aptechka 0.40.2 → 0.40.4

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.
@@ -0,0 +1,12 @@
1
+ import { SourceElement } from '../source';
2
+
3
+ export declare class IFameElement extends SourceElement<HTMLElement> {
4
+ #private;
5
+ protected createConsumer(): HTMLDivElement;
6
+ protected consumeSource(code: string | null): void;
7
+ }
8
+ declare global {
9
+ interface HTMLElementTagNameMap {
10
+ 'e-iframe': IFameElement;
11
+ }
12
+ }
@@ -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),_=(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)}},I=m=>{try{g(t.throw(m))}catch(l){o(l)}},g=m=>m.done?i(m.value):Promise.resolve(m.value).then(y,I);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,v,f,F,A,c,z,U,S,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,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,S,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?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,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,S)}get isFirstLoadHappened(){return e(this,b)}triggerLazyLoad(){!e(this,v)&&e(this,d).current&&e(this,d).current!==e(this,d).previous&&(r(this,v,!0),_(this,B,G).call(this,e(this,d).current))}connectedCallback(){r(this,F,`source-consumer-${++Le}`);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 le=a=>{throw TypeError(a)};var ae=(a,n,t)=>n.has(a)||le("Cannot "+t);var e=(a,n,t)=>(ae(a,n,"read from private field"),t?t.call(a):n.get(a)),s=(a,n,t)=>n.has(a)?le("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(a):n.set(a,t),r=(a,n,t,i)=>(ae(a,n,"write to private field"),i?i.call(a,t):n.set(a,t),t),q=(a,n,t)=>(ae(a,n,"access private method"),t);var de=(a,n,t)=>new Promise((i,o)=>{var E=m=>{try{v(t.next(m))}catch(l){o(l)}},A=m=>{try{v(t.throw(m))}catch(l){o(l)}},v=m=>m.done?i(m.value):Promise.resolve(m.value).then(E,A);v((t=t.apply(a,n)).next())});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Se=require("../source/index.cjs"),we=require("../class-linked-status/index.cjs"),pe=require("../browser-CpzFX2xg.cjs"),V=require("../events-KVanG9sR.cjs"),Ee=require("../string-DhgS_iFl.cjs"),oe=require("../loading/index.cjs"),Ce=require("../device/index.cjs"),G=require("../css-property/index.cjs"),me=require("../element-resizer/vanilla/index.cjs"),fe=require("../canvas-CU5Xjahf.cjs"),Re=require("../canvas/index.cjs"),he=require("../ticker/vanilla/index.cjs");let Ie=0;var d,h,y,L,f,Y,P,c,U,B,S,M,J,Z,N,ee;class O extends HTMLElement{constructor(){super();s(this,M);s(this,d,null);s(this,h,null);s(this,y,!1);s(this,L,!1);s(this,f,!1);s(this,Y,"");s(this,P,"");s(this,c,new we.ClassLinkedStatus(this,{loading:!1,loaded:!1,error:!1,clear:!1}));s(this,U,null);s(this,B);s(this,S,null);s(this,Z,t=>{const i=t[0];e(this,f)&&(!e(this,L)||this.hasAttribute("reload-source"))&&i.isIntersecting&&this.triggerLazyLoad(),i.isIntersecting?V.dispatchEvent(this,"sourceCapture",{custom:!0}):(this.hasAttribute("reload-source")&&q(this,M,J).call(this,void 0),V.dispatchEvent(this,"sourceRelease",{custom:!0}))});s(this,N,()=>{e(this,c).set("loaded",!0),e(this,c).set("error",!1),e(this,c).set("loading",!1),!e(this,f)&&!e(this,y)&&oe.loading.complete(e(this,P)),V.dispatchEvent(this,"sourceLoaded",{custom:!0});const t=getComputedStyle(this).getPropertyValue("--clear-duration");t?r(this,B,setTimeout(()=>{e(this,c).set("clear",!0)},parseFloat(t)*1e3)):e(this,c).set("clear",!0),r(this,y,!0)});s(this,ee,t=>{e(this,c).set("loaded",!1),e(this,c).set("error",!0),e(this,c).set("loading",!1),!e(this,f)&&!e(this,y)&&oe.loading.error(e(this,P)),V.dispatchEvent(this,"sourceError",{custom:!0}),r(this,y,!0)});pe.isBrowser&&window.IntersectionObserver&&r(this,U,new IntersectionObserver(e(this,Z)))}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,S)}get isFirstLoadHappened(){return e(this,y)}triggerLazyLoad(){!e(this,L)&&e(this,d).current&&e(this,d).current!==e(this,d).previous&&(r(this,L,!0),q(this,M,J).call(this,e(this,d).current))}connectedCallback(){r(this,Y,`source-consumer-${++Ie}`);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||"",I=me.kebabToCamel(o.name);I in e(this,h)&&(e(this,h)[I]=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))&&_(this,B,G).call(this,o.current)}),e(this,d).connect(),e(this,z).observe(this)}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,v,!1),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,A=new WeakMap,c=new WeakMap,z=new WeakMap,U=new WeakMap,S=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,S,i?t.url:t.name+t.extension),this.consumeSource(e(this,S)),!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,S))}}else r(this,S,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,L,w,k,x,Y,E,C;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,L,new X.CSSProperty(this,"--offset-x",.5));s(this,w,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,L).current,e(this,w).current)):r(this,k,le.contain(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,L).current,e(this,w).current))}});s(this,C,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,L).subscribe(e(this,E)),e(this,w).subscribe(e(this,E)),this.addEventListener("sourceCapture",i=>{this.consumerElement.addEventListener("canvasRender",e(this,C))}),this.addEventListener("sourceRelease",i=>{this.consumerElement.removeEventListener("canvasRender",e(this,C))}))}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,L).observe(),e(this,w).observe(),ue.elementResizer.subscribe(this,e(this,E))}disconnectedCallback(){super.disconnectedCallback(),e(this,M).unobserve(),e(this,P).unobserve(),e(this,L).unobserve(),e(this,w).unobserve(),r(this,p,[]),ue.elementResizer.unsubscribe(e(this,E)),this.consumerElement.removeEventListener("canvasRender",e(this,C))}createConsumer(){return new Se.CanvasElement}consumeSource(t){return ce(this,null,function*(){var i,o,y,I;if(t){this.consumerElement.removeEventListener("canvasRender",e(this,C));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,C))}catch(l){console.error(l),(I=(y=this.consumerElement).onerror)==null||I.call(y,new Event("error"))}}})}}p=new WeakMap,P=new WeakMap,M=new WeakMap,L=new WeakMap,w=new WeakMap,k=new WeakMap,x=new WeakMap,Y=new WeakMap,E=new WeakMap,C=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,R,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,R,!1);s(this,N,!1);s(this,$,()=>{r(this,R,e(this,R)||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,R,!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,R=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,R)?e(this,u).playVideo():e(this,u).stopVideo(),r(this,R,!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;
5
+ `,e(this,h).classList.add("source-consumer"),Array.from(this.attributes).forEach(o=>{if(o.name!=="srcset"){const E=o.nodeValue||"",A=Ee.kebabToCamel(o.name);A in e(this,h)&&(e(this,h)[A]=E||!0)}}),this.appendChild(e(this,h)),r(this,d,new Se.SourceManager({srcset:t})),r(this,f,this.hasAttribute("lazy")),e(this,d).subscribe(o=>{(!e(this,f)||e(this,f)&&e(this,L))&&q(this,M,J).call(this,o.current)}),e(this,d).connect(),e(this,U).observe(this)}disconnectedCallback(){e(this,U).disconnect(),e(this,d).close(),e(this,h).onloadeddata=null,e(this,h).onload=null,e(this,h).onerror=null,r(this,y,!1),r(this,L,!1),e(this,h).remove(),e(this,c).reset(),clearTimeout(e(this,B))}}d=new WeakMap,h=new WeakMap,y=new WeakMap,L=new WeakMap,f=new WeakMap,Y=new WeakMap,P=new WeakMap,c=new WeakMap,U=new WeakMap,B=new WeakMap,S=new WeakMap,M=new WeakSet,J=function(t){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){r(this,P,`${e(this,Y)}-${t.url}`);const i=this.hasAttribute("keep-source-parameters");e(this,c).set("loading",!0),r(this,S,i?t.url:t.name+t.extension),this.consumeSource(e(this,S)),!e(this,f)&&!e(this,y)&&oe.loading.add(e(this,P)),e(this,h).onloadeddata=()=>{e(this,N).call(this)},e(this,h).onload=()=>{e(this,N).call(this)},e(this,h).onerror=()=>{e(this,ee).call(this,e(this,S))}}else r(this,S,null),this.consumeSource(null)},Z=new WeakMap,N=new WeakMap,ee=new WeakMap;var b,te,se;class ye extends O{constructor(){super(...arguments);s(this,b,null);s(this,te,()=>{var t,i;(i=(t=this.consumerElement).onload)==null||i.call(t,new Event("load"))});s(this,se,()=>{var t,i;(i=(t=this.consumerElement).onload)==null||i.call(t,new Event("error"))})}createConsumer(){return document.createElement("div")}consumeSource(t){e(this,b)&&(e(this,b).onload=null,e(this,b).onerror=null),this.consumerElement.innerHTML=(t==null?void 0:t.replace(/\\u003C/g,"<").replace(/\\u003E/g,">").replace(/\\"/g,'"'))||"",r(this,b,this.consumerElement.querySelector("iframe")),e(this,b)&&(e(this,b).onload=e(this,te),e(this,b).onerror=e(this,se))}}b=new WeakMap,te=new WeakMap,se=new WeakMap;customElements.get("e-iframe")||customElements.define("e-iframe",ye);class be extends O{createConsumer(){return document.createElement("img")}consumeSource(n){if(n&&this.hasAttribute("webp")&&Ce.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",be);function Ae(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,k,F,w,C,x,T,j,g,R;class ge extends O{constructor(t){super();s(this,p,[]);s(this,k,new G.CSSProperty(this,"--fit","contain"));s(this,F,new G.CSSProperty(this,"--autoplay",!1));s(this,w,new G.CSSProperty(this,"--offset-x",.5));s(this,C,new G.CSSProperty(this,"--offset-y",.5));s(this,x,null);s(this,T,0);s(this,j,1);s(this,g,()=>{if(e(this,p).length){const t=e(this,p)[0];e(this,k).current==="cover"?r(this,x,fe.cover(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,w).current,e(this,C).current)):r(this,x,fe.contain(t.naturalWidth,t.naturalHeight,this.consumerElement.width,this.consumerElement.height,e(this,w).current,e(this,C).current))}});s(this,R,t=>{if(this.status.isFalse("loaded")||!e(this,x))return;t.detail.context.clearRect(0,0,t.detail.width,t.detail.height);const i=e(this,p)[e(this,T)];i&&t.detail.context.drawImage(i,...e(this,x)),e(this,F).current&&r(this,T,(e(this,T)+1)%e(this,p).length)});pe.isBrowser&&(r(this,j,parseInt(((t==null?void 0:t.pad)||this.getAttribute("pad")||"1").toString())),e(this,k).subscribe(e(this,g)),e(this,w).subscribe(e(this,g)),e(this,C).subscribe(e(this,g)),this.addEventListener("sourceCapture",i=>{this.consumerElement.addEventListener("canvasRender",e(this,R))}),this.addEventListener("sourceRelease",i=>{this.consumerElement.removeEventListener("canvasRender",e(this,R))}))}setProgress(t){e(this,p).length&&r(this,T,Math.floor((e(this,p).length-1)*t))}connectedCallback(){super.connectedCallback(),e(this,F).observe(),e(this,k).observe(),e(this,w).observe(),e(this,C).observe(),me.elementResizer.subscribe(this,e(this,g))}disconnectedCallback(){super.disconnectedCallback(),e(this,F).unobserve(),e(this,k).unobserve(),e(this,w).unobserve(),e(this,C).unobserve(),r(this,p,[]),me.elementResizer.unsubscribe(e(this,g)),this.consumerElement.removeEventListener("canvasRender",e(this,R))}createConsumer(){return new Re.CanvasElement}consumeSource(t){return de(this,null,function*(){var i,o,E,A;if(t){this.consumerElement.removeEventListener("canvasRender",e(this,R));const v=[],m=Ae(t);if(m)for(let l=m.start;l<=m.end;l++){const ue=t.replace(/\{([^}]+)\}/,l.toString().padStart(e(this,j),"0")),X=new Image;X.src=ue,v.push(X)}else{const l=new Image;l.src=t,v.push(l)}try{yield Promise.all(v.map((l,ue)=>new Promise((X,Le)=>{l.onload=()=>{X()},l.onerror=Pe=>{Le(`${l.src} Image not found`)}}))),r(this,p,v),e(this,g).call(this),(o=(i=this.consumerElement).onload)==null||o.call(i,new Event("load")),this.isLazy||this.consumerElement.addEventListener("canvasRender",e(this,R))}catch(l){console.error(l),(A=(E=this.consumerElement).onerror)==null||A.call(E,new Event("error"))}}})}}p=new WeakMap,k=new WeakMap,F=new WeakMap,w=new WeakMap,C=new WeakMap,x=new WeakMap,T=new WeakMap,j=new WeakMap,g=new WeakMap,R=new WeakMap;customElements.get("e-sequence")||customElements.define("e-sequence",ge);var _,H;class ve extends O{constructor(){super(...arguments);s(this,_,0);s(this,H,()=>{this.classList.add(`state-${this.consumerElement.readyState}`);const t=this.consumerElement.readyState/4;t>e(this,_)&&r(this,_,t),V.dispatchEvent(this,"videoReadyStateChange",{detail:{readyState:this.consumerElement.readyState,progress:e(this,_)}}),this.consumerElement.readyState===4&&he.ticker.unsubscribe(e(this,H))})}connectedCallback(){super.connectedCallback(),this.addEventListener("sourceCapture",()=>{he.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(),he.ticker.unsubscribe(e(this,H)),r(this,_,0)}createConsumer(){return document.createElement("video")}consumeSource(t){this.consumerElement.src=t||"",this.consumerElement.autoplay=!0}}_=new WeakMap,H=new WeakMap;customElements.get("e-video")||customElements.define("e-video",ve);var u,W,I,D,$,ie,re,ne,K,ce;const z=class z extends O{constructor(){super();s(this,K);s(this,u);s(this,W);s(this,I,!1);s(this,D,!1);s(this,$,()=>{r(this,I,e(this,I)||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,ie),onError:e(this,re),onStateChange:e(this,ne)}}))});s(this,ie,()=>{r(this,D,!0),q(this,K,ce).call(this)});s(this,re,t=>{var i,o;console.error("YouTube: Ошибка при загрузке видео:",this.currentURL,t),(o=(i=this.consumerElement).onerror)==null||o.call(i,new Event("error"))});s(this,ne,()=>{});r(this,W,"yt-"+Ee.generateId(10)),z.__apiReady||(window.onYouTubeIframeAPIReady=()=>{z.__apiReady=!0,V.dispatchEvent(window,"youTubeIframeAPIReady")}),this.addEventListener("sourceCapture",()=>{this.hasAttribute("capture-autoplay")&&(e(this,D)?e(this,u).playVideo():r(this,I,!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 E=document.getElementsByTagName("script")[0];(i=E.parentNode)==null||i.insertBefore(o,E)}e(this,u)?q(this,K,ce).call(this):z.__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,I=new WeakMap,D=new WeakMap,$=new WeakMap,ie=new WeakMap,re=new WeakMap,ne=new WeakMap,K=new WeakSet,ce=function(){var t,i;this.currentURL&&(this.currentURL.startsWith("http")?e(this,u).loadVideoByUrl(this.currentURL):e(this,u).loadVideoById(this.currentURL)),e(this,I)?e(this,u).playVideo():e(this,u).stopVideo(),r(this,I,!1),(i=(t=this.consumerElement).onload)==null||i.call(t,new Event("load"))},z.__apiReady=!1;let Q=z;customElements.get("e-youtube")||customElements.define("e-youtube",Q);exports.IFameElement=ye;exports.ImageElement=be;exports.SequenceElement=ge;exports.SourceElement=O;exports.VideoElement=ve;exports.YouTubeElement=Q;
@@ -1,3 +1,4 @@
1
+ export { IFameElement } from './iframe';
1
2
  export { ImageElement } from './image';
2
3
  export { SequenceElement, type SequenceElementParameters } from './sequence';
3
4
  export { SourceElement, type SourceEvents } from './source';
@@ -1,74 +1,74 @@
1
- var he = (a) => {
1
+ var ue = (a) => {
2
2
  throw TypeError(a);
3
3
  };
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), V = (a, n, t) => (se(a, n, "access private method"), t);
6
- var ce = (a, n, t) => new Promise((i, o) => {
4
+ var ne = (a, n, t) => n.has(a) || ue("Cannot " + t);
5
+ var e = (a, n, t) => (ne(a, n, "read from private field"), t ? t.call(a) : n.get(a)), s = (a, n, t) => n.has(a) ? ue("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(a) : n.set(a, t), r = (a, n, t, i) => (ne(a, n, "write to private field"), i ? i.call(a, t) : n.set(a, t), t), U = (a, n, t) => (ne(a, n, "access private method"), t);
6
+ var de = (a, n, t) => new Promise((i, o) => {
7
7
  var y = (m) => {
8
8
  try {
9
- E(t.next(m));
10
- } catch (l) {
11
- o(l);
9
+ v(t.next(m));
10
+ } catch (u) {
11
+ o(u);
12
12
  }
13
- }, I = (m) => {
13
+ }, A = (m) => {
14
14
  try {
15
- E(t.throw(m));
16
- } catch (l) {
17
- o(l);
15
+ v(t.throw(m));
16
+ } catch (u) {
17
+ o(u);
18
18
  }
19
- }, E = (m) => m.done ? i(m.value) : Promise.resolve(m.value).then(y, I);
20
- E((t = t.apply(a, n)).next());
19
+ }, v = (m) => m.done ? i(m.value) : Promise.resolve(m.value).then(y, A);
20
+ v((t = t.apply(a, n)).next());
21
21
  });
22
- import { device as me } from "../device/index.js";
23
- import { SourceManager as fe } from "../source/index.js";
24
- import { ClassLinkedStatus as pe } from "../class-linked-status/index.js";
25
- import { i as le } from "../browser-0zX67oeU.js";
26
- import { d as U } from "../events-CsVF98U6.js";
27
- import { k as ye, g as be } from "../string-f0Dnk0L1.js";
28
- import { loading as ie } from "../loading/index.js";
29
- import { CSSProperty as K } from "../css-property/index.js";
30
- import { elementResizer as ue } from "../element-resizer/vanilla/index.js";
31
- import { c as ge, a as Ee } from "../canvas-DeZ0SLUJ.js";
32
- import { CanvasElement as ve } from "../canvas/index.js";
33
- import { ticker as re } from "../ticker/vanilla/index.js";
34
- let Le = 0;
35
- var d, h, b, v, f, q, A, c, _, B, L, H, X, G, N, J;
36
- class te extends HTMLElement {
22
+ import { SourceManager as ye } from "../source/index.js";
23
+ import { ClassLinkedStatus as Ee } from "../class-linked-status/index.js";
24
+ import { i as fe } from "../browser-0zX67oeU.js";
25
+ import { d as z } from "../events-CsVF98U6.js";
26
+ import { k as be, g as ge } from "../string-f0Dnk0L1.js";
27
+ import { loading as ae } from "../loading/index.js";
28
+ import { device as ve } from "../device/index.js";
29
+ import { CSSProperty as G } from "../css-property/index.js";
30
+ import { elementResizer as me } from "../element-resizer/vanilla/index.js";
31
+ import { c as Le, a as we } from "../canvas-DeZ0SLUJ.js";
32
+ import { CanvasElement as Ce } from "../canvas/index.js";
33
+ import { ticker as oe } from "../ticker/vanilla/index.js";
34
+ let Se = 0;
35
+ var d, h, E, L, f, N, k, c, B, H, w, M, J, Q, O, Z;
36
+ class K extends HTMLElement {
37
37
  constructor() {
38
38
  super();
39
- s(this, H);
39
+ s(this, M);
40
40
  s(this, d, null);
41
41
  s(this, h, null);
42
- s(this, b, !1);
43
- s(this, v, !1);
42
+ s(this, E, !1);
43
+ s(this, L, !1);
44
44
  s(this, f, !1);
45
- s(this, q, "");
46
- s(this, A, "");
47
- s(this, c, new pe(this, {
45
+ s(this, N, "");
46
+ s(this, k, "");
47
+ s(this, c, new Ee(this, {
48
48
  loading: !1,
49
49
  loaded: !1,
50
50
  error: !1,
51
51
  clear: !1
52
52
  }));
53
- s(this, _, null);
54
- s(this, B);
55
- s(this, L, null);
56
- s(this, G, (t) => {
53
+ s(this, B, null);
54
+ s(this, H);
55
+ s(this, w, null);
56
+ s(this, Q, (t) => {
57
57
  const i = t[0];
58
- e(this, f) && (!e(this, v) || 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 }));
58
+ e(this, f) && (!e(this, L) || this.hasAttribute("reload-source")) && i.isIntersecting && this.triggerLazyLoad(), i.isIntersecting ? z(this, "sourceCapture", { custom: !0 }) : (this.hasAttribute("reload-source") && U(this, M, J).call(this, void 0), z(this, "sourceRelease", { custom: !0 }));
59
59
  });
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, A)), U(this, "sourceLoaded", { custom: !0 });
60
+ s(this, O, () => {
61
+ e(this, c).set("loaded", !0), e(this, c).set("error", !1), e(this, c).set("loading", !1), !e(this, f) && !e(this, E) && ae.complete(e(this, k)), z(this, "sourceLoaded", { custom: !0 });
62
62
  const t = getComputedStyle(this).getPropertyValue("--clear-duration");
63
- t ? r(this, B, setTimeout(() => {
63
+ t ? r(this, H, setTimeout(() => {
64
64
  e(this, c).set("clear", !0);
65
- }, parseFloat(t) * 1e3)) : e(this, c).set("clear", !0), r(this, b, !0);
65
+ }, parseFloat(t) * 1e3)) : e(this, c).set("clear", !0), r(this, E, !0);
66
66
  });
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, A)), U(this, "sourceError", { custom: !0 }), r(this, b, !0);
67
+ s(this, Z, (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, E) && ae.error(e(this, k)), z(this, "sourceError", { custom: !0 }), r(this, E, !0);
69
69
  });
70
- le && window.IntersectionObserver && r(this, _, new IntersectionObserver(
71
- e(this, G)
70
+ fe && window.IntersectionObserver && r(this, B, new IntersectionObserver(
71
+ e(this, Q)
72
72
  ));
73
73
  }
74
74
  get consumerElement() {
@@ -84,16 +84,16 @@ class te extends HTMLElement {
84
84
  return e(this, f);
85
85
  }
86
86
  get currentURL() {
87
- return e(this, L);
87
+ return e(this, w);
88
88
  }
89
89
  get isFirstLoadHappened() {
90
- return e(this, b);
90
+ return e(this, E);
91
91
  }
92
92
  triggerLazyLoad() {
93
- !e(this, v) && e(this, d).current && e(this, d).current !== e(this, d).previous && (r(this, v, !0), V(this, H, X).call(this, e(this, d).current));
93
+ !e(this, L) && e(this, d).current && e(this, d).current !== e(this, d).previous && (r(this, L, !0), U(this, M, J).call(this, e(this, d).current));
94
94
  }
95
95
  connectedCallback() {
96
- r(this, q, `source-consumer-${++Le}`);
96
+ r(this, N, `source-consumer-${++Se}`);
97
97
  const t = this.getAttribute("srcset");
98
98
  if (!t) return;
99
99
  const i = this.hasAttribute("notify") ? this.closest(this.getAttribute("notify")) : null;
@@ -103,47 +103,70 @@ class te extends HTMLElement {
103
103
  height: 100%;
104
104
  `, e(this, h).classList.add("source-consumer"), Array.from(this.attributes).forEach((o) => {
105
105
  if (o.name !== "srcset") {
106
- const y = o.nodeValue || "", I = ye(o.name);
107
- I in e(this, h) && (e(this, h)[I] = y || !0);
106
+ const y = o.nodeValue || "", A = be(o.name);
107
+ A in e(this, h) && (e(this, h)[A] = y || !0);
108
108
  }
109
- }), this.appendChild(e(this, h)), r(this, d, new fe({
109
+ }), this.appendChild(e(this, h)), r(this, d, new ye({
110
110
  srcset: t
111
111
  })), r(this, f, this.hasAttribute("lazy")), e(this, d).subscribe((o) => {
112
- (!e(this, f) || e(this, f) && e(this, v)) && V(this, H, X).call(this, o.current);
113
- }), e(this, d).connect(), e(this, _).observe(this);
112
+ (!e(this, f) || e(this, f) && e(this, L)) && U(this, M, J).call(this, o.current);
113
+ }), e(this, d).connect(), e(this, B).observe(this);
114
114
  }
