From aee2463fd1a3be6db9097d308c985ca083e8931d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B6rn?= Date: Mon, 2 Mar 2020 22:53:46 +0100 Subject: [PATCH] adding --- dist/js/demo.js | 2 +- package.json | 2 +- src/TinyConsent.riot | 89 ++++++++++++++++++++++++-------------------- 3 files changed, 51 insertions(+), 42 deletions(-) diff --git a/dist/js/demo.js b/dist/js/demo.js index ac57419..88cea14 100644 --- a/dist/js/demo.js +++ b/dist/js/demo.js @@ -1 +1 @@ -!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=2)}([function(e,t,n){var o,r;!function(i){if(void 0===(r="function"==typeof(o=i)?o.call(t,n,t,e):o)||(e.exports=r),!0,e.exports=i(),!!0){var s=window.Cookies,a=window.Cookies=i();a.noConflict=function(){return window.Cookies=s,a}}}((function(){function e(){for(var e=0,t={};e"__proto__"!==e&&"constructor"!==e&&"prototype"!==e,s=e.exports=(e,...t)=>{let n=0;var o;for(("object"==typeof(o=e)?null===o:"function"!=typeof o)&&(e=t[n++]),e||(e={});n{if("function"!=typeof(n=e)&&"[object Object]"!==o.call(n)&&!Array.isArray(n))throw new TypeError("expected the first argument to be an object");var n;if(0===t.length||"function"!=typeof Symbol||"function"!=typeof i)return e;for(let n of t){let t=i(n);for(let o of t)r.call(n,o)&&(e[o]=n[o])}return e}},function(e,t,n){"use strict";n.r(t);const o=new Map,r=Symbol("riot-component"),i=new Set,s="mount",a="update",u="unmount",c=Symbol.for("pure"),l=Symbol("parent"),p=Symbol("attributes"),d=Symbol("template");var h=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:o,DOM_COMPONENT_INSTANCE_PROPERTY:r,PLUGINS_SET:i,IS_DIRECTIVE:"is",VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:s,UPDATE_METHOD_KEY:a,UNMOUNT_METHOD_KEY:u,SHOULD_UPDATE_KEY:"shouldUpdate",ON_BEFORE_MOUNT_KEY:"onBeforeMount",ON_MOUNTED_KEY:"onMounted",ON_BEFORE_UPDATE_KEY:"onBeforeUpdate",ON_UPDATED_KEY:"onUpdated",ON_BEFORE_UNMOUNT_KEY:"onBeforeUnmount",ON_UNMOUNTED_KEY:"onUnmounted",PROPS_KEY:"props",STATE_KEY:"state",SLOTS_KEY:"slots",ROOT_KEY:"root",IS_PURE_SYMBOL:c,PARENT_KEY_SYMBOL:l,ATTRIBUTES_KEY_SYMBOL:p,TEMPLATE_KEY_SYMBOL:d});function f(e){return typeof e==="function"}function m(){return this}function b(e){return f(e)?e.prototype&&e.prototype.constructor?new e:e():e}function x(e){Array.from(e).forEach(y)}function y(e){const{parentNode:t}=e;e.remove?e.remove():t&&t.removeChild(e)}var v={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4};var g={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};const{indexOf:_}=[],T=(e,t,n,o,r,i)=>{const s="selectedIndex"in t;let a=s;for(;oe==t,O=e=>e,N=(e,t,n,o,r,i,s)=>{const a=i-r;if(a<1)return-1;for(;n-t>=a;){let a=t,u=r;for(;an{for(;n{let o=1,r=t;for(;o>>0;n{((e,t,n,o,r,i,s,a,u)=>{const c=[],l=e.length;let p=s,d=0;for(;d{const a=n+i,u=[];let c,l,p,d,h,f,m;e:for(c=0;c<=a;c++){if(c>50)return null;for(m=c-1,h=c?u[c-1]:[0,0],f=u[c]=[],l=-c;l<=c;l+=2){for(d=l===-c||l!==c&&h[m+l-1]=0;c--){for(;d>0&&p>0&&s(o[r+d-1],e[t+p-1]);)b[x--]=0,d--,p--;if(!c)break;m=c-1,h=c?u[c-1]:[0,0],l=d-p,l===-c||l!==c&&h[m+l-1]{let u=0,c=os;)--u;c=a+o-u;const h=Array(c);let f=l[u];for(--n;f;){const{newi:e,oldi:t}=f;for(;n>e;)h[--c]=1,--n;for(;s>t;)h[--c]=-1,--s;h[--c]=0,--n,--s,f=f.prev}for(;n>=t;)h[--c]=1,--n;for(;s>=i;)h[--c]=-1,--s;return h})(n,o,r,i,s,a,u,c),e,t,n,o,s,a,l,d)},w=e=>(e.remove||I).call(e);function I(){const{parentNode:e}=this;e&&e.removeChild(this)}function M(e,t){return typeof e===t}function S(e){const t=e.ownerSVGElement;return!!t||null===t}function U(e){return!P(e.content)}function D(e){return M(e,"function")}function B(e){return!P(e)&&M(e,"object")}function P(e){return null==e}const R=Symbol("unmount"),L=Object.seal({nodes:[],mount(e,t){return this.update(e,t)},update(e,t){const{placeholder:n,nodes:o,childrenMap:r}=this,i=e===R?null:this.evaluate(e),s=i?Array.from(i):[],a=n.parentNode,{newChildrenMap:u,batches:c,futureNodes:l}=function(e,t,n,o){const{condition:r,template:i,childrenMap:s,itemName:a,getKey:u,indexName:c,root:l,isTemplateTag:p}=o,d=new Map,h=[],f=[];return e.forEach((e,o)=>{const m=function(e,t){let{itemName:n,indexName:o,index:r,item:i}=t;e[n]=i,o&&(e[o]=r);return e}(Object.create(t),{itemName:a,indexName:c,index:o,item:e}),b=u?u(m):o,x=s.get(b);if(function(e,t){return!!e&&!1===Boolean(e(t))}(r,m))return;const y=x?x.template:i.clone(),v=x?y.el:l.cloneNode(),g=!x,_=p&&g?function(e){const t=e.dom.cloneNode(!0);return{avoidDOMInjection:!0,fragment:t,children:Array.from(t.childNodes)}}(y):{};if(g?h.push(()=>y.mount(v,m,n,_)):h.push(()=>y.update(m,n)),p){const e=_.children||y.children;f.push(...e),e.forEach(e=>d.set(e,null))}else f.push(v);s.delete(b),d.set(b,{template:y,context:m,index:o})}),{newChildrenMap:d,batches:h,futureNodes:f}}(s,e,t,this);return((e,t,n,o)=>{o||(o={});const r=o.compare||E,i=o.node||O,s=null==o.before?null:i(o.before,0),a=t.length;let u=a,c=0,l=n.length,p=0;for(;c{for(;oe()),this.childrenMap=u,this.nodes=l,this},unmount(e,t){return this.update(R,t),this}});function Y(e,t){return(n,o)=>{if(o<0){const n=e.pop();if(n){const{template:e,context:o}=n;e.unmount(o,t,null)}}return n}}const K=Object.seal({mount(e,t){return this.update(e,t)},update(e,t){const n=!!this.evaluate(e),o=!this.value&&n,r=this.value&&!n,i=()=>{const n=this.node.cloneNode();this.placeholder.parentNode.insertBefore(n,this.placeholder),this.template=this.template.clone(),this.template.mount(n,e,t)};switch(!0){case o:i();break;case r:this.unmount(e);break;default:n&&this.template.update(e,t)}return this.value=n,this},unmount(e,t){return this.template.unmount(e,t,!0),this}});const H="undefined"==typeof Element?{}:Element.prototype,F=function(e){const t=new Map,n=n=>t.has(n)?t.get(n):t.set(n,e.call(this,n))&&t.get(n);return n.cache=t,n}(e=>H.hasOwnProperty(e));function X(e,t,n,o){let{name:r}=t;r?(!F(r)&&(function(e){return M(e,"boolean")}(n)||B(n)||D(n))&&(e[r]=n),e[function(e){return P(e)||!1===e||""===e||B(e)||D(e)?"removeAttribute":"setAttribute"}(n)](r,function(e,t){return!0===t?e:t}(r,n))):n?function(e,t){Object.entries(t).forEach(t=>{let[n,o]=t;return X(e,{name:n},o)})}(e,n):o&&function(e,t){Object.keys(t).forEach(t=>e.removeAttribute(t))}(e,o)}const V=/^on/;function $(e){return P(e)?"":e}const z=(e,t)=>{const n=e.childNodes[t];if(n.nodeType===Node.COMMENT_NODE){const t=document.createTextNode("");return e.replaceChild(t,n),t}return n};var W={0:X,1:function(e,t,n,o){let{name:r}=t;const i=r.replace(V,"");o&&e.removeEventListener(i,o),n&&e.addEventListener(i,n,!1)},2:function(e,t,n){e.data=$(n)},3:function(e,t,n){e.value=$(n)}};const q=Object.seal({mount(e){return this.value=this.evaluate(e),G(this,this.value),this},update(e){const t=this.evaluate(e);return this.value!==t&&(G(this,t),this.value=t),this},unmount(){return 1===this.type&&G(this,null),this}});function G(e,t){return W[e.type](e.node,e,t,e.value)}function J(e,t){return Object.assign({},q,{},t,{node:2===t.type?z(e,t.childNodeIndex):e})}function Z(e,t,n){if(!e||!e.length)return n;const o=e.map(e=>Object.assign({},e,{value:e.evaluate(t)}));return Object.assign(Object.create(n||null),function(e){return e.reduce((e,t)=>{const{value:n,type:o}=t;switch(!0){case!t.name&&0===o:return Object.assign({},e,{},n);case 3===o:e.value=t.value;break;default:e[(r=t.name,r.replace(/-(\w)/g,(e,t)=>t.toUpperCase()))]=t.value}var r;return e},{})}(o))}const Q=Object.seal({attributes:[],getTemplateScope(e,t){return Z(this.attributes,e,t)},mount(e,t){const n=!!e.slots&&e.slots.find(e=>{let{id:t}=e;return t===this.name}),{parentNode:o}=this.node;return this.template=n&&ae(n.html,n.bindings).createDOM(o),this.template&&(this.template.mount(this.node,this.getTemplateScope(e,t)),this.template.children=function e(t,n){void 0===n&&(n=[]);const o=t.firstChild;if(o)return t.parentNode.insertBefore(o,t),[o,...e(t)];return n}(this.node)),y(this.node),this},update(e,t){return this.template&&this.template.update(this.getTemplateScope(e,t)),this},unmount(e,t,n){return this.template&&this.template.unmount(this.getTemplateScope(e,t),null,n),this}});function ee(e){return e.reduce((e,t)=>{let{bindings:n}=t;return e.concat(n)},[])}const te=Object.seal({mount(e){return this.update(e)},update(e,t){const n=this.evaluate(e);return n===this.name?this.tag.update(e):(this.unmount(e,t,!0),this.name=n,this.tag=function(e,t,n){return void 0===t&&(t=[]),void 0===n&&(n=[]),e?e({slots:t,attributes:n}):ae(function(e){return e.reduce((e,t)=>e+t.html,"")}(t),[...ee(t),{expressions:n.map(e=>Object.assign({type:0},e))}])}(this.getComponent(n),this.slots,this.attributes),this.tag.mount(this.node,e)),this},unmount(e,t,n){return this.tag&&this.tag.unmount(n),this}});var ne={1:function(e,t){let{evaluate:n,template:o}=t;const r=e.parentNode,i=document.createTextNode("");return r.insertBefore(i,e),y(e),Object.assign({},K,{node:e,evaluate:n,placeholder:i,template:o.createDOM(e)})},2:function(e,t){let{expressions:n}=t;return Object.assign({},(o=n.map(t=>J(e,t)),["mount","update","unmount"].reduce((e,t)=>Object.assign({},e,{[t]:e=>o.map(n=>n[t](e))&&r}),{})));var o,r},0:function(e,t){let{evaluate:n,condition:o,itemName:r,indexName:i,getKey:s,template:a}=t;const u=document.createTextNode(""),c=e.parentNode,l=e.cloneNode();return c.insertBefore(u,e),y(e),Object.assign({},L,{childrenMap:new Map,node:e,root:l,condition:o,evaluate:n,isTemplateTag:U(l),template:a.createDOM(e),getKey:s,indexName:i,itemName:r,placeholder:u})},3:function(e,t){let{evaluate:n,getComponent:o,slots:r,attributes:i}=t;return Object.assign({},te,{node:e,evaluate:n,slots:r,attributes:i,getComponent:o})},4:function(e,t){let{name:n,attributes:o}=t;return Object.assign({},Q,{attributes:o,node:e,name:n})}};function oe(e,t){return e.map(e=>2===e.type?Object.assign({},e,{childNodeIndex:e.childNodeIndex+t}):e)}function re(e,t){return S(e)?function(e,t){return t.ownerDocument.importNode((new window.DOMParser).parseFromString(`${e}`,"application/xml").documentElement,!0)}(t,e):function(e,t){const n=U(t)?t:document.createElement("template");return n.innerHTML=e,n.content}(t,e)}function ie(e,t){switch(!0){case S(e):!function e(t,n){t.firstChild&&(n.appendChild(t.firstChild),e(t,n))}(t,e);break;case U(e):e.parentNode.replaceChild(t,e);break;default:e.appendChild(t)}}const se=Object.freeze({createDOM(e){return this.dom=this.dom||function(e,t){return t&&("string"==typeof t?re(e,t):t)}(e,this.html),this},mount(e,t,n,o){if(void 0===o&&(o={}),!e)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(t);const{fragment:r,children:i,avoidDOMInjection:s}=o,{parentNode:a}=i?i[0]:e,u=U(e),c=u?Math.max(Array.from(a.children).indexOf(e),0):null;return this.isTemplateTag=u,this.createDOM(e),this.dom&&(this.fragment=r||this.dom.cloneNode(!0)),this.el=this.isTemplateTag?a:e,this.children=this.isTemplateTag?i||Array.from(this.fragment.childNodes):null,!s&&this.fragment&&ie(e,this.fragment),this.bindings=this.bindingsData.map(e=>function(e,t,n){const{selector:o,type:r,redundantAttribute:i,expressions:s}=t,a=o?e.querySelector(o):e;i&&a.removeAttribute(i);const u=s||[];return(ne[r]||ne[2])(a,Object.assign({},t,{expressions:n&&!o?oe(u,n):u}))}(this.el,e,c)),this.bindings.forEach(e=>e.mount(t,n)),this},update(e,t){return this.bindings.forEach(n=>n.update(e,t)),this},unmount(e,t,n){if(this.el){switch(this.bindings.forEach(o=>o.unmount(e,t,n)),!0){case this.children&&null!==n:x(this.children);break;case!0===n:y(this.el);break;case null!==n:x(this.el.childNodes)}this.el=null}return this},clone(){return Object.assign({},this,{el:null})}});function ae(e,t){return void 0===t&&(t=[]),Object.assign({},se,{html:e,bindingsData:t})}function ue(e,t,n,o){return void 0===o&&(o={}),Object.defineProperty(e,t,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},o)),e}function ce(e,t,n){return Object.entries(t).forEach(t=>{let[o,r]=t;ue(e,o,r,n)}),e}function le(e,t){return Object.entries(t).forEach(t=>{let[n,o]=t;e[n]||(e[n]=o)}),e}function pe(e){return e.replace(/-(\w)/g,(e,t)=>t.toUpperCase())}function de(e){throw new Error(e)}function he(e){return e.reduce((e,t)=>{const{value:n,type:o}=t;switch(!0){case!t.name&&0===o:return Object.assign({},e,{},n);case 3===o:e.value=t.value;break;default:e[pe(t.name)]=t.value}return e},{})}function fe(e){return Array.isArray(e)?e:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e))&&"number"==typeof e.length?Array.from(e):[e]}function me(e,t){return fe("string"==typeof e?(t||document).querySelectorAll(e):e)}const be=e=>1===e.length?e[0]:e;function xe(e,t,n){const o="object"==typeof t?t:{[t]:n},r=Object.keys(o);return fe(e).forEach(e=>{r.forEach(t=>e.setAttribute(t,o[t]))}),e}function ye(e,t){return function(e,t,n){const o="string"==typeof t?[t]:t;return be(fe(e).map(e=>be(o.map(t=>e[n](t)))))}(e,t,"getAttribute")}const ve=new Map,ge=()=>_e||(xe(_e=me("style[riot]")[0]||document.createElement("style"),"type","text/css"),_e.parentNode||document.head.appendChild(_e),_e);var _e,Te={CSS_BY_NAME:ve,add(e,t){return ve.has(e)||(ve.set(e,t),this.inject()),this},inject(){return ge().innerHTML=[...ve.values()].join("\n"),this},remove(e){return ve.has(e)&&(ve.delete(e),this.inject()),this}};function Ee(e){return ye(e,"is")||e.tagName.toLowerCase()}const Oe=Object.freeze({$(e){return me(e,this.root)[0]},$$(e){return me(e,this.root)}}),Ne=Object.freeze({[s]:m,[a]:m,[u]:m}),je=Object.freeze({shouldUpdate:m,onBeforeMount:m,onMounted:m,onBeforeUpdate:m,onUpdated:m,onBeforeUnmount:m,onUnmounted:m}),ke=Object.assign({},Ne,{clone:m,createDOM:m});function Ae(e){return[s,a,u].reduce((t,n)=>(t[n]=e(n),t),{})}function Ce(e){let{css:t,template:n,exports:r,name:i}=e;const s=n?function(e,t){return e(ae,g,v,e=>t[e]||o.get(e))}(n,r?function(e){void 0===e&&(e={});return Object.entries(b(e)).reduce((e,t)=>{let[n,o]=t;var r;return e[(r=n,r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Ce(o),e},{})}(r.components):{}):ke;return e=>{let{slots:o,attributes:a,props:u}=e;if(r&&r[c])return function(e,t){let{slots:n,attributes:o,props:r,css:i,template:s}=t;s&&de("Pure components can not have html"),i&&de("Pure components do not have css");const a=le(e({slots:n,attributes:o,props:r}),Ne);return Ae(e=>function(){return a[e](...arguments),a})}(r,{slots:o,attributes:a,props:u,css:t,template:n});const l=b(r)||{},p=we({css:t,template:s,componentAPI:l,name:i})({slots:o,attributes:a,props:u});return{mount:(e,t,n)=>p.mount(e,n,t),update:(e,t)=>p.update(t,e),unmount:e=>p.unmount(e)}}}function we(e){let{css:t,template:n,componentAPI:o,name:r}=e;return t&&r&&Te.add(r,t),function e(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;rt(e)||e,e)}(ce(Object.create(e),{mount(t,i,a){return void 0===i&&(i={}),this[p]=function(e,t){void 0===t&&(t=[]);const n=t.map(t=>J(e,t)),o={};return Object.assign(o,Object.assign({expressions:n},Ae(e=>t=>(n.forEach(n=>n[e](t)),o))))}(t,o).mount(a),ue(this,"props",Object.freeze(Object.assign({},s,{},he(this[p].expressions)))),this.state=Ie(this.state,i),this[d]=this.template.createDOM(t).clone(),t[r]=this,e.name&&function(e,t){Ee(e)!==t&&xe(e,"is",t)}(t,e.name),ue(this,"root",t),ue(this,"slots",n),this.onBeforeMount(this.props,this.state),this[d].mount(t,this,a),this[l]=a,this.onMounted(this.props,this.state),this},update(e,t){void 0===e&&(e={}),t&&this[p].update(t);const n=he(this[p].expressions);if(!1!==this.shouldUpdate(n,this.props))return ue(this,"props",Object.freeze(Object.assign({},s,{},n))),this.state=Ie(this.state,e),this.onBeforeUpdate(this.props,this.state),this[d].update(this,this[l]),this.onUpdated(this.props,this.state),this},unmount(e){return this.onBeforeUnmount(this.props,this.state),this[p].unmount(),this[d].unmount(this,this[l],null===e?null:!e),this.onUnmounted(this.props,this.state),this}})),Object.keys(e).filter(t=>f(e[t])).forEach(e=>{a[e]=a[e].bind(a)}),a;var a}const{DOM_COMPONENT_INSTANCE_PROPERTY:Se,COMPONENTS_IMPLEMENTATION_MAP:Ue,PLUGINS_SET:De}=h;function Be(e,t){return void 0===t&&(t=[]),Object.assign({},function(e){return Array.from(e.attributes).reduce((e,t)=>(e[pe(t.name)]=t.value,e),{})}(e),{},b(t))}function Pe(e,t){let{css:n,template:o,exports:r}=t;return Ue.has(e)&&de(`The component "${e}" was already registered`),Ue.set(e,Ce({name:e,css:n,template:o,exports:r})),Ue}function Re(e,t,n){return me(e).map(e=>function(e,t,n){const r=n||Ee(e);return o.has(r)||de(`The component named "${r}" was never registered`),o.get(r)({props:t}).mount(e)}(e,Be(e,t),n))}var Le=n(0),Ye=n.n(Le),Ke=n(1),He=n.n(Ke),Fe={css:null,exports:{state:{options:{messages:{open:"Open"}}},handleOpen(e){e.preventDefault(),window.dispatchEvent(new window.CustomEvent("tiny-consent-open"))}},template:function(e,t,n,o){return e('',[{redundantAttribute:"expr22",selector:"[expr22]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.messages.open].join("")}},{type:t.EVENT,name:"onclick",evaluate:function(e){return e.handleOpen}}]}])},name:"tiny-consent-button"};Pe("tiny-consent",{css:null,exports:{state:{options:{cookie_name:"tiny_consent",text:{title:"Cookies",content:"We are using Cookies and display that was we use, also there are cookies you can accept or reject",title__default:"Essential",button__agree:"Yes",button__reject:"No",button__ok:"Ok",button__close:"Close",footer__name:"Cookie Name",footer__provider:"Provider",footer__duration:"Cookie Duration",footer__privacy_policy:"Privacy Policy"},offsetLineHeight:1.15},isOpen:!1,hasChanged:!1,cookies:{}},getData(){let e=Ye.a.getJSON(this.state.options.cookie_name);return e||(e={}),e},getAgreeClasses(e){let t=["button","button--agree","tiny-consent__button"];return!0===this.getData()[e.id]&&t.push("button--active"),t.join(" ")},getRejectClasses(e){let t=["button","button--reject","tiny-consent__button"];return!1===this.getData()[e.id]&&t.push("button--active"),t.join(" ")},getWrapperClasses(e){let t=["tiny-consent__wrapper"];return!1===data[e.id]&&t.push("button--active"),t.join(" ")},handleToogle(e){e.preventDefault();let t=e.target;e.target.nextElementSibling||(t=e.target.parentNode);const n=t.nextElementSibling.childNodes[0].offsetHeight*this.state.options.offsetLineHeight;t.classList.toggle("tiny-consent__cookie-accordion-header--open"),t.nextElementSibling.style.maxHeight?t.nextElementSibling.style.maxHeight="":t.nextElementSibling.style.maxHeight=n+"px"},isOk(){let e=this.getData(),t=!0;return this.state.cookies.default.forEach(n=>{!0!==e[n.id]&&(t=!1)}),t},onMounted(){window.addEventListener("tiny-consent-open",()=>{this.root.firstChild.style.bottom="0px",this.update()}),this.root.firstChild.style.bottom=-this.root.firstChild.offsetHeight+"px",this.root.firstChild.style.visibility="visible",window.requestAnimationFrame(()=>{this.root.firstChild.classList.add("tiny-consent--animation"),!0===this.state.hasChanged&&(this.root.firstChild.style.bottom="0px")});const e=this.$(".button--ok.tiny-consent__button:not([disabled])");e&&e.click()},onBeforeMount(){const e=this.getData();this.props.options&&(this.state.options=He()(this.state.options,this.props.options)),0===Object.entries(e).length&&(this.state.hasChanged=!0),this.props.cookies.forEach((t,n)=>{!0===e[t.id]||!1===e[t.id]?(!0===e[t.id]&&t.handleAgree?t.handleAgree():!1===e[t.id]&&t.handleReject&&t.handleReject(),t.hasConsent=!0):(this.state.hasChanged=!0,t.hasConsent=!1),t.default?(this.state.cookies.default||(this.state.cookies.default=[]),this.state.cookies.default.push(t)):(this.state.cookies.other||(this.state.cookies.other=[]),this.state.cookies.other.push(t))})},onBeforeUpdate(){if(!0===this.state.hasChanged){let e=!0;this.props.cookies.forEach(t=>{!0!==t.hasConsent&&(e=!1)}),!0===e&&(this.state.isOpen=!1)}},handleAgree(e,t,n){e.preventDefault();let o=this.getData();t.handleAgree&&t.handleAgree(),o[t.id]=!0,Ye.a.set(this.state.options.cookie_name,o),this.update()},handleReject(e,t,n){e.preventDefault();let o=this.getData();t.handleReject&&t.handleReject(),o[t.id]=!1,Ye.a.set(this.state.options.cookie_name,o),this.update()},handleDefault(e){e.preventDefault();let t=this.getData();this.state.cookies.default.forEach((e,n)=>{t[e.id]=!0}),Ye.a.set(this.state.options.cookie_name,t),this.update()},handleClose(e){e.preventDefault(),this.root.firstChild.style.bottom=this.root.firstChild.style.bottom=-this.root.firstChild.offsetHeight+"px",this.update()}},template:function(e,t,n,o){return e('',[{redundantAttribute:"expr0",selector:"[expr0]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.title].join("")}}]},{type:n.IF,evaluate:function(e){return e.state.options.text.content},redundantAttribute:"expr1",selector:"[expr1]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.content].join("")}}]}])},{redundantAttribute:"expr2",selector:"[expr2]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.button__close].join("")}},{type:t.EVENT,name:"onclick",evaluate:function(e){return e.handleClose}}]},{type:n.EACH,getKey:null,condition:null,template:e('
',[{expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-group"}}]},{type:n.IF,evaluate:function(e){return"default"===e.group[0]&&e.group[1].length>1},redundantAttribute:"expr4",selector:"[expr4]",template:e(' ',[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.title__default," (",e.group[1].length,")"].join("")}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-accordion-header"}},{type:t.EVENT,name:"onclick",evaluate:function(e){return t=>{e.handleToogle(t)}}}]}])},{redundantAttribute:"expr5",selector:"[expr5]",expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return["tiny-consent__cookie-accordion","default"===e.group[0]&&e.group[1].length>1?" tiny-consent__cookie-accordion--active":""].join("")}}]},{type:n.EACH,getKey:null,condition:null,template:e('',[{expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-wrapper"}}]},{redundantAttribute:"expr7",selector:"[expr7]",expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.content].join("")}}]},{type:n.IF,evaluate:function(e){return e.cookie.title},redundantAttribute:"expr8",selector:"[expr8]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.cookie.title}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-title"}}]}])},{type:n.IF,evaluate:function(e){return e.cookie.provider},redundantAttribute:"expr9",selector:"[expr9]",template:e(' ',[{expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.provider].join("")}}]},{redundantAttribute:"expr10",selector:"[expr10]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.footer__provider}}]}])},{type:n.IF,evaluate:function(e){return e.cookie.name},redundantAttribute:"expr11",selector:"[expr11]",template:e(' ',[{expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.name].join("")}}]},{redundantAttribute:"expr12",selector:"[expr12]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.footer__name}}]}])},{type:n.IF,evaluate:function(e){return e.cookie.duration},redundantAttribute:"expr13",selector:"[expr13]",template:e(' ',[{expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.duration].join("")}}]},{redundantAttribute:"expr14",selector:"[expr14]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.footer__duration}}]}])},{type:n.IF,evaluate:function(e){return e.cookie.privacy_policy},redundantAttribute:"expr15",selector:"[expr15]",template:e(' ',[{redundantAttribute:"expr16",selector:"[expr16]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.footer__url}},{type:t.ATTRIBUTE,name:"href",evaluate:function(e){return e.cookie.privacy_policy}}]}])},{type:n.IF,evaluate:function(e){return"other"===e.group[0]},redundantAttribute:"expr17",selector:"[expr17]",template:e('',[{expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-decision"}}]},{redundantAttribute:"expr18",selector:"[expr18]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.button__agree].join("")}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return e.getAgreeClasses(e.cookie)}},{type:t.EVENT,name:"onclick",evaluate:function(e){return t=>{e.handleAgree(t,e.cookie,e.index)}}}]},{type:n.IF,evaluate:function(e){return"other"===e.group[0]},redundantAttribute:"expr19",selector:"[expr19]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.button__reject].join("")}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return e.getRejectClasses(e.cookie)}},{type:t.EVENT,name:"onclick",evaluate:function(e){return t=>{e.handleReject(t,e.cookie,e.index)}}}]}])}])},{type:n.IF,evaluate:function(e){return"default"===e.group[0]&&e.index===e.group[1].length-1},redundantAttribute:"expr20",selector:"[expr20]",template:e('',[{expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-decision"}}]},{redundantAttribute:"expr21",selector:"[expr21]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.button__ok].join("")}},{type:t.ATTRIBUTE,name:"disabled",evaluate:function(e){return e.isOk()}},{type:t.EVENT,name:"onclick",evaluate:function(e){return t=>{e.handleDefault(t,e.cookies)}}}]}])}]),redundantAttribute:"expr6",selector:"[expr6]",itemName:"cookie",indexName:"index",evaluate:function(e){return e.group[1]}}]),redundantAttribute:"expr3",selector:"[expr3]",itemName:"group",indexName:null,evaluate:function(e){return Object.entries(e.state.cookies)}}])},name:"tiny-consent"}),Pe("tiny-consent-button",Fe),Re("tiny-consent",{text:{content:void 0},cookies:[{title:"Matomo",name:"matamo_",id:"matamo",content:"Cookie from Matamo for Website-Analytics. Creates statiscial Data how the User uses this Website",provider:"Tentakelfabrik.de",duration:"1 Year",privacy_policy:"https://tentakelfabrik.de/datenschutzerklarung",handleAgree:function(){console.log("agree")},handleReject:function(){console.log("reject")}},{title:"Tiny Consent",id:"tiny_consent",name:"tiny_consent",content:"Saves the Settings of Cookies from Tiny Consent",provider:"Owner of this Site",duration:"1 Year",default:!0},{title:"Wordpress mit WooCommerce",id:"wordpress_woocommerce",name:"woocommerce_cart_hash, woocommerce_items_in_cart, wp_woocommerce_session_, tk_ai",content:"Handle Login of User and Cart of WooCommerce Shop",provider:"Owner of this Site",duration:"Session",default:!0}]}),Re("tiny-consent-button")},function(e,t){}]); \ No newline at end of file +!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=2)}([function(e,t,n){var o,r;!function(i){if(void 0===(r="function"==typeof(o=i)?o.call(t,n,t,e):o)||(e.exports=r),!0,e.exports=i(),!!0){var s=window.Cookies,a=window.Cookies=i();a.noConflict=function(){return window.Cookies=s,a}}}((function(){function e(){for(var e=0,t={};e"__proto__"!==e&&"constructor"!==e&&"prototype"!==e,s=e.exports=(e,...t)=>{let n=0;var o;for(("object"==typeof(o=e)?null===o:"function"!=typeof o)&&(e=t[n++]),e||(e={});n{if("function"!=typeof(n=e)&&"[object Object]"!==o.call(n)&&!Array.isArray(n))throw new TypeError("expected the first argument to be an object");var n;if(0===t.length||"function"!=typeof Symbol||"function"!=typeof i)return e;for(let n of t){let t=i(n);for(let o of t)r.call(n,o)&&(e[o]=n[o])}return e}},function(e,t,n){"use strict";n.r(t);const o=new Map,r=Symbol("riot-component"),i=new Set,s="mount",a="update",u="unmount",c=Symbol.for("pure"),l=Symbol("parent"),p=Symbol("attributes"),d=Symbol("template");var h=Object.freeze({__proto__:null,COMPONENTS_IMPLEMENTATION_MAP:o,DOM_COMPONENT_INSTANCE_PROPERTY:r,PLUGINS_SET:i,IS_DIRECTIVE:"is",VALUE_ATTRIBUTE:"value",MOUNT_METHOD_KEY:s,UPDATE_METHOD_KEY:a,UNMOUNT_METHOD_KEY:u,SHOULD_UPDATE_KEY:"shouldUpdate",ON_BEFORE_MOUNT_KEY:"onBeforeMount",ON_MOUNTED_KEY:"onMounted",ON_BEFORE_UPDATE_KEY:"onBeforeUpdate",ON_UPDATED_KEY:"onUpdated",ON_BEFORE_UNMOUNT_KEY:"onBeforeUnmount",ON_UNMOUNTED_KEY:"onUnmounted",PROPS_KEY:"props",STATE_KEY:"state",SLOTS_KEY:"slots",ROOT_KEY:"root",IS_PURE_SYMBOL:c,PARENT_KEY_SYMBOL:l,ATTRIBUTES_KEY_SYMBOL:p,TEMPLATE_KEY_SYMBOL:d});function f(e){return typeof e==="function"}function m(){return this}function b(e){return f(e)?e.prototype&&e.prototype.constructor?new e:e():e}function x(e){Array.from(e).forEach(y)}function y(e){const{parentNode:t}=e;e.remove?e.remove():t&&t.removeChild(e)}var v={EACH:0,IF:1,SIMPLE:2,TAG:3,SLOT:4};var g={ATTRIBUTE:0,EVENT:1,TEXT:2,VALUE:3};const{indexOf:_}=[],T=(e,t,n,o,r,i)=>{const s="selectedIndex"in t;let a=s;for(;oe==t,O=e=>e,N=(e,t,n,o,r,i,s)=>{const a=i-r;if(a<1)return-1;for(;n-t>=a;){let a=t,u=r;for(;an{for(;n{let o=1,r=t;for(;o>>0;n{((e,t,n,o,r,i,s,a,u)=>{const c=[],l=e.length;let p=s,d=0;for(;d{const a=n+i,u=[];let c,l,p,d,h,f,m;e:for(c=0;c<=a;c++){if(c>50)return null;for(m=c-1,h=c?u[c-1]:[0,0],f=u[c]=[],l=-c;l<=c;l+=2){for(d=l===-c||l!==c&&h[m+l-1]=0;c--){for(;d>0&&p>0&&s(o[r+d-1],e[t+p-1]);)b[x--]=0,d--,p--;if(!c)break;m=c-1,h=c?u[c-1]:[0,0],l=d-p,l===-c||l!==c&&h[m+l-1]{let u=0,c=os;)--u;c=a+o-u;const h=Array(c);let f=l[u];for(--n;f;){const{newi:e,oldi:t}=f;for(;n>e;)h[--c]=1,--n;for(;s>t;)h[--c]=-1,--s;h[--c]=0,--n,--s,f=f.prev}for(;n>=t;)h[--c]=1,--n;for(;s>=i;)h[--c]=-1,--s;return h})(n,o,r,i,s,a,u,c),e,t,n,o,s,a,l,d)},C=e=>(e.remove||w).call(e);function w(){const{parentNode:e}=this;e&&e.removeChild(this)}function M(e,t){return typeof e===t}function S(e){const t=e.ownerSVGElement;return!!t||null===t}function U(e){return!P(e.content)}function D(e){return M(e,"function")}function B(e){return!P(e)&&M(e,"object")}function P(e){return null==e}const R=Symbol("unmount"),L=Object.seal({nodes:[],mount(e,t){return this.update(e,t)},update(e,t){const{placeholder:n,nodes:o,childrenMap:r}=this,i=e===R?null:this.evaluate(e),s=i?Array.from(i):[],a=n.parentNode,{newChildrenMap:u,batches:c,futureNodes:l}=function(e,t,n,o){const{condition:r,template:i,childrenMap:s,itemName:a,getKey:u,indexName:c,root:l,isTemplateTag:p}=o,d=new Map,h=[],f=[];return e.forEach((e,o)=>{const m=function(e,t){let{itemName:n,indexName:o,index:r,item:i}=t;e[n]=i,o&&(e[o]=r);return e}(Object.create(t),{itemName:a,indexName:c,index:o,item:e}),b=u?u(m):o,x=s.get(b);if(function(e,t){return!!e&&!1===Boolean(e(t))}(r,m))return;const y=x?x.template:i.clone(),v=x?y.el:l.cloneNode(),g=!x,_=p&&g?function(e){const t=e.dom.cloneNode(!0);return{avoidDOMInjection:!0,fragment:t,children:Array.from(t.childNodes)}}(y):{};if(g?h.push(()=>y.mount(v,m,n,_)):h.push(()=>y.update(m,n)),p){const e=_.children||y.children;f.push(...e),e.forEach(e=>d.set(e,null))}else f.push(v);s.delete(b),d.set(b,{template:y,context:m,index:o})}),{newChildrenMap:d,batches:h,futureNodes:f}}(s,e,t,this);return((e,t,n,o)=>{o||(o={});const r=o.compare||E,i=o.node||O,s=null==o.before?null:i(o.before,0),a=t.length;let u=a,c=0,l=n.length,p=0;for(;c{for(;oe()),this.childrenMap=u,this.nodes=l,this},unmount(e,t){return this.update(R,t),this}});function Y(e,t){return(n,o)=>{if(o<0){const n=e.pop();if(n){const{template:e,context:o}=n;e.unmount(o,t,null)}}return n}}const K=Object.seal({mount(e,t){return this.update(e,t)},update(e,t){const n=!!this.evaluate(e),o=!this.value&&n,r=this.value&&!n,i=()=>{const n=this.node.cloneNode();this.placeholder.parentNode.insertBefore(n,this.placeholder),this.template=this.template.clone(),this.template.mount(n,e,t)};switch(!0){case o:i();break;case r:this.unmount(e);break;default:n&&this.template.update(e,t)}return this.value=n,this},unmount(e,t){return this.template.unmount(e,t,!0),this}});const F="undefined"==typeof Element?{}:Element.prototype,H=function(e){const t=new Map,n=n=>t.has(n)?t.get(n):t.set(n,e.call(this,n))&&t.get(n);return n.cache=t,n}(e=>F.hasOwnProperty(e));function X(e,t,n,o){let{name:r}=t;r?(!H(r)&&(function(e){return M(e,"boolean")}(n)||B(n)||D(n))&&(e[r]=n),e[function(e){return P(e)||!1===e||""===e||B(e)||D(e)?"removeAttribute":"setAttribute"}(n)](r,function(e,t){return!0===t?e:t}(r,n))):n?function(e,t){Object.entries(t).forEach(t=>{let[n,o]=t;return X(e,{name:n},o)})}(e,n):o&&function(e,t){Object.keys(t).forEach(t=>e.removeAttribute(t))}(e,o)}const V=/^on/;function z(e){return P(e)?"":e}const $=(e,t)=>{const n=e.childNodes[t];if(n.nodeType===Node.COMMENT_NODE){const t=document.createTextNode("");return e.replaceChild(t,n),t}return n};var W={0:X,1:function(e,t,n,o){let{name:r}=t;const i=r.replace(V,"");o&&e.removeEventListener(i,o),n&&e.addEventListener(i,n,!1)},2:function(e,t,n){e.data=z(n)},3:function(e,t,n){e.value=z(n)}};const q=Object.seal({mount(e){return this.value=this.evaluate(e),G(this,this.value),this},update(e){const t=this.evaluate(e);return this.value!==t&&(G(this,t),this.value=t),this},unmount(){return 1===this.type&&G(this,null),this}});function G(e,t){return W[e.type](e.node,e,t,e.value)}function J(e,t){return Object.assign({},q,{},t,{node:2===t.type?$(e,t.childNodeIndex):e})}function Z(e,t,n){if(!e||!e.length)return n;const o=e.map(e=>Object.assign({},e,{value:e.evaluate(t)}));return Object.assign(Object.create(n||null),function(e){return e.reduce((e,t)=>{const{value:n,type:o}=t;switch(!0){case!t.name&&0===o:return Object.assign({},e,{},n);case 3===o:e.value=t.value;break;default:e[(r=t.name,r.replace(/-(\w)/g,(e,t)=>t.toUpperCase()))]=t.value}var r;return e},{})}(o))}const Q=Object.seal({attributes:[],getTemplateScope(e,t){return Z(this.attributes,e,t)},mount(e,t){const n=!!e.slots&&e.slots.find(e=>{let{id:t}=e;return t===this.name}),{parentNode:o}=this.node;return this.template=n&&ae(n.html,n.bindings).createDOM(o),this.template&&(this.template.mount(this.node,this.getTemplateScope(e,t)),this.template.children=function e(t,n){void 0===n&&(n=[]);const o=t.firstChild;if(o)return t.parentNode.insertBefore(o,t),[o,...e(t)];return n}(this.node)),y(this.node),this},update(e,t){return this.template&&this.template.update(this.getTemplateScope(e,t)),this},unmount(e,t,n){return this.template&&this.template.unmount(this.getTemplateScope(e,t),null,n),this}});function ee(e){return e.reduce((e,t)=>{let{bindings:n}=t;return e.concat(n)},[])}const te=Object.seal({mount(e){return this.update(e)},update(e,t){const n=this.evaluate(e);return n===this.name?this.tag.update(e):(this.unmount(e,t,!0),this.name=n,this.tag=function(e,t,n){return void 0===t&&(t=[]),void 0===n&&(n=[]),e?e({slots:t,attributes:n}):ae(function(e){return e.reduce((e,t)=>e+t.html,"")}(t),[...ee(t),{expressions:n.map(e=>Object.assign({type:0},e))}])}(this.getComponent(n),this.slots,this.attributes),this.tag.mount(this.node,e)),this},unmount(e,t,n){return this.tag&&this.tag.unmount(n),this}});var ne={1:function(e,t){let{evaluate:n,template:o}=t;const r=e.parentNode,i=document.createTextNode("");return r.insertBefore(i,e),y(e),Object.assign({},K,{node:e,evaluate:n,placeholder:i,template:o.createDOM(e)})},2:function(e,t){let{expressions:n}=t;return Object.assign({},(o=n.map(t=>J(e,t)),["mount","update","unmount"].reduce((e,t)=>Object.assign({},e,{[t]:e=>o.map(n=>n[t](e))&&r}),{})));var o,r},0:function(e,t){let{evaluate:n,condition:o,itemName:r,indexName:i,getKey:s,template:a}=t;const u=document.createTextNode(""),c=e.parentNode,l=e.cloneNode();return c.insertBefore(u,e),y(e),Object.assign({},L,{childrenMap:new Map,node:e,root:l,condition:o,evaluate:n,isTemplateTag:U(l),template:a.createDOM(e),getKey:s,indexName:i,itemName:r,placeholder:u})},3:function(e,t){let{evaluate:n,getComponent:o,slots:r,attributes:i}=t;return Object.assign({},te,{node:e,evaluate:n,slots:r,attributes:i,getComponent:o})},4:function(e,t){let{name:n,attributes:o}=t;return Object.assign({},Q,{attributes:o,node:e,name:n})}};function oe(e,t){return e.map(e=>2===e.type?Object.assign({},e,{childNodeIndex:e.childNodeIndex+t}):e)}function re(e,t){return S(e)?function(e,t){return t.ownerDocument.importNode((new window.DOMParser).parseFromString(`${e}`,"application/xml").documentElement,!0)}(t,e):function(e,t){const n=U(t)?t:document.createElement("template");return n.innerHTML=e,n.content}(t,e)}function ie(e,t){switch(!0){case S(e):!function e(t,n){t.firstChild&&(n.appendChild(t.firstChild),e(t,n))}(t,e);break;case U(e):e.parentNode.replaceChild(t,e);break;default:e.appendChild(t)}}const se=Object.freeze({createDOM(e){return this.dom=this.dom||function(e,t){return t&&("string"==typeof t?re(e,t):t)}(e,this.html),this},mount(e,t,n,o){if(void 0===o&&(o={}),!e)throw new Error("Please provide DOM node to mount properly your template");this.el&&this.unmount(t);const{fragment:r,children:i,avoidDOMInjection:s}=o,{parentNode:a}=i?i[0]:e,u=U(e),c=u?Math.max(Array.from(a.children).indexOf(e),0):null;return this.isTemplateTag=u,this.createDOM(e),this.dom&&(this.fragment=r||this.dom.cloneNode(!0)),this.el=this.isTemplateTag?a:e,this.children=this.isTemplateTag?i||Array.from(this.fragment.childNodes):null,!s&&this.fragment&&ie(e,this.fragment),this.bindings=this.bindingsData.map(e=>function(e,t,n){const{selector:o,type:r,redundantAttribute:i,expressions:s}=t,a=o?e.querySelector(o):e;i&&a.removeAttribute(i);const u=s||[];return(ne[r]||ne[2])(a,Object.assign({},t,{expressions:n&&!o?oe(u,n):u}))}(this.el,e,c)),this.bindings.forEach(e=>e.mount(t,n)),this},update(e,t){return this.bindings.forEach(n=>n.update(e,t)),this},unmount(e,t,n){if(this.el){switch(this.bindings.forEach(o=>o.unmount(e,t,n)),!0){case this.children&&null!==n:x(this.children);break;case!0===n:y(this.el);break;case null!==n:x(this.el.childNodes)}this.el=null}return this},clone(){return Object.assign({},this,{el:null})}});function ae(e,t){return void 0===t&&(t=[]),Object.assign({},se,{html:e,bindingsData:t})}function ue(e,t,n,o){return void 0===o&&(o={}),Object.defineProperty(e,t,Object.assign({value:n,enumerable:!1,writable:!1,configurable:!0},o)),e}function ce(e,t,n){return Object.entries(t).forEach(t=>{let[o,r]=t;ue(e,o,r,n)}),e}function le(e,t){return Object.entries(t).forEach(t=>{let[n,o]=t;e[n]||(e[n]=o)}),e}function pe(e){return e.replace(/-(\w)/g,(e,t)=>t.toUpperCase())}function de(e){throw new Error(e)}function he(e){return e.reduce((e,t)=>{const{value:n,type:o}=t;switch(!0){case!t.name&&0===o:return Object.assign({},e,{},n);case 3===o:e.value=t.value;break;default:e[pe(t.name)]=t.value}return e},{})}function fe(e){return Array.isArray(e)?e:/^\[object (HTMLCollection|NodeList|Object)\]$/.test(Object.prototype.toString.call(e))&&"number"==typeof e.length?Array.from(e):[e]}function me(e,t){return fe("string"==typeof e?(t||document).querySelectorAll(e):e)}const be=e=>1===e.length?e[0]:e;function xe(e,t,n){const o="object"==typeof t?t:{[t]:n},r=Object.keys(o);return fe(e).forEach(e=>{r.forEach(t=>e.setAttribute(t,o[t]))}),e}function ye(e,t){return function(e,t,n){const o="string"==typeof t?[t]:t;return be(fe(e).map(e=>be(o.map(t=>e[n](t)))))}(e,t,"getAttribute")}const ve=new Map,ge=()=>_e||(xe(_e=me("style[riot]")[0]||document.createElement("style"),"type","text/css"),_e.parentNode||document.head.appendChild(_e),_e);var _e,Te={CSS_BY_NAME:ve,add(e,t){return ve.has(e)||(ve.set(e,t),this.inject()),this},inject(){return ge().innerHTML=[...ve.values()].join("\n"),this},remove(e){return ve.has(e)&&(ve.delete(e),this.inject()),this}};function Ee(e){return ye(e,"is")||e.tagName.toLowerCase()}const Oe=Object.freeze({$(e){return me(e,this.root)[0]},$$(e){return me(e,this.root)}}),Ne=Object.freeze({[s]:m,[a]:m,[u]:m}),je=Object.freeze({shouldUpdate:m,onBeforeMount:m,onMounted:m,onBeforeUpdate:m,onUpdated:m,onBeforeUnmount:m,onUnmounted:m}),ke=Object.assign({},Ne,{clone:m,createDOM:m});function Ae(e){return[s,a,u].reduce((t,n)=>(t[n]=e(n),t),{})}function Ie(e){let{css:t,template:n,exports:r,name:i}=e;const s=n?function(e,t){return e(ae,g,v,e=>t[e]||o.get(e))}(n,r?function(e){void 0===e&&(e={});return Object.entries(b(e)).reduce((e,t)=>{let[n,o]=t;var r;return e[(r=n,r.replace(/([a-z])([A-Z])/g,"$1-$2").toLowerCase())]=Ie(o),e},{})}(r.components):{}):ke;return e=>{let{slots:o,attributes:a,props:u}=e;if(r&&r[c])return function(e,t){let{slots:n,attributes:o,props:r,css:i,template:s}=t;s&&de("Pure components can not have html"),i&&de("Pure components do not have css");const a=le(e({slots:n,attributes:o,props:r}),Ne);return Ae(e=>function(){return a[e](...arguments),a})}(r,{slots:o,attributes:a,props:u,css:t,template:n});const l=b(r)||{},p=Ce({css:t,template:s,componentAPI:l,name:i})({slots:o,attributes:a,props:u});return{mount:(e,t,n)=>p.mount(e,n,t),update:(e,t)=>p.update(t,e),unmount:e=>p.unmount(e)}}}function Ce(e){let{css:t,template:n,componentAPI:o,name:r}=e;return t&&r&&Te.add(r,t),function e(t){for(var n=arguments.length,o=new Array(n>1?n-1:0),r=1;rt(e)||e,e)}(ce(Object.create(e),{mount(t,i,a){return void 0===i&&(i={}),this[p]=function(e,t){void 0===t&&(t=[]);const n=t.map(t=>J(e,t)),o={};return Object.assign(o,Object.assign({expressions:n},Ae(e=>t=>(n.forEach(n=>n[e](t)),o))))}(t,o).mount(a),ue(this,"props",Object.freeze(Object.assign({},s,{},he(this[p].expressions)))),this.state=we(this.state,i),this[d]=this.template.createDOM(t).clone(),t[r]=this,e.name&&function(e,t){Ee(e)!==t&&xe(e,"is",t)}(t,e.name),ue(this,"root",t),ue(this,"slots",n),this.onBeforeMount(this.props,this.state),this[d].mount(t,this,a),this[l]=a,this.onMounted(this.props,this.state),this},update(e,t){void 0===e&&(e={}),t&&this[p].update(t);const n=he(this[p].expressions);if(!1!==this.shouldUpdate(n,this.props))return ue(this,"props",Object.freeze(Object.assign({},s,{},n))),this.state=we(this.state,e),this.onBeforeUpdate(this.props,this.state),this[d].update(this,this[l]),this.onUpdated(this.props,this.state),this},unmount(e){return this.onBeforeUnmount(this.props,this.state),this[p].unmount(),this[d].unmount(this,this[l],null===e?null:!e),this.onUnmounted(this.props,this.state),this}})),Object.keys(e).filter(t=>f(e[t])).forEach(e=>{a[e]=a[e].bind(a)}),a;var a}const{DOM_COMPONENT_INSTANCE_PROPERTY:Se,COMPONENTS_IMPLEMENTATION_MAP:Ue,PLUGINS_SET:De}=h;function Be(e,t){return void 0===t&&(t=[]),Object.assign({},function(e){return Array.from(e.attributes).reduce((e,t)=>(e[pe(t.name)]=t.value,e),{})}(e),{},b(t))}function Pe(e,t){let{css:n,template:o,exports:r}=t;return Ue.has(e)&&de(`The component "${e}" was already registered`),Ue.set(e,Ie({name:e,css:n,template:o,exports:r})),Ue}function Re(e,t,n){return me(e).map(e=>function(e,t,n){const r=n||Ee(e);return o.has(r)||de(`The component named "${r}" was never registered`),o.get(r)({props:t}).mount(e)}(e,Be(e,t),n))}var Le=n(0),Ye=n.n(Le),Ke=n(1),Fe=n.n(Ke),He={css:null,exports:{state:{options:{messages:{open:"Open"}}},handleOpen(e){e.preventDefault(),window.dispatchEvent(new window.CustomEvent("tiny-consent-open"))}},template:function(e,t,n,o){return e('',[{redundantAttribute:"expr24",selector:"[expr24]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.messages.open].join("")}},{type:t.EVENT,name:"onclick",evaluate:function(e){return e.handleOpen}}]}])},name:"tiny-consent-button"};Pe("tiny-consent",{css:null,exports:{state:{options:{cookie_name:"tiny_consent",text:{title:"Cookies",content:"We are using Cookies and display that was we use, also there are cookies you can accept or reject",title__default:"Essential",button__agree:"Yes",button__reject:"No",button__ok:"Ok",button__close:"Close",footer__name:"Cookie Name",footer__provider:"Provider",footer__duration:"Cookie Duration",footer__privacy_policy:"Privacy Policy"},offsetLineHeight:1.15},hasChanged:!1,hasInitiated:!1,cookies:{}},getData(){let e=Ye.a.getJSON(this.state.options.cookie_name);return e||(e={}),e},getAgreeClasses(e){let t=["button","button--agree","tiny-consent__button"];return!0===this.getData()[e.id]&&t.push("button--active"),t.join(" ")},getRejectClasses(e){let t=["button","button--reject","tiny-consent__button"];return!1===this.getData()[e.id]&&t.push("button--active"),t.join(" ")},getWrapperClasses(e){let t=["tiny-consent__wrapper"];return!1===data[e.id]&&t.push("button--active"),t.join(" ")},handleToogle(){let e=event.target;event.target.nextElementSibling||(e=event.target.parentNode);const t=e.nextElementSibling.childNodes[0].offsetHeight*this.state.options.offsetLineHeight;e.classList.toggle("tiny-consent__cookie-accordion-header--open"),e.nextElementSibling.style.maxHeight?e.nextElementSibling.style.maxHeight="":e.nextElementSibling.style.maxHeight=t+"px"},isOk(){let e=this.getData(),t=!0;return this.state.cookies.default.forEach(n=>{!0!==e[n.id]&&(t=!1)}),t},onMounted(){window.addEventListener("tiny-consent-open",()=>{this.root.firstChild.style.bottom="0px",this.update()}),this.root.firstChild.style.bottom=-this.root.firstChild.offsetHeight+"px",this.root.firstChild.style.visibility="visible",window.requestAnimationFrame(()=>{this.root.firstChild.classList.add("tiny-consent--animation"),!0===this.state.hasChanged&&(this.root.firstChild.style.bottom="0px")})},onBeforeMount(){const e=this.getData();this.props.options&&(this.state.options=Fe()(this.state.options,this.props.options)),Object.entries(e).length>0&&(this.state.hasInitiated=!0),this.props.cookies.forEach((t,n)=>{!0===e[t.id]||!1===e[t.id]?(!0===e[t.id]&&t.handleAgree?t.handleAgree():!1===e[t.id]&&t.handleReject&&t.handleReject(),t.hasConsent=!0):(this.state.hasChanged=!0,t.hasConsent=!1),t.default?(this.state.cookies.default||(this.state.cookies.default=[]),this.state.cookies.default.push(t)):(this.state.cookies.other||(this.state.cookies.other=[]),this.state.cookies.other.push(t))})},beforeUpdate(){if(!1===this.state.hasInitiated&&this.state.cookies.other.length>0){let e=!0,t=this.getData();this.state.cookies.other.forEach(n=>{!1===t[n.id]&&(e=!1)}),!0===e&&(this.handleDefault(),this.close(),this.state.hasInitiated=!0)}},handleAgree(e,t){let n=this.getData();e.handleAgree&&e.handleAgree(),n[e.id]=!0,Ye.a.set(this.state.options.cookie_name,n),this.beforeUpdate(),this.update()},handleReject(e){let t=this.getData();e.handleReject&&e.handleReject(),t[e.id]=!1,Ye.a.set(this.state.options.cookie_name,t),this.beforeUpdate(),this.update()},handleDefault(){let e=this.getData();this.state.cookies.default.forEach((t,n)=>{e[t.id]=!0}),Ye.a.set(this.state.options.cookie_name,e),this.update()},close(){this.root.firstChild.style.bottom=this.root.firstChild.style.bottom=-this.root.firstChild.offsetHeight+"px"},handleClose(){!1===this.state.hasInitiated&&this.state.cookies.other.forEach(e=>{this.handleReject(e),this.handleDefault(),this.state.hasInitiated=!0}),this.close(),this.update()}},template:function(e,t,n,o){return e('',[{redundantAttribute:"expr0",selector:"[expr0]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.title].join("")}}]},{type:n.IF,evaluate:function(e){return e.state.options.text.content},redundantAttribute:"expr1",selector:"[expr1]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.content].join("")}}]}])},{redundantAttribute:"expr2",selector:"[expr2]",expressions:[{type:t.EVENT,name:"onclick",evaluate:function(e){return e.handleClose}}]},{type:n.IF,evaluate:function(e){return!1===e.state.hasInitiated},redundantAttribute:"expr3",selector:"[expr3]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.button__ok}}]}])},{type:n.IF,evaluate:function(e){return!0===e.state.hasInitiated},redundantAttribute:"expr4",selector:"[expr4]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.button__close}}]}])},{type:n.EACH,getKey:null,condition:null,template:e('
',[{expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-group"}}]},{type:n.IF,evaluate:function(e){return"default"===e.group[0]&&e.group[1].length>1},redundantAttribute:"expr6",selector:"[expr6]",template:e(' ',[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.title__default," (",e.group[1].length,")"].join("")}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-accordion-header"}},{type:t.EVENT,name:"onclick",evaluate:function(e){return()=>{e.handleToogle()}}}]}])},{redundantAttribute:"expr7",selector:"[expr7]",expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return["tiny-consent__cookie-accordion","default"===e.group[0]&&e.group[1].length>1?" tiny-consent__cookie-accordion--active":""].join("")}}]},{type:n.EACH,getKey:null,condition:null,template:e('',[{expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-wrapper"}}]},{redundantAttribute:"expr9",selector:"[expr9]",expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.content].join("")}}]},{type:n.IF,evaluate:function(e){return e.cookie.title},redundantAttribute:"expr10",selector:"[expr10]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.cookie.title}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-title"}}]}])},{type:n.IF,evaluate:function(e){return e.cookie.provider},redundantAttribute:"expr11",selector:"[expr11]",template:e(' ',[{expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.provider].join("")}}]},{redundantAttribute:"expr12",selector:"[expr12]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.footer__provider}}]}])},{type:n.IF,evaluate:function(e){return e.cookie.name},redundantAttribute:"expr13",selector:"[expr13]",template:e(' ',[{expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.name].join("")}}]},{redundantAttribute:"expr14",selector:"[expr14]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.footer__name}}]}])},{type:n.IF,evaluate:function(e){return e.cookie.duration},redundantAttribute:"expr15",selector:"[expr15]",template:e(' ',[{expressions:[{type:t.TEXT,childNodeIndex:1,evaluate:function(e){return[e.cookie.duration].join("")}}]},{redundantAttribute:"expr16",selector:"[expr16]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.footer__duration}}]}])},{type:n.IF,evaluate:function(e){return e.cookie.privacy_policy},redundantAttribute:"expr17",selector:"[expr17]",template:e(' ',[{redundantAttribute:"expr18",selector:"[expr18]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return e.state.options.text.footer__privacy_policy}},{type:t.ATTRIBUTE,name:"href",evaluate:function(e){return e.cookie.privacy_policy}}]}])},{type:n.IF,evaluate:function(e){return"other"===e.group[0]},redundantAttribute:"expr19",selector:"[expr19]",template:e('',[{expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-decision"}}]},{redundantAttribute:"expr20",selector:"[expr20]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.button__agree].join("")}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return e.getAgreeClasses(e.cookie)}},{type:t.EVENT,name:"onclick",evaluate:function(e){return()=>{e.handleAgree(e.cookie)}}}]},{type:n.IF,evaluate:function(e){return"other"===e.group[0]},redundantAttribute:"expr21",selector:"[expr21]",template:e(" ",[{expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.button__reject].join("")}},{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return e.getRejectClasses(e.cookie)}},{type:t.EVENT,name:"onclick",evaluate:function(e){return()=>{e.handleReject(e.cookie)}}}]}])}])},{type:n.IF,evaluate:function(e){return"default"===e.group[0]&&e.index===e.group[1].length-1},redundantAttribute:"expr22",selector:"[expr22]",template:e('',[{expressions:[{type:t.ATTRIBUTE,name:"class",evaluate:function(e){return"tiny-consent__cookie-decision"}}]},{redundantAttribute:"expr23",selector:"[expr23]",expressions:[{type:t.TEXT,childNodeIndex:0,evaluate:function(e){return[e.state.options.text.button__ok].join("")}},{type:t.ATTRIBUTE,name:"disabled",evaluate:function(e){return e.isOk()}},{type:t.EVENT,name:"onclick",evaluate:function(e){return t=>{e.handleDefault(e.cookies)}}}]}])}]),redundantAttribute:"expr8",selector:"[expr8]",itemName:"cookie",indexName:"index",evaluate:function(e){return e.group[1]}}]),redundantAttribute:"expr5",selector:"[expr5]",itemName:"group",indexName:null,evaluate:function(e){return Object.entries(e.state.cookies)}}])},name:"tiny-consent"}),Pe("tiny-consent-button",He),Re("tiny-consent",{text:{content:void 0},cookies:[{title:"Matomo",name:"matamo_",id:"matamo",content:"Cookie from Matamo for Website-Analytics. Creates statiscial Data how the User uses this Website",provider:"Tentakelfabrik.de",duration:"1 Year",privacy_policy:"https://tentakelfabrik.de/datenschutzerklarung",handleAgree:function(){console.log("agree")},handleReject:function(){console.log("reject")}},{title:"Tiny Consent",id:"tiny_consent",name:"tiny_consent",content:"Saves the Settings of Cookies from Tiny Consent",provider:"Owner of this Site",duration:"1 Year",default:!0},{title:"Wordpress mit WooCommerce",id:"wordpress_woocommerce",name:"woocommerce_cart_hash, woocommerce_items_in_cart, wp_woocommerce_session_, tk_ai",content:"Handle Login of User and Cart of WooCommerce Shop",provider:"Owner of this Site",duration:"Session",default:!0}]}),Re("tiny-consent-button")},function(e,t){}]); \ No newline at end of file diff --git a/package.json b/package.json index 4899cd8..1b8c805 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tiny-consent", - "version": "1.1.3", + "version": "1.1.4", "description": "Consent Banner for GDPR with RiotJS, part of Tiny-Components", "scripts": { "dev": "npm run development", diff --git a/src/TinyConsent.riot b/src/TinyConsent.riot index 2834f5c..32eea38 100644 --- a/src/TinyConsent.riot +++ b/src/TinyConsent.riot @@ -10,14 +10,15 @@

@@ -99,16 +100,17 @@ }, offsetLineHeight: 1.15 }, - isOpen: false, hasChanged: false, + hasInitiated: false, cookies: { } }, /** + * getting cookie data as object * - * @return {[type]} [description] + * @return {object} */ getData() { @@ -189,10 +191,8 @@ * @param {object} event * */ - handleToogle(event) + handleToogle() { - event.preventDefault(); - let target = event.target; if (!event.target.nextElementSibling) { @@ -248,12 +248,6 @@ this.root.firstChild.style.bottom = '0px'; } }); - - const essential = this.$('.button--ok.tiny-consent__button:not([disabled])'); - - if (essential) { - essential.click(); - } }, /** @@ -269,8 +263,8 @@ } // check if consent already has set - if (Object.entries(data).length === 0) { - this.state.hasChanged = true; + if (Object.entries(data).length > 0) { + this.state.hasInitiated = true; } this.props.cookies.forEach((cookie, index) => { @@ -295,6 +289,7 @@ } this.state.cookies['default'].push(cookie); + } else { if (!this.state.cookies['other']) { this.state.cookies['other'] = []; @@ -310,20 +305,23 @@ * * @return {[type]} */ - onBeforeUpdate() { + beforeUpdate() { + if (this.state.hasInitiated === false && this.state.cookies.other.length > 0) { - // state - if (this.state.hasChanged === true) { - let hasToClose = true; + let hasClosing = true; - this.props.cookies.forEach((cookie) => { - if (cookie.hasConsent !== true) { - hasToClose = false; + let data = this.getData(); + + this.state.cookies.other.forEach((cookie) => { + if (data[cookie.id] === false) { + hasClosing = false; } }); - if (hasToClose === true) { - this.state.isOpen = false; + if (hasClosing === true) { + this.state.hasInitiated = true; + this.handleDefault(); + this.close(); } } }, @@ -333,9 +331,7 @@ * @param {[type]} event [description] * @return {[type]} [description] */ - handleAgree(event, cookie, index) { - event.preventDefault(); - + handleAgree(cookie, index) { let data = this.getData(); if (cookie.handleAgree) { @@ -345,6 +341,7 @@ data[cookie.id] = true; Cookie.set(this.state.options.cookie_name, data); + this.beforeUpdate(); this.update(); }, @@ -355,9 +352,7 @@ * @param {object} event * */ - handleReject(event, cookie, index) { - event.preventDefault(); - + handleReject(cookie) { let data = this.getData(); if (cookie.handleReject) { @@ -367,6 +362,7 @@ data[cookie.id] = false; Cookie.set(this.state.options.cookie_name, data); + this.beforeUpdate(); this.update(); }, @@ -375,9 +371,7 @@ * * @param {object} event */ - handleDefault(event) - { - event.preventDefault(); + handleDefault() { let data = this.getData(); @@ -390,17 +384,32 @@ this.update(); }, + /** + * + * + */ + close() + { + this.root.firstChild.style.bottom = this.root.firstChild.style.bottom = -(this.root.firstChild.offsetHeight) + 'px'; + }, + /** * change to open * * @param {object} event * */ - handleClose(event) + handleClose() { - event.preventDefault(); + if (this.state.hasInitiated === false) { + this.state.cookies.other.forEach((cookie) => { + this.handleReject(cookie); + this.handleDefault(); + this.state.hasInitiated = true; + }); + } - this.root.firstChild.style.bottom = this.root.firstChild.style.bottom = -(this.root.firstChild.offsetHeight) + 'px'; + this.close(); this.update(); } }