From 7bad28b4c9431a21aa3cca0523abfa64225d0b12 Mon Sep 17 00:00:00 2001 From: Denis <76569844+DenisPower1@users.noreply.github.com> Date: Tue, 22 Jun 2021 06:12:51 -0700 Subject: [PATCH] minified version --- inter.min.js | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 inter.min.js diff --git a/inter.min.js b/inter.min.js new file mode 100644 index 0000000..713f3a4 --- /dev/null +++ b/inter.min.js @@ -0,0 +1,2 @@ +!function(){function e(e){return"[object Object]"==Object.prototype.toString.call(e)}function t(e){return Array.isArray(e)}function n(e){return"function"==r(e)}function r(e){return typeof e}function o(e){return e in this}function s(e){return void 0!==e&&null!=e}function l(e){const t=e.tagName;return"input"==de.call(t)||"textarea"==de.call(t)}function a(e){if("production"==ee.status||"development"!=ee.status)return!1;throw new SyntaxError(e)}function i(e){if("production"!=ee.status&&"development"==ee.status)throw new TypeError(e)}function c(e){const t=document.getElementById(e);if(e+""!="null")return t;a(`\n There is not an element by id ${e} in document.\n `)}function u(e){"production"!=ee.status&&"development"==ee.status&&console.warn(e)}function d(e){return document.createTextNode(e)}function h(e,t){if(q(e))return e.hasAttribute(t)}function f(e){return document.createElement(e)}function p(e,t,n){return void 0==e?void 0:e.setAttribute(t,n)}function g(e,t){return void 0==e?void 0:e.getAttribute(t)}function m(e){return 1==e}function y(e){return"a"==de.call(e.nodeName)||"button"==de.call(e.nodeName)}function b(e){const t=f(e.nodeName);for(let n of e.children){const e=n.cloneNode(!0);if(Object.entries(n).forEach(t=>{const[n,r]=t,o=n.replace("_","");e[o]=r,n.startsWith("_")&&(e[n]=r)}),V(n)){let t=-1;for(let r of n.children){t++;const n=r.cloneNode(!0);Object.entries(r).forEach(e=>{const[t,r]=e,o=t.replace("_","");n[o]=r}),e.replaceChild(n,e.children[t])}}t.appendChild(e)}return t}function w(e,t){return!Object.is(e,t)}function v(){}function x(){try{let e=new Map;return e.set("Libray","Inter"),e.set("Creator","Denis"),e.clear(),!0}catch(e){return!1}}function O(e,t){if(function(e,t){const n=de.call(e.nodeName),r=de.call(t.nodeName);return o.call({video:!0,audio:!0,input:!0,textarea:!0},n)&&!w(n,r)}(e,t)){const n=le(e,t),r=e.attributes,o=t.attributes;for(let s=0;n>s;s++){const n=r[s],l=o[s];h(e,l.name)?w(l.value,n.value)&&("value"!=l.name?p(t,l.name,n.value):t.value=n.value):t.removeAttribute(l.name)}}else{const r=e.attributes,o=t.attributes;if(n=t,Object.is(e.textContent,n.textContent))if(r.length!=o.length)t.parentNode.replaceChild(e,t);else for(let n of r){if(!h(t,n.name)){t.parentNode.replaceChild(e,t);break}if(h(t,n.name)&&w(g(t,n.name),n.value)){t.parentNode.replaceChild(e,t);break}}else t.parentNode.replaceChild(e,t)}var n}function j(e){return void 0!=e&&1==e.nodeType}function C(t){if(void 0!==new.target&&a("\n You must not create an instance for whileLoading() function. \n "),e(t)){const{elements:e}=t;let r=null;[...e].forEach(e=>{const{tag:t,attrs:o={},events:l={},children:i}=e;s(i)&&!E(i)||a("\n Oh, you must define the children array, and it must not be empty.\n ");const c=f(t);Object.entries(o).forEach(e=>{const[t,n]=e;p(c,t,n)}),Object.entries(l).forEach(e=>{const[t,n]=e;c[t]=n}),i.forEach(e=>{const{tag:t,events:r={},attrs:o={},text:l}=e,a=f(t);Object.entries(r).forEach(e=>{const[t,n]=e;a[t]=n}),Object.entries(o).forEach(e=>{const[t,n]=e;p(a,t,n)}),s(l)&&(n(l)?a.appendChild(d(l())):a.appendChild(d(l))),c.appendChild(a)}),r=c,document.body.appendChild(c)}),document.onreadystatechange=function(){"complete"==this.readyState&&this.body.removeChild(r)}}else a("\n The value passed as argument in the method \n whileLoading() must be any object.\n \n ")}function E(e){return 0==e.length}function N(r){const{elements:o}=r;t(o)||a('\n The property "elements" must be an array.\n ');let l=re.create(null);return o.forEach(t=>{e(t)||a('\n The itens of array "elements" must be objects with at least\n "tag" property. \n ');const{tag:r,text:o,attrs:i={},events:c={},children:u=[],handlers:h={},styles:g={}}=t,m=f(r);Object.entries(i).forEach(e=>{const[t,r]=e;n(i[t])?s(i[t]())&&p(m,t,i[t]()):s(r)&&p(m,t,r)}),Object.entries(c).forEach(e=>{const[t,n]=e;m[t]=n,m.rerender=!0}),Object.values(h).forEach(e=>{if(n(e))return m.rerender=!0,h[e].call(m)}),Object.entries(g).forEach(e=>{const[t,r]=e;n(r)?s(r())&&(m.style[t]=r()):s(r)&&(m.style[t]=r)}),E(u)||u.forEach((e,t)=>{const{tag:r,text:o,attrs:l={},events:a={},render:i,handlers:c={},styles:u={},children:h=[]}=e,g=f(r);w(i,!0)&&w(i,!1)||(g.render=i,g.index=t),Object.entries(l).forEach(e=>{const[t,r]=e;n(r)?s(r())&&p(g,t,r()):s(r)&&p(g,t,r)}),Object.entries(a).forEach(e=>{const[t,n]=e;g[t]=n,g[`_${t}`]=n,g.rerender=!0}),Object.values(c).forEach(e=>{if(n(e))return g.rerender=!0,c[e].call(g)}),Object.entries(u).forEach(e=>{const[t,r]=e;g.style[t]=n(r)?r():r}),s(o)&&(n(o)?g.appendChild(d(o())):g.appendChild(d(o))),Array.from(h).forEach((e,t)=>{const{tag:r,text:o,render:l,attrs:a={},events:i={},handlers:c={},styles:u={}}=e,h=f(r);w(l,!0)&&w(l,!1)||(h.render=l,h.index=t),Object.entries(a).forEach(e=>{const[t,r]=e;n(r)?s(r())&&p(h,t,r()):s(r)&&p(h,t,r)}),Object.entries(i).forEach(e=>{const[t,n]=e;h[t]=n,h[`_${t}`]=n,h.rerender=!0}),Object.values(c).forEach(e=>{n(e)&&(h.rerender=!0,e())}),Object.entries(u).forEach(e=>{const[t,r]=e;g.style[t]=n(r)?r():r}),s(o)&&(n(o)?h.appendChild(d(o())):h.appendChild(d(o))),"null"!=de.call(h.tagName)&&"undefined"!=de.call(h.tagName)&&g.appendChild(h)}),"null"!=de.call(g.tagName)&&"undefined"!=de.call(g.tagName)&&m.appendChild(g)}),s(o)&&(n(o)?m.appendChild(d(o())):m.appendChild(d(o))),"null"!=de.call(m.tagName)&&"undefined"!=de.call(m.tagName)&&l.push(m)}),l}function T(){}function R(){let e=null;var t=document.getElementsByTagName("*");for(let n=0;n{let t=be.handler[l];for(let n of t){const{target:t,text:o}=n,s=RegExp(`{(:?\\s+)*(:?${r})(:?\\s+)*}`,"g");if(s.test(o)){let n=o.replace(s,e.target.value);t.textContent=n}}})}else a("\n Really? handleValue must be only setted in value that recieve value.\n ");je.fire(`handler${e}`)}function P(){}function $(e,t,n){return Object.defineProperty(e,t,{value:n,enumerable:!0})}function A(e){return 0==Object.keys(e).length}function S(){}function k(e){return e.getElementsByTagName("*").length>0}function I(t){if(e(t)){let{in:o,data:l,handleValue:a,react:i}=t;const u=Object.assign(Object.create(null),l);Object.getOwnPropertyNames(l).forEach(e=>{Object.defineProperty(l,e,{get:()=>u[e]}),n(l[e])&&(u[e]=l[e].call(l))}),oe.hasRefContainer(o)?(Object.destroyAll(Ee.handler),Object.destroyAll(Re.handle),Object.destroyAll($e.storage),Object.destroyAll(Ae.storage),Object.destroyAll(ne[te])):oe.refContainer(o);const d=c(o).getElementsByTagName("*"),h=0!=d.length;je.listen(`handler${o}`,()=>{const t=Object.create(null);e(a)&&(Object.entries(a).forEach(e=>{const[n,r]=e;t[n]=r}),Object.entries(a).forEach((e,n)=>{const[r,s]=e;let l=be.handler[o];for(let e of l){const{target:n,text:o,input:l}=e,a=RegExp(`{(:?\\s+)*(:?${r})(:?\\s+)*}`,"g");if(a.test(o)){const e=o.replace(a,s);n.textContent=e}let i=new Proxy(t,{get:()=>l.value,set(e,t,s,l){const a=RegExp(`{(:?\\s+)*(:?${r})(:?\\s+)*}`,"g"),i=o.replace(a,s);n.textContent=i}});window[r]=i}}))});const f=c(o).getElementsByTagName("*");var r=Object.keys(l);0==f.length&&(Ee.create(o),Ee.add(o,{target:c(o),text:c(o).textContent}));for(let e=0;e{const{text:l,target:a,attrName:i,attrValue:c}=e,u=RegExp(`{(:?\\s+)*(:?${t})(:?\\s+)*}`,"g");if(s(l))u.test(l)&&ne.has(o)&&ne.reConstroy(o,t,n);else if(u.test(c)){const e=c.replace(u,n);e==c||("value"!=i?p(a,i,e):a.value=e)}});else{const s={refName:t,refValue:n,refContainer:o};Reflect.set(e,t,n,r),function(e){const{refName:t,refValue:n,refContainer:r}=e,o=c(r).getElementsByTagName("*"),s=RegExp(`{(:?\\s+)*(:?${t})(:?\\s+)*}`,"g");for(let e of o)if(V(e)){const o=e.childNodes;for(let e of o)if(s.test(e.textContent)){Ee.add(r,{target:e,text:e.textContent});const o=e.textContent.replace(s,n);ne.set(r,{target:e,text:e.textContent,refs:{[t]:n}}),e.textContent=o}}else if(s.test(e.textContent)){Ee.add(r,{target:e,text:e.textContent});const o=e.textContent.replace(s,n);ne.set(r,{target:e,text:e.textContent,refs:{[t]:n}}),e.textContent=o}for(let e of o){const t=e.attributes;for(let o=0;oRe.has(t)?Re.get(t).value:Reflect.get(e,t,n),deleteProperty(e,t,n){Pe.has(t)&&(Reflect.deleteProperty(e,t,n),Pe.delete(t),Ee.handler[o].forEach((e,n)=>{const{target:r,text:l,attrName:a,attrValue:i}=e,c=RegExp(`{(:?\\s+)*(:?${t})(:?\\s+)*}`,"g");s(a)&&c.test(i)&&Ee.handler[o].splice(n,1),s(l)&&c.test(l)&&Ee.handler[o].splice(n,1)}))}}),enumerable:!0,configurable:!0,writable:!0}),window[i]=e[i]}if(!A(l)&&s(l)){if(!Ae.has(o)){const e=c(o).getElementsByTagName("*"),t=0==d.length;let n=re.create(null),r=re.create(null);if(t){const e=c(o).textContent;Object.getOwnPropertyNames(l).forEach(t=>{RegExp(`{(:?\\s+)*(:?${t})(:?\\s+)*}`,"g").test(e)&&(n.push({target:c(o),text:e,position:null}),Ae.set(o,n))})}else for(let t=0;t{let[t,n]=e;const r=Ae.get(o),l=$e.get(o);ne.create(o);let a=ne.get(o);re.shareItens(r,a);for(let e=0;e-1;e--){if(V(l[e])){const t=l[e].children,n=o[e].children;if(t.length==n.length){for(let e=n.length-1;e>-1;e--)H(n[e],t[e])&&n[e].parentNode.replaceChild(t[e],n[e]);continue}o[e].parentNode.replaceChild(l[e],o[e])}else H(o[e],l[e]);s(o[e])&&s(l[e])&&!V(l[e])&&H(o[e],l[e])&&(V(l[e])||o[e].parentNode.replaceChild(l[e],o[e]))}}else{const r=t.children[n];H(r,e)&&t.replaceChild(e,r)}}function H(e,t){let n=!1;const r=e.attributes,o=t.attributes;if(w(t.rerender,!0)||(n=!0),!n)if(r.length!==o.length)n=!0;else for(let t of o){const r=t.name,o=t.value;if(!h(e,r)){n=!0;break}if(h(e,r)&&g(e,r)!==o){n=!0;break}}return n||e.textContent&&t.textContent&&(n=e.textContent!==t.textContent),n}function Y(e,t){const n=Object.assign({},e);Object.keys(e).reduce((r,o)=>{Object.defineProperty(e,[o],{set(e){n[o]=e,t()},get:()=>n[o]})},[])}function B(){return!!window.location.hash}function _(t){if(e(t)){const{routes:e}=t,r=Object.create(null);if(Object.entries(e).forEach(e=>{const[t,o]=e;if(Q.test(t)||"*"==t||a("\n Route name must starts with /.\n "),n(o)||a("\n Route action must be a function.\n "),t.includes("/*")){const e=t.replaceAll("*","(:?[\\s\\S]+)");r[e]=o}else"*"!==t&&(r[t]=o)}),n(e["*"])&&ke.set("*",e["*"]),B()){const e=window.decodeURI(window.location.hash.replace("#",""));let t=!1;Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),t||(ke.hasNotFound()?ke.get():u('\n You should always create a notfound route with "*" property.\n '))}else{let e=!1;const t=window.location.pathname;Object.keys(r).some(n=>{/(?:)/.compile(n).test(t)&&(e=!0,r[n]())}),e||(ke.hasNotFound()?ke.get():u('\n You should always create a notfound route with "*" property.\n '))}je.listen("URLCHANGED",()=>{if(B()){const e=window.decodeURI(window.location.hash.replace("#",""));let t=!1;Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),t||(ke.hasNotFound()?ke.get():u('\n You should always create a notfound route with "*" property.\n '))}else{const e=window.location.pathname;let t=!1;if(Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),!t){if(ke.hasNotFound())return ke.get();u('\n You should always create a notfound route with "*" property.\n ')}}}),window.onpopstate=(()=>{if(B()){const e=window.decodeURI(window.location.hash.replace("#",""));let t=!1;if(Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),!t){if(ke.hasNotFound())return ke.get();u('\n You should always create a notfound route with "*" property.\n ')}}else{const e=window.location.pathname;let t=!1;Object.keys(r).some(n=>{/(?:)/.compile(n).test(e)&&(r[n](),t=!0)}),t||(ke.hasNotFound()?ke.get():u('\n You should always create a notfound route with "*" property.\n '))}})}else a("\nThe argument of ROUTER must be an object.\n");(function(){const e=this.getElementsByTagName("*");for(let t of e)y(t)&&h(t,"setPath")&&(t.onclick=(e=>{e.preventDefault();const n=g(t,"setPath");Q.test(n)?me.setPath(n):a("\n A valid pathName must starts with /.\n ")})),y(t)&&h(t,"useHash")&&(t.onclick=(e=>{e.preventDefault();const n=g(t,"useHash");Q.test(n)?me.useHash(n):a("\n A valid pathName must starts with /.\n ")}))}).call(document.body)}function U(e){const t=re.create(null),n=c(e).getElementsByTagName("*");for(let r=0;r0}function M(){this[Symbol()]=Object.create(null)}function q(e){return 1==e.nodeType}function D(){}function W(e,t,r,s){Object.entries(t).reduce((t,r)=>{const[o,l]=r;void 0==l||o.startsWith("on")?o.startsWith("on")&&n(l)&&(e[o]=function(e){l.call(s,e)}):p(e,o,l)},{}),Object.entries(s).reduce((t,n)=>{const[r]=n;Object.defineProperty(s,r,{set(t){void 0==t?r.startsWith("on")?e.removeEventListener(r):e.removeAttribute(r):r.startsWith("on")?e[r]=function(e){t.call(s,e)}:p(e,r,t)},get(){if(!r.startsWith("on"))return g(e,r);a(`\n ${r} seems to be an event listener, \n and you can not get the value of an event.\n `)}})},{});const l=Object.create(null);Object.defineProperty(l,[r],{value:new Proxy(t,{set(t,n,r,s){if(o.call(t,n)){if(void 0==r)return n.startsWith("on")?e.removeEventListener(n):e.removeAttribute(n),!1;if("value"!=n&&!n.startsWith("on"))return p(e,n,r),Reflect.set(t,n,r,s),!1;"value"==n?(e.value=r,Reflect.set(t,n,r,s)):n.startsWith("on")&&(e[n]=value,Reflect.set(t,n,r,s))}},get(t,n,r){if(!n.startsWith("on"))return e[n];a(`${n} seems to be an event listener, and you can\n not get the value of an event`)}})}),window[r]=l[r]}function G(t){if(e(t)){const{in:n,data:r}=t,o=c(n);e(r)?function(e,t){const n=Object.getOwnPropertyNames(t),r=e.getElementsByTagName("*");for(let e of r)if(1==e.attributes.length){const r=e.attributes[0].name;for(let o of n)if(RegExp(`{...${o}}`).test(r)){const n=Object.assign({},t[o]);e.removeAttribute(r),W(e,n,o,t[o]);break}}}(o,r):a("\ndata in toATTR() must be an object.\n")}else a('\n The argument in "toATTR()" function must be an object.\n ')}function z(e,t){return w(e.index,t.index)}function F(t){if(void 0!==new.target&&a('\n "reativeTemplate" is not a construtor, do not invoke it with "new" keyword.\n '),e(t)){const{react:e,in:n,render:r}=t,o=c(n),s=new Proxy(e,{set(...e){Reflect.set(...e);const t=r.call(s);for(let e=0;ec;c++){const e=s[c],u=void 0==r.children[c]?r.children[r.children.length-1]:r.children[c],d=e.render;if(V(o.children[c]))for(let t=0;t{if(void 0!==u)return void 0==u.children[t]?u.children[u.children.length-1]:u.children[t]},o=e.children[t],s=o.render;w(s,!0)?w(s,!1)||void 0===n()||z(o,n())||i.push({el:n(),parent:void 0==u?r.children[r.children.length-1]:u}):(void 0==n()||z(o,n()))&&(l.push({id:t,el:o,parent:void 0==u?r.children[r.children.length-1]:u}),a=!0)}w(d,!0)?w(d,!1)||void 0===u||z(u,e)||(t.push({el:u,id:c}),a=!0):(void 0==u||z(e,u))&&(n.push({id:c,el:e}),a=!0)}for(let e of t){const{el:t}=e;r.removeChild(t)}for(let e of i){const{el:t,parent:n}=e;n.removeChild(t)}for(let e of l){const{el:t,id:n,parent:r}=e;if(void 0==r.children[n])r.appendChild(t);else{const e=r.children[n];r.insertBefore(t,e)}}for(let e of n){const{id:t,el:n}=e;void 0==r.children[t]?r.appendChild(n):r.insertBefore(n,r.children[t])}}(),a){let e=o.children.length;for(let t=0;e>t;t++){const n=o.children[t];if(w(n.render,!1)){if(V(n))for(let e of n.children)w(e.render,!1)||n.removeChild(e)}else o.removeChild(n),t--,e--}}else{const e=l.children.length;for(let t=0;e>t;t++){const e=l.children[t];if(void 0==e)continue;const n=void 0!==e?e.render:void 0;if(e.children.length>0)for(let t of e.children)w(t.render,!1)||e.removeChild(t);void 0!=n&&0==n&&(l.removeChild(e),t--)}}ae.change(a?o:l,r)}function X(n){if(void 0!==new.target&&a('\n "renderContainer" is not a constructor, do not call it\n with the "new" keyword.\n '),e(n)){const{in:e,data:l,react:i}=n,d=function(e){const t=e.children,n=re.create(null),r=re.create(null);let o=-1;for(let e of t)if(o++,h(e,"_istrue")){h(e,"_default")&&a("\n A container can not have two reative attributes.\n ");const t=g(e,"_istrue");e.istrue=!0;const s={ifTrue:e,cond:t.trim(),index:o},l=e.nextElementSibling;j(l)&&h(l,"_default")&&(h(l,"_istrue")&&a("\n A container can not have two reative attributes.\n "),l.default=!0,s.default=l,l.removeAttribute("default"),r.push(l)),e.removeAttribute("_istrue"),r.push(e),n.push(s)}for(let t of r)e.removeChild(t);return n}(c(e));Object.seal(l);const f=Object.assign({},l),p=Object.assign({},l),m=Object.getOwnPropertyNames(l);for(let e of m)Object.defineProperty(f,[e],{set(t){p[e]=t,r()},get:()=>p[e]});const y=re.create(null);let b=!1;function r(){for(let t of d){const{cond:n,ifTrue:r,default:l,index:a}=t,i=c(e),u=i.children;if(o.call(f,n)){if(!w(f[n],!0)&&s(l)){if(void 0==u[a]){i.appendChild(r);continue}if(u[a].isSameNode(r));else{if(u[a].default){i.replaceChild(r,l);continue}i.insertBefore(r,u[a])}}else{if(!w(f[n],!1)&&s(l)){if(void 0==u[a]){i.appendChild(l);continue}if(u[a].isSameNode(l));else{if(u[a].istrue){i.replaceChild(l,r);continue}i.insertBefore(l,u[a])}}if(!w(f[n],!0)&&!s(l)){if(void 0==u[a]){i.appendChild(r);continue}u[a].isSameNode(r)||i.insertBefore(r,u[a])}}w(f[n],!1)||s(l)||null!==r.parentNode&&i.removeChild(r)}}}Object.defineProperty(f,"register",{set(e){if(t(e)||a(`\n The value in ${i}.register must be an array.\n `),b&&a("\n You can only register the properties once.\n "),E(e))a("\n The array is empty.\n ");else{for(let t of e)o.call(l,t)?y.push(t):u(`\n There is not a property called "${t}"\n in ${i}\n `);Object.defineProperty(this,"setRegistered",{enumerable:!1,configurable:!1,set(e){if(function(e){return 1==e||0==e}(e)){for(let t of y)K[i][t]=e;b=!0}else a("\n The setRegistered property only accepts\n boolean value, true or false.\n ")}}),Object.seal(this)}}}),K[i]=f}else a('\n The argument in "renderContainer" must be a n object.\n ');r()}Object.destroyAll=(e=>{const t=Object.keys(e);for(let n of t)delete e[n]});const K=globalThis||function(){return window||self||global||void 0},Q=/^\/(:?[\s\S]+)|\/$/;var ee={status:"development"};const te=Symbol(),ne={[te]:Object.create(null),create(e){return this[te][e]=re.create(null)},set(e,t){this[te][e].push(t)},get(e){return this[te][e]},has(e){return e in this[te]},reConstroy(e,t,n){let r=this.get(e);for(let e of r){const{text:r,target:s,refs:l}=e;o.call(l,t)&&(l[t]=n);let a=r,i=Object.getOwnPropertyNames(l);for(let e of i){const t=RegExp(`{(:?\\s+)*(:?${e})(:?\\s+)*}`,"g");a=a.replace(t,l[e])}s.textContent=a}}};v.prototype.create=(e=>null==e?[]:[...e]),v.prototype.shareItens=((e,t)=>{for(let n of e)t.push(n)}),v.prototype.destroy=(e=>{let t=e.length;for(;t--;)e.pop()});var re=new v;const oe={handleMemomory:re.create(null),refContainer(e){this.handleMemomory.push(e)},hasRefContainer(e){let t=null;return this.handleMemomory.some(n=>t=e==n),t}},se=new Proxy(ee,{set(e,t,n,r){if("status"==t&&"production"==n&&(console.log("You're using Inter in production mode."),Reflect.set(e,t,n,r)),"status"!=t||"development"!=n)return!1;console.log("You're using Inter in development mode. When you deploy your app turn on production mode."),Reflect.set(e,t,n,r)}}),le=(e,t)=>{const n=e.attributes.length,r=t.attributes.length;return n>r?n:r},ae={applyChange:(e,t)=>(function(e,t){const n=t.children,r=e.children;for(let t=e.children.length-1;t>-1;t--){const e=r[t],o=n[t];if(Z(e,o)&&j(e)&&j(o))o.parentNode.replaceChild(e,o);else if(V(e))for(let t=e.children.length-1;t>-1;t--)O(e.children[t],o.children[t]);else!Z(e,o)&&j(e)&&j(o)&&O(e,o)}})(e,t),has:e=>has(e),change(e,t){V(e)&&V(t)&&this.applyChange(e,t)}};Object.defineProperty(window,"onload",{set(e){"inputHandler"!=e?window.addEventListener("load",t=>{"development"==se.status&&console.log("You're using Inter in development mode, when you deploy your app turn on production mode."),R(),n(e)&&e(t)}):window.addEventListener("load",R())},get(){}}),window.onload=(()=>{R()});var ie=new Proxy({url:function(e){return/^(?:http:\/\/|https:\/\/)+(:?[A-Z]{2,8}\.)*(:?[a-z]+)+\.+(:?[a-z]{2,8})+(:?[\s\S])*$/i.test(e)},email:function(e){return/^(?:[A-Z]+)+(:?[0-9]+)*@+(:?[A-Z]+)\.[A-Z]+$/i.test(e)}},{set:(e,t,n,r)=>"url"==t||"email"==t?(i("\n You must not overwrite built-in methods\n "),!1):Reflect.set(e,t,n,r),deleteProperty:(e,t)=>"url"==t||"email"==t?(i("\n You must not delete built-in methods\n "),!1):Reflect.deleteProperty(e,t)});const ce=new class{constructor(){}addHTML(t){if(e(t)){const{in:e,elements:n}=t,r=c(e);n.forEach(e=>{const{tag:t,text:n,children:o=[],attrs:l={},events:a={}}=e;let i=f(t);Object.entries(l).forEach(e=>{const[t,n]=e;p(i,t,n)}),Object.entries(a).forEach(e=>{const[t,n]=e;i[t]=n}),s(n)&&i.appendChild(d(n)),E(o)||o.forEach(e=>{const{tag:t,text:n,events:r={},attrs:o={}}=e,l=f(t);Object.entries(r).forEach(e=>{const[t,n]=e;l[t]=n}),Object.entries(o).forEach(e=>{const[t,n]=e;p(l,t,n)}),s(n)&&l.appendChild(d(n)),i.appendChild(l)}),r.appendChild(i)})}else a("\n The argument passed in the method AddHTML must be a plain object.\n ")}},ue=new Proxy(ce,{set:(...e)=>(a("You can not set any propriety in object Inter,\n this is a fatal action.\n "),!1),deleteProperty:(...e)=>(a("Fatal error: do not try to delete any propriety of Inter object"),!1),getPrototypeOf:e=>null,setPrototypeOf:(...e)=>!1}),de=String.prototype.toLowerCase,he=new function(){this.query=function(n){if(e(n)){const{in:r,setting:s}=n,{applyTo:l,value:i,query:c}=s;e(s)||a("\n Setting must be an object.\n "),t(r)&&t(l)||a("\n The in=>target and the applyTo=>reciever properties must be array.\n ");let u=r.filter(e=>{o.call(e,c)||console.log(`There was not found a property called ${c} in target object.`);const t=e[c];if(de.call(t).includes(de.call(i)))return e});if(re.destroy(l),""===i)return!1;re.shareItens(u,l)}else a("\nThe argument in data.query() must be an object.\n")}};Object.defineProperty(he,"query",{enumerable:!0,value:he.query}),Object.freeze(he),Object.defineProperty(ce,Symbol.hasInstance,{value:function(){return!1},enumerable:!1,configurable:!1,writable:!1});const fe={refHandler:Object.create(null),has:function(e){return e in this.refHandler},get:function(e){return this.refHandler[e]},addRef:function(e,t){return this.refHandler[e]=t},freeAll(){return Object.destroyAll(this.refHandler)}};$(ue,"renderIf",n=>{const l=re.create(null);if(e(n)){const{in:u,watch:d,conditions:h}=n;if(e(d)){const e=Object.create(null);!function(e,t){const n=Object.getOwnPropertyNames(e);for(let r of n)t[r]=e[r]}(d,e),Object.keys(d).forEach(t=>{Object.defineProperty(d,t,{set(n){e[t]=n,i()},get:()=>e[t]})})}function i(){const e=c(u);var n;l.length>0&&(l.forEach(t=>{const n=e.children[t];s(n)&&e.removeChild(n)}),re.destroy(l)),t(h)||a("\n conditions must be an array.\n "),[...h].forEach((t,i)=>{const{render:c}=t;if(!s(c.call(t))&&o.call(l,t.index+"")){const n=e.children[t.index];e.removeChild(n),delete l[t.index+""]}if(n=c.call(t),/^\[object HTML+(:?[A-Z]+)+Element\]$/i.test(n)){const n=t.index,o=e.children[n];if("number"!=r(+n))a("\n The index in Inter.renderIf() must be a number.\n ");else{let r=e.children[n];if(1==e.children.length&&!s(t.replace)&&0==n){const t=e.children[0];return e.insertBefore(c()[i],t),l.push(n),!1}if(s(o)&&m(t.replace))return e.replaceChild(c()[0],o),l.push(n),!1;if(s(r))e.insertBefore(c()[0],r),l.push(n);else{const t=e.children.length-1;t+1==n?(e.appendChild(c()[i]),l.push(n)):a(`The last rendered children in element by id ${u} is at index ${t} and \n to render a children at index ${n}.\n `)}}}})}}i()});const pe=new class{constructor(){}typing(t){if(e(t)){const{in:e,setting:o,done:s}=t;var r=c(e);Array.from(o).forEach(e=>{const{text:t,speed:o}=e;let l=[...t][Symbol.iterator](),a=setInterval(()=>{let e=l.next().value;if(void 0!==e)fe.has(r)?(r.textContent=`${fe.get(r)}${e}`,fe.addRef(r,`${fe.get(r)}${e}`)):(r.textContent=e,fe.addRef(r,e));else if(clearInterval(a),n(s))return s()},+o)})}}cleaning(t){if(e(t)){const{in:e,speed:r,done:o}=t,l=c(e),a=[...l.textContent];let i=setInterval(()=>{a.pop(),l.textContent=function(e){let t=[...l.textContent];return t.pop(),t.reduce((e,t)=>e.concat(t),"")}(),s(a[0])||(clearInterval(i),fe.has(l)&&delete fe.refHandler[l],n(o)&&o())},+r)}else a("\n The value passed as argument in the method cleaning must be an object.\n ")}};var ge=new Proxy(pe,{deleteProperty:(...e)=>(a("\n You can not delety any property in\n simulate object\n \n "),!1),defineProperty:(...e)=>!1,set:(...e)=>!0,getPrototypeOf:e=>null,setPrototypeOf:(e,t)=>!1});T.prototype.useHash=(e=>{Q.test(e)||a("\n pathName must starts with /.\n ");const t=window.location.pathname;return s(e)||u("You must define the path of the url."),"/"==e?(window.history.pushState(null,null,`/#${e}`),je.fire("URLCHANGED"),!1):"/"!=e&&"/"==t?(window.history.pushState(null,null,`/#${e}`),je.fire("URLCHANGED"),!1):(window.history.replaceState(null,null,`/#${e}`),void je.fire("URLCHANGED"))}),T.prototype.setPath=(e=>{const t=window.location.pathname;return Q.test(e)||a("\n Pathname must starts with /.\n "),s(e)||a("\n setPath's parameter must not be a null or undefined value.\n "),"/"==e?(window.history.pushState(null,null,e),je.fire("URLCHANGED"),!1):"/"!=e&&"/"==t?(window.history.pushState(null,null,e),je.fire("ULRCHANGED"),!1):(window.history.replaceState(null,null,e),void je.fire("URLCHANGED"))});const me=Object.freeze(new T);let ye=new Proxy(function(t){const{in:n}=t;if(e(t))return{only:()=>c([n]).value,done(e,t){c(n).oninput=(n=>{I({in:e,data:{[t]:n.target.value}})})}};a("\ngetValue()'s argument must be only an object.\n")},{construct(...e){a("\n You've create an instance for getValue, it's forbidden.\n ")}});const be={handler:Object.create(null),justRegistered(e){return e in this.handler}},we=String.prototype.toUpperCase;P.prototype.request=function(t){function r(){m(f)&&(p.withCredentials=!0);const t=we.call(l);A(h)||!s(h)?p.open(t,i,!0):e(h)&&p.open(t,i,!0,h.username,h.password),Object.entries(u).forEach(e=>{const[t,n]=e;p.setRequestHeader(t,n)}),Object.entries(c).forEach(e=>{const[t,r]=e;"onerror"!=t&&"onload"!=t||a(`\n You can not listen for "${t}" event in backend.request(), it's ilegal.\n `),n(r)&&(p[t]=r.call(p))}),p.onload=function(){let e=null;try{JSON.parse(e),e=JSON.parse(this.responseText),n(o.okay)&&o.okay.call(p,e)}catch(t){e=this.responseText,n(o.okay)&&o.okay.call(p,e)}},p.onerror=function(){n(o.error)&&o.error.call(p)},"GET"==t||"DELETE"==t?p.send(null):s(d)&&p.send(d)}const o={_set(e,t){this[e]=t},okay:null,error:null};e(t);const{type:l,path:i,events:c={},headers:u={},body:d,security:h={},withCridentials:f}=t;let p=new XMLHttpRequest;return{okay(e){n(e)?(o._set("okay",e),r()):a("\n The argument in okay respons method must be a function.\n ")},error(e){n(e)?(o._set("error",e),r()):a("\n The argument in error response method must be a function.\n ")},response(e,t){2>arguments.length&&a("\n backend.request().response() must have two arguments.\n "),n(e)&&n(t)?(o._set("okay",e),o._set("error",t),r()):a("\n The arguments in backend.request().response() must be functions.\n ")}}};const ve=new P,xe={protectedListener:Object.create(null),ref:Object.create(null),add:function(e,t){return this.ref[e]=t}},Oe=new Proxy({},{set(e,t,n,r){const o=Object.keys(xe.ref);for(let e=0;e{s(e)||a("\n You must define the event's name\n "),s(t)?Oe[e]=t:Oe[e]="fired"}),this.listen=((e,t)=>{n(t)||a("\n The second argument of event.listen() must be a function.\n "),o.call(xe.ref,e)||xe.add(e,t)}),this.removeListener=(e=>{if(s(e)||a("\n You must define the event's name you want to remove the listener\n "),o.call(xe.ref,e)||u("\n Ops, you are trying to delete a listener that does not exist\n "),!o.call(xe.protectedListener,e))return delete xe.ref[e];a(`\n The listener of "${e}" is protected, you can not remove it.\n `)}),this.protectListener=(e=>{o.call(xe.protectedListener,e)?u(`The listener of "${e}" is already protected. `):xe.protectedListener[e]=!0}),this.hasListener=(e=>!!o.call(xe.ref,e))}),Ce=new Proxy(Object.create(null),{set:(e,t,n,r)=>t in Ce?"Inter here":Reflect.set(e,t,n,r)}),Ee={handler:{},add(e,t){return this.handler[e].push(t)},create(e){return!(e in this.handler)&&(this.handler[e]=re.create(null))}};S.prototype.each=((e,t,n,r)=>{if(k(e)){const r=e.childNodes;for(let e=0;e{let{in:o,do:l,data:a,react:u}=r,d=null;if(t(a)&&(d=new Proxy(a,{set:(t,n,r,o)=>(t[n]=r,e(r)&&Y(r,h),h(),!0)}),Object.defineProperty(d,"concat",{value:n=>{if(t(n)){for(let e of n)d.push(e);return h(),[...a]}return d.push(n),e(n)&&Y(n,h),[...a]},configurable:!0}),s(u)&&(window[u]=d)),t(a)||i("Inter warning: data must be an array."),n(l)){const t=c(o);for(let t of a)e(t)&&Y(t,h);function h(){if(a.lengtha.length;--n)t.removeChild(e[e.length-1])}if(!Se.has(o))return[...a].forEach((e,n)=>{var r=l.call(d,e,n);for(let e of r)t.appendChild(e)}),Se.set(o),!1;Se.has(o)&&a.forEach((e,n)=>{let r=l.call(d,e,n);if(s(t.children[n]))for(let e of r)L(e,t,n);if(!s(t.children[n])&&a.length>t.children.length)for(let e of r)t.appendChild(e)})}}else i(" Inter warning: do must be a function");h()});const ke={store:Object.create(null),set(e,t){this.store[e]=t},hasNotFound(){return"*"in this.store},get(){return this.store["*"]()}};let Ie=new class{constructor(){}each(e){const{in:t,do:n}=e;let r=re.create(null),o=c(t).getElementsByTagName("*");for(let e of o)l(e)&&r.push(e);for(let e=0;earguments.length)u("\n input.sateSate() must have two arguments, first is the name of the state \n and second the value.\n ");else{const n=U(t);for(let e=0;earguments.length)a("resetState must have two arguments.");else{const n=U(t);for(let e=0;e{const n=this[Le][t];for(let t of n)e(t.clonedInput)}):a("\n send's argument must be a function.\n ")}};Object.freeze(Ve),M.prototype.set=function(e,t){const n=Object.getOwnPropertySymbols(this)[0];if(2>arguments.length&&a("\n storage.set() must have two arguments!\n "),!(e in this[n]))return this[n][e]=t;this[n][e]=t,u(`\n there's already an element called "${e}" in storage, and its value\n was overwritten.\n `)},M.prototype.get=function(e,t){const r=Object.getOwnPropertySymbols(this)[0];if(2>arguments.length&&a("\n storage.get() must have two arguments!\n "),n(t)||a("\n The second argument in storage.get() must be a function.\n "),o.call(this[r],e))return t(this[r][e]);u("\n You are trying to get an element that is not actually registered in the storage.\n ")},M.prototype.has=function(e){const t=Object.getOwnPropertySymbols(this)[0];if(s(e))return o.call(this[t],e);a("\n You must define the element to check it's existence in the storage.\n ")},M.prototype.delete=function(e){const t=Object.getOwnPropertySymbols(this)[0];if(s(e)||a("You must define the key you want to delete from storage."),o.call(this[t],e))return delete this[t][e];a("\n You're trying to delete a key that is not in the storage.\n ")};const Me=Object.freeze(new M);D.prototype.previous=((e,t)=>{if(q(e),n(t)){const n=re.create(null),r=e.parentNode.children;for(child of r){if(e.isSameNode(child)){n.push(child),t([...n]),re.destroy(n);break}n.push(child)}}}),D.prototype.next=((e,t)=>{if(q(e)||a('\nThe first argument in "interface.next()" must be a valid HTML element.\n'),n(t)){let n=!1;const r=re.create(null),o=e.parentNode.children;for(let t of o)(e.isSameNode(t)||n)&&(r.push(t),n||(n=!0));t([...r]),re.destroy(r)}else a('\nThe second argument in "interface.next()" must be a function.\n')});const qe=Object.freeze(new D);je.protectListener("URLCHANGED"),je.protectListener("handler"),"undefined"!=typeof window&&(window.renderContainer=X,window.interface=qe,window.storage=Me,window.input=Ve,window.form=Ie,window.toHTML=I,window.validate=ie,window.Inter=ue,window.simulate=ge,window.ROUTER=_,window.supportInter=x,window.url=me,window.data=he,window.getValue=ye,window.backend=ve,window.event=je,window.whileLoading=C,window.app=se,window.template=N,window.toATTR=G,window.reativeTemplate=F),"undefined"!=typeof module&&"object"==typeof module.exports&&(exports.renderContainer=X,exports.whileLoading=C,exports.reativeTemplate=F,exports.toATTR=G,exports.validate=ie,exports.Inter=ue,exports.backend=ve,exports.simulate=ge,exports.supportInter=x,exports.data=he,exports.url=me,exports.input=Ve,exports.getValue=ye,exports.toHTML=I,exports.app=se,exports.event=je,exports.template=N,exports.app=se,exports.getValue=ye,exports.ROUTER=_,exports.form=Ie,exports.interface=qe,exports.input=Ve,exports.storage=Me)}();