@tantainnovative/ndpr-toolkit 5.1.1 → 5.1.3

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 (111) hide show
  1. package/CHANGELOG.md +31 -0
  2. package/README.md +1 -1
  3. package/dist/breach.js +1 -1
  4. package/dist/breach.mjs +1 -1
  5. package/dist/{chunk-BRJKIF7E.mjs → chunk-2ASQQYJR.mjs} +1 -1
  6. package/dist/{chunk-3SIYRGJF.js → chunk-2MGLU3FY.js} +3 -3
  7. package/dist/{chunk-CSE36REY.js → chunk-2OSZT7KI.js} +1 -1
  8. package/dist/{chunk-MAD7QYRK.js → chunk-37VR2MXL.js} +1 -1
  9. package/dist/{chunk-3H6FYU3Z.mjs → chunk-5E56KT7E.mjs} +1 -1
  10. package/dist/{chunk-V5TZJJWU.mjs → chunk-5LJ652AH.mjs} +1 -1
  11. package/dist/{chunk-F5MGMNQF.js → chunk-6KQADEFS.js} +1 -1
  12. package/dist/{chunk-D2UWB5OI.js → chunk-6MO3GS3B.js} +1 -1
  13. package/dist/{chunk-WPH6CJDL.mjs → chunk-6UGLAVRM.mjs} +1 -1
  14. package/dist/{chunk-TTMGFC6C.js → chunk-7563FVMY.js} +1 -1
  15. package/dist/{chunk-SBSYHCPK.mjs → chunk-AS2M5OTX.mjs} +1 -1
  16. package/dist/chunk-BHUJWWCO.js +1 -0
  17. package/dist/{chunk-42UJFTII.js → chunk-C32TMS75.js} +1 -1
  18. package/dist/{chunk-6A6VI7ZP.mjs → chunk-C77CRJLD.mjs} +1 -1
  19. package/dist/{chunk-3I6FYA5C.js → chunk-C7OOUURS.js} +1 -1
  20. package/dist/{chunk-BPMVJOHH.mjs → chunk-CNCEP66F.mjs} +1 -1
  21. package/dist/{chunk-WCTFED27.js → chunk-DRQURLN5.js} +1 -1
  22. package/dist/{chunk-L3FR4PQE.mjs → chunk-EAV4BZKO.mjs} +1 -1
  23. package/dist/{chunk-J7BIJ45O.mjs → chunk-EF5CLD4V.mjs} +1 -1
  24. package/dist/{chunk-4FXRJH37.js → chunk-ERCGW2DJ.js} +1 -1
  25. package/dist/{chunk-UZNWXJ2W.js → chunk-FRHFIEWZ.js} +1 -1
  26. package/dist/{chunk-ELK6VFKC.mjs → chunk-HDPXARLC.mjs} +1 -1
  27. package/dist/{chunk-I2ZBMR7F.mjs → chunk-HMKXK23C.mjs} +1 -1
  28. package/dist/{chunk-YDKWD6MQ.js → chunk-I5ZDNSX5.js} +1 -1
  29. package/dist/{chunk-RDALAH3Y.js → chunk-JVMHWM3I.js} +1 -1
  30. package/dist/{chunk-PSPYIRIF.mjs → chunk-KUI5W44P.mjs} +1 -1
  31. package/dist/{chunk-6YFPDGNB.js → chunk-LP5KXMBY.js} +1 -1
  32. package/dist/{chunk-N72RNTGP.mjs → chunk-MIQQYXTE.mjs} +1 -1
  33. package/dist/{chunk-WVHMY2BV.mjs → chunk-OLTLB5MP.mjs} +1 -1
  34. package/dist/{chunk-FRQFU44F.mjs → chunk-PHA3YMFO.mjs} +1 -1
  35. package/dist/{chunk-ZD2W3YU2.js → chunk-PXUX4FYM.js} +1 -1
  36. package/dist/{chunk-37VFK5SR.js → chunk-QG72X7G4.js} +1 -1
  37. package/dist/{chunk-NBOJ2KGN.mjs → chunk-RW7V7DDR.mjs} +1 -1
  38. package/dist/{chunk-3E4IH7CE.js → chunk-SMEZAQNJ.js} +1 -1
  39. package/dist/{chunk-B2EXRSYG.mjs → chunk-TWWGNFPF.mjs} +1 -1
  40. package/dist/{chunk-ASEUTU45.js → chunk-TYR5PFYD.js} +1 -1
  41. package/dist/{chunk-KH3EQJQE.js → chunk-VEWLYTRA.js} +1 -1
  42. package/dist/{chunk-63WM5PHZ.js → chunk-VTBHDHYK.js} +1 -1
  43. package/dist/{chunk-DK7P5JEG.mjs → chunk-WLZTATLL.mjs} +1 -1
  44. package/dist/chunk-XAB5C2JG.mjs +1 -0
  45. package/dist/{chunk-7RBO42IW.mjs → chunk-YX7DEHPA.mjs} +1 -1
  46. package/dist/{chunk-ZQHGIOYP.mjs → chunk-YZHEEGGK.mjs} +1 -1
  47. package/dist/consent.js +1 -1
  48. package/dist/consent.mjs +1 -1
  49. package/dist/core.d.mts +2 -2
  50. package/dist/core.d.ts +2 -2
  51. package/dist/core.js +1 -1
  52. package/dist/core.mjs +1 -1
  53. package/dist/cross-border-lite.d.mts +1 -1
  54. package/dist/cross-border-lite.d.ts +1 -1
  55. package/dist/cross-border-lite.js +1 -1
  56. package/dist/cross-border-lite.mjs +1 -1
  57. package/dist/cross-border.js +1 -1
  58. package/dist/cross-border.mjs +1 -1
  59. package/dist/dpia.js +1 -1
  60. package/dist/dpia.mjs +1 -1
  61. package/dist/dsr.js +1 -1
  62. package/dist/dsr.mjs +1 -1
  63. package/dist/headless.d.mts +1 -1
  64. package/dist/headless.d.ts +1 -1
  65. package/dist/headless.js +1 -1
  66. package/dist/headless.mjs +1 -1
  67. package/dist/hooks.d.mts +1 -1
  68. package/dist/hooks.d.ts +1 -1
  69. package/dist/hooks.js +1 -1
  70. package/dist/hooks.mjs +1 -1
  71. package/dist/index.d.mts +5 -4
  72. package/dist/index.d.ts +5 -4
  73. package/dist/index.js +1 -1
  74. package/dist/index.mjs +1 -1
  75. package/dist/lawful-basis-lite.d.mts +1 -1
  76. package/dist/lawful-basis-lite.d.ts +1 -1
  77. package/dist/lawful-basis-lite.js +1 -1
  78. package/dist/lawful-basis-lite.mjs +1 -1
  79. package/dist/lawful-basis.d.mts +1 -1
  80. package/dist/lawful-basis.d.ts +1 -1
  81. package/dist/lawful-basis.js +1 -1
  82. package/dist/lawful-basis.mjs +1 -1
  83. package/dist/policy.d.mts +5 -4
  84. package/dist/policy.d.ts +5 -4
  85. package/dist/policy.js +1 -1
  86. package/dist/policy.mjs +1 -1
  87. package/dist/presets-consent.js +1 -1
  88. package/dist/presets-consent.mjs +1 -1
  89. package/dist/presets-dsr.js +1 -1
  90. package/dist/presets-dsr.mjs +1 -1
  91. package/dist/presets-policy.d.mts +1 -1
  92. package/dist/presets-policy.d.ts +1 -1
  93. package/dist/presets-policy.js +1 -1
  94. package/dist/presets-policy.mjs +1 -1
  95. package/dist/presets.d.mts +2 -2
  96. package/dist/presets.d.ts +2 -2
  97. package/dist/presets.js +1 -1
  98. package/dist/presets.mjs +1 -1
  99. package/dist/ropa-lite.js +1 -1
  100. package/dist/ropa-lite.mjs +1 -1
  101. package/dist/ropa.js +1 -1
  102. package/dist/ropa.mjs +1 -1
  103. package/dist/server.d.mts +2 -2
  104. package/dist/server.d.ts +2 -2
  105. package/dist/server.js +1 -1
  106. package/dist/server.mjs +1 -1
  107. package/dist/unstyled.js +1 -1
  108. package/dist/unstyled.mjs +1 -1
  109. package/package.json +11 -6
  110. package/dist/chunk-FC3PTJFL.js +0 -1
  111. package/dist/chunk-IQO3SIAG.mjs +0 -1
