nodality
Version:
A lightweight library for declarative UI elements.
2 lines • 34.2 kB
JavaScript
/*! For license information please see link.cjs.js.LICENSE.txt */
(()=>{"use strict";var t={d:(e,r)=>{for(var n in r)t.o(r,n)&&!t.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:r[n]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};function r(t){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},r(t)}function n(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,o,a=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}(t,e)||s(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function i(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=s(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var o,a=!0,l=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){l=!0,o=t},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}function s(t,e){if(t){if("string"==typeof t)return o(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(t,e):void 0}}function o(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function a(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,l(n.key),n)}}function l(t){var e=function(t){if("object"!=r(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var n=e.call(t,"string");if("object"!=r(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==r(e)?e:e+""}function c(t){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},c(t)}function u(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function d(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,h(n.key),n)}}function h(t){var e=function(t){if("object"!=c(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==c(e)?e:e+""}function f(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(f=function(){return!!t})()}function y(t,e,r,n){var i=p(m(1&n?t.prototype:t),e,r);return 2&n&&"function"==typeof i?function(t){return i.apply(r,t)}:i}function p(){return p="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=m(t)););return t}(t,e);if(n){var i=Object.getOwnPropertyDescriptor(n,e);return i.get?i.get.call(arguments.length<3?t:r):i.value}},p.apply(null,arguments)}function m(t){return m=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},m(t)}function v(t,e){return v=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},v(t,e)}t.r(e),t.d(e,{Link:()=>g});var g=function(t){function e(t,r,n){var i;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(i=function(t,e,r){return e=m(e),function(t,e){if(e&&("object"==c(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t)}(t,f()?Reflect.construct(e,r||[],m(t).constructor):e.apply(t,r))}(this,e)).link=r,i.text=t,i.code=[],i.css=[],i.elCSS=[],i.html=[],i.res=null,i.stopEM=n,i.setup(),i.inlineBlock(),i.res.addEventListener("click",(function(t){var e=i.link||i.res.getAttribute("href");if(e){var r=/^https?:\/\//i.test(e),n=e.startsWith("#");r||n||e.endsWith(".html")||(t.preventDefault(),"navigation"in window?navigation.navigate(e):(history.pushState({},"",e),document.dispatchEvent(new PopStateEvent("popstate"))))}})),i}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&v(t,e)}(e,t),r=e,(n=[{key:"toCSS",value:function(){return this.css}},{key:"toHTMLA",value:function(){return this.html}},{key:"toElCSS",value:function(){return this.preffersId?this.elCSS.unshift(this.res.id+" { \n"):this.elCSS.unshift("."+this.class+" { \n"),this.elCSS.push(" } \n \n"),this.elCSS}},{key:"getType",value:function(){return"HTMLAnchorElement"}},{key:"toCode",value:function(){if(this.excludeFromCodeTrue)return[""];var t=Object.fromEntries(Object.entries(this.options).filter((function(t){var e=function(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,o,a=[],l=!0,c=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=s.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){c=!0,i=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw i}}return a}}(t,e)||function(t,e){if(t){if("string"==typeof t)return u(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?u(t,e):void 0}}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}(t,2);return e[0],null!==e[1]}))),e=JSON.stringify(t,null,4).replace(/"([^"]+)":/g,"$1:");return["new Link().set(".concat(e,")")]}},{key:"setArea",value:function(t){return this.res.style.gridArea=t,this}},{key:"setup",value:function(){var t=document.createElement("a");t.setAttribute("href",this.link),t.style.textDecoration="none",t.style.color="black",t.style.fontFamily="Arial";var e=document.createTextNode(this.text);return t.appendChild(e),this.res=t,!1===this.stopEM&&this.em(1),this}},{key:"appendImageAsChild",value:function(t,e){var r=document.createElement("a");t.options.vtn&&(r.style.viewTransitionName=t.options.vtn),r.setAttribute("href",t.options.url);var n=document.createElement("img");return t.options&&(n.style.width=t.options.size,t.options.radius&&(n.style.borderRadius=t.options.radius),n.setAttribute("src",t.options.img),r.appendChild(n)),this.res=r,e&&(this.res.style.marginLeft=e),this}},{key:"addIcon",value:function(t){var e=document.createElement("img");return e.style.width="20px",e.style.height="auto",e.style.marginLeft=t.padding?t.padding:"10px",e.setAttribute("src",t.url),this.res.appendChild(e),this}},{key:"removeQuotesFromFirstWord",value:function(t){if(t)return t.replace(/"([^"]+)":/g,"$1:")}},{key:"set",value:function(t){this.elCSS.push("text-decoration: none; \n"),this.options=t;var r="";t.tags&&y(e,"setTags",this,3)([t.tags]),t.id&&this.res.setAttribute("id",t.id),t.id&&y(e,"setID",this,3)([t.id]),t.flex&&(this.res.style.display="flex"),t.pad&&this.pad(t.pad);var n=this.removeQuotesFromFirstWord(JSON.stringify(t.pad));if(t.pad&&(r+="\n pad: ".concat(n,",")),t.preffersId&&(this.preffersId=t.preffersId),null!=t.preffersId&&(r+="\n preffersId: ".concat(t.preffersId,",")),t.class&&y(e,"setClass",this,3)([t.class]),t.class&&(r+='\n class: "'.concat(t.class,'",')),t.borderObj){this.res.style.border="".concat(t.borderObj.width," solid ").concat(t.borderObj.color),this.res.style.borderRadius="".concat(t.borderObj.radius);var i=this.removeQuotesFromFirstWord(JSON.stringify(t.borderObj));r+="\n borderObj: ".concat(i,",")}if(!1===this.options.preffersId?this.html.push('<a class="'.concat(t.class,'" href="#hello">').concat(t.text,"</a> \n \n")):t.id&&this.html.push('<a id="'.concat(t.id.substr(1),'" href="#hello">').concat(t.text,"</a> \n \n")),null!=t.blastData){var s=this.removeQuotesFromFirstWord(JSON.stringify(t.blastData));y(e,"setAny",this,3)([{globalBlast:"1px ".concat(t.blastData.color)}]),t.blastData&&(r+="\n blastData: ".concat(s,","))}t.nowrap&&(this.res.style.whiteSpace="nowrap"),t.font&&this.font(t.font),t.font&&(r+='\n font: "'.concat(t.font,'",')),t.font&&this.elCSS.push('font-family: "'.concat(t.font,'"; \n')),t.fluidc&&this.fluidCopy(t.fluidc),t.fluidc&&(r+='\n fluidc: "'.concat(t.fluidc,'",')),t.size&&this.fluidCopy(t.size),t.size&&(r+='\n size: "'.concat(t.size,'",')),"S6"===t.fluidc?t.fluidc&&this.elCSS.push("font-size: calc(1rem + 1.075vw); \n"):t.fluidc&&this.elCSS.push("font-size: calc(1.625rem + 5.075vw); \n"),t.clampc&&this.clampCopy(t.clampc),this.options.id&&(r+='\n id: "'.concat(this.options.id,'",')),t.align&&this.leftAlign(t.align),t.align&&(r+='\n align: "'.concat(t.align,'",')),t.type&&(this.res.style.display="block"),t.color&&this.color(t.color),t.color&&(r+='\n color: "'.concat(t.color,'",')),t.color&&this.elCSS.push('color: "'.concat(t.color,'"; \n')),t.background&&this.background(t.background);var o=this.removeQuotesFromFirstWord(JSON.stringify(t.background));t.background&&(r+="\n background: ".concat(o,",")),t.hover&&this.hover(t.hover);var a=this.removeQuotesFromFirstWord(JSON.stringify(t.hover));if(t.hover&&(r+="\n hover: ".concat(a,",")),t.weight&&(this.res.style.fontWeight=t.weight),t.blast&&(this.blastData=t.blast),t.bold&&(this.res.style.fontWeight="bold"),t.bold&&(r+="\n bold: ".concat(t.bold,",")),t.block&&this.toBlock(),t.block&&(r+="\n block: ".concat(t.block,",")),t.radius&&this.radius(t.radius),t.radius&&(r+='\n radius: "'.concat(t.radius,'",')),t.width&&this.width(t.width),t.width&&(r+='\n width: "'.concat(t.width,'",')),t.arrayPadding){var l=t.arrayPadding.sides.map((function(t){return'"'.concat(t,'"')})).join(", ");t.arrayPadding&&this.arrayPadding(t.arrayPadding.sides,t.arrayPadding.value),t.arrayPadding&&(r+="\n arrayPadding: {sides: [".concat(l,'], value: "').concat(t.arrayPadding.value,'"},'))}if(t.arrayMargin&&this.arrayMargin(t.arrayMargin.sides,t.arrayMargin.value),t.arrayMargin&&(r+="\n arrayMargin: {sides: [".concat(t.arrayMargin.sides.map((function(t){return'"'.concat(t,'", ')})),'], value: "').concat(t.arrayMargin.value,'"},')),t.maxWidth&&this.maxWidth(t.maxWidth),t.url&&this.res.setAttribute("href",t.url),r+='\n url: "'.concat(t.url,'",'),t.text&&(this.res.textContent=t.text),r+='\n text: "'.concat(t.text,'",'),t.data){t.data&&this.appendImageAsChild(t.data,"20px");var c=this.removeQuotesFromFirstWord(JSON.stringify(t.data));t.data&&(r+="\n data: ".concat(c))}if(t.icon){this.addIcon(t.icon);var u=this.removeQuotesFromFirstWord(JSON.stringify(t.icon));r+="\n icon: ".concat(u,",")}if(t.shadow){var d=t.shadow,h=this.removeQuotesFromFirstWord(JSON.stringify(d));r+="\n shadow: ".concat(h,",")}if(t.stroke){var f=this.removeQuotesFromFirstWord(JSON.stringify(t.stroke));t.stroke&&(r+="\n stroke: ".concat(f,","))}if(t.backgroundOp){var p=this.removeQuotesFromFirstWord(JSON.stringify(t.backgroundOp));r+="\n backgroundOp: ".concat(p,",")}if(t.marginOp){var m=this.removeQuotesFromFirstWord(JSON.stringify(t.marginOp));r+="\n marginOp: ".concat(m,",")}if(t.gradient){var v=this.removeQuotesFromFirstWord(JSON.stringify(t.gradient));r+="\n gradient: ".concat(v,",")}if(t.animation){var g=this.removeQuotesFromFirstWord(JSON.stringify(t.animation));r+="\n animation: ".concat(g,",")}if(t.transform){var b=this.removeQuotesFromFirstWord(JSON.stringify(t.transform));r+="\n transform: ".concat(b,",")}if(t.blast){var w=this.removeQuotesFromFirstWord(JSON.stringify(t.blast));r+="\n blast: ".concat(w,",")}var x="new Link().set({".concat(r,"}) \n");this.code.push(x),t.color&&this.color(t.color),t.rounded&&this.round(),t.transform&&this.reactOnTransform(t.transform);var k=[],S=[t.border,t.blast,t.gradient,t.animation,t.span,t.shadow,t.backgroundOp,t.animation,t.transform];if((S=S.filter((function(t){return null!=t}))).length>0){t.gradient&&(this.globalGradient=t.gradient.op.gradient,"radial"===t.gradient.op.direction&&(this.globalGradient="radial-gradient(circle at center, orange, green)")),t.stroke&&y(e,"setAny",this,3)([{globalBlast:"".concat(t.stroke.op.width," ").concat(t.stroke.op.color)}]);for(var O=0;O<S.length;O++)k.push({range:S[O].range,log:S[O].op.name,target:S[O].target,op:S[O].op});var T=[];t.borderObj&&T.push("border"),t.background&&T.push("background"),t.mar&&T.push("margin"),t.animation&&T.push("animation"),this.chainReact(k,t.id,T,t.isNavA),this.res.style.zIndex=1}return t.mar&&this.mar(t.mar),this}},{key:"color",value:function(t){return this.res.style.color=t,this}},{key:"maxWidth",value:function(t){return this.res.style.maxWidth=t,this}},{key:"background",value:function(t){return this.res.style.backgroundColor=t,this}},{key:"leftAlign",value:function(t){return this.res.style.textAlign=t,this}},{key:"arrayPadding",value:function(t,e){return e||(this.res.style.marginLeft="".concat(t[0],"px"),this.res.style.marginTop="".concat(t[1],"px"),this.res.style.marginRight="".concat(t[2],"px"),this.res.style.marginBottom="".concat(t[3],"px")),"all"===t[0]&&(this.res.style.paddingLeft=e,this.res.style.paddingTop=e,this.res.style.paddingRight=e,this.res.style.paddingBottom=e),t.includes("left")&&(this.res.style.paddingLeft=e),t.includes("right")&&(this.res.style.paddingRight=e),t.includes("top")&&(this.res.style.paddingTop=e),t.includes("bottom")&&(this.res.style.paddingBottom=e),e||(this.res.style.paddingBottom=t),this}},{key:"arrayMargin",value:function(t,e){return t.includes("left")&&(this.res.style.marginLeft=e),t.includes("right")&&(this.res.style.marginRight=e),t.includes("top")&&(this.res.style.marginTop=e),t.includes("bottom")&&(this.res.style.marginBottom=e),t.includes("all")&&(this.res.style.margin=e),e||(this.res.style.marginBottom=t),this}},{key:"getClampValue",value:function(t){return"S6"===t?"clamp(2.25rem, 2vw+1.5rem, 3.25rem)":"S5"===t?"clamp(2.75rem, 2vw + 1.5rem, 3.25rem)":"S4"===t?"clamp(3.5rem, 2vw + 1.5rem, 3.25rem)":"S3"===t?"clamp(4.25rem, 2vw + 1.5rem, 3.25rem)":"S2"===t?"clamp(5rem, 2vw + 1.5rem, 3.25rem)":"S1"===t?"clamp(6rem, 2vw + 1.5rem, 3.25rem)":void 0}},{key:"clampCopy",value:function(t){return this.res.style.fontSize=this.getClampValue(t),this}},{key:"fluidCopy",value:function(t){return"S1"===t&&(this.res.style.fontSize="calc(1.625rem + 5.075vw)"),"S2"===t&&(this.res.style.fontSize="calc(1.500rem + 4.3vw)"),"S3"===t&&(this.res.style.fontSize="calc(1.375rem + 3.525vw)"),"S4"===t&&(this.res.style.fontSize="calc(1.250rem + 2.75vw)"),"S5"===t&&(this.res.style.fontSize="calc(1.125rem + 1.975vw)"),"S6"===t&&(this.res.style.fontSize="calc(1rem + 0.5vw)"),this}},{key:"inlineBlock",value:function(){return this.res.style.display="inline-block",this}},{key:"toBlock",value:function(){return this.res.style.display="block",this}},{key:"myself",value:function(t){var e=this,r=function(){window.matchMedia("(max-device-width: 415px)").matches?e.res.style.fontSize=t.desktop:e.res.style.fontSize=t.phone};return r(),window.addEventListener("resize",r),this}},{key:"style",value:function(t){return this.res.style.color=t.styles.color,this.res.style.fontWeight=t.styles.fontWeight,this.res.style.paddingLeft=t.styles.padding[0],this.res.style.paddingTop=t.styles.padding[1],this.res.style.paddingRight=t.styles.padding[2],this.res.style.paddingBottom=t.styles.padding[3],this}},{key:"round",value:function(){return this.res.style.borderRadius="0.5rem",this.options.rounded&&(this.res.children[0].style.borderRadius="0.5rem"),this}},{key:"newWindow",value:function(){return this.res.target="_new",this}},{key:"radius",value:function(t){return this.res.style.borderRadius="".concat(t),this}},{key:"transition",value:function(t){return this.res.style.transition="".concat(t,"s ease-in-out"),this.res.style.transionProperty="background, color",this}},{key:"width",value:function(t){return this.res.style.width=t,this}},{key:"italic",value:function(){return this.res.style.fontStyle="italic",this}},{key:"padding",value:function(t,e,r,n){return t&&e&&r&&n?(this.res.style.paddingLeft=t,this.res.style.paddingTop=e,this.res.style.paddingRight=r,this.res.style.paddingBottom=n):this.res.style.padding=t,this}},{key:"medium",value:function(){var t=this,e=function(){window.matchMedia("(max-device-width: 415px)").matches?t.res.style.fontSize="2rem":t.res.style.fontSize="1.5em"};return e(),window.addEventListener("resize",e),this}},{key:"opacity",value:function(t){return this.res.style.opacity=t,this}},{key:"margin",value:function(t,e,r,n){return this.res.style.marginTop=t,this.res.style.marginLeft=e,this.res.style.marginRight=r,this.res.style.marginBottom=n,this}},{key:"hover",value:function(t){var e=this;if(t.border){var r=t.border.width;this.res.style.border=r?"".concat(r,"px solid transparent"):"1px solid transparent"}var n=this.options.borderObj;return n&&(this.res.style.border="".concat(n.width,"px solid ").concat(n.color)),this.prevColor=this.res.style.backgroundColor,this.foreColor=this.res.style.color,this.prevBorder=this.res.style.border,t.animation&&(this.res.style.transition="".concat(t.animation),this.res.style.transionProperty="background, color"),this.res.onmouseout=function(){e.res.style.backgroundColor="".concat(e.prevColor),e.res.style.color="".concat(e.foreColor),e.res.style.border=e.prevBorder},this.res.onmouseover=function(){if(e.res.style.color=t.color,e.res.style.backgroundColor=t.background,t.border){var r,n=t.border.width,i=null!==(r=t.border.color)&&void 0!==r?r:"#2ECC71";e.res.style.border=n?"".concat(n,"px solid ").concat(i):"1px solid #2ECC71"}},this}},{key:"em",value:function(t){var e=this,r=window.matchMedia("(max-device-width: 415px)"),n=function(){r.matches?e.res.style.fontSize="2em":e.res.style.fontSize="1em"};return n(),window.addEventListener("resize",n),this}},{key:"font",value:function(t){return this.res.style.fontFamily=t,this}},{key:"render",value:function(t){return t?(document.querySelector(t).appendChild(this.res),this):this.res}}])&&d(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(function(){return t=function t(){var e,r,n,i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),e=this,n=function(t){if(console.log("LOBJO IS"),console.log(t),t.transform||t.op&&t.op.transform){var e=t.transform;t.transform||(e=t.op.transform),e.duration||(e.duration="3s-ease-in-out"),i.setDefault=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0px";return 0===t.length?e+" ":t};var r=function(){var r="",n="",s="",o="",a="",l="",c="",u="",d="";if(0!==e.values.length){e.values.forEach((function(t){t.startsWith("tx:")&&(r=t.replace("tx:","")),t.startsWith("ty:")&&(n=t.replace("ty:","")),t.startsWith("tz:")?s=t.replace("tz:",""):t.startsWith("scale(")?o=t:t.startsWith("skew(")?a=t:t.startsWith("rotate(")?l=function(t){var e=t.match(/rotate\(([^)]+)\)/);if(!e)return t;var r=e[1].split(",").map((function(t){return t.trim()}));return 1===r.length?"rotate(".concat(r[0],")"):2===r.length?"rotateX(".concat(r[0],") rotateY(").concat(r[1],")"):3===r.length?"rotateX(".concat(r[0],") rotateY(").concat(r[1],") rotate(").concat(r[2],")"):t}(t):t.startsWith("perspective(")?c=t:t.startsWith("matrix(")?u=t:t.startsWith("opacity:")&&(d=t.replace("opacity:",""))})),r=i.setDefault(r),n=i.setDefault(n),s=i.setDefault(s);var h="";if("0px"!=n&&"0px"!=r&&"0px"!=s?h+="translate3d(".concat(r,", ").concat(n,", ").concat(s,")"):"0px"==n&&"0px"==r||(h+="translate(".concat(r,", ").concat(n,")")),o&&(h+=" ".concat(o)),l&&(h+=" ".concat(l)),a&&(h+=" ".concat(a)),c&&(h+=" ".concat(c)),u&&(h+=" ".concat(u)),h){if(t.op.transform.duration){var f=t.op.transform.duration.replace(/^(\d+)(s)-/,(function(t,e,r){return e/2+r+" "})),y="transform ".concat(f,", opacity ").concat(f);i.res.style.transition=y}else i.res.style.transition="transform 3s ease-in-out, opacity 3s ease-in-out";t.op.transform.static&&(i.res.style.transition=""),(i.blastTarget||i.res).style.transform=h,i.res.style.opacity=d}else alert("OPE")}};e.on?i.res.addEventListener(e.on,(function(){e.delay?setTimeout((function(){r()}),e.delay):r()})):window.addEventListener("load",(function(){e.delay?setTimeout((function(){r()}),e.delay):r()}));var n=function(){var t="";e.values.forEach((function(e){e.startsWith("tx:")?t+="translateX(0) ":e.startsWith("ty:")?t+="translateY(0) ":e.startsWith("tz:")?t+="translateZ(0) ":e.startsWith("scale(")?t+="scale(1) ":e.startsWith("skew(")?t+="skew(0, 0) ":e.startsWith("rotate(")?t+="rotate(0) ":e.startsWith("perspective(")?t+="perspective(0) ":e.startsWith("matrix(")&&(t+="matrix(1, 0, 0, 1, 0, 0) "),i.res.style.opacity="1"})),t&&(i.res.style.transform=t.trim())};if(e.on)i.res.addEventListener("mouseout",(function(){e.keep||n()}));else{var s=1e3*parseFloat(e.duration),o=e.closeAfter?e.closeAfter:0;setTimeout((function(){e.keep||n()}),s/2+o)}e.hardCSS&&(i.res.style.transform=e.hardCSS)}else alert("THIS FIRE WITH GRADIENT (invalid block"),console.log("INVALID BLOCKA"),console.log(t)},(r=l(r="reactOnTransform"))in e?Object.defineProperty(e,r,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[r]=n,this.state={isExpanded:!1,isMovedUp:!1,isMovedDown:!1}},e=[{key:"keySet",value:function(t){return this.temporaryVal=1,this.res.style[t.key]=t.value,this}},{key:"onScroll",value:function(t){var e=this;"opacity"===t.value?this.res.style.opacity=t.valMin:"scale"===t.value&&(this.res.style.transform="scale(".concat(t.valMax,")")),window.addEventListener("scroll",(function(){var r=e.smartRange(window.scrollY,{min:t.from,max:t.to},{min:t.valMin,max:t.valMax});"opacity"===t.value?e.res.style.opacity=r:"scale"===t.value&&(e.res.style.transform="scale(".concat(r,")"))}))}},{key:"setAny",value:function(t){this[Object.keys(t)[0]]=[Object.values(t)[0]]}},{key:"setID",value:function(t){this.id=t}},{key:"setPrevText",value:function(t){this.prevText=t}},{key:"getCSS",value:function(){return this.css}},{key:"getPX",value:function(t){return{xs:"0px",sm:"576px",md:"768px",lg:"992px",xl:"1200px",xxl:"1400px",mxxl:"1800px"}[t]||"Invalid breakpoint"}},{key:"respad",value:function(t){var e=this,r=function(){e.pad(t[0].values);for(var r=0;r<t.length;r++){var n=t[r].breakpoint;window.matchMedia("(min-width: ".concat(e.getPX(n))).matches&&e.pad(t[r].values)}};window.addEventListener("resize",r),r()}},{key:"resmar",value:function(t){var e=this,r=function(){e.mar(t[0].values);for(var r=0;r<t.length;r++){var n=t[r].breakpoint;window.matchMedia("(max-width: ".concat(e.getPX(n))).matches&&e.mar(t[r].values)}};window.addEventListener("resize",r),r()}},{key:"resprop",value:function(t){var e=this;console.log("RES STYLE"),console.log(t),this.prevStyles={};for(var r=0;r<this.res.style.length;r++){var n=this.res.style[r];this.prevStyles[n]=this.res.style[n],console.log("kio")}var i=function(){for(var r in e.prevStyles)e.res.style[r]=e.prevStyles[r];console.log("mkio");for(var n=0;n<t.length;n++){var i=t[n].breakpoint,s="(max-width: ".concat(i,")");if(console.log("testing media query:",s,window.matchMedia(s).matches),window.matchMedia(s).matches)for(var o in t[n])"breakpoint"!==o&&(console.log("ukio"),e.res.style[o]=t[n][o])}};window.addEventListener("resize",i),i()}},{key:"isNumber",value:function(t){return"number"==typeof t&&!isNaN(t)}},{key:"pad",value:function(t){for(var e=0;e<t.length;e++)for(var r=Object.keys(t[e]),n=0;n<r.length;n++)for(var i=r[n],s=t[e][i],o=0;o<i.length;o++)switch(i[o]){case"a":this.res.style.padding=this.isNumber(s)?"".concat(s,"px"):s;break;case"t":this.res.style.paddingTop=this.isNumber(s)?"".concat(s,"px"):s;break;case"l":this.res.style.paddingLeft=this.isNumber(s)?"".concat(s,"px"):s;break;case"r":this.res.style.paddingRight=this.isNumber(s)?"".concat(s,"px"):s;break;case"b":this.res.style.paddingBottom=this.isNumber(s)?"".concat(s,"px"):s}return this}},{key:"as",value:function(t){return this.res.style.alignSelf=t,this}},{key:"mar",value:function(t){for(var e=0;e<t.length;e++)for(var r=Object.keys(t[e]),n=0;n<r.length;n++)for(var i=r[n],s=t[e][i],o=0;o<i.length;o++){switch(i[o]){case"a":this.res.style.margin=this.isNumber(s)?"".concat(s,"px"):s;break;case"t":this.res.style.marginTop=this.isNumber(s)?"".concat(s,"px"):s;break;case"l":this.res.style.marginLeft=this.isNumber(s)?"".concat(s,"px"):s;break;case"r":this.res.style.marginRight=this.isNumber(s)?"".concat(s,"px"):s;break;case"b":this.res.style.marginBottom=this.isNumber(s)?"".concat(s,"px"):s}"auto"===i[o]&&(this.res.style.marginLeft="auto",this.res.style.marginRight="auto")}return this}},{key:"smartRange",value:function(t,e,r){t<e.min&&(t=e.min),t>e.max&&(t=e.max);var n=(t-e.min)/(e.max-e.min);e.min>e.max&&(n=(t-e.max)/(e.min-e.max));var i=(r.min-r.max)*n-r.min;if(i=Math.abs(i),r.min<r.max){var s=(r.max+Math.abs(r.min))*n;i=r.min+s}return i}},{key:"gpos",value:function(t){return this.res.style.gridColumn=t.col,this.res.style.gridRow=t.row,this}},{key:"fluidCopy",value:function(t){if(t instanceof Object){this.prevStylex=this.res.style,this.res=document.createElement("h1"),this.res.style.cssText=this.prevStylex.cssText;var e=document.createTextNode(this.text);return this.res.appendChild(e),this.res.style.fontSize=t.exact,this}if("S1"===t){this.prevStylex=this.res.style,this.res=document.createElement("h1"),this.res.style.cssText=this.prevStylex.cssText;var r=document.createTextNode(this.text);this.res.appendChild(r),this.res.style.fontSize="calc(1.625rem + 5.075vw)"}if("S2"===t){this.prevStylex=this.res.style,this.res=document.createElement("h2"),this.res.style.cssText=this.prevStylex.cssText;var n=document.createTextNode(this.text);this.res.appendChild(n),this.res.style.fontSize="calc(1.500rem + 4.3vw)"}if("S3"===t){this.prevStylex=this.res.style,this.res=document.createElement("h3"),this.res.style.cssText=this.prevStylex.cssText;var i=document.createTextNode(this.text);this.res.appendChild(i),this.res.style.fontSize="calc(1.375rem + 3.525vw)"}if("S4"===t){this.prevStylex=this.res.style,this.res=document.createElement("h4"),this.res.style.cssText=this.prevStylex.cssText;var s=document.createTextNode(this.text);this.res.appendChild(s),this.res.style.fontSize="calc(1.250rem + 2.75vw)"}if("S5"===t){this.prevStylex=this.res.style,this.res=document.createElement("h5"),this.res.style.cssText=this.prevStylex.cssText;var o=document.createTextNode(this.text);this.res.appendChild(o),this.res.style.fontSize="calc(1.125rem + 1.975vw)"}return"S6"===t&&(this.res.style.fontSize="calc(1rem + 0.5vw)"),this}},{key:"setIndex",value:function(t){this.index=t}},{key:"borderObj",value:function(t){var e,r=null!==(e=t.type)&&void 0!==e?e:"solid";return this.res.style.border="".concat(t.width," ").concat(r," ").concat(t.color),this.res.style.borderRadius=t.radius,this}},{key:"setPref",value:function(t){this.preffersId=t}},{key:"setClass",value:function(t){this.class=t}},{key:"setTags",value:function(t){this.openTag=t.open,this.closeTag=t.close,console.log("TAGS SET"),console.log(t)}},{key:"chainReact",value:function(t,e,r){var s=this;console.log("0P"),this.ap=!1,this.cta=0,this.once=!1;var o,a=i(t);try{for(a.s();!(o=a.n()).done;){var l=o.value;l.range||(l.range=["0px","999999px"])}}catch(t){a.e(t)}finally{a.f()}t.sort((function(t,e){return parseInt(t.range[0])-parseInt(e.range[0])}));var c=function(o){var a=window.visualViewport.width,l=[],c=[];s.resCopy=s.res,s.storedQueries=t.map((function(t){return t.target})).filter((function(t){return null!=t}));var u,d=i(t);try{for(d.s();!(u=d.n()).done;){var h=u.value;s.counterIndex++;var f=n(h.range,2),y=f[0],p=f[1],m=parseInt(y),v=parseInt(p),g=!0;if(h.target){g=!1;for(var b=0;b<h.target.length;b++)h.target[b]===e&&(g=!0)}a>=m&&a<=v&&g&&(l.push(h.log),c.push(h),h.op&&h.op.margin&&(s.useMargin=h.op.margin))}}catch(t){d.e(t)}finally{d.f()}if(r&&!r.includes("background")&&(s.res.style.background="",s.res.style.backgroundColor=""),s.res.style.textShadow="",r&&!r.includes("border")&&(s.res.style.border=""),r&&!r.includes("margin")&&(s.res.style.margin=""),s.res.style["-webkit-text-fill-color"]="",s.res.style["-webkit-text-stroke-color"]="",s.res.style["-webkit-text-stroke-width"]="",s.res.style.filter="",s.options.background&&(console.log(s.options.background),s.res.style.background=s.options.background),l.includes("gradient"),(l.includes("gradient")||l.includes("shadow"))&&(s.res.style.position="relative"),l.includes("blast")){var w,x=c.filter((function(t){return"blast"===t.log}))[0].op.color,k=null!==(w=c.filter((function(t){return"blast"===t.log}))[0].op.width)&&void 0!==w?w:"1px";"FlexRowLayoutElement"===s.getType()||"LayoutWrapperElement"===s.getType()?(s.res.style.border="".concat("number"==typeof k?k+"px":k," solid orange"),s.res.style.display="inline-block","FlexRowLayoutElement"===s.getType()&&(s.res.style.display="flex"),s.res.style.boxSizing="border-box",s.res.style.transformOrigin="center",s.blastTarget=s.res):(s.text&&(s.res.textContent=s.text),s.res.style["-webkit-text-fill-color"]="transparent",s.res.style["-webkit-text-stroke-color"]=x,s.res.style["-webkit-text-stroke-width"]="".concat(k))}if(l.includes("filter")){var S=c.filter((function(t){return"filter"===t.log}))[0].op.filter;s.res.style.filter=S}if(l.includes("background")&&(s.res.style.backgroundColor="green"),l.includes("gradient")&&("LayoutWrapperElement"!==s.getType()&&"FlexRowLayoutElement"!==s.getType()&&(s.res.style["-webkit-text-fill-color"]="transparent"),s.res.style.background=s.globalGradient,"LayoutWrapperElement"!==s.getType()&&"FlexRowLayoutElement"!==s.getType()&&(s.res.style["background-clip"]="text")),l.includes("shadow")){var O,T="",C=0;for(b=0;b<s.options.shadow.op.steps;b++){var E;T+="drop-shadow(".concat(C+=3,"px ").concat(C,"px ").concat(C,"px ").concat(null!==(E=s.options.shadow.color)&&void 0!==E?E:"gray",") ")}"FlexRowLayoutElement"===s.getType()||"LayoutWrapperElement"===s.getType()?s.res.style.boxShadow="".concat(C,"px ").concat(C,"px ").concat(C,"px ").concat(null!==(O=s.options.shadow.color)&&void 0!==O?O:"gray"):s.res.style.filter=T}if(l.includes("margin"))for(b=0;b<t.length;b++)if(t[b].op){var W=t[b].op.offsets;W&&void 0!==s.index&&(s.res.style.margin=W[Number(s.index)]+"px")}if(l.includes("spana")||l.includes("span")){if(s.res=s.resCopy,s.options.span){var A;for(A=Array.isArray(s.options.span)?s.options.span.filter((function(t){return"span"===t.op.name}))[0]:s.options.span,s.res.textContent="",b=0;b<A.op.parts.length;b++){var j=A.op.parts[b].style,L=new s.constructor(A.op.parts[b].text).setup({type:"span"}).set(j).render();s.res.appendChild(L)}}}else{var F=new s.constructor(s.prevText).set({}).render();s.prevText&&s.prevText.length>0&&o&&s.res.appendChild(F)}if(l.includes("animation")){if(s.options.animation&&!s.hasAnimated&&!s.options.animation.op.fireAt){console.warn(s.openTag),s.hasAnimated=!0;var N=s.options.animation.op;window.addEventListener("sidebar:open",(function(){s.res.animate(N.keyframesOpen,N.openOptions)})),window.addEventListener("sidebar:closed",(function(){s.res.animate(N.keyframesClose,N.closeOptions)})),s.res.animate(N.keyframesClose,{duration:0,fill:"forwards"}),s.openTag&&s.closeTag&&(window.addEventListener(s.openTag,(function(){s.res.animate(N.keyframesOpen,N.openOptions)})),window.addEventListener(s.closeTag,(function(){s.res.animate(N.keyframesClose,N.closeOptions)})))}if(s.options.animation&&s.options.animation.op.fireAt&&s.options.animation.op.fireAt.endsWith("px")){var P=s.options.animation.op;s.res.animate(P.keyframesClose,{duration:0,fill:"forwards"});var z=function(){window.scrollY>parseFloat(P.fireAt)&&(s.res.animate(P.keyframesOpen,P.openOptions),window.removeEventListener("scroll",z))};window.addEventListener("scroll",z)}if(s.options.animation&&s.options.animation.op.fireAt&&"inview"===s.options.animation.op.fireAt){var I=s.options.animation.op;s.res.animate(I.keyframesClose,{duration:0,fill:"forwards"}),new IntersectionObserver((function(t,e){t.forEach((function(t){t.isIntersecting&&(s.res.animate(I.keyframesOpen,I.openOptions),e.disconnect())}))})).observe(s.res)}}};this.options.animation||window.addEventListener("resize",(function(){return c()})),c()}},{key:"maxWidth",value:function(t){return this.res.style.maxWidth=t,this}},{key:"removeQuotesFromFirstWord",value:function(t){return t.replace(/"([^"]+)":/g,"$1:")}},{key:"arrayMargin",value:function(t,e){return t.includes("left")&&(this.res.style.marginLeft=e),t.includes("right")&&(this.res.style.marginRight=e),t.includes("top")&&(this.res.style.marginTop=e),t.includes("bottom")&&(this.res.style.marginBottom=e),t.includes("all")&&(this.res.style.margin=e),e||(this.res.style.marginBottom=t),this}}],e&&a(t.prototype,e),Object.defineProperty(t,"prototype",{writable:!1}),t;var t,e}());module.exports=e})();