@tantainnovative/ndpr-toolkit 3.10.4 → 3.10.6

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.
@@ -0,0 +1 @@
1
+ import {a}from'./chunk-SFGW37LE.mjs';import {b,a as a$1}from'./chunk-ZJYULEER.mjs';import {useState,useRef,useEffect,useMemo}from'react';import {jsxs,jsx}from'react/jsx-runtime';var G=({options:g,settings:d,onSave:S,title:l="Manage Your Privacy Settings",description:R="Update your consent preferences at any time. Required cookies cannot be disabled as they are necessary for the website to function. Consent management is provided in accordance with NDPA Sections 25-26.",saveButtonText:M="Save Preferences",resetButtonText:w="Reset to Defaults",version:_="1.0",className:f="",buttonClassName:v="",primaryButtonClassName:T="",secondaryButtonClassName:$="",classNames:n,unstyled:e,showSuccessMessage:k=true,successMessage:D="Your preferences have been saved.",successMessageDuration:P=3e3})=>{let[u,c]=useState({}),[q,b$1]=useState(false),p=useRef(null);useEffect(()=>()=>{p.current&&clearTimeout(p.current);},[]);let x=useMemo(()=>g.map(t=>`${t.id}:${t.defaultValue?"1":"0"}`).join("|"),[g]);useEffect(()=>{if(d&&d.consents)c(d.consents);else {let t={};g.forEach(o=>{t[o.id]=o.defaultValue||false;}),c(t);}},[x,d]);let y=(t,o)=>{c(s=>b(a$1({},s),{[t]:o}));},E=()=>{let t={consents:u,timestamp:Date.now(),version:_,method:"manager",hasInteracted:true};S(t),k&&(b$1(true),p.current&&clearTimeout(p.current),p.current=setTimeout(()=>{b$1(false);},P));},I=()=>{let t={};g.forEach(o=>{t[o.id]=o.defaultValue||false;}),c(t);},L=`ndpr-consent-manager__button ndpr-consent-manager__button--primary ${v} ${T}`.trim(),V=`ndpr-consent-manager__button ndpr-consent-manager__button--secondary ${v} ${$}`.trim(),F=(n==null?void 0:n.primaryButton)||(n==null?void 0:n.saveButton)||L,O=(n==null?void 0:n.secondaryButton)||(n==null?void 0:n.resetButton)||V,Y=`ndpr-consent-manager${f?` ${f}`:""}`;return jsxs("div",{"data-ndpr-component":"consent-manager",className:a(Y,n==null?void 0:n.root,e),children:[jsx("h2",{className:a("ndpr-consent-manager__title",n==null?void 0:n.title,e),children:l}),jsx("p",{className:a("ndpr-consent-manager__description",n==null?void 0:n.description,e),children:R}),jsx("div",{className:a("ndpr-consent-manager__options-list",n==null?void 0:n.optionsList,e),children:g.map(t=>{let o=`consent-manager-${t.id}`;return jsxs("div",{className:a("ndpr-consent-manager__option",n==null?void 0:n.optionItem,e),children:[jsxs("div",{className:e?"":"ndpr-consent-manager__option-info",children:[jsx("h3",{className:e?"":"ndpr-consent-manager__option-label",children:t.label}),jsx("p",{className:e?"":"ndpr-consent-manager__option-description",children:t.description})]}),jsxs("label",{htmlFor:o,className:e?"":"ndpr-consent-manager__toggle-wrapper",children:[jsx("input",{id:o,type:"checkbox",className:e?"":"ndpr-consent-manager__toggle-input",checked:u[t.id]||false,onChange:s=>y(t.id,s.target.checked),disabled:t.required}),jsx("span",{"aria-hidden":"true",className:a("ndpr-consent-manager__toggle",n==null?void 0:n.toggle,e)}),jsxs("span",{className:e?"":"ndpr-consent-manager__toggle-status",children:[u[t.id]?"Enabled":"Disabled",t.required&&jsx("span",{className:e?"":"ndpr-consent-manager__required-marker",children:"(Required)"})]})]})]},t.id)})}),q&&jsx("div",{className:e?"":"ndpr-consent-manager__success","aria-live":"polite",role:"status",children:D}),jsxs("div",{className:e?"":"ndpr-consent-manager__buttons",children:[jsx("button",{onClick:E,className:a(F,n==null?void 0:n.saveButton,e),children:M}),jsx("button",{onClick:I,className:a(O,n==null?void 0:n.resetButton,e),children:w})]}),jsxs("div",{className:e?"":"ndpr-consent-manager__meta",children:[jsxs("p",{children:["Last updated: ",d?new Date(d.timestamp).toLocaleString():"Never"]}),jsxs("p",{children:["Version: ",_]})]})]})};export{G as a};
@@ -1 +1 @@
1
- 'use strict';var chunk7ZZO7GVB_js=require('./chunk-7ZZO7GVB.js'),chunkB46SJB5V_js=require('./chunk-B46SJB5V.js'),chunkVWED6UTN_js=require('./chunk-VWED6UTN.js'),react=require('react');function F(n){if(!n)return chunkVWED6UTN_js.a("ndpr_consent");let{storageKey:o="ndpr_consent",storageType:i="localStorage"}=n;return i==="sessionStorage"?chunk7ZZO7GVB_js.a(o):i==="cookie"?chunk7ZZO7GVB_js.b(o,n.cookieOptions):chunkVWED6UTN_js.a(o)}function k(n,o,i,r,a,g,l){if(n){i(n);let{valid:s,errors:c}=chunkB46SJB5V_js.a(n);r(s),a(c),g(!(s&&n.version===o));}else g(true);l(false);}function z({options:n,adapter:o,storageOptions:i,version:r="1.0",onChange:a}){let g=o!=null?o:F(i),l=react.useRef(g);l.current=g;let[s,c]=react.useState(null),[y,d]=react.useState(false),[E,C]=react.useState(false),[w,S]=react.useState([]),[I,v]=react.useState(true);react.useEffect(()=>{let e=false;try{let t=l.current.load();t instanceof Promise?t.then(m=>{e||k(m,r,c,C,S,d,v);},()=>{e||(d(!0),v(!1));}):k(t,r,c,C,S,d,v);}catch(t){e||(d(true),v(false));}return ()=>{e=true;}},[r]);let h=react.useCallback(e=>{let{valid:t,errors:m}=chunkB46SJB5V_js.a(e);C(t),S(m),a==null||a(e),Promise.resolve(l.current.save(e)).catch(P=>{console.warn("[ndpr-toolkit] Failed to save consent:",P);});},[a]),f=react.useCallback(e=>{let t={consents:e,timestamp:Date.now(),version:r,method:"explicit",hasInteracted:true};c(t),h(t),d(false);},[r,h]),L=react.useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=true;}),f(e);},[n,f]),U=react.useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=t.required||false;}),f(e);},[n,f]),V=react.useCallback(e=>!!(s!=null&&s.consents[e]),[s]),j=react.useCallback(()=>{c(null),d(true),C(false),S([]),Promise.resolve(l.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove consent:",e);});},[]);return {settings:s,hasConsent:V,updateConsent:f,acceptAll:L,rejectAll:U,shouldShowBanner:y,isValid:E,validationErrors:w,resetConsent:j,isLoading:I}}exports.a=z;
1
+ 'use strict';var chunkC2KEXHRX_js=require('./chunk-C2KEXHRX.js'),chunkB46SJB5V_js=require('./chunk-B46SJB5V.js'),chunkVWED6UTN_js=require('./chunk-VWED6UTN.js'),react=require('react');function F(n){if(!n)return chunkVWED6UTN_js.a("ndpr_consent");let{storageKey:o="ndpr_consent",storageType:i="localStorage"}=n;return i==="sessionStorage"?chunkC2KEXHRX_js.a(o):i==="cookie"?chunkC2KEXHRX_js.b(o,n.cookieOptions):chunkVWED6UTN_js.a(o)}function k(n,o,i,r,a,g,l){if(n){i(n);let{valid:s,errors:c}=chunkB46SJB5V_js.a(n);r(s),a(c),g(!(s&&n.version===o));}else g(true);l(false);}function z({options:n,adapter:o,storageOptions:i,version:r="1.0",onChange:a}){let g=o!=null?o:F(i),l=react.useRef(g);l.current=g;let[s,c]=react.useState(null),[y,d]=react.useState(false),[E,C]=react.useState(false),[w,S]=react.useState([]),[I,v]=react.useState(true);react.useEffect(()=>{let e=false;try{let t=l.current.load();t instanceof Promise?t.then(m=>{e||k(m,r,c,C,S,d,v);},()=>{e||(d(!0),v(!1));}):k(t,r,c,C,S,d,v);}catch(t){e||(d(true),v(false));}return ()=>{e=true;}},[r]);let h=react.useCallback(e=>{let{valid:t,errors:m}=chunkB46SJB5V_js.a(e);C(t),S(m),a==null||a(e),Promise.resolve(l.current.save(e)).catch(P=>{console.warn("[ndpr-toolkit] Failed to save consent:",P);});},[a]),f=react.useCallback(e=>{let t={consents:e,timestamp:Date.now(),version:r,method:"explicit",hasInteracted:true};c(t),h(t),d(false);},[r,h]),L=react.useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=true;}),f(e);},[n,f]),U=react.useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=t.required||false;}),f(e);},[n,f]),V=react.useCallback(e=>!!(s!=null&&s.consents[e]),[s]),j=react.useCallback(()=>{c(null),d(true),C(false),S([]),Promise.resolve(l.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove consent:",e);});},[]);return {settings:s,hasConsent:V,updateConsent:f,acceptAll:L,rejectAll:U,shouldShowBanner:y,isValid:E,validationErrors:w,resetConsent:j,isLoading:I}}exports.a=z;
@@ -0,0 +1 @@
1
+ 'use strict';var chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js');function M(e){return e.response?e.response.status>=500:true}function $(e){return new Promise(s=>setTimeout(s,e))}function O(e){return e?typeof e=="function"?e():e:{}}function q(e,s={}){var w,k,g;let{headers:a,credentials:d="same-origin",loadMethod:u="GET",saveMethod:c="POST",unwrap:A,retry:p,onError:h,onSuccess:l,fetchInit:x}=s,T=(w=p==null?void 0:p.attempts)!=null?w:0,C=(k=p==null?void 0:p.baseDelayMs)!=null?k:250,E=(g=p==null?void 0:p.shouldRetry)!=null?g:M,y=h!=null?h:(t=>{if(t.method==="load")return;let o=t.method==="save"?"save to":"delete from";if(t.response){console.warn(`[ndpr-toolkit] Failed to ${o} ${t.endpoint}: ${t.response.status}`);try{let r=typeof t.response.clone=="function"?t.response.clone():null;r&&typeof r.text=="function"&&r.text().then(i=>{let n=i.length>256?`${i.slice(0,256)}\u2026`:i;n.trim()&&console.warn(`[ndpr-toolkit] ${o} ${t.endpoint} response body: ${n}`);}).catch(()=>{});}catch(r){}}else console.warn(`[ndpr-toolkit] Failed to ${o} ${t.endpoint}`);});function v(t,o,r){return chunkRFPLZDIO_js.d(this,null,function*(){for(let i=0;i<=T;i++){let n,S;try{n=yield fetch(e,chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a(chunkRFPLZDIO_js.a({},x),o),{headers:chunkRFPLZDIO_js.a(chunkRFPLZDIO_js.a({},O(a)),o.headers),credentials:d}));}catch(b){S=b;}if(n&&n.ok)return {ok:true,response:n};let R={method:t,endpoint:e,error:S,response:n,status:n==null?void 0:n.status,payload:r,attempt:i};if(i===T||!E(R))return y(R),{ok:false};yield $(C*Math.pow(2,i));}return {ok:false}})}return {load(){return chunkRFPLZDIO_js.d(this,null,function*(){let t=yield v("load",{method:u,headers:{}});if(!t.ok)return null;try{let o=yield t.response.json(),r=A?A(o):o;return l&&l({method:"load",endpoint:e,response:t.response,data:r!=null?r:void 0}),r}catch(o){return y({method:"load",endpoint:e,error:o,response:t.response,status:t.response.status,attempt:T}),null}})},save(t){return chunkRFPLZDIO_js.d(this,null,function*(){let o=yield v("save",{method:c,headers:{"Content-Type":"application/json"},body:JSON.stringify(t)},t);o.ok&&l&&l({method:"save",endpoint:e,response:o.response,payload:t});})},remove(){return chunkRFPLZDIO_js.d(this,null,function*(){let t=yield v("remove",{method:"DELETE",headers:{}});t.ok&&l&&l({method:"remove",endpoint:e,response:t.response});})}}}function F(e){let s=e!=null?e:null;return {load(){return s},save(a){s=a;},remove(){s=null;}}}function H(e,...s){return {load(){return e.load()},save(a){let d=e.save(a),u=()=>{for(let c of s)try{c.save(a);}catch(A){console.warn("[ndpr-toolkit] Secondary adapter save failed:",A);}};if(d instanceof Promise)return d.then(()=>u());u();},remove(){let a=e.remove(),d=()=>{for(let u of s)try{u.remove();}catch(c){console.warn("[ndpr-toolkit] Secondary adapter remove failed:",c);}};if(a instanceof Promise)return a.then(()=>d());d();}}}exports.a=q;exports.b=F;exports.c=H;
@@ -1 +1 @@
1
- import {a as a$2,b}from'./chunk-UASG46LP.mjs';import {a}from'./chunk-PJNKQPQP.mjs';import {a as a$1}from'./chunk-DBZSN4WP.mjs';import {useRef,useState,useEffect,useCallback}from'react';function F(n){if(!n)return a$1("ndpr_consent");let{storageKey:o="ndpr_consent",storageType:i="localStorage"}=n;return i==="sessionStorage"?a$2(o):i==="cookie"?b(o,n.cookieOptions):a$1(o)}function k(n,o,i,r,a$1,g,l){if(n){i(n);let{valid:s,errors:c}=a(n);r(s),a$1(c),g(!(s&&n.version===o));}else g(true);l(false);}function z({options:n,adapter:o,storageOptions:i,version:r="1.0",onChange:a$1}){let g=o!=null?o:F(i),l=useRef(g);l.current=g;let[s,c]=useState(null),[y,d]=useState(false),[E,C]=useState(false),[w,S]=useState([]),[I,v]=useState(true);useEffect(()=>{let e=false;try{let t=l.current.load();t instanceof Promise?t.then(m=>{e||k(m,r,c,C,S,d,v);},()=>{e||(d(!0),v(!1));}):k(t,r,c,C,S,d,v);}catch(t){e||(d(true),v(false));}return ()=>{e=true;}},[r]);let h=useCallback(e=>{let{valid:t,errors:m}=a(e);C(t),S(m),a$1==null||a$1(e),Promise.resolve(l.current.save(e)).catch(P=>{console.warn("[ndpr-toolkit] Failed to save consent:",P);});},[a$1]),f=useCallback(e=>{let t={consents:e,timestamp:Date.now(),version:r,method:"explicit",hasInteracted:true};c(t),h(t),d(false);},[r,h]),L=useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=true;}),f(e);},[n,f]),U=useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=t.required||false;}),f(e);},[n,f]),V=useCallback(e=>!!(s!=null&&s.consents[e]),[s]),j=useCallback(()=>{c(null),d(true),C(false),S([]),Promise.resolve(l.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove consent:",e);});},[]);return {settings:s,hasConsent:V,updateConsent:f,acceptAll:L,rejectAll:U,shouldShowBanner:y,isValid:E,validationErrors:w,resetConsent:j,isLoading:I}}export{z as a};
1
+ import {a as a$2,b}from'./chunk-XC3DLYEG.mjs';import {a}from'./chunk-PJNKQPQP.mjs';import {a as a$1}from'./chunk-DBZSN4WP.mjs';import {useRef,useState,useEffect,useCallback}from'react';function F(n){if(!n)return a$1("ndpr_consent");let{storageKey:o="ndpr_consent",storageType:i="localStorage"}=n;return i==="sessionStorage"?a$2(o):i==="cookie"?b(o,n.cookieOptions):a$1(o)}function k(n,o,i,r,a$1,g,l){if(n){i(n);let{valid:s,errors:c}=a(n);r(s),a$1(c),g(!(s&&n.version===o));}else g(true);l(false);}function z({options:n,adapter:o,storageOptions:i,version:r="1.0",onChange:a$1}){let g=o!=null?o:F(i),l=useRef(g);l.current=g;let[s,c]=useState(null),[y,d]=useState(false),[E,C]=useState(false),[w,S]=useState([]),[I,v]=useState(true);useEffect(()=>{let e=false;try{let t=l.current.load();t instanceof Promise?t.then(m=>{e||k(m,r,c,C,S,d,v);},()=>{e||(d(!0),v(!1));}):k(t,r,c,C,S,d,v);}catch(t){e||(d(true),v(false));}return ()=>{e=true;}},[r]);let h=useCallback(e=>{let{valid:t,errors:m}=a(e);C(t),S(m),a$1==null||a$1(e),Promise.resolve(l.current.save(e)).catch(P=>{console.warn("[ndpr-toolkit] Failed to save consent:",P);});},[a$1]),f=useCallback(e=>{let t={consents:e,timestamp:Date.now(),version:r,method:"explicit",hasInteracted:true};c(t),h(t),d(false);},[r,h]),L=useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=true;}),f(e);},[n,f]),U=useCallback(()=>{let e={};n.forEach(t=>{e[t.id]=t.required||false;}),f(e);},[n,f]),V=useCallback(e=>!!(s!=null&&s.consents[e]),[s]),j=useCallback(()=>{c(null),d(true),C(false),S([]),Promise.resolve(l.current.remove()).catch(e=>{console.warn("[ndpr-toolkit] Failed to remove consent:",e);});},[]);return {settings:s,hasConsent:V,updateConsent:f,acceptAll:L,rejectAll:U,shouldShowBanner:y,isValid:E,validationErrors:w,resetConsent:j,isLoading:I}}export{z as a};
@@ -1 +1 @@
1
- function p(t){return {load(){if(typeof window=="undefined")return null;try{let e=sessionStorage.getItem(t);return e?JSON.parse(e):null}catch(e){return null}},save(e){if(typeof window!="undefined")try{sessionStorage.setItem(t,JSON.stringify(e));}catch(i){}},remove(){if(typeof window!="undefined")try{sessionStorage.removeItem(t);}catch(e){}}}}function m(t,e={}){let{domain:i,path:s="/",expires:d=365,secure:u=true,sameSite:c="Lax"}=e;return {load(){if(typeof document=="undefined")return null;try{let n=encodeURIComponent(t),a=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(`${n}=`));if(!a)return null;let r=a.indexOf("=");return JSON.parse(decodeURIComponent(a.slice(r+1)))}catch(n){return null}},save(n){if(typeof document=="undefined")return;let a=u||c==="None",r=`${encodeURIComponent(t)}=${encodeURIComponent(JSON.stringify(n))}; path=${s}; samesite=${c}`;if(d>0){let o=new Date;o.setDate(o.getDate()+d),r+=`; expires=${o.toUTCString()}`;}i&&(r+=`; domain=${i}`),a&&(r+="; secure"),document.cookie=r;},remove(){if(typeof document=="undefined")return;let n=`${encodeURIComponent(t)}=; path=${s}; expires=Thu, 01 Jan 1970 00:00:00 GMT`;i&&(n+=`; domain=${i}`),document.cookie=n;}}}export{p as a,m as b};
1
+ function p(t){return {load(){if(typeof window=="undefined")return null;try{let e=sessionStorage.getItem(t);return e?JSON.parse(e):null}catch(e){return null}},save(e){if(typeof window!="undefined")try{sessionStorage.setItem(t,JSON.stringify(e));}catch(i){}},remove(){if(typeof window!="undefined")try{sessionStorage.removeItem(t);}catch(e){}}}}function m(t,e={}){let{domain:i,path:s="/",expires:d=180,secure:u=true,sameSite:c="Lax"}=e;return {load(){if(typeof document=="undefined")return null;try{let n=encodeURIComponent(t),a=document.cookie.split(";").map(o=>o.trim()).find(o=>o.startsWith(`${n}=`));if(!a)return null;let r=a.indexOf("=");return JSON.parse(decodeURIComponent(a.slice(r+1)))}catch(n){return null}},save(n){if(typeof document=="undefined")return;let a=u||c==="None",r=`${encodeURIComponent(t)}=${encodeURIComponent(JSON.stringify(n))}; path=${s}; samesite=${c}`;if(d>0){let o=new Date;o.setDate(o.getDate()+d),r+=`; expires=${o.toUTCString()}`;}i&&(r+=`; domain=${i}`),a&&(r+="; secure"),document.cookie=r;},remove(){if(typeof document=="undefined")return;let n=`${encodeURIComponent(t)}=; path=${s}; expires=Thu, 01 Jan 1970 00:00:00 GMT`;i&&(n+=`; domain=${i}`),document.cookie=n;}}}export{p as a,m as b};
@@ -1,11 +1,11 @@
1
- import {c,d,b as b$1}from'./chunk-NBQQ2GN3.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {d as d$1,b,a as a$1}from'./chunk-ZJYULEER.mjs';import {useId,useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var ye=({sections:_=c,variables:U=d,onGenerate:L,title:M="NDPA Privacy Policy Generator",description:V="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:K="",buttonClassName:T="",generateButtonText:Q="Generate Policy",showPreview:B=true,allowEditing:N=true,classNames:r,unstyled:x=false})=>{let P=useId(),[A,n]=useState(_),[i,s]=useState(U),[m,$]=useState("sections"),[S,X]=useState(""),[F,R]=useState(""),[J,Z]=useState(false),[v,I]=useState({});useEffect(()=>{n(_);},[_]),useEffect(()=>{s(U);},[U]);let G=l=>{n(c=>c.map(a=>a.id===l?b(a$1({},a),{included:!a.included}):a));},W=(l,c)=>{s(a=>a.map(b$1=>b$1.id===l?b(a$1({},b$1),{value:c}):b$1)),v[l]&&I(a=>{let b=a$1({},a);return delete b[l],b});},j=()=>{let l={},c=true;return i.forEach(a=>{a.required&&!a.value&&(l[a.id]=`${a.name} is required`,c=false);}),I(l),c},ee=()=>{if(!j()){$("variables");return}let l=A.filter(b=>b.included),c=Object.fromEntries(i.map(b=>[b.name,b.value])),a="";l.forEach(b=>{a+=`## ${b.title}
1
+ import {c,d,b as b$1}from'./chunk-NBQQ2GN3.mjs';import {a}from'./chunk-SFGW37LE.mjs';import {d as d$1,b,a as a$1}from'./chunk-ZJYULEER.mjs';import {useId,useState,useEffect}from'react';import {jsxs,jsx}from'react/jsx-runtime';var ye=({sections:E=c,variables:U=d,onGenerate:L,title:M="NDPA Privacy Policy Generator",description:V="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:K="",buttonClassName:T="",generateButtonText:Q="Generate Policy",showPreview:B=true,allowEditing:N=true,classNames:r,unstyled:x=false})=>{let P=useId(),[F,n]=useState(E),[o,s]=useState(U),[m,$]=useState("sections"),[S,X]=useState(""),[A,R]=useState(""),[J,Z]=useState(false),[h,I]=useState({});useEffect(()=>{n(E);},[E]),useEffect(()=>{s(U);},[U]);let G=l=>{n(c=>c.map(a=>a.id===l?b(a$1({},a),{included:!a.included}):a));},W=(l,c)=>{s(a=>a.map(f=>f.id===l?b(a$1({},f),{value:c}):f)),h[l]&&I(a=>{let f=a$1({},a);return delete f[l],f});},j=()=>{let l={},c=true;return o.forEach(a=>{a.required&&!a.value&&(l[a.id]=`${a.name} is required`,c=false);}),I(l),c},ee=()=>{if(!j()){$("variables");return}let l=F.filter(f=>f.included),c=Object.fromEntries(o.map(f=>[f.name,f.value])),a="";l.forEach(f=>{a+=`## ${f.title}
2
2
 
3
- `,a+=b$1(b.template,c),a+=`
3
+ `,a+=b$1(f.template,c),a+=`
4
4
 
5
- `;}),X(a),R(a),Z(true),$("preview");},h=()=>{L({sections:A,variables:i,content:N?F:S});},g=()=>jsxs("div",{"data-ndpr-component":"policy-generator",className:a("ndpr-form-section",r==null?void 0:r.sectionList,x),role:"group","aria-labelledby":`${P}-sections-heading`,children:[jsx("h3",{id:`${P}-sections-heading`,className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),A.map(l=>{let c=`${P}-section-${l.id}`,a$1=l.description?`${P}-section-desc-${l.id}`:void 0;return jsx("div",{className:a("border border-gray-200 dark:border-gray-700 rounded-md p-4",r==null?void 0:r.sectionItem,x),children:jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:c,type:"checkbox",checked:l.included,onChange:()=>G(l.id),disabled:l.required,"aria-describedby":a$1,className:a("w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",r==null?void 0:r.input,x)})}),jsxs("div",{className:"ml-3 text-sm",children:[jsxs("label",{htmlFor:c,className:"font-medium ndpr-text-foreground",children:[l.title," ",l.required&&jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),l.required&&jsx("span",{className:"sr-only",children:" (required)"})]}),l.description&&jsx("p",{id:a$1,className:"ndpr-text-muted mt-1",children:l.description})]})]})},l.id)}),jsx("div",{className:"mt-6",children:jsx("button",{onClick:()=>$("variables"),className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:"Next: Fill Variables"})})]}),w=()=>{let l={};return i.forEach(c=>{let a=c.id.split(".")[0];l[a]||(l[a]=[]),l[a].push(c);}),jsxs("div",{className:a("",r==null?void 0:r.form,x),children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsx("div",{className:"ndpr-form-section",children:Object.entries(l).map(([c,a$1])=>{let b=A.find(e=>e.id===c);return b&&!b.included?null:jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsx("h4",{className:"font-medium text-lg mb-3",children:b?b.title:"General Information"}),jsx("div",{className:"ndpr-form-section",children:a$1.map(e=>{let y=`${P}-var-${e.id}`,u=e.description?`${P}-var-desc-${e.id}`:void 0,z=v[e.id]?`${P}-var-err-${e.id}`:void 0,O=[u,z].filter(Boolean).join(" ")||void 0;return jsxs("div",{children:[jsxs("label",{htmlFor:y,className:"ndpr-form-field__label",children:[e.name," ",e.required&&jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),e.description&&jsx("p",{id:u,className:"text-xs ndpr-text-muted mb-2",children:e.description}),e.inputType==="textarea"?jsx("textarea",{id:y,value:e.value,onChange:E=>W(e.id,E.target.value),rows:4,className:a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0}):e.inputType==="select"&&e.options?jsxs("select",{id:y,value:e.value,onChange:E=>W(e.id,E.target.value),className:a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0,children:[jsx("option",{value:"",children:"Select an option"}),e.options.map(E=>jsx("option",{value:E,children:E},E))]}):jsx("input",{id:y,type:e.inputType,value:e.value,onChange:E=>W(e.id,E.target.value),className:a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0}),v[e.id]&&jsx("p",{id:z,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:v[e.id]})]},e.id)})})]},c)})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>$("sections"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Sections"}),jsx("button",{onClick:ee,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:Q})]})]})},C=()=>{let l=`${P}-policy-content`;return jsxs("div",{children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),N?jsxs("div",{className:"ndpr-form-field",children:[jsx("label",{htmlFor:l,className:"ndpr-form-field__label",children:"Edit Policy Content"}),jsx("textarea",{id:l,value:F,onChange:c=>R(c.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono"})]}):jsx("div",{className:"ndpr-panel","aria-live":"polite",children:jsx("div",{className:"prose dark:prose-invert max-w-none",children:S.split(`
6
- `).map((c,a)=>c.startsWith("## ")?jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},a):c.startsWith("### ")?jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},a):c===""?jsx("br",{},a):jsx("p",{className:"mb-2",children:c},a))})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Variables"}),jsx("button",{onClick:h,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${T}`,children:"Save Policy"})]})]})},q=()=>{switch(m){case "sections":return g();case "variables":return w();case "preview":return C();default:return g()}};return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${K}`,r==null?void 0:r.root,x),children:[jsxs("div",{className:a("mb-6",r==null?void 0:r.header,x),children:[jsx("h2",{className:a("ndpr-section-heading",r==null?void 0:r.title,x),children:M}),jsx("p",{className:a("ndpr-card__subtitle",r==null?void 0:r.description,x),children:V})]}),jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxs("ol",{className:"flex items-center w-full",children:[jsxs("li",{className:`flex w-full items-center ${m==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="sections"?"step":void 0,children:"1"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsx("span",{className:"sr-only",children:m==="sections"?" (current step)":""})]}),jsxs("li",{className:`flex w-full items-center ${m==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="variables"?"step":void 0,children:"2"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsx("span",{className:"sr-only",children:m==="variables"?" (current step)":""})]}),jsxs("li",{className:`flex items-center ${m==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="preview"?"step":void 0,children:"3"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsx("span",{className:"sr-only",children:m==="preview"?" (current step)":""})]})]})}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",r==null?void 0:r.complianceNotice,x),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"ndpr-text-info text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),q()]})};var _e=({content:_,sections:U,variables:L,onExport:M,onEdit:V,title:K="Privacy Policy Preview",description:T="Preview your NDPA-compliant privacy policy before exporting.",className:Q="",buttonClassName:B="",showExportOptions:N=true,showEditButton:r=true,showTableOfContents:x=true,showMetadata:P=true,organizationName:A,lastUpdated:n,classNames:i,unstyled:s=false})=>{let m=useId(),[$,S]=useState("preview"),X=`${m}-tab-preview`,F=`${m}-tab-markdown`,R=`${m}-panel-preview`,J=`${m}-panel-markdown`,v=(()=>{let h=_.split(`
7
- `),g=[];return h.forEach(w=>{if(w.startsWith("## ")){let C=w.substring(3).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:2});}else if(w.startsWith("### ")){let C=w.substring(4).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:3});}}),g})(),I=h=>{if(M)M(h);else if(h==="markdown"){let g=document.createElement("a"),w=new Blob([_],{type:"text/markdown"});g.href=URL.createObjectURL(w),g.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(g),g.click(),document.body.removeChild(g);}},G=()=>!x||v.length===0?null:jsxs("nav",{"aria-label":"Table of contents",className:"ndpr-panel",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsx("ul",{className:"space-y-1",children:v.map((h,g)=>jsx("li",{style:{marginLeft:`${(h.level-2)*1.5}rem`},children:jsx("a",{href:`#${h.id}`,className:"ndpr-text-primary hover:underline",children:h.title})},g))})]}),W=()=>P?jsxs("div",{"data-ndpr-component":"policy-preview",className:"mb-6",children:[jsx("h1",{className:"ndpr-card__title",children:A?`${A} Privacy Policy`:"Privacy Policy"}),jsxs("p",{className:"ndpr-form-field__hint",children:["Last Updated: ",n?n.toLocaleDateString():"N/A"]})]}):null,j=()=>jsx("div",{className:a("prose dark:prose-invert max-w-none",i==null?void 0:i.sectionContent,s),children:_.split(`
8
- `).map((h,g)=>{if(h.startsWith("## ")){let w=h.substring(3).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsx("h3",{id:C,className:a("text-xl font-bold mt-6 mb-3",i==null?void 0:i.sectionTitle,s),children:w},g)}else if(h.startsWith("### ")){let w=h.substring(4).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsx("h4",{id:C,className:a("text-lg font-bold mt-4 mb-2",i==null?void 0:i.sectionTitle,s),children:w},g)}else return h===""?jsx("br",{},g):jsx("p",{className:"mb-2",children:h},g)})}),ee=()=>N?jsxs("div",{className:"mt-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>I("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as PDF"}),jsx("button",{onClick:()=>I("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as DOCX"}),jsx("button",{onClick:()=>I("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as HTML"}),jsx("button",{onClick:()=>I("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as Markdown"})]})]}):null;return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,i==null?void 0:i.root,s),children:[jsxs("div",{className:a("flex justify-between items-start mb-6",i==null?void 0:i.header,s),children:[jsxs("div",{children:[jsx("h2",{className:a("ndpr-section-heading",i==null?void 0:i.title,s),children:K}),jsx("p",{className:a("ndpr-card__subtitle",i==null?void 0:i.description,s),children:T})]}),r&&V&&jsx("button",{onClick:V,className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${B}`,children:"Edit Policy"})]}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",i==null?void 0:i.complianceNotice,s),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"ndpr-text-info text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxs("div",{role:"tablist","aria-label":"Policy view options",className:"flex flex-wrap -mb-px",children:[jsx("div",{className:"mr-2",children:jsx("button",{role:"tab",id:X,"aria-selected":$==="preview","aria-controls":R,onClick:()=>S("preview"),className:`inline-block p-4 ${$==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsx("div",{className:"mr-2",children:jsx("button",{role:"tab",id:F,"aria-selected":$==="markdown","aria-controls":J,onClick:()=>S("markdown"),className:`inline-block p-4 ${$==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsx("div",{className:a("bg-white dark:bg-gray-800 p-4 rounded-md",i==null?void 0:i.content,s),children:$==="preview"?jsxs("div",{role:"tabpanel",id:R,"aria-labelledby":X,"aria-live":"polite",children:[W(),G(),jsx("div",{className:a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",i==null?void 0:i.section,s),children:j()})]}):jsx("div",{role:"tabpanel",id:J,"aria-labelledby":F,children:jsx("pre",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md overflow-auto whitespace-pre-wrap font-mono text-sm text-gray-800 dark:text-gray-200",children:_})})}),ee()]})};var Ae=({content:_,title:U="Privacy Policy",organizationName:L,lastUpdated:M,onExportComplete:V,componentTitle:K="Export Privacy Policy",description:T="Export your NDPA-compliant privacy policy in various formats.",className:Q="",buttonClassName:B="",showExportHistory:N=true,includeComplianceNotice:r=true,includeLogo:x=false,logoUrl:P,customStyles:A,classNames:n,unstyled:i=false})=>{let s=useId(),[m,$]=useState([]),[S,X]=useState("pdf"),[F,R]=useState(false),[J,Z]=useState(null),[v,I]=useState(""),[G,W]=useState(""),[j,ee]=useState(""),[h,g]=useState(false),w=e=>{let y=new Date().toISOString().split("T")[0];return `${L?L.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${y}.${e.toLowerCase()}`},C=e=>v?v.endsWith(`.${e.toLowerCase()}`)?v:`${v}.${e.toLowerCase()}`:w(e),q=()=>{let e=L?`${L} ${U}`:U,y=M?M.toLocaleDateString():"N/A",u=`<!DOCTYPE html>
5
+ `;}),X(a),R(a),Z(true),$("preview");},y=()=>{L({sections:F,variables:o,content:N?A:S});},g=()=>jsxs("div",{"data-ndpr-component":"policy-generator",className:a("ndpr-form-section",r==null?void 0:r.sectionList,x),role:"group","aria-labelledby":`${P}-sections-heading`,children:[jsx("h3",{id:`${P}-sections-heading`,className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),F.map(l=>{let c=`${P}-section-${l.id}`,a$1=l.description?`${P}-section-desc-${l.id}`:void 0;return jsx("div",{className:a("border border-gray-200 dark:border-gray-700 rounded-md p-4",r==null?void 0:r.sectionItem,x),children:jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:c,type:"checkbox",checked:l.included,onChange:()=>G(l.id),disabled:l.required,"aria-describedby":a$1,className:a("w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",r==null?void 0:r.input,x)})}),jsxs("div",{className:"ml-3 text-sm",children:[jsxs("label",{htmlFor:c,className:"font-medium ndpr-text-foreground",children:[l.title," ",l.required&&jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),l.required&&jsx("span",{className:"sr-only",children:" (required)"})]}),l.description&&jsx("p",{id:a$1,className:"ndpr-text-muted mt-1",children:l.description})]})]})},l.id)}),jsx("div",{className:"mt-6",children:jsx("button",{onClick:()=>$("variables"),className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:"Next: Fill Variables"})})]}),w=()=>{let l={};return o.forEach(c=>{let a=c.id.split(".")[0];l[a]||(l[a]=[]),l[a].push(c);}),jsxs("div",{className:a("",r==null?void 0:r.form,x),children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsx("div",{className:"ndpr-form-section",children:Object.entries(l).map(([c,a$1])=>{let f=F.find(e=>e.id===c);return f&&!f.included?null:jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsx("h4",{className:"font-medium text-lg mb-3",children:f?f.title:"General Information"}),jsx("div",{className:"ndpr-form-section",children:a$1.map(e=>{let u=`${P}-var-${e.id}`,b=e.description?`${P}-var-desc-${e.id}`:void 0,z=h[e.id]?`${P}-var-err-${e.id}`:void 0,O=[b,z].filter(Boolean).join(" ")||void 0;return jsxs("div",{children:[jsxs("label",{htmlFor:u,className:"ndpr-form-field__label",children:[e.name," ",e.required&&jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),e.description&&jsx("p",{id:b,className:"text-xs ndpr-text-muted mb-2",children:e.description}),e.inputType==="textarea"?jsx("textarea",{id:u,value:e.value,onChange:_=>W(e.id,_.target.value),rows:4,className:a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0}):e.inputType==="select"&&e.options?jsxs("select",{id:u,value:e.value,onChange:_=>W(e.id,_.target.value),className:a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0,children:[jsx("option",{value:"",children:"Select an option"}),e.options.map(_=>jsx("option",{value:_,children:_},_))]}):jsx("input",{id:u,type:e.inputType,value:e.value,onChange:_=>W(e.id,_.target.value),className:a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0}),h[e.id]&&jsx("p",{id:z,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:h[e.id]})]},e.id)})})]},c)})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>$("sections"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Sections"}),jsx("button",{onClick:ee,className:a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:Q})]})]})},C=()=>{let l=`${P}-policy-content`;return jsxs("div",{children:[jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),N?jsxs("div",{className:"ndpr-form-field",children:[jsx("label",{htmlFor:l,className:"ndpr-form-field__label",children:"Edit Policy Content"}),jsx("textarea",{id:l,value:A,onChange:c=>R(c.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono"})]}):jsx("div",{className:"ndpr-panel","aria-live":"polite",children:jsx("div",{className:"prose dark:prose-invert max-w-none",children:S.split(`
6
+ `).map((c,a)=>c.startsWith("## ")?jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},a):c.startsWith("### ")?jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},a):c===""?jsx("br",{},a):jsx("p",{className:"mb-2",children:c},a))})}),jsxs("div",{className:"mt-6 flex space-x-4",children:[jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Variables"}),jsx("button",{onClick:y,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${T}`,children:"Save Policy"})]})]})},q=()=>{switch(m){case "sections":return g();case "variables":return w();case "preview":return C();default:return g()}};return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${K}`,r==null?void 0:r.root,x),children:[jsxs("div",{className:a("mb-6",r==null?void 0:r.header,x),children:[jsx("h2",{className:a("ndpr-section-heading",r==null?void 0:r.title,x),children:M}),jsx("p",{className:a("ndpr-card__subtitle",r==null?void 0:r.description,x),children:V})]}),jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxs("ol",{className:"flex items-center w-full",children:[jsxs("li",{className:`flex w-full items-center ${m==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="sections"?"step":void 0,children:"1"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsx("span",{className:"sr-only",children:m==="sections"?" (current step)":""})]}),jsxs("li",{className:`flex w-full items-center ${m==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="variables"?"step":void 0,children:"2"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsx("span",{className:"sr-only",children:m==="variables"?" (current step)":""})]}),jsxs("li",{className:`flex items-center ${m==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="preview"?"step":void 0,children:"3"}),jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsx("span",{className:"sr-only",children:m==="preview"?" (current step)":""})]})]})}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",r==null?void 0:r.complianceNotice,x),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"ndpr-text-info text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),q()]})};var Ee=({content:E,sections:U,variables:L,onExport:M,onEdit:V,title:K="Privacy Policy Preview",description:T="Preview your NDPA-compliant privacy policy before exporting.",className:Q="",buttonClassName:B="",showExportOptions:N=true,showEditButton:r=true,showTableOfContents:x=true,showMetadata:P=true,organizationName:F,lastUpdated:n,classNames:o,unstyled:s=false})=>{let m=useId(),[$,S]=useState("preview"),X=`${m}-tab-preview`,A=`${m}-tab-markdown`,R=`${m}-panel-preview`,J=`${m}-panel-markdown`,h=(()=>{let y=E.split(`
7
+ `),g=[];return y.forEach(w=>{if(w.startsWith("## ")){let C=w.substring(3).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:2});}else if(w.startsWith("### ")){let C=w.substring(4).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:3});}}),g})(),I=y=>{if(M)M(y);else if(y==="markdown"){let g=document.createElement("a"),w=new Blob([E],{type:"text/markdown"});g.href=URL.createObjectURL(w),g.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(g),g.click(),document.body.removeChild(g);}},G=()=>!x||h.length===0?null:jsxs("nav",{"aria-label":"Table of contents",className:"ndpr-panel",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsx("ul",{className:"space-y-1",children:h.map((y,g)=>jsx("li",{style:{marginLeft:`${(y.level-2)*1.5}rem`},children:jsx("a",{href:`#${y.id}`,className:"ndpr-text-primary hover:underline",children:y.title})},g))})]}),W=()=>P?jsxs("div",{"data-ndpr-component":"policy-preview",className:"mb-6",children:[jsx("h1",{className:"ndpr-card__title",children:F?`${F} Privacy Policy`:"Privacy Policy"}),jsxs("p",{className:"ndpr-form-field__hint",children:["Last Updated: ",n?n.toLocaleDateString():"N/A"]})]}):null,j=()=>jsx("div",{className:a("prose dark:prose-invert max-w-none",o==null?void 0:o.sectionContent,s),children:E.split(`
8
+ `).map((y,g)=>{if(y.startsWith("## ")){let w=y.substring(3).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsx("h3",{id:C,className:a("text-xl font-bold mt-6 mb-3",o==null?void 0:o.sectionTitle,s),children:w},g)}else if(y.startsWith("### ")){let w=y.substring(4).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsx("h4",{id:C,className:a("text-lg font-bold mt-4 mb-2",o==null?void 0:o.sectionTitle,s),children:w},g)}else return y===""?jsx("br",{},g):jsx("p",{className:"mb-2",children:y},g)})}),ee=()=>N?jsxs("div",{className:"mt-6",children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxs("div",{className:"ndpr-card__footer",children:[jsx("button",{onClick:()=>I("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as PDF"}),jsx("button",{onClick:()=>I("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as DOCX"}),jsx("button",{onClick:()=>I("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as HTML"}),jsx("button",{onClick:()=>I("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as Markdown"})]})]}):null;return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,o==null?void 0:o.root,s),children:[jsxs("div",{className:a("flex justify-between items-start mb-6",o==null?void 0:o.header,s),children:[jsxs("div",{children:[jsx("h2",{className:a("ndpr-section-heading",o==null?void 0:o.title,s),children:K}),jsx("p",{className:a("ndpr-card__subtitle",o==null?void 0:o.description,s),children:T})]}),r&&V&&jsx("button",{onClick:V,className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${B}`,children:"Edit Policy"})]}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",o==null?void 0:o.complianceNotice,s),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsx("p",{className:"ndpr-text-info text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxs("div",{role:"tablist","aria-label":"Policy view options",className:"flex flex-wrap -mb-px",children:[jsx("div",{className:"mr-2",children:jsx("button",{role:"tab",id:X,"aria-selected":$==="preview","aria-controls":R,onClick:()=>S("preview"),className:`inline-block p-4 ${$==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsx("div",{className:"mr-2",children:jsx("button",{role:"tab",id:A,"aria-selected":$==="markdown","aria-controls":J,onClick:()=>S("markdown"),className:`inline-block p-4 ${$==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsx("div",{className:a("bg-white dark:bg-gray-800 p-4 rounded-md",o==null?void 0:o.content,s),children:$==="preview"?jsxs("div",{role:"tabpanel",id:R,"aria-labelledby":X,"aria-live":"polite",children:[W(),G(),jsx("div",{className:a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",o==null?void 0:o.section,s),children:j()})]}):jsx("div",{role:"tabpanel",id:J,"aria-labelledby":A,children:jsx("pre",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md overflow-auto whitespace-pre-wrap font-mono text-sm text-gray-800 dark:text-gray-200",children:E})})}),ee()]})};var Fe=({content:E,title:U="Privacy Policy",organizationName:L,lastUpdated:M,onExportComplete:V,componentTitle:K="Export Privacy Policy",description:T="Export your NDPA-compliant privacy policy in various formats.",className:Q="",buttonClassName:B="",showExportHistory:N=true,includeComplianceNotice:r=true,includeLogo:x=false,logoUrl:P,customStyles:F,classNames:n,unstyled:o=false})=>{let s=useId(),[m,$]=useState([]),[S,X]=useState("pdf"),[A,R]=useState(false),[J,Z]=useState(null),[h,I]=useState(""),[G,W]=useState(""),[j,ee]=useState(""),[y,g]=useState(false),w=e=>{let u=new Date().toISOString().split("T")[0];return `${L?L.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${u}.${e.toLowerCase()}`},C=e=>h?h.endsWith(`.${e.toLowerCase()}`)?h:`${h}.${e.toLowerCase()}`:w(e),q=()=>{let e=L?`${L} ${U}`:U,u=M?M.toLocaleDateString():"N/A",b=`<!DOCTYPE html>
9
9
  <html lang="en">
10
10
  <head>
11
11
  <meta charset="UTF-8">
@@ -67,7 +67,7 @@ import {c,d,b as b$1}from'./chunk-NBQQ2GN3.mjs';import {a}from'./chunk-SFGW37LE.
67
67
  margin-bottom: 30px;
68
68
  font-size: 14px;
69
69
  }
70
- ${A||""}
70
+ ${F||""}
71
71
  </style>
72
72
  </head>
73
73
  <body>
@@ -75,12 +75,12 @@ import {c,d,b as b$1}from'./chunk-NBQQ2GN3.mjs';import {a}from'./chunk-SFGW37LE.
75
75
  ${x&&P?`<img src="${P}" alt="${L||"Company"} Logo" class="logo">`:""}
76
76
  ${G?`<div class="custom-header">${G}</div>`:""}
77
77
  <h1>${e}</h1>
78
- <div class="last-updated">Last Updated: ${y}</div>
79
- </div>`;r&&(u+=`
78
+ <div class="last-updated">Last Updated: ${u}</div>
79
+ </div>`;r&&(b+=`
80
80
  <div class="compliance-notice">
81
81
  <strong>NDPA Compliance Notice:</strong> This privacy policy has been created to comply with the Nigeria Data Protection Act (NDPA) 2023.
82
82
  It outlines how we collect, use, disclose, and protect your personal information in accordance with NDPA requirements.
83
- </div>`);let z=_.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return u+=`
83
+ </div>`);let z=E.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return b+=`
84
84
  <div class="content">
85
85
  <p>${z}</p>
86
86
  </div>
@@ -90,4 +90,4 @@ import {c,d,b as b$1}from'./chunk-NBQQ2GN3.mjs';import {a}from'./chunk-SFGW37LE.
90
90
  <p>&copy; ${new Date().getFullYear()} ${L||"Company"}. All rights reserved.</p>
91
91
  </div>
92
92
  </body>
93
- </html>`,u},l=()=>d$1(null,null,function*(){R(true),Z(null);try{let e=S.toLowerCase(),y="",u;switch(e){case "pdf":let te=q();u=new Blob([te],{type:"text/html"}),y=URL.createObjectURL(u);break;case "docx":u=new Blob([_],{type:"text/plain"}),y=URL.createObjectURL(u);break;case "html":let pe=q();u=new Blob([pe],{type:"text/html"}),y=URL.createObjectURL(u);break;default:u=new Blob([_],{type:"text/markdown"}),y=URL.createObjectURL(u);break}let z=C(e),O=document.createElement("a");O.href=y,O.download=z,document.body.appendChild(O),O.click(),document.body.removeChild(O);let E={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:y,filename:z};$(te=>[E,...te]),V&&V(e,y);}catch(e){console.error("[ndpr-toolkit] Export error:",e),Z("An error occurred during export. Please try again.");}finally{R(false);}}),c=()=>{let e=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}],y=`${s}-export-format`;return jsxs("div",{"data-ndpr-component":"policy-exporter",className:a("mb-6",n==null?void 0:n.formatSelector,i),children:[jsx("label",{htmlFor:y,className:"ndpr-form-field__label",children:"Export Format"}),jsx("select",{id:y,value:S,onChange:u=>X(u.target.value),className:a("ndpr-form-field__input",n==null?void 0:n.formatOption,i),children:e.map(u=>jsx("option",{value:u.value,children:u.label},u.value))})]})},a$1=()=>h?jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsx("button",{type:"button",onClick:()=>g(false),className:"ndpr-text-primary text-sm",children:"Hide Advanced Options"})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${s}-custom-filename`,className:"ndpr-form-field__label",children:"Custom Filename"}),jsx("input",{type:"text",id:`${s}-custom-filename`,value:v,onChange:e=>I(e.target.value),placeholder:w(S),"aria-describedby":`${s}-custom-filename-desc`,className:"ndpr-form-field__input"}),jsx("p",{id:`${s}-custom-filename-desc`,className:"ndpr-form-field__hint",children:"Leave blank to use the default filename format."})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${s}-custom-header`,className:"ndpr-form-field__label",children:"Custom Header HTML (for HTML/PDF exports)"}),jsx("textarea",{id:`${s}-custom-header`,value:G,onChange:e=>W(e.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${s}-custom-footer`,className:"ndpr-form-field__label",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsx("textarea",{id:`${s}-custom-footer`,value:j,onChange:e=>ee(e.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"ndpr-form-field__input"})]}),jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:`${s}-include-compliance-notice`,type:"checkbox",checked:r,onChange:e=>g(e.target.checked),"aria-describedby":`${s}-compliance-notice-desc`,className:"w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"})}),jsxs("div",{className:"ml-3 text-sm",children:[jsx("label",{htmlFor:`${s}-include-compliance-notice`,className:"font-medium ndpr-text-foreground",children:"Include NDPA Compliance Notice"}),jsx("p",{id:`${s}-compliance-notice-desc`,className:"ndpr-card__subtitle",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsx("button",{type:"button",onClick:()=>g(true),className:"ndpr-text-primary text-sm mb-6",children:"Show Advanced Options"}),b=()=>!N||m.length===0?null:jsxs("div",{className:a("mt-6",n==null?void 0:n.preview,i),children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxs("tr",{children:[jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Date"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Format"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Filename"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Actions"})]})}),jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:m.map(e=>jsxs("tr",{children:[jsx("td",{className:"ndpr-table__cell",children:new Date(e.timestamp).toLocaleString()}),jsx("td",{className:"ndpr-table__cell",children:e.format.toUpperCase()}),jsx("td",{className:"ndpr-table__cell",children:e.filename}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsx("a",{href:e.url,download:e.filename,className:"ndpr-text-primary hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},e.id))})]})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,n==null?void 0:n.root,i),children:[jsxs("div",{className:a("mb-6",n==null?void 0:n.header,i),children:[jsx("h2",{className:a("ndpr-section-heading",n==null?void 0:n.title,i),children:K}),jsx("p",{className:a("ndpr-card__subtitle",n==null?void 0:n.description,i),children:T})]}),c(),a$1(),jsxs("div",{className:"mb-6",children:[jsx("button",{onClick:l,disabled:F,className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${B} ${F?"opacity-70 cursor-not-allowed":""}`,(n==null?void 0:n.primaryButton)||(n==null?void 0:n.exportButton),i),children:F?"Exporting...":`Export as ${S.toUpperCase()}`}),J&&jsx("p",{className:"mt-2 text-sm ndpr-text-destructive dark:text-red-500",children:J})]}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",n==null?void 0:n.complianceNotice,i),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"Export Tips"}),jsxs("ul",{className:"ndpr-text-info text-sm list-disc list-inside space-y-1",children:[jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),b()]})};export{ye as a,_e as b,Ae as c};
93
+ </html>`,b},l=()=>d$1(null,null,function*(){R(true),Z(null);try{let e=S.toLowerCase(),u="",b;switch(e){case "pdf":let te=q();b=new Blob([te],{type:"text/html"}),u=URL.createObjectURL(b);break;case "docx":b=new Blob([E],{type:"text/plain"}),u=URL.createObjectURL(b);break;case "html":let pe=q();b=new Blob([pe],{type:"text/html"}),u=URL.createObjectURL(b);break;default:b=new Blob([E],{type:"text/markdown"}),u=URL.createObjectURL(b);break}let z=C(e),O=document.createElement("a");O.href=u,O.download=z,document.body.appendChild(O),O.click(),document.body.removeChild(O);let _={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:u,filename:z};$(te=>[_,...te]),V&&V(e,u);}catch(e){console.error("[ndpr-toolkit/policy] Export failed:",e);let u=e instanceof Error&&e.message?e.message.length>200?`${e.message.slice(0,200)}\u2026`:e.message:null;Z(u?`[ndpr-toolkit/policy] Export failed: ${u}`:"[ndpr-toolkit/policy] Export failed \u2014 see the browser console for the underlying error.");}finally{R(false);}}),c=()=>{let e=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}],u=`${s}-export-format`;return jsxs("div",{"data-ndpr-component":"policy-exporter",className:a("mb-6",n==null?void 0:n.formatSelector,o),children:[jsx("label",{htmlFor:u,className:"ndpr-form-field__label",children:"Export Format"}),jsx("select",{id:u,value:S,onChange:b=>X(b.target.value),className:a("ndpr-form-field__input",n==null?void 0:n.formatOption,o),children:e.map(b=>jsx("option",{value:b.value,children:b.label},b.value))})]})},a$1=()=>y?jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxs("div",{className:"flex justify-between items-center",children:[jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsx("button",{type:"button",onClick:()=>g(false),className:"ndpr-text-primary text-sm",children:"Hide Advanced Options"})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${s}-custom-filename`,className:"ndpr-form-field__label",children:"Custom Filename"}),jsx("input",{type:"text",id:`${s}-custom-filename`,value:h,onChange:e=>I(e.target.value),placeholder:w(S),"aria-describedby":`${s}-custom-filename-desc`,className:"ndpr-form-field__input"}),jsx("p",{id:`${s}-custom-filename-desc`,className:"ndpr-form-field__hint",children:"Leave blank to use the default filename format."})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${s}-custom-header`,className:"ndpr-form-field__label",children:"Custom Header HTML (for HTML/PDF exports)"}),jsx("textarea",{id:`${s}-custom-header`,value:G,onChange:e=>W(e.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"ndpr-form-field__input"})]}),jsxs("div",{children:[jsx("label",{htmlFor:`${s}-custom-footer`,className:"ndpr-form-field__label",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsx("textarea",{id:`${s}-custom-footer`,value:j,onChange:e=>ee(e.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"ndpr-form-field__input"})]}),jsxs("div",{className:"flex items-start",children:[jsx("div",{className:"flex items-center h-5",children:jsx("input",{id:`${s}-include-compliance-notice`,type:"checkbox",checked:r,onChange:e=>g(e.target.checked),"aria-describedby":`${s}-compliance-notice-desc`,className:"w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"})}),jsxs("div",{className:"ml-3 text-sm",children:[jsx("label",{htmlFor:`${s}-include-compliance-notice`,className:"font-medium ndpr-text-foreground",children:"Include NDPA Compliance Notice"}),jsx("p",{id:`${s}-compliance-notice-desc`,className:"ndpr-card__subtitle",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsx("button",{type:"button",onClick:()=>g(true),className:"ndpr-text-primary text-sm mb-6",children:"Show Advanced Options"}),f=()=>!N||m.length===0?null:jsxs("div",{className:a("mt-6",n==null?void 0:n.preview,o),children:[jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxs("tr",{children:[jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Date"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Format"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Filename"}),jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Actions"})]})}),jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:m.map(e=>jsxs("tr",{children:[jsx("td",{className:"ndpr-table__cell",children:new Date(e.timestamp).toLocaleString()}),jsx("td",{className:"ndpr-table__cell",children:e.format.toUpperCase()}),jsx("td",{className:"ndpr-table__cell",children:e.filename}),jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsx("a",{href:e.url,download:e.filename,className:"ndpr-text-primary hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},e.id))})]})})]});return jsxs("div",{className:a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,n==null?void 0:n.root,o),children:[jsxs("div",{className:a("mb-6",n==null?void 0:n.header,o),children:[jsx("h2",{className:a("ndpr-section-heading",n==null?void 0:n.title,o),children:K}),jsx("p",{className:a("ndpr-card__subtitle",n==null?void 0:n.description,o),children:T})]}),c(),a$1(),jsxs("div",{className:"mb-6",children:[jsx("button",{onClick:l,disabled:A,className:a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${B} ${A?"opacity-70 cursor-not-allowed":""}`,(n==null?void 0:n.primaryButton)||(n==null?void 0:n.exportButton),o),children:A?"Exporting...":`Export as ${S.toUpperCase()}`}),J&&jsx("p",{className:"mt-2 text-sm ndpr-text-destructive dark:text-red-500",children:J})]}),jsxs("div",{className:a("ndpr-alert ndpr-alert--info",n==null?void 0:n.complianceNotice,o),children:[jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"Export Tips"}),jsxs("ul",{className:"ndpr-text-info text-sm list-disc list-inside space-y-1",children:[jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),f()]})};export{ye as a,Ee as b,Fe as c};
@@ -1,11 +1,11 @@
1
- 'use strict';var chunkD2ZKDQVL_js=require('./chunk-D2ZKDQVL.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var ye=({sections:_=chunkD2ZKDQVL_js.c,variables:U=chunkD2ZKDQVL_js.d,onGenerate:L,title:M="NDPA Privacy Policy Generator",description:V="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:K="",buttonClassName:T="",generateButtonText:Q="Generate Policy",showPreview:B=true,allowEditing:N=true,classNames:r,unstyled:x=false})=>{let P=react.useId(),[A,n]=react.useState(_),[i,s]=react.useState(U),[m,$]=react.useState("sections"),[S,X]=react.useState(""),[F,R]=react.useState(""),[J,Z]=react.useState(false),[v,I]=react.useState({});react.useEffect(()=>{n(_);},[_]),react.useEffect(()=>{s(U);},[U]);let G=l=>{n(c=>c.map(a=>a.id===l?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},a),{included:!a.included}):a));},W=(l,c)=>{s(a=>a.map(b=>b.id===l?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},b),{value:c}):b)),v[l]&&I(a=>{let b=chunkRFPLZDIO_js.a({},a);return delete b[l],b});},j=()=>{let l={},c=true;return i.forEach(a=>{a.required&&!a.value&&(l[a.id]=`${a.name} is required`,c=false);}),I(l),c},ee=()=>{if(!j()){$("variables");return}let l=A.filter(b=>b.included),c=Object.fromEntries(i.map(b=>[b.name,b.value])),a="";l.forEach(b=>{a+=`## ${b.title}
1
+ 'use strict';var chunkD2ZKDQVL_js=require('./chunk-D2ZKDQVL.js'),chunkAME4HJR4_js=require('./chunk-AME4HJR4.js'),chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var ye=({sections:E=chunkD2ZKDQVL_js.c,variables:U=chunkD2ZKDQVL_js.d,onGenerate:L,title:M="NDPA Privacy Policy Generator",description:V="Generate an NDPA-compliant privacy policy for your organization in accordance with NDPA Section 24.",className:K="",buttonClassName:T="",generateButtonText:Q="Generate Policy",showPreview:B=true,allowEditing:N=true,classNames:r,unstyled:x=false})=>{let P=react.useId(),[F,n]=react.useState(E),[o,s]=react.useState(U),[m,$]=react.useState("sections"),[S,X]=react.useState(""),[A,R]=react.useState(""),[J,Z]=react.useState(false),[h,I]=react.useState({});react.useEffect(()=>{n(E);},[E]),react.useEffect(()=>{s(U);},[U]);let G=l=>{n(c=>c.map(a=>a.id===l?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},a),{included:!a.included}):a));},W=(l,c)=>{s(a=>a.map(f=>f.id===l?chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},f),{value:c}):f)),h[l]&&I(a=>{let f=chunkRFPLZDIO_js.a({},a);return delete f[l],f});},j=()=>{let l={},c=true;return o.forEach(a=>{a.required&&!a.value&&(l[a.id]=`${a.name} is required`,c=false);}),I(l),c},ee=()=>{if(!j()){$("variables");return}let l=F.filter(f=>f.included),c=Object.fromEntries(o.map(f=>[f.name,f.value])),a="";l.forEach(f=>{a+=`## ${f.title}
2
2
 
3
- `,a+=chunkD2ZKDQVL_js.b(b.template,c),a+=`
3
+ `,a+=chunkD2ZKDQVL_js.b(f.template,c),a+=`
4
4
 
5
- `;}),X(a),R(a),Z(true),$("preview");},h=()=>{L({sections:A,variables:i,content:N?F:S});},g=()=>jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-generator",className:chunkAME4HJR4_js.a("ndpr-form-section",r==null?void 0:r.sectionList,x),role:"group","aria-labelledby":`${P}-sections-heading`,children:[jsxRuntime.jsx("h3",{id:`${P}-sections-heading`,className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),A.map(l=>{let c=`${P}-section-${l.id}`,a=l.description?`${P}-section-desc-${l.id}`:void 0;return jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("border border-gray-200 dark:border-gray-700 rounded-md p-4",r==null?void 0:r.sectionItem,x),children:jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:c,type:"checkbox",checked:l.included,onChange:()=>G(l.id),disabled:l.required,"aria-describedby":a,className:chunkAME4HJR4_js.a("w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",r==null?void 0:r.input,x)})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsxs("label",{htmlFor:c,className:"font-medium ndpr-text-foreground",children:[l.title," ",l.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),l.required&&jsxRuntime.jsx("span",{className:"sr-only",children:" (required)"})]}),l.description&&jsxRuntime.jsx("p",{id:a,className:"ndpr-text-muted mt-1",children:l.description})]})]})},l.id)}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:"Next: Fill Variables"})})]}),w=()=>{let l={};return i.forEach(c=>{let a=c.id.split(".")[0];l[a]||(l[a]=[]),l[a].push(c);}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("",r==null?void 0:r.form,x),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:Object.entries(l).map(([c,a])=>{let b=A.find(e=>e.id===c);return b&&!b.included?null:jsxRuntime.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsx("h4",{className:"font-medium text-lg mb-3",children:b?b.title:"General Information"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:a.map(e=>{let y=`${P}-var-${e.id}`,u=e.description?`${P}-var-desc-${e.id}`:void 0,z=v[e.id]?`${P}-var-err-${e.id}`:void 0,O=[u,z].filter(Boolean).join(" ")||void 0;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:y,className:"ndpr-form-field__label",children:[e.name," ",e.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),e.description&&jsxRuntime.jsx("p",{id:u,className:"text-xs ndpr-text-muted mb-2",children:e.description}),e.inputType==="textarea"?jsxRuntime.jsx("textarea",{id:y,value:e.value,onChange:E=>W(e.id,E.target.value),rows:4,className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0}):e.inputType==="select"&&e.options?jsxRuntime.jsxs("select",{id:y,value:e.value,onChange:E=>W(e.id,E.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select an option"}),e.options.map(E=>jsxRuntime.jsx("option",{value:E,children:E},E))]}):jsxRuntime.jsx("input",{id:y,type:e.inputType,value:e.value,onChange:E=>W(e.id,E.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${v[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":v[e.id]?true:void 0}),v[e.id]&&jsxRuntime.jsx("p",{id:z,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:v[e.id]})]},e.id)})})]},c)})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("sections"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Sections"}),jsxRuntime.jsx("button",{onClick:ee,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:Q})]})]})},C=()=>{let l=`${P}-policy-content`;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),N?jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:l,className:"ndpr-form-field__label",children:"Edit Policy Content"}),jsxRuntime.jsx("textarea",{id:l,value:F,onChange:c=>R(c.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono"})]}):jsxRuntime.jsx("div",{className:"ndpr-panel","aria-live":"polite",children:jsxRuntime.jsx("div",{className:"prose dark:prose-invert max-w-none",children:S.split(`
6
- `).map((c,a)=>c.startsWith("## ")?jsxRuntime.jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},a):c.startsWith("### ")?jsxRuntime.jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},a):c===""?jsxRuntime.jsx("br",{},a):jsxRuntime.jsx("p",{className:"mb-2",children:c},a))})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Variables"}),jsxRuntime.jsx("button",{onClick:h,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${T}`,children:"Save Policy"})]})]})},q=()=>{switch(m){case "sections":return g();case "variables":return w();case "preview":return C();default:return g()}};return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${K}`,r==null?void 0:r.root,x),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",r==null?void 0:r.header,x),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",r==null?void 0:r.title,x),children:M}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",r==null?void 0:r.description,x),children:V})]}),jsxRuntime.jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxRuntime.jsxs("ol",{className:"flex items-center w-full",children:[jsxRuntime.jsxs("li",{className:`flex w-full items-center ${m==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="sections"?"step":void 0,children:"1"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="sections"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex w-full items-center ${m==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="variables"?"step":void 0,children:"2"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="variables"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex items-center ${m==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="preview"?"step":void 0,children:"3"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="preview"?" (current step)":""})]})]})}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",r==null?void 0:r.complianceNotice,x),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),q()]})};var _e=({content:_,sections:U,variables:L,onExport:M,onEdit:V,title:K="Privacy Policy Preview",description:T="Preview your NDPA-compliant privacy policy before exporting.",className:Q="",buttonClassName:B="",showExportOptions:N=true,showEditButton:r=true,showTableOfContents:x=true,showMetadata:P=true,organizationName:A,lastUpdated:n,classNames:i,unstyled:s=false})=>{let m=react.useId(),[$,S]=react.useState("preview"),X=`${m}-tab-preview`,F=`${m}-tab-markdown`,R=`${m}-panel-preview`,J=`${m}-panel-markdown`,v=(()=>{let h=_.split(`
7
- `),g=[];return h.forEach(w=>{if(w.startsWith("## ")){let C=w.substring(3).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:2});}else if(w.startsWith("### ")){let C=w.substring(4).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:3});}}),g})(),I=h=>{if(M)M(h);else if(h==="markdown"){let g=document.createElement("a"),w=new Blob([_],{type:"text/markdown"});g.href=URL.createObjectURL(w),g.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(g),g.click(),document.body.removeChild(g);}},G=()=>!x||v.length===0?null:jsxRuntime.jsxs("nav",{"aria-label":"Table of contents",className:"ndpr-panel",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsxRuntime.jsx("ul",{className:"space-y-1",children:v.map((h,g)=>jsxRuntime.jsx("li",{style:{marginLeft:`${(h.level-2)*1.5}rem`},children:jsxRuntime.jsx("a",{href:`#${h.id}`,className:"ndpr-text-primary hover:underline",children:h.title})},g))})]}),W=()=>P?jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-preview",className:"mb-6",children:[jsxRuntime.jsx("h1",{className:"ndpr-card__title",children:A?`${A} Privacy Policy`:"Privacy Policy"}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:["Last Updated: ",n?n.toLocaleDateString():"N/A"]})]}):null,j=()=>jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("prose dark:prose-invert max-w-none",i==null?void 0:i.sectionContent,s),children:_.split(`
8
- `).map((h,g)=>{if(h.startsWith("## ")){let w=h.substring(3).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h3",{id:C,className:chunkAME4HJR4_js.a("text-xl font-bold mt-6 mb-3",i==null?void 0:i.sectionTitle,s),children:w},g)}else if(h.startsWith("### ")){let w=h.substring(4).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h4",{id:C,className:chunkAME4HJR4_js.a("text-lg font-bold mt-4 mb-2",i==null?void 0:i.sectionTitle,s),children:w},g)}else return h===""?jsxRuntime.jsx("br",{},g):jsxRuntime.jsx("p",{className:"mb-2",children:h},g)})}),ee=()=>N?jsxRuntime.jsxs("div",{className:"mt-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[jsxRuntime.jsx("button",{onClick:()=>I("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as PDF"}),jsxRuntime.jsx("button",{onClick:()=>I("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as DOCX"}),jsxRuntime.jsx("button",{onClick:()=>I("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as HTML"}),jsxRuntime.jsx("button",{onClick:()=>I("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as Markdown"})]})]}):null;return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,i==null?void 0:i.root,s),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("flex justify-between items-start mb-6",i==null?void 0:i.header,s),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",i==null?void 0:i.title,s),children:K}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",i==null?void 0:i.description,s),children:T})]}),r&&V&&jsxRuntime.jsx("button",{onClick:V,className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${B}`,children:"Edit Policy"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",i==null?void 0:i.complianceNotice,s),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsxRuntime.jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxRuntime.jsxs("div",{role:"tablist","aria-label":"Policy view options",className:"flex flex-wrap -mb-px",children:[jsxRuntime.jsx("div",{className:"mr-2",children:jsxRuntime.jsx("button",{role:"tab",id:X,"aria-selected":$==="preview","aria-controls":R,onClick:()=>S("preview"),className:`inline-block p-4 ${$==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsxRuntime.jsx("div",{className:"mr-2",children:jsxRuntime.jsx("button",{role:"tab",id:F,"aria-selected":$==="markdown","aria-controls":J,onClick:()=>S("markdown"),className:`inline-block p-4 ${$==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-white dark:bg-gray-800 p-4 rounded-md",i==null?void 0:i.content,s),children:$==="preview"?jsxRuntime.jsxs("div",{role:"tabpanel",id:R,"aria-labelledby":X,"aria-live":"polite",children:[W(),G(),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",i==null?void 0:i.section,s),children:j()})]}):jsxRuntime.jsx("div",{role:"tabpanel",id:J,"aria-labelledby":F,children:jsxRuntime.jsx("pre",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md overflow-auto whitespace-pre-wrap font-mono text-sm text-gray-800 dark:text-gray-200",children:_})})}),ee()]})};var Ae=({content:_,title:U="Privacy Policy",organizationName:L,lastUpdated:M,onExportComplete:V,componentTitle:K="Export Privacy Policy",description:T="Export your NDPA-compliant privacy policy in various formats.",className:Q="",buttonClassName:B="",showExportHistory:N=true,includeComplianceNotice:r=true,includeLogo:x=false,logoUrl:P,customStyles:A,classNames:n,unstyled:i=false})=>{let s=react.useId(),[m,$]=react.useState([]),[S,X]=react.useState("pdf"),[F,R]=react.useState(false),[J,Z]=react.useState(null),[v,I]=react.useState(""),[G,W]=react.useState(""),[j,ee]=react.useState(""),[h,g]=react.useState(false),w=e=>{let y=new Date().toISOString().split("T")[0];return `${L?L.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${y}.${e.toLowerCase()}`},C=e=>v?v.endsWith(`.${e.toLowerCase()}`)?v:`${v}.${e.toLowerCase()}`:w(e),q=()=>{let e=L?`${L} ${U}`:U,y=M?M.toLocaleDateString():"N/A",u=`<!DOCTYPE html>
5
+ `;}),X(a),R(a),Z(true),$("preview");},y=()=>{L({sections:F,variables:o,content:N?A:S});},g=()=>jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-generator",className:chunkAME4HJR4_js.a("ndpr-form-section",r==null?void 0:r.sectionList,x),role:"group","aria-labelledby":`${P}-sections-heading`,children:[jsxRuntime.jsx("h3",{id:`${P}-sections-heading`,className:"text-lg font-medium mb-4",children:"Select Policy Sections"}),F.map(l=>{let c=`${P}-section-${l.id}`,a=l.description?`${P}-section-desc-${l.id}`:void 0;return jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("border border-gray-200 dark:border-gray-700 rounded-md p-4",r==null?void 0:r.sectionItem,x),children:jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:c,type:"checkbox",checked:l.included,onChange:()=>G(l.id),disabled:l.required,"aria-describedby":a,className:chunkAME4HJR4_js.a("w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600",r==null?void 0:r.input,x)})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsxs("label",{htmlFor:c,className:"font-medium ndpr-text-foreground",children:[l.title," ",l.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"}),l.required&&jsxRuntime.jsx("span",{className:"sr-only",children:" (required)"})]}),l.description&&jsxRuntime.jsx("p",{id:a,className:"ndpr-text-muted mt-1",children:l.description})]})]})},l.id)}),jsxRuntime.jsx("div",{className:"mt-6",children:jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:"Next: Fill Variables"})})]}),w=()=>{let l={};return o.forEach(c=>{let a=c.id.split(".")[0];l[a]||(l[a]=[]),l[a].push(c);}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("",r==null?void 0:r.form,x),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Fill Policy Variables"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:Object.entries(l).map(([c,a])=>{let f=F.find(e=>e.id===c);return f&&!f.included?null:jsxRuntime.jsxs("div",{className:"border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsx("h4",{className:"font-medium text-lg mb-3",children:f?f.title:"General Information"}),jsxRuntime.jsx("div",{className:"ndpr-form-section",children:a.map(e=>{let u=`${P}-var-${e.id}`,b=e.description?`${P}-var-desc-${e.id}`:void 0,z=h[e.id]?`${P}-var-err-${e.id}`:void 0,O=[b,z].filter(Boolean).join(" ")||void 0;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsxs("label",{htmlFor:u,className:"ndpr-form-field__label",children:[e.name," ",e.required&&jsxRuntime.jsx("span",{className:"text-red-500","aria-hidden":"true",children:"*"})]}),e.description&&jsxRuntime.jsx("p",{id:b,className:"text-xs ndpr-text-muted mb-2",children:e.description}),e.inputType==="textarea"?jsxRuntime.jsx("textarea",{id:u,value:e.value,onChange:_=>W(e.id,_.target.value),rows:4,className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0}):e.inputType==="select"&&e.options?jsxRuntime.jsxs("select",{id:u,value:e.value,onChange:_=>W(e.id,_.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0,children:[jsxRuntime.jsx("option",{value:"",children:"Select an option"}),e.options.map(_=>jsxRuntime.jsx("option",{value:_,children:_},_))]}):jsxRuntime.jsx("input",{id:u,type:e.inputType,value:e.value,onChange:_=>W(e.id,_.target.value),className:chunkAME4HJR4_js.a(`w-full px-3 py-2 border ${h[e.id]?"border-red-500 focus:ring-red-500":"border-gray-300 dark:border-gray-600 focus:ring-[rgb(var(--ndpr-ring))]"} rounded-md focus:outline-none focus:ring-2`,r==null?void 0:r.input,x),required:e.required,"aria-required":e.required||void 0,"aria-describedby":O,"aria-invalid":h[e.id]?true:void 0}),h[e.id]&&jsxRuntime.jsx("p",{id:z,role:"alert",className:"mt-1 text-sm ndpr-text-destructive dark:text-red-500",children:h[e.id]})]},e.id)})})]},c)})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("sections"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Sections"}),jsxRuntime.jsx("button",{onClick:ee,className:chunkAME4HJR4_js.a(`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${T}`,(r==null?void 0:r.primaryButton)||(r==null?void 0:r.generateButton),x),children:Q})]})]})},C=()=>{let l=`${P}-policy-content`;return jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-4",children:"Preview Generated Policy"}),N?jsxRuntime.jsxs("div",{className:"ndpr-form-field",children:[jsxRuntime.jsx("label",{htmlFor:l,className:"ndpr-form-field__label",children:"Edit Policy Content"}),jsxRuntime.jsx("textarea",{id:l,value:A,onChange:c=>R(c.target.value),rows:20,className:"ndpr-form-field__input ndpr-form-field__input--mono"})]}):jsxRuntime.jsx("div",{className:"ndpr-panel","aria-live":"polite",children:jsxRuntime.jsx("div",{className:"prose dark:prose-invert max-w-none",children:S.split(`
6
+ `).map((c,a)=>c.startsWith("## ")?jsxRuntime.jsx("h3",{className:"text-xl font-bold mt-6 mb-3",children:c.substring(3)},a):c.startsWith("### ")?jsxRuntime.jsx("h4",{className:"text-lg font-bold mt-4 mb-2",children:c.substring(4)},a):c===""?jsxRuntime.jsx("br",{},a):jsxRuntime.jsx("p",{className:"mb-2",children:c},a))})}),jsxRuntime.jsxs("div",{className:"mt-6 flex space-x-4",children:[jsxRuntime.jsx("button",{onClick:()=>$("variables"),className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${T}`,children:"Back to Variables"}),jsxRuntime.jsx("button",{onClick:y,className:`px-4 py-2 bg-green-600 text-white rounded hover:bg-green-700 ${T}`,children:"Save Policy"})]})]})},q=()=>{switch(m){case "sections":return g();case "variables":return w();case "preview":return C();default:return g()}};return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${K}`,r==null?void 0:r.root,x),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",r==null?void 0:r.header,x),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",r==null?void 0:r.title,x),children:M}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",r==null?void 0:r.description,x),children:V})]}),jsxRuntime.jsx("nav",{"aria-label":"Policy generation steps",className:"mb-8",children:jsxRuntime.jsxs("ol",{className:"flex items-center w-full",children:[jsxRuntime.jsxs("li",{className:`flex w-full items-center ${m==="sections"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="sections"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="sections"?"step":void 0,children:"1"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Sections"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="sections"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex w-full items-center ${m==="variables"?"ndpr-text-primary":"ndpr-card__subtitle"} after:content-[''] after:w-full after:h-1 after:border-b after:border-gray-200 after:border-1 after:hidden sm:after:inline-block after:mx-6 xl:after:mx-10`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="variables"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="variables"?"step":void 0,children:"2"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Variables"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="variables"?" (current step)":""})]}),jsxRuntime.jsxs("li",{className:`flex items-center ${m==="preview"?"ndpr-text-primary":"ndpr-card__subtitle"}`,children:[jsxRuntime.jsx("span",{className:`flex items-center justify-center w-8 h-8 ${m==="preview"?"ndpr-alert ndpr-alert--info":"ndpr-panel"} rounded-full shrink-0`,"aria-current":m==="preview"?"step":void 0,children:"3"}),jsxRuntime.jsx("span",{className:"hidden sm:inline-flex sm:ml-2",children:"Preview"}),jsxRuntime.jsx("span",{className:"sr-only",children:m==="preview"?" (current step)":""})]})]})}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",r==null?void 0:r.complianceNotice,x),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This tool helps you generate a privacy policy that aligns with the Nigeria Data Protection Act (NDPA) 2023. While we strive to ensure compliance, we recommend having the final policy reviewed by a legal professional familiar with NDPA requirements."})]}),q()]})};var Ee=({content:E,sections:U,variables:L,onExport:M,onEdit:V,title:K="Privacy Policy Preview",description:T="Preview your NDPA-compliant privacy policy before exporting.",className:Q="",buttonClassName:B="",showExportOptions:N=true,showEditButton:r=true,showTableOfContents:x=true,showMetadata:P=true,organizationName:F,lastUpdated:n,classNames:o,unstyled:s=false})=>{let m=react.useId(),[$,S]=react.useState("preview"),X=`${m}-tab-preview`,A=`${m}-tab-markdown`,R=`${m}-panel-preview`,J=`${m}-panel-markdown`,h=(()=>{let y=E.split(`
7
+ `),g=[];return y.forEach(w=>{if(w.startsWith("## ")){let C=w.substring(3).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:2});}else if(w.startsWith("### ")){let C=w.substring(4).trim(),q=`${m}-${C.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;g.push({id:q,title:C,level:3});}}),g})(),I=y=>{if(M)M(y);else if(y==="markdown"){let g=document.createElement("a"),w=new Blob([E],{type:"text/markdown"});g.href=URL.createObjectURL(w),g.download=`privacy-policy-${new Date().toISOString().split("T")[0]}.md`,document.body.appendChild(g),g.click(),document.body.removeChild(g);}},G=()=>!x||h.length===0?null:jsxRuntime.jsxs("nav",{"aria-label":"Table of contents",className:"ndpr-panel",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Table of Contents"}),jsxRuntime.jsx("ul",{className:"space-y-1",children:h.map((y,g)=>jsxRuntime.jsx("li",{style:{marginLeft:`${(y.level-2)*1.5}rem`},children:jsxRuntime.jsx("a",{href:`#${y.id}`,className:"ndpr-text-primary hover:underline",children:y.title})},g))})]}),W=()=>P?jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-preview",className:"mb-6",children:[jsxRuntime.jsx("h1",{className:"ndpr-card__title",children:F?`${F} Privacy Policy`:"Privacy Policy"}),jsxRuntime.jsxs("p",{className:"ndpr-form-field__hint",children:["Last Updated: ",n?n.toLocaleDateString():"N/A"]})]}):null,j=()=>jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("prose dark:prose-invert max-w-none",o==null?void 0:o.sectionContent,s),children:E.split(`
8
+ `).map((y,g)=>{if(y.startsWith("## ")){let w=y.substring(3).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h3",{id:C,className:chunkAME4HJR4_js.a("text-xl font-bold mt-6 mb-3",o==null?void 0:o.sectionTitle,s),children:w},g)}else if(y.startsWith("### ")){let w=y.substring(4).trim(),C=`${m}-${w.toLowerCase().replace(/[^a-z0-9]+/g,"-")}`;return jsxRuntime.jsx("h4",{id:C,className:chunkAME4HJR4_js.a("text-lg font-bold mt-4 mb-2",o==null?void 0:o.sectionTitle,s),children:w},g)}else return y===""?jsxRuntime.jsx("br",{},g):jsxRuntime.jsx("p",{className:"mb-2",children:y},g)})}),ee=()=>N?jsxRuntime.jsxs("div",{className:"mt-6",children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export Options"}),jsxRuntime.jsxs("div",{className:"ndpr-card__footer",children:[jsxRuntime.jsx("button",{onClick:()=>I("pdf"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as PDF"}),jsxRuntime.jsx("button",{onClick:()=>I("docx"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as DOCX"}),jsxRuntime.jsx("button",{onClick:()=>I("html"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as HTML"}),jsxRuntime.jsx("button",{onClick:()=>I("markdown"),className:`px-4 py-2 bg-[rgb(var(--ndpr-primary))] text-white rounded hover:bg-[rgb(var(--ndpr-primary-hover))] ${B}`,children:"Export as Markdown"})]})]}):null;return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,o==null?void 0:o.root,s),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("flex justify-between items-start mb-6",o==null?void 0:o.header,s),children:[jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",o==null?void 0:o.title,s),children:K}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",o==null?void 0:o.description,s),children:T})]}),r&&V&&jsxRuntime.jsx("button",{onClick:V,className:`px-4 py-2 bg-gray-200 text-gray-800 dark:bg-gray-700 dark:text-white rounded hover:bg-gray-300 dark:hover:bg-gray-600 ${B}`,children:"Edit Policy"})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",o==null?void 0:o.complianceNotice,s),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"NDPA Compliance Notice"}),jsxRuntime.jsx("p",{className:"ndpr-text-info text-sm",children:"This privacy policy has been generated to align with the Nigeria Data Protection Act (NDPA) 2023. We recommend having the final policy reviewed by a legal professional familiar with NDPA requirements before publishing it on your website or sharing it with your users."})]}),jsxRuntime.jsx("div",{className:"mb-6 border-b border-gray-200 dark:border-gray-700",children:jsxRuntime.jsxs("div",{role:"tablist","aria-label":"Policy view options",className:"flex flex-wrap -mb-px",children:[jsxRuntime.jsx("div",{className:"mr-2",children:jsxRuntime.jsx("button",{role:"tab",id:X,"aria-selected":$==="preview","aria-controls":R,onClick:()=>S("preview"),className:`inline-block p-4 ${$==="preview"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Preview"})}),jsxRuntime.jsx("div",{className:"mr-2",children:jsxRuntime.jsx("button",{role:"tab",id:A,"aria-selected":$==="markdown","aria-controls":J,onClick:()=>S("markdown"),className:`inline-block p-4 ${$==="markdown"?"text-[rgb(var(--ndpr-primary))] border-b-2 border-[rgb(var(--ndpr-primary))] dark:text-[rgb(var(--ndpr-primary))] dark:border-[rgb(var(--ndpr-primary))]":"text-gray-600 hover:text-gray-700 hover:border-gray-300 dark:text-gray-400 dark:hover:text-gray-300"}`,children:"Markdown"})})]})}),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-white dark:bg-gray-800 p-4 rounded-md",o==null?void 0:o.content,s),children:$==="preview"?jsxRuntime.jsxs("div",{role:"tabpanel",id:R,"aria-labelledby":X,"aria-live":"polite",children:[W(),G(),jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("bg-gray-50 dark:bg-gray-700 p-6 rounded-md",o==null?void 0:o.section,s),children:j()})]}):jsxRuntime.jsx("div",{role:"tabpanel",id:J,"aria-labelledby":A,children:jsxRuntime.jsx("pre",{className:"bg-gray-50 dark:bg-gray-700 p-4 rounded-md overflow-auto whitespace-pre-wrap font-mono text-sm text-gray-800 dark:text-gray-200",children:E})})}),ee()]})};var Fe=({content:E,title:U="Privacy Policy",organizationName:L,lastUpdated:M,onExportComplete:V,componentTitle:K="Export Privacy Policy",description:T="Export your NDPA-compliant privacy policy in various formats.",className:Q="",buttonClassName:B="",showExportHistory:N=true,includeComplianceNotice:r=true,includeLogo:x=false,logoUrl:P,customStyles:F,classNames:n,unstyled:o=false})=>{let s=react.useId(),[m,$]=react.useState([]),[S,X]=react.useState("pdf"),[A,R]=react.useState(false),[J,Z]=react.useState(null),[h,I]=react.useState(""),[G,W]=react.useState(""),[j,ee]=react.useState(""),[y,g]=react.useState(false),w=e=>{let u=new Date().toISOString().split("T")[0];return `${L?L.toLowerCase().replace(/[^a-z0-9]+/g,"-"):"privacy-policy"}-privacy-policy-${u}.${e.toLowerCase()}`},C=e=>h?h.endsWith(`.${e.toLowerCase()}`)?h:`${h}.${e.toLowerCase()}`:w(e),q=()=>{let e=L?`${L} ${U}`:U,u=M?M.toLocaleDateString():"N/A",b=`<!DOCTYPE html>
9
9
  <html lang="en">
10
10
  <head>
11
11
  <meta charset="UTF-8">
@@ -67,7 +67,7 @@
67
67
  margin-bottom: 30px;
68
68
  font-size: 14px;
69
69
  }
70
- ${A||""}
70
+ ${F||""}
71
71
  </style>
72
72
  </head>
73
73
  <body>
@@ -75,12 +75,12 @@
75
75
  ${x&&P?`<img src="${P}" alt="${L||"Company"} Logo" class="logo">`:""}
76
76
  ${G?`<div class="custom-header">${G}</div>`:""}
77
77
  <h1>${e}</h1>
78
- <div class="last-updated">Last Updated: ${y}</div>
79
- </div>`;r&&(u+=`
78
+ <div class="last-updated">Last Updated: ${u}</div>
79
+ </div>`;r&&(b+=`
80
80
  <div class="compliance-notice">
81
81
  <strong>NDPA Compliance Notice:</strong> This privacy policy has been created to comply with the Nigeria Data Protection Act (NDPA) 2023.
82
82
  It outlines how we collect, use, disclose, and protect your personal information in accordance with NDPA requirements.
83
- </div>`);let z=_.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return u+=`
83
+ </div>`);let z=E.replace(/^## (.*?)$/gm,"<h2>$1</h2>").replace(/^### (.*?)$/gm,"<h3>$1</h3>").replace(/\n\n/g,"</p><p>").replace(/\n/g,"<br>");return b+=`
84
84
  <div class="content">
85
85
  <p>${z}</p>
86
86
  </div>
@@ -90,4 +90,4 @@
90
90
  <p>&copy; ${new Date().getFullYear()} ${L||"Company"}. All rights reserved.</p>
91
91
  </div>
92
92
  </body>
93
- </html>`,u},l=()=>chunkRFPLZDIO_js.d(null,null,function*(){R(true),Z(null);try{let e=S.toLowerCase(),y="",u;switch(e){case "pdf":let te=q();u=new Blob([te],{type:"text/html"}),y=URL.createObjectURL(u);break;case "docx":u=new Blob([_],{type:"text/plain"}),y=URL.createObjectURL(u);break;case "html":let pe=q();u=new Blob([pe],{type:"text/html"}),y=URL.createObjectURL(u);break;default:u=new Blob([_],{type:"text/markdown"}),y=URL.createObjectURL(u);break}let z=C(e),O=document.createElement("a");O.href=y,O.download=z,document.body.appendChild(O),O.click(),document.body.removeChild(O);let E={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:y,filename:z};$(te=>[E,...te]),V&&V(e,y);}catch(e){console.error("[ndpr-toolkit] Export error:",e),Z("An error occurred during export. Please try again.");}finally{R(false);}}),c=()=>{let e=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}],y=`${s}-export-format`;return jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-exporter",className:chunkAME4HJR4_js.a("mb-6",n==null?void 0:n.formatSelector,i),children:[jsxRuntime.jsx("label",{htmlFor:y,className:"ndpr-form-field__label",children:"Export Format"}),jsxRuntime.jsx("select",{id:y,value:S,onChange:u=>X(u.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",n==null?void 0:n.formatOption,i),children:e.map(u=>jsxRuntime.jsx("option",{value:u.value,children:u.label},u.value))})]})},a=()=>h?jsxRuntime.jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>g(false),className:"ndpr-text-primary text-sm",children:"Hide Advanced Options"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-filename`,className:"ndpr-form-field__label",children:"Custom Filename"}),jsxRuntime.jsx("input",{type:"text",id:`${s}-custom-filename`,value:v,onChange:e=>I(e.target.value),placeholder:w(S),"aria-describedby":`${s}-custom-filename-desc`,className:"ndpr-form-field__input"}),jsxRuntime.jsx("p",{id:`${s}-custom-filename-desc`,className:"ndpr-form-field__hint",children:"Leave blank to use the default filename format."})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-header`,className:"ndpr-form-field__label",children:"Custom Header HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:`${s}-custom-header`,value:G,onChange:e=>W(e.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-footer`,className:"ndpr-form-field__label",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:`${s}-custom-footer`,value:j,onChange:e=>ee(e.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:`${s}-include-compliance-notice`,type:"checkbox",checked:r,onChange:e=>g(e.target.checked),"aria-describedby":`${s}-compliance-notice-desc`,className:"w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsx("label",{htmlFor:`${s}-include-compliance-notice`,className:"font-medium ndpr-text-foreground",children:"Include NDPA Compliance Notice"}),jsxRuntime.jsx("p",{id:`${s}-compliance-notice-desc`,className:"ndpr-card__subtitle",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>g(true),className:"ndpr-text-primary text-sm mb-6",children:"Show Advanced Options"}),b=()=>!N||m.length===0?null:jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mt-6",n==null?void 0:n.preview,i),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsxRuntime.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsxRuntime.jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Date"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Format"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Filename"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Actions"})]})}),jsxRuntime.jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:m.map(e=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:new Date(e.timestamp).toLocaleString()}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:e.format.toUpperCase()}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:e.filename}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsxRuntime.jsx("a",{href:e.url,download:e.filename,className:"ndpr-text-primary hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},e.id))})]})})]});return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,n==null?void 0:n.root,i),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",n==null?void 0:n.header,i),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",n==null?void 0:n.title,i),children:K}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",n==null?void 0:n.description,i),children:T})]}),c(),a(),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("button",{onClick:l,disabled:F,className:chunkAME4HJR4_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${B} ${F?"opacity-70 cursor-not-allowed":""}`,(n==null?void 0:n.primaryButton)||(n==null?void 0:n.exportButton),i),children:F?"Exporting...":`Export as ${S.toUpperCase()}`}),J&&jsxRuntime.jsx("p",{className:"mt-2 text-sm ndpr-text-destructive dark:text-red-500",children:J})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",n==null?void 0:n.complianceNotice,i),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"Export Tips"}),jsxRuntime.jsxs("ul",{className:"ndpr-text-info text-sm list-disc list-inside space-y-1",children:[jsxRuntime.jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsxRuntime.jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsxRuntime.jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsxRuntime.jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),b()]})};exports.a=ye;exports.b=_e;exports.c=Ae;
93
+ </html>`,b},l=()=>chunkRFPLZDIO_js.d(null,null,function*(){R(true),Z(null);try{let e=S.toLowerCase(),u="",b;switch(e){case "pdf":let te=q();b=new Blob([te],{type:"text/html"}),u=URL.createObjectURL(b);break;case "docx":b=new Blob([E],{type:"text/plain"}),u=URL.createObjectURL(b);break;case "html":let pe=q();b=new Blob([pe],{type:"text/html"}),u=URL.createObjectURL(b);break;default:b=new Blob([E],{type:"text/markdown"}),u=URL.createObjectURL(b);break}let z=C(e),O=document.createElement("a");O.href=u,O.download=z,document.body.appendChild(O),O.click(),document.body.removeChild(O);let _={id:`export_${Date.now()}`,format:e,timestamp:Date.now(),url:u,filename:z};$(te=>[_,...te]),V&&V(e,u);}catch(e){console.error("[ndpr-toolkit/policy] Export failed:",e);let u=e instanceof Error&&e.message?e.message.length>200?`${e.message.slice(0,200)}\u2026`:e.message:null;Z(u?`[ndpr-toolkit/policy] Export failed: ${u}`:"[ndpr-toolkit/policy] Export failed \u2014 see the browser console for the underlying error.");}finally{R(false);}}),c=()=>{let e=[{value:"pdf",label:"PDF Document (.pdf)"},{value:"docx",label:"Word Document (.docx)"},{value:"html",label:"Web Page (.html)"},{value:"markdown",label:"Markdown (.md)"}],u=`${s}-export-format`;return jsxRuntime.jsxs("div",{"data-ndpr-component":"policy-exporter",className:chunkAME4HJR4_js.a("mb-6",n==null?void 0:n.formatSelector,o),children:[jsxRuntime.jsx("label",{htmlFor:u,className:"ndpr-form-field__label",children:"Export Format"}),jsxRuntime.jsx("select",{id:u,value:S,onChange:b=>X(b.target.value),className:chunkAME4HJR4_js.a("ndpr-form-field__input",n==null?void 0:n.formatOption,o),children:e.map(b=>jsxRuntime.jsx("option",{value:b.value,children:b.label},b.value))})]})},a=()=>y?jsxRuntime.jsxs("div",{className:"mb-6 space-y-4 border border-gray-200 dark:border-gray-700 rounded-md p-4",children:[jsxRuntime.jsxs("div",{className:"flex justify-between items-center",children:[jsxRuntime.jsx("h3",{className:"text-md font-medium",children:"Advanced Export Options"}),jsxRuntime.jsx("button",{type:"button",onClick:()=>g(false),className:"ndpr-text-primary text-sm",children:"Hide Advanced Options"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-filename`,className:"ndpr-form-field__label",children:"Custom Filename"}),jsxRuntime.jsx("input",{type:"text",id:`${s}-custom-filename`,value:h,onChange:e=>I(e.target.value),placeholder:w(S),"aria-describedby":`${s}-custom-filename-desc`,className:"ndpr-form-field__input"}),jsxRuntime.jsx("p",{id:`${s}-custom-filename-desc`,className:"ndpr-form-field__hint",children:"Leave blank to use the default filename format."})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-header`,className:"ndpr-form-field__label",children:"Custom Header HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:`${s}-custom-header`,value:G,onChange:e=>W(e.target.value),rows:3,placeholder:"<div>Custom header content</div>",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{children:[jsxRuntime.jsx("label",{htmlFor:`${s}-custom-footer`,className:"ndpr-form-field__label",children:"Custom Footer HTML (for HTML/PDF exports)"}),jsxRuntime.jsx("textarea",{id:`${s}-custom-footer`,value:j,onChange:e=>ee(e.target.value),rows:3,placeholder:"<div>Custom footer content</div>",className:"ndpr-form-field__input"})]}),jsxRuntime.jsxs("div",{className:"flex items-start",children:[jsxRuntime.jsx("div",{className:"flex items-center h-5",children:jsxRuntime.jsx("input",{id:`${s}-include-compliance-notice`,type:"checkbox",checked:r,onChange:e=>g(e.target.checked),"aria-describedby":`${s}-compliance-notice-desc`,className:"w-4 h-4 text-[rgb(var(--ndpr-primary))] border-gray-300 rounded focus:ring-[rgb(var(--ndpr-ring))] dark:focus:ring-[rgb(var(--ndpr-ring))] dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800 focus:ring-2 dark:bg-gray-700 dark:border-gray-600"})}),jsxRuntime.jsxs("div",{className:"ml-3 text-sm",children:[jsxRuntime.jsx("label",{htmlFor:`${s}-include-compliance-notice`,className:"font-medium ndpr-text-foreground",children:"Include NDPA Compliance Notice"}),jsxRuntime.jsx("p",{id:`${s}-compliance-notice-desc`,className:"ndpr-card__subtitle",children:"Adds a notice explaining that this policy complies with NDPA requirements."})]})]})]}):jsxRuntime.jsx("button",{type:"button",onClick:()=>g(true),className:"ndpr-text-primary text-sm mb-6",children:"Show Advanced Options"}),f=()=>!N||m.length===0?null:jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mt-6",n==null?void 0:n.preview,o),children:[jsxRuntime.jsx("h3",{className:"text-lg font-medium mb-3",children:"Export History"}),jsxRuntime.jsx("div",{className:"bg-gray-50 dark:bg-gray-700 rounded-md overflow-hidden",children:jsxRuntime.jsxs("table",{className:"min-w-full divide-y divide-gray-200 dark:divide-gray-600",children:[jsxRuntime.jsx("thead",{className:"bg-gray-100 dark:bg-gray-800",children:jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Date"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Format"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Filename"}),jsxRuntime.jsx("th",{scope:"col",className:"px-6 py-3 text-left text-xs font-medium ndpr-text-muted uppercase tracking-wider",children:"Actions"})]})}),jsxRuntime.jsx("tbody",{className:"bg-white dark:bg-gray-700 divide-y divide-gray-200 dark:divide-gray-600",children:m.map(e=>jsxRuntime.jsxs("tr",{children:[jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:new Date(e.timestamp).toLocaleString()}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:e.format.toUpperCase()}),jsxRuntime.jsx("td",{className:"ndpr-table__cell",children:e.filename}),jsxRuntime.jsx("td",{className:"px-6 py-4 whitespace-nowrap text-sm font-medium",children:jsxRuntime.jsx("a",{href:e.url,download:e.filename,className:"ndpr-text-primary hover:text-[rgb(var(--ndpr-primary-hover))] dark:hover:text-[rgb(var(--ndpr-primary-hover))] mr-4",children:"Download"})})]},e.id))})]})})]});return jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a(`bg-white dark:bg-gray-800 p-6 rounded-lg shadow-md ${Q}`,n==null?void 0:n.root,o),children:[jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("mb-6",n==null?void 0:n.header,o),children:[jsxRuntime.jsx("h2",{className:chunkAME4HJR4_js.a("ndpr-section-heading",n==null?void 0:n.title,o),children:K}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-card__subtitle",n==null?void 0:n.description,o),children:T})]}),c(),a(),jsxRuntime.jsxs("div",{className:"mb-6",children:[jsxRuntime.jsx("button",{onClick:l,disabled:A,className:chunkAME4HJR4_js.a(`px-6 py-3 bg-[rgb(var(--ndpr-primary))] text-white rounded-md hover:bg-[rgb(var(--ndpr-primary-hover))] focus:outline-none focus:ring-2 focus:ring-[rgb(var(--ndpr-ring))] focus:ring-offset-2 ${B} ${A?"opacity-70 cursor-not-allowed":""}`,(n==null?void 0:n.primaryButton)||(n==null?void 0:n.exportButton),o),children:A?"Exporting...":`Export as ${S.toUpperCase()}`}),J&&jsxRuntime.jsx("p",{className:"mt-2 text-sm ndpr-text-destructive dark:text-red-500",children:J})]}),jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-alert ndpr-alert--info",n==null?void 0:n.complianceNotice,o),children:[jsxRuntime.jsx("h3",{className:"text-sm font-bold ndpr-text-info mb-2",children:"Export Tips"}),jsxRuntime.jsxs("ul",{className:"ndpr-text-info text-sm list-disc list-inside space-y-1",children:[jsxRuntime.jsx("li",{children:"PDF format is recommended for printing or sharing with stakeholders."}),jsxRuntime.jsx("li",{children:"HTML format is ideal for publishing on your website."}),jsxRuntime.jsx("li",{children:"DOCX format allows for further editing in Microsoft Word or similar applications."}),jsxRuntime.jsx("li",{children:"Markdown format is useful for version control systems or technical documentation."})]})]}),f()]})};exports.a=ye;exports.b=Ee;exports.c=Fe;
package/dist/consent.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- 'use strict';var chunkSJDDNB6M_js=require('./chunk-SJDDNB6M.js'),chunkBRS52EDT_js=require('./chunk-BRS52EDT.js'),chunkD3DVVJCT_js=require('./chunk-D3DVVJCT.js'),chunk3IA3KDII_js=require('./chunk-3IA3KDII.js'),chunkP4LNLCSF_js=require('./chunk-P4LNLCSF.js');require('./chunk-L2VO3MEJ.js'),require('./chunk-7ZZO7GVB.js');var chunkB46SJB5V_js=require('./chunk-B46SJB5V.js');require('./chunk-NDKDKDDX.js'),require('./chunk-WKTKTLMF.js');var chunkAME4HJR4_js=require('./chunk-AME4HJR4.js');require('./chunk-VWED6UTN.js');var chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var v=react.createContext(null);function p(){let t=react.useContext(v);if(!t)throw new Error("Consent compound components must be wrapped in <Consent.Provider>. Example: <Consent.Provider options={...}><Consent.Banner /></Consent.Provider>");return t}var g=({options:t,adapter:n,version:s,onChange:r,children:c})=>{let C=chunkP4LNLCSF_js.a({options:t,adapter:n,version:s,onChange:r}),o=chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},C),{options:t});return jsxRuntime.jsx(v.Provider,{value:o,children:c})};var P=({classNames:t,unstyled:n})=>{let{options:s,settings:r}=p(),[c,C]=react.useState(()=>{let o={};return s.forEach(i=>{var a,_;o[i.id]=(_=(a=r==null?void 0:r.consents[i.id])!=null?a:i.defaultValue)!=null?_:false;}),o});return jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__options-list",t==null?void 0:t.root,n),"data-ndpr-component":"consent-option-list",children:s.map(o=>jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__option",t==null?void 0:t.optionItem,n),children:[jsxRuntime.jsx("input",{id:`consent-${o.id}`,type:"checkbox",checked:c[o.id]||false,onChange:i=>C(a=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},a),{[o.id]:i.target.checked})),disabled:o.required,className:chunkAME4HJR4_js.a("ndpr-consent-banner__option-checkbox",t==null?void 0:t.optionCheckbox,n),"aria-label":o.label}),jsxRuntime.jsxs("div",{className:n?"":"ndpr-consent-banner__option-text",children:[jsxRuntime.jsxs("label",{htmlFor:`consent-${o.id}`,className:chunkAME4HJR4_js.a("ndpr-consent-banner__option-label",t==null?void 0:t.optionLabel,n),children:[o.label,o.required&&jsxRuntime.jsx("span",{className:n?"":"ndpr-consent-banner__required-marker",children:" *"})]}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__option-description",t==null?void 0:t.optionDescription,n),children:o.description})]})]},o.id))})};var R=({children:t,className:n,unstyled:s})=>{let{acceptAll:r}=p();return jsxRuntime.jsx("button",{onClick:r,className:chunkAME4HJR4_js.a("ndpr-consent-banner__button ndpr-consent-banner__button--primary",n,s),"data-ndpr-component":"consent-accept-button",children:t!=null?t:"Accept All"})};var S=({children:t,className:n,unstyled:s})=>{let{rejectAll:r}=p();return jsxRuntime.jsx("button",{onClick:r,className:chunkAME4HJR4_js.a("ndpr-consent-banner__button ndpr-consent-banner__button--secondary",n,s),"data-ndpr-component":"consent-reject-button",children:t!=null?t:"Reject All"})};var y=({children:t,className:n,unstyled:s,consents:r})=>{let{updateConsent:c,options:C}=p();return jsxRuntime.jsx("button",{onClick:()=>{if(r)c(r);else {let i={};C.forEach(a=>{i[a.id]=a.required||false;}),c(i);}},className:chunkAME4HJR4_js.a("ndpr-consent-banner__button ndpr-consent-banner__button--primary",n,s),"data-ndpr-component":"consent-save-button",children:t!=null?t:"Save Preferences"})};var I={Provider:g,OptionList:P,AcceptButton:R,RejectButton:S,SaveButton:y,Banner:chunkD3DVVJCT_js.a,Settings:chunkBRS52EDT_js.a,Storage:chunkSJDDNB6M_js.a};Object.defineProperty(exports,"ConsentStorage",{enumerable:true,get:function(){return chunkSJDDNB6M_js.a}});Object.defineProperty(exports,"ConsentManager",{enumerable:true,get:function(){return chunkBRS52EDT_js.a}});Object.defineProperty(exports,"ConsentBanner",{enumerable:true,get:function(){return chunkD3DVVJCT_js.a}});Object.defineProperty(exports,"appendAuditEntry",{enumerable:true,get:function(){return chunk3IA3KDII_js.c}});Object.defineProperty(exports,"createAuditEntry",{enumerable:true,get:function(){return chunk3IA3KDII_js.a}});Object.defineProperty(exports,"getAuditLog",{enumerable:true,get:function(){return chunk3IA3KDII_js.b}});Object.defineProperty(exports,"useConsent",{enumerable:true,get:function(){return chunkP4LNLCSF_js.a}});Object.defineProperty(exports,"validateConsent",{enumerable:true,get:function(){return chunkB46SJB5V_js.a}});Object.defineProperty(exports,"validateConsentOptions",{enumerable:true,get:function(){return chunkB46SJB5V_js.b}});Object.defineProperty(exports,"resolveClass",{enumerable:true,get:function(){return chunkAME4HJR4_js.a}});exports.Consent=I;exports.ConsentAcceptButton=R;exports.ConsentOptionList=P;exports.ConsentProvider=g;exports.ConsentRejectButton=S;exports.ConsentSaveButton=y;exports.useConsentCompound=p;
2
+ 'use strict';var chunkSJDDNB6M_js=require('./chunk-SJDDNB6M.js'),chunk73BMSK67_js=require('./chunk-73BMSK67.js'),chunkD3DVVJCT_js=require('./chunk-D3DVVJCT.js'),chunk3IA3KDII_js=require('./chunk-3IA3KDII.js'),chunkH3IULCE3_js=require('./chunk-H3IULCE3.js');require('./chunk-L2VO3MEJ.js'),require('./chunk-C2KEXHRX.js');var chunkB46SJB5V_js=require('./chunk-B46SJB5V.js');require('./chunk-NDKDKDDX.js'),require('./chunk-WKTKTLMF.js');var chunkAME4HJR4_js=require('./chunk-AME4HJR4.js');require('./chunk-VWED6UTN.js');var chunkRFPLZDIO_js=require('./chunk-RFPLZDIO.js'),react=require('react'),jsxRuntime=require('react/jsx-runtime');var v=react.createContext(null);function p(){let t=react.useContext(v);if(!t)throw new Error("Consent compound components must be wrapped in <Consent.Provider>. Example: <Consent.Provider options={...}><Consent.Banner /></Consent.Provider>");return t}var g=({options:t,adapter:n,version:s,onChange:r,children:c})=>{let C=chunkH3IULCE3_js.a({options:t,adapter:n,version:s,onChange:r}),o=chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},C),{options:t});return jsxRuntime.jsx(v.Provider,{value:o,children:c})};var P=({classNames:t,unstyled:n})=>{let{options:s,settings:r}=p(),[c,C]=react.useState(()=>{let o={};return s.forEach(i=>{var a,_;o[i.id]=(_=(a=r==null?void 0:r.consents[i.id])!=null?a:i.defaultValue)!=null?_:false;}),o});return jsxRuntime.jsx("div",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__options-list",t==null?void 0:t.root,n),"data-ndpr-component":"consent-option-list",children:s.map(o=>jsxRuntime.jsxs("div",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__option",t==null?void 0:t.optionItem,n),children:[jsxRuntime.jsx("input",{id:`consent-${o.id}`,type:"checkbox",checked:c[o.id]||false,onChange:i=>C(a=>chunkRFPLZDIO_js.b(chunkRFPLZDIO_js.a({},a),{[o.id]:i.target.checked})),disabled:o.required,className:chunkAME4HJR4_js.a("ndpr-consent-banner__option-checkbox",t==null?void 0:t.optionCheckbox,n),"aria-label":o.label}),jsxRuntime.jsxs("div",{className:n?"":"ndpr-consent-banner__option-text",children:[jsxRuntime.jsxs("label",{htmlFor:`consent-${o.id}`,className:chunkAME4HJR4_js.a("ndpr-consent-banner__option-label",t==null?void 0:t.optionLabel,n),children:[o.label,o.required&&jsxRuntime.jsx("span",{className:n?"":"ndpr-consent-banner__required-marker",children:" *"})]}),jsxRuntime.jsx("p",{className:chunkAME4HJR4_js.a("ndpr-consent-banner__option-description",t==null?void 0:t.optionDescription,n),children:o.description})]})]},o.id))})};var R=({children:t,className:n,unstyled:s})=>{let{acceptAll:r}=p();return jsxRuntime.jsx("button",{onClick:r,className:chunkAME4HJR4_js.a("ndpr-consent-banner__button ndpr-consent-banner__button--primary",n,s),"data-ndpr-component":"consent-accept-button",children:t!=null?t:"Accept All"})};var S=({children:t,className:n,unstyled:s})=>{let{rejectAll:r}=p();return jsxRuntime.jsx("button",{onClick:r,className:chunkAME4HJR4_js.a("ndpr-consent-banner__button ndpr-consent-banner__button--secondary",n,s),"data-ndpr-component":"consent-reject-button",children:t!=null?t:"Reject All"})};var y=({children:t,className:n,unstyled:s,consents:r})=>{let{updateConsent:c,options:C}=p();return jsxRuntime.jsx("button",{onClick:()=>{if(r)c(r);else {let i={};C.forEach(a=>{i[a.id]=a.required||false;}),c(i);}},className:chunkAME4HJR4_js.a("ndpr-consent-banner__button ndpr-consent-banner__button--primary",n,s),"data-ndpr-component":"consent-save-button",children:t!=null?t:"Save Preferences"})};var I={Provider:g,OptionList:P,AcceptButton:R,RejectButton:S,SaveButton:y,Banner:chunkD3DVVJCT_js.a,Settings:chunk73BMSK67_js.a,Storage:chunkSJDDNB6M_js.a};Object.defineProperty(exports,"ConsentStorage",{enumerable:true,get:function(){return chunkSJDDNB6M_js.a}});Object.defineProperty(exports,"ConsentManager",{enumerable:true,get:function(){return chunk73BMSK67_js.a}});Object.defineProperty(exports,"ConsentBanner",{enumerable:true,get:function(){return chunkD3DVVJCT_js.a}});Object.defineProperty(exports,"appendAuditEntry",{enumerable:true,get:function(){return chunk3IA3KDII_js.c}});Object.defineProperty(exports,"createAuditEntry",{enumerable:true,get:function(){return chunk3IA3KDII_js.a}});Object.defineProperty(exports,"getAuditLog",{enumerable:true,get:function(){return chunk3IA3KDII_js.b}});Object.defineProperty(exports,"useConsent",{enumerable:true,get:function(){return chunkH3IULCE3_js.a}});Object.defineProperty(exports,"validateConsent",{enumerable:true,get:function(){return chunkB46SJB5V_js.a}});Object.defineProperty(exports,"validateConsentOptions",{enumerable:true,get:function(){return chunkB46SJB5V_js.b}});Object.defineProperty(exports,"resolveClass",{enumerable:true,get:function(){return chunkAME4HJR4_js.a}});exports.Consent=I;exports.ConsentAcceptButton=R;exports.ConsentOptionList=P;exports.ConsentProvider=g;exports.ConsentRejectButton=S;exports.ConsentSaveButton=y;exports.useConsentCompound=p;
package/dist/consent.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import {a}from'./chunk-XOH4WXOZ.mjs';export{a as ConsentStorage}from'./chunk-XOH4WXOZ.mjs';import {a as a$1}from'./chunk-U5RWJRGA.mjs';export{a as ConsentManager}from'./chunk-U5RWJRGA.mjs';import {a as a$2}from'./chunk-WYH3OA5L.mjs';export{a as ConsentBanner}from'./chunk-WYH3OA5L.mjs';export{c as appendAuditEntry,a as createAuditEntry,b as getAuditLog}from'./chunk-V7UFP6QU.mjs';import {a as a$3}from'./chunk-PCU6GKBE.mjs';export{a as useConsent}from'./chunk-PCU6GKBE.mjs';import'./chunk-YTU4FNM2.mjs';import'./chunk-UASG46LP.mjs';export{a as validateConsent,b as validateConsentOptions}from'./chunk-PJNKQPQP.mjs';import'./chunk-25TNTLHJ.mjs';import'./chunk-RBMLGRDN.mjs';import {a as a$5}from'./chunk-SFGW37LE.mjs';export{a as resolveClass}from'./chunk-SFGW37LE.mjs';import'./chunk-DBZSN4WP.mjs';import {b,a as a$4}from'./chunk-ZJYULEER.mjs';import {createContext,useContext,useState}from'react';import {jsx,jsxs}from'react/jsx-runtime';var v=createContext(null);function p(){let t=useContext(v);if(!t)throw new Error("Consent compound components must be wrapped in <Consent.Provider>. Example: <Consent.Provider options={...}><Consent.Banner /></Consent.Provider>");return t}var g=({options:t,adapter:n,version:s,onChange:r,children:c})=>{let C=a$3({options:t,adapter:n,version:s,onChange:r}),o=b(a$4({},C),{options:t});return jsx(v.Provider,{value:o,children:c})};var P=({classNames:t,unstyled:n})=>{let{options:s,settings:r}=p(),[c,C]=useState(()=>{let o={};return s.forEach(i=>{var a,_;o[i.id]=(_=(a=r==null?void 0:r.consents[i.id])!=null?a:i.defaultValue)!=null?_:false;}),o});return jsx("div",{className:a$5("ndpr-consent-banner__options-list",t==null?void 0:t.root,n),"data-ndpr-component":"consent-option-list",children:s.map(o=>jsxs("div",{className:a$5("ndpr-consent-banner__option",t==null?void 0:t.optionItem,n),children:[jsx("input",{id:`consent-${o.id}`,type:"checkbox",checked:c[o.id]||false,onChange:i=>C(a=>b(a$4({},a),{[o.id]:i.target.checked})),disabled:o.required,className:a$5("ndpr-consent-banner__option-checkbox",t==null?void 0:t.optionCheckbox,n),"aria-label":o.label}),jsxs("div",{className:n?"":"ndpr-consent-banner__option-text",children:[jsxs("label",{htmlFor:`consent-${o.id}`,className:a$5("ndpr-consent-banner__option-label",t==null?void 0:t.optionLabel,n),children:[o.label,o.required&&jsx("span",{className:n?"":"ndpr-consent-banner__required-marker",children:" *"})]}),jsx("p",{className:a$5("ndpr-consent-banner__option-description",t==null?void 0:t.optionDescription,n),children:o.description})]})]},o.id))})};var R=({children:t,className:n,unstyled:s})=>{let{acceptAll:r}=p();return jsx("button",{onClick:r,className:a$5("ndpr-consent-banner__button ndpr-consent-banner__button--primary",n,s),"data-ndpr-component":"consent-accept-button",children:t!=null?t:"Accept All"})};var S=({children:t,className:n,unstyled:s})=>{let{rejectAll:r}=p();return jsx("button",{onClick:r,className:a$5("ndpr-consent-banner__button ndpr-consent-banner__button--secondary",n,s),"data-ndpr-component":"consent-reject-button",children:t!=null?t:"Reject All"})};var y=({children:t,className:n,unstyled:s,consents:r})=>{let{updateConsent:c,options:C}=p();return jsx("button",{onClick:()=>{if(r)c(r);else {let i={};C.forEach(a=>{i[a.id]=a.required||false;}),c(i);}},className:a$5("ndpr-consent-banner__button ndpr-consent-banner__button--primary",n,s),"data-ndpr-component":"consent-save-button",children:t!=null?t:"Save Preferences"})};var I={Provider:g,OptionList:P,AcceptButton:R,RejectButton:S,SaveButton:y,Banner:a$2,Settings:a$1,Storage:a};export{I as Consent,R as ConsentAcceptButton,P as ConsentOptionList,g as ConsentProvider,S as ConsentRejectButton,y as ConsentSaveButton,p as useConsentCompound};
2
+ import {a}from'./chunk-XOH4WXOZ.mjs';export{a as ConsentStorage}from'./chunk-XOH4WXOZ.mjs';import {a as a$1}from'./chunk-G7JKRYM5.mjs';export{a as ConsentManager}from'./chunk-G7JKRYM5.mjs';import {a as a$2}from'./chunk-WYH3OA5L.mjs';export{a as ConsentBanner}from'./chunk-WYH3OA5L.mjs';export{c as appendAuditEntry,a as createAuditEntry,b as getAuditLog}from'./chunk-V7UFP6QU.mjs';import {a as a$3}from'./chunk-TAHSSITO.mjs';export{a as useConsent}from'./chunk-TAHSSITO.mjs';import'./chunk-YTU4FNM2.mjs';import'./chunk-XC3DLYEG.mjs';export{a as validateConsent,b as validateConsentOptions}from'./chunk-PJNKQPQP.mjs';import'./chunk-25TNTLHJ.mjs';import'./chunk-RBMLGRDN.mjs';import {a as a$5}from'./chunk-SFGW37LE.mjs';export{a as resolveClass}from'./chunk-SFGW37LE.mjs';import'./chunk-DBZSN4WP.mjs';import {b,a as a$4}from'./chunk-ZJYULEER.mjs';import {createContext,useContext,useState}from'react';import {jsx,jsxs}from'react/jsx-runtime';var v=createContext(null);function p(){let t=useContext(v);if(!t)throw new Error("Consent compound components must be wrapped in <Consent.Provider>. Example: <Consent.Provider options={...}><Consent.Banner /></Consent.Provider>");return t}var g=({options:t,adapter:n,version:s,onChange:r,children:c})=>{let C=a$3({options:t,adapter:n,version:s,onChange:r}),o=b(a$4({},C),{options:t});return jsx(v.Provider,{value:o,children:c})};var P=({classNames:t,unstyled:n})=>{let{options:s,settings:r}=p(),[c,C]=useState(()=>{let o={};return s.forEach(i=>{var a,_;o[i.id]=(_=(a=r==null?void 0:r.consents[i.id])!=null?a:i.defaultValue)!=null?_:false;}),o});return jsx("div",{className:a$5("ndpr-consent-banner__options-list",t==null?void 0:t.root,n),"data-ndpr-component":"consent-option-list",children:s.map(o=>jsxs("div",{className:a$5("ndpr-consent-banner__option",t==null?void 0:t.optionItem,n),children:[jsx("input",{id:`consent-${o.id}`,type:"checkbox",checked:c[o.id]||false,onChange:i=>C(a=>b(a$4({},a),{[o.id]:i.target.checked})),disabled:o.required,className:a$5("ndpr-consent-banner__option-checkbox",t==null?void 0:t.optionCheckbox,n),"aria-label":o.label}),jsxs("div",{className:n?"":"ndpr-consent-banner__option-text",children:[jsxs("label",{htmlFor:`consent-${o.id}`,className:a$5("ndpr-consent-banner__option-label",t==null?void 0:t.optionLabel,n),children:[o.label,o.required&&jsx("span",{className:n?"":"ndpr-consent-banner__required-marker",children:" *"})]}),jsx("p",{className:a$5("ndpr-consent-banner__option-description",t==null?void 0:t.optionDescription,n),children:o.description})]})]},o.id))})};var R=({children:t,className:n,unstyled:s})=>{let{acceptAll:r}=p();return jsx("button",{onClick:r,className:a$5("ndpr-consent-banner__button ndpr-consent-banner__button--primary",n,s),"data-ndpr-component":"consent-accept-button",children:t!=null?t:"Accept All"})};var S=({children:t,className:n,unstyled:s})=>{let{rejectAll:r}=p();return jsx("button",{onClick:r,className:a$5("ndpr-consent-banner__button ndpr-consent-banner__button--secondary",n,s),"data-ndpr-component":"consent-reject-button",children:t!=null?t:"Reject All"})};var y=({children:t,className:n,unstyled:s,consents:r})=>{let{updateConsent:c,options:C}=p();return jsx("button",{onClick:()=>{if(r)c(r);else {let i={};C.forEach(a=>{i[a.id]=a.required||false;}),c(i);}},className:a$5("ndpr-consent-banner__button ndpr-consent-banner__button--primary",n,s),"data-ndpr-component":"consent-save-button",children:t!=null?t:"Save Preferences"})};var I={Provider:g,OptionList:P,AcceptButton:R,RejectButton:S,SaveButton:y,Banner:a$2,Settings:a$1,Storage:a};export{I as Consent,R as ConsentAcceptButton,P as ConsentOptionList,g as ConsentProvider,S as ConsentRejectButton,y as ConsentSaveButton,p as useConsentCompound};
package/dist/headless.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- 'use strict';require('./chunk-OZCNFB5C.js');var chunkCNM6G5IA_js=require('./chunk-CNM6G5IA.js'),chunkVJTQXVAF_js=require('./chunk-VJTQXVAF.js'),chunkRC3XFXTJ_js=require('./chunk-RC3XFXTJ.js'),chunkQHW4UKGJ_js=require('./chunk-QHW4UKGJ.js'),chunkUTFBKL73_js=require('./chunk-UTFBKL73.js'),chunkHHK5LHEG_js=require('./chunk-HHK5LHEG.js'),chunk3JPDTXGC_js=require('./chunk-3JPDTXGC.js');require('./chunk-JS7SYL5P.js'),require('./chunk-RDALAH3Y.js'),require('./chunk-3YTAOT5O.js'),require('./chunk-D2ZKDQVL.js'),require('./chunk-6LJHLE6G.js'),require('./chunk-YFBDJ4FH.js'),require('./chunk-WZYCBW2R.js'),require('./chunk-4CVBQC66.js');var chunkP4LNLCSF_js=require('./chunk-P4LNLCSF.js'),chunkL2VO3MEJ_js=require('./chunk-L2VO3MEJ.js');require('./chunk-7ZZO7GVB.js'),require('./chunk-B46SJB5V.js');var chunkHBLGN4SD_js=require('./chunk-HBLGN4SD.js');require('./chunk-L2BRFMVS.js');var chunkC7IDR2IV_js=require('./chunk-C7IDR2IV.js');require('./chunk-TQZWJGJ2.js'),require('./chunk-ZVOIR4QH.js'),require('./chunk-VWED6UTN.js'),require('./chunk-RFPLZDIO.js');Object.defineProperty(exports,"useComplianceScore",{enumerable:true,get:function(){return chunkCNM6G5IA_js.a}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkVJTQXVAF_js.a}});Object.defineProperty(exports,"useDefaultPrivacyPolicy",{enumerable:true,get:function(){return chunkRC3XFXTJ_js.b}});Object.defineProperty(exports,"usePrivacyPolicy",{enumerable:true,get:function(){return chunkRC3XFXTJ_js.a}});Object.defineProperty(exports,"useAdaptivePolicyWizard",{enumerable:true,get:function(){return chunkQHW4UKGJ_js.a}});Object.defineProperty(exports,"useLawfulBasis",{enumerable:true,get:function(){return chunkUTFBKL73_js.a}});Object.defineProperty(exports,"useCrossBorderTransfer",{enumerable:true,get:function(){return chunkHHK5LHEG_js.a}});Object.defineProperty(exports,"useROPA",{enumerable:true,get:function(){return chunk3JPDTXGC_js.a}});Object.defineProperty(exports,"useConsent",{enumerable:true,get:function(){return chunkP4LNLCSF_js.a}});Object.defineProperty(exports,"useFocusTrap",{enumerable:true,get:function(){return chunkL2VO3MEJ_js.a}});Object.defineProperty(exports,"useDSR",{enumerable:true,get:function(){return chunkHBLGN4SD_js.a}});Object.defineProperty(exports,"useDPIA",{enumerable:true,get:function(){return chunkC7IDR2IV_js.a}});
2
+ 'use strict';require('./chunk-OZCNFB5C.js');var chunkCNM6G5IA_js=require('./chunk-CNM6G5IA.js'),chunkVJTQXVAF_js=require('./chunk-VJTQXVAF.js'),chunkRC3XFXTJ_js=require('./chunk-RC3XFXTJ.js'),chunkQHW4UKGJ_js=require('./chunk-QHW4UKGJ.js'),chunkUTFBKL73_js=require('./chunk-UTFBKL73.js'),chunkHHK5LHEG_js=require('./chunk-HHK5LHEG.js'),chunk3JPDTXGC_js=require('./chunk-3JPDTXGC.js');require('./chunk-JS7SYL5P.js'),require('./chunk-RDALAH3Y.js'),require('./chunk-3YTAOT5O.js'),require('./chunk-D2ZKDQVL.js'),require('./chunk-6LJHLE6G.js'),require('./chunk-YFBDJ4FH.js'),require('./chunk-WZYCBW2R.js'),require('./chunk-4CVBQC66.js');var chunkH3IULCE3_js=require('./chunk-H3IULCE3.js'),chunkL2VO3MEJ_js=require('./chunk-L2VO3MEJ.js');require('./chunk-C2KEXHRX.js'),require('./chunk-B46SJB5V.js');var chunkHBLGN4SD_js=require('./chunk-HBLGN4SD.js');require('./chunk-L2BRFMVS.js');var chunkC7IDR2IV_js=require('./chunk-C7IDR2IV.js');require('./chunk-TQZWJGJ2.js'),require('./chunk-ZVOIR4QH.js'),require('./chunk-VWED6UTN.js'),require('./chunk-RFPLZDIO.js');Object.defineProperty(exports,"useComplianceScore",{enumerable:true,get:function(){return chunkCNM6G5IA_js.a}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkVJTQXVAF_js.a}});Object.defineProperty(exports,"useDefaultPrivacyPolicy",{enumerable:true,get:function(){return chunkRC3XFXTJ_js.b}});Object.defineProperty(exports,"usePrivacyPolicy",{enumerable:true,get:function(){return chunkRC3XFXTJ_js.a}});Object.defineProperty(exports,"useAdaptivePolicyWizard",{enumerable:true,get:function(){return chunkQHW4UKGJ_js.a}});Object.defineProperty(exports,"useLawfulBasis",{enumerable:true,get:function(){return chunkUTFBKL73_js.a}});Object.defineProperty(exports,"useCrossBorderTransfer",{enumerable:true,get:function(){return chunkHHK5LHEG_js.a}});Object.defineProperty(exports,"useROPA",{enumerable:true,get:function(){return chunk3JPDTXGC_js.a}});Object.defineProperty(exports,"useConsent",{enumerable:true,get:function(){return chunkH3IULCE3_js.a}});Object.defineProperty(exports,"useFocusTrap",{enumerable:true,get:function(){return chunkL2VO3MEJ_js.a}});Object.defineProperty(exports,"useDSR",{enumerable:true,get:function(){return chunkHBLGN4SD_js.a}});Object.defineProperty(exports,"useDPIA",{enumerable:true,get:function(){return chunkC7IDR2IV_js.a}});
package/dist/headless.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import'./chunk-GQYBS3A7.mjs';export{a as useComplianceScore}from'./chunk-MOHBL6LX.mjs';export{a as useBreach}from'./chunk-3HOXQNCH.mjs';export{b as useDefaultPrivacyPolicy,a as usePrivacyPolicy}from'./chunk-UVXS7KRV.mjs';export{a as useAdaptivePolicyWizard}from'./chunk-KE2FZH2V.mjs';export{a as useLawfulBasis}from'./chunk-4G3SRVRI.mjs';export{a as useCrossBorderTransfer}from'./chunk-KDAZQO3N.mjs';export{a as useROPA}from'./chunk-RPXRPGHL.mjs';import'./chunk-IVSNHT24.mjs';import'./chunk-7RBO42IW.mjs';import'./chunk-WTGKZX7J.mjs';import'./chunk-NBQQ2GN3.mjs';import'./chunk-BIJSMSUU.mjs';import'./chunk-7BJXI2HI.mjs';import'./chunk-LWIKDDSU.mjs';import'./chunk-XP5PL6K7.mjs';export{a as useConsent}from'./chunk-PCU6GKBE.mjs';export{a as useFocusTrap}from'./chunk-YTU4FNM2.mjs';import'./chunk-UASG46LP.mjs';import'./chunk-PJNKQPQP.mjs';export{a as useDSR}from'./chunk-MPBPAEZC.mjs';import'./chunk-RZ6GC6WN.mjs';export{a as useDPIA}from'./chunk-H3XJV2IR.mjs';import'./chunk-LRRENTT5.mjs';import'./chunk-ITCY2Z66.mjs';import'./chunk-DBZSN4WP.mjs';import'./chunk-ZJYULEER.mjs';
2
+ import'./chunk-GQYBS3A7.mjs';export{a as useComplianceScore}from'./chunk-MOHBL6LX.mjs';export{a as useBreach}from'./chunk-3HOXQNCH.mjs';export{b as useDefaultPrivacyPolicy,a as usePrivacyPolicy}from'./chunk-UVXS7KRV.mjs';export{a as useAdaptivePolicyWizard}from'./chunk-KE2FZH2V.mjs';export{a as useLawfulBasis}from'./chunk-4G3SRVRI.mjs';export{a as useCrossBorderTransfer}from'./chunk-KDAZQO3N.mjs';export{a as useROPA}from'./chunk-RPXRPGHL.mjs';import'./chunk-IVSNHT24.mjs';import'./chunk-7RBO42IW.mjs';import'./chunk-WTGKZX7J.mjs';import'./chunk-NBQQ2GN3.mjs';import'./chunk-BIJSMSUU.mjs';import'./chunk-7BJXI2HI.mjs';import'./chunk-LWIKDDSU.mjs';import'./chunk-XP5PL6K7.mjs';export{a as useConsent}from'./chunk-TAHSSITO.mjs';export{a as useFocusTrap}from'./chunk-YTU4FNM2.mjs';import'./chunk-XC3DLYEG.mjs';import'./chunk-PJNKQPQP.mjs';export{a as useDSR}from'./chunk-MPBPAEZC.mjs';import'./chunk-RZ6GC6WN.mjs';export{a as useDPIA}from'./chunk-H3XJV2IR.mjs';import'./chunk-LRRENTT5.mjs';import'./chunk-ITCY2Z66.mjs';import'./chunk-DBZSN4WP.mjs';import'./chunk-ZJYULEER.mjs';
package/dist/hooks.js CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- 'use strict';require('./chunk-OZCNFB5C.js');var chunkCNM6G5IA_js=require('./chunk-CNM6G5IA.js'),chunkVJTQXVAF_js=require('./chunk-VJTQXVAF.js'),chunkRC3XFXTJ_js=require('./chunk-RC3XFXTJ.js'),chunkQHW4UKGJ_js=require('./chunk-QHW4UKGJ.js'),chunkUTFBKL73_js=require('./chunk-UTFBKL73.js'),chunkHHK5LHEG_js=require('./chunk-HHK5LHEG.js'),chunk3JPDTXGC_js=require('./chunk-3JPDTXGC.js');require('./chunk-JS7SYL5P.js'),require('./chunk-RDALAH3Y.js'),require('./chunk-3YTAOT5O.js'),require('./chunk-D2ZKDQVL.js'),require('./chunk-6LJHLE6G.js'),require('./chunk-YFBDJ4FH.js'),require('./chunk-WZYCBW2R.js'),require('./chunk-4CVBQC66.js');var chunkP4LNLCSF_js=require('./chunk-P4LNLCSF.js'),chunkL2VO3MEJ_js=require('./chunk-L2VO3MEJ.js');require('./chunk-7ZZO7GVB.js'),require('./chunk-B46SJB5V.js');var chunkHBLGN4SD_js=require('./chunk-HBLGN4SD.js');require('./chunk-L2BRFMVS.js');var chunkC7IDR2IV_js=require('./chunk-C7IDR2IV.js');require('./chunk-TQZWJGJ2.js'),require('./chunk-ZVOIR4QH.js'),require('./chunk-VWED6UTN.js'),require('./chunk-RFPLZDIO.js');Object.defineProperty(exports,"useComplianceScore",{enumerable:true,get:function(){return chunkCNM6G5IA_js.a}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkVJTQXVAF_js.a}});Object.defineProperty(exports,"useDefaultPrivacyPolicy",{enumerable:true,get:function(){return chunkRC3XFXTJ_js.b}});Object.defineProperty(exports,"usePrivacyPolicy",{enumerable:true,get:function(){return chunkRC3XFXTJ_js.a}});Object.defineProperty(exports,"useAdaptivePolicyWizard",{enumerable:true,get:function(){return chunkQHW4UKGJ_js.a}});Object.defineProperty(exports,"useLawfulBasis",{enumerable:true,get:function(){return chunkUTFBKL73_js.a}});Object.defineProperty(exports,"useCrossBorderTransfer",{enumerable:true,get:function(){return chunkHHK5LHEG_js.a}});Object.defineProperty(exports,"useROPA",{enumerable:true,get:function(){return chunk3JPDTXGC_js.a}});Object.defineProperty(exports,"useConsent",{enumerable:true,get:function(){return chunkP4LNLCSF_js.a}});Object.defineProperty(exports,"useFocusTrap",{enumerable:true,get:function(){return chunkL2VO3MEJ_js.a}});Object.defineProperty(exports,"useDSR",{enumerable:true,get:function(){return chunkHBLGN4SD_js.a}});Object.defineProperty(exports,"useDPIA",{enumerable:true,get:function(){return chunkC7IDR2IV_js.a}});
2
+ 'use strict';require('./chunk-OZCNFB5C.js');var chunkCNM6G5IA_js=require('./chunk-CNM6G5IA.js'),chunkVJTQXVAF_js=require('./chunk-VJTQXVAF.js'),chunkRC3XFXTJ_js=require('./chunk-RC3XFXTJ.js'),chunkQHW4UKGJ_js=require('./chunk-QHW4UKGJ.js'),chunkUTFBKL73_js=require('./chunk-UTFBKL73.js'),chunkHHK5LHEG_js=require('./chunk-HHK5LHEG.js'),chunk3JPDTXGC_js=require('./chunk-3JPDTXGC.js');require('./chunk-JS7SYL5P.js'),require('./chunk-RDALAH3Y.js'),require('./chunk-3YTAOT5O.js'),require('./chunk-D2ZKDQVL.js'),require('./chunk-6LJHLE6G.js'),require('./chunk-YFBDJ4FH.js'),require('./chunk-WZYCBW2R.js'),require('./chunk-4CVBQC66.js');var chunkH3IULCE3_js=require('./chunk-H3IULCE3.js'),chunkL2VO3MEJ_js=require('./chunk-L2VO3MEJ.js');require('./chunk-C2KEXHRX.js'),require('./chunk-B46SJB5V.js');var chunkHBLGN4SD_js=require('./chunk-HBLGN4SD.js');require('./chunk-L2BRFMVS.js');var chunkC7IDR2IV_js=require('./chunk-C7IDR2IV.js');require('./chunk-TQZWJGJ2.js'),require('./chunk-ZVOIR4QH.js'),require('./chunk-VWED6UTN.js'),require('./chunk-RFPLZDIO.js');Object.defineProperty(exports,"useComplianceScore",{enumerable:true,get:function(){return chunkCNM6G5IA_js.a}});Object.defineProperty(exports,"useBreach",{enumerable:true,get:function(){return chunkVJTQXVAF_js.a}});Object.defineProperty(exports,"useDefaultPrivacyPolicy",{enumerable:true,get:function(){return chunkRC3XFXTJ_js.b}});Object.defineProperty(exports,"usePrivacyPolicy",{enumerable:true,get:function(){return chunkRC3XFXTJ_js.a}});Object.defineProperty(exports,"useAdaptivePolicyWizard",{enumerable:true,get:function(){return chunkQHW4UKGJ_js.a}});Object.defineProperty(exports,"useLawfulBasis",{enumerable:true,get:function(){return chunkUTFBKL73_js.a}});Object.defineProperty(exports,"useCrossBorderTransfer",{enumerable:true,get:function(){return chunkHHK5LHEG_js.a}});Object.defineProperty(exports,"useROPA",{enumerable:true,get:function(){return chunk3JPDTXGC_js.a}});Object.defineProperty(exports,"useConsent",{enumerable:true,get:function(){return chunkH3IULCE3_js.a}});Object.defineProperty(exports,"useFocusTrap",{enumerable:true,get:function(){return chunkL2VO3MEJ_js.a}});Object.defineProperty(exports,"useDSR",{enumerable:true,get:function(){return chunkHBLGN4SD_js.a}});Object.defineProperty(exports,"useDPIA",{enumerable:true,get:function(){return chunkC7IDR2IV_js.a}});
package/dist/hooks.mjs CHANGED
@@ -1,2 +1,2 @@
1
1
  "use client";
