aptechka 0.39.8 → 0.39.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- "use strict";var he=a=>{throw TypeError(a)};var ie=(a,n,t)=>n.has(a)||he("Cannot "+t);var e=(a,n,t)=>(ie(a,n,"read from private field"),t?t.call(a):n.get(a)),s=(a,n,t)=>n.has(a)?he("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(a):n.set(a,t),r=(a,n,t,i)=>(ie(a,n,"write to private field"),i?i.call(a,t):n.set(a,t),t),T=(a,n,t)=>(ie(a,n,"access private method"),t);var ce=(a,n,t)=>new Promise((i,o)=>{var y=m=>{try{g(t.next(m))}catch(l){o(l)}},R=m=>{try{g(t.throw(m))}catch(l){o(l)}},g=m=>m.done?i(m.value):Promise.resolve(m.value).then(y,R);g((t=t.apply(a,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ee=require("../device/index.cjs"),ge=require("../source/index.cjs"),ve=require("../class-linked-status/index.cjs"),de=require("../browser-CpzFX2xg.cjs"),_=require("../events-KVanG9sR.cjs"),me=require("../string-DhgS_iFl.cjs"),re=require("../loading/index.cjs"),X=require("../css-property/index.cjs"),ue=require("../element-resizer/vanilla/index.cjs"),le=require("../canvas-CU5Xjahf.cjs"),Se=require("../canvas/index.cjs"),ne=require("../ticker/vanilla/index.cjs");let Le=0;var d,h,b,V,f,F,I,c,z,U,v,B,G,Q,O,Z;class D extends HTMLElement{constructor(){super();s(this,B);s(this,d,null);s(this,h,null);s(this,b,!1);s(this,V,!1);s(this,f,!1);s(this,F,"");s(this,I,"");s(this,c,new ve.ClassLinkedStatus(this,{loading:!1,loaded:!1,error:!1,clear:!1}));s(this,z,null);s(this,U);s(this,v,null);s(this,Q,t=>{const i=t[0];e(this,f)&&(!e(this,V)||this.hasAttribute("reload-source"))&&i.isIntersecting&&this.triggerLazyLoad(),i.isIntersecting?_.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&T(this,B,G).call(this,void 0),_.dispatchEvent(this,"sourceRelease",{custom:!0}))});s(this,O,()=>{e(this,c).set("loaded",!0),e(this,c).set("error",!1),e(this,c).set("loading",!1),!e(this,f)&&!e(this,b)&&re.loading.complete(e(this,I)),_.dispatchEvent(this,"sourceLoaded",{custom:!0});const t=getComputedStyle(this).getPropertyValue("--clear-duration");t?r(this,U,setTimeout(()=>{e(this,c).set("clear",!0)},parseFloat(t)*1e3)):e(this,c).set("clear",!0),r(this,b,!0)});s(this,Z,t=>{e(this,c).set("loaded",!1),e(this,c).set("error",!0),e(this,c).set("loading",!1),!e(this,f)&&!e(this,b)&&re.loading.error(e(this,I)),_.dispatchEvent(this,"sourceError",{custom:!0}),r(this,b,!0)});de.isBrowser&&window.IntersectionObserver&&(r(this,F,`source-consumer-${++Le}`),r(this,z,new IntersectionObserver(e(this,Q))))}get consumerElement(){return e(this,h)}get sourceManager(){return e(this,d)}get status(){return e(this,c)}get isLazy(){return e(this,f)}get currentURL(){return e(this,v)}get isFirstLoadHappened(){return e(this,b)}triggerLazyLoad(){e(this,d).current&&e(this,d).current!==e(this,d).previous&&T(this,B,G).call(this,e(this,d).current),r(this,V,!0)}connectedCallback(){const t=this.getAttribute("srcset");if(!t)return;const i=this.hasAttribute("notify")?this.closest(this.getAttribute("notify")):null;i&&e(this,c).addElement(i),r(this,h,this.createConsumer()),e(this,h).style.cssText=`
1
+ "use strict";var he=a=>{throw TypeError(a)};var ie=(a,n,t)=>n.has(a)||he("Cannot "+t);var e=(a,n,t)=>(ie(a,n,"read from private field"),t?t.call(a):n.get(a)),s=(a,n,t)=>n.has(a)?he("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(a):n.set(a,t),r=(a,n,t,i)=>(ie(a,n,"write to private field"),i?i.call(a,t):n.set(a,t),t),_=(a,n,t)=>(ie(a,n,"access private method"),t);var ce=(a,n,t)=>new Promise((i,o)=>{var y=m=>{try{g(t.next(m))}catch(l){o(l)}},R=m=>{try{g(t.throw(m))}catch(l){o(l)}},g=m=>m.done?i(m.value):Promise.resolve(m.value).then(y,R);g((t=t.apply(a,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Ee=require("../device/index.cjs"),ge=require("../source/index.cjs"),ve=require("../class-linked-status/index.cjs"),de=require("../browser-CpzFX2xg.cjs"),q=require("../events-KVanG9sR.cjs"),me=require("../string-DhgS_iFl.cjs"),re=require("../loading/index.cjs"),X=require("../css-property/index.cjs"),ue=require("../element-resizer/vanilla/index.cjs"),le=require("../canvas-CU5Xjahf.cjs"),Se=require("../canvas/index.cjs"),ne=require("../ticker/vanilla/index.cjs");let Le=0;var d,h,b,I,f,F,A,c,z,U,v,B,G,Q,O,Z;class D extends HTMLElement{constructor(){super();s(this,B);s(this,d,null);s(this,h,null);s(this,b,!1);s(this,I,!1);s(this,f,!1);s(this,F,"");s(this,A,"");s(this,c,new ve.ClassLinkedStatus(this,{loading:!1,loaded:!1,error:!1,clear:!1}));s(this,z,null);s(this,U);s(this,v,null);s(this,Q,t=>{const i=t[0];e(this,f)&&(!e(this,I)||this.hasAttribute("reload-source"))&&i.isIntersecting&&this.triggerLazyLoad(),i.isIntersecting?q.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&_(this,B,G).call(this,void 0),q.dispatchEvent(this,"sourceRelease",{custom:!0}))});s(this,O,()=>{e(this,c).set("loaded",!0),e(this,c).set("error",!1),e(this,c).set("loading",!1),!e(this,f)&&!e(this,b)&&re.loading.complete(e(this,A)),q.dispatchEvent(this,"sourceLoaded",{custom:!0});const t=getComputedStyle(this).getPropertyValue("--clear-duration");t?r(this,U,setTimeout(()=>{e(this,c).set("clear",!0)},parseFloat(t)*1e3)):e(this,c).set("clear",!0),r(this,b,!0)});s(this,Z,t=>{e(this,c).set("loaded",!1),e(this,c).set("error",!0),e(this,c).set("loading",!1),!e(this,f)&&!e(this,b)&&re.loading.error(e(this,A)),q.dispatchEvent(this,"sourceError",{custom:!0}),r(this,b,!0)});de.isBrowser&&window.IntersectionObserver&&(r(this,F,`source-consumer-${++Le}`),r(this,z,new IntersectionObserver(e(this,Q))))}get consumerElement(){return e(this,h)}get sourceManager(){return e(this,d)}get status(){return e(this,c)}get isLazy(){return e(this,f)}get currentURL(){return e(this,v)}get isFirstLoadHappened(){return e(this,b)}triggerLazyLoad(){e(this,d).current&&e(this,d).current!==e(this,d).previous&&_(this,B,G).call(this,e(this,d).current),r(this,I,!0)}connectedCallback(){const t=this.getAttribute("srcset");if(!t)return;const i=this.hasAttribute("notify")?this.closest(this.getAttribute("notify")):null;i&&e(this,c).addElement(i),r(this,h,this.createConsumer()),e(this,h).style.cssText=`
2
2
  display: block;
3
3
  width: 100%;
4
4
  height: 100%;
5
- `,e(this,h).classList.add("source-consumer"),Array.from(this.attributes).forEach(o=>{if(o.name!=="srcset"){const y=o.nodeValue||"",R=me.kebabToCamel(o.name);R in e(this,h)&&(e(this,h)[R]=y||!0)}}),this.appendChild(e(this,h)),r(this,d,new ge.SourceManager({srcset:t})),r(this,f,this.hasAttribute("lazy")),e(this,d).subscribe(o=>{(!e(this,f)||e(this,f)&&e(this,V))&&T(this,B,G).call(this,o.current)}),e(this,z).observe(this),e(this,d).connect()}disconnectedCallback(){e(this,z).disconnect(),e(this,d).close(),e(this,h).onloadeddata=null,e(this,h).onload=null,e(this,h).onerror=null,e(this,h).remove(),e(this,c).reset(),clearTimeout(e(this,U))}}d=new WeakMap,h=new WeakMap,b=new WeakMap,V=new WeakMap,f=new WeakMap,F=new WeakMap,I=new WeakMap,c=new WeakMap,z=new WeakMap,U=new WeakMap,v=new WeakMap,B=new WeakSet,G=function(t){if(clearTimeout(e(this,U)),e(this,h).onloadeddata=null,e(this,h).onload=null,e(this,h).onerror=null,e(this,c).set("loaded",!1),e(this,c).set("error",!1),e(this,c).set("loading",!1),e(this,c).set("clear",!1),t){r(this,I,`${e(this,F)}-${t.url}`);const i=this.hasAttribute("keep-source-parameters");e(this,c).set("loading",!0),r(this,v,i?t.url:t.name+t.extension),this.consumeSource(e(this,v)),!e(this,f)&&!e(this,b)&&re.loading.add(e(this,I)),e(this,h).onloadeddata=()=>{e(this,O).call(this)},e(this,h).onload=()=>{e(this,O).call(this)},e(this,h).onerror=()=>{e(this,Z).call(this,e(this,v))}}else r(this,v,null),this.consumeSource(null)},Q=new WeakMap,O=new WeakMap,Z=new WeakMap;class fe extends D{createConsumer(){return document.createElement("img")}consumeSource(n){if(n&&this.hasAttribute("webp")&&Ee.device.isWebp){const t=n.split(".").slice(0,-1).join(".")+".webp";this.consumerElement.src=t}else this.consumerElement.src=n||""}}customElements.get("e-image")||customElements.define("e-image",fe);function we(a){const n=a.match(/\{([\d-]+)\}/);if(n){const t=n[1].split("-");if(t.length===2){const i=parseInt(t[0],10),o=parseInt(t[1],10);return{start:i,end:o}}}return null}var p,A,M,S,L,P,k,Y,E,w;class pe extends D{constructor(t){super();s(this,p,[]);s(this,A,new X.CSSProperty(this,"--fit","contain"));s(this,M,new X.CSSProperty(this,"--autoplay",!1));s(this,S,new X.CSSProperty(this,"--offset-x",.5));s(this,L,new X.CSSProperty(this,"--offset-y",.5));s(this,P,null);s(this,k,0);s(this,Y,1);s(this,E,()=>{if(e(this,p).length){const t=e(this,p)[0];e(this,A).current==="cover"?r(this,P,le.cover(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,S).current,e(this,L).current)):r(this,P,le.contain(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,S).current,e(this,L).current))}});s(this,w,t=>{if(this.status.isFalse("loaded")||!e(this,P))return;t.detail.context.clearRect(0,0,t.detail.width,t.detail.height);const i=e(this,p)[e(this,k)];i&&t.detail.context.drawImage(i,...e(this,P)),e(this,M).current&&r(this,k,(e(this,k)+1)%e(this,p).length)});de.isBrowser&&(r(this,Y,parseInt(((t==null?void 0:t.pad)||this.getAttribute("pad")||"1").toString())),e(this,A).subscribe(e(this,E)),e(this,S).subscribe(e(this,E)),e(this,L).subscribe(e(this,E)),this.addEventListener("sourceCapture",i=>{this.consumerElement.addEventListener("canvasRender",e(this,w))}),this.addEventListener("sourceRelease",i=>{this.consumerElement.removeEventListener("canvasRender",e(this,w))}))}setProgress(t){e(this,p).length&&r(this,k,Math.floor((e(this,p).length-1)*t))}connectedCallback(){super.connectedCallback(),e(this,M).observe(),e(this,A).observe(),e(this,S).observe(),e(this,L).observe(),ue.elementResizer.subscribe(this,e(this,E))}disconnectedCallback(){super.disconnectedCallback(),e(this,M).unobserve(),e(this,A).unobserve(),e(this,S).unobserve(),e(this,L).unobserve(),r(this,p,[]),ue.elementResizer.unsubscribe(e(this,E)),this.consumerElement.removeEventListener("canvasRender",e(this,w))}createConsumer(){return new Se.CanvasElement}consumeSource(t){return ce(this,null,function*(){var i,o,y,R;if(t){this.consumerElement.removeEventListener("canvasRender",e(this,w));const g=[],m=we(t);if(m)for(let l=m.start;l<=m.end;l++){const oe=t.replace(/\{([^}]+)\}/,l.toString().padStart(e(this,Y),"0")),K=new Image;K.src=oe,g.push(K)}else{const l=new Image;l.src=t,g.push(l)}try{yield Promise.all(g.map((l,oe)=>new Promise((K,be)=>{l.onload=()=>{K()},l.onerror=Ce=>{be(`${l.src} Image not found`)}}))),r(this,p,g),e(this,E).call(this),(o=(i=this.consumerElement).onload)==null||o.call(i,new Event("load")),this.isLazy||this.consumerElement.addEventListener("canvasRender",e(this,w))}catch(l){console.error(l),(R=(y=this.consumerElement).onerror)==null||R.call(y,new Event("error"))}}})}}p=new WeakMap,A=new WeakMap,M=new WeakMap,S=new WeakMap,L=new WeakMap,P=new WeakMap,k=new WeakMap,Y=new WeakMap,E=new WeakMap,w=new WeakMap;customElements.get("e-sequence")||customElements.define("e-sequence",pe);var x,H;class ye extends D{constructor(){super(...arguments);s(this,x,0);s(this,H,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>e(this,x)&&r(this,x,t),_.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:e(this,x)}}),this.consumerElement.readyState===4&&ne.ticker.unsubscribe(e(this,H))})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{ne.ticker.subscribe(e(this,H)),this.hasAttribute("capture-autoplay")&&this.consumerElement.play()}),this.addEventListener("sourceRelease",()=>{this.hasAttribute("capture-autoplay")&&(this.consumerElement.pause(),this.hasAttribute("replay")&&(this.consumerElement.currentTime=0)),this.hasAttribute("reload-source")&&this.classList.remove("state-0","state-1","state-2","state-3","state-4")})}disconnectedCallback(){super.disconnectedCallback(),ne.ticker.unsubscribe(e(this,H)),r(this,x,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||"",this.consumerElement.autoplay=!0}}x=new WeakMap,H=new WeakMap;customElements.get("e-video")||customElements.define("e-video",ye);var u,W,C,N,$,ee,te,se,j,ae;const q=class q extends D{constructor(){super();s(this,j);s(this,u);s(this,W);s(this,C,!1);s(this,N,!1);s(this,$,()=>{r(this,C,e(this,C)||this.hasAttribute("autoplay")&&!this.hasAttribute("capture-autoplay")),r(this,u,new window.YT.Player(e(this,W),{playerVars:{mute:this.hasAttribute("muted")?1:0,controls:this.hasAttribute("controls")?1:0},events:{onReady:e(this,ee),onError:e(this,te),onStateChange:e(this,se)}}))});s(this,ee,()=>{r(this,N,!0),T(this,j,ae).call(this)});s(this,te,t=>{var i,o;console.error("YouTube: Ошибка при загрузке видео:",this.currentURL,t),(o=(i=this.consumerElement).onerror)==null||o.call(i,new Event("error"))});s(this,se,()=>{});r(this,W,"yt-"+me.generateId(10)),q.__apiReady||(window.onYouTubeIframeAPIReady=()=>{q.__apiReady=!0,_.dispatchEvent(window,"youTubeIframeAPIReady")}),this.addEventListener("sourceCapture",()=>{this.hasAttribute("capture-autoplay")&&(e(this,N)?e(this,u).playVideo():r(this,C,!0))}),this.addEventListener("sourceRelease",()=>{e(this,u)&&this.hasAttribute("capture-autoplay")&&(e(this,u).pauseVideo(),this.hasAttribute("replay")&&e(this,u).seekTo(0))})}static __onYouTubeIframeAPIReady(){this.__apiReady=!0}createConsumer(){const t=document.createElement("div");return t.id=e(this,W),t}consumeSource(t){var i;if(t){if(!document.getElementById("youtube-script")){const o=document.createElement("script");o.id,o.src="https://www.youtube.com/iframe_api";const y=document.getElementsByTagName("script")[0];(i=y.parentNode)==null||i.insertBefore(o,y)}e(this,u)?T(this,j,ae).call(this):q.__apiReady?e(this,$).call(this):addEventListener("youTubeIframeAPIReady",e(this,$))}else e(this,u)&&e(this,u).stopVideo()}disconnectedCallback(){super.disconnectedCallback(),e(this,u)&&e(this,u).destroy(),removeEventListener("youTubeIframeAPIReady",e(this,$))}};u=new WeakMap,W=new WeakMap,C=new WeakMap,N=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,se=new WeakMap,j=new WeakSet,ae=function(){var t,i;this.currentURL&&(this.currentURL.startsWith("http")?e(this,u).loadVideoByUrl(this.currentURL):e(this,u).loadVideoById(this.currentURL)),e(this,C)?e(this,u).playVideo():e(this,u).stopVideo(),r(this,C,!1),(i=(t=this.consumerElement).onload)==null||i.call(t,new Event("load"))},q.__apiReady=!1;let J=q;customElements.get("e-youtube")||customElements.define("e-youtube",J);exports.ImageElement=fe;exports.SequenceElement=pe;exports.SourceElement=D;exports.VideoElement=ye;exports.YouTubeElement=J;
5
+ `,e(this,h).classList.add("source-consumer"),Array.from(this.attributes).forEach(o=>{if(o.name!=="srcset"){const y=o.nodeValue||"",R=me.kebabToCamel(o.name);R in e(this,h)&&(e(this,h)[R]=y||!0)}}),this.appendChild(e(this,h)),r(this,d,new ge.SourceManager({srcset:t})),r(this,f,this.hasAttribute("lazy")),e(this,d).subscribe(o=>{(!e(this,f)||e(this,f)&&e(this,I))&&_(this,B,G).call(this,o.current)}),e(this,z).observe(this),e(this,d).connect()}disconnectedCallback(){e(this,z).disconnect(),e(this,d).close(),e(this,h).onloadeddata=null,e(this,h).onload=null,e(this,h).onerror=null,r(this,b,!1),r(this,I,!1),e(this,h).remove(),e(this,c).reset(),clearTimeout(e(this,U))}}d=new WeakMap,h=new WeakMap,b=new WeakMap,I=new WeakMap,f=new WeakMap,F=new WeakMap,A=new WeakMap,c=new WeakMap,z=new WeakMap,U=new WeakMap,v=new WeakMap,B=new WeakSet,G=function(t){if(clearTimeout(e(this,U)),e(this,h).onloadeddata=null,e(this,h).onload=null,e(this,h).onerror=null,e(this,c).set("loaded",!1),e(this,c).set("error",!1),e(this,c).set("loading",!1),e(this,c).set("clear",!1),t){r(this,A,`${e(this,F)}-${t.url}`);const i=this.hasAttribute("keep-source-parameters");e(this,c).set("loading",!0),r(this,v,i?t.url:t.name+t.extension),this.consumeSource(e(this,v)),!e(this,f)&&!e(this,b)&&re.loading.add(e(this,A)),e(this,h).onloadeddata=()=>{e(this,O).call(this)},e(this,h).onload=()=>{e(this,O).call(this)},e(this,h).onerror=()=>{e(this,Z).call(this,e(this,v))}}else r(this,v,null),this.consumeSource(null)},Q=new WeakMap,O=new WeakMap,Z=new WeakMap;class fe extends D{createConsumer(){return document.createElement("img")}consumeSource(n){if(n&&this.hasAttribute("webp")&&Ee.device.isWebp){const t=n.split(".").slice(0,-1).join(".")+".webp";this.consumerElement.src=t}else this.consumerElement.src=n||""}}customElements.get("e-image")||customElements.define("e-image",fe);function we(a){const n=a.match(/\{([\d-]+)\}/);if(n){const t=n[1].split("-");if(t.length===2){const i=parseInt(t[0],10),o=parseInt(t[1],10);return{start:i,end:o}}}return null}var p,P,M,S,L,k,x,Y,E,w;class pe extends D{constructor(t){super();s(this,p,[]);s(this,P,new X.CSSProperty(this,"--fit","contain"));s(this,M,new X.CSSProperty(this,"--autoplay",!1));s(this,S,new X.CSSProperty(this,"--offset-x",.5));s(this,L,new X.CSSProperty(this,"--offset-y",.5));s(this,k,null);s(this,x,0);s(this,Y,1);s(this,E,()=>{if(e(this,p).length){const t=e(this,p)[0];e(this,P).current==="cover"?r(this,k,le.cover(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,S).current,e(this,L).current)):r(this,k,le.contain(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,S).current,e(this,L).current))}});s(this,w,t=>{if(this.status.isFalse("loaded")||!e(this,k))return;t.detail.context.clearRect(0,0,t.detail.width,t.detail.height);const i=e(this,p)[e(this,x)];i&&t.detail.context.drawImage(i,...e(this,k)),e(this,M).current&&r(this,x,(e(this,x)+1)%e(this,p).length)});de.isBrowser&&(r(this,Y,parseInt(((t==null?void 0:t.pad)||this.getAttribute("pad")||"1").toString())),e(this,P).subscribe(e(this,E)),e(this,S).subscribe(e(this,E)),e(this,L).subscribe(e(this,E)),this.addEventListener("sourceCapture",i=>{this.consumerElement.addEventListener("canvasRender",e(this,w))}),this.addEventListener("sourceRelease",i=>{this.consumerElement.removeEventListener("canvasRender",e(this,w))}))}setProgress(t){e(this,p).length&&r(this,x,Math.floor((e(this,p).length-1)*t))}connectedCallback(){super.connectedCallback(),e(this,M).observe(),e(this,P).observe(),e(this,S).observe(),e(this,L).observe(),ue.elementResizer.subscribe(this,e(this,E))}disconnectedCallback(){super.disconnectedCallback(),e(this,M).unobserve(),e(this,P).unobserve(),e(this,S).unobserve(),e(this,L).unobserve(),r(this,p,[]),ue.elementResizer.unsubscribe(e(this,E)),this.consumerElement.removeEventListener("canvasRender",e(this,w))}createConsumer(){return new Se.CanvasElement}consumeSource(t){return ce(this,null,function*(){var i,o,y,R;if(t){this.consumerElement.removeEventListener("canvasRender",e(this,w));const g=[],m=we(t);if(m)for(let l=m.start;l<=m.end;l++){const oe=t.replace(/\{([^}]+)\}/,l.toString().padStart(e(this,Y),"0")),K=new Image;K.src=oe,g.push(K)}else{const l=new Image;l.src=t,g.push(l)}try{yield Promise.all(g.map((l,oe)=>new Promise((K,be)=>{l.onload=()=>{K()},l.onerror=Ce=>{be(`${l.src} Image not found`)}}))),r(this,p,g),e(this,E).call(this),(o=(i=this.consumerElement).onload)==null||o.call(i,new Event("load")),this.isLazy||this.consumerElement.addEventListener("canvasRender",e(this,w))}catch(l){console.error(l),(R=(y=this.consumerElement).onerror)==null||R.call(y,new Event("error"))}}})}}p=new WeakMap,P=new WeakMap,M=new WeakMap,S=new WeakMap,L=new WeakMap,k=new WeakMap,x=new WeakMap,Y=new WeakMap,E=new WeakMap,w=new WeakMap;customElements.get("e-sequence")||customElements.define("e-sequence",pe);var T,H;class ye extends D{constructor(){super(...arguments);s(this,T,0);s(this,H,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>e(this,T)&&r(this,T,t),q.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:e(this,T)}}),this.consumerElement.readyState===4&&ne.ticker.unsubscribe(e(this,H))})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{ne.ticker.subscribe(e(this,H)),this.hasAttribute("capture-autoplay")&&this.consumerElement.play()}),this.addEventListener("sourceRelease",()=>{this.hasAttribute("capture-autoplay")&&(this.consumerElement.pause(),this.hasAttribute("replay")&&(this.consumerElement.currentTime=0)),this.hasAttribute("reload-source")&&this.classList.remove("state-0","state-1","state-2","state-3","state-4")})}disconnectedCallback(){super.disconnectedCallback(),ne.ticker.unsubscribe(e(this,H)),r(this,T,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||"",this.consumerElement.autoplay=!0}}T=new WeakMap,H=new WeakMap;customElements.get("e-video")||customElements.define("e-video",ye);var u,W,C,N,$,ee,te,se,j,ae;const V=class V extends D{constructor(){super();s(this,j);s(this,u);s(this,W);s(this,C,!1);s(this,N,!1);s(this,$,()=>{r(this,C,e(this,C)||this.hasAttribute("autoplay")&&!this.hasAttribute("capture-autoplay")),r(this,u,new window.YT.Player(e(this,W),{playerVars:{mute:this.hasAttribute("muted")?1:0,controls:this.hasAttribute("controls")?1:0},events:{onReady:e(this,ee),onError:e(this,te),onStateChange:e(this,se)}}))});s(this,ee,()=>{r(this,N,!0),_(this,j,ae).call(this)});s(this,te,t=>{var i,o;console.error("YouTube: Ошибка при загрузке видео:",this.currentURL,t),(o=(i=this.consumerElement).onerror)==null||o.call(i,new Event("error"))});s(this,se,()=>{});r(this,W,"yt-"+me.generateId(10)),V.__apiReady||(window.onYouTubeIframeAPIReady=()=>{V.__apiReady=!0,q.dispatchEvent(window,"youTubeIframeAPIReady")}),this.addEventListener("sourceCapture",()=>{this.hasAttribute("capture-autoplay")&&(e(this,N)?e(this,u).playVideo():r(this,C,!0))}),this.addEventListener("sourceRelease",()=>{e(this,u)&&this.hasAttribute("capture-autoplay")&&(e(this,u).pauseVideo(),this.hasAttribute("replay")&&e(this,u).seekTo(0))})}static __onYouTubeIframeAPIReady(){this.__apiReady=!0}createConsumer(){const t=document.createElement("div");return t.id=e(this,W),t}consumeSource(t){var i;if(t){if(!document.getElementById("youtube-script")){const o=document.createElement("script");o.id,o.src="https://www.youtube.com/iframe_api";const y=document.getElementsByTagName("script")[0];(i=y.parentNode)==null||i.insertBefore(o,y)}e(this,u)?_(this,j,ae).call(this):V.__apiReady?e(this,$).call(this):addEventListener("youTubeIframeAPIReady",e(this,$))}else e(this,u)&&e(this,u).stopVideo()}disconnectedCallback(){super.disconnectedCallback(),e(this,u)&&e(this,u).destroy(),removeEventListener("youTubeIframeAPIReady",e(this,$))}};u=new WeakMap,W=new WeakMap,C=new WeakMap,N=new WeakMap,$=new WeakMap,ee=new WeakMap,te=new WeakMap,se=new WeakMap,j=new WeakSet,ae=function(){var t,i;this.currentURL&&(this.currentURL.startsWith("http")?e(this,u).loadVideoByUrl(this.currentURL):e(this,u).loadVideoById(this.currentURL)),e(this,C)?e(this,u).playVideo():e(this,u).stopVideo(),r(this,C,!1),(i=(t=this.consumerElement).onload)==null||i.call(t,new Event("load"))},V.__apiReady=!1;let J=V;customElements.get("e-youtube")||customElements.define("e-youtube",J);exports.ImageElement=fe;exports.SequenceElement=pe;exports.SourceElement=D;exports.VideoElement=ye;exports.YouTubeElement=J;
@@ -2,7 +2,7 @@ var he = (a) => {
2
2
  throw TypeError(a);
3
3
  };
