@whitesev/domutils 1.7.0 → 1.7.1

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.
@@ -1,2 +1,2 @@
1
- "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=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,n=536870912,o=1073741824,r=new WeakMap;var i;const s=((e,r)=>i=>{const s=r.get(i);let l=void 0===s?i.size:s<o?s+1:0;if(!i.has(l))return e(i,l);if(i.size<n){for(;i.has(l);)l=Math.floor(Math.random()*o);return e(i,l)}if(i.size>t)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;i.has(l);)l=Math.floor(Math.random()*t);return e(i,l)})((i=r,(e,t)=>(i.set(e,t),t)),r),l=new WeakMap,a=new WeakMap,c=new Map([[0,null]]),f=new Map([[0,null]]),d=(e=>{const t=(n=e,{...n,connect:({call:e})=>async()=>{const{port1:t,port2:n}=new MessageChannel,o=await e("connect",{port:t},[t]);return l.set(n,o),n},disconnect:({call:e})=>async t=>{const n=l.get(t);if(void 0===n)throw new Error("The given port is not connected.");await e("disconnect",{portId:n})},isSupported:({call:e})=>()=>e("isSupported")});var n;return e=>{const n=(e=>{if(a.has(e))return a.get(e);const t=new Map;return a.set(e,t),t})(e);e.addEventListener("message",({data:e})=>{const{id:t}=e;if(null!==t&&n.has(t)){const{reject:o,resolve:r}=n.get(t);n.delete(t),void 0===e.error?r(e.result):o(new Error(e.error.message))}}),(e=>"function"==typeof e.start)(e)&&e.start();const o=(t,o=null,r=[])=>new Promise((i,l)=>{const a=s(n);n.set(a,{reject:l,resolve:i}),null===o?e.postMessage({id:a,method:t},r):e.postMessage({id:a,method:t,params:o},r)}),r=(t,n,o=[])=>{e.postMessage({id:null,method:t,params:n},o)};let i={};for(const[e,n]of Object.entries(t))i={...i,[e]:n({call:o,notify:r})};return{...i}}})({clearInterval:({call:e})=>t=>{"symbol"==typeof c.get(t)&&(c.set(t,null),e("clear",{timerId:t,timerType:"interval"}).then(()=>{c.delete(t)}))},clearTimeout:({call:e})=>t=>{"symbol"==typeof f.get(t)&&(f.set(t,null),e("clear",{timerId:t,timerType:"timeout"}).then(()=>{f.delete(t)}))},setInterval:({call:e})=>(t,n=0,...o)=>{const r=Symbol(),i=s(c);c.set(i,r);const l=()=>e("set",{delay:n,now:performance.timeOrigin+performance.now(),timerId:i,timerType:"interval"}).then(()=>{const e=c.get(i);if(void 0===e)throw new Error("The timer is in an undefined state.");e===r&&(t(...o),c.get(i)===r&&l())});return l(),i},setTimeout:({call:e})=>(t,n=0,...o)=>{const r=Symbol(),i=s(f);return f.set(i,r),e("set",{delay:n,now:performance.timeOrigin+performance.now(),timerId:i,timerType:"timeout"}).then(()=>{const e=f.get(i);if(void 0===e)throw new Error("The timer is in an undefined state.");e===r&&(f.delete(i),t(...o))}),i}}),u=((e,t)=>{let n=null;return()=>{if(null!==n)return n;const o=new Blob([t],{type:"application/javascript; charset=utf-8"}),r=URL.createObjectURL(o);return n=e(r),setTimeout(()=>URL.revokeObjectURL(r)),n}})(e=>{const t=new Worker(e);return d(t)},'(()=>{var e={455:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),l=t(c);e.addUniqueNumber=l,e.generateUniqueNumber=c}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";const e=-32603,t=-32602,n=-32601,o=(e,t)=>Object.assign(new Error(e),{status:t}),s=t=>o(\'The handler of the method called "\'.concat(t,\'" returned an unexpected result.\'),e),a=(t,r)=>async({data:{id:a,method:i,params:u}})=>{const c=r[i];try{if(void 0===c)throw(e=>o(\'The requested method called "\'.concat(e,\'" is not supported.\'),n))(i);const r=void 0===u?c():c(u);if(void 0===r)throw(t=>o(\'The handler of the method called "\'.concat(t,\'" returned no required result.\'),e))(i);const l=r instanceof Promise?await r:r;if(null===a){if(void 0!==l.result)throw s(i)}else{if(void 0===l.result)throw s(i);const{result:e,transferables:r=[]}=l;t.postMessage({id:a,result:e},r)}}catch(e){const{message:r,status:n=-32603}=e;t.postMessage({error:{code:n,message:r},id:a})}};var i=r(455);const u=new Map,c=(e,r,n)=>({...r,connect:({port:t})=>{t.start();const n=e(t,r),o=(0,i.generateUniqueNumber)(u);return u.set(o,()=>{n(),t.close(),u.delete(o)}),{result:o}},disconnect:({portId:e})=>{const r=u.get(e);if(void 0===r)throw(e=>o(\'The specified parameter called "portId" with the given value "\'.concat(e,\'" does not identify a port connected to this worker.\'),t))(e);return r(),{result:null}},isSupported:async()=>{if(await new Promise(e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=({data:t})=>e(null!==t),n.postMessage(t,[t])})){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),l=(e,t,r=()=>!0)=>{const n=c(l,t,r),o=a(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},d=(e,t)=>r=>{const n=t.get(r);if(void 0===n)return Promise.resolve(!1);const[o,s]=n;return e(o),t.delete(r),s(!1),Promise.resolve(!0)},f=(e,t,r,n)=>(o,s,a)=>{const i=o+s-t.timeOrigin,u=i-t.now();return new Promise(t=>{e.set(a,[r(n,u,i,e,t,a),t])})},m=new Map,h=d(globalThis.clearTimeout,m),p=new Map,v=d(globalThis.clearTimeout,p),w=((e,t)=>{const r=(n,o,s,a)=>{const i=n-e.now();i>0?o.set(a,[t(r,i,n,o,s,a),s]):(o.delete(a),s(!0))};return r})(performance,globalThis.setTimeout),g=f(m,performance,globalThis.setTimeout,w),T=f(p,performance,globalThis.setTimeout,w);l(self,{clear:async({timerId:e,timerType:t})=>({result:await("interval"===t?h(e):v(e))}),set:async({delay:e,now:t,timerId:r,timerType:n})=>({result:await("interval"===n?g:T)(e,t,r)})})})()})();'),p={windowApi:new e({document:document,window:window,top:top,setTimeout:setTimeout,clearTimeout:clearTimeout,setInterval:setInterval,clearInterval:clearInterval}),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 r=parseFloat(o[t]);return isNaN(r)?0:r},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]},setTimeout(e,t=0){try{return((...e)=>u().setTimeout(...e))(e,t)}catch{return this.windowApi.setTimeout(e,t)}},clearTimeout(e){try{null!=e&&(t=e,u().clearTimeout(t))}catch{}finally{this.windowApi.clearTimeout(e)}var t},setInterval(e,t=0){try{return((...e)=>u().setInterval(...e))(e,t)}catch{return this.windowApi.setInterval(e,t)}},clearInterval(e){try{null!=e&&(t=e,u().clearInterval(t))}catch{}finally{this.windowApi.clearInterval(e)}var t},isNodeList:e=>Array.isArray(e)||e instanceof NodeList,getAnimationEndNameList:()=>["webkitAnimationEnd","mozAnimationEnd","MSAnimationEnd","oanimationend","animationend"],getTransitionEndNameList:()=>["webkitTransitionEnd","mozTransitionEnd","MSTransitionEnd","otransitionend","transitionend"]},h={domEventSymbol:Symbol("events_"+(65536*(1+Math.random())|0).toString(16).substring(1))};class m{windowApi;constructor(t){this.windowApi=new e(t)}selector(e,t){return this.selectorAll(e,t)[0]}selectorAll(e,t){if(t=t||this.windowApi.document,(e=e.trim()).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=>(e?.textContent||e?.innerText)?.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 r="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),r=o[3]);const i=new RegExp(n,r);return e=e.replace(/:regexp\(("|')(.*)("|')\)$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>Boolean((e?.textContent||e?.innerText)?.match(i)))}return Array.from(t.querySelectorAll(e))}matches(e,t){if(t=t.trim(),null==e)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||e?.innerText;return"string"!=typeof o&&(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 r="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),r=o[3]);const i=new RegExp(n,r);t=t.replace(/:regexp\(("|')(.*)("|')\)$/gi,"");let s=e?.textContent||e?.innerText;return"string"!=typeof s&&(s=""),e.matches(t)&&Boolean(s?.match(i))}return e.matches(t)}closest(e,t){if((t=t.trim()).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 r="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),r=o[3]);const i=new RegExp(n,r);t=t.replace(/:regexp\(("|')(.*)("|')\)$/gi,"");const s=e?.closest(t);if(s){const t=e?.textContent||e?.innerText;if("string"==typeof t&&t.match(i))return s}return null}{const n=e?.closest(t);return n}}}const g=new m,y=function(e){return e instanceof Node};const w=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","keypress","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","sort","splice","text","toArray","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;if(null==e&&(e={}),n)for(const r in t){const i=r,s=Reflect.get(e,i),l=Reflect.get(t,r);"object"!=typeof l||null==l||!(r in e)||y(l)?Reflect.set(e,r,l):Reflect.set(e,r,o.assign(s,l,n))}else for(const r in e)if(r in t){const i=Reflect.get(e,r),s=Reflect.get(t,r);if("object"==typeof s&&null!=s&&!y(s)&&Object.keys(s).length){Reflect.set(e,r,o.assign(i,s,n));continue}Reflect.set(e,r,s)}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 A extends m{windowApi;constructor(t){super(t),this.windowApi=new e(t)}wait(e,t,n){const o=this,r="number"==typeof t?t:0;return new Promise(t=>{const i=w.mutationObserver(n||o.windowApi.document,{config:{subtree:!0,childList:!0,attributes:!0},immediate:!0,callback(n,o){const r=e();r.success&&("function"==typeof o?.disconnect&&o.disconnect(),t(r.data))}});r>0&&p.setTimeout(()=>{"function"==typeof i?.disconnect&&i.disconnect(),t(null)},r)})}waitNode(...e){const t=(e=e.filter(e=>void 0!==e))[0];let n=this.windowApi.document,o=0;if("string"!=typeof e[0]&&!Array.isArray(e[0])&&"function"!=typeof e[0])throw new TypeError("Utils.waitNode 第一个参数必须是string|string[]|Function");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)o=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitNode 第二个参数必须是number|Node");n=t}}else{if(3!==e.length)throw new TypeError("Utils.waitNode 参数个数错误");{const t=e[1],r=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitNode 第二个参数必须是Node");if(n=t,"number"!=typeof r)throw new TypeError("Utils.waitNode 第三个参数必须是number");o=r}}return this.wait(()=>{const e=function(){if(!Array.isArray(t))return"function"==typeof t?t():g.selector(t,n);{const e=[];for(let n=0;n<t.length;n++){const o=g.selector(t[n]);o&&e.push(o)}if(e.length===t.length)return e}}();return e?{success:!0,data:e}:{success:!1,data:e}},o,n)}waitAnyNode(...e){e=e.filter(e=>void 0!==e);const t=this,n=e[0];let o=t.windowApi.document,r=0;if("object"!=typeof e[0]&&!Array.isArray(e[0]))throw new TypeError("Utils.waitAnyNode 第一个参数必须是string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)r=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitAnyNode 第二个参数必须是number|Node");o=t}}else{if(3!==e.length)throw new TypeError("Utils.waitAnyNode 参数个数错误");{const t=e[1],n=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitAnyNode 第二个参数必须是Node");if(o=t,"number"!=typeof n)throw new TypeError("Utils.waitAnyNode 第三个参数必须是number");r=n}}const i=n.map(e=>t.waitNode(e,o,r));return Promise.any(i)}waitNodeList(...e){const t=(e=e.filter(e=>void 0!==e))[0];let n=this.windowApi.document,o=0;if("string"!=typeof e[0]&&!Array.isArray(e[0]))throw new TypeError("Utils.waitNodeList 第一个参数必须是string|string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)o=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitNodeList 第二个参数必须是number|Node");n=t}}else{if(3!==e.length)throw new TypeError("Utils.waitNodeList 参数个数错误");{const t=e[1],r=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitNodeList 第二个参数必须是Node");if(n=t,"number"!=typeof r)throw new TypeError("Utils.waitNodeList 第三个参数必须是number");o=r}}return this.wait(()=>{const e=function(){if(Array.isArray(t)){const e=[];for(let o=0;o<t.length;o++){const r=g.selectorAll(t[o],n);r.length&&e.push(r)}if(e.length===t.length)return e}else{const e=g.selectorAll(t,n);if(e.length)return e}}();return e?{success:!0,data:e}:{success:!1,data:e}},o,n)}waitAnyNodeList(...e){e=e.filter(e=>void 0!==e);const t=this,n=e[0];let o=t.windowApi.document,r=0;if(!Array.isArray(e[0]))throw new TypeError("Utils.waitAnyNodeList 第一个参数必须是string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)r=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitAnyNodeList 第二个参数必须是number|Node");o=t}}else{if(3!==e.length)throw new TypeError("Utils.waitAnyNodeList 参数个数错误");{const t=e[1],n=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitAnyNodeList 第二个参数必须是Node");if(o=t,"number"!=typeof n)throw new TypeError("Utils.waitAnyNodeList 第三个参数必须是number");r=n}}const i=n.map(e=>t.waitNodeList(e,o,r));return Promise.any(i)}}new A;class b extends A{windowApi;constructor(t){super(t),this.windowApi=new e(t)}animate(e,t,n=1e3,o=null){const r=this;if("string"==typeof e&&(e=g.selectorAll(e)),null==e)return;if(p.isNodeList(e))return void e.forEach(e=>{r.animate(e,t,n,o)});if("number"!=typeof n||n<=0)throw new TypeError("duration must be a positive number");if("function"!=typeof o&&void 0!==o)throw new TypeError("callback must be a function or null");if("object"!=typeof t||void 0===t)throw new TypeError("styles must be an object");if(0===Object.keys(t).length)throw new Error("styles must contain at least one property");const i=performance.now(),s={},l={};for(const n in t)s[n]=e.style[n]||r.windowApi.globalThis.getComputedStyle(e)[n],l[n]=t[n];const a=p.setInterval(function(){let r=(performance.now()-i)/n;r>1&&(r=1);for(const n in t)e.style[n]=s[n]+(l[n]-s[n])*r+"px";1===r&&(p.clearInterval(a),o&&o())},10)}show(e,t=!0){const n=this;if(null!=e)if("string"==typeof e&&(e=g.selectorAll(e)),e instanceof NodeList||e instanceof Array)for(const o of e)n.show(o,t);else e.style.display="",t&&(p.isShow(e)||e.style.setProperty("display","unset","important"))}hide(e,t=!0){const n=this;if(null!=e)if("string"==typeof e&&(e=g.selectorAll(e)),e instanceof NodeList||e instanceof Array)for(const o of e)n.hide(o,t);else e.style.display="none",t&&p.isShow(e)&&e.style.setProperty("display","none","important")}fadeIn(e,t=400,n){if(null==e)return;const o=this;if("string"==typeof e&&(e=g.selectorAll(e)),p.isNodeList(e))return void e.forEach(e=>{o.fadeIn(e,t,n)});e.style.opacity="0",e.style.display="";let r=null,i=null;i=o.windowApi.window.requestAnimationFrame(function s(l){r||(r=l);const a=l-r;e.style.opacity=Math.min(a/t,1).toString(),a<t?o.windowApi.window.requestAnimationFrame(s):(n&&"function"==typeof n&&n(),o.windowApi.window.cancelAnimationFrame(i))})}fadeOut(e,t=400,n){const o=this;if(null==e)return;if("string"==typeof e&&(e=g.selectorAll(e)),p.isNodeList(e))return void e.forEach(e=>{o.fadeOut(e,t,n)});e.style.opacity="1";let r=null,i=null;i=o.windowApi.window.requestAnimationFrame(function s(l){r||(r=l);const a=l-r;e.style.opacity=Math.max(1-a/t,0).toString(),a<t?o.windowApi.window.requestAnimationFrame(s):(e.style.display="none","function"==typeof n&&n(),o.windowApi.window.cancelAnimationFrame(i))})}toggle(e,t){const n=this;"string"==typeof e&&(e=g.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{n.toggle(e)}):"none"===n.windowApi.globalThis.getComputedStyle(e).getPropertyValue("display")?n.show(e,t):n.hide(e,t))}}new b;const v={Object:{defineProperty:Object.defineProperty}};class E extends b{windowApi;constructor(t){super(t),this.windowApi=new e(t)}getAnimationEndNameList(){return p.getAnimationEndNameList()}getTransitionEndNameList(){return p.getTransitionEndNameList()}on(e,t,n,o,r){function i(e,t,n){const o=e[t];return"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])):"object"==typeof o&&("capture"in o||"once"in o||"passive"in o||"isComposedPath"in o)&&(n.capture=o.capture,n.once=o.once,n.passive=o.passive,n.isComposedPath=o.isComposedPath),n}const s=this,l=arguments;if("string"==typeof e&&(e=s.selectorAll(e)),null==e)return;let a=[];e instanceof NodeList||Array.isArray(e)?a=[...e]:a.push(e);let c=[];Array.isArray(t)?c=c.concat(t.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof t&&(c=c.concat(t.split(" ").filter(e=>""!==e)));let f=[];Array.isArray(n)?f=f.concat(n.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof n&&f.push(n);let d=o,u={capture:!1,once:!1,passive:!1,isComposedPath:!1};function m(){u.once&&s.off(e,t,n,o,r)}"function"==typeof n?(d=n,u=i(l,3,u)):u=i(l,4,u),a.forEach(e=>{function t(t){if(f.length){let n=u.isComposedPath?t.composedPath()[0]:t.target,o=e;p.isWin(o)&&o===s.windowApi.document&&(o=s.windowApi.document.documentElement);if(f.find(e=>{if(s.matches(n,e))return!0;const t=s.closest(n,e);return!(!t||!o?.contains(t))&&(n=t,!0)})){try{v.Object.defineProperty(t,"target",{get:()=>n})}catch{}d.call(n,t,n),m()}}else d.call(e,t),m()}c.forEach(n=>{e.addEventListener(n,t,u);const o=Reflect.get(e,h.domEventSymbol)||{};o[n]=o[n]||[],o[n].push({selector:f,option:u,callback:t,originCallBack:d}),Reflect.set(e,h.domEventSymbol,o)})})}off(e,t,n,o,r,i){function s(e,t,n){const o=e[t];return"boolean"==typeof o?n.capture=o:"object"==typeof o&&null!=o&&"capture"in o&&(n.capture=o.capture),n}const l=arguments;if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let a=[];e instanceof NodeList||Array.isArray(e)?a=[...e]:a.push(e);let c=[];Array.isArray(t)?c=c.concat(t.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof t&&(c=c.concat(t.split(" ").filter(e=>""!==e)));let f=[];Array.isArray(n)?f=f.concat(n.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof n&&f.push(n);let d=o,u={capture:!1};"function"==typeof n?(d=n,u=s(l,3,u)):u=s(l,4,u);let m=!1;(2===l.length||3===l.length&&"string"==typeof l[2]||Array.isArray(l[2]))&&(m=!0),5===l.length&&"function"==typeof l[4]&&"function"!=typeof i&&(i=r),a.forEach(e=>{const n=Reflect.get(e,h.domEventSymbol)||{};c.forEach(o=>{const r=n[o]||[],s="function"==typeof i?r.filter(i):r;for(let t=0;t<s.length;t++){const n=s[t];let i=!0;if(i&&d&&n.originCallBack!==d&&(i=!1),i&&f.length&&Array.isArray(n.selector)&&JSON.stringify(n.selector)!==JSON.stringify(f)&&(i=!1),i&&"boolean"==typeof n.option.capture&&u.capture!==n.option.capture&&(i=!1),i||m){e.removeEventListener(o,n.callback,n.option);const t=r.findIndex(e=>e===n);-1!==t&&r.splice(t,1)}}0===r.length&&p.delete(n,t)}),Reflect.set(e,h.domEventSymbol,n)})}offAll(e,t){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let n=[];e instanceof NodeList||Array.isArray(e)?n=[...e]:n.push(e);let o=[];Array.isArray(t)?o=o.concat(t):"string"==typeof t&&(o=o.concat(t.split(" "))),n.forEach(e=>{[...new Set([...Object.getOwnPropertySymbols(e),h.domEventSymbol])].forEach(t=>{if(!t.toString().startsWith("Symbol(events_"))return;const n=Reflect.get(e,t)||{};(o.length?o:Object.keys(n)).forEach(o=>{const r=n[o];if(!r)return;for(const t of r)e.removeEventListener(o,t.callback,{capture:t.option.capture});const i=Reflect.get(e,t);p.delete(i,o)})})})}ready(e){if("function"!=typeof e)return;const t=this;function n(){!function(){for(let e=0;e<o.length;e++){const t=o[e];t.target.removeEventListener(t.eventType,t.callback)}}(),e()}const o=[{target:t.windowApi.document,eventType:"DOMContentLoaded",callback:n},{target:t.windowApi.window,eventType:"load",callback:n}];!function(){try{return"complete"===t.windowApi.document.readyState||"loading"!==t.windowApi.document.readyState&&!t.windowApi.document.documentElement.doScroll}catch{return!1}}()?function(){for(let e=0;e<o.length;e++){const t=o[e];t.target.addEventListener(t.eventType,t.callback)}}():p.setTimeout(e)}trigger(e,t,n,o=!0){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let r=[];r=e instanceof NodeList||Array.isArray(e)?[...e]:[e];let i=[];Array.isArray(t)?i=t:"string"==typeof t&&(i=t.split(" ")),r.forEach(e=>{const t=Reflect.get(e,h.domEventSymbol)||{};i.forEach(r=>{let i=null;n&&n instanceof Event?i=n:(i=new Event(r),n&&Object.keys(n).forEach(e=>{const t=Reflect.get(n,e);Reflect.set(i,e,t)})),0==o&&r in t?t[r].forEach(e=>{e.callback(i)}):e.dispatchEvent(i)})})}click(e,t,n,o){const r=this;"string"==typeof e&&(e=r.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{r.click(e,t,n,o)}):null==t?r.trigger(e,"click",n,o):r.on(e,"click",null,t))}blur(e,t,n,o){const r=this;"string"==typeof e&&(e=r.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{r.focus(e,t,n,o)}):null===t?r.trigger(e,"blur",n,o):r.on(e,"blur",null,t))}focus(e,t,n,o){const r=this;"string"==typeof e&&(e=r.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{r.focus(e,t,n,o)}):null==t?r.trigger(e,"focus",n,o):r.on(e,"focus",null,t))}hover(e,t,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{o.hover(e,t,n)}):(o.on(e,"mouseenter",null,t,n),o.on(e,"mouseleave",null,t,n)))}animationend(e,t,n){const o=this;if("string"==typeof e&&(e=o.selector(e)),null==e)return;const r={once:!0};Object.assign(r,n||{});const i=p.getAnimationEndNameList();return o.on(e,i,null,t,r),r.once?void 0:{off(){o.off(e,i,null,t,r)}}}transitionend(e,t,n){const o=this;if("string"==typeof e&&(e=o.selector(e)),null==e)return;const r={once:!0};Object.assign(r,n||{});const i=p.getTransitionEndNameList();return o.on(e,i,null,t,r),r.once?void 0:{off(){o.off(e,i,null,t,r)}}}keyup(e,t,n){const o=this;null!=e&&("string"==typeof e&&(e=o.selectorAll(e)),p.isNodeList(e)?e.forEach(e=>{o.keyup(e,t,n)}):o.on(e,"keyup",null,t,n))}keydown(e,t,n){const o=this;null!=e&&("string"==typeof e&&(e=o.selectorAll(e)),p.isNodeList(e)?e.forEach(e=>{o.keydown(e,t,n)}):o.on(e,"keydown",null,t,n))}keypress(e,t,n){const o=this;null!=e&&("string"==typeof e&&(e=o.selectorAll(e)),p.isNodeList(e)?e.forEach(e=>{o.keypress(e,t,n)}):o.on(e,"keypress",null,t,n))}listenKeyboard(e,t="keypress",n,o){const r=this;"string"==typeof e&&(e=r.selectorAll(e));const i=function(e){const t=e.key||e.code,o=e.charCode||e.keyCode||e.which,r=[];e.ctrlKey&&r.push("ctrl"),e.altKey&&r.push("alt"),e.metaKey&&r.push("meta"),e.shiftKey&&r.push("shift"),"function"==typeof n&&n(t,o,r,e)};return r.on(e,t,i,o),{removeListen:()=>{r.off(e,t,i,o)}}}preventEvent(...e){const t=e=>(e?.preventDefault(),e?.stopPropagation(),e?.stopImmediatePropagation(),!1);if(1===e.length)return t(e[0]);{const n=e[0];let o=e[1];const r=e[2];"string"==typeof o&&(o=[o]),this.on(n,o,t,{capture:Boolean(r)})}}}new E;class T extends E{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 T;class N extends T{constructor(e){super(e)}version="1.7.0";noConflict(){return this.windowApi.window.DOMUtils&&p.delete(window,"DOMUtils"),this.windowApi.window.DOMUtils=this,this}attr(e,t,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return p.isNodeList(e)?null==n?o.attr(e[0],t,n):void e.forEach(e=>{o.attr(e,t,n)}):null==n?e.getAttribute(t):void e.setAttribute(t,n)}createElement(e,t,n){const o=this,r=o.windowApi.document.createElement(e);return"string"==typeof t?(o.html(r,t),r):(null==t&&(t={}),null==n&&(n={}),Object.keys(t).forEach(e=>{const n=t[e];"innerHTML"!==e?r[e]=n:o.html(r,n)}),Object.keys(n).forEach(e=>{let t=n[e];"object"==typeof t?t=JSON.stringify(t):"function"==typeof t&&(t=t.toString()),r.setAttribute(e,t)}),r)}css(e,t,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(p.isNodeList(e))return"string"==typeof t?null==n?o.css(e[0],t):void e.forEach(e=>{o.css(e,t)}):"object"==typeof t?void e.forEach(e=>{o.css(e,t)}):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 t){if(null==n)return o.windowApi.globalThis.getComputedStyle(e).getPropertyValue(t);r(t,n)}else{if("object"!=typeof t)throw new TypeError("property must be string or object");for(const e in t){r(e,t[e])}}}text(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)return p.isNodeList(e)?null==t?n.text(e[0]):void e.forEach(e=>{n.text(e,t)}):null==t?e.textContent||e.innerText:(t instanceof Node&&(t=t.textContent||t.innerText),void("textContent"in e?e.textContent=t:"innerText"in e&&(e.innerText=t)))}html(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)return p.isNodeList(e)?null==t?n.html(e[0]):void e.forEach(e=>{n.html(e,t)}):null==t?e.innerHTML:(t instanceof Element&&(t=t.innerHTML),void("innerHTML"in e&&p.setSafeHTML(e,t)))}getTransform(e,t=!1){const n=this;let o=0,r=0;if(!(t||!t&&p.isShow(e))){const{recovery:t}=p.forceShow(e),o=n.getTransform(e,!0);return t(),o}const i=n.windowApi.globalThis.getComputedStyle(e).transform;if(null!=i&&"none"!==i&&""!==i){const e=i.match(/\((.+)\)/)?.[1].split(",");e?(o=Math.abs(parseInt(e[4])),r=Math.abs(parseInt(e[5]))):(o=0,r=0)}return{transformLeft:o,transformTop:r}}val(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)return p.isNodeList(e)?null==t?n.val(e[0]):void e.forEach(e=>{n.val(e,t)}):null==t?"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=t:e.checked=!!t)}prop(e,t,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return p.isNodeList(e)?null==n?o.prop(e[0],t):void e.forEach(e=>{o.prop(e,t,n)}):null==n?Reflect.get(e,t):void(e instanceof Element&&"innerHTML"===t?o.html(e,n):Reflect.set(e,t,n))}removeAttr(e,t){const n=this;"string"==typeof e&&(e=n.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{n.removeAttr(e,t)}):e.removeAttribute(t))}removeClass(e,t){const n=this;"string"==typeof e&&(e=n.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{n.removeClass(e,t)}):null==t?e.className="":(Array.isArray(t)||(t=t.trim().split(" ")),t.forEach(t=>{e.classList.remove(t)})))}removeProp(e,t){const n=this;"string"==typeof e&&(e=n.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{n.removeProp(e,t)}):p.delete(e,t))}addClass(e,t){const n=this;"string"==typeof e&&(e=n.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{n.addClass(e,t)}):(Array.isArray(t)||(t=t.split(" ")),t.forEach(t=>{""!=t.trim()&&e.classList.add(t)})))}hasClass(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null==e)return!1;if(p.isNodeList(e)){let o=!0;for(let r=0;r<e.length;r++){const i=e[r];o=o&&n.hasClass(i,t)}return o}if(!e?.classList)return!1;Array.isArray(t)||(t=t.split(" "));for(let n=0;n<t.length;n++){const o=t[n].trim();if(!e.classList.contains(o))return!1}return!0}append(e,t){const n=this;var o,r;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)if(p.isNodeList(e))e.forEach(e=>{n.append(e,t)});else if(Array.isArray(t)||t instanceof NodeList){const o=n.windowApi.document.createDocumentFragment();t.forEach(e=>{"string"==typeof e&&(e=n.toElement(e,!0,!1)),o.appendChild(e)}),e.appendChild(o)}else o=e,r=t,"string"==typeof t?o instanceof DocumentFragment?("string"==typeof r&&(r=n.toElement(r,!0,!1)),o.appendChild(r)):o.insertAdjacentHTML("beforeend",p.createSafeHTML(r)):o.appendChild(r)}prepend(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)if(p.isNodeList(e))e.forEach(e=>{n.prepend(e,t)});else if("string"==typeof t)e instanceof DocumentFragment?(t=n.toElement(t,!0,!1),e.prepend(t)):e.insertAdjacentHTML("afterbegin",p.createSafeHTML(t));else{const n=e.firstChild;null==n?e.prepend(t):e.insertBefore(t,n)}}after(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)if(p.isNodeList(e))e.forEach(e=>{n.after(e,t)});else if("string"==typeof t)e.insertAdjacentHTML("afterend",p.createSafeHTML(t));else{const n=e.parentElement,o=e.nextSibling;!n||o?e.after(t):n.insertBefore(t,o)}}before(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)if(p.isNodeList(e))e.forEach(e=>{n.before(e,t)});else if("string"==typeof t)e.insertAdjacentHTML("beforebegin",p.createSafeHTML(t));else{const n=e.parentElement;n?n.insertBefore(t,e):e.before(t)}}remove(e){const t=this;"string"==typeof e&&(e=t.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{t.remove(e)}):"function"==typeof e.remove?e.remove():e.parentElement?e.parentElement.removeChild(e):e.parentNode&&e.parentNode.removeChild(e))}empty(e){const t=this;"string"==typeof e&&(e=t.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{t.empty(e)}):e.innerHTML?e.innerHTML="":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,t=!1){const n=this;if("string"==typeof e&&(e=n.selector(e)),p.isWin(e))return n.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(t||!t&&p.isShow(e)){if(parseFloat(p.getStyleValue(e,"width").toString())>0)return parseFloat(p.getStyleValue(e,"width").toString());if(e.offsetWidth>0){const t=p.getStyleValue(e,"borderLeftWidth"),n=p.getStyleValue(e,"borderRightWidth"),o=p.getStyleValue(e,"paddingLeft"),r=p.getStyleValue(e,"paddingRight"),i=parseFloat(e.offsetWidth.toString())-parseFloat(t.toString())-parseFloat(n.toString())-parseFloat(o.toString())-parseFloat(r.toString());return parseFloat(i.toString())}return 0}{const{recovery:t}=p.forceShow(e),o=n.width(e,!0);return t(),o}}height(e,t=!1){const n=this;if(p.isWin(e))return n.windowApi.window.document.documentElement.clientHeight;if("string"==typeof e&&(e=n.selector(e)),9===e.nodeType)return Math.max(e.body.scrollHeight,e.documentElement.scrollHeight,e.body.offsetHeight,e.documentElement.offsetHeight,e.documentElement.clientHeight);if(t||!t&&p.isShow(e)){if(parseFloat(p.getStyleValue(e,"height").toString())>0)return parseFloat(p.getStyleValue(e,"height").toString());if(e.offsetHeight>0){const t=p.getStyleValue(e,"borderTopWidth"),n=p.getStyleValue(e,"borderBottomWidth"),o=p.getStyleValue(e,"paddingTop"),r=p.getStyleValue(e,"paddingBottom"),i=parseFloat(e.offsetHeight.toString())-parseFloat(t.toString())-parseFloat(n.toString())-parseFloat(o.toString())-parseFloat(r.toString());return parseFloat(i.toString())}return 0}{const{recovery:t}=p.forceShow(e),o=n.height(e,!0);return t(),o}}outerWidth(e,t=!1){const n=this;if(p.isWin(e))return n.windowApi.window.innerWidth;if("string"==typeof e&&(e=n.selector(e)),t||!t&&p.isShow(e)){const t=n.windowApi.globalThis.getComputedStyle(e,null),o=p.getStyleValue(t,"marginLeft"),r=p.getStyleValue(t,"marginRight");return e.offsetWidth+o+r}{const{recovery:t}=p.forceShow(e),o=n.outerWidth(e,!0);return t(),o}}outerHeight(e,t=!1){const n=this;if(p.isWin(e))return n.windowApi.window.innerHeight;if("string"==typeof e&&(e=n.selector(e)),t||!t&&p.isShow(e)){const t=n.windowApi.globalThis.getComputedStyle(e,null),o=p.getStyleValue(t,"marginTop"),r=p.getStyleValue(t,"marginBottom");return e.offsetHeight+o+r}{const{recovery:t}=p.forceShow(e),o=n.outerHeight(e,!0);return t(),o}}replaceWith(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null==e)return;if(p.isNodeList(e))return void e.forEach(e=>{n.replaceWith(e,t)});"string"==typeof t&&(t=n.toElement(t,!1,!1));const o=e.parentElement;o?o.replaceChild(t,e):(n.after(e,t),e.remove())}wrap(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null==e)return;if(p.isNodeList(e))return void e.forEach(e=>{n.wrap(e,t)});const o=n.windowApi.document.createElement("div");n.html(o,t);const r=o.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 t=this;if("string"==typeof e&&(e=t.selector(e)),null!=e){if(p.isNodeList(e)){const n=[];return e.forEach(e=>{n.push(t.parent(e))}),n}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}()}serialize(e){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 N(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 r=function(){const t=o.windowApi.document.body,n=o.windowApi.document.defaultView,r=o.windowApi.document.documentElement,i=o.windowApi.document.createElement("div");i.style.paddingLeft=i.style.width="1px",t.appendChild(i);const s=2==i.offsetWidth;t.removeChild(i);const l=e.getBoundingClientRect(),a=r.clientTop||t.clientTop||0,c=r.clientLeft||t.clientLeft||0,f=n.pageYOffset||s&&r.scrollTop||t.scrollTop,d=n.pageXOffset||s&&r.scrollLeft||t.scrollLeft;return{top:l.top+f-a,left:l.left+d-c}}(),i=y("width",!0),s=y("height",!0);let l=r.top,a=r.left,c="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+=y("padding-top",!0),l+=y("border-top-width",!0),a+=y("padding-left",!0),a+=y("border-left-width",!0),a+=1;for(let e=0;e<f.length;e++){const t=f[e];c+=t+":"+y(t,!1)+";"}const d=e.value||"G",u=d.length,p=o.windowApi.document.createElement("div");t>0&&g(0,t);const h=g(t,n);u>n&&g(n,u),p.style.cssText=c,p.style.position="absolute",p.style.top=l+"px",p.style.left=a+"px",p.style.width=i+"px",p.style.height=s+"px",o.windowApi.document.body.appendChild(p);const m=h.getBoundingClientRect();return p?.parentNode?.removeChild(p),m;function g(e,t){const n=o.windowApi.document.createElement("span");return n.style.cssText=c,n.textContent=d.substring(e,t),p.appendChild(n),n}function y(t,n){const r=o.windowApi.document.defaultView.getComputedStyle(e,null).getPropertyValue(t);return n?parseFloat(r):r}}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(!p.isDOM(e))throw new Error("Utils.checkUserClickInNode 参数 targetNode 必须为 Element|Node 类型");const t=this.windowApi.window.event,n=this.windowApi.window.event,o=t?.composedPath()?.[0],r=null!=t?.clientX?t.clientX:n.touches[0].clientX,i=null!=t?.clientY?t.clientY:n.touches[0].clientY,{left:s,right:l,top:a,bottom:c}=e.getBoundingClientRect();return r>=s&&r<=l&&i>=a&&i<=c||!!(o&&e.contains(o)||o==e)}deleteParentNode(e,t){if(null==e)return;if(!p.isDOM(e))throw new Error("DOMUtils.deleteParentNode 参数 target 必须为 Node|HTMLElement 类型");if("string"!=typeof t)throw new Error("DOMUtils.deleteParentNode 参数 targetSelector 必须为 string 类型");let n=!1;const o=S.closest(e,t);return o&&(this.remove(o),n=!0),n}*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 r of o)if(r.textContent.includes(t)){"function"==typeof n&&n(e)||(yield r)}}for(let r=0;r<e.children.length;r++){const i=e.children[r];yield*o.findElementsWithText(i,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 r=this.windowApi.document.createRange();if(r.selectNodeContents(e),t){if(t.nodeType!==Node.TEXT_NODE)throw new TypeError("childTextNode必须是#text元素");null!=n&&null!=o&&(r.setStart(t,n),r.setEnd(t,o))}const i=this.windowApi.globalThis.getSelection();i&&(i.removeAllRanges(),i.addRange(r))}}const S=new N;module.exports=S;
1
+ "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=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,n=536870912,o=1073741824,r=new WeakMap;var i;const s=((e,r)=>i=>{const s=r.get(i);let l=void 0===s?i.size:s<o?s+1:0;if(!i.has(l))return e(i,l);if(i.size<n){for(;i.has(l);)l=Math.floor(Math.random()*o);return e(i,l)}if(i.size>t)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;i.has(l);)l=Math.floor(Math.random()*t);return e(i,l)})((i=r,(e,t)=>(i.set(e,t),t)),r),l=new WeakMap,a=new WeakMap,c=new Map([[0,null]]),f=new Map([[0,null]]),u=(e=>{const t=(n=e,{...n,connect:({call:e})=>async()=>{const{port1:t,port2:n}=new MessageChannel,o=await e("connect",{port:t},[t]);return l.set(n,o),n},disconnect:({call:e})=>async t=>{const n=l.get(t);if(void 0===n)throw new Error("The given port is not connected.");await e("disconnect",{portId:n})},isSupported:({call:e})=>()=>e("isSupported")});var n;return e=>{const n=(e=>{if(a.has(e))return a.get(e);const t=new Map;return a.set(e,t),t})(e);e.addEventListener("message",({data:e})=>{const{id:t}=e;if(null!==t&&n.has(t)){const{reject:o,resolve:r}=n.get(t);n.delete(t),void 0===e.error?r(e.result):o(new Error(e.error.message))}}),(e=>"function"==typeof e.start)(e)&&e.start();const o=(t,o=null,r=[])=>new Promise((i,l)=>{const a=s(n);n.set(a,{reject:l,resolve:i}),null===o?e.postMessage({id:a,method:t},r):e.postMessage({id:a,method:t,params:o},r)}),r=(t,n,o=[])=>{e.postMessage({id:null,method:t,params:n},o)};let i={};for(const[e,n]of Object.entries(t))i={...i,[e]:n({call:o,notify:r})};return{...i}}})({clearInterval:({call:e})=>t=>{"symbol"==typeof c.get(t)&&(c.set(t,null),e("clear",{timerId:t,timerType:"interval"}).then(()=>{c.delete(t)}))},clearTimeout:({call:e})=>t=>{"symbol"==typeof f.get(t)&&(f.set(t,null),e("clear",{timerId:t,timerType:"timeout"}).then(()=>{f.delete(t)}))},setInterval:({call:e})=>(t,n=0,...o)=>{const r=Symbol(),i=s(c);c.set(i,r);const l=()=>e("set",{delay:n,now:performance.timeOrigin+performance.now(),timerId:i,timerType:"interval"}).then(()=>{const e=c.get(i);if(void 0===e)throw new Error("The timer is in an undefined state.");e===r&&(t(...o),c.get(i)===r&&l())});return l(),i},setTimeout:({call:e})=>(t,n=0,...o)=>{const r=Symbol(),i=s(f);return f.set(i,r),e("set",{delay:n,now:performance.timeOrigin+performance.now(),timerId:i,timerType:"timeout"}).then(()=>{const e=f.get(i);if(void 0===e)throw new Error("The timer is in an undefined state.");e===r&&(f.delete(i),t(...o))}),i}}),d=((e,t)=>{let n=null;return()=>{if(null!==n)return n;const o=new Blob([t],{type:"application/javascript; charset=utf-8"}),r=URL.createObjectURL(o);return n=e(r),setTimeout(()=>URL.revokeObjectURL(r)),n}})(e=>{const t=new Worker(e);return u(t)},'(()=>{var e={455:function(e,t){!function(e){"use strict";var t=function(e){return function(t){var r=e(t);return t.add(r),r}},r=function(e){return function(t,r){return e.set(t,r),r}},n=void 0===Number.MAX_SAFE_INTEGER?9007199254740991:Number.MAX_SAFE_INTEGER,o=536870912,s=2*o,a=function(e,t){return function(r){var a=t.get(r),i=void 0===a?r.size:a<s?a+1:0;if(!r.has(i))return e(r,i);if(r.size<o){for(;r.has(i);)i=Math.floor(Math.random()*s);return e(r,i)}if(r.size>n)throw new Error("Congratulations, you created a collection of unique numbers which uses all available integers!");for(;r.has(i);)i=Math.floor(Math.random()*n);return e(r,i)}},i=new WeakMap,u=r(i),c=a(u,i),l=t(c);e.addUniqueNumber=l,e.generateUniqueNumber=c}(t)}},t={};function r(n){var o=t[n];if(void 0!==o)return o.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}(()=>{"use strict";const e=-32603,t=-32602,n=-32601,o=(e,t)=>Object.assign(new Error(e),{status:t}),s=t=>o(\'The handler of the method called "\'.concat(t,\'" returned an unexpected result.\'),e),a=(t,r)=>async({data:{id:a,method:i,params:u}})=>{const c=r[i];try{if(void 0===c)throw(e=>o(\'The requested method called "\'.concat(e,\'" is not supported.\'),n))(i);const r=void 0===u?c():c(u);if(void 0===r)throw(t=>o(\'The handler of the method called "\'.concat(t,\'" returned no required result.\'),e))(i);const l=r instanceof Promise?await r:r;if(null===a){if(void 0!==l.result)throw s(i)}else{if(void 0===l.result)throw s(i);const{result:e,transferables:r=[]}=l;t.postMessage({id:a,result:e},r)}}catch(e){const{message:r,status:n=-32603}=e;t.postMessage({error:{code:n,message:r},id:a})}};var i=r(455);const u=new Map,c=(e,r,n)=>({...r,connect:({port:t})=>{t.start();const n=e(t,r),o=(0,i.generateUniqueNumber)(u);return u.set(o,()=>{n(),t.close(),u.delete(o)}),{result:o}},disconnect:({portId:e})=>{const r=u.get(e);if(void 0===r)throw(e=>o(\'The specified parameter called "portId" with the given value "\'.concat(e,\'" does not identify a port connected to this worker.\'),t))(e);return r(),{result:null}},isSupported:async()=>{if(await new Promise(e=>{const t=new ArrayBuffer(0),{port1:r,port2:n}=new MessageChannel;r.onmessage=({data:t})=>e(null!==t),n.postMessage(t,[t])})){const e=n();return{result:e instanceof Promise?await e:e}}return{result:!1}}}),l=(e,t,r=()=>!0)=>{const n=c(l,t,r),o=a(e,n);return e.addEventListener("message",o),()=>e.removeEventListener("message",o)},d=(e,t)=>r=>{const n=t.get(r);if(void 0===n)return Promise.resolve(!1);const[o,s]=n;return e(o),t.delete(r),s(!1),Promise.resolve(!0)},f=(e,t,r,n)=>(o,s,a)=>{const i=o+s-t.timeOrigin,u=i-t.now();return new Promise(t=>{e.set(a,[r(n,u,i,e,t,a),t])})},m=new Map,h=d(globalThis.clearTimeout,m),p=new Map,v=d(globalThis.clearTimeout,p),w=((e,t)=>{const r=(n,o,s,a)=>{const i=n-e.now();i>0?o.set(a,[t(r,i,n,o,s,a),s]):(o.delete(a),s(!0))};return r})(performance,globalThis.setTimeout),g=f(m,performance,globalThis.setTimeout,w),T=f(p,performance,globalThis.setTimeout,w);l(self,{clear:async({timerId:e,timerType:t})=>({result:await("interval"===t?h(e):v(e))}),set:async({delay:e,now:t,timerId:r,timerType:n})=>({result:await("interval"===n?g:T)(e,t,r)})})})()})();'),p={windowApi:new e({document:document,window:window,top:top,setTimeout:setTimeout,clearTimeout:clearTimeout,setInterval:setInterval,clearInterval:clearInterval}),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 r=parseFloat(o[t]);return isNaN(r)?0:r},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]},setTimeout(e,t=0){try{return((...e)=>d().setTimeout(...e))(e,t)}catch{return this.windowApi.setTimeout(e,t)}},clearTimeout(e){try{null!=e&&(t=e,d().clearTimeout(t))}catch{}finally{this.windowApi.clearTimeout(e)}var t},setInterval(e,t=0){try{return((...e)=>d().setInterval(...e))(e,t)}catch{return this.windowApi.setInterval(e,t)}},clearInterval(e){try{null!=e&&(t=e,d().clearInterval(t))}catch{}finally{this.windowApi.clearInterval(e)}var t},isNodeList:e=>Array.isArray(e)||e instanceof NodeList,getAnimationEndNameList:()=>["webkitAnimationEnd","mozAnimationEnd","MSAnimationEnd","oanimationend","animationend"],getTransitionEndNameList:()=>["webkitTransitionEnd","mozTransitionEnd","MSTransitionEnd","otransitionend","transitionend"]},h={domEventSymbol:Symbol("events_"+(65536*(1+Math.random())|0).toString(16).substring(1))};class m{windowApi;constructor(t){this.windowApi=new e(t)}selector(e,t){return this.selectorAll(e,t)[0]}selectorAll(e,t){if(t=t||this.windowApi.document,(e=e.trim()).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=>(e?.textContent||e?.innerText)?.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 r="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),r=o[3]);const i=new RegExp(n,r);return e=e.replace(/:regexp\(("|')(.*)("|')\)$/gi,""),Array.from(t.querySelectorAll(e)).filter(e=>Boolean((e?.textContent||e?.innerText)?.match(i)))}return Array.from(t.querySelectorAll(e))}matches(e,t){if(t=t.trim(),null==e)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||e?.innerText;return"string"!=typeof o&&(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 r="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),r=o[3]);const i=new RegExp(n,r);t=t.replace(/:regexp\(("|')(.*)("|')\)$/gi,"");let s=e?.textContent||e?.innerText;return"string"!=typeof s&&(s=""),e.matches(t)&&Boolean(s?.match(i))}return e.matches(t)}closest(e,t){if((t=t.trim()).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 r="";o&&(n=n.replace(/("|'),[\s]*("|')([igm]{0,3})$/gi,""),r=o[3]);const i=new RegExp(n,r);t=t.replace(/:regexp\(("|')(.*)("|')\)$/gi,"");const s=e?.closest(t);if(s){const t=e?.textContent||e?.innerText;if("string"==typeof t&&t.match(i))return s}return null}{const n=e?.closest(t);return n}}}const g=new m,y=function(e){return e instanceof Node};const w=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","keypress","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","sort","splice","text","toArray","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;if(null==e&&(e={}),n)for(const r in t){const i=r,s=Reflect.get(e,i),l=Reflect.get(t,r);"object"!=typeof l||null==l||!(r in e)||y(l)?Reflect.set(e,r,l):Reflect.set(e,r,o.assign(s,l,n))}else for(const r in e)if(r in t){const i=Reflect.get(e,r),s=Reflect.get(t,r);if("object"==typeof s&&null!=s&&!y(s)&&Object.keys(s).length){Reflect.set(e,r,o.assign(i,s,n));continue}Reflect.set(e,r,s)}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 A extends m{windowApi;constructor(t){super(t),this.windowApi=new e(t)}wait(e,t,n){const o=this,r="number"==typeof t?t:0;return new Promise(t=>{const i=w.mutationObserver(n||o.windowApi.document,{config:{subtree:!0,childList:!0,attributes:!0},immediate:!0,callback(n,o){const r=e();r.success&&("function"==typeof o?.disconnect&&o.disconnect(),t(r.data))}});r>0&&p.setTimeout(()=>{"function"==typeof i?.disconnect&&i.disconnect(),t(null)},r)})}waitNode(...e){const t=(e=e.filter(e=>void 0!==e))[0];let n=this.windowApi.document,o=0;if("string"!=typeof e[0]&&!Array.isArray(e[0])&&"function"!=typeof e[0])throw new TypeError("Utils.waitNode 第一个参数必须是string|string[]|Function");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)o=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitNode 第二个参数必须是number|Node");n=t}}else{if(3!==e.length)throw new TypeError("Utils.waitNode 参数个数错误");{const t=e[1],r=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitNode 第二个参数必须是Node");if(n=t,"number"!=typeof r)throw new TypeError("Utils.waitNode 第三个参数必须是number");o=r}}return this.wait(()=>{const e=function(){if(!Array.isArray(t))return"function"==typeof t?t():g.selector(t,n);{const e=[];for(let n=0;n<t.length;n++){const o=g.selector(t[n]);o&&e.push(o)}if(e.length===t.length)return e}}();return e?{success:!0,data:e}:{success:!1,data:e}},o,n)}waitAnyNode(...e){e=e.filter(e=>void 0!==e);const t=this,n=e[0];let o=t.windowApi.document,r=0;if("object"!=typeof e[0]&&!Array.isArray(e[0]))throw new TypeError("Utils.waitAnyNode 第一个参数必须是string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)r=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitAnyNode 第二个参数必须是number|Node");o=t}}else{if(3!==e.length)throw new TypeError("Utils.waitAnyNode 参数个数错误");{const t=e[1],n=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitAnyNode 第二个参数必须是Node");if(o=t,"number"!=typeof n)throw new TypeError("Utils.waitAnyNode 第三个参数必须是number");r=n}}const i=n.map(e=>t.waitNode(e,o,r));return Promise.any(i)}waitNodeList(...e){const t=(e=e.filter(e=>void 0!==e))[0];let n=this.windowApi.document,o=0;if("string"!=typeof e[0]&&!Array.isArray(e[0]))throw new TypeError("Utils.waitNodeList 第一个参数必须是string|string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)o=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitNodeList 第二个参数必须是number|Node");n=t}}else{if(3!==e.length)throw new TypeError("Utils.waitNodeList 参数个数错误");{const t=e[1],r=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitNodeList 第二个参数必须是Node");if(n=t,"number"!=typeof r)throw new TypeError("Utils.waitNodeList 第三个参数必须是number");o=r}}return this.wait(()=>{const e=function(){if(Array.isArray(t)){const e=[];for(let o=0;o<t.length;o++){const r=g.selectorAll(t[o],n);r.length&&e.push(r)}if(e.length===t.length)return e}else{const e=g.selectorAll(t,n);if(e.length)return e}}();return e?{success:!0,data:e}:{success:!1,data:e}},o,n)}waitAnyNodeList(...e){e=e.filter(e=>void 0!==e);const t=this,n=e[0];let o=t.windowApi.document,r=0;if(!Array.isArray(e[0]))throw new TypeError("Utils.waitAnyNodeList 第一个参数必须是string[]");if(1===e.length);else if(2===e.length){const t=e[1];if("number"==typeof t)r=t;else{if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitAnyNodeList 第二个参数必须是number|Node");o=t}}else{if(3!==e.length)throw new TypeError("Utils.waitAnyNodeList 参数个数错误");{const t=e[1],n=e[2];if(!("object"==typeof t&&t instanceof Node))throw new TypeError("Utils.waitAnyNodeList 第二个参数必须是Node");if(o=t,"number"!=typeof n)throw new TypeError("Utils.waitAnyNodeList 第三个参数必须是number");r=n}}const i=n.map(e=>t.waitNodeList(e,o,r));return Promise.any(i)}}new A;class b extends A{windowApi;constructor(t){super(t),this.windowApi=new e(t)}animate(e,t,n=1e3,o=null){const r=this;if("string"==typeof e&&(e=g.selectorAll(e)),null==e)return;if(p.isNodeList(e))return void e.forEach(e=>{r.animate(e,t,n,o)});if("number"!=typeof n||n<=0)throw new TypeError("duration must be a positive number");if("function"!=typeof o&&void 0!==o)throw new TypeError("callback must be a function or null");if("object"!=typeof t||void 0===t)throw new TypeError("styles must be an object");if(0===Object.keys(t).length)throw new Error("styles must contain at least one property");const i=performance.now(),s={},l={};for(const n in t)s[n]=e.style[n]||r.windowApi.globalThis.getComputedStyle(e)[n],l[n]=t[n];const a=p.setInterval(function(){let r=(performance.now()-i)/n;r>1&&(r=1);for(const n in t)e.style[n]=s[n]+(l[n]-s[n])*r+"px";1===r&&(p.clearInterval(a),o&&o())},10)}show(e,t=!0){const n=this;if(null!=e)if("string"==typeof e&&(e=g.selectorAll(e)),e instanceof NodeList||e instanceof Array)for(const o of e)n.show(o,t);else e.style.display="",t&&(p.isShow(e)||e.style.setProperty("display","unset","important"))}hide(e,t=!0){const n=this;if(null!=e)if("string"==typeof e&&(e=g.selectorAll(e)),e instanceof NodeList||e instanceof Array)for(const o of e)n.hide(o,t);else e.style.display="none",t&&p.isShow(e)&&e.style.setProperty("display","none","important")}fadeIn(e,t=400,n){if(null==e)return;const o=this;if("string"==typeof e&&(e=g.selectorAll(e)),p.isNodeList(e))return void e.forEach(e=>{o.fadeIn(e,t,n)});e.style.opacity="0",e.style.display="";let r=null,i=null;i=o.windowApi.window.requestAnimationFrame(function s(l){r||(r=l);const a=l-r;e.style.opacity=Math.min(a/t,1).toString(),a<t?o.windowApi.window.requestAnimationFrame(s):(n&&"function"==typeof n&&n(),o.windowApi.window.cancelAnimationFrame(i))})}fadeOut(e,t=400,n){const o=this;if(null==e)return;if("string"==typeof e&&(e=g.selectorAll(e)),p.isNodeList(e))return void e.forEach(e=>{o.fadeOut(e,t,n)});e.style.opacity="1";let r=null,i=null;i=o.windowApi.window.requestAnimationFrame(function s(l){r||(r=l);const a=l-r;e.style.opacity=Math.max(1-a/t,0).toString(),a<t?o.windowApi.window.requestAnimationFrame(s):(e.style.display="none","function"==typeof n&&n(),o.windowApi.window.cancelAnimationFrame(i))})}toggle(e,t){const n=this;"string"==typeof e&&(e=g.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{n.toggle(e)}):"none"===n.windowApi.globalThis.getComputedStyle(e).getPropertyValue("display")?n.show(e,t):n.hide(e,t))}}new b;const v={Object:{defineProperty:Object.defineProperty}};class E extends b{windowApi;constructor(t){super(t),this.windowApi=new e(t)}getAnimationEndNameList(){return p.getAnimationEndNameList()}getTransitionEndNameList(){return p.getTransitionEndNameList()}on(e,t,n,o,r){function i(e,t,n){const o=e[t];return"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])):"object"==typeof o&&("capture"in o||"once"in o||"passive"in o||"isComposedPath"in o)&&(n.capture=o.capture,n.once=o.once,n.passive=o.passive,n.isComposedPath=o.isComposedPath),n}const s=this,l=arguments;if("string"==typeof e&&(e=s.selectorAll(e)),null==e)return{off(){},trigger(){}};let a=[];e instanceof NodeList||Array.isArray(e)?a=a.concat(Array.from(e)):a.push(e);let c=[];Array.isArray(t)?c=c.concat(t.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof t&&(c=c.concat(t.split(" ").filter(e=>""!==e)));let f=[];Array.isArray(n)?f=f.concat(n.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof n&&f.push(n);let u=o,d={capture:!1,once:!1,passive:!1,isComposedPath:!1};function m(){d.once&&s.off(e,t,n,o,r)}return"function"==typeof n?(u=n,d=i(l,3,d)):d=i(l,4,d),a.forEach(e=>{function t(t){if(f.length){let n=d.isComposedPath?t.composedPath()[0]:t.target,o=e;p.isWin(o)&&o===s.windowApi.document&&(o=s.windowApi.document.documentElement);if(f.find(e=>{if(s.matches(n,e))return!0;const t=s.closest(n,e);return!(!t||!o?.contains?.(t))&&(n=t,!0)})){try{v.Object.defineProperty(t,"target",{get:()=>n})}catch{}u.call(n,t,n),m()}}else u.call(e,t),m()}c.forEach(n=>{e.addEventListener(n,t,d);const o=Reflect.get(e,h.domEventSymbol)||{};o[n]=o[n]||[],o[n].push({selector:f,option:d,callback:t,originCallBack:u}),Reflect.set(e,h.domEventSymbol,o)})}),{off(e){s.off(a,c,f,u,d,e)},trigger(e,t){s.trigger(a,c,e,t)}}}off(e,t,n,o,r,i){function s(e,t,n){const o=e[t];return"boolean"==typeof o?n.capture=o:"object"==typeof o&&null!=o&&"capture"in o&&(n.capture=o.capture),n}const l=arguments;if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let a=[];e instanceof NodeList||Array.isArray(e)?a=a.concat(Array.from(e)):a.push(e);let c=[];Array.isArray(t)?c=c.concat(t.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof t&&(c=c.concat(t.split(" ").filter(e=>""!==e)));let f=[];Array.isArray(n)?f=f.concat(n.filter(e=>"string"==typeof e&&""!==e.toString())):"string"==typeof n&&f.push(n);let u=o,d={capture:!1};"function"==typeof n?(u=n,d=s(l,3,d)):d=s(l,4,d);let m=!1;(2===l.length||3===l.length&&"string"==typeof l[2]||Array.isArray(l[2]))&&(m=!0),5===l.length&&"function"==typeof l[4]&&"function"!=typeof i&&(i=r),a.forEach(e=>{const n=Reflect.get(e,h.domEventSymbol)||{};c.forEach(o=>{const r=n[o]||[],s="function"==typeof i?r.filter(i):r;for(let t=0;t<s.length;t++){const n=s[t];let i=!0;if(i&&u&&n.originCallBack!==u&&(i=!1),i&&f.length&&Array.isArray(n.selector)&&JSON.stringify(n.selector)!==JSON.stringify(f)&&(i=!1),i&&"boolean"==typeof n.option.capture&&d.capture!==n.option.capture&&(i=!1),i||m){e.removeEventListener(o,n.callback,n.option);const t=r.findIndex(e=>e===n);-1!==t&&r.splice(t,1)}}0===r.length&&p.delete(n,t)}),Reflect.set(e,h.domEventSymbol,n)})}offAll(e,t){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let n=[];e instanceof NodeList||Array.isArray(e)?n=n.concat(Array.from(e)):n.push(e);let o=[];Array.isArray(t)?o=o.concat(t):"string"==typeof t&&(o=o.concat(t.split(" "))),n.forEach(e=>{[...new Set([...Object.getOwnPropertySymbols(e),h.domEventSymbol])].forEach(t=>{if(!t.toString().startsWith("Symbol(events_"))return;const n=Reflect.get(e,t)||{};(o.length?o:Object.keys(n)).forEach(o=>{const r=n[o];if(!r)return;for(const t of r)e.removeEventListener(o,t.callback,{capture:t.option.capture});const i=Reflect.get(e,t);p.delete(i,o)})})})}ready(e){if("function"!=typeof e)return;const t=this;function n(){!function(){for(let e=0;e<o.length;e++){const t=o[e];t.target.removeEventListener(t.eventType,t.callback)}}(),e()}const o=[{target:t.windowApi.document,eventType:"DOMContentLoaded",callback:n},{target:t.windowApi.window,eventType:"load",callback:n}];!function(){try{return"complete"===t.windowApi.document.readyState||"loading"!==t.windowApi.document.readyState&&!t.windowApi.document.documentElement.doScroll}catch{return!1}}()?function(){for(let e=0;e<o.length;e++){const t=o[e];t.target.addEventListener(t.eventType,t.callback)}}():p.setTimeout(e,0)}trigger(e,t,n,o=!0){if("string"==typeof e&&(e=this.selectorAll(e)),null==e)return;let r=[];e instanceof NodeList||Array.isArray(e)?r=r.concat(Array.from(e)):r.push(e);let i=[];Array.isArray(t)?i=t.filter(e=>"string"==typeof e&&""!==e.trim()):"string"==typeof t&&(i=t.split(" ")),r.forEach(e=>{const t=Reflect.get(e,h.domEventSymbol)||{};i.forEach(r=>{let i=null;if(n&&n instanceof Event)i=n;else if(i=new Event(r),n){Object.keys(n).forEach(e=>{const t=Reflect.get(n,e);Reflect.set(i,e,t)})}0==o&&r in t?t[r].forEach(e=>{e.callback(i)}):e.dispatchEvent(i)})})}click(e,t,n,o){const r=this;"string"==typeof e&&(e=r.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{r.click(e,t,n,o)}):null==t?r.trigger(e,"click",n,o):r.on(e,"click",null,t))}blur(e,t,n,o){const r=this;"string"==typeof e&&(e=r.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{r.focus(e,t,n,o)}):null===t?r.trigger(e,"blur",n,o):r.on(e,"blur",null,t))}focus(e,t,n,o){const r=this;"string"==typeof e&&(e=r.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{r.focus(e,t,n,o)}):null==t?r.trigger(e,"focus",n,o):r.on(e,"focus",null,t))}hover(e,t,n){const o=this;"string"==typeof e&&(e=o.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{o.hover(e,t,n)}):(o.on(e,"mouseenter",null,t,n),o.on(e,"mouseleave",null,t,n)))}animationend(e,t,n){const o=this;if("string"==typeof e&&(e=o.selector(e)),null==e)return;const r={once:!0};Object.assign(r,n||{});const i=p.getAnimationEndNameList();return o.on(e,i,null,t,r),r.once?void 0:{off(){o.off(e,i,null,t,r)}}}transitionend(e,t,n){const o=this;if("string"==typeof e&&(e=o.selector(e)),null==e)return;const r={once:!0};Object.assign(r,n||{});const i=p.getTransitionEndNameList();return o.on(e,i,null,t,r),r.once?void 0:{off(){o.off(e,i,null,t,r)}}}keyup(e,t,n){const o=this;null!=e&&("string"==typeof e&&(e=o.selectorAll(e)),p.isNodeList(e)?e.forEach(e=>{o.keyup(e,t,n)}):o.on(e,"keyup",null,t,n))}keydown(e,t,n){const o=this;null!=e&&("string"==typeof e&&(e=o.selectorAll(e)),p.isNodeList(e)?e.forEach(e=>{o.keydown(e,t,n)}):o.on(e,"keydown",null,t,n))}keypress(e,t,n){const o=this;null!=e&&("string"==typeof e&&(e=o.selectorAll(e)),p.isNodeList(e)?e.forEach(e=>{o.keypress(e,t,n)}):o.on(e,"keypress",null,t,n))}listenKeyboard(e,t="keypress",n,o){const r=this;"string"==typeof e&&(e=r.selectorAll(e));const i=function(e){const t=e.key||e.code,o=e.charCode||e.keyCode||e.which,r=[];e.ctrlKey&&r.push("ctrl"),e.altKey&&r.push("alt"),e.metaKey&&r.push("meta"),e.shiftKey&&r.push("shift"),"function"==typeof n&&n(t,o,r,e)};return r.on(e,t,i,o),{removeListen:()=>{r.off(e,t,i,o)}}}preventEvent(...e){const t=e=>(e?.preventDefault(),e?.stopPropagation(),e?.stopImmediatePropagation(),!1);if(1===e.length)return t(e[0]);{const n=e[0];let o=e[1];const r=e[2];"string"==typeof o&&(o=[o]),this.on(n,o,t,{capture:Boolean(r)})}}}new E;class T extends E{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 T;class N extends T{constructor(e){super(e)}version="1.7.1";noConflict(){return this.windowApi.window.DOMUtils&&p.delete(window,"DOMUtils"),this.windowApi.window.DOMUtils=this,this}attr(e,t,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return p.isNodeList(e)?null==n?o.attr(e[0],t,n):void e.forEach(e=>{o.attr(e,t,n)}):null==n?e.getAttribute(t):void e.setAttribute(t,n)}createElement(e,t,n){const o=this,r=o.windowApi.document.createElement(e);return"string"==typeof t?(o.html(r,t),r):(null==t&&(t={}),null==n&&(n={}),Object.keys(t).forEach(e=>{const n=t[e];"innerHTML"!==e?r[e]=n:o.html(r,n)}),Object.keys(n).forEach(e=>{let t=n[e];"object"==typeof t?t=JSON.stringify(t):"function"==typeof t&&(t=t.toString()),r.setAttribute(e,t)}),r)}css(e,t,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null==e)return;if(p.isNodeList(e))return"string"==typeof t?null==n?o.css(e[0],t):void e.forEach(e=>{o.css(e,t)}):"object"==typeof t?void e.forEach(e=>{o.css(e,t)}):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 t){if(null==n)return o.windowApi.globalThis.getComputedStyle(e).getPropertyValue(t);r(t,n)}else{if("object"!=typeof t)throw new TypeError("property must be string or object");for(const e in t){r(e,t[e])}}}text(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)return p.isNodeList(e)?null==t?n.text(e[0]):void e.forEach(e=>{n.text(e,t)}):null==t?e.textContent||e.innerText:(t instanceof Node&&(t=t.textContent||t.innerText),void("textContent"in e?e.textContent=t:"innerText"in e&&(e.innerText=t)))}html(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)return p.isNodeList(e)?null==t?n.html(e[0]):void e.forEach(e=>{n.html(e,t)}):null==t?e.innerHTML:(t instanceof Element&&(t=t.innerHTML),void("innerHTML"in e&&p.setSafeHTML(e,t)))}getTransform(e,t=!1){const n=this;let o=0,r=0;if(!(t||!t&&p.isShow(e))){const{recovery:t}=p.forceShow(e),o=n.getTransform(e,!0);return t(),o}const i=n.windowApi.globalThis.getComputedStyle(e).transform;if(null!=i&&"none"!==i&&""!==i){const e=i.match(/\((.+)\)/)?.[1].split(",");e?(o=Math.abs(parseInt(e[4])),r=Math.abs(parseInt(e[5]))):(o=0,r=0)}return{transformLeft:o,transformTop:r}}val(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)return p.isNodeList(e)?null==t?n.val(e[0]):void e.forEach(e=>{n.val(e,t)}):null==t?"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=t:e.checked=!!t)}prop(e,t,n){const o=this;if("string"==typeof e&&(e=o.selectorAll(e)),null!=e)return p.isNodeList(e)?null==n?o.prop(e[0],t):void e.forEach(e=>{o.prop(e,t,n)}):null==n?Reflect.get(e,t):void(e instanceof Element&&"innerHTML"===t?o.html(e,n):Reflect.set(e,t,n))}removeAttr(e,t){const n=this;"string"==typeof e&&(e=n.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{n.removeAttr(e,t)}):e.removeAttribute(t))}removeClass(e,t){const n=this;"string"==typeof e&&(e=n.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{n.removeClass(e,t)}):null==t?e.className="":(Array.isArray(t)||(t=t.trim().split(" ")),t.forEach(t=>{e.classList.remove(t)})))}removeProp(e,t){const n=this;"string"==typeof e&&(e=n.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{n.removeProp(e,t)}):p.delete(e,t))}addClass(e,t){const n=this;"string"==typeof e&&(e=n.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{n.addClass(e,t)}):(Array.isArray(t)||(t=t.split(" ")),t.forEach(t=>{""!=t.trim()&&e.classList.add(t)})))}hasClass(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null==e)return!1;if(p.isNodeList(e)){let o=!0;for(let r=0;r<e.length;r++){const i=e[r];o=o&&n.hasClass(i,t)}return o}if(!e?.classList)return!1;Array.isArray(t)||(t=t.split(" "));for(let n=0;n<t.length;n++){const o=t[n].trim();if(!e.classList.contains(o))return!1}return!0}append(e,t){const n=this;var o,r;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)if(p.isNodeList(e))e.forEach(e=>{n.append(e,t)});else if(Array.isArray(t)||t instanceof NodeList){const o=n.windowApi.document.createDocumentFragment();t.forEach(e=>{"string"==typeof e&&(e=n.toElement(e,!0,!1)),o.appendChild(e)}),e.appendChild(o)}else o=e,r=t,"string"==typeof t?o instanceof DocumentFragment?("string"==typeof r&&(r=n.toElement(r,!0,!1)),o.appendChild(r)):o.insertAdjacentHTML("beforeend",p.createSafeHTML(r)):o.appendChild(r)}prepend(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)if(p.isNodeList(e))e.forEach(e=>{n.prepend(e,t)});else if("string"==typeof t)e instanceof DocumentFragment?(t=n.toElement(t,!0,!1),e.prepend(t)):e.insertAdjacentHTML("afterbegin",p.createSafeHTML(t));else{const n=e.firstChild;null==n?e.prepend(t):e.insertBefore(t,n)}}after(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)if(p.isNodeList(e))e.forEach(e=>{n.after(e,t)});else if("string"==typeof t)e.insertAdjacentHTML("afterend",p.createSafeHTML(t));else{const n=e.parentElement,o=e.nextSibling;!n||o?e.after(t):n.insertBefore(t,o)}}before(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null!=e)if(p.isNodeList(e))e.forEach(e=>{n.before(e,t)});else if("string"==typeof t)e.insertAdjacentHTML("beforebegin",p.createSafeHTML(t));else{const n=e.parentElement;n?n.insertBefore(t,e):e.before(t)}}remove(e){const t=this;"string"==typeof e&&(e=t.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{t.remove(e)}):"function"==typeof e.remove?e.remove():e.parentElement?e.parentElement.removeChild(e):e.parentNode&&e.parentNode.removeChild(e))}empty(e){const t=this;"string"==typeof e&&(e=t.selectorAll(e)),null!=e&&(p.isNodeList(e)?e.forEach(e=>{t.empty(e)}):e.innerHTML?e.innerHTML="":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,t=!1){const n=this;if("string"==typeof e&&(e=n.selector(e)),p.isWin(e))return n.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(t||!t&&p.isShow(e)){if(parseFloat(p.getStyleValue(e,"width").toString())>0)return parseFloat(p.getStyleValue(e,"width").toString());if(e.offsetWidth>0){const t=p.getStyleValue(e,"borderLeftWidth"),n=p.getStyleValue(e,"borderRightWidth"),o=p.getStyleValue(e,"paddingLeft"),r=p.getStyleValue(e,"paddingRight"),i=parseFloat(e.offsetWidth.toString())-parseFloat(t.toString())-parseFloat(n.toString())-parseFloat(o.toString())-parseFloat(r.toString());return parseFloat(i.toString())}return 0}{const{recovery:t}=p.forceShow(e),o=n.width(e,!0);return t(),o}}height(e,t=!1){const n=this;if(p.isWin(e))return n.windowApi.window.document.documentElement.clientHeight;if("string"==typeof e&&(e=n.selector(e)),9===e.nodeType)return Math.max(e.body.scrollHeight,e.documentElement.scrollHeight,e.body.offsetHeight,e.documentElement.offsetHeight,e.documentElement.clientHeight);if(t||!t&&p.isShow(e)){if(parseFloat(p.getStyleValue(e,"height").toString())>0)return parseFloat(p.getStyleValue(e,"height").toString());if(e.offsetHeight>0){const t=p.getStyleValue(e,"borderTopWidth"),n=p.getStyleValue(e,"borderBottomWidth"),o=p.getStyleValue(e,"paddingTop"),r=p.getStyleValue(e,"paddingBottom"),i=parseFloat(e.offsetHeight.toString())-parseFloat(t.toString())-parseFloat(n.toString())-parseFloat(o.toString())-parseFloat(r.toString());return parseFloat(i.toString())}return 0}{const{recovery:t}=p.forceShow(e),o=n.height(e,!0);return t(),o}}outerWidth(e,t=!1){const n=this;if(p.isWin(e))return n.windowApi.window.innerWidth;if("string"==typeof e&&(e=n.selector(e)),t||!t&&p.isShow(e)){const t=n.windowApi.globalThis.getComputedStyle(e,null),o=p.getStyleValue(t,"marginLeft"),r=p.getStyleValue(t,"marginRight");return e.offsetWidth+o+r}{const{recovery:t}=p.forceShow(e),o=n.outerWidth(e,!0);return t(),o}}outerHeight(e,t=!1){const n=this;if(p.isWin(e))return n.windowApi.window.innerHeight;if("string"==typeof e&&(e=n.selector(e)),t||!t&&p.isShow(e)){const t=n.windowApi.globalThis.getComputedStyle(e,null),o=p.getStyleValue(t,"marginTop"),r=p.getStyleValue(t,"marginBottom");return e.offsetHeight+o+r}{const{recovery:t}=p.forceShow(e),o=n.outerHeight(e,!0);return t(),o}}replaceWith(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null==e)return;if(p.isNodeList(e))return void e.forEach(e=>{n.replaceWith(e,t)});"string"==typeof t&&(t=n.toElement(t,!1,!1));const o=e.parentElement;o?o.replaceChild(t,e):(n.after(e,t),e.remove())}wrap(e,t){const n=this;if("string"==typeof e&&(e=n.selectorAll(e)),null==e)return;if(p.isNodeList(e))return void e.forEach(e=>{n.wrap(e,t)});const o=n.windowApi.document.createElement("div");n.html(o,t);const r=o.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 t=this;if("string"==typeof e&&(e=t.selector(e)),null!=e){if(p.isNodeList(e)){const n=[];return e.forEach(e=>{n.push(t.parent(e))}),n}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}()}serialize(e){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 N(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 r=function(){const t=o.windowApi.document.body,n=o.windowApi.document.defaultView,r=o.windowApi.document.documentElement,i=o.windowApi.document.createElement("div");i.style.paddingLeft=i.style.width="1px",t.appendChild(i);const s=2==i.offsetWidth;t.removeChild(i);const l=e.getBoundingClientRect(),a=r.clientTop||t.clientTop||0,c=r.clientLeft||t.clientLeft||0,f=n.pageYOffset||s&&r.scrollTop||t.scrollTop,u=n.pageXOffset||s&&r.scrollLeft||t.scrollLeft;return{top:l.top+f-a,left:l.left+u-c}}(),i=y("width",!0),s=y("height",!0);let l=r.top,a=r.left,c="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+=y("padding-top",!0),l+=y("border-top-width",!0),a+=y("padding-left",!0),a+=y("border-left-width",!0),a+=1;for(let e=0;e<f.length;e++){const t=f[e];c+=t+":"+y(t,!1)+";"}const u=e.value||"G",d=u.length,p=o.windowApi.document.createElement("div");t>0&&g(0,t);const h=g(t,n);d>n&&g(n,d),p.style.cssText=c,p.style.position="absolute",p.style.top=l+"px",p.style.left=a+"px",p.style.width=i+"px",p.style.height=s+"px",o.windowApi.document.body.appendChild(p);const m=h.getBoundingClientRect();return p?.parentNode?.removeChild(p),m;function g(e,t){const n=o.windowApi.document.createElement("span");return n.style.cssText=c,n.textContent=u.substring(e,t),p.appendChild(n),n}function y(t,n){const r=o.windowApi.document.defaultView.getComputedStyle(e,null).getPropertyValue(t);return n?parseFloat(r):r}}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(!p.isDOM(e))throw new Error("Utils.checkUserClickInNode 参数 targetNode 必须为 Element|Node 类型");const t=this.windowApi.window.event,n=this.windowApi.window.event,o=t?.composedPath()?.[0],r=null!=t?.clientX?t.clientX:n.touches[0].clientX,i=null!=t?.clientY?t.clientY:n.touches[0].clientY,{left:s,right:l,top:a,bottom:c}=e.getBoundingClientRect();return r>=s&&r<=l&&i>=a&&i<=c||!!(o&&e.contains(o)||o==e)}deleteParentNode(e,t){if(null==e)return;if(!p.isDOM(e))throw new Error("DOMUtils.deleteParentNode 参数 target 必须为 Node|HTMLElement 类型");if("string"!=typeof t)throw new Error("DOMUtils.deleteParentNode 参数 targetSelector 必须为 string 类型");let n=!1;const o=S.closest(e,t);return o&&(this.remove(o),n=!0),n}*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 r of o)if(r.textContent.includes(t)){"function"==typeof n&&n(e)||(yield r)}}for(let r=0;r<e.children.length;r++){const i=e.children[r];yield*o.findElementsWithText(i,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 r=this.windowApi.document.createRange();if(r.selectNodeContents(e),t){if(t.nodeType!==Node.TEXT_NODE)throw new TypeError("childTextNode必须是#text元素");null!=n&&null!=o&&(r.setStart(t,n),r.setEnd(t,o))}const i=this.windowApi.globalThis.getSelection();i&&(i.removeAllRanges(),i.addRange(r))}}const S=new N;module.exports=S;
2
2
  //# sourceMappingURL=index.cjs.min.js.map