@tantainnovative/ndpr-toolkit 2.4.1 → 3.0.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 (182) hide show
  1. package/README.md +226 -246
  2. package/dist/BreachReportForm-DpRrBoxU.d.ts +158 -0
  3. package/dist/BreachReportForm-yJ2Zl6gz.d.mts +158 -0
  4. package/dist/ConsentBanner-CDRT0o2k.d.mts +146 -0
  5. package/dist/ConsentBanner-Vxyt8SCX.d.ts +146 -0
  6. package/dist/{cross-border-entry-BrWVPly6.d.ts → CrossBorderTransferManager-D5Lc0e46.d.ts} +4 -5
  7. package/dist/{cross-border-entry-cCTvpwnT.d.mts → CrossBorderTransferManager-DkZhv9vD.d.mts} +4 -5
  8. package/dist/DPIAQuestionnaire-BkejviPj.d.mts +123 -0
  9. package/dist/DPIAQuestionnaire-DdSqXG3x.d.ts +123 -0
  10. package/dist/DSRRequestForm-BY8PogCU.d.mts +146 -0
  11. package/dist/DSRRequestForm-CHUg9cZh.d.ts +146 -0
  12. package/dist/DSRTracker-C6u_jAaK.d.mts +163 -0
  13. package/dist/DSRTracker-Dr_aT0pg.d.ts +163 -0
  14. package/dist/{lawful-basis-entry-CxZrofwG.d.mts → LawfulBasisTracker-CBqOxX1D.d.mts} +3 -5
  15. package/dist/{lawful-basis-entry-15qjKcNO.d.ts → LawfulBasisTracker-Cg30NbDA.d.ts} +3 -5
  16. package/dist/NDPRDashboard-CLJpEg0X.d.mts +44 -0
  17. package/dist/NDPRDashboard-DDWNd2Ah.d.ts +44 -0
  18. package/dist/{policy-E0fXZkda.d.mts → PolicyExporter-BIqSVjfC.d.mts} +4 -98
  19. package/dist/{policy-D2_jh5-T.d.ts → PolicyExporter-BNWaPBGU.d.ts} +4 -98
  20. package/dist/PolicyGenerator-BvcWPbxp.d.mts +96 -0
  21. package/dist/PolicyGenerator-BzRwtlgn.d.ts +96 -0
  22. package/dist/{ropa-entry-B0D7X1GV.d.ts → ROPAManager-BS4eB8Hw.d.mts} +4 -5
  23. package/dist/{ropa-entry-DiOThOc2.d.mts → ROPAManager-qxTrXLkD.d.ts} +4 -5
  24. package/dist/RegulatoryReportGenerator-BUYgzTTT.d.ts +282 -0
  25. package/dist/RegulatoryReportGenerator-DwcHcEFp.d.mts +282 -0
  26. package/dist/StepIndicator-D-nwRTyo.d.mts +171 -0
  27. package/dist/StepIndicator-D9ZATz_O.d.ts +171 -0
  28. package/dist/adapters.d.mts +25 -0
  29. package/dist/adapters.d.ts +25 -0
  30. package/dist/adapters.js +2 -0
  31. package/dist/adapters.mjs +2 -0
  32. package/dist/breach.d.mts +36 -431
  33. package/dist/breach.d.ts +36 -431
  34. package/dist/breach.js +1 -1
  35. package/dist/breach.mjs +1 -1
  36. package/dist/chunk-27NYSWUG.mjs +2 -0
  37. package/dist/chunk-2ORDHJRD.js +2 -0
  38. package/dist/chunk-2W7ARAW2.js +2 -0
  39. package/dist/chunk-3F34NACG.js +2 -0
  40. package/dist/chunk-3RGJV3VF.js +7 -0
  41. package/dist/chunk-3UWT64FI.mjs +2 -0
  42. package/dist/chunk-3V23O4ZJ.js +2 -0
  43. package/dist/chunk-3XAUN5IM.mjs +3 -0
  44. package/dist/chunk-5VMHKNJY.js +2 -0
  45. package/dist/chunk-6D3ZUGBB.mjs +2 -0
  46. package/dist/chunk-6E54NSAO.mjs +2 -0
  47. package/dist/chunk-7F5F5YWI.mjs +2 -0
  48. package/dist/chunk-7FIUX3ZM.js +89 -0
  49. package/dist/chunk-FR7ZYZXB.js +2 -0
  50. package/dist/chunk-FY5G6DGZ.js +7 -0
  51. package/dist/chunk-G26I6MP5.mjs +2 -0
  52. package/dist/chunk-GPJVTGHR.mjs +2 -0
  53. package/dist/chunk-GVANK6PL.js +3 -0
  54. package/dist/chunk-HNZK7LY3.mjs +2 -0
  55. package/dist/chunk-IKEPXHCZ.js +2 -0
  56. package/dist/chunk-IQQW52EF.js +2 -0
  57. package/dist/chunk-ISSGO2YT.mjs +72 -0
  58. package/dist/chunk-J6IKAGUP.mjs +89 -0
  59. package/dist/chunk-KHRBU5K7.js +2 -0
  60. package/dist/chunk-KNE4NXCY.mjs +7 -0
  61. package/dist/chunk-LFNA6WYQ.mjs +2 -0
  62. package/dist/chunk-NPI5T6NH.mjs +7 -0
  63. package/dist/chunk-NPLXE43Q.mjs +2 -0
  64. package/dist/chunk-P7BSBCB3.js +2 -0
  65. package/dist/chunk-PEH5GIMN.js +2 -0
  66. package/dist/chunk-RSUDIFZV.mjs +2 -0
  67. package/dist/chunk-SBNAMPAP.mjs +2 -0
  68. package/dist/chunk-SVCRYM4I.mjs +2 -0
  69. package/dist/chunk-U6VWHC46.js +72 -0
  70. package/dist/chunk-UK656RCG.js +2 -0
  71. package/dist/chunk-UNKXYVXY.js +2 -0
  72. package/dist/chunk-UOSEH6DC.js +2 -0
  73. package/dist/chunk-V37BM2LF.js +2 -0
  74. package/dist/chunk-V3MXWGXU.mjs +2 -0
  75. package/dist/chunk-VDZKGCAF.js +2 -0
  76. package/dist/chunk-WLSW4Z4W.mjs +2 -0
  77. package/dist/chunk-XSK4BSZJ.mjs +2 -0
  78. package/dist/chunk-YJCGEOLO.mjs +2 -0
  79. package/dist/chunk-ZCZ5RRZO.js +2 -0
  80. package/dist/compliance-score-racQe_E_.d.mts +115 -0
  81. package/dist/compliance-score-racQe_E_.d.ts +115 -0
  82. package/dist/consent.d.mts +67 -295
  83. package/dist/consent.d.ts +67 -295
  84. package/dist/consent.js +1 -1
  85. package/dist/consent.mjs +1 -1
  86. package/dist/core.d.mts +8 -5
  87. package/dist/core.d.ts +8 -5
  88. package/dist/core.js +1 -1
  89. package/dist/core.mjs +1 -1
  90. package/dist/cross-border-BBi9rZyO.d.mts +54 -0
  91. package/dist/cross-border-Dy-U9Hu6.d.ts +54 -0
  92. package/dist/{cross-border-BMcqLvjC.d.mts → cross-border-UyT00llA.d.mts} +1 -52
  93. package/dist/{cross-border-BMcqLvjC.d.ts → cross-border-UyT00llA.d.ts} +1 -52
  94. package/dist/cross-border.d.mts +32 -4
  95. package/dist/cross-border.d.ts +32 -4
  96. package/dist/cross-border.js +1 -1
  97. package/dist/cross-border.mjs +1 -1
  98. package/dist/dpia.d.mts +28 -284
  99. package/dist/dpia.d.ts +28 -284
  100. package/dist/dpia.js +1 -1
  101. package/dist/dpia.mjs +1 -1
  102. package/dist/dsr.d.mts +29 -300
  103. package/dist/dsr.d.ts +29 -300
  104. package/dist/dsr.js +1 -1
  105. package/dist/dsr.mjs +1 -1
  106. package/dist/hooks.d.mts +21 -10
  107. package/dist/hooks.d.ts +21 -10
  108. package/dist/hooks.js +1 -1
  109. package/dist/hooks.mjs +1 -1
  110. package/dist/index.d.mts +28 -18
  111. package/dist/index.d.ts +28 -18
  112. package/dist/index.js +1 -1
  113. package/dist/index.mjs +1 -1
  114. package/dist/lawful-basis.d.mts +31 -4
  115. package/dist/lawful-basis.d.ts +31 -4
  116. package/dist/lawful-basis.js +1 -1
  117. package/dist/lawful-basis.mjs +1 -1
  118. package/dist/policy.d.mts +36 -4
  119. package/dist/policy.d.ts +36 -4
  120. package/dist/policy.js +1 -1
  121. package/dist/policy.mjs +1 -1
  122. package/dist/presets.d.mts +124 -0
  123. package/dist/presets.d.ts +124 -0
  124. package/dist/presets.js +2 -0
  125. package/dist/presets.mjs +2 -0
  126. package/dist/{ropa-Li6UlL5H.d.ts → ropa-BDTM06tr.d.ts} +1 -49
  127. package/dist/{ropa-DP7pPPql.d.mts → ropa-CFHuT7jE.d.mts} +1 -49
  128. package/dist/ropa-CyynscU6.d.ts +51 -0
  129. package/dist/ropa-NIgxd8uP.d.mts +51 -0
  130. package/dist/ropa.d.mts +30 -4
  131. package/dist/ropa.d.ts +30 -4
  132. package/dist/ropa.js +1 -1
  133. package/dist/ropa.mjs +1 -1
  134. package/dist/styling-B7CBzYG7.d.ts +165 -0
  135. package/dist/styling-uJLsBbER.d.mts +165 -0
  136. package/dist/types-DK2CoKOC.d.mts +10 -0
  137. package/dist/types-DK2CoKOC.d.ts +10 -0
  138. package/dist/unstyled.d.mts +4 -4
  139. package/dist/unstyled.d.ts +4 -4
  140. package/dist/{useBreach-BBSoIcZO.d.mts → useBreach-CPr86Yan.d.mts} +18 -2
  141. package/dist/{useBreach-lFLbSyAN.d.ts → useBreach-DkVXvtJK.d.ts} +18 -2
  142. package/dist/{useConsent-D0pAfTlb.d.ts → useConsent-DCNkIJHR.d.mts} +12 -2
  143. package/dist/{useConsent-DOt2Njst.d.mts → useConsent-dOcELSfX.d.ts} +12 -2
  144. package/dist/{useCrossBorderTransfer-DmtACeqW.d.ts → useCrossBorderTransfer-BGNZt2lk.d.mts} +15 -3
  145. package/dist/{useCrossBorderTransfer-BZVFCXfr.d.mts → useCrossBorderTransfer-COqjgjsu.d.ts} +15 -3
  146. package/dist/{useDPIA-DBsg2yZx.d.ts → useDPIA-Dl16Te3r.d.ts} +13 -2
  147. package/dist/{useDPIA-Da7-Q_yW.d.mts → useDPIA-DzWye8JB.d.mts} +13 -2
  148. package/dist/{useDSR-YYZ6FYFs.d.mts → useDSR-C1LksCfP.d.mts} +13 -2
  149. package/dist/{useDSR-CYI7WCXr.d.ts → useDSR-DZel52O1.d.ts} +13 -2
  150. package/dist/{useDefaultPrivacyPolicy-CUluF_ic.d.mts → useDefaultPrivacyPolicy-BsYttRey.d.mts} +13 -2
  151. package/dist/{useDefaultPrivacyPolicy-B7kTHbZh.d.ts → useDefaultPrivacyPolicy-C-mG-A5S.d.ts} +13 -2
  152. package/dist/{useLawfulBasis-CpWuHtyh.d.mts → useLawfulBasis-CKJ-kw84.d.mts} +13 -2
  153. package/dist/{useLawfulBasis-CCWF9waR.d.ts → useLawfulBasis-DFTmu1ca.d.ts} +13 -2
  154. package/dist/{useROPA-BhJ3kvHp.d.ts → useROPA-BSSU1rfx.d.ts} +14 -2
  155. package/dist/{useROPA-DLFdjkxP.d.mts → useROPA-C2hjaBTz.d.mts} +14 -2
  156. package/package.json +18 -2
  157. package/dist/chunk-2XFAV267.mjs +0 -2
  158. package/dist/chunk-32UIWTGD.js +0 -72
  159. package/dist/chunk-3YCV2BA6.js +0 -2
  160. package/dist/chunk-4A354HL3.js +0 -2
  161. package/dist/chunk-5ZBO2UPH.js +0 -2
  162. package/dist/chunk-6GGGTRDZ.mjs +0 -2
  163. package/dist/chunk-BGHQTZAC.js +0 -94
  164. package/dist/chunk-BZTTQS4A.mjs +0 -7
  165. package/dist/chunk-EKVTLHBQ.js +0 -2
  166. package/dist/chunk-GMLNWS2N.mjs +0 -2
  167. package/dist/chunk-IBEKLDBY.mjs +0 -2
  168. package/dist/chunk-K3GMTMQ6.js +0 -2
  169. package/dist/chunk-L52PDW6O.mjs +0 -2
  170. package/dist/chunk-LI6WJ3LZ.js +0 -2
  171. package/dist/chunk-LXRXDTPI.js +0 -2
  172. package/dist/chunk-NW4A3JW6.mjs +0 -2
  173. package/dist/chunk-OITITR6K.mjs +0 -2
  174. package/dist/chunk-PDJGTQMY.mjs +0 -2
  175. package/dist/chunk-SKJCQKFL.mjs +0 -94
  176. package/dist/chunk-T44JQT2O.mjs +0 -2
  177. package/dist/chunk-TCJCE6WN.js +0 -2
  178. package/dist/chunk-VMJBW3EF.mjs +0 -2
  179. package/dist/chunk-WW3X3ELF.js +0 -2
  180. package/dist/chunk-XMYUYQH7.mjs +0 -72
  181. package/dist/chunk-ZNTMZ6NM.js +0 -7
  182. package/dist/chunk-ZU73VG3X.js +0 -2