115
115
  disconnectedCallback() {
116
- 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, v, !1), e(this, h).remove(), e(this, c).reset(), clearTimeout(e(this, B));
116
+ e(this, B).disconnect(), e(this, d).close(), e(this, h).onloadeddata = null, e(this, h).onload = null, e(this, h).onerror = null, r(this, E, !1), r(this, L, !1), e(this, h).remove(), e(this, c).reset(), clearTimeout(e(this, H));
117
117
  }
118
118
  }
119
- d = new WeakMap(), h = new WeakMap(), b = new WeakMap(), v = new WeakMap(), f = new WeakMap(), q = new WeakMap(), A = new WeakMap(), c = new WeakMap(), _ = new WeakMap(), B = new WeakMap(), L = new WeakMap(), H = new WeakSet(), X = function(t) {
120
- 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) {
121
- r(this, A, `${e(this, q)}-${t.url}`);
119
+ d = new WeakMap(), h = new WeakMap(), E = new WeakMap(), L = new WeakMap(), f = new WeakMap(), N = new WeakMap(), k = new WeakMap(), c = new WeakMap(), B = new WeakMap(), H = new WeakMap(), w = new WeakMap(), M = new WeakSet(), J = function(t) {
120
+ if (clearTimeout(e(this, H)), 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) {
121
+ r(this, k, `${e(this, N)}-${t.url}`);
122
122
  const i = this.hasAttribute("keep-source-parameters");
123
- e(this, c).set("loading", !0), r(this, L, i ? t.url : t.name + t.extension), this.consumeSource(e(this, L)), !e(this, f) && !e(this, b) && ie.add(e(this, A)), e(this, h).onloadeddata = () => {
124
- e(this, N).call(this);
123
+ e(this, c).set("loading", !0), r(this, w, i ? t.url : t.name + t.extension), this.consumeSource(e(this, w)), !e(this, f) && !e(this, E) && ae.add(e(this, k)), e(this, h).onloadeddata = () => {
124
+ e(this, O).call(this);
125
125
  }, e(this, h).onload = () => {
126
- e(this, N).call(this);
126
+ e(this, O).call(this);
127
127
  }, e(this, h).onerror = () => {
128
- e(this, J).call(this, e(this, L));
128
+ e(this, Z).call(this, e(this, w));
129
129
  };
130
130
  } else
131
- r(this, L, null), this.consumeSource(null);
132
- }, G = new WeakMap(), N = new WeakMap(), J = new WeakMap();
133
- class we extends te {
131
+ r(this, w, null), this.consumeSource(null);
132
+ }, Q = new WeakMap(), O = new WeakMap(), Z = new WeakMap();
133
+ var b, ee, te;
134
+ class Re extends K {
135
+ constructor() {
136
+ super(...arguments);
137
+ s(this, b, null);
138
+ s(this, ee, () => {
139
+ var t, i;
140
+ (i = (t = this.consumerElement).onload) == null || i.call(t, new Event("load"));
141
+ });
142
+ s(this, te, () => {
143
+ var t, i;
144
+ (i = (t = this.consumerElement).onload) == null || i.call(t, new Event("error"));
145
+ });
146
+ }
147
+ createConsumer() {
148
+ return document.createElement("div");
149
+ }
150
+ consumeSource(t) {
151
+ e(this, b) && (e(this, b).onload = null, e(this, b).onerror = null), this.consumerElement.innerHTML = (t == null ? void 0 : t.replace(/\\u003C/g, "<").replace(/\\u003E/g, ">").replace(/\\"/g, '"')) || "", r(this, b, this.consumerElement.querySelector("iframe")), e(this, b) && (e(this, b).onload = e(this, ee), e(this, b).onerror = e(this, te));
152
+ }
153
+ }
154
+ b = new WeakMap(), ee = new WeakMap(), te = new WeakMap();
155
+ customElements.get("e-iframe") || customElements.define("e-iframe", Re);
156
+ class Ie extends K {
134
157
  createConsumer() {
135
158
  return document.createElement("img");
136
159
  }
137
160
  consumeSource(n) {
138
- if (n && this.hasAttribute("webp") && me.isWebp) {
161
+ if (n && this.hasAttribute("webp") && ve.isWebp) {
139
162
  const t = n.split(".").slice(0, -1).join(".") + ".webp";
140
163
  this.consumerElement.src = t;
141
164
  } else
142
165
  this.consumerElement.src = n || "";
143
166
  }
144
167
  }
145
- customElements.get("e-image") || customElements.define("e-image", we);
146
- function Ce(a) {
168
+ customElements.get("e-image") || customElements.define("e-image", Ie);
169
+ function Ae(a) {
147
170
  const n = a.match(/\{([\d-]+)\}/);
148
171
  if (n) {
149
172
  const t = n[1].split("-");
@@ -154,140 +177,140 @@ function Ce(a) {
154
177
  }
155
178
  return null;
156
179
  }
157
- var p, k, M, w, C, P, T, O, g, S;
158
- class Se extends te {
180
+ var p, P, F, C, S, T, x, Y, g, R;
181
+ class ke extends K {
159
182
  constructor(t) {
160
183
  super();
161
184
  s(this, p, []);
162
- s(this, k, new K(
185
+ s(this, P, new G(
163
186
  this,
164
187
  "--fit",
165
188
  "contain"
166
189
  ));
167
- s(this, M, new K(this, "--autoplay", !1));
168
- s(this, w, new K(this, "--offset-x", 0.5));
169
- s(this, C, new K(this, "--offset-y", 0.5));
170
- s(this, P, null);
171
- s(this, T, 0);
172
- s(this, O, 1);
190
+ s(this, F, new G(this, "--autoplay", !1));
191
+ s(this, C, new G(this, "--offset-x", 0.5));
192
+ s(this, S, new G(this, "--offset-y", 0.5));
193
+ s(this, T, null);
194
+ s(this, x, 0);
195
+ s(this, Y, 1);
173
196
  s(this, g, () => {
174
197
  if (e(this, p).length) {
175
198
  const t = e(this, p)[0];
176
- e(this, k).current === "cover" ? r(this, P, ge(
199
+ e(this, P).current === "cover" ? r(this, T, Le(
177
200
  t.naturalWidth,
178
201
  t.naturalHeight,
179
202
  this.consumerElement.width,
180
203
  this.consumerElement.height,
181
- e(this, w).current,
182
- e(this, C).current
183
- )) : r(this, P, Ee(
204
+ e(this, C).current,
205
+ e(this, S).current
206
+ )) : r(this, T, we(
184
207
  t.naturalWidth,
185
208
  t.naturalHeight,
186
209
  this.consumerElement.width,
187
210
  this.consumerElement.height,
188
- e(this, w).current,
189
- e(this, C).current
211
+ e(this, C).current,
212
+ e(this, S).current
190
213
  ));
191
214
  }
192
215
  });
193
- s(this, S, (t) => {
194
- if (this.status.isFalse("loaded") || !e(this, P))
216
+ s(this, R, (t) => {
217
+ if (this.status.isFalse("loaded") || !e(this, T))
195
218
  return;
196
219
  t.detail.context.clearRect(0, 0, t.detail.width, t.detail.height);
197
- const i = e(this, p)[e(this, T)];
198
- i && t.detail.context.drawImage(i, ...e(this, P)), e(this, M).current && r(this, T, (e(this, T) + 1) % e(this, p).length);
220
+ const i = e(this, p)[e(this, x)];
221
+ i && t.detail.context.drawImage(i, ...e(this, T)), e(this, F).current && r(this, x, (e(this, x) + 1) % e(this, p).length);
199
222
  });
200
- le && (r(this, O, parseInt(
223
+ fe && (r(this, Y, parseInt(
201
224
  ((t == null ? void 0 : t.pad) || this.getAttribute("pad") || "1").toString()
202
- )), e(this, k).subscribe(e(this, g)), e(this, w).subscribe(e(this, g)), e(this, C).subscribe(e(this, g)), this.addEventListener("sourceCapture", (i) => {
225
+ )), e(this, P).subscribe(e(this, g)), e(this, C).subscribe(e(this, g)), e(this, S).subscribe(e(this, g)), this.addEventListener("sourceCapture", (i) => {
203
226
  this.consumerElement.addEventListener(
204
227
  "canvasRender",
205
- e(this, S)
228
+ e(this, R)
206
229
  );
207
230
  }), this.addEventListener("sourceRelease", (i) => {
208
231
  this.consumerElement.removeEventListener(
209
232
  "canvasRender",
210
- e(this, S)
233
+ e(this, R)
211
234
  );
212
235
  }));
213
236
  }
214
237
  setProgress(t) {
215
- e(this, p).length && r(this, T, Math.floor((e(this, p).length - 1) * t));
238
+ e(this, p).length && r(this, x, Math.floor((e(this, p).length - 1) * t));
216
239
  }
217
240
  connectedCallback() {
218
- super.connectedCallback(), e(this, M).observe(), e(this, k).observe(), e(this, w).observe(), e(this, C).observe(), ue.subscribe(this, e(this, g));
241
+ super.connectedCallback(), e(this, F).observe(), e(this, P).observe(), e(this, C).observe(), e(this, S).observe(), me.subscribe(this, e(this, g));
219
242
  }
220
243
  disconnectedCallback() {
221
- super.disconnectedCallback(), e(this, M).unobserve(), e(this, k).unobserve(), e(this, w).unobserve(), e(this, C).unobserve(), r(this, p, []), ue.unsubscribe(e(this, g)), this.consumerElement.removeEventListener(
244
+ super.disconnectedCallback(), e(this, F).unobserve(), e(this, P).unobserve(), e(this, C).unobserve(), e(this, S).unobserve(), r(this, p, []), me.unsubscribe(e(this, g)), this.consumerElement.removeEventListener(
222
245
  "canvasRender",
223
- e(this, S)
246
+ e(this, R)
224
247
  );
225
248
  }
226
249
  createConsumer() {
227
- return new ve();
250
+ return new Ce();
228
251
  }
229
252
  consumeSource(t) {
230
- return ce(this, null, function* () {
231
- var i, o, y, I;
253
+ return de(this, null, function* () {
254
+ var i, o, y, A;
232
255
  if (t) {
233
256
  this.consumerElement.removeEventListener(
234
257
  "canvasRender",
235
- e(this, S)
258
+ e(this, R)
236
259
  );
237
- const E = [], m = Ce(t);
260
+ const v = [], m = Ae(t);
238
261
  if (m)
239
- for (let l = m.start; l <= m.end; l++) {
240
- const oe = t.replace(
262
+ for (let u = m.start; u <= m.end; u++) {
263
+ const le = t.replace(
241
264
  /\{([^}]+)\}/,
242
- l.toString().padStart(e(this, O), "0")
243
- ), j = new Image();
244
- j.src = oe, E.push(j);
265
+ u.toString().padStart(e(this, Y), "0")
266
+ ), X = new Image();
267
+ X.src = le, v.push(X);
245
268
  }
246
269
  else {
247
- const l = new Image();
248
- l.src = t, E.push(l);
270
+ const u = new Image();
271
+ u.src = t, v.push(u);
249
272
  }
250
273
  try {
251
274
  yield Promise.all(
252
- E.map((l, oe) => new Promise((j, de) => {
253
- l.onload = () => {
254
- j();
255
- }, l.onerror = (Ie) => {
256
- de(`${l.src} Image not found`);
275
+ v.map((u, le) => new Promise((X, pe) => {
276
+ u.onload = () => {
277
+ X();
278
+ }, u.onerror = (Te) => {
279
+ pe(`${u.src} Image not found`);
257
280
  };
258
281
  }))
259
- ), r(this, p, E), e(this, g).call(this), (o = (i = this.consumerElement).onload) == null || o.call(i, new Event("load")), this.isLazy || this.consumerElement.addEventListener(
282
+ ), r(this, p, v), e(this, g).call(this), (o = (i = this.consumerElement).onload) == null || o.call(i, new Event("load")), this.isLazy || this.consumerElement.addEventListener(
260
283
  "canvasRender",
261
- e(this, S)
284
+ e(this, R)
262
285
  );
263
- } catch (l) {
264
- console.error(l), (I = (y = this.consumerElement).onerror) == null || I.call(y, new Event("error"));
286
+ } catch (u) {
287
+ console.error(u), (A = (y = this.consumerElement).onerror) == null || A.call(y, new Event("error"));
265
288
  }
266
289
  }
267
290
  });
268
291
  }
269
292
  }
270
- p = new WeakMap(), k = new WeakMap(), M = new WeakMap(), w = new WeakMap(), C = new WeakMap(), P = new WeakMap(), T = new WeakMap(), O = new WeakMap(), g = new WeakMap(), S = new WeakMap();
271
- customElements.get("e-sequence") || customElements.define("e-sequence", Se);
272
- var x, W;
273
- class Re extends te {
293
+ p = new WeakMap(), P = new WeakMap(), F = new WeakMap(), C = new WeakMap(), S = new WeakMap(), T = new WeakMap(), x = new WeakMap(), Y = new WeakMap(), g = new WeakMap(), R = new WeakMap();
294
+ customElements.get("e-sequence") || customElements.define("e-sequence", ke);
295
+ var V, W;
296
+ class Pe extends K {
274
297
  constructor() {
275
298
  super(...arguments);
276
- s(this, x, 0);
299
+ s(this, V, 0);
277
300
  s(this, W, () => {
278
301
  this.classList.add(`state-${this.consumerElement.readyState}`);
279
302
  const t = this.consumerElement.readyState / 4;
280
- t > e(this, x) && r(this, x, t), U(this, "videoReadyStateChange", {
303
+ t > e(this, V) && r(this, V, t), z(this, "videoReadyStateChange", {
281
304
  detail: {
282
305
  readyState: this.consumerElement.readyState,
283
- progress: e(this, x)
306
+ progress: e(this, V)
284
307
  }
285
- }), this.consumerElement.readyState === 4 && re.unsubscribe(e(this, W));
308
+ }), this.consumerElement.readyState === 4 && oe.unsubscribe(e(this, W));
286
309
  });
287
310
  }
288
311
  connectedCallback() {
289
312
  super.connectedCallback(), this.addEventListener("sourceCapture", () => {
290
- re.subscribe(e(this, W)), this.hasAttribute("capture-autoplay") && this.consumerElement.play();
313
+ oe.subscribe(e(this, W)), this.hasAttribute("capture-autoplay") && this.consumerElement.play();
291
314
  }), this.addEventListener("sourceRelease", () => {
292
315
  this.hasAttribute("capture-autoplay") && (this.consumerElement.pause(), this.hasAttribute("replay") && (this.consumerElement.currentTime = 0)), this.hasAttribute("reload-source") && this.classList.remove(
293
316
  "state-0",
@@ -299,7 +322,7 @@ class Re extends te {
299
322
  });
300
323
  }
301
324
  disconnectedCallback() {
302
- super.disconnectedCallback(), re.unsubscribe(e(this, W)), r(this, x, 0);
325
+ super.disconnectedCallback(), oe.unsubscribe(e(this, W)), r(this, V, 0);
303
326
  }
304
327
  createConsumer() {
305
328
  return document.createElement("video");
@@ -308,45 +331,45 @@ class Re extends te {
308
331
  this.consumerElement.src = t || "", this.consumerElement.autoplay = !0;
309
332
  }
310
333
  }
311
- x = new WeakMap(), W = new WeakMap();
312
- customElements.get("e-video") || customElements.define("e-video", Re);
313
- var u, $, R, Y, F, Q, Z, ee, D, ae;
314
- const z = class z extends te {
334
+ V = new WeakMap(), W = new WeakMap();
335
+ customElements.get("e-video") || customElements.define("e-video", Pe);
336
+ var l, $, I, D, q, se, ie, re, j, ce;
337
+ const _ = class _ extends K {
315
338
  constructor() {
316
339
  super();
317
- s(this, D);
318
- s(this, u);
340
+ s(this, j);
341
+ s(this, l);
319
342
  s(this, $);
320
- s(this, R, !1);
321
- s(this, Y, !1);
322
- s(this, F, () => {
323
- r(this, R, e(this, R) || this.hasAttribute("autoplay") && !this.hasAttribute("capture-autoplay")), r(this, u, new window.YT.Player(e(this, $), {
343
+ s(this, I, !1);
344
+ s(this, D, !1);
345
+ s(this, q, () => {
346
+ r(this, I, e(this, I) || this.hasAttribute("autoplay") && !this.hasAttribute("capture-autoplay")), r(this, l, new window.YT.Player(e(this, $), {
324
347
  playerVars: {
325
348
  mute: this.hasAttribute("muted") ? 1 : 0,
326
349
  controls: this.hasAttribute("controls") ? 1 : 0
327
350
  },
328
351
  events: {
329
- onReady: e(this, Q),
330
- onError: e(this, Z),
331
- onStateChange: e(this, ee)
352
+ onReady: e(this, se),
353
+ onError: e(this, ie),
354
+ onStateChange: e(this, re)
332
355
  }
333
356
  }));
334
357
  });
335
- s(this, Q, () => {
336
- r(this, Y, !0), V(this, D, ae).call(this);
358
+ s(this, se, () => {
359
+ r(this, D, !0), U(this, j, ce).call(this);
337
360
  });
338
- s(this, Z, (t) => {
361
+ s(this, ie, (t) => {
339
362
  var i, o;
340
363
  console.error("YouTube: Ошибка при загрузке видео:", this.currentURL, t), (o = (i = this.consumerElement).onerror) == null || o.call(i, new Event("error"));
341
364
  });
342
- s(this, ee, () => {
365
+ s(this, re, () => {
343
366
  });
344
- r(this, $, "yt-" + be(10)), z.__apiReady || (window.onYouTubeIframeAPIReady = () => {
345
- z.__apiReady = !0, U(window, "youTubeIframeAPIReady");
367
+ r(this, $, "yt-" + ge(10)), _.__apiReady || (window.onYouTubeIframeAPIReady = () => {
368
+ _.__apiReady = !0, z(window, "youTubeIframeAPIReady");
346
369
  }), this.addEventListener("sourceCapture", () => {
347
- this.hasAttribute("capture-autoplay") && (e(this, Y) ? e(this, u).playVideo() : r(this, R, !0));
370
+ this.hasAttribute("capture-autoplay") && (e(this, D) ? e(this, l).playVideo() : r(this, I, !0));
348
371
  }), this.addEventListener("sourceRelease", () => {
349
- e(this, u) && this.hasAttribute("capture-autoplay") && (e(this, u).pauseVideo(), this.hasAttribute("replay") && e(this, u).seekTo(0));
372
+ e(this, l) && this.hasAttribute("capture-autoplay") && (e(this, l).pauseVideo(), this.hasAttribute("replay") && e(this, l).seekTo(0));
350
373
  });
351
374
  }
352
375
  static __onYouTubeIframeAPIReady() {
@@ -365,23 +388,24 @@ const z = class z extends te {
365
388
  const y = document.getElementsByTagName("script")[0];
366
389
  (i = y.parentNode) == null || i.insertBefore(o, y);
367
390
  }
368
- e(this, u) ? V(this, D, ae).call(this) : z.__apiReady ? e(this, F).call(this) : addEventListener("youTubeIframeAPIReady", e(this, F));
369
- } else e(this, u) && e(this, u).stopVideo();
391
+ e(this, l) ? U(this, j, ce).call(this) : _.__apiReady ? e(this, q).call(this) : addEventListener("youTubeIframeAPIReady", e(this, q));
392
+ } else e(this, l) && e(this, l).stopVideo();
370
393
  }
371
394
  disconnectedCallback() {
372
- super.disconnectedCallback(), e(this, u) && e(this, u).destroy(), removeEventListener("youTubeIframeAPIReady", e(this, F));
395
+ super.disconnectedCallback(), e(this, l) && e(this, l).destroy(), removeEventListener("youTubeIframeAPIReady", e(this, q));
373
396
  }
374
397
  };
375
- u = new WeakMap(), $ = new WeakMap(), R = new WeakMap(), Y = new WeakMap(), F = new WeakMap(), Q = new WeakMap(), Z = new WeakMap(), ee = new WeakMap(), D = new WeakSet(), ae = function() {
398
+ l = new WeakMap(), $ = new WeakMap(), I = new WeakMap(), D = new WeakMap(), q = new WeakMap(), se = new WeakMap(), ie = new WeakMap(), re = new WeakMap(), j = new WeakSet(), ce = function() {
376
399
  var t, i;
377
- this.currentURL && (this.currentURL.startsWith("http") ? e(this, u).loadVideoByUrl(this.currentURL) : e(this, u).loadVideoById(this.currentURL)), e(this, R) ? e(this, u).playVideo() : e(this, u).stopVideo(), r(this, R, !1), (i = (t = this.consumerElement).onload) == null || i.call(t, new Event("load"));
378
- }, z.__apiReady = !1;
379
- let ne = z;
380
- customElements.get("e-youtube") || customElements.define("e-youtube", ne);
400
+ this.currentURL && (this.currentURL.startsWith("http") ? e(this, l).loadVideoByUrl(this.currentURL) : e(this, l).loadVideoById(this.currentURL)), e(this, I) ? e(this, l).playVideo() : e(this, l).stopVideo(), r(this, I, !1), (i = (t = this.consumerElement).onload) == null || i.call(t, new Event("load"));
401
+ }, _.__apiReady = !1;
402
+ let he = _;
403
+ customElements.get("e-youtube") || customElements.define("e-youtube", he);
381
404
  export {
382
- we as ImageElement,
383
- Se as SequenceElement,
384
- te as SourceElement,
385
- Re as VideoElement,
386
- ne as YouTubeElement
405
+ Re as IFameElement,
406
+ Ie as ImageElement,
407
+ ke as SequenceElement,
408
+ K as SourceElement,
409
+ Pe as VideoElement,
410
+ he as YouTubeElement
387
411
  };
@@ -1 +1 @@
1
- "use strict";var F=n=>{throw TypeError(n)};var W=(n,c,t)=>c.has(n)||F("Cannot "+t);var e=(n,c,t)=>(W(n,c,"read from private field"),t?t.call(n):c.get(n)),s=(n,c,t)=>c.has(n)?F("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,t),i=(n,c,t,h)=>(W(n,c,"write to private field"),h?h.call(n,t):c.set(n,t),t),v=(n,c,t)=>(W(n,c,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../css-property/index.cjs"),X=require("../Store-C2J4Q87x.cjs"),I=require("../events-KVanG9sR.cjs"),Y=require("../function-MthRj-GJ.cjs"),Z=require("../style-At6aDoqG.cjs"),G=require("../url-BiHPIsKq.cjs"),J=require("../window-resizer/vanilla/index.cjs"),ee=require("../browser-CpzFX2xg.cjs");var C,d,O,S,u,m,p,g,f,y,b,w,l,K,T,N,A,B,k,_,R,x,D;const a=class a extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,C);s(this,d);s(this,O);s(this,S);s(this,u);s(this,m);s(this,p);s(this,g);s(this,f);s(this,y);s(this,b);s(this,w);s(this,T);s(this,A);s(this,k);s(this,_);s(this,R);s(this,x);this.urlValue="",i(this,C,-1),i(this,d,new X.Store(!1)),i(this,u,new E.CSSProperty(this,"--history",!1)),i(this,m,new E.CSSProperty(this,"--restore",!1)),i(this,p,new E.CSSProperty(this,"--dominance",0)),i(this,g,new E.CSSProperty(this,"--group","")),i(this,f,new E.CSSProperty(this,"--click-outside",!1)),i(this,y,new E.CSSProperty(this,"--escape",!1)),i(this,b,!1),this.open=t=>{if(e(this,d).current)return;i(this,w,t==null?void 0:t.trigger),e(this,p).current&&(a.__opened=a.__opened.filter(o=>o!==this&&v(this,l,D).call(this,this,o)?(o.close(),!1):!0)),a.__opened.push(this),i(this,C,a.__opened.length-1),clearTimeout(e(this,O)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",I.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,w)}}),e(this,u).current&&e(this,b)&&history.pushState(history.state,"",e(this,l,K)),e(this,d).current=!0;const h=()=>{addEventListener("click",e(this,T)),addEventListener("keydown",e(this,A)),e(this,x).call(this),this.style.opacity="1",this.classList.add("opened"),I.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,w)}}),i(this,S,void 0),this.setAttribute("aria-hidden","false")};t!=null&&t.skipTransition?h():i(this,S,setTimeout(h,10))},this.close=()=>{e(this,d).current&&(removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,A)),e(this,d).current=!1,a.__opened=a.__opened.filter(t=>t===this?!1:!e(t,S)&&v(this,l,D).call(this,this,t)?(t.close(),!1):!0),v(this,l,N).call(this),this.classList.remove("opened"),this.classList.add("closing"),this.setAttribute("aria-hidden","true"),this.style.opacity="0",I.dispatchEvent(this,"popoverClosing",{custom:!0}),setTimeout(()=>{this.classList.remove("triggered"),this.classList.remove("closing"),this.style.display="none",I.dispatchEvent(this,"popoverClosed",{custom:!0})},Z.getElementTransitionDurationMS(this)+10))},i(this,T,t=>{e(this,f).current&&v(this,l,B).call(this,()=>{var U;const h=t.composedPath();if(h.find(j=>j instanceof HTMLElement&&j.hasAttribute("data-popover-content")))return;const o=h[0],z=o instanceof Node&&(this.contains(o)||((U=this.shadowRoot)==null?void 0:U.contains(o))),P=o instanceof HTMLElement&&o.hasAttribute("data-outside");(!z||P)&&this.close()})}),i(this,A,t=>{e(this,y).current&&v(this,l,B).call(this,()=>{t.code==="Escape"&&this.close()})}),i(this,k,()=>{i(this,b,!1),e(this,d).current&&e(this,u).current&&!location.search.includes(this.id)?this.close():!e(this,d).current&&e(this,u).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),i(this,b,!0)}),i(this,_,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,R).call(this)}),i(this,R,Y.debounce(()=>{e(this,x).call(this)},10)),i(this,x,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")})}get history(){return e(this,u)}get restore(){return e(this,m)}get dominance(){return e(this,p)}get group(){return e(this,g)}get clickOutside(){return e(this,f)}get escape(){return e(this,y)}get opened(){return e(this,d)}get lastTrigger(){return e(this,w)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,d).current&&G.updateSearchParameter(this.id,t)}connectedCallback(){e(this,u).observe(),e(this,m).observe(),e(this,p).observe(),e(this,g).observe(),e(this,f).observe(),e(this,y).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("role","dialog"),this.setAttribute("aria-hidden","true"),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,k)),setTimeout(()=>{e(this,m).current?(this.urlValue=G.parseSearchParameters(location.search)[this.id],e(this,k).call(this)):(v(this,l,N).call(this),i(this,b,!0))},0),J.windowResizer.subscribe(e(this,_))}disconnectedCallback(){J.windowResizer.unsubscribe(e(this,_)),e(this,u).close(),e(this,m).close(),e(this,p).close(),e(this,g).close(),e(this,f).close(),e(this,y).close(),this.style.opacity="",this.style.display="",this.removeAttribute("role"),this.removeAttribute("aria-hidden"),a.__opened=a.__opened.filter(t=>t!==this),clearTimeout(e(this,O)),clearTimeout(e(this,S)),removeEventListener("popstate",e(this,k)),removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,A)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),v(this,l,N).call(this)}};C=new WeakMap,d=new WeakMap,O=new WeakMap,S=new WeakMap,u=new WeakMap,m=new WeakMap,p=new WeakMap,g=new WeakMap,f=new WeakMap,y=new WeakMap,b=new WeakMap,w=new WeakMap,l=new WeakSet,K=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},T=new WeakMap,N=function(){if(e(this,u).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},A=new WeakMap,B=function(t){(a.__opened[e(this,C)-1]||a.__opened.length===1||a.__opened.filter(h=>h!==this).every(h=>e(this,p).current>h.dominance.current))&&t()},k=new WeakMap,_=new WeakMap,R=new WeakMap,x=new WeakMap,D=function(t,h){if(e(t,g).current===e(h,g).current&&t.dominance.current>=h.dominance.current)return!0},a.__opened=[];let q=a;customElements.get("e-popover")||customElements.define("e-popover",q);var r,L,V,M,$,H;class Q extends HTMLElement{constructor(){super();s(this,r);s(this,L,new E.CSSProperty(this,"--type","open"));s(this,V,()=>{this.classList.add("triggered")});s(this,M,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});s(this,$,()=>{this.classList.remove("opened")});s(this,H,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});ee.isBrowser&&(this.addEventListener("click",()=>{if(e(this,r)){const t=e(this,L).current;t==="open"||t==="toggle"&&!e(this,r).opened.current?e(this,r).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,r).opened.current)&&e(this,r).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,L)}get popoverElement(){return e(this,r)}connectedCallback(){var h;e(this,L).subscribe(o=>{e(this,r)instanceof q&&(o.current!=="close"?(this.setAttribute("aria-has-popup","true"),this.setAttribute("aria-expanded",e(this,r).opened.current?"true":"false"),this.setAttribute("aria-controls",e(this,r).id||"")):(this.removeAttribute("aria-has-popup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let o=null;if(t==="parent"){const z=this.closest("[popover-target]");if(z)o=z;else{const P=this.getRootNode();P instanceof ShadowRoot?o=P.host.closest("[popover-target]"):P instanceof HTMLElement&&(o=P.closest("[popover-target]"))}}else t==="sibling"?o=(h=this.parentElement)==null?void 0:h.querySelector("[popover-target]"):o=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);o instanceof HTMLElement?(i(this,r,o),e(this,r).addEventListener("popoverTriggered",e(this,V)),e(this,r).addEventListener("popoverOpened",e(this,M)),e(this,r).addEventListener("popoverClosing",e(this,$)),e(this,r).addEventListener("popoverClosed",e(this,H))):console.warn(this,`target ${t} not found`)}this.isConnected&&e(this,L).observe()}disconnectedCallback(){e(this,L).unobserve(),this.removeAttribute("aria-has-popup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),e(this,r)&&(e(this,r).removeEventListener("popoverTriggered",e(this,V)),e(this,r).removeEventListener("popoverOpened",e(this,M)),e(this,r).removeEventListener("popoverClosing",e(this,$)),e(this,r).removeEventListener("popoverClosed",e(this,H)))}}r=new WeakMap,L=new WeakMap,V=new WeakMap,M=new WeakMap,$=new WeakMap,H=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",Q);exports.PopoverButtonElement=Q;exports.PopoverElement=q;
1
+ "use strict";var F=n=>{throw TypeError(n)};var W=(n,c,t)=>c.has(n)||F("Cannot "+t);var e=(n,c,t)=>(W(n,c,"read from private field"),t?t.call(n):c.get(n)),s=(n,c,t)=>c.has(n)?F("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,t),i=(n,c,t,h)=>(W(n,c,"write to private field"),h?h.call(n,t):c.set(n,t),t),v=(n,c,t)=>(W(n,c,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../css-property/index.cjs"),X=require("../Store-C2J4Q87x.cjs"),I=require("../events-KVanG9sR.cjs"),Y=require("../function-MthRj-GJ.cjs"),Z=require("../style-At6aDoqG.cjs"),G=require("../url-BiHPIsKq.cjs"),J=require("../window-resizer/vanilla/index.cjs"),ee=require("../browser-CpzFX2xg.cjs");var C,d,O,S,u,m,p,g,f,y,b,w,l,K,T,N,A,B,k,_,R,x,D;const a=class a extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,C);s(this,d);s(this,O);s(this,S);s(this,u);s(this,m);s(this,p);s(this,g);s(this,f);s(this,y);s(this,b);s(this,w);s(this,T);s(this,A);s(this,k);s(this,_);s(this,R);s(this,x);this.urlValue="",i(this,C,-1),i(this,d,new X.Store(!1)),i(this,u,new E.CSSProperty(this,"--history",!1)),i(this,m,new E.CSSProperty(this,"--restore",!1)),i(this,p,new E.CSSProperty(this,"--dominance",0)),i(this,g,new E.CSSProperty(this,"--group","")),i(this,f,new E.CSSProperty(this,"--click-outside",!1)),i(this,y,new E.CSSProperty(this,"--escape",!1)),i(this,b,!1),this.open=t=>{if(e(this,d).current)return;i(this,w,t==null?void 0:t.trigger),e(this,p).current&&(a.__opened=a.__opened.filter(o=>o!==this&&v(this,l,D).call(this,this,o)?(o.close(),!1):!0)),a.__opened.push(this),i(this,C,a.__opened.length-1),clearTimeout(e(this,O)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",I.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,w)}}),e(this,u).current&&e(this,b)&&history.pushState(history.state,"",e(this,l,K)),e(this,d).current=!0;const h=()=>{addEventListener("click",e(this,T)),addEventListener("keydown",e(this,A)),e(this,x).call(this),this.style.opacity="1",this.classList.add("opened"),I.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,w)}}),i(this,S,void 0),this.setAttribute("aria-hidden","false")};t!=null&&t.skipTransition?h():i(this,S,setTimeout(h,10))},this.close=()=>{e(this,d).current&&(removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,A)),e(this,d).current=!1,a.__opened=a.__opened.filter(t=>t===this?!1:!e(t,S)&&v(this,l,D).call(this,this,t)?(t.close(),!1):!0),v(this,l,N).call(this),this.classList.remove("opened"),this.classList.add("closing"),this.setAttribute("aria-hidden","true"),this.style.opacity="0",I.dispatchEvent(this,"popoverClosing",{custom:!0}),setTimeout(()=>{this.classList.remove("triggered"),this.classList.remove("closing"),this.style.display="none",I.dispatchEvent(this,"popoverClosed",{custom:!0})},Z.getElementTransitionDurationMS(this)+10))},i(this,T,t=>{e(this,f).current&&v(this,l,B).call(this,()=>{var U;const h=t.composedPath();if(h.find(j=>j instanceof HTMLElement&&j.hasAttribute("data-popover-content")))return;const o=h[0],z=o instanceof Node&&(this.contains(o)||((U=this.shadowRoot)==null?void 0:U.contains(o))),P=o instanceof HTMLElement&&o.hasAttribute("data-outside");(!z||P)&&this.close()})}),i(this,A,t=>{e(this,y).current&&v(this,l,B).call(this,()=>{t.code==="Escape"&&this.close()})}),i(this,k,()=>{i(this,b,!1),e(this,d).current&&e(this,u).current&&!location.search.includes(this.id)?this.close():!e(this,d).current&&e(this,u).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),i(this,b,!0)}),i(this,_,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,R).call(this)}),i(this,R,Y.debounce(()=>{e(this,x).call(this)},10)),i(this,x,()=>{this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px")})}get history(){return e(this,u)}get restore(){return e(this,m)}get dominance(){return e(this,p)}get group(){return e(this,g)}get clickOutside(){return e(this,f)}get escape(){return e(this,y)}get opened(){return e(this,d)}get lastTrigger(){return e(this,w)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,d).current&&G.updateSearchParameter(this.id,t)}connectedCallback(){e(this,u).observe(),e(this,m).observe(),e(this,p).observe(),e(this,g).observe(),e(this,f).observe(),e(this,y).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("role","dialog"),this.setAttribute("aria-hidden","true"),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,k)),setTimeout(()=>{e(this,m).current?(this.urlValue=G.parseSearchParameters(location.search)[this.id],e(this,k).call(this)):(v(this,l,N).call(this),i(this,b,!0))},0),J.windowResizer.subscribe(e(this,_))}disconnectedCallback(){J.windowResizer.unsubscribe(e(this,_)),e(this,u).close(),e(this,m).close(),e(this,p).close(),e(this,g).close(),e(this,f).close(),e(this,y).close(),this.style.opacity="",this.style.display="",this.removeAttribute("role"),this.removeAttribute("aria-hidden"),a.__opened=a.__opened.filter(t=>t!==this),clearTimeout(e(this,O)),clearTimeout(e(this,S)),removeEventListener("popstate",e(this,k)),removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,A)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),v(this,l,N).call(this)}};C=new WeakMap,d=new WeakMap,O=new WeakMap,S=new WeakMap,u=new WeakMap,m=new WeakMap,p=new WeakMap,g=new WeakMap,f=new WeakMap,y=new WeakMap,b=new WeakMap,w=new WeakMap,l=new WeakSet,K=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},T=new WeakMap,N=function(){if(e(this,u).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},A=new WeakMap,B=function(t){(a.__opened[e(this,C)-1]||a.__opened.length===1||a.__opened.filter(h=>h!==this).every(h=>e(this,p).current>h.dominance.current))&&t()},k=new WeakMap,_=new WeakMap,R=new WeakMap,x=new WeakMap,D=function(t,h){if(e(t,g).current===e(h,g).current&&t.dominance.current>=h.dominance.current)return!0},a.__opened=[];let q=a;customElements.get("e-popover")||customElements.define("e-popover",q);var r,L,V,M,$,H;class Q extends HTMLElement{constructor(){super();s(this,r);s(this,L,new E.CSSProperty(this,"--type","open"));s(this,V,()=>{this.classList.add("triggered")});s(this,M,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});s(this,$,()=>{this.classList.remove("opened")});s(this,H,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});ee.isBrowser&&(this.addEventListener("click",()=>{if(e(this,r)){const t=e(this,L).current;t==="open"||t==="toggle"&&!e(this,r).opened.current?e(this,r).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,r).opened.current)&&e(this,r).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&t.currentTarget.click()}))}get type(){return e(this,L)}get popoverElement(){return e(this,r)}connectedCallback(){var h;e(this,L).subscribe(o=>{e(this,r)instanceof q&&(o.current!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,r).opened.current?"true":"false"),this.setAttribute("aria-controls",e(this,r).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))}),this.hasAttribute("tabindex")||(this.tabIndex=0);const t=this.getAttribute("target");if(t){let o=null;if(t==="parent"){const z=this.closest("[popover-target]");if(z)o=z;else{const P=this.getRootNode();P instanceof ShadowRoot?o=P.host.closest("[popover-target]"):P instanceof HTMLElement&&(o=P.closest("[popover-target]"))}}else t==="sibling"?o=(h=this.parentElement)==null?void 0:h.querySelector("[popover-target]"):o=document.querySelector(`#${t}`)||this.getRootNode().querySelector(`#${t}`);o instanceof HTMLElement?(i(this,r,o),e(this,r).addEventListener("popoverTriggered",e(this,V)),e(this,r).addEventListener("popoverOpened",e(this,M)),e(this,r).addEventListener("popoverClosing",e(this,$)),e(this,r).addEventListener("popoverClosed",e(this,H))):console.warn(this,`target ${t} not found`)}this.isConnected&&e(this,L).observe()}disconnectedCallback(){e(this,L).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),e(this,r)&&(e(this,r).removeEventListener("popoverTriggered",e(this,V)),e(this,r).removeEventListener("popoverOpened",e(this,M)),e(this,r).removeEventListener("popoverClosing",e(this,$)),e(this,r).removeEventListener("popoverClosed",e(this,H)))}}r=new WeakMap,L=new WeakMap,V=new WeakMap,M=new WeakMap,$=new WeakMap,H=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",Q);exports.PopoverButtonElement=Q;exports.PopoverElement=q;
@@ -175,10 +175,10 @@ class te extends HTMLElement {
175
175
  connectedCallback() {
176
176
  var h;
177
177
  e(this, b).subscribe((o) => {
178
- e(this, r) instanceof W && (o.current !== "close" ? (this.setAttribute("aria-has-popup", "true"), this.setAttribute(
178
+ e(this, r) instanceof W && (o.current !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
179
179
  "aria-expanded",
180
180
  e(this, r).opened.current ? "true" : "false"
181
- ), this.setAttribute("aria-controls", e(this, r).id || "")) : (this.removeAttribute("aria-has-popup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
181
+ ), this.setAttribute("aria-controls", e(this, r).id || "")) : (this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
182
182
  }), this.hasAttribute("tabindex") || (this.tabIndex = 0);
183
183
  const t = this.getAttribute("target");
184
184
  if (t) {
@@ -209,7 +209,7 @@ class te extends HTMLElement {
209
209
  this.isConnected && e(this, b).observe();
210
210
  }
211
211
  disconnectedCallback() {
212
- e(this, b).unobserve(), this.removeAttribute("aria-has-popup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), e(this, r) && (e(this, r).removeEventListener(
212
+ e(this, b).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), e(this, r) && (e(this, r).removeEventListener(
213
213
  "popoverTriggered",
214
214
  e(this, $)
215
215
  ), e(this, r).removeEventListener(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.40.2",
3
+ "version": "0.40.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"