react-cookie-consent-popup 1.0.2 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +13 -1
- package/dist/index.js +1 -15
- package/dist/index.mjs +1 -0
- package/package.json +16 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mas Joobeh
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
# react-cookie-consent-popup
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/react-cookie-consent-popup)
|
|
4
|
+
[](https://bundlephobia.com/package/react-cookie-consent-popup)
|
|
5
|
+
[](https://github.com/Mas-HJ/react-cookie-consent-popup/blob/main/LICENSE)
|
|
6
|
+
|
|
3
7
|
A React cookie consent popup component with a centered modal dialog. Supports service management, script loading, cookie/localStorage/sessionStorage cleanup, hash-based consent invalidation, a settings modal with toggles, and light/dark themes.
|
|
4
8
|
|
|
5
|
-
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
### Live Demo
|
|
12
|
+
|
|
13
|
+
> **Try it out instantly!**
|
|
14
|
+
>
|
|
15
|
+
> [](https://codesandbox.io/p/sandbox/github/Mas-HJ/react-cookie-consent-popup/tree/main?file=/demo/src/App.tsx)
|
|
16
|
+
|
|
17
|
+
---
|
|
6
18
|
|
|
7
19
|
## Installation
|
|
8
20
|
|
package/dist/index.js
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
"use strict";var _t=Object.create;var ue=Object.defineProperty;var Ct=Object.getOwnPropertyDescriptor;var St=Object.getOwnPropertyNames;var Et=Object.getPrototypeOf,It=Object.prototype.hasOwnProperty;var ne=(i,a)=>()=>(a||i((a={exports:{}}).exports,a),a.exports),xt=(i,a)=>{for(var l in a)ue(i,l,{get:a[l],enumerable:!0})},Te=(i,a,l,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let g of St(a))!It.call(i,g)&&g!==l&&ue(i,g,{get:()=>a[g],enumerable:!(d=Ct(a,g))||d.enumerable});return i};var Le=(i,a,l)=>(l=i!=null?_t(Et(i)):{},Te(a||!i||!i.__esModule?ue(l,"default",{value:i,enumerable:!0}):l,i)),kt=i=>Te(ue({},"__esModule",{value:!0}),i);var Me=ne((un,pe)=>{(function(){"use strict";var i={}.hasOwnProperty;function a(){for(var g="",A=0;A<arguments.length;A++){var k=arguments[A];k&&(g=d(g,l(k)))}return g}function l(g){if(typeof g=="string"||typeof g=="number")return g;if(typeof g!="object")return"";if(Array.isArray(g))return a.apply(null,g);if(g.toString!==Object.prototype.toString&&!g.toString.toString().includes("[native code]"))return g.toString();var A="";for(var k in g)i.call(g,k)&&g[k]&&(A=d(A,k));return A}function d(g,A){return A?g?g+" "+A:g+A:g}typeof pe<"u"&&pe.exports?(a.default=a,pe.exports=a):typeof define=="function"&&typeof define.amd=="object"&&define.amd?define("classnames",[],function(){return a}):window.classNames=a})()});var je=ne((ln,Re)=>{"use strict";var Bt="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";Re.exports=Bt});var Ye=ne((fn,Ve)=>{"use strict";var Nt=je();function Fe(){}function De(){}De.resetWarningCache=Fe;Ve.exports=function(){function i(d,g,A,k,P,O){if(O!==Nt){var R=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw R.name="Invariant Violation",R}}i.isRequired=i;function a(){return i}var l={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:a,element:i,elementType:i,instanceOf:a,node:i,objectOf:a,oneOf:a,oneOfType:a,shape:a,exact:a,checkPropTypes:De,resetWarningCache:Fe};return l.PropTypes=l,l}});var He=ne((hn,qe)=>{qe.exports=Ye()();var dn,pn});var We=ne(_e=>{"use strict";Object.defineProperty(_e,"__esModule",{value:!0});var Tt=require("react"),Xe=Lt(Tt);function Lt(i){return i&&i.__esModule?i:{default:i}}_e.default=function(){return Xe.default.createElement("svg",{width:"14",height:"11",viewBox:"0 0 14 11"},Xe.default.createElement("path",{d:"M11.264 0L5.26 6.004 2.103 2.847 0 4.95l5.26 5.26 8.108-8.107L11.264 0",fill:"#fff",fillRule:"evenodd"}))}});var Je=ne(Ce=>{"use strict";Object.defineProperty(Ce,"__esModule",{value:!0});var Pt=require("react"),$e=Ut(Pt);function Ut(i){return i&&i.__esModule?i:{default:i}}Ce.default=function(){return $e.default.createElement("svg",{width:"10",height:"10",viewBox:"0 0 10 10"},$e.default.createElement("path",{d:"M9.9 2.12L7.78 0 4.95 2.828 2.12 0 0 2.12l2.83 2.83L0 7.776 2.123 9.9 4.95 7.07 7.78 9.9 9.9 7.776 7.072 4.95 9.9 2.12",fill:"#fff",fillRule:"evenodd"}))}});var Ke=ne(Se=>{"use strict";Object.defineProperty(Se,"__esModule",{value:!0});Se.pointerCoord=Ot;function Ot(i){if(i){var a=i.changedTouches;if(a&&a.length>0){var l=a[0];return{x:l.clientX,y:l.clientY}}var d=i.pageX;if(d!==void 0)return{x:d,y:i.pageY}}return{x:0,y:0}}});var Ge=ne(Ie=>{"use strict";Object.defineProperty(Ie,"__esModule",{value:!0});var Mt=Object.assign||function(i){for(var a=1;a<arguments.length;a++){var l=arguments[a];for(var d in l)Object.prototype.hasOwnProperty.call(l,d)&&(i[d]=l[d])}return i},Rt=(function(){function i(a,l){for(var d=0;d<l.length;d++){var g=l[d];g.enumerable=g.enumerable||!1,g.configurable=!0,"value"in g&&(g.writable=!0),Object.defineProperty(a,g.key,g)}}return function(a,l,d){return l&&i(a.prototype,l),d&&i(a,d),a}})(),ze=require("react"),re=ae(ze),jt=Me(),Ft=ae(jt),Dt=He(),W=ae(Dt),Vt=We(),Yt=ae(Vt),qt=Je(),Ht=ae(qt),Ee=Ke();function ae(i){return i&&i.__esModule?i:{default:i}}function Xt(i,a){var l={};for(var d in i)a.indexOf(d)>=0||Object.prototype.hasOwnProperty.call(i,d)&&(l[d]=i[d]);return l}function Wt(i,a){if(!(i instanceof a))throw new TypeError("Cannot call a class as a function")}function $t(i,a){if(!i)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return a&&(typeof a=="object"||typeof a=="function")?a:i}function Jt(i,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function, not "+typeof a);i.prototype=Object.create(a&&a.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),a&&(Object.setPrototypeOf?Object.setPrototypeOf(i,a):i.__proto__=a)}var he=(function(i){Jt(a,i);function a(l){Wt(this,a);var d=$t(this,(a.__proto__||Object.getPrototypeOf(a)).call(this,l));return d.handleClick=d.handleClick.bind(d),d.handleTouchStart=d.handleTouchStart.bind(d),d.handleTouchMove=d.handleTouchMove.bind(d),d.handleTouchEnd=d.handleTouchEnd.bind(d),d.handleFocus=d.handleFocus.bind(d),d.handleBlur=d.handleBlur.bind(d),d.previouslyChecked=!!(l.checked||l.defaultChecked),d.state={checked:!!(l.checked||l.defaultChecked),hasFocus:!1},d}return Rt(a,[{key:"componentDidUpdate",value:function(d){d.checked!==this.props.checked&&this.setState({checked:!!this.props.checked})}},{key:"handleClick",value:function(d){if(!this.props.disabled){var g=this.input;if(d.target!==g&&!this.moved){this.previouslyChecked=g.checked,d.preventDefault(),g.focus(),g.click();return}var A=this.props.hasOwnProperty("checked")?this.props.checked:g.checked;this.setState({checked:A})}}},{key:"handleTouchStart",value:function(d){this.props.disabled||(this.startX=(0,Ee.pointerCoord)(d).x,this.activated=!0)}},{key:"handleTouchMove",value:function(d){if(this.activated&&(this.moved=!0,this.startX)){var g=(0,Ee.pointerCoord)(d).x;this.state.checked&&g+15<this.startX?(this.setState({checked:!1}),this.startX=g,this.activated=!0):g-15>this.startX&&(this.setState({checked:!0}),this.startX=g,this.activated=g<this.startX+5)}}},{key:"handleTouchEnd",value:function(d){if(this.moved){var g=this.input;if(d.preventDefault(),this.startX){var A=(0,Ee.pointerCoord)(d).x;this.previouslyChecked===!0&&this.startX+4>A?this.previouslyChecked!==this.state.checked&&(this.setState({checked:!1}),this.previouslyChecked=this.state.checked,g.click()):this.startX-4<A&&this.previouslyChecked!==this.state.checked&&(this.setState({checked:!0}),this.previouslyChecked=this.state.checked,g.click()),this.activated=!1,this.startX=null,this.moved=!1}}}},{key:"handleFocus",value:function(d){var g=this.props.onFocus;g&&g(d),this.setState({hasFocus:!0})}},{key:"handleBlur",value:function(d){var g=this.props.onBlur;g&&g(d),this.setState({hasFocus:!1})}},{key:"getIcon",value:function(d){var g=this.props.icons;return g?g[d]===void 0?a.defaultProps.icons[d]:g[d]:null}},{key:"render",value:function(){var d=this,g=this.props,A=g.className,k=g.icons,P=Xt(g,["className","icons"]),O=(0,Ft.default)("react-toggle",{"react-toggle--checked":this.state.checked,"react-toggle--focus":this.state.hasFocus,"react-toggle--disabled":this.props.disabled},A);return re.default.createElement("div",{className:O,onClick:this.handleClick,onTouchStart:this.handleTouchStart,onTouchMove:this.handleTouchMove,onTouchEnd:this.handleTouchEnd},re.default.createElement("div",{className:"react-toggle-track"},re.default.createElement("div",{className:"react-toggle-track-check"},this.getIcon("checked")),re.default.createElement("div",{className:"react-toggle-track-x"},this.getIcon("unchecked"))),re.default.createElement("div",{className:"react-toggle-thumb"}),re.default.createElement("input",Mt({},P,{ref:function(V){d.input=V},onFocus:this.handleFocus,onBlur:this.handleBlur,className:"react-toggle-screenreader-only",type:"checkbox"})))}}]),a})(ze.PureComponent);Ie.default=he;he.displayName="Toggle";he.defaultProps={icons:{checked:re.default.createElement(Yt.default,null),unchecked:re.default.createElement(Ht.default,null)}};he.propTypes={checked:W.default.bool,disabled:W.default.bool,defaultChecked:W.default.bool,onChange:W.default.func,onFocus:W.default.func,onBlur:W.default.func,className:W.default.string,name:W.default.string,value:W.default.string,id:W.default.string,"aria-labelledby":W.default.string,"aria-label":W.default.string,icons:W.default.oneOfType([W.default.bool,W.default.shape({checked:W.default.node,unchecked:W.default.node})])}});var rt=ne((tt,nt)=>{(function(i){var a;typeof tt=="object"?nt.exports=i():typeof define=="function"&&define.amd?define(i):(typeof window<"u"?a=window:typeof global<"u"?a=global:typeof self<"u"&&(a=self),a.objectHash=i())})(function(){return(function i(a,l,d){function g(P,O){if(!l[P]){if(!a[P]){var R=typeof require=="function"&&require;if(!O&&R)return R(P,!0);if(A)return A(P,!0);throw new Error("Cannot find module '"+P+"'")}O=l[P]={exports:{}},a[P][0].call(O.exports,function(V){var q=a[P][1][V];return g(q||V)},O,O.exports,i,a,l,d)}return l[P].exports}for(var A=typeof require=="function"&&require,k=0;k<d.length;k++)g(d[k]);return g})({1:[function(i,a,l){(function(d,g,A,k,P,O,R,V,q){"use strict";var _=i("crypto");function x(c,h){h=v(c,h);var n;return(n=h.algorithm!=="passthrough"?_.createHash(h.algorithm):new B).write===void 0&&(n.write=n.update,n.end=n.update),w(h,n).dispatch(c),n.update||n.end(""),n.digest?n.digest(h.encoding==="buffer"?void 0:h.encoding):(c=n.read(),h.encoding!=="buffer"?c.toString(h.encoding):c)}(l=a.exports=x).sha1=function(c){return x(c)},l.keys=function(c){return x(c,{excludeValues:!0,algorithm:"sha1",encoding:"hex"})},l.MD5=function(c){return x(c,{algorithm:"md5",encoding:"hex"})},l.keysMD5=function(c){return x(c,{algorithm:"md5",encoding:"hex",excludeValues:!0})};var p=_.getHashes?_.getHashes().slice():["sha1","md5"],b=(p.push("passthrough"),["buffer","hex","binary","base64"]);function v(c,h){var n={};if(n.algorithm=(h=h||{}).algorithm||"sha1",n.encoding=h.encoding||"hex",n.excludeValues=!!h.excludeValues,n.algorithm=n.algorithm.toLowerCase(),n.encoding=n.encoding.toLowerCase(),n.ignoreUnknown=h.ignoreUnknown===!0,n.respectType=h.respectType!==!1,n.respectFunctionNames=h.respectFunctionNames!==!1,n.respectFunctionProperties=h.respectFunctionProperties!==!1,n.unorderedArrays=h.unorderedArrays===!0,n.unorderedSets=h.unorderedSets!==!1,n.unorderedObjects=h.unorderedObjects!==!1,n.replacer=h.replacer||void 0,n.excludeKeys=h.excludeKeys||void 0,c===void 0)throw new Error("Object argument required.");for(var o=0;o<p.length;++o)p[o].toLowerCase()===n.algorithm.toLowerCase()&&(n.algorithm=p[o]);if(p.indexOf(n.algorithm)===-1)throw new Error('Algorithm "'+n.algorithm+'" not supported. supported values: '+p.join(", "));if(b.indexOf(n.encoding)===-1&&n.algorithm!=="passthrough")throw new Error('Encoding "'+n.encoding+'" not supported. supported values: '+b.join(", "));return n}function C(c){if(typeof c=="function")return/^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(c))!=null}function w(c,h,n){n=n||[];function o(t){return h.update?h.update(t,"utf8"):h.write(t,"utf8")}return{dispatch:function(t){return this["_"+((t=c.replacer?c.replacer(t):t)===null?"null":typeof t)](t)},_object:function(t){var u,f=Object.prototype.toString.call(t),T=/\[object (.*)\]/i.exec(f);if(T=(T=T?T[1]:"unknown:["+f+"]").toLowerCase(),0<=(f=n.indexOf(t)))return this.dispatch("[CIRCULAR:"+f+"]");if(n.push(t),A!==void 0&&A.isBuffer&&A.isBuffer(t))return o("buffer:"),o(t);if(T==="object"||T==="function"||T==="asyncfunction")return f=Object.keys(t),c.unorderedObjects&&(f=f.sort()),c.respectType===!1||C(t)||f.splice(0,0,"prototype","__proto__","constructor"),c.excludeKeys&&(f=f.filter(function(N){return!c.excludeKeys(N)})),o("object:"+f.length+":"),u=this,f.forEach(function(N){u.dispatch(N),o(":"),c.excludeValues||u.dispatch(t[N]),o(",")});if(!this["_"+T]){if(c.ignoreUnknown)return o("["+T+"]");throw new Error('Unknown object type "'+T+'"')}this["_"+T](t)},_array:function(t,N){N=N!==void 0?N:c.unorderedArrays!==!1;var f=this;if(o("array:"+t.length+":"),!N||t.length<=1)return t.forEach(function(L){return f.dispatch(L)});var T=[],N=t.map(function(L){var I=new B,j=n.slice();return w(c,I,j).dispatch(L),T=T.concat(j.slice(n.length)),I.read().toString()});return n=n.concat(T),N.sort(),this._array(N,!1)},_date:function(t){return o("date:"+t.toJSON())},_symbol:function(t){return o("symbol:"+t.toString())},_error:function(t){return o("error:"+t.toString())},_boolean:function(t){return o("bool:"+t.toString())},_string:function(t){o("string:"+t.length+":"),o(t.toString())},_function:function(t){o("fn:"),C(t)?this.dispatch("[native]"):this.dispatch(t.toString()),c.respectFunctionNames!==!1&&this.dispatch("function-name:"+String(t.name)),c.respectFunctionProperties&&this._object(t)},_number:function(t){return o("number:"+t.toString())},_xml:function(t){return o("xml:"+t.toString())},_null:function(){return o("Null")},_undefined:function(){return o("Undefined")},_regexp:function(t){return o("regex:"+t.toString())},_uint8array:function(t){return o("uint8array:"),this.dispatch(Array.prototype.slice.call(t))},_uint8clampedarray:function(t){return o("uint8clampedarray:"),this.dispatch(Array.prototype.slice.call(t))},_int8array:function(t){return o("int8array:"),this.dispatch(Array.prototype.slice.call(t))},_uint16array:function(t){return o("uint16array:"),this.dispatch(Array.prototype.slice.call(t))},_int16array:function(t){return o("int16array:"),this.dispatch(Array.prototype.slice.call(t))},_uint32array:function(t){return o("uint32array:"),this.dispatch(Array.prototype.slice.call(t))},_int32array:function(t){return o("int32array:"),this.dispatch(Array.prototype.slice.call(t))},_float32array:function(t){return o("float32array:"),this.dispatch(Array.prototype.slice.call(t))},_float64array:function(t){return o("float64array:"),this.dispatch(Array.prototype.slice.call(t))},_arraybuffer:function(t){return o("arraybuffer:"),this.dispatch(new Uint8Array(t))},_url:function(t){return o("url:"+t.toString())},_map:function(t){return o("map:"),t=Array.from(t),this._array(t,c.unorderedSets!==!1)},_set:function(t){return o("set:"),t=Array.from(t),this._array(t,c.unorderedSets!==!1)},_file:function(t){return o("file:"),this.dispatch([t.name,t.size,t.type,t.lastModfied])},_blob:function(){if(c.ignoreUnknown)return o("[blob]");throw Error(`Hashing Blob objects is currently not supported
|
|
2
|
-
(see https://github.com/puleos/object-hash/issues/26)
|
|
3
|
-
Use "options.replacer" or "options.ignoreUnknown"
|
|
4
|
-
`)},_domwindow:function(){return o("domwindow")},_bigint:function(t){return o("bigint:"+t.toString())},_process:function(){return o("process")},_timer:function(){return o("timer")},_pipe:function(){return o("pipe")},_tcp:function(){return o("tcp")},_udp:function(){return o("udp")},_tty:function(){return o("tty")},_statwatcher:function(){return o("statwatcher")},_securecontext:function(){return o("securecontext")},_connection:function(){return o("connection")},_zlib:function(){return o("zlib")},_context:function(){return o("context")},_nodescript:function(){return o("nodescript")},_httpparser:function(){return o("httpparser")},_dataview:function(){return o("dataview")},_signal:function(){return o("signal")},_fsevent:function(){return o("fsevent")},_tlswrap:function(){return o("tlswrap")}}}function B(){return{buf:"",write:function(c){this.buf+=c},end:function(c){this.buf+=c},read:function(){return this.buf}}}l.writeToStream=function(c,h,n){return n===void 0&&(n=h,h={}),w(h=v(c,h),n).dispatch(c)}}).call(this,i("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},i("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/fake_9a5aa49d.js","/")},{buffer:3,crypto:5,lYpoI2:11}],2:[function(i,a,l){(function(d,g,A,k,P,O,R,V,q){(function(_){"use strict";var x=typeof Uint8Array<"u"?Uint8Array:Array,p=43,b=47,v=48,C=97,w=65,B=45,c=95;function h(n){return n=n.charCodeAt(0),n===p||n===B?62:n===b||n===c?63:n<v?-1:n<v+10?n-v+26+26:n<w+26?n-w:n<C+26?n-C+26:void 0}_.toByteArray=function(n){var o,t;if(0<n.length%4)throw new Error("Invalid string. Length must be a multiple of 4");var u=n.length,u=n.charAt(u-2)==="="?2:n.charAt(u-1)==="="?1:0,f=new x(3*n.length/4-u),T=0<u?n.length-4:n.length,N=0;function L(I){f[N++]=I}for(o=0;o<T;o+=4,0)L((16711680&(t=h(n.charAt(o))<<18|h(n.charAt(o+1))<<12|h(n.charAt(o+2))<<6|h(n.charAt(o+3))))>>16),L((65280&t)>>8),L(255&t);return u==2?L(255&(t=h(n.charAt(o))<<2|h(n.charAt(o+1))>>4)):u==1&&(L((t=h(n.charAt(o))<<10|h(n.charAt(o+1))<<4|h(n.charAt(o+2))>>2)>>8&255),L(255&t)),f},_.fromByteArray=function(n){var o,t,u,f,T=n.length%3,N="";function L(I){return"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(I)}for(o=0,u=n.length-T;o<u;o+=3)t=(n[o]<<16)+(n[o+1]<<8)+n[o+2],N+=L((f=t)>>18&63)+L(f>>12&63)+L(f>>6&63)+L(63&f);switch(T){case 1:N=(N+=L((t=n[n.length-1])>>2))+L(t<<4&63)+"==";break;case 2:N=(N=(N+=L((t=(n[n.length-2]<<8)+n[n.length-1])>>10))+L(t>>4&63))+L(t<<2&63)+"="}return N}})(l===void 0?this.base64js={}:l)}).call(this,i("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},i("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js","/node_modules/gulp-browserify/node_modules/base64-js/lib")},{buffer:3,lYpoI2:11}],3:[function(i,a,l){(function(d,g,p,k,P,O,R,V,q){var _=i("base64-js"),x=i("ieee754");function p(e,r,s){if(!(this instanceof p))return new p(e,r,s);var y,m,E,U,D=typeof e;if(r==="base64"&&D=="string")for(e=(U=e).trim?U.trim():U.replace(/^\s+|\s+$/g,"");e.length%4!=0;)e+="=";if(D=="number")y=$(e);else if(D=="string")y=p.byteLength(e,r);else{if(D!="object")throw new Error("First argument needs to be a number, array or string.");y=$(e.length)}if(p._useTypedArrays?m=p._augment(new Uint8Array(y)):((m=this).length=y,m._isBuffer=!0),p._useTypedArrays&&typeof e.byteLength=="number")m._set(e);else if(F(U=e)||p.isBuffer(U)||U&&typeof U=="object"&&typeof U.length=="number")for(E=0;E<y;E++)p.isBuffer(e)?m[E]=e.readUInt8(E):m[E]=e[E];else if(D=="string")m.write(e,0,r);else if(D=="number"&&!p._useTypedArrays&&!s)for(E=0;E<y;E++)m[E]=0;return m}function b(e,r,s,y){return p._charsWritten=ce((function(m){for(var E=[],U=0;U<m.length;U++)E.push(255&m.charCodeAt(U));return E})(r),e,s,y)}function v(e,r,s,y){return p._charsWritten=ce((function(m){for(var E,U,D=[],H=0;H<m.length;H++)U=m.charCodeAt(H),E=U>>8,U=U%256,D.push(U),D.push(E);return D})(r),e,s,y)}function C(e,r,s){var y="";s=Math.min(e.length,s);for(var m=r;m<s;m++)y+=String.fromCharCode(e[m]);return y}function w(e,r,s,E){E||(S(typeof s=="boolean","missing or invalid endian"),S(r!=null,"missing offset"),S(r+1<e.length,"Trying to read beyond buffer length"));var m,E=e.length;if(!(E<=r))return s?(m=e[r],r+1<E&&(m|=e[r+1]<<8)):(m=e[r]<<8,r+1<E&&(m|=e[r+1])),m}function B(e,r,s,E){E||(S(typeof s=="boolean","missing or invalid endian"),S(r!=null,"missing offset"),S(r+3<e.length,"Trying to read beyond buffer length"));var m,E=e.length;if(!(E<=r))return s?(r+2<E&&(m=e[r+2]<<16),r+1<E&&(m|=e[r+1]<<8),m|=e[r],r+3<E&&(m+=e[r+3]<<24>>>0)):(r+1<E&&(m=e[r+1]<<16),r+2<E&&(m|=e[r+2]<<8),r+3<E&&(m|=e[r+3]),m+=e[r]<<24>>>0),m}function c(e,r,s,y){if(y||(S(typeof s=="boolean","missing or invalid endian"),S(r!=null,"missing offset"),S(r+1<e.length,"Trying to read beyond buffer length")),!(e.length<=r))return y=w(e,r,s,!0),32768&y?-1*(65535-y+1):y}function h(e,r,s,y){if(y||(S(typeof s=="boolean","missing or invalid endian"),S(r!=null,"missing offset"),S(r+3<e.length,"Trying to read beyond buffer length")),!(e.length<=r))return y=B(e,r,s,!0),2147483648&y?-1*(4294967295-y+1):y}function n(e,r,s,y){return y||(S(typeof s=="boolean","missing or invalid endian"),S(r+3<e.length,"Trying to read beyond buffer length")),x.read(e,r,s,23,4)}function o(e,r,s,y){return y||(S(typeof s=="boolean","missing or invalid endian"),S(r+7<e.length,"Trying to read beyond buffer length")),x.read(e,r,s,52,8)}function t(e,r,s,y,m){if(m||(S(r!=null,"missing value"),S(typeof y=="boolean","missing or invalid endian"),S(s!=null,"missing offset"),S(s+1<e.length,"trying to write beyond buffer length"),ve(r,65535)),m=e.length,!(m<=s))for(var E=0,U=Math.min(m-s,2);E<U;E++)e[s+E]=(r&255<<8*(y?E:1-E))>>>8*(y?E:1-E)}function u(e,r,s,y,m){if(m||(S(r!=null,"missing value"),S(typeof y=="boolean","missing or invalid endian"),S(s!=null,"missing offset"),S(s+3<e.length,"trying to write beyond buffer length"),ve(r,4294967295)),m=e.length,!(m<=s))for(var E=0,U=Math.min(m-s,4);E<U;E++)e[s+E]=r>>>8*(y?E:3-E)&255}function f(e,r,s,y,m){m||(S(r!=null,"missing value"),S(typeof y=="boolean","missing or invalid endian"),S(s!=null,"missing offset"),S(s+1<e.length,"Trying to write beyond buffer length"),we(r,32767,-32768)),e.length<=s||t(e,0<=r?r:65535+r+1,s,y,m)}function T(e,r,s,y,m){m||(S(r!=null,"missing value"),S(typeof y=="boolean","missing or invalid endian"),S(s!=null,"missing offset"),S(s+3<e.length,"Trying to write beyond buffer length"),we(r,2147483647,-2147483648)),e.length<=s||u(e,0<=r?r:4294967295+r+1,s,y,m)}function N(e,r,s,y,m){m||(S(r!=null,"missing value"),S(typeof y=="boolean","missing or invalid endian"),S(s!=null,"missing offset"),S(s+3<e.length,"Trying to write beyond buffer length"),Be(r,34028234663852886e22,-34028234663852886e22)),e.length<=s||x.write(e,r,s,y,23,4)}function L(e,r,s,y,m){m||(S(r!=null,"missing value"),S(typeof y=="boolean","missing or invalid endian"),S(s!=null,"missing offset"),S(s+7<e.length,"Trying to write beyond buffer length"),Be(r,17976931348623157e292,-17976931348623157e292)),e.length<=s||x.write(e,r,s,y,52,8)}l.Buffer=p,l.SlowBuffer=p,l.INSPECT_MAX_BYTES=50,p.poolSize=8192,p._useTypedArrays=(function(){try{var e=new ArrayBuffer(0),r=new Uint8Array(e);return r.foo=function(){return 42},r.foo()===42&&typeof r.subarray=="function"}catch{return!1}})(),p.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"raw":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},p.isBuffer=function(e){return!(e==null||!e._isBuffer)},p.byteLength=function(e,r){var s;switch(e+="",r||"utf8"){case"hex":s=e.length/2;break;case"utf8":case"utf-8":s=te(e).length;break;case"ascii":case"binary":case"raw":s=e.length;break;case"base64":s=ke(e).length;break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":s=2*e.length;break;default:throw new Error("Unknown encoding")}return s},p.concat=function(e,r){if(S(F(e),`Usage: Buffer.concat(list, [totalLength])
|
|
5
|
-
list should be an Array.`),e.length===0)return new p(0);if(e.length===1)return e[0];if(typeof r!="number")for(m=r=0;m<e.length;m++)r+=e[m].length;for(var s=new p(r),y=0,m=0;m<e.length;m++){var E=e[m];E.copy(s,y),y+=E.length}return s},p.prototype.write=function(e,r,s,y){isFinite(r)?isFinite(s)||(y=s,s=void 0):(H=y,y=r,r=s,s=H),r=Number(r)||0;var m,E,U,D,H=this.length-r;switch((!s||H<(s=Number(s)))&&(s=H),y=String(y||"utf8").toLowerCase()){case"hex":m=(function(Z,J,K,X){K=Number(K)||0;var Y=Z.length-K;(!X||Y<(X=Number(X)))&&(X=Y),S((Y=J.length)%2==0,"Invalid hex string"),Y/2<X&&(X=Y/2);for(var ie=0;ie<X;ie++){var Ne=parseInt(J.substr(2*ie,2),16);S(!isNaN(Ne),"Invalid hex string"),Z[K+ie]=Ne}return p._charsWritten=2*ie,ie})(this,e,r,s);break;case"utf8":case"utf-8":E=this,U=r,D=s,m=p._charsWritten=ce(te(e),E,U,D);break;case"ascii":case"binary":m=b(this,e,r,s);break;case"base64":E=this,U=r,D=s,m=p._charsWritten=ce(ke(e),E,U,D);break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":m=v(this,e,r,s);break;default:throw new Error("Unknown encoding")}return m},p.prototype.toString=function(e,r,s){var y,m,E,U,D=this;if(e=String(e||"utf8").toLowerCase(),r=Number(r)||0,(s=s!==void 0?Number(s):D.length)===r)return"";switch(e){case"hex":y=(function(H,Z,J){var K=H.length;(!Z||Z<0)&&(Z=0),(!J||J<0||K<J)&&(J=K);for(var X="",Y=Z;Y<J;Y++)X+=M(H[Y]);return X})(D,r,s);break;case"utf8":case"utf-8":y=(function(H,Z,J){var K="",X="";J=Math.min(H.length,J);for(var Y=Z;Y<J;Y++)H[Y]<=127?(K+=Ae(X)+String.fromCharCode(H[Y]),X=""):X+="%"+H[Y].toString(16);return K+Ae(X)})(D,r,s);break;case"ascii":case"binary":y=C(D,r,s);break;case"base64":m=D,U=s,y=(E=r)===0&&U===m.length?_.fromByteArray(m):_.fromByteArray(m.slice(E,U));break;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":y=(function(H,Z,J){for(var K=H.slice(Z,J),X="",Y=0;Y<K.length;Y+=2)X+=String.fromCharCode(K[Y]+256*K[Y+1]);return X})(D,r,s);break;default:throw new Error("Unknown encoding")}return y},p.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},p.prototype.copy=function(e,r,s,y){if(r=r||0,(y=y||y===0?y:this.length)!==(s=s||0)&&e.length!==0&&this.length!==0){S(s<=y,"sourceEnd < sourceStart"),S(0<=r&&r<e.length,"targetStart out of bounds"),S(0<=s&&s<this.length,"sourceStart out of bounds"),S(0<=y&&y<=this.length,"sourceEnd out of bounds"),y>this.length&&(y=this.length);var m=(y=e.length-r<y-s?e.length-r+s:y)-s;if(m<100||!p._useTypedArrays)for(var E=0;E<m;E++)e[E+r]=this[E+s];else e._set(this.subarray(s,s+m),r)}},p.prototype.slice=function(e,r){var s=this.length;if(e=j(e,s,0),r=j(r,s,s),p._useTypedArrays)return p._augment(this.subarray(e,r));for(var y=r-e,m=new p(y,void 0,!0),E=0;E<y;E++)m[E]=this[E+e];return m},p.prototype.get=function(e){return console.log(".get() is deprecated. Access using array indexes instead."),this.readUInt8(e)},p.prototype.set=function(e,r){return console.log(".set() is deprecated. Access using array indexes instead."),this.writeUInt8(e,r)},p.prototype.readUInt8=function(e,r){if(r||(S(e!=null,"missing offset"),S(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return this[e]},p.prototype.readUInt16LE=function(e,r){return w(this,e,!0,r)},p.prototype.readUInt16BE=function(e,r){return w(this,e,!1,r)},p.prototype.readUInt32LE=function(e,r){return B(this,e,!0,r)},p.prototype.readUInt32BE=function(e,r){return B(this,e,!1,r)},p.prototype.readInt8=function(e,r){if(r||(S(e!=null,"missing offset"),S(e<this.length,"Trying to read beyond buffer length")),!(e>=this.length))return 128&this[e]?-1*(255-this[e]+1):this[e]},p.prototype.readInt16LE=function(e,r){return c(this,e,!0,r)},p.prototype.readInt16BE=function(e,r){return c(this,e,!1,r)},p.prototype.readInt32LE=function(e,r){return h(this,e,!0,r)},p.prototype.readInt32BE=function(e,r){return h(this,e,!1,r)},p.prototype.readFloatLE=function(e,r){return n(this,e,!0,r)},p.prototype.readFloatBE=function(e,r){return n(this,e,!1,r)},p.prototype.readDoubleLE=function(e,r){return o(this,e,!0,r)},p.prototype.readDoubleBE=function(e,r){return o(this,e,!1,r)},p.prototype.writeUInt8=function(e,r,s){s||(S(e!=null,"missing value"),S(r!=null,"missing offset"),S(r<this.length,"trying to write beyond buffer length"),ve(e,255)),r>=this.length||(this[r]=e)},p.prototype.writeUInt16LE=function(e,r,s){t(this,e,r,!0,s)},p.prototype.writeUInt16BE=function(e,r,s){t(this,e,r,!1,s)},p.prototype.writeUInt32LE=function(e,r,s){u(this,e,r,!0,s)},p.prototype.writeUInt32BE=function(e,r,s){u(this,e,r,!1,s)},p.prototype.writeInt8=function(e,r,s){s||(S(e!=null,"missing value"),S(r!=null,"missing offset"),S(r<this.length,"Trying to write beyond buffer length"),we(e,127,-128)),r>=this.length||(0<=e?this.writeUInt8(e,r,s):this.writeUInt8(255+e+1,r,s))},p.prototype.writeInt16LE=function(e,r,s){f(this,e,r,!0,s)},p.prototype.writeInt16BE=function(e,r,s){f(this,e,r,!1,s)},p.prototype.writeInt32LE=function(e,r,s){T(this,e,r,!0,s)},p.prototype.writeInt32BE=function(e,r,s){T(this,e,r,!1,s)},p.prototype.writeFloatLE=function(e,r,s){N(this,e,r,!0,s)},p.prototype.writeFloatBE=function(e,r,s){N(this,e,r,!1,s)},p.prototype.writeDoubleLE=function(e,r,s){L(this,e,r,!0,s)},p.prototype.writeDoubleBE=function(e,r,s){L(this,e,r,!1,s)},p.prototype.fill=function(e,r,s){if(r=r||0,s=s||this.length,S(typeof(e=typeof(e=e||0)=="string"?e.charCodeAt(0):e)=="number"&&!isNaN(e),"value is not a number"),S(r<=s,"end < start"),s!==r&&this.length!==0){S(0<=r&&r<this.length,"start out of bounds"),S(0<=s&&s<=this.length,"end out of bounds");for(var y=r;y<s;y++)this[y]=e}},p.prototype.inspect=function(){for(var e=[],r=this.length,s=0;s<r;s++)if(e[s]=M(this[s]),s===l.INSPECT_MAX_BYTES){e[s+1]="...";break}return"<Buffer "+e.join(" ")+">"},p.prototype.toArrayBuffer=function(){if(typeof Uint8Array>"u")throw new Error("Buffer.toArrayBuffer not supported in this browser");if(p._useTypedArrays)return new p(this).buffer;for(var e=new Uint8Array(this.length),r=0,s=e.length;r<s;r+=1)e[r]=this[r];return e.buffer};var I=p.prototype;function j(e,r,s){return typeof e!="number"?s:r<=(e=~~e)?r:0<=e||0<=(e+=r)?e:0}function $(e){return(e=~~Math.ceil(+e))<0?0:e}function F(e){return(Array.isArray||function(r){return Object.prototype.toString.call(r)==="[object Array]"})(e)}function M(e){return e<16?"0"+e.toString(16):e.toString(16)}function te(e){for(var r=[],s=0;s<e.length;s++){var y=e.charCodeAt(s);if(y<=127)r.push(e.charCodeAt(s));else for(var m=s,E=(55296<=y&&y<=57343&&s++,encodeURIComponent(e.slice(m,s+1)).substr(1).split("%")),U=0;U<E.length;U++)r.push(parseInt(E[U],16))}return r}function ke(e){return _.toByteArray(e)}function ce(e,r,s,y){for(var m=0;m<y&&!(m+s>=r.length||m>=e.length);m++)r[m+s]=e[m];return m}function Ae(e){try{return decodeURIComponent(e)}catch{return"\uFFFD"}}function ve(e,r){S(typeof e=="number","cannot write a non-number as a number"),S(0<=e,"specified a negative value for writing an unsigned value"),S(e<=r,"value is larger than maximum value for type"),S(Math.floor(e)===e,"value has a fractional component")}function we(e,r,s){S(typeof e=="number","cannot write a non-number as a number"),S(e<=r,"value larger than maximum allowed value"),S(s<=e,"value smaller than minimum allowed value"),S(Math.floor(e)===e,"value has a fractional component")}function Be(e,r,s){S(typeof e=="number","cannot write a non-number as a number"),S(e<=r,"value larger than maximum allowed value"),S(s<=e,"value smaller than minimum allowed value")}function S(e,r){if(!e)throw new Error(r||"Failed assertion")}p._augment=function(e){return e._isBuffer=!0,e._get=e.get,e._set=e.set,e.get=I.get,e.set=I.set,e.write=I.write,e.toString=I.toString,e.toLocaleString=I.toString,e.toJSON=I.toJSON,e.copy=I.copy,e.slice=I.slice,e.readUInt8=I.readUInt8,e.readUInt16LE=I.readUInt16LE,e.readUInt16BE=I.readUInt16BE,e.readUInt32LE=I.readUInt32LE,e.readUInt32BE=I.readUInt32BE,e.readInt8=I.readInt8,e.readInt16LE=I.readInt16LE,e.readInt16BE=I.readInt16BE,e.readInt32LE=I.readInt32LE,e.readInt32BE=I.readInt32BE,e.readFloatLE=I.readFloatLE,e.readFloatBE=I.readFloatBE,e.readDoubleLE=I.readDoubleLE,e.readDoubleBE=I.readDoubleBE,e.writeUInt8=I.writeUInt8,e.writeUInt16LE=I.writeUInt16LE,e.writeUInt16BE=I.writeUInt16BE,e.writeUInt32LE=I.writeUInt32LE,e.writeUInt32BE=I.writeUInt32BE,e.writeInt8=I.writeInt8,e.writeInt16LE=I.writeInt16LE,e.writeInt16BE=I.writeInt16BE,e.writeInt32LE=I.writeInt32LE,e.writeInt32BE=I.writeInt32BE,e.writeFloatLE=I.writeFloatLE,e.writeFloatBE=I.writeFloatBE,e.writeDoubleLE=I.writeDoubleLE,e.writeDoubleBE=I.writeDoubleBE,e.fill=I.fill,e.inspect=I.inspect,e.toArrayBuffer=I.toArrayBuffer,e}}).call(this,i("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},i("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/buffer/index.js","/node_modules/gulp-browserify/node_modules/buffer")},{"base64-js":2,buffer:3,ieee754:10,lYpoI2:11}],4:[function(i,a,l){(function(d,g,_,k,P,O,R,V,q){var _=i("buffer").Buffer,x=4,p=new _(x);p.fill(0),a.exports={hash:function(b,v,C,w){for(var B=v((function(t,u){t.length%x!=0&&(f=t.length+(x-t.length%x),t=_.concat([t,p],f));for(var f,T=[],N=u?t.readInt32BE:t.readInt32LE,L=0;L<t.length;L+=x)T.push(N.call(t,L));return T})(b=_.isBuffer(b)?b:new _(b),w),8*b.length),v=w,c=new _(C),h=v?c.writeInt32BE:c.writeInt32LE,n=0;n<B.length;n++)h.call(c,B[n],4*n,!0);return c}}}).call(this,i("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},i("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],5:[function(i,a,l){(function(d,g,_,k,P,O,R,V,q){var _=i("buffer").Buffer,x=i("./sha"),p=i("./sha256"),b=i("./rng"),v={sha1:x,sha256:p,md5:i("./md5")},C=64,w=new _(C);function B(t,u){var f=v[t=t||"sha1"],T=[];return f||c("algorithm:",t,"is not yet supported"),{update:function(N){return _.isBuffer(N)||(N=new _(N)),T.push(N),N.length,this},digest:function(N){var L=_.concat(T),L=u?(function(I,j,$){_.isBuffer(j)||(j=new _(j)),_.isBuffer($)||($=new _($)),j.length>C?j=I(j):j.length<C&&(j=_.concat([j,w],C));for(var F=new _(C),M=new _(C),te=0;te<C;te++)F[te]=54^j[te],M[te]=92^j[te];return $=I(_.concat([F,$])),I(_.concat([M,$]))})(f,u,L):f(L);return T=null,N?L.toString(N):L}}}function c(){var t=[].slice.call(arguments).join(" ");throw new Error([t,"we accept pull requests","http://github.com/dominictarr/crypto-browserify"].join(`
|
|
6
|
-
`))}w.fill(0),l.createHash=function(t){return B(t)},l.createHmac=B,l.randomBytes=function(t,u){if(!u||!u.call)return new _(b(t));try{u.call(this,void 0,new _(b(t)))}catch(f){u(f)}};var h,n=["createCredentials","createCipher","createCipheriv","createDecipher","createDecipheriv","createSign","createVerify","createDiffieHellman","pbkdf2"],o=function(t){l[t]=function(){c("sorry,",t,"is not implemented yet")}};for(h in n)o(n[h],h)}).call(this,i("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},i("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/index.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./md5":6,"./rng":7,"./sha":8,"./sha256":9,buffer:3,lYpoI2:11}],6:[function(i,a,l){(function(d,g,A,k,P,O,R,V,q){var _=i("./helpers");function x(c,h){c[h>>5]|=128<<h%32,c[14+(h+64>>>9<<4)]=h;for(var n=1732584193,o=-271733879,t=-1732584194,u=271733878,f=0;f<c.length;f+=16){var T=n,N=o,L=t,I=u,n=b(n,o,t,u,c[f+0],7,-680876936),u=b(u,n,o,t,c[f+1],12,-389564586),t=b(t,u,n,o,c[f+2],17,606105819),o=b(o,t,u,n,c[f+3],22,-1044525330);n=b(n,o,t,u,c[f+4],7,-176418897),u=b(u,n,o,t,c[f+5],12,1200080426),t=b(t,u,n,o,c[f+6],17,-1473231341),o=b(o,t,u,n,c[f+7],22,-45705983),n=b(n,o,t,u,c[f+8],7,1770035416),u=b(u,n,o,t,c[f+9],12,-1958414417),t=b(t,u,n,o,c[f+10],17,-42063),o=b(o,t,u,n,c[f+11],22,-1990404162),n=b(n,o,t,u,c[f+12],7,1804603682),u=b(u,n,o,t,c[f+13],12,-40341101),t=b(t,u,n,o,c[f+14],17,-1502002290),n=v(n,o=b(o,t,u,n,c[f+15],22,1236535329),t,u,c[f+1],5,-165796510),u=v(u,n,o,t,c[f+6],9,-1069501632),t=v(t,u,n,o,c[f+11],14,643717713),o=v(o,t,u,n,c[f+0],20,-373897302),n=v(n,o,t,u,c[f+5],5,-701558691),u=v(u,n,o,t,c[f+10],9,38016083),t=v(t,u,n,o,c[f+15],14,-660478335),o=v(o,t,u,n,c[f+4],20,-405537848),n=v(n,o,t,u,c[f+9],5,568446438),u=v(u,n,o,t,c[f+14],9,-1019803690),t=v(t,u,n,o,c[f+3],14,-187363961),o=v(o,t,u,n,c[f+8],20,1163531501),n=v(n,o,t,u,c[f+13],5,-1444681467),u=v(u,n,o,t,c[f+2],9,-51403784),t=v(t,u,n,o,c[f+7],14,1735328473),n=C(n,o=v(o,t,u,n,c[f+12],20,-1926607734),t,u,c[f+5],4,-378558),u=C(u,n,o,t,c[f+8],11,-2022574463),t=C(t,u,n,o,c[f+11],16,1839030562),o=C(o,t,u,n,c[f+14],23,-35309556),n=C(n,o,t,u,c[f+1],4,-1530992060),u=C(u,n,o,t,c[f+4],11,1272893353),t=C(t,u,n,o,c[f+7],16,-155497632),o=C(o,t,u,n,c[f+10],23,-1094730640),n=C(n,o,t,u,c[f+13],4,681279174),u=C(u,n,o,t,c[f+0],11,-358537222),t=C(t,u,n,o,c[f+3],16,-722521979),o=C(o,t,u,n,c[f+6],23,76029189),n=C(n,o,t,u,c[f+9],4,-640364487),u=C(u,n,o,t,c[f+12],11,-421815835),t=C(t,u,n,o,c[f+15],16,530742520),n=w(n,o=C(o,t,u,n,c[f+2],23,-995338651),t,u,c[f+0],6,-198630844),u=w(u,n,o,t,c[f+7],10,1126891415),t=w(t,u,n,o,c[f+14],15,-1416354905),o=w(o,t,u,n,c[f+5],21,-57434055),n=w(n,o,t,u,c[f+12],6,1700485571),u=w(u,n,o,t,c[f+3],10,-1894986606),t=w(t,u,n,o,c[f+10],15,-1051523),o=w(o,t,u,n,c[f+1],21,-2054922799),n=w(n,o,t,u,c[f+8],6,1873313359),u=w(u,n,o,t,c[f+15],10,-30611744),t=w(t,u,n,o,c[f+6],15,-1560198380),o=w(o,t,u,n,c[f+13],21,1309151649),n=w(n,o,t,u,c[f+4],6,-145523070),u=w(u,n,o,t,c[f+11],10,-1120210379),t=w(t,u,n,o,c[f+2],15,718787259),o=w(o,t,u,n,c[f+9],21,-343485551),n=B(n,T),o=B(o,N),t=B(t,L),u=B(u,I)}return Array(n,o,t,u)}function p(c,h,n,o,t,u){return B((h=B(B(h,c),B(o,u)))<<t|h>>>32-t,n)}function b(c,h,n,o,t,u,f){return p(h&n|~h&o,c,h,t,u,f)}function v(c,h,n,o,t,u,f){return p(h&o|n&~o,c,h,t,u,f)}function C(c,h,n,o,t,u,f){return p(h^n^o,c,h,t,u,f)}function w(c,h,n,o,t,u,f){return p(n^(h|~o),c,h,t,u,f)}function B(c,h){var n=(65535&c)+(65535&h);return(c>>16)+(h>>16)+(n>>16)<<16|65535&n}a.exports=function(c){return _.hash(c,x,16)}}).call(this,i("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},i("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/md5.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],7:[function(i,a,l){(function(d,g,A,k,P,O,R,V,q){var _;a.exports=_||function(x){for(var p,b=new Array(x),v=0;v<x;v++)(3&v)==0&&(p=4294967296*Math.random()),b[v]=p>>>((3&v)<<3)&255;return b}}).call(this,i("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},i("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/rng.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{buffer:3,lYpoI2:11}],8:[function(i,a,l){(function(d,g,A,k,P,O,R,V,q){var _=i("./helpers");function x(v,C){v[C>>5]|=128<<24-C%32,v[15+(C+64>>9<<4)]=C;for(var w,B,c,h=Array(80),n=1732584193,o=-271733879,t=-1732584194,u=271733878,f=-1009589776,T=0;T<v.length;T+=16){for(var N=n,L=o,I=t,j=u,$=f,F=0;F<80;F++){h[F]=F<16?v[T+F]:b(h[F-3]^h[F-8]^h[F-14]^h[F-16],1);var M=p(p(b(n,5),(M=o,B=t,c=u,(w=F)<20?M&B|~M&c:!(w<40)&&w<60?M&B|M&c|B&c:M^B^c)),p(p(f,h[F]),(w=F)<20?1518500249:w<40?1859775393:w<60?-1894007588:-899497514)),f=u,u=t,t=b(o,30),o=n,n=M}n=p(n,N),o=p(o,L),t=p(t,I),u=p(u,j),f=p(f,$)}return Array(n,o,t,u,f)}function p(v,C){var w=(65535&v)+(65535&C);return(v>>16)+(C>>16)+(w>>16)<<16|65535&w}function b(v,C){return v<<C|v>>>32-C}a.exports=function(v){return _.hash(v,x,20,!0)}}).call(this,i("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},i("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],9:[function(i,a,l){(function(d,g,A,k,P,O,R,V,q){function _(C,w){var B=(65535&C)+(65535&w);return(C>>16)+(w>>16)+(B>>16)<<16|65535&B}function x(C,w){var B,c=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298),h=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225),n=new Array(64);C[w>>5]|=128<<24-w%32,C[15+(w+64>>9<<4)]=w;for(var o,t,u=0;u<C.length;u+=16){for(var f=h[0],T=h[1],N=h[2],L=h[3],I=h[4],j=h[5],$=h[6],F=h[7],M=0;M<64;M++)n[M]=M<16?C[M+u]:_(_(_((t=n[M-2],b(t,17)^b(t,19)^v(t,10)),n[M-7]),(t=n[M-15],b(t,7)^b(t,18)^v(t,3))),n[M-16]),B=_(_(_(_(F,b(t=I,6)^b(t,11)^b(t,25)),I&j^~I&$),c[M]),n[M]),o=_(b(o=f,2)^b(o,13)^b(o,22),f&T^f&N^T&N),F=$,$=j,j=I,I=_(L,B),L=N,N=T,T=f,f=_(B,o);h[0]=_(f,h[0]),h[1]=_(T,h[1]),h[2]=_(N,h[2]),h[3]=_(L,h[3]),h[4]=_(I,h[4]),h[5]=_(j,h[5]),h[6]=_($,h[6]),h[7]=_(F,h[7])}return h}var p=i("./helpers"),b=function(C,w){return C>>>w|C<<32-w},v=function(C,w){return C>>>w};a.exports=function(C){return p.hash(C,x,32,!0)}}).call(this,i("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},i("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/crypto-browserify/sha256.js","/node_modules/gulp-browserify/node_modules/crypto-browserify")},{"./helpers":4,buffer:3,lYpoI2:11}],10:[function(i,a,l){(function(d,g,A,k,P,O,R,V,q){l.read=function(_,x,p,b,u){var C,w,B=8*u-b-1,c=(1<<B)-1,h=c>>1,n=-7,o=p?u-1:0,t=p?-1:1,u=_[x+o];for(o+=t,C=u&(1<<-n)-1,u>>=-n,n+=B;0<n;C=256*C+_[x+o],o+=t,n-=8);for(w=C&(1<<-n)-1,C>>=-n,n+=b;0<n;w=256*w+_[x+o],o+=t,n-=8);if(C===0)C=1-h;else{if(C===c)return w?NaN:1/0*(u?-1:1);w+=Math.pow(2,b),C-=h}return(u?-1:1)*w*Math.pow(2,C-b)},l.write=function(_,x,p,b,v,f){var w,B,c=8*f-v-1,h=(1<<c)-1,n=h>>1,o=v===23?Math.pow(2,-24)-Math.pow(2,-77):0,t=b?0:f-1,u=b?1:-1,f=x<0||x===0&&1/x<0?1:0;for(x=Math.abs(x),isNaN(x)||x===1/0?(B=isNaN(x)?1:0,w=h):(w=Math.floor(Math.log(x)/Math.LN2),x*(b=Math.pow(2,-w))<1&&(w--,b*=2),2<=(x+=1<=w+n?o/b:o*Math.pow(2,1-n))*b&&(w++,b/=2),h<=w+n?(B=0,w=h):1<=w+n?(B=(x*b-1)*Math.pow(2,v),w+=n):(B=x*Math.pow(2,n-1)*Math.pow(2,v),w=0));8<=v;_[p+t]=255&B,t+=u,B/=256,v-=8);for(w=w<<v|B,c+=v;0<c;_[p+t]=255&w,t+=u,w/=256,c-=8);_[p+t-u]|=128*f}}).call(this,i("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},i("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/ieee754/index.js","/node_modules/gulp-browserify/node_modules/ieee754")},{buffer:3,lYpoI2:11}],11:[function(i,a,l){(function(d,g,A,k,P,O,R,V,q){var _,x,p;function b(){}(d=a.exports={}).nextTick=(x=typeof window<"u"&&window.setImmediate,p=typeof window<"u"&&window.postMessage&&window.addEventListener,x?function(v){return window.setImmediate(v)}:p?(_=[],window.addEventListener("message",function(v){var C=v.source;C!==window&&C!==null||v.data!=="process-tick"||(v.stopPropagation(),0<_.length&&_.shift()())},!0),function(v){_.push(v),window.postMessage("process-tick","*")}):function(v){setTimeout(v,0)}),d.title="browser",d.browser=!0,d.env={},d.argv=[],d.on=b,d.addListener=b,d.once=b,d.off=b,d.removeListener=b,d.removeAllListeners=b,d.emit=b,d.binding=function(v){throw new Error("process.binding is not supported")},d.cwd=function(){return"/"},d.chdir=function(v){throw new Error("process.chdir is not supported")}}).call(this,i("lYpoI2"),typeof self<"u"?self:typeof window<"u"?window:{},i("buffer").Buffer,arguments[3],arguments[4],arguments[5],arguments[6],"/node_modules/gulp-browserify/node_modules/process/browser.js","/node_modules/gulp-browserify/node_modules/process")},{buffer:3,lYpoI2:11}]},{},[1])(1)})});var Zt={};xt(Zt,{ConsentContext:()=>se,ConsentPopup:()=>et,ConsentProvider:()=>vt,ConsentSettings:()=>ge,useConsent:()=>G});module.exports=kt(Zt);var Ue=require("react");var Pe=require("react"),At={consent:[],services:[],theme:"light",isPopupVisible:!0,isSettingsVisible:!1,setConsent:()=>{},hasConsent:()=>!1,showPopup:()=>{},hidePopup:()=>{},toggleSettings:()=>{}},se=(0,Pe.createContext)(At);function G(){return(0,Ue.useContext)(se)}var le=require("react");function fe(){let{services:i,setConsent:a,hidePopup:l}=G(),d=(0,le.useCallback)(()=>{a(i.map(k=>k.id)),l()},[i,a,l]),g=(0,le.useCallback)(k=>{a(k),l()},[a,l]),A=(0,le.useCallback)(()=>{let k=i.filter(P=>P.mandatory).map(P=>P.id);a(k),l()},[i,a,l]);return{approveAll:d,approveSelected:g,declineAll:A}}var de=require("react");function Oe(){let{consent:i,services:a}=G(),[l,d]=(0,de.useState)(()=>{let A=a.filter(k=>k.mandatory).map(k=>k.id);return[...new Set([...i,...A])]}),g=(0,de.useCallback)((A,k)=>{d(P=>k?[...P,A]:P.filter(O=>O!==A))},[]);return{selectedIds:l,toggleService:g}}var Qe=Le(Ge());var oe=require("react/jsx-runtime"),Kt=Qe.default;function Ze({serviceId:i,name:a,description:l,mandatory:d,onChange:g}){let{hasConsent:A}=G(),k=P=>{g(i,P.target.checked)};return(0,oe.jsxs)("div",{className:"rcc-settings__item",children:[(0,oe.jsxs)("div",{className:"rcc-settings__item__info",children:[(0,oe.jsx)("label",{htmlFor:`rcc-toggle-${i}`,className:"rcc-settings__item__name",children:a}),l&&(0,oe.jsx)("p",{className:"rcc-settings__item__description",children:l})]}),(0,oe.jsx)(Kt,{id:`rcc-toggle-${i}`,defaultChecked:d||A(i),disabled:d,onChange:k,"aria-label":`Toggle ${a}`})]})}var Q=require("react/jsx-runtime");function ge({onClose:i,modal:a}){let{services:l}=G(),{approveSelected:d,declineAll:g}=fe(),{selectedIds:A,toggleService:k}=Oe(),P=()=>{d(A),i()},O=()=>{g(),i()},R=a?.title??"Cookie Settings",V=a?.approve??"Save Selection",q=a?.decline??"Decline All",_=a?.close??"Close";return(0,Q.jsx)("div",{className:"rcc-settings",role:"dialog","aria-modal":"true","aria-label":"Cookie Settings",children:(0,Q.jsxs)("div",{className:"rcc-settings__content",children:[(0,Q.jsxs)("header",{className:"rcc-settings__header",children:[(0,Q.jsx)("h2",{className:"rcc-settings__title",children:R}),(0,Q.jsx)("button",{type:"button",className:"rcc-settings__close",onClick:i,"aria-label":"Close settings",children:_})]}),(0,Q.jsx)("main",{className:"rcc-settings__body",children:l.map(x=>(0,Q.jsx)(Ze,{serviceId:x.id,name:x.name,description:x.description,mandatory:x.mandatory,onChange:k},x.id))}),(0,Q.jsxs)("footer",{className:"rcc-settings__footer",children:[(0,Q.jsx)("button",{type:"button",className:"rcc-settings__btn rcc-settings__btn--secondary",onClick:O,children:q}),(0,Q.jsx)("button",{type:"button",className:"rcc-settings__btn rcc-settings__btn--primary",onClick:P,children:V})]})]})})}var ee=require("react/jsx-runtime");function et({children:i,settings:a,decline:l,approve:d}){let{isPopupVisible:g,isSettingsVisible:A,toggleSettings:k,theme:P}=G(),{approveAll:O,declineAll:R}=fe();if(!g)return null;if(A)return(0,ee.jsx)("div",{className:"rcc-popup","data-theme":P,children:(0,ee.jsx)(ge,{onClose:k,modal:a?.modal})});let V=a?.label??"Settings",q=l?.label??"Decline",_=d?.label??"Accept All";return(0,ee.jsx)("div",{className:"rcc-popup","data-theme":P,children:(0,ee.jsxs)("div",{className:"rcc-popup__card",role:"dialog","aria-modal":"true","aria-label":"Cookie consent",children:[(0,ee.jsx)("div",{className:"rcc-popup__message",children:i??"This website uses cookies to improve your experience."}),(0,ee.jsxs)("div",{className:"rcc-popup__actions",children:[!a?.hidden&&(0,ee.jsx)("button",{type:"button",className:"rcc-popup__btn rcc-popup__btn--secondary",onClick:k,children:V}),!l?.hidden&&(0,ee.jsx)("button",{type:"button",className:"rcc-popup__btn rcc-popup__btn--secondary",onClick:R,children:q}),(0,ee.jsx)("button",{type:"button",className:"rcc-popup__btn rcc-popup__btn--primary",onClick:O,children:_})]})]})})}var z=require("react"),yt=Le(rt());var me="rcc-popup",ye="rcc-popup-consent";function xe(i){let a=localStorage.getItem(ye);if(!a)return{consent:[],isValid:!1};try{let l=JSON.parse(a);return l.hash!==i?{consent:[],isValid:!1}:{consent:l.consent,isValid:!0}}catch{return{consent:[],isValid:!1}}}function ot(i){return"src"in i}function it(i){return"code"in i}function st(i,a){let l=document.createElement("script");l.id=i,l.src=a,l.async=!0,document.body.appendChild(l)}function at(i,a){let l=document.createElement("script");l.id=i,l.innerHTML=a,document.body.appendChild(l)}function zt(i,a){return`${me}-${i}-${a}`}function ct(i,a){for(let l of a){let d=zt(i,l.id);document.getElementById(d)||(ot(l)?st(d,l.src):it(l)&&at(d,l.code))}}function be(i){for(let a of i)a.scripts?.length&&ct(a.id,a.scripts)}function ut(i,a){for(let l of a){let d=`${me}-${i}-${l.id}`,g=document.getElementById(d);g&&g.remove()}}function Gt(){return document.cookie.split(";").map(i=>i.trim().split("=")[0]).filter(Boolean)}function lt(i){document.cookie=`${i}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`}function ft(i){let a=Gt();for(let{pattern:l}of i)if(typeof l=="string")lt(l);else for(let d of a)l.test(d)&<(d)}function dt(i){for(let a of i)localStorage.removeItem(a)}function pt(i){for(let a of i)sessionStorage.removeItem(a)}function ht(i){for(let a of i)a.scripts?.length&&ut(a.id,a.scripts),a.cookies?.length&&ft(a.cookies),a.localStorage?.length&&dt(a.localStorage),a.sessionStorage?.length&&pt(a.sessionStorage)}function gt(i,a){let l={consent:i,hash:a,timestamp:Date.now()};localStorage.setItem(ye,JSON.stringify(l))}function mt(i,a,l,d){let g=i.filter(k=>l.includes(k.id)&&!a.includes(k.id)),A=i.filter(k=>!l.includes(k.id)&&a.includes(k.id));ht(A),be(g),gt(l,d)}function Qt(i){return i.customHash?i.customHash:(0,yt.default)(i.services.map(a=>({id:a.id,name:a.name})))}function bt(i){let a=Qt(i),{services:l}=i,[d,g]=(0,z.useState)(()=>{let{consent:b,isValid:v}=xe(a);return v?b:[]}),[A,k]=(0,z.useState)(()=>{let{isValid:b}=xe(a);return!b}),[P,O]=(0,z.useState)(!1),R=(0,z.useRef)(d);(0,z.useEffect)(()=>{let b=l.filter(v=>d.includes(v.id));be(b)},[]);let V=(0,z.useCallback)(b=>{let v=R.current;mt(l,v,b,a),g(b),R.current=b},[l,a]),q=(0,z.useCallback)(b=>d.includes(b),[d]),_=(0,z.useCallback)(()=>k(!0),[]),x=(0,z.useCallback)(()=>k(!1),[]),p=(0,z.useCallback)(()=>O(b=>!b),[]);return{consent:d,services:l,theme:i.theme??"light",isPopupVisible:A,isSettingsVisible:P,setConsent:V,hasConsent:q,showPopup:_,hidePopup:x,toggleSettings:p}}var wt=require("react/jsx-runtime");function vt({options:i,children:a}){let l=bt(i);return(0,wt.jsx)(se.Provider,{value:l,children:a})}
|
|
7
|
-
/*! Bundled license information:
|
|
8
|
-
|
|
9
|
-
classnames/index.js:
|
|
10
|
-
(*!
|
|
11
|
-
Copyright (c) 2018 Jed Watson.
|
|
12
|
-
Licensed under the MIT License (MIT), see
|
|
13
|
-
http://jedwatson.github.io/classnames
|
|
14
|
-
*)
|
|
15
|
-
*/
|
|
1
|
+
"use strict";var ne=Object.create;var _=Object.defineProperty;var se=Object.getOwnPropertyDescriptor;var ie=Object.getOwnPropertyNames;var re=Object.getPrototypeOf,ce=Object.prototype.hasOwnProperty;var ae=(t,e)=>{for(var o in e)_(t,o,{get:e[o],enumerable:!0})},L=(t,e,o,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of ie(e))!ce.call(t,i)&&i!==o&&_(t,i,{get:()=>e[i],enumerable:!(n=se(e,i))||n.enumerable});return t};var T=(t,e,o)=>(o=t!=null?ne(re(t)):{},L(e||!t||!t.__esModule?_(o,"default",{value:t,enumerable:!0}):o,t)),pe=t=>L(_({},"__esModule",{value:!0}),t);var Ce={};ae(Ce,{ConsentContext:()=>S,ConsentPopup:()=>H,ConsentProvider:()=>ee,ConsentSettings:()=>I,useConsent:()=>l});module.exports=pe(Ce);var M=require("react");var A=require("react"),le={consent:[],services:[],theme:"light",isPopupVisible:!0,isSettingsVisible:!1,setConsent:()=>{},hasConsent:()=>!1,showPopup:()=>{},hidePopup:()=>{},toggleSettings:()=>{}},S=(0,A.createContext)(le);function l(){return(0,M.useContext)(S)}var y=require("react");function N(){let{services:t,setConsent:e,hidePopup:o}=l(),n=(0,y.useCallback)(()=>{e(t.map(s=>s.id)),o()},[t,e,o]),i=(0,y.useCallback)(s=>{e(s),o()},[e,o]),r=(0,y.useCallback)(()=>{let s=t.filter(c=>c.mandatory).map(c=>c.id);e(s),o()},[t,e,o]);return{approveAll:n,approveSelected:i,declineAll:r}}var P=require("react");function O(){let{consent:t,services:e}=l(),[o,n]=(0,P.useState)(()=>{let r=e.filter(s=>s.mandatory).map(s=>s.id);return[...new Set([...t,...r])]}),i=(0,P.useCallback)((r,s)=>{n(c=>s?[...c,r]:c.filter(u=>u!==r))},[]);return{selectedIds:o,toggleService:i}}var $=T(require("react-toggle"));var C=require("react/jsx-runtime"),de=$.default;function w({serviceId:t,name:e,description:o,mandatory:n,onChange:i}){let{hasConsent:r}=l(),s=c=>{i(t,c.target.checked)};return(0,C.jsxs)("div",{className:"rcc-settings__item",children:[(0,C.jsxs)("div",{className:"rcc-settings__item__info",children:[(0,C.jsx)("label",{htmlFor:`rcc-toggle-${t}`,className:"rcc-settings__item__name",children:e}),o&&(0,C.jsx)("p",{className:"rcc-settings__item__description",children:o})]}),(0,C.jsx)(de,{id:`rcc-toggle-${t}`,defaultChecked:n||r(t),disabled:n,onChange:s,"aria-label":`Toggle ${e}`})]})}var d=require("react/jsx-runtime");function I({onClose:t,modal:e}){let{services:o}=l(),{approveSelected:n,declineAll:i}=N(),{selectedIds:r,toggleService:s}=O(),c=()=>{n(r),t()},u=()=>{i(),t()},f=e?.title??"Cookie Settings",v=e?.approve??"Save Selection",b=e?.decline??"Decline All",h=e?.close??"Close";return(0,d.jsx)("div",{className:"rcc-settings",role:"dialog","aria-modal":"true","aria-label":"Cookie Settings",children:(0,d.jsxs)("div",{className:"rcc-settings__content",children:[(0,d.jsxs)("header",{className:"rcc-settings__header",children:[(0,d.jsx)("h2",{className:"rcc-settings__title",children:f}),(0,d.jsx)("button",{type:"button",className:"rcc-settings__close",onClick:t,"aria-label":"Close settings",children:h})]}),(0,d.jsx)("main",{className:"rcc-settings__body",children:o.map(g=>(0,d.jsx)(w,{serviceId:g.id,name:g.name,description:g.description,mandatory:g.mandatory,onChange:s},g.id))}),(0,d.jsxs)("footer",{className:"rcc-settings__footer",children:[(0,d.jsx)("button",{type:"button",className:"rcc-settings__btn rcc-settings__btn--secondary",onClick:u,children:b}),(0,d.jsx)("button",{type:"button",className:"rcc-settings__btn rcc-settings__btn--primary",onClick:c,children:v})]})]})})}var m=require("react/jsx-runtime");function H({children:t,settings:e,decline:o,approve:n}){let{isPopupVisible:i,isSettingsVisible:r,toggleSettings:s,theme:c}=l(),{approveAll:u,declineAll:f}=N();if(!i)return null;if(r)return(0,m.jsx)("div",{className:"rcc-popup","data-theme":c,children:(0,m.jsx)(I,{onClose:s,modal:e?.modal})});let v=e?.label??"Settings",b=o?.label??"Decline",h=n?.label??"Accept All";return(0,m.jsx)("div",{className:"rcc-popup","data-theme":c,children:(0,m.jsxs)("div",{className:"rcc-popup__card",role:"dialog","aria-modal":"true","aria-label":"Cookie consent",children:[(0,m.jsx)("div",{className:"rcc-popup__message",children:t??"This website uses cookies to improve your experience."}),(0,m.jsxs)("div",{className:"rcc-popup__actions",children:[!e?.hidden&&(0,m.jsx)("button",{type:"button",className:"rcc-popup__btn rcc-popup__btn--secondary",onClick:s,children:v}),!o?.hidden&&(0,m.jsx)("button",{type:"button",className:"rcc-popup__btn rcc-popup__btn--secondary",onClick:f,children:b}),(0,m.jsx)("button",{type:"button",className:"rcc-popup__btn rcc-popup__btn--primary",onClick:u,children:h})]})]})})}var a=require("react"),Z=T(require("object-hash"));var E="rcc-popup",k="rcc-popup-consent";function V(t){let e=localStorage.getItem(k);if(!e)return{consent:[],isValid:!1};try{let o=JSON.parse(e);return o.hash!==t?{consent:[],isValid:!1}:{consent:o.consent,isValid:!0}}catch{return{consent:[],isValid:!1}}}function D(t){return"src"in t}function F(t){return"code"in t}function G(t,e){let o=document.createElement("script");o.id=t,o.src=e,o.async=!0,document.body.appendChild(o)}function B(t,e){let o=document.createElement("script");o.id=t,o.innerHTML=e,document.body.appendChild(o)}function me(t,e){return`${E}-${t}-${e}`}function J(t,e){for(let o of e){let n=me(t,o.id);document.getElementById(n)||(D(o)?G(n,o.src):F(o)&&B(n,o.code))}}function R(t){for(let e of t)e.scripts?.length&&J(e.id,e.scripts)}function K(t,e){for(let o of e){let n=`${E}-${t}-${o.id}`,i=document.getElementById(n);i&&i.remove()}}function ue(){return document.cookie.split(";").map(t=>t.trim().split("=")[0]).filter(Boolean)}function X(t){document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`}function Y(t){let e=ue();for(let{pattern:o}of t)if(typeof o=="string")X(o);else for(let n of e)o.test(n)&&X(n)}function q(t){for(let e of t)localStorage.removeItem(e)}function z(t){for(let e of t)sessionStorage.removeItem(e)}function Q(t){for(let e of t)e.scripts?.length&&K(e.id,e.scripts),e.cookies?.length&&Y(e.cookies),e.localStorage?.length&&q(e.localStorage),e.sessionStorage?.length&&z(e.sessionStorage)}function U(t,e){let o={consent:t,hash:e,timestamp:Date.now()};localStorage.setItem(k,JSON.stringify(o))}function W(t,e,o,n){let i=t.filter(s=>o.includes(s.id)&&!e.includes(s.id)),r=t.filter(s=>!o.includes(s.id)&&e.includes(s.id));Q(r),R(i),U(o,n)}function ge(t){return t.customHash?t.customHash:(0,Z.default)(t.services.map(e=>({id:e.id,name:e.name})))}function j(t){let e=ge(t),{services:o}=t,[n,i]=(0,a.useState)(()=>{let{consent:p,isValid:x}=V(e);return x?p:[]}),[r,s]=(0,a.useState)(()=>{let{isValid:p}=V(e);return!p}),[c,u]=(0,a.useState)(!1),f=(0,a.useRef)(n);(0,a.useEffect)(()=>{let p=o.filter(x=>n.includes(x.id));R(p)},[]);let v=(0,a.useCallback)(p=>{let x=f.current;W(o,x,p,e),i(p),f.current=p},[o,e]),b=(0,a.useCallback)(p=>n.includes(p),[n]),h=(0,a.useCallback)(()=>s(!0),[]),g=(0,a.useCallback)(()=>s(!1),[]),oe=(0,a.useCallback)(()=>u(p=>!p),[]);return{consent:n,services:o,theme:t.theme??"light",isPopupVisible:r,isSettingsVisible:c,setConsent:v,hasConsent:b,showPopup:h,hidePopup:g,toggleSettings:oe}}var te=require("react/jsx-runtime");function ee({options:t,children:e}){let o=j(t);return(0,te.jsx)(S.Provider,{value:o,children:e})}
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{useContext as Z}from"react";import{createContext as U}from"react";var W={consent:[],services:[],theme:"light",isPopupVisible:!0,isSettingsVisible:!1,setConsent:()=>{},hasConsent:()=>!1,showPopup:()=>{},hidePopup:()=>{},toggleSettings:()=>{}},b=U(W);function p(){return Z(b)}import{useCallback as P}from"react";function x(){let{services:t,setConsent:e,hidePopup:o}=p(),n=P(()=>{e(t.map(s=>s.id)),o()},[t,e,o]),i=P(s=>{e(s),o()},[e,o]),r=P(()=>{let s=t.filter(c=>c.mandatory).map(c=>c.id);e(s),o()},[t,e,o]);return{approveAll:n,approveSelected:i,declineAll:r}}import{useState as j,useCallback as ee}from"react";function L(){let{consent:t,services:e}=p(),[o,n]=j(()=>{let r=e.filter(s=>s.mandatory).map(s=>s.id);return[...new Set([...t,...r])]}),i=ee((r,s)=>{n(c=>s?[...c,r]:c.filter(l=>l!==r))},[]);return{selectedIds:o,toggleService:i}}import te from"react-toggle";import{jsx as I,jsxs as T}from"react/jsx-runtime";var oe=te;function A({serviceId:t,name:e,description:o,mandatory:n,onChange:i}){let{hasConsent:r}=p(),s=c=>{i(t,c.target.checked)};return T("div",{className:"rcc-settings__item",children:[T("div",{className:"rcc-settings__item__info",children:[I("label",{htmlFor:`rcc-toggle-${t}`,className:"rcc-settings__item__name",children:e}),o&&I("p",{className:"rcc-settings__item__description",children:o})]}),I(oe,{id:`rcc-toggle-${t}`,defaultChecked:n||r(t),disabled:n,onChange:s,"aria-label":`Toggle ${e}`})]})}import{jsx as m,jsxs as E}from"react/jsx-runtime";function k({onClose:t,modal:e}){let{services:o}=p(),{approveSelected:n,declineAll:i}=x(),{selectedIds:r,toggleService:s}=L(),c=()=>{n(r),t()},l=()=>{i(),t()},g=e?.title??"Cookie Settings",C=e?.approve??"Save Selection",f=e?.decline??"Decline All",S=e?.close??"Close";return m("div",{className:"rcc-settings",role:"dialog","aria-modal":"true","aria-label":"Cookie Settings",children:E("div",{className:"rcc-settings__content",children:[E("header",{className:"rcc-settings__header",children:[m("h2",{className:"rcc-settings__title",children:g}),m("button",{type:"button",className:"rcc-settings__close",onClick:t,"aria-label":"Close settings",children:S})]}),m("main",{className:"rcc-settings__body",children:o.map(d=>m(A,{serviceId:d.id,name:d.name,description:d.description,mandatory:d.mandatory,onChange:s},d.id))}),E("footer",{className:"rcc-settings__footer",children:[m("button",{type:"button",className:"rcc-settings__btn rcc-settings__btn--secondary",onClick:l,children:f}),m("button",{type:"button",className:"rcc-settings__btn rcc-settings__btn--primary",onClick:c,children:C})]})]})})}import{jsx as u,jsxs as M}from"react/jsx-runtime";function ne({children:t,settings:e,decline:o,approve:n}){let{isPopupVisible:i,isSettingsVisible:r,toggleSettings:s,theme:c}=p(),{approveAll:l,declineAll:g}=x();if(!i)return null;if(r)return u("div",{className:"rcc-popup","data-theme":c,children:u(k,{onClose:s,modal:e?.modal})});let C=e?.label??"Settings",f=o?.label??"Decline",S=n?.label??"Accept All";return u("div",{className:"rcc-popup","data-theme":c,children:M("div",{className:"rcc-popup__card",role:"dialog","aria-modal":"true","aria-label":"Cookie consent",children:[u("div",{className:"rcc-popup__message",children:t??"This website uses cookies to improve your experience."}),M("div",{className:"rcc-popup__actions",children:[!e?.hidden&&u("button",{type:"button",className:"rcc-popup__btn rcc-popup__btn--secondary",onClick:s,children:C}),!o?.hidden&&u("button",{type:"button",className:"rcc-popup__btn rcc-popup__btn--secondary",onClick:g,children:f}),u("button",{type:"button",className:"rcc-popup__btn rcc-popup__btn--primary",onClick:l,children:S})]})]})})}import{useState as V,useCallback as h,useEffect as re,useRef as ce}from"react";import ae from"object-hash";var _="rcc-popup",y="rcc-popup-consent";function R(t){let e=localStorage.getItem(y);if(!e)return{consent:[],isValid:!1};try{let o=JSON.parse(e);return o.hash!==t?{consent:[],isValid:!1}:{consent:o.consent,isValid:!0}}catch{return{consent:[],isValid:!1}}}function O(t){return"src"in t}function $(t){return"code"in t}function w(t,e){let o=document.createElement("script");o.id=t,o.src=e,o.async=!0,document.body.appendChild(o)}function H(t,e){let o=document.createElement("script");o.id=t,o.innerHTML=e,document.body.appendChild(o)}function se(t,e){return`${_}-${t}-${e}`}function D(t,e){for(let o of e){let n=se(t,o.id);document.getElementById(n)||(O(o)?w(n,o.src):$(o)&&H(n,o.code))}}function N(t){for(let e of t)e.scripts?.length&&D(e.id,e.scripts)}function F(t,e){for(let o of e){let n=`${_}-${t}-${o.id}`,i=document.getElementById(n);i&&i.remove()}}function ie(){return document.cookie.split(";").map(t=>t.trim().split("=")[0]).filter(Boolean)}function G(t){document.cookie=`${t}=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/`}function B(t){let e=ie();for(let{pattern:o}of t)if(typeof o=="string")G(o);else for(let n of e)o.test(n)&&G(n)}function J(t){for(let e of t)localStorage.removeItem(e)}function K(t){for(let e of t)sessionStorage.removeItem(e)}function X(t){for(let e of t)e.scripts?.length&&F(e.id,e.scripts),e.cookies?.length&&B(e.cookies),e.localStorage?.length&&J(e.localStorage),e.sessionStorage?.length&&K(e.sessionStorage)}function Y(t,e){let o={consent:t,hash:e,timestamp:Date.now()};localStorage.setItem(y,JSON.stringify(o))}function q(t,e,o,n){let i=t.filter(s=>o.includes(s.id)&&!e.includes(s.id)),r=t.filter(s=>!o.includes(s.id)&&e.includes(s.id));X(r),N(i),Y(o,n)}function pe(t){return t.customHash?t.customHash:ae(t.services.map(e=>({id:e.id,name:e.name})))}function z(t){let e=pe(t),{services:o}=t,[n,i]=V(()=>{let{consent:a,isValid:v}=R(e);return v?a:[]}),[r,s]=V(()=>{let{isValid:a}=R(e);return!a}),[c,l]=V(!1),g=ce(n);re(()=>{let a=o.filter(v=>n.includes(v.id));N(a)},[]);let C=h(a=>{let v=g.current;q(o,v,a,e),i(a),g.current=a},[o,e]),f=h(a=>n.includes(a),[n]),S=h(()=>s(!0),[]),d=h(()=>s(!1),[]),Q=h(()=>l(a=>!a),[]);return{consent:n,services:o,theme:t.theme??"light",isPopupVisible:r,isSettingsVisible:c,setConsent:C,hasConsent:f,showPopup:S,hidePopup:d,toggleSettings:Q}}import{jsx as de}from"react/jsx-runtime";function le({options:t,children:e}){let o=z(t);return de(b.Provider,{value:o,children:e})}export{b as ConsentContext,ne as ConsentPopup,le as ConsentProvider,k as ConsentSettings,p as useConsent};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-cookie-consent-popup",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.4",
|
|
4
4
|
"description": "A React cookie consent popup component with centered modal dialog, service management, script loading, and light/dark theme support",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -11,14 +11,25 @@
|
|
|
11
11
|
"url": "https://github.com/Mas-HJ/react-cookie-consent-popup/issues"
|
|
12
12
|
},
|
|
13
13
|
"main": "./dist/index.js",
|
|
14
|
+
"module": "./dist/index.mjs",
|
|
14
15
|
"types": "./dist/index.d.ts",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/index.d.ts",
|
|
19
|
+
"import": "./dist/index.mjs",
|
|
20
|
+
"require": "./dist/index.js"
|
|
21
|
+
},
|
|
22
|
+
"./dist/*": "./dist/*"
|
|
23
|
+
},
|
|
24
|
+
"sideEffects": false,
|
|
15
25
|
"files": [
|
|
16
|
-
"dist"
|
|
26
|
+
"dist",
|
|
27
|
+
"LICENSE"
|
|
17
28
|
],
|
|
18
29
|
"scripts": {
|
|
19
|
-
"build": "
|
|
30
|
+
"build": "tsx esbuild.config.ts",
|
|
20
31
|
"postbuild": "tsc --emitDeclarationOnly",
|
|
21
|
-
"dev": "
|
|
32
|
+
"dev": "tsx esbuild.config.ts --watch",
|
|
22
33
|
"test": "jest",
|
|
23
34
|
"test:dev": "jest --watch",
|
|
24
35
|
"coverage": "jest --coverage"
|
|
@@ -75,6 +86,7 @@
|
|
|
75
86
|
"stylelint-prettier": "^5.0.0",
|
|
76
87
|
"ts-jest": "^29.1.2",
|
|
77
88
|
"ts-node": "^10.9.2",
|
|
89
|
+
"tsx": "^4.21.0",
|
|
78
90
|
"typescript": "^5.3.3"
|
|
79
91
|
}
|
|
80
92
|
}
|