4
4
  var se = (a, n, t) => n.has(a) || he("Cannot " + t);
5
- var e = (a, n, t) => (se(a, n, "read from private field"), t ? t.call(a) : n.get(a)), s = (a, n, t) => n.has(a) ? he("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(a) : n.set(a, t), r = (a, n, t, i) => (se(a, n, "write to private field"), i ? i.call(a, t) : n.set(a, t), t), x = (a, n, t) => (se(a, n, "access private method"), t);
5
+ var e = (a, n, t) => (se(a, n, "read from private field"), t ? t.call(a) : n.get(a)), s = (a, n, t) => n.has(a) ? he("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(a) : n.set(a, t), r = (a, n, t, i) => (se(a, n, "write to private field"), i ? i.call(a, t) : n.set(a, t), t), V = (a, n, t) => (se(a, n, "access private method"), t);
6
6
  var ce = (a, n, t) => new Promise((i, o) => {
7
7
  var y = (m) => {
8
8
  try {
@@ -23,7 +23,7 @@ import { device as me } from "../device/index.js";
23
23
  import { SourceManager as fe } from "../source/index.js";
24
24
  import { ClassLinkedStatus as pe } from "../class-linked-status/index.js";
25
25
  import { i as le } from "../browser-0zX67oeU.js";
26
- import { d as V } from "../events-CsVF98U6.js";
26
+ import { d as U } from "../events-CsVF98U6.js";
27
27
  import { k as ye, g as be } from "../string-f0Dnk0L1.js";
28
28
  import { loading as ie } from "../loading/index.js";
29
29
  import { CSSProperty as K } from "../css-property/index.js";
@@ -32,7 +32,7 @@ import { c as ge, a as Ee } from "../canvas-DeZ0SLUJ.js";
32
32
  import { CanvasElement as ve } from "../canvas/index.js";
33
33
  import { ticker as re } from "../ticker/vanilla/index.js";
34
34
  let Le = 0;
35
- var d, h, b, z, f, q, I, c, _, B, v, H, X, G, N, J;
35
+ var d, h, b, I, f, q, A, c, _, B, v, H, X, G, N, J;
36
36
  class te extends HTMLElement {
37
37
  constructor() {
38
38
  super();
@@ -40,10 +40,10 @@ class te extends HTMLElement {
40
40
  s(this, d, null);
41
41
  s(this, h, null);
42
42
  s(this, b, !1);
43
- s(this, z, !1);
43
+ s(this, I, !1);
44
44
  s(this, f, !1);
45
45
  s(this, q, "");
46
- s(this, I, "");
46
+ s(this, A, "");
47
47
  s(this, c, new pe(this, {
48
48
  loading: !1,
49
49
  loaded: !1,
@@ -55,17 +55,17 @@ class te extends HTMLElement {
55
55
  s(this, v, null);
56
56
  s(this, G, (t) => {
57
57
  const i = t[0];
58
- e(this, f) && (!e(this, z) || this.hasAttribute("reload-source")) && i.isIntersecting && this.triggerLazyLoad(), i.isIntersecting ? V(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && x(this, H, X).call(this, void 0), V(this, "sourceRelease", { custom: !0 }));
58
+ e(this, f) && (!e(this, I) || this.hasAttribute("reload-source")) && i.isIntersecting && this.triggerLazyLoad(), i.isIntersecting ? U(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && V(this, H, X).call(this, void 0), U(this, "sourceRelease", { custom: !0 }));
59
59
  });
60
60
  s(this, N, () => {
61
- e(this, c).set("loaded", !0), e(this, c).set("error", !1), e(this, c).set("loading", !1), !e(this, f) && !e(this, b) && ie.complete(e(this, I)), V(this, "sourceLoaded", { custom: !0 });
61
+ e(this, c).set("loaded", !0), e(this, c).set("error", !1), e(this, c).set("loading", !1), !e(this, f) && !e(this, b) && ie.complete(e(this, A)), U(this, "sourceLoaded", { custom: !0 });
62
62
  const t = getComputedStyle(this).getPropertyValue("--clear-duration");
63
63
  t ? r(this, B, setTimeout(() => {
64
64
  e(this, c).set("clear", !0);
65
65
  }, parseFloat(t) * 1e3)) : e(this, c).set("clear", !0), r(this, b, !0);
66
66
  });
67
67
  s(this, J, (t) => {
68
- e(this, c).set("loaded", !1), e(this, c).set("error", !0), e(this, c).set("loading", !1), !e(this, f) && !e(this, b) && ie.error(e(this, I)), V(this, "sourceError", { custom: !0 }), r(this, b, !0);
68
+ e(this, c).set("loaded", !1), e(this, c).set("error", !0), e(this, c).set("loading", !1), !e(this, f) && !e(this, b) && ie.error(e(this, A)), U(this, "sourceError", { custom: !0 }), r(this, b, !0);
69
69
  });
70
70
  le && window.IntersectionObserver && (r(this, q, `source-consumer-${++Le}`), r(this, _, new IntersectionObserver(
71
71
  e(this, G)
@@ -90,7 +90,7 @@ class te extends HTMLElement {
90
90
  return e(this, b);
91
91
  }
92
92
  triggerLazyLoad() {
93
- e(this, d).current && e(this, d).current !== e(this, d).previous && x(this, H, X).call(this, e(this, d).current), r(this, z, !0);
93
+ e(this, d).current && e(this, d).current !== e(this, d).previous && V(this, H, X).call(this, e(this, d).current), r(this, I, !0);
94
94
  }
95
95
  connectedCallback() {
96
96
  const t = this.getAttribute("srcset");
@@ -108,18 +108,18 @@ class te extends HTMLElement {
108
108
  }), this.appendChild(e(this, h)), r(this, d, new fe({
109
109
  srcset: t
110
110
  })), r(this, f, this.hasAttribute("lazy")), e(this, d).subscribe((o) => {
111
- (!e(this, f) || e(this, f) && e(this, z)) && x(this, H, X).call(this, o.current);
111
+ (!e(this, f) || e(this, f) && e(this, I)) && V(this, H, X).call(this, o.current);
112
112
  }), e(this, _).observe(this), e(this, d).connect();
113
113
  }
114
114
  disconnectedCallback() {
115
- e(this, _).disconnect(), e(this, d).close(), e(this, h).onloadeddata = null, e(this, h).onload = null, e(this, h).onerror = null, e(this, h).remove(), e(this, c).reset(), clearTimeout(e(this, B));
115
+ e(this, _).disconnect(), e(this, d).close(), e(this, h).onloadeddata = null, e(this, h).onload = null, e(this, h).onerror = null, r(this, b, !1), r(this, I, !1), e(this, h).remove(), e(this, c).reset(), clearTimeout(e(this, B));
116
116
  }
117
117
  }
118
- d = new WeakMap(), h = new WeakMap(), b = new WeakMap(), z = new WeakMap(), f = new WeakMap(), q = new WeakMap(), I = new WeakMap(), c = new WeakMap(), _ = new WeakMap(), B = new WeakMap(), v = new WeakMap(), H = new WeakSet(), X = function(t) {
118
+ d = new WeakMap(), h = new WeakMap(), b = new WeakMap(), I = new WeakMap(), f = new WeakMap(), q = new WeakMap(), A = new WeakMap(), c = new WeakMap(), _ = new WeakMap(), B = new WeakMap(), v = new WeakMap(), H = new WeakSet(), X = function(t) {
119
119
  if (clearTimeout(e(this, B)), e(this, h).onloadeddata = null, e(this, h).onload = null, e(this, h).onerror = null, e(this, c).set("loaded", !1), e(this, c).set("error", !1), e(this, c).set("loading", !1), e(this, c).set("clear", !1), t) {
120
- r(this, I, `${e(this, q)}-${t.url}`);
120
+ r(this, A, `${e(this, q)}-${t.url}`);
121
121
  const i = this.hasAttribute("keep-source-parameters");
122
- e(this, c).set("loading", !0), r(this, v, i ? t.url : t.name + t.extension), this.consumeSource(e(this, v)), !e(this, f) && !e(this, b) && ie.add(e(this, I)), e(this, h).onloadeddata = () => {
122
+ e(this, c).set("loading", !0), r(this, v, i ? t.url : t.name + t.extension), this.consumeSource(e(this, v)), !e(this, f) && !e(this, b) && ie.add(e(this, A)), e(this, h).onloadeddata = () => {
123
123
  e(this, N).call(this);
124
124
  }, e(this, h).onload = () => {
125
125
  e(this, N).call(this);
@@ -153,12 +153,12 @@ function Ce(a) {
153
153
  }
154
154
  return null;
155
155
  }
156
- var p, A, M, L, w, k, P, O, g, C;
156
+ var p, k, M, L, w, P, T, O, g, C;
157
157
  class Se extends te {
158
158
  constructor(t) {
159
159
  super();
160
160
  s(this, p, []);
161
- s(this, A, new K(
161
+ s(this, k, new K(
162
162
  this,
163
163
  "--fit",
164
164
  "contain"
@@ -166,20 +166,20 @@ class Se extends te {
166
166
  s(this, M, new K(this, "--autoplay", !1));
167
167
  s(this, L, new K(this, "--offset-x", 0.5));
168
168
  s(this, w, new K(this, "--offset-y", 0.5));
169
- s(this, k, null);
170
- s(this, P, 0);
169
+ s(this, P, null);
170
+ s(this, T, 0);
171
171
  s(this, O, 1);
172
172
  s(this, g, () => {
173
173
  if (e(this, p).length) {
174
174
  const t = e(this, p)[0];
175
- e(this, A).current === "cover" ? r(this, k, ge(
175
+ e(this, k).current === "cover" ? r(this, P, ge(
176
176
  t.naturalWidth,
177
177
  t.naturalHeight,
178
178
  this.consumerElement.width,
179
179
  this.consumerElement.height,
180
180
  e(this, L).current,
181
181
  e(this, w).current
182
- )) : r(this, k, Ee(
182
+ )) : r(this, P, Ee(
183
183
  t.naturalWidth,
184
184
  t.naturalHeight,
185
185
  this.consumerElement.width,
@@ -190,15 +190,15 @@ class Se extends te {
190
190
  }
191
191
  });
192
192
  s(this, C, (t) => {
193
- if (this.status.isFalse("loaded") || !e(this, k))
193
+ if (this.status.isFalse("loaded") || !e(this, P))
194
194
  return;
195
195
  t.detail.context.clearRect(0, 0, t.detail.width, t.detail.height);
196
- const i = e(this, p)[e(this, P)];
197
- i && t.detail.context.drawImage(i, ...e(this, k)), e(this, M).current && r(this, P, (e(this, P) + 1) % e(this, p).length);
196
+ const i = e(this, p)[e(this, T)];
197
+ i && t.detail.context.drawImage(i, ...e(this, P)), e(this, M).current && r(this, T, (e(this, T) + 1) % e(this, p).length);
198
198
  });
199
199
  le && (r(this, O, parseInt(
200
200
  ((t == null ? void 0 : t.pad) || this.getAttribute("pad") || "1").toString()
201
- )), e(this, A).subscribe(e(this, g)), e(this, L).subscribe(e(this, g)), e(this, w).subscribe(e(this, g)), this.addEventListener("sourceCapture", (i) => {
201
+ )), e(this, k).subscribe(e(this, g)), e(this, L).subscribe(e(this, g)), e(this, w).subscribe(e(this, g)), this.addEventListener("sourceCapture", (i) => {
202
202
  this.consumerElement.addEventListener(
203
203
  "canvasRender",
204
204
  e(this, C)
@@ -211,13 +211,13 @@ class Se extends te {
211
211
  }));
212
212
  }
213
213
  setProgress(t) {
214
- e(this, p).length && r(this, P, Math.floor((e(this, p).length - 1) * t));
214
+ e(this, p).length && r(this, T, Math.floor((e(this, p).length - 1) * t));
215
215
  }
216
216
  connectedCallback() {
217
- super.connectedCallback(), e(this, M).observe(), e(this, A).observe(), e(this, L).observe(), e(this, w).observe(), ue.subscribe(this, e(this, g));
217
+ super.connectedCallback(), e(this, M).observe(), e(this, k).observe(), e(this, L).observe(), e(this, w).observe(), ue.subscribe(this, e(this, g));
218
218
  }
219
219
  disconnectedCallback() {
220
- super.disconnectedCallback(), e(this, M).unobserve(), e(this, A).unobserve(), e(this, L).unobserve(), e(this, w).unobserve(), r(this, p, []), ue.unsubscribe(e(this, g)), this.consumerElement.removeEventListener(
220
+ super.disconnectedCallback(), e(this, M).unobserve(), e(this, k).unobserve(), e(this, L).unobserve(), e(this, w).unobserve(), r(this, p, []), ue.unsubscribe(e(this, g)), this.consumerElement.removeEventListener(
221
221
  "canvasRender",
222
222
  e(this, C)
223
223
  );
@@ -266,20 +266,20 @@ class Se extends te {
266
266
  });
267
267
  }
268
268
  }
269
- p = new WeakMap(), A = new WeakMap(), M = new WeakMap(), L = new WeakMap(), w = new WeakMap(), k = new WeakMap(), P = new WeakMap(), O = new WeakMap(), g = new WeakMap(), C = new WeakMap();
269
+ p = new WeakMap(), k = new WeakMap(), M = new WeakMap(), L = new WeakMap(), w = new WeakMap(), P = new WeakMap(), T = new WeakMap(), O = new WeakMap(), g = new WeakMap(), C = new WeakMap();
270
270
  customElements.get("e-sequence") || customElements.define("e-sequence", Se);
271
- var T, W;
271
+ var x, W;
272
272
  class Re extends te {
273
273
  constructor() {
274
274
  super(...arguments);
275
- s(this, T, 0);
275
+ s(this, x, 0);
276
276
  s(this, W, () => {
277
277
  this.classList.add(`state-${this.consumerElement.readyState}`);
278
278
  const t = this.consumerElement.readyState / 4;
279
- t > e(this, T) && r(this, T, t), V(this, "videoReadyStateChange", {
279
+ t > e(this, x) && r(this, x, t), U(this, "videoReadyStateChange", {
280
280
  detail: {
281
281
  readyState: this.consumerElement.readyState,
282
- progress: e(this, T)
282
+ progress: e(this, x)
283
283
  }
284
284
  }), this.consumerElement.readyState === 4 && re.unsubscribe(e(this, W));
285
285
  });
@@ -298,7 +298,7 @@ class Re extends te {
298
298
  });
299
299
  }
300
300
  disconnectedCallback() {
301
- super.disconnectedCallback(), re.unsubscribe(e(this, W)), r(this, T, 0);
301
+ super.disconnectedCallback(), re.unsubscribe(e(this, W)), r(this, x, 0);
302
302
  }
303
303
  createConsumer() {
304
304
  return document.createElement("video");
@@ -307,10 +307,10 @@ class Re extends te {
307
307
  this.consumerElement.src = t || "", this.consumerElement.autoplay = !0;
308
308
  }
309
309
  }
310
- T = new WeakMap(), W = new WeakMap();
310
+ x = new WeakMap(), W = new WeakMap();
311
311
  customElements.get("e-video") || customElements.define("e-video", Re);
312
312
  var u, $, S, Y, F, Q, Z, ee, D, ae;
313
- const U = class U extends te {
313
+ const z = class z extends te {
314
314
  constructor() {
315
315
  super();
316
316
  s(this, D);
@@ -332,7 +332,7 @@ const U = class U extends te {
332
332
  }));
333
333
  });
334
334
  s(this, Q, () => {
335
- r(this, Y, !0), x(this, D, ae).call(this);
335
+ r(this, Y, !0), V(this, D, ae).call(this);
336
336
  });
337
337
  s(this, Z, (t) => {
338
338
  var i, o;
@@ -340,8 +340,8 @@ const U = class U extends te {
340
340
  });
341
341
  s(this, ee, () => {
342
342
  });
343
- r(this, $, "yt-" + be(10)), U.__apiReady || (window.onYouTubeIframeAPIReady = () => {
344
- U.__apiReady = !0, V(window, "youTubeIframeAPIReady");
343
+ r(this, $, "yt-" + be(10)), z.__apiReady || (window.onYouTubeIframeAPIReady = () => {
344
+ z.__apiReady = !0, U(window, "youTubeIframeAPIReady");
345
345
  }), this.addEventListener("sourceCapture", () => {
346
346
  this.hasAttribute("capture-autoplay") && (e(this, Y) ? e(this, u).playVideo() : r(this, S, !0));
347
347
  }), this.addEventListener("sourceRelease", () => {
@@ -364,7 +364,7 @@ const U = class U extends te {
364
364
  const y = document.getElementsByTagName("script")[0];
365
365
  (i = y.parentNode) == null || i.insertBefore(o, y);
366
366
  }
367
- e(this, u) ? x(this, D, ae).call(this) : U.__apiReady ? e(this, F).call(this) : addEventListener("youTubeIframeAPIReady", e(this, F));
367
+ e(this, u) ? V(this, D, ae).call(this) : z.__apiReady ? e(this, F).call(this) : addEventListener("youTubeIframeAPIReady", e(this, F));
368
368
  } else e(this, u) && e(this, u).stopVideo();
369
369
  }
370
370
  disconnectedCallback() {
@@ -374,8 +374,8 @@ const U = class U extends te {
374
374
  u = new WeakMap(), $ = new WeakMap(), S = new WeakMap(), Y = new WeakMap(), F = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), ee = new WeakMap(), D = new WeakSet(), ae = function() {
375
375
  var t, i;
376
376
  this.currentURL && (this.currentURL.startsWith("http") ? e(this, u).loadVideoByUrl(this.currentURL) : e(this, u).loadVideoById(this.currentURL)), e(this, S) ? e(this, u).playVideo() : e(this, u).stopVideo(), r(this, S, !1), (i = (t = this.consumerElement).onload) == null || i.call(t, new Event("load"));
377
- }, U.__apiReady = !1;
378
- let ne = U;
377
+ }, z.__apiReady = !1;
378
+ let ne = z;
379
379
  customElements.get("e-youtube") || customElements.define("e-youtube", ne);
380
380
  export {
381
381
  we as ImageElement,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.39.8",
3
+ "version": "0.39.9",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"