@@ -1 +1 @@
1
- 'use strict';var chunkWZYCBW2R_js=require('./chunk-WZYCBW2R.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkYDKWD6MQ_js=require('./chunk-YDKWD6MQ.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var V={name:"",description:"",lawfulBasis:"consent",lawfulBasisJustification:"",dataCategories:"",involvesSensitiveData:false,sensitiveDataCondition:"",dataSubjectCategories:"",purposes:"",retentionPeriod:"",retentionJustification:"",recipients:"",crossBorderTransfer:false,reviewDate:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""},re=[{value:"consent",label:"Consent"},{value:"contract",label:"Contract"},{value:"legal_obligation",label:"Legal Obligation"},{value:"vital_interests",label:"Vital Interests"},{value:"public_interest",label:"Public Interest"},{value:"legitimate_interests",label:"Legitimate Interests"}],ae=[{value:"explicit_consent",label:"Explicit Consent"},{value:"employment_law",label:"Employment Law"},{value:"vital_interests_incapable",label:"Vital Interests (Incapable)"},{value:"nonprofit_legitimate",label:"Nonprofit Legitimate Activities"},{value:"publicly_available",label:"Publicly Available Data"},{value:"legal_claims",label:"Legal Claims"},{value:"substantial_public_interest",label:"Substantial Public Interest"},{value:"health_purposes",label:"Health Purposes"},{value:"public_health",label:"Public Health"},{value:"archiving_research",label:"Archiving / Research"}],Ae={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--neutral",under_review:"ndpr-badge ndpr-badge--warning",archived:"ndpr-badge ndpr-badge--destructive"},Be={active:"Active",inactive:"Inactive",under_review:"Under Review",archived:"Archived"},De={consent:"ndpr-badge ndpr-badge--info",contract:"ndpr-badge ndpr-badge--info",legal_obligation:"ndpr-badge ndpr-badge--info",vital_interests:"ndpr-badge ndpr-badge--destructive",public_interest:"ndpr-badge ndpr-badge--warning",legitimate_interests:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},Se={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"},je=({activities:g,onAdd:B,onUpdate:D,onArchive:S,title:j,description:E,className:ne="",buttonClassName:m="",showSummary:le=true,showComplianceGaps:oe=true,classNames:i,unstyled:l})=>{var X,Z;let M=chunkYDKWD6MQ_js.c(),de=(X=j!=null?j:M.lawfulBasis.title)!=null?X:"Lawful Basis Tracker",se=(Z=E!=null?E:M.lawfulBasis.description)!=null?Z:"Document and track the lawful basis for each processing activity as required by NDPA 2023 Section 25.",[x,f]=react.useState("list"),[a,w]=react.useState(V),[b,J]=react.useState(null),[R,pe]=react.useState(null),[P,ue]=react.useState("all"),[k,ce]=react.useState("all"),[L,ge]=react.useState(""),[c,C]=react.useState([]),H=react.useMemo(()=>{let e=[...g];if(P!=="all"&&(e=e.filter(d=>d.status===P)),k!=="all"&&(e=e.filter(d=>d.lawfulBasis===k)),L){let d=L.toLowerCase();e=e.filter(p=>p.name.toLowerCase().includes(d)||p.description.toLowerCase().includes(d)||p.purposes.some($=>$.toLowerCase().includes(d)));}return e.sort((d,p)=>p.updatedAt-d.updatedAt),e},[g,P,k,L]),y=react.useCallback(e=>new Date(e).toLocaleDateString(),[]),T=react.useMemo(()=>chunkWZYCBW2R_js.d(g),[g]),h=react.useMemo(()=>chunkWZYCBW2R_js.c(g),[g]),A=react.useCallback(e=>e.split(",").map(d=>d.trim()).filter(d=>d.length>0),[]),ve=react.useCallback(()=>{w(V),J(null),C([]),f("form");},[]),U=react.useCallback(e=>{w({name:e.name,description:e.description,lawfulBasis:e.lawfulBasis,lawfulBasisJustification:e.lawfulBasisJustification,dataCategories:e.dataCategories.join(", "),involvesSensitiveData:e.involvesSensitiveData,sensitiveDataCondition:e.sensitiveDataCondition||"",dataSubjectCategories:e.dataSubjectCategories.join(", "),purposes:e.purposes.join(", "),retentionPeriod:e.retentionPeriod,retentionJustification:e.retentionJustification||"",recipients:(e.recipients||[]).join(", "),crossBorderTransfer:e.crossBorderTransfer,reviewDate:e.reviewDate?new Date(e.reviewDate).toISOString().split("T")[0]:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""}),J(e.id),C([]),f("form");},[]),me=react.useCallback(()=>{let e={name:a.name,description:a.description,lawfulBasis:a.lawfulBasis,lawfulBasisJustification:a.lawfulBasisJustification,dataCategories:A(a.dataCategories),involvesSensitiveData:a.involvesSensitiveData,sensitiveDataCondition:a.sensitiveDataCondition||void 0,dataSubjectCategories:A(a.dataSubjectCategories),purposes:A(a.purposes),retentionPeriod:a.retentionPeriod,retentionJustification:a.retentionJustification||void 0,recipients:a.recipients?A(a.recipients):void 0,crossBorderTransfer:a.crossBorderTransfer,reviewDate:a.reviewDate?new Date(a.reviewDate).getTime():void 0,status:"active"},d=chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},e),{id:b||"temp",createdAt:Date.now(),updatedAt:Date.now()}),p=chunkWZYCBW2R_js.a(d);if(!p.isValid){C(p.errors);return}b?D==null||D(b,e):B==null||B(e),w(V),J(null),C([]),f("list");},[a,b,D,B,A]),Y=react.useCallback(e=>{S==null||S(e);},[S]),fe=react.useCallback(e=>{pe(e),f("detail");},[]),n=react.useMemo(()=>R?g.find(e=>e.id===R):null,[g,R]),W=react.useCallback(e=>jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a(`px-2 py-1 rounded text-xs font-medium ${Ae[e]}`,i==null?void 0:i.statusBadge,l),children:Be[e]}),[i==null?void 0:i.statusBadge,l]),z=react.useCallback(e=>jsxRuntime.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${De[e]}`,children:Se[e]}),[]),K=react.useCallback(e=>e.dpoApproval?e.dpoApproval.approved?jsxRuntime.jsx("span",{className:"ndpr-badge ndpr-badge--success",children:"Approved"}):jsxRuntime.jsx("span",{className:"ndpr-badge ndpr-badge--warning",children:"Pending Approval"}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400",children:"No DPO Review"}),[]),be=()=>jsxRuntime.jsxs("div",{"data-ndpr-component":"lawful-basis-tracker",className:chunkAME4HJR4_js.a("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",i==null?void 0:i.summary,l),role:"status","aria-label":"Compliance summary",children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",i==null?void 0:i.summaryCard,l),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:T.totalActivities}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-info",children:"Total Activities"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("bg-orange-50 dark:bg-orange-900/20 p-4 rounded-lg",i==null?void 0:i.summaryCard,l),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:T.sensitiveDataActivities}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-warning",children:"Sensitive Data"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",i==null?void 0:i.summaryCard,l),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:T.crossBorderActivities}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-info",children:"Cross-Border Transfers"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--destructive",i==null?void 0:i.summaryCard,l),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-destructive",children:T.activitiesWithoutApproval.length}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-destructive",children:"Pending Approval"})]})]}),N=react.useMemo(()=>h.filter(e=>e.severity==="high"),[h]),O=react.useMemo(()=>h.filter(e=>e.severity==="medium"),[h]),he=()=>h.length===0?jsxRuntime.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg mb-6",role:"status","aria-label":"No compliance gaps",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"No compliance gaps detected."}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-success mt-1",children:"All processing activities appear to be properly documented."})]}):jsxRuntime.jsxs("div",{className:"mb-6",role:"status","aria-label":`${h.length} compliance gaps detected`,children:[N.length>0&&jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-3",i==null?void 0:i.gapAlert,l),children:[jsxRuntime.jsxs("p",{className:"text-sm ndpr-text-destructive font-medium mb-2",children:["High Priority (",N.length,")"]}),jsxRuntime.jsx("ul",{className:"space-y-1",children:N.map((e,d)=>jsxRuntime.jsx("li",{className:"text-xs ndpr-text-destructive",children:e.description},d))})]}),O.length>0&&jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--warning",i==null?void 0:i.gapAlert,l),children:[jsxRuntime.jsxs("p",{className:"text-sm ndpr-text-warning font-medium mb-2",children:["Medium Priority (",O.length,")"]}),jsxRuntime.jsx("ul",{className:"space-y-1",children:O.map((e,d)=>jsxRuntime.jsx("li",{className:"text-xs ndpr-text-warning",children:e.description},d))})]})]}),Q=react.useCallback(()=>{f("list"),C([]);},[]),_e=react.useCallback(()=>{f("list");},[]),s=react.useCallback((e,d)=>{w(p=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},p),{[e]:d}));},[]),xe=react.useCallback(e=>{w(d=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},d),{involvesSensitiveData:e,sensitiveDataCondition:e?d.sensitiveDataCondition:""}));},[]),we=()=>jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("",i==null?void 0:i.form,l),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("flex justify-between items-center mb-4",i==null?void 0:i.header,l),children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:b?"Edit Processing Activity":"New Processing Activity"}),jsxRuntime.jsx("button",{onClick:Q,className:`px-4 py-2 ndpr-text-muted bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${m}`,children:"Cancel"})]}),c.length>0&&jsxRuntime.jsxs("div",{id:"form-errors",className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-4",role:"alert",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-destructive font-medium mb-2",children:"Please correct the following errors:"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside space-y-1",children:c.map((e,d)=>jsxRuntime.jsx("li",{className:"text-xs ndpr-text-destructive",children:e},d))})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-section",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"activityName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsxRuntime.jsx("input",{type:"text",id:"activityName",value:a.name,onChange:e=>s("name",e.target.value),placeholder:"e.g., Customer Account Management","aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"activityDescription",className:"ndpr-form-field__label",children:"Description *"}),jsxRuntime.jsx("textarea",{id:"activityDescription",value:a.description,onChange:e=>s("description",e.target.value),placeholder:"Describe what processing is performed...",rows:3,"aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis (NDPA Section 25) *"}),jsxRuntime.jsx("select",{id:"lawfulBasis",value:a.lawfulBasis,onChange:e=>s("lawfulBasis",e.target.value),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.select,l),children:re.map(e=>jsxRuntime.jsx("option",{value:e.value,children:e.label},e.value))}),jsxRuntime.jsx("p",{className:"mt-1 text-xs ndpr-text-muted",children:chunkWZYCBW2R_js.b(a.lawfulBasis)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"justification",className:"ndpr-form-field__label",children:"Lawful Basis Justification *"}),jsxRuntime.jsx("textarea",{id:"justification",value:a.lawfulBasisJustification,onChange:e=>s("lawfulBasisJustification",e.target.value),placeholder:"Document why this lawful basis applies to this processing activity...",rows:3,"aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),a.lawfulBasis==="legitimate_interests"&&jsxRuntime.jsxs("div",{className:"border border-indigo-200 dark:border-indigo-800 rounded-lg p-4 bg-indigo-50 dark:bg-indigo-900/20",children:[jsxRuntime.jsx("h4",{className:"text-sm font-semibold text-indigo-800 dark:text-indigo-200 mb-3",children:"Legitimate Interest Assessment (LIA)"}),jsxRuntime.jsx("p",{className:"text-xs text-indigo-600 dark:text-indigo-300 mb-4",children:"NDPA Section 25(1)(f) requires a balancing test when relying on legitimate interests."}),jsxRuntime.jsxs("div",{className:"ndpr-form-section",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaPurpose",className:"ndpr-form-field__label",children:"Purpose Test"}),jsxRuntime.jsx("textarea",{id:"liaPurpose",value:a.liaPurposeTest,onChange:e=>s("liaPurposeTest",e.target.value),placeholder:"Describe the legitimate interest being pursued...",rows:2,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaNecessity",className:"ndpr-form-field__label",children:"Necessity Test"}),jsxRuntime.jsx("textarea",{id:"liaNecessity",value:a.liaNecessityTest,onChange:e=>s("liaNecessityTest",e.target.value),placeholder:"Explain why this processing is necessary for the stated purpose...",rows:2,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaBalancing",className:"ndpr-form-field__label",children:"Balancing Test"}),jsxRuntime.jsx("textarea",{id:"liaBalancing",value:a.liaBalancingTest,onChange:e=>s("liaBalancingTest",e.target.value),placeholder:"Assess the impact on data subjects' rights and interests...",rows:2,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaSafeguards",className:"ndpr-form-field__label",children:"Safeguards"}),jsxRuntime.jsx("input",{type:"text",id:"liaSafeguards",value:a.liaSafeguards,onChange:e=>s("liaSafeguards",e.target.value),placeholder:"List safeguards (comma-separated)...",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaConclusion",className:"ndpr-form-field__label",children:"Conclusion"}),jsxRuntime.jsx("textarea",{id:"liaConclusion",value:a.liaConclusion,onChange:e=>s("liaConclusion",e.target.value),placeholder:"State your overall conclusion...",rows:2,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories *"}),jsxRuntime.jsx("input",{type:"text",id:"dataCategories",value:a.dataCategories,onChange:e=>s("dataCategories",e.target.value),placeholder:"e.g., Name, Email, Phone Number (comma-separated)","aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsxs("label",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:a.involvesSensitiveData,onChange:e=>xe(e.target.checked),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("span",{className:"ndpr-text-sm ndpr-font-medium",children:"Involves Sensitive Personal Data (NDPA Section 27)"})]})}),a.involvesSensitiveData&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"sensitiveCondition",className:"ndpr-form-field__label",children:"Sensitive Data Condition (NDPA Section 27) *"}),jsxRuntime.jsxs("select",{id:"sensitiveCondition",value:a.sensitiveDataCondition,onChange:e=>s("sensitiveDataCondition",e.target.value),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.select,l),children:[jsxRuntime.jsx("option",{value:"",children:"Select a condition..."}),ae.map(e=>jsxRuntime.jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dataSubjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories *"}),jsxRuntime.jsx("input",{type:"text",id:"dataSubjectCategories",value:a.dataSubjectCategories,onChange:e=>s("dataSubjectCategories",e.target.value),placeholder:"e.g., Customers, Employees, Vendors (comma-separated)","aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Processing Purposes *"}),jsxRuntime.jsx("input",{type:"text",id:"purposes",value:a.purposes,onChange:e=>s("purposes",e.target.value),placeholder:"e.g., Account management, Service delivery (comma-separated)","aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsxRuntime.jsx("input",{type:"text",id:"retentionPeriod",value:a.retentionPeriod,onChange:e=>s("retentionPeriod",e.target.value),placeholder:"e.g., 3 years after account closure","aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsxRuntime.jsx("input",{type:"text",id:"retentionJustification",value:a.retentionJustification,onChange:e=>s("retentionJustification",e.target.value),placeholder:"Reason for the retention period",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients"}),jsxRuntime.jsx("input",{type:"text",id:"recipients",value:a.recipients,onChange:e=>s("recipients",e.target.value),placeholder:"e.g., Payment processor, Cloud provider (comma-separated)",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsxs("label",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:a.crossBorderTransfer,onChange:e=>s("crossBorderTransfer",e.target.checked),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("span",{className:"ndpr-text-sm ndpr-font-medium",children:"Involves Cross-Border Transfer Outside Nigeria"})]})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"reviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsxRuntime.jsx("input",{type:"date",id:"reviewDate",value:a.reviewDate,onChange:e=>s("reviewDate",e.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[jsxRuntime.jsx("button",{onClick:Q,className:`px-4 py-2 ndpr-text-muted bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${m}`,children:"Cancel"}),jsxRuntime.jsx("button",{onClick:me,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,(i==null?void 0:i.primaryButton)||(i==null?void 0:i.submitButton),l),children:b?"Update Activity":"Create Activity"})]})]})]}),Ce=()=>{var d;if(!n)return jsxRuntime.jsx("div",{className:"ndpr-empty-state",children:jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:"Activity not found."})});let e=chunkWZYCBW2R_js.a(n);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{onClick:_e,className:"text-sm ndpr-text-primary hover:underline mb-2","aria-label":"Back to activities list",children:"Back to list"}),jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:n.name})]}),jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[z(n.lawfulBasis),W(n.status),K(n)]})]}),e.warnings.length>0&&jsxRuntime.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md mb-4",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-warning font-medium mb-1",children:"Warnings"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside space-y-1",children:e.warnings.map((p,$)=>jsxRuntime.jsx("li",{className:"text-xs ndpr-text-warning",children:p},$))})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Description:"})," ",n.description]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Lawful Basis:"})," ",chunkWZYCBW2R_js.b(n.lawfulBasis)]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Justification:"})," ",n.lawfulBasisJustification]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Categories:"})," ",n.dataCategories.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Subject Categories:"})," ",n.dataSubjectCategories.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Purposes:"})," ",n.purposes.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Retention Period:"})," ",n.retentionPeriod,n.retentionJustification&&jsxRuntime.jsxs("span",{className:"ndpr-card__subtitle",children:[" ","(",n.retentionJustification,")"]})]})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Sensitive Data:"})," ",n.involvesSensitiveData?"Yes":"No",n.sensitiveDataCondition&&jsxRuntime.jsxs("span",{children:[" ","(Condition:"," ",((d=ae.find(p=>p.value===n.sensitiveDataCondition))==null?void 0:d.label)||n.sensitiveDataCondition,")"]})]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Cross-Border Transfer:"})," ",n.crossBorderTransfer?"Yes":"No"]}),n.recipients&&n.recipients.length>0&&jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Recipients:"})," ",n.recipients.join(", ")]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Created:"})," ",y(n.createdAt)]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Last Updated:"})," ",y(n.updatedAt)]}),n.reviewDate&&jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Next Review:"})," ",y(n.reviewDate),n.reviewDate<Date.now()&&jsxRuntime.jsx("span",{className:"ndpr-text-destructive font-medium",children:" (Overdue)"})]})]})]}),n.dpoApproval&&jsxRuntime.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-6",children:[jsxRuntime.jsx("h4",{className:"ndpr-section-heading",children:"DPO Approval"}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Status:"})," ",n.dpoApproval.approved?"Approved":"Not Approved"]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Approved By:"})," ",n.dpoApproval.approvedBy]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Date:"})," ",y(n.dpoApproval.approvedAt)]}),n.dpoApproval.notes&&jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Notes:"})," ",n.dpoApproval.notes]})]}),jsxRuntime.jsxs("div",{className:"flex space-x-3",children:[jsxRuntime.jsx("button",{onClick:()=>U(n),"aria-label":`Edit ${n.name}`,className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,children:"Edit"}),n.status!=="archived"&&jsxRuntime.jsx("button",{onClick:()=>Y(n.id),"aria-label":`Archive ${n.name}`,className:`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 ${m}`,children:"Archive"})]})]})},ye=()=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"basisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxRuntime.jsxs("select",{id:"basisFilter",value:k,onChange:e=>ce(e.target.value),"aria-label":"Filter by lawful basis",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.select,l),children:[jsxRuntime.jsx("option",{value:"all",children:"All Bases"}),re.map(e=>jsxRuntime.jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"statusFilterSelect",className:"ndpr-form-field__label",children:"Status"}),jsxRuntime.jsxs("select",{id:"statusFilterSelect",value:P,onChange:e=>ue(e.target.value),"aria-label":"Filter by status",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.select,l),children:[jsxRuntime.jsx("option",{value:"all",children:"All Statuses"}),jsxRuntime.jsx("option",{value:"active",children:"Active"}),jsxRuntime.jsx("option",{value:"inactive",children:"Inactive"}),jsxRuntime.jsx("option",{value:"under_review",children:"Under Review"}),jsxRuntime.jsx("option",{value:"archived",children:"Archived"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"searchInput",className:"ndpr-form-field__label",children:"Search"}),jsxRuntime.jsx("input",{type:"text",id:"searchInput",value:L,onChange:e=>ge(e.target.value),placeholder:"Search activities...",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsx("div",{className:"flex items-end",children:jsxRuntime.jsx("button",{onClick:ve,className:chunkAME4HJR4_js.a(`w-full px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,(i==null?void 0:i.primaryButton)||(i==null?void 0:i.submitButton),l),children:"Add Activity"})})]}),H.length===0?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-32 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:"No processing activities found."})}):jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:chunkAME4HJR4_js.a("w-full text-sm text-left",i==null?void 0:i.table,l),children:[jsxRuntime.jsx("thead",{className:chunkAME4HJR4_js.a("ndpr-table__head",i==null?void 0:i.tableHeader,l),children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Activity"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"DPO Approval"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Sensitive Data"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Last Updated"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsxRuntime.jsx("tbody",{children:H.map(e=>jsxRuntime.jsxs("tr",{className:chunkAME4HJR4_js.a("border-b border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",i==null?void 0:i.tableRow,l),children:[jsxRuntime.jsxs("td",{className:"ndpr-table__cell",children:[jsxRuntime.jsx("button",{onClick:()=>fe(e.id),className:"font-medium ndpr-text-primary hover:underline text-left",children:e.name}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted mt-1 truncate max-w-xs",children:e.description})]}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:z(e.lawfulBasis)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:W(e.status)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:K(e)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:jsxRuntime.jsx("span",{className:`text-xs ${e.involvesSensitiveData?"ndpr-text-warning font-medium":"ndpr-card__subtitle"}`,children:e.involvesSensitiveData?"Yes":"No"})}),jsxRuntime.jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:y(e.updatedAt)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[jsxRuntime.jsx("button",{onClick:()=>U(e),"aria-label":`Edit ${e.name}`,className:"text-xs ndpr-text-primary hover:underline",children:"Edit"}),e.status!=="archived"&&jsxRuntime.jsx("button",{onClick:()=>Y(e.id),"aria-label":`Archive ${e.name}`,className:"text-xs ndpr-text-muted hover:underline",children:"Archive"})]})})]},e.id))})]})})]});return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ne}`,i==null?void 0:i.root,l),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",i==null?void 0:i.title,l),children:de}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:se}),le&&x==="list"&&be(),oe&&x==="list"&&he(),x==="list"&&ye(),x==="form"&&we(),x==="detail"&&Ce()]})};exports.a=je;
1
+ 'use strict';var chunkWZYCBW2R_js=require('./chunk-WZYCBW2R.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkI5ZDNSX5_js=require('./chunk-I5ZDNSX5.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var V={name:"",description:"",lawfulBasis:"consent",lawfulBasisJustification:"",dataCategories:"",involvesSensitiveData:false,sensitiveDataCondition:"",dataSubjectCategories:"",purposes:"",retentionPeriod:"",retentionJustification:"",recipients:"",crossBorderTransfer:false,reviewDate:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""},re=[{value:"consent",label:"Consent"},{value:"contract",label:"Contract"},{value:"legal_obligation",label:"Legal Obligation"},{value:"vital_interests",label:"Vital Interests"},{value:"public_interest",label:"Public Interest"},{value:"legitimate_interests",label:"Legitimate Interests"}],ae=[{value:"explicit_consent",label:"Explicit Consent"},{value:"employment_law",label:"Employment Law"},{value:"vital_interests_incapable",label:"Vital Interests (Incapable)"},{value:"nonprofit_legitimate",label:"Nonprofit Legitimate Activities"},{value:"publicly_available",label:"Publicly Available Data"},{value:"legal_claims",label:"Legal Claims"},{value:"substantial_public_interest",label:"Substantial Public Interest"},{value:"health_purposes",label:"Health Purposes"},{value:"public_health",label:"Public Health"},{value:"archiving_research",label:"Archiving / Research"}],Ae={active:"ndpr-badge ndpr-badge--success",inactive:"ndpr-badge ndpr-badge--neutral",under_review:"ndpr-badge ndpr-badge--warning",archived:"ndpr-badge ndpr-badge--destructive"},Be={active:"Active",inactive:"Inactive",under_review:"Under Review",archived:"Archived"},De={consent:"ndpr-badge ndpr-badge--info",contract:"ndpr-badge ndpr-badge--info",legal_obligation:"ndpr-badge ndpr-badge--info",vital_interests:"ndpr-badge ndpr-badge--destructive",public_interest:"ndpr-badge ndpr-badge--warning",legitimate_interests:"bg-indigo-100 text-indigo-800 dark:bg-indigo-900 dark:text-indigo-200"},Se={consent:"Consent",contract:"Contract",legal_obligation:"Legal Obligation",vital_interests:"Vital Interests",public_interest:"Public Interest",legitimate_interests:"Legitimate Interests"},je=({activities:g,onAdd:B,onUpdate:D,onArchive:S,title:j,description:E,className:ne="",buttonClassName:m="",showSummary:le=true,showComplianceGaps:oe=true,classNames:i,unstyled:l})=>{var X,Z;let M=chunkI5ZDNSX5_js.c(),de=(X=j!=null?j:M.lawfulBasis.title)!=null?X:"Lawful Basis Tracker",se=(Z=E!=null?E:M.lawfulBasis.description)!=null?Z:"Document and track the lawful basis for each processing activity as required by NDPA 2023 Section 25.",[x,f]=react.useState("list"),[a,w]=react.useState(V),[b,J]=react.useState(null),[R,pe]=react.useState(null),[P,ue]=react.useState("all"),[k,ce]=react.useState("all"),[L,ge]=react.useState(""),[c,C]=react.useState([]),H=react.useMemo(()=>{let e=[...g];if(P!=="all"&&(e=e.filter(d=>d.status===P)),k!=="all"&&(e=e.filter(d=>d.lawfulBasis===k)),L){let d=L.toLowerCase();e=e.filter(p=>p.name.toLowerCase().includes(d)||p.description.toLowerCase().includes(d)||p.purposes.some($=>$.toLowerCase().includes(d)));}return e.sort((d,p)=>p.updatedAt-d.updatedAt),e},[g,P,k,L]),y=react.useCallback(e=>new Date(e).toLocaleDateString(),[]),T=react.useMemo(()=>chunkWZYCBW2R_js.d(g),[g]),h=react.useMemo(()=>chunkWZYCBW2R_js.c(g),[g]),A=react.useCallback(e=>e.split(",").map(d=>d.trim()).filter(d=>d.length>0),[]),ve=react.useCallback(()=>{w(V),J(null),C([]),f("form");},[]),U=react.useCallback(e=>{w({name:e.name,description:e.description,lawfulBasis:e.lawfulBasis,lawfulBasisJustification:e.lawfulBasisJustification,dataCategories:e.dataCategories.join(", "),involvesSensitiveData:e.involvesSensitiveData,sensitiveDataCondition:e.sensitiveDataCondition||"",dataSubjectCategories:e.dataSubjectCategories.join(", "),purposes:e.purposes.join(", "),retentionPeriod:e.retentionPeriod,retentionJustification:e.retentionJustification||"",recipients:(e.recipients||[]).join(", "),crossBorderTransfer:e.crossBorderTransfer,reviewDate:e.reviewDate?new Date(e.reviewDate).toISOString().split("T")[0]:"",liaPurposeTest:"",liaNecessityTest:"",liaBalancingTest:"",liaSafeguards:"",liaConclusion:""}),J(e.id),C([]),f("form");},[]),me=react.useCallback(()=>{let e={name:a.name,description:a.description,lawfulBasis:a.lawfulBasis,lawfulBasisJustification:a.lawfulBasisJustification,dataCategories:A(a.dataCategories),involvesSensitiveData:a.involvesSensitiveData,sensitiveDataCondition:a.sensitiveDataCondition||void 0,dataSubjectCategories:A(a.dataSubjectCategories),purposes:A(a.purposes),retentionPeriod:a.retentionPeriod,retentionJustification:a.retentionJustification||void 0,recipients:a.recipients?A(a.recipients):void 0,crossBorderTransfer:a.crossBorderTransfer,reviewDate:a.reviewDate?new Date(a.reviewDate).getTime():void 0,status:"active"},d=chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},e),{id:b||"temp",createdAt:Date.now(),updatedAt:Date.now()}),p=chunkWZYCBW2R_js.a(d);if(!p.isValid){C(p.errors);return}b?D==null||D(b,e):B==null||B(e),w(V),J(null),C([]),f("list");},[a,b,D,B,A]),Y=react.useCallback(e=>{S==null||S(e);},[S]),fe=react.useCallback(e=>{pe(e),f("detail");},[]),n=react.useMemo(()=>R?g.find(e=>e.id===R):null,[g,R]),W=react.useCallback(e=>jsxRuntime.jsx("span",{className:chunkAME4HJR4_js.a(`px-2 py-1 rounded text-xs font-medium ${Ae[e]}`,i==null?void 0:i.statusBadge,l),children:Be[e]}),[i==null?void 0:i.statusBadge,l]),z=react.useCallback(e=>jsxRuntime.jsx("span",{className:`px-2 py-1 rounded text-xs font-medium ${De[e]}`,children:Se[e]}),[]),K=react.useCallback(e=>e.dpoApproval?e.dpoApproval.approved?jsxRuntime.jsx("span",{className:"ndpr-badge ndpr-badge--success",children:"Approved"}):jsxRuntime.jsx("span",{className:"ndpr-badge ndpr-badge--warning",children:"Pending Approval"}):jsxRuntime.jsx("span",{className:"px-2 py-1 rounded text-xs font-medium bg-gray-100 text-gray-600 dark:bg-gray-700 dark:text-gray-400",children:"No DPO Review"}),[]),be=()=>jsxRuntime.jsxs("div",{"data-ndpr-component":"lawful-basis-tracker",className:chunkAME4HJR4_js.a("grid grid-cols-2 md:grid-cols-4 gap-4 mb-6",i==null?void 0:i.summary,l),role:"status","aria-label":"Compliance summary",children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",i==null?void 0:i.summaryCard,l),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:T.totalActivities}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-info",children:"Total Activities"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("bg-orange-50 dark:bg-orange-900/20 p-4 rounded-lg",i==null?void 0:i.summaryCard,l),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-warning",children:T.sensitiveDataActivities}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-warning",children:"Sensitive Data"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",i==null?void 0:i.summaryCard,l),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-info",children:T.crossBorderActivities}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-info",children:"Cross-Border Transfers"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--destructive",i==null?void 0:i.summaryCard,l),children:[jsxRuntime.jsx("p",{className:"ndpr-stat__value ndpr-text-destructive",children:T.activitiesWithoutApproval.length}),jsxRuntime.jsx("p",{className:"text-sm ndpr-text-destructive",children:"Pending Approval"})]})]}),N=react.useMemo(()=>h.filter(e=>e.severity==="high"),[h]),O=react.useMemo(()=>h.filter(e=>e.severity==="medium"),[h]),he=()=>h.length===0?jsxRuntime.jsxs("div",{className:"bg-green-50 dark:bg-green-900/20 p-4 rounded-lg mb-6",role:"status","aria-label":"No compliance gaps",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-success font-medium",children:"No compliance gaps detected."}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-success mt-1",children:"All processing activities appear to be properly documented."})]}):jsxRuntime.jsxs("div",{className:"mb-6",role:"status","aria-label":`${h.length} compliance gaps detected`,children:[N.length>0&&jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-3",i==null?void 0:i.gapAlert,l),children:[jsxRuntime.jsxs("p",{className:"text-sm ndpr-text-destructive font-medium mb-2",children:["High Priority (",N.length,")"]}),jsxRuntime.jsx("ul",{className:"space-y-1",children:N.map((e,d)=>jsxRuntime.jsx("li",{className:"text-xs ndpr-text-destructive",children:e.description},d))})]}),O.length>0&&jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--warning",i==null?void 0:i.gapAlert,l),children:[jsxRuntime.jsxs("p",{className:"text-sm ndpr-text-warning font-medium mb-2",children:["Medium Priority (",O.length,")"]}),jsxRuntime.jsx("ul",{className:"space-y-1",children:O.map((e,d)=>jsxRuntime.jsx("li",{className:"text-xs ndpr-text-warning",children:e.description},d))})]})]}),Q=react.useCallback(()=>{f("list"),C([]);},[]),_e=react.useCallback(()=>{f("list");},[]),s=react.useCallback((e,d)=>{w(p=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},p),{[e]:d}));},[]),xe=react.useCallback(e=>{w(d=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},d),{involvesSensitiveData:e,sensitiveDataCondition:e?d.sensitiveDataCondition:""}));},[]),we=()=>jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("",i==null?void 0:i.form,l),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("flex justify-between items-center mb-4",i==null?void 0:i.header,l),children:[jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:b?"Edit Processing Activity":"New Processing Activity"}),jsxRuntime.jsx("button",{onClick:Q,className:`px-4 py-2 ndpr-text-muted bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${m}`,children:"Cancel"})]}),c.length>0&&jsxRuntime.jsxs("div",{id:"form-errors",className:"bg-red-50 dark:bg-red-900/20 p-4 rounded-lg mb-4",role:"alert",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-destructive font-medium mb-2",children:"Please correct the following errors:"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside space-y-1",children:c.map((e,d)=>jsxRuntime.jsx("li",{className:"text-xs ndpr-text-destructive",children:e},d))})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-section",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"activityName",className:"ndpr-form-field__label",children:"Activity Name *"}),jsxRuntime.jsx("input",{type:"text",id:"activityName",value:a.name,onChange:e=>s("name",e.target.value),placeholder:"e.g., Customer Account Management","aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"activityDescription",className:"ndpr-form-field__label",children:"Description *"}),jsxRuntime.jsx("textarea",{id:"activityDescription",value:a.description,onChange:e=>s("description",e.target.value),placeholder:"Describe what processing is performed...",rows:3,"aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"lawfulBasis",className:"ndpr-form-field__label",children:"Lawful Basis (NDPA Section 25) *"}),jsxRuntime.jsx("select",{id:"lawfulBasis",value:a.lawfulBasis,onChange:e=>s("lawfulBasis",e.target.value),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.select,l),children:re.map(e=>jsxRuntime.jsx("option",{value:e.value,children:e.label},e.value))}),jsxRuntime.jsx("p",{className:"mt-1 text-xs ndpr-text-muted",children:chunkWZYCBW2R_js.b(a.lawfulBasis)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"justification",className:"ndpr-form-field__label",children:"Lawful Basis Justification *"}),jsxRuntime.jsx("textarea",{id:"justification",value:a.lawfulBasisJustification,onChange:e=>s("lawfulBasisJustification",e.target.value),placeholder:"Document why this lawful basis applies to this processing activity...",rows:3,"aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),a.lawfulBasis==="legitimate_interests"&&jsxRuntime.jsxs("div",{className:"border border-indigo-200 dark:border-indigo-800 rounded-lg p-4 bg-indigo-50 dark:bg-indigo-900/20",children:[jsxRuntime.jsx("h4",{className:"text-sm font-semibold text-indigo-800 dark:text-indigo-200 mb-3",children:"Legitimate Interest Assessment (LIA)"}),jsxRuntime.jsx("p",{className:"text-xs text-indigo-600 dark:text-indigo-300 mb-4",children:"NDPA Section 25(1)(f) requires a balancing test when relying on legitimate interests."}),jsxRuntime.jsxs("div",{className:"ndpr-form-section",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaPurpose",className:"ndpr-form-field__label",children:"Purpose Test"}),jsxRuntime.jsx("textarea",{id:"liaPurpose",value:a.liaPurposeTest,onChange:e=>s("liaPurposeTest",e.target.value),placeholder:"Describe the legitimate interest being pursued...",rows:2,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaNecessity",className:"ndpr-form-field__label",children:"Necessity Test"}),jsxRuntime.jsx("textarea",{id:"liaNecessity",value:a.liaNecessityTest,onChange:e=>s("liaNecessityTest",e.target.value),placeholder:"Explain why this processing is necessary for the stated purpose...",rows:2,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaBalancing",className:"ndpr-form-field__label",children:"Balancing Test"}),jsxRuntime.jsx("textarea",{id:"liaBalancing",value:a.liaBalancingTest,onChange:e=>s("liaBalancingTest",e.target.value),placeholder:"Assess the impact on data subjects' rights and interests...",rows:2,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaSafeguards",className:"ndpr-form-field__label",children:"Safeguards"}),jsxRuntime.jsx("input",{type:"text",id:"liaSafeguards",value:a.liaSafeguards,onChange:e=>s("liaSafeguards",e.target.value),placeholder:"List safeguards (comma-separated)...",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"liaConclusion",className:"ndpr-form-field__label",children:"Conclusion"}),jsxRuntime.jsx("textarea",{id:"liaConclusion",value:a.liaConclusion,onChange:e=>s("liaConclusion",e.target.value),placeholder:"State your overall conclusion...",rows:2,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dataCategories",className:"ndpr-form-field__label",children:"Data Categories *"}),jsxRuntime.jsx("input",{type:"text",id:"dataCategories",value:a.dataCategories,onChange:e=>s("dataCategories",e.target.value),placeholder:"e.g., Name, Email, Phone Number (comma-separated)","aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsxs("label",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:a.involvesSensitiveData,onChange:e=>xe(e.target.checked),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("span",{className:"ndpr-text-sm ndpr-font-medium",children:"Involves Sensitive Personal Data (NDPA Section 30)"})]})}),a.involvesSensitiveData&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"sensitiveCondition",className:"ndpr-form-field__label",children:"Sensitive Data Condition (NDPA Section 30) *"}),jsxRuntime.jsxs("select",{id:"sensitiveCondition",value:a.sensitiveDataCondition,onChange:e=>s("sensitiveDataCondition",e.target.value),"aria-required":"true",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.select,l),children:[jsxRuntime.jsx("option",{value:"",children:"Select a condition..."}),ae.map(e=>jsxRuntime.jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"dataSubjectCategories",className:"ndpr-form-field__label",children:"Data Subject Categories *"}),jsxRuntime.jsx("input",{type:"text",id:"dataSubjectCategories",value:a.dataSubjectCategories,onChange:e=>s("dataSubjectCategories",e.target.value),placeholder:"e.g., Customers, Employees, Vendors (comma-separated)","aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"purposes",className:"ndpr-form-field__label",children:"Processing Purposes *"}),jsxRuntime.jsx("input",{type:"text",id:"purposes",value:a.purposes,onChange:e=>s("purposes",e.target.value),placeholder:"e.g., Account management, Service delivery (comma-separated)","aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{className:"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"retentionPeriod",className:"ndpr-form-field__label",children:"Retention Period *"}),jsxRuntime.jsx("input",{type:"text",id:"retentionPeriod",value:a.retentionPeriod,onChange:e=>s("retentionPeriod",e.target.value),placeholder:"e.g., 3 years after account closure","aria-required":"true","aria-describedby":c.length>0?"form-errors":void 0,className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"retentionJustification",className:"ndpr-form-field__label",children:"Retention Justification"}),jsxRuntime.jsx("input",{type:"text",id:"retentionJustification",value:a.retentionJustification,onChange:e=>s("retentionJustification",e.target.value),placeholder:"Reason for the retention period",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"recipients",className:"ndpr-form-field__label",children:"Recipients"}),jsxRuntime.jsx("input",{type:"text",id:"recipients",value:a.recipients,onChange:e=>s("recipients",e.target.value),placeholder:"e.g., Payment processor, Cloud provider (comma-separated)",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsx("div",{children:jsxRuntime.jsxs("label",{className:"flex items-center space-x-2",children:[jsxRuntime.jsx("input",{type:"checkbox",checked:a.crossBorderTransfer,onChange:e=>s("crossBorderTransfer",e.target.checked),className:"rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))]"}),jsxRuntime.jsx("span",{className:"ndpr-text-sm ndpr-font-medium",children:"Involves Cross-Border Transfer Outside Nigeria"})]})}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"reviewDate",className:"ndpr-form-field__label",children:"Next Review Date"}),jsxRuntime.jsx("input",{type:"date",id:"reviewDate",value:a.reviewDate,onChange:e=>s("reviewDate",e.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsxs("div",{className:"flex justify-end space-x-3 pt-4",children:[jsxRuntime.jsx("button",{onClick:Q,className:`px-4 py-2 ndpr-text-muted bg-gray-100 dark:bg-gray-700 rounded hover:bg-gray-200 dark:hover:bg-gray-600 ${m}`,children:"Cancel"}),jsxRuntime.jsx("button",{onClick:me,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,(i==null?void 0:i.primaryButton)||(i==null?void 0:i.submitButton),l),children:b?"Update Activity":"Create Activity"})]})]})]}),Ce=()=>{var d;if(!n)return jsxRuntime.jsx("div",{className:"ndpr-empty-state",children:jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:"Activity not found."})});let e=chunkWZYCBW2R_js.a(n);return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-start mb-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("button",{onClick:_e,className:"text-sm ndpr-text-primary hover:underline mb-2","aria-label":"Back to activities list",children:"Back to list"}),jsxRuntime.jsx("h3",{className:"ndpr-section-heading",children:n.name})]}),jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[z(n.lawfulBasis),W(n.status),K(n)]})]}),e.warnings.length>0&&jsxRuntime.jsxs("div",{className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md mb-4",children:[jsxRuntime.jsx("p",{className:"text-sm ndpr-text-warning font-medium mb-1",children:"Warnings"}),jsxRuntime.jsx("ul",{className:"list-disc list-inside space-y-1",children:e.warnings.map((p,$)=>jsxRuntime.jsx("li",{className:"text-xs ndpr-text-warning",children:p},$))})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Description:"})," ",n.description]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Lawful Basis:"})," ",chunkWZYCBW2R_js.b(n.lawfulBasis)]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Justification:"})," ",n.lawfulBasisJustification]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Categories:"})," ",n.dataCategories.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Data Subject Categories:"})," ",n.dataSubjectCategories.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Purposes:"})," ",n.purposes.join(", ")]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Retention Period:"})," ",n.retentionPeriod,n.retentionJustification&&jsxRuntime.jsxs("span",{className:"ndpr-card__subtitle",children:[" ","(",n.retentionJustification,")"]})]})]})]}),jsxRuntime.jsxs("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-6",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Sensitive Data:"})," ",n.involvesSensitiveData?"Yes":"No",n.sensitiveDataCondition&&jsxRuntime.jsxs("span",{children:[" ","(Condition:"," ",((d=ae.find(p=>p.value===n.sensitiveDataCondition))==null?void 0:d.label)||n.sensitiveDataCondition,")"]})]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Cross-Border Transfer:"})," ",n.crossBorderTransfer?"Yes":"No"]}),n.recipients&&n.recipients.length>0&&jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Recipients:"})," ",n.recipients.join(", ")]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Created:"})," ",y(n.createdAt)]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Last Updated:"})," ",y(n.updatedAt)]}),n.reviewDate&&jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Next Review:"})," ",y(n.reviewDate),n.reviewDate<Date.now()&&jsxRuntime.jsx("span",{className:"ndpr-text-destructive font-medium",children:" (Overdue)"})]})]})]}),n.dpoApproval&&jsxRuntime.jsxs("div",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-6",children:[jsxRuntime.jsx("h4",{className:"ndpr-section-heading",children:"DPO Approval"}),jsxRuntime.jsxs("p",{className:"ndpr-text-sm",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Status:"})," ",n.dpoApproval.approved?"Approved":"Not Approved"]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Approved By:"})," ",n.dpoApproval.approvedBy]}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Date:"})," ",y(n.dpoApproval.approvedAt)]}),n.dpoApproval.notes&&jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:[jsxRuntime.jsx("span",{className:"font-medium",children:"Notes:"})," ",n.dpoApproval.notes]})]}),jsxRuntime.jsxs("div",{className:"flex space-x-3",children:[jsxRuntime.jsx("button",{onClick:()=>U(n),"aria-label":`Edit ${n.name}`,className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,children:"Edit"}),n.status!=="archived"&&jsxRuntime.jsx("button",{onClick:()=>Y(n.id),"aria-label":`Archive ${n.name}`,className:`px-4 py-2 bg-gray-600 text-white rounded hover:bg-gray-700 ${m}`,children:"Archive"})]})]})},ye=()=>jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("div",{className:"mb-6 grid grid-cols-1 md:grid-cols-4 gap-4",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"basisFilter",className:"ndpr-form-field__label",children:"Lawful Basis"}),jsxRuntime.jsxs("select",{id:"basisFilter",value:k,onChange:e=>ce(e.target.value),"aria-label":"Filter by lawful basis",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.select,l),children:[jsxRuntime.jsx("option",{value:"all",children:"All Bases"}),re.map(e=>jsxRuntime.jsx("option",{value:e.value,children:e.label},e.value))]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"statusFilterSelect",className:"ndpr-form-field__label",children:"Status"}),jsxRuntime.jsxs("select",{id:"statusFilterSelect",value:P,onChange:e=>ue(e.target.value),"aria-label":"Filter by status",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.select,l),children:[jsxRuntime.jsx("option",{value:"all",children:"All Statuses"}),jsxRuntime.jsx("option",{value:"active",children:"Active"}),jsxRuntime.jsx("option",{value:"inactive",children:"Inactive"}),jsxRuntime.jsx("option",{value:"under_review",children:"Under Review"}),jsxRuntime.jsx("option",{value:"archived",children:"Archived"})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"searchInput",className:"ndpr-form-field__label",children:"Search"}),jsxRuntime.jsx("input",{type:"text",id:"searchInput",value:L,onChange:e=>ge(e.target.value),placeholder:"Search activities...",className:chunkAME4HJR4_js.a("ndpr-form-field__input",i==null?void 0:i.input,l)})]}),jsxRuntime.jsx("div",{className:"flex items-end",children:jsxRuntime.jsx("button",{onClick:ve,className:chunkAME4HJR4_js.a(`w-full px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${m}`,(i==null?void 0:i.primaryButton)||(i==null?void 0:i.submitButton),l),children:"Add Activity"})})]}),H.length===0?jsxRuntime.jsx("div",{className:"flex items-center justify-center h-32 bg-gray-50 dark:bg-gray-700 rounded-md",children:jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:"No processing activities found."})}):jsxRuntime.jsx("div",{className:"overflow-x-auto",children:jsxRuntime.jsxs("table",{className:chunkAME4HJR4_js.a("w-full text-sm text-left",i==null?void 0:i.table,l),children:[jsxRuntime.jsx("thead",{className:chunkAME4HJR4_js.a("ndpr-table__head",i==null?void 0:i.tableHeader,l),children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Activity"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Lawful Basis"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Status"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"DPO Approval"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Sensitive Data"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Last Updated"}),jsxRuntime.jsx("th",{className:"ndpr-table__cell",children:"Actions"})]})}),jsxRuntime.jsx("tbody",{children:H.map(e=>jsxRuntime.jsxs("tr",{className:chunkAME4HJR4_js.a("border-b border-gray-200 dark:border-gray-600 hover:bg-gray-50 dark:hover:bg-gray-700",i==null?void 0:i.tableRow,l),children:[jsxRuntime.jsxs("td",{className:"ndpr-table__cell",children:[jsxRuntime.jsx("button",{onClick:()=>fe(e.id),className:"font-medium ndpr-text-primary hover:underline text-left",children:e.name}),jsxRuntime.jsx("p",{className:"text-xs ndpr-text-muted mt-1 truncate max-w-xs",children:e.description})]}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:z(e.lawfulBasis)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:W(e.status)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:K(e)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:jsxRuntime.jsx("span",{className:`text-xs ${e.involvesSensitiveData?"ndpr-text-warning font-medium":"ndpr-card__subtitle"}`,children:e.involvesSensitiveData?"Yes":"No"})}),jsxRuntime.jsx("td",{className:"ndpr-table__cell ndpr-table__cell--muted",children:y(e.updatedAt)}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[jsxRuntime.jsx("button",{onClick:()=>U(e),"aria-label":`Edit ${e.name}`,className:"text-xs ndpr-text-primary hover:underline",children:"Edit"}),e.status!=="archived"&&jsxRuntime.jsx("button",{onClick:()=>Y(e.id),"aria-label":`Archive ${e.name}`,className:"text-xs ndpr-text-muted hover:underline",children:"Archive"})]})})]},e.id))})]})})]});return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${ne}`,i==null?void 0:i.root,l),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",i==null?void 0:i.title,l),children:de}),jsxRuntime.jsx("p",{className:"ndpr-card__subtitle",children:se}),le&&x==="list"&&be(),oe&&x==="list"&&he(),x==="list"&&ye(),x==="form"&&we(),x==="detail"&&Ce()]})};exports.a=je;
@@ -1,2 +1,2 @@
1
- 'use strict';var chunkUXUMYP4L_js=require('./chunk-UXUMYP4L.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkYDKWD6MQ_js=require('./chunk-YDKWD6MQ.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var Tr=({requestTypes:y,onSubmit:nr,onValidationError:F,title:T,description:C,submitButtonText:$,className:q="",buttonClassName:dr="",showConfirmation:pr=true,confirmationMessage:ar="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:O=true,identifierTypes:D=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:ur=true,labels:v={},classNames:r,unstyled:e=false,isSubmitting:A=false,defaultValues:p,onReset:I})=>{var W,J,K,Q,X,V,N,s,rr;if(!Array.isArray(y))throw new Error("[ndpr-toolkit] <DSRRequestForm requestTypes={...} /> requires an array of RequestType[]. See https://ndprtoolkit.com.ng/docs/components/dsr#requesttypes \u2014 or use the `<NDPRSubjectRights />` preset which ships sensible defaults.");let x=chunkYDKWD6MQ_js.c(),br=(W=T!=null?T:x.dsr.title)!=null?W:"Submit a Data Subject Request",fr=(J=C!=null?C:x.dsr.description)!=null?J:"Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part VI.",lr=(K=$!=null?$:x.dsr.submitRequest)!=null?K:"Submit Request",[c,z]=react.useState((p==null?void 0:p.requestType)||""),[P,B]=react.useState(((Q=p==null?void 0:p.dataSubject)==null?void 0:Q.fullName)||""),[S,M]=react.useState(((X=p==null?void 0:p.dataSubject)==null?void 0:X.email)||""),[k,Z]=react.useState(((V=p==null?void 0:p.dataSubject)==null?void 0:V.phone)||""),[G,L]=react.useState(((N=p==null?void 0:p.dataSubject)==null?void 0:N.identifierType)||((s=D[0])==null?void 0:s.id)||""),[w,Y]=react.useState(((rr=p==null?void 0:p.dataSubject)==null?void 0:rr.identifierValue)||""),[l,j]=react.useState((p==null?void 0:p.additionalInfo)||{}),[_r,E]=react.useState(false),[d,H]=react.useState({}),mr=()=>{var i;z(""),B(""),M(""),Z(""),L(((i=D[0])==null?void 0:i.id)||""),Y(""),j({}),E(false),H({}),I==null||I();},a=y.find(i=>i.id===c),gr=i=>{z(i.target.value),j({});},h=(i,b)=>{j(_=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},_),{[i]:b}));},vr=()=>{let i={};return P.trim()||(i.fullName="Full name is required"),S.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(S)||(i.email="Email is invalid"):i.email="Email is required",c||(i.requestType="Please select a request type"),O&&!w.trim()&&(i.identifierValue="Identifier value is required"),a!=null&&a.requiresAdditionalInfo&&a.additionalFields&&a.additionalFields.forEach(b=>{b.required&&!l[b.id]&&(i[`additional_${b.id}`]=`${b.label} is required`);}),H(i),i},hr=i=>{i.preventDefault();let b=vr();if(Object.keys(b).length>0){F==null||F(b);return}let _=Object.keys(l).length>0?Object.fromEntries(Object.entries(l).map(([u,m])=>[u,typeof m=="string"?chunkUXUMYP4L_js.a(m):m])):void 0,R={requestType:c,dataSubject:{fullName:chunkUXUMYP4L_js.a(P),email:chunkUXUMYP4L_js.a(S),phone:k?chunkUXUMYP4L_js.a(k):void 0,identifierType:G,identifierValue:chunkUXUMYP4L_js.a(w)},additionalInfo:_,submittedAt:Date.now()};nr(R),pr&&E(true);},U=`ndpr-dsr-form__button ndpr-dsr-form__button--primary ${dr}`.trim(),qr="ndpr-dsr-form__button ndpr-dsr-form__button--secondary";return _r?jsxRuntime.jsxs("div",{"data-ndpr-component":"dsr-request-form","data-ndpr-state":"submitted",className:chunkAME4HJR4_js.a(`ndpr-dsr-form__success${q?` ${q}`:""}`,r==null?void 0:r.successMessage,e),"aria-live":"polite",children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__success-title",r==null?void 0:r.title,e),children:"Request Submitted"}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__success-body",r==null?void 0:r.description,e),children:ar}),jsxRuntime.jsx("button",{onClick:()=>E(false),className:chunkAME4HJR4_js.a(U,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:"Submit Another Request"})]}):jsxRuntime.jsxs("div",{"data-ndpr-component":"dsr-request-form",className:chunkAME4HJR4_js.a(`ndpr-dsr-form${q?` ${q}`:""}`,r==null?void 0:r.root,e),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__title",r==null?void 0:r.title,e),children:br}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__description",r==null?void 0:r.description,e),children:fr}),jsxRuntime.jsx("form",{onSubmit:hr,className:chunkAME4HJR4_js.a("",r==null?void 0:r.form,e),children:jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__sections",r==null?void 0:r.fieldGroup,e),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Personal Information"}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"fullName",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.name||"Full Name"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"fullName",value:P,onChange:i=>B(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsxRuntime.jsx("p",{id:"fullName-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.fullName})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"email",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.email||"Email Address"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"email",id:"email",value:S,onChange:i=>M(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsxRuntime.jsx("p",{id:"email-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.email})]}),ur&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"phone",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:"Phone Number (Optional)"}),jsxRuntime.jsx("input",{type:"tel",id:"phone",value:k,onChange:i=>Z(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e)})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Request Details"}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"requestType",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.requestType||"Request Type"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsxs("select",{id:"requestType",value:c,onChange:gr,className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true","aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select a request type"}),y.map(i=>jsxRuntime.jsx("option",{value:i.id,children:i.name},i.id))]}),d.requestType&&jsxRuntime.jsx("p",{id:"requestType-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.requestType})]}),a&&jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__type-info",children:[jsxRuntime.jsx("p",{children:a.description}),jsxRuntime.jsxs("p",{children:["Estimated completion time: ",a.estimatedCompletionTime," ",a.estimatedCompletionTime===1?"day":"days"]})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:"requestDescription",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:v.description||"Additional Information"}),jsxRuntime.jsx("textarea",{id:"requestDescription",className:chunkAME4HJR4_js.a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),O&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Identity Verification"}),jsxRuntime.jsx("p",{className:e?"":"ndpr-form-section__hint",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"identifierType",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Type ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("select",{id:"identifierType",value:G,onChange:i=>L(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true",children:D.map(i=>jsxRuntime.jsx("option",{value:i.id,children:i.label},i.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"identifierValue",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Value ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"identifierValue",value:w,onChange:i=>Y(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsxRuntime.jsx("p",{id:"identifierValue-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.identifierValue})]})]})]}),(a==null?void 0:a.requiresAdditionalInfo)&&a.additionalFields&&a.additionalFields.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Additional Information"}),jsxRuntime.jsx("div",{className:e?"":"ndpr-form-section",children:a.additionalFields.map(i=>{var b,_,R;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:i.id,className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[i.label," ",i.required&&jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),i.type==="text"&&jsxRuntime.jsx("input",{type:"text",id:i.id,value:String((b=l[i.id])!=null?b:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="textarea"&&jsxRuntime.jsx("textarea",{id:i.id,value:String((_=l[i.id])!=null?_:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:chunkAME4HJR4_js.a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="select"&&i.options&&jsxRuntime.jsxs("select",{id:i.id,value:String((R=l[i.id])!=null?R:""),onChange:u=>h(i.id,u.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0,children:[jsxRuntime.jsx("option",{value:"",children:i.placeholder||"Select an option"}),i.options.map(u=>jsxRuntime.jsx("option",{value:u,children:u},u))]}),i.type==="checkbox"&&jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",id:i.id,checked:!!l[i.id],onChange:u=>h(i.id,u.target.checked),className:e?"":"ndpr-form-field__checkbox",required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),jsxRuntime.jsx("label",{htmlFor:i.id,className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:i.placeholder||i.label})]}),i.type==="file"&&jsxRuntime.jsx("input",{type:"file",id:i.id,onChange:u=>{var ir;let m=(ir=u.target.files)==null?void 0:ir[0];m&&h(i.id,m.name);},className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),d[`additional_${i.id}`]&&jsxRuntime.jsx("p",{id:`additional-${i.id}-error`,role:"alert",className:e?"":"ndpr-form-field__error",children:d[`additional_${i.id}`]})]},i.id)})})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__notice",children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-dsr-form__notice-title",children:"Privacy Notice"}),jsxRuntime.jsx("p",{className:e?"":"ndpr-dsr-form__notice-body",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."})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__actions",children:[A&&(r==null?void 0:r.loadingOverlay)&&jsxRuntime.jsx("div",{className:r.loadingOverlay}),jsxRuntime.jsx("button",{type:"submit",disabled:A,className:chunkAME4HJR4_js.a(U,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:A?"Submitting...":v.submit||lr}),jsxRuntime.jsx("button",{type:"button",onClick:mr,className:chunkAME4HJR4_js.a(qr,void 0,e),children:"Reset"})]})]})})]})};
1
+ 'use strict';var chunkUXUMYP4L_js=require('./chunk-UXUMYP4L.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkI5ZDNSX5_js=require('./chunk-I5ZDNSX5.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var Tr=({requestTypes:y,onSubmit:nr,onValidationError:F,title:T,description:C,submitButtonText:$,className:q="",buttonClassName:dr="",showConfirmation:pr=true,confirmationMessage:ar="Your request has been submitted successfully. You will receive a confirmation email shortly.",requireIdentityVerification:O=true,identifierTypes:D=[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}],collectAdditionalContact:ur=true,labels:v={},classNames:r,unstyled:e=false,isSubmitting:A=false,defaultValues:p,onReset:I})=>{var W,J,K,Q,X,V,N,s,rr;if(!Array.isArray(y))throw new Error("[ndpr-toolkit] <DSRRequestForm requestTypes={...} /> requires an array of RequestType[]. See https://ndprtoolkit.com.ng/docs/components/dsr#requesttypes \u2014 or use the `<NDPRSubjectRights />` preset which ships sensible defaults.");let x=chunkI5ZDNSX5_js.c(),br=(W=T!=null?T:x.dsr.title)!=null?W:"Submit a Data Subject Request",fr=(J=C!=null?C:x.dsr.description)!=null?J:"Use this form to exercise your rights under the Nigeria Data Protection Act (NDPA), Part VI.",lr=(K=$!=null?$:x.dsr.submitRequest)!=null?K:"Submit Request",[c,z]=react.useState((p==null?void 0:p.requestType)||""),[P,B]=react.useState(((Q=p==null?void 0:p.dataSubject)==null?void 0:Q.fullName)||""),[S,M]=react.useState(((X=p==null?void 0:p.dataSubject)==null?void 0:X.email)||""),[k,Z]=react.useState(((V=p==null?void 0:p.dataSubject)==null?void 0:V.phone)||""),[G,L]=react.useState(((N=p==null?void 0:p.dataSubject)==null?void 0:N.identifierType)||((s=D[0])==null?void 0:s.id)||""),[w,Y]=react.useState(((rr=p==null?void 0:p.dataSubject)==null?void 0:rr.identifierValue)||""),[l,j]=react.useState((p==null?void 0:p.additionalInfo)||{}),[_r,E]=react.useState(false),[d,H]=react.useState({}),mr=()=>{var i;z(""),B(""),M(""),Z(""),L(((i=D[0])==null?void 0:i.id)||""),Y(""),j({}),E(false),H({}),I==null||I();},a=y.find(i=>i.id===c),gr=i=>{z(i.target.value),j({});},h=(i,b)=>{j(_=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},_),{[i]:b}));},vr=()=>{let i={};return P.trim()||(i.fullName="Full name is required"),S.trim()?/^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(S)||(i.email="Email is invalid"):i.email="Email is required",c||(i.requestType="Please select a request type"),O&&!w.trim()&&(i.identifierValue="Identifier value is required"),a!=null&&a.requiresAdditionalInfo&&a.additionalFields&&a.additionalFields.forEach(b=>{b.required&&!l[b.id]&&(i[`additional_${b.id}`]=`${b.label} is required`);}),H(i),i},hr=i=>{i.preventDefault();let b=vr();if(Object.keys(b).length>0){F==null||F(b);return}let _=Object.keys(l).length>0?Object.fromEntries(Object.entries(l).map(([u,m])=>[u,typeof m=="string"?chunkUXUMYP4L_js.a(m):m])):void 0,R={requestType:c,dataSubject:{fullName:chunkUXUMYP4L_js.a(P),email:chunkUXUMYP4L_js.a(S),phone:k?chunkUXUMYP4L_js.a(k):void 0,identifierType:G,identifierValue:chunkUXUMYP4L_js.a(w)},additionalInfo:_,submittedAt:Date.now()};nr(R),pr&&E(true);},U=`ndpr-dsr-form__button ndpr-dsr-form__button--primary ${dr}`.trim(),qr="ndpr-dsr-form__button ndpr-dsr-form__button--secondary";return _r?jsxRuntime.jsxs("div",{"data-ndpr-component":"dsr-request-form","data-ndpr-state":"submitted",className:chunkAME4HJR4_js.a(`ndpr-dsr-form__success${q?` ${q}`:""}`,r==null?void 0:r.successMessage,e),"aria-live":"polite",children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__success-title",r==null?void 0:r.title,e),children:"Request Submitted"}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__success-body",r==null?void 0:r.description,e),children:ar}),jsxRuntime.jsx("button",{onClick:()=>E(false),className:chunkAME4HJR4_js.a(U,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:"Submit Another Request"})]}):jsxRuntime.jsxs("div",{"data-ndpr-component":"dsr-request-form",className:chunkAME4HJR4_js.a(`ndpr-dsr-form${q?` ${q}`:""}`,r==null?void 0:r.root,e),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__title",r==null?void 0:r.title,e),children:br}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__description",r==null?void 0:r.description,e),children:fr}),jsxRuntime.jsx("form",{onSubmit:hr,className:chunkAME4HJR4_js.a("",r==null?void 0:r.form,e),children:jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-dsr-form__sections",r==null?void 0:r.fieldGroup,e),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Personal Information"}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"fullName",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.name||"Full Name"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"fullName",value:P,onChange:i=>B(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.fullName,"aria-describedby":d.fullName?"fullName-error":void 0}),d.fullName&&jsxRuntime.jsx("p",{id:"fullName-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.fullName})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"email",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.email||"Email Address"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"email",id:"email",value:S,onChange:i=>M(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.email,"aria-describedby":d.email?"email-error":void 0}),d.email&&jsxRuntime.jsx("p",{id:"email-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.email})]}),ur&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:"phone",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:"Phone Number (Optional)"}),jsxRuntime.jsx("input",{type:"tel",id:"phone",value:k,onChange:i=>Z(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e)})]})]})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Request Details"}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxRuntime.jsxs("label",{htmlFor:"requestType",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[v.requestType||"Request Type"," ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsxs("select",{id:"requestType",value:c,onChange:gr,className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true","aria-invalid":!!d.requestType,"aria-describedby":d.requestType?"requestType-error":void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select a request type"}),y.map(i=>jsxRuntime.jsx("option",{value:i.id,children:i.name},i.id))]}),d.requestType&&jsxRuntime.jsx("p",{id:"requestType-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.requestType})]}),a&&jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__type-info",children:[jsxRuntime.jsx("p",{children:a.description}),jsxRuntime.jsxs("p",{children:["Estimated completion time: ",a.estimatedCompletionTime," ",a.estimatedCompletionTime===1?"day":"days"]})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:"requestDescription",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:v.description||"Additional Information"}),jsxRuntime.jsx("textarea",{id:"requestDescription",className:chunkAME4HJR4_js.a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,placeholder:"Please provide any additional details that might help us process your request"})]})]}),O&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Identity Verification"}),jsxRuntime.jsx("p",{className:e?"":"ndpr-form-section__hint",children:"To protect your privacy, we need to verify your identity before processing your request."}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-grid ndpr-form-grid--2",children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"identifierType",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Type ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("select",{id:"identifierType",value:G,onChange:i=>L(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:true,"aria-required":"true",children:D.map(i=>jsxRuntime.jsx("option",{value:i.id,children:i.label},i.id))})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:"identifierValue",className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:["Identifier Value ",jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),jsxRuntime.jsx("input",{type:"text",id:"identifierValue",value:w,onChange:i=>Y(i.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:true,"aria-required":"true","aria-invalid":!!d.identifierValue,"aria-describedby":d.identifierValue?"identifierValue-error":void 0}),d.identifierValue&&jsxRuntime.jsx("p",{id:"identifierValue-error",role:"alert",className:e?"":"ndpr-form-field__error",children:d.identifierValue})]})]})]}),(a==null?void 0:a.requiresAdditionalInfo)&&a.additionalFields&&a.additionalFields.length>0&&jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-form-section__heading",children:"Additional Information"}),jsxRuntime.jsx("div",{className:e?"":"ndpr-form-section",children:a.additionalFields.map(i=>{var b,_,R;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:i.id,className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:[i.label," ",i.required&&jsxRuntime.jsx("span",{className:e?"":"ndpr-form-field__required",children:"*"})]}),i.type==="text"&&jsxRuntime.jsx("input",{type:"text",id:i.id,value:String((b=l[i.id])!=null?b:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="textarea"&&jsxRuntime.jsx("textarea",{id:i.id,value:String((_=l[i.id])!=null?_:""),onChange:u=>h(i.id,u.target.value),placeholder:i.placeholder,className:chunkAME4HJR4_js.a("ndpr-form-field__textarea",r==null?void 0:r.textarea,e),rows:4,required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),i.type==="select"&&i.options&&jsxRuntime.jsxs("select",{id:i.id,value:String((R=l[i.id])!=null?R:""),onChange:u=>h(i.id,u.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__select",r==null?void 0:r.select,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0,children:[jsxRuntime.jsx("option",{value:"",children:i.placeholder||"Select an option"}),i.options.map(u=>jsxRuntime.jsx("option",{value:u,children:u},u))]}),i.type==="checkbox"&&jsxRuntime.jsxs("div",{className:e?"":"ndpr-form-field__checkbox-row",children:[jsxRuntime.jsx("input",{type:"checkbox",id:i.id,checked:!!l[i.id],onChange:u=>h(i.id,u.target.checked),className:e?"":"ndpr-form-field__checkbox",required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),jsxRuntime.jsx("label",{htmlFor:i.id,className:chunkAME4HJR4_js.a("ndpr-form-field__label",r==null?void 0:r.label,e),children:i.placeholder||i.label})]}),i.type==="file"&&jsxRuntime.jsx("input",{type:"file",id:i.id,onChange:u=>{var ir;let m=(ir=u.target.files)==null?void 0:ir[0];m&&h(i.id,m.name);},className:chunkAME4HJR4_js.a("ndpr-form-field__input",r==null?void 0:r.input,e),required:i.required,"aria-required":i.required||void 0,"aria-invalid":!!d[`additional_${i.id}`],"aria-describedby":d[`additional_${i.id}`]?`additional-${i.id}-error`:void 0}),d[`additional_${i.id}`]&&jsxRuntime.jsx("p",{id:`additional-${i.id}-error`,role:"alert",className:e?"":"ndpr-form-field__error",children:d[`additional_${i.id}`]})]},i.id)})})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__notice",children:[jsxRuntime.jsx("h3",{className:e?"":"ndpr-dsr-form__notice-title",children:"Privacy Notice"}),jsxRuntime.jsx("p",{className:e?"":"ndpr-dsr-form__notice-body",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."})]}),jsxRuntime.jsxs("div",{className:e?"":"ndpr-dsr-form__actions",children:[A&&(r==null?void 0:r.loadingOverlay)&&jsxRuntime.jsx("div",{className:r.loadingOverlay}),jsxRuntime.jsx("button",{type:"submit",disabled:A,className:chunkAME4HJR4_js.a(U,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.submitButton),e),children:A?"Submitting...":v.submit||lr}),jsxRuntime.jsx("button",{type:"button",onClick:mr,className:chunkAME4HJR4_js.a(qr,void 0,e),children:"Reset"})]})]})})]})};
2
2
  exports.a=Tr;
