nodality
Version:
A lightweight library for declarative UI elements.
2 lines • 35.8 kB
JavaScript
/*! For license information please see container.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,s,i,o,a=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){c=!0,s=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}(t,e)||i(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 s(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=i(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,s=function(){};return{s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:s}}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 i(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){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=h(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,s=function(){};return{s,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:s}}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 i,o=!0,a=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return o=t.done,t},e:function(t){a=!0,i=t},f:function(){try{o||null==r.return||r.return()}finally{if(a)throw i}}}}function h(t,e){if(t){if("string"==typeof t)return d(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)?d(t,e):void 0}}function d(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 y(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,f(n.key),n)}}function f(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 p(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(p=function(){return!!t})()}function m(){return m="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(t,e,r){var n=function(t,e){for(;!{}.hasOwnProperty.call(t,e)&&null!==(t=g(t)););return t}(t,e);if(n){var s=Object.getOwnPropertyDescriptor(n,e);return s.get?s.get.call(arguments.length<3?t:r):s.value}},m.apply(null,arguments)}function g(t){return g=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},g(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,{Wrapper:()=>b});var b=function(t){function e(t){var r;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(r=function(t,e,r){return e=g(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,p()?Reflect.construct(e,r||[],g(t).constructor):e.apply(t,r))}(this,e)).res=null,r.setup(t),r.code=[],r.isLast=!1,r.constrObj=t,r.code.push("\n new Wrapper() \n"),r}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:"isLasta",value:function(){return this.isLast=!0,this}},{key:"toCode",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;if(this.code=[],this.excludeFromCodeTrue)return[""];var e=" ".repeat(t),r="".concat(e,'new Wrapper("').concat(this.constrObj,'")');if(this.constrObj||(r="".concat(e,"new Wrapper()")),Object.keys(this.obj).length){var n=Object.fromEntries(Object.entries(this.obj).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,s,i,o,a=[],l=!0,c=!1;try{if(i=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;l=!1}else for(;!(l=(n=i.call(r)).done)&&(a.push(n.value),a.length!==e);l=!0);}catch(t){c=!0,s=t}finally{try{if(!l&&null!=r.return&&(o=r.return(),Object(o)!==o))return}finally{if(c)throw s}}return a}}(t,e)||h(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]}))),s=JSON.stringify(n,null,2).replace(/"([^"]+)":/g,"$1:");r+="\n".concat(e," .set(").concat(s,")")}return this.items.length&&(r+="\n".concat(e," .add([\n")+this.items.map((function(e){return e.toCode(t+4)})).join(",\n")+"\n".concat(e," ])")),[r+="\n".concat(e)]}},{key:"getType",value:function(){return"LayoutWrapperElement"}},{key:"setArea",value:function(t){return this.res.style.gridArea=t,this}},{key:"removeQuotesFromFirstWord",value:function(t){return t.replace(/"([^"]+)":/g,"$1:")}},{key:"clicked",value:function(t){return this.res.addEventListener("click",t),this}},{key:"gpos",value:function(t){return this.res.style.gridColumn=t.col,this.res.style.gridRow=t.row,this}},{key:"set",value:function(t){this.obj=t;var r=".set({";t.scale&&(this.res.style.scale=t.scale),t.scale&&(r+="scale: ".concat(t.scale)),t.keySet&&this.keySet(t.keySet),t.pad&&this.pad(t.pad),t.mar&&this.mar(t.mar),t.arrpad&&(r+="pad: {sides: [".concat(t.arrpad.sides.map((function(t){return'"'.concat(t,'"')})).join(", "),'], value: "').concat(t.arrpad.value,'"}, ')),t.gpos&&this.gpos(t.gpos);var n,s,i,o=[];if(t.stroke||t.gradient||t.span||t.backgroundOp||t.layout||t.shadow||t.animation||t.filtera||t.transform){t.gradient&&(this.globalGradient=t.gradient.op.gradient,"radial"===t.gradient.op.direction&&(this.globalGradient="radial-gradient(circle at center, orange, green)")),t.stroke&&(n=e,s=this,"function"==typeof(i=m(g(1&3?n.prototype:n),"setAny",s))?function(t){return i.apply(s,t)}:i)([{globalBlast:"".concat(t.stroke.op.width," ").concat(t.stroke.op.color)}]),t.span&&(t.span.prevText=this.text);var a=[t.stroke,t.gradient,t.animation,t.span,t.backgroundOp,t.layout,t.marginOp,t.shadow,t.animation,t.filtera,t.transform];a=a.filter((function(t){return null!=t}));for(var l=0;l<a.length;l++)o.push({range:a[l].range,log:a[l].op.name,target:a[l].target,op:a[l].op});var c=[];t.borderObj&&c.push("border"),t.background&&c.push("background"),t.mar&&c.push("margin"),t.animation&&c.push("animation"),t.span&&c.push("span"),t.transform&&c.push("transform"),t.gradient&&c.push("gradient"),t.blast,console.log("CARA IS "),console.log(o),this.options=t,this.chainReact(o,this.options.id,c)}if(t.centerColumn&&(this.res.style.display="flex",this.res.style.flexDirection="column",this.res.style.alignItems="center",t.centerColumn&&(r+="centerColumn: ".concat(t.centerColumn,","))),t.mboth&&(this.res.style.marginRight="auto")&&(this.res.style.marginLeft="auto"),t.mar&&this.mar(t.mar),t.sticky&&this.sticky(),t.transition&&(this.res.style.transition=t.transition),t.class&&this.res.setAttribute("class",t.class),t.ga&&(this.res.style.gridArea=t.ga),t.opacity&&(0==t.opacity&&(this.res.style.opacity=0),t.opacity&&(this.res.style.opacity=t.opacity)),t.maxHeight&&(this.res.style.maxHeight=t.maxHeight),t.id&&this.res.setAttribute("id",t.id),t.arrpad&&this.arrayPadding(t.arrpad.sides,t.arrpad.value),t.arrpad&&(r+="arrpad: {sides: [".concat(t.arrpad.sides.map((function(t){return'"'.concat(t,'"')})).join(", "),'], value: "').concat(t.arrpad.value,'"}, ')),t.arrayMargin&&this.arrayMargin(t.arrayMargin.sides,t.arrayMargin.value),t.arrayMargin&&(r+='\n arrayMargin: {sides: ["'.concat(t.arrayMargin.sides,'"], value: "').concat(t.arrayMargin.value,'"},')),t.center&&this.toCenter(t.center),t.center&&(r+='center: "'.concat(t.center,'",')),t.simpleCenter&&this.simpleCenter(),t.simpleCenter&&(r+='center: "'.concat(t.simpleCenter,'",')),t.filter&&(this.res.style.backdropFilter="blur(3px)"),t.radius&&this.corner(t.radius),t.radius&&(r+='\n radius: "'.concat(t.radius,'",')),t.border&&this.border(t.border),t.simpleBorder&&(this.res.style.border=t.simpleBorder),t.width&&this.width(t.width),t.width&&(r+='\n width: "'.concat(t.width,'",')),t.overflow&&(this.res.style.overflow="hidden"),t.overflow&&(r+='\n overflow: "'.concat(t.overflow,'",')),t.height&&this.heightNoAuto(t.height),t.height&&(r+='\n height: "'.concat(t.height,'",')),t.align&&this.flexAlign(t.align),t.align&&(r+='\n align: "'.concat(t.align,'",')),t.borderObj&&(this.res.style.borderRight="".concat(t.borderObj.width," solid ").concat(t.borderObj.color),this.res.style.borderRadius=t.borderObj.radius),t.borderObja&&(this.res.style.border="".concat(t.borderObja.width," solid ").concat(t.borderObja.color),this.res.style.borderRadius=t.borderObja.radius),t.font&&this.font(t.font),t.font&&(r+='font: "'.concat(t.font,'",')),t.maxWidth&&this.maxWidth(t.maxWidth),t.flexCenter&&this.flexc(t.flexCenter),t.multipad&&this.makeMultiPad(t.multipad),t.multimargin&&this.makeMultiMargin(t.multimargin),t.color&&this.color(t.color),t.background&&this.background(t.background),t.background&&(r+='background: "'.concat(t.background,'",')),t.weight&&this.weight(t.weight),t.paddings&&this.paddingo(t.paddings),t.area&&this.setArea(t.area),t.area&&(r+='area: "'.concat(t.area,'"')),t.column&&this.makeCol(),t.column&&(r+='\n column: "'.concat(t.column,'",')),t.alignIts&&(this.res.style.background="gray"),t.alignIts&&(this.res.style.alignItems="flex-start"),t.alignIts&&(this.res.style.justifyItems="flex-start"),t.customAlign&&(this.res.style.alignItems=t.customAlign),t.customJustify&&(this.res.style.justifyItems=t.customJustify),t.disp&&(this.res.style.display=t.disp),t.flexDir&&(this.res.style.flexDirection=t.flexDir),t.flexDir&&(this.res.style.display="flex"),t.flexDir&&(r+='\n flexDir: "'.concat(t.flexDir,'",')),t.zIndex&&(this.res.style.zIndex=t.zIndex),t.transform&&this.reactOnTransform(t.transform),t.name&&(this.name=t.name),t.responsive&&this.rsp(t.responsive),t.stretch){t.stretch&&this.stretch(t.stretch);var h=this.removeQuotesFromFirstWord(JSON.stringify(t.stretch));r+="\n stretch: ".concat(h,",")}for(var d in t)if("margin"===d){var y=t[d];if(Array.isArray(y)&&y.length>0){var f,p=u(y);try{for(p.s();!(f=p.n()).done;){var v=f.value;v.hasOwnProperty("top")&&(this.res.style.marginTop=v.top),v.hasOwnProperty("right")&&(this.res.style.marginRight=v.right),v.hasOwnProperty("bottom")&&(this.res.style.marginBottom=v.bottom),v.hasOwnProperty("left")&&(this.res.style.marginLeft=v.left)}}catch(t){p.e(t)}finally{p.f()}}}return 8===(r+="})\n").length&&(r=""),this.code.push(r),this}},{key:"rsp",value:function(t){var e=this;this.res.style.display="flex";var r=t.sequence.split("-"),n=function(){var n=t.ranges;"0px"!==n[0]&&n.unshift("0px");for(var s=0;s<n.length-1;s++)(window.matchMedia("(min-width: ".concat(n[s],") and (max-width: ").concat(n[s+1],")")).matches||window.matchMedia("(min-width: ".concat(n[n.length-1],")")).matches)&&("row"===r[s]&&(e.res.style.flexDirection="row",e.res.style.border="3px solid green"),"col"===r[s]&&(e.res.style.flexDirection="column",e.res.style.border="3px solid purple"));return e};window.addEventListener("resize",n),n()}},{key:"sticky",value:function(){return this.res.style.position="sticky",this.res.style.top=0,this}},{key:"toSticky",value:function(){return this.res.style.position="sticky",this.res.style.top="0",this}},{key:"stretch",value:function(t){var e=this,r=function(){window.matchMedia("(max-width: ".concat(t.at,")")).matches?e.res.style.width="auto":window.matchMedia("(max-device-width: 415px)").matches?e.res.style.width="100%":e.res.style.width=t.backTo};r(),window.addEventListener("resize",r)}},{key:"makeCol",value:function(){return this.res.style.display="flex",this.res.style.flexDirection="column",this.res.style.alignItems="flex-start",this}},{key:"paddingo",value:function(t){return this.res.style.padding=t,this}},{key:"toCenter",value:function(t){return this.res.style.display="flex",this.res.style.flexDirection="column",this.res.style.justifyContent="center","both"===t&&(this.res.style.alignItems="center"),this}},{key:"simpleCenter",value:function(){return this.res.style.justifyContent="center",this.res.style.justifyItems="center",this.res.style.alignContent="center",this.res.style.alignItems="center",this}},{key:"color",value:function(t){return this.res.style.color=t,this}},{key:"weight",value:function(t){return this.res.style.fontWeight=t,this}},{key:"makeMultiPad",value:function(t){for(var e=0;e<t.length;e++)"left"===t[e].side&&(this.res.style.paddingLeft=t[e].value),"right"===t[e].side&&(this.res.style.paddingRight=t[e].value);return this}},{key:"makeMultiMargin",value:function(t){this.res.style.zIndex="1";for(var e=0;e<t.length;e++)"left"===t[e].side&&(this.res.style.marginLeft=t[e].value),"right"===t[e].side&&(this.res.style.marginRight=t[e].value),"top"===t[e].side&&(this.res.style.marginTop=t[e].value),"bottom"===t[e].side&&(this.res.style.marginBottom=t[e].value);return this}},{key:"flexc",value:function(t){return this.res.style.display="flex",this.res.style.flexDirection="column",this.res.style.justifyContent="center",this}},{key:"maxWidth",value:function(t){return this.res.style.maxWidth=t,this}},{key:"font",value:function(t){return this.res.style.fontFamily=t,this}},{key:"flexAlign",value:function(t){return this.res.style.display="flex",this.res.style.justifyContent="flex-start",this.res.style.alignItems="flex-start","center"===t?(this.res.style.display="flex",this.res.style.flexDirection="column",this.res.style.alignItems="center",this):this}},{key:"width",value:function(t){return this.res.style.width=t,this}},{key:"heightNoAuto",value:function(t){return this.res.style.height=t,this}},{key:"border",value:function(t){return this.res.style.borderRadius="".concat(t.radius,"px"),this.res.style.padding="0.25em",this.res.style.border="".concat(t.width,"px solid ").concat(t.color),this}},{key:"toCol",value:function(){return this.res.style.display="flex",this.res.style.flexDirection="column",this.res.style.justifyContent="center",this.res.style.alignItems="center",this}},{key:"add",value:function(t){this.items=t,this.code.push(".add([ \n");var e=t.map((function(e,r){return e.toCode().flatMap((function(t){return t})).join("")+(r<t.length-1?",":"")})).join("");this.code.push(e);for(var r=0;r<t.length;r++)if(void 0!==t[r]&&void 0!==t[r].toCode){var n=t[r].render();this.res.appendChild(n)}return this.code.push("])"),this}},{key:"arrayPadding",value:function(t,e){return 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),this}},{key:"arrayMargin",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")),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),this}},{key:"setWidth",value:function(t){this.res.style.width="100vw"}},{key:"setHeight",value:function(t){return this.res.style.height="".concat(t),this}},{key:"setup",value:function(t){var e=null;return t?(t.isLink&&(e=document.createElement("a")),"aside"===t&&(e=document.createElement("aside")),"article"===t&&(e=document.createElement("article")),"main"===t&&(e=document.createElement("main")),"section"===t&&(e=document.createElement("section")),"header"===t&&(e=document.createElement("header")),"footer"===t&&(e=document.createElement("footer"))):e=document.createElement("div"),t&&t.isLink&&(e.style.textDecoration="none",e.setAttribute("href",t.child)),this.res=e,this.res.style.margin=0,this.res.style.padding=0,t&&!0===t.hideOverflow&&(this.res.style.overflow="hidden",this.res.style.overflowY="scroll"),t&&!0===t.center&&(this.res.style.display="flex",this.res.style.flexDirection="column",this.res.style.justifyContent="center",this.res.style.alignItems="center"),t&&"left"===t.align&&(this.res.style.alignItems="flex-start"),t&&"right"===t.align&&(this.res.style.alignItems="flex-end"),t&&t.height&&(this.res.style.height=t.height),t&&t.width&&(this.res.style.width=t.width,this.res.style.marginLeft="auto",this.res.style.marginRight="auto",window.matchMedia("(max-device-width: 415px)").matches&&(this.res.style.width="95%")),this}},{key:"height",value:function(t){return this.res.style.width="auto",this.res.style.height="".concat(t),this}},{key:"size",value:function(t,e){return this.w=t,this.h=e,this.w?this.res.style.width=this.w:this.res.style.width=window.innerWidth,this.h?this.res.style.height=this.h:this.res.style.height=window.innerHeight,this}},{key:"background",value:function(t){return this.res.style.background=t,this}},{key:"corner",value:function(t){return this.res.style.borderRadius=t,this}},{key:"padding",value:function(t,e,r,n){return this.res.style.paddingLeft=t,this.res.style.paddingTop=e,this.res.style.paddingRight=r,this.res.style.paddingBottom=n,this}},{key:"margin",value:function(t,e,r,n){return this.res.style.marginLeft=t,this.res.style.marginTop=e,this.res.style.marginRight=r,this.res.style.marginBottom=n,this}},{key:"itemWidth",value:function(t){for(var e=0;e<this.res.childNodes.length;e++)this.res.childNodes[e].style.width=t;return this}},{key:"apply",value:function(t){var e=this,r=function(){for(var r=0;r<t.length;r++){var n=t[r],s=window.matchMedia("(max-width: ".concat(n.width,"px)"));n.device&&(s=window.matchMedia("(max-device-width: ".concat(n.width,"px)")),alert(n.device)),s.matches&&Object.assign(e.res.style,n.styles)}},n=window.matchMedia("(max-width: ".concat(t[0].width,"px)"));return t[0].device&&(n=window.matchMedia("(max-device-width: ".concat(t[0].width,"px)"))),n.matches||Object.assign(this.res.style,t[0].styles),r(),window.addEventListener("resize",r),this}},{key:"mount",value:function(t){document.querySelector(t).appendChild(this.res)}},{key:"render",value:function(t){return t?(document.querySelector("#mount"),document.querySelector(t).appendChild(this.res),this):this.res}}],n&&y(r.prototype,n),Object.defineProperty(r,"prototype",{writable:!1}),r;var r,n}(function(){return t=function t(){var e,r,n,s=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"),s.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="",i="",o="",a="",l="",c="",u="",h="";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:")?i=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:")&&(h=t.replace("opacity:",""))})),r=s.setDefault(r),n=s.setDefault(n),i=s.setDefault(i);var d="";if("0px"!=n&&"0px"!=r&&"0px"!=i?d+="translate3d(".concat(r,", ").concat(n,", ").concat(i,")"):"0px"==n&&"0px"==r||(d+="translate(".concat(r,", ").concat(n,")")),o&&(d+=" ".concat(o)),l&&(d+=" ".concat(l)),a&&(d+=" ".concat(a)),c&&(d+=" ".concat(c)),u&&(d+=" ".concat(u)),d){if(t.op.transform.duration){var y=t.op.transform.duration.replace(/^(\d+)(s)-/,(function(t,e,r){return e/2+r+" "})),f="transform ".concat(y,", opacity ").concat(y);s.res.style.transition=f}else s.res.style.transition="transform 3s ease-in-out, opacity 3s ease-in-out";t.op.transform.static&&(s.res.style.transition=""),(s.blastTarget||s.res).style.transform=d,s.res.style.opacity=h}else alert("OPE")}};e.on?s.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) "),s.res.style.opacity="1"})),t&&(s.res.style.transform=t.trim())};if(e.on)s.res.addEventListener("mouseout",(function(){e.keep||n()}));else{var i=1e3*parseFloat(e.duration),o=e.closeAfter?e.closeAfter:0;setTimeout((function(){e.keep||n()}),i/2+o)}e.hardCSS&&(s.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 s=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 s=t[n].breakpoint,i="(max-width: ".concat(s,")");if(console.log("testing media query:",i,window.matchMedia(i).matches),window.matchMedia(i).matches)for(var o in t[n])"breakpoint"!==o&&(console.log("ukio"),e.res.style[o]=t[n][o])}};window.addEventListener("resize",s),s()}},{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 s=r[n],i=t[e][s],o=0;o<s.length;o++)switch(s[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(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 s=r[n],i=t[e][s],o=0;o<s.length;o++){switch(s[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"===s[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 s=(r.min-r.max)*n-r.min;if(s=Math.abs(s),r.min<r.max){var i=(r.max+Math.abs(r.min))*n;s=r.min+i}return s}},{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 s=document.createTextNode(this.text);this.res.appendChild(s),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 i=document.createTextNode(this.text);this.res.appendChild(i),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 i=this;console.log("0P"),this.ap=!1,this.cta=0,this.once=!1;var o,a=s(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=[];i.resCopy=i.res,i.storedQueries=t.map((function(t){return t.target})).filter((function(t){return null!=t}));var u,h=s(t);try{for(h.s();!(u=h.n()).done;){var d=u.value;i.counterIndex++;var y=n(d.range,2),f=y[0],p=y[1],m=parseInt(f),g=parseInt(p),v=!0;if(d.target){v=!1;for(var b=0;b<d.target.length;b++)d.target[b]===e&&(v=!0)}a>=m&&a<=g&&v&&(l.push(d.log),c.push(d),d.op&&d.op.margin&&(i.useMargin=d.op.margin))}}catch(t){h.e(t)}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 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"===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"]=x,i.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;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 O,T="",j=0;for(b=0;b<i.options.shadow.op.steps;b++){var E;T+="drop-shadow(".concat(j+=3,"px ").concat(j,"px ").concat(j,"px ").concat(null!==(E=i.options.shadow.color)&&void 0!==E?E:"gray",") ")}"FlexRowLayoutElement"===i.getType()||"LayoutWrapperElement"===i.getType()?i.res.style.boxShadow="".concat(j,"px ").concat(j,"px ").concat(j,"px ").concat(null!==(O=i.options.shadow.color)&&void 0!==O?O:"gray"):i.res.style.filter=T}if(l.includes("margin"))for(b=0;b<t.length;b++)if(t[b].op){var C=t[b].op.offsets;C&&void 0!==i.index&&(i.res.style.margin=C[Number(i.index)]+"px")}if(l.includes("spana")||l.includes("span")){if(i.res=i.resCopy,i.options.span){var A;for(A=Array.isArray(i.options.span)?i.options.span.filter((function(t){return"span"===t.op.name}))[0]:i.options.span,i.res.textContent="",b=0;b<A.op.parts.length;b++){var I=A.op.parts[b].style,L=new i.constructor(A.op.parts[b].text).setup({type:"span"}).set(I).render();i.res.appendChild(L)}}}else{var M=new i.constructor(i.prevText).set({}).render();i.prevText&&i.prevText.length>0&&o&&i.res.appendChild(M)}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 R=i.options.animation.op;i.res.animate(R.keyframesClose,{duration:0,fill:"forwards"});var P=function(){window.scrollY>parseFloat(R.fireAt)&&(i.res.animate(R.keyframesOpen,R.openOptions),window.removeEventListener("scroll",P))};window.addEventListener("scroll",P)}if(i.options.animation&&i.options.animation.op.fireAt&&"inview"===i.options.animation.op.fireAt){var N=i.options.animation.op;i.res.animate(N.keyframesClose,{duration:0,fill:"forwards"}),new IntersectionObserver((function(t,e){t.forEach((function(t){t.isIntersecting&&(i.res.animate(N.keyframesOpen,N.openOptions),e.disconnect())}))})).observe(i.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})();