@@ -0,0 +1,3 @@
1
+ import {a as a$2}from'./chunk-FXTZDKDC.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {a as a$1,b}from'./chunk-WWT2ZSNU.mjs';import {useState}from'react';import {jsxs,jsx}from'react/jsx-runtime';var qe=({categories:pe,onSubmit:ge,onValidationError:N,title:be="Report a Data Breach",formDescription:fe="Use this form to report a suspected or confirmed data breach in accordance with NDPA Section 40. All fields marked with * are required.",submitButtonText:ue="Submit Report",className:M="",buttonClassName:z="",classNames:d={},unstyled:c=false,isSubmitting:f=false,showConfirmation:ve=true,confirmationMessage:he="Your breach report has been submitted successfully. The data protection team has been notified.",allowAttachments:ye=true,maxAttachments:A=5,maxFileSize:k=5*1024*1024,allowedFileTypes:w=[".pdf",".jpg",".jpeg",".png",".doc",".docx",".xls",".xlsx",".txt"],defaultValues:t,onReset:S})=>{var ie,oe,se,ne,de;let L=r=>{if(!r)return "";let o=new Date(r),l=s=>String(s).padStart(2,"0");return `${o.getFullYear()}-${l(o.getMonth()+1)}-${l(o.getDate())}T${l(o.getHours())}:${l(o.getMinutes())}`},[D,O]=useState((t==null?void 0:t.title)||""),[C,Y]=useState((t==null?void 0:t.description)||""),[F,U]=useState((t==null?void 0:t.category)||""),[T,H]=useState(L(t==null?void 0:t.discoveredAt)),[R,_]=useState(L(t==null?void 0:t.occurredAt)),[B,Z]=useState(((ie=t==null?void 0:t.reporter)==null?void 0:ie.name)||""),[h,G]=useState(((oe=t==null?void 0:t.reporter)==null?void 0:oe.email)||""),[j,K]=useState(((se=t==null?void 0:t.reporter)==null?void 0:se.department)||""),[E,W]=useState(((ne=t==null?void 0:t.reporter)==null?void 0:ne.phone)||""),[J,Q]=useState((t==null?void 0:t.affectedSystems)||[]),[xe,X]=useState(((de=t==null?void 0:t.affectedSystems)==null?void 0:de.join(", "))||""),[q,V]=useState((t==null?void 0:t.dataTypes)||[]),[u,ee]=useState((t==null?void 0:t.estimatedAffectedSubjects)!=null?String(t.estimatedAffectedSubjects):""),[re,te]=useState((t==null?void 0:t.status)||"ongoing"),[I,ae]=useState((t==null?void 0:t.initialActions)||""),[y,$]=useState([]),[Ne,P]=useState(false),[i,v]=useState({}),Ae=()=>{O(""),Y(""),U(""),H(""),_(""),Z(""),G(""),K(""),W(""),Q([]),X(""),V([]),ee(""),te("ongoing"),ae(""),$([]),P(false),v({}),S==null||S();},ke=r=>{let o=r.target.value;X(o);let l=o.split(",").map(s=>s.trim()).filter(Boolean);Q(l);},we=r=>{V(o=>o.includes(r)?o.filter(l=>l!==r):[...o,r]);},Se=r=>{var me;let o=r.target.files;if(!o)return;let l=[],s={};if(y.length+o.length>A){s.attachments=`Maximum of ${A} files allowed`,v(p=>a$1(a$1({},p),s));return}for(let p=0;p<o.length;p++){let x=o[p];if(x.size>k){s.attachments=`File ${x.name} exceeds the maximum size of ${k/(1024*1024)}MB`;continue}let ce="."+((me=x.name.split(".").pop())==null?void 0:me.toLowerCase());if(!w.includes(ce)){s.attachments=`File type ${ce} is not allowed`;continue}l.push(x);}Object.keys(s).length>0?v(p=>a$1(a$1({},p),s)):($(p=>[...p,...l]),v(p=>b(a$1({},p),{attachments:""})));},De=r=>{$(o=>o.filter((l,s)=>s!==r));},Ce=()=>{let r={};return D.trim()||(r.breachTitle="Breach title is required"),C.trim()||(r.description="Description is required"),F||(r.category="Category is required"),T||(r.discoveredAt="Discovery date is required"),B.trim()||(r.reporterName="Reporter name is required"),h.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(h)||(r.reporterEmail="Reporter email is invalid"):r.reporterEmail="Reporter email is required",j.trim()||(r.reporterDepartment="Reporter department is required"),J.length===0&&(r.affectedSystems="At least one affected system is required"),q.length===0&&(r.dataTypes="At least one data type is required"),u&&isNaN(Number(u))&&(r.estimatedAffectedSubjects="Estimated affected subjects must be a number"),v(r),r},Fe=r=>{r.preventDefault();let o=Ce();if(Object.keys(o).length>0){N==null||N(o);return}let l={title:a$2(D),description:a$2(C),category:F,discoveredAt:new Date(T).getTime(),occurredAt:R?new Date(R).getTime():void 0,reportedAt:Date.now(),reporter:{name:a$2(B),email:a$2(h),department:a$2(j),phone:E?a$2(E):void 0},affectedSystems:J.map(s=>a$2(s)),dataTypes:q,estimatedAffectedSubjects:u?Number(u):void 0,status:re,initialActions:I?a$2(I):void 0,attachments:y.map(s=>({name:s.name,type:s.type,size:s.size,file:s}))};ge(l),ve&&P(true);};if(Ne)return jsxs("div",{className:`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${M}`,children:[jsx("h2",{className:"text-lg font-bold text-green-800 dark:text-green-200 mb-2",children:"Report Submitted"}),jsx("p",{className:"text-green-700 dark:text-green-300",children:he}),jsxs("div",{className:"mt-4 p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-md",children:[jsx("h3",{className:"text-sm font-bold text-yellow-800 dark:text-yellow-200 mb-2",children:"Important: Next Steps"}),jsx("p",{className:"text-yellow-700 dark:text-yellow-300 text-sm",children:"Under the NDPA (Section 40), data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."})]}),jsx("button",{onClick:()=>P(false),className:`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${z}`,children:"Report Another Breach"})]});let Te=[{id:"personal",label:"Personal Information (names, addresses)"},{id:"contact",label:"Contact Information (email, phone)"},{id:"financial",label:"Financial Information (bank details, payment info)"},{id:"health",label:"Health Information"},{id:"identification",label:"Identification Documents (ID cards, passports)"},{id:"login",label:"Login Credentials"},{id:"biometric",label:"Biometric Data"},{id:"children",label:"Children's Data"},{id:"location",label:"Location Data"},{id:"communications",label:"Communications Content"}];return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${M}`,d.root,c),children:[jsx("h2",{className:a("text-xl font-bold mb-2",d.title,c),children:be}),jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:fe}),jsx("form",{onSubmit:Fe,className:a("",d.form,c),children:jsxs("div",{className:"space-y-6",children:[jsxs("div",{className:a("",d.fieldGroup,c),children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Breach Information"}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"breachTitle",className:a("block text-sm font-medium mb-1",d.label,c),children:["Breach Title/Summary ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"breachTitle",value:D,onChange:r=>O(r.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.input,c),required:true,"aria-invalid":!!i.breachTitle,"aria-describedby":i.breachTitle?"breachTitle-error":void 0}),i.breachTitle&&jsx("p",{id:"breachTitle-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.breachTitle})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"category",className:a("block text-sm font-medium mb-1",d.label,c),children:["Breach Category ",jsx("span",{className:"text-red-500",children:"*"})]}),jsxs("select",{id:"category",value:F,onChange:r=>U(r.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.select,c),required:true,"aria-invalid":!!i.category,"aria-describedby":i.category?"category-error":void 0,children:[jsx("option",{value:"",children:"Select a category"}),pe.map(r=>jsx("option",{value:r.id,children:r.name},r.id))]}),i.category&&jsx("p",{id:"category-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.category})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{htmlFor:"description",className:a("block text-sm font-medium mb-1",d.label,c),children:["Detailed Description ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("textarea",{id:"description",value:C,onChange:r=>Y(r.target.value),rows:4,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.textarea,c),required:true,"aria-invalid":!!i.description,"aria-describedby":i.description?"description-error":void 0}),i.description&&jsx("p",{id:"description-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.description})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"discoveredAt",className:"block text-sm font-medium mb-1",children:["Date Discovered ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"datetime-local",id:"discoveredAt",value:T,onChange:r=>H(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.discoveredAt,"aria-describedby":i.discoveredAt?"discoveredAt-error":void 0}),i.discoveredAt&&jsx("p",{id:"discoveredAt-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.discoveredAt})]}),jsxs("div",{children:[jsx("label",{htmlFor:"occurredAt",className:"block text-sm font-medium mb-1",children:"Date Occurred (if known)"}),jsx("input",{type:"datetime-local",id:"occurredAt",value:R,onChange:r=>_(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Reporter Information"}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"reporterName",className:"block text-sm font-medium mb-1",children:["Your Name ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"reporterName",value:B,onChange:r=>Z(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.reporterName,"aria-describedby":i.reporterName?"reporterName-error":void 0}),i.reporterName&&jsx("p",{id:"reporterName-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.reporterName})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"reporterEmail",className:"block text-sm font-medium mb-1",children:["Your Email ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"email",id:"reporterEmail",value:h,onChange:r=>G(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.reporterEmail,"aria-describedby":i.reporterEmail?"reporterEmail-error":void 0}),i.reporterEmail&&jsx("p",{id:"reporterEmail-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.reporterEmail})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"reporterDepartment",className:"block text-sm font-medium mb-1",children:["Your Department ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"reporterDepartment",value:j,onChange:r=>K(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.reporterDepartment,"aria-describedby":i.reporterDepartment?"reporterDepartment-error":void 0}),i.reporterDepartment&&jsx("p",{id:"reporterDepartment-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.reporterDepartment})]}),jsxs("div",{children:[jsx("label",{htmlFor:"reporterPhone",className:"block text-sm font-medium mb-1",children:"Your Phone Number (Optional)"}),jsx("input",{type:"tel",id:"reporterPhone",value:E,onChange:r=>W(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Impact Information"}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"affectedSystems",className:"block text-sm font-medium mb-1",children:["Affected Systems/Applications ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"affectedSystems",value:xe,onChange:ke,placeholder:"e.g. CRM, Email Server, Website (comma separated)",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.affectedSystems,"aria-describedby":i.affectedSystems?"affectedSystems-error":void 0}),i.affectedSystems&&jsx("p",{id:"affectedSystems-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.affectedSystems})]}),jsxs("div",{children:[jsx("label",{htmlFor:"estimatedAffectedSubjects",className:"block text-sm font-medium mb-1",children:"Estimated Number of Affected Data Subjects"}),jsx("input",{type:"text",id:"estimatedAffectedSubjects",value:u,onChange:r=>ee(r.target.value),placeholder:"e.g. 100",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]","aria-invalid":!!i.estimatedAffectedSubjects,"aria-describedby":i.estimatedAffectedSubjects?"estimatedAffectedSubjects-error":void 0}),i.estimatedAffectedSubjects&&jsx("p",{id:"estimatedAffectedSubjects-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.estimatedAffectedSubjects})]}),jsxs("div",{className:"md:col-span-2",children:[jsxs("label",{className:"block text-sm font-medium mb-1",children:["Types of Data Involved ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:Te.map(r=>jsxs("div",{className:"flex items-center",children:[jsx("input",{type:"checkbox",id:`dataType_${r.id}`,checked:q.includes(r.id),onChange:()=>we(r.id),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsx("label",{htmlFor:`dataType_${r.id}`,className:"ml-2 text-sm text-gray-700 dark:text-gray-300",children:r.label})]},r.id))}),i.dataTypes&&jsx("p",{id:"dataTypes-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.dataTypes})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"status",className:"block text-sm font-medium mb-1",children:["Current Status ",jsx("span",{className:"text-red-500",children:"*"})]}),jsxs("select",{id:"status",value:re,onChange:r=>te(r.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.select,c),required:true,children:[jsx("option",{value:"ongoing",children:"Ongoing (breach is still active)"}),jsx("option",{value:"contained",children:"Contained (breach is stopped but not resolved)"}),jsx("option",{value:"resolved",children:"Resolved (breach is fully addressed)"})]})]}),jsxs("div",{className:"md:col-span-2",children:[jsx("label",{htmlFor:"initialActions",className:"block text-sm font-medium mb-1",children:"Initial Actions Taken"}),jsx("textarea",{id:"initialActions",value:I,onChange:r=>ae(r.target.value),placeholder:"Describe any immediate actions that have been taken to address the breach",rows:3,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.textarea,c)})]})]})]}),ye&&jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Attachments"}),jsxs("div",{className:"mb-4",children:[jsx("label",{className:"block text-sm font-medium mb-1",children:"Upload Supporting Files (Optional)"}),jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-2",children:["Max ",A," files, ",k/(1024*1024),"MB each. Allowed types: ",w.join(", ")]}),jsx("input",{type:"file",onChange:Se,multiple:true,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",accept:w.join(",")}),i.attachments&&jsx("p",{id:"attachments-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.attachments})]}),y.length>0&&jsxs("div",{className:"mb-4",children:[jsx("h4",{className:"text-sm font-medium mb-2",children:"Attached Files:"}),jsx("ul",{className:"space-y-2",children:y.map((r,o)=>jsxs("li",{className:"flex items-center justify-between p-2 bg-gray-50 dark:bg-gray-700 rounded",children:[jsxs("div",{className:"flex items-center",children:[jsx("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400 mr-2",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{fillRule:"evenodd",d:"M8 4a3 3 0 00-3 3v4a5 5 0 0010 0V7a1 1 0 112 0v4a7 7 0 11-14 0V7a5 5 0 0110 0v4a3 3 0 11-6 0V7a1 1 0 012 0v4a1 1 0 102 0V7a3 3 0 00-3-3z",clipRule:"evenodd"})}),jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:r.name}),jsxs("span",{className:"ml-2 text-xs text-gray-600 dark:text-gray-400",children:["(",(r.size/1024).toFixed(1)," KB)"]})]}),jsx("button",{type:"button",onClick:()=>De(o),className:"text-red-500 hover:text-red-700",children:jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},o))})]})]}),jsxs("div",{className:a("mt-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",d.notice,c),children:[jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"NDPA Breach Notification Requirements"}),jsx("p",{className:"text-blue-700 dark:text-blue-300 text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."})]}),jsxs("div",{className:"mt-6 relative flex gap-3",children:[f&&d.loadingOverlay&&jsx("div",{className:d.loadingOverlay}),jsx("button",{type:"submit",disabled:f,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 ${z} ${f?"opacity-50 cursor-not-allowed":""}`,d.primaryButton||d.submitButton,c),children:f?"Submitting...":ue}),jsx("button",{type:"button",onClick:Ae,disabled:f,className:a("px-6 py-3 bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",void 0,c),children:"Reset"})]})]})})]})};
2
+ export{qe as a};//# sourceMappingURL=chunk-3XAUN5IM.mjs.map
3
+ //# sourceMappingURL=chunk-3XAUN5IM.mjs.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunk3F34NACG_js=require('./chunk-3F34NACG.js'),chunkY34DQYS7_js=require('./chunk-Y34DQYS7.js'),chunkUK656RCG_js=require('./chunk-UK656RCG.js'),react=require('react');function F(n){if(!n)return chunkUK656RCG_js.a("ndpr_consent");let{storageKey:o="ndpr_consent",storageType:i="localStorage"}=n;return i==="sessionStorage"?chunk3F34NACG_js.a(o):i==="cookie"?chunk3F34NACG_js.b(o,n.cookieOptions):chunkUK656RCG_js.a(o)}function k(n,o,i,r,a,g,l){if(n){i(n);let{valid:s,errors:c}=chunkY34DQYS7_js.a(n);r(s),a(c),g(!(s&&n.version===o));}else g(true);l(false);}function z({options:n,adapter:o,storageOptions:i,version:r="1.0",onChange:a}){let g=o!=null?o:F(i),l=react.useRef(g);l.current=g;let[s,c]=react.useState(null),[y,d]=react.useState(false),[E,C]=react.useState(false),[w,S]=react.useState([]),[I,v]=react.useState(true);react.useEffect(()=>{let e=false;try{let t=l.current.load();t instanceof Promise?t.then(m=>{e||k(m,r,c,C,S,d,v);},()=>{e||(d(!0),v(!1));}):k(t,r,c,C,S,d,v);}catch(t){e||(d(true),v(false));}return ()=>{e=true;}},[r]);let h=react.useCallback(e=>{let{valid:t,errors:m}=chunkY34DQYS7_js.a(e);C(t),S(m),a==null||a(e),Promise.resolve(l.current.save(e)).catch(P=>{console.warn("[ndpr-toolkit] Failed to save consent:",P);});},[a]),f=react.useCallback(e=>{let t={consents:e,timestamp:Date.now(),version:r,method:"explicit",hasInteracted:true};c(t),h(t),d(false);},[r,h]),L=react.useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=true;}),f(e);},[n,f]),U=react.useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=t.required||false;}),f(e);},[n,f]),V=react.useCallback(e=>!!(s!=null&&s.consents[e]),[s]),j=react.useCallback(()=>{c(null),d(true),C(false),S([]),Promise.resolve(l.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove consent:",e);});},[]);return {settings:s,hasConsent:V,updateConsent:f,acceptAll:L,rejectAll:U,shouldShowBanner:y,isValid:E,validationErrors:w,resetConsent:j,isLoading:I}}exports.a=z;//# sourceMappingURL=chunk-5VMHKNJY.js.map
2
+ //# sourceMappingURL=chunk-5VMHKNJY.js.map
@@ -0,0 +1,2 @@
1
+ import {a as a$2}from'./chunk-FXTZDKDC.mjs';import {a}from'./chunk-AYKLAEOU.mjs';import {b,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useState}from'react';import {jsxs,jsx}from'react/jsx-runtime';var lr=({requestTypes:I,onSubmit:Q,onValidationError:q,title:X="Submit a Data Subject Request",description:V="Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part IV, Sections 29-36.",submitButtonText:s="Submit Request",className:A="",buttonClassName:D="",showConfirmation:N=true,confirmationMessage:rr="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:_=true,identifierTypes:k=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:er=true,labels:y={},classNames:r,unstyled:o=false,isSubmitting:f=false,defaultValues:g,onReset:S})=>{var G,Y,H,L,U,W;let[c,P]=useState((g==null?void 0:g.requestType)||""),[R,j]=useState(((G=g==null?void 0:g.dataSubject)==null?void 0:G.fullName)||""),[x,E]=useState(((Y=g==null?void 0:g.dataSubject)==null?void 0:Y.email)||""),[F,O]=useState(((H=g==null?void 0:g.dataSubject)==null?void 0:H.phone)||""),[B,z]=useState(((L=g==null?void 0:g.dataSubject)==null?void 0:L.identifierType)||((U=k[0])==null?void 0:U.id)||""),[T,M]=useState(((W=g==null?void 0:g.dataSubject)==null?void 0:W.identifierValue)||""),[b$1,w]=useState((g==null?void 0:g.additionalInfo)||{}),[ir,$]=useState(false),[d,Z]=useState({}),tr=()=>{var e;P(""),j(""),E(""),O(""),z(((e=k[0])==null?void 0:e.id)||""),M(""),w({}),$(false),Z({}),S==null||S();},u=I.find(e=>e.id===c),or=e=>{P(e.target.value),w({});},v=(e,a)=>{w(l=>b(a$1({},l),{[e]:a}));},nr=()=>{let e={};return R.trim()||(e.fullName="Full name is required"),x.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(x)||(e.email="Email is invalid"):e.email="Email is required",c||(e.requestType="Please select a request type"),_&&!T.trim()&&(e.identifierValue="Identifier value is required"),u!=null&&u.requiresAdditionalInfo&&u.additionalFields&&u.additionalFields.forEach(a=>{a.required&&!b$1[a.id]&&(e[`additional_${a.id}`]=`${a.label} is required`);}),Z(e),e},dr=e=>{e.preventDefault();let a=nr();if(Object.keys(a).length>0){q==null||q(a);return}let l=Object.keys(b$1).length>0?Object.fromEntries(Object.entries(b$1).map(([ar,C])=>[ar,typeof C=="string"?a$2(C):C])):void 0,h={requestType:c,dataSubject:{fullName:a$2(R),email:a$2(x),phone:F?a$2(F):void 0,identifierType:B,identifierValue:a$2(T)},additionalInfo:l,submittedAt:Date.now()};Q(h),N&&$(true);};return ir?jsxs("div",{className:a(`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${A}`,r==null?void 0:r.successMessage,o),children:[jsx("h2",{className:a("text-lg font-bold text-green-800 dark:text-green-200 mb-2",r==null?void 0:r.title,o),children:"Request Submitted"}),jsx("p",{className:a("text-green-700 dark:text-green-300",r==null?void 0:r.description,o),children:rr}),jsx("button",{onClick:()=>$(false),className:a(`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${D}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:"Submit Another Request"})]}):jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${A}`,r==null?void 0:r.root,o),children:[jsx("h2",{className:a("text-xl font-bold mb-2",r==null?void 0:r.title,o),children:X}),jsx("p",{className:a("mb-6 text-gray-600 dark:text-gray-300",r==null?void 0:r.description,o),children:V}),jsx("form",{onSubmit:dr,className:a("",r==null?void 0:r.form,o),children:jsxs("div",{className:a("space-y-4",r==null?void 0:r.fieldGroup,o),children:[jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Personal Information"}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"fullName",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[y.name||"Full Name"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"fullName",value:R,onChange:e=>j(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:true,"aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsx("p",{id:"fullName-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.fullName})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"email",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[y.email||"Email Address"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"email",id:"email",value:x,onChange:e=>E(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:true,"aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsx("p",{id:"email-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.email})]}),er&&jsxs("div",{children:[jsx("label",{htmlFor:"phone",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:"Phone Number (Optional)"}),jsx("input",{type:"tel",id:"phone",value:F,onChange:e=>O(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o)})]})]})]}),jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Request Details"}),jsxs("div",{className:"mb-4",children:[jsxs("label",{htmlFor:"requestType",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[y.requestType||"Request Type"," ",jsx("span",{className:"text-red-500",children:"*"})]}),jsxs("select",{id:"requestType",value:c,onChange:or,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),required:true,"aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsx("option",{value:"",children:"Select a request type"}),I.map(e=>jsx("option",{value:e.id,children:e.name},e.id))]}),d.requestType&&jsx("p",{id:"requestType-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.requestType})]}),u&&jsxs("div",{className:"mb-4 p-3 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-2",children:u.description}),jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Estimated completion time: ",u.estimatedCompletionTime," ",u.estimatedCompletionTime===1?"day":"days"]})]}),jsxs("div",{className:"mb-4",children:[jsx("label",{htmlFor:"requestDescription",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:y.description||"Additional Information"}),jsx("textarea",{id:"requestDescription",className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.textarea,o),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),_&&jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Identity Verification"}),jsx("p",{className:"text-sm text-gray-600 dark:text-gray-300 mb-3",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxs("div",{children:[jsxs("label",{htmlFor:"identifierType",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:["Identifier Type ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("select",{id:"identifierType",value:B,onChange:e=>z(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),required:true,children:k.map(e=>jsx("option",{value:e.id,children:e.label},e.id))})]}),jsxs("div",{children:[jsxs("label",{htmlFor:"identifierValue",className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:["Identifier Value ",jsx("span",{className:"text-red-500",children:"*"})]}),jsx("input",{type:"text",id:"identifierValue",value:T,onChange:e=>M(e.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:true,"aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsx("p",{id:"identifierValue-error",role:"alert",className:"mt-1 text-sm text-red-500",children:d.identifierValue})]})]})]}),(u==null?void 0:u.requiresAdditionalInfo)&&u.additionalFields&&u.additionalFields.length>0&&jsxs("div",{children:[jsx("h3",{className:"text-lg font-semibold mb-3",children:"Additional Information"}),jsx("div",{className:"space-y-4",children:u.additionalFields.map(e=>jsxs("div",{children:[jsxs("label",{htmlFor:e.id,className:a("block text-sm font-medium mb-1",r==null?void 0:r.label,o),children:[e.label," ",e.required&&jsx("span",{className:"text-red-500",children:"*"})]}),e.type==="text"&&jsx("input",{type:"text",id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),placeholder:e.placeholder,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),e.type==="textarea"&&jsx("textarea",{id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),placeholder:e.placeholder,className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.textarea,o),rows:4,required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),e.type==="select"&&e.options&&jsxs("select",{id:e.id,value:b$1[e.id]||"",onChange:a=>v(e.id,a.target.value),className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.select,o),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0,children:[jsx("option",{value:"",children:e.placeholder||"Select an option"}),e.options.map(a=>jsx("option",{value:a,children:a},a))]}),e.type==="checkbox"&&jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{type:"checkbox",id:e.id,checked:!!b$1[e.id],onChange:a=>v(e.id,a.target.checked),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0})}),jsx("div",{className:"ml-3 text-sm",children:jsx("label",{htmlFor:e.id,className:"text-gray-700 dark:text-gray-300",children:e.placeholder||e.label})})]}),e.type==="file"&&jsx("input",{type:"file",id:e.id,onChange:a=>{var h;let l=(h=a.target.files)==null?void 0:h[0];l&&v(e.id,l);},className:a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.input,o),required:e.required,"aria-invalid":!!d[`additional_${e.id}`],"aria-describedby":d[`additional_${e.id}`]?`additional-${e.id}-error`:void 0}),d[`additional_${e.id}`]&&jsx("p",{id:`additional-${e.id}-error`,role:"alert",className:"mt-1 text-sm text-red-500",children:d[`additional_${e.id}`]})]},e.id))})]}),jsxs("div",{className:"mt-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsx("h3",{className:"text-sm font-semibold mb-2",children:"Privacy Notice"}),jsx("p",{className:"text-xs text-gray-600 dark:text-gray-300",children:"The information you provide in this form will be used solely for the purpose of processing your data subject request. We will retain this information for as long as necessary to fulfill your request and to comply with our legal obligations. For more information, please refer to our Privacy Policy."})]}),jsxs("div",{className:"mt-6 flex gap-3 relative",children:[f&&(r==null?void 0:r.loadingOverlay)&&jsx("div",{className:r.loadingOverlay}),jsx("button",{type:"submit",disabled:f,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 ${D} ${f?"opacity-50 cursor-not-allowed":""}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),o),children:f?"Submitting...":y.submit||s}),jsx("button",{type:"button",onClick:tr,className:a("px-6 py-3 bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",void 0,o),children:"Reset"})]})]})})]})};export{lr as a};//# sourceMappingURL=chunk-6D3ZUGBB.mjs.map
2
+ //# sourceMappingURL=chunk-6D3ZUGBB.mjs.map
@@ -0,0 +1,2 @@
1
+ import {a,d}from'./chunk-CAB7O3GR.mjs';import {a as a$2}from'./chunk-SBNAMPAP.mjs';import {b,a as a$1}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect}from'react';function _(f,s){return s?a$2(f):{load:()=>null,save:()=>{},remove:()=>{}}}function z({templates:f,initialPolicy:s,adapter:y,storageKey:T="ndpr_privacy_policy",useLocalStorage:I=true,onGenerate:p}){let P=y!=null?y:_(T,I),o=useRef(P);o.current=P;let[a$2,d]=useState(s||null),[u,g]=useState(null),[m,h]=useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),[w,v]=useState(true);useEffect(()=>{if(s){v(false);return}let e=false;try{let n=o.current.load(),i=t=>{if(t){if(d(t),t.templateId){let l=f.find(U=>U.id===t.templateId);l&&g(l);}t.organizationInfo&&h(t.organizationInfo);}v(!1);};n instanceof Promise?n.then(t=>{e||i(t);},()=>{e||v(!1);}):i(n);}catch(n){e||v(false);}return ()=>{e=true;}},[s,f]);let x=e=>{Promise.resolve(o.current.save(e)).catch(n=>{console.warn("[ndpr-toolkit] Failed to save policy:",n);});},E=e=>{let n=f.find(l=>l.id===e);if(!n)return false;g(n);n.sections.map(l=>b(a$1({},l),{customContent:void 0}));return Object.keys(n.variables).forEach(l=>{n.variables[l].defaultValue||"";}),true},q=e=>{h(n=>a$1(a$1({},n),e));},N=(e,n)=>{u&&(a$2?d(i=>i&&b(a$1({},i),{sections:i.sections.map(t=>t.id===e?b(a$1({},t),{included:n}):t)})):g(i=>i&&b(a$1({},i),{sections:i.sections.map(t=>t.id===e?b(a$1({},t),{included:n}):t)})));},D=(e,n)=>{u&&(a$2?d(i=>i&&b(a$1({},i),{sections:i.sections.map(t=>t.id===e?b(a$1({},t),{customContent:n}):t)})):g(i=>i&&b(a$1({},i),{sections:i.sections.map(t=>t.id===e?b(a$1({},t),{customContent:n}):t)})));},C=(e,n)=>{a$2&&d(i=>i&&b(a$1({},i),{variableValues:b(a$1({},i.variableValues),{[e]:n})}));},R=()=>"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);return {policy:a$2,selectedTemplate:u,organizationInfo:m,selectTemplate:E,updateOrganizationInfo:q,toggleSection:N,updateSectionContent:D,updateVariableValue:C,generatePolicy:()=>{if(!u)throw new Error("No template selected");let e=Date.now(),n={id:(a$2==null?void 0:a$2.id)||R(),title:`Privacy Policy for ${m.name}`,templateId:u.id,organizationInfo:m,sections:u.sections.map(i=>{var t;return b(a$1({},i),{customContent:(t=a$2==null?void 0:a$2.sections.find(l=>l.id===i.id))==null?void 0:t.customContent})}),variableValues:(a$2==null?void 0:a$2.variableValues)||{},effectiveDate:e,lastUpdated:e,version:"1.0"};return d(n),x(n),p&&p(n),n},getPolicyText:()=>{if(!a$2)return {fullText:"",sectionTexts:{},missingVariables:[]};let e=a(a$2.sections,a$2.organizationInfo);return typeof e=="string"?{fullText:e,sectionTexts:{full:e},missingVariables:[]}:e},resetPolicy:()=>{d(null),g(null),h({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),Promise.resolve(o.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove policy:",e);});},isValid:()=>{let e=[];if(u||e.push("No template selected"),m.name||e.push("Organization name is required"),m.website||e.push("Organization website is required"),m.privacyEmail||e.push("Privacy contact email is required"),u){let n=u.sections.filter(t=>t.required),i=(a$2==null?void 0:a$2.sections.filter(t=>t.included))||[];n.forEach(t=>{i.some(l=>l.id===t.id)||e.push(`Required section "${t.title}" must be included`);});}return u&&a$2&&Object.entries(u.variables).forEach(([n,i])=>{i.required&&!a$2.variableValues[n]&&e.push(`Required variable "${i.name}" must have a value`);}),{valid:e.length===0,errors:e}},isLoading:w}}function W(f={}){let{orgInfo:s,storageKey:y,useLocalStorage:T}=f,{sections:I,variables:p}=d();if(s)for(let o of p)s.name&&o.name==="orgName"&&(o.value=s.name),s.email&&o.name==="privacyEmail"&&(o.value=s.email),s.dpoName&&o.name==="dpoName"&&(o.value=s.dpoName);let P={id:"default-business",name:"Default Business Policy",description:"NDPA-compliant privacy policy template for businesses.",organizationType:"business",sections:I,variables:Object.fromEntries(p.map(o=>[o.name,{name:o.name,description:o.description,required:o.required,defaultValue:o.value||void 0}])),version:"1.0",lastUpdated:Date.now(),ndpaCompliant:true};return z({templates:[P],storageKey:y,useLocalStorage:T})}export{z as a,W as b};//# sourceMappingURL=chunk-6E54NSAO.mjs.map
2
+ //# sourceMappingURL=chunk-6E54NSAO.mjs.map
@@ -0,0 +1,2 @@
1
+ import {a as a$1}from'./chunk-AYKLAEOU.mjs';import {a,b}from'./chunk-WWT2ZSNU.mjs';import {useState,useRef,useCallback,useEffect}from'react';import {createPortal}from'react-dom';import {jsx,jsxs}from'react/jsx-runtime';var lt=({options:d,onSave:J,title:M="We Value Your Privacy",description:W="We use cookies and similar technologies to provide our services and enhance your experience. Your consent is collected in accordance with NDPA Sections 25-26.",acceptAllButtonText:Y="Accept All",rejectAllButtonText:K="Reject All",customizeButtonText:Q="Customize",saveButtonText:U="Save Preferences",position:A="bottom",zIndex:T=9999,version:f="1.0",show:p,manageStorage:R=true,storageKey:E="ndpr_consent",className:X="",buttonClassName:y="",primaryButtonClassName:q="",secondaryButtonClassName:Z="",classNames:t,unstyled:o,onAnalytics:h})=>{let[g,u]=useState(false),[v,a$2]=useState(false),[C,B]=useState({}),z=useRef(null),$=useRef(null),j=useRef(false),b$1=useCallback((e,n)=>{h==null||h(a({action:e,timestamp:Date.now(),version:f},n!==void 0?{categories:n}:{}));},[h,f]);useEffect(()=>{let e={};if(d.forEach(n=>{e[n.id]=n.defaultValue||false;}),B(e),p===void 0)if(!R)u(true);else {let n=localStorage.getItem(E);if(n)try{JSON.parse(n).version!==f?u(!0):u(!1);}catch(D){u(true);}else u(true);}else u(p);},[d,E,f,R]),useEffect(()=>{p!==void 0&&u(p);},[p]);let s=()=>{let e={};d.forEach(n=>{e[n.id]=true;}),b$1("accepted_all",e),P(e);},N=()=>{let e={};d.forEach(n=>{e[n.id]=n.required||false;}),b$1("rejected_all",e),P(e);},tt=(e,n)=>{B(D=>b(a({},D),{[e]:n}));},et=()=>{let e={};d.forEach(n=>{e[n.id]=true;}),B(e);},nt=()=>{let e={};d.forEach(n=>{e[n.id]=n.required||false;}),B(e);},H=d.length>0&&d.every(e=>C[e.id]),rt=()=>{b$1("customized",C),P(C);},P=e=>{let n={consents:e,timestamp:Date.now(),version:f,method:v?"customize":"banner",hasInteracted:true};R&&localStorage.setItem(E,JSON.stringify(n)),J(n),u(false),a$2(false);},_=useCallback(()=>{b$1("dismissed"),u(false),a$2(false);},[b$1]);if(useEffect(()=>{if(!g)return;let e=n=>{n.key==="Escape"&&_();};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[g,_]),useEffect(()=>{g&&!j.current&&(j.current=true,b$1("shown")),g||(j.current=false);},[g,b$1]),useEffect(()=>{g&&z.current&&z.current.focus();},[g]),useEffect(()=>{if(v&&$.current){let e=$.current;e.style.maxHeight="0px",e.style.opacity="0",e.offsetHeight,e.style.maxHeight=`${e.scrollHeight}px`,e.style.opacity="1";}},[v]),!g)return null;let ot=(t==null?void 0:t.primaryButton)||(t==null?void 0:t.acceptButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${y} ${q}`,m=(t==null?void 0:t.secondaryButton)||(t==null?void 0:t.rejectButton)||`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 ${y} ${Z}`,it=(t==null?void 0:t.customizeButton)||`px-4 py-2 bg-transparent text-gray-800 dark:text-white hover:underline ${y}`,dt=(t==null?void 0:t.saveButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${y} ${q}`,k=A==="inline",w=A==="center",x;k||w?x="":A==="top"?x="fixed inset-x-0 top-0":x="fixed inset-x-0 bottom-0";let S=jsx("div",{ref:z,tabIndex:-1,"data-ndpr-component":"consent-banner",className:a$1(`${k?"":x} bg-white dark:bg-gray-800 shadow-lg p-3 sm:p-4 border border-gray-200 dark:border-gray-700 ${w?"max-w-lg w-full":""} ${X}`,t==null?void 0:t.root,o),style:!k&&!w?{zIndex:T}:void 0,role:"dialog","aria-labelledby":"consent-banner-title","aria-describedby":"consent-banner-description",children:jsxs("div",{className:a$1("max-w-6xl mx-auto",t==null?void 0:t.container,o),children:[jsx("h2",{id:"consent-banner-title",className:a$1("text-lg font-bold mb-2",t==null?void 0:t.title,o),children:M}),jsx("p",{id:"consent-banner-description",className:a$1("text-sm sm:text-base mb-4",t==null?void 0:t.description,o),children:W}),v&&jsxs("div",{ref:$,className:a$1("mb-4 p-3 sm:p-4 rounded-md border border-gray-200 dark:border-gray-600 bg-gray-50 dark:bg-gray-700/50",t==null?void 0:t.customizePanel,o),style:{overflow:"hidden",transition:"max-height 0.3s ease-out, opacity 0.3s ease-out"},children:[jsx("div",{className:"mb-3 flex items-center justify-end",children:jsx("button",{type:"button",onClick:H?nt:et,className:a$1("text-sm font-medium text-[rgb(var(--ndpr-primary))] hover:underline",t==null?void 0:t.selectAllButton,o),children:H?"Deselect All":"Select All"})}),jsx("div",{className:a$1("space-y-3",t==null?void 0:t.optionsList,o),children:d.map(e=>jsxs("div",{className:a$1("flex items-start",t==null?void 0:t.optionItem,o),children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:`consent-${e.id}`,type:"checkbox",checked:C[e.id]||false,onChange:n=>tt(e.id,n.target.checked),disabled:e.required,className:a$1("h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]",t==null?void 0:t.optionCheckbox,o)})}),jsxs("div",{className:"ml-3 text-sm",children:[jsxs("label",{htmlFor:`consent-${e.id}`,className:a$1("font-medium",t==null?void 0:t.optionLabel,o),children:[e.label," ",e.required&&jsx("span",{className:"text-red-500",children:"*"})]}),jsx("p",{className:a$1("text-gray-600 dark:text-gray-400",t==null?void 0:t.optionDescription,o),children:e.description})]})]},e.id))}),jsxs("div",{className:a$1("mt-4 flex flex-col sm:flex-row flex-wrap gap-2",t==null?void 0:t.buttonGroup,o),children:[jsx("button",{onClick:rt,className:a$1(dt,t==null?void 0:t.saveButton,o),children:U}),jsx("button",{onClick:()=>a$2(false),className:a$1(m,t==null?void 0:t.rejectButton,o),children:"Back"})]})]}),!v&&jsxs("div",{className:a$1("flex flex-col sm:flex-row flex-wrap gap-2",t==null?void 0:t.buttonGroup,o),children:[jsx("button",{onClick:s,className:a$1(ot,t==null?void 0:t.acceptButton,o),children:Y}),jsx("button",{onClick:N,className:a$1(m,t==null?void 0:t.rejectButton,o),children:K}),jsx("button",{onClick:()=>a$2(true),className:a$1(it,t==null?void 0:t.customizeButton,o),children:Q})]}),jsx("div",{className:a$1("mt-2 text-xs text-gray-600 dark:text-gray-400",void 0,o),children:'By clicking "Accept All", you agree to the use of ALL cookies. Visit our Cookie Policy to learn more.'})]})});if(k)return S;if(w){let e=jsxs("div",{className:"fixed inset-0 flex items-center justify-center",style:{zIndex:T},children:[jsx("div",{className:"absolute inset-0 bg-black/50","aria-hidden":"true"}),jsx("div",{className:"relative",children:S})]});return typeof document!="undefined"?createPortal(e,document.body):e}return typeof document!="undefined"?createPortal(S,document.body):S};export{lt as a};//# sourceMappingURL=chunk-7F5F5YWI.mjs.map
2
+ //# sourceMappingURL=chunk-7F5F5YWI.mjs.map
@@ -0,0 +1,89 @@
1
+ 'use strict';var chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var it=({content:u,sections:R,variables:v,onExport:D,onEdit:C,title:H="Privacy Policy Preview",description:U="Preview your NDPA-compliant privacy policy before exporting.",className:M="",buttonClassName:y="",showExportOptions:B=true,showEditButton:L=true,showTableOfContents:W=true,showMetadata:T=true,organizationName:F,lastUpdated:r=new Date,classNames:t,unstyled:g=false})=>{let[P,h]=react.useState("preview"),k=(()=>{let n=u.split(`
2
+ `),d=[];return n.forEach(c=>{if(c.startsWith("## ")){let s=c.substring(3).trim(),$=s.toLowerCase().replace(/[^a-z0-9]+/g,"-");d.push({id:$,title:s,level:2});}else if(c.startsWith("### ")){let s=c.substring(4).trim(),$=s.toLowerCase().replace(/[^a-z0-9]+/g,"-");d.push({id:$,title:s,level:3});}}),d})(),f=n=>{if(D)D(n);else if(n==="markdown"){let d=document.createElement("a"),c=new Blob([u],{type:"text/markdown"});d.href=URL.createObjectURL(c),d.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(d),d.click(),document.body.removeChild(d);}},A=()=>!W||k.length===0?null:jsxRuntime.jsxs("div",{className:"mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsxRuntime.jsx("ul",{className:"space-y-1",children:k.map((n,d)=>jsxRuntime.jsx("li",{style:{marginLeft:`${(n.level-2)*1.5}rem`},children:jsxRuntime.jsx("a",{href:`#${n.id}`,className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:underline",children:n.title})},d))})]}),O=()=>T?jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h1",{className:"text-2xl font-bold mb-2",children:F?`${F} Privacy Policy`:"Privacy Policy"}),jsxRuntime.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:["Last Updated: ",r.toLocaleDateString()]})]}):null,w=()=>jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("prose dark:prose-invert max-w-none",t==null?void 0:t.sectionContent,g),children:u.split(`
3
+ `).map((n,d)=>{if(n.startsWith("## ")){let c=n.substring(3).trim(),s=c.toLowerCase().replace(/[^a-z0-9]+/g,"-");return jsxRuntime.jsx("h2",{id:s,className:chunkE64TU6IU_js.a("text-xl font-bold mt-6 mb-3",t==null?void 0:t.sectionTitle,g),children:c},d)}else if(n.startsWith("### ")){let c=n.substring(4).trim(),s=c.toLowerCase().replace(/[^a-z0-9]+/g,"-");return jsxRuntime.jsx("h3",{id:s,className:chunkE64TU6IU_js.a("text-lg font-bold mt-4 mb-2",t==null?void 0:t.sectionTitle,g),children:c},d)}else return n===""?jsxRuntime.jsx("br",{},d):jsxRuntime.jsx("p",{className:"mb-2",children:n},d)})}),z=()=>B?jsxRuntime.jsxs("div",{className:"mt-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxRuntime.jsxs("div",{className:"flex flex-wrap gap-3",children:[jsxRuntime.jsx("button",{onClick:()=>f("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${y}`,children:"Export as PDF"}),jsxRuntime.jsx("button",{onClick:()=>f("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${y}`,children:"Export as DOCX"}),jsxRuntime.jsx("button",{onClick:()=>f("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${y}`,children:"Export as HTML"}),jsxRuntime.jsx("button",{onClick:()=>f("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${y}`,children:"Export as Markdown"})]})]}):null;return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${M}`,t==null?void 0:t.root,g),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex justify-between items-start mb-6",t==null?void 0:t.header,g),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",t==null?void 0:t.title,g),children:H}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("text-gray-600 dark:text-gray-300",t==null?void 0:t.description,g),children:U})]}),L&&C&&jsxRuntime.jsx("button",{onClick:C,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 ${y}`,children:"Edit Policy"})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",t==null?void 0:t.complianceNotice,g),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"text-blue-700 dark:text-blue-300 text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsxRuntime.jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxRuntime.jsxs("ul",{className:"flex flex-wrap -mb-px",children:[jsxRuntime.jsx("li",{className:"mr-2",children:jsxRuntime.jsx("button",{onClick:()=>h("preview"),className:`inline-block p-4 ${P==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsxRuntime.jsx("li",{className:"mr-2",children:jsxRuntime.jsx("button",{onClick:()=>h("markdown"),className:`inline-block p-4 ${P==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-800 p-4 rounded-md",t==null?void 0:t.content,g),children:P==="preview"?jsxRuntime.jsxs("div",{children:[O(),A(),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",t==null?void 0:t.section,g),children:w()})]}):jsxRuntime.jsx("div",{children:jsxRuntime.jsx("pre",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md overflow-auto whitespace-pre-wrap font-mono text-sm text-gray-800 dark:text-gray-200",children:u})})}),z()]})};var ct=({content:u,title:R="Privacy Policy",organizationName:v,lastUpdated:D=new Date,onExportComplete:C,componentTitle:H="Export Privacy Policy",description:U="Export your NDPA-compliant privacy policy in various formats.",className:M="",buttonClassName:y="",showExportHistory:B=true,includeComplianceNotice:L=true,includeLogo:W=false,logoUrl:T,customStyles:F,classNames:r,unstyled:t=false})=>{let[g,P]=react.useState([]),[h,N]=react.useState("pdf"),[k,f]=react.useState(false),[A,O]=react.useState(null),[w,z]=react.useState(""),[n,d]=react.useState(""),[c,s]=react.useState(""),[$,j]=react.useState(false),q=o=>{let l=new Date().toISOString().split("T")[0];return `${v?v.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${l}.${o.toLowerCase()}`},Y=o=>w?w.endsWith(`.${o.toLowerCase()}`)?w:`${w}.${o.toLowerCase()}`:q(o),V=()=>{let o=v?`${v} ${R}`:R,l=D.toLocaleDateString(),m=`<!DOCTYPE html>
4
+ <html lang="en">
5
+ <head>
6
+ <meta charset="UTF-8">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
8
+ <title>${o}</title>
9
+ <style>
10
+ body {
11
+ font-family: Arial, sans-serif;
12
+ line-height: 1.6;
13
+ color: #333;
14
+ max-width: 800px;
15
+ margin: 0 auto;
16
+ padding: 20px;
17
+ }
18
+ h1 {
19
+ font-size: 24px;
20
+ margin-bottom: 10px;
21
+ }
22
+ h2 {
23
+ font-size: 20px;
24
+ margin-top: 30px;
25
+ margin-bottom: 10px;
26
+ border-bottom: 1px solid #eee;
27
+ padding-bottom: 5px;
28
+ }
29
+ h3 {
30
+ font-size: 18px;
31
+ margin-top: 20px;
32
+ margin-bottom: 10px;
33
+ }
34
+ p {
35
+ margin-bottom: 15px;
36
+ }
37
+ .header {
38
+ text-align: center;
39
+ margin-bottom: 30px;
40
+ }
41
+ .footer {
42
+ margin-top: 50px;
43
+ text-align: center;
44
+ font-size: 12px;
45
+ color: #666;
46
+ border-top: 1px solid #eee;
47
+ padding-top: 20px;
48
+ }
49
+ .logo {
50
+ max-width: 200px;
51
+ margin-bottom: 20px;
52
+ }
53
+ .last-updated {
54
+ font-size: 12px;
55
+ color: #666;
56
+ margin-bottom: 30px;
57
+ }
58
+ .compliance-notice {
59
+ background-color: #f8f9fa;
60
+ border: 1px solid #e9ecef;
61
+ padding: 15px;
62
+ margin-bottom: 30px;
63
+ font-size: 14px;
64
+ }
65
+ ${F||""}
66
+ </style>
67
+ </head>
68
+ <body>
69
+ <div class="header">
70
+ ${W&&T?`<img src="${T}" alt="${v||"Company"} Logo" class="logo">`:""}
71
+ ${n?`<div class="custom-header">${n}</div>`:""}
72
+ <h1>${o}</h1>
73
+ <div class="last-updated">Last Updated: ${l}</div>
74
+ </div>`;L&&(m+=`
75
+ <div class="compliance-notice">
76
+ <strong>NDPA Compliance Notice:</strong> This privacy policy has been created to comply with the Nigeria Data Protection Act (NDPA) 2023.
77
+ It outlines how we collect, use, disclose, and protect your personal information in accordance with NDPA requirements.
78
+ </div>`);let S=u.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return m+=`
79
+ <div class="content">
80
+ <p>${S}</p>
81
+ </div>
82
+
83
+ <div class="footer">
84
+ ${c?`<div class="custom-footer">${c}</div>`:""}
85
+ <p>&copy; ${new Date().getFullYear()} ${v||"Company"}. All rights reserved.</p>
86
+ </div>
87
+ </body>
88
+ </html>`,m},_=()=>chunkMQFZHA2D_js.d(null,null,function*(){f(true),O(null);try{let o=h.toLowerCase(),l="",m;switch(o){case "pdf":let I=V();m=new Blob([I],{type:"text/html"}),l=URL.createObjectURL(m);break;case "docx":m=new Blob([u],{type:"text/plain"}),l=URL.createObjectURL(m);break;case "html":let Z=V();m=new Blob([Z],{type:"text/html"}),l=URL.createObjectURL(m);break;default:m=new Blob([u],{type:"text/markdown"}),l=URL.createObjectURL(m);break}let S=Y(o),E=document.createElement("a");E.href=l,E.download=S,document.body.appendChild(E),E.click(),document.body.removeChild(E);let Q={id:`export_${Date.now()}`,format:o,timestamp:Date.now(),url:l,filename:S};P(I=>[Q,...I]),C&&C(o,l);}catch(o){console.error("Export error:",o),O("An error occurred during export. Please try again.");}finally{f(false);}}),G=()=>{let o=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}];return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mb-6",r==null?void 0:r.formatSelector,t),children:[jsxRuntime.jsx("label",{htmlFor:"export-format",className:"block text-sm font-medium mb-1",children:"Export Format"}),jsxRuntime.jsx("select",{id:"export-format",value:h,onChange:l=>N(l.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",r==null?void 0:r.formatOption,t),children:o.map(l=>jsxRuntime.jsx("option",{value:l.value,children:l.label},l.value))})]})},J=()=>$?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:()=>j(false),className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] text-sm",children:"Hide Advanced Options"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"custom-filename",className:"block text-sm font-medium mb-1",children:"Custom Filename"}),jsxRuntime.jsx("input",{type:"text",id:"custom-filename",value:w,onChange:o=>z(o.target.value),placeholder:q(h),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:"Leave blank to use the default filename format."})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"custom-header",className:"block text-sm font-medium mb-1",children:"Custom Header HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:"custom-header",value:n,onChange:o=>d(o.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"custom-footer",className:"block text-sm font-medium mb-1",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:"custom-footer",value:c,onChange:o=>s(o.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]}),jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:"include-compliance-notice",type:"checkbox",checked:L,onChange:o=>j(o.target.checked),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:"include-compliance-notice",className:"font-medium text-gray-900 dark:text-white",children:"Include NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>j(true),className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] text-sm mb-6",children:"Show Advanced Options"}),K=()=>!B||g.length===0?null:jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mt-6",r==null?void 0:r.preview,t),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 text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Date"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Format"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Filename"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Actions"})]})}),jsxRuntime.jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:g.map(o=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:new Date(o.timestamp).toLocaleString()}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:o.format.toUpperCase()}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-300",children:o.filename}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsxRuntime.jsx("a",{href:o.url,download:o.filename,className:"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},o.id))})]})})]});return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${M}`,r==null?void 0:r.root,t),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mb-6",r==null?void 0:r.header,t),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",r==null?void 0:r.title,t),children:H}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("text-gray-600 dark:text-gray-300",r==null?void 0:r.description,t),children:U})]}),G(),J(),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("button",{onClick:_,disabled:k,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 ${y} ${k?"opacity-70 cursor-not-allowed":""}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.exportButton),t),children:k?"Exporting...":`Export as ${h.toUpperCase()}`}),A&&jsxRuntime.jsx("p",{className:"mt-2 text-sm text-red-600 dark:text-red-500",children:A})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",r==null?void 0:r.complianceNotice,t),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"Export Tips"}),jsxRuntime.jsxs("ul",{className:"text-blue-700 dark:text-blue-300 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."})]})]}),K()]})};exports.a=it;exports.b=ct;//# sourceMappingURL=chunk-7FIUX3ZM.js.map
89
+ //# sourceMappingURL=chunk-7FIUX3ZM.js.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var G=({options:l,settings:u,onSave:v,title:h="Manage Your Privacy Settings",description:x="Update your consent preferences at any time. Required cookies cannot be disabled as they are necessary for the website to function. Consent management is provided in accordance with NDPA Sections 25-26.",saveButtonText:m="Save Preferences",resetButtonText:y="Reset to Defaults",version:k="1.0",className:S="",buttonClassName:i="",primaryButtonClassName:a="",secondaryButtonClassName:w="",classNames:e,unstyled:s,showSuccessMessage:R=true,successMessage:B="Your preferences have been saved.",successMessageDuration:D=3e3})=>{let[p,n]=react.useState({}),[o,d]=react.useState(false);react.useEffect(()=>{if(u&&u.consents)n(u.consents);else {let t={};l.forEach(c=>{t[c.id]=c.defaultValue||false;}),n(t);}},[l,u]);let b=(t,c)=>{n(L=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},L),{[t]:c}));},I=()=>{let t={consents:p,timestamp:Date.now(),version:k,method:"manager",hasInteracted:true};v(t),R&&(d(true),setTimeout(()=>{d(false);},D));},M=()=>{let t={};l.forEach(c=>{t[c.id]=c.defaultValue||false;}),n(t);},O=(e==null?void 0:e.primaryButton)||(e==null?void 0:e.saveButton)||`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${i} ${a}`,C=(e==null?void 0:e.secondaryButton)||(e==null?void 0:e.resetButton)||`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 ${i} ${w}`;return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 ${S}`,e==null?void 0:e.root,s),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",e==null?void 0:e.title,s),children:h}),jsxRuntime.jsx("p",{className:chunkE64TU6IU_js.a("mb-6 text-gray-600 dark:text-gray-300",e==null?void 0:e.description,s),children:x}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("space-y-6",e==null?void 0:e.optionsList,s),children:l.map(t=>jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("border-b border-gray-200 dark:border-gray-700 pb-4 last:border-0",e==null?void 0:e.optionItem,s),children:jsxRuntime.jsxs("div",{className:"flex items-start justify-between",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-medium text-gray-900 dark:text-white",children:t.label}),jsxRuntime.jsx("p",{className:"text-sm text-gray-600 dark:text-gray-400 mt-1",children:t.description})]}),jsxRuntime.jsx("div",{className:"ml-4 flex-shrink-0",children:jsxRuntime.jsxs("label",{className:"relative inline-flex items-center cursor-pointer",children:[jsxRuntime.jsx("input",{type:"checkbox",className:"sr-only peer",checked:p[t.id]||false,onChange:c=>b(t.id,c.target.checked),disabled:t.required}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a(`w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-[rgb(var(--ndpr-ring)/0.3)] rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-[rgb(var(--ndpr-primary))] ${t.required?"opacity-60":""}`,e==null?void 0:e.toggle,s)}),jsxRuntime.jsxs("span",{className:"ml-3 text-sm font-medium text-gray-900 dark:text-gray-300",children:[p[t.id]?"Enabled":"Disabled",t.required&&jsxRuntime.jsx("span",{className:"text-xs text-red-500 ml-1",children:"(Required)"})]})]})})]})},t.id))}),o&&jsxRuntime.jsx("div",{className:"mt-4 p-3 bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200 rounded-md",children:B}),jsxRuntime.jsxs("div",{className:"mt-6 flex flex-wrap gap-3",children:[jsxRuntime.jsx("button",{onClick:I,className:chunkE64TU6IU_js.a(O,e==null?void 0:e.saveButton,s),children:m}),jsxRuntime.jsx("button",{onClick:M,className:chunkE64TU6IU_js.a(C,e==null?void 0:e.resetButton,s),children:y})]}),jsxRuntime.jsxs("div",{className:"mt-4 text-xs text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsxs("p",{children:["Last updated: ",u?new Date(u.timestamp).toLocaleString():"Never"]}),jsxRuntime.jsxs("p",{children:["Version: ",k]})]})]})};var X=({settings:l,storageOptions:u={},onLoad:v,onSave:h,autoSave:x=true,autoLoad:m=true,classNames:y,unstyled:k,children:S})=>{let{storageKey:i="ndpr_consent",storageType:a="localStorage",cookieOptions:w={}}=u,[e,s]=react.useState(false);react.useEffect(()=>{m&&!e&&R();},[m,e]),react.useEffect(()=>{x&&e&&B(l);},[l,x,e]);let R=()=>{let n=null;try{if(a==="localStorage"&&typeof window!="undefined"){let o=localStorage.getItem(i);o&&(n=JSON.parse(o));}else if(a==="sessionStorage"&&typeof window!="undefined"){let o=sessionStorage.getItem(i);o&&(n=JSON.parse(o));}else if(a==="cookie"&&typeof document!="undefined"){let d=document.cookie.split(";").find(b=>b.trim().startsWith(`${i}=`));if(d){let b=d.split("=")[1];n=JSON.parse(decodeURIComponent(b));}}s(!0),v&&v(n);}catch(o){console.error("Error loading consent settings:",o),s(true),v&&v(null);}return n},B=n=>{try{let o=JSON.stringify(n);if(a==="localStorage"&&typeof window!="undefined")localStorage.setItem(i,o);else if(a==="sessionStorage"&&typeof window!="undefined")sessionStorage.setItem(i,o);else if(a==="cookie"&&typeof document!="undefined"){let{domain:d,path:b="/",expires:I=365,secure:M=!0,sameSite:O="Lax"}=w,C=new Date;C.setDate(C.getDate()+I);let t=`${i}=${encodeURIComponent(o)}; path=${b}; expires=${C.toUTCString()}`;d&&(t+=`; domain=${d}`),M&&(t+="; secure"),t+=`; samesite=${O}`,document.cookie=t;}return h&&h(n),!0}catch(o){return console.error("Error saving consent settings:",o),false}},D=()=>{try{if(a==="localStorage"&&typeof window!="undefined")localStorage.removeItem(i);else if(a==="sessionStorage"&&typeof window!="undefined")sessionStorage.removeItem(i);else if(a==="cookie"&&typeof document!="undefined"){let{domain:n,path:o="/"}=w,d=`${i}=; path=${o}; expires=Thu, 01 Jan 1970 00:00:00 GMT`;n&&(d+=`; domain=${n}`),document.cookie=d;}return !0}catch(n){return console.error("Error clearing consent settings:",n),false}},p=chunkE64TU6IU_js.a("",y==null?void 0:y.root,k);if(typeof S=="function"){let n=S({loadSettings:R,saveSettings:B,clearSettings:D,loaded:e});return p?jsxRuntime.jsx("div",{className:p,children:n}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:n})}return p?jsxRuntime.jsx("div",{className:p,children:S}):jsxRuntime.jsx(jsxRuntime.Fragment,{children:S})};exports.a=G;exports.b=X;//# sourceMappingURL=chunk-FR7ZYZXB.js.map
2
+ //# sourceMappingURL=chunk-FR7ZYZXB.js.map
@@ -0,0 +1,7 @@
1
+ 'use strict';var chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),jsxRuntime=require('react/jsx-runtime'),D=require('react');function _interopDefault(e){return e&&e.__esModule?e:{default:e}}var D__default=/*#__PURE__*/_interopDefault(D);var S=({result:r,sections:m,showFullReport:p=true,allowPrint:x=true,allowExport:y=true,onExport:v,className:u="",buttonClassName:b="",classNames:k={},unstyled:N=false})=>{let i=(a,s)=>{let d=s?k[s]:void 0;return !d&&s==="printButton"&&(d=k.primaryButton),chunkE64TU6IU_js.a(a,d,N)},g=a=>new Date(a).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"}),l=a=>{let s=r.answers[a];return s==null?"Not answered":typeof s=="boolean"?s?"Yes":"No":Array.isArray(s)?s.join(", "):String(s)},w=()=>{window.print();},C=a=>{v&&v(a);},h=a=>jsxRuntime.jsx("span",{className:i(`px-2 py-1 rounded text-xs font-medium ${{low:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",medium:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",high:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",critical:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}[a]}`,"riskBadge"),children:a.charAt(0).toUpperCase()+a.slice(1)});return jsxRuntime.jsxs("div",{className:`${i("bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 print:shadow-none print:p-0","root")} ${u}`,children:[jsxRuntime.jsxs("div",{className:i("mb-8 border-b border-gray-200 dark:border-gray-700 pb-6 print:pb-4","header"),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h1",{className:i("text-2xl font-bold text-gray-900 dark:text-white mb-2","title"),children:"Data Protection Impact Assessment Report"}),jsxRuntime.jsx("h2",{className:"text-xl text-gray-700 dark:text-gray-300 mb-4",children:r.title})]}),(x||y)&&jsxRuntime.jsxs("div",{className:"flex space-x-2 print:hidden",children:[x&&jsxRuntime.jsx("button",{onClick:w,className:`${i("px-3 py-1 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600","printButton")} ${b}`,children:jsxRuntime.jsxs("span",{className:"flex items-center",children:[jsxRuntime.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"})}),"Print"]})}),y&&jsxRuntime.jsx("div",{className:"relative inline-block",children:jsxRuntime.jsx("button",{onClick:()=>C("pdf"),className:`px-3 py-1 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${b}`,children:jsxRuntime.jsxs("span",{className:"flex items-center",children:[jsxRuntime.jsx("svg",{className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})}),"Export PDF"]})})})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Assessor:"})," ",r.assessor.name,", ",r.assessor.role]}),jsxRuntime.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Contact:"})," ",r.assessor.email]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Started:"})," ",g(r.startedAt)]}),jsxRuntime.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Completed:"})," ",r.completedAt?g(r.completedAt):"In progress"]}),jsxRuntime.jsxs("p",{className:"text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Next review:"})," ",r.reviewDate?g(r.reviewDate):"Not scheduled"]})]})]})]}),jsxRuntime.jsxs("div",{className:i("mb-8","summary"),children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-4",children:"Executive Summary"}),jsxRuntime.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-4",children:[jsxRuntime.jsxs("div",{className:"flex items-center mb-2",children:[jsxRuntime.jsx("span",{className:"font-medium mr-2",children:"Overall Risk Level:"}),h(r.overallRiskLevel)]}),jsxRuntime.jsxs("div",{className:i("mb-2","conclusion"),children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Conclusion:"})," ",r.conclusion]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Can Proceed:"})," ",r.canProceed?"Yes":"No"]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Processing Activity Description"}),jsxRuntime.jsx("p",{className:"text-gray-700 dark:text-gray-300 mb-4",children:r.processingDescription}),r.recommendations&&r.recommendations.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"font-medium text-gray-900 dark:text-white mb-2",children:"Key Recommendations"}),jsxRuntime.jsx("ul",{className:"list-disc pl-5 text-gray-700 dark:text-gray-300",children:r.recommendations.map((a,s)=>jsxRuntime.jsx("li",{className:i("","recommendation"),children:a},s))})]})]})]}),jsxRuntime.jsxs("div",{className:"mb-8",children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-4",children:"Identified Risks"}),r.risks.length===0?jsxRuntime.jsx("p",{className:"text-gray-700 dark:text-gray-300",children:"No risks identified."}):jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:i("min-w-full divide-y divide-gray-200 dark:divide-gray-700","riskTable"),children:[jsxRuntime.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Risk"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Likelihood"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Impact"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Risk Level"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Mitigated"})]})}),jsxRuntime.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:r.risks.map(a=>jsxRuntime.jsxs("tr",{className:i("","riskRow"),children:[jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-normal text-sm text-gray-900 dark:text-gray-100",children:a.description}),jsxRuntime.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-400",children:[a.likelihood," / 5"]}),jsxRuntime.jsxs("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-400",children:[a.impact," / 5"]}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm",children:h(a.level)}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm text-gray-600 dark:text-gray-400",children:a.mitigated?jsxRuntime.jsx("span",{className:"text-green-600 dark:text-green-400",children:"Yes"}):jsxRuntime.jsx("span",{className:"text-red-600 dark:text-red-400",children:"No"})})]},a.id))})]})})]}),p&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:"text-xl font-bold text-gray-900 dark:text-white mb-4",children:"Full Assessment Details"}),m.map(a=>{let s=a.questions.filter(d=>r.answers[d.id]!==void 0);return s.length===0?null:jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-2",children:a.title}),jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700",children:[jsxRuntime.jsx("thead",{className:"bg-gray-50 dark:bg-gray-700",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Question"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-600 dark:text-gray-300 uppercase tracking-wider",children:"Answer"})]})}),jsxRuntime.jsx("tbody",{className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700",children:s.map(d=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-normal text-sm text-gray-900 dark:text-gray-100",children:d.text}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-normal text-sm text-gray-600 dark:text-gray-400",children:l(d.id)})]},d.id))})]})})]},a.id)})]}),jsxRuntime.jsxs("div",{className:"mt-8 pt-4 border-t border-gray-200 dark:border-gray-700 text-sm text-gray-600 dark:text-gray-400",children:[jsxRuntime.jsx("p",{children:"This DPIA was conducted in accordance with the Nigeria Data Protection Act (NDPA) 2023."}),jsxRuntime.jsxs("p",{children:["DPIA Report Version: ",r.version]}),jsxRuntime.jsxs("p",{children:["Generated on: ",new Date().toLocaleDateString()]})]})]})};var F=({steps:r,onStepClick:m,clickable:p=true,orientation:x="horizontal",className:y="",activeStepClassName:v="",completedStepClassName:u="",incompleteStepClassName:b="",classNames:k={},unstyled:N=false})=>{let i=(n,l)=>chunkE64TU6IU_js.a(n,l?k[l]:void 0,N),g=n=>{p&&m&&m(n);},c=x==="vertical";return jsxRuntime.jsx("div",{className:`${i(c?"flex flex-col space-y-4":"flex items-center justify-between","root")} ${y}`,children:r.map((n,l)=>{let w=l===r.length-1,C=n.active?i(`font-medium ${v||"text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))]"}`,"label"):n.completed?i(u||"text-green-600 dark:text-green-400","label"):i(b||"text-gray-600 dark:text-gray-400","label"),h=n.active?i("flex items-center justify-center w-8 h-8 rounded-full bg-[rgb(var(--ndpr-primary)/0.1)] dark:bg-[rgb(var(--ndpr-primary)/0.2)] text-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] border-2 border-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]","stepActive"):n.completed?i("flex items-center justify-center w-8 h-8 rounded-full bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-400 border-2 border-green-600 dark:border-green-400","stepCompleted"):i("flex items-center justify-center w-8 h-8 rounded-full bg-gray-100 dark:bg-gray-700 text-gray-600 dark:text-gray-400 border-2 border-gray-300 dark:border-gray-600","stepPending");return jsxRuntime.jsxs(D__default.default.Fragment,{children:[jsxRuntime.jsxs("div",{className:i(`${c?"flex items-start":"flex flex-col items-center"} ${p?"cursor-pointer":""}`,"step"),onClick:()=>g(n.id),children:[jsxRuntime.jsx("div",{className:`
2
+ flex items-center justify-center
3
+ ${c?"mr-4":""}
4
+ `,children:jsxRuntime.jsx("div",{className:h,children:n.icon?n.icon:n.completed?jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})}):jsxRuntime.jsx("span",{children:l+1})})}),jsxRuntime.jsxs("div",{className:`
5
+ ${c?"flex-1":"mt-2 text-center"}
6
+ `,children:[jsxRuntime.jsx("div",{className:`text-sm font-medium ${C}`,children:n.label}),n.description&&jsxRuntime.jsx("div",{className:"text-xs text-gray-600 dark:text-gray-400 mt-1",children:n.description})]})]}),!w&&jsxRuntime.jsx("div",{className:i(c?"ml-4 h-8 border-l-2 border-gray-300 dark:border-gray-600":"w-full border-t-2 border-gray-300 dark:border-gray-600 hidden sm:block","connector")})]},n.id)})})};exports.a=S;exports.b=F;//# sourceMappingURL=chunk-FY5G6DGZ.js.map
7
+ //# sourceMappingURL=chunk-FY5G6DGZ.js.map
@@ -0,0 +1,2 @@
1
+ import {a as a$2,b}from'./chunk-YJCGEOLO.mjs';import {a}from'./chunk-GIV2OHE6.mjs';import {a as a$1}from'./chunk-SBNAMPAP.mjs';import {useRef,useState,useEffect,useCallback}from'react';function F(n){if(!n)return a$1("ndpr_consent");let{storageKey:o="ndpr_consent",storageType:i="localStorage"}=n;return i==="sessionStorage"?a$2(o):i==="cookie"?b(o,n.cookieOptions):a$1(o)}function k(n,o,i,r,a$1,g,l){if(n){i(n);let{valid:s,errors:c}=a(n);r(s),a$1(c),g(!(s&&n.version===o));}else g(true);l(false);}function z({options:n,adapter:o,storageOptions:i,version:r="1.0",onChange:a$1}){let g=o!=null?o:F(i),l=useRef(g);l.current=g;let[s,c]=useState(null),[y,d]=useState(false),[E,C]=useState(false),[w,S]=useState([]),[I,v]=useState(true);useEffect(()=>{let e=false;try{let t=l.current.load();t instanceof Promise?t.then(m=>{e||k(m,r,c,C,S,d,v);},()=>{e||(d(!0),v(!1));}):k(t,r,c,C,S,d,v);}catch(t){e||(d(true),v(false));}return ()=>{e=true;}},[r]);let h=useCallback(e=>{let{valid:t,errors:m}=a(e);C(t),S(m),a$1==null||a$1(e),Promise.resolve(l.current.save(e)).catch(P=>{console.warn("[ndpr-toolkit] Failed to save consent:",P);});},[a$1]),f=useCallback(e=>{let t={consents:e,timestamp:Date.now(),version:r,method:"explicit",hasInteracted:true};c(t),h(t),d(false);},[r,h]),L=useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=true;}),f(e);},[n,f]),U=useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=t.required||false;}),f(e);},[n,f]),V=useCallback(e=>!!(s!=null&&s.consents[e]),[s]),j=useCallback(()=>{c(null),d(true),C(false),S([]),Promise.resolve(l.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove consent:",e);});},[]);return {settings:s,hasConsent:V,updateConsent:f,acceptAll:L,rejectAll:U,shouldShowBanner:y,isValid:E,validationErrors:w,resetConsent:j,isLoading:I}}export{z as a};//# sourceMappingURL=chunk-G26I6MP5.mjs.map
2
+ //# sourceMappingURL=chunk-G26I6MP5.mjs.map
@@ -0,0 +1,2 @@
1
+ var p=["critical","high","medium","low"];function m(e){let i=new Date(e).getTime();return (Date.now()-i)/(1e3*60*60*24*30.44)}function u(e){if(e.length===0)return 100;let i=e.filter(t=>t.pass).length;return Math.round(i/e.length*100)}function f(e){return [{key:"hasConsentMechanism",label:"Consent collection mechanism",priority:"critical",effort:"high",recommendation:"Implement a clear, affirmative consent collection mechanism before processing personal data.",ndpaSection:"Section 25",pass:e.hasConsentMechanism},{key:"hasPurposeSpecification",label:"Purpose specification at collection",priority:"critical",effort:"medium",recommendation:"Specify and communicate the purpose of data collection at the point of consent.",ndpaSection:"Section 25",pass:e.hasPurposeSpecification},{key:"hasWithdrawalMechanism",label:"Consent withdrawal mechanism",priority:"high",effort:"medium",recommendation:"Provide a simple mechanism for data subjects to withdraw consent at any time.",ndpaSection:"Section 26",pass:e.hasWithdrawalMechanism},{key:"hasMinorProtection",label:"Minor (child) data protection controls",priority:"high",effort:"high",recommendation:"Implement age-verification and parental-consent controls for processing data of minors.",ndpaSection:"Section 26",pass:e.hasMinorProtection},{key:"consentRecordsRetained",label:"Consent records retained",priority:"medium",effort:"low",recommendation:"Retain records of all consents obtained, including what was agreed to and when.",ndpaSection:"Section 25",pass:e.consentRecordsRetained}]}function g(e){let i=e.responseTimelineDays<=30;return [{key:"hasRequestMechanism",label:"DSR submission mechanism",priority:"critical",effort:"high",recommendation:"Implement a formal channel (e.g. a web form or email address) for data subjects to submit requests.",ndpaSection:"Section 34",pass:e.hasRequestMechanism},{key:"supportsAccess",label:"Right of access supported",priority:"high",effort:"medium",recommendation:"Enable data subjects to request and receive a copy of their personal data.",ndpaSection:"Section 34",pass:e.supportsAccess},{key:"supportsRectification",label:"Right to rectification supported",priority:"high",effort:"medium",recommendation:"Allow data subjects to request correction of inaccurate or incomplete personal data.",ndpaSection:"Section 35",pass:e.supportsRectification},{key:"supportsErasure",label:"Right to erasure supported",priority:"high",effort:"high",recommendation:"Implement processes to delete personal data upon valid erasure requests.",ndpaSection:"Section 36",pass:e.supportsErasure},{key:"supportsPortability",label:"Right to data portability supported",priority:"medium",effort:"high",recommendation:"Provide personal data in a structured, machine-readable format upon request.",ndpaSection:"Section 37",pass:e.supportsPortability},{key:"supportsObjection",label:"Right to object supported",priority:"medium",effort:"medium",recommendation:"Honour objections to processing where no compelling legitimate grounds override the data subject's interests.",ndpaSection:"Section 38",pass:e.supportsObjection},{key:"responseTimeline",label:"DSR response within 30 days",priority:"high",effort:"medium",recommendation:"Reduce DSR response time to 30 days or less as required by the NDPA.",ndpaSection:"Section 39",pass:i}]}function y(e){return [{key:"conductedForHighRisk",label:"DPIA conducted for high-risk processing",priority:"critical",effort:"high",recommendation:"Conduct a Data Protection Impact Assessment before undertaking high-risk processing activities.",ndpaSection:"Section 28",pass:e.conductedForHighRisk},{key:"documentedRisks",label:"Risks documented in DPIA",priority:"high",effort:"medium",recommendation:"Document identified risks to data subjects' rights and freedoms within the DPIA.",ndpaSection:"Section 28",pass:e.documentedRisks},{key:"mitigationMeasures",label:"Mitigation measures documented",priority:"high",effort:"medium",recommendation:"Document mitigation measures and residual risk acceptance within the DPIA.",ndpaSection:"Section 28",pass:e.mitigationMeasures}]}function b(e){return [{key:"hasNotificationProcess",label:"Breach notification process in place",priority:"critical",effort:"high",recommendation:"Establish a documented breach notification process covering detection, assessment, and reporting.",ndpaSection:"Section 40",pass:e.hasNotificationProcess},{key:"notifiesWithin72Hours",label:"NDPC notified within 72 hours",priority:"critical",effort:"medium",recommendation:"Ensure the NDPC is notified of qualifying breaches within 72 hours of discovery.",ndpaSection:"Section 40",pass:e.notifiesWithin72Hours},{key:"hasRiskAssessment",label:"Breach risk assessment performed",priority:"high",effort:"medium",recommendation:"Perform a risk assessment for every identified breach to determine notification obligations.",ndpaSection:"Section 40",pass:e.hasRiskAssessment},{key:"hasRecordKeeping",label:"Breach records maintained",priority:"medium",effort:"low",recommendation:"Maintain a breach register documenting all incidents, assessments, and actions taken.",ndpaSection:"Section 40",pass:e.hasRecordKeeping}]}function S(e){let t=m(e.lastUpdated)<=13;return [{key:"hasPrivacyPolicy",label:"Privacy policy exists",priority:"critical",effort:"high",recommendation:"Draft and publish a comprehensive privacy policy that satisfies NDPA requirements.",ndpaSection:"Section 29",pass:e.hasPrivacyPolicy},{key:"isPubliclyAccessible",label:"Privacy policy publicly accessible",priority:"high",effort:"low",recommendation:"Make the privacy policy easily accessible to data subjects on your website or app.",ndpaSection:"Section 29",pass:e.isPubliclyAccessible},{key:"policyUpToDate",label:"Privacy policy reviewed within 13 months",priority:"medium",effort:"medium",recommendation:"Review and update the privacy policy at least annually to reflect current practices.",ndpaSection:"Section 29",pass:t},{key:"coversAllSections",label:"Privacy policy covers all required sections",priority:"high",effort:"medium",recommendation:"Ensure the privacy policy addresses all NDPA-mandated disclosures including lawful basis, retention, and subject rights.",ndpaSection:"Section 29",pass:e.coversAllSections}]}function R(e){return [{key:"documentedForAllProcessing",label:"Lawful basis documented for all processing",priority:"critical",effort:"high",recommendation:"Identify and document a valid lawful basis for every processing activity before it begins.",ndpaSection:"Section 25(1)",pass:e.documentedForAllProcessing},{key:"hasLegitimateInterestAssessment",label:"Legitimate interest assessment completed",priority:"medium",effort:"medium",recommendation:"Complete a Legitimate Interest Assessment (LIA) where legitimate interests is the chosen lawful basis.",ndpaSection:"Section 25(1)",pass:e.hasLegitimateInterestAssessment}]}function v(e){return [{key:"hasTransferMechanisms",label:"Transfer mechanisms in place",priority:"critical",effort:"high",recommendation:"Implement appropriate transfer mechanisms (SCCs, BCRs, or adequacy decisions) for all cross-border transfers.",ndpaSection:"Section 43",pass:e.hasTransferMechanisms},{key:"adequacyAssessed",label:"Adequacy of destination country assessed",priority:"high",effort:"medium",recommendation:"Assess whether the destination country provides an adequate level of data protection before transferring.",ndpaSection:"Section 43",pass:e.adequacyAssessed},{key:"ndpcApprovalObtained",label:"NDPC approval obtained where required",priority:"high",effort:"high",recommendation:"Obtain NDPC approval for transfers to countries without adequacy decisions where required.",ndpaSection:"Section 44",pass:e.ndpcApprovalObtained}]}function w(e){let t=m(e.lastReviewed)<=6;return [{key:"maintained",label:"Record of Processing Activities maintained",priority:"critical",effort:"high",recommendation:"Create and maintain a comprehensive Record of Processing Activities (ROPA) as required by the NDPA.",ndpaSection:"Section 30",pass:e.maintained},{key:"includesAllProcessing",label:"ROPA includes all processing activities",priority:"high",effort:"medium",recommendation:"Ensure the ROPA captures every processing activity across all departments and systems.",ndpaSection:"Section 30",pass:e.includesAllProcessing},{key:"ropaUpToDate",label:"ROPA reviewed within 6 months",priority:"medium",effort:"low",recommendation:"Review and update the ROPA at least every six months to reflect changes in processing activities.",ndpaSection:"Section 30",pass:t}]}var k=[{name:"consent",weight:.2,ndpaSections:["Section 25","Section 26"],evaluate:e=>f(e.consent)},{name:"dsr",weight:.15,ndpaSections:["Section 34","Section 35","Section 36","Section 37","Section 38","Section 39"],evaluate:e=>g(e.dsr)},{name:"breach",weight:.15,ndpaSections:["Section 40"],evaluate:e=>b(e.breach)},{name:"policy",weight:.12,ndpaSections:["Section 29"],evaluate:e=>S(e.policy)},{name:"dpia",weight:.12,ndpaSections:["Section 28"],evaluate:e=>y(e.dpia)},{name:"lawfulBasis",weight:.1,ndpaSections:["Section 25(1)"],evaluate:e=>R(e.lawfulBasis)},{name:"crossBorder",weight:.08,ndpaSections:["Section 43","Section 44"],evaluate:e=>v(e.crossBorder)},{name:"ropa",weight:.08,ndpaSections:["Section 30"],evaluate:e=>w(e.ropa)}];function P(e){return e>=90?"excellent":e>=70?"good":e>=40?"needs-work":"critical"}function A(e){let i={},t=[],s=0;for(let o of k){let a=o.evaluate(e),c=u(a),l=c*o.weight;s+=l;let d=[];for(let n of a)n.pass||(d.push(n.label),t.push({module:o.name,key:n.key,label:n.label,priority:n.priority,effort:n.effort,recommendation:n.recommendation,ndpaSection:n.ndpaSection}));i[o.name]={name:o.name,score:c,maxScore:100,weightedScore:Math.round(l*100)/100,ndpaSections:o.ndpaSections,gaps:d};}t.sort((o,a)=>p.indexOf(o.priority)-p.indexOf(a.priority));let r=Math.round(s),h=[{section:"Section 25",title:"Consent and lawful basis for processing"},{section:"Section 26",title:"Withdrawal of consent and minor protection"},{section:"Section 28",title:"Data Protection Impact Assessment"},{section:"Section 29",title:"Privacy notice requirements"},{section:"Section 30",title:"Records of processing activities"},{section:"Section 34",title:"Right of access"},{section:"Section 35",title:"Right to rectification"},{section:"Section 36",title:"Right to erasure"},{section:"Section 37",title:"Right to data portability"},{section:"Section 38",title:"Right to object"},{section:"Section 39",title:"Response timelines for data subject requests"},{section:"Section 40",title:"Data breach notification"},{section:"Section 43",title:"Cross-border transfer restrictions"},{section:"Section 44",title:"NDPC approval for cross-border transfers"}];return {score:r,rating:P(r),modules:i,recommendations:t,regulatoryReferences:h,generatedAt:new Date().toISOString()}}export{A as a};//# sourceMappingURL=chunk-GPJVTGHR.mjs.map
2
+ //# sourceMappingURL=chunk-GPJVTGHR.mjs.map
@@ -0,0 +1,3 @@
1
+ 'use strict';var chunkEPF7J2FK_js=require('./chunk-EPF7J2FK.js'),chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var qe=({categories:pe,onSubmit:ge,onValidationError:N,title:be="Report a Data Breach",formDescription:fe="Use this form to report a suspected or confirmed data breach in accordance with NDPA Section 40. All fields marked with * are required.",submitButtonText:ue="Submit Report",className:M="",buttonClassName:z="",classNames:d={},unstyled:c=false,isSubmitting:f=false,showConfirmation:ve=true,confirmationMessage:he="Your breach report has been submitted successfully. The data protection team has been notified.",allowAttachments:ye=true,maxAttachments:A=5,maxFileSize:k=5*1024*1024,allowedFileTypes:w=[".pdf",".jpg",".jpeg",".png",".doc",".docx",".xls",".xlsx",".txt"],defaultValues:t,onReset:S})=>{var ie,oe,se,ne,de;let L=r=>{if(!r)return "";let o=new Date(r),l=s=>String(s).padStart(2,"0");return `${o.getFullYear()}-${l(o.getMonth()+1)}-${l(o.getDate())}T${l(o.getHours())}:${l(o.getMinutes())}`},[D,O]=react.useState((t==null?void 0:t.title)||""),[C,Y]=react.useState((t==null?void 0:t.description)||""),[F,U]=react.useState((t==null?void 0:t.category)||""),[T,H]=react.useState(L(t==null?void 0:t.discoveredAt)),[R,_]=react.useState(L(t==null?void 0:t.occurredAt)),[B,Z]=react.useState(((ie=t==null?void 0:t.reporter)==null?void 0:ie.name)||""),[h,G]=react.useState(((oe=t==null?void 0:t.reporter)==null?void 0:oe.email)||""),[j,K]=react.useState(((se=t==null?void 0:t.reporter)==null?void 0:se.department)||""),[E,W]=react.useState(((ne=t==null?void 0:t.reporter)==null?void 0:ne.phone)||""),[J,Q]=react.useState((t==null?void 0:t.affectedSystems)||[]),[xe,X]=react.useState(((de=t==null?void 0:t.affectedSystems)==null?void 0:de.join(", "))||""),[q,V]=react.useState((t==null?void 0:t.dataTypes)||[]),[u,ee]=react.useState((t==null?void 0:t.estimatedAffectedSubjects)!=null?String(t.estimatedAffectedSubjects):""),[re,te]=react.useState((t==null?void 0:t.status)||"ongoing"),[I,ae]=react.useState((t==null?void 0:t.initialActions)||""),[y,$]=react.useState([]),[Ne,P]=react.useState(false),[i,v]=react.useState({}),Ae=()=>{O(""),Y(""),U(""),H(""),_(""),Z(""),G(""),K(""),W(""),Q([]),X(""),V([]),ee(""),te("ongoing"),ae(""),$([]),P(false),v({}),S==null||S();},ke=r=>{let o=r.target.value;X(o);let l=o.split(",").map(s=>s.trim()).filter(Boolean);Q(l);},we=r=>{V(o=>o.includes(r)?o.filter(l=>l!==r):[...o,r]);},Se=r=>{var me;let o=r.target.files;if(!o)return;let l=[],s={};if(y.length+o.length>A){s.attachments=`Maximum of ${A} files allowed`,v(p=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},p),s));return}for(let p=0;p<o.length;p++){let x=o[p];if(x.size>k){s.attachments=`File ${x.name} exceeds the maximum size of ${k/(1024*1024)}MB`;continue}let ce="."+((me=x.name.split(".").pop())==null?void 0:me.toLowerCase());if(!w.includes(ce)){s.attachments=`File type ${ce} is not allowed`;continue}l.push(x);}Object.keys(s).length>0?v(p=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},p),s)):($(p=>[...p,...l]),v(p=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},p),{attachments:""})));},De=r=>{$(o=>o.filter((l,s)=>s!==r));},Ce=()=>{let r={};return D.trim()||(r.breachTitle="Breach title is required"),C.trim()||(r.description="Description is required"),F||(r.category="Category is required"),T||(r.discoveredAt="Discovery date is required"),B.trim()||(r.reporterName="Reporter name is required"),h.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(h)||(r.reporterEmail="Reporter email is invalid"):r.reporterEmail="Reporter email is required",j.trim()||(r.reporterDepartment="Reporter department is required"),J.length===0&&(r.affectedSystems="At least one affected system is required"),q.length===0&&(r.dataTypes="At least one data type is required"),u&&isNaN(Number(u))&&(r.estimatedAffectedSubjects="Estimated affected subjects must be a number"),v(r),r},Fe=r=>{r.preventDefault();let o=Ce();if(Object.keys(o).length>0){N==null||N(o);return}let l={title:chunkEPF7J2FK_js.a(D),description:chunkEPF7J2FK_js.a(C),category:F,discoveredAt:new Date(T).getTime(),occurredAt:R?new Date(R).getTime():void 0,reportedAt:Date.now(),reporter:{name:chunkEPF7J2FK_js.a(B),email:chunkEPF7J2FK_js.a(h),department:chunkEPF7J2FK_js.a(j),phone:E?chunkEPF7J2FK_js.a(E):void 0},affectedSystems:J.map(s=>chunkEPF7J2FK_js.a(s)),dataTypes:q,estimatedAffectedSubjects:u?Number(u):void 0,status:re,initialActions:I?chunkEPF7J2FK_js.a(I):void 0,attachments:y.map(s=>({name:s.name,type:s.type,size:s.size,file:s}))};ge(l),ve&&P(true);};if(Ne)return jsxRuntime.jsxs("div",{className:`p-4 bg-green-50 dark:bg-green-900/20 rounded-md ${M}`,children:[jsxRuntime.jsx("h2",{className:"text-lg font-bold text-green-800 dark:text-green-200 mb-2",children:"Report Submitted"}),jsxRuntime.jsx("p",{className:"text-green-700 dark:text-green-300",children:he}),jsxRuntime.jsxs("div",{className:"mt-4 p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-md",children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold text-yellow-800 dark:text-yellow-200 mb-2",children:"Important: Next Steps"}),jsxRuntime.jsx("p",{className:"text-yellow-700 dark:text-yellow-300 text-sm",children:"Under the NDPA (Section 40), data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."})]}),jsxRuntime.jsx("button",{onClick:()=>P(false),className:`mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${z}`,children:"Report Another Breach"})]});let Te=[{id:"personal",label:"Personal Information (names, addresses)"},{id:"contact",label:"Contact Information (email, phone)"},{id:"financial",label:"Financial Information (bank details, payment info)"},{id:"health",label:"Health Information"},{id:"identification",label:"Identification Documents (ID cards, passports)"},{id:"login",label:"Login Credentials"},{id:"biometric",label:"Biometric Data"},{id:"children",label:"Children's Data"},{id:"location",label:"Location Data"},{id:"communications",label:"Communications Content"}];return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${M}`,d.root,c),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",d.title,c),children:be}),jsxRuntime.jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:fe}),jsxRuntime.jsx("form",{onSubmit:Fe,className:chunkE64TU6IU_js.a("",d.form,c),children:jsxRuntime.jsxs("div",{className:"space-y-6",children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",d.fieldGroup,c),children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Breach Information"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"breachTitle",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",d.label,c),children:["Breach Title/Summary ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"breachTitle",value:D,onChange:r=>O(r.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.input,c),required:true,"aria-invalid":!!i.breachTitle,"aria-describedby":i.breachTitle?"breachTitle-error":void 0}),i.breachTitle&&jsxRuntime.jsx("p",{id:"breachTitle-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.breachTitle})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"category",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",d.label,c),children:["Breach Category ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsxs("select",{id:"category",value:F,onChange:r=>U(r.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.select,c),required:true,"aria-invalid":!!i.category,"aria-describedby":i.category?"category-error":void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select a category"}),pe.map(r=>jsxRuntime.jsx("option",{value:r.id,children:r.name},r.id))]}),i.category&&jsxRuntime.jsx("p",{id:"category-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.category})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{htmlFor:"description",className:chunkE64TU6IU_js.a("block text-sm font-medium mb-1",d.label,c),children:["Detailed Description ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("textarea",{id:"description",value:C,onChange:r=>Y(r.target.value),rows:4,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.textarea,c),required:true,"aria-invalid":!!i.description,"aria-describedby":i.description?"description-error":void 0}),i.description&&jsxRuntime.jsx("p",{id:"description-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.description})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"discoveredAt",className:"block text-sm font-medium mb-1",children:["Date Discovered ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"datetime-local",id:"discoveredAt",value:T,onChange:r=>H(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.discoveredAt,"aria-describedby":i.discoveredAt?"discoveredAt-error":void 0}),i.discoveredAt&&jsxRuntime.jsx("p",{id:"discoveredAt-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.discoveredAt})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"occurredAt",className:"block text-sm font-medium mb-1",children:"Date Occurred (if known)"}),jsxRuntime.jsx("input",{type:"datetime-local",id:"occurredAt",value:R,onChange:r=>_(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Reporter Information"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reporterName",className:"block text-sm font-medium mb-1",children:["Your Name ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"reporterName",value:B,onChange:r=>Z(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.reporterName,"aria-describedby":i.reporterName?"reporterName-error":void 0}),i.reporterName&&jsxRuntime.jsx("p",{id:"reporterName-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.reporterName})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reporterEmail",className:"block text-sm font-medium mb-1",children:["Your Email ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"email",id:"reporterEmail",value:h,onChange:r=>G(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.reporterEmail,"aria-describedby":i.reporterEmail?"reporterEmail-error":void 0}),i.reporterEmail&&jsxRuntime.jsx("p",{id:"reporterEmail-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.reporterEmail})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"reporterDepartment",className:"block text-sm font-medium mb-1",children:["Your Department ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"reporterDepartment",value:j,onChange:r=>K(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.reporterDepartment,"aria-describedby":i.reporterDepartment?"reporterDepartment-error":void 0}),i.reporterDepartment&&jsxRuntime.jsx("p",{id:"reporterDepartment-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.reporterDepartment})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"reporterPhone",className:"block text-sm font-medium mb-1",children:"Your Phone Number (Optional)"}),jsxRuntime.jsx("input",{type:"tel",id:"reporterPhone",value:E,onChange:r=>W(r.target.value),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]"})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Impact Information"}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"affectedSystems",className:"block text-sm font-medium mb-1",children:["Affected Systems/Applications ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"affectedSystems",value:xe,onChange:ke,placeholder:"e.g. CRM, Email Server, Website (comma separated)",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",required:true,"aria-invalid":!!i.affectedSystems,"aria-describedby":i.affectedSystems?"affectedSystems-error":void 0}),i.affectedSystems&&jsxRuntime.jsx("p",{id:"affectedSystems-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.affectedSystems})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"estimatedAffectedSubjects",className:"block text-sm font-medium mb-1",children:"Estimated Number of Affected Data Subjects"}),jsxRuntime.jsx("input",{type:"text",id:"estimatedAffectedSubjects",value:u,onChange:r=>ee(r.target.value),placeholder:"e.g. 100",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]","aria-invalid":!!i.estimatedAffectedSubjects,"aria-describedby":i.estimatedAffectedSubjects?"estimatedAffectedSubjects-error":void 0}),i.estimatedAffectedSubjects&&jsxRuntime.jsx("p",{id:"estimatedAffectedSubjects-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.estimatedAffectedSubjects})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsxs("label",{className:"block text-sm font-medium mb-1",children:["Types of Data Involved ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsx("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2",children:Te.map(r=>jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("input",{type:"checkbox",id:`dataType_${r.id}`,checked:q.includes(r.id),onChange:()=>we(r.id),className:"h-4 w-4 rounded border-gray-300 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("label",{htmlFor:`dataType_${r.id}`,className:"ml-2 text-sm text-gray-700 dark:text-gray-300",children:r.label})]},r.id))}),i.dataTypes&&jsxRuntime.jsx("p",{id:"dataTypes-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.dataTypes})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"status",className:"block text-sm font-medium mb-1",children:["Current Status ",jsxRuntime.jsx("span",{className:"text-red-500",children:"*"})]}),jsxRuntime.jsxs("select",{id:"status",value:re,onChange:r=>te(r.target.value),className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.select,c),required:true,children:[jsxRuntime.jsx("option",{value:"ongoing",children:"Ongoing (breach is still active)"}),jsxRuntime.jsx("option",{value:"contained",children:"Contained (breach is stopped but not resolved)"}),jsxRuntime.jsx("option",{value:"resolved",children:"Resolved (breach is fully addressed)"})]})]}),jsxRuntime.jsxs("div",{className:"md:col-span-2",children:[jsxRuntime.jsx("label",{htmlFor:"initialActions",className:"block text-sm font-medium mb-1",children:"Initial Actions Taken"}),jsxRuntime.jsx("textarea",{id:"initialActions",value:I,onChange:r=>ae(r.target.value),placeholder:"Describe any immediate actions that have been taken to address the breach",rows:3,className:chunkE64TU6IU_js.a("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",d.textarea,c)})]})]})]}),ye&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-semibold mb-3",children:"Attachments"}),jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("label",{className:"block text-sm font-medium mb-1",children:"Upload Supporting Files (Optional)"}),jsxRuntime.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-2",children:["Max ",A," files, ",k/(1024*1024),"MB each. Allowed types: ",w.join(", ")]}),jsxRuntime.jsx("input",{type:"file",onChange:Se,multiple:true,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",accept:w.join(",")}),i.attachments&&jsxRuntime.jsx("p",{id:"attachments-error",role:"alert",className:"mt-1 text-sm text-red-500",children:i.attachments})]}),y.length>0&&jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium mb-2",children:"Attached Files:"}),jsxRuntime.jsx("ul",{className:"space-y-2",children:y.map((r,o)=>jsxRuntime.jsxs("li",{className:"flex items-center justify-between p-2 bg-gray-50 dark:bg-gray-700 rounded",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("svg",{className:"w-4 h-4 text-gray-500 dark:text-gray-400 mr-2",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M8 4a3 3 0 00-3 3v4a5 5 0 0010 0V7a1 1 0 112 0v4a7 7 0 11-14 0V7a5 5 0 0110 0v4a3 3 0 11-6 0V7a1 1 0 012 0v4a1 1 0 102 0V7a3 3 0 00-3-3z",clipRule:"evenodd"})}),jsxRuntime.jsx("span",{className:"text-sm text-gray-700 dark:text-gray-300",children:r.name}),jsxRuntime.jsxs("span",{className:"ml-2 text-xs text-gray-600 dark:text-gray-400",children:["(",(r.size/1024).toFixed(1)," KB)"]})]}),jsxRuntime.jsx("button",{type:"button",onClick:()=>De(o),className:"text-red-500 hover:text-red-700",children:jsxRuntime.jsx("svg",{className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg",children:jsxRuntime.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})})})]},o))})]})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mt-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md",d.notice,c),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2",children:"NDPA Breach Notification Requirements"}),jsxRuntime.jsx("p",{className:"text-blue-700 dark:text-blue-300 text-sm",children:"Under the Nigeria Data Protection Act (NDPA), Section 40, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to the NDPC within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."})]}),jsxRuntime.jsxs("div",{className:"mt-6 relative flex gap-3",children:[f&&d.loadingOverlay&&jsxRuntime.jsx("div",{className:d.loadingOverlay}),jsxRuntime.jsx("button",{type:"submit",disabled:f,className:chunkE64TU6IU_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${z} ${f?"opacity-50 cursor-not-allowed":""}`,d.primaryButton||d.submitButton,c),children:f?"Submitting...":ue}),jsxRuntime.jsx("button",{type:"button",onClick:Ae,disabled:f,className:chunkE64TU6IU_js.a("px-6 py-3 bg-gray-200 dark:bg-gray-600 text-gray-700 dark:text-gray-200 rounded-md hover:bg-gray-300 dark:hover:bg-gray-500 focus:outline-none focus:ring-2 focus:ring-gray-400 focus:ring-offset-2",void 0,c),children:"Reset"})]})]})})]})};
2
+ exports.a=qe;//# sourceMappingURL=chunk-GVANK6PL.js.map
3
+ //# sourceMappingURL=chunk-GVANK6PL.js.map
@@ -0,0 +1,2 @@
1
+ import {a as a$1}from'./chunk-PGSA2O5P.mjs';import {a as a$2}from'./chunk-SBNAMPAP.mjs';import {b,a}from'./chunk-WWT2ZSNU.mjs';import {useRef,useState,useEffect}from'react';function H(a,A){return A?a$2(a):{load:()=>null,save:()=>{},remove:()=>{}}}function Y({sections:a$2,initialAnswers:A={},adapter:h,storageKey:E="ndpr_dpia_data",useLocalStorage:T=true,onComplete:I}){let w=h!=null?h:H(E,T),d=useRef(w);d.current=w;let[f,g]=useState(0),[o,p]=useState(A),[C,m]=useState(true);useEffect(()=>{let r=false;try{let s=d.current.load();s instanceof Promise?s.then(e=>{r||(e&&p(e),m(!1));},()=>{r||m(!1);}):(s&&p(s),m(!1));}catch(s){r||m(false);}return ()=>{r=true;}},[]);let c=a$2[f]||null,W=r=>{Promise.resolve(d.current.save(r)).catch(s=>{console.warn("[ndpr-toolkit] Failed to save DPIA answers:",s);});},_=(r,s)=>{p(e=>{let t=b(a({},e),{[r]:s});return W(t),t});},b$1=r=>r.showWhen?r.showWhen.every(s=>{let e=o[s.questionId];switch(s.operator){case "equals":return e===s.value;case "contains":return Array.isArray(e)?e.includes(s.value):false;case "greaterThan":return typeof e=="number"?e>s.value:false;case "lessThan":return typeof e=="number"?e<s.value:false;default:return true}}):true,v=()=>c?c.questions.filter(b$1):[],P=()=>c?v().every(s=>{if(!s.required)return true;let e=o[s.id];return !(e==null||typeof e=="string"&&e.trim()===""||Array.isArray(e)&&e.length===0)}):false,$=()=>{let r={};return c&&v().forEach(e=>{if(!e.required)return;let t=o[e.id];t==null||typeof t=="string"&&t.trim()===""?r[e.id]="This question is required":Array.isArray(t)&&t.length===0&&(r[e.id]="At least one option must be selected");}),r},O=()=>P()&&f<a$2.length-1?(g(r=>r+1),true):false,U=()=>f>0?(g(r=>r-1),true):false,V=r=>r>=0&&r<a$2.length?(g(r),true):false,B=()=>a$2.every(r=>r.questions.filter(e=>!e.showWhen||e.showWhen.length===0?true:e.showWhen.some(t=>{let n=o[t.questionId];switch(t.operator){case "equals":return n===t.value;case "contains":return Array.isArray(n)&&n.includes(t.value);case "greaterThan":return typeof n=="number"&&n>t.value;case "lessThan":return typeof n=="number"&&n<t.value;default:return false}})).every(e=>{if(!e.required)return true;let t=o[e.id];return !(t==null||typeof t=="string"&&t.trim()===""||Array.isArray(t)&&t.length===0)})),F=()=>{let r=[];return a$2.forEach(s=>{s.questions.forEach(e=>{let t=o[e.id];if(t!=null&&e.riskLevel)if(["select","radio","checkbox"].includes(e.type)&&e.options)(Array.isArray(t)?t:[t]).forEach(i=>{var D;let l=(D=e.options)==null?void 0:D.find(u=>u.value===i);if(l!=null&&l.riskLevel){let u=l.riskLevel,R=u==="low"?1:u==="medium"?3:5,S=u==="low"?1:u==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:`${e.text} - ${l.label}`,likelihood:R,impact:S,score:R*S,level:u,mitigated:false,relatedQuestionIds:[e.id]});}});else {let n=e.riskLevel,i=n==="low"?1:n==="medium"?3:5,l=n==="low"?1:n==="medium"?3:5;r.push({id:`risk_${r.length+1}`,description:e.text,likelihood:i,impact:l,score:i*l,level:n,mitigated:false,relatedQuestionIds:[e.id]});}});}),r},K=(r,s,e)=>{let t=F(),n={id:`dpia_${Date.now()}`,title:s,processingDescription:e,startedAt:Date.now(),completedAt:Date.now(),assessor:r,answers:o,risks:t,overallRiskLevel:"low",canProceed:true,conclusion:"",version:"1.0"},i=a$1(n);return n.overallRiskLevel=i.overallRiskLevel,n.canProceed=i.canProceed,n.conclusion=i.canProceed?"Based on the assessment, the processing can proceed with appropriate safeguards.":"Based on the assessment, the processing should not proceed without further mitigation measures.",n.recommendations=i.recommendations,I&&I(n),n},M=()=>{p({}),g(0),Promise.resolve(d.current.remove()).catch(r=>{console.warn("[ndpr-toolkit] Failed to remove DPIA data:",r);});},j=(()=>{let r=0,s=0;return a$2.forEach(e=>{e.questions.forEach(t=>{if(t.required&&b$1(t)){s++;let n=o[t.id];n!=null&&!(typeof n=="string"&&n.trim()==="")&&!(Array.isArray(n)&&n.length===0)&&r++;}});}),s>0?Math.round(r/s*100):0})();return {currentSectionIndex:f,currentSection:c,answers:o,updateAnswer:_,nextSection:O,prevSection:U,goToSection:V,isCurrentSectionValid:P,getCurrentSectionErrors:$,isComplete:B,completeDPIA:K,getVisibleQuestions:v,resetDPIA:M,progress:j,isLoading:C}}export{Y as a};//# sourceMappingURL=chunk-HNZK7LY3.mjs.map
2
+ //# sourceMappingURL=chunk-HNZK7LY3.mjs.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunk5RSOLEEP_js=require('./chunk-5RSOLEEP.js'),chunkUK656RCG_js=require('./chunk-UK656RCG.js'),chunkMQFZHA2D_js=require('./chunk-MQFZHA2D.js'),react=require('react');function _(f,s){return s?chunkUK656RCG_js.a(f):{load:()=>null,save:()=>{},remove:()=>{}}}function z({templates:f,initialPolicy:s,adapter:y,storageKey:T="ndpr_privacy_policy",useLocalStorage:I=true,onGenerate:p}){let P=y!=null?y:_(T,I),o=react.useRef(P);o.current=P;let[a,d]=react.useState(s||null),[u,g]=react.useState(null),[m,h]=react.useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),[w,v]=react.useState(true);react.useEffect(()=>{if(s){v(false);return}let e=false;try{let n=o.current.load(),i=t=>{if(t){if(d(t),t.templateId){let l=f.find(U=>U.id===t.templateId);l&&g(l);}t.organizationInfo&&h(t.organizationInfo);}v(!1);};n instanceof Promise?n.then(t=>{e||i(t);},()=>{e||v(!1);}):i(n);}catch(n){e||v(false);}return ()=>{e=true;}},[s,f]);let x=e=>{Promise.resolve(o.current.save(e)).catch(n=>{console.warn("[ndpr-toolkit] Failed to save policy:",n);});},E=e=>{let n=f.find(l=>l.id===e);if(!n)return false;g(n);n.sections.map(l=>chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},l),{customContent:void 0}));return Object.keys(n.variables).forEach(l=>{n.variables[l].defaultValue||"";}),true},q=e=>{h(n=>chunkMQFZHA2D_js.a(chunkMQFZHA2D_js.a({},n),e));},N=(e,n)=>{u&&(a?d(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{sections:i.sections.map(t=>t.id===e?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{included:n}):t)})):g(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{sections:i.sections.map(t=>t.id===e?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{included:n}):t)})));},D=(e,n)=>{u&&(a?d(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{sections:i.sections.map(t=>t.id===e?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{customContent:n}):t)})):g(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{sections:i.sections.map(t=>t.id===e?chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},t),{customContent:n}):t)})));},C=(e,n)=>{a&&d(i=>i&&chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{variableValues:chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i.variableValues),{[e]:n})}));},R=()=>"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9);return {policy:a,selectedTemplate:u,organizationInfo:m,selectTemplate:E,updateOrganizationInfo:q,toggleSection:N,updateSectionContent:D,updateVariableValue:C,generatePolicy:()=>{if(!u)throw new Error("No template selected");let e=Date.now(),n={id:(a==null?void 0:a.id)||R(),title:`Privacy Policy for ${m.name}`,templateId:u.id,organizationInfo:m,sections:u.sections.map(i=>{var t;return chunkMQFZHA2D_js.b(chunkMQFZHA2D_js.a({},i),{customContent:(t=a==null?void 0:a.sections.find(l=>l.id===i.id))==null?void 0:t.customContent})}),variableValues:(a==null?void 0:a.variableValues)||{},effectiveDate:e,lastUpdated:e,version:"1.0"};return d(n),x(n),p&&p(n),n},getPolicyText:()=>{if(!a)return {fullText:"",sectionTexts:{},missingVariables:[]};let e=chunk5RSOLEEP_js.a(a.sections,a.organizationInfo);return typeof e=="string"?{fullText:e,sectionTexts:{full:e},missingVariables:[]}:e},resetPolicy:()=>{d(null),g(null),h({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),Promise.resolve(o.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove policy:",e);});},isValid:()=>{let e=[];if(u||e.push("No template selected"),m.name||e.push("Organization name is required"),m.website||e.push("Organization website is required"),m.privacyEmail||e.push("Privacy contact email is required"),u){let n=u.sections.filter(t=>t.required),i=(a==null?void 0:a.sections.filter(t=>t.included))||[];n.forEach(t=>{i.some(l=>l.id===t.id)||e.push(`Required section "${t.title}" must be included`);});}return u&&a&&Object.entries(u.variables).forEach(([n,i])=>{i.required&&!a.variableValues[n]&&e.push(`Required variable "${i.name}" must have a value`);}),{valid:e.length===0,errors:e}},isLoading:w}}function W(f={}){let{orgInfo:s,storageKey:y,useLocalStorage:T}=f,{sections:I,variables:p}=chunk5RSOLEEP_js.d();if(s)for(let o of p)s.name&&o.name==="orgName"&&(o.value=s.name),s.email&&o.name==="privacyEmail"&&(o.value=s.email),s.dpoName&&o.name==="dpoName"&&(o.value=s.dpoName);let P={id:"default-business",name:"Default Business Policy",description:"NDPA-compliant privacy policy template for businesses.",organizationType:"business",sections:I,variables:Object.fromEntries(p.map(o=>[o.name,{name:o.name,description:o.description,required:o.required,defaultValue:o.value||void 0}])),version:"1.0",lastUpdated:Date.now(),ndpaCompliant:true};return z({templates:[P],storageKey:y,useLocalStorage:T})}exports.a=z;exports.b=W;//# sourceMappingURL=chunk-IKEPXHCZ.js.map
2
+ //# sourceMappingURL=chunk-IKEPXHCZ.js.map
@@ -0,0 +1,2 @@
1
+ 'use strict';var chunkCMZTI7SG_js=require('./chunk-CMZTI7SG.js'),chunkE64TU6IU_js=require('./chunk-E64TU6IU.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var oe=({requests:k,onSelectRequest:T,onUpdateStatus:$,onAssignRequest:I,title:H="Data Subject Request Dashboard",description:X="Track and manage data subject requests in compliance with NDPA Part IV requirements.",className:J="",buttonClassName:V="",showRequestDetails:K=true,showRequestTimeline:Y=true,showDeadlineAlerts:F=true,assignees:i=[],classNames:s,unstyled:f=false})=>{let[R,y]=react.useState(null),[N,B]=react.useState(k),[j,O]=react.useState("all"),[C,M]=react.useState("all"),[A,_]=react.useState(""),[P,z]=react.useState("createdAt"),[L,Z]=react.useState("desc"),[D,G]=react.useState("");react.useEffect(()=>{let e=[...k];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 w=0;switch(P){case "createdAt":w=r.createdAt-p.createdAt;break;case "dueDate":w=(r.dueDate||0)-(p.dueDate||0);break;case "type":w=r.type.localeCompare(p.type);break;case "status":w=r.status.localeCompare(p.status);break;default:w=r.createdAt-p.createdAt;}return L==="asc"?w:-w}),B(e);},[k,j,C,A,P,L]),react.useEffect(()=>{N.length>0&&!R&&y(N[0].id);},[N,R]);let Q=e=>{y(e),T&&T(e);},U=e=>{R&&$&&$(R,e);},W=()=>{R&&D&&I&&(I(R,D),G(""));},h=e=>new Date(e).toLocaleDateString(),E=e=>{let r=Date.now(),p=(e-r)/(1440*60*1e3);return Math.ceil(p)},m=R?k.find(e=>e.id===R):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 jsxRuntime.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${r[e]}`,children:p[e]})},l=e=>jsxRuntime.jsx("span",{className:chunkE64TU6IU_js.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]}`,s==null?void 0:s.statusBadge,f),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=E(e.dueDate);return r<=0?jsxRuntime.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Deadline Passed"}),jsxRuntime.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?jsxRuntime.jsxs("div",{className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-red-800 dark:text-red-200 font-medium",children:"Urgent: Deadline Approaching"}),jsxRuntime.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?jsxRuntime.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium",children:"Deadline Approaching"}),jsxRuntime.jsxs("p",{className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1",children:[r," days remaining until the response deadline."]})]}):jsxRuntime.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md",children:[jsxRuntime.jsx("p",{className:"text-sm text-green-800 dark:text-green-200 font-medium",children:"Deadline Tracking"}),jsxRuntime.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 ${h(e.createdAt)}.`}];return e.verifiedAt?r.push({title:"Identity Verified",date:e.verifiedAt,completed:true,description:`Data subject's identity was verified on ${h(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 ${h(e.updatedAt)}.`}),e.status==="completed"?r.push({title:"Request Completed",date:e.completedAt||Date.now(),completed:true,description:`Request was completed on ${h(e.completedAt||Date.now())}.`}):e.status==="rejected"&&r.push({title:"Request Rejected",date:e.completedAt||Date.now(),completed:true,description:`Request was rejected on ${h(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 ${h(e.dueDate)}.`}),jsxRuntime.jsxs("div",{className:"mt-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),jsxRuntime.jsx("ol",{className:"relative border-l border-gray-200 dark:border-gray-700",children:r.map((p,w)=>jsxRuntime.jsxs("li",{className:"mb-6 ml-4",children:[jsxRuntime.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"}`}),jsxRuntime.jsx("time",{className:"mb-1 text-sm font-normal leading-none text-gray-600 dark:text-gray-500",children:p.date?h(p.date):"Pending"}),jsxRuntime.jsx("h4",{className:"text-sm font-semibold text-gray-900 dark:text-white",children:p.title}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:p.description})]},w))})]})},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=>jsxRuntime.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=>jsxRuntime.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=>jsxRuntime.jsx("option",{value:r.value,children:r.label},r.value));return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${J}`,s==null?void 0:s.root,f),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("",s==null?void 0:s.header,f),children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",s==null?void 0:s.title,f),children:H}),jsxRuntime.jsx("p",{className:"mb-6 text-gray-600 dark:text-gray-300",children:X})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",s==null?void 0:s.filters,f),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"statusFilter",className:"block text-sm font-medium mb-1",children:"Status Filter"}),jsxRuntime.jsx("select",{id:"statusFilter",value:j,onChange:e=>O(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()})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"typeFilter",className:"block text-sm font-medium mb-1",children:"Request Type Filter"}),jsxRuntime.jsx("select",{id:"typeFilter",value:C,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:o()})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"sortBy",className:"block text-sm font-medium mb-1",children:"Sort By"}),jsxRuntime.jsxs("select",{id:"sortBy",value:P,onChange:e=>z(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:[jsxRuntime.jsx("option",{value:"createdAt",children:"Date Received"}),jsxRuntime.jsx("option",{value:"dueDate",children:"Due Date"}),jsxRuntime.jsx("option",{value:"type",children:"Request Type"}),jsxRuntime.jsx("option",{value:"status",children:"Status"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"searchTerm",className:"block text-sm font-medium mb-1",children:"Search"}),jsxRuntime.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))]"})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-3 gap-6",children:[jsxRuntime.jsxs("div",{className:"md:col-span-1",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"DSR Requests"}),N.length===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data subject requests found."}):jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("space-y-2 max-h-96 overflow-y-auto pr-2",s==null?void 0:s.requestList,f),children:N.map(e=>{let r=e.dueDate?E(e.dueDate):null,p=null;return r!==null&&(r<=0?p=jsxRuntime.jsx("span",{className:"text-xs text-red-600 dark:text-red-400 font-bold",children:"Overdue"}):r<=3?p=jsxRuntime.jsx("span",{className:"text-xs text-red-600 dark:text-red-400",children:"Urgent"}):r<=7&&(p=jsxRuntime.jsx("span",{className:"text-xs text-yellow-600 dark:text-yellow-400",children:"Soon"}))),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`p-3 rounded-md cursor-pointer ${R===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"}`,s==null?void 0:s.requestItem,f),onClick:()=>Q(e.id),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-sm",children:e.subject.name}),t(e.type)]}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:e.subject.email}),jsxRuntime.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:["Received: ",h(e.createdAt)]}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center mt-2",children:[jsxRuntime.jsx("div",{children:l(e.status)}),jsxRuntime.jsx("div",{children:p})]})]},e.id)})})]}),jsxRuntime.jsx("div",{className:chunkE64TU6IU_js.a("md:col-span-2",s==null?void 0:s.detailPanel,f),children:m?jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium",children:m.subject.name}),jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[t(m.type),l(m.status)]})]}),F&&m.dueDate&&jsxRuntime.jsx("div",{className:"mb-4",children:g(m)}),K&&jsxRuntime.jsxs("div",{className:"mb-6",children:[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:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Email:"})," ",m.subject.email]}),m.subject.phone&&jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Phone:"})," ",m.subject.phone]}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Received:"})," ",h(m.createdAt)]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.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]}),jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.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&&jsxRuntime.jsxs("p",{className:"text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Due Date:"})," ",h(m.dueDate)]})]})]}),m.description&&jsxRuntime.jsxs("div",{className:"mb-4",children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Request Details:"}),jsxRuntime.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&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-sm font-medium",children:"Additional Information:"}),jsxRuntime.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")})]})]}),jsxRuntime.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-md font-medium mb-2",children:"Update Status"}),jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsx("select",{value:m.status,onChange:e=>U(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()}),jsxRuntime.jsx("button",{onClick:()=>U(m.status),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${V}`,children:"Update"})]})]}),i.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-md font-medium mb-2",children:"Assign Request"}),jsxRuntime.jsxs("div",{className:"flex space-x-2",children:[jsxRuntime.jsxs("select",{value:D,onChange:e=>G(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:[jsxRuntime.jsx("option",{value:"",children:"Select Assignee"}),i.map(e=>jsxRuntime.jsx("option",{value:e,children:e},e))]}),jsxRuntime.jsx("button",{onClick:W,disabled:!D,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 ${V}`,children:"Assign"})]})]})]}),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Request Summary"}),jsxRuntime.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md",children:jsxRuntime.jsx("pre",{className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200",children:jsxRuntime.jsx("pre",{children:JSON.stringify(chunkCMZTI7SG_js.a(m),null,2)})})})]}),Y&&x(m)]}):jsxRuntime.jsx("div",{className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400",children:"Select a request to view details"})})})]})]})};var ue=({requests:k,onSelectRequest:T,title:$="DSR Request Tracker",description:I="Track the status and progress of data subject requests as required by NDPA Part IV.",className:H="",buttonClassName:X="",showSummaryStats:J=true,showTypeBreakdown:V=true,showStatusBreakdown:K=true,showTimelineChart:Y=true,showOverdueRequests:F=true,classNames:i,unstyled:s=false})=>{let[f,R]=react.useState("30days"),[y,N]=react.useState(k),[B,j]=react.useState([]),[O,C]=react.useState([]);react.useEffect(()=>{let t=Date.now(),l;switch(f){case "7days":l=k.filter(o=>t-o.createdAt<=10080*60*1e3);break;case "30days":l=k.filter(o=>t-o.createdAt<=720*60*60*1e3);break;case "90days":l=k.filter(o=>t-o.createdAt<=2160*60*60*1e3);break;default:l=[...k];}N(l);let g=l.filter(o=>o.dueDate&&t>o.dueDate&&o.status!=="completed"&&o.status!=="rejected");j(g);let x=l.filter(o=>o.dueDate&&t<o.dueDate&&o.dueDate-t<=10080*60*1e3&&o.status!=="completed"&&o.status!=="rejected");C(x);},[k,f]);let M=t=>{T&&T(t);},A=t=>new Date(t).toLocaleDateString(),_=t=>{let l=Date.now(),g=(t-l)/(1440*60*1e3);return Math.ceil(g)},P=()=>{let t=y.filter(g=>g.status==="completed"&&g.completedAt&&g.createdAt);if(t.length===0)return null;let l=t.reduce((g,x)=>{let o=((x.completedAt||0)-x.createdAt)/864e5;return g+o},0);return Number((l/t.length).toFixed(1))},z=()=>{let t=y.filter(g=>(g.status==="completed"||g.status==="rejected")&&g.completedAt&&g.dueDate);if(t.length===0)return null;let l=t.filter(g=>(g.completedAt||0)<=(g.dueDate||0));return Math.round(l.length/t.length*100)},L=()=>{let t={};return y.forEach(l=>{t[l.type]=(t[l.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 y.forEach(l=>{t[l.status]=(t[l.status]||0)+1;}),{pending:t.pending||0,awaitingVerification:t.awaitingVerification||0,inProgress:t.inProgress||0,completed:t.completed||0,rejected:t.rejected||0}},D=t=>{let l={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 jsxRuntime.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${l[t]}`,children:g[t]})},Q=()=>{let t=y.length,l=y.filter(u=>u.status!=="completed"&&u.status!=="rejected").length;y.filter(u=>u.status==="completed"||u.status==="rejected").length;let x=P(),o=z();return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",i==null?void 0:i.stats,s),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,s),children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Total Requests"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:t})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,s),children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Pending Requests"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:l})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,s),children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Avg. Response Time"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:x!==null?`${x} days`:"N/A"})]}),jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow",i==null?void 0:i.statCard,s),children:[jsxRuntime.jsx("h4",{className:"text-sm font-medium text-gray-600 dark:text-gray-400 mb-1",children:"Compliance Rate"}),jsxRuntime.jsx("p",{className:"text-2xl font-bold",children:o!==null?`${o}%`:"N/A"})]})]})},U=()=>{let t=L(),l=y.length,g=Object.entries(t).sort(([,x],[,o])=>o-x).map(([x])=>x);return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",i==null?void 0:i.table,s),children:[jsxRuntime.jsx("h3",{className:chunkE64TU6IU_js.a("text-lg font-medium mb-4",i==null?void 0:i.tableHeader,s),children:"Request Types"}),l===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxRuntime.jsx("div",{className:"space-y-4",children:g.map(x=>{let o=t[x],u=Math.round(o/l*100);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center mb-1",children:[jsxRuntime.jsxs("div",{className:"flex items-center",children:[D(x),jsxRuntime.jsxs("span",{className:"ml-2 text-sm",children:[o," requests"]})]}),jsxRuntime.jsxs("span",{className:"text-sm font-medium",children:[u,"%"]})]}),jsxRuntime.jsx("div",{className:"w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2.5",children:jsxRuntime.jsx("div",{className:"bg-[rgb(var(--ndpr-primary))] h-2.5 rounded-full",style:{width:`${u}%`}})})]},x)})})]})},W=()=>{let t=Z(),l=y.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 jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",i==null?void 0:i.table,s),children:[jsxRuntime.jsx("h3",{className:chunkE64TU6IU_js.a("text-lg font-medium mb-4",i==null?void 0:i.tableHeader,s),children:"Request Status"}),l===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("div",{className:"flex h-4 mb-2",children:g.map(o=>{let u=t[o],v=u/l*100;return v>0?jsxRuntime.jsx("div",{className:`${x[o]} first:rounded-l-full last:rounded-r-full`,style:{width:`${v}%`},title:`${o}: ${u} (${Math.round(v)}%)`},o):null})}),jsxRuntime.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/l*100);return jsxRuntime.jsxs("div",{className:"flex items-center",children:[jsxRuntime.jsx("div",{className:`w-3 h-3 rounded-full ${x[o]} mr-2`}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("p",{className:"text-xs font-medium",children:o==="inProgress"?"In Progress":o==="awaitingVerification"?"Awaiting Verification":o.charAt(0).toUpperCase()+o.slice(1)}),jsxRuntime.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:[u," (",v,"%)"]})]})]},o)})})]})]})},h=()=>{let t={};y.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 jsxRuntime.jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Request Timeline"}),g.length===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No data available for the selected timeframe."}):jsxRuntime.jsxs("div",{className:"h-40",children:[jsxRuntime.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 jsxRuntime.jsx("div",{className:"flex flex-col items-center flex-1",children:jsxRuntime.jsx("div",{className:"w-full bg-[rgb(var(--ndpr-primary))] rounded-t",style:{height:e},title:`${o(u)}: ${v} requests`})},u)})}),jsxRuntime.jsx("div",{className:"flex justify-between mt-2",children:g.map(u=>jsxRuntime.jsx("div",{className:"text-xs text-center",children:o(u)},u))})]})]})},E=()=>jsxRuntime.jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Overdue Requests"}),B.length===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No overdue requests."}):jsxRuntime.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:B.map(t=>jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.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,s),onClick:()=>M(t.id),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-sm",children:t.subject.name}),D(t.type)]}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:t.subject.email}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",A(t.dueDate||0)]}),jsxRuntime.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=()=>jsxRuntime.jsxs("div",{className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Upcoming Deadlines"}),O.length===0?jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-400 text-sm",children:"No upcoming deadlines in the next 7 days."}):jsxRuntime.jsx("div",{className:"space-y-2 max-h-60 overflow-y-auto",children:O.map(t=>{let l=_(t.dueDate||0);return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.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,s),onClick:()=>M(t.id),children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-1",children:[jsxRuntime.jsx("h4",{className:"font-medium text-sm",children:t.subject.name}),D(t.type)]}),jsxRuntime.jsx("p",{className:"text-xs text-gray-600 dark:text-gray-400 mb-1",children:t.subject.email}),jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsxs("p",{className:"text-xs text-gray-600 dark:text-gray-400",children:["Due: ",A(t.dueDate||0)]}),jsxRuntime.jsxs("p",{className:`text-xs font-bold ${l<=3?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400"}`,children:["Due in ",l," days"]})]})]},t.id)})})]});return jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${H}`,i==null?void 0:i.root,s),children:[jsxRuntime.jsxs("div",{className:chunkE64TU6IU_js.a("flex flex-col md:flex-row md:justify-between md:items-center mb-6",i==null?void 0:i.header,s),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:chunkE64TU6IU_js.a("text-xl font-bold mb-2",i==null?void 0:i.title,s),children:$}),jsxRuntime.jsx("p",{className:"text-gray-600 dark:text-gray-300",children:I})]}),jsxRuntime.jsxs("div",{className:"mt-4 md:mt-0",children:[jsxRuntime.jsx("label",{htmlFor:"timeframe",className:"block text-sm font-medium mb-1",children:"Timeframe"}),jsxRuntime.jsxs("select",{id:"timeframe",value:f,onChange:t=>R(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:[jsxRuntime.jsx("option",{value:"7days",children:"Last 7 Days"}),jsxRuntime.jsx("option",{value:"30days",children:"Last 30 Days"}),jsxRuntime.jsx("option",{value:"90days",children:"Last 90 Days"}),jsxRuntime.jsx("option",{value:"all",children:"All Time"})]})]})]}),J&&Q(),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6",children:[jsxRuntime.jsxs("div",{children:[V&&U(),K&&W()]}),jsxRuntime.jsxs("div",{children:[Y&&h(),F&&E(),F&&m()]})]})]})};exports.a=oe;exports.b=ue;//# sourceMappingURL=chunk-IQQW52EF.js.map
2
+ //# sourceMappingURL=chunk-IQQW52EF.js.map