1 line
72 KiB
JavaScript
1 line
72 KiB
JavaScript
|
(self.webpackChunk=self.webpackChunk||[]).push([[3],{6599:(t,e,r)=>{"use strict";r.d(e,{Mx:()=>Y,Qr:()=>it});class n{constructor(t,e,r){this.eventTarget=t,this.eventName=e,this.eventOptions=r,this.unorderedBindings=new Set}connect(){this.eventTarget.addEventListener(this.eventName,this,this.eventOptions)}disconnect(){this.eventTarget.removeEventListener(this.eventName,this,this.eventOptions)}bindingConnected(t){this.unorderedBindings.add(t)}bindingDisconnected(t){this.unorderedBindings.delete(t)}handleEvent(t){const e=function(t){if("immediatePropagationStopped"in t)return t;{const{stopImmediatePropagation:e}=t;return Object.assign(t,{immediatePropagationStopped:!1,stopImmediatePropagation(){this.immediatePropagationStopped=!0,e.call(this)}})}}(t);for(const t of this.bindings){if(e.immediatePropagationStopped)break;t.handleEvent(e)}}hasBindings(){return this.unorderedBindings.size>0}get bindings(){return Array.from(this.unorderedBindings).sort(((t,e)=>{const r=t.index,n=e.index;return r<n?-1:r>n?1:0}))}}class i{constructor(t){this.application=t,this.eventListenerMaps=new Map,this.started=!1}start(){this.started||(this.started=!0,this.eventListeners.forEach((t=>t.connect())))}stop(){this.started&&(this.started=!1,this.eventListeners.forEach((t=>t.disconnect())))}get eventListeners(){return Array.from(this.eventListenerMaps.values()).reduce(((t,e)=>t.concat(Array.from(e.values()))),[])}bindingConnected(t){this.fetchEventListenerForBinding(t).bindingConnected(t)}bindingDisconnected(t,e=!1){this.fetchEventListenerForBinding(t).bindingDisconnected(t),e&&this.clearEventListenersForBinding(t)}handleError(t,e,r={}){this.application.handleError(t,`Error ${e}`,r)}clearEventListenersForBinding(t){const e=this.fetchEventListenerForBinding(t);e.hasBindings()||(e.disconnect(),this.removeMappedEventListenerFor(t))}removeMappedEventListenerFor(t){const{eventTarget:e,eventName:r,eventOptions:n}=t,i=this.fetchEventListenerMapForEventTarget(e),s=this.cacheKey(r,n);i.delete(s),0==i.size&&this.eventListenerMaps.delete(e)}fetchEventListenerForBinding(t){const{eventTarget:e,eventName:r,eventOptions:n}=t;return this.fetchEventListener(e,r,n)}fetchEventListener(t,e,r){const n=this.fetchEventListenerMapForEventTarget(t),i=this.cacheKey(e,r);let s=n.get(i);return s||(s=this.createEventListener(t,e,r),n.set(i,s)),s}createEventListener(t,e,r){const i=new n(t,e,r);return this.started&&i.connect(),i}fetchEventListenerMapForEventTarget(t){let e=this.eventListenerMaps.get(t);return e||(e=new Map,this.eventListenerMaps.set(t,e)),e}cacheKey(t,e){const r=[t];return Object.keys(e).sort().forEach((t=>{r.push(`${e[t]?"":"!"}${t}`)})),r.join(":")}}const s={stop:({event:t,value:e})=>(e&&t.stopPropagation(),!0),prevent:({event:t,value:e})=>(e&&t.preventDefault(),!0),self:({event:t,value:e,element:r})=>!e||r===t.target},o=/^(?:(.+?)(?:\.(.+?))?(?:@(window|document))?->)?(.+?)(?:#([^:]+?))(?::(.+))?$/;function a(t){return"window"==t?window:"document"==t?document:void 0}function c(t){return t.replace(/(?:[_-])([a-z0-9])/g,((t,e)=>e.toUpperCase()))}function u(t){return c(t.replace(/--/g,"-").replace(/__/g,"_"))}function l(t){return t.charAt(0).toUpperCase()+t.slice(1)}function h(t){return t.replace(/([A-Z])/g,((t,e)=>`-${e.toLowerCase()}`))}class d{constructor(t,e,r,n){this.element=t,this.index=e,this.eventTarget=r.eventTarget||t,this.eventName=r.eventName||function(t){const e=t.tagName.toLowerCase();if(e in f)return f[e](t)}(t)||p("missing event name"),this.eventOptions=r.eventOptions||{},this.identifier=r.identifier||p("missing identifier"),this.methodName=r.methodName||p("missing method name"),this.keyFilter=r.keyFilter||"",this.schema=n}static forToken(t,e){return new this(t.element,t.index,function(t){const e=t.trim().match(o)||[];let r=e[1],n=e[2];return n&&!["keydown","keyup","keypress"].includes(r)&&(r+=`.${n}`,n=""),{eventTarget:a(e[3]),eventName:r,eventOptions:e[6]?(i=e[6],i.split(":").reduce(((t,e)=>Object.assign(t,{[e.replace(/^!/,"")]:!/^!/.test(e)})),{})):{},identifier:e[4],methodName:e[5],keyFilter:n};var i}(t.content),e)}toString(){const t=this.keyF
|