UNPKG

nodality

Version:

A lightweight library for declarative UI elements.

2 lines 26.2 kB
/*! For license information please see button.cjs.js.LICENSE.txt */ (()=>{"use strict";var e={d:(t,r)=>{for(var s in r)e.o(r,s)&&!e.o(t,s)&&Object.defineProperty(t,s,{enumerable:!0,get:r[s]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};function r(e){return r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r(e)}function s(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var r=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var s,n,i,o,a=[],l=!0,c=!1;try{if(i=(r=r.call(e)).next,0===t){if(Object(r)!==r)return;l=!1}else for(;!(l=(s=i.call(r)).done)&&(a.push(s.value),a.length!==t);l=!0);}catch(e){c=!0,n=e}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw n}}return a}}(e,t)||i(e,t)||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 n(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=i(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var s=0,n=function(){};return{s:n,n:function(){return s>=e.length?{done:!0}:{done:!1,value:e[s++]}},e:function(e){throw e},f:n}}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(e)},n:function(){var e=r.next();return a=e.done,e},e:function(e){l=!0,o=e},f:function(){try{a||null==r.return||r.return()}finally{if(l)throw o}}}}function i(e,t){if(e){if("string"==typeof e)return o(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?o(e,t):void 0}}function o(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,s=Array(t);r<t;r++)s[r]=e[r];return s}function a(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,l(s.key),s)}}function l(e){var t=function(e){if("object"!=r(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var s=t.call(e,"string");if("object"!=r(s))return s;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==r(t)?t:t+""}function c(e){return c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},c(e)}function u(e,t){for(var r=0;r<t.length;r++){var s=t[r];s.enumerable=s.enumerable||!1,s.configurable=!0,"value"in s&&(s.writable=!0),Object.defineProperty(e,h(s.key),s)}}function h(e){var t=function(e){if("object"!=c(e)||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var r=t.call(e,"string");if("object"!=c(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==c(t)?t:t+""}function d(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(d=function(){return!!e})()}function y(e){return y=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},y(e)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}e.r(t),e.d(t,{Button:()=>f});var f=function(e){function t(e,r){var s;return function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),(s=function(e,t,r){return t=y(t),function(e,t){if(t&&("object"==c(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(e,d()?Reflect.construct(t,r||[],y(e).constructor):t.apply(e,r))}(this,t)).text=e,s.res=null,s.val=r,s.setup(),s}return function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&p(e,t)}(t,e),r=t,s=[{key:"setup",value:function(e){return this}},{key:"hover",value:function(e){var t=this;return this.prevColor=this.res.style.backgroundColor,this.foreColor=this.res.style.color,e.animation&&(this.res.style.transition="".concat(e.animation,"s ease-in-out"),this.res.style.transionProperty="background, color"),this.res.onmouseout=function(){t.res.style.backgroundColor="".concat(t.prevColor),t.res.style.color="".concat(t.foreColor)},this.res.onmouseover=function(){t.res.style.backgroundColor=e.background,t.res.style.color=e.color},this}},{key:"set",value:function(e){this.options=e;var t=document.createElement("button");if(t.style.background="transparent",e.img&&t.append(e.img.render()),e.url&&!e.img);else{var r=document.createTextNode(this.text.replace("$",this.val));t.appendChild(r)}return this.res=t,e&&"submit"===e.type&&t.setAttribute("type",e.type),this.border("none"),this.res.style.display="block",e.background&&this.background(e.background),e.padding&&this.padding(e.padding),e.margin&&this.margin(e.margin),e.mar&&this.mar(e.mar),e.pad&&this.pad(e.pad),e.respad&&this.respad(e.respad),e.resmar&&this.resmar(e.resmar),e.centered&&(this.res.style.marginRight="auto",this.res.style.marginLeft="auto",this.res.style.backgroundColor="black"),e.border&&this.border(e.border),e.radius&&this.borderRadius(e.radius),e.class&&this.setClass(e.class),e.color&&this.color(e.color),e.auto&&this.auto(),e.weight&&(this.res.style.fontWeight=e.weight),e.fluidc&&this.fluidButtonCopy(e.fluidc),e.fluidc&&'\n fluidc: "'.concat(e.fluidc,'",'),e.onTap&&this.onTap(e.onTap),e.frame&&this.frame(e.frame),e.frame&&'\n frame: "'.concat(e.frame,'",'),e.arrpad&&this.arrayPadding(e.arrpad.sides,e.arrpad.value),e.arrpad&&'\n arrpad: {sides: ["'.concat(e.arrpad.sides,'"], value: "').concat(e.arrpad.value,'"},'),e.arrayMargin&&this.arrayMargin(e.arrayMargin.sides,e.arrayMargin.value),e.arrayMargin&&'\n arrayMargin: {sides: ["'.concat(e.arrayMargin.sides,'"], value: "').concat(e.arrayMargin.value,'"},'),e.keySet&&this.keySet(e.keySet),this}},{key:"arrayPadding",value:function(e,t){return e.includes("left")&&(this.res.style.paddingLeft=t),e.includes("right")&&(this.res.style.paddingRight=t),e.includes("top")&&(this.res.style.paddingTop=t),e.includes("bottom")&&(this.res.style.paddingBottom=t),e.includes("all")&&(this.res.style.padding=t),t||(this.res.style.paddingBottom=e),this}},{key:"arrayMargin",value:function(e,t){return t||(this.res.style.marginLeft="".concat(e[0],"px"),this.res.style.marginTop="".concat(e[1],"px"),this.res.style.marginRight="".concat(e[2],"px"),this.res.style.marginBottom="".concat(e[3],"px")),e.includes("left")&&(this.res.style.marginLeft=t),e.includes("right")&&(this.res.style.marginRight=t),e.includes("top")&&(this.res.style.marginTop=t),e.includes("bottom")&&(this.res.style.marginBottom=t),e.includes("all")&&(this.res.style.margin=t),t||(this.res.style.marginBottom=e),this}},{key:"fluidButtonCopy",value:function(e){if(e instanceof Object){this.prevStylex=this.res.style,this.res=document.createElement("button"),this.res.style.cssText=this.prevStylex.cssText;var t=document.createTextNode(this.text);return this.res.appendChild(t),this.res.style.fontSize=e.exact,this}if("S1"===e){this.prevStylex=this.res.style,this.res=document.createElement("button"),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"===e){this.prevStylex=this.res.style,this.res=document.createElement("button"),this.res.style.cssText=this.prevStylex.cssText;var s=document.createTextNode(this.text);this.res.appendChild(s),this.res.style.fontSize="calc(1.500rem + 4.3vw)"}if("S3"===e){this.prevStylex=this.res.style,this.res=document.createElement("button"),this.res.style.cssText=this.prevStylex.cssText;var n=document.createTextNode(this.text);this.res.appendChild(n),this.res.style.fontSize="calc(1.375rem + 3.525vw)"}if("S4"===e){this.prevStylex=this.res.style,this.res=document.createElement("button"),this.res.style.cssText=this.prevStylex.cssText;var i=document.createTextNode(this.text);this.res.appendChild(i),this.res.style.fontSize="calc(1.250rem + 2.75vw)"}if("S5"===e){this.prevStylex=this.res.style,this.res=document.createElement("button"),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"===e&&(this.res.style.fontSize="calc(1rem + 0.5vw)"),this}},{key:"setClass",value:function(e){return this.res.setAttribute("class",e),this}},{key:"color",value:function(e){return this.res.style.color=e,this}},{key:"background",value:function(e){return this.res.style.background=e,this}},{key:"width",value:function(e){return this.res.style.width=e,this}},{key:"borderRadius",value:function(e){return this.res.style.borderRadius=e,this}},{key:"padding",value:function(e,t,r,s){return e&&t&&r&&s?(this.res.style.paddingLeft=e,this.res.style.paddingTop=t,this.res.style.paddingRight=r,this.res.style.paddingBottom=s):this.res.style.padding=e,this}},{key:"margin",value:function(e,t,r,s){return e&&t&&r&&s?(this.res.style.marginLeft=e,this.res.style.marginTop=t,this.res.style.marginRight=r,this.res.style.marginBottom=s):this.res.style.margin=e,this}},{key:"auto",value:function(){var e=this,t=function(){window.matchMedia("(max-device-width: 415px)").matches?e.res.style.fontSize="2.2rem":e.res.style.fontSize="1rem"};return t(),window.addEventListener("resize",t),this}},{key:"large",value:function(){var e=this,t=function(){window.matchMedia("(max-device-width: 415px)").matches?(alert("WOW"),e.res.style.fontSize="6rem"):e.res.style.fontSize="3rem"};return t(),window.addEventListener("resize",t),this}},{key:"border",value:function(e,t){return"none"===e&&(this.res.style.border="none"),this.res.style.border="".concat(e," solid ").concat(t,"px"),this}},{key:"frame",value:function(e){return this.res.style.width=e.width,this.res.style.height=e.height,this}},{key:"updating",value:function(e,t){var r=this.res,s=this.text;return Object.defineProperty(e,t,{set:function(e){var t=document.createTextNode(s.replace("$",e));r.replaceChild(t,r.childNodes[0])}}),this}},{key:"onTap",value:function(e){return this.res.addEventListener("click",e),this}},{key:"toCode",value:function(){var e=JSON.stringify(this.options,(function(e,t){return"function"==typeof t?t.toString():t}),4).replace(/"(\w+)":/g,"$1:").replace(/"(\(\)\s*=>\s*{[^}]*})"/g,"$1").replace(/\\n/g,"").replace(/\\"/g,'"');return['new Button("'.concat(this.text,'").set(').concat(e,")")]}},{key:"render",value:function(e){if(!e)return this.res;document.querySelector(e).appendChild(this.res)}}],s&&u(r.prototype,s),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,s}(function(){return e=function e(){var t,r,s,n=this;!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),t=this,s=function(e){if(console.log("LOBJO IS"),console.log(e),e.transform||e.op&&e.op.transform){var t=e.transform;e.transform||(t=e.op.transform),t.duration||(t.duration="3s-ease-in-out"),n.setDefault=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"0px";return 0===e.length?t+" ":e};var r=function(){var r="",s="",i="",o="",a="",l="",c="",u="",h="";if(0!==t.values.length){t.values.forEach((function(e){e.startsWith("tx:")&&(r=e.replace("tx:","")),e.startsWith("ty:")&&(s=e.replace("ty:","")),e.startsWith("tz:")?i=e.replace("tz:",""):e.startsWith("scale(")?o=e:e.startsWith("skew(")?a=e:e.startsWith("rotate(")?l=function(e){var t=e.match(/rotate\(([^)]+)\)/);if(!t)return e;var r=t[1].split(",").map((function(e){return e.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],")"):e}(e):e.startsWith("perspective(")?c=e:e.startsWith("matrix(")?u=e:e.startsWith("opacity:")&&(h=e.replace("opacity:",""))})),r=n.setDefault(r),s=n.setDefault(s),i=n.setDefault(i);var d="";if("0px"!=s&&"0px"!=r&&"0px"!=i?d+="translate3d(".concat(r,", ").concat(s,", ").concat(i,")"):"0px"==s&&"0px"==r||(d+="translate(".concat(r,", ").concat(s,")")),o&&(d+=" ".concat(o)),l&&(d+=" ".concat(l)),a&&(d+=" ".concat(a)),c&&(d+=" ".concat(c)),u&&(d+=" ".concat(u)),d){if(e.op.transform.duration){var y=e.op.transform.duration.replace(/^(\d+)(s)-/,(function(e,t,r){return t/2+r+" "})),p="transform ".concat(y,", opacity ").concat(y);n.res.style.transition=p}else n.res.style.transition="transform 3s ease-in-out, opacity 3s ease-in-out";e.op.transform.static&&(n.res.style.transition=""),(n.blastTarget||n.res).style.transform=d,n.res.style.opacity=h}else alert("OPE")}};t.on?n.res.addEventListener(t.on,(function(){t.delay?setTimeout((function(){r()}),t.delay):r()})):window.addEventListener("load",(function(){t.delay?setTimeout((function(){r()}),t.delay):r()}));var s=function(){var e="";t.values.forEach((function(t){t.startsWith("tx:")?e+="translateX(0) ":t.startsWith("ty:")?e+="translateY(0) ":t.startsWith("tz:")?e+="translateZ(0) ":t.startsWith("scale(")?e+="scale(1) ":t.startsWith("skew(")?e+="skew(0, 0) ":t.startsWith("rotate(")?e+="rotate(0) ":t.startsWith("perspective(")?e+="perspective(0) ":t.startsWith("matrix(")&&(e+="matrix(1, 0, 0, 1, 0, 0) "),n.res.style.opacity="1"})),e&&(n.res.style.transform=e.trim())};if(t.on)n.res.addEventListener("mouseout",(function(){t.keep||s()}));else{var i=1e3*parseFloat(t.duration),o=t.closeAfter?t.closeAfter:0;setTimeout((function(){t.keep||s()}),i/2+o)}t.hardCSS&&(n.res.style.transform=t.hardCSS)}else alert("THIS FIRE WITH GRADIENT (invalid block"),console.log("INVALID BLOCKA"),console.log(e)},(r=l(r="reactOnTransform"))in t?Object.defineProperty(t,r,{value:s,enumerable:!0,configurable:!0,writable:!0}):t[r]=s,this.state={isExpanded:!1,isMovedUp:!1,isMovedDown:!1}},t=[{key:"keySet",value:function(e){return this.temporaryVal=1,this.res.style[e.key]=e.value,this}},{key:"onScroll",value:function(e){var t=this;"opacity"===e.value?this.res.style.opacity=e.valMin:"scale"===e.value&&(this.res.style.transform="scale(".concat(e.valMax,")")),window.addEventListener("scroll",(function(){var r=t.smartRange(window.scrollY,{min:e.from,max:e.to},{min:e.valMin,max:e.valMax});"opacity"===e.value?t.res.style.opacity=r:"scale"===e.value&&(t.res.style.transform="scale(".concat(r,")"))}))}},{key:"setAny",value:function(e){this[Object.keys(e)[0]]=[Object.values(e)[0]]}},{key:"setID",value:function(e){this.id=e}},{key:"setPrevText",value:function(e){this.prevText=e}},{key:"getCSS",value:function(){return this.css}},{key:"getPX",value:function(e){return{xs:"0px",sm:"576px",md:"768px",lg:"992px",xl:"1200px",xxl:"1400px",mxxl:"1800px"}[e]||"Invalid breakpoint"}},{key:"respad",value:function(e){var t=this,r=function(){t.pad(e[0].values);for(var r=0;r<e.length;r++){var s=e[r].breakpoint;window.matchMedia("(min-width: ".concat(t.getPX(s))).matches&&t.pad(e[r].values)}};window.addEventListener("resize",r),r()}},{key:"resmar",value:function(e){var t=this,r=function(){t.mar(e[0].values);for(var r=0;r<e.length;r++){var s=e[r].breakpoint;window.matchMedia("(max-width: ".concat(t.getPX(s))).matches&&t.mar(e[r].values)}};window.addEventListener("resize",r),r()}},{key:"resprop",value:function(e){var t=this;console.log("RES STYLE"),console.log(e),this.prevStyles={};for(var r=0;r<this.res.style.length;r++){var s=this.res.style[r];this.prevStyles[s]=this.res.style[s],console.log("kio")}var n=function(){for(var r in t.prevStyles)t.res.style[r]=t.prevStyles[r];console.log("mkio");for(var s=0;s<e.length;s++){var n=e[s].breakpoint,i="(max-width: ".concat(n,")");if(console.log("testing media query:",i,window.matchMedia(i).matches),window.matchMedia(i).matches)for(var o in e[s])"breakpoint"!==o&&(console.log("ukio"),t.res.style[o]=e[s][o])}};window.addEventListener("resize",n),n()}},{key:"isNumber",value:function(e){return"number"==typeof e&&!isNaN(e)}},{key:"pad",value:function(e){for(var t=0;t<e.length;t++)for(var r=Object.keys(e[t]),s=0;s<r.length;s++)for(var n=r[s],i=e[t][n],o=0;o<n.length;o++)switch(n[o]){case"a":this.res.style.padding=this.isNumber(i)?"".concat(i,"px"):i;break;case"t":this.res.style.paddingTop=this.isNumber(i)?"".concat(i,"px"):i;break;case"l":this.res.style.paddingLeft=this.isNumber(i)?"".concat(i,"px"):i;break;case"r":this.res.style.paddingRight=this.isNumber(i)?"".concat(i,"px"):i;break;case"b":this.res.style.paddingBottom=this.isNumber(i)?"".concat(i,"px"):i}return this}},{key:"as",value:function(e){return this.res.style.alignSelf=e,this}},{key:"mar",value:function(e){for(var t=0;t<e.length;t++)for(var r=Object.keys(e[t]),s=0;s<r.length;s++)for(var n=r[s],i=e[t][n],o=0;o<n.length;o++){switch(n[o]){case"a":this.res.style.margin=this.isNumber(i)?"".concat(i,"px"):i;break;case"t":this.res.style.marginTop=this.isNumber(i)?"".concat(i,"px"):i;break;case"l":this.res.style.marginLeft=this.isNumber(i)?"".concat(i,"px"):i;break;case"r":this.res.style.marginRight=this.isNumber(i)?"".concat(i,"px"):i;break;case"b":this.res.style.marginBottom=this.isNumber(i)?"".concat(i,"px"):i}"auto"===n[o]&&(this.res.style.marginLeft="auto",this.res.style.marginRight="auto")}return this}},{key:"smartRange",value:function(e,t,r){e<t.min&&(e=t.min),e>t.max&&(e=t.max);var s=(e-t.min)/(t.max-t.min);t.min>t.max&&(s=(e-t.max)/(t.min-t.max));var n=(r.min-r.max)*s-r.min;if(n=Math.abs(n),r.min<r.max){var i=(r.max+Math.abs(r.min))*s;n=r.min+i}return n}},{key:"gpos",value:function(e){return this.res.style.gridColumn=e.col,this.res.style.gridRow=e.row,this}},{key:"fluidCopy",value:function(e){if(e instanceof Object){this.prevStylex=this.res.style,this.res=document.createElement("h1"),this.res.style.cssText=this.prevStylex.cssText;var t=document.createTextNode(this.text);return this.res.appendChild(t),this.res.style.fontSize=e.exact,this}if("S1"===e){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"===e){this.prevStylex=this.res.style,this.res=document.createElement("h2"),this.res.style.cssText=this.prevStylex.cssText;var s=document.createTextNode(this.text);this.res.appendChild(s),this.res.style.fontSize="calc(1.500rem + 4.3vw)"}if("S3"===e){this.prevStylex=this.res.style,this.res=document.createElement("h3"),this.res.style.cssText=this.prevStylex.cssText;var n=document.createTextNode(this.text);this.res.appendChild(n),this.res.style.fontSize="calc(1.375rem + 3.525vw)"}if("S4"===e){this.prevStylex=this.res.style,this.res=document.createElement("h4"),this.res.style.cssText=this.prevStylex.cssText;var i=document.createTextNode(this.text);this.res.appendChild(i),this.res.style.fontSize="calc(1.250rem + 2.75vw)"}if("S5"===e){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"===e&&(this.res.style.fontSize="calc(1rem + 0.5vw)"),this}},{key:"setIndex",value:function(e){this.index=e}},{key:"borderObj",value:function(e){var t,r=null!==(t=e.type)&&void 0!==t?t:"solid";return this.res.style.border="".concat(e.width," ").concat(r," ").concat(e.color),this.res.style.borderRadius=e.radius,this}},{key:"setPref",value:function(e){this.preffersId=e}},{key:"setClass",value:function(e){this.class=e}},{key:"setTags",value:function(e){this.openTag=e.open,this.closeTag=e.close,console.log("TAGS SET"),console.log(e)}},{key:"chainReact",value:function(e,t,r){var i=this;console.log("0P"),this.ap=!1,this.cta=0,this.once=!1;var o,a=n(e);try{for(a.s();!(o=a.n()).done;){var l=o.value;l.range||(l.range=["0px","999999px"])}}catch(e){a.e(e)}finally{a.f()}e.sort((function(e,t){return parseInt(e.range[0])-parseInt(t.range[0])}));var c=function(o){var a=window.visualViewport.width,l=[],c=[];i.resCopy=i.res,i.storedQueries=e.map((function(e){return e.target})).filter((function(e){return null!=e}));var u,h=n(e);try{for(h.s();!(u=h.n()).done;){var d=u.value;i.counterIndex++;var y=s(d.range,2),p=y[0],f=y[1],m=parseInt(p),v=parseInt(f),g=!0;if(d.target){g=!1;for(var b=0;b<d.target.length;b++)d.target[b]===t&&(g=!0)}a>=m&&a<=v&&g&&(l.push(d.log),c.push(d),d.op&&d.op.margin&&(i.useMargin=d.op.margin))}}catch(e){h.e(e)}finally{h.f()}if(r&&!r.includes("background")&&(i.res.style.background="",i.res.style.backgroundColor=""),i.res.style.textShadow="",r&&!r.includes("border")&&(i.res.style.border=""),r&&!r.includes("margin")&&(i.res.style.margin=""),i.res.style["-webkit-text-fill-color"]="",i.res.style["-webkit-text-stroke-color"]="",i.res.style["-webkit-text-stroke-width"]="",i.res.style.filter="",i.options.background&&(console.log(i.options.background),i.res.style.background=i.options.background),l.includes("gradient"),(l.includes("gradient")||l.includes("shadow"))&&(i.res.style.position="relative"),l.includes("blast")){var x,w=c.filter((function(e){return"blast"===e.log}))[0].op.color,k=null!==(x=c.filter((function(e){return"blast"===e.log}))[0].op.width)&&void 0!==x?x:"1px";"FlexRowLayoutElement"===i.getType()||"LayoutWrapperElement"===i.getType()?(i.res.style.border="".concat("number"==typeof k?k+"px":k," solid orange"),i.res.style.display="inline-block","FlexRowLayoutElement"===i.getType()&&(i.res.style.display="flex"),i.res.style.boxSizing="border-box",i.res.style.transformOrigin="center",i.blastTarget=i.res):(i.text&&(i.res.textContent=i.text),i.res.style["-webkit-text-fill-color"]="transparent",i.res.style["-webkit-text-stroke-color"]=w,i.res.style["-webkit-text-stroke-width"]="".concat(k))}if(l.includes("filter")){var S=c.filter((function(e){return"filter"===e.log}))[0].op.filter;i.res.style.filter=S}if(l.includes("background")&&(i.res.style.backgroundColor="green"),l.includes("gradient")&&("LayoutWrapperElement"!==i.getType()&&"FlexRowLayoutElement"!==i.getType()&&(i.res.style["-webkit-text-fill-color"]="transparent"),i.res.style.background=i.globalGradient,"LayoutWrapperElement"!==i.getType()&&"FlexRowLayoutElement"!==i.getType()&&(i.res.style["background-clip"]="text")),l.includes("shadow")){var T,E="",O=0;for(b=0;b<i.options.shadow.op.steps;b++){var C;E+="drop-shadow(".concat(O+=3,"px ").concat(O,"px ").concat(O,"px ").concat(null!==(C=i.options.shadow.color)&&void 0!==C?C:"gray",") ")}"FlexRowLayoutElement"===i.getType()||"LayoutWrapperElement"===i.getType()?i.res.style.boxShadow="".concat(O,"px ").concat(O,"px ").concat(O,"px ").concat(null!==(T=i.options.shadow.color)&&void 0!==T?T:"gray"):i.res.style.filter=E}if(l.includes("margin"))for(b=0;b<e.length;b++)if(e[b].op){var L=e[b].op.offsets;L&&void 0!==i.index&&(i.res.style.margin=L[Number(i.index)]+"px")}if(l.includes("spana")||l.includes("span")){if(i.res=i.resCopy,i.options.span){var j;for(j=Array.isArray(i.options.span)?i.options.span.filter((function(e){return"span"===e.op.name}))[0]:i.options.span,i.res.textContent="",b=0;b<j.op.parts.length;b++){var N=j.op.parts[b].style,P=new i.constructor(j.op.parts[b].text).setup({type:"span"}).set(N).render();i.res.appendChild(P)}}}else{var R=new i.constructor(i.prevText).set({}).render();i.prevText&&i.prevText.length>0&&o&&i.res.appendChild(R)}if(l.includes("animation")){if(i.options.animation&&!i.hasAnimated&&!i.options.animation.op.fireAt){console.warn(i.openTag),i.hasAnimated=!0;var W=i.options.animation.op;window.addEventListener("sidebar:open",(function(){i.res.animate(W.keyframesOpen,W.openOptions)})),window.addEventListener("sidebar:closed",(function(){i.res.animate(W.keyframesClose,W.closeOptions)})),i.res.animate(W.keyframesClose,{duration:0,fill:"forwards"}),i.openTag&&i.closeTag&&(window.addEventListener(i.openTag,(function(){i.res.animate(W.keyframesOpen,W.openOptions)})),window.addEventListener(i.closeTag,(function(){i.res.animate(W.keyframesClose,W.closeOptions)})))}if(i.options.animation&&i.options.animation.op.fireAt&&i.options.animation.op.fireAt.endsWith("px")){var z=i.options.animation.op;i.res.animate(z.keyframesClose,{duration:0,fill:"forwards"});var M=function(){window.scrollY>parseFloat(z.fireAt)&&(i.res.animate(z.keyframesOpen,z.openOptions),window.removeEventListener("scroll",M))};window.addEventListener("scroll",M)}if(i.options.animation&&i.options.animation.op.fireAt&&"inview"===i.options.animation.op.fireAt){var A=i.options.animation.op;i.res.animate(A.keyframesClose,{duration:0,fill:"forwards"}),new IntersectionObserver((function(e,t){e.forEach((function(e){e.isIntersecting&&(i.res.animate(A.keyframesOpen,A.openOptions),t.disconnect())}))})).observe(i.res)}}};this.options.animation||window.addEventListener("resize",(function(){return c()})),c()}},{key:"maxWidth",value:function(e){return this.res.style.maxWidth=e,this}},{key:"removeQuotesFromFirstWord",value:function(e){return e.replace(/"([^"]+)":/g,"$1:")}},{key:"arrayMargin",value:function(e,t){return e.includes("left")&&(this.res.style.marginLeft=t),e.includes("right")&&(this.res.style.marginRight=t),e.includes("top")&&(this.res.style.marginTop=t),e.includes("bottom")&&(this.res.style.marginBottom=t),e.includes("all")&&(this.res.style.margin=t),t||(this.res.style.marginBottom=e),this}}],t&&a(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e;var e,t}());module.exports=t})();