/*! For license information please see video-core.js.LICENSE.txt */ !function(){var t={9089:function(t){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var i="",r=void 0!==e[5];return e[4]&&(i+="@supports (".concat(e[4],") {")),e[2]&&(i+="@media ".concat(e[2]," {")),r&&(i+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),i+=t(e),r&&(i+="}"),e[2]&&(i+="}"),e[4]&&(i+="}"),i})).join("")},e.i=function(t,i,r,n,a){"string"==typeof t&&(t=[[null,t,void 0]]);var s={};if(r)for(var o=0;o0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=a),i&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=i):d[2]=i),n&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=n):d[4]="".concat(n)),e.push(d))}},e}},9248:function(t){"use strict";t.exports=function(t){return t[1]}},9446:function(t){var e;"undefined"!=typeof window&&(e=function(){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var n=e[r]={i:r,l:!1,exports:{}};return t[r].call(n.exports,n,n.exports,i),n.l=!0,n.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var n in t)i.d(r,n,function(e){return t[e]}.bind(null,n));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="/dist/",i(i.s="./src/hls.ts")}({"./node_modules/eventemitter3/index.js":function(t,e,i){"use strict";var r=Object.prototype.hasOwnProperty,n="~";function a(){}function s(t,e,i){this.fn=t,this.context=e,this.once=i||!1}function o(t,e,i,r,a){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new s(i,r||t,a),l=n?n+e:e;return t._events[l]?t._events[l].fn?t._events[l]=[t._events[l],o]:t._events[l].push(o):(t._events[l]=o,t._eventsCount++),t}function l(t,e){0==--t._eventsCount?t._events=new a:delete t._events[e]}function c(){this._events=new a,this._eventsCount=0}Object.create&&(a.prototype=Object.create(null),(new a).__proto__||(n=!1)),c.prototype.eventNames=function(){var t,e,i=[];if(0===this._eventsCount)return i;for(e in t=this._events)r.call(t,e)&&i.push(n?e.slice(1):e);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(t)):i},c.prototype.listeners=function(t){var e=n?n+t:t,i=this._events[e];if(!i)return[];if(i.fn)return[i.fn];for(var r=0,a=i.length,s=new Array(a);r0}),!1)}t.exports=function(t,e){e=e||{};var n={main:i.m},a=e.all?{main:Object.keys(n.main)}:function(t,e){for(var i={main:[e]},r={main:[]},n={main:{}};l(i);)for(var a=Object.keys(i),s=0;s=2*u/p||A<=_)){var w,C=Number.POSITIVE_INFINITY;for(w=t.level-1;w>f&&!((C=u*g[w].maxBitrate/(6.4*y))<_);w--);if(!(C>=A)){var E=this.bwEstimator.getEstimate();c.logger.warn("Fragment "+t.sn+(e?" part "+e.index:"")+" of level "+t.level+" is loading too slowly and will cause an underbuffer; aborting and switching to level "+w+"\n Current BW estimate: "+(Object(r.isFiniteNumber)(E)?(E/1024).toFixed(3):"Unknown")+" Kb/s\n Estimated load time for current fragment: "+A.toFixed(3)+" s\n Estimated load time for the next fragment: "+C.toFixed(3)+" s\n Time to underbuffer: "+_.toFixed(3)+" s"),i.nextLoadLevel=w,this.bwEstimator.sample(h,d.loaded),this.clearTimer(),t.loader&&(this.fragCurrent=this.partCurrent=null,t.loader.abort()),i.trigger(a.Events.FRAG_LOAD_EMERGENCY_ABORTED,{frag:t,part:e,stats:d})}}}}}},u.onFragLoaded=function(t,e){var i=e.frag,n=e.part;if(i.type===l.PlaylistLevelType.MAIN&&Object(r.isFiniteNumber)(i.sn)){var s=n?n.stats:i.stats,o=n?n.duration:i.duration;if(this.clearTimer(),this.lastLoadedFragLevel=i.level,this._nextAutoLevel=-1,this.hls.config.abrMaxWithRealBitrate){var c=this.hls.levels[i.level],d=(c.loaded?c.loaded.bytes:0)+s.loaded,u=(c.loaded?c.loaded.duration:0)+o;c.loaded={bytes:d,duration:u},c.realBitrate=Math.round(8*d/u)}if(i.bitrateTest){var h={stats:s,frag:i,part:n,id:i.type};this.onFragBuffered(a.Events.FRAG_BUFFERED,h)}}},u.onFragBuffered=function(t,e){var i=e.frag,r=e.part,n=r?r.stats:i.stats;if(!n.aborted&&i.type===l.PlaylistLevelType.MAIN&&"initSegment"!==i.sn){var a=n.parsing.end-n.loading.start;this.bwEstimator.sample(a,n.loaded),n.bwEstimate=this.bwEstimator.getEstimate(),i.bitrateTest?this.bitrateTestDelay=a/1e3:this.bitrateTestDelay=0}},u.onError=function(t,e){switch(e.details){case o.ErrorDetails.FRAG_LOAD_ERROR:case o.ErrorDetails.FRAG_LOAD_TIMEOUT:this.clearTimer()}},u.clearTimer=function(){self.clearInterval(this.timer),this.timer=void 0},u.getNextABRAutoLevel=function(){var t=this.fragCurrent,e=this.partCurrent,i=this.hls,r=i.maxAutoLevel,n=i.config,a=i.minAutoLevel,o=i.media,l=e?e.duration:t?t.duration:0,d=o?o.currentTime:0,u=o&&0!==o.playbackRate?Math.abs(o.playbackRate):1,h=this.bwEstimator?this.bwEstimator.getEstimate():n.abrEwmaDefaultEstimate,p=(s.BufferHelper.bufferInfo(o,d,n.maxBufferHole).end-d)/u,g=this.findBestLevel(h,a,r,p,n.abrBandWidthFactor,n.abrBandWidthUpFactor);if(g>=0)return g;c.logger.trace((p?"rebuffering expected":"buffer is empty")+", finding optimal quality level");var f=l?Math.min(l,n.maxStarvationDelay):n.maxStarvationDelay,m=n.abrBandWidthFactor,v=n.abrBandWidthUpFactor;if(!p){var y=this.bitrateTestDelay;y&&(f=(l?Math.min(l,n.maxLoadingDelay):n.maxLoadingDelay)-y,c.logger.trace("bitrate test took "+Math.round(1e3*y)+"ms, set first fragment max fetchDuration to "+Math.round(1e3*f)+" ms"),m=v=1)}return g=this.findBestLevel(h,a,r,p+f,m,v),Math.max(g,0)},u.findBestLevel=function(t,e,i,r,n,a){for(var s,o=this.fragCurrent,l=this.partCurrent,d=this.lastLoadedFragLevel,u=this.hls.levels,h=u[d],p=!(null==h||null===(s=h.details)||void 0===s||!s.live),g=null==h?void 0:h.codecSet,f=l?l.duration:o?o.duration:0,m=i;m>=e;m--){var v=u[m];if(v&&(!g||v.codecSet===g)){var y,A=v.details,b=(l?null==A?void 0:A.partTarget:null==A?void 0:A.averagetargetduration)||f;y=m<=d?n*t:a*t;var _=u[m].maxBitrate,w=_*b/y;if(c.logger.trace("level/adjustedbw/bitrate/avgDuration/maxFetchDuration/fetchDuration: "+m+"/"+Math.round(y)+"/"+_+"/"+b+"/"+r+"/"+w),y>_&&(!w||p&&!this.bitrateTestDelay||w0&&-1===t?(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e,this.state=n.State.IDLE):(this.loadedmetadata=!1,this.state=n.State.WAITING_TRACK),this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()},b.doTick=function(){switch(this.state){case n.State.IDLE:this.doTickIdle();break;case n.State.WAITING_TRACK:var e,i=this.levels,r=this.trackId,a=null==i||null===(e=i[r])||void 0===e?void 0:e.details;if(a){if(this.waitForCdnTuneIn(a))break;this.state=n.State.WAITING_INIT_PTS}break;case n.State.FRAG_LOADING_WAITING_RETRY:var o,l=performance.now(),c=this.retryDate;(!c||l>=c||null!==(o=this.media)&&void 0!==o&&o.seeking)&&(this.log("RetryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.trackId),this.state=n.State.IDLE);break;case n.State.WAITING_INIT_PTS:var d=this.waitingData;if(d){var u=d.frag,h=d.part,p=d.cache,f=d.complete;if(void 0!==this.initPTS[u.cc]){this.waitingData=null,this.waitingVideoCC=-1,this.state=n.State.FRAG_LOADING;var m={frag:u,part:h,payload:p.flush(),networkDetails:null};this._handleFragmentLoadProgress(m),f&&t.prototype._handleFragmentLoadComplete.call(this,m)}else if(this.videoTrackCC!==this.waitingVideoCC)this.log("Waiting fragment cc ("+u.cc+") cancelled because video is at cc "+this.videoTrackCC),this.clearWaitingFragment();else{var v=this.getLoadPosition(),y=s.BufferHelper.bufferInfo(this.mediaBuffer,v,this.config.maxBufferHole);Object(g.fragmentWithinToleranceTest)(y.end,this.config.maxFragLookUpTolerance,u)<0&&(this.log("Waiting fragment cc ("+u.cc+") @ "+u.start+" cancelled because another fragment at "+y.end+" is needed"),this.clearWaitingFragment())}}else this.state=n.State.IDLE}this.onTickEnd()},b.clearWaitingFragment=function(){var t=this.waitingData;t&&(this.fragmentTracker.removeFragment(t.frag),this.waitingData=null,this.waitingVideoCC=-1,this.state=n.State.IDLE)},b.resetLoadingState=function(){this.clearWaitingFragment(),t.prototype.resetLoadingState.call(this)},b.onTickEnd=function(){var t=this.media;if(t&&t.readyState){var e=(this.mediaBuffer?this.mediaBuffer:t).buffered;!this.loadedmetadata&&e.length&&(this.loadedmetadata=!0),this.lastCurrentTime=t.currentTime}},b.doTickIdle=function(){var t,e,i=this.hls,r=this.levels,s=this.media,o=this.trackId,l=i.config;if(r&&r[o]&&(s||!this.startFragRequested&&l.startFragPrefetch)){var u=r[o].details;if(!u||u.live&&this.levelLastLoaded!==o||this.waitForCdnTuneIn(u))this.state=n.State.WAITING_TRACK;else{var h=this.mediaBuffer?this.mediaBuffer:this.media;this.bufferFlushed&&h&&(this.bufferFlushed=!1,this.afterBufferFlushed(h,d.ElementaryStreamTypes.AUDIO,c.PlaylistLevelType.AUDIO));var p=this.getFwdBufferInfo(h,c.PlaylistLevelType.AUDIO);if(null!==p){var g=this.getFwdBufferInfo(this.videoBuffer?this.videoBuffer:this.media,c.PlaylistLevelType.MAIN),f=p.len,m=this.getMaxBufferLength(null==g?void 0:g.len),v=this.audioSwitch;if(!(f>=m)||v){if(!v&&this._streamEnded(p,u))return i.trigger(a.Events.BUFFER_EOS,{type:"audio"}),void(this.state=n.State.ENDED);var y=u.fragments[0].start,A=p.end;if(v&&s){var b=this.getLoadPosition();A=b,u.PTSKnown&&by||p.nextStart)&&(this.log("Alt audio track ahead of main track, seek to start of alt audio track"),s.currentTime=y+.05)}if(!(g&&A>g.end+u.targetduration)&&(g&&g.len||!p.len)){var _=this.getNextFragment(A,u);_?"identity"!==(null===(t=_.decryptdata)||void 0===t?void 0:t.keyFormat)||null!==(e=_.decryptdata)&&void 0!==e&&e.key?this.loadFragment(_,u,A):this.loadKey(_,u):this.bufferFlushed=!0}}}}}},b.getMaxBufferLength=function(e){var i=t.prototype.getMaxBufferLength.call(this);return e?Math.max(i,e):i},b.onMediaDetaching=function(){this.videoBuffer=null,t.prototype.onMediaDetaching.call(this)},b.onAudioTracksUpdated=function(t,e){var i=e.audioTracks;this.resetTransmuxer(),this.levels=i.map((function(t){return new l.Level(t)}))},b.onAudioTrackSwitching=function(t,e){var i=!!e.url;this.trackId=e.id;var r=this.fragCurrent;null!=r&&r.loader&&r.loader.abort(),this.fragCurrent=null,this.clearWaitingFragment(),i?this.setInterval(100):this.resetTransmuxer(),i?(this.audioSwitch=!0,this.state=n.State.IDLE):this.state=n.State.STOPPED,this.tick()},b.onManifestLoading=function(){this.mainDetails=null,this.fragmentTracker.removeAllFragments(),this.startPosition=this.lastCurrentTime=0,this.bufferFlushed=!1},b.onLevelLoaded=function(t,e){this.mainDetails=e.details,null!==this.cachedTrackLoadedData&&(this.hls.trigger(a.Events.AUDIO_TRACK_LOADED,this.cachedTrackLoadedData),this.cachedTrackLoadedData=null)},b.onAudioTrackLoaded=function(t,e){var i;if(null!=this.mainDetails){var r=this.levels,a=e.details,s=e.id;if(r){this.log("Track "+s+" loaded ["+a.startSN+","+a.endSN+"],duration:"+a.totalduration);var o=r[s],l=0;if(a.live||null!==(i=o.details)&&void 0!==i&&i.live){var c=this.mainDetails;if(a.fragments[0]||(a.deltaUpdateFailed=!0),a.deltaUpdateFailed||!c)return;!o.details&&a.hasProgramDateTime&&c.hasProgramDateTime?(Object(f.alignMediaPlaylistByPDT)(a,c),l=a.fragments[0].start):l=this.alignPlaylists(a,o.details)}o.details=a,this.levelLastLoaded=s,this.startFragRequested||!this.mainDetails&&a.live||this.setStartPosition(o.details,l),this.state!==n.State.WAITING_TRACK||this.waitForCdnTuneIn(a)||(this.state=n.State.IDLE),this.tick()}else this.warn("Audio tracks were reset while loading level "+s)}else this.cachedTrackLoadedData=e},b._handleFragmentLoadProgress=function(t){var e,i=t.frag,r=t.part,a=t.payload,s=this.config,o=this.trackId,l=this.levels;if(l){var d=l[o];console.assert(d,"Audio track is defined on fragment load progress");var g=d.details;console.assert(g,"Audio track details are defined on fragment load progress");var f=s.defaultAudioCodec||d.audioCodec||"mp4a.40.2",m=this.transmuxer;m||(m=this.transmuxer=new h.default(this.hls,c.PlaylistLevelType.AUDIO,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)));var v=this.initPTS[i.cc],y=null===(e=i.initSegment)||void 0===e?void 0:e.data;if(void 0!==v){var A=r?r.index:-1,b=-1!==A,_=new p.ChunkMetadata(i.level,i.sn,i.stats.chunkCount,a.byteLength,A,b);m.push(a,y,f,"",i,r,g.totalduration,!1,_,v)}else this.log("Unknown video PTS for cc "+i.cc+", waiting for video PTS before demuxing audio frag "+i.sn+" of ["+g.startSN+" ,"+g.endSN+"],track "+o),(this.waitingData=this.waitingData||{frag:i,part:r,cache:new u.default,complete:!1}).cache.push(new Uint8Array(a)),this.waitingVideoCC=this.videoTrackCC,this.state=n.State.WAITING_INIT_PTS}else this.warn("Audio tracks were reset while fragment load was in progress. Fragment "+i.sn+" of level "+i.level+" will not be buffered")},b._handleFragmentLoadComplete=function(e){this.waitingData?this.waitingData.complete=!0:t.prototype._handleFragmentLoadComplete.call(this,e)},b.onBufferReset=function(){this.mediaBuffer=this.videoBuffer=null,this.loadedmetadata=!1},b.onBufferCreated=function(t,e){var i=e.tracks.audio;i&&(this.mediaBuffer=i.buffer||null),e.tracks.video&&(this.videoBuffer=e.tracks.video.buffer||null)},b.onFragBuffered=function(t,e){var i=e.frag,r=e.part;i.type===c.PlaylistLevelType.AUDIO&&(this.fragContextChanged(i)?this.warn("Fragment "+i.sn+(r?" p: "+r.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state+", audioSwitch: "+this.audioSwitch):("initSegment"!==i.sn&&(this.fragPrevious=i,this.audioSwitch&&(this.audioSwitch=!1,this.hls.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:this.trackId}))),this.fragBufferedComplete(i,r)))},b.onError=function(e,i){switch(i.details){case m.ErrorDetails.FRAG_LOAD_ERROR:case m.ErrorDetails.FRAG_LOAD_TIMEOUT:case m.ErrorDetails.KEY_LOAD_ERROR:case m.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.AUDIO,i);break;case m.ErrorDetails.AUDIO_TRACK_LOAD_ERROR:case m.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:this.state!==n.State.ERROR&&this.state!==n.State.STOPPED&&(this.state=i.fatal?n.State.ERROR:n.State.IDLE,this.warn(i.details+" while loading frag, switching to "+this.state+" state"));break;case m.ErrorDetails.BUFFER_FULL_ERROR:if("audio"===i.parent&&(this.state===n.State.PARSING||this.state===n.State.PARSED)){var r=!0,a=this.getFwdBufferInfo(this.mediaBuffer,c.PlaylistLevelType.AUDIO);a&&a.len>.5&&(r=!this.reduceMaxBufferLength(a.len)),r&&(this.warn("Buffer full error also media.currentTime is not buffered, flush audio buffer"),this.fragCurrent=null,t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.resetLoadingState()}}},b.onBufferFlushed=function(t,e){e.type===d.ElementaryStreamTypes.AUDIO&&(this.bufferFlushed=!0)},b._handleTransmuxComplete=function(t){var e,i="audio",r=this.hls,s=t.remuxResult,o=t.chunkMeta,l=this.getCurrentContext(o);if(!l)return this.warn("The loading context changed while buffering fragment "+o.sn+" of level "+o.level+". This chunk will not be buffered."),void this.resetStartWhenNotLoaded(o.level);var c=l.frag,u=l.part,h=l.level.details,p=s.audio,g=s.text,f=s.id3,m=s.initSegment;if(!this.fragContextChanged(c)&&h){if(this.state=n.State.PARSING,this.audioSwitch&&p&&this.completeAudioSwitch(),null!=m&&m.tracks&&(this._bufferInitSegment(m.tracks,c,o),r.trigger(a.Events.FRAG_PARSING_INIT_SEGMENT,{frag:c,id:i,tracks:m.tracks})),p){var y=p.startPTS,A=p.endPTS,b=p.startDTS,_=p.endDTS;u&&(u.elementaryStreams[d.ElementaryStreamTypes.AUDIO]={startPTS:y,endPTS:A,startDTS:b,endDTS:_}),c.setElementaryStreamInfo(d.ElementaryStreamTypes.AUDIO,y,A,b,_),this.bufferFragmentData(p,c,u,o)}if(null!=f&&null!==(e=f.samples)&&void 0!==e&&e.length){var w=v({id:i,frag:c,details:h},f);r.trigger(a.Events.FRAG_PARSING_METADATA,w)}if(g){var C=v({id:i,frag:c,details:h},g);r.trigger(a.Events.FRAG_PARSING_USERDATA,C)}}},b._bufferInitSegment=function(t,e,i){if(this.state===n.State.PARSING){t.video&&delete t.video;var r=t.audio;if(r){r.levelCodec=r.codec,r.id="audio",this.log("Init audio buffer, container:"+r.container+", codecs[parsed]=["+r.codec+"]"),this.hls.trigger(a.Events.BUFFER_CODECS,t);var s=r.initSegment;if(null!=s&&s.byteLength){var o={type:"audio",frag:e,part:null,chunkMeta:i,parent:e.type,data:s};this.hls.trigger(a.Events.BUFFER_APPENDING,o)}this.tick()}}},b.loadFragment=function(e,i,a){var s=this.fragmentTracker.getState(e);this.fragCurrent=e,(this.audioSwitch||s===o.FragmentState.NOT_LOADED||s===o.FragmentState.PARTIAL)&&("initSegment"===e.sn?this._loadInitSegment(e):i.live&&!Object(r.isFiniteNumber)(this.initPTS[e.cc])?(this.log("Waiting for video PTS in continuity counter "+e.cc+" of live stream before loading audio fragment "+e.sn+" of level "+this.trackId),this.state=n.State.WAITING_INIT_PTS):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,i,a)))},b.completeAudioSwitch=function(){var e=this.hls,i=this.media,r=this.trackId;i&&(this.log("Switching audio track : flushing all audio"),t.prototype.flushMainBuffer.call(this,0,Number.POSITIVE_INFINITY,"audio")),this.audioSwitch=!1,e.trigger(a.Events.AUDIO_TRACK_SWITCHED,{id:r})},A}(n.default);e.default=A},"./src/controller/audio-track-controller.ts":function(t,e,i){"use strict";i.r(e);var r=i("./src/events.ts"),n=i("./src/errors.ts"),a=i("./src/controller/base-playlist-controller.ts"),s=i("./src/types/loader.ts");function o(t,e){for(var i=0;i=e.length)this.warn("Invalid id passed to audio-track controller");else{this.clearTimer();var i=e[this.trackId];this.log("Now switching to audio-track index "+t);var n=e[t],a=n.id,s=n.groupId,o=void 0===s?"":s,l=n.name,c=n.type,d=n.url;if(this.trackId=t,this.trackName=l,this.selectDefaultTrack=!1,this.hls.trigger(r.Events.AUDIO_TRACK_SWITCHING,{id:a,groupId:o,name:l,type:c,url:d}),!n.details||n.details.live){var u=this.switchParams(n.url,null==i?void 0:i.details);this.loadPlaylist(u)}}},u.selectInitialTrack=function(){var t=this.tracksInGroup;console.assert(t.length,"Initial audio track should be selected when tracks are known");var e=this.trackName,i=this.findTrackId(e)||this.findTrackId();-1!==i?this.setAudioTrack(i):(this.warn("No track found for running audio group-ID: "+this.groupId),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,fatal:!0}))},u.findTrackId=function(t){for(var e=this.tracksInGroup,i=0;ie.partTarget&&(c+=1)}if(Object(r.isFiniteNumber)(l))return new n.HlsUrlParameters(l,Object(r.isFiniteNumber)(c)?c:void 0,n.HlsSkip.No)}}},e.loadPlaylist=function(t){},e.shouldLoadTrack=function(t){return this.canLoad&&t&&!!t.url&&(!t.details||t.details.live)},e.playlistLoaded=function(t,e,i){var r=this,n=e.details,s=e.stats,o=s.loading.end?Math.max(0,self.performance.now()-s.loading.end):0;if(n.advancedDateTime=Date.now()-o,n.live||null!=i&&i.live){if(n.reloaded(i),i&&this.log("live playlist "+t+" "+(n.advanced?"REFRESHED "+n.lastPartSn+"-"+n.lastPartIndex:"MISSED")),i&&n.fragments.length>0&&Object(a.mergeDetails)(i,n),!this.canLoad||!n.live)return;var l,c=void 0,d=void 0;if(n.canBlockReload&&n.endSN&&n.advanced){var u=this.hls.config.lowLatencyMode,h=n.lastPartSn,p=n.endSN,g=n.lastPartIndex,f=h===p;-1!==g?(c=f?p+1:h,d=f?u?0:g:g+1):c=p+1;var m=n.age,v=m+n.ageHeader,y=Math.min(v-n.partTarget,1.5*n.targetduration);if(y>0){if(i&&y>i.tuneInGoal)this.warn("CDN Tune-in goal increased from: "+i.tuneInGoal+" to: "+y+" with playlist age: "+n.age),y=0;else{var A=Math.floor(y/n.targetduration);c+=A,void 0!==d&&(d+=Math.round(y%n.targetduration/n.partTarget)),this.log("CDN Tune-in age: "+n.ageHeader+"s last advanced "+m.toFixed(2)+"s goal: "+y+" skip sn "+A+" to part "+d)}n.tuneInGoal=y}if(l=this.getDeliveryDirectives(n,e.deliveryDirectives,c,d),u||!f)return void this.loadPlaylist(l)}else l=this.getDeliveryDirectives(n,e.deliveryDirectives,c,d);var b=Object(a.computeReloadInterval)(n,s);void 0!==c&&n.canBlockReload&&(b-=n.partTarget||1),this.log("reload live playlist "+t+" in "+Math.round(b)+" ms"),this.timer=self.setTimeout((function(){return r.loadPlaylist(l)}),b)}else this.clearTimer()},e.getDeliveryDirectives=function(t,e,i,r){var a=Object(n.getSkipValue)(t,i);return null!=e&&e.skip&&t.deltaUpdateFailed&&(i=e.msn,r=e.part,a=n.HlsSkip.No),new n.HlsUrlParameters(i,r,a)},e.retryLoadingOrFail=function(t){var e,i=this,r=this.hls.config,n=this.retryCount-1&&null!==(e=t.context)&&void 0!==e&&e.deliveryDirectives)this.warn("retry playlist loading #"+this.retryCount+' after "'+t.details+'"'),this.loadPlaylist();else{var a=Math.min(Math.pow(2,this.retryCount)*r.levelLoadingRetryDelay,r.levelLoadingMaxRetryTimeout);this.timer=self.setTimeout((function(){return i.loadPlaylist()}),a),this.warn("retry playlist loading #"+this.retryCount+" in "+a+' ms after "'+t.details+'"')}else this.warn('cannot recover from error "'+t.details+'"'),this.clearTimer(),t.fatal=!0;return n},t}()},"./src/controller/base-stream-controller.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"State",(function(){return w})),i.d(e,"default",(function(){return C}));var r=i("./src/polyfills/number.ts"),n=i("./src/task-loop.ts"),a=i("./src/controller/fragment-tracker.ts"),s=i("./src/utils/buffer-helper.ts"),o=i("./src/utils/logger.ts"),l=i("./src/events.ts"),c=i("./src/errors.ts"),d=i("./src/types/transmuxer.ts"),u=i("./src/utils/mp4-tools.ts"),h=i("./src/utils/discontinuities.ts"),p=i("./src/controller/fragment-finders.ts"),g=i("./src/controller/level-helper.ts"),f=i("./src/loader/fragment-loader.ts"),m=i("./src/crypt/decrypter.ts"),v=i("./src/utils/time-ranges.ts"),y=i("./src/types/loader.ts");function A(t,e){for(var i=0;i=e.endSN&&!t.nextStart){var n=e.partList;if(null!=n&&n.length){var o=n[n.length-1];return s.BufferHelper.isBuffered(this.media,o.start+o.duration/2)}var l=r.getState(i);return l===a.FragmentState.PARTIAL||l===a.FragmentState.OK}return!1},T.onMediaAttached=function(t,e){var i=this.media=this.mediaBuffer=e.media;this.onvseeking=this.onMediaSeeking.bind(this),this.onvended=this.onMediaEnded.bind(this),i.addEventListener("seeking",this.onvseeking),i.addEventListener("ended",this.onvended);var r=this.config;this.levels&&r.autoStartLoad&&this.state===w.STOPPED&&this.startLoad(r.startPosition)},T.onMediaDetaching=function(){var t=this.media;null!=t&&t.ended&&(this.log("MSE detaching and video ended, reset startPosition"),this.startPosition=this.lastCurrentTime=0),t&&this.onvseeking&&this.onvended&&(t.removeEventListener("seeking",this.onvseeking),t.removeEventListener("ended",this.onvended),this.onvseeking=this.onvended=null),this.media=this.mediaBuffer=null,this.loadedmetadata=!1,this.fragmentTracker.removeAllFragments(),this.stopLoad()},T.onMediaSeeking=function(){var t=this.config,e=this.fragCurrent,i=this.media,n=this.mediaBuffer,a=this.state,o=i?i.currentTime:0,l=s.BufferHelper.bufferInfo(n||i,o,t.maxBufferHole);if(this.log("media seeking to "+(Object(r.isFiniteNumber)(o)?o.toFixed(3):o)+", state: "+a),a===w.ENDED)this.resetLoadingState();else if(e&&!l.len){var c=t.maxFragLookUpTolerance,d=e.start-c,u=o>e.start+e.duration+c;(o0&&a&&a.key&&a.iv&&"AES-128"===a.method){var s=self.performance.now();return e.decrypter.webCryptoDecrypt(new Uint8Array(n),a.key.buffer,a.iv.buffer).then((function(e){var n=self.performance.now();return r.trigger(l.Events.FRAG_DECRYPTED,{frag:t,payload:e,stats:{tstart:s,tdecrypt:n}}),i.payload=e,i}))}return i})).then((function(i){var r=e.fragCurrent,n=e.hls,a=e.levels;if(!a)throw new Error("init load aborted, missing levels");var s=a[t.level].details;console.assert(s,"Level details are defined when init segment is loaded");var o=t.stats;e.state=w.IDLE,e.fragLoadError=0,t.data=new Uint8Array(i.payload),o.parsing.start=o.buffering.start=self.performance.now(),o.parsing.end=o.buffering.end=self.performance.now(),i.frag===r&&n.trigger(l.Events.FRAG_BUFFERED,{stats:o,frag:r,part:null,id:t.type}),e.tick()})).catch((function(i){e.state!==w.STOPPED&&e.state!==w.ERROR&&(e.warn(i),e.resetFragmentLoading(t))}))},T.fragContextChanged=function(t){var e=this.fragCurrent;return!t||!e||t.level!==e.level||t.sn!==e.sn||t.urlId!==e.urlId},T.fragBufferedComplete=function(t,e){var i=this.mediaBuffer?this.mediaBuffer:this.media;this.log("Buffered "+t.type+" sn: "+t.sn+(e?" part: "+e.index:"")+" of "+("[stream-controller]"===this.logPrefix?"level":"track")+" "+t.level+" "+(i?v.default.toString(s.BufferHelper.getBuffered(i)):"(detached)")),this.state=w.IDLE,i&&(!this.loadedmetadata&&i.buffered.length&&this.fragCurrent===this.fragPrevious&&(this.loadedmetadata=!0),this.tick())},T._handleFragmentLoadComplete=function(t){var e=this.transmuxer;if(e){var i=t.frag,r=t.part,n=t.partsLoaded,a=!n||0===n.length||n.some((function(t){return!t})),s=new d.ChunkMetadata(i.level,i.sn,i.stats.chunkCount+1,0,r?r.index:-1,!a);e.flush(s)}},T._handleFragmentLoadProgress=function(t){},T._doFragLoad=function(t,e,i,n){var a=this;if(void 0===i&&(i=null),!this.levels)throw new Error("frag load aborted, missing levels");if(i=Math.max(t.start,i||0),this.config.lowLatencyMode&&e){var s=e.partList;if(s&&n){i>t.end&&e.fragmentHint&&(t=e.fragmentHint);var o=this.getNextPart(s,t,i);if(o>-1){var c=s[o];return this.log("Loading part sn: "+t.sn+" p: "+c.index+" cc: "+t.cc+" of playlist ["+e.startSN+"-"+e.endSN+"] parts [0-"+o+"-"+(s.length-1)+"] "+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(i.toFixed(3))),this.nextLoadPosition=c.start+c.duration,this.state=w.FRAG_LOADING,this.hls.trigger(l.Events.FRAG_LOADING,{frag:t,part:s[o],targetBufferTime:i}),this.doFragPartsLoad(t,s,o,n).catch((function(t){return a.handleFragLoadError(t)}))}if(!t.url||this.loadedEndOfParts(s,i))return Promise.resolve(null)}}return this.log("Loading fragment "+t.sn+" cc: "+t.cc+" "+(e?"of ["+e.startSN+"-"+e.endSN+"] ":"")+("[stream-controller]"===this.logPrefix?"level":"track")+": "+t.level+", target: "+parseFloat(i.toFixed(3))),Object(r.isFiniteNumber)(t.sn)&&!this.bitrateTest&&(this.nextLoadPosition=t.start+t.duration),this.state=w.FRAG_LOADING,this.hls.trigger(l.Events.FRAG_LOADING,{frag:t,targetBufferTime:i}),this.fragmentLoader.load(t,n).catch((function(t){return a.handleFragLoadError(t)}))},T.doFragPartsLoad=function(t,e,i,r){var n=this;return new Promise((function(a,s){var o=[];!function i(c){var d=e[c];n.fragmentLoader.loadPart(t,d,r).then((function(r){o[d.index]=r;var s=r.part;n.hls.trigger(l.Events.FRAG_LOADED,r);var u=e[c+1];if(!u||u.fragment!==t)return a({frag:t,part:s,partsLoaded:o});i(c+1)})).catch(s)}(i)}))},T.handleFragLoadError=function(t){var e=t.data;return e&&e.details===c.ErrorDetails.INTERNAL_ABORTED?this.handleFragLoadAborted(e.frag,e.part):this.hls.trigger(l.Events.ERROR,e),null},T._handleTransmuxerFlush=function(t){var e=this.getCurrentContext(t);if(e&&this.state===w.PARSING){var i=e.frag,r=e.part,n=e.level,a=self.performance.now();i.stats.parsing.end=a,r&&(r.stats.parsing.end=a),this.updateLevelTiming(i,r,n,t.partial)}else this.fragCurrent||(this.state=w.IDLE)},T.getCurrentContext=function(t){var e=this.levels,i=t.level,r=t.sn,n=t.part;if(!e||!e[i])return this.warn("Levels object was unset while buffering fragment "+r+" of level "+i+". The current chunk will not be buffered."),null;var a=e[i],s=n>-1?Object(g.getPartWith)(a,r,n):null,o=s?s.fragment:Object(g.getFragmentWithSN)(a,r,this.fragCurrent);return o?{frag:o,part:s,level:a}:null},T.bufferFragmentData=function(t,e,i,r){if(t&&this.state===w.PARSING){var n=t.data1,a=t.data2,s=n;if(n&&a&&(s=Object(u.appendUint8Array)(n,a)),s&&s.length){var o={type:t.type,frag:e,part:i,chunkMeta:r,parent:e.type,data:s};this.hls.trigger(l.Events.BUFFER_APPENDING,o),t.dropped&&t.independent&&!i&&this.flushBufferGap(e)}}},T.flushBufferGap=function(t){var e=this.media;if(e)if(s.BufferHelper.isBuffered(e,e.currentTime)){var i=e.currentTime,r=s.BufferHelper.bufferInfo(e,i,0),n=t.duration,a=Math.min(2*this.config.maxFragLookUpTolerance,.25*n),o=Math.max(Math.min(t.start-a,r.end-a),i+a);t.start-o>a&&this.flushMainBuffer(o,t.start)}else this.flushMainBuffer(0,t.start)},T.getFwdBufferInfo=function(t,e){var i=this.config,n=this.getLoadPosition();if(!Object(r.isFiniteNumber)(n))return null;var a=s.BufferHelper.bufferInfo(t,n,i.maxBufferHole);if(0===a.len&&void 0!==a.nextStart){var o=this.fragmentTracker.getBufferedFrag(n,e);if(o&&a.nextStart=i&&(e.maxMaxBufferLength/=2,this.warn("Reduce max buffer length to "+e.maxMaxBufferLength+"s"),!0)},T.getNextFragment=function(t,e){var i=e.fragments,r=i.length;if(!r)return null;var n,a=this.config,s=i[0].start;if(e.live){var o=a.initialLiveManifestSize;if(r-1&&ii.start&&i.loaded},T.getInitialLiveFragment=function(t,e){var i=this.fragPrevious,r=null;if(i){if(t.hasProgramDateTime&&(this.log("Live playlist, switching playlist, load frag with same PDT: "+i.programDateTime),r=Object(p.findFragmentByPDT)(e,i.endProgramDateTime,this.config.maxFragLookUpTolerance)),!r){var n=i.sn+1;if(n>=t.startSN&&n<=t.endSN){var a=e[n-t.startSN];i.cc===a.cc&&(r=a,this.log("Live playlist, switching playlist, load frag with next SN: "+r.sn))}r||(r=Object(p.findFragWithCC)(e,i.cc))&&this.log("Live playlist, switching playlist, load frag with same CC: "+r.sn)}}else{var s=this.hls.liveSyncPosition;null!==s&&(r=this.getFragmentAtPosition(s,this.bitrateTest?t.fragmentEnd:t.edge,t))}return r},T.getFragmentAtPosition=function(t,e,i){var r,n=this.config,s=this.fragPrevious,o=i.fragments,l=i.endSN,c=i.fragmentHint,d=n.maxFragLookUpTolerance,u=!!(n.lowLatencyMode&&i.partList&&c);if(u&&c&&!this.bitrateTest&&(o=o.concat(c),l=c.sn),te-d?0:d;r=Object(p.findFragmentByPTS)(s,o,t,h)}else r=o[o.length-1];if(r){var g=r.sn-i.startSN;if(s&&r.sn===s.sn&&!u&&s&&r.level===s.level){var f=o[g+1];r.sn=a-e.maxFragLookUpTolerance&&n<=s;if(null!==r&&i.duration>r&&(n"+t.startSN+" prev-sn: "+(a?a.sn:"na")+" fragments: "+o),u}return l},T.waitForCdnTuneIn=function(t){return t.live&&t.canBlockReload&&t.partTarget&&t.tuneInGoal>Math.max(t.partHoldBack,3*t.partTarget)},T.setStartPosition=function(t,e){var i=this.startPosition;if(i"+t))}}])&&A(C.prototype,E),Object.defineProperty(C,"prototype",{writable:!1}),n}(n.default)},"./src/controller/buffer-controller.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return p}));var r=i("./src/polyfills/number.ts"),n=i("./src/events.ts"),a=i("./src/utils/logger.ts"),s=i("./src/errors.ts"),o=i("./src/utils/buffer-helper.ts"),l=i("./src/utils/mediasource-helper.ts"),c=i("./src/loader/fragment.ts"),d=i("./src/controller/buffer-operation-queue.ts"),u=Object(l.getMediaSource)(),h=/([ha]vc.)(?:\.[^.,]+)+/,p=function(){function t(t){var e=this;this.details=null,this._objectUrl=null,this.operationQueue=void 0,this.listeners=void 0,this.hls=void 0,this.bufferCodecEventsExpected=0,this._bufferCodecEventsTotal=0,this.media=null,this.mediaSource=null,this.appendError=0,this.tracks={},this.pendingTracks={},this.sourceBuffer=void 0,this._onMediaSourceOpen=function(){var t=e.hls,i=e.media,r=e.mediaSource;a.logger.log("[buffer-controller]: Media source opened"),i&&(e.updateMediaElementDuration(),t.trigger(n.Events.MEDIA_ATTACHED,{media:i})),r&&r.removeEventListener("sourceopen",e._onMediaSourceOpen),e.checkPendingTracks()},this._onMediaSourceClose=function(){a.logger.log("[buffer-controller]: Media source closed")},this._onMediaSourceEnded=function(){a.logger.log("[buffer-controller]: Media source ended")},this.hls=t,this._initSourceBuffer(),this.registerListeners()}var e=t.prototype;return e.hasSourceTypes=function(){return this.getSourceBufferTypes().length>0||Object.keys(this.pendingTracks).length>0},e.destroy=function(){this.unregisterListeners(),this.details=null},e.registerListeners=function(){var t=this.hls;t.on(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.on(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.on(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.on(n.Events.BUFFER_RESET,this.onBufferReset,this),t.on(n.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.on(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.on(n.Events.BUFFER_EOS,this.onBufferEos,this),t.on(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.on(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.on(n.Events.FRAG_PARSED,this.onFragParsed,this),t.on(n.Events.FRAG_CHANGED,this.onFragChanged,this)},e.unregisterListeners=function(){var t=this.hls;t.off(n.Events.MEDIA_ATTACHING,this.onMediaAttaching,this),t.off(n.Events.MEDIA_DETACHING,this.onMediaDetaching,this),t.off(n.Events.MANIFEST_PARSED,this.onManifestParsed,this),t.off(n.Events.BUFFER_RESET,this.onBufferReset,this),t.off(n.Events.BUFFER_APPENDING,this.onBufferAppending,this),t.off(n.Events.BUFFER_CODECS,this.onBufferCodecs,this),t.off(n.Events.BUFFER_EOS,this.onBufferEos,this),t.off(n.Events.BUFFER_FLUSHING,this.onBufferFlushing,this),t.off(n.Events.LEVEL_UPDATED,this.onLevelUpdated,this),t.off(n.Events.FRAG_PARSED,this.onFragParsed,this),t.off(n.Events.FRAG_CHANGED,this.onFragChanged,this)},e._initSourceBuffer=function(){this.sourceBuffer={},this.operationQueue=new d.default(this.sourceBuffer),this.listeners={audio:[],video:[],audiovideo:[]}},e.onManifestParsed=function(t,e){var i=2;(e.audio&&!e.video||!e.altAudio)&&(i=1),this.bufferCodecEventsExpected=this._bufferCodecEventsTotal=i,this.details=null,a.logger.log(this.bufferCodecEventsExpected+" bufferCodec event(s) expected")},e.onMediaAttaching=function(t,e){var i=this.media=e.media;if(i&&u){var r=this.mediaSource=new u;r.addEventListener("sourceopen",this._onMediaSourceOpen),r.addEventListener("sourceended",this._onMediaSourceEnded),r.addEventListener("sourceclose",this._onMediaSourceClose),i.src=self.URL.createObjectURL(r),this._objectUrl=i.src}},e.onMediaDetaching=function(){var t=this.media,e=this.mediaSource,i=this._objectUrl;if(e){if(a.logger.log("[buffer-controller]: media source detaching"),"open"===e.readyState)try{e.endOfStream()}catch(t){a.logger.warn("[buffer-controller]: onMediaDetaching: "+t.message+" while calling endOfStream")}this.onBufferReset(),e.removeEventListener("sourceopen",this._onMediaSourceOpen),e.removeEventListener("sourceended",this._onMediaSourceEnded),e.removeEventListener("sourceclose",this._onMediaSourceClose),t&&(i&&self.URL.revokeObjectURL(i),t.src===i?(t.removeAttribute("src"),t.load()):a.logger.warn("[buffer-controller]: media.src was changed by a third party - skip cleanup")),this.mediaSource=null,this.media=null,this._objectUrl=null,this.bufferCodecEventsExpected=this._bufferCodecEventsTotal,this.pendingTracks={},this.tracks={}}this.hls.trigger(n.Events.MEDIA_DETACHED,void 0)},e.onBufferReset=function(){var t=this;this.getSourceBufferTypes().forEach((function(e){var i=t.sourceBuffer[e];try{i&&(t.removeBufferListeners(e),t.mediaSource&&t.mediaSource.removeSourceBuffer(i),t.sourceBuffer[e]=void 0)}catch(t){a.logger.warn("[buffer-controller]: Failed to reset the "+e+" buffer",t)}})),this._initSourceBuffer()},e.onBufferCodecs=function(t,e){var i=this,r=this.getSourceBufferTypes().length;Object.keys(e).forEach((function(t){if(r){var n=i.tracks[t];if(n&&"function"==typeof n.buffer.changeType){var s=e[t],o=s.id,l=s.codec,c=s.levelCodec,d=s.container,u=s.metadata,p=(n.levelCodec||n.codec).replace(h,"$1"),g=(c||l).replace(h,"$1");if(p!==g){var f=d+";codecs="+(c||l);i.appendChangeType(t,f),a.logger.log("[buffer-controller]: switching codec "+p+" to "+g),i.tracks[t]={buffer:n.buffer,codec:l,container:d,levelCodec:c,metadata:u,id:o}}}}else i.pendingTracks[t]=e[t]})),r||(this.bufferCodecEventsExpected=Math.max(this.bufferCodecEventsExpected-1,0),this.mediaSource&&"open"===this.mediaSource.readyState&&this.checkPendingTracks())},e.appendChangeType=function(t,e){var i=this,r=this.operationQueue,n={execute:function(){var n=i.sourceBuffer[t];n&&(a.logger.log("[buffer-controller]: changing "+t+" sourceBuffer type to "+e),n.changeType(e)),r.shiftAndExecuteNext(t)},onStart:function(){},onComplete:function(){},onError:function(e){a.logger.warn("[buffer-controller]: Failed to change "+t+" SourceBuffer type",e)}};r.append(n,t)},e.onBufferAppending=function(t,e){var i=this,r=this.hls,l=this.operationQueue,c=this.tracks,d=e.data,u=e.type,h=e.frag,p=e.part,g=e.chunkMeta,f=g.buffering[u],m=self.performance.now();f.start=m;var v=h.stats.buffering,y=p?p.stats.buffering:null;0===v.start&&(v.start=m),y&&0===y.start&&(y.start=m);var A=c.audio,b="audio"===u&&1===g.id&&"audio/mpeg"===(null==A?void 0:A.container),_={execute:function(){if(f.executeStart=self.performance.now(),b){var t=i.sourceBuffer[u];if(t){var e=h.start-t.timestampOffset;Math.abs(e)>=.1&&(a.logger.log("[buffer-controller]: Updating audio SourceBuffer timestampOffset to "+h.start+" (delta: "+e+") sn: "+h.sn+")"),t.timestampOffset=h.start)}}i.appendExecutor(d,u)},onStart:function(){},onComplete:function(){var t=self.performance.now();f.executeEnd=f.end=t,0===v.first&&(v.first=t),y&&0===y.first&&(y.first=t);var e=i.sourceBuffer,r={};for(var a in e)r[a]=o.BufferHelper.getBuffered(e[a]);i.appendError=0,i.hls.trigger(n.Events.BUFFER_APPENDED,{type:u,frag:h,part:p,chunkMeta:g,parent:h.type,timeRanges:r})},onError:function(t){a.logger.error("[buffer-controller]: Error encountered while trying to append to the "+u+" SourceBuffer",t);var e={type:s.ErrorTypes.MEDIA_ERROR,parent:h.type,details:s.ErrorDetails.BUFFER_APPEND_ERROR,err:t,fatal:!1};t.code===DOMException.QUOTA_EXCEEDED_ERR?e.details=s.ErrorDetails.BUFFER_FULL_ERROR:(i.appendError++,e.details=s.ErrorDetails.BUFFER_APPEND_ERROR,i.appendError>r.config.appendErrorMaxRetry&&(a.logger.error("[buffer-controller]: Failed "+r.config.appendErrorMaxRetry+" times to append segment in sourceBuffer"),e.fatal=!0,r.stopLoad())),r.trigger(n.Events.ERROR,e)}};l.append(_,u)},e.onBufferFlushing=function(t,e){var i=this,r=this.operationQueue,s=function(t){return{execute:i.removeExecutor.bind(i,t,e.startOffset,e.endOffset),onStart:function(){},onComplete:function(){i.hls.trigger(n.Events.BUFFER_FLUSHED,{type:t})},onError:function(e){a.logger.warn("[buffer-controller]: Failed to remove from "+t+" SourceBuffer",e)}}};e.type?r.append(s(e.type),e.type):this.getSourceBufferTypes().forEach((function(t){r.append(s(t),t)}))},e.onFragParsed=function(t,e){var i=this,r=e.frag,s=e.part,o=[],l=s?s.elementaryStreams:r.elementaryStreams;l[c.ElementaryStreamTypes.AUDIOVIDEO]?o.push("audiovideo"):(l[c.ElementaryStreamTypes.AUDIO]&&o.push("audio"),l[c.ElementaryStreamTypes.VIDEO]&&o.push("video")),0===o.length&&a.logger.warn("Fragments must have at least one ElementaryStreamType set. type: "+r.type+" level: "+r.level+" sn: "+r.sn),this.blockBuffers((function(){var t=self.performance.now();r.stats.buffering.end=t,s&&(s.stats.buffering.end=t);var e=s?s.stats:r.stats;i.hls.trigger(n.Events.FRAG_BUFFERED,{frag:r,part:s,stats:e,id:r.type})}),o)},e.onFragChanged=function(t,e){this.flushBackBuffer()},e.onBufferEos=function(t,e){var i=this;this.getSourceBufferTypes().reduce((function(t,r){var n=i.sourceBuffer[r];return e.type&&e.type!==r||n&&!n.ended&&(n.ended=!0,a.logger.log("[buffer-controller]: "+r+" sourceBuffer now EOS")),t&&!(n&&!n.ended)}),!0)&&this.blockBuffers((function(){var t=i.mediaSource;t&&"open"===t.readyState&&t.endOfStream()}))},e.onLevelUpdated=function(t,e){var i=e.details;i.fragments.length&&(this.details=i,this.getSourceBufferTypes().length?this.blockBuffers(this.updateMediaElementDuration.bind(this)):this.updateMediaElementDuration())},e.flushBackBuffer=function(){var t=this.hls,e=this.details,i=this.media,a=this.sourceBuffer;if(i&&null!==e){var s=this.getSourceBufferTypes();if(s.length){var l=e.live&&null!==t.config.liveBackBufferLength?t.config.liveBackBufferLength:t.config.backBufferLength;if(Object(r.isFiniteNumber)(l)&&!(l<0)){var c=i.currentTime,d=e.levelTargetDuration,u=Math.max(l,d),h=Math.floor(c/d)*d-u;s.forEach((function(i){var r=a[i];if(r){var s=o.BufferHelper.getBuffered(r);s.length>0&&h>s.start(0)&&(t.trigger(n.Events.BACK_BUFFER_REACHED,{bufferEnd:h}),e.live&&t.trigger(n.Events.LIVE_BACK_BUFFER_REACHED,{bufferEnd:h}),t.trigger(n.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:h,type:i}))}}))}}}},e.updateMediaElementDuration=function(){if(this.details&&this.media&&this.mediaSource&&"open"===this.mediaSource.readyState){var t=this.details,e=this.hls,i=this.media,n=this.mediaSource,s=t.fragments[0].start+t.totalduration,o=i.duration,l=Object(r.isFiniteNumber)(n.duration)?n.duration:0;t.live&&e.config.liveDurationInfinity?(a.logger.log("[buffer-controller]: Media Source duration is set to Infinity"),n.duration=1/0,this.updateSeekableRange(t)):(s>l&&s>o||!Object(r.isFiniteNumber)(o))&&(a.logger.log("[buffer-controller]: Updating Media Source duration to "+s.toFixed(3)),n.duration=s)}},e.updateSeekableRange=function(t){var e=this.mediaSource,i=t.fragments;if(i.length&&t.live&&null!=e&&e.setLiveSeekableRange){var r=Math.max(0,i[0].start),n=Math.max(r,r+t.totalduration);e.setLiveSeekableRange(r,n)}},e.checkPendingTracks=function(){var t=this.bufferCodecEventsExpected,e=this.operationQueue,i=this.pendingTracks,r=Object.keys(i).length;if(r&&!t||2===r){this.createSourceBuffers(i),this.pendingTracks={};var a=this.getSourceBufferTypes();if(0===a.length)return void this.hls.trigger(n.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_INCOMPATIBLE_CODECS_ERROR,fatal:!0,reason:"could not create source buffer for media codec(s)"});a.forEach((function(t){e.executeNext(t)}))}},e.createSourceBuffers=function(t){var e=this.sourceBuffer,i=this.mediaSource;if(!i)throw Error("createSourceBuffers called when mediaSource was null");var r=0;for(var o in t)if(!e[o]){var l=t[o];if(!l)throw Error("source buffer exists for track "+o+", however track does not");var c=l.levelCodec||l.codec,d=l.container+";codecs="+c;a.logger.log("[buffer-controller]: creating sourceBuffer("+d+")");try{var u=e[o]=i.addSourceBuffer(d),h=o;this.addBufferListener(h,"updatestart",this._onSBUpdateStart),this.addBufferListener(h,"updateend",this._onSBUpdateEnd),this.addBufferListener(h,"error",this._onSBUpdateError),this.tracks[o]={buffer:u,codec:c,container:l.container,levelCodec:l.levelCodec,metadata:l.metadata,id:l.id},r++}catch(t){a.logger.error("[buffer-controller]: error while trying to add sourceBuffer: "+t.message),this.hls.trigger(n.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_ADD_CODEC_ERROR,fatal:!1,error:t,mimeType:d})}}r&&this.hls.trigger(n.Events.BUFFER_CREATED,{tracks:this.tracks})},e._onSBUpdateStart=function(t){this.operationQueue.current(t).onStart()},e._onSBUpdateEnd=function(t){var e=this.operationQueue;e.current(t).onComplete(),e.shiftAndExecuteNext(t)},e._onSBUpdateError=function(t,e){a.logger.error("[buffer-controller]: "+t+" SourceBuffer error",e),this.hls.trigger(n.Events.ERROR,{type:s.ErrorTypes.MEDIA_ERROR,details:s.ErrorDetails.BUFFER_APPENDING_ERROR,fatal:!1});var i=this.operationQueue.current(t);i&&i.onError(e)},e.removeExecutor=function(t,e,i){var n=this.media,s=this.mediaSource,o=this.operationQueue,l=this.sourceBuffer[t];if(!n||!s||!l)return a.logger.warn("[buffer-controller]: Attempting to remove from the "+t+" SourceBuffer, but it does not exist"),void o.shiftAndExecuteNext(t);var c=Object(r.isFiniteNumber)(n.duration)?n.duration:1/0,d=Object(r.isFiniteNumber)(s.duration)?s.duration:1/0,u=Math.max(0,e),h=Math.min(i,c,d);h>u?(a.logger.log("[buffer-controller]: Removing ["+u+","+h+"] from the "+t+" SourceBuffer"),console.assert(!l.updating,t+" sourceBuffer must not be updating"),l.remove(u,h)):o.shiftAndExecuteNext(t)},e.appendExecutor=function(t,e){var i=this.operationQueue,r=this.sourceBuffer[e];if(!r)return a.logger.warn("[buffer-controller]: Attempting to append to the "+e+" SourceBuffer, but it does not exist"),void i.shiftAndExecuteNext(e);r.ended=!1,console.assert(!r.updating,e+" sourceBuffer must not be updating"),r.appendBuffer(t)},e.blockBuffers=function(t,e){var i=this;if(void 0===e&&(e=this.getSourceBufferTypes()),!e.length)return a.logger.log("[buffer-controller]: Blocking operation requested, but no SourceBuffers exist"),void Promise.resolve().then(t);var r=this.operationQueue,n=e.map((function(t){return r.appendBlocker(t)}));Promise.all(n).then((function(){t(),e.forEach((function(t){var e=i.sourceBuffer[t];e&&e.updating||r.shiftAndExecuteNext(t)}))}))},e.getSourceBufferTypes=function(){return Object.keys(this.sourceBuffer)},e.addBufferListener=function(t,e,i){var r=this.sourceBuffer[t];if(r){var n=i.bind(this,t);this.listeners[t].push({event:e,listener:n}),r.addEventListener(e,n)}},e.removeBufferListeners=function(t){var e=this.sourceBuffer[t];e&&this.listeners[t].forEach((function(t){e.removeEventListener(t.event,t.listener)}))},t}()},"./src/controller/buffer-operation-queue.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return n}));var r=i("./src/utils/logger.ts"),n=function(){function t(t){this.buffers=void 0,this.queues={video:[],audio:[],audiovideo:[]},this.buffers=t}var e=t.prototype;return e.append=function(t,e){var i=this.queues[e];i.push(t),1===i.length&&this.buffers[e]&&this.executeNext(e)},e.insertAbort=function(t,e){this.queues[e].unshift(t),this.executeNext(e)},e.appendBlocker=function(t){var e,i=new Promise((function(t){e=t})),r={execute:e,onStart:function(){},onComplete:function(){},onError:function(){}};return this.append(r,t),i},e.executeNext=function(t){var e=this.buffers,i=this.queues,n=e[t],a=i[t];if(a.length){var s=a[0];try{s.execute()}catch(e){r.logger.warn("[buffer-operation-queue]: Unhandled exception executing the current operation"),s.onError(e),n&&n.updating||(a.shift(),this.executeNext(t))}}},e.shiftAndExecuteNext=function(t){this.queues[t].shift(),this.executeNext(t)},e.current=function(t){return this.queues[t][0]},t}()},"./src/controller/cap-level-controller.ts":function(t,e,i){"use strict";i.r(e);var r=i("./src/events.ts");function n(t,e){for(var i=0;i0&&this.mediaWidth>0){var t=this.hls.levels;if(t.length){var e=this.hls;e.autoLevelCapping=this.getMaxLevel(t.length-1),e.autoLevelCapping>this.autoLevelCapping&&this.streamController&&this.streamController.nextLevelSwitch(),this.autoLevelCapping=e.autoLevelCapping}}},a.getMaxLevel=function(e){var i=this,r=this.hls.levels;if(!r.length)return-1;var n=r.filter((function(r,n){return t.isLevelAllowed(n,i.restrictedLevels)&&n<=e}));return this.clientRect=null,t.getMaxLevelByMediaSize(n,this.mediaWidth,this.mediaHeight)},a.startCapping=function(){this.timer||(this.autoLevelCapping=Number.POSITIVE_INFINITY,this.hls.firstLevel=this.getMaxLevel(this.firstLevel),self.clearInterval(this.timer),this.timer=self.setInterval(this.detectPlayerSize.bind(this),1e3),this.detectPlayerSize())},a.stopCapping=function(){this.restrictedLevels=[],this.firstLevel=-1,this.autoLevelCapping=Number.POSITIVE_INFINITY,this.timer&&(self.clearInterval(this.timer),this.timer=void 0)},a.getDimensions=function(){if(this.clientRect)return this.clientRect;var t=this.media,e={width:0,height:0};if(t){var i=t.getBoundingClientRect();e.width=i.width,e.height=i.height,e.width||e.height||(e.width=i.right-i.left||t.width||0,e.height=i.bottom-i.top||t.height||0)}return this.clientRect=e,e},t.isLevelAllowed=function(t,e){return void 0===e&&(e=[]),-1===e.indexOf(t)},t.getMaxLevelByMediaSize=function(t,e,i){if(!t||!t.length)return-1;for(var r,n,a=t.length-1,s=0;s=e||o.height>=i)&&(r=o,!(n=t[s+1])||r.width!==n.width||r.height!==n.height)){a=s;break}}return a},e=t,(i=[{key:"mediaWidth",get:function(){return this.getDimensions().width*this.contentScaleFactor}},{key:"mediaHeight",get:function(){return this.getDimensions().height*this.contentScaleFactor}},{key:"contentScaleFactor",get:function(){var t=1;if(!this.hls.config.ignoreDevicePixelRatio)try{t=self.devicePixelRatio}catch(t){}return t}}])&&n(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=a},"./src/controller/cmcd-controller.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return h}));var r=i("./src/events.ts"),n=i("./src/types/cmcd.ts"),a=i("./src/utils/buffer-helper.ts"),s=i("./src/utils/logger.ts");function o(t,e){for(var i=0;i=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var i=0,r=new Array(e);i-1?a+1:r.levels.length;e=r.levels.slice(0,s)}for(var o,l=c(e);!(o=l()).done;){var d=o.value;d.bitrate>i&&(i=d.bitrate)}return i>0?i:NaN},e.getBufferLength=function(t){var e=this.hls.media,i=t===n.CMCDObjectType.AUDIO?this.audioBuffer:this.videoBuffer;return i&&e?1e3*a.BufferHelper.bufferInfo(i,e.currentTime,this.config.maxBufferHole).len:NaN},e.createPlaylistLoader=function(){var t=this.config.pLoader,e=this.applyPlaylistData,i=t||this.config.loader;return function(){function t(t){this.loader=void 0,this.loader=new i(t)}var r=t.prototype;return r.destroy=function(){this.loader.destroy()},r.abort=function(){this.loader.abort()},r.load=function(t,i,r){e(t),this.loader.load(t,i,r)},l(t,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),t}()},e.createFragmentLoader=function(){var t=this.config.fLoader,e=this.applyFragmentData,i=t||this.config.loader;return function(){function t(t){this.loader=void 0,this.loader=new i(t)}var r=t.prototype;return r.destroy=function(){this.loader.destroy()},r.abort=function(){this.loader.abort()},r.load=function(t,i,r){e(t),this.loader.load(t,i,r)},l(t,[{key:"stats",get:function(){return this.loader.stats}},{key:"context",get:function(){return this.loader.context}}]),t}()},t.uuid=function(){var t=URL.createObjectURL(new Blob),e=t.toString();return URL.revokeObjectURL(t),e.slice(e.lastIndexOf("/")+1)},t.serialize=function(t){for(var e,i=[],r=function(t){return!Number.isNaN(t)&&null!=t&&""!==t&&!1!==t},n=function(t){return Math.round(t)},a=function(t){return 100*n(t/100)},s={br:n,d:n,bl:a,dl:a,mtp:a,nor:function(t){return encodeURIComponent(t)},rtp:a,tb:n},o=c(Object.keys(t||{}).sort());!(e=o()).done;){var l=e.value,d=t[l];if(r(d)&&!("v"===l&&1===d||"pr"==l&&1===d)){var u=s[l];u&&(d=u(d));var h,p=typeof d;h="ot"===l||"sf"===l||"st"===l?l+"="+d:"boolean"===p?l:"number"===p?l+"="+d:l+"="+JSON.stringify(d),i.push(h)}}return i.join(",")},t.toHeaders=function(e){for(var i={},r=["Object","Request","Session","Status"],n=[{},{},{},{}],a={br:0,d:0,ot:0,tb:0,bl:1,dl:1,mtp:1,nor:1,nrr:1,su:1,cid:2,pr:2,sf:2,sid:2,st:2,v:2,bs:3,rtp:3},s=0,o=Object.keys(e);s3)return void this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0});var c=3-this._requestLicenseFailureCount+1;a.logger.warn("Retrying license request, "+c+" attempts left"),this._requestLicense(i,s)}},l._generateLicenseRequestChallenge=function(t,e){if(t.mediaKeySystemDomain===s.KeySystems.WIDEVINE)return e;throw new Error("unsupported key-system: "+t.mediaKeySystemDomain)},l._requestLicense=function(t,e){a.logger.log("Requesting content license for key-system");var i=this._mediaKeysList[0];if(!i)return a.logger.error("Fatal error: Media is encrypted but no key-system access has been obtained yet"),void this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_NO_ACCESS,fatal:!0});try{var s=this.getLicenseServerUrl(i.mediaKeySystemDomain),o=this._createLicenseXhr(s,t,e);a.logger.log("Sending license request to URL: "+s);var l=this._generateLicenseRequestChallenge(i,t);o.send(l)}catch(t){a.logger.error("Failure requesting DRM license: "+t),this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.KEY_SYSTEM_ERROR,details:n.ErrorDetails.KEY_SYSTEM_LICENSE_REQUEST_FAILED,fatal:!0})}},l.onMediaAttached=function(t,e){if(this._emeEnabled){var i=e.media;this._media=i,i.addEventListener("encrypted",this._onMediaEncrypted)}},l.onMediaDetached=function(){var t=this._media,e=this._mediaKeysList;t&&(t.removeEventListener("encrypted",this._onMediaEncrypted),this._media=null,this._mediaKeysList=[],Promise.all(e.map((function(t){if(t.mediaKeysSession)return t.mediaKeysSession.close().catch((function(){}))}))).then((function(){return t.setMediaKeys(null)})).catch((function(){})))},l.onManifestParsed=function(t,e){if(this._emeEnabled){var i=e.levels.map((function(t){return t.audioCodec})).filter((function(t){return!!t})),r=e.levels.map((function(t){return t.videoCodec})).filter((function(t){return!!t}));this._attemptKeySystemAccess(s.KeySystems.WIDEVINE,i,r)}},e=t,(i=[{key:"requestMediaKeySystemAccess",get:function(){if(!this._requestMediaKeySystemAccess)throw new Error("No requestMediaKeySystemAccess function configured");return this._requestMediaKeySystemAccess}}])&&o(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}();e.default=l},"./src/controller/fps-controller.ts":function(t,e,i){"use strict";i.r(e);var r=i("./src/events.ts"),n=i("./src/utils/logger.ts"),a=function(){function t(t){this.hls=void 0,this.isVideoPlaybackQualityAvailable=!1,this.timer=void 0,this.media=null,this.lastTime=void 0,this.lastDroppedFrames=0,this.lastDecodedFrames=0,this.streamController=void 0,this.hls=t,this.registerListeners()}var e=t.prototype;return e.setStreamController=function(t){this.streamController=t},e.registerListeners=function(){this.hls.on(r.Events.MEDIA_ATTACHING,this.onMediaAttaching,this)},e.unregisterListeners=function(){this.hls.off(r.Events.MEDIA_ATTACHING,this.onMediaAttaching)},e.destroy=function(){this.timer&&clearInterval(this.timer),this.unregisterListeners(),this.isVideoPlaybackQualityAvailable=!1,this.media=null},e.onMediaAttaching=function(t,e){var i=this.hls.config;if(i.capLevelOnFPSDrop){var r=e.media instanceof self.HTMLVideoElement?e.media:null;this.media=r,r&&"function"==typeof r.getVideoPlaybackQuality&&(this.isVideoPlaybackQualityAvailable=!0),self.clearInterval(this.timer),this.timer=self.setInterval(this.checkFPSInterval.bind(this),i.fpsDroppedMonitoringPeriod)}},e.checkFPS=function(t,e,i){var a=performance.now();if(e){if(this.lastTime){var s=a-this.lastTime,o=i-this.lastDroppedFrames,l=e-this.lastDecodedFrames,c=1e3*o/s,d=this.hls;if(d.trigger(r.Events.FPS_DROP,{currentDropped:o,currentDecoded:l,totalDroppedFrames:i}),c>0&&o>d.config.fpsDroppedMonitoringThreshold*l){var u=d.currentLevel;n.logger.warn("drop FPS ratio greater than max allowed value for currentLevel: "+u),u>0&&(-1===d.autoLevelCapping||d.autoLevelCapping>=u)&&(u-=1,d.trigger(r.Events.FPS_DROP_LEVEL_CAPPING,{level:u,droppedLevel:d.currentLevel}),d.autoLevelCapping=u,this.streamController.nextLevelSwitch())}}this.lastTime=a,this.lastDroppedFrames=i,this.lastDecodedFrames=e}},e.checkFPSInterval=function(){var t=this.media;if(t)if(this.isVideoPlaybackQualityAvailable){var e=t.getVideoPlaybackQuality();this.checkFPS(t,e.totalVideoFrames,e.droppedVideoFrames)}else this.checkFPS(t,t.webkitDecodedFrameCount,t.webkitDroppedFrameCount)},t}();e.default=a},"./src/controller/fragment-finders.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"findFragmentByPDT",(function(){return a})),i.d(e,"findFragmentByPTS",(function(){return s})),i.d(e,"fragmentWithinToleranceTest",(function(){return o})),i.d(e,"pdtWithinToleranceTest",(function(){return l})),i.d(e,"findFragWithCC",(function(){return c}));var r=i("./src/polyfills/number.ts"),n=i("./src/utils/binary-search.ts");function a(t,e,i){if(null===e||!Array.isArray(t)||!t.length||!Object(r.isFiniteNumber)(e))return null;if(e<(t[0].programDateTime||0))return null;if(e>=(t[t.length-1].endProgramDateTime||0))return null;i=i||0;for(var n=0;nt&&i.start?-1:0}function l(t,e,i){var r=1e3*Math.min(e,i.duration+(i.deltaPTS?i.deltaPTS:0));return(i.endProgramDateTime||0)-r>t}function c(t,e){return n.default.search(t,(function(t){return t.cce?-1:0}))}},"./src/controller/fragment-tracker.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"FragmentState",(function(){return r})),i.d(e,"FragmentTracker",(function(){return s}));var r,n=i("./src/events.ts"),a=i("./src/types/loader.ts");!function(t){t.NOT_LOADED="NOT_LOADED",t.APPENDING="APPENDING",t.PARTIAL="PARTIAL",t.OK="OK"}(r||(r={}));var s=function(){function t(t){this.activeFragment=null,this.activeParts=null,this.fragments=Object.create(null),this.timeRanges=Object.create(null),this.bufferPadding=.2,this.hls=void 0,this.hls=t,this._registerListeners()}var e=t.prototype;return e._registerListeners=function(){var t=this.hls;t.on(n.Events.BUFFER_APPENDED,this.onBufferAppended,this),t.on(n.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.on(n.Events.FRAG_LOADED,this.onFragLoaded,this)},e._unregisterListeners=function(){var t=this.hls;t.off(n.Events.BUFFER_APPENDED,this.onBufferAppended,this),t.off(n.Events.FRAG_BUFFERED,this.onFragBuffered,this),t.off(n.Events.FRAG_LOADED,this.onFragLoaded,this)},e.destroy=function(){this._unregisterListeners(),this.fragments=this.timeRanges=null},e.getAppendedFrag=function(t,e){if(e===a.PlaylistLevelType.MAIN){var i=this.activeFragment,r=this.activeParts;if(!i)return null;if(r)for(var n=r.length;n--;){var s=r[n],o=s?s.end:i.appendedPTS;if(s.start<=t&&void 0!==o&&t<=o)return n>9&&(this.activeParts=r.slice(n-9)),s}else if(i.start<=t&&void 0!==i.appendedPTS&&t<=i.appendedPTS)return i}return this.getBufferedFrag(t,e)},e.getBufferedFrag=function(t,e){for(var i=this.fragments,r=Object.keys(i),n=r.length;n--;){var a=i[r[n]];if((null==a?void 0:a.body.type)===e&&a.buffered){var s=a.body;if(s.start<=t&&t<=s.end)return s}}return null},e.detectEvictedFragments=function(t,e,i){var r=this;Object.keys(this.fragments).forEach((function(n){var a=r.fragments[n];if(a)if(a.buffered){var s=a.range[t];s&&s.time.some((function(t){var i=!r.isTimeBuffered(t.startPTS,t.endPTS,e);return i&&r.removeFragment(a.body),i}))}else a.body.type===i&&r.removeFragment(a.body)}))},e.detectPartialFragments=function(t){var e=this,i=this.timeRanges,r=t.frag,n=t.part;if(i&&"initSegment"!==r.sn){var a=l(r),s=this.fragments[a];s&&(Object.keys(i).forEach((function(t){var a=r.elementaryStreams[t];if(a){var o=i[t],l=null!==n||!0===a.partial;s.range[t]=e.getBufferedTimes(r,n,l,o)}})),s.loaded=null,Object.keys(s.range).length?s.buffered=!0:this.removeFragment(s.body))}},e.fragBuffered=function(t){var e=l(t),i=this.fragments[e];i&&(i.loaded=null,i.buffered=!0)},e.getBufferedTimes=function(t,e,i,r){for(var n={time:[],partial:i},a=e?e.start:t.start,s=e?e.end:t.end,o=t.minEndPTS||s,l=t.maxStartPTS||a,c=0;c=d&&o<=u){n.time.push({startPTS:Math.max(a,r.start(c)),endPTS:Math.min(s,r.end(c))});break}if(ad)n.partial=!0,n.time.push({startPTS:Math.max(a,r.start(c)),endPTS:Math.min(s,r.end(c))});else if(s<=d)break}return n},e.getPartialFragment=function(t){var e,i,r,n=null,a=0,s=this.bufferPadding,l=this.fragments;return Object.keys(l).forEach((function(c){var d=l[c];d&&o(d)&&(i=d.body.start-s,r=d.body.end+s,t>=i&&t<=r&&(e=Math.min(t-i,r-t),a<=e&&(n=d.body,a=e)))})),n},e.getState=function(t){var e=l(t),i=this.fragments[e];return i?i.buffered?o(i)?r.PARTIAL:r.OK:r.APPENDING:r.NOT_LOADED},e.isTimeBuffered=function(t,e,i){for(var r,n,a=0;a=r&&e<=n)return!0;if(e<=r)return!1}return!1},e.onFragLoaded=function(t,e){var i=e.frag,r=e.part;if("initSegment"!==i.sn&&!i.bitrateTest&&!r){var n=l(i);this.fragments[n]={body:i,loaded:e,buffered:!1,range:Object.create(null)}}},e.onBufferAppended=function(t,e){var i=this,r=e.frag,n=e.part,s=e.timeRanges;if(r.type===a.PlaylistLevelType.MAIN)if(this.activeFragment=r,n){var o=this.activeParts;o||(this.activeParts=o=[]),o.push(n)}else this.activeParts=null;this.timeRanges=s,Object.keys(s).forEach((function(t){var e=s[t];if(i.detectEvictedFragments(t,e),!n)for(var a=0;at&&r.removeFragment(s)}}))},e.removeFragment=function(t){var e=l(t);t.stats.loaded=0,t.clearElementaryStreamInfo(),delete this.fragments[e]},e.removeAllFragments=function(){this.fragments=Object.create(null),this.activeFragment=null,this.activeParts=null},t}();function o(t){var e,i;return t.buffered&&((null===(e=t.range.video)||void 0===e?void 0:e.partial)||(null===(i=t.range.audio)||void 0===i?void 0:i.partial))}function l(t){return t.type+"_"+t.level+"_"+t.urlId+"_"+t.sn}},"./src/controller/gap-controller.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"STALL_MINIMUM_DURATION_MS",(function(){return o})),i.d(e,"MAX_START_GAP_JUMP",(function(){return l})),i.d(e,"SKIP_BUFFER_HOLE_STEP_SECONDS",(function(){return c})),i.d(e,"SKIP_BUFFER_RANGE_START",(function(){return d})),i.d(e,"default",(function(){return u}));var r=i("./src/utils/buffer-helper.ts"),n=i("./src/errors.ts"),a=i("./src/events.ts"),s=i("./src/utils/logger.ts"),o=250,l=2,c=.1,d=.05,u=function(){function t(t,e,i,r){this.config=void 0,this.media=null,this.fragmentTracker=void 0,this.hls=void 0,this.nudgeRetry=0,this.stallReported=!1,this.stalled=null,this.moved=!1,this.seeking=!1,this.config=t,this.media=e,this.fragmentTracker=i,this.hls=r}var e=t.prototype;return e.destroy=function(){this.media=null,this.hls=this.fragmentTracker=null},e.poll=function(t,e){var i=this.config,n=this.media,a=this.stalled;if(null!==n){var c=n.currentTime,d=n.seeking,u=this.seeking&&!d,h=!this.seeking&&d;if(this.seeking=d,c===t){if((h||u)&&(this.stalled=null),!(n.paused&&!d||n.ended||0===n.playbackRate)&&r.BufferHelper.getBuffered(n).length){var p=r.BufferHelper.bufferInfo(n,c,0),g=p.len>0,f=p.nextStart||0;if(g||f){if(d){var m=p.len>l,v=!f||e&&e.start<=c||f-c>l&&!this.fragmentTracker.getPartialFragment(c);if(m||v)return;this.moved=!1}if(!this.moved&&null!==this.stalled){var y,A=Math.max(f,p.start||0)-c,b=this.hls.levels?this.hls.levels[this.hls.currentLevel]:null,_=(null==b||null===(y=b.details)||void 0===y?void 0:y.live)?2*b.details.targetduration:l;if(A>0&&A<=_)return void this._trySkipBufferHole(null)}var w=self.performance.now();if(null!==a){var C=w-a;if(d||!(C>=o)||(this._reportStall(p),this.media)){var E=r.BufferHelper.bufferInfo(n,c,i.maxBufferHole);this._tryFixBufferStall(E,C)}}else this.stalled=w}}}else if(this.moved=!0,null!==a){if(this.stallReported){var T=self.performance.now()-a;s.logger.warn("playback not stuck anymore @"+c+", after "+Math.round(T)+"ms"),this.stallReported=!1}this.stalled=null,this.nudgeRetry=0}}},e._tryFixBufferStall=function(t,e){var i=this.config,r=this.fragmentTracker,n=this.media;if(null!==n){var a=n.currentTime,o=r.getPartialFragment(a);if(o&&(this._trySkipBufferHole(o)||!this.media))return;t.len>i.maxBufferHole&&e>1e3*i.highBufferWatchdogPeriod&&(s.logger.warn("Trying to nudge playhead over buffer-hole"),this.stalled=null,this._tryNudgeBuffer())}},e._reportStall=function(t){var e=this.hls,i=this.media;!this.stallReported&&i&&(this.stallReported=!0,s.logger.warn("Playback stalling at @"+i.currentTime+" due to low buffer ("+JSON.stringify(t)+")"),e.trigger(a.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.BUFFER_STALLED_ERROR,fatal:!1,buffer:t.len}))},e._trySkipBufferHole=function(t){var e=this.config,i=this.hls,o=this.media;if(null===o)return 0;for(var l=o.currentTime,u=0,h=r.BufferHelper.getBuffered(o),p=0;p=u&&lr.startDate&&t.push(i),t}),[]).sort((function(t,e){return t.startDate.getTime()-e.startDate.getTime()}))[0];m&&(g=d(m.startDate,v),c=!0)}for(var b,_=Object.keys(r.attr),w=0;w<_.length;w++){var C=_[w];if(C!==o.DateRangeAttribute.ID&&C!==o.DateRangeAttribute.CLASS&&C!==o.DateRangeAttribute.START_DATE&&C!==o.DateRangeAttribute.DURATION&&C!==o.DateRangeAttribute.END_DATE&&C!==o.DateRangeAttribute.END_ON_NEXT){var E=s[C];if(E)c&&!n.durationKnown&&(E.endTime=g);else{var T=r.attr[C];E=new A(p,g,""),C!==o.DateRangeAttribute.SCTE35_OUT&&C!==o.DateRangeAttribute.SCTE35_IN||(b=T,T=Uint8Array.from(b.replace(/^0x/,"").replace(/([\da-fA-F]{2}) ?/g,"0x$1 ").replace(/ +$/,"").split(" ")).buffer),E.value={key:C,data:T},E.type=l.MetadataSchema.dateRange,i.id3Track.addCue(E),s[C]=E}}}a[e]={cues:s,dateRange:r,durationKnown:c}},_=0;_.05&&this.forwardBufferLength>1){var c=Math.min(2,Math.max(1,a)),d=Math.round(2/(1+Math.exp(-.75*o-this.edgeStalled))*20)/20;t.playbackRate=Math.min(c,Math.max(1,d))}else 1!==t.playbackRate&&0!==t.playbackRate&&(t.playbackRate=1)}}}}},o.estimateLiveEdge=function(){var t=this.levelDetails;return null===t?null:t.edge+t.age},o.computeLatency=function(){var t=this.estimateLiveEdge();return null===t?null:t-this.currentTime},e=t,(i=[{key:"latency",get:function(){return this._latency||0}},{key:"maxLatency",get:function(){var t=this.config,e=this.levelDetails;return void 0!==t.liveMaxLatencyDuration?t.liveMaxLatencyDuration:e?t.liveMaxLatencyDurationCount*e.targetduration:0}},{key:"targetLatency",get:function(){var t=this.levelDetails;if(null===t)return null;var e=t.holdBack,i=t.partHoldBack,r=t.targetduration,n=this.config,a=n.liveSyncDuration,s=n.liveSyncDurationCount,o=n.lowLatencyMode,l=this.hls.userConfig,c=o&&i||e;(l.liveSyncDuration||l.liveSyncDurationCount||0===c)&&(c=void 0!==a?a:s*r);var d=r;return c+Math.min(1*this.stallCount,d)}},{key:"liveSyncPosition",get:function(){var t=this.estimateLiveEdge(),e=this.targetLatency,i=this.levelDetails;if(null===t||null===e||null===i)return null;var r=i.edge,n=t-e-this.edgeStalled,a=r-i.totalduration,s=r-(this.config.lowLatencyMode&&i.partTarget||i.targetduration);return Math.min(Math.max(a,n),s)}},{key:"drift",get:function(){var t=this.levelDetails;return null===t?1:t.drift}},{key:"edgeStalled",get:function(){var t=this.levelDetails;if(null===t)return 0;var e=3*(this.config.lowLatencyMode&&t.partTarget||t.targetduration);return Math.max(t.age-e,0)}},{key:"forwardBufferLength",get:function(){var t=this.media,e=this.levelDetails;if(!t||!e)return 0;var i=t.buffered.length;return(i?t.buffered.end(i-1):e.edge)-this.currentTime}}])&&s(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}()},"./src/controller/level-controller.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return g}));var r=i("./src/types/level.ts"),n=i("./src/events.ts"),a=i("./src/errors.ts"),s=i("./src/utils/codecs.ts"),o=i("./src/controller/level-helper.ts"),l=i("./src/controller/base-playlist-controller.ts"),c=i("./src/types/loader.ts");function d(){return d=Object.assign?Object.assign.bind():function(t){for(var e=1;e0){i=c[0].bitrate,c.sort((function(t,e){return t.bitrate-e.bitrate})),this._levels=c;for(var v=0;vthis.hls.config.fragLoadingMaxRetry&&(o=u)):o=u}break;case a.ErrorDetails.LEVEL_LOAD_ERROR:case a.ErrorDetails.LEVEL_LOAD_TIMEOUT:n&&(n.deliveryDirectives&&(d=!1),o=n.level),l=!0;break;case a.ErrorDetails.REMUX_ALLOC_ERROR:o=null!=(r=i.level)?r:this.currentLevelIndex,l=!0}void 0!==o&&this.recoverLevel(i,o,l,d)}}},m.recoverLevel=function(t,e,i,r){var n=t.details,a=this._levels[e];if(a.loadError++,i){if(!this.retryLoadingOrFail(t))return void(this.currentLevelIndex=-1);t.levelRetry=!0}if(r){var s=a.url.length;if(s>1&&a.loadError-1&&this.currentLevelIndex!==o&&(this.warn(n+": switch to "+o),t.levelRetry=!0,this.hls.nextAutoLevel=o)}}},m.redundantFailover=function(t){var e=this._levels[t],i=e.url.length;if(i>1){var r=(e.urlId+1)%i;this.warn("Switching to redundant URL-id "+r),this._levels.forEach((function(t){t.urlId=r})),this.level=t}},m.onFragLoaded=function(t,e){var i=e.frag;if(void 0!==i&&i.type===c.PlaylistLevelType.MAIN){var r=this._levels[i.level];void 0!==r&&(r.fragmentError=0,r.loadError=0)}},m.onLevelLoaded=function(t,e){var i,r,n=e.level,a=e.details,s=this._levels[n];if(!s)return this.warn("Invalid level index "+n),void(null!==(r=e.deliveryDirectives)&&void 0!==r&&r.skip&&(a.deltaUpdateFailed=!0));n===this.currentLevelIndex?(0===s.fragmentError&&(s.loadError=0,this.retryCount=0),this.playlistLoaded(n,e,s.details)):null!==(i=e.deliveryDirectives)&&void 0!==i&&i.skip&&(a.deltaUpdateFailed=!0)},m.onAudioTrackSwitched=function(t,e){var i=this.hls.levels[this.currentLevelIndex];if(i&&i.audioGroupIds){for(var r=-1,n=this.hls.audioTracks[e.id].groupId,a=0;a0){var r=i.urlId,a=i.url[r];if(t)try{a=t.addDirectives(a)}catch(t){this.warn("Could not construct new URL with HLS Delivery Directives: "+t)}this.log("Attempt loading level index "+e+(t?" at sn "+t.msn+" part "+t.part:"")+" with URL-id "+r+" "+a),this.clearTimer(),this.hls.trigger(n.Events.LEVEL_LOADING,{url:a,level:e,id:r,deliveryDirectives:t||null})}},m.removeLevel=function(t,e){var i=function(t,i){return i!==e},r=this._levels.filter((function(r,n){return n!==t||r.url.length>1&&void 0!==e&&(r.url=r.url.filter(i),r.audioGroupIds&&(r.audioGroupIds=r.audioGroupIds.filter(i)),r.textGroupIds&&(r.textGroupIds=r.textGroupIds.filter(i)),r.urlId=0,!0)})).map((function(t,e){var i=t.details;return null!=i&&i.fragments&&i.fragments.forEach((function(t){t.level=e})),t}));this._levels=r,this.hls.trigger(n.Events.LEVELS_UPDATED,{levels:r})},g=l,(f=[{key:"levels",get:function(){return 0===this._levels.length?null:this._levels}},{key:"level",get:function(){return this.currentLevelIndex},set:function(t){var e,i=this._levels;if(0!==i.length&&(this.currentLevelIndex!==t||null===(e=i[t])||void 0===e||!e.details)){if(t<0||t>=i.length){var r=t<0;if(this.hls.trigger(n.Events.ERROR,{type:a.ErrorTypes.OTHER_ERROR,details:a.ErrorDetails.LEVEL_SWITCH_ERROR,level:t,fatal:r,reason:"invalid level idx"}),r)return;t=Math.min(t,i.length-1)}this.clearTimer();var s=this.currentLevelIndex,o=i[s],l=i[t];this.log("switching to level "+t+" from "+s),this.currentLevelIndex=t;var c=d({},l,{level:t,maxBitrate:l.maxBitrate,uri:l.uri,urlId:l.urlId});delete c._urlId,this.hls.trigger(n.Events.LEVEL_SWITCHING,c);var u=l.details;if(!u||u.live){var h=this.switchParams(l.uri,null==o?void 0:o.details);this.loadPlaylist(h)}}}},{key:"manualLevel",get:function(){return this.manualLevelIndex},set:function(t){this.manualLevelIndex=t,void 0===this._startLevel&&(this._startLevel=t),-1!==t&&(this.level=t)}},{key:"firstLevel",get:function(){return this._firstLevel},set:function(t){this._firstLevel=t}},{key:"startLevel",get:function(){if(void 0===this._startLevel){var t=this.hls.config.startLevel;return void 0!==t?t:this._firstLevel}return this._startLevel},set:function(t){this._startLevel=t}},{key:"nextLoadLevel",get:function(){return-1!==this.manualLevelIndex?this.manualLevelIndex:this.hls.nextAutoLevel},set:function(t){this.level=t,-1===this.manualLevelIndex&&(this.hls.nextAutoLevel=t)}}])&&u(g.prototype,f),Object.defineProperty(g,"prototype",{writable:!1}),l}(l.default)},"./src/controller/level-helper.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"addGroupId",(function(){return o})),i.d(e,"assignTrackIdsByGroup",(function(){return l})),i.d(e,"updatePTS",(function(){return c})),i.d(e,"updateFragPTSDTS",(function(){return u})),i.d(e,"mergeDetails",(function(){return h})),i.d(e,"mapPartIntersection",(function(){return p})),i.d(e,"mapFragmentIntersection",(function(){return g})),i.d(e,"adjustSliding",(function(){return f})),i.d(e,"addSliding",(function(){return m})),i.d(e,"computeReloadInterval",(function(){return v})),i.d(e,"getFragmentWithSN",(function(){return y})),i.d(e,"getPartWith",(function(){return A}));var r=i("./src/polyfills/number.ts"),n=i("./src/utils/logger.ts"),a=i("./src/loader/date-range.ts");function s(){return s=Object.assign?Object.assign.bind():function(t){for(var e=1;et.sn?(a=i-t.start,n=t):(a=t.start-i,n=e),n.duration!==a&&(n.duration=a)}else e.sn>t.sn?t.cc===e.cc&&t.minEndPTS?e.start=t.start+(t.minEndPTS-t.start):e.start=t.start+t.duration:e.start=Math.max(t.start-e.duration,0)}function u(t,e,i,a,s,o){a-i<=0&&(n.logger.warn("Fragment should have a positive duration",e),a=i+e.duration,o=s+e.duration);var l=i,c=a,u=e.startPTS,h=e.endPTS;if(Object(r.isFiniteNumber)(u)){var p=Math.abs(u-i);Object(r.isFiniteNumber)(e.deltaPTS)?e.deltaPTS=Math.max(p,e.deltaPTS):e.deltaPTS=p,l=Math.max(i,u),i=Math.min(i,u),s=Math.min(s,e.startDTS),c=Math.min(a,h),a=Math.max(a,h),o=Math.max(o,e.endDTS)}e.duration=a-i;var g=i-e.start;e.appendedPTS=a,e.start=e.startPTS=i,e.maxStartPTS=l,e.startDTS=s,e.endPTS=a,e.minEndPTS=c,e.endDTS=o;var f,m=e.sn;if(!t||mt.endSN)return 0;var v=m-t.startSN,y=t.fragments;for(y[v]=e,f=v;f>0;f--)d(y[f],y[f-1]);for(f=v;f=0;l--){var c=o[l].initSegment;if(c){i=c;break}}t.fragmentHint&&delete t.fragmentHint.endPTS;var d,h,m,v,y,A=0;if(g(t,e,(function(t,n){t.relurl&&(A=t.cc-n.cc),Object(r.isFiniteNumber)(t.startPTS)&&Object(r.isFiniteNumber)(t.endPTS)&&(n.start=n.startPTS=t.startPTS,n.startDTS=t.startDTS,n.appendedPTS=t.appendedPTS,n.maxStartPTS=t.maxStartPTS,n.endPTS=t.endPTS,n.endDTS=t.endDTS,n.minEndPTS=t.minEndPTS,n.duration=t.endPTS-t.startPTS,n.duration&&(d=n),e.PTSKnown=e.alignedSliding=!0),n.elementaryStreams=t.elementaryStreams,n.loader=t.loader,n.stats=t.stats,n.urlId=t.urlId,t.initSegment&&(n.initSegment=t.initSegment,i=t.initSegment)})),i&&(e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments).forEach((function(t){var e;t.initSegment&&t.initSegment.relurl!==(null===(e=i)||void 0===e?void 0:e.relurl)||(t.initSegment=i)})),e.skippedSegments)if(e.deltaUpdateFailed=e.fragments.some((function(t){return!t})),e.deltaUpdateFailed){n.logger.warn("[level-helper] Previous playlist missing segments skipped in delta playlist");for(var b=e.skippedSegments;b--;)e.fragments.shift();e.startSN=e.fragments[0].sn,e.startCC=e.fragments[0].cc}else e.canSkipDateRanges&&(e.dateRanges=(h=t.dateRanges,m=e.dateRanges,v=e.recentlyRemovedDateranges,y=s({},h),v&&v.forEach((function(t){delete y[t]})),Object.keys(m).forEach((function(t){var e=new a.DateRange(m[t].attr,y[t]);e.isValid?y[t]=e:n.logger.warn('Ignoring invalid Playlist Delta Update DATERANGE tag: "'+JSON.stringify(m[t].attr)+'"')})),y));var _=e.fragments;if(A){n.logger.warn("discontinuity sliding from playlist, take drift into account");for(var w=0;w<_.length;w++)_[w].cc+=A}e.skippedSegments&&(e.startCC=e.fragments[0].cc),p(t.partList,e.partList,(function(t,e){e.elementaryStreams=t.elementaryStreams,e.stats=t.stats})),d?u(e,d,d.startPTS,d.endPTS,d.startDTS,d.endDTS):f(t,e),_.length&&(e.totalduration=e.edge-_[0].start),e.driftStartTime=t.driftStartTime,e.driftStart=t.driftStart;var C=e.advancedDateTime;if(e.advanced&&C){var E=e.edge;e.driftStart||(e.driftStartTime=C,e.driftStart=E),e.driftEndTime=C,e.driftEnd=E}else e.driftEndTime=t.driftEndTime,e.driftEnd=t.driftEnd,e.advancedDateTime=t.advancedDateTime}function p(t,e,i){if(t&&e)for(var r=0,n=0,a=t.length;n<=a;n++){var s=t[n],o=e[n+r];s&&o&&s.index===o.index&&s.fragment.sn===o.fragment.sn?i(s,o):r--}}function g(t,e,i){for(var r=e.skippedSegments,n=Math.max(t.startSN,e.startSN)-e.startSN,a=(t.fragmentHint?1:0)+(r?e.endSN:Math.min(t.endSN,e.endSN))-e.startSN,s=e.startSN-t.startSN,o=e.fragmentHint?e.fragments.concat(e.fragmentHint):e.fragments,l=t.fragmentHint?t.fragments.concat(t.fragmentHint):t.fragments,c=n;c<=a;c++){var d=l[s+c],u=o[c];r&&!u&&c=r.length||m(e,r[i].start)}function m(t,e){if(e){for(var i=t.fragments,r=t.skippedSegments;r0&&a<3*r,o=e.loading.end-e.loading.start,l=t.availabilityDelay;if(!1===t.updated)if(s){var c=333*t.misses;i=Math.max(Math.min(n,2*o),c),t.availabilityDelay=(t.availabilityDelay||0)+i}else i=n;else s?(l=Math.min(l||r/2,a),t.availabilityDelay=l,i=l+r-a):i=r-o;return Math.round(i)}function y(t,e,i){if(!t||!t.details)return null;var r=t.details,n=r.fragments[e-r.startSN];return n||((n=r.fragmentHint)&&n.sn===e?n:e1?(r=0,this.bitrateTest=!0):r=i.nextAutoLevel),this.level=i.nextLoadLevel=r,this.loadedmetadata=!1}e>0&&-1===t&&(this.log("Override startPosition with lastCurrentTime @"+e.toFixed(3)),t=e),this.state=n.State.IDLE,this.nextLoadPosition=this.startPosition=this.lastCurrentTime=t,this.tick()}else this._forceStartLoad=!0,this.state=n.State.STOPPED},b.stopLoad=function(){this._forceStartLoad=!1,t.prototype.stopLoad.call(this)},b.doTick=function(){switch(this.state){case n.State.IDLE:this.doTickIdle();break;case n.State.WAITING_LEVEL:var t,e=this.levels,i=this.level,r=null==e||null===(t=e[i])||void 0===t?void 0:t.details;if(r&&(!r.live||this.levelLastLoaded===this.level)){if(this.waitForCdnTuneIn(r))break;this.state=n.State.IDLE;break}break;case n.State.FRAG_LOADING_WAITING_RETRY:var a,s=self.performance.now(),o=this.retryDate;(!o||s>=o||null!==(a=this.media)&&void 0!==a&&a.seeking)&&(this.log("retryDate reached, switch back to IDLE state"),this.resetStartWhenNotLoaded(this.level),this.state=n.State.IDLE)}this.onTickEnd()},b.onTickEnd=function(){t.prototype.onTickEnd.call(this),this.checkBuffer(),this.checkFragmentChanged()},b.doTickIdle=function(){var t,e,i=this.hls,r=this.levelLastLoaded,a=this.levels,o=this.media,u=i.config,h=i.nextLoadLevel;if(null!==r&&(o||!this.startFragRequested&&u.startFragPrefetch)&&(!this.altAudio||!this.audioOnly)&&a&&a[h]){var p=a[h];this.level=i.nextLoadLevel=h;var g=p.details;if(!g||this.state===n.State.WAITING_LEVEL||g.live&&this.levelLastLoaded!==h)this.state=n.State.WAITING_LEVEL;else{var f=this.getMainFwdBufferInfo();if(null!==f&&!(f.len>=this.getMaxBufferLength(p.maxBitrate))){if(this._streamEnded(f,g)){var m={};return this.altAudio&&(m.type="video"),this.hls.trigger(s.Events.BUFFER_EOS,m),void(this.state=n.State.ENDED)}this.backtrackFragment&&this.backtrackFragment.start>f.end&&(this.backtrackFragment=null);var v=this.backtrackFragment?this.backtrackFragment.start:f.end,y=this.getNextFragment(v,g);if(this.couldBacktrack&&!this.fragPrevious&&y&&"initSegment"!==y.sn&&this.fragmentTracker.getState(y)!==l.FragmentState.OK){var A,b=(null!=(A=this.backtrackFragment)?A:y).sn-g.startSN,_=g.fragments[b-1];_&&y.cc===_.cc&&(y=_,this.fragmentTracker.removeFragment(_))}else this.backtrackFragment&&f.len&&(this.backtrackFragment=null);if(y&&this.fragmentTracker.getState(y)===l.FragmentState.OK&&this.nextLoadPosition>v){var w=this.audioOnly&&!this.altAudio?d.ElementaryStreamTypes.AUDIO:d.ElementaryStreamTypes.VIDEO;o&&this.afterBufferFlushed(o,w,c.PlaylistLevelType.MAIN),y=this.getNextFragment(this.nextLoadPosition,g)}y&&(!y.initSegment||y.initSegment.data||this.bitrateTest||(y=y.initSegment),"identity"!==(null===(t=y.decryptdata)||void 0===t?void 0:t.keyFormat)||null!==(e=y.decryptdata)&&void 0!==e&&e.key?this.loadFragment(y,g,v):this.loadKey(y,g))}}}},b.loadFragment=function(e,i,r){var n,a=this.fragmentTracker.getState(e);this.fragCurrent=e,a===l.FragmentState.NOT_LOADED||a===l.FragmentState.PARTIAL?"initSegment"===e.sn?this._loadInitSegment(e):this.bitrateTest?(this.log("Fragment "+e.sn+" of level "+e.level+" is being downloaded to test bitrate and will not be buffered"),this._loadBitrateTestFrag(e)):(this.startFragRequested=!0,t.prototype.loadFragment.call(this,e,i,r)):a===l.FragmentState.APPENDING?this.reduceMaxBufferLength(e.duration)&&this.fragmentTracker.removeFragment(e):0===(null===(n=this.media)||void 0===n?void 0:n.buffered.length)&&this.fragmentTracker.removeAllFragments()},b.getAppendedFrag=function(t){var e=this.fragmentTracker.getAppendedFrag(t,c.PlaylistLevelType.MAIN);return e&&"fragment"in e?e.fragment:e},b.getBufferedFrag=function(t){return this.fragmentTracker.getBufferedFrag(t,c.PlaylistLevelType.MAIN)},b.followingBufferedFrag=function(t){return t?this.getBufferedFrag(t.end+.5):null},b.immediateLevelSwitch=function(){this.abortCurrentFrag(),this.flushMainBuffer(0,Number.POSITIVE_INFINITY)},b.nextLevelSwitch=function(){var t=this.levels,e=this.media;if(null!=e&&e.readyState){var i,r=this.getAppendedFrag(e.currentTime);if(r&&r.start>1&&this.flushMainBuffer(0,r.start-1),!e.paused&&t){var n=t[this.hls.nextLoadLevel],a=this.fragLastKbps;i=a&&this.fragCurrent?this.fragCurrent.duration*n.maxBitrate/(1e3*a)+1:0}else i=0;var s=this.getBufferedFrag(e.currentTime+i);if(s){var o=this.followingBufferedFrag(s);if(o){this.abortCurrentFrag();var l=o.maxStartPTS?o.maxStartPTS:o.start,c=o.duration,d=Math.max(s.end,l+Math.min(Math.max(c-this.config.maxFragLookUpTolerance,.5*c),.75*c));this.flushMainBuffer(d,Number.POSITIVE_INFINITY)}}}},b.abortCurrentFrag=function(){var t=this.fragCurrent;switch(this.fragCurrent=null,this.backtrackFragment=null,null!=t&&t.loader&&t.loader.abort(),this.state){case n.State.KEY_LOADING:case n.State.FRAG_LOADING:case n.State.FRAG_LOADING_WAITING_RETRY:case n.State.PARSING:case n.State.PARSED:this.state=n.State.IDLE}this.nextLoadPosition=this.getLoadPosition()},b.flushMainBuffer=function(e,i){t.prototype.flushMainBuffer.call(this,e,i,this.altAudio?"video":null)},b.onMediaAttached=function(e,i){t.prototype.onMediaAttached.call(this,e,i);var r=i.media;this.onvplaying=this.onMediaPlaying.bind(this),this.onvseeked=this.onMediaSeeked.bind(this),r.addEventListener("playing",this.onvplaying),r.addEventListener("seeked",this.onvseeked),this.gapController=new p.default(this.config,r,this.fragmentTracker,this.hls)},b.onMediaDetaching=function(){var e=this.media;e&&this.onvplaying&&this.onvseeked&&(e.removeEventListener("playing",this.onvplaying),e.removeEventListener("seeked",this.onvseeked),this.onvplaying=this.onvseeked=null,this.videoBuffer=null),this.fragPlaying=null,this.gapController&&(this.gapController.destroy(),this.gapController=null),t.prototype.onMediaDetaching.call(this)},b.onMediaPlaying=function(){this.tick()},b.onMediaSeeked=function(){var t=this.media,e=t?t.currentTime:null;Object(r.isFiniteNumber)(e)&&this.log("Media seeked to "+e.toFixed(3)),this.tick()},b.onManifestLoading=function(){this.log("Trigger BUFFER_RESET"),this.hls.trigger(s.Events.BUFFER_RESET,void 0),this.fragmentTracker.removeAllFragments(),this.couldBacktrack=!1,this.startPosition=this.lastCurrentTime=0,this.fragPlaying=null,this.backtrackFragment=null},b.onManifestParsed=function(t,e){var i,r=!1,n=!1;e.levels.forEach((function(t){(i=t.audioCodec)&&(-1!==i.indexOf("mp4a.40.2")&&(r=!0),-1!==i.indexOf("mp4a.40.5")&&(n=!0))})),this.audioCodecSwitch=r&&n&&!Object(a.changeTypeSupported)(),this.audioCodecSwitch&&this.log("Both AAC/HE-AAC audio found in levels; declaring level codec as HE-AAC"),this.levels=e.levels,this.startFragRequested=!1},b.onLevelLoading=function(t,e){var i=this.levels;if(i&&this.state===n.State.IDLE){var r=i[e.level];(!r.details||r.details.live&&this.levelLastLoaded!==e.level||this.waitForCdnTuneIn(r.details))&&(this.state=n.State.WAITING_LEVEL)}},b.onLevelLoaded=function(t,e){var i,r=this.levels,a=e.level,o=e.details,l=o.totalduration;if(r){this.log("Level "+a+" loaded ["+o.startSN+","+o.endSN+"], cc ["+o.startCC+", "+o.endCC+"] duration:"+l);var c=this.fragCurrent;!c||this.state!==n.State.FRAG_LOADING&&this.state!==n.State.FRAG_LOADING_WAITING_RETRY||c.level!==e.level&&c.loader&&(this.state=n.State.IDLE,this.backtrackFragment=null,c.loader.abort());var d=r[a],u=0;if(o.live||null!==(i=d.details)&&void 0!==i&&i.live){if(o.fragments[0]||(o.deltaUpdateFailed=!0),o.deltaUpdateFailed)return;u=this.alignPlaylists(o,d.details)}if(d.details=o,this.levelLastLoaded=a,this.hls.trigger(s.Events.LEVEL_UPDATED,{details:o,level:a}),this.state===n.State.WAITING_LEVEL){if(this.waitForCdnTuneIn(o))return;this.state=n.State.IDLE}this.startFragRequested?o.live&&this.synchronizeToLiveEdge(o):this.setStartPosition(o,u),this.tick()}else this.warn("Levels were reset while loading level "+a)},b._handleFragmentLoadProgress=function(t){var e,i=t.frag,r=t.part,n=t.payload,a=this.levels;if(a){var s=a[i.level],o=s.details;if(o){var l=s.videoCodec,d=o.PTSKnown||!o.live,p=null===(e=i.initSegment)||void 0===e?void 0:e.data,g=this._getAudioCodec(s),f=this.transmuxer=this.transmuxer||new u.default(this.hls,c.PlaylistLevelType.MAIN,this._handleTransmuxComplete.bind(this),this._handleTransmuxerFlush.bind(this)),m=r?r.index:-1,v=-1!==m,y=new h.ChunkMetadata(i.level,i.sn,i.stats.chunkCount,n.byteLength,m,v),A=this.initPTS[i.cc];f.push(n,p,g,l,i,r,o.totalduration,d,y,A)}else this.warn("Dropping fragment "+i.sn+" of level "+i.level+" after level details were reset")}else this.warn("Levels were reset while fragment load was in progress. Fragment "+i.sn+" of level "+i.level+" will not be buffered")},b.onAudioTrackSwitching=function(t,e){var i=this.altAudio,r=!!e.url,n=e.id;if(!r){if(this.mediaBuffer!==this.media){this.log("Switching on main audio, use media.buffered to schedule main fragment loading"),this.mediaBuffer=this.media;var a=this.fragCurrent;null!=a&&a.loader&&(this.log("Switching to main audio track, cancel main fragment load"),a.loader.abort()),this.resetTransmuxer(),this.resetLoadingState()}else this.audioOnly&&this.resetTransmuxer();var o=this.hls;i&&o.trigger(s.Events.BUFFER_FLUSHING,{startOffset:0,endOffset:Number.POSITIVE_INFINITY,type:"audio"}),o.trigger(s.Events.AUDIO_TRACK_SWITCHED,{id:n})}},b.onAudioTrackSwitched=function(t,e){var i=e.id,r=!!this.hls.audioTracks[i].url;if(r){var n=this.videoBuffer;n&&this.mediaBuffer!==n&&(this.log("Switching on alternate audio, use video.buffered to schedule main fragment loading"),this.mediaBuffer=n)}this.altAudio=r,this.tick()},b.onBufferCreated=function(t,e){var i,r,n=e.tracks,a=!1;for(var s in n){var o=n[s];if("main"===o.id){if(r=s,i=o,"video"===s){var l=n[s];l&&(this.videoBuffer=l.buffer)}}else a=!0}a&&i?(this.log("Alternate track found, use "+r+".buffered to schedule main fragment loading"),this.mediaBuffer=i.buffer):this.mediaBuffer=this.media},b.onFragBuffered=function(t,e){var i=e.frag,r=e.part;if(!i||i.type===c.PlaylistLevelType.MAIN){if(this.fragContextChanged(i))return this.warn("Fragment "+i.sn+(r?" p: "+r.index:"")+" of level "+i.level+" finished buffering, but was aborted. state: "+this.state),void(this.state===n.State.PARSED&&(this.state=n.State.IDLE));var a=r?r.stats:i.stats;this.fragLastKbps=Math.round(8*a.total/(a.buffering.end-a.loading.first)),"initSegment"!==i.sn&&(this.fragPrevious=i),this.fragBufferedComplete(i,r)}},b.onError=function(t,e){switch(e.details){case g.ErrorDetails.FRAG_LOAD_ERROR:case g.ErrorDetails.FRAG_LOAD_TIMEOUT:case g.ErrorDetails.KEY_LOAD_ERROR:case g.ErrorDetails.KEY_LOAD_TIMEOUT:this.onFragmentOrKeyLoadError(c.PlaylistLevelType.MAIN,e);break;case g.ErrorDetails.LEVEL_LOAD_ERROR:case g.ErrorDetails.LEVEL_LOAD_TIMEOUT:this.state!==n.State.ERROR&&(e.fatal?(this.warn(""+e.details),this.state=n.State.ERROR):e.levelRetry||this.state!==n.State.WAITING_LEVEL||(this.state=n.State.IDLE));break;case g.ErrorDetails.BUFFER_FULL_ERROR:if("main"===e.parent&&(this.state===n.State.PARSING||this.state===n.State.PARSED)){var i=!0,r=this.getFwdBufferInfo(this.media,c.PlaylistLevelType.MAIN);r&&r.len>.5&&(i=!this.reduceMaxBufferLength(r.len)),i&&(this.warn("buffer full error also media.currentTime is not buffered, flush main"),this.immediateLevelSwitch()),this.resetLoadingState()}}},b.checkBuffer=function(){var t=this.media,e=this.gapController;if(t&&e&&t.readyState){var i=o.BufferHelper.getBuffered(t);if(!this.loadedmetadata&&i.length)this.loadedmetadata=!0,this.seekToStartPos();else{var r=this.state!==n.State.IDLE?this.fragCurrent:null;e.poll(this.lastCurrentTime,r)}this.lastCurrentTime=t.currentTime}},b.onFragLoadEmergencyAborted=function(){this.state=n.State.IDLE,this.loadedmetadata||(this.startFragRequested=!1,this.nextLoadPosition=this.startPosition),this.tickImmediate()},b.onBufferFlushed=function(t,e){var i=e.type;if(i!==d.ElementaryStreamTypes.AUDIO||this.audioOnly&&!this.altAudio){var r=(i===d.ElementaryStreamTypes.VIDEO?this.videoBuffer:this.mediaBuffer)||this.media;this.afterBufferFlushed(r,i,c.PlaylistLevelType.MAIN)}},b.onLevelsUpdated=function(t,e){this.levels=e.levels},b.swapAudioCodec=function(){this.audioCodecSwap=!this.audioCodecSwap},b.seekToStartPos=function(){var t=this.media;if(t){var e=t.currentTime,i=this.startPosition;if(i>=0&&e0&&(n1&&!1===t.seeking){var i=t.currentTime;if(o.BufferHelper.isBuffered(t,i)?e=this.getAppendedFrag(i):o.BufferHelper.isBuffered(t,i+.1)&&(e=this.getAppendedFrag(i+.1)),e){this.backtrackFragment=null;var r=this.fragPlaying,n=e.level;r&&e.sn===r.sn&&r.level===n&&e.urlId===r.urlId||(this.hls.trigger(s.Events.FRAG_CHANGED,{frag:e}),r&&r.level===n||this.hls.trigger(s.Events.LEVEL_SWITCHED,{level:n}),this.fragPlaying=e)}}},y=v,(A=[{key:"nextLevel",get:function(){var t=this.nextBufferedFrag;return t?t.level:-1}},{key:"currentFrag",get:function(){var t=this.media;return t?this.fragPlaying||this.getAppendedFrag(t.currentTime):null}},{key:"currentProgramDateTime",get:function(){var t=this.media;if(t){var e=t.currentTime,i=this.currentFrag;if(i&&Object(r.isFiniteNumber)(e)&&Object(r.isFiniteNumber)(i.programDateTime)){var n=i.programDateTime+1e3*(e-i.start);return new Date(n)}}return null}},{key:"currentLevel",get:function(){var t=this.currentFrag;return t?t.level:-1}},{key:"nextBufferedFrag",get:function(){var t=this.currentFrag;return t?this.followingBufferedFrag(t):null}},{key:"forceStartLoad",get:function(){return this._forceStartLoad}}])&&f(y.prototype,A),Object.defineProperty(y,"prototype",{writable:!1}),v}(n.default)},"./src/controller/subtitle-stream-controller.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"SubtitleStreamController",(function(){return g}));var r=i("./src/events.ts"),n=i("./src/utils/buffer-helper.ts"),a=i("./src/controller/fragment-finders.ts"),s=i("./src/utils/discontinuities.ts"),o=i("./src/controller/level-helper.ts"),l=i("./src/controller/fragment-tracker.ts"),c=i("./src/controller/base-stream-controller.ts"),d=i("./src/types/loader.ts"),u=i("./src/types/level.ts");function h(t,e){for(var i=0;i=n[o].start&&s<=n[o].end){a=n[o];break}var l=i.start+i.duration;a?a.end=l:(a={start:s,end:l},n.push(a)),this.fragmentTracker.fragBuffered(i)}}},y.onBufferFlushing=function(t,e){var i=e.startOffset,r=e.endOffset;if(0===i&&r!==Number.POSITIVE_INFINITY){var n=this.currentTrackId,a=this.levels;if(!a.length||!a[n]||!a[n].details)return;var s=r-a[n].details.targetduration;if(s<=0)return;e.endOffsetSubtitles=Math.max(0,s),this.tracksBuffered.forEach((function(t){for(var e=0;e=d.length||n!==l)&&u){if(this.mediaBuffer=this.mediaBufferTimeRanges,r.live||null!==(i=u.details)&&void 0!==i&&i.live){var h=this.mainDetails;if(r.deltaUpdateFailed||!h)return;var p=h.fragments[0];u.details?0===this.alignPlaylists(r,u.details)&&p&&Object(o.addSliding)(r,p.start):r.hasProgramDateTime&&h.hasProgramDateTime?Object(s.alignMediaPlaylistByPDT)(r,h):p&&Object(o.addSliding)(r,p.start)}u.details=r,this.levelLastLoaded=n,this.tick(),r.live&&!this.fragCurrent&&this.media&&this.state===c.State.IDLE&&(Object(a.findFragmentByPTS)(null,r.fragments,this.media.currentTime,0)||(this.warn("Subtitle playlist not aligned with playback"),u.details=void 0))}}},y._handleFragmentLoadComplete=function(t){var e=t.frag,i=t.payload,n=e.decryptdata,a=this.hls;if(!this.fragContextChanged(e)&&i&&i.byteLength>0&&n&&n.key&&n.iv&&"AES-128"===n.method){var s=performance.now();this.decrypter.webCryptoDecrypt(new Uint8Array(i),n.key.buffer,n.iv.buffer).then((function(t){var i=performance.now();a.trigger(r.Events.FRAG_DECRYPTED,{frag:e,payload:t,stats:{tstart:s,tdecrypt:i}})}))}},y.doTick=function(){if(this.media){if(this.state===c.State.IDLE){var t=this.currentTrackId,e=this.levels;if(!e.length||!e[t]||!e[t].details)return;var i=e[t].details,r=i.targetduration,s=this.config,o=this.media,d=n.BufferHelper.bufferedInfo(this.tracksBuffered[this.currentTrackId]||[],o.currentTime-r,s.maxBufferHole),u=d.end;if(d.len>this.getMaxBufferLength()+r)return;console.assert(i,"Subtitle track details are defined on idle subtitle stream controller tick");var h,p=i.fragments,g=p.length,f=i.edge,m=this.fragPrevious;if(u>>=0)>r-1)throw new DOMException("Failed to execute '"+e+"' on 'TimeRanges': The index provided ("+i+") is greater than the maximum bound ("+r+")");return t[i][e]};this.buffered={get length(){return t.length},end:function(i){return e("end",i,t.length)},start:function(i){return e("start",i,t.length)}}}},"./src/controller/subtitle-track-controller.ts":function(t,e,i){"use strict";i.r(e);var r=i("./src/events.ts"),n=i("./src/utils/texttrack-utils.ts"),a=i("./src/controller/base-playlist-controller.ts"),s=i("./src/types/loader.ts");function o(t,e){for(var i=0;i-1&&(this.subtitleTrack=this.queuedDefaultTrack,this.queuedDefaultTrack=-1),this.useTextTrackPolling=!(this.media.textTracks&&"onchange"in this.media.textTracks),this.useTextTrackPolling?this.pollTrackChange(500):this.media.textTracks.addEventListener("change",this.asyncPollTrackChange))},h.pollTrackChange=function(t){self.clearInterval(this.subtitlePollingInterval),this.subtitlePollingInterval=self.setInterval(this.trackChangeListener,t)},h.onMediaDetaching=function(){this.media&&(self.clearInterval(this.subtitlePollingInterval),this.useTextTrackPolling||this.media.textTracks.removeEventListener("change",this.asyncPollTrackChange),this.trackId>-1&&(this.queuedDefaultTrack=this.trackId),d(this.media.textTracks).forEach((function(t){Object(n.clearCurrentCues)(t)})),this.subtitleTrack=-1,this.media=null)},h.onManifestLoading=function(){this.tracks=[],this.groupId=null,this.tracksInGroup=[],this.trackId=-1,this.selectDefaultTrack=!0},h.onManifestParsed=function(t,e){this.tracks=e.subtitleTracks},h.onSubtitleTrackLoaded=function(t,e){var i=e.id,r=e.details,n=this.trackId,a=this.tracksInGroup[n];if(a){var s=a.details;a.details=e.details,this.log("subtitle track "+i+" loaded ["+r.startSN+"-"+r.endSN+"]"),i===this.trackId&&(this.retryCount=0,this.playlistLoaded(i,e,s))}else this.warn("Invalid subtitle track id "+i)},h.onLevelLoading=function(t,e){this.switchLevel(e.level)},h.onLevelSwitching=function(t,e){this.switchLevel(e.level)},h.switchLevel=function(t){var e=this.hls.levels[t];if(null!=e&&e.textGroupIds){var i=e.textGroupIds[e.urlId];if(this.groupId!==i){var n=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0,a=this.tracks.filter((function(t){return!i||t.groupId===i}));this.tracksInGroup=a;var s=this.findTrackId(null==n?void 0:n.name)||this.findTrackId();this.groupId=i;var o={subtitleTracks:a};this.log("Updating subtitle tracks, "+a.length+' track(s) found in "'+i+'" group-id'),this.hls.trigger(r.Events.SUBTITLE_TRACKS_UPDATED,o),-1!==s&&this.setSubtitleTrack(s,n)}}},h.findTrackId=function(t){for(var e=this.tracksInGroup,i=0;i=n.length)){this.clearTimer();var a=n[t];if(this.log("Switching to subtitle track "+t),this.trackId=t,a){var s=a.id,o=a.groupId,l=void 0===o?"":o,c=a.name,d=a.type,u=a.url;this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:s,groupId:l,name:c,type:d,url:u});var h=this.switchParams(a.url,null==e?void 0:e.details);this.loadPlaylist(h)}else this.hls.trigger(r.Events.SUBTITLE_TRACK_SWITCH,{id:t})}}else this.queuedDefaultTrack=t},h.onTextTracksChanged=function(){if(this.useTextTrackPolling||self.clearInterval(this.subtitlePollingInterval),this.media&&this.hls.config.renderTextTracksNatively){for(var t=-1,e=d(this.media.textTracks),i=0;i-1&&this.toggleTrackModes(this.trackId)}},{key:"subtitleTracks",get:function(){return this.tracksInGroup}},{key:"subtitleTrack",get:function(){return this.trackId},set:function(t){this.selectDefaultTrack=!1;var e=this.tracksInGroup?this.tracksInGroup[this.trackId]:void 0;this.setSubtitleTrack(t,e)}}])&&o(c.prototype,u),Object.defineProperty(c,"prototype",{writable:!1}),a}(a.default);function d(t){for(var e=[],i=0;i=0&&(h[0]=Math.min(h[0],e),h[1]=Math.max(h[1],i),d=!0,p/(i-e)>.5))return}if(d||a.push([e,i]),this.config.renderTextTracksNatively){var g=this.captionsTracks[t];this.Cues.newCue(g,e,i,r)}else{var f=this.Cues.newCue(null,e,i,r);this.hls.trigger(n.Events.CUES_PARSED,{type:"captions",cues:f,track:t})}},e.onInitPtsFound=function(t,e){var i=this,r=e.frag,a=e.id,s=e.initPTS,o=e.timescale,l=this.unparsedVttFrags;"main"===a&&(this.initPTS[r.cc]=s,this.timescale[r.cc]=o),l.length&&(this.unparsedVttFrags=[],l.forEach((function(t){i.onFragLoaded(n.Events.FRAG_LOADED,t)})))},e.getExistingTrack=function(t){var e=this.media;if(e)for(var i=0;i>>8^255&m^99,t[p]=m,e[m]=p;var v=h[p],y=h[v],A=h[y],b=257*h[m]^16843008*m;r[p]=b<<24|b>>>8,n[p]=b<<16|b>>>16,a[p]=b<<8|b>>>24,s[p]=b,b=16843009*A^65537*y^257*v^16843008*p,l[m]=b<<24|b>>>8,c[m]=b<<16|b>>>16,d[m]=b<<8|b>>>24,u[m]=b,p?(p=v^h[h[h[A^v]]],g^=h[h[g]]):p=g=1}},e.expandKey=function(t){for(var e=this.uint8ArrayToUint32Array_(t),i=!0,r=0;r>>6);var g=(60&e[i+2])>>>2;if(!(g>p.length-1))return c=(1&e[i+2])<<2,c|=(192&e[i+3])>>>6,r.logger.log("manifest codec:"+s+", ADTS type:"+o+", samplingIndex:"+g),/firefox/i.test(u)?g>=6?(o=5,d=new Array(4),l=g-3):(o=2,d=new Array(2),l=g):-1!==u.indexOf("android")?(o=2,d=new Array(2),l=g):(o=5,d=new Array(4),s&&(-1!==s.indexOf("mp4a.40.29")||-1!==s.indexOf("mp4a.40.5"))||!s&&g>=6?l=g-3:((s&&-1!==s.indexOf("mp4a.40.2")&&(g>=6&&1===c||/vivaldi/i.test(u))||!s&&1===c)&&(o=2,d=new Array(2)),l=g)),d[0]=o<<3,d[0]|=(14&g)>>1,d[1]|=(1&g)<<7,d[1]|=c<<3,5===o&&(d[1]|=(14&l)>>1,d[2]=(1&l)<<7,d[2]|=8,d[3]=0),{config:d,samplerate:p[g],channelCount:c,codec:"mp4a.40."+o,manifestCodec:h};t.trigger(a.Events.ERROR,{type:n.ErrorTypes.MEDIA_ERROR,details:n.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"invalid ADTS sampling index:"+g})}function o(t,e){return 255===t[e]&&240==(246&t[e+1])}function l(t,e){return 1&t[e+1]?7:9}function c(t,e){return(3&t[e+3])<<11|t[e+4]<<3|(224&t[e+5])>>>5}function d(t,e){return e+5=t.length)return!1;var r=c(t,e);if(r<=i)return!1;var n=e+r;return n===t.length||u(t,n)}return!1}function g(t,e,i,n,a){if(!t.samplerate){var o=s(e,i,n,a);if(!o)return;t.config=o.config,t.samplerate=o.samplerate,t.channelCount=o.channelCount,t.codec=o.codec,t.manifestCodec=o.manifestCodec,r.logger.log("parsed codec:"+t.codec+", rate:"+o.samplerate+", channels:"+o.channelCount)}}function f(t){return 9216e4/t}function m(t,e){var i=l(t,e);if(e+i<=t.length){var r=c(t,e)-i;if(r>0)return{headerLength:i,frameLength:r}}}function v(t,e,i,r,n){var a,s=r+n*f(t.samplerate),o=m(e,i);if(o){var l=o.frameLength,c=o.headerLength,d=c+l,u=Math.max(0,i+d-e.length);u?(a=new Uint8Array(d-c)).set(e.subarray(i+c,e.length),0):a=e.subarray(i+c,i+d);var h={unit:a,pts:s};return u||t.samples.push(h),{sample:h,length:d,missing:u}}var p=e.length-i;return(a=new Uint8Array(p)).set(e.subarray(i,e.length),0),{sample:{unit:a,pts:s},length:p,missing:-1}}},"./src/demux/base-audio-demuxer.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"initPTSFn",(function(){return d}));var r=i("./src/polyfills/number.ts"),n=i("./src/demux/id3.ts"),a=i("./src/types/demuxer.ts"),s=i("./src/demux/dummy-demuxed-track.ts"),o=i("./src/utils/mp4-tools.ts"),l=i("./src/utils/typed-array.ts"),c=function(){function t(){this._audioTrack=void 0,this._id3Track=void 0,this.frameIndex=0,this.cachedData=null,this.basePTS=null,this.initPTS=null}var e=t.prototype;return e.resetInitSegment=function(t,e,i,r){this._id3Track={type:"id3",id:3,pid:-1,inputTimeScale:9e4,sequenceNumber:0,samples:[],dropped:0}},e.resetTimeStamp=function(t){this.initPTS=t,this.resetContiguity()},e.resetContiguity=function(){this.basePTS=null,this.frameIndex=0},e.canParse=function(t,e){return!1},e.appendFrame=function(t,e,i){},e.demux=function(t,e){this.cachedData&&(t=Object(o.appendUint8Array)(this.cachedData,t),this.cachedData=null);var i,c,u=n.getID3Data(t,0),h=u?u.length:0,p=this._audioTrack,g=this._id3Track,f=u?n.getTimeStamp(u):void 0,m=t.length;for((null===this.basePTS||0===this.frameIndex&&Object(r.isFiniteNumber)(f))&&(this.basePTS=d(f,e,this.initPTS)),u&&u.length>0&&g.samples.push({pts:this.basePTS,dts:this.basePTS,data:u,type:a.MetadataSchema.audioId3}),c=this.basePTS;ht?(this.word<<=t,this.bitsAvailable-=t):(t-=this.bitsAvailable,t-=(e=t>>3)>>3,this.bytesAvailable-=e,this.loadWord(),this.word<<=t,this.bitsAvailable-=t)},e.readBits=function(t){var e=Math.min(this.bitsAvailable,t),i=this.word>>>32-e;return t>32&&r.logger.error("Cannot read more than 32 bits at a time"),this.bitsAvailable-=e,this.bitsAvailable>0?this.word<<=e:this.bytesAvailable>0&&this.loadWord(),(e=t-e)>0&&this.bitsAvailable?i<>>t)return this.word<<=t,this.bitsAvailable-=t,t;return this.loadWord(),t+this.skipLZ()},e.skipUEG=function(){this.skipBits(1+this.skipLZ())},e.skipEG=function(){this.skipBits(1+this.skipLZ())},e.readUEG=function(){var t=this.skipLZ();return this.readBits(t+1)-1},e.readEG=function(){var t=this.readUEG();return 1&t?1+t>>>1:-1*(t>>>1)},e.readBoolean=function(){return 1===this.readBits(1)},e.readUByte=function(){return this.readBits(8)},e.readUShort=function(){return this.readBits(16)},e.readUInt=function(){return this.readBits(32)},e.skipScalingList=function(t){for(var e=8,i=8,r=0;r0)return t.subarray(i,i+r)},o=function(t,e){var i=0;return i=(127&t[e])<<21,i|=(127&t[e+1])<<14,(i|=(127&t[e+2])<<7)|127&t[e+3]},l=function(t,e){return n(t,e)&&o(t,e+6)+10<=t.length-e},c=function(t){for(var e=h(t),i=0;i>4){case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:c+=String.fromCharCode(a);break;case 12:case 13:s=t[d++],c+=String.fromCharCode((31&a)<<6|63&s);break;case 14:s=t[d++],o=t[d++],c+=String.fromCharCode((15&a)<<12|(63&s)<<6|63&o)}}return c},A={decodeTextFrame:f};function b(){return r||void 0===self.TextDecoder||(r=new self.TextDecoder("utf-8")),r}},"./src/demux/mp3demuxer.ts":function(t,e,i){"use strict";i.r(e);var r=i("./src/demux/base-audio-demuxer.ts"),n=i("./src/demux/id3.ts"),a=i("./src/utils/logger.ts"),s=i("./src/demux/mpegaudio.ts");function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}var l=function(t){var e,i;function r(){return t.apply(this,arguments)||this}i=t,(e=r).prototype=Object.create(i.prototype),e.prototype.constructor=e,o(e,i);var l=r.prototype;return l.resetInitSegment=function(e,i,r,n){t.prototype.resetInitSegment.call(this,e,i,r,n),this._audioTrack={container:"audio/mpeg",type:"audio",id:2,pid:-1,sequenceNumber:0,segmentCodec:"mp3",samples:[],manifestCodec:i,duration:n,inputTimeScale:9e4,dropped:0}},r.probe=function(t){if(!t)return!1;for(var e=(n.getID3Data(t,0)||[]).length,i=t.length;e16384?t.subarray(0,16384):t,Object(a.findBox)(t,["moof"]).length>0},e.demux=function(t,e){this.timeOffset=e;var i=t,r=this.videoTrack,n=this.txtTrack;if(this.config.progressive){this.remainderData&&(i=Object(a.appendUint8Array)(this.remainderData,t));var s=Object(a.segmentValidRange)(i);this.remainderData=s.remainder,r.samples=s.valid||new Uint8Array}else r.samples=i;var o=this.extractID3Track(r,e);return n.samples=Object(a.parseSamples)(e,r),{videoTrack:r,audioTrack:this.audioTrack,id3Track:o,textTrack:this.txtTrack}},e.flush=function(){var t=this.timeOffset,e=this.videoTrack,i=this.txtTrack;e.samples=this.remainderData||new Uint8Array,this.remainderData=null;var r=this.extractID3Track(e,this.timeOffset);return i.samples=Object(a.parseSamples)(t,e),{videoTrack:e,audioTrack:Object(s.dummyTrack)(),id3Track:r,textTrack:Object(s.dummyTrack)()}},e.extractID3Track=function(t,e){var i=this.id3Track;if(t.samples.length){var s=Object(a.findBox)(t.samples,["emsg"]);s&&s.forEach((function(t){var s=Object(a.parseEmsg)(t);if(o.test(s.schemeIdUri)){var l=Object(r.isFiniteNumber)(s.presentationTime)?s.presentationTime/s.timeScale:e+s.presentationTimeDelta/s.timeScale,c=s.payload;i.samples.push({data:c,len:c.byteLength,dts:l,pts:l,type:n.MetadataSchema.emsg})}}))}return i},e.demuxSampleAes=function(t,e,i){return Promise.reject(new Error("The MP4 demuxer does not support SAMPLE-AES decryption"))},e.destroy=function(){},t}();e.default=l},"./src/demux/mpegaudio.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"appendFrame",(function(){return l})),i.d(e,"parseHeader",(function(){return c})),i.d(e,"isHeaderPattern",(function(){return d})),i.d(e,"isHeader",(function(){return u})),i.d(e,"canParse",(function(){return h})),i.d(e,"probe",(function(){return p}));var r=null,n=[32,64,96,128,160,192,224,256,288,320,352,384,416,448,32,48,56,64,80,96,112,128,160,192,224,256,320,384,32,40,48,56,64,80,96,112,128,160,192,224,256,320,32,48,56,64,80,96,112,128,144,160,176,192,224,256,8,16,24,32,40,48,56,64,80,96,112,128,144,160],a=[44100,48e3,32e3,22050,24e3,16e3,11025,12e3,8e3],s=[[0,72,144,12],[0,0,0,0],[0,72,144,12],[0,144,144,12]],o=[0,1,1,4];function l(t,e,i,r,n){if(!(i+24>e.length)){var a=c(e,i);if(a&&i+a.frameLength<=e.length){var s=r+n*(9e4*a.samplesPerFrame/a.sampleRate),o={unit:e.subarray(i,i+a.frameLength),pts:s,dts:s};return t.config=[],t.channelCount=a.channelCount,t.samplerate=a.sampleRate,t.samples.push(o),{sample:o,length:a.frameLength,missing:0}}}}function c(t,e){var i=t[e+1]>>3&3,l=t[e+1]>>1&3,c=t[e+2]>>4&15,d=t[e+2]>>2&3;if(1!==i&&0!==c&&15!==c&&3!==d){var u=t[e+2]>>1&1,h=t[e+3]>>6,p=1e3*n[14*(3===i?3-l:3===l?3:4)+c-1],g=a[3*(3===i?0:2===i?1:2)+d],f=3===h?1:2,m=s[i][l],v=o[l],y=8*m*v,A=Math.floor(m*p/g+u)*v;if(null===r){var b=(navigator.userAgent||"").match(/Chrome\/(\d+)/i);r=b?parseInt(b[1]):0}return!!r&&r<=87&&2===l&&p>=224e3&&0===h&&(t[e+3]=128|t[e+3]),{sampleRate:g,channelCount:f,frameLength:A,samplesPerFrame:y}}}function d(t,e){return!(255!==t[e]||224&~t[e+1]||!(6&t[e+1]))}function u(t,e){return e+1=t.length)return void i();if(!(t[e].unit.length<32)){var r=this.decrypter.isSync();if(this.decryptAacSample(t,e,i,r),!r)return}}},e.getAvcEncryptedData=function(t){for(var e=16*Math.floor((t.length-48)/160)+16,i=new Int8Array(e),r=0,n=32;n=t.length)return void r();for(var n=t[e].units;!(i>=n.length);i++){var a=n[i];if(!(a.data.length<=48||1!==a.type&&5!==a.type)){var s=this.decrypter.isSync();if(this.decryptAvcSample(t,e,i,r,a,s),!s)return}}}},t}();e.default=a},"./src/demux/transmuxer-interface.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return u}));var r=i("./node_modules/webworkify-webpack/index.js"),n=i("./src/events.ts"),a=i("./src/demux/transmuxer.ts"),s=i("./src/utils/logger.ts"),o=i("./src/errors.ts"),l=i("./src/utils/mediasource-helper.ts"),c=i("./node_modules/eventemitter3/index.js"),d=Object(l.getMediaSource)()||{isTypeSupported:function(){return!1}},u=function(){function t(t,e,i,l){var u=this;this.hls=void 0,this.id=void 0,this.observer=void 0,this.frag=null,this.part=null,this.worker=void 0,this.onwmsg=void 0,this.transmuxer=null,this.onTransmuxComplete=void 0,this.onFlush=void 0,this.hls=t,this.id=e,this.onTransmuxComplete=i,this.onFlush=l;var h=t.config,p=function(e,i){(i=i||{}).frag=u.frag,i.id=u.id,t.trigger(e,i)};this.observer=new c.EventEmitter,this.observer.on(n.Events.FRAG_DECRYPTED,p),this.observer.on(n.Events.ERROR,p);var g={mp4:d.isTypeSupported("video/mp4"),mpeg:d.isTypeSupported("audio/mpeg"),mp3:d.isTypeSupported('audio/mp4; codecs="mp3"')},f=navigator.vendor;if(h.enableWorker&&"undefined"!=typeof Worker){var m;s.logger.log("demuxing in webworker");try{m=this.worker=r("./src/demux/transmuxer-worker.ts"),this.onwmsg=this.onWorkerMessage.bind(this),m.addEventListener("message",this.onwmsg),m.onerror=function(e){t.trigger(n.Events.ERROR,{type:o.ErrorTypes.OTHER_ERROR,details:o.ErrorDetails.INTERNAL_EXCEPTION,fatal:!0,event:"demuxerWorker",error:new Error(e.message+" ("+e.filename+":"+e.lineno+")")})},m.postMessage({cmd:"init",typeSupported:g,vendor:f,id:e,config:JSON.stringify(h)})}catch(t){s.logger.warn("Error in worker:",t),s.logger.error("Error while initializing DemuxerWorker, fallback to inline"),m&&self.URL.revokeObjectURL(m.objectURL),this.transmuxer=new a.default(this.observer,g,h,f,e),this.worker=null}}else this.transmuxer=new a.default(this.observer,g,h,f,e)}var e=t.prototype;return e.destroy=function(){var t=this.worker;if(t)t.removeEventListener("message",this.onwmsg),t.terminate(),this.worker=null,this.onwmsg=void 0;else{var e=this.transmuxer;e&&(e.destroy(),this.transmuxer=null)}var i=this.observer;i&&i.removeAllListeners(),this.frag=null,this.observer=null,this.hls=null},e.push=function(t,e,i,r,n,o,l,c,d,u){var h,p,g=this;d.transmuxing.start=self.performance.now();var f=this.transmuxer,m=this.worker,v=o?o.start:n.start,y=n.decryptdata,A=this.frag,b=!(A&&n.cc===A.cc),_=!(A&&d.level===A.level),w=A?d.sn-A.sn:-1,C=this.part?d.part-this.part.index:-1,E=0===w&&d.id>1&&d.id===(null==A?void 0:A.stats.chunkCount),T=!_&&(1===w||0===w&&(1===C||E&&C<=0)),I=self.performance.now();(_||w||0===n.stats.parsing.start)&&(n.stats.parsing.start=I),!o||!C&&T||(o.stats.parsing.start=I);var S=!(A&&(null===(h=n.initSegment)||void 0===h?void 0:h.url)===(null===(p=A.initSegment)||void 0===p?void 0:p.url)),x=new a.TransmuxState(b,T,c,_,v,S);if(!T||b||S){s.logger.log("[transmuxer-interface, "+n.type+"]: Starting new transmux session for sn: "+d.sn+" p: "+d.part+" level: "+d.level+" id: "+d.id+"\n discontinuity: "+b+"\n trackSwitch: "+_+"\n contiguous: "+T+"\n accurateTimeOffset: "+c+"\n timeOffset: "+v+"\n initSegmentChange: "+S);var k=new a.TransmuxConfig(i,r,e,l,u);this.configureTransmuxer(k)}if(this.frag=n,this.part=o,m)m.postMessage({cmd:"demux",data:t,decryptdata:y,chunkMeta:d,state:x},t instanceof ArrayBuffer?[t]:[]);else if(f){var P=f.push(t,y,d,x);Object(a.isPromise)(P)?P.then((function(t){g.handleTransmuxComplete(t)})):this.handleTransmuxComplete(P)}},e.flush=function(t){var e=this;t.transmuxing.start=self.performance.now();var i=this.transmuxer,r=this.worker;if(r)r.postMessage({cmd:"flush",chunkMeta:t});else if(i){var n=i.flush(t);Object(a.isPromise)(n)?n.then((function(i){e.handleFlushResult(i,t)})):this.handleFlushResult(n,t)}},e.handleFlushResult=function(t,e){var i=this;t.forEach((function(t){i.handleTransmuxComplete(t)})),this.onFlush(e)},e.onWorkerMessage=function(t){var e=t.data,i=this.hls;switch(e.event){case"init":self.URL.revokeObjectURL(this.worker.objectURL);break;case"transmuxComplete":this.handleTransmuxComplete(e.data);break;case"flush":this.onFlush(e.data);break;case"workerLog":s.logger[e.data.logType]&&s.logger[e.data.logType](e.data.message);break;default:e.data=e.data||{},e.data.frag=this.frag,e.data.id=this.id,i.trigger(e.event,e.data)}},e.configureTransmuxer=function(t){var e=this.worker,i=this.transmuxer;e?e.postMessage({cmd:"configure",config:t}):i&&i.configure(t)},e.handleTransmuxComplete=function(t){t.chunkMeta.transmuxing.end=self.performance.now(),this.onTransmuxComplete(t)},t}()},"./src/demux/transmuxer-worker.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return o}));var r=i("./src/demux/transmuxer.ts"),n=i("./src/events.ts"),a=i("./src/utils/logger.ts"),s=i("./node_modules/eventemitter3/index.js");function o(t){var e=new s.EventEmitter,i=function(e,i){t.postMessage({event:e,data:i})};e.on(n.Events.FRAG_DECRYPTED,i),e.on(n.Events.ERROR,i),t.addEventListener("message",(function(n){var s=n.data;switch(s.cmd){case"init":var o=JSON.parse(s.config);t.transmuxer=new r.default(e,s.typeSupported,o,s.vendor,s.id),Object(a.enableLogs)(o.debug),function(){var t=function(t){a.logger[t]=function(e){i("workerLog",{logType:t,message:e})}};for(var e in a.logger)t(e)}(),i("init",null);break;case"configure":t.transmuxer.configure(s.config);break;case"demux":var c=t.transmuxer.push(s.data,s.decryptdata,s.chunkMeta,s.state);Object(r.isPromise)(c)?c.then((function(e){l(t,e)})):l(t,c);break;case"flush":var u=s.chunkMeta,h=t.transmuxer.flush(u);Object(r.isPromise)(h)?h.then((function(e){d(t,e,u)})):d(t,h,u)}}))}function l(t,e){if(!((i=e.remuxResult).audio||i.video||i.text||i.id3||i.initSegment))return!1;var i,r=[],n=e.remuxResult,a=n.audio,s=n.video;return a&&c(r,a),s&&c(r,s),t.postMessage({event:"transmuxComplete",data:e},r),!0}function c(t,e){e.data1&&t.push(e.data1.buffer),e.data2&&t.push(e.data2.buffer)}function d(t,e,i){e.reduce((function(e,i){return l(t,i)||e}),!1)||t.postMessage({event:"transmuxComplete",data:e[0]}),t.postMessage({event:"flush",data:i})}},"./src/demux/transmuxer.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return f})),i.d(e,"isPromise",(function(){return v})),i.d(e,"TransmuxConfig",(function(){return y})),i.d(e,"TransmuxState",(function(){return A}));var r,n=i("./src/events.ts"),a=i("./src/errors.ts"),s=i("./src/crypt/decrypter.ts"),o=i("./src/demux/aacdemuxer.ts"),l=i("./src/demux/mp4demuxer.ts"),c=i("./src/demux/tsdemuxer.ts"),d=i("./src/demux/mp3demuxer.ts"),u=i("./src/remux/mp4-remuxer.ts"),h=i("./src/remux/passthrough-remuxer.ts"),p=i("./src/utils/logger.ts");try{r=self.performance.now.bind(self.performance)}catch(t){p.logger.debug("Unable to use Performance API on this environment");try{r=self.Date.now}catch(t){}}var g=[{demux:c.default,remux:u.default},{demux:l.default,remux:h.default},{demux:o.default,remux:u.default},{demux:d.default,remux:u.default}],f=function(){function t(t,e,i,r,n){this.observer=void 0,this.typeSupported=void 0,this.config=void 0,this.vendor=void 0,this.id=void 0,this.demuxer=void 0,this.remuxer=void 0,this.decrypter=void 0,this.probe=void 0,this.decryptionPromise=null,this.transmuxConfig=void 0,this.currentTransmuxState=void 0,this.observer=t,this.typeSupported=e,this.config=i,this.vendor=r,this.id=n}var e=t.prototype;return e.configure=function(t){this.transmuxConfig=t,this.decrypter&&this.decrypter.reset()},e.push=function(t,e,i,n){var a=this,s=i.transmuxing;s.executeStart=r();var o=new Uint8Array(t),l=this.config,c=this.currentTransmuxState,d=this.transmuxConfig;n&&(this.currentTransmuxState=n);var u=n||c,h=u.contiguous,p=u.discontinuity,g=u.trackSwitch,f=u.accurateTimeOffset,v=u.timeOffset,y=u.initSegmentChange,A=d.audioCodec,b=d.videoCodec,_=d.defaultInitPts,w=d.duration,C=d.initSegmentData;(p||g||y)&&this.resetInitSegment(C,A,b,w),(p||y)&&this.resetInitialTimestamp(_),h||this.resetContiguity();var E=function(t,e){var i=null;return t.byteLength>0&&null!=e&&null!=e.key&&null!==e.iv&&null!=e.method&&(i=e),i}(o,e);if(E&&"AES-128"===E.method){var T=this.getDecrypter();if(!l.enableSoftwareAES)return this.decryptionPromise=T.webCryptoDecrypt(o,E.key.buffer,E.iv.buffer).then((function(t){var e=a.push(t,null,i);return a.decryptionPromise=null,e})),this.decryptionPromise;var I=T.softwareDecrypt(o,E.key.buffer,E.iv.buffer);if(!I)return s.executeEnd=r(),m(i);o=new Uint8Array(I)}this.needsProbing(o,p,g)&&this.configureTransmuxer(o,d);var S=this.transmux(o,E,v,f,i),x=this.currentTransmuxState;return x.contiguous=!0,x.discontinuity=!1,x.trackSwitch=!1,s.executeEnd=r(),S},e.flush=function(t){var e=this,i=t.transmuxing;i.executeStart=r();var s=this.decrypter,o=this.currentTransmuxState,l=this.decryptionPromise;if(l)return l.then((function(){return e.flush(t)}));var c=[],d=o.timeOffset;if(s){var u=s.flush();u&&c.push(this.push(u,null,t))}var h=this.demuxer,p=this.remuxer;if(!h||!p)return this.observer.emit(n.Events.ERROR,n.Events.ERROR,{type:a.ErrorTypes.MEDIA_ERROR,details:a.ErrorDetails.FRAG_PARSING_ERROR,fatal:!0,reason:"no demux matching with content found"}),i.executeEnd=r(),[m(t)];var g=h.flush(d);return v(g)?g.then((function(i){return e.flushRemux(c,i,t),c})):(this.flushRemux(c,g,t),c)},e.flushRemux=function(t,e,i){var n=e.audioTrack,a=e.videoTrack,s=e.id3Track,o=e.textTrack,l=this.currentTransmuxState,c=l.accurateTimeOffset,d=l.timeOffset;p.logger.log("[transmuxer.ts]: Flushed fragment "+i.sn+(i.part>-1?" p: "+i.part:"")+" of level "+i.level);var u=this.remuxer.remux(n,a,s,o,d,c,!0,this.id);t.push({remuxResult:u,chunkMeta:i}),i.transmuxing.executeEnd=r()},e.resetInitialTimestamp=function(t){var e=this.demuxer,i=this.remuxer;e&&i&&(e.resetTimeStamp(t),i.resetTimeStamp(t))},e.resetContiguity=function(){var t=this.demuxer,e=this.remuxer;t&&e&&(t.resetContiguity(),e.resetNextTimestamp())},e.resetInitSegment=function(t,e,i,r){var n=this.demuxer,a=this.remuxer;n&&a&&(n.resetInitSegment(t,e,i,r),a.resetInitSegment(t,e,i))},e.destroy=function(){this.demuxer&&(this.demuxer.destroy(),this.demuxer=void 0),this.remuxer&&(this.remuxer.destroy(),this.remuxer=void 0)},e.transmux=function(t,e,i,r,n){return e&&"SAMPLE-AES"===e.method?this.transmuxSampleAes(t,e,i,r,n):this.transmuxUnencrypted(t,i,r,n)},e.transmuxUnencrypted=function(t,e,i,r){var n=this.demuxer.demux(t,e,!1,!this.config.progressive),a=n.audioTrack,s=n.videoTrack,o=n.id3Track,l=n.textTrack;return{remuxResult:this.remuxer.remux(a,s,o,l,e,i,!1,this.id),chunkMeta:r}},e.transmuxSampleAes=function(t,e,i,r,n){var a=this;return this.demuxer.demuxSampleAes(t,e,i).then((function(t){return{remuxResult:a.remuxer.remux(t.audioTrack,t.videoTrack,t.id3Track,t.textTrack,i,r,!1,a.id),chunkMeta:n}}))},e.configureTransmuxer=function(t,e){for(var i,r=this.config,n=this.observer,a=this.typeSupported,s=this.vendor,o=e.audioCodec,c=e.defaultInitPts,d=e.duration,u=e.initSegmentData,f=e.videoCodec,m=0,v=g.length;m>4>1){if((P=S+5+t[S+4])===S+188)continue}else P=S+4;switch(k){case p:x&&(g&&(n=v(g))&&this.parseAVCPES(a,h,n,!1),g={data:[],size:0}),g&&(g.data.push(t.subarray(P,S+188)),g.size+=S+188-P);break;case y:if(x){if(b&&(n=v(b)))switch(s.segmentCodec){case"aac":this.parseAACPES(s,n);break;case"mp3":this.parseMPEGPES(s,n)}b={data:[],size:0}}b&&(b.data.push(t.subarray(P,S+188)),b.size+=S+188-P);break;case A:x&&(_&&(n=v(_))&&this.parseID3PES(u,n),_={data:[],size:0}),_&&(_.data.push(t.subarray(P,S+188)),_.size+=S+188-P);break;case 0:x&&(P+=t[P]+1),E=this._pmtId=f(t,P);break;case E:x&&(P+=t[P]+1);var D=m(t,P,this.typeSupported,i);(p=D.avc)>0&&(a.pid=p),(y=D.audio)>0&&(s.pid=y,s.segmentCodec=D.segmentCodec),(A=D.id3)>0&&(u.pid=A),null===w||C||(c.logger.log("unknown PID '"+w+"' in TS found"),w=null),C=this.pmtParsed=!0;break;case 17:case 8191:break;default:w=k}}else I++;I>0&&this.observer.emit(o.Events.ERROR,o.Events.ERROR,{type:d.ErrorTypes.MEDIA_ERROR,details:d.ErrorDetails.FRAG_PARSING_ERROR,fatal:!1,reason:"Found "+I+" TS packet/s that do not start with 0x47"}),a.pesData=g,s.pesData=b,u.pesData=_;var L={audioTrack:s,videoTrack:a,id3Track:u,textTrack:h};return r&&this.extractRemainingSamples(L),L},e.flush=function(){var t,e=this.remainderData;return this.remainderData=null,t=e?this.demux(e,-1,!1,!0):{videoTrack:this._avcTrack,audioTrack:this._audioTrack,id3Track:this._id3Track,textTrack:this._txtTrack},this.extractRemainingSamples(t),this.sampleAes?this.decrypt(t,this.sampleAes):t},e.extractRemainingSamples=function(t){var e,i=t.audioTrack,r=t.videoTrack,n=t.id3Track,a=t.textTrack,s=r.pesData,o=i.pesData,l=n.pesData;if(s&&(e=v(s))?(this.parseAVCPES(r,a,e,!0),r.pesData=null):r.pesData=s,o&&(e=v(o))){switch(i.segmentCodec){case"aac":this.parseAACPES(i,e);break;case"mp3":this.parseMPEGPES(i,e)}i.pesData=null}else null!=o&&o.size&&c.logger.log("last AAC PES packet truncated,might overlap between fragments"),i.pesData=o;l&&(e=v(l))?(this.parseID3PES(n,e),n.pesData=null):n.pesData=l},e.demuxSampleAes=function(t,e,i){var r=this.demux(t,i,!0,!this.config.progressive),n=this.sampleAes=new s.default(this.observer,this.config,e);return this.decrypt(r,n)},e.decrypt=function(t,e){return new Promise((function(i){var r=t.audioTrack,n=t.videoTrack;r.samples&&"aac"===r.segmentCodec?e.decryptAacSamples(r.samples,0,(function(){n.samples?e.decryptAvcSamples(n.samples,0,0,(function(){i(t)})):i(t)})):n.samples&&e.decryptAvcSamples(n.samples,0,0,(function(){i(t)}))}))},e.destroy=function(){this._duration=0},e.parseAVCPES=function(t,e,i,r){var n,s=this,o=this.parseAVCNALu(t,i.data),c=this.avcSample,d=!1;i.data=null,c&&o.length&&!t.audFound&&(y(c,t),c=this.avcSample=g(!1,i.pts,i.dts,"")),o.forEach((function(r){switch(r.type){case 1:n=!0,c||(c=s.avcSample=g(!0,i.pts,i.dts,"")),c.frame=!0;var o=r.data;if(d&&o.length>4){var u=new a.default(o).readSliceType();2!==u&&4!==u&&7!==u&&9!==u||(c.key=!0)}break;case 5:n=!0,c||(c=s.avcSample=g(!0,i.pts,i.dts,"")),c.key=!0,c.frame=!0;break;case 6:n=!0,Object(l.parseSEIMessageFromNALu)(A(r.data),i.pts,e.samples);break;case 7:if(n=!0,d=!0,!t.sps){var h=new a.default(r.data).readSPS();t.width=h.width,t.height=h.height,t.pixelRatio=h.pixelRatio,t.sps=[r.data],t.duration=s._duration;for(var p=r.data.subarray(1,4),f="avc1.",m=0;m<3;m++){var v=p[m].toString(16);v.length<2&&(v="0"+v),f+=v}t.codec=f}break;case 8:n=!0,t.pps||(t.pps=[r.data]);break;case 9:n=!1,t.audFound=!0,c&&y(c,t),c=s.avcSample=g(!1,i.pts,i.dts,"");break;case 12:n=!0;break;default:n=!1,c&&(c.debug+="unknown NAL "+r.type+" ")}c&&n&&c.units.push(r)})),r&&c&&(y(c,t),this.avcSample=null)},e.getLastNalUnit=function(t){var e,i,r=this.avcSample;if(r&&0!==r.units.length||(r=t[t.length-1]),null!==(e=r)&&void 0!==e&&e.units){var n=r.units;i=n[n.length-1]}return i},e.parseAVCNALu=function(t,e){var i,r,n=e.byteLength,a=t.naluState||0,s=a,o=[],l=0,c=-1,d=0;for(-1===a&&(c=0,d=31&e[0],a=0,l=1);l=0){var u={data:e.subarray(c,l-a-1),type:d};o.push(u)}else{var h=this.getLastNalUnit(t.samples);if(h&&(s&&l<=4-s&&h.state&&(h.data=h.data.subarray(0,h.data.byteLength-s)),(r=l-a-1)>0)){var p=new Uint8Array(h.data.byteLength+r);p.set(h.data,0),p.set(e.subarray(0,r),h.data.byteLength),h.data=p,h.state=0}}l=0&&a>=0){var g={data:e.subarray(c,n),type:d,state:a};o.push(g)}if(0===o.length){var f=this.getLastNalUnit(t.samples);if(f){var m=new Uint8Array(f.data.byteLength+e.byteLength);m.set(f.data,0),m.set(e,f.data.byteLength),f.data=m}}return t.naluState=a,o},e.parseAACPES=function(t,e){var i,n,a,s,l,u=0,h=this.aacOverFlow,p=e.data;if(h){this.aacOverFlow=null;var g=h.missing,f=h.sample.unit.byteLength;if(-1===g){var m=new Uint8Array(f+p.byteLength);m.set(h.sample.unit,0),m.set(p,f),p=m}else{var v=f-g;h.sample.unit.set(p.subarray(0,g),v),t.samples.push(h.sample),u=h.missing}}for(i=u,n=p.length;i1;){var l=new Uint8Array(o[0].length+o[1].length);l.set(o[0]),l.set(o[1],o[0].length),o[0]=l,o.splice(1,1)}if(1===((e=o[0])[0]<<16)+(e[1]<<8)+e[2]){if((i=(e[4]<<8)+e[5])&&i>t.size-6)return null;var d=e[7];192&d&&(n=536870912*(14&e[9])+4194304*(255&e[10])+16384*(254&e[11])+128*(255&e[12])+(254&e[13])/2,64&d?n-(a=536870912*(14&e[14])+4194304*(255&e[15])+16384*(254&e[16])+128*(255&e[17])+(254&e[18])/2)>54e5&&(c.logger.warn(Math.round((n-a)/9e4)+"s delta between PTS and DTS, align them"),n=a):a=n);var u=(r=e[8])+9;if(t.size<=u)return null;t.size-=u;for(var h=new Uint8Array(t.size),p=0,g=o.length;pf){u-=f;continue}e=e.subarray(u),f-=u,u=0}h.set(e,s),s+=f}return i&&(i-=r+3),{data:h,pts:n,dts:a,len:i}}return null}function y(t,e){if(t.units.length&&t.frame){if(void 0===t.pts){var i=e.samples,r=i.length;if(!r)return void e.dropped++;var n=i[r-1];t.pts=n.pts,t.dts=n.dts}e.samples.push(t)}t.debug.length&&c.logger.log(t.pts+"/"+t.dts+":"+t.debug)}function A(t){for(var e=t.byteLength,i=[],r=1;r=e)return r;return 0}},{key:"maxAutoLevel",get:function(){var t=this.levels,e=this.autoLevelCapping;return-1===e&&t&&t.length?t.length-1:e}},{key:"nextAutoLevel",get:function(){return Math.min(Math.max(this.abrController.nextAutoLevel,this.minAutoLevel),this.maxAutoLevel)},set:function(t){this.abrController.nextAutoLevel=Math.max(this.minAutoLevel,t)}},{key:"playingDate",get:function(){return this.streamController.currentProgramDateTime}},{key:"audioTracks",get:function(){var t=this.audioTrackController;return t?t.audioTracks:[]}},{key:"audioTrack",get:function(){var t=this.audioTrackController;return t?t.audioTrack:-1},set:function(t){var e=this.audioTrackController;e&&(e.audioTrack=t)}},{key:"subtitleTracks",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTracks:[]}},{key:"subtitleTrack",get:function(){var t=this.subtitleTrackController;return t?t.subtitleTrack:-1},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleTrack=t)}},{key:"media",get:function(){return this._media}},{key:"subtitleDisplay",get:function(){var t=this.subtitleTrackController;return!!t&&t.subtitleDisplay},set:function(t){var e=this.subtitleTrackController;e&&(e.subtitleDisplay=t)}},{key:"lowLatencyMode",get:function(){return this.config.lowLatencyMode},set:function(t){this.config.lowLatencyMode=t}},{key:"liveSyncPosition",get:function(){return this.latencyController.liveSyncPosition}},{key:"latency",get:function(){return this.latencyController.latency}},{key:"maxLatency",get:function(){return this.latencyController.maxLatency}},{key:"targetLatency",get:function(){return this.latencyController.targetLatency}},{key:"drift",get:function(){return this.latencyController.drift}},{key:"forceStartLoad",get:function(){return this.streamController.forceStartLoad}}])&&v(e.prototype,i),y&&v(e,y),Object.defineProperty(e,"prototype",{writable:!1}),t}();y.defaultConfig=void 0},"./src/is-supported.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"isSupported",(function(){return a})),i.d(e,"changeTypeSupported",(function(){return s}));var r=i("./src/utils/mediasource-helper.ts");function n(){return self.SourceBuffer||self.WebKitSourceBuffer}function a(){var t=Object(r.getMediaSource)();if(!t)return!1;var e=n(),i=t&&"function"==typeof t.isTypeSupported&&t.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"'),a=!e||e.prototype&&"function"==typeof e.prototype.appendBuffer&&"function"==typeof e.prototype.remove;return!!i&&!!a}function s(){var t,e=n();return"function"==typeof(null==e||null===(t=e.prototype)||void 0===t?void 0:t.changeType)}},"./src/loader/date-range.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"DateRangeAttribute",(function(){return r})),i.d(e,"DateRange",(function(){return c}));var r,n=i("./src/polyfills/number.ts"),a=i("./src/utils/attr-list.ts"),s=i("./src/utils/logger.ts");function o(){return o=Object.assign?Object.assign.bind():function(t){for(var e=1;e=0)&&(!this.endOnNext||!!this.class)}}])&&l(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}()},"./src/loader/fragment-loader.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return d})),i.d(e,"LoadError",(function(){return h}));var r=i("./src/polyfills/number.ts"),n=i("./src/errors.ts");function a(t){var e="function"==typeof Map?new Map:void 0;return a=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return s(t,arguments,l(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),o(r,t)},a(t)}function s(t,e,i){return s=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&o(n,i.prototype),n},s.apply(null,arguments)}function o(t,e){return o=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},o(t,e)}function l(t){return l=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},l(t)}var c=Math.pow(2,17),d=function(){function t(t){this.config=void 0,this.loader=null,this.partLoadTimeout=-1,this.config=t}var e=t.prototype;return e.destroy=function(){this.loader&&(this.loader.destroy(),this.loader=null)},e.abort=function(){this.loader&&this.loader.abort()},e.load=function(t,e){var i=this,r=t.url;if(!r)return Promise.reject(new h({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,networkDetails:null},"Fragment does not have a "+(r?"part list":"url")));this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(r,l){i.loader&&i.loader.destroy();var d=i.loader=t.loader=s?new s(a):new o(a),p=u(t),g={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:"initSegment"===t.sn?1/0:c};t.stats=d.stats,d.load(p,g,{onSuccess:function(e,n,a,s){i.resetLoader(t,d),r({frag:t,part:null,payload:e.data,networkDetails:s})},onError:function(e,r,a){i.resetLoader(t,d),l(new h({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,response:e,networkDetails:a}))},onAbort:function(e,r,a){i.resetLoader(t,d),l(new h({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:t,networkDetails:a}))},onTimeout:function(e,r,a){i.resetLoader(t,d),l(new h({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,networkDetails:a}))},onProgress:function(i,r,n,a){e&&e({frag:t,part:null,payload:n,networkDetails:a})}})}))},e.loadPart=function(t,e,i){var r=this;this.abort();var a=this.config,s=a.fLoader,o=a.loader;return new Promise((function(l,d){r.loader&&r.loader.destroy();var p=r.loader=t.loader=s?new s(a):new o(a),g=u(t,e),f={timeout:a.fragLoadingTimeOut,maxRetry:0,retryDelay:0,maxRetryDelay:a.fragLoadingMaxRetryTimeout,highWaterMark:c};e.stats=p.stats,p.load(g,f,{onSuccess:function(n,a,s,o){r.resetLoader(t,p),r.updateStatsFromPart(t,e);var c={frag:t,part:e,payload:n.data,networkDetails:o};i(c),l(c)},onError:function(i,a,s){r.resetLoader(t,p),d(new h({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_ERROR,fatal:!1,frag:t,part:e,response:i,networkDetails:s}))},onAbort:function(i,a,s){t.stats.aborted=e.stats.aborted,r.resetLoader(t,p),d(new h({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.INTERNAL_ABORTED,fatal:!1,frag:t,part:e,networkDetails:s}))},onTimeout:function(i,a,s){r.resetLoader(t,p),d(new h({type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.FRAG_LOAD_TIMEOUT,fatal:!1,frag:t,part:e,networkDetails:s}))}})}))},e.updateStatsFromPart=function(t,e){var i=t.stats,r=e.stats,n=r.total;if(i.loaded+=r.loaded,n){var a=Math.round(t.duration/e.duration),s=Math.min(Math.round(i.loaded/n),a),o=(a-s)*Math.round(i.loaded/s);i.total=i.loaded+o}else i.total=Math.max(i.loaded,i.total);var l=i.loading,c=r.loading;l.start?l.first+=c.first-c.start:(l.start=c.start,l.first=c.first),l.end=c.end},e.resetLoader=function(t,e){t.loader=null,this.loader===e&&(self.clearTimeout(this.partLoadTimeout),this.loader=null),e.destroy()},t}();function u(t,e){void 0===e&&(e=null);var i=e||t,n={frag:t,part:e,responseType:"arraybuffer",url:i.url,headers:{},rangeStart:0,rangeEnd:0},a=i.byteRangeStartOffset,s=i.byteRangeEndOffset;return Object(r.isFiniteNumber)(a)&&Object(r.isFiniteNumber)(s)&&(n.rangeStart=a,n.rangeEnd=s),n}var h=function(t){var e,i;function r(e){for(var i,r=arguments.length,n=new Array(r>1?r-1:0),a=1;a>8*(15-i)&255;return e},i.setDecryptDataFromLevelKey=function(t,e){var i=t;return"AES-128"===(null==t?void 0:t.method)&&t.uri&&!t.iv&&((i=o.LevelKey.fromURI(t.uri)).method=t.method,i.iv=this.createInitializationVector(e),i.keyFormat="identity"),i},i.setElementaryStreamInfo=function(t,e,i,r,n,a){void 0===a&&(a=!1);var s=this.elementaryStreams,o=s[t];o?(o.startPTS=Math.min(o.startPTS,e),o.endPTS=Math.max(o.endPTS,i),o.startDTS=Math.min(o.startDTS,r),o.endDTS=Math.max(o.endDTS,n)):s[t]={startPTS:e,endPTS:i,startDTS:r,endDTS:n,partial:a}},i.clearElementaryStreamInfo=function(){var t=this.elementaryStreams;t[r.AUDIO]=null,t[r.VIDEO]=null,t[r.AUDIOVIDEO]=null},h(e,[{key:"decryptdata",get:function(){if(!this.levelkey&&!this._decryptdata)return null;if(!this._decryptdata&&this.levelkey){var t=this.sn;"number"!=typeof t&&(this.levelkey&&"AES-128"===this.levelkey.method&&!this.levelkey.iv&&s.logger.warn('missing IV for initialization segment with method="'+this.levelkey.method+'" - compliance issue'),t=0),this._decryptdata=this.setDecryptDataFromLevelKey(this.levelkey,t)}return this._decryptdata}},{key:"end",get:function(){return this.start+this.duration}},{key:"endProgramDateTime",get:function(){if(null===this.programDateTime)return null;if(!Object(n.isFiniteNumber)(this.programDateTime))return null;var t=Object(n.isFiniteNumber)(this.duration)?this.duration:0;return this.programDateTime+1e3*t}},{key:"encrypted",get:function(){var t;return!(null===(t=this.decryptdata)||void 0===t||!t.keyFormat||!this.decryptdata.uri)}}]),e}(p),f=function(t){function e(e,i,r,n,a){var s;(s=t.call(this,r)||this).fragOffset=0,s.duration=0,s.gap=!1,s.independent=!1,s.relurl=void 0,s.fragment=void 0,s.index=void 0,s.stats=new l.LoadStats,s.duration=e.decimalFloatingPoint("DURATION"),s.gap=e.bool("GAP"),s.independent=e.bool("INDEPENDENT"),s.relurl=e.enumeratedString("URI"),s.fragment=i,s.index=n;var o=e.enumeratedString("BYTERANGE");return o&&s.setByteRange(o,a),a&&(s.fragOffset=a.fragOffset+a.duration),s}return c(e,t),h(e,[{key:"start",get:function(){return this.fragment.start+this.fragOffset}},{key:"end",get:function(){return this.start+this.duration}},{key:"loaded",get:function(){var t=this.elementaryStreams;return!!(t.audio||t.video||t.audiovideo)}}]),e}(p)},"./src/loader/key-loader.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return s}));var r=i("./src/events.ts"),n=i("./src/errors.ts"),a=i("./src/utils/logger.ts"),s=function(){function t(t){this.hls=void 0,this.loaders={},this.decryptkey=null,this.decrypturl=null,this.hls=t,this.registerListeners()}var e=t.prototype;return e.startLoad=function(t){},e.stopLoad=function(){this.destroyInternalLoaders()},e.registerListeners=function(){this.hls.on(r.Events.KEY_LOADING,this.onKeyLoading,this)},e.unregisterListeners=function(){this.hls.off(r.Events.KEY_LOADING,this.onKeyLoading)},e.destroyInternalLoaders=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy()}this.loaders={}},e.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},e.onKeyLoading=function(t,e){var i=e.frag,n=i.type,s=this.loaders[n];if(i.decryptdata){var o=i.decryptdata.uri;if(o!==this.decrypturl||null===this.decryptkey){var l=this.hls.config;if(s&&(a.logger.warn("abort previous key loader for type:"+n),s.abort()),!o)return void a.logger.warn("key uri is falsy");var c=l.loader,d=i.loader=this.loaders[n]=new c(l);this.decrypturl=o,this.decryptkey=null;var u={url:o,frag:i,responseType:"arraybuffer"},h={timeout:l.fragLoadingTimeOut,maxRetry:0,retryDelay:l.fragLoadingRetryDelay,maxRetryDelay:l.fragLoadingMaxRetryTimeout,highWaterMark:0},p={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};d.load(u,h,p)}else this.decryptkey&&(i.decryptdata.key=this.decryptkey,this.hls.trigger(r.Events.KEY_LOADED,{frag:i}))}else a.logger.warn("Missing decryption data on fragment in onKeyLoading")},e.loadsuccess=function(t,e,i){var n=i.frag;n.decryptdata?(this.decryptkey=n.decryptdata.key=new Uint8Array(t.data),n.loader=null,delete this.loaders[n.type],this.hls.trigger(r.Events.KEY_LOADED,{frag:n})):a.logger.error("after key load, decryptdata unset")},e.loaderror=function(t,e){var i=e.frag,a=i.loader;a&&a.abort(),delete this.loaders[i.type],this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.KEY_LOAD_ERROR,fatal:!1,frag:i,response:t})},e.loadtimeout=function(t,e){var i=e.frag,a=i.loader;a&&a.abort(),delete this.loaders[i.type],this.hls.trigger(r.Events.ERROR,{type:n.ErrorTypes.NETWORK_ERROR,details:n.ErrorDetails.KEY_LOAD_TIMEOUT,fatal:!1,frag:i})},t}()},"./src/loader/level-details.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"LevelDetails",(function(){return a}));var r=i("./src/polyfills/number.ts");function n(t,e){for(var i=0;it.endSN||e>0||0===e&&i>0,this.updated||this.advanced?this.misses=Math.floor(.6*t.misses):this.misses=t.misses+1,this.availabilityDelay=t.availabilityDelay},e=t,(i=[{key:"hasProgramDateTime",get:function(){return!!this.fragments.length&&Object(r.isFiniteNumber)(this.fragments[this.fragments.length-1].programDateTime)}},{key:"levelTargetDuration",get:function(){return this.averagetargetduration||this.targetduration||10}},{key:"drift",get:function(){var t=this.driftEndTime-this.driftStartTime;return t>0?1e3*(this.driftEnd-this.driftStart)/t:1}},{key:"edge",get:function(){return this.partEnd||this.fragmentEnd}},{key:"partEnd",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].end:this.fragmentEnd}},{key:"fragmentEnd",get:function(){var t;return null!==(t=this.fragments)&&void 0!==t&&t.length?this.fragments[this.fragments.length-1].end:0}},{key:"age",get:function(){return this.advancedDateTime?Math.max(Date.now()-this.advancedDateTime,0)/1e3:0}},{key:"lastPartIndex",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].index:-1}},{key:"lastPartSn",get:function(){var t;return null!==(t=this.partList)&&void 0!==t&&t.length?this.partList[this.partList.length-1].fragment.sn:this.endSN}}])&&n(e.prototype,i),Object.defineProperty(e,"prototype",{writable:!1}),t}()},"./src/loader/level-key.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"LevelKey",(function(){return a}));var r=i("./node_modules/url-toolkit/src/url-toolkit.js");function n(t,e){for(var i=0;i2){var i=e.shift()+".";return(i+=parseInt(e.shift()).toString(16))+("000"+parseInt(e.shift()).toString(16)).slice(-4)}return t},t.resolve=function(t,e){return n.buildAbsoluteURL(e,t,{alwaysNormalize:!0})},t.parseMasterPlaylist=function(e,i){var r,n=[],a={},s=!1;for(h.lastIndex=0;null!=(r=h.exec(e));)if(r[1]){var o=new c.AttrList(r[1]),l={attrs:o,bitrate:o.decimalInteger("AVERAGE-BANDWIDTH")||o.decimalInteger("BANDWIDTH"),name:o.NAME,url:t.resolve(r[2],i)},d=o.decimalResolution("RESOLUTION");d&&(l.width=d.width,l.height=d.height),y((o.CODECS||"").split(/[ ,]+/).filter((function(t){return t})),l),l.videoCodec&&-1!==l.videoCodec.indexOf("avc1")&&(l.videoCodec=t.convertAVC1ToAVCOTI(l.videoCodec)),n.push(l)}else if(r[3]){var u=new c.AttrList(r[3]);u["DATA-ID"]&&(s=!0,a[u["DATA-ID"]]=u)}return{levels:n,sessionData:s?a:null}},t.parseMasterPlaylistMedia=function(e,i,r,n){var a;void 0===n&&(n=[]);var s=[],o=0;for(p.lastIndex=0;null!==(a=p.exec(e));){var l=new c.AttrList(a[1]);if(l.TYPE===r){var d={attrs:l,bitrate:0,id:o++,groupId:l["GROUP-ID"],instreamId:l["INSTREAM-ID"],name:l.NAME||l.LANGUAGE||"",type:r,default:l.bool("DEFAULT"),autoselect:l.bool("AUTOSELECT"),forced:l.bool("FORCED"),lang:l.LANGUAGE,url:l.URI?t.resolve(l.URI,i):""};if(n.length){var u=t.findGroup(n,d.groupId)||n[0];A(d,u,"audioCodec"),A(d,u,"textCodec")}s.push(d)}}return s},t.parseLevelPlaylist=function(t,e,i,u,h){var p,v,y,A=new o.LevelDetails(e),w=A.fragments,C=null,E=0,T=0,I=0,S=0,x=null,k=new s.Fragment(u,e),P=-1,D=!1;for(g.lastIndex=0,A.m3u8=t;null!==(p=g.exec(t));){D&&(D=!1,(k=new s.Fragment(u,e)).start=I,k.sn=E,k.cc=S,k.level=i,C&&(k.initSegment=C,k.rawProgramDateTime=C.rawProgramDateTime,C.rawProgramDateTime=null));var L=p[1];if(L){k.duration=parseFloat(L);var B=(" "+p[2]).slice(1);k.title=B||null,k.tagList.push(B?["INF",L,B]:["INF",L])}else if(p[3])Object(r.isFiniteNumber)(k.duration)&&(k.start=I,y&&(k.levelkey=y),k.sn=E,k.level=i,k.cc=S,k.urlId=h,w.push(k),k.relurl=(" "+p[3]).slice(1),b(k,x),x=k,I+=k.duration,E++,T=0,D=!0);else if(p[4]){var O=(" "+p[4]).slice(1);x?k.setByteRange(O,x):k.setByteRange(O)}else if(p[5])k.rawProgramDateTime=(" "+p[5]).slice(1),k.tagList.push(["PROGRAM-DATE-TIME",k.rawProgramDateTime]),-1===P&&(P=w.length);else{if(!(p=p[0].match(f))){d.logger.warn("No matches on slow regex match for level playlist!");continue}for(v=1;v-1){d.logger.warn("Keyformat "+X+" is not supported from the manifest");continue}if("identity"!==X)continue;z&&(y=l.LevelKey.fromURL(e,K),K&&["AES-128","SAMPLE-AES","SAMPLE-AES-CENC"].indexOf(z)>=0&&(y.method=z,y.keyFormat=X,J&&(y.keyID=J),Y&&(y.keyFormatVersions=Y),y.iv=q));break;case"START":var $=new c.AttrList(M).decimalFloatingPoint("TIME-OFFSET");Object(r.isFiniteNumber)($)&&(A.startTimeOffset=$);break;case"MAP":var Z=new c.AttrList(M);if(k.duration){var tt=new s.Fragment(u,e);_(tt,Z,i,y),C=tt,k.initSegment=C,C.rawProgramDateTime&&!k.rawProgramDateTime&&(k.rawProgramDateTime=C.rawProgramDateTime)}else _(k,Z,i,y),C=k,D=!0;break;case"SERVER-CONTROL":var et=new c.AttrList(M);A.canBlockReload=et.bool("CAN-BLOCK-RELOAD"),A.canSkipUntil=et.optionalFloat("CAN-SKIP-UNTIL",0),A.canSkipDateRanges=A.canSkipUntil>0&&et.bool("CAN-SKIP-DATERANGES"),A.partHoldBack=et.optionalFloat("PART-HOLD-BACK",0),A.holdBack=et.optionalFloat("HOLD-BACK",0);break;case"PART-INF":var it=new c.AttrList(M);A.partTarget=it.decimalFloatingPoint("PART-TARGET");break;case"PART":var rt=A.partList;rt||(rt=A.partList=[]);var nt=T>0?rt[rt.length-1]:void 0,at=T++,st=new s.Part(new c.AttrList(M),k,e,at,nt);rt.push(st),k.duration+=st.duration;break;case"PRELOAD-HINT":var ot=new c.AttrList(M);A.preloadHint=ot;break;case"RENDITION-REPORT":var lt=new c.AttrList(M);A.renditionReports=A.renditionReports||[],A.renditionReports.push(lt);break;default:d.logger.warn("line parsed but not handled: "+p)}}}x&&!x.relurl?(w.pop(),I-=x.duration,A.partList&&(A.fragmentHint=x)):A.partList&&(b(k,x),k.cc=S,A.fragmentHint=k);var ct=w.length,dt=w[0],ut=w[ct-1];if((I+=A.skippedSegments*A.targetduration)>0&&ct&&ut){A.averagetargetduration=I/ct;var ht=ut.sn;A.endSN="initSegment"!==ht?ht:0,dt&&(A.startCC=dt.cc,dt.initSegment||A.fragments.every((function(t){return t.relurl&&(e=t.relurl,m.test(null!=(i=null===(r=n.parseURL(e))||void 0===r?void 0:r.path)?i:""));var e,i,r}))&&(d.logger.warn("MP4 fragments found but no init segment (probably no MAP, incomplete M3U8), trying to fetch SIDX"),(k=new s.Fragment(u,e)).relurl=ut.relurl,k.level=i,k.sn="initSegment",dt.initSegment=k,A.needSidxRanges=!0))}else A.endSN=0,A.startCC=0;return A.fragmentHint&&(I+=A.fragmentHint.duration),A.totalduration=I,A.endCC=S,P>0&&function(t,e){for(var i=t[e],r=e;r--;){var n=t[r];if(!n)return;n.programDateTime=i.programDateTime-1e3*n.duration,i=n}}(w,P),A},t}();function y(t,e){["video","audio","text"].forEach((function(i){var r=t.filter((function(t){return Object(u.isCodecType)(t,i)}));if(r.length){var n=r.filter((function(t){return 0===t.lastIndexOf("avc1",0)||0===t.lastIndexOf("mp4a",0)}));e[i+"Codec"]=n.length>0?n[0]:r[0],t=t.filter((function(t){return-1===r.indexOf(t)}))}})),e.unknownCodecs=t}function A(t,e,i){var r=e[i];r&&(t[i]=r)}function b(t,e){t.rawProgramDateTime?t.programDateTime=Date.parse(t.rawProgramDateTime):null!=e&&e.programDateTime&&(t.programDateTime=e.endProgramDateTime),Object(r.isFiniteNumber)(t.programDateTime)||(t.programDateTime=null,t.rawProgramDateTime=null)}function _(t,e,i,r){t.relurl=e.URI,e.BYTERANGE&&t.setByteRange(e.BYTERANGE),t.level=i,t.sn="initSegment",r&&(t.levelkey=r),t.initSegment=null}},"./src/loader/playlist-loader.ts":function(t,e,i){"use strict";i.r(e);var r=i("./src/polyfills/number.ts"),n=i("./src/events.ts"),a=i("./src/errors.ts"),s=i("./src/utils/logger.ts"),o=i("./src/utils/mp4-tools.ts"),l=i("./src/loader/m3u8-parser.ts"),c=i("./src/types/loader.ts"),d=i("./src/utils/attr-list.ts");function u(t,e){var i=t.url;return void 0!==i&&0!==i.indexOf("data:")||(i=e.url),i}var h=function(){function t(t){this.hls=void 0,this.loaders=Object.create(null),this.hls=t,this.registerListeners()}var e=t.prototype;return e.startLoad=function(t){},e.stopLoad=function(){this.destroyInternalLoaders()},e.registerListeners=function(){var t=this.hls;t.on(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.on(n.Events.LEVEL_LOADING,this.onLevelLoading,this),t.on(n.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.on(n.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.unregisterListeners=function(){var t=this.hls;t.off(n.Events.MANIFEST_LOADING,this.onManifestLoading,this),t.off(n.Events.LEVEL_LOADING,this.onLevelLoading,this),t.off(n.Events.AUDIO_TRACK_LOADING,this.onAudioTrackLoading,this),t.off(n.Events.SUBTITLE_TRACK_LOADING,this.onSubtitleTrackLoading,this)},e.createInternalLoader=function(t){var e=this.hls.config,i=e.pLoader,r=e.loader,n=new(i||r)(e);return t.loader=n,this.loaders[t.type]=n,n},e.getInternalLoader=function(t){return this.loaders[t.type]},e.resetInternalLoader=function(t){this.loaders[t]&&delete this.loaders[t]},e.destroyInternalLoaders=function(){for(var t in this.loaders){var e=this.loaders[t];e&&e.destroy(),this.resetInternalLoader(t)}},e.destroy=function(){this.unregisterListeners(),this.destroyInternalLoaders()},e.onManifestLoading=function(t,e){var i=e.url;this.load({id:null,groupId:null,level:0,responseType:"text",type:c.PlaylistContextType.MANIFEST,url:i,deliveryDirectives:null})},e.onLevelLoading=function(t,e){var i=e.id,r=e.level,n=e.url,a=e.deliveryDirectives;this.load({id:i,groupId:null,level:r,responseType:"text",type:c.PlaylistContextType.LEVEL,url:n,deliveryDirectives:a})},e.onAudioTrackLoading=function(t,e){var i=e.id,r=e.groupId,n=e.url,a=e.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:c.PlaylistContextType.AUDIO_TRACK,url:n,deliveryDirectives:a})},e.onSubtitleTrackLoading=function(t,e){var i=e.id,r=e.groupId,n=e.url,a=e.deliveryDirectives;this.load({id:i,groupId:r,level:null,responseType:"text",type:c.PlaylistContextType.SUBTITLE_TRACK,url:n,deliveryDirectives:a})},e.load=function(t){var e,i,r,n,a,o,l=this.hls.config,d=this.getInternalLoader(t);if(d){var u=d.context;if(u&&u.url===t.url)return void s.logger.trace("[playlist-loader]: playlist request ongoing");s.logger.log("[playlist-loader]: aborting previous loader for type: "+t.type),d.abort()}switch(t.type){case c.PlaylistContextType.MANIFEST:i=l.manifestLoadingMaxRetry,r=l.manifestLoadingTimeOut,n=l.manifestLoadingRetryDelay,a=l.manifestLoadingMaxRetryTimeout;break;case c.PlaylistContextType.LEVEL:case c.PlaylistContextType.AUDIO_TRACK:case c.PlaylistContextType.SUBTITLE_TRACK:i=0,r=l.levelLoadingTimeOut;break;default:i=l.levelLoadingMaxRetry,r=l.levelLoadingTimeOut,n=l.levelLoadingRetryDelay,a=l.levelLoadingMaxRetryTimeout}if(d=this.createInternalLoader(t),null!==(e=t.deliveryDirectives)&&void 0!==e&&e.part&&(t.type===c.PlaylistContextType.LEVEL&&null!==t.level?o=this.hls.levels[t.level].details:t.type===c.PlaylistContextType.AUDIO_TRACK&&null!==t.id?o=this.hls.audioTracks[t.id].details:t.type===c.PlaylistContextType.SUBTITLE_TRACK&&null!==t.id&&(o=this.hls.subtitleTracks[t.id].details),o)){var h=o.partTarget,p=o.targetduration;h&&p&&(r=Math.min(1e3*Math.max(3*h,.8*p),r))}var g={timeout:r,maxRetry:i,retryDelay:n,maxRetryDelay:a,highWaterMark:0},f={onSuccess:this.loadsuccess.bind(this),onError:this.loaderror.bind(this),onTimeout:this.loadtimeout.bind(this)};d.load(t,g,f)},e.loadsuccess=function(t,e,i,r){if(void 0===r&&(r=null),i.isSidxRequest)return this.handleSidxRequest(t,i),void this.handlePlaylistLoaded(t,e,i,r);this.resetInternalLoader(i.type);var n=t.data;0===n.indexOf("#EXTM3U")?(e.parsing.start=performance.now(),n.indexOf("#EXTINF:")>0||n.indexOf("#EXT-X-TARGETDURATION:")>0?this.handleTrackOrLevelPlaylist(t,e,i,r):this.handleMasterPlaylist(t,e,i,r)):this.handleManifestParsingError(t,i,"no EXTM3U delimiter",r)},e.loaderror=function(t,e,i){void 0===i&&(i=null),this.handleNetworkError(e,i,!1,t)},e.loadtimeout=function(t,e,i){void 0===i&&(i=null),this.handleNetworkError(e,i,!0)},e.handleMasterPlaylist=function(t,e,i,r){var a=this.hls,o=t.data,c=u(t,i),h=l.default.parseMasterPlaylist(o,c),p=h.levels,g=h.sessionData;if(p.length){var f=p.map((function(t){return{id:t.attrs.AUDIO,audioCodec:t.audioCodec}})),m=p.map((function(t){return{id:t.attrs.SUBTITLES,textCodec:t.textCodec}})),v=l.default.parseMasterPlaylistMedia(o,c,"AUDIO",f),y=l.default.parseMasterPlaylistMedia(o,c,"SUBTITLES",m),A=l.default.parseMasterPlaylistMedia(o,c,"CLOSED-CAPTIONS");v.length&&(v.some((function(t){return!t.url}))||!p[0].audioCodec||p[0].attrs.AUDIO||(s.logger.log("[playlist-loader]: audio codec signaled in quality level, but no embedded audio track signaled, create one"),v.unshift({type:"main",name:"main",default:!1,autoselect:!1,forced:!1,id:-1,attrs:new d.AttrList({}),bitrate:0,url:""}))),a.trigger(n.Events.MANIFEST_LOADED,{levels:p,audioTracks:v,subtitles:y,captions:A,url:c,stats:e,networkDetails:r,sessionData:g})}else this.handleManifestParsingError(t,i,"no level found in manifest",r)},e.handleTrackOrLevelPlaylist=function(t,e,i,s){var o=this.hls,h=i.id,p=i.level,g=i.type,f=u(t,i),m=Object(r.isFiniteNumber)(h)?h:0,v=Object(r.isFiniteNumber)(p)?p:m,y=function(t){switch(t.type){case c.PlaylistContextType.AUDIO_TRACK:return c.PlaylistLevelType.AUDIO;case c.PlaylistContextType.SUBTITLE_TRACK:return c.PlaylistLevelType.SUBTITLE;default:return c.PlaylistLevelType.MAIN}}(i),A=l.default.parseLevelPlaylist(t.data,f,v,y,m);if(A.fragments.length){if(g===c.PlaylistContextType.MANIFEST){var b={attrs:new d.AttrList({}),bitrate:0,details:A,name:"",url:f};o.trigger(n.Events.MANIFEST_LOADED,{levels:[b],audioTracks:[],url:f,stats:e,networkDetails:s,sessionData:null})}if(e.parsing.end=performance.now(),A.needSidxRanges){var _,w=null===(_=A.fragments[0].initSegment)||void 0===_?void 0:_.url;this.load({url:w,isSidxRequest:!0,type:g,level:p,levelDetails:A,id:h,groupId:null,rangeStart:0,rangeEnd:2048,responseType:"arraybuffer",deliveryDirectives:null})}else i.levelDetails=A,this.handlePlaylistLoaded(t,e,i,s)}else o.trigger(n.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.LEVEL_EMPTY_ERROR,fatal:!1,url:f,reason:"no fragments found in level",level:"number"==typeof i.level?i.level:void 0})},e.handleSidxRequest=function(t,e){var i=new Uint8Array(t.data),r=Object(o.findBox)(i,["sidx"])[0];if(r){var n=Object(o.parseSegmentIndex)(r);if(n){var a=n.references,s=e.levelDetails;a.forEach((function(t,e){var r=t.info,n=s.fragments[e];if(0===n.byteRange.length&&n.setByteRange(String(1+r.end-r.start)+"@"+String(r.start)),n.initSegment){var a=Object(o.findBox)(i,["moov"])[0],l=a?a.length:null;n.initSegment.setByteRange(String(l)+"@0")}}))}}},e.handleManifestParsingError=function(t,e,i,r){this.hls.trigger(n.Events.ERROR,{type:a.ErrorTypes.NETWORK_ERROR,details:a.ErrorDetails.MANIFEST_PARSING_ERROR,fatal:e.type===c.PlaylistContextType.MANIFEST,url:t.url,reason:i,response:t,context:e,networkDetails:r})},e.handleNetworkError=function(t,e,i,r){void 0===i&&(i=!1),s.logger.warn("[playlist-loader]: A network "+(i?"timeout":"error")+" occurred while loading "+t.type+" level: "+t.level+" id: "+t.id+' group-id: "'+t.groupId+'"');var o=a.ErrorDetails.UNKNOWN,l=!1,d=this.getInternalLoader(t);switch(t.type){case c.PlaylistContextType.MANIFEST:o=i?a.ErrorDetails.MANIFEST_LOAD_TIMEOUT:a.ErrorDetails.MANIFEST_LOAD_ERROR,l=!0;break;case c.PlaylistContextType.LEVEL:o=i?a.ErrorDetails.LEVEL_LOAD_TIMEOUT:a.ErrorDetails.LEVEL_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.AUDIO_TRACK:o=i?a.ErrorDetails.AUDIO_TRACK_LOAD_TIMEOUT:a.ErrorDetails.AUDIO_TRACK_LOAD_ERROR,l=!1;break;case c.PlaylistContextType.SUBTITLE_TRACK:o=i?a.ErrorDetails.SUBTITLE_TRACK_LOAD_TIMEOUT:a.ErrorDetails.SUBTITLE_LOAD_ERROR,l=!1}d&&this.resetInternalLoader(t.type);var u={type:a.ErrorTypes.NETWORK_ERROR,details:o,fatal:l,url:t.url,loader:d,context:t,networkDetails:e};r&&(u.response=r),this.hls.trigger(n.Events.ERROR,u)},e.handlePlaylistLoaded=function(t,e,i,r){var a=i.type,s=i.level,o=i.id,l=i.groupId,d=i.loader,u=i.levelDetails,h=i.deliveryDirectives;if(null!=u&&u.targetduration){if(d)switch(u.live&&(d.getCacheAge&&(u.ageHeader=d.getCacheAge()||0),d.getCacheAge&&!isNaN(u.ageHeader)||(u.ageHeader=0)),a){case c.PlaylistContextType.MANIFEST:case c.PlaylistContextType.LEVEL:this.hls.trigger(n.Events.LEVEL_LOADED,{details:u,level:s||0,id:o||0,stats:e,networkDetails:r,deliveryDirectives:h});break;case c.PlaylistContextType.AUDIO_TRACK:this.hls.trigger(n.Events.AUDIO_TRACK_LOADED,{details:u,id:o||0,groupId:l||"",stats:e,networkDetails:r,deliveryDirectives:h});break;case c.PlaylistContextType.SUBTITLE_TRACK:this.hls.trigger(n.Events.SUBTITLE_TRACK_LOADED,{details:u,id:o||0,groupId:l||"",stats:e,networkDetails:r,deliveryDirectives:h})}}else this.handleManifestParsingError(t,i,"invalid target duration",r)},t}();e.default=h},"./src/polyfills/number.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"isFiniteNumber",(function(){return r})),i.d(e,"MAX_SAFE_INTEGER",(function(){return n}));var r=Number.isFinite||function(t){return"number"==typeof t&&isFinite(t)},n=Number.MAX_SAFE_INTEGER||9007199254740991},"./src/remux/aac-helper.ts":function(t,e,i){"use strict";i.r(e);var r=function(){function t(){}return t.getSilentFrame=function(t,e){if("mp4a.40.2"===t){if(1===e)return new Uint8Array([0,200,0,128,35,128]);if(2===e)return new Uint8Array([33,0,73,144,2,25,0,35,128]);if(3===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,142]);if(4===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,128,44,128,8,2,56]);if(5===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,56]);if(6===e)return new Uint8Array([0,200,0,128,32,132,1,38,64,8,100,0,130,48,4,153,0,33,144,2,0,178,0,32,8,224])}else{if(1===e)return new Uint8Array([1,64,34,128,163,78,230,128,186,8,0,0,0,28,6,241,193,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(2===e)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94]);if(3===e)return new Uint8Array([1,64,34,128,163,94,230,128,186,8,0,0,0,0,149,0,6,241,161,10,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,90,94])}},t}();e.default=r},"./src/remux/mp4-generator.ts":function(t,e,i){"use strict";i.r(e);var r=Math.pow(2,32)-1,n=function(){function t(){}return t.init=function(){var e;for(e in t.types={avc1:[],avcC:[],btrt:[],dinf:[],dref:[],esds:[],ftyp:[],hdlr:[],mdat:[],mdhd:[],mdia:[],mfhd:[],minf:[],moof:[],moov:[],mp4a:[],".mp3":[],mvex:[],mvhd:[],pasp:[],sdtp:[],stbl:[],stco:[],stsc:[],stsd:[],stsz:[],stts:[],tfdt:[],tfhd:[],traf:[],trak:[],trun:[],trex:[],tkhd:[],vmhd:[],smhd:[]},t.types)t.types.hasOwnProperty(e)&&(t.types[e]=[e.charCodeAt(0),e.charCodeAt(1),e.charCodeAt(2),e.charCodeAt(3)]);var i=new Uint8Array([0,0,0,0,0,0,0,0,118,105,100,101,0,0,0,0,0,0,0,0,0,0,0,0,86,105,100,101,111,72,97,110,100,108,101,114,0]),r=new Uint8Array([0,0,0,0,0,0,0,0,115,111,117,110,0,0,0,0,0,0,0,0,0,0,0,0,83,111,117,110,100,72,97,110,100,108,101,114,0]);t.HDLR_TYPES={video:i,audio:r};var n=new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,12,117,114,108,32,0,0,0,1]),a=new Uint8Array([0,0,0,0,0,0,0,0]);t.STTS=t.STSC=t.STCO=a,t.STSZ=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0]),t.VMHD=new Uint8Array([0,0,0,1,0,0,0,0,0,0,0,0]),t.SMHD=new Uint8Array([0,0,0,0,0,0,0,0]),t.STSD=new Uint8Array([0,0,0,0,0,0,0,1]);var s=new Uint8Array([105,115,111,109]),o=new Uint8Array([97,118,99,49]),l=new Uint8Array([0,0,0,1]);t.FTYP=t.box(t.types.ftyp,s,l,s,o),t.DINF=t.box(t.types.dinf,t.box(t.types.dref,n))},t.box=function(t){for(var e=8,i=arguments.length,r=new Array(i>1?i-1:0),n=1;n>24&255,o[1]=e>>16&255,o[2]=e>>8&255,o[3]=255&e,o.set(t,4),a=0,e=8;a>24&255,e>>16&255,e>>8&255,255&e,n>>24,n>>16&255,n>>8&255,255&n,a>>24,a>>16&255,a>>8&255,255&a,85,196,0,0]))},t.mdia=function(e){return t.box(t.types.mdia,t.mdhd(e.timescale,e.duration),t.hdlr(e.type),t.minf(e))},t.mfhd=function(e){return t.box(t.types.mfhd,new Uint8Array([0,0,0,0,e>>24,e>>16&255,e>>8&255,255&e]))},t.minf=function(e){return"audio"===e.type?t.box(t.types.minf,t.box(t.types.smhd,t.SMHD),t.DINF,t.stbl(e)):t.box(t.types.minf,t.box(t.types.vmhd,t.VMHD),t.DINF,t.stbl(e))},t.moof=function(e,i,r){return t.box(t.types.moof,t.mfhd(e),t.traf(r,i))},t.moov=function(e){for(var i=e.length,r=[];i--;)r[i]=t.trak(e[i]);return t.box.apply(null,[t.types.moov,t.mvhd(e[0].timescale,e[0].duration)].concat(r).concat(t.mvex(e)))},t.mvex=function(e){for(var i=e.length,r=[];i--;)r[i]=t.trex(e[i]);return t.box.apply(null,[t.types.mvex].concat(r))},t.mvhd=function(e,i){i*=e;var n=Math.floor(i/(r+1)),a=Math.floor(i%(r+1)),s=new Uint8Array([1,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,e>>24&255,e>>16&255,e>>8&255,255&e,n>>24,n>>16&255,n>>8&255,255&n,a>>24,a>>16&255,a>>8&255,255&a,0,1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,255,255,255,255]);return t.box(t.types.mvhd,s)},t.sdtp=function(e){var i,r,n=e.samples||[],a=new Uint8Array(4+n.length);for(i=0;i>>8&255),a.push(255&n),a=a.concat(Array.prototype.slice.call(r));for(i=0;i>>8&255),s.push(255&n),s=s.concat(Array.prototype.slice.call(r));var o=t.box(t.types.avcC,new Uint8Array([1,a[3],a[4],a[5],255,224|e.sps.length].concat(a).concat([e.pps.length]).concat(s))),l=e.width,c=e.height,d=e.pixelRatio[0],u=e.pixelRatio[1];return t.box(t.types.avc1,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,l>>8&255,255&l,c>>8&255,255&c,0,72,0,0,0,72,0,0,0,0,0,0,0,1,18,100,97,105,108,121,109,111,116,105,111,110,47,104,108,115,46,106,115,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,17,17]),o,t.box(t.types.btrt,new Uint8Array([0,28,156,128,0,45,198,192,0,45,198,192])),t.box(t.types.pasp,new Uint8Array([d>>24,d>>16&255,d>>8&255,255&d,u>>24,u>>16&255,u>>8&255,255&u])))},t.esds=function(t){var e=t.config.length;return new Uint8Array([0,0,0,0,3,23+e,0,1,0,4,15+e,64,21,0,0,0,0,0,0,0,0,0,0,0,5].concat([e]).concat(t.config).concat([6,1,2]))},t.mp4a=function(e){var i=e.samplerate;return t.box(t.types.mp4a,new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,i>>8&255,255&i,0,0]),t.box(t.types.esds,t.esds(e)))},t.mp3=function(e){var i=e.samplerate;return t.box(t.types[".mp3"],new Uint8Array([0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,e.channelCount,0,16,0,0,0,0,i>>8&255,255&i,0,0]))},t.stsd=function(e){return"audio"===e.type?"mp3"===e.segmentCodec&&"mp3"===e.codec?t.box(t.types.stsd,t.STSD,t.mp3(e)):t.box(t.types.stsd,t.STSD,t.mp4a(e)):t.box(t.types.stsd,t.STSD,t.avc1(e))},t.tkhd=function(e){var i=e.id,n=e.duration*e.timescale,a=e.width,s=e.height,o=Math.floor(n/(r+1)),l=Math.floor(n%(r+1));return t.box(t.types.tkhd,new Uint8Array([1,0,0,7,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,3,i>>24&255,i>>16&255,i>>8&255,255&i,0,0,0,0,o>>24,o>>16&255,o>>8&255,255&o,l>>24,l>>16&255,l>>8&255,255&l,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,a>>8&255,255&a,0,0,s>>8&255,255&s,0,0]))},t.traf=function(e,i){var n=t.sdtp(e),a=e.id,s=Math.floor(i/(r+1)),o=Math.floor(i%(r+1));return t.box(t.types.traf,t.box(t.types.tfhd,new Uint8Array([0,0,0,0,a>>24,a>>16&255,a>>8&255,255&a])),t.box(t.types.tfdt,new Uint8Array([1,0,0,0,s>>24,s>>16&255,s>>8&255,255&s,o>>24,o>>16&255,o>>8&255,255&o])),t.trun(e,n.length+16+20+8+16+8+8),n)},t.trak=function(e){return e.duration=e.duration||4294967295,t.box(t.types.trak,t.tkhd(e),t.mdia(e))},t.trex=function(e){var i=e.id;return t.box(t.types.trex,new Uint8Array([0,0,0,0,i>>24,i>>16&255,i>>8&255,255&i,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,1]))},t.trun=function(e,i){var r,n,a,s,o,l,c=e.samples||[],d=c.length,u=12+16*d,h=new Uint8Array(u);for(i+=8+u,h.set([0,0,15,1,d>>>24&255,d>>>16&255,d>>>8&255,255&d,i>>>24&255,i>>>16&255,i>>>8&255,255&i],0),r=0;r>>24&255,a>>>16&255,a>>>8&255,255&a,s>>>24&255,s>>>16&255,s>>>8&255,255&s,o.isLeading<<2|o.dependsOn,o.isDependedOn<<6|o.hasRedundancy<<4|o.paddingValue<<1|o.isNonSync,61440&o.degradPrio,15&o.degradPrio,l>>>24&255,l>>>16&255,l>>>8&255,255&l],12+16*r);return t.box(t.types.trun,h)},t.initSegment=function(e){t.types||t.init();var i=t.moov(e),r=new Uint8Array(t.FTYP.byteLength+i.byteLength);return r.set(t.FTYP),r.set(i,t.FTYP.byteLength),r},t}();n.types=void 0,n.HDLR_TYPES=void 0,n.STTS=void 0,n.STSC=void 0,n.STCO=void 0,n.STSZ=void 0,n.VMHD=void 0,n.SMHD=void 0,n.STSD=void 0,n.FTYP=void 0,n.DINF=void 0,e.default=n},"./src/remux/mp4-remuxer.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return f})),i.d(e,"normalizePts",(function(){return m})),i.d(e,"flushTextTrackMetadataCueSamples",(function(){return v})),i.d(e,"flushTextTrackUserdataCueSamples",(function(){return y}));var r=i("./src/polyfills/number.ts"),n=i("./src/remux/aac-helper.ts"),a=i("./src/remux/mp4-generator.ts"),s=i("./src/events.ts"),o=i("./src/errors.ts"),l=i("./src/utils/logger.ts"),c=i("./src/types/loader.ts"),d=i("./src/utils/timescale-conversion.ts");function u(){return u=Object.assign?Object.assign.bind():function(t){for(var e=1;e=75||p&&p>=600)}var e=t.prototype;return e.destroy=function(){},e.resetTimeStamp=function(t){l.logger.log("[mp4-remuxer]: initPTS & initDTS reset"),this._initPTS=this._initDTS=t},e.resetNextTimestamp=function(){l.logger.log("[mp4-remuxer]: reset next timestamp"),this.isVideoContiguous=!1,this.isAudioContiguous=!1},e.resetInitSegment=function(){l.logger.log("[mp4-remuxer]: ISGenerated flag reset"),this.ISGenerated=!1},e.getVideoStartPts=function(t){var e=!1,i=t.reduce((function(t,i){var r=i.pts-t;return r<-4294967296?(e=!0,m(t,i.pts)):r>0?t:i.pts}),t[0].pts);return e&&l.logger.debug("PTS rollover detected"),i},e.remux=function(t,e,i,r,n,a,s,o){var d,u,h,p,g,f,A=n,b=n,_=t.pid>-1,w=e.pid>-1,C=e.samples.length,E=t.samples.length>0,T=s&&C>0||C>1;if((!_||E)&&(!w||T)||this.ISGenerated||s){this.ISGenerated||(h=this.generateIS(t,e,n));var I,S=this.isVideoContiguous,x=-1;if(T&&(x=function(t){for(var e=0;e0){l.logger.warn("[mp4-remuxer]: Dropped "+x+" out of "+C+" video samples due to a missing keyframe");var k=this.getVideoStartPts(e.samples);e.samples=e.samples.slice(x),e.dropped+=x,I=b+=(e.samples[0].pts-k)/e.inputTimeScale}else-1===x&&(l.logger.warn("[mp4-remuxer]: No keyframe found out of "+C+" video samples"),f=!1);if(this.ISGenerated){if(E&&T){var P=this.getVideoStartPts(e.samples),D=(m(t.samples[0].pts,P)-P)/e.inputTimeScale;A+=Math.max(0,D),b+=Math.max(0,-D)}if(E){if(t.samplerate||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as audio detected"),h=this.generateIS(t,e,n)),u=this.remuxAudio(t,A,this.isAudioContiguous,a,w||T||o===c.PlaylistLevelType.AUDIO?b:void 0),T){var L=u?u.endPTS-u.startPTS:0;e.inputTimeScale||(l.logger.warn("[mp4-remuxer]: regenerate InitSegment as video detected"),h=this.generateIS(t,e,n)),d=this.remuxVideo(e,b,S,L)}}else T&&(d=this.remuxVideo(e,b,S,0));d&&(d.firstKeyFrame=x,d.independent=-1!==x,d.firstKeyFramePTS=I)}}return this.ISGenerated&&(i.samples.length&&(g=v(i,n,this._initPTS,this._initDTS)),r.samples.length&&(p=y(r,n,this._initPTS))),{audio:u,video:d,initSegment:h,independent:f,text:p,id3:g}},e.generateIS=function(t,e,i){var n,s,o,l=t.samples,c=e.samples,d=this.typeSupported,u={},h=!Object(r.isFiniteNumber)(this._initPTS),p="audio/mp4";if(h&&(n=s=1/0),t.config&&l.length&&(t.timescale=t.samplerate,"mp3"===t.segmentCodec&&(d.mpeg?(p="audio/mpeg",t.codec=""):d.mp3&&(t.codec="mp3")),u.audio={id:"audio",container:p,codec:t.codec,initSegment:"mp3"===t.segmentCodec&&d.mpeg?new Uint8Array(0):a.default.initSegment([t]),metadata:{channelCount:t.channelCount}},h&&(o=t.inputTimeScale,n=s=l[0].pts-Math.round(o*i))),e.sps&&e.pps&&c.length&&(e.timescale=e.inputTimeScale,u.video={id:"main",container:"video/mp4",codec:e.codec,initSegment:a.default.initSegment([e]),metadata:{width:e.width,height:e.height}},h)){o=e.inputTimeScale;var g=this.getVideoStartPts(c),f=Math.round(o*i);s=Math.min(s,m(c[0].dts,g)-f),n=Math.min(n,g-f)}if(Object.keys(u).length)return this.ISGenerated=!0,h&&(this._initPTS=n,this._initDTS=s),{tracks:u,initPTS:n,timescale:o}},e.remuxVideo=function(t,e,i,r){var n,c,p=t.inputTimeScale,f=t.samples,v=[],y=f.length,b=this._initPTS,_=this.nextAvcDts,w=8,C=this.videoSampleDuration,E=Number.POSITIVE_INFINITY,T=Number.NEGATIVE_INFINITY,I=0,S=!1;i&&null!==_||(_=e*p-(f[0].pts-m(f[0].dts,f[0].pts)));for(var x=0;xk.pts&&(I=Math.max(Math.min(I,k.pts-k.dts),-18e3)),k.dts0?x-1:x].dts&&(S=!0)}S&&f.sort((function(t,e){var i=t.dts-e.dts,r=t.pts-e.pts;return i||r})),n=f[0].dts;var P=f[f.length-1].dts-n,D=P?Math.round(P/(y-1)):C||t.inputTimeScale/30;if(I<0){if(I<-2*D){l.logger.warn("PTS < DTS detected in video samples, offsetting DTS from PTS by "+Object(d.toMsFromMpegTsClock)(-D,!0)+" ms");for(var L=I,B=0;BD;if(M||R<-1){M?l.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(R,!0)+" ms ("+R+"dts) hole between fragments detected, filling it"):l.logger.warn("AVC: "+Object(d.toMsFromMpegTsClock)(-R,!0)+" ms ("+R+"dts) overlapping between fragments detected"),n=_;var N=f[0].pts-R;f[0].dts=n,f[0].pts=N,l.logger.log("Video: First PTS/DTS adjusted: "+Object(d.toMsFromMpegTsClock)(N,!0)+"/"+Object(d.toMsFromMpegTsClock)(n,!0)+", delta: "+Object(d.toMsFromMpegTsClock)(R,!0)+" ms")}}g&&(n=Math.max(0,n));for(var F=0,U=0,V=0;V0?X.dts-f[J-1].dts:D;if(at.stretchShortVideoTrack&&null!==this.nextAudioPts){var ot=Math.floor(at.maxBufferHole*p),lt=(r?E+r*p:this.nextAudioPts)-X.pts;lt>ot?((C=lt-st)<0?C=st:Y=!0,l.logger.log("[mp4-remuxer]: It is approximately "+lt/90+" ms to the next segment; using duration "+C/90+" ms for the last video frame.")):C=st}else C=st}var ct=Math.round(X.pts-X.dts);v.push(new A(X.key,C,Z,ct))}if(v.length&&h&&h<70){var dt=v[0].flags;dt.dependsOn=2,dt.isNonSync=0}console.assert(null!==C,"mp4SampleDuration must be computed"),C=Y||!C?D:C,this.nextAvcDts=_=c+C,this.videoSampleDuration=C,this.isVideoContiguous=!0;var ut={data1:a.default.moof(t.sequenceNumber++,n,u({},t,{samples:v})),data2:z,startPTS:E/p,endPTS:(T+C)/p,startDTS:n/p,endDTS:_/p,type:"video",hasAudio:!1,hasVideo:!0,nb:v.length,dropped:t.dropped};return t.samples=[],t.dropped=0,console.assert(z.length,"MDAT length must not be zero"),ut},e.remuxAudio=function(t,e,i,r,c){var d=t.inputTimeScale,h=d/(t.samplerate?t.samplerate:d),p="aac"===t.segmentCodec?1024:1152,g=p*h,f=this._initPTS,v="mp3"===t.segmentCodec&&this.typeSupported.mpeg,y=[],b=void 0!==c,_=t.samples,w=v?0:8,C=this.nextAudioPts||-1,E=e*d;if(this.isAudioContiguous=i=i||_.length&&C>0&&(r&&Math.abs(E-C)<9e3||Math.abs(m(_[0].pts-f,E)-C)<20*g),_.forEach((function(t){t.pts=m(t.pts-f,E)})),!i||C<0){if(_=_.filter((function(t){return t.pts>=0})),!_.length)return;C=0===c?0:r&&!b?Math.max(0,E):_[0].pts}if("aac"===t.segmentCodec)for(var T=this.config.maxAudioFramesDrift,I=0,S=C;I<_.length;I++){var x=_[I],k=x.pts,P=k-S,D=Math.abs(1e3*P/d);if(P<=-T*g&&b)0===I&&(l.logger.warn("Audio frame @ "+(k/d).toFixed(3)+"s overlaps nextAudioPts by "+Math.round(1e3*P/d)+" ms."),this.nextAudioPts=C=S=k);else if(P>=T*g&&D<1e4&&b){var L=Math.round(P/g);(S=k-L*g)<0&&(L--,S+=g),0===I&&(this.nextAudioPts=C=S),l.logger.warn("[mp4-remuxer]: Injecting "+L+" audio frame @ "+(S/d).toFixed(3)+"s due to "+Math.round(1e3*P/d)+" ms gap.");for(var B=0;B0))return;U+=w;try{M=new Uint8Array(U)}catch(t){return void this.observer.emit(s.Events.ERROR,s.Events.ERROR,{type:o.ErrorTypes.MUX_ERROR,details:o.ErrorDetails.REMUX_ALLOC_ERROR,fatal:!1,bytes:U,reason:"fail allocating audio mdat "+U})}v||(new DataView(M.buffer).setUint32(0,U),M.set(a.default.types.mdat,4))}M.set(H,w);var z=H.byteLength;w+=z,y.push(new A(!0,p,z,0)),F=W}var K=y.length;if(K){var q=y[y.length-1];this.nextAudioPts=C=F+h*q.duration;var Y=v?new Uint8Array(0):a.default.moof(t.sequenceNumber++,N/h,u({},t,{samples:y}));t.samples=[];var J=N/d,X=C/d,$={data1:Y,data2:M,startPTS:J,endPTS:X,startDTS:J,endDTS:X,type:"audio",hasAudio:!0,hasVideo:!1,nb:K};return this.isAudioContiguous=!0,console.assert(M.length,"MDAT length must not be zero"),$}},e.remuxEmptyAudio=function(t,e,i,r){var a=t.inputTimeScale,s=a/(t.samplerate?t.samplerate:a),o=this.nextAudioPts,c=(null!==o?o:r.startDTS*a)+this._initDTS,d=r.endDTS*a+this._initDTS,u=1024*s,h=Math.ceil((d-c)/u),p=n.default.getSilentFrame(t.manifestCodec||t.codec,t.channelCount);if(l.logger.warn("[mp4-remuxer]: remux empty Audio"),p){for(var g=[],f=0;f4294967296;)t+=i;return t}function v(t,e,i,r){var n=t.samples.length;if(n){for(var a=t.inputTimeScale,s=0;s0?this.lastEndTime=A:(o.logger.warn("Duration parsed from mp4 should be greater than zero"),this.resetNextTimestamp());var b=!!f.audio,_=!!f.video,w="";b&&(w+="audio"),_&&(w+="video");var C={data1:p,startPTS:y,startDTS:y,endPTS:A,endDTS:A,type:w,hasAudio:b,hasVideo:_,nb:1,dropped:0};h.audio="audio"===C.type?C:void 0,h.video="audio"!==C.type?C:void 0,h.initSegment=g;var E=null!=(c=this.initPTS)?c:0;return h.id3=Object(n.flushTextTrackMetadataCueSamples)(i,l,E,E),s.samples.length&&(h.text=Object(n.flushTextTrackUserdataCueSamples)(s,l,E)),h},t}();function c(t,e){var i=null==t?void 0:t.codec;return i&&i.length>4?i:"hvc1"===i||"hev1"===i?"hvc1.1.c.L120.90":"av01"===i?"av01.0.04M.08":"avc1"===i||e===s.ElementaryStreamTypes.VIDEO?"avc1.42e01e":"mp4a.40.5"}e.default=l},"./src/task-loop.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return r}));var r=function(){function t(){this._boundTick=void 0,this._tickTimer=null,this._tickInterval=null,this._tickCallCount=0,this._boundTick=this.tick.bind(this)}var e=t.prototype;return e.destroy=function(){this.onHandlerDestroying(),this.onHandlerDestroyed()},e.onHandlerDestroying=function(){this.clearNextTick(),this.clearInterval()},e.onHandlerDestroyed=function(){},e.hasInterval=function(){return!!this._tickInterval},e.hasNextTick=function(){return!!this._tickTimer},e.setInterval=function(t){return!this._tickInterval&&(this._tickInterval=self.setInterval(this._boundTick,t),!0)},e.clearInterval=function(){return!!this._tickInterval&&(self.clearInterval(this._tickInterval),this._tickInterval=null,!0)},e.clearNextTick=function(){return!!this._tickTimer&&(self.clearTimeout(this._tickTimer),this._tickTimer=null,!0)},e.tick=function(){this._tickCallCount++,1===this._tickCallCount&&(this.doTick(),this._tickCallCount>1&&this.tickImmediate(),this._tickCallCount=0)},e.tickImmediate=function(){this.clearNextTick(),this._tickTimer=self.setTimeout(this._boundTick,0)},e.doTick=function(){},t}()},"./src/types/cmcd.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"CMCDVersion",(function(){return s})),i.d(e,"CMCDObjectType",(function(){return r})),i.d(e,"CMCDStreamingFormat",(function(){return n})),i.d(e,"CMCDStreamType",(function(){return a}));var r,n,a,s=1;!function(t){t.MANIFEST="m",t.AUDIO="a",t.VIDEO="v",t.MUXED="av",t.INIT="i",t.CAPTION="c",t.TIMED_TEXT="tt",t.KEY="k",t.OTHER="o"}(r||(r={})),function(t){t.DASH="d",t.HLS="h",t.SMOOTH="s",t.OTHER="o"}(n||(n={})),function(t){t.VOD="v",t.LIVE="l"}(a||(a={}))},"./src/types/demuxer.ts":function(t,e,i){"use strict";var r;i.r(e),i.d(e,"MetadataSchema",(function(){return r})),function(t){t.audioId3="org.id3",t.dateRange="com.apple.quicktime.HLS",t.emsg="https://aomedia.org/emsg/ID3"}(r||(r={}))},"./src/types/level.ts":function(t,e,i){"use strict";function r(t,e){for(var i=0;iNumber.MAX_SAFE_INTEGER?1/0:e},e.hexadecimalInteger=function(t){if(this[t]){var e=(this[t]||"0x").slice(2);e=(1&e.length?"0":"")+e;for(var i=new Uint8Array(e.length/2),r=0;rNumber.MAX_SAFE_INTEGER?1/0:e},e.decimalFloatingPoint=function(t){return parseFloat(this[t])},e.optionalFloat=function(t,e){var i=this[t];return i?parseFloat(i):e},e.enumeratedString=function(t){return this[t]},e.bool=function(t){return"YES"===this[t]},e.decimalResolution=function(t){var e=r.exec(this[t]);if(null!==e)return{width:parseInt(e[1],10),height:parseInt(e[2],10)}},t.parseAttrList=function(t){var e,i={};for(n.lastIndex=0;null!==(e=n.exec(t));){var r=e[2];0===r.indexOf('"')&&r.lastIndexOf('"')===r.length-1&&(r=r.slice(1,-1)),i[e[1]]=r}return i},t}()},"./src/utils/binary-search.ts":function(t,e,i){"use strict";i.r(e),e.default={search:function(t,e){for(var i=0,r=t.length-1,n=null,a=null;i<=r;){var s=e(a=t[n=(i+r)/2|0]);if(s>0)i=n+1;else{if(!(s<0))return a;r=n-1}}return null}}},"./src/utils/buffer-helper.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"BufferHelper",(function(){return a}));var r=i("./src/utils/logger.ts"),n={length:0,start:function(){return 0},end:function(){return 0}},a=function(){function t(){}return t.isBuffered=function(e,i){try{if(e)for(var r=t.getBuffered(e),n=0;n=r.start(n)&&i<=r.end(n))return!0}catch(t){}return!1},t.bufferInfo=function(e,i,r){try{if(e){var n,a=t.getBuffered(e),s=[];for(n=0;ns&&(r[a-1].end=t[n].end):r.push(t[n])}else r.push(t[n])}else r=t;for(var o,l=0,c=e,d=e,u=0;u=h&&e=t&&n.logger.log(this.time+" ["+t+"] "+e)},t}(),f=function(t){for(var e=[],i=0;il&&(this.logger.log(r.DEBUG,"Too large cursor position "+this.pos),this.pos=l)},e.moveCursor=function(t){var e=this.pos+t;if(t>1)for(var i=this.pos+1;i=144&&this.backSpace();var e=s(t);this.pos>=l?this.logger.log(r.ERROR,"Cannot insert "+t.toString(16)+" ("+e+") at position "+this.pos+". Skipping it!"):(this.chars[this.pos].setChar(e,this.currPenState),this.moveCursor(1))},e.clearFromPos=function(t){var e;for(e=t;e0&&(i=t?"["+e.join(" | ")+"]":e.join("\n")),i},e.getTextAndFormat=function(){return this.rows},t}(),b=function(){function t(t,e,i){this.chNr=void 0,this.outputFilter=void 0,this.mode=void 0,this.verbose=void 0,this.displayedMemory=void 0,this.nonDisplayedMemory=void 0,this.lastOutputScreen=void 0,this.currRollUpRow=void 0,this.writeScreen=void 0,this.cueStartTime=void 0,this.logger=void 0,this.chNr=t,this.outputFilter=e,this.mode=null,this.verbose=0,this.displayedMemory=new A(i),this.nonDisplayedMemory=new A(i),this.lastOutputScreen=new A(i),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null,this.logger=i}var e=t.prototype;return e.reset=function(){this.mode=null,this.displayedMemory.reset(),this.nonDisplayedMemory.reset(),this.lastOutputScreen.reset(),this.outputFilter.reset(),this.currRollUpRow=this.displayedMemory.rows[14],this.writeScreen=this.displayedMemory,this.mode=null,this.cueStartTime=null},e.getHandler=function(){return this.outputFilter},e.setHandler=function(t){this.outputFilter=t},e.setPAC=function(t){this.writeScreen.setPAC(t)},e.setBkgData=function(t){this.writeScreen.setBkgData(t)},e.setMode=function(t){t!==this.mode&&(this.mode=t,this.logger.log(r.INFO,"MODE="+t),"MODE_POP-ON"===this.mode?this.writeScreen=this.nonDisplayedMemory:(this.writeScreen=this.displayedMemory,this.writeScreen.reset()),"MODE_ROLL-UP"!==this.mode&&(this.displayedMemory.nrRollUpRows=null,this.nonDisplayedMemory.nrRollUpRows=null),this.mode=t)},e.insertChars=function(t){for(var e=0;e=46,e.italics)e.foreground="white";else{var i=Math.floor(t/2)-16;e.foreground=["white","green","blue","cyan","red","yellow","magenta"][i]}this.logger.log(r.INFO,"MIDROW: "+JSON.stringify(e)),this.writeScreen.setPen(e)},e.outputDataUpdate=function(t){void 0===t&&(t=!1);var e=this.logger.time;null!==e&&this.outputFilter&&(null!==this.cueStartTime||this.displayedMemory.isEmpty()?this.displayedMemory.equals(this.lastOutputScreen)||(this.outputFilter.newCue(this.cueStartTime,e,this.lastOutputScreen),t&&this.outputFilter.dispatchCue&&this.outputFilter.dispatchCue(),this.cueStartTime=this.displayedMemory.isEmpty()?null:e):this.cueStartTime=e,this.lastOutputScreen.copy(this.displayedMemory))},e.cueSplitAtTime=function(t){this.outputFilter&&(this.displayedMemory.isEmpty()||(this.outputFilter.newCue&&this.outputFilter.newCue(this.cueStartTime,t,this.displayedMemory),this.cueStartTime=t))},t}(),_=function(){function t(t,e,i){this.channels=void 0,this.currentChannel=0,this.cmdHistory=void 0,this.logger=void 0;var r=new g;this.channels=[null,new b(t,e,r),new b(t+1,i,r)],this.cmdHistory={a:null,b:null},this.logger=r}var e=t.prototype;return e.getHandler=function(t){return this.channels[t].getHandler()},e.setHandler=function(t,e){this.channels[t].setHandler(e)},e.addData=function(t,e){var i,n,a,s=!1;this.logger.time=t;for(var o=0;o ("+f([n,a])+")"),(i=this.parseCmd(n,a))||(i=this.parseMidrow(n,a)),i||(i=this.parsePAC(n,a)),i||(i=this.parseBackgroundAttributes(n,a)),!i&&(s=this.parseChars(n,a))){var l=this.currentChannel;l&&l>0?this.channels[l].insertChars(s):this.logger.log(r.WARNING,"No channel found yet. TEXT-MODE?")}i||s||this.logger.log(r.WARNING,"Couldn't parse cleaned data "+f([n,a])+" orig: "+f([e[o],e[o+1]]))}},e.parseCmd=function(t,e){var i=this.cmdHistory;if(!((20===t||28===t||21===t||29===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=33&&e<=35))return!1;if(C(t,e,i))return w(null,null,i),this.logger.log(r.DEBUG,"Repeated command ("+f([t,e])+") is dropped"),!0;var n=20===t||21===t||23===t?1:2,a=this.channels[n];return 20===t||21===t||28===t||29===t?32===e?a.ccRCL():33===e?a.ccBS():34===e?a.ccAOF():35===e?a.ccAON():36===e?a.ccDER():37===e?a.ccRU(2):38===e?a.ccRU(3):39===e?a.ccRU(4):40===e?a.ccFON():41===e?a.ccRDC():42===e?a.ccTR():43===e?a.ccRTD():44===e?a.ccEDM():45===e?a.ccCR():46===e?a.ccENM():47===e&&a.ccEOC():a.ccTO(e-32),w(t,e,i),this.currentChannel=n,!0},e.parseMidrow=function(t,e){var i=0;if((17===t||25===t)&&e>=32&&e<=47){if((i=17===t?1:2)!==this.currentChannel)return this.logger.log(r.ERROR,"Mismatch channel in midrow parsing"),!1;var n=this.channels[i];return!!n&&(n.ccMIDROW(e),this.logger.log(r.DEBUG,"MIDROW ("+f([t,e])+")"),!0)}return!1},e.parsePAC=function(t,e){var i,r=this.cmdHistory;if(!((t>=17&&t<=23||t>=25&&t<=31)&&e>=64&&e<=127||(16===t||24===t)&&e>=64&&e<=95))return!1;if(C(t,e,r))return w(null,null,r),!0;var n=t<=23?1:2;i=e>=64&&e<=95?1===n?c[t]:u[t]:1===n?d[t]:h[t];var a=this.channels[n];return!!a&&(a.setPAC(this.interpretPAC(i,e)),w(t,e,r),this.currentChannel=n,!0)},e.interpretPAC=function(t,e){var i,r={color:null,italics:!1,indent:null,underline:!1,row:t};return i=e>95?e-96:e-64,r.underline=!(1&~i),i<=13?r.color=["white","green","blue","cyan","red","yellow","magenta","white"][Math.floor(i/2)]:i<=15?(r.italics=!0,r.color="white"):r.indent=4*Math.floor((i-16)/2),r},e.parseChars=function(t,e){var i,n,a=null,o=null;if(t>=25?(i=2,o=t-8):(i=1,o=t),o>=17&&o<=19?(n=17===o?e+80:18===o?e+112:e+144,this.logger.log(r.INFO,"Special char '"+s(n)+"' in channel "+i),a=[n]):t>=32&&t<=127&&(a=0===e?[t]:[t,e]),a){var l=f(a);this.logger.log(r.DEBUG,"Char codes = "+l.join(",")),w(t,e,this.cmdHistory)}return a},e.parseBackgroundAttributes=function(t,e){var i;if(!((16===t||24===t)&&e>=32&&e<=47||(23===t||31===t)&&e>=45&&e<=47))return!1;var r={};16===t||24===t?(i=Math.floor((e-32)/2),r.background=p[i],e%2==1&&(r.background=r.background+"_semi")):45===e?r.background="transparent":(r.foreground="black",47===e&&(r.underline=!0));var n=t<=23?1:2;return this.channels[n].setBkgData(r),w(t,e,this.cmdHistory),!0},e.reset=function(){for(var t=0;t=16?u--:u++;var v=Object(r.fixLineBreaks)(h.trim()),y=Object(n.generateCueId)(e,i,v);t&&t.cues&&t.cues.getCueById(y)||((c=new g(e,i,v)).id=y,c.line=f+1,c.align="left",c.position=10+Math.min(80,10*Math.floor(8*u/32)),p.push(c))}return t&&p.length&&(p.sort((function(t,e){return"auto"===t.line||"auto"===e.line?0:t.line>8&&e.line>8?e.line-t.line:t.line-e.line})),p.forEach((function(e){return Object(a.addCueToTrack)(t,e)}))),p}};e.default=o},"./src/utils/discontinuities.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"findFirstFragWithCC",(function(){return s})),i.d(e,"shouldAlignOnDiscontinuities",(function(){return o})),i.d(e,"findDiscontinuousReferenceFrag",(function(){return l})),i.d(e,"adjustSlidingStart",(function(){return d})),i.d(e,"alignStream",(function(){return u})),i.d(e,"alignPDT",(function(){return h})),i.d(e,"alignFragmentByPDTDelta",(function(){return p})),i.d(e,"alignMediaPlaylistByPDT",(function(){return g}));var r=i("./src/polyfills/number.ts"),n=i("./src/utils/logger.ts"),a=i("./src/controller/level-helper.ts");function s(t,e){for(var i=null,r=0,n=t.length;ri.startCC||t&&t.cc=this.minWeight_},e.getEstimate=function(){return this.canEstimate()?Math.min(this.fast_.getEstimate(),this.slow_.getEstimate()):this.defaultEstimate_},e.destroy=function(){},t}();e.default=n},"./src/utils/ewma.ts":function(t,e,i){"use strict";i.r(e);var r=function(){function t(t,e,i){void 0===e&&(e=0),void 0===i&&(i=0),this.halfLife=void 0,this.alpha_=void 0,this.estimate_=void 0,this.totalWeight_=void 0,this.halfLife=t,this.alpha_=t?Math.exp(Math.log(.5)/t):0,this.estimate_=e,this.totalWeight_=i}var e=t.prototype;return e.sample=function(t,e){var i=Math.pow(this.alpha_,t);this.estimate_=e*(1-i)+i*this.estimate_,this.totalWeight_+=t},e.getTotalWeight=function(){return this.totalWeight_},e.getEstimate=function(){if(this.alpha_){var t=1-Math.pow(this.alpha_,this.totalWeight_);if(t)return this.estimate_/t}return this.estimate_},t}();e.default=r},"./src/utils/fetch-loader.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"fetchSupported",(function(){return u}));var r=i("./src/polyfills/number.ts"),n=i("./src/loader/load-stats.ts"),a=i("./src/demux/chunk-cache.ts");function s(t){var e="function"==typeof Map?new Map:void 0;return s=function(t){if(null===t||(i=t,-1===Function.toString.call(i).indexOf("[native code]")))return t;var i;if("function"!=typeof t)throw new TypeError("Super expression must either be null or a function");if(void 0!==e){if(e.has(t))return e.get(t);e.set(t,r)}function r(){return o(t,arguments,c(this).constructor)}return r.prototype=Object.create(t.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),l(r,t)},s(t)}function o(t,e,i){return o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}()?Reflect.construct.bind():function(t,e,i){var r=[null];r.push.apply(r,e);var n=new(Function.bind.apply(t,r));return i&&l(n,i.prototype),n},o.apply(null,arguments)}function l(t,e){return l=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},l(t,e)}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}function d(){return d=Object.assign?Object.assign.bind():function(t){for(var e=1;e=r&&n(e,i,s.flush(),t)):n(e,i,l,t),a()})).catch((function(){return Promise.reject()}))}()},t}();function p(t,e){return new self.Request(t.url,e)}var g=function(t){var e,i;function r(e,i,r){var n;return(n=t.call(this,e)||this).code=void 0,n.details=void 0,n.code=i,n.details=r,n}return i=t,(e=r).prototype=Object.create(i.prototype),e.prototype.constructor=e,l(e,i),r}(s(Error));e.default=h},"./src/utils/imsc1-ttml-parser.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"IMSC1_CODEC",(function(){return d})),i.d(e,"parseIMSC1",(function(){return g}));var r=i("./src/utils/mp4-tools.ts"),n=i("./src/utils/vttparser.ts"),a=i("./src/utils/vttcue.ts"),s=i("./src/demux/id3.ts"),o=i("./src/utils/timescale-conversion.ts"),l=i("./src/utils/webvtt-parser.ts");function c(){return c=Object.assign?Object.assign.bind():function(t){for(var e=1;e1?e-1:0),n=1;n"):r}(e)}))}(t,"debug","log","info","warn","error");try{a.log()}catch(t){a=n}}else a=n}var o=n},"./src/utils/mediakeys-helper.ts":function(t,e,i){"use strict";var r;i.r(e),i.d(e,"KeySystems",(function(){return r})),i.d(e,"requestMediaKeySystemAccess",(function(){return n})),function(t){t.WIDEVINE="com.widevine.alpha",t.PLAYREADY="com.microsoft.playready"}(r||(r={}));var n="undefined"!=typeof self&&self.navigator&&self.navigator.requestMediaKeySystemAccess?self.navigator.requestMediaKeySystemAccess.bind(self.navigator):null},"./src/utils/mediasource-helper.ts":function(t,e,i){"use strict";function r(){return self.MediaSource||self.WebKitMediaSource}i.r(e),i.d(e,"getMediaSource",(function(){return r}))},"./src/utils/mp4-tools.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"RemuxerTrackIdConfig",(function(){return l})),i.d(e,"bin2str",(function(){return c})),i.d(e,"readUint16",(function(){return d})),i.d(e,"readUint32",(function(){return u})),i.d(e,"readSint32",(function(){return h})),i.d(e,"writeUint32",(function(){return p})),i.d(e,"findBox",(function(){return g})),i.d(e,"parseSegmentIndex",(function(){return f})),i.d(e,"parseInitSegment",(function(){return m})),i.d(e,"getStartDTS",(function(){return v})),i.d(e,"getDuration",(function(){return y})),i.d(e,"computeRawDurationFromSamples",(function(){return A})),i.d(e,"offsetStartDTS",(function(){return b})),i.d(e,"segmentValidRange",(function(){return _})),i.d(e,"appendUint8Array",(function(){return w})),i.d(e,"parseSamples",(function(){return C})),i.d(e,"parseSEIMessageFromNALu",(function(){return T})),i.d(e,"parseEmsg",(function(){return I}));var r=i("./src/utils/typed-array.ts"),n=i("./src/loader/fragment.ts"),a=i("./src/demux/id3.ts"),s=Math.pow(2,32)-1,o=[].push,l={video:1,audio:2,id3:3,text:4};function c(t){return String.fromCharCode.apply(null,t)}function d(t,e){var i=t[e]<<8|t[e+1];return i<0?65536+i:i}function u(t,e){var i=h(t,e);return i<0?4294967296+i:i}function h(t,e){return t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3]}function p(t,e,i){t[e]=i>>24,t[e+1]=i>>16&255,t[e+2]=i>>8&255,t[e+3]=255&i}function g(t,e){var i=[];if(!e.length)return i;for(var r=t.byteLength,n=0;n1?n+a:r;if(c(t.subarray(n+4,n+8))===e[0])if(1===e.length)i.push(t.subarray(n+8,s));else{var l=g(t.subarray(n+8,s),e.slice(1));l.length&&o.apply(i,l)}n=s}return i}function f(t){var e=[],i=t[0],r=8,n=u(t,r);r+=4,r+=0===i?8:16,r+=2;var a=t.length+0,s=d(t,r);r+=2;for(var o=0;o>>31)return console.warn("SIDX has hierarchical references (not supported)"),null;var p=u(t,l);l+=4,e.push({referenceSize:h,subsegmentDuration:p,info:{duration:p/n,start:a,end:a+h-1}}),a+=h,r=l+=4}return{earliestPresentationTime:0,timescale:n,version:i,referencesCount:s,references:e}}function m(t){for(var e=[],i=g(t,["moov","trak"]),r=0;r=r.length)break;s+=c=r[n++]}while(255===c);o=0;do{if(n>=r.length)break;o+=c=r[n++]}while(255===c);var h=r.length-n;if(!l&&4===s&&n16){for(var _=[],w=0;w<16;w++){var C=r[n++].toString(16);_.push(1==C.length?"0"+C:C),3!==w&&5!==w&&7!==w&&9!==w||_.push("-")}for(var E=o-16,T=new Uint8Array(E),I=0;Ih)break}}function I(t){var e=t[0],i="",r="",n=0,a=0,s=0,o=0,l=0,d=0;if(0===e){for(;"\0"!==c(t.subarray(d,d+1));)i+=c(t.subarray(d,d+1)),d+=1;for(i+=c(t.subarray(d,d+1)),d+=1;"\0"!==c(t.subarray(d,d+1));)r+=c(t.subarray(d,d+1)),d+=1;r+=c(t.subarray(d,d+1)),d+=1,n=u(t,12),a=u(t,16),o=u(t,20),l=u(t,24),d=28}else if(1===e){n=u(t,d+=4);var h=u(t,d+=4),p=u(t,d+=4);for(d+=4,s=Math.pow(2,32)*h+p,Number.isSafeInteger(s)||(s=Number.MAX_SAFE_INTEGER,console.warn("Presentation time exceeds safe integer limit and wrapped to max safe integer in parsing emsg box")),o=u(t,d),l=u(t,d+=4),d+=4;"\0"!==c(t.subarray(d,d+1));)i+=c(t.subarray(d,d+1)),d+=1;for(i+=c(t.subarray(d,d+1)),d+=1;"\0"!==c(t.subarray(d,d+1));)r+=c(t.subarray(d,d+1)),d+=1;r+=c(t.subarray(d,d+1)),d+=1}return{schemeIdUri:i,value:r,timeScale:n,presentationTime:s,presentationTimeDelta:a,eventDuration:o,id:l,payload:t.subarray(d,t.byteLength)}}},"./src/utils/output-filter.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"default",(function(){return r}));var r=function(){function t(t,e){this.timelineController=void 0,this.cueRanges=[],this.trackName=void 0,this.startTime=null,this.endTime=null,this.screen=null,this.timelineController=t,this.trackName=e}var e=t.prototype;return e.dispatchCue=function(){null!==this.startTime&&(this.timelineController.addCues(this.trackName,this.startTime,this.endTime,this.screen,this.cueRanges),this.startTime=null)},e.newCue=function(t,e,i){(null===this.startTime||this.startTime>t)&&(this.startTime=t),this.endTime=e,this.screen=i,this.timelineController.createCaptionsTrack(this.trackName)},e.reset=function(){this.cueRanges=[],this.startTime=null},t}()},"./src/utils/texttrack-utils.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"sendAddTrackEvent",(function(){return n})),i.d(e,"addCueToTrack",(function(){return a})),i.d(e,"clearCurrentCues",(function(){return s})),i.d(e,"removeCuesInRange",(function(){return o})),i.d(e,"getCuesInRange",(function(){return l}));var r=i("./src/utils/logger.ts");function n(t,e){var i;try{i=new Event("addtrack")}catch(t){(i=document.createEvent("Event")).initEvent("addtrack",!1,!1)}i.track=t,e.dispatchEvent(i)}function a(t,e){var i=t.mode;if("disabled"===i&&(t.mode="hidden"),t.cues&&!t.cues.getCueById(e.id))try{if(t.addCue(e),!t.cues.getCueById(e.id))throw new Error("addCue is failed for: "+e)}catch(i){r.logger.debug("[texttrack-utils]: "+i);var n=new self.TextTrackCue(e.startTime,e.endTime,e.text);n.id=e.id,t.addCue(n)}"disabled"===i&&(t.mode=i)}function s(t){var e=t.mode;if("disabled"===e&&(t.mode="hidden"),t.cues)for(var i=t.cues.length;i--;)t.removeCue(t.cues[i]);"disabled"===e&&(t.mode=e)}function o(t,e,i,r){var n=t.mode;if("disabled"===n&&(t.mode="hidden"),t.cues&&t.cues.length>0)for(var a=l(t.cues,e,i),s=0;st[i].endTime)return-1;for(var r=0,n=i;r<=n;){var a=Math.floor((n+r)/2);if(et[a].startTime&&r-1)for(var a=n,s=t.length;a=e&&o.endTime<=i)r.push(o);else if(o.startTime>i)return r}return r}},"./src/utils/time-ranges.ts":function(t,e,i){"use strict";i.r(e),e.default={toString:function(t){for(var e="",i=t.length,r=0;r1?e-1:0),r=1;r100)throw new Error("Position must be between 0 and 100.");A=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"positionAlign",n({},l,{get:function(){return b},set:function(t){var e=r(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");b=e,this.hasBeenReset=!0}})),Object.defineProperty(o,"size",n({},l,{get:function(){return _},set:function(t){if(t<0||t>100)throw new Error("Size must be between 0 and 100.");_=t,this.hasBeenReset=!0}})),Object.defineProperty(o,"align",n({},l,{get:function(){return w},set:function(t){var e=r(t);if(!e)throw new SyntaxError("An invalid or illegal string was specified.");w=e,this.hasBeenReset=!0}})),o.displayState=void 0}return a.prototype.getCueAsHTML=function(){return self.WebVTT.convertCueToDOMTree(self,this.text)},a}()},"./src/utils/vttparser.ts":function(t,e,i){"use strict";i.r(e),i.d(e,"parseTimeStamp",(function(){return a})),i.d(e,"fixLineBreaks",(function(){return u})),i.d(e,"VTTParser",(function(){return h}));var r=i("./src/utils/vttcue.ts"),n=function(){function t(){}return t.prototype.decode=function(t,e){if(!t)return"";if("string"!=typeof t)throw new Error("Error - expected string data.");return decodeURIComponent(encodeURIComponent(t))},t}();function a(t){function e(t,e,i,r){return 3600*(0|t)+60*(0|e)+(0|i)+parseFloat(r||0)}var i=t.match(/^(?:(\d+):)?(\d{2}):(\d{2})(\.\d+)?/);return i?parseFloat(i[2])>59?e(i[2],i[3],0,i[4]):e(i[1],i[2],i[3],i[4]):null}var s=function(){function t(){this.values=Object.create(null)}var e=t.prototype;return e.set=function(t,e){this.get(t)||""===e||(this.values[t]=e)},e.get=function(t,e,i){return i?this.has(t)?this.values[t]:e[i]:this.has(t)?this.values[t]:e},e.has=function(t){return t in this.values},e.alt=function(t,e,i){for(var r=0;r=0&&i<=100)return this.set(t,i),!0}return!1},t}();function o(t,e,i,r){var n=r?t.split(r):[t];for(var a in n)if("string"==typeof n[a]){var s=n[a].split(i);2===s.length&&e(s[0],s[1])}}var l=new r.default(0,0,""),c="middle"===l.align?"middle":"center";function d(t,e,i){var r=t;function n(){var e=a(t);if(null===e)throw new Error("Malformed timestamp: "+r);return t=t.replace(/^[^\sa-zA-Z-]+/,""),e}function d(){t=t.replace(/^\s+/,"")}if(d(),e.startTime=n(),d(),"--\x3e"!==t.slice(0,3))throw new Error("Malformed time stamp (time stamps must be separated by '--\x3e'): "+r);t=t.slice(3),d(),e.endTime=n(),d(),function(t,e){var r=new s;o(t,(function(t,e){var n;switch(t){case"region":for(var a=i.length-1;a>=0;a--)if(i[a].id===e){r.set(t,i[a].region);break}break;case"vertical":r.alt(t,e,["rl","lr"]);break;case"line":n=e.split(","),r.integer(t,n[0]),r.percent(t,n[0])&&r.set("snapToLines",!1),r.alt(t,n[0],["auto"]),2===n.length&&r.alt("lineAlign",n[1],["start",c,"end"]);break;case"position":n=e.split(","),r.percent(t,n[0]),2===n.length&&r.alt("positionAlign",n[1],["start",c,"end","line-left","line-right","auto"]);break;case"size":r.percent(t,e);break;case"align":r.alt(t,e,["start",c,"end","left","right"])}}),/:/,/\s/),e.region=r.get("region",null),e.vertical=r.get("vertical","");var n=r.get("line","auto");"auto"===n&&-1===l.line&&(n=-1),e.line=n,e.lineAlign=r.get("lineAlign","start"),e.snapToLines=r.get("snapToLines",!0),e.size=r.get("size",100),e.align=r.get("align",c);var a=r.get("position","auto");"auto"===a&&50===l.position&&(a="start"===e.align||"left"===e.align?0:"end"===e.align||"right"===e.align?100:50),e.position=a}(t,e)}function u(t){return t.replace(//gi,"\n")}var h=function(){function t(){this.state="INITIAL",this.buffer="",this.decoder=new n,this.regionList=[],this.cue=null,this.oncue=void 0,this.onparsingerror=void 0,this.onflush=void 0}var e=t.prototype;return e.parse=function(t){var e=this;function i(){var t=e.buffer,i=0;for(t=u(t);i9?parseInt(t.substring(0,t.indexOf(":"))):0;if(!(Object(r.isFiniteNumber)(e)&&Object(r.isFiniteNumber)(i)&&Object(r.isFiniteNumber)(n)&&Object(r.isFiniteNumber)(a)))throw Error("Malformed X-TIMESTAMP-MAP: Local:"+t);return e+=1e3*i,(e+=6e4*n)+36e5*a},u=function(t){for(var e=5381,i=t.length;i;)e=33*e^t.charCodeAt(--i);return(e>>>0).toString()};function h(t,e,i){return u(t.toString())+u(e.toString())+u(i)}var p=function(t,e,i){var r=t[e],n=t[r.prevCC];if(!n||!n.new&&r.new)return t.ccOffset=t.presentationOffset=r.start,void(r.new=!1);for(;null!==(a=n)&&void 0!==a&&a.new;){var a;t.ccOffset+=r.start-n.start,r.new=!1,n=t[(r=n).prevCC]}t.presentationOffset=i};function g(t,e,i,r,u,g,f,m){var v,y=new n.VTTParser,A=Object(a.utf8ArrayToStr)(new Uint8Array(t)).trim().replace(l,"\n").split("\n"),b=[],_=Object(s.toMpegTsClockFromTimescale)(e,i),w="00:00.000",C=0,E=0,T=!0;y.oncue=function(t){var e=r[u],i=r.ccOffset,n=(C-_)/9e4;null!=e&&e.new&&(void 0!==E?i=r.ccOffset=e.start:p(r,u,n)),n&&(i=n-r.presentationOffset);var a=t.endTime-t.startTime,s=Object(o.normalizePts)(9e4*(t.startTime+i-E),9e4*g)/9e4;t.startTime=Math.max(s,0),t.endTime=Math.max(s+a,0);var l=t.text.trim();t.text=decodeURIComponent(encodeURIComponent(l)),t.id||(t.id=h(t.startTime,t.endTime,l)),t.endTime>0&&b.push(t)},y.onparsingerror=function(t){v=t},y.onflush=function(){v?m(v):f(b)},A.forEach((function(t){if(T){if(c(t,"X-TIMESTAMP-MAP=")){T=!1,t.slice(16).split(",").forEach((function(t){c(t,"LOCAL:")?w=t.slice(6):c(t,"MPEGTS:")&&(C=parseInt(t.slice(7)))}));try{E=d(w)/1e3}catch(t){v=t}return}""===t&&(T=!1)}y.parse(t+"\n")})),y.flush()}},"./src/utils/xhr-loader.ts":function(t,e,i){"use strict";i.r(e);var r=i("./src/utils/logger.ts"),n=i("./src/loader/load-stats.ts"),a=/^age:\s*[\d.]+\s*$/m,s=function(){function t(t){this.xhrSetup=void 0,this.requestTimeout=void 0,this.retryTimeout=void 0,this.retryDelay=void 0,this.config=null,this.callbacks=null,this.context=void 0,this.loader=null,this.stats=void 0,this.xhrSetup=t?t.xhrSetup:null,this.stats=new n.LoadStats,this.retryDelay=0}var e=t.prototype;return e.destroy=function(){this.callbacks=null,this.abortInternal(),this.loader=null,this.config=null},e.abortInternal=function(){var t=this.loader;self.clearTimeout(this.requestTimeout),self.clearTimeout(this.retryTimeout),t&&(t.onreadystatechange=null,t.onprogress=null,4!==t.readyState&&(this.stats.aborted=!0,t.abort()))},e.abort=function(){var t;this.abortInternal(),null!==(t=this.callbacks)&&void 0!==t&&t.onAbort&&this.callbacks.onAbort(this.stats,this.context,this.loader)},e.load=function(t,e,i){if(this.stats.loading.start)throw new Error("Loader can only be used once.");this.stats.loading.start=self.performance.now(),this.context=t,this.config=e,this.callbacks=i,this.retryDelay=e.retryDelay,this.loadInternal()},e.loadInternal=function(){var t=this.config,e=this.context;if(t){var i=this.loader=new self.XMLHttpRequest,r=this.stats;r.loading.first=0,r.loaded=0;var n=this.xhrSetup;try{if(n)try{n(i,e.url)}catch(t){i.open("GET",e.url,!0),n(i,e.url)}i.readyState||i.open("GET",e.url,!0);var a=this.context.headers;if(a)for(var s in a)i.setRequestHeader(s,a[s])}catch(t){return void this.callbacks.onError({code:i.status,text:t.message},e,i)}e.rangeEnd&&i.setRequestHeader("Range","bytes="+e.rangeStart+"-"+(e.rangeEnd-1)),i.onreadystatechange=this.readystatechange.bind(this),i.onprogress=this.loadprogress.bind(this),i.responseType=e.responseType,self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),t.timeout),i.send()}},e.readystatechange=function(){var t=this.context,e=this.loader,i=this.stats;if(t&&e){var n=e.readyState,a=this.config;if(!i.aborted&&n>=2)if(self.clearTimeout(this.requestTimeout),0===i.loading.first&&(i.loading.first=Math.max(self.performance.now(),i.loading.start)),4===n){e.onreadystatechange=null,e.onprogress=null;var s=e.status;if(s>=200&&s<300){var o,l;if(i.loading.end=Math.max(self.performance.now(),i.loading.first),l="arraybuffer"===t.responseType?(o=e.response).byteLength:(o=e.responseText).length,i.loaded=i.total=l,!this.callbacks)return;var c=this.callbacks.onProgress;if(c&&c(i,t,o,e),!this.callbacks)return;var d={url:e.responseURL,data:o};this.callbacks.onSuccess(d,i,t,e)}else i.retry>=a.maxRetry||s>=400&&s<499?(r.logger.error(s+" while loading "+t.url),this.callbacks.onError({code:s,text:e.statusText},t,e)):(r.logger.warn(s+" while loading "+t.url+", retrying in "+this.retryDelay+"..."),this.abortInternal(),this.loader=null,self.clearTimeout(this.retryTimeout),this.retryTimeout=self.setTimeout(this.loadInternal.bind(this),this.retryDelay),this.retryDelay=Math.min(2*this.retryDelay,a.maxRetryDelay),i.retry++)}else self.clearTimeout(this.requestTimeout),this.requestTimeout=self.setTimeout(this.loadtimeout.bind(this),a.timeout)}},e.loadtimeout=function(){r.logger.warn("timeout while loading "+this.context.url);var t=this.callbacks;t&&(this.abortInternal(),t.onTimeout(this.stats,this.context,this.loader))},e.loadprogress=function(t){var e=this.stats;e.loaded=t.loaded,t.lengthComputable&&(e.total=t.total)},e.getCacheAge=function(){var t=null;if(this.loader&&a.test(this.loader.getAllResponseHeaders())){var e=this.loader.getResponseHeader("age");t=e?parseFloat(e):null}return t},t}();e.default=s}}).default},t.exports=e())},6820:function(t,e,i){var r;t=i.nmd(t),function(){var n,a="Expected a function",s="__lodash_hash_undefined__",o="__lodash_placeholder__",l=32,c=128,d=1/0,u=9007199254740991,h=NaN,p=4294967295,g=[["ary",c],["bind",1],["bindKey",2],["curry",8],["curryRight",16],["flip",512],["partial",l],["partialRight",64],["rearg",256]],f="[object Arguments]",m="[object Array]",v="[object Boolean]",y="[object Date]",A="[object Error]",b="[object Function]",_="[object GeneratorFunction]",w="[object Map]",C="[object Number]",E="[object Object]",T="[object Promise]",I="[object RegExp]",S="[object Set]",x="[object String]",k="[object Symbol]",P="[object WeakMap]",D="[object ArrayBuffer]",L="[object DataView]",B="[object Float32Array]",O="[object Float64Array]",R="[object Int8Array]",M="[object Int16Array]",N="[object Int32Array]",F="[object Uint8Array]",U="[object Uint8ClampedArray]",V="[object Uint16Array]",j="[object Uint32Array]",Q=/\b__p \+= '';/g,G=/\b(__p \+=) '' \+/g,H=/(__e\(.*?\)|\b__t\)) \+\n'';/g,W=/&(?:amp|lt|gt|quot|#39);/g,z=/[&<>"']/g,K=RegExp(W.source),q=RegExp(z.source),Y=/<%-([\s\S]+?)%>/g,J=/<%([\s\S]+?)%>/g,X=/<%=([\s\S]+?)%>/g,$=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Z=/^\w*$/,tt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,et=/[\\^$.*+?()[\]{}|]/g,it=RegExp(et.source),rt=/^\s+/,nt=/\s/,at=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,st=/\{\n\/\* \[wrapped with (.+)\] \*/,ot=/,? & /,lt=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,ct=/[()=,{}\[\]\/\s]/,dt=/\\(\\)?/g,ut=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,ht=/\w*$/,pt=/^[-+]0x[0-9a-f]+$/i,gt=/^0b[01]+$/i,ft=/^\[object .+?Constructor\]$/,mt=/^0o[0-7]+$/i,vt=/^(?:0|[1-9]\d*)$/,yt=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,At=/($^)/,bt=/['\n\r\u2028\u2029\\]/g,_t="\\ud800-\\udfff",wt="\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff",Ct="\\u2700-\\u27bf",Et="a-z\\xdf-\\xf6\\xf8-\\xff",Tt="A-Z\\xc0-\\xd6\\xd8-\\xde",It="\\ufe0e\\ufe0f",St="\\xac\\xb1\\xd7\\xf7\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf\\u2000-\\u206f \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",xt="["+_t+"]",kt="["+St+"]",Pt="["+wt+"]",Dt="\\d+",Lt="["+Ct+"]",Bt="["+Et+"]",Ot="[^"+_t+St+Dt+Ct+Et+Tt+"]",Rt="\\ud83c[\\udffb-\\udfff]",Mt="[^"+_t+"]",Nt="(?:\\ud83c[\\udde6-\\uddff]){2}",Ft="[\\ud800-\\udbff][\\udc00-\\udfff]",Ut="["+Tt+"]",Vt="\\u200d",jt="(?:"+Bt+"|"+Ot+")",Qt="(?:"+Ut+"|"+Ot+")",Gt="(?:['’](?:d|ll|m|re|s|t|ve))?",Ht="(?:['’](?:D|LL|M|RE|S|T|VE))?",Wt="(?:"+Pt+"|"+Rt+")?",zt="["+It+"]?",Kt=zt+Wt+"(?:"+Vt+"(?:"+[Mt,Nt,Ft].join("|")+")"+zt+Wt+")*",qt="(?:"+[Lt,Nt,Ft].join("|")+")"+Kt,Yt="(?:"+[Mt+Pt+"?",Pt,Nt,Ft,xt].join("|")+")",Jt=RegExp("['’]","g"),Xt=RegExp(Pt,"g"),$t=RegExp(Rt+"(?="+Rt+")|"+Yt+Kt,"g"),Zt=RegExp([Ut+"?"+Bt+"+"+Gt+"(?="+[kt,Ut,"$"].join("|")+")",Qt+"+"+Ht+"(?="+[kt,Ut+jt,"$"].join("|")+")",Ut+"?"+jt+"+"+Gt,Ut+"+"+Ht,"\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])","\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",Dt,qt].join("|"),"g"),te=RegExp("["+Vt+_t+wt+It+"]"),ee=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,ie=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],re=-1,ne={};ne[B]=ne[O]=ne[R]=ne[M]=ne[N]=ne[F]=ne[U]=ne[V]=ne[j]=!0,ne[f]=ne[m]=ne[D]=ne[v]=ne[L]=ne[y]=ne[A]=ne[b]=ne[w]=ne[C]=ne[E]=ne[I]=ne[S]=ne[x]=ne[P]=!1;var ae={};ae[f]=ae[m]=ae[D]=ae[L]=ae[v]=ae[y]=ae[B]=ae[O]=ae[R]=ae[M]=ae[N]=ae[w]=ae[C]=ae[E]=ae[I]=ae[S]=ae[x]=ae[k]=ae[F]=ae[U]=ae[V]=ae[j]=!0,ae[A]=ae[b]=ae[P]=!1;var se={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},oe=parseFloat,le=parseInt,ce="object"==typeof i.g&&i.g&&i.g.Object===Object&&i.g,de="object"==typeof self&&self&&self.Object===Object&&self,ue=ce||de||Function("return this")(),he=e&&!e.nodeType&&e,pe=he&&t&&!t.nodeType&&t,ge=pe&&pe.exports===he,fe=ge&&ce.process,me=function(){try{return pe&&pe.require&&pe.require("util").types||fe&&fe.binding&&fe.binding("util")}catch(t){}}(),ve=me&&me.isArrayBuffer,ye=me&&me.isDate,Ae=me&&me.isMap,be=me&&me.isRegExp,_e=me&&me.isSet,we=me&&me.isTypedArray;function Ce(t,e,i){switch(i.length){case 0:return t.call(e);case 1:return t.call(e,i[0]);case 2:return t.call(e,i[0],i[1]);case 3:return t.call(e,i[0],i[1],i[2])}return t.apply(e,i)}function Ee(t,e,i,r){for(var n=-1,a=null==t?0:t.length;++n-1}function Pe(t,e,i){for(var r=-1,n=null==t?0:t.length;++r-1;);return i}function Ze(t,e){for(var i=t.length;i--&&Ue(e,t[i],0)>-1;);return i}var ti=He({"À":"A","Á":"A","Â":"A","Ã":"A","Ä":"A","Å":"A","à":"a","á":"a","â":"a","ã":"a","ä":"a","å":"a","Ç":"C","ç":"c","Ð":"D","ð":"d","È":"E","É":"E","Ê":"E","Ë":"E","è":"e","é":"e","ê":"e","ë":"e","Ì":"I","Í":"I","Î":"I","Ï":"I","ì":"i","í":"i","î":"i","ï":"i","Ñ":"N","ñ":"n","Ò":"O","Ó":"O","Ô":"O","Õ":"O","Ö":"O","Ø":"O","ò":"o","ó":"o","ô":"o","õ":"o","ö":"o","ø":"o","Ù":"U","Ú":"U","Û":"U","Ü":"U","ù":"u","ú":"u","û":"u","ü":"u","Ý":"Y","ý":"y","ÿ":"y","Æ":"Ae","æ":"ae","Þ":"Th","þ":"th","ß":"ss","Ā":"A","Ă":"A","Ą":"A","ā":"a","ă":"a","ą":"a","Ć":"C","Ĉ":"C","Ċ":"C","Č":"C","ć":"c","ĉ":"c","ċ":"c","č":"c","Ď":"D","Đ":"D","ď":"d","đ":"d","Ē":"E","Ĕ":"E","Ė":"E","Ę":"E","Ě":"E","ē":"e","ĕ":"e","ė":"e","ę":"e","ě":"e","Ĝ":"G","Ğ":"G","Ġ":"G","Ģ":"G","ĝ":"g","ğ":"g","ġ":"g","ģ":"g","Ĥ":"H","Ħ":"H","ĥ":"h","ħ":"h","Ĩ":"I","Ī":"I","Ĭ":"I","Į":"I","İ":"I","ĩ":"i","ī":"i","ĭ":"i","į":"i","ı":"i","Ĵ":"J","ĵ":"j","Ķ":"K","ķ":"k","ĸ":"k","Ĺ":"L","Ļ":"L","Ľ":"L","Ŀ":"L","Ł":"L","ĺ":"l","ļ":"l","ľ":"l","ŀ":"l","ł":"l","Ń":"N","Ņ":"N","Ň":"N","Ŋ":"N","ń":"n","ņ":"n","ň":"n","ŋ":"n","Ō":"O","Ŏ":"O","Ő":"O","ō":"o","ŏ":"o","ő":"o","Ŕ":"R","Ŗ":"R","Ř":"R","ŕ":"r","ŗ":"r","ř":"r","Ś":"S","Ŝ":"S","Ş":"S","Š":"S","ś":"s","ŝ":"s","ş":"s","š":"s","Ţ":"T","Ť":"T","Ŧ":"T","ţ":"t","ť":"t","ŧ":"t","Ũ":"U","Ū":"U","Ŭ":"U","Ů":"U","Ű":"U","Ų":"U","ũ":"u","ū":"u","ŭ":"u","ů":"u","ű":"u","ų":"u","Ŵ":"W","ŵ":"w","Ŷ":"Y","ŷ":"y","Ÿ":"Y","Ź":"Z","Ż":"Z","Ž":"Z","ź":"z","ż":"z","ž":"z","IJ":"IJ","ij":"ij","Œ":"Oe","œ":"oe","ʼn":"'n","ſ":"s"}),ei=He({"&":"&","<":"<",">":">",'"':""","'":"'"});function ii(t){return"\\"+se[t]}function ri(t){return te.test(t)}function ni(t){var e=-1,i=Array(t.size);return t.forEach((function(t,r){i[++e]=[r,t]})),i}function ai(t,e){return function(i){return t(e(i))}}function si(t,e){for(var i=-1,r=t.length,n=0,a=[];++i",""":'"',"'":"'"}),pi=function t(e){var i,r=(e=null==e?ue:pi.defaults(ue.Object(),e,pi.pick(ue,ie))).Array,nt=e.Date,_t=e.Error,wt=e.Function,Ct=e.Math,Et=e.Object,Tt=e.RegExp,It=e.String,St=e.TypeError,xt=r.prototype,kt=wt.prototype,Pt=Et.prototype,Dt=e["__core-js_shared__"],Lt=kt.toString,Bt=Pt.hasOwnProperty,Ot=0,Rt=(i=/[^.]+$/.exec(Dt&&Dt.keys&&Dt.keys.IE_PROTO||""))?"Symbol(src)_1."+i:"",Mt=Pt.toString,Nt=Lt.call(Et),Ft=ue._,Ut=Tt("^"+Lt.call(Bt).replace(et,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Vt=ge?e.Buffer:n,jt=e.Symbol,Qt=e.Uint8Array,Gt=Vt?Vt.allocUnsafe:n,Ht=ai(Et.getPrototypeOf,Et),Wt=Et.create,zt=Pt.propertyIsEnumerable,Kt=xt.splice,qt=jt?jt.isConcatSpreadable:n,Yt=jt?jt.iterator:n,$t=jt?jt.toStringTag:n,te=function(){try{var t=la(Et,"defineProperty");return t({},"",{}),t}catch(t){}}(),se=e.clearTimeout!==ue.clearTimeout&&e.clearTimeout,ce=nt&&nt.now!==ue.Date.now&&nt.now,de=e.setTimeout!==ue.setTimeout&&e.setTimeout,he=Ct.ceil,pe=Ct.floor,fe=Et.getOwnPropertySymbols,me=Vt?Vt.isBuffer:n,Me=e.isFinite,He=xt.join,gi=ai(Et.keys,Et),fi=Ct.max,mi=Ct.min,vi=nt.now,yi=e.parseInt,Ai=Ct.random,bi=xt.reverse,_i=la(e,"DataView"),wi=la(e,"Map"),Ci=la(e,"Promise"),Ei=la(e,"Set"),Ti=la(e,"WeakMap"),Ii=la(Et,"create"),Si=Ti&&new Ti,xi={},ki=Ma(_i),Pi=Ma(wi),Di=Ma(Ci),Li=Ma(Ei),Bi=Ma(Ti),Oi=jt?jt.prototype:n,Ri=Oi?Oi.valueOf:n,Mi=Oi?Oi.toString:n;function Ni(t){if(Zs(t)&&!Qs(t)&&!(t instanceof ji)){if(t instanceof Vi)return t;if(Bt.call(t,"__wrapped__"))return Na(t)}return new Vi(t)}var Fi=function(){function t(){}return function(e){if(!$s(e))return{};if(Wt)return Wt(e);t.prototype=e;var i=new t;return t.prototype=n,i}}();function Ui(){}function Vi(t,e){this.__wrapped__=t,this.__actions__=[],this.__chain__=!!e,this.__index__=0,this.__values__=n}function ji(t){this.__wrapped__=t,this.__actions__=[],this.__dir__=1,this.__filtered__=!1,this.__iteratees__=[],this.__takeCount__=p,this.__views__=[]}function Qi(t){var e=-1,i=null==t?0:t.length;for(this.clear();++e=e?t:e)),t}function ar(t,e,i,r,a,s){var o,l=1&e,c=2&e,d=4&e;if(i&&(o=a?i(t,r,a,s):i(t)),o!==n)return o;if(!$s(t))return t;var u=Qs(t);if(u){if(o=function(t){var e=t.length,i=new t.constructor(e);return e&&"string"==typeof t[0]&&Bt.call(t,"index")&&(i.index=t.index,i.input=t.input),i}(t),!l)return In(t,o)}else{var h=ua(t),p=h==b||h==_;if(zs(t))return bn(t,l);if(h==E||h==f||p&&!a){if(o=c||p?{}:pa(t),!l)return c?function(t,e){return Sn(t,da(t),e)}(t,function(t,e){return t&&Sn(e,Do(e),t)}(o,t)):function(t,e){return Sn(t,ca(t),e)}(t,er(o,t))}else{if(!ae[h])return a?t:{};o=function(t,e,i){var r,n=t.constructor;switch(e){case D:return _n(t);case v:case y:return new n(+t);case L:return function(t,e){var i=e?_n(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.byteLength)}(t,i);case B:case O:case R:case M:case N:case F:case U:case V:case j:return wn(t,i);case w:return new n;case C:case x:return new n(t);case I:return function(t){var e=new t.constructor(t.source,ht.exec(t));return e.lastIndex=t.lastIndex,e}(t);case S:return new n;case k:return r=t,Ri?Et(Ri.call(r)):{}}}(t,h,l)}}s||(s=new zi);var g=s.get(t);if(g)return g;s.set(t,o),no(t)?t.forEach((function(r){o.add(ar(r,e,i,r,t,s))})):to(t)&&t.forEach((function(r,n){o.set(n,ar(r,e,i,n,t,s))}));var m=u?n:(d?c?ea:ta:c?Do:Po)(t);return Te(m||t,(function(r,n){m&&(r=t[n=r]),$i(o,n,ar(r,e,i,n,t,s))})),o}function sr(t,e,i){var r=i.length;if(null==t)return!r;for(t=Et(t);r--;){var a=i[r],s=e[a],o=t[a];if(o===n&&!(a in t)||!s(o))return!1}return!0}function or(t,e,i){if("function"!=typeof t)throw new St(a);return Sa((function(){t.apply(n,i)}),e)}function lr(t,e,i,r){var n=-1,a=ke,s=!0,o=t.length,l=[],c=e.length;if(!o)return l;i&&(e=De(e,Ye(i))),r?(a=Pe,s=!1):e.length>=200&&(a=Xe,s=!1,e=new Wi(e));t:for(;++n-1},Gi.prototype.set=function(t,e){var i=this.__data__,r=Zi(i,t);return r<0?(++this.size,i.push([t,e])):i[r][1]=e,this},Hi.prototype.clear=function(){this.size=0,this.__data__={hash:new Qi,map:new(wi||Gi),string:new Qi}},Hi.prototype.delete=function(t){var e=sa(this,t).delete(t);return this.size-=e?1:0,e},Hi.prototype.get=function(t){return sa(this,t).get(t)},Hi.prototype.has=function(t){return sa(this,t).has(t)},Hi.prototype.set=function(t,e){var i=sa(this,t),r=i.size;return i.set(t,e),this.size+=i.size==r?0:1,this},Wi.prototype.add=Wi.prototype.push=function(t){return this.__data__.set(t,s),this},Wi.prototype.has=function(t){return this.__data__.has(t)},zi.prototype.clear=function(){this.__data__=new Gi,this.size=0},zi.prototype.delete=function(t){var e=this.__data__,i=e.delete(t);return this.size=e.size,i},zi.prototype.get=function(t){return this.__data__.get(t)},zi.prototype.has=function(t){return this.__data__.has(t)},zi.prototype.set=function(t,e){var i=this.__data__;if(i instanceof Gi){var r=i.__data__;if(!wi||r.length<199)return r.push([t,e]),this.size=++i.size,this;i=this.__data__=new Hi(r)}return i.set(t,e),this.size=i.size,this};var cr=Pn(vr),dr=Pn(yr,!0);function ur(t,e){var i=!0;return cr(t,(function(t,r,n){return i=!!e(t,r,n)})),i}function hr(t,e,i){for(var r=-1,a=t.length;++r0&&i(o)?e>1?gr(o,e-1,i,r,n):Le(n,o):r||(n[n.length]=o)}return n}var fr=Dn(),mr=Dn(!0);function vr(t,e){return t&&fr(t,e,Po)}function yr(t,e){return t&&mr(t,e,Po)}function Ar(t,e){return xe(e,(function(e){return Ys(t[e])}))}function br(t,e){for(var i=0,r=(e=mn(e,t)).length;null!=t&&ie}function Er(t,e){return null!=t&&Bt.call(t,e)}function Tr(t,e){return null!=t&&e in Et(t)}function Ir(t,e,i){for(var a=i?Pe:ke,s=t[0].length,o=t.length,l=o,c=r(o),d=1/0,u=[];l--;){var h=t[l];l&&e&&(h=De(h,Ye(e))),d=mi(h.length,d),c[l]=!i&&(e||s>=120&&h.length>=120)?new Wi(l&&h):n}h=t[0];var p=-1,g=c[0];t:for(;++p=o?l:l*("desc"==i[r]?-1:1)}return t.index-e.index}(t,e,i)}));r--;)t[r]=t[r].value;return t}(n)}function jr(t,e,i){for(var r=-1,n=e.length,a={};++r-1;)o!==t&&Kt.call(o,l,1),Kt.call(t,l,1);return t}function Gr(t,e){for(var i=t?e.length:0,r=i-1;i--;){var n=e[i];if(i==r||n!==a){var a=n;fa(n)?Kt.call(t,n,1):ln(t,n)}}return t}function Hr(t,e){return t+pe(Ai()*(e-t+1))}function Wr(t,e){var i="";if(!t||e<1||e>u)return i;do{e%2&&(i+=t),(e=pe(e/2))&&(t+=t)}while(e);return i}function zr(t,e){return xa(Ca(t,e,il),t+"")}function Kr(t){return qi(Uo(t))}function qr(t,e){var i=Uo(t);return Da(i,nr(e,0,i.length))}function Yr(t,e,i,r){if(!$s(t))return t;for(var a=-1,s=(e=mn(e,t)).length,o=s-1,l=t;null!=l&&++aa?0:a+e),(i=i>a?a:i)<0&&(i+=a),a=e>i?0:i-e>>>0,e>>>=0;for(var s=r(a);++n>>1,s=t[a];null!==s&&!so(s)&&(i?s<=e:s=200){var c=e?null:zn(t);if(c)return oi(c);s=!1,n=Xe,l=new Wi}else l=e?[]:o;t:for(;++r=r?t:Zr(t,e,i)}var An=se||function(t){return ue.clearTimeout(t)};function bn(t,e){if(e)return t.slice();var i=t.length,r=Gt?Gt(i):new t.constructor(i);return t.copy(r),r}function _n(t){var e=new t.constructor(t.byteLength);return new Qt(e).set(new Qt(t)),e}function wn(t,e){var i=e?_n(t.buffer):t.buffer;return new t.constructor(i,t.byteOffset,t.length)}function Cn(t,e){if(t!==e){var i=t!==n,r=null===t,a=t==t,s=so(t),o=e!==n,l=null===e,c=e==e,d=so(e);if(!l&&!d&&!s&&t>e||s&&o&&c&&!l&&!d||r&&o&&c||!i&&c||!a)return 1;if(!r&&!s&&!d&&t1?i[a-1]:n,o=a>2?i[2]:n;for(s=t.length>3&&"function"==typeof s?(a--,s):n,o&&ma(i[0],i[1],o)&&(s=a<3?n:s,a=1),e=Et(e);++r-1?a[s?e[o]:o]:n}}function Mn(t){return Zn((function(e){var i=e.length,r=i,s=Vi.prototype.thru;for(t&&e.reverse();r--;){var o=e[r];if("function"!=typeof o)throw new St(a);if(s&&!l&&"wrapper"==ra(o))var l=new Vi([],!0)}for(r=l?r:i;++r1&&b.reverse(),p&&ul))return!1;var d=s.get(t),u=s.get(e);if(d&&u)return d==e&&u==t;var h=-1,p=!0,g=2&i?new Wi:n;for(s.set(t,e),s.set(e,t);++h-1&&t%1==0&&t1?"& ":"")+e[r],e=e.join(i>2?", ":" "),t.replace(at,"{\n/* [wrapped with "+e+"] */\n")}(r,function(t,e){return Te(g,(function(i){var r="_."+i[0];e&i[1]&&!ke(t,r)&&t.push(r)})),t.sort()}(function(t){var e=t.match(st);return e?e[1].split(ot):[]}(r),i)))}function Pa(t){var e=0,i=0;return function(){var r=vi(),a=16-(r-i);if(i=r,a>0){if(++e>=800)return arguments[0]}else e=0;return t.apply(n,arguments)}}function Da(t,e){var i=-1,r=t.length,a=r-1;for(e=e===n?r:e;++i1?t[e-1]:n;return i="function"==typeof i?(t.pop(),i):n,rs(t,i)}));function ds(t){var e=Ni(t);return e.__chain__=!0,e}function us(t,e){return e(t)}var hs=Zn((function(t){var e=t.length,i=e?t[0]:0,r=this.__wrapped__,a=function(e){return rr(e,t)};return!(e>1||this.__actions__.length)&&r instanceof ji&&fa(i)?((r=r.slice(i,+i+(e?1:0))).__actions__.push({func:us,args:[a],thisArg:n}),new Vi(r,this.__chain__).thru((function(t){return e&&!t.length&&t.push(n),t}))):this.thru(a)})),ps=xn((function(t,e,i){Bt.call(t,i)?++t[i]:ir(t,i,1)})),gs=Rn(ja),fs=Rn(Qa);function ms(t,e){return(Qs(t)?Te:cr)(t,aa(e,3))}function vs(t,e){return(Qs(t)?Ie:dr)(t,aa(e,3))}var ys=xn((function(t,e,i){Bt.call(t,i)?t[i].push(e):ir(t,i,[e])})),As=zr((function(t,e,i){var n=-1,a="function"==typeof e,s=Hs(t)?r(t.length):[];return cr(t,(function(t){s[++n]=a?Ce(e,t,i):Sr(t,e,i)})),s})),bs=xn((function(t,e,i){ir(t,i,e)}));function _s(t,e){return(Qs(t)?De:Rr)(t,aa(e,3))}var ws=xn((function(t,e,i){t[i?0:1].push(e)}),(function(){return[[],[]]})),Cs=zr((function(t,e){if(null==t)return[];var i=e.length;return i>1&&ma(t,e[0],e[1])?e=[]:i>2&&ma(e[0],e[1],e[2])&&(e=[e[0]]),Vr(t,gr(e,1),[])})),Es=ce||function(){return ue.Date.now()};function Ts(t,e,i){return e=i?n:e,e=t&&null==e?t.length:e,qn(t,c,n,n,n,n,e)}function Is(t,e){var i;if("function"!=typeof e)throw new St(a);return t=po(t),function(){return--t>0&&(i=e.apply(this,arguments)),t<=1&&(e=n),i}}var Ss=zr((function(t,e,i){var r=1;if(i.length){var n=si(i,na(Ss));r|=l}return qn(t,r,e,i,n)})),xs=zr((function(t,e,i){var r=3;if(i.length){var n=si(i,na(xs));r|=l}return qn(e,r,t,i,n)}));function ks(t,e,i){var r,s,o,l,c,d,u=0,h=!1,p=!1,g=!0;if("function"!=typeof t)throw new St(a);function f(e){var i=r,a=s;return r=s=n,u=e,l=t.apply(a,i)}function m(t){var i=t-d;return d===n||i>=e||i<0||p&&t-u>=o}function v(){var t=Es();if(m(t))return y(t);c=Sa(v,function(t){var i=e-(t-d);return p?mi(i,o-(t-u)):i}(t))}function y(t){return c=n,g&&r?f(t):(r=s=n,l)}function A(){var t=Es(),i=m(t);if(r=arguments,s=this,d=t,i){if(c===n)return function(t){return u=t,c=Sa(v,e),h?f(t):l}(d);if(p)return An(c),c=Sa(v,e),f(d)}return c===n&&(c=Sa(v,e)),l}return e=fo(e)||0,$s(i)&&(h=!!i.leading,o=(p="maxWait"in i)?fi(fo(i.maxWait)||0,e):o,g="trailing"in i?!!i.trailing:g),A.cancel=function(){c!==n&&An(c),u=0,r=d=s=c=n},A.flush=function(){return c===n?l:y(Es())},A}var Ps=zr((function(t,e){return or(t,1,e)})),Ds=zr((function(t,e,i){return or(t,fo(e)||0,i)}));function Ls(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new St(a);var i=function(){var r=arguments,n=e?e.apply(this,r):r[0],a=i.cache;if(a.has(n))return a.get(n);var s=t.apply(this,r);return i.cache=a.set(n,s)||a,s};return i.cache=new(Ls.Cache||Hi),i}function Bs(t){if("function"!=typeof t)throw new St(a);return function(){var e=arguments;switch(e.length){case 0:return!t.call(this);case 1:return!t.call(this,e[0]);case 2:return!t.call(this,e[0],e[1]);case 3:return!t.call(this,e[0],e[1],e[2])}return!t.apply(this,e)}}Ls.Cache=Hi;var Os=vn((function(t,e){var i=(e=1==e.length&&Qs(e[0])?De(e[0],Ye(aa())):De(gr(e,1),Ye(aa()))).length;return zr((function(r){for(var n=-1,a=mi(r.length,i);++n=e})),js=xr(function(){return arguments}())?xr:function(t){return Zs(t)&&Bt.call(t,"callee")&&!zt.call(t,"callee")},Qs=r.isArray,Gs=ve?Ye(ve):function(t){return Zs(t)&&wr(t)==D};function Hs(t){return null!=t&&Xs(t.length)&&!Ys(t)}function Ws(t){return Zs(t)&&Hs(t)}var zs=me||fl,Ks=ye?Ye(ye):function(t){return Zs(t)&&wr(t)==y};function qs(t){if(!Zs(t))return!1;var e=wr(t);return e==A||"[object DOMException]"==e||"string"==typeof t.message&&"string"==typeof t.name&&!io(t)}function Ys(t){if(!$s(t))return!1;var e=wr(t);return e==b||e==_||"[object AsyncFunction]"==e||"[object Proxy]"==e}function Js(t){return"number"==typeof t&&t==po(t)}function Xs(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=u}function $s(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}function Zs(t){return null!=t&&"object"==typeof t}var to=Ae?Ye(Ae):function(t){return Zs(t)&&ua(t)==w};function eo(t){return"number"==typeof t||Zs(t)&&wr(t)==C}function io(t){if(!Zs(t)||wr(t)!=E)return!1;var e=Ht(t);if(null===e)return!0;var i=Bt.call(e,"constructor")&&e.constructor;return"function"==typeof i&&i instanceof i&&Lt.call(i)==Nt}var ro=be?Ye(be):function(t){return Zs(t)&&wr(t)==I},no=_e?Ye(_e):function(t){return Zs(t)&&ua(t)==S};function ao(t){return"string"==typeof t||!Qs(t)&&Zs(t)&&wr(t)==x}function so(t){return"symbol"==typeof t||Zs(t)&&wr(t)==k}var oo=we?Ye(we):function(t){return Zs(t)&&Xs(t.length)&&!!ne[wr(t)]},lo=Gn(Or),co=Gn((function(t,e){return t<=e}));function uo(t){if(!t)return[];if(Hs(t))return ao(t)?di(t):In(t);if(Yt&&t[Yt])return function(t){for(var e,i=[];!(e=t.next()).done;)i.push(e.value);return i}(t[Yt]());var e=ua(t);return(e==w?ni:e==S?oi:Uo)(t)}function ho(t){return t?(t=fo(t))===d||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0}function po(t){var e=ho(t),i=e%1;return e==e?i?e-i:e:0}function go(t){return t?nr(po(t),0,p):0}function fo(t){if("number"==typeof t)return t;if(so(t))return h;if($s(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=$s(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=qe(t);var i=gt.test(t);return i||mt.test(t)?le(t.slice(2),i?2:8):pt.test(t)?h:+t}function mo(t){return Sn(t,Do(t))}function vo(t){return null==t?"":sn(t)}var yo=kn((function(t,e){if(ba(e)||Hs(e))Sn(e,Po(e),t);else for(var i in e)Bt.call(e,i)&&$i(t,i,e[i])})),Ao=kn((function(t,e){Sn(e,Do(e),t)})),bo=kn((function(t,e,i,r){Sn(e,Do(e),t,r)})),_o=kn((function(t,e,i,r){Sn(e,Po(e),t,r)})),wo=Zn(rr),Co=zr((function(t,e){t=Et(t);var i=-1,r=e.length,a=r>2?e[2]:n;for(a&&ma(e[0],e[1],a)&&(r=1);++i1),e})),Sn(t,ea(t),i),r&&(i=ar(i,7,Xn));for(var n=e.length;n--;)ln(i,e[n]);return i})),Ro=Zn((function(t,e){return null==t?{}:function(t,e){return jr(t,e,(function(e,i){return Io(t,i)}))}(t,e)}));function Mo(t,e){if(null==t)return{};var i=De(ea(t),(function(t){return[t]}));return e=aa(e),jr(t,i,(function(t,i){return e(t,i[0])}))}var No=Kn(Po),Fo=Kn(Do);function Uo(t){return null==t?[]:Je(t,Po(t))}var Vo=Bn((function(t,e,i){return e=e.toLowerCase(),t+(i?jo(e):e)}));function jo(t){return Yo(vo(t).toLowerCase())}function Qo(t){return(t=vo(t))&&t.replace(yt,ti).replace(Xt,"")}var Go=Bn((function(t,e,i){return t+(i?"-":"")+e.toLowerCase()})),Ho=Bn((function(t,e,i){return t+(i?" ":"")+e.toLowerCase()})),Wo=Ln("toLowerCase"),zo=Bn((function(t,e,i){return t+(i?"_":"")+e.toLowerCase()})),Ko=Bn((function(t,e,i){return t+(i?" ":"")+Yo(e)})),qo=Bn((function(t,e,i){return t+(i?" ":"")+e.toUpperCase()})),Yo=Ln("toUpperCase");function Jo(t,e,i){return t=vo(t),(e=i?n:e)===n?function(t){return ee.test(t)}(t)?function(t){return t.match(Zt)||[]}(t):function(t){return t.match(lt)||[]}(t):t.match(e)||[]}var Xo=zr((function(t,e){try{return Ce(t,n,e)}catch(t){return qs(t)?t:new _t(t)}})),$o=Zn((function(t,e){return Te(e,(function(e){e=Ra(e),ir(t,e,Ss(t[e],t))})),t}));function Zo(t){return function(){return t}}var tl=Mn(),el=Mn(!0);function il(t){return t}function rl(t){return Lr("function"==typeof t?t:ar(t,1))}var nl=zr((function(t,e){return function(i){return Sr(i,t,e)}})),al=zr((function(t,e){return function(i){return Sr(t,i,e)}}));function sl(t,e,i){var r=Po(e),n=Ar(e,r);null!=i||$s(e)&&(n.length||!r.length)||(i=e,e=t,t=this,n=Ar(e,Po(e)));var a=!($s(i)&&"chain"in i&&!i.chain),s=Ys(t);return Te(n,(function(i){var r=e[i];t[i]=r,s&&(t.prototype[i]=function(){var e=this.__chain__;if(a||e){var i=t(this.__wrapped__);return(i.__actions__=In(this.__actions__)).push({func:r,args:arguments,thisArg:t}),i.__chain__=e,i}return r.apply(t,Le([this.value()],arguments))})})),t}function ol(){}var ll=Vn(De),cl=Vn(Se),dl=Vn(Re);function ul(t){return va(t)?Ge(Ra(t)):function(t){return function(e){return br(e,t)}}(t)}var hl=Qn(),pl=Qn(!0);function gl(){return[]}function fl(){return!1}var ml,vl=Un((function(t,e){return t+e}),0),yl=Wn("ceil"),Al=Un((function(t,e){return t/e}),1),bl=Wn("floor"),_l=Un((function(t,e){return t*e}),1),wl=Wn("round"),Cl=Un((function(t,e){return t-e}),0);return Ni.after=function(t,e){if("function"!=typeof e)throw new St(a);return t=po(t),function(){if(--t<1)return e.apply(this,arguments)}},Ni.ary=Ts,Ni.assign=yo,Ni.assignIn=Ao,Ni.assignInWith=bo,Ni.assignWith=_o,Ni.at=wo,Ni.before=Is,Ni.bind=Ss,Ni.bindAll=$o,Ni.bindKey=xs,Ni.castArray=function(){if(!arguments.length)return[];var t=arguments[0];return Qs(t)?t:[t]},Ni.chain=ds,Ni.chunk=function(t,e,i){e=(i?ma(t,e,i):e===n)?1:fi(po(e),0);var a=null==t?0:t.length;if(!a||e<1)return[];for(var s=0,o=0,l=r(he(a/e));sa?0:a+i),(r=r===n||r>a?a:po(r))<0&&(r+=a),r=i>r?0:go(r);i>>0)?(t=vo(t))&&("string"==typeof e||null!=e&&!ro(e))&&!(e=sn(e))&&ri(t)?yn(di(t),0,i):t.split(e,i):[]},Ni.spread=function(t,e){if("function"!=typeof t)throw new St(a);return e=null==e?0:fi(po(e),0),zr((function(i){var r=i[e],n=yn(i,0,e);return r&&Le(n,r),Ce(t,this,n)}))},Ni.tail=function(t){var e=null==t?0:t.length;return e?Zr(t,1,e):[]},Ni.take=function(t,e,i){return t&&t.length?Zr(t,0,(e=i||e===n?1:po(e))<0?0:e):[]},Ni.takeRight=function(t,e,i){var r=null==t?0:t.length;return r?Zr(t,(e=r-(e=i||e===n?1:po(e)))<0?0:e,r):[]},Ni.takeRightWhile=function(t,e){return t&&t.length?dn(t,aa(e,3),!1,!0):[]},Ni.takeWhile=function(t,e){return t&&t.length?dn(t,aa(e,3)):[]},Ni.tap=function(t,e){return e(t),t},Ni.throttle=function(t,e,i){var r=!0,n=!0;if("function"!=typeof t)throw new St(a);return $s(i)&&(r="leading"in i?!!i.leading:r,n="trailing"in i?!!i.trailing:n),ks(t,e,{leading:r,maxWait:e,trailing:n})},Ni.thru=us,Ni.toArray=uo,Ni.toPairs=No,Ni.toPairsIn=Fo,Ni.toPath=function(t){return Qs(t)?De(t,Ra):so(t)?[t]:In(Oa(vo(t)))},Ni.toPlainObject=mo,Ni.transform=function(t,e,i){var r=Qs(t),n=r||zs(t)||oo(t);if(e=aa(e,4),null==i){var a=t&&t.constructor;i=n?r?new a:[]:$s(t)&&Ys(a)?Fi(Ht(t)):{}}return(n?Te:vr)(t,(function(t,r,n){return e(i,t,r,n)})),i},Ni.unary=function(t){return Ts(t,1)},Ni.union=Za,Ni.unionBy=ts,Ni.unionWith=es,Ni.uniq=function(t){return t&&t.length?on(t):[]},Ni.uniqBy=function(t,e){return t&&t.length?on(t,aa(e,2)):[]},Ni.uniqWith=function(t,e){return e="function"==typeof e?e:n,t&&t.length?on(t,n,e):[]},Ni.unset=function(t,e){return null==t||ln(t,e)},Ni.unzip=is,Ni.unzipWith=rs,Ni.update=function(t,e,i){return null==t?t:cn(t,e,fn(i))},Ni.updateWith=function(t,e,i,r){return r="function"==typeof r?r:n,null==t?t:cn(t,e,fn(i),r)},Ni.values=Uo,Ni.valuesIn=function(t){return null==t?[]:Je(t,Do(t))},Ni.without=ns,Ni.words=Jo,Ni.wrap=function(t,e){return Rs(fn(e),t)},Ni.xor=as,Ni.xorBy=ss,Ni.xorWith=os,Ni.zip=ls,Ni.zipObject=function(t,e){return pn(t||[],e||[],$i)},Ni.zipObjectDeep=function(t,e){return pn(t||[],e||[],Yr)},Ni.zipWith=cs,Ni.entries=No,Ni.entriesIn=Fo,Ni.extend=Ao,Ni.extendWith=bo,sl(Ni,Ni),Ni.add=vl,Ni.attempt=Xo,Ni.camelCase=Vo,Ni.capitalize=jo,Ni.ceil=yl,Ni.clamp=function(t,e,i){return i===n&&(i=e,e=n),i!==n&&(i=(i=fo(i))==i?i:0),e!==n&&(e=(e=fo(e))==e?e:0),nr(fo(t),e,i)},Ni.clone=function(t){return ar(t,4)},Ni.cloneDeep=function(t){return ar(t,5)},Ni.cloneDeepWith=function(t,e){return ar(t,5,e="function"==typeof e?e:n)},Ni.cloneWith=function(t,e){return ar(t,4,e="function"==typeof e?e:n)},Ni.conformsTo=function(t,e){return null==e||sr(t,e,Po(e))},Ni.deburr=Qo,Ni.defaultTo=function(t,e){return null==t||t!=t?e:t},Ni.divide=Al,Ni.endsWith=function(t,e,i){t=vo(t),e=sn(e);var r=t.length,a=i=i===n?r:nr(po(i),0,r);return(i-=e.length)>=0&&t.slice(i,a)==e},Ni.eq=Fs,Ni.escape=function(t){return(t=vo(t))&&q.test(t)?t.replace(z,ei):t},Ni.escapeRegExp=function(t){return(t=vo(t))&&it.test(t)?t.replace(et,"\\$&"):t},Ni.every=function(t,e,i){var r=Qs(t)?Se:ur;return i&&ma(t,e,i)&&(e=n),r(t,aa(e,3))},Ni.find=gs,Ni.findIndex=ja,Ni.findKey=function(t,e){return Ne(t,aa(e,3),vr)},Ni.findLast=fs,Ni.findLastIndex=Qa,Ni.findLastKey=function(t,e){return Ne(t,aa(e,3),yr)},Ni.floor=bl,Ni.forEach=ms,Ni.forEachRight=vs,Ni.forIn=function(t,e){return null==t?t:fr(t,aa(e,3),Do)},Ni.forInRight=function(t,e){return null==t?t:mr(t,aa(e,3),Do)},Ni.forOwn=function(t,e){return t&&vr(t,aa(e,3))},Ni.forOwnRight=function(t,e){return t&&yr(t,aa(e,3))},Ni.get=To,Ni.gt=Us,Ni.gte=Vs,Ni.has=function(t,e){return null!=t&&ha(t,e,Er)},Ni.hasIn=Io,Ni.head=Ha,Ni.identity=il,Ni.includes=function(t,e,i,r){t=Hs(t)?t:Uo(t),i=i&&!r?po(i):0;var n=t.length;return i<0&&(i=fi(n+i,0)),ao(t)?i<=n&&t.indexOf(e,i)>-1:!!n&&Ue(t,e,i)>-1},Ni.indexOf=function(t,e,i){var r=null==t?0:t.length;if(!r)return-1;var n=null==i?0:po(i);return n<0&&(n=fi(r+n,0)),Ue(t,e,n)},Ni.inRange=function(t,e,i){return e=ho(e),i===n?(i=e,e=0):i=ho(i),function(t,e,i){return t>=mi(e,i)&&t=-9007199254740991&&t<=u},Ni.isSet=no,Ni.isString=ao,Ni.isSymbol=so,Ni.isTypedArray=oo,Ni.isUndefined=function(t){return t===n},Ni.isWeakMap=function(t){return Zs(t)&&ua(t)==P},Ni.isWeakSet=function(t){return Zs(t)&&"[object WeakSet]"==wr(t)},Ni.join=function(t,e){return null==t?"":He.call(t,e)},Ni.kebabCase=Go,Ni.last=qa,Ni.lastIndexOf=function(t,e,i){var r=null==t?0:t.length;if(!r)return-1;var a=r;return i!==n&&(a=(a=po(i))<0?fi(r+a,0):mi(a,r-1)),e==e?function(t,e,i){for(var r=i+1;r--;)if(t[r]===e)return r;return r}(t,e,a):Fe(t,je,a,!0)},Ni.lowerCase=Ho,Ni.lowerFirst=Wo,Ni.lt=lo,Ni.lte=co,Ni.max=function(t){return t&&t.length?hr(t,il,Cr):n},Ni.maxBy=function(t,e){return t&&t.length?hr(t,aa(e,2),Cr):n},Ni.mean=function(t){return Qe(t,il)},Ni.meanBy=function(t,e){return Qe(t,aa(e,2))},Ni.min=function(t){return t&&t.length?hr(t,il,Or):n},Ni.minBy=function(t,e){return t&&t.length?hr(t,aa(e,2),Or):n},Ni.stubArray=gl,Ni.stubFalse=fl,Ni.stubObject=function(){return{}},Ni.stubString=function(){return""},Ni.stubTrue=function(){return!0},Ni.multiply=_l,Ni.nth=function(t,e){return t&&t.length?Ur(t,po(e)):n},Ni.noConflict=function(){return ue._===this&&(ue._=Ft),this},Ni.noop=ol,Ni.now=Es,Ni.pad=function(t,e,i){t=vo(t);var r=(e=po(e))?ci(t):0;if(!e||r>=e)return t;var n=(e-r)/2;return jn(pe(n),i)+t+jn(he(n),i)},Ni.padEnd=function(t,e,i){t=vo(t);var r=(e=po(e))?ci(t):0;return e&&re){var r=t;t=e,e=r}if(i||t%1||e%1){var a=Ai();return mi(t+a*(e-t+oe("1e-"+((a+"").length-1))),e)}return Hr(t,e)},Ni.reduce=function(t,e,i){var r=Qs(t)?Be:We,n=arguments.length<3;return r(t,aa(e,4),i,n,cr)},Ni.reduceRight=function(t,e,i){var r=Qs(t)?Oe:We,n=arguments.length<3;return r(t,aa(e,4),i,n,dr)},Ni.repeat=function(t,e,i){return e=(i?ma(t,e,i):e===n)?1:po(e),Wr(vo(t),e)},Ni.replace=function(){var t=arguments,e=vo(t[0]);return t.length<3?e:e.replace(t[1],t[2])},Ni.result=function(t,e,i){var r=-1,a=(e=mn(e,t)).length;for(a||(a=1,t=n);++ru)return[];var i=p,r=mi(t,p);e=aa(e),t-=p;for(var n=Ke(r,e);++i=s)return t;var l=i-ci(r);if(l<1)return r;var c=o?yn(o,0,l).join(""):t.slice(0,l);if(a===n)return c+r;if(o&&(l+=c.length-l),ro(a)){if(t.slice(l).search(a)){var d,u=c;for(a.global||(a=Tt(a.source,vo(ht.exec(a))+"g")),a.lastIndex=0;d=a.exec(u);)var h=d.index;c=c.slice(0,h===n?l:h)}}else if(t.indexOf(sn(a),l)!=l){var p=c.lastIndexOf(a);p>-1&&(c=c.slice(0,p))}return c+r},Ni.unescape=function(t){return(t=vo(t))&&K.test(t)?t.replace(W,hi):t},Ni.uniqueId=function(t){var e=++Ot;return vo(t)+e},Ni.upperCase=qo,Ni.upperFirst=Yo,Ni.each=ms,Ni.eachRight=vs,Ni.first=Ha,sl(Ni,(ml={},vr(Ni,(function(t,e){Bt.call(Ni.prototype,e)||(ml[e]=t)})),ml),{chain:!1}),Ni.VERSION="4.17.21",Te(["bind","bindKey","curry","curryRight","partial","partialRight"],(function(t){Ni[t].placeholder=Ni})),Te(["drop","take"],(function(t,e){ji.prototype[t]=function(i){i=i===n?1:fi(po(i),0);var r=this.__filtered__&&!e?new ji(this):this.clone();return r.__filtered__?r.__takeCount__=mi(i,r.__takeCount__):r.__views__.push({size:mi(i,p),type:t+(r.__dir__<0?"Right":"")}),r},ji.prototype[t+"Right"]=function(e){return this.reverse()[t](e).reverse()}})),Te(["filter","map","takeWhile"],(function(t,e){var i=e+1,r=1==i||3==i;ji.prototype[t]=function(t){var e=this.clone();return e.__iteratees__.push({iteratee:aa(t,3),type:i}),e.__filtered__=e.__filtered__||r,e}})),Te(["head","last"],(function(t,e){var i="take"+(e?"Right":"");ji.prototype[t]=function(){return this[i](1).value()[0]}})),Te(["initial","tail"],(function(t,e){var i="drop"+(e?"":"Right");ji.prototype[t]=function(){return this.__filtered__?new ji(this):this[i](1)}})),ji.prototype.compact=function(){return this.filter(il)},ji.prototype.find=function(t){return this.filter(t).head()},ji.prototype.findLast=function(t){return this.reverse().find(t)},ji.prototype.invokeMap=zr((function(t,e){return"function"==typeof t?new ji(this):this.map((function(i){return Sr(i,t,e)}))})),ji.prototype.reject=function(t){return this.filter(Bs(aa(t)))},ji.prototype.slice=function(t,e){t=po(t);var i=this;return i.__filtered__&&(t>0||e<0)?new ji(i):(t<0?i=i.takeRight(-t):t&&(i=i.drop(t)),e!==n&&(i=(e=po(e))<0?i.dropRight(-e):i.take(e-t)),i)},ji.prototype.takeRightWhile=function(t){return this.reverse().takeWhile(t).reverse()},ji.prototype.toArray=function(){return this.take(p)},vr(ji.prototype,(function(t,e){var i=/^(?:filter|find|map|reject)|While$/.test(e),r=/^(?:head|last)$/.test(e),a=Ni[r?"take"+("last"==e?"Right":""):e],s=r||/^find/.test(e);a&&(Ni.prototype[e]=function(){var e=this.__wrapped__,o=r?[1]:arguments,l=e instanceof ji,c=o[0],d=l||Qs(e),u=function(t){var e=a.apply(Ni,Le([t],o));return r&&h?e[0]:e};d&&i&&"function"==typeof c&&1!=c.length&&(l=d=!1);var h=this.__chain__,p=!!this.__actions__.length,g=s&&!h,f=l&&!p;if(!s&&d){e=f?e:new ji(this);var m=t.apply(e,o);return m.__actions__.push({func:us,args:[u],thisArg:n}),new Vi(m,h)}return g&&f?t.apply(this,o):(m=this.thru(u),g?r?m.value()[0]:m.value():m)})})),Te(["pop","push","shift","sort","splice","unshift"],(function(t){var e=xt[t],i=/^(?:push|sort|unshift)$/.test(t)?"tap":"thru",r=/^(?:pop|shift)$/.test(t);Ni.prototype[t]=function(){var t=arguments;if(r&&!this.__chain__){var n=this.value();return e.apply(Qs(n)?n:[],t)}return this[i]((function(i){return e.apply(Qs(i)?i:[],t)}))}})),vr(ji.prototype,(function(t,e){var i=Ni[e];if(i){var r=i.name+"";Bt.call(xi,r)||(xi[r]=[]),xi[r].push({name:e,func:i})}})),xi[Nn(n,2).name]=[{name:"wrapper",func:n}],ji.prototype.clone=function(){var t=new ji(this.__wrapped__);return t.__actions__=In(this.__actions__),t.__dir__=this.__dir__,t.__filtered__=this.__filtered__,t.__iteratees__=In(this.__iteratees__),t.__takeCount__=this.__takeCount__,t.__views__=In(this.__views__),t},ji.prototype.reverse=function(){if(this.__filtered__){var t=new ji(this);t.__dir__=-1,t.__filtered__=!0}else(t=this.clone()).__dir__*=-1;return t},ji.prototype.value=function(){var t=this.__wrapped__.value(),e=this.__dir__,i=Qs(t),r=e<0,n=i?t.length:0,a=function(t,e,i){for(var r=-1,n=i.length;++r=this.__values__.length;return{done:t,value:t?n:this.__values__[this.__index__++]}},Ni.prototype.plant=function(t){for(var e,i=this;i instanceof Ui;){var r=Na(i);r.__index__=0,r.__values__=n,e?a.__wrapped__=r:e=r;var a=r;i=i.__wrapped__}return a.__wrapped__=t,e},Ni.prototype.reverse=function(){var t=this.__wrapped__;if(t instanceof ji){var e=t;return this.__actions__.length&&(e=new ji(this)),(e=e.reverse()).__actions__.push({func:us,args:[$a],thisArg:n}),new Vi(e,this.__chain__)}return this.thru($a)},Ni.prototype.toJSON=Ni.prototype.valueOf=Ni.prototype.value=function(){return un(this.__wrapped__,this.__actions__)},Ni.prototype.first=Ni.prototype.head,Yt&&(Ni.prototype[Yt]=function(){return this}),Ni}();ue._=pi,(r=function(){return pi}.call(e,i,e,t))===n||(t.exports=r)}.call(this)},3997:function(t){t.exports=function(){"use strict";function t(t,e){for(var i=0;i(i=100/l.width*(n.clientX-l.left))?i=0:100i?i-=(100-2*i)*c:50e){var i=function(t){var e="".concat(t).match(/(?:\.(\d+))?(?:[eE]([+-]?\d+))?$/);return e?Math.max(0,(e[1]?e[1].length:0)-(e[2]?+e[2]:0)):0}(e);return parseFloat(t.toFixed(i))}return Math.round(t/e)*e}(i/100*(s-a),o)}},{key:"set",value:function(t){e.enabled&&g(t)&&!t.target.disabled&&(t.preventDefault(),t.target.value=this.get(t),function(t,e){if(t&&e){var i=new Event(e,{bubbles:!0});t.dispatchEvent(i)}}(t.target,"touchend"===t.type?"change":"input"))}}])&&t(i.prototype,a),s&&t(i,s),e;var i,a,s}()}()},9829:function(t,e,i){t.exports=i(5002)},5002:function(t,e,i){const r=i(2035),n=i(6421),a=i(9518),{invalidGallerySelectors:s}=i(5276),o={};function l(t){if(r.nullOrUndefined(t))return!1;let e;for(let i=0;inull!=t?t.constructor:null,i=(t,e)=>Boolean(t&&e&&t instanceof e),r=t=>null==t,n=t=>e(t)===Object,a=t=>e(t)===String,s=t=>Array.isArray(t),o=t=>i(t,NodeList),l=t=>r(t)||(a(t)||s(t)||o(t))&&!t.length||n(t)&&!Object.keys(t).length;t.exports={nullOrUndefined:r,object:n,number:t=>e(t)===Number&&!Number.isNaN(t),string:a,boolean:t=>e(t)===Boolean,function:t=>e(t)===Function,array:s,weakMap:t=>i(t,WeakMap),nodeList:o,element:t=>i(t,Element),textNode:t=>e(t)===Text,event:t=>i(t,Event),keyboardEvent:t=>i(t,KeyboardEvent),cue:t=>i(t,window.TextTrackCue)||i(t,window.VTTCue),track:t=>i(t,TextTrack)||!r(t)&&a(t.kind),promise:t=>i(t,Promise),url:t=>{if(i(t,window.URL))return!0;if(!a(t))return!1;let e=t;t.startsWith("http://")&&t.startsWith("https://")||(e=`http://${t}`);try{return!l(new URL(e).hostname)}catch(t){return!1}},empty:l,zero:t=>a(t)?0===parseInt(t,10):0===t}},6421:function(t){const e=[".product-single__photos > .product-single__photo-wrapper","#productPhotoContainer-product-template",".photos__item--main","#ProductMediaGroup-product-template",".product-single__media-wrapper:not(.hide)",".product-single > .grid__item.large--seven-twelfths.medium--seven-twelfths.text-center",".product-single__photos",".product-gallery--viewer",".product-gallery .main",".theme-viewport",".Product__Slideshow > .Product__SlideItem",".flickity-viewport","#shopify-section-product-template .product-single .grid__item",'.product-single [id^="ProductImageWrapper"]',".product-image-container",".product-single__medias",".product-single__media",".featured-image-div",".product-image-viewer",".product-main-image",".product__slides",".product__photo",".product_gallery .flex-viewport",".product_gallery .slides",".product-single__photo .product-single__photo","#slider-product-template",".product__media-container",".product__image-wrapper",".featured-product__wrapper .featured-product__image-column",".featured-product__wrapper .featured-product__media-column",".product__main-photos",".product-slideshow-images",".thumbnails-swipper-container",".productImgSlider",".box__product-gallery",".product-gallery--slider",".product-page--image-container","figure.product-image",".product-images-inner",".image-layers",".product-big-image",".product-images .frame",".product-image--slider",".product-gallery .main",".product-gallery",".images-navigation ~ .images .cell",".theme-gallery",".product-photos .product-img-box",".product-photos",".product-page--media",".product-page--images-container",".product_gallery",".image--container",".main-image",".prd-block_main-image.main-image--slide.js-main-image--slide","#gl_thum",".product-images-static",".tt-product-single-img",".single-product-thumbnail.pr.bc_nt-p-item",".slick-slider",'div[data-section-id="product-template"][itemscope] .grid__item.one-half.small-down--one-whole',".product-image",".product-shot-product-template",'.product__image [id^="slider-"]',".primary-images","#main-image-gallery",".product__feature-image .responsive-image__wrapper",".productimages .main","#main-product-image-product-template",".product-detail .product-detail__images",".product__main-photos.aos-init.aos-animate","#productPhoto",".product-images .image.featured",".FeaturedProduct .FeaturedProduct__Gallery",".product_image_list_wrapper",".product-medias__main",".gallery__image-wrapper",".product-images.product-media","#ProductPhoto"],i=window.innerWidth||document.body.clientWidth;i<=768&&e.unshift("#shopify-section-product-template .product-single .grid__item.text-center.context.mobile--no-top-margin","#product-photo-container .flexsliders"),i<=798&&e.unshift(".medium-down--one-whole.omega .product_gallery"),t.exports=e},9518:function(t){window.innerWidth||document.body.clientWidth,t.exports=["[data-image-gallery]"]},3591:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,'.vimotia__modal-open{overflow:hidden}.vimotia__modal-open .vimotia__modal{overflow-x:hidden;overflow-y:auto;display:block}.vimotia__modal{position:fixed;top:0;left:0;z-index:2147483646;display:none;width:100%;height:100%;overflow:hidden;outline:0}.vimotia__modal.vimotia__modal-show{display:grid}.vimotia__modal-dialog{position:relative;width:auto;opacity:0;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .3s;pointer-events:none}.vimotia__modal-dialog.vimotia__modal-dialog--show{opacity:1}.vimotia__modal-dialog-centered{display:flex;align-items:center;justify-self:center}.vimotia__modal-dialog-centered::before{display:block;content:""}.vimotia__modal-content{position:relative;display:flex;flex-direction:column;width:100%;color:#222;pointer-events:auto;background-color:#fff;background-clip:padding-box;border:1px solid rgba(0,0,0,.2);border-radius:.3rem;outline:0}.vimotia__modal-backdrop{display:none;position:fixed;top:0;left:0;z-index:2147483645;width:100%;height:100%;background-color:#000;opacity:0;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s}.vimotia__modal-backdrop.vimotia__modal-fade{opacity:.5}.vimotia__modal-backdrop.vimotia__modal-show{display:block !important}.vimotia__modal-header{display:grid;grid-template-columns:46px 1fr 46px;align-items:center;padding:8px 16px;border-bottom:1px solid #dee2e6;border-top-left-radius:4px;border-top-right-radius:4px}@media(max-width: 599px){.vimotia__modal-header{padding:8px}}.vimotia__modal-btn{display:inline-block;font-weight:400;color:#212529;text-align:center;vertical-align:middle;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;background-color:rgba(0,0,0,0);border:1px solid rgba(0,0,0,0);padding:8px 12px;font-size:16px;line-height:1.5;border-radius:.25rem;transition:color .15s ease-in-out,background-color .15s ease-in-out,border-color .15s ease-in-out,box-shadow .15s ease-in-out;-webkit-appearance:button;text-transform:none;font-family:inherit;overflow:visible}.vimotia__modal-header-btn{color:#000;width:100%;min-width:auto;padding:12px;cursor:pointer;background-color:rgba(0,0,0,0);border:0;-webkit-appearance:none;-moz-appearance:none;appearance:none;display:grid;align-items:center;justify-content:center;box-sizing:border-box}.vimotia__modal-header-btn:hover{background:rgba(0,0,0,0)}.vimotia__modal-header-btn-icon{width:14px;height:14px;display:grid;align-items:center;justify-content:center}.vimotia__modal-header-btn-icon svg{width:100% !important;height:100% !important}.vimotia__modal-header-btn--left{opacity:0;pointer-events:none;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s}.vimotia__modal--show-left-btn .vimotia__modal-header-btn--left{opacity:1;pointer-events:unset}.vimotia__modal-title{display:block !important;margin-bottom:0;line-height:1.5;font-size:18px;font-family:inherit;text-align:center}.vimotia__modal-body{overflow:auto;position:relative;flex:1 1 auto;padding:32px}@media(max-width: 599px){.vimotia__modal-body{padding:12px}}.vimotia__modal-body.vimotia__modal-body--no-padding{padding:0}@media(max-width: 599px){.vimotia__modal-body.vimotia__modal-body--no-padding{padding:0}}.vimotia__modal-footer{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;padding:12px;border-top:1px solid #dee2e6;border-bottom-right-radius:calc(.3rem - 1px);border-bottom-left-radius:calc(.3rem - 1px)}.vimotia__modal-footer>*{margin:4px}@media(min-width: 576px){.vimotia__modal-dialog{width:500px}}.vimotia__modal-btn-primary{color:#fff;background-color:#5c6ac4;border-color:#202e78}.vimotia__modal-btn-secondary{color:#212b36;background-color:#f4f6f8;border-color:#dfe3e8}',""]),e.A=s},68:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-heading{padding:12px;text-align:left;font-size:var(--vimotia-heading-font-size, 16px);font-weight:var(--vimotia-heading-font-weight, 600);line-height:1.25;color:var(--vimotia-heading-text-color, #000000);background-color:var(--vimotia-heading-background-color, transparent)}.vimotia-heading:empty{display:none}",""]),e.A=s},2265:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-message{padding:8px 16px;border-radius:24px;font-size:14px;position:fixed;top:48px;left:50%;transform:translate(-50%, -48px);opacity:0;will-change:opacity,transform;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .3s;z-index:2147483647}.vimotia-message.vimotia-message--show{opacity:1;transform:translate(-50%, 0)}.vimotia-message--success{border:1px solid #95c9b4;background-color:#f1f8f5;color:#292929}.vimotia-message__inner{display:grid;grid-template-columns:12px 1fr;gap:12px;align-items:center}.vimotia-message__icon{position:relative;width:12px;height:12px}.vimotia-message__icon svg{width:100%;position:absolute;top:0}.vimotia-message__content{white-space:nowrap}",""]),e.A=s},7319:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-slider--pagination{--swiper-theme-color: hsl(211, 0%, 23%)}",""]),e.A=s},5069:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-thumbnail.vimotia-thumbnail--landscape{aspect-ratio:2/1}",""]),e.A=s},3569:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-thumbnail.vimotia-thumbnail--portrait{aspect-ratio:1/2}",""]),e.A=s},5975:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-thumbnail.vimotia-thumbnail--round{align-items:center;justify-items:center;border-radius:50%}.vimotia-thumbnail.vimotia-thumbnail--round .vimotia-thumbnail__inner{display:grid;grid-template-columns:1fr;gap:8px;align-items:center;justify-items:center}.vimotia-thumbnail.vimotia-thumbnail--round .vimotia-thumbnail__play-button{position:static;transform:translate(0, 0)}.vimotia-thumbnail.vimotia-thumbnail--round .vimotia-thumbnail__video-duration{position:static}.vimotia-thumbnail.vimotia-thumbnail--round .vimotia-heading{text-align:center}",""]),e.A=s},1533:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,"",""]),e.A=s},8808:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-thumbnail{display:grid;background-size:cover;background-position:center;background-image:var(--vimotia-thumbnail-image);border:var(--vimotia-thumbnail-border-width, 0) solid var(--vimotia-thumbnail-border-color, transparent);border-radius:var(--vimotia-thumbnail-border-radius, 0);cursor:pointer;opacity:0;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .6s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .6s;-webkit-tap-highlight-color:rgba(0,0,0,0);box-sizing:border-box;width:200px;aspect-ratio:1/1}@supports not (aspect-ratio: auto){.vimotia-thumbnail{height:200px}}.vimotia-thumbnail[hidden]{display:none}.vimotia-thumbnail .vimotia-heading{padding:calc(12px + var(--vimotia-thumbnail-border-radius, 0)/2) calc(12px + var(--vimotia-thumbnail-border-radius, 0)/2) 0}.vimotia-thumbnail__inner{position:relative}.vimotia-thumbnail__video-duration{font-size:12px;color:#fff;position:absolute;right:calc(12px + var(--vimotia-thumbnail-border-radius, 0)/2);bottom:calc(12px + var(--vimotia-thumbnail-border-radius, 0)/2)}.vimotia-thumbnail__play-button{position:absolute}.vimotia-thumbnail__play-button--top .vimotia-thumbnail__play-button{top:calc(12px + var(--vimotia-thumbnail-border-radius, 0)/2)}.vimotia-thumbnail__play-button--bottom .vimotia-thumbnail__play-button{bottom:calc(12px + var(--vimotia-thumbnail-border-radius, 0)/2)}.vimotia-thumbnail__play-button--left .vimotia-thumbnail__play-button{left:calc(12px + var(--vimotia-thumbnail-border-radius, 0)/2)}.vimotia-thumbnail__play-button--right .vimotia-thumbnail__play-button{right:calc(12px + var(--vimotia-thumbnail-border-radius, 0)/2)}.vimotia-thumbnail__play-button--center-x .vimotia-thumbnail__play-button{left:50%;transform:translateX(-50%)}.vimotia-thumbnail__play-button--center-y .vimotia-thumbnail__play-button{top:50%;transform:translateY(-50%)}.vimotia-thumbnail__play-button--center-x.vimotia-thumbnail__play-button--center-y .vimotia-thumbnail__play-button{transform:translate(-50%, -50%)}.vimotia-thumbnail--has-video-duration.vimotia-thumbnail__play-button--bottom.vimotia-thumbnail__play-button--right .vimotia-thumbnail__play-button{bottom:calc(12px + var(--vimotia-thumbnail-border-radius, 0)/2 + 32px)}",""]),e.A=s},1710:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-thumbnail--large{width:250px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--large{height:250px}}@media(max-width: 599px){.vimotia-thumbnail--large{width:180px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--large{height:180px}}}.vimotia-thumbnail--large.vimotia-thumbnail--portrait{width:180px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--large.vimotia-thumbnail--portrait{height:360px}}@media(max-width: 599px){.vimotia-thumbnail--large.vimotia-thumbnail--portrait{width:150px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--large.vimotia-thumbnail--portrait{height:300px}}}.vimotia-thumbnail--large.vimotia-thumbnail--landscape{width:360px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--large.vimotia-thumbnail--landscape{height:180px}}@media(max-width: 599px){.vimotia-thumbnail--large.vimotia-thumbnail--landscape{width:240px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--large.vimotia-thumbnail--landscape{height:120px}}}.vimotia-thumbnail--large .vimotia-heading{font-size:18px}@media(max-width: 599px){.vimotia-thumbnail--large .vimotia-heading{font-size:16px}}",""]),e.A=s},1580:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-thumbnail--medium{width:200px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--medium{height:200px}}@media(max-width: 599px){.vimotia-thumbnail--medium{width:150px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--medium{height:150px}}}.vimotia-thumbnail--medium.vimotia-thumbnail--portrait{width:150px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--medium.vimotia-thumbnail--portrait{height:300px}}@media(max-width: 599px){.vimotia-thumbnail--medium.vimotia-thumbnail--portrait{width:120px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--medium.vimotia-thumbnail--portrait{height:240px}}}.vimotia-thumbnail--medium.vimotia-thumbnail--landscape{width:300px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--medium.vimotia-thumbnail--landscape{height:150px}}@media(max-width: 599px){.vimotia-thumbnail--medium.vimotia-thumbnail--landscape{width:200px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--medium.vimotia-thumbnail--landscape{height:100px}}}.vimotia-thumbnail--medium .vimotia-heading{font-size:16px}@media(max-width: 599px){.vimotia-thumbnail--medium .vimotia-heading{font-size:14px}}",""]),e.A=s},7310:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-thumbnail--small{width:150px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--small{height:150px}}@media(max-width: 599px){.vimotia-thumbnail--small{width:120px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--small{height:120px}}}.vimotia-thumbnail--small.vimotia-thumbnail--portrait{width:120px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--small.vimotia-thumbnail--portrait{height:240px}}@media(max-width: 599px){.vimotia-thumbnail--small.vimotia-thumbnail--portrait{width:90px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--small.vimotia-thumbnail--portrait{height:180px}}}.vimotia-thumbnail--small.vimotia-thumbnail--landscape{width:240px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--small.vimotia-thumbnail--landscape{height:120px}}@media(max-width: 599px){.vimotia-thumbnail--small.vimotia-thumbnail--landscape{width:160px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--small.vimotia-thumbnail--landscape{height:80px}}}.vimotia-thumbnail--small .vimotia-heading{font-size:14px}@media(max-width: 599px){.vimotia-thumbnail--small .vimotia-heading{font-size:12px}}",""]),e.A=s},9356:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-thumbnail--x-small{width:120px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--x-small{height:120px}}@media(max-width: 599px){.vimotia-thumbnail--x-small{width:90px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--x-small{height:90px}}}.vimotia-thumbnail--x-small.vimotia-thumbnail--portrait{width:90px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--x-small.vimotia-thumbnail--portrait{height:180px}}@media(max-width: 599px){.vimotia-thumbnail--x-small.vimotia-thumbnail--portrait{width:60px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--x-small.vimotia-thumbnail--portrait{height:120px}}}.vimotia-thumbnail--x-small.vimotia-thumbnail--landscape{width:210px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--x-small.vimotia-thumbnail--landscape{height:105px}}@media(max-width: 599px){.vimotia-thumbnail--x-small.vimotia-thumbnail--landscape{width:130px}@supports not (aspect-ratio: auto){.vimotia-thumbnail--x-small.vimotia-thumbnail--landscape{height:65px}}}.vimotia-thumbnail--x-small .vimotia-heading{font-size:14px}@media(max-width: 599px){.vimotia-thumbnail--x-small .vimotia-heading{font-size:12px}}",""]),e.A=s},2490:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__logo{width:auto;height:48px;margin:0;padding:0}.vimotia__logo--placeholder{display:none}",""]),e.A=s},3600:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia--collection{opacity:0;z-index:-999;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s}@media(min-width: 900px){.vimotia--collection{display:grid;grid-template-columns:1fr 420px}.vimotia--collection.vimotia-collection--hide-video-info{grid-template-columns:1fr 0}.vimotia--collection.vimotia-collection--hide-video-info--permanent{grid-template-columns:1fr 0}}.vimotia--collection.vimotia--visible{opacity:1}.vimotia--collection__video{position:relative;min-width:0;min-height:0;width:100%;height:100%}.vimotia--collection__video-info{background-color:#fff}.vimotia-collection--hide-video-info .vimotia--collection__video-info{width:0;padding:0}.vimotia-collection--hide-video-info--permanent .vimotia--collection__video-info{width:0;padding:0}.vimotia-collection__close{--icon-color: #FFFFFF}.vimotia--collection--popup.vimotia--visible{z-index:2147483645}.vimotia--collection--popup .vimotia{position:relative}.vimotia-collection--hide-video-info--permanent .vimotia-collection__product-widget{display:none}",""]),e.A=s},5867:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia--collection__video__slider{height:100%}.vimotia--collection>.swiper{width:100%;height:100%}.vimotia--collection .swiper-slide{display:flex;align-items:center}.vimotia--collection .swiper-button-prev.vimotia--collection__video__slider__button-prev,.vimotia--collection .swiper-button-next.vimotia--collection__video__slider__button-next{display:block;position:static;transform:rotate(90deg);width:auto;height:auto;margin:0;color:#fff}.vimotia--collection .swiper-button-prev.vimotia--collection__video__slider__button-prev:after,.vimotia--collection .swiper-button-next.vimotia--collection__video__slider__button-next:after{display:none}.vimotia--collection .swiper-button-prev.vimotia--collection__video__slider__button-prev[hidden],.vimotia--collection [hidden].swiper-button-next.vimotia--collection__video__slider__button-next{display:none}.vimotia--collection .swiper-button-next.vimotia--collection__video__slider__button-next{transform:rotate(-90deg)}",""]),e.A=s},7326:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-collection__actions-wrapper{width:100%;height:100%;position:absolute;top:0;left:0;display:grid;grid-column:1;grid-template-rows:fit-content(72px) 1fr fit-content(0)}.vimotia-collection__top-actions{display:grid;width:100%;min-width:0;grid-template-columns:1fr 1fr;padding:12px;z-index:1}.vimotia-collection__top-actions__left{display:flex !important;align-items:center;gap:12px;color:#fff}.vimotia-collection__top-actions__right{display:flex !important;justify-content:flex-end}.vimotia-collection__center-actions{padding:0 12px;height:100%;display:flex;justify-content:flex-end}.vimotia-collection__side-actions{display:grid;grid-template-rows:1fr 1fr 1fr;justify-content:flex-end;height:100%;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .2s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .2s}@media(max-width: 599px){.vimotia-collection__side-actions{grid-template-rows:1fr 0 3fr;width:48px}}.vimotia-collection__side-actions[hidden]{display:none}.vimotia--hide-widgets .vimotia-collection__side-actions{transform:translateX(100%);opacity:0;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .6s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .6s}.vimotia-collection__side-actions__top{display:flex;justify-content:flex-end;align-items:flex-start;z-index:1}.vimotia-collection__side-actions__center{display:flex !important;flex-direction:column;justify-content:center;align-items:flex-end;gap:12px;z-index:1}.vimotia-collection__side-actions__bottom{display:flex;flex-direction:column;justify-content:flex-end;align-items:flex-end;gap:12px;z-index:1}.vimotia-collection__bottom-actions{padding:12px;display:flex;flex-direction:column;gap:12px;z-index:1}.vimotia-collection__bottom-actions__bottom-row{display:grid;grid-template-columns:1fr min-content;align-items:center;gap:12px}.vimotia-collection__bottom-actions__controls{display:grid;gap:4px}.vimotia-collection__bottom-actions__controls__bottom{display:flex;justify-content:space-between;gap:24px;align-items:center;color:#fff;opacity:.5;font-size:10px}.vimotia-collection__bottom-actions__controls__bottom__current-play,.vimotia-collection__bottom-actions__controls__bottom__next-play{display:grid;grid-template-columns:8px 1fr auto;align-items:center;gap:4px;max-width:180px}@media(max-width: 599px){.vimotia-collection__bottom-actions__controls__bottom__current-play,.vimotia-collection__bottom-actions__controls__bottom__next-play{max-width:130px}}.vimotia-collection__bottom-actions__controls__bottom__current-play[hidden],[hidden].vimotia-collection__bottom-actions__controls__bottom__next-play{opacity:0}.vimotia-collection__bottom-actions__controls__bottom__current-play__time-wrapper{display:flex}.vimotia-collection__bottom-actions__controls__bottom__current-play__text,.vimotia-collection__bottom-actions__controls__bottom__next-play__text{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;line-height:12px;height:12px}.vimotia-collection__bottom-actions__controls__bottom__current-play__icon,.vimotia-collection__bottom-actions__controls__bottom__next-play__icon{position:relative;width:8px;height:8px}.vimotia-collection__bottom-actions__controls__bottom__current-play__icon svg,.vimotia-collection__bottom-actions__controls__bottom__next-play__icon svg{position:absolute;top:0;left:0;width:8px;height:8px}.vimotia-collection__icon--swipe-up{width:9px;height:9px;transform:rotate(90deg)}",""]),e.A=s},8542:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-collection__sound{transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s}",""]),e.A=s},8049:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-collection__product-widget{display:grid;gap:8px;align-content:flex-start;width:100%;max-width:none;background-color:rgba(0,0,0,0);-webkit-backdrop-filter:blur(6px) !important;backdrop-filter:blur(6px) !important;justify-self:flex-end;will-change:opacity,transform;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .2s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .2s,width cubic-bezier(0.42, 0, 0.15, 0.99) .3s,padding-left cubic-bezier(0.42, 0, 0.15, 0.99) .2s,padding-right cubic-bezier(0.42, 0, 0.15, 0.99) .2s;bottom:80px}@media(min-width: 600px){.vimotia-collection__product-widget{width:420px;padding:0}}@media(min-width: 900px){.vimotia-collection__product-widget{grid-template-columns:1fr;gap:24px;position:static;height:100vh;background-color:#fff;box-shadow:-12px 0 24px rgba(0,0,0,.04)}}.vimotia-collection__product-widget[hidden]{display:none}.vimotia-collection__product-widget .swiper-slide{width:290px}.vimotia--hide-widgets .vimotia-collection__product-widget{opacity:0;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .6s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .6s;transform:translateY(400px)}@media(min-width: 900px){.vimotia--hide-widgets .vimotia-collection__product-widget{opacity:1;transform:translateY(0)}}.vimotia-collection__link-widget{display:grid;grid-template-columns:1fr;gap:12px;justify-items:flex-end;margin-left:-552px}@media(max-width: 599px){.vimotia-collection__link-widget{margin-left:-252px}}.vimotia-collection__sticker-widget{display:grid;grid-template-columns:1fr;gap:8px;margin-left:-52px}",""]),e.A=s},8558:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-collection__video-info__coupon{will-change:opacity,height;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .6s 300ms,height cubic-bezier(0.42, 0, 0.15, 0.99) .6s}.vimotia-coupon--desktop__coupons-list-wrapper{padding:24px;border-bottom:1px solid #e3e3e3}.vimotia-coupon__coupon-wrapper{margin-bottom:12px}.vimotia-coupon--desktop__coupons-list-wrapper .vimotia-coupon__coupon-wrapper{margin-bottom:0}.vimotia-coupon__coupon{position:relative;max-width:400px;margin:0 auto;background-color:var(--background-color, #FBF6E3);border:1px dashed var(--foreground-color, #FF9AA1);border-radius:4px;text-align:center;color:var(--foreground-color, #FF9AA1)}.vimotia-coupon__coupon--top{display:grid;grid-template-columns:2fr 1fr;align-items:center;border-bottom:1px dashed var(--foreground-color, #FF9AA1)}.vimotia-coupon__coupon--timer-hidden .vimotia-coupon__coupon--top{border-bottom:none}.vimotia-coupon__coupon-content{padding:8px;border-right:1px dashed var(--foreground-color, #FF9AA1)}.vimotia-coupon__coupon-content__amount{font-size:32px;font-weight:bold;line-height:1;margin-bottom:4px}.vimotia-coupon__coupon-content__text{font-size:14px;line-height:1}.vimotia-coupon__coupon-button{display:grid;align-items:center;min-height:0;height:100%;padding:24px 8px;font-size:14px;font-weight:600;line-height:1.5;text-transform:uppercase;will-change:background-color,color;transition:background-color cubic-bezier(0.42, 0, 0.15, 0.99) .3s,color cubic-bezier(0.42, 0, 0.15, 0.99) .3s;cursor:pointer}.vimotia-coupon__coupon-button:hover{color:var(--background-color, #FBF6E3);background-color:var(--foreground-color, #FF9AA1)}.vimotia-coupon__coupon--applied .vimotia-coupon__coupon-button{pointer-events:none}.vimotia-coupon__valid-timer{padding:4px;font-size:14px;text-align:center}.vimotia-coupon__coupon--timer-hidden .vimotia-coupon__valid-timer{display:none}.vimotia-coupon__valid-timer__timer{display:inline-flex;font-weight:bold;margin:0 8px}.vimotia-coupon__message--applying,.vimotia-coupon__message--post-success-note,.vimotia-coupon__message--apply-failed{margin:24px 0;padding:16px;text-align:left;font-size:14px;line-height:1.5;background-color:#eaf8fc;border:1px solid #98c6cd}.vimotia-coupon__message--applying[hidden],[hidden].vimotia-coupon__message--post-success-note,[hidden].vimotia-coupon__message--apply-failed{display:none}.vimotia-coupon__message--apply-failed{background-color:#fff5ea;border:1px solid #e0b878}.vimotia-coupon__message--post-success-note{background-color:#f1f8f5;border:1px solid #95c9b4}.vimotia-coupon__coupon-check-icon{display:none;position:absolute;top:-8px;right:-8px;width:25px;height:25px;border:1px solid #fff;border-radius:50%}.vimotia-coupon__coupon-check-icon svg{width:100%;height:100%}.vimotia-coupon__coupon--applied .vimotia-coupon__coupon-check-icon{display:grid}",""]),e.A=s},6790:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-modal--discount-timed-dialog .vimotia__modal-body{padding:24px}.vimotia-modal--discount-timed-dialog .vimotia__modal-dialog{width:400px;max-width:90vw}.vimotia-coupon__dialog-timer{margin-top:12px;text-align:center;font-size:12px}.vimotia-coupon__dialog-timer[hidden]{display:none}.vimotia-coupon__dialog-timer__timer{display:inline-flex;margin:0 8px;font-weight:bold}.vimotia-coupon--mobile__coupon-wrapper{display:grid;gap:4px;font-size:12px;text-align:center;color:#fff;--icon-color: white}.vimotia-coupon--mobile__coupon-wrapper[hidden]{display:none}.vimotia-coupon--mobile__coupon-timer{display:inline-flex;justify-content:center}.vimotia-modal--coupon-list .vimotia__modal-body{padding:12px}.vimotia-modal--coupon-list .vimotia__modal-dialog{width:400px;max-width:90vw}.vimotia-coupon__coupon-list-dialog-body-wrapper{will-change:opacity,height;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .6s 300ms,height cubic-bezier(0.42, 0, 0.15, 0.99) .6s}.vimotia-coupon__coupons-list-wrapper{max-height:58vh;padding:12px 14px 0;overflow-y:auto;overflow-x:visible}.vimotia-coupon--desktop__more{text-align:center;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;line-height:1.5;will-change:color,background-color,border-color;transition:color cubic-bezier(0.42, 0, 0.15, 0.99) .3s,background-color cubic-bezier(0.42, 0, 0.15, 0.99) .3s,border-color cubic-bezier(0.42, 0, 0.15, 0.99) .3s;text-transform:uppercase;font-family:inherit;overflow:visible;width:100%;min-width:auto;font-size:14px;margin-top:12px;padding:8px 12px;letter-spacing:2px;background-color:#fff;color:#292929;text-decoration:none;opacity:1;position:relative;outline:none;border:1px solid currentColor;border-radius:4px;font-weight:600}",""]),e.A=s},6914:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,'.vimotia--embedded{position:relative;width:100%;display:grid;grid-template-columns:1fr;grid-template-areas:"video";overflow:hidden;opacity:1;z-index:1}@media(min-width: 600px){.vimotia--embedded{margin:24px 0}}.vimotia--embedded .vimotia--embedded__video{grid-area:video;position:relative;z-index:1;opacity:1;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s}.vimotia--embedded .vimotia--embedded__video[hidden]{opacity:0}.vimotia--embedded .vimotia__playButtonContainer--embed{grid-area:video;margin:0;width:100%;height:100%;z-index:2}.vimotia--embedded .vimotia__video-wrapper{max-height:70vh;position:static}.vimotia--embedded .vimotia__videos{position:relative}@media(max-width: 599px){.vimotia--embedded .vimotia__widgetList__sticker-image{max-height:60px !important}}@media(max-width: 899px){.vimotia--embedded .vimotia__controls{padding:10px}}.vimotia--embedded .vimotia-collection__top-actions{z-index:2}.vimotia--embedded .vimotia-collection__side-actions{grid-template-rows:1fr 0 1fr}.vimotia--embedded .vimotia-collection__side-actions__top{z-index:2}.vimotia--embedded .vimotia-collection__side-actions__bottom{z-index:2}.vimotia--embedded .vimotia-collection__bottom-actions{z-index:2}.vimotia--embedded__product-widget{display:block;padding:24px 12px;background-color:#222;width:100%;height:auto;overflow:hidden;opacity:1;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .6s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .6s}@media(max-width: 599px){.vimotia--embedded__product-widget{padding:12px 8px}}.vimotia--embedded__product-widget.hidden{height:0;opacity:0}.vimotia--embedded__product-widget .swiper{width:100%}.vimotia--embedded__product-widget .swiper-slide{width:350px}.vimotia--embedded--atc-overlap .vimotia--embedded__product-widget{background-color:rgba(0,0,0,0);padding:0;grid-area:unset}.vimotia--hide-widgets .vimotia--embedded--atc-overlap .vimotia--embedded__product-widget{transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .3s;opacity:0;transform:translateY(300px)}',""]),e.A=s},9474:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia--gallery{display:block;width:100%;padding:var(--gallery-spacing-top, 24px) var(--gallery-spacing-right, 0) var(--gallery-spacing-bottom, 24px) var(--gallery-spacing-left, 0);opacity:0;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .6s}.vimotia--gallery.vimotia--gallery--ready{opacity:1}.vimotia--gallery .vimotia-thumbnail{width:100%}.vimotia--gallery-header{display:grid;align-items:center;justify-content:center}.vimotia--gallery--page .vimotia--gallery-header{display:none}.vimotia--gallery-title{margin:0 0 55px;padding:0;color:var(--gallery-title-color)}@media(max-width: 599px){.vimotia--gallery-title{margin:12px 0 24px}}.shopify-block.shopify-app-block[data-block-handle=gallery-block]{will-change:opacity,height;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s,height cubic-bezier(0.42, 0, 0.15, 0.99) .3s}.vimotia-gallery__gallery-player .vimotia--video{border-radius:var(--vimotia-thumbnail-border-radius, 0)}.vimotia-gallery__gallery-player .vimotia--video .vimotia__video-wrapper{border:var(--vimotia-thumbnail-border-width, 0) solid var(--vimotia-thumbnail-border-color, transparent)}#vimotia_gallery_app_block[hidden]{display:none}",""]),e.A=s},9567:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-gallery__gallery-player{width:100%;height:100%;position:absolute;top:0;left:0;opacity:0;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s}.vimotia-gallery__gallery-player .vimotia__controls{display:none}.vimotia-gallery__gallery-player .vimotia--video .vimotia__control--overlaid{display:none}",""]),e.A=s},60:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia--gallery-item{position:relative;cursor:pointer}",""]),e.A=s},8374:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia--grid-gallery{display:grid;align-items:center;grid-gap:var(--gallery-gap, 24px)}.vimotia--gallery-body{width:100%}.vimotia--grid-gallery .vimotia--gallery-body{display:grid;grid-gap:var(--gallery-gap, 15px);grid-template-columns:repeat(var(--gallery-col-desktop, 4), 1fr)}@media(max-width: 599px){.vimotia--grid-gallery .vimotia--gallery-body{grid-gap:var(--gallery-gap, 8px);grid-template-columns:repeat(var(--gallery-col-mobile, 2), 1fr)}}.vimotia--gallery-footer{margin-top:24px}.vimotia--grid-gallery .vimotia--gallery-footer{display:grid;align-items:center;justify-content:center}.vimotia--gallery-button--load-more{background-color:var(--background-color, #1A1B18);color:var(--text-color, white);line-height:1;padding:8px 26px;cursor:pointer;border:none;outline:none}.vimotia--gallery-button--load-more[disabled]{background-color:#d4d4d4;color:#fff}.vimotia--gallery--all-videos-loaded .vimotia--gallery-button--load-more{display:none}",""]),e.A=s},2229:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia--slider-gallery__nav-button{padding:8px;width:48px;height:48px;position:absolute;top:50%;transform:translateY(-50%);display:flex;align-items:center;justify-content:center;color:var(--vimotia-gallery-slider-arrow-color, #000000);text-rendering:initial;background-color:var(--vimotia-gallery-slider-arrow-background-color);z-index:10;cursor:pointer;transition:background-color cubic-bezier(0.42, 0, 0.15, 0.99) .3s}@media(max-width: 599px){.vimotia--slider-gallery__nav-button{width:32px;height:32px}}.vimotia--slider-gallery__nav-button:hover{background-color:var(--vimotia-gallery-slider-arrow-background-color-hover)}.vimotia--slider-gallery__nav-button.swiper-button-disabled{opacity:.35;cursor:auto;pointer-events:none}.vimotia--slider-gallery__nav-button[disabled]{opacity:.35;cursor:auto;pointer-events:none}.vimotia--slider-gallery__nav-button--prev{left:10px;right:auto}.vimotia--slider-gallery__nav-button--next{left:auto;right:10px;transform:translateY(-50%) rotate(180deg)}.vimotia--slider-gallery__nav-button--round{border-radius:50%}.vimotia--slider-gallery__nav-button--square{border-radius:4px}",""]),e.A=s},3138:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia--slider-gallery{position:relative}.vimotia--slider-gallery--arrow-outside{margin:0 64px}.vimotia--slider-gallery--arrow-outside.vimotia--slider-gallery--no-nav{margin:0}.vimotia--slider-gallery--arrow-outside .vimotia--slider-gallery__nav-button--prev{right:calc(100% + 8px);left:auto}.vimotia--slider-gallery--arrow-outside .vimotia--slider-gallery__nav-button--next{left:calc(100% + 8px);right:auto}",""]),e.A=s},9074:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__pip{width:400px;position:fixed;z-index:2147483647;box-shadow:0 2px 5px 0 rgba(0,0,0,.16),0 3px 6px 0 rgba(0,0,0,.2);opacity:0;transform:translateY(-30px);transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .6s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .6s}@media(max-width: 599px){.vimotia__pip{width:200px;right:6px;bottom:6px}}.vimotia__pip.vimotia__pip--visible{opacity:1;transform:translateY(0)}.vimotia__pip.vimotia__pip--bottom-right{right:12px;bottom:12px}.vimotia__pip.vimotia__pip--bottom-left{left:12px;bottom:12px}.vimotia__pip.vimotia__pip--landscape{width:400px}@media(max-width: 599px){.vimotia__pip.vimotia__pip--landscape{width:200px}}.vimotia__pip.vimotia__pip--square{width:200px}@media(max-width: 599px){.vimotia__pip.vimotia__pip--square{width:120px}}.vimotia__pip.vimotia__pip--portrait{width:200px}@media(max-width: 599px){.vimotia__pip.vimotia__pip--portrait{width:120px}}.vimotia__pip .vimotia{width:100%;max-width:none;max-height:none;min-width:auto}.vimotia__pip .vimotia__controls{display:none}.vimotia__pip .vimotia__branding{display:none}.vimotia__pip .vimotia__video-wrapper{position:relative}.vimotia__pip .vimotia__videos{position:relative}.vimotia__pip video{height:auto}.vimotia__pip__ui{width:100%;height:100%;position:absolute;top:0;left:0;right:0;bottom:0;background:#000;background:linear-gradient(180deg, rgba(0, 0, 0, 0.35) 0%, rgba(0, 0, 0, 0) 35%);transition:opacity ease-in-out .25s;cursor:pointer;--icon-color: white}@media(min-width: 1200px){.vimotia__pip__ui{opacity:0}}.vimotia__pip__ui:hover{opacity:1}.vimotia__pip__button{width:auto;min-width:auto;height:auto;position:absolute;padding:16px;margin:0;cursor:pointer;fill:#fff !important;color:#fff !important;background-color:rgba(0,0,0,0);border:0;box-shadow:none;-webkit-appearance:none;-moz-appearance:none;appearance:none;transition:opacity ease-in-out .6s,transform ease-in-out .6s}@media(max-width: 599px){.vimotia__pip__button{padding:12px}}.vimotia__pip__button svg{width:20px;height:20px;display:block}@media(max-width: 599px){.vimotia__pip__button svg{width:16px;height:16px}}.vimotia__pip__button-close{top:0;right:0}.vimotia__pip__button-expand{top:0;left:0}.vimotia__pip--bottom-right .vimotia__pip__button-expand{transform:scaleX(-1)}",""]),e.A=s},7791:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButtonPositioningMarker{width:0;height:0;position:relative;grid-template-rows:none;grid-template-columns:none;grid-template-areas:none;grid-auto-flow:initial;grid-auto-columns:initial;grid-auto-rows:initial;grid-area:none/none/none/none}.vimotia__playButtonContainer.vimotia__playButtonContainer--custom{position:absolute;left:var(--vimotia-button-space-x, 10px);top:var(--vimotia-button-space-y, 300px);right:auto;bottom:auto}.vimotia__playButtonContainer.vimotia__playButtonContainer--custom-default{position:absolute;left:20px;top:10px;right:auto;bottom:auto}",""]),e.A=s},9745:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButtonContainer--embed.vimotia-thumbnail{width:100%}",""]),e.A=s},5511:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButtonContainer.vimotia__playButtonContainer--floating{position:fixed;top:var(--vimotia-button-space-y, 300px);background-color:var(--vimotia-floating-connect-bg-color-rgb)}.vimotia__playButtonContainer.vimotia__playButtonContainer--floating.vimotia__playButtonContainer--left{left:0;right:auto;padding-left:var(--vimotia-button-space-x, 10px);border-radius:0 2em 2em 0}.vimotia__playButtonContainer.vimotia__playButtonContainer--floating.vimotia__playButtonContainer--right{left:auto;right:0;padding-right:var(--vimotia-button-space-x, 10px);border-radius:2em 0 0 2em}",""]),e.A=s},8705:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButtonContainer--pip{position:fixed;z-index:4}.vimotia__playButtonContainer--pip .vimotia-thumbnail{box-shadow:1px 2px 6px -1px rgba(0,0,0,.04),4px 6px 9px 0 rgba(0,0,0,.04),10px 11px 20px 1px rgba(0,0,0,.04),10px 11px 30px 3px rgba(0,0,0,.04)}.vimotia__playButtonContainer--pip--top{top:var(--vimotia-button-space-y, 300px)}.vimotia__playButtonContainer--pip--bottom{bottom:var(--vimotia-button-space-y, 300px)}.vimotia__playButtonContainer--pip--left{left:var(--vimotia-button-space-x, 50px)}.vimotia__playButtonContainer--pip--right{right:var(--vimotia-button-space-x, 50px)}",""]),e.A=s},3356:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--animation{animation-duration:3s;animation-fill-mode:both;animation-delay:1s;animation-iteration-count:infinite}",""]),e.A=s},4093:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--bounce{animation-name:vimotia-animation-bounce;transform-origin:center bottom}@keyframes vimotia-animation-bounce{13%,20%,25%,5%,from,to{animation-timing-function:cubic-bezier(0.215, 0.61, 0.355, 1);transform:translate3d(0, 0, 0)}10%,12%{animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);transform:translate3d(0, -30px, 0)}17%{animation-timing-function:cubic-bezier(0.755, 0.05, 0.855, 0.06);transform:translate3d(0, -15px, 0)}23%{transform:translate3d(0, -4px, 0)}}",""]),e.A=s},7519:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--emitting{animation-name:vimotia-animation-emitting;transform-origin:center bottom}@keyframes vimotia-animation-emitting{13%{box-shadow:0 0 5px 5px var(--emitting-color)}100%,25%{box-shadow:0 0 0 0 var(--emitting-color)}}",""]),e.A=s},869:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--flash{animation-name:vimotia-animation-flash}@keyframes vimotia-animation-flash{12%,6%,from,to{opacity:1}3%,9%{opacity:0}}",""]),e.A=s},4727:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--flip{animation-name:vimotia-animation-flip;backface-visibility:visible}@keyframes vimotia-animation-flip{from{transform:perspective(400px) rotate3d(0, 1, 0, -360deg);animation-timing-function:ease-out}5%{transform:perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg);animation-timing-function:ease-out}6%{transform:perspective(400px) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg);animation-timing-function:ease-in}10%{transform:perspective(400px) scale3d(0.95, 0.95, 0.95);animation-timing-function:ease-in}12%,to{transform:perspective(400px);animation-timing-function:ease-in}}",""]),e.A=s},6213:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--jello{animation-name:vimotia-animation-jello;transform-origin:center}@keyframes vimotia-animation-jello{5.6%,50%,from,to{transform:translate3d(0, 0, 0)}11.1%{transform:skewX(-12.5deg) skewY(-12.5deg)}16.6%{transform:skewX(6.25deg) skewY(6.25deg)}22.2%{transform:skewX(-3.125deg) skewY(-3.125deg)}27.7%{transform:skewX(1.5625deg) skewY(1.5625deg)}33.3%{transform:skewX(-0.78125deg) skewY(-0.78125deg)}38.8%{transform:skewX(0.390625deg) skewY(0.390625deg)}44.4%{transform:skewX(-0.1953125deg) skewY(-0.1953125deg)}}",""]),e.A=s},5289:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--pulse{animation-name:vimotia-animation-pulse;box-shadow:0 0 0 0 rgba(var(--vimotia-play-button-theme-color-rgb), 0.5)}@keyframes vimotia-animation-pulse{0%{transform:scale(0.9)}70%{transform:scale(1);box-shadow:0 0 0 50px rgba(var(--vimotia-play-button-theme-color-rgb), 0)}100%{transform:scale(0.9);box-shadow:0 0 0 0 rgba(var(--vimotia-play-button-theme-color-rgb), 0)}}",""]),e.A=s},4931:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--rubber-band{animation-name:vimotia-animation-rubber-band}@keyframes vimotia-animation-rubber-band{25%,from,to{transform:scale3d(1, 1, 1)}7%{transform:scale3d(1.25, 0.75, 1)}10%{transform:scale3d(0.75, 1.25, 1)}12%{transform:scale3d(1.15, 0.85, 1)}16%{transform:scale3d(0.95, 1.05, 1)}18%{transform:scale3d(1.05, 0.95, 1)}}",""]),e.A=s},6561:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--shine{animation-name:vimotia-animation-shine}@keyframes vimotia-animation-shine{0%{filter:drop-shadow(0px 0px 10px var(--vimotia-play-button-theme-color))}25%{filter:drop-shadow(0px 0px 0px var(--vimotia-play-button-theme-color))}100%{filter:drop-shadow(0px 0px 0px var(--vimotia-play-button-theme-color))}}",""]),e.A=s},3325:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--swing{animation-name:vimotia-animation-swing;transform-origin:top center}@keyframes vimotia-animation-swing{5%{transform:rotate3d(0, 0, 1, 15deg)}10%{transform:rotate3d(0, 0, 1, -10deg)}15%{transform:rotate3d(0, 0, 1, 5deg)}20%{transform:rotate3d(0, 0, 1, -5deg)}25%,to{transform:rotate3d(0, 0, 1, 0deg)}}",""]),e.A=s},9101:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--tada{animation-name:vimotia-animation-tada}@keyframes vimotia-animation-tada{25%,from,to{transform:scale3d(1, 1, 1)}2%,5%{transform:scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg)}12%,17%,22%,7%{transform:scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg)}10%,15%,20%{transform:scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg)}}",""]),e.A=s},9011:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--wobble{animation-name:vimotia-animation-wobble}@keyframes vimotia-animation-wobble{25%,from,to{transform:translate3d(0, 0, 0)}3%{transform:translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg)}7%{transform:translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg)}11%{transform:translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg)}15%{transform:translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg)}18%{transform:translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg)}}",""]),e.A=s},6465:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButtonContainer{cursor:pointer;z-index:4;display:none;opacity:0;transform:translateY(-20px);transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .6s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .6s;-webkit-tap-highlight-color:rgba(0,0,0,0)}.vimotia__playButtonContainer.vimotia__playButtonContainer--visible{display:inline-block}.vimotia__playButtonContainer.vimotia__playButtonContainer--is-showing{opacity:1;transform:translateY(0)}.vimotia__playButtonInnerContainer{border-radius:4em;overflow:hidden;font-size:initial;line-height:0;transition:transform ease-in-out .2s,box-shadow ease-in-out .2s;will-change:transform,box-shadow}.vimotia__playButtonInnerContainer:hover{transform:scale(1.05);box-shadow:2px 4px 16px 0 rgba(52,64,70,.1)}.vimotia__playButton{cursor:pointer}",""]),e.A=s},9439:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--large .vimotia__playButton-circle{width:48px;height:48px}@media(max-width: 599px){.vimotia__playButton--large .vimotia__playButton-circle{width:36px;height:36px}}",""]),e.A=s},3321:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--medium .vimotia__playButton-circle{width:36px;height:36px}@media(max-width: 599px){.vimotia__playButton--medium .vimotia__playButton-circle{width:24px;height:24px}}",""]),e.A=s},407:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--small .vimotia__playButton-circle{width:24px;height:24px}",""]),e.A=s},8693:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--x-small .vimotia__playButton-circle{width:20px;height:20px}",""]),e.A=s},773:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--style-minimal .vimotia__playButton-circle{border:none;border-radius:0;background-color:rgba(0,0,0,0)}.vimotia__playButton--style-minimal .vimotia__playButton-triangle{width:100%;height:100%}.vimotia__playButton--style-minimal.vimotia__playButtonContainer--floating .vimotia__playButtonInnerContainer{transform:translateX(85%)}.vimotia__playButton--style-minimal .vimotia__playButtonInnerContainer:hover{box-shadow:none}.vimotia__playButton--style-minimal.vimotia__playButtonContainer.vimotia__playButtonContainer--floating.vimotia__playButtonContainer--left{border-radius:0}",""]),e.A=s},9509:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--style-outline .vimotia__playButton-circle{border-color:var(--vimotia-play-button-circle-color, #FF0000);background-color:rgba(0,0,0,0)}",""]),e.A=s},9636:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton-circle{border:1px solid rgba(0,0,0,0);border-radius:50%;background-color:var(--vimotia-play-button-circle-color, #FF0000);display:flex;justify-content:center;align-items:center}.vimotia__playButton-triangle{width:45%;height:45%;color:var(--vimotia-play-button-triangle-color, #FFFFFF);position:relative;left:1px;z-index:1}.vimotia__playButton-triangle svg{width:100%;height:100%}.vimotia__playButton__progressBar{display:inline-block !important;width:0;height:100%;border-radius:0;position:absolute;left:0;top:0;background:#e4e7eb;will-change:width}.vimotia__playButton-circle .vimotia__playButton__progressBar{background-color:var(--vimotia-play-button-circle-color);filter:brightness(0.8)}.vimotia__playButton__progressBarAnimate{animation-name:vimotia-progress-bar;animation-duration:var(--vimotia-progress-bar-duration);animation-fill-mode:both;animation-iteration-count:1;animation-timing-function:linear}",""]),e.A=s},757:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--style-rectangle .vimotia__playButton-circle{border:none;border-radius:0;background-color:var(--vimotia-play-button-circle-color, #FF0000)}.vimotia__playButton--style-rectangle .vimotia__playButtonInnerContainer{border-radius:0}.vimotia__playButton--style-rectangle.vimotia__playButton--small .vimotia__playButton-circle{width:36px}@media(max-width: 599px){.vimotia__playButton--style-rectangle.vimotia__playButton--small .vimotia__playButton-circle{width:32px}}.vimotia__playButton--style-rectangle.vimotia__playButton--medium .vimotia__playButton-circle{width:54px}@media(max-width: 599px){.vimotia__playButton--style-rectangle.vimotia__playButton--medium .vimotia__playButton-circle{width:36px}}.vimotia__playButton--style-rectangle.vimotia__playButton--large .vimotia__playButton-circle{width:72px}@media(max-width: 599px){.vimotia__playButton--style-rectangle.vimotia__playButton--large .vimotia__playButton-circle{width:54px}}",""]),e.A=s},7679:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton--style-standard .vimotia__playButton-circle{border:none;background-color:var(--vimotia-play-button-circle-color, #FF0000)}",""]),e.A=s},6137:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton__text{font-family:inherit;font-weight:600;line-height:1;white-space:nowrap}.vimotia__playButton--style-text .vimotia__playButtonInnerContainer{background-color:var(--vimotia-play-button-text-background-color, #ffffff)}.vimotia__playButton--style-text .vimotia__playButton{position:relative;border:1px solid var(--vimotia-play-button-text-border-color, #333F44);border-radius:inherit;color:var(--vimotia-play-button-text-color, #333F44) !important;display:inline-grid;grid-template-columns:1fr;align-items:center;text-align:center}@media(max-width: 599px){.vimotia__playButton--style-text .vimotia__playButton{grid-gap:4px}}.vimotia__playButton--style-text.vimotia__playButton--large .vimotia__playButton{padding:16px 32px;font-size:20px}@media(max-width: 599px){.vimotia__playButton--style-text.vimotia__playButton--large .vimotia__playButton{padding:12px 16px;font-size:16px}}.vimotia__playButton--style-text.vimotia__playButton--medium .vimotia__playButton{padding:12px 24px;font-size:16px}@media(max-width: 599px){.vimotia__playButton--style-text.vimotia__playButton--medium .vimotia__playButton{padding:8px 16px;font-size:14px}}.vimotia__playButton--style-text.vimotia__playButton--small .vimotia__playButton{padding:8px 12px;font-size:14px}@media(max-width: 599px){.vimotia__playButton--style-text.vimotia__playButton--small .vimotia__playButton{font-size:12px}}.vimotia__playButton--style-text.vimotia__playButton--x-small .vimotia__playButton{padding:8px;font-size:12px}",""]),e.A=s},7761:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__playButton__textTime{display:grid;gap:8px}.vimotia__playButton--small .vimotia__playButton__textTime{gap:4px}.vimotia__playButton__time{font-family:inherit;font-weight:600;line-height:1}.vimotia__playButton--large .vimotia__playButton__time{font-size:16px}@media(max-width: 599px){.vimotia__playButton--large .vimotia__playButton__time{font-size:14px}}.vimotia__playButton--medium .vimotia__playButton__time{font-size:14px}@media(max-width: 599px){.vimotia__playButton--medium .vimotia__playButton__time{font-size:12px}}.vimotia__playButton--small .vimotia__playButton__time{font-size:12px}",""]),e.A=s},1767:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__product-view__add-to-cart{position:relative;width:100%;min-width:auto;padding:12px;display:grid;justify-content:center;align-items:center;border-radius:4px;font-family:inherit;font-size:14px;color:var(--add-to-cart-text-color, #ffffff);background-color:var(--add-to-cart-background-color, rgb(33, 42, 47));border:1px solid var(--add-to-cart-background-color, rgb(33, 42, 47));line-height:1.25;text-align:center;text-transform:uppercase;text-decoration:none;font-weight:600;letter-spacing:2px;cursor:pointer;outline:none;box-sizing:border-box;opacity:1;overflow:visible;-webkit-user-select:none;-moz-user-select:none;user-select:none;will-change:color,background-color,border-color;transition:color cubic-bezier(0.42, 0, 0.15, 0.99) .3s,background-color cubic-bezier(0.42, 0, 0.15, 0.99) .3s,border-color cubic-bezier(0.42, 0, 0.15, 0.99) .3s}.vimotia__product-view__add-to-cart:hover{color:#fff;filter:brightness(1.1)}.vimotia__product-view__add-to-cart[disabled],.vimotia__product-view__add-to-cart[disabled]:hover{color:rgba(0,0,0,.25);background:#f5f5f5;border-color:#d9d9d9;text-shadow:none;box-shadow:none;cursor:not-allowed;filter:brightness(1)}.vimotia__product-view__add-to-cart.vimotia__product-view__add-to-cart--success,.vimotia__product-view__add-to-cart.vimotia__product-view__add-to-cart--success:hover{border:1px solid #95c9b4;background-color:#f1f8f5;color:#292929;filter:none}.vimotia__product-view__add-to-cart__inner{display:flex;align-items:center;gap:12px}",""]),e.A=s},3051:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__product-view__title{font-size:20px;line-height:1.25;text-transform:capitalize;text-indent:0;text-align:left;box-shadow:none;font-family:inherit;padding:0;border:0;display:block}.vimotia__product-view__price{font-size:16px}.vimotia__product-view__price__current{font-weight:600}.vimotia__product-view__price__compare{text-decoration:line-through;color:#b3b3b3}",""]),e.A=s},7695:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__product-view--card{display:grid;gap:12px;padding:12px;border:1px solid #e3e3e3;border-radius:12px;font-size:14px}",""]),e.A=s},975:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__product-view--detail{font-size:12px;color:#3b3b3b}.vimotia__product-view--detail__section{padding:16px;border-bottom:1px solid #e3e3e3}.vimotia__product-view--detail__section--key-info{display:grid;grid-gap:8px}.vimotia__product-view--detail__detail-header{font-size:16px;font-weight:500;margin-bottom:16px}.vimotia__product-view--detail__detail-body{overflow:hidden}",""]),e.A=s},7143:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__product-view--extend-card{display:grid;gap:16px}",""]),e.A=s},3407:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__product-view__gallery--empty{display:none}",""]),e.A=s},8234:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__product-view__gallery__image{display:block;opacity:1 !important;-o-object-fit:contain;object-fit:contain}",""]),e.A=s},4391:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,"@media(max-width: 599px){.vimotia__modal-dialog .vimotia__product-view__gallery--multiple{width:100%}}.vimotia__product-view__gallery--multiple .vimotia__product-view__gallery__image{width:auto;height:200px}@media(max-width: 599px){.vimotia__product-view__gallery--multiple .vimotia__product-view__gallery__image{width:100%;height:auto}}.vimotia__product-view__gallery--multiple .swiper-wrapper{height:auto}",""]),e.A=s},2471:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__product-view__gallery--single .vimotia__product-view__gallery__image{width:100%}",""]),e.A=s},2623:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__product-view--mini-card{box-sizing:border-box;width:100%;display:grid;grid-template-columns:96px 1fr 24px;grid-gap:12px;align-items:center;border-radius:4px;font-size:14px;text-align:left;color:#3b3b3b}.vimotia__product-view--mini-card:hover{cursor:pointer}.vimotia__product-view--mini-card.vimotia__product-view--mini-card--no-image{grid-template-columns:0 1fr 16px}.vimotia__product-view--mini-card__gallery--single{width:96px;height:96px;border-radius:4px;overflow:hidden;display:flex}.vimotia__product-view--mini-card__gallery{max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain;border-radius:4px;opacity:1 !important}.vimotia__product-view--mini-card__title{display:block;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;font-family:inherit;font-weight:600;line-height:1.25;margin-bottom:4px}.vimotia__product-view--mini-card__price{font-size:14px;display:flex;gap:8px}.vimotia__product-view--mini-card__price__current{font-weight:600}.vimotia__product-view--mini-card__price__compare{text-decoration:line-through;color:#b3b3b3}.vimotia__product-view--mini-card__right{min-width:0}.vimotia__product-view--mini-card__arrow{color:#999;transform:rotate(180deg)}@media(max-width: 599px){.vimotia__product-view--mini-card__arrow{color:inherit}}.vimotia__product-view--mini-card:hover .vimotia__product-view--mini-card__arrow .vimotia-icon{animation:vimotia-slide 1s ease-in-out both 2}",""]),e.A=s},3219:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__product-view--mini-card--standalone{font-size:14px;color:#fff;background-color:rgba(255,255,255,.15)}",""]),e.A=s},8581:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__product-recommendation{padding:16px}.vimotia__product-recommendation__heading{margin:12px 0;font-size:16px;font-weight:600}.vimotia__product-recommendation__product-wrapper{display:grid;grid-template-columns:repeat(2, 1fr);gap:16px}.vimotia__product-recommendation__product{display:grid;gap:8px;font-size:14px;text-decoration:none;color:inherit}.vimotia__product-recommendation__product__image-wrapper{display:grid;align-items:center;justify-content:center}.vimotia__product-recommendation__product__image{display:block;max-width:100%;max-height:100%;-o-object-fit:contain;object-fit:contain}.vimotia__product-recommendation__product__title{line-height:1.25}.vimotia__product-recommendation__product:hover .vimotia__product-recommendation__product__title{text-decoration:underline}.vimotia__product-recommendation__product__price-wrapper{display:flex;gap:4px;line-height:1}.vimotia__product-recommendation__product__price-from{font-weight:600}.vimotia__product-recommendation__product__price{font-weight:600}",""]),e.A=s},1787:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__variantForm_container--collapse .vimotia__variantForm_singleSelectorsWrapper{transition:height cubic-bezier(0.42, 0, 0.15, 0.99) .2s;height:0}.vimotia__variantForm_container--collapse.vimotia__variantForm_container--collapse--show-options .vimotia__variantForm_singleSelectorsWrapper{height:auto}",""]),e.A=s},4410:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__variantForm_container{display:grid;gap:16px}.vimotia__variantForm_singleSelectorsWrapper{overflow:hidden}.vimotia__variantForm_singleSelectorsInner{display:grid;gap:16px}.vimotia__variantForm_singleSelectorsInner .vimotia__formGroup{margin-bottom:0}.vimotia__variantForm_priceWrapper{font-size:20px;line-height:1.25;font-style:normal;font-weight:600}.vimotia__variantForm_price{font-weight:600}.vimotia__variantForm_comparePrice{color:#b3b3b3;text-decoration:line-through;margin-left:12px}.vimotia__variantForm_unitPrice{color:#b3b3b3;font-size:12px;font-weight:400}",""]),e.A=s},4720:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__widget__addToCart--desktop-view{min-width:0;transition:opacity .2s cubic-bezier(0.42, 0, 0.15, 0.99);overflow:auto}.vimotia__widget__addToCart--desktop-view .vimotia__product-view--card{margin:12px}.vimotia__widget__addToCart__product-detail__header{display:grid;grid-template-columns:48px 1fr 48px;align-items:center;justify-content:center;padding:8px;border-bottom:1px solid #e3e3e3}.vimotia__widget__addToCart__product-detail__header-middle{display:flex;justify-content:center;align-items:center}.vimotia__widget__addToCart__product-list__header{font-size:16px;font-weight:600;padding:16px 24px 0}",""]),e.A=s},5672:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-addToCart--mobile{display:grid;gap:8px}.vimotia-addToCart__list-wrapper{transition:height cubic-bezier(0.42, 0, 0.15, 0.99) .3s,opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s}.vimotia-addToCart__top{display:grid;grid-template-columns:1fr;gap:8px;position:relative}.vimotia-addToCart__more{display:none;position:absolute;top:-12px;transform:translateY(-100%);min-height:0;padding:8px;color:#fff;background-color:rgba(255,255,255,.15);border-radius:4px;justify-self:flex-start}.vimotia-addToCart--has-more .vimotia-addToCart__more{display:block}.vimotia-addToCart__more-text{font-size:12px;line-height:1}.vimotia-addToCart__primary{overflow:auto}.vimotia-addToCart__list{overflow:auto;display:grid;gap:12px}.vimotia-addToCart__list .vimotia__widget__productInfo__container{padding:0 0 16px 0;margin-bottom:16px;border-bottom:1px solid #e3e3e3}.vimotia-addToCart__list .vimotia__widget__productInfo__container:last-child{padding:0;margin:0;border:none}.vimotia-addToCart--mobile .vimotia__widget__productInfo__addToCartButton{display:none}@media(max-width: 599px){.vimotia-addToCart--mobile__modal.vimotia__modal{z-index:2147483647}.vimotia-addToCart--mobile__modal .vimotia__modal-dialog{width:100%;height:100%;position:absolute;top:0;left:0}.vimotia-addToCart--mobile__modal .vimotia__modal-content{height:100%;overflow:hidden}}@media(min-width: 600px){.vimotia-addToCart--mobile__modal .vimotia__modal-dialog{margin:24px auto}.vimotia-addToCart--mobile__modal .vimotia__modal-header{padding:4px}.vimotia-addToCart--mobile__modal .vimotia__product--form-view{font-size:12px}.vimotia-addToCart--mobile__modal .vimotia__product--form-view .vimotia__formGroup{margin-bottom:0}.vimotia-addToCart--mobile__modal .vimotia__product--form-view .vimotia__widget__productInfo__container{grid-template-columns:42px minmax(0, 1fr)}.vimotia-addToCart--mobile__modal .vimotia__product--form-view .vimotia__widget__productInfo__imageWrapper{width:42px;height:42px}.vimotia-addToCart--mobile__modal .vimotia__product--form-view .vimotia__product-view__add-to-cart{font-size:10px}}.vimotia__modal-dialog{transform:translateY(100%)}.vimotia__modal-dialog.vimotia__modal-dialog--show{transform:translateY(0)}",""]),e.A=s},568:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-addToCart--slider__modal .vimotia__widget__productInfo__container{margin-bottom:16px;grid-gap:16px}.vimotia-addToCart--slider .vimotia__widget__productInfo__container:hover{cursor:grab}.vimotia-addToCart--slider .vimotia__widget__productInfo__contentWrapper{font-size:10px}.vimotia-addToCart--slider__modal .vimotia__widget__productInfo__contentWrapper>div{margin-bottom:8px}.vimotia-addToCart--slider .vimotia__product-view--mini-card__price{font-size:12px;line-height:1.25}.vimotia-addToCart--slider__modal-msg{text-align:center;width:480px;margin:0 auto}",""]),e.A=s},6047:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__widget__addToCart--hide-add-to-cart-button .vimotia__widget__addToCart__product-list__body .vimotia__product-view__add-to-cart{display:none}.vimotia__widget__addToCart--hide-add-to-cart-button .vimotia__modal-dialog .vimotia-addToCart__list .vimotia__product-view__add-to-cart{display:none}",""]),e.A=s},6923:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__widgetList__annotationLink{display:inline-block;width:auto;max-width:290px;line-height:2em;font-weight:400;z-index:6;overflow:hidden;border-radius:4px;opacity:1;will-change:opacity,transform;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .2s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .2s}.vimotia__widgetList__annotationLink[hidden]{display:none}.vimotia--hide-widgets .vimotia__widgetList__annotationLink{opacity:0;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .6s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .6s;transform:translateY(400px)}.vimotia__widgetList__annotationLink--has-link{cursor:pointer}.vimotia__widgetList__item__contentWrapper{display:grid;grid-template-columns:1fr auto;align-items:baseline;grid-gap:4px;padding:0 12px;min-height:48px;line-height:48px;font-size:12px;color:#fff;background-color:rgba(255,255,255,.15) !important;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .3s}.vimotia__widgetList__item__contentWrapper[hidden]{display:none}.vimotia__timer{display:inline-block;margin-left:.25em}.vimotia__timer__digit{font-weight:600}.vimotia__timer__separator{margin:0;padding:0}a.vimotia__widget__button,button.vimotia__widget__button{display:inline-block;height:auto;width:auto;padding:0 6px !important;margin:0;line-height:1.65em !important;border-radius:4px;font-size:inherit;font-weight:600;text-decoration:none;transition:all .3s ease-in;cursor:pointer}a.vimotia__widget__button:hover,button.vimotia__widget__button:hover{filter:brightness(125%)}button.vimotia__widget__button{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none}.vimotia__link-widget__icon_trigger_button{transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .3s}",""]),e.A=s},5601:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__widgetList__decoration{display:block !important;position:absolute;top:0;left:0;background-color:rgba(0,0,0,0);background-position:0 0;background-size:contain;width:100%;height:12%;max-height:50px;will-change:opacity,transform,brightness;opacity:1;transition:all cubic-bezier(0.42, 0, 0.15, 0.99) .2s}.vimotia__widgetList__decoration[data-link]{cursor:pointer}.vimotia__widgetList__decoration[data-link]:hover{filter:brightness(1.25)}.vimotia--hide-widgets .vimotia__widgetList__decoration{transform:translateY(-100%);opacity:0;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .6s,transform cubic-bezier(0.42, 0, 0.15, 0.99) .6s}",""]),e.A=s},8487:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__message-widget{color:var(--vimotia-message-widget-text-color, hsl(211, 0%, 23%));font-weight:var(--vimotia-message-widget-text-font-weight, 400)}.vimotia__message-widget[hidden]{display:none}",""]),e.A=s},2039:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__product-view__product-page-link{position:relative;width:100%;min-width:auto;padding:12px;display:grid;justify-content:center;align-items:center;border-radius:4px;font-family:inherit;font-size:14px;color:#3b3b3b;background-color:#fff;border:1px solid #3b3b3b;line-height:1.25;text-align:center;text-transform:uppercase;text-decoration:none;font-weight:600;letter-spacing:2px;cursor:pointer;outline:none;box-sizing:border-box;opacity:1;overflow:visible;-webkit-user-select:none;-moz-user-select:none;user-select:none;will-change:color,background-color,border-color;transition:color cubic-bezier(0.42, 0, 0.15, 0.99) .3s,background-color cubic-bezier(0.42, 0, 0.15, 0.99) .3s,border-color cubic-bezier(0.42, 0, 0.15, 0.99) .3s}.vimotia__product-view__product-page-link:hover{color:#080808;background-color:#e4e4e4;filter:brightness(1.1)}.vimotia__product-view__product-page-link[hidden]{display:none}",""]),e.A=s},9347:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__widgetList__sticker{display:grid;justify-content:flex-end;z-index:3;opacity:1;will-change:opacity;transition:opacity cubic-bezier(0.42, 0, 0.15, 0.99) .3s}.vimotia__widgetList__sticker[hidden]{display:block;opacity:0}.vimotia__widgetList__sticker-image-container{max-width:100px}.vimotia__widgetList__sticker-image{display:block !important;position:static !important;margin:0 !important;padding:0 !important;height:auto !important;max-height:100px !important;min-height:auto !important;width:auto !important;max-width:100% !important;min-width:auto !important;-o-object-fit:contain;object-fit:contain;background-color:rgba(0,0,0,0) !important;opacity:1 !important;transition:all .3s ease-in}.vimotia__widgetList__sticker-image[data-link]{cursor:pointer}.vimotia__widgetList__sticker-image[data-link]:hover{filter:brightness(1.25)}@media(max-width: 400px){.vimotia__widgetList__sticker-image{max-height:86px !important}}",""]),e.A=s},8631:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__stock-widget{display:grid;grid-template-columns:1fr max-content;grid-gap:8px;align-items:center;color:var(--vimotia-stock-text-color, hsl(211, 0%, 23%))}.vimotia__stock-widget[hidden]{display:none}.vimotia__stock-widget__progress-bar{box-sizing:border-box;width:100%;background-color:rgba(var(--vimotia-stock-progress-bar-color-rgb), 0.2);border-radius:10px;height:4px;position:relative;color:inherit;font-family:inherit;transform:translateY(-1px)}.vimotia__stock-widget__progress-bar[hidden]{display:none}.vimotia__stock-widget__progress-inner-bar{display:block !important;position:absolute;top:0;left:0;border-radius:8px;height:4px;width:100%;color:inherit;font-family:inherit;background-color:var(--vimotia-stock-progress-bar-color, red);transition:width 1.5s .5s cubic-bezier(0.68, 0.02, 0.24, 0.98)}.vimotia__stock-widget__quantity{display:inline-block;margin:0 4px;font-weight:600}",""]),e.A=s},3275:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia__timer-widget{display:flex;gap:4px;color:var(--vimotia-timer-widget-text-color, hsl(211, 0%, 23%))}.vimotia__timer-widget[hidden]{display:none}.vimotia__timer-widget__timer{display:inline-flex;font-variant-numeric:tabular-nums;color:var(--vimotia-timer-widget-digit-color, hsl(211, 0%, 23%))}",""]),e.A=s},6142:function(t,e,i){"use strict";var r=i(9248),n=i.n(r),a=i(9089),s=i.n(a)()(n());s.push([t.id,".vimotia-icon{min-width:auto;display:flex;align-items:center;justify-content:center;border:1px solid rgba(0,0,0,0);border-radius:50%;line-height:1;color:currentColor;fill:currentColor;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;user-select:none;overflow:visible;-webkit-appearance:none;-moz-appearance:none;appearance:none;box-sizing:border-box}.vimotia-icon[hidden]{display:none !important}.vimotia-icon svg{width:16px;height:16px}@media(min-width: 600px){.vimotia-icon svg{width:24px;height:24px}}.vimotia-icon svg g{fill:currentColor}.vimotia-icon__image{display:block;width:100%}.vimotia-icon--round{width:48px;height:48px;padding:14px;background-color:rgba(255,255,255,.15) !important}.vimotia-icon--large svg,.vimotia-icon--large img{width:24px;height:24px}.vimotia-icon--medium svg,.vimotia-icon--medium img{width:16px;height:16px}.vimotia-icon--small svg,.vimotia-icon--small img{width:12px;height:12px}",""]),e.A=s},5072:function(t){"use strict";var e=[];function i(t){for(var i=-1,r=0;r0?" ".concat(i.layer):""," {")),r+=i.css,n&&(r+="}"),i.media&&(r+="}"),i.supports&&(r+="}");var a=i.sourceMap;a&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(a))))," */")),e.styleTagTransform(r,t,e.options)}(e,t,i)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}},1113:function(t){"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}}},e={};function i(r){var n=e[r];if(void 0!==n)return n.exports;var a=e[r]={id:r,loaded:!1,exports:{}};return t[r].call(a.exports,a,a.exports,i),a.loaded=!0,a.exports}i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,{a:e}),e},i.d=function(t,e){for(var r in e)i.o(e,r)&&!i.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:e[r]})},i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nmd=function(t){return t.paths=[],t.children||(t.children=[]),t},i.nc=void 0,function(){"use strict";var t={};i.r(t),i.d(t,{hasBrowserEnv:function(){return br},hasStandardBrowserEnv:function(){return _r},hasStandardBrowserWebWorkerEnv:function(){return Cr}});const e="HT_VIMOTIA_CORE_INIT",r="blog",n="collection",a="home",s="page",o="product",l="no_logo";class c{constructor(){this.staticSrcUrlConstants={STAGING:"https://cdn3.hexjerry.com",PRODUCTION:"https://cdn5.hextom.com"},this.apiBaseUrlConstants={STAGING:"https://vimotia.hexjerry.com",PRODUCTION:"https://vimotia.hextom.com"}}get staticSrcBaseUrl(){return c.isDevelopment()||c.isStaging()?this.staticSrcUrlConstants.STAGING:this.staticSrcUrlConstants.PRODUCTION}get apiBaseUrl(){return c.isDevelopment()||c.isStaging()?this.apiBaseUrlConstants.STAGING:this.apiBaseUrlConstants.PRODUCTION}get apiConstants(){return{MORE_RELATED_VIDEOS:"/gs",MORE_GALLERY_VIDEOS:"/gm",ANALYTICS_START:"/s",ANALYTICS_PLAYING:"/k",TRACK_ORDER:"/t"}}static isDebugOn(){return!1}static isDevelopment(){return!1}static isStaging(){return!1}static getPlatformEnvSetting(){return"shopify"}}var d=c;const u=t=>null!=t?t.constructor:null,h=(t,e)=>Boolean(t&&e&&t instanceof e),p=t=>null==t,g=t=>u(t)===Object,f=t=>u(t)===String,m=t=>Array.isArray(t),v=t=>h(t,NodeList),y=t=>p(t)||(f(t)||m(t)||v(t))&&!t.length||g(t)&&!Object.keys(t).length;var A={nullOrUndefined:p,object:g,number:t=>u(t)===Number&&!Number.isNaN(t),string:f,boolean:t=>u(t)===Boolean,function:t=>u(t)===Function,array:m,weakMap:t=>h(t,WeakMap),nodeList:v,element:t=>h(t,Element),textNode:t=>u(t)===Text,event:t=>h(t,Event),keyboardEvent:t=>h(t,KeyboardEvent),cue:t=>h(t,window.TextTrackCue)||h(t,window.VTTCue),track:t=>h(t,TextTrack)||!p(t)&&f(t.kind),promise:t=>h(t,Promise),url:t=>{if(h(t,window.URL))return!0;if(!f(t))return!1;let e=t;t.startsWith("http://")&&t.startsWith("https://")||(e=`http://${t}`);try{return!y(new URL(e).hostname)}catch(t){return!1}},empty:y,zero:t=>f(t)?0===parseInt(t,10):0===t};const b="[Vimotia]",_="VimotiaLogger",w=()=>{};class C{constructor(){this.enabled=window.console&&d.isDebugOn()}get log(){return this.enabled?Function.prototype.bind.call(console.log,console,b):w}get warn(){return this.enabled?Function.prototype.bind.call(console.warn,console,b):w}get error(){return this.enabled?Function.prototype.bind.call(console.error,console,b):w}}function E(){let t=window[_];return A.nullOrUndefined(t)?(t=new C,window[_]=t,t):t}function T(){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",e=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").replace(new RegExp(t.toString().replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1"),"g"),e.toString())}function I(t){return JSON.parse(JSON.stringify(t))}function S(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;r{A.object(n[e])?(Object.keys(t).includes(e)||Object.assign(t,{[e]:{}}),S(t[e],n[e])):Object.assign(t,{[e]:n[e]})})),S(t,...i)):t}class x{constructor(t){this.key=t,this.TIMESTAMP_KEY="timestamp",this.MAX_AGE_MILLISECONDS=864e5,this.setTimestampIfNotPresent()}static get supported(){try{if(!("localStorage"in window))return!1;const t="___test";return window.localStorage.setItem(t,t),window.localStorage.removeItem(t),!0}catch(t){return!1}}get(t){if(!x.supported)return null;const e=window.localStorage.getItem(this.key);if(A.empty(e))return null;const i=JSON.parse(e);return A.string(t)&&t.length?i[t]:i}set(t){if(!x.supported)return;if(!A.object(t))return;let e=this.get();A.empty(e)&&(e={}),S(e,t),window.localStorage.setItem(this.key,JSON.stringify(e))}isExpired(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.MAX_AGE_MILLISECONDS,e=this.get(this.TIMESTAMP_KEY);const i=+new Date;return A.nullOrUndefined(e)?(this.set({[this.TIMESTAMP_KEY]:i}),!1):(A.string(e)&&(e=parseInt(e,10)),i-e>=t)}getExpireTime(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this.MAX_AGE_MILLISECONDS,e=this.get(this.TIMESTAMP_KEY);const i=+new Date;return A.nullOrUndefined(e)&&this.set({[this.TIMESTAMP_KEY]:i}),A.string(e)&&(e=parseInt(e,10)),e+t}refresh(){window.localStorage.removeItem(this.key),this.set({[this.TIMESTAMP_KEY]:+new Date})}setTimestampIfNotPresent(){const t=this.get(this.TIMESTAMP_KEY);A.nullOrUndefined(t)&&this.set({[this.TIMESTAMP_KEY]:+new Date})}}var k=x;const P="--vimotia-floating-connect-bg-color-rgb",D="--vimotia-button-space-x",L="--vimotia-button-space-y",B="floating",O="custom",R="embed";var M={isIE:!!document.documentMode,isEdge:window.navigator.userAgent.includes("Edge"),isWebkit:"WebkitAppearance"in document.documentElement.style&&!/Edge/.test(navigator.userAgent),isIPhone:/(iPhone|iPod)/gi.test(navigator.platform),isIos:/(iPad|iPhone|iPod)/gi.test(navigator.platform),isIPad:Boolean(navigator.userAgent.match(/Mac/)&&navigator.maxTouchPoints&&navigator.maxTouchPoints>2),isSafari:/^((?!chrome|android).)*safari/i.test(navigator.userAgent)},N=i(6820);class F{constructor(t){this.key=t}static get supported(){const t=E();try{if(!("sessionStorage"in window))return t.error("sessionStorage not in window"),!1;const e="___test";return window.sessionStorage.setItem(e,e),window.sessionStorage.removeItem(e),!0}catch(e){return t.error("sessionStorage not supported"),!1}}get(t){if(!F.supported)return null;const e=window.sessionStorage.getItem(this.key);if(A.empty(e))return null;const i=JSON.parse(e);return A.string(t)&&t.length?i[t]:i}set(t){if(!F.supported)return;if(!A.object(t))return;let e=this.get();A.empty(e)&&(e={}),e=(0,N.merge)(e,t),window.sessionStorage.setItem(this.key,JSON.stringify(e))}}var U=F;const V="VimotiaStates",j="shouldShowSwipeInstruction",Q="swipeInstructionCreateTimeStamp",G="swipeInstructionCloseTimeStamp",H="logoConfig",W="logoPath",z="isMobile",K="isAppleDevice",q="isLazyLoading",Y="isSwipeVideoOn",J="collectionAutoPlayTimer",X="picInPicClosed",$="isMuted";class Z{constructor(){this.logger=E(),this.cache=new k("vimotia-states"),this.sessionCache=new U("vimotia-session-states"),this.init()}init(){this.isMobile=Z.isMobileDevice(),this.isAppleDevice=M.isIos||M.isIPad,this.isLazyLoading=!this.isAppleDevice,this.collectionAutoPlayTimer=-1}static isMobileDevice(){return function(){let t=!1;return(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|ipad|iris|kindle|Android|Silk|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(navigator.userAgent)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i.test(navigator.userAgent.substr(0,4)))&&(t=!0),t}()||(A.nullOrUndefined(window.visualViewport)?window.innerWidth:window.visualViewport.width)<=900}set(t){try{return this.cache.set(t),!0}catch(t){return this.logger.error("Fail saving cache"),this.logger.error(t),!1}}get shouldShowSwipeInstruction(){const t=this.cache.get(j);return A.nullOrUndefined(t)?(this.logger.error("Expect SHOULD_SHOW_SWIPE_INSTRUCTION set before get"),!1):this.cache.get(j)}set shouldShowSwipeInstruction(t){this.cache.set({[j]:t})}get swipeHintDismissedTimestamp(){const t=this.cache.get(G);return A.empty(t)?0:t}set swipeHintDismissedTimestamp(t){this.cache.set({[G]:t})}get swipeHintCreated(){const t=this.cache.get(Q);return!A.empty(t)}set swipeHintCreated(t){this.cache.set({[Q]:!0})}get logoConfig(){const t=this.cache.get(H);return A.nullOrUndefined(t)?(this.logger.error("Expect BRANDING_TYPE set before get"),l):this.cache.get(H)}set logoConfig(t){this.cache.set({[H]:t})}get logoPath(){const t=this.cache.get(W);return A.nullOrUndefined(t)?(this.logger.error("Expect LOGO_PATH set before get"),""):this.cache.get(W)}set logoPath(t){this.cache.set({[W]:t})}get isMobile(){const t=this.cache.get(z);return A.nullOrUndefined(t)?(this.logger.error("Expect IS_MOBILE set before get"),!1):this.cache.get(z)}set isMobile(t){this.cache.set({[z]:t})}get isAppleDevice(){const t=this.cache.get(K);return A.nullOrUndefined(t)?(this.logger.error("Expect IS_APPLE_DEVICE set before get"),!1):this.cache.get(K)}set isAppleDevice(t){this.cache.set({[K]:t})}get isLazyLoading(){const t=this.cache.get(q);return A.nullOrUndefined(t)?(this.logger.error("Expect IS_LAZY_LOADING set before get"),!1):this.cache.get(q)}set isLazyLoading(t){this.cache.set({[q]:t})}get isSwipeVideoOn(){const t=this.cache.get(Y);return A.nullOrUndefined(t)?(this.logger.error("Expect IS_SWIPE_VIDEO_ON set before get"),!1):this.cache.get(Y)}set isSwipeVideoOn(t){this.cache.set({[Y]:t})}get collectionAutoPlayTimer(){const t=this.cache.get(J);return A.nullOrUndefined(t)?(this.logger.error("Expect COLLECTION_AUTO_PLAY_TIMER set before get"),-1):this.cache.get(J)}set collectionAutoPlayTimer(t){this.cache.set({[J]:t})}clearCollectionAutoPlayTimer(){-1!==this.collectionAutoPlayTimer&&(window.clearTimeout(this.collectionAutoPlayTimer),this.collectionAutoPlayTimer=-1)}get isFirstCollectionAutoPlay(){return-1===this.collectionAutoPlayTimer}get picInPicClosed(){return!0===this.sessionCache.get(X)}set picInPicClosed(t){this.sessionCache.set({[X]:t})}get isMuted(){return!0===this.sessionCache.get($)}set isMuted(t){this.sessionCache.set({[$]:t})}}function tt(){let t=window[V];return A.nullOrUndefined(t)?(t=new Z,window[V]=t,t):t}var et=i(5072),it=i.n(et),rt=i(7825),nt=i.n(rt),at=i(7659),st=i.n(at),ot=i(5056),lt=i.n(ot),ct=i(540),dt=i.n(ct),ut=i(1113),ht=i.n(ut),pt=i(4720),gt={};gt.styleTagTransform=ht(),gt.setAttributes=lt(),gt.insert=st().bind(null,"head"),gt.domAPI=nt(),gt.insertStyleElement=dt(),it()(pt.A,gt),pt.A&&pt.A.locals&&pt.A.locals;const ft=(()=>{let t=!1;try{const e=Object.defineProperty({},"passive",{get(){return t=!0,null}});window.addEventListener("test",null,e),window.removeEventListener("test",null,e)}catch(t){}return t})();function mt(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],a=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(!t||!("addEventListener"in t)||A.empty(e)||!A.function(i))return;const s=e.split(" ");let o=a;ft&&(o={passive:n,capture:a}),s.forEach((e=>{this&&this.eventListeners&&r&&this.eventListeners.push({element:t,type:e,callback:i,options:o}),t[r?"addEventListener":"removeEventListener"](e,i,o)}))}function vt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];mt.call(this,t,e,i,!0,r,n)}function yt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2?arguments[2]:void 0,r=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],n=arguments.length>4&&void 0!==arguments[4]&&arguments[4];mt.call(this,t,e,i,!1,r,n)}function At(t){var e=this;let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2?arguments[2]:void 0,n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],a=arguments.length>4&&void 0!==arguments[4]&&arguments[4];const s=function(){yt(t,i,s,n,a);for(var o=arguments.length,l=new Array(o),c=0;c1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};if(!A.element(t)||A.empty(e))return;const n=new CustomEvent(e,{bubbles:i,detail:{...r,vimotia:this}});t.dispatchEvent(n)}function _t(){this&&this.eventListeners&&(this.eventListeners.forEach((t=>{const{element:e,type:i,callback:r,options:n}=t;e.removeEventListener(i,r,n)})),this.eventListeners=[])}function wt(){return new Promise((t=>this.ready?setTimeout(t,0):vt.call(this,this.elements.container,"ready",t))).then((()=>{}))}function Ct(t,e){A.element(t)&&!A.empty(e)&&Object.entries(e).filter((t=>{let[,e]=t;return!A.nullOrUndefined(e)})).forEach((e=>{let[i,r]=e;return t.setAttribute(i,r)}))}function Et(t,e){A.element(t)&&!A.empty(e)&&Object.entries(e).filter((t=>{let[,e]=t;return!A.nullOrUndefined(e)})).forEach((e=>{let[i]=e;return t.removeAttribute(i)}))}function Tt(t,e,i,r){let n;return n=r?document.createElementNS("http://www.w3.org/2000/svg",t):document.createElement(t),A.object(e)&&Ct(n,e),A.string(i)&&(n.innerText=i),n}function It(t){A.nodeList(t)||A.array(t)?Array.from(t).forEach(It):A.element(t)&&A.element(t.parentNode)&&t.parentNode.removeChild(t)}function St(t){if(!A.element(t))return;let{length:e}=t.childNodes;for(;e>0;)t.removeChild(t.lastChild),e-=1}function xt(t,e){if(!A.string(t)||A.empty(t))return{};const i={},r=S({},e);return t.split(",").forEach((t=>{const e=t.trim(),n=e.replace(".",""),a=e.replace(/[\[\]]/g,"").split("="),[s]=a,o=a.length>1?a[1].replace(/["']/g,""):"",l=e.charAt(0);"."===l?A.string(r.class)?i.class=`${r.class} ${n}`:i.class=n:"#"===l?i.id=e.replace("#",""):"["===l&&(i[s]=o)})),S(r,i)}function kt(t,e){if(A.nodeList(t)||A.array(t))return void Array.from(t).map((t=>kt(t,e)));if(!A.element(t))return;let i=e;A.boolean(i)||(i=!t.hidden),t.hidden=i}function Pt(t,e,i){if(A.nodeList(t))return Array.from(t).map((t=>Pt(t,e,i)));if(A.element(t)){let r="toggle";return void 0!==i&&(r=i?"add":"remove"),t.classList[r](e),t.classList.contains(e)}return!1}function Dt(t,e){return A.element(t)&&t.classList.contains(e)}function Lt(t,e){const i={Element:Element};return(i.matches||i.webkitMatchesSelector||i.mozMatchesSelector||i.msMatchesSelector||function(){return Array.from(document.querySelectorAll(e)).includes(this)}).call(t,e)}function Bt(t){return this.elements.container.querySelectorAll(t)}function Ot(t){return this.elements.container.querySelector(t)}function Rt(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!A.element(t))return;const i=Ot.call(this,"button:not(:disabled), input:not(:disabled), [tabindex]"),r=i[0],n=i[i.length-1];mt.call(this,this.elements.container,"keydown",(t=>{if("Tab"!==t.key)return;const e=document.activeElement;e!==n||t.shiftKey?e===r&&t.shiftKey&&(n.focus(),t.preventDefault()):(r.focus(),t.preventDefault())}),e,!1)}function Mt(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];A.element(t)&&(t.focus({preventScroll:!0}),e&&Pt(t,this.config.classNames.tabFocus))}function Nt(t){return document.evaluate(t,document,null,XPathResult.FIRST_ORDERED_NODE_TYPE,null).singleNodeValue}function Ft(t,e){if(!A.element(t))return!1;const i=t;return Object.keys(e).forEach((t=>{i.style[t]=e[t]})),!0}function Ut(t,e){Object.keys(e).forEach((i=>{t.style.setProperty(`${i}`,e[i])}))}const Vt=t=>Math.trunc(t/60/60%60);function jt(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(!A.number(t))return jt(null,e,i);const r=t=>`0${t}`.slice(-2);let n=Vt(t);const a=(s=t,Math.trunc(s/60%60));var s;const o=(t=>Math.trunc(t%60))(t);return n=e||n>0?`${n}:`:"",`${i&&t>0?"-":""}${n}${r(a)}:${r(o)}`}function Qt(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:300;return new Promise((e=>{window.setTimeout(e,t)}))}async function Gt(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:100,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,r=t();if(r)return!0;for(let n=0;n0&&void 0!==arguments[0]?arguments[0]:300;await Qt(t)}static async waitToStartAnimation(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:300;await Qt(t)}}const Wt=(()=>{const t=document.createElement("span"),e={WebkitTransition:"webkitTransitionEnd",MozTransition:"transitionend",OTransition:"oTransitionEnd otransitionend",transition:"transitionend"},i=Object.keys(e).find((e=>void 0!==t.style[e]));return!!A.string(i)&&e[i]})();function zt(t){setTimeout((()=>{try{t.hidden=!0,t.offsetHeight,t.hidden=!1}catch(t){}}),arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}var Kt=i(6142),qt={};qt.styleTagTransform=ht(),qt.setAttributes=lt(),qt.insert=st().bind(null,"head"),qt.domAPI=nt(),qt.insertStyleElement=dt(),it()(Kt.A,qt),Kt.A&&Kt.A.locals&&Kt.A.locals;const Yt="vimotia-icon",Jt="vimotia-icon--round",Xt="vimotia-icon--medium",$t="vimotia-icon--small";class Zt{static createRoundArrow(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Zt.createArrow([Jt,...t])}static createArrow(){const t=Tt("div",{class:`${Yt} ${(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).join(" ")}`,"aria-label":"Arrow"});return t.innerHTML=Zt.createArrowIcon(),t}static createArrowIcon(){return`\n \n \n \n `}static createArrowWithTailIcon(){return`\n \n \n \n `}static createBack(){const t=Tt("div",{type:"button",class:`${Yt} ${(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).join(" ")}`,"aria-label":"Back"});return t.innerHTML=Zt.createArrowWithTailIcon(),t}static createBagMedium(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Zt.createBag([Xt,...t])}static createBag(){const t=Tt("div",{class:`${Yt} ${(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).join(" ")}`,"aria-label":"Shopping Bag"});return t.innerHTML=Zt.createBagIcon(),t}static createBagIcon(){return`\n \n \n \n \n \n \n \n `}static createCartSmall(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Zt.createCart([$t,...t])}static createCartMedium(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Zt.createCart([Xt,...t])}static createCart(){const t=Tt("div",{class:`${Yt} ${(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).join(" ")}`,"aria-label":"Cart"});return t.innerHTML=Zt.createCartIcon(),t}static createCartIcon(){return`\n \n \n \n \n \n \n \n `}static createNotificationIcon(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.createImageRoundIcon(t,"Notification","annotation-link-v1.png")}static createCheckIcon(){return'\n \n \n check\n \n \n \n \n \n \n \n \n \n \n \n \n '}static createRoundClose(t){return Zt.createClose([Jt,...t])}static createClose(t){const e=Tt("button",{type:"button",class:`${Yt} ${t.join(" ")}`,"aria-label":"Close"}),i=Zt.createCloseIcon();return e.appendChild(i),e}static createCloseIcon(){const t=Tt("svg",{x:"0px",y:"0px",viewBox:"0 0 123 123","enable-background":"new 0 0 123 123"},"",!0),e=Tt("g",{},"",!0),i=Tt("path",{d:"M121.325,10.925l-8.5-8.399c-2.3-2.3-6.1-2.3-8.5,0l-42.4,42.399L18.726,1.726c-2.301-2.301-6.101-2.301-8.5,0l-8.5,8.5c-2.301,2.3-2.301,6.1,0,8.5l43.1,43.1l-42.3,42.5c-2.3,2.3-2.3,6.1,0,8.5l8.5,8.5c2.3,2.3,6.1,2.3,8.5,0l42.399-42.4l42.4,42.4c2.3,2.3,6.1,2.3,8.5,0l8.5-8.5c2.3-2.3,2.3-6.1,0-8.5l-42.5-42.4l42.4-42.399C123.625,17.125,123.625,13.325,121.325,10.925z"},"",!0);return e.appendChild(i),t.appendChild(e),t}static createDiscount(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.createImageRoundIcon(t,"Discount","discount-tag-v1.png")}static createExpand(){const t=Tt("button",{type:"button",class:`${(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).join(" ")}`,"aria-label":"Expand"}),e=Zt.createExpandIcon();return t.appendChild(e),t}static createExpandIcon(){const t=Tt("svg",{x:"0px",y:"0px",viewBox:"0 0 384 384","enable-background":"new 0 0 512 512",class:"expand__svg-icon"},"",!0),e=Tt("polygon",{points:"234.667,0 234.667,42.667 311.147,42.667 101.44,252.373 131.627,282.56 341.333,72.853 341.333,149.333 384,149.333 384,0","data-original":"#000000","data-old_color":"#000000",fill:"#ffffff"},"",!0),i=Tt("path",{d:"M341.333,341.333H42.667V42.667H192V0H42.667C19.093,0,0,19.093,0,42.667v298.667C0,364.907,19.093,384,42.667,384 h298.667C364.907,384,384,364.907,384,341.333V192h-42.667V341.333z","data-original":"#000000","data-old_color":"#000000",fill:"#ffffff"},"",!0);return t.appendChild(e),t.appendChild(i),t}static createLabelIcon(){return'\n \n \n label\n \n \n \n \n \n \n \n \n '}static createLinkOutIcon(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Zt.createImageIcon([$t,...t],"Link Out","link-out-v1.png")}static createNotification(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.createImageRoundIcon(t,"Message Notification","annotation-link-v1.png")}static createPlayIcon(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};const{circleClass:e,circleSvg:i,triangleSvg:r,triangleBorderSvg:n}=t,a=Tt("div",{class:e}),s=Tt("svg",{x:"0px",y:"0px",width:"18px",height:"22px",viewBox:"0 0 18 22",version:"1.1",xmlns:'xlink="http://www.w3.org/1999/xlink"',class:i},"",!0),o=Tt("path",{d:"M19.0558064,13.5007448 C19.3212746,13.5104115 19.5845471,13.5903873 19.8114417,13.7385673 L19.8114417,13.7385673 L33.8116475,22.7387198 C34.2394337,23.0140667 34.5000312,23.4902707 34.5000312,24 C34.5000312,24.5096824 34.2395101,24.9857435 33.8114105,25.2614327 L33.8114105,25.2614327 L19.8131353,34.2603392 C19.5665693,34.4202548 19.2819063,34.5000312 19.0000313,34.5000312 C18.3656136,34.2975369 18.0722673,34.1073014 17.8827268,33.9177609 C17.5924036,33.6274377 17.5,33.3204441 17.5,33 L17.5,33 L17.5,15 C17.5,14.7252007 17.5748761,14.4617686 17.7101376,14.2340635 C17.8452212,14.0066578 18.0405698,13.8148109 18.2807962,13.6838 C18.5195584,13.55264 18.7886194,13.4910155 19.0558064,13.5007448 Z",class:r},"",!0),l=Tt("g",{transform:"translate(706, 428)"},"",!0),c=Tt("g",{transform:"translate(-723, -441)","fill-rule":"nonzero",class:n},"",!0);return l.appendChild(o),c.appendChild(l),s.appendChild(c),a.appendChild(s),a}static createPlayArrowIcon(){return`\n \n \n \n \n \n `}static createSound(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.createImageRoundIcon(t,"Sound","sound-v1.png")}static createSoundMute(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return this.createImageRoundIcon(t,"Unmute","mute-v1.png")}static createSwipeUpHandLine(){const t=Tt("svg",{x:"0px",y:"0px",viewBox:"0 0 1334 1024","enable-background":"new 0 0 1334 1024",class:`${(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).join(" ")}`},"",!0),e=Tt("g",{},"",!0),i=Tt("path",{d:"M798.782061 958.712242l-1.024-0.682666c-1.365333-0.961939-3.475394-2.01697-5.306182-2.978909l-0.713697-0.465455c-0.961939-0.589576-2.07903-1.148121-2.947879-1.768727l-4.840727-2.854788-0.527515-0.248242-243.743031-152.234667a129.520485 129.520485 0 0 1-57.250909-78.78594 126.417455 126.417455 0 0 1 12.846546-95.573333 120.149333 120.149333 0 0 1 106.52703-59.45406L431.569455 198.656c-29.820121-63.363879-6.11297-137.464242 52.658424-164.83297 58.709333-27.368727 130.761697 2.048 160.395636 65.567031l54.675394 117.294545a94.332121 94.332121 0 0 1 24.762182-16.849454c27.772121-12.970667 60.291879-11.791515 89.584485 2.637575 10.022788-16.384 24.420848-29.478788 41.580606-37.732848a97.745455 97.745455 0 0 1 63.860363-6.206061c16.725333 3.878788 32.768 11.481212 46.917819 22.372849 7.354182-6.795636 15.670303-12.474182 24.669091-16.694303 54.737455-25.506909 123.314424 5.523394 152.948363 69.073454l143.049697 306.765576c31.650909 67.863273 36.615758 156.889212 12.722424 226.831515-13.312 38.974061-34.257455 66.870303-59.174787 78.506667L937.115152 986.701576c-56.785455 26.499879-101.965576-3.723636-138.364122-27.989334z m421.205333-172.900848c9.18497-4.313212 24.855273-30.316606 31.464727-74.78303 6.919758-47.879758 0.217212-98.241939-18.307879-137.960728l-147.176727-315.578181c-12.008727-25.786182-38.384485-40.773818-56.506182-32.302546a26.686061 26.686061 0 0 0-10.084848 8.285091l51.448242 110.374788-0.124121 0.06206c7.323152 19.083636-0.806788 40.339394-18.680242 48.810667-17.966545 8.378182-39.749818 0.744727-49.493334-17.035636l-0.06206 0.03103-44.652606-95.728485-14.584243-25.941333c-12.908606-23.117576-37.360485-35.529697-54.489212-27.523879-7.571394 3.506424-13.436121 11.357091-16.290909 21.255758l55.637333 119.373575c9.060848 19.549091 1.117091 42.480485-17.749333 51.293091-18.866424 8.719515-41.518545 0.062061-50.672485-19.393939l-48.934788-105.006545-8.316121-11.077819c-13.746424-18.432-35.064242-27.182545-49.493333-20.48-9.836606 4.592485-16.446061 16.135758-17.811394 30.626909l54.116848 118.877091 20.790303 44.528485c8.067879 17.283879 0.930909 37.85697-15.763394 45.645576l-7.416242 3.475394c-16.756364 7.819636-37.019152 0-45.08703-17.283879l-165.701819-355.390061-6.019878-12.412121c-12.412121-26.59297-41.115152-39.408485-64.201697-28.672-23.086545 10.767515-31.681939 41.084121-19.331879 67.615031l162.536727 344.622545c0.589576 1.024 1.117091 2.07903 1.613576 3.134061l63.891394 137.029818c7.943758 17.749333 2.07903 38.446545-13.777455 48.593454a37.85697 37.85697 0 0 1-49.400242-8.25406l-30.906182-32.768a51.293091 51.293091 0 0 0-39.222303-6.671515 49.958788 49.958788 0 0 0-31.650909 23.58303c-14.398061 24.793212-6.11297 57.344 18.494061 72.766061l251.097212 156.578909 0.775757 0.403394 3.103031 1.954909 3.847757 2.389333c2.420364 1.551515 4.902788 3.04097 7.012849 4.096l1.520484 0.775758 1.427394 1.241212c40.339394 26.996364 52.906667 31.030303 70.190546 22.962424L1220.111515 785.997576l-0.124121-0.248243v0.062061z","data-original":"#000000","data-old_color":"#000000",fill:"#ffffff"},"",!0),r=Tt("path",{d:"M257.861818 158.068364l77.482667 41.208242a6.206061 6.206061 0 0 0 8.843636-7.292121L295.96703 34.195394a6.206061 6.206061 0 0 0-7.757575-4.12703L130.420364 78.320485a6.206061 6.206061 0 0 0-1.086061 11.388121l73.479758 39.098182a1189.515636 1189.515636 0 0 0-192.077576 535.117576 1207.233939 1207.233939 0 0 0-6.516364 139.729454c-1.799758 17.066667 13.156848 32.581818 28.827152 34.226424 15.670303 1.644606 33.543758-9.712485 33.450666-27.67903 0-1.427394-0.062061-2.792727-0.186181-4.189091-0.620606-44.714667 1.365333-89.987879 6.17503-135.602424a1127.641212 1127.641212 0 0 1 185.40606-512.310303z","data-original":"#000000","data-old_color":"#000000",fill:"#ffffff"},"",!0);return e.appendChild(i),e.appendChild(r),t.appendChild(e),t}static CreateSwipeUpHandSolid(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];return Zt.createImageIcon(t,"Swipe Up","swipe-up-v2.png")}static createImageRoundIcon(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";return Zt.createImageIcon([Jt,...t],e,i)}static createImageIcon(t,e,i){const r=Tt("div",{class:`${Yt} ${t.join(" ")}`,"aria-label":e}),n=Tt("img",{class:"vimotia-icon__image",src:`${(new d).staticSrcBaseUrl}/img/frontend_player_icons/${i}`});return r.appendChild(n),r}}var te=Zt,ee=i(7695),ie={};ie.styleTagTransform=ht(),ie.setAttributes=lt(),ie.insert=st().bind(null,"head"),ie.domAPI=nt(),ie.insertStyleElement=dt(),it()(ee.A,ie),ee.A&&ee.A.locals&&ee.A.locals;var re=i(3051),ne={};ne.styleTagTransform=ht(),ne.setAttributes=lt(),ne.insert=st().bind(null,"head"),ne.domAPI=nt(),ne.insertStyleElement=dt(),it()(re.A,ne),re.A&&re.A.locals&&re.A.locals;var ae=i(8487),se={};se.styleTagTransform=ht(),se.setAttributes=lt(),se.insert=st().bind(null,"head"),se.domAPI=nt(),se.insertStyleElement=dt(),it()(ae.A,se),ae.A&&ae.A.locals&&ae.A.locals;class oe{constructor(t){this.logger=E(),this.data=oe.processData(t),this.elements={container:null},this.classNames={container:"vimotia__message-widget"},this.init()}init(){this.container=this.createMessageContainer(),this.toggleDisplay()}createMessageContainer(){return Tt("div",{class:this.classNames.container,style:this.cssVariables},this.data.content)}toggleDisplay(){this.enable?this.show():this.hide()}hide(){kt(this.container,!0)}show(){kt(this.container,!1)}get container(){return this.elements.container}set container(t){this.elements.container=t}get enable(){return this.data.enable}get cssVariables(){return`\n --vimotia-message-widget-text-color: ${this.data.textColor};\n --vimotia-message-widget-text-font-weight: ${this.fontWeightConfigToCSS(this.data.textFontWeight)};\n `}fontWeightConfigToCSS(t){switch(t){case"regular":return"regular";case"bold":return"bold";default:return this.logger.error(`Unknown font weight config ${t}`),"regular"}}static processData(t){return{enable:t.message_enable,content:t.message_content,textColor:t.message_content_color,textFontWeight:t.message_content_font_weight}}}var le=oe,ce=i(8631),de={};function ue(t){if(A.empty(t))return"255, 255, 255";let e=t;e.length>7&&(e=e.substring(0,7));const i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(e),r=i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:{r:0,g:0,b:0};return`${r.r}, ${r.g}, ${r.b}`}function he(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,i=t.replace("#","");3===i.length&&(i=`${i[0]}${i[0]}${i[1]}${i[1]}${i[2]}${i[2]}`);const r=parseInt(i.substring(0,2),16),n=parseInt(i.substring(2,4),16),a=parseInt(i.substring(4,6),16);let s=parseInt(i.substring(6,8),16);return A.number(s)||(s=1),s=Math.min(s,e),`rgba(${r},${n},${a},${s})`}function pe(t){let e=t.toLowerCase();return e.length>7&&(e=e.substring(0,7)),["#fff","#ffffff"].includes(e)}de.styleTagTransform=ht(),de.setAttributes=lt(),de.insert=st().bind(null,"head"),de.domAPI=nt(),de.insertStyleElement=dt(),it()(ce.A,de),ce.A&&ce.A.locals&&ce.A.locals;const ge="Product Details",fe="data-vimotia-widget-id",me={GOTO_CART_PAGE:"goto_cart_page",NOTICE:"notice"},ve="VimotiaATCWidgetAddToCart",ye="VimotiaATCWidgetClick",Ae="VimotiaAnnotationLinkWidgetClick",be="VimotiaAnnotationLinkWidgetTogglePlaying",_e="VimotiaAnnotationLinkWidgetToggleEnd",we="VimotiaDecorationWidgetClick",Ce="VimotiaStickerWidgetClick";class Ee{constructor(t){this.logger=E(),this.data=Ee.processData(t),this.elements={container:null,quantity:null,innerBar:null},this.classNames={container:"vimotia__stock-widget",bar:"vimotia__stock-widget__progress-bar",innerBar:"vimotia__stock-widget__progress-inner-bar",text:"vimotia__stock-widget__text",textBefore:"vimotia__stock-widget__text-before",textAfter:"vimotia__stock-widget__text-after",quantity:"vimotia__stock-widget__quantity"},this.init()}init(){const{container:t,quantity:e,bar:i,innerBar:r}=this.createContainer();this.container=t,this.quantityNumberContainer=e,this.innerBarContainer=r,this.toggleProgressBar(i)}createContainer(){const t=Tt("div",{class:this.classNames.container,style:Ee.cssVariables(this.data)}),e=Tt("div",{class:this.classNames.bar}),i=Tt("div",{class:this.classNames.innerBar}),r=Tt("span",{class:this.classNames.textBefore},this.data.textBeforeNumber),n=Tt("div",{class:this.classNames.text}),a=Tt("span",{class:this.classNames.textAfter},this.data.textAfterNumber),s=Tt("div",{class:this.classNames.quantity});return e.appendChild(i),n.append(r,s,a),t.append(e,n),{container:t,quantity:s,bar:e,innerBar:i}}toggleProgressBar(t){this.progressBarEnable?kt(t,!1):kt(t,!0)}setQuantity(t){this.toggleDisplay(t),this.setQuantityToContainer(t),this.setBarFillWidth(this.getBarFillWidth(t))}toggleDisplay(t){this.shouldShow(t)?this.show():this.hide()}shouldShow(t){return this.enable&&this.isInThreshold(t)}hide(){kt(this.container,!0)}show(){kt(this.container,!1)}setQuantityToContainer(t){this.quantityNumberContainer.textContent=`${t}`}getBarFillWidth(t){return t<=0?0:this.isOverThreshold(t)?35:this.calculateBarFillWidth(t)}isOverThreshold(t){return!this.isInThreshold(t)}isInThreshold(t){return t>0&&t<=this.data.threshold}calculateBarFillWidth(t){const e=Math.round(35*(t/this.data.threshold).toFixed(2));return Math.max(e,5)}setBarFillWidth(t){Ft(this.innerBarContainer,{width:`${t}%`})}get container(){return this.elements.container}set container(t){this.elements.container=t}get quantityNumberContainer(){return this.elements.quantity}set quantityNumberContainer(t){this.elements.quantity=t}get innerBarContainer(){return this.elements.innerBar}set innerBarContainer(t){this.elements.innerBar=t}get enable(){return this.data.enable}get progressBarEnable(){return this.data.progressBarEnable}static cssVariables(t){return`\n --vimotia-stock-text-color: ${t.textColor};\n --vimotia-stock-progress-bar-color: ${t.progressBarThemeColor};\n --vimotia-stock-progress-bar-color-rgb: ${t.progressBarThemeColorInRGB};\n `}static processData(t){return{enable:t.stock_enable,threshold:t.stock_threshold,textBeforeNumber:t.stock_before,textAfterNumber:t.stock_after,textColor:t.stock_text_color,progressBarEnable:t.stock_progress_enable,progressBarThemeColor:t.stock_progress_color,progressBarThemeColorInRGB:ue(t.stock_progress_color)}}}var Te=Ee,Ie=class extends Te{setQuantity(t){this.logger.log("Set quantity in disabled stock"),this.hide()}};const Se="colon";var xe={date:"June 7, 2087 15:03:25",refresh:1e3,offset:0,timeUnitText:{day:"day",days:"days",hour:"hour",hours:"hours",minute:"minute",minutes:"minutes",second:"second",seconds:"seconds",months:["January","February","March","April","May","June","July","August","September","October","November","December"],dateNotation:"mm-dd"}},ke=class{constructor(t,e){this.logger=E(),this.el=t,this.options={},this.interval=!1,this.classNames={digit:"vimotia__timer__digit",divider:"vimotia__timer__separator"},this.mergeOptions(e),this.init()}init(){this.interval||(this.render(),this.options.refresh&&(this.interval=window.setInterval((()=>{this.render()}),this.options.refresh)))}getUnitDays(t){return t>=2?this.options.timeUnitText.days:this.options.timeUnitText.day}getUnitHours(t){return t>=2?this.options.timeUnitText.hours:this.options.timeUnitText.hour}getUnitMins(t){return t>=2?this.options.timeUnitText.minutes:this.options.timeUnitText.minute}getUnitSecs(t){return t>=2?this.options.timeUnitText.seconds:this.options.timeUnitText.second}getDiffDate(){"object"!=typeof this.options.date&&(this.options.date=new Date(this.options.date));let t=(this.options.date.getTime()-Date.now()+this.options.offset)/1e3;const e={years:0,days:0,hours:0,min:0,sec:0,millisec:0};return t<=0?(this.interval&&(this.stop(),A.function(this.options.onEnd)&&this.options.onEnd()),e):(t>=31557600&&(e.years=Math.floor(t/31557600),t-=365.25*e.years*86400),t>=86400&&(e.days=Math.floor(t/86400),t-=86400*e.days),t>=3600&&(e.hours=Math.floor(t/3600),t-=3600*e.hours),t>=60&&(e.min=Math.floor(t/60),t-=60*e.min),e.sec=Math.round(t),e.millisec=t%1*1e3,e)}static leadingZeros(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;const i=String(t);if(i.length>=e)return i;const r=Array(e+1).join("0")+i;return r.substring(r.length-e)}mergeOptions(t){this.options={...xe,...t},A.string(this.options.date)&&(this.options.date=new Date(this.options.date))}render(){throw new Error("Override this method in subclass")}restart(t){return this.update(t),this.interval=!1,this.init(),this}restartWithOptions(t){return this.mergeOptions(t),this.interval=!1,this.init(),this}stop(){return this.interval&&(clearInterval(this.interval),this.interval=!1),this}update(t){return"object"!=typeof t&&(this.options.date=new Date(t)),this.options.date=t,this.render(),this}updateOffset(t){return this.options.offset=t,this}},Pe=class extends ke{render(){this.el.innerHTML="";const t=this.getDiffDate();this.shouldDisplayDays(t.days)?(this.setDigitInView(t.days),this.setDigitInView(t.hours)):this.shouldDisplayHours(t.hours)&&this.setDigitInView(t.hours);const e=this.createDigit(t.min),i=this.createDigit(t.sec),r=this.createDivider();this.el.append(e,r,i)}shouldDisplayDays(t){return t>0}shouldDisplayHours(t){return t>0}setDigitInView(t){const e=this.createDigit(t),i=this.createDivider();this.el.append(e,i)}createDigit(t){return Tt("div",{class:this.classNames.digit},ke.leadingZeros(t))}createDivider(){return Tt("div",{class:this.classNames.divider},":")}},De=i(3275),Le={};Le.styleTagTransform=ht(),Le.setAttributes=lt(),Le.insert=st().bind(null,"head"),Le.domAPI=nt(),Le.insertStyleElement=dt(),it()(De.A,Le),De.A&&De.A.locals&&De.A.locals;class Be{constructor(t){this.logger=E(),this.data=Be.processData(t),this.elements={container:null},this.classNames={container:"vimotia__timer-widget",textBeforeTimer:"vimotia__timer-widget__text-before",textAfterTimer:"vimotia__timer-widget__text-after",timer:"vimotia__timer-widget__timer"},this.init()}init(){const{container:t,timerContainer:e}=this.createContainers();this.container=t,this.initTimer(e)}createContainers(){const t=Tt("div",{class:this.classNames.container,style:this.cssVariables}),e=Tt("div",{class:this.classNames.textBeforeTimer},this.data.textBeforeTimer),i=Tt("div",{class:this.classNames.timer}),r=Tt("div",{class:this.classNames.textAfterTimer},this.data.textAfterTimer);return t.append(e,i,r),{container:t,timerContainer:i}}initTimer(t){this.enable&&this.isTimerActive?(this.logger.log("Start timer"),this.startTimer(t)):(this.logger.log("Hide timer"),this.hide(t))}startTimer(){throw new Error("implement startTimer in the subclass")}hide(){kt(this.container,!0)}show(){kt(this.container,!1)}get isTimerActive(){throw new Error("implement isTimerActive in the subclass")}get diff(){throw new Error("implement diff getter in the subclass")}get endTime(){throw new Error("implement endTime getter in the subclass")}get container(){return this.elements.container}set container(t){this.elements.container=t}get enable(){return this.data.enable}get cssVariables(){return`\n --vimotia-timer-widget-text-color: ${this.data.textColor};\n --vimotia-timer-widget-digit-color: ${this.data.digitColor};\n `}static processData(t){return{enable:t.countdown_enable,id:t.widget_id,genericDate:t.countdown_generic_date,sessionSeconds:t.countdown_session_seconds,digitColor:t.countdown_timer_digit_color,textColor:t.countdown_timer_text_color,textBeforeTimer:t.countdown_timer_before,textAfterTimer:t.countdown_timer_after}}}var Oe=Be,Re=class extends Oe{get isTimerActive(){return this.diff>0}startTimer(t){new Pe(t,{date:this.endTime,style:Se,onEnd:()=>{this.hide(t)}})}get diff(){const t=(new Date).getTime();return this.endTime-t}get endTime(){const t=new Date(this.data.genericDate).getTime();return A.number(t)?t:0}},Me=class extends Oe{get isTimerActive(){const t=(new Date).getTime();return!(this.endTime<=t)&&this.diff>0}startTimer(t){new Pe(t,{date:this.endTime,style:Se,onEnd:()=>{this.hide(t)}})}get endTime(){const t=function(t){const e=`; ${document.cookie}`.split(`; ${t}=`);return 2===e.length?e.pop().split(";").shift():null}(this.timerKey);return A.nullOrUndefined(t)?(new Date).getTime()+this.diff:parseInt(t,10)}get timerKey(){return`vimotia_countdown_end_time_${this.data.id}_${this.data.type}_${this.data.sessionSeconds}`}get diff(){return 1e3*this.data.sessionSeconds}},Ne=class{static create(t){switch(t.countdown_timer_type){case"generic":return new Re(t);case"session":return new Me(t);default:throw new Error(`Unknown timer widget type ${t.countdown_timer_type}`)}}},Fe={enableStockWidget:!0,enableMessageWidget:!0,enableTimerWidget:!0},Ue=i(2039),Ve={};Ve.styleTagTransform=ht(),Ve.setAttributes=lt(),Ve.insert=st().bind(null,"head"),Ve.domAPI=nt(),Ve.insertStyleElement=dt(),it()(Ue.A,Ve),Ue.A&&Ue.A.locals&&Ue.A.locals;class je{constructor(t,e){this.logger=E(),this.data=je.processData(t),this.product=e,this.elements={container:null},this.classNames={container:"vimotia__product-view__product-page-link",text:"vimotia__product-view__product-page-link__text"},this.init()}init(){this.container=Tt("div",{class:this.classNames.container,style:this.cssVariables},this.data.content),this.textContainer=Tt("div",{class:this.classNames.text},"View Product Page"),this.container.appendChild(this.textContainer),this.enable&&vt(this.container,"click",(()=>{let t=`https://${window.Shopify.shop}/products/${this.product.data.handle}`;setTimeout((()=>{window.open(t,"_blank")}),300)})),this.toggleDisplay()}toggleDisplay(){this.enable?this.show():this.hide()}hide(){kt(this.container,!0)}show(){kt(this.container,!1)}get container(){return this.elements.container}set container(t){this.elements.container=t}get enable(){return this.data.enable}get cssVariables(){return""}fontWeightConfigToCSS(t){switch(t){case"regular":return"regular";case"bold":return"bold";default:return this.logger.error(`Unknown font weight config ${t}`),"regular"}}static processData(t){return{enable:t.product_link_enable}}}var Qe=je;class Ge{constructor(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.logger=E(),this.platform=t,this.product=e,this.widgetConfig=i,this.variantFormInstance=null,this.config=Ge.processConfig(r),this.elements={container:null},this.classNames={container:"vimotia__product-view",title:"vimotia__product-view__title",price:{container:"vimotia__product-view__price",current:"vimotia__product-view__price__current",compare:"vimotia__product-view__price__compare"}},this.init()}init(){const t=this.createContainer();this.assembleUI(t),this.toggleUniqueClass(t),this.elements.container=t}createContainer(){return Tt("div",{class:this.classNames.container})}assembleUI(t){throw new Error("implement createImageContainer in the subclass")}toggleUniqueClass(t){throw new Error("implement createImageContainer in the subclass")}createTitleContainer(){return Tt("div",{class:this.classNames.title},this.product.title)}createVariantForm(){return this.createVariantFormInstance(this.widgetConfig)}createVariantFormInstance(t){throw new Error("implement it in the sub class")}get stockWidget(){return this.config.enableStockWidget?new Te(this.widgetConfig):new Ie(this.widgetConfig)}get messageWidget(){return new le(this.widgetConfig)}get timerWidget(){return Ne.create(this.widgetConfig)}get productPageLink(){return new Qe(this.widgetConfig,this.product)}get container(){return this.elements.container}get variantForm(){return this.variantFormInstance}get shouldDisplayRecommendation(){return(A.nullOrUndefined(this.widgetConfig.product_recommend)||this.widgetConfig.product_recommend)&&this.product.shouldDisplayRecommendation}static processConfig(t){return{...Fe,...t}}}var He=Ge,We=i(2623),ze={};ze.styleTagTransform=ht(),ze.setAttributes=lt(),ze.insert=st().bind(null,"head"),ze.domAPI=nt(),ze.insertStyleElement=dt(),it()(We.A,ze),We.A&&We.A.locals&&We.A.locals;class Ke{constructor(t){this.logger=E(),this.data=Ke.capCount(Ke.readData(t))}get hasRecommendation(){return this.data.length>0}get recommendations(){return this.data}static readData(t){return A.empty(t)?[]:t.map((t=>({id:t.id,title:t.title,url:t.url,image:t.featured_image,hasVariousPricesInVariants:t.price_varies,price:t.price,compareAtPrice:t.compare_at_price})))}static capCount(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:4;return t.slice(0,e)}}var qe=Ke,Ye=class{constructor(t){this.logger=E(),this.state={isValid:this.validateParams(t)},this.isValid?(this.data=this.readData(t),this.variantManager=this.createVariantManager(this.data.variants),this.optionManager=this.createOptionManager(this.data.options),this.recommendationManager=new qe(this.data.recommendation)):this.logger.error("Product data reader creation fails due to invalid product data")}createVariantManager(t){throw new Error("implement it in the sub class")}createOptionManager(t){throw new Error("implement it in the sub class")}readData(t){throw new Error("implement it in the sub class")}get defaultVariantCompareAtPrice(){return this.variantManager.defaultVariant.compareAtPrice}get defaultVariantPrice(){return this.variantManager.defaultVariant.price}get defaultVariantOptionMap(){return this.optionManager.targetIdToValueIdMap(this.variantManager.defaultVariant.optionKeys)}getVariantPrice(t){return this.variantManager.getVariant(t).price}getVariantCompareAtPrice(t){return this.variantManager.getVariant(t).compareAtPrice}getVariantUnitPriceObj(t){let e=this.variantManager.getVariant(t);if(A.empty(e.unitPrice))return null;let i="",r=!1;if(A.nullOrUndefined(window.Intl)||A.nullOrUndefined(window.Shopify)||(i=`${new Intl.NumberFormat(window.Shopify.locale,{style:"currency",currency:window.Shopify.currency.active}).format(e.unitPrice)}`,r=!0),!r){let t=Math.floor(e.unitPrice/100),r=e.unitPrice%100,n=`${r}`;0===r?n="00":r<10&&(n=`0${r}`),i=`${t}.${n}`}let n="";return n=Number(e.unitPriceMeasurement.referenceValue)>1?`${e.unitPriceMeasurement.referenceValue}${e.unitPriceMeasurement.referenceUnit}`:`${e.unitPriceMeasurement.referenceUnit}`,{unitPrice:i,unitMeasure:n,intlFormattedPrice:r}}getVariantStock(t){return this.variantManager.getVariant(t).stock}getVariantIdByOptions(t){if(A.empty(t)&&this.hasOnlyDefaultVariant)return`${this.variantManager.firstVariant.id}`;const e=t.map((t=>t.optionValueId));return`${this.variantManager.getVariantByOption(e).id}`}getVariantByImageSrc(t){return this.variantManager.getVariantByImageSrc(t)}get hasOnlyDefaultVariant(){return this.variantManager.hasOnlyDefaultVariant}get featuredImageSrc(){return A.empty(this.allImageSrc)?"":this.featuredImageAtSize(this.allImageSrc[0])}featuredImageAtSize(t){throw new Error("must be implemented by subclass")}get allImageSrc(){return A.empty(this.data.images)?[]:this.data.images}get hasNoImage(){return 0===this.allImageSrc.length}get hasImages(){return!this.hasNoImage}get hasOnlySingleImage(){return 1===this.allImageSrc.length}get hasMultipleImages(){return this.allImageSrc.length>=2}get isOutOfStock(){return this.isOnlyDefaultVariantOutOfStock||this.isAllVariantsOutOfStock}get isOnlyDefaultVariantOutOfStock(){return this.tracksInventory&&this.hasOnlyDefaultVariant&&0===this.totalStockQty&&!this.anyVariantAllowContinuePurchase}get tracksInventory(){return this.data.tracksInventory}get anyVariantAllowContinuePurchase(){return this.variantManager.anyVariantAllowContinuePurchase}get isAllVariantsOutOfStock(){return this.tracksInventory&&0===this.totalStockQty&&!this.anyVariantAllowContinuePurchase&&this.allVariantHasInventoryManager}get allVariantHasInventoryManager(){return this.variantManager.allVariantHasInventoryManager}isVariantOutOfStock(t){return!!this.tracksInventory&&!this.variantManager.getVariant(t).isInStock}get optionData(){return this.optionManager.formattedData}get handle(){return this.data.handle}get productId(){return this.data.id}get title(){return this.data.title}get totalStockQty(){return this.variantManager.stock}get description(){return this.data.description}get hasDescription(){return!A.empty(this.description)}get shouldDisplayRecommendation(){return this.recommendationManager.hasRecommendation}get recommendationData(){return this.recommendationManager.recommendations}formatProductId(t){throw new Error("must be implemented by subclass")}static isValidCompareAtPrice(t,e){if(A.nullOrUndefined(t))return!1;if(A.nullOrUndefined(e))return!1;const i=parseInt(e,10);return parseInt(t,10){bt(t,Je,!0,{productId:t.dataset.productId})}))}get container(){return this.elements.container}get priceContainer(){return this.elements.price}get comparePriceContainer(){return this.elements.comparePrice}},$e=i(1787),Ze={};Ze.styleTagTransform=ht(),Ze.setAttributes=lt(),Ze.insert=st().bind(null,"head"),Ze.domAPI=nt(),Ze.insertStyleElement=dt(),it()($e.A,Ze),$e.A&&$e.A.locals&&$e.A.locals;var ti=i(4410),ei={};ei.styleTagTransform=ht(),ei.setAttributes=lt(),ei.insert=st().bind(null,"head"),ei.domAPI=nt(),ei.insertStyleElement=dt(),it()(ti.A,ei),ti.A&&ti.A.locals&&ti.A.locals;var ii=i(2265),ri={};ri.styleTagTransform=ht(),ri.setAttributes=lt(),ri.insert=st().bind(null,"head"),ri.domAPI=nt(),ri.insertStyleElement=dt(),it()(ii.A,ri),ii.A&&ii.A.locals&&ii.A.locals;var ni=class{constructor(){this.elements={container:null,icon:null,content:null},this.classNames={container:"vimotia-message",type:{success:"vimotia-message--success"},inner:"vimotia-message__inner",icon:"vimotia-message__icon",content:"vimotia-message__content",visibility:{show:"vimotia-message--show"}},this.init()}init(){this.createContainer()}hide(){const{container:t}=this.elements,{visibility:e}=this.classNames;return Pt(t,e.show,!1),new Promise((e=>{window.setTimeout((()=>{this.setIcon(""),this.setContent(""),t.remove(),e()}),300)}))}createContainer(){if(this.elements.container)return;const t=Tt("div",{class:this.classNames.container}),e=Tt("div",{class:this.classNames.inner}),i=Tt("div",{class:this.classNames.icon}),r=Tt("div",{class:this.classNames.content});e.append(i,r),t.appendChild(e),this.elements.container=t,this.elements.icon=i,this.elements.content=r}setContent(t){this.elements.content.innerText=t}setIcon(t){this.elements.icon.innerHTML=t}show(){const{container:t}=this.elements,{visibility:e}=this.classNames;document.querySelector("body").appendChild(t),window.setTimeout((()=>{Pt(t,e.show,!0)}),100)}success(t){const{container:e}=this.elements,{type:i}=this.classNames;Pt(e,i.success,!0),this.setIcon(te.createCheckIcon()),this.setContent(t),this.show(),window.setTimeout((()=>{this.hide().then((()=>{Pt(e,i.success,!1)}))}),3e3)}},ai=i(1767),si={};si.styleTagTransform=ht(),si.setAttributes=lt(),si.insert=st().bind(null,"head"),si.domAPI=nt(),si.insertStyleElement=dt(),it()(ai.A,si),ai.A&&ai.A.locals&&ai.A.locals;const oi="Item added to your cart",li="vimotia__product-view__add-to-cart--success",ci="vimotia__product-view__add-to-cart__icon--placeholder";class di{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"";this.logger=E(),this.data={...di.processData(t),customClassNames:e,inlineStyles:i},this.elements={container:null,text:null},this.init()}init(){const{container:t,textContainer:e}=this.create();this.container=t,this.textContainer=e}create(){const t=this.createInnerContainer(),e=this.createIconContainer(),i=this.createTextContainer();t.append(e,i);const r=this.createContainer();return r.append(t),{container:r,textContainer:i}}createContainer(){return Tt("div",{class:`vimotia__product-view__add-to-cart ${this.data.customClassNames.join(" ")}`,style:di.inlineCSSVariables(this.data)})}createIconContainer(){const t=Tt("div",{class:"vimotia__product-view__add-to-cart__icon"});switch(this.data.iconType){case"":return Tt("div",{class:ci});case"cart":return t.append(te.createCartMedium()),t;case"bag":return t.append(te.createBagMedium()),t;default:return this.logger.error(`Unknown add to cart button icon type ${this.data.iconType}`),Tt("div",{class:ci})}}createTextContainer(){return Tt("div",{class:"vimotia__product-view__add-to-cart__text"},this.data.texts.addToCart)}createInnerContainer(){return Tt("div",{class:"vimotia__product-view__add-to-cart__inner"})}disableButton(){Ct(this.container,{disabled:""})}setButtonDefaultState(){Et(this.container,{disabled:""}),this.setButtonText(this.data.texts.addToCart)}setAddingItemState(){this.disableButton(),this.setButtonText(this.data.texts.loading)}setUnavailableState(){this.disableButton(),this.setButtonText(this.data.texts.unavailable)}setSoldOutState(){this.disableButton(),this.setButtonText(this.data.texts.soldOut)}async setSuccessState(){this.showSuccessState(),await Ht.waitAnimationEnd(3e3),this.hideSuccessState()}showSuccessState(){this.setButtonText(this.data.texts.itemAdded),Pt(this.container,li,!0)}hideSuccessState(){Pt(this.container,li,!1),this.setButtonDefaultState()}setButtonText(t){A.string(t)&&(this.textContainer.textContent=t)}get container(){return this.elements.container}set container(t){this.elements.container=t}get textContainer(){return this.elements.text}set textContainer(t){this.elements.text=t}get isDisable(){return this.container.hasAttribute("disabled")}static inlineCSSVariables(t){return`\n --add-to-cart-background-color: ${t.backgroundColor};\n --add-to-cart-text-color: ${t.textColor};\n `}static processData(t){return{iconType:t.atc_text_icon,backgroundColor:t.countdown_message_button_color,textColor:t.countdown_message_button_text_color,texts:{addToCart:t.countdown_message_button_text,unavailable:"Unavailable",soldOut:"Sold Out",loading:"Adding Item...",itemAdded:oi}}}}var ui=di;const hi="vimotia-product-multiple-image-gallery-ready",pi="vimotia-selected-variant-change";class gi{constructor(t,e,i,r){this.logger=E(),this.platform=t,this.product=e,this.stock=i,this.selectedOptions={},this.data=gi.processData(r),this.state={selectedVariantId:null},this.elements={form:null,price:null,compareAtPrice:null,singleSelectorsWrapper:null,singleSelectorsInner:null,unitPrice:null,optionSelects:[]},this.classNames={container:"vimotia__variantForm_container",singleSelectorsWrapper:"vimotia__variantForm_singleSelectorsWrapper",singleSelectorsInner:"vimotia__variantForm_singleSelectorsInner",priceWrapper:"vimotia__variantForm_priceWrapper",price:"vimotia__variantForm_price",comparePrice:"vimotia__variantForm_comparePrice",unitPrice:"vimotia__variantForm_unitPrice",optionId:"vimotia__variantForm__singleOptionSelector-{0}",form:{group:"vimotia__formGroup",label:"vimotia__formLabel",control:"vimotia__formControl"}},this.addToCartButton=new ui(r),this.init()}init(){this.create(),this.listen(),this.listenToProductGalleryReadyEvent(),this.updateToFirstInStockVariant()}create(){const t=this.createMainContainer(),{wrapper:e,inner:i}=this.createSelectors();this.elements.singleSelectorsWrapper=e,this.elements.singleSelectorsInner=i,this.assembleUI(t,e,this.addToCartButton.container),(this.product.hasOnlyDefaultVariant||this.product.isOutOfStock)&&kt(this.elements.singleSelectorsWrapper),this.container=t}assembleUI(t,e,i){throw new Error("implement it in the subclass")}setPriceElements(t,e,i){this.elements.price=t,this.elements.compareAtPrice=e,this.elements.unitPrice=i}createMainContainer(){return Tt("div",{class:this.classNames.container})}createSelectors(){const t=Tt("div",{class:this.classNames.singleSelectorsWrapper}),e=Tt("div",{class:this.classNames.singleSelectorsInner}),i=this.product.optionData.map((t=>this.createSelect(t.name,t.optionId,t.values)));return e.append(...i),t.append(e),{wrapper:t,inner:e}}createSelect(t,e,i){const r=Tt("div",{class:this.classNames.form.group}),n=Tt("label",{class:this.classNames.form.label},t),a=Tt("select",{class:this.classNames.form.control,"data-option-id":e}),s=i.map((t=>Tt("option",{value:t.valueId},t.displayName)));return a.append(...s),this.elements.optionSelects.push(a),r.appendChild(n),r.appendChild(a),r}createPriceContainer(){const t=Tt("div",{class:this.classNames.priceWrapper}),e=Tt("span",{class:this.classNames.price}),i=Tt("span",{class:this.classNames.comparePrice}),r=Tt("div",{class:this.classNames.unitPrice});return t.append(e,i,r),{priceWrapper:t,price:e,compareAtPrice:i,unitPrice:r}}listen(){this.listenToAddToButtonClick(),this.listenToFormUpdate()}listenToAddToButtonClick(){vt(this.addToCartButton.container,"click",(()=>{this.processAddToCartAction()}))}processAddToCartAction(){this.defaultAddToCartAction()}defaultAddToCartAction(){if(!this.addToCartButton.isDisable){if(this.addToCartButton.setAddingItemState(),A.empty(this.selectedVariantId))return this.logger.warn("The selected variant id is not available"),void this.addToCartButton.setButtonDefaultState();if(!A.string(this.selectedVariantId))return this.logger.warn("The selected variant id is expected as a string but got "+typeof this.selectedVariantId),void this.addToCartButton.setButtonDefaultState();this.queueClickEvent(),this.waitToQueueClickEventThenAddToCart()}}queueClickEvent(){bt(this.container,ve,!0,{widgetId:this.data.widgetId,productId:this.product.productId})}listenToFormUpdate(){vt(this.container,"change",(()=>{this.update()}))}waitToQueueClickEventThenAddToCart(){window.setTimeout((()=>{this.addVariantToCart()}),300)}updateToFirstInStockVariant(){this.updateOptionSelectsElements(this.product.defaultVariantOptionMap),this.update()}updateOptionSelectsElements(t){this.elements.optionSelects.forEach((e=>{e.value=t[e.dataset.optionId]}))}update(){this.updateSelectedVariantId(),this.updateAddToCarButton(),this.updatePrice(),this.updateStock()}updateSelectedVariantId(){let t="";this.elements.optionSelects.forEach(((e,i)=>{t=0===i?`${e.value}`:`${t} / ${e.value}`})),this.currentOptions=this.elements.optionSelects.map((t=>({optionId:t.dataset.optionId,optionValueId:t.value}))),this.selectedVariantId=this.product.getVariantIdByOptions(this.currentOptions)}updateAddToCarButton(){A.empty(this.selectedVariantId)?this.addToCartButton.setUnavailableState():this.product.isVariantOutOfStock(this.selectedVariantId)?this.addToCartButton.setSoldOutState():this.addToCartButton.setButtonDefaultState()}updatePrice(){if(A.nullOrUndefined(this.elements.price)||A.nullOrUndefined(this.elements.compareAtPrice))return void this.logger.warn("Missing price and compare price elements to update price. Make sure you set price elements and then update again.");if(A.empty(this.selectedVariantId))return this.elements.price.textContent="",void(this.elements.compareAtPrice.textContent=" ");const t=this.product.getVariantPrice(this.selectedVariantId),e=this.product.getVariantCompareAtPrice(this.selectedVariantId),i=this.product.getVariantUnitPriceObj(this.selectedVariantId);if(this.elements.price.textContent=this.platform.formatPrice(t),parseInt(e,10)>parseInt(t,10)?this.elements.compareAtPrice.textContent=this.platform.formatPrice(e):this.elements.compareAtPrice.textContent="",A.empty(i))this.elements.unitPrice.textContent="";else{let t="";t=i.intlFormattedPrice?i.unitPrice:this.platform.formatPrice(i.unitPrice),this.elements.unitPrice.textContent=`${t} / ${i.unitMeasure}`,this.elements.unitPrice.style.marginTop="2.1px"}}updateStock(){this.stock.setQuantity(this.product.totalStockQty)}addVariantToCart(){this.platform.addToCart(this.product,this.currentOptions,{redirectToCartPage:this.data.redirectToCartPage,onSuccess:()=>{this.showSuccessAlert(),this.addToCartButton.setSuccessState().then()}})}showSuccessAlert(){(new ni).success(this.data.texts.itemAdded)}listenToProductGalleryReadyEvent(){vt(document.querySelector("body"),hi,(()=>{this.triggerSelectedVariantChangeEvent(this.selectedVariantId)}))}set container(t){this.elements.form=t}get container(){return this.elements.form}set currentOptions(t){this.selectedOptions=t}get currentOptions(){return this.selectedOptions}set selectedVariantId(t){this.state.selectedVariantId=t,this.triggerSelectedVariantChangeEvent(t)}get selectedVariantId(){return this.state.selectedVariantId}triggerSelectedVariantChangeEvent(t){bt(this.container,pi,!0,{variantId:t})}static processData(t){return{redirectToCartPage:t.atc_click_effect===me.GOTO_CART_PAGE,texts:{itemAdded:oi},widgetId:`${t.widget_id}`}}static processPrimaryColor(t){return!A.string(t)||pe(t)?"#000000":t.length>=7?t.substring(0,7):t}}var fi=gi;const mi="vimotia__variantForm_container--collapse",vi="vimotia__variantForm_container--collapse--show-options";var yi=class extends fi{assembleUI(t,e,i){t.append(e,this.stock.container,i),Pt(t,mi,!0)}processAddToCartAction(){this.shouldShowOptions()?this.showOptions():this.defaultAddToCartAction()}shouldShowOptions(){return!this.product.hasOnlyDefaultVariant&&!this.isOptionsShown()}isOptionsShown(){return Dt(this.elements.form,vi)}showOptions(){this.logger.log("show options"),Ht.heightFromElement(this.elements.singleSelectorsInner,this.elements.singleSelectorsWrapper),Pt(this.elements.form,vi,!0)}};const Ai="vimotia__product-view--card";var bi=class extends He{assembleUI(t){const e=new Xe(this.platform,this.product),i=this.createVariantForm();i.setPriceElements(e.priceContainer,e.comparePriceContainer),this.variantFormInstance=i,t.append(e.container,i.container),this.config.enableMessageWidget&&t.append(this.messageWidget.container),this.config.enableTimerWidget&&t.append(this.timerWidget.container)}toggleUniqueClass(t){Pt(t,Ai,!0)}createVariantFormInstance(t){return new yi(this.platform,this.product,this.stockWidget,t)}};function _i(t,e){return function(){return t.apply(e,arguments)}}const{toString:wi}=Object.prototype,{getPrototypeOf:Ci}=Object,Ei=(Ti=Object.create(null),t=>{const e=wi.call(t);return Ti[e]||(Ti[e]=e.slice(8,-1).toLowerCase())});var Ti;const Ii=t=>(t=t.toLowerCase(),e=>Ei(e)===t),Si=t=>e=>typeof e===t,{isArray:xi}=Array,ki=Si("undefined"),Pi=Ii("ArrayBuffer"),Di=Si("string"),Li=Si("function"),Bi=Si("number"),Oi=t=>null!==t&&"object"==typeof t,Ri=t=>{if("object"!==Ei(t))return!1;const e=Ci(t);return!(null!==e&&e!==Object.prototype&&null!==Object.getPrototypeOf(e)||Symbol.toStringTag in t||Symbol.iterator in t)},Mi=Ii("Date"),Ni=Ii("File"),Fi=Ii("Blob"),Ui=Ii("FileList"),Vi=Ii("URLSearchParams");function ji(t,e,{allOwnKeys:i=!1}={}){if(null==t)return;let r,n;if("object"!=typeof t&&(t=[t]),xi(t))for(r=0,n=t.length;r0;)if(r=i[n],e===r.toLowerCase())return r;return null}const Gi="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:global,Hi=t=>!ki(t)&&t!==Gi,Wi=(zi="undefined"!=typeof Uint8Array&&Ci(Uint8Array),t=>zi&&t instanceof zi);var zi;const Ki=Ii("HTMLFormElement"),qi=(({hasOwnProperty:t})=>(e,i)=>t.call(e,i))(Object.prototype),Yi=Ii("RegExp"),Ji=(t,e)=>{const i=Object.getOwnPropertyDescriptors(t),r={};ji(i,((i,n)=>{let a;!1!==(a=e(i,n,t))&&(r[n]=a||i)})),Object.defineProperties(t,r)},Xi="abcdefghijklmnopqrstuvwxyz",$i="0123456789",Zi={DIGIT:$i,ALPHA:Xi,ALPHA_DIGIT:Xi+Xi.toUpperCase()+$i},tr=Ii("AsyncFunction");var er={isArray:xi,isArrayBuffer:Pi,isBuffer:function(t){return null!==t&&!ki(t)&&null!==t.constructor&&!ki(t.constructor)&&Li(t.constructor.isBuffer)&&t.constructor.isBuffer(t)},isFormData:t=>{let e;return t&&("function"==typeof FormData&&t instanceof FormData||Li(t.append)&&("formdata"===(e=Ei(t))||"object"===e&&Li(t.toString)&&"[object FormData]"===t.toString()))},isArrayBufferView:function(t){let e;return e="undefined"!=typeof ArrayBuffer&&ArrayBuffer.isView?ArrayBuffer.isView(t):t&&t.buffer&&Pi(t.buffer),e},isString:Di,isNumber:Bi,isBoolean:t=>!0===t||!1===t,isObject:Oi,isPlainObject:Ri,isUndefined:ki,isDate:Mi,isFile:Ni,isBlob:Fi,isRegExp:Yi,isFunction:Li,isStream:t=>Oi(t)&&Li(t.pipe),isURLSearchParams:Vi,isTypedArray:Wi,isFileList:Ui,forEach:ji,merge:function t(){const{caseless:e}=Hi(this)&&this||{},i={},r=(r,n)=>{const a=e&&Qi(i,n)||n;Ri(i[a])&&Ri(r)?i[a]=t(i[a],r):Ri(r)?i[a]=t({},r):xi(r)?i[a]=r.slice():i[a]=r};for(let t=0,e=arguments.length;t(ji(e,((e,r)=>{i&&Li(e)?t[r]=_i(e,i):t[r]=e}),{allOwnKeys:r}),t),trim:t=>t.trim?t.trim():t.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,""),stripBOM:t=>(65279===t.charCodeAt(0)&&(t=t.slice(1)),t),inherits:(t,e,i,r)=>{t.prototype=Object.create(e.prototype,r),t.prototype.constructor=t,Object.defineProperty(t,"super",{value:e.prototype}),i&&Object.assign(t.prototype,i)},toFlatObject:(t,e,i,r)=>{let n,a,s;const o={};if(e=e||{},null==t)return e;do{for(n=Object.getOwnPropertyNames(t),a=n.length;a-- >0;)s=n[a],r&&!r(s,t,e)||o[s]||(e[s]=t[s],o[s]=!0);t=!1!==i&&Ci(t)}while(t&&(!i||i(t,e))&&t!==Object.prototype);return e},kindOf:Ei,kindOfTest:Ii,endsWith:(t,e,i)=>{t=String(t),(void 0===i||i>t.length)&&(i=t.length),i-=e.length;const r=t.indexOf(e,i);return-1!==r&&r===i},toArray:t=>{if(!t)return null;if(xi(t))return t;let e=t.length;if(!Bi(e))return null;const i=new Array(e);for(;e-- >0;)i[e]=t[e];return i},forEachEntry:(t,e)=>{const i=(t&&t[Symbol.iterator]).call(t);let r;for(;(r=i.next())&&!r.done;){const i=r.value;e.call(t,i[0],i[1])}},matchAll:(t,e)=>{let i;const r=[];for(;null!==(i=t.exec(e));)r.push(i);return r},isHTMLForm:Ki,hasOwnProperty:qi,hasOwnProp:qi,reduceDescriptors:Ji,freezeMethods:t=>{Ji(t,((e,i)=>{if(Li(t)&&-1!==["arguments","caller","callee"].indexOf(i))return!1;const r=t[i];Li(r)&&(e.enumerable=!1,"writable"in e?e.writable=!1:e.set||(e.set=()=>{throw Error("Can not rewrite read-only method '"+i+"'")}))}))},toObjectSet:(t,e)=>{const i={},r=t=>{t.forEach((t=>{i[t]=!0}))};return xi(t)?r(t):r(String(t).split(e)),i},toCamelCase:t=>t.toLowerCase().replace(/[-_\s]([a-z\d])(\w*)/g,(function(t,e,i){return e.toUpperCase()+i})),noop:()=>{},toFiniteNumber:(t,e)=>(t=+t,Number.isFinite(t)?t:e),findKey:Qi,global:Gi,isContextDefined:Hi,ALPHABET:Zi,generateString:(t=16,e=Zi.ALPHA_DIGIT)=>{let i="";const{length:r}=e;for(;t--;)i+=e[Math.random()*r|0];return i},isSpecCompliantForm:function(t){return!!(t&&Li(t.append)&&"FormData"===t[Symbol.toStringTag]&&t[Symbol.iterator])},toJSONObject:t=>{const e=new Array(10),i=(t,r)=>{if(Oi(t)){if(e.indexOf(t)>=0)return;if(!("toJSON"in t)){e[r]=t;const n=xi(t)?[]:{};return ji(t,((t,e)=>{const a=i(t,r+1);!ki(a)&&(n[e]=a)})),e[r]=void 0,n}}return t};return i(t,0)},isAsyncFn:tr,isThenable:t=>t&&(Oi(t)||Li(t))&&Li(t.then)&&Li(t.catch)};function ir(t,e,i,r,n){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack,this.message=t,this.name="AxiosError",e&&(this.code=e),i&&(this.config=i),r&&(this.request=r),n&&(this.response=n)}er.inherits(ir,Error,{toJSON:function(){return{message:this.message,name:this.name,description:this.description,number:this.number,fileName:this.fileName,lineNumber:this.lineNumber,columnNumber:this.columnNumber,stack:this.stack,config:er.toJSONObject(this.config),code:this.code,status:this.response&&this.response.status?this.response.status:null}}});const rr=ir.prototype,nr={};["ERR_BAD_OPTION_VALUE","ERR_BAD_OPTION","ECONNABORTED","ETIMEDOUT","ERR_NETWORK","ERR_FR_TOO_MANY_REDIRECTS","ERR_DEPRECATED","ERR_BAD_RESPONSE","ERR_BAD_REQUEST","ERR_CANCELED","ERR_NOT_SUPPORT","ERR_INVALID_URL"].forEach((t=>{nr[t]={value:t}})),Object.defineProperties(ir,nr),Object.defineProperty(rr,"isAxiosError",{value:!0}),ir.from=(t,e,i,r,n,a)=>{const s=Object.create(rr);return er.toFlatObject(t,s,(function(t){return t!==Error.prototype}),(t=>"isAxiosError"!==t)),ir.call(s,t.message,e,i,r,n),s.cause=t,s.name=t.name,a&&Object.assign(s,a),s};var ar=ir;function sr(t){return er.isPlainObject(t)||er.isArray(t)}function or(t){return er.endsWith(t,"[]")?t.slice(0,-2):t}function lr(t,e,i){return t?t.concat(e).map((function(t,e){return t=or(t),!i&&e?"["+t+"]":t})).join(i?".":""):e}const cr=er.toFlatObject(er,{},null,(function(t){return/^is[A-Z]/.test(t)}));var dr=function(t,e,i){if(!er.isObject(t))throw new TypeError("target must be an object");e=e||new FormData;const r=(i=er.toFlatObject(i,{metaTokens:!0,dots:!1,indexes:!1},!1,(function(t,e){return!er.isUndefined(e[t])}))).metaTokens,n=i.visitor||c,a=i.dots,s=i.indexes,o=(i.Blob||"undefined"!=typeof Blob&&Blob)&&er.isSpecCompliantForm(e);if(!er.isFunction(n))throw new TypeError("visitor must be a function");function l(t){if(null===t)return"";if(er.isDate(t))return t.toISOString();if(!o&&er.isBlob(t))throw new ar("Blob is not supported. Use a Buffer instead.");return er.isArrayBuffer(t)||er.isTypedArray(t)?o&&"function"==typeof Blob?new Blob([t]):Buffer.from(t):t}function c(t,i,n){let o=t;if(t&&!n&&"object"==typeof t)if(er.endsWith(i,"{}"))i=r?i:i.slice(0,-2),t=JSON.stringify(t);else if(er.isArray(t)&&function(t){return er.isArray(t)&&!t.some(sr)}(t)||(er.isFileList(t)||er.endsWith(i,"[]"))&&(o=er.toArray(t)))return i=or(i),o.forEach((function(t,r){!er.isUndefined(t)&&null!==t&&e.append(!0===s?lr([i],r,a):null===s?i:i+"[]",l(t))})),!1;return!!sr(t)||(e.append(lr(n,i,a),l(t)),!1)}const d=[],u=Object.assign(cr,{defaultVisitor:c,convertValue:l,isVisitable:sr});if(!er.isObject(t))throw new TypeError("data must be an object");return function t(i,r){if(!er.isUndefined(i)){if(-1!==d.indexOf(i))throw Error("Circular reference detected in "+r.join("."));d.push(i),er.forEach(i,(function(i,a){!0===(!(er.isUndefined(i)||null===i)&&n.call(e,i,er.isString(a)?a.trim():a,r,u))&&t(i,r?r.concat(a):[a])})),d.pop()}}(t),e};function ur(t){const e={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+","%00":"\0"};return encodeURIComponent(t).replace(/[!'()~]|%20|%00/g,(function(t){return e[t]}))}function hr(t,e){this._pairs=[],t&&dr(t,this,e)}const pr=hr.prototype;pr.append=function(t,e){this._pairs.push([t,e])},pr.toString=function(t){const e=t?function(e){return t.call(this,e,ur)}:ur;return this._pairs.map((function(t){return e(t[0])+"="+e(t[1])}),"").join("&")};var gr=hr;function fr(t){return encodeURIComponent(t).replace(/%3A/gi,":").replace(/%24/g,"$").replace(/%2C/gi,",").replace(/%20/g,"+").replace(/%5B/gi,"[").replace(/%5D/gi,"]")}function mr(t,e,i){if(!e)return t;const r=i&&i.encode||fr,n=i&&i.serialize;let a;if(a=n?n(e,i):er.isURLSearchParams(e)?e.toString():new gr(e,i).toString(r),a){const e=t.indexOf("#");-1!==e&&(t=t.slice(0,e)),t+=(-1===t.indexOf("?")?"?":"&")+a}return t}var vr=class{constructor(){this.handlers=[]}use(t,e,i){return this.handlers.push({fulfilled:t,rejected:e,synchronous:!!i&&i.synchronous,runWhen:i?i.runWhen:null}),this.handlers.length-1}eject(t){this.handlers[t]&&(this.handlers[t]=null)}clear(){this.handlers&&(this.handlers=[])}forEach(t){er.forEach(this.handlers,(function(e){null!==e&&t(e)}))}},yr={silentJSONParsing:!0,forcedJSONParsing:!0,clarifyTimeoutError:!1},Ar={isBrowser:!0,classes:{URLSearchParams:"undefined"!=typeof URLSearchParams?URLSearchParams:gr,FormData:"undefined"!=typeof FormData?FormData:null,Blob:"undefined"!=typeof Blob?Blob:null},protocols:["http","https","file","blob","url","data"]};const br="undefined"!=typeof window&&"undefined"!=typeof document,_r=(wr="undefined"!=typeof navigator&&navigator.product,br&&["ReactNative","NativeScript","NS"].indexOf(wr)<0);var wr;const Cr="undefined"!=typeof WorkerGlobalScope&&self instanceof WorkerGlobalScope&&"function"==typeof self.importScripts;var Er={...t,...Ar},Tr=function(t){function e(t,i,r,n){let a=t[n++];if("__proto__"===a)return!0;const s=Number.isFinite(+a),o=n>=t.length;return a=!a&&er.isArray(r)?r.length:a,o?(er.hasOwnProp(r,a)?r[a]=[r[a],i]:r[a]=i,!s):(r[a]&&er.isObject(r[a])||(r[a]=[]),e(t,i,r[a],n)&&er.isArray(r[a])&&(r[a]=function(t){const e={},i=Object.keys(t);let r;const n=i.length;let a;for(r=0;r{e(function(t){return er.matchAll(/\w+|\[(\w*)]/g,t).map((t=>"[]"===t[0]?"":t[1]||t[0]))}(t),r,i,0)})),i}return null};const Ir={transitional:yr,adapter:["xhr","http"],transformRequest:[function(t,e){const i=e.getContentType()||"",r=i.indexOf("application/json")>-1,n=er.isObject(t);if(n&&er.isHTMLForm(t)&&(t=new FormData(t)),er.isFormData(t))return r?JSON.stringify(Tr(t)):t;if(er.isArrayBuffer(t)||er.isBuffer(t)||er.isStream(t)||er.isFile(t)||er.isBlob(t))return t;if(er.isArrayBufferView(t))return t.buffer;if(er.isURLSearchParams(t))return e.setContentType("application/x-www-form-urlencoded;charset=utf-8",!1),t.toString();let a;if(n){if(i.indexOf("application/x-www-form-urlencoded")>-1)return function(t,e){return dr(t,new Er.classes.URLSearchParams,Object.assign({visitor:function(t,e,i,r){return Er.isNode&&er.isBuffer(t)?(this.append(e,t.toString("base64")),!1):r.defaultVisitor.apply(this,arguments)}},e))}(t,this.formSerializer).toString();if((a=er.isFileList(t))||i.indexOf("multipart/form-data")>-1){const e=this.env&&this.env.FormData;return dr(a?{"files[]":t}:t,e&&new e,this.formSerializer)}}return n||r?(e.setContentType("application/json",!1),function(t,e,i){if(er.isString(t))try{return(0,JSON.parse)(t),er.trim(t)}catch(t){if("SyntaxError"!==t.name)throw t}return(0,JSON.stringify)(t)}(t)):t}],transformResponse:[function(t){const e=this.transitional||Ir.transitional,i=e&&e.forcedJSONParsing,r="json"===this.responseType;if(t&&er.isString(t)&&(i&&!this.responseType||r)){const i=!(e&&e.silentJSONParsing)&&r;try{return JSON.parse(t)}catch(t){if(i){if("SyntaxError"===t.name)throw ar.from(t,ar.ERR_BAD_RESPONSE,this,null,this.response);throw t}}}return t}],timeout:0,xsrfCookieName:"XSRF-TOKEN",xsrfHeaderName:"X-XSRF-TOKEN",maxContentLength:-1,maxBodyLength:-1,env:{FormData:Er.classes.FormData,Blob:Er.classes.Blob},validateStatus:function(t){return t>=200&&t<300},headers:{common:{Accept:"application/json, text/plain, */*","Content-Type":void 0}}};er.forEach(["delete","get","head","post","put","patch"],(t=>{Ir.headers[t]={}}));var Sr=Ir;const xr=er.toObjectSet(["age","authorization","content-length","content-type","etag","expires","from","host","if-modified-since","if-unmodified-since","last-modified","location","max-forwards","proxy-authorization","referer","retry-after","user-agent"]),kr=Symbol("internals");function Pr(t){return t&&String(t).trim().toLowerCase()}function Dr(t){return!1===t||null==t?t:er.isArray(t)?t.map(Dr):String(t)}function Lr(t,e,i,r,n){return er.isFunction(r)?r.call(this,e,i):(n&&(e=i),er.isString(e)?er.isString(r)?-1!==e.indexOf(r):er.isRegExp(r)?r.test(e):void 0:void 0)}class Br{constructor(t){t&&this.set(t)}set(t,e,i){const r=this;function n(t,e,i){const n=Pr(e);if(!n)throw new Error("header name must be a non-empty string");const a=er.findKey(r,n);(!a||void 0===r[a]||!0===i||void 0===i&&!1!==r[a])&&(r[a||e]=Dr(t))}const a=(t,e)=>er.forEach(t,((t,i)=>n(t,i,e)));return er.isPlainObject(t)||t instanceof this.constructor?a(t,e):er.isString(t)&&(t=t.trim())&&!/^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(t.trim())?a((t=>{const e={};let i,r,n;return t&&t.split("\n").forEach((function(t){n=t.indexOf(":"),i=t.substring(0,n).trim().toLowerCase(),r=t.substring(n+1).trim(),!i||e[i]&&xr[i]||("set-cookie"===i?e[i]?e[i].push(r):e[i]=[r]:e[i]=e[i]?e[i]+", "+r:r)})),e})(t),e):null!=t&&n(e,t,i),this}get(t,e){if(t=Pr(t)){const i=er.findKey(this,t);if(i){const t=this[i];if(!e)return t;if(!0===e)return function(t){const e=Object.create(null),i=/([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g;let r;for(;r=i.exec(t);)e[r[1]]=r[2];return e}(t);if(er.isFunction(e))return e.call(this,t,i);if(er.isRegExp(e))return e.exec(t);throw new TypeError("parser must be boolean|regexp|function")}}}has(t,e){if(t=Pr(t)){const i=er.findKey(this,t);return!(!i||void 0===this[i]||e&&!Lr(0,this[i],i,e))}return!1}delete(t,e){const i=this;let r=!1;function n(t){if(t=Pr(t)){const n=er.findKey(i,t);!n||e&&!Lr(0,i[n],n,e)||(delete i[n],r=!0)}}return er.isArray(t)?t.forEach(n):n(t),r}clear(t){const e=Object.keys(this);let i=e.length,r=!1;for(;i--;){const n=e[i];t&&!Lr(0,this[n],n,t,!0)||(delete this[n],r=!0)}return r}normalize(t){const e=this,i={};return er.forEach(this,((r,n)=>{const a=er.findKey(i,n);if(a)return e[a]=Dr(r),void delete e[n];const s=t?function(t){return t.trim().toLowerCase().replace(/([a-z\d])(\w*)/g,((t,e,i)=>e.toUpperCase()+i))}(n):String(n).trim();s!==n&&delete e[n],e[s]=Dr(r),i[s]=!0})),this}concat(...t){return this.constructor.concat(this,...t)}toJSON(t){const e=Object.create(null);return er.forEach(this,((i,r)=>{null!=i&&!1!==i&&(e[r]=t&&er.isArray(i)?i.join(", "):i)})),e}[Symbol.iterator](){return Object.entries(this.toJSON())[Symbol.iterator]()}toString(){return Object.entries(this.toJSON()).map((([t,e])=>t+": "+e)).join("\n")}get[Symbol.toStringTag](){return"AxiosHeaders"}static from(t){return t instanceof this?t:new this(t)}static concat(t,...e){const i=new this(t);return e.forEach((t=>i.set(t))),i}static accessor(t){const e=(this[kr]=this[kr]={accessors:{}}).accessors,i=this.prototype;function r(t){const r=Pr(t);e[r]||(function(t,e){const i=er.toCamelCase(" "+e);["get","set","has"].forEach((r=>{Object.defineProperty(t,r+i,{value:function(t,i,n){return this[r].call(this,e,t,i,n)},configurable:!0})}))}(i,t),e[r]=!0)}return er.isArray(t)?t.forEach(r):r(t),this}}Br.accessor(["Content-Type","Content-Length","Accept","Accept-Encoding","User-Agent","Authorization"]),er.reduceDescriptors(Br.prototype,(({value:t},e)=>{let i=e[0].toUpperCase()+e.slice(1);return{get:()=>t,set(t){this[i]=t}}})),er.freezeMethods(Br);var Or=Br;function Rr(t,e){const i=this||Sr,r=e||i,n=Or.from(r.headers);let a=r.data;return er.forEach(t,(function(t){a=t.call(i,a,n.normalize(),e?e.status:void 0)})),n.normalize(),a}function Mr(t){return!(!t||!t.__CANCEL__)}function Nr(t,e,i){ar.call(this,null==t?"canceled":t,ar.ERR_CANCELED,e,i),this.name="CanceledError"}er.inherits(Nr,ar,{__CANCEL__:!0});var Fr=Nr,Ur=Er.hasStandardBrowserEnv?{write(t,e,i,r,n,a){const s=[t+"="+encodeURIComponent(e)];er.isNumber(i)&&s.push("expires="+new Date(i).toGMTString()),er.isString(r)&&s.push("path="+r),er.isString(n)&&s.push("domain="+n),!0===a&&s.push("secure"),document.cookie=s.join("; ")},read(t){const e=document.cookie.match(new RegExp("(^|;\\s*)("+t+")=([^;]*)"));return e?decodeURIComponent(e[3]):null},remove(t){this.write(t,"",Date.now()-864e5)}}:{write(){},read(){return null},remove(){}};function Vr(t,e){return t&&!/^([a-z][a-z\d+\-.]*:)?\/\//i.test(e)?function(t,e){return e?t.replace(/\/?\/$/,"")+"/"+e.replace(/^\/+/,""):t}(t,e):e}var jr=Er.hasStandardBrowserEnv?function(){const t=/(msie|trident)/i.test(navigator.userAgent),e=document.createElement("a");let i;function r(i){let r=i;return t&&(e.setAttribute("href",r),r=e.href),e.setAttribute("href",r),{href:e.href,protocol:e.protocol?e.protocol.replace(/:$/,""):"",host:e.host,search:e.search?e.search.replace(/^\?/,""):"",hash:e.hash?e.hash.replace(/^#/,""):"",hostname:e.hostname,port:e.port,pathname:"/"===e.pathname.charAt(0)?e.pathname:"/"+e.pathname}}return i=r(window.location.href),function(t){const e=er.isString(t)?r(t):t;return e.protocol===i.protocol&&e.host===i.host}}():function(){return!0};function Qr(t,e){let i=0;const r=function(t,e){t=t||10;const i=new Array(t),r=new Array(t);let n,a=0,s=0;return e=void 0!==e?e:1e3,function(o){const l=Date.now(),c=r[s];n||(n=l),i[a]=o,r[a]=l;let d=s,u=0;for(;d!==a;)u+=i[d++],d%=t;if(a=(a+1)%t,a===s&&(s=(s+1)%t),l-n{const a=n.loaded,s=n.lengthComputable?n.total:void 0,o=a-i,l=r(o);i=a;const c={loaded:a,total:s,progress:s?a/s:void 0,bytes:o,rate:l||void 0,estimated:l&&s&&a<=s?(s-a)/l:void 0,event:n};c[e?"download":"upload"]=!0,t(c)}}const Gr={http:null,xhr:"undefined"!=typeof XMLHttpRequest&&function(t){return new Promise((function(e,i){let r=t.data;const n=Or.from(t.headers).normalize();let a,s,{responseType:o,withXSRFToken:l}=t;function c(){t.cancelToken&&t.cancelToken.unsubscribe(a),t.signal&&t.signal.removeEventListener("abort",a)}if(er.isFormData(r))if(Er.hasStandardBrowserEnv||Er.hasStandardBrowserWebWorkerEnv)n.setContentType(!1);else if(!1!==(s=n.getContentType())){const[t,...e]=s?s.split(";").map((t=>t.trim())).filter(Boolean):[];n.setContentType([t||"multipart/form-data",...e].join("; "))}let d=new XMLHttpRequest;if(t.auth){const e=t.auth.username||"",i=t.auth.password?unescape(encodeURIComponent(t.auth.password)):"";n.set("Authorization","Basic "+btoa(e+":"+i))}const u=Vr(t.baseURL,t.url);function h(){if(!d)return;const r=Or.from("getAllResponseHeaders"in d&&d.getAllResponseHeaders());!function(t,e,i){const r=i.config.validateStatus;i.status&&r&&!r(i.status)?e(new ar("Request failed with status code "+i.status,[ar.ERR_BAD_REQUEST,ar.ERR_BAD_RESPONSE][Math.floor(i.status/100)-4],i.config,i.request,i)):t(i)}((function(t){e(t),c()}),(function(t){i(t),c()}),{data:o&&"text"!==o&&"json"!==o?d.response:d.responseText,status:d.status,statusText:d.statusText,headers:r,config:t,request:d}),d=null}if(d.open(t.method.toUpperCase(),mr(u,t.params,t.paramsSerializer),!0),d.timeout=t.timeout,"onloadend"in d?d.onloadend=h:d.onreadystatechange=function(){d&&4===d.readyState&&(0!==d.status||d.responseURL&&0===d.responseURL.indexOf("file:"))&&setTimeout(h)},d.onabort=function(){d&&(i(new ar("Request aborted",ar.ECONNABORTED,t,d)),d=null)},d.onerror=function(){i(new ar("Network Error",ar.ERR_NETWORK,t,d)),d=null},d.ontimeout=function(){let e=t.timeout?"timeout of "+t.timeout+"ms exceeded":"timeout exceeded";const r=t.transitional||yr;t.timeoutErrorMessage&&(e=t.timeoutErrorMessage),i(new ar(e,r.clarifyTimeoutError?ar.ETIMEDOUT:ar.ECONNABORTED,t,d)),d=null},Er.hasStandardBrowserEnv&&(l&&er.isFunction(l)&&(l=l(t)),l||!1!==l&&jr(u))){const e=t.xsrfHeaderName&&t.xsrfCookieName&&Ur.read(t.xsrfCookieName);e&&n.set(t.xsrfHeaderName,e)}void 0===r&&n.setContentType(null),"setRequestHeader"in d&&er.forEach(n.toJSON(),(function(t,e){d.setRequestHeader(e,t)})),er.isUndefined(t.withCredentials)||(d.withCredentials=!!t.withCredentials),o&&"json"!==o&&(d.responseType=t.responseType),"function"==typeof t.onDownloadProgress&&d.addEventListener("progress",Qr(t.onDownloadProgress,!0)),"function"==typeof t.onUploadProgress&&d.upload&&d.upload.addEventListener("progress",Qr(t.onUploadProgress)),(t.cancelToken||t.signal)&&(a=e=>{d&&(i(!e||e.type?new Fr(null,t,d):e),d.abort(),d=null)},t.cancelToken&&t.cancelToken.subscribe(a),t.signal&&(t.signal.aborted?a():t.signal.addEventListener("abort",a)));const p=function(t){const e=/^([-+\w]{1,25})(:?\/\/|:)/.exec(t);return e&&e[1]||""}(u);p&&-1===Er.protocols.indexOf(p)?i(new ar("Unsupported protocol "+p+":",ar.ERR_BAD_REQUEST,t)):d.send(r||null)}))}};er.forEach(Gr,((t,e)=>{if(t){try{Object.defineProperty(t,"name",{value:e})}catch(t){}Object.defineProperty(t,"adapterName",{value:e})}}));const Hr=t=>`- ${t}`,Wr=t=>er.isFunction(t)||null===t||!1===t;var zr=t=>{t=er.isArray(t)?t:[t];const{length:e}=t;let i,r;const n={};for(let a=0;a`adapter ${t} `+(!1===e?"is not supported by the environment":"is not available in the build")));let i=e?t.length>1?"since :\n"+t.map(Hr).join("\n"):" "+Hr(t[0]):"as no adapter specified";throw new ar("There is no suitable adapter to dispatch the request "+i,"ERR_NOT_SUPPORT")}return r};function Kr(t){if(t.cancelToken&&t.cancelToken.throwIfRequested(),t.signal&&t.signal.aborted)throw new Fr(null,t)}function qr(t){return Kr(t),t.headers=Or.from(t.headers),t.data=Rr.call(t,t.transformRequest),-1!==["post","put","patch"].indexOf(t.method)&&t.headers.setContentType("application/x-www-form-urlencoded",!1),zr(t.adapter||Sr.adapter)(t).then((function(e){return Kr(t),e.data=Rr.call(t,t.transformResponse,e),e.headers=Or.from(e.headers),e}),(function(e){return Mr(e)||(Kr(t),e&&e.response&&(e.response.data=Rr.call(t,t.transformResponse,e.response),e.response.headers=Or.from(e.response.headers))),Promise.reject(e)}))}const Yr=t=>t instanceof Or?{...t}:t;function Jr(t,e){e=e||{};const i={};function r(t,e,i){return er.isPlainObject(t)&&er.isPlainObject(e)?er.merge.call({caseless:i},t,e):er.isPlainObject(e)?er.merge({},e):er.isArray(e)?e.slice():e}function n(t,e,i){return er.isUndefined(e)?er.isUndefined(t)?void 0:r(void 0,t,i):r(t,e,i)}function a(t,e){if(!er.isUndefined(e))return r(void 0,e)}function s(t,e){return er.isUndefined(e)?er.isUndefined(t)?void 0:r(void 0,t):r(void 0,e)}function o(i,n,a){return a in e?r(i,n):a in t?r(void 0,i):void 0}const l={url:a,method:a,data:a,baseURL:s,transformRequest:s,transformResponse:s,paramsSerializer:s,timeout:s,timeoutMessage:s,withCredentials:s,withXSRFToken:s,adapter:s,responseType:s,xsrfCookieName:s,xsrfHeaderName:s,onUploadProgress:s,onDownloadProgress:s,decompress:s,maxContentLength:s,maxBodyLength:s,beforeRedirect:s,transport:s,httpAgent:s,httpsAgent:s,cancelToken:s,socketPath:s,responseEncoding:s,validateStatus:o,headers:(t,e)=>n(Yr(t),Yr(e),!0)};return er.forEach(Object.keys(Object.assign({},t,e)),(function(r){const a=l[r]||n,s=a(t[r],e[r],r);er.isUndefined(s)&&a!==o||(i[r]=s)})),i}const Xr={};["object","boolean","number","function","string","symbol"].forEach(((t,e)=>{Xr[t]=function(i){return typeof i===t||"a"+(e<1?"n ":" ")+t}}));const $r={};Xr.transitional=function(t,e,i){function r(t,e){return"[Axios v1.6.8] Transitional option '"+t+"'"+e+(i?". "+i:"")}return(i,n,a)=>{if(!1===t)throw new ar(r(n," has been removed"+(e?" in "+e:"")),ar.ERR_DEPRECATED);return e&&!$r[n]&&($r[n]=!0,console.warn(r(n," has been deprecated since v"+e+" and will be removed in the near future"))),!t||t(i,n,a)}};var Zr={assertOptions:function(t,e,i){if("object"!=typeof t)throw new ar("options must be an object",ar.ERR_BAD_OPTION_VALUE);const r=Object.keys(t);let n=r.length;for(;n-- >0;){const a=r[n],s=e[a];if(s){const e=t[a],i=void 0===e||s(e,a,t);if(!0!==i)throw new ar("option "+a+" must be "+i,ar.ERR_BAD_OPTION_VALUE)}else if(!0!==i)throw new ar("Unknown option "+a,ar.ERR_BAD_OPTION)}},validators:Xr};const tn=Zr.validators;class en{constructor(t){this.defaults=t,this.interceptors={request:new vr,response:new vr}}async request(t,e){try{return await this._request(t,e)}catch(t){if(t instanceof Error){let e;Error.captureStackTrace?Error.captureStackTrace(e={}):e=new Error;const i=e.stack?e.stack.replace(/^.+\n/,""):"";t.stack?i&&!String(t.stack).endsWith(i.replace(/^.+\n.+\n/,""))&&(t.stack+="\n"+i):t.stack=i}throw t}}_request(t,e){"string"==typeof t?(e=e||{}).url=t:e=t||{},e=Jr(this.defaults,e);const{transitional:i,paramsSerializer:r,headers:n}=e;void 0!==i&&Zr.assertOptions(i,{silentJSONParsing:tn.transitional(tn.boolean),forcedJSONParsing:tn.transitional(tn.boolean),clarifyTimeoutError:tn.transitional(tn.boolean)},!1),null!=r&&(er.isFunction(r)?e.paramsSerializer={serialize:r}:Zr.assertOptions(r,{encode:tn.function,serialize:tn.function},!0)),e.method=(e.method||this.defaults.method||"get").toLowerCase();let a=n&&er.merge(n.common,n[e.method]);n&&er.forEach(["delete","get","head","post","put","patch","common"],(t=>{delete n[t]})),e.headers=Or.concat(a,n);const s=[];let o=!0;this.interceptors.request.forEach((function(t){"function"==typeof t.runWhen&&!1===t.runWhen(e)||(o=o&&t.synchronous,s.unshift(t.fulfilled,t.rejected))}));const l=[];let c;this.interceptors.response.forEach((function(t){l.push(t.fulfilled,t.rejected)}));let d,u=0;if(!o){const t=[qr.bind(this),void 0];for(t.unshift.apply(t,s),t.push.apply(t,l),d=t.length,c=Promise.resolve(e);u{if(!i._listeners)return;let e=i._listeners.length;for(;e-- >0;)i._listeners[e](t);i._listeners=null})),this.promise.then=t=>{let e;const r=new Promise((t=>{i.subscribe(t),e=t})).then(t);return r.cancel=function(){i.unsubscribe(e)},r},t((function(t,r,n){i.reason||(i.reason=new Fr(t,r,n),e(i.reason))}))}throwIfRequested(){if(this.reason)throw this.reason}subscribe(t){this.reason?t(this.reason):this._listeners?this._listeners.push(t):this._listeners=[t]}unsubscribe(t){if(!this._listeners)return;const e=this._listeners.indexOf(t);-1!==e&&this._listeners.splice(e,1)}static source(){let t;return{token:new nn((function(e){t=e})),cancel:t}}}var an=nn;const sn={Continue:100,SwitchingProtocols:101,Processing:102,EarlyHints:103,Ok:200,Created:201,Accepted:202,NonAuthoritativeInformation:203,NoContent:204,ResetContent:205,PartialContent:206,MultiStatus:207,AlreadyReported:208,ImUsed:226,MultipleChoices:300,MovedPermanently:301,Found:302,SeeOther:303,NotModified:304,UseProxy:305,Unused:306,TemporaryRedirect:307,PermanentRedirect:308,BadRequest:400,Unauthorized:401,PaymentRequired:402,Forbidden:403,NotFound:404,MethodNotAllowed:405,NotAcceptable:406,ProxyAuthenticationRequired:407,RequestTimeout:408,Conflict:409,Gone:410,LengthRequired:411,PreconditionFailed:412,PayloadTooLarge:413,UriTooLong:414,UnsupportedMediaType:415,RangeNotSatisfiable:416,ExpectationFailed:417,ImATeapot:418,MisdirectedRequest:421,UnprocessableEntity:422,Locked:423,FailedDependency:424,TooEarly:425,UpgradeRequired:426,PreconditionRequired:428,TooManyRequests:429,RequestHeaderFieldsTooLarge:431,UnavailableForLegalReasons:451,InternalServerError:500,NotImplemented:501,BadGateway:502,ServiceUnavailable:503,GatewayTimeout:504,HttpVersionNotSupported:505,VariantAlsoNegotiates:506,InsufficientStorage:507,LoopDetected:508,NotExtended:510,NetworkAuthenticationRequired:511};Object.entries(sn).forEach((([t,e])=>{sn[e]=t}));var on=sn;const ln=function t(e){const i=new rn(e),r=_i(rn.prototype.request,i);return er.extend(r,rn.prototype,i,{allOwnKeys:!0}),er.extend(r,i,null,{allOwnKeys:!0}),r.create=function(i){return t(Jr(e,i))},r}(Sr);ln.Axios=rn,ln.CanceledError=Fr,ln.CancelToken=an,ln.isCancel=Mr,ln.VERSION="1.6.8",ln.toFormData=dr,ln.AxiosError=ar,ln.Cancel=ln.CanceledError,ln.all=function(t){return Promise.all(t)},ln.spread=function(t){return function(e){return t.apply(null,e)}},ln.isAxiosError=function(t){return er.isObject(t)&&!0===t.isAxiosError},ln.mergeConfig=Jr,ln.AxiosHeaders=Or,ln.formToJSON=t=>Tr(er.isHTMLForm(t)?new FormData(t):t),ln.getAdapter=zr,ln.HttpStatusCode=on,ln.default=ln;var cn=ln;const dn=E(),un=new d,hn=cn.create({baseURL:un.apiBaseUrl,timeout:3e4});hn.interceptors.response.use((t=>t.data),(t=>(dn.error(t),Promise.reject(t))));var pn=hn;const gn="utm_source=branding&utm_medium=frontendPlayer&utm_campaign=branding";function fn(){const t=window.location.href,{protocol:e}=window.location;return t.replace(`${e}//`,"")}function mn(t){const e="https://";let i=t;i.includes(e)||(i=`${e}${i}`),window.location.href=i}const vn={EXIT:"exit",DELAY:"delay"},yn="percent",An="vimotia-show-exit-coupon",bn="VimotiaDiscountCache",_n="coupons",wn="coupon-waiting",Cn="coupon-applied";class En{constructor(){this.logger=E(),this.cache=new k("vimotia-discount")}set(t){const e=E();try{return this.cache.set(t),!0}catch(t){return e.error("Fail saving cache"),e.error(t),!1}}get(){return this.cache.get()}get coupons(){const t=this.cache.get(_n);return this.verifyCoupons(t)?t:[]}set coupons(t){this.cache.set({[_n]:t})}get aCouponWaitingToApply(){const t=this.cache.get(wn);return A.empty(t)?(this.logger.log("No coupon waiting to apply"),""):(this.logger.log(`Found a coupon waiting to apply: ${t}`),t)}set aCouponWaitingToApply(t){this.cache.set({[wn]:t})}get appliedCoupon(){const t=this.cache.get(Cn);return A.empty(t)?(this.logger.log("No coupon applied"),{}):(this.logger.log("Found a coupon should have applied: ",t),t)}set appliedCoupon(t){this.cache.set({[Cn]:t})}clearCouponWaitingToApply(){this.aCouponWaitingToApply=""}verifyCoupons(t){return!A.nullOrUndefined(t)||(this.logger.warn("No cached coupons data"),!1)}}function Tn(){let t=window[bn];return A.nullOrUndefined(t)?(t=new En,window[bn]=t,t):t}class In{constructor(t){this.logger=E(),this.coupons=[],this.initialData={},this.init(t)}init(t){this.initialCouponData=In.rawDataToCouponData(t)}couponContainers(t){const e=[];return In.getSortedCoupons(t,this.initialCouponPriceRuleId).forEach((t=>{const i=t.getContainer();A.nullOrUndefined(i)||e.push(i)})),e}static getSortedCoupons(t,e){const i=[],r=[],n=[];return t.forEach((t=>{const a=t.isApplied(),s=In.equalsCoupon(t.getPriceRuleId(),e);a?r.push(t):s?i.push(t):n.push(t)})),i.sort(In.sortCouponByExpireOn),r.sort(In.sortCouponByExpireOn),n.sort(In.sortCouponByExpireOn),[...r,...i,...n]}static equalsCoupon(t,e){return t===e}static sortCouponByExpireOn(t,e){return e.getExpireOn()-t.getExpireOn()}static overrideACouponDataInCache(t){const e=In.getAllValidCouponsDataInCache(),i=[t];for(let r=0;r{t!==i.couponCode&&e.push(i)})),In.replaceAllCouponsDataInCache(e)}static setACouponDataInCache(t){if(In.isSeenPriceRule(t.priceRuleId))return!1;const e=In.getAllValidCouponsDataInCache();return e.push(t),In.replaceAllCouponsDataInCache(e),!0}static isSeenPriceRule(t){const e=In.getAllValidCouponsDataInCache().map((t=>t.priceRuleId));return e.includes(t)}static getAllValidCouponsDataInCache(){const t=Tn().coupons;if(A.empty(t))return[];const{couponConfigs:e,expireCount:i}=In.filterExpiredCouponData(t),{uniqueCouponConfigs:r,duplicates:n}=In.filterUniqueCouponData(e);return(0!==i||0!==n)&&In.replaceAllCouponsDataInCache(r),e}static filterExpiredCouponData(t){const e=[];let i=0;return t.forEach((t=>{In.getExpireState(t.expireOn)?i+=1:e.push(t)})),{couponConfigs:e,expireCount:i}}static filterUniqueCouponData(t){const e=[],i=[];let r=0;for(let n=0;n=t}static isNeverExpireOnConfig(t){return 0===t}static rawDataToCouponData(t){if(A.nullOrUndefined(t)||A.empty(t))return{};if(!In.verifyServerData(t))return{};const e={activeMinutes:t.active_minutes,backgroundColor:t.discount_coupon_bg_color,buttonText:t.countdown_message_button_text,couponText:t.discount_coupon_text,couponMessage:{},foregroundColor:t.discount_coupon_text_color,priceRuleId:t.pricerule_id,priceRuleType:t.pricerule_type,priceRuleValue:t.pricerule_value,triggerType:t.discount_popup_trigger_type,triggerSeconds:t.discount_popup_trigger_seconds,validTimerTextBefore:t.discount_expire_text};return A.nullOrUndefined(t.extra_text?.discount_applied_text)||(e.buttonTextApplied=t.extra_text?.discount_applied_text),A.nullOrUndefined(t.extra_text?.discount_apply_failed_text)||(e.couponMessage.applyFailed=t.extra_text?.discount_apply_failed_text),A.nullOrUndefined(t.extra_text?.discount_applying_text)||(e.couponMessage.applying=t.extra_text?.discount_applying_text),A.nullOrUndefined(t.extra_text?.discount_post_success_note)||(e.couponMessage.postSuccessNote=t.extra_text?.discount_post_success_note),A.nullOrUndefined(t.extra_text?.discount_success_text)||(e.couponMessage.success=t.extra_text?.discount_success_text),e}static verifyServerData(t){const e=E();return A.empty(t.pricerule_id)?(e.error(`Server data error: expected a discount price rule id but got "${t.pricerule_id}"`),!1):!A.empty(t.pricerule_type)||(e.error(`Server data error: expected a discount price rule type but got "${t.pricerule_type}"`),!1)}addACoupon(t){this.addACouponToCurrentList(t);const e=t.getCouponData();In.setACouponDataInCache(e)}addACouponToCurrentList(t){this.allCoupons.push(t)}get allCoupons(){return this.coupons}set allCoupons(t){this.coupons=[...t]}get hasCoupons(){return this.allCoupons.length>0}get hasNoCoupons(){return!this.hasCoupons}get initialCouponData(){return this.initialData}set initialCouponData(t){this.initialData=t}get initialCouponPriceRuleId(){return this.initialCouponData.priceRuleId}get primaryCouponExpireOn(){const t=In.getSortedCoupons(this.allCoupons,this.initialCouponPriceRuleId);return A.empty(t)?0:t[0].getExpireOn()}}var Sn=In;const xn="vimotia-collection-play",kn="vimotia-collection-close",Pn="vimotia-collection-video-info-hide-permanent";class Dn{constructor(t){this.logger=E(),this.stateClient=tt(),this.options=t,this.listenToCollectionClose()}listenToCollectionClose(){vt(document.querySelector("body"),kn,(()=>{mn(this.targetPageOnClose())}))}get initialPlaybackParam(){const t=Dn.shopOrigin(),e=Dn.pageType(),i=Dn.pagePath(),r=!this.stateClient.isMobile;if([t,e,i].some((t=>A.nullOrUndefined(t))))throw new Error(`\n Expect all on-page data but got \n\n shopUrl: ${t} \n\n pageType: ${e} \n\n pagePath: ${i} \n\n It happens because expect on-page meta does not exist.\n `);return this.logger.log("Video page requests",{shopUrl:t,pageType:e,pagePath:i,isDesktop:r}),window.btoa(`${t}+${e}+${i}+${r}`)}static pagePath(){return window._page_path}static pageType(){return window.meta?.page?.pageType}static isProductPage(){return"product"===Dn.pageType()}static shopOrigin(){return window._shop_origin}static shopUrl(){return window.location.hostname}pageHandle(){return Dn.isProductPage()?`${this.options.productPageSubFolder}${window._redirect_path}`:window._redirect_path}static emailPlatform(){return A.empty(window._email_platform)?"":window._email_platform}updateData(t){if(A.empty(t))return t;const e=I(t),i=Dn.videoId(),r=this.composeFullPlayerList(e).find((t=>`${t.video.video_id}`===i));if(A.nullOrUndefined(r))throw new Error(`Cannot find player data with video id ${i}. It happens because video id in the URL does not exist in the response data`);const n=this.updateToFloatButton(this.updateToAutoPlay(r));return e.current_payload.player_list=[n],e}composeFullPlayerList(t){if(A.empty(t.current_payload.gallery_list))return[...t.current_payload.player_list];const e=[];return t.current_payload.gallery_list.forEach((t=>{t.player_list.forEach((t=>{e.push(t)}))})),[...t.current_payload.player_list,...e]}updateToAutoPlay(t){return{...t,player:{...t.player,auto_start:!0,auto_start_m:!0,auto_start_seconds:0,auto_start_seconds_m:0}}}updateToFloatButton(t){return{...t,player:{...t.player,player_style:B,player_style_m:B}}}static videoId(){return function(t){const e=new URLSearchParams(window.location.search).get("video_id");return A.nullOrUndefined(e)?"":e}()}static isVideoPage(){return window._hosted_video_page}targetPageOnClose(){return`${Dn.shopUrl()}${this.pageHandle()}`}static analyticsPagePathKey(){return"vimotia-video-share-page"}}var Ln=Dn;const Bn="VimotiaAnalyticsData",On="clickEventsQueue",Rn="purchaseEventsQueue";class Mn{constructor(){this.logger=E(),this.cache=new k("vimotia-analytics")}get clickEvents(){const t=this.cache.get(On);return A.nullOrUndefined(t)?[]:JSON.parse(t)}set clickEvents(t){this.cache.set({[On]:JSON.stringify(t)})}appendAClickEvent(t){const e=this.clickEvents;e.push(t),this.clickEvents=e}clearClickEvents(){this.clickEvents=[]}get purchaseEvent(){const t=this.cache.get(Rn);return A.nullOrUndefined(t)?[]:JSON.parse(t)}set purchaseEvent(t){this.cache.set({[Rn]:JSON.stringify(t)})}appendPurchaseEvent(t){const e=this.purchaseEvent;e.push(t),this.purchaseEvent=e}}function Nn(){let t=window[Bn];return A.nullOrUndefined(t)?(t=new Mn,window[Bn]=t,t):t}const Fn="click";class Un{constructor(t,e,i,r){this.logger=E(),this.sessionId="",this.timerId=null,this.platform=i,this.discount=r,this.stateClient=tt(),this.data={shopUrl:this.platform.shopDomain,videoId:t,playerId:e,pagePath:this.platform.analyticsPagePathKeyword,landingUrl:fn(),locale:window.navigator.language||"en",device:this.stateClient.isMobile?"mobile":"desktop"}}clearTimer(){null!==this.timerId&&(window.clearInterval(this.timerId),this.timerId=null)}static async getCheckoutOrderData(t,e){const i=E(),r=[],n=[],a=[],s=await e.getOrder();if(A.nullOrUndefined(s))return i.error("Cannot create an order instance"),{orders:[],remainEvents:t};for(let e=0;e0&&void 0!==arguments[0]?arguments[0]:"";return Ln.isVideoPage()?`email-${Ln.emailPlatform()}`:A.empty(t)?document.referrer:`swipe,${t}`}get priceRuleId(){return A.nullOrUndefined(this.discount)?"":this.discount.getCurrentCouponPriceRuleId()}postEnd(t){navigator.sendBeacon?this.postEndWithBeacon(t):this.postEndWithREST(t)}postEndWithBeacon(t){this.clearTimer();const e={action_name:"end",play_time:String(parseInt(t,10)),session_id:this.sessionId,shop_url:this.data.shopUrl},i=new d;window.navigator.sendBeacon(`${i.apiBaseUrl}${i.apiConstants.ANALYTICS_PLAYING}`,JSON.stringify(e))}postEndWithREST(t){const e=new d;pn.post(e.apiConstants.ANALYTICS_PLAYING,{action_name:"end",play_time:String(parseInt(t,10)),session_id:this.sessionId,shop_url:this.data.shopUrl}).then((t=>{"success"===t.result?this.logger.log("Analytics end: success"):this.logger.error(`Analytics end: fail. Error message: "${t.message}"`)})).catch((t=>{throw t})).finally((()=>{this.clearTimer()}))}postPlay(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=new d;pn.post(i.apiConstants.ANALYTICS_PLAYING,{action_name:"play",play_time:String(parseInt(t,10)),session_id:this.sessionId,shop_url:this.data.shopUrl}).then((t=>{if("success"!==t.result)return this.logger.error(`Analytics play: fail. Error message: "${t.message}"`),void(A.function(e.onError)&&e.onError());A.function(e.onSuccess)&&e.onSuccess()})).catch((t=>{throw this.logger.log("Analytics play: axios error config ",t.config),A.function(e.onError)&&e.onError(),t})).finally((()=>{A.function(e.onFinally)&&e.onFinally()}))}postPlayInterval(t){this.timerId=setInterval((()=>{this.postPlay(t.currentTime,{onError:()=>{this.clearTimer()}})}),5e3)}static queueClickEvents(t){Nn().appendAClickEvent(t)}static queuePurchaseEvents(t){const e=E();t.productId.includes("gid")?e.error(`Expect a clean id without GID but got ${t.productId}`):Nn().appendPurchaseEvent(t)}static sendClickEventsInQueue(){const t=E(),e=Nn(),i=e.clickEvents;A.empty(i)||(i.forEach((e=>{const{actionName:i,currentTime:r,objectId:n,sessionId:a,shopUrl:s}=e;if(!A.nullOrUndefined(i)&&!A.nullOrUndefined(r)&&!A.nullOrUndefined(n)){const e=new d;pn.post(e.apiConstants.ANALYTICS_PLAYING,{action_name:i,action_object_id:n,play_time:String(parseInt(r,10)),session_id:a,shop_url:s}).then((e=>{if("success"!==e.result)throw e;t.log("Analytics post success")}))}})),e.clearClickEvents())}static async sendPurchaseEventsInQueue(t){const e=E(),i=Nn(),r=i.purchaseEvent;if(A.empty(r))return;const{orders:n,remainEvents:a}=await Un.getCheckoutOrderData(r,t);if(A.empty(n))return e.log("No qualified orders"),void(i.purchaseEvent=a);e.log("Qualified orders: ",n);const s=new d;pn.post(s.apiConstants.TRACK_ORDER,{shop_url:t.shopDomain,orders:JSON.stringify(n)}).then((r=>{if("success"!==r.result)throw r;i.purchaseEvent=a;const n=t.getOrder(),{usedCouponCode:s}=n;Sn.removeCouponInCache(s),e.log("Analytics track order: post success")}))}static validatePurchaseEventData(t,e){const i=E(),{sessionId:r,videoId:n,productId:a,timestamp:s}=t;return!(A.nullOrUndefined(r)||A.nullOrUndefined(n)||A.nullOrUndefined(a)||A.nullOrUndefined(s)||e.includes(a)||function(t,e){const i=+new Date;let r=e;return A.string(e)&&(r=parseInt(e,10)),i-r>=2592e5}(0,s)&&(i.log(`order track expired on product ${a}`),1))}}var Vn=Un;function jn(){return!A.nullOrUndefined(window.VMT_SECTION_DEV_ENV)}const Qn="small",Gn="medium",Hn="large",Wn="slide",zn="grid",Kn="page",qn="--gallery-row-desktop",Yn="--gallery-row-mobile",Jn="--gallery-col-desktop",Xn="--gallery-col-mobile",$n="--gallery-gap",Zn="--gallery-spacing-top",ta="--gallery-spacing-bottom",ea="--gallery-spacing-left",ia="--gallery-spacing-right",ra="--gallery-title-color",na={CIRCLE_BG_COLOR:"--gallery-button-circle-bg-color",CIRCLE_BORDER_COLOR:"--gallery-button-circle-border-color",TRIANGLE_BG_COLOR:"--gallery-button-triangle-bg-color",TRIANGLE_BORDER_COLOR:"--gallery-button-triangle-border-color"},aa="order",sa="player";var oa=class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.logger=E(),this.position=t}inject(t){if(this.isUsingAppBlock)return this.logger.log("[Gallery] using app block for position"),void this.injectToAppBlock(t).then();this.logger.log("[Gallery] using regular position"),this.injectToXPathPosition(t)}get isUsingAppBlock(){return"#vimotia_gallery_app_block"===this.position}async injectToAppBlock(t){kt(this.appBlockPlaceholder),this.appBlock.appendChild(t),this.logger.log("[Gallery] inject to: ",this.appBlock)}get appBlock(){return this.appBlockPlaceholder?.parentElement}get appBlockPlaceholder(){return document.querySelector("#vimotia_gallery_app_block")}injectToXPathPosition(t){const{parent:e,beforeElement:i}=this.injectTarget;if(A.nullOrUndefined(e))throw new Error("cannot find target with XPath for gallery");e.insertBefore(t,i),this.logger.log("[Gallery] inject to: ",e)}get injectTarget(){const t=this.position.split("&&");if(4!==t.length)throw new Error(`expect 4 parts in gallery xpath but got ${t.length}`);const[e,i,r]=t;try{let t=Nt(e);return A.nullOrUndefined(t)&&(t=Nt(i)),A.nullOrUndefined(t)?{parent:null,beforeElement:null}:{parent:t,beforeElement:t.children[r]}}catch(t){throw new Error(t)}}},la=class extends oa{hideAppBlock(){A.element(this.appBlock)&&!function(){try{return window.self!==window.top}catch(t){return!0}}()&&(this.logger.log("Hiding gallery app block"),this.appBlock.style.display="none")}};class ca{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.logger=E(),this.config=t,this.stateClient=tt()}requestDataAndImportCoreScript(){this.preRequestTasks(),Ln.isVideoPage()?this.processVideoPage():this.processStandardPage()}preRequestTasks(){this.sendAnalytics(),ca.cleanStorages()}sendAnalytics(){Vn.sendClickEventsInQueue(),this.isThankYouPage&&Vn.sendPurchaseEventsInQueue(this).then((()=>{this.logger.log("Purchase event sent")}))}static cleanStorages(){ca.cleanExpiredProductData()}static cleanExpiredProductData(){Fa().clearExpiredData()}processVideoPage(){this.importCoreScript();const t=new Ln({productPageSubFolder:this.productPageSubFolder});this.getData(t.initialPlaybackParam).then((e=>{if(A.empty(e))this.removeCoreScript();else{const i=t.updateData(e);window.VimotiaConfigData={...i}}}))}processStandardPage(){this.importCoreScript(),this.getData(this.initialPlaybackParam).then((t=>{A.empty(t)?(this.logger.warn("No videos linked to this page"),(new la).hideAppBlock(),this.removeCoreScript()):window.VimotiaConfigData={...t}}))}get initialPlaybackParam(){throw new Error("must be implemented by subclass")}importCoreScript(){const t=Tt("script",{src:this.coreJsFileUri,id:"vmt-core-script",async:!0});t.onload=()=>{const t=window[e];if(A.nullOrUndefined(t)||A.nullOrUndefined(window.VimotiaConfigData))return A.nullOrUndefined(t)&&this.logger.warn("expect a core function but got null, trying again..."),A.nullOrUndefined(window.VimotiaConfigData)&&this.logger.warn("expect a Vimotia config data but got null, trying again..."),void ca.periodicallyInitCore();t(window.VimotiaConfigData)},document.head.appendChild(t)}removeCoreScript(){this.logger.warn("removing core script from page");try{let t=document.getElementById("vmt-core-script");t&&t.remove()}catch(t){this.logger.error(t)}}static periodicallyInitCore(){let t,i=20;const r=window.setInterval((()=>{if(0===i)return void window.clearInterval(r);i-=1,t=window[e];const n=!A.nullOrUndefined(t),a=!A.nullOrUndefined(window.VimotiaConfigData);n&&a&&(window.clearInterval(r),t(window.VimotiaConfigData))}),200)}formatPrice(t){if(A.nullOrUndefined(this.config.moneyFormat))return t;let e=this.config.moneyFormat;return[...e.matchAll(/<("[^"]*"|'[^']*'|[^'">])*>/gi)].forEach((t=>{const i=t[0];A.string(i)&&(e=e.replace(i,""))})),e.replace(/{{.*?}}/i,t)}async addToCart(t,e,i){let{redirectToCartPage:r=!1,onSuccess:n}=i;throw new Error("must be implemented by subclass")}async applyCoupon(t){throw new Error("must be implemented by subclass")}createProduct(t){throw new Error("must be implemented by subclass")}async createProductGroup(t){const e=Fa(),i=t.filter((t=>A.empty(e.getProduct(t))));return A.empty(i)?(this.logger.log("Following products data in cache. No need to request.",t),t.map((t=>{const i=e.getProduct(t);return this.createProduct(i)}))):(await this.requestProductData(i),t.map((t=>{const i=e.getProduct(t);return this.createProduct(i)})))}async requestProductData(t){throw new Error("must be implemented by subclass")}async requestProductRecommendationData(t){throw new Error("must be implemented by subclass")}get couponApplyingMessage(){throw new Error("must be implemented by subclass")}async getData(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";if(A.empty(t))return this.logger.error("Expected a base64 string but got an empty one"),{};const e=await pn.get(`/g/${t}`);return A.nullOrUndefined(e.current_payload)?(this.logger.error("server response an unexpect JSON on initial request: ",e),{}):e}async getOrder(){throw new Error("must be implemented by subclass")}get pageType(){throw new Error("must be implemented by subclass")}get productIdOnPage(){throw new Error("must be implemented by subclass")}get shopDomain(){throw new Error("must be implemented by subclass")}async getThemeName(){throw new Error("must be implemented by subclass")}getThemeMaxSectionWidthClassName(t){throw new Error("must be implemented by subclass")}get isProductPage(){throw new Error("must be implemented by subclass")}get productPageSubFolder(){return""}get isHomepage(){throw new Error("must be implemented by subclass")}get isThankYouPage(){throw new Error("must be implemented by subclass")}get brandingLink(){throw new Error("must be implemented by subclass")}get coreJsFileUri(){throw new Error("must be implemented by subclass")}get analyticsPagePathKeyword(){return Ln.isVideoPage()?Ln.analyticsPagePathKey():this.isProductPage?`${this.productIdOnPage}`:window.location.pathname}}var da=ca;const ua={dawn:["page-width"],express:["image-with-text__inner"],narrative:["page-width"],debut:["page-width"],venture:["page-width"],brooklyn:["wrapper"],minimal:["wrapper"]},ha={PRODUCT:"product",HOME:"home",COLLECTION:"collection",PAGE:"page",BLOG:"blog"},pa=E(),ga=cn.create({baseURL:"",timeout:3e4});ga.interceptors.response.use((t=>t.data),(t=>(pa.error(t),Promise.reject(t))));var fa=ga,ma=class{getProductSubtotal(t){throw new Error("must be implemented by subclass")}isProductInOrder(t){throw new Error("must be implemented by subclass")}get orderId(){throw new Error("must be implemented by subclass")}get usedCouponCode(){throw new Error("must be implemented by subclass")}get usedCouponData(){throw new Error("must be implemented by subclass")}},va=class extends ma{constructor(t){super(),this.data=t}getProductSubtotal(t){const e=this.mapProductIdToOrderSubtotal()[t];return A.nullOrUndefined(e)?"":`${(e/this.getCurrencyRate()).toFixed(2)}`}getCurrencyRate(){const{currency:t,presentment_currency:e,total_price_set:i}=this.data;let r=1;return A.nullOrUndefined(t)||A.nullOrUndefined(e)||A.nullOrUndefined(i)||A.nullOrUndefined(i.shop_money)||A.nullOrUndefined(i.shop_money.amount)||A.nullOrUndefined(i.presentment_money)||A.nullOrUndefined(i.presentment_money.amount)||t===e||(r=(parseFloat(i.presentment_money.amount)/parseFloat(i.shop_money.amount)).toFixed(7)),0===r&&(r=1),r}isProductInOrder(t){const e=this.mapProductIdToOrderSubtotal();return Object.keys(e).includes(t)}mapProductIdToOrderSubtotal(){const t=E(),e={};for(let i=0;i{t.values.forEach((i=>{e[i.valueId]=t}))})),e}get formattedData(){return this.options.map((t=>t.formattedData))}targetIdToValueIdMap(){const t={};return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((e=>{const i=this.lookupByValueId[e];A.nullOrUndefined(i)||(t[i.id]=e)})),t}},Aa=class{constructor(t){this.logger=E(),this.data=this.readData(t)}readData(t){throw new Error("implement it in the sub class")}encodeValues(t){throw new Error("implement it in the sub class")}get id(){return this.data.id}get name(){return this.data.name}get position(){return this.data.position}get values(){return this.data.values}get formattedData(){return{name:this.name,optionId:parseInt(this.id,10),values:this.values}}};class ba extends Aa{readData(t){return{id:ba.decodeId(t.id),name:t.name,position:t.position,values:this.encodeValues(t.values)}}static decodeId(t){return t.includes("gid://shopify/ProductOption/")?t.substring(28):t}encodeValues(t){return t.map((t=>({valueId:t,displayName:t})))}}var _a=ba,wa=class extends ya{createOptions(t){return t.map((t=>new _a(t)))}},Ca=class{static getProductIdFromString(t){return t.includes("gid://shopify/Product/")?t.substring(22):t}static getImageAtSize(t,e){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"2x";const r=[".jpg",".jpeg",".png",".gif",".webp"];let n="",a=-1;for(let e=0;e0}get isAvailable(){return this.isStockManaged?!!this.isInStockWithManager||(this.isStockManaged&&this.isContinueSellingWhenOutOfStock?(this.logger.log(`Variant ${this.title} is continue selling`),!0):(this.logger.warn(`Variant ${this.title} is not available`),!1)):(this.logger.log(`Variant ${this.title} is not tracked`),!0)}get optionKeys(){return this.data.optionKeys}},Ta=class extends Ea{readData(t){return{id:"",title:"",price:"",compareAtPrice:"",stock:0,isStockManaged:!0,isContinueSellingWhenOutOfStock:!1,optionKeys:[]}}};class Ia extends Map{constructor(t){for(var e=arguments.length,i=new Array(e>1?e-1:0),r=1;rthis.createVariant(t.node)))}createVariant(t){throw new Error("implement it in the sub class")}createLookup(t){const e={};return t.forEach((t=>{e[t.id]=t})),e}createLookupByOption(t){throw new Error("implement it in the sub class")}createLookupImageSrcToId(t){const e=new Sa((()=>new Set));return t.forEach((t=>{A.empty(t.imageSrc)||e.get(t.imageSrc).add(t)})),e}createOptionKey(t){throw new Error("implement it in the sub class")}getVariant(t){throw new Error("implement it in the sub class")}get firstVariant(){throw new Error("implement it in the sub class")}get firstInStockVariant(){return this.variants.find((t=>t.isInStock))}get defaultVariant(){const t=this.firstInStockVariant;return A.nullOrUndefined(t)?this.firstVariant:t}get hasOnlyDefaultVariant(){return 1===this.variants.length}get allVariantHasInventoryManager(){throw new Error("implement it in the sub class")}getVariantByOption(){throw new Error("implement it in the sub class")}getVariantByImageSrc(t){return[...this.lookupByImageSrc.get(t).values()]}get anyVariantAllowContinuePurchase(){throw new Error("implement it in the sub class")}get stock(){return this.variants.map((t=>t.stock)).reduce(((t,e)=>t+e),0)}};class ka extends Ea{readData(t){return{id:ka.getVariantIdFromString(t.id),title:t.title,price:t.price,compareAtPrice:t.compareAtPrice,imageSrc:A.nullOrUndefined(t.image)?"":t.image.url,stock:t.inventoryQuantity,isStockManaged:A.nullOrUndefined(t.inventoryItem)?"NOT_MANAGED"!==t.inventoryManagement:t.inventoryItem.tracked,isContinueSellingWhenOutOfStock:"CONTINUE"===t.inventoryPolicy,optionKeys:ka.formatOptions(t),unitPrice:A.nullOrUndefined(t.unitPrice)?"":t.unitPrice,unitPriceMeasurement:A.nullOrUndefined(t.unitPriceMeasurement)?"":t.unitPriceMeasurement}}get unitPrice(){return this.data.unitPrice}get unitPriceMeasurement(){return this.data.unitPriceMeasurement}static getVariantIdFromString(t){return t.includes("gid://shopify/ProductVariant/")?t.substring(29):t}static formatOptions(t){return A.empty(t.selectedOptions)?this.formatOptionsFromTitle(t.title):t.selectedOptions.map((t=>t.value.trim()))}static formatOptionsFromTitle(t){return t.split("/").map((t=>t.trim()))}}var Pa=ka,Da=class extends xa{createVariant(t){return new Pa(t)}createLookupByOption(t){const e={};return t.forEach((t=>{e[t.title]=t})),e}getVariant(t){const e=Pa.getVariantIdFromString(t),i=this.lookup[e];return A.nullOrUndefined(i)?(this.logger.error("Expect variant data but got null"),new Ta({})):i}get firstVariant(){return A.empty(this.variants)?new Ta({}):this.variants[0]}get allVariantHasInventoryManager(){return this.variants.every((t=>t.isStockManaged))}getVariantByOption(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=this.createOptionKey(t),i=this.lookupByOption[e];return A.nullOrUndefined(i)?(this.logger.error("Cannot find a variant with option ids",t),new Ta({})):i}createOptionKey(t){return t.join(" / ")}get anyVariantAllowContinuePurchase(){return this.variants.some((t=>t.isContinueSellingWhenOutOfStock))}},La=class extends Ye{readData(t){return{id:this.formatProductId(t.id),handle:t.handle,title:t.title,options:[...t.options],variants:[...t.variants.edges],images:A.nullOrUndefined(t.media)?[...t.images.edges].map((t=>t.node?.url)).filter((t=>!A.empty(t))):[...t.media.edges].map((t=>t.node?.image?.url)).filter((t=>!A.empty(t))),tracksInventory:t.tracksInventory,description:t.descriptionHtml,recommendation:A.array(t.recommendation)?[...t.recommendation]:[]}}createOptionManager(t){return new wa(t)}createVariantManager(t){return new Da(t)}featuredImageAtSize(t){return Ca.getImageAtSize(t,100)}formatProductId(t){return Ca.getProductIdFromString(t)}};const Ba={"a5aec8.myshopify.com":function(){window.card_atc().then((t=>{try{window.document.getElementById("shopify-section-cart-drawer").getElementsByClassName("cart-drawer")[0].style.zIndex=9999999999}catch(t){E().error(t)}})).catch((t=>{}))}};class Oa extends da{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.env=new d}async addToCart(t,e,i){let{redirectToCartPage:r=!1,onSuccess:n}=i;const a=t.getVariantIdByOptions(e);if(A.empty(a))return void this.logger.error(`Expect a variant id but got '${a}'`);const s=await fa.post("/cart/add.js",{id:parseInt(a,10)});if(this.logger.log("Add to cart return: ",s),r)setTimeout((()=>{Oa.gotoCartPage()}),300);else{try{!function(t){if(!A.empty(window.Shopify)){let t=E();try{let e=window.Shopify.shop;A.empty(Ba[e])?t.log("shop domain does not exist in UPDATE_CART_DRAWER_FUNCTIONS"):Ba[e]()}catch(e){t.error(e)}}}()}catch(t){this.logger.error(t)}A.function(n)&&n()}}async applyCoupon(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(A.nullOrUndefined(t)||A.empty(t))return!1;const i="/discount";let r=`${i}/${t}`;if(A.empty(e)||(r=`${i}/${t}?redirect=${e}`),(()=>{const t=new RegExp(`(${["WebView","(iPhone|iPod|iPad)(?!.*Safari/)","Android.*(wv|.0.0.0)"].join("|")})`,"ig");return Boolean(navigator.userAgent.match(t))})()){const{origin:t}=window.location;return window.location.replace(`${t}${r}`),!0}const n=window.open(r,"_blank"),{title:a}=n.window.document,s=await Gt((()=>{const{title:t}=n.window.document;return a!==t}));return n.close(),s||this.logger.error("Coupon apply failed"),s}createProduct(t){return new La(t)}async requestProductData(t){const e=Fa(),i=(await e.requestData(this.shopDomain,t)).map((t=>({...t,id:Ca.getProductIdFromString(t.id)})));e.cacheData(i);const r=await Promise.all(t.map((async t=>({id:t,recommendation:await this.requestProductRecommendationData(t)}))));e.cacheData(r)}async requestProductRecommendationData(t){const e=Ca.getProductIdFromString(t),i="related",r=Oa.isOnPrimaryLocale()?Oa.recommendationApiUrl(e,i):Oa.recommendationApiUrlWithLocale(e,i);try{return(await fa.get(r)).products.map((t=>Oa.normalizePriceData(t)))}catch(t){return this.logger.error("Fail to get recommendation products"),[]}}static recommendationApiUrlWithLocale(t,e){return`/${Oa.getLocale()}/recommendations/products.json?product_id=${t}&intent=${e}`}static recommendationApiUrl(t,e){return`/recommendations/products.json?product_id=${t}&intent=${e}`}static normalizePriceData(t){return{...t,price:Oa.formatToDecimalPrice(t.price),price_min:Oa.formatToDecimalPrice(t.price_min),price_max:Oa.formatToDecimalPrice(t.price_max),compare_at_price:Oa.formatToDecimalPrice(t.compare_at_price),compare_at_price_min:Oa.formatToDecimalPrice(t.compare_at_price_min),compare_at_price_max:Oa.formatToDecimalPrice(t.compare_at_price_max)}}static formatToDecimalPrice(t){let e=t;return A.string(t)&&(e=parseInt(t,10)),0===e?"0":""+e/100}get initialPlaybackParam(){return this.isProductPage?this.getBase64OnProductPage():this.isHomepage?this.getBase64OnHomePage():Oa.isBlogPage()?this.getBase64OnPathname(r):Oa.isPagePage()?this.getBase64OnPathname(s):Oa.isCollectionPage()?this.getBase64OnPathname(n):Oa.isCartPage()?this.getBase64OnPathname("cart"):""}getBase64OnProductPage(){const t=this.shopDomain,e=this.productIdOnPage,i=o,r=!this.stateClient.isMobile;return A.nullOrUndefined(e)&&this.logger.error("Product ID is null or undefined."),this.logger.log(`Product page with product id: "${e}"`),window.btoa(`${t}+${i}+${e}+${r}`)}getBase64OnHomePage(){const t=this.shopDomain,e=a,i=!this.stateClient.isMobile;return this.logger.log("Home page"),window.btoa(`${t}+${e}+/+${i}`)}getBase64OnPathname(t){const e=this.shopDomain,i=Oa.pagePathname(),r=!this.stateClient.isMobile;return this.logger.log(`Page of type: ${t}`),window.btoa(`${e}+${t}+${i}+${r}`)}get couponApplyingMessage(){return"Applying, a new window opens soon..."}async getOrder(){if(!A.nullOrUndefined(this.order))return this.order;const{Shopify:t}=window;if(A.nullOrUndefined(t))throw new Error(`expect to get Shopify.checkout data but got ${t}`);const{checkout:e}=t;if(A.nullOrUndefined(e))throw new Error(`expect to get Shopify.checkout data but got ${e}`);return Promise.resolve(new va(e))}static getLocale(){return A.string(window.Shopify?.locale)?window.Shopify.locale:""}static getCountry(){return A.string(window.Shopify?.country)?window.Shopify.country:""}static isOnPrimaryLocale(){return A.empty(Oa.languageInPathname())}static languageInPathname(t){let e=t||window.location.pathname;e.includes("http")&&(e=new URL(e).pathname);let i=e.split("/");i=i.splice(1,i.length);const r=i[0].match(/^[a-zA-Z]{2}$/)||i[0].match(/^[a-zA-Z]{2}-[a-zA-Z]{2}$/)||i[0].match(/^[a-zA-Z]{3}$/);return null===r?"":r[0]}get pageType(){const{pageType:t}=window.meta.page,{BLOG:e,COLLECTION:i,HOME:l,PAGE:c,PRODUCT:d}=ha;switch(t){case e:return r;case i:return n;case l:return a;case c:return s;case d:return o;default:throw new Error(`Unknown page type: ${t}`)}}static pagePathname(){const{pathname:t}=window.location;if(A.nullOrUndefined(t))throw new Error(`Expect a pathname but got ${t}`);const e=Oa.getLocale();return A.empty(e)?t:t===`/${e}`?"/":t.replace(`/${e}`,"")}get productIdOnPage(){return A.nullOrUndefined(window.meta)||A.nullOrUndefined(window.meta.product)||A.empty(window.meta.product.id)?(this.logger.log("No product id on page"),null):window.meta.product.id}get shopDomain(){let t="";if(A.object(window.Shopify)&&A.string(window.Shopify.shop)&&(t=window.Shopify.shop),!t){const e=document.getElementsByTagName("script");for(let i=0;i-1&&(t=e[i].src.substring(e[i].src.indexOf("shop=")+5,e[i].src.length)),!t);i+=1);}return t||(t=document.domain),t}async getThemeName(){return new Promise((t=>{const e=window.setInterval((()=>{window.BOOMR&&window.BOOMR.themeName&&(window.clearInterval(e),t(window.BOOMR.themeName.toLowerCase()))}),200)}))}getThemeMaxSectionWidthClassName(t){const e=ua[t];return A.nullOrUndefined(e)?"":e}static gotoCartPage(){window.open(Oa.CartPageLink(),"_self")}static CartPageLink(){const{hostname:t}=window.location;return Oa.isOnPrimaryLocale()?`https://${t}/cart`:`https://${t}/${Oa.getLocale()}/cart`}get isProductPage(){const t=window.meta?.page?.pageType;return A.empty(t)?window.location.href.toLowerCase().indexOf("/products")>-1:"product"===t}get productPageSubFolder(){return"/products"}static isCollectionPage(){const t=window.meta?.page?.pageType;return A.empty(t)?window.location.href.toLowerCase().indexOf("/collections")>-1:"collection"===t}static isBlogPage(){let t;try{t=window.meta.page.pageType}catch(t){throw new Error(t)}return!A.nullOrUndefined(t)&&"article"===t||window.location.href.toLowerCase().indexOf("/blogs")>-1}static isPagePage(){let t;try{t=window.meta.page.pageType}catch(t){throw new Error(t)}return!A.nullOrUndefined(t)&&"page"===t||window.location.href.toLowerCase().indexOf("/pages")>-1}static isCartPage(){let t;try{return t=window.meta.page.pageType,"cart"===t}catch(t){this.logger.error(`error get page type in isCartPage() ${t}`)}return"/cart"===window.location.pathname}get isHomepage(){let t;try{t=window.meta.page.pageType}catch(t){return!1}if(!A.nullOrUndefined(t)){if("home"===t)return!0;if("collections"===t||"collection"===t||"product"===t)return!1}const e=["body.template-index","body#index"];for(let t=0;t{this.setProduct(t.id,t)})):this.logger.error("Expect an array but got: ",t)}async requestData(t,e){if(!A.array(e))return this.logger.error(`Expected a list of product ids to request data but got ${e}`),[];const i=e.slice(0,50),r=await pn.post("/gp",{shop_url:t,product_ids:i,source:"p"});try{if(!A.empty(window.Shopify)){const t=Ra.getCountry();if(("DE"===t||"FR"===t)&&!A.empty(r))for(let t=0;t{if(!A.empty(t.unit_price)&&!A.empty(t.unit_price_measurement)){let e=`gid://shopify/ProductVariant/${t.id}`;o[e]={unitPrice:t.unit_price,unitPriceMeasurement:{measuredType:t.unit_price_measurement.measured_type,quantityValue:t.unit_price_measurement.quantity_value,quantityUnit:t.unit_price_measurement.quantity_unit,referenceValue:t.unit_price_measurement.reference_value,referenceUnit:t.unit_price_measurement.reference_unit}}}}));for(let t=0;t{void 0===t[i]?t[i]=e[i]:ts(e[i])&&ts(t[i])&&Object.keys(e[i]).length>0&&es(t[i],e[i])}))}Za.styleTagTransform=ht(),Za.setAttributes=lt(),Za.insert=st().bind(null,"head"),Za.domAPI=nt(),Za.insertStyleElement=dt(),it()($a.A,Za),$a.A&&$a.A.locals&&$a.A.locals;const is={body:{},addEventListener(){},removeEventListener(){},activeElement:{blur(){},nodeName:""},querySelector(){return null},querySelectorAll(){return[]},getElementById(){return null},createEvent(){return{initEvent(){}}},createElement(){return{children:[],childNodes:[],style:{},setAttribute(){},getElementsByTagName(){return[]}}},createElementNS(){return{}},importNode(){return null},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""}};function rs(){const t="undefined"!=typeof document?document:{};return es(t,is),t}const ns={document:is,navigator:{userAgent:""},location:{hash:"",host:"",hostname:"",href:"",origin:"",pathname:"",protocol:"",search:""},history:{replaceState(){},pushState(){},go(){},back(){}},CustomEvent:function(){return this},addEventListener(){},removeEventListener(){},getComputedStyle(){return{getPropertyValue(){return""}}},Image(){},Date(){},screen:{},setTimeout(){},clearTimeout(){},matchMedia(){return{}},requestAnimationFrame(t){return"undefined"==typeof setTimeout?(t(),null):setTimeout(t,0)},cancelAnimationFrame(t){"undefined"!=typeof setTimeout&&clearTimeout(t)}};function as(){const t="undefined"!=typeof window?window:{};return es(t,ns),t}function ss(t,e){return void 0===e&&(e=0),setTimeout(t,e)}function os(){return Date.now()}function ls(t){return"object"==typeof t&&null!==t&&t.constructor&&"Object"===Object.prototype.toString.call(t).slice(8,-1)}function cs(){const t=Object(arguments.length<=0?void 0:arguments[0]),e=["__proto__","constructor","prototype"];for(let r=1;re.indexOf(t)<0));for(let e=0,r=i.length;ea?"next":"prev",d=(t,e)=>"next"===c&&t>=e||"prev"===c&&t<=e,u=()=>{s=(new Date).getTime(),null===o&&(o=s);const t=Math.max(Math.min((s-o)/l,1),0),c=.5-Math.cos(t*Math.PI)/2;let h=a+c*(i-a);if(d(h,i)&&(h=i),e.wrapperEl.scrollTo({[r]:h}),d(h,i))return e.wrapperEl.style.overflow="hidden",e.wrapperEl.style.scrollSnapType="",setTimeout((()=>{e.wrapperEl.style.overflow="",e.wrapperEl.scrollTo({[r]:h})})),void n.cancelAnimationFrame(e.cssModeFrameID);e.cssModeFrameID=n.requestAnimationFrame(u)};u()}function hs(t,e){return void 0===e&&(e=""),[...t.children].filter((t=>t.matches(e)))}function ps(t){try{return void console.warn(t)}catch(t){}}function gs(t,e){void 0===e&&(e=[]);const i=document.createElement(t);return i.classList.add(...Array.isArray(e)?e:function(t){return void 0===t&&(t=""),t.trim().split(" ").filter((t=>!!t.trim()))}(e)),i}function fs(t,e){return as().getComputedStyle(t,null).getPropertyValue(e)}function ms(t){let e,i=t;if(i){for(e=0;null!==(i=i.previousSibling);)1===i.nodeType&&(e+=1);return e}}function vs(t,e){const i=[];let r=t.parentElement;for(;r;)e?r.matches(e)&&i.push(r):i.push(r),r=r.parentElement;return i}function ys(t,e,i){const r=as();return i?t["width"===e?"offsetWidth":"offsetHeight"]+parseFloat(r.getComputedStyle(t,null).getPropertyValue("width"===e?"margin-right":"margin-top"))+parseFloat(r.getComputedStyle(t,null).getPropertyValue("width"===e?"margin-left":"margin-bottom")):t.offsetWidth}function As(t){return(Array.isArray(t)?t:[t]).filter((t=>!!t))}let bs,_s,ws;function Cs(){return bs||(bs=function(){const t=as(),e=rs();return{smoothScroll:e.documentElement&&e.documentElement.style&&"scrollBehavior"in e.documentElement.style,touch:!!("ontouchstart"in t||t.DocumentTouch&&e instanceof t.DocumentTouch)}}()),bs}function Es(t){return void 0===t&&(t={}),_s||(_s=function(t){let{userAgent:e}=void 0===t?{}:t;const i=Cs(),r=as(),n=r.navigator.platform,a=e||r.navigator.userAgent,s={ios:!1,android:!1},o=r.screen.width,l=r.screen.height,c=a.match(/(Android);?[\s\/]+([\d.]+)?/);let d=a.match(/(iPad).*OS\s([\d_]+)/);const u=a.match(/(iPod)(.*OS\s([\d_]+))?/),h=!d&&a.match(/(iPhone\sOS|iOS)\s([\d_]+)/),p="Win32"===n;let g="MacIntel"===n;return!d&&g&&i.touch&&["1024x1366","1366x1024","834x1194","1194x834","834x1112","1112x834","768x1024","1024x768","820x1180","1180x820","810x1080","1080x810"].indexOf(`${o}x${l}`)>=0&&(d=a.match(/(Version)\/([\d.]+)/),d||(d=[0,1,"13_0_0"]),g=!1),c&&!p&&(s.os="android",s.android=!0),(d||h||u)&&(s.os="ios",s.ios=!0),s}(t)),_s}var Ts={on(t,e,i){const r=this;if(!r.eventsListeners||r.destroyed)return r;if("function"!=typeof e)return r;const n=i?"unshift":"push";return t.split(" ").forEach((t=>{r.eventsListeners[t]||(r.eventsListeners[t]=[]),r.eventsListeners[t][n](e)})),r},once(t,e,i){const r=this;if(!r.eventsListeners||r.destroyed)return r;if("function"!=typeof e)return r;function n(){r.off(t,n),n.__emitterProxy&&delete n.__emitterProxy;for(var i=arguments.length,a=new Array(i),s=0;s=0&&e.eventsAnyListeners.splice(i,1),e},off(t,e){const i=this;return!i.eventsListeners||i.destroyed?i:i.eventsListeners?(t.split(" ").forEach((t=>{void 0===e?i.eventsListeners[t]=[]:i.eventsListeners[t]&&i.eventsListeners[t].forEach(((r,n)=>{(r===e||r.__emitterProxy&&r.__emitterProxy===e)&&i.eventsListeners[t].splice(n,1)}))})),i):i},emit(){const t=this;if(!t.eventsListeners||t.destroyed)return t;if(!t.eventsListeners)return t;let e,i,r;for(var n=arguments.length,a=new Array(n),s=0;s{t.eventsAnyListeners&&t.eventsAnyListeners.length&&t.eventsAnyListeners.forEach((t=>{t.apply(r,[e,...i])})),t.eventsListeners&&t.eventsListeners[e]&&t.eventsListeners[e].forEach((t=>{t.apply(r,i)}))})),t}};const Is=(t,e,i)=>{e&&!t.classList.contains(i)?t.classList.add(i):!e&&t.classList.contains(i)&&t.classList.remove(i)},Ss=(t,e,i)=>{e&&!t.classList.contains(i)?t.classList.add(i):!e&&t.classList.contains(i)&&t.classList.remove(i)},xs=(t,e)=>{if(!t||t.destroyed||!t.params)return;const i=e.closest(t.isElement?"swiper-slide":`.${t.params.slideClass}`);if(i){let e=i.querySelector(`.${t.params.lazyPreloaderClass}`);!e&&t.isElement&&(i.shadowRoot?e=i.shadowRoot.querySelector(`.${t.params.lazyPreloaderClass}`):requestAnimationFrame((()=>{i.shadowRoot&&(e=i.shadowRoot.querySelector(`.${t.params.lazyPreloaderClass}`),e&&e.remove())}))),e&&e.remove()}},ks=(t,e)=>{if(!t.slides[e])return;const i=t.slides[e].querySelector('[loading="lazy"]');i&&i.removeAttribute("loading")},Ps=t=>{if(!t||t.destroyed||!t.params)return;let e=t.params.lazyPreloadPrevNext;const i=t.slides.length;if(!i||!e||e<0)return;e=Math.min(e,i);const r="auto"===t.params.slidesPerView?t.slidesPerViewDynamic():Math.ceil(t.params.slidesPerView),n=t.activeIndex;if(t.params.grid&&t.params.grid.rows>1){const i=n,a=[i-e];return a.push(...Array.from({length:e}).map(((t,e)=>i+r+e))),void t.slides.forEach(((e,i)=>{a.includes(e.column)&&ks(t,i)}))}const a=n+r-1;if(t.params.rewind||t.params.loop)for(let r=n-e;r<=a+e;r+=1){const e=(r%i+i)%i;(ea)&&ks(t,e)}else for(let r=Math.max(n-e,0);r<=Math.min(a+e,i-1);r+=1)r!==n&&(r>a||r=0?A=parseFloat(A.replace("%",""))/100*a:"string"==typeof A&&(A=parseFloat(A)),t.virtualSize=-A,d.forEach((t=>{s?t.style.marginLeft="":t.style.marginRight="",t.style.marginBottom="",t.style.marginTop=""})),i.centeredSlides&&i.cssMode&&(ds(r,"--swiper-centered-offset-before",""),ds(r,"--swiper-centered-offset-after",""));const C=i.grid&&i.grid.rows>1&&t.grid;let E;C?t.grid.initSlides(d):t.grid&&t.grid.unsetSlides();const T="auto"===i.slidesPerView&&i.breakpoints&&Object.keys(i.breakpoints).filter((t=>void 0!==i.breakpoints[t].slidesPerView)).length>0;for(let r=0;r1&&h.push(t.virtualSize-a)}if(l&&i.loop){const e=g[0]+A;if(i.slidesPerGroup>1){const r=Math.ceil((t.virtual.slidesBefore+t.virtual.slidesAfter)/i.slidesPerGroup),n=e*i.slidesPerGroup;for(let t=0;t!(i.cssMode&&!i.loop)||e!==d.length-1)).forEach((t=>{t.style[e]=`${A}px`}))}if(i.centeredSlides&&i.centeredSlidesBounds){let t=0;g.forEach((e=>{t+=e+(A||0)})),t-=A;const e=t-a;h=h.map((t=>t<=0?-f:t>e?e+m:t))}if(i.centerInsufficientSlides){let t=0;g.forEach((e=>{t+=e+(A||0)})),t-=A;const e=(i.slidesOffsetBefore||0)+(i.slidesOffsetAfter||0);if(t+e{h[e]=t-i})),p.forEach(((t,e)=>{p[e]=t+i}))}}if(Object.assign(t,{slides:d,snapGrid:h,slidesGrid:p,slidesSizesGrid:g}),i.centeredSlides&&i.cssMode&&!i.centeredSlidesBounds){ds(r,"--swiper-centered-offset-before",-h[0]+"px"),ds(r,"--swiper-centered-offset-after",t.size/2-g[g.length-1]/2+"px");const e=-t.snapGrid[0],i=-t.slidesGrid[0];t.snapGrid=t.snapGrid.map((t=>t+e)),t.slidesGrid=t.slidesGrid.map((t=>t+i))}if(u!==c&&t.emit("slidesLengthChange"),h.length!==v&&(t.params.watchOverflow&&t.checkOverflow(),t.emit("snapGridLengthChange")),p.length!==y&&t.emit("slidesGridLengthChange"),i.watchSlidesProgress&&t.updateSlidesOffset(),t.emit("slidesUpdated"),!(l||i.cssMode||"slide"!==i.effect&&"fade"!==i.effect)){const e=`${i.containerModifierClass}backface-hidden`,r=t.el.classList.contains(e);u<=i.maxBackfaceHiddenSlides?r||t.el.classList.add(e):r&&t.el.classList.remove(e)}},updateAutoHeight:function(t){const e=this,i=[],r=e.virtual&&e.params.virtual.enabled;let n,a=0;"number"==typeof t?e.setTransition(t):!0===t&&e.setTransition(e.params.speed);const s=t=>r?e.slides[e.getSlideIndexByData(t)]:e.slides[t];if("auto"!==e.params.slidesPerView&&e.params.slidesPerView>1)if(e.params.centeredSlides)(e.visibleSlides||[]).forEach((t=>{i.push(t)}));else for(n=0;ne.slides.length&&!r)break;i.push(s(t))}else i.push(s(e.activeIndex));for(n=0;na?t:a}(a||0===a)&&(e.wrapperEl.style.height=`${a}px`)},updateSlidesOffset:function(){const t=this,e=t.slides,i=t.isElement?t.isHorizontal()?t.wrapperEl.offsetLeft:t.wrapperEl.offsetTop:0;for(let r=0;r=0?o=parseFloat(o.replace("%",""))/100*e.size:"string"==typeof o&&(o=parseFloat(o));for(let t=0;t=0&&h<=e.size-e.slidesSizesGrid[t],f=h>=0&&h1&&p<=e.size||h<=0&&p>=e.size;f&&(e.visibleSlides.push(l),e.visibleSlidesIndexes.push(t)),Is(l,f,i.slideVisibleClass),Is(l,g,i.slideFullyVisibleClass),l.progress=n?-d:d,l.originalProgress=n?-u:u}},updateProgress:function(t){const e=this;if(void 0===t){const i=e.rtlTranslate?-1:1;t=e&&e.translate&&e.translate*i||0}const i=e.params,r=e.maxTranslate()-e.minTranslate();let{progress:n,isBeginning:a,isEnd:s,progressLoop:o}=e;const l=a,c=s;if(0===r)n=0,a=!0,s=!0;else{n=(t-e.minTranslate())/r;const i=Math.abs(t-e.minTranslate())<1,o=Math.abs(t-e.maxTranslate())<1;a=i||n<=0,s=o||n>=1,i&&(n=0),o&&(n=1)}if(i.loop){const i=e.getSlideIndexByData(0),r=e.getSlideIndexByData(e.slides.length-1),n=e.slidesGrid[i],a=e.slidesGrid[r],s=e.slidesGrid[e.slidesGrid.length-1],l=Math.abs(t);o=l>=n?(l-n)/s:(l+s-a)/s,o>1&&(o-=1)}Object.assign(e,{progress:n,progressLoop:o,isBeginning:a,isEnd:s}),(i.watchSlidesProgress||i.centeredSlides&&i.autoHeight)&&e.updateSlidesProgress(t),a&&!l&&e.emit("reachBeginning toEdge"),s&&!c&&e.emit("reachEnd toEdge"),(l&&!a||c&&!s)&&e.emit("fromEdge"),e.emit("progress",n)},updateSlidesClasses:function(){const t=this,{slides:e,params:i,slidesEl:r,activeIndex:n}=t,a=t.virtual&&i.virtual.enabled,s=t.grid&&i.grid&&i.grid.rows>1,o=t=>hs(r,`.${i.slideClass}${t}, swiper-slide${t}`)[0];let l,c,d;if(a)if(i.loop){let e=n-t.virtual.slidesBefore;e<0&&(e=t.virtual.slides.length+e),e>=t.virtual.slides.length&&(e-=t.virtual.slides.length),l=o(`[data-swiper-slide-index="${e}"]`)}else l=o(`[data-swiper-slide-index="${n}"]`);else s?(l=e.filter((t=>t.column===n))[0],d=e.filter((t=>t.column===n+1))[0],c=e.filter((t=>t.column===n-1))[0]):l=e[n];l&&(s||(d=function(t,e){const i=[];for(;t.nextElementSibling;){const r=t.nextElementSibling;e?r.matches(e)&&i.push(r):i.push(r),t=r}return i}(l,`.${i.slideClass}, swiper-slide`)[0],i.loop&&!d&&(d=e[0]),c=function(t,e){const i=[];for(;t.previousElementSibling;){const r=t.previousElementSibling;e?r.matches(e)&&i.push(r):i.push(r),t=r}return i}(l,`.${i.slideClass}, swiper-slide`)[0],i.loop&&0===!c&&(c=e[e.length-1]))),e.forEach((t=>{Ss(t,t===l,i.slideActiveClass),Ss(t,t===d,i.slideNextClass),Ss(t,t===c,i.slidePrevClass)})),t.emitSlidesClasses()},updateActiveIndex:function(t){const e=this,i=e.rtlTranslate?e.translate:-e.translate,{snapGrid:r,params:n,activeIndex:a,realIndex:s,snapIndex:o}=e;let l,c=t;const d=t=>{let i=t-e.virtual.slidesBefore;return i<0&&(i=e.virtual.slides.length+i),i>=e.virtual.slides.length&&(i-=e.virtual.slides.length),i};if(void 0===c&&(c=function(t){const{slidesGrid:e,params:i}=t,r=t.rtlTranslate?t.translate:-t.translate;let n;for(let t=0;t=e[t]&&r=e[t]&&r=e[t]&&(n=t);return i.normalizeSlideIndex&&(n<0||void 0===n)&&(n=0),n}(e)),r.indexOf(i)>=0)l=r.indexOf(i);else{const t=Math.min(n.slidesPerGroupSkip,c);l=t+Math.floor((c-t)/n.slidesPerGroup)}if(l>=r.length&&(l=r.length-1),c===a&&!e.params.loop)return void(l!==o&&(e.snapIndex=l,e.emit("snapIndexChange")));if(c===a&&e.params.loop&&e.virtual&&e.params.virtual.enabled)return void(e.realIndex=d(c));const u=e.grid&&n.grid&&n.grid.rows>1;let h;if(e.virtual&&n.virtual.enabled&&n.loop)h=d(c);else if(u){const t=e.slides.filter((t=>t.column===c))[0];let i=parseInt(t.getAttribute("data-swiper-slide-index"),10);Number.isNaN(i)&&(i=Math.max(e.slides.indexOf(t),0)),h=Math.floor(i/n.grid.rows)}else if(e.slides[c]){const t=e.slides[c].getAttribute("data-swiper-slide-index");h=t?parseInt(t,10):c}else h=c;Object.assign(e,{previousSnapIndex:o,snapIndex:l,previousRealIndex:s,realIndex:h,previousIndex:a,activeIndex:c}),e.initialized&&Ps(e),e.emit("activeIndexChange"),e.emit("snapIndexChange"),(e.initialized||e.params.runCallbacksOnInit)&&(s!==h&&e.emit("realIndexChange"),e.emit("slideChange"))},updateClickedSlide:function(t,e){const i=this,r=i.params;let n=t.closest(`.${r.slideClass}, swiper-slide`);!n&&i.isElement&&e&&e.length>1&&e.includes(t)&&[...e.slice(e.indexOf(t)+1,e.length)].forEach((t=>{!n&&t.matches&&t.matches(`.${r.slideClass}, swiper-slide`)&&(n=t)}));let a,s=!1;if(n)for(let t=0;ts?"next":a=l.length&&(m=l.length-1);const v=-l[m];if(o.normalizeSlideIndex)for(let t=0;t=i&&e=i&&e=i&&(s=t)}if(a.initialized&&s!==u){if(!a.allowSlideNext&&(h?v>a.translate&&v>a.minTranslate():va.translate&&v>a.maxTranslate()&&(u||0)!==s)return!1}let y;if(s!==(d||0)&&i&&a.emit("beforeSlideChangeStart"),a.updateProgress(v),y=s>u?"next":s0?(a._cssModeVirtualInitialSet=!0,requestAnimationFrame((()=>{p[t?"scrollLeft":"scrollTop"]=i}))):p[t?"scrollLeft":"scrollTop"]=i,e&&requestAnimationFrame((()=>{a.wrapperEl.style.scrollSnapType="",a._immediateVirtual=!1}))}else{if(!a.support.smoothScroll)return us({swiper:a,targetPosition:i,side:t?"left":"top"}),!0;p.scrollTo({[t?"left":"top"]:i,behavior:"smooth"})}return!0}return a.setTransition(e),a.setTranslate(v),a.updateActiveIndex(s),a.updateSlidesClasses(),a.emit("beforeTransitionStart",e,r),a.transitionStart(i,y),0===e?a.transitionEnd(i,y):a.animating||(a.animating=!0,a.onSlideToWrapperTransitionEnd||(a.onSlideToWrapperTransitionEnd=function(t){a&&!a.destroyed&&t.target===this&&(a.wrapperEl.removeEventListener("transitionend",a.onSlideToWrapperTransitionEnd),a.onSlideToWrapperTransitionEnd=null,delete a.onSlideToWrapperTransitionEnd,a.transitionEnd(i,y))}),a.wrapperEl.addEventListener("transitionend",a.onSlideToWrapperTransitionEnd)),!0},slideToLoop:function(t,e,i,r){void 0===t&&(t=0),void 0===i&&(i=!0),"string"==typeof t&&(t=parseInt(t,10));const n=this;if(n.destroyed)return;void 0===e&&(e=n.params.speed);const a=n.grid&&n.params.grid&&n.params.grid.rows>1;let s=t;if(n.params.loop)if(n.virtual&&n.params.virtual.enabled)s+=n.virtual.slidesBefore;else{let t;if(a){const e=s*n.params.grid.rows;t=n.slides.filter((t=>1*t.getAttribute("data-swiper-slide-index")===e))[0].column}else t=n.getSlideIndexByData(s);const e=a?Math.ceil(n.slides.length/n.params.grid.rows):n.slides.length,{centeredSlides:i}=n.params;let o=n.params.slidesPerView;"auto"===o?o=n.slidesPerViewDynamic():(o=Math.ceil(parseFloat(n.params.slidesPerView,10)),i&&o%2==0&&(o+=1));let l=e-t1*e.getAttribute("data-swiper-slide-index")===t))[0].column}else s=n.getSlideIndexByData(s)}return requestAnimationFrame((()=>{n.slideTo(s,e,i,r)})),n},slideNext:function(t,e,i){void 0===e&&(e=!0);const r=this,{enabled:n,params:a,animating:s}=r;if(!n||r.destroyed)return r;void 0===t&&(t=r.params.speed);let o=a.slidesPerGroup;"auto"===a.slidesPerView&&1===a.slidesPerGroup&&a.slidesPerGroupAuto&&(o=Math.max(r.slidesPerViewDynamic("current",!0),1));const l=r.activeIndex{r.slideTo(r.activeIndex+l,t,e,i)})),!0}return a.rewind&&r.isEnd?r.slideTo(0,t,e,i):r.slideTo(r.activeIndex+l,t,e,i)},slidePrev:function(t,e,i){void 0===e&&(e=!0);const r=this,{params:n,snapGrid:a,slidesGrid:s,rtlTranslate:o,enabled:l,animating:c}=r;if(!l||r.destroyed)return r;void 0===t&&(t=r.params.speed);const d=r.virtual&&n.virtual.enabled;if(n.loop){if(c&&!d&&n.loopPreventsSliding)return!1;r.loopFix({direction:"prev"}),r._clientLeft=r.wrapperEl.clientLeft}function u(t){return t<0?-Math.floor(Math.abs(t)):Math.floor(t)}const h=u(o?r.translate:-r.translate),p=a.map((t=>u(t)));let g=a[p.indexOf(h)-1];if(void 0===g&&n.cssMode){let t;a.forEach(((e,i)=>{h>=e&&(t=i)})),void 0!==t&&(g=a[t>0?t-1:t])}let f=0;if(void 0!==g&&(f=s.indexOf(g),f<0&&(f=r.activeIndex-1),"auto"===n.slidesPerView&&1===n.slidesPerGroup&&n.slidesPerGroupAuto&&(f=f-r.slidesPerViewDynamic("previous",!0)+1,f=Math.max(f,0))),n.rewind&&r.isBeginning){const n=r.params.virtual&&r.params.virtual.enabled&&r.virtual?r.virtual.slides.length-1:r.slides.length-1;return r.slideTo(n,t,e,i)}return n.loop&&0===r.activeIndex&&n.cssMode?(requestAnimationFrame((()=>{r.slideTo(f,t,e,i)})),!0):r.slideTo(f,t,e,i)},slideReset:function(t,e,i){void 0===e&&(e=!0);const r=this;if(!r.destroyed)return void 0===t&&(t=r.params.speed),r.slideTo(r.activeIndex,t,e,i)},slideToClosest:function(t,e,i,r){void 0===e&&(e=!0),void 0===r&&(r=.5);const n=this;if(n.destroyed)return;void 0===t&&(t=n.params.speed);let a=n.activeIndex;const s=Math.min(n.params.slidesPerGroupSkip,a),o=s+Math.floor((a-s)/n.params.slidesPerGroup),l=n.rtlTranslate?n.translate:-n.translate;if(l>=n.snapGrid[o]){const t=n.snapGrid[o];l-t>(n.snapGrid[o+1]-t)*r&&(a+=n.params.slidesPerGroup)}else{const t=n.snapGrid[o-1];l-t<=(n.snapGrid[o]-t)*r&&(a-=n.params.slidesPerGroup)}return a=Math.max(a,0),a=Math.min(a,n.slidesGrid.length-1),n.slideTo(a,t,e,i)},slideToClickedSlide:function(){const t=this;if(t.destroyed)return;const{params:e,slidesEl:i}=t,r="auto"===e.slidesPerView?t.slidesPerViewDynamic():e.slidesPerView;let n,a=t.clickedIndex;const s=t.isElement?"swiper-slide":`.${e.slideClass}`;if(e.loop){if(t.animating)return;n=parseInt(t.clickedSlide.getAttribute("data-swiper-slide-index"),10),e.centeredSlides?at.slides.length-t.loopedSlides+r/2?(t.loopFix(),a=t.getSlideIndex(hs(i,`${s}[data-swiper-slide-index="${n}"]`)[0]),ss((()=>{t.slideTo(a)}))):t.slideTo(a):a>t.slides.length-r?(t.loopFix(),a=t.getSlideIndex(hs(i,`${s}[data-swiper-slide-index="${n}"]`)[0]),ss((()=>{t.slideTo(a)}))):t.slideTo(a)}else t.slideTo(a)}},Os={loopCreate:function(t){const e=this,{params:i,slidesEl:r}=e;if(!i.loop||e.virtual&&e.params.virtual.enabled)return;const n=()=>{hs(r,`.${i.slideClass}, swiper-slide`).forEach(((t,e)=>{t.setAttribute("data-swiper-slide-index",e)}))},a=e.grid&&i.grid&&i.grid.rows>1,s=i.slidesPerGroup*(a?i.grid.rows:1),o=e.slides.length%s!=0,l=a&&e.slides.length%i.grid.rows!=0,c=t=>{for(let r=0;r1;c.lengtht.classList.contains(p.slideActiveClass)))[0]):_=a;const w="next"===r||!r,C="prev"===r||!r;let E=0,T=0;const I=y?Math.ceil(c.length/p.grid.rows):c.length,S=(y?c[a].column:a)+(g&&void 0===n?-f/2+.5:0);if(S=0;e-=1)c[e].column===t&&A.push(e)}else A.push(I-e-1)}}else if(S+f>I-v){T=Math.max(S-(I-2*v),m);for(let t=0;t{t.column===e&&b.push(i)})):b.push(e)}}if(l.__preventObserver__=!0,requestAnimationFrame((()=>{l.__preventObserver__=!1})),C&&A.forEach((t=>{c[t].swiperLoopMoveDOM=!0,h.prepend(c[t]),c[t].swiperLoopMoveDOM=!1})),w&&b.forEach((t=>{c[t].swiperLoopMoveDOM=!0,h.append(c[t]),c[t].swiperLoopMoveDOM=!1})),l.recalcSlides(),"auto"===p.slidesPerView?l.updateSlides():y&&(A.length>0&&C||b.length>0&&w)&&l.slides.forEach(((t,e)=>{l.grid.updateSlide(e,t,l.slides)})),p.watchSlidesProgress&&l.updateSlidesOffset(),i)if(A.length>0&&C){if(void 0===e){const t=l.slidesGrid[_],e=l.slidesGrid[_+E]-t;o?l.setTranslate(l.translate-e):(l.slideTo(_+Math.ceil(E),0,!1,!0),n&&(l.touchEventsData.startTranslate=l.touchEventsData.startTranslate-e,l.touchEventsData.currentTranslate=l.touchEventsData.currentTranslate-e))}else if(n){const t=y?A.length/p.grid.rows:A.length;l.slideTo(l.activeIndex+t,0,!1,!0),l.touchEventsData.currentTranslate=l.translate}}else if(b.length>0&&w)if(void 0===e){const t=l.slidesGrid[_],e=l.slidesGrid[_-T]-t;o?l.setTranslate(l.translate-e):(l.slideTo(_-T,0,!1,!0),n&&(l.touchEventsData.startTranslate=l.touchEventsData.startTranslate-e,l.touchEventsData.currentTranslate=l.touchEventsData.currentTranslate-e))}else{const t=y?b.length/p.grid.rows:b.length;l.slideTo(l.activeIndex-t,0,!1,!0)}if(l.allowSlidePrev=d,l.allowSlideNext=u,l.controller&&l.controller.control&&!s){const t={slideRealIndex:e,direction:r,setTranslate:n,activeSlideIndex:a,byController:!0};Array.isArray(l.controller.control)?l.controller.control.forEach((e=>{!e.destroyed&&e.params.loop&&e.loopFix({...t,slideTo:e.params.slidesPerView===p.slidesPerView&&i})})):l.controller.control instanceof l.constructor&&l.controller.control.params.loop&&l.controller.control.loopFix({...t,slideTo:l.controller.control.params.slidesPerView===p.slidesPerView&&i})}l.emit("loopFix")},loopDestroy:function(){const t=this,{params:e,slidesEl:i}=t;if(!e.loop||t.virtual&&t.params.virtual.enabled)return;t.recalcSlides();const r=[];t.slides.forEach((t=>{const e=void 0===t.swiperSlideIndex?1*t.getAttribute("data-swiper-slide-index"):t.swiperSlideIndex;r[e]=t})),t.slides.forEach((t=>{t.removeAttribute("data-swiper-slide-index")})),r.forEach((t=>{i.append(t)})),t.recalcSlides(),t.slideTo(t.realIndex,0)}};function Rs(t,e,i){const r=as(),{params:n}=t,a=n.edgeSwipeDetection,s=n.edgeSwipeThreshold;return!a||!(i<=s||i>=r.innerWidth-s)||"prevent"===a&&(e.preventDefault(),!0)}function Ms(t){const e=this,i=rs();let r=t;r.originalEvent&&(r=r.originalEvent);const n=e.touchEventsData;if("pointerdown"===r.type){if(null!==n.pointerId&&n.pointerId!==r.pointerId)return;n.pointerId=r.pointerId}else"touchstart"===r.type&&1===r.targetTouches.length&&(n.touchId=r.targetTouches[0].identifier);if("touchstart"===r.type)return void Rs(e,r,r.targetTouches[0].pageX);const{params:a,touches:s,enabled:o}=e;if(!o)return;if(!a.simulateTouch&&"mouse"===r.pointerType)return;if(e.animating&&a.preventInteractionOnTransition)return;!e.animating&&a.cssMode&&a.loop&&e.loopFix();let l=r.target;if("wrapper"===a.touchEventsTarget&&!e.wrapperEl.contains(l))return;if("which"in r&&3===r.which)return;if("button"in r&&r.button>0)return;if(n.isTouched&&n.isMoved)return;const c=!!a.noSwipingClass&&""!==a.noSwipingClass,d=r.composedPath?r.composedPath():r.path;c&&r.target&&r.target.shadowRoot&&d&&(l=d[0]);const u=a.noSwipingSelector?a.noSwipingSelector:`.${a.noSwipingClass}`,h=!(!r.target||!r.target.shadowRoot);if(a.noSwiping&&(h?function(t,e){return void 0===e&&(e=this),function e(i){if(!i||i===rs()||i===as())return null;i.assignedSlot&&(i=i.assignedSlot);const r=i.closest(t);return r||i.getRootNode?r||e(i.getRootNode().host):null}(e)}(u,l):l.closest(u)))return void(e.allowClick=!0);if(a.swipeHandler&&!l.closest(a.swipeHandler))return;s.currentX=r.pageX,s.currentY=r.pageY;const p=s.currentX,g=s.currentY;if(!Rs(e,r,p))return;Object.assign(n,{isTouched:!0,isMoved:!1,allowTouchCallbacks:!0,isScrolling:void 0,startMoving:void 0}),s.startX=p,s.startY=g,n.touchStartTime=os(),e.allowClick=!0,e.updateSize(),e.swipeDirection=void 0,a.threshold>0&&(n.allowThresholdMove=!1);let f=!0;l.matches(n.focusableElements)&&(f=!1,"SELECT"===l.nodeName&&(n.isTouched=!1)),i.activeElement&&i.activeElement.matches(n.focusableElements)&&i.activeElement!==l&&i.activeElement.blur();const m=f&&e.allowTouchMove&&a.touchStartPreventDefault;!a.touchStartForcePreventDefault&&!m||l.isContentEditable||r.preventDefault(),a.freeMode&&a.freeMode.enabled&&e.freeMode&&e.animating&&!a.cssMode&&e.freeMode.onTouchStart(),e.emit("touchStart",r)}function Ns(t){const e=rs(),i=this,r=i.touchEventsData,{params:n,touches:a,rtlTranslate:s,enabled:o}=i;if(!o)return;if(!n.simulateTouch&&"mouse"===t.pointerType)return;let l,c=t;if(c.originalEvent&&(c=c.originalEvent),"pointermove"===c.type){if(null!==r.touchId)return;if(c.pointerId!==r.pointerId)return}if("touchmove"===c.type){if(l=[...c.changedTouches].filter((t=>t.identifier===r.touchId))[0],!l||l.identifier!==r.touchId)return}else l=c;if(!r.isTouched)return void(r.startMoving&&r.isScrolling&&i.emit("touchMoveOpposite",c));const d=l.pageX,u=l.pageY;if(c.preventedByNestedSwiper)return a.startX=d,void(a.startY=u);if(!i.allowTouchMove)return c.target.matches(r.focusableElements)||(i.allowClick=!1),void(r.isTouched&&(Object.assign(a,{startX:d,startY:u,currentX:d,currentY:u}),r.touchStartTime=os()));if(n.touchReleaseOnEdges&&!n.loop)if(i.isVertical()){if(ua.startY&&i.translate>=i.minTranslate())return r.isTouched=!1,void(r.isMoved=!1)}else if(da.startX&&i.translate>=i.minTranslate())return;if(e.activeElement&&c.target===e.activeElement&&c.target.matches(r.focusableElements))return r.isMoved=!0,void(i.allowClick=!1);r.allowTouchCallbacks&&i.emit("touchMove",c),a.previousX=a.currentX,a.previousY=a.currentY,a.currentX=d,a.currentY=u;const h=a.currentX-a.startX,p=a.currentY-a.startY;if(i.params.threshold&&Math.sqrt(h**2+p**2)=25&&(t=180*Math.atan2(Math.abs(p),Math.abs(h))/Math.PI,r.isScrolling=i.isHorizontal()?t>n.touchAngle:90-t>n.touchAngle)}if(r.isScrolling&&i.emit("touchMoveOpposite",c),void 0===r.startMoving&&(a.currentX===a.startX&&a.currentY===a.startY||(r.startMoving=!0)),r.isScrolling||"touchmove"===c.type&&r.preventTouchMoveFromPointerMove)return void(r.isTouched=!1);if(!r.startMoving)return;i.allowClick=!1,!n.cssMode&&c.cancelable&&c.preventDefault(),n.touchMoveStopPropagation&&!n.nested&&c.stopPropagation();let g=i.isHorizontal()?h:p,f=i.isHorizontal()?a.currentX-a.previousX:a.currentY-a.previousY;n.oneWayMovement&&(g=Math.abs(g)*(s?1:-1),f=Math.abs(f)*(s?1:-1)),a.diff=g,g*=n.touchRatio,s&&(g=-g,f=-f);const m=i.touchesDirection;i.swipeDirection=g>0?"prev":"next",i.touchesDirection=f>0?"prev":"next";const v=i.params.loop&&!n.cssMode,y="next"===i.touchesDirection&&i.allowSlideNext||"prev"===i.touchesDirection&&i.allowSlidePrev;if(!r.isMoved){if(v&&y&&i.loopFix({direction:i.swipeDirection}),r.startTranslate=i.getTranslate(),i.setTransition(0),i.animating){const t=new window.CustomEvent("transitionend",{bubbles:!0,cancelable:!0,detail:{bySwiperTouchMove:!0}});i.wrapperEl.dispatchEvent(t)}r.allowMomentumBounce=!1,!n.grabCursor||!0!==i.allowSlideNext&&!0!==i.allowSlidePrev||i.setGrabCursor(!0),i.emit("sliderFirstMove",c)}if((new Date).getTime(),r.isMoved&&r.allowThresholdMove&&m!==i.touchesDirection&&v&&y&&Math.abs(g)>=1)return Object.assign(a,{startX:d,startY:u,currentX:d,currentY:u,startTranslate:r.currentTranslate}),r.loopSwapReset=!0,void(r.startTranslate=r.currentTranslate);i.emit("sliderMove",c),r.isMoved=!0,r.currentTranslate=g+r.startTranslate;let A=!0,b=n.resistanceRatio;if(n.touchReleaseOnEdges&&(b=0),g>0?(v&&y&&r.allowThresholdMove&&r.currentTranslate>(n.centeredSlides?i.minTranslate()-i.slidesSizesGrid[i.activeIndex+1]:i.minTranslate())&&i.loopFix({direction:"prev",setTranslate:!0,activeSlideIndex:0}),r.currentTranslate>i.minTranslate()&&(A=!1,n.resistance&&(r.currentTranslate=i.minTranslate()-1+(-i.minTranslate()+r.startTranslate+g)**b))):g<0&&(v&&y&&r.allowThresholdMove&&r.currentTranslate<(n.centeredSlides?i.maxTranslate()+i.slidesSizesGrid[i.slidesSizesGrid.length-1]:i.maxTranslate())&&i.loopFix({direction:"next",setTranslate:!0,activeSlideIndex:i.slides.length-("auto"===n.slidesPerView?i.slidesPerViewDynamic():Math.ceil(parseFloat(n.slidesPerView,10)))}),r.currentTranslater.startTranslate&&(r.currentTranslate=r.startTranslate),i.allowSlidePrev||i.allowSlideNext||(r.currentTranslate=r.startTranslate),n.threshold>0){if(!(Math.abs(g)>n.threshold||r.allowThresholdMove))return void(r.currentTranslate=r.startTranslate);if(!r.allowThresholdMove)return r.allowThresholdMove=!0,a.startX=a.currentX,a.startY=a.currentY,r.currentTranslate=r.startTranslate,void(a.diff=i.isHorizontal()?a.currentX-a.startX:a.currentY-a.startY)}n.followFinger&&!n.cssMode&&((n.freeMode&&n.freeMode.enabled&&i.freeMode||n.watchSlidesProgress)&&(i.updateActiveIndex(),i.updateSlidesClasses()),n.freeMode&&n.freeMode.enabled&&i.freeMode&&i.freeMode.onTouchMove(),i.updateProgress(r.currentTranslate),i.setTranslate(r.currentTranslate))}function Fs(t){const e=this,i=e.touchEventsData;let r,n=t;if(n.originalEvent&&(n=n.originalEvent),"touchend"===n.type||"touchcancel"===n.type){if(r=[...n.changedTouches].filter((t=>t.identifier===i.touchId))[0],!r||r.identifier!==i.touchId)return}else{if(null!==i.touchId)return;if(n.pointerId!==i.pointerId)return;r=n}if(["pointercancel","pointerout","pointerleave","contextmenu"].includes(n.type)&&(!["pointercancel","contextmenu"].includes(n.type)||!e.browser.isSafari&&!e.browser.isWebView))return;i.pointerId=null,i.touchId=null;const{params:a,touches:s,rtlTranslate:o,slidesGrid:l,enabled:c}=e;if(!c)return;if(!a.simulateTouch&&"mouse"===n.pointerType)return;if(i.allowTouchCallbacks&&e.emit("touchEnd",n),i.allowTouchCallbacks=!1,!i.isTouched)return i.isMoved&&a.grabCursor&&e.setGrabCursor(!1),i.isMoved=!1,void(i.startMoving=!1);a.grabCursor&&i.isMoved&&i.isTouched&&(!0===e.allowSlideNext||!0===e.allowSlidePrev)&&e.setGrabCursor(!1);const d=os(),u=d-i.touchStartTime;if(e.allowClick){const t=n.path||n.composedPath&&n.composedPath();e.updateClickedSlide(t&&t[0]||n.target,t),e.emit("tap click",n),u<300&&d-i.lastClickTime<300&&e.emit("doubleTap doubleClick",n)}if(i.lastClickTime=os(),ss((()=>{e.destroyed||(e.allowClick=!0)})),!i.isTouched||!i.isMoved||!e.swipeDirection||0===s.diff&&!i.loopSwapReset||i.currentTranslate===i.startTranslate&&!i.loopSwapReset)return i.isTouched=!1,i.isMoved=!1,void(i.startMoving=!1);let h;if(i.isTouched=!1,i.isMoved=!1,i.startMoving=!1,h=a.followFinger?o?e.translate:-e.translate:-i.currentTranslate,a.cssMode)return;if(a.freeMode&&a.freeMode.enabled)return void e.freeMode.onTouchEnd({currentPos:h});const p=h>=-e.maxTranslate()&&!e.params.loop;let g=0,f=e.slidesSizesGrid[0];for(let t=0;t=l[t]&&h=l[t])&&(g=t,f=l[l.length-1]-l[l.length-2])}let m=null,v=null;a.rewind&&(e.isBeginning?v=a.virtual&&a.virtual.enabled&&e.virtual?e.virtual.slides.length-1:e.slides.length-1:e.isEnd&&(m=0));const y=(h-l[g])/f,A=ga.longSwipesMs){if(!a.longSwipes)return void e.slideTo(e.activeIndex);"next"===e.swipeDirection&&(y>=a.longSwipesRatio?e.slideTo(a.rewind&&e.isEnd?m:g+A):e.slideTo(g)),"prev"===e.swipeDirection&&(y>1-a.longSwipesRatio?e.slideTo(g+A):null!==v&&y<0&&Math.abs(y)>a.longSwipesRatio?e.slideTo(v):e.slideTo(g))}else{if(!a.shortSwipes)return void e.slideTo(e.activeIndex);!e.navigation||n.target!==e.navigation.nextEl&&n.target!==e.navigation.prevEl?("next"===e.swipeDirection&&e.slideTo(null!==m?m:g+A),"prev"===e.swipeDirection&&e.slideTo(null!==v?v:g)):n.target===e.navigation.nextEl?e.slideTo(g+A):e.slideTo(g)}}function Us(){const t=this,{params:e,el:i}=t;if(i&&0===i.offsetWidth)return;e.breakpoints&&t.setBreakpoint();const{allowSlideNext:r,allowSlidePrev:n,snapGrid:a}=t,s=t.virtual&&t.params.virtual.enabled;t.allowSlideNext=!0,t.allowSlidePrev=!0,t.updateSize(),t.updateSlides(),t.updateSlidesClasses();const o=s&&e.loop;!("auto"===e.slidesPerView||e.slidesPerView>1)||!t.isEnd||t.isBeginning||t.params.centeredSlides||o?t.params.loop&&!s?t.slideToLoop(t.realIndex,0,!1,!0):t.slideTo(t.activeIndex,0,!1,!0):t.slideTo(t.slides.length-1,0,!1,!0),t.autoplay&&t.autoplay.running&&t.autoplay.paused&&(clearTimeout(t.autoplay.resizeTimeout),t.autoplay.resizeTimeout=setTimeout((()=>{t.autoplay&&t.autoplay.running&&t.autoplay.paused&&t.autoplay.resume()}),500)),t.allowSlidePrev=n,t.allowSlideNext=r,t.params.watchOverflow&&a!==t.snapGrid&&t.checkOverflow()}function Vs(t){const e=this;e.enabled&&(e.allowClick||(e.params.preventClicks&&t.preventDefault(),e.params.preventClicksPropagation&&e.animating&&(t.stopPropagation(),t.stopImmediatePropagation())))}function js(){const t=this,{wrapperEl:e,rtlTranslate:i,enabled:r}=t;if(!r)return;let n;t.previousTranslate=t.translate,t.isHorizontal()?t.translate=-e.scrollLeft:t.translate=-e.scrollTop,0===t.translate&&(t.translate=0),t.updateActiveIndex(),t.updateSlidesClasses();const a=t.maxTranslate()-t.minTranslate();n=0===a?0:(t.translate-t.minTranslate())/a,n!==t.progress&&t.updateProgress(i?-t.translate:t.translate),t.emit("setTranslate",t.translate,!1)}function Qs(t){const e=this;xs(e,t.target),e.params.cssMode||"auto"!==e.params.slidesPerView&&!e.params.autoHeight||e.update()}function Gs(){const t=this;t.documentTouchHandlerProceeded||(t.documentTouchHandlerProceeded=!0,t.params.touchReleaseOnEdges&&(t.el.style.touchAction="auto"))}const Hs=(t,e)=>{const i=rs(),{params:r,el:n,wrapperEl:a,device:s}=t,o=!!r.nested,l="on"===e?"addEventListener":"removeEventListener",c=e;i[l]("touchstart",t.onDocumentTouchStart,{passive:!1,capture:o}),n[l]("touchstart",t.onTouchStart,{passive:!1}),n[l]("pointerdown",t.onTouchStart,{passive:!1}),i[l]("touchmove",t.onTouchMove,{passive:!1,capture:o}),i[l]("pointermove",t.onTouchMove,{passive:!1,capture:o}),i[l]("touchend",t.onTouchEnd,{passive:!0}),i[l]("pointerup",t.onTouchEnd,{passive:!0}),i[l]("pointercancel",t.onTouchEnd,{passive:!0}),i[l]("touchcancel",t.onTouchEnd,{passive:!0}),i[l]("pointerout",t.onTouchEnd,{passive:!0}),i[l]("pointerleave",t.onTouchEnd,{passive:!0}),i[l]("contextmenu",t.onTouchEnd,{passive:!0}),(r.preventClicks||r.preventClicksPropagation)&&n[l]("click",t.onClick,!0),r.cssMode&&a[l]("scroll",t.onScroll),r.updateOnWindowResize?t[c](s.ios||s.android?"resize orientationchange observerUpdate":"resize observerUpdate",Us,!0):t[c]("observerUpdate",Us,!0),n[l]("load",t.onLoad,{capture:!0})},Ws=(t,e)=>t.grid&&e.grid&&e.grid.rows>1;var zs={init:!0,direction:"horizontal",oneWayMovement:!1,swiperElementNodeName:"SWIPER-CONTAINER",touchEventsTarget:"wrapper",initialSlide:0,speed:300,cssMode:!1,updateOnWindowResize:!0,resizeObserver:!0,nested:!1,createElements:!1,eventsPrefix:"swiper",enabled:!0,focusableElements:"input, select, option, textarea, button, video, label",width:null,height:null,preventInteractionOnTransition:!1,userAgent:null,url:null,edgeSwipeDetection:!1,edgeSwipeThreshold:20,autoHeight:!1,setWrapperSize:!1,virtualTranslate:!1,effect:"slide",breakpoints:void 0,breakpointsBase:"window",spaceBetween:0,slidesPerView:1,slidesPerGroup:1,slidesPerGroupSkip:0,slidesPerGroupAuto:!1,centeredSlides:!1,centeredSlidesBounds:!1,slidesOffsetBefore:0,slidesOffsetAfter:0,normalizeSlideIndex:!0,centerInsufficientSlides:!1,watchOverflow:!0,roundLengths:!1,touchRatio:1,touchAngle:45,simulateTouch:!0,shortSwipes:!0,longSwipes:!0,longSwipesRatio:.5,longSwipesMs:300,followFinger:!0,allowTouchMove:!0,threshold:5,touchMoveStopPropagation:!1,touchStartPreventDefault:!0,touchStartForcePreventDefault:!1,touchReleaseOnEdges:!1,uniqueNavElements:!0,resistance:!0,resistanceRatio:.85,watchSlidesProgress:!1,grabCursor:!1,preventClicks:!0,preventClicksPropagation:!0,slideToClickedSlide:!1,loop:!1,loopAddBlankSlides:!0,loopAdditionalSlides:0,loopPreventsSliding:!0,rewind:!1,allowSlidePrev:!0,allowSlideNext:!0,swipeHandler:null,noSwiping:!0,noSwipingClass:"swiper-no-swiping",noSwipingSelector:null,passiveListeners:!0,maxBackfaceHiddenSlides:10,containerModifierClass:"swiper-",slideClass:"swiper-slide",slideBlankClass:"swiper-slide-blank",slideActiveClass:"swiper-slide-active",slideVisibleClass:"swiper-slide-visible",slideFullyVisibleClass:"swiper-slide-fully-visible",slideNextClass:"swiper-slide-next",slidePrevClass:"swiper-slide-prev",wrapperClass:"swiper-wrapper",lazyPreloaderClass:"swiper-lazy-preloader",lazyPreloadPrevNext:0,runCallbacksOnInit:!0,_emitClasses:!1};function Ks(t,e){return function(i){void 0===i&&(i={});const r=Object.keys(i)[0],n=i[r];"object"==typeof n&&null!==n?(!0===t[r]&&(t[r]={enabled:!0}),"navigation"===r&&t[r]&&t[r].enabled&&!t[r].prevEl&&!t[r].nextEl&&(t[r].auto=!0),["pagination","scrollbar"].indexOf(r)>=0&&t[r]&&t[r].enabled&&!t[r].el&&(t[r].auto=!0),r in t&&"enabled"in n?("object"!=typeof t[r]||"enabled"in t[r]||(t[r].enabled=!0),t[r]||(t[r]={enabled:!1}),cs(e,i)):cs(e,i)):cs(e,i)}}const qs={eventsEmitter:Ts,update:Ds,translate:{getTranslate:function(t){void 0===t&&(t=this.isHorizontal()?"x":"y");const{params:e,rtlTranslate:i,translate:r,wrapperEl:n}=this;if(e.virtualTranslate)return i?-r:r;if(e.cssMode)return r;let a=function(t,e){void 0===e&&(e="x");const i=as();let r,n,a;const s=function(t){const e=as();let i;return e.getComputedStyle&&(i=e.getComputedStyle(t,null)),!i&&t.currentStyle&&(i=t.currentStyle),i||(i=t.style),i}(t);return i.WebKitCSSMatrix?(n=s.transform||s.webkitTransform,n.split(",").length>6&&(n=n.split(", ").map((t=>t.replace(",","."))).join(", ")),a=new i.WebKitCSSMatrix("none"===n?"":n)):(a=s.MozTransform||s.OTransform||s.MsTransform||s.msTransform||s.transform||s.getPropertyValue("transform").replace("translate(","matrix(1, 0, 0, 1,"),r=a.toString().split(",")),"x"===e&&(n=i.WebKitCSSMatrix?a.m41:16===r.length?parseFloat(r[12]):parseFloat(r[4])),"y"===e&&(n=i.WebKitCSSMatrix?a.m42:16===r.length?parseFloat(r[13]):parseFloat(r[5])),n||0}(n,t);return a+=this.cssOverflowAdjustment(),i&&(a=-a),a||0},setTranslate:function(t,e){const i=this,{rtlTranslate:r,params:n,wrapperEl:a,progress:s}=i;let o,l=0,c=0;i.isHorizontal()?l=r?-t:t:c=t,n.roundLengths&&(l=Math.floor(l),c=Math.floor(c)),i.previousTranslate=i.translate,i.translate=i.isHorizontal()?l:c,n.cssMode?a[i.isHorizontal()?"scrollLeft":"scrollTop"]=i.isHorizontal()?-l:-c:n.virtualTranslate||(i.isHorizontal()?l-=i.cssOverflowAdjustment():c-=i.cssOverflowAdjustment(),a.style.transform=`translate3d(${l}px, ${c}px, 0px)`);const d=i.maxTranslate()-i.minTranslate();o=0===d?0:(t-i.minTranslate())/d,o!==s&&i.updateProgress(t),i.emit("setTranslate",i.translate,e)},minTranslate:function(){return-this.snapGrid[0]},maxTranslate:function(){return-this.snapGrid[this.snapGrid.length-1]},translateTo:function(t,e,i,r,n){void 0===t&&(t=0),void 0===e&&(e=this.params.speed),void 0===i&&(i=!0),void 0===r&&(r=!0);const a=this,{params:s,wrapperEl:o}=a;if(a.animating&&s.preventInteractionOnTransition)return!1;const l=a.minTranslate(),c=a.maxTranslate();let d;if(d=r&&t>l?l:r&&t{e.__preventObserver__=!1}))},unsetGrabCursor:function(){const t=this;t.params.watchOverflow&&t.isLocked||t.params.cssMode||(t.isElement&&(t.__preventObserver__=!0),t["container"===t.params.touchEventsTarget?"el":"wrapperEl"].style.cursor="",t.isElement&&requestAnimationFrame((()=>{t.__preventObserver__=!1})))}},events:{attachEvents:function(){const t=this,{params:e}=t;t.onTouchStart=Ms.bind(t),t.onTouchMove=Ns.bind(t),t.onTouchEnd=Fs.bind(t),t.onDocumentTouchStart=Gs.bind(t),e.cssMode&&(t.onScroll=js.bind(t)),t.onClick=Vs.bind(t),t.onLoad=Qs.bind(t),Hs(t,"on")},detachEvents:function(){Hs(this,"off")}},breakpoints:{setBreakpoint:function(){const t=this,{realIndex:e,initialized:i,params:r,el:n}=t,a=r.breakpoints;if(!a||a&&0===Object.keys(a).length)return;const s=t.getBreakpoint(a,t.params.breakpointsBase,t.el);if(!s||t.currentBreakpoint===s)return;const o=(s in a?a[s]:void 0)||t.originalParams,l=Ws(t,r),c=Ws(t,o),d=t.params.grabCursor,u=o.grabCursor,h=r.enabled;l&&!c?(n.classList.remove(`${r.containerModifierClass}grid`,`${r.containerModifierClass}grid-column`),t.emitContainerClasses()):!l&&c&&(n.classList.add(`${r.containerModifierClass}grid`),(o.grid.fill&&"column"===o.grid.fill||!o.grid.fill&&"column"===r.grid.fill)&&n.classList.add(`${r.containerModifierClass}grid-column`),t.emitContainerClasses()),d&&!u?t.unsetGrabCursor():!d&&u&&t.setGrabCursor(),["navigation","pagination","scrollbar"].forEach((e=>{if(void 0===o[e])return;const i=r[e]&&r[e].enabled,n=o[e]&&o[e].enabled;i&&!n&&t[e].disable(),!i&&n&&t[e].enable()}));const p=o.direction&&o.direction!==r.direction,g=r.loop&&(o.slidesPerView!==r.slidesPerView||p),f=r.loop;p&&i&&t.changeDirection(),cs(t.params,o);const m=t.params.enabled,v=t.params.loop;Object.assign(t,{allowTouchMove:t.params.allowTouchMove,allowSlideNext:t.params.allowSlideNext,allowSlidePrev:t.params.allowSlidePrev}),h&&!m?t.disable():!h&&m&&t.enable(),t.currentBreakpoint=s,t.emit("_beforeBreakpoint",o),i&&(g?(t.loopDestroy(),t.loopCreate(e),t.updateSlides()):!f&&v?(t.loopCreate(e),t.updateSlides()):f&&!v&&t.loopDestroy()),t.emit("breakpoint",o)},getBreakpoint:function(t,e,i){if(void 0===e&&(e="window"),!t||"container"===e&&!i)return;let r=!1;const n=as(),a="window"===e?n.innerHeight:i.clientHeight,s=Object.keys(t).map((t=>{if("string"==typeof t&&0===t.indexOf("@")){const e=parseFloat(t.substr(1));return{value:a*e,point:t}}return{value:t,point:t}}));s.sort(((t,e)=>parseInt(t.value,10)-parseInt(e.value,10)));for(let t=0;ti}else t.isLocked=1===t.snapGrid.length;!0===i.allowSlideNext&&(t.allowSlideNext=!t.isLocked),!0===i.allowSlidePrev&&(t.allowSlidePrev=!t.isLocked),e&&e!==t.isLocked&&(t.isEnd=!1),e!==t.isLocked&&t.emit(t.isLocked?"lock":"unlock")}},classes:{addClasses:function(){const t=this,{classNames:e,params:i,rtl:r,el:n,device:a}=t,s=function(t,e){const i=[];return t.forEach((t=>{"object"==typeof t?Object.keys(t).forEach((r=>{t[r]&&i.push(e+r)})):"string"==typeof t&&i.push(e+t)})),i}(["initialized",i.direction,{"free-mode":t.params.freeMode&&i.freeMode.enabled},{autoheight:i.autoHeight},{rtl:r},{grid:i.grid&&i.grid.rows>1},{"grid-column":i.grid&&i.grid.rows>1&&"column"===i.grid.fill},{android:a.android},{ios:a.ios},{"css-mode":i.cssMode},{centered:i.cssMode&&i.centeredSlides},{"watch-progress":i.watchSlidesProgress}],i.containerModifierClass);e.push(...s),n.classList.add(...e),t.emitContainerClasses()},removeClasses:function(){const{el:t,classNames:e}=this;t.classList.remove(...e),this.emitContainerClasses()}}},Ys={};class Js{constructor(){let t,e;for(var i=arguments.length,r=new Array(i),n=0;n1){const t=[];return a.querySelectorAll(e.el).forEach((i=>{const r=cs({},e,{el:i});t.push(new Js(r))})),t}const s=this;s.__swiper__=!0,s.support=Cs(),s.device=Es({userAgent:e.userAgent}),s.browser=(ws||(ws=function(){const t=as(),e=Es();let i=!1;function r(){const e=t.navigator.userAgent.toLowerCase();return e.indexOf("safari")>=0&&e.indexOf("chrome")<0&&e.indexOf("android")<0}if(r()){const e=String(t.navigator.userAgent);if(e.includes("Version/")){const[t,r]=e.split("Version/")[1].split(" ")[0].split(".").map((t=>Number(t)));i=t<16||16===t&&r<2}}const n=/(iPhone|iPod|iPad).*AppleWebKit(?!.*Safari)/i.test(t.navigator.userAgent),a=r();return{isSafari:i||a,needPerspectiveFix:i,need3dFix:a||n&&e.ios,isWebView:n}}()),ws),s.eventsListeners={},s.eventsAnyListeners=[],s.modules=[...s.__modules__],e.modules&&Array.isArray(e.modules)&&s.modules.push(...e.modules);const o={};s.modules.forEach((t=>{t({params:e,swiper:s,extendParams:Ks(e,o),on:s.on.bind(s),once:s.once.bind(s),off:s.off.bind(s),emit:s.emit.bind(s)})}));const l=cs({},zs,o);return s.params=cs({},l,Ys,e),s.originalParams=cs({},s.params),s.passedParams=cs({},e),s.params&&s.params.on&&Object.keys(s.params.on).forEach((t=>{s.on(t,s.params.on[t])})),s.params&&s.params.onAny&&s.onAny(s.params.onAny),Object.assign(s,{enabled:s.params.enabled,el:t,classNames:[],slides:[],slidesGrid:[],snapGrid:[],slidesSizesGrid:[],isHorizontal(){return"horizontal"===s.params.direction},isVertical(){return"vertical"===s.params.direction},activeIndex:0,realIndex:0,isBeginning:!0,isEnd:!1,translate:0,previousTranslate:0,progress:0,velocity:0,animating:!1,cssOverflowAdjustment(){return Math.trunc(this.translate/2**23)*2**23},allowSlideNext:s.params.allowSlideNext,allowSlidePrev:s.params.allowSlidePrev,touchEventsData:{isTouched:void 0,isMoved:void 0,allowTouchCallbacks:void 0,touchStartTime:void 0,isScrolling:void 0,currentTranslate:void 0,startTranslate:void 0,allowThresholdMove:void 0,focusableElements:s.params.focusableElements,lastClickTime:0,clickTimeout:void 0,velocities:[],allowMomentumBounce:void 0,startMoving:void 0,pointerId:null,touchId:null},allowClick:!0,allowTouchMove:s.params.allowTouchMove,touches:{startX:0,startY:0,currentX:0,currentY:0,diff:0},imagesToLoad:[],imagesLoaded:0}),s.emit("_swiper"),s.params.init&&s.init(),s}getDirectionLabel(t){return this.isHorizontal()?t:{width:"height","margin-top":"margin-left","margin-bottom ":"margin-right","margin-left":"margin-top","margin-right":"margin-bottom","padding-left":"padding-top","padding-right":"padding-bottom",marginRight:"marginBottom"}[t]}getSlideIndex(t){const{slidesEl:e,params:i}=this,r=ms(hs(e,`.${i.slideClass}, swiper-slide`)[0]);return ms(t)-r}getSlideIndexByData(t){return this.getSlideIndex(this.slides.filter((e=>1*e.getAttribute("data-swiper-slide-index")===t))[0])}recalcSlides(){const{slidesEl:t,params:e}=this;this.slides=hs(t,`.${e.slideClass}, swiper-slide`)}enable(){const t=this;t.enabled||(t.enabled=!0,t.params.grabCursor&&t.setGrabCursor(),t.emit("enable"))}disable(){const t=this;t.enabled&&(t.enabled=!1,t.params.grabCursor&&t.unsetGrabCursor(),t.emit("disable"))}setProgress(t,e){const i=this;t=Math.min(Math.max(t,0),1);const r=i.minTranslate(),n=(i.maxTranslate()-r)*t+r;i.translateTo(n,void 0===e?0:e),i.updateActiveIndex(),i.updateSlidesClasses()}emitContainerClasses(){const t=this;if(!t.params._emitClasses||!t.el)return;const e=t.el.className.split(" ").filter((e=>0===e.indexOf("swiper")||0===e.indexOf(t.params.containerModifierClass)));t.emit("_containerClasses",e.join(" "))}getSlideClasses(t){const e=this;return e.destroyed?"":t.className.split(" ").filter((t=>0===t.indexOf("swiper-slide")||0===t.indexOf(e.params.slideClass))).join(" ")}emitSlidesClasses(){const t=this;if(!t.params._emitClasses||!t.el)return;const e=[];t.slides.forEach((i=>{const r=t.getSlideClasses(i);e.push({slideEl:i,classNames:r}),t.emit("_slideClass",i,r)})),t.emit("_slideClasses",e)}slidesPerViewDynamic(t,e){void 0===t&&(t="current"),void 0===e&&(e=!1);const{params:i,slides:r,slidesGrid:n,slidesSizesGrid:a,size:s,activeIndex:o}=this;let l=1;if("number"==typeof i.slidesPerView)return i.slidesPerView;if(i.centeredSlides){let t,e=r[o]?Math.ceil(r[o].swiperSlideSize):0;for(let i=o+1;is&&(t=!0));for(let i=o-1;i>=0;i-=1)r[i]&&!t&&(e+=r[i].swiperSlideSize,l+=1,e>s&&(t=!0))}else if("current"===t)for(let t=o+1;t=0;t-=1)n[o]-n[t]{e.complete&&xs(t,e)})),t.updateSize(),t.updateSlides(),t.updateProgress(),t.updateSlidesClasses(),i.freeMode&&i.freeMode.enabled&&!i.cssMode)r(),i.autoHeight&&t.updateAutoHeight();else{if(("auto"===i.slidesPerView||i.slidesPerView>1)&&t.isEnd&&!i.centeredSlides){const e=t.virtual&&i.virtual.enabled?t.virtual.slides:t.slides;n=t.slideTo(e.length-1,0,!1,!0)}else n=t.slideTo(t.activeIndex,0,!1,!0);n||r()}i.watchOverflow&&e!==t.snapGrid&&t.checkOverflow(),t.emit("update")}changeDirection(t,e){void 0===e&&(e=!0);const i=this,r=i.params.direction;return t||(t="horizontal"===r?"vertical":"horizontal"),t===r||"horizontal"!==t&&"vertical"!==t||(i.el.classList.remove(`${i.params.containerModifierClass}${r}`),i.el.classList.add(`${i.params.containerModifierClass}${t}`),i.emitContainerClasses(),i.params.direction=t,i.slides.forEach((e=>{"vertical"===t?e.style.width="":e.style.height=""})),i.emit("changeDirection"),e&&i.update()),i}changeLanguageDirection(t){const e=this;e.rtl&&"rtl"===t||!e.rtl&&"ltr"===t||(e.rtl="rtl"===t,e.rtlTranslate="horizontal"===e.params.direction&&e.rtl,e.rtl?(e.el.classList.add(`${e.params.containerModifierClass}rtl`),e.el.dir="rtl"):(e.el.classList.remove(`${e.params.containerModifierClass}rtl`),e.el.dir="ltr"),e.update())}mount(t){const e=this;if(e.mounted)return!0;let i=t||e.params.el;if("string"==typeof i&&(i=document.querySelector(i)),!i)return!1;i.swiper=e,i.parentNode&&i.parentNode.host&&i.parentNode.host.nodeName===e.params.swiperElementNodeName.toUpperCase()&&(e.isElement=!0);const r=()=>`.${(e.params.wrapperClass||"").trim().split(" ").join(".")}`;let n=i&&i.shadowRoot&&i.shadowRoot.querySelector?i.shadowRoot.querySelector(r()):hs(i,r())[0];return!n&&e.params.createElements&&(n=gs("div",e.params.wrapperClass),i.append(n),hs(i,`.${e.params.slideClass}`).forEach((t=>{n.append(t)}))),Object.assign(e,{el:i,wrapperEl:n,slidesEl:e.isElement&&!i.parentNode.host.slideSlots?i.parentNode.host:n,hostEl:e.isElement?i.parentNode.host:i,mounted:!0,rtl:"rtl"===i.dir.toLowerCase()||"rtl"===fs(i,"direction"),rtlTranslate:"horizontal"===e.params.direction&&("rtl"===i.dir.toLowerCase()||"rtl"===fs(i,"direction")),wrongRTL:"-webkit-box"===fs(n,"display")}),!0}init(t){const e=this;if(e.initialized)return e;if(!1===e.mount(t))return e;e.emit("beforeInit"),e.params.breakpoints&&e.setBreakpoint(),e.addClasses(),e.updateSize(),e.updateSlides(),e.params.watchOverflow&&e.checkOverflow(),e.params.grabCursor&&e.enabled&&e.setGrabCursor(),e.params.loop&&e.virtual&&e.params.virtual.enabled?e.slideTo(e.params.initialSlide+e.virtual.slidesBefore,0,e.params.runCallbacksOnInit,!1,!0):e.slideTo(e.params.initialSlide,0,e.params.runCallbacksOnInit,!1,!0),e.params.loop&&e.loopCreate(),e.attachEvents();const i=[...e.el.querySelectorAll('[loading="lazy"]')];return e.isElement&&i.push(...e.hostEl.querySelectorAll('[loading="lazy"]')),i.forEach((t=>{t.complete?xs(e,t):t.addEventListener("load",(t=>{xs(e,t.target)}))})),Ps(e),e.initialized=!0,Ps(e),e.emit("init"),e.emit("afterInit"),e}destroy(t,e){void 0===t&&(t=!0),void 0===e&&(e=!0);const i=this,{params:r,el:n,wrapperEl:a,slides:s}=i;return void 0===i.params||i.destroyed||(i.emit("beforeDestroy"),i.initialized=!1,i.detachEvents(),r.loop&&i.loopDestroy(),e&&(i.removeClasses(),n.removeAttribute("style"),a.removeAttribute("style"),s&&s.length&&s.forEach((t=>{t.classList.remove(r.slideVisibleClass,r.slideFullyVisibleClass,r.slideActiveClass,r.slideNextClass,r.slidePrevClass),t.removeAttribute("style"),t.removeAttribute("data-swiper-slide-index")}))),i.emit("destroy"),Object.keys(i.eventsListeners).forEach((t=>{i.off(t)})),!1!==t&&(i.el.swiper=null,function(t){const e=t;Object.keys(e).forEach((t=>{try{e[t]=null}catch(t){}try{delete e[t]}catch(t){}}))}(i)),i.destroyed=!0),null}static extendDefaults(t){cs(Ys,t)}static get extendedDefaults(){return Ys}static get defaults(){return zs}static installModule(t){Js.prototype.__modules__||(Js.prototype.__modules__=[]);const e=Js.prototype.__modules__;"function"==typeof t&&e.indexOf(t)<0&&e.push(t)}static use(t){return Array.isArray(t)?(t.forEach((t=>Js.installModule(t))),Js):(Js.installModule(t),Js)}}function Xs(t,e,i,r){return t.params.createElements&&Object.keys(r).forEach((n=>{if(!i[n]&&!0===i.auto){let a=hs(t.el,`.${r[n]}`)[0];a||(a=gs("div",r[n]),a.className=r[n],t.el.append(a)),i[n]=a,e[n]=a}})),i}function $s(t){let{swiper:e,extendParams:i,on:r,emit:n}=t;function a(t){let i;return t&&"string"==typeof t&&e.isElement&&(i=e.el.querySelector(t),i)?i:(t&&("string"==typeof t&&(i=[...document.querySelectorAll(t)]),e.params.uniqueNavElements&&"string"==typeof t&&i&&i.length>1&&1===e.el.querySelectorAll(t).length?i=e.el.querySelector(t):i&&1===i.length&&(i=i[0])),t&&!i?t:i)}function s(t,i){const r=e.params.navigation;(t=As(t)).forEach((t=>{t&&(t.classList[i?"add":"remove"](...r.disabledClass.split(" ")),"BUTTON"===t.tagName&&(t.disabled=i),e.params.watchOverflow&&e.enabled&&t.classList[e.isLocked?"add":"remove"](r.lockClass))}))}function o(){const{nextEl:t,prevEl:i}=e.navigation;if(e.params.loop)return s(i,!1),void s(t,!1);s(i,e.isBeginning&&!e.params.rewind),s(t,e.isEnd&&!e.params.rewind)}function l(t){t.preventDefault(),(!e.isBeginning||e.params.loop||e.params.rewind)&&(e.slidePrev(),n("navigationPrev"))}function c(t){t.preventDefault(),(!e.isEnd||e.params.loop||e.params.rewind)&&(e.slideNext(),n("navigationNext"))}function d(){const t=e.params.navigation;if(e.params.navigation=Xs(e,e.originalParams.navigation,e.params.navigation,{nextEl:"swiper-button-next",prevEl:"swiper-button-prev"}),!t.nextEl&&!t.prevEl)return;let i=a(t.nextEl),r=a(t.prevEl);Object.assign(e.navigation,{nextEl:i,prevEl:r}),i=As(i),r=As(r);const n=(i,r)=>{i&&i.addEventListener("click","next"===r?c:l),!e.enabled&&i&&i.classList.add(...t.lockClass.split(" "))};i.forEach((t=>n(t,"next"))),r.forEach((t=>n(t,"prev")))}function u(){let{nextEl:t,prevEl:i}=e.navigation;t=As(t),i=As(i);const r=(t,i)=>{t.removeEventListener("click","next"===i?c:l),t.classList.remove(...e.params.navigation.disabledClass.split(" "))};t.forEach((t=>r(t,"next"))),i.forEach((t=>r(t,"prev")))}i({navigation:{nextEl:null,prevEl:null,hideOnClick:!1,disabledClass:"swiper-button-disabled",hiddenClass:"swiper-button-hidden",lockClass:"swiper-button-lock",navigationDisabledClass:"swiper-navigation-disabled"}}),e.navigation={nextEl:null,prevEl:null},r("init",(()=>{!1===e.params.navigation.enabled?h():(d(),o())})),r("toEdge fromEdge lock unlock",(()=>{o()})),r("destroy",(()=>{u()})),r("enable disable",(()=>{let{nextEl:t,prevEl:i}=e.navigation;t=As(t),i=As(i),e.enabled?o():[...t,...i].filter((t=>!!t)).forEach((t=>t.classList.add(e.params.navigation.lockClass)))})),r("click",((t,i)=>{let{nextEl:r,prevEl:a}=e.navigation;r=As(r),a=As(a);const s=i.target;if(e.params.navigation.hideOnClick&&!a.includes(s)&&!r.includes(s)){if(e.pagination&&e.params.pagination&&e.params.pagination.clickable&&(e.pagination.el===s||e.pagination.el.contains(s)))return;let t;r.length?t=r[0].classList.contains(e.params.navigation.hiddenClass):a.length&&(t=a[0].classList.contains(e.params.navigation.hiddenClass)),n(!0===t?"navigationShow":"navigationHide"),[...r,...a].filter((t=>!!t)).forEach((t=>t.classList.toggle(e.params.navigation.hiddenClass)))}}));const h=()=>{e.el.classList.add(...e.params.navigation.navigationDisabledClass.split(" ")),u()};Object.assign(e.navigation,{enable:()=>{e.el.classList.remove(...e.params.navigation.navigationDisabledClass.split(" ")),d(),o()},disable:h,update:o,init:d,destroy:u})}function Zs(t){return void 0===t&&(t=""),`.${t.trim().replace(/([\.:!+\/])/g,"\\$1").replace(/ /g,".")}`}function to(t){let{swiper:e,extendParams:i,on:r,emit:n}=t;const a="swiper-pagination";let s;i({pagination:{el:null,bulletElement:"span",clickable:!1,hideOnClick:!1,renderBullet:null,renderProgressbar:null,renderFraction:null,renderCustom:null,progressbarOpposite:!1,type:"bullets",dynamicBullets:!1,dynamicMainBullets:1,formatFractionCurrent:t=>t,formatFractionTotal:t=>t,bulletClass:`${a}-bullet`,bulletActiveClass:`${a}-bullet-active`,modifierClass:`${a}-`,currentClass:`${a}-current`,totalClass:`${a}-total`,hiddenClass:`${a}-hidden`,progressbarFillClass:`${a}-progressbar-fill`,progressbarOppositeClass:`${a}-progressbar-opposite`,clickableClass:`${a}-clickable`,lockClass:`${a}-lock`,horizontalClass:`${a}-horizontal`,verticalClass:`${a}-vertical`,paginationDisabledClass:`${a}-disabled`}}),e.pagination={el:null,bullets:[]};let o=0;function l(){return!e.params.pagination.el||!e.pagination.el||Array.isArray(e.pagination.el)&&0===e.pagination.el.length}function c(t,i){const{bulletActiveClass:r}=e.params.pagination;t&&(t=t[("prev"===i?"previous":"next")+"ElementSibling"])&&(t.classList.add(`${r}-${i}`),(t=t[("prev"===i?"previous":"next")+"ElementSibling"])&&t.classList.add(`${r}-${i}-${i}`))}function d(t){const i=t.target.closest(Zs(e.params.pagination.bulletClass));if(!i)return;t.preventDefault();const r=ms(i)*e.params.slidesPerGroup;if(e.params.loop){if(e.realIndex===r)return;e.slideToLoop(r)}else e.slideTo(r)}function u(){const t=e.rtl,i=e.params.pagination;if(l())return;let r,a,d=e.pagination.el;d=As(d);const u=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.slides.length,h=e.params.loop?Math.ceil(u/e.params.slidesPerGroup):e.snapGrid.length;if(e.params.loop?(a=e.previousRealIndex||0,r=e.params.slidesPerGroup>1?Math.floor(e.realIndex/e.params.slidesPerGroup):e.realIndex):void 0!==e.snapIndex?(r=e.snapIndex,a=e.previousSnapIndex):(a=e.previousIndex||0,r=e.activeIndex||0),"bullets"===i.type&&e.pagination.bullets&&e.pagination.bullets.length>0){const n=e.pagination.bullets;let l,u,h;if(i.dynamicBullets&&(s=ys(n[0],e.isHorizontal()?"width":"height",!0),d.forEach((t=>{t.style[e.isHorizontal()?"width":"height"]=s*(i.dynamicMainBullets+4)+"px"})),i.dynamicMainBullets>1&&void 0!==a&&(o+=r-(a||0),o>i.dynamicMainBullets-1?o=i.dynamicMainBullets-1:o<0&&(o=0)),l=Math.max(r-o,0),u=l+(Math.min(n.length,i.dynamicMainBullets)-1),h=(u+l)/2),n.forEach((t=>{const e=[...["","-next","-next-next","-prev","-prev-prev","-main"].map((t=>`${i.bulletActiveClass}${t}`))].map((t=>"string"==typeof t&&t.includes(" ")?t.split(" "):t)).flat();t.classList.remove(...e)})),d.length>1)n.forEach((t=>{const n=ms(t);n===r?t.classList.add(...i.bulletActiveClass.split(" ")):e.isElement&&t.setAttribute("part","bullet"),i.dynamicBullets&&(n>=l&&n<=u&&t.classList.add(...`${i.bulletActiveClass}-main`.split(" ")),n===l&&c(t,"prev"),n===u&&c(t,"next"))}));else{const t=n[r];if(t&&t.classList.add(...i.bulletActiveClass.split(" ")),e.isElement&&n.forEach(((t,e)=>{t.setAttribute("part",e===r?"bullet-active":"bullet")})),i.dynamicBullets){const t=n[l],e=n[u];for(let t=l;t<=u;t+=1)n[t]&&n[t].classList.add(...`${i.bulletActiveClass}-main`.split(" "));c(t,"prev"),c(e,"next")}}if(i.dynamicBullets){const r=Math.min(n.length,i.dynamicMainBullets+4),a=(s*r-s)/2-h*s,o=t?"right":"left";n.forEach((t=>{t.style[e.isHorizontal()?o:"top"]=`${a}px`}))}}d.forEach(((t,a)=>{if("fraction"===i.type&&(t.querySelectorAll(Zs(i.currentClass)).forEach((t=>{t.textContent=i.formatFractionCurrent(r+1)})),t.querySelectorAll(Zs(i.totalClass)).forEach((t=>{t.textContent=i.formatFractionTotal(h)}))),"progressbar"===i.type){let n;n=i.progressbarOpposite?e.isHorizontal()?"vertical":"horizontal":e.isHorizontal()?"horizontal":"vertical";const a=(r+1)/h;let s=1,o=1;"horizontal"===n?s=a:o=a,t.querySelectorAll(Zs(i.progressbarFillClass)).forEach((t=>{t.style.transform=`translate3d(0,0,0) scaleX(${s}) scaleY(${o})`,t.style.transitionDuration=`${e.params.speed}ms`}))}"custom"===i.type&&i.renderCustom?(t.innerHTML=i.renderCustom(e,r+1,h),0===a&&n("paginationRender",t)):(0===a&&n("paginationRender",t),n("paginationUpdate",t)),e.params.watchOverflow&&e.enabled&&t.classList[e.isLocked?"add":"remove"](i.lockClass)}))}function h(){const t=e.params.pagination;if(l())return;const i=e.virtual&&e.params.virtual.enabled?e.virtual.slides.length:e.grid&&e.params.grid.rows>1?e.slides.length/Math.ceil(e.params.grid.rows):e.slides.length;let r=e.pagination.el;r=As(r);let a="";if("bullets"===t.type){let r=e.params.loop?Math.ceil(i/e.params.slidesPerGroup):e.snapGrid.length;e.params.freeMode&&e.params.freeMode.enabled&&r>i&&(r=i);for(let i=0;i`}"fraction"===t.type&&(a=t.renderFraction?t.renderFraction.call(e,t.currentClass,t.totalClass):` / `),"progressbar"===t.type&&(a=t.renderProgressbar?t.renderProgressbar.call(e,t.progressbarFillClass):``),e.pagination.bullets=[],r.forEach((i=>{"custom"!==t.type&&(i.innerHTML=a||""),"bullets"===t.type&&e.pagination.bullets.push(...i.querySelectorAll(Zs(t.bulletClass)))})),"custom"!==t.type&&n("paginationRender",r[0])}function p(){e.params.pagination=Xs(e,e.originalParams.pagination,e.params.pagination,{el:"swiper-pagination"});const t=e.params.pagination;if(!t.el)return;let i;"string"==typeof t.el&&e.isElement&&(i=e.el.querySelector(t.el)),i||"string"!=typeof t.el||(i=[...document.querySelectorAll(t.el)]),i||(i=t.el),i&&0!==i.length&&(e.params.uniqueNavElements&&"string"==typeof t.el&&Array.isArray(i)&&i.length>1&&(i=[...e.el.querySelectorAll(t.el)],i.length>1&&(i=i.filter((t=>vs(t,".swiper")[0]===e.el))[0])),Array.isArray(i)&&1===i.length&&(i=i[0]),Object.assign(e.pagination,{el:i}),i=As(i),i.forEach((i=>{"bullets"===t.type&&t.clickable&&i.classList.add(...(t.clickableClass||"").split(" ")),i.classList.add(t.modifierClass+t.type),i.classList.add(e.isHorizontal()?t.horizontalClass:t.verticalClass),"bullets"===t.type&&t.dynamicBullets&&(i.classList.add(`${t.modifierClass}${t.type}-dynamic`),o=0,t.dynamicMainBullets<1&&(t.dynamicMainBullets=1)),"progressbar"===t.type&&t.progressbarOpposite&&i.classList.add(t.progressbarOppositeClass),t.clickable&&i.addEventListener("click",d),e.enabled||i.classList.add(t.lockClass)})))}function g(){const t=e.params.pagination;if(l())return;let i=e.pagination.el;i&&(i=As(i),i.forEach((i=>{i.classList.remove(t.hiddenClass),i.classList.remove(t.modifierClass+t.type),i.classList.remove(e.isHorizontal()?t.horizontalClass:t.verticalClass),t.clickable&&(i.classList.remove(...(t.clickableClass||"").split(" ")),i.removeEventListener("click",d))}))),e.pagination.bullets&&e.pagination.bullets.forEach((e=>e.classList.remove(...t.bulletActiveClass.split(" "))))}r("changeDirection",(()=>{if(!e.pagination||!e.pagination.el)return;const t=e.params.pagination;let{el:i}=e.pagination;i=As(i),i.forEach((i=>{i.classList.remove(t.horizontalClass,t.verticalClass),i.classList.add(e.isHorizontal()?t.horizontalClass:t.verticalClass)}))})),r("init",(()=>{!1===e.params.pagination.enabled?f():(p(),h(),u())})),r("activeIndexChange",(()=>{void 0===e.snapIndex&&u()})),r("snapIndexChange",(()=>{u()})),r("snapGridLengthChange",(()=>{h(),u()})),r("destroy",(()=>{g()})),r("enable disable",(()=>{let{el:t}=e.pagination;t&&(t=As(t),t.forEach((t=>t.classList[e.enabled?"remove":"add"](e.params.pagination.lockClass))))})),r("lock unlock",(()=>{u()})),r("click",((t,i)=>{const r=i.target,a=As(e.pagination.el);if(e.params.pagination.el&&e.params.pagination.hideOnClick&&a&&a.length>0&&!r.classList.contains(e.params.pagination.bulletClass)){if(e.navigation&&(e.navigation.nextEl&&r===e.navigation.nextEl||e.navigation.prevEl&&r===e.navigation.prevEl))return;const t=a[0].classList.contains(e.params.pagination.hiddenClass);n(!0===t?"paginationShow":"paginationHide"),a.forEach((t=>t.classList.toggle(e.params.pagination.hiddenClass)))}}));const f=()=>{e.el.classList.add(e.params.pagination.paginationDisabledClass);let{el:t}=e.pagination;t&&(t=As(t),t.forEach((t=>t.classList.add(e.params.pagination.paginationDisabledClass)))),g()};Object.assign(e.pagination,{enable:()=>{e.el.classList.remove(e.params.pagination.paginationDisabledClass);let{el:t}=e.pagination;t&&(t=As(t),t.forEach((t=>t.classList.remove(e.params.pagination.paginationDisabledClass)))),p(),h(),u()},disable:f,render:h,update:u,init:p,destroy:g})}function eo(t){const e=this,{params:i,slidesEl:r}=e;i.loop&&e.loopDestroy();const n=t=>{if("string"==typeof t){const e=document.createElement("div");e.innerHTML=t,r.append(e.children[0]),e.innerHTML=""}else r.append(t)};if("object"==typeof t&&"length"in t)for(let e=0;e{if("string"==typeof t){const e=document.createElement("div");e.innerHTML=t,n.prepend(e.children[0]),e.innerHTML=""}else n.prepend(t)};if("object"==typeof t&&"length"in t){for(let e=0;e=o)return void i.appendSlide(e);let l=s>t?s+1:s;const c=[];for(let e=o-1;e>=t;e-=1){const t=i.slides[e];t.remove(),c.unshift(t)}if("object"==typeof e&&"length"in e){for(let t=0;tt?s+e.length:s}else a.append(e);for(let t=0;t{Object.keys(qs[t]).forEach((e=>{Js.prototype[e]=qs[t][e]}))})),Js.use([function(t){let{swiper:e,on:i,emit:r}=t;const n=as();let a=null,s=null;const o=()=>{e&&!e.destroyed&&e.initialized&&(r("beforeResize"),r("resize"))},l=()=>{e&&!e.destroyed&&e.initialized&&r("orientationchange")};i("init",(()=>{e.params.resizeObserver&&void 0!==n.ResizeObserver?e&&!e.destroyed&&e.initialized&&(a=new ResizeObserver((t=>{s=n.requestAnimationFrame((()=>{const{width:i,height:r}=e;let n=i,a=r;t.forEach((t=>{let{contentBoxSize:i,contentRect:r,target:s}=t;s&&s!==e.el||(n=r?r.width:(i[0]||i).inlineSize,a=r?r.height:(i[0]||i).blockSize)})),n===i&&a===r||o()}))})),a.observe(e.el)):(n.addEventListener("resize",o),n.addEventListener("orientationchange",l))})),i("destroy",(()=>{s&&n.cancelAnimationFrame(s),a&&a.unobserve&&e.el&&(a.unobserve(e.el),a=null),n.removeEventListener("resize",o),n.removeEventListener("orientationchange",l)}))},function(t){let{swiper:e,extendParams:i,on:r,emit:n}=t;const a=[],s=as(),o=function(t,i){void 0===i&&(i={});const r=new(s.MutationObserver||s.WebkitMutationObserver)((t=>{if(e.__preventObserver__)return;if(1===t.length)return void n("observerUpdate",t[0]);const i=function(){n("observerUpdate",t[0])};s.requestAnimationFrame?s.requestAnimationFrame(i):s.setTimeout(i,0)}));r.observe(t,{attributes:void 0===i.attributes||i.attributes,childList:void 0===i.childList||i.childList,characterData:void 0===i.characterData||i.characterData}),a.push(r)};i({observer:!1,observeParents:!1,observeSlideChildren:!1}),r("init",(()=>{if(e.params.observer){if(e.params.observeParents){const t=vs(e.hostEl);for(let e=0;e{a.forEach((t=>{t.disconnect()})),a.splice(0,a.length)}))}]);var oo=class{constructor(){this.logger=E(),this.slider=null,this.elements={container:null},this.classNames={container:"swiper",wrapper:"swiper-wrapper",slide:"swiper-slide",buttonPrev:"swiper-button-prev",buttonNext:"swiper-button-next"},this.init()}init(){const t=this.createUIStructure();this.create(t),this.elements.container=t}create(t){throw new Error("implement it in the subclass")}createUIStructure(){const t=Tt("div",{class:this.classNames.container}),e=Tt("div",{class:this.classNames.wrapper});return t.append(e),t}createASlide(t){if(A.nullOrUndefined(t))throw new Error("Expect an element in slide but got null");const e=Tt("div",{class:this.classNames.slide});return e.append(t),e}appendSlides(t){if(A.nullOrUndefined(this.slider))throw new Error("Expect a slider instance but got null");const e=t.map((t=>this.createASlide(t)));this.slider.appendSlide(e)}slideTo(t){this.slider.slideTo(t)}get container(){return this.elements.container}};class lo extends oo{create(t){const e=lo.createPaginationElement();t.append(e),Pt(t,"vimotia-slider--pagination",!0),this.slider=new Js(t,{modules:[so,to],centeredSlides:!1,loop:!1,slidesPerView:2,pagination:{el:e}})}static createPaginationElement(){return Tt("div",{class:"swiper-pagination"})}}var co=lo;const uo="vimotia__product-view__gallery--multiple";var ho=class extends Ka{createInner(){const t=Tt("div",{class:uo}),e=new co;t.append(e.container),this.listenToSelectedVariantChange(e);const i=this.createAllImages();return e.appendSlides(i),t}createAllImages(){return this.product.allImageSrc.map((t=>this.createImageElement(t)))}listenToSelectedVariantChange(t){const e=document.querySelector("body"),i=this.createVariantImageSlideLookup();vt(e,pi,(e=>{const{variantId:r}=e.detail,n=i[r];A.nullOrUndefined(n)?this.logger.warn(`[Product Gallery] No slide for variant ${r}`,{lookup:i}):(this.logger.log(`[Product Gallery] Slide to ${r} at slide ${n}`),t.slideTo(n))})),this.triggerSelectedVariantChangeListenerReadyEvent()}triggerSelectedVariantChangeListenerReadyEvent(){bt(document.querySelector("body"),hi)}createVariantImageSlideLookup(){const t={};for(let e=0;e{t[i.id]=e}))}return t}},po=i(2471),go={};go.styleTagTransform=ht(),go.setAttributes=lt(),go.insert=st().bind(null,"head"),go.domAPI=nt(),go.insertStyleElement=dt(),it()(po.A,go),po.A&&po.A.locals&&po.A.locals;const fo="vimotia__product-view__gallery--single";var mo=class extends Ka{createInner(){const t=Tt("div",{class:fo}),e=this.createImageElement(this.product.allImageSrc[0]);return t.append(e),t}},vo=class{static create(t){return 0===t.allImageSrc.length?new Ya(t):1===t.allImageSrc.length?new mo(t):new ho(t)}},yo=i(8581),Ao={};Ao.styleTagTransform=ht(),Ao.setAttributes=lt(),Ao.insert=st().bind(null,"head"),Ao.domAPI=nt(),Ao.insertStyleElement=dt(),it()(yo.A,Ao),yo.A&&yo.A.locals&&yo.A.locals;var bo="vimotia__product-recommendation",_o="vimotia__product-recommendation__heading",wo={wrapper:"vimotia__product-recommendation__product-wrapper",container:"vimotia__product-recommendation__product",image:{container:"vimotia__product-recommendation__product__image-wrapper",image:"vimotia__product-recommendation__product__image"},title:"vimotia__product-recommendation__product__title",price:{container:"vimotia__product-recommendation__product__price-wrapper",from:"vimotia__product-recommendation__product__price-from",price:"vimotia__product-recommendation__product__price",compareAtPrice:"vimotia__product-recommendation__product__compare-at-price"}},Co=class{constructor(t,e){this.data=t,this.platform=e,this.elements={container:null},this.init()}init(){const t=this.createProductGridWrapper(),e=this.data.map((t=>this.createProductGrid(t)));t.append(...e);const i=this.createContainer(),r=this.createHeadingContainer();i.append(r,t),this.container=i}createContainer(){return Tt("div",{class:bo})}createHeadingContainer(){return Tt("div",{class:_o},"You may also like")}createProductGridWrapper(){return Tt("div",{class:wo.wrapper})}createProductGrid(t){const e=this.createProductGridContainer(t.url),i=this.createImageContainer(t.image),r=this.createTitleContainer(t.title),n=t.hasVariousPricesInVariants?this.createPriceContainerVariation(t):this.createPriceContainer(t);return e.append(i,r,n),e}createProductGridContainer(t){return Tt("a",{class:wo.container,href:t,target:"__blank"})}createImageContainer(t){const e=Tt("img",{class:wo.image.image,src:t}),i=Tt("div",{class:wo.image.container});return i.append(e),i}createTitleContainer(t){return Tt("div",{class:wo.title},t)}createPriceContainer(t){const e=Tt("div",{class:wo.price.container}),i=this.createSalePriceContainer(t.price);if(e.append(i),this.shouldDisplayCompareAtPrice(t)){const i=this.createCompareAtPriceContainer(t.compareAtPrice);e.append(i)}return e}createPriceContainerVariation(t){const e=Tt("div",{class:wo.price.container}),i=this.createFromContainer(),r=this.createSalePriceContainer(t.price);if(e.append(i,r),this.shouldDisplayCompareAtPrice(t)){const i=this.createCompareAtPriceContainer(t.compareAtPrice);e.append(i)}return e}shouldDisplayCompareAtPrice(t){const{price:e,compareAtPrice:i}=t;return!A.empty(i)&&(0!==parseInt(i,10)&&parseInt(e,10)>i)}createFromContainer(){return Tt("div",{class:wo.price.from},"From")}createSalePriceContainer(t){return Tt("div",{class:wo.price.price},this.platform.formatPrice(t))}createCompareAtPriceContainer(t){return Tt("div",{class:wo.price.compareAtPrice},this.platform.formatPrice(t))}set container(t){this.elements.container=t}get container(){return this.elements.container}},Eo=class extends fi{assembleUI(t,e,i){const{priceWrapper:r,price:n,compareAtPrice:a,unitPrice:s}=this.createPriceContainer();t.append(r,e,this.stock.container,i),this.setPriceElements(n,a,s)}};const To="vimotia__product-view--detail__section--key-info",Io="vimotia__product-view--detail__detail",So="vimotia__product-view--detail__detail-header",xo="vimotia__product-view--detail__detail-body";var ko=class extends He{assembleUI(t){const e=this.createVariantForm();if(this.variantFormInstance=e,this.assembleInfo(e,t),this.product.hasDescription&&t.append(this.createDescription()),this.shouldDisplayRecommendation){const e=new Co(this.product.recommendationData,this.platform);t.append(e.container)}}assembleInfo(t,e){const i=this.createTitleContainer(),r=this.createSectionContainer();r.append(i,t.container,this.productPageLink.container,this.messageWidget.container,this.timerWidget.container),Pt(r,To,!0);const n=this.createGallery();e.append(n,r)}createVariantFormInstance(t){return new Eo(this.platform,this.product,this.stockWidget,t)}createSectionContainer(){return Tt("div",{class:"vimotia__product-view--detail__section"})}createDescription(){const t=this.createSectionContainer(),e=this.createDetailContainer();return t.append(e),t}createDetailContainer(){const t=Tt("div",{class:Io}),e=Tt("div",{class:So},"Details"),i=Tt("div",{class:xo});return i.innerHTML=this.product.description,t.append(e,i),t}createGallery(){return vo.create(this.product).container}toggleUniqueClass(t){Pt(t,"vimotia__product-view--detail",!0)}},Po={hideAddToCartButton:"vimotia__widget__addToCart--hide-add-to-cart-button"},Do={header:{container:"vimotia__widget__addToCart__product-list__header"},body:{container:"vimotia__widget__addToCart__product-list__body"}},Lo={header:{container:"vimotia__widget__addToCart__product-detail__header",left:"vimotia__widget__addToCart__product-detail__header-left",middle:"vimotia__widget__addToCart__product-detail__header-middle",right:"vimotia__widget__addToCart__product-detail__header-right",icon:"vimotia__widget__addToCart__product-detail__header-icon",logo:"vimotia__widget__addToCart__product-detail__header-logo"},body:{container:"vimotia__widget__addToCart__product-detail__body"}},Bo={type:"vimotia-addToCart--mobile__modal"},Oo=i(6047),Ro={};Ro.styleTagTransform=ht(),Ro.setAttributes=lt(),Ro.insert=st().bind(null,"head"),Ro.domAPI=nt(),Ro.insertStyleElement=dt(),it()(Oo.A,Ro),Oo.A&&Oo.A.locals&&Oo.A.locals;var Mo=i(3591),No={};No.styleTagTransform=ht(),No.setAttributes=lt(),No.insert=st().bind(null,"head"),No.domAPI=nt(),No.insertStyleElement=dt(),it()(Mo.A,No),Mo.A&&Mo.A.locals&&Mo.A.locals;const Fo="vimotia-dialog-close";var Uo=class{constructor(t){this.config=S({},{title:"",bodyContent:"",cancelButton:"Cancel",confirmButton:"Confirm",confirmButtonLink:"",classNamePrefix:"vimotia__",customContainerClass:"",footerIsActive:!1,confirmButtonIsActive:!1,cancelButtonIsActive:!1},t),this.config.footerIsActive||(this.config.confirmButtonIsActive=!1,this.config.cancelButtonIsActive=!1),this.elements={parent:null,container:null,dialog:null,header:null,body:null,footer:null,title:null,backButton:null,closeButton:null,cancelButton:null,confirmButton:null,backdrop:null},this.classNames={modal:`${this.config.classNamePrefix}modal`,modalDialog:`${this.config.classNamePrefix}modal-dialog`,modalDialogCenter:`${this.config.classNamePrefix}modal-dialog-centered`,modalDialogShow:`${this.config.classNamePrefix}modal-dialog--show`,content:`${this.config.classNamePrefix}modal-content`,header:`${this.config.classNamePrefix}modal-header`,headerButton:{container:`${this.config.classNamePrefix}modal-header-btn`,left:`${this.config.classNamePrefix}modal-header-btn--left`,showLeft:`${this.config.classNamePrefix}modal--show-left-btn`,right:`${this.config.classNamePrefix}modal-header-btn--right`,icon:`${this.config.classNamePrefix}modal-header-btn-icon`},title:`${this.config.classNamePrefix}modal-title`,body:`${this.config.classNamePrefix}modal-body`,bodyType:{noPadding:`${this.config.classNamePrefix}modal-body--no-padding`},footer:`${this.config.classNamePrefix}modal-footer`,open:`${this.config.classNamePrefix}modal-open`,backdrop:`${this.config.classNamePrefix}modal-backdrop`,fade:`${this.config.classNamePrefix}modal-fade`,show:`${this.config.classNamePrefix}modal-show`,button:`${this.config.classNamePrefix}modal-btn`,buttonSecondary:`${this.config.classNamePrefix}modal-btn-secondary`},A.nullOrUndefined(this.elements.container)&&(this.elements.container=this.createDialog(),this.attachListeners()),this.createBackDrop()}createDialog(){const t=this.createContainer(),e=this.createDialogContainer(),i=Tt("div",{class:`${this.classNames.content}`}),r=this.createHeader(),n=this.createBackButton(),a=this.createTitle(),s=this.createCloseButton();r.append(n,a,s);const o=this.createBody(),l=this.createFooter();return i.append(r,o),this.config.footerIsActive&&i.appendChild(l),e.appendChild(i),t.appendChild(e),t}createBackDrop(){this.elements.backdrop=Tt("div",{class:this.classNames.backdrop})}createBody(){const t=Tt("div",{class:`${this.classNames.body}`});let e;return e=A.element(this.config.bodyContent)?this.config.bodyContent:Tt("p",{},this.config.bodyContent),t.appendChild(e),this.elements.body=t,t}createBackButton(){const t=Tt("button",{type:"button",class:`${this.classNames.button} ${this.classNames.headerButton.container} ${this.classNames.headerButton.left}`,"aria-label":"Back"}),e=Tt("span",{class:this.classNames.headerButton.icon,"aria-hidden":"true"});return e.innerHTML=te.createArrowWithTailIcon(),t.appendChild(e),this.elements.backButton=t,t}createContainer(){const t=Tt("div",{class:`${this.classNames.modal} ${this.config.customContainerClass}`,tabindex:"-1",role:"dialog","aria-hidden":"true"});return this.elements.container=t,t}createCloseButton(){const t=Tt("button",{type:"button",class:`${this.classNames.button} ${this.classNames.headerButton.container} ${this.classNames.headerButton.right}`,"data-dismiss":"modal","aria-label":"Close"}),e=Tt("span",{class:this.classNames.headerButton.icon,"aria-hidden":"true"}),i=te.createCloseIcon();return e.appendChild(i),t.appendChild(e),this.elements.closeButton=t,t}createDialogContainer(){const t=Tt("div",{class:`${this.classNames.modalDialog} ${this.classNames.modalDialogCenter}`,role:"document"});return this.elements.dialog=t,t}createHeader(){const t=Tt("div",{class:this.classNames.header});return this.elements.header=t,t}createFooter(){const t=Tt("div",{class:`${this.classNames.footer}`});if(this.config.footerIsActive&&this.config.cancelButtonIsActive){let e;A.element(this.config.cancelButton)?e=this.config.cancelButton:A.string(this.config.cancelButton)&&(e=Tt("button",{type:"button",class:"modal-btn modal-btn-secondary","data-dismiss":"modal"},this.config.cancelButton)),this.elements.cancelButton=e,t.appendChild(e)}if(this.config.footerIsActive&&this.config.confirmButtonIsActive){let e;A.element(this.config.confirmButton)?e=this.config.confirmButton:A.string(this.config.confirmButton)&&(e=Tt("button",{class:`${this.classNames.button} ${this.classNames.buttonSecondary}`},this.config.confirmButton)),this.elements.confirmButton=e,t.appendChild(e)}return t}createTitle(){const t=Tt("div",{class:`${this.classNames.title}`},this.config.title);return this.elements.title=t,t}attachListeners(){vt(this.elements.closeButton,"click",(()=>{this.hide()})),vt(this.elements.confirmButton,"click",(()=>{A.nullOrUndefined(this.config.confirmButtonLink)?this.hide():window.open(this.config.confirmButtonLink,"_blank")})),A.nullOrUndefined(this.elements.cancelButton)||vt(this.elements.cancelButton,"click",(()=>{this.hide()})),vt(document.querySelector("body"),Fo,(()=>{this.hide()}))}isHidden(){return!this.isShowing()}isShowing(){return Dt(this.elements.dialog,this.classNames.modalDialogShow)}inject(t){const e=t||document.querySelector("body");this.elements.parent=e,e.appendChild(this.elements.container),e.appendChild(this.elements.backdrop)}setbackButtonAction(t){vt(this.elements.backButton,"click",(()=>{t()}))}async setBody(t){Ht.fadeOut(this.elements.body),await Ht.waitAnimationEnd(),St(this.elements.body),this.elements.body.appendChild(t),this.config.bodyContent=t,Ht.fadeIn(this.elements.body)}setTitleWithPlainText(t){St(this.elements.title),this.elements.title.textContent=t}setTitleWithElement(t){St(this.elements.title),this.elements.title.append(t)}setPostCloseCallback(t){this.config.postCloseCallback=()=>{t()}}show(){this.isShowing()||(Ft(this.elements.parent,{overflow:"hidden"}),Ft(this.elements.container,{overflowX:"hidden",overflowY:"auto"}),Pt(this.elements.container,this.classNames.show,!0),Pt(this.elements.backdrop,this.classNames.show,!0),window.setTimeout((()=>{Pt(this.elements.dialog,this.classNames.modalDialogShow,!0),Pt(this.elements.backdrop,this.classNames.fade,!0)}),20))}showLeftButton(){Pt(this.elements.header,this.classNames.headerButton.showLeft,!0)}hide(){this.isHidden()||(this.resetScrollOnBody(),this.hideModalAndBackDrop().then((()=>{this.resetBodyPadding()})))}resetScrollOnBody(){Ft(this.elements.parent,{overflow:"auto"})}async hideModalAndBackDrop(){Pt(this.elements.dialog,this.classNames.modalDialogShow,!1),Pt(this.elements.backdrop,this.classNames.fade,!1),await Ht.waitAnimationEnd(),Et(this.elements.container,{style:""}),Pt(this.elements.container,this.classNames.show,!1),Pt(this.elements.backdrop,this.classNames.show,!1),A.function(this.config.postCloseCallback)&&this.config.postCloseCallback()}hideLeftButton(){Pt(this.elements.header,this.classNames.headerButton.showLeft,!1)}removeBodyPadding(){Pt(this.elements.body,this.classNames.bodyType.noPadding,!0)}resetBodyPadding(){Pt(this.elements.body,this.classNames.bodyType.noPadding,!1)}scrollBodyToTop(){this.elements.body.scrollTop=0}get container(){return this.elements.container}},Vo=i(2490),jo={};jo.styleTagTransform=ht(),jo.setAttributes=lt(),jo.insert=st().bind(null,"head"),jo.domAPI=nt(),jo.insertStyleElement=dt(),it()(Vo.A,jo),Vo.A&&Vo.A.locals&&Vo.A.locals;const Qo="vimotia__logo";class Go{static createLogo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=tt();switch(e.logoConfig){case l:return Go.createPlaceholder();case"vimotia_logo":return Go.createVimotiaLogo(t);case"shop_logo":return Go.createCustomLogo(t);default:throw new Error(`Unknown logo config ${e.logoConfig}`)}}static createPlaceholder(){return Tt("div",{class:"vimotia__logo--placeholder"})}static createVimotiaLogo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=`${(new d).staticSrcBaseUrl}/img/frontend_player_icons/vimotia-logo-player-branding.png`;return Tt("img",{class:`${Qo} ${t.join(" ")}`,src:e})}static createCustomLogo(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=new d,i=tt(),r=`${e.staticSrcBaseUrl}/${i.logoPath}`;return Tt("img",{class:`${Qo} ${t.join(" ")}`,src:r})}}var Ho=Go,Wo={atc_click_effect:me.GOTO_CART_PAGE};class zo{constructor(t,e){this.logger=E(),this.widgetConfig=zo.getAddToCartWidgetConfig(t.widgets),this.playerItem=t,this.platform=e,this.states={shouldHideAddToCartButton:!this.widgetConfig.atc_enable},this.instances={primaryAddToCartButton:null},this.elemens={container:null},this.init()}init(){this.assembleUIAndSetProducts(),this.shouldHideAddToCartButton&&this.hideAddToCartButton()}assembleUIAndSetProducts(){throw new Error("implement it in the subclass")}get shouldHideAddToCartButton(){return this.states.shouldHideAddToCartButton}hideAddToCartButton(){Pt(this.container,Po.hideAddToCartButton,!0)}async createAllProducts(){const t=this.playerItem.linkedproducts.map((t=>t.product_id));return(await this.platform.createProductGroup(t)).filter((t=>t.isValid))}createDialog(){const t=document.querySelector("body"),e=new Uo({footerIsActive:!1,classNamePrefix:"vimotia__",customContainerClass:Bo.type});return e.inject(t),this.shouldHideAddToCartButton&&Pt(e.container,Po.hideAddToCartButton,!0),e}createDetailViewHeaderTitle(){return Ho.createLogo([Lo.header.logo])}static getAddToCartWidgetConfig(t){const e=t.filter((t=>"add_to_cart"===t.widget_type));return{...Wo,...e[0]}}set container(t){this.elemens.container=t}get container(){return this.elemens.container}get linkedProductCount(){return this.playerItem.linkedproducts.length}get addToCartButton(){return this.instances.primaryAddToCartButton}set addToCartButton(t){this.instances.primaryAddToCartButton=t}}var Ko=zo;var qo=class extends Ko{assembleUIAndSetProducts(){const t=this.assembleUI();this.setProducts(t).then((()=>{this.listenToProductDetailViewClick(t)}))}assembleUI(){const t=Tt("div",{class:"vimotia__widget__addToCart--desktop-view"});return this.container=t,t}async setProducts(t){const e=await this.createAllProducts();1===e.length?this.setSingleProduct(t,e[0]):this.setMultipleProducts(t,e)}setSingleProduct(t,e){const i=new ko(this.platform,e,this.widgetConfig);t.appendChild(i.container)}setMultipleProducts(t,e){const i=this.createListViewHeader();t.appendChild(i);const r=this.createListViewBody();t.appendChild(r),e.forEach((t=>{window.setTimeout((()=>{const e=new bi(this.platform,t,this.widgetConfig,{enableStockWidget:this.widgetConfig.enable_widget_on_product_list,enableMessageWidget:this.widgetConfig.enable_widget_on_product_list,enableTimerWidget:this.widgetConfig.enable_widget_on_product_list});r.appendChild(e.container)}),200)}))}listenToProductDetailViewClick(t){t.addEventListener(Je,(async e=>{const{productId:i}=e.detail;if(A.nullOrUndefined(i))return void this.logger.error(`Expect a product id from mini-card click but got ${i}`);const r=Fa().getProduct(i),n=this.platform.createProduct(r);if(!n.isValid)return;const a=new ko(this.platform,n,this.widgetConfig);this.showDetailView(t,a).then()}))}async showDetailView(t,e){Ht.fadeOut(t),await Ht.waitAnimationEnd(),St(t);const{header:i,backButton:r}=this.createDetailViewHeader();t.append(i,e.container),await Ht.waitToStartAnimation(),Ht.fadeIn(t),this.listenToFromProductDetailToMultipleViewClick(t,r),t.scrollTop=0}createListViewHeader(){return Tt("div",{class:Do.header.container},`${this.linkedProductCount} items in video`)}createListViewBody(){return Tt("div",{class:Do.body.container})}createDetailViewHeader(){const t=Tt("div",{class:Lo.header.container}),{left:e,backButton:i}=this.createDetailViewHeaderLeft(),r=this.createDetailViewHeaderMiddle(),n=this.createDetailViewHeaderRight();return t.append(e,r,n),{header:t,backButton:i}}createDetailViewHeaderLeft(){const t=Tt("div",{class:Lo.header.left}),e=te.createBack([Lo.header.icon]);return t.append(e),{left:t,backButton:e}}createDetailViewHeaderRight(){return Tt("div",{class:Lo.header.right})}createDetailViewHeaderMiddle(){const t=Tt("div",{class:Lo.header.middle}),e=this.createDetailViewHeaderTitle();return t.appendChild(e),t}listenToFromProductDetailToMultipleViewClick(t,e){e.addEventListener("click",(async()=>{Ht.fadeOut(t),await Ht.waitAnimationEnd(),St(t);const e=await this.createAllProducts();this.setMultipleProducts(t,e),await Ht.waitToStartAnimation(),Ht.fadeIn(t)}))}},Yo=i(6790),Jo={};Jo.styleTagTransform=ht(),Jo.setAttributes=lt(),Jo.insert=st().bind(null,"head"),Jo.domAPI=nt(),Jo.insertStyleElement=dt(),it()(Yo.A,Jo),Yo.A&&Yo.A.locals&&Yo.A.locals;const Xo={APPLIED:"vimotia-coupon-applied",EXPIRED:"vimotia-coupon-expired"};var $o=i(8558),Zo={};Zo.styleTagTransform=ht(),Zo.setAttributes=lt(),Zo.insert=st().bind(null,"head"),Zo.domAPI=nt(),Zo.insertStyleElement=dt(),it()($o.A,Zo),$o.A&&$o.A.locals&&$o.A.locals;var tl={activeMinutes:0,buttonText:"Apply",buttonTextApplied:"Applied",backgroundColor:"#FBF6E3",couponMessage:{applying:"Applying your coupon...",applyingDelay:3,applyFailed:"Some issues happened when getting your coupon. Please refresh the page, open the video, and try again.",success:"Coupon is applied successfully",postSuccessNote:"Coupon will be automatically applied at checkout"},couponText:"",foregroundColor:"#FF9AA1",priceRuleId:"",priceRuleType:yn,priceRuleValue:"0",triggerType:vn.EXIT,triggerSeconds:2,validTimerTextBefore:"Expire in",validTimerTextAfter:"",couponCode:"",applied:!1,expireOn:-1};class el{constructor(t,e){this.logger=E(),this.platform=e,this.data=this.extendDefaults(t),this.validTimer=null,this.elements={wrapper:null,coupon:{container:null,button:null},validTimer:{container:null,timer:null},message:{applying:null,applyFailed:null,postSuccessNote:null}},this.classNames={wrapper:{default:"vimotia-coupon__coupon-wrapper"},coupon:{container:"vimotia-coupon__coupon",containerState:{applied:"vimotia-coupon__coupon--applied",timerHidden:"vimotia-coupon__coupon--timer-hidden"},topWrapper:"vimotia-coupon__coupon--top",content:"vimotia-coupon__coupon-content",amount:"vimotia-coupon__coupon-content__amount",text:"vimotia-coupon__coupon-content__text",button:"vimotia-coupon__coupon-button",checkIcon:"vimotia-coupon__coupon-check-icon"},validTimer:{container:"vimotia-coupon__valid-timer",timer:"vimotia-coupon__valid-timer__timer",before:"vimotia-coupon__valid-timer__before",after:"vimotia-coupon__valid-timer__after"},message:{applying:"vimotia-coupon__message--applying",applyFailed:"vimotia-coupon__message--apply-failed",postSuccessNote:"vimotia-coupon__message--post-success-note"}},this.init()}init(){this.createCouponUI(),this.listenToApplyCoupon(),this.listenToCouponApplied(),this.startValidTimer(),this.data.applied&&(this.setCouponStylesToApplied(),this.showMessagePostSuccessNote())}createButton(){const t=Tt("div",{class:this.classNames.coupon.button},this.data.buttonText);return this.elements.coupon.button=t,t}createCheckIcon(){const t=te.createCheckIcon(),e=Tt("div",{class:this.classNames.coupon.checkIcon});return e.innerHTML=t,e}createContent(){const{coupon:t}=this.classNames,e=Tt("div",{class:t.content}),i=Tt("div",{class:t.amount},this.getCouponAmount()),r=Tt("div",{class:t.text},this.data.couponText);return e.append(i,r),e}createCouponUI(){const{wrapper:t,container:e,topWrapper:i}=this.createCouponStructure(),r=this.createContent(),n=this.createButton(),a=this.createValidTimer(),s=this.createCheckIcon();i.append(r,n),e.append(i,a,s);const{applying:o,applyFailed:l,postSuccessNote:c}=this.createMessages();t.append(e,o,l,c)}createCouponStructure(){const t=Tt("div",{class:this.classNames.wrapper.default}),e=Tt("div",{class:this.classNames.coupon.container,style:`--background-color: ${this.data.backgroundColor};\n --foreground-color: ${this.data.foregroundColor};\n `}),i=Tt("div",{class:this.classNames.coupon.topWrapper});return this.elements.wrapper=t,this.elements.coupon.container=e,{wrapper:t,container:e,topWrapper:i}}createMessages(){const{message:t}=this.classNames,e=Tt("div",{class:t.applying,hidden:""},this.data.couponMessage.applying);this.elements.message.applying=e;const i=Tt("div",{class:t.applyFailed,hidden:""},this.data.couponMessage.applyFailed);this.elements.message.applyFailed=i;const r=Tt("div",{class:t.postSuccessNote,hidden:""},this.data.couponMessage.postSuccessNote);return this.elements.message.postSuccessNote=r,{applying:e,applyFailed:i,postSuccessNote:r}}createValidTimer(){const{validTimer:t}=this.classNames,e=Tt("div",{class:t.container}),i=Tt("span",{class:t.before},this.data.validTimerTextBefore),r=Tt("span",{class:t.timer}),n=Tt("span",{class:t.after},this.data.validTimerTextAfter);return e.append(i,r,n),this.elements.validTimer.container=e,this.elements.validTimer.timer=r,e}getContainer(){return A.nullOrUndefined(this.elements.wrapper)?(this.logger.error("Expect a coupon container but got null"),null):this.elements.wrapper}getCouponAmount(){const{priceRuleType:t,priceRuleValue:e}=this.data,i=this.platform.formatPrice(e);switch(t){case yn:return`${e}%`;case"amount":return`${i}`;default:return this.logger.error(`Unknown price rule type ${t}`),""}}getCouponData(){return this.data}getCouponCode(){return this.data.couponCode}getExpireOn(){return this.data.expireOn}getPriceRuleId(){return this.data.priceRuleId}extendDefaults(t){return S({},tl,{couponMessage:{applying:this.platform.couponApplyingMessage}},t)}getTriggerDelay(){return this.data.triggerSeconds}getTriggerType(){return this.data.triggerType}hideValidTimer(){Pt(this.elements.coupon.container,this.classNames.coupon.containerState.timerHidden,!0)}hideMessageApplying(){kt(this.elements.message.applying,!0)}hideMessageApplyFailed(){kt(this.elements.message.applyFailed,!0)}hideMessagePostSuccessNote(){kt(this.elements.message.postSuccessNote,!0)}isApplied(){return this.data.applied}static isNeverExpireActiveConfig(t){return 0===t}listenToCouponApplied(){vt(document.querySelector("body"),Xo.APPLIED,(t=>{const{priceRuleId:e}=t.detail;e!==this.data.priceRuleId&&(this.setState({applied:!1}),Sn.overrideACouponDataInCache(this.data),this.setCouponStylesToDefault(),this.hideMessageApplyFailed(),this.hideMessagePostSuccessNote())}))}listenToApplyCoupon(){this.elements.coupon.button.addEventListener("click",(async()=>{if(this.showMessageApplying(),M.isSafari||await Qt(1e3*this.data.couponMessage.applyingDelay),A.empty(this.data.couponCode))return this.hideMessageApplying(),this.showMessageApplyFailed(),void window.setTimeout((()=>{this.hideMessageApplyFailed()}),1e4);const t=await this.platform.applyCoupon(this.data.couponCode,window.location.pathname);this.hideMessageApplying(),t&&((new ni).success(this.data.couponMessage.success),this.setState({applied:!0}),Sn.overrideACouponDataInCache(this.data),this.setCouponStylesToApplied(),this.showMessagePostSuccessNote(),bt(this.elements.coupon.container,Xo.APPLIED,!0,{priceRuleId:this.data.priceRuleId}))}))}setCouponCode(t){const e=+new Date;if(el.isNeverExpireActiveConfig(this.data.activeMinutes))return void this.setState({couponCode:t,expireOn:0});const i=e+60*this.data.activeMinutes*1e3;this.setState({couponCode:t,expireOn:i}),this.startValidTimer(i)}setCouponStylesToApplied(){this.elements.coupon.button.innerText=this.data.buttonTextApplied,Pt(this.elements.coupon.container,this.classNames.coupon.containerState.applied,!0)}setCouponStylesToDefault(){this.elements.coupon.button.innerText=this.data.buttonText,Pt(this.elements.coupon.container,this.classNames.coupon.containerState.applied,!1)}setState(t){this.data=S({},this.data,t)}startValidTimer(t){let e=t;return A.nullOrUndefined(e)&&(e=this.getExpireOn()),Sn.isNeverExpireOnConfig(e)||Sn.getExpireState(e)?(this.validTimer=null,this.hideValidTimer(),!1):A.nullOrUndefined(this.validTimer)?A.nullOrUndefined(this.validTimer)?(this.validTimer=new Pe(this.elements.validTimer.timer,{date:e,onEnd:()=>{Sn.removeACouponInCache(this.data.couponCode),bt(this.elements.coupon.container,Xo.EXPIRED,!0)}}),this.showValidTimer(),!0):(this.validTimer.update(new Date(e)),!0):(this.showValidTimer(),!0)}showValidTimer(){Pt(this.elements.coupon.container,this.classNames.coupon.containerState.timerHidden,!1)}showMessageApplying(){kt(this.elements.message.applying,!1)}showMessageApplyFailed(){kt(this.elements.message.applyFailed,!1)}showMessagePostSuccessNote(){kt(this.elements.message.postSuccessNote,!1)}get valid(){return!A.empty(this.data.couponCode)}}var il=el,rl={title:"Coupons"};class nl{constructor(){this.logger=E(),this.config=nl.createConfig(),this.couponListDialog=null,this.elements={couponListDialog:{bodyWrapper:null}},this.classNames={couponListDialog:{dialog:"vimotia-modal--coupon-list",bodyWrapper:"vimotia-coupon__coupon-list-dialog-body-wrapper",couponsListWrapper:"vimotia-coupon__coupons-list-wrapper"}},this.init()}init(){this.couponListDialogBody=this.createCouponListDialogBody(),this.dialogInstance=this.createDialog(),this.dialogInstance.inject()}createDialog(){return new Uo({title:this.config.title,customContainerClass:this.classNames.couponListDialog.dialog})}createCouponListWrapper(){return Tt("div",{class:this.classNames.couponListDialog.couponsListWrapper})}createCouponListDialogBody(){return Tt("div",{class:this.classNames.couponListDialog.bodyWrapper})}async setCoupons(t){const e=this.couponListDialogBody.offsetHeight;Ft(this.couponListDialogBody,{height:`${e}px`,opacity:0}),await Qt(300);const i=this.createCouponListWrapper();i.append(...t),St(this.couponListDialogBody),this.couponListDialogBody.appendChild(i),await this.dialogInstance.setBody(this.couponListDialogBody);const r=i.offsetHeight;var n;Ft(this.couponListDialogBody,{height:`${r}px`,opacity:1}),await Qt(600),n=this.couponListDialogBody,A.element(n)&&n.style.removeProperty("height")}show(){this.dialogInstance&&this.dialogInstance.show()}get couponListDialogBody(){return this.elements.couponListDialog.bodyWrapper}set couponListDialogBody(t){this.elements.couponListDialog.bodyWrapper=t}get dialogInstance(){return this.couponListDialog}set dialogInstance(t){this.couponListDialog=t}static createConfig(){return{...rl}}}var al=nl,sl={enable:!1};class ol{constructor(){this.logger=E(),this.config=ol.getConfigs(),this.primaryTimer=null,this.elements={container:null},this.classNames={container:"vimotia-coupon--mobile__coupon-timer"},this.init()}init(){this.container=this.createContainer()}createContainer(){return Tt("div",{class:this.classNames.container})}start(t,e){this.config.enable?+new Date>=t?this.hide():A.nullOrUndefined(this.timerInstance)?(this.timerInstance=new Pe(this.container,{date:t,onEnd:e}),this.show()):this.timerInstance.update(new Date(t)):this.hide()}hide(){kt(this.container,!0)}show(){kt(this.container,!1)}get container(){return this.elements.container}set container(t){this.elements.container=t}get timerInstance(){return this.primaryTimer}set timerInstance(t){this.primaryTimer=t}static getConfigs(){return{...sl}}}var ll=ol,cl={title:"Coupon",timerDuration:10,timerTextBefore:"This popup will be closed in",timerTextAfter:"s"};class dl{constructor(t){this.logger=E(),this.config=dl.createConfig(t),this.timedDialog=null,this.timedDialogTimerRef=-1,this.isTimedDialogShown=!1,this.elements={timedDialog:{container:null,bodyWrapper:null,timer:null}},this.classNames={timedDialog:{dialog:"vimotia-modal--discount-timed-dialog",bodyWrapper:"vimotia-modal--discount-timed-dialog__body-wrapper"},dialogTimer:{container:"vimotia-coupon__dialog-timer",timer:"vimotia-coupon__dialog-timer__timer",before:"vimotia-coupon__dialog-timer__before",after:"vimotia-coupon__dialog-timer__after"}},this.init()}init(){const{container:t,timer:e}=this.createTimedDialogContainers();this.timedDialogContainer=t,this.timedDialogTimerContainer=e,this.timedDialogBody=this.createTimedDialogBody()}initTimedDialog(t){if(A.nullOrUndefined(t))return;const e=new Uo({title:this.config.title,customContainerClass:this.classNames.timedDialog.dialog}),i=t.getContainer();A.nullOrUndefined(i)||(this.setCouponContainerToTimedDialogBody(i),e.setBody(this.timedDialogBody).then((()=>{e.inject()})),this.dialogInstance=e)}createTimedDialogContainers(){const t=Tt("div",{class:this.classNames.dialogTimer.container}),e=Tt("span",{class:this.classNames.dialogTimer.before},this.config.timerTextBefore),i=Tt("span",{class:this.classNames.dialogTimer.timer}),r=Tt("span",{class:this.classNames.dialogTimer.after},this.config.timerTextAfter);return t.append(e,i,r),{container:t,timer:i}}createTimedDialogBody(){return Tt("div",{class:this.classNames.timedDialog.bodyWrapper})}setCouponContainerToTimedDialogBody(t){this.timedDialogBody.append(t,this.timedDialogContainer)}show(t){if(A.nullOrUndefined(t))return this.logger.error("Expect the current coupon but got null"),this.isShown=!0,!1;if(A.nullOrUndefined(this.dialogInstance))return!1;const e=t.getCouponCode();return A.nullOrUndefined(e)||A.empty(e)?(this.logger.error("Expect a coupon code but got null"),this.isShown=!0,!1):(this.startDialogTimer(),this.dialogInstance.show(),this.isShown=!0,!0)}cancel(){this.timerRef>0&&(window.clearTimeout(this.timerRef),this.timerRef=-1)}startDialogTimer(){const t={date:+new Date+1e3*this.config.timerDuration,onEnd:()=>{this.dialogInstance.hide()}};new Pe(this.timedDialogTimerContainer,t)}setTimedDialogPostCloseCallback(t){A.function(t)?A.nullOrUndefined(this.dialogInstance)||this.dialogInstance.setPostCloseCallback((()=>{t()})):this.logger.error(`Param error: expect a function but got: ${t}`)}get timedDialogContainer(){return this.elements.timedDialog.container}set timedDialogContainer(t){this.elements.timedDialog.container=t}get timedDialogTimerContainer(){return this.elements.timedDialog.timer}set timedDialogTimerContainer(t){this.elements.timedDialog.timer=t}get timedDialogBody(){return this.elements.timedDialog.bodyWrapper}set timedDialogBody(t){this.elements.timedDialog.bodyWrapper=t}get dialogInstance(){return this.timedDialog}set dialogInstance(t){this.timedDialog=t}get timerRef(){return this.timedDialogTimerRef}set timerRef(t){this.timedDialogTimerRef=t}get isShown(){return this.isTimedDialogShown}set isShown(t){this.isTimedDialogShown=t}get isNotShown(){return!this.isShown}static createConfig(t){return{...cl,title:t.discount_popup_title,timerTextBefore:t.discount_close_popup_text}}}var ul=dl,hl=class{constructor(t){this.primaryTimer=t,this.elements={coupon:{container:null,timer:null}},this.classNames={coupon:{container:"vimotia-coupon--mobile__coupon-wrapper",icon:"vimotia-coupon--mobile__coupon-icon",timer:"vimotia-coupon--mobile__coupon-timer"}},this.init()}init(){this.initTriggerUI()}initTriggerUI(){this.triggerContainer=this.createTriggerContainers()}createTriggerContainers(){const t=Tt("div",{class:this.classNames.coupon.container}),e=te.createDiscount([this.classNames.coupon.icon]);return t.append(e,this.primaryTimer.container),t}get triggerContainer(){return this.elements.coupon.container}set triggerContainer(t){this.elements.coupon.container=t}hideTriggerContainer(){kt(this.triggerContainer,!0)}},pl=class{constructor(t,e,i){this.logger=E(),this.iconContainer=i,this.couponsManager=new Sn(t),this.platform=e,this.primaryTimer=new ll,this.uiCreator=new hl(this.primaryTimer),this.timedDialog=new ul(t),this.couponListDialog=new al,this.exitHandler=()=>{this.timedDialog.show(this.currentCoupon)&&this.couponsManager.addACoupon(this.currentCoupon)},this.currentCoupon=null,this.init()}init(){const t=this.createCurrentCoupon();this.timedDialog.initTimedDialog(t),this.currentCoupon=t,this.couponsManager.allCoupons=this.createCoupons(),this.couponListDialog.setCoupons(this.allCouponContainers).then(),this.listenToCouponListUpdate(),this.showCurrentCoupon(),this.handleTimedDialogClose(),this.listenToOpenCouponListDialog(),this.showCouponReminder()}createCurrentCoupon(){return A.empty(this.couponsManager.initialCouponData)||Sn.isSeenPriceRule(this.couponsManager.initialCouponPriceRuleId)?null:new il(this.couponsManager.initialCouponData,this.platform)}createCoupons(){const t=Sn.getAllValidCouponsDataInCache(),e=[];return t.forEach((t=>{const i=new il(t,this.platform);e.push(i)})),e}get allCouponContainers(){const t=this.createCoupons();return this.couponsManager.couponContainers(t)}listenToCouponListUpdate(){const{APPLIED:t,EXPIRED:e}=Xo;vt(document.querySelector("body"),`${t} ${e}`,(()=>{this.updateCouponsWithLatestData(),this.updateSortedCouponsInDialog(),this.primaryTimer.start(this.couponsManager.primaryCouponExpireOn,this.primaryTimerOnEndCallback)}))}updateCouponsWithLatestData(){this.couponsManager.allCoupons=this.createCoupons()}updateSortedCouponsInDialog(){this.couponListDialog.setCoupons(this.allCouponContainers).then()}get primaryTimerOnEndCallback(){return()=>{window.setTimeout((()=>{this.couponsManager.hasCoupons?this.primaryTimer.start(this.couponsManager.primaryCouponExpireOn,this.primaryTimerOnEndCallback):this.uiCreator.hideTriggerContainer()}),300)}}showCurrentCoupon(){if(A.nullOrUndefined(this.currentCoupon))return;const{DELAY:t,EXIT:e}=vn,i=this.currentCoupon.getTriggerType(),r=this.currentCoupon.getTriggerDelay();switch(i){case t:this.timedDialog.timerRef=window.setTimeout((()=>{this.timedDialog.show(this.currentCoupon)&&this.couponsManager.addACoupon(this.currentCoupon)}),1e3*r);break;case e:vt(document.querySelector("body"),An,this.exitHandler);break;default:this.logger.error(`Unknown discount trigger type: ${i}`)}}handleTimedDialogClose(){this.timedDialog.setTimedDialogPostCloseCallback((()=>{this.showCouponReminder(),this.couponListDialog.setCoupons(this.allCouponContainers).then()}))}showCouponReminder(){const t=this.iconContainer;A.nullOrUndefined(t)||this.couponsManager.hasNoCoupons||(St(t),t.appendChild(this.uiCreator.triggerContainer),this.primaryTimer.start(this.couponsManager.primaryCouponExpireOn,this.primaryTimerOnEndCallback))}listenToOpenCouponListDialog(){vt(this.uiCreator.triggerContainer,"click",(()=>{this.couponListDialog.show()}))}cancel(){this.timedDialog.cancel(),this.cancelExitTypeDiscount()}cancelExitTypeDiscount(){yt(document.querySelector("body"),An,this.exitHandler)}static filterConfigFromList(t){const e=t.filter((t=>"discount_popup"===t.widget_type));return A.empty(e)?{}:e[0]}getCurrentCouponPriceRuleId(){return A.nullOrUndefined(this.currentCoupon)?"":this.currentCoupon.getPriceRuleId()}isCurrentCouponExitType(){return!A.nullOrUndefined(this.currentCoupon)&&this.currentCoupon.getTriggerType()===vn.EXIT}setCurrentCouponCode(t){A.nullOrUndefined(t)||A.empty(t)||this.currentCoupon.setCouponCode(t)}shouldCurrentCouponShowAtExit(){const t=this.isCurrentCouponExitType(),e=this.currentCoupon&&this.currentCoupon.valid;return t&&this.timedDialog.isNotShown&&e}},gl=i(7791),fl={};fl.styleTagTransform=ht(),fl.setAttributes=lt(),fl.insert=st().bind(null,"head"),fl.domAPI=nt(),fl.insertStyleElement=dt(),it()(gl.A,fl),gl.A&&gl.A.locals&&gl.A.locals;var ml=i(9829),vl=i(6465),yl={};yl.styleTagTransform=ht(),yl.setAttributes=lt(),yl.insert=st().bind(null,"head"),yl.domAPI=nt(),yl.insertStyleElement=dt(),it()(vl.A,yl),vl.A&&vl.A.locals&&vl.A.locals;const Al="xsmall",bl="small",_l="medium",wl="large",Cl="standard",El="--vimotia-play-button-theme-color",Tl="--vimotia-play-button-theme-color-rgb",Il="--vimotia-play-button-circle-color",Sl="--vimotia-play-button-triangle-color",xl="--vimotia-play-button-text-color",kl="--vimotia-play-button-text-background-color",Pl="--vimotia-play-button-text-border-color";var Dl=i(773),Ll={};Ll.styleTagTransform=ht(),Ll.setAttributes=lt(),Ll.insert=st().bind(null,"head"),Ll.domAPI=nt(),Ll.insertStyleElement=dt(),it()(Dl.A,Ll),Dl.A&&Dl.A.locals&&Dl.A.locals;var Bl=i(7679),Ol={};Ol.styleTagTransform=ht(),Ol.setAttributes=lt(),Ol.insert=st().bind(null,"head"),Ol.domAPI=nt(),Ol.insertStyleElement=dt(),it()(Bl.A,Ol),Bl.A&&Bl.A.locals&&Bl.A.locals;var Rl=i(9636),Ml={};Ml.styleTagTransform=ht(),Ml.setAttributes=lt(),Ml.insert=st().bind(null,"head"),Ml.domAPI=nt(),Ml.insertStyleElement=dt(),it()(Rl.A,Ml),Rl.A&&Rl.A.locals&&Rl.A.locals;var Nl=i(4093),Fl={};Fl.styleTagTransform=ht(),Fl.setAttributes=lt(),Fl.insert=st().bind(null,"head"),Fl.domAPI=nt(),Fl.insertStyleElement=dt(),it()(Nl.A,Fl),Nl.A&&Nl.A.locals&&Nl.A.locals;var Ul=i(3356),Vl={};Vl.styleTagTransform=ht(),Vl.setAttributes=lt(),Vl.insert=st().bind(null,"head"),Vl.domAPI=nt(),Vl.insertStyleElement=dt(),it()(Ul.A,Vl),Ul.A&&Ul.A.locals&&Ul.A.locals;var jl=class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"";this.themeColor=t}animate(t){this.setAnimationClass(t)}setAnimationClass(t){Pt(t,"vimotia__playButton--animation",!0),Pt(t,this.className,!0)}get className(){throw new Error("implement it in the sub class")}};var Ql=class extends jl{get className(){return"vimotia__playButton--bounce"}};var Gl=class extends jl{get className(){return"vimotia__playButton--no-animation"}},Hl=i(7519),Wl={};Wl.styleTagTransform=ht(),Wl.setAttributes=lt(),Wl.insert=st().bind(null,"head"),Wl.domAPI=nt(),Wl.insertStyleElement=dt(),it()(Hl.A,Wl),Hl.A&&Hl.A.locals&&Hl.A.locals;const zl="--emitting-color";var Kl=class extends jl{animate(t){super.animate(t),Ut(t,{[zl]:this.themeColor})}get className(){return"vimotia__playButton--emitting"}},ql=i(869),Yl={};Yl.styleTagTransform=ht(),Yl.setAttributes=lt(),Yl.insert=st().bind(null,"head"),Yl.domAPI=nt(),Yl.insertStyleElement=dt(),it()(ql.A,Yl),ql.A&&ql.A.locals&&ql.A.locals;var Jl=class extends jl{get className(){return"vimotia__playButton--flash"}},Xl=i(4727),$l={};$l.styleTagTransform=ht(),$l.setAttributes=lt(),$l.insert=st().bind(null,"head"),$l.domAPI=nt(),$l.insertStyleElement=dt(),it()(Xl.A,$l),Xl.A&&Xl.A.locals&&Xl.A.locals;var Zl=class extends jl{get className(){return"vimotia__playButton--flip"}},tc=i(6213),ec={};ec.styleTagTransform=ht(),ec.setAttributes=lt(),ec.insert=st().bind(null,"head"),ec.domAPI=nt(),ec.insertStyleElement=dt(),it()(tc.A,ec),tc.A&&tc.A.locals&&tc.A.locals;var ic=class extends jl{get className(){return"vimotia__playButton--jello"}},rc=i(5289),nc={};nc.styleTagTransform=ht(),nc.setAttributes=lt(),nc.insert=st().bind(null,"head"),nc.domAPI=nt(),nc.insertStyleElement=dt(),it()(rc.A,nc),rc.A&&rc.A.locals&&rc.A.locals;var ac=class extends jl{get className(){return"vimotia__playButton--pulse"}},sc=i(4931),oc={};oc.styleTagTransform=ht(),oc.setAttributes=lt(),oc.insert=st().bind(null,"head"),oc.domAPI=nt(),oc.insertStyleElement=dt(),it()(sc.A,oc),sc.A&&sc.A.locals&&sc.A.locals;var lc=class extends jl{get className(){return"vimotia__playButton--rubber-band"}},cc=i(6561),dc={};dc.styleTagTransform=ht(),dc.setAttributes=lt(),dc.insert=st().bind(null,"head"),dc.domAPI=nt(),dc.insertStyleElement=dt(),it()(cc.A,dc),cc.A&&cc.A.locals&&cc.A.locals;var uc=class extends jl{get className(){return"vimotia__playButton--shine"}},hc=i(3325),pc={};pc.styleTagTransform=ht(),pc.setAttributes=lt(),pc.insert=st().bind(null,"head"),pc.domAPI=nt(),pc.insertStyleElement=dt(),it()(hc.A,pc),hc.A&&hc.A.locals&&hc.A.locals;var gc=class extends jl{get className(){return"vimotia__playButton--swing"}},fc=i(9101),mc={};mc.styleTagTransform=ht(),mc.setAttributes=lt(),mc.insert=st().bind(null,"head"),mc.domAPI=nt(),mc.insertStyleElement=dt(),it()(fc.A,mc),fc.A&&fc.A.locals&&fc.A.locals;var vc=class extends jl{get className(){return"vimotia__playButton--tada"}},yc=i(9011),Ac={};Ac.styleTagTransform=ht(),Ac.setAttributes=lt(),Ac.insert=st().bind(null,"head"),Ac.domAPI=nt(),Ac.insertStyleElement=dt(),it()(yc.A,Ac),yc.A&&yc.A.locals&&yc.A.locals;var bc=class extends jl{get className(){return"vimotia__playButton--wobble"}},_c=class{static create(t,e){switch(t){case"bounce":return new Ql;case"emitting":return new Kl(e);case"flash":return new Jl;case"flip":return new Zl;case"jello":return new ic;case"pulse":return new ac;case"band":return new lc;case"shine":return new uc;case"swing":return new gc;case"tada":return new vc;case"wobble":return new bc;default:return new Gl}}},wc=i(9439),Cc={};Cc.styleTagTransform=ht(),Cc.setAttributes=lt(),Cc.insert=st().bind(null,"head"),Cc.domAPI=nt(),Cc.insertStyleElement=dt(),it()(wc.A,Cc),wc.A&&wc.A.locals&&wc.A.locals;var Ec=class{setSizeClass(t){Pt(t,this.className,!0)}get className(){throw new Error("implement it in the sub class")}};var Tc=class extends Ec{get className(){return"vimotia__playButton--large"}},Ic=i(3321),Sc={};Sc.styleTagTransform=ht(),Sc.setAttributes=lt(),Sc.insert=st().bind(null,"head"),Sc.domAPI=nt(),Sc.insertStyleElement=dt(),it()(Ic.A,Sc),Ic.A&&Ic.A.locals&&Ic.A.locals;var xc=class extends Ec{get className(){return"vimotia__playButton--medium"}},kc=i(407),Pc={};Pc.styleTagTransform=ht(),Pc.setAttributes=lt(),Pc.insert=st().bind(null,"head"),Pc.domAPI=nt(),Pc.insertStyleElement=dt(),it()(kc.A,Pc),kc.A&&kc.A.locals&&kc.A.locals;var Dc=class extends Ec{get className(){return"vimotia__playButton--small"}},Lc=i(8693),Bc={};Bc.styleTagTransform=ht(),Bc.setAttributes=lt(),Bc.insert=st().bind(null,"head"),Bc.domAPI=nt(),Bc.insertStyleElement=dt(),it()(Lc.A,Bc),Lc.A&&Lc.A.locals&&Lc.A.locals;var Oc=class extends Ec{get className(){return"vimotia__playButton--x-small"}},Rc=class{static create(t){switch(t){case Al:return new Oc;case bl:return new Dc;case _l:return new xc;case wl:return new Tc;default:throw new Error(`Unknown play button size ${t}`)}}},Mc=class{constructor(t){this.stateClient=tt(),this.data=this.createData(t),this.sizer=Rc.create(t.play_button_size),this.animator=_c.create(t.play_button_animation,this.themeColor),this.elements={container:null,progressBar:null},this.classNames={container:"vimotia__playButtonContainer",containerVisibility:"vimotia__playButtonContainer--visible",containerIsShowing:"vimotia__playButtonContainer--is-showing",innerContainer:"vimotia__playButtonInnerContainer",autoStart:"vimotia__autoStart",button:"vimotia__playButton",circleWrapper:"vimotia__playButton-circleWrapper",circle:"vimotia__playButton-circle",triangle:"vimotia__playButton-triangle",textWrapper:"vimotia__playButton__text",timeWrapper:"vimotia__playButton__time",textTimeWrapper:"vimotia__playButton__textTime",progressBar:"vimotia__playButton__progressBar",progressBarAnimation:"vimotia__playButton__progressBarAnimate"},this.init()}init(){this.container=this.createContainer(),this.setStyle(this.container),this.setCSSVariable(this.container),this.sizer.setSizeClass(this.container);const t=this.createInnerContainer();this.container.appendChild(t),this.animator.animate(t),this.progressBar=this.createProgressBar(),this.assembleUI(t)}createContainer(){return Tt("div",{class:this.classNames.container})}assembleUI(t){throw new Error("Implement it in the sub class")}setStyle(t){A.array(this.styleClassName)?this.styleClassName.forEach((e=>{Pt(t,e,!0)})):Pt(t,this.styleClassName,!0)}get styleClassName(){throw new Error("Implement it in the sub class")}setCSSVariable(t){Ut(t,this.cssVariables)}get cssVariables(){return{[El]:this.themeColor,[Tl]:ue(this.themeColor)}}createInnerContainer(){const t=this.isAutoStart?this.classNames.autoStart:"";return Tt("div",{class:`${this.classNames.innerContainer} ${t}`})}createButton(){return Tt("div",{class:this.classNames.button})}createTextTimeWrapper(){return Tt("div",{class:this.classNames.textTimeWrapper})}createCircleWrapper(){return Tt("div",{class:this.classNames.circleWrapper})}createCircle(){return Tt("div",{class:this.classNames.circle})}createTriangle(){const t=Tt("div",{class:this.classNames.triangle});return t.innerHTML=te.createPlayArrowIcon(),t}createProgressBar(){const t=this.isAutoStart?this.classNames.progressBarAnimation:"",e=this.isAutoStart?`--vimotia-progress-bar-duration: ${this.data.autoStartInSeconds}s`:"";return Tt("div",{class:`${this.classNames.progressBar} ${t}`,style:e})}cancelAutoPlayProcessAnimation(){Pt(this.progressBar,this.classNames.progressBarAnimation,!1)}createText(t){return Tt("span",{class:`${this.classNames.textWrapper}`},t)}firstNonWhiteColor(t){if(!A.array(t))throw new Error(`Expected an array, but got ${t}`);for(let e=0;e{if(t.endsWith("_m")){const i=t.substring(0,t.length-2);o[i]=e[t]}})):Object.keys(e).forEach((t=>{t.endsWith("_m")||(o[t]=e[t])})),o=S({},s,o),o}static getVideoLength(){let t=0;return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:[]).forEach((e=>{t+=e.length})),t}}var Zc=$c;const td="--vimotia-heading-font-weight",ed="--vimotia-heading-font-size",id="--vimotia-heading-text-color",rd="--vimotia-heading-background-color";var nd={text:"Heading",fontFamily:"inherit",fontWeight:"regular",fontSize:16,textColor:"#000000",backgroundColor:"transparent",position:"top_left"},ad=i(68),sd={};sd.styleTagTransform=ht(),sd.setAttributes=lt(),sd.insert=st().bind(null,"head"),sd.domAPI=nt(),sd.insertStyleElement=dt(),it()(ad.A,sd),ad.A&&ad.A.locals&&ad.A.locals;var od=class{constructor(t){this.data=t,this.elements={container:null},this.init()}init(){this.container=this.createContainer(),this.setStyleClassName(this.container),this.setCSSVariables(this.container)}createContainer(){return Tt("div",{class:"vimotia-heading"},this.data.text)}setStyleClassName(t){Pt(t,this.styleClassName)}get styleClassName(){throw new Error("implement it in the sub class")}setCSSVariables(t){Ut(t,this.cssVariables)}get cssVariables(){return{[td]:this.data.fontWeight,[ed]:`${this.data.fontSize}px`,[id]:this.data.textColor,[rd]:this.data.backgroundColor}}get container(){return this.elements.container}set container(t){this.elements.container=t}};var ld=class extends od{get styleClassName(){return"vimotia-heading--simple"}};class cd{static createHeading(t){const e=cd.createData(t);return new ld(e)}static createData(t){return{...nd,text:t.thumbnail_text,textColor:t.thumbnail_text_color}}}var dd=cd;const ud="rect",hd="rectv",pd="round",gd="square",fd="--vimotia-thumbnail-image",md="--vimotia-thumbnail-border-radius",vd="--vimotia-thumbnail-border-width",yd="--vimotia-thumbnail-border-color";var Ad=i(5069),bd={};bd.styleTagTransform=ht(),bd.setAttributes=lt(),bd.insert=st().bind(null,"head"),bd.domAPI=nt(),bd.insertStyleElement=dt(),it()(Ad.A,bd),Ad.A&&Ad.A.locals&&Ad.A.locals;var _d=i(8808),wd={};wd.styleTagTransform=ht(),wd.setAttributes=lt(),wd.insert=st().bind(null,"head"),wd.domAPI=nt(),wd.insertStyleElement=dt(),it()(_d.A,wd),_d.A&&_d.A.locals&&_d.A.locals;const Cd="center";var Ed=class{setPositionClass(t){throw new Error("implement it in the sub class")}setTopClass(t){Pt(t,"vimotia-thumbnail__play-button--top",!0)}setBottomClass(t){Pt(t,"vimotia-thumbnail__play-button--bottom",!0)}setLeftClass(t){Pt(t,"vimotia-thumbnail__play-button--left",!0)}setRightClass(t){Pt(t,"vimotia-thumbnail__play-button--right",!0)}setCenterXClass(t){Pt(t,"vimotia-thumbnail__play-button--center-x",!0)}setCenterYClass(t){Pt(t,"vimotia-thumbnail__play-button--center-y",!0)}},Td=class extends Ed{setPositionClass(t){this.setBottomClass(t),this.setLeftClass(t)}},Id=class extends Ed{setPositionClass(t){this.setBottomClass(t),this.setRightClass(t)}},Sd=class extends Ed{setPositionClass(t){this.setCenterXClass(t),this.setCenterYClass(t)}},xd=class extends Ed{setPositionClass(t){this.setTopClass(t),this.setLeftClass(t)}},kd=class extends Ed{setPositionClass(t){this.setTopClass(t),this.setRightClass(t)}},Pd=class{static create(t){switch(t){case"top_left":return new xd;case"top_right":return new kd;case Cd:return new Sd;case"bottom_left":return new Td;case"bottom_right":return new Id;default:throw new Error(`Unknown play button position ${t}`)}}},Dd=i(1710),Ld={};Ld.styleTagTransform=ht(),Ld.setAttributes=lt(),Ld.insert=st().bind(null,"head"),Ld.domAPI=nt(),Ld.insertStyleElement=dt(),it()(Dd.A,Ld),Dd.A&&Dd.A.locals&&Dd.A.locals;var Bd=class{setSizeClass(t){Pt(t,this.className,!0)}get className(){throw new Error("implement it in the sub class")}};var Od=class extends Bd{get className(){return"vimotia-thumbnail--large"}},Rd=i(1580),Md={};Md.styleTagTransform=ht(),Md.setAttributes=lt(),Md.insert=st().bind(null,"head"),Md.domAPI=nt(),Md.insertStyleElement=dt(),it()(Rd.A,Md),Rd.A&&Rd.A.locals&&Rd.A.locals;var Nd=class extends Bd{get className(){return"vimotia-thumbnail--medium"}},Fd=i(7310),Ud={};Ud.styleTagTransform=ht(),Ud.setAttributes=lt(),Ud.insert=st().bind(null,"head"),Ud.domAPI=nt(),Ud.insertStyleElement=dt(),it()(Fd.A,Ud),Fd.A&&Fd.A.locals&&Fd.A.locals;var Vd=class extends Bd{get className(){return"vimotia-thumbnail--small"}},jd=i(9356),Qd={};Qd.styleTagTransform=ht(),Qd.setAttributes=lt(),Qd.insert=st().bind(null,"head"),Qd.domAPI=nt(),Qd.insertStyleElement=dt(),it()(jd.A,Qd),jd.A&&jd.A.locals&&jd.A.locals;var Gd=class extends Bd{get className(){return"vimotia-thumbnail--x-small"}},Hd=class{static create(t){switch(t){case Al:return new Gd;case bl:return new Vd;case _l:return new Nd;case wl:return new Od;default:throw new Error(`Unknown thumbnail size ${t}`)}}},Wd=class{constructor(t,e,i){this.stateClient=tt(),this.data=t,this.playButtonStyler=e,this.heading=i,this.playButtonPositioner=Pd.create(this.data.playButtonPosition),this.sizer=Hd.create(this.data.size),this.elements={container:null},this.classNames={container:"vimotia-thumbnail",containerStates:{hasVideoDuration:"vimotia-thumbnail--has-video-duration"},inner:"vimotia-thumbnail__inner",playButtonWrapper:"vimotia-thumbnail__play-button",videoDuration:"vimotia-thumbnail__video-duration"},this.init()}init(){this.container=this.createContainer(),this.setStyle(this.container),this.setCSSVariable(this.container),this.sizer.setSizeClass(this.container),this.playButtonPositioner.setPositionClass(this.container),this.assembleUI(this.container)}createContainer(){return Tt("div",{class:this.classNames.container})}setStyle(t){Pt(t,this.shapeClassName,!0)}get shapeClassName(){throw new Error("Implement it in the sub class")}setCSSVariable(t){Ut(t,this.cssVariables)}get cssVariables(){return{...super.cssVariables,[fd]:`url('${this.data.backgroundImage}')`,[vd]:`${this.data.borderWidth}px`,[md]:`${this.data.borderRadius}px`,[yd]:this.data.borderColor}}assembleUI(t){const e=this.createPlayButtonWrapperContainer();e.append(this.playButtonStyler.container);const i=this.createInnerContainer();if(i.append(this.heading.container,e),this.data.shouldDisplayVideoDuration){const e=this.createVideoDurationContainer();i.append(e),Pt(t,this.classNames.containerStates.hasVideoDuration,!0)}t.append(i)}createInnerContainer(){return Tt("div",{class:this.classNames.inner})}createPlayButtonWrapperContainer(){return Tt("div",{class:this.classNames.playButtonWrapper})}createVideoDurationContainer(){return Tt("div",{class:this.classNames.videoDuration},`${this.data.videoDuration}`)}async hide(){return Ht.fadeOutTop(this.container),await Ht.waitAnimationEnd(),kt(this.container,!0),await this.playButtonStyler.hide(),!0}show(){Ht.fadeInTop(this.container),this.playButtonStyler.show().then()}cancelPlayButtonAutoPlayProcessAnimation(){this.playButtonStyler.cancelAutoPlayProcessAnimation()}get container(){return this.elements.container}set container(t){this.elements.container=t}};var zd=class extends Wd{get shapeClassName(){return"vimotia-thumbnail--landscape"}},Kd=i(3569),qd={};qd.styleTagTransform=ht(),qd.setAttributes=lt(),qd.insert=st().bind(null,"head"),qd.domAPI=nt(),qd.insertStyleElement=dt(),it()(Kd.A,qd),Kd.A&&Kd.A.locals&&Kd.A.locals;var Yd=class extends Wd{get shapeClassName(){return"vimotia-thumbnail--portrait"}},Jd=i(5975),Xd={};Xd.styleTagTransform=ht(),Xd.setAttributes=lt(),Xd.insert=st().bind(null,"head"),Xd.domAPI=nt(),Xd.insertStyleElement=dt(),it()(Jd.A,Xd),Jd.A&&Jd.A.locals&&Jd.A.locals;var $d=class extends Wd{get shapeClassName(){return"vimotia-thumbnail--round"}},Zd=i(1533),tu={};tu.styleTagTransform=ht(),tu.setAttributes=lt(),tu.insert=st().bind(null,"head"),tu.domAPI=nt(),tu.insertStyleElement=dt(),it()(Zd.A,tu),Zd.A&&Zd.A.locals&&Zd.A.locals;var eu=class extends Wd{get shapeClassName(){return"vimotia-thumbnail--square"}};class iu{static createPlayButtonThumbnail(t){const e=iu.createDataFromPlayButtonData(t),i=dd.createHeading(t),r=iu.createThumbnailPlayButtonData(t),n=Xc.create(r);switch(t.thumbnail_format){case ud:return new zd(e,n,i);case hd:return new Yd(e,n,i);case pd:return new $d(e,n,i);case gd:return new eu(e,n,i);default:throw new Error(`Unknown thumbnail style type ${t.thumbnail_format}`)}}static createDataFromPlayButtonData(t){return{backgroundImage:t.coverImageUrl,playButtonPosition:t.play_button_position,style:t.thumbnail_format,size:t.play_button_size,borderRadius:t.thumbnail_radius,borderWidth:t.thumbnail_border,borderColor:t.thumbnail_border_color,shouldDisplayVideoDuration:t.thumbnail_video_duration,videoDuration:t.videoLength}}static createThumbnailPlayButtonData(t){return{...t,play_button_video_duration:!1}}static createGalleryThumbnail(t,e){const i=iu.mapGalleryDataToPlayButtonData(t,e),r=Xc.create(i),n=dd.createHeading(i),a=iu.createDataFromGalleryData(i,e);switch(e.thumbnail_format){case ud:return new zd(a,r,n);case hd:return new Yd(a,r,n);case pd:return new $d(a,r,n);case gd:return new eu(a,r,n);default:throw new Error(`Unknown thumbnail style type ${e.thumbnail_format}`)}}static mapGalleryDataToPlayButtonData(t,e){return{shouldAutoPlay:!1,auto_start:!1,auto_start_seconds:0,embeded_play:!1,linkedpage:-1,muted_play:!1,name:"",play_button_x:"",play_button_xpath:"",play_button_y:"",playerId:-1,player_style:"",video:-1,coverImageUrl:`${(new d).staticSrcBaseUrl}/${t.video.cover_image_url}`,play_button_video_duration:!1,play_button_bgcolor_cir:e.play_btn_bgcolor_cir,play_button_bgcolor_tri:e.play_btn_bgcolor_tri,play_button_bgcolor_txt:e.play_btn_bgcolor_txt,play_button_brcolor_cir:e.play_btn_brcolor_cir,play_button_brcolor_tri:e.play_btn_brcolor_tri,play_button_brcolor_txt:e.play_btn_brcolor_txt,play_button_size:_l,play_button_style:e.play_btn_style,play_button_animation:e.play_btn_animation,play_button_text:e.play_btn_text,play_button_txt_color:e.play_btn_txt_color,play_button_color:e.play_btn_color,play_button_position:e.play_btn_position,thumbnail_format:e.thumbnail_format,thumbnail_radius:e.thumbnail_radius,thumbnail_border:e.thumbnail_border,thumbnail_border_color:e.thumbnail_border_color,thumbnail_video_duration:e.thumbnail_video_duration,thumbnail_text:t.player.thumbnail_text,thumbnail_text_color:t.player.thumbnail_text_color,videoLength:Zc.getVideoLength(t.linkedhosts)}}static createDataFromGalleryData(t,e){return{backgroundImage:t.coverImageUrl,playButtonPosition:e.play_btn_position,style:e.thumbnail_format,size:t.play_button_size,borderRadius:e.thumbnail_radius,borderWidth:e.thumbnail_border,borderColor:e.thumbnail_border_color,shouldDisplayVideoDuration:e.thumbnail_video_duration,videoDuration:t.videoLength}}}var ru=iu,nu={shouldAutoPlay:!0,auto_start:!1,auto_start_seconds:10,coverImageUrl:"",embeded_play:!1,linkedpage:-1,muted_play:!1,name:"",play_button_bgcolor_cir:"#FFFFFFFF",play_button_bgcolor_tri:"#FAAD14FF",play_button_bgcolor_txt:"#FAAD14FF",play_button_brcolor_cir:"#FFFFFFFF",play_button_brcolor_tri:"#FFFFFFFF",play_button_brcolor_txt:"#FAAD14FF",play_button_color:"#E35421",play_button_fixed:!1,play_button_size:_l,play_button_style:Cl,play_button_video_duration:!1,play_button_animation:"",play_button_text:"Play",play_button_txt_color:"#FFFFFFFF",play_button_x:"93,371,0",play_button_xpath:"body[1]",play_button_y:"197,6564,0",play_button_position:Cd,thumbnail_format:pd,thumbnail_radius:4,thumbnail_border:2,thumbnail_border_color:"#FFFFFF",thumbnail_video_duration:!1,thumbnail_text:"",thumbnail_text_color:"#FFFFFF",playerId:-1,player_style:"floating",video:-1,videoLength:-1};class au{constructor(t){this.logger=E(),this.stateClient=tt(),this.playerItem=t;const e=Zc.getPlayButtonDataBasedOnDevice(this.playerItem);this.config=this.getConfig(e),this.styler=Xc.create(this.config),this.thumbnail=ru.createPlayButtonThumbnail(this.config),this.init()}init(){this.setCSSVariable()}setCSSVariable(){Ut(this.styler.container,this.cssVariables)}get cssVariables(){throw new Error("Implement it in the sub class")}inject(){throw new Error("Implement it in the sub class")}postInject(){this.setTypeUniqueUI(),this.listenToRemoveAnimation(),this.show().then()}setTypeUniqueUI(){throw new Error("Implement it in the sub class")}listenToRemoveAnimation(){vt(this.styler.container,"click animationend",(()=>{this.styler.cancelAutoPlayProcessAnimation()}))}async show(){await this.styler.show()}async hide(){await this.styler.hide()}destroy(){window.setTimeout((()=>{It(this.styler.container)}),200)}getConfig(t){return S({},nu,t,{shouldAutoPlay:t.auto_start})}static getInitPosition(t){return au.getPositionValue(t,0)}static getPositionValue(t,e){if(A.nullOrUndefined(t))return-1;const i=t.split(",");return A.nullOrUndefined(i[e])?-1:parseFloat(i[e])}get container(){return this.styler.container}get targetFromXPath(){const t=Zc.getPlayButtonDataBasedOnDevice(this.playerItem);return au.getPlayButtonTarget(t)}static getPlayButtonTarget(t){const e=E();if(A.empty(t.play_button_xpath))return e.warn("Play button XPath is empty"),null;let i;const r=t.play_button_xpath.split("&&").filter((t=>!A.empty(t)));try{for(let t=0;t0&&void 0!==arguments[0]?arguments[0]:{};const e=["left","right","top","bottom"];Object.keys(t).forEach((i=>{e.includes(i)&&A.number(t[i])&&this.container.style.setProperty(i,`${t[i]}px`)}))}injectToTargetXPath(){A.nullOrUndefined(this.targetFromXPath)?this.logger.error(`Cannot find target place from XPath: ${this.config.play_button_xpath}`):(this.targetFromXPath.prepend(this.elements.positionMarkerContainer),this.fineTunePosition(this.targetFromXPath))}fineTunePosition(t){A.nullOrUndefined(t)?this.logger.error("Expect a target container for attached play button but got null"):(this.isDefaultPosition()||this.rePosition(t,!0),this.checkContainerRect(t))}checkContainerRect(t){if(this.isListenerAttached.containerSize)return;if(this.isDefaultPosition())return;this.isListenerAttached.containerSize=!0;const e=t.getBoundingClientRect();let i=Number(e.width),r=Number(e.height);window.setInterval((()=>{const e=t.getBoundingClientRect(),n=Number(e.width),a=Number(e.height);i===n&&r===a||(this.rePosition(t,!1),i=n,r=a)}),200)}isDefaultPosition(){const{play_button_x:t,play_button_y:e}=this.config;return!t.includes(",")&&!e.includes(",")}rePosition(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=t.getBoundingClientRect(),r=Number(i.width),n=Number(i.height),a=getComputedStyle(t),s=Number(this.targetContainerRect.width),o=Number(this.targetContainerRect.height),l=getComputedStyle(this.container),c=Number(a.paddingLeft.replace("px","")),d=Number(a.paddingRight.replace("px","")),u=this.container.offsetHeight,h=this.container.offsetWidth,p=-d+c;let g,f,m;e?(g=su.getInitPosition(this.config.play_button_y),f=su.getInitPosition(this.config.play_button_x),m=ou.getButtonOffset(this.config.play_button_x)):(g=Number(l.top.replace("px","")),f=Number(l.left.replace("px","")),m=-d+c);const v=Math.abs((r-h-p)/(s-h-m+1e-9));let y=(g+o)*Math.abs((n-u)/(o-u+1e-9))-n;(n/r>1.8||o/s>1.8||gn)&&(y=Math.round(g*(r/s))),Math.abs(i.height-o)<=1e-12&&(y=g);const A=Math.round(f*v);this.container.style.setProperty(D,`${A}px`),this.container.style.setProperty(L,`${y}px`),this.targetContainerRect.width=i.width,this.targetContainerRect.height=i.height}static getButtonOffset(t){const e=su.getPositionValue(t,2);return e<0?0:e}static getTargetContainerRect(t){return su.getPositionValue(t,1)}}var lu=ou,cu=i(9745),du={};du.styleTagTransform=ht(),du.setAttributes=lt(),du.insert=st().bind(null,"head"),du.domAPI=nt(),du.insertStyleElement=dt(),it()(cu.A,du),cu.A&&cu.A.locals&&cu.A.locals;var uu=class extends su{setTypeUniqueUI(){Pt(this.container,"vimotia__playButtonContainer--embed",!0)}get cssVariables(){return{}}inject(){A.nullOrUndefined(this.targetFromXPath)?this.logger.error(`Cannot find target place from XPath: ${this.config.play_button_xpath}`):(this.targetFromXPath.appendChild(this.thumbnail.container),this.postInject())}async show(){this.thumbnail.show()}async hide(){await this.thumbnail.hide()}get container(){return this.thumbnail.container}},hu=i(5511),pu={};pu.styleTagTransform=ht(),pu.setAttributes=lt(),pu.insert=st().bind(null,"head"),pu.domAPI=nt(),pu.insertStyleElement=dt(),it()(hu.A,pu),hu.A&&hu.A.locals&&hu.A.locals;var gu=class extends su{setTypeUniqueUI(){Pt(this.container,"vimotia__playButtonContainer--floating",!0),Pt(this.container,"vimotia__playButtonContainer--left",!0)}get cssVariables(){return{[P]:`${he(this.styler.themeColor,.1)}`,[D]:`${su.getInitPosition(this.config.play_button_x)}px`,[L]:`${su.getInitPosition(this.config.play_button_y)}px`}}inject(){document.querySelector("body").prepend(this.container),this.postInject()}},fu=i(8705),mu={};mu.styleTagTransform=ht(),mu.setAttributes=lt(),mu.insert=st().bind(null,"head"),mu.domAPI=nt(),mu.insertStyleElement=dt(),it()(fu.A,mu),fu.A&&fu.A.locals&&fu.A.locals;const vu="bottom_right",yu="bottom_left",Au="close";var bu=i(9074),_u={};_u.styleTagTransform=ht(),_u.setAttributes=lt(),_u.insert=st().bind(null,"head"),_u.domAPI=nt(),_u.insertStyleElement=dt(),it()(bu.A,_u),bu.A&&bu.A.locals&&bu.A.locals;const wu=E(),Cu=cn.create({baseURL:"",timeout:3e4});Cu.interceptors.response.use((t=>t.data),(t=>(wu.error(t),Promise.reject(t))));var Eu=Cu,Tu=class extends ma{constructor(t){super(),this.data=t}getProductSubtotal(t){let e=this.getProductSubtotalInPhysicalItems(t);return e>0||(e=this.getProductSubtotalInDigitalItems(t),e>0||(e=this.getProductSubtotalInGiftCertificates(t))),`${e}`}getProductSubtotalInPhysicalItems(t){const e=this.data.lineItems.physicalItems.filter((e=>`${e.productId}`===t));if(0===e.length)return 0;const i=e.map((t=>t.extendedSalePrice));return i.reduce(((t,e)=>t+e))}getProductSubtotalInDigitalItems(t){const e=this.data.lineItems.digitalItems.filter((e=>`${e.productId}`===t));if(0===e.length)return 0;const i=e.map((t=>t.extendedSalePrice));return i.reduce(((t,e)=>t+e))}getProductSubtotalInGiftCertificates(t){const e=this.data.lineItems.digitalItems.filter((e=>`${e.type}`===t));if(0===e.length)return 0;const i=e.map((t=>t.amount));return i.reduce(((t,e)=>t+e))}isProductInOrder(t){return this.isProductInPhysicalItems(t)||this.isProductInDigitalItems(t)||this.isProductInGiftCertificates(t)}isProductInPhysicalItems(t){const e=this.data.lineItems.physicalItems.find((e=>`${e.productId}`===t));return!A.nullOrUndefined(e)}isProductInDigitalItems(t){const e=this.data.lineItems.digitalItems.find((e=>`${e.productId}`===t));return!A.nullOrUndefined(e)}isProductInGiftCertificates(t){const e=this.data.lineItems.giftCertificates.find((e=>`${e.productId}`===t));return!A.nullOrUndefined(e)}get orderId(){return this.data.orderId}get usedCouponCode(){return 0===this.data.coupons.length?"":this.data.coupons[0].code}get usedCouponData(){return 0===this.data.coupons.length?{code:"",applicable:!1}:{code:this.data.coupons[0].code,applicable:!0}}},Iu=class extends Aa{readData(t){return{id:`${t.id}`,name:t.name,position:t.position,values:this.encodeValues(t.values)}}encodeValues(t){return t.map((t=>({valueId:t.id,displayName:t.label})))}},Su=class extends ya{createOptions(t){return t.map((t=>new Iu(t)))}};class xu extends Ea{readData(t){return{id:`${t.id}`,title:t.title,price:xu.calculatePrice(t),compareAtPrice:xu.calculateCompareAtPrice(t),imageSrc:A.nullOrUndefined(t.image)?"":t.image.url,stock:t.inventoryQuantity,isStockManaged:!0,isContinueSellingWhenOutOfStock:!1,optionKeys:xu.formatOptionsKeys(t)}}static calculatePrice(t){const e=parseFloat(t.price),i=parseFloat(t.salePrice);return e>i&&i>0?`${i}`:`${e}`}static calculateCompareAtPrice(t){const e=parseFloat(t.mapPrice),i=parseFloat(t.price),r=parseFloat(t.salePrice);return e>i&&i>0?`${e}`:i>r&&r>0?`${i}`:""}static formatOptionsKeys(t){return t.optionValues.map((t=>t.id))}}var ku=xu,Pu=class extends xa{createVariant(t){return new ku(t)}createLookupByOption(t){const e={};return t.forEach((t=>{const i=this.createOptionKey(t.optionKeys);e[i]=t})),e}getVariant(t){const e=this.lookup[t];return A.nullOrUndefined(e)?new Ta({}):e}get firstVariant(){return A.empty(this.variants)?new Ta({}):this.variants[0]}get allVariantHasInventoryManager(){return!0}getVariantByOption(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];const e=this.createOptionKey(t),i=this.lookupByOption[e];return A.nullOrUndefined(i)?(this.logger.error("Cannot find a variant with option ids",t),new Ta({})):i}createOptionKey(t){return t.sort(((t,e)=>parseInt(t,10)-parseInt(e,10))).join("-")}get anyVariantAllowContinuePurchase(){return!1}},Du=class extends Ye{readData(t){return{id:this.formatProductId(t.id),handle:t.handle,title:t.title,options:[...t.options],variants:[...t.variants.edges],images:[...t.images.edges].map((t=>t.node?.url)).filter((t=>!A.empty(t))),tracksInventory:t.inventoryTracking,description:t.description,recommendation:[...t.recommendation]}}createOptionManager(t){return new Su(t)}createVariantManager(t){return new Pu(t)}featuredImageAtSize(t){return t}formatProductId(t){return`${t}`}};class Lu extends da{constructor(){super(arguments.length>0&&void 0!==arguments[0]?arguments[0]:{}),this.env=new d,this.couponTimer=-1,this.init()}init(){this.applyCouponPeriodically().then(),this.reappliedCoupon().then()}async applyCouponPeriodically(){this.couponTimer>0&&window.clearInterval(this.couponTimer),await this.applyWaitingCoupon()||(this.couponTimer=window.setInterval((async()=>{await this.applyWaitingCoupon()&&window.clearInterval(this.couponTimer)}),15e3))}async applyWaitingCoupon(){if(!Lu.hasCouponWaitingToApply())return!0;const t=Tn(),e=t.aCouponWaitingToApply,i=await Lu.getCartId();if(A.empty(i))return!1;const r=await this.applyCoupon(e);return r&&(t.clearCouponWaitingToApply(),t.appliedCoupon={coupon:e,cartId:i}),this.logger.log(`Coupon ${e} applied success? ${r}`),r}static hasCouponWaitingToApply(){const t=Tn().aCouponWaitingToApply;return!A.empty(t)}async reappliedCoupon(){if(!Lu.hasAppliedCoupon())return void this.logger.log("No applied coupon");const t=Tn(),{coupon:e}=t.appliedCoupon;if(await Lu.cartIdChangedForAppliedCoupon()){this.logger.log("Reapply coupon");const t=await this.applyCoupon(e);this.logger.log(`Success to reapply the coupon ${e}? ${t}`)}else this.logger.log("Cart ID remains the same. Coupon should have applied")}static hasAppliedCoupon(){const t=Tn(),{coupon:e}=t.appliedCoupon;return!A.empty(e)}static async getCartId(){const t=E(),e=await Eu.get("/api/storefront/carts");return A.empty(e)?"":(t.log(`Got cart id ${e[0].id}`),e[0].id)}static async cartIdChangedForAppliedCoupon(){const t=Tn(),{cartId:e}=t.appliedCoupon,i=await Lu.getCartId();return!A.empty(i)&&i!==e}async addToCart(t,e,i){let{redirectToCartPage:r=!1,onSuccess:n}=i;const a=await Lu.getCartId(),s={lineItems:[{quantity:1,productId:t.productId,optionSelections:e.map((t=>({optionId:parseInt(t.optionId,10),optionValue:parseInt(t.optionValueId,10)})))}]};let o;o=A.empty(a)?await this.createACart(s):await this.addCartLineItems(a,s),this.logger.log("Add to cart response: ",o),r?Lu.hasCouponWaitingToApply()?this.applyWaitingCoupon().then((()=>{Lu.gotoCartPage()})):Lu.hasAppliedCoupon()?this.reappliedCoupon().then((()=>{Lu.gotoCartPage()})):Lu.gotoCartPage():A.function(n)&&n()}async createACart(t){return this.logger.log("Create a cart"),Eu.post("/api/storefront/carts",{...t})}async addCartLineItems(t,e){return this.logger.log("Add item to existing cart"),Eu.post(`/api/storefront/carts/${t}/items`,{...e})}async applyCoupon(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(A.nullOrUndefined(t)||A.empty(t))return!1;const i=await Lu.getCartId();if(A.empty(i))return this.logger.warn("There is not cart id. Queue coupon."),Lu.queueCoupon(t),this.applyCouponPeriodically().then(),!0;const r=await Eu.post(`/api/storefront/checkouts/${i}/coupons`,{couponCode:t});return!A.nullOrUndefined(r?.cart?.coupons[0])&&(A.empty(e)||"/"===e||mn(`${window.location.hostname}/${e}`),!0)}static queueCoupon(t){Tn().aCouponWaitingToApply=t}createProduct(t){return new Du(t)}async requestProductData(t){const e=Fa(),i=await e.requestData(this.shopDomain,t);e.cacheData(i);const r=await Promise.all(t.map((async t=>({id:t,recommendation:await this.requestProductRecommendationData(t)}))));e.cacheData(r)}async requestProductRecommendationData(t){const e=`/api/recommend-products?product_id=${t}&shop_url=${this.shopDomain}`;return(await pn.get(e)).result.products}getThemeMaxSectionWidthClassName(t){return""}async getThemeName(){return Promise.resolve("")}async getOrder(){if(!A.nullOrUndefined(this.order))return this.order;const t=await Lu.getOrderId();if(A.empty(t))return this.logger.error("Cannot find an order id"),null;const e=await this.getOrderData(t);return A.nullOrUndefined(e)?(this.logger.error(`Cannot get order data from id: ${t}`),null):new Tu(e)}async getOrderData(t){const e=await Eu.get(`/api/storefront/orders/${t}`);return Lu.verifyOrderData(e)?e:(this.logger.error(`Cannot get data from id ${t}`),null)}static verifyOrderData(t){return!(A.nullOrUndefined(t)||A.nullOrUndefined(t.orderId)&&(this.logger.error("Got order data with an unexpected structure: ",t),1))}static async getOrderId(){const t=Lu.getOrderIdFromWindow();return A.empty(t)?Lu.getOrderIdFromElement():`${t}`}static getOrderIdFromWindow(){return E().log(`order id from window: ${window.htVimotia?.orderId}`),A.nullOrUndefined(window.htVimotia?.orderId)?"":window.htVimotia.orderId}static async getOrderIdFromElement(){const t=E();let e;if(!await Gt((()=>(e=document.querySelector('p[data-test="order-confirmation-order-number-text"]'),!A.nullOrUndefined(e))),200))return t.error("Cannot find element with order ID on page"),"";const i=e.textContent.match(/\d+/);return t.log("Potential matched ID: ",i),A.number(parseInt(i[0],10))?i[0]:(t.error("Cannot find a number in element: ",e),"")}get couponApplyingMessage(){return"Applying your coupon..."}static getPathname(t){if("/"===t)return"/";const e=t.split("/").filter((t=>t.length>0));return A.empty(e)?"":Lu.removeHTMLFileExtension(e.join("/"))}static removeHTMLFileExtension(t){return t.split(".html")[0]}get initialPlaybackParam(){const t=this.shopDomain,e=Lu.getPathname(window.location.pathname),i=!this.stateClient.isMobile;return this.logger.log(`shop: ${t}, handle: ${e}`),window.btoa(`${t}++${e}+${i}`)}get isHomepage(){return"/"===window.location.pathname}get isProductPage(){return!this.isHomepage&&!this.isThankYouPage}get isThankYouPage(){return window.location.pathname.includes("checkout/order-confirmation")}get brandingLink(){return`https://www.bigcommerce.com/apps/vimotia-shoppable-videos/?${gn}`}get pageType(){return""}get productIdOnPage(){return""}get shopDomain(){const t=[...document.querySelectorAll('script[src*="vimotia"]')];if(A.empty(t))return this.logger.error("expect vimotia scripts on page but cannot find any"),"";const e=t.find((t=>{const e=new URL(t.src).searchParams.get("shop");return!A.empty(e)}));return A.nullOrUndefined(e)?(this.logger.error("expect vimotia script with shop param on page but cannot find any",t),""):new URL(e.src).searchParams.get("shop")}static gotoCartPage(){E().log("Go to cart page"),mn(`${window.location.hostname}/cart.php`)}get coreJsFileUri(){return d.isDevelopment()?"/video-core-bigc.dev.js":d.isStaging()?`${this.env.staticSrcBaseUrl}/js/video-core-bigc.staging.js`:`${this.env.staticSrcBaseUrl}/js/video-core-bigc.js`}}var Bu=Lu;const Ou="VimotiaPlatformClient";class Ru{static create(t,e){switch(t){case"shopify":return new Ra(e);case"bigcommerce":return new Bu(e);default:throw new Error(`Unknown platform: ${t}`)}}}function Mu(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};if(!A.empty(t)){const e=Ru.create(d.getPlatformEnvSetting(),t);return window[Ou]=e,e}let e=window[Ou];return A.nullOrUndefined(e)?(e=Ru.create(d.getPlatformEnvSetting(),t),window[Ou]=e,e):e}var Nu=i(9446),Fu=i.n(Nu);const Uu="vimotiaListenerPlayerContainerToggleClick",Vu="true",ju="vimotiapause";function Qu(t,e){if(!A.string(t))return;const i="cache",r=A.string(e);let n=!1;const a=()=>null!==document.getElementById(e),s=(t,e)=>{t.innerHTML=e,r&&a()||document.body.insertAdjacentElement("beforeend",t)};if(!r||!a()){const a=k.supported,o=document.createElement("div");if(o.setAttribute("hidden",""),r&&o.setAttribute("id",e),a){const t=window.localStorage.getItem(`${i}-${e}`);if(n=null!==t,n){const e=JSON.parse(t);s(o,e.content)}}(function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"text";return new Promise(((i,r)=>{try{const r=new XMLHttpRequest;if(!("withCredentials"in r))return;r.addEventListener("load",(()=>{if("text"===e)try{i(JSON.parse(r.responseText))}catch(t){i(r.responseText)}else i(r.response)})),r.addEventListener("error",(()=>{throw new Error(r.status)})),r.open("GET",t,!0),r.responseType=e,r.send()}catch(t){r(t)}}))})(t).then((t=>{A.empty(t)||(a&&window.localStorage.setItem(`${i}-${e}`,JSON.stringify({content:t})),s(o,t))})).catch((()=>{}))}}function Gu(t){return!!(A.array(t)||A.string(t)&&t.includes(":"))&&(A.array(t)?t:t.split(":")).map(Number).every(A.number)}function Hu(t){if(!A.array(t)||!t.every(A.number))return null;const[e,i]=t,r=(t,e)=>0===e?t:r(e,t%e),n=r(e,i);return[e/n,i/n]}function Wu(t){const e=t=>Gu(t)?t.split(":").map(Number):null;let i=e(t);if(null===i&&(i=e(this.config.ratio)),null===i&&!A.empty(this.embed)&&A.array(this.embed.ratio)&&({ratio:i}=this.embed),null===i&&this.isHTML5){const{videoWidth:t,videoHeight:e}=this.media;i=Hu([t,e])}return i}function zu(t){if(!this.isVideo)return{};const e=Wu.call(this,t),[i,r]=A.array(e)?e:[0,0],n=100/i*r;return this.elements.wrapper.style.paddingBottom=`${n}%`,this.isHTML5&&this.elements.wrapper.classList.toggle(this.config.classNames.videoFixedRatio,null!==e),{padding:n,ratio:e}}var Ku=i(3997),qu=i.n(Ku);const Yu={html5:"HTML5"},Ju={get(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(A.empty(t)||A.empty(e))return"";let i=(r=e.i18n,t.split(".").reduce(((t,e)=>t&&t[e]),r));var r;if(A.empty(i))return Object.keys(Yu).includes(t)?Yu[t]:"";const n={"{seektime}":e.seekTime,"{title}":e.title};return Object.entries(n).forEach((t=>{let[e,r]=t;i=T(i,e,r)})),i}};var Xu=Ju;const $u={"video/webm":"vp8, vorbis","video/mp4":"avc1.42E01E, mp4a.40.2","video/ogg":"theora"},Zu={video:"canPlayType"in document.createElement("video"),check(t,e,i){const r=M.isIPhone&&i&&Zu.playsinline,n=Zu[t]||"html5"!==e;return{api:n,ui:n&&Zu.rangeInput&&("video"!==t||!M.isIPhone||r)}},playsinline:"playsInline"in document.createElement("video"),mime(t){if(A.empty(t))return!1;const[e]=t.split("/");let i=t;if(!this.isHTML5||e!==this.type)return!1;Object.keys($u).includes(i)&&(i+=`; codecs="${$u[t]}"`);try{return Boolean(i&&this.media.canPlayType(i).replace(/no/,""))}catch(t){return!1}},rangeInput:(()=>{const t=document.createElement("input");return t.type="range","range"===t.type})(),touch:"ontouchstart"in document.documentElement,transitions:!1!==Wt,reducedMotion:"matchMedia"in window&&window.matchMedia("(prefers-reduced-motion)").matches};var th=Zu;const eh={getIconUrl(){const t=`${(new d).staticSrcBaseUrl}/${this.config.iconUrl}`;return{url:t,cors:new URL(t,window.location).host!==window.location.host||M.isIE&&!window.svg4everybody}},findElements(){try{return this.elements.controls=Ot.call(this,this.config.selector.controls.wrapper),this.elements.buttons={play:Bt.call(this,this.config.selectors.buttons.play),pause:Ot.call(this,this.config.selectors.buttons.pause),restart:Ot.call(this,this.config.selectors.buttons.restart),rewind:Ot.call(this,this.config.selectors.buttons.rewind),fastForward:Ot.call(this,this.config.selectors.buttons.fastForward),mute:Ot.call(this,this.config.selectors.buttons.mute),fullscreen:Ot.call(this,this.config.selectors.buttons.fullscreen)},this.elements.progress=Ot.call(this,this.config.selectors.progress),this.elements.inputs={seek:Ot.call(this,this.config.selectors.inputs.seek),volume:Ot.call(this,this.config.selectors.inputs.volume)},this.elements.display={buffer:Ot.call(this,this.config.selectors.display.buffer),currentTime:Ot.call(this,this.config.selectors.display.currentTime),duration:Ot.call(this,this.config.selectors.display.duration)},A.element(this.elements.progress)&&(this.elements.display.seekTooltip=this.elements.progress.querySelector(`.${this.config.classNames.tooltip}`)),!0}catch(t){return this.debug.warn("It looks like there is a problem with your custom controls HTML",t),this.toggleNativeControls(!0),!1}},createIcon(t,e){const i="http://www.w3.org/2000/svg",r=eh.getIconUrl.call(this),n=`${r.cors?"":r.url}#${this.config.iconPrefix}`,a=document.createElementNS(i,"svg");Ct(a,S(e,{role:"presentation",focusable:"false"}));const s=document.createElementNS(i,"use"),o=`${n}-${t}`;return"href"in s&&s.setAttributeNS("http://www.w3.org/1999/xlink","href",o),s.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",o),a.appendChild(s),a},createLabel(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=Xu.get(t,this.config);return Tt("span",{...e,class:[e.class,this.config.classNames.hidden].filter(Boolean).join(" ")},i)},createButton(t,e){const i=S({},e);let r=function(){let t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString();return t=function(){let t=(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString();return t=T(t,"-"," "),t=T(t,"_"," "),t=function(){return(arguments.length>0&&void 0!==arguments[0]?arguments[0]:"").toString().replace(/\w\S*/g,(t=>t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()))}(t),T(t," ","")}(t),t.charAt(0).toLowerCase()+t.slice(1)}(t);const n={element:"button",toggle:!1,label:null,icon:null,labelPressed:null,iconPressed:null};switch(["element","icon","label"].forEach((t=>{Object.keys(i).includes(t)&&(n[t]=i[t],delete i[t])})),"button"!==n.element||Object.keys(i).includes("type")||(i.type="button"),Object.keys(i).includes("class")?i.class.split(" ").some((t=>t===this.config.classNames.control))||S(i,{class:`${i.class} ${this.config.classNames.control}`}):i.class=this.config.classNames.control,t){case"play":n.toggle=!0,n.label="play",n.labelPressed="pause",n.icon="play",n.iconPressed="pause";break;case"mute":n.toggle=!0,n.label="mute",n.labelPressed="unmute",n.icon="volume",n.iconPressed="muted";break;case"fullscreen":n.toggle=!0,n.label="enterFullscreen",n.labelPressed="exitFullscreen",n.icon="enter-fullscreen",n.iconPressed="exit-fullscreen";break;case"play-large":i.class+=` ${this.config.classNames.control}--overlaid`,r="play",n.label="play",n.icon="play";break;default:A.empty(n.label)&&(n.label=r),A.empty(n.icon)&&(n.icon=t)}const a=Tt(n.element);return n.toggle?(a.appendChild(eh.createIcon.call(this,n.iconPressed,{class:"icon--pressed"})),a.appendChild(eh.createIcon.call(this,n.icon,{class:"icon--not-pressed"})),a.appendChild(eh.createLabel.call(this,n.labelPressed,{class:"label--pressed"})),a.appendChild(eh.createLabel.call(this,n.label,{class:"label--not-pressed"}))):(a.appendChild(eh.createIcon.call(this,n.icon)),a.appendChild(eh.createLabel.call(this,n.label))),S(i,xt(this.config.selectors.buttons[r],i)),Ct(a,i),"play"===r?(A.array(this.elements.buttons[r])||(this.elements.buttons[r]=[]),this.elements.buttons[r].push(a)):this.elements.buttons[r]=a,a},createRange(t,e){const i=Tt("input",S(xt(this.config.selectors.inputs[t]),{type:"range",min:0,max:100,step:.01,value:0,autocomplete:"off",role:"slider","aria-label":Xu.get(t,this.config),"aria-valuemin":0,"aria-valuemax":100,"aria-valuenow":0},e));return this.elements.inputs[t]=i,eh.updateRangeFill.call(this,i),qu().setup(i),i},createProgress(t,e){const i=Tt("progress",S(xt(this.config.selectors.display[t]),{min:0,max:100,value:0,role:"progressbar","aria-hidden":!0},e));if("volume"!==t){i.appendChild(Tt("span",null,"0"));const e={played:"played",buffer:"buffered"}[t],r=e?Xu.get(e,this.config):"";i.innerText=`% ${r.toLowerCase()}`}return this.elements.display[t]=i,i},createTime(t,e){const i=xt(this.config.selectors.display[t],e),r=Tt("div",S(i,{class:`${i.class?i.class:""} ${this.config.classNames.display.time} `.trim(),"aria-label":Xu.get(t,this.config)}),"00:00");return this.elements.display[t]=r,r},bindMenuItemShortcuts(t,e){vt(t,"keydown keyup",(i=>{if(![32,38,39,40].includes(i.which))return;if(i.preventDefault(),i.stopPropagation(),"keydown"===i.type)return;const r=Lt(t,'[role="menuitemradio"]');if(!r&&[32,39].includes(i.which))eh.showMenuPanel.call(this,e,!0);else{let e;32!==i.which&&(40===i.which||r&&39===i.which?(e=t.nextElementSibling,A.element(e)||(e=t.parentNode.firstElementChild)):(e=t.previousElementSibling,A.element(e)||(e=t.parentNode.lastElementChild)),Mt.call(this,e,!0))}}),!1),vt(t,"keyup",(t=>{13===t.which&&eh.focusFirstMenuItem.call(this,null,!0)}))},formatTime(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return A.number(t)?jt(t,Vt(this.duration)>0,e):t},updateTimeDisplay(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]&&arguments[2];A.element(t)&&A.number(e)&&(t.innerText=eh.formatTime(e,i))},updateVolume(){this.supported.ui&&(A.element(this.elements.inputs.volume)&&eh.setRange.call(this,this.elements.inputs.volume,this.muted?0:this.volume),A.element(this.elements.buttons.mute)&&(this.elements.buttons.mute.pressed=this.muted||0===this.volume))},setRange(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;A.element(t)&&(t.value=e,eh.updateRangeFill.call(this,t))},updateProgress(t){if(!this.supported.ui||!A.event(t))return;let e=0;const i=(t,e)=>{const i=A.number(e)?e:0,r=A.element(t)?t:this.elements.display.buffer;if(A.element(r)){r.value=i;const t=r.getElementsByTagName("span")[0];A.element(t)&&(t.childNodes[0].nodeValue=i)}};if(t)switch(t.type){case"timeupdate":case"seeking":case"seeked":r=this.currentTime,n=this.duration,e=0===r||0===n||Number.isNaN(r)||Number.isNaN(n)?0:(r/n*100).toFixed(2),"timeupdate"===t.type&&eh.setRange.call(this,this.elements.inputs.seek,e);break;case"playing":case"progress":i(this.elements.display.buffer,100*this.buffered)}var r,n},updateRangeFill(t){const e=A.event(t)?t.target:t;if(A.element(e)&&"range"===e.getAttribute("type")){if(Lt(e,this.config.selectors.inputs.seek)){e.setAttribute("aria-valuenow",this.currentTime);const t=eh.formatTime(this.currentTime),i=eh.formatTime(this.duration),r=Xu.get("seekLabel",this.config);e.setAttribute("aria-valuetext",r.replace("{currentTime}",t).replace("{duration}",i))}else if(Lt(e,this.config.selectors.inputs.volume)){const t=100*e.value;e.setAttribute("aria-valuenow",t),e.setAttribute("aria-valuetext",`${t.toFixed(1)}%`)}else e.setAttribute("aria-valuenow",e.value);M.isWebkit&&e.style.setProperty("--value",e.value/e.max*100+"%")}},updateSeekTooltip(t){if(!this.config.tooltips.seek||!A.element(this.elements.inputs.seek)||!A.element(this.elements.display.seekTooltip)||0===this.duration)return;const e=`${this.config.classNames.tooltip}--visible`,i=t=>Pt(this.elements.display.seekTooltip,e,t);if(this.touch)return void i(!1);let r=0;const n=this.elements.progress.getBoundingClientRect();if(A.event(t))r=100/n.width*(t.pageX-n.left);else{if(!Dt(this.elements.display.seekTooltip,e))return;r=parseFloat(this.elements.display.seekTooltip.style.left,10)}r<0?r=0:r>100&&(r=100),eh.updateTimeDisplay.call(this,this.elements.display.seekTooltip,this.duration/100*r),this.elements.display.seekTooltip.style.left=`${r}%`,A.event(t)&&["mouseenter","mouseleave"].includes(t.type)&&i("mouseenter"===t.type)},timeUpdate(t){const e=!A.element(this.elements.display.duration)&&this.config.invertTime;eh.updateTimeDisplay.call(this,this.elements.display.currentTime,e?this.duration-this.currentTime:this.currentTime,e),t&&"timeupdate"===t.type&&this.media.seeking||eh.updateProgress.call(this,t)},durationUpdate(){if(!this.supported.ui||!this.config.invertTime&&this.currentTime)return;if(this.duration>=2**32)return kt(this.elements.display.currentTime,!0),void kt(this.elements.progress,!0);A.element(this.elements.inputs.seek)&&this.elements.inputs.seek.setAttribute("aria-valuemax",this.duration);const t=A.element(this.elements.display.duration);!t&&this.config.displayDuration&&this.paused&&eh.updateTimeDisplay.call(this,this.elements.display.currentTime,this.duration),t&&eh.updateTimeDisplay.call(this,this.elements.display.duration,this.duration),eh.updateSeekTooltip.call(this)},focusFirstMenuItem(t){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(this.elements.settings.popup.hidden)return;let i=t;A.element(i)||(i=Object.values(this.elements.settings.panels).find((t=>!t.hidden)));const r=i.querySelector('[role^="menuitem"]');Mt.call(this,r,e)},toggleMenu(t){const{popup:e}=this.elements.settings,i=this.elements.buttons.settings;if(!A.element(e)||!A.element(i))return;const{hidden:r}=e;let n=r;if(A.boolean(t))n=t;else if(A.keyboardEvent(t)&&27===t.which)n=!1;else if(A.event(t)){const r=A.function(t.composedPath)?t.composedPath()[0]:t.target,a=e.contains(r);if(a||!a&&t.target!==i&&n)return}i.setAttribute("aria-expanded",n),kt(e,!n),Pt(this.elements.container,this.config.classNames.menu.open,n),n&&A.keyboardEvent(t)?eh.focusFirstMenuItem.call(this,null,!0):n||r||Mt.call(this,i,A.keyboardEvent(t))},getMenuSize(t){const e=t.cloneNode(!0);e.style.playButtonPosition="absolute",e.style.opacity=0,e.removeAttribute("hidden"),t.parentNode.appendChild(e);const i=e.scrollWidth,r=e.scrollHeight;return It(e),{width:i,height:r}},showMenuPanel(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const i=this.elements.container.querySelector(`#vimotia-settings-${this.id}-${t}`);if(!A.element(i))return;const r=i.parentNode,n=Array.from(r.children).find((t=>!t.hidden));if(th.transitions&&!th.reducedMotion){r.style.width=`${n.scrollWidth}px`,r.style.height=`${n.scrollHeight}px`;const t=eh.getMenuSize.call(this,i),e=t=>{t.target===r&&["width","height"].includes(t.propertyName)&&(r.style.width="",r.style.height="",yt.call(this,r,Wt,e))};vt.call(this,r,Wt,e),r.style.width=`${t.width}px`,r.style.height=`${t.height}px`}kt(n,!0),kt(i,!1),eh.focusFirstMenuItem.call(this,i,e)},create(t){const{bindMenuItemShortcuts:e,createButton:i,createProgress:r,createRange:n,createTime:a,showMenuPanel:s}=eh;this.elements.controls=null,this.config.controls.includes("play-large")&&this.elements.container.appendChild(i.call(this,"play-large"));const o=Tt("div",xt(this.config.selectors.controls.wrapper));this.elements.controls=o;const l={class:"vimotia__controls__item"};var c;return(c=this.config.controls,A.array(c)?c.filter(((t,e)=>c.indexOf(t)===e)):c).forEach((c=>{if("restart"===c&&o.appendChild(i.call(this,"restart",l)),"rewind"===c&&o.appendChild(i.call(this,"rewind",l)),"play"===c&&o.appendChild(i.call(this,"play",l)),"fast-forward"===c&&o.appendChild(i.call(this,"fast-forward",l)),"progress"===c){const e=Tt("div",{class:`${l.class} vimotia__progress__container`}),i=Tt("div",xt(this.config.selectors.progress));if(i.appendChild(n.call(this,"seek",{id:`vimotia-seek-${t.id}`})),i.appendChild(r.call(this,"buffer")),this.config.tooltips.seek){const t=Tt("span",{class:this.config.classNames.tooltip},"00:00");i.appendChild(t),this.elements.display.seekTooltip=t}this.elements.progress=i,e.appendChild(this.elements.progress),o.appendChild(e)}if("current-time"===c&&o.appendChild(a.call(this,"currentTime",l)),"duration"===c&&o.appendChild(a.call(this,"duration",l)),"mute"===c||"volume"===c){let{volume:e}=this.elements;if(A.element(e)&&o.contains(e)||(e=Tt("div",S({},l,{class:`${l.class} vimotia__volume`.trim()})),this.elements.volume=e,o.appendChild(e)),"mute"===c&&e.appendChild(i.call(this,"mute")),"volume"===c){const i={max:1,step:.05,value:this.config.volume};e.appendChild(n.call(this,"volume",S(i,{id:`vimotia-volume-${t.id}`})))}}if("settings"===c&&!A.empty(this.config.settings)){const r=Tt("div",S({},l,{class:`${l.class} vimotia__menu`.trim(),hidden:""}));r.appendChild(i.call(this,"settings",{"aria-haspopup":!0,"aria-controls":`vimotia-settings-${t.id}`,"aria-expanded":!1}));const n=Tt("div",{class:"vimotia__menu__container",id:`vimotia-settings-${t.id}`,hidden:""}),a=Tt("div"),c=Tt("div",{id:`vimotia-settings-${t.id}-home`}),d=Tt("div",{role:"menu"});c.appendChild(d),a.appendChild(c),this.elements.settings.panels.home=c,this.config.settings.forEach((i=>{const r=Tt("button",S(xt(this.config.selectors.buttons.settings),{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--forward`,role:"menuitem","aria-haspopup":!0,hidden:""}));e.call(this,r,i),vt(r,"click",(()=>{s.call(this,i,!1)}));const n=Tt("span",null,Xu.get(i,this.config)),o=Tt("span",{class:this.config.classNames.menu.value});o.innerHTML=t[i],n.appendChild(o),r.appendChild(n),d.appendChild(r);const l=Tt("div",{id:`vimotia-settings-${t.id}-${i}`,hidden:""}),c=Tt("button",{type:"button",class:`${this.config.classNames.control} ${this.config.classNames.control}--back`});c.appendChild(Tt("span",{"aria-hidden":!0},Xu.get(i,this.config))),c.appendChild(Tt("span",{class:this.config.classNames.hidden},Xu.get("menuBack",this.config))),vt(l,"keydown",(t=>{37===t.which&&(t.preventDefault(),t.stopPropagation(),s.call(this,"home",!0))}),!1),vt(c,"click",(()=>{s.call(this,"home",!1)})),l.appendChild(c),l.appendChild(Tt("div",{role:"menu"})),a.appendChild(l),this.elements.settings.buttons[i]=r,this.elements.settings.panels[i]=l})),n.appendChild(a),r.appendChild(n),o.appendChild(r),this.elements.settings.popup=n,this.elements.settings.menu=r}"fullscreen"===c&&o.appendChild(i.call(this,"fullscreen",l))})),o},inject(){if(this.config.loadSprite){const t=eh.getIconUrl.call(this);t.cors&&Qu(t.url,"sprite-vimotia")}this.id=this.config.player.player_id||Math.floor(1e4*Math.random());let t=null;this.elements.controls=null;const e={id:this.id,seektime:this.config.seekTime,title:this.config.title};let i=!0;A.function(this.config.controls)&&(this.config.controls=this.config.controls.call(this,e)),this.config.controls||(this.config.controls=[]),A.element(this.config.controls)||A.string(this.config.controls)?t=this.config.controls:(t=eh.create.call(this,{id:this.id,seektime:this.config.seekTime}),i=!1);const r=t=>{let i=t;return Object.entries(e).forEach((t=>{let[e,r]=t;i=T(i,`{${e}}`,r)})),i};let n;if(i&&(A.string(this.config.controls)?t=r(t):A.element(t)&&(t.innerHTML=r(t.innerHTML))),A.string(this.config.selectors.controls.container)&&(n=document.querySelector(this.config.selectors.controls.container)),A.element(n)||(n=this.elements.container),n[A.element(t)?"insertAdjacentElement":"insertAdjacentHTML"]("afterbegin",t),A.element(this.elements.controls)||eh.findElements.call(this),!A.empty(this.elements.buttons)){const t=t=>{const e=this.config.classNames.controlPressed;Object.defineProperty(t,"pressed",{enumerable:!0,get(){return Dt(t,e)},set(){Pt(t,e,arguments.length>0&&void 0!==arguments[0]&&arguments[0])}})};Object.values(this.elements.buttons).filter(Boolean).forEach((e=>{A.array(e)||A.nodeList(e)?Array.from(e).filter(Boolean).forEach(t):t(e)}))}if(M.isEdge&&zt(n),this.config.tooltips.controls){const{classNames:t,selectors:e}=this.config,i=`${e.controls.wrapper} ${e.labels} .${t.hidden}`,r=Bt.call(this,i);Array.from(r).forEach((t=>{Pt(t,this.config.classNames.hidden,!1),Pt(t,this.config.classNames.tooltip,!0)}))}}};var ih=eh;function rh(){if(!this.enabled)return;const t=this.player.elements.buttons.fullscreen;A.element(t)&&(t.pressed=this.active),bt.call(this.player,this.target,this.active?"enterfullscreen":"exitfullscreen",!0),M.isIos||Rt.call(this.player,this.target,this.active)}function nh(){let t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(t?this.scrollPosition={x:window.scrollX||0,y:window.scrollY||0}:window.scrollTo(this.scrollPosition.x,this.scrollPosition.y),document.body.style.overflow=t?"hidden":"",Pt(this.target,this.player.config.classNames.fullscreen.fallback,t),M.isIos){let e=document.head.querySelector('meta[name="viewport"]');const i="viewport-fit=cover";e||(e=document.createElement("meta"),e.setAttribute("name","viewport"));const r=A.string(e.content)&&e.content.includes(i);t?(this.cleanupViewport=!r,r||(e.content+=`,${i}`)):this.cleanupViewport&&(e.content=e.content.split(",").filter((t=>t.trim()!==i)).join(","))}rh.call(this)}class ah{constructor(t){this.logger=E(),this.player=t,this.prefix=ah.prefix,this.property=ah.property,this.scrollPosition={x:0,y:0},this.forceFallback="force"===t.config.fullscreen.fallback,vt.call(this.player,document,"ms"===this.prefix?"MSFullscreenChange":`${this.prefix}fullscreenchange`,(()=>{rh.call(this)})),vt.call(this.player,this.player.elements.container,"dblclick",(t=>{A.element(this.player.elements.controls)&&this.player.elements.controls.contains(t.target)||this.toggle()})),this.update()}static get native(){return!!(document.fullscreenEnabled||document.webkitFullscreenEnabled||document.mozFullScreenEnabled||document.msFullscreenEnabled)}get usingNative(){return ah.native&&!this.forceFallback}static get prefix(){if(A.function(document.exitFullscreen))return"";let t="";return["webkit","moz","ms"].some((e=>!(!A.function(document[`${e}ExitFullscreen`])&&!A.function(document[`${e}CancelFullScreen`])||(t=e,0)))),t}static get property(){return"moz"===this.prefix?"FullScreen":"Fullscreen"}get enabled(){return(ah.native||this.player.config.fullscreen.fallback)&&this.player.config.fullscreen.enabled&&this.player.supported.ui&&this.player.isVideo}get active(){return!!this.enabled&&(!ah.native||this.forceFallback?Dt(this.target,this.player.config.classNames.fullscreen.fallback):(this.prefix?document[`${this.prefix}${this.property}Element`]:document.fullscreenElement)===this.target)}get target(){return M.isIos&&this.player.config.fullscreen.iosNative?this.player.media:this.player.elements.container}update(){this.enabled||this.logger.log("Fullscreen not supported and fallback disabled"),Pt(this.player.elements.container,this.player.config.classNames.fullscreen.enabled,this.enabled)}enter(){this.enabled&&(M.isIos&&this.player.config.fullscreen.iosNative?this.target.webkitEnterFullscreen():!ah.native||this.forceFallback?nh.call(this,!0):this.prefix?A.empty(this.prefix)||this.target[`${this.prefix}Request${this.property}`]():this.target.requestFullscreen())}exit(){if(this.enabled)if(M.isIos&&this.player.config.fullscreen.iosNative)this.target.webkitExitFullscreen(),this.player.play();else if(!ah.native||this.forceFallback)nh.call(this,!1);else if(this.prefix){if(!A.empty(this.prefix)){const t="moz"===this.prefix?"Cancel":"Exit";document[`${this.prefix}${t}${this.property}`]()}}else(document.cancelFullScreen||document.exitFullscreen).call(document)}toggle(){this.active?this.exit():this.enter()}}var sh=ah;const oh={addStyleHook(){Pt(this.elements.container,this.config.selectors.container.replace(".",""),!0),Pt(this.elements.container,this.config.classNames.uiSupported,this.supported.ui)},toggleNativeControls(){arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&this.isHTML5?this.media.setAttribute("controls",""):this.media.removeAttribute("controls")},build(){if(this.listeners.media(),!this.supported.ui)return this.debug.warn(`Basic support only for ${this.provider} ${this.type}`),void oh.toggleNativeControls.call(this,!0);A.element(this.elements.controls)||setTimeout((()=>{ih.inject.call(this),this.listeners.controls()}),0),oh.toggleNativeControls.call(this),this.volume=null,this.muted=null,ih.updateVolume.call(this),ih.timeUpdate.call(this),oh.checkPlaying.call(this),Pt(this.elements.container,this.config.classNames.isIos,M.isIos),Pt(this.elements.container,this.config.classNames.isTouch,this.touch),this.ready=!0,setTimeout((()=>{bt.call(this,this.media,"ready")}),0),oh.setTitle.call(this),this.poster&&oh.setPoster.call(this,this.poster,!1).catch((()=>{})),this.config.duration&&ih.durationUpdate.call(this)},setTitle(){let t=Xu.get("play",this.config);A.string(this.config.title)&&!A.empty(this.config.title)&&(t+=`, ${this.config.title}`),Array.from(this.elements.buttons.play||[]).forEach((e=>{e.setAttribute("aria-label",t)}))},togglePoster(t){Pt(this.elements.container,this.config.classNames.posterEnabled,t)},setPoster(t){return arguments.length>1&&void 0!==arguments[1]&&!arguments[1]||!this.poster?(this.media.setAttribute("poster",t),wt.call(this).then((()=>function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return new Promise(((i,r)=>{const n=new Image,a=()=>{delete n.onload,delete n.onerror,(n.naturalWidth>=e?i:r)(n)};Object.assign(n,{onload:a,onerror:a,src:t})}))}(t))).catch((e=>{throw t===this.poster&&oh.togglePoster.call(this,!1),e})).then((()=>{if(t!==this.poster)throw new Error("setPoster cancelled by later call to setPoster")})).then((()=>(Object.assign(this.elements.poster.style,{backgroundImage:`url('${t}')`,backgroundSize:""}),oh.togglePoster.call(this,!0),t)))):Promise.reject(new Error("Poster already set"))},checkPlaying(t){Pt(this.elements.container,this.config.classNames.playing,this.playing),Pt(this.elements.container,this.config.classNames.paused,this.paused),Pt(this.elements.container,this.config.classNames.stopped,this.stopped),Array.from(this.elements.buttons.play||[]).forEach((t=>{Object.assign(t,{pressed:this.playing})})),A.event(t)&&"timeupdate"===t.type||oh.toggleControls.call(this)},checkLoading(t){this.loading=["stalled","waiting"].includes(t.type),clearTimeout(this.timers.loading),this.timers.loading=setTimeout((()=>{Pt(this.elements.container,this.config.classNames.loading,this.loading),oh.toggleControls.call(this)}),this.loading?250:0)},toggleControls(t){const{controls:e}=this.elements;if(e&&this.config.hideControls){const i=this.touch&&this.lastSeekTime+2e3>Date.now();this.togglePlayerControls(Boolean(t||this.loading||this.paused||e.pressed||e.hover||i))}}};var lh=oh,ch=class{constructor(t){this.player=t,this.lastKey=null,this.focusTimer=null,this.lastKeyDown=null,this.handleKey=this.handleKey.bind(this),this.toggleMenu=this.toggleMenu.bind(this),this.setTabFocus=this.setTabFocus.bind(this),this.firstTouch=this.firstTouch.bind(this)}handleKey(t){const{player:e}=this,{elements:i}=e,r=t.keyCode,n="keydown"===t.type,a=n&&r===this.lastKey;if(!(t.altKey||t.ctrlKey||t.metaKey||t.shiftKey)&&A.number(r))if(n){const n=document.activeElement;if(A.element(n)){const{editable:r}=e.config.selectors,{seek:a}=i.inputs;if(n!==a&&Lt(n,r))return;if(32===t.keyCode&&Lt(n,'button, [role^="menuitem"]'))return}switch([32,37,38,39,40,48,49,50,51,52,53,54,56,57,67,70,73,75,76,77,79].includes(r)&&(t.preventDefault(),t.stopPropagation()),r){case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:a||(e.currentTime=e.duration/10*(r-48));break;case 32:case 75:a||e.togglePlay();break;case 38:e.increaseVolume(.1);break;case 40:e.decreaseVolume(.1);break;case 77:a||(e.muted=!e.muted);break;case 39:e.forward();break;case 37:e.rewind();break;case 70:e.fullscreen.toggle()}27===r&&!e.fullscreen.usingNative&&e.fullscreen.active&&e.fullscreen.toggle(),this.lastKey=r}else this.lastKey=null}toggleMenu(t){ih.toggleMenu.call(this.player,t)}firstTouch(){const{player:t}=this,{elements:e}=t;t.touch=!0,Pt(e.container,t.config.classNames.isTouch,!0)}setTabFocus(t){const{player:e}=this,{elements:i}=e;if(clearTimeout(this.focusTimer),"keydown"===t.type&&9!==t.keyCode)return;"keydown"===t.type&&(this.lastKeyDown=t.timeStamp);const r=t.timeStamp-this.lastKeyDown<=20;("focus"!==t.type||r)&&((()=>{const t=e.config.classNames.tabFocus;Pt(Bt.call(e,`.${t}`),t,!1)})(),this.focusTimer=setTimeout((()=>{const t=document.activeElement;i.container.contains(t)&&Pt(document.activeElement,e.config.classNames.tabFocus,!0)}),10))}global(){let t=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];const{player:e}=this;e.config.keyboard.global&&mt.call(e,window,"keydown keyup",this.handleKey,t,!1),mt.call(e,document.body,"click",this.toggleMenu,t),At.call(e,document.body,"touchstart",this.firstTouch),mt.call(e,document.body,"keydown focus blur",this.setTabFocus,t,!1,!0),vt.call(e,window,"beforeunload, pagehide",(()=>{e.playing&&!A.nullOrUndefined(e.analytics)&&e.analytics.postEnd(e.currentTime)}))}container(){const{player:t}=this,{config:e,elements:i,timers:r}=t;!e.keyboard.global&&e.keyboard.focused&&vt.call(t,i.container,"keydown keyup",this.handleKey,!1),vt.call(t,i.container,"mousemove mouseleave touchstart touchmove enterfullscreen exitfullscreen",(e=>{const{controls:n}=i;n&&"enterfullscreen"===e.type&&(n.pressed=!1,n.hover=!1);let a=0;["touchstart","touchmove","mousemove"].includes(e.type)&&(lh.toggleControls.call(t,!0),a=t.touch?3e3:2e3),clearTimeout(r.controls),r.controls=setTimeout((()=>lh.toggleControls.call(t,!1)),a)}));const n=e=>{if(!e)return zu.call(t);const r=i.container.getBoundingClientRect(),{width:n,height:a}=r;return zu.call(t,`${n}:${a}`)},a=()=>{clearTimeout(r.resized),r.resized=setTimeout(n,50)};vt.call(t,i.container,"enterfullscreen exitfullscreen",(e=>{const{target:r,usingNative:n}=t.fullscreen;if(r!==i.container)return;if(A.empty(t.config.ratio))return;const s="enterfullscreen"===e.type;n||(s?vt.call(t,window,"resize",a):yt.call(t,window,"resize",a))}))}media(){const{player:t}=this,{elements:e}=t;if(vt.call(t,t.media,"timeupdate seeking seeked",(e=>ih.timeUpdate.call(t,e))),vt.call(t,t.media,"durationchange loadeddata loadedmetadata",(e=>ih.durationUpdate.call(t,e))),vt.call(t,t.media,"ended",(()=>{t.isHTML5&&t.isVideo&&(t.currentMediaId===t.mediaById.length-1?(A.nullOrUndefined(t.analytics)||t.analytics.postEnd(t.duration),t.config.loop?t.restart():t.stop()):t.playNextAvailableTrack())})),vt.call(t,t.media,"progress playing seeking seeked",(e=>ih.updateProgress.call(t,e))),vt.call(t,t.media,"playing play pause ended emptied timeupdate",(e=>lh.checkPlaying.call(t,e))),vt.call(t,t.media,"waiting canplay seeked playing",(e=>lh.checkLoading.call(t,e))),t.supported.ui){const i=Ot.call(t,`.${t.config.classNames.video}`);if(!A.element(i))return;const r=e.container.dataset[Uu];A.nullOrUndefined(r)&&(e.container.dataset[Uu]=Vu,vt.call(t,e.container,"click",(r=>{([e.container,i,e.widgetList.container].includes(r.target)||i.contains(r.target))&&(t.touch&&t.config.hideControls||(t.config.clickToPlay&&(t.ended?(this.proxy(r,t.restart,"restart"),this.proxy(r,t.play,"play")):this.proxy(r,t.togglePlay,"play")),t.config.clickToToggleWidgets&&t.togglePlayerControls()))})))}vt.call(t,e.container,"click touchend",(e=>{if((!("ontouchstart"in document.documentElement)||"click"!==e.type)&&e.target.classList.contains(t.config.classNames.brandingElem.linkHandler)){t.play&&t.pause();const e=Mu();window.open(e.brandingLink,"_blank")}})),t.supported.ui&&t.config.disableContextMenu&&vt.call(t,e.wrapper,"contextmenu",(t=>{t.preventDefault()}),!1),vt.call(t,t.media,"volumechange",(()=>{t.storage.set({volume:t.volume,muted:t.muted})}));const i=t.config.events.concat(["keyup","keydown"]).join(" ");vt.call(t,t.media,i,(i=>{let{detail:r={}}=i;"error"===i.type&&(r=t.media.error),bt.call(t,e.container,i.type,!0,r)})),vt.call(t,t.media,"timeupdate ended play",(e=>{bt(t.mediaWrapper,be,!0,{currentTime:t.currentTime}),bt(t.mediaWrapper,_e,!0,{type:e.type,currentTime:t.currentTime})})),Ct(t.media,{[t.config.listenerAttributes.media]:"true"})}proxy(t,e,i){const{player:r}=this,n=r.config.listeners[i];let a=!0;A.function(n)&&(a=n.call(r,t)),a&&A.function(e)&&e.call(r,t)}bind(t,e,i,r){let n=!(arguments.length>4&&void 0!==arguments[4])||arguments[4];const{player:a}=this,s=a.config.listeners[r],o=A.function(s);vt.call(a,t,e,(t=>this.proxy(t,i,r)),n&&!o)}controls(){const{player:t}=this,{elements:e}=t,i=M.isIE?"change":"input";if(e.buttons.play&&Array.from(e.buttons.play).forEach((e=>{this.bind(e,"click",t.togglePlay,"play")})),this.bind(e.buttons.restart,"click",t.restart,"restart"),this.bind(e.buttons.rewind,"click",t.rewind,"rewind"),this.bind(e.buttons.fastForward,"click",t.forward,"fastForward"),this.bind(e.buttons.mute,"click",(()=>{t.muted=!t.muted,ih.updateVolume.call(t)}),"mute"),this.bind(e.buttons.fullscreen,"click",(()=>{t.fullscreen.toggle()}),"fullscreen"),this.bind(e.buttons.settings,"click",(e=>{e.stopPropagation(),ih.toggleMenu.call(t,e)})),this.bind(e.buttons.settings,"keyup",(e=>{const i=e.keyCode;[13,32].includes(i)&&(13!==i?(e.preventDefault(),e.stopPropagation(),ih.toggleMenu.call(t,e)):ih.focusFirstMenuItem.call(t,null,!0))}),null,!1),this.bind(e.settings.menu,"keydown",(e=>{27===e.keyCode&&ih.toggleMenu.call(t,e)})),this.bind(e.inputs.seek,"mousedown mousemove",(t=>{const i=e.progress.getBoundingClientRect(),r=100/i.width*(t.pageX-i.left);t.currentTarget.setAttribute("seek-value",r)})),this.bind(e.inputs.seek,"mousedown mouseup keydown keyup touchstart touchend",(e=>{const i=e.currentTarget,r=e.keyCode,n="play-on-seeked";if(A.keyboardEvent(e)&&39!==r&&37!==r)return;t.lastSeekTime=Date.now();const a=i.hasAttribute(n),s=["mouseup","touchend","keyup"].includes(e.type);a&&s?(i.removeAttribute(n),t.play()):!s&&t.playing&&(i.setAttribute(n,""),t.pause())})),M.isIos){const e=Bt.call(t,'input[type="range"]');Array.from(e).forEach((t=>this.bind(t,i,(t=>zt(t.target)))))}this.bind(e.inputs.seek,i,(e=>{const i=e.currentTarget;let r=i.getAttribute("seek-value");A.empty(r)&&(r=i.value),i.removeAttribute("seek-value"),t.currentTime=r/i.max*t.duration}),"seek"),this.bind(e.progress,"mouseenter mouseleave mousemove",(e=>ih.updateSeekTooltip.call(t,e))),this.bind(e.progress,"mousemove touchmove",(e=>{const{previewThumbnails:i}=t;i&&i.loaded&&i.startMove(e)})),this.bind(e.progress,"mouseleave click",(()=>{const{previewThumbnails:e}=t;e&&e.loaded&&e.endMove(!1,!0)})),this.bind(e.progress,"mousedown touchstart",(e=>{const{previewThumbnails:i}=t;i&&i.loaded&&i.startScrubbing(e)})),this.bind(e.progress,"mouseup touchend",(e=>{const{previewThumbnails:i}=t;i&&i.loaded&&i.endScrubbing(e)})),M.isWebkit&&Array.from(Bt.call(t,'input[type="range"]')).forEach((e=>{this.bind(e,"input",(e=>ih.updateRangeFill.call(t,e.target)))})),t.config.toggleInvert&&!A.element(e.display.duration)&&this.bind(e.display.currentTime,"click",(()=>{0!==t.currentTime&&(t.config.invertTime=!t.config.invertTime,ih.timeUpdate.call(t))})),this.bind(e.inputs.volume,i,(e=>{t.volume=e.target.value,0===t.volume?(t.volume=1,t.muted=!0):t.muted=!1,ih.updateVolume.call(t)}),"volume"),this.bind(e.controls,"mouseenter mouseleave",(i=>{e.controls.hover=!t.touch&&"mouseenter"===i.type})),this.bind(e.controls,"mousedown mouseup touchstart touchend touchcancel",(t=>{e.controls.pressed=["mousedown","touchstart"].includes(t.type)})),this.bind(e.controls,"focusin",(()=>{const{config:i,timers:r}=t;Pt(e.controls,i.classNames.noTransition,!0),lh.toggleControls.call(t,!0),setTimeout((()=>{Pt(e.controls,i.classNames.noTransition,!1)}),0);const n=this.touch?3e3:4e3;clearTimeout(r.controls),r.controls=setTimeout((()=>lh.toggleControls.call(t,!1)),n)})),this.bind(e.inputs.volume,"wheel",(e=>{const i=e.webkitDirectionInvertedFromDevice,[r,n]=[e.deltaX,-e.deltaY].map((t=>i?-t:t)),a=Math.sign(Math.abs(r)>Math.abs(n)?r:n);t.increaseVolume(a/50);const{volume:s}=t.media;(1===a&&s<1||-1===a&&s>0)&&e.preventDefault()}),"volume",!1)}};const dh={getSources(){return this.isHTML5?Array.from(this.media.querySelectorAll("source")).filter((t=>{const e=t.getAttribute("type");return!!A.empty(e)||th.mime.call(this,e)})):[]},extend(){if(!this.isHTML5)return;A.empty(this.config.ratio)||zu.call(this)},cancelRequests(){if(!this.isHTML5)return;It(dh.getSources.call(this));const t=new d;this.media.setAttribute("src",`${t.staticSrcBaseUrl}/${this.config.blankVideo}`),this.media.load(),this.debug.log("Cancelled network requests")}};var uh=dh,hh={setup(){this.media?(Pt(this.elements.container,this.config.classNames.type.replace("{0}",this.type),!0),Pt(this.elements.container,this.config.classNames.provider.replace("{0}",this.provider),!0),this.isHTML5&&uh.extend.call(this)):this.debug.warn("No media element found!")}},ph={accumulatedMediaDurationById:[],playerTheme:"#717171FF",player:{auto_start:!1,embeded_play:!1,id:-1,muted_play:!1},autoplay:!1,loop:!1,playsinline:!0,seekTime:10,volume:1,muted:!1,duration:null,displayDuration:!0,invertTime:!0,toggleInvert:!0,ratio:null,clickToPlay:!0,clickToToggleWidgets:!1,hideControls:!1,resetOnEnd:!1,disableContextMenu:!0,loadSprite:!0,iconPrefix:"vimotia",iconUrl:"img/frontend_player_icons/vimotia.svg",blankVideo:"video/frontend_player_blank.mp4",keyboard:{focused:!0,global:!1},tooltips:{controls:!1,seek:!0},fullscreen:{enabled:!1,fallback:!0,iosNative:!1},storage:{enabled:!0,keyPrefix:"vimotia",key:"vimotia"},controls:["play-large","progress","current-time"],i18n:{restart:"Restart",rewind:"Rewind {seektime}s",play:"Play",pause:"Pause",fastForward:"Forward {seektime}s",seek:"Seek",seekLabel:"{currentTime} of {duration}",played:"Played",buffered:"Buffered",currentTime:"Current time",duration:"Duration",volume:"Volume",mute:"Mute",unmute:"Unmute",enterFullscreen:"Enter fullscreen",exitFullscreen:"Exit fullscreen",frameTitle:"Player for {title}",menuBack:"Go back to previous menu",normal:"Normal",start:"Start",end:"End",all:"All",reset:"Reset",disabled:"Disabled",enabled:"Enabled"},listeners:{seek:null,play:null,pause:null,restart:null,rewind:null,fastForward:null,mute:null,volume:null,fullscreen:null},listenerAttributes:{media:"vimotiaMediaListener"},events:["ended","progress","stalled","playing","waiting","canplay","canplaythrough","loadstart","loadeddata","loadedmetadata","timeupdate","volumechange","play","pause","error","seeking","seeked","emptied","ratechange","cuechange","enterfullscreen","exitfullscreen","controlshidden","controlsshown","ready"],selectors:{editable:"input, textarea, select, [contenteditable]",container:".vimotia",controls:{container:null,wrapper:".vimotia__controls"},widgetList:{container:".vimotia__video-wrapper"},labels:"[data-vimotia]",buttons:{play:'[data-vimotia="play"]',pause:'[data-vimotia="pause"]',restart:'[data-vimotia="restart"]',rewind:'[data-vimotia="rewind"]',fastForward:'[data-vimotia="fast-forward"]',mute:'[data-vimotia="mute"]',fullscreen:'[data-vimotia="fullscreen"]'},inputs:{seek:'[data-vimotia="seek"]',volume:'[data-vimotia="volume"]'},display:{currentTime:".vimotia__time--current",duration:".vimotia__time--duration",buffer:".vimotia__progress__buffer",volume:".vimotia__volume--display"},progress:".vimotia__progress"},classNames:{type:"vimotia--{0}",provider:"vimotia--{0}",vertical:"vimotia--vertical",video:"vimotia__video-wrapper",embed:"vimotia__video-embed",videoFixedRatio:"vimotia__video-wrapper--fixed-ratio",brandingEnabled:"vimotia--branding-enabled",brandingElem:{container:"vimotia__branding",linkHandler:"vimotia__branding__linkHandler",link:"vimotia__branding__link",type:{underPlayer:"vimotia__branding--under-player"}},poster:"vimotia__poster",posterEnabled:"vimotia__poster-enabled",widgetProductInfoSlider:{container:"vimotia__widget__productInfoSlider__container",wrapper:"vimotia__widget__productInfoSlider__wrapper"},swiperPlugin:{container:"swiper-container",wrapper:"swiper-wrapper",slide:"swiper-slide"},control:"vimotia__control",controlPressed:"vimotia__control--pressed",playing:"vimotia--playing",paused:"vimotia--paused",stopped:"vimotia--stopped",loading:"vimotia--loading",hover:"vimotia--hover",tooltip:"vimotia__tooltip",cues:"vimotia__cues",hidden:"vimotia__sr-only",hideControls:"vimotia--hide-controls",hideWidgets:"vimotia--hide-widgets",hideActions:"vimotia--hide-actions",isIos:"vimotia--is-ios",isTouch:"vimotia--is-touch",uiSupported:"vimotia--full-ui",noTransition:"vimotia--no-transition",display:{time:"vimotia__time"},menu:{value:"vimotia__menu__value",badge:"vimotia__badge",open:"vimotia--menu-open"},fullscreen:{enabled:"vimotia--fullscreen-enabled",fallback:"vimotia--fullscreen-fallback"},tabFocus:"vimotia__tab-focus"},variantFormTexts:{addToCart:"Add to Cart"}};class gh{constructor(t,e,i){if(this.logger=E(),this.stateClient=tt(),A.nullOrUndefined(i.player))return void this.logger.error("Player: data is missing",i);if(!A.array(e))return void this.logger.error("Expect to see an array of video elements, but got ",e);if(this.timers={},this.ready=!1,this.loading=!1,this.touch=th.touch,this.mediaWrapper=t,this.mediaById=e,[this.media]=this.mediaById,this.currentMediaId=0,this.config=S({},ph,gh.defaults,i,{uid:`${i.video.video_id}_${i.player.id}`,storage:{key:`${ph.storage.keyPrefix}-v${i.video.video_id}-p${i.player.id}`}},(()=>{try{return JSON.parse(this.media.getAttribute("data-vimotia-config"))}catch(t){return{}}})()),this.elements={container:null,controls:null,buttons:{},display:{buffer:null,currentTime:null,duration:null},progress:{},inputs:{},settings:{popup:null,menu:null,panels:{},buttons:{}},widgetList:{container:null},productInfoSlider:{container:null}},this.fullscreen={active:!1},A.nullOrUndefined(this.media)||!A.element(this.media))return void this.logger.error("Setup failed: no suitable element passed");if(this.media.player)return void this.logger.warn("Target already setup");if(!th.check().api)return void this.logger.error("Setup failed: no support");const r=this.media.cloneNode(!0);r.autoplay=!1,this.elements.original=r;const n=this.media.tagName.toLowerCase();"video"===n?(this.type=n,this.provider="html5",this.media.hasAttribute("crossorigin")&&(this.config.crossorigin=!0),(this.media.hasAttribute("autoplay")||i.player.auto_start)&&(this.config.autoplay=!0),(this.media.hasAttribute("playsinline")||this.media.hasAttribute("webkit-playsinline"))&&(this.config.playsinline=!0),(this.media.hasAttribute("muted")||i.player.muted_play)&&(this.config.muted=!0),this.supported=th.check(this.type,this.provider,this.config.playsinline),this.supported.api?(this.mediaById.forEach((t=>{const e=t;kt(e,!0),e.muted=this.config.muted})),kt(this.mediaById[this.currentMediaId],!1),this.eventListeners=[],this.listeners=new ch(this),this.storage=new k(this.config.storage.key),this.storage.set({...this.config}),this.media.vimotia=this,A.element(this.elements.container)||(this.elements.container=Tt("div",{tabindex:0,style:`--vimotia-theme: ${this.config.playerTheme}`,"data-video-id":this.config.video.video_id}),function(t,e){const i=t.length?t:[t];Array.from(i).reverse().forEach(((t,i)=>{const r=i>0?e.cloneNode(!0):e,n=t.parentNode,a=t.nextSibling;r.appendChild(t),a?n.insertBefore(r,a):n.appendChild(r)}))}(this.mediaWrapper,this.elements.container)),lh.addStyleHook.call(this),hh.setup.call(this),!this.isHTML5&&this.supported.ui||lh.build.call(this),this.listeners.container(),this.listeners.global(),this.fullscreen=new sh(this),this.lastSeekTime=0):this.logger.error("Setup failed: no support")):this.logger.error("Setup failed: unsupported type")}get isHTML5(){return"html5"===this.provider}get isVideo(){return"video"===this.type}play(){if(!A.function(this.media.play))return null;const t=this.media.play();return A.nullOrUndefined(t)||t.then((()=>{this.muted=this.config.muted})).catch((t=>(this.logger.warn(`player: cannot play video ${this.config.video.video_id}`,`media sound is on: ${!this.media.muted}`,"error:",t),null))),null}pause(){this.playing&&A.function(this.media.pause)&&this.media.pause()}get playing(){return Boolean(this.ready&&!this.paused&&!this.ended)}get paused(){return Boolean(this.media.paused)}get stopped(){return Boolean(this.paused&&0===this.currentTime)}get ended(){return Boolean(this.media.ended)}togglePlay(t){(A.boolean(t)?t:!this.playing)?this.play():this.pause()}stop(){this.isHTML5?(this.currentTime=0,this.pause()):A.function(this.media.stop)&&this.media.stop()}restart(){this.currentTime=0,this.play()}rewind(t){this.currentTime-=A.number(t)?t:this.config.seekTime}forward(t){this.currentTime+=A.number(t)?t:this.config.seekTime}set currentTime(t){if(!this.duration)return;let e=t;e>this.config.duration&&(e=this.config.duration-.5,this.logger.warn(`The seek-to time is expected to be less than ${this.config.duration} seconds, but got: `,t));const i=A.number(e)&&e>0,{accumulatedMediaDurationById:r}=this.config;let n=0;for(let t=0;t0?t.end(0)/this.duration:0}get seeking(){return Boolean(this.media.seeking)}get duration(){const t=parseFloat(this.config.duration),e=(this.media||{}).duration,i=A.number(e)&&e!==1/0?e:0;return t||i}set volume(t){let e=t;A.string(e)&&(e=Number(e)),A.number(e)||(e=this.storage.get("volume")),A.number(e)||({volume:e}=this.config),e>1&&(e=1),e<0&&(e=0),this.config.volume=e,this.media.volume=e,!A.empty(t)&&this.muted&&e>0&&(this.muted=!1)}get volume(){return Number(this.media.volume)}increaseVolume(t){const e=this.media.muted?0:this.volume;this.volume=e+(A.number(t)?t:0)}decreaseVolume(t){this.increaseVolume(-t)}set muted(t){let e=t;A.boolean(e)||(e=this.storage.get("muted")),A.boolean(e)||(e=this.config.muted),this.config.muted=e,Object.keys(this.mediaById).forEach((t=>{this.mediaById[t].muted=e}))}get muted(){return Boolean(this.media.muted)}get source(){return this.media.currentSrc}set poster(t){this.isVideo?lh.setPoster.call(this,t,!1).catch((()=>{})):this.logger.warn("Poster can only be set for video")}get poster(){return this.isVideo?this.media.getAttribute("poster"):null}get ratio(){if(!this.isVideo)return null;const t=Hu(Wu.call(this));return A.array(t)?t.join(":"):t}set ratio(t){this.isVideo?A.string(t)&&Gu(t)?(this.config.ratio=t,zu.call(this)):this.logger.error(`Invalid aspect ratio specified (${t})`):this.logger.warn("Aspect ratio can only be set for video")}set autoplay(t){this.config.autoplay=A.boolean(t)?t:this.config.autoplay}get autoplay(){return Boolean(this.config.autoplay)}togglePlayerControls(t){if(this.togglePlayerWidgets(t),this.toggleGlobalActions(t),this.supported.ui){const e=Dt(this.elements.container,this.config.classNames.hideControls),i=void 0===t?void 0:!t,r=Pt(this.elements.container,this.config.classNames.hideControls,i);if(r&&this.config.controls.includes("settings")&&!A.empty(this.config.settings)&&ih.toggleMenu.call(this,!1),r!==e){const t=r?"controlshidden":"controlsshown";bt.call(this,this.media,t)}return!r}return!1}togglePlayerWidgets(t){if(!this.supported.ui)return!1;const e=void 0===t?void 0:!t;return!Pt(document.querySelector("body"),this.config.classNames.hideWidgets,e)}toggleGlobalActions(t){const e=void 0===t?void 0:!t,i=document.querySelectorAll(".vimotia--close"),r=document.querySelectorAll(".vimotia--global-volume--unmute");Pt(i,this.config.classNames.hideActions,e),Pt(r,this.config.classNames.hideActions,e)}updateMedia(t){if(t>=this.config.accumulatedMediaDurationById.length)return void this.logger.error(`The id is exceed the number of tracks. We have ${this.config.accumulatedMediaDurationById.length} tracks, but got id: `,t);if(t===this.currentMediaId)return;const e=this.mediaById[t];if(A.nullOrUndefined(e)||!A.element(e)||"video"!==(i=e,A.element(i)?i.tagName.toLowerCase():""))return void this.logger.error("Expect to get a video element, but got: ",e);var i;this.pause(),this.media=e;const r=this.currentMediaId;this.currentMediaId=t,this.media.vimotia=this,"true"===this.media.getAttribute(this.config.listenerAttributes.media)||this.listeners.media(),kt(this.mediaById[r],!0),kt(this.mediaById[this.currentMediaId],!1),this.play(),this.logger.log(`Media updated to id: ${this.currentMediaId}`,e)}playNextAvailableTrack(){const{accumulatedMediaDurationById:t}=this.config;let e=this.currentMediaId;this.currentMediaId1&&void 0!==arguments[1]&&arguments[1];if(!this.ready)return;this.stop(),clearTimeout(this.timers.loading),clearTimeout(this.timers.controls),clearTimeout(this.timers.resized),this.isHTML5&&(lh.toggleNativeControls.call(this,!0),(()=>{var i,r;document.body.style.overflow="",this.embed=null,e?(Object.keys(this.elements).length&&(It(this.elements.buttons.play),It(this.elements.controls),It(this.elements.wrapper),this.elements.buttons.play=null,this.elements.controls=null,this.elements.wrapper=null),A.function(t)&&t()):(_t.call(this),i=this.elements.original,r=this.elements.container,A.element(r)&&A.element(r.parentNode)&&A.element(i)&&r.parentNode.replaceChild(i,r),bt.call(this,this.elements.original,"destroyed",!0),A.function(t)&&t.call(this.elements.original),this.ready=!1,setTimeout((()=>{this.elements=null,this.media=null,this.mediaById=null}),200))})())}supports(t){return th.mime.call(this,t)}static loadSprite(t,e){return Qu(t,e)}updateUi(){ih.updateVolume.call(this)}get controlsContainer(){return this.elements.controls}get currentTimeContainer(){return this.elements.display.currentTime}}gh.defaults=I(ph);var fh=gh,mh={analytics:!0,discount:null,embeddedPlayAtcWidgetContainer:null,loop:!1,lazyLoading:!0,themeColor:"#5C5C5C"},vh=class{constructor(t,e,i){let r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:{};this.logger=E(),this.stateClient=tt(),this.playerItem=t,this.sharedCollectionStates=e,this.platform=i,this.validateParams(t)&&(this.config=S({},mh,r),this.tracks=[...this.playerItem.linkedhosts],this.player=null,this.accumulatedMediaDurationById=[],this.videoLength=0,this.tracks.forEach((t=>{this.videoLength+=t.length,this.accumulatedMediaDurationById.push(this.videoLength)})),this.analytics=null,this.elements={container:null,videosList:null,videos:[],overlay:{container:null,side:null,bottom:null,annotationLinks:[],decorations:[],stickers:[]}},this.classNames={container:"vimotia__video-wrapper",poster:"vimotia__poster",videosList:"vimotia__videos",videoBackground:"vimotia__video-wrapper__background",videoItem:"vimotia__videos__item",overlay:{container:"vimotia__widgetList",side:"vimotia-video__overlay__side",bottom:"vimotia-video__overlay__bottom"}},this.init())}init(){const t=Tt("div",{class:this.classNames.container});this.elements.container=t;const e=Tt("div",{class:this.classNames.videosList});this.elements.videosList=e;const i=Tt("div",{class:this.classNames.poster}),r=this.createOverlay(),n=this.createVideoBackground();t.append(e,i,r,n),this.tracks.forEach((t=>{const i=this.createTrack(t.cdn_url);e.appendChild(i),this.elements.videos.push(i)}))}createVideoBackground(){return Tt("img",{class:this.classNames.videoBackground,src:this.backgroundImage})}appendDecoration(t){const{container:e,decorations:i}=this.elements.overlay;if(i.length>0)return;let r=t;A.array(r)||(r=[t]),e.append(...r),i.push(...r)}createOverlay(){const t=Tt("div",{class:this.classNames.overlay.container}),e=Tt("div",{class:this.classNames.overlay.side}),i=Tt("div",{class:this.classNames.overlay.bottom});return t.append(e,i),this.elements.overlay.container=t,this.elements.overlay.side=e,this.elements.overlay.bottom=i,t}createTrack(t){const e=Tt("video",{class:this.classNames.videoItem,playsinline:"playsinline",preloaded:"metadata",poster:""});let i;if(this.config.lazyLoading)i=Tt("source",{"data-src":t,type:"video/mp4"}),e.appendChild(i);else if(i=Tt("source",{src:t,type:"video/mp4"}),`${t}`.endsWith("m3u8"))if(e.canPlayType("application/vnd.apple.mpegurl"))e.appendChild(i);else if(Fu().isSupported()){const i=new(Fu());i.loadSource(t),i.attachMedia(e)}else this.logger.error("This is a legacy browser that doesn't support MSE");else e.appendChild(i);return e}listenToAnnotationLinkDisplayWindow(t){vt(this.elements.container,be,(e=>{const{currentTime:i}=e.detail;t.forEach((t=>{t.toggleBasedOnDisplayWindow(i)}))})),vt(this.elements.container,_e,(e=>{const{type:i,currentTime:r}=e.detail;t.forEach((t=>{t.toggleAtTheEndOfPlayback(i,r)}))}))}addPlayer(){if(A.nullOrUndefined(this.elements.videosList))return;let t={accumulatedMediaDurationById:this.accumulatedMediaDurationById,duration:this.videoLength,linkedProducts:[...this.playerItem.linkedproducts],loop:this.config.loop,playerTheme:this.config.themeColor,player:{auto_start:this.playerItem.player.auto_start,embeded_play:this.playerItem.player.embeded_play,id:this.playerItem.player.id,muted_play:this.playerItem.player.muted_play},video:{...this.playerItem.video},widgets:[...this.playerItem.widgets]};this.stateClient.isMobile&&(t=S({},t,{player:{...function(t,e){const i={};let r="";return Object.keys(t).forEach((e=>{e.endsWith("_m")&&(r=e.substring(0,e.length-2),i[r]=t[e])})),i}(this.playerItem.player)}})),this.player=new fh(this.elements.container,this.elements.videos,t)}play(){this.config.lazyLoading&&this.lazyLoadSource(),this.player.play(),this.player.updateUi(),this.sendPlayStartToAnalytics()}stop(){this.sendPlayEndToAnalytics(),this.player.pause()}pause(){this.player.pause()}setMuted(t){this.player.muted=t}get isMuted(){return!0===this.player.muted}get analyticsInstance(){return this.analytics}get container(){return this.elements.container}get id(){return this.playerItem.video.video_id}get title(){return A.nullOrUndefined(this.playerItem?.video?.name)?"":this.playerItem.video.name}get backgroundImage(){return`${(new d).staticSrcBaseUrl}/${this.playerItem.video.cover_image_url}`}get playerId(){return this.playerItem.player.id}get playerItemData(){return this.playerItem}get linkedProductsData(){return A.empty(this.playerItem?.linkedproducts)?[]:this.playerItem.linkedproducts}get hasLinkedProducts(){return!A.empty(this.linkedProductsData)}ready(){bt(this.player.elements.container,"videoisreadyindom")}sendPlayEndToAnalytics(){this.config.analytics&&(A.nullOrUndefined(this.analytics)?this.logger.error("Expect analytics but got null"):this.player.ended||0===this.player.currentTime||this.analytics.postEnd(this.player.currentTime))}sendPlayStartToAnalytics(){this.config.analytics&&(A.nullOrUndefined(this.analytics)?this.logger.error("Expect analytics but got null"):this.analytics.postStart(this.sharedCollectionStates.prevVideoIdAsSwipeReferrer,(()=>{this.analytics.postPlayInterval(this.player),A.array(this.playerItem.linkedproducts)&&this.playerItem.linkedproducts.forEach((t=>{Vn.queuePurchaseEvents({linkedPage:Vn.getLinkedPage(this.platform),pageType:this.platform.pageType,playerId:this.playerId,productId:t.product_id,sessionId:this.analytics.getSessionId(),timestamp:+new Date,videoId:this.id})}))})).then())}setAnalytics(t){this.analytics=t}get controlsContainer(){return this.player.controlsContainer}get currentTimeContainer(){return this.player.currentTimeContainer}lazyLoadSource(){let t,e;this.elements.videos.forEach((i=>{if([t]=i.getElementsByTagName("source"),e=t.dataset.src,!A.nullOrUndefined(e)&&!A.empty(e)){if(Ct(t,{src:e,"data-src":""}),`${e}`.endsWith("m3u8"))if(i.canPlayType("application/vnd.apple.mpegurl"));else if(Fu().isSupported()){const t=new(Fu());t.loadSource(e),t.attachMedia(i)}else this.logger.error("This is a legacy browser that doesn't support MSE");i.load()}}))}validateParams(t){const{linkedhosts:e}=t;return A.nullOrUndefined(e)||!A.array(e)?(this.logger.error("Video: linked hosts are missing"),!1):!A.nullOrUndefined(e[0])||(this.logger.error("Video: linked hosts have no data"),!1)}},yh={position:vu},Ah=class{constructor(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.logger=E(),this.platform=Mu(),A.empty(t)?this.logger.error(`expect player item but got "${t}"`):(this.playerItem=t,this.video=null,this.isInitialized=!1,this.config={...yh,...e},this.elements={container:null,close:null},this.classNames={container:"vimotia__pip",containerVisibility:"vimotia__pip--visible",position:{bottomLeft:"vimotia__pip--bottom-left",bottomRight:"vimotia__pip--bottom-right"},orientation:{landscape:"vimotia__pip--landscape",portrait:"vimotia__pip--portrait",square:"vimotia__pip--square"},uiContainer:"vimotia__pip__ui",buttons:{default:"vimotia__pip__button",close:"vimotia__pip__button-close",expand:"vimotia__pip__button-expand"}},this.init())}init(){this.logger.log("Init PIP"),this.create(),this.listenToClose(),this.listenToCollectionPlay(),this.play()}initialDisplay(){this.inject(),this.listenToClose(),this.isInitialized=!0,window.setTimeout((()=>{this.display()}),200)}display(){this.show(),this.play()}listenToClose(){vt(this.elements.close,"click",(t=>{t.stopPropagation(),this.close()}))}listenToCollectionPlay(){vt(document.querySelector("body"),xn,(()=>{this.close()}))}inject(){const t=document.querySelector("body");A.nullOrUndefined(this.elements.container)?this.logger.error(`expect an element but got ${this.elements.container}`):t.appendChild(this.elements.container)}create(){const t=this.getPositionClassName(),e=this.getOrientationClassName(),i=Tt("div",{class:`${this.classNames.container} ${t} ${e}`}),r=this.createUIOverlay(),n={muteOnMobile:!0,firstVideoIdInList:`${this.playerItem.video.video_id}`,prevVideoIdAsSwipeReferrer:""},a=new vh(this.playerItem,n,this.platform,{loop:!0,analytics:!1});this.video=a,A.nullOrUndefined(a.container)?this.logger.error(`expect a video container but got ${a.container}`):(i.appendChild(a.container),i.appendChild(r),this.elements.container=i,a.addPlayer())}createUIOverlay(){const t=Tt("div",{class:this.classNames.uiContainer}),e=te.createClose([this.classNames.buttons.default,this.classNames.buttons.close]),i=te.createExpand([this.classNames.buttons.default,this.classNames.buttons.expand]);return t.appendChild(e),t.appendChild(i),this.elements.close=e,t}close(){this.hide(),this.video.stop(),bt(this.elements.container,Au)}show(){kt(this.elements.container,!1),window.setTimeout((()=>{Pt(this.elements.container,this.classNames.containerVisibility,!0)}),100)}hide(){Pt(this.elements.container,this.classNames.containerVisibility,!1),window.setTimeout((()=>{kt(this.elements.container,!0)}),800)}play(){A.nullOrUndefined(this.video)?this.logger.error(`expect a video but got ${this.video}`):(this.video.setMuted(!0),this.video.play())}getPositionClassName(){switch(this.config.position){case vu:return this.classNames.position.bottomRight;case yu:return this.classNames.position.bottomLeft;default:return""}}getOrientationClassName(){const{width:t,height:e}=this.playerItem.video,{portrait:i,landscape:r,square:n}=this.classNames.orientation;return te?r:n}get container(){return this.elements.container}set isInitialized(t){this.isInitializedInDOM=t}get isInitialized(){return this.isInitializedInDOM}};const bh="vimotia__playButtonContainer--pip--bottom",_h="vimotia__playButtonContainer--pip--left",wh="vimotia__playButtonContainer--pip--right";var Ch=class extends su{constructor(t){super(t),this.picInPic=this.createPicInPic(),this.autoShowPicInPicTimer=-1}setCSSVariable(){Ut(this.thumbnail.container,this.cssVariables)}get cssVariables(){const t=Math.abs(parseInt(this.config.play_button_x,10)),e=Math.abs(parseInt(this.config.play_button_y,10));return A.number(t)&&A.number(e)?{[D]:`${t}px`,[L]:`${e}px`}:(this.logger.error("Expect a number for x and y coordination from",{play_button_x:this.config.play_button_x,play_button_y:this.config.play_button_y}),{[D]:"25px",[L]:"25px"})}inject(){document.querySelector("body").prepend(this.primaryButtonContainer),this.listenToPicInPicTrigger(),this.listenToPicInPicClose(),this.postInject(),this.tryAutoShowPicInPic(),this.tryScrollToShowPicInPic()}listenToPicInPicTrigger(){vt(this.primaryButtonContainer,"click",(()=>{this.clearAutoShowPicInPicTimer(),this.config.pip_direct_play||this.displayPicInPic(),this.hide().then()}))}async show(){this.thumbnail.show()}async hide(){await this.thumbnail.hide()}clearAutoShowPicInPicTimer(){this.autoShowPicInPicTimer>=0&&(window.clearTimeout(this.autoShowPicInPicTimer),this.autoShowPicInPicTimer=-1)}displayPicInPic(){this.picInPic.isInitialized?this.picInPic.display():this.picInPic.initialDisplay()}listenToPicInPicClose(){vt(this.picInPic.container,Au,(()=>{this.shouldShowPlayButtonAfterClose()&&this.show().then(),this.stateClient.picInPicClosed=!0}))}shouldShowPlayButtonAfterClose(){return!this.playerItem.player.hide_playbutton}tryAutoShowPicInPic(){this.hasClosedInCurrentSession()?this.thumbnail.cancelPlayButtonAutoPlayProcessAnimation():this.isAutoShowPicInPic()?this.autoShowPicInPicTimer=window.setTimeout((()=>{this.displayPicInPic(),this.hide().then()}),1e3*this.config.auto_start_seconds):this.thumbnail.cancelPlayButtonAutoPlayProcessAnimation()}hasClosedInCurrentSession(){return this.stateClient.picInPicClosed}isAutoShowPicInPic(){return this.config.shouldAutoPlay&&!this.isScrollToShowPicInPic()}tryScrollToShowPicInPic(){this.hasClosedInCurrentSession()||this.isScrollToShowPicInPic()&&At(window,"scroll",(()=>{this.displayPicInPic(),this.hide().then()}))}isScrollToShowPicInPic(){return-1===this.config.auto_start_seconds}createPicInPic(){const t=this.isLeftPosition()?yu:vu;return new Ah(this.playerItem,{position:t})}setTypeUniqueUI(){Pt(this.primaryButtonContainer,"vimotia__playButtonContainer--pip",!0),Pt(this.primaryButtonContainer,bh,!0),this.isLeftPosition()?Pt(this.primaryButtonContainer,_h,!0):Pt(this.primaryButtonContainer,wh,!0)}isLeftPosition(){return parseInt(this.config.play_button_x,10)>0}get primaryButtonContainer(){return this.thumbnail.container}get container(){return this.config.pip_direct_play?this.thumbnail.container:this.picInPic.container}get isAutoShowCollection(){return!1}},Eh=class{constructor(t){this.logger=E(),this.playerItem=t,this.stateClient=tt()}create(){return this.stateClient.isMobile?this.createMobile():this.createDesktop()}createMobile(){switch(this.playerItem.player.player_style_m){case B:return new gu(this.playerItem);case O:return new lu(this.playerItem);case R:return new uu(this.playerItem);case"pip":return new Ch(this.playerItem);default:throw new Error(`Unknown player style ${this.playerItem.player.player_style_m}`)}}createDesktop(){switch(this.playerItem.player.player_style){case B:return new gu(this.playerItem);case O:return new lu(this.playerItem);case R:return new uu(this.playerItem);case"pip":return new Ch(this.playerItem);default:throw new Error(`Unknown player style ${this.playerItem.player.player_style}`)}}},Th=i(6923),Ih={};Ih.styleTagTransform=ht(),Ih.setAttributes=lt(),Ih.insert=st().bind(null,"head"),Ih.domAPI=nt(),Ih.insertStyleElement=dt(),it()(Th.A,Ih),Th.A&&Th.A.locals&&Th.A.locals;var Sh=class{constructor(t){this.logger=E(),this.widgetConfig=t,this.state={displaying:!0},this.config={displayTimeInSecs:5},this.elements={container:null,contentContainer:null,iconTriggerButton:null},this.classNames={container:"vimotia__widgetList__annotationLink",containerType:{hasLink:"vimotia__widgetList__annotationLink--has-link"},item:"vimotia__widgetList__item",contentWrapper:"vimotia__widgetList__item__contentWrapper",countdownTimer:{content:"vimotia__widgetList__countdownTimer__content",text:"vimotia__widgetList__countdownTimer__text",timer:"vimotia__timer"},message:{content:"vimotia__widgetList__message__content",text:"vimotia__widgetList__message__text"},button:"vimotia__widget__button",widgetHide:"vimotia__widget__hide",timerHide:"vimotia__widget__timerHide",iconTriggerButton:"vimotia__link-widget__icon_trigger_button"},this.init()}init(){this.iconTriggerButton=this.createTriggerButton(),this.listenToTriggerButton(this.iconTriggerButton),this.contentContainer=this.createContent();const t=this.createMainContainer();t.append(this.contentContainer,this.iconTriggerButton),this.container=t}createTriggerButton(){return te.createNotification([this.classNames.iconTriggerButton])}listenToTriggerButton(t){vt(t,"click",(()=>{this.showLink().then()}))}async hideTriggerButton(){Ht.fadeOutRight(this.iconTriggerButton),await Ht.waitAnimationEnd(),kt(this.iconTriggerButton,!0)}async showTriggerButton(){kt(this.iconTriggerButton,!1),await Ht.waitToStartAnimation(),Ht.fadeInLeft(this.iconTriggerButton)}createContent(){throw new Error("implement it in the sub class")}async hideContentContainer(){Ht.fadeOutRight(this.contentContainer),await Ht.waitAnimationEnd(),kt(this.contentContainer,!0)}async showContentContainer(){kt(this.contentContainer,!1),await Ht.waitToStartAnimation(),Ht.fadeInLeft(this.contentContainer)}createContentWrapperContainer(){return Tt("div",{class:`${this.classNames.contentWrapper} ${this.classNames.countdownTimer.content}`})}createLinkOutIcon(){return te.createLinkOutIcon()}applyLinkStyle(t){Pt(t,this.classNames.containerType.hasLink,!0)}listenToLink(t){vt(t,"click",(()=>{A.empty(this.link)?this.logger.warn(`annotation link: expect to get a link but got ${this.link}`):(bt(this.container,Ae,!0,{widgetId:this.widgetConfig.widget_id}),setTimeout((()=>{window.open(this.link,"_blank")}),300))}))}createMainContainer(){return Tt("div",{class:`${this.classNames.item} ${this.classNames.container}`,[fe]:this.widgetConfig.widget_id})}toggleBasedOnDisplayWindow(t){"time_window"===this.widgetConfig.duration_type&&(this.isInDisplayWindow(t)?this.showWidget():this.hideWidget())}isInDisplayWindow(t){return this.widgetConfig.duration_start<=t&&(this.widgetConfig.duration_end>=t||this.isAlwaysDisplay)}get isAlwaysDisplay(){return-1===this.widgetConfig.duration_end}toggleAtTheEndOfPlayback(t,e){"end_of_play"===this.widgetConfig.duration_type&&("ended"===t&&this.showWidget(),"timeupdate"===t&&e>1&&this.hideWidget())}hideWidget(){this.isDisplaying&&(this.isDisplaying=!1,kt(this.container,!0))}showWidget(){this.isDisplaying||(this.isDisplaying=!0,kt(this.container,!1),this.showLink().then())}async showLink(){await this.hideTriggerButton(),await this.showContentContainer(),await Qt(1e3*this.config.displayTimeInSecs),await this.hideContentContainer(),await this.showTriggerButton()}get container(){return this.elements.container}set container(t){this.elements.container=t}get contentContainer(){return this.elements.contentContainer}set contentContainer(t){this.elements.contentContainer=t}get iconTriggerButton(){return this.elements.iconTriggerButton}set iconTriggerButton(t){this.elements.iconTriggerButton=t}get isDisplaying(){return this.state.displaying}set isDisplaying(t){this.state.displaying=t}get shouldAddLink(){return!A.empty(this.link)}get link(){return this.widgetConfig.countdown_message_button_link}},xh=class extends Sh{createContent(){const t=this.createContentWrapperContainer(),e=Tt("div",{class:this.classNames.message.text},this.widgetConfig.message_content);return t.appendChild(e),this.shouldAddLink&&(this.applyLinkStyle(t),this.listenToLink(t),t.appendChild(this.createLinkOutIcon())),t}};class kh{static createAll(t){return kh.getConfig(t).map((t=>kh.create(t)))}static create(t){return new xh(t)}static getConfig(t){return t.filter((t=>"annotation_link"===t.widget_type))}}var Ph=kh,Dh=i(5601),Lh={};Lh.styleTagTransform=ht(),Lh.setAttributes=lt(),Lh.insert=st().bind(null,"head"),Lh.domAPI=nt(),Lh.insertStyleElement=dt(),it()(Dh.A,Lh),Dh.A&&Dh.A.locals&&Dh.A.locals;class Bh{constructor(t){this.logger=E(),this.widgetConfig=t,this.elements={container:null},this.classNames={container:"vimotia__widgetList__decoration",widgetHide:"vimotia__widget__hide"},this.init()}init(){this.createContainer(),this.listenToImageClick()}createContainer(){const t=`\n background-image: url(${(new d).staticSrcBaseUrl}/${this.widgetConfig.decoration_image_url});\n background-repeat: ${this.widgetConfig.decoration_repeat?"repeat-x":"no-repeat"};\n `,e=Tt("div",{class:this.classNames.container,style:t,[fe]:this.widgetConfig.widget_id});this.widgetConfig.decoration_clickable&&(e.dataset.link=this.widgetConfig.decoration_link),this.elements.container=e}static create(t){const e=Bh.getConfig(t),i=[];return e.forEach((t=>{const e=new Bh(t).getContainer();i.push(e)})),i}getContainer(){return this.elements.container}static getConfig(t){return t.filter((t=>"decoration"===t.widget_type))}listenToImageClick(){const{container:t}=this.elements,e=!A.nullOrUndefined(t),{decoration_clickable:i}=this.widgetConfig;e&&i&&vt(t,"click",(t=>{const{link:e}=t.target.dataset;A.nullOrUndefined(e)||A.empty(e)?this.logger.warn(`decoration: expect to get a link but got ${e}`):(bt(this.elements.container,we,!0,{widgetId:this.widgetConfig.widget_id}),setTimeout((()=>{window.open(e,"_self")}),300))}))}}var Oh=Bh,Rh=i(9347),Mh={};Mh.styleTagTransform=ht(),Mh.setAttributes=lt(),Mh.insert=st().bind(null,"head"),Mh.domAPI=nt(),Mh.insertStyleElement=dt(),it()(Rh.A,Mh),Rh.A&&Rh.A.locals&&Rh.A.locals;class Nh{constructor(t){this.logger=E(),this.widgetConfig=t,this.elements={container:null},this.classNames={container:"vimotia__widgetList__sticker",imageContainer:"vimotia__widgetList__sticker-image-container",image:"vimotia__widgetList__sticker-image",widgetHide:"vimotia__widget__hide"},this.init()}init(){this.createContainer(),this.listenToImageClick()}createContainer(){const t=Tt("div",{class:this.classNames.container,[fe]:this.widgetConfig.widget_id}),e=this.createImage(),i=Tt("div",{rel:"noopener noreferrer",[fe]:this.widgetConfig.widget_id,class:this.classNames.imageContainer});i.appendChild(e),t.appendChild(i),this.elements.container=t}createImage(){const t=Tt("img",{src:`${(new d).staticSrcBaseUrl}/${this.widgetConfig.sticker_image_url}`,class:`${this.classNames.image} vimotia__image`,alt:"sticker"});return this.widgetConfig.sticker_clickable&&(t.dataset.link=this.widgetConfig.sticker_link),t}static create(t){const e=Nh.getConfig(t),i=[];return e.forEach((t=>{const e=new Nh(t).getContainer();i.push(e)})),i}getContainer(){return this.elements.container}static getConfig(t){return t.filter((t=>"sticker"===t.widget_type))}listenToImageClick(){const{container:t}=this.elements,e=!A.nullOrUndefined(t),{sticker_clickable:i}=this.widgetConfig;e&&i&&vt(t,"click",(t=>{t.stopPropagation();const{link:e}=t.target.dataset;A.nullOrUndefined(e)||A.empty(e)?this.logger.warn(`sticker: expect to get a link but got ${e}`):(bt(this.elements.container,Ce,!0,{widgetId:this.widgetConfig.widget_id}),setTimeout((()=>{window.open(e,"_blank")}),300))}))}}var Fh=Nh,Uh={allowAutoPopup:!0,enablePlayButton:!0},Vh=class{constructor(t,e,i,r,n){let a=arguments.length>5&&void 0!==arguments[5]?arguments[5]:{};this.logger=E(),this.stateClient=tt(),this.platform=i,this.initialPlayerList=t,this.swipePlayerList=e,this.uiCreator=n,this.slider=r,this.playButton=null,this.config=S({},Uh,a),this.state={injected:!1};const s=this.initialPlayerList[0];this.sharedCollectionStates={firstVideoIdInList:`${s.video.video_id}`,prevVideoIdAsSwipeReferrer:""},this.timers={discountDialog:-1},this.discount=null,this.elements={playButton:null,info:{discount:{container:null}}},this.playerHashAdded=!1,window._vmtCheckAdminPage=()=>{A.nullOrUndefined(this.playButton)||this.playButton.destroy()},this.init()}init(){this.createUI(),this.initPlayButton(),this.listenToSharedEvents(),this.listenToUniqueEvents()}createUI(){throw new Error("Implement in the sub class")}createBaseUI(){this.createPlayButton(),this.uiCreator.setThemeColor(this.playButton.themeColor),this.initVideosAndStates(),this.slider.appendAllVideosToSlide(),this.listenToCloseButton(this.uiCreator.closeButton),this.listenToSoundButton(this.uiCreator.soundButton)}createPlayButton(){const t=new Eh(this.initialPlayerList[0]).create();this.playButton=t,this.elements.playButton=t.container}initVideosAndStates(){const t=this.initialPlayerList[0],e=this.createVideo(t);this.slider.cacheVideoConfig(t),this.slider.appendVideoId(t.video.video_id),this.slider.appendVideo(e),this.slider.appendVideoToUnlockQueue(e),this.slider.currentVideo=e}listenToSoundButton(t){A.nullOrUndefined(t)?this.logger.error("expect a sound button container, but got null"):vt(t,"click",(()=>{this.stateClient.isMuted=!this.stateClient.isMuted,this.syncSoundStateOnCurrentVideo()}))}syncSoundStateOnCurrentVideo(){this.stateClient.isMuted?this.muteVideo():this.unmuteVideo()}muteVideo(){this.logger.log("Mute video"),this.uiCreator.setMuteIcon(),this.slider.currentVideo.setMuted(!0),this.stateClient.isMuted=!0}unmuteVideo(){this.logger.log("Unmute video"),this.uiCreator.setSoundIcon(),this.slider.currentVideo.setMuted(!1),this.stateClient.isMuted=!1}listenToCloseButton(t){vt(t,"click",(()=>{"brunetteskin.myshopify.com"!==this.platform.shopDomain&&"bella-babe-by-sk.myshopify.com"!==this.platform.shopDomain&&window.location.hash.includes("vmt_player_on")&&this.playerHashAdded?window.history.back():this.exitSequence()}))}exitSequence(){this.logger.log("collection base: exit sequence"),A.nullOrUndefined(this.slider.currentVideo)?this.logger.error(`collection: expect a current playing video but got ${this.slider.currentVideo}`):this.discount&&this.discount.shouldCurrentCouponShowAtExit()?bt(document.querySelector("body"),An):(this.cancelCurrentTimers(),this.stop(),bt(document.querySelector("body"),kn))}cancelCurrentTimers(){this.discount&&this.discount.cancel()}getSwipeVideos(t,e){const i=new d;pn.post(i.apiConstants.MORE_RELATED_VIDEOS,{page_number:t,shop_url:e}).then((t=>{if(this.logger.log("collection: received more videos",t),"success"!==t.status)return void this.logger.error(`Fail getting data from the endpoint. Error message: "${t.message}"`);const e=t.swipe_player_list;if(0===e.length)return this.logger.log("collection: no more videos"),void(this.slider.hasMoreSwipeVideoData=!1);this.logger.log(`collection: adding ${e.length} videos' config: `,e);let i=0;e.forEach((t=>{const{video:e}=t,{video_id:r}=e;this.slider.containsVideoId(r)?this.logger.warn(`collection: skip adding an existing video to queue, id: ${r}`):(this.slider.cacheVideoConfig(t),this.slider.appendVideoId(r),i+=1)})),0===i&&(this.logger.log("collection: no more videos"),this.slider.hasMoreSwipeVideoData=!1),this.ensureEnoughVideosAtTail(),this.logger.log(`collection: added ${i} videos' config`)}))}hide(){this.uiCreator.hide(),this.clearTimers()}clearTimers(){this.timers.discountDialog>0&&(window.clearTimeout(this.timers.discountDialog),this.timers.discountDialog=-1)}initPlayButton(){this.config.enablePlayButton&&window.setTimeout((()=>{this.setPlayButtonInDOM(),this.listenToPlayButton(),this.autoPlayIfSet()}),0)}setPlayButtonInDOM(){this.playButton.inject()}listenToPlayButton(){vt(this.elements.playButton,"click",(t=>{t.preventDefault(),t.stopPropagation(),jn()?this.logger.log("In dev env. Return."):A.nullOrUndefined(this.slider.currentVideo)?this.logger.error(`collection: expect a current playing video but got ${this.slider.currentVideo}`):(this.stateClient.isMuted=this.slider.currentVideo.isMuted,this.inject(),this.play())}),!1)}autoPlayIfSet(){if(!this.playButton.isAutoShowCollection)return;const t=this.initialPlayerList[0].player.auto_start_seconds;this.stateClient.collectionAutoPlayTimer=window.setTimeout((()=>{this.inject(),this.muteVideo(),this.play()}),1e3*t-500)}inject(){this.state.injected?this.logger.log("Skip. Collection is already on page."):(this.state.injected=!0,this.uiCreator.inject(),this.slider.toggleSliderNavigation(),this.listenToSlider(),this.addRemainingVideos())}listenToSlider(){this.slider.instance.on("slideNextTransitionEnd",(()=>{this.sharedCollectionStates.prevVideoIdAsSwipeReferrer=`${this.slider.currentVideo.id}`,this.slider.playNextVideo(),this.setSliderStateAndPlay()})),this.slider.instance.on("slidePrevTransitionEnd",(()=>{this.sharedCollectionStates.prevVideoIdAsSwipeReferrer=`${this.slider.currentVideo.id}`,this.slider.playPrevVideo(),this.setSliderStateAndPlay()}))}setSliderStateAndPlay(){this.optimizeNumOfSlides(),this.runPrePlayTasks(),this.slider.currentVideo.play()}optimizeNumOfSlides(){this.ensureEnoughVideosAtTail(),this.ensureEnoughVideosAtHead(),this.slider.removeExtraSlides()}ensureEnoughVideosAtTail(){if(this.slider.tailHasSufficientVideos)return;this.logger.log(`collection tail: ${this.slider.tailVideosCount} left, it reaches the threshold 2`);const t=this.slider.videoActiveIndex+this.slider.tailVideosCount+1,e=this.slider.videoId(t),i=this.slider.videoConfig(e);if(A.nullOrUndefined(i))return void(this.slider.hasMoreSwipeVideoData?(this.slider.currentSwipeVideoDataPage+=1,this.logger.log(`collection tail: request more videos from server on page ${this.slider.currentSwipeVideoDataPage}`),this.getSwipeVideos(this.slider.currentSwipeVideoDataPage,this.platform.shopDomain)):(this.logger.log("collection tail: loop existing videos"),this.slider.extendVideosWithDuplication(),this.ensureEnoughVideosAtTail()));this.logger.log(`collection tail: found video ${e} in memory`);const r=this.createVideo(i);this.slider.appendAVideoToSlider(r)}ensureEnoughVideosAtHead(){if(this.slider.isAllInitialVideosInSlider())return void this.logger.log("collection head: all previous videos are on page");if(this.slider.headHasSufficientVideos)return;this.logger.log(`collection head: ${this.slider.activeIndex} left, it reaches the threshold 2`);const t=this.slider.videoActiveIndex-this.slider.activeIndex-1;if(t<0)return void this.logger.log(`collection head: index to prepend is ${t} all previous videos are on page`);const e=this.slider.videoId(t);if(A.nullOrUndefined(e))return void this.logger.error(`collection head: expect to get a video id but got ${e}`,"this should not happen");const i=this.slider.videoConfig(e);if(A.nullOrUndefined(i))return void this.logger.error(`collection head: expect to get a video config but got ${i}`,"this should not happen");const r=this.createVideo(i);this.slider.prependAVideoToSlider(r),this.logger.log(`collection head: prepended video ${e} to the slider`)}toggleCurrentVideoUI(){this.toggleVideoInfoUI(),this.syncSoundStateOnCurrentVideo()}toggleVideoInfoUI(){throw new Error("not implemented")}runPrePlayTasks(){this.cancelCurrentTimers(),this.setWidgets(),this.setDiscountAndAnalytics(),this.toggleCurrentVideoUI(),this.movePlayerControlsToTarget(),this.setCurrentAndNextPlayText()}movePlayerControlsToTarget(){this.uiCreator.setControlsContainer(this.slider.currentVideo.controlsContainer),this.uiCreator.setCurrentTimeContainer(this.slider.currentVideo.currentTimeContainer)}setCurrentAndNextPlayText(){this.uiCreator.currentPlayText=this.slider.currentVideoTitle,this.uiCreator.nextPlayText=this.slider.nextVideoTitle}setWidgets(){this.setAddToCartWidget(),this.setAnnotationLinkWidget(),this.setStickerWidget(),this.setDecorationWidget()}setAddToCartWidget(){if(A.empty(this.slider.currentVideo.playerItemData.linkedproducts))return;const t=this.createAddToCartWidgetView();this.uiCreator.setCurrentProductWidget(t.container)}createAddToCartWidgetView(){throw new Error("Implement it in the sub class")}setAnnotationLinkWidget(){const t=Ph.createAll(this.slider.currentVideoWidgetsConfig);this.slider.currentVideo.listenToAnnotationLinkDisplayWindow(t),this.uiCreator.setCurrentLinkWidget(t.map((t=>t.container))),t.forEach((t=>t.showLink()))}setStickerWidget(){const t=Fh.create(this.slider.currentVideoWidgetsConfig);this.uiCreator.setCurrentStickerWidget(t)}setDecorationWidget(){const t=Oh.create(this.slider.currentVideoWidgetsConfig);this.slider.currentVideo.appendDecoration(t)}setDiscountAndAnalytics(){const t=this.setDiscountWidget();this.setAnalytics(t)}setDiscountWidget(){const t=pl.filterConfigFromList(this.slider.currentVideoWidgetsConfig),e=new pl(t,this.platform,this.uiCreator.discountContainer);return this.discount=e,e}setAnalytics(t){A.nullOrUndefined(t)&&this.logger.error("Expect a discount widget but got null");const e=new Vn(`${this.slider.currentVideo.id}`,`${this.slider.currentVideo.playerId}`,this.platform,t);this.slider.currentVideo.setAnalytics(e)}addRemainingVideos(){const t=[...this.initialPlayerList.slice(1)];this.addVideoGroupToSlider(t),this.stateClient.isSwipeVideoOn&&this.addVideoGroupToSlider(this.swipePlayerList),!A.nullOrUndefined(this.slider.videos)&&A.array(this.slider.videos)&&this.slider.videos.forEach((t=>{t.ready()}))}addVideoGroupToSlider(t){for(let e=0;e{this.slider.appendAVideoToSlider(r),this.slider.toggleSliderNavigation()}),200)}}listenToSharedEvents(){this.listenToVideoPauseEvent(),this.listenToAddToCartEvent(),this.listenToAddToCartButtonClickEvent(),this.listenToWidgetsClickEvent()}listenToUniqueEvents(){throw new Error("implement it in the sub class")}listenToVideoPauseEvent(){vt(this.uiCreator.container,ju,(()=>{this.slider.currentVideo.pause()}))}listenToAddToCartEvent(){vt(this.uiCreator.container,ve,(t=>{Vn.queueClickEvents({actionName:"addtocart",currentTime:this.slider.currentVideo.player.currentTime,objectId:`${t.detail.widgetId}`,sessionId:this.slider.currentVideo.analyticsInstance.getSessionId(),shopUrl:this.slider.currentVideo.analyticsInstance.getShopUrl()}),Vn.queuePurchaseEvents({linkedPage:Vn.getLinkedPage(this.platform),pageType:this.platform.pageType,playerId:this.slider.currentVideo.playerId,productId:`${t.detail.productId}`,sessionId:this.slider.currentVideo.analyticsInstance.getSessionId(),timestamp:+new Date,videoId:this.slider.currentVideo.id})}))}listenToAddToCartButtonClickEvent(){vt(this.uiCreator.container,ye,(t=>{Vn.queueClickEvents({actionName:Fn,currentTime:this.slider.currentVideo.player.currentTime,objectId:`${t.detail.widgetId}`,sessionId:this.slider.currentVideo.analyticsInstance.getSessionId(),shopUrl:this.slider.currentVideo.analyticsInstance.getShopUrl()}),Vn.queuePurchaseEvents({linkedPage:Vn.getLinkedPage(this.platform),pageType:this.platform.pageType,playerId:this.slider.currentVideo.playerId,productId:`${t.detail.productId}`,sessionId:this.slider.currentVideo.analyticsInstance.getSessionId(),timestamp:+new Date,videoId:this.slider.currentVideo.id})}))}listenToWidgetsClickEvent(){vt(this.uiCreator.container,`${Ae} ${we} ${Ce}`,(t=>{Vn.queueClickEvents({actionName:Fn,currentTime:this.slider.currentVideo.player.currentTime,objectId:`${t.detail.widgetId}`,sessionId:this.slider.currentVideo.analyticsInstance.getSessionId(),shopUrl:this.slider.currentVideo.analyticsInstance.getShopUrl()})}))}play(){throw new Error("play needs to be integrated in subclass")}prePlay(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.slider.slideTo(t,0,!1),this.logger.log("updating url hash"),"brunetteskin.myshopify.com"!==this.platform.shopDomain&&"bella-babe-by-sk.myshopify.com"!==this.platform.shopDomain&&function(t){let e=`${window.location.hash}`,i="",r="vmt_player_on";e.includes(r)&&(i=e.replace(`${r}`,"")),i=`${i}${r}`,console.log(`update location hash to: ${i}`),window.location.hash=`${i}`}(),bt(this.uiCreator.container,xn,!0)}postPlay(){if(this.stateClient.clearCollectionAutoPlayTimer(),"brunetteskin.myshopify.com"!==this.platform.shopDomain&&"bella-babe-by-sk.myshopify.com"!==this.platform.shopDomain){this.logger.log("hashchange listener added");let t=e=>{e.newURL.includes("#vmt_player_on")||(this.playerHashAdded=!1,this.exitSequence(),window.removeEventListener("hashchange",t),this.logger.log("player exit, hashchange listener removed"))};window.addEventListener("hashchange",t),this.playerHashAdded=!0}}stop(){throw new Error("Implement it in the sub class")}postStop(){this.slider.currentVideo.stop(),bt(document.querySelector("body"),Fo)}reset(){return this.logger.log("collection: resetting the slider"),this.rebuildVideosInSlider(),this.logger.log("collection: reset done"),!0}rebuildVideosInSlider(){this.slider.reset();const t=[...this.initialPlayerList,...this.swipePlayerList];for(let e=0;e{this.slider.appendAVideoToSlider(r),0===e&&([this.slider.currentVideo]=this.slider.videos)}),0)}}resetWithNewList(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[];this.initialPlayerList=[...t],this.rebuildVideosInSlider(),this.logger.log("collection: reset with updated list done")}show(){this.uiCreator.show()}createVideo(t){const e=S({},arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{discount:this.discount,themeColor:this.playButton.themeColor});return new vh(t,this.sharedCollectionStates,this.platform,e)}},jh=class extends Vh{listenToUniqueEvents(){this.uiCreator.listenToPermanentHideVideoInfo()}createUI(){this.createBaseUI()}createAddToCartWidgetView(){return new qo(this.slider.currentVideo.playerItemData,this.platform)}play(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.prePlay(t),window.setTimeout((()=>{this.show(),this.runPrePlayTasks(),this.slider.currentVideo.play()}),200),this.postPlay()}stop(){this.hide(),this.postStop(),setTimeout((()=>{this.reset()}),200)}toggleVideoInfoUI(){this.uiCreator.shouldPermanentHideVideoInfoUIBasedOnTitle?this.uiCreator.triggerEventToPermanentHideVideoInfoUI():this.shouldShowVideoInfo?this.uiCreator.showVideoInfoUI():(this.uiCreator.hideVideoInfoUI(),this.slider.updateSliderWidth())}get shouldShowVideoInfo(){return this.isProductUIDisplaying()}isProductUIDisplaying(){return!A.empty(this.slider.currentVideo.playerItemData.linkedproducts)&&(this.logger.log("Show video info"),!0)}},Qh=i(5672),Gh={};Gh.styleTagTransform=ht(),Gh.setAttributes=lt(),Gh.insert=st().bind(null,"head"),Gh.domAPI=nt(),Gh.insertStyleElement=dt(),it()(Qh.A,Gh),Qh.A&&Qh.A.locals&&Qh.A.locals;var Hh=i(7143),Wh={};Wh.styleTagTransform=ht(),Wh.setAttributes=lt(),Wh.insert=st().bind(null,"head"),Wh.domAPI=nt(),Wh.insertStyleElement=dt(),it()(Hh.A,Wh),Hh.A&&Hh.A.locals&&Hh.A.locals;const zh={viewType:{extend:"vimotia__variantForm_container--extend"}};var Kh=class extends fi{assembleUI(t,e,i){t.append(e,this.stock.container,i),Pt(t,zh.viewType.collapse,!0)}};const qh="vimotia__product-view--extend-card";var Yh=class extends bi{createVariantFormInstance(t){return new Kh(this.platform,this.product,this.stockWidget,t)}toggleUniqueClass(t){Pt(t,qh,!0)}},Jh=i(3219),Xh={};Xh.styleTagTransform=ht(),Xh.setAttributes=lt(),Xh.insert=st().bind(null,"head"),Xh.domAPI=nt(),Xh.insertStyleElement=dt(),it()(Jh.A,Xh),Jh.A&&Jh.A.locals&&Jh.A.locals;const $h="vimotia__product-view--mini-card--standalone";var Zh=class extends Xe{toggleTypeClass(t){Pt(t,$h,!0)}};const tp="vimotia-addToCart__list-wrapper",ep="vimotia-addToCart__list",ip="vimotia-addToCart__more",rp="vimotia-addToCart__more-text";class np extends Ko{assembleUIAndSetProducts(){this.addToCartButton=this.createPrimaryProductAddToCartButton();const{container:t,primaryProduct:e,moreButton:i}=this.createContainers(this.addToCartButton.container);this.container=t,this.setProducts(e,i).then()}createContainers(t){const e=Tt("div",{class:"vimotia-addToCart__primary"}),i=this.createMoreButton(),r=Tt("div",{class:"vimotia-addToCart__top"});r.append(i,e);const n=Tt("div",{class:"vimotia-addToCart--mobile"});return n.appendChild(r),this.widgetConfig.atc_enable&&n.appendChild(t),{container:n,primaryProduct:e,moreButton:i}}createMoreButton(){const t=Tt("div",{class:ip}),e=Tt("div",{class:rp},`Shop ${this.linkedProductCount} items`);return t.append(e),t}createPrimaryProductAddToCartButton(){return new ui(this.widgetConfig)}async setProducts(t,e){const i=await this.createAllProducts(),r=this.getPrimaryProduct(i);this.setPrimaryProductView(r,t);const{listWrapper:n,listContainer:a}=this.createProductListContainers(),s=this.createDialogForProductList(n,a);this.listenToPrimaryAddToCartButton(r,s),this.setAllProducts(n,a,i,s),i.length>1&&this.showMoreButton(e,n,s)}getPrimaryProduct(t){const e=t.find((t=>!t.isOutOfStock));return A.nullOrUndefined(e)?t[0]:e}setPrimaryProductView(t,e){if(A.nullOrUndefined(t))return void this.logger.error("Expect a primary product, but got null");const i=new Zh(this.platform,t);this.listenToPrimaryProductClick(i.container,t),e.appendChild(i.container)}listenToPrimaryProductClick(t,e){t.addEventListener(Je,(async()=>{this.pauseVideo(),await this.setPrimaryProductDetailViewInDialog(e)}))}async setPrimaryProductDetailViewInDialog(t){const e=this.createDialog();e.show();const i=new ko(this.platform,t,this.widgetConfig);await e.setBody(i.container),e.removeBodyPadding(),e.setTitleWithElement(this.createDetailViewHeaderTitle())}createProductListContainers(){const t=Tt("div",{class:tp}),e=Tt("div",{class:ep});return t.appendChild(e),{listWrapper:t,listContainer:e}}createDialogForProductList(t,e){const i=this.createDialog();return i.setbackButtonAction((()=>{np.showList(t,e).then((()=>{i.setTitleWithPlainText(this.productListViewTitlePlainText),i.hideLeftButton(),i.resetBodyPadding()}))})),i}static async showList(t,e){Ht.fadeOut(t),await Ht.waitAnimationEnd(),St(t),t.appendChild(e),await Ht.waitToStartAnimation(),Ht.fadeIn(t)}listenToPrimaryAddToCartButton(t,e){this.addToCartButton.container.addEventListener("click",(async()=>{if(this.pauseVideo(),A.nullOrUndefined(t))return void this.logger.error("Expected a primary product instance but got null");const i=await this.setProductExtendCardViewInDialog(t,e);t.hasOnlyDefaultVariant?this.addPrimaryProductDirectly(i.variantForm,t):(e.show(),this.listenToMiniCardClickInDialog(i.container,t,e))}))}async setProductExtendCardViewInDialog(t,e){const i=new Yh(this.platform,t,this.widgetConfig);return await e.setBody(i.container),e.setTitleWithPlainText("Select a Variant"),e.hideLeftButton(),i}listenToMiniCardClickInDialog(t,e,i){t.addEventListener(Je,(async()=>{const t=new ko(this.platform,e,this.widgetConfig);await i.setBody(t.container),i.removeBodyPadding(),i.setTitleWithPlainText(ge),i.showLeftButton(),i.setbackButtonAction((async()=>{i.resetBodyPadding();const t=await this.setProductExtendCardViewInDialog(e,i);this.listenToMiniCardClickInDialog(t.container,e,i)}))}))}addPrimaryProductDirectly(t,e){this.addToCartWithDefaultVariant(e,t,this.elemens.container,(()=>{this.addToCartButton.setSuccessState().then()})),this.addToCartButton.setAddingItemState()}addToCartWithDefaultVariant(t,e,i,r){bt(i,ve,!0,{widgetId:this.widgetConfig.widget_id,productId:t.productId});const{GOTO_CART_PAGE:n}=me;this.platform.addToCart(t,e.currentOptions,{redirectToCartPage:this.widgetConfig.atc_click_effect===n,onSuccess:()=>{(new ni).success(oi),A.function(r)&&r()}})}setAllProducts(t,e,i,r){i.forEach((i=>{window.setTimeout((()=>{this.addProductToList(t,e,i,r)}),200)}))}addProductToList(t,e,i,r){const n=new bi(this.platform,i,this.widgetConfig,{enableStockWidget:this.widgetConfig.enable_widget_on_product_list,enableMessageWidget:this.widgetConfig.enable_widget_on_product_list,enableTimerWidget:this.widgetConfig.enable_widget_on_product_list});this.listenToProductInList(n.container,t,i,r),e.appendChild(n.container)}listenToProductInList(t,e,i,r){t.addEventListener(Je,(async()=>{await this.setProductDetailViewInProductListDialog(e,i,r)}))}async setProductDetailViewInProductListDialog(t,e,i){Ht.fadeOut(t),await Ht.waitAnimationEnd();const r=new ko(this.platform,e,this.widgetConfig);i.removeBodyPadding(),i.setTitleWithElement(this.createDetailViewHeaderTitle()),i.showLeftButton(),i.scrollBodyToTop(),St(t),t.appendChild(r.container),await Ht.waitToStartAnimation(),Ht.fadeIn(t)}showMoreButton(t,e,i){Pt(this.elemens.container,"vimotia-addToCart--has-more",!0),this.listenToMoreButton(t,e,i)}listenToMoreButton(t,e,i){vt(t,"click",(()=>{this.pauseVideo(),i.show(),i.setTitleWithPlainText(this.productListViewTitlePlainText),i.setBody(e).then()}))}get productListViewTitlePlainText(){return`${this.linkedProductCount} items in video`}pauseVideo(){bt(this.elemens.container,ju,!0)}}var ap=np,sp=class{constructor(){this.logger=E(),this.stateClient=tt(),this.classNames={swipeUpMsgOverlay:{container:"vimotia--swipe-up-msg-container",innerContainer:"vimotia--swipe-up-msg__inner-container",icon:"vimotia--swipe-up-msg__icon",text:"vimotia--swipe-up-msg__text"}},this.init()}init(){if(!this.stateClient.shouldShowSwipeInstruction)return;if(this.stateClient.swipeHintCreated)return;this.stateClient.swipeHintCreated=!0;const t=this.createContainers();this.inject(t),this.listenDismiss(t)}createContainers(){const t=Tt("div",{class:this.classNames.swipeUpMsgOverlay.container}),e=Tt("div",{class:this.classNames.swipeUpMsgOverlay.innerContainer}),i=te.createSwipeUpHandLine([this.classNames.swipeUpMsgOverlay.icon]),r=Tt("div",{class:this.classNames.swipeUpMsgOverlay.text},"Swipe up for more");return e.append(i,r),t.appendChild(e),t}inject(t){document.querySelector("body").appendChild(t)}listenDismiss(t){vt(t,"click",(()=>{this.hide(t)}))}hide(t){kt(t,!0),this.stateClient.swipeHintDismissedTimestamp=+new Date}};class op extends Vh{listenToUniqueEvents(){this.uiCreator.listenToPermanentHideVideoInfo(),this.stateClient.isAppleDevice&&this.listenUnlockVideos()}createUI(){this.createBaseUI(),new sp}toggleVideoInfoUI(){this.uiCreator.shouldPermanentHideVideoInfoUIBasedOnTitle&&this.uiCreator.triggerEventToPermanentHideVideoInfoUI()}createAddToCartWidgetView(){return new ap(this.slider.currentVideo.playerItemData,this.platform)}listenUnlockVideos(){vt(this.uiCreator.container,"touchstart",(()=>{this.slider.hasVideosInUnlockQueue&&this.unlockVideos()}))}unlockVideos(){this.logger.log(`[Collection Mobile] unlocking ${this.slider.videoCountInUnlockQueue} videos`),this.slider.videosInUnlockQueue.forEach((t=>{t.play(),window.setTimeout((()=>{t.stop()}),500)})),this.slider.removeAllVideosInUnlockQueue()}play(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;this.prePlay(t),tt().isAppleDevice&&this.slider.hasVideosInUnlockQueue?(this.slider.forceSyncVideosToUnlockQueue(),this.unlockVideos(),window.setTimeout((()=>{this.playOnMobile()}),500)):this.playOnMobile()}playOnMobile(){op.disableBodyScrolling(),window.setTimeout((()=>{this.show(),this.runPrePlayTasks(),this.slider.currentVideo.play()}),200),this.postPlay()}stop(){op.enableBodyScrolling(),this.hide(),this.postStop(),window.setTimeout((()=>{this.reset()}),200)}static disableBodyScrolling(){document.body.style.top=`-${window.scrollY}px`}static enableBodyScrolling(){const t=document.body.style.top;document.body.style.top="",window.scrollTo(0,-1*parseInt(t||"0",10))}}var lp=op,cp=i(5867),dp={};dp.styleTagTransform=ht(),dp.setAttributes=lt(),dp.insert=st().bind(null,"head"),dp.domAPI=nt(),dp.insertStyleElement=dt(),it()(cp.A,dp),cp.A&&cp.A.locals&&cp.A.locals;var up={fadeIn:"vimotia-fade-in",fadeOut:"vimotia-fade-out"},hp={container:"swiper",wrapper:"swiper-wrapper",slide:"swiper-slide",buttonPrev:"swiper-button-prev",buttonNext:"swiper-button-next"},pp=class{constructor(){this.logger=E(),this.stateClient=tt(),this.state={activeIndex:0,currentVideo:null,currentPage:0,hasNext:!0},this.slider=null,this.videosIdInOrder=[],this.videosInSlider=[],this.videoConfigById={},this.videosWaitingToUnlock=[],this.elements={slider:{container:null,wrapper:null,buttonPrev:null,buttonNext:null}},this.classNames={slider:{container:"vimotia--collection__video__slider",buttonPrev:"vimotia--collection__video__slider__button-prev",buttonNext:"vimotia--collection__video__slider__button-next"}},this.init()}init(){const{slider:t,wrapper:e,buttonPrev:i,buttonNext:r}=this.createSliderContainers();this.elements.slider.container=t,this.elements.slider.wrapper=e,this.elements.slider.buttonPrev=i,this.elements.slider.buttonNext=r,this.instance=this.createSlider()}createSliderContainers(){const t=Tt("div",{class:`${hp.container} ${this.classNames.slider.container}`}),e=Tt("div",{class:hp.wrapper}),i=Tt("div",{class:`${hp.buttonPrev} ${this.classNames.slider.buttonPrev}`});i.append(te.createRoundArrow());const r=Tt("div",{class:`${hp.buttonNext} ${this.classNames.slider.buttonNext}`});return r.append(te.createRoundArrow()),t.appendChild(e),t.appendChild(i),t.appendChild(r),{slider:t,wrapper:e,buttonPrev:i,buttonNext:r}}get sliderContainer(){return this.elements.slider.container}get sliderWrapper(){return this.elements.slider.wrapper}get sliderButtonPrev(){return this.elements.slider.buttonPrev}get sliderButtonNext(){return this.elements.slider.buttonNext}appendASlide(t){const e=this.createASlide(t);this.sliderWrapper.appendChild(e)}createASlide(t){const e=Tt("div",{class:hp.slide});return A.nullOrUndefined(t.container)?(this.logger.error(`collection: expect to get a video container but got ${t.container}`),e):(e.appendChild(t.container),e)}createSlider(){throw new Error("play needs to be integrated in subclass")}appendAllVideosToSlide(){this.hasNoVideos&&this.logger.warn("collection: no video instance"),this.videos.forEach((t=>{this.appendASlide(t),window.setTimeout((()=>{t.addPlayer()}),0)}))}appendSlide(t){this.instance.appendSlide(t)}prependSlide(t){this.instance.prependSlide(t)}removeSlide(t){this.instance.removeSlide(t)}removeAllSlides(){this.instance.removeAllSlides()}slideTo(t,e,i){if(this.videoCount2}get headHasSufficientVideos(){return this.activeIndex>2}get extraSlidesToRemoveCount(){return this.slidesCount-10}get hasNoExtraSlidesToRemove(){return this.extraSlidesToRemoveCount<=0}get shouldNotRemoveSlidesFromHead(){return this.activeIndex<=this.extraSlidesToRemoveCount+2-1}get remainingSlidesCount(){return this.slidesCount-this.extraSlidesToRemoveCount}get shouldNotRemoveSlidesFromTail(){return this.activeIndex>=this.remainingSlidesCount-3}appendVideo(t){this.videosInSlider.push(t)}prependVideo(t){this.videosInSlider.unshift(t)}removeVideos(t){this.videosInSlider=function(t,e){if(!A.array(t))return null;if(0===e.length)return t;if(1===e.length){const i=t;return i.splice(e[0],1),i}const i=[];return t.forEach(((t,r)=>{e.includes(r)||i.push(t)})),i}(this.videosInSlider,t)}removeAllVideos(){this.videosInSlider.length=0}get hasNoVideos(){return A.empty(this.videosInSlider)}get videos(){return this.videosInSlider}get videoCount(){return this.videos.length}appendVideoId(t){this.videosIdInOrder.push(t)}containsVideoId(t){return this.videosIdInOrder.includes(t)}videoId(t){return this.videosIdInOrder[t]}extendVideosWithDuplication(){this.videosIdInOrder=this.videosIdInOrder.concat(this.videosIdInOrder)}removeAllVideoIds(){this.videosIdInOrder=[]}cacheVideoConfig(t){this.videoConfigById[t.video.video_id]=t}videoConfig(t){return this.videoConfigById[t]}removeAllVideoConfigs(){this.videoConfigById={}}appendVideoToUnlockQueue(t){this.videosWaitingToUnlock.push(t)}removeAllVideosInUnlockQueue(){this.videosWaitingToUnlock.length=0}get hasVideosInUnlockQueue(){return!A.empty(this.videosWaitingToUnlock)}get videoCountInUnlockQueue(){return this.videosWaitingToUnlock.length}forceSyncVideosToUnlockQueue(){this.videosWaitingToUnlock=[...this.videos]}get videosInUnlockQueue(){return this.videosWaitingToUnlock}muteAllVideos(){this.videos.forEach((t=>t.setMuted(!1)))}get videoActiveIndex(){return this.state.activeIndex}set videoActiveIndex(t){this.state.activeIndex=t}resetVideoActiveIndex(){this.videoActiveIndex=0}get currentVideo(){return this.state.currentVideo}set currentVideo(t){this.state.currentVideo=t}get currentVideoTitle(){return this.currentVideo.title}get nextVideoTitle(){if(this.videoActiveIndex===this.videosIdInOrder.length)return"";const t=this.videoActiveIndex+1,e=this.videosInSlider[t];return A.nullOrUndefined(e)?(this.logger.warn(`Expect to find next video at index ${t}, but got null. Usually, it means there are no swipe videos`),""):e.title}get currentSwipeVideoDataPage(){return this.state.currentPage}set currentSwipeVideoDataPage(t){this.state.currentPage=t}resetSwipeVideoDataPage(){this.currentSwipeVideoDataPage=0}get hasMoreSwipeVideoData(){return this.state.hasNext}set hasMoreSwipeVideoData(t){this.state.hasNext=t}appendAVideoToSlider(t){const e=this.createASlide(t);this.appendSlide(e),this.appendVideo(t),this.appendVideoToUnlockQueue(t),t.addPlayer(),t.ready()}prependAVideoToSlider(t){const e=this.createASlide(t);this.prependSlide(e),this.prependVideo(t),this.appendVideoToUnlockQueue(t),t.addPlayer(),t.ready()}removeSlidesFromTail(){const t=this.getTailIndexesToRemove();t.includes(this.activeIndex)?this.logger.error(`collection: this should not happen. Playing a video at index ${this.activeIndex} potentially to be removed`):(this.removeSlide(t),this.removeVideos(t),this.logger.log(`collection: removed slides at indexes ${t}`))}getTailIndexesToRemove(){if(this.shouldNotRemoveSlidesFromTail)return this.logger.log("collection: stop removing to keep minimum 3 at tail"),[];this.logger.log("collection: remove slides from tail");const t=[];for(let e=this.remainingSlidesCount;e{St(this.linkContainer),Pt(this.linkContainer,up.fadeOut,!1),this.linkContainer.append(...t)}),300),window.setTimeout((()=>{Pt(this.linkContainer,up.fadeIn,!0)}),300),window.setTimeout((()=>{Pt(this.linkContainer,up.fadeIn,!1)}),300)}async setProductWidget(t){Ht.fadeOut(this.productContainer),await Ht.waitAnimationEnd(),St(this.productContainer),A.nullOrUndefined(t)||(this.productContainer.appendChild(t),await Ht.waitToStartAnimation(),Ht.fadeIn(this.productContainer))}setStickerWidget(t){St(this.stickerContainer),this.stickerContainer.append(...t)}get productContainer(){return this.elements.widgetHolderContainer.product}set productContainer(t){this.elements.widgetHolderContainer.product=t}get linkContainer(){return this.elements.widgetHolderContainer.link}set linkContainer(t){this.elements.widgetHolderContainer.link=t}get stickerContainer(){return this.elements.widgetHolderContainer.sticker}set stickerContainer(t){this.elements.widgetHolderContainer.sticker=t}get discountContainer(){return this.elements.widgetHolderContainer.discount}set discountContainer(t){this.elements.widgetHolderContainer.discount=t}},Lp=class{constructor(t){this.logger=E(),this.stateClient=tt(),this.widgetUICreator=new Dp,this.actionUICreator=Ep.create(),this.buttonUICreator=new xp,this.backdropUICreator=new Tp,this.slider=t,this.elements={container:null,info:{container:null},video:{container:null}},this.classNames={container:"vimotia--collection",containerStyle:{popup:"vimotia--collection--popup",position:"vimotia--full-view-center"},containerState:{visible:"vimotia--visible",hideVideoInfo:"vimotia-collection--hide-video-info",permanentHideVideoInfo:"vimotia-collection--hide-video-info--permanent"},info:{container:"vimotia--collection__video-info"},video:{container:"vimotia--collection__video"}},this.init()}init(){this.initVideoUI(),this.initVideoInfoContainers(),this.assembleProductWidgetUI();const t=this.createMainContainer();t.append(this.videoContainer,this.videoInfoContainer),this.container=t}setSoundIcon(){this.buttonUICreator.setSoundIcon().then()}setMuteIcon(){this.buttonUICreator.setMuteIcon().then()}initVideoUI(){this.assembleTopAction(),this.assembleSideAction(),this.assembleBottomAction();const t=this.createVideoContainer();t.append(this.slider.sliderContainer,this.actionUICreator.container),this.videoContainer=t}assembleTopAction(){this.actionUICreator.topActionLeftContainer.appendChild(this.buttonUICreator.closeButton),this.actionUICreator.topActionLeftContainer.appendChild(Ho.createLogo())}assembleSideAction(){this.actionUICreator.sideActionTopContainer.append(this.widgetUICreator.stickerContainer),this.actionUICreator.sideActionCenterContainer.append(this.slider.sliderButtonPrev,this.slider.sliderButtonNext),this.assembleSideBottomAction()}assembleSideBottomAction(){throw new Error("implement it in the sub class")}assembleBottomAction(){throw new Error("implement it in the sub class")}createVideoContainer(){return Tt("div",{class:this.classNames.video.container})}initVideoInfoContainers(){this.videoInfoContainer=this.createVideoInfoContainer()}createVideoInfoContainer(){return Tt("div",{class:this.classNames.info.container})}showVideoInfoUI(){Pt(this.container,this.classNames.containerState.hideVideoInfo,!1)}hideVideoInfoUI(){Pt(this.container,this.classNames.containerState.hideVideoInfo,!0)}get shouldPermanentHideVideoInfoUIBasedOnTitle(){return this.slider.currentVideo.linkedProductsData.some((t=>t.product_title.includes("__hidden__")))}triggerEventToPermanentHideVideoInfoUI(){bt(document.querySelector("body"),Pn)}listenToPermanentHideVideoInfo(){vt(document.querySelector("body"),Pn,(()=>{this.logger.log("Permanently hide video info due to __hidden__ in title"),Pt(this.container,this.classNames.containerState.permanentHideVideoInfo,!0)}))}assembleProductWidgetUI(){throw new Error("implement it in the sub class")}repaintProductUI(){zt(this.widgetUICreator.productContainer)}createMainContainer(){return Tt("div",{class:`${this.classNames.container} ${this.classNames.containerStyle.popup} ${this.classNames.containerStyle.position}`})}hideMainContainer(){Pt(this.container,this.classNames.containerState.visible,!1)}showMainContainer(){Pt(this.container,this.classNames.containerState.visible,!0)}setCurrentLinkWidget(t){this.widgetUICreator.setLinkWidget(t)}setCurrentProductWidget(t){this.widgetUICreator.setProductWidget(t).then((()=>{this.repaintProductUI()}))}setCurrentStickerWidget(t){this.widgetUICreator.setStickerWidget(t)}setControlsContainer(t){St(this.controlsContainer),this.controlsContainer.append(t)}setCurrentTimeContainer(t){St(this.currentTimeContainer),this.currentTimeContainer.append(t)}setThemeColor(t){Ct(this.container,{style:`--vimotia-theme: ${t}`})}hide(){this.hideMainContainer(),this.backdropUICreator.hide()}show(){this.backdropUICreator.show(),this.showMainContainer()}inject(){document.body.appendChild(this.container)}get container(){return this.elements.container}set container(t){this.elements.container=t}get videoContainer(){return this.elements.video.container}set videoContainer(t){this.elements.video.container=t}get videoInfoContainer(){return this.elements.info.container}set videoInfoContainer(t){this.elements.info.container=t}get controlsContainer(){return this.actionUICreator.bottomActionControlsTopContainer}get currentTimeContainer(){return this.actionUICreator.currentPlayTimeContainer}set currentPlayText(t){this.actionUICreator.currentPlayText=t}set nextPlayText(t){this.actionUICreator.nextPlayText=t}get closeButton(){return this.buttonUICreator.closeButton}get soundButton(){return this.buttonUICreator.soundButton}get discountContainer(){return this.widgetUICreator.discountContainer}},Bp=class extends Lp{assembleSideBottomAction(){this.actionUICreator.sideActionBottomContainer.append(this.widgetUICreator.linkContainer,this.widgetUICreator.discountContainer)}assembleBottomAction(){this.actionUICreator.bottomActionBottomRowContainer.append(this.actionUICreator.bottomActionControlsWrapper,this.buttonUICreator.soundButton)}assembleProductWidgetUI(){this.videoInfoContainer.append(this.widgetUICreator.productContainer)}},Op=class extends Lp{assembleSideBottomAction(){this.actionUICreator.sideActionBottomContainer.append(this.widgetUICreator.linkContainer,this.widgetUICreator.discountContainer,this.buttonUICreator.soundButton)}assembleBottomAction(){this.actionUICreator.bottomActionBottomRowContainer.append(this.actionUICreator.bottomActionControlsWrapper)}assembleProductWidgetUI(){this.actionUICreator.bottomActionContainer.prepend(this.widgetUICreator.productContainer)}},Rp=i(6914),Mp={};Mp.styleTagTransform=ht(),Mp.setAttributes=lt(),Mp.insert=st().bind(null,"head"),Mp.domAPI=nt(),Mp.insertStyleElement=dt(),it()(Rp.A,Mp),Rp.A&&Rp.A.locals&&Rp.A.locals;var Np=i(568),Fp={};Fp.styleTagTransform=ht(),Fp.setAttributes=lt(),Fp.insert=st().bind(null,"head"),Fp.domAPI=nt(),Fp.insertStyleElement=dt(),it()(Np.A,Fp),Np.A&&Np.A.locals&&Np.A.locals;class Up extends Ko{assembleUIAndSetProducts(){const{slider:t,container:e}=this.createSlider();this.setProductsInSlider(t).then(),this.container=e}createSlider(){const t=Tt("div",{class:"vimotia-addToCart--slider"}),e=Tt("div",{class:hp.container}),i=Tt("div",{class:hp.wrapper});return t.appendChild(e),e.appendChild(i),{slider:new Js(e,{modules:[so],slidesPerView:"auto",spaceBetween:6}),container:t}}async setProductsInSlider(t){(await this.createAllProducts()).forEach((e=>{const i=this.createProductView(e);this.lazySetProductViewInSlider(i,t)}))}createProductView(t){const e=new Zh(this.platform,t);return this.listenToSlideClick(e.container,t),e}lazySetProductViewInSlider(t,e){window.setTimeout((()=>{Up.appendToSlider(e,t.container)}),200)}listenToSlideClick(t,e){t.addEventListener(Je,(async()=>{this.recordWidgetClick(e,this.elemens.container);const t=this.createDialog();t.show();const i=new ko(this.platform,e,this.widgetConfig);await t.setBody(i.container),t.removeBodyPadding(),t.setTitleWithPlainText(ge)}))}recordWidgetClick(t,e){bt(e,ye,!0,{widgetId:this.widgetConfig.widget_id,productId:t.productId})}static appendToSlider(t,e){const i=Tt("div",{class:`${hp.slide}`});i.appendChild(e),t.appendSlide(i)}}var Vp=Up;var jp=class{constructor(){this.logger=E(),this.widgetUICreator=new Dp,this.actionUICreator=Ep.create(),this.buttonUICreator=new xp,this.elements={container:null,video:{container:null}},this.classNames={container:"vimotia--embedded",containerTypes:{atcOverlay:"vimotia--embedded--atc-overlap"},video:{container:"vimotia--embedded__video"},product:{container:"vimotia--embedded__product-widget",hidden:"hidden"}},this.init()}init(){this.initVideoUI(),this.container=this.createMainContainer(),this.applyProductWidgetStyle(this.productContainer)}initVideoUI(){this.assembleTopAction(),this.assembleSideAction(),this.assembleBottomAction(),this.videoContainer=this.createVideoContainer(),this.videoContainer.append(this.actionUICreator.container),kt(this.videoContainer,!0)}assembleTopAction(){this.actionUICreator.topActionLeftContainer.appendChild(Ho.createLogo())}assembleSideAction(){this.actionUICreator.sideActionTopContainer.append(this.widgetUICreator.stickerContainer),this.assembleSideBottomAction()}assembleSideBottomAction(){this.actionUICreator.sideActionBottomContainer.append(this.widgetUICreator.linkContainer,this.widgetUICreator.discountContainer)}assembleBottomAction(){this.actionUICreator.bottomActionBottomRowContainer.append(this.actionUICreator.bottomActionControlsWrapper,this.buttonUICreator.soundButton)}createVideoContainer(){return Tt("div",{class:this.classNames.video.container})}createMainContainer(){return Tt("div",{class:this.classNames.container})}applyProductWidgetStyle(t){Pt(t,this.classNames.product.container,!0),Pt(t,this.classNames.product.hidden,!0)}showProductWidget(){Pt(this.productContainer,this.classNames.product.hidden,!1),window.dispatchEvent(new Event("resize"))}showVideo(){kt(this.videoContainer,!1)}assembleContainers(t,e){throw new Error("implement it in the sub class")}setCurrentLinkWidget(t){this.widgetUICreator.setLinkWidget(t)}setCurrentProductWidget(t){this.widgetUICreator.setProductWidget(t).then()}setCurrentStickerWidget(t){this.widgetUICreator.setStickerWidget(t)}setControlsContainer(t){St(this.controlsContainer),this.controlsContainer.append(t)}setCurrentTimeContainer(t){St(this.currentTimeContainer),this.currentTimeContainer.append(t)}setThemeColor(t){Ct(this.container,{style:`--vimotia-theme: ${t}`})}setSoundIcon(){this.buttonUICreator.setSoundIcon().then()}setMuteIcon(){this.buttonUICreator.setMuteIcon().then()}get soundButton(){return this.buttonUICreator.soundButton}set currentPlayText(t){this.actionUICreator.currentPlayText=t}set nextPlayText(t){this.actionUICreator.nextPlayText=t}get controlsContainer(){return this.actionUICreator.bottomActionControlsTopContainer}get currentTimeContainer(){return this.actionUICreator.currentPlayTimeContainer}get container(){return this.elements.container}set container(t){this.elements.container=t}get videoContainer(){return this.elements.video.container}set videoContainer(t){this.elements.video.container=t}get productContainer(){return this.widgetUICreator.productContainer}get discountContainer(){return this.widgetUICreator.discountContainer}},Qp=class extends jp{assembleContainers(t,e){this.videoContainer.append(t,this.actionUICreator.container),this.container.append(this.videoContainer,e),this.actionUICreator.bottomActionContainer.prepend(this.productContainer),this.setOverlapStyleProductWidget()}setOverlapStyleProductWidget(){Pt(this.container,this.classNames.containerTypes.atcOverlay,!0)}},Gp=class extends jp{assembleContainers(t,e){this.videoContainer.append(t,this.actionUICreator.container),this.container.append(this.videoContainer,this.productContainer,e)}},Hp=class{static create(t){switch(t.embededPlayWidgetPosition){case"new_line":return new Gp;case"overlay":return new Qp;default:throw new Error(`Unknown embedded play product widget position type ${t.embededPlayWidgetPosition}`)}}},Wp=class{constructor(t){this.logger=E(),this.stateClient=tt(),this.playerItem=t,this.platform=Mu(),this.data=this.getDataBasedOnDevice(this.playerItem.player),this.uiCreator=Hp.create(this.data),this.discount=null,this.state={injected:!1},this.init()}init(){const t=this.createPlayButton(),e=this.createVideo(t.themeColor);this.uiCreator.assembleContainers(e.container,t.container),this.uiCreator.setThemeColor(t.themeColor),this.listenToPlayButton(t,e),this.setWidgets(e),this.inject(t),e.addPlayer(),e.ready(),t.postInject(),this.syncSoundStateOnCurrentVideo(e),this.listenToSoundButton(this.uiCreator.soundButton,e),this.autoPlayIfSet(t,e,1e3*this.data.autoStartSeconds-500)}createPlayButton(){return new Eh(this.playerItem).create()}createVideo(t){const e={firstVideoIdInList:`${this.playerItem.video.video_id}`,prevVideoIdAsSwipeReferrer:""};return new vh(this.playerItem,e,this.platform,{lazyLoading:this.stateClient.isLazyLoading,themeColor:t})}listenToPlayButton(t,e){vt(t.container,"click",(()=>{jn()?this.logger.log("In dev env. Return."):this.play(t,e)}),!1)}play(t,e){this.stateClient.clearCollectionAutoPlayTimer(),t.hide().then(),this.uiCreator.showVideo(),e.play(),t.destroy(),this.movePlayerControlsToTarget(e),this.setCurrentAndNextPlayText(e),e.hasLinkedProducts&&setTimeout((()=>{this.uiCreator.showProductWidget()}),300)}movePlayerControlsToTarget(t){this.uiCreator.setControlsContainer(t.controlsContainer),this.uiCreator.setCurrentTimeContainer(t.currentTimeContainer)}setCurrentAndNextPlayText(t){this.uiCreator.currentPlayText=t.title,this.uiCreator.nextPlayText=""}listenToSoundButton(t,e){A.nullOrUndefined(t)?this.logger.error("expect a sound button container, but got null"):vt(t,"click",(()=>{this.stateClient.isMuted=!this.stateClient.isMuted,this.syncSoundStateOnCurrentVideo(e)}))}syncSoundStateOnCurrentVideo(t){this.stateClient.isMuted?this.muteVideo(t):this.unmuteVideo(t)}muteVideo(t){this.logger.log("Mute video"),this.uiCreator.setMuteIcon(),t.setMuted(!0)}unmuteVideo(t){this.logger.log("Unmute video"),this.uiCreator.setSoundIcon(),t.setMuted(!1)}setWidgets(t){return!!this.getShowingAddToCartWidget()&&(this.setAddToCartWidget(),this.setAnnotationLinkWidget(t),this.setDecorationWidget(t),this.setStickerWidget(),this.setDiscountAndAnalytics(t),this.listenToPausePlayFromAddToCartWidget(t),!0)}getShowingAddToCartWidget(){const{isProductPage:t}=this.platform,e=!Ko.getAddToCartWidgetConfig(this.playerItem.widgets).atc_enable;return!t||!e}setAddToCartWidget(){const t=new Vp(this.playerItem,this.platform);this.uiCreator.setCurrentProductWidget(t.container)}setAnnotationLinkWidget(t){const e=Ph.createAll(this.playerItem.widgets);t.listenToAnnotationLinkDisplayWindow(e),this.uiCreator.setCurrentLinkWidget(e.map((t=>t.container))),e.forEach((t=>t.showLink()))}setDecorationWidget(t){const e=Oh.create(this.playerItem.widgets);t.appendDecoration(e)}setStickerWidget(){const t=Fh.create(this.playerItem.widgets);this.uiCreator.setCurrentStickerWidget(t)}setDiscountAndAnalytics(t){const e=this.setDiscountWidget();this.setAnalytics(t,e)}setDiscountWidget(){const t=pl.filterConfigFromList(this.playerItem.widgets),e=new pl(t,this.platform,this.uiCreator.discountContainer);return this.discount=e,e}setAnalytics(t,e){const i=new Vn(`${t.id}`,`${t.playerId}`,this.platform,e);t.setAnalytics(i)}listenToPausePlayFromAddToCartWidget(t){vt(this.uiCreator.container,ju,(()=>{t.pause()}))}inject(t){A.nullOrUndefined(t.targetFromXPath)?this.logger.error(`Cannot find target place from XPath: ${t.config.play_button_xpath}`):(t.targetFromXPath.appendChild(this.uiCreator.container),this.logger.log("[Embedded] inject to: ",t.targetFromXPath))}autoPlayIfSet(t,e,i){this.stateClient.isFirstCollectionAutoPlay&&this.data.autoStart&&(this.stateClient.collectionAutoPlayTimer=window.setTimeout((()=>{this.muteVideo(e),this.play(t,e)}),i))}getDataBasedOnDevice(t){return this.stateClient.isMobile?{autoStart:t.auto_start_m,autoStartSeconds:t.auto_start_seconds_m,embededPlayWidgetPosition:t.embeded_play_widget_position_m}:{autoStart:t.auto_start,autoStartSeconds:t.auto_start_seconds,embededPlayWidgetPosition:t.embeded_play_widget_position}}},zp=i(9474),Kp={};Kp.styleTagTransform=ht(),Kp.setAttributes=lt(),Kp.insert=st().bind(null,"head"),Kp.domAPI=nt(),Kp.insertStyleElement=dt(),it()(zp.A,Kp),zp.A&&zp.A.locals&&zp.A.locals;var qp=i(9567),Yp={};Yp.styleTagTransform=ht(),Yp.setAttributes=lt(),Yp.insert=st().bind(null,"head"),Yp.domAPI=nt(),Yp.insertStyleElement=dt(),it()(qp.A,Yp),qp.A&&qp.A.locals&&qp.A.locals;var Jp=class{constructor(t){this.logger=E(),this.platform=Mu(),A.empty(t)?this.logger.error(`expect player item but got "${t}"`):(this.playerItem=t,this.videoInstance=null,this.elements={container:null},this.init())}init(){this.container=this.createContainer(),this.video=this.createVideo(),this.container.append(this.video.container),this.video.addPlayer()}createContainer(){return Tt("div",{class:"vimotia-gallery__gallery-player"})}createVideo(){const t={muteOnMobile:!0,firstVideoIdInList:`${this.playerItem.video.video_id}`,prevVideoIdAsSwipeReferrer:""};return new vh(this.playerItem,t,this.platform,{analytics:!1,loop:!0})}play(){this.video.setMuted(!0),this.video.play()}stop(){this.video.stop()}set container(t){this.elements.container=t}get container(){return this.elements.container}set video(t){this.videoInstance=t}get video(){return this.videoInstance}},Xp=class{constructor(t){this.dataLookup=this.createDataLookup(t),this.playerLookup={}}create(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};const i=this.playerLookup[t];if(!A.nullOrUndefined(i))return i;const r=this.dataLookup[t];if(A.nullOrUndefined(r))throw new Error("Expect data when create a gallery player in creator but got null");const n=new Jp(r);if(this.playerLookup[`${t}`]=n,!0===e.autoPlay){let t=n.elements.container.getElementsByClassName("vimotia__videos");for(let e=0;e{e[`${t.player.id}`]=t})),e}};const $p="vimotia--gallery-item",Zp="vimotia--gallery-title--small",tg="vimotia--gallery-title--medium",eg="vimotia--gallery-title--large",ig="vimotia--gallery--grid",rg="vimotia--gallery--slider",ng="vimotia--gallery--page",ag=1,sg=2,og=4,lg=2,cg=24,dg=24,ug=0,hg=0;var pg=i(60),gg={};gg.styleTagTransform=ht(),gg.setAttributes=lt(),gg.insert=st().bind(null,"head"),gg.domAPI=nt(),gg.insertStyleElement=dt(),it()(pg.A,gg),pg.A&&pg.A.locals&&pg.A.locals;class fg{constructor(t){this.logger=E(),this.platform=Mu(),this.data=fg.createData(t),this.stateClient=tt(),this.elements={container:null},this.init()}init(){this.container=this.createContainer(),this.setStyle(),!A.empty(this.data.title)&&this.container.appendChild(this.createHeader())}setStyle(){this.setTitleClass(),this.setLayoutClass(),this.setCssVar()}setTitleClass(){Pt(this.container,this.titleSizeClassName,!0)}get titleSizeClassName(){switch(this.data.titleSize){case Qn:return Zp;case Gn:return tg;case Hn:return eg;default:throw new Error("Unknown title size in gallery list config")}}setLayoutClass(){throw new Error("implement it in the subclass")}setCssVar(){Ut(this.container,{[Zn]:this.data.spacingTop,[ta]:this.data.spacingBottom,[ea]:this.data.spacingLeft,[ia]:this.data.spacingRight,[ra]:this.data.titleColor})}createContainer(){return Tt("div",{class:"vimotia--gallery"})}createHeader(){const t=Tt("div",{class:"vimotia--gallery-header"});let e;switch(this.data.titleSize){case Qn:e="h3";break;case Gn:e="h2";break;case Hn:e="h1";break;default:throw new Error("Unknown gallery title size")}const i=Tt(e,{class:"vimotia--gallery-title"},this.data.title);return t.appendChild(i),t}createItem(t,e){return Tt("div",{class:$p,style:this.getItemCssVar(t),[`data-${aa}`]:e,[`data-${sa}`]:t.player.id})}getItemCssVar(t){const e=[],i=this.getPlayButtonCssVar(t.player);e.push(i);const r=this.getItemBackgroundCssVar(t.video);return e.push(r),e.join("")}getPlayButtonCssVar(t){const{play_button_bgcolor_cir:e,play_button_bgcolor_cir_m:i,play_button_brcolor_cir:r,play_button_brcolor_cir_m:n,play_button_bgcolor_tri:a,play_button_bgcolor_tri_m:s,play_button_brcolor_tri:o,play_button_brcolor_tri_m:l}=t,{CIRCLE_BG_COLOR:c,CIRCLE_BORDER_COLOR:d,TRIANGLE_BG_COLOR:u,TRIANGLE_BORDER_COLOR:h}=na;let p=e,g=r,f=a,m=o;return this.stateClient.isMobile&&(p=i,g=n,f=s,m=l),`\n ${c}: ${p};\n ${d}: ${g};\n ${u}: ${f};\n ${h}: ${m};\n `}getItemBackgroundCssVar(t){const{cover_image_url:e}=t;return`\n --gallery-background-image-url: url(${(new d).staticSrcBaseUrl}/${e});\n `}showThumbnails(t){t.map((t=>t.show()))}show(){Pt(this.container,"vimotia--gallery--ready",!0)}hideLoadMoreButton(){Pt(this.container,"vimotia--gallery--all-videos-loaded",!0)}addMaxWidthBasedOnTheme(){this.platform.getThemeName().then((t=>{const e=this.platform.getThemeMaxSectionWidthClassName(t);return!A.nullOrUndefined(e)&&!A.empty(e)&&(Pt(this.container,e),!0)}))}get videoCountInCol(){return this.stateClient.isMobile?this.data.colMobile:this.data.colDesktop}static createData(t){return{position:t.position_xpath,title:t.title,titleSize:t.title_size,titleColor:t.title_color,rowDesktop:t.line_number||ag,rowMobile:t.line_number_m||sg,colDesktop:t.column_number||og,colMobile:t.column_number_m||lg,gap:`${t.padding||12}px`,spacingTop:`${t.margin_top||cg}px`,spacingBottom:`${t.margin_bottom||dg}px`,spacingLeft:`${t.margin_left_right||ug}px`,spacingRight:`${t.margin_left_right||hg}px`}}set container(t){this.elements.container=t}get container(){return this.elements.container}}var mg=fg,vg=class extends mg{setLayoutClass(){Pt(this.container,ig,!0)}setCssVar(){super.setCssVar(),Ut(this.container,{[qn]:this.data.rowDesktop,[Yn]:this.data.rowMobile,[Jn]:this.data.colDesktop,[Xn]:this.data.colMobile,[$n]:this.data.gap})}},yg=class extends mg{setLayoutClass(){Pt(this.container,ng,!0)}setCssVar(){super.setCssVar(),Ut(this.container,{[qn]:this.data.rowDesktop,[Yn]:this.data.rowMobile,[Jn]:this.data.colDesktop,[Xn]:this.data.colMobile,[$n]:this.data.gap})}},Ag=class extends mg{setLayoutClass(){Pt(this.container,rg,!0)}},bg=class{static create(t){switch(t.layout){case zn:return new vg(t);case Kn:return new yg(t);case Wn:return new Ag(t);default:throw new Error(`Unknown gallery layout ${t.layout}`)}}},_g=i(8374),wg={};wg.styleTagTransform=ht(),wg.setAttributes=lt(),wg.insert=st().bind(null,"head"),wg.domAPI=nt(),wg.insertStyleElement=dt(),it()(_g.A,wg),_g.A&&_g.A.locals&&_g.A.locals;var Cg=class{constructor(t){this.logger=E(),this.data=this.readData(t),this.baseElements={container:null}}create(){throw new Error("implement it in the sub class")}addItems(t){throw new Error("implement it in the sub class")}handleItemClick(t){throw new Error("implement it in the sub class")}handleLoadMore(t){throw new Error("implement it in the sub class")}get container(){return this.baseElements.container}set container(t){this.baseElements.container=t}readData(t){throw new Error("implement it in the sub class")}};const Eg="vimotia--gallery-body";var Tg=class extends Cg{constructor(t){super(t),this.elements={containerBody:null,loadMoreButton:null}}create(){const t=Tt("div",{class:"vimotia--grid-gallery"}),e=Tt("div",{class:Eg}),i=Tt("div",{class:"vimotia--gallery-footer"}),r=this.createLoadMoreButton();i.append(r),t.append(e,i),this.container=t,this.containerBody=e,this.loadMoreButton=r}createLoadMoreButton(){return Tt("button",{class:"vimotia--gallery-button--load-more",style:`\n --background-color: ${this.data.buttonBackgroundColor};\n --text-color: ${this.data.buttonTextColor};\n `},this.data.buttonText)}addItems(t){this.containerBody.append(...t)}handleItemClick(t){vt(this.containerBody,"click",(e=>{Dt(e.target,Eg)||t(e.target)}))}handleLoadMore(t){vt(this.loadMoreButton,"click",(()=>{this.logger.log("[Gallery] load more"),t(this.loadMoreButton)}))}get containerBody(){return this.elements.containerBody}set containerBody(t){this.elements.containerBody=t}get loadMoreButton(){return this.elements.loadMoreButton}set loadMoreButton(t){this.elements.loadMoreButton=t}readData(t){let e=t.btn_text;A.nullOrUndefined(e)&&(e="Load More");let i=t.btn_text_color;A.empty(i)&&(i="#ffffff");let r=t.btn_background;return A.empty(r)&&(r="#1a1b18"),{buttonText:e,buttonTextColor:i,buttonBackgroundColor:r}}},Ig=i(3138),Sg={};Sg.styleTagTransform=ht(),Sg.setAttributes=lt(),Sg.insert=st().bind(null,"head"),Sg.domAPI=nt(),Sg.insertStyleElement=dt(),it()(Ig.A,Sg),Ig.A&&Ig.A.locals&&Ig.A.locals;var xg="swiper-slide",kg=class{static createASlide(t){if(A.nullOrUndefined(t))throw new Error("Expect an element in slide but got null");const e=Tt("div",{class:xg});return e.append(t),e}};const Pg="--vimotia-gallery-slider-arrow-color",Dg="--vimotia-gallery-slider-arrow-background-color",Lg="--vimotia-gallery-slider-arrow-background-color-hover";var Bg=i(2229),Og={};Og.styleTagTransform=ht(),Og.setAttributes=lt(),Og.insert=st().bind(null,"head"),Og.domAPI=nt(),Og.insertStyleElement=dt(),it()(Bg.A,Og),Bg.A&&Bg.A.locals&&Bg.A.locals;const Rg="vimotia--slider-gallery__nav-button",Mg="vimotia--slider-gallery__nav-button--round",Ng="vimotia--slider-gallery__nav-button--square";var Fg=class{constructor(){this.logger=E(),this.stateClient=tt(),this.elements={prev:null,next:null},this.init()}init(){this.prevContainer=this.createPrevContainer(),this.setShapeClassName(this.prevContainer),this.nextContainer=this.createNextContainer(),this.setShapeClassName(this.nextContainer)}createPrevContainer(){const t=Tt("div",{class:`${Rg} vimotia--slider-gallery__nav-button--prev`});return t.innerHTML=this.icon,t}createNextContainer(){const t=Tt("div",{class:`${Rg} vimotia--slider-gallery__nav-button--next`});return t.innerHTML=this.icon,t}get icon(){throw new Error("implement it in the subclass")}setShapeClassName(t){Pt(t,this.shapeClassName,!0)}get shapeClassName(){throw new Error("implement it in the subclass")}get roundShapeClassName(){return Mg}get squareShapeClassName(){return Ng}get standardArrowIcon(){return te.createArrowIcon()}get tailArrowIcon(){return te.createArrowWithTailIcon()}get prevContainer(){return this.elements.prev}set prevContainer(t){this.elements.prev=t}get nextContainer(){return this.elements.next}set nextContainer(t){this.elements.next=t}},Ug=class extends Fg{get icon(){return this.standardArrowIcon}get shapeClassName(){return this.roundShapeClassName}},Vg=class extends Fg{get icon(){return this.standardArrowIcon}get shapeClassName(){return this.squareShapeClassName}},jg=class extends Fg{get icon(){return this.tailArrowIcon}get shapeClassName(){return this.roundShapeClassName}},Qg=class extends Fg{get icon(){return this.tailArrowIcon}get shapeClassName(){return this.squareShapeClassName}},Gg=class{static create(t){switch(t){case"standard_round":return new Ug;case"standard_square":return new Vg;case"tail_round":return new jg;case"tail_square":return new Qg;default:throw new Error(`Unknown gallery arrow style ${t}`)}}};const Hg="vimotia--slider-gallery--arrow-inside",Wg="vimotia--slider-gallery--arrow-outside";var zg=class extends Cg{constructor(t){super(t),this.slider=null,this.navigation=Gg.create(this.data.arrowStyle)}create(){this.container=this.createContainer(),this.setCSSVariables(this.container),this.setArrowPositionClassName(this.container);const t=this.createSliderContainers();this.container.append(t,this.navigation.prevContainer,this.navigation.nextContainer),this.sliderInstance=this.createSlider(t)}createContainer(){return Tt("div",{class:"vimotia--slider-gallery"})}setCSSVariables(t){Ut(t,this.cssVariables)}get cssVariables(){return{[Pg]:this.data.arrowColor,[Dg]:`${this.data.arrowBackgroundColor}90`,[Lg]:`${this.data.arrowBackgroundColor}FF`}}createSlider(t){return new Js(t,{modules:[so,$s],preventInteractionOnTransition:!0,observer:!0,observeParents:!0,slidesPerView:this.data.slidesPerViewMobile,spaceBetween:this.data.spaceBetween,navigation:{nextEl:this.navigation.nextContainer,prevEl:this.navigation.prevContainer},breakpoints:{480:{slidesPerView:this.data.slidesPerViewDesktop,spaceBetween:this.data.spaceBetween,allowTouchMove:!1}}})}createSliderContainers(){const t=Tt("div",{class:hp.container}),e=Tt("div",{class:hp.wrapper});return t.append(e),t}addItems(t){const e=t.map((t=>kg.createASlide(t)));this.sliderInstance.appendSlide(e),Math.max(e.length,this.sliderInstance.slides.length)<=this.sliderInstance.params.slidesPerView&&(kt(this.sliderInstance.navigation.prevEl),kt(this.sliderInstance.navigation.nextEl),Pt(this.container,"vimotia--slider-gallery--no-nav",!0))}handleItemClick(t){this.sliderInstance.on("click",(()=>{A.nullOrUndefined(this.sliderInstance.clickedSlide)||t(this.sliderInstance.clickedSlide.firstElementChild)}))}handleLoadMore(t){this.sliderInstance.on("slideNextTransitionEnd",(()=>{this.logger.log("[Gallery] load more"),t(this.sliderInstance.navigation.nextEl)}))}setArrowPositionClassName(t){this.isInside?Pt(t,Hg,!0):Pt(t,Wg,!0)}get isInside(){return tt().isMobile}get sliderInstance(){return this.slider}set sliderInstance(t){this.slider=t}readData(t){return{arrowStyle:t.arrow_style,arrowColor:t.arrow_color,arrowBackgroundColor:t.arrow_bg_color,slidesPerViewDesktop:t.column_number,slidesPerViewMobile:t.column_number_m,spaceBetween:t.padding}}},Kg=class{static create(t){switch(t.layout){case zn:case Kn:return new Tg(t);case Wn:return new zg(t);default:throw new Error(`Unknown gallery layout ${t.layout}`)}}},qg=class{constructor(t,e,i){this.logger=E(),this.logger.log("[Gallery]: ON"),this.stateClient=tt(),this.galleryItem=t,this.galleryView=Kg.create(t),this.galleryStyler=bg.create(t),this.galleryInjector=new oa(t.position_xpath),this.collection=e,this.platform=i,this.playerList=[...t.player_list],this.state={currentPagination:0,lastItemOrderInGallery:-1,hasMoreVideosInGallery:!0,lastPlayerId:this.playerList[this.playerList.length-1].player.id},this.init().then()}async init(){this.initGalleryView(),this.initItems(this.galleryItem.player_list),this.galleryInjector.inject(this.galleryStyler.container),this.galleryStyler.show(),window.setTimeout((()=>{this.collection.inject()}),200),window.setTimeout((()=>{window.dispatchEvent(new Event("resize"))}),200)}initGalleryView(){this.galleryView.create(),this.galleryView.handleItemClick((t=>{let e=t;var i;if(Dt(e,$p)||(i=`.${$p}`,e=e.closest(i)),!Dt(e,$p))throw new Error("cannot find gallery item");const r=e.dataset[aa];this.collection.play(parseInt(r,10))})),this.galleryView.handleLoadMore((t=>{var e;this.state.hasMoreVideosInGallery?(e=t,A.element(e)&&!A.nullOrUndefined(e.disabled)&&e.disabled?this.logger.log("[Gallery] Bail. waiting for previous response."):(function(t){A.element(t)&&(t.disabled=!0)}(t),this.getMoreVideos().then((e=>{if(this.initItems(e.player_list),this.resetCollection(e.player_list),function(t){A.element(t)&&(t.disabled=!1)}(t),!A.empty(e.player_list)){const t=e.player_list[e.player_list.length-1];this.state.lastPlayerId=t.player.id}})))):this.logger.log("[Gallery] Bail. No more videos")})),this.galleryStyler.container.appendChild(this.galleryView.container)}initItems(t){const{items:e,thumbnails:i}=this.createItemAll(t);if(this.galleryStyler.showThumbnails(i),this.appendItemsToGallery(e),this.shouldHoverToPlay){const i=new Xp(t);e.forEach((t=>{this.listenToPlay(t,i),this.listenToStop(t,i)}))}else if(this.shouldAutoPlayThumbnail){const r=new Xp(t);e.forEach((t=>{this.setupAutoPlay(t,r)})),i.forEach((t=>{t.container.style.opacity=0}))}}createItemAll(t){const e=this.createItemsList(t),i=this.createThumbnailsList(t);return e.map(((t,e)=>[t,i[e]])).forEach((t=>{let[e,i]=t;e.append(i.container)})),{items:e,thumbnails:i}}createItemsList(t){return t.map((t=>(this.state.lastItemOrderInGallery+=1,this.galleryStyler.createItem(t,`${this.state.lastItemOrderInGallery}`))))}createThumbnailsList(t){return t.map((t=>ru.createGalleryThumbnail(t,this.galleryItem)))}appendItemsToGallery(t){this.galleryView.addItems(t);const e=this.galleryStyler.videoCountInCol;t.length{const i=t.dataset[sa];if(A.nullOrUndefined(i))throw new Error("Expect a player id in the gallery item but got null");const r=e.create(i);t.append(r.container),r.play(),Ht.fadeIn(r.container)}))}listenToStop(t,e){vt(t,"mouseleave",(()=>{const i=t.dataset[sa];if(A.nullOrUndefined(i))throw new Error("Expect a player id in the gallery item but got null");const r=e.create(i);Ht.fadeOut(r.container),Ht.waitAnimationEnd().then((()=>{r.stop()}))}))}setupAutoPlay(t,e){const i=t.dataset[sa];if(A.nullOrUndefined(i))throw new Error("Expect a player id in the gallery item but got null");const r=e.create(i,{autoPlay:!0});let n={[vd]:`${this.galleryItem.thumbnail_border}px`,[md]:`${this.galleryItem.thumbnail_radius}px`,[yd]:this.galleryItem.thumbnail_border_color},a=r.container.getElementsByClassName("vimotia--video")[0];a&&(Ut(a,n),a.style.background="none");let s=r.container.getElementsByClassName("vimotia__video-wrapper")[0];s&&(s.style.background="none"),t.append(r.container),r.play(),Ht.fadeIn(r.container)}resetCollection(t){this.playerList.push(...t),this.collection.resetWithNewList(this.playerList)}async getMoreVideos(){this.state.currentPagination+=1;const t=new d,e=await pn.post(t.apiConstants.MORE_GALLERY_VIDEOS,{shop_url:this.platform.shopDomain,page_number:this.state.currentPagination,gallery_id:this.galleryItem.id,last_player_id:this.state.lastPlayerId,desktop:!this.stateClient.isMobile,page_product_id:`${this.platform.productIdOnPage}`});return"fail"===e.status?(this.logger.error(`Fail getting more gallery videos. Error message: "${e.message}"`),{}):e}};class Yg{constructor(t){this.logger=E(),this.stateClient=tt(),this.data=t,this.platform=Mu({moneyFormat:t.current_payload.money_format}),this.init()}init(){this.updateStates(),this.initGallery(),this.initCollections()}updateStates(){this.stateClient.logoConfig=this.logoConfig,this.stateClient.logoPath=this.logoPath,this.stateClient.isSwipeVideoOn=this.data.current_payload.is_swipe_video_on,this.stateClient.shouldShowSwipeInstruction=this.shouldShowSwipeUpMsgOverlay(this.stateClient.isMobile)}get logoConfig(){return A.empty(this.data?.current_payload?.logo_config)?l:this.data.current_payload.logo_config}get logoPath(){return A.empty(this.data?.current_payload?.logo_url)?"":this.data.current_payload.logo_url}shouldShowSwipeUpMsgOverlay(t){const e=this.isOnlyCurrentVideoInSwipeVideos();return t&&Yg.isSwipeUpMsgOverlayExpire()&&this.data.current_payload.is_swipe_video_on&&this.data.swipe_payload.swipe_player_list.length>0&&!e}isOnlyCurrentVideoInSwipeVideos(){const t=this.firstVideoIdInList();return 1===this.data.swipe_payload.swipe_player_list.length&&this.data.swipe_payload.swipe_player_list[0].video.video_id===t}static isSwipeUpMsgOverlayExpire(){const t=tt();return+new Date-t.swipeHintDismissedTimestamp>=6048e5}initCollections(){A.array(this.data.current_payload.player_list)?Yg.sortPlayerList(this.data.current_payload.player_list).forEach((t=>{this.createCollection(t)})):this.logger.error(`Expect a player list but got "${this.data.current_payload.player_list}"`)}static sortPlayerList(t){const e=[...t];return e.sort(((t,e)=>{const{play_button_xpath:i}=t.player,{play_button_xpath:r}=e.player;return A.nullOrUndefined(i)||A.nullOrUndefined(r)||i.split("&&").pop(){Yg.initEmbeddedSingleVideo(t)}),200):this.stateClient.isMobile?window.setTimeout((()=>{const e=new fp;new lp([t],[...this.data.swipe_payload.swipe_player_list],this.platform,e,new Op(e))}),200):window.setTimeout((()=>{const e=new gp;new jh([t],[...this.data.swipe_payload.swipe_player_list],this.platform,e,new Bp(e))}),200)}isEmbeddedSingleVideo(t){const{player:e}=t;return this.stateClient.isMobile?e.embeded_play_m&&e.player_style_m===R:e.embeded_play&&e.player_style===R}static initEmbeddedSingleVideo(t){new Wp(t)}initGallery(){if(jn())this.logger.log("In dev env. Stop rendering gallery.");else{if(A.nullOrUndefined(this.data.current_payload.gallery_list))throw new Error("Expect gallery list data but got null");if(A.empty(this.data.current_payload.gallery_list))return this.logger.log("Gallery list is empty. Stop rendering gallery."),void(new la).hideAppBlock();Yg.sortGalleryList(this.data.current_payload.gallery_list).forEach((t=>{this.createGallery(t)}))}}static sortGalleryList(t){const e=[...t];return e.sort(((t,e)=>{const{position_xpath:i}=t,{position_xpath:r}=e;return A.nullOrUndefined(i)||A.nullOrUndefined(r)||parseInt(i.split("&&").pop(),10)