aptechka 0.39.2 → 0.39.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.
@@ -9,6 +9,7 @@ export interface MorphParameters {
9
9
  export interface MorphNavigationEntry {
10
10
  pathname: string;
11
11
  isCached: boolean;
12
+ state?: any;
12
13
  }
13
14
  export interface MorphPreprocessorEntry extends MorphNavigationEntry {
14
15
  resolve: () => void;
@@ -17,6 +18,10 @@ export interface MorphPreprocessorEntry extends MorphNavigationEntry {
17
18
  export type MorphPreprocessor = (entry: MorphPreprocessorEntry) => void;
18
19
  export type MorphNavigationCallback = (entry: MorphNavigationEntry) => void;
19
20
  export type MorphPostprocessor = MorphNavigationCallback;
21
+ export interface MorphNavigateOptions {
22
+ historyAction?: ChangeHistoryAction;
23
+ state?: any;
24
+ }
20
25
  export declare class Morph {
21
26
  #private;
22
27
  preprocessor?: MorphPreprocessor;
@@ -33,7 +38,7 @@ export declare class Morph {
33
38
  beforeNavigationEvent(callback: MorphNavigationCallback): () => void;
34
39
  afterNavigationEvent(callback: MorphNavigationCallback): () => void;
35
40
  prefetch(path: string): Promise<Document>;
36
- navigate(path: string, historyAction?: ChangeHistoryAction): Promise<void>;
41
+ navigate(path: string, { historyAction, state }?: MorphNavigateOptions): Promise<void>;
37
42
  addLinks(elements: Array<HTMLAnchorElement>): void;
38
43
  findLinks(): void;
39
44
  }
@@ -1 +1 @@
1
- "use strict";var et=(s,t)=>(t=Symbol[s])?t:Symbol.for("Symbol."+s),it=s=>{throw TypeError(s)};var G=(s,t,i)=>t.has(s)||it("Cannot "+i);var e=(s,t,i)=>(G(s,t,"read from private field"),i?i.call(s):t.get(s)),o=(s,t,i)=>t.has(s)?it("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,i),l=(s,t,i,r)=>(G(s,t,"write to private field"),r?r.call(s,i):t.set(s,i),i),v=(s,t,i)=>(G(s,t,"access private method"),i);var N=(s,t,i)=>new Promise((r,n)=>{var d=c=>{try{f(i.next(c))}catch(E){n(E)}},g=c=>{try{f(i.throw(c))}catch(E){n(E)}},f=c=>c.done?r(c.value):Promise.resolve(c.value).then(d,g);f((i=i.apply(s,t)).next())});var st=(s,t,i)=>(t=s[et("asyncIterator")])?t.call(s):(s=s[et("iterator")](),t={},i=(r,n)=>(n=s[r])&&(t[r]=d=>new Promise((g,f,c)=>(d=n.call(s,d),c=d.done,Promise.resolve(d.value).then(E=>g({value:E,done:c}),f)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const nt=require("../notifier/index.cjs"),dt=require("../browser-CpzFX2xg.cjs"),O=require("../url-DELd-VFC.cjs"),rt=require("../loading/index.cjs");var y,h,m,T,M,C,k;class at{constructor(t,i){o(this,y);o(this,h);o(this,m);o(this,T);o(this,M);o(this,C,t=>{t.preventDefault(),e(this,y).links.forEach(i=>{var r;e(this,m)===e(i,m)||(r=e(i,M))!=null&&r.includes(e(this,m))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,y).navigate(e(this,m),e(this,T))});o(this,k,()=>{e(this,y).prefetch(e(this,m)),e(this,h).removeEventListener("pointerenter",e(this,k))});var d,g;l(this,y,i),l(this,h,t),l(this,m,e(this,h).getAttribute("href")||"/"),l(this,T,e(this,h).getAttribute("data-history-action")||"push"),e(this,h).addEventListener("click",e(this,C));const r=i.normalizePath(e(this,m)),n=i.normalizePath(location.pathname);l(this,M,(d=e(this,h).getAttribute("data-match-paths"))==null?void 0:d.split(",").map(f=>i.normalizePath(f.trim()).pathname)),e(this,h).hasAttribute("data-include")?n.pathname.includes(r.pathname)&&e(this,h).classList.add("current"):r.pathname===n.pathname||(g=e(this,M))!=null&&g.includes(n.pathname)?(e(this,h).classList.add("current"),e(this,h).classList.add("clicked")):e(this,h).classList.remove("clicked"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,k))}destroy(){e(this,h).removeEventListener("click",e(this,C)),e(this,h).removeEventListener("pointerenter",e(this,k)),e(this,h).classList.remove("current")}}y=new WeakMap,h=new WeakMap,m=new WeakMap,T=new WeakMap,M=new WeakMap,C=new WeakMap,k=new WeakMap;var S,z,q,x,A,B,P,w,p,_,D,u,J,Q,ot,U,W;class ut{constructor(t){o(this,u);o(this,S,null);o(this,z,null);o(this,q,null);o(this,x,null);o(this,A,[]);o(this,B,new DOMParser);o(this,P,new Map);o(this,w);o(this,p,null);o(this,_,new nt.Notifier);o(this,D,new nt.Notifier);o(this,W,t=>{t.state&&this.navigate(t.state,"none")});if(dt.isBrowser){l(this,S,O.normalizeBase(t==null?void 0:t.base)),l(this,z,(t==null?void 0:t.waitForHeadToLoad)!==!1),l(this,q,(t==null?void 0:t.cachePages)!==!1),l(this,x,v(this,u,Q).call(this,document.body));const i=this.normalizePath(location.pathname);l(this,p,i.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,p)),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),addEventListener("popstate",e(this,W)),O.changeHistory("replace",e(this,p),i.parameters,i.hash)}}get currentPathname(){return e(this,p)}get links(){return e(this,A)}normalizePath(t){return O.splitPath(t,e(this,S))}beforeNavigationEvent(t){return e(this,_).subscribe(t)}afterNavigationEvent(t){return e(this,D).subscribe(t)}prefetch(t){return N(this,null,function*(){const i=this.normalizePath(t);return v(this,u,J).call(this,i.pathname)})}navigate(t,i="push"){return N(this,null,function*(){var E;const r=this.normalizePath(t);let{pathname:n,hash:d,parameters:g,leaf:f}=r;if(e(this,w)===n||e(this,p)===n)return;l(this,w,n);const c=e(this,P).has(n);try{rt.loading.add("__morph");let R=!0;if(e(this,_).notify({pathname:n,isCached:c}),this.preprocessor)try{yield new Promise((a,L)=>{var b;(b=this.preprocessor)==null||b.call(this,{pathname:n,resolve:a,reject:L,isCached:c})})}catch(a){a?console.error(a):console.log("Route change canceled"),R=!1}if(!R||e(this,w)!==n)return;const V=e(this,P).get(n)||(yield v(this,u,J).call(this,n));if(e(this,w)!==n)return;const X=Array.from(document.head.children),Z=Array.from(V.head.cloneNode(!0).children),$=v(this,u,ot).call(this,X,Z),ht=v(this,u,U).call(this,X,$),F=v(this,u,U).call(this,Z,$);F.forEach((a,L)=>{if(a.tagName==="SCRIPT"&&a.getAttribute("src")){const b=document.createElement("script");b.type="module",b.src=a.getAttribute("src"),F[L]=b}}),F.forEach(a=>{document.head.appendChild(a)});const j=F.filter(a=>(a.tagName==="STYLE"||a.tagName==="SCRIPT"||a.tagName==="LINK")&&a.getAttribute("rel")!=="canonical");e(this,z)&&j.length&&(yield new Promise(a=>N(this,null,function*(){let L=0;try{for(var b=st(j),lt,K,I;lt=!(K=yield b.next()).done;lt=!1){const H=K.value;H.onload=()=>{L++,L===j.length&&a()}}}catch(K){I=[K]}finally{try{lt&&(K=b.return)&&(yield K.call(b))}finally{if(I)throw I[0]}}}))),ht.forEach(a=>{a.hasAttribute("data-permanent")||a.remove()}),l(this,p,n),O.changeHistory(i,n,g,d);const ct=v(this,u,Q).call(this,V.body.cloneNode(!0));e(this,x).forEach((a,L)=>{const b=ct[L];let lt=[...a.childNodes],K=[...b.childNodes];lt.forEach(I=>{if(I instanceof HTMLElement){const H=I.getAttribute("data-remain");let tt;K=K.filter(Y=>Y instanceof HTMLElement&&H&&Y.getAttribute("data-remain")===H?(tt=Y,!1):!0),H&&tt||I.remove()}else I.remove()}),a.append(...K)}),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",n),document.documentElement.setAttribute("data-current-leaf",f),(E=this.postprocessor)==null||E.call(this,{pathname:n,isCached:c}),e(this,D).notify({pathname:n,isCached:c}),rt.loading.complete("__morph")}catch(R){console.error(R)}l(this,w,void 0)})}addLinks(t){t.forEach(i=>{e(this,A).push(new at(i,this))})}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var r;return((r=i.getAttribute("href"))==null?void 0:r.startsWith("/"))&&!i.hasAttribute("download")&&!i.hasAttribute("data-morph-skip")});e(this,A).forEach(i=>i.destroy()),l(this,A,t.map(i=>new at(i,this)))}}S=new WeakMap,z=new WeakMap,q=new WeakMap,x=new WeakMap,A=new WeakMap,B=new WeakMap,P=new WeakMap,w=new WeakMap,p=new WeakMap,_=new WeakMap,D=new WeakMap,u=new WeakSet,J=function(t){return N(this,null,function*(){const i=e(this,P).get(t);if(i)return i;const n=yield(yield fetch(t)).text(),d=e(this,B).parseFromString(n,"text/html");return e(this,q)&&e(this,P).set(t,d),d})},Q=function(t){return[...t.querySelectorAll("[data-morph]")]},ot=function(t,i){return t.filter(r=>i.find(n=>n.outerHTML===r.outerHTML))},U=function(t,i){return t.filter(r=>!i.find(n=>n.outerHTML===r.outerHTML))},W=new WeakMap;exports.Morph=ut;
1
+ "use strict";var nt=(s,t)=>(t=Symbol[s])?t:Symbol.for("Symbol."+s),rt=s=>{throw TypeError(s)};var Q=(s,t,i)=>t.has(s)||rt("Cannot "+i);var e=(s,t,i)=>(Q(s,t,"read from private field"),i?i.call(s):t.get(s)),o=(s,t,i)=>t.has(s)?rt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(s):t.set(s,i),c=(s,t,i,n)=>(Q(s,t,"write to private field"),n?n.call(s,i):t.set(s,i),i),L=(s,t,i)=>(Q(s,t,"access private method"),i);var N=(s,t,i)=>new Promise((n,l)=>{var d=m=>{try{p(i.next(m))}catch(w){l(w)}},a=m=>{try{p(i.throw(m))}catch(w){l(w)}},p=m=>m.done?n(m.value):Promise.resolve(m.value).then(d,a);p((i=i.apply(s,t)).next())});var at=(s,t,i)=>(t=s[nt("asyncIterator")])?t.call(s):(s=s[nt("iterator")](),t={},i=(n,l)=>(l=s[n])&&(t[n]=d=>new Promise((a,p,m)=>(d=l.call(s,d),m=d.done,Promise.resolve(d.value).then(w=>a({value:w,done:m}),p)))),i("next"),i("return"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const ot=require("../notifier/index.cjs"),ft=require("../browser-CpzFX2xg.cjs"),W=require("../url-DELd-VFC.cjs"),ht=require("../loading/index.cjs");var A,h,f,T,C,M,S,k;class ct{constructor(t,i){o(this,A);o(this,h);o(this,f);o(this,T);o(this,C);o(this,M);o(this,S,t=>{t.preventDefault(),e(this,A).links.forEach(i=>{var n;e(this,f)===e(i,f)||(n=e(i,M))!=null&&n.includes(e(this,f))?e(i,h).classList.add("clicked"):e(i,h).classList.remove("clicked")}),e(this,A).navigate(e(this,f),{historyAction:e(this,T),state:e(this,C)})});o(this,k,()=>{e(this,A).prefetch(e(this,f)),e(this,h).removeEventListener("pointerenter",e(this,k))});var d,a;c(this,A,i),c(this,h,t),c(this,f,e(this,h).getAttribute("href")||"/"),c(this,T,e(this,h).getAttribute("data-history-action")||"push"),c(this,C,e(this,h).getAttribute("data-state")||void 0),e(this,h).addEventListener("click",e(this,S));const n=i.normalizePath(e(this,f)),l=i.normalizePath(location.pathname);c(this,M,(d=e(this,h).getAttribute("data-match-paths"))==null?void 0:d.split(",").map(p=>i.normalizePath(p.trim()).pathname)),e(this,h).hasAttribute("data-include")?l.pathname.includes(n.pathname)&&e(this,h).classList.add("current"):n.pathname===l.pathname||(a=e(this,M))!=null&&a.includes(l.pathname)?(e(this,h).classList.add("current"),e(this,h).classList.add("clicked")):e(this,h).classList.remove("clicked"),e(this,h).hasAttribute("data-prefetch")&&e(this,h).addEventListener("pointerenter",e(this,k))}destroy(){e(this,h).removeEventListener("click",e(this,S)),e(this,h).removeEventListener("pointerenter",e(this,k)),e(this,h).classList.remove("current")}}A=new WeakMap,h=new WeakMap,f=new WeakMap,T=new WeakMap,C=new WeakMap,M=new WeakMap,S=new WeakMap,k=new WeakMap;var z,q,x,_,y,j,P,v,g,D,R,u,U,V,lt,X,K;class pt{constructor(t){o(this,u);o(this,z,null);o(this,q,null);o(this,x,null);o(this,_,null);o(this,y,[]);o(this,j,new DOMParser);o(this,P,new Map);o(this,v);o(this,g,null);o(this,D,new ot.Notifier);o(this,R,new ot.Notifier);o(this,K,t=>{t.state&&this.navigate(t.state,{historyAction:"none"})});if(ft.isBrowser){c(this,z,W.normalizeBase(t==null?void 0:t.base)),c(this,q,(t==null?void 0:t.waitForHeadToLoad)!==!1),c(this,x,(t==null?void 0:t.cachePages)!==!1),c(this,_,L(this,u,V).call(this,document.body));const i=this.normalizePath(location.pathname);c(this,g,i.pathname),document.documentElement.setAttribute("data-current-pathname",e(this,g)),document.documentElement.setAttribute("data-current-leaf",i.leaf),this.findLinks(),addEventListener("popstate",e(this,K)),W.changeHistory("replace",e(this,g),i.parameters,i.hash)}}get currentPathname(){return e(this,g)}get links(){return e(this,y)}normalizePath(t){return W.splitPath(t,e(this,z))}beforeNavigationEvent(t){return e(this,D).subscribe(t)}afterNavigationEvent(t){return e(this,R).subscribe(t)}prefetch(t){return N(this,null,function*(){const i=this.normalizePath(t);return L(this,u,U).call(this,i.pathname)})}navigate(l){return N(this,arguments,function*(t,{historyAction:i="push",state:n}={}){var Z;const d=this.normalizePath(t);let{pathname:a,hash:p,parameters:m,leaf:w}=d;if(e(this,v)===a||e(this,g)===a)return;c(this,v,a);const F=e(this,P).has(a);try{ht.loading.add("__morph");let I=!0;if(e(this,D).notify({pathname:a,isCached:F,state:n}),this.preprocessor)try{yield new Promise((r,E)=>{var b;(b=this.preprocessor)==null||b.call(this,{pathname:a,resolve:r,reject:E,isCached:F,state:n})})}catch(r){r?console.error(r):console.log("Route change canceled"),I=!1}if(!I||e(this,v)!==a)return;const $=e(this,P).get(a)||(yield L(this,u,U).call(this,a));if(e(this,v)!==a)return;const tt=Array.from(document.head.children),et=Array.from($.head.cloneNode(!0).children),it=L(this,u,lt).call(this,tt,et),dt=L(this,u,X).call(this,tt,it),O=L(this,u,X).call(this,et,it);O.forEach((r,E)=>{if(r.tagName==="SCRIPT"&&r.getAttribute("src")){const b=document.createElement("script");b.type="module",b.src=r.getAttribute("src"),O[E]=b}}),O.forEach(r=>{document.head.appendChild(r)});const Y=O.filter(r=>(r.tagName==="STYLE"||r.tagName==="SCRIPT"||r.tagName==="LINK")&&r.getAttribute("rel")!=="canonical");e(this,q)&&Y.length&&(yield new Promise(r=>N(this,null,function*(){let E=0;try{for(var b=at(Y),mt,G,B;mt=!(G=yield b.next()).done;mt=!1){const H=G.value;H.onload=()=>{E++,E===Y.length&&r()}}}catch(G){B=[G]}finally{try{mt&&(G=b.return)&&(yield G.call(b))}finally{if(B)throw B[0]}}}))),dt.forEach(r=>{r.hasAttribute("data-permanent")||r.remove()}),c(this,g,a),W.changeHistory(i,a,m,p);const ut=L(this,u,V).call(this,$.body.cloneNode(!0));e(this,_).forEach((r,E)=>{const b=ut[E];let mt=[...r.childNodes],G=[...b.childNodes];mt.forEach(B=>{if(B instanceof HTMLElement){const H=B.getAttribute("data-remain");let st;G=G.filter(J=>J instanceof HTMLElement&&H&&J.getAttribute("data-remain")===H?(st=J,!1):!0),H&&st||B.remove()}else B.remove()}),r.append(...G)}),this.findLinks(),document.documentElement.setAttribute("data-current-pathname",a),document.documentElement.setAttribute("data-current-leaf",w),(Z=this.postprocessor)==null||Z.call(this,{pathname:a,isCached:F,state:n}),e(this,R).notify({pathname:a,isCached:F,state:n}),ht.loading.complete("__morph")}catch(I){console.error(I)}c(this,v,void 0)})}addLinks(t){t.forEach(i=>{e(this,y).push(new ct(i,this))})}findLinks(){const t=[...document.documentElement.querySelectorAll("a")].filter(i=>{var n;return((n=i.getAttribute("href"))==null?void 0:n.startsWith("/"))&&!i.hasAttribute("download")&&!i.hasAttribute("data-morph-skip")});e(this,y).forEach(i=>i.destroy()),c(this,y,t.map(i=>new ct(i,this)))}}z=new WeakMap,q=new WeakMap,x=new WeakMap,_=new WeakMap,y=new WeakMap,j=new WeakMap,P=new WeakMap,v=new WeakMap,g=new WeakMap,D=new WeakMap,R=new WeakMap,u=new WeakSet,U=function(t){return N(this,null,function*(){const i=e(this,P).get(t);if(i)return i;const l=yield(yield fetch(t)).text(),d=e(this,j).parseFromString(l,"text/html");return e(this,x)&&e(this,P).set(t,d),d})},V=function(t){return[...t.querySelectorAll("[data-morph]")]},lt=function(t,i){return t.filter(n=>i.find(l=>l.outerHTML===n.outerHTML))},X=function(t,i){return t.filter(n=>!i.find(l=>l.outerHTML===n.outerHTML))},K=new WeakMap;exports.Morph=pt;
@@ -1,203 +1,208 @@
1
- var tt = (s, t) => (t = Symbol[s]) ? t : Symbol.for("Symbol." + s), et = (s) => {
1
+ var st = (s, t) => (t = Symbol[s]) ? t : Symbol.for("Symbol." + s), nt = (s) => {
2
2
  throw TypeError(s);
3
3
  };
4
- var j = (s, t, i) => t.has(s) || et("Cannot " + i);
5
- var e = (s, t, i) => (j(s, t, "read from private field"), i ? i.call(s) : t.get(s)), o = (s, t, i) => t.has(s) ? et("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, i), l = (s, t, i, a) => (j(s, t, "write to private field"), a ? a.call(s, i) : t.set(s, i), i), v = (s, t, i) => (j(s, t, "access private method"), i);
6
- var N = (s, t, i) => new Promise((a, n) => {
7
- var d = (c) => {
4
+ var J = (s, t, i) => t.has(s) || nt("Cannot " + i);
5
+ var e = (s, t, i) => (J(s, t, "read from private field"), i ? i.call(s) : t.get(s)), o = (s, t, i) => t.has(s) ? nt("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, i), c = (s, t, i, n) => (J(s, t, "write to private field"), n ? n.call(s, i) : t.set(s, i), i), b = (s, t, i) => (J(s, t, "access private method"), i);
6
+ var N = (s, t, i) => new Promise((n, l) => {
7
+ var d = (m) => {
8
8
  try {
9
- f(i.next(c));
10
- } catch (E) {
11
- n(E);
9
+ p(i.next(m));
10
+ } catch (A) {
11
+ l(A);
12
12
  }
13
- }, g = (c) => {
13
+ }, a = (m) => {
14
14
  try {
15
- f(i.throw(c));
16
- } catch (E) {
17
- n(E);
15
+ p(i.throw(m));
16
+ } catch (A) {
17
+ l(A);
18
18
  }
19
- }, f = (c) => c.done ? a(c.value) : Promise.resolve(c.value).then(d, g);
20
- f((i = i.apply(s, t)).next());
19
+ }, p = (m) => m.done ? n(m.value) : Promise.resolve(m.value).then(d, a);
20
+ p((i = i.apply(s, t)).next());
21
21
  });
22
- var it = (s, t, i) => (t = s[tt("asyncIterator")]) ? t.call(s) : (s = s[tt("iterator")](), t = {}, i = (a, n) => (n = s[a]) && (t[a] = (d) => new Promise((g, f, c) => (d = n.call(s, d), c = d.done, Promise.resolve(d.value).then((E) => g({ value: E, done: c }), f)))), i("next"), i("return"), t);
23
- import { Notifier as st } from "../notifier/index.js";
24
- import { i as dt } from "../browser-0zX67oeU.js";
25
- import { n as ut, c as nt, s as mt } from "../url-BnTGHSgP.js";
26
- import { loading as at } from "../loading/index.js";
27
- var A, h, m, T, k, C, H;
28
- class rt {
22
+ var rt = (s, t, i) => (t = s[st("asyncIterator")]) ? t.call(s) : (s = s[st("iterator")](), t = {}, i = (n, l) => (l = s[n]) && (t[n] = (d) => new Promise((a, p, m) => (d = l.call(s, d), m = d.done, Promise.resolve(d.value).then((A) => a({ value: A, done: m }), p)))), i("next"), i("return"), t);
23
+ import { Notifier as at } from "../notifier/index.js";
24
+ import { i as ft } from "../browser-0zX67oeU.js";
25
+ import { n as pt, c as ot, s as gt } from "../url-BnTGHSgP.js";
26
+ import { loading as ht } from "../loading/index.js";
27
+ var w, h, f, T, C, k, z, H;
28
+ class ct {
29
29
  constructor(t, i) {
30
- o(this, A);
30
+ o(this, w);
31
31
  o(this, h);
32
- o(this, m);
32
+ o(this, f);
33
33
  o(this, T);
34
+ o(this, C);
34
35
  o(this, k);
35
- o(this, C, (t) => {
36
- t.preventDefault(), e(this, A).links.forEach((i) => {
37
- var a;
38
- e(this, m) === e(i, m) || (a = e(i, k)) != null && a.includes(e(this, m)) ? e(i, h).classList.add("clicked") : e(i, h).classList.remove("clicked");
39
- }), e(this, A).navigate(e(this, m), e(this, T));
36
+ o(this, z, (t) => {
37
+ t.preventDefault(), e(this, w).links.forEach((i) => {
38
+ var n;
39
+ e(this, f) === e(i, f) || (n = e(i, k)) != null && n.includes(e(this, f)) ? e(i, h).classList.add("clicked") : e(i, h).classList.remove("clicked");
40
+ }), e(this, w).navigate(e(this, f), {
41
+ historyAction: e(this, T),
42
+ state: e(this, C)
43
+ });
40
44
  });
41
45
  o(this, H, () => {
42
- e(this, A).prefetch(e(this, m)), e(this, h).removeEventListener("pointerenter", e(this, H));
46
+ e(this, w).prefetch(e(this, f)), e(this, h).removeEventListener("pointerenter", e(this, H));
43
47
  });
44
- var d, g;
45
- l(this, A, i), l(this, h, t), l(this, m, e(this, h).getAttribute("href") || "/"), l(this, T, e(this, h).getAttribute(
48
+ var d, a;
49
+ c(this, w, i), c(this, h, t), c(this, f, e(this, h).getAttribute("href") || "/"), c(this, T, e(this, h).getAttribute(
46
50
  "data-history-action"
47
- ) || "push"), e(this, h).addEventListener("click", e(this, C));
48
- const a = i.normalizePath(e(this, m)), n = i.normalizePath(location.pathname);
49
- l(this, k, (d = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : d.split(",").map((f) => i.normalizePath(f.trim()).pathname)), e(this, h).hasAttribute("data-include") ? n.pathname.includes(a.pathname) && e(this, h).classList.add("current") : a.pathname === n.pathname || (g = e(this, k)) != null && g.includes(n.pathname) ? (e(this, h).classList.add("current"), e(this, h).classList.add("clicked")) : e(this, h).classList.remove("clicked"), e(this, h).hasAttribute("data-prefetch") && e(this, h).addEventListener("pointerenter", e(this, H));
51
+ ) || "push"), c(this, C, e(this, h).getAttribute("data-state") || void 0), e(this, h).addEventListener("click", e(this, z));
52
+ const n = i.normalizePath(e(this, f)), l = i.normalizePath(location.pathname);
53
+ c(this, k, (d = e(this, h).getAttribute("data-match-paths")) == null ? void 0 : d.split(",").map((p) => i.normalizePath(p.trim()).pathname)), e(this, h).hasAttribute("data-include") ? l.pathname.includes(n.pathname) && e(this, h).classList.add("current") : n.pathname === l.pathname || (a = e(this, k)) != null && a.includes(l.pathname) ? (e(this, h).classList.add("current"), e(this, h).classList.add("clicked")) : e(this, h).classList.remove("clicked"), e(this, h).hasAttribute("data-prefetch") && e(this, h).addEventListener("pointerenter", e(this, H));
50
54
  }
51
55
  destroy() {
52
- e(this, h).removeEventListener("click", e(this, C)), e(this, h).removeEventListener("pointerenter", e(this, H)), e(this, h).classList.remove("current");
56
+ e(this, h).removeEventListener("click", e(this, z)), e(this, h).removeEventListener("pointerenter", e(this, H)), e(this, h).classList.remove("current");
53
57
  }
54
58
  }
55
- A = new WeakMap(), h = new WeakMap(), m = new WeakMap(), T = new WeakMap(), k = new WeakMap(), C = new WeakMap(), H = new WeakMap();
56
- var z, S, x, D, P, B, y, w, p, R, _, u, G, J, ot, Q, O;
57
- class bt {
59
+ w = new WeakMap(), h = new WeakMap(), f = new WeakMap(), T = new WeakMap(), C = new WeakMap(), k = new WeakMap(), z = new WeakMap(), H = new WeakMap();
60
+ var S, x, D, R, y, W, P, v, g, _, F, u, Q, U, lt, V, K;
61
+ class wt {
58
62
  constructor(t) {
59
63
  o(this, u);
60
- o(this, z, null);
61
64
  o(this, S, null);
62
65
  o(this, x, null);
63
66
  o(this, D, null);
64
- o(this, P, []);
65
- o(this, B, new DOMParser());
66
- o(this, y, /* @__PURE__ */ new Map());
67
- o(this, w);
68
- o(this, p, null);
69
- o(this, R, new st());
70
- o(this, _, new st());
71
- o(this, O, (t) => {
72
- t.state && this.navigate(t.state, "none");
67
+ o(this, R, null);
68
+ o(this, y, []);
69
+ o(this, W, new DOMParser());
70
+ o(this, P, /* @__PURE__ */ new Map());
71
+ o(this, v);
72
+ o(this, g, null);
73
+ o(this, _, new at());
74
+ o(this, F, new at());
75
+ o(this, K, (t) => {
76
+ t.state && this.navigate(t.state, { historyAction: "none" });
73
77
  });
74
- if (dt) {
75
- l(this, z, ut(t == null ? void 0 : t.base)), l(this, S, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), l(this, x, (t == null ? void 0 : t.cachePages) !== !1), l(this, D, v(this, u, J).call(this, document.body));
78
+ if (ft) {
79
+ c(this, S, pt(t == null ? void 0 : t.base)), c(this, x, (t == null ? void 0 : t.waitForHeadToLoad) !== !1), c(this, D, (t == null ? void 0 : t.cachePages) !== !1), c(this, R, b(this, u, U).call(this, document.body));
76
80
  const i = this.normalizePath(location.pathname);
77
- l(this, p, i.pathname), document.documentElement.setAttribute(
81
+ c(this, g, i.pathname), document.documentElement.setAttribute(
78
82
  "data-current-pathname",
79
- e(this, p)
83
+ e(this, g)
80
84
  ), document.documentElement.setAttribute(
81
85
  "data-current-leaf",
82
86
  i.leaf
83
- ), this.findLinks(), addEventListener("popstate", e(this, O)), nt(
87
+ ), this.findLinks(), addEventListener("popstate", e(this, K)), ot(
84
88
  "replace",
85
- e(this, p),
89
+ e(this, g),
86
90
  i.parameters,
87
91
  i.hash
88
92
  );
89
93
  }
90
94
  }
91
95
  get currentPathname() {
92
- return e(this, p);
96
+ return e(this, g);
93
97
  }
94
98
  get links() {
95
- return e(this, P);
99
+ return e(this, y);
96
100
  }
97
101
  normalizePath(t) {
98
- return mt(t, e(this, z));
102
+ return gt(t, e(this, S));
99
103
  }
100
104
  beforeNavigationEvent(t) {
101
- return e(this, R).subscribe(t);
105
+ return e(this, _).subscribe(t);
102
106
  }
103
107
  afterNavigationEvent(t) {
104
- return e(this, _).subscribe(t);
108
+ return e(this, F).subscribe(t);
105
109
  }
106
110
  prefetch(t) {
107
111
  return N(this, null, function* () {
108
112
  const i = this.normalizePath(t);
109
- return v(this, u, G).call(this, i.pathname);
113
+ return b(this, u, Q).call(this, i.pathname);
110
114
  });
111
115
  }
112
- navigate(t, i = "push") {
113
- return N(this, null, function* () {
114
- var E;
115
- const a = this.normalizePath(t);
116
- let { pathname: n, hash: d, parameters: g, leaf: f } = a;
117
- if (e(this, w) === n || e(this, p) === n)
116
+ navigate(l) {
117
+ return N(this, arguments, function* (t, { historyAction: i = "push", state: n } = {}) {
118
+ var X;
119
+ const d = this.normalizePath(t);
120
+ let { pathname: a, hash: p, parameters: m, leaf: A } = d;
121
+ if (e(this, v) === a || e(this, g) === a)
118
122
  return;
119
- l(this, w, n);
120
- const c = e(this, y).has(n);
123
+ c(this, v, a);
124
+ const I = e(this, P).has(a);
121
125
  try {
122
- at.add("__morph");
123
- let F = !0;
124
- if (e(this, R).notify({
125
- pathname: n,
126
- isCached: c
126
+ ht.add("__morph");
127
+ let q = !0;
128
+ if (e(this, _).notify({
129
+ pathname: a,
130
+ isCached: I,
131
+ state: n
127
132
  }), this.preprocessor)
128
133
  try {
129
- yield new Promise((r, L) => {
130
- var b;
131
- (b = this.preprocessor) == null || b.call(this, { pathname: n, resolve: r, reject: L, isCached: c });
134
+ yield new Promise((r, E) => {
135
+ var L;
136
+ (L = this.preprocessor) == null || L.call(this, { pathname: a, resolve: r, reject: E, isCached: I, state: n });
132
137
  });
133
138
  } catch (r) {
134
- r ? console.error(r) : console.log("Route change canceled"), F = !1;
139
+ r ? console.error(r) : console.log("Route change canceled"), q = !1;
135
140
  }
136
- if (!F || e(this, w) !== n)
141
+ if (!q || e(this, v) !== a)
137
142
  return;
138
- const U = e(this, y).get(n) || (yield v(this, u, G).call(this, n));
139
- if (e(this, w) !== n)
143
+ const Z = e(this, P).get(a) || (yield b(this, u, Q).call(this, a));
144
+ if (e(this, v) !== a)
140
145
  return;
141
- const V = Array.from(document.head.children), X = Array.from(
142
- U.head.cloneNode(!0).children
143
- ), Z = v(this, u, ot).call(this, V, X), ht = v(this, u, Q).call(this, V, Z), I = v(this, u, Q).call(this, X, Z);
144
- I.forEach((r, L) => {
146
+ const $ = Array.from(document.head.children), tt = Array.from(
147
+ Z.head.cloneNode(!0).children
148
+ ), et = b(this, u, lt).call(this, $, tt), dt = b(this, u, V).call(this, $, et), B = b(this, u, V).call(this, tt, et);
149
+ B.forEach((r, E) => {
145
150
  if (r.tagName === "SCRIPT" && r.getAttribute("src")) {
146
- const b = document.createElement("script");
147
- b.type = "module", b.src = r.getAttribute("src"), I[L] = b;
151
+ const L = document.createElement("script");
152
+ L.type = "module", L.src = r.getAttribute("src"), B[E] = L;
148
153
  }
149
- }), I.forEach((r) => {
154
+ }), B.forEach((r) => {
150
155
  document.head.appendChild(r);
151
156
  });
152
- const W = I.filter(
157
+ const Y = B.filter(
153
158
  (r) => (r.tagName === "STYLE" || r.tagName === "SCRIPT" || r.tagName === "LINK") && r.getAttribute("rel") !== "canonical"
154
159
  );
155
- e(this, S) && W.length && (yield new Promise((r) => N(this, null, function* () {
156
- let L = 0;
160
+ e(this, x) && Y.length && (yield new Promise((r) => N(this, null, function* () {
161
+ let E = 0;
157
162
  try {
158
- for (var b = it(W), lt, K, q; lt = !(K = yield b.next()).done; lt = !1) {
159
- const M = K.value;
163
+ for (var L = rt(Y), mt, j, O; mt = !(j = yield L.next()).done; mt = !1) {
164
+ const M = j.value;
160
165
  M.onload = () => {
161
- L++, L === W.length && r();
166
+ E++, E === Y.length && r();
162
167
  };
163
168
  }
164
- } catch (K) {
165
- q = [K];
169
+ } catch (j) {
170
+ O = [j];
166
171
  } finally {
167
172
  try {
168
- lt && (K = b.return) && (yield K.call(b));
173
+ mt && (j = L.return) && (yield j.call(L));
169
174
  } finally {
170
- if (q)
171
- throw q[0];
175
+ if (O)
176
+ throw O[0];
172
177
  }
173
178
  }
174
- }))), ht.forEach((r) => {
179
+ }))), dt.forEach((r) => {
175
180
  r.hasAttribute("data-permanent") || r.remove();
176
- }), l(this, p, n), nt(i, n, g, d);
177
- const ct = v(this, u, J).call(this, U.body.cloneNode(!0));
178
- e(this, D).forEach((r, L) => {
179
- const b = ct[L];
180
- let lt = [...r.childNodes], K = [...b.childNodes];
181
- lt.forEach((q) => {
182
- if (q instanceof HTMLElement) {
183
- const M = q.getAttribute("data-remain");
184
- let $;
185
- K = K.filter(
186
- (Y) => Y instanceof HTMLElement && M && Y.getAttribute("data-remain") === M ? ($ = Y, !1) : !0
187
- ), M && $ || q.remove();
181
+ }), c(this, g, a), ot(i, a, m, p);
182
+ const ut = b(this, u, U).call(this, Z.body.cloneNode(!0));
183
+ e(this, R).forEach((r, E) => {
184
+ const L = ut[E];
185
+ let mt = [...r.childNodes], j = [...L.childNodes];
186
+ mt.forEach((O) => {
187
+ if (O instanceof HTMLElement) {
188
+ const M = O.getAttribute("data-remain");
189
+ let it;
190
+ j = j.filter(
191
+ (G) => G instanceof HTMLElement && M && G.getAttribute("data-remain") === M ? (it = G, !1) : !0
192
+ ), M && it || O.remove();
188
193
  } else
189
- q.remove();
190
- }), r.append(...K);
191
- }), this.findLinks(), document.documentElement.setAttribute("data-current-pathname", n), document.documentElement.setAttribute("data-current-leaf", f), (E = this.postprocessor) == null || E.call(this, { pathname: n, isCached: c }), e(this, _).notify({ pathname: n, isCached: c }), at.complete("__morph");
192
- } catch (F) {
193
- console.error(F);
194
+ O.remove();
195
+ }), r.append(...j);
196
+ }), this.findLinks(), document.documentElement.setAttribute("data-current-pathname", a), document.documentElement.setAttribute("data-current-leaf", A), (X = this.postprocessor) == null || X.call(this, { pathname: a, isCached: I, state: n }), e(this, F).notify({ pathname: a, isCached: I, state: n }), ht.complete("__morph");
197
+ } catch (q) {
198
+ console.error(q);
194
199
  }
195
- l(this, w, void 0);
200
+ c(this, v, void 0);
196
201
  });
197
202
  }
198
203
  addLinks(t) {
199
204
  t.forEach((i) => {
200
- e(this, P).push(new rt(i, this));
205
+ e(this, y).push(new ct(i, this));
201
206
  });
202
207
  }
203
208
  findLinks() {
@@ -205,36 +210,36 @@ class bt {
205
210
  ...document.documentElement.querySelectorAll("a")
206
211
  ].filter(
207
212
  (i) => {
208
- var a;
209
- return ((a = i.getAttribute("href")) == null ? void 0 : a.startsWith("/")) && !i.hasAttribute("download") && !i.hasAttribute("data-morph-skip");
213
+ var n;
214
+ return ((n = i.getAttribute("href")) == null ? void 0 : n.startsWith("/")) && !i.hasAttribute("download") && !i.hasAttribute("data-morph-skip");
210
215
  }
211
216
  );
212
- e(this, P).forEach((i) => i.destroy()), l(this, P, t.map((i) => new rt(i, this)));
217
+ e(this, y).forEach((i) => i.destroy()), c(this, y, t.map((i) => new ct(i, this)));
213
218
  }
214
219
  }
215
- z = new WeakMap(), S = new WeakMap(), x = new WeakMap(), D = new WeakMap(), P = new WeakMap(), B = new WeakMap(), y = new WeakMap(), w = new WeakMap(), p = new WeakMap(), R = new WeakMap(), _ = new WeakMap(), u = new WeakSet(), G = function(t) {
220
+ S = new WeakMap(), x = new WeakMap(), D = new WeakMap(), R = new WeakMap(), y = new WeakMap(), W = new WeakMap(), P = new WeakMap(), v = new WeakMap(), g = new WeakMap(), _ = new WeakMap(), F = new WeakMap(), u = new WeakSet(), Q = function(t) {
216
221
  return N(this, null, function* () {
217
- const i = e(this, y).get(t);
222
+ const i = e(this, P).get(t);
218
223
  if (i)
219
224
  return i;
220
- const n = yield (yield fetch(t)).text(), d = e(this, B).parseFromString(n, "text/html");
221
- return e(this, x) && e(this, y).set(t, d), d;
225
+ const l = yield (yield fetch(t)).text(), d = e(this, W).parseFromString(l, "text/html");
226
+ return e(this, D) && e(this, P).set(t, d), d;
222
227
  });
223
- }, J = function(t) {
228
+ }, U = function(t) {
224
229
  return [...t.querySelectorAll("[data-morph]")];
225
- }, ot = function(t, i) {
230
+ }, lt = function(t, i) {
226
231
  return t.filter(
227
- (a) => i.find(
228
- (n) => n.outerHTML === a.outerHTML
232
+ (n) => i.find(
233
+ (l) => l.outerHTML === n.outerHTML
229
234
  )
230
235
  );
231
- }, Q = function(t, i) {
236
+ }, V = function(t, i) {
232
237
  return t.filter(
233
- (a) => !i.find(
234
- (n) => n.outerHTML === a.outerHTML
238
+ (n) => !i.find(
239
+ (l) => l.outerHTML === n.outerHTML
235
240
  )
236
241
  );
237
- }, O = new WeakMap();
242
+ }, K = new WeakMap();
238
243
  export {
239
- bt as Morph
244
+ wt as Morph
240
245
  };
@@ -1 +1 @@
1
- "use strict";var G=n=>{throw TypeError(n)};var N=(n,c,t)=>c.has(n)||G("Cannot "+t);var e=(n,c,t)=>(N(n,c,"read from private field"),t?t.call(n):c.get(n)),s=(n,c,t)=>c.has(n)?G("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,t),i=(n,c,t,h)=>(N(n,c,"write to private field"),h?h.call(n,t):c.set(n,t),t),b=(n,c,t)=>(N(n,c,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../css-property/index.cjs"),V=require("../Store-CDb6RMce.cjs"),I=require("../events-KVanG9sR.cjs"),X=require("../function-MthRj-GJ.cjs"),Y=require("../style-At6aDoqG.cjs"),J=require("../window-resizer/vanilla/index.cjs"),Z=require("../browser-CpzFX2xg.cjs");var A,d,q,w,p,g,u,v,m,f,y,S,l,K,T,D,k,j,C,_,M,x,U;const a=class a extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,A);s(this,d);s(this,q);s(this,w);s(this,p);s(this,g);s(this,u);s(this,v);s(this,m);s(this,f);s(this,y);s(this,S);s(this,T);s(this,k);s(this,C);s(this,_);s(this,M);s(this,x);i(this,A,-1),i(this,d,new V.Store(!1)),i(this,p,new E.CSSProperty(this,"--history",!1)),i(this,g,new E.CSSProperty(this,"--restore",!1)),i(this,u,new E.CSSProperty(this,"--dominance",0)),i(this,v,new E.CSSProperty(this,"--group","")),i(this,m,new E.CSSProperty(this,"--click-outside",!1)),i(this,f,new E.CSSProperty(this,"--escape",!1)),i(this,y,!1),this.open=t=>{if(e(this,d).current)return;i(this,S,t==null?void 0:t.trigger),e(this,d).current=!0,e(this,u).current&&(a.__opened=a.__opened.filter(o=>o!==this&&b(this,l,U).call(this,this,o)?(o.close(),!1):!0)),a.__opened.push(this),i(this,A,a.__opened.length-1),e(this,p).current&&e(this,y)&&history.pushState("","",e(this,l,K)),clearTimeout(e(this,q)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",I.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,S)}});const h=()=>{addEventListener("click",e(this,T)),addEventListener("keydown",e(this,k)),e(this,x).call(this),this.style.opacity="1",this.classList.add("opened"),I.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,S)}}),i(this,w,void 0)};t!=null&&t.skipTransition?h():i(this,w,setTimeout(h,10))},this.close=()=>{e(this,d).current&&(removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),e(this,d).current=!1,a.__opened=a.__opened.filter(t=>t===this?!1:!e(t,w)&&b(this,l,U).call(this,this,t)?(t.close(),!1):!0),b(this,l,D).call(this),this.classList.remove("opened"),this.classList.add("closing"),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})},Y.getElementTransitionDurationMS(this)+10))},i(this,T,t=>{e(this,m).current&&b(this,l,j).call(this,()=>{var W;const h=t.composedPath();if(h.find(F=>F instanceof HTMLElement&&F.hasAttribute("data-popover-content")))return;const o=h[0],$=o instanceof HTMLElement&&(this.contains(o)||((W=this.shadowRoot)==null?void 0:W.contains(o))),P=o instanceof HTMLElement&&o.hasAttribute("data-outside");(!$||P)&&this.close()})}),i(this,k,t=>{e(this,f).current&&b(this,l,j).call(this,()=>{t.code==="Escape"&&this.close()})}),i(this,C,()=>{i(this,y,!1),e(this,d).current&&e(this,p).current&&!location.search.includes(this.id)?this.close():!e(this,d).current&&e(this,p).current&&location.search.includes(this.id)&&this.open(),i(this,y,!0)}),i(this,_,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,M).call(this)}),i(this,M,X.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,p)}get restore(){return e(this,g)}get dominance(){return e(this,u)}get group(){return e(this,v)}get clickOutside(){return e(this,m)}get escape(){return e(this,f)}get opened(){return e(this,d)}get lastTrigger(){return e(this,S)}connectedCallback(){e(this,p).observe(),e(this,g).observe(),e(this,u).observe(),e(this,v).observe(),e(this,m).observe(),e(this,f).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,C)),setTimeout(()=>{e(this,g).current?e(this,C).call(this):(b(this,l,D).call(this),i(this,y,!0))},0),J.windowResizer.subscribe(e(this,_))}disconnectedCallback(){J.windowResizer.unsubscribe(e(this,_)),e(this,p).close(),e(this,g).close(),e(this,u).close(),e(this,v).close(),e(this,m).close(),e(this,f).close(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),a.__opened=a.__opened.filter(t=>t!==this),clearTimeout(e(this,q)),clearTimeout(e(this,w)),removeEventListener("popstate",e(this,C)),removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height")}};A=new WeakMap,d=new WeakMap,q=new WeakMap,w=new WeakMap,p=new WeakMap,g=new WeakMap,u=new WeakMap,v=new WeakMap,m=new WeakMap,f=new WeakMap,y=new WeakMap,S=new WeakMap,l=new WeakSet,K=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},T=new WeakMap,D=function(){if(e(this,p).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(null,"",t.href)}},k=new WeakMap,j=function(t){(a.__opened[e(this,A)-1]||a.__opened.length===1||a.__opened.filter(h=>h!==this).every(h=>e(this,u).current>h.dominance.current))&&t()},C=new WeakMap,_=new WeakMap,M=new WeakMap,x=new WeakMap,U=function(t,h){if(e(t,v).current===e(h,v).current&&t.dominance.current>=h.dominance.current)return!0},a.__opened=[];let B=a;customElements.get("e-popover")||customElements.define("e-popover",B);var r,L,O,R,H,z;class Q extends HTMLElement{constructor(){super();s(this,r);s(this,L,new E.CSSProperty(this,"--type","open"));s(this,O,()=>{this.classList.add("triggered")});s(this,R,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});s(this,H,()=>{this.classList.remove("opened")});s(this,z,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});Z.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)&&(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 $=this.closest("[popover-target]");if($)o=$;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,O)),e(this,r).addEventListener("popoverOpened",e(this,R)),e(this,r).addEventListener("popoverClosing",e(this,H)),e(this,r).addEventListener("popoverClosed",e(this,z))):console.warn(this,`target ${t} not found`)}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,O)),e(this,r).removeEventListener("popoverOpened",e(this,R)),e(this,r).removeEventListener("popoverClosing",e(this,H)),e(this,r).removeEventListener("popoverClosed",e(this,z)))}}r=new WeakMap,L=new WeakMap,O=new WeakMap,R=new WeakMap,H=new WeakMap,z=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",Q);exports.PopoverButtonElement=Q;exports.PopoverElement=B;
1
+ "use strict";var G=n=>{throw TypeError(n)};var B=(n,c,t)=>c.has(n)||G("Cannot "+t);var e=(n,c,t)=>(B(n,c,"read from private field"),t?t.call(n):c.get(n)),s=(n,c,t)=>c.has(n)?G("Cannot add the same private member more than once"):c instanceof WeakSet?c.add(n):c.set(n,t),i=(n,c,t,h)=>(B(n,c,"write to private field"),h?h.call(n,t):c.set(n,t),t),b=(n,c,t)=>(B(n,c,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const E=require("../css-property/index.cjs"),V=require("../Store-CDb6RMce.cjs"),I=require("../events-KVanG9sR.cjs"),X=require("../function-MthRj-GJ.cjs"),Y=require("../style-At6aDoqG.cjs"),J=require("../window-resizer/vanilla/index.cjs"),Z=require("../browser-CpzFX2xg.cjs");var A,d,q,w,p,g,u,v,m,f,y,S,l,K,T,D,k,j,C,_,O,x,U;const a=class a extends HTMLElement{constructor(){super(...arguments);s(this,l);s(this,A);s(this,d);s(this,q);s(this,w);s(this,p);s(this,g);s(this,u);s(this,v);s(this,m);s(this,f);s(this,y);s(this,S);s(this,T);s(this,k);s(this,C);s(this,_);s(this,O);s(this,x);i(this,A,-1),i(this,d,new V.Store(!1)),i(this,p,new E.CSSProperty(this,"--history",!1)),i(this,g,new E.CSSProperty(this,"--restore",!1)),i(this,u,new E.CSSProperty(this,"--dominance",0)),i(this,v,new E.CSSProperty(this,"--group","")),i(this,m,new E.CSSProperty(this,"--click-outside",!1)),i(this,f,new E.CSSProperty(this,"--escape",!1)),i(this,y,!1),this.open=t=>{if(e(this,d).current)return;i(this,S,t==null?void 0:t.trigger),e(this,d).current=!0,e(this,u).current&&(a.__opened=a.__opened.filter(o=>o!==this&&b(this,l,U).call(this,this,o)?(o.close(),!1):!0)),a.__opened.push(this),i(this,A,a.__opened.length-1),e(this,p).current&&e(this,y)&&history.pushState("","",e(this,l,K)),clearTimeout(e(this,q)),this.classList.remove("closing"),this.classList.add("triggered"),this.style.display="block",I.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,S)}});const h=()=>{addEventListener("click",e(this,T)),addEventListener("keydown",e(this,k)),e(this,x).call(this),this.style.opacity="1",this.classList.add("opened"),I.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,S)}}),i(this,w,void 0)};t!=null&&t.skipTransition?h():i(this,w,setTimeout(h,10))},this.close=()=>{e(this,d).current&&(removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),e(this,d).current=!1,a.__opened=a.__opened.filter(t=>t===this?!1:!e(t,w)&&b(this,l,U).call(this,this,t)?(t.close(),!1):!0),b(this,l,D).call(this),this.classList.remove("opened"),this.classList.add("closing"),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})},Y.getElementTransitionDurationMS(this)+10))},i(this,T,t=>{e(this,m).current&&b(this,l,j).call(this,()=>{var W;const h=t.composedPath();if(h.find(F=>F instanceof HTMLElement&&F.hasAttribute("data-popover-content")))return;const o=h[0],$=o instanceof Node&&(this.contains(o)||((W=this.shadowRoot)==null?void 0:W.contains(o))),P=o instanceof HTMLElement&&o.hasAttribute("data-outside");(!$||P)&&this.close()})}),i(this,k,t=>{e(this,f).current&&b(this,l,j).call(this,()=>{t.code==="Escape"&&this.close()})}),i(this,C,()=>{i(this,y,!1),e(this,d).current&&e(this,p).current&&!location.search.includes(this.id)?this.close():!e(this,d).current&&e(this,p).current&&location.search.includes(this.id)&&this.open(),i(this,y,!0)}),i(this,_,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),e(this,O).call(this)}),i(this,O,X.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,p)}get restore(){return e(this,g)}get dominance(){return e(this,u)}get group(){return e(this,v)}get clickOutside(){return e(this,m)}get escape(){return e(this,f)}get opened(){return e(this,d)}get lastTrigger(){return e(this,S)}connectedCallback(){e(this,p).observe(),e(this,g).observe(),e(this,u).observe(),e(this,v).observe(),e(this,m).observe(),e(this,f).observe(),this.style.opacity="0",this.style.display="none",this.setAttribute("popover-target",""),this.classList.remove("closing"),this.classList.remove("closed"),this.classList.remove("triggered"),this.classList.remove("opened"),addEventListener("popstate",e(this,C)),setTimeout(()=>{e(this,g).current?e(this,C).call(this):(b(this,l,D).call(this),i(this,y,!0))},0),J.windowResizer.subscribe(e(this,_))}disconnectedCallback(){J.windowResizer.unsubscribe(e(this,_)),e(this,p).close(),e(this,g).close(),e(this,u).close(),e(this,v).close(),e(this,m).close(),e(this,f).close(),this.style.opacity="",this.style.display="",this.removeAttribute("popover-target"),a.__opened=a.__opened.filter(t=>t!==this),clearTimeout(e(this,q)),clearTimeout(e(this,w)),removeEventListener("popstate",e(this,C)),removeEventListener("click",e(this,T)),removeEventListener("keydown",e(this,k)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height")}};A=new WeakMap,d=new WeakMap,q=new WeakMap,w=new WeakMap,p=new WeakMap,g=new WeakMap,u=new WeakMap,v=new WeakMap,m=new WeakMap,f=new WeakMap,y=new WeakMap,S=new WeakMap,l=new WeakSet,K=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.id}`},T=new WeakMap,D=function(){if(e(this,p).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(null,"",t.href)}},k=new WeakMap,j=function(t){(a.__opened[e(this,A)-1]||a.__opened.length===1||a.__opened.filter(h=>h!==this).every(h=>e(this,u).current>h.dominance.current))&&t()},C=new WeakMap,_=new WeakMap,O=new WeakMap,x=new WeakMap,U=function(t,h){if(e(t,v).current===e(h,v).current&&t.dominance.current>=h.dominance.current)return!0},a.__opened=[];let N=a;customElements.get("e-popover")||customElements.define("e-popover",N);var r,L,R,M,H,z;class Q extends HTMLElement{constructor(){super();s(this,r);s(this,L,new E.CSSProperty(this,"--type","open"));s(this,R,()=>{this.classList.add("triggered")});s(this,M,()=>{this.classList.add("opened"),this.setAttribute("aria-expanded","true")});s(this,H,()=>{this.classList.remove("opened")});s(this,z,()=>{this.classList.remove("triggered"),this.setAttribute("aria-expanded","false")});Z.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)&&(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 $=this.closest("[popover-target]");if($)o=$;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,R)),e(this,r).addEventListener("popoverOpened",e(this,M)),e(this,r).addEventListener("popoverClosing",e(this,H)),e(this,r).addEventListener("popoverClosed",e(this,z))):console.warn(this,`target ${t} not found`)}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,R)),e(this,r).removeEventListener("popoverOpened",e(this,M)),e(this,r).removeEventListener("popoverClosing",e(this,H)),e(this,r).removeEventListener("popoverClosed",e(this,z)))}}r=new WeakMap,L=new WeakMap,R=new WeakMap,M=new WeakMap,H=new WeakMap,z=new WeakMap;customElements.get("e-popover-button")||customElements.define("e-popover-button",Q);exports.PopoverButtonElement=Q;exports.PopoverElement=N;
@@ -1,23 +1,23 @@
1
1
  var G = (n) => {
2
2
  throw TypeError(n);
3
3
  };
4
- var N = (n, c, t) => c.has(n) || G("Cannot " + t);
5
- var e = (n, c, t) => (N(n, c, "read from private field"), t ? t.call(n) : c.get(n)), s = (n, c, t) => c.has(n) ? G("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(n) : c.set(n, t), i = (n, c, t, h) => (N(n, c, "write to private field"), h ? h.call(n, t) : c.set(n, t), t), b = (n, c, t) => (N(n, c, "access private method"), t);
4
+ var q = (n, c, t) => c.has(n) || G("Cannot " + t);
5
+ var e = (n, c, t) => (q(n, c, "read from private field"), t ? t.call(n) : c.get(n)), s = (n, c, t) => c.has(n) ? G("Cannot add the same private member more than once") : c instanceof WeakSet ? c.add(n) : c.set(n, t), i = (n, c, t, h) => (q(n, c, "write to private field"), h ? h.call(n, t) : c.set(n, t), t), b = (n, c, t) => (q(n, c, "access private method"), t);
6
6
  import { CSSProperty as E } from "../css-property/index.js";
7
7
  import { S as Q } from "../Store-OTdcl6SX.js";
8
- import { d as q } from "../events-CsVF98U6.js";
8
+ import { d as N } from "../events-CsVF98U6.js";
9
9
  import { d as V } from "../function-C10DGppn.js";
10
10
  import { g as X } from "../style-j2TwriJ_.js";
11
11
  import { windowResizer as J } from "../window-resizer/vanilla/index.js";
12
12
  import { i as Y } from "../browser-0zX67oeU.js";
13
- var C, d, H, T, p, g, u, v, m, f, L, w, l, K, k, D, A, U, S, _, M, P, W;
13
+ var C, d, O, T, p, g, u, v, m, f, y, w, l, K, k, D, A, U, S, _, H, P, W;
14
14
  const a = class a extends HTMLElement {
15
15
  constructor() {
16
16
  super(...arguments);
17
17
  s(this, l);
18
18
  s(this, C);
19
19
  s(this, d);
20
- s(this, H);
20
+ s(this, O);
21
21
  s(this, T);
22
22
  s(this, p);
23
23
  s(this, g);
@@ -25,25 +25,25 @@ const a = class a extends HTMLElement {
25
25
  s(this, v);
26
26
  s(this, m);
27
27
  s(this, f);
28
- s(this, L);
28
+ s(this, y);
29
29
  s(this, w);
30
30
  s(this, k);
31
31
  s(this, A);
32
32
  s(this, S);
33
33
  s(this, _);
34
- s(this, M);
34
+ s(this, H);
35
35
  s(this, P);
36
- i(this, C, -1), i(this, d, new Q(!1)), i(this, p, new E(this, "--history", !1)), i(this, g, new E(this, "--restore", !1)), i(this, u, new E(this, "--dominance", 0)), i(this, v, new E(this, "--group", "")), i(this, m, new E(this, "--click-outside", !1)), i(this, f, new E(this, "--escape", !1)), i(this, L, !1), this.open = (t) => {
36
+ i(this, C, -1), i(this, d, new Q(!1)), i(this, p, new E(this, "--history", !1)), i(this, g, new E(this, "--restore", !1)), i(this, u, new E(this, "--dominance", 0)), i(this, v, new E(this, "--group", "")), i(this, m, new E(this, "--click-outside", !1)), i(this, f, new E(this, "--escape", !1)), i(this, y, !1), this.open = (t) => {
37
37
  if (e(this, d).current)
38
38
  return;
39
- i(this, w, t == null ? void 0 : t.trigger), e(this, d).current = !0, e(this, u).current && (a.__opened = a.__opened.filter((o) => o !== this && b(this, l, W).call(this, this, o) ? (o.close(), !1) : !0)), a.__opened.push(this), i(this, C, a.__opened.length - 1), e(this, p).current && e(this, L) && history.pushState("", "", e(this, l, K)), clearTimeout(e(this, H)), this.classList.remove("closing"), this.classList.add("triggered"), this.style.display = "block", q(this, "popoverTriggered", {
39
+ i(this, w, t == null ? void 0 : t.trigger), e(this, d).current = !0, e(this, u).current && (a.__opened = a.__opened.filter((o) => o !== this && b(this, l, W).call(this, this, o) ? (o.close(), !1) : !0)), a.__opened.push(this), i(this, C, a.__opened.length - 1), e(this, p).current && e(this, y) && history.pushState("", "", e(this, l, K)), clearTimeout(e(this, O)), this.classList.remove("closing"), this.classList.add("triggered"), this.style.display = "block", N(this, "popoverTriggered", {
40
40
  custom: !0,
41
41
  detail: {
42
42
  trigger: e(this, w)
43
43
  }
44
44
  });
45
45
  const h = () => {
46
- addEventListener("click", e(this, k)), addEventListener("keydown", e(this, A)), e(this, P).call(this), this.style.opacity = "1", this.classList.add("opened"), q(this, "popoverOpened", {
46
+ addEventListener("click", e(this, k)), addEventListener("keydown", e(this, A)), e(this, P).call(this), this.style.opacity = "1", this.classList.add("opened"), N(this, "popoverOpened", {
47
47
  custom: !0,
48
48
  detail: {
49
49
  trigger: e(this, w)
@@ -52,10 +52,10 @@ const a = class a extends HTMLElement {
52
52
  };
53
53
  t != null && t.skipTransition ? h() : i(this, T, setTimeout(h, 10));
54
54
  }, this.close = () => {
55
- e(this, d).current && (removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), e(this, d).current = !1, a.__opened = a.__opened.filter((t) => t === this ? !1 : !e(t, T) && b(this, l, W).call(this, this, t) ? (t.close(), !1) : !0), b(this, l, D).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.style.opacity = "0", q(this, "popoverClosing", {
55
+ e(this, d).current && (removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), e(this, d).current = !1, a.__opened = a.__opened.filter((t) => t === this ? !1 : !e(t, T) && b(this, l, W).call(this, this, t) ? (t.close(), !1) : !0), b(this, l, D).call(this), this.classList.remove("opened"), this.classList.add("closing"), this.style.opacity = "0", N(this, "popoverClosing", {
56
56
  custom: !0
57
57
  }), setTimeout(() => {
58
- this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none", q(this, "popoverClosed", {
58
+ this.classList.remove("triggered"), this.classList.remove("closing"), this.style.display = "none", N(this, "popoverClosed", {
59
59
  custom: !0
60
60
  });
61
61
  }, X(this) + 10));
@@ -67,7 +67,7 @@ const a = class a extends HTMLElement {
67
67
  (F) => F instanceof HTMLElement && F.hasAttribute("data-popover-content")
68
68
  ))
69
69
  return;
70
- const o = h[0], z = o instanceof HTMLElement && (this.contains(o) || ((j = this.shadowRoot) == null ? void 0 : j.contains(o))), x = o instanceof HTMLElement && o.hasAttribute("data-outside");
70
+ const o = h[0], z = o instanceof Node && (this.contains(o) || ((j = this.shadowRoot) == null ? void 0 : j.contains(o))), x = o instanceof HTMLElement && o.hasAttribute("data-outside");
71
71
  (!z || x) && this.close();
72
72
  });
73
73
  }), i(this, A, (t) => {
@@ -75,10 +75,10 @@ const a = class a extends HTMLElement {
75
75
  t.code === "Escape" && this.close();
76
76
  });
77
77
  }), i(this, S, () => {
78
- i(this, L, !1), e(this, d).current && e(this, p).current && !location.search.includes(this.id) ? this.close() : !e(this, d).current && e(this, p).current && location.search.includes(this.id) && this.open(), i(this, L, !0);
78
+ i(this, y, !1), e(this, d).current && e(this, p).current && !location.search.includes(this.id) ? this.close() : !e(this, d).current && e(this, p).current && location.search.includes(this.id) && this.open(), i(this, y, !0);
79
79
  }), i(this, _, () => {
80
- this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this, M).call(this);
81
- }), i(this, M, V(() => {
80
+ this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), e(this, H).call(this);
81
+ }), i(this, H, V(() => {
82
82
  e(this, P).call(this);
83
83
  }, 10)), i(this, P, () => {
84
84
  this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px");
@@ -110,14 +110,14 @@ const a = class a extends HTMLElement {
110
110
  }
111
111
  connectedCallback() {
112
112
  e(this, p).observe(), e(this, g).observe(), e(this, u).observe(), e(this, v).observe(), e(this, m).observe(), e(this, f).observe(), this.style.opacity = "0", this.style.display = "none", this.setAttribute("popover-target", ""), this.classList.remove("closing"), this.classList.remove("closed"), this.classList.remove("triggered"), this.classList.remove("opened"), addEventListener("popstate", e(this, S)), setTimeout(() => {
113
- e(this, g).current ? e(this, S).call(this) : (b(this, l, D).call(this), i(this, L, !0));
113
+ e(this, g).current ? e(this, S).call(this) : (b(this, l, D).call(this), i(this, y, !0));
114
114
  }, 0), J.subscribe(e(this, _));
115
115
  }
116
116
  disconnectedCallback() {
117
- J.unsubscribe(e(this, _)), e(this, p).close(), e(this, g).close(), e(this, u).close(), e(this, v).close(), e(this, m).close(), e(this, f).close(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), a.__opened = a.__opened.filter((t) => t !== this), clearTimeout(e(this, H)), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, S)), removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height");
117
+ J.unsubscribe(e(this, _)), e(this, p).close(), e(this, g).close(), e(this, u).close(), e(this, v).close(), e(this, m).close(), e(this, f).close(), this.style.opacity = "", this.style.display = "", this.removeAttribute("popover-target"), a.__opened = a.__opened.filter((t) => t !== this), clearTimeout(e(this, O)), clearTimeout(e(this, T)), removeEventListener("popstate", e(this, S)), removeEventListener("click", e(this, k)), removeEventListener("keydown", e(this, A)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height");
118
118
  }
119
119
  };
120
- C = new WeakMap(), d = new WeakMap(), H = new WeakMap(), T = new WeakMap(), p = new WeakMap(), g = new WeakMap(), u = new WeakMap(), v = new WeakMap(), m = new WeakMap(), f = new WeakMap(), L = new WeakMap(), w = new WeakMap(), l = new WeakSet(), K = function() {
120
+ C = new WeakMap(), d = new WeakMap(), O = new WeakMap(), T = new WeakMap(), p = new WeakMap(), g = new WeakMap(), u = new WeakMap(), v = new WeakMap(), m = new WeakMap(), f = new WeakMap(), y = new WeakMap(), w = new WeakMap(), l = new WeakSet(), K = function() {
121
121
  return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.id}`;
122
122
  }, k = new WeakMap(), D = function() {
123
123
  if (e(this, p).current) {
@@ -126,19 +126,19 @@ C = new WeakMap(), d = new WeakMap(), H = new WeakMap(), T = new WeakMap(), p =
126
126
  }
127
127
  }, A = new WeakMap(), U = function(t) {
128
128
  (a.__opened[e(this, C) - 1] || a.__opened.length === 1 || a.__opened.filter((h) => h !== this).every((h) => e(this, u).current > h.dominance.current)) && t();
129
- }, S = new WeakMap(), _ = new WeakMap(), M = new WeakMap(), P = new WeakMap(), W = function(t, h) {
129
+ }, S = new WeakMap(), _ = new WeakMap(), H = new WeakMap(), P = new WeakMap(), W = function(t, h) {
130
130
  if (e(t, v).current === e(h, v).current && t.dominance.current >= h.dominance.current)
131
131
  return !0;
132
132
  }, a.__opened = [];
133
133
  let B = a;
134
134
  customElements.get("e-popover") || customElements.define("e-popover", B);
135
- var r, y, O, R, $, I;
135
+ var r, L, M, R, $, I;
136
136
  class Z extends HTMLElement {
137
137
  constructor() {
138
138
  super();
139
139
  s(this, r);
140
- s(this, y, new E(this, "--type", "open"));
141
- s(this, O, () => {
140
+ s(this, L, new E(this, "--type", "open"));
141
+ s(this, M, () => {
142
142
  this.classList.add("triggered");
143
143
  });
144
144
  s(this, R, () => {
@@ -152,7 +152,7 @@ class Z extends HTMLElement {
152
152
  });
153
153
  Y && (this.addEventListener("click", () => {
154
154
  if (e(this, r)) {
155
- const t = e(this, y).current;
155
+ const t = e(this, L).current;
156
156
  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();
157
157
  }
158
158
  }), this.addEventListener("keydown", (t) => {
@@ -160,14 +160,14 @@ class Z extends HTMLElement {
160
160
  }));
161
161
  }
162
162
  get type() {
163
- return e(this, y);
163
+ return e(this, L);
164
164
  }
165
165
  get popoverElement() {
166
166
  return e(this, r);
167
167
  }
168
168
  connectedCallback() {
169
169
  var h;
170
- e(this, y).subscribe((o) => {
170
+ e(this, L).subscribe((o) => {
171
171
  e(this, r) && (o.current !== "close" ? (this.setAttribute("aria-has-popup", "true"), this.setAttribute(
172
172
  "aria-expanded",
173
173
  e(this, r).opened.current ? "true" : "false"
@@ -187,7 +187,7 @@ class Z extends HTMLElement {
187
187
  } else t === "sibling" ? o = (h = this.parentElement) == null ? void 0 : h.querySelector("[popover-target]") : o = document.querySelector(`#${t}`) || this.getRootNode().querySelector(`#${t}`);
188
188
  o instanceof HTMLElement ? (i(this, r, o), e(this, r).addEventListener(
189
189
  "popoverTriggered",
190
- e(this, O)
190
+ e(this, M)
191
191
  ), e(this, r).addEventListener(
192
192
  "popoverOpened",
193
193
  e(this, R)
@@ -199,12 +199,12 @@ class Z extends HTMLElement {
199
199
  e(this, I)
200
200
  )) : console.warn(this, `target ${t} not found`);
201
201
  }
202
- e(this, y).observe();
202
+ e(this, L).observe();
203
203
  }
204
204
  disconnectedCallback() {
205
- e(this, y).unobserve(), this.removeAttribute("aria-has-popup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), e(this, r) && (e(this, r).removeEventListener(
205
+ e(this, L).unobserve(), this.removeAttribute("aria-has-popup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), e(this, r) && (e(this, r).removeEventListener(
206
206
  "popoverTriggered",
207
- e(this, O)
207
+ e(this, M)
208
208
  ), e(this, r).removeEventListener(
209
209
  "popoverOpened",
210
210
  e(this, R)
@@ -217,7 +217,7 @@ class Z extends HTMLElement {
217
217
  ));
218
218
  }
219
219
  }
220
- r = new WeakMap(), y = new WeakMap(), O = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), I = new WeakMap();
220
+ r = new WeakMap(), L = new WeakMap(), M = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), I = new WeakMap();
221
221
  customElements.get("e-popover-button") || customElements.define("e-popover-button", Z);
222
222
  export {
223
223
  Z as PopoverButtonElement,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.39.2",
3
+ "version": "0.39.4",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"