tweb/public/297.1bdbe4d3952a46b0e184.ch...

2 lines
1.4 MiB
JavaScript
Raw Normal View History

2023-03-13 15:47:15 +01:00
(this.webpackChunktweb=this.webpackChunktweb||[]).push([[297],{5814:(e,t,i)=>{"use strict";i.d(t,{Z:()=>m});var s=i(5400),n=i(3512),a=i(4762),o=i(410),r=i(8487),d=i(3772),l=i(1655),c=i(7625),h=i(2586),u=i(3013),p=i(3035);const f=new class{constructor(){this.observer=new IntersectionObserver((e=>{for(const t of e){const e=t.target;for(const i in this.byGroups){if(this.intersectionLockedGroups[i])continue;const s=this.byGroups[i].find((t=>t.el===e));if(s){if(t.isIntersecting)this.visible.add(s),this.checkAnimation(s,!1);else{this.visible.delete(s),this.checkAnimation(s,!0);const e=s.animation;e instanceof d.Z&&e.clearCache()}break}}}})),this.visible=new Set,this.overrideIdleGroups=new Set,this.byGroups={},this.byPlayer=new Map,this.lockedGroups={},this.onlyOnePlayableGroup="",this.intersectionLockedGroups={},this.videosLocked=!1,u.Z.addEventListener("play",(({doc:e})=>{"round"===e.type&&(this.videosLocked=!0,this.checkAnimations2())})),u.Z.addEventListener("pause",(()=>{this.videosLocked&&(this.videosLocked=!1,this.checkAnimations2())})),h.Z.addEventListener("change",(e=>{this.checkAnimations2(e)}))}setOverrideIdleGroup(e,t){t?this.overrideIdleGroups.add(e):this.overrideIdleGroups.delete(e)}getAnimations(e){const t=[];for(const i in this.byGroups)for(const s of this.byGroups[i])s.el===e&&t.push(s);return t}removeAnimation(e){const{el:t,animation:i}=e;i instanceof HTMLVideoElement||i.remove(),i instanceof HTMLVideoElement&&a.IS_SAFARI&&setTimeout((()=>{i.src="",i.load()}),1e3);const s=this.byGroups[e.group];s&&((0,l.Z)(s,e),s.length||delete this.byGroups[e.group]),this.observer.unobserve(t),this.visible.delete(e),this.byPlayer.delete(i)}removeAnimationByPlayer(e){const t=this.byPlayer.get(e);t&&this.removeAnimation(t)}addAnimation(e){var t,i,a,o;let{animation:r,group:l="",observeElement:c,controlled:h,liteModeKey:u}=e;if("none"===l||this.byPlayer.has(r))return;c||(r instanceof d.Z?c=r.el[0]:r instanceof s.KZ?c=r.canvas:r instanceof s.LD?c=null!==(t=r.placeholder)&&void 0!==t?t:r:r instanceof HTMLElement&&(c=r));const p={el:c,animation:r,group:l,controlled:h,liteModeKey:u};h&&"boolean"!=typeof h&&h.onClean((()=>{this.removeAnimationByPlayer(r)})),r instanceof d.Z&&!n.Z.settings.stickers.loop&&r.loop&&(r.loop=n.Z.settings.stickers.loop),(null!==(i=(a=this.byGroups)[o=l])&&void 0!==i?i:a[o]=[]).push(p),this.observer.observe(p.el),this.byPlayer.set(r,p)}checkAnimations(e,t,i,s){if(void 0!==t&&!this.byGroups[t])return;const n=void 0!==t?[t]:Object.keys(this.byGroups);for(const t of n){if(s&&this.intersectionLockedGroups[t])continue;const n=this.byGroups[t];(0,c.Z)(n,(t=>{this.checkAnimation(t,e,i)}))}}checkAnimations2(e){this.checkAnimations(e,void 0,void 0,!0)}checkAnimation(e,t,i){const{el:s,animation:n,group:a}=e;i||!this.lockedGroups[a]&&!(0,r.Z)(s)?e.controlled&&!i||this.removeAnimation(e):t||this.onlyOnePlayableGroup&&this.onlyOnePlayableGroup!==a||n instanceof HTMLVideoElement&&this.videosLocked?n.paused||n.pause():!(n.paused&&this.visible.has(e)&&n.autoplay)||this.onlyOnePlayableGroup&&this.onlyOnePlayableGroup!==a||h.Z.isIdle&&!this.overrideIdleGroups.has(e.group)||n.play()}getOnlyOnePlayableGroup(){return this.onlyOnePlayableGroup}setOnlyOnePlayableGroup(e=""){this.onlyOnePlayableGroup=e}lockGroup(e){this.lockedGroups[e]=!0}unlockGroup(e){delete this.lockedGroups[e],this.checkAnimations(void 0,e)}refreshGroup(e){const t=this.byGroups[e];(null==t?void 0:t.length)&&(t.forEach((e=>{this.observer.unobserve(e.el)})),(0,p.T2)((()=>{t.forEach((e=>{this.observer.observe(e.el)}))})))}lockIntersectionGroup(e){this.intersectionLockedGroups[e]=!0}unlockIntersectionGroup(e){delete this.intersectionLockedGroups[e],this.refreshGroup(e)}toggleIntersectionGroup(e,t){t?this.lockIntersectionGroup(e):this.unlockIntersectionGroup(e)}setAutoplay(e,t){let i=!1;return this.byPlayer.forEach(((s,a)=>{s.liteModeKey===t&&(i=!0,a.autoplay=!!e&&!!+s.el.dataset.stickerPlay,a.loop=!!e&&!!+s.el.dataset.stickerLoop&&n.Z.settings.stickers.loop)})),i}setLoop(e){let t=!1;return this.byPlayer.forEach(((i,s)=>{+i.el.dataset.stickerLoop&&s.loop!==e&&(s inst
//# sourceMappingURL=297.1bdbe4d3952a46b0e184.chunk.js.map