1const{Core,Utils,DOMEvents}=Global,{$fetch,$replaceContent,$active}=Utils,ENTER_KEYCODE=13,animationsComplete=element=>Promise.allSettled(element.getAnimations().map(animation=>animation.finished));customElements.define("modal-container",class extends Core{elements={$:["dialog","content","spinner"]};propTypes={"remote-url":String,"remote-target":String,"remote-detach":Boolean};render(){this.$("dialog",{click:this._handleBackdropClick}),this.$({"modal-close":this._close,"modal-open":this._open})}open(){this.dispatchEvent(DOMEvents.MODAL_OPEN)}close(){this.dispatchEvent(DOMEvents.MODAL_CLOSE)}refreshLayer(){this.$("dialog").close(),this.$("dialog").showModal()}_handleBackdropClick({target}){target===this.$("dialog")&&this.dispatchEvent(DOMEvents.MODAL_CLOSE)}async _loadRemoteContent(){try{this.$remoteContent=await $fetch(this.prop("remote-url"),{before:this._loading(!0),after:this._loading(!1),select:this.prop("remote-target")})}catch(err){console.error(err)}}_loading(state){return()=>{$active(this.$("spinner"),state)}}_attachRemoteContent(){this.$remoteContent&&this.$("content").append(this.$remoteContent)}_detachRemoteContent(){this.$remoteContent&&this.prop("remote-detach")&&this.$remoteContent.remove()}async _handleRemoteContent(){this.prop("remote-url")&&this.prop("remote-target")&&!this.$remoteContent&&await this._loadRemoteContent(),this._attachRemoteContent()}async _open(){this.$("dialog").open||(this.$("dialog").showModal(),await this._handleRemoteContent(),this.setAttribute("opening",""),await animationsComplete(this.$("content")),this.removeAttribute("opening"),this.$("dialog").dispatchEvent(new CustomEvent("modal-open",{bubbles:!0})))}async _close(e){e?.preventDefault(),this.$("dialog").open&&(this.setAttribute("closing",""),await animationsComplete(this.$("content")),this.$("dialog").close(),this.removeAttribute("closing"),this._detachRemoteContent())}}),customElements.define("modal-open",class extends Core{propTypes={target:String,fallback:String};render(){this.$target=document.getElementById(this.prop("target")),this._handleClick()}async _handleClick(){await customElements.whenDefined("modal-container"),this.$({click:this._openTargetModal,keydown:this._openOnEnterPressed})}_openOnEnterPressed(e){e.keyCode===ENTER_KEYCODE&&this._openTargetModal()}_openTargetModal(){if(!this.$target){this.prop("fallback")&&(window.location.href=this.prop("fallback"));return}this.$target.dispatchEvent(DOMEvents.MODAL_OPEN)}}),customElements.define("modal-close",class extends Core{render(){this.$({click:this._emitClose})}_emitClose(){this.dispatchEvent(DOMEvents.MODAL_CLOSE)}}); 2//# sourceMappingURL=/cdn/shop/t/57/assets/modal.js.map?v=144325349831045053721766012179
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.