@tantainnovative/ndpr-toolkit 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (105) hide show
  1. package/dist/index.d.mts +224 -32
  2. package/dist/index.d.ts +442 -18
  3. package/dist/index.js +190 -1
  4. package/dist/index.js.map +1 -1
  5. package/dist/index.mjs +190 -1
  6. package/dist/index.mjs.map +1 -1
  7. package/dist/unstyled.d.mts +4 -4
  8. package/dist/unstyled.d.ts +22 -2
  9. package/package.json +28 -32
  10. package/dist/components/breach-notification/BreachNotificationForm.d.ts +0 -18
  11. package/dist/components/breach-notification/BreachNotificationForm.d.ts.map +0 -1
  12. package/dist/components/consent/ConsentBanner.d.ts +0 -30
  13. package/dist/components/consent/ConsentBanner.d.ts.map +0 -1
  14. package/dist/components/consent/ConsentManager.d.ts +0 -51
  15. package/dist/components/consent/ConsentManager.d.ts.map +0 -1
  16. package/dist/components/consent/ConsentSettings.d.ts +0 -15
  17. package/dist/components/consent/ConsentSettings.d.ts.map +0 -1
  18. package/dist/components/consent/unstyled/UnstyledConsentBanner.d.ts +0 -7
  19. package/dist/components/consent/unstyled/UnstyledConsentBanner.d.ts.map +0 -1
  20. package/dist/components/consent/unstyled/UnstyledConsentSettings.d.ts +0 -7
  21. package/dist/components/consent/unstyled/UnstyledConsentSettings.d.ts.map +0 -1
  22. package/dist/components/consent/unstyled/UnstyledConsentToggle.d.ts +0 -8
  23. package/dist/components/consent/unstyled/UnstyledConsentToggle.d.ts.map +0 -1
  24. package/dist/components/consent/unstyled/index.d.ts +0 -4
  25. package/dist/components/consent/unstyled/index.d.ts.map +0 -1
  26. package/dist/components/data-subject-rights/DataSubjectRequestForm.d.ts +0 -14
  27. package/dist/components/data-subject-rights/DataSubjectRequestForm.d.ts.map +0 -1
  28. package/dist/components/docs/DocLayout.d.ts +0 -9
  29. package/dist/components/docs/DocLayout.d.ts.map +0 -1
  30. package/dist/components/docs/index.d.ts +0 -2
  31. package/dist/components/docs/index.d.ts.map +0 -1
  32. package/dist/components/dpia/DPIAQuestionnaire.d.ts +0 -9
  33. package/dist/components/dpia/DPIAQuestionnaire.d.ts.map +0 -1
  34. package/dist/components/privacy-policy/PolicyGenerator.d.ts +0 -12
  35. package/dist/components/privacy-policy/PolicyGenerator.d.ts.map +0 -1
  36. package/dist/components/privacy-policy/data.d.ts +0 -8
  37. package/dist/components/privacy-policy/data.d.ts.map +0 -1
  38. package/dist/components/privacy-policy/shared/CheckboxField.d.ts +0 -13
  39. package/dist/components/privacy-policy/shared/CheckboxField.d.ts.map +0 -1
  40. package/dist/components/privacy-policy/shared/CheckboxGroup.d.ts +0 -13
  41. package/dist/components/privacy-policy/shared/CheckboxGroup.d.ts.map +0 -1
  42. package/dist/components/privacy-policy/shared/FormField.d.ts +0 -13
  43. package/dist/components/privacy-policy/shared/FormField.d.ts.map +0 -1
  44. package/dist/components/privacy-policy/shared/StepIndicator.d.ts +0 -8
  45. package/dist/components/privacy-policy/shared/StepIndicator.d.ts.map +0 -1
  46. package/dist/components/privacy-policy/steps/CustomSectionsStep.d.ts +0 -15
  47. package/dist/components/privacy-policy/steps/CustomSectionsStep.d.ts.map +0 -1
  48. package/dist/components/privacy-policy/steps/DataCollectionStep.d.ts +0 -20
  49. package/dist/components/privacy-policy/steps/DataCollectionStep.d.ts.map +0 -1
  50. package/dist/components/privacy-policy/steps/DataSharingStep.d.ts +0 -34
  51. package/dist/components/privacy-policy/steps/DataSharingStep.d.ts.map +0 -1
  52. package/dist/components/privacy-policy/steps/OrganizationInfoStep.d.ts +0 -17
  53. package/dist/components/privacy-policy/steps/OrganizationInfoStep.d.ts.map +0 -1
  54. package/dist/components/privacy-policy/steps/PolicyPreviewStep.d.ts +0 -30
  55. package/dist/components/privacy-policy/steps/PolicyPreviewStep.d.ts.map +0 -1
  56. package/dist/components/ui/Badge.d.ts +0 -10
  57. package/dist/components/ui/Badge.d.ts.map +0 -1
  58. package/dist/components/ui/Button.d.ts +0 -11
  59. package/dist/components/ui/Button.d.ts.map +0 -1
  60. package/dist/components/ui/Card.d.ts +0 -10
  61. package/dist/components/ui/Card.d.ts.map +0 -1
  62. package/dist/components/ui/Checkbox.d.ts +0 -8
  63. package/dist/components/ui/Checkbox.d.ts.map +0 -1
  64. package/dist/components/ui/FormField.d.ts +0 -11
  65. package/dist/components/ui/FormField.d.ts.map +0 -1
  66. package/dist/components/ui/Input.d.ts +0 -6
  67. package/dist/components/ui/Input.d.ts.map +0 -1
  68. package/dist/components/ui/Select.d.ts +0 -6
  69. package/dist/components/ui/Select.d.ts.map +0 -1
  70. package/dist/components/ui/TextArea.d.ts +0 -6
  71. package/dist/components/ui/TextArea.d.ts.map +0 -1
  72. package/dist/components/ui/dialog.d.ts +0 -18
  73. package/dist/components/ui/dialog.d.ts.map +0 -1
  74. package/dist/components/ui/label.d.ts +0 -5
  75. package/dist/components/ui/label.d.ts.map +0 -1
  76. package/dist/components/ui/switch.d.ts +0 -5
  77. package/dist/components/ui/switch.d.ts.map +0 -1
  78. package/dist/components/ui/tabs.d.ts +0 -8
  79. package/dist/components/ui/tabs.d.ts.map +0 -1
  80. package/dist/contexts/ConsentContext.d.ts +0 -35
  81. package/dist/contexts/ConsentContext.d.ts.map +0 -1
  82. package/dist/contexts/GenericConsentContext.d.ts +0 -11
  83. package/dist/contexts/GenericConsentContext.d.ts.map +0 -1
  84. package/dist/hooks/useConsent.d.ts +0 -12
  85. package/dist/hooks/useConsent.d.ts.map +0 -1
  86. package/dist/hooks/useConsentActions.d.ts +0 -12
  87. package/dist/hooks/useConsentActions.d.ts.map +0 -1
  88. package/dist/hooks/useConsentManager.d.ts +0 -14
  89. package/dist/hooks/useConsentManager.d.ts.map +0 -1
  90. package/dist/hooks/useConsentState.d.ts +0 -10
  91. package/dist/hooks/useConsentState.d.ts.map +0 -1
  92. package/dist/index.d.ts.map +0 -1
  93. package/dist/lib/consentService.d.ts +0 -11
  94. package/dist/lib/consentService.d.ts.map +0 -1
  95. package/dist/lib/dpiaQuestions.d.ts +0 -3
  96. package/dist/lib/dpiaQuestions.d.ts.map +0 -1
  97. package/dist/lib/requestService.d.ts +0 -10
  98. package/dist/lib/requestService.d.ts.map +0 -1
  99. package/dist/lib/utils.d.ts +0 -3
  100. package/dist/lib/utils.d.ts.map +0 -1
  101. package/dist/types/consent.d.ts +0 -57
  102. package/dist/types/consent.d.ts.map +0 -1
  103. package/dist/types/index.d.ts +0 -91
  104. package/dist/types/index.d.ts.map +0 -1
  105. package/dist/unstyled.d.ts.map +0 -1
