maglevcms 3.0.0.beta1 → 3.0.0.beta2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ // @rails/actioncable/src@8.0.200 downloaded from https://ga.jspm.io/npm:@rails/actioncable@8.0.200/src/index.js
2
+
3
+ var t={logger:typeof console!=="undefined"?console:void 0,WebSocket:typeof WebSocket!=="undefined"?WebSocket:void 0};var e={log(...e){if(this.enabled){e.push(Date.now());t.logger.log("[ActionCable]",...e)}}};const now=()=>(new Date).getTime();const secondsSince=t=>(now()-t)/1e3;class ConnectionMonitor{constructor(t){this.visibilityDidChange=this.visibilityDidChange.bind(this);this.connection=t;this.reconnectAttempts=0}start(){if(!this.isRunning()){this.startedAt=now();delete this.stoppedAt;this.startPolling();addEventListener("visibilitychange",this.visibilityDidChange);e.log(`ConnectionMonitor started. stale threshold = ${this.constructor.staleThreshold} s`)}}stop(){if(this.isRunning()){this.stoppedAt=now();this.stopPolling();removeEventListener("visibilitychange",this.visibilityDidChange);e.log("ConnectionMonitor stopped")}}isRunning(){return this.startedAt&&!this.stoppedAt}recordMessage(){this.pingedAt=now()}recordConnect(){this.reconnectAttempts=0;delete this.disconnectedAt;e.log("ConnectionMonitor recorded connect")}recordDisconnect(){this.disconnectedAt=now();e.log("ConnectionMonitor recorded disconnect")}startPolling(){this.stopPolling();this.poll()}stopPolling(){clearTimeout(this.pollTimeout)}poll(){this.pollTimeout=setTimeout((()=>{this.reconnectIfStale();this.poll()}),this.getPollInterval())}getPollInterval(){const{staleThreshold:t,reconnectionBackoffRate:e}=this.constructor;const n=Math.pow(1+e,Math.min(this.reconnectAttempts,10));const i=this.reconnectAttempts===0?1:e;const o=i*Math.random();return t*1e3*n*(1+o)}reconnectIfStale(){if(this.connectionIsStale()){e.log(`ConnectionMonitor detected stale connection. reconnectAttempts = ${this.reconnectAttempts}, time stale = ${secondsSince(this.refreshedAt)} s, stale threshold = ${this.constructor.staleThreshold} s`);this.reconnectAttempts++;if(this.disconnectedRecently())e.log(`ConnectionMonitor skipping reopening recent disconnect. time disconnected = ${secondsSince(this.disconnectedAt)} s`);else{e.log("ConnectionMonitor reopening");this.connection.reopen()}}}get refreshedAt(){return this.pingedAt?this.pingedAt:this.startedAt}connectionIsStale(){return secondsSince(this.refreshedAt)>this.constructor.staleThreshold}disconnectedRecently(){return this.disconnectedAt&&secondsSince(this.disconnectedAt)<this.constructor.staleThreshold}visibilityDidChange(){document.visibilityState==="visible"&&setTimeout((()=>{if(this.connectionIsStale()||!this.connection.isOpen()){e.log(`ConnectionMonitor reopening stale connection on visibilitychange. visibilityState = ${document.visibilityState}`);this.connection.reopen()}}),200)}}ConnectionMonitor.staleThreshold=6;ConnectionMonitor.reconnectionBackoffRate=.15;var n={message_types:{welcome:"welcome",disconnect:"disconnect",ping:"ping",confirmation:"confirm_subscription",rejection:"reject_subscription"},disconnect_reasons:{unauthorized:"unauthorized",invalid_request:"invalid_request",server_restart:"server_restart",remote:"remote"},default_mount_path:"/cable",protocols:["actioncable-v1-json","actioncable-unsupported"]};const{message_types:i,protocols:o}=n;const s=o.slice(0,o.length-1);const r=[].indexOf;class Connection{constructor(t){this.open=this.open.bind(this);this.consumer=t;this.subscriptions=this.consumer.subscriptions;this.monitor=new ConnectionMonitor(this);this.disconnected=true}send(t){if(this.isOpen()){this.webSocket.send(JSON.stringify(t));return true}return false}open(){if(this.isActive()){e.log(`Attempted to open WebSocket, but existing socket is ${this.getState()}`);return false}{const n=[...o,...this.consumer.subprotocols||[]];e.log(`Opening WebSocket, current state is ${this.getState()}, subprotocols: ${n}`);this.webSocket&&this.uninstallEventHandlers();this.webSocket=new t.WebSocket(this.consumer.url,n);this.installEventHandlers();this.monitor.start();return true}}close({allowReconnect:t}={allowReconnect:true}){t||this.monitor.stop();if(this.isOpen())return this.webSocket.close()}reopen(){e.log(`Reopening WebSocket, current state is ${this.getState()}`);if(!this.isActive())return this.open();try{return this.close()}catch(t){e.log("Failed to reopen WebSocket",t)}finally{e.log(`Reopening WebSocket in ${this.constructor.reopenDelay}ms`);setTimeout(this.open,this.constructor.reopenDelay)}}getProtocol(){if(this.webSocket)return this.webSocket.protocol}isOpen(){return this.isState("open")}isActive(){return this.isState("open","connecting")}triedToReconnect(){return this.monitor.reconnectAttempts>0}isProtocolSupported(){return r.call(s,this.getProtocol())>=0}isState(...t){return r.call(t,this.getState())>=0}getState(){if(this.webSocket)for(let e in t.WebSocket)if(t.WebSocket[e]===this.webSocket.readyState)return e.toLowerCase();return null}installEventHandlers(){for(let t in this.events){const e=this.events[t].bind(this);this.webSocket[`on${t}`]=e}}uninstallEventHandlers(){for(let t in this.events)this.webSocket[`on${t}`]=function(){}}}Connection.reopenDelay=500;Connection.prototype.events={message(t){if(!this.isProtocolSupported())return;const{identifier:n,message:o,reason:s,reconnect:r,type:c}=JSON.parse(t.data);this.monitor.recordMessage();switch(c){case i.welcome:this.triedToReconnect()&&(this.reconnectAttempted=true);this.monitor.recordConnect();return this.subscriptions.reload();case i.disconnect:e.log(`Disconnecting. Reason: ${s}`);return this.close({allowReconnect:r});case i.ping:return null;case i.confirmation:this.subscriptions.confirmSubscription(n);if(this.reconnectAttempted){this.reconnectAttempted=false;return this.subscriptions.notify(n,"connected",{reconnected:true})}return this.subscriptions.notify(n,"connected",{reconnected:false});case i.rejection:return this.subscriptions.reject(n);default:return this.subscriptions.notify(n,"received",o)}},open(){e.log(`WebSocket onopen event, using '${this.getProtocol()}' subprotocol`);this.disconnected=false;if(!this.isProtocolSupported()){e.log("Protocol is unsupported. Stopping monitor and disconnecting.");return this.close({allowReconnect:false})}},close(t){e.log("WebSocket onclose event");if(!this.disconnected){this.disconnected=true;this.monitor.recordDisconnect();return this.subscriptions.notifyAll("disconnected",{willAttemptReconnect:this.monitor.isRunning()})}},error(){e.log("WebSocket onerror event")}};const extend=function(t,e){if(e!=null)for(let n in e){const i=e[n];t[n]=i}return t};class Subscription{constructor(t,e={},n){this.consumer=t;this.identifier=JSON.stringify(e);extend(this,n)}perform(t,e={}){e.action=t;return this.send(e)}send(t){return this.consumer.send({command:"message",identifier:this.identifier,data:JSON.stringify(t)})}unsubscribe(){return this.consumer.subscriptions.remove(this)}}class SubscriptionGuarantor{constructor(t){this.subscriptions=t;this.pendingSubscriptions=[]}guarantee(t){if(this.pendingSubscriptions.indexOf(t)==-1){e.log(`SubscriptionGuarantor guaranteeing ${t.identifier}`);this.pendingSubscriptions.push(t)}else e.log(`SubscriptionGuarantor already guaranteeing ${t.identifier}`);this.startGuaranteeing()}forget(t){e.log(`SubscriptionGuarantor forgetting ${t.identifier}`);this.pendingSubscriptions=this.pendingSubscriptions.filter((e=>e!==t))}startGuaranteeing(){this.stopGuaranteeing();this.retrySubscribing()}stopGuaranteeing(){clearTimeout(this.retryTimeout)}retrySubscribing(){this.retryTimeout=setTimeout((()=>{this.subscriptions&&typeof this.subscriptions.subscribe==="function"&&this.pendingSubscriptions.map((t=>{e.log(`SubscriptionGuarantor resubscribing ${t.identifier}`);this.subscriptions.subscribe(t)}))}),500)}}class Subscriptions{constructor(t){this.consumer=t;this.guarantor=new SubscriptionGuarantor(this);this.subscriptions=[]}create(t,e){const n=t;const i=typeof n==="object"?n:{channel:n};const o=new Subscription(this.consumer,i,e);return this.add(o)}add(t){this.subscriptions.push(t);this.consumer.ensureActiveConnection();this.notify(t,"initialized");this.subscribe(t);return t}remove(t){this.forget(t);this.findAll(t.identifier).length||this.sendCommand(t,"unsubscribe");return t}reject(t){return this.findAll(t).map((t=>{this.forget(t);this.notify(t,"rejected");return t}))}forget(t){this.guarantor.forget(t);this.subscriptions=this.subscriptions.filter((e=>e!==t));return t}findAll(t){return this.subscriptions.filter((e=>e.identifier===t))}reload(){return this.subscriptions.map((t=>this.subscribe(t)))}notifyAll(t,...e){return this.subscriptions.map((n=>this.notify(n,t,...e)))}notify(t,e,...n){let i;i=typeof t==="string"?this.findAll(t):[t];return i.map((t=>typeof t[e]==="function"?t[e](...n):void 0))}subscribe(t){this.sendCommand(t,"subscribe")&&this.guarantor.guarantee(t)}confirmSubscription(t){e.log(`Subscription confirmed ${t}`);this.findAll(t).map((t=>this.guarantor.forget(t)))}sendCommand(t,e){const{identifier:n}=t;return this.consumer.send({command:e,identifier:n})}}class Consumer{constructor(t){this._url=t;this.subscriptions=new Subscriptions(this);this.connection=new Connection(this);this.subprotocols=[]}get url(){return createWebSocketURL(this._url)}send(t){return this.connection.send(t)}connect(){return this.connection.open()}disconnect(){return this.connection.close({allowReconnect:false})}ensureActiveConnection(){if(!this.connection.isActive())return this.connection.open()}addSubProtocol(t){this.subprotocols=[...this.subprotocols,t]}}function createWebSocketURL(t){typeof t==="function"&&(t=t());if(t&&!/^wss?:/i.test(t)){const e=document.createElement("a");e.href=t;e.href=e.href;e.protocol=e.protocol.replace("http","ws");return e.href}return t}function createConsumer(t=getConfig("url")||n.default_mount_path){return new Consumer(t)}function getConfig(t){const e=document.head.querySelector(`meta[name='action-cable-${t}']`);if(e)return e.getAttribute("content")}export{Connection,ConnectionMonitor,Consumer,n as INTERNAL,Subscription,SubscriptionGuarantor,Subscriptions,t as adapters,createConsumer,createWebSocketURL,getConfig,e as logger};
4
+
@@ -0,0 +1,4 @@
1
+ // @rails/request.js@0.0.12 downloaded from https://ga.jspm.io/npm:@rails/request.js@0.0.12/src/index.js
2
+
3
+ class FetchResponse{constructor(t){this.response=t}get statusCode(){return this.response.status}get redirected(){return this.response.redirected}get ok(){return this.response.ok}get unauthenticated(){return this.statusCode===401}get unprocessableEntity(){return this.statusCode===422}get authenticationURL(){return this.response.headers.get("WWW-Authenticate")}get contentType(){const t=this.response.headers.get("Content-Type")||"";return t.replace(/;.*$/,"")}get headers(){return this.response.headers}get html(){return this.contentType.match(/^(application|text)\/(html|xhtml\+xml)$/)?this.text:Promise.reject(new Error(`Expected an HTML response but got "${this.contentType}" instead`))}get json(){return this.contentType.match(/^application\/.*json$/)?this.responseJson||(this.responseJson=this.response.json()):Promise.reject(new Error(`Expected a JSON response but got "${this.contentType}" instead`))}get text(){return this.responseText||(this.responseText=this.response.text())}get isTurboStream(){return this.contentType.match(/^text\/vnd\.turbo-stream\.html/)}get isScript(){return this.contentType.match(/\b(?:java|ecma)script\b/)}async renderTurboStream(){if(!this.isTurboStream)return Promise.reject(new Error(`Expected a Turbo Stream response but got "${this.contentType}" instead`));window.Turbo?await window.Turbo.renderStreamMessage(await this.text):console.warn("You must set `window.Turbo = Turbo` to automatically process Turbo Stream events with request.js")}async activeScript(){if(!this.isScript)return Promise.reject(new Error(`Expected a Script response but got "${this.contentType}" instead`));{const t=document.createElement("script");const e=document.querySelector("meta[name=csp-nonce]");if(e){const n=e.nonce===""?e.content:e.nonce;n&&t.setAttribute("nonce",n)}t.innerHTML=await this.text;document.body.appendChild(t)}}}class RequestInterceptor{static register(t){this.interceptor=t}static get(){return this.interceptor}static reset(){this.interceptor=void 0}}function t(t){const e=document.cookie?document.cookie.split("; "):[];const n=`${encodeURIComponent(t)}=`;const s=e.find((t=>t.startsWith(n)));if(s){const t=s.split("=").slice(1).join("=");if(t)return decodeURIComponent(t)}}function e(t){const e={};for(const n in t){const s=t[n];s!==void 0&&(e[n]=s)}return e}function n(t){const e=document.head.querySelector(`meta[name="${t}"]`);return e&&e.content}function s(t){return[...t].reduce(((t,[e,n])=>t.concat(typeof n==="string"?[[e,n]]:[])),[])}function r(t,e){for(const[n,s]of e)if(!(s instanceof window.File))if(t.has(n)&&!n.includes("[]")){t.delete(n);t.set(n,s)}else t.append(n,s)}class FetchRequest{constructor(t,e,n={}){this.method=t;this.options=n;this.originalUrl=e.toString()}async perform(){try{const t=RequestInterceptor.get();t&&await t(this)}catch(t){console.error(t)}const t=this.responseKind==="turbo-stream"&&window.Turbo?window.Turbo.fetch:window.fetch;const e=new FetchResponse(await t(this.url,this.fetchOptions));if(e.unauthenticated&&e.authenticationURL)return Promise.reject(window.location.href=e.authenticationURL);e.isScript&&await e.activeScript();const n=e.ok||e.unprocessableEntity;n&&e.isTurboStream&&await e.renderTurboStream();return e}addHeader(t,e){const n=this.additionalHeaders;n[t]=e;this.options.headers=n}sameHostname(){if(!this.originalUrl.startsWith("http:")&&!this.originalUrl.startsWith("https:"))return true;try{return new URL(this.originalUrl).hostname===window.location.hostname}catch(t){return true}}get fetchOptions(){return{method:this.method.toUpperCase(),headers:this.headers,body:this.formattedBody,signal:this.signal,credentials:this.credentials,redirect:this.redirect,keepalive:this.keepalive}}get headers(){const t={"X-Requested-With":"XMLHttpRequest","Content-Type":this.contentType,Accept:this.accept};this.sameHostname()&&(t["X-CSRF-Token"]=this.csrfToken);return e(Object.assign(t,this.additionalHeaders))}get csrfToken(){return t(n("csrf-param"))||n("csrf-token")}get contentType(){return this.options.contentType?this.options.contentType:this.body==null||this.body instanceof window.FormData?void 0:this.body instanceof window.File?this.body.type:"application/json"}get accept(){switch(this.responseKind){case"html":return"text/html, application/xhtml+xml";case"turbo-stream":return"text/vnd.turbo-stream.html, text/html, application/xhtml+xml";case"json":return"application/json, application/vnd.api+json";case"script":return"text/javascript, application/javascript";default:return"*/*"}}get body(){return this.options.body}get query(){const t=(this.originalUrl.split("?")[1]||"").split("#")[0];const e=new URLSearchParams(t);let n=this.options.query;n=n instanceof window.FormData?s(n):n instanceof window.URLSearchParams?n.entries():Object.entries(n||{});r(e,n);const o=e.toString();return o.length>0?`?${o}`:""}get url(){return this.originalUrl.split("?")[0].split("#")[0]+this.query}get responseKind(){return this.options.responseKind||"html"}get signal(){return this.options.signal}get redirect(){return this.options.redirect||"follow"}get credentials(){return this.options.credentials||"same-origin"}get keepalive(){return this.options.keepalive||false}get additionalHeaders(){return this.options.headers||{}}get formattedBody(){const t=Object.prototype.toString.call(this.body)==="[object String]";const e=this.headers["Content-Type"]==="application/json";return e&&!t?JSON.stringify(this.body):this.body}}async function o(t,e){const n=new FetchRequest("get",t,e);return n.perform()}async function i(t,e){const n=new FetchRequest("post",t,e);return n.perform()}async function c(t,e){const n=new FetchRequest("put",t,e);return n.perform()}async function a(t,e){const n=new FetchRequest("patch",t,e);return n.perform()}async function h(t,e){const n=new FetchRequest("delete",t,e);return n.perform()}export{FetchRequest,FetchResponse,RequestInterceptor,h as destroy,o as get,a as patch,i as post,c as put};
4
+
@@ -0,0 +1,4 @@
1
+ // @shopify/draggable@1.1.4 downloaded from https://ga.jspm.io/npm:@shopify/draggable@1.1.4/build/esm/index.mjs
2
+
3
+ class AbstractEvent{constructor(t){this._canceled=false;this.data=t}get type(){return this.constructor.type}get cancelable(){return this.constructor.cancelable}cancel(){this._canceled=true}canceled(){return this._canceled}clone(t){return new this.constructor({...this.data,...t})}}AbstractEvent.type="event";AbstractEvent.cancelable=false;class AbstractPlugin{constructor(t){this.draggable=t}attach(){throw new Error("Not Implemented")}detach(){throw new Error("Not Implemented")}}const t={mouse:0,drag:0,touch:100};class Sensor{constructor(t=[],e={}){this.containers=[...t];this.options={...e};this.dragging=false;this.currentContainer=null;this.originalSource=null;this.startEvent=null;this.delay=calcDelay(e.delay)}attach(){return this}detach(){return this}addContainer(...t){this.containers=[...this.containers,...t]}removeContainer(...t){this.containers=this.containers.filter((e=>!t.includes(e)))}trigger(t,e){const n=document.createEvent("Event");n.detail=e;n.initEvent(e.type,true,true);t.dispatchEvent(n);this.lastEvent=e;return e}}function calcDelay(e){const n={};if(e===void 0)return{...t};if(typeof e==="number"){for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(n[r]=e);return n}for(const r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]===void 0?n[r]=t[r]:n[r]=e[r]);return n}function closest(t,e){if(t==null)return null;function conditionFn(t){return t!=null&&e!=null&&(isSelector(e)?Element.prototype.matches.call(t,e):isNodeList(e)?[...e].includes(t):isElement(e)?e===t:!!isFunction(e)&&e(t))}let n=t;do{n=n.correspondingUseElement||n.correspondingElement||n;if(conditionFn(n))return n;n=n?.parentNode||null}while(n!=null&&n!==document.body&&n!==document);return null}function isSelector(t){return Boolean(typeof t==="string")}function isNodeList(t){return Boolean(t instanceof NodeList||t instanceof Array)}function isElement(t){return Boolean(t instanceof Node)}function isFunction(t){return Boolean(typeof t==="function")}function distance(t,e,n,r){return Math.sqrt((n-t)**2+(r-e)**2)}class SensorEvent extends AbstractEvent{get originalEvent(){return this.data.originalEvent}get clientX(){return this.data.clientX}get clientY(){return this.data.clientY}get target(){return this.data.target}get container(){return this.data.container}get originalSource(){return this.data.originalSource}get pressure(){return this.data.pressure}}class DragStartSensorEvent extends SensorEvent{}DragStartSensorEvent.type="drag:start";class DragMoveSensorEvent extends SensorEvent{}DragMoveSensorEvent.type="drag:move";class DragStopSensorEvent extends SensorEvent{}DragStopSensorEvent.type="drag:stop";class DragPressureSensorEvent extends SensorEvent{}DragPressureSensorEvent.type="drag:pressure";const e=Symbol("onContextMenuWhileDragging");const n=Symbol("onMouseDown");const r=Symbol("onMouseMove");const s=Symbol("onMouseUp");const o=Symbol("startDrag");const i=Symbol("onDistanceChange");class MouseSensor extends Sensor{constructor(t=[],a={}){super(t,a);this.mouseDownTimeout=null;this.pageX=null;this.pageY=null;this[e]=this[e].bind(this);this[n]=this[n].bind(this);this[r]=this[r].bind(this);this[s]=this[s].bind(this);this[o]=this[o].bind(this);this[i]=this[i].bind(this)}attach(){document.addEventListener("mousedown",this[n],true)}detach(){document.removeEventListener("mousedown",this[n],true)}[n](t){if(t.button!==0||t.ctrlKey||t.metaKey)return;const e=closest(t.target,this.containers);if(!e)return;if(this.options.handle&&t.target&&!closest(t.target,this.options.handle))return;const n=closest(t.target,this.options.draggable);if(!n)return;const{delay:r}=this;const{pageX:o,pageY:a}=t;Object.assign(this,{pageX:o,pageY:a});this.onMouseDownAt=Date.now();this.startEvent=t;this.currentContainer=e;this.originalSource=n;document.addEventListener("mouseup",this[s]);document.addEventListener("dragstart",preventNativeDragStart);document.addEventListener("mousemove",this[i]);this.mouseDownTimeout=window.setTimeout((()=>{this[i]({pageX:this.pageX,pageY:this.pageY})}),r.mouse)}[o](){const t=this.startEvent;const n=this.currentContainer;const s=this.originalSource;const o=new DragStartSensorEvent({clientX:t.clientX,clientY:t.clientY,target:t.target,container:n,originalSource:s,originalEvent:t});this.trigger(this.currentContainer,o);this.dragging=!o.canceled();if(this.dragging){document.addEventListener("contextmenu",this[e],true);document.addEventListener("mousemove",this[r])}}[i](t){const{pageX:e,pageY:n}=t;const{distance:r}=this.options;const{startEvent:s,delay:a}=this;Object.assign(this,{pageX:e,pageY:n});if(!this.currentContainer)return;const l=Date.now()-this.onMouseDownAt;const c=distance(s.pageX,s.pageY,e,n)||0;clearTimeout(this.mouseDownTimeout);if(l<a.mouse)document.removeEventListener("mousemove",this[i]);else if(c>=r){document.removeEventListener("mousemove",this[i]);this[o]()}}[r](t){if(!this.dragging)return;const e=document.elementFromPoint(t.clientX,t.clientY);const n=new DragMoveSensorEvent({clientX:t.clientX,clientY:t.clientY,target:e,container:this.currentContainer,originalEvent:t});this.trigger(this.currentContainer,n)}[s](t){clearTimeout(this.mouseDownTimeout);if(t.button!==0)return;document.removeEventListener("mouseup",this[s]);document.removeEventListener("dragstart",preventNativeDragStart);document.removeEventListener("mousemove",this[i]);if(!this.dragging)return;const n=document.elementFromPoint(t.clientX,t.clientY);const o=new DragStopSensorEvent({clientX:t.clientX,clientY:t.clientY,target:n,container:this.currentContainer,originalEvent:t});this.trigger(this.currentContainer,o);document.removeEventListener("contextmenu",this[e],true);document.removeEventListener("mousemove",this[r]);this.currentContainer=null;this.dragging=false;this.startEvent=null}[e](t){t.preventDefault()}}function preventNativeDragStart(t){t.preventDefault()}function touchCoords(t){const{touches:e,changedTouches:n}=t;return e&&e[0]||n&&n[0]}const a=Symbol("onTouchStart");const l=Symbol("onTouchEnd");const c=Symbol("onTouchMove");const d=Symbol("startDrag");const h=Symbol("onDistanceChange");let u=false;window.addEventListener("touchmove",(t=>{u&&t.preventDefault()}),{passive:false});class TouchSensor extends Sensor{constructor(t=[],e={}){super(t,e);this.currentScrollableParent=null;this.tapTimeout=null;this.touchMoved=false;this.pageX=null;this.pageY=null;this[a]=this[a].bind(this);this[l]=this[l].bind(this);this[c]=this[c].bind(this);this[d]=this[d].bind(this);this[h]=this[h].bind(this)}attach(){document.addEventListener("touchstart",this[a])}detach(){document.removeEventListener("touchstart",this[a])}[a](t){const e=closest(t.target,this.containers);if(!e)return;if(this.options.handle&&t.target&&!closest(t.target,this.options.handle))return;const n=closest(t.target,this.options.draggable);if(!n)return;const{distance:r=0}=this.options;const{delay:s}=this;const{pageX:o,pageY:i}=touchCoords(t);Object.assign(this,{pageX:o,pageY:i});this.onTouchStartAt=Date.now();this.startEvent=t;this.currentContainer=e;this.originalSource=n;document.addEventListener("touchend",this[l]);document.addEventListener("touchcancel",this[l]);document.addEventListener("touchmove",this[h]);e.addEventListener("contextmenu",onContextMenu);r&&(u=true);this.tapTimeout=window.setTimeout((()=>{this[h]({touches:[{pageX:this.pageX,pageY:this.pageY}]})}),s.touch)}[d](){const t=this.startEvent;const e=this.currentContainer;const n=touchCoords(t);const r=this.originalSource;const s=new DragStartSensorEvent({clientX:n.pageX,clientY:n.pageY,target:t.target,container:e,originalSource:r,originalEvent:t});this.trigger(this.currentContainer,s);this.dragging=!s.canceled();this.dragging&&document.addEventListener("touchmove",this[c]);u=this.dragging}[h](t){const{distance:e}=this.options;const{startEvent:n,delay:r}=this;const s=touchCoords(n);const o=touchCoords(t);const i=Date.now()-this.onTouchStartAt;const a=distance(s.pageX,s.pageY,o.pageX,o.pageY);Object.assign(this,o);clearTimeout(this.tapTimeout);if(i<r.touch)document.removeEventListener("touchmove",this[h]);else if(a>=e){document.removeEventListener("touchmove",this[h]);this[d]()}}[c](t){if(!this.dragging)return;const{pageX:e,pageY:n}=touchCoords(t);const r=document.elementFromPoint(e-window.scrollX,n-window.scrollY);const s=new DragMoveSensorEvent({clientX:e,clientY:n,target:r,container:this.currentContainer,originalEvent:t});this.trigger(this.currentContainer,s)}[l](t){clearTimeout(this.tapTimeout);u=false;document.removeEventListener("touchend",this[l]);document.removeEventListener("touchcancel",this[l]);document.removeEventListener("touchmove",this[h]);this.currentContainer&&this.currentContainer.removeEventListener("contextmenu",onContextMenu);if(!this.dragging)return;document.removeEventListener("touchmove",this[c]);const{pageX:e,pageY:n}=touchCoords(t);const r=document.elementFromPoint(e-window.scrollX,n-window.scrollY);t.preventDefault();const s=new DragStopSensorEvent({clientX:e,clientY:n,target:r,container:this.currentContainer,originalEvent:t});this.trigger(this.currentContainer,s);this.currentContainer=null;this.dragging=false;this.startEvent=null}}function onContextMenu(t){t.preventDefault();t.stopPropagation()}const g=Symbol("onMouseDown");const p=Symbol("onMouseUp");const m=Symbol("onDragStart");const v=Symbol("onDragOver");const f=Symbol("onDragEnd");const b=Symbol("onDrop");const E=Symbol("reset");class DragSensor extends Sensor{constructor(t=[],e={}){super(t,e);this.mouseDownTimeout=null;this.draggableElement=null;this.nativeDraggableElement=null;this[g]=this[g].bind(this);this[p]=this[p].bind(this);this[m]=this[m].bind(this);this[v]=this[v].bind(this);this[f]=this[f].bind(this);this[b]=this[b].bind(this)}attach(){document.addEventListener("mousedown",this[g],true)}detach(){document.removeEventListener("mousedown",this[g],true)}[m](t){t.dataTransfer.setData("text","");t.dataTransfer.effectAllowed=this.options.type;const e=document.elementFromPoint(t.clientX,t.clientY);const n=this.draggableElement;if(!n)return;const r=new DragStartSensorEvent({clientX:t.clientX,clientY:t.clientY,target:e,originalSource:n,container:this.currentContainer,originalEvent:t});setTimeout((()=>{this.trigger(this.currentContainer,r);r.canceled()?this.dragging=false:this.dragging=true}),0)}[v](t){if(!this.dragging)return;const e=document.elementFromPoint(t.clientX,t.clientY);const n=this.currentContainer;const r=new DragMoveSensorEvent({clientX:t.clientX,clientY:t.clientY,target:e,container:n,originalEvent:t});this.trigger(n,r);if(!r.canceled()){t.preventDefault();t.dataTransfer.dropEffect=this.options.type}}[f](t){if(!this.dragging)return;document.removeEventListener("mouseup",this[p],true);const e=document.elementFromPoint(t.clientX,t.clientY);const n=this.currentContainer;const r=new DragStopSensorEvent({clientX:t.clientX,clientY:t.clientY,target:e,container:n,originalEvent:t});this.trigger(n,r);this.dragging=false;this.startEvent=null;this[E]()}[b](t){t.preventDefault()}[g](t){if(t.target&&(t.target.form||t.target.contenteditable))return;const e=t.target;this.currentContainer=closest(e,this.containers);if(!this.currentContainer)return;if(this.options.handle&&e&&!closest(e,this.options.handle))return;const n=closest(e,this.options.draggable);if(!n)return;const r=closest(t.target,(t=>t.draggable));if(r){r.draggable=false;this.nativeDraggableElement=r}document.addEventListener("mouseup",this[p],true);document.addEventListener("dragstart",this[m],false);document.addEventListener("dragover",this[v],false);document.addEventListener("dragend",this[f],false);document.addEventListener("drop",this[b],false);this.startEvent=t;this.mouseDownTimeout=setTimeout((()=>{n.draggable=true;this.draggableElement=n}),this.delay.drag)}[p](){this[E]()}[E](){clearTimeout(this.mouseDownTimeout);document.removeEventListener("mouseup",this[p],true);document.removeEventListener("dragstart",this[m],false);document.removeEventListener("dragover",this[v],false);document.removeEventListener("dragend",this[f],false);document.removeEventListener("drop",this[b],false);if(this.nativeDraggableElement){this.nativeDraggableElement.draggable=true;this.nativeDraggableElement=null}if(this.draggableElement){this.draggableElement.draggable=false;this.draggableElement=null}}}const S=Symbol("onMouseForceWillBegin");const y=Symbol("onMouseForceDown");const C=Symbol("onMouseDown");const D=Symbol("onMouseForceChange");const w=Symbol("onMouseMove");const x=Symbol("onMouseUp");const M=Symbol("onMouseForceGlobalChange");class ForceTouchSensor extends Sensor{constructor(t=[],e={}){super(t,e);this.mightDrag=false;this[S]=this[S].bind(this);this[y]=this[y].bind(this);this[C]=this[C].bind(this);this[D]=this[D].bind(this);this[w]=this[w].bind(this);this[x]=this[x].bind(this)}attach(){for(const t of this.containers){t.addEventListener("webkitmouseforcewillbegin",this[S],false);t.addEventListener("webkitmouseforcedown",this[y],false);t.addEventListener("mousedown",this[C],true);t.addEventListener("webkitmouseforcechanged",this[D],false)}document.addEventListener("mousemove",this[w]);document.addEventListener("mouseup",this[x])}detach(){for(const t of this.containers){t.removeEventListener("webkitmouseforcewillbegin",this[S],false);t.removeEventListener("webkitmouseforcedown",this[y],false);t.removeEventListener("mousedown",this[C],true);t.removeEventListener("webkitmouseforcechanged",this[D],false)}document.removeEventListener("mousemove",this[w]);document.removeEventListener("mouseup",this[x])}[S](t){t.preventDefault();this.mightDrag=true}[y](t){if(this.dragging)return;const e=document.elementFromPoint(t.clientX,t.clientY);const n=t.currentTarget;if(this.options.handle&&e&&!closest(e,this.options.handle))return;const r=closest(e,this.options.draggable);if(!r)return;const s=new DragStartSensorEvent({clientX:t.clientX,clientY:t.clientY,target:e,container:n,originalSource:r,originalEvent:t});this.trigger(n,s);this.currentContainer=n;this.dragging=!s.canceled();this.mightDrag=false}[x](t){if(!this.dragging)return;const e=new DragStopSensorEvent({clientX:t.clientX,clientY:t.clientY,target:null,container:this.currentContainer,originalEvent:t});this.trigger(this.currentContainer,e);this.currentContainer=null;this.dragging=false;this.mightDrag=false}[C](t){if(this.mightDrag){t.stopPropagation();t.stopImmediatePropagation();t.preventDefault()}}[w](t){if(!this.dragging)return;const e=document.elementFromPoint(t.clientX,t.clientY);const n=new DragMoveSensorEvent({clientX:t.clientX,clientY:t.clientY,target:e,container:this.currentContainer,originalEvent:t});this.trigger(this.currentContainer,n)}[D](t){if(this.dragging)return;const e=t.target;const n=t.currentTarget;const r=new DragPressureSensorEvent({pressure:t.webkitForce,clientX:t.clientX,clientY:t.clientY,target:e,container:n,originalEvent:t});this.trigger(n,r)}[M](t){if(!this.dragging)return;const e=t.target;const n=new DragPressureSensorEvent({pressure:t.webkitForce,clientX:t.clientX,clientY:t.clientY,target:e,container:this.currentContainer,originalEvent:t});this.trigger(this.currentContainer,n)}}var O=Object.freeze(Object.defineProperty({__proto__:null,DragMoveSensorEvent:DragMoveSensorEvent,DragPressureSensorEvent:DragPressureSensorEvent,DragSensor:DragSensor,DragStartSensorEvent:DragStartSensorEvent,DragStopSensorEvent:DragStopSensorEvent,ForceTouchSensor:ForceTouchSensor,MouseSensor:MouseSensor,Sensor:Sensor,SensorEvent:SensorEvent,TouchSensor:TouchSensor},Symbol.toStringTag,{value:"Module"}));class CollidableEvent extends AbstractEvent{constructor(t){super(t);this.data=t}get dragEvent(){return this.data.dragEvent}}CollidableEvent.type="collidable";class CollidableInEvent extends CollidableEvent{get collidingElement(){return this.data.collidingElement}}CollidableInEvent.type="collidable:in";class CollidableOutEvent extends CollidableEvent{get collidingElement(){return this.data.collidingElement}}CollidableOutEvent.type="collidable:out";const A=Symbol("onDragMove");const L=Symbol("onDragStop");const F=Symbol("onRequestAnimationFrame");class Collidable extends AbstractPlugin{constructor(t){super(t);this.currentlyCollidingElement=null;this.lastCollidingElement=null;this.currentAnimationFrame=null;this[A]=this[A].bind(this);this[L]=this[L].bind(this);this[F]=this[F].bind(this)}attach(){this.draggable.on("drag:move",this[A]).on("drag:stop",this[L])}detach(){this.draggable.off("drag:move",this[A]).off("drag:stop",this[L])}getCollidables(){const t=this.draggable.options.collidables;return typeof t==="string"?Array.prototype.slice.call(document.querySelectorAll(t)):t instanceof NodeList||t instanceof Array?Array.prototype.slice.call(t):t instanceof HTMLElement?[t]:typeof t==="function"?t():[]}[A](t){const e=t.sensorEvent.target;this.currentAnimationFrame=requestAnimationFrame(this[F](e));this.currentlyCollidingElement&&t.cancel();const n=new CollidableInEvent({dragEvent:t,collidingElement:this.currentlyCollidingElement});const r=new CollidableOutEvent({dragEvent:t,collidingElement:this.lastCollidingElement});const s=Boolean(this.currentlyCollidingElement&&this.lastCollidingElement!==this.currentlyCollidingElement);const o=Boolean(!this.currentlyCollidingElement&&this.lastCollidingElement);if(s){this.lastCollidingElement&&this.draggable.trigger(r);this.draggable.trigger(n)}else o&&this.draggable.trigger(r);this.lastCollidingElement=this.currentlyCollidingElement}[L](t){const e=this.currentlyCollidingElement||this.lastCollidingElement;const n=new CollidableOutEvent({dragEvent:t,collidingElement:e});e&&this.draggable.trigger(n);this.lastCollidingElement=null;this.currentlyCollidingElement=null}[F](t){return()=>{const e=this.getCollidables();this.currentlyCollidingElement=closest(t,(t=>e.includes(t)))}}}function createAddInitializerMethod(t,e){return function(n){assertNotFinished(e,"addInitializer"),assertCallable(n,"An initializer"),t.push(n)}}function assertInstanceIfPrivate(t,e){if(!t(e))throw new TypeError("Attempted to access private element on non-instance")}function memberDec(t,e,n,r,s,o,i,a,l,c,d){var h;switch(o){case 1:h="accessor";break;case 2:h="method";break;case 3:h="getter";break;case 4:h="setter";break;default:h="field"}var u,g,p={kind:h,name:a?"#"+n:n,static:i,private:a,metadata:d},m={v:!1};if(0!==o&&(p.addInitializer=createAddInitializerMethod(s,m)),a||0!==o&&2!==o)if(2===o)u=function(t){return assertInstanceIfPrivate(c,t),r.value};else{var v=0===o||1===o;(v||3===o)&&(u=a?function(t){return assertInstanceIfPrivate(c,t),r.get.call(t)}:function(t){return r.get.call(t)}),(v||4===o)&&(g=a?function(t,e){assertInstanceIfPrivate(c,t),r.set.call(t,e)}:function(t,e){r.set.call(t,e)})}else u=function(t){return t[n]},0===o&&(g=function(t,e){t[n]=e});var f=a?c.bind():function(t){return n in t};p.access=u&&g?{get:u,set:g,has:f}:u?{get:u,has:f}:{set:g,has:f};try{return t.call(e,l,p)}finally{m.v=!0}}function assertNotFinished(t,e){if(t.v)throw new Error("attempted to call "+e+" after decoration was finished")}function assertCallable(t,e){if("function"!=typeof t)throw new TypeError(e+" must be a function")}function assertValidReturnValue(t,e){var n=typeof e;if(1===t){if("object"!==n||null===e)throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");void 0!==e.get&&assertCallable(e.get,"accessor.get"),void 0!==e.set&&assertCallable(e.set,"accessor.set"),void 0!==e.init&&assertCallable(e.init,"accessor.init")}else if("function"!==n){var r;throw r=0===t?"field":5===t?"class":"method",new TypeError(r+" decorators must return a function or void 0")}}function curryThis1(t){return function(){return t(this)}}function curryThis2(t){return function(e){t(this,e)}}function applyMemberDec(t,e,n,r,s,o,i,a,l,c,d){var h,u,g,p,m,v,f=n[0];r||Array.isArray(f)||(f=[f]),a?h=0===o||1===o?{get:curryThis1(n[3]),set:curryThis2(n[4])}:3===o?{get:n[3]}:4===o?{set:n[3]}:{value:n[3]}:0!==o&&(h=Object.getOwnPropertyDescriptor(e,s)),1===o?g={get:h.get,set:h.set}:2===o?g=h.value:3===o?g=h.get:4===o&&(g=h.set);for(var b=r?2:1,E=f.length-1;E>=0;E-=b){var S;void 0!==(p=memberDec(f[E],r?f[E-1]:void 0,s,h,l,o,i,a,g,c,d))&&(assertValidReturnValue(o,p),0===o?S=p:1===o?(S=p.init,m=p.get||g.get,v=p.set||g.set,g={get:m,set:v}):g=p,void 0!==S&&(void 0===u?u=S:"function"==typeof u?u=[u,S]:u.push(S)))}if(0===o||1===o){if(void 0===u)u=function(t,e){return e};else if("function"!=typeof u){var y=u;u=function(t,e){for(var n=e,r=y.length-1;r>=0;r--)n=y[r].call(t,n);return n}}else{var C=u;u=function(t,e){return C.call(t,e)}}t.push(u)}0!==o&&(1===o?(h.get=g.get,h.set=g.set):2===o?h.value=g:3===o?h.get=g:4===o&&(h.set=g),a?1===o?(t.push((function(t,e){return g.get.call(t,e)})),t.push((function(t,e){return g.set.call(t,e)}))):2===o?t.push(g):t.push((function(t,e){return g.call(t,e)})):Object.defineProperty(e,s,h))}function applyMemberDecs(t,e,n,r){for(var s,o,i,a=[],l=new Map,c=new Map,d=0;d<e.length;d++){var h=e[d];if(Array.isArray(h)){var u,g,p=h[1],m=h[2],v=h.length>3,f=16&p,b=!!(8&p),E=n;if(p&=7,b?(u=t,0!==p&&(g=o=o||[]),v&&!i&&(i=function(e){return _checkInRHS(e)===t}),E=i):(u=t.prototype,0!==p&&(g=s=s||[])),0!==p&&!v){var S=b?c:l,y=S.get(m)||0;if(!0===y||3===y&&4!==p||4===y&&3!==p)throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: "+m);S.set(m,!(!y&&p>2)||p)}applyMemberDec(a,u,h,f,m,p,b,v,g,E,r)}}return pushInitializers(a,s),pushInitializers(a,o),a}function pushInitializers(t,e){e&&t.push((function(t){for(var n=0;n<e.length;n++)e[n].call(t);return t}))}function applyClassDecs(t,e,n,r){if(e.length){for(var s=[],o=t,i=t.name,a=n?2:1,l=e.length-1;l>=0;l-=a){var c={v:!1};try{var d=e[l].call(n?e[l-1]:void 0,o,{kind:"class",name:i,addInitializer:createAddInitializerMethod(s,c),metadata:r})}finally{c.v=!0}void 0!==d&&(assertValidReturnValue(5,d),o=d)}return[defineMetadata(o,r),function(){for(var t=0;t<s.length;t++)s[t].call(o)}]}}function defineMetadata(t,e){return Object.defineProperty(t,Symbol.metadata||Symbol.for("Symbol.metadata"),{configurable:!0,enumerable:!0,value:e})}function _applyDecs2305(t,e,n,r,s,o){if(arguments.length>=6)var i=o[Symbol.metadata||Symbol.for("Symbol.metadata")];var a=Object.create(void 0===i?null:i),l=applyMemberDecs(t,e,s,a);return n.length||defineMetadata(t,a),{e:l,get c(){return applyClassDecs(t,n,r,a)}}}function _checkInRHS(t){if(Object(t)!==t)throw TypeError("right-hand side of 'in' should be an object, got "+(null!==t?typeof t:"null"));return t}function AutoBind(t,{name:e,addInitializer:n}){n((function(){this[e]=t.bind(this)}))}function requestNextAnimationFrame(t){return requestAnimationFrame((()=>{requestAnimationFrame(t)}))}class DragEvent extends AbstractEvent{constructor(t){super(t);this.data=t}get source(){return this.data.source}get originalSource(){return this.data.originalSource}get mirror(){return this.data.mirror}get sourceContainer(){return this.data.sourceContainer}get sensorEvent(){return this.data.sensorEvent}get originalEvent(){return this.sensorEvent?this.sensorEvent.originalEvent:null}}DragEvent.type="drag";class DragStartEvent extends DragEvent{}DragStartEvent.type="drag:start";DragStartEvent.cancelable=true;class DragMoveEvent extends DragEvent{}DragMoveEvent.type="drag:move";class DragOverEvent extends DragEvent{get overContainer(){return this.data.overContainer}get over(){return this.data.over}}DragOverEvent.type="drag:over";DragOverEvent.cancelable=true;function isDragOverEvent(t){return t.type===DragOverEvent.type}class DragOutEvent extends DragEvent{get overContainer(){return this.data.overContainer}get over(){return this.data.over}}DragOutEvent.type="drag:out";class DragOverContainerEvent extends DragEvent{get overContainer(){return this.data.overContainer}}DragOverContainerEvent.type="drag:over:container";class DragOutContainerEvent extends DragEvent{get overContainer(){return this.data.overContainer}}DragOutContainerEvent.type="drag:out:container";class DragPressureEvent extends DragEvent{get pressure(){return this.data.pressure}}DragPressureEvent.type="drag:pressure";class DragStopEvent extends DragEvent{}DragStopEvent.type="drag:stop";DragStopEvent.cancelable=true;class DragStoppedEvent extends DragEvent{}DragStoppedEvent.type="drag:stopped";var T,X;const Y={};class ResizeMirror extends AbstractPlugin{constructor(t){T(super(t));this.lastWidth=0;this.lastHeight=0;this.mirror=null}attach(){this.draggable.on("mirror:created",this.onMirrorCreated).on("drag:over",this.onDragOver).on("drag:over:container",this.onDragOver)}detach(){this.draggable.off("mirror:created",this.onMirrorCreated).off("mirror:destroy",this.onMirrorDestroy).off("drag:over",this.onDragOver).off("drag:over:container",this.onDragOver)}getOptions(){return this.draggable.options.resizeMirror||{}}onMirrorCreated({mirror:t}){this.mirror=t}onMirrorDestroy(){this.mirror=null}onDragOver(t){this.resize(t)}resize(t){requestAnimationFrame((()=>{let e=null;const{overContainer:n}=t;if(this.mirror==null||this.mirror.parentNode==null)return;this.mirror.parentNode!==n&&n.appendChild(this.mirror);isDragOverEvent(t)&&(e=t.over);const r=e||this.draggable.getDraggableElementsForContainer(n)[0];r&&requestNextAnimationFrame((()=>{const t=r.getBoundingClientRect();if(this.mirror!=null&&(this.lastHeight!==t.height||this.lastWidth!==t.width)){this.mirror.style.width=`${t.width}px`;this.mirror.style.height=`${t.height}px`;this.lastWidth=t.width;this.lastHeight=t.height}}))}))}}X=ResizeMirror;[T]=_applyDecs2305(X,[[AutoBind,2,"onMirrorCreated"],[AutoBind,2,"onMirrorDestroy"],[AutoBind,2,"onDragOver"]],[],0,void 0,AbstractPlugin).e;class SnapEvent extends AbstractEvent{get dragEvent(){return this.data.dragEvent}get snappable(){return this.data.snappable}}SnapEvent.type="snap";class SnapInEvent extends SnapEvent{}SnapInEvent.type="snap:in";SnapInEvent.cancelable=true;class SnapOutEvent extends SnapEvent{}SnapOutEvent.type="snap:out";SnapOutEvent.cancelable=true;const P=Symbol("onDragStart");const N=Symbol("onDragStop");const z=Symbol("onDragOver");const I=Symbol("onDragOut");const $=Symbol("onMirrorCreated");const B=Symbol("onMirrorDestroy");class Snappable extends AbstractPlugin{constructor(t){super(t);this.firstSource=null;this.mirror=null;this[P]=this[P].bind(this);this[N]=this[N].bind(this);this[z]=this[z].bind(this);this[I]=this[I].bind(this);this[$]=this[$].bind(this);this[B]=this[B].bind(this)}attach(){this.draggable.on("drag:start",this[P]).on("drag:stop",this[N]).on("drag:over",this[z]).on("drag:out",this[I]).on("droppable:over",this[z]).on("droppable:out",this[I]).on("mirror:created",this[$]).on("mirror:destroy",this[B])}detach(){this.draggable.off("drag:start",this[P]).off("drag:stop",this[N]).off("drag:over",this[z]).off("drag:out",this[I]).off("droppable:over",this[z]).off("droppable:out",this[I]).off("mirror:created",this[$]).off("mirror:destroy",this[B])}[P](t){t.canceled()||(this.firstSource=t.source)}[N](){this.firstSource=null}[z](t){if(t.canceled())return;const e=t.source||t.dragEvent.source;if(e===this.firstSource){this.firstSource=null;return}const n=new SnapInEvent({dragEvent:t,snappable:t.over||t.droppable});this.draggable.trigger(n);if(!n.canceled()){this.mirror&&(this.mirror.style.display="none");e.classList.remove(...this.draggable.getClassNamesFor("source:dragging"));e.classList.add(...this.draggable.getClassNamesFor("source:placed"));setTimeout((()=>{e.classList.remove(...this.draggable.getClassNamesFor("source:placed"))}),this.draggable.options.placedTimeout)}}[I](t){if(t.canceled())return;const e=t.source||t.dragEvent.source;const n=new SnapOutEvent({dragEvent:t,snappable:t.over||t.droppable});this.draggable.trigger(n);if(!n.canceled()){this.mirror&&(this.mirror.style.display="");e.classList.add(...this.draggable.getClassNamesFor("source:dragging"))}}[$]({mirror:t}){this.mirror=t}[B](){this.mirror=null}}var k,R;const q={duration:150,easingFunction:"ease-in-out",horizontal:false};class SwapAnimation extends AbstractPlugin{constructor(t){k(super(t));this.options={...q,...this.getOptions()};this.lastAnimationFrame=null}attach(){this.draggable.on("sortable:sorted",this.onSortableSorted)}detach(){this.draggable.off("sortable:sorted",this.onSortableSorted)}getOptions(){return this.draggable.options.swapAnimation||{}}onSortableSorted({oldIndex:t,newIndex:e,dragEvent:n}){const{source:r,over:s}=n;this.lastAnimationFrame&&cancelAnimationFrame(this.lastAnimationFrame);this.lastAnimationFrame=requestAnimationFrame((()=>{t>=e?animate$1(r,s,this.options):animate$1(s,r,this.options)}))}}R=SwapAnimation;[k]=_applyDecs2305(R,[[AutoBind,2,"onSortableSorted"]],[],0,void 0,AbstractPlugin).e;function animate$1(t,e,{duration:n,easingFunction:r,horizontal:s}){for(const n of[t,e])n.style.pointerEvents="none";if(s){const n=t.offsetWidth;t.style.transform=`translate3d(${n}px, 0, 0)`;e.style.transform=`translate3d(-${n}px, 0, 0)`}else{const n=t.offsetHeight;t.style.transform=`translate3d(0, ${n}px, 0)`;e.style.transform=`translate3d(0, -${n}px, 0)`}requestAnimationFrame((()=>{for(const s of[t,e]){s.addEventListener("transitionend",resetElementOnTransitionEnd$1);s.style.transition=`transform ${n}ms ${r}`;s.style.transform=""}}))}function resetElementOnTransitionEnd$1(t){if(t.target!=null&&isHTMLElement(t.target)){t.target.style.transition="";t.target.style.pointerEvents="";t.target.removeEventListener("transitionend",resetElementOnTransitionEnd$1)}}function isHTMLElement(t){return Boolean("style"in t)}const _=Symbol("onSortableSorted");const j=Symbol("onSortableSort");const H={duration:150,easingFunction:"ease-in-out"};class SortAnimation extends AbstractPlugin{constructor(t){super(t);this.options={...H,...this.getOptions()};this.lastAnimationFrame=null;this.lastElements=[];this[_]=this[_].bind(this);this[j]=this[j].bind(this)}attach(){this.draggable.on("sortable:sort",this[j]);this.draggable.on("sortable:sorted",this[_])}detach(){this.draggable.off("sortable:sort",this[j]);this.draggable.off("sortable:sorted",this[_])}getOptions(){return this.draggable.options.sortAnimation||{}}[j]({dragEvent:t}){const{sourceContainer:e}=t;const n=this.draggable.getDraggableElementsForContainer(e);this.lastElements=Array.from(n).map((t=>({domEl:t,offsetTop:t.offsetTop,offsetLeft:t.offsetLeft})))}[_]({oldIndex:t,newIndex:e}){if(t===e)return;const n=[];let r;let s;let o;if(t>e){r=e;s=t-1;o=1}else{r=t+1;s=e;o=-1}for(let t=r;t<=s;t++){const e=this.lastElements[t];const r=this.lastElements[t+o];n.push({from:e,to:r})}cancelAnimationFrame(this.lastAnimationFrame);this.lastAnimationFrame=requestAnimationFrame((()=>{n.forEach((t=>animate(t,this.options)))}))}}function animate({from:t,to:e},{duration:n,easingFunction:r}){const s=t.domEl;const o=t.offsetLeft-e.offsetLeft;const i=t.offsetTop-e.offsetTop;s.style.pointerEvents="none";s.style.transform=`translate3d(${o}px, ${i}px, 0)`;requestAnimationFrame((()=>{s.addEventListener("transitionend",resetElementOnTransitionEnd);s.style.transition=`transform ${n}ms ${r}`;s.style.transform=""}))}function resetElementOnTransitionEnd(t){t.target.style.transition="";t.target.style.pointerEvents="";t.target.removeEventListener("transitionend",resetElementOnTransitionEnd)}var V=Object.freeze(Object.defineProperty({__proto__:null,Collidable:Collidable,ResizeMirror:ResizeMirror,Snappable:Snappable,SortAnimation:SortAnimation,SwapAnimation:SwapAnimation,defaultResizeMirrorOptions:Y,defaultSortAnimationOptions:H,defaultSwapAnimationOptions:q},Symbol.toStringTag,{value:"Module"}));const U=Symbol("onInitialize");const W=Symbol("onDestroy");const G=Symbol("announceEvent");const K=Symbol("announceMessage");const Z="aria-relevant";const J="aria-atomic";const Q="aria-live";const tt="role";const et={expire:7e3};class Announcement extends AbstractPlugin{constructor(t){super(t);this.options={...et,...this.getOptions()};this.originalTriggerMethod=this.draggable.trigger;this[U]=this[U].bind(this);this[W]=this[W].bind(this)}attach(){this.draggable.on("draggable:initialize",this[U])}detach(){this.draggable.off("draggable:destroy",this[W])}getOptions(){return this.draggable.options.announcements||{}}[G](t){const e=this.options[t.type];e&&typeof e==="string"&&this[K](e);e&&typeof e==="function"&&this[K](e(t))}[K](t){announce(t,{expire:this.options.expire})}[U](){this.draggable.trigger=t=>{try{this[G](t)}finally{this.originalTriggerMethod.call(this.draggable,t)}}}[W](){this.draggable.trigger=this.originalTriggerMethod}}const nt=createRegion();function announce(t,{expire:e}){const n=document.createElement("div");n.textContent=t;nt.appendChild(n);return setTimeout((()=>{nt.removeChild(n)}),e)}function createRegion(){const t=document.createElement("div");t.setAttribute("id","draggable-live-region");t.setAttribute(Z,"additions");t.setAttribute(J,"true");t.setAttribute(Q,"assertive");t.setAttribute(tt,"log");t.style.position="fixed";t.style.width="1px";t.style.height="1px";t.style.top="-1px";t.style.overflow="hidden";return t}document.addEventListener("DOMContentLoaded",(()=>{document.body.appendChild(nt)}));const rt=Symbol("onInitialize");const st=Symbol("onDestroy");const ot={};class Focusable extends AbstractPlugin{constructor(t){super(t);this.options={...ot,...this.getOptions()};this[rt]=this[rt].bind(this);this[st]=this[st].bind(this)}attach(){this.draggable.on("draggable:initialize",this[rt]).on("draggable:destroy",this[st])}detach(){this.draggable.off("draggable:initialize",this[rt]).off("draggable:destroy",this[st]);this[st]()}getOptions(){return this.draggable.options.focusable||{}}getElements(){return[...this.draggable.containers,...this.draggable.getDraggableElements()]}[rt](){requestAnimationFrame((()=>{this.getElements().forEach((t=>decorateElement(t)))}))}[st](){requestAnimationFrame((()=>{this.getElements().forEach((t=>stripElement(t)))}))}}const it=[];function decorateElement(t){const e=Boolean(!t.getAttribute("tabindex")&&t.tabIndex===-1);if(e){it.push(t);t.tabIndex=0}}function stripElement(t){const e=it.indexOf(t);if(e!==-1){t.tabIndex=-1;it.splice(e,1)}}class MirrorEvent extends AbstractEvent{constructor(t){super(t);this.data=t}get source(){return this.data.source}get originalSource(){return this.data.originalSource}get sourceContainer(){return this.data.sourceContainer}get sensorEvent(){return this.data.sensorEvent}get dragEvent(){return this.data.dragEvent}get originalEvent(){return this.sensorEvent?this.sensorEvent.originalEvent:null}}class MirrorCreateEvent extends MirrorEvent{}MirrorCreateEvent.type="mirror:create";class MirrorCreatedEvent extends MirrorEvent{get mirror(){return this.data.mirror}}MirrorCreatedEvent.type="mirror:created";class MirrorAttachedEvent extends MirrorEvent{get mirror(){return this.data.mirror}}MirrorAttachedEvent.type="mirror:attached";class MirrorMoveEvent extends MirrorEvent{get mirror(){return this.data.mirror}get passedThreshX(){return this.data.passedThreshX}get passedThreshY(){return this.data.passedThreshY}}MirrorMoveEvent.type="mirror:move";MirrorMoveEvent.cancelable=true;class MirrorMovedEvent extends MirrorEvent{get mirror(){return this.data.mirror}get passedThreshX(){return this.data.passedThreshX}get passedThreshY(){return this.data.passedThreshY}}MirrorMovedEvent.type="mirror:moved";class MirrorDestroyEvent extends MirrorEvent{get mirror(){return this.data.mirror}}MirrorDestroyEvent.type="mirror:destroy";MirrorDestroyEvent.cancelable=true;const at=Symbol("onDragStart");const lt=Symbol("onDragMove");const ct=Symbol("onDragStop");const dt=Symbol("onMirrorCreated");const ht=Symbol("onMirrorMove");const ut=Symbol("onScroll");const gt=Symbol("getAppendableContainer");const pt={constrainDimensions:false,xAxis:true,yAxis:true,cursorOffsetX:null,cursorOffsetY:null,thresholdX:null,thresholdY:null};class Mirror extends AbstractPlugin{constructor(t){super(t);this.options={...pt,...this.getOptions()};this.scrollOffset={x:0,y:0};this.initialScrollOffset={x:window.scrollX,y:window.scrollY};this[at]=this[at].bind(this);this[lt]=this[lt].bind(this);this[ct]=this[ct].bind(this);this[dt]=this[dt].bind(this);this[ht]=this[ht].bind(this);this[ut]=this[ut].bind(this)}attach(){this.draggable.on("drag:start",this[at]).on("drag:move",this[lt]).on("drag:stop",this[ct]).on("mirror:created",this[dt]).on("mirror:move",this[ht])}detach(){this.draggable.off("drag:start",this[at]).off("drag:move",this[lt]).off("drag:stop",this[ct]).off("mirror:created",this[dt]).off("mirror:move",this[ht])}getOptions(){return this.draggable.options.mirror||{}}[at](t){if(t.canceled())return;"ontouchstart"in window&&document.addEventListener("scroll",this[ut],true);this.initialScrollOffset={x:window.scrollX,y:window.scrollY};const{source:e,originalSource:n,sourceContainer:r,sensorEvent:s}=t;this.lastMirrorMovedClient={x:s.clientX,y:s.clientY};const o=new MirrorCreateEvent({source:e,originalSource:n,sourceContainer:r,sensorEvent:s,dragEvent:t});this.draggable.trigger(o);if(isNativeDragEvent(s)||o.canceled())return;const i=this[gt](e)||r;this.mirror=e.cloneNode(true);const a=new MirrorCreatedEvent({source:e,originalSource:n,sourceContainer:r,sensorEvent:s,dragEvent:t,mirror:this.mirror});const l=new MirrorAttachedEvent({source:e,originalSource:n,sourceContainer:r,sensorEvent:s,dragEvent:t,mirror:this.mirror});this.draggable.trigger(a);i.appendChild(this.mirror);this.draggable.trigger(l)}[lt](t){if(!this.mirror||t.canceled())return;const{source:e,originalSource:n,sourceContainer:r,sensorEvent:s}=t;let o=true;let i=true;if(this.options.thresholdX||this.options.thresholdY){const{x:t,y:e}=this.lastMirrorMovedClient;Math.abs(t-s.clientX)<this.options.thresholdX?o=false:this.lastMirrorMovedClient.x=s.clientX;Math.abs(e-s.clientY)<this.options.thresholdY?i=false:this.lastMirrorMovedClient.y=s.clientY;if(!o&&!i)return}const a=new MirrorMoveEvent({source:e,originalSource:n,sourceContainer:r,sensorEvent:s,dragEvent:t,mirror:this.mirror,passedThreshX:o,passedThreshY:i});this.draggable.trigger(a)}[ct](t){"ontouchstart"in window&&document.removeEventListener("scroll",this[ut],true);this.initialScrollOffset={x:0,y:0};this.scrollOffset={x:0,y:0};if(!this.mirror)return;const{source:e,sourceContainer:n,sensorEvent:r}=t;const s=new MirrorDestroyEvent({source:e,mirror:this.mirror,sourceContainer:n,sensorEvent:r,dragEvent:t});this.draggable.trigger(s);s.canceled()||this.mirror.remove()}[ut](){this.scrollOffset={x:window.scrollX-this.initialScrollOffset.x,y:window.scrollY-this.initialScrollOffset.y}}[dt]({mirror:t,source:e,sensorEvent:n}){const r=this.draggable.getClassNamesFor("mirror");const setState=({mirrorOffset:t,initialX:e,initialY:n,...r})=>{this.mirrorOffset=t;this.initialX=e;this.initialY=n;this.lastMovedX=e;this.lastMovedY=n;return{mirrorOffset:t,initialX:e,initialY:n,...r}};t.style.display="none";const s={mirror:t,source:e,sensorEvent:n,mirrorClasses:r,scrollOffset:this.scrollOffset,options:this.options,passedThreshX:true,passedThreshY:true};return Promise.resolve(s).then(computeMirrorDimensions).then(calculateMirrorOffset).then(resetMirror).then(addMirrorClasses).then(positionMirror({initial:true})).then(removeMirrorID).then(setState)}[ht](t){if(t.canceled())return null;const setState=({lastMovedX:t,lastMovedY:e,...n})=>{this.lastMovedX=t;this.lastMovedY=e;return{lastMovedX:t,lastMovedY:e,...n}};const triggerMoved=e=>{const n=new MirrorMovedEvent({source:t.source,originalSource:t.originalSource,sourceContainer:t.sourceContainer,sensorEvent:t.sensorEvent,dragEvent:t.dragEvent,mirror:this.mirror,passedThreshX:t.passedThreshX,passedThreshY:t.passedThreshY});this.draggable.trigger(n);return e};const e={mirror:t.mirror,sensorEvent:t.sensorEvent,mirrorOffset:this.mirrorOffset,options:this.options,initialX:this.initialX,initialY:this.initialY,scrollOffset:this.scrollOffset,passedThreshX:t.passedThreshX,passedThreshY:t.passedThreshY,lastMovedX:this.lastMovedX,lastMovedY:this.lastMovedY};return Promise.resolve(e).then(positionMirror({raf:true})).then(setState).then(triggerMoved)}[gt](t){const e=this.options.appendTo;return typeof e==="string"?document.querySelector(e):e instanceof HTMLElement?e:typeof e==="function"?e(t):t.parentNode}}function computeMirrorDimensions({source:t,...e}){return withPromise((n=>{const r=t.getBoundingClientRect();n({source:t,sourceRect:r,...e})}))}function calculateMirrorOffset({sensorEvent:t,sourceRect:e,options:n,...r}){return withPromise((s=>{const o=n.cursorOffsetY===null?t.clientY-e.top:n.cursorOffsetY;const i=n.cursorOffsetX===null?t.clientX-e.left:n.cursorOffsetX;const a={top:o,left:i};s({sensorEvent:t,sourceRect:e,mirrorOffset:a,options:n,...r})}))}function resetMirror({mirror:t,source:e,options:n,...r}){return withPromise((s=>{let o;let i;if(n.constrainDimensions){const t=getComputedStyle(e);o=t.getPropertyValue("height");i=t.getPropertyValue("width")}t.style.display=null;t.style.position="fixed";t.style.pointerEvents="none";t.style.top=0;t.style.left=0;t.style.margin=0;if(n.constrainDimensions){t.style.height=o;t.style.width=i}s({mirror:t,source:e,options:n,...r})}))}function addMirrorClasses({mirror:t,mirrorClasses:e,...n}){return withPromise((r=>{t.classList.add(...e);r({mirror:t,mirrorClasses:e,...n})}))}function removeMirrorID({mirror:t,...e}){return withPromise((n=>{t.removeAttribute("id");delete t.id;n({mirror:t,...e})}))}function positionMirror({withFrame:t=false,initial:e=false}={}){return({mirror:n,sensorEvent:r,mirrorOffset:s,initialY:o,initialX:i,scrollOffset:a,options:l,passedThreshX:c,passedThreshY:d,lastMovedX:h,lastMovedY:u,...g})=>withPromise((t=>{const p={mirror:n,sensorEvent:r,mirrorOffset:s,options:l,...g};if(s){const t=c?Math.round((r.clientX-s.left-a.x)/(l.thresholdX||1))*(l.thresholdX||1):Math.round(h);const g=d?Math.round((r.clientY-s.top-a.y)/(l.thresholdY||1))*(l.thresholdY||1):Math.round(u);l.xAxis&&l.yAxis||e?n.style.transform=`translate3d(${t}px, ${g}px, 0)`:l.xAxis&&!l.yAxis?n.style.transform=`translate3d(${t}px, ${o}px, 0)`:l.yAxis&&!l.xAxis&&(n.style.transform=`translate3d(${i}px, ${g}px, 0)`);if(e){p.initialX=t;p.initialY=g}p.lastMovedX=t;p.lastMovedY=g}t(p)}),{frame:t})}function withPromise(t,{raf:e=false}={}){return new Promise(((n,r)=>{e?requestAnimationFrame((()=>{t(n,r)})):t(n,r)}))}function isNativeDragEvent(t){return/^drag/.test(t.originalEvent.type)}const mt=Symbol("onDragStart");const vt=Symbol("onDragMove");const ft=Symbol("onDragStop");const bt=Symbol("scroll");const Et={speed:6,sensitivity:50,scrollableElements:[]};class Scrollable extends AbstractPlugin{constructor(t){super(t);this.options={...Et,...this.getOptions()};this.currentMousePosition=null;this.scrollAnimationFrame=null;this.scrollableElement=null;this.findScrollableElementFrame=null;this[mt]=this[mt].bind(this);this[vt]=this[vt].bind(this);this[ft]=this[ft].bind(this);this[bt]=this[bt].bind(this)}attach(){this.draggable.on("drag:start",this[mt]).on("drag:move",this[vt]).on("drag:stop",this[ft])}detach(){this.draggable.off("drag:start",this[mt]).off("drag:move",this[vt]).off("drag:stop",this[ft])}getOptions(){return this.draggable.options.scrollable||{}}getScrollableElement(t){return this.hasDefinedScrollableElements()?closest(t,this.options.scrollableElements)||document.documentElement:closestScrollableElement(t)}hasDefinedScrollableElements(){return Boolean(this.options.scrollableElements.length!==0)}[mt](t){this.findScrollableElementFrame=requestAnimationFrame((()=>{this.scrollableElement=this.getScrollableElement(t.source)}))}[vt](t){this.findScrollableElementFrame=requestAnimationFrame((()=>{this.scrollableElement=this.getScrollableElement(t.sensorEvent.target)}));if(!this.scrollableElement)return;const e=t.sensorEvent;const n={x:0,y:0};if("ontouchstart"in window){n.y=window.pageYOffset||document.documentElement.scrollTop||document.body.scrollTop||0;n.x=window.pageXOffset||document.documentElement.scrollLeft||document.body.scrollLeft||0}this.currentMousePosition={clientX:e.clientX-n.x,clientY:e.clientY-n.y};this.scrollAnimationFrame=requestAnimationFrame(this[bt])}[ft](){cancelAnimationFrame(this.scrollAnimationFrame);cancelAnimationFrame(this.findScrollableElementFrame);this.scrollableElement=null;this.scrollAnimationFrame=null;this.findScrollableElementFrame=null;this.currentMousePosition=null}[bt](){if(!this.scrollableElement||!this.currentMousePosition)return;cancelAnimationFrame(this.scrollAnimationFrame);const{speed:t,sensitivity:e}=this.options;const n=this.scrollableElement.getBoundingClientRect();const r=n.bottom>window.innerHeight;const s=n.top<0;const o=s||r;const i=getDocumentScrollingElement();const a=this.scrollableElement;const l=this.currentMousePosition.clientX;const c=this.currentMousePosition.clientY;if(a===document.body||a===document.documentElement||o){const{innerHeight:n,innerWidth:r}=window;c<e?i.scrollTop-=t:n-c<e&&(i.scrollTop+=t);l<e?i.scrollLeft-=t:r-l<e&&(i.scrollLeft+=t)}else{const{offsetHeight:r,offsetWidth:s}=a;n.top+r-c<e?a.scrollTop+=t:c-n.top<e&&(a.scrollTop-=t);n.left+s-l<e?a.scrollLeft+=t:l-n.left<e&&(a.scrollLeft-=t)}this.scrollAnimationFrame=requestAnimationFrame(this[bt])}}function hasOverflow(t){const e=/(auto|scroll)/;const n=getComputedStyle(t,null);const r=n.getPropertyValue("overflow")+n.getPropertyValue("overflow-y")+n.getPropertyValue("overflow-x");return e.test(r)}function isStaticallyPositioned(t){const e=getComputedStyle(t).getPropertyValue("position");return e==="static"}function closestScrollableElement(t){if(!t)return getDocumentScrollingElement();const e=getComputedStyle(t).getPropertyValue("position");const n=e==="absolute";const r=closest(t,(t=>(!n||!isStaticallyPositioned(t))&&hasOverflow(t)));return e!=="fixed"&&r?r:getDocumentScrollingElement()}function getDocumentScrollingElement(){return document.scrollingElement||document.documentElement}class Emitter{constructor(){this.callbacks={}}on(t,...e){this.callbacks[t]||(this.callbacks[t]=[]);this.callbacks[t].push(...e);return this}off(t,e){if(!this.callbacks[t])return null;const n=this.callbacks[t].slice(0);for(let r=0;r<n.length;r++)e===n[r]&&this.callbacks[t].splice(r,1);return this}trigger(t){if(!this.callbacks[t.type])return null;const e=[...this.callbacks[t.type]];const n=[];for(let r=e.length-1;r>=0;r--){const s=e[r];try{s(t)}catch(t){n.push(t)}}n.length&&console.error(`Draggable caught errors while triggering '${t.type}'`,n);return this}}class DraggableEvent extends AbstractEvent{get draggable(){return this.data.draggable}}DraggableEvent.type="draggable";class DraggableInitializedEvent extends DraggableEvent{}DraggableInitializedEvent.type="draggable:initialize";class DraggableDestroyEvent extends DraggableEvent{}DraggableDestroyEvent.type="draggable:destroy";const St=Symbol("onDragStart");const yt=Symbol("onDragMove");const Ct=Symbol("onDragStop");const Dt=Symbol("onDragPressure");const wt=Symbol("dragStop");const xt={"drag:start":t=>`Picked up ${t.source.textContent.trim()||t.source.id||"draggable element"}`,"drag:stop":t=>`Released ${t.source.textContent.trim()||t.source.id||"draggable element"}`};const Mt={"container:dragging":"draggable-container--is-dragging","source:dragging":"draggable-source--is-dragging","source:placed":"draggable-source--placed","container:placed":"draggable-container--placed","body:dragging":"draggable--is-dragging","draggable:over":"draggable--over","container:over":"draggable-container--over","source:original":"draggable--original",mirror:"draggable-mirror"};const Ot={draggable:".draggable-source",handle:null,delay:{},distance:0,placedTimeout:800,plugins:[],sensors:[],exclude:{plugins:[],sensors:[]}};class Draggable{constructor(t=[document.body],e={}){if(t instanceof NodeList||t instanceof Array)this.containers=[...t];else{if(!(t instanceof HTMLElement))throw new Error("Draggable containers are expected to be of type `NodeList`, `HTMLElement[]` or `HTMLElement`");this.containers=[t]}this.options={...Ot,...e,classes:{...Mt,...e.classes||{}},announcements:{...xt,...e.announcements||{}},exclude:{plugins:e.exclude&&e.exclude.plugins||[],sensors:e.exclude&&e.exclude.sensors||[]}};this.emitter=new Emitter;this.dragging=false;this.plugins=[];this.sensors=[];this[St]=this[St].bind(this);this[yt]=this[yt].bind(this);this[Ct]=this[Ct].bind(this);this[Dt]=this[Dt].bind(this);this[wt]=this[wt].bind(this);document.addEventListener("drag:start",this[St],true);document.addEventListener("drag:move",this[yt],true);document.addEventListener("drag:stop",this[Ct],true);document.addEventListener("drag:pressure",this[Dt],true);const n=Object.values(Draggable.Plugins).filter((t=>!this.options.exclude.plugins.includes(t)));const r=Object.values(Draggable.Sensors).filter((t=>!this.options.exclude.sensors.includes(t)));this.addPlugin(...n,...this.options.plugins);this.addSensor(...r,...this.options.sensors);const s=new DraggableInitializedEvent({draggable:this});this.on("mirror:created",(({mirror:t})=>this.mirror=t));this.on("mirror:destroy",(()=>this.mirror=null));this.trigger(s)}destroy(){document.removeEventListener("drag:start",this[St],true);document.removeEventListener("drag:move",this[yt],true);document.removeEventListener("drag:stop",this[Ct],true);document.removeEventListener("drag:pressure",this[Dt],true);const t=new DraggableDestroyEvent({draggable:this});this.trigger(t);this.removePlugin(...this.plugins.map((t=>t.constructor)));this.removeSensor(...this.sensors.map((t=>t.constructor)))}addPlugin(...t){const e=t.map((t=>new t(this)));e.forEach((t=>t.attach()));this.plugins=[...this.plugins,...e];return this}removePlugin(...t){const e=this.plugins.filter((e=>t.includes(e.constructor)));e.forEach((t=>t.detach()));this.plugins=this.plugins.filter((e=>!t.includes(e.constructor)));return this}addSensor(...t){const e=t.map((t=>new t(this.containers,this.options)));e.forEach((t=>t.attach()));this.sensors=[...this.sensors,...e];return this}removeSensor(...t){const e=this.sensors.filter((e=>t.includes(e.constructor)));e.forEach((t=>t.detach()));this.sensors=this.sensors.filter((e=>!t.includes(e.constructor)));return this}addContainer(...t){this.containers=[...this.containers,...t];this.sensors.forEach((e=>e.addContainer(...t)));return this}removeContainer(...t){this.containers=this.containers.filter((e=>!t.includes(e)));this.sensors.forEach((e=>e.removeContainer(...t)));return this}on(t,...e){this.emitter.on(t,...e);return this}off(t,e){this.emitter.off(t,e);return this}trigger(t){this.emitter.trigger(t);return this}getClassNameFor(t){return this.getClassNamesFor(t)[0]}getClassNamesFor(t){const e=this.options.classes[t];return e instanceof Array?e:typeof e==="string"||e instanceof String?[e]:[]}isDragging(){return Boolean(this.dragging)}getDraggableElements(){return this.containers.reduce(((t,e)=>[...t,...this.getDraggableElementsForContainer(e)]),[])}getDraggableElementsForContainer(t){const e=t.querySelectorAll(this.options.draggable);return[...e].filter((t=>t!==this.originalSource&&t!==this.mirror))}cancel(){this[wt]()}[St](t){const e=getSensorEvent(t);const{target:n,container:r,originalSource:s}=e;if(!this.containers.includes(r))return;if(this.options.handle&&n&&!closest(n,this.options.handle)){e.cancel();return}this.originalSource=s;this.sourceContainer=r;if(this.lastPlacedSource&&this.lastPlacedContainer){clearTimeout(this.placedTimeoutID);this.lastPlacedSource.classList.remove(...this.getClassNamesFor("source:placed"));this.lastPlacedContainer.classList.remove(...this.getClassNamesFor("container:placed"))}this.source=this.originalSource.cloneNode(true);this.originalSource.parentNode.insertBefore(this.source,this.originalSource);this.originalSource.style.display="none";const o=new DragStartEvent({source:this.source,originalSource:this.originalSource,sourceContainer:r,sensorEvent:e});this.trigger(o);this.dragging=!o.canceled();if(o.canceled()){this.source.remove();this.originalSource.style.display=null}else{this.originalSource.classList.add(...this.getClassNamesFor("source:original"));this.source.classList.add(...this.getClassNamesFor("source:dragging"));this.sourceContainer.classList.add(...this.getClassNamesFor("container:dragging"));document.body.classList.add(...this.getClassNamesFor("body:dragging"));applyUserSelect(document.body,"none");requestAnimationFrame((()=>{const e=getSensorEvent(t);const n=e.clone({target:this.source});this[yt]({...t,detail:n})}))}}[yt](t){if(!this.dragging)return;const e=getSensorEvent(t);const{container:n}=e;let r=e.target;const s=new DragMoveEvent({source:this.source,originalSource:this.originalSource,sourceContainer:n,sensorEvent:e});this.trigger(s);s.canceled()&&e.cancel();r=closest(r,this.options.draggable);const o=closest(e.target,this.containers);const i=e.overContainer||o;const a=this.currentOverContainer&&i!==this.currentOverContainer;const l=this.currentOver&&r!==this.currentOver;const c=i&&this.currentOverContainer!==i;const d=o&&r&&this.currentOver!==r;if(l){const t=new DragOutEvent({source:this.source,originalSource:this.originalSource,sourceContainer:n,sensorEvent:e,over:this.currentOver,overContainer:this.currentOverContainer});this.currentOver.classList.remove(...this.getClassNamesFor("draggable:over"));this.currentOver=null;this.trigger(t)}if(a){const t=new DragOutContainerEvent({source:this.source,originalSource:this.originalSource,sourceContainer:n,sensorEvent:e,overContainer:this.currentOverContainer});this.currentOverContainer.classList.remove(...this.getClassNamesFor("container:over"));this.currentOverContainer=null;this.trigger(t)}if(c){i.classList.add(...this.getClassNamesFor("container:over"));const t=new DragOverContainerEvent({source:this.source,originalSource:this.originalSource,sourceContainer:n,sensorEvent:e,overContainer:i});this.currentOverContainer=i;this.trigger(t)}if(d){r.classList.add(...this.getClassNamesFor("draggable:over"));const t=new DragOverEvent({source:this.source,originalSource:this.originalSource,sourceContainer:n,sensorEvent:e,overContainer:i,over:r});this.currentOver=r;this.trigger(t)}}[wt](t){if(!this.dragging)return;this.dragging=false;const e=new DragStopEvent({source:this.source,originalSource:this.originalSource,sensorEvent:t?t.sensorEvent:null,sourceContainer:this.sourceContainer});this.trigger(e);e.canceled()||this.source.parentNode.insertBefore(this.originalSource,this.source);this.source.remove();this.originalSource.style.display="";this.source.classList.remove(...this.getClassNamesFor("source:dragging"));this.originalSource.classList.remove(...this.getClassNamesFor("source:original"));this.originalSource.classList.add(...this.getClassNamesFor("source:placed"));this.sourceContainer.classList.add(...this.getClassNamesFor("container:placed"));this.sourceContainer.classList.remove(...this.getClassNamesFor("container:dragging"));document.body.classList.remove(...this.getClassNamesFor("body:dragging"));applyUserSelect(document.body,"");this.currentOver&&this.currentOver.classList.remove(...this.getClassNamesFor("draggable:over"));this.currentOverContainer&&this.currentOverContainer.classList.remove(...this.getClassNamesFor("container:over"));this.lastPlacedSource=this.originalSource;this.lastPlacedContainer=this.sourceContainer;this.placedTimeoutID=setTimeout((()=>{this.lastPlacedSource&&this.lastPlacedSource.classList.remove(...this.getClassNamesFor("source:placed"));this.lastPlacedContainer&&this.lastPlacedContainer.classList.remove(...this.getClassNamesFor("container:placed"));this.lastPlacedSource=null;this.lastPlacedContainer=null}),this.options.placedTimeout);const n=new DragStoppedEvent({source:this.source,originalSource:this.originalSource,sensorEvent:t?t.sensorEvent:null,sourceContainer:this.sourceContainer});this.trigger(n);this.source=null;this.originalSource=null;this.currentOverContainer=null;this.currentOver=null;this.sourceContainer=null}[Ct](t){this[wt](t)}[Dt](t){if(!this.dragging)return;const e=getSensorEvent(t);const n=this.source||closest(e.originalEvent.target,this.options.draggable);const r=new DragPressureEvent({sensorEvent:e,source:n,pressure:e.pressure});this.trigger(r)}}Draggable.Plugins={Announcement:Announcement,Focusable:Focusable,Mirror:Mirror,Scrollable:Scrollable};Draggable.Sensors={MouseSensor:MouseSensor,TouchSensor:TouchSensor};function getSensorEvent(t){return t.detail}function applyUserSelect(t,e){t.style.webkitUserSelect=e;t.style.mozUserSelect=e;t.style.msUserSelect=e;t.style.oUserSelect=e;t.style.userSelect=e}class DroppableEvent extends AbstractEvent{constructor(t){super(t);this.data=t}get dragEvent(){return this.data.dragEvent}}DroppableEvent.type="droppable";class DroppableStartEvent extends DroppableEvent{get dropzone(){return this.data.dropzone}}DroppableStartEvent.type="droppable:start";DroppableStartEvent.cancelable=true;class DroppableDroppedEvent extends DroppableEvent{get dropzone(){return this.data.dropzone}}DroppableDroppedEvent.type="droppable:dropped";DroppableDroppedEvent.cancelable=true;class DroppableReturnedEvent extends DroppableEvent{get dropzone(){return this.data.dropzone}}DroppableReturnedEvent.type="droppable:returned";DroppableReturnedEvent.cancelable=true;class DroppableStopEvent extends DroppableEvent{get dropzone(){return this.data.dropzone}}DroppableStopEvent.type="droppable:stop";DroppableStopEvent.cancelable=true;const At=Symbol("onDragStart");const Lt=Symbol("onDragMove");const Ft=Symbol("onDragStop");const Tt=Symbol("dropInDropZone");const Xt=Symbol("returnToOriginalDropzone");const Yt=Symbol("closestDropzone");const Pt=Symbol("getDropzones");function onDroppableDroppedDefaultAnnouncement({dragEvent:t,dropzone:e}){const n=t.source.textContent.trim()||t.source.id||"draggable element";const r=e.textContent.trim()||e.id||"droppable element";return`Dropped ${n} into ${r}`}function onDroppableReturnedDefaultAnnouncement({dragEvent:t,dropzone:e}){const n=t.source.textContent.trim()||t.source.id||"draggable element";const r=e.textContent.trim()||e.id||"droppable element";return`Returned ${n} from ${r}`}const Nt={"droppable:dropped":onDroppableDroppedDefaultAnnouncement,"droppable:returned":onDroppableReturnedDefaultAnnouncement};const zt={"droppable:active":"draggable-dropzone--active","droppable:occupied":"draggable-dropzone--occupied"};const It={dropzone:".draggable-droppable"};class Droppable extends Draggable{constructor(t=[],e={}){super(t,{...It,...e,classes:{...zt,...e.classes||{}},announcements:{...Nt,...e.announcements||{}}});this.dropzones=null;this.lastDropzone=null;this.initialDropzone=null;this[At]=this[At].bind(this);this[Lt]=this[Lt].bind(this);this[Ft]=this[Ft].bind(this);this.on("drag:start",this[At]).on("drag:move",this[Lt]).on("drag:stop",this[Ft])}destroy(){super.destroy();this.off("drag:start",this[At]).off("drag:move",this[Lt]).off("drag:stop",this[Ft])}[At](t){if(t.canceled())return;this.dropzones=[...this[Pt]()];const e=closest(t.sensorEvent.target,this.options.dropzone);if(!e){t.cancel();return}const n=new DroppableStartEvent({dragEvent:t,dropzone:e});this.trigger(n);if(n.canceled())t.cancel();else{this.initialDropzone=e;for(const t of this.dropzones)t.classList.contains(this.getClassNameFor("droppable:occupied"))||t.classList.add(...this.getClassNamesFor("droppable:active"))}}[Lt](t){if(t.canceled())return;const e=this[Yt](t.sensorEvent.target);const n=e&&!e.classList.contains(this.getClassNameFor("droppable:occupied"));if(n&&this[Tt](t,e))this.lastDropzone=e;else if((!e||e===this.initialDropzone)&&this.lastDropzone){this[Xt](t);this.lastDropzone=null}}[Ft](t){const e=new DroppableStopEvent({dragEvent:t,dropzone:this.lastDropzone||this.initialDropzone});this.trigger(e);const n=this.getClassNamesFor("droppable:occupied");for(const t of this.dropzones)t.classList.remove(...this.getClassNamesFor("droppable:active"));this.lastDropzone&&this.lastDropzone!==this.initialDropzone&&this.initialDropzone.classList.remove(...n);this.dropzones=null;this.lastDropzone=null;this.initialDropzone=null}[Tt](t,e){const n=new DroppableDroppedEvent({dragEvent:t,dropzone:e});this.trigger(n);if(n.canceled())return false;const r=this.getClassNamesFor("droppable:occupied");this.lastDropzone&&this.lastDropzone.classList.remove(...r);e.appendChild(t.source);e.classList.add(...r);return true}[Xt](t){const e=new DroppableReturnedEvent({dragEvent:t,dropzone:this.lastDropzone});this.trigger(e);if(!e.canceled()){this.initialDropzone.appendChild(t.source);this.lastDropzone.classList.remove(...this.getClassNamesFor("droppable:occupied"))}}[Yt](t){return this.dropzones?closest(t,this.dropzones):null}[Pt](){const t=this.options.dropzone;return typeof t==="string"?document.querySelectorAll(t):t instanceof NodeList||t instanceof Array?t:typeof t==="function"?t():[]}}class SwappableEvent extends AbstractEvent{constructor(t){super(t);this.data=t}get dragEvent(){return this.data.dragEvent}}SwappableEvent.type="swappable";class SwappableStartEvent extends SwappableEvent{}SwappableStartEvent.type="swappable:start";SwappableStartEvent.cancelable=true;class SwappableSwapEvent extends SwappableEvent{get over(){return this.data.over}get overContainer(){return this.data.overContainer}}SwappableSwapEvent.type="swappable:swap";SwappableSwapEvent.cancelable=true;class SwappableSwappedEvent extends SwappableEvent{get swappedElement(){return this.data.swappedElement}}SwappableSwappedEvent.type="swappable:swapped";class SwappableStopEvent extends SwappableEvent{}SwappableStopEvent.type="swappable:stop";const $t=Symbol("onDragStart");const Bt=Symbol("onDragOver");const kt=Symbol("onDragStop");function onSwappableSwappedDefaultAnnouncement({dragEvent:t,swappedElement:e}){const n=t.source.textContent.trim()||t.source.id||"swappable element";const r=e.textContent.trim()||e.id||"swappable element";return`Swapped ${n} with ${r}`}const Rt={"swappabled:swapped":onSwappableSwappedDefaultAnnouncement};class Swappable extends Draggable{constructor(t=[],e={}){super(t,{...e,announcements:{...Rt,...e.announcements||{}}});this.lastOver=null;this[$t]=this[$t].bind(this);this[Bt]=this[Bt].bind(this);this[kt]=this[kt].bind(this);this.on("drag:start",this[$t]).on("drag:over",this[Bt]).on("drag:stop",this[kt])}destroy(){super.destroy();this.off("drag:start",this._onDragStart).off("drag:over",this._onDragOver).off("drag:stop",this._onDragStop)}[$t](t){const e=new SwappableStartEvent({dragEvent:t});this.trigger(e);e.canceled()&&t.cancel()}[Bt](t){if(t.over===t.originalSource||t.over===t.source||t.canceled())return;const e=new SwappableSwapEvent({dragEvent:t,over:t.over,overContainer:t.overContainer});this.trigger(e);if(e.canceled())return;this.lastOver&&this.lastOver!==t.over&&swap(this.lastOver,t.source);this.lastOver===t.over?this.lastOver=null:this.lastOver=t.over;swap(t.source,t.over);const n=new SwappableSwappedEvent({dragEvent:t,swappedElement:t.over});this.trigger(n)}[kt](t){const e=new SwappableStopEvent({dragEvent:t});this.trigger(e);this.lastOver=null}}function withTempElement(t){const e=document.createElement("div");t(e);e.remove()}function swap(t,e){const n=e.parentNode;const r=t.parentNode;withTempElement((s=>{r.insertBefore(s,t);n.insertBefore(t,e);r.insertBefore(e,s)}))}class SortableEvent extends AbstractEvent{constructor(t){super(t);this.data=t}get dragEvent(){return this.data.dragEvent}}SortableEvent.type="sortable";class SortableStartEvent extends SortableEvent{get startIndex(){return this.data.startIndex}get startContainer(){return this.data.startContainer}}SortableStartEvent.type="sortable:start";SortableStartEvent.cancelable=true;class SortableSortEvent extends SortableEvent{get currentIndex(){return this.data.currentIndex}get over(){return this.data.over}get overContainer(){return this.data.dragEvent.overContainer}}SortableSortEvent.type="sortable:sort";SortableSortEvent.cancelable=true;class SortableSortedEvent extends SortableEvent{get oldIndex(){return this.data.oldIndex}get newIndex(){return this.data.newIndex}get oldContainer(){return this.data.oldContainer}get newContainer(){return this.data.newContainer}}SortableSortedEvent.type="sortable:sorted";class SortableStopEvent extends SortableEvent{get oldIndex(){return this.data.oldIndex}get newIndex(){return this.data.newIndex}get oldContainer(){return this.data.oldContainer}get newContainer(){return this.data.newContainer}}SortableStopEvent.type="sortable:stop";const qt=Symbol("onDragStart");const _t=Symbol("onDragOverContainer");const jt=Symbol("onDragOver");const Ht=Symbol("onDragStop");function onSortableSortedDefaultAnnouncement({dragEvent:t}){const e=t.source.textContent.trim()||t.source.id||"sortable element";if(t.over){const n=t.over.textContent.trim()||t.over.id||"sortable element";const r=t.source.compareDocumentPosition(t.over)&Node.DOCUMENT_POSITION_FOLLOWING;return r?`Placed ${e} after ${n}`:`Placed ${e} before ${n}`}return`Placed ${e} into a different container`}const Vt={"sortable:sorted":onSortableSortedDefaultAnnouncement};class Sortable extends Draggable{constructor(t=[],e={}){super(t,{...e,announcements:{...Vt,...e.announcements||{}}});this.startIndex=null;this.startContainer=null;this[qt]=this[qt].bind(this);this[_t]=this[_t].bind(this);this[jt]=this[jt].bind(this);this[Ht]=this[Ht].bind(this);this.on("drag:start",this[qt]).on("drag:over:container",this[_t]).on("drag:over",this[jt]).on("drag:stop",this[Ht])}destroy(){super.destroy();this.off("drag:start",this[qt]).off("drag:over:container",this[_t]).off("drag:over",this[jt]).off("drag:stop",this[Ht])}index(t){return this.getSortableElementsForContainer(t.parentNode).indexOf(t)}getSortableElementsForContainer(t){const e=t.querySelectorAll(this.options.draggable);return[...e].filter((e=>e!==this.originalSource&&e!==this.mirror&&e.parentNode===t))}[qt](t){this.startContainer=t.source.parentNode;this.startIndex=this.index(t.source);const e=new SortableStartEvent({dragEvent:t,startIndex:this.startIndex,startContainer:this.startContainer});this.trigger(e);e.canceled()&&t.cancel()}[_t](t){if(t.canceled())return;const{source:e,over:n,overContainer:r}=t;const s=this.index(e);const o=new SortableSortEvent({dragEvent:t,currentIndex:s,source:e,over:n});this.trigger(o);if(o.canceled())return;const i=this.getSortableElementsForContainer(r);const a=move({source:e,over:n,overContainer:r,children:i});if(!a)return;const{oldContainer:l,newContainer:c}=a;const d=this.index(t.source);const h=new SortableSortedEvent({dragEvent:t,oldIndex:s,newIndex:d,oldContainer:l,newContainer:c});this.trigger(h)}[jt](t){if(t.over===t.originalSource||t.over===t.source)return;const{source:e,over:n,overContainer:r}=t;const s=this.index(e);const o=new SortableSortEvent({dragEvent:t,currentIndex:s,source:e,over:n});this.trigger(o);if(o.canceled())return;const i=this.getDraggableElementsForContainer(r);const a=move({source:e,over:n,overContainer:r,children:i});if(!a)return;const{oldContainer:l,newContainer:c}=a;const d=this.index(e);const h=new SortableSortedEvent({dragEvent:t,oldIndex:s,newIndex:d,oldContainer:l,newContainer:c});this.trigger(h)}[Ht](t){const e=new SortableStopEvent({dragEvent:t,oldIndex:this.startIndex,newIndex:this.index(t.source),oldContainer:this.startContainer,newContainer:t.source.parentNode});this.trigger(e);this.startIndex=null;this.startContainer=null}}function index(t){return Array.prototype.indexOf.call(t.parentNode.children,t)}function move({source:t,over:e,overContainer:n,children:r}){const s=!r.length;const o=t.parentNode!==n;const i=e&&t.parentNode===e.parentNode;return s?moveInsideEmptyContainer(t,n):i?moveWithinContainer(t,e):o?moveOutsideContainer(t,e,n):null}function moveInsideEmptyContainer(t,e){const n=t.parentNode;e.appendChild(t);return{oldContainer:n,newContainer:e}}function moveWithinContainer(t,e){const n=index(t);const r=index(e);n<r?t.parentNode.insertBefore(t,e.nextElementSibling):t.parentNode.insertBefore(t,e);return{oldContainer:t.parentNode,newContainer:t.parentNode}}function moveOutsideContainer(t,e,n){const r=t.parentNode;e?e.parentNode.insertBefore(t,e):n.appendChild(t);return{oldContainer:r,newContainer:t.parentNode}}export{AbstractEvent as BaseEvent,AbstractPlugin as BasePlugin,Draggable,Droppable,V as Plugins,O as Sensors,Sortable,Swappable};
4
+
@@ -0,0 +1,4 @@
1
+ // el-transition@0.0.7 downloaded from https://ga.jspm.io/npm:el-transition@0.0.7/index.js
2
+
3
+ async function enter(t,e=null){t.classList.remove("hidden");await transition("enter",t,e)}async function leave(t,e=null){await transition("leave",t,e);t.classList.add("hidden")}async function toggle(t,e=null){t.classList.contains("hidden")?await enter(t,e):await leave(t,e)}async function transition(t,e,s){const n=e.dataset;const a=s?`${s}-${t}`:t;let i=`transition${t.charAt(0).toUpperCase()+t.slice(1)}`;const o=n[i]?n[i].split(" "):[a];const r=n[`${i}Start`]?n[`${i}Start`].split(" "):[`${a}-start`];const l=n[`${i}End`]?n[`${i}End`].split(" "):[`${a}-end`];addClasses(e,o);addClasses(e,r);await nextFrame();removeClasses(e,r);addClasses(e,l);await afterTransition(e);removeClasses(e,l);removeClasses(e,o)}function addClasses(t,e){t.classList.add(...e)}function removeClasses(t,e){t.classList.remove(...e)}function nextFrame(){return new Promise(t=>{requestAnimationFrame(()=>{requestAnimationFrame(t)})})}function afterTransition(t){return new Promise(e=>{const s=getComputedStyle(t).transitionDuration.split(",")[0];const n=1e3*Number(s.replace("s",""));setTimeout(()=>{e()},n)})}export{enter,leave,toggle};
4
+
@@ -0,0 +1,4 @@
1
+ // stimulus-use@0.52.3 downloaded from https://ga.jspm.io/npm:stimulus-use@0.52.3/dist/index.js
2
+
3
+ import{Controller as e}from"@hotwired/stimulus";const method=(e,t)=>{const s=e[t];return typeof s=="function"?s:(...e)=>{}};const composeEventName=(e,t,s)=>{let n=e;s===true?n=`${t.identifier}:${e}`:typeof s==="string"&&(n=`${s}:${e}`);return n};const extendedEvent=(e,t,s)=>{const{bubbles:n,cancelable:o,composed:i}=t||{bubbles:true,cancelable:true,composed:true};t&&Object.assign(s,{originalEvent:t});const r=new CustomEvent(e,{bubbles:n,cancelable:o,composed:i,detail:s});return r};function isElementInViewport(e){const t=e.getBoundingClientRect();const s=window.innerHeight||document.documentElement.clientHeight;const n=window.innerWidth||document.documentElement.clientWidth;const o=t.top<=s&&t.top+t.height>0;const i=t.left<=n&&t.left+t.width>0;return o&&i}function camelize(e){return e.replace(/(?:[_-])([a-z0-9])/g,((e,t)=>t.toUpperCase()))}function __rest(e,t){var s={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(s[n]=e[n]);if(e!=null&&typeof Object.getOwnPropertySymbols==="function"){var o=0;for(n=Object.getOwnPropertySymbols(e);o<n.length;o++)t.indexOf(n[o])<0&&Object.prototype.propertyIsEnumerable.call(e,n[o])&&(s[n[o]]=e[n[o]])}return s}const t={debug:false,logger:console,dispatchEvent:true,eventPrefix:true};class StimulusUse{constructor(e,s={}){var n,o,i;this.log=(e,t)=>{if(this.debug){this.logger.groupCollapsed(`%c${this.controller.identifier} %c#${e}`,"color: #3B82F6","color: unset");this.logger.log(Object.assign({controllerId:this.controllerId},t));this.logger.groupEnd()}};this.warn=e=>{this.logger.warn(`%c${this.controller.identifier} %c${e}`,"color: #3B82F6; font-weight: bold","color: unset")};this.dispatch=(e,t={})=>{if(this.dispatchEvent){const{event:s}=t,n=__rest(t,["event"]);const o=this.extendedEvent(e,s||null,n);this.targetElement.dispatchEvent(o);this.log("dispatchEvent",Object.assign({eventName:o.type},n))}};this.call=(e,t={})=>{const s=this.controller[e];if(typeof s=="function")return s.call(this.controller,t)};this.extendedEvent=(e,t,s)=>{const{bubbles:n,cancelable:o,composed:i}=t||{bubbles:true,cancelable:true,composed:true};t&&Object.assign(s,{originalEvent:t});const r=new CustomEvent(this.composeEventName(e),{bubbles:n,cancelable:o,composed:i,detail:s});return r};this.composeEventName=e=>{let t=e;this.eventPrefix===true?t=`${this.controller.identifier}:${e}`:typeof this.eventPrefix==="string"&&(t=`${this.eventPrefix}:${e}`);return t};this.debug=(o=(n=s===null||s===void 0?void 0:s.debug)!==null&&n!==void 0?n:e.application.stimulusUseDebug)!==null&&o!==void 0?o:t.debug;this.logger=(i=s===null||s===void 0?void 0:s.logger)!==null&&i!==void 0?i:t.logger;this.controller=e;this.controllerId=e.element.id||e.element.dataset.id;this.targetElement=(s===null||s===void 0?void 0:s.element)||e.element;const{dispatchEvent:r,eventPrefix:l}=Object.assign({},t,s);Object.assign(this,{dispatchEvent:r,eventPrefix:l});this.controllerInitialize=e.initialize.bind(e);this.controllerConnect=e.connect.bind(e);this.controllerDisconnect=e.disconnect.bind(e)}}const s={eventPrefix:true,bubbles:true,cancelable:true};class UseDispatch extends StimulusUse{constructor(e,t={}){var n,o,i,r;super(e,t);this.dispatch=(e,t={})=>{const{controller:s,targetElement:n,eventPrefix:o,bubbles:i,cancelable:r,log:l,warn:c}=this;Object.assign(t,{controller:s});const a=composeEventName(e,this.controller,o);const u=new CustomEvent(a,{detail:t,bubbles:i,cancelable:r});n.dispatchEvent(u);c("`useDispatch()` is deprecated. Please use the built-in `this.dispatch()` function from Stimulus. You can find more information on how to upgrade at: https://stimulus-use.github.io/stimulus-use/#/use-dispatch");l("dispatch",{eventName:a,detail:t,bubbles:i,cancelable:r});return u};this.targetElement=(n=t.element)!==null&&n!==void 0?n:e.element;this.eventPrefix=(o=t.eventPrefix)!==null&&o!==void 0?o:s.eventPrefix;this.bubbles=(i=t.bubbles)!==null&&i!==void 0?i:s.bubbles;this.cancelable=(r=t.cancelable)!==null&&r!==void 0?r:s.cancelable;this.enhanceController()}enhanceController(){Object.assign(this.controller,{dispatch:this.dispatch})}}const useDispatch=(e,t={})=>new UseDispatch(e,t);const n={overwriteDispatch:true};const useApplication=(e,t={})=>{const{overwriteDispatch:s}=Object.assign({},n,t);Object.defineProperty(e,"isPreview",{get(){return document.documentElement.hasAttribute("data-turbolinks-preview")||document.documentElement.hasAttribute("data-turbo-preview")}});Object.defineProperty(e,"isConnected",{get(){return!!Array.from(this.context.module.connectedContexts).find((e=>e===this.context))}});Object.defineProperty(e,"csrfToken",{get(){return this.metaValue("csrf-token")}});s&&useDispatch(e,t);Object.assign(e,{metaValue(e){const t=document.head.querySelector(`meta[name="${e}"]`);return t&&t.getAttribute("content")}})};class ApplicationController extends e{constructor(e){super(e);this.isPreview=false;this.isConnected=false;this.csrfToken="";useApplication(this,this.options)}}const o={events:["click","touchend"],onlyVisible:true,dispatchEvent:true,eventPrefix:true};const useClickOutside=(e,t={})=>{const s=e;const{onlyVisible:n,dispatchEvent:i,events:r,eventPrefix:l}=Object.assign({},o,t);const onEvent=e=>{const o=(t===null||t===void 0?void 0:t.element)||s.element;if(!(o.contains(e.target)||!isElementInViewport(o)&&n)){s.clickOutside&&s.clickOutside(e);if(i){const t=composeEventName("click:outside",s,l);const n=extendedEvent(t,e,{controller:s});o.dispatchEvent(n)}}};const observe=()=>{r===null||r===void 0?void 0:r.forEach((e=>{window.addEventListener(e,onEvent,true)}))};const unobserve=()=>{r===null||r===void 0?void 0:r.forEach((e=>{window.removeEventListener(e,onEvent,true)}))};const c=s.disconnect.bind(s);Object.assign(s,{disconnect(){unobserve();c()}});observe();return[observe,unobserve]};class ClickOutsideComposableController extends e{}class ClickOutsideController extends ClickOutsideComposableController{constructor(e){super(e);requestAnimationFrame((()=>{const[e,t]=useClickOutside(this,this.options);Object.assign(this,{observe:e,unobserve:t})}))}}class DebounceController extends e{}DebounceController.debounces=[];const i=200;const debounce=(e,t=i)=>{let s=null;return function(){const n=Array.from(arguments);const o=this;const i=n.map((e=>e.params));const callback=()=>{n.forEach(((e,t)=>e.params=i[t]));return e.apply(o,n)};s&&clearTimeout(s);s=setTimeout(callback,t)}};const useDebounce=(e,t)=>{const s=e;const n=s.constructor;n.debounces.forEach((e=>{typeof e==="string"&&(s[e]=debounce(s[e],t===null||t===void 0?void 0:t.wait));if(typeof e==="object"){const{name:n,wait:o}=e;if(!n)return;s[n]=debounce(s[n],o||(t===null||t===void 0?void 0:t.wait))}}))};class UseHover extends StimulusUse{constructor(e,t={}){super(e,t);this.observe=()=>{this.targetElement.addEventListener("mouseenter",this.onEnter);this.targetElement.addEventListener("mouseleave",this.onLeave)};this.unobserve=()=>{this.targetElement.removeEventListener("mouseenter",this.onEnter);this.targetElement.removeEventListener("mouseleave",this.onLeave)};this.onEnter=e=>{this.call("mouseEnter",e);this.log("mouseEnter",{hover:true});this.dispatch("mouseEnter",{hover:false})};this.onLeave=e=>{this.call("mouseLeave",e);this.log("mouseLeave",{hover:false});this.dispatch("mouseLeave",{hover:false})};this.controller=e;this.enhanceController();this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);const disconnect=()=>{this.unobserve();e()};Object.assign(this.controller,{disconnect:disconnect})}}const useHover=(e,t={})=>{const s=e;const n=new UseHover(s,t);return[n.observe,n.unobserve]};class HoverComposableController extends e{}class HoverController extends HoverComposableController{constructor(e){super(e);requestAnimationFrame((()=>{const[e,t]=useHover(this,this.options);Object.assign(this,{observe:e,unobserve:t})}))}}const r=["mousemove","mousedown","resize","keydown","touchstart","wheel"];const l=6e4;const c={ms:l,initialState:false,events:r,dispatchEvent:true,eventPrefix:true};const useIdle=(e,t={})=>{const s=e;const{ms:n,initialState:o,events:i,dispatchEvent:r,eventPrefix:l}=Object.assign({},c,t);let a=o;let u=setTimeout((()=>{a=true;dispatchAway()}),n);const dispatchAway=e=>{const t=composeEventName("away",s,l);s.isIdle=true;method(s,"away").call(s,e);if(r){const n=extendedEvent(t,e||null,{controller:s});s.element.dispatchEvent(n)}};const dispatchBack=e=>{const t=composeEventName("back",s,l);s.isIdle=false;method(s,"back").call(s,e);if(r){const n=extendedEvent(t,e||null,{controller:s});s.element.dispatchEvent(n)}};const onEvent=e=>{a&&dispatchBack(e);a=false;clearTimeout(u);u=setTimeout((()=>{a=true;dispatchAway(e)}),n)};const onVisibility=e=>{document.hidden||onEvent(e)};a?dispatchAway():dispatchBack();const h=s.disconnect.bind(s);const observe=()=>{i.forEach((e=>{window.addEventListener(e,onEvent)}));document.addEventListener("visibilitychange",onVisibility)};const unobserve=()=>{clearTimeout(u);i.forEach((e=>{window.removeEventListener(e,onEvent)}));document.removeEventListener("visibilitychange",onVisibility)};Object.assign(s,{disconnect(){unobserve();h()}});observe();return[observe,unobserve]};class IdleComposableController extends e{constructor(){super(...arguments);this.isIdle=false}}class IdleController extends IdleComposableController{constructor(e){super(e);requestAnimationFrame((()=>{const[e,t]=useIdle(this,this.options);Object.assign(this,{observe:e,unobserve:t})}))}}const a={dispatchEvent:true,eventPrefix:true,visibleAttribute:"isVisible"};const useIntersection=(e,t={})=>{const s=e;const{dispatchEvent:n,eventPrefix:o,visibleAttribute:i}=Object.assign({},a,t);const r=(t===null||t===void 0?void 0:t.element)||s.element;s.intersectionElements||(s.intersectionElements=[]);s.intersectionElements.push(r);const callback=e=>{const[t]=e;t.isIntersecting?dispatchAppear(t):r.hasAttribute(i)&&dispatchDisappear(t)};const l=new IntersectionObserver(callback,t);const dispatchAppear=e=>{r.setAttribute(i,"true");method(s,"appear").call(s,e,l);if(n){const t=composeEventName("appear",s,o);const n=extendedEvent(t,null,{controller:s,entry:e,observer:l});r.dispatchEvent(n)}};const dispatchDisappear=e=>{r.removeAttribute(i);method(s,"disappear").call(s,e,l);if(n){const t=composeEventName("disappear",s,o);const n=extendedEvent(t,null,{controller:s,entry:e,observer:l});r.dispatchEvent(n)}};const c=s.disconnect.bind(s);const disconnect=()=>{unobserve();c()};const observe=()=>{l.observe(r)};const unobserve=()=>{l.unobserve(r)};const noneVisible=()=>s.intersectionElements.filter((e=>e.hasAttribute(i))).length===0;const oneVisible=()=>s.intersectionElements.filter((e=>e.hasAttribute(i))).length===1;const atLeastOneVisible=()=>s.intersectionElements.some((e=>e.hasAttribute(i)));const allVisible=()=>s.intersectionElements.every((e=>e.hasAttribute(i)));const u=allVisible;Object.assign(s,{isVisible:u,noneVisible:noneVisible,oneVisible:oneVisible,atLeastOneVisible:atLeastOneVisible,allVisible:allVisible,disconnect:disconnect});observe();return[observe,unobserve]};class IntersectionComposableController extends e{}class IntersectionController extends IntersectionComposableController{constructor(e){super(e);requestAnimationFrame((()=>{const[e,t]=useIntersection(this,this.options);Object.assign(this,{observe:e,unobserve:t})}))}}const useLazyLoad=(e,t)=>{const callback=t=>{const[s]=t;s.isIntersecting&&!e.isLoaded&&handleAppear()};const handleAppear=t=>{const s=e.data.get("src");if(!s)return;const n=e.element;e.isLoading=true;method(e,"loading").call(e,s);n.onload=()=>{handleLoaded(s)};n.src=s};const handleLoaded=t=>{e.isLoading=false;e.isLoaded=true;method(e,"loaded").call(e,t)};const s=e.disconnect.bind(e);const n=new IntersectionObserver(callback,t);const observe=()=>{n.observe(e.element)};const unobserve=()=>{n.unobserve(e.element)};Object.assign(e,{isVisible:false,disconnect(){unobserve();s()}});observe();return[observe,unobserve]};class LazyLoadComposableController extends e{constructor(){super(...arguments);this.isLoading=false;this.isLoaded=false}}class LazyLoadController extends LazyLoadComposableController{constructor(e){super(e);this.options={rootMargin:"10%"};requestAnimationFrame((()=>{const[e,t]=useLazyLoad(this,this.options);Object.assign(this,{observe:e,unobserve:t})}))}}const u={mediaQueries:{},dispatchEvent:true,eventPrefix:true,debug:false};class UseMatchMedia extends StimulusUse{constructor(e,t={}){var s,n,o,i;super(e,t);this.matches=[];this.callback=e=>{const t=Object.keys(this.mediaQueries).find((t=>this.mediaQueries[t]===e.media));if(!t)return;const{media:s,matches:n}=e;this.changed({name:t,media:s,matches:n,event:e})};this.changed=e=>{const{name:t}=e;if(e.event){this.call(camelize(`${t}_changed`),e);this.dispatch(`${t}:changed`,e);this.log(`media query "${t}" changed`,e)}if(e.matches){this.call(camelize(`is_${t}`),e);this.dispatch(`is:${t}`,e)}else{this.call(camelize(`not_${t}`),e);this.dispatch(`not:${t}`,e)}};this.observe=()=>{Object.keys(this.mediaQueries).forEach((e=>{const t=this.mediaQueries[e];const s=window.matchMedia(t);s.addListener(this.callback);this.matches.push(s);this.changed({name:e,media:t,matches:s.matches})}))};this.unobserve=()=>{this.matches.forEach((e=>e.removeListener(this.callback)))};this.controller=e;this.mediaQueries=(s=t.mediaQueries)!==null&&s!==void 0?s:u.mediaQueries;this.dispatchEvent=(n=t.dispatchEvent)!==null&&n!==void 0?n:u.dispatchEvent;this.eventPrefix=(o=t.eventPrefix)!==null&&o!==void 0?o:u.eventPrefix;this.debug=(i=t.debug)!==null&&i!==void 0?i:u.debug;if(window.matchMedia){this.enhanceController();this.observe()}else console.error("window.matchMedia() is not available")}enhanceController(){const e=this.controller.disconnect.bind(this.controller);const disconnect=()=>{this.unobserve();e()};Object.assign(this.controller,{disconnect:disconnect})}}const useMatchMedia=(e,t={})=>{const s=new UseMatchMedia(e,t);return[s.observe,s.unobserve]};const memoize=(e,t,s)=>{Object.defineProperty(e,t,{value:s});return s};const useMemo=e=>{var t;(t=e.constructor.memos)===null||t===void 0?void 0:t.forEach((t=>{memoize(e,t,e[t])}))};const defineMetaGetter=(e,t,s)=>{const n=s?`${camelize(t)}Meta`:camelize(t);Object.defineProperty(e,n,{get(){return typeCast(metaValue(t))}})};function metaValue(e){const t=document.head.querySelector(`meta[name="${e}"]`);return t&&t.getAttribute("content")}function typeCast(e){try{return JSON.parse(e)}catch(t){return e}}const useMeta=(e,t={suffix:true})=>{const s=e.constructor.metaNames;const n=t.suffix;s===null||s===void 0?void 0:s.forEach((t=>{defineMetaGetter(e,t,n)}));Object.defineProperty(e,"metas",{get(){const e={};s===null||s===void 0?void 0:s.forEach((t=>{const s=typeCast(metaValue(t));s!==void 0&&s!==null&&(e[camelize(t)]=s)}));return e}})};class UseMutation extends StimulusUse{constructor(e,t={}){super(e,t);this.observe=()=>{try{this.observer.observe(this.targetElement,this.options)}catch(e){this.controller.application.handleError(e,"At a minimum, one of childList, attributes, and/or characterData must be true",{})}};this.unobserve=()=>{this.observer.disconnect()};this.mutation=e=>{this.call("mutate",e);this.log("mutate",{entries:e});this.dispatch("mutate",{entries:e})};this.targetElement=(t===null||t===void 0?void 0:t.element)||e.element;this.controller=e;this.options=t;this.observer=new MutationObserver(this.mutation);this.enhanceController();this.observe()}enhanceController(){const e=this.controller.disconnect.bind(this.controller);const disconnect=()=>{this.unobserve();e()};Object.assign(this.controller,{disconnect:disconnect})}}const useMutation=(e,t={})=>{const s=new UseMutation(e,t);return[s.observe,s.unobserve]};class MutationComposableController extends e{}class MutationController extends MutationComposableController{constructor(e){super(e);requestAnimationFrame((()=>{const[e,t]=useMutation(this,this.options);Object.assign(this,{observe:e,unobserve:t})}))}}const h={dispatchEvent:true,eventPrefix:true};const useResize=(e,t={})=>{const s=e;const{dispatchEvent:n,eventPrefix:o}=Object.assign({},h,t);const i=(t===null||t===void 0?void 0:t.element)||s.element;const callback=e=>{const[t]=e;method(s,"resize").call(s,t.contentRect);if(n){const e=composeEventName("resize",s,o);const n=extendedEvent(e,null,{controller:s,entry:t});i.dispatchEvent(n)}};const r=s.disconnect.bind(s);const l=new ResizeObserver(callback);const observe=()=>{l.observe(i)};const unobserve=()=>{l.unobserve(i)};Object.assign(s,{disconnect(){unobserve();r()}});observe();return[observe,unobserve]};class ResizeComposableController extends e{}class ResizeController extends ResizeComposableController{constructor(e){super(e);requestAnimationFrame((()=>{const[e,t]=useResize(this,this.options);Object.assign(this,{observe:e,unobserve:t})}))}}class UseTargetMutation extends StimulusUse{constructor(e,t={}){super(e,t);this.observe=()=>{this.observer.observe(this.targetElement,{subtree:true,characterData:true,childList:true,attributes:true,attributeOldValue:true,attributeFilter:[this.targetSelector,this.scopedTargetSelector]})};this.unobserve=()=>{this.observer.disconnect()};this.mutation=e=>{for(const t of e)switch(t.type){case"attributes":let e=t.target.getAttribute(t.attributeName);let s=t.oldValue;if(t.attributeName===this.targetSelector||t.attributeName===this.scopedTargetSelector){let n=this.targetsUsedByThisController(s);let o=this.targetsUsedByThisController(e);let i=n.filter((e=>!o.includes(e)));let r=o.filter((e=>!n.includes(e)));i.forEach((e=>this.targetRemoved(this.stripIdentifierPrefix(e),t.target,"attributeChange")));r.forEach((e=>this.targetAdded(this.stripIdentifierPrefix(e),t.target,"attributeChange")))}break;case"characterData":let n=this.findTargetInAncestry(t.target);if(n==null)return;{let e=this.targetsUsedByThisControllerFromNode(n);e.forEach((e=>{this.targetChanged(this.stripIdentifierPrefix(e),n,"domMutation")}))}break;case"childList":let{addedNodes:o,removedNodes:i}=t;o.forEach((e=>this.processNodeDOMMutation(e,this.targetAdded)));i.forEach((e=>this.processNodeDOMMutation(e,this.targetRemoved)));break}};this.controller=e;this.options=t;this.targetElement=e.element;this.identifier=e.scope.identifier;this.identifierPrefix=`${this.identifier}.`;this.targetSelector=e.scope.schema.targetAttribute;this.scopedTargetSelector=`data-${this.identifier}-target`;this.targets=t.targets||e.constructor.targets;this.prefixedTargets=this.targets.map((e=>`${this.identifierPrefix}${e}`));this.observer=new MutationObserver(this.mutation);this.enhanceController();this.observe()}processNodeDOMMutation(e,t){let s=e;let n=t;let o=[];if(s.nodeName=="#text"||this.targetsUsedByThisControllerFromNode(s).length==0){n=this.targetChanged;s=this.findTargetInAncestry(e)}else o=this.targetsUsedByThisControllerFromNode(s);if(s!=null){o.length==0&&(o=this.targetsUsedByThisControllerFromNode(s));o.forEach((e=>{n.call(this,this.stripIdentifierPrefix(e),s,"domMutation")}))}}findTargetInAncestry(e){let t=e;let s=[];t.nodeName!="#text"&&(s=this.targetsUsedByThisControllerFromNode(t));while(t.parentNode!==null&&t.parentNode!=this.targetElement&&s.length==0){t=t.parentNode;if(t.nodeName!=="#text"){let e=this.targetsUsedByThisControllerFromNode(t);if(e.length>0)return t}}return t.nodeName=="#text"||t.parentNode==null?null:t.parentNode==this.targetElement&&this.targetsUsedByThisControllerFromNode(t).length>0?t:null}targetAdded(e,t,s){let n=`${e}TargetAdded`;this.controller[n]&&method(this.controller,n).call(this.controller,t);this.warn("`[target]TargetAdded` is deprecated. Please use the built-in `[target]TargetConnected()` function from Stimulus.");this.log("targetAdded",{target:e,node:t,trigger:s})}targetRemoved(e,t,s){let n=`${e}TargetRemoved`;this.controller[n]&&method(this.controller,n).call(this.controller,t);this.warn("`[target]TargetRemoved` is deprecated. Please use the built-in `[target]TargetDisconnected()` function from Stimulus.");this.log("targetRemoved",{target:e,node:t,trigger:s})}targetChanged(e,t,s){let n=`${e}TargetChanged`;this.controller[n]&&method(this.controller,n).call(this.controller,t);this.log("targetChanged",{target:e,node:t,trigger:s})}targetsUsedByThisControllerFromNode(e){if(e.nodeName=="#text"||e.nodeName=="#comment")return[];let t=e;return this.targetsUsedByThisController(t.getAttribute(this.scopedTargetSelector)||t.getAttribute(this.targetSelector))}targetsUsedByThisController(e){e=e||"";let t=this.stripIdentifierPrefix(e).split(" ");return this.targets.filter((e=>t.indexOf(e)!==-1))}stripIdentifierPrefix(e){return e.replace(new RegExp(this.identifierPrefix,"g"),"")}enhanceController(){const e=this.controller.disconnect.bind(this.controller);const disconnect=()=>{this.unobserve();e()};Object.assign(this.controller,{disconnect:disconnect})}}const useTargetMutation=(e,t={})=>{const s=e;const n=new UseTargetMutation(s,t);n.warn("`[target]TargetAdded` and `[target]TargetRemoved` are deprecated. Please use the built-in `[target]TargetConnected()` and `[target]TargetDisconnected()` functions from Stimulus.");return[n.observe,n.unobserve]};class TargetMutationComposableController extends e{}class TargetMutationController extends TargetMutationComposableController{constructor(e){super(e);requestAnimationFrame((()=>{const[e,t]=useTargetMutation(this,this.options);Object.assign(this,{observe:e,unobserve:t})}))}}class ThrottleController extends e{}ThrottleController.throttles=[];const d=200;function throttle(e,t=d){let s;return function(){const n=arguments;const o=this;if(!s){s=true;e.apply(o,n);setTimeout((()=>s=false),t)}}}const useThrottle=(e,t={})=>{var s;const n=e;const o=n.constructor;(s=o.throttles)===null||s===void 0?void 0:s.forEach((e=>{typeof e==="string"&&(n[e]=throttle(n[e],t===null||t===void 0?void 0:t.wait));if(typeof e==="object"){const{name:s,wait:o}=e;if(!s)return;n[s]=throttle(n[s],o||(t===null||t===void 0?void 0:t.wait))}}))};const b={enterFromClass:"enter",enterActiveClass:"enterStart",enterToClass:"enterEnd",leaveFromClass:"leave",leaveActiveClass:"leaveStart",leaveToClass:"leaveEnd"};const m={transitioned:false,hiddenClass:"hidden",preserveOriginalClass:true,removeToClasses:true};const useTransition=(e,t={})=>{var s,n,o;const i=e;const r=i.element.dataset.transitionTarget;let l;r&&(l=i[`${r}Target`]);const c=(t===null||t===void 0?void 0:t.element)||l||i.element;if(!(c instanceof HTMLElement||c instanceof SVGElement))return;const a=c.dataset;const u=parseInt(a.leaveAfter||"")||t.leaveAfter||0;const{transitioned:h,hiddenClass:d,preserveOriginalClass:b,removeToClasses:v}=Object.assign({},m,t);const g=(s=i.enter)===null||s===void 0?void 0:s.bind(i);const p=(n=i.leave)===null||n===void 0?void 0:n.bind(i);const f=(o=i.toggleTransition)===null||o===void 0?void 0:o.bind(i);async function enter(e){if(i.transitioned)return;i.transitioned=true;g&&g(e);const s=getAttribute("enterFrom",t,a);const n=getAttribute("enterActive",t,a);const o=getAttribute("enterTo",t,a);const r=getAttribute("leaveTo",t,a);!d||c.classList.remove(d);v||removeClasses(c,r);await transition(c,s,n,o,d,b,v);u>0&&setTimeout((()=>{leave(e)}),u)}async function leave(e){if(!i.transitioned)return;i.transitioned=false;p&&p(e);const s=getAttribute("leaveFrom",t,a);const n=getAttribute("leaveActive",t,a);const o=getAttribute("leaveTo",t,a);const r=getAttribute("enterTo",t,a);v||removeClasses(c,r);await transition(c,s,n,o,d,b,v);!d||c.classList.add(d)}function toggleTransition(e){f&&f(e);i.transitioned?leave():enter()}async function transition(e,t,s,n,o,i,r){const l=[];if(i){t.forEach((t=>e.classList.contains(t)&&t!==o&&l.push(t)));s.forEach((t=>e.classList.contains(t)&&t!==o&&l.push(t)));n.forEach((t=>e.classList.contains(t)&&t!==o&&l.push(t)))}addClasses(e,t);removeClasses(e,l);addClasses(e,s);await nextAnimationFrame();removeClasses(e,t);addClasses(e,n);await afterTransition(e);removeClasses(e,s);r&&removeClasses(e,n);addClasses(e,l)}function initialState(){i.transitioned=h;if(h){!d||c.classList.remove(d);enter()}else{!d||c.classList.add(d);leave()}}function addClasses(e,t){t.length>0&&e.classList.add(...t)}function removeClasses(e,t){t.length>0&&e.classList.remove(...t)}initialState();Object.assign(i,{enter:enter,leave:leave,toggleTransition:toggleTransition});return[enter,leave,toggleTransition]};function getAttribute(e,t,s){const n=`transition${e[0].toUpperCase()}${e.substr(1)}`;const o=b[e];const i=t[e]||s[n]||s[o]||" ";return isEmpty(i)?[]:i.split(" ")}async function afterTransition(e){return new Promise((t=>{const s=Number(getComputedStyle(e).transitionDuration.split(",")[0].replace("s",""))*1e3;setTimeout((()=>{t(s)}),s)}))}async function nextAnimationFrame(){return new Promise((e=>{requestAnimationFrame((()=>{requestAnimationFrame(e)}))}))}function isEmpty(e){return e.length===0||!e.trim()}class TransitionComposableController extends e{constructor(){super(...arguments);this.transitioned=false}}class TransitionController extends TransitionComposableController{constructor(e){super(e);requestAnimationFrame((()=>{useTransition(this,this.options)}))}}class UseVisibility extends StimulusUse{constructor(e,t={}){super(e,t);this.observe=()=>{this.controller.isVisible=!document.hidden;document.addEventListener("visibilitychange",this.handleVisibilityChange);this.handleVisibilityChange()};this.unobserve=()=>{document.removeEventListener("visibilitychange",this.handleVisibilityChange)};this.becomesInvisible=e=>{this.controller.isVisible=false;this.call("invisible",e);this.log("invisible",{isVisible:false});this.dispatch("invisible",{event:e,isVisible:false})};this.becomesVisible=e=>{this.controller.isVisible=true;this.call("visible",e);this.log("visible",{isVisible:true});this.dispatch("visible",{event:e,isVisible:true})};this.handleVisibilityChange=e=>{document.hidden?this.becomesInvisible(e):this.becomesVisible(e)};this.controller=e;this.enhanceController();this.observe()}enhanceController(){const e=this.controllerDisconnect;const disconnect=()=>{this.unobserve();e()};Object.assign(this.controller,{disconnect:disconnect})}}const useVisibility=(e,t={})=>{const s=e;const n=new UseVisibility(s,t);return[n.observe,n.unobserve]};class VisibilityComposableController extends e{constructor(){super(...arguments);this.isVisible=false}}class VisibilityController extends VisibilityComposableController{constructor(e){super(e);requestAnimationFrame((()=>{const[e,t]=useVisibility(this,this.options);Object.assign(this,{observe:e,unobserve:t})}))}}class UseWindowFocus extends StimulusUse{constructor(e,t={}){super(e,t);this.observe=()=>{document.hasFocus()?this.becomesFocused():this.becomesUnfocused();this.interval=setInterval((()=>{this.handleWindowFocusChange()}),this.intervalDuration)};this.unobserve=()=>{clearInterval(this.interval)};this.becomesUnfocused=e=>{this.controller.hasFocus=false;this.call("unfocus",e);this.log("unfocus",{hasFocus:false});this.dispatch("unfocus",{event:e,hasFocus:false})};this.becomesFocused=e=>{this.controller.hasFocus=true;this.call("focus",e);this.log("focus",{hasFocus:true});this.dispatch("focus",{event:e,hasFocus:true})};this.handleWindowFocusChange=e=>{document.hasFocus()&&!this.controller.hasFocus?this.becomesFocused(e):!document.hasFocus()&&this.controller.hasFocus&&this.becomesUnfocused(e)};this.controller=e;this.intervalDuration=t.interval||200;this.enhanceController();this.observe()}enhanceController(){const e=this.controllerDisconnect;const disconnect=()=>{this.unobserve();e()};Object.assign(this.controller,{disconnect:disconnect})}}const useWindowFocus=(e,t={})=>{const s=e;const n=new UseWindowFocus(s,t);return[n.observe,n.unobserve]};class WindowFocusComposableController extends e{constructor(){super(...arguments);this.hasFocus=false}}class WindowFocusController extends WindowFocusComposableController{constructor(e){super(e);requestAnimationFrame((()=>{const[e,t]=useWindowFocus(this,this.options);Object.assign(this,{observe:e,unobserve:t})}))}}const useWindowResize=e=>{const t=e;const callback=e=>{const{innerWidth:s,innerHeight:n}=window;const o={height:n||Infinity,width:s||Infinity,event:e};method(t,"windowResize").call(t,o)};const s=t.disconnect.bind(t);const observe=()=>{window.addEventListener("resize",callback);callback()};const unobserve=()=>{window.removeEventListener("resize",callback)};Object.assign(t,{disconnect(){unobserve();s()}});observe();return[observe,unobserve]};class WindowResizeComposableController extends e{}class WindowResizeController extends WindowResizeComposableController{constructor(e){super(e);requestAnimationFrame((()=>{const[e,t]=useWindowResize(this);Object.assign(this,{observe:e,unobserve:t})}))}}function useHotkeys(){throw"[stimulus-use] Notice: The import for `useHotkeys()` has been moved from `stimulus-use` to `stimulus-use/hotkeys`. \nPlease change the import accordingly and add `hotkey-js` as a dependency to your project. \n\nFor more information see: https://stimulus-use.github.io/stimulus-use/#/use-hotkeys?id=importing-the-behavior"}export{ApplicationController,ClickOutsideController,HoverController,IdleController,IntersectionController,LazyLoadController,MutationController,ResizeController,TargetMutationController,TransitionController,UseHover,UseMutation,UseTargetMutation,UseVisibility,UseWindowFocus,VisibilityController,WindowFocusController,WindowResizeController,debounce,useApplication,useClickOutside,useDebounce,useDispatch,useHotkeys,useHover,useIdle,useIntersection,useLazyLoad,useMatchMedia,useMemo,useMeta,useMutation,useResize,useTargetMutation,useThrottle,useTransition,useVisibility,useWindowFocus,useWindowResize};
4
+