/** * Dom7 4.0.1 * Minimalistic JavaScript library for DOM manipulation, with a jQuery-compatible API * https://framework7.io/docs/dom7.html * * Copyright 2021, Vladimir Kharlampidi * * Licensed under MIT * * Released on: October 27, 2021 */ !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):(t="undefined"!=typeof globalThis?globalThis:t||self).Dom7=e()}(this,(function(){"use strict";function t(t){return null!==t&&"object"==typeof t&&"constructor"in t&&t.constructor===Object}function e(n={},i={}){Object.keys(i).forEach((o=>{void 0===n[o]?n[o]=i[o]:t(i[o])&&t(n[o])&&Object.keys(i[o]).length>0&&e(n[o],i[o])}))}const n={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector:()=>null,querySelectorAll:()=>[],getElementById:()=>null,createEvent:()=>({initEvent(){}}),createElement:()=>({children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName:()=>[]}),createElementNS:()=>({}),importNode:()=>null,location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function i(){const t="undefined"!=typeof document?document:{};return e(t,n),t}const o={document:n,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle:()=>({getPropertyValue:()=>""}),Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia:()=>({}),requestAnimationFrame:t=>"undefined"==typeof setTimeout?(t(),null):setTimeout(t,0),cancelAnimationFrame(t){"undefined"!=typeof setTimeout&&clearTimeout(t)}};function s(){const t="undefined"!=typeof window?window:{};return e(t,o),t}class r extends Array{constructor(t){super(...t||[]),function(t){const e=t.__proto__;Object.defineProperty(t,"__proto__",{get:()=>e,set(t){e.__proto__=t}})}(this)}}function l(t=[]){const e=[];return t.forEach((t=>{Array.isArray(t)?e.push(...l(t)):e.push(t)})),e}function h(t,e){return Array.prototype.filter.call(t,e)}function u(t,e){const n=s(),o=i();let l=[];if(!e&&t instanceof r)return t;if(!t)return new r(l);if("string"==typeof t){const n=t.trim();if(n.indexOf("<")>=0&&n.indexOf(">")>=0){let t="div";0===n.indexOf("t.split(" "))));return this.forEach((t=>{t.classList.add(...e)})),this},removeClass:function(...t){const e=l(t.map((t=>t.split(" "))));return this.forEach((t=>{t.classList.remove(...e)})),this},toggleClass:function(...t){const e=l(t.map((t=>t.split(" "))));this.forEach((t=>{e.forEach((e=>{t.classList.toggle(e)}))}))},hasClass:function(...t){const e=l(t.map((t=>t.split(" "))));return h(this,(t=>e.filter((e=>t.classList.contains(e))).length>0)).length>0},attr:function(t,e){if(1===arguments.length&&"string"==typeof t)return this[0]?this[0].getAttribute(t):void 0;for(let n=0;n=0&&(e[(n=o.name.split("data-")[1],n.toLowerCase().replace(/-(.)/g,((t,e)=>e.toUpperCase())))]=o.value)}var n;for(const t in e)"false"===e[t]?e[t]=!1:"true"===e[t]?e[t]=!0:parseFloat(e[t])===1*e[t]&&(e[t]*=1);return e},val:function(t){if(void 0===t){const t=this[0];if(!t)return;if(t.multiple&&"select"===t.nodeName.toLowerCase()){const e=[];for(let n=0;n=0;else n.value=t}return this},value:function(t){return this.val(t)},transform:function(t){for(let e=0;e=0;t-=1){const n=r[t];i&&n.listener===i||i&&n.listener&&n.listener.dom7proxy&&n.listener.dom7proxy===i?(s.removeEventListener(e,n.proxyListener,o),r.splice(t,1)):i||(s.removeEventListener(e,n.proxyListener,o),r.splice(t,1))}}}return this},once:function(...t){const e=this;let[n,i,o,s]=t;function r(...t){o.apply(this,t),e.off(n,i,r,s),r.dom7proxy&&delete r.dom7proxy}return"function"==typeof t[1]&&([n,o,s]=t,i=void 0),r.dom7proxy=o,e.on(n,i,r,s)},trigger:function(...t){const e=s(),n=t[0].split(" "),i=t[1];for(let o=0;oe>0)),o.dispatchEvent(n),o.dom7EventData=[],delete o.dom7EventData}}}return this},transitionEnd:function(t){const e=this;return t&&e.on("transitionend",(function n(i){i.target===this&&(t.call(this,i),e.off("transitionend",n))})),this},animationEnd:function(t){const e=this;return t&&e.on("animationend",(function n(i){i.target===this&&(t.call(this,i),e.off("animationend",n))})),this},width:function(){const t=s();return this[0]===t?t.innerWidth:this.length>0?parseFloat(this.css("width")):null},outerWidth:function(t){if(this.length>0){if(t){const t=this.styles();return this[0].offsetWidth+parseFloat(t.getPropertyValue("margin-right"))+parseFloat(t.getPropertyValue("margin-left"))}return this[0].offsetWidth}return null},height:function(){const t=s();return this[0]===t?t.innerHeight:this.length>0?parseFloat(this.css("height")):null},outerHeight:function(t){if(this.length>0){if(t){const t=this.styles();return this[0].offsetHeight+parseFloat(t.getPropertyValue("margin-top"))+parseFloat(t.getPropertyValue("margin-bottom"))}return this[0].offsetHeight}return null},offset:function(){if(this.length>0){const t=s(),e=i(),n=this[0],o=n.getBoundingClientRect(),r=e.body,l=n.clientTop||r.clientTop||0,h=n.clientLeft||r.clientLeft||0,u=n===t?t.scrollY:n.scrollTop,a=n===t?t.scrollX:n.scrollLeft;return{top:o.top+u-l,left:o.left+a-h}}return null},hide:function(){for(let t=0;t{t.apply(e,[e,n])})),this):this},filter:function(t){return u(h(this,t))},html:function(t){if(void 0===t)return this[0]?this[0].innerHTML:null;for(let e=0;ee-1)return u([]);if(t<0){const n=e+t;return u(n<0?[]:[this[n]])}return u([this[t]])},append:function(...t){let e;const n=i();for(let i=0;i=0;o-=1)this[n].insertBefore(i.childNodes[o],this[n].childNodes[0])}else if(t instanceof r)for(o=0;o1)for(let n=0;n1)for(let n=0;n0?t?this[0].nextElementSibling&&u(this[0].nextElementSibling).is(t)?u([this[0].nextElementSibling]):u([]):this[0].nextElementSibling?u([this[0].nextElementSibling]):u([]):u([])},nextAll:function(t){const e=[];let n=this[0];if(!n)return u([]);for(;n.nextElementSibling;){const i=n.nextElementSibling;t?u(i).is(t)&&e.push(i):e.push(i),n=i}return u(e)},prev:function(t){if(this.length>0){const e=this[0];return t?e.previousElementSibling&&u(e.previousElementSibling).is(t)?u([e.previousElementSibling]):u([]):e.previousElementSibling?u([e.previousElementSibling]):u([])}return u([])},prevAll:function(t){const e=[];let n=this[0];if(!n)return u([]);for(;n.previousElementSibling;){const i=n.previousElementSibling;t?u(i).is(t)&&e.push(i):e.push(i),n=i}return u(e)},siblings:function(t){return this.nextAll(t).add(this.prevAll(t))},parent:function(t){const e=[];for(let n=0;n0||0===i,g=n>0||0===n;if(void 0===r&&(r="swing"),m&&(s=t.scrollTop,o||(t.scrollTop=i)),g&&(h=t.scrollLeft,o||(t.scrollLeft=n)),!o)return;m&&(u=t.scrollHeight-t.offsetHeight,c=Math.max(Math.min(i,u),0)),g&&(a=t.scrollWidth-t.offsetWidth,f=Math.max(Math.min(n,a),0));let y=null;m&&c===s&&(m=!1),g&&f===h&&(g=!1),e.requestAnimationFrame((function n(i=(new Date).getTime()){null===y&&(y=i);const u=Math.max(Math.min((i-y)/o,1),0),a="linear"===r?u:.5-Math.cos(u*Math.PI)/2;let v;m&&(d=s+a*(c-s)),g&&(p=h+a*(f-h)),m&&c>s&&d>=c&&(t.scrollTop=c,v=!0),m&&ch&&p>=f&&(t.scrollLeft=f,v=!0),g&&f0?s[0].scrollTop:null:s.scrollTo(void 0,e,n,i,o)},scrollLeft:function(...t){let[e,n,i,o]=t;3===t.length&&"function"==typeof i&&([e,n,o,i]=t);const s=this;return void 0===e?s.length>0?s[0].scrollLeft:null:s.scrollTo(e,void 0,n,i,o)}});var f=Object.freeze({__proto__:null,animate:function(t,e){const n=s(),i=this,o={props:Object.assign({},t),params:Object.assign({duration:300,easing:"swing"},e),elements:i,animating:!1,que:[],easingProgress:(t,e)=>"swing"===t?.5-Math.cos(e*Math.PI)/2:"function"==typeof t?t(e):e,stop(){o.frameId&&n.cancelAnimationFrame(o.frameId),o.animating=!1,o.elements.each((t=>{delete t.dom7AnimateInstance})),o.que=[]},done(t){if(o.animating=!1,o.elements.each((t=>{delete t.dom7AnimateInstance})),t&&t(i),o.que.length>0){const t=o.que.shift();o.animate(t[0],t[1])}},animate(t,e){if(o.animating)return o.que.push([t,e]),o;const s=[];o.elements.each(((e,i)=>{let r,l,h,u,a;e.dom7AnimateInstance||(o.elements[i].dom7AnimateInstance=o),s[i]={container:e},Object.keys(t).forEach((o=>{r=n.getComputedStyle(e,null).getPropertyValue(o).replace(",","."),l=parseFloat(r),h=r.replace(l,""),u=parseFloat(t[o]),a=t[o]+h,s[i][o]={initialFullValue:r,initialValue:l,unit:h,finalValue:u,finalFullValue:a,currentValue:l}}))}));let r,l,h=null,u=0,a=0,c=!1;return o.animating=!0,o.frameId=n.requestAnimationFrame((function f(){let d,p;r=(new Date).getTime(),c||(c=!0,e.begin&&e.begin(i)),null===h&&(h=r),e.progress&&e.progress(i,Math.max(Math.min((r-h)/e.duration,1),0),h+e.duration-r<0?0:h+e.duration-r,h),s.forEach((n=>{const i=n;l||i.done||Object.keys(t).forEach((n=>{if(l||i.done)return;d=Math.max(Math.min((r-h)/e.duration,1),0),p=o.easingProgress(e.easing,d);const{initialValue:c,finalValue:f,unit:m}=i[n];i[n].currentValue=c+p*(f-c);const g=i[n].currentValue;(f>c&&g>=f||f{Object.keys(t).forEach((e=>{u.fn[e]=t[e]}))})),u})); //# sourceMappingURL=dom7.min.js.map