@citiwave/im-disclaimer-modal
Version:
A customizable React disclaimer modal component with theme support
57 lines (53 loc) • 23.5 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("react"),We=require("lucide-react");var fe={exports:{}},B={};/**
* @license React
* react-jsx-runtime.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ae;function jr(){if(Ae)return B;Ae=1;var i=T,c=Symbol.for("react.element"),f=Symbol.for("react.fragment"),b=Object.prototype.hasOwnProperty,j=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,g={key:!0,ref:!0,__self:!0,__source:!0};function C(w,u,R){var d,E={},_=null,P=null;R!==void 0&&(_=""+R),u.key!==void 0&&(_=""+u.key),u.ref!==void 0&&(P=u.ref);for(d in u)b.call(u,d)&&!g.hasOwnProperty(d)&&(E[d]=u[d]);if(w&&w.defaultProps)for(d in u=w.defaultProps,u)E[d]===void 0&&(E[d]=u[d]);return{$$typeof:c,type:w,key:_,ref:P,props:E,_owner:j.current}}return B.Fragment=f,B.jsx=C,B.jsxs=C,B}var J={};/**
* @license React
* react-jsx-runtime.development.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/var Ie;function Er(){return Ie||(Ie=1,process.env.NODE_ENV!=="production"&&function(){var i=T,c=Symbol.for("react.element"),f=Symbol.for("react.portal"),b=Symbol.for("react.fragment"),j=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),C=Symbol.for("react.provider"),w=Symbol.for("react.context"),u=Symbol.for("react.forward_ref"),R=Symbol.for("react.suspense"),d=Symbol.for("react.suspense_list"),E=Symbol.for("react.memo"),_=Symbol.for("react.lazy"),P=Symbol.for("react.offscreen"),Y=Symbol.iterator,F="@@iterator";function X(e){if(e===null||typeof e!="object")return null;var r=Y&&e[Y]||e[F];return typeof r=="function"?r:null}var A=i.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function x(e){{for(var r=arguments.length,t=new Array(r>1?r-1:0),n=1;n<r;n++)t[n-1]=arguments[n];$("error",e,t)}}function $(e,r,t){{var n=A.ReactDebugCurrentFrame,l=n.getStackAddendum();l!==""&&(r+="%s",t=t.concat([l]));var v=t.map(function(s){return String(s)});v.unshift("Warning: "+r),Function.prototype.apply.call(console[e],console,v)}}var Z=!1,Q=!1,h=!1,p=!1,O=!1,de;de=Symbol.for("react.module.reference");function Je(e){return!!(typeof e=="string"||typeof e=="function"||e===b||e===g||O||e===j||e===R||e===d||p||e===P||Z||Q||h||typeof e=="object"&&e!==null&&(e.$$typeof===_||e.$$typeof===E||e.$$typeof===C||e.$$typeof===w||e.$$typeof===u||e.$$typeof===de||e.getModuleId!==void 0))}function ze(e,r,t){var n=e.displayName;if(n)return n;var l=r.displayName||r.name||"";return l!==""?t+"("+l+")":t}function ve(e){return e.displayName||"Context"}function N(e){if(e==null)return null;if(typeof e.tag=="number"&&x("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof e=="function")return e.displayName||e.name||null;if(typeof e=="string")return e;switch(e){case b:return"Fragment";case f:return"Portal";case g:return"Profiler";case j:return"StrictMode";case R:return"Suspense";case d:return"SuspenseList"}if(typeof e=="object")switch(e.$$typeof){case w:var r=e;return ve(r)+".Consumer";case C:var t=e;return ve(t._context)+".Provider";case u:return ze(e,e.render,"ForwardRef");case E:var n=e.displayName||null;return n!==null?n:N(e.type)||"Memo";case _:{var l=e,v=l._payload,s=l._init;try{return N(s(v))}catch{return null}}}return null}var I=Object.assign,U=0,pe,be,he,me,ge,ye,xe;function je(){}je.__reactDisabledLog=!0;function Ke(){{if(U===0){pe=console.log,be=console.info,he=console.warn,me=console.error,ge=console.group,ye=console.groupCollapsed,xe=console.groupEnd;var e={configurable:!0,enumerable:!0,value:je,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}U++}}function Ge(){{if(U--,U===0){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:I({},e,{value:pe}),info:I({},e,{value:be}),warn:I({},e,{value:he}),error:I({},e,{value:me}),group:I({},e,{value:ge}),groupCollapsed:I({},e,{value:ye}),groupEnd:I({},e,{value:xe})})}U<0&&x("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var ee=A.ReactCurrentDispatcher,re;function z(e,r,t){{if(re===void 0)try{throw Error()}catch(l){var n=l.stack.trim().match(/\n( *(at )?)/);re=n&&n[1]||""}return`
`+re+e}}var te=!1,K;{var He=typeof WeakMap=="function"?WeakMap:Map;K=new He}function Ee(e,r){if(!e||te)return"";{var t=K.get(e);if(t!==void 0)return t}var n;te=!0;var l=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var v;v=ee.current,ee.current=null,Ke();try{if(r){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(s,[])}catch(k){n=k}Reflect.construct(e,[],s)}else{try{s.call()}catch(k){n=k}e.call(s.prototype)}}else{try{throw Error()}catch(k){n=k}e()}}catch(k){if(k&&n&&typeof k.stack=="string"){for(var o=k.stack.split(`
`),S=n.stack.split(`
`),m=o.length-1,y=S.length-1;m>=1&&y>=0&&o[m]!==S[y];)y--;for(;m>=1&&y>=0;m--,y--)if(o[m]!==S[y]){if(m!==1||y!==1)do if(m--,y--,y<0||o[m]!==S[y]){var D=`
`+o[m].replace(" at new "," at ");return e.displayName&&D.includes("<anonymous>")&&(D=D.replace("<anonymous>",e.displayName)),typeof e=="function"&&K.set(e,D),D}while(m>=1&&y>=0);break}}}finally{te=!1,ee.current=v,Ge(),Error.prepareStackTrace=l}var L=e?e.displayName||e.name:"",W=L?z(L):"";return typeof e=="function"&&K.set(e,W),W}function Xe(e,r,t){return Ee(e,!1)}function Ze(e){var r=e.prototype;return!!(r&&r.isReactComponent)}function G(e,r,t){if(e==null)return"";if(typeof e=="function")return Ee(e,Ze(e));if(typeof e=="string")return z(e);switch(e){case R:return z("Suspense");case d:return z("SuspenseList")}if(typeof e=="object")switch(e.$$typeof){case u:return Xe(e.render);case E:return G(e.type,r,t);case _:{var n=e,l=n._payload,v=n._init;try{return G(v(l),r,t)}catch{}}}return""}var V=Object.prototype.hasOwnProperty,Re={},_e=A.ReactDebugCurrentFrame;function H(e){if(e){var r=e._owner,t=G(e.type,e._source,r?r.type:null);_e.setExtraStackFrame(t)}else _e.setExtraStackFrame(null)}function Qe(e,r,t,n,l){{var v=Function.call.bind(V);for(var s in e)if(v(e,s)){var o=void 0;try{if(typeof e[s]!="function"){var S=Error((n||"React class")+": "+t+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw S.name="Invariant Violation",S}o=e[s](r,s,n,t,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(m){o=m}o&&!(o instanceof Error)&&(H(l),x("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",n||"React class",t,s,typeof o),H(null)),o instanceof Error&&!(o.message in Re)&&(Re[o.message]=!0,H(l),x("Failed %s type: %s",t,o.message),H(null))}}}var er=Array.isArray;function ae(e){return er(e)}function rr(e){{var r=typeof Symbol=="function"&&Symbol.toStringTag,t=r&&e[Symbol.toStringTag]||e.constructor.name||"Object";return t}}function tr(e){try{return we(e),!1}catch{return!0}}function we(e){return""+e}function Te(e){if(tr(e))return x("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",rr(e)),we(e)}var q=A.ReactCurrentOwner,ar={key:!0,ref:!0,__self:!0,__source:!0},Se,ke,ne;ne={};function nr(e){if(V.call(e,"ref")){var r=Object.getOwnPropertyDescriptor(e,"ref").get;if(r&&r.isReactWarning)return!1}return e.ref!==void 0}function ir(e){if(V.call(e,"key")){var r=Object.getOwnPropertyDescriptor(e,"key").get;if(r&&r.isReactWarning)return!1}return e.key!==void 0}function or(e,r){if(typeof e.ref=="string"&&q.current&&r&&q.current.stateNode!==r){var t=N(q.current.type);ne[t]||(x('Component "%s" contains the string ref "%s". Support for string refs will be removed in a future major release. This case cannot be automatically converted to an arrow function. We ask you to manually fix this case by using useRef() or createRef() instead. Learn more about using refs safely here: https://reactjs.org/link/strict-mode-string-ref',N(q.current.type),e.ref),ne[t]=!0)}}function sr(e,r){{var t=function(){Se||(Se=!0,x("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"key",{get:t,configurable:!0})}}function lr(e,r){{var t=function(){ke||(ke=!0,x("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",r))};t.isReactWarning=!0,Object.defineProperty(e,"ref",{get:t,configurable:!0})}}var cr=function(e,r,t,n,l,v,s){var o={$$typeof:c,type:e,key:r,ref:t,props:s,_owner:v};return o._store={},Object.defineProperty(o._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(o,"_self",{configurable:!1,enumerable:!1,writable:!1,value:n}),Object.defineProperty(o,"_source",{configurable:!1,enumerable:!1,writable:!1,value:l}),Object.freeze&&(Object.freeze(o.props),Object.freeze(o)),o};function ur(e,r,t,n,l){{var v,s={},o=null,S=null;t!==void 0&&(Te(t),o=""+t),ir(r)&&(Te(r.key),o=""+r.key),nr(r)&&(S=r.ref,or(r,l));for(v in r)V.call(r,v)&&!ar.hasOwnProperty(v)&&(s[v]=r[v]);if(e&&e.defaultProps){var m=e.defaultProps;for(v in m)s[v]===void 0&&(s[v]=m[v])}if(o||S){var y=typeof e=="function"?e.displayName||e.name||"Unknown":e;o&&sr(s,y),S&&lr(s,y)}return cr(e,o,S,l,n,q.current,s)}}var ie=A.ReactCurrentOwner,Ce=A.ReactDebugCurrentFrame;function M(e){if(e){var r=e._owner,t=G(e.type,e._source,r?r.type:null);Ce.setExtraStackFrame(t)}else Ce.setExtraStackFrame(null)}var oe;oe=!1;function se(e){return typeof e=="object"&&e!==null&&e.$$typeof===c}function Oe(){{if(ie.current){var e=N(ie.current.type);if(e)return`
Check the render method of \``+e+"`."}return""}}function fr(e){{if(e!==void 0){var r=e.fileName.replace(/^.*[\\\/]/,""),t=e.lineNumber;return`
Check your code at `+r+":"+t+"."}return""}}var Pe={};function dr(e){{var r=Oe();if(!r){var t=typeof e=="string"?e:e.displayName||e.name;t&&(r=`
Check the top-level render call using <`+t+">.")}return r}}function De(e,r){{if(!e._store||e._store.validated||e.key!=null)return;e._store.validated=!0;var t=dr(r);if(Pe[t])return;Pe[t]=!0;var n="";e&&e._owner&&e._owner!==ie.current&&(n=" It was passed a child from "+N(e._owner.type)+"."),M(e),x('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',t,n),M(null)}}function $e(e,r){{if(typeof e!="object")return;if(ae(e))for(var t=0;t<e.length;t++){var n=e[t];se(n)&&De(n,r)}else if(se(e))e._store&&(e._store.validated=!0);else if(e){var l=X(e);if(typeof l=="function"&&l!==e.entries)for(var v=l.call(e),s;!(s=v.next()).done;)se(s.value)&&De(s.value,r)}}}function vr(e){{var r=e.type;if(r==null||typeof r=="string")return;var t;if(typeof r=="function")t=r.propTypes;else if(typeof r=="object"&&(r.$$typeof===u||r.$$typeof===E))t=r.propTypes;else return;if(t){var n=N(r);Qe(t,e.props,"prop",n,e)}else if(r.PropTypes!==void 0&&!oe){oe=!0;var l=N(r);x("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",l||"Unknown")}typeof r.getDefaultProps=="function"&&!r.getDefaultProps.isReactClassApproved&&x("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function pr(e){{for(var r=Object.keys(e.props),t=0;t<r.length;t++){var n=r[t];if(n!=="children"&&n!=="key"){M(e),x("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",n),M(null);break}}e.ref!==null&&(M(e),x("Invalid attribute `ref` supplied to `React.Fragment`."),M(null))}}var Ne={};function Fe(e,r,t,n,l,v){{var s=Je(e);if(!s){var o="";(e===void 0||typeof e=="object"&&e!==null&&Object.keys(e).length===0)&&(o+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var S=fr(l);S?o+=S:o+=Oe();var m;e===null?m="null":ae(e)?m="array":e!==void 0&&e.$$typeof===c?(m="<"+(N(e.type)||"Unknown")+" />",o=" Did you accidentally export a JSX literal instead of a component?"):m=typeof e,x("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",m,o)}var y=ur(e,r,t,l,v);if(y==null)return y;if(s){var D=r.children;if(D!==void 0)if(n)if(ae(D)){for(var L=0;L<D.length;L++)$e(D[L],e);Object.freeze&&Object.freeze(D)}else x("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else $e(D,e)}if(V.call(r,"key")){var W=N(e),k=Object.keys(r).filter(function(xr){return xr!=="key"}),le=k.length>0?"{key: someKey, "+k.join(": ..., ")+": ...}":"{key: someKey}";if(!Ne[W+le]){var yr=k.length>0?"{"+k.join(": ..., ")+": ...}":"{}";x(`A props object containing a "key" prop is being spread into JSX:
let props = %s;
<%s {...props} />
React keys must be passed directly to JSX without using spread:
let props = %s;
<%s key={someKey} {...props} />`,le,W,yr,W),Ne[W+le]=!0}}return e===b?pr(y):vr(y),y}}function br(e,r,t){return Fe(e,r,t,!0)}function hr(e,r,t){return Fe(e,r,t,!1)}var mr=hr,gr=br;J.Fragment=b,J.jsx=mr,J.jsxs=gr}()),J}process.env.NODE_ENV==="production"?fe.exports=jr():fe.exports=Er();var a=fe.exports;const Ye=i=>({title:i==="dark"?"text-white":"!text-gray-900",heading:i==="dark"?"text-white":"!text-gray-900",text:i==="dark"?"text-gray-200":"!text-gray-900"}),Rr=(i,c)=>{const f=Ye(c),b=f.text;return a.jsxs("div",{className:`mb-6 ${f.text}`,children:[a.jsx("h4",{className:`text-lg font-semibold mb-2 ${f.heading}`,children:i.heading}),a.jsx("p",{className:`mb-3 ${b}`,children:i.text}),i.list&&a.jsx("ul",{className:`list-disc pl-5 space-y-1 ${b}`,children:i.list.map((j,g)=>a.jsx("li",{className:b,children:j},g))})]},i.heading)},Me=(i,c="dark")=>{if(!i)return null;const f=Ye(c);return a.jsxs("div",{className:"space-y-6",children:[a.jsx("h3",{className:`text-xl font-bold mb-6 ${f.title}`,children:i.title}),i.sections.map(b=>Rr(b,c))]})},Le=i=>({dark:{modal:"bg-gray-900 text-white",header:"border-gray-800 bg-gray-900/95 backdrop-blur-sm",tabBorder:"border-gray-800",activeTab:"text-blue-400 border-blue-400",inactiveTab:"text-gray-400 border-transparent hover:text-blue-400/80",completedTab:"text-emerald-400",content:"prose-invert",footer:"border-gray-800 bg-gray-900/95 backdrop-blur-sm",checkbox:{base:"border-gray-600 group-hover:border-blue-400",checked:"bg-blue-500 border-blue-500",disabled:"opacity-50 cursor-not-allowed"},text:{enabled:"text-gray-200",disabled:"text-gray-500"}},light:{modal:"bg-white text-gray-900",header:"border-gray-200 bg-white/95 backdrop-blur-sm",tabBorder:"border-gray-200",activeTab:"text-blue-600 border-blue-600",inactiveTab:"text-gray-500 border-transparent hover:text-blue-600/80",completedTab:"text-emerald-600",content:"prose-base",footer:"border-gray-200 bg-white/95 backdrop-blur-sm",checkbox:{base:"border-gray-300 group-hover:border-blue-500",checked:"bg-blue-600 border-blue-600",disabled:"opacity-50 cursor-not-allowed"},text:{enabled:"text-gray-900",disabled:"text-gray-500"}}})[i],_r=({content:i,onScroll:c,onAgree:f,isActive:b,isScrolled:j,isAgreed:g,sectionTitle:C,theme:w})=>{const u=T.useRef(null),R=Le(w);return T.useEffect(()=>{const d=()=>{if(!u.current)return;const{scrollHeight:_,scrollTop:P,clientHeight:Y}=u.current;_-P-Y<20&&!j&&c(!0)},E=u.current;if(E)return E.addEventListener("scroll",d),d(),()=>E.removeEventListener("scroll",d)},[c,j]),b?a.jsxs("div",{className:"flex flex-col p-4",children:[a.jsx("div",{ref:u,className:`
overflow-y-auto prose max-w-none mb-4 p-4 rounded-lg
${R.content}
${w==="light"?"border border-gray-200 bg-white shadow-sm":"border border-gray-700 bg-gray-800 shadow-sm"}
max-h-[calc(60vh-4rem)]
`,children:i}),a.jsxs("label",{className:"flex items-center group cursor-pointer select-none",children:[a.jsxs("div",{className:"relative",children:[a.jsx("input",{type:"checkbox",className:"sr-only",checked:g,onChange:f,disabled:!j}),a.jsx("div",{className:`
w-5 h-5 border-2 rounded transition-all duration-200
${j?R.checkbox.base:R.checkbox.disabled}
${g?R.checkbox.checked:""}
`}),g&&a.jsx(We.Check,{className:"absolute top-0.5 left-0.5 w-4 h-4 text-white"})]}),a.jsxs("span",{className:`ml-3 ${j?R.text.enabled:R.text.disabled}`,children:["I have read and agree to the ",C]})]})]}):null},ce="im-disclaimer-accepted",wr=({isOpen:i,onClose:c,title:f,disclaimerContent:b,disclaimerSections:j,theme:g="dark",customTheme:C,setAllAgreed:w,onAllSectionsAgreed:u,accentColor:R})=>{const d=b?Object.entries(b).map(([h,p])=>({title:p.title,required:p.required,content:Me(p.content,g)})):j||[],[E,_]=T.useState(0),[P,Y]=T.useState(new Array(d.length).fill(!1)),[F,X]=T.useState(new Array(d.length).fill(!1)),[A,x]=T.useState(i),$=C||Le(g);T.useEffect(()=>{const h=localStorage.getItem(ce);h&&new Set(JSON.parse(h)).has(f)&&x(!1)},[f]);const Z=()=>{const h=localStorage.getItem(ce),p=h?new Set(JSON.parse(h)):new Set;p.add(f),localStorage.setItem(ce,JSON.stringify(Array.from(p))),x(!1),c==null||c()};if(T.useEffect(()=>{const h=d.filter(p=>p.required).every((p,O)=>F[O]);w==null||w(h),u==null||u(h)},[d,F,u]),!A)return null;const Q=d.filter(h=>h.required).every((h,p)=>F[p]);return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"fixed inset-0 z-40",children:a.jsx("div",{className:"absolute inset-0 bg-black/40 backdrop-blur-md transition-all duration-300"})}),a.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-4",children:a.jsxs("div",{className:`
w-full max-w-4xl rounded-xl shadow-2xl overflow-hidden
flex flex-col
${$.modal}
transform transition-all duration-200 ease-out
border border-gray-200/10
`,children:[a.jsx("div",{className:`sticky top-0 z-10 px-6 py-4 border-b flex items-center ${$.header}`,children:a.jsx("h2",{className:"text-2xl font-bold text-gray-900 dark:text-white mb-4",children:f})}),a.jsx("div",{className:`sticky top-[4.5rem] z-10 flex border-b ${$.tabBorder} bg-inherit`,children:d.map((h,p)=>{const O=F[p]?"completed":P[p]?"scrolled":"pending";return a.jsxs("button",{onClick:()=>_(p),className:`
flex items-center gap-2 px-6 py-3 text-sm font-medium border-b-2 -mb-[2px]
transition-all duration-200
${E===p?$.activeTab:O==="completed"?$.completedTab:$.inactiveTab}
`,children:[O==="completed"?a.jsx(We.Check,{className:"w-4 h-4"}):a.jsx("div",{className:`w-2 h-2 rounded-full ${O==="scrolled"?"bg-current":"bg-current opacity-40"}`}),h.title,h.required&&a.jsx("span",{className:"text-red-500",children:"*"})]},h.title)})}),a.jsx("div",{className:`flex-1 overflow-y-auto ${$.content}`,children:d.map((h,p)=>a.jsx(_r,{content:h.content,onScroll:()=>{const O=[...P];O[p]=!0,Y(O)},onAgree:()=>{const O=[...F];O[p]=!0,X(O)},isActive:E===p,isScrolled:P[p],isAgreed:F[p],sectionTitle:h.title,theme:g},h.title))}),a.jsx("div",{className:`sticky bottom-0 flex justify-end gap-4 px-6 py-4 border-t ${$.footer}`,children:a.jsx("button",{onClick:Z,disabled:!Q,style:{backgroundColor:R},className:`
px-6 py-2 rounded-lg font-medium
disabled:opacity-50 disabled:cursor-not-allowed
transition-all duration-200
`,children:"Accept All"})})]})})]})},Ue=wr,ue={get:i=>{if(typeof window>"u")return null;try{return localStorage.getItem(i)}catch(c){return console.warn("Failed to access localStorage:",c),null}},set:(i,c)=>{if(!(typeof window>"u"))try{localStorage.setItem(i,c)}catch(f){console.warn("Failed to write to localStorage:",f)}},remove:i=>{if(!(typeof window>"u"))try{localStorage.removeItem(i)}catch(c){console.warn("Failed to remove from localStorage:",c)}}},Ve=(i,c={})=>{const{storagePrefix:f="disclaimer",defaultOpen:b=!0}=c,[j,g]=T.useState(!1),[C,w]=T.useState(!1),[u,R]=T.useState(!1);T.useEffect(()=>{w(!0);const _=`${f}_${i}`,P=ue.get(_)==="true";g(!P&&b)},[i,f,b]);const d=T.useCallback(()=>{if(u){const _=`${f}_${i}`;ue.set(_,"true"),g(!1)}},[u,i,f]),E=T.useCallback(()=>{const _=`${f}_${i}`;ue.remove(_),g(!0)},[i,f]);return C?{isOpen:j,onClose:d,reset:E,setAllSectionsAgreed:R}:{isOpen:!1,onClose:()=>{},reset:()=>{},setAllSectionsAgreed:()=>{}}},Tr=({id:i,title:c,disclaimerSections:f,theme:b="light",storagePrefix:j="disclaimer"})=>{const{isOpen:g,onClose:C}=Ve(i,{storagePrefix:j,defaultOpen:!0});return a.jsx(Ue,{isOpen:g,onClose:C,title:c,disclaimerSections:f,theme:b})},Sr=Tr,qe=()=>a.jsxs(a.Fragment,{children:[a.jsx("h3",{children:"Terms of Use"}),a.jsx("p",{children:"Please read these terms carefully. By accessing or using this service, you agree to be bound by these terms and conditions."}),a.jsx("h4",{children:"1. Service Overview"}),a.jsx("p",{children:"This section describes the service and its primary functions. Replace this content with your specific service description."}),a.jsx("h4",{children:"2. User Responsibilities"}),a.jsx("p",{children:"As a user of this service, you are responsible for:"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Maintaining the confidentiality of your account"}),a.jsx("li",{children:"Providing accurate and truthful information"}),a.jsx("li",{children:"Complying with all applicable regulations"}),a.jsx("li",{children:"Protecting privacy and confidentiality"})]})]}),Be=()=>a.jsxs(a.Fragment,{children:[a.jsx("h3",{children:"Privacy Policy"}),a.jsx("p",{children:"This Privacy Policy describes how we collect, use, and handle your information."}),a.jsx("h4",{children:"1. Information Collection"}),a.jsx("p",{children:"We collect information that you provide directly to us, including:"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Account information"}),a.jsx("li",{children:"Usage data"}),a.jsx("li",{children:"Communication preferences"})]}),a.jsx("h4",{children:"2. Data Usage"}),a.jsx("p",{children:"We use collected information to:"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Provide and maintain our services"}),a.jsx("li",{children:"Improve user experience"}),a.jsx("li",{children:"Send important notifications"})]})]}),kr={terms:{id:"terms",title:"Terms & Conditions",content:a.jsx(qe,{})},privacy:{id:"privacy",title:"Privacy Policy",content:a.jsx(Be,{})}};exports.DisclaimerModal=Ue;exports.DisclaimerProvider=Sr;exports.PrivacyTemplate=Be;exports.TermsTemplate=qe;exports.exampleDisclaimers=kr;exports.renderDisclaimerContent=Me;exports.useDisclaimer=Ve;
//# sourceMappingURL=index.cjs.js.map