!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var r=t();for(var i in r)("object"==typeof exports?exports:e)[i]=r[i]}}(Depicter,(()=>(()=>{"use strict";var e={};(e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})})(e);const{Layer:t,env:r,utils:i}=window.Depicter;return window.Depicter.externalLayers.hoverSwitch=class extends t{constructor(e,t,i,s,o,a){super(e,t,i,s,o,a),this.type="hoverSwitch",this.frame.classList.add(`${r.prefix}-hover-switch-layer`)}_setupContent(){this.holder.readyTrigger.hold(),this.primaryPicture=this.element.querySelector(`.${r.prefix}-primary`),this.secondaryPicture=this.element.querySelector(`.${r.prefix}-secondary`),this.duration=parseFloat(this.element.dataset.switchDuration)||.5,this.primaryImg=this.primaryPicture.querySelector("img"),this.secondaryImg=this.secondaryPicture.querySelector("img"),this.primaryImg.style.transition=`opacity ${this.duration}s`,this._remainingImages=2,this.holder.on("loadingStart",this._loadImages,this)}_loadImages(){const e=()=>{this._remainingImages-=1,this._remainingImages<=0&&!this.holder.readyTrigger.isExecuted()&&(this.holder.readyTrigger.exec(),this.primaryImg.classList.add(`${r.prefix}-loaded`),this.secondaryImg.classList.add(`${r.prefix}-loaded`))};i.loadPicture(this.primaryPicture,e,e),i.loadPicture(this.secondaryPicture,e,e)}},e})()));