@whitesev/domutils 2.0.7 → 2.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.amd.js +1 -1
- package/dist/index.amd.min.js +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.min.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.min.js +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.min.js +1 -1
- package/dist/index.system.js +1 -1
- package/dist/index.system.min.js +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.min.js +1 -1
- package/dist/types/index.d.ts +1 -1
- package/index.ts +1 -1
- package/package.json +10 -10
package/dist/index.esm.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
class e{defaultApi={document:document,window:window,globalThis:globalThis,self:self,top:top,setTimeout:globalThis.setTimeout.bind(globalThis),setInterval:globalThis.setInterval.bind(globalThis),clearTimeout:globalThis.clearTimeout.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis)};api;constructor(e){e&&(null==e.globalThis&&(e.globalThis=e.window),null==e.self&&(e.self=e.window)),e||(e=Object.assign({},this.defaultApi)),this.api=Object.assign({},e)}get document(){return this.api.document}get window(){return this.api.window}get globalThis(){return this.api.globalThis}get self(){return this.api.self}get top(){return this.api.top}get setTimeout(){return this.api.setTimeout}get clearTimeout(){return this.api.clearTimeout}get setInterval(){return this.api.setInterval}get clearInterval(){return this.api.clearInterval}}const t={windowApi:new e({document:document,window:window,top:top,setTimeout:globalThis.setTimeout.bind(globalThis),clearTimeout:globalThis.clearTimeout.bind(globalThis),setInterval:globalThis.setInterval.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis)}),isShow:e=>Boolean(e.getClientRects().length),createSafeHTML(e){if(window.trustedTypes){return window.trustedTypes.createPolicy("safe-innerHTML",{createHTML:e=>e}).createHTML(e)}return e},setSafeHTML(e,t){e.innerHTML=this.createSafeHTML(t)},forceShow(e){const t=e.cloneNode(!0);return t.setAttribute("style","visibility: hidden !important;display:block !important;"),this.windowApi.document.documentElement.appendChild(t),{recovery(){t.remove()}}},getStyleValue(e,t){let n=null,o=null;e instanceof CSSStyleDeclaration?o=e:(n=e.ownerDocument.defaultView,n&&n.opener||(n=window),o=n.getComputedStyle(e));const i=parseFloat(o[t]);return isNaN(i)?0:i},isWin:e=>"object"==typeof e&&(!(e instanceof Node)&&(e===globalThis||(e===window||(e===self||(e===globalThis||(e===window||(e===self||("undefined"!=typeof unsafeWindow&&e===unsafeWindow||"[object Math]"===e?.Math?.toString())))))))),isDOM:e=>e instanceof Node,delete(e,t){if("object"==typeof Reflect&&null!=Reflect&&Reflect.deleteProperty)return Reflect.deleteProperty(e,t);delete e[t]},isNodeList:e=>Array.isArray(e)||e instanceof NodeList,getAnimationEndNameList:()=>["webkitAnimationEnd","mozAnimationEnd","MSAnimationEnd","oanimationend","animationend"],getTransitionEndNameList:()=>["webkitTransitionEnd","mozTransitionEnd","MSTransitionEnd","otransitionend","transitionend"]};class n{windowApi;constructor(t){this.windowApi=new e(t)}selector(e,t){return this.selectorAll(e,t)[0]}selectorAll(e,t){const n=this;if(t=t||n.windowApi.document,(e=e.trim()).startsWith("xpath:")){e=e.replace(/^xpath:/i,"");const o=n.windowApi.document.evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),i=[];let r=o.iterateNext();for(;r;)i.push(r),r=o.iterateNext();return i}if(e.match(/[^\s]{1}:empty$/gi))return e=e.replace(/:empty$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>""===e?.innerHTML?.trim());if(e.match(/[^\s]{1}:contains\("(.*)"\)$/i)||e.match(/[^\s]{1}:contains\('(.*)'\)$/i)){const n=e.match(/:contains\(("|')(.*)("|')\)$/i)[2];return e=e.replace(/:contains\(("|')(.*)("|')\)$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>{let t=e.textContent;return null==t&&(t=e.innerText),null!=t&&t.includes(n)})}if(e.match(/[^\s]{1}:regexp\("(.*)"\)$/i)||e.match(/[^\s]{1}:regexp\('(.*)'\)$/i)){let n=e.match(/:regexp\(("|')(.*)("|')\)$/i)[2];const o=n.match(/("|'),[\s]*("|')([igm]{0,3})$/i);let i="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),i=o[3]);const r=new RegExp(n,i);return e=e.replace(/:regexp\(("|')(.*)("|')\)$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>{let t=e.textContent;return null==t&&(t=e.innerText),null!=t&&!!t.match(r)})}return Array.from(t.querySelectorAll(e))}matches(e,t){if(t=t.trim(),null==e)return!1;if(e instanceof Document)return!1;if(t.match(/[^\s]{1}:empty$/gi))return t=t.replace(/:empty$/gi,""),e.matches(t)&&""===e?.innerHTML?.trim();if(t.match(/[^\s]{1}:contains\("(.*)"\)$/i)||t.match(/[^\s]{1}:contains\('(.*)'\)$/i)){const n=t.match(/:contains\(("|')(.*)("|')\)$/i)[2];t=t.replace(/:contains\(("|')(.*)("|')\)$/gi,"");let o=e.textContent;return null==o&&(o=e.innerText),null!=o&&(e.matches(t)&&o.includes(n))}if(t.match(/[^\s]{1}:regexp\("(.*)"\)$/i)||t.match(/[^\s]{1}:regexp\('(.*)'\)$/i)){let n=t.match(/:regexp\(("|')(.*)("|')\)$/i)[2];const o=n.match(/("|'),[\s]*("|')([igm]{0,3})$/i);let i="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),i=o[3]);const r=new RegExp(n,i);t=t.replace(/:regexp\(("|')(.*)("|')\)$/gi,"");let s=e.textContent;return null==s&&(s=e.innerText),null!=s&&(e.matches(t)&&!!s.match(r))}return e.matches(t)}closest(e,t){if(t=t.trim(),null==e)return null;if(e instanceof Document)return null;if(t.match(/[^\s]{1}:empty$/gi)){t=t.replace(/:empty$/gi,"");const n=e?.closest(t);return n&&""===n?.innerHTML?.trim()?n:null}if(t.match(/[^\s]{1}:contains\("(.*)"\)$/i)||t.match(/[^\s]{1}:contains\('(.*)'\)$/i)){const n=t.match(/:contains\(("|')(.*)("|')\)$/i)[2];t=t.replace(/:contains\(("|')(.*)("|')\)$/gi,"");const o=e?.closest(t);if(o){const t=e?.textContent||e?.innerText;if("string"==typeof t&&t.includes(n))return o}return null}if(t.match(/[^\s]{1}:regexp\("(.*)"\)$/i)||t.match(/[^\s]{1}:regexp\('(.*)'\)$/i)){let n=t.match(/:regexp\(("|')(.*)("|')\)$/i)[2];const o=n.match(/("|'),[\s]*("|')([igm]{0,3})$/i);let i="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),i=o[3]);const r=new RegExp(n,i);t=t.replace(/:regexp\(("|')(.*)("|')\)$/gi,"");const s=e?.closest(t);if(s){let t=e.textContent;if(null==t&&(t=e.innerText),"string"==typeof t&&t.match(r))return s}return null}{const n=e?.closest(t);return n}}}const o=new n,i=function(e){return e instanceof Node};const r=new class{windowApi;constructor(t){this.windowApi=new e(t)}isJQuery(e){let t=!1;if("object"==typeof jQuery&&e instanceof jQuery&&(t=!0),null==e)return!1;if("object"==typeof e){const n=["add","addBack","addClass","after","ajaxComplete","ajaxError","ajaxSend","ajaxStart","ajaxStop","ajaxSuccess","animate","append","appendTo","attr","before","bind","blur","change","children","clearQueue","click","clone","closest","constructor","contents","contextmenu","css","data","dblclick","delay","delegate","dequeue","each","empty","end","eq","extend","fadeIn","fadeOut","fadeTo","fadeToggle","filter","find","first","focus","focusin","focusout","get","has","hasClass","height","hide","hover","html","index","init","innerHeight","innerWidth","insertAfter","insertBefore","is","jquery","keydown","keyup","last","load","map","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","next","nextAll","not","off","offset","offsetParent","on","one","outerHeight","outerWidth","parent","parents","position","prepend","prependTo","prev","prevAll","prevUntil","promise","prop","pushStack","queue","ready","remove","removeAttr","removeClass","removeData","removeProp","replaceAll","replaceWith","resize","scroll","scrollLeft","scrollTop","select","show","siblings","slice","slideDown","slideToggle","slideUp","text","toggle","toggleClass","trigger","triggerHandler","unbind","width","wrap"];for(const o of n){if(!(o in e)){t=!1;break}t=!0}}return t}assign(e={},t={},n=!1){const o=this;if(Array.isArray(t)){if(!t.filter(e=>"object"==typeof e).length)return t}if(null==t)return e;let r;null==e&&(e={}),r=n?t:e;for(const s in r){if(!n&&!(s in t))continue;const r=Reflect.get(e,s),l=Reflect.get(t,s);if("object"==typeof l&&null!=l&&s in e&&!i(l)){let t;Array.isArray(l)?(Array.isArray(r)&&(r.length=0),t=l):t=o.assign(r,l,n),Reflect.set(e,s,t)}else Reflect.set(e,s,l)}return e}mutationObserver(e,t){t=this.assign({callback:()=>{},config:{subtree:void 0,childList:void 0,attributes:void 0,attributeFilter:void 0,attributeOldValue:void 0,characterData:void 0,characterDataOldValue:void 0},immediate:!1},t);const n=new(this.windowApi.window.MutationObserver||this.windowApi.window.webkitMutationObserver||this.windowApi.window.MozMutationObserver)(function(e,n){"function"==typeof t.callback&&t.callback(e,n)});return Array.isArray(e)||e instanceof NodeList?e.forEach(e=>{n.observe(e,t.config)}):this.isJQuery(e)?e.each((e,o)=>{n.observe(o,t.config)}):n.observe(e,t.config),t.immediate&&"function"==typeof t.callback&&t.callback([],n),n}};class s extends n{windowApi;constructor(t){super(t),this.windowApi=new e(t)}wait(e,t,n){const o=this,i="number"==typeof t?t:0;return new Promise(t=>{const s=r.mutationObserver(n||o.windowApi.document,{config:{subtree:!0,childList:!0,attributes:!0},immediate:!0,callback(n,o){const i=e();i.success&&("function"==typeof o?.disconnect&&o.disconnect(),t(i.data))}});i>0&&setTimeout(()=>{"function"==typeof s?.disconnect&&s.disconnect(),t(null)},i)})}waitNode(...e){const t=(e=e.filter(e=>void 0!==e))[0];let n=this.windowApi.document,i=0;if("string"!=typeof e[0]&&!Array.isArray(e[0])&&"function"!=typeof e[0])throw new TypeError("DOMUtils.waitNode 第一个参数必须是string|string[]|Function");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNode 第二个参数必须是number|Node");n=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitNode 参数个数错误");{const t=e[1],o=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNode 第二个参数必须是Node");if(n=t,"number"!=typeof o)throw new TypeError("DOMUtils.waitNode 第三个参数必须是number");i=o}}return this.wait(()=>{const e=function(){if(!Array.isArray(t))return"function"==typeof t?t():o.selector(t,n);{const e=[];for(let n=0;n<t.length;n++){const i=o.selector(t[n]);i&&e.push(i)}if(e.length===t.length)return e}}();return e?{success:!0,data:e}:{success:!1,data:e}},i,n)}waitAnyNode(...e){e=e.filter(e=>void 0!==e);const t=this,n=e[0];let o=t.windowApi.document,i=0;if("object"!=typeof e[0]&&!Array.isArray(e[0]))throw new TypeError("DOMUtils.waitAnyNode 第一个参数必须是string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNode 第二个参数必须是number|Node");o=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitAnyNode 参数个数错误");{const t=e[1],n=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNode 第二个参数必须是Node");if(o=t,"number"!=typeof n)throw new TypeError("DOMUtils.waitAnyNode 第三个参数必须是number");i=n}}const r=n.map(e=>t.waitNode(e,o,i));return Promise.any(r)}waitNodeList(...e){const t=(e=e.filter(e=>void 0!==e))[0];let n=this.windowApi.document,i=0;if("string"!=typeof e[0]&&!Array.isArray(e[0]))throw new TypeError("DOMUtils.waitNodeList 第一个参数必须是string|string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNodeList 第二个参数必须是number|Node");n=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitNodeList 参数个数错误");{const t=e[1],o=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNodeList 第二个参数必须是Node");if(n=t,"number"!=typeof o)throw new TypeError("DOMUtils.waitNodeList 第三个参数必须是number");i=o}}return this.wait(()=>{const e=function(){if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++){const r=o.selectorAll(t[i],n);r.length&&e.push(r)}if(e.length===t.length)return e}else{const e=o.selectorAll(t,n);if(e.length)return e}}();return e?{success:!0,data:e}:{success:!1,data:e}},i,n)}waitAnyNodeList(...e){e=e.filter(e=>void 0!==e);const t=this,n=e[0];let o=t.windowApi.document,i=0;if(!Array.isArray(e[0]))throw new TypeError("DOMUtils.waitAnyNodeList 第一个参数必须是string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNodeList 第二个参数必须是number|Node");o=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitAnyNodeList 参数个数错误");{const t=e[1],n=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNodeList 第二个参数必须是Node");if(o=t,"number"!=typeof n)throw new TypeError("DOMUtils.waitAnyNodeList 第三个参数必须是number");i=n}}const r=n.map(e=>t.waitNodeList(e,o,i));return Promise.any(r)}}new s;class l extends s{windowApi;constructor(t){super(t),this.windowApi=new e(t)}animate(e,n,i=1e3,r=null){const s=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{s.animate(e,n,i,r)});if("number"!=typeof i||i<=0)throw new TypeError("duration must be a positive number");if("function"!=typeof r&&void 0!==r)throw new TypeError("callback must be a function or null");if("object"!=typeof n||void 0===n)throw new TypeError("styles must be an object");if(0===Object.keys(n).length)throw new Error("styles must contain at least one property");const l=performance.now(),c={},a={};for(const t in n)c[t]=e.style[t]||s.windowApi.globalThis.getComputedStyle(e)[t],a[t]=n[t];const f=setInterval(function(){let t=(performance.now()-l)/i;t>1&&(t=1);for(const o in n)e.style[o]=c[o]+(a[o]-c[o])*t+"px";1===t&&(clearInterval(f),r&&r())},10)}show(e,n=!0){const i=this;if(null!=e)if("string"==typeof e&&(e=o.selectorAll(e)),e instanceof NodeList||e instanceof Array)for(const t of e)i.show(t,n);else e.style.display="",n&&(t.isShow(e)||e.style.setProperty("display","unset","important"))}hide(e,n=!0){const i=this;if(null!=e)if("string"==typeof e&&(e=o.selectorAll(e)),e instanceof NodeList||e instanceof Array)for(const t of e)i.hide(t,n);else e.style.display="none",n&&t.isShow(e)&&e.style.setProperty("display","none","important")}fadeIn(e,n=400,i){if(null==e)return;const r=this;if("string"==typeof e&&(e=o.selectorAll(e)),t.isNodeList(e))return void e.forEach(e=>{r.fadeIn(e,n,i)});e.style.opacity="0",e.style.display="";let s=null,l=null;l=r.windowApi.window.requestAnimationFrame(function t(o){s||(s=o);const c=o-s;e.style.opacity=Math.min(c/n,1).toString(),c<n?r.windowApi.window.requestAnimationFrame(t):(i&&"function"==typeof i&&i(),r.windowApi.window.cancelAnimationFrame(l))})}fadeOut(e,n=400,i){const r=this;if(null==e)return;if("string"==typeof e&&(e=o.selectorAll(e)),t.isNodeList(e))return void e.forEach(e=>{r.fadeOut(e,n,i)});e.style.opacity="1";let s=null,l=null;l=r.windowApi.window.requestAnimationFrame(function t(o){s||(s=o);const c=o-s;e.style.opacity=Math.max(1-c/n,0).toString(),c<n?r.windowApi.window.requestAnimationFrame(t):(e.style.display="none","function"==typeof i&&i(),r.windowApi.window.cancelAnimationFrame(l))})}toggle(e,n){const i=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{i.toggle(e)}):"none"===i.windowApi.globalThis.getComputedStyle(e).getPropertyValue("display")?i.show(e,n):i.hide(e,n))}}new l;const c={domEventSymbol:Symbol("events_"+(65536*(1+Math.random())|0).toString(16).substring(1))},a={Object:{defineProperty:Object.defineProperty,defineProperties:Object.defineProperties}};class f extends l{windowApi;constructor(t){super(t),this.windowApi=new e(t)}getAnimationEndNameList(){return t.getAnimationEndNameList()}getTransitionEndNameList(){return t.getTransitionEndNameList()}on(e,n,o,i,r){const s=function(e,t,n){const o=e[t];if("boolean"==typeof o)n.capture=o,"boolean"==typeof e[t+1]&&(n.once=e[t+1]),"boolean"==typeof e[t+2]&&(n.passive=e[t+2]);else if(o&&"object"==typeof o)for(const e in n)Reflect.has(o,e)&&Reflect.set(n,e,o[e]);return n},l=this,f=arguments;if("string"==typeof e&&(e=l.selectorAll(e)),null==e)return{off(){},emit(){}};let d=[];e instanceof NodeList||Array.isArray(e)?d=d.concat(Array.from(e)):d.push(e);let u=[];Array.isArray(n)?u=u.concat(n.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof n&&(u=u.concat(n.split(" ").filter(e=>""!==e)));let p=[];Array.isArray(o)?p=p.concat(o.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof o&&p.push(o);let h=i,m={capture:!1,once:!1,passive:!1,isComposedPath:!1,overrideTarget:!0};return"function"==typeof o?(h=o,m=s(f,3,m)):m=s(f,4,m),d.forEach(e=>{const n=t.isWin(e);u.forEach(t=>{const s=()=>{m.once&&this.off(e,t,o,i,r)},f=function(t){let o,i,r;m.isPreventEvent&&l.preventEvent(t);let c=!1;if(p.length){let s;if(m.isComposedPath){const e=t.composedPath();!e.length&&t.target&&e.push(t.target),s=e[0]}else s=t.target;const f=n?l.windowApi.document.documentElement:e;if(p.find(e=>{if(l.matches(s,e))return!0;const t=l.closest(s,e);return!(!t||!f?.contains?.(t))&&(s=t,!0)})){if(m.overrideTarget)try{const e=t.target;a.Object.defineProperties(t,{target:{get:()=>s},originTarget:{get:()=>e}})}catch{}c=!0,o=s,i=t,r=s}}else c=!0,o=e,i=t;if(c){const e=h.call(o,i,r);if(s(),"boolean"==typeof e&&!e)return!1}};e.addEventListener(t,f,m);const d=Reflect.get(e,c.domEventSymbol)||{};d[t]=d[t]||[],d[t].push({selector:p,option:m,handlerCallBack:f,callback:h}),Reflect.set(e,c.domEventSymbol,d)})}),{off:e=>{l.off(d,u,p,h,m,e)},emit:(e,t)=>{l.emit(d,u,e,t)}}}off(e,n,o,i,r,s){const l=function(e,t,n){const o=e[t];return"boolean"==typeof o?n.capture=o:o&&"object"==typeof o&&"capture"in o&&(n.capture=o.capture),n},a=arguments;if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let f=[];e instanceof NodeList||Array.isArray(e)?f=f.concat(Array.from(e)):f.push(e);let d=[];Array.isArray(n)?d=d.concat(n.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof n&&(d=d.concat(n.split(" ").filter(e=>""!==e)));let u=[];Array.isArray(o)?u=u.concat(o.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof o&&u.push(o);let p=i,h={capture:!1};"function"==typeof o?(p=o,h=l(a,3,h)):h=l(a,4,h),5===a.length&&"function"==typeof a[4]&&"function"!=typeof s&&(s=r),f.forEach(e=>{const o=Reflect.get(e,c.domEventSymbol)||{};d.forEach(i=>{const r=o[i]||[],l="function"==typeof s?r.filter(s):r;for(let t=0;t<l.length;t++){const n=l[t];let o=!0;if(o&&p&&n.callback!==p&&(o=!1),o&&u.length&&Array.isArray(n.selector)&&JSON.stringify(n.selector)!==JSON.stringify(u)&&(o=!1),o&&"boolean"==typeof n.option.capture&&h.capture!==n.option.capture&&(o=!1),o){e.removeEventListener(i,n.handlerCallBack,n.option);for(let e=r.length-1;e>=0;e--)r[e]===n&&r.splice(e,1)}}0===r.length&&(t.delete(o,n),0===Object.keys(o).length&&t.delete(e,c.domEventSymbol))}),Reflect.set(e,c.domEventSymbol,o)})}offAll(e,n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let o=[];e instanceof NodeList||Array.isArray(e)?o=o.concat(Array.from(e)):o.push(e);let i=[];Array.isArray(n)?i=i.concat(n):"string"==typeof n&&(i=i.concat(n.split(" "))),o.forEach(e=>{[...new Set([...Object.getOwnPropertySymbols(e),c.domEventSymbol])].forEach(n=>{if(!n.toString().startsWith("Symbol(events_"))return;const o=Reflect.get(e,n)||{};(i.length?i:Object.keys(o)).forEach(i=>{const r=o[i];if(!r)return;for(const t of r)e.removeEventListener(i,t.handlerCallBack,{capture:t.option.capture});const s=Reflect.get(e,n);t.delete(s,i),0===Object.keys(s).length&&t.delete(e,n)})})})}onReady(...e){const t=e[0];let n;const o=this,i=[{target:o.windowApi.document,eventType:"DOMContentLoaded",callback:()=>{r.completed()}},{target:o.windowApi.window,eventType:"load",callback:()=>{r.completed()}}],r={init(){if(0===e.length)return new Promise(e=>{n=e,r.check()});r.check()},check(){r.isReady()?setTimeout(()=>{r.completed()},0):r.onCompleted()},isReady(){try{return"complete"===o.windowApi.document.readyState||"loading"!==o.windowApi.document.readyState&&!o.windowApi.document.documentElement.doScroll}catch{return!1}},completed(){r.offCompleted(),"function"==typeof t&&t(),"function"==typeof n&&n()},onCompleted(){for(const e of i)o.on(e.target,e.eventType,e.callback)},offCompleted(){for(const e of i)o.off(e.target,e.eventType,e.callback)}};return r.init()}emit(e,t,n,o=!0){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let i=[];e instanceof NodeList||Array.isArray(e)?i=i.concat(Array.from(e)):i.push(e);const r=(e,t)=>{if(e instanceof Event&&"object"==typeof t&&null!=t&&!Array.isArray(t)){Object.keys(t).forEach(n=>{const o=Reflect.get(t,n);Reflect.set(e,n,o)})}};let s=[],l=null;Array.isArray(t)?s=t.filter(e=>"string"==typeof e&&""!==e.trim()):"string"==typeof t?s=t.split(" "):t instanceof Event&&(l=t,r(l,n)),i.forEach(e=>{const t=Reflect.get(e,c.domEventSymbol)||{},i=(n,i)=>{0==o&&i in t?t[i].forEach(e=>{e.handlerCallBack(n)}):e.dispatchEvent(n)};if(l){const e=l,t=e.type;i(e,t)}else s.forEach(e=>{const t=new Event(e);r(t,n),i(t,e)})})}click(e,n,o,i){const r=this;if("string"==typeof e&&(e=r.selectorAll(e)),null!=e)if(t.isNodeList(e))e.forEach(e=>{r.click(e,n,o,i)});else{if(null!=n){return r.on(e,"click",null,n)}r.emit(e,"click",o,i)}}blur(e,n,o,i){const r=this;if("string"==typeof e&&(e=r.selectorAll(e)),null!=e)if(t.isNodeList(e))e.forEach(e=>{r.focus(e,n,o,i)});else{if(null!==n){return r.on(e,"blur",null,n)}r.emit(e,"blur",o,i)}}focus(e,n,o,i){const r=this;if("string"==typeof e&&(e=r.selectorAll(e)),null!=e)if(t.isNodeList(e))e.forEach(e=>{r.focus(e,n,o,i)});else{if(null!=n){return r.on(e,"focus",null,n)}r.emit(e,"focus",o,i)}}onHover(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null==e)return;if(t.isNodeList(e)){const t=[];return e.forEach(e=>{const r=i.onHover(e,n,o);t.push(r)}),{off(){t.forEach(e=>{e&&e.off()})}}}const r=i.on(e,"mouseenter",null,n,o),s=i.on(e,"mouseleave",null,n,o);return{off(){r.off(),s.off()}}}onAnimationend(e,n,o){const i=this;if("string"==typeof e&&(e=i.selector(e)),null==e)return;const r={once:!0};Object.assign(r,o||{});const s=t.getAnimationEndNameList();return i.on(e,s,null,n,r),r.once?void 0:{off(){i.off(e,s,null,n,r)}}}onTransitionend(e,n,o){const i=this;if("string"==typeof e&&(e=i.selector(e)),null==e)return;const r={once:!0};Object.assign(r,o||{});const s=t.getTransitionEndNameList();return i.on(e,s,null,n,r),r.once?void 0:{off(){i.off(e,s,null,n,r)}}}onKeyup(e,n,o){const i=this;if(null!=e){if("string"==typeof e&&(e=i.selectorAll(e)),t.isNodeList(e)){const t=[];return e.forEach(e=>{const r=i.onKeyup(e,n,o);t.push(r)}),{off(){t.forEach(e=>{e&&e.off()})}}}return i.on(e,"keyup",null,n,o)}}onKeydown(e,n,o){const i=this;if(null!=e){if("string"==typeof e&&(e=i.selectorAll(e)),t.isNodeList(e)){const t=[];return e.forEach(e=>{const r=i.onKeydown(e,n,o);t.push(r)}),{off(){t.forEach(e=>{e&&e.off()})}}}return i.on(e,"keydown",null,n,o)}}onKeyboard(e,t="keydown",n,o){const i=this;"string"==typeof e&&(e=i.selectorAll(e));return i.on(e,t,function(e){const t=e.key||e.code,o=e.charCode||e.keyCode||e.which,i=[];e.ctrlKey&&i.push("ctrl"),e.altKey&&i.push("alt"),e.metaKey&&i.push("meta"),e.shiftKey&&i.push("shift"),"function"==typeof n&&n(t,o,i,e)},o)}onInput(e,t,n){let o=!1;const i=this.on(e,"input",async e=>{o||await t(e)},n),r=this.on(e,"compositionstart",()=>{o=!0},n),s=this.on(e,"compositionend",()=>{o=!1,this.emit(e,"input",{isComposite:o})},n);return{off(){i.off(),r.off(),s.off()},emit(e,t){i.emit(e,t)}}}onOneOrDouble(...e){const t=e[0];let n,o,i;if(2===e.length){if("function"!=typeof e[1])throw new TypeError("handler is not a function");o=e[1]}else if(3===e.length)"function"==typeof e[1]?(o=e[1],i=e[2]):(n=e[1],o=e[2]);else{if(4!==e.length)throw new Error("args length error");n=e[1],o=e[2],i=e[3]}let r,s=new WeakMap,l=!1,c="pointerup",a=200;"object"==typeof i&&null!=i&&(("string"==typeof i.eventType||Array.isArray(i.eventType))&&(c=i.eventType),"number"==typeof i.checkClickTime&&(a=i.checkClickTime));const f=(e,t,n)=>n?o(e,n,t):o(e,t),d=this.on(t,c,n,(e,t)=>{clearTimeout(r),r=void 0,l&&s.has(t)?(l=!1,s.delete(t),f(e,{isDouble:!0},t)):(r=setTimeout(()=>{l=!1,f(e,{isDouble:!1},t)},a),l=!0,s.set(t,e))},i);return{off(){d.off(),s=null},emit(e,t){f(e,t||{isDouble:!1})}}}preventEvent(...e){const t=(e,t)=>{if(e?.stopPropagation(),e?.stopImmediatePropagation(),"boolean"!=typeof t||!t)return e?.preventDefault(),!1};if(e[0]instanceof Event){const n=e[1];return t(e[0],n)}{const n=e[0];let o,i,r=e[1],s=!1,l=!1;if("string"==typeof r&&(r=[r]),2===e.length);else if("string"==typeof e[2]||Array.isArray(e[2]))o=e[2],"object"==typeof e[3]&&null!=e[3]&&(i=e[3]);else{if("object"!=typeof e[2]||null==e[2]||Array.isArray(e[2]))throw new TypeError("Invalid argument");i=e[2]}i&&(s=Boolean(i.capture),l=Boolean(i.onlyStopPropagation));return this.on(n,r,o,e=>t(e,l),{capture:s})}}}new f;class d extends f{windowApi;constructor(t){super(t),this.windowApi=new e(t)}getElementSelector(e){if(!e)return;if(!e.parentElement)return;if(e.id)return`#${e.id}`;let t=this.getElementSelector(e.parentElement);if(!t)return e.tagName.toLowerCase();if(e.parentElement.querySelectorAll(e.tagName).length>1){const n=Array.prototype.indexOf.call(e.parentElement.children,e)+1;t+=` > ${e.tagName.toLowerCase()}:nth-child(${n})`}else t+=` > ${e.tagName.toLowerCase()}`;return t}}new d;class u extends d{constructor(e){super(e)}version="2.0.7";noConflict(){return this.windowApi.window.DOMUtils&&t.delete(window,"DOMUtils"),this.windowApi.window.DOMUtils=this,this}attr(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null!=e)return t.isNodeList(e)?null==o?i.attr(e[0],n,o):void e.forEach(e=>{i.attr(e,n,o)}):null==o?e.getAttribute(n):void e.setAttribute(n,o)}createElement(e,t,n){const o=this,i=o.windowApi.document.createElement(e);return"string"==typeof t?(o.html(i,t),i):(null==t&&(t={}),null==n&&(n={}),Object.keys(t).forEach(e=>{const n=t[e];"innerHTML"!==e?i[e]=n:o.html(i,n)}),Object.keys(n).forEach(e=>{let t=n[e];"object"==typeof t?t=JSON.stringify(t):"function"==typeof t&&(t=t.toString()),i.setAttribute(e,t)}),i)}css(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null==e)return;if(t.isNodeList(e))return"string"==typeof n?null==o?i.css(e[0],n):void e.forEach(e=>{i.css(e,n)}):"object"==typeof n?void e.forEach(e=>{i.css(e,n)}):void 0;const r=(t,n)=>{"string"==typeof n&&n.trim().endsWith("!important")?(n=n.trim().replace(/!important$/gi,"").trim(),e.style.setProperty(t,n,"important")):(n=function(e,t){return"number"==typeof t&&(t=t.toString()),"string"==typeof t&&["width","height","top","left","right","bottom","font-size"].includes(e)&&t.match(/[0-9]$/gi)&&(t+="px"),t}(t,n),e.style.setProperty(t,n))};if("string"==typeof n){if(null==o)return i.windowApi.globalThis.getComputedStyle(e).getPropertyValue(n);r(n,o)}else{if("object"!=typeof n)throw new TypeError("property must be string or object");for(const e in n){r(e,n[e])}}}text(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return t.isNodeList(e)?null==n?o.text(e[0]):void e.forEach(e=>{o.text(e,n)}):null==n?e.textContent||e.innerText:(n instanceof Node&&(n=n.textContent||n.innerText),void("textContent"in e?e.textContent=n:"innerText"in e&&(e.innerText=n)))}html(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return t.isNodeList(e)?null==n?o.html(e[0]):void e.forEach(e=>{o.html(e,n)}):null==n?e.innerHTML:(n instanceof Element&&(n=n.innerHTML),void("innerHTML"in e&&t.setSafeHTML(e,n)))}getTransform(e,n=!1){const o=this;let i=0,r=0;if(!(n||!n&&t.isShow(e))){const{recovery:n}=t.forceShow(e),i=o.getTransform(e,!0);return n(),i}const s=o.windowApi.globalThis.getComputedStyle(e).transform;if(null!=s&&"none"!==s&&""!==s){const e=s.match(/\((.+)\)/)?.[1].split(",");e?(i=Math.abs(parseInt(e[4])),r=Math.abs(parseInt(e[5]))):(i=0,r=0)}return{transformLeft:i,transformTop:r}}val(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return t.isNodeList(e)?null==n?o.val(e[0]):void e.forEach(e=>{o.val(e,n)}):null==n?"input"!==e.localName||"checkbox"!==e.type&&"radio"!==e.type?e.value:e.checked:void("input"!==e.localName||"checkbox"!==e.type&&"radio"!==e.type?e.value=n:e.checked=!!n)}prop(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null!=e)return t.isNodeList(e)?null==o?i.prop(e[0],n):void e.forEach(e=>{i.prop(e,n,o)}):null==o?Reflect.get(e,n):void(e instanceof Element&&"innerHTML"===n?i.html(e,o):Reflect.set(e,n,o))}removeAttr(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.removeAttr(e,n)}):e.removeAttribute(n))}removeClass(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.removeClass(e,n)}):null==n?e.className="":(Array.isArray(n)||(n=n.trim().split(" ")),n.forEach(t=>{e.classList.remove(t)})))}removeProp(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.removeProp(e,n)}):t.delete(e,n))}addClass(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.addClass(e,n)}):(Array.isArray(n)||(n=n.split(" ")),n.forEach(t=>{""!=t.trim()&&e.classList.add(t)})))}hasClass(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return!1;if(t.isNodeList(e)){let t=!0;for(let i=0;i<e.length;i++){const r=e[i];t=t&&o.hasClass(r,n)}return t}if(!e?.classList)return!1;Array.isArray(n)||(n=n.split(" "));for(let t=0;t<n.length;t++){const o=n[t].trim();if(!e.classList.contains(o))return!1}return!0}append(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.append(e,...n)});const o=(e,n)=>{e instanceof DocumentFragment?("string"==typeof n&&(n=this.toElement(n,!0,!1)),e.appendChild(n)):"string"==typeof n?e.insertAdjacentHTML("beforeend",t.createSafeHTML(n)):e.appendChild(n)},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}prepend(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.prepend(e,...n)});const o=(e,n)=>{if(e instanceof DocumentFragment)"string"==typeof n&&(n=this.toElement(n,!0,!1)),e.appendChild(n);else if("string"==typeof n)e.insertAdjacentHTML("afterbegin",t.createSafeHTML(n));else{const t=e.firstChild;t?e.insertBefore(n,t):e.prepend(n)}},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}after(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.after(e,...n)});const o=(n,o)=>{if(n instanceof DocumentFragment)"string"==typeof o&&(o=this.toElement(o,!0,!1)),n.appendChild(o);else if("string"==typeof o)n.insertAdjacentHTML("afterend",t.createSafeHTML(o));else{const t=e.parentElement,n=e.nextSibling;t&&n?t.insertBefore(o,n):e.after(o)}},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}before(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.before(e,...n)});const o=(n,o)=>{if(n instanceof DocumentFragment)"string"==typeof o&&(o=this.toElement(o,!0,!1)),n.appendChild(o);else if("string"==typeof o)e.insertAdjacentHTML("beforebegin",t.createSafeHTML(o));else{const t=e.parentElement;t?t.insertBefore(o,e):e.before(o)}},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}remove(e){"string"==typeof e&&(e=this.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{this.remove(e)}):(e.querySelectorAll("*").forEach(e=>{e instanceof Element&&this.offAll(e)}),this.offAll(e),"function"==typeof e.remove?e.remove():e.parentElement?e.parentElement.removeChild(e):e.parentNode&&e.parentNode.removeChild(e)))}empty(e){const n=this;"string"==typeof e&&(e=n.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{n.empty(e)}):e.innerHTML?t.setSafeHTML(e,""):e.textContent&&(e.textContent=""))}offset(e){const t=this;if("string"==typeof e&&(e=t.selector(e)),null==e)return;const n=e.getBoundingClientRect();return{top:n.top+t.windowApi.globalThis.scrollY,left:n.left+t.windowApi.globalThis.scrollX}}width(e,n=!1){const o=this;if("string"==typeof e&&(e=o.selector(e)),t.isWin(e))return o.windowApi.window.document.documentElement.clientWidth;if(9===e.nodeType)return Math.max(e.body.scrollWidth,e.documentElement.scrollWidth,e.body.offsetWidth,e.documentElement.offsetWidth,e.documentElement.clientWidth);if(n||!n&&t.isShow(e)){if(parseFloat(t.getStyleValue(e,"width").toString())>0)return parseFloat(t.getStyleValue(e,"width").toString());if(e.offsetWidth>0){const n=t.getStyleValue(e,"borderLeftWidth"),o=t.getStyleValue(e,"borderRightWidth"),i=t.getStyleValue(e,"paddingLeft"),r=t.getStyleValue(e,"paddingRight"),s=parseFloat(e.offsetWidth.toString())-parseFloat(n.toString())-parseFloat(o.toString())-parseFloat(i.toString())-parseFloat(r.toString());return parseFloat(s.toString())}return 0}{const{recovery:n}=t.forceShow(e),i=o.width(e,!0);return n(),i}}height(e,n=!1){const o=this;if(t.isWin(e))return o.windowApi.window.document.documentElement.clientHeight;if("string"==typeof e&&(e=o.selector(e)),9===e.nodeType)return Math.max(e.body.scrollHeight,e.documentElement.scrollHeight,e.body.offsetHeight,e.documentElement.offsetHeight,e.documentElement.clientHeight);if(n||!n&&t.isShow(e)){if(parseFloat(t.getStyleValue(e,"height").toString())>0)return parseFloat(t.getStyleValue(e,"height").toString());if(e.offsetHeight>0){const n=t.getStyleValue(e,"borderTopWidth"),o=t.getStyleValue(e,"borderBottomWidth"),i=t.getStyleValue(e,"paddingTop"),r=t.getStyleValue(e,"paddingBottom"),s=parseFloat(e.offsetHeight.toString())-parseFloat(n.toString())-parseFloat(o.toString())-parseFloat(i.toString())-parseFloat(r.toString());return parseFloat(s.toString())}return 0}{const{recovery:n}=t.forceShow(e),i=o.height(e,!0);return n(),i}}outerWidth(e,n=!1){const o=this;if(t.isWin(e))return o.windowApi.window.innerWidth;if("string"==typeof e&&(e=o.selector(e)),n||!n&&t.isShow(e)){const n=o.windowApi.globalThis.getComputedStyle(e,null),i=t.getStyleValue(n,"marginLeft"),r=t.getStyleValue(n,"marginRight");return e.offsetWidth+i+r}{const{recovery:n}=t.forceShow(e),i=o.outerWidth(e,!0);return n(),i}}outerHeight(e,n=!1){const o=this;if(t.isWin(e))return o.windowApi.window.innerHeight;if("string"==typeof e&&(e=o.selector(e)),n||!n&&t.isShow(e)){const n=o.windowApi.globalThis.getComputedStyle(e,null),i=t.getStyleValue(n,"marginTop"),r=t.getStyleValue(n,"marginBottom");return e.offsetHeight+i+r}{const{recovery:n}=t.forceShow(e),i=o.outerHeight(e,!0);return n(),i}}replaceWith(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{o.replaceWith(e,n)});"string"==typeof n&&(n=o.toElement(n,!1,!1));const i=e.parentElement;i?i.replaceChild(n,e):(o.after(e,n),this.remove(e))}wrap(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{o.wrap(e,n)});const i=o.windowApi.document.createElement("div");o.html(i,n);const r=i.firstChild;e.parentElement.insertBefore(r,e),r.appendChild(e)}prev(e){if("string"==typeof e&&(e=this.selector(e)),null!=e)return e.previousElementSibling}next(e){if("string"==typeof e&&(e=this.selector(e)),null!=e)return e.nextElementSibling}siblings(e){if("string"==typeof e&&(e=this.selector(e)),null!=e)return Array.from(e.parentElement.children).filter(t=>t!==e)}parent(e){const n=this;if("string"==typeof e&&(e=n.selector(e)),null!=e){if(t.isNodeList(e)){const t=[];return e.forEach(e=>{t.push(n.parent(e))}),t}return e.parentElement}}toElement(e,t=!1,n=!1){const o=this;return e=e.trim(),t?function(){const t=new DOMParser;return n?t.parseFromString(e,"text/html"):t.parseFromString(e,"text/html").body.firstChild}():function(){const t=o.windowApi.document.createElement("div");return o.html(t,e),n?t:t.firstElementChild??t.firstChild}()}toElements(e,t=!1){const n=this;return e=e.trim(),t?function(){const t=new DOMParser;return Array.from(t.parseFromString(e,"text/html").body.childNodes)}():function(){const t=n.windowApi.document.createElement("div");return n.html(t,e),Array.from(t.childNodes)}()}serialize(e){if(!(e instanceof HTMLFormElement))throw new TypeError("DOMUtils.serialize 参数必须是HTMLFormElement");const t=e.elements,n=[];for(let e=0;e<t.length;e++){const o=t[e];if(o.name&&!o.disabled&&(o.checked||["text","hidden","password","textarea","select-one","select-multiple"].includes(o.type)))if("select-multiple"===o.type)for(let e=0;e<o.options.length;e++)o.options[e].selected&&n.push({name:o.name,value:o.options[e].value});else n.push({name:o.name,value:o.value})}return n.map(e=>`${encodeURIComponent(e.name)}=${encodeURIComponent(e.value)}`).join("&")}createDOMUtils(e){return new u(e)}getTextBoundingRect(e,t,n){const o=this;if(!e||!("value"in e))return e;if(null==t&&(t=e.selectionStart||0),null==n&&(n=e.selectionEnd||0),"string"==typeof t&&(t=parseFloat(t)),("number"!=typeof t||isNaN(t))&&(t=0),t=t<0?0:Math.min(e.value.length,t),"string"==typeof n&&(n=parseFloat(n)),("number"!=typeof n||isNaN(n)||n<t)&&(n=t),n=n<0?0:Math.min(e.value.length,n),"function"==typeof e.createTextRange){const o=e.createTextRange();return o.collapse(!0),o.moveStart("character",t),o.moveEnd("character",n-t),o.getBoundingClientRect()}const i=function(){const t=o.windowApi.document.body,n=o.windowApi.document.defaultView,i=o.windowApi.document.documentElement,r=o.windowApi.document.createElement("div");r.style.paddingLeft=r.style.width="1px",t.appendChild(r);const s=2==r.offsetWidth;t.removeChild(r);const l=e.getBoundingClientRect(),c=i.clientTop||t.clientTop||0,a=i.clientLeft||t.clientLeft||0,f=n.pageYOffset||s&&i.scrollTop||t.scrollTop,d=n.pageXOffset||s&&i.scrollLeft||t.scrollLeft;return{top:l.top+f-c,left:l.left+d-a}}(),r=g("width",!0),s=g("height",!0);let l=i.top,c=i.left,a="white-space:pre;padding:0;margin:0;";const f=["direction","font-family","font-size","font-size-adjust","font-variant","font-weight","font-style","letter-spacing","line-height","text-align","text-indent","text-transform","word-wrap","word-spacing"];l+=g("padding-top",!0),l+=g("border-top-width",!0),c+=g("padding-left",!0),c+=g("border-left-width",!0),c+=1;for(let e=0;e<f.length;e++){const t=f[e];a+=t+":"+g(t,!1)+";"}const d=e.value||"G",u=d.length,p=o.windowApi.document.createElement("div");t>0&&y(0,t);const h=y(t,n);u>n&&y(n,u),p.style.cssText=a,p.style.position="absolute",p.style.top=l+"px",p.style.left=c+"px",p.style.width=r+"px",p.style.height=s+"px",o.windowApi.document.body.appendChild(p);const m=h.getBoundingClientRect();return p?.parentNode?.removeChild(p),m;function y(e,t){const n=o.windowApi.document.createElement("span");return n.style.cssText=a,n.textContent=d.substring(e,t),p.appendChild(n),n}function g(t,n){const i=o.windowApi.document.defaultView.getComputedStyle(e,null).getPropertyValue(t);return n?parseFloat(i):i}}addStyle(e){if("string"!=typeof e)throw new Error("DOMUtils.addStyle 参数cssText 必须为String类型");const t=this.createElement("style",{type:"text/css",innerHTML:e});return this.windowApi.document.head?this.windowApi.document.head.appendChild(t):0===this.windowApi.document.documentElement.childNodes.length?this.windowApi.document.documentElement.appendChild(t):this.windowApi.document.documentElement.insertBefore(t,this.windowApi.document.documentElement.childNodes[0]),t}checkUserClickInNode(e){if(!t.isDOM(e))throw new Error("DOMUtils.checkUserClickInNode 参数 targetNode 必须为 Element|Node 类型");const n=this.windowApi.window.event,o=this.windowApi.window.event,i=n?.composedPath()?.[0],r=null!=n?.clientX?n.clientX:o.touches[0].clientX,s=null!=n?.clientY?n.clientY:o.touches[0].clientY,{left:l,right:c,top:a,bottom:f}=e.getBoundingClientRect();return r>=l&&r<=c&&s>=a&&s<=f||!!(i&&e.contains(i)||i==e)}deleteParentNode(e,n){if(null==e)return;if(!t.isDOM(e))throw new Error("DOMUtils.deleteParentNode 参数 target 必须为 Node|HTMLElement 类型");if("string"!=typeof n)throw new Error("DOMUtils.deleteParentNode 参数 targetSelector 必须为 string 类型");let o=!1;const i=p.closest(e,n);return i&&(this.remove(i),o=!0),o}*findElementsWithText(e,t,n){const o=this;if(e.outerHTML.includes(t))if(0===e.children.length){"function"==typeof n&&n(e)||(yield e)}else{const o=Array.from(e.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE);for(const i of o)if(i.textContent.includes(t)){"function"==typeof n&&n(e)||(yield i)}}for(let i=0;i<e.children.length;i++){const r=e.children[i];yield*o.findElementsWithText(r,t,n)}}findVisibleElement(e){let t=e;for(;t;){if(t.getBoundingClientRect().length)return t;t=t.parentElement}return null}setElementSelection(e,t,n,o){const i=this.windowApi.document.createRange();if(i.selectNodeContents(e),t){if(t.nodeType!==Node.TEXT_NODE)throw new TypeError("childTextNode必须是#text元素");null!=n&&null!=o&&(i.setStart(t,n),i.setEnd(t,o))}const r=this.windowApi.globalThis.getSelection();r&&(r.removeAllRanges(),r.addRange(i))}}const p=new u;export{p as default};
|
|
1
|
+
class e{defaultApi={document:document,window:window,globalThis:globalThis,self:self,top:top,setTimeout:globalThis.setTimeout.bind(globalThis),setInterval:globalThis.setInterval.bind(globalThis),clearTimeout:globalThis.clearTimeout.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis)};api;constructor(e){e&&(null==e.globalThis&&(e.globalThis=e.window),null==e.self&&(e.self=e.window)),e||(e=Object.assign({},this.defaultApi)),this.api=Object.assign({},e)}get document(){return this.api.document}get window(){return this.api.window}get globalThis(){return this.api.globalThis}get self(){return this.api.self}get top(){return this.api.top}get setTimeout(){return this.api.setTimeout}get clearTimeout(){return this.api.clearTimeout}get setInterval(){return this.api.setInterval}get clearInterval(){return this.api.clearInterval}}const t={windowApi:new e({document:document,window:window,top:top,setTimeout:globalThis.setTimeout.bind(globalThis),clearTimeout:globalThis.clearTimeout.bind(globalThis),setInterval:globalThis.setInterval.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis)}),isShow:e=>Boolean(e.getClientRects().length),createSafeHTML(e){if(window.trustedTypes){return window.trustedTypes.createPolicy("safe-innerHTML",{createHTML:e=>e}).createHTML(e)}return e},setSafeHTML(e,t){e.innerHTML=this.createSafeHTML(t)},forceShow(e){const t=e.cloneNode(!0);return t.setAttribute("style","visibility: hidden !important;display:block !important;"),this.windowApi.document.documentElement.appendChild(t),{recovery(){t.remove()}}},getStyleValue(e,t){let n=null,o=null;e instanceof CSSStyleDeclaration?o=e:(n=e.ownerDocument.defaultView,n&&n.opener||(n=window),o=n.getComputedStyle(e));const i=parseFloat(o[t]);return isNaN(i)?0:i},isWin:e=>"object"==typeof e&&(!(e instanceof Node)&&(e===globalThis||(e===window||(e===self||(e===globalThis||(e===window||(e===self||("undefined"!=typeof unsafeWindow&&e===unsafeWindow||"[object Math]"===e?.Math?.toString())))))))),isDOM:e=>e instanceof Node,delete(e,t){if("object"==typeof Reflect&&null!=Reflect&&Reflect.deleteProperty)return Reflect.deleteProperty(e,t);delete e[t]},isNodeList:e=>Array.isArray(e)||e instanceof NodeList,getAnimationEndNameList:()=>["webkitAnimationEnd","mozAnimationEnd","MSAnimationEnd","oanimationend","animationend"],getTransitionEndNameList:()=>["webkitTransitionEnd","mozTransitionEnd","MSTransitionEnd","otransitionend","transitionend"]};class n{windowApi;constructor(t){this.windowApi=new e(t)}selector(e,t){return this.selectorAll(e,t)[0]}selectorAll(e,t){const n=this;if(t=t||n.windowApi.document,(e=e.trim()).startsWith("xpath:")){e=e.replace(/^xpath:/i,"");const o=n.windowApi.document.evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),i=[];let r=o.iterateNext();for(;r;)i.push(r),r=o.iterateNext();return i}if(e.match(/[^\s]{1}:empty$/gi))return e=e.replace(/:empty$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>""===e?.innerHTML?.trim());if(e.match(/[^\s]{1}:contains\("(.*)"\)$/i)||e.match(/[^\s]{1}:contains\('(.*)'\)$/i)){const n=e.match(/:contains\(("|')(.*)("|')\)$/i)[2];return e=e.replace(/:contains\(("|')(.*)("|')\)$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>{let t=e.textContent;return null==t&&(t=e.innerText),null!=t&&t.includes(n)})}if(e.match(/[^\s]{1}:regexp\("(.*)"\)$/i)||e.match(/[^\s]{1}:regexp\('(.*)'\)$/i)){let n=e.match(/:regexp\(("|')(.*)("|')\)$/i)[2];const o=n.match(/("|'),[\s]*("|')([igm]{0,3})$/i);let i="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),i=o[3]);const r=new RegExp(n,i);return e=e.replace(/:regexp\(("|')(.*)("|')\)$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>{let t=e.textContent;return null==t&&(t=e.innerText),null!=t&&!!t.match(r)})}return Array.from(t.querySelectorAll(e))}matches(e,t){if(t=t.trim(),null==e)return!1;if(e instanceof Document)return!1;if(t.match(/[^\s]{1}:empty$/gi))return t=t.replace(/:empty$/gi,""),e.matches(t)&&""===e?.innerHTML?.trim();if(t.match(/[^\s]{1}:contains\("(.*)"\)$/i)||t.match(/[^\s]{1}:contains\('(.*)'\)$/i)){const n=t.match(/:contains\(("|')(.*)("|')\)$/i)[2];t=t.replace(/:contains\(("|')(.*)("|')\)$/gi,"");let o=e.textContent;return null==o&&(o=e.innerText),null!=o&&(e.matches(t)&&o.includes(n))}if(t.match(/[^\s]{1}:regexp\("(.*)"\)$/i)||t.match(/[^\s]{1}:regexp\('(.*)'\)$/i)){let n=t.match(/:regexp\(("|')(.*)("|')\)$/i)[2];const o=n.match(/("|'),[\s]*("|')([igm]{0,3})$/i);let i="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),i=o[3]);const r=new RegExp(n,i);t=t.replace(/:regexp\(("|')(.*)("|')\)$/gi,"");let s=e.textContent;return null==s&&(s=e.innerText),null!=s&&(e.matches(t)&&!!s.match(r))}return e.matches(t)}closest(e,t){if(t=t.trim(),null==e)return null;if(e instanceof Document)return null;if(t.match(/[^\s]{1}:empty$/gi)){t=t.replace(/:empty$/gi,"");const n=e?.closest(t);return n&&""===n?.innerHTML?.trim()?n:null}if(t.match(/[^\s]{1}:contains\("(.*)"\)$/i)||t.match(/[^\s]{1}:contains\('(.*)'\)$/i)){const n=t.match(/:contains\(("|')(.*)("|')\)$/i)[2];t=t.replace(/:contains\(("|')(.*)("|')\)$/gi,"");const o=e?.closest(t);if(o){const t=e?.textContent||e?.innerText;if("string"==typeof t&&t.includes(n))return o}return null}if(t.match(/[^\s]{1}:regexp\("(.*)"\)$/i)||t.match(/[^\s]{1}:regexp\('(.*)'\)$/i)){let n=t.match(/:regexp\(("|')(.*)("|')\)$/i)[2];const o=n.match(/("|'),[\s]*("|')([igm]{0,3})$/i);let i="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),i=o[3]);const r=new RegExp(n,i);t=t.replace(/:regexp\(("|')(.*)("|')\)$/gi,"");const s=e?.closest(t);if(s){let t=e.textContent;if(null==t&&(t=e.innerText),"string"==typeof t&&t.match(r))return s}return null}{const n=e?.closest(t);return n}}}const o=new n,i=function(e){return e instanceof Node};const r=new class{windowApi;constructor(t){this.windowApi=new e(t)}isJQuery(e){let t=!1;if("object"==typeof jQuery&&e instanceof jQuery&&(t=!0),null==e)return!1;if("object"==typeof e){const n=["add","addBack","addClass","after","ajaxComplete","ajaxError","ajaxSend","ajaxStart","ajaxStop","ajaxSuccess","animate","append","appendTo","attr","before","bind","blur","change","children","clearQueue","click","clone","closest","constructor","contents","contextmenu","css","data","dblclick","delay","delegate","dequeue","each","empty","end","eq","extend","fadeIn","fadeOut","fadeTo","fadeToggle","filter","find","first","focus","focusin","focusout","get","has","hasClass","height","hide","hover","html","index","init","innerHeight","innerWidth","insertAfter","insertBefore","is","jquery","keydown","keyup","last","load","map","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","next","nextAll","not","off","offset","offsetParent","on","one","outerHeight","outerWidth","parent","parents","position","prepend","prependTo","prev","prevAll","prevUntil","promise","prop","pushStack","queue","ready","remove","removeAttr","removeClass","removeData","removeProp","replaceAll","replaceWith","resize","scroll","scrollLeft","scrollTop","select","show","siblings","slice","slideDown","slideToggle","slideUp","text","toggle","toggleClass","trigger","triggerHandler","unbind","width","wrap"];for(const o of n){if(!(o in e)){t=!1;break}t=!0}}return t}assign(e={},t={},n=!1){const o=this;if(Array.isArray(t)){if(!t.filter(e=>"object"==typeof e).length)return t}if(null==t)return e;let r;null==e&&(e={}),r=n?t:e;for(const s in r){if(!n&&!(s in t))continue;const r=Reflect.get(e,s),l=Reflect.get(t,s);if("object"==typeof l&&null!=l&&s in e&&!i(l)){let t;Array.isArray(l)?(Array.isArray(r)&&(r.length=0),t=l):t=o.assign(r,l,n),Reflect.set(e,s,t)}else Reflect.set(e,s,l)}return e}mutationObserver(e,t){t=this.assign({callback:()=>{},config:{subtree:void 0,childList:void 0,attributes:void 0,attributeFilter:void 0,attributeOldValue:void 0,characterData:void 0,characterDataOldValue:void 0},immediate:!1},t);const n=new(this.windowApi.window.MutationObserver||this.windowApi.window.webkitMutationObserver||this.windowApi.window.MozMutationObserver)(function(e,n){"function"==typeof t.callback&&t.callback(e,n)});return Array.isArray(e)||e instanceof NodeList?e.forEach(e=>{n.observe(e,t.config)}):this.isJQuery(e)?e.each((e,o)=>{n.observe(o,t.config)}):n.observe(e,t.config),t.immediate&&"function"==typeof t.callback&&t.callback([],n),n}};class s extends n{windowApi;constructor(t){super(t),this.windowApi=new e(t)}wait(e,t,n){const o=this,i="number"==typeof t?t:0;return new Promise(t=>{const s=r.mutationObserver(n||o.windowApi.document,{config:{subtree:!0,childList:!0,attributes:!0},immediate:!0,callback(n,o){const i=e();i.success&&("function"==typeof o?.disconnect&&o.disconnect(),t(i.data))}});i>0&&setTimeout(()=>{"function"==typeof s?.disconnect&&s.disconnect(),t(null)},i)})}waitNode(...e){const t=(e=e.filter(e=>void 0!==e))[0];let n=this.windowApi.document,i=0;if("string"!=typeof e[0]&&!Array.isArray(e[0])&&"function"!=typeof e[0])throw new TypeError("DOMUtils.waitNode 第一个参数必须是string|string[]|Function");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNode 第二个参数必须是number|Node");n=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitNode 参数个数错误");{const t=e[1],o=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNode 第二个参数必须是Node");if(n=t,"number"!=typeof o)throw new TypeError("DOMUtils.waitNode 第三个参数必须是number");i=o}}return this.wait(()=>{const e=function(){if(!Array.isArray(t))return"function"==typeof t?t():o.selector(t,n);{const e=[];for(let n=0;n<t.length;n++){const i=o.selector(t[n]);i&&e.push(i)}if(e.length===t.length)return e}}();return e?{success:!0,data:e}:{success:!1,data:e}},i,n)}waitAnyNode(...e){e=e.filter(e=>void 0!==e);const t=this,n=e[0];let o=t.windowApi.document,i=0;if("object"!=typeof e[0]&&!Array.isArray(e[0]))throw new TypeError("DOMUtils.waitAnyNode 第一个参数必须是string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNode 第二个参数必须是number|Node");o=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitAnyNode 参数个数错误");{const t=e[1],n=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNode 第二个参数必须是Node");if(o=t,"number"!=typeof n)throw new TypeError("DOMUtils.waitAnyNode 第三个参数必须是number");i=n}}const r=n.map(e=>t.waitNode(e,o,i));return Promise.any(r)}waitNodeList(...e){const t=(e=e.filter(e=>void 0!==e))[0];let n=this.windowApi.document,i=0;if("string"!=typeof e[0]&&!Array.isArray(e[0]))throw new TypeError("DOMUtils.waitNodeList 第一个参数必须是string|string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNodeList 第二个参数必须是number|Node");n=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitNodeList 参数个数错误");{const t=e[1],o=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNodeList 第二个参数必须是Node");if(n=t,"number"!=typeof o)throw new TypeError("DOMUtils.waitNodeList 第三个参数必须是number");i=o}}return this.wait(()=>{const e=function(){if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++){const r=o.selectorAll(t[i],n);r.length&&e.push(r)}if(e.length===t.length)return e}else{const e=o.selectorAll(t,n);if(e.length)return e}}();return e?{success:!0,data:e}:{success:!1,data:e}},i,n)}waitAnyNodeList(...e){e=e.filter(e=>void 0!==e);const t=this,n=e[0];let o=t.windowApi.document,i=0;if(!Array.isArray(e[0]))throw new TypeError("DOMUtils.waitAnyNodeList 第一个参数必须是string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNodeList 第二个参数必须是number|Node");o=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitAnyNodeList 参数个数错误");{const t=e[1],n=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNodeList 第二个参数必须是Node");if(o=t,"number"!=typeof n)throw new TypeError("DOMUtils.waitAnyNodeList 第三个参数必须是number");i=n}}const r=n.map(e=>t.waitNodeList(e,o,i));return Promise.any(r)}}new s;class l extends s{windowApi;constructor(t){super(t),this.windowApi=new e(t)}animate(e,n,i=1e3,r=null){const s=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{s.animate(e,n,i,r)});if("number"!=typeof i||i<=0)throw new TypeError("duration must be a positive number");if("function"!=typeof r&&void 0!==r)throw new TypeError("callback must be a function or null");if("object"!=typeof n||void 0===n)throw new TypeError("styles must be an object");if(0===Object.keys(n).length)throw new Error("styles must contain at least one property");const l=performance.now(),c={},a={};for(const t in n)c[t]=e.style[t]||s.windowApi.globalThis.getComputedStyle(e)[t],a[t]=n[t];const f=setInterval(function(){let t=(performance.now()-l)/i;t>1&&(t=1);for(const o in n)e.style[o]=c[o]+(a[o]-c[o])*t+"px";1===t&&(clearInterval(f),r&&r())},10)}show(e,n=!0){const i=this;if(null!=e)if("string"==typeof e&&(e=o.selectorAll(e)),e instanceof NodeList||e instanceof Array)for(const t of e)i.show(t,n);else e.style.display="",n&&(t.isShow(e)||e.style.setProperty("display","unset","important"))}hide(e,n=!0){const i=this;if(null!=e)if("string"==typeof e&&(e=o.selectorAll(e)),e instanceof NodeList||e instanceof Array)for(const t of e)i.hide(t,n);else e.style.display="none",n&&t.isShow(e)&&e.style.setProperty("display","none","important")}fadeIn(e,n=400,i){if(null==e)return;const r=this;if("string"==typeof e&&(e=o.selectorAll(e)),t.isNodeList(e))return void e.forEach(e=>{r.fadeIn(e,n,i)});e.style.opacity="0",e.style.display="";let s=null,l=null;l=r.windowApi.window.requestAnimationFrame(function t(o){s||(s=o);const c=o-s;e.style.opacity=Math.min(c/n,1).toString(),c<n?r.windowApi.window.requestAnimationFrame(t):(i&&"function"==typeof i&&i(),r.windowApi.window.cancelAnimationFrame(l))})}fadeOut(e,n=400,i){const r=this;if(null==e)return;if("string"==typeof e&&(e=o.selectorAll(e)),t.isNodeList(e))return void e.forEach(e=>{r.fadeOut(e,n,i)});e.style.opacity="1";let s=null,l=null;l=r.windowApi.window.requestAnimationFrame(function t(o){s||(s=o);const c=o-s;e.style.opacity=Math.max(1-c/n,0).toString(),c<n?r.windowApi.window.requestAnimationFrame(t):(e.style.display="none","function"==typeof i&&i(),r.windowApi.window.cancelAnimationFrame(l))})}toggle(e,n){const i=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{i.toggle(e)}):"none"===i.windowApi.globalThis.getComputedStyle(e).getPropertyValue("display")?i.show(e,n):i.hide(e,n))}}new l;const c={domEventSymbol:Symbol("events_"+(65536*(1+Math.random())|0).toString(16).substring(1))},a={Object:{defineProperty:Object.defineProperty,defineProperties:Object.defineProperties}};class f extends l{windowApi;constructor(t){super(t),this.windowApi=new e(t)}getAnimationEndNameList(){return t.getAnimationEndNameList()}getTransitionEndNameList(){return t.getTransitionEndNameList()}on(e,n,o,i,r){const s=function(e,t,n){const o=e[t];if("boolean"==typeof o)n.capture=o,"boolean"==typeof e[t+1]&&(n.once=e[t+1]),"boolean"==typeof e[t+2]&&(n.passive=e[t+2]);else if(o&&"object"==typeof o)for(const e in n)Reflect.has(o,e)&&Reflect.set(n,e,o[e]);return n},l=this,f=arguments;if("string"==typeof e&&(e=l.selectorAll(e)),null==e)return{off(){},emit(){}};let d=[];e instanceof NodeList||Array.isArray(e)?d=d.concat(Array.from(e)):d.push(e);let u=[];Array.isArray(n)?u=u.concat(n.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof n&&(u=u.concat(n.split(" ").filter(e=>""!==e)));let p=[];Array.isArray(o)?p=p.concat(o.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof o&&p.push(o);let h=i,m={capture:!1,once:!1,passive:!1,isComposedPath:!1,overrideTarget:!0};return"function"==typeof o?(h=o,m=s(f,3,m)):m=s(f,4,m),d.forEach(e=>{const n=t.isWin(e);u.forEach(t=>{const s=()=>{m.once&&this.off(e,t,o,i,r)},f=function(t){let o,i,r;m.isPreventEvent&&l.preventEvent(t);let c=!1;if(p.length){let s;if(m.isComposedPath){const e=t.composedPath();!e.length&&t.target&&e.push(t.target),s=e[0]}else s=t.target;const f=n?l.windowApi.document.documentElement:e;if(p.find(e=>{if(l.matches(s,e))return!0;const t=l.closest(s,e);return!(!t||!f?.contains?.(t))&&(s=t,!0)})){if(m.overrideTarget)try{const e=t.target;a.Object.defineProperties(t,{target:{get:()=>s},originTarget:{get:()=>e}})}catch{}c=!0,o=s,i=t,r=s}}else c=!0,o=e,i=t;if(c){const e=h.call(o,i,r);if(s(),"boolean"==typeof e&&!e)return!1}};e.addEventListener(t,f,m);const d=Reflect.get(e,c.domEventSymbol)||{};d[t]=d[t]||[],d[t].push({selector:p,option:m,handlerCallBack:f,callback:h}),Reflect.set(e,c.domEventSymbol,d)})}),{off:e=>{l.off(d,u,p,h,m,e)},emit:(e,t)=>{l.emit(d,u,e,t)}}}off(e,n,o,i,r,s){const l=function(e,t,n){const o=e[t];return"boolean"==typeof o?n.capture=o:o&&"object"==typeof o&&"capture"in o&&(n.capture=o.capture),n},a=arguments;if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let f=[];e instanceof NodeList||Array.isArray(e)?f=f.concat(Array.from(e)):f.push(e);let d=[];Array.isArray(n)?d=d.concat(n.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof n&&(d=d.concat(n.split(" ").filter(e=>""!==e)));let u=[];Array.isArray(o)?u=u.concat(o.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof o&&u.push(o);let p=i,h={capture:!1};"function"==typeof o?(p=o,h=l(a,3,h)):h=l(a,4,h),5===a.length&&"function"==typeof a[4]&&"function"!=typeof s&&(s=r),f.forEach(e=>{const o=Reflect.get(e,c.domEventSymbol)||{};d.forEach(i=>{const r=o[i]||[],l="function"==typeof s?r.filter(s):r;for(let t=0;t<l.length;t++){const n=l[t];let o=!0;if(o&&p&&n.callback!==p&&(o=!1),o&&u.length&&Array.isArray(n.selector)&&JSON.stringify(n.selector)!==JSON.stringify(u)&&(o=!1),o&&"boolean"==typeof n.option.capture&&h.capture!==n.option.capture&&(o=!1),o){e.removeEventListener(i,n.handlerCallBack,n.option);for(let e=r.length-1;e>=0;e--)r[e]===n&&r.splice(e,1)}}0===r.length&&(t.delete(o,n),0===Object.keys(o).length&&t.delete(e,c.domEventSymbol))}),Reflect.set(e,c.domEventSymbol,o)})}offAll(e,n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let o=[];e instanceof NodeList||Array.isArray(e)?o=o.concat(Array.from(e)):o.push(e);let i=[];Array.isArray(n)?i=i.concat(n):"string"==typeof n&&(i=i.concat(n.split(" "))),o.forEach(e=>{[...new Set([...Object.getOwnPropertySymbols(e),c.domEventSymbol])].forEach(n=>{if(!n.toString().startsWith("Symbol(events_"))return;const o=Reflect.get(e,n)||{};(i.length?i:Object.keys(o)).forEach(i=>{const r=o[i];if(!r)return;for(const t of r)e.removeEventListener(i,t.handlerCallBack,{capture:t.option.capture});const s=Reflect.get(e,n);t.delete(s,i),0===Object.keys(s).length&&t.delete(e,n)})})})}onReady(...e){const t=e[0];let n;const o=this,i=[{target:o.windowApi.document,eventType:"DOMContentLoaded",callback:()=>{r.completed()}},{target:o.windowApi.window,eventType:"load",callback:()=>{r.completed()}}],r={init(){if(0===e.length)return new Promise(e=>{n=e,r.check()});r.check()},check(){r.isReady()?setTimeout(()=>{r.completed()},0):r.onCompleted()},isReady(){try{return"complete"===o.windowApi.document.readyState||"loading"!==o.windowApi.document.readyState&&!o.windowApi.document.documentElement.doScroll}catch{return!1}},completed(){r.offCompleted(),"function"==typeof t&&t(),"function"==typeof n&&n()},onCompleted(){for(const e of i)o.on(e.target,e.eventType,e.callback)},offCompleted(){for(const e of i)o.off(e.target,e.eventType,e.callback)}};return r.init()}emit(e,t,n,o=!0){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let i=[];e instanceof NodeList||Array.isArray(e)?i=i.concat(Array.from(e)):i.push(e);const r=(e,t)=>{if(e instanceof Event&&"object"==typeof t&&null!=t&&!Array.isArray(t)){Object.keys(t).forEach(n=>{const o=Reflect.get(t,n);Reflect.set(e,n,o)})}};let s=[],l=null;Array.isArray(t)?s=t.filter(e=>"string"==typeof e&&""!==e.trim()):"string"==typeof t?s=t.split(" "):t instanceof Event&&(l=t,r(l,n)),i.forEach(e=>{const t=Reflect.get(e,c.domEventSymbol)||{},i=(n,i)=>{0==o&&i in t?t[i].forEach(e=>{e.handlerCallBack(n)}):e.dispatchEvent(n)};if(l){const e=l,t=e.type;i(e,t)}else s.forEach(e=>{const t=new Event(e);r(t,n),i(t,e)})})}click(e,n,o,i){const r=this;if("string"==typeof e&&(e=r.selectorAll(e)),null!=e)if(t.isNodeList(e))e.forEach(e=>{r.click(e,n,o,i)});else{if(null!=n){return r.on(e,"click",null,n)}r.emit(e,"click",o,i)}}blur(e,n,o,i){const r=this;if("string"==typeof e&&(e=r.selectorAll(e)),null!=e)if(t.isNodeList(e))e.forEach(e=>{r.focus(e,n,o,i)});else{if(null!==n){return r.on(e,"blur",null,n)}r.emit(e,"blur",o,i)}}focus(e,n,o,i){const r=this;if("string"==typeof e&&(e=r.selectorAll(e)),null!=e)if(t.isNodeList(e))e.forEach(e=>{r.focus(e,n,o,i)});else{if(null!=n){return r.on(e,"focus",null,n)}r.emit(e,"focus",o,i)}}onHover(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null==e)return;if(t.isNodeList(e)){const t=[];return e.forEach(e=>{const r=i.onHover(e,n,o);t.push(r)}),{off(){t.forEach(e=>{e&&e.off()})}}}const r=i.on(e,"mouseenter",null,n,o),s=i.on(e,"mouseleave",null,n,o);return{off(){r.off(),s.off()}}}onAnimationend(e,n,o){const i=this;if("string"==typeof e&&(e=i.selector(e)),null==e)return;const r={once:!0};Object.assign(r,o||{});const s=t.getAnimationEndNameList();return i.on(e,s,null,n,r),r.once?void 0:{off(){i.off(e,s,null,n,r)}}}onTransitionend(e,n,o){const i=this;if("string"==typeof e&&(e=i.selector(e)),null==e)return;const r={once:!0};Object.assign(r,o||{});const s=t.getTransitionEndNameList();return i.on(e,s,null,n,r),r.once?void 0:{off(){i.off(e,s,null,n,r)}}}onKeyup(e,n,o){const i=this;if(null!=e){if("string"==typeof e&&(e=i.selectorAll(e)),t.isNodeList(e)){const t=[];return e.forEach(e=>{const r=i.onKeyup(e,n,o);t.push(r)}),{off(){t.forEach(e=>{e&&e.off()})}}}return i.on(e,"keyup",null,n,o)}}onKeydown(e,n,o){const i=this;if(null!=e){if("string"==typeof e&&(e=i.selectorAll(e)),t.isNodeList(e)){const t=[];return e.forEach(e=>{const r=i.onKeydown(e,n,o);t.push(r)}),{off(){t.forEach(e=>{e&&e.off()})}}}return i.on(e,"keydown",null,n,o)}}onKeyboard(e,t="keydown",n,o){const i=this;"string"==typeof e&&(e=i.selectorAll(e));return i.on(e,t,function(e){const t=e.key||e.code,o=e.charCode||e.keyCode||e.which,i=[];e.ctrlKey&&i.push("ctrl"),e.altKey&&i.push("alt"),e.metaKey&&i.push("meta"),e.shiftKey&&i.push("shift"),"function"==typeof n&&n(t,o,i,e)},o)}onInput(e,t,n){let o=!1;const i=this.on(e,"input",async e=>{o||await t(e)},n),r=this.on(e,"compositionstart",()=>{o=!0},n),s=this.on(e,"compositionend",()=>{o=!1,this.emit(e,"input",{isComposite:o})},n);return{off(){i.off(),r.off(),s.off()},emit(e,t){i.emit(e,t)}}}onOneOrDouble(...e){const t=e[0];let n,o,i;if(2===e.length){if("function"!=typeof e[1])throw new TypeError("handler is not a function");o=e[1]}else if(3===e.length)"function"==typeof e[1]?(o=e[1],i=e[2]):(n=e[1],o=e[2]);else{if(4!==e.length)throw new Error("args length error");n=e[1],o=e[2],i=e[3]}let r,s=new WeakMap,l=!1,c="pointerup",a=200;"object"==typeof i&&null!=i&&(("string"==typeof i.eventType||Array.isArray(i.eventType))&&(c=i.eventType),"number"==typeof i.checkClickTime&&(a=i.checkClickTime));const f=(e,t,n)=>n?o(e,n,t):o(e,t),d=this.on(t,c,n,(e,t)=>{clearTimeout(r),r=void 0,l&&s.has(t)?(l=!1,s.delete(t),f(e,{isDouble:!0},t)):(r=setTimeout(()=>{l=!1,f(e,{isDouble:!1},t)},a),l=!0,s.set(t,e))},i);return{off(){d.off(),s=null},emit(e,t){f(e,t||{isDouble:!1})}}}preventEvent(...e){const t=(e,t)=>{if(e?.stopPropagation(),e?.stopImmediatePropagation(),"boolean"!=typeof t||!t)return e?.preventDefault(),!1};if(e[0]instanceof Event){const n=e[1];return t(e[0],n)}{const n=e[0];let o,i,r=e[1],s=!1,l=!1;if("string"==typeof r&&(r=[r]),2===e.length);else if("string"==typeof e[2]||Array.isArray(e[2]))o=e[2],"object"==typeof e[3]&&null!=e[3]&&(i=e[3]);else{if("object"!=typeof e[2]||null==e[2]||Array.isArray(e[2]))throw new TypeError("Invalid argument");i=e[2]}i&&(s=Boolean(i.capture),l=Boolean(i.onlyStopPropagation));return this.on(n,r,o,e=>t(e,l),{capture:s})}}}new f;class d extends f{windowApi;constructor(t){super(t),this.windowApi=new e(t)}getElementSelector(e){if(!e)return;if(!e.parentElement)return;if(e.id)return`#${e.id}`;let t=this.getElementSelector(e.parentElement);if(!t)return e.tagName.toLowerCase();if(e.parentElement.querySelectorAll(e.tagName).length>1){const n=Array.prototype.indexOf.call(e.parentElement.children,e)+1;t+=` > ${e.tagName.toLowerCase()}:nth-child(${n})`}else t+=` > ${e.tagName.toLowerCase()}`;return t}}new d;class u extends d{constructor(e){super(e)}version="2.0.8";noConflict(){return this.windowApi.window.DOMUtils&&t.delete(window,"DOMUtils"),this.windowApi.window.DOMUtils=this,this}attr(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null!=e)return t.isNodeList(e)?null==o?i.attr(e[0],n,o):void e.forEach(e=>{i.attr(e,n,o)}):null==o?e.getAttribute(n):void e.setAttribute(n,o)}createElement(e,t,n){const o=this,i=o.windowApi.document.createElement(e);return"string"==typeof t?(o.html(i,t),i):(null==t&&(t={}),null==n&&(n={}),Object.keys(t).forEach(e=>{const n=t[e];"innerHTML"!==e?i[e]=n:o.html(i,n)}),Object.keys(n).forEach(e=>{let t=n[e];"object"==typeof t?t=JSON.stringify(t):"function"==typeof t&&(t=t.toString()),i.setAttribute(e,t)}),i)}css(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null==e)return;if(t.isNodeList(e))return"string"==typeof n?null==o?i.css(e[0],n):void e.forEach(e=>{i.css(e,n)}):"object"==typeof n?void e.forEach(e=>{i.css(e,n)}):void 0;const r=(t,n)=>{"string"==typeof n&&n.trim().endsWith("!important")?(n=n.trim().replace(/!important$/gi,"").trim(),e.style.setProperty(t,n,"important")):(n=function(e,t){return"number"==typeof t&&(t=t.toString()),"string"==typeof t&&["width","height","top","left","right","bottom","font-size"].includes(e)&&t.match(/[0-9]$/gi)&&(t+="px"),t}(t,n),e.style.setProperty(t,n))};if("string"==typeof n){if(null==o)return i.windowApi.globalThis.getComputedStyle(e).getPropertyValue(n);r(n,o)}else{if("object"!=typeof n)throw new TypeError("property must be string or object");for(const e in n){r(e,n[e])}}}text(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return t.isNodeList(e)?null==n?o.text(e[0]):void e.forEach(e=>{o.text(e,n)}):null==n?e.textContent||e.innerText:(n instanceof Node&&(n=n.textContent||n.innerText),void("textContent"in e?e.textContent=n:"innerText"in e&&(e.innerText=n)))}html(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return t.isNodeList(e)?null==n?o.html(e[0]):void e.forEach(e=>{o.html(e,n)}):null==n?e.innerHTML:(n instanceof Element&&(n=n.innerHTML),void("innerHTML"in e&&t.setSafeHTML(e,n)))}getTransform(e,n=!1){const o=this;let i=0,r=0;if(!(n||!n&&t.isShow(e))){const{recovery:n}=t.forceShow(e),i=o.getTransform(e,!0);return n(),i}const s=o.windowApi.globalThis.getComputedStyle(e).transform;if(null!=s&&"none"!==s&&""!==s){const e=s.match(/\((.+)\)/)?.[1].split(",");e?(i=Math.abs(parseInt(e[4])),r=Math.abs(parseInt(e[5]))):(i=0,r=0)}return{transformLeft:i,transformTop:r}}val(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return t.isNodeList(e)?null==n?o.val(e[0]):void e.forEach(e=>{o.val(e,n)}):null==n?"input"!==e.localName||"checkbox"!==e.type&&"radio"!==e.type?e.value:e.checked:void("input"!==e.localName||"checkbox"!==e.type&&"radio"!==e.type?e.value=n:e.checked=!!n)}prop(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null!=e)return t.isNodeList(e)?null==o?i.prop(e[0],n):void e.forEach(e=>{i.prop(e,n,o)}):null==o?Reflect.get(e,n):void(e instanceof Element&&"innerHTML"===n?i.html(e,o):Reflect.set(e,n,o))}removeAttr(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.removeAttr(e,n)}):e.removeAttribute(n))}removeClass(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.removeClass(e,n)}):null==n?e.className="":(Array.isArray(n)||(n=n.trim().split(" ")),n.forEach(t=>{e.classList.remove(t)})))}removeProp(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.removeProp(e,n)}):t.delete(e,n))}addClass(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.addClass(e,n)}):(Array.isArray(n)||(n=n.split(" ")),n.forEach(t=>{""!=t.trim()&&e.classList.add(t)})))}hasClass(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return!1;if(t.isNodeList(e)){let t=!0;for(let i=0;i<e.length;i++){const r=e[i];t=t&&o.hasClass(r,n)}return t}if(!e?.classList)return!1;Array.isArray(n)||(n=n.split(" "));for(let t=0;t<n.length;t++){const o=n[t].trim();if(!e.classList.contains(o))return!1}return!0}append(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.append(e,...n)});const o=(e,n)=>{e instanceof DocumentFragment?("string"==typeof n&&(n=this.toElement(n,!0,!1)),e.appendChild(n)):"string"==typeof n?e.insertAdjacentHTML("beforeend",t.createSafeHTML(n)):e.appendChild(n)},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}prepend(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.prepend(e,...n)});const o=(e,n)=>{if(e instanceof DocumentFragment)"string"==typeof n&&(n=this.toElement(n,!0,!1)),e.appendChild(n);else if("string"==typeof n)e.insertAdjacentHTML("afterbegin",t.createSafeHTML(n));else{const t=e.firstChild;t?e.insertBefore(n,t):e.prepend(n)}},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}after(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.after(e,...n)});const o=(n,o)=>{if(n instanceof DocumentFragment)"string"==typeof o&&(o=this.toElement(o,!0,!1)),n.appendChild(o);else if("string"==typeof o)n.insertAdjacentHTML("afterend",t.createSafeHTML(o));else{const t=e.parentElement,n=e.nextSibling;t&&n?t.insertBefore(o,n):e.after(o)}},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}before(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.before(e,...n)});const o=(n,o)=>{if(n instanceof DocumentFragment)"string"==typeof o&&(o=this.toElement(o,!0,!1)),n.appendChild(o);else if("string"==typeof o)e.insertAdjacentHTML("beforebegin",t.createSafeHTML(o));else{const t=e.parentElement;t?t.insertBefore(o,e):e.before(o)}},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}remove(e){"string"==typeof e&&(e=this.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{this.remove(e)}):(e.querySelectorAll("*").forEach(e=>{e instanceof Element&&this.offAll(e)}),this.offAll(e),"function"==typeof e.remove?e.remove():e.parentElement?e.parentElement.removeChild(e):e.parentNode&&e.parentNode.removeChild(e)))}empty(e){const n=this;"string"==typeof e&&(e=n.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{n.empty(e)}):e.innerHTML?t.setSafeHTML(e,""):e.textContent&&(e.textContent=""))}offset(e){const t=this;if("string"==typeof e&&(e=t.selector(e)),null==e)return;const n=e.getBoundingClientRect();return{top:n.top+t.windowApi.globalThis.scrollY,left:n.left+t.windowApi.globalThis.scrollX}}width(e,n=!1){const o=this;if("string"==typeof e&&(e=o.selector(e)),t.isWin(e))return o.windowApi.window.document.documentElement.clientWidth;if(9===e.nodeType)return Math.max(e.body.scrollWidth,e.documentElement.scrollWidth,e.body.offsetWidth,e.documentElement.offsetWidth,e.documentElement.clientWidth);if(n||!n&&t.isShow(e)){if(parseFloat(t.getStyleValue(e,"width").toString())>0)return parseFloat(t.getStyleValue(e,"width").toString());if(e.offsetWidth>0){const n=t.getStyleValue(e,"borderLeftWidth"),o=t.getStyleValue(e,"borderRightWidth"),i=t.getStyleValue(e,"paddingLeft"),r=t.getStyleValue(e,"paddingRight"),s=parseFloat(e.offsetWidth.toString())-parseFloat(n.toString())-parseFloat(o.toString())-parseFloat(i.toString())-parseFloat(r.toString());return parseFloat(s.toString())}return 0}{const{recovery:n}=t.forceShow(e),i=o.width(e,!0);return n(),i}}height(e,n=!1){const o=this;if(t.isWin(e))return o.windowApi.window.document.documentElement.clientHeight;if("string"==typeof e&&(e=o.selector(e)),9===e.nodeType)return Math.max(e.body.scrollHeight,e.documentElement.scrollHeight,e.body.offsetHeight,e.documentElement.offsetHeight,e.documentElement.clientHeight);if(n||!n&&t.isShow(e)){if(parseFloat(t.getStyleValue(e,"height").toString())>0)return parseFloat(t.getStyleValue(e,"height").toString());if(e.offsetHeight>0){const n=t.getStyleValue(e,"borderTopWidth"),o=t.getStyleValue(e,"borderBottomWidth"),i=t.getStyleValue(e,"paddingTop"),r=t.getStyleValue(e,"paddingBottom"),s=parseFloat(e.offsetHeight.toString())-parseFloat(n.toString())-parseFloat(o.toString())-parseFloat(i.toString())-parseFloat(r.toString());return parseFloat(s.toString())}return 0}{const{recovery:n}=t.forceShow(e),i=o.height(e,!0);return n(),i}}outerWidth(e,n=!1){const o=this;if(t.isWin(e))return o.windowApi.window.innerWidth;if("string"==typeof e&&(e=o.selector(e)),n||!n&&t.isShow(e)){const n=o.windowApi.globalThis.getComputedStyle(e,null),i=t.getStyleValue(n,"marginLeft"),r=t.getStyleValue(n,"marginRight");return e.offsetWidth+i+r}{const{recovery:n}=t.forceShow(e),i=o.outerWidth(e,!0);return n(),i}}outerHeight(e,n=!1){const o=this;if(t.isWin(e))return o.windowApi.window.innerHeight;if("string"==typeof e&&(e=o.selector(e)),n||!n&&t.isShow(e)){const n=o.windowApi.globalThis.getComputedStyle(e,null),i=t.getStyleValue(n,"marginTop"),r=t.getStyleValue(n,"marginBottom");return e.offsetHeight+i+r}{const{recovery:n}=t.forceShow(e),i=o.outerHeight(e,!0);return n(),i}}replaceWith(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{o.replaceWith(e,n)});"string"==typeof n&&(n=o.toElement(n,!1,!1));const i=e.parentElement;i?i.replaceChild(n,e):(o.after(e,n),this.remove(e))}wrap(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{o.wrap(e,n)});const i=o.windowApi.document.createElement("div");o.html(i,n);const r=i.firstChild;e.parentElement.insertBefore(r,e),r.appendChild(e)}prev(e){if("string"==typeof e&&(e=this.selector(e)),null!=e)return e.previousElementSibling}next(e){if("string"==typeof e&&(e=this.selector(e)),null!=e)return e.nextElementSibling}siblings(e){if("string"==typeof e&&(e=this.selector(e)),null!=e)return Array.from(e.parentElement.children).filter(t=>t!==e)}parent(e){const n=this;if("string"==typeof e&&(e=n.selector(e)),null!=e){if(t.isNodeList(e)){const t=[];return e.forEach(e=>{t.push(n.parent(e))}),t}return e.parentElement}}toElement(e,t=!1,n=!1){const o=this;return e=e.trim(),t?function(){const t=new DOMParser;return n?t.parseFromString(e,"text/html"):t.parseFromString(e,"text/html").body.firstChild}():function(){const t=o.windowApi.document.createElement("div");return o.html(t,e),n?t:t.firstElementChild??t.firstChild}()}toElements(e,t=!1){const n=this;return e=e.trim(),t?function(){const t=new DOMParser;return Array.from(t.parseFromString(e,"text/html").body.childNodes)}():function(){const t=n.windowApi.document.createElement("div");return n.html(t,e),Array.from(t.childNodes)}()}serialize(e){if(!(e instanceof HTMLFormElement))throw new TypeError("DOMUtils.serialize 参数必须是HTMLFormElement");const t=e.elements,n=[];for(let e=0;e<t.length;e++){const o=t[e];if(o.name&&!o.disabled&&(o.checked||["text","hidden","password","textarea","select-one","select-multiple"].includes(o.type)))if("select-multiple"===o.type)for(let e=0;e<o.options.length;e++)o.options[e].selected&&n.push({name:o.name,value:o.options[e].value});else n.push({name:o.name,value:o.value})}return n.map(e=>`${encodeURIComponent(e.name)}=${encodeURIComponent(e.value)}`).join("&")}createDOMUtils(e){return new u(e)}getTextBoundingRect(e,t,n){const o=this;if(!e||!("value"in e))return e;if(null==t&&(t=e.selectionStart||0),null==n&&(n=e.selectionEnd||0),"string"==typeof t&&(t=parseFloat(t)),("number"!=typeof t||isNaN(t))&&(t=0),t=t<0?0:Math.min(e.value.length,t),"string"==typeof n&&(n=parseFloat(n)),("number"!=typeof n||isNaN(n)||n<t)&&(n=t),n=n<0?0:Math.min(e.value.length,n),"function"==typeof e.createTextRange){const o=e.createTextRange();return o.collapse(!0),o.moveStart("character",t),o.moveEnd("character",n-t),o.getBoundingClientRect()}const i=function(){const t=o.windowApi.document.body,n=o.windowApi.document.defaultView,i=o.windowApi.document.documentElement,r=o.windowApi.document.createElement("div");r.style.paddingLeft=r.style.width="1px",t.appendChild(r);const s=2==r.offsetWidth;t.removeChild(r);const l=e.getBoundingClientRect(),c=i.clientTop||t.clientTop||0,a=i.clientLeft||t.clientLeft||0,f=n.pageYOffset||s&&i.scrollTop||t.scrollTop,d=n.pageXOffset||s&&i.scrollLeft||t.scrollLeft;return{top:l.top+f-c,left:l.left+d-a}}(),r=g("width",!0),s=g("height",!0);let l=i.top,c=i.left,a="white-space:pre;padding:0;margin:0;";const f=["direction","font-family","font-size","font-size-adjust","font-variant","font-weight","font-style","letter-spacing","line-height","text-align","text-indent","text-transform","word-wrap","word-spacing"];l+=g("padding-top",!0),l+=g("border-top-width",!0),c+=g("padding-left",!0),c+=g("border-left-width",!0),c+=1;for(let e=0;e<f.length;e++){const t=f[e];a+=t+":"+g(t,!1)+";"}const d=e.value||"G",u=d.length,p=o.windowApi.document.createElement("div");t>0&&y(0,t);const h=y(t,n);u>n&&y(n,u),p.style.cssText=a,p.style.position="absolute",p.style.top=l+"px",p.style.left=c+"px",p.style.width=r+"px",p.style.height=s+"px",o.windowApi.document.body.appendChild(p);const m=h.getBoundingClientRect();return p?.parentNode?.removeChild(p),m;function y(e,t){const n=o.windowApi.document.createElement("span");return n.style.cssText=a,n.textContent=d.substring(e,t),p.appendChild(n),n}function g(t,n){const i=o.windowApi.document.defaultView.getComputedStyle(e,null).getPropertyValue(t);return n?parseFloat(i):i}}addStyle(e){if("string"!=typeof e)throw new Error("DOMUtils.addStyle 参数cssText 必须为String类型");const t=this.createElement("style",{type:"text/css",innerHTML:e});return this.windowApi.document.head?this.windowApi.document.head.appendChild(t):0===this.windowApi.document.documentElement.childNodes.length?this.windowApi.document.documentElement.appendChild(t):this.windowApi.document.documentElement.insertBefore(t,this.windowApi.document.documentElement.childNodes[0]),t}checkUserClickInNode(e){if(!t.isDOM(e))throw new Error("DOMUtils.checkUserClickInNode 参数 targetNode 必须为 Element|Node 类型");const n=this.windowApi.window.event,o=this.windowApi.window.event,i=n?.composedPath()?.[0],r=null!=n?.clientX?n.clientX:o.touches[0].clientX,s=null!=n?.clientY?n.clientY:o.touches[0].clientY,{left:l,right:c,top:a,bottom:f}=e.getBoundingClientRect();return r>=l&&r<=c&&s>=a&&s<=f||!!(i&&e.contains(i)||i==e)}deleteParentNode(e,n){if(null==e)return;if(!t.isDOM(e))throw new Error("DOMUtils.deleteParentNode 参数 target 必须为 Node|HTMLElement 类型");if("string"!=typeof n)throw new Error("DOMUtils.deleteParentNode 参数 targetSelector 必须为 string 类型");let o=!1;const i=p.closest(e,n);return i&&(this.remove(i),o=!0),o}*findElementsWithText(e,t,n){const o=this;if(e.outerHTML.includes(t))if(0===e.children.length){"function"==typeof n&&n(e)||(yield e)}else{const o=Array.from(e.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE);for(const i of o)if(i.textContent.includes(t)){"function"==typeof n&&n(e)||(yield i)}}for(let i=0;i<e.children.length;i++){const r=e.children[i];yield*o.findElementsWithText(r,t,n)}}findVisibleElement(e){let t=e;for(;t;){if(t.getBoundingClientRect().length)return t;t=t.parentElement}return null}setElementSelection(e,t,n,o){const i=this.windowApi.document.createRange();if(i.selectNodeContents(e),t){if(t.nodeType!==Node.TEXT_NODE)throw new TypeError("childTextNode必须是#text元素");null!=n&&null!=o&&(i.setStart(t,n),i.setEnd(t,o))}const r=this.windowApi.globalThis.getSelection();r&&(r.removeAllRanges(),r.addRange(i))}}const p=new u;export{p as default};
|
|
2
2
|
//# sourceMappingURL=index.esm.min.js.map
|
package/dist/index.iife.js
CHANGED
package/dist/index.iife.min.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var DOMUtils=function(){"use strict";class e{defaultApi={document:document,window:window,globalThis:globalThis,self:self,top:top,setTimeout:globalThis.setTimeout.bind(globalThis),setInterval:globalThis.setInterval.bind(globalThis),clearTimeout:globalThis.clearTimeout.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis)};api;constructor(e){e&&(null==e.globalThis&&(e.globalThis=e.window),null==e.self&&(e.self=e.window)),e||(e=Object.assign({},this.defaultApi)),this.api=Object.assign({},e)}get document(){return this.api.document}get window(){return this.api.window}get globalThis(){return this.api.globalThis}get self(){return this.api.self}get top(){return this.api.top}get setTimeout(){return this.api.setTimeout}get clearTimeout(){return this.api.clearTimeout}get setInterval(){return this.api.setInterval}get clearInterval(){return this.api.clearInterval}}const t={windowApi:new e({document:document,window:window,top:top,setTimeout:globalThis.setTimeout.bind(globalThis),clearTimeout:globalThis.clearTimeout.bind(globalThis),setInterval:globalThis.setInterval.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis)}),isShow:e=>Boolean(e.getClientRects().length),createSafeHTML(e){if(window.trustedTypes){return window.trustedTypes.createPolicy("safe-innerHTML",{createHTML:e=>e}).createHTML(e)}return e},setSafeHTML(e,t){e.innerHTML=this.createSafeHTML(t)},forceShow(e){const t=e.cloneNode(!0);return t.setAttribute("style","visibility: hidden !important;display:block !important;"),this.windowApi.document.documentElement.appendChild(t),{recovery(){t.remove()}}},getStyleValue(e,t){let n=null,o=null;e instanceof CSSStyleDeclaration?o=e:(n=e.ownerDocument.defaultView,n&&n.opener||(n=window),o=n.getComputedStyle(e));const i=parseFloat(o[t]);return isNaN(i)?0:i},isWin:e=>"object"==typeof e&&(!(e instanceof Node)&&(e===globalThis||(e===window||(e===self||(e===globalThis||(e===window||(e===self||("undefined"!=typeof unsafeWindow&&e===unsafeWindow||"[object Math]"===e?.Math?.toString())))))))),isDOM:e=>e instanceof Node,delete(e,t){if("object"==typeof Reflect&&null!=Reflect&&Reflect.deleteProperty)return Reflect.deleteProperty(e,t);delete e[t]},isNodeList:e=>Array.isArray(e)||e instanceof NodeList,getAnimationEndNameList:()=>["webkitAnimationEnd","mozAnimationEnd","MSAnimationEnd","oanimationend","animationend"],getTransitionEndNameList:()=>["webkitTransitionEnd","mozTransitionEnd","MSTransitionEnd","otransitionend","transitionend"]};class n{windowApi;constructor(t){this.windowApi=new e(t)}selector(e,t){return this.selectorAll(e,t)[0]}selectorAll(e,t){const n=this;if(t=t||n.windowApi.document,(e=e.trim()).startsWith("xpath:")){e=e.replace(/^xpath:/i,"");const o=n.windowApi.document.evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),i=[];let r=o.iterateNext();for(;r;)i.push(r),r=o.iterateNext();return i}if(e.match(/[^\s]{1}:empty$/gi))return e=e.replace(/:empty$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>""===e?.innerHTML?.trim());if(e.match(/[^\s]{1}:contains\("(.*)"\)$/i)||e.match(/[^\s]{1}:contains\('(.*)'\)$/i)){const n=e.match(/:contains\(("|')(.*)("|')\)$/i)[2];return e=e.replace(/:contains\(("|')(.*)("|')\)$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>{let t=e.textContent;return null==t&&(t=e.innerText),null!=t&&t.includes(n)})}if(e.match(/[^\s]{1}:regexp\("(.*)"\)$/i)||e.match(/[^\s]{1}:regexp\('(.*)'\)$/i)){let n=e.match(/:regexp\(("|')(.*)("|')\)$/i)[2];const o=n.match(/("|'),[\s]*("|')([igm]{0,3})$/i);let i="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),i=o[3]);const r=new RegExp(n,i);return e=e.replace(/:regexp\(("|')(.*)("|')\)$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>{let t=e.textContent;return null==t&&(t=e.innerText),null!=t&&!!t.match(r)})}return Array.from(t.querySelectorAll(e))}matches(e,t){if(t=t.trim(),null==e)return!1;if(e instanceof Document)return!1;if(t.match(/[^\s]{1}:empty$/gi))return t=t.replace(/:empty$/gi,""),e.matches(t)&&""===e?.innerHTML?.trim();if(t.match(/[^\s]{1}:contains\("(.*)"\)$/i)||t.match(/[^\s]{1}:contains\('(.*)'\)$/i)){const n=t.match(/:contains\(("|')(.*)("|')\)$/i)[2];t=t.replace(/:contains\(("|')(.*)("|')\)$/gi,"");let o=e.textContent;return null==o&&(o=e.innerText),null!=o&&(e.matches(t)&&o.includes(n))}if(t.match(/[^\s]{1}:regexp\("(.*)"\)$/i)||t.match(/[^\s]{1}:regexp\('(.*)'\)$/i)){let n=t.match(/:regexp\(("|')(.*)("|')\)$/i)[2];const o=n.match(/("|'),[\s]*("|')([igm]{0,3})$/i);let i="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),i=o[3]);const r=new RegExp(n,i);t=t.replace(/:regexp\(("|')(.*)("|')\)$/gi,"");let s=e.textContent;return null==s&&(s=e.innerText),null!=s&&(e.matches(t)&&!!s.match(r))}return e.matches(t)}closest(e,t){if(t=t.trim(),null==e)return null;if(e instanceof Document)return null;if(t.match(/[^\s]{1}:empty$/gi)){t=t.replace(/:empty$/gi,"");const n=e?.closest(t);return n&&""===n?.innerHTML?.trim()?n:null}if(t.match(/[^\s]{1}:contains\("(.*)"\)$/i)||t.match(/[^\s]{1}:contains\('(.*)'\)$/i)){const n=t.match(/:contains\(("|')(.*)("|')\)$/i)[2];t=t.replace(/:contains\(("|')(.*)("|')\)$/gi,"");const o=e?.closest(t);if(o){const t=e?.textContent||e?.innerText;if("string"==typeof t&&t.includes(n))return o}return null}if(t.match(/[^\s]{1}:regexp\("(.*)"\)$/i)||t.match(/[^\s]{1}:regexp\('(.*)'\)$/i)){let n=t.match(/:regexp\(("|')(.*)("|')\)$/i)[2];const o=n.match(/("|'),[\s]*("|')([igm]{0,3})$/i);let i="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),i=o[3]);const r=new RegExp(n,i);t=t.replace(/:regexp\(("|')(.*)("|')\)$/gi,"");const s=e?.closest(t);if(s){let t=e.textContent;if(null==t&&(t=e.innerText),"string"==typeof t&&t.match(r))return s}return null}{const n=e?.closest(t);return n}}}const o=new n,i=function(e){return e instanceof Node};const r=new class{windowApi;constructor(t){this.windowApi=new e(t)}isJQuery(e){let t=!1;if("object"==typeof jQuery&&e instanceof jQuery&&(t=!0),null==e)return!1;if("object"==typeof e){const n=["add","addBack","addClass","after","ajaxComplete","ajaxError","ajaxSend","ajaxStart","ajaxStop","ajaxSuccess","animate","append","appendTo","attr","before","bind","blur","change","children","clearQueue","click","clone","closest","constructor","contents","contextmenu","css","data","dblclick","delay","delegate","dequeue","each","empty","end","eq","extend","fadeIn","fadeOut","fadeTo","fadeToggle","filter","find","first","focus","focusin","focusout","get","has","hasClass","height","hide","hover","html","index","init","innerHeight","innerWidth","insertAfter","insertBefore","is","jquery","keydown","keyup","last","load","map","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","next","nextAll","not","off","offset","offsetParent","on","one","outerHeight","outerWidth","parent","parents","position","prepend","prependTo","prev","prevAll","prevUntil","promise","prop","pushStack","queue","ready","remove","removeAttr","removeClass","removeData","removeProp","replaceAll","replaceWith","resize","scroll","scrollLeft","scrollTop","select","show","siblings","slice","slideDown","slideToggle","slideUp","text","toggle","toggleClass","trigger","triggerHandler","unbind","width","wrap"];for(const o of n){if(!(o in e)){t=!1;break}t=!0}}return t}assign(e={},t={},n=!1){const o=this;if(Array.isArray(t)){if(!t.filter(e=>"object"==typeof e).length)return t}if(null==t)return e;let r;null==e&&(e={}),r=n?t:e;for(const s in r){if(!n&&!(s in t))continue;const r=Reflect.get(e,s),l=Reflect.get(t,s);if("object"==typeof l&&null!=l&&s in e&&!i(l)){let t;Array.isArray(l)?(Array.isArray(r)&&(r.length=0),t=l):t=o.assign(r,l,n),Reflect.set(e,s,t)}else Reflect.set(e,s,l)}return e}mutationObserver(e,t){t=this.assign({callback:()=>{},config:{subtree:void 0,childList:void 0,attributes:void 0,attributeFilter:void 0,attributeOldValue:void 0,characterData:void 0,characterDataOldValue:void 0},immediate:!1},t);const n=new(this.windowApi.window.MutationObserver||this.windowApi.window.webkitMutationObserver||this.windowApi.window.MozMutationObserver)(function(e,n){"function"==typeof t.callback&&t.callback(e,n)});return Array.isArray(e)||e instanceof NodeList?e.forEach(e=>{n.observe(e,t.config)}):this.isJQuery(e)?e.each((e,o)=>{n.observe(o,t.config)}):n.observe(e,t.config),t.immediate&&"function"==typeof t.callback&&t.callback([],n),n}};class s extends n{windowApi;constructor(t){super(t),this.windowApi=new e(t)}wait(e,t,n){const o=this,i="number"==typeof t?t:0;return new Promise(t=>{const s=r.mutationObserver(n||o.windowApi.document,{config:{subtree:!0,childList:!0,attributes:!0},immediate:!0,callback(n,o){const i=e();i.success&&("function"==typeof o?.disconnect&&o.disconnect(),t(i.data))}});i>0&&setTimeout(()=>{"function"==typeof s?.disconnect&&s.disconnect(),t(null)},i)})}waitNode(...e){const t=(e=e.filter(e=>void 0!==e))[0];let n=this.windowApi.document,i=0;if("string"!=typeof e[0]&&!Array.isArray(e[0])&&"function"!=typeof e[0])throw new TypeError("DOMUtils.waitNode 第一个参数必须是string|string[]|Function");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNode 第二个参数必须是number|Node");n=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitNode 参数个数错误");{const t=e[1],o=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNode 第二个参数必须是Node");if(n=t,"number"!=typeof o)throw new TypeError("DOMUtils.waitNode 第三个参数必须是number");i=o}}return this.wait(()=>{const e=function(){if(!Array.isArray(t))return"function"==typeof t?t():o.selector(t,n);{const e=[];for(let n=0;n<t.length;n++){const i=o.selector(t[n]);i&&e.push(i)}if(e.length===t.length)return e}}();return e?{success:!0,data:e}:{success:!1,data:e}},i,n)}waitAnyNode(...e){e=e.filter(e=>void 0!==e);const t=this,n=e[0];let o=t.windowApi.document,i=0;if("object"!=typeof e[0]&&!Array.isArray(e[0]))throw new TypeError("DOMUtils.waitAnyNode 第一个参数必须是string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNode 第二个参数必须是number|Node");o=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitAnyNode 参数个数错误");{const t=e[1],n=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNode 第二个参数必须是Node");if(o=t,"number"!=typeof n)throw new TypeError("DOMUtils.waitAnyNode 第三个参数必须是number");i=n}}const r=n.map(e=>t.waitNode(e,o,i));return Promise.any(r)}waitNodeList(...e){const t=(e=e.filter(e=>void 0!==e))[0];let n=this.windowApi.document,i=0;if("string"!=typeof e[0]&&!Array.isArray(e[0]))throw new TypeError("DOMUtils.waitNodeList 第一个参数必须是string|string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNodeList 第二个参数必须是number|Node");n=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitNodeList 参数个数错误");{const t=e[1],o=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNodeList 第二个参数必须是Node");if(n=t,"number"!=typeof o)throw new TypeError("DOMUtils.waitNodeList 第三个参数必须是number");i=o}}return this.wait(()=>{const e=function(){if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++){const r=o.selectorAll(t[i],n);r.length&&e.push(r)}if(e.length===t.length)return e}else{const e=o.selectorAll(t,n);if(e.length)return e}}();return e?{success:!0,data:e}:{success:!1,data:e}},i,n)}waitAnyNodeList(...e){e=e.filter(e=>void 0!==e);const t=this,n=e[0];let o=t.windowApi.document,i=0;if(!Array.isArray(e[0]))throw new TypeError("DOMUtils.waitAnyNodeList 第一个参数必须是string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNodeList 第二个参数必须是number|Node");o=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitAnyNodeList 参数个数错误");{const t=e[1],n=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNodeList 第二个参数必须是Node");if(o=t,"number"!=typeof n)throw new TypeError("DOMUtils.waitAnyNodeList 第三个参数必须是number");i=n}}const r=n.map(e=>t.waitNodeList(e,o,i));return Promise.any(r)}}new s;class l extends s{windowApi;constructor(t){super(t),this.windowApi=new e(t)}animate(e,n,i=1e3,r=null){const s=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{s.animate(e,n,i,r)});if("number"!=typeof i||i<=0)throw new TypeError("duration must be a positive number");if("function"!=typeof r&&void 0!==r)throw new TypeError("callback must be a function or null");if("object"!=typeof n||void 0===n)throw new TypeError("styles must be an object");if(0===Object.keys(n).length)throw new Error("styles must contain at least one property");const l=performance.now(),c={},a={};for(const t in n)c[t]=e.style[t]||s.windowApi.globalThis.getComputedStyle(e)[t],a[t]=n[t];const f=setInterval(function(){let t=(performance.now()-l)/i;t>1&&(t=1);for(const o in n)e.style[o]=c[o]+(a[o]-c[o])*t+"px";1===t&&(clearInterval(f),r&&r())},10)}show(e,n=!0){const i=this;if(null!=e)if("string"==typeof e&&(e=o.selectorAll(e)),e instanceof NodeList||e instanceof Array)for(const t of e)i.show(t,n);else e.style.display="",n&&(t.isShow(e)||e.style.setProperty("display","unset","important"))}hide(e,n=!0){const i=this;if(null!=e)if("string"==typeof e&&(e=o.selectorAll(e)),e instanceof NodeList||e instanceof Array)for(const t of e)i.hide(t,n);else e.style.display="none",n&&t.isShow(e)&&e.style.setProperty("display","none","important")}fadeIn(e,n=400,i){if(null==e)return;const r=this;if("string"==typeof e&&(e=o.selectorAll(e)),t.isNodeList(e))return void e.forEach(e=>{r.fadeIn(e,n,i)});e.style.opacity="0",e.style.display="";let s=null,l=null;l=r.windowApi.window.requestAnimationFrame(function t(o){s||(s=o);const c=o-s;e.style.opacity=Math.min(c/n,1).toString(),c<n?r.windowApi.window.requestAnimationFrame(t):(i&&"function"==typeof i&&i(),r.windowApi.window.cancelAnimationFrame(l))})}fadeOut(e,n=400,i){const r=this;if(null==e)return;if("string"==typeof e&&(e=o.selectorAll(e)),t.isNodeList(e))return void e.forEach(e=>{r.fadeOut(e,n,i)});e.style.opacity="1";let s=null,l=null;l=r.windowApi.window.requestAnimationFrame(function t(o){s||(s=o);const c=o-s;e.style.opacity=Math.max(1-c/n,0).toString(),c<n?r.windowApi.window.requestAnimationFrame(t):(e.style.display="none","function"==typeof i&&i(),r.windowApi.window.cancelAnimationFrame(l))})}toggle(e,n){const i=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{i.toggle(e)}):"none"===i.windowApi.globalThis.getComputedStyle(e).getPropertyValue("display")?i.show(e,n):i.hide(e,n))}}new l;const c={domEventSymbol:Symbol("events_"+(65536*(1+Math.random())|0).toString(16).substring(1))},a={Object:{defineProperty:Object.defineProperty,defineProperties:Object.defineProperties}};class f extends l{windowApi;constructor(t){super(t),this.windowApi=new e(t)}getAnimationEndNameList(){return t.getAnimationEndNameList()}getTransitionEndNameList(){return t.getTransitionEndNameList()}on(e,n,o,i,r){const s=function(e,t,n){const o=e[t];if("boolean"==typeof o)n.capture=o,"boolean"==typeof e[t+1]&&(n.once=e[t+1]),"boolean"==typeof e[t+2]&&(n.passive=e[t+2]);else if(o&&"object"==typeof o)for(const e in n)Reflect.has(o,e)&&Reflect.set(n,e,o[e]);return n},l=this,f=arguments;if("string"==typeof e&&(e=l.selectorAll(e)),null==e)return{off(){},emit(){}};let d=[];e instanceof NodeList||Array.isArray(e)?d=d.concat(Array.from(e)):d.push(e);let u=[];Array.isArray(n)?u=u.concat(n.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof n&&(u=u.concat(n.split(" ").filter(e=>""!==e)));let p=[];Array.isArray(o)?p=p.concat(o.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof o&&p.push(o);let h=i,m={capture:!1,once:!1,passive:!1,isComposedPath:!1,overrideTarget:!0};return"function"==typeof o?(h=o,m=s(f,3,m)):m=s(f,4,m),d.forEach(e=>{const n=t.isWin(e);u.forEach(t=>{const s=()=>{m.once&&this.off(e,t,o,i,r)},f=function(t){let o,i,r;m.isPreventEvent&&l.preventEvent(t);let c=!1;if(p.length){let s;if(m.isComposedPath){const e=t.composedPath();!e.length&&t.target&&e.push(t.target),s=e[0]}else s=t.target;const f=n?l.windowApi.document.documentElement:e;if(p.find(e=>{if(l.matches(s,e))return!0;const t=l.closest(s,e);return!(!t||!f?.contains?.(t))&&(s=t,!0)})){if(m.overrideTarget)try{const e=t.target;a.Object.defineProperties(t,{target:{get:()=>s},originTarget:{get:()=>e}})}catch{}c=!0,o=s,i=t,r=s}}else c=!0,o=e,i=t;if(c){const e=h.call(o,i,r);if(s(),"boolean"==typeof e&&!e)return!1}};e.addEventListener(t,f,m);const d=Reflect.get(e,c.domEventSymbol)||{};d[t]=d[t]||[],d[t].push({selector:p,option:m,handlerCallBack:f,callback:h}),Reflect.set(e,c.domEventSymbol,d)})}),{off:e=>{l.off(d,u,p,h,m,e)},emit:(e,t)=>{l.emit(d,u,e,t)}}}off(e,n,o,i,r,s){const l=function(e,t,n){const o=e[t];return"boolean"==typeof o?n.capture=o:o&&"object"==typeof o&&"capture"in o&&(n.capture=o.capture),n},a=arguments;if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let f=[];e instanceof NodeList||Array.isArray(e)?f=f.concat(Array.from(e)):f.push(e);let d=[];Array.isArray(n)?d=d.concat(n.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof n&&(d=d.concat(n.split(" ").filter(e=>""!==e)));let u=[];Array.isArray(o)?u=u.concat(o.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof o&&u.push(o);let p=i,h={capture:!1};"function"==typeof o?(p=o,h=l(a,3,h)):h=l(a,4,h),5===a.length&&"function"==typeof a[4]&&"function"!=typeof s&&(s=r),f.forEach(e=>{const o=Reflect.get(e,c.domEventSymbol)||{};d.forEach(i=>{const r=o[i]||[],l="function"==typeof s?r.filter(s):r;for(let t=0;t<l.length;t++){const n=l[t];let o=!0;if(o&&p&&n.callback!==p&&(o=!1),o&&u.length&&Array.isArray(n.selector)&&JSON.stringify(n.selector)!==JSON.stringify(u)&&(o=!1),o&&"boolean"==typeof n.option.capture&&h.capture!==n.option.capture&&(o=!1),o){e.removeEventListener(i,n.handlerCallBack,n.option);for(let e=r.length-1;e>=0;e--)r[e]===n&&r.splice(e,1)}}0===r.length&&(t.delete(o,n),0===Object.keys(o).length&&t.delete(e,c.domEventSymbol))}),Reflect.set(e,c.domEventSymbol,o)})}offAll(e,n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let o=[];e instanceof NodeList||Array.isArray(e)?o=o.concat(Array.from(e)):o.push(e);let i=[];Array.isArray(n)?i=i.concat(n):"string"==typeof n&&(i=i.concat(n.split(" "))),o.forEach(e=>{[...new Set([...Object.getOwnPropertySymbols(e),c.domEventSymbol])].forEach(n=>{if(!n.toString().startsWith("Symbol(events_"))return;const o=Reflect.get(e,n)||{};(i.length?i:Object.keys(o)).forEach(i=>{const r=o[i];if(!r)return;for(const t of r)e.removeEventListener(i,t.handlerCallBack,{capture:t.option.capture});const s=Reflect.get(e,n);t.delete(s,i),0===Object.keys(s).length&&t.delete(e,n)})})})}onReady(...e){const t=e[0];let n;const o=this,i=[{target:o.windowApi.document,eventType:"DOMContentLoaded",callback:()=>{r.completed()}},{target:o.windowApi.window,eventType:"load",callback:()=>{r.completed()}}],r={init(){if(0===e.length)return new Promise(e=>{n=e,r.check()});r.check()},check(){r.isReady()?setTimeout(()=>{r.completed()},0):r.onCompleted()},isReady(){try{return"complete"===o.windowApi.document.readyState||"loading"!==o.windowApi.document.readyState&&!o.windowApi.document.documentElement.doScroll}catch{return!1}},completed(){r.offCompleted(),"function"==typeof t&&t(),"function"==typeof n&&n()},onCompleted(){for(const e of i)o.on(e.target,e.eventType,e.callback)},offCompleted(){for(const e of i)o.off(e.target,e.eventType,e.callback)}};return r.init()}emit(e,t,n,o=!0){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let i=[];e instanceof NodeList||Array.isArray(e)?i=i.concat(Array.from(e)):i.push(e);const r=(e,t)=>{if(e instanceof Event&&"object"==typeof t&&null!=t&&!Array.isArray(t)){Object.keys(t).forEach(n=>{const o=Reflect.get(t,n);Reflect.set(e,n,o)})}};let s=[],l=null;Array.isArray(t)?s=t.filter(e=>"string"==typeof e&&""!==e.trim()):"string"==typeof t?s=t.split(" "):t instanceof Event&&(l=t,r(l,n)),i.forEach(e=>{const t=Reflect.get(e,c.domEventSymbol)||{},i=(n,i)=>{0==o&&i in t?t[i].forEach(e=>{e.handlerCallBack(n)}):e.dispatchEvent(n)};if(l){const e=l,t=e.type;i(e,t)}else s.forEach(e=>{const t=new Event(e);r(t,n),i(t,e)})})}click(e,n,o,i){const r=this;if("string"==typeof e&&(e=r.selectorAll(e)),null!=e)if(t.isNodeList(e))e.forEach(e=>{r.click(e,n,o,i)});else{if(null!=n){return r.on(e,"click",null,n)}r.emit(e,"click",o,i)}}blur(e,n,o,i){const r=this;if("string"==typeof e&&(e=r.selectorAll(e)),null!=e)if(t.isNodeList(e))e.forEach(e=>{r.focus(e,n,o,i)});else{if(null!==n){return r.on(e,"blur",null,n)}r.emit(e,"blur",o,i)}}focus(e,n,o,i){const r=this;if("string"==typeof e&&(e=r.selectorAll(e)),null!=e)if(t.isNodeList(e))e.forEach(e=>{r.focus(e,n,o,i)});else{if(null!=n){return r.on(e,"focus",null,n)}r.emit(e,"focus",o,i)}}onHover(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null==e)return;if(t.isNodeList(e)){const t=[];return e.forEach(e=>{const r=i.onHover(e,n,o);t.push(r)}),{off(){t.forEach(e=>{e&&e.off()})}}}const r=i.on(e,"mouseenter",null,n,o),s=i.on(e,"mouseleave",null,n,o);return{off(){r.off(),s.off()}}}onAnimationend(e,n,o){const i=this;if("string"==typeof e&&(e=i.selector(e)),null==e)return;const r={once:!0};Object.assign(r,o||{});const s=t.getAnimationEndNameList();return i.on(e,s,null,n,r),r.once?void 0:{off(){i.off(e,s,null,n,r)}}}onTransitionend(e,n,o){const i=this;if("string"==typeof e&&(e=i.selector(e)),null==e)return;const r={once:!0};Object.assign(r,o||{});const s=t.getTransitionEndNameList();return i.on(e,s,null,n,r),r.once?void 0:{off(){i.off(e,s,null,n,r)}}}onKeyup(e,n,o){const i=this;if(null!=e){if("string"==typeof e&&(e=i.selectorAll(e)),t.isNodeList(e)){const t=[];return e.forEach(e=>{const r=i.onKeyup(e,n,o);t.push(r)}),{off(){t.forEach(e=>{e&&e.off()})}}}return i.on(e,"keyup",null,n,o)}}onKeydown(e,n,o){const i=this;if(null!=e){if("string"==typeof e&&(e=i.selectorAll(e)),t.isNodeList(e)){const t=[];return e.forEach(e=>{const r=i.onKeydown(e,n,o);t.push(r)}),{off(){t.forEach(e=>{e&&e.off()})}}}return i.on(e,"keydown",null,n,o)}}onKeyboard(e,t="keydown",n,o){const i=this;"string"==typeof e&&(e=i.selectorAll(e));return i.on(e,t,function(e){const t=e.key||e.code,o=e.charCode||e.keyCode||e.which,i=[];e.ctrlKey&&i.push("ctrl"),e.altKey&&i.push("alt"),e.metaKey&&i.push("meta"),e.shiftKey&&i.push("shift"),"function"==typeof n&&n(t,o,i,e)},o)}onInput(e,t,n){let o=!1;const i=this.on(e,"input",async e=>{o||await t(e)},n),r=this.on(e,"compositionstart",()=>{o=!0},n),s=this.on(e,"compositionend",()=>{o=!1,this.emit(e,"input",{isComposite:o})},n);return{off(){i.off(),r.off(),s.off()},emit(e,t){i.emit(e,t)}}}onOneOrDouble(...e){const t=e[0];let n,o,i;if(2===e.length){if("function"!=typeof e[1])throw new TypeError("handler is not a function");o=e[1]}else if(3===e.length)"function"==typeof e[1]?(o=e[1],i=e[2]):(n=e[1],o=e[2]);else{if(4!==e.length)throw new Error("args length error");n=e[1],o=e[2],i=e[3]}let r,s=new WeakMap,l=!1,c="pointerup",a=200;"object"==typeof i&&null!=i&&(("string"==typeof i.eventType||Array.isArray(i.eventType))&&(c=i.eventType),"number"==typeof i.checkClickTime&&(a=i.checkClickTime));const f=(e,t,n)=>n?o(e,n,t):o(e,t),d=this.on(t,c,n,(e,t)=>{clearTimeout(r),r=void 0,l&&s.has(t)?(l=!1,s.delete(t),f(e,{isDouble:!0},t)):(r=setTimeout(()=>{l=!1,f(e,{isDouble:!1},t)},a),l=!0,s.set(t,e))},i);return{off(){d.off(),s=null},emit(e,t){f(e,t||{isDouble:!1})}}}preventEvent(...e){const t=(e,t)=>{if(e?.stopPropagation(),e?.stopImmediatePropagation(),"boolean"!=typeof t||!t)return e?.preventDefault(),!1};if(e[0]instanceof Event){const n=e[1];return t(e[0],n)}{const n=e[0];let o,i,r=e[1],s=!1,l=!1;if("string"==typeof r&&(r=[r]),2===e.length);else if("string"==typeof e[2]||Array.isArray(e[2]))o=e[2],"object"==typeof e[3]&&null!=e[3]&&(i=e[3]);else{if("object"!=typeof e[2]||null==e[2]||Array.isArray(e[2]))throw new TypeError("Invalid argument");i=e[2]}i&&(s=Boolean(i.capture),l=Boolean(i.onlyStopPropagation));return this.on(n,r,o,e=>t(e,l),{capture:s})}}}new f;class d extends f{windowApi;constructor(t){super(t),this.windowApi=new e(t)}getElementSelector(e){if(!e)return;if(!e.parentElement)return;if(e.id)return`#${e.id}`;let t=this.getElementSelector(e.parentElement);if(!t)return e.tagName.toLowerCase();if(e.parentElement.querySelectorAll(e.tagName).length>1){const n=Array.prototype.indexOf.call(e.parentElement.children,e)+1;t+=` > ${e.tagName.toLowerCase()}:nth-child(${n})`}else t+=` > ${e.tagName.toLowerCase()}`;return t}}new d;class u extends d{constructor(e){super(e)}version="2.0.7";noConflict(){return this.windowApi.window.DOMUtils&&t.delete(window,"DOMUtils"),this.windowApi.window.DOMUtils=this,this}attr(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null!=e)return t.isNodeList(e)?null==o?i.attr(e[0],n,o):void e.forEach(e=>{i.attr(e,n,o)}):null==o?e.getAttribute(n):void e.setAttribute(n,o)}createElement(e,t,n){const o=this,i=o.windowApi.document.createElement(e);return"string"==typeof t?(o.html(i,t),i):(null==t&&(t={}),null==n&&(n={}),Object.keys(t).forEach(e=>{const n=t[e];"innerHTML"!==e?i[e]=n:o.html(i,n)}),Object.keys(n).forEach(e=>{let t=n[e];"object"==typeof t?t=JSON.stringify(t):"function"==typeof t&&(t=t.toString()),i.setAttribute(e,t)}),i)}css(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null==e)return;if(t.isNodeList(e))return"string"==typeof n?null==o?i.css(e[0],n):void e.forEach(e=>{i.css(e,n)}):"object"==typeof n?void e.forEach(e=>{i.css(e,n)}):void 0;const r=(t,n)=>{"string"==typeof n&&n.trim().endsWith("!important")?(n=n.trim().replace(/!important$/gi,"").trim(),e.style.setProperty(t,n,"important")):(n=function(e,t){return"number"==typeof t&&(t=t.toString()),"string"==typeof t&&["width","height","top","left","right","bottom","font-size"].includes(e)&&t.match(/[0-9]$/gi)&&(t+="px"),t}(t,n),e.style.setProperty(t,n))};if("string"==typeof n){if(null==o)return i.windowApi.globalThis.getComputedStyle(e).getPropertyValue(n);r(n,o)}else{if("object"!=typeof n)throw new TypeError("property must be string or object");for(const e in n){r(e,n[e])}}}text(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return t.isNodeList(e)?null==n?o.text(e[0]):void e.forEach(e=>{o.text(e,n)}):null==n?e.textContent||e.innerText:(n instanceof Node&&(n=n.textContent||n.innerText),void("textContent"in e?e.textContent=n:"innerText"in e&&(e.innerText=n)))}html(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return t.isNodeList(e)?null==n?o.html(e[0]):void e.forEach(e=>{o.html(e,n)}):null==n?e.innerHTML:(n instanceof Element&&(n=n.innerHTML),void("innerHTML"in e&&t.setSafeHTML(e,n)))}getTransform(e,n=!1){const o=this;let i=0,r=0;if(!(n||!n&&t.isShow(e))){const{recovery:n}=t.forceShow(e),i=o.getTransform(e,!0);return n(),i}const s=o.windowApi.globalThis.getComputedStyle(e).transform;if(null!=s&&"none"!==s&&""!==s){const e=s.match(/\((.+)\)/)?.[1].split(",");e?(i=Math.abs(parseInt(e[4])),r=Math.abs(parseInt(e[5]))):(i=0,r=0)}return{transformLeft:i,transformTop:r}}val(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return t.isNodeList(e)?null==n?o.val(e[0]):void e.forEach(e=>{o.val(e,n)}):null==n?"input"!==e.localName||"checkbox"!==e.type&&"radio"!==e.type?e.value:e.checked:void("input"!==e.localName||"checkbox"!==e.type&&"radio"!==e.type?e.value=n:e.checked=!!n)}prop(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null!=e)return t.isNodeList(e)?null==o?i.prop(e[0],n):void e.forEach(e=>{i.prop(e,n,o)}):null==o?Reflect.get(e,n):void(e instanceof Element&&"innerHTML"===n?i.html(e,o):Reflect.set(e,n,o))}removeAttr(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.removeAttr(e,n)}):e.removeAttribute(n))}removeClass(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.removeClass(e,n)}):null==n?e.className="":(Array.isArray(n)||(n=n.trim().split(" ")),n.forEach(t=>{e.classList.remove(t)})))}removeProp(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.removeProp(e,n)}):t.delete(e,n))}addClass(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.addClass(e,n)}):(Array.isArray(n)||(n=n.split(" ")),n.forEach(t=>{""!=t.trim()&&e.classList.add(t)})))}hasClass(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return!1;if(t.isNodeList(e)){let t=!0;for(let i=0;i<e.length;i++){const r=e[i];t=t&&o.hasClass(r,n)}return t}if(!e?.classList)return!1;Array.isArray(n)||(n=n.split(" "));for(let t=0;t<n.length;t++){const o=n[t].trim();if(!e.classList.contains(o))return!1}return!0}append(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.append(e,...n)});const o=(e,n)=>{e instanceof DocumentFragment?("string"==typeof n&&(n=this.toElement(n,!0,!1)),e.appendChild(n)):"string"==typeof n?e.insertAdjacentHTML("beforeend",t.createSafeHTML(n)):e.appendChild(n)},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}prepend(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.prepend(e,...n)});const o=(e,n)=>{if(e instanceof DocumentFragment)"string"==typeof n&&(n=this.toElement(n,!0,!1)),e.appendChild(n);else if("string"==typeof n)e.insertAdjacentHTML("afterbegin",t.createSafeHTML(n));else{const t=e.firstChild;t?e.insertBefore(n,t):e.prepend(n)}},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}after(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.after(e,...n)});const o=(n,o)=>{if(n instanceof DocumentFragment)"string"==typeof o&&(o=this.toElement(o,!0,!1)),n.appendChild(o);else if("string"==typeof o)n.insertAdjacentHTML("afterend",t.createSafeHTML(o));else{const t=e.parentElement,n=e.nextSibling;t&&n?t.insertBefore(o,n):e.after(o)}},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}before(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.before(e,...n)});const o=(n,o)=>{if(n instanceof DocumentFragment)"string"==typeof o&&(o=this.toElement(o,!0,!1)),n.appendChild(o);else if("string"==typeof o)e.insertAdjacentHTML("beforebegin",t.createSafeHTML(o));else{const t=e.parentElement;t?t.insertBefore(o,e):e.before(o)}},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}remove(e){"string"==typeof e&&(e=this.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{this.remove(e)}):(e.querySelectorAll("*").forEach(e=>{e instanceof Element&&this.offAll(e)}),this.offAll(e),"function"==typeof e.remove?e.remove():e.parentElement?e.parentElement.removeChild(e):e.parentNode&&e.parentNode.removeChild(e)))}empty(e){const n=this;"string"==typeof e&&(e=n.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{n.empty(e)}):e.innerHTML?t.setSafeHTML(e,""):e.textContent&&(e.textContent=""))}offset(e){const t=this;if("string"==typeof e&&(e=t.selector(e)),null==e)return;const n=e.getBoundingClientRect();return{top:n.top+t.windowApi.globalThis.scrollY,left:n.left+t.windowApi.globalThis.scrollX}}width(e,n=!1){const o=this;if("string"==typeof e&&(e=o.selector(e)),t.isWin(e))return o.windowApi.window.document.documentElement.clientWidth;if(9===e.nodeType)return Math.max(e.body.scrollWidth,e.documentElement.scrollWidth,e.body.offsetWidth,e.documentElement.offsetWidth,e.documentElement.clientWidth);if(n||!n&&t.isShow(e)){if(parseFloat(t.getStyleValue(e,"width").toString())>0)return parseFloat(t.getStyleValue(e,"width").toString());if(e.offsetWidth>0){const n=t.getStyleValue(e,"borderLeftWidth"),o=t.getStyleValue(e,"borderRightWidth"),i=t.getStyleValue(e,"paddingLeft"),r=t.getStyleValue(e,"paddingRight"),s=parseFloat(e.offsetWidth.toString())-parseFloat(n.toString())-parseFloat(o.toString())-parseFloat(i.toString())-parseFloat(r.toString());return parseFloat(s.toString())}return 0}{const{recovery:n}=t.forceShow(e),i=o.width(e,!0);return n(),i}}height(e,n=!1){const o=this;if(t.isWin(e))return o.windowApi.window.document.documentElement.clientHeight;if("string"==typeof e&&(e=o.selector(e)),9===e.nodeType)return Math.max(e.body.scrollHeight,e.documentElement.scrollHeight,e.body.offsetHeight,e.documentElement.offsetHeight,e.documentElement.clientHeight);if(n||!n&&t.isShow(e)){if(parseFloat(t.getStyleValue(e,"height").toString())>0)return parseFloat(t.getStyleValue(e,"height").toString());if(e.offsetHeight>0){const n=t.getStyleValue(e,"borderTopWidth"),o=t.getStyleValue(e,"borderBottomWidth"),i=t.getStyleValue(e,"paddingTop"),r=t.getStyleValue(e,"paddingBottom"),s=parseFloat(e.offsetHeight.toString())-parseFloat(n.toString())-parseFloat(o.toString())-parseFloat(i.toString())-parseFloat(r.toString());return parseFloat(s.toString())}return 0}{const{recovery:n}=t.forceShow(e),i=o.height(e,!0);return n(),i}}outerWidth(e,n=!1){const o=this;if(t.isWin(e))return o.windowApi.window.innerWidth;if("string"==typeof e&&(e=o.selector(e)),n||!n&&t.isShow(e)){const n=o.windowApi.globalThis.getComputedStyle(e,null),i=t.getStyleValue(n,"marginLeft"),r=t.getStyleValue(n,"marginRight");return e.offsetWidth+i+r}{const{recovery:n}=t.forceShow(e),i=o.outerWidth(e,!0);return n(),i}}outerHeight(e,n=!1){const o=this;if(t.isWin(e))return o.windowApi.window.innerHeight;if("string"==typeof e&&(e=o.selector(e)),n||!n&&t.isShow(e)){const n=o.windowApi.globalThis.getComputedStyle(e,null),i=t.getStyleValue(n,"marginTop"),r=t.getStyleValue(n,"marginBottom");return e.offsetHeight+i+r}{const{recovery:n}=t.forceShow(e),i=o.outerHeight(e,!0);return n(),i}}replaceWith(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{o.replaceWith(e,n)});"string"==typeof n&&(n=o.toElement(n,!1,!1));const i=e.parentElement;i?i.replaceChild(n,e):(o.after(e,n),this.remove(e))}wrap(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{o.wrap(e,n)});const i=o.windowApi.document.createElement("div");o.html(i,n);const r=i.firstChild;e.parentElement.insertBefore(r,e),r.appendChild(e)}prev(e){if("string"==typeof e&&(e=this.selector(e)),null!=e)return e.previousElementSibling}next(e){if("string"==typeof e&&(e=this.selector(e)),null!=e)return e.nextElementSibling}siblings(e){if("string"==typeof e&&(e=this.selector(e)),null!=e)return Array.from(e.parentElement.children).filter(t=>t!==e)}parent(e){const n=this;if("string"==typeof e&&(e=n.selector(e)),null!=e){if(t.isNodeList(e)){const t=[];return e.forEach(e=>{t.push(n.parent(e))}),t}return e.parentElement}}toElement(e,t=!1,n=!1){const o=this;return e=e.trim(),t?function(){const t=new DOMParser;return n?t.parseFromString(e,"text/html"):t.parseFromString(e,"text/html").body.firstChild}():function(){const t=o.windowApi.document.createElement("div");return o.html(t,e),n?t:t.firstElementChild??t.firstChild}()}toElements(e,t=!1){const n=this;return e=e.trim(),t?function(){const t=new DOMParser;return Array.from(t.parseFromString(e,"text/html").body.childNodes)}():function(){const t=n.windowApi.document.createElement("div");return n.html(t,e),Array.from(t.childNodes)}()}serialize(e){if(!(e instanceof HTMLFormElement))throw new TypeError("DOMUtils.serialize 参数必须是HTMLFormElement");const t=e.elements,n=[];for(let e=0;e<t.length;e++){const o=t[e];if(o.name&&!o.disabled&&(o.checked||["text","hidden","password","textarea","select-one","select-multiple"].includes(o.type)))if("select-multiple"===o.type)for(let e=0;e<o.options.length;e++)o.options[e].selected&&n.push({name:o.name,value:o.options[e].value});else n.push({name:o.name,value:o.value})}return n.map(e=>`${encodeURIComponent(e.name)}=${encodeURIComponent(e.value)}`).join("&")}createDOMUtils(e){return new u(e)}getTextBoundingRect(e,t,n){const o=this;if(!e||!("value"in e))return e;if(null==t&&(t=e.selectionStart||0),null==n&&(n=e.selectionEnd||0),"string"==typeof t&&(t=parseFloat(t)),("number"!=typeof t||isNaN(t))&&(t=0),t=t<0?0:Math.min(e.value.length,t),"string"==typeof n&&(n=parseFloat(n)),("number"!=typeof n||isNaN(n)||n<t)&&(n=t),n=n<0?0:Math.min(e.value.length,n),"function"==typeof e.createTextRange){const o=e.createTextRange();return o.collapse(!0),o.moveStart("character",t),o.moveEnd("character",n-t),o.getBoundingClientRect()}const i=function(){const t=o.windowApi.document.body,n=o.windowApi.document.defaultView,i=o.windowApi.document.documentElement,r=o.windowApi.document.createElement("div");r.style.paddingLeft=r.style.width="1px",t.appendChild(r);const s=2==r.offsetWidth;t.removeChild(r);const l=e.getBoundingClientRect(),c=i.clientTop||t.clientTop||0,a=i.clientLeft||t.clientLeft||0,f=n.pageYOffset||s&&i.scrollTop||t.scrollTop,d=n.pageXOffset||s&&i.scrollLeft||t.scrollLeft;return{top:l.top+f-c,left:l.left+d-a}}(),r=g("width",!0),s=g("height",!0);let l=i.top,c=i.left,a="white-space:pre;padding:0;margin:0;";const f=["direction","font-family","font-size","font-size-adjust","font-variant","font-weight","font-style","letter-spacing","line-height","text-align","text-indent","text-transform","word-wrap","word-spacing"];l+=g("padding-top",!0),l+=g("border-top-width",!0),c+=g("padding-left",!0),c+=g("border-left-width",!0),c+=1;for(let e=0;e<f.length;e++){const t=f[e];a+=t+":"+g(t,!1)+";"}const d=e.value||"G",u=d.length,p=o.windowApi.document.createElement("div");t>0&&y(0,t);const h=y(t,n);u>n&&y(n,u),p.style.cssText=a,p.style.position="absolute",p.style.top=l+"px",p.style.left=c+"px",p.style.width=r+"px",p.style.height=s+"px",o.windowApi.document.body.appendChild(p);const m=h.getBoundingClientRect();return p?.parentNode?.removeChild(p),m;function y(e,t){const n=o.windowApi.document.createElement("span");return n.style.cssText=a,n.textContent=d.substring(e,t),p.appendChild(n),n}function g(t,n){const i=o.windowApi.document.defaultView.getComputedStyle(e,null).getPropertyValue(t);return n?parseFloat(i):i}}addStyle(e){if("string"!=typeof e)throw new Error("DOMUtils.addStyle 参数cssText 必须为String类型");const t=this.createElement("style",{type:"text/css",innerHTML:e});return this.windowApi.document.head?this.windowApi.document.head.appendChild(t):0===this.windowApi.document.documentElement.childNodes.length?this.windowApi.document.documentElement.appendChild(t):this.windowApi.document.documentElement.insertBefore(t,this.windowApi.document.documentElement.childNodes[0]),t}checkUserClickInNode(e){if(!t.isDOM(e))throw new Error("DOMUtils.checkUserClickInNode 参数 targetNode 必须为 Element|Node 类型");const n=this.windowApi.window.event,o=this.windowApi.window.event,i=n?.composedPath()?.[0],r=null!=n?.clientX?n.clientX:o.touches[0].clientX,s=null!=n?.clientY?n.clientY:o.touches[0].clientY,{left:l,right:c,top:a,bottom:f}=e.getBoundingClientRect();return r>=l&&r<=c&&s>=a&&s<=f||!!(i&&e.contains(i)||i==e)}deleteParentNode(e,n){if(null==e)return;if(!t.isDOM(e))throw new Error("DOMUtils.deleteParentNode 参数 target 必须为 Node|HTMLElement 类型");if("string"!=typeof n)throw new Error("DOMUtils.deleteParentNode 参数 targetSelector 必须为 string 类型");let o=!1;const i=p.closest(e,n);return i&&(this.remove(i),o=!0),o}*findElementsWithText(e,t,n){const o=this;if(e.outerHTML.includes(t))if(0===e.children.length){"function"==typeof n&&n(e)||(yield e)}else{const o=Array.from(e.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE);for(const i of o)if(i.textContent.includes(t)){"function"==typeof n&&n(e)||(yield i)}}for(let i=0;i<e.children.length;i++){const r=e.children[i];yield*o.findElementsWithText(r,t,n)}}findVisibleElement(e){let t=e;for(;t;){if(t.getBoundingClientRect().length)return t;t=t.parentElement}return null}setElementSelection(e,t,n,o){const i=this.windowApi.document.createRange();if(i.selectNodeContents(e),t){if(t.nodeType!==Node.TEXT_NODE)throw new TypeError("childTextNode必须是#text元素");null!=n&&null!=o&&(i.setStart(t,n),i.setEnd(t,o))}const r=this.windowApi.globalThis.getSelection();r&&(r.removeAllRanges(),r.addRange(i))}}const p=new u;return p}();
|
|
1
|
+
var DOMUtils=function(){"use strict";class e{defaultApi={document:document,window:window,globalThis:globalThis,self:self,top:top,setTimeout:globalThis.setTimeout.bind(globalThis),setInterval:globalThis.setInterval.bind(globalThis),clearTimeout:globalThis.clearTimeout.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis)};api;constructor(e){e&&(null==e.globalThis&&(e.globalThis=e.window),null==e.self&&(e.self=e.window)),e||(e=Object.assign({},this.defaultApi)),this.api=Object.assign({},e)}get document(){return this.api.document}get window(){return this.api.window}get globalThis(){return this.api.globalThis}get self(){return this.api.self}get top(){return this.api.top}get setTimeout(){return this.api.setTimeout}get clearTimeout(){return this.api.clearTimeout}get setInterval(){return this.api.setInterval}get clearInterval(){return this.api.clearInterval}}const t={windowApi:new e({document:document,window:window,top:top,setTimeout:globalThis.setTimeout.bind(globalThis),clearTimeout:globalThis.clearTimeout.bind(globalThis),setInterval:globalThis.setInterval.bind(globalThis),clearInterval:globalThis.clearInterval.bind(globalThis)}),isShow:e=>Boolean(e.getClientRects().length),createSafeHTML(e){if(window.trustedTypes){return window.trustedTypes.createPolicy("safe-innerHTML",{createHTML:e=>e}).createHTML(e)}return e},setSafeHTML(e,t){e.innerHTML=this.createSafeHTML(t)},forceShow(e){const t=e.cloneNode(!0);return t.setAttribute("style","visibility: hidden !important;display:block !important;"),this.windowApi.document.documentElement.appendChild(t),{recovery(){t.remove()}}},getStyleValue(e,t){let n=null,o=null;e instanceof CSSStyleDeclaration?o=e:(n=e.ownerDocument.defaultView,n&&n.opener||(n=window),o=n.getComputedStyle(e));const i=parseFloat(o[t]);return isNaN(i)?0:i},isWin:e=>"object"==typeof e&&(!(e instanceof Node)&&(e===globalThis||(e===window||(e===self||(e===globalThis||(e===window||(e===self||("undefined"!=typeof unsafeWindow&&e===unsafeWindow||"[object Math]"===e?.Math?.toString())))))))),isDOM:e=>e instanceof Node,delete(e,t){if("object"==typeof Reflect&&null!=Reflect&&Reflect.deleteProperty)return Reflect.deleteProperty(e,t);delete e[t]},isNodeList:e=>Array.isArray(e)||e instanceof NodeList,getAnimationEndNameList:()=>["webkitAnimationEnd","mozAnimationEnd","MSAnimationEnd","oanimationend","animationend"],getTransitionEndNameList:()=>["webkitTransitionEnd","mozTransitionEnd","MSTransitionEnd","otransitionend","transitionend"]};class n{windowApi;constructor(t){this.windowApi=new e(t)}selector(e,t){return this.selectorAll(e,t)[0]}selectorAll(e,t){const n=this;if(t=t||n.windowApi.document,(e=e.trim()).startsWith("xpath:")){e=e.replace(/^xpath:/i,"");const o=n.windowApi.document.evaluate(e,t,null,XPathResult.ORDERED_NODE_ITERATOR_TYPE,null),i=[];let r=o.iterateNext();for(;r;)i.push(r),r=o.iterateNext();return i}if(e.match(/[^\s]{1}:empty$/gi))return e=e.replace(/:empty$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>""===e?.innerHTML?.trim());if(e.match(/[^\s]{1}:contains\("(.*)"\)$/i)||e.match(/[^\s]{1}:contains\('(.*)'\)$/i)){const n=e.match(/:contains\(("|')(.*)("|')\)$/i)[2];return e=e.replace(/:contains\(("|')(.*)("|')\)$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>{let t=e.textContent;return null==t&&(t=e.innerText),null!=t&&t.includes(n)})}if(e.match(/[^\s]{1}:regexp\("(.*)"\)$/i)||e.match(/[^\s]{1}:regexp\('(.*)'\)$/i)){let n=e.match(/:regexp\(("|')(.*)("|')\)$/i)[2];const o=n.match(/("|'),[\s]*("|')([igm]{0,3})$/i);let i="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),i=o[3]);const r=new RegExp(n,i);return e=e.replace(/:regexp\(("|')(.*)("|')\)$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>{let t=e.textContent;return null==t&&(t=e.innerText),null!=t&&!!t.match(r)})}return Array.from(t.querySelectorAll(e))}matches(e,t){if(t=t.trim(),null==e)return!1;if(e instanceof Document)return!1;if(t.match(/[^\s]{1}:empty$/gi))return t=t.replace(/:empty$/gi,""),e.matches(t)&&""===e?.innerHTML?.trim();if(t.match(/[^\s]{1}:contains\("(.*)"\)$/i)||t.match(/[^\s]{1}:contains\('(.*)'\)$/i)){const n=t.match(/:contains\(("|')(.*)("|')\)$/i)[2];t=t.replace(/:contains\(("|')(.*)("|')\)$/gi,"");let o=e.textContent;return null==o&&(o=e.innerText),null!=o&&(e.matches(t)&&o.includes(n))}if(t.match(/[^\s]{1}:regexp\("(.*)"\)$/i)||t.match(/[^\s]{1}:regexp\('(.*)'\)$/i)){let n=t.match(/:regexp\(("|')(.*)("|')\)$/i)[2];const o=n.match(/("|'),[\s]*("|')([igm]{0,3})$/i);let i="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),i=o[3]);const r=new RegExp(n,i);t=t.replace(/:regexp\(("|')(.*)("|')\)$/gi,"");let s=e.textContent;return null==s&&(s=e.innerText),null!=s&&(e.matches(t)&&!!s.match(r))}return e.matches(t)}closest(e,t){if(t=t.trim(),null==e)return null;if(e instanceof Document)return null;if(t.match(/[^\s]{1}:empty$/gi)){t=t.replace(/:empty$/gi,"");const n=e?.closest(t);return n&&""===n?.innerHTML?.trim()?n:null}if(t.match(/[^\s]{1}:contains\("(.*)"\)$/i)||t.match(/[^\s]{1}:contains\('(.*)'\)$/i)){const n=t.match(/:contains\(("|')(.*)("|')\)$/i)[2];t=t.replace(/:contains\(("|')(.*)("|')\)$/gi,"");const o=e?.closest(t);if(o){const t=e?.textContent||e?.innerText;if("string"==typeof t&&t.includes(n))return o}return null}if(t.match(/[^\s]{1}:regexp\("(.*)"\)$/i)||t.match(/[^\s]{1}:regexp\('(.*)'\)$/i)){let n=t.match(/:regexp\(("|')(.*)("|')\)$/i)[2];const o=n.match(/("|'),[\s]*("|')([igm]{0,3})$/i);let i="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),i=o[3]);const r=new RegExp(n,i);t=t.replace(/:regexp\(("|')(.*)("|')\)$/gi,"");const s=e?.closest(t);if(s){let t=e.textContent;if(null==t&&(t=e.innerText),"string"==typeof t&&t.match(r))return s}return null}{const n=e?.closest(t);return n}}}const o=new n,i=function(e){return e instanceof Node};const r=new class{windowApi;constructor(t){this.windowApi=new e(t)}isJQuery(e){let t=!1;if("object"==typeof jQuery&&e instanceof jQuery&&(t=!0),null==e)return!1;if("object"==typeof e){const n=["add","addBack","addClass","after","ajaxComplete","ajaxError","ajaxSend","ajaxStart","ajaxStop","ajaxSuccess","animate","append","appendTo","attr","before","bind","blur","change","children","clearQueue","click","clone","closest","constructor","contents","contextmenu","css","data","dblclick","delay","delegate","dequeue","each","empty","end","eq","extend","fadeIn","fadeOut","fadeTo","fadeToggle","filter","find","first","focus","focusin","focusout","get","has","hasClass","height","hide","hover","html","index","init","innerHeight","innerWidth","insertAfter","insertBefore","is","jquery","keydown","keyup","last","load","map","mousedown","mouseenter","mouseleave","mousemove","mouseout","mouseover","mouseup","next","nextAll","not","off","offset","offsetParent","on","one","outerHeight","outerWidth","parent","parents","position","prepend","prependTo","prev","prevAll","prevUntil","promise","prop","pushStack","queue","ready","remove","removeAttr","removeClass","removeData","removeProp","replaceAll","replaceWith","resize","scroll","scrollLeft","scrollTop","select","show","siblings","slice","slideDown","slideToggle","slideUp","text","toggle","toggleClass","trigger","triggerHandler","unbind","width","wrap"];for(const o of n){if(!(o in e)){t=!1;break}t=!0}}return t}assign(e={},t={},n=!1){const o=this;if(Array.isArray(t)){if(!t.filter(e=>"object"==typeof e).length)return t}if(null==t)return e;let r;null==e&&(e={}),r=n?t:e;for(const s in r){if(!n&&!(s in t))continue;const r=Reflect.get(e,s),l=Reflect.get(t,s);if("object"==typeof l&&null!=l&&s in e&&!i(l)){let t;Array.isArray(l)?(Array.isArray(r)&&(r.length=0),t=l):t=o.assign(r,l,n),Reflect.set(e,s,t)}else Reflect.set(e,s,l)}return e}mutationObserver(e,t){t=this.assign({callback:()=>{},config:{subtree:void 0,childList:void 0,attributes:void 0,attributeFilter:void 0,attributeOldValue:void 0,characterData:void 0,characterDataOldValue:void 0},immediate:!1},t);const n=new(this.windowApi.window.MutationObserver||this.windowApi.window.webkitMutationObserver||this.windowApi.window.MozMutationObserver)(function(e,n){"function"==typeof t.callback&&t.callback(e,n)});return Array.isArray(e)||e instanceof NodeList?e.forEach(e=>{n.observe(e,t.config)}):this.isJQuery(e)?e.each((e,o)=>{n.observe(o,t.config)}):n.observe(e,t.config),t.immediate&&"function"==typeof t.callback&&t.callback([],n),n}};class s extends n{windowApi;constructor(t){super(t),this.windowApi=new e(t)}wait(e,t,n){const o=this,i="number"==typeof t?t:0;return new Promise(t=>{const s=r.mutationObserver(n||o.windowApi.document,{config:{subtree:!0,childList:!0,attributes:!0},immediate:!0,callback(n,o){const i=e();i.success&&("function"==typeof o?.disconnect&&o.disconnect(),t(i.data))}});i>0&&setTimeout(()=>{"function"==typeof s?.disconnect&&s.disconnect(),t(null)},i)})}waitNode(...e){const t=(e=e.filter(e=>void 0!==e))[0];let n=this.windowApi.document,i=0;if("string"!=typeof e[0]&&!Array.isArray(e[0])&&"function"!=typeof e[0])throw new TypeError("DOMUtils.waitNode 第一个参数必须是string|string[]|Function");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNode 第二个参数必须是number|Node");n=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitNode 参数个数错误");{const t=e[1],o=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNode 第二个参数必须是Node");if(n=t,"number"!=typeof o)throw new TypeError("DOMUtils.waitNode 第三个参数必须是number");i=o}}return this.wait(()=>{const e=function(){if(!Array.isArray(t))return"function"==typeof t?t():o.selector(t,n);{const e=[];for(let n=0;n<t.length;n++){const i=o.selector(t[n]);i&&e.push(i)}if(e.length===t.length)return e}}();return e?{success:!0,data:e}:{success:!1,data:e}},i,n)}waitAnyNode(...e){e=e.filter(e=>void 0!==e);const t=this,n=e[0];let o=t.windowApi.document,i=0;if("object"!=typeof e[0]&&!Array.isArray(e[0]))throw new TypeError("DOMUtils.waitAnyNode 第一个参数必须是string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNode 第二个参数必须是number|Node");o=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitAnyNode 参数个数错误");{const t=e[1],n=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNode 第二个参数必须是Node");if(o=t,"number"!=typeof n)throw new TypeError("DOMUtils.waitAnyNode 第三个参数必须是number");i=n}}const r=n.map(e=>t.waitNode(e,o,i));return Promise.any(r)}waitNodeList(...e){const t=(e=e.filter(e=>void 0!==e))[0];let n=this.windowApi.document,i=0;if("string"!=typeof e[0]&&!Array.isArray(e[0]))throw new TypeError("DOMUtils.waitNodeList 第一个参数必须是string|string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNodeList 第二个参数必须是number|Node");n=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitNodeList 参数个数错误");{const t=e[1],o=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitNodeList 第二个参数必须是Node");if(n=t,"number"!=typeof o)throw new TypeError("DOMUtils.waitNodeList 第三个参数必须是number");i=o}}return this.wait(()=>{const e=function(){if(Array.isArray(t)){const e=[];for(let i=0;i<t.length;i++){const r=o.selectorAll(t[i],n);r.length&&e.push(r)}if(e.length===t.length)return e}else{const e=o.selectorAll(t,n);if(e.length)return e}}();return e?{success:!0,data:e}:{success:!1,data:e}},i,n)}waitAnyNodeList(...e){e=e.filter(e=>void 0!==e);const t=this,n=e[0];let o=t.windowApi.document,i=0;if(!Array.isArray(e[0]))throw new TypeError("DOMUtils.waitAnyNodeList 第一个参数必须是string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)i=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNodeList 第二个参数必须是number|Node");o=t}}else{if(3!==e.length)throw new TypeError("DOMUtils.waitAnyNodeList 参数个数错误");{const t=e[1],n=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("DOMUtils.waitAnyNodeList 第二个参数必须是Node");if(o=t,"number"!=typeof n)throw new TypeError("DOMUtils.waitAnyNodeList 第三个参数必须是number");i=n}}const r=n.map(e=>t.waitNodeList(e,o,i));return Promise.any(r)}}new s;class l extends s{windowApi;constructor(t){super(t),this.windowApi=new e(t)}animate(e,n,i=1e3,r=null){const s=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{s.animate(e,n,i,r)});if("number"!=typeof i||i<=0)throw new TypeError("duration must be a positive number");if("function"!=typeof r&&void 0!==r)throw new TypeError("callback must be a function or null");if("object"!=typeof n||void 0===n)throw new TypeError("styles must be an object");if(0===Object.keys(n).length)throw new Error("styles must contain at least one property");const l=performance.now(),c={},a={};for(const t in n)c[t]=e.style[t]||s.windowApi.globalThis.getComputedStyle(e)[t],a[t]=n[t];const f=setInterval(function(){let t=(performance.now()-l)/i;t>1&&(t=1);for(const o in n)e.style[o]=c[o]+(a[o]-c[o])*t+"px";1===t&&(clearInterval(f),r&&r())},10)}show(e,n=!0){const i=this;if(null!=e)if("string"==typeof e&&(e=o.selectorAll(e)),e instanceof NodeList||e instanceof Array)for(const t of e)i.show(t,n);else e.style.display="",n&&(t.isShow(e)||e.style.setProperty("display","unset","important"))}hide(e,n=!0){const i=this;if(null!=e)if("string"==typeof e&&(e=o.selectorAll(e)),e instanceof NodeList||e instanceof Array)for(const t of e)i.hide(t,n);else e.style.display="none",n&&t.isShow(e)&&e.style.setProperty("display","none","important")}fadeIn(e,n=400,i){if(null==e)return;const r=this;if("string"==typeof e&&(e=o.selectorAll(e)),t.isNodeList(e))return void e.forEach(e=>{r.fadeIn(e,n,i)});e.style.opacity="0",e.style.display="";let s=null,l=null;l=r.windowApi.window.requestAnimationFrame(function t(o){s||(s=o);const c=o-s;e.style.opacity=Math.min(c/n,1).toString(),c<n?r.windowApi.window.requestAnimationFrame(t):(i&&"function"==typeof i&&i(),r.windowApi.window.cancelAnimationFrame(l))})}fadeOut(e,n=400,i){const r=this;if(null==e)return;if("string"==typeof e&&(e=o.selectorAll(e)),t.isNodeList(e))return void e.forEach(e=>{r.fadeOut(e,n,i)});e.style.opacity="1";let s=null,l=null;l=r.windowApi.window.requestAnimationFrame(function t(o){s||(s=o);const c=o-s;e.style.opacity=Math.max(1-c/n,0).toString(),c<n?r.windowApi.window.requestAnimationFrame(t):(e.style.display="none","function"==typeof i&&i(),r.windowApi.window.cancelAnimationFrame(l))})}toggle(e,n){const i=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{i.toggle(e)}):"none"===i.windowApi.globalThis.getComputedStyle(e).getPropertyValue("display")?i.show(e,n):i.hide(e,n))}}new l;const c={domEventSymbol:Symbol("events_"+(65536*(1+Math.random())|0).toString(16).substring(1))},a={Object:{defineProperty:Object.defineProperty,defineProperties:Object.defineProperties}};class f extends l{windowApi;constructor(t){super(t),this.windowApi=new e(t)}getAnimationEndNameList(){return t.getAnimationEndNameList()}getTransitionEndNameList(){return t.getTransitionEndNameList()}on(e,n,o,i,r){const s=function(e,t,n){const o=e[t];if("boolean"==typeof o)n.capture=o,"boolean"==typeof e[t+1]&&(n.once=e[t+1]),"boolean"==typeof e[t+2]&&(n.passive=e[t+2]);else if(o&&"object"==typeof o)for(const e in n)Reflect.has(o,e)&&Reflect.set(n,e,o[e]);return n},l=this,f=arguments;if("string"==typeof e&&(e=l.selectorAll(e)),null==e)return{off(){},emit(){}};let d=[];e instanceof NodeList||Array.isArray(e)?d=d.concat(Array.from(e)):d.push(e);let u=[];Array.isArray(n)?u=u.concat(n.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof n&&(u=u.concat(n.split(" ").filter(e=>""!==e)));let p=[];Array.isArray(o)?p=p.concat(o.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof o&&p.push(o);let h=i,m={capture:!1,once:!1,passive:!1,isComposedPath:!1,overrideTarget:!0};return"function"==typeof o?(h=o,m=s(f,3,m)):m=s(f,4,m),d.forEach(e=>{const n=t.isWin(e);u.forEach(t=>{const s=()=>{m.once&&this.off(e,t,o,i,r)},f=function(t){let o,i,r;m.isPreventEvent&&l.preventEvent(t);let c=!1;if(p.length){let s;if(m.isComposedPath){const e=t.composedPath();!e.length&&t.target&&e.push(t.target),s=e[0]}else s=t.target;const f=n?l.windowApi.document.documentElement:e;if(p.find(e=>{if(l.matches(s,e))return!0;const t=l.closest(s,e);return!(!t||!f?.contains?.(t))&&(s=t,!0)})){if(m.overrideTarget)try{const e=t.target;a.Object.defineProperties(t,{target:{get:()=>s},originTarget:{get:()=>e}})}catch{}c=!0,o=s,i=t,r=s}}else c=!0,o=e,i=t;if(c){const e=h.call(o,i,r);if(s(),"boolean"==typeof e&&!e)return!1}};e.addEventListener(t,f,m);const d=Reflect.get(e,c.domEventSymbol)||{};d[t]=d[t]||[],d[t].push({selector:p,option:m,handlerCallBack:f,callback:h}),Reflect.set(e,c.domEventSymbol,d)})}),{off:e=>{l.off(d,u,p,h,m,e)},emit:(e,t)=>{l.emit(d,u,e,t)}}}off(e,n,o,i,r,s){const l=function(e,t,n){const o=e[t];return"boolean"==typeof o?n.capture=o:o&&"object"==typeof o&&"capture"in o&&(n.capture=o.capture),n},a=arguments;if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let f=[];e instanceof NodeList||Array.isArray(e)?f=f.concat(Array.from(e)):f.push(e);let d=[];Array.isArray(n)?d=d.concat(n.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof n&&(d=d.concat(n.split(" ").filter(e=>""!==e)));let u=[];Array.isArray(o)?u=u.concat(o.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof o&&u.push(o);let p=i,h={capture:!1};"function"==typeof o?(p=o,h=l(a,3,h)):h=l(a,4,h),5===a.length&&"function"==typeof a[4]&&"function"!=typeof s&&(s=r),f.forEach(e=>{const o=Reflect.get(e,c.domEventSymbol)||{};d.forEach(i=>{const r=o[i]||[],l="function"==typeof s?r.filter(s):r;for(let t=0;t<l.length;t++){const n=l[t];let o=!0;if(o&&p&&n.callback!==p&&(o=!1),o&&u.length&&Array.isArray(n.selector)&&JSON.stringify(n.selector)!==JSON.stringify(u)&&(o=!1),o&&"boolean"==typeof n.option.capture&&h.capture!==n.option.capture&&(o=!1),o){e.removeEventListener(i,n.handlerCallBack,n.option);for(let e=r.length-1;e>=0;e--)r[e]===n&&r.splice(e,1)}}0===r.length&&(t.delete(o,n),0===Object.keys(o).length&&t.delete(e,c.domEventSymbol))}),Reflect.set(e,c.domEventSymbol,o)})}offAll(e,n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let o=[];e instanceof NodeList||Array.isArray(e)?o=o.concat(Array.from(e)):o.push(e);let i=[];Array.isArray(n)?i=i.concat(n):"string"==typeof n&&(i=i.concat(n.split(" "))),o.forEach(e=>{[...new Set([...Object.getOwnPropertySymbols(e),c.domEventSymbol])].forEach(n=>{if(!n.toString().startsWith("Symbol(events_"))return;const o=Reflect.get(e,n)||{};(i.length?i:Object.keys(o)).forEach(i=>{const r=o[i];if(!r)return;for(const t of r)e.removeEventListener(i,t.handlerCallBack,{capture:t.option.capture});const s=Reflect.get(e,n);t.delete(s,i),0===Object.keys(s).length&&t.delete(e,n)})})})}onReady(...e){const t=e[0];let n;const o=this,i=[{target:o.windowApi.document,eventType:"DOMContentLoaded",callback:()=>{r.completed()}},{target:o.windowApi.window,eventType:"load",callback:()=>{r.completed()}}],r={init(){if(0===e.length)return new Promise(e=>{n=e,r.check()});r.check()},check(){r.isReady()?setTimeout(()=>{r.completed()},0):r.onCompleted()},isReady(){try{return"complete"===o.windowApi.document.readyState||"loading"!==o.windowApi.document.readyState&&!o.windowApi.document.documentElement.doScroll}catch{return!1}},completed(){r.offCompleted(),"function"==typeof t&&t(),"function"==typeof n&&n()},onCompleted(){for(const e of i)o.on(e.target,e.eventType,e.callback)},offCompleted(){for(const e of i)o.off(e.target,e.eventType,e.callback)}};return r.init()}emit(e,t,n,o=!0){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let i=[];e instanceof NodeList||Array.isArray(e)?i=i.concat(Array.from(e)):i.push(e);const r=(e,t)=>{if(e instanceof Event&&"object"==typeof t&&null!=t&&!Array.isArray(t)){Object.keys(t).forEach(n=>{const o=Reflect.get(t,n);Reflect.set(e,n,o)})}};let s=[],l=null;Array.isArray(t)?s=t.filter(e=>"string"==typeof e&&""!==e.trim()):"string"==typeof t?s=t.split(" "):t instanceof Event&&(l=t,r(l,n)),i.forEach(e=>{const t=Reflect.get(e,c.domEventSymbol)||{},i=(n,i)=>{0==o&&i in t?t[i].forEach(e=>{e.handlerCallBack(n)}):e.dispatchEvent(n)};if(l){const e=l,t=e.type;i(e,t)}else s.forEach(e=>{const t=new Event(e);r(t,n),i(t,e)})})}click(e,n,o,i){const r=this;if("string"==typeof e&&(e=r.selectorAll(e)),null!=e)if(t.isNodeList(e))e.forEach(e=>{r.click(e,n,o,i)});else{if(null!=n){return r.on(e,"click",null,n)}r.emit(e,"click",o,i)}}blur(e,n,o,i){const r=this;if("string"==typeof e&&(e=r.selectorAll(e)),null!=e)if(t.isNodeList(e))e.forEach(e=>{r.focus(e,n,o,i)});else{if(null!==n){return r.on(e,"blur",null,n)}r.emit(e,"blur",o,i)}}focus(e,n,o,i){const r=this;if("string"==typeof e&&(e=r.selectorAll(e)),null!=e)if(t.isNodeList(e))e.forEach(e=>{r.focus(e,n,o,i)});else{if(null!=n){return r.on(e,"focus",null,n)}r.emit(e,"focus",o,i)}}onHover(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null==e)return;if(t.isNodeList(e)){const t=[];return e.forEach(e=>{const r=i.onHover(e,n,o);t.push(r)}),{off(){t.forEach(e=>{e&&e.off()})}}}const r=i.on(e,"mouseenter",null,n,o),s=i.on(e,"mouseleave",null,n,o);return{off(){r.off(),s.off()}}}onAnimationend(e,n,o){const i=this;if("string"==typeof e&&(e=i.selector(e)),null==e)return;const r={once:!0};Object.assign(r,o||{});const s=t.getAnimationEndNameList();return i.on(e,s,null,n,r),r.once?void 0:{off(){i.off(e,s,null,n,r)}}}onTransitionend(e,n,o){const i=this;if("string"==typeof e&&(e=i.selector(e)),null==e)return;const r={once:!0};Object.assign(r,o||{});const s=t.getTransitionEndNameList();return i.on(e,s,null,n,r),r.once?void 0:{off(){i.off(e,s,null,n,r)}}}onKeyup(e,n,o){const i=this;if(null!=e){if("string"==typeof e&&(e=i.selectorAll(e)),t.isNodeList(e)){const t=[];return e.forEach(e=>{const r=i.onKeyup(e,n,o);t.push(r)}),{off(){t.forEach(e=>{e&&e.off()})}}}return i.on(e,"keyup",null,n,o)}}onKeydown(e,n,o){const i=this;if(null!=e){if("string"==typeof e&&(e=i.selectorAll(e)),t.isNodeList(e)){const t=[];return e.forEach(e=>{const r=i.onKeydown(e,n,o);t.push(r)}),{off(){t.forEach(e=>{e&&e.off()})}}}return i.on(e,"keydown",null,n,o)}}onKeyboard(e,t="keydown",n,o){const i=this;"string"==typeof e&&(e=i.selectorAll(e));return i.on(e,t,function(e){const t=e.key||e.code,o=e.charCode||e.keyCode||e.which,i=[];e.ctrlKey&&i.push("ctrl"),e.altKey&&i.push("alt"),e.metaKey&&i.push("meta"),e.shiftKey&&i.push("shift"),"function"==typeof n&&n(t,o,i,e)},o)}onInput(e,t,n){let o=!1;const i=this.on(e,"input",async e=>{o||await t(e)},n),r=this.on(e,"compositionstart",()=>{o=!0},n),s=this.on(e,"compositionend",()=>{o=!1,this.emit(e,"input",{isComposite:o})},n);return{off(){i.off(),r.off(),s.off()},emit(e,t){i.emit(e,t)}}}onOneOrDouble(...e){const t=e[0];let n,o,i;if(2===e.length){if("function"!=typeof e[1])throw new TypeError("handler is not a function");o=e[1]}else if(3===e.length)"function"==typeof e[1]?(o=e[1],i=e[2]):(n=e[1],o=e[2]);else{if(4!==e.length)throw new Error("args length error");n=e[1],o=e[2],i=e[3]}let r,s=new WeakMap,l=!1,c="pointerup",a=200;"object"==typeof i&&null!=i&&(("string"==typeof i.eventType||Array.isArray(i.eventType))&&(c=i.eventType),"number"==typeof i.checkClickTime&&(a=i.checkClickTime));const f=(e,t,n)=>n?o(e,n,t):o(e,t),d=this.on(t,c,n,(e,t)=>{clearTimeout(r),r=void 0,l&&s.has(t)?(l=!1,s.delete(t),f(e,{isDouble:!0},t)):(r=setTimeout(()=>{l=!1,f(e,{isDouble:!1},t)},a),l=!0,s.set(t,e))},i);return{off(){d.off(),s=null},emit(e,t){f(e,t||{isDouble:!1})}}}preventEvent(...e){const t=(e,t)=>{if(e?.stopPropagation(),e?.stopImmediatePropagation(),"boolean"!=typeof t||!t)return e?.preventDefault(),!1};if(e[0]instanceof Event){const n=e[1];return t(e[0],n)}{const n=e[0];let o,i,r=e[1],s=!1,l=!1;if("string"==typeof r&&(r=[r]),2===e.length);else if("string"==typeof e[2]||Array.isArray(e[2]))o=e[2],"object"==typeof e[3]&&null!=e[3]&&(i=e[3]);else{if("object"!=typeof e[2]||null==e[2]||Array.isArray(e[2]))throw new TypeError("Invalid argument");i=e[2]}i&&(s=Boolean(i.capture),l=Boolean(i.onlyStopPropagation));return this.on(n,r,o,e=>t(e,l),{capture:s})}}}new f;class d extends f{windowApi;constructor(t){super(t),this.windowApi=new e(t)}getElementSelector(e){if(!e)return;if(!e.parentElement)return;if(e.id)return`#${e.id}`;let t=this.getElementSelector(e.parentElement);if(!t)return e.tagName.toLowerCase();if(e.parentElement.querySelectorAll(e.tagName).length>1){const n=Array.prototype.indexOf.call(e.parentElement.children,e)+1;t+=` > ${e.tagName.toLowerCase()}:nth-child(${n})`}else t+=` > ${e.tagName.toLowerCase()}`;return t}}new d;class u extends d{constructor(e){super(e)}version="2.0.8";noConflict(){return this.windowApi.window.DOMUtils&&t.delete(window,"DOMUtils"),this.windowApi.window.DOMUtils=this,this}attr(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null!=e)return t.isNodeList(e)?null==o?i.attr(e[0],n,o):void e.forEach(e=>{i.attr(e,n,o)}):null==o?e.getAttribute(n):void e.setAttribute(n,o)}createElement(e,t,n){const o=this,i=o.windowApi.document.createElement(e);return"string"==typeof t?(o.html(i,t),i):(null==t&&(t={}),null==n&&(n={}),Object.keys(t).forEach(e=>{const n=t[e];"innerHTML"!==e?i[e]=n:o.html(i,n)}),Object.keys(n).forEach(e=>{let t=n[e];"object"==typeof t?t=JSON.stringify(t):"function"==typeof t&&(t=t.toString()),i.setAttribute(e,t)}),i)}css(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null==e)return;if(t.isNodeList(e))return"string"==typeof n?null==o?i.css(e[0],n):void e.forEach(e=>{i.css(e,n)}):"object"==typeof n?void e.forEach(e=>{i.css(e,n)}):void 0;const r=(t,n)=>{"string"==typeof n&&n.trim().endsWith("!important")?(n=n.trim().replace(/!important$/gi,"").trim(),e.style.setProperty(t,n,"important")):(n=function(e,t){return"number"==typeof t&&(t=t.toString()),"string"==typeof t&&["width","height","top","left","right","bottom","font-size"].includes(e)&&t.match(/[0-9]$/gi)&&(t+="px"),t}(t,n),e.style.setProperty(t,n))};if("string"==typeof n){if(null==o)return i.windowApi.globalThis.getComputedStyle(e).getPropertyValue(n);r(n,o)}else{if("object"!=typeof n)throw new TypeError("property must be string or object");for(const e in n){r(e,n[e])}}}text(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return t.isNodeList(e)?null==n?o.text(e[0]):void e.forEach(e=>{o.text(e,n)}):null==n?e.textContent||e.innerText:(n instanceof Node&&(n=n.textContent||n.innerText),void("textContent"in e?e.textContent=n:"innerText"in e&&(e.innerText=n)))}html(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return t.isNodeList(e)?null==n?o.html(e[0]):void e.forEach(e=>{o.html(e,n)}):null==n?e.innerHTML:(n instanceof Element&&(n=n.innerHTML),void("innerHTML"in e&&t.setSafeHTML(e,n)))}getTransform(e,n=!1){const o=this;let i=0,r=0;if(!(n||!n&&t.isShow(e))){const{recovery:n}=t.forceShow(e),i=o.getTransform(e,!0);return n(),i}const s=o.windowApi.globalThis.getComputedStyle(e).transform;if(null!=s&&"none"!==s&&""!==s){const e=s.match(/\((.+)\)/)?.[1].split(",");e?(i=Math.abs(parseInt(e[4])),r=Math.abs(parseInt(e[5]))):(i=0,r=0)}return{transformLeft:i,transformTop:r}}val(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return t.isNodeList(e)?null==n?o.val(e[0]):void e.forEach(e=>{o.val(e,n)}):null==n?"input"!==e.localName||"checkbox"!==e.type&&"radio"!==e.type?e.value:e.checked:void("input"!==e.localName||"checkbox"!==e.type&&"radio"!==e.type?e.value=n:e.checked=!!n)}prop(e,n,o){const i=this;if("string"==typeof e&&(e=i.selectorAll(e)),null!=e)return t.isNodeList(e)?null==o?i.prop(e[0],n):void e.forEach(e=>{i.prop(e,n,o)}):null==o?Reflect.get(e,n):void(e instanceof Element&&"innerHTML"===n?i.html(e,o):Reflect.set(e,n,o))}removeAttr(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.removeAttr(e,n)}):e.removeAttribute(n))}removeClass(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.removeClass(e,n)}):null==n?e.className="":(Array.isArray(n)||(n=n.trim().split(" ")),n.forEach(t=>{e.classList.remove(t)})))}removeProp(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.removeProp(e,n)}):t.delete(e,n))}addClass(e,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{o.addClass(e,n)}):(Array.isArray(n)||(n=n.split(" ")),n.forEach(t=>{""!=t.trim()&&e.classList.add(t)})))}hasClass(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return!1;if(t.isNodeList(e)){let t=!0;for(let i=0;i<e.length;i++){const r=e[i];t=t&&o.hasClass(r,n)}return t}if(!e?.classList)return!1;Array.isArray(n)||(n=n.split(" "));for(let t=0;t<n.length;t++){const o=n[t].trim();if(!e.classList.contains(o))return!1}return!0}append(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.append(e,...n)});const o=(e,n)=>{e instanceof DocumentFragment?("string"==typeof n&&(n=this.toElement(n,!0,!1)),e.appendChild(n)):"string"==typeof n?e.insertAdjacentHTML("beforeend",t.createSafeHTML(n)):e.appendChild(n)},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}prepend(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.prepend(e,...n)});const o=(e,n)=>{if(e instanceof DocumentFragment)"string"==typeof n&&(n=this.toElement(n,!0,!1)),e.appendChild(n);else if("string"==typeof n)e.insertAdjacentHTML("afterbegin",t.createSafeHTML(n));else{const t=e.firstChild;t?e.insertBefore(n,t):e.prepend(n)}},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}after(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.after(e,...n)});const o=(n,o)=>{if(n instanceof DocumentFragment)"string"==typeof o&&(o=this.toElement(o,!0,!1)),n.appendChild(o);else if("string"==typeof o)n.insertAdjacentHTML("afterend",t.createSafeHTML(o));else{const t=e.parentElement,n=e.nextSibling;t&&n?t.insertBefore(o,n):e.after(o)}},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}before(e,...n){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{this.before(e,...n)});const o=(n,o)=>{if(n instanceof DocumentFragment)"string"==typeof o&&(o=this.toElement(o,!0,!1)),n.appendChild(o);else if("string"==typeof o)e.insertAdjacentHTML("beforebegin",t.createSafeHTML(o));else{const t=e.parentElement;t?t.insertBefore(o,e):e.before(o)}},i=this.windowApi.document.createDocumentFragment();n.forEach(e=>{t.isNodeList(e)?e.forEach(e=>{o(i,e)}):o(i,e)}),o(e,i)}remove(e){"string"==typeof e&&(e=this.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{this.remove(e)}):(e.querySelectorAll("*").forEach(e=>{e instanceof Element&&this.offAll(e)}),this.offAll(e),"function"==typeof e.remove?e.remove():e.parentElement?e.parentElement.removeChild(e):e.parentNode&&e.parentNode.removeChild(e)))}empty(e){const n=this;"string"==typeof e&&(e=n.selectorAll(e)),null!=e&&(t.isNodeList(e)?e.forEach(e=>{n.empty(e)}):e.innerHTML?t.setSafeHTML(e,""):e.textContent&&(e.textContent=""))}offset(e){const t=this;if("string"==typeof e&&(e=t.selector(e)),null==e)return;const n=e.getBoundingClientRect();return{top:n.top+t.windowApi.globalThis.scrollY,left:n.left+t.windowApi.globalThis.scrollX}}width(e,n=!1){const o=this;if("string"==typeof e&&(e=o.selector(e)),t.isWin(e))return o.windowApi.window.document.documentElement.clientWidth;if(9===e.nodeType)return Math.max(e.body.scrollWidth,e.documentElement.scrollWidth,e.body.offsetWidth,e.documentElement.offsetWidth,e.documentElement.clientWidth);if(n||!n&&t.isShow(e)){if(parseFloat(t.getStyleValue(e,"width").toString())>0)return parseFloat(t.getStyleValue(e,"width").toString());if(e.offsetWidth>0){const n=t.getStyleValue(e,"borderLeftWidth"),o=t.getStyleValue(e,"borderRightWidth"),i=t.getStyleValue(e,"paddingLeft"),r=t.getStyleValue(e,"paddingRight"),s=parseFloat(e.offsetWidth.toString())-parseFloat(n.toString())-parseFloat(o.toString())-parseFloat(i.toString())-parseFloat(r.toString());return parseFloat(s.toString())}return 0}{const{recovery:n}=t.forceShow(e),i=o.width(e,!0);return n(),i}}height(e,n=!1){const o=this;if(t.isWin(e))return o.windowApi.window.document.documentElement.clientHeight;if("string"==typeof e&&(e=o.selector(e)),9===e.nodeType)return Math.max(e.body.scrollHeight,e.documentElement.scrollHeight,e.body.offsetHeight,e.documentElement.offsetHeight,e.documentElement.clientHeight);if(n||!n&&t.isShow(e)){if(parseFloat(t.getStyleValue(e,"height").toString())>0)return parseFloat(t.getStyleValue(e,"height").toString());if(e.offsetHeight>0){const n=t.getStyleValue(e,"borderTopWidth"),o=t.getStyleValue(e,"borderBottomWidth"),i=t.getStyleValue(e,"paddingTop"),r=t.getStyleValue(e,"paddingBottom"),s=parseFloat(e.offsetHeight.toString())-parseFloat(n.toString())-parseFloat(o.toString())-parseFloat(i.toString())-parseFloat(r.toString());return parseFloat(s.toString())}return 0}{const{recovery:n}=t.forceShow(e),i=o.height(e,!0);return n(),i}}outerWidth(e,n=!1){const o=this;if(t.isWin(e))return o.windowApi.window.innerWidth;if("string"==typeof e&&(e=o.selector(e)),n||!n&&t.isShow(e)){const n=o.windowApi.globalThis.getComputedStyle(e,null),i=t.getStyleValue(n,"marginLeft"),r=t.getStyleValue(n,"marginRight");return e.offsetWidth+i+r}{const{recovery:n}=t.forceShow(e),i=o.outerWidth(e,!0);return n(),i}}outerHeight(e,n=!1){const o=this;if(t.isWin(e))return o.windowApi.window.innerHeight;if("string"==typeof e&&(e=o.selector(e)),n||!n&&t.isShow(e)){const n=o.windowApi.globalThis.getComputedStyle(e,null),i=t.getStyleValue(n,"marginTop"),r=t.getStyleValue(n,"marginBottom");return e.offsetHeight+i+r}{const{recovery:n}=t.forceShow(e),i=o.outerHeight(e,!0);return n(),i}}replaceWith(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{o.replaceWith(e,n)});"string"==typeof n&&(n=o.toElement(n,!1,!1));const i=e.parentElement;i?i.replaceChild(n,e):(o.after(e,n),this.remove(e))}wrap(e,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(t.isNodeList(e))return void e.forEach(e=>{o.wrap(e,n)});const i=o.windowApi.document.createElement("div");o.html(i,n);const r=i.firstChild;e.parentElement.insertBefore(r,e),r.appendChild(e)}prev(e){if("string"==typeof e&&(e=this.selector(e)),null!=e)return e.previousElementSibling}next(e){if("string"==typeof e&&(e=this.selector(e)),null!=e)return e.nextElementSibling}siblings(e){if("string"==typeof e&&(e=this.selector(e)),null!=e)return Array.from(e.parentElement.children).filter(t=>t!==e)}parent(e){const n=this;if("string"==typeof e&&(e=n.selector(e)),null!=e){if(t.isNodeList(e)){const t=[];return e.forEach(e=>{t.push(n.parent(e))}),t}return e.parentElement}}toElement(e,t=!1,n=!1){const o=this;return e=e.trim(),t?function(){const t=new DOMParser;return n?t.parseFromString(e,"text/html"):t.parseFromString(e,"text/html").body.firstChild}():function(){const t=o.windowApi.document.createElement("div");return o.html(t,e),n?t:t.firstElementChild??t.firstChild}()}toElements(e,t=!1){const n=this;return e=e.trim(),t?function(){const t=new DOMParser;return Array.from(t.parseFromString(e,"text/html").body.childNodes)}():function(){const t=n.windowApi.document.createElement("div");return n.html(t,e),Array.from(t.childNodes)}()}serialize(e){if(!(e instanceof HTMLFormElement))throw new TypeError("DOMUtils.serialize 参数必须是HTMLFormElement");const t=e.elements,n=[];for(let e=0;e<t.length;e++){const o=t[e];if(o.name&&!o.disabled&&(o.checked||["text","hidden","password","textarea","select-one","select-multiple"].includes(o.type)))if("select-multiple"===o.type)for(let e=0;e<o.options.length;e++)o.options[e].selected&&n.push({name:o.name,value:o.options[e].value});else n.push({name:o.name,value:o.value})}return n.map(e=>`${encodeURIComponent(e.name)}=${encodeURIComponent(e.value)}`).join("&")}createDOMUtils(e){return new u(e)}getTextBoundingRect(e,t,n){const o=this;if(!e||!("value"in e))return e;if(null==t&&(t=e.selectionStart||0),null==n&&(n=e.selectionEnd||0),"string"==typeof t&&(t=parseFloat(t)),("number"!=typeof t||isNaN(t))&&(t=0),t=t<0?0:Math.min(e.value.length,t),"string"==typeof n&&(n=parseFloat(n)),("number"!=typeof n||isNaN(n)||n<t)&&(n=t),n=n<0?0:Math.min(e.value.length,n),"function"==typeof e.createTextRange){const o=e.createTextRange();return o.collapse(!0),o.moveStart("character",t),o.moveEnd("character",n-t),o.getBoundingClientRect()}const i=function(){const t=o.windowApi.document.body,n=o.windowApi.document.defaultView,i=o.windowApi.document.documentElement,r=o.windowApi.document.createElement("div");r.style.paddingLeft=r.style.width="1px",t.appendChild(r);const s=2==r.offsetWidth;t.removeChild(r);const l=e.getBoundingClientRect(),c=i.clientTop||t.clientTop||0,a=i.clientLeft||t.clientLeft||0,f=n.pageYOffset||s&&i.scrollTop||t.scrollTop,d=n.pageXOffset||s&&i.scrollLeft||t.scrollLeft;return{top:l.top+f-c,left:l.left+d-a}}(),r=g("width",!0),s=g("height",!0);let l=i.top,c=i.left,a="white-space:pre;padding:0;margin:0;";const f=["direction","font-family","font-size","font-size-adjust","font-variant","font-weight","font-style","letter-spacing","line-height","text-align","text-indent","text-transform","word-wrap","word-spacing"];l+=g("padding-top",!0),l+=g("border-top-width",!0),c+=g("padding-left",!0),c+=g("border-left-width",!0),c+=1;for(let e=0;e<f.length;e++){const t=f[e];a+=t+":"+g(t,!1)+";"}const d=e.value||"G",u=d.length,p=o.windowApi.document.createElement("div");t>0&&y(0,t);const h=y(t,n);u>n&&y(n,u),p.style.cssText=a,p.style.position="absolute",p.style.top=l+"px",p.style.left=c+"px",p.style.width=r+"px",p.style.height=s+"px",o.windowApi.document.body.appendChild(p);const m=h.getBoundingClientRect();return p?.parentNode?.removeChild(p),m;function y(e,t){const n=o.windowApi.document.createElement("span");return n.style.cssText=a,n.textContent=d.substring(e,t),p.appendChild(n),n}function g(t,n){const i=o.windowApi.document.defaultView.getComputedStyle(e,null).getPropertyValue(t);return n?parseFloat(i):i}}addStyle(e){if("string"!=typeof e)throw new Error("DOMUtils.addStyle 参数cssText 必须为String类型");const t=this.createElement("style",{type:"text/css",innerHTML:e});return this.windowApi.document.head?this.windowApi.document.head.appendChild(t):0===this.windowApi.document.documentElement.childNodes.length?this.windowApi.document.documentElement.appendChild(t):this.windowApi.document.documentElement.insertBefore(t,this.windowApi.document.documentElement.childNodes[0]),t}checkUserClickInNode(e){if(!t.isDOM(e))throw new Error("DOMUtils.checkUserClickInNode 参数 targetNode 必须为 Element|Node 类型");const n=this.windowApi.window.event,o=this.windowApi.window.event,i=n?.composedPath()?.[0],r=null!=n?.clientX?n.clientX:o.touches[0].clientX,s=null!=n?.clientY?n.clientY:o.touches[0].clientY,{left:l,right:c,top:a,bottom:f}=e.getBoundingClientRect();return r>=l&&r<=c&&s>=a&&s<=f||!!(i&&e.contains(i)||i==e)}deleteParentNode(e,n){if(null==e)return;if(!t.isDOM(e))throw new Error("DOMUtils.deleteParentNode 参数 target 必须为 Node|HTMLElement 类型");if("string"!=typeof n)throw new Error("DOMUtils.deleteParentNode 参数 targetSelector 必须为 string 类型");let o=!1;const i=p.closest(e,n);return i&&(this.remove(i),o=!0),o}*findElementsWithText(e,t,n){const o=this;if(e.outerHTML.includes(t))if(0===e.children.length){"function"==typeof n&&n(e)||(yield e)}else{const o=Array.from(e.childNodes).filter(e=>e.nodeType===Node.TEXT_NODE);for(const i of o)if(i.textContent.includes(t)){"function"==typeof n&&n(e)||(yield i)}}for(let i=0;i<e.children.length;i++){const r=e.children[i];yield*o.findElementsWithText(r,t,n)}}findVisibleElement(e){let t=e;for(;t;){if(t.getBoundingClientRect().length)return t;t=t.parentElement}return null}setElementSelection(e,t,n,o){const i=this.windowApi.document.createRange();if(i.selectNodeContents(e),t){if(t.nodeType!==Node.TEXT_NODE)throw new TypeError("childTextNode必须是#text元素");null!=n&&null!=o&&(i.setStart(t,n),i.setEnd(t,o))}const r=this.windowApi.globalThis.getSelection();r&&(r.removeAllRanges(),r.addRange(i))}}const p=new u;return p}();
|
|
2
2
|
//# sourceMappingURL=index.iife.min.js.map
|