tesses-backup/TessesDedupWeb/wwwroot/js/beer.min.js

3 lines
8.5 KiB
JavaScript
Raw Normal View History

2024-07-23 03:49:40 +00:00
let m,S,M,P;const d={light:"",dark:""},j=[];async function U(t){return await new Promise(e=>setTimeout(e,t))}function X(){return"fxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=Math.random()*16|0;return(t==="x"?e:e&3|8).toString(16)})}function x(t,e){try{return typeof t=="string"?(e!=null?e:document).querySelector(t):t}catch{return null}}function y(t,e){try{return typeof t=="string"?(e!=null?e:document).querySelectorAll(t):t!=null?t:j}catch{return j}}function g(t,e){var n,r;return(r=(n=t==null?void 0:t.classList)==null?void 0:n.contains(e))!=null?r:!1}function L(t,e){var n;return((n=t==null?void 0:t.tagName)==null?void 0:n.toLowerCase())===e}function C(t,e){var n;return((n=t==null?void 0:t.type)==null?void 0:n.toLowerCase())===e}function h(t,e){var n;(n=t==null?void 0:t.classList)==null||n.add(e)}function f(t,e){var n;(n=t==null?void 0:t.classList)==null||n.remove(e)}function p(t,e,n,r=!0){t==null||t.addEventListener(e,n,r)}function H(t,e,n,r=!0){t==null||t.removeEventListener(e,n,r)}function Y(t,e){var n;(n=e==null?void 0:e.parentNode)==null||n.insertBefore(t,e)}function N(t){return t==null?void 0:t.previousElementSibling}function K(t){return t==null?void 0:t.nextElementSibling}function k(t){return t==null?void 0:t.parentElement}function J(t){const e=document.createElement("div");for(let n=0,r=Object.keys(t),a=r.length;n<a;n++){const c=r[n];e.setAttribute(c,t[c])}return e}function w(t){const e=t;C(e,"number")&&!e.value&&(e.value=""),e.placeholder||(e.placeholder=" "),t.getAttribute("data-ui")&&D(t,null)}function tt(t){D(t.currentTarget,null,null,t)}function et(t){const e=t.currentTarget,n=k(e),r=x("input:not([type=file], [type=checkbox], [type=radio]), select, textarea",n);r&&r.focus()}function nt(t){const e=t.currentTarget;w(e)}function rt(t){const e=t.currentTarget;w(e)}function R(t){H(document.body,"click",R);const e=t.target,n=y("menu.active");for(let r=0,a=n.length;r<a;r++)I(e,n[r],t)}function it(t){const e=t.currentTarget;f(e,"active"),m&&clearTimeout(m)}function at(t){const e=t.currentTarget;$(e)}function ot(t){const e=t.currentTarget;_(e)}function ct(t){const e=t.currentTarget;$(e,t)}function ut(t){const e=t.currentTarget;_(e,t)}function st(t){const e=t.currentTarget;Z(e)}function B(){S&&clearTimeout(S),S=setTimeout(()=>{A()},180)}function $(t,e){if(e&&e.key==="Enter"){const a=N(t);return C(a,"file")?a.click():void 0}const n=t,r=K(t);!C(r,"text")||(r.value=n.files?Array.from(n.files).map(a=>a.name).join(", "):"",r.readOnly=!0,p(r,"keydown",ct,!1),w(r))}function _(t,e){if(e&&e.key==="Enter"){const a=N(t);return C(a,"color")?a.click():void 0}const n=t,r=K(t);!C(r,"text")||(r.readOnly=!0,r.value=n.value,p(r,"keydown",ut,!1),w(r))}function Z(t){const e=k(t),n=k(t);e.removeAttribute("style"),g(e,"min")&&e.style.setProperty("---size",`${Math.max(t.scrollHeight,n.offsetHeight)}px`)}function V(t){const e=k(t),n=x("span",e),r=y("input",e);if(!r.length||!n)return;const a=parseInt(getComputedStyle(document.documentElement).getPropertyValue("--size"))||16,c=g(e,"max")?0:.25*a*100/r[0].offsetWidth,o=[],l=[];for(let T=0,W=r.length;T<W;T++){const O=parseFloat(r[T].min)||0,G=parseFloat(r[T].max)||100,q=parseFloat(r[T].value)||0,z=(q-O)*100/(G-O),Q=c/2-c*z/100;o.push(z+Q),l.push(q)}let i=o[0],u=0,s=100-u-i,v=l[0],b=l[1]||0;r.length>1&&(i=Math.abs(o[1]-o[0]),u=o[1]>o[0]?o[0]:o[1],s=100-u-i,b>v&&(v=l[1]||0,b=l[0])),e.style.setProperty("---start",`${u}%`),e.style.setProperty("---end",`${s}%`),e.style.setProperty("---value1",`'${v}'`),e.style.setProperty("---value2",`'${b}'`)}function F(t){if(t){const n=t.target;if(n.type==="range")return V(n)}const e=y(".slider > input[type=range]");e.length?p(globalThis,"input",F,!1):H(globalThis,"input",F,!1);for(let n=0,r=e.length;n<r;n++)V(e[n])}async function D(t,e,n,r){if(!(!e&&(e=x(t.getAttribute("data-ui")),!e))){if(L(e,"dialog"))return await ft(t,e);if(L(e,"menu"))return I(t,e,r);if(g(e,"snackbar"))return dt(t,e,n);if(g(e,"page"))return lt(t,e);if(E(t),g(e,"active"))return f(e,"active");h(e,"active")}}function E(t){t.id&&g(t,"page")&&(t=x(`[data-ui="#${t.id}"]`));const e
export default globalThis.ui;