@@ -1,2 +1,2 @@
1
- import {a}from'./chunk-KE2FZH2V.mjs';import {a as a$1}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import {d,b,a as a$2}from'./chunk-ZJYULEER.mjs';import Nr,{useId,useState,useEffect}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var cr=["Organization","Data Collection","Processing","Review & Export"],yr=({currentStep:n,classNames:p,unstyled:r})=>jsx("nav",{"data-ndpr-component":"policy-step-indicator","aria-label":"Policy wizard progress",className:a$1("w-full flex items-center justify-between px-2 py-4",p==null?void 0:p.root,r),children:cr.map((e,d)=>{let t=d+1,i=t<n,u=t===n,v=d===cr.length-1;return jsxs(Nr.Fragment,{children:[jsxs("div",{className:a$1("flex flex-col items-center gap-1",p==null?void 0:p.stepWrapper,r),children:[jsx("div",{"aria-current":u?"step":void 0,"aria-label":`Step ${t}: ${e}${i?" (completed)":u?" (current)":""}`,className:a$1(["flex items-center justify-center rounded-full border-2 font-semibold transition-all",i?"w-8 h-8 bg-[rgb(var(--ndpr-primary))] border-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))]":u?"w-9 h-9 bg-[rgb(var(--ndpr-primary))] border-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] shadow-md":"w-8 h-8 bg-white dark:bg-gray-900 border-gray-300 dark:border-gray-600 text-gray-400 dark:text-gray-500"].join(" "),i?p==null?void 0:p.stepCompleted:u?p==null?void 0:p.stepCurrent:p==null?void 0:p.stepUpcoming,r),children:i?jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):jsx("span",{className:"text-xs leading-none",children:t})}),jsx("span",{className:a$1(["text-xs font-medium hidden sm:block",i||u?"text-[rgb(var(--ndpr-primary))]":"ndpr-card__subtitle"].join(" "),p==null?void 0:p.stepLabel,r),children:e})]}),!v&&jsx("div",{className:a$1(["flex-1 h-0.5 mx-2",i?"bg-[rgb(var(--ndpr-primary))]":"bg-gray-200 dark:bg-gray-700"].join(" "),p==null?void 0:p.connector,r),"aria-hidden":"true"})]},t)})});var $="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 ndpr-text-foreground focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] text-sm",rt="block text-sm font-medium ndpr-text-muted mb-1",A=({id:n,label:p,required:r,description:e,children:d,classNames:t,unstyled:i})=>{let u=e?`${n}-desc`:void 0;return jsxs("div",{className:a$1("flex flex-col",t==null?void 0:t.field,i),children:[jsxs("label",{htmlFor:n,className:a$1(rt,t==null?void 0:t.label,i),children:[p,r&&jsx("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:"*"})]}),e&&jsx("p",{id:u,className:"text-xs ndpr-text-muted mb-1",children:e}),d]})},Cr=({context:n,onUpdateOrg:p,classNames:r,unstyled:e})=>{var i,u,l;let d=useId(),t=n.org;return jsxs("div",{"data-ndpr-component":"policy-step-about",className:a$1("ndpr-form-section",r==null?void 0:r.root,e),children:[jsxs("div",{children:[jsx("h2",{className:a$1("ndpr-section-heading",r==null?void 0:r.heading,e),children:"Organisation Details"}),jsxs("p",{className:a$1("ndpr-form-field__hint",r==null?void 0:r.subheading,e),children:["Tell us about your organisation. Fields marked ",jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})," are required."]})]}),jsxs("div",{className:a$1("grid grid-cols-1 md:grid-cols-2 gap-4",r==null?void 0:r.grid,e),children:[jsx(A,{id:`${d}-org-name`,label:"Organisation Name",required:true,classNames:r,unstyled:e,children:jsx("input",{id:`${d}-org-name`,type:"text",value:t.name,onChange:v=>p({name:v.target.value}),placeholder:"Acme Corporation",className:a$1($,r==null?void 0:r.input,e),"aria-required":"true"})}),jsx(A,{id:`${d}-website`,label:"Website",required:true,classNames:r,unstyled:e,children:jsx("input",{id:`${d}-website`,type:"url",value:t.website,onChange:v=>p({website:v.target.value}),placeholder:"https://example.com",className:a$1($,r==null?void 0:r.input,e),"aria-required":"true"})}),jsx(A,{id:`${d}-privacy-email`,label:"Privacy Contact Email",required:true,classNames:r,unstyled:e,children:jsx("input",{id:`${d}-privacy-email`,type:"email",value:t.privacyEmail,onChange:v=>p({privacyEmail:v.target.value}),placeholder:"privacy@example.com",className:a$1($,r==null?void 0:r.input,e),"aria-required":"true"})}),jsx(A,{id:`${d}-industry`,label:"Industry",classNames:r,unstyled:e,children:jsxs("select",{id:`${d}-industry`,value:t.industry,onChange:v=>p({industry:v.target.value}),className:a$1($,r==null?void 0:r.select,e),children:[jsx("option",{value:"fintech",children:"Fintech"}),jsx("option",{value:"healthcare",children:"Healthcare"}),jsx("option",{value:"ecommerce",children:"E-commerce"}),jsx("option",{value:"saas",children:"SaaS"}),jsx("option",{value:"education",children:"Education"}),jsx("option",{value:"government",children:"Government"}),jsx("option",{value:"other",children:"Other"})]})}),jsx(A,{id:`${d}-dpo-name`,label:"Data Protection Officer (DPO) Name",classNames:r,unstyled:e,children:jsx("input",{id:`${d}-dpo-name`,type:"text",value:(i=t.dpoName)!=null?i:"",onChange:v=>p({dpoName:v.target.value}),placeholder:"Jane Smith",className:a$1($,r==null?void 0:r.input,e)})}),jsx(A,{id:`${d}-dpo-email`,label:"DPO Email",classNames:r,unstyled:e,children:jsx("input",{id:`${d}-dpo-email`,type:"email",value:(u=t.dpoEmail)!=null?u:"",onChange:v=>p({dpoEmail:v.target.value}),placeholder:"dpo@example.com",className:a$1($,r==null?void 0:r.input,e)})}),jsx(A,{id:`${d}-address`,label:"Registered Address",classNames:r,unstyled:e,children:jsx("input",{id:`${d}-address`,type:"text",value:(l=t.address)!=null?l:"",onChange:v=>p({address:v.target.value}),placeholder:"1 Victoria Island, Lagos, Nigeria",className:a$1($,r==null?void 0:r.input,e)})}),jsx(A,{id:`${d}-org-size`,label:"Organisation Size",classNames:r,unstyled:e,children:jsxs("select",{id:`${d}-org-size`,value:t.orgSize,onChange:v=>p({orgSize:v.target.value}),className:a$1($,r==null?void 0:r.select,e),children:[jsx("option",{value:"startup",children:"Startup (1\u201350 employees)"}),jsx("option",{value:"midsize",children:"Mid-size (51\u2013500 employees)"}),jsx("option",{value:"enterprise",children:"Enterprise (500+ employees)"})]})}),jsx(A,{id:`${d}-country`,label:"Country of Operation",classNames:r,unstyled:e,children:jsx("input",{id:`${d}-country`,type:"text",value:t.country,onChange:v=>p({country:v.target.value}),placeholder:"Nigeria",className:a$1($,r==null?void 0:r.input,e)})})]})]})};var tt={identity:"Identity",financial:"Financial",behavioral:"Behavioural",sensitive:"Sensitive",children:"Children"},ot=["identity","financial","behavioral","sensitive","children"],et=["sensitive","children"],kr=({categories:n,onToggle:p,classNames:r,unstyled:e})=>{let d=ot.reduce((t,i)=>{let u=n.filter(l=>l.group===i);return u.length>0&&(t[i]=u),t},{});return jsxs("div",{"data-ndpr-component":"policy-step-data",className:a$1("space-y-8",r==null?void 0:r.root,e),children:[jsxs("div",{children:[jsx("h2",{className:a$1("ndpr-section-heading",r==null?void 0:r.heading,e),children:"Data Categories"}),jsx("p",{id:"data-categories-desc",className:a$1("ndpr-form-field__hint",r==null?void 0:r.subheading,e),children:"Select the categories of personal data your organisation collects. You must select at least one."})]}),Object.entries(d).map(([t,i])=>{let u=et.includes(t);return jsxs("div",{className:a$1("space-y-3",r==null?void 0:r.group,e),children:[jsxs("div",{className:a$1("flex items-center gap-2",r==null?void 0:r.groupHeader,e),children:[jsx("h3",{className:a$1("text-sm font-semibold uppercase tracking-wide ndpr-text-muted",r==null?void 0:r.groupTitle,e),children:tt[t]}),u&&jsx("span",{className:a$1("text-xs font-medium ndpr-text-warning bg-amber-50 dark:bg-amber-900/20 px-2 py-0.5 rounded-full",r==null?void 0:r.sensitiveTag,e),children:"Sensitive"})]}),u&&jsx("p",{className:a$1("text-xs ndpr-text-warning",r==null?void 0:r.sensitiveWarning,e),children:t==="children"?"Processing children's data requires parental consent under NDPA Section 31 and imposes heightened obligations.":"Sensitive/special-category data requires explicit consent and additional safeguards under NDPA Section 30."}),jsx("div",{className:a$1("grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",r==null?void 0:r.cardsGrid,e),children:i.map(l=>jsx("button",{type:"button",onClick:()=>p(l.id),"aria-pressed":l.selected,className:a$1(["text-left rounded-lg border p-4 transition-all cursor-pointer focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",l.selected?"bg-[rgb(var(--ndpr-primary))]/5 border-[rgb(var(--ndpr-primary))] dark:bg-[rgb(var(--ndpr-primary))]/10":"bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"].join(" "),r==null?void 0:r.card,e),children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:a$1(["mt-0.5 w-4 h-4 rounded border-2 flex-shrink-0 flex items-center justify-center",l.selected?"bg-[rgb(var(--ndpr-primary))] border-[rgb(var(--ndpr-primary))]":"border-gray-300 dark:border-gray-600"].join(" "),r==null?void 0:r.checkbox,e),"aria-hidden":"true",children:l.selected&&jsx("svg",{className:"w-2.5 h-2.5 text-[rgb(var(--ndpr-primary-foreground))]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),jsxs("div",{className:"min-w-0",children:[jsx("p",{className:a$1("text-sm font-medium ndpr-text-foreground",r==null?void 0:r.cardLabel,e),children:l.label}),jsx("p",{className:a$1("text-xs ndpr-text-muted mt-1 leading-relaxed",r==null?void 0:r.cardDataPoints,e),children:l.dataPoints.join(", ")})]})]})},l.id))})]},t)})]})};var nt=[{value:"service_delivery",label:"Service Delivery",description:"Processing required to deliver the core product or service."},{value:"marketing",label:"Marketing & Communications",description:"Sending promotional messages, newsletters or offers."},{value:"analytics",label:"Analytics & Insights",description:"Analysing usage patterns to improve the product."},{value:"research",label:"Research & Development",description:"Using data to develop new features or products."},{value:"legal_compliance",label:"Legal Compliance",description:"Meeting statutory, regulatory or contractual obligations."},{value:"fraud_prevention",label:"Fraud Prevention & Security",description:"Detecting and preventing fraudulent activity."}],dr="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 ndpr-text-foreground focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] text-sm",pr="ndpr-card ndpr-card--compact",gr=({id:n,checked:p,onChange:r})=>jsx("button",{id:n,type:"button",role:"switch","aria-checked":p,onClick:()=>r(!p),className:["relative inline-flex h-6 w-11 flex-shrink-0 rounded-full border-2 border-transparent cursor-pointer transition-colors focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",p?"bg-[rgb(var(--ndpr-primary))]":"bg-gray-200 dark:bg-gray-600"].join(" "),children:jsx("span",{"aria-hidden":"true",className:["pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition-transform",p?"translate-x-5":"translate-x-0"].join(" ")})}),Pr=({context:n,onTogglePurpose:p,onUpdateContext:r,onAddProcessor:e,onRemoveProcessor:d,classNames:t,unstyled:i})=>{let u=useId(),[l,v]=useState({name:"",purpose:"",country:""}),[C,g]=useState(false),a=()=>{let{name:b,purpose:c,country:m}=l;!b.trim()||!c.trim()||!m.trim()||(e({name:b.trim(),purpose:c.trim(),country:m.trim()}),v({name:"",purpose:"",country:""}),g(false));};return jsxs("div",{"data-ndpr-component":"policy-step-processing",className:a$1("ndpr-form-section",t==null?void 0:t.root,i),children:[jsxs("div",{children:[jsx("h2",{className:a$1("ndpr-section-heading",t==null?void 0:t.heading,i),children:"Processing Details"}),jsx("p",{className:a$1("ndpr-form-field__hint",t==null?void 0:t.subheading,i),children:"Define how and why you process personal data."})]}),jsxs("section",{className:a$1(pr,t==null?void 0:t.section,i),"aria-labelledby":"purposes-heading",children:[jsx("h3",{id:"purposes-heading",className:a$1("text-base font-semibold ndpr-text-foreground",t==null?void 0:t.sectionTitle,i),children:"Processing Purposes"}),jsx("p",{className:a$1("ndpr-form-field__hint",t==null?void 0:t.sectionDescription,i),children:"Select all purposes for which you process personal data. At least one is required."}),jsx("div",{className:a$1("space-y-3",t==null?void 0:t.purposeList,i),children:nt.map(b=>{let c=n.purposes.includes(b.value),m=`${u}-purpose-${b.value}`,B=`${u}-purpose-desc-${b.value}`;return jsxs("label",{htmlFor:m,className:a$1("flex items-start gap-3 cursor-pointer group",t==null?void 0:t.purposeItem,i),children:[jsx("input",{id:m,type:"checkbox",checked:c,onChange:()=>p(b.value),"aria-describedby":B,className:a$1("mt-0.5 h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))] cursor-pointer",t==null?void 0:t.purposeCheckbox,i)}),jsxs("div",{children:[jsx("p",{className:a$1("text-sm font-medium ndpr-text-foreground",t==null?void 0:t.purposeLabel,i),children:b.label}),jsx("p",{id:B,className:a$1("ndpr-form-field__hint",t==null?void 0:t.purposeDescription,i),children:b.description})]})]},b.value)})})]}),jsxs("section",{className:a$1(pr,t==null?void 0:t.section,i),"aria-labelledby":"thirdparty-heading",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h3",{id:"thirdparty-heading",className:a$1("text-base font-semibold ndpr-text-foreground",t==null?void 0:t.sectionTitle,i),children:"Third-Party Data Sharing"}),jsx(gr,{id:`${u}-thirdparty-toggle`,checked:n.thirdPartyProcessors.length>0||C,onChange:b=>{b?g(true):(n.thirdPartyProcessors.forEach((c,m)=>d(0)),g(false));}})]}),(n.thirdPartyProcessors.length>0||C)&&jsxs("div",{className:a$1("ndpr-form-section",t==null?void 0:t.processorSection,i),children:[n.thirdPartyProcessors.length>0&&jsx("div",{className:a$1("overflow-x-auto",t==null?void 0:t.processorTable,i),children:jsxs("table",{className:"w-full text-sm",children:[jsx("thead",{children:jsxs("tr",{className:a$1("text-left text-xs font-medium ndpr-text-muted border-b border-gray-200 dark:border-gray-700",t==null?void 0:t.tableHeader,i),children:[jsx("th",{className:"pb-2 pr-4",children:"Name"}),jsx("th",{className:"pb-2 pr-4",children:"Purpose"}),jsx("th",{className:"pb-2 pr-4",children:"Country"}),jsx("th",{className:"pb-2"})]})}),jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:n.thirdPartyProcessors.map((b,c)=>jsxs("tr",{children:[jsx("td",{className:a$1("py-2 pr-4 ndpr-text-foreground",t==null?void 0:t.tableCell,i),children:b.name}),jsx("td",{className:a$1("py-2 pr-4 ndpr-text-muted",t==null?void 0:t.tableCell,i),children:b.purpose}),jsx("td",{className:a$1("py-2 pr-4 ndpr-text-muted",t==null?void 0:t.tableCell,i),children:b.country}),jsx("td",{className:"py-2",children:jsx("button",{type:"button",onClick:()=>d(c),className:a$1("text-red-500 hover:ndpr-text-destructive dark:hover:text-red-300 text-xs font-medium",t==null?void 0:t.removeButton,i),"aria-label":`Remove ${b.name}`,children:"Remove"})})]},c))})]})}),C?jsxs("div",{className:a$1("grid grid-cols-1 sm:grid-cols-3 gap-3 items-end",t==null?void 0:t.processorForm,i),children:[jsxs("div",{children:[jsx("label",{htmlFor:`${u}-proc-name`,className:"block text-xs font-medium ndpr-text-muted mb-1",children:"Processor Name"}),jsx("input",{id:`${u}-proc-name`,type:"text",placeholder:"Processor name",value:l.name,onChange:b$1=>v(c=>b(a$2({},c),{name:b$1.target.value})),"aria-required":"true",className:a$1(dr,t==null?void 0:t.input,i)})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${u}-proc-purpose`,className:"block text-xs font-medium ndpr-text-muted mb-1",children:"Purpose"}),jsx("input",{id:`${u}-proc-purpose`,type:"text",placeholder:"Purpose",value:l.purpose,onChange:b$1=>v(c=>b(a$2({},c),{purpose:b$1.target.value})),"aria-required":"true",className:a$1(dr,t==null?void 0:t.input,i)})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${u}-proc-country`,className:"block text-xs font-medium ndpr-text-muted mb-1",children:"Country"}),jsx("input",{id:`${u}-proc-country`,type:"text",placeholder:"Country",value:l.country,onChange:b$1=>v(c=>b(a$2({},c),{country:b$1.target.value})),"aria-required":"true",className:a$1(dr,t==null?void 0:t.input,i)})]}),jsxs("div",{className:"sm:col-span-3 flex gap-2",children:[jsx("button",{type:"button",onClick:a,className:a$1("ndpr-button ndpr-button--primary ndpr-button--sm",t==null?void 0:t.addButton,i),children:"Add Processor"}),jsx("button",{type:"button",onClick:()=>g(false),className:a$1("ndpr-button ndpr-button--secondary ndpr-button--sm",t==null?void 0:t.cancelButton,i),children:"Cancel"})]})]}):jsxs("button",{type:"button",onClick:()=>g(true),className:a$1("flex items-center gap-1 text-sm text-[rgb(var(--ndpr-primary))] hover:underline font-medium",t==null?void 0:t.addLink,i),children:[jsx("span",{"aria-hidden":"true",children:"+"})," Add processor"]})]})]}),jsxs("section",{className:a$1(pr,t==null?void 0:t.section,i),"aria-labelledby":"disclosures-heading",children:[jsx("h3",{id:"disclosures-heading",className:a$1("text-base font-semibold ndpr-text-foreground",t==null?void 0:t.sectionTitle,i),children:"Additional Disclosures"}),jsxs("div",{className:a$1("ndpr-form-section",t==null?void 0:t.disclosureList,i),children:[jsxs("div",{className:a$1("flex items-start justify-between gap-4",t==null?void 0:t.disclosureItem,i),children:[jsxs("div",{children:[jsx("p",{id:`${u}-cross-border-label`,className:a$1("text-sm font-medium ndpr-text-foreground",t==null?void 0:t.disclosureLabel,i),children:"Cross-border Data Transfers"}),jsx("p",{id:`${u}-cross-border-desc`,className:a$1("text-xs ndpr-text-muted mt-0.5",t==null?void 0:t.disclosureDescription,i),children:"Do you transfer personal data outside Nigeria? This triggers NDPA Chapter 6 obligations."})]}),jsx(gr,{id:`${u}-cross-border-toggle`,checked:n.hasCrossBorderTransfer,onChange:b=>r({hasCrossBorderTransfer:b})})]}),jsxs("div",{className:a$1("flex items-start justify-between gap-4",t==null?void 0:t.disclosureItem,i),children:[jsxs("div",{children:[jsx("p",{id:`${u}-automated-label`,className:a$1("text-sm font-medium ndpr-text-foreground",t==null?void 0:t.disclosureLabel,i),children:"Automated Decision-Making / Profiling"}),jsx("p",{id:`${u}-automated-desc`,className:a$1("text-xs ndpr-text-muted mt-0.5",t==null?void 0:t.disclosureDescription,i),children:"Do you use algorithms or automated systems to make decisions about individuals? Requires disclosure under NDPA Section 37."})]}),jsx(gr,{id:`${u}-automated-toggle`,checked:n.hasAutomatedDecisions,onChange:b=>r({hasAutomatedDecisions:b})})]})]})]})]})};var Sr=({section:n,index:p,isCustom:r,isEditing:e,editedContent:d,onEdit:t,onSaveEdit:i,onCancelEdit:u,onMoveUp:l,onMoveDown:v,onDelete:C,classNames:g,unstyled:a})=>{let[b,c]=useState(d!=null?d:n.template);return useEffect(()=>{d!==void 0&&c(d);},[d]),useEffect(()=>{e&&c(d!=null?d:n.template);},[e,d,n.template]),jsxs("div",{"data-ndpr-component":"policy-section-card",className:a$1("bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 space-y-3",g==null?void 0:g.root,a),children:[jsxs("div",{className:a$1("flex items-start justify-between gap-2",g==null?void 0:g.header,a),children:[jsxs("div",{className:a$1("flex items-center gap-3 min-w-0",g==null?void 0:g.titleRow,a),children:[jsx("span",{className:a$1("flex-shrink-0 w-7 h-7 rounded-full bg-gray-100 dark:bg-gray-700 ndpr-text-muted text-xs font-semibold flex items-center justify-center",g==null?void 0:g.sectionNumber,a),"aria-hidden":"true",children:p+1}),jsxs("h4",{className:a$1("text-sm font-semibold ndpr-text-foreground truncate",g==null?void 0:g.sectionTitle,a),children:[n.title,r&&jsx("span",{className:a$1("ml-2 text-xs font-normal ndpr-text-muted bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded",g==null?void 0:g.customBadge,a),children:"Custom"})]})]}),jsxs("div",{className:a$1("flex items-center gap-1 flex-shrink-0",g==null?void 0:g.actions,a),children:[l&&jsx("button",{type:"button",onClick:l,className:a$1("ndpr-button ndpr-button--icon",g==null?void 0:g.moveButton,a),"aria-label":`Move "${n.title}" up`,children:jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}),v&&jsx("button",{type:"button",onClick:v,className:a$1("ndpr-button ndpr-button--icon",g==null?void 0:g.moveButton,a),"aria-label":`Move "${n.title}" down`,children:jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}),!e&&jsx("button",{type:"button",onClick:t,className:a$1("p-1.5 text-gray-400 hover:text-[rgb(var(--ndpr-primary))] rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",g==null?void 0:g.editButton,a),"aria-label":`Edit "${n.title}"`,children:jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),r&&C&&jsx("button",{type:"button",onClick:C,className:a$1("p-1.5 text-gray-400 hover:text-red-500 dark:hover:text-red-400 rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",g==null?void 0:g.deleteButton,a),"aria-label":`Delete "${n.title}"`,children:jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]}),e?jsxs("div",{className:a$1("space-y-2",g==null?void 0:g.editArea,a),children:[jsx("textarea",{value:b,onChange:m=>c(m.target.value),rows:8,className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 ndpr-text-foreground focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] text-sm font-mono resize-y",g==null?void 0:g.textarea,a),"aria-label":`Edit content for ${n.title}`}),jsxs("div",{className:a$1("flex gap-2",g==null?void 0:g.editActions,a),children:[jsx("button",{type:"button",onClick:()=>i(b),className:a$1("ndpr-button ndpr-button--primary ndpr-button--sm",g==null?void 0:g.saveButton,a),children:"Save"}),jsx("button",{type:"button",onClick:u,className:a$1("ndpr-button ndpr-button--secondary ndpr-button--sm",g==null?void 0:g.cancelButton,a),children:"Cancel"})]})]}):jsx("div",{className:a$1("text-sm ndpr-text-muted leading-relaxed line-clamp-4 whitespace-pre-wrap",g==null?void 0:g.content,a),children:n.template})]})};var Rr="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 ndpr-text-foreground focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] text-sm",Lr=({onAdd:n,nextOrder:p,classNames:r,unstyled:e})=>{let d=useId(),[t,i]=useState(""),[u,l]=useState(""),[v,C]=useState(""),g=()=>{if(!t.trim()){C("Section title is required.");return}if(!u.trim()){C("Section content is required.");return}C(""),n({title:t.trim(),content:u.trim(),order:p}),i(""),l("");};return jsxs("div",{"data-ndpr-component":"custom-section-form",className:a$1("ndpr-card ndpr-card--compact",r==null?void 0:r.root,e),children:[jsx("h4",{className:a$1("ndpr-section-heading",r==null?void 0:r.heading,e),children:"Add Custom Section"}),v&&jsx("p",{role:"alert",className:a$1("text-xs ndpr-text-destructive",r==null?void 0:r.error,e),children:v}),jsxs("div",{className:a$1("space-y-3",r==null?void 0:r.fields,e),children:[jsxs("div",{children:[jsxs("label",{htmlFor:`${d}-custom-section-title`,className:a$1("block text-xs font-medium ndpr-text-muted mb-1",r==null?void 0:r.label,e),children:["Section Title ",jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),jsx("input",{id:`${d}-custom-section-title`,type:"text",value:t,onChange:a=>{i(a.target.value),v&&C("");},placeholder:"e.g. Cookie Policy",className:a$1(Rr,r==null?void 0:r.input,e),"aria-required":"true"})]}),jsxs("div",{children:[jsxs("label",{htmlFor:`${d}-custom-section-content`,className:a$1("block text-xs font-medium ndpr-text-muted mb-1",r==null?void 0:r.label,e),children:["Content ",jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),jsx("textarea",{id:`${d}-custom-section-content`,value:u,onChange:a=>{l(a.target.value),v&&C("");},placeholder:"Write the section content here...",rows:5,className:a$1(`${Rr} resize-y`,r==null?void 0:r.textarea,e),"aria-required":"true"})]})]}),jsx("div",{className:a$1("flex items-center gap-2",r==null?void 0:r.footer,e),children:jsx("button",{type:"button",onClick:g,className:a$1("ndpr-button ndpr-button--primary ndpr-button--sm",r==null?void 0:r.addButton,e),children:"Add Section"})})]})};var Fr={compliant:{bg:"ndpr-alert ndpr-alert--success",text:"ndpr-text-success",border:"border-green-200 dark:border-green-700"},nearly_compliant:{bg:"bg-amber-50 dark:bg-amber-900/20",text:"ndpr-text-warning",border:"border-amber-200 dark:border-amber-700"},not_compliant:{bg:"ndpr-alert ndpr-alert--destructive",text:"ndpr-text-destructive",border:"border-red-200 dark:border-red-700"}},gt={compliant:"Compliant",nearly_compliant:"Nearly Compliant",not_compliant:"Not Compliant"},N=({icon:n,label:p,description:r,actionLabel:e,loading:d,onClick:t,classNames:i,unstyled:u})=>jsxs("div",{className:a$1("bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 flex flex-col gap-3",i==null?void 0:i.formatCard,u),children:[jsxs("div",{className:a$1("flex items-center gap-3",i==null?void 0:i.formatHeader,u),children:[jsx("div",{className:a$1("w-10 h-10 rounded-lg bg-gray-100 dark:bg-gray-700 flex items-center justify-center flex-shrink-0",i==null?void 0:i.formatIcon,u),"aria-hidden":"true",children:n}),jsxs("div",{className:"min-w-0",children:[jsx("p",{className:a$1("ndpr-section-heading",i==null?void 0:i.formatLabel,u),children:p}),jsx("p",{className:a$1("ndpr-form-field__hint",i==null?void 0:i.formatDescription,u),children:r})]})]}),jsx("button",{type:"button",onClick:t,disabled:d,className:a$1("w-full px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm font-medium disabled:opacity-60 disabled:cursor-not-allowed flex items-center justify-center gap-2",i==null?void 0:i.formatButton,u),children:d?jsxs(Fragment,{children:[jsxs("svg",{className:"animate-spin w-4 h-4",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4l3-3-3-3v4a10 10 0 100 10l-1.73-3A8 8 0 014 12z"})]}),"Generating\u2026"]}):e})]}),Er=({complianceResult:n,onExportPDF:p,onExportDOCX:r,onExportHTML:e,onExportMarkdown:d$1,classNames:t,unstyled:i})=>{var c;let[u,l]=useState(false),[v,C]=useState(false),g=(c=Fr[n.rating])!=null?c:Fr.not_compliant,a=()=>d(null,null,function*(){l(true);try{yield p();}finally{l(false);}}),b=()=>d(null,null,function*(){C(true);try{yield r();}finally{C(false);}});return jsxs("div",{"data-ndpr-component":"policy-export-panel",className:a$1("ndpr-form-section",t==null?void 0:t.root,i),children:[jsxs("div",{className:a$1(`rounded-lg border p-4 flex items-center gap-4 ${g.bg} ${g.border}`,t==null?void 0:t.complianceSummary,i),children:[jsxs("div",{className:a$1(`text-3xl font-bold ${g.text}`,t==null?void 0:t.complianceScore,i),"aria-label":`Compliance score: ${n.percentage}%`,children:[n.percentage,"%"]}),jsxs("div",{children:[jsx("p",{className:a$1(`text-sm font-semibold ${g.text}`,t==null?void 0:t.complianceRating,i),children:gt[n.rating]}),jsxs("p",{className:a$1("text-xs ndpr-text-muted mt-0.5",t==null?void 0:t.complianceDetail,i),children:[n.score," / ",n.maxScore," points \u2022"," ",n.gaps.length," gap",n.gaps.length!==1?"s":""," remaining"]})]})]}),jsxs("div",{children:[jsx("h3",{className:a$1("ndpr-section-heading",t==null?void 0:t.formatsHeading,i),children:"Export Format"}),jsxs("div",{className:a$1("grid grid-cols-1 sm:grid-cols-2 gap-3",t==null?void 0:t.formatsGrid,i),children:[jsx(N,{icon:jsx("svg",{className:"w-5 h-5 text-red-500",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-3 7v-1h4v1h-4zm0-3v-1h4v1h-4zm-2-5h8v1H8v-1z"})}),label:"PDF",description:"Professional formatted document, ideal for publishing.",actionLabel:"Download PDF",loading:u,onClick:a,classNames:t,unstyled:i}),jsx(N,{icon:jsx("svg",{className:"w-5 h-5 text-blue-500",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-5 8v-5h1.5l1 3 1-3H13v5h-1v-3.5l-.75 2.25h-.5L10 13.5V17H9zm5-1.5h.75c.55 0 .75-.25.75-.75 0-.4-.2-.65-.75-.65H14V15.5zm1 1.5h-2v-4h2c1.1 0 1.75.6 1.75 1.5 0 .55-.25.95-.65 1.15.5.2.8.65.8 1.2 0 1-.65 1.65-1.9 1.65V17zm-.25-1c.6 0 .9-.25.9-.75 0-.45-.3-.75-.9-.75H14V16h.75z"})}),label:"DOCX",description:"Editable Word document for further customisation.",actionLabel:"Download DOCX",loading:v,onClick:b,classNames:t,unstyled:i}),jsx(N,{icon:jsxs("svg",{className:"w-5 h-5 text-orange-500",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 15H9V8h2v9zm4 0h-2V8h2v9z"}),jsx("path",{d:"M9.5 6.5h1v1h-1zm4 0h1v1h-1z"}),jsx("path",{d:"M5 5h14v2H5zm0 12h14v2H5z"})]}),label:"HTML",description:"Copy-ready HTML to embed on your website.",actionLabel:"Copy HTML",onClick:e,classNames:t,unstyled:i}),jsx(N,{icon:jsx("svg",{className:"w-5 h-5 ndpr-text-muted",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{d:"M3 5h18v2H3V5zm0 4h12v2H3V9zm0 4h18v2H3v-2zm0 4h12v2H3v-2z"})}),label:"Markdown",description:"Plain-text format for documentation or Git repos.",actionLabel:"Copy Markdown",onClick:d$1,classNames:t,unstyled:i})]})]})]})};var Ar=({sections:n,customSections:p,sectionOverrides:r,complianceResult:e,onEditSection:d,onAddCustomSection:t,onRemoveCustomSection:i,onReorderSection:u,onExportPDF:l,onExportDOCX:v,onExportHTML:C,onExportMarkdown:g,classNames:a,unstyled:b$1})=>{let[c,m]=useState(null),[B,J]=useState(false),Z=new Set(p.map(h=>h.id)),or=(h,F)=>{d(h,F),m(null);},er=n.length>0?Math.max(...n.map(h=>{var F;return (F=h.order)!=null?F:0}))+1:1;return jsxs("div",{"data-ndpr-component":"policy-step-review",className:a$1("ndpr-form-section",a==null?void 0:a.root,b$1),children:[jsxs("div",{children:[jsx("h2",{className:a$1("ndpr-section-heading",a==null?void 0:a.heading,b$1),children:"Review & Export"}),jsx("p",{className:a$1("ndpr-form-field__hint",a==null?void 0:a.subheading,b$1),children:"Review your generated policy sections, reorder or edit content, then export."})]}),jsx("div",{className:a$1("space-y-3",a==null?void 0:a.sectionList,b$1),"aria-live":"polite",children:n.map((h,F)=>jsx(Sr,{section:r[h.id]?b(a$2({},h),{template:r[h.id]}):h,index:F,isCustom:Z.has(h.id),isEditing:c===h.id,editedContent:r[h.id],onEdit:()=>m(h.id),onSaveEdit:ir=>or(h.id,ir),onCancelEdit:()=>m(null),onMoveUp:F>0?()=>u(h.id,"up"):void 0,onMoveDown:F<n.length-1?()=>u(h.id,"down"):void 0,onDelete:Z.has(h.id)?()=>i(h.id):void 0,classNames:a,unstyled:b$1},h.id))}),!B&&jsxs("button",{type:"button",onClick:()=>J(true),className:a$1("flex items-center gap-2 text-sm text-[rgb(var(--ndpr-primary))] hover:underline font-medium",a==null?void 0:a.addSectionButton,b$1),children:[jsx("span",{className:a$1("w-5 h-5 rounded-full border-2 border-[rgb(var(--ndpr-primary))] flex items-center justify-center text-xs font-bold leading-none",a==null?void 0:a.addSectionIcon,b$1),"aria-hidden":"true",children:"+"}),"Add Custom Section"]}),B&&jsxs("div",{className:a$1("space-y-2",a==null?void 0:a.customFormWrapper,b$1),children:[jsx(Lr,{onAdd:h=>{t(h),J(false);},nextOrder:er,classNames:a,unstyled:b$1}),jsx("button",{type:"button",onClick:()=>J(false),className:a$1("text-sm ndpr-text-muted hover:underline",a==null?void 0:a.cancelCustomForm,b$1),children:"Cancel"})]}),jsx("hr",{className:a$1("border-gray-200 dark:border-gray-700",a==null?void 0:a.divider,b$1)}),jsx(Er,{complianceResult:e,onExportPDF:l,onExportDOCX:v,onExportHTML:C,onExportMarkdown:g,classNames:a,unstyled:b$1})]})};var Tr={compliant:{stroke:"stroke-green-500 dark:stroke-green-400",text:"ndpr-text-success"},nearly_compliant:{stroke:"stroke-amber-500 dark:stroke-amber-400",text:"ndpr-text-warning"},not_compliant:{stroke:"stroke-red-500 dark:stroke-red-400",text:"ndpr-text-destructive"}},at={compliant:"Compliant",nearly_compliant:"Nearly Compliant",not_compliant:"Not Compliant"},Ir=({score:n,maxScore:p,rating:r,classNames:e,unstyled:d})=>{var C,g;let t=p>0?Math.round(n/p*100):0,i=(C=Tr[r])!=null?C:Tr.not_compliant,u=36,l=2*Math.PI*u,v=l-t/100*l;return jsxs("div",{"data-ndpr-component":"compliance-score-ring",className:a$1("flex flex-col items-center gap-2",e==null?void 0:e.root,d),children:[jsxs("div",{className:a$1("relative w-24 h-24",e==null?void 0:e.svgWrapper,d),children:[jsxs("svg",{className:"w-24 h-24 -rotate-90",viewBox:"0 0 96 96","aria-hidden":"true",children:[jsx("circle",{cx:"48",cy:"48",r:u,fill:"none",className:"stroke-gray-200 dark:stroke-gray-700",strokeWidth:"8"}),jsx("circle",{cx:"48",cy:"48",r:u,fill:"none",className:i.stroke,strokeWidth:"8",strokeLinecap:"round",strokeDasharray:l,strokeDashoffset:v,style:{transition:"stroke-dashoffset 0.5s ease-out"}})]}),jsx("div",{className:a$1("absolute inset-0 flex flex-col items-center justify-center",e==null?void 0:e.centerText,d),children:jsxs("span",{className:a$1(`text-xl font-bold leading-none ${i.text}`,e==null?void 0:e.scoreValue,d),"aria-label":`${t}% compliance score`,children:[t,"%"]})})]}),jsx("p",{className:a$1(`text-xs font-semibold text-center ${i.text}`,e==null?void 0:e.ratingLabel,d),children:(g=at[r])!=null?g:r}),jsxs("p",{className:a$1("text-xs ndpr-text-muted text-center",e==null?void 0:e.scoreDetail,d),children:[n," / ",p," pts"]})]})};var bt={critical:"ndpr-text-destructive",important:"ndpr-text-warning",recommended:"ndpr-text-info"},_r=({gap:n,isPassed:p,onFix:r,classNames:e,unstyled:d})=>{let[t,i]=useState(false);return jsxs("div",{"data-ndpr-component":"compliance-requirement-item",className:a$1("border-b border-gray-100 dark:border-gray-700 last:border-0 py-2",e==null?void 0:e.root,d),children:[jsxs("button",{type:"button",onClick:()=>!p&&i(u=>!u),className:a$1("w-full flex items-start gap-2 text-left group",e==null?void 0:e.row,d),"aria-expanded":p?void 0:t,"aria-disabled":p,children:[jsx("span",{className:a$1(["mt-0.5 flex-shrink-0 w-4 h-4 rounded-full flex items-center justify-center",p?"bg-green-500":n.severity==="critical"?"bg-red-500":n.severity==="important"?"bg-amber-500":"bg-blue-400"].join(" "),e==null?void 0:e.statusIcon,d),"aria-hidden":"true",children:p?jsx("svg",{className:"w-2.5 h-2.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):jsx("svg",{className:"w-2.5 h-2.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center justify-between gap-1",children:[jsx("p",{className:a$1(`text-xs font-medium ${p?"ndpr-text-muted":"ndpr-text-foreground"}`,e==null?void 0:e.requirementLabel,d),children:n.requirement}),!p&&jsx("svg",{className:`flex-shrink-0 w-3 h-3 text-gray-400 transition-transform ${t?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),jsxs("p",{className:a$1("text-xs text-gray-400 dark:text-gray-500 mt-0.5",e==null?void 0:e.ndpaSection,d),children:["NDPA ",n.ndpaSection]})]})]}),!p&&t&&jsxs("div",{className:a$1("mt-2 ml-6 space-y-2",e==null?void 0:e.detail,d),children:[jsx("p",{className:a$1(`text-xs ${bt[n.severity]}`,e==null?void 0:e.message,d),children:n.message}),jsx("button",{type:"button",onClick:()=>{r(n.requirementId),i(false);},className:a$1("text-xs font-medium px-3 py-1 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))]",e==null?void 0:e.fixButton,d),children:n.fixLabel})]})]})};function ft(n,p){let r=p.map(t=>({gap:{requirementId:t,requirement:t.split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" "),ndpaSection:"\u2014",severity:"recommended",message:"",fixType:"fill_field",fixLabel:""},isPassed:true})),e=n.map(t=>({gap:t,isPassed:false})),d={critical:0,important:1,recommended:2};return e.sort((t,i)=>d[t.gap.severity]-d[i.gap.severity]),[...e,...r]}var Mr=({complianceResult:n,onFix:p,classNames:r,unstyled:e})=>{let[d,t]=useState(false),i=ft(n.gaps,n.passed);return jsxs("aside",{"data-ndpr-component":"compliance-checker-sidebar",className:a$1("bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",r==null?void 0:r.root,e),"aria-label":"NDPA compliance checker",children:[jsxs("div",{className:a$1("flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",r==null?void 0:r.header,e),children:[jsx("h2",{className:a$1("ndpr-section-heading",r==null?void 0:r.title,e),children:"NDPA Compliance"}),jsx("button",{type:"button",onClick:()=>t(u=>!u),className:a$1("p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",r==null?void 0:r.collapseButton,e),"aria-expanded":!d,"aria-label":d?"Expand compliance checker":"Collapse compliance checker",children:jsx("svg",{className:`w-4 h-4 transition-transform ${d?"-rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})})]}),!d&&jsxs("div",{className:a$1("p-4 space-y-4",r==null?void 0:r.body,e),children:[jsx("div",{className:a$1("flex justify-center",r==null?void 0:r.ringWrapper,e),children:jsx(Ir,{score:n.score,maxScore:n.maxScore,rating:n.rating,classNames:r,unstyled:e})}),jsx("div",{className:a$1("grid grid-cols-3 gap-2 text-center",r==null?void 0:r.statsRow,e),children:[{count:n.gaps.filter(u=>u.severity==="critical").length,label:"Critical",color:"ndpr-text-destructive"},{count:n.gaps.filter(u=>u.severity==="important").length,label:"Important",color:"ndpr-text-warning"},{count:n.passed.length,label:"Passed",color:"ndpr-text-success"}].map(({count:u,label:l,color:v})=>jsxs("div",{children:[jsx("p",{className:a$1(`text-base font-bold ${v}`,r==null?void 0:r.statValue,e),children:u}),jsx("p",{className:a$1("ndpr-form-field__hint",r==null?void 0:r.statLabel,e),children:l})]},l))}),jsx("div",{className:a$1("overflow-y-auto max-h-80",r==null?void 0:r.requirementsList,e),children:i.length===0?jsx("p",{className:a$1("ndpr-empty-state",r==null?void 0:r.emptyState,e),children:"No requirements to display."}):i.map(({gap:u,isPassed:l})=>jsx(_r,{gap:u,isPassed:l,onFix:p,classNames:r,unstyled:e},u.requirementId))})]})]})};function xt(n){let p=Date.now()-n;return p<1e4?"just now":p<6e4?`${Math.floor(p/1e3)}s ago`:p<36e5?`${Math.floor(p/6e4)}m ago`:new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}var zr=({lastSavedAt:n,isSaving:p,hasError:r,classNames:e,unstyled:d})=>{let t="idle";if(p?t="saving":r?t="error":n!==null&&(t="saved"),t==="idle")return null;let i=t==="saving"?"Saving\u2026":t==="error"?"Unable to save":`Draft saved ${n?xt(n):""}`;return jsxs("div",{"data-ndpr-component":"draft-save-indicator",role:"status","aria-live":"polite","aria-atomic":"true",className:a$1(`flex items-center gap-1.5 ${t==="error"?"text-red-500 dark:text-red-400":t==="saving"?"ndpr-card__subtitle":"ndpr-text-success"}`,e==null?void 0:e.root,d),children:[t==="saving"&&jsxs("svg",{className:"animate-spin w-3 h-3 flex-shrink-0",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4l3-3-3-3v4a10 10 0 100 10l-1.73-3A8 8 0 014 12z"})]}),t==="saved"&&jsx("svg",{className:"w-3 h-3 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),t==="error"&&jsx("svg",{className:"w-3 h-3 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"})}),jsx("span",{className:a$1("text-xs font-medium",e==null?void 0:e.text,d),children:i})]})};var _o=({adapter:n,onComplete:p,classNames:r,unstyled:e,initialContext:d$1})=>{var vr,br,lr;let t=c(),i=(vr=t.policy.wizardTitle)!=null?vr:"Privacy Policy Builder",u=(br=t.common.back)!=null?br:"Back",l=(lr=t.common.next)!=null?lr:"Next",{currentStep:v,nextStep:C,prevStep:g,canProceed:a$2,context:b,updateOrg:c$1,updateContext:m,toggleDataCategory:B,togglePurpose:J,addProcessor:Z,removeProcessor:or,sections:er,customSections:h,sectionOverrides:F,editSectionContent:ir,addCustomSection:jr,removeCustomSection:qr,reorderSections:Or,complianceResult:ar,applyFix:Hr,handleExportPDF:Wr,handleExportDOCX:Gr,handleExportHTML:Ur,handleExportMarkdown:Vr,lastSavedAt:Xr,isLoading:Yr}=a({adapter:n,onComplete:p,initialContext:d$1}),nr=(D,K)=>{let O=URL.createObjectURL(D),H=document.createElement("a");H.href=O,H.download=K,H.click(),URL.revokeObjectURL(O);},Jr=()=>d(null,null,function*(){let D=yield Wr();nr(D,"privacy-policy.pdf");}),Kr=()=>d(null,null,function*(){let D=yield Gr();nr(D,"privacy-policy.docx");}),Qr=()=>{let D=Ur();navigator.clipboard.writeText(D).catch(()=>{let K=new Blob([D],{type:"text/html"}),O=URL.createObjectURL(K),H=window.open(O,"_blank");H?H.addEventListener("load",()=>URL.revokeObjectURL(O)):URL.revokeObjectURL(O);});},Zr=()=>{let D=Vr();navigator.clipboard.writeText(D).catch(()=>{let K=new Blob([D],{type:"text/markdown"});nr(K,"privacy-policy.md");});};return Yr?jsxs("div",{"data-ndpr-component":"adaptive-policy-wizard",className:a$1("flex items-center justify-center min-h-64 text-gray-400 dark:text-gray-500",r==null?void 0:r.root,e),"aria-busy":"true","aria-label":"Loading policy wizard",children:[jsxs("svg",{className:"animate-spin w-6 h-6 mr-2",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4l3-3-3-3v4a10 10 0 100 10l-1.73-3A8 8 0 014 12z"})]}),jsx("span",{className:"ndpr-text-sm",children:"Loading\u2026"})]}):jsx("div",{"data-ndpr-component":"adaptive-policy-wizard",className:a$1("min-h-screen bg-gray-50 dark:bg-gray-900",r==null?void 0:r.root,e),children:jsxs("div",{className:a$1("max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",r==null?void 0:r.container,e),children:[jsxs("div",{className:a$1("flex items-center justify-between mb-6",r==null?void 0:r.topBar,e),children:[jsx("h1",{className:a$1("text-2xl font-bold ndpr-text-foreground",r==null?void 0:r.wizardTitle,e),children:i}),jsx(zr,{lastSavedAt:Xr,isSaving:false,hasError:false,classNames:r,unstyled:e})]}),jsx("div",{className:a$1("bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg px-4 mb-6",r==null?void 0:r.stepIndicatorWrapper,e),children:jsx(yr,{currentStep:v,classNames:r,unstyled:e})}),jsxs("div",{className:a$1("flex flex-col lg:flex-row gap-6 items-start",r==null?void 0:r.panels,e),children:[jsxs("main",{"aria-live":"polite",className:a$1("flex-1 min-w-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",r==null?void 0:r.mainPanel,e),children:[v===1&&jsx(Cr,{context:b,onUpdateOrg:c$1,classNames:r,unstyled:e}),v===2&&jsx(kr,{categories:b.dataCategories,onToggle:B,classNames:r,unstyled:e}),v===3&&jsx(Pr,{context:b,onTogglePurpose:J,onUpdateContext:m,onAddProcessor:Z,onRemoveProcessor:or,classNames:r,unstyled:e}),v===4&&jsx(Ar,{sections:er,customSections:h,sectionOverrides:F,complianceResult:ar,onEditSection:ir,onAddCustomSection:jr,onRemoveCustomSection:qr,onReorderSection:Or,onExportPDF:Jr,onExportDOCX:Kr,onExportHTML:Qr,onExportMarkdown:Zr,classNames:r,unstyled:e}),jsxs("div",{className:a$1("flex items-center justify-between mt-8 pt-4 border-t border-gray-200 dark:border-gray-700",r==null?void 0:r.navigation,e),children:[jsx("button",{type:"button",onClick:g,disabled:v===1,className:a$1("px-4 py-2 bg-gray-200 dark:bg-gray-700 ndpr-text-foreground rounded-md text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors",r==null?void 0:r.backButton,e),children:u}),jsx("div",{className:"flex items-center gap-2",children:jsxs("span",{className:a$1("ndpr-form-field__hint",r==null?void 0:r.stepCounter,e),children:["Step ",v," of 4"]})}),v<4?jsx("button",{type:"button",onClick:C,disabled:!a$2,className:a$1("px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed transition-colors",r==null?void 0:r.nextButton,e),children:l}):jsx("span",{})]})]}),jsx("aside",{className:a$1("w-full lg:w-80 flex-shrink-0",r==null?void 0:r.sidebarWrapper,e),children:jsx(Mr,{complianceResult:ar,onFix:Hr,classNames:r,unstyled:e})})]})]})})};
1
+ import {a}from'./chunk-KE2FZH2V.mjs';import {a as a$1}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-PHA3YMFO.mjs';import {d,b,a as a$2}from'./chunk-ZJYULEER.mjs';import Nr,{useId,useState,useEffect}from'react';import {jsxs,jsx,Fragment}from'react/jsx-runtime';var cr=["Organization","Data Collection","Processing","Review & Export"],yr=({currentStep:n,classNames:p,unstyled:r})=>jsx("nav",{"data-ndpr-component":"policy-step-indicator","aria-label":"Policy wizard progress",className:a$1("w-full flex items-center justify-between px-2 py-4",p==null?void 0:p.root,r),children:cr.map((e,d)=>{let t=d+1,i=t<n,u=t===n,v=d===cr.length-1;return jsxs(Nr.Fragment,{children:[jsxs("div",{className:a$1("flex flex-col items-center gap-1",p==null?void 0:p.stepWrapper,r),children:[jsx("div",{"aria-current":u?"step":void 0,"aria-label":`Step ${t}: ${e}${i?" (completed)":u?" (current)":""}`,className:a$1(["flex items-center justify-center rounded-full border-2 font-semibold transition-all",i?"w-8 h-8 bg-[rgb(var(--ndpr-primary))] border-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))]":u?"w-9 h-9 bg-[rgb(var(--ndpr-primary))] border-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] shadow-md":"w-8 h-8 bg-white dark:bg-gray-900 border-gray-300 dark:border-gray-600 text-gray-400 dark:text-gray-500"].join(" "),i?p==null?void 0:p.stepCompleted:u?p==null?void 0:p.stepCurrent:p==null?void 0:p.stepUpcoming,r),children:i?jsx("svg",{className:"w-4 h-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):jsx("span",{className:"text-xs leading-none",children:t})}),jsx("span",{className:a$1(["text-xs font-medium hidden sm:block",i||u?"text-[rgb(var(--ndpr-primary))]":"ndpr-card__subtitle"].join(" "),p==null?void 0:p.stepLabel,r),children:e})]}),!v&&jsx("div",{className:a$1(["flex-1 h-0.5 mx-2",i?"bg-[rgb(var(--ndpr-primary))]":"bg-gray-200 dark:bg-gray-700"].join(" "),p==null?void 0:p.connector,r),"aria-hidden":"true"})]},t)})});var $="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 ndpr-text-foreground focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] text-sm",rt="block text-sm font-medium ndpr-text-muted mb-1",A=({id:n,label:p,required:r,description:e,children:d,classNames:t,unstyled:i})=>{let u=e?`${n}-desc`:void 0;return jsxs("div",{className:a$1("flex flex-col",t==null?void 0:t.field,i),children:[jsxs("label",{htmlFor:n,className:a$1(rt,t==null?void 0:t.label,i),children:[p,r&&jsx("span",{className:"text-red-500 ml-0.5","aria-hidden":"true",children:"*"})]}),e&&jsx("p",{id:u,className:"text-xs ndpr-text-muted mb-1",children:e}),d]})},Cr=({context:n,onUpdateOrg:p,classNames:r,unstyled:e})=>{var i,u,l;let d=useId(),t=n.org;return jsxs("div",{"data-ndpr-component":"policy-step-about",className:a$1("ndpr-form-section",r==null?void 0:r.root,e),children:[jsxs("div",{children:[jsx("h2",{className:a$1("ndpr-section-heading",r==null?void 0:r.heading,e),children:"Organisation Details"}),jsxs("p",{className:a$1("ndpr-form-field__hint",r==null?void 0:r.subheading,e),children:["Tell us about your organisation. Fields marked ",jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})," are required."]})]}),jsxs("div",{className:a$1("grid grid-cols-1 md:grid-cols-2 gap-4",r==null?void 0:r.grid,e),children:[jsx(A,{id:`${d}-org-name`,label:"Organisation Name",required:true,classNames:r,unstyled:e,children:jsx("input",{id:`${d}-org-name`,type:"text",value:t.name,onChange:v=>p({name:v.target.value}),placeholder:"Acme Corporation",className:a$1($,r==null?void 0:r.input,e),"aria-required":"true"})}),jsx(A,{id:`${d}-website`,label:"Website",required:true,classNames:r,unstyled:e,children:jsx("input",{id:`${d}-website`,type:"url",value:t.website,onChange:v=>p({website:v.target.value}),placeholder:"https://example.com",className:a$1($,r==null?void 0:r.input,e),"aria-required":"true"})}),jsx(A,{id:`${d}-privacy-email`,label:"Privacy Contact Email",required:true,classNames:r,unstyled:e,children:jsx("input",{id:`${d}-privacy-email`,type:"email",value:t.privacyEmail,onChange:v=>p({privacyEmail:v.target.value}),placeholder:"privacy@example.com",className:a$1($,r==null?void 0:r.input,e),"aria-required":"true"})}),jsx(A,{id:`${d}-industry`,label:"Industry",classNames:r,unstyled:e,children:jsxs("select",{id:`${d}-industry`,value:t.industry,onChange:v=>p({industry:v.target.value}),className:a$1($,r==null?void 0:r.select,e),children:[jsx("option",{value:"fintech",children:"Fintech"}),jsx("option",{value:"healthcare",children:"Healthcare"}),jsx("option",{value:"ecommerce",children:"E-commerce"}),jsx("option",{value:"saas",children:"SaaS"}),jsx("option",{value:"education",children:"Education"}),jsx("option",{value:"government",children:"Government"}),jsx("option",{value:"other",children:"Other"})]})}),jsx(A,{id:`${d}-dpo-name`,label:"Data Protection Officer (DPO) Name",classNames:r,unstyled:e,children:jsx("input",{id:`${d}-dpo-name`,type:"text",value:(i=t.dpoName)!=null?i:"",onChange:v=>p({dpoName:v.target.value}),placeholder:"Jane Smith",className:a$1($,r==null?void 0:r.input,e)})}),jsx(A,{id:`${d}-dpo-email`,label:"DPO Email",classNames:r,unstyled:e,children:jsx("input",{id:`${d}-dpo-email`,type:"email",value:(u=t.dpoEmail)!=null?u:"",onChange:v=>p({dpoEmail:v.target.value}),placeholder:"dpo@example.com",className:a$1($,r==null?void 0:r.input,e)})}),jsx(A,{id:`${d}-address`,label:"Registered Address",classNames:r,unstyled:e,children:jsx("input",{id:`${d}-address`,type:"text",value:(l=t.address)!=null?l:"",onChange:v=>p({address:v.target.value}),placeholder:"1 Victoria Island, Lagos, Nigeria",className:a$1($,r==null?void 0:r.input,e)})}),jsx(A,{id:`${d}-org-size`,label:"Organisation Size",classNames:r,unstyled:e,children:jsxs("select",{id:`${d}-org-size`,value:t.orgSize,onChange:v=>p({orgSize:v.target.value}),className:a$1($,r==null?void 0:r.select,e),children:[jsx("option",{value:"startup",children:"Startup (1\u201350 employees)"}),jsx("option",{value:"midsize",children:"Mid-size (51\u2013500 employees)"}),jsx("option",{value:"enterprise",children:"Enterprise (500+ employees)"})]})}),jsx(A,{id:`${d}-country`,label:"Country of Operation",classNames:r,unstyled:e,children:jsx("input",{id:`${d}-country`,type:"text",value:t.country,onChange:v=>p({country:v.target.value}),placeholder:"Nigeria",className:a$1($,r==null?void 0:r.input,e)})})]})]})};var tt={identity:"Identity",financial:"Financial",behavioral:"Behavioural",sensitive:"Sensitive",children:"Children"},ot=["identity","financial","behavioral","sensitive","children"],et=["sensitive","children"],kr=({categories:n,onToggle:p,classNames:r,unstyled:e})=>{let d=ot.reduce((t,i)=>{let u=n.filter(l=>l.group===i);return u.length>0&&(t[i]=u),t},{});return jsxs("div",{"data-ndpr-component":"policy-step-data",className:a$1("space-y-8",r==null?void 0:r.root,e),children:[jsxs("div",{children:[jsx("h2",{className:a$1("ndpr-section-heading",r==null?void 0:r.heading,e),children:"Data Categories"}),jsx("p",{id:"data-categories-desc",className:a$1("ndpr-form-field__hint",r==null?void 0:r.subheading,e),children:"Select the categories of personal data your organisation collects. You must select at least one."})]}),Object.entries(d).map(([t,i])=>{let u=et.includes(t);return jsxs("div",{className:a$1("space-y-3",r==null?void 0:r.group,e),children:[jsxs("div",{className:a$1("flex items-center gap-2",r==null?void 0:r.groupHeader,e),children:[jsx("h3",{className:a$1("text-sm font-semibold uppercase tracking-wide ndpr-text-muted",r==null?void 0:r.groupTitle,e),children:tt[t]}),u&&jsx("span",{className:a$1("text-xs font-medium ndpr-text-warning bg-amber-50 dark:bg-amber-900/20 px-2 py-0.5 rounded-full",r==null?void 0:r.sensitiveTag,e),children:"Sensitive"})]}),u&&jsx("p",{className:a$1("text-xs ndpr-text-warning",r==null?void 0:r.sensitiveWarning,e),children:t==="children"?"Processing children's data requires parental consent under NDPA Section 31 and imposes heightened obligations.":"Sensitive/special-category data requires explicit consent and additional safeguards under NDPA Section 30."}),jsx("div",{className:a$1("grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3",r==null?void 0:r.cardsGrid,e),children:i.map(l=>jsx("button",{type:"button",onClick:()=>p(l.id),"aria-pressed":l.selected,className:a$1(["text-left rounded-lg border p-4 transition-all cursor-pointer focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",l.selected?"bg-[rgb(var(--ndpr-primary))]/5 border-[rgb(var(--ndpr-primary))] dark:bg-[rgb(var(--ndpr-primary))]/10":"bg-white dark:bg-gray-800 border-gray-200 dark:border-gray-700 hover:border-gray-300 dark:hover:border-gray-600"].join(" "),r==null?void 0:r.card,e),children:jsxs("div",{className:"flex items-start gap-3",children:[jsx("div",{className:a$1(["mt-0.5 w-4 h-4 rounded border-2 flex-shrink-0 flex items-center justify-center",l.selected?"bg-[rgb(var(--ndpr-primary))] border-[rgb(var(--ndpr-primary))]":"border-gray-300 dark:border-gray-600"].join(" "),r==null?void 0:r.checkbox,e),"aria-hidden":"true",children:l.selected&&jsx("svg",{className:"w-2.5 h-2.5 text-[rgb(var(--ndpr-primary-foreground))]",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})})}),jsxs("div",{className:"min-w-0",children:[jsx("p",{className:a$1("text-sm font-medium ndpr-text-foreground",r==null?void 0:r.cardLabel,e),children:l.label}),jsx("p",{className:a$1("text-xs ndpr-text-muted mt-1 leading-relaxed",r==null?void 0:r.cardDataPoints,e),children:l.dataPoints.join(", ")})]})]})},l.id))})]},t)})]})};var nt=[{value:"service_delivery",label:"Service Delivery",description:"Processing required to deliver the core product or service."},{value:"marketing",label:"Marketing & Communications",description:"Sending promotional messages, newsletters or offers."},{value:"analytics",label:"Analytics & Insights",description:"Analysing usage patterns to improve the product."},{value:"research",label:"Research & Development",description:"Using data to develop new features or products."},{value:"legal_compliance",label:"Legal Compliance",description:"Meeting statutory, regulatory or contractual obligations."},{value:"fraud_prevention",label:"Fraud Prevention & Security",description:"Detecting and preventing fraudulent activity."}],dr="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 ndpr-text-foreground focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] text-sm",pr="ndpr-card ndpr-card--compact",gr=({id:n,checked:p,onChange:r})=>jsx("button",{id:n,type:"button",role:"switch","aria-checked":p,onClick:()=>r(!p),className:["relative inline-flex h-6 w-11 flex-shrink-0 rounded-full border-2 border-transparent cursor-pointer transition-colors focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))]",p?"bg-[rgb(var(--ndpr-primary))]":"bg-gray-200 dark:bg-gray-600"].join(" "),children:jsx("span",{"aria-hidden":"true",className:["pointer-events-none inline-block h-5 w-5 rounded-full bg-white shadow transform ring-0 transition-transform",p?"translate-x-5":"translate-x-0"].join(" ")})}),Pr=({context:n,onTogglePurpose:p,onUpdateContext:r,onAddProcessor:e,onRemoveProcessor:d,classNames:t,unstyled:i})=>{let u=useId(),[l,v]=useState({name:"",purpose:"",country:""}),[C,g]=useState(false),a=()=>{let{name:b,purpose:c,country:m}=l;!b.trim()||!c.trim()||!m.trim()||(e({name:b.trim(),purpose:c.trim(),country:m.trim()}),v({name:"",purpose:"",country:""}),g(false));};return jsxs("div",{"data-ndpr-component":"policy-step-processing",className:a$1("ndpr-form-section",t==null?void 0:t.root,i),children:[jsxs("div",{children:[jsx("h2",{className:a$1("ndpr-section-heading",t==null?void 0:t.heading,i),children:"Processing Details"}),jsx("p",{className:a$1("ndpr-form-field__hint",t==null?void 0:t.subheading,i),children:"Define how and why you process personal data."})]}),jsxs("section",{className:a$1(pr,t==null?void 0:t.section,i),"aria-labelledby":"purposes-heading",children:[jsx("h3",{id:"purposes-heading",className:a$1("text-base font-semibold ndpr-text-foreground",t==null?void 0:t.sectionTitle,i),children:"Processing Purposes"}),jsx("p",{className:a$1("ndpr-form-field__hint",t==null?void 0:t.sectionDescription,i),children:"Select all purposes for which you process personal data. At least one is required."}),jsx("div",{className:a$1("space-y-3",t==null?void 0:t.purposeList,i),children:nt.map(b=>{let c=n.purposes.includes(b.value),m=`${u}-purpose-${b.value}`,B=`${u}-purpose-desc-${b.value}`;return jsxs("label",{htmlFor:m,className:a$1("flex items-start gap-3 cursor-pointer group",t==null?void 0:t.purposeItem,i),children:[jsx("input",{id:m,type:"checkbox",checked:c,onChange:()=>p(b.value),"aria-describedby":B,className:a$1("mt-0.5 h-4 w-4 rounded border-gray-300 dark:border-gray-600 text-[rgb(var(--ndpr-primary))] focus:ring-[rgb(var(--ndpr-ring))] cursor-pointer",t==null?void 0:t.purposeCheckbox,i)}),jsxs("div",{children:[jsx("p",{className:a$1("text-sm font-medium ndpr-text-foreground",t==null?void 0:t.purposeLabel,i),children:b.label}),jsx("p",{id:B,className:a$1("ndpr-form-field__hint",t==null?void 0:t.purposeDescription,i),children:b.description})]})]},b.value)})})]}),jsxs("section",{className:a$1(pr,t==null?void 0:t.section,i),"aria-labelledby":"thirdparty-heading",children:[jsxs("div",{className:"flex items-center justify-between",children:[jsx("h3",{id:"thirdparty-heading",className:a$1("text-base font-semibold ndpr-text-foreground",t==null?void 0:t.sectionTitle,i),children:"Third-Party Data Sharing"}),jsx(gr,{id:`${u}-thirdparty-toggle`,checked:n.thirdPartyProcessors.length>0||C,onChange:b=>{b?g(true):(n.thirdPartyProcessors.forEach((c,m)=>d(0)),g(false));}})]}),(n.thirdPartyProcessors.length>0||C)&&jsxs("div",{className:a$1("ndpr-form-section",t==null?void 0:t.processorSection,i),children:[n.thirdPartyProcessors.length>0&&jsx("div",{className:a$1("overflow-x-auto",t==null?void 0:t.processorTable,i),children:jsxs("table",{className:"w-full text-sm",children:[jsx("thead",{children:jsxs("tr",{className:a$1("text-left text-xs font-medium ndpr-text-muted border-b border-gray-200 dark:border-gray-700",t==null?void 0:t.tableHeader,i),children:[jsx("th",{className:"pb-2 pr-4",children:"Name"}),jsx("th",{className:"pb-2 pr-4",children:"Purpose"}),jsx("th",{className:"pb-2 pr-4",children:"Country"}),jsx("th",{className:"pb-2"})]})}),jsx("tbody",{className:"divide-y divide-gray-100 dark:divide-gray-700",children:n.thirdPartyProcessors.map((b,c)=>jsxs("tr",{children:[jsx("td",{className:a$1("py-2 pr-4 ndpr-text-foreground",t==null?void 0:t.tableCell,i),children:b.name}),jsx("td",{className:a$1("py-2 pr-4 ndpr-text-muted",t==null?void 0:t.tableCell,i),children:b.purpose}),jsx("td",{className:a$1("py-2 pr-4 ndpr-text-muted",t==null?void 0:t.tableCell,i),children:b.country}),jsx("td",{className:"py-2",children:jsx("button",{type:"button",onClick:()=>d(c),className:a$1("text-red-500 hover:ndpr-text-destructive dark:hover:text-red-300 text-xs font-medium",t==null?void 0:t.removeButton,i),"aria-label":`Remove ${b.name}`,children:"Remove"})})]},c))})]})}),C?jsxs("div",{className:a$1("grid grid-cols-1 sm:grid-cols-3 gap-3 items-end",t==null?void 0:t.processorForm,i),children:[jsxs("div",{children:[jsx("label",{htmlFor:`${u}-proc-name`,className:"block text-xs font-medium ndpr-text-muted mb-1",children:"Processor Name"}),jsx("input",{id:`${u}-proc-name`,type:"text",placeholder:"Processor name",value:l.name,onChange:b$1=>v(c=>b(a$2({},c),{name:b$1.target.value})),"aria-required":"true",className:a$1(dr,t==null?void 0:t.input,i)})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${u}-proc-purpose`,className:"block text-xs font-medium ndpr-text-muted mb-1",children:"Purpose"}),jsx("input",{id:`${u}-proc-purpose`,type:"text",placeholder:"Purpose",value:l.purpose,onChange:b$1=>v(c=>b(a$2({},c),{purpose:b$1.target.value})),"aria-required":"true",className:a$1(dr,t==null?void 0:t.input,i)})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${u}-proc-country`,className:"block text-xs font-medium ndpr-text-muted mb-1",children:"Country"}),jsx("input",{id:`${u}-proc-country`,type:"text",placeholder:"Country",value:l.country,onChange:b$1=>v(c=>b(a$2({},c),{country:b$1.target.value})),"aria-required":"true",className:a$1(dr,t==null?void 0:t.input,i)})]}),jsxs("div",{className:"sm:col-span-3 flex gap-2",children:[jsx("button",{type:"button",onClick:a,className:a$1("ndpr-button ndpr-button--primary ndpr-button--sm",t==null?void 0:t.addButton,i),children:"Add Processor"}),jsx("button",{type:"button",onClick:()=>g(false),className:a$1("ndpr-button ndpr-button--secondary ndpr-button--sm",t==null?void 0:t.cancelButton,i),children:"Cancel"})]})]}):jsxs("button",{type:"button",onClick:()=>g(true),className:a$1("flex items-center gap-1 text-sm text-[rgb(var(--ndpr-primary))] hover:underline font-medium",t==null?void 0:t.addLink,i),children:[jsx("span",{"aria-hidden":"true",children:"+"})," Add processor"]})]})]}),jsxs("section",{className:a$1(pr,t==null?void 0:t.section,i),"aria-labelledby":"disclosures-heading",children:[jsx("h3",{id:"disclosures-heading",className:a$1("text-base font-semibold ndpr-text-foreground",t==null?void 0:t.sectionTitle,i),children:"Additional Disclosures"}),jsxs("div",{className:a$1("ndpr-form-section",t==null?void 0:t.disclosureList,i),children:[jsxs("div",{className:a$1("flex items-start justify-between gap-4",t==null?void 0:t.disclosureItem,i),children:[jsxs("div",{children:[jsx("p",{id:`${u}-cross-border-label`,className:a$1("text-sm font-medium ndpr-text-foreground",t==null?void 0:t.disclosureLabel,i),children:"Cross-border Data Transfers"}),jsx("p",{id:`${u}-cross-border-desc`,className:a$1("text-xs ndpr-text-muted mt-0.5",t==null?void 0:t.disclosureDescription,i),children:"Do you transfer personal data outside Nigeria? This triggers NDPA Chapter 6 obligations."})]}),jsx(gr,{id:`${u}-cross-border-toggle`,checked:n.hasCrossBorderTransfer,onChange:b=>r({hasCrossBorderTransfer:b})})]}),jsxs("div",{className:a$1("flex items-start justify-between gap-4",t==null?void 0:t.disclosureItem,i),children:[jsxs("div",{children:[jsx("p",{id:`${u}-automated-label`,className:a$1("text-sm font-medium ndpr-text-foreground",t==null?void 0:t.disclosureLabel,i),children:"Automated Decision-Making / Profiling"}),jsx("p",{id:`${u}-automated-desc`,className:a$1("text-xs ndpr-text-muted mt-0.5",t==null?void 0:t.disclosureDescription,i),children:"Do you use algorithms or automated systems to make decisions about individuals? Requires disclosure under NDPA Section 37."})]}),jsx(gr,{id:`${u}-automated-toggle`,checked:n.hasAutomatedDecisions,onChange:b=>r({hasAutomatedDecisions:b})})]})]})]})]})};var Sr=({section:n,index:p,isCustom:r,isEditing:e,editedContent:d,onEdit:t,onSaveEdit:i,onCancelEdit:u,onMoveUp:l,onMoveDown:v,onDelete:C,classNames:g,unstyled:a})=>{let[b,c]=useState(d!=null?d:n.template);return useEffect(()=>{d!==void 0&&c(d);},[d]),useEffect(()=>{e&&c(d!=null?d:n.template);},[e,d,n.template]),jsxs("div",{"data-ndpr-component":"policy-section-card",className:a$1("bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 space-y-3",g==null?void 0:g.root,a),children:[jsxs("div",{className:a$1("flex items-start justify-between gap-2",g==null?void 0:g.header,a),children:[jsxs("div",{className:a$1("flex items-center gap-3 min-w-0",g==null?void 0:g.titleRow,a),children:[jsx("span",{className:a$1("flex-shrink-0 w-7 h-7 rounded-full bg-gray-100 dark:bg-gray-700 ndpr-text-muted text-xs font-semibold flex items-center justify-center",g==null?void 0:g.sectionNumber,a),"aria-hidden":"true",children:p+1}),jsxs("h4",{className:a$1("text-sm font-semibold ndpr-text-foreground truncate",g==null?void 0:g.sectionTitle,a),children:[n.title,r&&jsx("span",{className:a$1("ml-2 text-xs font-normal ndpr-text-muted bg-gray-100 dark:bg-gray-700 px-1.5 py-0.5 rounded",g==null?void 0:g.customBadge,a),children:"Custom"})]})]}),jsxs("div",{className:a$1("flex items-center gap-1 flex-shrink-0",g==null?void 0:g.actions,a),children:[l&&jsx("button",{type:"button",onClick:l,className:a$1("ndpr-button ndpr-button--icon",g==null?void 0:g.moveButton,a),"aria-label":`Move "${n.title}" up`,children:jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 15l7-7 7 7"})})}),v&&jsx("button",{type:"button",onClick:v,className:a$1("ndpr-button ndpr-button--icon",g==null?void 0:g.moveButton,a),"aria-label":`Move "${n.title}" down`,children:jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})}),!e&&jsx("button",{type:"button",onClick:t,className:a$1("p-1.5 text-gray-400 hover:text-[rgb(var(--ndpr-primary))] rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",g==null?void 0:g.editButton,a),"aria-label":`Edit "${n.title}"`,children:jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M11 5H6a2 2 0 00-2 2v11a2 2 0 002 2h11a2 2 0 002-2v-5m-1.414-9.414a2 2 0 112.828 2.828L11.828 15H9v-2.828l8.586-8.586z"})})}),r&&C&&jsx("button",{type:"button",onClick:C,className:a$1("p-1.5 text-gray-400 hover:text-red-500 dark:hover:text-red-400 rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",g==null?void 0:g.deleteButton,a),"aria-label":`Delete "${n.title}"`,children:jsx("svg",{className:"w-3.5 h-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 7l-.867 12.142A2 2 0 0116.138 21H7.862a2 2 0 01-1.995-1.858L5 7m5 4v6m4-6v6m1-10V4a1 1 0 00-1-1h-4a1 1 0 00-1 1v3M4 7h16"})})})]})]}),e?jsxs("div",{className:a$1("space-y-2",g==null?void 0:g.editArea,a),children:[jsx("textarea",{value:b,onChange:m=>c(m.target.value),rows:8,className:a$1("w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 ndpr-text-foreground focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] text-sm font-mono resize-y",g==null?void 0:g.textarea,a),"aria-label":`Edit content for ${n.title}`}),jsxs("div",{className:a$1("flex gap-2",g==null?void 0:g.editActions,a),children:[jsx("button",{type:"button",onClick:()=>i(b),className:a$1("ndpr-button ndpr-button--primary ndpr-button--sm",g==null?void 0:g.saveButton,a),children:"Save"}),jsx("button",{type:"button",onClick:u,className:a$1("ndpr-button ndpr-button--secondary ndpr-button--sm",g==null?void 0:g.cancelButton,a),children:"Cancel"})]})]}):jsx("div",{className:a$1("text-sm ndpr-text-muted leading-relaxed line-clamp-4 whitespace-pre-wrap",g==null?void 0:g.content,a),children:n.template})]})};var Rr="w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md bg-white dark:bg-gray-800 ndpr-text-foreground focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] text-sm",Lr=({onAdd:n,nextOrder:p,classNames:r,unstyled:e})=>{let d=useId(),[t,i]=useState(""),[u,l]=useState(""),[v,C]=useState(""),g=()=>{if(!t.trim()){C("Section title is required.");return}if(!u.trim()){C("Section content is required.");return}C(""),n({title:t.trim(),content:u.trim(),order:p}),i(""),l("");};return jsxs("div",{"data-ndpr-component":"custom-section-form",className:a$1("ndpr-card ndpr-card--compact",r==null?void 0:r.root,e),children:[jsx("h4",{className:a$1("ndpr-section-heading",r==null?void 0:r.heading,e),children:"Add Custom Section"}),v&&jsx("p",{role:"alert",className:a$1("text-xs ndpr-text-destructive",r==null?void 0:r.error,e),children:v}),jsxs("div",{className:a$1("space-y-3",r==null?void 0:r.fields,e),children:[jsxs("div",{children:[jsxs("label",{htmlFor:`${d}-custom-section-title`,className:a$1("block text-xs font-medium ndpr-text-muted mb-1",r==null?void 0:r.label,e),children:["Section Title ",jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),jsx("input",{id:`${d}-custom-section-title`,type:"text",value:t,onChange:a=>{i(a.target.value),v&&C("");},placeholder:"e.g. Cookie Policy",className:a$1(Rr,r==null?void 0:r.input,e),"aria-required":"true"})]}),jsxs("div",{children:[jsxs("label",{htmlFor:`${d}-custom-section-content`,className:a$1("block text-xs font-medium ndpr-text-muted mb-1",r==null?void 0:r.label,e),children:["Content ",jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),jsx("textarea",{id:`${d}-custom-section-content`,value:u,onChange:a=>{l(a.target.value),v&&C("");},placeholder:"Write the section content here...",rows:5,className:a$1(`${Rr} resize-y`,r==null?void 0:r.textarea,e),"aria-required":"true"})]})]}),jsx("div",{className:a$1("flex items-center gap-2",r==null?void 0:r.footer,e),children:jsx("button",{type:"button",onClick:g,className:a$1("ndpr-button ndpr-button--primary ndpr-button--sm",r==null?void 0:r.addButton,e),children:"Add Section"})})]})};var Fr={compliant:{bg:"ndpr-alert ndpr-alert--success",text:"ndpr-text-success",border:"border-green-200 dark:border-green-700"},nearly_compliant:{bg:"bg-amber-50 dark:bg-amber-900/20",text:"ndpr-text-warning",border:"border-amber-200 dark:border-amber-700"},not_compliant:{bg:"ndpr-alert ndpr-alert--destructive",text:"ndpr-text-destructive",border:"border-red-200 dark:border-red-700"}},gt={compliant:"Compliant",nearly_compliant:"Nearly Compliant",not_compliant:"Not Compliant"},N=({icon:n,label:p,description:r,actionLabel:e,loading:d,onClick:t,classNames:i,unstyled:u})=>jsxs("div",{className:a$1("bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-4 flex flex-col gap-3",i==null?void 0:i.formatCard,u),children:[jsxs("div",{className:a$1("flex items-center gap-3",i==null?void 0:i.formatHeader,u),children:[jsx("div",{className:a$1("w-10 h-10 rounded-lg bg-gray-100 dark:bg-gray-700 flex items-center justify-center flex-shrink-0",i==null?void 0:i.formatIcon,u),"aria-hidden":"true",children:n}),jsxs("div",{className:"min-w-0",children:[jsx("p",{className:a$1("ndpr-section-heading",i==null?void 0:i.formatLabel,u),children:p}),jsx("p",{className:a$1("ndpr-form-field__hint",i==null?void 0:i.formatDescription,u),children:r})]})]}),jsx("button",{type:"button",onClick:t,disabled:d,className:a$1("w-full px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm font-medium disabled:opacity-60 disabled:cursor-not-allowed flex items-center justify-center gap-2",i==null?void 0:i.formatButton,u),children:d?jsxs(Fragment,{children:[jsxs("svg",{className:"animate-spin w-4 h-4",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4l3-3-3-3v4a10 10 0 100 10l-1.73-3A8 8 0 014 12z"})]}),"Generating\u2026"]}):e})]}),Er=({complianceResult:n,onExportPDF:p,onExportDOCX:r,onExportHTML:e,onExportMarkdown:d$1,classNames:t,unstyled:i})=>{var c;let[u,l]=useState(false),[v,C]=useState(false),g=(c=Fr[n.rating])!=null?c:Fr.not_compliant,a=()=>d(null,null,function*(){l(true);try{yield p();}finally{l(false);}}),b=()=>d(null,null,function*(){C(true);try{yield r();}finally{C(false);}});return jsxs("div",{"data-ndpr-component":"policy-export-panel",className:a$1("ndpr-form-section",t==null?void 0:t.root,i),children:[jsxs("div",{className:a$1(`rounded-lg border p-4 flex items-center gap-4 ${g.bg} ${g.border}`,t==null?void 0:t.complianceSummary,i),children:[jsxs("div",{className:a$1(`text-3xl font-bold ${g.text}`,t==null?void 0:t.complianceScore,i),"aria-label":`Compliance score: ${n.percentage}%`,children:[n.percentage,"%"]}),jsxs("div",{children:[jsx("p",{className:a$1(`text-sm font-semibold ${g.text}`,t==null?void 0:t.complianceRating,i),children:gt[n.rating]}),jsxs("p",{className:a$1("text-xs ndpr-text-muted mt-0.5",t==null?void 0:t.complianceDetail,i),children:[n.score," / ",n.maxScore," points \u2022"," ",n.gaps.length," gap",n.gaps.length!==1?"s":""," remaining"]})]})]}),jsxs("div",{children:[jsx("h3",{className:a$1("ndpr-section-heading",t==null?void 0:t.formatsHeading,i),children:"Export Format"}),jsxs("div",{className:a$1("grid grid-cols-1 sm:grid-cols-2 gap-3",t==null?void 0:t.formatsGrid,i),children:[jsx(N,{icon:jsx("svg",{className:"w-5 h-5 text-red-500",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-3 7v-1h4v1h-4zm0-3v-1h4v1h-4zm-2-5h8v1H8v-1z"})}),label:"PDF",description:"Professional formatted document, ideal for publishing.",actionLabel:"Download PDF",loading:u,onClick:a,classNames:t,unstyled:i}),jsx(N,{icon:jsx("svg",{className:"w-5 h-5 text-blue-500",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8l-6-6zm-1 7V3.5L18.5 9H13zm-5 8v-5h1.5l1 3 1-3H13v5h-1v-3.5l-.75 2.25h-.5L10 13.5V17H9zm5-1.5h.75c.55 0 .75-.25.75-.75 0-.4-.2-.65-.75-.65H14V15.5zm1 1.5h-2v-4h2c1.1 0 1.75.6 1.75 1.5 0 .55-.25.95-.65 1.15.5.2.8.65.8 1.2 0 1-.65 1.65-1.9 1.65V17zm-.25-1c.6 0 .9-.25.9-.75 0-.45-.3-.75-.9-.75H14V16h.75z"})}),label:"DOCX",description:"Editable Word document for further customisation.",actionLabel:"Download DOCX",loading:v,onClick:b,classNames:t,unstyled:i}),jsx(N,{icon:jsxs("svg",{className:"w-5 h-5 text-orange-500",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("path",{d:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 15H9V8h2v9zm4 0h-2V8h2v9z"}),jsx("path",{d:"M9.5 6.5h1v1h-1zm4 0h1v1h-1z"}),jsx("path",{d:"M5 5h14v2H5zm0 12h14v2H5z"})]}),label:"HTML",description:"Copy-ready HTML to embed on your website.",actionLabel:"Copy HTML",onClick:e,classNames:t,unstyled:i}),jsx(N,{icon:jsx("svg",{className:"w-5 h-5 ndpr-text-muted",fill:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:jsx("path",{d:"M3 5h18v2H3V5zm0 4h12v2H3V9zm0 4h18v2H3v-2zm0 4h12v2H3v-2z"})}),label:"Markdown",description:"Plain-text format for documentation or Git repos.",actionLabel:"Copy Markdown",onClick:d$1,classNames:t,unstyled:i})]})]})]})};var Ar=({sections:n,customSections:p,sectionOverrides:r,complianceResult:e,onEditSection:d,onAddCustomSection:t,onRemoveCustomSection:i,onReorderSection:u,onExportPDF:l,onExportDOCX:v,onExportHTML:C,onExportMarkdown:g,classNames:a,unstyled:b$1})=>{let[c,m]=useState(null),[B,J]=useState(false),Z=new Set(p.map(h=>h.id)),or=(h,F)=>{d(h,F),m(null);},er=n.length>0?Math.max(...n.map(h=>{var F;return (F=h.order)!=null?F:0}))+1:1;return jsxs("div",{"data-ndpr-component":"policy-step-review",className:a$1("ndpr-form-section",a==null?void 0:a.root,b$1),children:[jsxs("div",{children:[jsx("h2",{className:a$1("ndpr-section-heading",a==null?void 0:a.heading,b$1),children:"Review & Export"}),jsx("p",{className:a$1("ndpr-form-field__hint",a==null?void 0:a.subheading,b$1),children:"Review your generated policy sections, reorder or edit content, then export."})]}),jsx("div",{className:a$1("space-y-3",a==null?void 0:a.sectionList,b$1),"aria-live":"polite",children:n.map((h,F)=>jsx(Sr,{section:r[h.id]?b(a$2({},h),{template:r[h.id]}):h,index:F,isCustom:Z.has(h.id),isEditing:c===h.id,editedContent:r[h.id],onEdit:()=>m(h.id),onSaveEdit:ir=>or(h.id,ir),onCancelEdit:()=>m(null),onMoveUp:F>0?()=>u(h.id,"up"):void 0,onMoveDown:F<n.length-1?()=>u(h.id,"down"):void 0,onDelete:Z.has(h.id)?()=>i(h.id):void 0,classNames:a,unstyled:b$1},h.id))}),!B&&jsxs("button",{type:"button",onClick:()=>J(true),className:a$1("flex items-center gap-2 text-sm text-[rgb(var(--ndpr-primary))] hover:underline font-medium",a==null?void 0:a.addSectionButton,b$1),children:[jsx("span",{className:a$1("w-5 h-5 rounded-full border-2 border-[rgb(var(--ndpr-primary))] flex items-center justify-center text-xs font-bold leading-none",a==null?void 0:a.addSectionIcon,b$1),"aria-hidden":"true",children:"+"}),"Add Custom Section"]}),B&&jsxs("div",{className:a$1("space-y-2",a==null?void 0:a.customFormWrapper,b$1),children:[jsx(Lr,{onAdd:h=>{t(h),J(false);},nextOrder:er,classNames:a,unstyled:b$1}),jsx("button",{type:"button",onClick:()=>J(false),className:a$1("text-sm ndpr-text-muted hover:underline",a==null?void 0:a.cancelCustomForm,b$1),children:"Cancel"})]}),jsx("hr",{className:a$1("border-gray-200 dark:border-gray-700",a==null?void 0:a.divider,b$1)}),jsx(Er,{complianceResult:e,onExportPDF:l,onExportDOCX:v,onExportHTML:C,onExportMarkdown:g,classNames:a,unstyled:b$1})]})};var Tr={compliant:{stroke:"stroke-green-500 dark:stroke-green-400",text:"ndpr-text-success"},nearly_compliant:{stroke:"stroke-amber-500 dark:stroke-amber-400",text:"ndpr-text-warning"},not_compliant:{stroke:"stroke-red-500 dark:stroke-red-400",text:"ndpr-text-destructive"}},at={compliant:"Compliant",nearly_compliant:"Nearly Compliant",not_compliant:"Not Compliant"},Ir=({score:n,maxScore:p,rating:r,classNames:e,unstyled:d})=>{var C,g;let t=p>0?Math.round(n/p*100):0,i=(C=Tr[r])!=null?C:Tr.not_compliant,u=36,l=2*Math.PI*u,v=l-t/100*l;return jsxs("div",{"data-ndpr-component":"compliance-score-ring",className:a$1("flex flex-col items-center gap-2",e==null?void 0:e.root,d),children:[jsxs("div",{className:a$1("relative w-24 h-24",e==null?void 0:e.svgWrapper,d),children:[jsxs("svg",{className:"w-24 h-24 -rotate-90",viewBox:"0 0 96 96","aria-hidden":"true",children:[jsx("circle",{cx:"48",cy:"48",r:u,fill:"none",className:"stroke-gray-200 dark:stroke-gray-700",strokeWidth:"8"}),jsx("circle",{cx:"48",cy:"48",r:u,fill:"none",className:i.stroke,strokeWidth:"8",strokeLinecap:"round",strokeDasharray:l,strokeDashoffset:v,style:{transition:"stroke-dashoffset 0.5s ease-out"}})]}),jsx("div",{className:a$1("absolute inset-0 flex flex-col items-center justify-center",e==null?void 0:e.centerText,d),children:jsxs("span",{className:a$1(`text-xl font-bold leading-none ${i.text}`,e==null?void 0:e.scoreValue,d),"aria-label":`${t}% compliance score`,children:[t,"%"]})})]}),jsx("p",{className:a$1(`text-xs font-semibold text-center ${i.text}`,e==null?void 0:e.ratingLabel,d),children:(g=at[r])!=null?g:r}),jsxs("p",{className:a$1("text-xs ndpr-text-muted text-center",e==null?void 0:e.scoreDetail,d),children:[n," / ",p," pts"]})]})};var bt={critical:"ndpr-text-destructive",important:"ndpr-text-warning",recommended:"ndpr-text-info"},_r=({gap:n,isPassed:p,onFix:r,classNames:e,unstyled:d})=>{let[t,i]=useState(false);return jsxs("div",{"data-ndpr-component":"compliance-requirement-item",className:a$1("border-b border-gray-100 dark:border-gray-700 last:border-0 py-2",e==null?void 0:e.root,d),children:[jsxs("button",{type:"button",onClick:()=>!p&&i(u=>!u),className:a$1("w-full flex items-start gap-2 text-left group",e==null?void 0:e.row,d),"aria-expanded":p?void 0:t,"aria-disabled":p,children:[jsx("span",{className:a$1(["mt-0.5 flex-shrink-0 w-4 h-4 rounded-full flex items-center justify-center",p?"bg-green-500":n.severity==="critical"?"bg-red-500":n.severity==="important"?"bg-amber-500":"bg-blue-400"].join(" "),e==null?void 0:e.statusIcon,d),"aria-hidden":"true",children:p?jsx("svg",{className:"w-2.5 h-2.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}):jsx("svg",{className:"w-2.5 h-2.5 text-white",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18L18 6M6 6l12 12"})})}),jsxs("div",{className:"flex-1 min-w-0",children:[jsxs("div",{className:"flex items-center justify-between gap-1",children:[jsx("p",{className:a$1(`text-xs font-medium ${p?"ndpr-text-muted":"ndpr-text-foreground"}`,e==null?void 0:e.requirementLabel,d),children:n.requirement}),!p&&jsx("svg",{className:`flex-shrink-0 w-3 h-3 text-gray-400 transition-transform ${t?"rotate-180":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})]}),jsxs("p",{className:a$1("text-xs text-gray-400 dark:text-gray-500 mt-0.5",e==null?void 0:e.ndpaSection,d),children:["NDPA ",n.ndpaSection]})]})]}),!p&&t&&jsxs("div",{className:a$1("mt-2 ml-6 space-y-2",e==null?void 0:e.detail,d),children:[jsx("p",{className:a$1(`text-xs ${bt[n.severity]}`,e==null?void 0:e.message,d),children:n.message}),jsx("button",{type:"button",onClick:()=>{r(n.requirementId),i(false);},className:a$1("text-xs font-medium px-3 py-1 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded hover:bg-[rgb(var(--ndpr-primary-hover))]",e==null?void 0:e.fixButton,d),children:n.fixLabel})]})]})};function ft(n,p){let r=p.map(t=>({gap:{requirementId:t,requirement:t.split("-").map(i=>i.charAt(0).toUpperCase()+i.slice(1)).join(" "),ndpaSection:"\u2014",severity:"recommended",message:"",fixType:"fill_field",fixLabel:""},isPassed:true})),e=n.map(t=>({gap:t,isPassed:false})),d={critical:0,important:1,recommended:2};return e.sort((t,i)=>d[t.gap.severity]-d[i.gap.severity]),[...e,...r]}var Mr=({complianceResult:n,onFix:p,classNames:r,unstyled:e})=>{let[d,t]=useState(false),i=ft(n.gaps,n.passed);return jsxs("aside",{"data-ndpr-component":"compliance-checker-sidebar",className:a$1("bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden",r==null?void 0:r.root,e),"aria-label":"NDPA compliance checker",children:[jsxs("div",{className:a$1("flex items-center justify-between px-4 py-3 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-900/50",r==null?void 0:r.header,e),children:[jsx("h2",{className:a$1("ndpr-section-heading",r==null?void 0:r.title,e),children:"NDPA Compliance"}),jsx("button",{type:"button",onClick:()=>t(u=>!u),className:a$1("p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 rounded hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors",r==null?void 0:r.collapseButton,e),"aria-expanded":!d,"aria-label":d?"Expand compliance checker":"Collapse compliance checker",children:jsx("svg",{className:`w-4 h-4 transition-transform ${d?"-rotate-90":""}`,fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19 9l-7 7-7-7"})})})]}),!d&&jsxs("div",{className:a$1("p-4 space-y-4",r==null?void 0:r.body,e),children:[jsx("div",{className:a$1("flex justify-center",r==null?void 0:r.ringWrapper,e),children:jsx(Ir,{score:n.score,maxScore:n.maxScore,rating:n.rating,classNames:r,unstyled:e})}),jsx("div",{className:a$1("grid grid-cols-3 gap-2 text-center",r==null?void 0:r.statsRow,e),children:[{count:n.gaps.filter(u=>u.severity==="critical").length,label:"Critical",color:"ndpr-text-destructive"},{count:n.gaps.filter(u=>u.severity==="important").length,label:"Important",color:"ndpr-text-warning"},{count:n.passed.length,label:"Passed",color:"ndpr-text-success"}].map(({count:u,label:l,color:v})=>jsxs("div",{children:[jsx("p",{className:a$1(`text-base font-bold ${v}`,r==null?void 0:r.statValue,e),children:u}),jsx("p",{className:a$1("ndpr-form-field__hint",r==null?void 0:r.statLabel,e),children:l})]},l))}),jsx("div",{className:a$1("overflow-y-auto max-h-80",r==null?void 0:r.requirementsList,e),children:i.length===0?jsx("p",{className:a$1("ndpr-empty-state",r==null?void 0:r.emptyState,e),children:"No requirements to display."}):i.map(({gap:u,isPassed:l})=>jsx(_r,{gap:u,isPassed:l,onFix:p,classNames:r,unstyled:e},u.requirementId))})]})]})};function xt(n){let p=Date.now()-n;return p<1e4?"just now":p<6e4?`${Math.floor(p/1e3)}s ago`:p<36e5?`${Math.floor(p/6e4)}m ago`:new Date(n).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit"})}var zr=({lastSavedAt:n,isSaving:p,hasError:r,classNames:e,unstyled:d})=>{let t="idle";if(p?t="saving":r?t="error":n!==null&&(t="saved"),t==="idle")return null;let i=t==="saving"?"Saving\u2026":t==="error"?"Unable to save":`Draft saved ${n?xt(n):""}`;return jsxs("div",{"data-ndpr-component":"draft-save-indicator",role:"status","aria-live":"polite","aria-atomic":"true",className:a$1(`flex items-center gap-1.5 ${t==="error"?"text-red-500 dark:text-red-400":t==="saving"?"ndpr-card__subtitle":"ndpr-text-success"}`,e==null?void 0:e.root,d),children:[t==="saving"&&jsxs("svg",{className:"animate-spin w-3 h-3 flex-shrink-0",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4l3-3-3-3v4a10 10 0 100 10l-1.73-3A8 8 0 014 12z"})]}),t==="saved"&&jsx("svg",{className:"w-3 h-3 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:3,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5 13l4 4L19 7"})}),t==="error"&&jsx("svg",{className:"w-3 h-3 flex-shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,"aria-hidden":"true",children:jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v2m0 4h.01M10.29 3.86L1.82 18a2 2 0 001.71 3h16.94a2 2 0 001.71-3L13.71 3.86a2 2 0 00-3.42 0z"})}),jsx("span",{className:a$1("text-xs font-medium",e==null?void 0:e.text,d),children:i})]})};var _o=({adapter:n,onComplete:p,classNames:r,unstyled:e,initialContext:d$1})=>{var vr,br,lr;let t=c(),i=(vr=t.policy.wizardTitle)!=null?vr:"Privacy Policy Builder",u=(br=t.common.back)!=null?br:"Back",l=(lr=t.common.next)!=null?lr:"Next",{currentStep:v,nextStep:C,prevStep:g,canProceed:a$2,context:b,updateOrg:c$1,updateContext:m,toggleDataCategory:B,togglePurpose:J,addProcessor:Z,removeProcessor:or,sections:er,customSections:h,sectionOverrides:F,editSectionContent:ir,addCustomSection:jr,removeCustomSection:qr,reorderSections:Or,complianceResult:ar,applyFix:Hr,handleExportPDF:Wr,handleExportDOCX:Gr,handleExportHTML:Ur,handleExportMarkdown:Vr,lastSavedAt:Xr,isLoading:Yr}=a({adapter:n,onComplete:p,initialContext:d$1}),nr=(D,K)=>{let O=URL.createObjectURL(D),H=document.createElement("a");H.href=O,H.download=K,H.click(),URL.revokeObjectURL(O);},Jr=()=>d(null,null,function*(){let D=yield Wr();nr(D,"privacy-policy.pdf");}),Kr=()=>d(null,null,function*(){let D=yield Gr();nr(D,"privacy-policy.docx");}),Qr=()=>{let D=Ur();navigator.clipboard.writeText(D).catch(()=>{let K=new Blob([D],{type:"text/html"}),O=URL.createObjectURL(K),H=window.open(O,"_blank");H?H.addEventListener("load",()=>URL.revokeObjectURL(O)):URL.revokeObjectURL(O);});},Zr=()=>{let D=Vr();navigator.clipboard.writeText(D).catch(()=>{let K=new Blob([D],{type:"text/markdown"});nr(K,"privacy-policy.md");});};return Yr?jsxs("div",{"data-ndpr-component":"adaptive-policy-wizard",className:a$1("flex items-center justify-center min-h-64 text-gray-400 dark:text-gray-500",r==null?void 0:r.root,e),"aria-busy":"true","aria-label":"Loading policy wizard",children:[jsxs("svg",{className:"animate-spin w-6 h-6 mr-2",fill:"none",viewBox:"0 0 24 24","aria-hidden":"true",children:[jsx("circle",{className:"opacity-25",cx:"12",cy:"12",r:"10",stroke:"currentColor",strokeWidth:"4"}),jsx("path",{className:"opacity-75",fill:"currentColor",d:"M4 12a8 8 0 018-8v4l3-3-3-3v4a10 10 0 100 10l-1.73-3A8 8 0 014 12z"})]}),jsx("span",{className:"ndpr-text-sm",children:"Loading\u2026"})]}):jsx("div",{"data-ndpr-component":"adaptive-policy-wizard",className:a$1("min-h-screen bg-gray-50 dark:bg-gray-900",r==null?void 0:r.root,e),children:jsxs("div",{className:a$1("max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8",r==null?void 0:r.container,e),children:[jsxs("div",{className:a$1("flex items-center justify-between mb-6",r==null?void 0:r.topBar,e),children:[jsx("h1",{className:a$1("text-2xl font-bold ndpr-text-foreground",r==null?void 0:r.wizardTitle,e),children:i}),jsx(zr,{lastSavedAt:Xr,isSaving:false,hasError:false,classNames:r,unstyled:e})]}),jsx("div",{className:a$1("bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg px-4 mb-6",r==null?void 0:r.stepIndicatorWrapper,e),children:jsx(yr,{currentStep:v,classNames:r,unstyled:e})}),jsxs("div",{className:a$1("flex flex-col lg:flex-row gap-6 items-start",r==null?void 0:r.panels,e),children:[jsxs("main",{"aria-live":"polite",className:a$1("flex-1 min-w-0 bg-white dark:bg-gray-800 border border-gray-200 dark:border-gray-700 rounded-lg p-6",r==null?void 0:r.mainPanel,e),children:[v===1&&jsx(Cr,{context:b,onUpdateOrg:c$1,classNames:r,unstyled:e}),v===2&&jsx(kr,{categories:b.dataCategories,onToggle:B,classNames:r,unstyled:e}),v===3&&jsx(Pr,{context:b,onTogglePurpose:J,onUpdateContext:m,onAddProcessor:Z,onRemoveProcessor:or,classNames:r,unstyled:e}),v===4&&jsx(Ar,{sections:er,customSections:h,sectionOverrides:F,complianceResult:ar,onEditSection:ir,onAddCustomSection:jr,onRemoveCustomSection:qr,onReorderSection:Or,onExportPDF:Jr,onExportDOCX:Kr,onExportHTML:Qr,onExportMarkdown:Zr,classNames:r,unstyled:e}),jsxs("div",{className:a$1("flex items-center justify-between mt-8 pt-4 border-t border-gray-200 dark:border-gray-700",r==null?void 0:r.navigation,e),children:[jsx("button",{type:"button",onClick:g,disabled:v===1,className:a$1("px-4 py-2 bg-gray-200 dark:bg-gray-700 ndpr-text-foreground rounded-md text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed hover:bg-gray-300 dark:hover:bg-gray-600 transition-colors",r==null?void 0:r.backButton,e),children:u}),jsx("div",{className:"flex items-center gap-2",children:jsxs("span",{className:a$1("ndpr-form-field__hint",r==null?void 0:r.stepCounter,e),children:["Step ",v," of 4"]})}),v<4?jsx("button",{type:"button",onClick:C,disabled:!a$2,className:a$1("px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-[rgb(var(--ndpr-primary-foreground))] rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] text-sm font-medium disabled:opacity-40 disabled:cursor-not-allowed transition-colors",r==null?void 0:r.nextButton,e),children:l}):jsx("span",{})]})]}),jsx("aside",{className:a$1("w-full lg:w-80 flex-shrink-0",r==null?void 0:r.sidebarWrapper,e),children:jsx(Mr,{complianceResult:ar,onFix:Hr,classNames:r,unstyled:e})})]})]})})};
2
2
  export{_o as a};
