@dflex/draggable
Advanced tools
Comparing version 3.9.2 to 3.9.3
@@ -1,1 +0,1 @@ | ||
class t{constructor(t,i){this.x=t,this.y=i}}class i extends t{setAxes(t,i){this.x=t,this.y=i}clone(t){this.setAxes(t.x,t.y)}getInstance(){return{x:this.x,y:this.y}}isInstanceEqual(t){return this.x===t.x&&this.y===t.y}isEqual(t,i){return this.x===t&&this.y===i}isNotEqual(t,i){return this.x!==t||this.y!==i}}class s{constructor(t,i,s,n){this.top=t,this.right=i,this.bottom=s,this.left=n}}class n extends s{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,i,s,n){return this.top=t,this.right=i,this.bottom=s,this.left=n,this}getBox(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}setByAxis(t,i,s){"x"===t?(this.left=i,this.right=s):(this.top=i,this.bottom=s)}setOne(t,i,s){"x"===t?-1===i?this.left=s:this.right=s:-1===i?this.top=s:this.bottom=s}getOne(t,i){return"x"===t?-1===i?this.left:this.right:-1===i?this.top:this.bottom}setPositionInstance(t){this.top=t.y,this.left=t.x}setPosition(t,i){this.top=i,this.left=t}hasEqualPosition(t,i){return this.top===i||this.left===t}getPosition(){return{x:this.left,y:this.top}}}class e extends n{t(t){return this.top>=t.bottom}i(t){return this.bottom<=t.top}h(t){return this.right<=t.left}o(t){return this.left>=t.right}u(t){return this.top<t.top}l(t){return this.right>t.right}g(t){return this.bottom>t.bottom}m(t){return this.left<t.left}p(t){return this.top>=t.top}_(t){return this.right<=t.right}S(t){return this.bottom<=t.bottom}T(t){return this.left>=t.left}isBoxIntersect(t){return!(this.i(t)||this.o(t)||this.t(t)||this.h(t))}isOutThreshold(t,i,s){if(i.setBox(!1,!1,!1,!1),s){if("y"===s){const s=this.u(t),n=this.g(t);return s&&(i.top=!0),n&&(i.bottom=!0),s||n}const n=this.m(t),e=this.l(t);return n&&(i.left=!0),e&&(i.right=!0),n||e}return this.u(t)?(i.top=!0,!0):this.l(t)?(i.right=!0,!0):this.g(t)?(i.bottom=!0,!0):!!this.m(t)&&(i.left=!0,!0)}isInsideThreshold(t){return this.p(t)&&this._(t)&&this.S(t)&&this.T(t)}getSurroundingBox(t){return{left:Math.min(t.left,this.left),top:Math.min(t.top,this.top),right:Math.max(t.right,this.right),bottom:Math.max(t.bottom,this.bottom)}}isPositionedY(t){return this.t(t)||this.i(t)}assignBiggestBox(t){const{top:i,left:s,right:n,bottom:e}=t;s<this.left&&(this.left=s),i<this.top&&(this.top=i),n>this.right&&(this.right=n),e>this.bottom&&(this.bottom=e)}}function h(t,i){return`${t}_${i}`}function r(t){const i={easing:"ease-in",duration:"dynamic"};return void 0===t?i:null===t?null:{...i,...t}}function o(){}const u="height",l="width",c="position";class a extends e{constructor(t,i,s,n){super(t,i,s,n),this.width=i-n,this.height=s-t}setByPointAndDimensions(t,i,s,n){this.top=t,this.left=i,this.width=n,this.height=s,this.right=i+n,this.bottom=t+s}setAxes(t,i){this.left=t,this.right=this.width+t,this.top=i,this.bottom=this.height+i}getDimensionDiff(t,i){const s=function(t){return"x"===t?l:u}(t);return this[s]-i[s]}getPositionDiff(t,i){const s=function(t){return"x"===t?"left":"top"}(t);return this[s]-i[t]}}class d extends i{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,i){const{top:s,left:n,bottom:h,right:r}=t;return i?new e(s+this.y,r-this.x,h-this.y,n+this.x):new e(s-this.y,r+this.x,h+this.y,n-this.x)}onSameAxis(t,i){return"y"===t?i.x===this.x:i.y===this.y}}class f{constructor(){this.O={}}newTravel(t){return void 0===this.O[t]?this.O[t]=0:this.O[t]+=1,`${t}${this.O[t]}`}}const g="dflex_id_",[m,p]=function(t){let i=null,s=!1;function n(){i&&(clearTimeout(i),i=null)}return[function(t,e){const h=t||o;s=!0,e&&n(),i=setTimeout((()=>{s=!1,h()}),0)},n,function(){return s}]}();class y{constructor(){this.D={},this.K=new Set}v(t){Array.isArray(this.D[t])||(this.D[t]=[])}$(t,i,s){this.D[i].push(t),s&&this.K.add(s)}A(t){return!Array.isArray(this.D[t])||0===this.D[t].length}hasElm(t){return this.K.has(t)}enqueueBeforeLast(t,i,s,n){this.v(s);const{length:e}=this.D[s];0===e?this.D[s].push(i):this.D[s][e-1]=i,this.$(t,s,n)}enqueue(t,i,s){this.v(i),this.$(t,i,s)}executeQueue(t){const i=[];if(this.A(t))return i;try{this.D[t].forEach((t=>{const s=t();i.push(s)}))}catch(t){}finally{p(),delete this.D[t]}return i}B(t){m((()=>{const[i,s]=t;this.executeQueue(i),s&&queueMicrotask((()=>this.executeQueue(s))),this.K.clear()}),!0)}scheduleNextTask(t){this.B(t)}cancelQueuedTask(){p()}clear(){p(),this.D={},this.K.clear()}}const x=Object.freeze(["x","y"]);let b=new WeakMap;function _(t,i,s){t.style.setProperty(i,s)}function S(t,i){t.style.removeProperty(i)}function w(t,i,s){const n=function(t){if(b.has(t))return b.get(t);const i={computedStyle:getComputedStyle(t),parsedProperties:new Map};return b.set(t,i),i}(t),{parsedProperties:e,computedStyle:h}=n,r=e.get(i);if(void 0===r){const t=h.getPropertyValue(i),n=s?function(t){const i=parseFloat(t);return Number.isNaN(i)?0:i}(t):t;return e.set(i,n),n}return r}const T={height:["border-top-width","border-bottom-width","padding-top","padding-bottom"],width:["border-left-width","border-right-width","padding-left","padding-right"]},O={height:"offsetHeight",width:"offsetWidth"};function D(t,i){let s=0;return T[i].forEach((i=>{s+=w(t,i,!0)})),t[O[i]]-s}const E=/absolute|fixed/;const K="dflex_ky_",v="dflex_sk_",$="dflex_bk_";class A{constructor(){this.P()}P(){this.I={},this.M=0,this.C={},this.R={},this.N={},this.k={},this.q=-99,this.F=null,this.H=`${K}${h(0,0)}`}L(t,i){Array.isArray(this.R[i])?this.R[i].find((i=>i===t))||this.R[i].push(t):this.R[i]=[t]}j(t,i){return Array.isArray(this.C[i])||(this.C[i]=[]),this.C[i].push(t)-1}X(t){for(let i=t;i<=t+2;i+=1)void 0===this.I[i]&&(this.I[i]=0)}G(t,i,s,n){const{BK:e,PK:r}=s,o=e!==this.F;this.F=e,o&&(this.I[t]=0);const u=`${v}${h(t,n)}`;let l=null;return t>0&&(l=this.H),o&&(this.N[e][t]={SK:u,id:i}),this.I[t]+=1,{siblingsIndex:n,CHK:l,SK:u,PK:r,BK:e}}W(t,i,s){const n=t+1;if(void 0===this.I[n]&&this.X(t),t<this.q){this.M+=1;const i=s?t:t-1;for(let t=0;t<=i;t+=1)this.I[t]=0}const e=`${$}${this.M}`;Array.isArray(this.N[e])||(this.N[e]=[]),s&&this.I[n]>0&&(this.I[n]-=1);const r=this.I[n],o=`${v}${h(t,r)}`;let u=`${K}${h(t+1,this.M)}`;s?u=this.k[t]:this.k[t]=u;let l=null;if(t>0&&(l=this.H),this.H=u,this.N[e].find((t=>t&&t.SK===o))||this.N[e].push({SK:o,id:i}),s){const t=this.N[`${$}${this.M-1}`],i=t.length;i===this.N[e].length+1&&this.N[e].push(t[i-1])}return this.q=t,this.I[t]+=1,{siblingsIndex:r,CHK:l,SK:o,PK:u,BK:e}}U(t,i,s,n){return this.L(s.SK,i),{order:{self:this.j(t,s.SK),parent:n},keys:s}}register(t,i,s,n,e){const{CHK:h,SK:r,PK:o,BK:u,siblingsIndex:l}=n?this.G(i,t,n,e):this.W(i,t,s);return this.U(t,i,{CHK:h,SK:r,PK:o,BK:u},l)}mutateSiblings(t,i){t in this.C&&Object.assign(this.C,{[t]:i})}getSiblingKeysByDepth(t){return this.R[t]||[]}getElmSiblingsByKey(t){return this.C[t]||[]}getHighestSKInAllBranches(){const t=new Set;return Object.keys(this.N).forEach((i=>{const s=this.N[i][this.N[i].length-1];s&&t.add(s)})),t}V(t){return Array.isArray(this.C[t])}removeIDFromBranch(t,i){this.N[i].find((i=>i&&i.id===t))&&(this.N[i]=this.N[i].map((i=>i&&i.id!==t?i:null)))}Y(t,i){this.N[i]=this.N[i].map((i=>i&&i.SK!==t?i:null))}J(t,i){this.R[i]=this.R[i].filter((i=>i!==t))}destroySiblings(t,i,s,n){if(this.V(t)){if("function"==typeof n)for(;this.C[t].length;)n(this.C[t].pop());delete this.C[t],this.J(t,s),this.Y(t,i)}}endRegistration(){this.F=null}clear(){this.P()}}const B=Object.freeze({DRAGGED:"dragged",INDEX:"data-index",OUT_POS:"data-dragged-out-position",OUT_CONTAINER:"data-dragged-out-container"});function P(t,i,s){_(t,"transform",`translate3d(${i}px, ${s}px, 0)`)}class I{static getType(){return"base:element"}static transform=P;constructor(t){this.id=t,this.translate=new d(0,0),this.Z=new Set}setAttribute(t,i,s){"INDEX"!==i?this.Z.has(i)||(t.setAttribute(B[i],`${s}`),this.Z.add(i)):t.setAttribute(B[i],`${s}`)}removeAttribute(t,i){"INDEX"!==i&&this.Z.has(i)&&(t.removeAttribute(B[i]),this.Z.delete(i))}clearAttributes(t){this.Z.forEach((i=>{this.removeAttribute(t,i)})),this.Z.clear()}}const M="transition-property",C="transition-delay",R="transition-duration",N="transition-timing-function";const k="transitionend";class q extends I{static getType(){return"core:element"}constructor(t){const{order:i,keys:s,depth:n,readonly:e,animation:h,id:r,CSSTransform:o}=t;super(r),this.VDOMOrder={...i},this.DOMOrder={...i},this.keys={...s},this.depth=n,this.readonly=e,this.tt=h,this.it=o,[this.st]=function(){let t=null;function i(){t&&(cancelAnimationFrame(t),t=null)}return[function(s,n){n&&i();try{t=requestAnimationFrame(s)}catch(t){}},i]}(),this.nt=!0,this.et=!1,this.ht=void 0,this.rt=null,this.ot=new d(0,0),this.rect=new a(0,0,0,0),this.DOMGrid=new d(0,0)}updateConfig(t,i,s){this.readonly=t,this.tt=i,this.it=s}initElmRect(t,i,s){const{height:n,width:e,left:h,top:r}=t.getBoundingClientRect(),o=h+i,u=r+s;this.ot.setAxes(o,u),this.rect.setByPointAndDimensions(u,o,n,e),this.ut(t)}ut(t){const i=function(t){const i=function(t){if(!/matrix\([^)]+\)/.test(t))return null;const i=t.match(/matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^)]+)\)/);return i?[parseFloat(i[5]),parseFloat(i[6])]:null}(w(t,"transform",!1));return i}(t);if(i){const[t,s]=i,n=this.ot.x-t,e=this.ot.y-s;this.ot.setAxes(n,e),this.rect.setByPointAndDimensions(e,n,this.rect.height,this.rect.width),this.translate.setAxes(t,s)}}getDimensions(t){if(this.rt)return this.rt;const{width:i,height:s}=function(t){return{width:w(t,l,!0),height:w(t,u,!0)}}(t);return this.rt=new d(i,s),this.rt}getInitialPosition(){return this.ot}changeVisibility(t,i){i!==this.nt&&(this.nt=i,this.et&&this.nt&&(this.lt(t,null),this.et=!1))}lt(t,i,s=o){if(!this.nt)return void(this.et=!0);const n=()=>{this.it&&function(t,i){"string"!=typeof i?function(t,i){Object.keys(i).forEach((i=>{S(t,i)}))}(t,i):function(t,i){t.classList.remove(i)}(t,i)}(t,this.it),this.tt&&function(t){S(t,M),S(t,C),S(t,R),S(t,N)}(t),i&&t.removeEventListener(k,n),s()};this.st((()=>{if(this.it&&function(t,i){"string"!=typeof i?function(t,i){Object.entries(i).forEach((([i,s])=>{_(t,i,s)}))}(t,i):function(t,i){t.classList.add(i)}(t,i)}(t,this.it),null===i)return q.transform(t,this.translate.x,this.translate.y),void n();t.addEventListener(k,n),function(t,i,s,n){_(t,M,"transform"),_(t,C,"0ms"),_(t,R,`${s}ms`),_(t,N,n)}(t,0,i,this.tt.easing),q.transform(t,this.translate.x,this.translate.y)}),!0)}updateIndex(t,i){this.setAttribute(t,"INDEX",i),this.VDOMOrder.self=i}assignNewIndex(t,i){t[i]=this.id}ct(t,i,s){const n={axes:t,numberOfPassedElm:s,translate:this.translate.getInstance()};void 0===this.ht&&(this.ht=new Map),this.ht.has(i)||this.ht.set(i,[]),this.ht.get(i).push(n)}dt(t,i,s){if(i)return!this.nt&&this.et?void(this.et=!1):void this.lt(t,s);this.nt?this.lt(t,s):this.et=!0}ft(t,i,s,n){let e=null;if(this.tt){const{duration:t}=this.tt,s=this.translate.getInstance(),n=this.translate.increase(i).getInstance();e="number"==typeof t?t:function(t,i){const s=t.x-i.x,n=t.y-i.y,e=Math.sqrt(s*s+n*n);return 20*Math.sqrt(e)}(s,n)}else this.translate.increase(i);this.rect.setAxes(this.ot.x+this.translate.x,this.ot.y+this.translate.y),this.dt(t,s,e);const{self:h}=this.VDOMOrder,r=h+n;return this.updateIndex(t,r),[h,r]}gt(t,i,s){if(-1!==t)for(let t=0;t<i;t+=1)this.DOMGrid.x+=1,this.DOMGrid.x>s.x&&(this.DOMGrid.x=0,this.DOMGrid.y+=1);else for(let t=0;t<i;t+=1)this.DOMGrid.x-=1,this.DOMGrid.x<0&&(this.DOMGrid.x=s.x,this.DOMGrid.y-=1)}reconcilePosition(t,i,s,n,e,h,r,o){let u;const l={x:1===i?-1:1,y:i};"z"===t?u=x:(u=[t],l[t]=i),u.forEach((t=>{e[t]*=l[t],this.gt(l[t],h,r)})),this.ct(t,o,h);const c=i*h,[a,d]=this.ft(s,e,!1,c);n[a]="",n[d]=this.id}restorePosition(t){this.lt(t,null),this.setAttribute(t,"INDEX",this.VDOMOrder.self)}assignNewPosition(t,i){this.translate.clone(i),this.lt(t,null)}rollBackPosition(t,i){if(void 0===this.ht||!this.ht.has(i))return;const s=this.ht.get(i),{translate:n,axes:e,numberOfPassedElm:h}=s.pop(),r={x:n.x-this.translate.x,y:n.y-this.translate.y};let o=0;const u={x:r.x>0?1:-1,y:r.y>0?1:-1};if("z"===e?(o=r.x>0||r.y>0?1:-1,this.DOMGrid.increase({x:u.x*h,y:u.y*h})):(o=u[e]*h,this.DOMGrid[e]+=o),this.ft(t,r,!0,o),0===s.length)return this.ht.delete(i),void(0===this.ht.size&&(this.ht=void 0));this.rollBackPosition(t,i)}hasTransformedFromOrigin(){return this.ot.isNotEqual(this.rect.left,this.rect.top)}needDOMReconciliation(){return this.VDOMOrder.self!==this.DOMOrder.self}refreshIndicators(t,i,s){this.ht=void 0,this.translate.setAxes(0,0),this.et=!1,this.DOMOrder.self=this.VDOMOrder.self,S(t,"transform"),function(t,i){if(!t.hasAttribute(i))return;const s=t.getAttribute(i);s&&""===s.trim()&&t.removeAttribute(i)}(t,"style"),this.initElmRect(t,i,s),this.DOMGrid.setAxes(0,0)}getSerializedInstance(){return{type:q.getType(),version:3,id:this.id,grid:this.DOMGrid,translate:this.translate instanceof d?this.translate:null,order:this.VDOMOrder,initialPosition:this.ot.getInstance(),rect:this.rect,hasTransformedFromOrigin:this.hasTransformedFromOrigin(),hasPendingTransformation:this.et,isVisible:this.nt}}}class F extends q{static getDistance(t,i,s){let n=t[s]-i.rect["x"===s?"left":"top"];return n+=i.translate[s],n}static getDisplacement(t,i,s){return t[s]-("x"===s?i.rect.right:i.rect.bottom)}getDisplacement(t,i){return F.getDisplacement(this.rect.getPosition(),t,i)}getDistance(t,i){return F.getDistance(this.rect.getPosition(),t,i)}}const H="registerQ",L="submitQ";class j{constructor(){this.globals={removeContainerWhenEmpty:!1},this.yt=null,this.tracker=new f,this.xt=new y,this.registry=new Map,this.interactiveDOM=new Map,this.DOMGen=new A}config(t){Object.assign(this.globals,t)}bt(t,i,s){const{id:n,depth:e,readonly:h,animation:r,CSSTransform:o}=i;let a,d,f=!1;e>0&&(f=function(t,i,s,n){let e=!1;const h=i.getSiblingKeysByDepth(n),r=h.length;if(r>0){const n=i.getElmSiblingsByKey(h[r-1]),o=n.length;if(o>0){const i=n[o-1],{previousElementSibling:h}=t;h&&(e=h.isSameNode(s.get(i)))}}return e}(t,this.DOMGen,this.interactiveDOM,e),function(t){const i=function(t){return w(t,c,!1)}(t);E.test(i)&&_(t,c,"relative")}(t),this.globals.removeContainerWhenEmpty||function(t){const i=D(t,u),s=D(t,l);_(t,u,`${i}px`),_(t,l,`${s}px`)}(t)),s&&({keys:a,VDOMOrder:{self:d}}=s);const{order:g,keys:m}=this.DOMGen.register(n,e,f,a,d),p=new F({id:n,order:g,keys:m,depth:e,readonly:h,animation:r,CSSTransform:o});return this.registry.set(n,p),this.interactiveDOM.set(n,t),p.setAttribute(t,"INDEX",p.VDOMOrder.self),e>0&&(t.dataset.dflexKey=m.SK),m}_t(t,i,s,n,e,h){let r=null;return t.childNodes.forEach(((t,o)=>{if(t instanceof HTMLElement){let{id:o}=t;if(o||(o=this.tracker.newTravel(g),t.id=o),!this.registry.has(o)){const u={depth:i,readonly:e!==o,animation:s,id:o,CSSTransform:n};({SK:r}=this.bt(t,u,h))}}})),r}endRegistration(){this.yt=null,this.DOMGen.endRegistration()}addElmToRegistry(t,i,s){this.xt.cancelQueuedTask();const{id:n,depth:e,readonly:h,animation:o,CSSTransform:u}=t;let l,c,a=this.registry.has(n);if(a){l=this.interactiveDOM.get(n);const t=this.registry.get(n);t.updateConfig(h,o,u),({SK:c}=t.keys)}else l=function(t){let i=document.getElementById(t);return i&&i.nodeType===Node.ELEMENT_NODE||(i=null),i}(n);!function(t,i){let s=0,n=t;try{do{if(s+=1,s>1&&i(n))return s=0,n;n=n.parentElement}while(null!==n&&!n.isSameNode(document.body))}catch(t){}finally{s=0}}(l,(t=>{let l=!1,{id:d}=t;if(d?l=this.registry.has(d):(d=this.tracker.newTravel(g),t.id=d),this.xt.hasElm(n)&&([c]=this.xt.executeQueue(H),this.registry.get(n).updateConfig(h,o,u),a=!0),null===this.yt||!this.yt.isSameNode(t)){const h=i=>{c=this._t(t,e,o,u,n,i),a=!0},f=()=>{i&&s&&this.xt.enqueueBeforeLast(s,(()=>i(c,e+1,t)),L)};if(this.yt=t,l)a||(h(this.registry.get(d)),f());else{this.xt.executeQueue(H);const i=e+1;a||h(null),this.xt.enqueue((()=>{const{SK:s}=this.bt(t,{id:d,depth:i,readonly:!0,animation:r(),CSSTransform:null},null);return s}),H,d),f()}}return this.xt.scheduleNextTask([H,L]),!0}))}getElmWithDOM(t){return[this.registry.get(t),this.interactiveDOM.get(t)]}has(t){return this.interactiveDOM.has(t)&&this.registry.has(t)}getElmSiblingsByKey(t){return this.DOMGen.getElmSiblingsByKey(t)}getSiblingKeysByDepth(t){return this.DOMGen.getSiblingKeysByDepth(t)}mutateSiblings(t,i){this.DOMGen.mutateSiblings(t,i)}unregister(t){this.registry.delete(t),this.interactiveDOM.delete(t)}destroy(){this.DOMGen.clear(),this.interactiveDOM.clear(),this.registry.clear(),this.xt.clear(),this.yt=null}}var z=new class extends j{constructor(){super(),this.St=this.St.bind(this),this.wt=this.wt.bind(this)}wt(t){const[i,s]=this.getElmWithDOM(t);i.initElmRect(s,0,0)}St(t){this.getElmSiblingsByKey(t).forEach(this.wt)}register(t){this.addElmToRegistry({id:t,depth:0,readonly:!1,animation:r(),CSSTransform:null},this.St)}};function Q(t,i){i?(_(t,"position","relative"),_(t,"z-index","99")):(S(t,"position"),S(t,"z-index"))}function X(t,i){if(!t.hasAttribute(i))return;const s=t.getAttribute(i);s&&""===s.trim()&&t.removeAttribute(i)}class G{constructor(t,i,s){this.draggedElm=t,this.draggedDOM=i;const{translate:n}=this.draggedElm;this.Tt=new d(n.x-s.x,n.y-s.y),this.translatePlaceholder=new d(0,0),this.Ot=null}Dt(t,i){if(i)return this.Ot=t.ariaDisabled,void(t.ariaDisabled="true");t.ariaDisabled=this.Ot}setDOMAttrAndStyle(t,i,s,n,e,h){if(s){this.Dt(t,!0),this.draggedElm.setAttribute(t,"DRAGGED","true"),null!==i?(i.ariaLabel="Draggable",i.id=`dflex-draggable-mirror_${t.id}`,delete i.dataset.index,function(t,i,s){const[n=0,e=0]=i||[];_(t,"position","fixed"),_(t,"top",`${n}px`),_(t,"left",`${e}px`),s&&(s.y>0&&_(t,"height",`${s.y}px`),s.x>0&&_(t,"width",`${s.x}px`)),_(t,"z-index","99"),_(t,"margin","0")}(i,h,e),_(t,"opacity","0")):(t.ariaLabel="Draggable",Q(t,!0)),_(document.body,"user-select","none");const s=window.getSelection();s&&s.removeAllRanges()}else S(document.body,"user-select"),this.Dt(t,!1),t.ariaLabel=null,this.draggedElm.clearAttributes(t),null!==i?(n&&(_(t,"position","absolute"),e.x>0&&_(t,"width",`${e.x}px`),e.y>0&&_(t,"height",`${e.y}px`)),S(t,"opacity"),i.remove()):Q(t,!1),X(t,"style"),X(document.body,"style")}translate(t,i){this.translatePlaceholder.setAxes(t+this.Tt.x,i+this.Tt.y),I.transform(this.draggedDOM,this.translatePlaceholder.x,this.translatePlaceholder.y)}}exports.DFlexBaseDraggable=G,exports.Draggable=class extends G{constructor(t,i){const[s,n]=z.getElmWithDOM(t);super(s,n,i),this.setDOMAttrAndStyle(this.draggedDOM,null,!0,!1,null,null)}dragAt(t,i){this.translate(t,i),this.draggedElm.translate.clone(this.translatePlaceholder)}endDragging(){this.setDOMAttrAndStyle(this.draggedDOM,null,!1,!1,null,null)}},exports.store=z; | ||
class t{constructor(t,i){this.x=t,this.y=i}}class i extends t{setAxes(t,i){this.x=t,this.y=i}clone(t){this.setAxes(t.x,t.y)}getInstance(){return{x:this.x,y:this.y}}isInstanceEqual(t){return this.x===t.x&&this.y===t.y}isEqual(t,i){return this.x===t&&this.y===i}isNotEqual(t,i){return this.x!==t||this.y!==i}}class s{constructor(t,i,s,n){this.top=t,this.right=i,this.bottom=s,this.left=n}}class n extends s{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,i,s,n){return this.top=t,this.right=i,this.bottom=s,this.left=n,this}getBox(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}setByAxis(t,i,s){"x"===t?(this.left=i,this.right=s):(this.top=i,this.bottom=s)}setOne(t,i,s){"x"===t?-1===i?this.left=s:this.right=s:-1===i?this.top=s:this.bottom=s}getOne(t,i){return"x"===t?-1===i?this.left:this.right:-1===i?this.top:this.bottom}setPositionInstance(t){this.top=t.y,this.left=t.x}setPosition(t,i){this.top=i,this.left=t}hasEqualPosition(t,i){return this.top===i||this.left===t}getPosition(){return{x:this.left,y:this.top}}}class e extends n{t(t){return this.top>=t.bottom}i(t){return this.bottom<=t.top}h(t){return this.right<=t.left}o(t){return this.left>=t.right}u(t){return this.top<t.top}l(t){return this.right>t.right}g(t){return this.bottom>t.bottom}m(t){return this.left<t.left}p(t){return this.top>=t.top}S(t){return this.right<=t.right}_(t){return this.bottom<=t.bottom}T(t){return this.left>=t.left}isBoxIntersect(t){return!(this.i(t)||this.o(t)||this.t(t)||this.h(t))}isOutThreshold(t,i,s){if(i.setBox(!1,!1,!1,!1),s){if("y"===s){const s=this.u(t),n=this.g(t);return s&&(i.top=!0),n&&(i.bottom=!0),s||n}const n=this.m(t),e=this.l(t);return n&&(i.left=!0),e&&(i.right=!0),n||e}return this.u(t)?(i.top=!0,!0):this.l(t)?(i.right=!0,!0):this.g(t)?(i.bottom=!0,!0):!!this.m(t)&&(i.left=!0,!0)}isInsideThreshold(t){return this.p(t)&&this.S(t)&&this._(t)&&this.T(t)}getSurroundingBox(t){return{left:Math.min(t.left,this.left),top:Math.min(t.top,this.top),right:Math.max(t.right,this.right),bottom:Math.max(t.bottom,this.bottom)}}isPositionedY(t){return this.t(t)||this.i(t)}assignBiggestBox(t){const{top:i,left:s,right:n,bottom:e}=t;s<this.left&&(this.left=s),i<this.top&&(this.top=i),n>this.right&&(this.right=n),e>this.bottom&&(this.bottom=e)}}function h(t,i){return`${t}_${i}`}function r(t){const i={easing:"ease-in",duration:"dynamic"};return void 0===t?i:null===t?null:{...i,...t}}function o(){}const u="height",l="width",c="position";class a extends e{constructor(t,i,s,n){super(t,i,s,n),this.width=i-n,this.height=s-t}setByPointAndDimensions(t,i,s,n){this.top=t,this.left=i,this.width=n,this.height=s,this.right=i+n,this.bottom=t+s}setAxes(t,i){this.left=t,this.right=this.width+t,this.top=i,this.bottom=this.height+i}getDimensionDiff(t,i){const s=function(t){return"x"===t?l:u}(t);return this[s]-i[s]}getPositionDiff(t,i){const s=function(t){return"x"===t?"left":"top"}(t);return this[s]-i[t]}}class d extends i{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,i){const{top:s,left:n,bottom:h,right:r}=t;return i?new e(s+this.y,r-this.x,h-this.y,n+this.x):new e(s-this.y,r+this.x,h+this.y,n-this.x)}onSameAxis(t,i){return"y"===t?i.x===this.x:i.y===this.y}}var f=new class{constructor(){this.O={}}newTravel(t){return void 0===this.O[t]?this.O[t]=0:this.O[t]+=1,`${t}${this.O[t]}`}};const[g,m]=function(t){let i=null,s=!1;function n(){i&&(clearTimeout(i),i=null)}return[function(t,e){const h=t||o;s=!0,e&&n(),i=setTimeout((()=>{s=!1,h()}),0)},n,function(){return s}]}();class p{constructor(){this.D={},this.K=new Set}v(t){Array.isArray(this.D[t])||(this.D[t]=[])}$(t,i,s){this.D[i].push(t),s&&this.K.add(s)}A(t){return!Array.isArray(this.D[t])||0===this.D[t].length}hasElm(t){return this.K.has(t)}enqueueBeforeLast(t,i,s,n){this.v(s);const{length:e}=this.D[s];0===e?this.D[s].push(i):this.D[s][e-1]=i,this.$(t,s,n)}enqueue(t,i,s){this.v(i),this.$(t,i,s)}executeQueue(t){const i=[];if(this.A(t))return i;try{this.D[t].forEach((t=>{const s=t();i.push(s)}))}catch(t){}finally{m(),delete this.D[t]}return i}B(t){g((()=>{const[i,s]=t;this.executeQueue(i),s&&queueMicrotask((()=>this.executeQueue(s))),this.K.clear()}),!0)}scheduleNextTask(t){this.B(t)}cancelQueuedTask(){m()}clear(){m(),this.D={},this.K.clear()}}const y=Object.freeze(["x","y"]);let x=new WeakMap;function b(t,i,s){t.style.setProperty(i,s)}function S(t,i){t.style.removeProperty(i)}function _(t,i,s){const n=function(t){if(x.has(t))return x.get(t);const i={computedStyle:getComputedStyle(t),parsedProperties:new Map};return x.set(t,i),i}(t),{parsedProperties:e,computedStyle:h}=n,r=e.get(i);if(void 0===r){const t=h.getPropertyValue(i),n=s?function(t){const i=parseFloat(t);return Number.isNaN(i)?0:i}(t):t;return e.set(i,n),n}return r}const w={height:["border-top-width","border-bottom-width","padding-top","padding-bottom"],width:["border-left-width","border-right-width","padding-left","padding-right"]},T={height:"offsetHeight",width:"offsetWidth"};function O(t,i){let s=0;return w[i].forEach((i=>{s+=_(t,i,!0)})),t[T[i]]-s}const D=/absolute|fixed/,E="relative";const K="dflex_ky_",v="dflex_sk_",$="dflex_bk_";class A{constructor(){this.P()}P(){this.I={},this.M=0,this.C={},this.R={},this.N={},this.k={},this.q=-99,this.F=null,this.H=`${K}${h(0,0)}`}L(t,i){Array.isArray(this.R[i])?this.R[i].find((i=>i===t))||this.R[i].push(t):this.R[i]=[t]}j(t,i){return Array.isArray(this.C[i])||(this.C[i]=[]),this.C[i].push(t)-1}X(t){for(let i=t;i<=t+2;i+=1)void 0===this.I[i]&&(this.I[i]=0)}G(t,i,s,n){const{BK:e,PK:r}=s,o=e!==this.F;this.F=e,o&&(this.I[t]=0);const u=`${v}${h(t,n)}`;let l=null;return t>0&&(l=this.H),o&&(this.N[e][t]={SK:u,id:i}),this.I[t]+=1,{siblingsIndex:n,CHK:l,SK:u,PK:r,BK:e}}W(t,i,s){const n=t+1;if(void 0===this.I[n]&&this.X(t),t<this.q){this.M+=1;const i=s?t:t-1;for(let t=0;t<=i;t+=1)this.I[t]=0}const e=`${$}${this.M}`;Array.isArray(this.N[e])||(this.N[e]=[]),s&&this.I[n]>0&&(this.I[n]-=1);const r=this.I[n],o=`${v}${h(t,r)}`;let u=`${K}${h(t+1,this.M)}`;s?u=this.k[t]:this.k[t]=u;let l=null;if(t>0&&(l=this.H),this.H=u,this.N[e].find((t=>t&&t.SK===o))||this.N[e].push({SK:o,id:i}),s){const t=this.N[`${$}${this.M-1}`],i=t.length;i===this.N[e].length+1&&this.N[e].push(t[i-1])}return this.q=t,this.I[t]+=1,{siblingsIndex:r,CHK:l,SK:o,PK:u,BK:e}}U(t,i,s,n){return this.L(s.SK,i),{order:{self:this.j(t,s.SK),parent:n},keys:s}}register(t,i,s,n,e){const{CHK:h,SK:r,PK:o,BK:u,siblingsIndex:l}=n?this.G(i,t,n,e):this.W(i,t,s);return this.U(t,i,{CHK:h,SK:r,PK:o,BK:u},l)}mutateSiblings(t,i){t in this.C&&Object.assign(this.C,{[t]:i})}getSiblingKeysByDepth(t){return this.R[t]||[]}getElmSiblingsByKey(t){return this.C[t]||[]}getHighestSKInAllBranches(){const t=new Set;return Object.keys(this.N).forEach((i=>{const s=this.N[i][this.N[i].length-1];s&&t.add(s)})),t}V(t){return Array.isArray(this.C[t])}removeIDFromBranch(t,i){this.N[i].find((i=>i&&i.id===t))&&(this.N[i]=this.N[i].map((i=>i&&i.id!==t?i:null)))}Y(t,i){this.N[i]=this.N[i].map((i=>i&&i.SK!==t?i:null))}J(t,i){this.R[i]=this.R[i].filter((i=>i!==t))}destroySiblings(t,i,s,n){if(this.V(t)){if("function"==typeof n)for(;this.C[t].length;)n(this.C[t].pop());delete this.C[t],this.J(t,s),this.Y(t,i)}}endRegistration(){this.F=null}clear(){this.P()}}const B=Object.freeze({DRAGGED:"dragged",INDEX:"data-index",OUT_POS:"data-dragged-out-position",OUT_CONTAINER:"data-dragged-out-container"});function P(t,i,s){b(t,"transform",`translate3d(${i}px, ${s}px, 0)`)}class I{static getType(){return"base:element"}static transform=P;constructor(t){this.id=t,this.translate=new d(0,0),this.Z=new Set}setAttribute(t,i,s){"INDEX"!==i?this.Z.has(i)||(t.setAttribute(B[i],`${s}`),this.Z.add(i)):t.setAttribute(B[i],`${s}`)}removeAttribute(t,i){"INDEX"!==i&&this.Z.has(i)&&(t.removeAttribute(B[i]),this.Z.delete(i))}clearAttributes(t){this.Z.forEach((i=>{this.removeAttribute(t,i)})),this.Z.clear()}}const M="transition-property",C="transition-delay",R="transition-duration",N="transition-timing-function";const k="transitionend";class q extends I{static getType(){return"core:element"}constructor(t){const{order:i,keys:s,depth:n,readonly:e,animation:h,id:r,CSSTransform:o}=t;super(r),this.VDOMOrder={...i},this.DOMOrder={...i},this.keys={...s},this.depth=n,this.readonly=e,this.tt=h,this.it=o,[this.st]=function(){let t=null;function i(){t&&(cancelAnimationFrame(t),t=null)}return[function(s,n){n&&i();try{t=requestAnimationFrame(s)}catch(t){}},i]}(),this.nt=!0,this.et=!1,this.ht=void 0,this.rt=null,this.ot=new d(0,0),this.rect=new a(0,0,0,0),this.DOMGrid=new d(0,0)}updateConfig(t,i,s){this.readonly=t,this.tt=i,this.it=s}initElmRect(t,i,s){this.rect=function(t,i,s){const{left:n,top:e,right:h,bottom:r,height:o,width:u}=t.getBoundingClientRect(),l=new a(e,h,r,n);return 0===i&&0===s||l.setByPointAndDimensions(e+s,n+i,o,u),l}(t,i,s);const{left:n,top:e}=this.rect;this.ot.setAxes(n,e),this.ut(t)}ut(t){const i=function(t){const i=function(t){if(!/matrix\([^)]+\)/.test(t))return null;const i=t.match(/matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^)]+)\)/);return i?[parseFloat(i[5]),parseFloat(i[6])]:null}(_(t,"transform",!1));return i}(t);if(i){const[t,s]=i,n=this.ot.x-t,e=this.ot.y-s;this.ot.setAxes(n,e),this.rect.setByPointAndDimensions(e,n,this.rect.height,this.rect.width),this.translate.setAxes(t,s)}}getDimensions(t){if(this.rt)return this.rt;const{width:i,height:s}=function(t){return{width:_(t,l,!0),height:_(t,u,!0)}}(t);return this.rt=new d(i,s),this.rt}getInitialPosition(){return this.ot}changeVisibility(t,i){i!==this.nt&&(this.nt=i,this.et&&this.nt&&(this.lt(t,null),this.et=!1))}lt(t,i,s=o){if(!this.nt)return void(this.et=!0);const n=()=>{this.it&&function(t,i){"string"!=typeof i?function(t,i){Object.keys(i).forEach((i=>{S(t,i)}))}(t,i):function(t,i){t.classList.remove(i)}(t,i)}(t,this.it),this.tt&&function(t){S(t,M),S(t,C),S(t,R),S(t,N)}(t),i&&t.removeEventListener(k,n),s()};this.st((()=>{if(this.it&&function(t,i){"string"!=typeof i?function(t,i){Object.entries(i).forEach((([i,s])=>{b(t,i,s)}))}(t,i):function(t,i){t.classList.add(i)}(t,i)}(t,this.it),null===i)return q.transform(t,this.translate.x,this.translate.y),void n();t.addEventListener(k,n),function(t,i,s,n){b(t,M,"transform"),b(t,C,"0ms"),b(t,R,`${s}ms`),b(t,N,n)}(t,0,i,this.tt.easing),q.transform(t,this.translate.x,this.translate.y)}),!0)}updateIndex(t,i){this.setAttribute(t,"INDEX",i),this.VDOMOrder.self=i}assignNewIndex(t,i){t[i]=this.id}ct(t,i,s){const n={axes:t,numberOfPassedElm:s,translate:this.translate.getInstance()};void 0===this.ht&&(this.ht=new Map),this.ht.has(i)||this.ht.set(i,[]),this.ht.get(i).push(n)}dt(t,i,s){if(i)return!this.nt&&this.et?void(this.et=!1):void this.lt(t,s);this.nt?this.lt(t,s):this.et=!0}ft(t,i,s,n){let e=null;if(this.tt){const{duration:t}=this.tt,s=this.translate.getInstance(),n=this.translate.increase(i).getInstance();e="number"==typeof t?t:function(t,i){const s=t.x-i.x,n=t.y-i.y,e=Math.sqrt(s*s+n*n);return 20*Math.sqrt(e)}(s,n)}else this.translate.increase(i);this.rect.setAxes(this.ot.x+this.translate.x,this.ot.y+this.translate.y),this.dt(t,s,e);const{self:h}=this.VDOMOrder,r=h+n;return this.updateIndex(t,r),[h,r]}gt(t,i,s){if(-1!==t)for(let t=0;t<i;t+=1)this.DOMGrid.x+=1,this.DOMGrid.x>s.x&&(this.DOMGrid.x=0,this.DOMGrid.y+=1);else for(let t=0;t<i;t+=1)this.DOMGrid.x-=1,this.DOMGrid.x<0&&(this.DOMGrid.x=s.x,this.DOMGrid.y-=1)}reconcilePosition(t,i,s,n,e,h,r,o){let u;const l={x:1===i?-1:1,y:i};"z"===t?u=y:(u=[t],l[t]=i),u.forEach((t=>{e[t]*=l[t],this.gt(l[t],h,r)})),this.ct(t,o,h);const c=i*h,[a,d]=this.ft(s,e,!1,c);n[a]="",n[d]=this.id}restorePosition(t){this.lt(t,null),this.setAttribute(t,"INDEX",this.VDOMOrder.self)}assignNewPosition(t,i){this.translate.clone(i),this.lt(t,null)}rollBackPosition(t,i){if(void 0===this.ht||!this.ht.has(i))return;const s=this.ht.get(i),{translate:n,axes:e,numberOfPassedElm:h}=s.pop(),r={x:n.x-this.translate.x,y:n.y-this.translate.y};let o=0;const u={x:r.x>0?1:-1,y:r.y>0?1:-1};if("z"===e?(o=r.x>0||r.y>0?1:-1,this.DOMGrid.increase({x:u.x*h,y:u.y*h})):(o=u[e]*h,this.DOMGrid[e]+=o),this.ft(t,r,!0,o),0===s.length)return this.ht.delete(i),void(0===this.ht.size&&(this.ht=void 0));this.rollBackPosition(t,i)}hasTransformedFromOrigin(){return this.ot.isNotEqual(this.rect.left,this.rect.top)}needDOMReconciliation(){return this.VDOMOrder.self!==this.DOMOrder.self}refreshIndicators(t,i,s){this.ht=void 0,this.translate.setAxes(0,0),this.et=!1,this.DOMOrder.self=this.VDOMOrder.self,S(t,"transform"),function(t,i){if(!t.hasAttribute(i))return;const s=t.getAttribute(i);s&&""===s.trim()&&t.removeAttribute(i)}(t,"style"),this.initElmRect(t,i,s),this.DOMGrid.setAxes(0,0)}getSerializedInstance(){return{type:q.getType(),version:3,id:this.id,grid:this.DOMGrid,translate:this.translate instanceof d?this.translate:null,order:this.VDOMOrder,initialPosition:this.ot.getInstance(),rect:this.rect,hasTransformedFromOrigin:this.hasTransformedFromOrigin(),hasPendingTransformation:this.et,isVisible:this.nt}}}class F extends q{static getDistance(t,i,s){let n=t[s]-i.rect["x"===s?"left":"top"];return n+=i.translate[s],n}static getDisplacement(t,i,s){return t[s]-("x"===s?i.rect.right:i.rect.bottom)}getDisplacement(t,i){return F.getDisplacement(this.rect.getPosition(),t,i)}getDistance(t,i){return F.getDistance(this.rect.getPosition(),t,i)}}function H(t,i,s,n){const{id:e,depth:h,readonly:r,animation:o,CSSTransform:a}=i;let d,f,g=!1;h>0&&(g=function(t,i,s){let n=!1;const e=s.DOMGen.getSiblingKeysByDepth(i),h=e.length;if(h>0){const i=s.DOMGen.getElmSiblingsByKey(e[h-1]),r=i.length;if(r>0){const e=i[r-1],{previousElementSibling:h}=t;h&&(n=h.isSameNode(s.interactiveDOM.get(e)))}}return n}(t,h,n),function(t){const i=function(t){return _(t,c,!1)}(t);D.test(i)&&b(t,c,E)}(t),n.globals.removeContainerWhenEmpty||function(t){const i=O(t,u),s=O(t,l);b(t,u,`${i}px`),b(t,l,`${s}px`)}(t)),s&&({keys:d,VDOMOrder:{self:f}}=s);const{order:m,keys:p}=n.DOMGen.register(e,h,g,d,f),y=new F({id:e,order:m,keys:p,depth:h,readonly:r,animation:o,CSSTransform:a});return n.registry.set(e,y),n.interactiveDOM.set(e,t),y.setAttribute(t,"INDEX",y.VDOMOrder.self),h>0&&(t.dataset.dflexKey=p.SK),p}function L(t){let{id:i}=t;return i||(i=f.newTravel("dflex_id_"),t.id=i),i}const j="registerQ",z="submitQ";class Q{constructor(){this.globals={removeContainerWhenEmpty:!1},this.yt=null,this.xt=new p,this.registry=new Map,this.interactiveDOM=new Map,this.DOMGen=new A}config(t){Object.assign(this.globals,t)}endRegistration(){this.yt=null,this.DOMGen.endRegistration()}addElmToRegistry(t,i,s){this.xt.cancelQueuedTask();const{id:n,depth:e,readonly:h,animation:o,CSSTransform:u}=t;let l,c,a=this.registry.has(n);if(a){let t;[t,l]=this.getElmWithDOM(n),t.updateConfig(h,o,u),({SK:c}=t.keys)}else l=function(t){let i=document.getElementById(t);return i&&i.nodeType===Node.ELEMENT_NODE||(i=null),i}(n);!function(t,i){let s=0,n=t;try{do{if(s+=1,s>1&&i(n))return s=0,n;n=n.parentElement}while(null!==n&&!n.isSameNode(document.body))}catch(t){}finally{s=0}}(l,(t=>{const l=L(t),d=this.registry.has(l);if(this.xt.hasElm(n)&&([c]=this.xt.executeQueue(j),this.registry.get(n).updateConfig(h,o,u),a=!0),null===this.yt||!this.yt.isSameNode(t)){const h=i=>{c=function(t,i,s,n,e,h,r){let o=null;return t.childNodes.forEach(((t,u)=>{if(t instanceof HTMLElement){const u=L(t);if(!s.registry.has(u)){const l={depth:i,readonly:h!==u,animation:n,id:u,CSSTransform:e};({SK:o}=H(t,l,r,s))}}})),o}(t,e,this,o,u,n,i),a=!0},f=()=>{i&&s&&this.xt.enqueueBeforeLast(s,(()=>i(c,e+1,t)),z)};if(this.yt=t,d)a||(h(this.registry.get(l)),f());else{this.xt.executeQueue(j);const i=e+1;a||h(null),this.xt.enqueue((()=>{const{SK:s}=H(t,{id:l,depth:i,readonly:!0,animation:r(),CSSTransform:null},null,this);return s}),j,l),f()}}return this.xt.scheduleNextTask([j,z]),!0}))}getElmWithDOM(t){return[this.registry.get(t),this.interactiveDOM.get(t)]}has(t){return this.interactiveDOM.has(t)&&this.registry.has(t)}getElmSiblingsByKey(t){return this.DOMGen.getElmSiblingsByKey(t)}getSiblingKeysByDepth(t){return this.DOMGen.getSiblingKeysByDepth(t)}mutateSiblings(t,i){this.DOMGen.mutateSiblings(t,i)}unregister(t){this.registry.delete(t),this.interactiveDOM.delete(t)}destroy(){this.DOMGen.clear(),this.interactiveDOM.clear(),this.registry.clear(),this.xt.clear(),this.yt=null}}var X=new class extends Q{constructor(){super(),this.bt=this.bt.bind(this),this.St=this.St.bind(this)}St(t){const[i,s]=this.getElmWithDOM(t);i.initElmRect(s,0,0)}bt(t){this.getElmSiblingsByKey(t).forEach(this.St)}register(t){this.addElmToRegistry({id:t,depth:0,readonly:!1,animation:r(),CSSTransform:null},this.bt)}};function G(t,i){i?(b(t,"position","relative"),b(t,"z-index","99")):(S(t,"position"),S(t,"z-index"))}function W(t,i){if(!t.hasAttribute(i))return;const s=t.getAttribute(i);s&&""===s.trim()&&t.removeAttribute(i)}class U{constructor(t,i,s){this.draggedElm=t,this.draggedDOM=i;const{translate:n}=this.draggedElm;this._t=new d(n.x-s.x,n.y-s.y),this.translatePlaceholder=new d(0,0),this.wt=null}Tt(t,i){if(i)return this.wt=t.ariaDisabled,void(t.ariaDisabled="true");t.ariaDisabled=this.wt}setDOMAttrAndStyle(t,i,s,n,e,h){if(s){this.Tt(t,!0),this.draggedElm.setAttribute(t,"DRAGGED","true"),null!==i?(i.ariaLabel="Draggable",i.id=`dflex-draggable-mirror_${t.id}`,delete i.dataset.index,function(t,i,s){const[n=0,e=0]=i||[];b(t,"position","fixed"),b(t,"top",`${n}px`),b(t,"left",`${e}px`),s&&(s.y>0&&b(t,"height",`${s.y}px`),s.x>0&&b(t,"width",`${s.x}px`)),b(t,"z-index","99"),b(t,"margin","0")}(i,h,e),b(t,"opacity","0")):(t.ariaLabel="Draggable",G(t,!0)),b(document.body,"user-select","none");const s=window.getSelection();s&&s.removeAllRanges()}else S(document.body,"user-select"),this.Tt(t,!1),t.ariaLabel=null,this.draggedElm.clearAttributes(t),null!==i?(n&&(b(t,"position","absolute"),e.x>0&&b(t,"width",`${e.x}px`),e.y>0&&b(t,"height",`${e.y}px`)),S(t,"opacity"),i.remove()):G(t,!1),W(t,"style"),W(document.body,"style")}translate(t,i){this.translatePlaceholder.setAxes(t+this._t.x,i+this._t.y),I.transform(this.draggedDOM,this.translatePlaceholder.x,this.translatePlaceholder.y)}}exports.DFlexBaseDraggable=U,exports.Draggable=class extends U{constructor(t,i){const[s,n]=X.getElmWithDOM(t);super(s,n,i),this.setDOMAttrAndStyle(this.draggedDOM,null,!0,!1,null,null)}dragAt(t,i){this.translate(t,i),this.draggedElm.translate.clone(this.translatePlaceholder)}endDragging(){this.setDOMAttrAndStyle(this.draggedDOM,null,!1,!1,null,null)}},exports.store=X; |
@@ -1,1 +0,1 @@ | ||
class t{constructor(t,i){this.x=t,this.y=i}}class i extends t{setAxes(t,i){this.x=t,this.y=i}clone(t){this.setAxes(t.x,t.y)}getInstance(){return{x:this.x,y:this.y}}isInstanceEqual(t){return this.x===t.x&&this.y===t.y}isEqual(t,i){return this.x===t&&this.y===i}isNotEqual(t,i){return this.x!==t||this.y!==i}}class s{constructor(t,i,s,n){this.top=t,this.right=i,this.bottom=s,this.left=n}}class n extends s{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,i,s,n){return this.top=t,this.right=i,this.bottom=s,this.left=n,this}getBox(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}setByAxis(t,i,s){"x"===t?(this.left=i,this.right=s):(this.top=i,this.bottom=s)}setOne(t,i,s){"x"===t?-1===i?this.left=s:this.right=s:-1===i?this.top=s:this.bottom=s}getOne(t,i){return"x"===t?-1===i?this.left:this.right:-1===i?this.top:this.bottom}setPositionInstance(t){this.top=t.y,this.left=t.x}setPosition(t,i){this.top=i,this.left=t}hasEqualPosition(t,i){return this.top===i||this.left===t}getPosition(){return{x:this.left,y:this.top}}}class e extends n{t(t){return this.top>=t.bottom}i(t){return this.bottom<=t.top}h(t){return this.right<=t.left}o(t){return this.left>=t.right}u(t){return this.top<t.top}l(t){return this.right>t.right}g(t){return this.bottom>t.bottom}m(t){return this.left<t.left}p(t){return this.top>=t.top}_(t){return this.right<=t.right}S(t){return this.bottom<=t.bottom}T(t){return this.left>=t.left}isBoxIntersect(t){return!(this.i(t)||this.o(t)||this.t(t)||this.h(t))}isOutThreshold(t,i,s){if(i.setBox(!1,!1,!1,!1),s){if("y"===s){const s=this.u(t),n=this.g(t);return s&&(i.top=!0),n&&(i.bottom=!0),s||n}const n=this.m(t),e=this.l(t);return n&&(i.left=!0),e&&(i.right=!0),n||e}return this.u(t)?(i.top=!0,!0):this.l(t)?(i.right=!0,!0):this.g(t)?(i.bottom=!0,!0):!!this.m(t)&&(i.left=!0,!0)}isInsideThreshold(t){return this.p(t)&&this._(t)&&this.S(t)&&this.T(t)}getSurroundingBox(t){return{left:Math.min(t.left,this.left),top:Math.min(t.top,this.top),right:Math.max(t.right,this.right),bottom:Math.max(t.bottom,this.bottom)}}isPositionedY(t){return this.t(t)||this.i(t)}assignBiggestBox(t){const{top:i,left:s,right:n,bottom:e}=t;s<this.left&&(this.left=s),i<this.top&&(this.top=i),n>this.right&&(this.right=n),e>this.bottom&&(this.bottom=e)}}function h(t,i){return`${t}_${i}`}function r(t){const i={easing:"ease-in",duration:"dynamic"};return void 0===t?i:null===t?null:{...i,...t}}function o(){}const u="height",l="width",c="position";class a extends e{constructor(t,i,s,n){super(t,i,s,n),this.width=i-n,this.height=s-t}setByPointAndDimensions(t,i,s,n){this.top=t,this.left=i,this.width=n,this.height=s,this.right=i+n,this.bottom=t+s}setAxes(t,i){this.left=t,this.right=this.width+t,this.top=i,this.bottom=this.height+i}getDimensionDiff(t,i){const s=function(t){return"x"===t?l:u}(t);return this[s]-i[s]}getPositionDiff(t,i){const s=function(t){return"x"===t?"left":"top"}(t);return this[s]-i[t]}}class d extends i{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,i){const{top:s,left:n,bottom:h,right:r}=t;return i?new e(s+this.y,r-this.x,h-this.y,n+this.x):new e(s-this.y,r+this.x,h+this.y,n-this.x)}onSameAxis(t,i){return"y"===t?i.x===this.x:i.y===this.y}}class f{constructor(){this.O={}}newTravel(t){return void 0===this.O[t]?this.O[t]=0:this.O[t]+=1,`${t}${this.O[t]}`}}const g="dflex_id_",[m,p]=function(t){let i=null,s=!1;function n(){i&&(clearTimeout(i),i=null)}return[function(t,e){const h=t||o;s=!0,e&&n(),i=setTimeout((()=>{s=!1,h()}),0)},n,function(){return s}]}();class y{constructor(){this.D={},this.K=new Set}v(t){Array.isArray(this.D[t])||(this.D[t]=[])}$(t,i,s){this.D[i].push(t),s&&this.K.add(s)}A(t){return!Array.isArray(this.D[t])||0===this.D[t].length}hasElm(t){return this.K.has(t)}enqueueBeforeLast(t,i,s,n){this.v(s);const{length:e}=this.D[s];0===e?this.D[s].push(i):this.D[s][e-1]=i,this.$(t,s,n)}enqueue(t,i,s){this.v(i),this.$(t,i,s)}executeQueue(t){const i=[];if(this.A(t))return i;try{this.D[t].forEach((t=>{const s=t();i.push(s)}))}catch(t){}finally{p(),delete this.D[t]}return i}B(t){m((()=>{const[i,s]=t;this.executeQueue(i),s&&queueMicrotask((()=>this.executeQueue(s))),this.K.clear()}),!0)}scheduleNextTask(t){this.B(t)}cancelQueuedTask(){p()}clear(){p(),this.D={},this.K.clear()}}const x=Object.freeze(["x","y"]);let b=new WeakMap;function _(t,i,s){t.style.setProperty(i,s)}function S(t,i){t.style.removeProperty(i)}function w(t,i,s){const n=function(t){if(b.has(t))return b.get(t);const i={computedStyle:getComputedStyle(t),parsedProperties:new Map};return b.set(t,i),i}(t),{parsedProperties:e,computedStyle:h}=n,r=e.get(i);if(void 0===r){const t=h.getPropertyValue(i),n=s?function(t){const i=parseFloat(t);return Number.isNaN(i)?0:i}(t):t;return e.set(i,n),n}return r}const T={height:["border-top-width","border-bottom-width","padding-top","padding-bottom"],width:["border-left-width","border-right-width","padding-left","padding-right"]},O={height:"offsetHeight",width:"offsetWidth"};function D(t,i){let s=0;return T[i].forEach((i=>{s+=w(t,i,!0)})),t[O[i]]-s}const E=/absolute|fixed/;const K="dflex_ky_",v="dflex_sk_",$="dflex_bk_";class A{constructor(){this.P()}P(){this.I={},this.M=0,this.C={},this.R={},this.N={},this.k={},this.q=-99,this.F=null,this.H=`${K}${h(0,0)}`}L(t,i){Array.isArray(this.R[i])?this.R[i].find((i=>i===t))||this.R[i].push(t):this.R[i]=[t]}j(t,i){return Array.isArray(this.C[i])||(this.C[i]=[]),this.C[i].push(t)-1}X(t){for(let i=t;i<=t+2;i+=1)void 0===this.I[i]&&(this.I[i]=0)}G(t,i,s,n){const{BK:e,PK:r}=s,o=e!==this.F;this.F=e,o&&(this.I[t]=0);const u=`${v}${h(t,n)}`;let l=null;return t>0&&(l=this.H),o&&(this.N[e][t]={SK:u,id:i}),this.I[t]+=1,{siblingsIndex:n,CHK:l,SK:u,PK:r,BK:e}}W(t,i,s){const n=t+1;if(void 0===this.I[n]&&this.X(t),t<this.q){this.M+=1;const i=s?t:t-1;for(let t=0;t<=i;t+=1)this.I[t]=0}const e=`${$}${this.M}`;Array.isArray(this.N[e])||(this.N[e]=[]),s&&this.I[n]>0&&(this.I[n]-=1);const r=this.I[n],o=`${v}${h(t,r)}`;let u=`${K}${h(t+1,this.M)}`;s?u=this.k[t]:this.k[t]=u;let l=null;if(t>0&&(l=this.H),this.H=u,this.N[e].find((t=>t&&t.SK===o))||this.N[e].push({SK:o,id:i}),s){const t=this.N[`${$}${this.M-1}`],i=t.length;i===this.N[e].length+1&&this.N[e].push(t[i-1])}return this.q=t,this.I[t]+=1,{siblingsIndex:r,CHK:l,SK:o,PK:u,BK:e}}U(t,i,s,n){return this.L(s.SK,i),{order:{self:this.j(t,s.SK),parent:n},keys:s}}register(t,i,s,n,e){const{CHK:h,SK:r,PK:o,BK:u,siblingsIndex:l}=n?this.G(i,t,n,e):this.W(i,t,s);return this.U(t,i,{CHK:h,SK:r,PK:o,BK:u},l)}mutateSiblings(t,i){t in this.C&&Object.assign(this.C,{[t]:i})}getSiblingKeysByDepth(t){return this.R[t]||[]}getElmSiblingsByKey(t){return this.C[t]||[]}getHighestSKInAllBranches(){const t=new Set;return Object.keys(this.N).forEach((i=>{const s=this.N[i][this.N[i].length-1];s&&t.add(s)})),t}V(t){return Array.isArray(this.C[t])}removeIDFromBranch(t,i){this.N[i].find((i=>i&&i.id===t))&&(this.N[i]=this.N[i].map((i=>i&&i.id!==t?i:null)))}Y(t,i){this.N[i]=this.N[i].map((i=>i&&i.SK!==t?i:null))}J(t,i){this.R[i]=this.R[i].filter((i=>i!==t))}destroySiblings(t,i,s,n){if(this.V(t)){if("function"==typeof n)for(;this.C[t].length;)n(this.C[t].pop());delete this.C[t],this.J(t,s),this.Y(t,i)}}endRegistration(){this.F=null}clear(){this.P()}}const B=Object.freeze({DRAGGED:"dragged",INDEX:"data-index",OUT_POS:"data-dragged-out-position",OUT_CONTAINER:"data-dragged-out-container"});function P(t,i,s){_(t,"transform",`translate3d(${i}px, ${s}px, 0)`)}class I{static getType(){return"base:element"}static transform=P;constructor(t){this.id=t,this.translate=new d(0,0),this.Z=new Set}setAttribute(t,i,s){"INDEX"!==i?this.Z.has(i)||(t.setAttribute(B[i],`${s}`),this.Z.add(i)):t.setAttribute(B[i],`${s}`)}removeAttribute(t,i){"INDEX"!==i&&this.Z.has(i)&&(t.removeAttribute(B[i]),this.Z.delete(i))}clearAttributes(t){this.Z.forEach((i=>{this.removeAttribute(t,i)})),this.Z.clear()}}const M="transition-property",C="transition-delay",R="transition-duration",N="transition-timing-function";const k="transitionend";class q extends I{static getType(){return"core:element"}constructor(t){const{order:i,keys:s,depth:n,readonly:e,animation:h,id:r,CSSTransform:o}=t;super(r),this.VDOMOrder={...i},this.DOMOrder={...i},this.keys={...s},this.depth=n,this.readonly=e,this.tt=h,this.it=o,[this.st]=function(){let t=null;function i(){t&&(cancelAnimationFrame(t),t=null)}return[function(s,n){n&&i();try{t=requestAnimationFrame(s)}catch(t){}},i]}(),this.nt=!0,this.et=!1,this.ht=void 0,this.rt=null,this.ot=new d(0,0),this.rect=new a(0,0,0,0),this.DOMGrid=new d(0,0)}updateConfig(t,i,s){this.readonly=t,this.tt=i,this.it=s}initElmRect(t,i,s){const{height:n,width:e,left:h,top:r}=t.getBoundingClientRect(),o=h+i,u=r+s;this.ot.setAxes(o,u),this.rect.setByPointAndDimensions(u,o,n,e),this.ut(t)}ut(t){const i=function(t){const i=function(t){if(!/matrix\([^)]+\)/.test(t))return null;const i=t.match(/matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^)]+)\)/);return i?[parseFloat(i[5]),parseFloat(i[6])]:null}(w(t,"transform",!1));return i}(t);if(i){const[t,s]=i,n=this.ot.x-t,e=this.ot.y-s;this.ot.setAxes(n,e),this.rect.setByPointAndDimensions(e,n,this.rect.height,this.rect.width),this.translate.setAxes(t,s)}}getDimensions(t){if(this.rt)return this.rt;const{width:i,height:s}=function(t){return{width:w(t,l,!0),height:w(t,u,!0)}}(t);return this.rt=new d(i,s),this.rt}getInitialPosition(){return this.ot}changeVisibility(t,i){i!==this.nt&&(this.nt=i,this.et&&this.nt&&(this.lt(t,null),this.et=!1))}lt(t,i,s=o){if(!this.nt)return void(this.et=!0);const n=()=>{this.it&&function(t,i){"string"!=typeof i?function(t,i){Object.keys(i).forEach((i=>{S(t,i)}))}(t,i):function(t,i){t.classList.remove(i)}(t,i)}(t,this.it),this.tt&&function(t){S(t,M),S(t,C),S(t,R),S(t,N)}(t),i&&t.removeEventListener(k,n),s()};this.st((()=>{if(this.it&&function(t,i){"string"!=typeof i?function(t,i){Object.entries(i).forEach((([i,s])=>{_(t,i,s)}))}(t,i):function(t,i){t.classList.add(i)}(t,i)}(t,this.it),null===i)return q.transform(t,this.translate.x,this.translate.y),void n();t.addEventListener(k,n),function(t,i,s,n){_(t,M,"transform"),_(t,C,"0ms"),_(t,R,`${s}ms`),_(t,N,n)}(t,0,i,this.tt.easing),q.transform(t,this.translate.x,this.translate.y)}),!0)}updateIndex(t,i){this.setAttribute(t,"INDEX",i),this.VDOMOrder.self=i}assignNewIndex(t,i){t[i]=this.id}ct(t,i,s){const n={axes:t,numberOfPassedElm:s,translate:this.translate.getInstance()};void 0===this.ht&&(this.ht=new Map),this.ht.has(i)||this.ht.set(i,[]),this.ht.get(i).push(n)}dt(t,i,s){if(i)return!this.nt&&this.et?void(this.et=!1):void this.lt(t,s);this.nt?this.lt(t,s):this.et=!0}ft(t,i,s,n){let e=null;if(this.tt){const{duration:t}=this.tt,s=this.translate.getInstance(),n=this.translate.increase(i).getInstance();e="number"==typeof t?t:function(t,i){const s=t.x-i.x,n=t.y-i.y,e=Math.sqrt(s*s+n*n);return 20*Math.sqrt(e)}(s,n)}else this.translate.increase(i);this.rect.setAxes(this.ot.x+this.translate.x,this.ot.y+this.translate.y),this.dt(t,s,e);const{self:h}=this.VDOMOrder,r=h+n;return this.updateIndex(t,r),[h,r]}gt(t,i,s){if(-1!==t)for(let t=0;t<i;t+=1)this.DOMGrid.x+=1,this.DOMGrid.x>s.x&&(this.DOMGrid.x=0,this.DOMGrid.y+=1);else for(let t=0;t<i;t+=1)this.DOMGrid.x-=1,this.DOMGrid.x<0&&(this.DOMGrid.x=s.x,this.DOMGrid.y-=1)}reconcilePosition(t,i,s,n,e,h,r,o){let u;const l={x:1===i?-1:1,y:i};"z"===t?u=x:(u=[t],l[t]=i),u.forEach((t=>{e[t]*=l[t],this.gt(l[t],h,r)})),this.ct(t,o,h);const c=i*h,[a,d]=this.ft(s,e,!1,c);n[a]="",n[d]=this.id}restorePosition(t){this.lt(t,null),this.setAttribute(t,"INDEX",this.VDOMOrder.self)}assignNewPosition(t,i){this.translate.clone(i),this.lt(t,null)}rollBackPosition(t,i){if(void 0===this.ht||!this.ht.has(i))return;const s=this.ht.get(i),{translate:n,axes:e,numberOfPassedElm:h}=s.pop(),r={x:n.x-this.translate.x,y:n.y-this.translate.y};let o=0;const u={x:r.x>0?1:-1,y:r.y>0?1:-1};if("z"===e?(o=r.x>0||r.y>0?1:-1,this.DOMGrid.increase({x:u.x*h,y:u.y*h})):(o=u[e]*h,this.DOMGrid[e]+=o),this.ft(t,r,!0,o),0===s.length)return this.ht.delete(i),void(0===this.ht.size&&(this.ht=void 0));this.rollBackPosition(t,i)}hasTransformedFromOrigin(){return this.ot.isNotEqual(this.rect.left,this.rect.top)}needDOMReconciliation(){return this.VDOMOrder.self!==this.DOMOrder.self}refreshIndicators(t,i,s){this.ht=void 0,this.translate.setAxes(0,0),this.et=!1,this.DOMOrder.self=this.VDOMOrder.self,S(t,"transform"),function(t,i){if(!t.hasAttribute(i))return;const s=t.getAttribute(i);s&&""===s.trim()&&t.removeAttribute(i)}(t,"style"),this.initElmRect(t,i,s),this.DOMGrid.setAxes(0,0)}getSerializedInstance(){return{type:q.getType(),version:3,id:this.id,grid:this.DOMGrid,translate:this.translate instanceof d?this.translate:null,order:this.VDOMOrder,initialPosition:this.ot.getInstance(),rect:this.rect,hasTransformedFromOrigin:this.hasTransformedFromOrigin(),hasPendingTransformation:this.et,isVisible:this.nt}}}class F extends q{static getDistance(t,i,s){let n=t[s]-i.rect["x"===s?"left":"top"];return n+=i.translate[s],n}static getDisplacement(t,i,s){return t[s]-("x"===s?i.rect.right:i.rect.bottom)}getDisplacement(t,i){return F.getDisplacement(this.rect.getPosition(),t,i)}getDistance(t,i){return F.getDistance(this.rect.getPosition(),t,i)}}const H="registerQ",L="submitQ";class j{constructor(){this.globals={removeContainerWhenEmpty:!1},this.yt=null,this.tracker=new f,this.xt=new y,this.registry=new Map,this.interactiveDOM=new Map,this.DOMGen=new A}config(t){Object.assign(this.globals,t)}bt(t,i,s){const{id:n,depth:e,readonly:h,animation:r,CSSTransform:o}=i;let a,d,f=!1;e>0&&(f=function(t,i,s,n){let e=!1;const h=i.getSiblingKeysByDepth(n),r=h.length;if(r>0){const n=i.getElmSiblingsByKey(h[r-1]),o=n.length;if(o>0){const i=n[o-1],{previousElementSibling:h}=t;h&&(e=h.isSameNode(s.get(i)))}}return e}(t,this.DOMGen,this.interactiveDOM,e),function(t){const i=function(t){return w(t,c,!1)}(t);E.test(i)&&_(t,c,"relative")}(t),this.globals.removeContainerWhenEmpty||function(t){const i=D(t,u),s=D(t,l);_(t,u,`${i}px`),_(t,l,`${s}px`)}(t)),s&&({keys:a,VDOMOrder:{self:d}}=s);const{order:g,keys:m}=this.DOMGen.register(n,e,f,a,d),p=new F({id:n,order:g,keys:m,depth:e,readonly:h,animation:r,CSSTransform:o});return this.registry.set(n,p),this.interactiveDOM.set(n,t),p.setAttribute(t,"INDEX",p.VDOMOrder.self),e>0&&(t.dataset.dflexKey=m.SK),m}_t(t,i,s,n,e,h){let r=null;return t.childNodes.forEach(((t,o)=>{if(t instanceof HTMLElement){let{id:o}=t;if(o||(o=this.tracker.newTravel(g),t.id=o),!this.registry.has(o)){const u={depth:i,readonly:e!==o,animation:s,id:o,CSSTransform:n};({SK:r}=this.bt(t,u,h))}}})),r}endRegistration(){this.yt=null,this.DOMGen.endRegistration()}addElmToRegistry(t,i,s){this.xt.cancelQueuedTask();const{id:n,depth:e,readonly:h,animation:o,CSSTransform:u}=t;let l,c,a=this.registry.has(n);if(a){l=this.interactiveDOM.get(n);const t=this.registry.get(n);t.updateConfig(h,o,u),({SK:c}=t.keys)}else l=function(t){let i=document.getElementById(t);return i&&i.nodeType===Node.ELEMENT_NODE||(i=null),i}(n);!function(t,i){let s=0,n=t;try{do{if(s+=1,s>1&&i(n))return s=0,n;n=n.parentElement}while(null!==n&&!n.isSameNode(document.body))}catch(t){}finally{s=0}}(l,(t=>{let l=!1,{id:d}=t;if(d?l=this.registry.has(d):(d=this.tracker.newTravel(g),t.id=d),this.xt.hasElm(n)&&([c]=this.xt.executeQueue(H),this.registry.get(n).updateConfig(h,o,u),a=!0),null===this.yt||!this.yt.isSameNode(t)){const h=i=>{c=this._t(t,e,o,u,n,i),a=!0},f=()=>{i&&s&&this.xt.enqueueBeforeLast(s,(()=>i(c,e+1,t)),L)};if(this.yt=t,l)a||(h(this.registry.get(d)),f());else{this.xt.executeQueue(H);const i=e+1;a||h(null),this.xt.enqueue((()=>{const{SK:s}=this.bt(t,{id:d,depth:i,readonly:!0,animation:r(),CSSTransform:null},null);return s}),H,d),f()}}return this.xt.scheduleNextTask([H,L]),!0}))}getElmWithDOM(t){return[this.registry.get(t),this.interactiveDOM.get(t)]}has(t){return this.interactiveDOM.has(t)&&this.registry.has(t)}getElmSiblingsByKey(t){return this.DOMGen.getElmSiblingsByKey(t)}getSiblingKeysByDepth(t){return this.DOMGen.getSiblingKeysByDepth(t)}mutateSiblings(t,i){this.DOMGen.mutateSiblings(t,i)}unregister(t){this.registry.delete(t),this.interactiveDOM.delete(t)}destroy(){this.DOMGen.clear(),this.interactiveDOM.clear(),this.registry.clear(),this.xt.clear(),this.yt=null}}var z=new class extends j{constructor(){super(),this.St=this.St.bind(this),this.wt=this.wt.bind(this)}wt(t){const[i,s]=this.getElmWithDOM(t);i.initElmRect(s,0,0)}St(t){this.getElmSiblingsByKey(t).forEach(this.wt)}register(t){this.addElmToRegistry({id:t,depth:0,readonly:!1,animation:r(),CSSTransform:null},this.St)}};function Q(t,i){i?(_(t,"position","relative"),_(t,"z-index","99")):(S(t,"position"),S(t,"z-index"))}function X(t,i){if(!t.hasAttribute(i))return;const s=t.getAttribute(i);s&&""===s.trim()&&t.removeAttribute(i)}class G{constructor(t,i,s){this.draggedElm=t,this.draggedDOM=i;const{translate:n}=this.draggedElm;this.Tt=new d(n.x-s.x,n.y-s.y),this.translatePlaceholder=new d(0,0),this.Ot=null}Dt(t,i){if(i)return this.Ot=t.ariaDisabled,void(t.ariaDisabled="true");t.ariaDisabled=this.Ot}setDOMAttrAndStyle(t,i,s,n,e,h){if(s){this.Dt(t,!0),this.draggedElm.setAttribute(t,"DRAGGED","true"),null!==i?(i.ariaLabel="Draggable",i.id=`dflex-draggable-mirror_${t.id}`,delete i.dataset.index,function(t,i,s){const[n=0,e=0]=i||[];_(t,"position","fixed"),_(t,"top",`${n}px`),_(t,"left",`${e}px`),s&&(s.y>0&&_(t,"height",`${s.y}px`),s.x>0&&_(t,"width",`${s.x}px`)),_(t,"z-index","99"),_(t,"margin","0")}(i,h,e),_(t,"opacity","0")):(t.ariaLabel="Draggable",Q(t,!0)),_(document.body,"user-select","none");const s=window.getSelection();s&&s.removeAllRanges()}else S(document.body,"user-select"),this.Dt(t,!1),t.ariaLabel=null,this.draggedElm.clearAttributes(t),null!==i?(n&&(_(t,"position","absolute"),e.x>0&&_(t,"width",`${e.x}px`),e.y>0&&_(t,"height",`${e.y}px`)),S(t,"opacity"),i.remove()):Q(t,!1),X(t,"style"),X(document.body,"style")}translate(t,i){this.translatePlaceholder.setAxes(t+this.Tt.x,i+this.Tt.y),I.transform(this.draggedDOM,this.translatePlaceholder.x,this.translatePlaceholder.y)}}exports.DFlexBaseDraggable=G,exports.Draggable=class extends G{constructor(t,i){const[s,n]=z.getElmWithDOM(t);super(s,n,i),this.setDOMAttrAndStyle(this.draggedDOM,null,!0,!1,null,null)}dragAt(t,i){this.translate(t,i),this.draggedElm.translate.clone(this.translatePlaceholder)}endDragging(){this.setDOMAttrAndStyle(this.draggedDOM,null,!1,!1,null,null)}},exports.store=z; | ||
class t{constructor(t,i){this.x=t,this.y=i}}class i extends t{setAxes(t,i){this.x=t,this.y=i}clone(t){this.setAxes(t.x,t.y)}getInstance(){return{x:this.x,y:this.y}}isInstanceEqual(t){return this.x===t.x&&this.y===t.y}isEqual(t,i){return this.x===t&&this.y===i}isNotEqual(t,i){return this.x!==t||this.y!==i}}class s{constructor(t,i,s,n){this.top=t,this.right=i,this.bottom=s,this.left=n}}class n extends s{clone(t){this.top=t.top,this.right=t.right,this.bottom=t.bottom,this.left=t.left}setBox(t,i,s,n){return this.top=t,this.right=i,this.bottom=s,this.left=n,this}getBox(){return{top:this.top,right:this.right,bottom:this.bottom,left:this.left}}setByAxis(t,i,s){"x"===t?(this.left=i,this.right=s):(this.top=i,this.bottom=s)}setOne(t,i,s){"x"===t?-1===i?this.left=s:this.right=s:-1===i?this.top=s:this.bottom=s}getOne(t,i){return"x"===t?-1===i?this.left:this.right:-1===i?this.top:this.bottom}setPositionInstance(t){this.top=t.y,this.left=t.x}setPosition(t,i){this.top=i,this.left=t}hasEqualPosition(t,i){return this.top===i||this.left===t}getPosition(){return{x:this.left,y:this.top}}}class e extends n{t(t){return this.top>=t.bottom}i(t){return this.bottom<=t.top}h(t){return this.right<=t.left}o(t){return this.left>=t.right}u(t){return this.top<t.top}l(t){return this.right>t.right}g(t){return this.bottom>t.bottom}m(t){return this.left<t.left}p(t){return this.top>=t.top}S(t){return this.right<=t.right}_(t){return this.bottom<=t.bottom}T(t){return this.left>=t.left}isBoxIntersect(t){return!(this.i(t)||this.o(t)||this.t(t)||this.h(t))}isOutThreshold(t,i,s){if(i.setBox(!1,!1,!1,!1),s){if("y"===s){const s=this.u(t),n=this.g(t);return s&&(i.top=!0),n&&(i.bottom=!0),s||n}const n=this.m(t),e=this.l(t);return n&&(i.left=!0),e&&(i.right=!0),n||e}return this.u(t)?(i.top=!0,!0):this.l(t)?(i.right=!0,!0):this.g(t)?(i.bottom=!0,!0):!!this.m(t)&&(i.left=!0,!0)}isInsideThreshold(t){return this.p(t)&&this.S(t)&&this._(t)&&this.T(t)}getSurroundingBox(t){return{left:Math.min(t.left,this.left),top:Math.min(t.top,this.top),right:Math.max(t.right,this.right),bottom:Math.max(t.bottom,this.bottom)}}isPositionedY(t){return this.t(t)||this.i(t)}assignBiggestBox(t){const{top:i,left:s,right:n,bottom:e}=t;s<this.left&&(this.left=s),i<this.top&&(this.top=i),n>this.right&&(this.right=n),e>this.bottom&&(this.bottom=e)}}function h(t,i){return`${t}_${i}`}function r(t){const i={easing:"ease-in",duration:"dynamic"};return void 0===t?i:null===t?null:{...i,...t}}function o(){}const u="height",l="width",c="position";class a extends e{constructor(t,i,s,n){super(t,i,s,n),this.width=i-n,this.height=s-t}setByPointAndDimensions(t,i,s,n){this.top=t,this.left=i,this.width=n,this.height=s,this.right=i+n,this.bottom=t+s}setAxes(t,i){this.left=t,this.right=this.width+t,this.top=i,this.bottom=this.height+i}getDimensionDiff(t,i){const s=function(t){return"x"===t?l:u}(t);return this[s]-i[s]}getPositionDiff(t,i){const s=function(t){return"x"===t?"left":"top"}(t);return this[s]-i[t]}}class d extends i{increase(t){return this.x+=t.x,this.y+=t.y,this}composeBox(t,i){const{top:s,left:n,bottom:h,right:r}=t;return i?new e(s+this.y,r-this.x,h-this.y,n+this.x):new e(s-this.y,r+this.x,h+this.y,n-this.x)}onSameAxis(t,i){return"y"===t?i.x===this.x:i.y===this.y}}var f=new class{constructor(){this.O={}}newTravel(t){return void 0===this.O[t]?this.O[t]=0:this.O[t]+=1,`${t}${this.O[t]}`}};const[g,m]=function(t){let i=null,s=!1;function n(){i&&(clearTimeout(i),i=null)}return[function(t,e){const h=t||o;s=!0,e&&n(),i=setTimeout((()=>{s=!1,h()}),0)},n,function(){return s}]}();class p{constructor(){this.D={},this.K=new Set}v(t){Array.isArray(this.D[t])||(this.D[t]=[])}$(t,i,s){this.D[i].push(t),s&&this.K.add(s)}A(t){return!Array.isArray(this.D[t])||0===this.D[t].length}hasElm(t){return this.K.has(t)}enqueueBeforeLast(t,i,s,n){this.v(s);const{length:e}=this.D[s];0===e?this.D[s].push(i):this.D[s][e-1]=i,this.$(t,s,n)}enqueue(t,i,s){this.v(i),this.$(t,i,s)}executeQueue(t){const i=[];if(this.A(t))return i;try{this.D[t].forEach((t=>{const s=t();i.push(s)}))}catch(t){}finally{m(),delete this.D[t]}return i}B(t){g((()=>{const[i,s]=t;this.executeQueue(i),s&&queueMicrotask((()=>this.executeQueue(s))),this.K.clear()}),!0)}scheduleNextTask(t){this.B(t)}cancelQueuedTask(){m()}clear(){m(),this.D={},this.K.clear()}}const y=Object.freeze(["x","y"]);let x=new WeakMap;function b(t,i,s){t.style.setProperty(i,s)}function S(t,i){t.style.removeProperty(i)}function _(t,i,s){const n=function(t){if(x.has(t))return x.get(t);const i={computedStyle:getComputedStyle(t),parsedProperties:new Map};return x.set(t,i),i}(t),{parsedProperties:e,computedStyle:h}=n,r=e.get(i);if(void 0===r){const t=h.getPropertyValue(i),n=s?function(t){const i=parseFloat(t);return Number.isNaN(i)?0:i}(t):t;return e.set(i,n),n}return r}const w={height:["border-top-width","border-bottom-width","padding-top","padding-bottom"],width:["border-left-width","border-right-width","padding-left","padding-right"]},T={height:"offsetHeight",width:"offsetWidth"};function O(t,i){let s=0;return w[i].forEach((i=>{s+=_(t,i,!0)})),t[T[i]]-s}const D=/absolute|fixed/,E="relative";const K="dflex_ky_",v="dflex_sk_",$="dflex_bk_";class A{constructor(){this.P()}P(){this.I={},this.M=0,this.C={},this.R={},this.N={},this.k={},this.q=-99,this.F=null,this.H=`${K}${h(0,0)}`}L(t,i){Array.isArray(this.R[i])?this.R[i].find((i=>i===t))||this.R[i].push(t):this.R[i]=[t]}j(t,i){return Array.isArray(this.C[i])||(this.C[i]=[]),this.C[i].push(t)-1}X(t){for(let i=t;i<=t+2;i+=1)void 0===this.I[i]&&(this.I[i]=0)}G(t,i,s,n){const{BK:e,PK:r}=s,o=e!==this.F;this.F=e,o&&(this.I[t]=0);const u=`${v}${h(t,n)}`;let l=null;return t>0&&(l=this.H),o&&(this.N[e][t]={SK:u,id:i}),this.I[t]+=1,{siblingsIndex:n,CHK:l,SK:u,PK:r,BK:e}}W(t,i,s){const n=t+1;if(void 0===this.I[n]&&this.X(t),t<this.q){this.M+=1;const i=s?t:t-1;for(let t=0;t<=i;t+=1)this.I[t]=0}const e=`${$}${this.M}`;Array.isArray(this.N[e])||(this.N[e]=[]),s&&this.I[n]>0&&(this.I[n]-=1);const r=this.I[n],o=`${v}${h(t,r)}`;let u=`${K}${h(t+1,this.M)}`;s?u=this.k[t]:this.k[t]=u;let l=null;if(t>0&&(l=this.H),this.H=u,this.N[e].find((t=>t&&t.SK===o))||this.N[e].push({SK:o,id:i}),s){const t=this.N[`${$}${this.M-1}`],i=t.length;i===this.N[e].length+1&&this.N[e].push(t[i-1])}return this.q=t,this.I[t]+=1,{siblingsIndex:r,CHK:l,SK:o,PK:u,BK:e}}U(t,i,s,n){return this.L(s.SK,i),{order:{self:this.j(t,s.SK),parent:n},keys:s}}register(t,i,s,n,e){const{CHK:h,SK:r,PK:o,BK:u,siblingsIndex:l}=n?this.G(i,t,n,e):this.W(i,t,s);return this.U(t,i,{CHK:h,SK:r,PK:o,BK:u},l)}mutateSiblings(t,i){t in this.C&&Object.assign(this.C,{[t]:i})}getSiblingKeysByDepth(t){return this.R[t]||[]}getElmSiblingsByKey(t){return this.C[t]||[]}getHighestSKInAllBranches(){const t=new Set;return Object.keys(this.N).forEach((i=>{const s=this.N[i][this.N[i].length-1];s&&t.add(s)})),t}V(t){return Array.isArray(this.C[t])}removeIDFromBranch(t,i){this.N[i].find((i=>i&&i.id===t))&&(this.N[i]=this.N[i].map((i=>i&&i.id!==t?i:null)))}Y(t,i){this.N[i]=this.N[i].map((i=>i&&i.SK!==t?i:null))}J(t,i){this.R[i]=this.R[i].filter((i=>i!==t))}destroySiblings(t,i,s,n){if(this.V(t)){if("function"==typeof n)for(;this.C[t].length;)n(this.C[t].pop());delete this.C[t],this.J(t,s),this.Y(t,i)}}endRegistration(){this.F=null}clear(){this.P()}}const B=Object.freeze({DRAGGED:"dragged",INDEX:"data-index",OUT_POS:"data-dragged-out-position",OUT_CONTAINER:"data-dragged-out-container"});function P(t,i,s){b(t,"transform",`translate3d(${i}px, ${s}px, 0)`)}class I{static getType(){return"base:element"}static transform=P;constructor(t){this.id=t,this.translate=new d(0,0),this.Z=new Set}setAttribute(t,i,s){"INDEX"!==i?this.Z.has(i)||(t.setAttribute(B[i],`${s}`),this.Z.add(i)):t.setAttribute(B[i],`${s}`)}removeAttribute(t,i){"INDEX"!==i&&this.Z.has(i)&&(t.removeAttribute(B[i]),this.Z.delete(i))}clearAttributes(t){this.Z.forEach((i=>{this.removeAttribute(t,i)})),this.Z.clear()}}const M="transition-property",C="transition-delay",R="transition-duration",N="transition-timing-function";const k="transitionend";class q extends I{static getType(){return"core:element"}constructor(t){const{order:i,keys:s,depth:n,readonly:e,animation:h,id:r,CSSTransform:o}=t;super(r),this.VDOMOrder={...i},this.DOMOrder={...i},this.keys={...s},this.depth=n,this.readonly=e,this.tt=h,this.it=o,[this.st]=function(){let t=null;function i(){t&&(cancelAnimationFrame(t),t=null)}return[function(s,n){n&&i();try{t=requestAnimationFrame(s)}catch(t){}},i]}(),this.nt=!0,this.et=!1,this.ht=void 0,this.rt=null,this.ot=new d(0,0),this.rect=new a(0,0,0,0),this.DOMGrid=new d(0,0)}updateConfig(t,i,s){this.readonly=t,this.tt=i,this.it=s}initElmRect(t,i,s){this.rect=function(t,i,s){const{left:n,top:e,right:h,bottom:r,height:o,width:u}=t.getBoundingClientRect(),l=new a(e,h,r,n);return 0===i&&0===s||l.setByPointAndDimensions(e+s,n+i,o,u),l}(t,i,s);const{left:n,top:e}=this.rect;this.ot.setAxes(n,e),this.ut(t)}ut(t){const i=function(t){const i=function(t){if(!/matrix\([^)]+\)/.test(t))return null;const i=t.match(/matrix\(\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^,]+),\s*([^)]+)\)/);return i?[parseFloat(i[5]),parseFloat(i[6])]:null}(_(t,"transform",!1));return i}(t);if(i){const[t,s]=i,n=this.ot.x-t,e=this.ot.y-s;this.ot.setAxes(n,e),this.rect.setByPointAndDimensions(e,n,this.rect.height,this.rect.width),this.translate.setAxes(t,s)}}getDimensions(t){if(this.rt)return this.rt;const{width:i,height:s}=function(t){return{width:_(t,l,!0),height:_(t,u,!0)}}(t);return this.rt=new d(i,s),this.rt}getInitialPosition(){return this.ot}changeVisibility(t,i){i!==this.nt&&(this.nt=i,this.et&&this.nt&&(this.lt(t,null),this.et=!1))}lt(t,i,s=o){if(!this.nt)return void(this.et=!0);const n=()=>{this.it&&function(t,i){"string"!=typeof i?function(t,i){Object.keys(i).forEach((i=>{S(t,i)}))}(t,i):function(t,i){t.classList.remove(i)}(t,i)}(t,this.it),this.tt&&function(t){S(t,M),S(t,C),S(t,R),S(t,N)}(t),i&&t.removeEventListener(k,n),s()};this.st((()=>{if(this.it&&function(t,i){"string"!=typeof i?function(t,i){Object.entries(i).forEach((([i,s])=>{b(t,i,s)}))}(t,i):function(t,i){t.classList.add(i)}(t,i)}(t,this.it),null===i)return q.transform(t,this.translate.x,this.translate.y),void n();t.addEventListener(k,n),function(t,i,s,n){b(t,M,"transform"),b(t,C,"0ms"),b(t,R,`${s}ms`),b(t,N,n)}(t,0,i,this.tt.easing),q.transform(t,this.translate.x,this.translate.y)}),!0)}updateIndex(t,i){this.setAttribute(t,"INDEX",i),this.VDOMOrder.self=i}assignNewIndex(t,i){t[i]=this.id}ct(t,i,s){const n={axes:t,numberOfPassedElm:s,translate:this.translate.getInstance()};void 0===this.ht&&(this.ht=new Map),this.ht.has(i)||this.ht.set(i,[]),this.ht.get(i).push(n)}dt(t,i,s){if(i)return!this.nt&&this.et?void(this.et=!1):void this.lt(t,s);this.nt?this.lt(t,s):this.et=!0}ft(t,i,s,n){let e=null;if(this.tt){const{duration:t}=this.tt,s=this.translate.getInstance(),n=this.translate.increase(i).getInstance();e="number"==typeof t?t:function(t,i){const s=t.x-i.x,n=t.y-i.y,e=Math.sqrt(s*s+n*n);return 20*Math.sqrt(e)}(s,n)}else this.translate.increase(i);this.rect.setAxes(this.ot.x+this.translate.x,this.ot.y+this.translate.y),this.dt(t,s,e);const{self:h}=this.VDOMOrder,r=h+n;return this.updateIndex(t,r),[h,r]}gt(t,i,s){if(-1!==t)for(let t=0;t<i;t+=1)this.DOMGrid.x+=1,this.DOMGrid.x>s.x&&(this.DOMGrid.x=0,this.DOMGrid.y+=1);else for(let t=0;t<i;t+=1)this.DOMGrid.x-=1,this.DOMGrid.x<0&&(this.DOMGrid.x=s.x,this.DOMGrid.y-=1)}reconcilePosition(t,i,s,n,e,h,r,o){let u;const l={x:1===i?-1:1,y:i};"z"===t?u=y:(u=[t],l[t]=i),u.forEach((t=>{e[t]*=l[t],this.gt(l[t],h,r)})),this.ct(t,o,h);const c=i*h,[a,d]=this.ft(s,e,!1,c);n[a]="",n[d]=this.id}restorePosition(t){this.lt(t,null),this.setAttribute(t,"INDEX",this.VDOMOrder.self)}assignNewPosition(t,i){this.translate.clone(i),this.lt(t,null)}rollBackPosition(t,i){if(void 0===this.ht||!this.ht.has(i))return;const s=this.ht.get(i),{translate:n,axes:e,numberOfPassedElm:h}=s.pop(),r={x:n.x-this.translate.x,y:n.y-this.translate.y};let o=0;const u={x:r.x>0?1:-1,y:r.y>0?1:-1};if("z"===e?(o=r.x>0||r.y>0?1:-1,this.DOMGrid.increase({x:u.x*h,y:u.y*h})):(o=u[e]*h,this.DOMGrid[e]+=o),this.ft(t,r,!0,o),0===s.length)return this.ht.delete(i),void(0===this.ht.size&&(this.ht=void 0));this.rollBackPosition(t,i)}hasTransformedFromOrigin(){return this.ot.isNotEqual(this.rect.left,this.rect.top)}needDOMReconciliation(){return this.VDOMOrder.self!==this.DOMOrder.self}refreshIndicators(t,i,s){this.ht=void 0,this.translate.setAxes(0,0),this.et=!1,this.DOMOrder.self=this.VDOMOrder.self,S(t,"transform"),function(t,i){if(!t.hasAttribute(i))return;const s=t.getAttribute(i);s&&""===s.trim()&&t.removeAttribute(i)}(t,"style"),this.initElmRect(t,i,s),this.DOMGrid.setAxes(0,0)}getSerializedInstance(){return{type:q.getType(),version:3,id:this.id,grid:this.DOMGrid,translate:this.translate instanceof d?this.translate:null,order:this.VDOMOrder,initialPosition:this.ot.getInstance(),rect:this.rect,hasTransformedFromOrigin:this.hasTransformedFromOrigin(),hasPendingTransformation:this.et,isVisible:this.nt}}}class F extends q{static getDistance(t,i,s){let n=t[s]-i.rect["x"===s?"left":"top"];return n+=i.translate[s],n}static getDisplacement(t,i,s){return t[s]-("x"===s?i.rect.right:i.rect.bottom)}getDisplacement(t,i){return F.getDisplacement(this.rect.getPosition(),t,i)}getDistance(t,i){return F.getDistance(this.rect.getPosition(),t,i)}}function H(t,i,s,n){const{id:e,depth:h,readonly:r,animation:o,CSSTransform:a}=i;let d,f,g=!1;h>0&&(g=function(t,i,s){let n=!1;const e=s.DOMGen.getSiblingKeysByDepth(i),h=e.length;if(h>0){const i=s.DOMGen.getElmSiblingsByKey(e[h-1]),r=i.length;if(r>0){const e=i[r-1],{previousElementSibling:h}=t;h&&(n=h.isSameNode(s.interactiveDOM.get(e)))}}return n}(t,h,n),function(t){const i=function(t){return _(t,c,!1)}(t);D.test(i)&&b(t,c,E)}(t),n.globals.removeContainerWhenEmpty||function(t){const i=O(t,u),s=O(t,l);b(t,u,`${i}px`),b(t,l,`${s}px`)}(t)),s&&({keys:d,VDOMOrder:{self:f}}=s);const{order:m,keys:p}=n.DOMGen.register(e,h,g,d,f),y=new F({id:e,order:m,keys:p,depth:h,readonly:r,animation:o,CSSTransform:a});return n.registry.set(e,y),n.interactiveDOM.set(e,t),y.setAttribute(t,"INDEX",y.VDOMOrder.self),h>0&&(t.dataset.dflexKey=p.SK),p}function L(t){let{id:i}=t;return i||(i=f.newTravel("dflex_id_"),t.id=i),i}const j="registerQ",z="submitQ";class Q{constructor(){this.globals={removeContainerWhenEmpty:!1},this.yt=null,this.xt=new p,this.registry=new Map,this.interactiveDOM=new Map,this.DOMGen=new A}config(t){Object.assign(this.globals,t)}endRegistration(){this.yt=null,this.DOMGen.endRegistration()}addElmToRegistry(t,i,s){this.xt.cancelQueuedTask();const{id:n,depth:e,readonly:h,animation:o,CSSTransform:u}=t;let l,c,a=this.registry.has(n);if(a){let t;[t,l]=this.getElmWithDOM(n),t.updateConfig(h,o,u),({SK:c}=t.keys)}else l=function(t){let i=document.getElementById(t);return i&&i.nodeType===Node.ELEMENT_NODE||(i=null),i}(n);!function(t,i){let s=0,n=t;try{do{if(s+=1,s>1&&i(n))return s=0,n;n=n.parentElement}while(null!==n&&!n.isSameNode(document.body))}catch(t){}finally{s=0}}(l,(t=>{const l=L(t),d=this.registry.has(l);if(this.xt.hasElm(n)&&([c]=this.xt.executeQueue(j),this.registry.get(n).updateConfig(h,o,u),a=!0),null===this.yt||!this.yt.isSameNode(t)){const h=i=>{c=function(t,i,s,n,e,h,r){let o=null;return t.childNodes.forEach(((t,u)=>{if(t instanceof HTMLElement){const u=L(t);if(!s.registry.has(u)){const l={depth:i,readonly:h!==u,animation:n,id:u,CSSTransform:e};({SK:o}=H(t,l,r,s))}}})),o}(t,e,this,o,u,n,i),a=!0},f=()=>{i&&s&&this.xt.enqueueBeforeLast(s,(()=>i(c,e+1,t)),z)};if(this.yt=t,d)a||(h(this.registry.get(l)),f());else{this.xt.executeQueue(j);const i=e+1;a||h(null),this.xt.enqueue((()=>{const{SK:s}=H(t,{id:l,depth:i,readonly:!0,animation:r(),CSSTransform:null},null,this);return s}),j,l),f()}}return this.xt.scheduleNextTask([j,z]),!0}))}getElmWithDOM(t){return[this.registry.get(t),this.interactiveDOM.get(t)]}has(t){return this.interactiveDOM.has(t)&&this.registry.has(t)}getElmSiblingsByKey(t){return this.DOMGen.getElmSiblingsByKey(t)}getSiblingKeysByDepth(t){return this.DOMGen.getSiblingKeysByDepth(t)}mutateSiblings(t,i){this.DOMGen.mutateSiblings(t,i)}unregister(t){this.registry.delete(t),this.interactiveDOM.delete(t)}destroy(){this.DOMGen.clear(),this.interactiveDOM.clear(),this.registry.clear(),this.xt.clear(),this.yt=null}}var X=new class extends Q{constructor(){super(),this.bt=this.bt.bind(this),this.St=this.St.bind(this)}St(t){const[i,s]=this.getElmWithDOM(t);i.initElmRect(s,0,0)}bt(t){this.getElmSiblingsByKey(t).forEach(this.St)}register(t){this.addElmToRegistry({id:t,depth:0,readonly:!1,animation:r(),CSSTransform:null},this.bt)}};function G(t,i){i?(b(t,"position","relative"),b(t,"z-index","99")):(S(t,"position"),S(t,"z-index"))}function W(t,i){if(!t.hasAttribute(i))return;const s=t.getAttribute(i);s&&""===s.trim()&&t.removeAttribute(i)}class U{constructor(t,i,s){this.draggedElm=t,this.draggedDOM=i;const{translate:n}=this.draggedElm;this._t=new d(n.x-s.x,n.y-s.y),this.translatePlaceholder=new d(0,0),this.wt=null}Tt(t,i){if(i)return this.wt=t.ariaDisabled,void(t.ariaDisabled="true");t.ariaDisabled=this.wt}setDOMAttrAndStyle(t,i,s,n,e,h){if(s){this.Tt(t,!0),this.draggedElm.setAttribute(t,"DRAGGED","true"),null!==i?(i.ariaLabel="Draggable",i.id=`dflex-draggable-mirror_${t.id}`,delete i.dataset.index,function(t,i,s){const[n=0,e=0]=i||[];b(t,"position","fixed"),b(t,"top",`${n}px`),b(t,"left",`${e}px`),s&&(s.y>0&&b(t,"height",`${s.y}px`),s.x>0&&b(t,"width",`${s.x}px`)),b(t,"z-index","99"),b(t,"margin","0")}(i,h,e),b(t,"opacity","0")):(t.ariaLabel="Draggable",G(t,!0)),b(document.body,"user-select","none");const s=window.getSelection();s&&s.removeAllRanges()}else S(document.body,"user-select"),this.Tt(t,!1),t.ariaLabel=null,this.draggedElm.clearAttributes(t),null!==i?(n&&(b(t,"position","absolute"),e.x>0&&b(t,"width",`${e.x}px`),e.y>0&&b(t,"height",`${e.y}px`)),S(t,"opacity"),i.remove()):G(t,!1),W(t,"style"),W(document.body,"style")}translate(t,i){this.translatePlaceholder.setAxes(t+this._t.x,i+this._t.y),I.transform(this.draggedDOM,this.translatePlaceholder.x,this.translatePlaceholder.y)}}exports.DFlexBaseDraggable=U,exports.Draggable=class extends U{constructor(t,i){const[s,n]=X.getElmWithDOM(t);super(s,n,i),this.setDOMAttrAndStyle(this.draggedDOM,null,!0,!1,null,null)}dragAt(t,i){this.translate(t,i),this.draggedElm.translate.clone(this.translatePlaceholder)}endDragging(){this.setDOMAttrAndStyle(this.draggedDOM,null,!1,!1,null,null)}},exports.store=X; |
{ | ||
"name": "@dflex/draggable", | ||
"version": "3.9.2", | ||
"version": "3.9.3", | ||
"description": "Draggable only package for all JavaScript frameworks", | ||
@@ -29,5 +29,5 @@ "author": "Jalal Maskoun", | ||
"devDependencies": { | ||
"@dflex/core-instance": "^3.9.2", | ||
"@dflex/store": "^3.9.2", | ||
"@dflex/utils": "^3.9.2", | ||
"@dflex/core-instance": "^3.9.3", | ||
"@dflex/store": "^3.9.3", | ||
"@dflex/utils": "^3.9.3", | ||
"eslint-config-dflex-react": "0.3.0" | ||
@@ -34,0 +34,0 @@ }, |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
198692
5024