text: !function(t,e){if(e.isKeyEventBind||!t.addEventListener)return{};var i=navigator.platform||navigator.userAgent,s="windows";/mac/i.test(i)&&(s="mac");var a="chrome";void 0!==t.mozFullScreen?a="moz":void 0===t.msHidden&&void 0!==t.hidden||(a="ie");var n={windows:{ctrlKey:!1,altKey:!0,shiftKey:!1},mac:{ctrlKey:!0,altKey:!0,shiftKey:!1}}[s],r=null,o=function(){clearTimeout(r);var e=t.querySelectorAll(".AK_Tips");[].slice.call(e).forEach((function(e){e.fromTarget&&(e.fromTarget.hasTipsShow=null),t.body.removeChild(e)})),t.hasTipsShow=null};t.addEventListener("keydown",(function(e){var i=!1,s=e.target||t.activeElement,l=s.tagName.toLowerCase();("textarea"==l||"input"==l&&0==/checkbox|radio|select|file|button|image|hidden/i.test(s.type))&&(i=!0);var d=t.querySelectorAll("a[accesskey],area[accesskey],button[accesskey],input[accesskey],label[accesskey],legend[accesskey],textarea[accesskey]");if(0!=d.length){var c=[].slice.call(d),h=c.map((function(t){return t.getAttribute("accesskey")})),u=-1;if(h.forEach((function(t,i){if(e.key&&e.key==t||e.keyIdentifier&&parseInt(e.keyIdentifier.toLowerCase().replace("u+",""),16)==parseInt(function(t,e){if(!t)return"";e=e||"x";for(var i,s="",a=0;a<t.length;a+=1)t.charCodeAt(a)>=55296&&t.charCodeAt(a)<=56319?(i=(65536+1024*(Number(t.charCodeAt(a))-55296)+Number(t.charCodeAt(a+1))-56320).toString(16),a+=1):i=t.charCodeAt(a).toString(16),s+=e+i;return s.substr(e.length)}(t),16))return u=i,!1})),0==e.altKey&&0==e.shiftKey&&0==e.ctrlKey){if(i)return;c[u]&&(setTimeout((function(){c[u].focus()}),1),e.preventDefault())}else 0==e.altKey&&1==e.shiftKey&&0==e.ctrlKey?191!=e.keyCode||i||(t.hasTipsShow?o():function(e){if(!t.hasTipsShow){var i=t.documentElement.scrollTop||t.body.scrollTop,s=t.documentElement.scrollLeft||t.body.scrollLeft;e.forEach((function(e){if(e.clientHeight*e.clientWidth!=0){var a=e.getAttribute("accesskey"),r=[];for(var o in n)n[o]&&r.push(o);r.push(a);var l=e.getBoundingClientRect(),d=t.createElement("div");d.className="ui-kbd-tips AK_Tips",d.setAttribute("style","top:"+(l.top+i)+"px;left:"+(l.left+s)+"px;"),d.innerHTML=r.map((function(t){return"<kbd>"+t.replace("Key","")+"</kbd>"})).join("+"),t.body.appendChild(d),d.fromTarget=e}})),t.hasTipsShow=!0,r=setTimeout((function(){o()}),3e3)}}(c)):!c[u]||i||"ie"!=a&&"moz"!=a||!e.altKey||e.shiftKey||e.ctrlKey||c[u].click()}})),t.addEventListener("mousedown",(function(){o()}));var l={37:"left",38:"up",39:"right",40:"down",13:"enter",9:"tab",27:"esc"},d="ui-outline",c={add:function(t){t.classList.add(d)},remove:function(t){t.classList.remove(d)},removeAll:function(){[].slice.call(t.querySelectorAll(".ui-outline")).forEach((function(t){c.remove(t)}))},has:function(t){t.classList.contains(d)}},h=null;e.isKeyEvent=!1,t.addEventListener("keydown",(function(i){e.isKeyEvent=!0,clearTimeout(h),h=setTimeout((function(){e.isKeyEvent=!1}),100);var s=l[i.keyCode];if(s){var a=t.activeElement;if(a&&!/body/i.test(a.tagName)){if("enter"==s&&(/^radio|checkbox$/i.test(a.type)||"0"==a.getAttribute("tabindex")))return a.click(),void i.preventDefault();var n=null,r=t.querySelectorAll(".ESC");"esc"==s&&r.length&&[].slice.call(r).forEach((function(e){var i=e.id;(n=i&&t.querySelector('[data-target="'+i+'"],[data-target2="'+i+'"],ui-drop[target="'+i+'"]'))&&"none"!==e.style.display&&e.clientHeight>0?n.hide?n.hide():n["ui-drop"]?n["ui-drop"].hide():n.click():e==document.activeElement&&e.click&&e.click()}));var o=a.getAttribute("data-focus"),d=a.getAttribute("data-target"),u=null;if((o||d)&&(o?u=t.getElementById(o):d&&(u=t.getElementById(d)),u&&(0!=u.clientWidth||0!=u.clientHeight))){if("tab"==s){c.removeAll();var p=u;return u.getAttribute("tabindex")||(p=u.querySelector("a[href], button:not(:disabled), input:not(:disabled)")),void(p&&p.focus())}if("enter"==s){var m=u.querySelector(".ui-outline");if(m&&o)return i.preventDefault(),void m.click();if(d)return}if("esc"==s)return n=t.querySelector('a[data-target="'+d+'"],input[data-target="'+d+'"]'),void(o?a.blur():n&&0==/ESC/.test(n.className)&&n.click());var g=[].slice.call(u.querySelectorAll("a[href], button:not(:disabled), input:not(:disabled)")),f=-1;0!=g.length&&(g.forEach((function(t,e){o?c.has(t)&&(f=e):a==t&&(f=e),c.remove(t)})),i.preventDefault(),"left"==s||"up"==s?--f<0&&(f=-1):"right"!=s&&"down"!=s||++f>g.length-1&&(f=g.length),g[f]&&(o?c.add(g[f]):g[f].focus()))}}}})),t.addEventListener("mousedown",(function(t){var e=t.target;e&&!c.has(e)&&c.removeAll()})),t.addEventListener("click",(function(i){var s=i.target,a=t.activeElement,n=s.getAttribute("tabindex")||"-1";s&&s==a&&(/^radio|checkbox$/i.test(a.type)||n>=0)&&0==e.isKeyEvent&&0==/none/.test(getComputedStyle(s).outline)&&a.blur()})),t.addEventListener("focusin",(function(t){var i=t.target;if(i&&(/^javascript/.test(i.href)&&!i.getAttribute("role")&&i.setAttribute("role","button"),e.isKeyEvent)){var s=window.getComputedStyle(i);!/none|auto/.test(s.outlineStyle)||t.path&&t.path[0]!==i||c.add(i)}})),t.addEventListener("focusout",(function(t){var e=t.target;e&&c.remove(e)})),e.isKeyEventBind=!0}(document,window),HTMLElement.prototype.follow=function(t,e){let i={offsets:{x:0,y:0},safeArea:[0,0,0,0],position:"4-1",edgeAdjust:!0};for(var s in t&&"[object Object]"===Object.prototype.toString.call(t)&&(e=t,t=null),e||(e={}))void 0===e[s]&&delete e[s];let a=Object.assign({},i,e);if(!t){let e=this.getAttribute("is-follow")||this.dataset.target;if(!e)return;if(!(t=document.getElementById(e)||document.querySelector("."+e)||document.querySelector(e)))return}let n=["4-1","1-4","5-7","2-3","2-1","6-8","3-4","4-3","8-6","1-2","7-5","3-2"],r=this.dataset.offsets,o=[];a.offsets.map&&a.offsets.length?o=a.offsets:"string"==typeof a.offsets&&(o=a.offsets.trim().split(/,\s*|\s+/)),r&&!e.offsets&&(o=r.trim().split(/,\s*|\s+/)),o.length&&(a.offsets={},a.offsets.x=o[0],a.offsets.y=o[1]||o[0]);let l=this.dataset.offsetX,d=this.dataset.offsetY;l&&(a.offsets.x=l),d&&(a.offsets.y=d),a.offsets.x*=1,a.offsets.y*=1;let c=this.dataset.position,h=this.dataset.align,u=n.some((t=>t===h));!c&&h&&u&&(c=h),!c||e&&e.position||(a.position=c);let p=this.dataset.edgeAdjust||a.edgeAdjust,m=!("0"===p||"none"===p||"false"===p||!1===p);"string"==typeof p&&"boolean"!=typeof a.edgeAdjust&&(a.edgeAdjust=m);let g=t.style.position;"absolute"!=g&&(t.style.position="absolute");let f=this.getBoundingClientRect(),v=t.getBoundingClientRect();if(v.width*v.height==0)return t.style.position=g||"",void window.console.warn((t.id?"id为"+t.id+"的":"")+"目前元素尺寸为0，无法定位");let b=window.pageYOffset,y=window.pageXOffset,E=window.innerWidth,w=window.innerHeight;(f.left<0&&f.right<0||f.top<0&&f.bottom<0||f.left>E&&f.right>E||f.top>w&&f.bottom>w)&&(a.edgeAdjust=m=!1);let A=t.offsetParent,$=A.getBoundingClientRect();const x={follow:t};this.element=this.element?Object.assign(this.element,x):x,this.params=this.params?Object.assign(this.params,a):a;let C=a.offsets,L=$.top+b,S=$.left+y;A===document.body&&"static"===window.getComputedStyle(A).position&&(L=0,S=0);let T,M,k=a.position,j=function(){let e=window.getComputedStyle(t),i=Number(e.zIndex),s=19;A.childNodes.forEach((e=>{if(1!==e.nodeType)return;let i=window.getComputedStyle(e),a=1*i.zIndex;a&&t!==e&&"none"!==i.display&&(s=Math.max(a+1,s))})),s!==i&&(t.style.zIndex=s)};if("string"!=typeof k&&2===k.length){let e=k;return T=e[0]+C.x,M=e[1]+C.y,!0===a.edgeAdjust&&(T+v.width>E+y&&(T=E+y-v.width-C.x),M+v.height>w+b&&(M=w+b-v.height-C.y)),t.style.left=`${T}px`,t.style.top=`${M}px`,t.dataset.align="3-1",void j()}!1===n.some((t=>t===k))&&(k=i.position);let D=this.dataset.safeArea||getComputedStyle(t).getPropertyValue("--safe-area")||a.safeArea;"string"==typeof D&&(D=D.trim().split(/(?:,\s*|\s+)/)),D=D.map((function(t){return parseFloat(t)||0})),1==D.length?D=D.concat(D[0],D[0],D[0]):2==D.length?(D.push(D[0]),D.push(D[1])):3==D.length&&D.push(D[1]);const H=v.width+C.x+D[3]>f.left,O=f.top-(v.height+C.y+D[0])<0,q=f.right+v.width+C.x+D[1]>E,N=f.bottom+v.height+C.y+D[2]>w;v.width,C.x,D[3],f.right,f.left,v.width,C.x,D[1],v.height,C.y,D[0],f.bottom,f.top,v.height,C.y,D[2];let R="bottom";var I=()=>{switch(k){case"1-4":case"5-7":case"2-3":M=f.top-v.height,T="1-4"===k?f.left:"5-7"===k?f.left-(v.width-f.width)/2:f.left-(v.width-f.width),R="top",m&&O&&(N?H&&q||(k={"1-4":"2-1","5-7":"6-8","2-3":"3-4"}[k],I()):(k={"1-4":"4-1","5-7":"7-5","2-3":"3-2"}[k],I()));break;case"2-1":case"6-8":case"3-4":T=f.right,M="2-1"===k?f.top:"6-8"===k?f.top-(v.height-f.height)/2:f.top-(v.height-f.height),R="right",m&&q&&(H?O&&N||(k={"2-1":"1-4","6-8":"5-7","3-4":"2-3"}[k],I()):(k={"2-1":"1-2","6-8":"8-6","3-4":"4-3"}[k],I()));break;case"4-1":case"7-5":case"3-2":M=f.bottom,T="4-1"===k?f.left:"7-5"===k?f.left-(v.width-f.width)/2:f.left-(v.width-f.width),R="bottom",m&&N&&(O?H&&q||(k={"4-1":"2-1","7-5":"6-8","3-2":"3-4"}[k],I()):(k={"4-1":"1-4","7-5":"5-7","3-2":"2-3"}[k],I()));break;case"1-2":case"8-6":case"4-3":T=f.left-v.width,M="1-2"===k?f.top:"8-6"===k?f.top-(v.height-f.height)/2:f.top-(v.height-f.height),R="left",m&&H&&(q?O&&N||(k={"1-2":"1-4","8-6":"5-7","4-3":"2-3"}[k],I()):(k={"1-2":"2-1","8-6":"6-8","4-3":"3-4"}[k],I()))}};I(),T=T+C.x-S,M=M+C.y-L,m&&("top"==R?M-=D[2]:"bottom"==R?M+=D[0]:"left"==R?T-=D[1]:T+=D[3]),M+=b,T+=y,t.style.left=`${Math.round(T)}px`,t.style.top=`${Math.round(M)}px`,v=t.getBoundingClientRect(),m&&("top"==R||"bottom"==R?v.left<D[3]?T+=D[3]-v.left:v.right+D[1]>E&&(T-=v.right+D[1]-E):v.top<D[0]?M+=D[0]-v.top:v.bottom+D[2]>w&&(M-=v.bottom+D[2]-w),t.style.left=`${Math.round(T)}px`,t.style.top=`${Math.round(M)}px`),t.dataset.align=k,t.dataset.direction=R,j(),t.zIndex||(t.zIndex=j)},[NodeList.prototype,HTMLCollection.prototype].forEach((t=>{t.follow=function(){[...this].forEach((t=>{1===t.nodeType&&t.follow.apply(t,this.arguments)}))}}));class Tab extends HTMLElement{static get observedAttributes(){return["open"]}static get defaults(){return{eventType:"click",history:!1,autoplay:3e3}}constructor(t,e){super();let i=null;if("string"==typeof t?i=document.getElementById(t):"object"==typeof t&&(t.tagName?i=t:e||(e=t)),e=e||{},i){let t=i.id;t||(t=("lulu_"+Math.random()).replace("0.",""),i.id=t,this.htmlFor=t),i.getAttribute("name")&&(this.name=i.getAttribute("name")),i.hasAttribute("open")&&(this.open=!0);for(let t in Tab.defaults)void 0!==i.dataset[t.toLowerCase()]?this[t]=i.dataset[t.toLowerCase()]:void 0!==e[t]&&(this[t]=i.dataset[t.toLowerCase()]=e[t]);let s=i.getAttribute("is-tab");s&&!i.dataset.target&&(i.dataset.target=s),-1==i.tabIndex&&i.setAttribute("tabindex",0)}let s=this.element||{};if(this.element=new Proxy(s,{get:(t,e)=>{if("target"==e){let t=this.target,e=null,i=this.element.trigger;return!t&&i&&(t=i.dataset.target||i.getAttribute("href"),t&&/#/.test(t)&&(t=t.split("#")[1])),t&&(e=document.getElementById(t)),e}return"trigger"==e?this.htmlFor&&document.getElementById(this.htmlFor)||this:t[e]},set:(t,e,i)=>{if("string"==typeof i&&(i=document.getElementById(i)||document.querySelector(i)),i&&"number"!=typeof i.nodeType)return!1;if(t[e]=i,"target"==e&&i){let t=i,e=t.id;e||(e=("lulu_"+Math.random()).replace("0.",""),t.id=e),this.element.trigger==this?this.target!=e&&(this.target=e):this.element.trigger&&this.element.trigger.setAttribute("data-target",e)}return!0}}),this.setParams(e),i&&!this.parentElement&&i!=this){let t=document.querySelector('body > div[hidden="tab"]');t||(t=document.createElement("div"),t.setAttribute("hidden","tab"),document.body.append(t)),t.append(this)}}get eventType(){let t=this.getAttribute("eventtype")||Tab.defaults.eventType;return"hover"==t&&(t="mouseenter"),t}set eventType(t){this.setAttribute("eventtype",t)}get history(){return this.hasAttribute("history")||Tab.defaults.history}set history(t){this.toggleAttribute("history",t)}get autoplay(){let t=this.getAttribute("autoplay");return"string"==typeof t&&(/^\d+$/.test(t)?1*t:Tab.defaults.autoplay)}set autoplay(t){t||""===t?this.setAttribute("autoplay",t):this.removeAttribute("autoplay")}get name(){return this.getAttribute("name")}set name(t){this.setAttribute("name",t)}get htmlFor(){return this.getAttribute("for")}set htmlFor(t){this.setAttribute("for",t)}get target(){return this.getAttribute("target")}set target(t){this.setAttribute("target",t)}get open(){return this.hasAttribute("open")}set open(t){this.toggleAttribute("open",t)}setParams(t){this.params=this.params||{},t=t||{},Object.assign(this.params,t)}switch(){let t=this.name,e=[];t?(e=document.querySelectorAll('ui-tab[name="'+t+'"]'),this.open||(e.forEach((t=>{t.open&&(t.open=!1)})),this.open=!0)):this.open=!this.open;const i=window.location;if(1==this.history&&t&&0==/tab\d{10,16}/.test(t)){if(!this.element.target)return;let e=this.element.target.id;const s=new URLSearchParams(i.search);s.set(t,e);let a=i.hash;e==a&&(i.hash=a=""),window.history.replaceState(null,document.title,i.href.split("?")[0]+"?"+s.toString()+a)}}autoSwitch(){let t=this.autoplay,e=this.name;if(t&&e){let i=document.querySelectorAll('ui-tab[name="'+e+'"]');if(clearTimeout(this.timer),t&&e&&i.length>1){let e=[].slice.call(i).findIndex((t=>t==this));e++,e>=i.length&&(e=0),this.timer=setTimeout((()=>{i[e].switch(),i[e].autoSwitch()}),t)}}}events(){if("mouseover"!=this.eventType&&"mouseenter"!=this.eventType||(this.element.trigger.addEventListener(this.eventType,(()=>{Tab.hoverTimer=setTimeout((()=>{this.switch()}),150)}),!1),this.element.trigger.addEventListener(this.eventType.replace("over","out").replace("enter","leave"),(()=>{clearTimeout(Tab.hoverTimer)}))),this.element.trigger.addEventListener("click",(t=>{/^(:?javas|#)/.test(t.target.getAttribute("href"))&&t.preventDefault(),this.switch()}),!1),this.autoplay&&this.name){[this.element.trigger,this.element.target].forEach((t=>{t.addEventListener("mouseenter",(()=>{clearTimeout(this.timer)})),t.addEventListener("mouseleave",(()=>{this.autoSwitch()}))}));let t=document.querySelector('ui-tab[name="'+this.name+'"][open]');t&&t.autoSwitch()}}connectedCallback(){this.closest("a, button")||this.querySelector("a, button")||this.setAttribute("tabindex","0");let t=this.element.target,e=this.element.trigger;e&&e.setAttribute("role","tab"),t&&t.setAttribute("role","tabpanel"),this.events(),new URLSearchParams(window.location.search).forEach(((i,s)=>{e&&t&&this.name==s&&t.id==i&&!e.hasAttribute("open")&&e.click()})),this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-tab"}})),this.isConnectedCallback=!0,this.dispatchEvent(new CustomEvent("DOMContentLoaded")),e!=this&&(e.dispatchEvent(new CustomEvent("DOMContentLoaded")),e.hasAttribute("is-tab")&&(e.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-tab"}})),e.setAttribute("defined","")))}attributeChangedCallback(t,e,i){if(this.element&&"open"===t&&typeof e!=typeof i){const t=this.element.target;if(!t)return;this.open?(t.classList.add("active"),this.setAttribute("aria-selected","true"),this.dispatchEvent(new CustomEvent("show",{detail:{type:"ui-tab"}}))):(t.classList.remove("active"),this.setAttribute("aria-selected","false"),this.dispatchEvent(new CustomEvent("hide",{detail:{type:"ui-tab"}})));let e=this.element.trigger;e&&e!=this&&e.toggleAttribute("open",this.open),e&&this.name&&/ui-tab/.test(e.className)&&(e.parentElement.style.setProperty("--ui-tab-width",e.clientWidth),e.parentElement.style.setProperty("--ui-tab-left",e.offsetLeft)),this.dispatchEvent(new CustomEvent("switch"))}}}NodeList.prototype.tab=function(t={}){const e=this;let i=t.name||"";for(var s of e)!i&&s.getAttribute("name")&&(i=s.getAttribute("name"));i||(i=("tab"+Math.random()).replace("0.",""));for(let s of e)s.setAttribute("name",i),s["ui-tab"]=new Tab(s,t)},customElements.get("ui-tab")||customElements.define("ui-tab",Tab),window.Tab=Tab,function(){function t(){document.querySelectorAll("[is-tab]").forEach((function(t){t["ui-tab"]||(t["ui-tab"]=new Tab(t))})),new MutationObserver((function(t){t.forEach((function(t){t.addedNodes.forEach((function(t){t.tagName&&(t.hasAttribute("is-tab")?t["ui-tab"]||(t["ui-tab"]=new Tab(t)):t.querySelectorAll("[is-tab]").forEach((function(t){t["ui-tab"]||(t["ui-tab"]=new Tab(t))})))}))}))})).observe(document.body,{childList:!0,subtree:!0})}"loading"!=document.readyState?t():window.addEventListener("DOMContentLoaded",t)}();class Select extends HTMLSelectElement{static get observedAttributes(){return["multiple","disabled","width"]}constructor(){super(),this.element||(this.element={button:null,combobox:null,datalist:null}),this.observer=null,this.resizeObserver=null,this.setProperty()}static addClass(){return["ui","select"].concat([].slice.call(arguments)).join("-")}set multiple(t){return this.toggleAttribute("multiple",Boolean(t))}get multiple(){return this.hasAttribute("multiple")}render(){this.create(),this.refresh(),this.events()}remove(){this.parentElement&&this.parentElement.removeChild(this),this.element.combobox&&this.element.combobox.remove()}getData(){if(!this.options.length)return[{html:""}];let t=this.querySelectorAll("optgroup"),e=!!this.querySelector("optgroup[label]");if(t.length){let i=[];return t.forEach((t=>{i.push({html:t.label,disabled:t.disabled,className:t.className,divide:!e}),t.querySelectorAll("option").forEach((s=>{i.push({html:s.innerHTML,value:s.value,selected:s.selected,disabled:t.disabled||s.disabled,className:s.className,intent:e})}))})),i}return[].slice.call(this.options).map((t=>({html:t.innerHTML,value:t.value,selected:t.selected,disabled:t.disabled,className:t.className})))}get width(){let t=this.getAttribute("width");return t&&Number(t)===parseFloat(t)&&(t+="px"),t}set width(t){0!=/\d/.test(t)&&this.setAttribute("width",t)}getWidth(){return this.style.width||this.width||this.offsetWidth+"px"}setWidth(){if(this.element.combobox){const t=this.getWidth();this.element.combobox.style.width=t,this.style.transform="",-1!==t.lastIndexOf("%")&&"absolute"!=this.originPosition&&"fixed"!=this.originPosition&&(this.style.transform=`scaleX(${this.parentElement.clientWidth*parseFloat(t)*.01/this.offsetWidth})`)}}create(){if(this.element&&this.element.combobox)return;const t=("lulu_"+(this.id||Math.random())).replace("0.",""),e=Select.addClass("button"),i=Select.addClass("datalist");let s=window.getComputedStyle(this).position;this.originPosition=s;var a=/windows/i.test(navigator.userAgent);this.insertAdjacentHTML("afterend",`<div style="width: ${this.getWidth()}">\n           ${this.multiple?"":`<a\n                class="${e}"\n                data-target="${t}"\n                aria-owns="${t}"\n                aria-expanded="false"\n                style="display: ${this.multiple?"none":"block"}"\n                ${this.disabled?"":'href="javascript:" '}\n                role="button"\n            /></a>`}\n           <ui-select-list id="${t}" role="listbox" aria-expanded="false" class="${i}" ${this.multiple?"":'aria-hidden="true"'} data-custom-scroll="${a}"></ui-select-list>\n        </div>`);let n=this.nextElementSibling;Object.assign(this.element,{combobox:n,button:n.querySelector(`.${e}`),datalist:n.querySelector(`.${i}`)}),"fixed"!=s&&(this.style.position="absolute"),this.dispatchEvent(new CustomEvent("DOMContentLoaded"))}refresh(t){const e=this.multiple,i=this,s=this.element.combobox,a=this.element.button,n=this.element.datalist;if(!n)return;const r=n.id;if(t=t||this.getData(),s.className=`${i.className} ${Select.addClass()}`.trim(),e)s.style.height=i.style.height||i.offsetHeight+"px";else if(i[i.selectedIndex]){const t=i[i.selectedIndex].innerHTML;a.innerHTML=`<span class="${Select.addClass("text")}">${t}</span><i class="${Select.addClass("icon")}" aria-hidden="true"></i>`}let o=-1;n.innerHTML=t.map((t=>{let i=[Select.addClass("datalist","li"),t.className];return t.selected&&i.push("selected"),t.disabled&&i.push("disabled"),void 0!==t.divide?t.divide?(i=[Select.addClass("datalist","hr"),t.className],`<div class="${i.join(" ")}"></div>`):`<div class="${i.join(" ")}" role="heading">${t.html}</div>`:(o++,t.intent&&i.push(Select.addClass("intent")),t.html?e?`<a class="${i.join(" ")}" data-index=${o}>${t.html}</a>`:`<a\n                ${t.disabled?"":' href="javascript:" '}\n                class="${i.join(" ")}"\n                data-index=${o}\n                data-target="${r}"\n                role="option"\n                aria-selected="${t.selected}"\n            >${t.html}</a>`:`<span class="${i.join(" ")} disabled"></span>`)})).join("")}events(){this.multiple?this.createMultipleEvent():this.createNormalEvent()}zIndex(){let t=this.element.datalist,e=window.getComputedStyle(t),i=Number(e.zIndex),s=19;document.body.childNodes.forEach((e=>{if(1!==e.nodeType)return;let i=window.getComputedStyle(e),a=1*i.zIndex;a&&t!==e&&"none"!==i.display&&(s=Math.max(a+1,s))})),s!==i&&(t.style.zIndex=s)}position(){const t=this.element;let e=t.combobox,i=t.button,s=t.datalist;if(!e.classList.contains("active"))return;let a=i.getBoundingClientRect();s.style.left=a.left+document.scrollingElement.scrollLeft+"px",s.style.top=a.bottom+document.scrollingElement.scrollTop-1+"px",s.style.width=e.getBoundingClientRect().width+"px",s.classList.add("active"),this.zIndex();let n=s.getBoundingClientRect();var r=n.bottom+window.pageYOffset>Math.max(document.body.clientHeight,window.innerHeight);e.classList[r?"add":"remove"]("reverse"),r&&(s.style.top=a.top+document.scrollingElement.scrollTop-n.height+1+"px")}createNormalEvent(){const t=this.element;let e=t.combobox,i=t.button,s=t.datalist;i.addEventListener("click",(()=>{if(this.disabled)return!1;if(e.classList.toggle("active"),e.classList.contains("active")){document.body.appendChild(s),this.position(),i.setAttribute("aria-expanded","true");var t=e.dataScrollTop,a=s.querySelector(".selected");t&&a&&t[1]===a.getAttribute("data-index")&&t[2]===a.innerText&&(s.scrollTop=t[0],delete e.dataScrollTop)}else e.classList.remove("reverse"),i.setAttribute("aria-expanded","false"),s.remove()})),s.addEventListener("click",(t=>{var a=t.target;if(a&&a.closest){var n=a,r=null,o=n.classList.contains("disabled"),l=n.getAttribute("data-index"),d=s.scrollTop;e.dataScrollTop=[d,l,n.innerText],o||(r=this[l])&&(r.selected=!0),e.classList.remove("active"),i.setAttribute("aria-expanded","false"),s.remove(),i.focus(),i.blur(),o||(this.refresh(),this.dispatchEvent(new CustomEvent("change",{bubbles:!0})))}})),document.isSelectMouseEvent||(document.addEventListener("mouseup",(t=>{var e=t.target;if(!e)return;const i=document.querySelector("select+.ui-select.active");if(!i)return;const s=i.previousElementSibling,a=s.element&&s.element.datalist;a.contains(e)||i.contains(e)||(i.classList.remove("active"),i.classList.remove("reverse"),a.remove())})),document.isSelectMouseEvent=!0)}createMultipleEvent(){const t=this.element.datalist;this.addEventListener("change",(()=>{this.refresh()})),this.addEventListener("scroll",(()=>{t.scrollTop=this.scrollTop})),this.addEventListener("mousedown",(()=>{this.setAttribute("data-active","true")})),this.addEventListener("mousemove",(e=>{if(this.getAttribute("data-active"))this.refresh();else for(var i=e.clientY,s=e.clientX,a=document.elementsFromPoint(s,i),n=t.querySelectorAll("a"),r=0;r<n.length;r++){var o=n[r];if(o.removeAttribute("href"),[...a].includes(o)){o.classList.contains("selected")||o.classList.contains("disabled")||(o.href="javascript:");break}}})),this.addEventListener("mouseout",(()=>{t.querySelectorAll("a[href]").forEach((function(t){t.removeAttribute("href")}))})),document.addEventListener("mouseup",(()=>{this.removeAttribute("data-active")}))}setProperty(){Object.defineProperty(this,"value",{configurable:!0,enumerable:!0,writeable:!0,get:()=>{let t=[];return[].slice.call(this.options).forEach((e=>{e.selected&&t.push(e.value)})),t.join()},set:t=>{let e=!1;t=this.multiple?t.split(","):[t.toString()],[].slice.call(this.options).forEach((i=>{!this.multiple&&e||(-1!==t.indexOf(i.value)?i.selected=e=!0:this.multiple&&(i.selected=!1))}))}});const t=Object.getOwnPropertyDescriptor(HTMLSelectElement.prototype,"selectedIndex");Object.defineProperty(HTMLSelectElement.prototype,"selectedIndex",{...t,set(t){this.options[t]&&(this.options[t].selected=!0)}})}attributeChangedCallback(t){const e=this.element.button;if("disabled"===t){if(!e)return;this.disabled?e.removeAttribute("href"):e.setAttribute("href","javascript:")}else"multiple"===t?this.element.combobox&&(this.element.combobox.remove(),this.render()):"width"==t&&this.setWidth()}connectedCallback(){this.observer=new MutationObserver((t=>{let e=!0;t.forEach((t=>{"attributes"==t.type&&t.target.hasAttribute("selected")&&(t.target.selected=!0,e=!1)})),e&&this.refresh()})),this.resizeObserver=new ResizeObserver((()=>{this.setWidth(),this.position()})),this.observer.observe(this,{childList:!0,subtree:!0,attributes:!0,attributeFilter:["selected"]}),this.resizeObserver.observe(this),this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-select"}})),this.isConnectedCallback=!0,this.render()}disconnectedCallback(){this.remove(),this.observer.disconnect(),this.resizeObserver.disconnect()}}const propOptionSelected=Object.getOwnPropertyDescriptor(HTMLOptionElement.prototype,"selected");Object.defineProperty(HTMLOptionElement.prototype,"selected",{...propOptionSelected,set(t){propOptionSelected.set.call(this,t),this.parentElement&&this.parentElement.refresh&&this.parentElement.refresh()}}),customElements.get("ui-select")||customElements.define("ui-select",Select,{extends:"select"});class Drop extends HTMLElement{static get observedAttributes(){return["open","target"]}static get defaults(){return{eventtype:"click",position:"7-5"}}constructor(t,e,i){super(),i=i||{},this.params=this.params||{},this.params=new Proxy(this.params,{get:(t,e)=>{if(!e)return;let i=t[e=e.toLowerCase()],s=this.element.trigger;return void 0===i&&(i=s.getAttribute(e)||s.dataset[e],"width"==e&&(i=s!==this?s.dataset[e]:s.getAttribute(e)),void 0===i&&Drop.defaults[e]&&(i=Drop.defaults[e])),i},set:(t,e,i)=>(t[e.toLowerCase()]=i,!0)});let s=this.element||{};this.element=new Proxy(s,{get:(t,e)=>{if("target"==e){let i=this.getAttribute("target"),s=t[e];return!s&&i&&(s=document.getElementById(i)),s}return"trigger"==e?t[e]||this:t[e]},set:(t,e,i)=>{if("string"==typeof i&&(i=document.getElementById(i)||document.querySelector(i)),i&&"number"!=typeof i.nodeType)return!1;if(t[e]=i,"target"==e&&i){let t=i,e=t.id;e||(e=("lulu_"+Math.random()).replace("0.",""),t.id=e);let s=this.element.trigger;if(s==this)this.target!=e&&(this.target=e);else if(s){let t=s.dataset.target;t&&document.querySelector('datalist[id="'+t+'"]')?s.setAttribute("data-target2",e):s.setAttribute("data-target",e)}}return!0}}),[...arguments].forEach((function(t){"object"==typeof t&&t&&!t.tagName&&(i=t)})),t&&(this.element.trigger=t),(t=this.element.trigger)&&(e&&e!==i?this.element.target=e:!e&&t.dataset&&t.dataset.target&&(this.element.target=t.dataset.target)),this.setParams(i),this.open&&("loading"!=document.readyState?this.show():window.addEventListener("DOMContentLoaded",(()=>{this.show()}))),t!==this&&(this.addEventListener("connected",(function(){this.remove()})),t["ui-drop"]=this,document.body.append(this))}get htmlFor(){return this.getAttribute("for")}set htmlFor(t){this.setAttribute("for",t)}get target(){return this.getAttribute("target")}set target(t){this.setAttribute("target",t)}get eventType(){return this.getAttribute("eventtype")||"click"}set eventType(t){this.setAttribute("eventtype",t)}get open(){return this.hasAttribute("open")}set open(t){this.toggleAttribute("open",t)}setParams(t){let e=(t=t||{}).onShow,i=t.onHide;"function"==typeof e&&(this.addEventListener("show",(function(t){e.call(this,t)})),delete t.onShow),"function"==typeof i&&(this.addEventListener("hide",(function(t){i.call(this,t)})),delete t.onHide),Object.assign(this.params,t||{})}events(t){let e=this.element.trigger,i=this.element.target;if(!i&&!t)return;if(i&&i.matches("datalist"))return;const s=this.params,a=t=>{if(!s.selector)return null;const i=t.closest(s.selector);return 0==e.contains(i)?null:i};switch(s.eventType){case"null":break;case"hover":case"mouseover":case"mouseenter":if(!i)return void setTimeout((()=>{this.element.target&&this.events()}),1);i.timerHover=null,i.timerHold=null,e.isBindDropEvents||(e.addEventListener("mouseover",(t=>{if(t.relatedTarget!==t.target){const e=a(t.target);e&&(this.element.trigger=e),s.selector&&!e||(i.timerHover=setTimeout((()=>{this.show()}),150),clearTimeout(i.timerHold))}})),e.addEventListener("mouseout",(t=>{(this.element.trigger==t.target||this.element.trigger.contains(t.target))&&(clearTimeout(i.timerHover),i.timerHold=setTimeout((()=>{this.hide()}),200))})),i&&!i.isBindDropHover&&(i.addEventListener("mouseenter",(()=>{clearTimeout(i.timerHold)})),i.addEventListener("mouseleave",(()=>{i.timerHold=setTimeout((()=>{let t=i.element.trigger;t&&"hover"==t.eventType&&t.hide()}),100)})),i.isBindDropHover=!0),e.addEventListener("click",(t=>{if(!window.isKeyEvent)return;t.preventDefault();const e=a(t.target);e&&(this.element.trigger=e),s.selector&&!e||(this.open?this.hide():this.show())})),"hover"!=this.eventType&&(this.eventType="hover"));break;case"click":case"contextmenu":e.isBindDropEvents&&e.isBindDropEvents===s.eventType||e.addEventListener(s.eventType,(t=>{t.preventDefault();const e=a(t.target);if(e&&(this.element.trigger=e),!s.selector||e){if("contextmenu"==s.eventType)return s.position=[t.pageX,t.pageY],void this.show();this.open?this.hide():this.show()}}))}"null"==s.eventType||e.isBindDocMouseUp||(document.addEventListener("mouseup",(t=>{let e=t&&t.target;if(!e||!this.open)return;let i=this.element.trigger,s=this.element.target;0!=i.contains(e)||s&&0!=s.contains(e)||this.hide()})),e.isBindDocMouseUp=!0),e.isBindDropEvents=s.eventType||!0,window.addEventListener("resize",(()=>{this.position()})),this.dispatchEvent(new CustomEvent("DOMContentLoaded")),e!=this&&e.dispatchEvent(new CustomEvent("DOMContentLoaded"))}position(){let t=this.element.trigger,e=this.element.target;return this.open&&e&&"none"!=window.getComputedStyle(t).display&&t.follow(e,{offsets:this.params.offsets,position:this.params.position,edgeAdjust:this.params.edgeAdjust}),this}show(){let t=this.element.trigger,e=this.element.target;return e&&0==document.body.contains(e)&&document.body.appendChild(e),e&&(e.style.position="absolute",e.style.display="inline",e.classList.add("ESC"),e.tabIndex=-1,e.focus({preventScroll:!0}),e.element=e.element||{},e.element.trigger=this),t.setAttribute("aria-expanded","true"),this.open||(this.open=!0),this.position(),this.dispatchEvent(new CustomEvent("show")),t!=this&&t.dispatchEvent(new CustomEvent("show",{detail:{type:"ui-drop"}})),this}hide(){let t=this.element.trigger,e=this.element.target;return e&&(e.style.display="none",e.classList.remove("ESC"),e.element&&delete e.element.trigger),t.setAttribute("aria-expanded","false"),window.isKeyEvent&&t.focus(),this.open&&(this.open=!1),this.dispatchEvent(new CustomEvent("hide")),t!=this&&t.dispatchEvent(new CustomEvent("hide",{detail:{type:"ui-drop"}})),this}list(t,e,i){const s=function(t){let e={id:t.id||t.value,value:t.innerHTML||t.value,className:t.className,disabled:t.disabled,label:t.label,accessKey:t.accessKey},i=t.closest("optgroup");return i&&i.disabled&&(e.disabled=!0),t.hasAttribute("href")&&(e.href=t.getAttribute("href")),e};if([...arguments].forEach((a=>{const n=typeof a;"string"===n?t=document.getElementById(a)||document.querySelector(a):"function"===n?e=a:"object"===n&&("number"==typeof a.nodeType?a.matches("datalist")?(e=function(){let t=a.querySelectorAll("optgroup"),e=!!a.querySelector("optgroup[label]");if(t.length){let i=[];return t.forEach((t=>{e?i.push({id:"-1",value:t.label,disabled:t.disabled,className:t.className,heading:!0}):i.push({}),t.querySelectorAll("option").forEach((t=>{i.push(s(t))}))})),i}return[...a.querySelectorAll("option")].map(((t,e)=>{let i=s(t);return i.value?(i.id||(i.id=e),i):{}}))},t==a&&(t=null)):t=a:a.map?e=a:i=a)})),t&&"number"!=typeof t.nodeType&&(t=null),!(t=t||this.element.trigger))return this;e||(e=[]);const a={eventType:"click",offsets:{x:0,y:0},position:"4-1",selector:"",width:"",onShow:()=>{},onHide:()=>{},onSelect:()=>{}},n={};i=i||{},Object.keys(a).forEach((t=>{n[t]=i[t]||this.params[t]||a[t]}));const r="selected",o=function(){return["ui-droplist"].concat([].slice.call(arguments)).join("-")};let l="innerHTML";t.matches("input")&&(l="value");let d=document.createElement("div");d.setAttribute("role","listbox"),d.setAttribute("tabindex","-1"),/^\d+$/.test(n.width)?d.style.width=n.width+"px":d.style.width=n.width,d.className=o("x"),this.data=e;let c=e,h=e=>{let i="-1",s=!1,a=(e,n)=>{e&&e.length&&e.forEach(((e,r)=>{const o=n.concat(r);e&&e.data?a(e.data,o):(e&&e.selected&&!e.disabled&&e.value&&(t[l]=e.value,i=o.join("-")),e&&e.selected&&(s=!0))}))};a(e,[]);const n=(t[l]||"").trim();return 0==s&&n&&(a=(t,e)=>{t&&t.length&&t.forEach(((t,s)=>{const r=e.concat(s);t&&t.data?a(t.data,r):"string"==typeof t.value&&t.value.trim()==n&&(i=r.join("-"),t.selected=!0)}))},a(e,[])),i},u=-1;"function"!=typeof e&&e.length&&e.map&&(u=h(c));const p=(t,e)=>{"function"==typeof e&&(e=e(),u=h(e));let i=(e=e&&e.length?e.map((t=>"string"==typeof t&&"-"!==t?{value:t}:t)):[{value:"没有数据",disabled:!0}]).some((t=>t&&t.selected));t.innerHTML=(()=>{let t="";const s=(t,e)=>{let a="";return t.forEach(((t,n)=>{if("-"==t||null===t||"{}"==JSON.stringify(t))return void(a+='<hr class="'+o("hr")+'">');const l=e.concat(n);let d=t.href;"string"!=typeof d?d="javascript:":d||(d=location.href.split("#")[0]);let c="";t.target&&(c=' target="'+t.target+'"');let h="";t.data&&(h=" data-sublist");let p="";t.label&&(p=' aria-label="'+t.label+'"');let m="";t.accessKey&&(m=` accesskey="${t.accessKey}"`),0==i&&u==l.join("-")&&(t.selected=!0);let g=o("li")+" "+t.className;if(t.selected&&(g=g+" "+r),g=g.trim(),1==t.heading)return t.disabled&&(g+=" disabled"),void(a+='<div class="'+g+'"'+p+' role="heading">'+t.value+"</div>");1!=t.disabled?(a+='<a href="'+d+'"'+c+p+m+' class="'+g+'" data-index="'+l.join("-")+'" role="option" aria-selected="'+(t.selected||"false")+'" '+h+">"+t.value+"</a>",t.data&&(a+='<div class="'+o("xx")+'"><div class="'+o("x")+'" role="listbox">'+s(t.data,l)+"</div></div>")):a+='<span class="'+g+'"'+p+m+">"+t.value+"</span>"})),a};return t+=s(e,[]),t})(),t.listData=e};return this.setParams({eventType:n.eventType,offsets:n.offsets,selector:n.selector,position:n.position,onShow:function(){p.call(this,d,this.data),n.onShow.apply(this,arguments)},onHide:n.onHide}),this.element.trigger=t,this.element.target=d,this.events(),d.addEventListener("click",(e=>{if(1!=e.target.nodeType||!e.target.closest)return;const i=e.target.closest("a");if(!i)return;const s=d.listData,a=i.getAttribute("data-index");if(!a)return;let c=null;if(a.split("-").forEach((t=>{c=null===c?s[t]:c.data?c.data[t]:c[t]})),c){if("string"==typeof i.getAttribute("data-sublist")){i.classList.add(r);const t=i.nextElementSibling.querySelector("."+o("x"));if(!t)return;t.style.transform="",t.classList.remove("reverse");const e=t.getBoundingClientRect();e.right>document.documentElement.clientWidth&&t.classList.add("reverse");let s=0;return e.bottom>window.innerHeight&&(s=window.innerHeight-e.bottom),void(t.style.transform="translateY("+s+"px)")}if(a!=u){let t=null;"-1"!=u&&(u.split("-").forEach((e=>{t=null===t?s[e]:t.data?t.data[e]:t[e]})),t&&delete t.selected),c.selected=!0,u=a}(this.params.onSelect||n.onSelect).call(this,c,i),this.dispatchEvent(new CustomEvent("select",{detail:{data:c,target:i}})),t!=this&&t.dispatchEvent(new CustomEvent("select",{detail:{type:"ui-drop",data:c,target:i}})),"contextmenu"==n.eventType||""!=n.selector||c.href||(t[l]=c.value),this.hide()}})),d.addEventListener("mouseover",(t=>{if(1!=t.target.nodeType||!t.target.closest)return;const e=t.target.closest("a");if(!e)return;const i=e.parentElement.querySelector(".selected[data-sublist]");i&&i!=e&&i.classList.remove(r),0==e.classList.contains(r)&&"string"==typeof e.getAttribute("data-sublist")&&e.click()})),this}panel(t,e){if(2===arguments.length)t=arguments[0],e=arguments[1];else if(1===arguments.length){if((e=arguments[0]).matches&&e.matches("dialog")){let t=e,s=t.dataset.buttons;var i=[];""!==s&&"null"!==s&&"false"!==s&&(s=s||"",i=[{value:s.split(",")[0].trim(),events:()=>{t.dispatchEvent(new CustomEvent("ensure",{detail:{drop:this}}))}},{value:(s.split(",")[1]||"").trim(),events:()=>{t.dispatchEvent(new CustomEvent("cancel",{detail:{drop:this}})),this.hide()}}]),e={content:t.innerHTML,title:t.title,buttons:i}}t=null}if("string"==typeof t&&(t=document.querySelector(t)),!(t=t||this.element.trigger))return this;e=e||{},["width","eventType","selector","offsets","position"].forEach((function(i){let s=t.getAttribute(i)||t.dataset[i];s&&void 0===e[i]&&(e[i]=s)}));const s=Object.assign({},{title:"",content:"",buttons:[{},{}],width:"auto",eventType:"click",selector:"",offsets:{x:0,y:0},position:"4-1",onShow:()=>{},onHide:()=>{}},e),a={add:function(){return["ui-dropanel"].concat([].slice.call(arguments)).join("-")},toString:()=>"ui-dropanel"},n=document.createElement("div");n.className=a.add("x"),/^\d+$/.test(s.width)?n.style.width=s.width+"px":/^\d+\D+$/.test(s.width)&&(n.style.width=s.width);const r=document.createElement("h5");r.className=a.add("title"),r.innerHTML=s.title;const o=document.createElement("button");o.setAttribute("aria-label","关闭"),o.className=a.add("close");const l=document.createElement("content");l.className=a.add("content"),l.innerHTML=s.content;const d=document.createElement("div");return d.className=a.add("footer"),n.appendChild(r),n.appendChild(o),n.appendChild(l),n.appendChild(d),this.setParams({eventType:s.eventType,offsets:s.offsets,selector:s.selector,position:s.position,onShow:s.onShow,onHide:s.onHide}),Object.assign(this.element,{trigger:t,target:n,panel:n,title:r,close:o,content:l,footer:d}),this.events(),o.addEventListener("click",(()=>{this.hide()}),!1),s.buttons.forEach(((t,e)=>{let i=(t=t||{}).type||"";i||0!=e||(i=s.buttons.length>1?"danger":"primary");let n=t.value;n||(n=["确定","取消"][e]);let r=t.events||{click:()=>{this.hide()}};"function"==typeof r&&(r={click:r});let o=null;t.for?(o=document.createElement("label"),o.setAttribute("for",t.for),o.setAttribute("role","button")):t.form?(o.setAttribute("form",t.form),o.type="submit"):(o=document.createElement("button"),this.element["button"+e]=o),o.innerHTML=n,o.className=String(a).replace("dropanel","button")+" "+a.add("button")+" "+(t.className||""),i&&o.setAttribute("data-type",i),this.element["button"+e]=o;for(let t in r)o.addEventListener(t,(e=>{e.drop=this,r[t](e)}),!1);this.element.footer.appendChild(o)})),this}connectedCallback(){let t=this.element.target,e=this.element.trigger;e.open?e.setAttribute("aria-expanded","true"):e.setAttribute("aria-expanded","false"),t?t.matches("datalist")?this.list(t):t.matches("dialog")?this.panel(t):this.events():this.events(e===this),this.querySelector("a, button")||this.closest("a, button")||(this.tabIndex=0,this.role="button"),this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-drop"}})),e!=this&&e.hasAttribute("is-drop")&&(e.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-drop"}})),e.setAttribute("defined","")),this.isConnectedCallback=!0}attributeChangedCallback(t,e,i){if("target"==t){let t=document.getElementById(i);t&&(this.element.target=t)}else if("open"==t){let t=this.element.trigger.getAttribute("aria-expanded");this.open&&"false"==t?this.show():this.open||"true"!=t||this.hide()}}}window.Drop=Drop,customElements.get("ui-drop")||customElements.define("ui-drop",Drop),HTMLElement.prototype.drop=function(t,e){return this.matches("ui-drop, [is-drop]")||this["ui-drop"]||(this["ui-drop"]=new Drop(this,t,e)),this};const initAllIsDropAttrAction=t=>{(t||document.querySelectorAll("[is-drop]")).forEach((t=>{let e=t.getAttribute("is-drop");e&&!t.dataset.target&&(t.dataset.target=e),e=t.dataset.target;let i=e&&document.getElementById(e);i&&(t["ui-drop"]=new Drop(t,i))}))},autoInitAndWatchingIsDropAttr=()=>{initAllIsDropAttrAction();new MutationObserver((t=>{t.forEach((t=>{t.addedNodes&&t.addedNodes.forEach((t=>{t.tagName&&(t.hasAttribute("is-drop")?initAllIsDropAttrAction([t]):initAllIsDropAttrAction(t.querySelectorAll("[is-drop]")))}))}))})).observe(document.body,{childList:!0,subtree:!0})};"loading"!=document.readyState?autoInitAndWatchingIsDropAttr():window.addEventListener("DOMContentLoaded",autoInitAndWatchingIsDropAttr);class Tips extends HTMLElement{static get observedAttributes(){return["title","reverse","for","eventType","align"]}constructor(t,e,i){if(super(),"string"==typeof t&&/^#?\w+(?:[-_]\w+)*$/.test(t)&&(t=document.getElementById(t.replace("#",""))),t&&t.tips)return t.tips(e,i),t["ui-tips"];this.target=null}get title(){let t=this.getAttribute("title");return t?(this.setAttribute("data-title",t),this.removeAttribute("title")):t=this.getAttribute("data-title")||"",t}set title(t){this.setAttribute("data-title",t),this.setAttribute("aria-label",t)}get reverse(){return null!==this.getAttribute("reverse")||this.classList.contains("reverse")}set reverse(t){t?this.setAttribute("reverse",""):this.removeAttribute("reverse")}get htmlFor(){return this.getAttribute("for")}set htmlFor(t){this.setAttribute("for",t)}get align(){return this.getAttribute("align")||"auto"}set align(t){this.setAttribute("align",t)}get eventType(){return this.getAttribute("eventtype")||"hover"}set eventType(t){this.setAttribute("eventtype",t)}get trigger(){const t=this.htmlFor;let e;return t&&(e=document.getElementById(t)),e||this}create(){let t=this.trigger,e=this.title,i=document.createElement("div");if(i.classList.add("ui-tips-x"),i.innerHTML=e,!t.getAttribute("aria-label")){const e="lulu_"+(Math.random()+"").replace("0.","");t.setAttribute("aria-labelledby",e)}document.body.appendChild(i),this.target=i,this.dispatchEvent(new CustomEvent("DOMContentLoaded")),t!=this&&t.dispatchEvent(new CustomEvent("DOMContentLoaded"))}show(){let t=this.trigger,e=this.title;this.target?this.target.innerHTML=e:this.create(),this.target.style.display="block";let i="5-7",s=this.align;const a=this.reverse;"auto"===s&&(s=t.dataset.align||t.dataset.position||"center"),"center"===s?i=a?"7-5":"5-7":"left"===s?i=a?"4-1":"1-4":"right"===s?i=a?"3-2":"2-3":/^\d-\d$/.test(s)&&(i=s),t.follow(this.target,{position:i,edgeAdjust:!1}),t.dispatchEvent(new CustomEvent("show",{detail:{type:"ui-tips"}}))}hide(){this.target&&(this.target.style.display="none",this.trigger.dispatchEvent(new CustomEvent("hide",{detail:{type:"ui-tips"}})))}events(){let t=this.trigger;this.timerTips=null,this.handleMouseEnter=()=>{this.timerTips=setTimeout((()=>{this.show()}),100)},this.handleMouseLeave=()=>{clearTimeout(this.timerTips),this.hide()},this.handleFocus=()=>{window.isKeyEvent&&this.show()},this.handleMouseUp=e=>{const i=e.target;t.contains(i)||this.target.contains(i)||this.hide()},"hover"===this.eventType?(t.addEventListener("mouseenter",this.handleMouseEnter),t.addEventListener("mouseleave",this.handleMouseLeave),t.addEventListener("focus",this.handleFocus),t.addEventListener("blur",this.hide)):"click"===this.eventType?(t.addEventListener("click",this.show),document.addEventListener("mouseup",this.handleMouseUp)):this.show()}connectedCallback(){let t=this.trigger;t.originTitle=this.title,/^a|input|button|area$/i.test(t.tagName)||(t.setAttribute("tabindex","0"),t.setAttribute("role","tooltip")),this.events(),this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-tips"}})),t!=this&&t.hasAttribute("is-tips")&&(t.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-tips"}})),t.setAttribute("defined","")),this.isConnectedCallback=!0}}customElements.get("ui-tips")||customElements.define("ui-tips",Tips),window.Tips=Tips,HTMLElement.prototype.tips=function(t,e={}){if("css"===this.getAttribute("is-tips")||this.classList.contains("ui-tips"))return void(this.title&&(this.setAttribute("data-title",this.title),this.setAttribute("aria-label",this.title),this.removeAttribute("title")));if("string"!=typeof t&&(e=t||{}),this["ui-tips"])return void(void 0!==e.eventType&&"hover"!=e.eventType&&"click"!=e.eventType&&this["ui-tips"].show());let i=document.createElement("ui-tips");i.title="string"==typeof t?t:this.getAttribute("title")||e.content||"",this.removeAttribute("title"),this.id||(this.id="lulu_"+(Math.random()+"").replace("0.","")),i.htmlFor=this.id,e.eventType&&(i.eventType=e.eventType),e.align&&(i.align=e.align),this["ui-tips"]=i,i.addEventListener("connected",(function(){this.remove()})),document.body.appendChild(i)},function(){let t=function(){const t=".ui-tips, [is-tips]";document.querySelectorAll(t).forEach((t=>{t.tips&&t.tips()})),new MutationObserver((function(e){e.forEach((function(e){var i=e.addedNodes,s=e.removedNodes;i.length&&i.forEach((function(e){e.matches&&(e.matches(t)?e.tips():e.querySelectorAll(t).forEach((t=>{t.tips()})))})),s.length&&s.forEach((function(e){e.matches&&(e["ui-tips"]&&e["ui-tips"].target?e["ui-tips"].target.remove():e.querySelectorAll(t).forEach((function(t){t["ui-tips"]&&t["ui-tips"].target&&t["ui-tips"].target.remove()})))}))}))})).observe(document.body,{childList:!0,subtree:!0})};"loading"!=document.readyState?t():window.addEventListener("DOMContentLoaded",t)}();class LightTip extends HTMLElement{static get observedAttributes(){return["open"]}constructor(){super(),arguments.length&&LightTip.custom.apply(this,arguments)}get type(){return this.getAttribute("type")}get time(){let t=this.getAttribute("time");return isNaN(t)||isNaN(parseFloat(t))?3e3:Number(t)}set type(t){this.setAttribute("type",t)}set time(t){this.setAttribute("time",t)}get open(){return this.hasAttribute("open")}set open(t){this.toggleAttribute("open",t)}connectedCallback(){this.setAttribute("tabIndex",0),this.setAttribute("role","tooltip"),this.closeMode||(this.closeMode="hide"),this.addEventListener("click",(()=>{this[this.closeMode]()})),this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-lighttip"}})),this.isConnectedCallback=!0}attributeChangedCallback(t,e,i){"open"==t&&typeof e!=typeof i&&("string"==typeof i?(clearTimeout(this.timer),this.timer=setTimeout((()=>{this[this.closeMode]()}),this.time),this.classList.add("ESC"),this.zIndex()):this.classList.remove("ESC"),this.tabIndex())}zIndex(){var t=19;this.parentElement&&[...this.parentElement.childNodes].forEach((function(e){if(1==e.nodeType){var i=window.getComputedStyle(e),s=1*i.zIndex;s&&"none"!=i.display&&(t=Math.max(s+1,t))}})),this.style.zIndex=t}tabIndex(){var t=LightTip.lastActiveElement;if(1==this.open){var e=document.activeElement;this!==e&&(LightTip.lastActiveElement=e),this.focus()}else t&&!t.matches("body")&&(t.focus({preventScroll:!0}),window.isKeyEvent||t.blur(),LightTip.lastActiveElement=null);return this}static success(t,e=3e3){return this.custom(t,"success",e)}static error(t,e=3e3){return this.custom(t,"error",e)}static normal(t,e=3e3){return this.custom(t,"normal",e)}static loading(t){return t=t||"正在加载中...",this.custom(t,"loading")}static custom(t="",e,i){if(!this.matches||!this.matches("ui-lighttip"))return LightTip.custom.apply(document.createElement("ui-lighttip"),arguments);if("object"==typeof t&&(e=t,t=""),"string"!=typeof t)return this;if(this.closeMode="remove",e&&"object"==typeof e)LightTip.custom.call(this,t,e.type,e.time);else{if("number"!=typeof e)return"loading"==e&&(t||(t="正在加载中..."),i=999999),i&&(this.time=i),e&&(this.type=e),this.innerHTML=t,"success"==e?this.setAttribute("aria-lable","操作成功"):"error"==e&&this.setAttribute("aria-lable","操作失败"),this.parentElement||(document.body.appendChild(this),this.dispatchEvent(new CustomEvent("DOMContentLoaded"))),this.show(),this;LightTip.custom.call(this,t,i,e)}}remove(){this.parentElement&&this.parentElement.removeChild(this),this.open=!1}show(){this.time>0&&(this.open=!0)}hide(){this.open=!1}}customElements.get("ui-lighttip")||customElements.define("ui-lighttip",LightTip),window.LightTip=LightTip;class ErrorTip{static allHide(t){ErrorTip.collectionErrorTip.forEach((e=>{t!=e&&e.hide()}))}constructor(t,e,i){const s={unique:!0,onShow:()=>{},onHide:()=>{},...i};let a=e;if("function"==typeof a&&(a=a()),"string"!=typeof a)return this;const n=t;let r,o=n.data&&n.data.errorTip;if(o)return o.content=a,o.callback={show:s.onShow,hide:s.onHide},o.element.tips.trigger=n,o.show(),this;let l=ErrorTip.collectionErrorTip;const d=l[l.length-1];r=1==s.unique&&d?d.element.tips:0==s.unique&&n.data&&n.data.errorTip?n.data.errorTip.element.tips:this.create(),1==s.unique&&0==l.includes(this)&&l.push(this),r.trigger=n,this.element={trigger:n,tips:r},this.callback={show:s.onShow,hide:s.onHide},this.params={unique:s.unique},this.content=a,n.data||(n.data={}),n.data.errorTip=this,this.show()}create(){let t=document.createElement("div");return t.className="ui-tips-x ui-tips-error",document.body.appendChild(t),this.events(t),t}events(t){document.addEventListener("keydown",(t=>{/Control|Shift/i.test(t.code)||(ErrorTip.allHide(this),this.hide())})),document.addEventListener("mousedown",(e=>{const i=document.activeElement,s=t.trigger,a=e.target;i&&s&&i==a&&i==s&&!s.getAttribute("data-focus")||(ErrorTip.allHide(this),this.hide())})),window.addEventListener("resize",(()=>{ErrorTip.allHide(this),this.hide()}))}show(){const t=this.element,e=t.tips,i=t.trigger;e.innerHTML=this.content,e.style.display="",i.follow(e,{position:"5-7",edgeAdjust:!1}),i.setAttribute("aria-label","错误提示："+this.content),i.toggleAttribute("is-error",!0),i.classList.add("valided"),this.display=!0,this.callback&&this.callback.show&&this.callback.show.call(this,i,e),i.dispatchEvent(new CustomEvent("show",{detail:{type:"ui-errortip",content:this.content}}))}hide(){if(!this.display)return;const t=this.element.tips,e=this.element.trigger;e.removeAttribute("aria-label"),e.removeAttribute("is-error"),t.style.display="none",this.display=!1,this.callback&&this.callback.hide&&this.callback.hide.call(this,e,t),e.dispatchEvent(new CustomEvent("hide",{detail:{type:"ui-errortip"}}))}}ErrorTip.collectionErrorTip=[],window.ErrorTip=ErrorTip,HTMLElement.prototype.errorTip=function(t,e={}){return new ErrorTip(this,t,e),this},(()=>{let t="loading",e="ui-loading";Object.defineProperty(HTMLElement.prototype,"loading",{configurable:!0,enumerable:!0,get(){return!(!this.classList.contains(e)&&!this.matches(e))},set(i){let s="remove";if(i&&(s="add",this.loading))return i;let a=e.replace(t,"button");this.classList.contains(a)||this.getAttribute("is")==a?this.classList[s](t):this.classList[s](e)}});let i=null,s=null;Object.defineProperty(document,"loading",{get:()=>Boolean(i&&document.querySelector("ui-lighttip[type=loading]")),set(t){if(t){i?(document.body.append(i),i.open=!0):i=new LightTip({type:"loading"});let e=0,a=["正在加载中<ui-dot>...</ui-dot>","仍在加载中<ui-dot>...</ui-dot>","请再稍等片刻<ui-dot>...</ui-dot>"];"string"==typeof t?a=[t]:Array.isArray(t)&&(a=t),i.innerHTML=a[e],clearInterval(s),s=setInterval((()=>{e++,i.innerHTML=a[e]||a[e-1],e>=a.length-1&&clearInterval(s)}),6e3)}else i&&i.remove(),clearInterval(s)}})})();class Loading extends HTMLElement{constructor(){super()}get size(){return this.getAttribute("size")||2}set size(t){this.setAttribute("size",t)}get rows(){return this.getAttribute("rows")}set rows(t){this.setAttribute("rows",t)}}customElements.define("ui-loading",Loading);class XRange extends HTMLInputElement{static get observedAttributes(){return["max","min","step","disabled"]}get defaultrange(){return this.getAttribute("range")||`${this.getAttribute("from")||this.min||0},${this.getAttribute("to")||this.max||100}`}set vertical(t){return this.toggleAttribute("vertical",t)}get vertical(){return null!==this.getAttribute("vertical")}set multiple(t){return this.toggleAttribute("multiple",t)}get multiple(){return null!==this.getAttribute("multiple")}get from(){return this.element&&this.element.otherRange?Math.min(this.value,this.element.otherRange.value):""}get to(){return this.element&&this.element.otherRange?Math.max(this.value,this.element.otherRange.value):""}get range(){return this.multiple?this.from+","+this.to:""}get isFrom(){return!(!this.element||!this.element.otherRange)&&this.value-this.element.otherRange.value<0}set from(t){this.element&&this.element.otherRange&&(this.isFrom?this.value=t:this.element.otherRange.value=t)}set to(t){this.element&&this.element.otherRange&&(this.isFrom?this.element.otherRange.value=t:this.value=t)}set range(t){if(this.multiple){const[e,i]=t.split(",");this.to=i,this.from=e}}connectedCallback(){this.tips=this.dataset.tips,this.addEventListener("input",this.render),this.addEventListener("change",this.change),this.addEventListener("touchstart",this.stopPropagation),this.vertical&&(this.resizeObserver=new ResizeObserver((t=>{for(let e of t){const{height:t}=e.contentRect;this.style.setProperty("--h",t+"px")}})),this.resizeObserver.observe(this)),this.element=this.element||{},this.multiple&&!this.element.otherRange&&("static"===getComputedStyle(this.parentNode).position&&(this.parentNode.style.position="relative"),Object.assign(this.element,{otherRange:this.cloneNode(!1)}),this.element.otherRange.tips=this.tips,this.element.otherRange.element={otherRange:this},this.vertical?(this.after(this.element.otherRange),this.setAttribute("data-range","from"),this.element.otherRange.setAttribute("data-range","to")):(this.before(this.element.otherRange),this.setAttribute("data-range","to"),this.element.otherRange.setAttribute("data-range","from")),this.range=this.defaultrange),null===this.getAttribute("is")&&this.setAttribute("is","ui-range"),this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-range"}})),this.isConnectedCallback=!0,this.render(),this.dispatchEvent(new CustomEvent("DOMContentLoaded"))}disconnectedCallback(){this.removeEventListener("input",this.render),this.removeEventListener("change",this.change),this.removeEventListener("touchstart",this.stopPropagation),this.vertical&&this.resizeObserver.unobserve(this),this.element&&this.element.otherRange&&!this.exchange&&this.element.otherRange.remove()}stopPropagation(t){t.stopPropagation()}attributeChangedCallback(t,e,i){e!==i&&("disabled"===t&&this.element&&this.element.otherRange?this.element.otherRange.disabled=null!==i:this.render())}change(){if(!this.element||!this.element.otherRange)return;const t=!this.isFrom&&this.nextElementSibling===this.element.otherRange&&!this.vertical,e=this.isFrom&&this.nextElementSibling!==this.element.otherRange&&!this.vertical,i=!this.isFrom&&this.nextElementSibling!==this.element.otherRange&&this.vertical,s=this.isFrom&&this.nextElementSibling===this.element.otherRange&&this.vertical;(i||e||s||t)&&(this.exchange=!0,i||e?(this.element.otherRange.before(this),this.setAttribute("data-range","from"),this.element.otherRange.setAttribute("data-range","to")):(this.element.otherRange.after(this),this.setAttribute("data-range","to"),this.element.otherRange.setAttribute("data-range","from")),this.exchange=!1,this.focus())}render(){const t=this.max||100,e=this.min||0;this.style.setProperty("--percent",(this.value-e)/(t-e)),"string"==typeof this.tips&&(/^\d+$/.test(this.tips)?this.dataset.tips=this.value:/^\${value}/.test(this.tips)?this.dataset.tips=this.tips.replace(/\${value}/g,this.value):this.dataset.tips=this.tips.replace(/\d+/,this.value)),this.style.setProperty("--from",this.from),this.style.setProperty("--to",this.to),this.element&&this.element.otherRange&&(this.element.otherRange.style.setProperty("--from",this.from),this.element.otherRange.style.setProperty("--to",this.to))}addEventListener(...t){document.addEventListener.apply(this,t),this.element&&this.element.otherRange&&document.addEventListener.apply(this.element.otherRange,t)}}const props=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");Object.defineProperty(XRange.prototype,"value",{...props,set(t){props.set.call(this,t),this.render()}}),customElements.get("ui-range")||customElements.define("ui-range",XRange,{extends:"input"});const BG_COLOR="background-color";class Color extends HTMLInputElement{static get observedAttributes(){return["disabled"]}constructor(){super(),this.setProperty()}static addClass(...t){return["ui","color",...t].join("-")}static funHslToHex(t,e,i,s){let a,n,r;if(0==e)a=n=r=i;else{const s=function(t,e,i){return i<0&&(i+=1),i>1&&(i-=1),i<1/6?t+6*(e-t)*i:i<.5?e:i<2/3?t+(e-t)*(2/3-i)*6:t},o=i<.5?i*(1+e):i+e-i*e,l=2*i-o;a=s(l,o,t+1/3),n=s(l,o,t),r=s(l,o,t-1/3)}const o=[Math.round(255*a),Math.round(255*n),Math.round(255*r)];return s&&o.push(Math.round(255*s)),o.map((t=>1==(t=t.toString(16)).length?"0"+t:t)).join("")}static funHexToHsl(t){3!=(t=(t||"").replace("#","")).length&&4!=t.length||(t=t.split("").map((function(t){return t+t})).join(""));const e=parseInt(t.slice(0,2),16)/255,i=parseInt(t.slice(2,4),16)/255,s=parseInt(t.slice(4,6),16)/255,a=Math.max(e,i,s),n=Math.min(e,i,s);let r,o;const l=(a+n)/2;if(a==n)r=o=0;else{const t=a-n;switch(o=l>.5?t/(2-a-n):t/(a+n),a){case e:r=(i-s)/t+(i<s?6:0);break;case i:r=(s-e)/t+2;break;case s:r=(e-i)/t+4}r/=6}if(8==t.length){return[r,o,l,parseInt(t.slice(6,8),16)/255]}return[r,o,l]}static funRgbToHex(t){if(!t)return Color.defaultValue;let e=[],i=[];if(t=t.replace("#","").toLowerCase(),/^[0-9A-F]{1,6}$/i.test(t))return"#"+t.repeat(Math.ceil(6/t.length)).slice(0,6);if(/^[0-9A-F]{1,8}$/i.test(t))return"#"+t.repeat(Math.ceil(8/t.length)).slice(0,8);e=t.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)/i),i=t.match(/^rgba\((\d+),\s*(\d+),\s*(\d+),\s*([0|1]?\.?\d+)/i);const s=t=>("0"+parseInt(t,10).toString(16)).slice(-2);return e&&4==e.length?`#${s(e[1])}${s(e[2])}${s(e[3])}`:i&&5==i.length?`#${s(i[1])}${s(i[2])}${s(i[3])}${Math.round(255*i[4]).toString(16).padStart(2,"0")}`:Color.defaultValue}get type(){return this.getAttribute("type")||"color"}set type(t){return this.setAttribute("type",t||"color")}events(){const t=this.element,e=t.target,i=t.circle,s=t.fill,a=t.arrow,n=t.field,r=t.opacity;e.addEventListener("click",(e=>{const i=e.target;let s="";const a=i.className;/cancel/.test(a)?this.hide():/lump/.test(a)?(s=i.getAttribute("data-color"),this.value="#"+s):/switch/.test(a)&&("更多"===i.textContent?(t.more.style.display="block",t.basic.style.display="none",i.textContent="基本",t.mode.setAttribute("data-mode","basic")):(t.more.style.display="none",t.basic.style.display="block",i.textContent="更多",t.mode.setAttribute("data-mode","more")),this.match())})),n.addEventListener("input",(()=>{const t=this.value;/^[0-9A-F]{6}$/i.test(t)||/^[0-9A-F]{8}$/i.test(t)?this.match():/^[0-9A-F]{3, 4}$/i.test(t)&&this.match(Color.funRgbToHex("#"+t).replace("#",""))})),n.addEventListener("keyup",(t=>{if(13==t.keyCode){let t=n.value;t&&(t=r?Color.funRgbToHex("#"+t).replace("#",""):Color.funRgbToHex("#"+t.slice(0,6)).replace("#",""),this.value="#"+t),this.hide()}})),r&&r.addEventListener("input",(()=>{let t=n.value,e=Math.round(r.value/100*255).toString(16).padStart(2,"0");if(t){let i=t.slice(0,6)+e;this.value=i}}));const o={},l={};return a.addEventListener("pointerdown",(t=>{t.preventDefault(),o.pageY=t.pageY,o.top=parseFloat(window.getComputedStyle(a).top)})),s.addEventListener("pointerdown",(t=>{t.preventDefault();const e=t.target.getBoundingClientRect(),i=t.pageY-window.pageYOffset-e.top;a.style.top=i+"px",this.isTrustedEvent=!0,this.value=this.getValueByStyle(),o.pageY=t.pageY,o.top=parseFloat(window.getComputedStyle(a).top)})),i.parentElement.querySelectorAll("a").forEach((t=>{t.addEventListener("pointerdown",(t=>{t.preventDefault(),l.pageY=t.pageY,l.pageX=t.pageX,i.style.left=t.offsetX+"px",i.style.top=t.offsetY+"px",l.top=parseFloat(t.offsetY),l.left=parseFloat(t.offsetX),this.isTrustedEvent=!0,this.value=this.getValueByStyle()}))})),document.addEventListener("pointermove",(t=>{if("number"==typeof o.top){t.preventDefault();let e=o.top+(t.pageY-o.pageY);const i=a.parentElement.clientHeight;e<0?e=0:e>i&&(e=i),a.style.top=e+"px",this.isTrustedEvent=!0,this.value=this.getValueByStyle()}else if("number"==typeof l.top){t.preventDefault();const e={top:t.pageY-l.pageY+l.top,left:t.pageX-l.pageX+l.left},s={top:i.parentElement.clientHeight,left:i.parentElement.clientWidth};e.left<0?e.left=0:e.left>s.left&&(e.left=s.left),e.top<0?e.top=0:e.top>s.top&&(e.top=s.top);const a=e.left/s.left,n=1-e.top/s.top;i.style.left=e.left+"px",i.style.top=e.top+"px";const r=`hsl('${[360*a,100*n+"%","50%"].join()})`;i.style[BG_COLOR]=r,this.isTrustedEvent=!0,this.value=this.getValueByStyle()}}),{passive:!1}),document.addEventListener("pointerup",(()=>{o.top=null,l.top=null})),s.parentElement.querySelectorAll("a").forEach((t=>{t.addEventListener("keydown",(t=>{if(38==t.keyCode||40==t.keyCode){t.preventDefault();let e=parseFloat(window.getComputedStyle(a).top);const i=s.clientHeight;38==t.keyCode?(e--,e<0&&(e=0)):(e++,e>i&&(e=i));const n=a.getAttribute("aria-label");a.style.top=e+"px",a.setAttribute("aria-label",n.replace(/\d+/,Math.round(100*e/i))),this.isTrustedEvent=!0,this.value=this.getValueByStyle()}}))})),i.parentElement.querySelectorAll("a").forEach((t=>{t.addEventListener("keydown",(e=>{if(e.keyCode>=37&&e.keyCode<=40){e.preventDefault();const s=window.getComputedStyle(i);let a=parseFloat(s.top),n=parseFloat(s.left);const r=t.clientHeight,o=t.clientWidth;38==e.keyCode?(a--,a<0&&(a=0)):40==e.keyCode?(a++,a>r&&(a=r)):37==e.keyCode?(n--,n<0&&(n=0)):39==e.keyCode&&(n++,n>o&&(n=o)),i.style.left=n+"px",i.style.top=a+"px",this.isTrustedEvent=!0,this.value=this.getValueByStyle()}}))})),this}create(){const t=this.element.target,e="color-opacity"===this.type,i=`<button class="${Color.addClass("switch")} colorMode" data-mode="more" role="button">更多</button>`,s=`<div class="${Color.addClass("current")}">\n            <i class="${e?Color.addClass("current","square","opacity"):Color.addClass("current","square")} colorCurrent"></i>\n            #<input class="${Color.addClass("current","input")}" value="${this.value.replace("#","")}">\n        </div>`,a=this.params.color.basicPreset,n=this.params.color.fixed,r=`<div class="${Color.addClass("body")}">`+function(){let t=`<div class="${Color.addClass("basic")} colorBasicX" role="listbox">`,i=(localStorage.commonColors||"").split(",");return t+=`<aside class="${Color.addClass("basic","l")}">`+n.concat(i[0]||"0ff",i[1]||"800180").map((function(t){const e=Color.funRgbToHex(t).replace("#","");return`<a href="javascript:" class="${Color.addClass("lump")}" data-color="${e}" aria-label="${e}" style="${BG_COLOR}:#${e}" role="option"></a>`})).join("")+"</aside>",t=t+`<div class="${Color.addClass("basic","r")}">`+function(){let t="";return a.forEach((i=>{t+=`<a href="javascript:" title="#${i}${e?"ff":""}" class="${Color.addClass("lump","preset")}" data-color="${i}${e?"ff":""}" style="${BG_COLOR}:#${i}${e?"ff":""}" aria-label="${i}${e?"ff":""}" role="option"></a>`})),t}()+"</div>",t+"</div>"}()+function(){let t=`<div class="${Color.addClass("more")} colorMoreX">`;return t+=`<div class="${Color.addClass("more","l")}">\n                <a href="javascript:" class="${Color.addClass("cover","white")}" aria-label="色域背景块" role="region"></a><div class="${Color.addClass("circle")} colorCircle"></div>\n                <div class="${Color.addClass("gradient")}">\n                </div>\n                </div><div class="${Color.addClass("more","r")}">\n                    <div class="${Color.addClass("more","fill")} colorFill">\n                        <a href="javascript:" class="${Color.addClass("more","cover")}" aria-label="明度控制背景条" role="region"></a>\n                        <div class="${Color.addClass("gradient")}" style="background: linear-gradient(#ffffff 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,0) 50%, ${Color.defaultValue} 100%);">\n                        </div>\n                    </div>\n                    <a href="javascript:" class="${Color.addClass("more","arrow")} colorArrow" role="slider" aria-label="明度控制按钮：100%"></a>\n                </div>`,t+"</div>"}()+function(){if(e){return`<div class="${Color.addClass("opacity")}">透明度：<input class="${Color.addClass("opacity","range")} colorOpacity"type="range"  value="100" min="0" max="100" step="1" data-tips="\${value}%" is="ui-range"></div>`}return""}()+"</div>";t.innerHTML=i+s+r+"",Object.assign(this.element,{field:t.querySelector("input"),basic:t.querySelector(".colorBasicX"),more:t.querySelector(".colorMoreX"),mode:t.querySelector(".colorMode"),opacity:t.querySelector(".colorOpacity"),circle:t.querySelector(".colorCircle"),fill:t.querySelector(".colorFill"),arrow:t.querySelector(".colorArrow"),current:t.querySelector(".colorCurrent")});const o=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");let l=this.element.field;return Object.defineProperty(l,"value",{...o,set(t){o.set.call(this,t),l.dispatchEvent(new CustomEvent("change"))}}),0==document.body.contains(t)&&document.body.appendChild(t),this.events(),this}match(t){if(1!=this.display)return this;const e=this.element,i=e.target,s=e.current,a=e.more,n=e.circle,r=e.fill,o=e.arrow,l=e.field,d=e.opacity;let c=!0;!1===t&&(c=!1);let h=t||l.value;if(""==h&&(h=Color.funRgbToHex(getComputedStyle(s)[BG_COLOR]).replace("#",""),l.value=h),h=h.replace("#",""),d?(/^[0-9A-F]{8}$/i.test(h)&&(d.value=parseInt(h.slice(6,8),16)/255*100),/^[0-9A-F]{6}$/i.test(h)&&(l.value+=Math.round(d.value/100*255).toString(16).padStart(2,"0"))):s.style[BG_COLOR]="#"+h,"none"==window.getComputedStyle(a).display){const t=i.querySelector(".active");t&&t.classList.remove("active");const e=i.querySelector(`a[data-color="${h.toUpperCase()}"]`);e&&e.classList.add("active")}else{let t=n.parentElement.clientWidth,e=n.parentElement.clientHeight,i=0,s=1,a=.5;if(1==c){let r=Color.funHexToHsl(h);i=r[0],s=r[1],a=r[2],n.style.left=t*i+"px",n.style.top=e*(1-s)+"px",o.style.top=o.parentElement.clientHeight*(1-a)+"px"}else i=parseFloat(n.style.left||0)/t,s=1-parseFloat(n.style.top||0)/e;let l=`hsl(${[360*i,Math.round(100*s)+"%","50%"].join()}`;r.style[BG_COLOR]=l,n.style[BG_COLOR]=l}return this}position(){return this.follow(),this}show(){let t=this.element.target;""==t.innerHTML.trim()&&this.create(),this.display=!0,t.style.display="inline",t.classList.add("ESC"),this.setAttribute("aria-expanded","true"),this.position();const e=this.element.current;return e.getAttribute("style")||(e.style[BG_COLOR]=this.value),this.match(),this.dispatchEvent(new CustomEvent("show",{detail:{type:"ui-color"}})),this}hide(){let t=this.element.target;return t.style.display="none",t.classList.remove("ESC"),this.setAttribute("aria-expanded","false"),this.display=!1,this.focus(),this.dispatchEvent(new CustomEvent("hide",{detail:{type:"ui-color"}})),this}setProperty(){Object.defineProperty(this,"getValueByStyle",{value:()=>{const t=this.element.circle,e=this.element.arrow,i=this.element.opacity;if(t.length*e.length==0)return Color.defaultValue;let s,a,n;return s=t.style.left?parseFloat(window.getComputedStyle(t).left)/t.parentElement.clientWidth:0,a=t.style.top?1-parseFloat(window.getComputedStyle(t).top)/t.parentElement.clientHeight:1,n=e.style.top?1-parseFloat(window.getComputedStyle(e).top)/e.parentElement.clientHeight:0,i&&i.value?"#"+Color.funHslToHex(s,a,n,i.value/100):"#"+Color.funHslToHex(s,a,n)}});const t=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value");Object.defineProperty(Color.prototype,"value",{...t,set(e){let i=e,s=this.value;if("string"==typeof e){if(/^[a-z]{3,}$/.test(i)&&(document.head.style.backgroundColor=i,i=window.getComputedStyle(document.head).backgroundColor,document.head.style.backgroundColor=""),i=Color.funRgbToHex(i),t.set.call(this,i),!this.params)return;let e=(localStorage.commonColors||"").split(",");if(0==this.params.color.fixed.some((t=>Color.funRgbToHex(t)==i))){e=e.filter((t=>t&&t!=i.replace("#",""))),e.unshift(i.replace("#","")),localStorage.commonColors=e.join();const t=this.element.basic;if(t){const s=t.querySelectorAll("aside a"),a=s[s.length-2],n=s[s.length-1];a.setAttribute("data-color",e[0]),a.setAttribute("aria-label",e[0]),a.style[BG_COLOR]=i;const r=e[1]||"0ff";n.setAttribute("data-color",r),n.setAttribute("aria-label",r),n.style[BG_COLOR]="#"+r}}this.style.setProperty("--ui-color-opacity",i),this.element.target.style.setProperty("--ui-color-opacity",i),this.element.field&&(this.element.field.value=i.replace("#","")),this.isTrustedEvent?(this.match(!1),this.isTrustedEvent=null):this.match()}else s||(s=Color.defaultValue,t.set.call(this,s));s&&i!=s&&(this.dispatchEvent(new CustomEvent("change",{bubbles:!0})),this.dispatchEvent(new CustomEvent("input",{bubbles:!0})))}}),this.title||(this.title=(this.disabled?"禁止":"")+"颜色选择")}attributeChangedCallback(t){"disabled"==t&&("颜色选择"==this.title&&this.disabled?this.title="禁止颜色选择":"禁止颜色选择"!=this.title||this.disabled||(this.title="颜色选择"))}connectedCallback(){this.id||(this.id="lulu_"+(Math.random()+"").split(".")[1]),this.addEventListener("click",(t=>{t.preventDefault(),1!=this.display&&this.show()})),this.dataset.position||(this.dataset.position="7-5");const t=document.createElement("div");t.classList.add(Color.addClass("container")),t.id=("lulu_"+Math.random()).replace("0.",""),this.dataset.target=t.id,this.element={target:t},"color-opacity"===this.getAttribute("type")&&(this.style.setProperty("--ui-color-opacity",this.value),t.style.setProperty("--ui-color-opacity",this.value));const e=["0","3","6","9","c","f"],i=e.concat("eb4646","1cad70","2a80eb","f59b00");this.params=this.params||{},this.params.color={basic:e,basicPreset:["2a80eb","0057c3","7fdbff","f7f9fa","1cad70","3d9970","39cccc","dddddd","eb4646","ab2526","ef8a5e","a2a9b6","f59b00","de6d00","ffdc00","4c5161"],fixed:i},document.addEventListener("click",(e=>{const i=e&&e.target;i&&this.display&&i!=this&&0==t.contains(i)&&this.hide()})),window.addEventListener("resize",(()=>{this.display&&this.position()})),this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-color"}})),this.isConnectedCallback=!0}}Color.defaultValue="#000000",customElements.get("ui-color")||customElements.define("ui-color",Color,{extends:"input"});const Dialog=(()=>{const t="dialog",e={add:(...t)=>`ui-dialog-${t.join("-")}`,toString:e=>`ui-${e||t}`};let i=function(t){this.element={dialog:t},t.hasAttribute("role")||t.setAttribute("role","dialog"),t.show=this.show.bind(this),t.showModal=this.showModal.bind(this),t.close=this.close.bind(this),t.zIndex=this.zIndex.bind(this),Object.defineProperty(t,"open",{set:this.setOpen.bind(this),get:t.hasAttribute.bind(t,"open")})};i.prototype={get dialog(){return this.element.dialog},show(){this.setOpen(!0),this.zIndex()},showModal(){this.setOpen(!0)},close(){this.setOpen(!1),this.dialog.dispatchEvent(new CustomEvent("close",{bubbles:!1,cancelable:!1}))},setOpen(t){t?this.dialog.setAttribute("open",""):this.dialog.removeAttribute("open")},zIndex(){var t=this.dialog;const e=window.getComputedStyle(t).zIndex;let i=19;document.body.childNodes.forEach((function(e){if(1!==e.nodeType)return;const s=window.getComputedStyle(e),a=1*s.zIndex;a&&t!==e&&"none"!==s.display&&(i=Math.max(a+1,i))})),i!==e&&(t.style.zIndex=i)}};let s=function(s){if(!s.hide||!s.button){if("open"in document.createElement("dialog")==0&&new i(s),"ui-dialog"==s.getAttribute("is")){Object.defineProperties(s,{setParams:{value:function(t){return Object.assign(this.params,t||{}),this.params}},button:{value:function(){const t=this.params,i=this.element;i.footer.innerHTML="";for(const t in i)/^button/.test(t)&&delete i[t];return t.buttons.forEach((function(t,s){let a=(t=t||{}).type,n=t.value;("remind"===a||!a&&0===s)&&(a="primary"),n||(n=["确定","取消"][s]);let r=document.createElement("button");t.for?(r=document.createElement("label"),r.setAttribute("for",t.for)):t.form&&(r.setAttribute("form",t.form),r.type="submit"),t.className&&(r.className=t.className),r.classList.add(e.toString("button")),a&&r.setAttribute("data-type",a),r.disabled=Boolean(t.disabled),r.innerHTML=n,i.footer.appendChild(r),i["button"+s]=r})),t.buttons.forEach(((t,e)=>{t=t||{};const s=i["button"+e];if(!s||t.for||t.form)return;let a=t.events||{click:()=>{this[this.closeMode]()}};"function"==typeof a&&(a={click:a});for(const t in a)s.addEventListener(t,(e=>{e.dialog=this,a[t](e)}));s.addEventListener("focus",(function(){window.isKeyEvent?this.style.outline="":this.style.outline="none"}))})),this}},events:{value:function(){const i=this.element;this.addEventListener("animationend",(function(i){i.target.tagName.toLowerCase()===t&&this.classList.remove(e.add("animation"))}));const s=i.close;return s&&s.addEventListener("click",(()=>{const t=document.activeElement,e=t.getAttribute("data-target");let i=null;e&&(i=document.getElementById(e)),window.isKeyEvent&&i&&t!==s&&document.querySelector('a[data-target="'+e+'"],input[data-target="'+e+'"],button[data-target="'+e+'"]')&&i.clientWidth>0||this[this.closeMode]()})),this.dispatchEvent(new CustomEvent("DOMContentLoaded")),this}},alert:{value:function(t,i){if(!t)return;let s=t;const a={title:"",type:"remind",buttons:[{}]},n={...a,...i};"error"===n.type||"fail"===n.type?n.type="danger":"primary"===n.type&&(n.type="remind"),n.buttons.length&&!n.buttons[0].type&&(n.buttons[0].type=n.type,!1===/^remind|success|warning|danger$/.test(n.type)&&(n.buttons[0].type=a.type));let r=(new DOMParser).parseFromString(s,"text/html").body.childNodes;return 1==r.length?3===r[0].nodeType&&(s='<p class="'+e.add("wrap")+'">'+s+"</p>"):s='<div class="'+e.add("wrap")+'">'+s+"</div>",s='<div class="'+e.add(n.type)+" "+e.add("alert")+'">'+s+"</div>",this.setParams({width:"auto",title:n.title,buttons:n.buttons,content:s}),this.type="alert",this.show(),this}},confirm:{value:function(t,i){if(!t)return;let s=t;const a={title:"",type:"danger",buttons:[{},{}]},n={...a,...i};"error"!==n.type&&"fail"!==n.type||(n.type="danger"),"primary"===n.type&&(n.type="remind"),n.buttons.length&&!n.buttons[0].type&&(n.buttons[0].type=n.type,!1===/^remind|success|warning|danger$/.test(n.type)&&(n.buttons[0].type=a.type));let r=(new DOMParser).parseFromString(s,"text/html").body.childNodes;return 1==r.length?3===r[0].nodeType&&(s='<p class="'+e.add("wrap")+'">'+s+"</p>"):s='<div class="'+e.add("wrap")+'">'+s+"</div>",s='<div class="'+e.add(n.type)+" "+e.add("confirm")+'">'+s+"</div>",this.setParams({width:"auto",title:n.title,buttons:n.buttons,content:s}),this.type="confirm",this.show(),this}},loading:{value:function(){const t=this.element;return this.params.content='<ui-loading rows="10" size="3"></ui-loading>',t.dialog.classList.add(e.add("loading")),this.show(),this}},content:{get(){return this.params.content},set(t){if(t!=this.params.content)return void(this.params.content=t);let i=this.element.body;if(this.element.dialog.classList.remove(e.add("loading")),"function"==typeof t)t=t();else if("string"==typeof t&&/^#?\w+(?:[-_]\w+)*$/i.test(t)){let e=document.querySelector(t);e&&(t=e.matches("textarea")?e.value:e.matches("script")?e.innerHTML:e)}if(this.closeMode="string"==typeof t?"remove":"hide","hide"==this.closeMode&&i.innerHTML){let t=document.createElement("div");t.setAttribute("hidden",""),i.childNodes.forEach((e=>{t.appendChild(e)})),document.body.appendChild(t)}if(i.innerHTML="","remove"==this.closeMode)i.innerHTML=t;else{let e=t.parentElement,s=e&&e.matches("div[hidden]");i.appendChild(t),s&&""===e.innerHTML.trim()&&e.remove(),1===t.nodeType&&"none"==getComputedStyle(t).display&&(t.removeAttribute("hidden"),t.style.display="","none"==getComputedStyle(t).display&&(t.style.display="revert"))}}},scrollbar:{value:function(){const t=document.querySelectorAll('dialog[is="ui-dialog"]'),e=[].slice.call(t).some((function(t){return"none"!==window.getComputedStyle(t).display}));document.documentElement.style.overflow="",document.body.style.borderRight="";let i=window.innerWidth-document.documentElement.clientWidth;return e&&(document.documentElement.style.overflow="hidden",document.body.style.borderRight=i+"px solid transparent"),this}},tabindex:{value:function(){var t=this.element.dialog,e=this.lastActiveElement;if(1==this.open){var i=document.activeElement;"alert"==this.type||"confirm"==this.type?(this.element.button0!=i&&(this.lastActiveElement=i),this.element.button0.focus()):t&&(t!=i&&(this.lastActiveElement=i),t.focus())}else e&&"body"!=e.tagName.toLowerCase()&&(e.focus(),e.blur(),this.lastActiveElement=null);return this}},show:{value:function(){return!0!==this.open&&this.classList.add(e.add("animation")),this.open=!0,this.zIndex&&this.zIndex(),this.dispatchEvent(new CustomEvent("show",{detail:{type:"ui-dialog"}})),this}},hide:{value:function(){return this.close(),this.dispatchEvent(new CustomEvent("hide",{detail:{type:"ui-dialog"}})),this}},remove:{value:function(){return this.open=!1,this.parentElement.removeChild(this),this.dispatchEvent(new CustomEvent("remove",{detail:{type:"ui-dialog"}})),this}}}),s.params=new Proxy(s.params||{},{get:(t,e)=>t[e],set(t,i,a){if(!s.element)return!1;if(t[i]=a,"title"==i&&s.element.title)s.element.title.innerHTML=a;else if("content"==i)s.content=a;else if("buttons"==i)s.button();else if(s.element.dialog&&("width"==i||"height"==i)){let t=s.element.dialog;t.classList.remove(e.add("stretch")),""!==a&&Number(a)==a?t.style[i]=a+"px":"height"==i&&"stretch"==a?t.classList.add(e.add(a)):("auto"==a&&(a=""),t.style[i]=a)}return!0}});const i=document.createElement("div");i.classList.add(e),i.setAttribute("tabindex","-1");const a=document.createElement("h4");a.classList.add(e.add("title")),a.innerHTML=s.title,s.removeAttribute("title");const n=("lulu_"+Math.random()).replace("0.",""),r=document.createElement("button");r.textContent="关闭",r.classList.add(e.add("close"),"ESC"),r.id=n,r.setAttribute("data-target",n);const o=document.createElement("div");o.classList.add(e.add("body"));const l=document.createElement("div");l.classList.add(e.add("footer")),s.element=Object.assign(s.element||{},{dialog:i,close:r,title:a,body:o,footer:l});let d=[...s.childNodes];d.length&&d.forEach((t=>{o.append(t)})),i.append(r,a,o,l),s.append(i),new MutationObserver((function(t){t.forEach((t=>{let e=t.target;"attributes"==t.type&&(e.scrollbar(),e.tabindex())}))})).observe(s,{attributes:!0,attributeFilter:["open"]}),s.closeMode="hide",s.events()}s.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-dialog"}})),s.setAttribute("defined",""),s.isConnectedCallback=!0}},a=function(){document.querySelectorAll("dialog").forEach((t=>{s(t)})),new MutationObserver((function(t){t.forEach((function(t){t.addedNodes.forEach((function(t){t.matches&&t.matches("dialog")?s(t):t.querySelector&&t.querySelectorAll("dialog").forEach((t=>{s(t)}))}))}))})).observe(document.body,{childList:!0,subtree:!0})};return"loading"!=document.readyState?a():window.addEventListener("DOMContentLoaded",a),class{constructor(e={}){const i={title:"",content:"",width:"auto",height:"auto",buttons:[],onShow:function(){},onHide:function(){},onRemove:function(){},...e},a=document.createElement(t);a.setAttribute("is","ui-dialog"),a.addEventListener("DOMContentLoaded",(()=>{'"{}"'!=JSON.stringify(e)&&(a.setParams({title:i.title,width:i.width,height:i.height,content:i.content,buttons:i.buttons}),"function"==typeof e.onShow&&a.addEventListener("show",(function(t){e.onShow.call(a,t)})),"function"==typeof e.onHide&&a.addEventListener("hide",(function(t){e.onHide.call(a,t)})),"function"==typeof e.onRemove&&a.addEventListener("remove",(function(t){e.onRemove.call(a,t)}))),a.show()}));const n=document.querySelector("body > dialog");return n?n.insertAdjacentElement("beforebegin",a):document.body.appendChild(a),s(a),a}}})();window.Dialog=Dialog;const Datalist=(()=>{const t="datalist",e="disabled",i="active",s="reverse",a={add:e=>["ui",t].concat([e]).join("-"),toString:()=>`ui-${t}`};let n={end:"mouseup"};"ontouchstart"in document&&(n={end:"touchend"});class r extends HTMLInputElement{constructor(){super(),this.params||(this.params={}),this.element||(this.element={})}static stripHTML(t){return"string"==typeof t?t.replace(/<\/?[^<>]*>/g,"").replace(/<\/?[^<>]*>/g,""):""}static encodeHTML(t){return"string"==typeof t?t.replace(/<|&|>/g,(function(t){return{"<":"&lt;",">":"&gt;","&":"&amp;"}[t]})):""}static decodeHTML(t){return"string"==typeof t?t.replace(/&lt;|&gt;|&amp;/gi,(t=>({"&lt;":"<","&gt;":">","&amp;":"&"}[t.toLowerCase()]))):""}setParams(t){Object.assign(this.params,t||{})}convertData(e){if(this.params.data=e||this.params.data,"auto"==this.params.data){let e=this.getAttribute("list");if(e){let t=document.getElementById(e);if(!t)return void setTimeout((()=>{document.getElementById(e)&&this.convertData()}),1);this.removeAttribute("list"),this.params.data=function(){return[].slice.call(t.querySelectorAll("option")).map((function(t){let e={};return[].slice.call(t.attributes).forEach((function(t){e[t.name]=t.value})),e.value=e.value||"",t.hasAttribute("value")||(e.value=t.textContent||""),e.label=e.label||"",e}))}}else!this.name||""!==this.autocomplete&&"on"!=this.autocomplete?this.params.data=function(){return[]}:(this.params.twice=!0,this.params.placeholder=!1,this.params.data=()=>{let e=[],i=localStorage[t+"-"+this.name];return i&&i.split(",").forEach((function(t){t&&t.trim()&&e.push({label:"",value:t})})),e})}else if(this.params.data instanceof Array){let t=this.params.data;this.params.data=function(){return t}}else if("function"==typeof this.params.data);else if("object"==typeof this.params.data&&this.params.data.url){let t=null,e={...this.params.data};this.params.data=()=>{clearTimeout(t),this.name||(this.name="k");let i=this.value.trim();if(""==i)return this.datalist=[],[];let s=new URLSearchParams(e.data);s.append(this.name,i);let a=e.url.split("#")[0];a=a.split("?").length>1?a+"&"+s.toString():a+"?"+s.toString();t=setTimeout((async()=>{const t=await fetch(a);this.setAttribute("aria-busy","true");const i=await t.json();if(this.removeAttribute("aria-busy"),i&&i.data){let t=i.data;this.params.encode&&t.map&&(t=t.map((t=>(t.value&&(t.value=r.encodeHTML(t.value)),t)))),this.refresh(this.params.filter.call(this,t)),e.success&&e.success(i)}else e.error&&e.error(i)}),200)},this.params.placeholder=!1}}store(){const e=this.val(),{name:i}=this;if(e&&i){let s=(localStorage[`${t}-${i}`]||"").split(",");const a=s.indexOf(e);if(-1==a)s.unshift(e);else if(0!=a){let t=s.splice(a,1);s=[t,...s]}localStorage[`${t}-${i}`]=s.join()}return this}removeStore(e){const i=this.name,s=e||this.val();if(s&&i)if(!0===s)localStorage.removeItem(`${t}-${i}`);else if("string"==typeof s){let e=(localStorage[`${t}-${i}`]||"").split(",");const a=e.indexOf(s);-1!=a&&(e.splice(a,1),localStorage[`${t}-${i}`]=e.join())}return this}refresh(e){let i=this.element.target;i||(this.create(),i=this.element.target);const s=this.val();let n=e;if(void 0===n){if("function"!=typeof this.params.data&&this.convertData(),"function"!=typeof this.params.data)return this;if(n=this.params.data(),!n)return this;if(this.params.encode&&n.map&&(n=n.map((t=>(t.value&&(t.value=r.encodeHTML(t.value)),t)))),n=this.params.filter.call(this,n,s),n instanceof Array==0)return this}const o=this.getAttribute("results"),l=Number(o);o&&(n=n.slice(0,l)),this.datalist=n;let d="";if(n&&n.length){this.params.index=-1;const t=this.getAttribute("placeholder"),e=this.params.placeholder;n.forEach(((i,n)=>{let o=i.value||"",l=r.stripHTML(o).trim().replace(/\n/g,""),c=r.stripHTML(i.label||"").trim().replace(/\n/g,""),h="";(s&&l==s||!s&&l==t&&l!=e)&&(h=" selected",this.params.index=n),(i.disabled||"string"==typeof i.disabled)&&(h=" disabled"),d=i.label?`${d}<li class="${a.add("option")}${h}" data-value="${l}" label="${c}" data-index="${n}"><label class="${a.add("label")}">${i.label}</label><span class="${a.add("value")}">${o}</span></li>`:`${d}<li class="${a.add("option")}${h}" data-value="${l}" data-index="${n}"><span class="${a.add("value")}">${o}</span></li>`}))}""!=d&&(d=`<ul class="${a.add(t)}">${d}</ul>`),i.innerHTML=d;const c=i.querySelector(".selected");if(1==this.display&&c){const t=c.offsetTop-(i.lastScrollTop||0);t<0||t>=c.parentElement.clientHeight?(c.parentElement.scrollTop=c.offsetTop,i.lastScrollTop=c.offsetTop):c.parentElement.scrollTop=i.lastScrollTop||0}d?0==this.display&&this.show():1==this.display&&this.hide()}create(){if(!this.element.target){let t=this.element.datalist&&this.element.datalist.id;t||(t=`lulu_${Math.random()}`.replace("0.",""),this.setAttribute("data-target",t));const i=document.createElement("div");i.classList.add(a),i.addEventListener("click",(t=>{if(t.touches&&t.touches.length&&(t=t.touches[0]),!t.target)return;const i=t.target.closest("li");if(i&&0==i.classList.contains(e)){const t=i.getAttribute("data-index");this.params.index=Number(t),this.val(this.datalist[this.params.index]),this.hide(),this.dispatchEvent(new CustomEvent("select",{detail:this.datalist[this.params.index]}))}})),this.id&&i.classList.add(a.add(this.id.replace(/[A-Z]/g,(t=>`-${t.toLowerCase()}`)).replace(/^-+|-+$/g,""))),document.body.appendChild(i),this.element.target=i,this.display=!1,this.dispatchEvent(new CustomEvent("DOMContentLoaded"))}return this}val(t={}){const{value:e}=t;if(void 0===e)return r.encodeHTML(this.value.trim());const i=e.toString();return this.value=r.decodeHTML(r.stripHTML(i.trim())),i!=this.oldValue&&(this.dispatchEvent(new CustomEvent("change",{bubbles:!0,detail:{...t}})),this.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:{...t}}))),this.oldValue=i,this}events(){return document.activeElement!=this&&(this.isFocus=!1),this.addEventListener("blur",(function(){this.isFocus=!1})),this.addEventListener("focus",(function(){window.isKeyEvent&&this.click()})),this.addEventListener("click",(()=>{0==this.display&&(!0===this.params.placeholder&&(this.focusValue=this.value.trim(),this.focusValue&&this.setAttribute("placeholder",this.focusValue),this.value=""),1==this.params.twice&&1==this.isFocus?this.refresh():this.params.twice||this.refresh()),this.isFocus=!0})),this.addEventListener("input",(t=>{!1!==t.isTrusted&&(1==this.params.placeholder||this.value.trim()?this.refresh():this.hide())})),this.addEventListener("keydown",(t=>{let e=this.datalist,i=this.params.index;const s=this.element.target;if(!s)return;const a=s.querySelector(".selected");switch(t.code){case"Escape":case"Enter":1==this.display&&(this.hide(),t.preventDefault(),a&&(a.click(),t.preventDefault(),setTimeout((function(){const t=this;if(this.setSelectionRange)try{t.setSelectionRange(t.value.length,t.value.length)}catch(e){t.value=t.value}else t.value=t.value;t.dispatchEvent(new CustomEvent("input",{bubbles:!0,detail:e[i]}))}),17)));break;case"ArrowUp":case"ArrowDown":if(1==this.display&&e&&e.length){t.preventDefault();const s=[];if(e.forEach(((t,e)=>{t.disabled||""===t.disabled||s.push(e)})),0==s.length)return;let a=s.indexOf(i);"ArrowUp"==t.code?a--:a++,i=a<0?s[s.length-1]:a>s.length-1?s[0]:s[a]}if(e[i]){const t=e[i];this.val(t)}this.select(),this.refresh(e);break;case"Delete":if(1==this.display&&1==this.params.twice&&a){let s=a.getAttribute("data-value");this.removeStore(s),e=e.filter((t=>t.value!=s)),t.preventDefault();const n=e[i]||e[i-1];n?(this.val(n.value),this.refresh(e)):(this.value="",this.hide())}}})),this.form&&"auto"==this.params.data&&this.name&&(""==this.autocomplete||"on"==this.autocomplete)&&this.form.addEventListener("submit",(()=>{this.store()})),document.addEventListener(n.end,(t=>{t.touches&&t.touches.length&&(t=t.touches[0]);const e=t.target,i=this.element.target;i&&1==e.nodeType&&0==i.contains(e)&&this.hide(),e!=this&&""==this.value.trim()&&(this.focusValue?this.value=this.focusValue:"string"==typeof this.params.placeholder&&"auto"!==this.params.placeholder&&this.setAttribute("placeholder",this.params.placeholder))})),window.addEventListener("resize",(()=>{1==this.display&&this.position()})),this}position(){const t=this.element.target;return this&&t&&(this.follow(t),1==this.display&&this.classList.add(i)),this}show(){let t=this.element.target;t||(this.create(),t=this.element.target);const e=this.display;let i=this.params.width;const s=this.getBoundingClientRect().width||this.clientWidth;"auto"==i?i=s:"function"==typeof i&&(i=i.call(this,t)),"auto"!=i&&"number"!=typeof i&&(i=s),t.style.display="block",t.style.width=i+"px","number"==typeof t.lastScrollTop&&t.querySelector("ul")&&(t.querySelector("ul").scrollTop=t.lastScrollTop),this.display=!0,this.position(),0==e&&this.dispatchEvent(new CustomEvent("show",{detail:{type:"ui-datalist"}}))}hide(){const t=this.element.target;t&&1==this.display&&(t.querySelector("ul")&&(t.lastScrollTop=t.querySelector("ul").scrollTop),t.style.display="none",t.classList.remove(s),this.dispatchEvent(new CustomEvent("hide",{detail:{type:"ui-datalist"}}))),this.classList.remove(i),this.classList.remove(s),this.display=!1}connectedCallback(){this.params=Object.assign(this.params,{filter(t,e){const i=[];return t&&t.forEach?(t.forEach((function(t){e&&0!=t.value.indexOf(e)||i.push(t)})),i):i},encode:!0,index:-1,data:"auto",placeholder:"auto",width:"auto"});const t=this.getAttribute("placeholder");t&&(this.params.placeholder=t),this.display=!1,"auto"==this.params.placeholder&&(this.params.placeholder=!0),this.events(),this.convertData(),this.form?this.setAttribute("autocomplete","off"):this.setAttribute("autocomplete","new-password"),this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-datalist"}})),this.isConnectedCallback=!0}}return r})();customElements.get("ui-datalist")||customElements.define("ui-datalist",Datalist,{extends:"input"});const DateTime=(()=>{const t={toString:()=>"ui-datetime"};["date","range","day","year","month","hour","minute","time"].forEach((e=>{t[e]=(...t)=>["ui",e,...t].join("-")}));const e="selected",i="active",s=/-|\//g;String.prototype.toDate=function(){let t,e,i;const a=this.replace(/年|月|日/g,"-").split(s);return t=1*a[0],e=a[1]||1,i=a[2]||1,t?new Date(t,e-1,i):new Date},String.prototype.toTime=function(){let t=this.trim().split(":").map(((t,e)=>!t||/\D/.test(t)?"":t<0?"00":(0===e?t>23&&(t="23"):t>59&&(t="59"),t.padStart(2,"0")))).filter((t=>t)).slice(0,3);return 1==t.length&&t.push("00"),t},Date.prototype.toArray=function(){let t=this.getFullYear(),e=this.getMonth()+1,i=this.getDate();return e<10&&(e=`0${e}`),i<10&&(i=`0${i}`),[t,e,i]};class a extends HTMLInputElement{constructor(){super()}minMaxConvert(t){"number"==typeof t&&Number.isInteger(t)&&(t>1e7?t=new Date(t):t<9999&&(t=String(t)));let e=[];t.toArray?e=t.toArray():"string"==typeof t&&(e=t.toDate().toArray());let i=this.getAttribute("type")||"date";if("date"==i||"date-range"==i)t=e.join("-");else if("year"==i)t=e[0];else if("month"==i||"month-range"==i)t=e.slice(0,2).join("-");else{t.toArray&&(t=t.getHours()+":"+t.getMinutes());let e=t.toTime();if(!e[0])return"";t=e.join(":")}return t}get min(){let t=this.getAttribute("min")||"";return t?this.minMaxConvert(t).toString():t}set min(t){t?this.setAttribute("min",this.minMaxConvert(t)):this.removeAttribute("min")}get max(){let t=this.getAttribute("max")||"";return t?this.minMaxConvert(t).toString():t}set max(t){t?this.setAttribute("max",this.minMaxConvert(t)):this.removeAttribute("max")}get step(){let t=this.getAttribute("step"),e=this.params.type,i=Number(t);return t&&/^\d+$/.test(t)?("time"==e?t>60?(t%60!=0||t/60>30)&&(i=1):i>30&&(i=1):"hour"==e?i>12&&(i=1):"minute"==e&&i>30&&(i=1),i):""}set step(t){t?this.setAttribute("step",t):this.removeAttribute("step")}events(){const t=this.element.target;return t.addEventListener("click",(i=>{if(1!=i.target.nodeType||!i.target.closest)return;const s=i.target.closest("a, button");if(!s)return;let a,n=0,r=0,o=0,l=0,d=[],c="";switch(t.dataset.type){case"date":if(/prev|next/.test(s.className)){r=s.dataset.month,this.selected[1]=1*r;const e=this.getMonthDay(this.selected),i=r-1<0?e[11]:r>e.length?e[0]:e[r-1];l=this.selected[2];const a=t.dataDayOverflow;a?this.selected[2]=Math.min(a,i):this.selected[2]>i&&(this.selected[2]=i,t.dataDayOverflow=l),this.selected=this.selected.join("-").toDate().toArray(),this.date(),t.querySelector(".selected[href]")&&this.setValue()}else/item/.test(s.className)?(l=s.innerHTML,/\D/.test(l)?this.selected=(new Date).toArray():(l<10&&(l=`0${l}`),this.selected[2]=l),this.setValue(),this.hide(),delete t.dataDayOverflow):"month"==s.dataset.type&&this.month();break;case"date-range":/prev|next/.test(s.className)?(r=1*s.dataset.month,d=t.dataDate||this.selected[0],t.dataDate=new Date(d[0],r-1,1).toArray(),this["date-range"]()):/item/.test(s.className)?(n=s.dataset.year,r=s.dataset.month,l=s.innerHTML,r<10&&(r=`0${r}`),l<10&&(l=`0${l}`),a=this.selected,a[0].join()==a[1].join()?n+r+l>a[0].join("")?a[1]=[n,r,l]:a[0]=[n,r,l]:a=[[n,r,l],[n,r,l]],this.selected=a,this["date-range"]()):/button/.test(s.className)&&(c=s.dataset.type,"primary"==c?(this.setValue(),this.dataRangeSelected=this.selected,this.hide()):"normal"==c&&(this.dataRangeSelected&&(this.selected=this.dataRangeSelected),this.hide()));break;case"month-range":/prev|next/.test(s.className)?(n=1*s.dataset.year,d=t.dataDate||this.selected[0],t.dataDate=new Date(n,d[1],1).toArray(),this["month-range"]()):/item/.test(s.className)?(n=s.dataset.year,r=s.dataset.value,l="01",a=this.selected,a[0].join()==a[1].join()?n+r+l>a[0].join("")?a[1]=[n,r,l]:a[0]=[n,r,l]:a=[[n,r,l],[n,r,l]],this.selected=a,this["month-range"]()):/button/.test(s.className)&&(c=s.dataset.type,"primary"==c?(this.setValue(),this.dataRangeSelected=this.selected,this.hide()):"normal"==c&&(this.dataRangeSelected&&(this.selected=this.dataRangeSelected),this.hide()));break;case"month":if(/prev|next/.test(s.className))n=s.dataset.year,this.selected[0]=1*n,this.month(),t.querySelector(".selected[href]")&&this.setValue();else if(/item/.test(s.className)){const t=s.dataset.value;if(t)this.selected[1]=t;else{const t=(new Date).toArray();this.selected[0]=t[0],this.selected[1]=t[1]}this.setValue(),"month"==this.params.type?this.hide():this.date()}else"year"==s.dataset.type&&this.year();break;case"year":/prev|next/.test(s.className)?(n=s.dataset.year,this.selected[0]=1*n,this.year(),t.querySelector(".selected[href]")&&this.setValue()):/item/.test(s.className)&&("今年"==s.innerHTML?this.selected[0]=(new Date).getFullYear():this.selected[0]=1*s.innerHTML,this.setValue(),"year"==this.params.type?this.hide():this.month());break;case"time":if("BUTTON"==s.tagName&&0==s.classList.contains(e)){let t=s.parentElement.dataset.type,e=s.dataset.index;"ampm"==t?("0"==e?this.selected[0]-=12:this.selected[0]=Number(this.selected[0])+12,this.selected[0]=String(this.selected[0]).padStart(2,"0")):"hour"==t?this.selected[0]=e.padStart(2,"0"):"minute"==t?this.selected[1]=e.padStart(2,"0"):"second"==t&&(this.selected[2]=e.padStart(2,"0")),this.setValue(),this.time()}break;case"minute":/prev|next/.test(s.className)?(o=s.getAttribute("data-hour"),1==o.length&&(o=`0${o}`),this.selected[0]=o,this.minute(),t.querySelector(".selected[href]")&&this.setValue()):/item/.test(s.className)?(this.selected=s.innerHTML.split(":"),this.setValue(),this.hide()):"hour"==s.dataset.type&&this.hour();break;case"hour":/item/.test(s.className)&&(this.selected[0]=s.innerHTML.split(":")[0],this.setValue(),"hour"==this.params.type?this.hide():this.minute())}})),this.addEventListener("click",(t=>{t.preventDefault(),this.display?this.hide():this.show()})),this.addEventListener("keydown",(t=>{"Enter"==t.code&&(t.preventDefault(),this.click())})),document.addEventListener("mouseup",(e=>{const i=e.target;i&&i!=this&&0==t.contains(i)&&this.display&&this.hide()})),document.addEventListener("keydown",(e=>{if("time"==t.dataset.type&&1==this.display&&t.contains(document.activeElement)){if(/^arrow/i.test(e.key)){e.preventDefault();let i=[...t.querySelectorAll(".selected")],s=i.findIndex((t=>t==e.target)),a=[...e.target.parentElement.querySelectorAll('button:enabled:not([data-visibility="false"])')],n=a.findIndex((t=>t==e.target));if("ArrowLeft"==e.key)s--,i[s]&&i[s].focus();else if("ArrowRight"==e.key)s++,i[s]&&i[s].focus();else if("ArrowUp"==e.key){let t=a[n-1];t||(t=a[a.length-1]),t&&(t.click(),t.focus())}else if("ArrowDown"==e.key){let t=a[n+1];t||(t=a[0]),t&&(t.click(),t.focus())}}"Enter"==e.key&&this.hide()}})),window.addEventListener("resize",(()=>{this.display&&this.position()})),this}format(){const t=this.params.type,e=this.value.trim();if(!e)return this;switch(t){case"date":case"year":case"month":{const t=e.toDate().toArray();this.selected=t;break}case"time":case"hour":case"minute":{const t=e.toTime();t.length>1&&(this.selected=[...t]);break}case"date-range":case"month-range":{let t=new Date,i=new Date;const s=e.split(" ");3==s.length&&(t=s[0].toDate(),i=s[s.length-1].toDate(),this.selected=[t.toArray(),i.toArray()]);break}}return this}setValue(){const t=this.selected,e=this.value;switch(this.params.type){case"date":this.value=t.join("-");break;case"month":this.value=t.slice(0,2).join("-");break;case"year":this.value=t[0];break;case"date-range":this.value=`${t[0].join("-")} 至 ${t[1].join("-")}`;break;case"month-range":this.value=`${t[0].slice(0,2).join("-")} 至 ${t[1].slice(0,2).join("-")}`;break;case"time":case"minute":this.value=t.join(":");break;case"hour":this.value=`${t[0]}:00`}return this.value!=e&&this.dispatchEvent(new CustomEvent("change",{bubbles:!0})),this.value}getCalendarData(e){let i="";const s=this.params.type;let a=(this.min||"0001-01-01").toDate(),n=(this.max||"9999-00-01").toDate();const r=["日","一","二","三","四","五","六"],o=this.getMonthDay(e),l=e.join("-").toDate();i=`<div class="${t.day("x")}">${(()=>{let e="";return r.forEach(((i,s)=>{e=`${e}<span class="${t.day("item")} col${s}">${i}</span>`})),e})()}</div>`;const d=e.join("-").toDate();let c=0;d.setDate(1),2==d.getDate()&&d.setDate(0),c=d.getDay();let h=d.getMonth()-1;h<0&&(h=11);const u=`data-year="${e[0]}" data-month="${d.getMonth()+1}"`,p="data-date=";let m="";return i=`${i}<div class="${t.date("body")}">${(()=>{let i="",r="";for(let g=0;g<6;g++){i=`${i}<div class="${t.date("tr")}">`;for(let f=0;f<7;f++){r=`${t.date("item")} col${f}`;const v=e[0],b=d.getMonth()+1;let y,E;if("date"==s)0==g&&f<c?(y=o[h]-c+f+1,E=new Date(v,h,y),m=p+E.toArray().join("-"),i=`${i}<span class="${r}" ${m}>${y}</span>`):(y=7*g+f-c+1,y<=o[d.getMonth()]?(E=new Date(v,d.getMonth(),y),m=p+E.toArray().join("-"),l.getDate()==y&&(r=`${r} selected`),i=E>=a&&E<=n?`${i}<a href="javascript:;" ${u} class="${r}" ${m}>${y}</a>`:`${i}<span class="${r}" ${m}>${y}</span>`):(y-=o[d.getMonth()],m=p+new Date(v,b,y).toArray().join("-"),i=`${i}<span class="${r}" ${m}>${y}</span>`));else if("date-range"==s)if(0==g&&f<c)i=`${i}<span class="${r}"></span>`;else if(y=7*g+f-c+1,y<=o[d.getMonth()]){E=new Date(v,d.getMonth(),y),m=p+E.toArray().join("-");const e=this.selected[0].join("-").toDate(),s=this.selected[1].join("-").toDate(),l=E.getTime(),c=e.getTime(),h=s.getTime();l>=c&&l<=h&&(r=`${r} selected`,l==c&&(r=`${r} ${t.date("begin")}`),l==h&&(r=`${r} ${t.date("end")}`),1==y?r=`${r} ${t.date("first")}`:y==o[d.getMonth()]&&(r=`${r} ${t.date("last")}`)),i=E>=a&&E<=n?`${i}<a href="javascript:;" ${u} class="${r}" ${m}>${y}</a>`:`${i}<span class="${r}" ${m}>${y}</span>`}else i=`${i}<span class="${r}"></span>`}i+="</div>"}return i})()}</div>`,{monthDay:o,html:i,min:a,max:n}}getMonthData(e){let i=(this.min||"000000").replace(s,"").slice(0,6),a=(this.max||"999912").replace(s,"").slice(0,6);const n=["一","二","三","四","五","六","七","八","九","十","十一","十二"],r=1*e[0],o=this.params.type;return{html:`<div class="${t.month("body")}">${(()=>{let s="",l="",d="";for(let c=1;c<=12;c+=1){if(d=c<10?`0${c}`:`${c}`,l=t.date("item"),"month"==o)c==e[1]&&(l=`${l} selected`);else if("month-range"==o){const t=this.selected[0].slice(0,2).join(""),e=this.selected[1].slice(0,2).join(""),i=r+d;i>=t&&i<=e&&(l=`${l} selected`)}s=r+d>=i&&r+d<=a?`${s}<a href="javascript:" class="${l}" data-year="${r}" data-value="${d}">${n[c-1]}月</a>`:`${s}<span class="${l}" data-value="${d}">${n[c-1]}月</span>`}return s})()}</div>`,min:i,max:a}}getMonthDay(t){let e=t;"object"==typeof t||t.map||(e=t.toArray());const i=[31,28,31,30,31,30,31,31,30,31,30,31];return(e[0]%4==0&&e[0]%100!=0||e[0]%400==0)&&(i[1]=29),i}getDatePrevMonth(t){let e=t;"object"==typeof t||t.map||(e=t.toArray());const i=1*e[1],s=this.getMonthDay(e);return 1==i?[e[0]-1,12,e[2]].join("-").toDate():s[i-2]<e[2]?[e[0],i-1,s[i-2]].join("-").toDate():[e[0],i-1,e[2]].join("-").toDate()}getDateNextMonth(t){let e=t;"object"==typeof t||t.map||(e=t.toArray());const i=1*e[1],s=this.getMonthDay(e);return 12==i?[e[0]+1,1,e[2]].join("-").toDate():s[i]<e[2]?[e[0],i+1,s[i]].join("-").toDate():[e[0],i+1,e[2]].join("-").toDate()}date(){const e=this.element.target,i=this.selected,s=i[1]-1,a=1*i[1]+1,n=this.getCalendarData(i);let r=`<div class="${t.date("x")}">`;r=`${r}<div class="${t.date("head")}">`;const o=this.getDatePrevMonth(i),l=o.getMonth(),d=o.getFullYear();r=new Date(d,l,n.monthDay[l])>=n.min?`${r}<a href="javascript:" class="${t.date("prev")}" data-month="${s}" role="button" aria-label="上一月"></a>`:`${r}<span class="${t.date("prev")}" aria-label="上一月"></span>`;const c=this.getDateNextMonth(i),h=c.getMonth(),u=c.getFullYear();return r=new Date(u,h,1)<=n.max?`${r}<a href="javascript:" class="${t.date("next")}" data-month="${a}" role="button" aria-label="下一月"></a>`:`${r}<span class="${t.date("next")}" aria-label="下一月"></span>`,r=`${r}<a href="javascript:" class="${t.date("switch")}" data-type="month" role="button" aria-label="快速切换月份">${i.slice(0,2).join("-")}</a></div>`,r+=n.html,r=new Date>=n.min&&new Date<=n.max?`${r}<a href="javascript:" class="${t.date("item")} ${t.date("now")}" role="button">今天</a>`:`${r}<span class="${t.date("item")} ${t.date("now")}">今天</span>`,r+="</div>",e.dataset.type="date",e.innerHTML=r,this}"date-range"(){const e=this.element.target,i=this.selected,s=e.dataDate||i[0];e.dataDate=s;const a=s[1]-1,n=1*s[1]+1,r=this.getCalendarData(s);let o=`<div class="${t.range("x")}">`;o=`${o}<div class="${t.date("head")}"><div class="${t.date("half")}">`;o=new Date(s[0],a-1,r.monthDay[a])>=r.min?`${o}<a href="javascript:" class="${t.date("prev")}" data-month="${a}" aria-label="上一个月，当前${s[1]}月"></a>`:`${o}<span class="${t.date("prev")}"></span>`,o=`${o}<span class="${t.date("switch")}">${new Date(s[0],a,s[2]).toArray().slice(0,2).join("-")}</span></div><div class="${t.date("half")}">`;const l=new Date(s[0],s[1],1);return o=new Date(s[0],n,s[2])<=r.max?`${o}<a href="javascript:" class="${t.date("next")}" data-month="${n}" aria-label="下一个月，当前${n}月"></a>`:`${o}<span class="${t.date("next")}"></span>`,o=`${o}<span class="${t.date("switch")}">${l.toArray().slice(0,2).join("-")}</span></div>`,o+="</div>",o=`${o}<div class="${t.range("body")} ${t.range("date","body")}">            <div class="${t.date("half")}">${r.html}</div>            <div class="${t.date("half")}">${this.getCalendarData(l.toArray()).html}</div>            </div>`,o=`${o}<div class="${t.range("footer")}">            <button class="ui-button" data-type="primary">确定</button>            <button class="ui-button" data-type="normal">取消</button>            </div>`,o+="</div>",e.dataset.type="date-range",e.innerHTML=o,this}month(){const e=this.element.target,i=this.selected,s=this.getMonthData(i),a=s.min,n=s.max;let r=`<div class="${t.month("x")}">`;const o=1*i[0];r=`${r}<div class="${t.date("head")}">`,r=o-1>=Math.floor(a/100)&&o-1<=Math.floor(n/100)?`${r}<a href="javascript:" class="${t.date("prev")}" data-year="${o-1}" role="button" aria-label="上一年"></a>`:`${r}<span class="${t.date("prev")}" aria-label="上一年"></span>`,r=o+1>=Math.floor(a/100)&&o+1<=Math.floor(n/100)?`${r}<a href="javascript:" class="${t.date("next")}" data-year="${o+1}" role="button" aria-label="下一年"></a>`:`${r}<span class="${t.date("next")}"></span>`,r=`${r}<a href="javascript:" class="${t.date("switch")}" data-type="year" role="button" aria-label="快速切换年份">${o}</a>            </div>`,r+=s.html;const l=(new Date).toArray().slice(0,2).join("");return r=l>=a&&l<=n?`${r}<a href="javascript:" class="${t.date("item")} ${t.date("now")}">今月</a>`:`${r}<span class="${t.date("item")} ${t.date("now")}">今月</span>`,r+="</div>",e.dataset.type="month",e.innerHTML=r,this}"month-range"(){const e=this.element.target,i=this.selected,s=e.dataDate||i[0];e.dataDate=s;const a=1*s[0]-1,n=1*s[0]+1,r=this.getMonthData(s),o=r.max.slice(0,4),l=r.min.slice(0,4);let d=`<div class="${t.range("x")}">`;return d=`${d}<div class="${t.date("head")}">            <div class="${t.date("half")}">`,d=a>=l&&a<=o?`${d}<a href="javascript:" class="${t.date("prev")}" data-year="${a}" role="button" aria-label="上一年"></a>`:`${d}<span class="${t.date("prev")}" aria-label="上一年"></span>`,d=`${d}<span class="${t.date("switch")}">${s[0]}</span>            </div>            <div class="${t.date("half")}">`,d=n>=l&&n<o?`${d}<a href="javascript:" class="${t.date("next")}" data-year="${n}" role="button" aria-label="下一年"></a>`:`${d}<span class="${t.date("next")}" aria-label="下一年"></span>`,d=`${d}<span class="${t.date("switch")}">${n}</span>            </div>`,d+="</div>",d=`${d}<div class="${t.range("body")} ${t.range("month","body")}">            <div class="${t.date("half")}">${r.html}</div>            <div class="${t.date("half")}">${this.getMonthData([n,s[1],s[2]]).html}</div>            </div>`,d=`${d}<div class="${t.range("footer")}">            <button class="ui-button" data-type="primary">确定</button>            <button class="ui-button" data-type="normal">取消</button>            </div>`,d+="</div>",e.dataset.type="month-range",e.innerHTML=d,this}year(){const e=this.element.target,i=this.selected;let s=this.min||0,a=this.max||9999,n=`<div class="${t.year("x")}">`;const r=i[0];n=`${n}<div class="${t.date("head")}">`,n=r-12>=s&&r-12<=a?`${n}<a href="javascript:" class="${t.date("prev")}" data-year="${r-12}" role="button" aria-label="上一个12年"></a>`:`${n}<span class="${t.date("prev")}"></span>`,n=r+12>=s&&r+12<=a?`${n}<a href="javascript:" class="${t.date("next")}" data-year="${r+12}" role="button" aria-label="下一个12年"></a>`:`${n}<span class="${t.date("next")}"></span>`,n=`${n}<span class="${t.date("switch")}">${[r-6,r+5].join("-")}</span></div>`;n=`${n}<div class="${t.year("body")}">${(()=>{let e="",i="";for(let n=r-6;n<r+6;n+=1)i=t.date("item"),n==r&&(i=`${i} selected`),e=n>=s&&n<=a?`${e}<a href="javascript:" class="${i}">${n}</a>`:`${e}<span class="${i}">${n}</span>`;return e})()}</div>`;const o=(new Date).getFullYear();return n=o>=s&&o<=a?`${n}<a href="javascript:" class="${t.date("item")} ${t.date("now")}" role="button">今年</a>`:`${n}<span class="${t.date("item")} ${t.date("now")}">今年</span>`,n+="</div>",n+="</div>",e.dataset.type="year",e.innerHTML=n,this}hour(){const e=this.element.target,i=this.selected;let s=this.step||1,a=Number(this.min.split(":")[0])||0,n=Number(this.max.split(":")[0]);!isNaN(n)&&this.max||(n=24);let r=`<div class="${t.hour("x")}">`;return r=`${r}<div class="${t.hour("body")}">${(()=>{let e="",r="",o="";for(let l=0;l<24;l+=s)r=String(l).padStart(2,"0"),o=t.date("item"),r==i[0]&&(o=`${o} selected`),e=l>=a&&l<=n?`${e}<a href="javascript:" class="${o}">${r}:00</a>`:`${e}<span class="${o}">${r}:00</span>`;return e})()}</div>`,r+="</div>",e.dataset.type="hour",e.innerHTML=r,this}time(){const i=this.element.target,s=this.selected;let a=Number(s[0]),n=Number(s[1]),r=Number(s[2]),o=1*this.step||1;o>60&&(o=Math.floor(o/60));let l=this.min||"00:00:00",d=this.max||"23:59:59",c=Number(l.split(":")[0])||0,h=Number(l.split(":")[1])||0,u=Number(l.split(":")[2])||0,p=Number(d.split(":")[0]);isNaN(p)&&(p=23);let m=Number(d.split(":")[1]),g=Number(d.split(":")[2]);isNaN(m)&&(m=59),isNaN(g)&&(g=59);let f=[];"H:mm"!=this.datetimeformat&&(f=[0,1].map((t=>0==t?{value:"上午",selected:a<=11}:{value:"下午",selected:a>11})));let v=Array(24).fill().map(((t,e)=>{let i=!1;(e<c||e>p)&&(i=!0);let s=!0,n=!1,r=String(e).padStart(2,"0");return"H:mm"!=this.datetimeformat&&((e>11&&f[0].selected||e<=11&&f[1].selected)&&(s=!1),e>=12&&(r=String(e-12).padStart(2,"0")),"00"==r&&(r="12")),e==a&&(n=!0),{value:r,disabled:i,selected:n,visibility:s}})),b=Array(60).fill().map(((t,e)=>{let i=!1,r=!0,l=!1;return(a==c&&e<h||a==p&&e>m)&&(i=!0),2==s.length&&e%o!=0&&(r=!1),e==n&&(l=!0),{value:String(e).padStart(2,"0"),disabled:i,visibility:r,selected:l}})),y=Array(60).fill().map(((t,e)=>{let i=!1,l=!0,d=!1;return(a==c&&n==h&&e<u||a==p&&n==m&&e>g)&&(i=!0),3==s.length&&e%o!=0&&(l=!1),e==r&&(d=!0),{value:String(e).padStart(2,"0"),disabled:i,visibility:l,selected:d}}));if(i.innerHTML)return[...i.querySelectorAll("button")].forEach((function(t){t.classList.remove(e),t.disabled=!1,t.dataset.visibility="true";let i=t.dataset.index,s=t.parentElement.dataset.type;if("ampm"==s)f[i].selected&&t.classList.add(e);else{let a={hour:v,minute:b,second:y}[s][i];a.selected&&t.classList.add(e),a.disabled&&(t.disabled=!0),0==a.visibility&&(t.dataset.visibility="false")}})),this;let E=`<div class="${t.time("x")}" data-step="${o}">`;"H:mm"!=this.datetimeformat&&(E+=`<div class="${t.time("col")}" data-type="ampm">\n                    ${f.map(((e,i)=>`<button class="${t.time("item")}${e.selected?" selected":""}" data-index="${i}">${e.value}</button>`)).join("")}\n                </div>`),E+=`<div class="${t.time("col")}" data-type="hour">\n                ${v.map(((e,i)=>`<button class="${t.time("item")}${e.selected?" selected":""}" data-index="${i}"${e.disabled?" disabled":""} data-visibility="${e.visibility}">${e.value}</button>`)).join("")}\n            </div>`,E+=`<div class="${t.time("col")}" data-type="minute">\n                ${b.map(((e,i)=>`<button class="${t.time("item")}${e.selected?" selected":""}" data-index="${i}"${e.disabled?" disabled":""} data-visibility="${e.visibility}">${e.value}</button>`)).join("")}\n            </div>`,3==s.length&&(E+=`<div class="${t.time("col")}" data-type="second">\n                    ${y.map(((e,i)=>`<button class="${t.time("item")}${e.selected?" selected":""}" data-index="${i}"${e.disabled?" disabled":""} data-visibility="${e.visibility}">${e.value}</button>`)).join("")}\n                </div>`),E+="</div>",i.dataset.type="time",i.innerHTML=E}minute(){const e=this.element.target,i=this.selected,s=1*this.step||1;let a=1*(this.min||"0").replace(":",""),n=1*(this.max||"2359").replace(":",""),r=`<div class="${t.minute("x")}" data-step="${s}">`;const o=1*i[0];r=`${r}<div class="${t.date("head")}">`,r=o<=Math.floor(a/100)?`${r}<span class="${t.date("prev")}"></span>`:`${r}<a href="javascript:" class="${t.date("prev")}" data-hour="${o-1}" role="button" aria-label="上一个小时"></a>`,r=o>=Math.floor(n/100)?`${r}<span class="${t.date("next")}"></span>`:`${r}<a href="javascript:" class="${t.date("next")}" data-hour="${o+1}" role="button" aria-label="下一个小时"></a>`,r=`${r}<a href="javascript:" class="${t.date("switch")}" data-type="hour">${i[0]}:00</a></div>`;return r=`${r}<div class="${t.minute("body")}">${(()=>{let e="",r="",o="";for(let l=0;l<60;l+=s)r=`${l}`,1==r.length&&(r=`0${r}`),o=t.date("item"),1*(i[0]+r)>=a&&1*(i[0]+r)<=n?(r==i[1]&&(o=`${o} selected`),e=`${e}<a href="javascript:" class="${o}">${[i[0],r].join(":")}</a>`):e=`${e}<span class="${o}">${[i[0],r].join(":")}</span>`;return e})()}</div>`,r+="</div>",e.dataset.type="minute",e.innerHTML=r,this}position(){return this.follow(),this}show(){const t=this.element.target;return this.disabled||(this.format(),"date-range"==this.params.type?(this.dataRangeSelected||(this.dataRangeSelected=this.selected),this["date-range"]()):"month-range"==this.params.type?(this.dataRangeSelected||(this.dataRangeSelected=this.selected),this["month-range"]()):this[this.params.type]?this[this.params.type]():this.date(),0==document.body.contains(t)&&(document.body.appendChild(t),this.dispatchEvent(new CustomEvent("DOMContentLoaded"))),t.style.display="inline-block",this.classList.add(i),this.position(),this.display=!0,"time"==this.params.type&&[...t.querySelectorAll(".selected")].forEach(((t,e)=>{t.scrollIntoViewIfNeeded?t.scrollIntoViewIfNeeded():(t.offsetTop-5>t.parentElement.scrollTop+t.parentElement.clientHeight||t.offsetTop-5<t.parentElement.scrollTop)&&(t.parentElement.scrollTop=t.offsetTop-5),0==e&&t.focus({preventScroll:!0})})),this.dispatchEvent(new CustomEvent("show",{detail:{type:"ui-datetime"}}))),this}hide(){const t=this.element.target;return 1==this.display&&(t.style.display="none",this.classList.remove(i),(document.activeElement==document.body||t.contains(document.activeElement))&&(this.focus(),this.blur())),this.display=!1,this.dispatchEvent(new CustomEvent("hide",{detail:{type:"ui-datetime"}})),this}connectedCallback(){let e=this.getAttribute("type");0==["date","year","month","time","hour","minute","date-range","month-range"].includes(e)&&(e="date",e&&this.removeAttribute("type")),this.params=this.params||{},this.params.type=e;let i=null;this.setAttribute("readonly","readonly"),this.toggleAttribute("required",!0);let s=this.id;s||(s=`lulu_${String(Math.random()).replace("0.","")}`,this.id=s);let a=this.getAttribute("value")||this.value;switch(e){case"date":case"year":case"month":{const t=a.toDate().toArray();"date"==e?this.value=t.join("-"):"year"==e?this.value=t[0]:"month"==e&&(this.value=t.slice(0,2).join("-")),this.selected=t;break}case"time":{const t=a.toTime();let i=new Date,s=i.getHours(),n=i.getMinutes(),r=i.getSeconds(),o=String(t[0]||s).padStart(2,"0"),l=String(t[1]||n).padStart(2,"0"),d=String(t[2]||r).padStart(2,"0"),c=this.step;"time"==e&&(!c&&t[2]||c>0&&c<=30)?this.value=[o,l,d].join(":"):this.value=[o,l].join(":"),this.selected=[o,l,d];break}case"hour":case"minute":{const t=a.toTime();let i=new Date,s=i.getHours(),n=i.getMinutes(),r=String(t[0]||s).padStart(2,"0"),o=String(t[1]||n).padStart(2,"0");t[0]||"hour"!=e||(o="00"),this.value=[r,o].join(":"),this.selected=[r,o];break}case"date-range":case"month-range":{let t=new Date,i=new Date;const s=a.split(" ");if(""!=a&&1==s.length){const e=s[0].toDate();e.getTime()>t.getTime()?i=e:t=e}else t=s[0].toDate(),i=s[s.length-1].toDate();const n=t.toArray(),r=i.toArray();this.value="date-range"==e?`${n.join("-")} 至 ${r.join("-")}`:`${n.slice(0,2).join("-")} 至 ${r.slice(0,2).join("-")}`,this.selected=[n,r];break}}if(/time/.test(e)){this.datetimeformat="H:mm";let t=document.createElement("input");if(t.setAttribute("type","time"),t.value="00:00",document.body.append(t),t.style.position="absolute",t.style.left="-999px",t.style.fontFamily="revert","time"==t.type){t.style.fontSize="20px";let e=t.clientWidth;t.style.fontSize="30px";let i=t.clientWidth-e;Math.ceil(i/10)>=5&&(this.datetimeformat="ah:mm"),t.remove()}}if(!i){i=document.createElement("div"),i.classList.add(t.date("container"));const e=`lulu_${String(Math.random()).replace("0.","")}`;i.setAttribute("id",e),i.classList.add("ESC"),this.setAttribute("data-target",e),i.setAttribute("data-id",s)}this.element=this.element||{},this.element.target=i,this.events(),this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-datetime"}})),this.isConnectedCallback=!0}}return a})();customElements.get("ui-datetime")||customElements.define("ui-datetime",DateTime,{extends:"input"});const Validate=(()=>{window.DBC2SBC=t=>{let e,i,s="";for(e=0;e<t.length;e++)i=t.charCodeAt(e),s+=i>=65281&&i<=65373?String.fromCharCode(t.charCodeAt(e)-65248):12288==i?String.fromCharCode(t.charCodeAt(e)-12288+32):t.charAt(e);return s},window.scrollTopTo=(t,e)=>{let i=document.scrollingElement.scrollTop;const s=()=>{if(i+=(t-i)/2,Math.abs(i-t)<=1)return document.scrollingElement.scrollTop=t,void(e&&e());document.scrollingElement.scrollTop=i,requestAnimationFrame(s)};s()},document.validate={reg:{email:"^[a-z0-9._%-]+@([a-z0-9-]+\\.)+[a-z]{2,4}$",number:"^\\-?\\d+(\\.\\d+)?$",url:"^(http|https)\\:\\/\\/[a-z0-9\\-\\.]+\\.[a-z]{2,3}(:[a-z0-9]*)?\\/?([a-z0-9\\-\\._\\:\\?\\,\\'\\/\\\\\\+&amp;%\\$#\\=~])*$",tel:"^1\\d{10}$",zipcode:"^\\d{6}$",date:"^\\d{4}\\-(0\\d|1[0-2])\\-([0-2]\\d|3[0-1])$",time:"^[0-2]\\d\\:[0-5]\\d$",hour:"^[0-2]\\d\\:00$",minute:"^[0-2]\\d\\:[0-5]\\d$","date-range":"^\\d{4}(\\-\\d{2}){2}\\s至\\s\\d{4}(\\-\\d{2}){2}$","month-range":"^\\d{4}\\-\\d{2}\\s至\\s\\d{4}\\-\\d{2}$"},name:{email:"邮箱",tel:"手机号码",url:"网址",zipcode:"邮编",password:"密码",number:"数值",range:"数值",date:"日期",year:"年份",month:"月份",hour:"小时",minute:"分钟",time:"时间",datetime:"日期时间","date-range":"日期范围","month-range":"月份范围"},selectRange(t,e,i){if(t)if(t.createTextRange){const s=t.createTextRange();s.collapse(!0),s.moveEnd("character",i),s.moveStart("character",e),s.select()}else t.focus&&(t.focus(),t.setSelectionRange(e,i))},getTel(t){let e=t||"";return e=e.replace("+86",""),e.match(/\d/)&&11==e.match(/\d/g).length&&(e=e.replace(/\D/g,"")),e},getLength(t,e){if("password"==t.type)return e||t.value.length;const i=t.getAttribute("lang"),s=t.value.trim();if(!i)return e||s.length;if(""==s)return 0;let a=1,n=1;if(/zh/i.test(i)?n=.5:/en/i.test(i)&&(a=2),!e){const t=s.replace(/[\x00-\xff]/g,"").length,e=s.length-t;return Math.ceil(e*n)+Math.ceil(t*a)}let r=0,o=e;return s.split("").forEach(((t,i)=>{r>=e||(/[\x00-\xff]/.test(t)?r+=n:r+=a,r>=e&&(o=i+1))})),o},getType(t){let e=t.getAttribute("type")||t.type||"";return"select-one"==e&&(e="select"),e},getReportText(t){const e={name:this.name,badInput:"值无效",customError:"包含错误",patternMismatch:{pattern:"内容格式不符合要求",multiple:"某项内容格式不符合要求"},valueMissing:{radio:"请选择一个选项",checkbox:"如果要继续，请选中此框",select:"请选择列表中的一项","select-one":"请选择列表中的一项",empty:"请填写此字段"},rangeOverflow:"值偏大",rangeUnderflow:"值偏小",stepMismatch:"值不在间隔要求范围内",tooLong:"内容长度偏大",tooShort:"内容长度偏小",typeMismatch:"值和输入框类型不匹配"};if(!t)return"";const i=t.validity;if(1==i.valid)return"";let s="";const a=t.id,n=this.getType(t),r=t.customValidate||{},o=r.report||{},l=e.name[n]||function(){if(!r.label||!a||/checkbox|radio/.test(n))return;let t="";return document.querySelectorAll("label[for="+a+"]").forEach((function(e){const i=e.cloneNode(!0);[].slice.call(i.children).forEach((function(t){t.remove()}));const s=i.innerHTML.trim().replace(/\d/g,"").replace("：","");s.length>t.length&&(t=s)})),t.length>=2?t:void 0}();if(i.valueMissing)s=o.valueMissing,s||(s=n&&l?"select"!=n?l+"不能为空":"您尚未选择"+l:e.valueMissing[n],s=s||e.valueMissing.empty);else if(i.patternMismatch){if(s=o.patternMismatch,!s){const i=t.hasAttribute("multiple")&&t.value.split(",").length>1;s=e.patternMismatch[i?"multiple":"pattern"],n&&l&&(s=l+s)}}else if(i.badInput)s=o.badInput,s||(s=(l||"")+e.badInput);else if(i.typeMismatch)s=o.typeMismatch,s||(s=e.typeMismatch,l&&(s=s.replace("输入框",l)));else if(i.rangeUnderflow||i.rangeOverflow){if(s=o.rangeUnderflow||o.rangeOverflow,!s&&n&&l){let e=t.getAttribute("min"),a=t.getAttribute("max");"month-range"==n&&(e=e.slice(0,7),a=a.slice(0,7));const r="必须要大于或等于"+e,o="必须要小于或等于"+a;i.rangeUnderflow&&i.rangeOverflow?s="起始日期"+r+"，结束日期"+o:i.rangeUnderflow?(s=l+r,"-range"==n.slice(-6)&&(s="起始日期"+r)):(s=l+o,"-range"==n.slice(-6)&&(s="结束日期"+o))}s=s||"值不在要求的范围内"}else if(i.stepMismatch){if(s=o.stepMismatch,!s){const e=1*t.getAttribute("min"),i=1*t.getAttribute("max"),a=1*t.getAttribute("step")||1;s="number"==n||"range"==n?"请输入有效的值。两个最接近的有效值是"+function(){const s=1*t.value.trim();let n=e;for(let t=e;t<i;t+=a)if(t<s&&t+a>s){n=t;break}return[n,n+a].join("和")}():"请"+(t.hasAttribute("readonly")?"选择":"输入")+"有效的值。"+(l||"")+"间隔是"+a}s=s||e.stepMismatch}else if(i.tooLong||i.tooShort){const e=t.getAttribute("lang");let a="";/zh/i.test(e)?a="个汉字(2字母=1汉字)":/en/i.test(e)&&(a="个字符(1汉字=2字符)"),i.tooLong?(s=o.tooLong,s||(s=(l||"")+"内容长度不能大于"+(t.maxlength||t.getAttribute("maxlength")).replace(/\D/g,"")+a)):(s=o.tooShort,s||(s="内容长度不能小于"+t.getAttribute("minlength")+a))}else i.customError&&(s=o.customError||e.customError);return"function"==typeof s&&(s=s.call(t,t)),s},getMissingState(t){const e={valueMissing:!1};if(!t||t.disabled)return e;const i=this.getType(t);let s=t.value;if(t.hasAttribute("required")){if("radio"==i){let i=[t];const s=t.closest("form")||t.parentElement.parentElement;return t.name&&s&&(i=s.querySelectorAll('input[type="radio"][name="'+t.name+'"]')),0==[].slice.call(i).some((function(t){return t.checked}))&&(e.valueMissing=!0),e}if("checkbox"==i)return 0==t.checked&&(e.valueMissing=!0),e;"password"!=i&&(s=s.trim()),""==s&&(t.value="",e.valueMissing=!0)}return e},isMissing(t){return this.getMissingState(t).valueMissing},getMismatchState(t,e,i){const s={patternMismatch:!1,typeMismatch:!1};if(!t||t.disabled)return!1;const a=t.value;let n=a;const r=this.getType(t);if(/^radio|checkbox|select$/i.test(r))return s;if("password"!=r&&(n=a.trim()),0==/^text|textarea|password$/i.test(r)&&(n=window.DBC2SBC(n)),"tel"==r&&(n=this.getTel(n)),!1!==document.validate.focusable&&0!==document.validate.focusable&&n!=a&&(t.value=n),""==n)return s;if(!(e=e||t.getAttribute("pattern")||r&&r.split("|").map((function(t){const e=document.validate.reg[t];if(e)return e})).join("|")))return s;const o=t.hasAttribute("multiple"),l=new RegExp(e,i||"i");let d=!0;return o&&0==/^number|range$/i.test(r)?n.split(",").forEach((function(t){t=t.trim(),d&&!l.test(t)&&(d=!1)})):d=l.test(n),0==d&&(t.hasAttribute("pattern")?s.patternMismatch=!0:s.typeMismatch=!0),s},isMismatch(t,e,i){const s=this.getMismatchState(t,e,i);return s.patternMismatch||s.typeMismatch},getRangeState(t){const e={badInput:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1};if(!t||t.disabled)return e;const i=this.getType(t);let s=t.value.trim();if(/radio|checkbox|select|textarea/i.test(i)||""==s)return e;let a=t.getAttribute("min"),n=t.getAttribute("max");const r=Number(t.getAttribute("step"))||1;if("number"!=i&&"range"!=i||/[-+]?[0-9]/.test(s)||(e.badInput=!0),"-range"!=i.slice(-6)){if("0"!=s&&Number(s)!=s||(s*=1),a&&s<a&&(e.rangeUnderflow=!0),n&&s>n&&(e.rangeOverflow=!0),"number"!=i&&"range"!=i||!r||!a||/^\d+$/.test(Math.abs(s-a)/r)||(e.stepMismatch=!0),("hour"==i||"minute"==i||"time"==i)&&a&&r){const t=s.split(":")[1],n=a.split(":")[1];"hour"!=i||t==n&&(s.split(":")[0]-a.split(":")[0])%r==0?(t-n)%r!=0&&(e.stepMismatch=!0):e.stepMismatch=!0}}else{const t=s.split(" ");"month-range"==i&&(a=a&&a.slice(0,7),n=n&&n.slice(0,7)),3==t.length&&(a&&t[0]<a&&(e.rangeUnderflow=!0),n&&t[2]>n&&(e.rangeOverflow=!0))}return e},isOut(t){const e=this.getRangeState(t);return e.badInput||e.rangeOverflow||e.rangeUnderflow||e.stepMismatch},getLengthState(t){const e={tooLong:!1,tooShort:!1};if(!t||t.disabled||/^radio|checkbox|select$/i.test(t.type))return e;const i=t.getAttribute("minlength");let s=t.maxlength||t.getAttribute("maxlength");if(""==t.value)return e;const a=this.getLength(t);return i&&a<i&&(e.tooShort=!0),s&&(s=s.replace(/\D/g,""),a>s&&(e.tooLong=!0)),e},isOverflow(t){const e=this.getLengthState(t);return e.tooLong||e.tooShort},getCustomState(t){const e={customError:!1},i=t.customValidate;if(i&&"function"==typeof i.method){const s=i.method.call(i.owner,t);s&&(e.customError=!0,"object"==typeof s&&s.customError?this.setCustomValidity(t,s.customError):this.setCustomValidity(t,s))}return e},setCustomValidity(t,e){e&&(t.customValidate||(t.customValidate={report:{}}),t.customValidate.report||(t.customValidate.report={}),t.customValidate.report.customError=e)},checkValidity(t){if(!t||t.disabled)return!0;const e=t.getAttribute("type")||t.type,i=t.tagName.toLowerCase();return 1==/^button|submit|reset|file|image$/.test(e)||"button"==i||(0==t.matches("input, select, textarea")&&t.children&&(t=t.querySelectorAll("input, select, textarea")),1==t.nodeType?this.getValidity(t).valid:!t.length||[].slice.call(t).every(function(t){return this.checkValidity(t)}.bind(this)))},getValidity(t){if(t.lastValidateState&&t.lastValue===t.value&&0==/radio|checkbox/.test(t.type))return t.lastValidateState;let e={badInput:!1,customError:!1,patternMismatch:!1,rangeOverflow:!1,rangeUnderflow:!1,stepMismatch:!1,tooLong:!1,tooShort:!1,typeMismatch:!1,valid:!0,valueMissing:!1};e=Object.assign({},e,this.getMissingState(t),this.getMismatchState(t),this.getRangeState(t),this.getLengthState(t),this.getCustomState(t));let i=!1;for(let t in e)"valid"!=t&&1==e[t]&&(i=!0);return e.valid=!i,t.lastValue=t.value,t.lastValidateState=e,setTimeout((function(){delete t.lastValidateState}),1),e},reportValidity(t,e){e=e||this.getReportText(t),this.errorTip(t,e),""===e&&t.data&&t.data.errorTip&&t.data.errorTip.hide();const i=!e;return this.styleError(t,i),i},styleError(t,e){if(!t)return this;void 0===e?e=t.validity.valid:t.dispatchEvent(new CustomEvent(e?"valid":"invalid"));const i=this.getTarget(t);if(!i)return e;const s=t.form||t.closest("form")||t.customValidate&&t.customValidate.owner;return"radio"==t.type&&t.name&&s?s.querySelectorAll("input[type=radio][name="+t.name+"]").forEach(function(t){const i=this.getTarget(t);e?(i.removeAttribute("is-error"),i.removeAttribute("aria-label")):i.setAttribute("is-error","")}.bind(this)):e?(i.removeAttribute("is-error"),i.removeAttribute("aria-label")):i.setAttribute("is-error",""),e},errorTip(t,e){const i=this.getTarget(t);if(!i||!e)return this;const s=window.getComputedStyle(i);if("none"==s.display||"hidden"==s.visibility)return this;const a=function(){const i=document.validate.errorTip.control,s=document.validate.errorTip.target;if(s.errorTip(e,{onShow(t,e){const i=.5*(e.clientWidth-s.clientWidth);e.style.marginLeft=i<0?.5*(e.clientWidth-s.clientWidth)+"px":0,!1===document.validate.focusable?e.classList.add("none"):e.classList.remove("none")},onHide(t,e){const s=i.form||i.closest("form");s&&s.isImmediated&&(e.style.marginLeft="",document.validate.styleError(i))}}),!1!==document.validate.focusable&&0!==document.validate.focusable&&(document.validate.focusable=null,document.validate.getType(i)))if(-1!=e.indexOf("内容长度")&&-1!=e.indexOf("大")){const e=i.value.length,s=i.maxlength||i.getAttribute("maxlength").replace(/\D/g,"");e&&s&&document.validate.selectRange(t,document.validate.getLength(t,s),e)}else i.focus&&i.select&&(i.focus(),i.select())};document.validate.errorTip.control=t,document.validate.errorTip.target=i;const n=i.getBoundingClientRect();let r=-1;return n.top<50?r=window.pageYOffset-(50-n.top):n.bottom>window.innerHeight&&(r=window.pageYOffset+(n.bottom-window.innerHeight)),r>=0?window.scrollTopTo(r,a):a(),this},getTarget(t){if(!t)return null;let e=t;const i=t.getAttribute("type")||t.type,s=t.id,a=t.tagName.toLowerCase(),n=window.getComputedStyle(t);if("radio"==i)"1"!=n.opacity&&(e=t.parentElement.querySelector('label.ui-radio[for="'+s+'"]'));else if("checkbox"==i)"1"!=n.opacity&&(e=t.parentElement.querySelector('label.ui-checkbox[for="'+s+'"]'));else if("select"==i||"select"==a)"1"!=n.opacity&&(e=t.nextElementSibling);else if("range"==i)"none"==n.display&&(e=t.nextElementSibling);else if("hidden"==i||"none"==n.display||"hidden"==n.visibility){const i=document.getElementById(e.getAttribute("data-target"))||t.dataTarget;i&&(e=document.validate.getTarget(i))}else"textarea"==i||"textarea"==a?0==t.classList.contains("ui-textarea")&&t.parentElement.querySelector(".ui-textarea")&&(e=t.parentElement.querySelector(".ui-textarea")):"input"==a&&0==t.classList.contains("ui-input")&&t.parentElement.querySelector(".ui-input")&&(e=t.parentElement.querySelector(".ui-input"));return e}},[HTMLInputElement.prototype,HTMLSelectElement.prototype,HTMLTextAreaElement.prototype].forEach((function(t){Object.defineProperty(t,"validity",{get(){return document.validate.getValidity(this)},configurable:!0}),Object.defineProperty(t,"validationMessage",{get(){return document.validate.getReportText(this)},configurable:!0}),Object.defineProperty(t,"checkValidity",{value(){return this.validity.valid},configurable:!0}),Object.defineProperty(t,"reportValidity",{value(t){return document.validate.reportValidity(this,t)},configurable:!0}),Object.defineProperty(t,"setCustomValidity",{value(t){if(!t)return;const e=["badInput","customError","patternMismatch","rangeOverflow","rangeUnderflow","stepMismatch","tooLong","tooShort","typeMismatch","valueMissing"];this.customValidate||(this.customValidate={}),this.customValidate.report||(this.customValidate.report={}),"string"==typeof t?e.forEach((function(e){this.customValidate.report[e]=t})):"object"==typeof t&&Object.assign(this.customValidate.report,t)},configurable:!0})})),Object.defineProperty(HTMLFormElement.prototype,"checkValidity",{value(){return document.validate.checkValidity(this)},configurable:!0});return class{constructor(t,e,i){if("string"==typeof t&&(t=document.getElementById(t)||document.querySelector(t)),!t)return this;const s=t;if(s.data&&s.data.validate)return s.data.validate;s.setAttribute("novalidate","novalidate");"object"==typeof e&&(i=e,e=null);const a=Object.assign({},{multiple:!0,immediate:!0,label:!0,validate:[]},i||{});return s.querySelectorAll('[type="submit"]:disabled, [type="image"]:disabled').forEach((function(t){t.disabled=!1})),s.addEventListener("submit",(t=>{if(!this.stopValidate)return t.preventDefault(),this.checkValidity()&&("function"==typeof e&&e.call(this,s),s.dispatchEvent(new CustomEvent("valid"))),!1})),this.element={form:s},this.params={multiple:a.multiple,immediate:a.immediate,label:a.label},this.setCustomValidity(a.validate),this.count(),this.enhance(),s.data||(s.data={}),s.data.validate=this,this}setCustomValidity(t){let e=t||this.dataValidate;if(!e||!this.element||!this.element.form)return this;"function"==typeof e&&(e=e()),e&&!e.forEach&&e.id&&(e=[e]);const i=this.params.label;let s=this.element.form.elements||this.element.form.querySelectorAll("input, textarea, select");if(!s.length)return this;[...s].forEach((t=>{const s=t.id;let a={label:i,owner:this};s&&e&&e.length&&e.forEach(function(t){t.id==s&&(t.label=i,t.owner=this,a=t)}.bind(this)),this.element.form.data&&this.element.form.data.validate||(t.lastValue=t.value||""),t.customValidate=a})),this.dataValidate=t}count(){const t=this.element.form,e=Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,"value"),i=Object.getOwnPropertyDescriptor(HTMLTextAreaElement.prototype,"value");return t.querySelectorAll("input, textarea").forEach((function(s){let a=s.getAttribute("maxlength");if(a)try{s.setAttribute("maxlength","_"+a+"_")}catch(t){s.removeAttribute("maxlength"),s.maxlength=a}const n=s.getAttribute("minlength");if(!a)return;a&&(a=a.replace(/\D/g,""));const r=s.tagName.toLowerCase(),o={add(){return["ui",r].concat([].slice.call(arguments)).join("-")},toString:()=>"ui-"+r};let l=s.parentElement.querySelector("."+o.add("count"))||t.querySelector("."+o.add("count")+'[for="'+s.id+'"]');if(!l&&!s.parentElement.classList.contains(o.add("x")))return;let d=s.id;d||(d=("lulu_"+Math.random()).replace("0.",""),s.id=d),l?l.hasAttribute("for")||l.setAttribute("for",d):(l=document.createElement("label"),l.className=o.add("count"),l.setAttribute("for",d),l.innerHTML="<span>0</span><slash>/</slash><span>"+(n?n+"-":"")+a+"</span>",s.parentElement.appendChild(l));const c=l.querySelector("span, output")||l,h=function(){const t=document.validate.getLength(s);c.innerHTML=t,0!=t&&(t>a||n&&t<n)?(c.classList.add("error"),c.toggleAttribute("is-error",!0)):(c.classList.remove("error"),c.toggleAttribute("is-error",!1))};s.count=h,s.addEventListener("input",h),"input"==r?Object.defineProperty(s,"value",{...e,set(t){e.set.call(this,t),h()}}):"textarea"==r&&Object.defineProperty(s,"value",{...i,set(t){i.set.call(this,t),h()}}),h()})),t.addEventListener("reset",(function(){this.querySelectorAll("input, textarea").forEach((function(t){t.count&&setTimeout((()=>{t.count()}),1)}))})),this}enhance(){this.element.form.querySelectorAll("input, textarea").forEach((function(t){const e=document.validate.getType(t);0==/^checkbox|radio|range$/i.test(e)&&["paste","drop"].forEach((e=>{t.addEventListener(e,(function(e){const i=this.getAttribute("type")||this.type,s=e.clipboardData||e.dataTransfer;let a="";if(!s)return;let n=this.value.slice(t.selectionStart,t.selectionEnd);""!=this.value.trim()&&n!==this.value||(e.preventDefault(),e.stopPropagation(),a=s.getData("text")||"","password"!=i&&(a=a.trim()),"email"==i?a=a.replace("#","@"):"tel"==i&&(a=document.validate.getTel(a)),this.value=a,t.dispatchEvent(new CustomEvent("input")))}))}))}))}immediate(){const t=this.element.form;if(t.isImmediated)return this;const e=t=>{0!=this.params.immediate&&this.reportValidity(t.target)},i=t=>{this.params.immediate&&setTimeout(function(){document.validate.focusable=0,this.reportValidity(t.target)}.bind(this),20)},s=t=>{0!=this.params.immediate&&(document.validate.focusable=!1,this.reportValidity(t.target),t.target.lastValue=t.target.value)};t.querySelectorAll("input, select, textarea").forEach((function(t){let a=t.type,n=t.getAttribute("type");"button"!=a&&"submit"!=a&&"reset"!=a&&"file"!=a&&"image"!=a&&("radio"==a||"checkbox"==a?t.addEventListener("click",e):/select/.test(a)||/range|date|time|hour|minute|hidden/.test(n)?t.addEventListener("change",e):(t.addEventListener("focus",i),t.addEventListener("input",s)))})),t.isImmediated=!0;const a=function(){[...t.elements].forEach((t=>{let a=t.type;if(["button","submit","reset","file","image"].includes(a))return;let n=t.getAttribute("type");"radio"==a||"checkbox"==a?t.removeEventListener("click",e):/select/.test(a)||/range|date|time|hour|minute|hidden/.test(n)?t.removeEventListener("change",e):(t.removeEventListener("focus",i),t.removeEventListener("input",s))})),[...t.querySelectorAll(".valided")].forEach((t=>{t.classList.remove("valided")})),[...t.querySelectorAll("[is-error]")].forEach((t=>{let e=t.data&&t.data.errorTip;e&&e.hide(),t.removeAttribute("is-error")})),t.isImmediated=!1,t.removeEventListener("reset",a)};return t.addEventListener("reset",a),this}checkValidity(){const t=this.element.form;let e=!0;return document.validate.focusable=!0,t.querySelectorAll("input, select, textarea").forEach((t=>{if(1==e||this.params.multiple){const i=t.validity.valid;1==e&&0==i?(this.reportValidity(t),e=!1):document.validate.styleError(t,i)}})),!t.isImmediated&&this.params.immediate&&this.immediate(),e}reportValidity(t,e){t&&document.validate.reportValidity(t,e)}}})();window.Validate=Validate,HTMLFormElement.prototype.validate=function(){return new Validate(this),this},function(){const t=t=>{(t||document.querySelectorAll("[is-validate]")).forEach((t=>{t.validate(),t.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-validate"}})),t.dispatchEvent(new CustomEvent("DOMContentLoaded"))}))},e=()=>{t();new MutationObserver((e=>{e.forEach((e=>{e.addedNodes&&e.addedNodes.forEach((e=>{e.tagName&&(e.hasAttribute("is-validate")?t([e]):t(e.querySelectorAll("[is-validate]")))}))}))})).observe(document.body,{childList:!0,subtree:!0})};"loading"!=document.readyState?e():window.addEventListener("DOMContentLoaded",e)}();class Pagination extends HTMLElement{static get observedAttributes(){return["per","total","current","loading"]}constructor({per:t,total:e,current:i,loading:s,href:a,container:n=null,onChange:r=(()=>{})}={}){super();const o=this.attachShadow({mode:"open"}),l=a||this.href?"a":"button";t&&(this.per=t),e&&(this.total=e),i&&this.setAttribute("current",i),this.loading=s,this.onchange=r,o.innerHTML=`\n        <style>\n        :host {\n            display: flex;\n            font-size: 14px;\n            height: 30px;\n            align-items: center;\n        }\n\n        .ui-page {\n            display: inline-flex;\n            min-width: 18px;\n            padding: 0 var(--ui-page-padding, 2px);\n            margin: 0 5px;\n            height: var(--ui-page-height, 28px);\n            border: 1px solid transparent;\n            border-radius: var(--ui-page-radius, 0);\n            color: var(--ui-gray, #a2a9b6);\n            font-size: var(--ui-font, 14px);\n            font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;\n            transition: border-color var(--ui-animate-time, .2s), background-color var(--ui-animate-time, .2s);\n            text-decoration: none;\n            user-select: none;\n            position: relative;\n            justify-content: center;\n            align-items: center;\n            background: none;\n            box-sizing: content-box;\n        }\n\n        .ui-page:not(:focus-visible){\n            outline: 0;\n        }\n\n        .ui-page[current] {\n            cursor: default;\n        }\n\n        .ui-page:not([current]):not([disabled]):not(:disabled):hover {\n            border-color: #b6bbc6;\n            color: var(--ui-gray, #a2a9b6);\n            cursor: pointer;\n        }\n\n        .ui-page:disabled {\n            color: #ccd0d7;\n            cursor: default;\n        }\n\n        .ui-page > svg {\n            width: 20px;\n            height: 20px;\n        }\n\n        .ui-page-prev,\n        .ui-page-next {\n            text-align: center;\n            fill: currentColor;\n            overflow: hidden;\n        }\n\n        /* 当前不可点的按钮颜色 */\n        span.ui-page-prev,\n        span.ui-page-next {\n            color: var(--ui-diabled, #ccd0d7);\n        }\n\n        .ui-page-next svg {\n            transform: scaleX(-1);\n        }\n\n        .ui-page-prev {\n            margin-left: 0;\n        }\n\n        .ui-page-next {\n            margin-right: 0;\n        }\n\n        .ui-page-ellipsis {\n            display: inline-block;\n        }\n\n        :host(:not([loading]):not([data-loading=true])) .ui-page[current] {\n            color: var(--ui-white, #ffffff);\n            background-color: var(--ui-blue, #2a80eb);\n        }\n\n        .ui-page-text {\n            color: var(--ui-dark, #4c5161);\n        }\n\n        .ui-page.loading > svg {\n            visibility: hidden;\n        }\n\n        :host([loading]) .ui-page[current]::before,\n        :host([data-loading=true]) .ui-page[current]::before {\n            content: "";\n            position: absolute;\n            left: 0;\n            top: 0;\n            right: 0;\n            bottom: 0;\n            background-repeat: no-repeat;\n            width: 20px;\n            height: 20px;\n            background: url("data:image/svg+xml,%3Csvg viewBox='0 0 1024 1024' xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cpath d='M512 1024q-104 0-199-40-92-39-163-110T40 711Q0 616 0 512q0-15 10.5-25.5T36 476t25.5 10.5T72 512q0 90 35 171 33 79 94 140t140 95q81 34 171 34t171-35q79-33 140-94t95-140q34-81 34-171t-35-171q-33-79-94-140t-140-95q-81-34-171-34-15 0-25.5-10.5T476 36t10.5-25.5T512 0q104 0 199 40 92 39 163 110t110 163q40 95 40 199t-40 199q-39 92-110 163T711 984q-95 40-199 40z' fill='%232a80eb'/%3E%3C/svg%3E")\n                no-repeat center;\n            background-size: 20px 20px;\n            margin: auto;\n            animation: spin 1s linear infinite;\n        }\n\n        @keyframes spin {\n            from {\n                transform: rotate(0);\n            }\n            to {\n                transform: rotate(360deg);\n            }\n        }\n\n        .simple-page {\n            width: auto;\n            padding: 0 .625em;\n            pointer-events: none;\n            color: #4c5161;\n        }\n        .page {\n            display: inline-flex;\n            height: 100%;\n            align-items: center;\n        }\n        .pagination-wrap {\n            display: contents;\n            visibility: var(--ui-visibility, initial);\n        }\n        @media (prefers-reduced-motion: reduce) {\n            .ui-page {\n                transition: none;\n            }\n        }\n        </style>\n        <fieldset id="wrap" class="pagination-wrap">\n            <${l} class="ui-page ui-page-prev" id="left">\n                <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><path d="M85.876,100.5l49.537-50.526c4.089-4.215,4.089-11.049,0-15.262 c-4.089-4.218-10.719-4.218-14.808,0L63.586,92.868c-4.089,4.215-4.089,11.049,0,15.264l57.018,58.156 c4.089,4.215,10.719,4.215,14.808,0c4.089-4.215,4.089-11.049,0-15.262L85.876,100.5z"></path></svg>\n            </${l}>\n            <div class="page" id="page"></div>\n            <${l} class="ui-page ui-page-next" id="right">\n                <svg version="1.1" xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><path d="M85.876,100.5l49.537-50.526c4.089-4.215,4.089-11.049,0-15.262 c-4.089-4.218-10.719-4.218-14.808,0L63.586,92.868c-4.089,4.215-4.089,11.049,0,15.264l57.018,58.156 c4.089,4.215,10.719,4.215,14.808,0c4.089-4.215,4.089-11.049,0-15.262L85.876,100.5z"></path></svg>\n            </${l}>\n        </fieldset>\n        `,this.element=new Proxy({},{get:(t,e)=>{if("trigger"==e)return this.htmlFor&&document.getElementById(this.htmlFor)}}),"string"==typeof n&&(n=document.querySelector(n)),n&&n.append(this)}get per(){return Number(this.getAttribute("per"))||15}get simple(){return"short"===this.getAttribute("mode")}get total(){return Number(this.getAttribute("total"))||0}get current(){return Number(this.getAttribute("current"))||1}get loading(){return null!==this.getAttribute("loading")}get href(){return this.getAttribute("href")}set current(t){this.setAttribute("current",Math.min(Math.max(1,t),this.count))}set per(t){this.setAttribute("per",t)}set total(t){this.setAttribute("total",t)}set loading(t){t?this.setAttribute("loading",""):this.removeAttribute("loading")}get htmlFor(){return this.getAttribute("for")}set htmlFor(t){this.setAttribute("for",t)}render(t,e){const i=this.href?"a":"button";this.count=Math.ceil(e/t)||1;const s=Math.min(Math.max(1,this.current),this.count);if(this.simple){const t=`<div class="simple-page ui-page" >${s} / ${this.count}</div>`;this.page.innerHTML=t}else{const t=Array.from({length:this.count}).splice(0,9).map(((t,e)=>`<${i} class="ui-page" data-current="${e+1}" aria-label="第${e+1}页，共${this.count}页">${e+1}</${i}>`)).join("");this.page.innerHTML=t}clearTimeout(this.timerRender),this.timerRender=setTimeout((()=>{this.updatePage(s)}))}updatePage(t=this.current){if(1==t?(this.left.setAttribute("disabled",!0),this.left.setAttribute("aria-label","已经是第一页了"),this.left.removeAttribute("href")):(this.left.removeAttribute("disabled"),this.left.setAttribute("aria-label",`上一页，当前第${t}页`),this.left.href=this.href?this.href.replace(/\${current}/g,t-1):"javascript:;"),t==this.count?(this.right.setAttribute("disabled",!0),this.right.setAttribute("aria-label","已经是最后一页了"),this.right.removeAttribute("href")):(this.right.removeAttribute("disabled"),this.right.setAttribute("aria-label",`下一页，当前第${t}页`),this.right.href=this.href?this.href.replace(/\${current}/g,t+1):"javascript:;"),this.simple)this.page.querySelector(".simple-page").textContent=t+" / "+this.count;else if(this.count>9){let e=[];switch(t){case 1:case 2:case 3:case 4:case 5:e=[1,2,3,4,5,6,7,"next",this.count];break;case this.count:case this.count-1:case this.count-2:case this.count-3:case this.count-4:e=[1,"pre",this.count-6,this.count-5,this.count-4,this.count-3,this.count-2,this.count-1,this.count];break;default:e=[1,"pre",t-2,t-1,t,t+1,t+2,"next",this.count]}this.page.querySelectorAll(".ui-page").forEach(((i,s)=>{"number"==typeof e[s]?(i.dataset.current=e[s],i.textContent=e[s],i.disabled=!1,i.href="javascript:;",e[s]==t?(i.setAttribute("current",""),this.isKeepFocusIn&&i.focus({preventScroll:!0})):i.removeAttribute("current"),i.removeAttribute("disabled"),i.setAttribute("aria-label",`第${e[s]}页，共${this.count}页`),this.href&&(i.href=this.href.replace(/\${current}/g,i.dataset.current))):(i.textContent="...",i.removeAttribute("current"),i.removeAttribute("data-current"),i.removeAttribute("aria-label"),i.setAttribute("disabled",!0),i.removeAttribute("href"))}))}else this.page.querySelectorAll(".ui-page").forEach((e=>{e.dataset.current==t?(e.setAttribute("current",""),this.isKeepFocusIn&&e.focus({preventScroll:!0})):e.removeAttribute("current"),this.href&&(e.href=this.href.replace(/\${current}/g,e.dataset.current))}))}focusPrev(){const t=this.shadowRoot.activeElement;if(t===this.right)this.simple?this.left.focus():this.page.lastElementChild.focus();else{const e=t.previousElementSibling;e?e.disabled?e.previousElementSibling.focus():e.focus():this.left.focus()}}focusNext(){const t=this.shadowRoot.activeElement;if(t===this.left)this.simple?this.right.focus():this.page.firstElementChild.focus();else{const e=t.nextElementSibling;e?e.disabled?e.nextElementSibling.focus():e.focus():this.right.focus()}}connectedCallback(){this.page=this.shadowRoot.getElementById("page"),this.left=this.shadowRoot.getElementById("left"),this.right=this.shadowRoot.getElementById("right"),this.wrap=this.shadowRoot.getElementById("wrap"),this.render(this.per,this.total),this.page.addEventListener("click",(t=>{const e=t.target.closest(".ui-page");e&&(this.nativeClick=!0,this.current=Number(e.dataset.current))})),this.page.addEventListener("focusin",(()=>{this.isKeepFocusIn=!0})),this.addEventListener("keydown",(t=>{if(!this.loading)switch(t.key){case"ArrowDown":case"PageDown":t.preventDefault(),this.nativeClick=!0,this.current--;break;case"ArrowUp":case"PageUp":t.preventDefault(),this.nativeClick=!0,this.current++;break;case"ArrowLeft":this.focusPrev();break;case"ArrowRight":this.focusNext()}})),this.left.addEventListener("click",(()=>{this.nativeClick=!0,this.current--,this.left.focus()})),this.right.addEventListener("click",(()=>{this.nativeClick=!0,this.current++,this.right.focus()})),this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-pagination"}})),this.isConnectedCallback=!0,this.dispatchEvent(new CustomEvent("DOMContentLoaded"))}attributeChangedCallback(t,e,i){if(!this.page||e===i)return;let s=this.element&&this.element.trigger;"per"==t?(this.render(i,this.total),s&&(s.dataset.per=i)):"total"==t?(this.render(this.per,i),s&&(s.dataset.total=i)):"loading"==t?(this.wrap.disabled=null!==i,s&&(s.dataset.loading=null!==i)):"current"==t&&e!==i&&(clearTimeout(this.timerRender),this.timerRender=setTimeout((()=>{this.updatePage(Number(i))})),s&&(s.dataset.current=i),this.nativeClick&&(this.nativeClick=!1,this.dispatchEvent(new CustomEvent("change",{detail:{current:Number(i),per:this.per,total:this.total}})),s&&s!=this&&s.dispatchEvent(new CustomEvent("change",{detail:{current:Number(i),per:this.per,total:this.total}}))))}}customElements.get("ui-pagination")||customElements.define("ui-pagination",Pagination),window.Pagination=Pagination,HTMLElement.prototype.pagination=function(t){if(this.matches("ui-pagination")||this["ui-pagination"])return this;const{total:e=0,current:i=1,per:s=15,href:a=null,loading:n=!1}=this.dataset;let r=Object.assign({},{per:s,total:e,href:a,loading:n},t||{});const o=new Pagination(r),l=this.id||("lulu_"+Math.random()).replace("0.","");this.innerHTML="",this.id=l,this["ui-pagination"]=o,o.htmlFor=l,o.setAttribute("current",i),o.addEventListener("connected",(()=>{this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-pagination"}})),o.remove(),this.dispatchEvent(new CustomEvent("DOMContentLoaded"))})),document.body.append(o);return this.attachShadow({mode:"open"}).append(o.shadowRoot),this.setAttribute("defined",""),this},function(){const t=t=>{(t||document.querySelectorAll("[is-pagination]")).forEach((t=>{t.pagination()}))},e=()=>{t();new MutationObserver((e=>{e.forEach((e=>{e.addedNodes&&e.addedNodes.forEach((e=>{e.tagName&&(e.hasAttribute("is-pagination")?t([e]):t(e.querySelectorAll("[is-pagination]")))}))}))})).observe(document.body,{childList:!0,subtree:!0})};"loading"!=document.readyState?e():window.addEventListener("DOMContentLoaded",e)}();const Table=function(){let t="table-x",e="table-null-x",i="table-error-x",s="table-page",a='[type="checkbox"]';class n extends HTMLTableElement{static get defaultKeyMap(){return{key:"",total:"total",per:"per",current:"current"}}static scrollTopTo(t,e){let i=document.scrollingElement.scrollTop,s=function(){if(i+=(t-i)/2,Math.abs(i-t)<=1)return document.scrollingElement.scrollTop=t,void(e&&e());document.scrollingElement.scrollTop=i,requestAnimationFrame(s)};s()}constructor(){super(),this.params=this.params||{},this.element=this.element||{},this.params.parse=t=>this.params.template?this.params.template.interpolate(t):"",this.params.ajax={},this.params.form={},this.params.list=[15,30,50],this.params.page={total:0,per:15,current:1,keyMap:n.defaultKeyMap}}setParams(t){let e=(t=t||{}).page;return e&&(e.keyMap=Object.assign({},this.params.page.keyMap||n.defaultKeyMap,e.keyMap||{})),this.params=Object.assign(this.params,t),this}events(){let t=this.params,e=this.element;this.addEventListener("click",(function(t){let e=t.target;if(!e||"checkbox"!=e.type)return;if(e.closest("tr").querySelector(":first-child "+a)!==e)return;let i=[];this.querySelectorAll("tr").forEach((function(t){if(0==t.clientWidth)return;let e=t.querySelector("td:first-child "+a+":enabled");e&&i.push(e)}));let s=!1,n=!1;if(e.closest("th"))s=e.checked,n=!s,i.forEach((function(t){t.checked=s}));else{let t=[].slice.call(i).filter((function(t){return t.checked})).length;s=i.length==t,n=0==t}let r=this.querySelector("th:first-child "+a);r&&(r.checked=s),i.forEach((function(t){t.closest("tr").classList[t.checked?"add":"remove"]("selected")})),this.dispatchEvent(new CustomEvent("check",{detail:{isAllChecked:s,isAllUnchecked:n,target:e,allEnabledCheckbox:i}}))})),this.addEventListener("click",(function(t){let e=t.target,i=null;e&&0==/^(?:a|input|textarea|tbody|i|select|label|th)$/i.test(e.tagName)&&(i=e.closest("tr")&&e.closest("tr").querySelector("td:first-child "+a+":enabled"),i&&i.click())}));let i=this.element.pagination;i&&i.addEventListener("change",(e=>{let s=e.detail.current;t.page.current=s,i.loading=!0,this.ajax()}));let s=this.id,n=t.page.per,r=e.drop;r&&r.list&&(s&&localStorage[s]&&(n=localStorage[s],t.page.per=Number(n)),r.textContent=n,r.list((()=>t.list.map((function(t){return{value:t}}))),{width:60,onSelect:e=>{let i=e.value;s&&(localStorage[s]=i),t.page.per!=i&&(t.page.per=i,t.page.current=1,this.ajax())}}));let o=this.form;o&&new Validate(o,(()=>{t.page.current=1,this.ajax({data:this.params.form.data||{}})}),{validate:()=>this.params.form.validate||[]})}ajax(t){t=t||{};let s=this.params,a=this.element;if("true"==this.getAttribute("aria-busy"))return this;let r=this.parentElement,o=this.querySelector("tbody"),l=this.form,d={data:{}};if(l){let t=l.getAttribute("action");t&&(d.url=t),l.querySelectorAll("input[name]:enabled, select[name]:enabled, textarea[name]:enabled").forEach((t=>{/^(?:submit|image|file)$/.test(t.type)||(d.data[t.name]=t.value)}))}let c=Object.assign({},this.dataset,d,s.ajax,t);if(!c.url)return this.element.pagination&&(this.element.pagination.loading=!1),this;/^\/\//.test(c.url)&&(c.url=location.protocol+c.url);let h=t.data||{},u=d.data,p=s.ajax.data||{};"function"==typeof p&&(p=p()||{}),"function"==typeof u&&(u=u()||{}),"function"==typeof h&&(h=h()||{});let m={},g=s.page.keyMap;g&&(m[g.current]=s.page.current,m[g.per]=s.page.per);let f=Object.assign({},m,u,p,h);g&&(s.page.current=f[g.current],s.page.per=f[g.per]);let v=new URLSearchParams(f),b=c.url,y="?";b.split("?").length>1&&(y=y+b.split("?")[1]+"&"),b=b.split("?")[0]+y+v.toString();let E=t=>{let e=a.error||r.querySelector("."+i);e||(e=document.createElement("div"),e.className=i,this.insertAdjacentElement("afterend",e),a.error=e),e.style.display="flex",e.innerHTML=t||"数据没有获取成功","function"==typeof c.error&&c.error()},w=()=>{this.removeAttribute("aria-busy"),a.loading&&(a.loading.style.display="none"),a.pagination&&(a.pagination.loading=!1),"function"==typeof c.complete&&c.complete(),this.show()},A=()=>{let t=new XMLHttpRequest;t.open("GET",b),t.onload=()=>{let i={};try{i=JSON.parse(t.responseText)||{}}catch(t){return void E("解析异常，请稍后重试")}if(0!==i.code&&0!==i.error)return void E(i.msg||"返回数据格式不符合要求");let n=s.parse(i);o.innerHTML=n||"";let l=a.empty;n&&n.trim()||(l||(l=document.querySelector("."+e)||document.createElement("div"),l.className=e,this.insertAdjacentElement("afterend",l),a.empty=l),l.style.display="flex");let d,h=g.key;d=h?i.data[h][g.total]:i.data[g.total],(d||0==d)&&(r.querySelectorAll('output[data-type="total"]').forEach((function(t){t.innerHTML=d})),s.page.total=d),this.page(),"function"==typeof c.success&&c.success(i)},t.onerror=()=>{E("网络异常，数据没有获取成功，您可以稍后重试！")},t.onloadend=()=>{w()},t.send(),this.setAttribute("aria-busy","true")},$=window.pageYOffset,x=a.loading;if(x||(x=document.createElement("ui-loading"),x.setAttribute("rows",15),this.insertAdjacentElement("afterend",x),a.loading=x),x.style.paddingBottom="","none"==window.getComputedStyle(x).display){let t=this.querySelector("thead");x.style.height=this.clientHeight-(t?t.clientHeight:0)+"px",""==o.innerHTML.trim()&&(x.style.height="")}let C=parseFloat(x.style.height)-window.innerHeight;C>0&&(x.style.paddingBottom=C+"px"),x.style.display="block",a.empty&&(a.empty.style.display="none"),a.error&&(a.error.style.display="none"),o.innerHTML="";let L=this.getBoundingClientRect();return!this.isFirstAjax&&L.top<0?($=L.top+$,n.scrollTopTo($,A)):!this.isFirstAjax&&L.top>window.innerHeight?($-=L.top,n.scrollTopTo($,A)):(A(),this.isFirstAjax=!1),this}page(t){let e=this.params.page,i=this.element.pagination;if(!i)return;let s={total:t||e.total,current:e.current,per:e.per,mode:e.mode||"long"};for(let t in s)i[t]=s[t]}show(){this.element.loading&&(this.element.loading.style.paddingBottom="");let t=this.querySelector("th:first-child "+a);return t&&(t.checked=!1),this.dispatchEvent(new CustomEvent("show",{detail:{type:"ui-table"}})),this}connectedCallback(){let e=this.querySelector("tbody");e||(e=document.createElement("tbody"),this.append(e));let i=this.querySelector("template");i&&(this.params.template=i.innerHTML);let a=this.closest("."+t),n=null;if(a){if(n=a.querySelector("ui-pagination"),n)this.element.pagination=n,this.setParams({page:{current:n.current,total:n.total,per:n.per}});else{n=document.createElement("ui-pagination"),this.element.pagination=n;let t=a.querySelector("."+s);t&&t.appendChild(n)}let t=a.querySelector("ui-loading");t&&(this.element.loading=t);let e=a.querySelector('ui-drop[data-type="per"]');e&&(this.element.drop=e)}setTimeout((()=>{this.events(),""==e.textContent.trim()?(this.isFirstAjax=!0,this.ajax()):this.page()}),1),this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-table"}})),this.isConnectedCallback=!0,this.dispatchEvent(new CustomEvent("DOMContentLoaded"))}}return"".interpolate||(String.prototype.interpolate=function(t){const e=Object.keys(t),i=Object.values(t);return new Function(...e,`return \`${s=this,s.replace(/&(lt|gt|amp|quot);/gi,(function(t,e){return{lt:"<",gt:">",amp:"&",quot:'"'}[e]}))}\`;`)(...i);var s}),n}();Object.defineProperty(HTMLTableElement.prototype,"form",{get(){let t=this.getAttribute("form");return t?document.getElementById(t):null}}),customElements.get("ui-table")||customElements.define("ui-table",Table,{extends:"table"});class Form extends HTMLFormElement{constructor(){return super(),this.element=this.element||{},this.params=this.params||{},this.callback=this.callback||{},Object.defineProperty(this.params,"validate",{set(t){this.validate&&this.validate.setCustomValidity(t)}}),this}ajax(){let t=this.callback;t=t||function(){},"function"==typeof t&&(t={success:t});let e=null,i=this.element.submit;e=i.id&&document.querySelector("label[for="+i.id+"]"),e||(e=i),this.element.button=e;let s=this.action.split("#")[0]||location.href.split("#")[0],a=this.method||"POST",n=this.enctype;e.loading=!0,i.setAttribute("disabled","disabled");let r=new FormData(this);this.params.data&&Object.keys(this.params.data).forEach((t=>{r.append(t,this.params.data[t])}));let o=new URLSearchParams(r).toString();"get"==a.toLowerCase()&&(s=s.split("?").length>1?s+"&"+o:s+"?"+o);let l=new XMLHttpRequest;l.open(a,s),n&&l.setRequestHeader("Content-Type",n),t.beforeSend&&t.beforeSend.call(this,l,r),l.onload=()=>{let e={};try{e=JSON.parse(l.responseText)}catch(e){return new LightTip("返回数据解析出错。","error"),t.error&&t.error.call(this,e),void this.dispatchEvent(new CustomEvent("error",{detail:{data:{code:-1,msg:"解析出错"}}}))}!e||0!==e.code&&0!==e.error?(new LightTip(e&&e.msg||"返回数据格式不符合要求。","error"),t.error&&t.error.call(this,e),this.dispatchEvent(new CustomEvent("error",{detail:{data:e}}))):(t.success?t.success.call(this,e):(new LightTip(e.msg||"操作成功。","success"),this.reset()),this.dispatchEvent(new CustomEvent("success",{detail:{data:e}})))},l.onerror=()=>{new LightTip("网络异常，刚才的操作没有成功，您可以稍后重试。","error"),t.error&&t.error.apply(this,arguments),this.dispatchEvent(new CustomEvent("error",{detail:{code:-1,msg:"网络异常"}}))},l.onloadend=()=>{e.loading=!1,i.removeAttribute("disabled"),t.complete&&t.complete.apply(this,arguments),this.dispatchEvent(new CustomEvent("complete"))},n&&"application/x-www-form-urlencoded"===n.toLowerCase()?l.send(o):l.send(r)}connectedCallback(){let t=[...this.elements].filter((function(t){return t.type&&/^(?:submit|image)$/i.test(t.type)}))[0]||this.querySelector("button:nth-last-of-type(1)");t||(t=(()=>{let t=document.createElement("button");return t.type="submit",t.setAttribute("hidden",""),this.appendChild(t),t})()),this.element.submit=t,this.validate=new Validate(this,(()=>{let t=this.params.avoidSend||this.callback.avoidSend;t&&t(this)||this.ajax()}),this.params.validate||{}),this.dispatchEvent(new CustomEvent("connected",{detail:{type:"ui-form"}})),this.isConnectedCallback=!0,this.dispatchEvent(new CustomEvent("DOMContentLoaded"))}}customElements.get("ui-form")||customElements.define("ui-form",Form,{extends:"form"});