@tantainnovative/ndpr-toolkit 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +412 -0
- package/dist/components/breach/BreachNotificationManager.d.ts +62 -0
- package/dist/components/breach/BreachReportForm.d.ts +66 -0
- package/dist/components/breach/BreachRiskAssessment.d.ts +50 -0
- package/dist/components/breach/RegulatoryReportGenerator.d.ts +94 -0
- package/dist/components/consent/ConsentBanner.d.ts +79 -0
- package/dist/components/consent/ConsentManager.d.ts +73 -0
- package/dist/components/consent/ConsentStorage.d.ts +41 -0
- package/dist/components/dpia/DPIAQuestionnaire.d.ts +70 -0
- package/dist/components/dpia/DPIAReport.d.ts +40 -0
- package/dist/components/dpia/StepIndicator.d.ts +64 -0
- package/dist/components/dsr/DSRDashboard.d.ts +58 -0
- package/dist/components/dsr/DSRRequestForm.d.ts +74 -0
- package/dist/components/dsr/DSRTracker.d.ts +56 -0
- package/dist/components/policy/PolicyExporter.d.ts +65 -0
- package/dist/components/policy/PolicyGenerator.d.ts +54 -0
- package/dist/components/policy/PolicyPreview.d.ts +71 -0
- package/dist/hooks/useBreach.d.ts +97 -0
- package/dist/hooks/useConsent.d.ts +63 -0
- package/dist/hooks/useDPIA.d.ts +92 -0
- package/dist/hooks/useDSR.d.ts +72 -0
- package/dist/hooks/usePrivacyPolicy.d.ts +87 -0
- package/dist/index.d.ts +31 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/setupTests.d.ts +2 -0
- package/dist/types/breach.d.ts +239 -0
- package/dist/types/consent.d.ts +95 -0
- package/dist/types/dpia.d.ts +196 -0
- package/dist/types/dsr.d.ts +162 -0
- package/dist/types/privacy.d.ts +204 -0
- package/dist/utils/breach.d.ts +14 -0
- package/dist/utils/consent.d.ts +10 -0
- package/dist/utils/dpia.d.ts +12 -0
- package/dist/utils/dsr.d.ts +11 -0
- package/dist/utils/privacy.d.ts +12 -0
- package/package.json +71 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var a=r(t),s=function(){return s=Object.assign||function(e){for(var t,r=1,a=arguments.length;r<a;r++)for(var s in t=arguments[r])Object.prototype.hasOwnProperty.call(t,s)&&(e[s]=t[s]);return e},s.apply(this,arguments)};function n(e,t,r,a){return new(r||(r=Promise))((function(s,n){function i(e){try{d(a.next(e))}catch(e){n(e)}}function o(e){try{d(a.throw(e))}catch(e){n(e)}}function d(e){var t;e.done?s(e.value):(t=e.value,t instanceof r?t:new r((function(e){e(t)}))).then(i,o)}d((a=a.apply(e,t||[])).next())}))}function i(e,t){var r,a,s,n={label:0,sent:function(){if(1&s[0])throw s[1];return s[1]},trys:[],ops:[]},i=Object.create(("function"==typeof Iterator?Iterator:Object).prototype);return i.next=o(0),i.throw=o(1),i.return=o(2),"function"==typeof Symbol&&(i[Symbol.iterator]=function(){return this}),i;function o(o){return function(d){return function(o){if(r)throw new TypeError("Generator is already executing.");for(;i&&(i=0,o[0]&&(n=0)),n;)try{if(r=1,a&&(s=2&o[0]?a.return:o[0]?a.throw||((s=a.return)&&s.call(a),0):a.next)&&!(s=s.call(a,o[1])).done)return s;switch(a=0,s&&(o=[2&o[0],s.value]),o[0]){case 0:case 1:s=o;break;case 4:return n.label++,{value:o[1],done:!1};case 5:n.label++,a=o[1],o=[0];continue;case 7:o=n.ops.pop(),n.trys.pop();continue;default:if(!(s=n.trys,(s=s.length>0&&s[s.length-1])||6!==o[0]&&2!==o[0])){n=0;continue}if(3===o[0]&&(!s||o[1]>s[0]&&o[1]<s[3])){n.label=o[1];break}if(6===o[0]&&n.label<s[1]){n.label=s[1],s=o;break}if(s&&n.label<s[2]){n.label=s[2],n.ops.push(o);break}s[2]&&n.ops.pop(),n.trys.pop();continue}o=t.call(e,n)}catch(e){o=[6,e],a=0}finally{r=s=0}if(5&o[0])throw o[1];return{value:o[0]?o[1]:void 0,done:!0}}([o,d])}}}function o(e,t,r){if(r||2===arguments.length)for(var a,s=0,n=t.length;s<n;s++)!a&&s in t||(a||(a=Array.prototype.slice.call(t,0,s)),a[s]=t[s]);return e.concat(a||Array.prototype.slice.call(t))}"function"==typeof SuppressedError&&SuppressedError;function d(e){var t,r,a=[];return e.id||a.push("Request ID is required"),e.type||a.push("Request type is required"),e.status||a.push("Request status is required"),e.createdAt||a.push("Creation timestamp is required"),(null===(t=e.subject)||void 0===t?void 0:t.name)||a.push("Data subject name is required"),(null===(r=e.subject)||void 0===r?void 0:r.email)||a.push("Data subject email is required"),{formattedRequest:{requestId:e.id,requestType:e.type,status:e.status,createdDate:new Date(e.createdAt).toISOString(),lastUpdated:e.updatedAt?new Date(e.updatedAt).toISOString():void 0,dueDate:e.dueDate?new Date(e.dueDate).toISOString():void 0,dataSubject:{name:e.subject.name,email:e.subject.email,phone:e.subject.phone||"Not provided",identifier:{type:e.subject.identifierType||"Not specified",value:e.subject.identifierValue||"Not provided"}},additionalInformation:e.additionalInfo||{},verificationStatus:e.verification?"".concat(e.verification.verified?"Verified":"Not verified").concat(e.verification.method?" via ".concat(e.verification.method):""):"Pending verification",attachments:e.attachments?e.attachments.map((function(e){return{name:e.name,type:e.type,addedOn:new Date(e.addedAt).toISOString()}})):[]},isValid:0===a.length,validationErrors:a}}function l(e,t){if(t){return{severityLevel:t.riskLevel,notificationRequired:t.risksToRightsAndFreedoms,urgentNotificationRequired:t.highRisksToRightsAndFreedoms,timeframeHours:72,justification:t.justification||"Based on risk assessment results"}}var r,a={ongoing:"ongoing"===e.status,sensitiveData:["health","financial","biometric","children","location","religious","political","ethnic"].some((function(t){return e.dataTypes.includes(t)})),largeScale:(e.estimatedAffectedSubjects||0)>1e3,delayedDiscovery:e.occurredAt&&e.discoveredAt-e.occurredAt>6048e5},s=Object.values(a).filter(Boolean).length,n="low"!==(r=0===s?"low":1===s?"medium":2===s?"high":"critical"),i="high"===r||"critical"===r,o=Object.entries(a).filter((function(e){return e[0],e[1]})).map((function(e){var t=e[0];return e[1],t})).join(", "),d="";return"low"===r?d="Low risk due to minimal data exposure and effective containment":"medium"===r?d=a.ongoing?"Medium risk due to personal data exposure (ongoing: ".concat(a.ongoing,")"):"Medium risk due to personal data exposure":"high"===r?d="High risk due to sensitive financial data":"critical"===r&&(d="Critical risk due to large-scale sensitive data exposure"),!o||"medium"!==r&&"high"!==r&&"critical"!==r||d.includes(o)||(d+=" (factors: ".concat(o,")")),{severityLevel:r,notificationRequired:n,urgentNotificationRequired:i,timeframeHours:72,justification:d}}function c(e,t){if("string"==typeof e){for(var r=e,a=t,s=r,n=/\{\{([^}]+)\}\}/g,i=void 0;null!==(i=n.exec(r));){var o=i[1].trim(),d=a[o]||"";s=s.replace(new RegExp("\\{\\{\\s*".concat(o,"\\s*\\}\\}"),"g"),d)}return s}var l=t,c={},u=[];return e.filter((function(e){return e.included})).sort((function(e,t){return(e.order||0)-(t.order||0)})).forEach((function(e){for(var t,r=e.template||e.customContent||e.defaultContent||"",a=/\{\{([^}]+)\}\}/g,s=[];null!==(t=a.exec(r));)s.push(t[1].trim());s.forEach((function(e){var t="";e in l&&(t=l[e]||""),t||u.push(e),r=r.replace(new RegExp("\\{\\{\\s*".concat(e,"\\s*\\}\\}"),"g"),t)})),c[e.id]=r})),{fullText:Object.values(c).join("\n\n"),sectionTexts:c,missingVariables:Array.from(new Set(u))}}function u(e){var t=[];e.consents&&0!==Object.keys(e.consents).length||t.push("Consent settings must include at least one consent option"),e.timestamp?("number"!=typeof e.timestamp||isNaN(e.timestamp))&&t.push("Consent timestamp must be a valid number"):t.push("Consent timestamp is required"),e.version||t.push("Consent version is required"),e.method||t.push("Consent collection method is required"),void 0===e.hasInteracted&&t.push("User interaction status is required");var r=Date.now()-33696e6;return e.timestamp<r&&t.push("Consent is older than 13 months and should be refreshed"),{valid:0===t.length,errors:t}}function m(e){var t,r={low:0,medium:0,high:0,critical:0},a=0,s=[];e.risks.forEach((function(e){r[e.level]++,e.score>a&&(a=e.score),"high"!==e.level&&"critical"!==e.level||e.mitigated||s.push(e)}));var n="high"===(t=r.critical>0?"critical":r.high>2||r.high>0&&r.medium>3?"high":r.high>0||r.medium>1?"medium":"low")||"critical"===t,i=0===s.length,o=[];return s.length>0&&o.push("Mitigate the following high/critical risks before proceeding: ".concat(s.map((function(e){return e.description})).join(", "))),n&&o.push("Consult with NITDA before proceeding with this processing activity, as required by NDPR for high-risk processing."),r.medium>0&&o.push("Implement additional safeguards to reduce medium-level risks where possible."),"low"!==t?o.push("Schedule a review of this DPIA in 6 months to reassess risks and effectiveness of mitigation measures."):o.push("Schedule a review of this DPIA in 12 months as part of regular compliance activities."),{overallRiskLevel:t,requiresConsultation:n,canProceed:i,recommendations:o}}exports.BreachNotificationManager=function(r){var a=r.breachReports,n=r.riskAssessments,i=r.regulatoryNotifications,d=r.onSelectBreach,c=r.onRequestAssessment,u=r.onRequestNotification,m=r.title,x=void 0===m?"Breach Notification Manager":m,h=r.description,g=void 0===h?"Manage data breach notifications and track compliance with NDPR requirements.":h,p=r.className,f=void 0===p?"":p,b=r.buttonClassName,v=void 0===b?"":b,y=r.showBreachDetails,j=void 0===y||y,N=r.showNotificationTimeline,k=void 0===N||N,w=r.showDeadlineAlerts,S=void 0===w||w,D=t.useState(null),A=D[0],R=D[1],C=t.useState(a),q=C[0],I=C[1],T=t.useState("all"),P=T[0],E=T[1],F=t.useState(""),L=F[0],O=F[1],B=t.useState("discoveredAt"),U=B[0],V=B[1],M=t.useState("desc"),z=M[0];M[1],t.useEffect((function(){var e=o([],a,!0);if("all"!==P&&(e=e.filter((function(e){return e.status===P}))),L){var t=L.toLowerCase();e=e.filter((function(e){return e.title.toLowerCase().includes(t)||e.description.toLowerCase().includes(t)||e.affectedSystems.some((function(e){return e.toLowerCase().includes(t)}))||e.dataTypes.some((function(e){return e.toLowerCase().includes(t)}))}))}e.sort((function(e,t){var r=0;switch(U){case"title":r=e.title.localeCompare(t.title);break;case"discoveredAt":default:r=e.discoveredAt-t.discoveredAt;break;case"status":r=e.status.localeCompare(t.status);break;case"riskLevel":var a=n.find((function(t){return t.breachId===e.id})),s=n.find((function(e){return e.breachId===t.id})),i=(null==a?void 0:a.riskLevel)||"unknown",o=(null==s?void 0:s.riskLevel)||"unknown";r=i.localeCompare(o)}return"asc"===z?r:-r})),I(e)}),[a,P,L,U,z,n]),t.useEffect((function(){q.length>0&&!A&&R(q[0].id)}),[q,A]);var _=function(e){return new Date(e).toLocaleString()},H=A?a.find((function(e){return e.id===A})):null,J=A?n.find((function(e){return e.breachId===A})):null,W=A?i.find((function(e){return e.breachId===A})):null,G=H?Y(H,J):null;function Y(e,t){var r=l(e,t||void 0),a=e.discoveredAt+60*r.timeframeHours*60*1e3;return{nitdaNotificationRequired:r.notificationRequired,nitdaNotificationDeadline:a,dataSubjectNotificationRequired:(null==t?void 0:t.highRisksToRightsAndFreedoms)||!1,justification:r.justification}}function K(e){var t=Date.now();return Number(((e-t)/36e5).toFixed(1))}var Q=function(t){if(!t)return null;return e.jsx("span",s({className:"px-2 py-1 rounded text-xs font-medium ".concat({low:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",medium:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",high:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",critical:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}[t])},{children:t.charAt(0).toUpperCase()+t.slice(1)}))},$=function(t){return e.jsx("span",s({className:"px-2 py-1 rounded text-xs font-medium ".concat({ongoing:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",contained:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",resolved:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200"}[t]||"bg-gray-100 text-gray-800 dark:bg-gray-900 dark:text-gray-200")},{children:t.charAt(0).toUpperCase()+t.slice(1)}))};return e.jsxs("div",s({className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ".concat(f)},{children:[e.jsx("h2",s({className:"text-xl font-bold mb-2"},{children:x})),e.jsx("p",s({className:"mb-6 text-gray-600 dark:text-gray-300"},{children:g})),e.jsxs("div",s({className:"mb-6 grid grid-cols-1 md:grid-cols-3 gap-4"},{children:[e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"statusFilter",className:"block text-sm font-medium mb-1"},{children:"Status Filter"})),e.jsxs("select",s({id:"statusFilter",value:P,onChange:function(e){return E(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},{children:[e.jsx("option",s({value:"all"},{children:"All Statuses"})),e.jsx("option",s({value:"ongoing"},{children:"Ongoing"})),e.jsx("option",s({value:"contained"},{children:"Contained"})),e.jsx("option",s({value:"resolved"},{children:"Resolved"}))]}))]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"sortBy",className:"block text-sm font-medium mb-1"},{children:"Sort By"})),e.jsxs("select",s({id:"sortBy",value:U,onChange:function(e){return V(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},{children:[e.jsx("option",s({value:"discoveredAt"},{children:"Discovery Date"})),e.jsx("option",s({value:"title"},{children:"Title"})),e.jsx("option",s({value:"status"},{children:"Status"})),e.jsx("option",s({value:"riskLevel"},{children:"Risk Level"}))]}))]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"searchTerm",className:"block text-sm font-medium mb-1"},{children:"Search"})),e.jsx("input",{type:"text",id:"searchTerm",value:L,onChange:function(e){return O(e.target.value)},placeholder:"Search breaches...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]})),e.jsxs("div",s({className:"grid grid-cols-1 md:grid-cols-3 gap-6"},{children:[e.jsxs("div",s({className:"md:col-span-1"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-3"},{children:"Breach Reports"})),0===q.length?e.jsx("p",s({className:"text-gray-500 dark:text-gray-400 text-sm"},{children:"No breach reports found."})):e.jsx("div",s({className:"space-y-2 max-h-96 overflow-y-auto pr-2"},{children:q.map((function(t){var r=n.find((function(e){return e.breachId===t.id})),a=i.find((function(e){return e.breachId===t.id})),o=Y(t,r),l=null;if(null==o?void 0:o.nitdaNotificationRequired)if(a)l=e.jsx("span",s({className:"text-xs text-green-600 dark:text-green-400"},{children:"Notified"}));else{var c=K(o.nitdaNotificationDeadline);l=c<=0?e.jsx("span",s({className:"text-xs text-red-600 dark:text-red-400 font-bold"},{children:"Overdue"})):c<=24?e.jsx("span",s({className:"text-xs text-red-600 dark:text-red-400"},{children:"Urgent"})):e.jsx("span",s({className:"text-xs text-yellow-600 dark:text-yellow-400"},{children:"Required"}))}else l=e.jsx("span",s({className:"text-xs text-green-600 dark:text-green-400"},{children:"Not Required"}));return e.jsxs("div",s({className:"p-3 rounded-md cursor-pointer ".concat(A===t.id?"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800":"bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600"),onClick:function(){return e=t.id,R(e),void(d&&d(e));var e}},{children:[e.jsxs("div",s({className:"flex justify-between items-start mb-1"},{children:[e.jsx("h4",s({className:"font-medium text-sm"},{children:t.title})),$(t.status)]})),e.jsxs("p",s({className:"text-xs text-gray-500 dark:text-gray-400 mb-1"},{children:["Discovered: ",new Date(t.discoveredAt).toLocaleDateString()]})),e.jsxs("div",s({className:"flex justify-between items-center mt-2"},{children:[e.jsx("div",{children:r&&Q(r.riskLevel)}),e.jsx("div",{children:l})]}))]}),t.id)}))}))]})),e.jsx("div",s({className:"md:col-span-2"},{children:H?e.jsxs("div",{children:[e.jsxs("div",s({className:"flex justify-between items-start mb-4"},{children:[e.jsx("h3",s({className:"text-lg font-medium"},{children:H.title})),$(H.status)]})),S&&e.jsx("div",s({className:"mb-4"},{children:function(){if(!H||!G)return null;if(!G.nitdaNotificationRequired)return e.jsxs("div",s({className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md"},{children:[e.jsx("p",s({className:"text-sm text-green-800 dark:text-green-200 font-medium"},{children:"Notification Not Required"})),e.jsx("p",s({className:"text-xs text-green-700 dark:text-green-300 mt-1"},{children:"Based on the risk assessment, NITDA notification is not required for this breach."}))]}));if(W)return e.jsxs("div",s({className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md"},{children:[e.jsx("p",s({className:"text-sm text-green-800 dark:text-green-200 font-medium"},{children:"Notification Sent"})),e.jsxs("p",s({className:"text-xs text-green-700 dark:text-green-300 mt-1"},{children:["Notification was sent to NITDA on ",_(W.sentAt),"."]}))]}));var t=K(G.nitdaNotificationDeadline);return t<=0?e.jsxs("div",s({className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md"},{children:[e.jsx("p",s({className:"text-sm text-red-800 dark:text-red-200 font-medium"},{children:"Notification Deadline Passed"})),e.jsx("p",s({className:"text-xs text-red-700 dark:text-red-300 mt-1"},{children:"The 72-hour deadline for NITDA notification has passed. Notification should be sent immediately."}))]})):t<=24?e.jsxs("div",s({className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md"},{children:[e.jsx("p",s({className:"text-sm text-red-800 dark:text-red-200 font-medium"},{children:"Urgent: Notification Due Soon"})),e.jsxs("p",s({className:"text-xs text-red-700 dark:text-red-300 mt-1"},{children:["Only ",t," hours remaining until the NITDA notification deadline."]}))]})):e.jsxs("div",s({className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md"},{children:[e.jsx("p",s({className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium"},{children:"Notification Required"})),e.jsxs("p",s({className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1"},{children:["NITDA notification is required by ",_(G.nitdaNotificationDeadline)," (",t," hours remaining)."]}))]}))}()})),j&&e.jsxs("div",s({className:"mb-6"},{children:[e.jsxs("div",s({className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4"},{children:[e.jsxs("div",{children:[e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Discovered:"}))," ",_(H.discoveredAt)]})),H.occurredAt&&e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Occurred:"}))," ",_(H.occurredAt)]})),e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Reporter:"}))," ",H.reporter.name]}))]}),e.jsxs("div",{children:[e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Affected Systems:"}))," ",H.affectedSystems.join(", ")]})),e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Data Types:"}))," ",H.dataTypes.join(", ")]})),e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Affected Subjects:"}))," ",H.estimatedAffectedSubjects||"Unknown"]}))]})]})),e.jsxs("div",s({className:"mb-4"},{children:[e.jsx("p",s({className:"text-sm font-medium"},{children:"Description:"})),e.jsx("p",s({className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1"},{children:H.description}))]})),H.initialActions&&e.jsxs("div",{children:[e.jsx("p",s({className:"text-sm font-medium"},{children:"Initial Actions Taken:"})),e.jsx("p",s({className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1"},{children:H.initialActions}))]})]})),e.jsxs("div",s({className:"mb-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-3"},{children:"Risk Assessment"})),J?e.jsxs("div",s({className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md"},{children:[e.jsxs("div",s({className:"flex justify-between items-center mb-2"},{children:[e.jsx("p",s({className:"text-sm font-medium"},{children:"Risk Level:"})),Q(J.riskLevel)]})),e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Risk Score:"}))," ",J.overallRiskScore," / 5"]})),e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Risks to Rights and Freedoms:"}))," ",J.risksToRightsAndFreedoms?"Yes":"No"]})),e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"High Risks to Rights and Freedoms:"}))," ",J.highRisksToRightsAndFreedoms?"Yes":"No"]})),e.jsx("p",s({className:"text-sm mb-1"},{children:e.jsx("span",s({className:"font-medium"},{children:"Justification:"}))})),e.jsx("p",s({className:"text-xs text-gray-600 dark:text-gray-300 bg-white dark:bg-gray-800 p-2 rounded-md"},{children:J.justification}))]})):e.jsxs("div",s({className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md"},{children:[e.jsx("p",s({className:"text-sm text-yellow-800 dark:text-yellow-200"},{children:"Risk assessment has not been conducted yet."})),e.jsx("button",s({onClick:function(){A&&c&&c(A)},className:"mt-2 px-3 py-1 text-xs bg-yellow-600 text-white rounded hover:bg-yellow-700 ".concat(v)},{children:"Conduct Risk Assessment"}))]}))]})),e.jsxs("div",s({className:"mb-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-3"},{children:"Notification Status"})),W?e.jsxs("div",s({className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md"},{children:[e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Notification Sent:"}))," ",_(W.sentAt)]})),e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Method:"}))," ",W.method.charAt(0).toUpperCase()+W.method.slice(1)]})),W.referenceNumber&&e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Reference Number:"}))," ",W.referenceNumber]})),W.nitdaContact&&e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"NITDA Contact:"}))," ",W.nitdaContact.name]}))]})):e.jsx("div",{children:(null==G?void 0:G.nitdaNotificationRequired)?e.jsxs("div",s({className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md"},{children:[e.jsx("p",s({className:"text-sm text-yellow-800 dark:text-yellow-200"},{children:"NITDA notification is required but has not been sent yet."})),e.jsx("button",s({onClick:function(){A&&u&&u(A)},className:"mt-2 px-3 py-1 text-xs bg-yellow-600 text-white rounded hover:bg-yellow-700 ".concat(v)},{children:"Generate Notification"}))]})):e.jsx("div",s({className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md"},{children:e.jsx("p",s({className:"text-sm text-green-800 dark:text-green-200"},{children:"NITDA notification is not required for this breach."}))}))})]})),k&&function(){if(!H)return null;var t=[{title:"Breach Discovered",date:H.discoveredAt,completed:!0,description:"Breach was discovered on ".concat(_(H.discoveredAt),".")},{title:"Risk Assessment",date:null==J?void 0:J.assessedAt,completed:!!J,description:J?"Risk assessment completed on ".concat(_(J.assessedAt),"."):"Risk assessment has not been completed yet."}];return(null==G?void 0:G.nitdaNotificationRequired)&&t.push({title:"NITDA Notification",date:null==W?void 0:W.sentAt,completed:!!W,description:W?"Notification sent to NITDA on ".concat(_(W.sentAt),"."):"Notification must be sent to NITDA by ".concat(_(G.nitdaNotificationDeadline),".")}),(null==G?void 0:G.dataSubjectNotificationRequired)&&t.push({title:"Data Subject Notification",date:void 0,completed:!1,description:"Notification to affected data subjects is required but has not been sent yet."}),e.jsxs("div",s({className:"mt-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-4"},{children:"Notification Timeline"})),e.jsx("ol",s({className:"relative border-l border-gray-200 dark:border-gray-700"},{children:t.map((function(t,r){return e.jsxs("li",s({className:"mb-6 ml-4"},{children:[e.jsx("div",{className:"absolute w-3 h-3 rounded-full mt-1.5 -left-1.5 border ".concat(t.completed?"bg-green-500 border-green-500 dark:border-green-500":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700")}),e.jsx("time",s({className:"mb-1 text-sm font-normal leading-none text-gray-400 dark:text-gray-500"},{children:t.date?_(t.date):"Pending"})),e.jsx("h4",s({className:"text-sm font-semibold text-gray-900 dark:text-white"},{children:t.title})),e.jsx("p",s({className:"text-xs text-gray-500 dark:text-gray-400"},{children:t.description}))]}),r)}))}))]}))}()]}):e.jsx("div",s({className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md"},{children:e.jsx("p",s({className:"text-gray-500 dark:text-gray-400"},{children:"Select a breach to view details"}))}))}))]}))]}))},exports.BreachReportForm=function(r){var a=r.categories,n=r.onSubmit,i=r.title,d=void 0===i?"Report a Data Breach":i,l=r.formDescription,c=void 0===l?"Use this form to report a suspected or confirmed data breach. All fields marked with * are required.":l,u=r.submitButtonText,m=void 0===u?"Submit Report":u,x=r.className,h=void 0===x?"":x,g=r.buttonClassName,p=void 0===g?"":g,f=r.showConfirmation,b=void 0===f||f,v=r.confirmationMessage,y=void 0===v?"Your breach report has been submitted successfully. The data protection team has been notified.":v,j=r.allowAttachments,N=void 0===j||j,k=r.maxAttachments,w=void 0===k?5:k,S=r.maxFileSize,D=void 0===S?5242880:S,A=r.allowedFileTypes,R=void 0===A?[".pdf",".jpg",".jpeg",".png",".doc",".docx",".xls",".xlsx",".txt"]:A,C=t.useState(""),q=C[0],I=C[1],T=t.useState(""),P=T[0],E=T[1],F=t.useState(""),L=F[0],O=F[1],B=t.useState(""),U=B[0],V=B[1],M=t.useState(""),z=M[0],_=M[1],H=t.useState(""),J=H[0],W=H[1],G=t.useState(""),Y=G[0],K=G[1],Q=t.useState(""),$=Q[0],X=Q[1],Z=t.useState(""),ee=Z[0],te=Z[1],re=t.useState([]),ae=re[0],se=re[1],ne=t.useState(""),ie=ne[0],oe=ne[1],de=t.useState([]),le=de[0],ce=de[1],ue=t.useState(""),me=ue[0],xe=ue[1],he=t.useState("ongoing"),ge=he[0],pe=he[1],fe=t.useState(""),be=fe[0],ve=fe[1],ye=t.useState([]),je=ye[0],Ne=ye[1],ke=t.useState(!1),we=ke[0],Se=ke[1],De=t.useState({}),Ae=De[0],Re=De[1];if(we)return e.jsxs("div",s({className:"p-4 bg-green-50 dark:bg-green-900/20 rounded-md ".concat(h)},{children:[e.jsx("h2",s({className:"text-lg font-bold text-green-800 dark:text-green-200 mb-2"},{children:"Report Submitted"})),e.jsx("p",s({className:"text-green-700 dark:text-green-300"},{children:y})),e.jsxs("div",s({className:"mt-4 p-4 bg-yellow-50 dark:bg-yellow-900/20 rounded-md"},{children:[e.jsx("h3",s({className:"text-sm font-bold text-yellow-800 dark:text-yellow-200 mb-2"},{children:"Important: Next Steps"})),e.jsx("p",s({className:"text-yellow-700 dark:text-yellow-300 text-sm"},{children:"Under the NDPR, data breaches that pose a risk to the rights and freedoms of data subjects must be reported to NITDA within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."}))]})),e.jsx("button",s({onClick:function(){return Se(!1)},className:"mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ".concat(p)},{children:"Report Another Breach"}))]}));return e.jsxs("div",s({className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ".concat(h)},{children:[e.jsx("h2",s({className:"text-xl font-bold mb-2"},{children:d})),e.jsx("p",s({className:"mb-6 text-gray-600 dark:text-gray-300"},{children:c})),e.jsx("form",s({onSubmit:function(e){if(e.preventDefault(),t={},q.trim()||(t.breachTitle="Breach title is required"),P.trim()||(t.description="Description is required"),L||(t.category="Category is required"),U||(t.discoveredAt="Discovery date is required"),J.trim()||(t.reporterName="Reporter name is required"),Y.trim()?/\S+@\S+\.\S+/.test(Y)||(t.reporterEmail="Reporter email is invalid"):t.reporterEmail="Reporter email is required",$.trim()||(t.reporterDepartment="Reporter department is required"),0===ae.length&&(t.affectedSystems="At least one affected system is required"),0===le.length&&(t.dataTypes="At least one data type is required"),me&&isNaN(Number(me))&&(t.estimatedAffectedSubjects="Estimated affected subjects must be a number"),Re(t),0===Object.keys(t).length){var t,r={title:q,description:P,category:L,discoveredAt:new Date(U).getTime(),occurredAt:z?new Date(z).getTime():void 0,reportedAt:Date.now(),reporter:{name:J,email:Y,department:$,phone:ee||void 0},affectedSystems:ae,dataTypes:le,estimatedAffectedSubjects:me?Number(me):void 0,status:ge,initialActions:be||void 0,attachments:je.map((function(e){return{name:e.name,type:e.type,size:e.size,file:e}}))};n(r),b&&Se(!0)}}},{children:e.jsxs("div",s({className:"space-y-6"},{children:[e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Breach Information"})),e.jsxs("div",s({className:"grid grid-cols-1 gap-4 md:grid-cols-2"},{children:[e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"breachTitle",className:"block text-sm font-medium mb-1"},{children:["Breach Title/Summary ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("input",{type:"text",id:"breachTitle",value:q,onChange:function(e){return I(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),Ae.breachTitle&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:Ae.breachTitle}))]}),e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"category",className:"block text-sm font-medium mb-1"},{children:["Breach Category ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsxs("select",s({id:"category",value:L,onChange:function(e){return O(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0},{children:[e.jsx("option",s({value:""},{children:"Select a category"})),a.map((function(t){return e.jsx("option",s({value:t.id},{children:t.name}),t.id)}))]})),Ae.category&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:Ae.category}))]}),e.jsxs("div",s({className:"md:col-span-2"},{children:[e.jsxs("label",s({htmlFor:"description",className:"block text-sm font-medium mb-1"},{children:["Detailed Description ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("textarea",{id:"description",value:P,onChange:function(e){return E(e.target.value)},rows:4,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),Ae.description&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:Ae.description}))]})),e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"discoveredAt",className:"block text-sm font-medium mb-1"},{children:["Date Discovered ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("input",{type:"datetime-local",id:"discoveredAt",value:U,onChange:function(e){return V(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),Ae.discoveredAt&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:Ae.discoveredAt}))]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"occurredAt",className:"block text-sm font-medium mb-1"},{children:"Date Occurred (if known)"})),e.jsx("input",{type:"datetime-local",id:"occurredAt",value:z,onChange:function(e){return _(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}))]}),e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Reporter Information"})),e.jsxs("div",s({className:"grid grid-cols-1 gap-4 md:grid-cols-2"},{children:[e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"reporterName",className:"block text-sm font-medium mb-1"},{children:["Your Name ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("input",{type:"text",id:"reporterName",value:J,onChange:function(e){return W(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),Ae.reporterName&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:Ae.reporterName}))]}),e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"reporterEmail",className:"block text-sm font-medium mb-1"},{children:["Your Email ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("input",{type:"email",id:"reporterEmail",value:Y,onChange:function(e){return K(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),Ae.reporterEmail&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:Ae.reporterEmail}))]}),e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"reporterDepartment",className:"block text-sm font-medium mb-1"},{children:["Your Department ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("input",{type:"text",id:"reporterDepartment",value:$,onChange:function(e){return X(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),Ae.reporterDepartment&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:Ae.reporterDepartment}))]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"reporterPhone",className:"block text-sm font-medium mb-1"},{children:"Your Phone Number (Optional)"})),e.jsx("input",{type:"tel",id:"reporterPhone",value:ee,onChange:function(e){return te(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}))]}),e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Impact Information"})),e.jsxs("div",s({className:"grid grid-cols-1 gap-4 md:grid-cols-2"},{children:[e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"affectedSystems",className:"block text-sm font-medium mb-1"},{children:["Affected Systems/Applications ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("input",{type:"text",id:"affectedSystems",value:ie,onChange:function(e){var t=e.target.value;oe(t);var r=t.split(",").map((function(e){return e.trim()})).filter(Boolean);se(r)},placeholder:"e.g. CRM, Email Server, Website (comma separated)",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),Ae.affectedSystems&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:Ae.affectedSystems}))]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"estimatedAffectedSubjects",className:"block text-sm font-medium mb-1"},{children:"Estimated Number of Affected Data Subjects"})),e.jsx("input",{type:"text",id:"estimatedAffectedSubjects",value:me,onChange:function(e){return xe(e.target.value)},placeholder:"e.g. 100",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}),Ae.estimatedAffectedSubjects&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:Ae.estimatedAffectedSubjects}))]}),e.jsxs("div",s({className:"md:col-span-2"},{children:[e.jsxs("label",s({className:"block text-sm font-medium mb-1"},{children:["Types of Data Involved ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("div",s({className:"grid grid-cols-1 md:grid-cols-2 gap-2"},{children:[{id:"personal",label:"Personal Information (names, addresses)"},{id:"contact",label:"Contact Information (email, phone)"},{id:"financial",label:"Financial Information (bank details, payment info)"},{id:"health",label:"Health Information"},{id:"identification",label:"Identification Documents (ID cards, passports)"},{id:"login",label:"Login Credentials"},{id:"biometric",label:"Biometric Data"},{id:"children",label:"Children's Data"},{id:"location",label:"Location Data"},{id:"communications",label:"Communications Content"}].map((function(t){return e.jsxs("div",s({className:"flex items-center"},{children:[e.jsx("input",{type:"checkbox",id:"dataType_".concat(t.id),checked:le.includes(t.id),onChange:function(){return function(e){ce((function(t){return t.includes(e)?t.filter((function(t){return t!==e})):o(o([],t,!0),[e],!1)}))}(t.id)},className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),e.jsx("label",s({htmlFor:"dataType_".concat(t.id),className:"ml-2 text-sm text-gray-700 dark:text-gray-300"},{children:t.label}))]}),t.id)}))})),Ae.dataTypes&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:Ae.dataTypes}))]})),e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"status",className:"block text-sm font-medium mb-1"},{children:["Current Status ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsxs("select",s({id:"status",value:ge,onChange:function(e){return pe(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0},{children:[e.jsx("option",s({value:"ongoing"},{children:"Ongoing (breach is still active)"})),e.jsx("option",s({value:"contained"},{children:"Contained (breach is stopped but not resolved)"})),e.jsx("option",s({value:"resolved"},{children:"Resolved (breach is fully addressed)"}))]}))]}),e.jsxs("div",s({className:"md:col-span-2"},{children:[e.jsx("label",s({htmlFor:"initialActions",className:"block text-sm font-medium mb-1"},{children:"Initial Actions Taken"})),e.jsx("textarea",{id:"initialActions",value:be,onChange:function(e){return ve(e.target.value)},placeholder:"Describe any immediate actions that have been taken to address the breach",rows:3,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}))]}))]}),N&&e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Attachments"})),e.jsxs("div",s({className:"mb-4"},{children:[e.jsx("label",s({className:"block text-sm font-medium mb-1"},{children:"Upload Supporting Files (Optional)"})),e.jsxs("p",s({className:"text-xs text-gray-500 dark:text-gray-400 mb-2"},{children:["Max ",w," files, ",D/1048576,"MB each. Allowed types: ",R.join(", ")]})),e.jsx("input",{type:"file",onChange:function(e){var t,r=e.target.files;if(r){var a=[],n={};if(je.length+r.length>w)return n.attachments="Maximum of ".concat(w," files allowed"),void Re((function(e){return s(s({},e),n)}));for(var i=0;i<r.length;i++){var d=r[i];if(d.size>D)n.attachments="File ".concat(d.name," exceeds the maximum size of ").concat(D/1048576,"MB");else{var l="."+(null===(t=d.name.split(".").pop())||void 0===t?void 0:t.toLowerCase());R.includes(l)?a.push(d):n.attachments="File type ".concat(l," is not allowed")}}Object.keys(n).length>0?Re((function(e){return s(s({},e),n)})):(Ne((function(e){return o(o([],e,!0),a,!0)})),Re((function(e){return s(s({},e),{attachments:""})})))}},multiple:!0,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",accept:R.join(",")}),Ae.attachments&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:Ae.attachments}))]})),je.length>0&&e.jsxs("div",s({className:"mb-4"},{children:[e.jsx("h4",s({className:"text-sm font-medium mb-2"},{children:"Attached Files:"})),e.jsx("ul",s({className:"space-y-2"},{children:je.map((function(t,r){return e.jsxs("li",s({className:"flex items-center justify-between p-2 bg-gray-50 dark:bg-gray-700 rounded"},{children:[e.jsxs("div",s({className:"flex items-center"},{children:[e.jsx("svg",s({className:"w-4 h-4 text-gray-500 dark:text-gray-400 mr-2",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",d:"M8 4a3 3 0 00-3 3v4a5 5 0 0010 0V7a1 1 0 112 0v4a7 7 0 11-14 0V7a5 5 0 0110 0v4a3 3 0 11-6 0V7a1 1 0 012 0v4a1 1 0 102 0V7a3 3 0 00-3-3z",clipRule:"evenodd"})})),e.jsx("span",s({className:"text-sm text-gray-700 dark:text-gray-300"},{children:t.name})),e.jsxs("span",s({className:"ml-2 text-xs text-gray-500 dark:text-gray-400"},{children:["(",(t.size/1024).toFixed(1)," KB)"]}))]})),e.jsx("button",s({type:"button",onClick:function(){return function(e){Ne((function(t){return t.filter((function(t,r){return r!==e}))}))}(r)},className:"text-red-500 hover:text-red-700"},{children:e.jsx("svg",s({className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",d:"M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z",clipRule:"evenodd"})}))}))]}),r)}))}))]}))]}),e.jsxs("div",s({className:"mt-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md"},{children:[e.jsx("h3",s({className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2"},{children:"NDPR Breach Notification Requirements"})),e.jsx("p",s({className:"text-blue-700 dark:text-blue-300 text-sm"},{children:"Under the Nigeria Data Protection Regulation (NDPR), data breaches that pose a risk to the rights and freedoms of data subjects must be reported to NITDA within 72 hours of discovery. The data protection team will assess this breach and determine if notification is required."}))]})),e.jsx("div",s({className:"mt-6"},{children:e.jsx("button",s({type:"submit",className:"px-6 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(p)},{children:m}))}))]}))}))]}))},exports.BreachRiskAssessment=function(r){var a=r.breachData,n=r.initialAssessment,i=void 0===n?{}:n,o=r.onComplete,d=r.title,l=void 0===d?"Breach Risk Assessment":d,c=r.description,u=void 0===c?"Assess the risk level of this data breach to determine notification requirements.":c,m=r.submitButtonText,x=void 0===m?"Complete Assessment":m,h=r.className,g=void 0===h?"":h,p=r.buttonClassName,f=void 0===p?"":p,b=r.showBreachSummary,v=void 0===b||b,y=r.showNotificationRequirements,j=void 0===y||y,N=t.useState(i.confidentialityImpact||3),k=N[0],w=N[1],S=t.useState(i.integrityImpact||3),D=S[0],A=S[1],R=t.useState(i.availabilityImpact||3),C=R[0],q=R[1],I=t.useState(i.harmLikelihood||3),T=I[0],P=I[1],E=t.useState(i.harmSeverity||3),F=E[0],L=E[1],O=t.useState(void 0!==i.risksToRightsAndFreedoms&&i.risksToRightsAndFreedoms),B=O[0],U=O[1],V=t.useState(void 0!==i.highRisksToRightsAndFreedoms&&i.highRisksToRightsAndFreedoms),M=V[0],z=V[1],_=t.useState(i.justification||""),H=_[0],J=_[1],W=t.useState(0),G=W[0],Y=W[1],K=t.useState("low"),Q=K[0],$=K[1],X=t.useState(!1),Z=X[0],ee=X[1],te=t.useState(0),re=te[0],ae=te[1],se=t.useState(0),ne=se[0],ie=se[1],oe=t.useState(!1),de=oe[0],le=oe[1];t.useEffect((function(){var e,t=.2*k+.1*D+.1*C+.3*T+.3*F;Y(Number(t.toFixed(1))),$(e=t<2?"low":t<3?"medium":t<4?"high":"critical"),ee(B||"high"===e||"critical"===e);var r=a.discoveredAt+2592e5;ae(r);var s=Date.now();ie(Number(((r-s)/36e5).toFixed(1)))}),[k,D,C,T,F,B,a.discoveredAt]);var ce=function(e){return new Date(e).toLocaleString()},ue=function(e){switch(e){case 1:return"Minimal";case 2:return"Low";case 3:return"Moderate";case 4:return"High";case 5:return"Severe";default:return"Unknown"}},me=function(t){return e.jsx("span",s({className:"px-2 py-1 rounded text-xs font-medium ".concat({low:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",medium:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",high:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",critical:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}[t])},{children:t.charAt(0).toUpperCase()+t.slice(1)}))};return e.jsxs("div",s({className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ".concat(g)},{children:[e.jsx("h2",s({className:"text-xl font-bold mb-2"},{children:l})),e.jsx("p",s({className:"mb-6 text-gray-600 dark:text-gray-300"},{children:u})),v&&e.jsxs("div",s({className:"mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-2"},{children:"Breach Summary"})),e.jsxs("div",s({className:"grid grid-cols-1 md:grid-cols-2 gap-2"},{children:[e.jsxs("div",{children:[e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Title:"}))," ",a.title]})),e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Discovered:"}))," ",ce(a.discoveredAt)]})),e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Status:"}))," ",a.status.charAt(0).toUpperCase()+a.status.slice(1)]}))]}),e.jsxs("div",{children:[e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Data Types:"}))," ",a.dataTypes.join(", ")]})),e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Affected Systems:"}))," ",a.affectedSystems.join(", ")]})),e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Affected Subjects:"}))," ",a.estimatedAffectedSubjects||"Unknown"]}))]})]}))]})),de?e.jsxs("div",{children:[e.jsxs("div",s({className:"mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-3"},{children:"Assessment Results"})),e.jsxs("div",s({className:"grid grid-cols-1 md:grid-cols-2 gap-4"},{children:[e.jsxs("div",{children:[e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Overall Risk Level:"}))," ",me(Q)]})),e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Risk Score:"}))," ",G," / 5"]})),e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Assessed On:"}))," ",ce(Date.now())]}))]}),e.jsxs("div",{children:[e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Risks to Rights and Freedoms:"}))," ",B?"Yes":"No"]})),e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"High Risks to Rights and Freedoms:"}))," ",M?"Yes":"No"]}))]})]})),e.jsxs("div",s({className:"mt-3"},{children:[e.jsx("p",s({className:"text-sm mb-1"},{children:e.jsx("span",s({className:"font-medium"},{children:"Justification:"}))})),e.jsx("p",s({className:"text-sm bg-white dark:bg-gray-800 p-2 rounded"},{children:H}))]}))]})),j&&e.jsxs("div",s({className:"mb-6 p-4 rounded-md ".concat(Z?ne>24?"bg-yellow-50 dark:bg-yellow-900/20":"bg-red-50 dark:bg-red-900/20":"bg-green-50 dark:bg-green-900/20")},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-3"},{children:"Notification Requirements"})),Z?e.jsxs("div",{children:[e.jsx("p",s({className:"text-sm font-bold mb-2 ".concat(ne>24?"text-yellow-800 dark:text-yellow-200":"text-red-800 dark:text-red-200")},{children:"NITDA Notification Required"})),e.jsx("p",s({className:"text-sm mb-2"},{children:"Under the NDPR, this breach must be reported to NITDA within 72 hours of discovery."})),e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Notification Deadline:"}))," ",ce(re)]})),e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Time Remaining:"}))," ",e.jsx("span",s({className:ne<24?"text-red-600 dark:text-red-400 font-bold":""},{children:ne>0?"".concat(ne," hours"):"Deadline passed"}))]})),e.jsxs("p",s({className:"text-sm mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Data Subject Notification:"}))," ",M?"Required":"Not required unless directed by NITDA"]}))]}):e.jsxs("div",{children:[e.jsx("p",s({className:"text-sm font-bold mb-2 text-green-800 dark:text-green-200"},{children:"NITDA Notification Not Required"})),e.jsx("p",s({className:"text-sm mb-2"},{children:"Based on this assessment, this breach does not need to be reported to NITDA."})),e.jsx("p",s({className:"text-sm mb-2"},{children:"However, the breach should still be documented internally for compliance purposes."}))]}),e.jsxs("div",s({className:"mt-3 text-sm"},{children:[e.jsx("p",s({className:"font-medium"},{children:"Next Steps:"})),e.jsx("ul",s({className:"list-disc pl-5 mt-1"},{children:Z?e.jsxs(e.Fragment,{children:[e.jsx("li",{children:"Prepare a notification report for NITDA"}),e.jsx("li",{children:"Document all aspects of the breach and your response"}),M&&e.jsx("li",{children:"Prepare communications for affected data subjects"}),e.jsx("li",{children:"Implement measures to mitigate the impact of the breach"})]}):e.jsxs(e.Fragment,{children:[e.jsx("li",{children:"Document the breach and this assessment in your internal records"}),e.jsx("li",{children:"Implement measures to prevent similar breaches in the future"}),e.jsx("li",{children:"Review and update security measures as needed"})]})}))]}))]})),e.jsx("button",s({onClick:function(){return le(!1)},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(f)},{children:"Edit Assessment"}))]}):e.jsx("form",s({onSubmit:function(e){e.preventDefault();var t={id:i.id||"assessment_".concat(Date.now()),breachId:a.id,assessedAt:Date.now(),assessor:i.assessor||{name:"Assessment User",role:"Data Protection Officer",email:"dpo@example.com"},confidentialityImpact:k,integrityImpact:D,availabilityImpact:C,harmLikelihood:T,harmSeverity:F,overallRiskScore:G,riskLevel:Q,risksToRightsAndFreedoms:B,highRisksToRightsAndFreedoms:M,justification:H};o(t),le(!0)}},{children:e.jsxs("div",s({className:"space-y-6"},{children:[e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Impact Assessment"})),e.jsxs("div",s({className:"mb-4"},{children:[e.jsxs("label",s({htmlFor:"confidentialityImpact",className:"block text-sm font-medium mb-1"},{children:["Confidentiality Impact (1-5)",e.jsx("span",s({className:"ml-2 text-sm text-gray-500 dark:text-gray-400"},{children:"How much has the confidentiality of data been compromised?"}))]})),e.jsxs("div",s({className:"flex items-center"},{children:[e.jsx("input",{type:"range",id:"confidentialityImpact",min:"1",max:"5",step:"1",value:k,onChange:function(e){return w(parseInt(e.target.value))},className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"}),e.jsxs("span",s({className:"ml-3 w-24 text-sm"},{children:[ue(k)," (",k,")"]}))]}))]})),e.jsxs("div",s({className:"mb-4"},{children:[e.jsxs("label",s({htmlFor:"integrityImpact",className:"block text-sm font-medium mb-1"},{children:["Integrity Impact (1-5)",e.jsx("span",s({className:"ml-2 text-sm text-gray-500 dark:text-gray-400"},{children:"How much has the integrity of data been compromised?"}))]})),e.jsxs("div",s({className:"flex items-center"},{children:[e.jsx("input",{type:"range",id:"integrityImpact",min:"1",max:"5",step:"1",value:D,onChange:function(e){return A(parseInt(e.target.value))},className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"}),e.jsxs("span",s({className:"ml-3 w-24 text-sm"},{children:[ue(D)," (",D,")"]}))]}))]})),e.jsxs("div",s({className:"mb-4"},{children:[e.jsxs("label",s({htmlFor:"availabilityImpact",className:"block text-sm font-medium mb-1"},{children:["Availability Impact (1-5)",e.jsx("span",s({className:"ml-2 text-sm text-gray-500 dark:text-gray-400"},{children:"How much has the availability of data or systems been compromised?"}))]})),e.jsxs("div",s({className:"flex items-center"},{children:[e.jsx("input",{type:"range",id:"availabilityImpact",min:"1",max:"5",step:"1",value:C,onChange:function(e){return q(parseInt(e.target.value))},className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"}),e.jsxs("span",s({className:"ml-3 w-24 text-sm"},{children:[ue(C)," (",C,")"]}))]}))]}))]}),e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Risk to Data Subjects"})),e.jsxs("div",s({className:"mb-4"},{children:[e.jsxs("label",s({htmlFor:"harmLikelihood",className:"block text-sm font-medium mb-1"},{children:["Likelihood of Harm (1-5)",e.jsx("span",s({className:"ml-2 text-sm text-gray-500 dark:text-gray-400"},{children:"How likely is it that data subjects will experience harm?"}))]})),e.jsxs("div",s({className:"flex items-center"},{children:[e.jsx("input",{type:"range",id:"harmLikelihood",min:"1",max:"5",step:"1",value:T,onChange:function(e){return P(parseInt(e.target.value))},className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"}),e.jsxs("span",s({className:"ml-3 w-24 text-sm"},{children:[ue(T)," (",T,")"]}))]}))]})),e.jsxs("div",s({className:"mb-4"},{children:[e.jsxs("label",s({htmlFor:"harmSeverity",className:"block text-sm font-medium mb-1"},{children:["Severity of Harm (1-5)",e.jsx("span",s({className:"ml-2 text-sm text-gray-500 dark:text-gray-400"},{children:"How severe would the harm be to affected data subjects?"}))]})),e.jsxs("div",s({className:"flex items-center"},{children:[e.jsx("input",{type:"range",id:"harmSeverity",min:"1",max:"5",step:"1",value:F,onChange:function(e){return L(parseInt(e.target.value))},className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"}),e.jsxs("span",s({className:"ml-3 w-24 text-sm"},{children:[ue(F)," (",F,")"]}))]}))]})),e.jsxs("div",s({className:"mb-4"},{children:[e.jsxs("div",s({className:"flex items-center mb-2"},{children:[e.jsx("input",{type:"checkbox",id:"risksToRightsAndFreedoms",checked:B,onChange:function(e){return U(e.target.checked)},className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),e.jsx("label",s({htmlFor:"risksToRightsAndFreedoms",className:"ml-2 text-sm font-medium"},{children:"This breach poses a risk to the rights and freedoms of data subjects"}))]})),e.jsx("p",s({className:"text-xs text-gray-500 dark:text-gray-400 ml-6"},{children:"Under the NDPR, breaches that pose a risk to rights and freedoms must be reported to NITDA within 72 hours."}))]})),e.jsxs("div",s({className:"mb-4"},{children:[e.jsxs("div",s({className:"flex items-center mb-2"},{children:[e.jsx("input",{type:"checkbox",id:"highRisksToRightsAndFreedoms",checked:M,onChange:function(e){return z(e.target.checked)},className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"}),e.jsx("label",s({htmlFor:"highRisksToRightsAndFreedoms",className:"ml-2 text-sm font-medium"},{children:"This breach poses a high risk to the rights and freedoms of data subjects"}))]})),e.jsx("p",s({className:"text-xs text-gray-500 dark:text-gray-400 ml-6"},{children:"Under the NDPR, breaches that pose a high risk to rights and freedoms also require notification to affected data subjects."}))]}))]}),e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Overall Assessment"})),e.jsxs("div",s({className:"mb-4 p-4 bg-gray-50 dark:bg-gray-700 rounded-md"},{children:[e.jsxs("div",s({className:"flex items-center justify-between mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Overall Risk Score:"})),e.jsxs("span",{children:[G," / 5"]})]})),e.jsxs("div",s({className:"flex items-center justify-between"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Risk Level:"})),me(Q)]}))]})),e.jsxs("div",s({className:"mb-4"},{children:[e.jsxs("label",s({htmlFor:"justification",className:"block text-sm font-medium mb-1"},{children:["Justification for Assessment ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("textarea",{id:"justification",value:H,onChange:function(e){return J(e.target.value)},rows:4,placeholder:"Explain the reasoning behind your assessment, including any factors that influenced your decision.",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0})]}))]}),e.jsxs("div",s({className:"mt-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md"},{children:[e.jsx("h3",s({className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2"},{children:"NDPR Breach Notification Requirements"})),e.jsx("p",s({className:"text-blue-700 dark:text-blue-300 text-sm"},{children:"Under the Nigeria Data Protection Regulation (NDPR), data breaches that pose a risk to the rights and freedoms of data subjects must be reported to NITDA within 72 hours of discovery. This assessment will determine if notification is required for this breach."}))]})),e.jsx("div",s({className:"mt-6"},{children:e.jsx("button",s({type:"submit",className:"px-6 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(f)},{children:x}))}))]}))}))]}))},exports.ConsentBanner=function(r){var a=r.options,n=r.onSave,i=r.title,o=void 0===i?"We Value Your Privacy":i,d=r.description,l=void 0===d?"We use cookies and similar technologies to provide our services and enhance your experience.":d,c=r.acceptAllButtonText,u=void 0===c?"Accept All":c,m=r.rejectAllButtonText,x=void 0===m?"Reject All":m,h=r.customizeButtonText,g=void 0===h?"Customize":h,p=r.saveButtonText,f=void 0===p?"Save Preferences":p,b=r.position,v=void 0===b?"bottom":b,y=r.version,j=void 0===y?"1.0":y,N=r.show,k=r.storageKey,w=void 0===k?"ndpr_consent":k,S=r.className,D=void 0===S?"":S,A=r.buttonClassName,R=void 0===A?"":A,C=r.primaryButtonClassName,q=void 0===C?"":C,I=r.secondaryButtonClassName,T=void 0===I?"":I,P=t.useState(!1),E=P[0],F=P[1],L=t.useState(!1),O=L[0],B=L[1],U=t.useState({}),V=U[0],M=U[1];t.useEffect((function(){var e={};if(a.forEach((function(t){e[t.id]=t.defaultValue||!1})),M(e),void 0===N){var t=localStorage.getItem(w);F(!t)}else F(N)}),[a,N,w]);var z=function(e){var t={consents:e,timestamp:Date.now(),version:j,method:O?"customize":"banner",hasInteracted:!0};localStorage.setItem(w,JSON.stringify(t)),n(t),F(!1),B(!1)};if(!E)return null;var _="top"===v?"top-0 left-0 right-0":"center"===v?"top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 max-w-lg":"bottom-0 left-0 right-0";return e.jsx("div",s({className:"fixed z-50 bg-white dark:bg-gray-800 shadow-lg p-4 border border-gray-200 dark:border-gray-700 ".concat(_," ").concat(D),role:"dialog","aria-labelledby":"consent-banner-title"},{children:e.jsxs("div",s({className:"max-w-6xl mx-auto"},{children:[e.jsx("h2",s({id:"consent-banner-title",className:"text-lg font-bold mb-2"},{children:o})),e.jsx("p",s({className:"mb-4"},{children:l})),O?e.jsxs("div",s({className:"mb-4"},{children:[e.jsx("div",s({className:"space-y-3"},{children:a.map((function(t){return e.jsxs("div",s({className:"flex items-start"},{children:[e.jsx("div",s({className:"flex items-center h-5"},{children:e.jsx("input",{id:"consent-".concat(t.id),type:"checkbox",checked:V[t.id]||!1,onChange:function(e){return r=t.id,a=e.target.checked,void M((function(e){var t;return s(s({},e),((t={})[r]=a,t))}));var r,a},disabled:t.required,className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500"})})),e.jsxs("div",s({className:"ml-3 text-sm"},{children:[e.jsxs("label",s({htmlFor:"consent-".concat(t.id),className:"font-medium"},{children:[t.label," ",t.required&&e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("p",s({className:"text-gray-500 dark:text-gray-400"},{children:t.description}))]}))]}),t.id)}))})),e.jsxs("div",s({className:"mt-4 flex flex-wrap gap-2"},{children:[e.jsx("button",s({onClick:function(){z(V)},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(R," ").concat(q)},{children:f})),e.jsx("button",s({onClick:function(){return B(!1)},className:"px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ".concat(R," ").concat(T)},{children:"Back"}))]}))]})):e.jsxs("div",s({className:"flex flex-wrap gap-2"},{children:[e.jsx("button",s({onClick:function(){var e={};a.forEach((function(t){e[t.id]=!0})),z(e)},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(R," ").concat(q)},{children:u})),e.jsx("button",s({onClick:function(){var e={};a.forEach((function(t){e[t.id]=t.required||!1})),z(e)},className:"px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ".concat(R," ").concat(T)},{children:x})),e.jsx("button",s({onClick:function(){return B(!0)},className:"px-4 py-2 bg-transparent text-gray-800 dark:text-white hover:underline ".concat(R)},{children:g}))]})),e.jsx("div",s({className:"mt-2 text-xs text-gray-500 dark:text-gray-400"},{children:'By clicking "Accept All", you agree to the use of ALL cookies. Visit our Cookie Policy to learn more.'}))]}))}))},exports.ConsentManager=function(r){var a=r.options,n=r.settings,i=r.onSave,o=r.title,d=void 0===o?"Manage Your Privacy Settings":o,l=r.description,c=void 0===l?"Update your consent preferences at any time. Required cookies cannot be disabled as they are necessary for the website to function.":l,u=r.saveButtonText,m=void 0===u?"Save Preferences":u,x=r.resetButtonText,h=void 0===x?"Reset to Defaults":x,g=r.version,p=void 0===g?"1.0":g,f=r.className,b=void 0===f?"":f,v=r.buttonClassName,y=void 0===v?"":v,j=r.primaryButtonClassName,N=void 0===j?"":j,k=r.secondaryButtonClassName,w=void 0===k?"":k,S=r.showSuccessMessage,D=void 0===S||S,A=r.successMessage,R=void 0===A?"Your preferences have been saved.":A,C=r.successMessageDuration,q=void 0===C?3e3:C,I=t.useState({}),T=I[0],P=I[1],E=t.useState(!1),F=E[0],L=E[1];t.useEffect((function(){if(n&&n.consents)P(n.consents);else{var e={};a.forEach((function(t){e[t.id]=t.defaultValue||!1})),P(e)}}),[a,n]);return e.jsxs("div",s({className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 ".concat(b)},{children:[e.jsx("h2",s({className:"text-xl font-bold mb-2"},{children:d})),e.jsx("p",s({className:"mb-6 text-gray-600 dark:text-gray-300"},{children:c})),e.jsx("div",s({className:"space-y-6"},{children:a.map((function(t){return e.jsx("div",s({className:"border-b border-gray-200 dark:border-gray-700 pb-4 last:border-0"},{children:e.jsxs("div",s({className:"flex items-start justify-between"},{children:[e.jsxs("div",{children:[e.jsx("h3",s({className:"font-medium text-gray-900 dark:text-white"},{children:t.label})),e.jsx("p",s({className:"text-sm text-gray-500 dark:text-gray-400 mt-1"},{children:t.description}))]}),e.jsx("div",s({className:"ml-4 flex-shrink-0"},{children:e.jsxs("label",s({className:"relative inline-flex items-center cursor-pointer"},{children:[e.jsx("input",{type:"checkbox",className:"sr-only peer",checked:T[t.id]||!1,onChange:function(e){return r=t.id,a=e.target.checked,void P((function(e){var t;return s(s({},e),((t={})[r]=a,t))}));var r,a},disabled:t.required}),e.jsx("div",{className:"w-11 h-6 bg-gray-200 peer-focus:outline-none peer-focus:ring-4 peer-focus:ring-blue-300 dark:peer-focus:ring-blue-800 rounded-full peer dark:bg-gray-700 peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all dark:border-gray-600 peer-checked:bg-blue-600 ".concat(t.required?"opacity-60":"")}),e.jsxs("span",s({className:"ml-3 text-sm font-medium text-gray-900 dark:text-gray-300"},{children:[T[t.id]?"Enabled":"Disabled",t.required&&e.jsx("span",s({className:"text-xs text-red-500 ml-1"},{children:"(Required)"}))]}))]}))}))]}))}),t.id)}))})),F&&e.jsx("div",s({className:"mt-4 p-3 bg-green-50 dark:bg-green-900/20 text-green-800 dark:text-green-200 rounded-md"},{children:R})),e.jsxs("div",s({className:"mt-6 flex flex-wrap gap-3"},{children:[e.jsx("button",s({onClick:function(){var e={consents:T,timestamp:Date.now(),version:p,method:"manager",hasInteracted:!0};i(e),D&&(L(!0),setTimeout((function(){L(!1)}),q))},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(y," ").concat(N)},{children:m})),e.jsx("button",s({onClick:function(){var e={};a.forEach((function(t){e[t.id]=t.defaultValue||!1})),P(e)},className:"px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ".concat(y," ").concat(w)},{children:h}))]})),e.jsxs("div",s({className:"mt-4 text-xs text-gray-500 dark:text-gray-400"},{children:[e.jsxs("p",{children:["Last updated: ",n?new Date(n.timestamp).toLocaleString():"Never"]}),e.jsxs("p",{children:["Version: ",p]})]}))]}))},exports.ConsentStorage=function(r){var a=r.settings,s=r.storageOptions,n=void 0===s?{}:s,i=r.onLoad,o=r.onSave,d=r.autoSave,l=void 0===d||d,c=r.autoLoad,u=void 0===c||c,m=r.children,x=n.storageKey,h=void 0===x?"ndpr_consent":x,g=n.storageType,p=void 0===g?"localStorage":g,f=n.cookieOptions,b=void 0===f?{}:f,v=t.useState(!1),y=v[0],j=v[1];t.useEffect((function(){u&&!y&&N()}),[u,y]),t.useEffect((function(){l&&y&&k(a)}),[a,l,y]);var N=function(){var e=null;try{if("localStorage"===p&&"undefined"!=typeof window)(t=localStorage.getItem(h))&&(e=JSON.parse(t));else if("sessionStorage"===p&&"undefined"!=typeof window){var t;(t=sessionStorage.getItem(h))&&(e=JSON.parse(t))}else if("cookie"===p&&"undefined"!=typeof document){var r=document.cookie.split(";").find((function(e){return e.trim().startsWith("".concat(h,"="))}));if(r){var a=r.split("=")[1];e=JSON.parse(decodeURIComponent(a))}}j(!0),i&&i(e)}catch(e){console.error("Error loading consent settings:",e),j(!0),i&&i(null)}return e},k=function(e){try{var t=JSON.stringify(e);if("localStorage"===p&&"undefined"!=typeof window)localStorage.setItem(h,t);else if("sessionStorage"===p&&"undefined"!=typeof window)sessionStorage.setItem(h,t);else if("cookie"===p&&"undefined"!=typeof document){var r=b.domain,a=b.path,s=void 0===a?"/":a,n=b.expires,i=void 0===n?365:n,d=b.secure,l=void 0===d||d,c=b.sameSite,u=void 0===c?"Lax":c,m=new Date;m.setDate(m.getDate()+i);var x="".concat(h,"=").concat(encodeURIComponent(t),"; path=").concat(s,"; expires=").concat(m.toUTCString());r&&(x+="; domain=".concat(r)),l&&(x+="; secure"),x+="; samesite=".concat(u),document.cookie=x}return o&&o(e),!0}catch(e){return console.error("Error saving consent settings:",e),!1}};return"function"==typeof m?e.jsx(e.Fragment,{children:m({loadSettings:N,saveSettings:k,clearSettings:function(){try{if("localStorage"===p&&"undefined"!=typeof window)localStorage.removeItem(h);else if("sessionStorage"===p&&"undefined"!=typeof window)sessionStorage.removeItem(h);else if("cookie"===p&&"undefined"!=typeof document){var e=b.domain,t=b.path,r=void 0===t?"/":t,a="".concat(h,"=; path=").concat(r,"; expires=Thu, 01 Jan 1970 00:00:00 GMT");e&&(a+="; domain=".concat(e)),document.cookie=a}return!0}catch(e){return console.error("Error clearing consent settings:",e),!1}},loaded:y})}):e.jsx(e.Fragment,{children:m})},exports.DPIAQuestionnaire=function(t){var r=t.sections,a=t.answers,n=t.onAnswerChange,i=t.currentSectionIndex,d=t.onNextSection,l=t.onPrevSection,c=t.validationErrors,u=void 0===c?{}:c,m=t.readOnly,x=void 0!==m&&m,h=t.className,g=void 0===h?"":h,p=t.buttonClassName,f=void 0===p?"":p,b=t.nextButtonText,v=void 0===b?"Next":b,y=t.prevButtonText,j=void 0===y?"Previous":y,N=t.submitButtonText,k=void 0===N?"Submit":N,w=t.showProgress,S=void 0===w||w,D=t.progress,A=r[i],R=i===r.length-1,C=function(t){if(!function(e){return!e.showWhen||e.showWhen.every((function(e){var t=a[e.questionId];switch(e.operator){case"equals":return t===e.value;case"contains":return!!Array.isArray(t)&&t.includes(e.value);case"greaterThan":return"number"==typeof t&&t>e.value;case"lessThan":return"number"==typeof t&&t<e.value;default:return!0}}))}(t))return null;var r=u[t.id],i=a[t.id];return e.jsxs("div",s({className:"mb-6"},{children:[e.jsxs("div",s({className:"mb-2"},{children:[e.jsxs("label",s({htmlFor:t.id,className:"block text-sm font-medium text-gray-900 dark:text-gray-100"},{children:[t.text,t.required&&e.jsx("span",s({className:"text-red-500 ml-1"},{children:"*"}))]})),t.guidance&&e.jsx("p",s({className:"mt-1 text-sm text-gray-500 dark:text-gray-400"},{children:t.guidance}))]})),"text"===t.type&&e.jsx("input",{type:"text",id:t.id,value:i||"",onChange:function(e){return n(t.id,e.target.value)},disabled:x,className:"w-full px-3 py-2 border rounded-md ".concat(r?"border-red-500":"border-gray-300 dark:border-gray-600"," focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100")}),"textarea"===t.type&&e.jsx("textarea",{id:t.id,value:i||"",onChange:function(e){return n(t.id,e.target.value)},disabled:x,rows:4,className:"w-full px-3 py-2 border rounded-md ".concat(r?"border-red-500":"border-gray-300 dark:border-gray-600"," focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100")}),"select"===t.type&&t.options&&e.jsxs("select",s({id:t.id,value:i||"",onChange:function(e){return n(t.id,e.target.value)},disabled:x,className:"w-full px-3 py-2 border rounded-md ".concat(r?"border-red-500":"border-gray-300 dark:border-gray-600"," focus:outline-none focus:ring-2 focus:ring-blue-500 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100")},{children:[e.jsx("option",s({value:""},{children:"Select an option"})),t.options.map((function(t){return e.jsx("option",s({value:t.value},{children:t.label}),t.value)}))]})),"radio"===t.type&&t.options&&e.jsx("div",s({className:"space-y-2"},{children:t.options.map((function(r){return e.jsxs("div",s({className:"flex items-center"},{children:[e.jsx("input",{type:"radio",id:"".concat(t.id,"_").concat(r.value),name:t.id,value:r.value,checked:i===r.value,onChange:function(){return n(t.id,r.value)},disabled:x,className:"h-4 w-4 text-blue-600 focus:ring-blue-500 border-gray-300 dark:border-gray-600"}),e.jsxs("label",s({htmlFor:"".concat(t.id,"_").concat(r.value),className:"ml-2 block text-sm text-gray-900 dark:text-gray-100"},{children:[r.label,r.riskLevel&&e.jsxs("span",s({className:"ml-2 text-xs px-2 py-1 rounded ".concat("low"===r.riskLevel?"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200":"medium"===r.riskLevel?"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200":"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200")},{children:[r.riskLevel.charAt(0).toUpperCase()+r.riskLevel.slice(1)," Risk"]}))]}))]}),r.value)}))})),"checkbox"===t.type&&t.options&&e.jsx("div",s({className:"space-y-2"},{children:t.options.map((function(r){return e.jsxs("div",s({className:"flex items-center"},{children:[e.jsx("input",{type:"checkbox",id:"".concat(t.id,"_").concat(r.value),value:r.value,checked:!!Array.isArray(i)&&i.includes(r.value),onChange:function(e){var a=Array.isArray(i)?o([],i,!0):[];e.target.checked?n(t.id,o(o([],a,!0),[r.value],!1)):n(t.id,a.filter((function(e){return e!==r.value})))},disabled:x,className:"h-4 w-4 rounded text-blue-600 focus:ring-blue-500 border-gray-300 dark:border-gray-600"}),e.jsx("label",s({htmlFor:"".concat(t.id,"_").concat(r.value),className:"ml-2 block text-sm text-gray-900 dark:text-gray-100"},{children:r.label}))]}),r.value)}))})),"scale"===t.type&&e.jsxs("div",{children:[e.jsx("div",s({className:"flex justify-between mb-2"},{children:t.scaleLabels&&Object.entries(t.scaleLabels).map((function(r){var a=r[0],n=r[1];return e.jsx("div",s({className:"text-xs text-gray-500 dark:text-gray-400 text-center",style:{width:"".concat(100/Object.keys(t.scaleLabels||{}).length,"%")}},{children:n}),a)}))})),e.jsx("input",{type:"range",id:t.id,min:t.minValue||1,max:t.maxValue||5,value:i||t.minValue||1,onChange:function(e){return n(t.id,parseInt(e.target.value,10))},disabled:x,className:"w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer dark:bg-gray-700"}),e.jsxs("div",s({className:"mt-1 text-sm text-gray-500 dark:text-gray-400 text-center"},{children:["Selected value: ",i||t.minValue||1]}))]}),r&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:r}))]}),t.id)};return A?e.jsxs("div",s({className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 ".concat(g)},{children:[S&&e.jsxs("div",s({className:"mb-6"},{children:[e.jsxs("div",s({className:"flex justify-between text-sm text-gray-500 dark:text-gray-400 mb-1"},{children:[e.jsxs("span",{children:["Section ",i+1," of ",r.length]}),e.jsx("span",{children:void 0!==D?"".concat(D,"% Complete"):""})]})),e.jsx("div",s({className:"w-full bg-gray-200 rounded-full h-2.5 dark:bg-gray-700"},{children:e.jsx("div",{className:"bg-blue-600 h-2.5 rounded-full",style:{width:"".concat(void 0!==D?D:(i+1)/r.length*100,"%")}})}))]})),e.jsx("h2",s({className:"text-xl font-bold mb-2 text-gray-900 dark:text-white"},{children:A.title})),A.description&&e.jsx("p",s({className:"mb-6 text-gray-600 dark:text-gray-300"},{children:A.description})),e.jsx("div",s({className:"space-y-6"},{children:A.questions.map((function(e){return C(e)}))})),e.jsxs("div",s({className:"mt-8 flex justify-between"},{children:[e.jsx("button",s({type:"button",onClick:l,disabled:0===i||x,className:"px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 disabled:opacity-50 disabled:cursor-not-allowed ".concat(f)},{children:j})),e.jsx("button",s({type:"button",onClick:d,disabled:x,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 disabled:opacity-50 disabled:cursor-not-allowed ".concat(f)},{children:R?k:v}))]}))]})):e.jsx("div",{children:"No section found."})},exports.DPIAReport=function(t){var r=t.result,a=t.sections,n=t.showFullReport,i=void 0===n||n,o=t.allowPrint,d=void 0===o||o,l=t.allowExport,c=void 0===l||l,u=t.onExport,m=t.className,x=void 0===m?"":m,h=t.buttonClassName,g=void 0===h?"":h,p=function(e){return new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})},f=function(t){return e.jsx("span",s({className:"px-2 py-1 rounded text-xs font-medium ".concat({low:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",medium:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",high:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200",critical:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200"}[t])},{children:t.charAt(0).toUpperCase()+t.slice(1)}))};return e.jsxs("div",s({className:"bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 print:shadow-none print:p-0 ".concat(x)},{children:[e.jsxs("div",s({className:"mb-8 border-b border-gray-200 dark:border-gray-700 pb-6 print:pb-4"},{children:[e.jsxs("div",s({className:"flex justify-between items-start"},{children:[e.jsxs("div",{children:[e.jsx("h1",s({className:"text-2xl font-bold text-gray-900 dark:text-white mb-2"},{children:"Data Protection Impact Assessment Report"})),e.jsx("h2",s({className:"text-xl text-gray-700 dark:text-gray-300 mb-4"},{children:r.title}))]}),(d||c)&&e.jsxs("div",s({className:"flex space-x-2 print:hidden"},{children:[d&&e.jsx("button",s({onClick:function(){window.print()},className:"px-3 py-1 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ".concat(g)},{children:e.jsxs("span",s({className:"flex items-center"},{children:[e.jsx("svg",s({className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M17 17h2a2 2 0 002-2v-4a2 2 0 00-2-2H5a2 2 0 00-2 2v4a2 2 0 002 2h2m2 4h6a2 2 0 002-2v-4a2 2 0 00-2-2H9a2 2 0 00-2 2v4a2 2 0 002 2zm8-12V5a2 2 0 00-2-2H9a2 2 0 00-2 2v4h10z"})})),"Print"]}))})),c&&e.jsx("div",s({className:"relative inline-block"},{children:e.jsx("button",s({onClick:function(){return e="pdf",void(u&&u(e));var e},className:"px-3 py-1 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(g)},{children:e.jsxs("span",s({className:"flex items-center"},{children:[e.jsx("svg",s({className:"w-4 h-4 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M4 16v1a3 3 0 003 3h10a3 3 0 003-3v-1m-4-4l-4 4m0 0l-4-4m4 4V4"})})),"Export PDF"]}))}))}))]}))]})),e.jsxs("div",s({className:"grid grid-cols-1 md:grid-cols-2 gap-4 mt-4"},{children:[e.jsxs("div",{children:[e.jsxs("p",s({className:"text-sm text-gray-500 dark:text-gray-400"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Assessor:"}))," ",r.assessor.name,", ",r.assessor.role]})),e.jsxs("p",s({className:"text-sm text-gray-500 dark:text-gray-400"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Contact:"}))," ",r.assessor.email]}))]}),e.jsxs("div",{children:[e.jsxs("p",s({className:"text-sm text-gray-500 dark:text-gray-400"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Started:"}))," ",p(r.startedAt)]})),e.jsxs("p",s({className:"text-sm text-gray-500 dark:text-gray-400"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Completed:"}))," ",r.completedAt?p(r.completedAt):"In progress"]})),e.jsxs("p",s({className:"text-sm text-gray-500 dark:text-gray-400"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Next review:"}))," ",r.reviewDate?p(r.reviewDate):"Not scheduled"]}))]})]}))]})),e.jsxs("div",s({className:"mb-8"},{children:[e.jsx("h2",s({className:"text-xl font-bold text-gray-900 dark:text-white mb-4"},{children:"Executive Summary"})),e.jsxs("div",s({className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-4"},{children:[e.jsxs("div",s({className:"flex items-center mb-2"},{children:[e.jsx("span",s({className:"font-medium mr-2"},{children:"Overall Risk Level:"})),f(r.overallRiskLevel)]})),e.jsxs("div",s({className:"mb-2"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Conclusion:"}))," ",r.conclusion]})),e.jsxs("div",{children:[e.jsx("span",s({className:"font-medium"},{children:"Can Proceed:"}))," ",r.canProceed?"Yes":"No"]})]})),e.jsxs("div",{children:[e.jsx("h3",s({className:"font-medium text-gray-900 dark:text-white mb-2"},{children:"Processing Activity Description"})),e.jsx("p",s({className:"text-gray-700 dark:text-gray-300 mb-4"},{children:r.processingDescription})),r.recommendations&&r.recommendations.length>0&&e.jsxs("div",{children:[e.jsx("h3",s({className:"font-medium text-gray-900 dark:text-white mb-2"},{children:"Key Recommendations"})),e.jsx("ul",s({className:"list-disc pl-5 text-gray-700 dark:text-gray-300"},{children:r.recommendations.map((function(t,r){return e.jsx("li",{children:t},r)}))}))]})]})]})),e.jsxs("div",s({className:"mb-8"},{children:[e.jsx("h2",s({className:"text-xl font-bold text-gray-900 dark:text-white mb-4"},{children:"Identified Risks"})),0===r.risks.length?e.jsx("p",s({className:"text-gray-700 dark:text-gray-300"},{children:"No risks identified."})):e.jsx("div",s({className:"overflow-x-auto"},{children:e.jsxs("table",s({className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700"},{children:[e.jsx("thead",s({className:"bg-gray-50 dark:bg-gray-700"},{children:e.jsxs("tr",{children:[e.jsx("th",s({scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"},{children:"Risk"})),e.jsx("th",s({scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"},{children:"Likelihood"})),e.jsx("th",s({scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"},{children:"Impact"})),e.jsx("th",s({scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"},{children:"Risk Level"})),e.jsx("th",s({scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"},{children:"Mitigated"}))]})})),e.jsx("tbody",s({className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700"},{children:r.risks.map((function(t){return e.jsxs("tr",{children:[e.jsx("td",s({className:"px-6 py-4 whitespace-normal text-sm text-gray-900 dark:text-gray-100"},{children:t.description})),e.jsxs("td",s({className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400"},{children:[t.likelihood," / 5"]})),e.jsxs("td",s({className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400"},{children:[t.impact," / 5"]})),e.jsx("td",s({className:"px-6 py-4 whitespace-nowrap text-sm"},{children:f(t.level)})),e.jsx("td",s({className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-400"},{children:t.mitigated?e.jsx("span",s({className:"text-green-600 dark:text-green-400"},{children:"Yes"})):e.jsx("span",s({className:"text-red-600 dark:text-red-400"},{children:"No"}))}))]},t.id)}))}))]}))}))]})),i&&e.jsxs("div",{children:[e.jsx("h2",s({className:"text-xl font-bold text-gray-900 dark:text-white mb-4"},{children:"Full Assessment Details"})),a.map((function(t){var a=t.questions.filter((function(e){return void 0!==r.answers[e.id]}));return 0===a.length?null:e.jsxs("div",s({className:"mb-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium text-gray-900 dark:text-white mb-2"},{children:t.title})),e.jsx("div",s({className:"overflow-x-auto"},{children:e.jsxs("table",s({className:"min-w-full divide-y divide-gray-200 dark:divide-gray-700"},{children:[e.jsx("thead",s({className:"bg-gray-50 dark:bg-gray-700"},{children:e.jsxs("tr",{children:[e.jsx("th",s({scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"},{children:"Question"})),e.jsx("th",s({scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"},{children:"Answer"}))]})})),e.jsx("tbody",s({className:"bg-white dark:bg-gray-800 divide-y divide-gray-200 dark:divide-gray-700"},{children:a.map((function(t){return e.jsxs("tr",{children:[e.jsx("td",s({className:"px-6 py-4 whitespace-normal text-sm text-gray-900 dark:text-gray-100"},{children:t.text})),e.jsx("td",s({className:"px-6 py-4 whitespace-normal text-sm text-gray-500 dark:text-gray-400"},{children:(a=t.id,n=r.answers[a],null==n?"Not answered":"boolean"==typeof n?n?"Yes":"No":Array.isArray(n)?n.join(", "):String(n))}))]},t.id);var a,n}))}))]}))}))]}),t.id)}))]}),e.jsxs("div",s({className:"mt-8 pt-4 border-t border-gray-200 dark:border-gray-700 text-sm text-gray-500 dark:text-gray-400"},{children:[e.jsx("p",{children:"This DPIA was conducted in accordance with the Nigeria Data Protection Regulation (NDPR)."}),e.jsxs("p",{children:["DPIA Report Version: ",r.version]}),e.jsxs("p",{children:["Generated on: ",(new Date).toLocaleDateString()]})]}))]}))},exports.DSRDashboard=function(r){var a=r.requests,n=r.onSelectRequest,i=r.onUpdateStatus,l=r.onAssignRequest,c=r.title,u=void 0===c?"Data Subject Request Dashboard":c,m=r.description,x=void 0===m?"Track and manage data subject requests in compliance with NDPR requirements.":m,h=r.className,g=void 0===h?"":h,p=r.buttonClassName,f=void 0===p?"":p,b=r.showRequestDetails,v=void 0===b||b,y=r.showRequestTimeline,j=void 0===y||y,N=r.showDeadlineAlerts,k=void 0===N||N,w=r.assignees,S=void 0===w?[]:w,D=t.useState(null),A=D[0],R=D[1],C=t.useState(a),q=C[0],I=C[1],T=t.useState("all"),P=T[0],E=T[1],F=t.useState("all"),L=F[0],O=F[1],B=t.useState(""),U=B[0],V=B[1],M=t.useState("createdAt"),z=M[0],_=M[1],H=t.useState("desc"),J=H[0];H[1];var W=t.useState(""),G=W[0],Y=W[1];t.useEffect((function(){var e=o([],a,!0);if("all"!==P&&(e=e.filter((function(e){return e.status===P}))),"all"!==L&&(e=e.filter((function(e){return e.type===L}))),U){var t=U.toLowerCase();e=e.filter((function(e){return e.subject.name.toLowerCase().includes(t)||e.subject.email.toLowerCase().includes(t)||e.description&&e.description.toLowerCase().includes(t)}))}e.sort((function(e,t){var r=0;switch(z){case"createdAt":default:r=e.createdAt-t.createdAt;break;case"dueDate":r=(e.dueDate||0)-(t.dueDate||0);break;case"type":r=e.type.localeCompare(t.type);break;case"status":r=e.status.localeCompare(t.status)}return"asc"===J?r:-r})),I(e)}),[a,P,L,U,z,J]),t.useEffect((function(){q.length>0&&!A&&R(q[0].id)}),[q,A]);var K,Q,$=function(e){A&&i&&i(A,e)},X=function(e){return new Date(e).toLocaleDateString()},Z=function(e){var t=(e-Date.now())/864e5;return Math.ceil(t)},ee=A?a.find((function(e){return e.id===A})):null,te=function(t){return e.jsx("span",s({className:"px-2 py-1 rounded text-xs font-medium ".concat({access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200"}[t])},{children:t.charAt(0).toUpperCase()+t.slice(1)}))},re=function(t){return e.jsx("span",s({className:"px-2 py-1 rounded text-xs font-medium ".concat({pending:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",inProgress:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",completed:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",rejected:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",awaitingVerification:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200"}[t])},{children:"inProgress"===t?"In Progress":"awaitingVerification"===t?"Awaiting Verification":t.charAt(0).toUpperCase()+t.slice(1)}))};return e.jsxs("div",s({className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ".concat(g)},{children:[e.jsx("h2",s({className:"text-xl font-bold mb-2"},{children:u})),e.jsx("p",s({className:"mb-6 text-gray-600 dark:text-gray-300"},{children:x})),e.jsxs("div",s({className:"mb-6 grid grid-cols-1 md:grid-cols-4 gap-4"},{children:[e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"statusFilter",className:"block text-sm font-medium mb-1"},{children:"Status Filter"})),e.jsx("select",s({id:"statusFilter",value:P,onChange:function(e){return E(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},{children:[{value:"all",label:"All Statuses"},{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map((function(t){return e.jsx("option",s({value:t.value},{children:t.label}),t.value)}))}))]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"typeFilter",className:"block text-sm font-medium mb-1"},{children:"Request Type Filter"})),e.jsx("select",s({id:"typeFilter",value:L,onChange:function(e){return O(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},{children:[{value:"all",label:"All Types"},{value:"access",label:"Access"},{value:"rectification",label:"Rectification"},{value:"erasure",label:"Erasure"},{value:"restriction",label:"Restriction"},{value:"portability",label:"Portability"},{value:"objection",label:"Objection"}].map((function(t){return e.jsx("option",s({value:t.value},{children:t.label}),t.value)}))}))]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"sortBy",className:"block text-sm font-medium mb-1"},{children:"Sort By"})),e.jsxs("select",s({id:"sortBy",value:z,onChange:function(e){return _(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},{children:[e.jsx("option",s({value:"createdAt"},{children:"Date Received"})),e.jsx("option",s({value:"dueDate"},{children:"Due Date"})),e.jsx("option",s({value:"type"},{children:"Request Type"})),e.jsx("option",s({value:"status"},{children:"Status"}))]}))]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"searchTerm",className:"block text-sm font-medium mb-1"},{children:"Search"})),e.jsx("input",{type:"text",id:"searchTerm",value:U,onChange:function(e){return V(e.target.value)},placeholder:"Search requests...",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]})),e.jsxs("div",s({className:"grid grid-cols-1 md:grid-cols-3 gap-6"},{children:[e.jsxs("div",s({className:"md:col-span-1"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-3"},{children:"DSR Requests"})),0===q.length?e.jsx("p",s({className:"text-gray-500 dark:text-gray-400 text-sm"},{children:"No data subject requests found."})):e.jsx("div",s({className:"space-y-2 max-h-96 overflow-y-auto pr-2"},{children:q.map((function(t){var r=t.dueDate?Z(t.dueDate):null,a=null;return null!==r&&(r<=0?a=e.jsx("span",s({className:"text-xs text-red-600 dark:text-red-400 font-bold"},{children:"Overdue"})):r<=3?a=e.jsx("span",s({className:"text-xs text-red-600 dark:text-red-400"},{children:"Urgent"})):r<=7&&(a=e.jsx("span",s({className:"text-xs text-yellow-600 dark:text-yellow-400"},{children:"Soon"})))),e.jsxs("div",s({className:"p-3 rounded-md cursor-pointer ".concat(A===t.id?"bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800":"bg-gray-50 dark:bg-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600"),onClick:function(){return e=t.id,R(e),void(n&&n(e));var e}},{children:[e.jsxs("div",s({className:"flex justify-between items-start mb-1"},{children:[e.jsx("h4",s({className:"font-medium text-sm"},{children:t.subject.name})),te(t.type)]})),e.jsx("p",s({className:"text-xs text-gray-500 dark:text-gray-400 mb-1"},{children:t.subject.email})),e.jsxs("p",s({className:"text-xs text-gray-500 dark:text-gray-400 mb-1"},{children:["Received: ",X(t.createdAt)]})),e.jsxs("div",s({className:"flex justify-between items-center mt-2"},{children:[e.jsx("div",{children:re(t.status)}),e.jsx("div",{children:a})]}))]}),t.id)}))}))]})),e.jsx("div",s({className:"md:col-span-2"},{children:ee?e.jsxs("div",{children:[e.jsxs("div",s({className:"flex justify-between items-start mb-4"},{children:[e.jsx("h3",s({className:"text-lg font-medium"},{children:ee.subject.name})),e.jsxs("div",s({className:"flex space-x-2"},{children:[te(ee.type),re(ee.status)]}))]})),k&&ee.dueDate&&e.jsx("div",s({className:"mb-4"},{children:function(t){if(!t.dueDate)return null;var r=Z(t.dueDate);return r<=0?e.jsxs("div",s({className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md"},{children:[e.jsx("p",s({className:"text-sm text-red-800 dark:text-red-200 font-medium"},{children:"Deadline Passed"})),e.jsx("p",s({className:"text-xs text-red-700 dark:text-red-300 mt-1"},{children:"The response deadline has passed. Immediate action is required."}))]})):r<=3?e.jsxs("div",s({className:"bg-red-50 dark:bg-red-900/20 p-3 rounded-md"},{children:[e.jsx("p",s({className:"text-sm text-red-800 dark:text-red-200 font-medium"},{children:"Urgent: Deadline Approaching"})),e.jsxs("p",s({className:"text-xs text-red-700 dark:text-red-300 mt-1"},{children:["Only ",r," day",1!==r?"s":""," remaining until the response deadline."]}))]})):r<=7?e.jsxs("div",s({className:"bg-yellow-50 dark:bg-yellow-900/20 p-3 rounded-md"},{children:[e.jsx("p",s({className:"text-sm text-yellow-800 dark:text-yellow-200 font-medium"},{children:"Deadline Approaching"})),e.jsxs("p",s({className:"text-xs text-yellow-700 dark:text-yellow-300 mt-1"},{children:[r," days remaining until the response deadline."]}))]})):e.jsxs("div",s({className:"bg-green-50 dark:bg-green-900/20 p-3 rounded-md"},{children:[e.jsx("p",s({className:"text-sm text-green-800 dark:text-green-200 font-medium"},{children:"Deadline Tracking"})),e.jsxs("p",s({className:"text-xs text-green-700 dark:text-green-300 mt-1"},{children:[r," days remaining until the response deadline."]}))]}))}(ee)})),v&&e.jsxs("div",s({className:"mb-6"},{children:[e.jsxs("div",s({className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4"},{children:[e.jsxs("div",{children:[e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Email:"}))," ",ee.subject.email]})),ee.subject.phone&&e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Phone:"}))," ",ee.subject.phone]})),e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Received:"}))," ",X(ee.createdAt)]}))]}),e.jsxs("div",{children:[e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Request Type:"}))," ",ee.type.charAt(0).toUpperCase()+ee.type.slice(1)]})),e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Status:"}))," ","inProgress"===ee.status?"In Progress":"awaitingVerification"===ee.status?"Awaiting Verification":ee.status.charAt(0).toUpperCase()+ee.status.slice(1)]})),ee.dueDate&&e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Due Date:"}))," ",X(ee.dueDate)]}))]})]})),ee.description&&e.jsxs("div",s({className:"mb-4"},{children:[e.jsx("p",s({className:"text-sm font-medium"},{children:"Request Details:"})),e.jsx("p",s({className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1"},{children:ee.description}))]})),ee.additionalInfo&&e.jsxs("div",{children:[e.jsx("p",s({className:"text-sm font-medium"},{children:"Additional Information:"})),e.jsx("p",s({className:"text-sm text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-700 p-2 rounded-md mt-1"},{children:"object"==typeof ee.additionalInfo?JSON.stringify(ee.additionalInfo,null,2):String(ee.additionalInfo||"No additional information provided")}))]})]})),e.jsxs("div",s({className:"mb-6 grid grid-cols-1 md:grid-cols-2 gap-4"},{children:[e.jsxs("div",{children:[e.jsx("h3",s({className:"text-md font-medium mb-2"},{children:"Update Status"})),e.jsxs("div",s({className:"flex space-x-2"},{children:[e.jsx("select",s({value:ee.status,onChange:function(e){return $(e.target.value)},className:"flex-grow px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},{children:[{value:"pending",label:"Pending"},{value:"awaitingVerification",label:"Awaiting Verification"},{value:"inProgress",label:"In Progress"},{value:"completed",label:"Completed"},{value:"rejected",label:"Rejected"}].map((function(t){return e.jsx("option",s({value:t.value},{children:t.label}),t.value)}))})),e.jsx("button",s({onClick:function(){return $(ee.status)},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(f)},{children:"Update"}))]}))]}),S.length>0&&e.jsxs("div",{children:[e.jsx("h3",s({className:"text-md font-medium mb-2"},{children:"Assign Request"})),e.jsxs("div",s({className:"flex space-x-2"},{children:[e.jsxs("select",s({value:G,onChange:function(e){return Y(e.target.value)},className:"flex-grow px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},{children:[e.jsx("option",s({value:""},{children:"Select Assignee"})),S.map((function(t){return e.jsx("option",s({value:t},{children:t}),t)}))]})),e.jsx("button",s({onClick:function(){A&&G&&l&&(l(A,G),Y(""))},disabled:!G,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 disabled:bg-gray-300 disabled:text-gray-500 ".concat(f)},{children:"Assign"}))]}))]})]})),e.jsxs("div",s({className:"mb-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-3"},{children:"Request Summary"})),e.jsx("div",s({className:"bg-gray-50 dark:bg-gray-700 p-3 rounded-md"},{children:e.jsx("pre",s({className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200"},{children:e.jsx("pre",{children:JSON.stringify(d(ee),null,2)})}))}))]})),j&&(K=ee,Q=[{title:"Request Received",date:K.createdAt,completed:!0,description:"Request was received on ".concat(X(K.createdAt),".")}],K.verifiedAt?Q.push({title:"Identity Verified",date:K.verifiedAt,completed:!0,description:"Data subject's identity was verified on ".concat(X(K.verifiedAt),".")}):"awaitingVerification"===K.status&&Q.push({title:"Identity Verification",date:Date.now(),completed:!1,description:"Awaiting verification of data subject's identity."}),"inProgress"!==K.status&&"completed"!==K.status&&"rejected"!==K.status||Q.push({title:"Processing Started",date:K.updatedAt,completed:!0,description:"Request processing started on ".concat(X(K.updatedAt),".")}),"completed"===K.status?Q.push({title:"Request Completed",date:K.completedAt||Date.now(),completed:!0,description:"Request was completed on ".concat(X(K.completedAt||Date.now()),".")}):"rejected"===K.status&&Q.push({title:"Request Rejected",date:K.completedAt||Date.now(),completed:!0,description:"Request was rejected on ".concat(X(K.completedAt||Date.now()),".").concat(K.rejectionReason?" Reason: ".concat(K.rejectionReason):"")}),K.dueDate&&Q.push({title:"Response Deadline",date:K.dueDate,completed:Date.now()>K.dueDate,description:"Response is due by ".concat(X(K.dueDate),".")}),e.jsxs("div",s({className:"mt-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-4"},{children:"Request Timeline"})),e.jsx("ol",s({className:"relative border-l border-gray-200 dark:border-gray-700"},{children:Q.map((function(t,r){return e.jsxs("li",s({className:"mb-6 ml-4"},{children:[e.jsx("div",{className:"absolute w-3 h-3 rounded-full mt-1.5 -left-1.5 border ".concat(t.completed?"bg-green-500 border-green-500 dark:border-green-500":"bg-gray-200 border-gray-200 dark:bg-gray-700 dark:border-gray-700")}),e.jsx("time",s({className:"mb-1 text-sm font-normal leading-none text-gray-400 dark:text-gray-500"},{children:t.date?X(t.date):"Pending"})),e.jsx("h4",s({className:"text-sm font-semibold text-gray-900 dark:text-white"},{children:t.title})),e.jsx("p",s({className:"text-xs text-gray-500 dark:text-gray-400"},{children:t.description}))]}),r)}))}))]})))]}):e.jsx("div",s({className:"flex items-center justify-center h-64 bg-gray-50 dark:bg-gray-700 rounded-md"},{children:e.jsx("p",s({className:"text-gray-500 dark:text-gray-400"},{children:"Select a request to view details"}))}))}))]}))]}))},exports.DSRRequestForm=function(r){var a,n=r.requestTypes,i=r.onSubmit,o=r.title,d=void 0===o?"Submit a Data Subject Request":o,l=r.description,c=void 0===l?"Use this form to exercise your rights under the Nigeria Data Protection Regulation (NDPR).":l,u=r.submitButtonText,m=void 0===u?"Submit Request":u,x=r.className,h=void 0===x?"":x,g=r.buttonClassName,p=void 0===g?"":g,f=r.showConfirmation,b=void 0===f||f,v=r.confirmationMessage,y=void 0===v?"Your request has been submitted successfully. You will receive a confirmation email shortly.":v,j=r.requireIdentityVerification,N=void 0===j||j,k=r.identifierTypes,w=void 0===k?[{id:"email",label:"Email Address"},{id:"account",label:"Account Number"},{id:"customer_id",label:"Customer ID"}]:k,S=r.collectAdditionalContact,D=void 0===S||S,A=r.labels,R=void 0===A?{}:A,C=t.useState(""),q=C[0],I=C[1],T=t.useState(""),P=T[0],E=T[1],F=t.useState(""),L=F[0],O=F[1],B=t.useState(""),U=B[0],V=B[1],M=t.useState((null===(a=w[0])||void 0===a?void 0:a.id)||""),z=M[0],_=M[1],H=t.useState(""),J=H[0],W=H[1],G=t.useState({}),Y=G[0],K=G[1],Q=t.useState(!1),$=Q[0],X=Q[1],Z=t.useState({}),ee=Z[0],te=Z[1],re=n.find((function(e){return e.id===q})),ae=function(e,t){K((function(r){var a;return s(s({},r),((a={})[e]=t,a))}))};return $?e.jsxs("div",s({className:"p-4 bg-green-50 dark:bg-green-900/20 rounded-md ".concat(h)},{children:[e.jsx("h2",s({className:"text-lg font-bold text-green-800 dark:text-green-200 mb-2"},{children:"Request Submitted"})),e.jsx("p",s({className:"text-green-700 dark:text-green-300"},{children:y})),e.jsx("button",s({onClick:function(){return X(!1)},className:"mt-4 px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ".concat(p)},{children:"Submit Another Request"}))]})):e.jsxs("div",s({className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ".concat(h)},{children:[e.jsx("h2",s({className:"text-xl font-bold mb-2"},{children:d})),e.jsx("p",s({className:"mb-6 text-gray-600 dark:text-gray-300"},{children:c})),e.jsx("form",s({onSubmit:function(e){if(e.preventDefault(),t={},P.trim()||(t.fullName="Full name is required"),L.trim()?/\S+@\S+\.\S+/.test(L)||(t.email="Email is invalid"):t.email="Email is required",q||(t.requestType="Please select a request type"),N&&!J.trim()&&(t.identifierValue="Identifier value is required"),(null==re?void 0:re.requiresAdditionalInfo)&&re.additionalFields&&re.additionalFields.forEach((function(e){e.required&&!Y[e.id]&&(t["additional_".concat(e.id)]="".concat(e.label," is required"))})),te(t),0===Object.keys(t).length){var t,r={requestType:q,dataSubject:{fullName:P,email:L,phone:U||void 0,identifierType:z,identifierValue:J},additionalInfo:Object.keys(Y).length>0?Y:void 0,submittedAt:Date.now()};i(r),b&&X(!0)}}},{children:e.jsxs("div",s({className:"space-y-4"},{children:[e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Personal Information"})),e.jsxs("div",s({className:"grid grid-cols-1 gap-4 md:grid-cols-2"},{children:[e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"fullName",className:"block text-sm font-medium mb-1"},{children:[R.name||"Full Name"," ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("input",{type:"text",id:"fullName",value:P,onChange:function(e){return E(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),ee.fullName&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:ee.fullName}))]}),e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"email",className:"block text-sm font-medium mb-1"},{children:[R.email||"Email Address"," ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("input",{type:"email",id:"email",value:L,onChange:function(e){return O(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),ee.email&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:ee.email}))]}),D&&e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"phone",className:"block text-sm font-medium mb-1"},{children:"Phone Number (Optional)"})),e.jsx("input",{type:"tel",id:"phone",value:U,onChange:function(e){return V(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}))]}),e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Request Details"})),e.jsxs("div",s({className:"mb-4"},{children:[e.jsxs("label",s({htmlFor:"requestType",className:"block text-sm font-medium mb-1"},{children:[R.requestType||"Request Type"," ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsxs("select",s({id:"requestType",value:q,onChange:function(e){I(e.target.value),K({})},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0},{children:[e.jsx("option",s({value:""},{children:"Select a request type"})),n.map((function(t){return e.jsx("option",s({value:t.id},{children:t.name}),t.id)}))]})),ee.requestType&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:ee.requestType}))]})),re&&e.jsxs("div",s({className:"mb-4 p-3 bg-gray-50 dark:bg-gray-700 rounded-md"},{children:[e.jsx("p",s({className:"text-sm text-gray-600 dark:text-gray-300 mb-2"},{children:re.description})),e.jsxs("p",s({className:"text-sm text-gray-500 dark:text-gray-400"},{children:["Estimated completion time: ",re.estimatedCompletionTime," ",1===re.estimatedCompletionTime?"day":"days"]}))]})),e.jsxs("div",s({className:"mb-4"},{children:[e.jsx("label",s({htmlFor:"requestDescription",className:"block text-sm font-medium mb-1"},{children:R.description||"Additional Information"})),e.jsx("textarea",{id:"requestDescription",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",rows:4,placeholder:"Please provide any additional details that might help us process your request"})]}))]}),N&&e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Identity Verification"})),e.jsx("p",s({className:"text-sm text-gray-600 dark:text-gray-300 mb-3"},{children:"To protect your privacy, we need to verify your identity before processing your request."})),e.jsxs("div",s({className:"grid grid-cols-1 gap-4 md:grid-cols-2"},{children:[e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"identifierType",className:"block text-sm font-medium mb-1"},{children:["Identifier Type ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("select",s({id:"identifierType",value:z,onChange:function(e){return _(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0},{children:w.map((function(t){return e.jsx("option",s({value:t.id},{children:t.label}),t.id)}))}))]}),e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"identifierValue",className:"block text-sm font-medium mb-1"},{children:["Identifier Value ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("input",{type:"text",id:"identifierValue",value:J,onChange:function(e){return W(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0}),ee.identifierValue&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:ee.identifierValue}))]})]}))]}),(null==re?void 0:re.requiresAdditionalInfo)&&re.additionalFields&&re.additionalFields.length>0&&e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Additional Information"})),e.jsx("div",s({className:"space-y-4"},{children:re.additionalFields.map((function(t){return e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:t.id,className:"block text-sm font-medium mb-1"},{children:[t.label," ",t.required&&e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),"text"===t.type&&e.jsx("input",{type:"text",id:t.id,value:Y[t.id]||"",onChange:function(e){return ae(t.id,e.target.value)},placeholder:t.placeholder,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:t.required}),"textarea"===t.type&&e.jsx("textarea",{id:t.id,value:Y[t.id]||"",onChange:function(e){return ae(t.id,e.target.value)},placeholder:t.placeholder,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",rows:4,required:t.required}),"select"===t.type&&t.options&&e.jsxs("select",s({id:t.id,value:Y[t.id]||"",onChange:function(e){return ae(t.id,e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:t.required},{children:[e.jsx("option",s({value:""},{children:t.placeholder||"Select an option"})),t.options.map((function(t){return e.jsx("option",s({value:t},{children:t}),t)}))]})),"checkbox"===t.type&&e.jsxs("div",s({className:"flex items-start"},{children:[e.jsx("div",s({className:"flex items-center h-5"},{children:e.jsx("input",{type:"checkbox",id:t.id,checked:!!Y[t.id],onChange:function(e){return ae(t.id,e.target.checked)},className:"h-4 w-4 rounded border-gray-300 text-blue-600 focus:ring-blue-500",required:t.required})})),e.jsx("div",s({className:"ml-3 text-sm"},{children:e.jsx("label",s({htmlFor:t.id,className:"text-gray-700 dark:text-gray-300"},{children:t.placeholder||t.label}))}))]})),"file"===t.type&&e.jsx("input",{type:"file",id:t.id,onChange:function(e){var r,a=null===(r=e.target.files)||void 0===r?void 0:r[0];a&&ae(t.id,a)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:t.required}),ee["additional_".concat(t.id)]&&e.jsx("p",s({className:"mt-1 text-sm text-red-500"},{children:ee["additional_".concat(t.id)]}))]},t.id)}))}))]}),e.jsxs("div",s({className:"mt-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md"},{children:[e.jsx("h3",s({className:"text-sm font-semibold mb-2"},{children:"Privacy Notice"})),e.jsx("p",s({className:"text-xs text-gray-600 dark:text-gray-300"},{children:"The information you provide in this form will be used solely for the purpose of processing your data subject request. We will retain this information for as long as necessary to fulfill your request and to comply with our legal obligations. For more information, please refer to our Privacy Policy."}))]})),e.jsx("div",s({className:"mt-6"},{children:e.jsx("button",s({type:"submit",className:"px-6 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(p)},{children:R.submit||m}))}))]}))}))]}))},exports.DSRTracker=function(r){var a=r.requests,n=r.onSelectRequest,i=r.title,d=void 0===i?"DSR Request Tracker":i,l=r.description,c=void 0===l?"Track the status and progress of data subject requests.":l,u=r.className,m=void 0===u?"":u;r.buttonClassName;var x=r.showSummaryStats,h=void 0===x||x,g=r.showTypeBreakdown,p=void 0===g||g,f=r.showStatusBreakdown,b=void 0===f||f,v=r.showTimelineChart,y=void 0===v||v,j=r.showOverdueRequests,N=void 0===j||j,k=t.useState("30days"),w=k[0],S=k[1],D=t.useState(a),A=D[0],R=D[1],C=t.useState([]),q=C[0],I=C[1],T=t.useState([]),P=T[0],E=T[1];t.useEffect((function(){var e,t=Date.now();switch(w){case"7days":e=a.filter((function(e){return t-e.createdAt<=6048e5}));break;case"30days":e=a.filter((function(e){return t-e.createdAt<=2592e6}));break;case"90days":e=a.filter((function(e){return t-e.createdAt<=7776e6}));break;default:e=o([],a,!0)}R(e);var r=e.filter((function(e){return e.dueDate&&t>e.dueDate&&"completed"!==e.status&&"rejected"!==e.status}));I(r);var s=e.filter((function(e){return e.dueDate&&t<e.dueDate&&e.dueDate-t<=6048e5&&"completed"!==e.status&&"rejected"!==e.status}));E(s)}),[a,w]);var F,L,O,B,U=function(e){n&&n(e)},V=function(e){return new Date(e).toLocaleDateString()},M=function(e){var t=(e-Date.now())/864e5;return Math.ceil(t)},z=function(t){return e.jsx("span",s({className:"px-2 py-1 rounded text-xs font-medium ".concat({access:"bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200",rectification:"bg-green-100 text-green-800 dark:bg-green-900 dark:text-green-200",erasure:"bg-red-100 text-red-800 dark:bg-red-900 dark:text-red-200",restriction:"bg-yellow-100 text-yellow-800 dark:bg-yellow-900 dark:text-yellow-200",portability:"bg-purple-100 text-purple-800 dark:bg-purple-900 dark:text-purple-200",objection:"bg-orange-100 text-orange-800 dark:bg-orange-900 dark:text-orange-200"}[t])},{children:t.charAt(0).toUpperCase()+t.slice(1)}))};return e.jsxs("div",s({className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ".concat(m)},{children:[e.jsxs("div",s({className:"flex flex-col md:flex-row md:justify-between md:items-center mb-6"},{children:[e.jsxs("div",{children:[e.jsx("h2",s({className:"text-xl font-bold mb-2"},{children:d})),e.jsx("p",s({className:"text-gray-600 dark:text-gray-300"},{children:c}))]}),e.jsxs("div",s({className:"mt-4 md:mt-0"},{children:[e.jsx("label",s({htmlFor:"timeframe",className:"block text-sm font-medium mb-1"},{children:"Timeframe"})),e.jsxs("select",s({id:"timeframe",value:w,onChange:function(e){return S(e.target.value)},className:"px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},{children:[e.jsx("option",s({value:"7days"},{children:"Last 7 Days"})),e.jsx("option",s({value:"30days"},{children:"Last 30 Days"})),e.jsx("option",s({value:"90days"},{children:"Last 90 Days"})),e.jsx("option",s({value:"all"},{children:"All Time"}))]}))]}))]})),h&&function(){var t=A.length,r=A.filter((function(e){return"completed"!==e.status&&"rejected"!==e.status})).length;A.filter((function(e){return"completed"===e.status||"rejected"===e.status})).length;var a=function(){var e=A.filter((function(e){return"completed"===e.status&&e.completedAt&&e.createdAt}));if(0===e.length)return null;var t=e.reduce((function(e,t){return e+((t.completedAt||0)-t.createdAt)/864e5}),0);return Number((t/e.length).toFixed(1))}(),n=function(){var e=A.filter((function(e){return("completed"===e.status||"rejected"===e.status)&&e.completedAt&&e.dueDate}));if(0===e.length)return null;var t=e.filter((function(e){return(e.completedAt||0)<=(e.dueDate||0)}));return Math.round(t.length/e.length*100)}();return e.jsxs("div",s({className:"grid grid-cols-2 md:grid-cols-4 gap-4 mb-6"},{children:[e.jsxs("div",s({className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow"},{children:[e.jsx("h4",s({className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1"},{children:"Total Requests"})),e.jsx("p",s({className:"text-2xl font-bold"},{children:t}))]})),e.jsxs("div",s({className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow"},{children:[e.jsx("h4",s({className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1"},{children:"Pending Requests"})),e.jsx("p",s({className:"text-2xl font-bold"},{children:r}))]})),e.jsxs("div",s({className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow"},{children:[e.jsx("h4",s({className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1"},{children:"Avg. Response Time"})),e.jsx("p",s({className:"text-2xl font-bold"},{children:null!==a?"".concat(a," days"):"N/A"}))]})),e.jsxs("div",s({className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow"},{children:[e.jsx("h4",s({className:"text-sm font-medium text-gray-500 dark:text-gray-400 mb-1"},{children:"Compliance Rate"})),e.jsx("p",s({className:"text-2xl font-bold"},{children:null!==n?"".concat(n,"%"):"N/A"}))]}))]}))}(),e.jsxs("div",s({className:"grid grid-cols-1 md:grid-cols-2 gap-6"},{children:[e.jsxs("div",{children:[p&&(F={},A.forEach((function(e){F[e.type]=(F[e.type]||0)+1})),L={access:F.access||0,rectification:F.rectification||0,erasure:F.erasure||0,restriction:F.restriction||0,portability:F.portability||0,objection:F.objection||0},O=A.length,B=Object.entries(L).sort((function(e,t){var r=e[1];return t[1]-r})).map((function(e){return e[0]})),e.jsxs("div",s({className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-4"},{children:"Request Types"})),0===O?e.jsx("p",s({className:"text-gray-500 dark:text-gray-400 text-sm"},{children:"No data available for the selected timeframe."})):e.jsx("div",s({className:"space-y-4"},{children:B.map((function(t){var r=L[t],a=Math.round(r/O*100);return e.jsxs("div",{children:[e.jsxs("div",s({className:"flex justify-between items-center mb-1"},{children:[e.jsxs("div",s({className:"flex items-center"},{children:[z(t),e.jsxs("span",s({className:"ml-2 text-sm"},{children:[r," requests"]}))]})),e.jsxs("span",s({className:"text-sm font-medium"},{children:[a,"%"]}))]})),e.jsx("div",s({className:"w-full bg-gray-200 dark:bg-gray-600 rounded-full h-2.5"},{children:e.jsx("div",{className:"bg-blue-600 h-2.5 rounded-full",style:{width:"".concat(a,"%")}})}))]},t)}))}))]}))),b&&function(){var t,r=(t={},A.forEach((function(e){t[e.status]=(t[e.status]||0)+1})),{pending:t.pending||0,awaitingVerification:t.awaitingVerification||0,inProgress:t.inProgress||0,completed:t.completed||0,rejected:t.rejected||0}),a=A.length,n=["pending","awaitingVerification","inProgress","completed","rejected"],i={pending:"bg-yellow-500",awaitingVerification:"bg-purple-500",inProgress:"bg-blue-500",completed:"bg-green-500",rejected:"bg-red-500"};return e.jsxs("div",s({className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-4"},{children:"Request Status"})),0===a?e.jsx("p",s({className:"text-gray-500 dark:text-gray-400 text-sm"},{children:"No data available for the selected timeframe."})):e.jsxs("div",{children:[e.jsx("div",s({className:"flex h-4 mb-2"},{children:n.map((function(t){var s=r[t],n=s/a*100;return n>0?e.jsx("div",{className:"".concat(i[t]," first:rounded-l-full last:rounded-r-full"),style:{width:"".concat(n,"%")},title:"".concat(t,": ").concat(s," (").concat(Math.round(n),"%)")},t):null}))})),e.jsx("div",s({className:"grid grid-cols-2 md:grid-cols-5 gap-2 mt-4"},{children:n.map((function(t){var n=r[t],o=Math.round(n/a*100);return e.jsxs("div",s({className:"flex items-center"},{children:[e.jsx("div",{className:"w-3 h-3 rounded-full ".concat(i[t]," mr-2")}),e.jsxs("div",{children:[e.jsx("p",s({className:"text-xs font-medium"},{children:"inProgress"===t?"In Progress":"awaitingVerification"===t?"Awaiting Verification":t.charAt(0).toUpperCase()+t.slice(1)})),e.jsxs("p",s({className:"text-xs text-gray-500 dark:text-gray-400"},{children:[n," (",o,"%)"]}))]})]}),t)}))}))]})]}))}()]}),e.jsxs("div",{children:[y&&function(){var t={};A.forEach((function(e){var r=new Date(e.createdAt),a="".concat(r.getFullYear(),"-").concat(String(r.getMonth()+1).padStart(2,"0"));t[a]=(t[a]||0)+1}));var r=Object.keys(t).sort().slice(-6),a=Math.max.apply(Math,o(o([],Object.values(t).filter((function(e){return e>0})),!1),[1],!1)),n=function(e){var t=e.split("-"),r=t[0],a=t[1];return"".concat(a,"/").concat(r.slice(2))};return e.jsxs("div",s({className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-4"},{children:"Request Timeline"})),0===r.length?e.jsx("p",s({className:"text-gray-500 dark:text-gray-400 text-sm"},{children:"No data available for the selected timeframe."})):e.jsxs("div",s({className:"h-40"},{children:[e.jsx("div",s({className:"flex h-32 items-end justify-between space-x-2"},{children:r.map((function(r){var i=t[r],o="".concat(i/a*100,"%");return e.jsx("div",s({className:"flex flex-col items-center flex-1"},{children:e.jsx("div",{className:"w-full bg-blue-500 rounded-t",style:{height:o},title:"".concat(n(r),": ").concat(i," requests")})}),r)}))})),e.jsx("div",s({className:"flex justify-between mt-2"},{children:r.map((function(t){return e.jsx("div",s({className:"text-xs text-center"},{children:n(t)}),t)}))}))]}))]}))}(),N&&e.jsxs("div",s({className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-4"},{children:"Overdue Requests"})),0===q.length?e.jsx("p",s({className:"text-gray-500 dark:text-gray-400 text-sm"},{children:"No overdue requests."})):e.jsx("div",s({className:"space-y-2 max-h-60 overflow-y-auto"},{children:q.map((function(t){return e.jsxs("div",s({className:"p-3 bg-red-50 dark:bg-red-900/20 rounded-md cursor-pointer hover:bg-red-100 dark:hover:bg-red-900/30",onClick:function(){return U(t.id)}},{children:[e.jsxs("div",s({className:"flex justify-between items-start mb-1"},{children:[e.jsx("h4",s({className:"font-medium text-sm"},{children:t.subject.name})),z(t.type)]})),e.jsx("p",s({className:"text-xs text-gray-500 dark:text-gray-400 mb-1"},{children:t.subject.email})),e.jsxs("div",s({className:"flex justify-between items-center"},{children:[e.jsxs("p",s({className:"text-xs text-gray-500 dark:text-gray-400"},{children:["Due: ",V(t.dueDate||0)]})),e.jsxs("p",s({className:"text-xs font-bold text-red-600 dark:text-red-400"},{children:["Overdue by ",Math.abs(M(t.dueDate||0))," days"]}))]}))]}),t.id)}))}))]})),N&&e.jsxs("div",s({className:"bg-white dark:bg-gray-700 p-4 rounded-lg shadow mb-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-4"},{children:"Upcoming Deadlines"})),0===P.length?e.jsx("p",s({className:"text-gray-500 dark:text-gray-400 text-sm"},{children:"No upcoming deadlines in the next 7 days."})):e.jsx("div",s({className:"space-y-2 max-h-60 overflow-y-auto"},{children:P.map((function(t){var r=M(t.dueDate||0);return e.jsxs("div",s({className:"p-3 bg-yellow-50 dark:bg-yellow-900/20 rounded-md cursor-pointer hover:bg-yellow-100 dark:hover:bg-yellow-900/30",onClick:function(){return U(t.id)}},{children:[e.jsxs("div",s({className:"flex justify-between items-start mb-1"},{children:[e.jsx("h4",s({className:"font-medium text-sm"},{children:t.subject.name})),z(t.type)]})),e.jsx("p",s({className:"text-xs text-gray-500 dark:text-gray-400 mb-1"},{children:t.subject.email})),e.jsxs("div",s({className:"flex justify-between items-center"},{children:[e.jsxs("p",s({className:"text-xs text-gray-500 dark:text-gray-400"},{children:["Due: ",V(t.dueDate||0)]})),e.jsxs("p",s({className:"text-xs font-bold ".concat(r<=3?"text-red-600 dark:text-red-400":"text-yellow-600 dark:text-yellow-400")},{children:["Due in ",r," days"]}))]}))]}),t.id)}))}))]}))]})]}))]}))},exports.PolicyExporter=function(r){var a=r.content,d=r.title,l=void 0===d?"Privacy Policy":d,c=r.organizationName,u=r.lastUpdated,m=void 0===u?new Date:u,x=r.onExportComplete,h=r.componentTitle,g=void 0===h?"Export Privacy Policy":h,p=r.description,f=void 0===p?"Export your NDPR-compliant privacy policy in various formats.":p,b=r.className,v=void 0===b?"":b,y=r.buttonClassName,j=void 0===y?"":y,N=r.showExportHistory,k=void 0===N||N,w=r.includeComplianceNotice,S=void 0===w||w,D=r.includeLogo,A=void 0!==D&&D,R=r.logoUrl,C=r.customStyles,q=t.useState([]),I=q[0],T=q[1],P=t.useState("pdf"),E=P[0],F=P[1],L=t.useState(!1),O=L[0],B=L[1],U=t.useState(null),V=U[0],M=U[1],z=t.useState(""),_=z[0],H=z[1],J=t.useState(""),W=J[0],G=J[1],Y=t.useState(""),K=Y[0],Q=Y[1],$=t.useState(!1),X=$[0],Z=$[1],ee=function(e){var t=(new Date).toISOString().split("T")[0],r=c?c.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy";return"".concat(r,"-privacy-policy-").concat(t,".").concat(e.toLowerCase())},te=function(){var e=c?"".concat(c," ").concat(l):l,t=m.toLocaleDateString(),r='<!DOCTYPE html>\n<html lang="en">\n<head>\n <meta charset="UTF-8">\n <meta name="viewport" content="width=device-width, initial-scale=1.0">\n <title>'.concat(e,"</title>\n <style>\n body {\n font-family: Arial, sans-serif;\n line-height: 1.6;\n color: #333;\n max-width: 800px;\n margin: 0 auto;\n padding: 20px;\n }\n h1 {\n font-size: 24px;\n margin-bottom: 10px;\n }\n h2 {\n font-size: 20px;\n margin-top: 30px;\n margin-bottom: 10px;\n border-bottom: 1px solid #eee;\n padding-bottom: 5px;\n }\n h3 {\n font-size: 18px;\n margin-top: 20px;\n margin-bottom: 10px;\n }\n p {\n margin-bottom: 15px;\n }\n .header {\n text-align: center;\n margin-bottom: 30px;\n }\n .footer {\n margin-top: 50px;\n text-align: center;\n font-size: 12px;\n color: #666;\n border-top: 1px solid #eee;\n padding-top: 20px;\n }\n .logo {\n max-width: 200px;\n margin-bottom: 20px;\n }\n .last-updated {\n font-size: 12px;\n color: #666;\n margin-bottom: 30px;\n }\n .compliance-notice {\n background-color: #f8f9fa;\n border: 1px solid #e9ecef;\n padding: 15px;\n margin-bottom: 30px;\n font-size: 14px;\n }\n ").concat(C||"",'\n </style>\n</head>\n<body>\n <div class="header">\n ').concat(A&&R?'<img src="'.concat(R,'" alt="').concat(c||"Company",' Logo" class="logo">'):"","\n ").concat(W?'<div class="custom-header">'.concat(W,"</div>"):"","\n <h1>").concat(e,'</h1>\n <div class="last-updated">Last Updated: ').concat(t,"</div>\n </div>");S&&(r+='\n <div class="compliance-notice">\n <strong>NDPR Compliance Notice:</strong> This privacy policy has been created to comply with the Nigeria Data Protection Regulation (NDPR).\n It outlines how we collect, use, disclose, and protect your personal information in accordance with NDPR requirements.\n </div>');var s=a.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return r+='\n <div class="content">\n <p>'.concat(s,'</p>\n </div>\n \n <div class="footer">\n ').concat(K?'<div class="custom-footer">'.concat(K,"</div>"):"","\n <p>© ").concat((new Date).getFullYear()," ").concat(c||"Company",". All rights reserved.</p>\n </div>\n</body>\n</html>")};return e.jsxs("div",s({className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ".concat(v)},{children:[e.jsx("h2",s({className:"text-xl font-bold mb-2"},{children:g})),e.jsx("p",s({className:"mb-6 text-gray-600 dark:text-gray-300"},{children:f})),e.jsxs("div",s({className:"mb-6"},{children:[e.jsx("label",s({htmlFor:"export-format",className:"block text-sm font-medium mb-1"},{children:"Export Format"})),e.jsx("select",s({id:"export-format",value:E,onChange:function(e){return F(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"},{children:[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}].map((function(t){return e.jsx("option",s({value:t.value},{children:t.label}),t.value)}))}))]})),X?e.jsxs("div",s({className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4"},{children:[e.jsxs("div",s({className:"flex justify-between items-center"},{children:[e.jsx("h3",s({className:"text-md font-medium"},{children:"Advanced Export Options"})),e.jsx("button",s({type:"button",onClick:function(){return Z(!1)},className:"text-blue-600 dark:text-blue-400 text-sm"},{children:"Hide Advanced Options"}))]})),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"custom-filename",className:"block text-sm font-medium mb-1"},{children:"Custom Filename"})),e.jsx("input",{type:"text",id:"custom-filename",value:_,onChange:function(e){return H(e.target.value)},placeholder:ee(E),className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"}),e.jsx("p",s({className:"text-xs text-gray-500 dark:text-gray-400 mt-1"},{children:"Leave blank to use the default filename format."}))]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"custom-header",className:"block text-sm font-medium mb-1"},{children:"Custom Header HTML (for HTML/PDF exports)"})),e.jsx("textarea",{id:"custom-header",value:W,onChange:function(e){return G(e.target.value)},rows:3,placeholder:"<div>Custom header content</div>",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"custom-footer",className:"block text-sm font-medium mb-1"},{children:"Custom Footer HTML (for HTML/PDF exports)"})),e.jsx("textarea",{id:"custom-footer",value:K,onChange:function(e){return Q(e.target.value)},rows:3,placeholder:"<div>Custom footer content</div>",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",s({className:"flex items-start"},{children:[e.jsx("div",s({className:"flex items-center h-5"},{children:e.jsx("input",{id:"include-compliance-notice",type:"checkbox",checked:S,onChange:function(e){return Z(e.target.checked)},className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"})})),e.jsxs("div",s({className:"ml-3 text-sm"},{children:[e.jsx("label",s({htmlFor:"include-compliance-notice",className:"font-medium text-gray-900 dark:text-white"},{children:"Include NDPR Compliance Notice"})),e.jsx("p",s({className:"text-gray-500 dark:text-gray-400"},{children:"Adds a notice explaining that this policy complies with NDPR requirements."}))]}))]}))]})):e.jsx("button",s({type:"button",onClick:function(){return Z(!0)},className:"text-blue-600 dark:text-blue-400 text-sm mb-6"},{children:"Show Advanced Options"})),e.jsxs("div",s({className:"mb-6"},{children:[e.jsx("button",s({onClick:function(){return n(void 0,void 0,void 0,(function(){var e,t,r,s,n,d,l,c;return i(this,(function(i){B(!0),M(null);try{switch(e=E.toLowerCase(),t="",r=void 0,e){case"pdf":s=te(),r=new Blob([s],{type:"text/html"}),t=URL.createObjectURL(r);break;case"docx":r=new Blob([a],{type:"text/plain"}),t=URL.createObjectURL(r);break;case"html":n=te(),r=new Blob([n],{type:"text/html"}),t=URL.createObjectURL(r);break;default:r=new Blob([a],{type:"text/markdown"}),t=URL.createObjectURL(r)}d=function(e){return _?_.endsWith(".".concat(e.toLowerCase()))?_:"".concat(_,".").concat(e.toLowerCase()):ee(e)}(e),(l=document.createElement("a")).href=t,l.download=d,document.body.appendChild(l),l.click(),document.body.removeChild(l),c={id:"export_".concat(Date.now()),format:e,timestamp:Date.now(),url:t,filename:d},T((function(e){return o([c],e,!0)})),x&&x(e,t)}catch(e){console.error("Export error:",e),M("An error occurred during export. Please try again.")}finally{B(!1)}return[2]}))}))},disabled:O,className:"px-6 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(j," ").concat(O?"opacity-70 cursor-not-allowed":"")},{children:O?"Exporting...":"Export as ".concat(E.toUpperCase())})),V&&e.jsx("p",s({className:"mt-2 text-sm text-red-600 dark:text-red-500"},{children:V}))]})),e.jsxs("div",s({className:"mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md"},{children:[e.jsx("h3",s({className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2"},{children:"Export Tips"})),e.jsxs("ul",s({className:"text-blue-700 dark:text-blue-300 text-sm list-disc list-inside space-y-1"},{children:[e.jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),e.jsx("li",{children:"HTML format is ideal for publishing on your website."}),e.jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),e.jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]}))]})),k&&0!==I.length?e.jsxs("div",s({className:"mt-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-3"},{children:"Export History"})),e.jsx("div",s({className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden"},{children:e.jsxs("table",s({className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600"},{children:[e.jsx("thead",s({className:"bg-gray-100 dark:bg-gray-800"},{children:e.jsxs("tr",{children:[e.jsx("th",s({scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"},{children:"Date"})),e.jsx("th",s({scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"},{children:"Format"})),e.jsx("th",s({scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"},{children:"Filename"})),e.jsx("th",s({scope:"col",className:"px-6 py-3 text-left text-xs font-medium text-gray-500 dark:text-gray-300 uppercase tracking-wider"},{children:"Actions"}))]})})),e.jsx("tbody",s({className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600"},{children:I.map((function(t){return e.jsxs("tr",{children:[e.jsx("td",s({className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-300"},{children:new Date(t.timestamp).toLocaleString()})),e.jsx("td",s({className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-300"},{children:t.format.toUpperCase()})),e.jsx("td",s({className:"px-6 py-4 whitespace-nowrap text-sm text-gray-500 dark:text-gray-300"},{children:t.filename})),e.jsx("td",s({className:"px-6 py-4 whitespace-nowrap text-sm font-medium"},{children:e.jsx("a",s({href:t.url,download:t.filename,className:"text-blue-600 dark:text-blue-400 hover:text-blue-900 dark:hover:text-blue-300 mr-4"},{children:"Download"}))}))]},t.id)}))}))]}))}))]})):null]}))},exports.PolicyGenerator=function(r){var a=r.sections,n=r.variables,i=r.onGenerate,o=r.title,d=void 0===o?"NDPR Privacy Policy Generator":o,l=r.description,u=void 0===l?"Generate an NDPR-compliant privacy policy for your organization.":l,m=r.className,x=void 0===m?"":m,h=r.buttonClassName,g=void 0===h?"":h,p=r.generateButtonText,f=void 0===p?"Generate Policy":p;r.showPreview;var b=r.allowEditing,v=void 0===b||b,y=t.useState(a),j=y[0],N=y[1],k=t.useState(n),w=k[0],S=k[1],D=t.useState("sections"),A=D[0],R=D[1],C=t.useState(""),q=C[0],I=C[1],T=t.useState(""),P=T[0],E=T[1],F=t.useState(!1);F[0];var L=F[1],O=t.useState({}),B=O[0],U=O[1];t.useEffect((function(){N(a)}),[a]),t.useEffect((function(){S(n)}),[n]);var V=function(e,t){S((function(r){return r.map((function(r){return r.id===e?s(s({},r),{value:t}):r}))})),B[e]&&U((function(t){var r=s({},t);return delete r[e],r}))},M=function(){if(e={},t=!0,w.forEach((function(r){r.required&&!r.value&&(e[r.id]="".concat(r.name," is required"),t=!1)})),U(e),t){var e,t,r=j.filter((function(e){return e.included})),a=Object.fromEntries(w.map((function(e){return[e.name,e.value]}))),s="";r.forEach((function(e){s+="## ".concat(e.title,"\n\n"),s+=c(e.template,a),s+="\n\n"})),I(s),E(s),L(!0),R("preview")}else R("variables")},z=function(){i({sections:j,variables:w,content:v?P:q})},_=function(){return e.jsxs("div",s({className:"space-y-4"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-4"},{children:"Select Policy Sections"})),j.map((function(t){return e.jsx("div",s({className:"border border-gray-200 dark:border-gray-700 rounded-md p-4"},{children:e.jsxs("div",s({className:"flex items-start"},{children:[e.jsx("div",s({className:"flex items-center h-5"},{children:e.jsx("input",{id:"section-".concat(t.id),type:"checkbox",checked:t.included,onChange:function(){return e=t.id,void N((function(t){return t.map((function(t){return t.id===e?s(s({},t),{included:!t.included}):t}))}));var e},disabled:t.required,className:"w-4 h-4 text-blue-600 border-gray-300 rounded focus:ring-blue-500 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"})})),e.jsxs("div",s({className:"ml-3 text-sm"},{children:[e.jsxs("label",s({htmlFor:"section-".concat(t.id),className:"font-medium text-gray-900 dark:text-white"},{children:[t.title," ",t.required&&e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),t.description&&e.jsx("p",s({className:"text-gray-500 dark:text-gray-400 mt-1"},{children:t.description}))]}))]}))}),t.id)})),e.jsx("div",s({className:"mt-6"},{children:e.jsx("button",s({onClick:function(){return R("variables")},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(g)},{children:"Next: Fill Variables"}))}))]}))};return e.jsxs("div",s({className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ".concat(x)},{children:[e.jsx("h2",s({className:"text-xl font-bold mb-2"},{children:d})),e.jsx("p",s({className:"mb-6 text-gray-600 dark:text-gray-300"},{children:u})),e.jsx("div",s({className:"mb-8"},{children:e.jsxs("ol",s({className:"flex items-center w-full"},{children:[e.jsxs("li",s({className:"flex w-full items-center ".concat("sections"===A?"text-blue-600 dark:text-blue-500":"text-gray-500 dark:text-gray-400"," after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10")},{children:[e.jsx("span",s({className:"flex items-center justify-center w-8 h-8 ".concat("sections"===A?"bg-blue-100 dark:bg-blue-800":"bg-gray-100 dark:bg-gray-700"," rounded-full shrink-0")},{children:"1"})),e.jsx("span",s({className:"hidden sm:inline-flex sm:ml-2"},{children:"Sections"}))]})),e.jsxs("li",s({className:"flex w-full items-center ".concat("variables"===A?"text-blue-600 dark:text-blue-500":"text-gray-500 dark:text-gray-400"," after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10")},{children:[e.jsx("span",s({className:"flex items-center justify-center w-8 h-8 ".concat("variables"===A?"bg-blue-100 dark:bg-blue-800":"bg-gray-100 dark:bg-gray-700"," rounded-full shrink-0")},{children:"2"})),e.jsx("span",s({className:"hidden sm:inline-flex sm:ml-2"},{children:"Variables"}))]})),e.jsxs("li",s({className:"flex items-center ".concat("preview"===A?"text-blue-600 dark:text-blue-500":"text-gray-500 dark:text-gray-400")},{children:[e.jsx("span",s({className:"flex items-center justify-center w-8 h-8 ".concat("preview"===A?"bg-blue-100 dark:bg-blue-800":"bg-gray-100 dark:bg-gray-700"," rounded-full shrink-0")},{children:"3"})),e.jsx("span",s({className:"hidden sm:inline-flex sm:ml-2"},{children:"Preview"}))]}))]}))})),e.jsxs("div",s({className:"mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md"},{children:[e.jsx("h3",s({className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2"},{children:"NDPR Compliance Notice"})),e.jsx("p",s({className:"text-blue-700 dark:text-blue-300 text-sm"},{children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Regulation (NDPR). While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPR requirements."}))]})),function(){switch(A){case"sections":default:return _();case"variables":return t={},w.forEach((function(e){var r=e.id.split(".")[0];t[r]||(t[r]=[]),t[r].push(e)})),e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-medium mb-4"},{children:"Fill Policy Variables"})),e.jsx("div",s({className:"space-y-6"},{children:Object.entries(t).map((function(t){var r=t[0],a=t[1],n=j.find((function(e){return e.id===r}));return n&&!n.included?null:e.jsxs("div",s({className:"border border-gray-200 dark:border-gray-700 rounded-md p-4"},{children:[e.jsx("h4",s({className:"font-medium text-lg mb-3"},{children:n?n.title:"General Information"})),e.jsx("div",s({className:"space-y-4"},{children:a.map((function(t){return e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"var-".concat(t.id),className:"block text-sm font-medium mb-1"},{children:[t.name," ",t.required&&e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),t.description&&e.jsx("p",s({className:"text-xs text-gray-500 dark:text-gray-400 mb-2"},{children:t.description})),"textarea"===t.inputType?e.jsx("textarea",{id:"var-".concat(t.id),value:t.value,onChange:function(e){return V(t.id,e.target.value)},rows:4,className:"w-full px-3 py-2 border ".concat(B[t.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500"," rounded-md focus:outline-none focus:ring-2"),required:t.required}):"select"===t.inputType&&t.options?e.jsxs("select",s({id:"var-".concat(t.id),value:t.value,onChange:function(e){return V(t.id,e.target.value)},className:"w-full px-3 py-2 border ".concat(B[t.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500"," rounded-md focus:outline-none focus:ring-2"),required:t.required},{children:[e.jsx("option",s({value:""},{children:"Select an option"})),t.options.map((function(t){return e.jsx("option",s({value:t},{children:t}),t)}))]})):e.jsx("input",{id:"var-".concat(t.id),type:t.inputType,value:t.value,onChange:function(e){return V(t.id,e.target.value)},className:"w-full px-3 py-2 border ".concat(B[t.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-blue-500"," rounded-md focus:outline-none focus:ring-2"),required:t.required}),B[t.id]&&e.jsx("p",s({className:"mt-1 text-sm text-red-600 dark:text-red-500"},{children:B[t.id]}))]},t.id)}))}))]}),r)}))})),e.jsxs("div",s({className:"mt-6 flex space-x-4"},{children:[e.jsx("button",s({onClick:function(){return R("sections")},className:"px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ".concat(g)},{children:"Back to Sections"})),e.jsx("button",s({onClick:M,className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(g)},{children:f}))]}))]});case"preview":return e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-medium mb-4"},{children:"Preview Generated Policy"})),v?e.jsxs("div",s({className:"mb-4"},{children:[e.jsx("label",s({htmlFor:"policy-content",className:"block text-sm font-medium mb-1"},{children:"Edit Policy Content"})),e.jsx("textarea",{id:"policy-content",value:P,onChange:function(e){return E(e.target.value)},rows:20,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-sm"})]})):e.jsx("div",s({className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md mb-4"},{children:e.jsx("div",s({className:"prose dark:prose-invert max-w-none"},{children:q.split("\n").map((function(t,r){return t.startsWith("## ")?e.jsx("h2",s({className:"text-xl font-bold mt-6 mb-3"},{children:t.substring(3)}),r):t.startsWith("### ")?e.jsx("h3",s({className:"text-lg font-bold mt-4 mb-2"},{children:t.substring(4)}),r):""===t?e.jsx("br",{},r):e.jsx("p",s({className:"mb-2"},{children:t}),r)}))}))})),e.jsxs("div",s({className:"mt-6 flex space-x-4"},{children:[e.jsx("button",s({onClick:function(){return R("variables")},className:"px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ".concat(g)},{children:"Back to Variables"})),e.jsx("button",s({onClick:z,className:"px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ".concat(g)},{children:"Save Policy"}))]}))]})}var t}()]}))},exports.PolicyPreview=function(r){var a=r.content;r.sections,r.variables;var n=r.onExport,i=r.onEdit,o=r.title,d=void 0===o?"Privacy Policy Preview":o,l=r.description,c=void 0===l?"Preview your NDPR-compliant privacy policy before exporting.":l,u=r.className,m=void 0===u?"":u,x=r.buttonClassName,h=void 0===x?"":x,g=r.showExportOptions,p=void 0===g||g,f=r.showEditButton,b=void 0===f||f,v=r.showTableOfContents,y=void 0===v||v,j=r.showMetadata,N=void 0===j||j,k=r.organizationName,w=r.lastUpdated,S=void 0===w?new Date:w,D=t.useState("preview"),A=D[0],R=D[1],C=function(){var e=a.split("\n"),t=[];return e.forEach((function(e){if(e.startsWith("## ")){var r=e.substring(3).trim(),a=r.toLowerCase().replace(/[^a-z0-9]+/g,"-");t.push({id:a,title:r,level:2})}else if(e.startsWith("### ")){var s=e.substring(4).trim();a=s.toLowerCase().replace(/[^a-z0-9]+/g,"-");t.push({id:a,title:s,level:3})}})),t}(),q=function(e){if(n)n(e);else if("markdown"===e){var t=document.createElement("a"),r=new Blob([a],{type:"text/markdown"});t.href=URL.createObjectURL(r),t.download="privacy-policy-".concat((new Date).toISOString().split("T")[0],".md"),document.body.appendChild(t),t.click(),document.body.removeChild(t)}};return e.jsxs("div",s({className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ".concat(m)},{children:[e.jsxs("div",s({className:"flex justify-between items-start mb-6"},{children:[e.jsxs("div",{children:[e.jsx("h2",s({className:"text-xl font-bold mb-2"},{children:d})),e.jsx("p",s({className:"text-gray-600 dark:text-gray-300"},{children:c}))]}),b&&i&&e.jsx("button",s({onClick:i,className:"px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ".concat(h)},{children:"Edit Policy"}))]})),e.jsxs("div",s({className:"mb-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md"},{children:[e.jsx("h3",s({className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2"},{children:"NDPR Compliance Notice"})),e.jsx("p",s({className:"text-blue-700 dark:text-blue-300 text-sm"},{children:"This privacy policy has been generated to align with the Nigeria Data Protection Regulation (NDPR). We recommend having the final policy reviewed by a legal professional familiar with NDPR requirements before publishing it on your website or sharing it with your users."}))]})),e.jsx("div",s({className:"mb-6 border-b border-gray-200 dark:border-gray-700"},{children:e.jsxs("ul",s({className:"flex flex-wrap -mb-px"},{children:[e.jsx("li",s({className:"mr-2"},{children:e.jsx("button",s({onClick:function(){return R("preview")},className:"inline-block p-4 ".concat("preview"===A?"text-blue-600 border-b-2 border-blue-600 dark:text-blue-500 dark:border-blue-500":"text-gray-500 hover:text-gray-600 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300")},{children:"Preview"}))})),e.jsx("li",s({className:"mr-2"},{children:e.jsx("button",s({onClick:function(){return R("markdown")},className:"inline-block p-4 ".concat("markdown"===A?"text-blue-600 border-b-2 border-blue-600 dark:text-blue-500 dark:border-blue-500":"text-gray-500 hover:text-gray-600 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300")},{children:"Markdown"}))}))]}))})),e.jsx("div",s({className:"bg-white dark:bg-gray-800 p-4 rounded-md"},{children:"preview"===A?e.jsxs("div",{children:[N?e.jsxs("div",s({className:"mb-6"},{children:[e.jsx("h1",s({className:"text-2xl font-bold mb-2"},{children:k?"".concat(k," Privacy Policy"):"Privacy Policy"})),e.jsxs("p",s({className:"text-sm text-gray-500 dark:text-gray-400"},{children:["Last Updated: ",S.toLocaleDateString()]}))]})):null,y&&0!==C.length?e.jsxs("div",s({className:"mb-6 p-4 bg-gray-50 dark:bg-gray-700 rounded-md"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-3"},{children:"Table of Contents"})),e.jsx("ul",s({className:"space-y-1"},{children:C.map((function(t,r){return e.jsx("li",s({style:{marginLeft:"".concat(1.5*(t.level-2),"rem")}},{children:e.jsx("a",s({href:"#".concat(t.id),className:"text-blue-600 dark:text-blue-400 hover:underline"},{children:t.title}))}),r)}))}))]})):null,e.jsx("div",s({className:"bg-gray-50 dark:bg-gray-700 p-6 rounded-md"},{children:e.jsx("div",s({className:"prose dark:prose-invert max-w-none"},{children:a.split("\n").map((function(t,r){if(t.startsWith("## ")){var a=t.substring(3).trim(),n=a.toLowerCase().replace(/[^a-z0-9]+/g,"-");return e.jsx("h2",s({id:n,className:"text-xl font-bold mt-6 mb-3"},{children:a}),r)}if(t.startsWith("### ")){var i=t.substring(4).trim();return n=i.toLowerCase().replace(/[^a-z0-9]+/g,"-"),e.jsx("h3",s({id:n,className:"text-lg font-bold mt-4 mb-2"},{children:i}),r)}return""===t?e.jsx("br",{},r):e.jsx("p",s({className:"mb-2"},{children:t}),r)}))}))}))]}):e.jsx("div",{children:e.jsx("pre",s({className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md overflow-auto whitespace-pre-wrap font-mono text-sm text-gray-800 dark:text-gray-200"},{children:a}))})})),p?e.jsxs("div",s({className:"mt-6"},{children:[e.jsx("h3",s({className:"text-lg font-medium mb-3"},{children:"Export Options"})),e.jsxs("div",s({className:"flex flex-wrap gap-3"},{children:[e.jsx("button",s({onClick:function(){return q("pdf")},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(h)},{children:"Export as PDF"})),e.jsx("button",s({onClick:function(){return q("docx")},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(h)},{children:"Export as DOCX"})),e.jsx("button",s({onClick:function(){return q("html")},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(h)},{children:"Export as HTML"})),e.jsx("button",s({onClick:function(){return q("markdown")},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(h)},{children:"Export as Markdown"}))]}))]})):null]}))},exports.RegulatoryReportGenerator=function(r){var a=r.breachData,n=r.assessmentData,i=r.organizationInfo,o=r.onGenerate,d=r.title,l=void 0===d?"Generate NITDA Notification Report":d,c=r.description,u=void 0===c?"Generate a report for submission to NITDA in compliance with the NDPR breach notification requirements.":c,m=r.generateButtonText,x=void 0===m?"Generate Report":m,h=r.className,g=void 0===h?"":h,p=r.buttonClassName,f=void 0===p?"":p,b=r.showPreview,v=void 0===b||b,y=r.allowEditing,j=void 0===y||y,N=r.allowDownload,k=void 0===N||N,w=r.downloadFormat,S=void 0===w?"pdf":w,D=t.useState(""),A=D[0],R=D[1],C=t.useState(""),q=C[0],I=C[1],T=t.useState(""),P=T[0],E=T[1],F=t.useState(""),L=F[0],O=F[1],B=t.useState("email"),U=B[0],V=B[1],M=t.useState(""),z=M[0],_=M[1],H=t.useState(""),J=H[0],W=H[1],G=t.useState(!1),Y=G[0],K=G[1],Q=t.useState(!1),$=Q[0],X=Q[1];t.useEffect((function(){if(!Y){var e=ee();R(e),K(!0)}}),[a,n,i]);var Z=function(e){return new Date(e).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"})},ee=function(){var e=(new Date).toLocaleDateString("en-GB",{day:"numeric",month:"long",year:"numeric"});return"\nNITDA DATA BREACH NOTIFICATION\n\nDate: ".concat(e,"\n\nORGANIZATION DETAILS\n-------------------\nOrganization Name: ").concat(i.name,"\n").concat(i.registrationNumber?"Registration Number: ".concat(i.registrationNumber):"","\nAddress: ").concat(i.address,"\n").concat(i.website?"Website: ".concat(i.website):"","\n\nDATA PROTECTION OFFICER\n----------------------\nName: ").concat(i.dpoName,"\nEmail: ").concat(i.dpoEmail,"\n").concat(i.dpoPhone?"Phone: ".concat(i.dpoPhone):"","\n\nBREACH DETAILS\n-------------\nBreach Title: ").concat(a.title,"\nDate Discovered: ").concat(Z(a.discoveredAt),"\n").concat(a.occurredAt?"Date Occurred: ".concat(Z(a.occurredAt)):"Date Occurred: Unknown","\nStatus: ").concat(a.status.charAt(0).toUpperCase()+a.status.slice(1),"\n\nDescription of the Breach:\n").concat(a.description,"\n\nAffected Systems/Applications:\n").concat(a.affectedSystems.join(", "),"\n\nTypes of Personal Data Involved:\n").concat(a.dataTypes.join(", "),"\n\nEstimated Number of Data Subjects Affected:\n").concat(a.estimatedAffectedSubjects||"Unknown","\n\nRISK ASSESSMENT\n--------------\n").concat(n?"\nOverall Risk Level: ".concat(n.riskLevel.charAt(0).toUpperCase()+n.riskLevel.slice(1),"\nRisk to Rights and Freedoms of Data Subjects: ").concat(n.risksToRightsAndFreedoms?"Yes":"No","\nHigh Risk to Rights and Freedoms of Data Subjects: ").concat(n.highRisksToRightsAndFreedoms?"Yes":"No","\n\nJustification for Risk Assessment:\n").concat(n.justification,"\n"):"Risk assessment has not been conducted yet.","\n\nMEASURES TAKEN\n-------------\nMeasures taken or proposed to address the breach:\n").concat(a.initialActions||"To be determined","\n\nMeasures taken or proposed to mitigate possible adverse effects:\n[Please specify measures taken to mitigate adverse effects]\n\nNOTIFICATION TO DATA SUBJECTS\n----------------------------\nHave data subjects been notified: [Yes/No]\nIf yes, date of notification: [Date]\nIf no, planned date of notification: [Date]\nReason for delay (if applicable): [Reason]\n\nADDITIONAL INFORMATION\n---------------------\n[Any additional information relevant to the breach]\n\nThis notification is made in compliance with the Nigeria Data Protection Regulation (NDPR).\n ")};return e.jsxs("div",s({className:"bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ".concat(g)},{children:[e.jsx("h2",s({className:"text-xl font-bold mb-2"},{children:l})),e.jsx("p",s({className:"mb-6 text-gray-600 dark:text-gray-300"},{children:u})),$?e.jsxs("div",{children:[e.jsxs("div",s({className:"mb-6 p-4 bg-green-50 dark:bg-green-900/20 rounded-md"},{children:[e.jsx("h3",s({className:"text-lg font-bold text-green-800 dark:text-green-200 mb-2"},{children:"Report Generated Successfully"})),e.jsx("p",s({className:"text-green-700 dark:text-green-300"},{children:"Your NITDA notification report has been generated and is ready for submission. Please review the report carefully before submitting it to NITDA."}))]})),e.jsxs("div",s({className:"mb-6"},{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Submission Details"})),e.jsxs("div",s({className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4"},{children:[e.jsxs("div",{children:[e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Method:"}))," ",U.charAt(0).toUpperCase()+U.slice(1)]})),q&&e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Contact Name:"}))," ",q]})),P&&e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Contact Email:"}))," ",P]})),L&&e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Contact Phone:"}))," ",L]}))]}),e.jsxs("div",{children:[e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Date Generated:"}))," ",Z(Date.now())]})),e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Breach ID:"}))," ",a.id]})),z&&e.jsxs("p",s({className:"text-sm"},{children:[e.jsx("span",s({className:"font-medium"},{children:"Reference Number:"}))," ",z]}))]})]}))]})),v&&e.jsxs("div",s({className:"mb-6"},{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Report Preview"})),e.jsx("div",s({className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md"},{children:e.jsx("pre",s({className:"whitespace-pre-wrap text-sm font-mono text-gray-800 dark:text-gray-200"},{children:A}))}))]})),e.jsxs("div",s({className:"flex flex-wrap gap-3"},{children:[k&&e.jsxs("button",s({onClick:function(){var e=document.createElement("a"),t=new Blob([A],{type:"text/plain"});e.href=URL.createObjectURL(t),e.download="NITDA_Breach_Notification_".concat((new Date).toISOString().split("T")[0],".txt"),document.body.appendChild(e),e.click(),document.body.removeChild(e)},className:"px-4 py-2 bg-blue-600 text-white rounded hover:bg-blue-700 ".concat(f)},{children:["Download Report (",S.toUpperCase(),")"]})),e.jsx("button",s({onClick:function(){return X(!1)},className:"px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ".concat(f)},{children:"Edit Report"}))]}))]}):e.jsx("form",s({onSubmit:function(e){e.preventDefault();var t={id:"notification_".concat(Date.now()),breachId:a.id,sentAt:Date.now(),method:U,referenceNumber:z||void 0,nitdaContact:q?{name:q,email:P,phone:L||void 0}:void 0,content:A,attachments:[]};o(t),X(!0)}},{children:e.jsxs("div",s({className:"space-y-6"},{children:[e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Notification Method"})),e.jsxs("div",s({className:"grid grid-cols-1 gap-4 md:grid-cols-2"},{children:[e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"method",className:"block text-sm font-medium mb-1"},{children:["Method of Submission ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("select",s({id:"method",value:U,onChange:function(e){return V(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500",required:!0},{children:[{value:"email",label:"Email"},{value:"portal",label:"NITDA Portal"},{value:"letter",label:"Formal Letter"},{value:"other",label:"Other"}].map((function(t){return e.jsx("option",s({value:t.value},{children:t.label}),t.value)}))}))]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"referenceNumber",className:"block text-sm font-medium mb-1"},{children:"Reference Number (if available)"})),e.jsx("input",{type:"text",id:"referenceNumber",value:z,onChange:function(e){return _(e.target.value)},placeholder:"e.g. NITDA/BR/2023/001",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}))]}),e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"NITDA Contact (if known)"})),e.jsxs("div",s({className:"grid grid-cols-1 gap-4 md:grid-cols-3"},{children:[e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"contactName",className:"block text-sm font-medium mb-1"},{children:"Contact Name"})),e.jsx("input",{type:"text",id:"contactName",value:q,onChange:function(e){return I(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"contactEmail",className:"block text-sm font-medium mb-1"},{children:"Contact Email"})),e.jsx("input",{type:"email",id:"contactEmail",value:P,onChange:function(e){return E(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]}),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"contactPhone",className:"block text-sm font-medium mb-1"},{children:"Contact Phone"})),e.jsx("input",{type:"tel",id:"contactPhone",value:L,onChange:function(e){return O(e.target.value)},className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}))]}),e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Additional Information"})),e.jsxs("div",{children:[e.jsx("label",s({htmlFor:"additionalInfo",className:"block text-sm font-medium mb-1"},{children:"Additional Information to Include"})),e.jsx("textarea",{id:"additionalInfo",value:J,onChange:function(e){return W(e.target.value)},rows:3,placeholder:"Any additional information you want to include in the report",className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500"})]})]}),j&&e.jsxs("div",{children:[e.jsx("h3",s({className:"text-lg font-semibold mb-3"},{children:"Report Content"})),e.jsxs("div",{children:[e.jsxs("label",s({htmlFor:"reportContent",className:"block text-sm font-medium mb-1"},{children:["Edit Report Content ",e.jsx("span",s({className:"text-red-500"},{children:"*"}))]})),e.jsx("textarea",{id:"reportContent",value:A,onChange:function(e){return R(e.target.value)},rows:20,className:"w-full px-3 py-2 border border-gray-300 dark:border-gray-600 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 font-mono text-sm",required:!0})]})]}),e.jsxs("div",s({className:"mt-6 p-4 bg-blue-50 dark:bg-blue-900/20 rounded-md"},{children:[e.jsx("h3",s({className:"text-sm font-bold text-blue-800 dark:text-blue-200 mb-2"},{children:"NDPR Breach Notification Requirements"})),e.jsx("p",s({className:"text-blue-700 dark:text-blue-300 text-sm"},{children:"Under the Nigeria Data Protection Regulation (NDPR), data breaches that pose a risk to the rights and freedoms of data subjects must be reported to NITDA within 72 hours of discovery. This report will help you comply with this requirement."}))]})),e.jsx("div",s({className:"mt-6"},{children:e.jsx("button",s({type:"submit",className:"px-6 py-3 bg-blue-600 text-white rounded-md hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 ".concat(f)},{children:x}))}))]}))}))]}))},exports.StepIndicator=function(t){var r=t.steps,n=t.onStepClick,i=t.clickable,o=void 0===i||i,d=t.orientation,l=void 0===d?"horizontal":d,c=t.className,u=void 0===c?"":c,m=t.activeStepClassName,x=void 0===m?"":m,h=t.completedStepClassName,g=void 0===h?"":h,p=t.incompleteStepClassName,f=void 0===p?"":p,b="vertical"===l;return e.jsx("div",s({className:"".concat(u," ").concat(b?"flex flex-col space-y-4":"flex items-center justify-between")},{children:r.map((function(t,i){var d=i===r.length-1,l=t.active?"font-medium ".concat(x||"text-blue-600 dark:text-blue-400"):t.completed?"".concat(g||"text-green-600 dark:text-green-400"):"".concat(f||"text-gray-500 dark:text-gray-400");return e.jsxs(a.default.Fragment,{children:[e.jsxs("div",s({className:"\n ".concat(b?"flex items-start":"flex flex-col items-center","\n ").concat(o?"cursor-pointer":"","\n "),onClick:function(){return e=t.id,void(o&&n&&n(e));var e}},{children:[e.jsx("div",s({className:"\n flex items-center justify-center\n ".concat(b?"mr-4":"","\n ")},{children:e.jsx("div",s({className:"\n flex items-center justify-center\n w-8 h-8 rounded-full\n ".concat(t.active?"bg-blue-100 dark:bg-blue-900 text-blue-600 dark:text-blue-400 border-2 border-blue-600 dark:border-blue-400":t.completed?"bg-green-100 dark:bg-green-900 text-green-600 dark:text-green-400 border-2 border-green-600 dark:border-green-400":"bg-gray-100 dark:bg-gray-700 text-gray-500 dark:text-gray-400 border-2 border-gray-300 dark:border-gray-600","\n ")},{children:t.icon?t.icon:t.completed?e.jsx("svg",s({className:"w-4 h-4",fill:"currentColor",viewBox:"0 0 20 20",xmlns:"http://www.w3.org/2000/svg"},{children:e.jsx("path",{fillRule:"evenodd",d:"M16.707 5.293a1 1 0 010 1.414l-8 8a1 1 0 01-1.414 0l-4-4a1 1 0 011.414-1.414L8 12.586l7.293-7.293a1 1 0 011.414 0z",clipRule:"evenodd"})})):e.jsx("span",{children:i+1})}))})),e.jsxs("div",s({className:"\n ".concat(b?"flex-1":"mt-2 text-center","\n ")},{children:[e.jsx("div",s({className:"text-sm font-medium ".concat(l)},{children:t.label})),t.description&&e.jsx("div",s({className:"text-xs text-gray-500 dark:text-gray-400 mt-1"},{children:t.description}))]}))]})),!d&&e.jsx("div",{className:"\n ".concat(b?"ml-4 h-8 border-l-2 border-gray-300 dark:border-gray-600":"w-full border-t-2 border-gray-300 dark:border-gray-600 hidden sm:block","\n ")})]},t.id)}))}))},exports.assessDPIARisk=m,exports.calculateBreachSeverity=l,exports.formatDSRRequest=d,exports.generatePolicyText=c,exports.useBreach=function(e){e.categories;var r=e.initialReports,a=void 0===r?[]:r,n=e.storageKey,i=void 0===n?"ndpr_breach_data":n,d=e.useLocalStorage,c=void 0===d||d,u=e.onReport,m=e.onAssessment,x=e.onNotification,h=t.useState(a),g=h[0],p=h[1],f=t.useState([]),b=f[0],v=f[1],y=t.useState([]),j=y[0],N=y[1];t.useEffect((function(){if(c&&"undefined"!=typeof window)try{var e=localStorage.getItem(i);if(e){var t=JSON.parse(e),r=t.reports,a=t.assessments,s=t.notifications;p(r||[]),v(a||[]),N(s||[])}}catch(e){console.error("Error loading breach data:",e)}}),[i,c]),t.useEffect((function(){if(c&&"undefined"!=typeof window)try{localStorage.setItem(i,JSON.stringify({reports:g,assessments:b,notifications:j}))}catch(e){console.error("Error saving breach data:",e)}}),[g,b,j,i,c]);var k=function(e){return"".concat(e,"_").concat(Date.now(),"_").concat(Math.random().toString(36).substr(2,9))},w=function(e){return g.find((function(t){return t.id===e}))||null},S=function(e){return b.find((function(t){return t.breachId===e}))||null},D=function(e){var t=w(e),r=S(e);if(!t)return null;var a=l(t,r||void 0),s=a.severityLevel,n=a.notificationRequired,i=a.timeframeHours,o=a.justification;return{nitdaNotificationRequired:n,nitdaNotificationDeadline:t.discoveredAt+60*i*60*1e3,dataSubjectNotificationRequired:"high"===s||"critical"===s,justification:o}};return{reports:g,assessments:b,notifications:j,reportBreach:function(e){var t=s({id:k("breach"),reportedAt:Date.now()},e);return p((function(e){return o(o([],e,!0),[t],!1)})),u&&u(t),t},updateReport:function(e,t){var r=null;return p((function(a){var n=a.findIndex((function(t){return t.id===e}));if(-1===n)return a;var i=a[n];r=s(s({},i),t);var d=o([],a,!0);return d[n]=r,d})),r},getReport:w,assessRisk:function(e,t){var r=b.find((function(t){return t.breachId===e}));if(r){var a=s(s(s({},r),t),{assessedAt:Date.now()});return v((function(e){return e.map((function(e){return e.id===r.id?a:e}))})),m&&m(a),a}var n=s({id:k("assessment"),breachId:e,assessedAt:Date.now()},t);return v((function(e){return o(o([],e,!0),[n],!1)})),m&&m(n),n},getAssessment:S,calculateNotificationRequirements:D,sendNotification:function(e,t){var r=j.find((function(t){return t.breachId===e}));if(r){var a=s(s(s({},r),t),{sentAt:Date.now()});return N((function(e){return e.map((function(e){return e.id===r.id?a:e}))})),x&&x(a),a}var n=s({id:k("notification"),breachId:e,sentAt:Date.now()},t);return N((function(e){return o(o([],e,!0),[n],!1)})),x&&x(n),n},getNotification:function(e){return j.find((function(t){return t.breachId===e}))||null},getBreachesRequiringNotification:function(e){void 0===e&&(e=24);var t=Date.now(),r=[];return g.forEach((function(a){if(!j.some((function(e){return e.breachId===a.id}))){var s=S(a.id);if(s){var n=D(a.id);if(n&&n.nitdaNotificationRequired){var i=(n.nitdaNotificationDeadline-t)/36e5;i<=e&&r.push({report:a,assessment:s,requirements:n,hoursRemaining:i})}}}})),r.sort((function(e,t){return e.hoursRemaining-t.hoursRemaining}))},clearBreachData:function(){p([]),v([]),N([]),c&&"undefined"!=typeof window&&localStorage.removeItem(i)}}},exports.useConsent=function(e){var r=e.options,a=e.storageOptions,s=void 0===a?{}:a,n=e.version,i=void 0===n?"1.0":n,o=e.onChange,d=s.storageKey,l=void 0===d?"ndpr_consent":d,c=s.storageType,m=void 0===c?"localStorage":c,x=t.useState(null),h=x[0],g=x[1],p=t.useState(!0),f=p[0],b=p[1],v=t.useState(!1),y=v[0],j=v[1],N=t.useState([]),k=N[0],w=N[1];t.useEffect((function(){var e=null;try{if("localStorage"===m&&"undefined"!=typeof window)(t=localStorage.getItem(l))&&(e=JSON.parse(t));else if("sessionStorage"===m&&"undefined"!=typeof window){var t;(t=sessionStorage.getItem(l))&&(e=JSON.parse(t))}else if("cookie"===m&&"undefined"!=typeof document){var r=document.cookie.split(";").find((function(e){return e.trim().startsWith("".concat(l,"="))}));if(r){var a=r.split("=")[1];e=JSON.parse(decodeURIComponent(a))}}}catch(e){console.error("Error loading consent settings:",e)}if(e){g(e);var s=u(e),n=s.valid,o=s.errors;j(n),w(o),b(!(n&&e.version===i))}else b(!0)}),[l,m,i]);var S=function(e){var t={consents:e,timestamp:Date.now(),version:i,method:"explicit",hasInteracted:!0};g(t),function(e){try{var t=JSON.stringify(e);if("localStorage"===m&&"undefined"!=typeof window)localStorage.setItem(l,t);else if("sessionStorage"===m&&"undefined"!=typeof window)sessionStorage.setItem(l,t);else if("cookie"===m&&"undefined"!=typeof document){var r=s.cookieOptions,a=void 0===r?{}:r,n=a.domain,i=a.path,d=void 0===i?"/":i,c=a.expires,x=void 0===c?365:c,h=a.secure,g=void 0===h||h,p=a.sameSite,f=void 0===p?"Lax":p,b=new Date;b.setDate(b.getDate()+x);var v="".concat(l,"=").concat(encodeURIComponent(t),"; path=").concat(d,"; expires=").concat(b.toUTCString());n&&(v+="; domain=".concat(n)),g&&(v+="; secure"),v+="; samesite=".concat(f),document.cookie=v}var y=u(e),N=y.valid,k=y.errors;j(N),w(k),o&&o(e)}catch(e){console.error("Error saving consent settings:",e)}}(t),b(!1)};return{settings:h,hasConsent:function(e){return!!(null==h?void 0:h.consents[e])},updateConsent:S,acceptAll:function(){var e={};r.forEach((function(t){e[t.id]=!0})),S(e)},rejectAll:function(){var e={};r.forEach((function(t){e[t.id]=t.required||!1})),S(e)},shouldShowBanner:f,isValid:y,validationErrors:k,resetConsent:function(){if("localStorage"===m&&"undefined"!=typeof window)localStorage.removeItem(l);else if("sessionStorage"===m&&"undefined"!=typeof window)sessionStorage.removeItem(l);else if("cookie"===m&&"undefined"!=typeof document){var e=s.cookieOptions,t=void 0===e?{}:e,r=t.domain,a=t.path,n=void 0===a?"/":a,i="".concat(l,"=; path=").concat(n,"; expires=Thu, 01 Jan 1970 00:00:00 GMT");r&&(i+="; domain=".concat(r)),document.cookie=i}g(null),b(!0),j(!1),w([])}}},exports.useDPIA=function(e){var r=e.sections,a=e.initialAnswers,n=void 0===a?{}:a,i=e.storageKey,o=void 0===i?"ndpr_dpia_data":i,d=e.useLocalStorage,l=void 0===d||d,c=e.onComplete,u=t.useState(0),x=u[0],h=u[1],g=t.useState(n),p=g[0],f=g[1];t.useEffect((function(){if(l&&"undefined"!=typeof window)try{var e=localStorage.getItem(o);if(e){var t=JSON.parse(e),r=t.answers,a=t.sectionIndex;f(r||{}),h(a||0)}}catch(e){console.error("Error loading DPIA data:",e)}}),[o,l]),t.useEffect((function(){if(l&&"undefined"!=typeof window)try{localStorage.setItem(o,JSON.stringify({answers:p,sectionIndex:x}))}catch(e){console.error("Error saving DPIA data:",e)}}),[p,x,o,l]);var b,v,y=r[x]||null,j=function(e){return!e.showWhen||e.showWhen.every((function(e){var t=p[e.questionId];switch(e.operator){case"equals":return t===e.value;case"contains":return!!Array.isArray(t)&&t.includes(e.value);case"greaterThan":return"number"==typeof t&&t>e.value;case"lessThan":return"number"==typeof t&&t<e.value;default:return!0}}))},N=function(){return y?y.questions.filter(j):[]},k=function(){return!!y&&N().every((function(e){if(!e.required)return!0;var t=p[e.id];return null!=t&&(("string"!=typeof t||""!==t.trim())&&(!Array.isArray(t)||0!==t.length))}))},w=(b=0,v=0,r.forEach((function(e){e.questions.forEach((function(e){if(e.required&&j(e)){v++;var t=p[e.id];null==t||"string"==typeof t&&""===t.trim()||Array.isArray(t)&&0===t.length||b++}}))})),v>0?Math.round(b/v*100):0);return{currentSectionIndex:x,currentSection:y,answers:p,updateAnswer:function(e,t){f((function(r){var a;return s(s({},r),((a={})[e]=t,a))}))},nextSection:function(){return!!k()&&(x<r.length-1&&(h((function(e){return e+1})),!0))},prevSection:function(){return x>0&&(h((function(e){return e-1})),!0)},goToSection:function(e){return e>=0&&e<r.length&&(h(e),!0)},isCurrentSectionValid:k,getCurrentSectionErrors:function(){var e={};return y?(N().forEach((function(t){if(t.required){var r=p[t.id];null==r||"string"==typeof r&&""===r.trim()?e[t.id]="This question is required":Array.isArray(r)&&0===r.length&&(e[t.id]="At least one option must be selected")}})),e):e},isComplete:function(){return r.every((function(e,t){h(t);var r=k();return h(x),r}))},completeDPIA:function(e,t,a){var s=function(){var e=[];return r.forEach((function(t){t.questions.forEach((function(t){var r=p[t.id];if(null!=r&&t.riskLevel)if(["select","radio","checkbox"].includes(t.type)&&t.options)(Array.isArray(r)?r:[r]).forEach((function(r){var a,s=null===(a=t.options)||void 0===a?void 0:a.find((function(e){return e.value===r}));if(null==s?void 0:s.riskLevel){var n=s.riskLevel,i="low"===n?1:"medium"===n?3:5,o="low"===n?1:"medium"===n?3:5;e.push({id:"risk_".concat(e.length+1),description:"".concat(t.text," - ").concat(s.label),likelihood:i,impact:o,score:i*o,level:n,mitigated:!1,relatedQuestionIds:[t.id]})}}));else{var a=t.riskLevel,s="low"===a?1:"medium"===a?3:5,n="low"===a?1:"medium"===a?3:5;e.push({id:"risk_".concat(e.length+1),description:t.text,likelihood:s,impact:n,score:s*n,level:a,mitigated:!1,relatedQuestionIds:[t.id]})}}))})),e}(),n={id:"dpia_".concat(Date.now()),title:t,processingDescription:a,startedAt:Date.now(),completedAt:Date.now(),assessor:e,answers:p,risks:s,overallRiskLevel:"low",canProceed:!0,conclusion:"",version:"1.0"},i=m(n);return n.overallRiskLevel=i.overallRiskLevel,n.canProceed=i.canProceed,n.conclusion=i.canProceed?"Based on the assessment, the processing can proceed with appropriate safeguards.":"Based on the assessment, the processing should not proceed without further mitigation measures.",n.recommendations=i.recommendations,c&&c(n),n},getVisibleQuestions:N,resetDPIA:function(){f({}),h(0),l&&"undefined"!=typeof window&&localStorage.removeItem(o)},progress:w}},exports.useDSR=function(e){var r=e.initialRequests,a=void 0===r?[]:r,n=e.requestTypes,i=e.storageKey,l=void 0===i?"ndpr_dsr_requests":i,c=e.useLocalStorage,u=void 0===c||c,m=e.onSubmit,x=e.onUpdate,h=t.useState(a),g=h[0],p=h[1];return t.useEffect((function(){if(u&&"undefined"!=typeof window)try{var e=localStorage.getItem(l);e&&p(JSON.parse(e))}catch(e){console.error("Error loading DSR requests:",e)}}),[l,u]),t.useEffect((function(){if(u&&"undefined"!=typeof window&&g.length>0)try{localStorage.setItem(l,JSON.stringify(g))}catch(e){console.error("Error saving DSR requests:",e)}}),[g,l,u]),{requests:g,submitRequest:function(e){var t=n.find((function(t){return t.id===e.type})),r=(null==t?void 0:t.estimatedCompletionTime)||30,a=Date.now(),i=a+24*r*60*60*1e3,d=e;d.createdAt;var l=function(e,t){var r={};for(var a in e)Object.prototype.hasOwnProperty.call(e,a)&&t.indexOf(a)<0&&(r[a]=e[a]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(a=Object.getOwnPropertySymbols(e);s<a.length;s++)t.indexOf(a[s])<0&&Object.prototype.propertyIsEnumerable.call(e,a[s])&&(r[a[s]]=e[a[s]])}return r}(d,["createdAt"]),c=s({id:"dsr_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),status:"pending",createdAt:a,updatedAt:a,dueDate:i},l);return p((function(e){return o(o([],e,!0),[c],!1)})),m&&m(c),c},updateRequest:function(e,t){var r=null;return p((function(a){var n=a.findIndex((function(t){return t.id===e}));if(-1===n)return a;var i=a[n];r=s(s(s({},i),t),{updatedAt:Date.now()});var d=o([],a,!0);return d[n]=r,d})),r&&x&&x(r),r},getRequest:function(e){return g.find((function(t){return t.id===e}))||null},getRequestsByStatus:function(e){return g.filter((function(t){return t.status===e}))},getRequestsByType:function(e){return g.filter((function(t){return t.type===e}))},getRequestType:function(e){return n.find((function(t){return t.id===e}))},formatRequest:function(e){return d(e).formattedRequest},clearRequests:function(){p([]),u&&"undefined"!=typeof window&&localStorage.removeItem(l)}}},exports.usePrivacyPolicy=function(e){var r=e.templates,a=e.initialPolicy,n=e.storageKey,i=void 0===n?"ndpr_privacy_policy":n,o=e.useLocalStorage,d=void 0===o||o,l=e.onGenerate,u=t.useState(a||null),m=u[0],x=u[1],h=t.useState(null),g=h[0],p=h[1],f=t.useState({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),b=f[0],v=f[1];return t.useEffect((function(){if(d&&"undefined"!=typeof window&&!a)try{var e=localStorage.getItem(i);if(e){var t=JSON.parse(e),s=t.policy,n=t.template,o=t.organizationInfo;if(s&&x(s),n){var l=r.find((function(e){return e.id===n.id}));l&&p(l)}o&&v(o)}}catch(e){console.error("Error loading privacy policy data:",e)}}),[i,d,a,r]),t.useEffect((function(){if(d&&"undefined"!=typeof window)try{localStorage.setItem(i,JSON.stringify({policy:m,template:g,organizationInfo:b}))}catch(e){console.error("Error saving privacy policy data:",e)}}),[m,g,b,i,d]),{policy:m,selectedTemplate:g,organizationInfo:b,selectTemplate:function(e){var t=r.find((function(t){return t.id===e}));return!!t&&(p(t),t.sections.map((function(e){return s(s({},e),{customContent:void 0})})),Object.keys(t.variables).forEach((function(e){t.variables[e].defaultValue})),!0)},updateOrganizationInfo:function(e){v((function(t){return s(s({},t),e)}))},toggleSection:function(e,t){g&&(m?x((function(r){return r?s(s({},r),{sections:r.sections.map((function(r){return r.id===e?s(s({},r),{included:t}):r}))}):r})):p((function(r){return r?s(s({},r),{sections:r.sections.map((function(r){return r.id===e?s(s({},r),{included:t}):r}))}):r})))},updateSectionContent:function(e,t){g&&(m?x((function(r){return r?s(s({},r),{sections:r.sections.map((function(r){return r.id===e?s(s({},r),{customContent:t}):r}))}):r})):p((function(r){return r?s(s({},r),{sections:r.sections.map((function(r){return r.id===e?s(s({},r),{customContent:t}):r}))}):r})))},updateVariableValue:function(e,t){m&&x((function(r){var a;return r?s(s({},r),{variableValues:s(s({},r.variableValues),(a={},a[e]=t,a))}):r}))},generatePolicy:function(){if(!g)throw new Error("No template selected");var e=Date.now(),t={id:(null==m?void 0:m.id)||"policy_"+Date.now()+"_"+Math.random().toString(36).substr(2,9),title:"Privacy Policy for ".concat(b.name),templateId:g.id,organizationInfo:b,sections:g.sections.map((function(e){var t;return s(s({},e),{customContent:null===(t=null==m?void 0:m.sections.find((function(t){return t.id===e.id})))||void 0===t?void 0:t.customContent})})),variableValues:(null==m?void 0:m.variableValues)||{},effectiveDate:e,lastUpdated:e,version:"1.0"};return x(t),l&&l(t),t},getPolicyText:function(){if(!m)return{fullText:"",sectionTexts:{},missingVariables:[]};var e=c(m.sections,m.organizationInfo);return"string"==typeof e?{fullText:e,sectionTexts:{full:e},missingVariables:[]}:e},resetPolicy:function(){x(null),p(null),v({name:"",website:"",privacyEmail:"",address:"",privacyPhone:"",dpoName:"",dpoEmail:"",industry:""}),d&&"undefined"!=typeof window&&localStorage.removeItem(i)},isValid:function(){var e=[];if(g||e.push("No template selected"),b.name||e.push("Organization name is required"),b.website||e.push("Organization website is required"),b.privacyEmail||e.push("Privacy contact email is required"),g){var t=g.sections.filter((function(e){return e.required})),r=(null==m?void 0:m.sections.filter((function(e){return e.included})))||[];t.forEach((function(t){r.some((function(e){return e.id===t.id}))||e.push('Required section "'.concat(t.title,'" must be included'))}))}return g&&m&&Object.entries(g.variables).forEach((function(t){var r=t[0],a=t[1];a.required&&!m.variableValues[r]&&e.push('Required variable "'.concat(a.name,'" must have a value'))})),{valid:0===e.length,errors:e}}}},exports.validateConsent=u;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|