package/dist/index.mjs CHANGED
@@ -1,2 +1,191 @@
1
- import*as C from'react';import C__default,{createContext,useState,useEffect,useCallback,useContext,useRef}from'react';import {Slot}from'@radix-ui/react-slot';import {cva}from'class-variance-authority';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import*as j from'@radix-ui/react-switch';import {v4}from'uuid';var Se=Object.defineProperty,xe=Object.defineProperties;var we=Object.getOwnPropertyDescriptors;var H=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,ie=Object.prototype.propertyIsEnumerable;var se=(e,n,o)=>n in e?Se(e,n,{enumerable:true,configurable:true,writable:true,value:o}):e[n]=o,a=(e,n)=>{for(var o in n||(n={}))re.call(n,o)&&se(e,o,n[o]);if(H)for(var o of H(n))ie.call(n,o)&&se(e,o,n[o]);return e},T=(e,n)=>xe(e,we(n));var x=(e,n)=>{var o={};for(var t in e)re.call(e,t)&&n.indexOf(t)<0&&(o[t]=e[t]);if(e!=null&&H)for(var t of H(e))n.indexOf(t)<0&&ie.call(e,t)&&(o[t]=e[t]);return o};var Y=createContext(void 0),le={necessary:true,analytics:false,marketing:false,functional:false};function G({children:e,initialConsent:n={},onConsentChange:o,storageKey:t="ndpr-consent"}){let[s,l]=useState(()=>{if(typeof window!="undefined"){let S=localStorage.getItem(t);if(S)try{let N=JSON.parse(S);return a(a({},le),N)}catch(N){console.error("Failed to parse consent from localStorage",N);}}return a(a({},le),n)}),[r,d]=useState(()=>typeof window!="undefined"?localStorage.getItem(`${t}-set`)==="true":false),[i,c]=useState(!r),[f,u]=useState(false);useEffect(()=>{typeof window!="undefined"&&r&&(localStorage.setItem(t,JSON.stringify(s)),localStorage.setItem(`${t}-set`,"true"));},[s,r,t]),useEffect(()=>{r&&o&&o(s);},[s,r,o]);let k=useCallback(()=>{l({necessary:true,analytics:true,marketing:true,functional:true}),d(true),c(false),u(false);},[]),F=useCallback(()=>{l({necessary:true,analytics:false,marketing:false,functional:false}),d(true),c(false),u(false);},[]),E=useCallback(S=>{l(N=>T(a(a({},N),S),{necessary:true})),d(true),c(false),u(false);},[]),$=useCallback((S,N)=>{S!=="necessary"&&l(W=>T(a({},W),{[S]:N}));},[]),B=useCallback(()=>{u(true),c(false);},[]),_=useCallback(()=>{u(false);},[]),R={hasUserConsented:r,consentState:s,showBanner:i,showSettings:f,acceptAll:k,rejectAll:F,savePreferences:E,openSettings:B,closeSettings:_,updateConsent:$};return C__default.createElement(Y.Provider,{value:R},e)}function g(){let e=useContext(Y);if(!e)throw new Error("useConsent must be used within a ConsentProvider");return e}function Ee(){let e=createContext(void 0);function n({children:t,initialConsent:s={},onConsentChange:l,storageKey:r="ndpr-consent",categories:d}){let i=()=>{let p={necessary:true};return d?d.forEach(m=>{m.id!=="necessary"&&(p[m.id]=false);}):(p.analytics=false,p.marketing=false,p.functional=false),p},[c,f]=useState(()=>{if(typeof window!="undefined"){let p=localStorage.getItem(r);if(p)try{let m=JSON.parse(p);return a(a({},i()),m)}catch(m){console.error("Failed to parse consent from localStorage",m);}}return a(a({},i()),s)}),[u,k]=useState(()=>typeof window!="undefined"?localStorage.getItem(`${r}-set`)==="true":false),[F,E]=useState(!u),[$,B]=useState(false);useEffect(()=>{typeof window!="undefined"&&u&&(localStorage.setItem(r,JSON.stringify(c)),localStorage.setItem(`${r}-set`,"true"));},[c,u,r]),useEffect(()=>{u&&l&&l(c);},[c,u,l]);let _=useCallback(()=>{let p=a({},c);Object.keys(p).forEach(m=>{p[m]=true;}),f(p),k(true),E(false),B(false);},[c]),R=useCallback(()=>{let p=a({},c);Object.keys(p).forEach(m=>{m!=="necessary"&&(p[m]=false);}),f(p),k(true),E(false),B(false);},[c]),S=useCallback(p=>{f(m=>T(a(a({},m),p),{necessary:true})),k(true),E(false),B(false);},[]),N=useCallback((p,m)=>{p!=="necessary"&&f(be=>T(a({},be),{[p]:m}));},[]),W=useCallback(()=>{B(true),E(false);},[]),ye=useCallback(()=>{B(false);},[]),he={hasUserConsented:u,consentState:c,showBanner:F,showSettings:$,acceptAll:_,rejectAll:R,savePreferences:S,openSettings:W,closeSettings:ye,updateConsent:N};return C__default.createElement(e.Provider,{value:he},t)}function o(){let t=useContext(e);if(!t)throw new Error("useConsent must be used within a ConsentProvider");return t}return {ConsentContext:e,ConsentProvider:n,useConsent:o}}function v(...e){return twMerge(clsx(e))}var Oe=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function A(l){var r=l,{className:e,variant:n,size:o,asChild:t=false}=r,s=x(r,["className","variant","size","asChild"]);return C.createElement(t?Slot:"button",a({"data-slot":"button",className:v(Oe({variant:n,size:o,className:e}))},s))}var U=({renderBanner:e,theme:n,position:o="bottom",animation:t="slide",fullWidth:s=true,maxWidth:l="1200px",unstyled:r=false,className:d,children:i})=>{let{showBanner:c,acceptAll:f,rejectAll:u,openSettings:k}=g();return c?e?C__default.createElement(C__default.Fragment,null,e({onAcceptAll:f,onRejectAll:u,onOpenSettings:k})):i?C__default.createElement("div",{className:v(!r&&["fixed z-50 p-4",o==="bottom"&&"bottom-0 left-0 right-0",o==="top"&&"top-0 left-0 right-0",o==="center"&&"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",t==="slide"&&"animate-slide-in",t==="fade"&&"animate-fade-in"],d),style:{backgroundColor:r?void 0:(n==null?void 0:n.backgroundColor)||"white",color:r||n==null?void 0:n.textColor,maxWidth:s?void 0:l,margin:s?void 0:"0 auto"}},i):C__default.createElement("div",{className:v("fixed z-50 p-4",o==="bottom"&&"bottom-0 left-0 right-0",o==="top"&&"top-0 left-0 right-0",o==="center"&&"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",t==="slide"&&"animate-slide-in",t==="fade"&&"animate-fade-in",d),style:{backgroundColor:(n==null?void 0:n.backgroundColor)||"white",color:n==null?void 0:n.textColor}},C__default.createElement("div",{className:"mx-auto",style:{maxWidth:s?void 0:l}},C__default.createElement("div",{className:"bg-white rounded-lg shadow-lg p-6"},C__default.createElement("h3",{className:"text-lg font-semibold mb-2"},"Cookie Consent"),C__default.createElement("p",{className:"text-gray-600 mb-4"},"We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies."),C__default.createElement("div",{className:"flex gap-3 flex-wrap"},C__default.createElement(A,{onClick:f,style:{backgroundColor:n==null?void 0:n.primaryColor}},"Accept All"),C__default.createElement(A,{onClick:u,variant:"outline"},"Reject All"),C__default.createElement(A,{onClick:k,variant:"ghost"},"Manage Preferences"))))):null};U.Message=({children:e,className:n})=>C__default.createElement("div",{className:v("mb-4",n)},e);U.Actions=({children:e,className:n})=>C__default.createElement("div",{className:v("flex gap-3 flex-wrap",n)},e);function fe(o){var t=o,{className:e}=t,n=x(t,["className"]);return C.createElement(j.Root,a({"data-slot":"switch",className:v("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e)},n),C.createElement(j.Thumb,{"data-slot":"switch-thumb",className:v("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")}))}var q=({open:e,onOpenChange:n,children:o})=>e?C.createElement("div",{className:"fixed inset-0 z-50 flex items-center justify-center"},C.createElement("div",{className:"fixed inset-0 bg-black/50",onClick:()=>n==null?void 0:n(false)}),o):null,L=C.forwardRef((l,s)=>{var r=l,{className:e,children:n,unstyled:o}=r,t=x(r,["className","children","unstyled"]);return C.createElement("div",a({ref:s,className:v(!o&&"relative z-50 grid w-full max-w-lg gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",e)},t),n)});L.displayName="DialogContent";var X=o=>{var t=o,{className:e}=t,n=x(t,["className"]);return C.createElement("div",a({className:v("flex flex-col space-y-1.5 text-center sm:text-left",e)},n))};X.displayName="DialogHeader";var Z=C.forwardRef((t,o)=>{var s=t,{className:e}=s,n=x(s,["className"]);return C.createElement("h3",a({ref:o,className:v("text-lg font-semibold leading-none tracking-tight",e)},n))});Z.displayName="DialogTitle";var K=C.forwardRef((t,o)=>{var s=t,{className:e}=s,n=x(s,["className"]);return C.createElement("p",a({ref:o,className:v("text-sm text-muted-foreground",e)},n))});K.displayName="DialogDescription";var Ie=[{id:"necessary",name:"Necessary Cookies",description:"These cookies are essential for the website to function properly.",disabled:true},{id:"analytics",name:"Analytics Cookies",description:"These cookies help us understand how visitors interact with our website.",disabled:false},{id:"marketing",name:"Marketing Cookies",description:"These cookies are used to track visitors across websites for marketing purposes.",disabled:false},{id:"functional",name:"Functional Cookies",description:"These cookies enable personalized features and functionality.",disabled:false}],J=({renderSettings:e,theme:n,unstyled:o=false,className:t,children:s})=>{let{showSettings:l,consentState:r,updateConsent:d,savePreferences:i,closeSettings:c}=g();if(!l)return null;let f=()=>{i(r);};return e?C__default.createElement(C__default.Fragment,null,e({consentState:r,onUpdateConsent:d,onSave:f,onClose:c})):s?C__default.createElement(q,{open:l,onOpenChange:c},C__default.createElement(L,{className:t,unstyled:o},s)):C__default.createElement(q,{open:l,onOpenChange:c},C__default.createElement(L,{className:"max-w-2xl"},C__default.createElement(X,null,C__default.createElement(Z,null,"Cookie Preferences"),C__default.createElement(K,null,"Manage your cookie preferences. You can enable or disable different categories of cookies below.")),C__default.createElement("div",{className:"space-y-6 py-4"},Ie.map(u=>C__default.createElement("div",{key:u.id,className:"flex items-start justify-between space-x-4"},C__default.createElement("div",{className:"flex-1"},C__default.createElement("h4",{className:"font-medium mb-1"},u.name),C__default.createElement("p",{className:"text-sm text-gray-600"},u.description)),C__default.createElement(fe,{checked:r[u.id],onCheckedChange:k=>d(u.id,k),disabled:u.disabled})))),C__default.createElement("div",{className:"flex justify-end gap-3 pt-4 border-t"},C__default.createElement(A,{variant:"outline",onClick:c},"Cancel"),C__default.createElement(A,{onClick:f,style:{backgroundColor:n==null?void 0:n.primaryColor}},"Save Preferences"))))};var je=({children:e,headless:n=false,renderBanner:o,renderSettings:t,components:s,theme:l,position:r="bottom",animation:d="slide",fullWidth:i=true,maxWidth:c="1200px"})=>{let f=g();if(typeof e=="function"){let u={consents:f.consentState,actions:{acceptAll:f.acceptAll,rejectAll:f.rejectAll,savePreferences:f.savePreferences,updateConsent:f.updateConsent,openSettings:f.openSettings,closeSettings:f.closeSettings},ui:{showBanner:f.showBanner,showSettings:f.showSettings,openSettings:f.openSettings,closeSettings:f.closeSettings}};return C__default.createElement(C__default.Fragment,null,e(u))}return C__default.createElement(C__default.Fragment,null,e,!n&&C__default.createElement(C__default.Fragment,null,s!=null&&s.Banner?C__default.createElement(s.Banner,null):C__default.createElement(U,{renderBanner:o,theme:l,position:r,animation:d,fullWidth:i,maxWidth:c}),s!=null&&s.Settings?C__default.createElement(s.Settings,null):C__default.createElement(J,{renderSettings:t,theme:l})))},ee=l=>{var r=l,{children:e,initialConsent:n,onConsentChange:o,storageKey:t}=r,s=x(r,["children","initialConsent","onConsentChange","storageKey"]);return C__default.createElement(G,{initialConsent:n,onConsentChange:o,storageKey:t},C__default.createElement(je,a({},s),e))};ee.Banner=U;ee.Settings=J;var ue=({className:e,children:n})=>{let{showBanner:o,acceptAll:t,rejectAll:s,openSettings:l}=g();return o?C__default.createElement("div",{className:e,role:"region","aria-label":"Cookie consent"},n||C__default.createElement(C__default.Fragment,null,C__default.createElement("div",null,C__default.createElement("h3",null,"Cookie Consent"),C__default.createElement("p",null,"We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.")),C__default.createElement("div",null,C__default.createElement("button",{onClick:t,"aria-label":"Accept all cookies"},"Accept All"),C__default.createElement("button",{onClick:s,"aria-label":"Reject non-essential cookies"},"Reject All"),C__default.createElement("button",{onClick:l,"aria-label":"Manage cookie preferences"},"Manage Preferences")))):null};var Le=[{id:"necessary",name:"Necessary Cookies",description:"These cookies are essential for the website to function properly.",disabled:true},{id:"analytics",name:"Analytics Cookies",description:"These cookies help us understand how visitors interact with our website.",disabled:false},{id:"marketing",name:"Marketing Cookies",description:"These cookies are used to track visitors across websites for marketing purposes.",disabled:false},{id:"functional",name:"Functional Cookies",description:"These cookies enable personalized features and functionality.",disabled:false}],pe=({className:e,children:n})=>{let{showSettings:o,consentState:t,updateConsent:s,savePreferences:l,closeSettings:r}=g();if(!o)return null;let d=()=>{l(t);};return C__default.createElement("div",{className:e,role:"dialog","aria-label":"Cookie preferences"},n||C__default.createElement(C__default.Fragment,null,C__default.createElement("div",null,C__default.createElement("h2",null,"Cookie Preferences"),C__default.createElement("p",null,"Manage your cookie preferences. You can enable or disable different categories of cookies below.")),C__default.createElement("div",null,Le.map(i=>C__default.createElement("div",{key:i.id},C__default.createElement("div",null,C__default.createElement("h4",null,i.name),C__default.createElement("p",null,i.description)),C__default.createElement("input",{type:"checkbox",checked:t[i.id],onChange:c=>s(i.id,c.target.checked),disabled:i.disabled,"aria-label":`Toggle ${i.name}`})))),C__default.createElement("div",null,C__default.createElement("button",{onClick:r,"aria-label":"Cancel changes"},"Cancel"),C__default.createElement("button",{onClick:d,"aria-label":"Save cookie preferences"},"Save Preferences"))))};var ge=({category:e,className:n,label:o})=>{let{consentState:t,updateConsent:s}=g();return C__default.createElement("label",{className:n},C__default.createElement("input",{type:"checkbox",checked:t[e],onChange:l=>s(e,l.target.checked),"aria-label":o||`Toggle ${e} cookies`}),o&&C__default.createElement("span",null,o))};function Je(){let{hasUserConsented:e,consentState:n,showBanner:o,showSettings:t}=g();return {hasUserConsented:e,consentState:n,showBanner:o,showSettings:t}}function ze(){let{acceptAll:e,rejectAll:n,savePreferences:o,openSettings:t,closeSettings:s,updateConsent:l}=g();return {acceptAll:e,rejectAll:n,savePreferences:o,openSettings:t,closeSettings:s,updateConsent:l}}function Fe(){let e=g(),n=useRef(new Map),o=useRef({hasUserConsented:e.hasUserConsented,showBanner:e.showBanner,showSettings:e.showSettings,consentState:e.consentState}),t=useCallback((r,d)=>{let i=n.current.get(r);i&&i.forEach(c=>c(d));},[]),s=useCallback((r,d)=>(n.current.has(r)||n.current.set(r,new Set),n.current.get(r).add(d),()=>{let i=n.current.get(r);i&&i.delete(d);}),[]),l=useCallback((r,d)=>{let i=n.current.get(r);i&&i.delete(d);},[]);return useEffect(()=>{let r=o.current;if(!r.hasUserConsented&&e.hasUserConsented){let d=Object.entries(e.consentState).filter(([i])=>i!=="necessary").every(([,i])=>i);t(d?"consent:accepted":"consent:rejected",e.consentState);}r.hasUserConsented&&e.hasUserConsented&&JSON.stringify(r.consentState)!==JSON.stringify(e.consentState)&&t("consent:updated",e.consentState),!r.showBanner&&e.showBanner?t("banner:shown"):r.showBanner&&!e.showBanner&&t("banner:hidden"),!r.showSettings&&e.showSettings?t("settings:opened"):r.showSettings&&!e.showSettings&&t("settings:closed"),o.current={hasUserConsented:e.hasUserConsented,showBanner:e.showBanner,showSettings:e.showSettings,consentState:a({},e.consentState)};},[e,t]),T(a({},e),{on:s,off:l,emit:t})}var z="ndpr_consent_records",V="ndpr_consent_history",oe=()=>{if(typeof window=="undefined")return [];let e=localStorage.getItem(V);if(!e)return [];try{return JSON.parse(e)}catch(n){return console.error("Error parsing consent history:",n),[]}},ve={saveConsent:(e,n)=>{let o={id:v4(),userId:n,consents:e,timestamp:new Date().toISOString(),ipAddress:"Collected server-side in real implementation",userAgent:typeof window!="undefined"?window.navigator.userAgent:"Unknown"};if(typeof window!="undefined"){localStorage.setItem(z,JSON.stringify(o));let t=oe();t.push(o),localStorage.setItem(V,JSON.stringify(t));}return o},getCurrentConsent:()=>{if(typeof window=="undefined")return null;let e=localStorage.getItem(z);if(!e)return null;try{return JSON.parse(e)}catch(n){return console.error("Error parsing consent record:",n),null}},getConsentHistory:()=>oe(),updateConsent:(e,n,o)=>{let t={id:v4(),userId:o,consents:e,timestamp:new Date().toISOString(),ipAddress:"Collected server-side in real implementation",userAgent:typeof window!="undefined"?window.navigator.userAgent:"Unknown",changeReason:n};if(typeof window!="undefined"){localStorage.setItem(z,JSON.stringify(t));let s=oe();s.push(t),localStorage.setItem(V,JSON.stringify(s));}return t},clearConsentData:()=>{typeof window!="undefined"&&(localStorage.removeItem(z),localStorage.removeItem(V));},hasConsent:e=>{let n=ve.getCurrentConsent();return n?n.consents[e]===true:false}};var at={set:(e,n,o)=>{if(typeof window=="undefined")return;let t=new Date;t.setTime(t.getTime()+o*24*60*60*1e3);let s=`expires=${t.toUTCString()}`;document.cookie=`${e}=${n};${s};path=/`;},get:e=>{if(typeof window=="undefined")return null;let n=`${e}=`,o=document.cookie.split(";");for(let t=0;t<o.length;t++){let s=o[t];for(;s.charAt(0)===" ";)s=s.substring(1,s.length);if(s.indexOf(n)===0)return s.substring(n.length,s.length)}return null},delete:e=>{typeof window!="undefined"&&(document.cookie=`${e}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;`);}},lt={save:(e,n)=>{typeof window!="undefined"&&localStorage.setItem(e,JSON.stringify(n));},load:e=>{if(typeof window=="undefined")return null;let n=localStorage.getItem(e);return n?JSON.parse(n):null},remove:e=>{typeof window!="undefined"&&localStorage.removeItem(e);}};export{U as ConsentBanner,Y as ConsentContext,ee as ConsentManager,G as ConsentProvider,J as ConsentSettings,ue as UnstyledConsentBanner,pe as UnstyledConsentSettings,ge as UnstyledConsentToggle,ve as consentService,lt as consentStorage,at as cookieUtils,Ee as createConsentContext,g as useConsent,ze as useConsentActions,Fe as useConsentManager,Je as useConsentState};//# sourceMappingURL=index.mjs.map
1
+ import*as p from'react';import p__default,{createContext,useState,useEffect,useCallback,useContext,useRef}from'react';import {Slot}from'@radix-ui/react-slot';import {cva}from'class-variance-authority';import {clsx}from'clsx';import {twMerge}from'tailwind-merge';import*as Fe from'@radix-ui/react-switch';import {v4}from'uuid';import'jspdf';var Ut=Object.defineProperty,Vt=Object.defineProperties;var Yt=Object.getOwnPropertyDescriptors;var ze=Object.getOwnPropertySymbols;var gt=Object.prototype.hasOwnProperty,mt=Object.prototype.propertyIsEnumerable;var pt=(e,r,o)=>r in e?Ut(e,r,{enumerable:true,configurable:true,writable:true,value:o}):e[r]=o,l=(e,r)=>{for(var o in r||(r={}))gt.call(r,o)&&pt(e,o,r[o]);if(ze)for(var o of ze(r))mt.call(r,o)&&pt(e,o,r[o]);return e},z=(e,r)=>Vt(e,Yt(r));var E=(e,r)=>{var o={};for(var a in e)gt.call(e,a)&&r.indexOf(a)<0&&(o[a]=e[a]);if(e!=null&&ze)for(var a of ze(e))r.indexOf(a)<0&&mt.call(e,a)&&(o[a]=e[a]);return o};var xe=(e,r,o)=>new Promise((a,t)=>{var n=s=>{try{c(o.next(s));}catch(m){t(m);}},i=s=>{try{c(o.throw(s));}catch(m){t(m);}},c=s=>s.done?a(s.value):Promise.resolve(s.value).then(n,i);c((o=o.apply(e,r)).next());});var Ue=createContext(void 0),ht={necessary:true,analytics:false,marketing:false,functional:false};function Ve({children:e,initialConsent:r={},onConsentChange:o,storageKey:a="ndpr-consent"}){let[t,n]=useState(()=>{if(typeof window!="undefined"){let O=localStorage.getItem(a);if(O)try{let Q=JSON.parse(O);return l(l({},ht),Q)}catch(Q){console.error("Failed to parse consent from localStorage",Q);}}return l(l({},ht),r)}),[i,c]=useState(()=>typeof window!="undefined"?localStorage.getItem(`${a}-set`)==="true":false),[s,m]=useState(!i),[k,w]=useState(false);useEffect(()=>{typeof window!="undefined"&&i&&(localStorage.setItem(a,JSON.stringify(t)),localStorage.setItem(`${a}-set`,"true"));},[t,i,a]),useEffect(()=>{i&&o&&o(t);},[t,i,o]);let B=useCallback(()=>{n({necessary:true,analytics:true,marketing:true,functional:true}),c(true),m(false),w(false);},[]),D=useCallback(()=>{n({necessary:true,analytics:false,marketing:false,functional:false}),c(true),m(false),w(false);},[]),T=useCallback(O=>{n(Q=>z(l(l({},Q),O),{necessary:true})),c(true),m(false),w(false);},[]),u=useCallback((O,Q)=>{O!=="necessary"&&n(g=>z(l({},g),{[O]:Q}));},[]),$=useCallback(()=>{w(true),m(false);},[]),de=useCallback(()=>{w(false);},[]),ae={hasUserConsented:i,consentState:t,showBanner:s,showSettings:k,acceptAll:B,rejectAll:D,savePreferences:T,openSettings:$,closeSettings:de,updateConsent:u};return p__default.createElement(Ue.Provider,{value:ae},e)}function K(){let e=useContext(Ue);if(!e)throw new Error("useConsent must be used within a ConsentProvider");return e}function Xt(){let e=createContext(void 0);function r({children:a,initialConsent:t={},onConsentChange:n,storageKey:i="ndpr-consent",categories:c}){let s=()=>{let A={necessary:true};return c?c.forEach(d=>{if(d.id!=="necessary"){let y=d.id;A[y]=false;}}):(A.analytics=false,A.marketing=false,A.functional=false),A},[m,k]=useState(()=>{if(typeof window!="undefined"){let A=localStorage.getItem(i);if(A)try{let d=JSON.parse(A);return l(l({},s()),d)}catch(d){console.error("Failed to parse consent from localStorage",d);}}return l(l({},s()),t)}),[w,B]=useState(()=>typeof window!="undefined"?localStorage.getItem(`${i}-set`)==="true":false),[D,T]=useState(!w),[u,$]=useState(false);useEffect(()=>{typeof window!="undefined"&&w&&(localStorage.setItem(i,JSON.stringify(m)),localStorage.setItem(`${i}-set`,"true"));},[m,w,i]),useEffect(()=>{w&&n&&n(m);},[m,w,n]);let de=useCallback(()=>{let A=l({},m);Object.keys(A).forEach(d=>{A[d]=true;}),k(A),B(true),T(false),$(false);},[m]),ae=useCallback(()=>{let A=l({},m);Object.keys(A).forEach(d=>{d!=="necessary"&&(A[d]=false);}),k(A),B(true),T(false),$(false);},[m]),O=useCallback(A=>{k(d=>z(l(l({},d),A),{necessary:true})),B(true),T(false),$(false);},[]),Q=useCallback((A,d)=>{A!=="necessary"&&k(y=>z(l({},y),{[A]:d}));},[]),g=useCallback(()=>{$(true),T(false);},[]),N=useCallback(()=>{$(false);},[]),W={hasUserConsented:w,consentState:m,showBanner:D,showSettings:u,acceptAll:de,rejectAll:ae,savePreferences:O,openSettings:g,closeSettings:N,updateConsent:Q};return p__default.createElement(e.Provider,{value:W},a)}function o(){let a=useContext(e);if(!a)throw new Error("useConsent must be used within a ConsentProvider");return a}return {ConsentContext:e,ConsentProvider:r,useConsent:o}}function b(...e){return twMerge(clsx(e))}var or=cva("inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",{variants:{variant:{default:"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",destructive:"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",outline:"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",secondary:"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",ghost:"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",link:"text-primary underline-offset-4 hover:underline"},size:{default:"h-9 px-4 py-2 has-[>svg]:px-3",sm:"h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",lg:"h-10 rounded-md px-6 has-[>svg]:px-4",icon:"size-9"}},defaultVariants:{variant:"default",size:"default"}});function q(n){var i=n,{className:e,variant:r,size:o,asChild:a=false}=i,t=E(i,["className","variant","size","asChild"]);return p.createElement(a?Slot:"button",l({"data-slot":"button",className:b(or({variant:r,size:o,className:e}))},t))}var Ne=({renderBanner:e,theme:r,position:o="bottom",animation:a="slide",fullWidth:t=true,maxWidth:n="1200px",unstyled:i=false,className:c,children:s})=>{let{showBanner:m,acceptAll:k,rejectAll:w,openSettings:B}=K();return m?e?p__default.createElement(p__default.Fragment,null,e({onAcceptAll:k,onRejectAll:w,onOpenSettings:B})):s?p__default.createElement("div",{className:b(!i&&["fixed z-50 p-4",o==="bottom"&&"bottom-0 left-0 right-0",o==="top"&&"top-0 left-0 right-0",o==="center"&&"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",a==="slide"&&"animate-slide-in",a==="fade"&&"animate-fade-in"],c),style:{backgroundColor:i?void 0:(r==null?void 0:r.backgroundColor)||"white",color:i||r==null?void 0:r.textColor,maxWidth:t?void 0:n,margin:t?void 0:"0 auto"}},s):p__default.createElement("div",{className:b("fixed z-50 p-4",o==="bottom"&&"bottom-0 left-0 right-0",o==="top"&&"top-0 left-0 right-0",o==="center"&&"top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2",a==="slide"&&"animate-slide-in",a==="fade"&&"animate-fade-in",c),style:{backgroundColor:(r==null?void 0:r.backgroundColor)||"white",color:r==null?void 0:r.textColor}},p__default.createElement("div",{className:"mx-auto",style:{maxWidth:t?void 0:n}},p__default.createElement("div",{className:"bg-white rounded-lg shadow-lg p-6"},p__default.createElement("h3",{className:"text-lg font-semibold mb-2"},"Cookie Consent"),p__default.createElement("p",{className:"text-gray-600 mb-4"},"We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies."),p__default.createElement("div",{className:"flex gap-3 flex-wrap"},p__default.createElement(q,{onClick:k,style:{backgroundColor:r==null?void 0:r.primaryColor}},"Accept All"),p__default.createElement(q,{onClick:w,variant:"outline"},"Reject All"),p__default.createElement(q,{onClick:B,variant:"ghost"},"Manage Preferences"))))):null},vt=({children:e,className:r})=>p__default.createElement("div",{className:b("mb-4",r)},e);vt.displayName="ConsentBanner.Message";var Ct=({children:e,className:r})=>p__default.createElement("div",{className:b("flex gap-3 flex-wrap",r)},e);Ct.displayName="ConsentBanner.Actions";Ne.Message=vt;Ne.Actions=Ct;function wt(o){var a=o,{className:e}=a,r=E(a,["className"]);return p.createElement(Fe.Root,l({"data-slot":"switch",className:b("peer data-[state=checked]:bg-primary data-[state=unchecked]:bg-input focus-visible:border-ring focus-visible:ring-ring/50 dark:data-[state=unchecked]:bg-input/80 inline-flex h-[1.15rem] w-8 shrink-0 items-center rounded-full border border-transparent shadow-xs transition-all outline-none focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50",e)},r),p.createElement(Fe.Thumb,{"data-slot":"switch-thumb",className:b("bg-background dark:data-[state=unchecked]:bg-foreground dark:data-[state=checked]:bg-primary-foreground pointer-events-none block size-4 rounded-full ring-0 transition-transform data-[state=checked]:translate-x-[calc(100%-2px)] data-[state=unchecked]:translate-x-0")}))}var _e=({open:e,onOpenChange:r,children:o})=>e?p.createElement("div",{className:"fixed inset-0 z-50 flex items-center justify-center"},p.createElement("div",{className:"fixed inset-0 bg-black/50",onClick:()=>r==null?void 0:r(false)}),o):null,Me=p.forwardRef((n,t)=>{var i=n,{className:e,children:r,unstyled:o}=i,a=E(i,["className","children","unstyled"]);return p.createElement("div",l({ref:t,className:b(!o&&"relative z-50 grid w-full max-w-lg gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 sm:rounded-lg",e)},a),r)});Me.displayName="DialogContent";var Ge=o=>{var a=o,{className:e}=a,r=E(a,["className"]);return p.createElement("div",l({className:b("flex flex-col space-y-1.5 text-center sm:text-left",e)},r))};Ge.displayName="DialogHeader";var Qe=p.forwardRef((a,o)=>{var t=a,{className:e}=t,r=E(t,["className"]);return p.createElement("h3",l({ref:o,className:b("text-lg font-semibold leading-none tracking-tight",e)},r))});Qe.displayName="DialogTitle";var Je=p.forwardRef((a,o)=>{var t=a,{className:e}=t,r=E(t,["className"]);return p.createElement("p",l({ref:o,className:b("text-sm text-muted-foreground",e)},r))});Je.displayName="DialogDescription";var ar=[{id:"necessary",name:"Necessary Cookies",description:"These cookies are essential for the website to function properly.",disabled:true},{id:"analytics",name:"Analytics Cookies",description:"These cookies help us understand how visitors interact with our website.",disabled:false},{id:"marketing",name:"Marketing Cookies",description:"These cookies are used to track visitors across websites for marketing purposes.",disabled:false},{id:"functional",name:"Functional Cookies",description:"These cookies enable personalized features and functionality.",disabled:false}],je=({renderSettings:e,theme:r,unstyled:o=false,className:a,children:t})=>{let{showSettings:n,consentState:i,updateConsent:c,savePreferences:s,closeSettings:m}=K();if(!n)return null;let k=()=>{s(i);};return e?p__default.createElement(p__default.Fragment,null,e({consentState:i,onUpdateConsent:c,onSave:k,onClose:m})):t?p__default.createElement(_e,{open:n,onOpenChange:m},p__default.createElement(Me,{className:a,unstyled:o},t)):p__default.createElement(_e,{open:n,onOpenChange:m},p__default.createElement(Me,{className:"max-w-2xl"},p__default.createElement(Ge,null,p__default.createElement(Qe,null,"Cookie Preferences"),p__default.createElement(Je,null,"Manage your cookie preferences. You can enable or disable different categories of cookies below.")),p__default.createElement("div",{className:"space-y-6 py-4"},ar.map(w=>p__default.createElement("div",{key:w.id,className:"flex items-start justify-between space-x-4"},p__default.createElement("div",{className:"flex-1"},p__default.createElement("h4",{className:"font-medium mb-1"},w.name),p__default.createElement("p",{className:"text-sm text-gray-600"},w.description)),p__default.createElement(wt,{checked:i[w.id],onCheckedChange:B=>c(w.id,B),disabled:w.disabled})))),p__default.createElement("div",{className:"flex justify-end gap-3 pt-4 border-t"},p__default.createElement(q,{variant:"outline",onClick:m},"Cancel"),p__default.createElement(q,{onClick:k,style:{backgroundColor:r==null?void 0:r.primaryColor}},"Save Preferences"))))};var nr=({children:e,headless:r=false,renderBanner:o,renderSettings:a,components:t,theme:n,position:i="bottom",animation:c="slide",fullWidth:s=true,maxWidth:m="1200px"})=>{let k=K();if(typeof e=="function"){let w={consents:k.consentState,actions:{acceptAll:k.acceptAll,rejectAll:k.rejectAll,savePreferences:k.savePreferences,updateConsent:k.updateConsent,openSettings:k.openSettings,closeSettings:k.closeSettings},ui:{showBanner:k.showBanner,showSettings:k.showSettings,openSettings:k.openSettings,closeSettings:k.closeSettings}};return p__default.createElement(p__default.Fragment,null,e(w))}return p__default.createElement(p__default.Fragment,null,e,!r&&p__default.createElement(p__default.Fragment,null,t!=null&&t.Banner?p__default.createElement(t.Banner,null):p__default.createElement(Ne,{renderBanner:o,theme:n,position:i,animation:c,fullWidth:s,maxWidth:m}),t!=null&&t.Settings?p__default.createElement(t.Settings,null):p__default.createElement(je,{renderSettings:a,theme:n})))},Ke=n=>{var i=n,{children:e,initialConsent:r,onConsentChange:o,storageKey:a}=i,t=E(i,["children","initialConsent","onConsentChange","storageKey"]);return p__default.createElement(Ve,{initialConsent:r,onConsentChange:o,storageKey:a},p__default.createElement(nr,l({},t),e))};Ke.Banner=Ne;Ke.Settings=je;var xt=({className:e,children:r})=>{let{showBanner:o,acceptAll:a,rejectAll:t,openSettings:n}=K();return o?p__default.createElement("div",{className:e,role:"region","aria-label":"Cookie consent"},r||p__default.createElement(p__default.Fragment,null,p__default.createElement("div",null,p__default.createElement("h3",null,"Cookie Consent"),p__default.createElement("p",null,"We use cookies to enhance your experience. By continuing to visit this site you agree to our use of cookies.")),p__default.createElement("div",null,p__default.createElement("button",{onClick:a,"aria-label":"Accept all cookies"},"Accept All"),p__default.createElement("button",{onClick:t,"aria-label":"Reject non-essential cookies"},"Reject All"),p__default.createElement("button",{onClick:n,"aria-label":"Manage cookie preferences"},"Manage Preferences")))):null};var ir=[{id:"necessary",name:"Necessary Cookies",description:"These cookies are essential for the website to function properly.",disabled:true},{id:"analytics",name:"Analytics Cookies",description:"These cookies help us understand how visitors interact with our website.",disabled:false},{id:"marketing",name:"Marketing Cookies",description:"These cookies are used to track visitors across websites for marketing purposes.",disabled:false},{id:"functional",name:"Functional Cookies",description:"These cookies enable personalized features and functionality.",disabled:false}],kt=({className:e,children:r})=>{let{showSettings:o,consentState:a,updateConsent:t,savePreferences:n,closeSettings:i}=K();if(!o)return null;let c=()=>{n(a);};return p__default.createElement("div",{className:e,role:"dialog","aria-label":"Cookie preferences"},r||p__default.createElement(p__default.Fragment,null,p__default.createElement("div",null,p__default.createElement("h2",null,"Cookie Preferences"),p__default.createElement("p",null,"Manage your cookie preferences. You can enable or disable different categories of cookies below.")),p__default.createElement("div",null,ir.map(s=>p__default.createElement("div",{key:s.id},p__default.createElement("div",null,p__default.createElement("h4",null,s.name),p__default.createElement("p",null,s.description)),p__default.createElement("input",{type:"checkbox",checked:a[s.id],onChange:m=>t(s.id,m.target.checked),disabled:s.disabled,"aria-label":`Toggle ${s.name}`})))),p__default.createElement("div",null,p__default.createElement("button",{onClick:i,"aria-label":"Cancel changes"},"Cancel"),p__default.createElement("button",{onClick:c,"aria-label":"Save cookie preferences"},"Save Preferences"))))};var Pt=({category:e,className:r,label:o})=>{let{consentState:a,updateConsent:t}=K();return p__default.createElement("label",{className:r},p__default.createElement("input",{type:"checkbox",checked:a[e],onChange:n=>t(e,n.target.checked),"aria-label":o||`Toggle ${e} cookies`}),o&&p__default.createElement("span",null,o))};function sr(){let{hasUserConsented:e,consentState:r,showBanner:o,showSettings:a}=K();return {hasUserConsented:e,consentState:r,showBanner:o,showSettings:a}}function lr(){let{acceptAll:e,rejectAll:r,savePreferences:o,openSettings:a,closeSettings:t,updateConsent:n}=K();return {acceptAll:e,rejectAll:r,savePreferences:o,openSettings:a,closeSettings:t,updateConsent:n}}function cr(){let e=K(),r=useRef(new Map),o=useRef({hasUserConsented:e.hasUserConsented,showBanner:e.showBanner,showSettings:e.showSettings,consentState:e.consentState}),a=useCallback((i,c)=>{let s=r.current.get(i);s&&s.forEach(m=>m(c));},[]),t=useCallback((i,c)=>(r.current.has(i)||r.current.set(i,new Set),r.current.get(i).add(c),()=>{let s=r.current.get(i);s&&s.delete(c);}),[]),n=useCallback((i,c)=>{let s=r.current.get(i);s&&s.delete(c);},[]);return useEffect(()=>{let i=o.current;if(!i.hasUserConsented&&e.hasUserConsented){let c=Object.entries(e.consentState).filter(([s])=>s!=="necessary").every(([,s])=>s);a(c?"consent:accepted":"consent:rejected",e.consentState);}i.hasUserConsented&&e.hasUserConsented&&JSON.stringify(i.consentState)!==JSON.stringify(e.consentState)&&a("consent:updated",e.consentState),!i.showBanner&&e.showBanner?a("banner:shown"):i.showBanner&&!e.showBanner&&a("banner:hidden"),!i.showSettings&&e.showSettings?a("settings:opened"):i.showSettings&&!e.showSettings&&a("settings:closed"),o.current={hasUserConsented:e.hasUserConsented,showBanner:e.showBanner,showSettings:e.showSettings,consentState:l({},e.consentState)};},[e,a]),z(l({},e),{on:t,off:n,emit:a})}var Ze=class{static isStorageAvailable(){if(typeof window=="undefined")return false;try{let r="__storage_test__";return window.localStorage.setItem(r,"test"),window.localStorage.removeItem(r),!0}catch(r){return false}}static getItem(r,o){if(!this.isStorageAvailable())return console.warn("localStorage is not available"),o!=null?o:null;try{let a=window.localStorage.getItem(r);if(a===null)return o!=null?o:null;try{return JSON.parse(a)}catch(t){return a}}catch(a){return console.error(`Error reading from localStorage: ${r}`,a),o!=null?o:null}}static setItem(r,o){if(!this.isStorageAvailable())return console.warn("localStorage is not available"),false;try{let a=typeof o=="string"?o:JSON.stringify(o);return window.localStorage.setItem(r,a),!0}catch(a){if(a instanceof Error&&a.name==="QuotaExceededError"){console.error("localStorage quota exceeded"),this.clearOldData();try{let t=typeof o=="string"?o:JSON.stringify(o);return window.localStorage.setItem(r,t),!0}catch(t){return console.error("Failed to save after clearing old data"),false}}return console.error(`Error writing to localStorage: ${r}`,a),false}}static removeItem(r){if(!this.isStorageAvailable())return console.warn("localStorage is not available"),false;try{return window.localStorage.removeItem(r),!0}catch(o){return console.error(`Error removing from localStorage: ${r}`,o),false}}static clear(){if(!this.isStorageAvailable())return console.warn("localStorage is not available"),false;try{return window.localStorage.clear(),!0}catch(r){return console.error("Error clearing localStorage",r),false}}static getStorageSize(){if(!this.isStorageAvailable())return 0;let r=0;try{for(let o in window.localStorage)window.localStorage.hasOwnProperty(o)&&(r+=window.localStorage[o].length+o.length);}catch(o){console.error("Error calculating storage size",o);}return r}static clearOldData(r=30){if(!this.isStorageAvailable())return;let o=Date.now()-r*24*60*60*1e3,a=[];try{for(let t in window.localStorage)if(window.localStorage.hasOwnProperty(t))try{let n=window.localStorage.getItem(t);if(n){let i=JSON.parse(n);i.timestamp&&i.timestamp<o&&a.push(t);}}catch(n){}a.forEach(t=>this.removeItem(t));}catch(t){console.error("Error clearing old data",t);}}static setItemWithTimestamp(r,o){let a={data:o,timestamp:Date.now()};return this.setItem(r,a)}static getItemWithTimestamp(r,o){let a=this.getItem(r);return a?o&&a.timestamp&&Date.now()-a.timestamp>o?(this.removeItem(r),null):a.data:null}};var ge=Ze;var Be="ndpr_consent_records",Le="ndpr_consent_history",et=()=>ge.getItem(Le,[])||[],tt={saveConsent:(e,r)=>{let o={id:v4(),userId:r,consents:e,timestamp:new Date,ipAddress:"Collected server-side in real implementation",userAgent:typeof window!="undefined"?window.navigator.userAgent:"Unknown",version:"1.0"};if(!ge.setItem(Be,o))throw new Error("Failed to save consent record");let a={timestamp:new Date,consents:e,action:"granted",ipAddress:"Collected server-side in real implementation",userAgent:typeof window!="undefined"?window.navigator.userAgent:"Unknown",version:"1.0"},t=et();if(t.push(a),!ge.setItem(Le,t))throw new Error("Failed to save consent history");return o},getCurrentConsent:()=>ge.getItem(Be),getConsentHistory:()=>et(),updateConsent:(e,r,o)=>{let a=tt.getCurrentConsent(),t={id:v4(),userId:o,consents:e,timestamp:new Date,ipAddress:"Collected server-side in real implementation",userAgent:typeof window!="undefined"?window.navigator.userAgent:"Unknown",version:"1.0"};if(!ge.setItem(Be,t))throw new Error("Failed to save consent record");let n="updated";a?Object.values(e).every(m=>!m)&&(n="revoked"):n="granted";let i={timestamp:new Date,consents:e,action:n,ipAddress:"Collected server-side in real implementation",userAgent:typeof window!="undefined"?window.navigator.userAgent:"Unknown",version:"1.0"},c=et();if(c.push(i),!ge.setItem(Le,c))throw new Error("Failed to save consent history");return t},clearConsentData:()=>{let e=ge.removeItem(Be),r=ge.removeItem(Le);return e&&r},hasConsent:e=>{let r=tt.getCurrentConsent();return r?r.consents[e]===true:false}};var U=p.forwardRef((t,a)=>{var n=t,{className:e,type:r}=n,o=E(n,["className","type"]);return p.createElement("input",l({type:r,className:b("block w-full px-3 py-2 text-base","border border-gray-300 dark:border-gray-600 rounded-md shadow-sm","bg-white dark:bg-gray-800 text-gray-900 dark:text-white","placeholder:text-gray-400 dark:placeholder:text-gray-500","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:focus:ring-blue-400 dark:focus:border-blue-400","disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-gray-50 dark:disabled:bg-gray-900",e),ref:a},o))});U.displayName="Input";var ee=p__default.forwardRef((a,o)=>{var t=a,{className:e}=t,r=E(t,["className"]);return p__default.createElement("textarea",l({className:b("block w-full px-3 py-2 text-base","border border-gray-300 dark:border-gray-600 rounded-md shadow-sm","bg-white dark:bg-gray-800 text-gray-900 dark:text-white","placeholder:text-gray-400 dark:placeholder:text-gray-500","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:focus:ring-blue-400 dark:focus:border-blue-400","disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-gray-50 dark:disabled:bg-gray-900","min-h-[80px] resize-y","hover:border-blue-400 dark:hover:border-blue-500 transition-colors duration-200",e),ref:o},r))});ee.displayName="TextArea";var M=p__default.forwardRef((m,s)=>{var k=m,{id:e,label:r,description:o,error:a,required:t=false,className:n,children:i}=k,c=E(k,["id","label","description","error","required","className","children"]);return p__default.createElement("div",l({ref:s,className:b("mb-4",n)},c),p__default.createElement("div",{className:"mb-1.5"},p__default.createElement("label",{htmlFor:e,className:"block text-sm font-medium text-gray-900 dark:text-gray-100"},r,t&&p__default.createElement("span",{className:"ml-1 text-red-500"},"*")),o&&p__default.createElement("p",{className:"mt-1 text-xs text-gray-500 dark:text-gray-400"},o)),p__default.createElement("div",{className:"mt-1"},i),a&&p__default.createElement("p",{className:"mt-1.5 text-xs text-red-600 dark:text-red-400"},a))});M.displayName="FormField";var se=p__default.forwardRef((n,t)=>{var i=n,{className:e,label:r,description:o}=i,a=E(i,["className","label","description"]);let c=p__default.useId(),s=a.id||c;return p__default.createElement("div",{className:"flex items-start"},p__default.createElement("div",{className:"flex items-center h-5"},p__default.createElement("input",l({type:"checkbox",id:s,className:b("h-4 w-4 rounded border-gray-300 text-blue-600","focus:ring-blue-500 focus:ring-offset-0","disabled:opacity-70 disabled:cursor-not-allowed",e),ref:t},a))),(r||o)&&p__default.createElement("div",{className:"ml-3 text-sm"},r&&p__default.createElement("label",{htmlFor:s,className:b("font-medium text-gray-900 dark:text-white",a.disabled&&"text-gray-500 dark:text-gray-400")},r),o&&p__default.createElement("p",{className:"text-gray-500 dark:text-gray-400"},o)))});se.displayName="Checkbox";function Te({onSubmit:e,className:r=""}){let[o,a]=useState({title:"",description:"",discoveryDate:"",affectedDataSubjects:0,dataCategories:[],severity:"medium",mitigationSteps:[],reportedToAuthorities:false,reportedToDataSubjects:false}),[t,n]=useState({}),[i,c]=useState(false),[s,m]=useState(""),[k,w]=useState(""),B=["Personal identifiers (name, ID numbers)","Contact information","Financial information","Health information","Biometric data","Location data","Online identifiers (IP address, cookies)","Credentials (usernames, passwords)"],D=g=>{let{name:N,value:W,type:A}=g.target;a(A==="checkbox"?d=>z(l({},d),{[N]:g.target.checked}):A==="number"?d=>z(l({},d),{[N]:parseInt(W)||0}):d=>z(l({},d),{[N]:W})),t[N]&&n(d=>{let y=l({},d);return delete y[N],y});},T=g=>{a(N=>{let W=N.dataCategories.includes(g)?N.dataCategories.filter(A=>A!==g):[...N.dataCategories,g];return z(l({},N),{dataCategories:W})}),t.dataCategories&&n(N=>{let W=l({},N);return delete W.dataCategories,W});},u=g=>{g&&g.preventDefault(),k.trim()&&(o.dataCategories.includes(k.trim())||a(N=>z(l({},N),{dataCategories:[...N.dataCategories,k.trim()]})),w(""),t.dataCategories&&n(N=>{let W=l({},N);return delete W.dataCategories,W}));},$=g=>{g&&g.preventDefault(),s.trim()&&(a(N=>z(l({},N),{mitigationSteps:[...N.mitigationSteps,s.trim()]})),m(""),t.mitigationSteps&&n(N=>{let W=l({},N);return delete W.mitigationSteps,W}));},de=g=>{a(N=>z(l({},N),{mitigationSteps:N.mitigationSteps.filter((W,A)=>A!==g)}));},ae=(g,N)=>{g.key==="Enter"&&(g.preventDefault(),N==="category"?u():$());},O=()=>{let g={};return o.title.trim()||(g.title="Title is required"),o.description.trim()||(g.description="Description is required"),o.discoveryDate||(g.discoveryDate="Discovery date is required"),o.affectedDataSubjects<=0&&(g.affectedDataSubjects="Number of affected data subjects must be greater than 0"),o.dataCategories.length===0&&(g.dataCategories="Please select at least one data category"),o.mitigationSteps.length===0&&(g.mitigationSteps="Please add at least one mitigation step"),n(g),Object.keys(g).length===0},Q=g=>xe(null,null,function*(){if(g.preventDefault(),!!O()){c(true);try{yield new Promise(N=>setTimeout(N,1e3)),e({title:o.title,description:o.description,discoveryDate:o.discoveryDate,affectedDataSubjects:o.affectedDataSubjects,dataCategories:o.dataCategories,severity:o.severity,mitigationSteps:o.mitigationSteps,reportedToAuthorities:o.reportedToAuthorities,reportedToDataSubjects:o.reportedToDataSubjects});}catch(N){console.error("Error submitting breach notification:",N),n({submit:"An error occurred while submitting the breach notification. Please try again."});}finally{c(false);}}});return React.createElement("div",{className:`bg-white dark:bg-gray-800 shadow-sm rounded-lg border border-gray-200 dark:border-gray-700 p-6 ${r}`},React.createElement("h3",{className:"text-lg font-medium text-gray-900 dark:text-white mb-4"},"Data Breach Notification Form"),React.createElement("form",{onSubmit:Q,className:"space-y-6"},React.createElement(M,{id:"title",label:"Breach Title",required:true,error:t.title},React.createElement(U,{id:"title",name:"title",value:o.title,onChange:D,placeholder:"Enter title describing the breach"})),React.createElement(M,{id:"description",label:"Breach Description",required:true,error:t.description},React.createElement(ee,{id:"description",name:"description",value:o.description,onChange:D,rows:4,placeholder:"Detailed description of what happened, how it happened, and the potential impact"})),React.createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},React.createElement(M,{id:"discoveryDate",label:"Date of Discovery",required:true,error:t.discoveryDate},React.createElement(U,{type:"date",id:"discoveryDate",name:"discoveryDate",value:o.discoveryDate,onChange:D,max:new Date().toISOString().split("T")[0]})),React.createElement(M,{id:"affectedDataSubjects",label:"Number of Affected Data Subjects",required:true,error:t.affectedDataSubjects},React.createElement(U,{type:"number",id:"affectedDataSubjects",name:"affectedDataSubjects",value:o.affectedDataSubjects,onChange:D,min:0}))),React.createElement(M,{id:"severity",label:"Breach Severity",required:true,error:t.severity},React.createElement("select",{id:"severity",name:"severity",value:o.severity,onChange:D,className:"block w-full px-3 py-2 text-base border border-gray-300 dark:border-gray-600 rounded-md shadow-sm bg-white dark:bg-gray-800 text-gray-900 dark:text-white focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:focus:ring-blue-400 dark:focus:border-blue-400"},React.createElement("option",{value:"low"},"Low - Minimal impact on data subjects"),React.createElement("option",{value:"medium"},"Medium - Moderate impact on data subjects"),React.createElement("option",{value:"high"},"High - Significant impact on data subjects"),React.createElement("option",{value:"critical"},"Critical - Severe impact on data subjects"))),React.createElement(M,{id:"dataCategories",label:"Categories of Data Involved",required:true,error:t.dataCategories},React.createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-2 mt-2"},o.dataCategories.length>0&&o.dataCategories.filter(g=>!B.includes(g)).length>0&&React.createElement("div",{className:"col-span-2 mb-2 p-2 bg-gray-50 dark:bg-gray-800 rounded"},React.createElement("h4",{className:"text-sm font-medium mb-1"},"Added Categories:"),React.createElement("div",{className:"flex flex-wrap gap-2"},o.dataCategories.filter(g=>!B.includes(g)).map((g,N)=>React.createElement("span",{key:N,className:"inline-flex items-center px-2 py-1 rounded text-xs font-medium bg-blue-100 text-blue-800 dark:bg-blue-900 dark:text-blue-200"},g,React.createElement("button",{type:"button",className:"ml-1 text-blue-600 hover:text-blue-800 dark:text-blue-400 dark:hover:text-blue-300",onClick:()=>{a(W=>z(l({},W),{dataCategories:W.dataCategories.filter(A=>A!==g)}));}},"\xD7"))))),B.map(g=>React.createElement(se,{key:g,id:`category-${g}`,label:g,checked:o.dataCategories.includes(g),onChange:()=>T(g)}))),React.createElement("div",{className:"flex space-x-2 mt-4"},React.createElement(U,{type:"text",id:"newDataCategory",value:k,onChange:g=>w(g.target.value),onKeyPress:g=>ae(g,"category"),placeholder:"Add other data category",className:"flex-1"}),React.createElement(q,{type:"button",onClick:g=>u(g),size:"sm"},"Add"))),React.createElement(M,{id:"mitigationSteps",label:"Mitigation Steps Taken",error:t.mitigationSteps},React.createElement("div",{className:"flex space-x-2 mb-2"},React.createElement(U,{type:"text",id:"newMitigationStep",value:s,onChange:g=>m(g.target.value),onKeyPress:g=>ae(g,"mitigation"),placeholder:"e.g., Changed all passwords, Patched vulnerability",className:"flex-1"}),React.createElement(q,{type:"button",onClick:g=>$(g),size:"sm"},"Add")),o.mitigationSteps.length>0&&React.createElement("ul",{className:"mt-2 space-y-1"},o.mitigationSteps.map((g,N)=>React.createElement("li",{key:N,className:"flex items-center justify-between bg-gray-50 dark:bg-gray-700 p-2 rounded"},React.createElement("span",{className:"text-sm text-gray-700 dark:text-gray-300"},g),React.createElement(q,{type:"button",onClick:()=>de(N),variant:"ghost",size:"sm",className:"text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300"},"Remove"))))),React.createElement("div",{className:"space-y-4"},React.createElement(se,{id:"reportedToAuthorities",name:"reportedToAuthorities",checked:o.reportedToAuthorities,onChange:D,label:"Reported to Nigerian Data Protection Commission (NDPC)"}),React.createElement(se,{id:"reportedToDataSubjects",name:"reportedToDataSubjects",checked:o.reportedToDataSubjects,onChange:D,label:"Reported to affected data subjects"})),t.submit&&React.createElement("div",{className:"rounded-md bg-red-50 dark:bg-red-900/20 p-4"},React.createElement("p",{className:"text-sm text-red-700 dark:text-red-400"},t.submit)),React.createElement("div",{className:"flex justify-end"},React.createElement(q,{type:"submit",disabled:i,variant:"default"},i?"Submitting...":"Submit Breach Notification"))))}function L(o){var a=o,{className:e}=a,r=E(a,["className"]);return p.createElement("div",l({"data-slot":"card",className:b("bg-card text-card-foreground flex flex-col gap-6 rounded-xl border py-6 shadow-sm",e)},r))}function V(o){var a=o,{className:e}=a,r=E(a,["className"]);return p.createElement("div",l({"data-slot":"card-header",className:b("@container/card-header grid auto-rows-min grid-rows-[auto_auto] items-start gap-1.5 px-6 has-data-[slot=card-action]:grid-cols-[1fr_auto] [.border-b]:pb-6",e)},r))}function Y(o){var a=o,{className:e}=a,r=E(a,["className"]);return p.createElement("div",l({"data-slot":"card-title",className:b("leading-none font-semibold",e)},r))}function _(o){var a=o,{className:e}=a,r=E(a,["className"]);return p.createElement("div",l({"data-slot":"card-description",className:b("text-muted-foreground text-sm",e)},r))}function H(o){var a=o,{className:e}=a,r=E(a,["className"]);return p.createElement("div",l({"data-slot":"card-content",className:b("px-6",e)},r))}var pr=cva("inline-flex items-center rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-offset-2",{variants:{variant:{default:"bg-gray-700 text-white dark:bg-gray-500 focus:ring-gray-500",primary:"bg-blue-700 text-white dark:bg-blue-600 focus:ring-blue-500",secondary:"bg-gray-600 text-white dark:bg-gray-400 focus:ring-gray-500",success:"bg-green-700 text-white dark:bg-green-600 focus:ring-green-500",danger:"bg-red-700 text-white dark:bg-red-600 focus:ring-red-500",warning:"bg-amber-700 text-white dark:bg-amber-600 focus:ring-amber-500",info:"bg-blue-700 text-white dark:bg-blue-600 focus:ring-blue-500",outline:"border-2 border-gray-700 dark:border-gray-300 text-gray-900 dark:text-gray-100 focus:ring-gray-500"}},defaultVariants:{variant:"default"}}),rt=p__default.forwardRef((t,a)=>{var n=t,{className:e,variant:r}=n,o=E(n,["className","variant"]);return p__default.createElement("div",l({ref:a,className:b(pr({variant:r}),e)},o))});rt.displayName="Badge";function At({questions:e,onSubmit:r,className:o=""}){let[a,t]=useState(""),[n,i]=useState(""),[c,s]=useState(""),[m,k]=useState(new Date().toISOString().split("T")[0]),[w,B]=useState({}),[D,T]=useState(0),[u,$]=useState({}),[de,ae]=useState(0),O={"Assessment Questions":e},Q=Object.keys(O),g=(f,J)=>{B(F=>z(l({},F),{[f]:typeof J=="string"?parseInt(J,10):J})),u[f]&&$(F=>{let ne=l({},F);return delete ne[f],ne});},N=f=>{var J,F,ne;switch(f.type){case "text":return React.createElement(U,{id:f.id,value:w[f.id]||"",onChange:v=>g(f.id,v.target.value),placeholder:f.guidance,className:"w-full"});case "textarea":return React.createElement(ee,{id:f.id,value:w[f.id]||"",onChange:v=>g(f.id,v.target.value),placeholder:f.guidance,rows:4,className:"w-full"});case "select":return React.createElement("select",{id:f.id,value:w[f.id]||"",onChange:v=>g(f.id,v.target.value),className:"w-full p-2 border border-gray-300 rounded-md focus:ring-2 focus:ring-blue-500 focus:border-blue-500"},React.createElement("option",{value:""},"Select an option"),(J=f.options)==null?void 0:J.map(v=>React.createElement("option",{key:v.value,value:v.value},v.label)));case "radio":return (F=f.options)==null?void 0:F.map(v=>React.createElement("div",{key:v.value,className:`p-3 border rounded-md cursor-pointer transition-colors ${w[f.id]===parseInt(v.value)?"border-blue-500 bg-blue-50 dark:bg-blue-900/30 dark:border-blue-400":"border-gray-200 dark:border-gray-700 hover:bg-gray-50 dark:hover:bg-gray-800"}`,onClick:()=>g(f.id,v.value)},React.createElement("div",{className:"flex items-center justify-between"},React.createElement("div",{className:"flex items-center"},React.createElement("input",{id:`${f.id}-${v.value}`,name:f.id,type:"radio",value:v.value,checked:w[f.id]===parseInt(v.value),onChange:()=>g(f.id,v.value),className:"h-4 w-4 border-gray-300 text-blue-600 focus:ring-blue-500"}),React.createElement("label",{htmlFor:`${f.id}-${v.value}`,className:"ml-3 block text-sm text-gray-700 dark:text-gray-300 cursor-pointer"},v.label)),v.riskLevel&&I(parseInt(v.value)))));case "checkbox":return (ne=f.options)==null?void 0:ne.map(v=>{var Z;return React.createElement("div",{key:v.value,className:"flex items-center"},React.createElement("input",{id:`${f.id}-${v.value}`,type:"checkbox",value:v.value,checked:(Z=w[f.id])==null?void 0:Z.toString().includes(v.value),onChange:qt=>{var ct;let Ie=((ct=w[f.id])==null?void 0:ct.toString().split(",").filter(Boolean))||[];if(qt.target.checked)Ie.push(v.value);else {let ut=Ie.indexOf(v.value);ut>-1&&Ie.splice(ut,1);}g(f.id,Ie.join(","));},className:"h-4 w-4 border-gray-300 text-blue-600 focus:ring-blue-500 rounded"}),React.createElement("label",{htmlFor:`${f.id}-${v.value}`,className:"ml-3 block text-sm text-gray-700 dark:text-gray-300"},v.label))});case "scale":return React.createElement("div",{className:"space-y-2"},React.createElement("input",{type:"range",id:f.id,min:f.minValue||1,max:f.maxValue||5,value:w[f.id]||f.minValue||1,onChange:v=>g(f.id,v.target.value),className:"w-full"}),React.createElement("div",{className:"flex justify-between text-sm text-gray-600"},f.scaleLabels?Object.entries(f.scaleLabels).map(([v,Z])=>React.createElement("span",{key:v},String(Z))):React.createElement(React.Fragment,null,React.createElement("span",null,f.minValue||1),React.createElement("span",null,f.maxValue||5))));default:return React.createElement("p",{className:"text-gray-500"},"Unsupported question type: ",f.type)}};useEffect(()=>{let f=e.length,J=Object.keys(w).length,F=a.trim()!==""?1:0,ne=Math.round((J+F)/(f+1)*100);ae(ne);},[w,a,e.length]);let W=f=>{let J={};if(f===0)a.trim()||(J.projectName="Project name is required");else {let F=Q[f-1];O[F].forEach(v=>{w[v.id]===void 0&&(J[v.id]="Please select an answer for this question");});}return $(J),Object.keys(J).length===0},A=()=>{W(D)&&T(f=>f+1);},d=()=>{T(f=>f-1);},y=()=>{W(D)&&r(w,a);},j=()=>{if(D===0)return React.createElement("div",{className:"space-y-6"},React.createElement("h3",{className:"text-lg font-medium text-gray-900 dark:text-white"},"Project Information"),React.createElement("div",{className:"bg-blue-50 dark:bg-blue-900/20 p-4 rounded-md mb-6"},React.createElement("p",{className:"text-sm text-blue-800 dark:text-blue-200"},"This Data Protection Impact Assessment (DPIA) will help you identify and minimize data protection risks in your project. Please provide accurate information to receive the most relevant recommendations.")),React.createElement(M,{id:"projectName",label:"Project Name",required:true,error:u.projectName},React.createElement(U,{id:"projectName",value:a,onChange:F=>t(F.target.value),placeholder:"Enter the name of your project or data processing activity"})),React.createElement(M,{id:"projectDescription",label:"Project Description",description:"Briefly describe the purpose and scope of your project"},React.createElement(ee,{id:"projectDescription",value:n,onChange:F=>i(F.target.value),rows:3,placeholder:"Briefly describe the purpose and scope of your project"})),React.createElement(M,{id:"dataController",label:"Data Controller",description:"Organization responsible for the data"},React.createElement(U,{id:"dataController",value:c,onChange:F=>s(F.target.value),placeholder:"Name of the organization responsible for the data"})),React.createElement(M,{id:"assessmentDate",label:"Assessment Date"},React.createElement(U,{type:"date",id:"assessmentDate",value:m,onChange:F=>k(F.target.value)})));let f=Q[D-1],J=O[f];return React.createElement("div",{className:"space-y-6"},React.createElement("div",{className:"flex items-center space-x-2"},React.createElement("div",{className:"w-8 h-8 rounded-full bg-blue-100 dark:bg-blue-900 flex items-center justify-center"},React.createElement("span",{className:"text-blue-600 dark:text-blue-300 font-medium"},D)),React.createElement("h3",{className:"text-lg font-medium text-gray-900 dark:text-white"},f)),React.createElement("div",{className:"bg-gray-50 dark:bg-gray-800 p-4 rounded-md mb-4"},React.createElement("p",{className:"text-sm text-gray-600 dark:text-gray-400"},C(f))),J.map((F,ne)=>React.createElement("div",{key:F.id,className:"p-4 border border-gray-200 dark:border-gray-700 rounded-lg space-y-4"},React.createElement("div",{className:"flex items-start"},React.createElement("div",{className:"flex-shrink-0 w-6 h-6 rounded-full bg-blue-100 dark:bg-blue-900 flex items-center justify-center mr-3 mt-0.5"},React.createElement("span",{className:"text-blue-600 dark:text-blue-300 text-xs font-medium"},ne+1)),React.createElement("label",{className:"block text-sm font-medium text-gray-800 dark:text-gray-200"},F.text)),React.createElement("div",{className:"ml-9 space-y-2"},N(F)),u[F.id]&&React.createElement("p",{className:"ml-9 text-sm text-red-600 dark:text-red-400"},u[F.id]))))},C=f=>{switch(f){case "Data Collection":return "These questions help assess the risks associated with the types of personal data you collect and the sources of that data.";case "Data Processing":return "These questions evaluate how you use, analyze, and transform the personal data within your project.";case "Data Sharing":return "These questions examine the risks of sharing personal data with third parties or transferring it across borders.";case "Security Measures":return "These questions assess the safeguards you have in place to protect personal data from unauthorized access or breaches.";case "Data Subject Rights":return "These questions evaluate how well your project supports individuals in exercising their rights over their personal data.";default:return "Please answer the following questions about your project."}},I=f=>{let J={1:"success",2:"warning",3:"danger",4:"danger"},F={1:"Low Risk",2:"Medium Risk",3:"High Risk",4:"Very High Risk"};return React.createElement("div",{className:"flex items-center ml-auto pl-2"},React.createElement(rt,{variant:J[f]},F[f]))},ce=Q.length+1;return React.createElement(L,{className:o},React.createElement(V,null,React.createElement(Y,null,"Data Protection Impact Assessment"),React.createElement("p",{className:"text-sm text-gray-500 dark:text-gray-400"},"Assess the data protection risks of your project with our DPIA tool.")),React.createElement(H,null,React.createElement("div",{className:"mb-6"},React.createElement("div",{className:"flex items-center justify-between mb-2"},React.createElement("div",{className:"text-sm text-gray-500 dark:text-gray-400"},"Step ",D+1," of ",ce),React.createElement("div",{className:"text-sm font-medium text-gray-900 dark:text-white"},D===0?"Project Information":Q[D-1])),React.createElement("div",{className:"h-2 w-full bg-gray-200 dark:bg-gray-700 rounded-full overflow-hidden"},React.createElement("div",{className:"h-2 bg-blue-600 rounded-full transition-all duration-300 ease-in-out",style:{width:`${(D+1)/ce*100}%`}})),React.createElement("div",{className:"flex justify-between mt-2"},React.createElement("div",{className:"text-xs text-gray-500 dark:text-gray-400"},"Overall completion: ",de,"%"),D>0&&D<ce&&React.createElement("div",{className:"text-xs text-gray-500 dark:text-gray-400"},O[Q[D-1]].filter(f=>w[f.id]!==void 0).length," ","of ",O[Q[D-1]].length," questions answered"))),React.createElement("div",{className:"mb-6"},j()),React.createElement("div",{className:"flex justify-between pt-4 border-t border-gray-200 dark:border-gray-700"},D>0?React.createElement(q,{type:"button",onClick:d,variant:"outline"},React.createElement("svg",{className:"w-5 h-5 mr-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M15 19l-7-7 7-7"})),"Back"):React.createElement("div",null),D<ce-1?React.createElement(q,{type:"button",onClick:A,variant:"default"},"Next",React.createElement("svg",{className:"w-5 h-5 ml-1",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},React.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M9 5l7 7-7 7"}))):React.createElement(q,{type:"button",onClick:y,variant:"default"},"Submit Assessment"))))}function mr({size:e="md",className:r}){return p__default.createElement("div",{className:b("inline-block animate-spin rounded-full border-2 border-solid border-current border-r-transparent align-[-0.125em] motion-reduce:animate-[spin_1.5s_linear_infinite]",{sm:"h-4 w-4",md:"h-8 w-8",lg:"h-12 w-12"}[e],r),role:"status","aria-label":"Loading"},p__default.createElement("span",{className:"sr-only"},"Loading..."))}function It(i){var c=i,{loading:e=false,loadingText:r="Loading...",children:o,disabled:a,className:t}=c,n=E(c,["loading","loadingText","children","disabled","className"]);return p__default.createElement("button",l({disabled:e||a,className:b("relative inline-flex items-center justify-center",e&&"cursor-not-allowed opacity-70",t)},n),e?p__default.createElement(p__default.Fragment,null,p__default.createElement(mr,{size:"sm",className:"mr-2"}),p__default.createElement("span",null,r)):o)}var hr=e=>{switch(e){case "access":return React.createElement("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},React.createElement("path",{d:"M10 12a2 2 0 100-4 2 2 0 000 4z"}),React.createElement("path",{fillRule:"evenodd",d:"M.458 10C1.732 5.943 5.522 3 10 3s8.268 2.943 9.542 7c-1.274 4.057-5.064 7-9.542 7S1.732 14.057.458 10zM14 10a4 4 0 11-8 0 4 4 0 018 0z",clipRule:"evenodd"}));case "rectification":return React.createElement("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},React.createElement("path",{d:"M13.586 3.586a2 2 0 112.828 2.828l-.793.793-2.828-2.828.793-.793zM11.379 5.793L3 14.172V17h2.828l8.38-8.379-2.83-2.828z"}));case "erasure":return React.createElement("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},React.createElement("path",{fillRule:"evenodd",d:"M9 2a1 1 0 00-.894.553L7.382 4H4a1 1 0 000 2v10a2 2 0 002 2h8a2 2 0 002-2V6a1 1 0 100-2h-3.382l-.724-1.447A1 1 0 0011 2H9zM7 8a1 1 0 012 0v6a1 1 0 11-2 0V8zm5-1a1 1 0 00-1 1v6a1 1 0 102 0V8a1 1 0 00-1-1z",clipRule:"evenodd"}));case "restriction":return React.createElement("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},React.createElement("path",{fillRule:"evenodd",d:"M5 9V7a5 5 0 0110 0v2a2 2 0 012 2v5a2 2 0 01-2 2H5a2 2 0 01-2-2v-5a2 2 0 012-2zm8-2v2H7V7a3 3 0 016 0z",clipRule:"evenodd"}));case "portability":return React.createElement("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},React.createElement("path",{d:"M4 3a2 2 0 100 4h12a2 2 0 100-4H4z"}),React.createElement("path",{fillRule:"evenodd",d:"M3 8h14v7a2 2 0 01-2 2H5a2 2 0 01-2-2V8zm5 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z",clipRule:"evenodd"}));case "objection":return React.createElement("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},React.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"}));default:return React.createElement("svg",{className:"w-5 h-5",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},React.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-8-3a1 1 0 00-.867.5 1 1 0 11-1.731-1A3 3 0 0113 8a3.001 3.001 0 01-2 2.83V11a1 1 0 11-2 0v-1a1 1 0 011-1 1 1 0 100-2zm0 8a1 1 0 100-2 1 1 0 000 2z",clipRule:"evenodd"}))}};function Oe({onSubmit:e,className:r=""}){var T;let[o,a]=useState({requestType:"access",name:"",email:"",details:"",consent:false}),[t,n]=useState({}),[i,c]=useState(false),s=[{value:"access",label:"Access to Personal Data",description:"Request a copy of your personal data that we process"},{value:"rectification",label:"Rectification of Data",description:"Request correction of inaccurate personal data"},{value:"erasure",label:"Erasure of Data",description:'Request deletion of your personal data ("right to be forgotten")'},{value:"restriction",label:"Restriction of Processing",description:"Request to restrict how we process your data"},{value:"portability",label:"Data Portability",description:"Request to receive your data in a structured, machine-readable format"},{value:"objection",label:"Object to Processing",description:"Object to processing of your personal data"}],m=u=>{let{name:$,value:de}=u.target;a(ae=>z(l({},ae),{[$]:de})),t[$]&&n(ae=>{let O=l({},ae);return delete O[$],O});},k=()=>{let u={};return o.name.trim()||(u.name="Name is required"),o.email.trim()?/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(o.email)||(u.email="Please enter a valid email address"):u.email="Email is required",o.details.trim()||(u.details="Please provide details about your request"),o.consent||(u.consent="You must consent to the processing of your data to submit this request"),n(u),Object.keys(u).length===0},w=u=>xe(null,null,function*(){if(u.preventDefault(),!!k()){c(true);try{yield new Promise($=>setTimeout($,1e3)),e({requestType:o.requestType,name:o.name,email:o.email,details:o.details,consent:o.consent}),a({requestType:"access",name:"",email:"",details:"",consent:!1});}catch($){console.error("Error submitting request:",$),n({submit:"An error occurred while submitting your request. Please try again."});}finally{c(false);}}}),[B,D]=useState(0);return useEffect(()=>{let u=0,$=3;o.name.trim()&&u++,o.email.trim()&&u++,o.details.trim()&&u++,D(Math.round(u/$*100));},[o]),React.createElement("div",{className:`bg-white dark:bg-gray-800 shadow-lg rounded-lg overflow-hidden ${r}`},React.createElement("div",{className:"bg-gradient-to-r from-blue-600 to-indigo-700 p-6 text-white relative"},React.createElement("h2",{className:"text-xl font-bold mb-2"},"Submit a Data Subject Request"),React.createElement("p",{className:"text-blue-100 text-sm mb-4"},"Exercise your rights under the Nigeria Data Protection Regulation"),React.createElement("div",{className:"w-full h-2 bg-blue-800 rounded-full overflow-hidden mt-2"},React.createElement("div",{className:"h-full bg-green-400 transition-all duration-300 ease-out",style:{width:`${B}%`}})),React.createElement("div",{className:"flex justify-between text-xs text-blue-200 mt-1"},React.createElement("span",null,"Form Progress"),React.createElement("span",null,B,"% Complete"))),React.createElement("form",{onSubmit:w,className:"p-6 space-y-6"},React.createElement("div",{className:"mb-8"},React.createElement("label",{htmlFor:"requestType",className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Request Type"),React.createElement("div",{className:"grid grid-cols-2 md:grid-cols-3 gap-3 mb-3"},s.map(u=>React.createElement("div",{key:u.value,onClick:()=>a(z(l({},o),{requestType:u.value})),className:b("cursor-pointer border rounded-lg p-3 transition-all",o.requestType===u.value?"bg-blue-50 border-blue-500 dark:bg-blue-900/30 dark:border-blue-400":"border-gray-200 hover:border-gray-300 dark:border-gray-700 dark:hover:border-gray-600")},React.createElement("div",{className:"flex flex-col items-center text-center"},React.createElement("div",{className:b("w-10 h-10 flex items-center justify-center rounded-full mb-2",o.requestType===u.value?"bg-blue-100 text-blue-600 dark:bg-blue-800 dark:text-blue-300":"bg-gray-100 text-gray-600 dark:bg-gray-800 dark:text-gray-400")},hr(u.value)),React.createElement("span",{className:"text-sm font-medium"},u.label))))),React.createElement("p",{className:"mt-2 text-sm text-gray-500 dark:text-gray-400 bg-gray-50 dark:bg-gray-800/50 p-3 rounded-lg border border-gray-100 dark:border-gray-700"},React.createElement("span",{className:"font-medium block mb-1"},"About this request:"),(T=s.find(u=>u.value===o.requestType))==null?void 0:T.description)),React.createElement("div",{className:"bg-gray-50 dark:bg-gray-800/50 p-4 rounded-lg border border-gray-100 dark:border-gray-700 mb-6"},React.createElement("h3",{className:"text-md font-medium text-gray-900 dark:text-white mb-4"},"Personal Information"),React.createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-4 mb-4"},React.createElement(M,{id:"name",label:"Full Name",required:true,error:t.name},React.createElement("div",{className:"relative"},React.createElement("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"},React.createElement("svg",{className:"h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},React.createElement("path",{fillRule:"evenodd",d:"M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z",clipRule:"evenodd"}))),React.createElement(U,{id:"name",name:"name",value:o.name,onChange:m,className:b("pl-10",t.name&&"border-red-300 focus:border-red-500 focus:ring-red-500")}))),React.createElement(M,{id:"email",label:"Email Address",required:true,error:t.email},React.createElement("div",{className:"relative"},React.createElement("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"},React.createElement("svg",{className:"h-5 w-5 text-gray-400",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},React.createElement("path",{d:"M2.003 5.884L10 9.882l7.997-3.998A2 2 0 0016 4H4a2 2 0 00-1.997 1.884z"}),React.createElement("path",{d:"M18 8.118l-8 4-8-4V14a2 2 0 002 2h12a2 2 0 002-2V8.118z"}))),React.createElement(U,{type:"email",id:"email",name:"email",value:o.email,onChange:m,className:b("pl-10",t.email&&"border-red-300 focus:border-red-500 focus:ring-red-500")}))))),React.createElement(M,{id:"details",label:"Request Details",required:true,error:t.details,description:"Your request will be processed in accordance with the Nigeria Data Protection Regulation (NDPR) and Data Protection Act (DPA)."},React.createElement("div",{className:"relative"},React.createElement(ee,{id:"details",name:"details",rows:5,value:o.details,onChange:m,className:b(t.details&&"border-red-300 focus:border-red-500 focus:ring-red-500"),placeholder:"Please provide specific details about your request. For example, what personal data you would like to access, what corrections you need to make, etc."}),React.createElement("div",{className:"absolute bottom-2 right-2 text-xs text-gray-400"},o.details.length," characters"))),React.createElement("div",{className:"mt-4"},React.createElement(se,{id:"consent",name:"consent",checked:o.consent,onChange:u=>a(z(l({},o),{consent:u.target.checked})),label:"I consent to the processing of my personal data",description:"By submitting this form, you consent to our processing of your personal data for the purpose of handling your request."}),t.consent&&React.createElement("p",{className:"mt-1 text-sm text-red-600 dark:text-red-400"},t.consent)),t.submit&&React.createElement("div",{className:"rounded-md bg-red-50 dark:bg-red-900/20 p-4 flex items-start"},React.createElement("svg",{className:"h-5 w-5 text-red-400 mt-0.5 mr-2",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor"},React.createElement("path",{fillRule:"evenodd",d:"M10 18a8 8 0 100-16 8 8 0 000 16zM8.707 7.293a1 1 0 00-1.414 1.414L8.586 10l-1.293 1.293a1 1 0 101.414 1.414L10 11.414l1.293 1.293a1 1 0 001.414-1.414L11.414 10l1.293-1.293a1 1 0 00-1.414-1.414L10 8.586 8.707 7.293z",clipRule:"evenodd"})),React.createElement("p",{className:"text-sm text-red-700 dark:text-red-400"},t.submit)),React.createElement("div",{className:"flex justify-end pt-4 border-t border-gray-200 dark:border-gray-700"},React.createElement(q,{type:"button",variant:"secondary",onClick:()=>{a({requestType:"access",name:"",email:"",details:"",consent:false}),n({});},className:"mr-3"},"Reset Form"),React.createElement(It,{type:"submit",loading:i,loadingText:"Processing...",className:"px-6 py-2 bg-blue-600 text-white hover:bg-blue-700 rounded-md font-medium"},"Submit Request"))))}function ot({formData:e,errors:r,onChange:o}){return p__default.createElement("div",{className:"space-y-8"},p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Organization Details"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Provide information about your organization for the privacy policy")),p__default.createElement(H,{className:"pt-5"},p__default.createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-x-6 gap-y-4"},p__default.createElement(M,{id:"organizationName",label:"Organization Name",required:true,error:r.organizationName,className:"md:col-span-2"},p__default.createElement(U,{type:"text",id:"organizationName",name:"organizationName",value:e.organizationName,onChange:o,placeholder:"e.g., Acme Corporation","aria-required":"true",className:r.organizationName?"border-red-300 focus:border-red-500 focus:ring-red-500":""})),p__default.createElement(M,{id:"organizationContact",label:"Contact Information",required:true,error:r.organizationContact},p__default.createElement("div",{className:"relative"},p__default.createElement("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"},p__default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},p__default.createElement("path",{d:"M2.003 5.884L10 9.882l7.997-3.998A2 2 0 0016 4H4a2 2 0 00-1.997 1.884z"}),p__default.createElement("path",{d:"M18 8.118l-8 4-8-4V14a2 2 0 002 2h12a2 2 0 002-2V8.118z"}))),p__default.createElement(U,{type:"text",id:"organizationContact",name:"organizationContact",value:e.organizationContact,onChange:o,placeholder:"email@example.com or phone","aria-required":"true",className:`pl-10 ${r.organizationContact?"border-red-300 focus:border-red-500 focus:ring-red-500":""}`}))),p__default.createElement(M,{id:"organizationWebsite",label:"Website (Optional)",error:r.organizationWebsite},p__default.createElement("div",{className:"relative"},p__default.createElement("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"},p__default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},p__default.createElement("path",{fillRule:"evenodd",d:"M4.083 9h1.946c.089-1.546.383-2.97.837-4.118A6.004 6.004 0 004.083 9zM10 2a8 8 0 100 16 8 8 0 000-16zm0 2c-.076 0-.232.032-.465.262-.238.234-.497.623-.737 1.182-.389.907-.673 2.142-.766 3.556h3.936c-.093-1.414-.377-2.649-.766-3.556-.24-.56-.5-.948-.737-1.182C10.232 4.032 10.076 4 10 4zm3.971 5c-.089-1.546-.383-2.97-.837-4.118A6.004 6.004 0 0115.917 9h-1.946zm-2.003 2H8.032c.093 1.414.377 2.649.766 3.556.24.56.5.948.737 1.182.233.23.389.262.465.262.076 0 .232-.032.465-.262.238-.234.498-.623.737-1.182.389-.907.673-2.142.766-3.556zm1.166 4.118c.454-1.147.748-2.572.837-4.118h1.946a6.004 6.004 0 01-2.783 4.118zm-6.268 0C6.412 13.97 6.118 12.546 6.03 11H4.083a6.004 6.004 0 002.783 4.118z",clipRule:"evenodd"}))),p__default.createElement(U,{type:"text",id:"organizationWebsite",name:"organizationWebsite",value:e.organizationWebsite,onChange:o,placeholder:"e.g., https://www.example.com",className:"pl-10"})))),p__default.createElement(M,{id:"organizationAddress",label:"Address (Optional)",error:r.organizationAddress,className:"mt-4"},p__default.createElement(ee,{id:"organizationAddress",name:"organizationAddress",value:e.organizationAddress,onChange:o,rows:2,placeholder:"e.g., 123 Main Street, Lagos, Nigeria"})))),p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Compliance Settings"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Configure data protection compliance options")),p__default.createElement(H,{className:"pt-5"},p__default.createElement(se,{id:"hasDPO",name:"hasDPO",label:"We have a Data Protection Officer (DPO)",checked:e.hasDPO,onChange:o}),e.hasDPO&&p__default.createElement("div",{className:"ml-8 mt-2 mb-4"},p__default.createElement(M,{id:"dpoContact",label:"DPO Contact Information",required:true,error:r.dpoContact},p__default.createElement("div",{className:"relative"},p__default.createElement("div",{className:"absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none"},p__default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-gray-400",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},p__default.createElement("path",{fillRule:"evenodd",d:"M10 9a3 3 0 100-6 3 3 0 000 6zm-7 9a7 7 0 1114 0H3z",clipRule:"evenodd"}))),p__default.createElement(U,{type:"text",id:"dpoContact",name:"dpoContact",value:e.dpoContact,onChange:o,placeholder:"dpo@example.com or phone number","aria-required":"true",className:`pl-10 ${r.dpoContact?"border-red-300 focus:border-red-500 focus:ring-red-500":""}`})))),p__default.createElement(se,{id:"includeNDPRCompliance",name:"includeNDPRCompliance",label:"Include NDPR and DPA compliance statements",checked:e.includeNDPRCompliance,onChange:o}),p__default.createElement("div",{className:"mt-4 p-3 bg-indigo-50 dark:bg-indigo-900/20 rounded-lg border border-indigo-100 dark:border-indigo-800/30"},p__default.createElement("div",{className:"flex"},p__default.createElement("div",{className:"flex-shrink-0"},p__default.createElement("svg",{className:"h-5 w-5 text-indigo-400",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},p__default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z",clipRule:"evenodd"}))),p__default.createElement("div",{className:"ml-3 flex-1 md:flex md:justify-between"},p__default.createElement("p",{className:"text-sm text-indigo-700 dark:text-indigo-300"},"Including compliance statements helps demonstrate your commitment to data protection regulations.")))))))}function re({title:e,items:r,selectedItems:o,onToggleItem:a,required:t=false,error:n,columns:i=2,className:c=""}){return p__default.createElement("div",{className:b("relative",c)},e&&p__default.createElement("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},e," ",t&&p__default.createElement("span",{className:"text-red-500"},"*")),n&&p__default.createElement("p",{className:"mt-1 mb-2 text-sm font-medium text-red-600 dark:text-red-400"},n),p__default.createElement("div",{className:b("grid gap-x-4 gap-y-2 mt-1",i===1?"grid-cols-1":i===2?"grid-cols-1 sm:grid-cols-2":"grid-cols-1 sm:grid-cols-2 md:grid-cols-3")},r.map(s=>{let m=o.includes(s),k=`item-${s.replace(/\s+/g,"-").toLowerCase()}`;return p__default.createElement("div",{key:k,className:"flex items-start group"},p__default.createElement("div",{className:"flex items-center h-5"},p__default.createElement("input",{id:k,type:"checkbox",checked:m,onChange:()=>a(s),className:b("h-4 w-4 rounded border-2 transition-colors duration-200","focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500",m?"bg-blue-600 border-blue-600 dark:bg-blue-500 dark:border-blue-500":"border-gray-300 dark:border-gray-600","hover:border-blue-500 dark:hover:border-blue-400")})),p__default.createElement("label",{htmlFor:k,className:b("ml-2 text-sm leading-tight",m?"text-gray-900 dark:text-white font-medium":"text-gray-700 dark:text-gray-300","group-hover:text-gray-900 dark:group-hover:text-white transition-colors duration-200")},s))})))}function fe({id:e,label:r,required:o=false,error:a,children:t,className:n="",description:i}){let c=!!a;return p__default.createElement("div",{className:b("mb-5 space-y-2",n)},p__default.createElement("div",{className:"flex items-center justify-between"},p__default.createElement("label",{htmlFor:e,className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 text-gray-700 dark:text-gray-200"},r," ",o&&p__default.createElement("span",{className:"text-red-500 ml-1","aria-hidden":"true"},"*"),o&&p__default.createElement("span",{className:"sr-only"},"(required)"))),i&&p__default.createElement("p",{className:"text-sm text-gray-500 dark:text-gray-400"},i),p__default.createElement("div",{className:`relative ${c?"has-error":""}`},t,c&&p__default.createElement("div",{className:"absolute inset-y-0 right-0 pr-3 flex items-center pointer-events-none"},p__default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 text-red-500",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},p__default.createElement("path",{fillRule:"evenodd",d:"M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7 4a1 1 0 11-2 0 1 1 0 012 0zm-1-9a1 1 0 00-1 1v4a1 1 0 102 0V6a1 1 0 00-1-1z",clipRule:"evenodd"})))),c&&p__default.createElement("p",{className:"text-sm font-medium text-red-600 dark:text-red-400",id:`${e}-error`,role:"alert"},a),p__default.createElement("style",null,`
2
+ /* This ensures the error icon doesn&apos;t appear on elements that shouldn't have it */
3
+ .has-error > :global(textarea),
4
+ .has-error > :global(input:not([type="checkbox"]):not([type="radio"])),
5
+ .has-error > :global(select) {
6
+ padding-right: 2.5rem;
7
+ border-color: rgb(239, 68, 68);
8
+ }
9
+
10
+ .has-error > :global(textarea:focus),
11
+ .has-error > :global(input:focus),
12
+ .has-error > :global(select:focus) {
13
+ border-color: rgb(239, 68, 68);
14
+ --tw-ring-color: rgba(239, 68, 68, 0.2);
15
+ }
16
+ `))}var Ae=p__default.forwardRef((t,a)=>{var n=t,{className:e,children:r}=n,o=E(n,["className","children"]);return p__default.createElement("select",l({className:b("block w-full px-3 py-2 text-base","border border-gray-300 dark:border-gray-600 rounded-md shadow-sm","bg-white dark:bg-gray-800 text-gray-900 dark:text-white","placeholder:text-gray-400 dark:placeholder:text-gray-500","focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-blue-500 dark:focus:ring-blue-400 dark:focus:border-blue-400","disabled:cursor-not-allowed disabled:opacity-50 disabled:bg-gray-50 dark:disabled:bg-gray-900","appearance-none bg-no-repeat bg-right","bg-[url('data:image/svg+xml;charset=utf-8,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20fill%3D%22none%22%20viewBox%3D%220%200%2020%2020%22%3E%3Cpath%20stroke%3D%22%236b7280%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%20stroke-width%3D%221.5%22%20d%3D%22m6%208%204%204%204-4%22%2F%3E%3C%2Fsvg%3E')]","bg-[length:1.25em_1.25em] pr-10","hover:border-blue-400 dark:hover:border-blue-500 transition-colors duration-200",e),ref:a},o),r)});Ae.displayName="Select";function at({formData:e,errors:r,onChange:o,onToggleItem:a,defaultDataPurposes:t,defaultSecurityMeasures:n,dataSubjectCategories:i}){let c=["Consent of the data subject","Performance of a contract","Compliance with a legal obligation","Protection of vital interests","Performance of a task in the public interest","Legitimate interests pursued by the controller","Explicit consent for special categories","Employment and social security purposes","Vital interests where consent cannot be given","Processing by non-profit bodies","Data made public by the data subject","Legal claims or judicial acts","Substantial public interest","Preventive or occupational medicine","Public health","Archiving, research and statistics"],s=["Personal identifiers (name, email, phone)","Contact information","Location data","Financial information","Transaction data","Technical data (IP address, device info)","Profile data","Usage data","Marketing preferences","Communications data","Employment information","Education information","Biometric data","Health data","Government identifiers"];return p__default.createElement("div",{className:"space-y-8"},p__default.createElement("div",{className:"grid grid-cols-1 md:grid-cols-2 gap-6"},p__default.createElement("div",{className:"space-y-6"},p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Data Collection Purposes"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Select all the purposes for which you collect personal data")),p__default.createElement(H,{className:"pt-5"},p__default.createElement(re,{title:"",items:t,selectedItems:e.dataCollectionPurposes,onToggleItem:m=>a("dataCollectionPurposes",m),required:true,error:r.dataCollectionPurposes,columns:1,className:"space-y-1"}))),p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Data Retention"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Specify how long you retain personal data")),p__default.createElement(H,{className:"pt-5"},p__default.createElement(fe,{id:"dataRetentionPeriod",label:"Data Retention Period",required:true,error:r.dataRetentionPeriod},p__default.createElement(Ae,{id:"dataRetentionPeriod",name:"dataRetentionPeriod",value:e.dataRetentionPeriod,onChange:o},p__default.createElement("option",{value:""},"Select a retention period"),p__default.createElement("option",{value:"1 year"},"1 year"),p__default.createElement("option",{value:"2 years"},"2 years"),p__default.createElement("option",{value:"3 years"},"3 years"),p__default.createElement("option",{value:"5 years"},"5 years"),p__default.createElement("option",{value:"7 years"},"7 years"),p__default.createElement("option",{value:"10 years"},"10 years"),p__default.createElement("option",{value:"as long as necessary for the purposes described"},"As long as necessary"))))),p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Data Subjects"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Select the categories of individuals whose data you process")),p__default.createElement(H,{className:"pt-5"},p__default.createElement(re,{title:"",items:i,selectedItems:e.dataSubjects,onToggleItem:m=>a("dataSubjects",m),required:true,error:r.dataSubjects,columns:1,className:"space-y-1"})))),p__default.createElement("div",{className:"space-y-6"},p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Personal Data Categories"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Select the types of personal data you collect")),p__default.createElement(H,{className:"pt-5"},p__default.createElement(re,{title:"",items:s,selectedItems:e.dataCategories,onToggleItem:m=>a("dataCategories",m),required:true,error:r.dataCategories,columns:1,className:"space-y-1"}))),p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Legal Basis"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Select the legal grounds for processing personal data")),p__default.createElement(H,{className:"pt-5"},p__default.createElement(re,{title:"",items:c,selectedItems:e.legalBasisForProcessing,onToggleItem:m=>a("legalBasisForProcessing",m),required:true,error:r.legalBasisForProcessing,columns:1,className:"space-y-1"}))))),p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Security Measures"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Select the security measures you implement to protect personal data")),p__default.createElement(H,{className:"pt-5"},p__default.createElement(re,{title:"",items:n,selectedItems:e.securityMeasures,onToggleItem:m=>a("securityMeasures",m),columns:2,className:"space-y-1"}))))}function we({id:e,name:r,label:o,checked:a,onChange:t,className:n="",description:i}){return p__default.createElement("div",{className:b("mb-4",n)},p__default.createElement(se,{id:e,name:r,label:o,checked:a,onChange:t,description:i}))}function nt({formData:e,errors:r,onChange:o,onToggleItem:a,onAddThirdParty:t,onRemoveThirdParty:n,defaultCookieTypes:i,commonTransferCountries:c,trackingTechnologies:s,transferSafeguards:m}){let k=useRef(null),w=["Cloud service providers","Payment processors","Analytics providers","Marketing and advertising partners","Customer support services","Social media platforms","Delivery and logistics providers","IT and system maintenance providers","Professional advisors (legal, accounting)","Regulatory authorities","Business partners","Affiliates and subsidiaries"],B=["Processing payments","Delivering products or services","Customer support","Analytics and performance monitoring","Marketing and advertising","Fraud prevention and security","Legal and regulatory compliance","Service optimization","Research and development","Business operations"],D=["General Data Protection Regulation (GDPR)","California Consumer Privacy Act (CCPA)","Personal Information Protection and Electronic Documents Act (PIPEDA)","Health Insurance Portability and Accountability Act (HIPAA)","Children's Online Privacy Protection Act (COPPA)","Payment Card Industry Data Security Standard (PCI DSS)","South Africa's Protection of Personal Information Act (POPIA)","Kenya's Data Protection Act","Ghana's Data Protection Act","ISO 27001 Information Security Standard"];return p__default.createElement("div",{className:"space-y-8"},p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Third-Party Sharing"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Specify if and how you share personal data with third parties")),p__default.createElement(H,{className:"pt-5"},p__default.createElement(we,{id:"thirdPartySharing",name:"thirdPartySharing",label:"We don't share your data with third parties",checked:e.thirdPartySharing,onChange:o,className:"mb-4"}),e.thirdPartySharing&&p__default.createElement("div",{className:"space-y-4"},p__default.createElement(fe,{id:"thirdPartyInput",label:"Add Specific Third Parties",error:r.thirdParties},p__default.createElement("div",{className:"flex space-x-2 mb-2"},p__default.createElement("input",{ref:k,type:"text",id:"thirdPartyInput",placeholder:"e.g., Google Analytics, Stripe",className:"block w-full rounded-md border-gray-300 dark:border-gray-600 shadow-sm focus:border-blue-500 focus:ring-blue-500 dark:bg-gray-700 dark:text-white sm:text-sm"}),p__default.createElement("button",{type:"button",onClick:t,className:"inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md shadow-sm text-white bg-blue-600 hover:bg-blue-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-blue-500"},"Add"))),e.thirdParties.length>0&&p__default.createElement("div",{className:"mt-2"},p__default.createElement("label",{className:"block text-sm font-medium text-gray-700 dark:text-gray-300 mb-2"},"Added Third Parties:"),p__default.createElement("ul",{className:"space-y-1"},e.thirdParties.map((T,u)=>p__default.createElement("li",{key:u,className:"flex justify-between items-center bg-gray-50 dark:bg-gray-800 px-3 py-2 rounded-md text-sm"},p__default.createElement("span",null,T),p__default.createElement("button",{type:"button",onClick:()=>n(u),className:"text-red-600 hover:text-red-800 dark:text-red-400 dark:hover:text-red-300"},"Remove"))))),p__default.createElement(re,{title:"Categories of Third Parties",items:w,selectedItems:e.thirdPartyCategories,onToggleItem:T=>a("thirdPartyCategories",T),required:true,error:r.thirdPartyCategories,columns:1}),p__default.createElement(re,{title:"Purposes of Sharing",items:B,selectedItems:e.thirdPartyPurposes,onToggleItem:T=>a("thirdPartyPurposes",T),required:true,error:r.thirdPartyPurposes,columns:1})))),p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Cookies and Tracking Technologies"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Specify how you use cookies and other tracking technologies")),p__default.createElement(H,{className:"pt-5"},p__default.createElement(we,{id:"cookiesUsed",name:"cookiesUsed",label:"We use cookies and similar tracking technologies",checked:e.cookiesUsed,onChange:o,className:"mb-4"}),e.cookiesUsed&&p__default.createElement("div",{className:"space-y-4"},p__default.createElement(re,{title:"Types of Cookies Used",items:i,selectedItems:e.cookieTypes,onToggleItem:T=>a("cookieTypes",T),required:true,error:r.cookieTypes,columns:2}),p__default.createElement(fe,{id:"cookieLifespan",label:"Cookie Lifespan",required:true,error:r.cookieLifespan},p__default.createElement("select",{id:"cookieLifespan",name:"cookieLifespan",value:e.cookieLifespan,onChange:o,className:`mt-1 block w-full rounded-md shadow-sm sm:text-sm ${r.cookieLifespan?"border-red-300 focus:border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:border-blue-500 focus:ring-blue-500"} dark:bg-gray-700 dark:text-white`},p__default.createElement("option",{value:""},"Select cookie lifespan"),p__default.createElement("option",{value:"Session only"},"Session only"),p__default.createElement("option",{value:"1 day"},"1 day"),p__default.createElement("option",{value:"7 days"},"7 days"),p__default.createElement("option",{value:"30 days"},"30 days"),p__default.createElement("option",{value:"90 days"},"90 days"),p__default.createElement("option",{value:"1 year"},"1 year"),p__default.createElement("option",{value:"2 years"},"2 years"),p__default.createElement("option",{value:"Varies by cookie type"},"Varies by cookie type"))),p__default.createElement(re,{title:"Other Tracking Technologies Used",items:s,selectedItems:e.trackingTechnologies,onToggleItem:T=>a("trackingTechnologies",T),columns:2})))),p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"International Data Transfers"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Specify if you transfer data internationally and the safeguards in place")),p__default.createElement(H,{className:"pt-5"},p__default.createElement(we,{id:"internationalTransfers",name:"internationalTransfers",label:"We transfer data internationally",checked:e.internationalTransfers,onChange:o,className:"mb-4"}),e.internationalTransfers&&p__default.createElement("div",{className:"space-y-4"},p__default.createElement(re,{title:"Countries or Regions of Transfer",items:c,selectedItems:e.transferCountries,onToggleItem:T=>a("transferCountries",T),required:true,error:r.transferCountries,columns:2}),p__default.createElement(re,{title:"Transfer Safeguards",items:m,selectedItems:e.transferSafeguards,onToggleItem:T=>a("transferSafeguards",T),required:true,error:r.transferSafeguards,columns:1})))),p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Special Categories of Data"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Specify if you process children's data or special categories of personal data")),p__default.createElement(H,{className:"pt-5"},p__default.createElement("div",{className:"space-y-4"},p__default.createElement(we,{id:"processesChildrenData",name:"processesChildrenData",label:"We process data of children under 18",checked:e.processesChildrenData,onChange:o,className:"mb-2"}),e.processesChildrenData&&p__default.createElement(fe,{id:"childrenDataDetails",label:"Details about children's data processing",required:true,error:r.childrenDataDetails},p__default.createElement(ee,{id:"childrenDataDetails",name:"childrenDataDetails",value:e.childrenDataDetails,onChange:o,rows:3,placeholder:"Explain how you collect, use, and protect children's data, including parental consent mechanisms"})),p__default.createElement(we,{id:"processesSpecialCategories",name:"processesSpecialCategories",label:"We process special categories of data (race, ethnicity, health, biometric, etc.)",checked:e.processesSpecialCategories,onChange:o,className:"mb-2"}),e.processesSpecialCategories&&p__default.createElement(fe,{id:"specialCategoriesDetails",label:"Details about special category data processing",required:true,error:r.specialCategoriesDetails},p__default.createElement(ee,{id:"specialCategoriesDetails",name:"specialCategoriesDetails",value:e.specialCategoriesDetails,onChange:o,rows:3,placeholder:"Explain what special categories of data you process, why, and the legal basis for processing"}))))),p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Additional Compliance"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Specify additional compliance measures and regulatory frameworks")),p__default.createElement(H,{className:"pt-5"},p__default.createElement("div",{className:"space-y-4"},p__default.createElement(fe,{id:"dataBreachProcedures",label:"Data Breach Procedures"},p__default.createElement(ee,{id:"dataBreachProcedures",name:"dataBreachProcedures",value:e.dataBreachProcedures,onChange:o,rows:3,placeholder:"Describe your procedures for handling data breaches, including notification timelines"})),p__default.createElement(re,{title:"Additional Regulatory Compliance",items:D,selectedItems:e.regulatoryCompliance,onToggleItem:T=>a("regulatoryCompliance",T),columns:1})))))}function it({formData:e,onAddCustomSection:r,onRemoveCustomSection:o}){var D,T;let a=useRef(null),t=useRef(null),[n,i]=useState(""),[c,s]=useState(false),m=[{id:"gdpr-compliance",title:"GDPR Compliance",description:"Information about compliance with the EU General Data Protection Regulation",content:`In addition to complying with the Nigeria Data Protection Regulation (NDPR) and Data Protection Act (DPA), we also adhere to the European Union's General Data Protection Regulation (GDPR) for users from the European Economic Area (EEA).
17
+
18
+ When processing personal data of individuals in the EEA, we ensure that:
19
+ - We have a lawful basis for processing
20
+ - We implement appropriate technical and organizational measures
21
+ - We facilitate the exercise of data subject rights
22
+ - We have appropriate data transfer mechanisms in place
23
+ - We maintain records of processing activities
24
+
25
+ For more information about our GDPR compliance measures, please contact us at the details provided in the 'Contact Us' section.`,categories:["All"]},{id:"california-privacy-rights",title:"California Privacy Rights",description:"Information about compliance with California privacy laws (CCPA/CPRA)",content:`If you are a California resident, you have specific rights under California privacy laws, including the California Consumer Privacy Act (CCPA) and the California Privacy Rights Act (CPRA).
26
+
27
+ As a California resident, you have the right to:
28
+ - Know what personal information we collect about you
29
+ - Request deletion of your personal information
30
+ - Opt-out of the sale or sharing of your personal information
31
+ - Limit the use of your sensitive personal information
32
+ - Non-discrimination for exercising your rights
33
+
34
+ To exercise your California privacy rights, please contact us using the information in the 'Contact Us' section. We will respond to verifiable consumer requests within 45 days.`,categories:["All"]},{id:"mobile-app-privacy",title:"Mobile Application Privacy",description:"Privacy information specific to mobile applications",content:`Our mobile application collects and processes personal data as described in this Privacy Policy. In addition to the information outlined elsewhere in this policy, our mobile application may:
35
+
36
+ - Access your device's camera, microphone, or other sensors with your permission
37
+ - Collect device identifiers such as device ID, advertising ID, or similar identifiers
38
+ - Access your location data (precise or approximate) with your permission
39
+ - Collect information about your mobile network and internet connection
40
+
41
+ You can control these permissions through your device settings. If you choose to deny certain permissions, some features of the application may not be available or may have limited functionality.`,categories:["All"]},{id:"social-media-integration",title:"Social Media Integration",description:"Information about social media features and widgets",content:`Our services may include social media features, such as the Facebook Like button, and widgets, such as the Share button. These features may collect your IP address, which page you are visiting, and may set a cookie to enable the feature to function properly.
42
+
43
+ Social media features and widgets are either hosted by a third party or hosted directly on our site. Your interactions with these features are governed by the privacy policy of the company providing it.
44
+
45
+ If you choose to connect your account with us to a social media account, we may receive personal information about you from the social media provider, including your profile information, friends or connections list, and other information you have permitted the social media provider to share with third parties.`,categories:["All"]},{id:"ecommerce-payments",title:"Payment Processing",description:"Information about payment processing and financial data",content:`When you make a purchase through our services, your payment information is processed by our payment service providers. We do not store complete credit card or debit card details on our servers.
46
+
47
+ Our payment processors collect and store your payment information in accordance with industry standards and applicable regulations, including the Payment Card Industry Data Security Standard (PCI DSS).
48
+
49
+ We may retain certain information about your transactions, such as the date and amount of the purchase, the items purchased, and your billing and shipping information, for record-keeping, accounting, and legal compliance purposes.`,categories:["E-commerce and retail","Financial services and fintech"]},{id:"healthcare-privacy",title:"Healthcare Information Privacy",description:"Information about healthcare data protection (relevant for healthcare organizations)",content:`We understand the sensitive nature of health information and are committed to protecting the privacy and security of your health data. We implement specific measures to safeguard health information in accordance with applicable healthcare privacy laws.
50
+
51
+ We only collect health information with your explicit consent or when necessary to provide our healthcare services. We limit access to health information to authorized personnel who need it to perform their duties.
52
+
53
+ We do not use or disclose your health information for marketing purposes without your explicit consent. We maintain audit trails of access to health information and regularly review our security practices to ensure the ongoing protection of your health data.`,categories:["Healthcare and medical"]},{id:"educational-privacy",title:"Educational Records Privacy",description:"Information about educational data protection (relevant for educational institutions)",content:`We are committed to protecting the privacy of educational records and student information. We collect and process educational data only for legitimate educational purposes and in accordance with applicable education privacy laws.
54
+
55
+ We implement specific measures to safeguard educational records, including:
56
+ - Limiting access to authorized personnel with a legitimate educational interest
57
+ - Obtaining appropriate consents for certain uses of student information
58
+ - Providing access to students or parents/guardians to review and correct educational records
59
+ - Implementing security measures specific to the protection of educational data
60
+
61
+ We do not use student information for targeted advertising purposes or sell student information to third parties.`,categories:["Education and e-learning"]},{id:"ndpr-dpa-details",title:"NDPR and DPA Compliance Details",description:"Detailed information about compliance with Nigerian data protection laws",content:`We are committed to full compliance with the Nigeria Data Protection Regulation (NDPR) of 2019 and the Data Protection Act (DPA) of 2023. Our compliance measures include:
62
+
63
+ 1. **Data Protection Officer**: We have appointed a Data Protection Officer responsible for overseeing our data protection strategy and implementation.
64
+
65
+ 2. **Data Protection Impact Assessments**: We conduct DPIAs for high-risk processing activities as required by Section 2.4 of the NDPR and Section 38 of the DPA.
66
+
67
+ 3. **Data Protection Audit**: We conduct annual data protection audits and file audit reports with the Nigeria Data Protection Commission as required by Section 4.1 of the NDPR.
68
+
69
+ 4. **Data Subject Access Request Procedure**: We have implemented a clear procedure for handling data subject access requests within the 30-day timeframe specified in Section 3.1(7) of the NDPR.
70
+
71
+ 5. **Data Breach Notification**: We have established procedures to notify the Nigeria Data Protection Commission and affected data subjects of any data breaches within 72 hours, as required by Section 2.10 of the NDPR and Section 40 of the DPA.
72
+
73
+ 6. **Training and Awareness**: We provide regular training to our staff on data protection principles and practices.
74
+
75
+ 7. **Data Processing Agreements**: We enter into written agreements with all data processors as required by Section 2.7 of the NDPR and Section 37 of the DPA.
76
+
77
+ For more information about our NDPR and DPA compliance program, please contact our Data Protection Officer.`,categories:["All"]}],k=m.filter(u=>u.categories.includes("All")||u.categories.includes(e.industryCategory)),w=()=>{if(n){let u=m.find($=>$.id===n);u&&(r(u.title,u.content),i(""),s(false));}},B=()=>{a.current&&t.current&&a.current.value.trim()&&t.current.value.trim()&&(r(a.current.value.trim(),t.current.value.trim()),a.current.value="",t.current.value="");};return p__default.createElement("div",{className:"space-y-8"},p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Template Sections"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Add pre-written sections to your privacy policy")),p__default.createElement(H,{className:"pt-5"},p__default.createElement("div",{className:"space-y-3"},p__default.createElement(M,{id:"templateSection",label:"Select a Template Section"},p__default.createElement(Ae,{id:"templateSection",value:n,onChange:u=>{i(u.target.value),s(!!u.target.value);}},p__default.createElement("option",{value:""},"-- Select a template section --"),k.map(u=>p__default.createElement("option",{key:u.id,value:u.id},u.title," - ",u.description)))),c&&n&&p__default.createElement("div",{className:"mt-3 bg-white dark:bg-gray-800 p-3 rounded border border-gray-200 dark:border-gray-600"},p__default.createElement("h5",{className:"font-medium text-gray-900 dark:text-white mb-2"},(D=m.find(u=>u.id===n))==null?void 0:D.title),p__default.createElement("div",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-line max-h-40 overflow-y-auto"},(T=m.find(u=>u.id===n))==null?void 0:T.content)),p__default.createElement(q,{variant:"default",size:"sm",disabled:!n,onClick:w},"Add Template Section")))),p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Create Custom Section"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Add your own custom section to the privacy policy")),p__default.createElement(H,{className:"pt-5"},p__default.createElement("div",{className:"space-y-3"},p__default.createElement(M,{id:"customSectionTitle",label:"Section Title"},p__default.createElement(U,{id:"customSectionTitle",ref:a,placeholder:"e.g., Cookies Policy, International Transfers"})),p__default.createElement(M,{id:"customSectionContent",label:"Section Content"},p__default.createElement(ee,{id:"customSectionContent",ref:t,rows:5,placeholder:"Enter the content for this section..."})),p__default.createElement(q,{variant:"default",size:"sm",onClick:B},"Add Custom Section")))),e.customSections.length>0&&p__default.createElement(L,{className:"overflow-hidden shadow-md border border-gray-200 dark:border-gray-700"},p__default.createElement(V,{className:"bg-gradient-to-r from-slate-100 to-gray-100 dark:from-slate-800 dark:to-gray-800 pb-3"},p__default.createElement(Y,{className:"text-lg font-semibold text-gray-800 dark:text-white"},"Added Custom Sections"),p__default.createElement(_,{className:"text-sm text-gray-600 dark:text-gray-300"},"Custom sections that will be included in your privacy policy")),p__default.createElement(H,{className:"pt-5"},p__default.createElement("ul",{className:"space-y-3"},e.customSections.map((u,$)=>p__default.createElement(L,{key:$,className:"overflow-visible"},p__default.createElement(H,{className:"pt-4"},p__default.createElement("div",{className:"flex items-center justify-between mb-2"},p__default.createElement("h5",{className:"font-medium text-gray-900 dark:text-white"},u.title),p__default.createElement(q,{variant:"destructive",size:"sm",onClick:()=>o($),className:"text-red-500 hover:text-red-700"},"Remove")),p__default.createElement("div",{className:"text-sm text-gray-700 dark:text-gray-300 whitespace-pre-line max-h-32 overflow-y-auto"},u.content.length>200?`${u.content.substring(0,200)}...`:u.content),u.content.length>200&&p__default.createElement(q,{variant:"link",size:"sm",onClick:()=>alert(u.content),className:"mt-2 p-0"},"View Full Content"))))))))}function st({formData:e,previewRef:r}){return p__default.createElement("div",{className:"space-y-8"},p__default.createElement(L,{className:"transition-all duration-200"},p__default.createElement(H,{className:"p-6"},p__default.createElement("div",{className:"flex items-center justify-between mb-4 pb-3 border-b border-gray-200 dark:border-gray-700"},p__default.createElement("h3",{className:"text-lg font-medium text-gray-900 dark:text-white flex items-center"},p__default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2 text-indigo-500",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},p__default.createElement("path",{fillRule:"evenodd",d:"M4 4a2 2 0 012-2h4.586A2 2 0 0112 2.586L15.414 6A2 2 0 0116 7.414V16a2 2 0 01-2 2H6a2 2 0 01-2-2V4zm2 6a1 1 0 011-1h6a1 1 0 110 2H7a1 1 0 01-1-1zm1 3a1 1 0 100 2h6a1 1 0 100-2H7z",clipRule:"evenodd"})),"Privacy Policy Preview"),p__default.createElement("span",{className:"text-xs text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-700 px-2 py-1 rounded-full"},"Preview Mode")),p__default.createElement("div",{ref:r,className:"prose dark:prose-invert prose-indigo max-w-none text-base prose-headings:text-gray-800 dark:prose-headings:text-gray-100 prose-p:text-gray-600 dark:prose-p:text-gray-300 prose-li:text-gray-600 dark:prose-li:text-gray-300 prose-h1:text-2xl prose-h1:font-bold prose-h2:text-xl prose-h2:font-semibold prose-h2:border-b prose-h2:border-gray-200 dark:prose-h2:border-gray-700 prose-h2:pb-2 prose-h2:mt-8 overflow-auto"},p__default.createElement("h1",null,e.organizationName," Privacy Policy"),p__default.createElement("h2",null,"Introduction"),p__default.createElement("p",null,"This Privacy Policy describes how ",e.organizationName," ","collects, uses, and discloses your personal information.",e.includeNDPRCompliance&&" This policy is compliant with the Nigeria Data Protection Regulation (NDPR) and the Data Protection Act (DPA)."),p__default.createElement("h2",null,"About Us"),p__default.createElement("p",null,e.organizationName,e.organizationAddress&&` is located at ${e.organizationAddress}`,".",e.organizationWebsite&&` Our website is ${e.organizationWebsite}.`),p__default.createElement("h2",null,"Information We Collect"),p__default.createElement("p",null,"We collect and process your personal data for the following purposes:"),p__default.createElement("ul",null,(e.dataCollectionPurposes||[]).map((o,a)=>p__default.createElement("li",{key:`purpose-${a}`},o))),p__default.createElement("h2",null,"Data Retention"),p__default.createElement("p",null,"We will retain your personal data for"," ",e.dataRetentionPeriod||"a period appropriate to the purpose",", or for as long as necessary to fulfill the purposes for which it was collected."),e.thirdPartySharing&&(e.thirdParties||[]).length>0&&p__default.createElement(p__default.Fragment,null,p__default.createElement("h2",null,"Third-Party Sharing"),p__default.createElement("p",null,"We may share your personal information with the following third parties:"),p__default.createElement("ul",null,(e.thirdParties||[]).map((o,a)=>p__default.createElement("li",{key:`party-${a}`},o)))),e.cookiesUsed&&(e.cookieTypes||[]).length>0&&p__default.createElement(p__default.Fragment,null,p__default.createElement("h2",null,"Cookies and Tracking Technologies"),p__default.createElement("p",null,"Our website uses cookies and similar tracking technologies. We use the following types of cookies:"),p__default.createElement("ul",null,(e.cookieTypes||[]).map((o,a)=>p__default.createElement("li",{key:`type-${a}`},o)))),e.internationalTransfers&&(e.transferCountries||[]).length>0&&p__default.createElement(p__default.Fragment,null,p__default.createElement("h2",null,"International Data Transfers"),p__default.createElement("p",null,"We may transfer your personal data to the following countries outside Nigeria:"),p__default.createElement("ul",null,(e.transferCountries||[]).map((o,a)=>p__default.createElement("li",{key:`country-${a}`},o))),p__default.createElement("p",null,"We ensure appropriate safeguards are in place to protect your data when transferred internationally.")),(e.securityMeasures||[]).length>0&&p__default.createElement(p__default.Fragment,null,p__default.createElement("h2",null,"Security Measures"),p__default.createElement("p",null,"We implement the following security measures to protect your personal data:"),p__default.createElement("ul",null,(e.securityMeasures||[]).map((o,a)=>p__default.createElement("li",{key:`measure-${a}`},o)))),p__default.createElement("h2",null,"Your Rights"),p__default.createElement("p",null,e.includeNDPRCompliance?"Under the NDPR and DPA, you have the following rights:":"You have the following rights regarding your personal data:"),p__default.createElement("ul",null,p__default.createElement("li",null,"Right to access your personal data"),p__default.createElement("li",null,"Right to rectify inaccurate personal data"),p__default.createElement("li",null,'Right to erasure ("right to be forgotten")'),p__default.createElement("li",null,"Right to restrict processing"),p__default.createElement("li",null,"Right to object to processing"),p__default.createElement("li",null,"Right to data portability")),p__default.createElement("p",null,"To exercise these rights, please contact us at"," ",e.organizationContact,"."),(e.customSections||[]).length>0&&(e.customSections||[]).map((o,a)=>p__default.createElement("div",{key:`section-${a}`},p__default.createElement("h2",null,o.title),p__default.createElement("p",null,o.content))),e.hasDPO&&e.dpoContact&&p__default.createElement(p__default.Fragment,null,p__default.createElement("h2",null,"Data Protection Officer"),p__default.createElement("p",null,"You can contact our Data Protection Officer at"," ",e.dpoContact,".")),p__default.createElement("h2",null,"Contact Us"),p__default.createElement("p",null,"If you have any questions about this Privacy Policy, please contact us at ",e.organizationContact,"."),p__default.createElement("p",{className:"text-gray-500 dark:text-gray-400 mt-4"},"Last Updated:"," ",e.policyEffectiveDate||new Date().toISOString().split("T")[0])))))}function lt({currentStep:e,totalSteps:r,stepLabels:o}){return p__default.createElement("div",{className:"mb-10",role:"navigation","aria-label":"Form progress"},p__default.createElement("div",{className:"flex items-center justify-between"},Array.from({length:r}).map((a,t)=>{let n=t+1,i=n===e,c=n<e,s=n>e;return p__default.createElement("div",{key:n,className:`flex items-center ${n<r?"w-full":""}`},p__default.createElement("div",{className:`
78
+ flex items-center justify-center w-10 h-10 rounded-full text-sm font-medium
79
+ transition-all duration-200 ease-in-out
80
+ ${i?"bg-indigo-600 text-white ring-4 ring-indigo-100 dark:ring-indigo-900/30 scale-110":""}
81
+ ${c?"bg-indigo-600 text-white":""}
82
+ ${s?"bg-gray-200 dark:bg-gray-700 text-gray-600 dark:text-gray-400":""}
83
+ `,"aria-current":i?"step":void 0,"aria-label":`Step ${n}: ${o[t]}`},c?p__default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-6 w-6",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor","aria-hidden":"true"},p__default.createElement("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})):n),n<r&&p__default.createElement("div",{className:`
84
+ flex-1 h-1 mx-2 rounded-full
85
+ transition-all duration-200 ease-in-out
86
+ ${n<e?"bg-indigo-600":"bg-gray-200 dark:bg-gray-700"}
87
+ `,"aria-hidden":"true"}))})),p__default.createElement("div",{className:"flex justify-between mt-3"},o.map((a,t)=>{let n=t+1,i=n===e,c=n<e;return p__default.createElement("span",{key:t,className:`
88
+ text-sm transition-colors duration-200 ease-in-out
89
+ ${i?"text-indigo-600 dark:text-indigo-400 font-medium":""}
90
+ ${c?"text-gray-700 dark:text-gray-300":""}
91
+ ${!i&&!c?"text-gray-500 dark:text-gray-400":""}
92
+ `},a)})))}var Mt=["Providing and maintaining our services","Processing transactions","Sending administrative information","Improving user experience","Marketing and promotional communications","Analytics and research","Legal compliance","Customer support","Personalization of content","Account management"],jt=["Encryption of sensitive data in transit and at rest","Multi-factor authentication for system access","Regular security assessments and penetration testing","Access controls with principle of least privilege","Data backup procedures with regular testing","Comprehensive staff training on data protection","Documented incident response plan with regular drills","Physical security measures including CCTV and access controls","Network security monitoring with intrusion detection","Vulnerability management and timely patching","Third-party security assessments for vendors","Data loss prevention (DLP) systems","Regular security audits and compliance checks","Secure development practices and code reviews","Privacy by design and default in all systems","Data minimization and pseudonymization where appropriate","Secure disposal of data and equipment","Endpoint protection and mobile device management"],Bt=["Customers and clients","Employees and contractors","Job applicants","Suppliers and vendors","Website visitors and users","Marketing recipients","Business partners","Shareholders and investors","Children (under 18 years)","Vulnerable individuals","Patients (for healthcare organizations)","Students (for educational institutions)","Members (for membership organizations)","Beneficiaries (for charities/NGOs)"],Lt=["HTTP cookies","Web beacons and pixel tags","Local storage objects","Session replay tools","Device fingerprinting","IP address tracking","JavaScript trackers","Mobile app SDKs","Cross-device tracking","Social media widgets and buttons","Heatmaps and clicktracking","UTM parameters","Server logs"],Ht=["Standard Contractual Clauses (SCCs)","Binding Corporate Rules (BCRs)","Adequacy decisions by the Nigerian Data Protection Commission","Data Processing Agreements with appropriate safeguards","Explicit consent of the data subject","Necessary for the performance of a contract","Necessary for important reasons of public interest","Necessary to protect vital interests","Transfer is from a register intended to provide information to the public","Compliance with NDPR Section 2.11 and 2.12 on international transfers"],Wt=["Strictly necessary cookies","Functional cookies","Performance cookies","Targeting/advertising cookies","Social media cookies"],Ot=["United States","United Kingdom","European Union countries","Canada","Australia","India","South Africa","Kenya"];function qe({onGenerate:e,className:r=""}){let [o,a]=useState(1),[t,n]=useState({organizationName:"",organizationContact:"",organizationWebsite:"",organizationAddress:"",organizationType:"",industryCategory:"",registrationNumber:"",dataCollectionPurposes:[],dataRetentionPeriod:"",legalBasisForProcessing:[],dataCategories:[],dataSubjects:[],automatedDecisionMaking:false,automatedDecisionDetails:"",thirdPartySharing:false,thirdParties:[],thirdPartyCategories:[],thirdPartyPurposes:[],securityMeasures:[],dataBreachProcedures:"",regulatoryCompliance:[],cookiesUsed:false,cookieTypes:[],cookieLifespan:"",trackingTechnologies:[],internationalTransfers:false,transferCountries:[],transferSafeguards:[],processesChildrenData:false,childrenDataDetails:"",processesSpecialCategories:false,specialCategoriesDetails:"",policyEffectiveDate:new Date().toISOString().split("T")[0],policyUpdateProcedure:"",policyVersion:"1.0",previousPolicyUrl:"",dpoContact:"",hasDPO:false,supervisoryAuthorityContact:"",customSections:[],includeNDPRCompliance:true,includeLegalReferences:true,includeExamples:true}),[i,c]=useState({}),s=useRef(null),m=d=>{let{name:y,value:j,type:C}=d.target;n(C==="checkbox"?I=>z(l({},I),{[y]:d.target.checked}):I=>z(l({},I),{[y]:j})),i[y]&&c(I=>{let ce=l({},I);return delete ce[y],ce});},k=(d,y)=>{n(j=>{let C=[...j[d]];return C.includes(y)?z(l({},j),{[d]:C.filter(I=>I!==y)}):z(l({},j),{[d]:[...C,y]})});},w=()=>{let d=document.getElementById("thirdPartyInput");d&&d.value.trim()&&(n(y=>z(l({},y),{thirdParties:[...y.thirdParties,d.value.trim()]})),d.value="");},B=d=>{n(y=>z(l({},y),{thirdParties:y.thirdParties.filter((j,C)=>C!==d)}));},D=(d,y)=>{d.trim()&&y.trim()&&n(j=>z(l({},j),{customSections:[...j.customSections,{title:d.trim(),content:y.trim()}]}));},T=d=>{n(y=>z(l({},y),{customSections:y.customSections.filter((j,C)=>C!==d)}));},u=d=>(c({}),true),$=()=>{u()&&a(d=>d+1);},de=()=>{a(d=>d-1);},g=()=>{if(!u());let d=[{id:"introduction",title:"Introduction",content:`This Privacy Policy ("Policy") describes how ${t.organizationName} ("we", "us", or "our") collects, uses, and discloses your personal information when you visit our website${t.organizationWebsite?` at ${t.organizationWebsite}`:""}, use our services, or otherwise interact with us. This Policy applies to all personal data processed by us, regardless of the media on which it is stored. ${t.includeNDPRCompliance?`This Policy is designed to comply with the Nigeria Data Protection Regulation (NDPR) ${t.includeLegalReferences?"of 2019 ":""}and the Data Protection Act (DPA) ${t.includeLegalReferences?"of 2023 ":""}and reflects our commitment to the principles of data protection as outlined in ${t.includeLegalReferences?"Section 2.1(1) of the NDPR and Section 2 of the DPA":"the applicable regulations"}.`:""} Please read this Policy carefully to understand our practices regarding your personal data and how we will treat it.`,required:true,included:true,order:1},{id:"about-us",title:"About Us",content:`${t.organizationName} ${t.organizationType?`is a ${t.organizationType} operating in the ${t.industryCategory} sector`:""}${t.registrationNumber?`, registered with registration number ${t.registrationNumber}`:""}${t.organizationAddress?`, and located at ${t.organizationAddress}`:""}. ${t.organizationWebsite?`Our official website is ${t.organizationWebsite}.`:""} ${t.includeNDPRCompliance?"As a data controller under the NDPR and DPA, we are responsible for deciding how we hold and use personal information about you.":""}`,required:true,included:true,order:2},{id:"definitions",title:"Definitions",content:`${t.includeNDPRCompliance?`For the purposes of this Policy and in accordance with the NDPR and DPA:
93
+
94
+ - "Personal Data" means any information relating to an identified or identifiable natural person ('data subject'); an identifiable natural person is one who can be identified, directly or indirectly, in particular by reference to an identifier.
95
+ - "Processing" means any operation or set of operations performed on personal data or on sets of personal data.
96
+ - "Data Controller" means a person who either alone, jointly with other persons or in common with other persons or as a statutory body determines the purposes for and the manner in which personal data is processed or is to be processed.
97
+ - "Data Subject" means any person, who can be identified, directly or indirectly, by reference to an identification number or to one or more factors specific to his physical, physiological, mental, economic, cultural or social identity.
98
+ - "Consent" means any freely given, specific, informed and unambiguous indication of the data subject's wishes by which he or she, through a statement or a clear affirmative action, signifies agreement to the processing of personal data relating to him or her.`:`For the purposes of this Policy:
99
+
100
+ - "Personal Data" means any information relating to an identified or identifiable individual.
101
+ - "Processing" means any operation performed on personal data.
102
+ - "Data Subject" means the individual to whom the personal data relates.`}`,required:true,included:true,order:3}],y=4;if(t.dataCategories.length>0&&d.push({id:"data-categories",title:"Categories of Personal Data We Collect",content:`We collect and process the following categories of personal data:
103
+
104
+ ${t.dataCategories.map(C=>`- ${C}`).join(`
105
+ `)}${t.includeExamples?`
106
+
107
+ ${N(t.industryCategory)}`:""}`,required:true,included:true,order:y++}),t.dataSubjects.length>0&&d.push({id:"data-subjects",title:"Categories of Data Subjects",content:`This Policy applies to personal data we collect from the following categories of individuals:
108
+
109
+ ${t.dataSubjects.map(C=>`- ${C}`).join(`
110
+ `)}`,required:true,included:true,order:y++}),d.push({id:"data-collection-purposes",title:"Purposes of Data Collection and Processing",content:`We collect and process your personal data for the following specific purposes:
111
+
112
+ ${t.dataCollectionPurposes.map(C=>`- ${C}`).join(`
113
+ `)}${t.includeExamples?`
114
+
115
+ ${W(t.industryCategory)}`:""}`,required:true,included:true,order:y++}),t.legalBasisForProcessing.length>0&&d.push({id:"legal-basis",title:"Legal Basis for Processing",content:`${t.includeNDPRCompliance?`In accordance with ${t.includeLegalReferences?"Section 2.2 of the NDPR and Section 27 of the DPA":"the NDPR and DPA"}, we process your personal data on the following legal grounds:`:"We process your personal data on the following legal grounds:"}
116
+
117
+ ${t.legalBasisForProcessing.map(C=>`- ${C}`).join(`
118
+ `)}`,required:true,included:true,order:y++}),t.automatedDecisionMaking&&d.push({id:"automated-decision-making",title:"Automated Decision-Making and Profiling",content:`We use automated decision-making processes, including profiling, in the following circumstances:
119
+
120
+ ${t.automatedDecisionDetails}
121
+
122
+ ${t.includeNDPRCompliance?`In accordance with ${t.includeLegalReferences?"Section 2.3(1)(c) of the NDPR and Section 41 of the DPA":"the NDPR and DPA"}, you have the right not to be subject to a decision based solely on automated processing, including profiling, which produces legal effects concerning you or similarly significantly affects you. You can exercise this right by contacting us at ${t.organizationContact}.`:"You have the right not to be subject to a decision based solely on automated processing. You can exercise this right by contacting us."}`,required:false,included:true,order:y++}),d.push({id:"data-retention",title:"Data Retention",content:`We will retain your personal data for ${t.dataRetentionPeriod}, or for as long as necessary to fulfill the purposes for which it was collected, including for the purposes of satisfying any legal, accounting, or reporting requirements. ${t.includeNDPRCompliance?`This is in accordance with ${t.includeLegalReferences?"Section 2.1(1)(e) of the NDPR and Section 33 of the DPA":"the data retention principles of the NDPR and DPA"}.`:""}
123
+
124
+ To determine the appropriate retention period for personal data, we consider the amount, nature, and sensitivity of the personal data, the potential risk of harm from unauthorized use or disclosure of your personal data, the purposes for which we process your personal data and whether we can achieve those purposes through other means, and the applicable legal requirements.`,required:true,included:true,order:y++}),t.thirdPartySharing){let C="We may share your personal information with the following categories of recipients:";t.thirdPartyCategories.length>0&&(C+=`
125
+
126
+ Categories of third parties:
127
+ ${t.thirdPartyCategories.map(I=>`- ${I}`).join(`
128
+ `)}`),t.thirdParties.length>0&&(C+=`
129
+
130
+ Specific third parties:
131
+ ${t.thirdParties.map(I=>`- ${I}`).join(`
132
+ `)}`),t.thirdPartyPurposes.length>0&&(C+=`
133
+
134
+ We share your personal data with these third parties for the following purposes:
135
+ ${t.thirdPartyPurposes.map(I=>`- ${I}`).join(`
136
+ `)}`),C+=`
137
+
138
+ ${t.includeNDPRCompliance?`In accordance with ${t.includeLegalReferences?"Section 2.6 of the NDPR and Section 37 of the DPA":"the NDPR and DPA"}, we require all third parties to respect the security of your personal data and to treat it in accordance with the law. We do not allow our third-party service providers to use your personal data for their own purposes and only permit them to process your personal data for specified purposes and in accordance with our instructions.`:"We require all third parties to respect the security of your personal data and to treat it in accordance with applicable law."}`,d.push({id:"third-party-sharing",title:"Third-Party Sharing",content:C,required:false,included:true,order:y++});}if(t.cookiesUsed){let C="Our website uses cookies and similar tracking technologies to distinguish you from other users of our website. This helps us to provide you with a good experience when you browse our website and also allows us to improve our site.";t.cookieTypes.length>0&&(C+=`
139
+
140
+ We use the following types of cookies:
141
+ ${t.cookieTypes.map(I=>`- ${I}`).join(`
142
+ `)}`),t.cookieLifespan&&(C+=`
143
+
144
+ Cookie Lifespan: ${t.cookieLifespan}`),t.trackingTechnologies.length>0&&(C+=`
145
+
146
+ In addition to cookies, we also use the following tracking technologies:
147
+ ${t.trackingTechnologies.map(I=>`- ${I}`).join(`
148
+ `)}`),C+=`
149
+
150
+ You can set your browser to refuse all or some browser cookies, or to alert you when websites set or access cookies. If you disable or refuse cookies, please note that some parts of this website may become inaccessible or not function properly.`,d.push({id:"cookies",title:"Cookies and Tracking Technologies",content:C,required:false,included:true,order:y++});}if(t.internationalTransfers){let C=`We may transfer your personal data to countries outside Nigeria. These countries may include: ${t.transferCountries.join(", ")}.`;t.transferSafeguards.length>0&&(C+=`
151
+
152
+ Whenever we transfer your personal data out of Nigeria, we ensure a similar degree of protection is afforded to it by implementing the following safeguards:
153
+ ${t.transferSafeguards.map(I=>`- ${I}`).join(`
154
+ `)}`),C+=`
155
+
156
+ ${t.includeNDPRCompliance?`In accordance with ${t.includeLegalReferences?"Sections 2.11 and 2.12 of the NDPR and Section 44 of the DPA":"the NDPR and DPA"}, we ensure that any international transfer of personal data is done in accordance with the provisions of the regulations and that adequate protection is guaranteed for the rights of data subjects.`:"We ensure that any international transfer of personal data is done with adequate protection for the rights of data subjects."}`,d.push({id:"international-transfers",title:"International Data Transfers",content:C,required:false,included:true,order:y++});}if(t.processesChildrenData&&d.push({id:"childrens-data",title:"Children's Privacy",content:`Our services may be used by individuals under the age of 18. ${t.childrenDataDetails}
157
+
158
+ ${t.includeNDPRCompliance?`In accordance with ${t.includeLegalReferences?"Section 2.2(d) of the NDPR and Section 39 of the DPA":"the NDPR and DPA"}, we implement specific measures to protect the privacy of children, including obtaining parental consent where required by law.`:"We implement specific measures to protect the privacy of children, including obtaining parental consent where required by law."}`,required:false,included:true,order:y++}),t.processesSpecialCategories&&d.push({id:"special-categories",title:"Special Categories of Personal Data",content:`We may process special categories of personal data, which includes information about your race, ethnic origin, political opinions, religious or philosophical beliefs, trade union membership, genetic data, biometric data, health data, sex life, or sexual orientation.
159
+
160
+ ${t.specialCategoriesDetails}
161
+
162
+ ${t.includeNDPRCompliance?`In accordance with ${t.includeLegalReferences?"Section 2.2 of the NDPR and Section 28 of the DPA":"the NDPR and DPA"}, we only process special categories of personal data when one of the specific legal bases for such processing is met, such as explicit consent or when processing is necessary for specific purposes outlined in the regulations.`:"We only process special categories of personal data when one of the specific legal bases for such processing is met, such as explicit consent."}`,required:false,included:true,order:y++}),t.securityMeasures.length>0){let C=`We have implemented appropriate security measures to prevent your personal data from being accidentally lost, used, or accessed in an unauthorized way, altered, or disclosed. These measures include:
163
+
164
+ ${t.securityMeasures.map(I=>`- ${I}`).join(`
165
+ `)}
166
+
167
+ ${t.includeNDPRCompliance?`In accordance with ${t.includeLegalReferences?"Section 2.1(1)(d) of the NDPR and Section 31 of the DPA":"the NDPR and DPA"}, we implement appropriate technical and organizational measures to ensure a level of security appropriate to the risk.`:"We regularly review and update our security measures to ensure the ongoing confidentiality, integrity, and availability of your personal data."}`;t.dataBreachProcedures&&(C+=`
168
+
169
+ Data Breach Procedures: ${t.dataBreachProcedures}`),d.push({id:"security-measures",title:"Data Security",content:C,required:true,included:true,order:y++});}let j=`${t.includeNDPRCompliance?`In accordance with ${t.includeLegalReferences?"Section 3.1 of the NDPR and Section 36 of the DPA":"the NDPR and DPA"}, you have the following rights in relation to your personal data:`:"You have the following rights in relation to your personal data:"}
170
+
171
+ - **Right to Access**: You have the right to request a copy of the personal data we hold about you.
172
+ - **Right to Rectification**: You have the right to request correction of any inaccurate personal data we hold about you.
173
+ - **Right to Erasure (Right to be Forgotten)**: You have the right to request erasure of your personal data in certain circumstances.
174
+ - **Right to Restriction of Processing**: You have the right to request restriction of processing of your personal data in certain circumstances.
175
+ - **Right to Data Portability**: You have the right to request the transfer of your personal data to you or to a third party in a structured, commonly used, machine-readable format.
176
+ - **Right to Object**: You have the right to object to processing of your personal data in certain circumstances.
177
+ - **Right to Withdraw Consent**: Where we rely on your consent to process your personal data, you have the right to withdraw your consent at any time.
178
+
179
+ To exercise any of these rights, please contact us at ${t.organizationContact}.${t.includeNDPRCompliance?` We will respond to your request within ${t.includeLegalReferences?"30 days as required by Section 3.1(7) of the NDPR":"the timeframe specified by the regulations"}.`:""}`;d.push({id:"data-subject-rights",title:"Your Rights",content:j,required:true,included:true,order:y++}),d.push({id:"policy-updates",title:"Changes to This Privacy Policy",content:`We may update this Privacy Policy from time to time. The current version of the Privacy Policy is effective as of ${t.policyEffectiveDate} (Version ${t.policyVersion}).${t.previousPolicyUrl?` Previous versions of this Policy can be found at ${t.previousPolicyUrl}.`:""}
180
+
181
+ ${t.policyUpdateProcedure?`When we make changes to this Privacy Policy: ${t.policyUpdateProcedure}`:"We will notify you of any material changes to this Privacy Policy by posting the updated Policy on our website and, where appropriate, by sending you a notification."}`,required:true,included:true,order:y++}),t.regulatoryCompliance.length>0&&d.push({id:"regulatory-compliance",title:"Regulatory Compliance",content:`In addition to the ${t.includeNDPRCompliance?"NDPR and DPA":"applicable data protection laws"}, we comply with the following regulations and standards:
182
+
183
+ ${t.regulatoryCompliance.map(C=>`- ${C}`).join(`
184
+ `)}`,required:false,included:true,order:y++}),t.customSections.forEach((C,I)=>{d.push({id:`custom-${I}`,title:C.title,content:C.content,required:false,included:true,order:y++});}),t.hasDPO&&t.dpoContact&&d.push({id:"dpo",title:"Data Protection Officer",content:`We have appointed a Data Protection Officer (DPO) who is responsible for overseeing questions in relation to this Privacy Policy. You can contact our DPO at ${t.dpoContact}.${t.includeNDPRCompliance?` This appointment is in accordance with ${t.includeLegalReferences?"Section 2.5 of the NDPR and Section 30 of the DPA":"the requirements of the NDPR and DPA"}.`:""}`,required:false,included:true,order:y++}),t.supervisoryAuthorityContact&&d.push({id:"supervisory-authority",title:"Supervisory Authority",content:`${t.includeNDPRCompliance?`In accordance with ${t.includeLegalReferences?"Section 3.1(8) of the NDPR and Section 36(5) of the DPA":"the NDPR and DPA"}, you have the right to lodge a complaint with the Nigeria Data Protection Commission (NDPC) if you are not satisfied with our response to your concerns. You can contact the NDPC at ${t.supervisoryAuthorityContact}.`:`You have the right to lodge a complaint with the relevant data protection authority if you are not satisfied with our response to your concerns. You can contact them at ${t.supervisoryAuthorityContact}.`}`,required:false,included:true,order:y++}),d.push({id:"contact",title:"Contact Us",content:`If you have any questions about this Privacy Policy or our privacy practices, please contact us at:
185
+
186
+ ${t.organizationName}
187
+ ${t.organizationAddress?`${t.organizationAddress}
188
+ `:""}Email: ${t.organizationContact}
189
+ ${t.organizationWebsite?`Website: ${t.organizationWebsite}`:""}`,required:true,included:true,order:y++}),e({organizationName:t.organizationName,organizationContact:t.organizationContact,sections:d});},N=d=>{switch(d){case "E-commerce and retail":return "For example, we collect your name, shipping address, and payment information when you place an order on our website.";case "Financial services and fintech":return "For example, we collect your financial information, transaction history, and credit information to provide our financial services.";case "Healthcare and medical":return "For example, we collect your medical history, treatment information, and health insurance details to provide healthcare services.";case "Education and e-learning":return "For example, we collect your educational background, course progress, and assessment results to provide educational services.";default:return "For example, we collect information necessary to provide our services and ensure a personalized experience."}},W=d=>{switch(d){case "E-commerce and retail":return "For example, we use your shipping address to deliver products you order and your payment information to process transactions.";case "Financial services and fintech":return "For example, we use your financial information to process transactions and your credit information for credit assessments.";case "Healthcare and medical":return "For example, we use your medical history to provide appropriate healthcare services and treatment recommendations.";case "Education and e-learning":return "For example, we use your course progress data to personalize your learning experience and provide appropriate educational content.";default:return "For example, we use your information to provide our services, improve your experience, and ensure compliance with applicable laws."}},A=["Organization Info","Data Collection","Data Sharing","Finalize"];return p__default.createElement("div",{className:`bg-white dark:bg-gray-900 shadow-lg rounded-xl p-8 max-w-4xl mx-auto ${r}`},p__default.createElement("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-8 text-center"},"Privacy Policy Generator"),p__default.createElement(lt,{currentStep:o,totalSteps:4,stepLabels:A}),o===1&&p__default.createElement(ot,{formData:t,errors:i,onChange:m}),o===2&&p__default.createElement(at,{formData:t,errors:i,onChange:m,onToggleItem:k,defaultDataPurposes:Mt,defaultSecurityMeasures:jt,dataSubjectCategories:Bt}),o===3&&p__default.createElement(nt,{formData:t,errors:i,onChange:m,onToggleItem:k,onAddThirdParty:w,onRemoveThirdParty:B,defaultCookieTypes:Wt,commonTransferCountries:Ot,trackingTechnologies:Lt,transferSafeguards:Ht}),o===4&&p__default.createElement("div",{className:"space-y-8"},p__default.createElement(it,{formData:t,onAddCustomSection:D,onRemoveCustomSection:T}),p__default.createElement(st,{formData:t,previewRef:s})),p__default.createElement("div",{className:"mt-10 flex justify-between items-center"},o>1?p__default.createElement("button",{type:"button",onClick:de,className:"inline-flex items-center px-5 py-2.5 border border-gray-300 dark:border-gray-600 shadow-sm text-sm font-medium rounded-lg text-gray-700 dark:text-gray-200 bg-white dark:bg-gray-800 hover:bg-gray-50 dark:hover:bg-gray-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition-colors duration-200 ease-in-out","aria-label":"Go back to previous step"},p__default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},p__default.createElement("path",{fillRule:"evenodd",d:"M12.707 5.293a1 1 0 010 1.414L9.414 10l3.293 3.293a1 1 0 01-1.414 1.414l-4-4a1 1 0 010-1.414l4-4a1 1 0 011.414 0z",clipRule:"evenodd"})),"Back"):p__default.createElement("div",null),o<4?p__default.createElement("button",{type:"button",onClick:$,className:"inline-flex items-center px-5 py-2.5 border border-transparent shadow-sm text-sm font-medium rounded-lg text-white bg-indigo-600 hover:bg-indigo-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-indigo-500 transition-colors duration-200 ease-in-out","aria-label":"Proceed to next step"},"Next",p__default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 ml-2",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},p__default.createElement("path",{fillRule:"evenodd",d:"M7.293 14.707a1 1 0 010-1.414L10.586 10 7.293 6.707a1 1 0 011.414-1.414l4 4a1 1 0 010 1.414l-4 4a1 1 0 01-1.414 0z",clipRule:"evenodd"}))):p__default.createElement("button",{type:"button",onClick:g,className:"inline-flex items-center px-5 py-2.5 border border-transparent shadow-sm text-sm font-medium rounded-lg text-white bg-gradient-to-r from-green-500 to-emerald-600 hover:from-green-600 hover:to-emerald-700 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-green-500 transition-all duration-200 ease-in-out","aria-label":"Generate privacy policy"},p__default.createElement("svg",{xmlns:"http://www.w3.org/2000/svg",className:"h-5 w-5 mr-2",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true"},p__default.createElement("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"})),"Generate Policy")))}var Jn={set:(e,r,o)=>{if(typeof window=="undefined")return;let a=new Date;a.setTime(a.getTime()+o*24*60*60*1e3);let t=`expires=${a.toUTCString()}`;document.cookie=`${e}=${r};${t};path=/`;},get:e=>{if(typeof window=="undefined")return null;let r=`${e}=`,o=document.cookie.split(";");for(let a=0;a<o.length;a++){let t=o[a];for(;t.charAt(0)===" ";)t=t.substring(1,t.length);if(t.indexOf(r)===0)return t.substring(r.length,t.length)}return null},delete:e=>{typeof window!="undefined"&&(document.cookie=`${e}=;expires=Thu, 01 Jan 1970 00:00:00 UTC;path=/;`);}},wr={save:(e,r)=>{typeof window!="undefined"&&localStorage.setItem(e,JSON.stringify(r));},load:e=>{if(typeof window=="undefined")return null;let r=localStorage.getItem(e);return r?JSON.parse(r):null},remove:e=>{typeof window!="undefined"&&localStorage.removeItem(e);}},Kn=wr;
190
+ export{Te as BreachNotificationManager,Te as BreachReportForm,Te as BreachRiskAssessment,Ne as ConsentBanner,Ue as ConsentContext,Ke as ConsentManager,Ve as ConsentProvider,je as ConsentSettings,Kn as ConsentStorage,At as DPIAQuestionnaire,Oe as DSRDashboard,Oe as DSRRequestForm,Oe as DSRTracker,qe as PolicyExporter,qe as PolicyGenerator,qe as PolicyPreview,Te as RegulatoryReportGenerator,xt as UnstyledConsentBanner,kt as UnstyledConsentSettings,Pt as UnstyledConsentToggle,tt as consentService,wr as consentStorage,Jn as cookieUtils,Xt as createConsentContext,K as useConsent,lr as useConsentActions,cr as useConsentManager,sr as useConsentState};//# sourceMappingURL=index.mjs.map
2
191
  //# sourceMappingURL=index.mjs.map