2022-08-28 19:28:03 +00:00
|
|
|
(()=>{"use strict";const t=function(t,e){return t instanceof DOMPoint?DOMPoint.fromPoint(t):t instanceof DOMRect?new DOMPoint(t.x,t.y):new DOMPoint(t,e)},e=t;function n(e){const{best:n}=e;return t(n.x?.rawDistance??0,n.y?.rawDistance??0)}const a=/[|;,\s]/;function s(t,e){if(null===t)return[];const n=t.split(a);return void 0===e?n:Object.values(e).filter((t=>n.includes(t)))}function o(t,e){const n=Array.isArray(t)?t:[t];return void 0===e?n.join("|"):Object.values(e).filter((t=>n.includes(t))).join("|")}const r=function(t,e){return customElements.get(e)?Promise.reject(new Error(`Already defined <${e}>`)):(customElements.define(e,t),customElements.whenDefined(e))};var i;!function(t){t.topToTop="topToTop",t.topToBottom="topToBottom",t.rightToRight="rightToRight",t.rightToLeft="rightToLeft",t.bottomToTop="bottomToTop",t.bottomToBottom="bottomToBottom",t.leftToRight="leftToRight",t.leftToLeft="leftToLeft",t.xCenterToXCenter="xCenterToXCenter",t.yCenterToYCenter="yCenterToYCenter"}(i||(i={}));const c=[i.rightToRight,i.rightToLeft,i.leftToRight,i.leftToLeft,i.xCenterToXCenter],l=[i.topToTop,i.topToBottom,i.bottomToTop,i.bottomToBottom,i.yCenterToYCenter],u=i;var g;let h;!function(t){t.outer="outer",t.inner="inner",t.center="center",t.extend="extend"}(g||(g={})),function(t){t.inner="inner",t.center="center"}(h||(h={}));const f=g;var d;!function(t){t.disabled="disabled",t.group="group",t.unattractable="unattractable",t.unmovable="unmovable",t.attractDistance="attract-distance",t.alignTo="align-to",t.alignToParent="align-to-parent",t.crossPrevent="cross-prevent",t.offsetUnit="offset-unit"}(d||(d={}));const m=d;var b;!function(t){t.parent="parent"}(b||(b={}));const p=b;var T;!function(t){t.magnetstart="magnetstart",t.magnetmove="magnetmove",t.magnetend="magnetend",t.attract="attract",t.attracted="attracted",t.attractmove="attractmove",t.attractedmove="attractedmove",t.unattract="unattract",t.unattracted="unattracted"}(T||(T={}));const y=T;var D;!function(t){t.pixel="px",t.px="px",t.percentage="%",t["%"]="%"}(D||(D={}));const x=D,{isNaN:v}=globalThis,{abs:P}=Math,A=document.createElement("template"),M={[m.disabled]:!1,[m.group]:null,[m.attractDistance]:10,[m.unattractable]:!1,[m.unmovable]:!1,get[m.alignTo](){return[f.outer,f.center,f.extend]},get[m.alignToParent](){return[]},get[m.crossPrevent](){return[]},[m.offsetUnit]:x.pixel};A.innerHTML="\n <style>\n :host {\n position: relative;\n display: inline-block;\n }\n </style>\n <slot>\n </slot>\n";class w extends HTMLElement{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.append(A.content.cloneNode(!0))}static get ALIGNMENT(){return{...u}}static get ALIGN_TO(){return{...f}}static get ALIGN_TO_PARENT(){return{...h}}static get CROSS_PREVENT(){return{...p}}static get EVENT(){return{...y}}static getAlignmentsFromAlignTo(t){const e=Array.isArray(t)?t:[t],n=[];return e.includes(f.outer)&&n.push(u.topToBottom,u.rightToLeft,u.bottomToTop,u.leftToRight),e.includes(f.inner)&&n.push(u.topToTop,u.rightToRight,u.bottomToBottom,u.leftToLeft),e.includes(f.center)&&n.push(u.xCenterToXCenter,u.yCenterToYCenter),n}static getMagnetAttractionOffset=n;get disabled(){return null!==this.traceMagnetAttributeValue(m.disabled)}set disabled(t){t?this.setAttribute(m.disabled,""):this.removeAttribute(m.disabled)}get group(){return this.traceMagnetAttributeValue(m.group)}set group(t){null===t||0===t.length?this.removeAttribute(m.group):this.setAttribute(m.group,t)}get parentMagnet(){const t=this.getAttribute(m.group);let e=this.parentElement;for(;e;){if(e instanceof w){const n=e.getAttribute(m.group);if(null===t||null===n||t===n)return e}e=e.parentElement}return null}get unattractable(){return null!==this.traceMagnetAttributeValue(m.unattractable)}set unattractable(t){t?this.setAttribute(m.unattractable,""):this.removeAttribute(m.unattractable)}get unmovable(){return null!==this.traceMagnetAttributeValue(m.unmovable)}set unmovable(t){t?this.setAttribute(m.unmovable,""):this.removeAttribute(m.unmovable)}get attractDistance(){const t=this.traceMagnetAttributeValue(m.attrac
|