@@ -1 +1 @@
1
- import {a}from'./chunk-YTU4FNM2.mjs';import {a as a$2}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-FRQFU44F.mjs';import {a as a$1,b}from'./chunk-ZJYULEER.mjs';import {useState,useRef,useEffect,useCallback}from'react';import {createPortal}from'react-dom';import {jsx,jsxs}from'react/jsx-runtime';var Vn=({options:d,onSave:bn,title:A,description:y,acceptAllButtonText:P,rejectAllButtonText:E,customizeButtonText:D,saveButtonText:z,position:pn="bottom",variant:a$3="bar",zIndex:x=9999,version:C="1.0",show:h,manageStorage:L=true,storageKey:w="ndpr_consent",className:V="",buttonClassName:j="",primaryButtonClassName:ln="",secondaryButtonClassName:fn="",classNames:n,unstyled:o,onAnalytics:k})=>{var U,X,Z,T,m,N,nn,tn,en;let c$1=c(),gn=(U=A!=null?A:c$1.consent.title)!=null?U:"We Value Your Privacy",vn=(X=y!=null?y:c$1.consent.description)!=null?X:"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.",_n=(Z=P!=null?P:c$1.consent.acceptAll)!=null?Z:"Accept All",Cn=(T=E!=null?E:c$1.consent.rejectAll)!=null?T:"Reject All",hn=(m=D!=null?D:c$1.consent.customize)!=null?m:"Customize",an=(N=z!=null?z:c$1.consent.savePreferences)!=null?N:"Save Preferences",kn=(nn=c$1.consent.selectAll)!=null?nn:"Select All",Sn=(tn=c$1.consent.deselectAll)!=null?tn:"Deselect All",[b$1,u]=useState(false),[f,I]=useState(false),[S,B]=useState({}),[s,Bn]=useState(false),Rn=a({active:b$1}),$=useRef(null),q=useRef(false);useEffect(()=>{Bn(true);},[]);let p=useCallback((t,e)=>{k==null||k(a$1({action:t,timestamp:Date.now(),version:C},e!==void 0?{categories:e}:{}));},[k,C]);useEffect(()=>{let t={};if(d.forEach(e=>{t[e.id]=e.defaultValue||false;}),B(t),h===void 0)if(!L)u(true);else {let e=localStorage.getItem(w);if(e)try{JSON.parse(e).version!==C?u(!0):u(!1);}catch(G){u(true);}else u(true);}else u(h);},[d,w,C,L]),useEffect(()=>{h!==void 0&&u(h);},[h]);let An=()=>{let t={};d.forEach(e=>{t[e.id]=true;}),p("accepted_all",t),H(t);},J=()=>{let t={};d.forEach(e=>{t[e.id]=e.required||false;}),p("rejected_all",t),H(t);},yn=(t,e)=>{B(G=>b(a$1({},G),{[t]:e}));},Pn=()=>{let t={};d.forEach(e=>{t[e.id]=true;}),B(t);},En=()=>{let t={};d.forEach(e=>{t[e.id]=e.required||false;}),B(t);},W=d.length>0&&d.every(t=>S[t.id]),Dn=()=>{p("customized",S),H(S);},H=t=>{let e={consents:t,timestamp:Date.now(),version:C,method:f?"customize":"banner",hasInteracted:true};L&&localStorage.setItem(w,JSON.stringify(e)),bn(e),u(false),I(false);};if(useEffect(()=>{if(!b$1)return;let t=e=>{e.key==="Escape"&&(p("dismissed"),J());};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[b$1,p,d,f]),useEffect(()=>{b$1&&!q.current&&(q.current=true,p("shown")),b$1||(q.current=false);},[b$1,p]),useEffect(()=>{if(f&&$.current){let t=$.current;t.style.maxHeight="0px",t.style.opacity="0",t.offsetHeight,t.style.maxHeight=`${t.scrollHeight}px`,t.style.opacity="1";}},[f]),!b$1)return null;let g=a$3==="modal"?"center":pn,Y=g==="inline",O=g==="center",v=["ndpr-consent-banner"];a$3!=="bar"&&v.push(`ndpr-consent-banner--${a$3}`),g==="top"?v.push("ndpr-consent-banner--top"):g==="bottom"?v.push("ndpr-consent-banner--bottom"):g==="inline"&&v.push("ndpr-consent-banner--inline"),V&&v.push(V);let zn=v.join(" "),K=`ndpr-consent-banner__button ndpr-consent-banner__button--primary ${j} ${ln}`.trim(),Ln=`ndpr-consent-banner__button ndpr-consent-banner__button--secondary ${j} ${fn}`.trim(),wn=`ndpr-consent-banner__button ndpr-consent-banner__button--ghost ${j}`.trim(),jn=(n==null?void 0:n.primaryButton)||(n==null?void 0:n.acceptButton)||K,Q=(n==null?void 0:n.secondaryButton)||(n==null?void 0:n.rejectButton)||Ln,In=(n==null?void 0:n.customizeButton)||wn,$n=(n==null?void 0:n.saveButton)||K,F=jsx("div",{ref:Rn,tabIndex:-1,"data-ndpr-component":"consent-banner","data-ndpr-variant":a$3,"data-ndpr-position":g,className:a$2(zn,n==null?void 0:n.root,o),style:!Y&&!O?{zIndex:x}:void 0,role:"dialog","aria-modal":O||void 0,"aria-labelledby":"consent-banner-title","aria-describedby":"consent-banner-description",children:jsxs("div",{className:a$2("ndpr-consent-banner__container",n==null?void 0:n.container,o),children:[jsx("h2",{id:"consent-banner-title",className:a$2("ndpr-consent-banner__title",n==null?void 0:n.title,o),children:gn}),jsx("p",{id:"consent-banner-description",className:a$2("ndpr-consent-banner__description",n==null?void 0:n.description,o),children:vn}),f&&jsxs("div",{ref:$,className:a$2("ndpr-consent-banner__customize-panel",n==null?void 0:n.customizePanel,o),children:[jsx("div",{className:o?"":"ndpr-consent-banner__select-all-row",children:jsx("button",{type:"button",onClick:W?En:Pn,className:a$2("ndpr-consent-banner__select-all-button",n==null?void 0:n.selectAllButton,o),children:W?Sn:kn})}),jsx("div",{className:a$2("ndpr-consent-banner__options-list",n==null?void 0:n.optionsList,o),children:d.map(t=>jsxs("div",{className:a$2("ndpr-consent-banner__option",n==null?void 0:n.optionItem,o),children:[jsx("input",{id:`consent-${t.id}`,type:"checkbox",checked:S[t.id]||false,onChange:e=>yn(t.id,e.target.checked),disabled:t.required,className:a$2("ndpr-consent-banner__option-checkbox",n==null?void 0:n.optionCheckbox,o)}),jsxs("div",{className:o?"":"ndpr-consent-banner__option-text",children:[jsxs("label",{htmlFor:`consent-${t.id}`,className:a$2("ndpr-consent-banner__option-label",n==null?void 0:n.optionLabel,o),children:[t.label,t.required&&jsx("span",{className:o?"":"ndpr-consent-banner__required-marker",children:" *"})]}),jsx("p",{className:a$2("ndpr-consent-banner__option-description",n==null?void 0:n.optionDescription,o),children:t.description})]})]},t.id))}),jsxs("div",{className:a$2("ndpr-consent-banner__buttons",n==null?void 0:n.buttonGroup,o),children:[jsx("button",{onClick:Dn,className:a$2($n,n==null?void 0:n.saveButton,o),children:an}),jsx("button",{onClick:()=>I(false),className:a$2(Q,n==null?void 0:n.rejectButton,o),children:(en=c$1.common.back)!=null?en:"Back"})]})]}),!f&&jsxs("div",{className:a$2("ndpr-consent-banner__buttons",n==null?void 0:n.buttonGroup,o),children:[jsx("button",{onClick:An,className:a$2(jn,n==null?void 0:n.acceptButton,o),children:_n}),jsx("button",{onClick:J,className:a$2(Q,n==null?void 0:n.rejectButton,o),children:Cn}),jsx("button",{onClick:()=>I(true),className:a$2(In,n==null?void 0:n.customizeButton,o),children:hn})]}),jsx("div",{className:a$2("ndpr-consent-banner__footer-text",void 0,o),children:'By clicking "Accept All", you agree to the use of ALL cookies. Visit our Cookie Policy to learn more.'})]})});if(Y)return F;if(O){let t=jsx("div",{className:o?"":"ndpr-consent-banner__overlay",style:{zIndex:x},children:F});return s?createPortal(t,document.body):null}return s?createPortal(F,document.body):null};export{Vn as a};
1
+ import {a}from'./chunk-YTU4FNM2.mjs';import {a as a$2}from'./chunk-SFGW37LE.mjs';import {c}from'./chunk-PHA3YMFO.mjs';import {a as a$1,b}from'./chunk-ZJYULEER.mjs';import {useState,useRef,useEffect,useCallback}from'react';import {createPortal}from'react-dom';import {jsx,jsxs}from'react/jsx-runtime';var Vn=({options:d,onSave:bn,title:A,description:y,acceptAllButtonText:P,rejectAllButtonText:E,customizeButtonText:D,saveButtonText:z,position:pn="bottom",variant:a$3="bar",zIndex:x=9999,version:C="1.0",show:h,manageStorage:L=true,storageKey:w="ndpr_consent",className:V="",buttonClassName:j="",primaryButtonClassName:ln="",secondaryButtonClassName:fn="",classNames:n,unstyled:o,onAnalytics:k})=>{var U,X,Z,T,m,N,nn,tn,en;let c$1=c(),gn=(U=A!=null?A:c$1.consent.title)!=null?U:"We Value Your Privacy",vn=(X=y!=null?y:c$1.consent.description)!=null?X:"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.",_n=(Z=P!=null?P:c$1.consent.acceptAll)!=null?Z:"Accept All",Cn=(T=E!=null?E:c$1.consent.rejectAll)!=null?T:"Reject All",hn=(m=D!=null?D:c$1.consent.customize)!=null?m:"Customize",an=(N=z!=null?z:c$1.consent.savePreferences)!=null?N:"Save Preferences",kn=(nn=c$1.consent.selectAll)!=null?nn:"Select All",Sn=(tn=c$1.consent.deselectAll)!=null?tn:"Deselect All",[b$1,u]=useState(false),[f,I]=useState(false),[S,B]=useState({}),[s,Bn]=useState(false),Rn=a({active:b$1}),$=useRef(null),q=useRef(false);useEffect(()=>{Bn(true);},[]);let p=useCallback((t,e)=>{k==null||k(a$1({action:t,timestamp:Date.now(),version:C},e!==void 0?{categories:e}:{}));},[k,C]);useEffect(()=>{let t={};if(d.forEach(e=>{t[e.id]=e.defaultValue||false;}),B(t),h===void 0)if(!L)u(true);else {let e=localStorage.getItem(w);if(e)try{JSON.parse(e).version!==C?u(!0):u(!1);}catch(G){u(true);}else u(true);}else u(h);},[d,w,C,L]),useEffect(()=>{h!==void 0&&u(h);},[h]);let An=()=>{let t={};d.forEach(e=>{t[e.id]=true;}),p("accepted_all",t),H(t);},J=()=>{let t={};d.forEach(e=>{t[e.id]=e.required||false;}),p("rejected_all",t),H(t);},yn=(t,e)=>{B(G=>b(a$1({},G),{[t]:e}));},Pn=()=>{let t={};d.forEach(e=>{t[e.id]=true;}),B(t);},En=()=>{let t={};d.forEach(e=>{t[e.id]=e.required||false;}),B(t);},W=d.length>0&&d.every(t=>S[t.id]),Dn=()=>{p("customized",S),H(S);},H=t=>{let e={consents:t,timestamp:Date.now(),version:C,method:f?"customize":"banner",hasInteracted:true};L&&localStorage.setItem(w,JSON.stringify(e)),bn(e),u(false),I(false);};if(useEffect(()=>{if(!b$1)return;let t=e=>{e.key==="Escape"&&(p("dismissed"),J());};return document.addEventListener("keydown",t),()=>document.removeEventListener("keydown",t)},[b$1,p,d,f]),useEffect(()=>{b$1&&!q.current&&(q.current=true,p("shown")),b$1||(q.current=false);},[b$1,p]),useEffect(()=>{if(f&&$.current){let t=$.current;t.style.maxHeight="0px",t.style.opacity="0",t.offsetHeight,t.style.maxHeight=`${t.scrollHeight}px`,t.style.opacity="1";}},[f]),!b$1)return null;let g=a$3==="modal"?"center":pn,Y=g==="inline",O=g==="center",v=["ndpr-consent-banner"];a$3!=="bar"&&v.push(`ndpr-consent-banner--${a$3}`),g==="top"?v.push("ndpr-consent-banner--top"):g==="bottom"?v.push("ndpr-consent-banner--bottom"):g==="inline"&&v.push("ndpr-consent-banner--inline"),V&&v.push(V);let zn=v.join(" "),K=`ndpr-consent-banner__button ndpr-consent-banner__button--primary ${j} ${ln}`.trim(),Ln=`ndpr-consent-banner__button ndpr-consent-banner__button--secondary ${j} ${fn}`.trim(),wn=`ndpr-consent-banner__button ndpr-consent-banner__button--ghost ${j}`.trim(),jn=(n==null?void 0:n.primaryButton)||(n==null?void 0:n.acceptButton)||K,Q=(n==null?void 0:n.secondaryButton)||(n==null?void 0:n.rejectButton)||Ln,In=(n==null?void 0:n.customizeButton)||wn,$n=(n==null?void 0:n.saveButton)||K,F=jsx("div",{ref:Rn,tabIndex:-1,"data-ndpr-component":"consent-banner","data-ndpr-variant":a$3,"data-ndpr-position":g,className:a$2(zn,n==null?void 0:n.root,o),style:!Y&&!O?{zIndex:x}:void 0,role:"dialog","aria-modal":O||void 0,"aria-labelledby":"consent-banner-title","aria-describedby":"consent-banner-description",children:jsxs("div",{className:a$2("ndpr-consent-banner__container",n==null?void 0:n.container,o),children:[jsx("h2",{id:"consent-banner-title",className:a$2("ndpr-consent-banner__title",n==null?void 0:n.title,o),children:gn}),jsx("p",{id:"consent-banner-description",className:a$2("ndpr-consent-banner__description",n==null?void 0:n.description,o),children:vn}),f&&jsxs("div",{ref:$,className:a$2("ndpr-consent-banner__customize-panel",n==null?void 0:n.customizePanel,o),children:[jsx("div",{className:o?"":"ndpr-consent-banner__select-all-row",children:jsx("button",{type:"button",onClick:W?En:Pn,className:a$2("ndpr-consent-banner__select-all-button",n==null?void 0:n.selectAllButton,o),children:W?Sn:kn})}),jsx("div",{className:a$2("ndpr-consent-banner__options-list",n==null?void 0:n.optionsList,o),children:d.map(t=>jsxs("div",{className:a$2("ndpr-consent-banner__option",n==null?void 0:n.optionItem,o),children:[jsx("input",{id:`consent-${t.id}`,type:"checkbox",checked:S[t.id]||false,onChange:e=>yn(t.id,e.target.checked),disabled:t.required,className:a$2("ndpr-consent-banner__option-checkbox",n==null?void 0:n.optionCheckbox,o)}),jsxs("div",{className:o?"":"ndpr-consent-banner__option-text",children:[jsxs("label",{htmlFor:`consent-${t.id}`,className:a$2("ndpr-consent-banner__option-label",n==null?void 0:n.optionLabel,o),children:[t.label,t.required&&jsx("span",{className:o?"":"ndpr-consent-banner__required-marker",children:" *"})]}),jsx("p",{className:a$2("ndpr-consent-banner__option-description",n==null?void 0:n.optionDescription,o),children:t.description})]})]},t.id))}),jsxs("div",{className:a$2("ndpr-consent-banner__buttons",n==null?void 0:n.buttonGroup,o),children:[jsx("button",{onClick:Dn,className:a$2($n,n==null?void 0:n.saveButton,o),children:an}),jsx("button",{onClick:()=>I(false),className:a$2(Q,n==null?void 0:n.rejectButton,o),children:(en=c$1.common.back)!=null?en:"Back"})]})]}),!f&&jsxs("div",{className:a$2("ndpr-consent-banner__buttons",n==null?void 0:n.buttonGroup,o),children:[jsx("button",{onClick:An,className:a$2(jn,n==null?void 0:n.acceptButton,o),children:_n}),jsx("button",{onClick:J,className:a$2(Q,n==null?void 0:n.rejectButton,o),children:Cn}),jsx("button",{onClick:()=>I(true),className:a$2(In,n==null?void 0:n.customizeButton,o),children:hn})]}),jsx("div",{className:a$2("ndpr-consent-banner__footer-text",void 0,o),children:'By clicking "Accept All", you agree to the use of ALL cookies. Visit our Cookie Policy to learn more.'})]})});if(Y)return F;if(O){let t=jsx("div",{className:o?"":"ndpr-consent-banner__overlay",style:{zIndex:x},children:F});return s?createPortal(t,document.body):null}return s?createPortal(F,document.body):null};export{Vn as a};
@@ -1 +1 @@
1
- 'use strict';var chunkTTMGFC6C_js=require('./chunk-TTMGFC6C.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var p=react.createContext({}),l=class extends react.Component{constructor(e){super(e);this.reset=()=>{this.setState({error:null});};this.state={error:null};}static getDerivedStateFromError(e){return {error:e}}componentDidCatch(e,r){var o,n;(n=(o=this.props).onError)==null||n.call(o,e,r);}render(){var r;let{error:e}=this.state;if(e){let{fallback:o}=this.props;return typeof o=="function"?o(e,this.reset):o!==void 0?o:jsxRuntime.jsxs("div",{role:"alert",style:{padding:"16px",border:"1px solid #e53e3e",borderRadius:"4px",backgroundColor:"#fff5f5",color:"#c53030"},children:[jsxRuntime.jsx("h3",{style:{margin:"0 0 8px 0",fontSize:"16px"},children:(r=this.props.errorTitle)!=null?r:"Something went wrong"}),jsxRuntime.jsx("p",{style:{margin:0,fontSize:"14px"},children:e.message})]})}return this.props.children}},x=o=>{var n=o,{children:t,fallback:c,onError:e}=n,r=chunkRFPLZDIO_js.c(n,["children","fallback","onError"]);var u;let m=react.useMemo(()=>{if(!r.theme)return;let i={};return r.theme.primary&&(i["--ndpr-primary"]=r.theme.primary),r.theme.primaryHover&&(i["--ndpr-primary-hover"]=r.theme.primaryHover),r.theme.primaryForeground&&(i["--ndpr-primary-foreground"]=r.theme.primaryForeground),Object.keys(i).length>0?i:void 0},[r.theme]),y=(u=react.useMemo(()=>chunkTTMGFC6C_js.b(r.locale),[r.locale]).common.error)!=null?u:"Something went wrong";return jsxRuntime.jsx(p.Provider,{value:r,children:jsxRuntime.jsx(l,{fallback:c,onError:e,errorTitle:y,children:m?jsxRuntime.jsx("div",{style:m,children:t}):t})})};function C(){return react.useContext(p)}function S(){let{locale:t}=react.useContext(p);return react.useMemo(()=>chunkTTMGFC6C_js.b(t),[t])}exports.a=x;exports.b=C;exports.c=S;
1
+ 'use strict';var chunk7563FVMY_js=require('./chunk-7563FVMY.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var p=react.createContext({}),l=class extends react.Component{constructor(e){super(e);this.reset=()=>{this.setState({error:null});};this.state={error:null};}static getDerivedStateFromError(e){return {error:e}}componentDidCatch(e,r){var o,n;(n=(o=this.props).onError)==null||n.call(o,e,r);}render(){var r;let{error:e}=this.state;if(e){let{fallback:o}=this.props;return typeof o=="function"?o(e,this.reset):o!==void 0?o:jsxRuntime.jsxs("div",{role:"alert",style:{padding:"16px",border:"1px solid #e53e3e",borderRadius:"4px",backgroundColor:"#fff5f5",color:"#c53030"},children:[jsxRuntime.jsx("h3",{style:{margin:"0 0 8px 0",fontSize:"16px"},children:(r=this.props.errorTitle)!=null?r:"Something went wrong"}),jsxRuntime.jsx("p",{style:{margin:0,fontSize:"14px"},children:e.message})]})}return this.props.children}},x=o=>{var n=o,{children:t,fallback:c,onError:e}=n,r=chunkRFPLZDIO_js.c(n,["children","fallback","onError"]);var u;let m=react.useMemo(()=>{if(!r.theme)return;let i={};return r.theme.primary&&(i["--ndpr-primary"]=r.theme.primary),r.theme.primaryHover&&(i["--ndpr-primary-hover"]=r.theme.primaryHover),r.theme.primaryForeground&&(i["--ndpr-primary-foreground"]=r.theme.primaryForeground),Object.keys(i).length>0?i:void 0},[r.theme]),y=(u=react.useMemo(()=>chunk7563FVMY_js.b(r.locale),[r.locale]).common.error)!=null?u:"Something went wrong";return jsxRuntime.jsx(p.Provider,{value:r,children:jsxRuntime.jsx(l,{fallback:c,onError:e,errorTitle:y,children:m?jsxRuntime.jsx("div",{style:m,children:t}):t})})};function C(){return react.useContext(p)}function S(){let{locale:t}=react.useContext(p);return react.useMemo(()=>chunk7563FVMY_js.b(t),[t])}exports.a=x;exports.b=C;exports.c=S;