2
- import'./chunk-GQYBS3A7.mjs';export{a as useComplianceScore}from'./chunk-MOHBL6LX.mjs';export{a as useBreach}from'./chunk-3HOXQNCH.mjs';export{b as useDefaultPrivacyPolicy,a as usePrivacyPolicy}from'./chunk-UVXS7KRV.mjs';export{a as useAdaptivePolicyWizard}from'./chunk-KE2FZH2V.mjs';export{a as useLawfulBasis}from'./chunk-4G3SRVRI.mjs';export{a as useCrossBorderTransfer}from'./chunk-KDAZQO3N.mjs';export{a as useROPA}from'./chunk-RPXRPGHL.mjs';import'./chunk-IVSNHT24.mjs';import'./chunk-7RBO42IW.mjs';import'./chunk-WTGKZX7J.mjs';import'./chunk-NBQQ2GN3.mjs';import'./chunk-BIJSMSUU.mjs';import'./chunk-7BJXI2HI.mjs';import'./chunk-LWIKDDSU.mjs';import'./chunk-XP5PL6K7.mjs';export{a as useConsent}from'./chunk-PCU6GKBE.mjs';export{a as useFocusTrap}from'./chunk-YTU4FNM2.mjs';import'./chunk-UASG46LP.mjs';import'./chunk-PJNKQPQP.mjs';export{a as useDSR}from'./chunk-MPBPAEZC.mjs';import'./chunk-RZ6GC6WN.mjs';export{a as useDPIA}from'./chunk-H3XJV2IR.mjs';import'./chunk-LRRENTT5.mjs';import'./chunk-ITCY2Z66.mjs';import'./chunk-DBZSN4WP.mjs';import'./chunk-ZJYULEER.mjs';
2
+ import'./chunk-GQYBS3A7.mjs';export{a as useComplianceScore}from'./chunk-MOHBL6LX.mjs';export{a as useBreach}from'./chunk-3HOXQNCH.mjs';export{b as useDefaultPrivacyPolicy,a as usePrivacyPolicy}from'./chunk-UVXS7KRV.mjs';export{a as useAdaptivePolicyWizard}from'./chunk-KE2FZH2V.mjs';export{a as useLawfulBasis}from'./chunk-4G3SRVRI.mjs';export{a as useCrossBorderTransfer}from'./chunk-KDAZQO3N.mjs';export{a as useROPA}from'./chunk-RPXRPGHL.mjs';import'./chunk-IVSNHT24.mjs';import'./chunk-7RBO42IW.mjs';import'./chunk-WTGKZX7J.mjs';import'./chunk-NBQQ2GN3.mjs';import'./chunk-BIJSMSUU.mjs';import'./chunk-7BJXI2HI.mjs';import'./chunk-LWIKDDSU.mjs';import'./chunk-XP5PL6K7.mjs';export{a as useConsent}from'./chunk-TAHSSITO.mjs';export{a as useFocusTrap}from'./chunk-YTU4FNM2.mjs';import'./chunk-XC3DLYEG.mjs';import'./chunk-PJNKQPQP.mjs';export{a as useDSR}from'./chunk-MPBPAEZC.mjs';import'./chunk-RZ6GC6WN.mjs';export{a as useDPIA}from'./chunk-H3XJV2IR.mjs';import'./chunk-LRRENTT5.mjs';import'./chunk-ITCY2Z66.mjs';import'./chunk-DBZSN4WP.mjs';import'./chunk-ZJYULEER.mjs';