aptechka 0.76.4 → 0.76.6

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.
@@ -30,6 +30,10 @@ export declare class En3View {
30
30
  set cameraDistance(value: number);
31
31
  set fov(value: 'auto' | number);
32
32
  get fov(): "auto" | number;
33
+ set near(value: number);
34
+ get near(): number;
35
+ set far(value: number);
36
+ get far(): number;
33
37
  get sizeElement(): HTMLElement;
34
38
  get isClipped(): boolean;
35
39
  resize(): void;
package/lib/en3/index.cjs CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";var j=Object.defineProperty,p=Object.defineProperties;var ee=Object.getOwnPropertyDescriptors;var H=Object.getOwnPropertySymbols;var te=Object.prototype.hasOwnProperty,re=Object.prototype.propertyIsEnumerable;var $=i=>{throw TypeError(i)};var N=(i,e,r)=>e in i?j(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,I=(i,e)=>{for(var r in e||(e={}))te.call(e,r)&&N(i,r,e[r]);if(H)for(var r of H(e))re.call(e,r)&&N(i,r,e[r]);return i},B=(i,e)=>p(i,ee(e));var W=(i,e,r)=>e.has(i)||$("Cannot "+r);var t=(i,e,r)=>(W(i,e,"read from private field"),r?r.call(i):e.get(i)),n=(i,e,r)=>e.has(i)?$("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,r),h=(i,e,r,s)=>(W(i,e,"write to private field"),s?s.call(i,r):e.set(i,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("three"),G=require("../order/index.cjs"),K=require("../window-resizer/index.cjs"),U=require("../ticker/index.cjs"),J=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");require("../index-DekP7OZe.cjs");const Z=require("../layout-box/index.cjs");function Q(i){const e=r=>{r.dispose();for(const s of Object.keys(r)){const a=r[s];a&&typeof a=="object"&&"minFilter"in a&&a.dispose()}};i.traverse(r=>{if(r instanceof d.Mesh){if(r.geometry.dispose(),!Array.isArray(r.material)&&r.material.isMaterial)e(r.material);else if(Array.isArray(r.material))for(const s of r.material)e(s)}})}var v,S,c,R,g,o,x,w,y;class F{constructor(e,r,s){n(this,v);n(this,S);n(this,c);n(this,R);n(this,g);n(this,o);n(this,x);n(this,w);n(this,y);h(this,v,e),h(this,S,r),h(this,c,(s==null?void 0:s.cameraType)==="orthographic"?new d.OrthographicCamera:new d.PerspectiveCamera),h(this,R,new d.Scene),h(this,g,[]),h(this,o,(s==null?void 0:s.cameraDistance)||1e3),t(this,c).near=(s==null?void 0:s.cameraNear)||1,t(this,c).far=(s==null?void 0:s.cameraFar)||11e3,h(this,x,(s==null?void 0:s.cameraFov)||"auto"),t(this,c).position.z=t(this,o),t(this,c).name=`Cameras.${t(this,S)}`,h(this,w,J.getElement(s==null?void 0:s.sizeElement)||document.documentElement),this.beforeRenderCallback=s==null?void 0:s.beforeRender,h(this,y,new Z.LayoutBox(t(this,w))),t(this,y).onResize(()=>{this.resize()})}get name(){return t(this,S)}get camera(){return t(this,c)}get scene(){return t(this,R)}get box(){return t(this,y)}get cameraDistance(){return t(this,o)}set cameraDistance(e){h(this,o,e),this.resize()}set fov(e){h(this,x,e),this.resize()}get fov(){return t(this,x)}get sizeElement(){return t(this,w)}get isClipped(){return t(this,w)!==t(this,v).containerElement}resize(){const{width:e,height:r}=t(this,y);t(this,c).userData.controlled||(t(this,c).position.z=t(this,o)),t(this,c)instanceof d.PerspectiveCamera?(t(this,c).aspect=e/r,t(this,c).fov=t(this,x)==="auto"?2*Math.atan(r/2/t(this,o))*(180/Math.PI):t(this,c).userData.controlled?t(this,c).fov:t(this,x)):t(this,c)instanceof d.OrthographicCamera&&(t(this,c).left=e/-2,t(this,c).right=e/2,t(this,c).top=r/2,t(this,c).bottom=r/-2),t(this,c).updateProjectionMatrix()}destroy(){t(this,g).forEach(e=>{e.userData.box.destroy()}),t(this,R).clear(),Q(t(this,R)),t(this,v).destroyView(this.name),t(this,y).destroy()}attachToHTMLElement(e,r,s){const a=new Z.LayoutBox(e,B(I({},s),{containerElement:t(this,w),cartesian:!0,scrollStep:!this.isClipped}));return a.bindObject(r),r.userData.box=a,t(this,g).push(r),r}detachFromHTMLElement(e){h(this,g,t(this,g).filter(r=>r===e?(e.userData.box.destroy(),!1):!0))}add(...e){const r=e[0],s=e[1],a=e[2];return s&&this.attachToHTMLElement(s,r,a),this.scene.add(r),r}remove(e,r){this.scene.remove(e),r&&this.detachFromHTMLElement(e)}}v=new WeakMap,S=new WeakMap,c=new WeakMap,R=new WeakMap,g=new WeakMap,o=new WeakMap,x=new WeakMap,w=new WeakMap,y=new WeakMap;var k,u,l,m,z,V,C,D,M,f,P,A;class se{constructor(){n(this,k,`https://unpkg.com/three@0.${d.REVISION}.x`);n(this,u,null);n(this,l,null);n(this,m,new Map);n(this,z,0);n(this,V,0);n(this,C,0);n(this,D,2);n(this,M,!1);n(this,f,null);n(this,P,e=>{e instanceof CustomEvent||(h(this,z,t(this,u).clientWidth),h(this,V,t(this,u).clientHeight),h(this,C,Math.min(t(this,D),devicePixelRatio||1)),t(this,l).setPixelRatio(t(this,C)),t(this,l).setSize(t(this,z),t(this,V)),t(this,f)&&(t(this,f).setPixelRatio(t(this,C)),t(this,f).setSize(t(this,z),t(this,V))))});n(this,A,()=>{t(this,l).setRenderTarget(null),t(this,m).forEach(e=>{this.render(e)})})}get CDNVersion(){return t(this,k)}get containerElement(){return t(this,u)}get webglRenderer(){return t(this,l)}get views(){return t(this,m)}get view(){return this.getView("default")}get camera(){return this.getView("default").camera}get scene(){return this.getView("default").scene}get width(){return t(this,z)}get height(){return t(this,V)}get pixelRatio(){return t(this,C)}get composer(){return t(this,f)}setup(e){if(t(this,M))return;h(this,u,J.getElement(e==null?void 0:e.containerElement)||document.body),h(this,D,(e==null?void 0:e.maxPixelRatio)||2),h(this,l,new d.WebGLRenderer(e==null?void 0:e.webGLRendererParameters)),t(this,l).domElement.style.cssText=`
1
+ "use strict";var p=Object.defineProperty,ee=Object.defineProperties;var te=Object.getOwnPropertyDescriptors;var N=Object.getOwnPropertySymbols;var re=Object.prototype.hasOwnProperty,se=Object.prototype.propertyIsEnumerable;var B=i=>{throw TypeError(i)};var $=(i,e,r)=>e in i?p(i,e,{enumerable:!0,configurable:!0,writable:!0,value:r}):i[e]=r,I=(i,e)=>{for(var r in e||(e={}))re.call(e,r)&&$(i,r,e[r]);if(N)for(var r of N(e))se.call(e,r)&&$(i,r,e[r]);return i},W=(i,e)=>ee(i,te(e));var G=(i,e,r)=>e.has(i)||B("Cannot "+r);var t=(i,e,r)=>(G(i,e,"read from private field"),r?r.call(i):e.get(i)),c=(i,e,r)=>e.has(i)?B("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(i):e.set(i,r),n=(i,e,r,s)=>(G(i,e,"write to private field"),s?s.call(i,r):e.set(i,r),r);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("three"),K=require("../order/index.cjs"),U=require("../window-resizer/index.cjs"),Z=require("../ticker/index.cjs"),Q=require("../dom-JBOkFLTh.cjs");require("construct-style-sheets-polyfill");require("../index-DekP7OZe.cjs");const J=require("../layout-box/index.cjs"),ie=require("../function-MthRj-GJ.cjs");function X(i){const e=r=>{r.dispose();for(const s of Object.keys(r)){const h=r[s];h&&typeof h=="object"&&"minFilter"in h&&h.dispose()}};i.traverse(r=>{if(r instanceof m.Mesh){if(r.geometry.dispose(),!Array.isArray(r.material)&&r.material.isMaterial)e(r.material);else if(Array.isArray(r.material))for(const s of r.material)e(s)}})}var S,D,a,R,g,o,x,w,y,z;class H{constructor(e,r,s){c(this,S);c(this,D);c(this,a);c(this,R);c(this,g);c(this,o);c(this,x);c(this,w);c(this,y);c(this,z,ie.debounce(()=>{this.resize()},0));n(this,S,e),n(this,D,r),n(this,a,(s==null?void 0:s.cameraType)==="orthographic"?new m.OrthographicCamera:new m.PerspectiveCamera),n(this,R,new m.Scene),n(this,g,[]),n(this,o,(s==null?void 0:s.cameraDistance)||1e3),t(this,a).near=(s==null?void 0:s.cameraNear)||1,t(this,a).far=(s==null?void 0:s.cameraFar)||11e3,n(this,x,(s==null?void 0:s.cameraFov)||"auto"),t(this,a).position.z=t(this,o),t(this,a).name=`Cameras.${t(this,D)}`,n(this,w,Q.getElement(s==null?void 0:s.sizeElement)||document.documentElement),this.beforeRenderCallback=s==null?void 0:s.beforeRender,n(this,y,new J.LayoutBox(t(this,w))),t(this,y).onResize(()=>{this.resize()})}get name(){return t(this,D)}get camera(){return t(this,a)}get scene(){return t(this,R)}get box(){return t(this,y)}get cameraDistance(){return t(this,o)}set cameraDistance(e){n(this,o,e),t(this,z).call(this)}set fov(e){n(this,x,e),t(this,z).call(this)}get fov(){return t(this,x)}set near(e){t(this,a).near=e,t(this,z).call(this)}get near(){return t(this,a).near}set far(e){t(this,a).far=e,t(this,z).call(this)}get far(){return t(this,a).far}get sizeElement(){return t(this,w)}get isClipped(){return t(this,w)!==t(this,S).containerElement}resize(){const{width:e,height:r}=t(this,y);t(this,a).userData.controlled||(t(this,a).position.z=t(this,o)),t(this,a)instanceof m.PerspectiveCamera?(t(this,a).aspect=e/r,t(this,a).fov=t(this,x)==="auto"?2*Math.atan(r/2/t(this,o))*(180/Math.PI):t(this,a).userData.controlled?t(this,a).fov:t(this,x)):t(this,a)instanceof m.OrthographicCamera&&(t(this,a).left=e/-2,t(this,a).right=e/2,t(this,a).top=r/2,t(this,a).bottom=r/-2),t(this,a).updateProjectionMatrix()}destroy(){t(this,g).forEach(e=>{e.userData.box.destroy()}),t(this,R).clear(),X(t(this,R)),t(this,S).destroyView(this.name),t(this,y).destroy()}attachToHTMLElement(e,r,s){const h=new J.LayoutBox(e,W(I({},s),{containerElement:t(this,w),cartesian:!0,scrollStep:!this.isClipped}));return h.bindObject(r),r.userData.box=h,t(this,g).push(r),r}detachFromHTMLElement(e){n(this,g,t(this,g).filter(r=>r===e?(e.userData.box.destroy(),!1):!0))}add(...e){const r=e[0],s=e[1],h=e[2];return s&&this.attachToHTMLElement(s,r,h),this.scene.add(r),r}remove(e,r){this.scene.remove(e),r&&this.detachFromHTMLElement(e)}}S=new WeakMap,D=new WeakMap,a=new WeakMap,R=new WeakMap,g=new WeakMap,o=new WeakMap,x=new WeakMap,w=new WeakMap,y=new WeakMap,z=new WeakMap;var q,d,l,u,V,C,M,P,T,f,A,L;class ae{constructor(){c(this,q,`https://unpkg.com/three@0.${m.REVISION}.x`);c(this,d,null);c(this,l,null);c(this,u,new Map);c(this,V,0);c(this,C,0);c(this,M,0);c(this,P,2);c(this,T,!1);c(this,f,null);c(this,A,e=>{e instanceof CustomEvent||(n(this,V,t(this,d).clientWidth),n(this,C,t(this,d).clientHeight),n(this,M,Math.min(t(this,P),devicePixelRatio||1)),t(this,l).setPixelRatio(t(this,M)),t(this,l).setSize(t(this,V),t(this,C)),t(this,f)&&(t(this,f).setPixelRatio(t(this,M)),t(this,f).setSize(t(this,V),t(this,C))))});c(this,L,()=>{t(this,l).setRenderTarget(null),t(this,u).forEach(e=>{this.render(e)})})}get CDNVersion(){return t(this,q)}get containerElement(){return t(this,d)}get webglRenderer(){return t(this,l)}get views(){return t(this,u)}get view(){return this.getView("default")}get camera(){return this.getView("default").camera}get scene(){return this.getView("default").scene}get width(){return t(this,V)}get height(){return t(this,C)}get pixelRatio(){return t(this,M)}get composer(){return t(this,f)}setup(e){if(t(this,T))return;n(this,d,Q.getElement(e==null?void 0:e.containerElement)||document.body),n(this,P,(e==null?void 0:e.maxPixelRatio)||2),n(this,l,new m.WebGLRenderer(e==null?void 0:e.webGLRendererParameters)),t(this,l).domElement.style.cssText=`
2
2
  position: ${(e==null?void 0:e.position)||"fixed"};
3
3
  left: 0;
4
4
  top: 0;
5
5
  width: 100%;
6
6
  height: 100%;
7
7
  z-index: ${(e==null?void 0:e.zIndex)||0};
8
- `,(t(this,u).shadowRoot||t(this,u)).append(t(this,l).domElement),t(this,m).set("default",new F(this,"default",I({sizeElement:t(this,u)},e==null?void 0:e.view))),e!=null&&e.composer&&(h(this,f,new e.composer(t(this,l))),this.render=()=>{t(this,f).render()}),h(this,M,!0),K.windowResizer.subscribe(t(this,P),G.RESIZE_ORDER.CANVAS),U.ticker.subscribe(t(this,A),{order:G.TICK_ORDER.CANVAS,culling:t(this,u)})}destroy(){var e;t(this,M)&&(K.windowResizer.unsubscribe(t(this,P)),U.ticker.unsubscribe(t(this,A)),t(this,m).forEach(r=>{r.destroy()}),t(this,m).clear(),t(this,l).dispose(),t(this,l).domElement.remove(),h(this,l,null),(e=t(this,f))==null||e.dispose(),h(this,f,null),h(this,M,!1))}createView(e,r){const s=t(this,m).size,a=new F(this,e,r);return t(this,m).set(e,a),s===1&&t(this,l).setScissorTest(!0),a}getView(e){return t(this,m).get(e)}destroyView(e){const r=t(this,m).get(e);r&&(t(this,m).delete(e),r.destroy(),t(this,m).size<=1&&t(this,l).setScissorTest(!1))}render(e){var r;if(t(this,m).size>1||this.view.isClipped){const s=e.box.left+e.box.CSSTranslation.x+e.box.scrollValue.x,a=this.height-e.box.height-e.box.top+e.box.CSSTranslation.y+e.box.scrollValue.y*-1;t(this,l).setScissor(s,a,e.box.width,e.box.height),t(this,l).setViewport(s,a,e.box.width,e.box.height)}(r=e.beforeRenderCallback)==null||r.call(e),t(this,l).render(e.scene,e.camera)}}k=new WeakMap,u=new WeakMap,l=new WeakMap,m=new WeakMap,z=new WeakMap,V=new WeakMap,C=new WeakMap,D=new WeakMap,M=new WeakMap,f=new WeakMap,P=new WeakMap,A=new WeakMap;function ie(i,e,r){const s=e.x,a=e.y,E=r||i.image.width/i.image.height;let T=0,b=0,q=i.offset.x,L=i.offset.y,O=i.rotation,X=i.center.x,Y=i.center.y;s/a>E?(T=1,b=a/s*E):(b=1,T=s/a/E),i.matrix.setUvTransform(q,L,T,b,O,X,Y)}const _=new d.Vector3,ae=new d.Vector3;function he(i,e,r="default"){const s=i.getView(r),{width:a,height:E}=i,T=a/E;e instanceof d.Vector3?_.copy(e):_.set(...e);const b=s.camera.getWorldPosition(ae).distanceTo(_);if(s.camera instanceof d.OrthographicCamera)return{width:a/s.camera.zoom,height:E/s.camera.zoom,factor:1,distance:b,aspect:T};{const q=s.camera.fov*Math.PI/180,L=2*Math.tan(q/2)*b,O=L*(a/E);return{width:O,height:L,factor:a/O,distance:b,aspect:T}}}function ne(i,e){i.traverse(r=>{r instanceof d.Mesh&&r.material&&(Array.isArray(r.material)?r.material:[r.material]).forEach(e)})}function ce(i,e){i.traverse(r=>{r instanceof d.Mesh&&e(r)})}exports.En3=se;exports.En3View=F;exports.coverTexture=ie;exports.dispose=Q;exports.getCurrentViewport=he;exports.traverseMaterials=ne;exports.traverseMeshes=ce;
8
+ `,(t(this,d).shadowRoot||t(this,d)).append(t(this,l).domElement),t(this,u).set("default",new H(this,"default",I({sizeElement:t(this,d)},e==null?void 0:e.view))),e!=null&&e.composer&&(n(this,f,new e.composer(t(this,l))),this.render=()=>{t(this,f).render()}),n(this,T,!0),U.windowResizer.subscribe(t(this,A),K.RESIZE_ORDER.CANVAS),Z.ticker.subscribe(t(this,L),{order:K.TICK_ORDER.CANVAS,culling:t(this,d)})}destroy(){var e;t(this,T)&&(U.windowResizer.unsubscribe(t(this,A)),Z.ticker.unsubscribe(t(this,L)),t(this,u).forEach(r=>{r.destroy()}),t(this,u).clear(),t(this,l).dispose(),t(this,l).domElement.remove(),n(this,l,null),(e=t(this,f))==null||e.dispose(),n(this,f,null),n(this,T,!1))}createView(e,r){const s=t(this,u).size,h=new H(this,e,r);return t(this,u).set(e,h),s===1&&t(this,l).setScissorTest(!0),h}getView(e){return t(this,u).get(e)}destroyView(e){const r=t(this,u).get(e);r&&(t(this,u).delete(e),r.destroy(),t(this,u).size<=1&&t(this,l).setScissorTest(!1))}render(e){var r;if(t(this,u).size>1||this.view.isClipped){const s=e.box.left+e.box.CSSTranslation.x+e.box.scrollValue.x,h=this.height-e.box.height-e.box.top+e.box.CSSTranslation.y+e.box.scrollValue.y*-1;t(this,l).setScissor(s,h,e.box.width,e.box.height),t(this,l).setViewport(s,h,e.box.width,e.box.height)}(r=e.beforeRenderCallback)==null||r.call(e),t(this,l).render(e.scene,e.camera)}}q=new WeakMap,d=new WeakMap,l=new WeakMap,u=new WeakMap,V=new WeakMap,C=new WeakMap,M=new WeakMap,P=new WeakMap,T=new WeakMap,f=new WeakMap,A=new WeakMap,L=new WeakMap;function he(i,e,r){const s=e.x,h=e.y,b=r||i.image.width/i.image.height;let v=0,E=0,_=i.offset.x,O=i.offset.y,k=i.rotation,Y=i.center.x,j=i.center.y;s/h>b?(v=1,E=h/s*b):(E=1,v=s/h/b),i.matrix.setUvTransform(_,O,v,E,k,Y,j)}const F=new m.Vector3,ne=new m.Vector3;function ce(i,e,r="default"){const s=i.getView(r),{width:h,height:b}=i,v=h/b;e instanceof m.Vector3?F.copy(e):F.set(...e);const E=s.camera.getWorldPosition(ne).distanceTo(F);if(s.camera instanceof m.OrthographicCamera)return{width:h/s.camera.zoom,height:b/s.camera.zoom,factor:1,distance:E,aspect:v};{const _=s.camera.fov*Math.PI/180,O=2*Math.tan(_/2)*E,k=O*(h/b);return{width:k,height:O,factor:h/k,distance:E,aspect:v}}}function le(i,e){i.traverse(r=>{r instanceof m.Mesh&&r.material&&(Array.isArray(r.material)?r.material:[r.material]).forEach(e)})}function ue(i,e){i.traverse(r=>{r instanceof m.Mesh&&e(r)})}exports.En3=ae;exports.En3View=H;exports.coverTexture=he;exports.dispose=X;exports.getCurrentViewport=ce;exports.traverseMaterials=le;exports.traverseMeshes=ue;
package/lib/en3/index.js CHANGED
@@ -1,38 +1,39 @@
1
- var p = Object.defineProperty, ee = Object.defineProperties;
2
- var te = Object.getOwnPropertyDescriptors;
3
- var W = Object.getOwnPropertySymbols;
4
- var se = Object.prototype.hasOwnProperty, ie = Object.prototype.propertyIsEnumerable;
5
- var G = (r) => {
1
+ var ee = Object.defineProperty, te = Object.defineProperties;
2
+ var se = Object.getOwnPropertyDescriptors;
3
+ var _ = Object.getOwnPropertySymbols;
4
+ var ie = Object.prototype.hasOwnProperty, re = Object.prototype.propertyIsEnumerable;
5
+ var B = (r) => {
6
6
  throw TypeError(r);
7
7
  };
8
- var _ = (r, e, s) => e in r ? p(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s, O = (r, e) => {
8
+ var G = (r, e, s) => e in r ? ee(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s, F = (r, e) => {
9
9
  for (var s in e || (e = {}))
10
- se.call(e, s) && _(r, s, e[s]);
11
- if (W)
12
- for (var s of W(e))
13
- ie.call(e, s) && _(r, s, e[s]);
10
+ ie.call(e, s) && G(r, s, e[s]);
11
+ if (_)
12
+ for (var s of _(e))
13
+ re.call(e, s) && G(r, s, e[s]);
14
14
  return r;
15
- }, B = (r, e) => ee(r, te(e));
16
- var K = (r, e, s) => e.has(r) || G("Cannot " + s);
17
- var t = (r, e, s) => (K(r, e, "read from private field"), s ? s.call(r) : e.get(r)), n = (r, e, s) => e.has(r) ? G("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, s), a = (r, e, s, i) => (K(r, e, "write to private field"), i ? i.call(r, s) : e.set(r, s), s);
18
- import { Mesh as N, OrthographicCamera as H, PerspectiveCamera as U, Scene as re, REVISION as he, WebGLRenderer as ae, Vector3 as $ } from "three";
19
- import { RESIZE_ORDER as ne, TICK_ORDER as ce } from "../order/index.js";
20
- import { windowResizer as Z } from "../window-resizer/index.js";
21
- import { ticker as q } from "../ticker/index.js";
22
- import { g as X } from "../dom-CVWzyXPH.js";
15
+ }, K = (r, e) => te(r, se(e));
16
+ var U = (r, e, s) => e.has(r) || B("Cannot " + s);
17
+ var t = (r, e, s) => (U(r, e, "read from private field"), s ? s.call(r) : e.get(r)), c = (r, e, s) => e.has(r) ? B("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(r) : e.set(r, s), n = (r, e, s, i) => (U(r, e, "write to private field"), i ? i.call(r, s) : e.set(r, s), s);
18
+ import { Mesh as $, OrthographicCamera as N, PerspectiveCamera as Z, Scene as he, REVISION as ae, WebGLRenderer as ne, Vector3 as W } from "three";
19
+ import { RESIZE_ORDER as ce, TICK_ORDER as le } from "../order/index.js";
20
+ import { windowResizer as q } from "../window-resizer/index.js";
21
+ import { ticker as J } from "../ticker/index.js";
22
+ import { g as Y } from "../dom-CVWzyXPH.js";
23
23
  import "construct-style-sheets-polyfill";
24
24
  import "../index-Bv9zgfdb.js";
25
- import { LayoutBox as J } from "../layout-box/index.js";
26
- function le(r) {
25
+ import { LayoutBox as Q } from "../layout-box/index.js";
26
+ import { d as me } from "../function-C10DGppn.js";
27
+ function fe(r) {
27
28
  const e = (s) => {
28
29
  s.dispose();
29
30
  for (const i of Object.keys(s)) {
30
- const h = s[i];
31
- h && typeof h == "object" && "minFilter" in h && h.dispose();
31
+ const a = s[i];
32
+ a && typeof a == "object" && "minFilter" in a && a.dispose();
32
33
  }
33
34
  };
34
35
  r.traverse((s) => {
35
- if (s instanceof N) {
36
+ if (s instanceof $) {
36
37
  if (s.geometry.dispose(), !Array.isArray(s.material) && s.material.isMaterial)
37
38
  e(s.material);
38
39
  else if (Array.isArray(s.material))
@@ -40,105 +41,120 @@ function le(r) {
40
41
  }
41
42
  });
42
43
  }
43
- var M, S, c, w, o, u, g, x, y;
44
- class Q {
44
+ var S, D, h, w, o, u, g, x, b, R;
45
+ class X {
45
46
  constructor(e, s, i) {
46
- n(this, M);
47
- n(this, S);
48
- n(this, c);
49
- n(this, w);
50
- n(this, o);
51
- n(this, u);
52
- n(this, g);
53
- n(this, x);
54
- n(this, y);
55
- a(this, M, e), a(this, S, s), a(this, c, (i == null ? void 0 : i.cameraType) === "orthographic" ? new H() : new U()), a(this, w, new re()), a(this, o, []), a(this, u, (i == null ? void 0 : i.cameraDistance) || 1e3), t(this, c).near = (i == null ? void 0 : i.cameraNear) || 1, t(this, c).far = (i == null ? void 0 : i.cameraFar) || 11e3, a(this, g, (i == null ? void 0 : i.cameraFov) || "auto"), t(this, c).position.z = t(this, u), t(this, c).name = `Cameras.${t(this, S)}`, a(this, x, X(i == null ? void 0 : i.sizeElement) || document.documentElement), this.beforeRenderCallback = i == null ? void 0 : i.beforeRender, a(this, y, new J(t(this, x))), t(this, y).onResize(() => {
47
+ c(this, S);
48
+ c(this, D);
49
+ c(this, h);
50
+ c(this, w);
51
+ c(this, o);
52
+ c(this, u);
53
+ c(this, g);
54
+ c(this, x);
55
+ c(this, b);
56
+ c(this, R, me(() => {
57
+ this.resize();
58
+ }, 0));
59
+ n(this, S, e), n(this, D, s), n(this, h, (i == null ? void 0 : i.cameraType) === "orthographic" ? new N() : new Z()), n(this, w, new he()), n(this, o, []), n(this, u, (i == null ? void 0 : i.cameraDistance) || 1e3), t(this, h).near = (i == null ? void 0 : i.cameraNear) || 1, t(this, h).far = (i == null ? void 0 : i.cameraFar) || 11e3, n(this, g, (i == null ? void 0 : i.cameraFov) || "auto"), t(this, h).position.z = t(this, u), t(this, h).name = `Cameras.${t(this, D)}`, n(this, x, Y(i == null ? void 0 : i.sizeElement) || document.documentElement), this.beforeRenderCallback = i == null ? void 0 : i.beforeRender, n(this, b, new Q(t(this, x))), t(this, b).onResize(() => {
56
60
  this.resize();
57
61
  });
58
62
  }
59
63
  get name() {
60
- return t(this, S);
64
+ return t(this, D);
61
65
  }
62
66
  get camera() {
63
- return t(this, c);
67
+ return t(this, h);
64
68
  }
65
69
  get scene() {
66
70
  return t(this, w);
67
71
  }
68
72
  get box() {
69
- return t(this, y);
73
+ return t(this, b);
70
74
  }
71
75
  get cameraDistance() {
72
76
  return t(this, u);
73
77
  }
74
78
  set cameraDistance(e) {
75
- a(this, u, e), this.resize();
79
+ n(this, u, e), t(this, R).call(this);
76
80
  }
77
81
  set fov(e) {
78
- a(this, g, e), this.resize();
82
+ n(this, g, e), t(this, R).call(this);
79
83
  }
80
84
  get fov() {
81
85
  return t(this, g);
82
86
  }
87
+ set near(e) {
88
+ t(this, h).near = e, t(this, R).call(this);
89
+ }
90
+ get near() {
91
+ return t(this, h).near;
92
+ }
93
+ set far(e) {
94
+ t(this, h).far = e, t(this, R).call(this);
95
+ }
96
+ get far() {
97
+ return t(this, h).far;
98
+ }
83
99
  get sizeElement() {
84
100
  return t(this, x);
85
101
  }
86
102
  get isClipped() {
87
- return t(this, x) !== t(this, M).containerElement;
103
+ return t(this, x) !== t(this, S).containerElement;
88
104
  }
89
105
  resize() {
90
- const { width: e, height: s } = t(this, y);
91
- t(this, c).userData.controlled || (t(this, c).position.z = t(this, u)), t(this, c) instanceof U ? (t(this, c).aspect = e / s, t(this, c).fov = t(this, g) === "auto" ? 2 * Math.atan(s / 2 / t(this, u)) * (180 / Math.PI) : t(this, c).userData.controlled ? t(this, c).fov : t(this, g)) : t(this, c) instanceof H && (t(this, c).left = e / -2, t(this, c).right = e / 2, t(this, c).top = s / 2, t(this, c).bottom = s / -2), t(this, c).updateProjectionMatrix();
106
+ const { width: e, height: s } = t(this, b);
107
+ t(this, h).userData.controlled || (t(this, h).position.z = t(this, u)), t(this, h) instanceof Z ? (t(this, h).aspect = e / s, t(this, h).fov = t(this, g) === "auto" ? 2 * Math.atan(s / 2 / t(this, u)) * (180 / Math.PI) : t(this, h).userData.controlled ? t(this, h).fov : t(this, g)) : t(this, h) instanceof N && (t(this, h).left = e / -2, t(this, h).right = e / 2, t(this, h).top = s / 2, t(this, h).bottom = s / -2), t(this, h).updateProjectionMatrix();
92
108
  }
93
109
  destroy() {
94
110
  t(this, o).forEach((e) => {
95
111
  e.userData.box.destroy();
96
- }), t(this, w).clear(), le(t(this, w)), t(this, M).destroyView(this.name), t(this, y).destroy();
112
+ }), t(this, w).clear(), fe(t(this, w)), t(this, S).destroyView(this.name), t(this, b).destroy();
97
113
  }
98
114
  attachToHTMLElement(e, s, i) {
99
- const h = new J(e, B(O({}, i), {
115
+ const a = new Q(e, K(F({}, i), {
100
116
  containerElement: t(this, x),
101
117
  cartesian: !0,
102
118
  scrollStep: !this.isClipped
103
119
  }));
104
- return h.bindObject(s), s.userData.box = h, t(this, o).push(s), s;
120
+ return a.bindObject(s), s.userData.box = a, t(this, o).push(s), s;
105
121
  }
106
122
  detachFromHTMLElement(e) {
107
- a(this, o, t(this, o).filter((s) => s === e ? (e.userData.box.destroy(), !1) : !0));
123
+ n(this, o, t(this, o).filter((s) => s === e ? (e.userData.box.destroy(), !1) : !0));
108
124
  }
109
125
  add(...e) {
110
- const s = e[0], i = e[1], h = e[2];
111
- return i && this.attachToHTMLElement(i, s, h), this.scene.add(s), s;
126
+ const s = e[0], i = e[1], a = e[2];
127
+ return i && this.attachToHTMLElement(i, s, a), this.scene.add(s), s;
112
128
  }
113
129
  remove(e, s) {
114
130
  this.scene.remove(e), s && this.detachFromHTMLElement(e);
115
131
  }
116
132
  }
117
- M = new WeakMap(), S = new WeakMap(), c = new WeakMap(), w = new WeakMap(), o = new WeakMap(), u = new WeakMap(), g = new WeakMap(), x = new WeakMap(), y = new WeakMap();
118
- var k, f, l, m, R, z, V, D, C, d, v, P;
119
- class we {
133
+ S = new WeakMap(), D = new WeakMap(), h = new WeakMap(), w = new WeakMap(), o = new WeakMap(), u = new WeakMap(), g = new WeakMap(), x = new WeakMap(), b = new WeakMap(), R = new WeakMap();
134
+ var I, f, l, m, z, V, C, v, T, d, P, A;
135
+ class Ve {
120
136
  constructor() {
121
- n(this, k, `https://unpkg.com/three@0.${he}.x`);
122
- n(this, f, null);
123
- n(this, l, null);
124
- n(this, m, /* @__PURE__ */ new Map());
125
- n(this, R, 0);
126
- n(this, z, 0);
127
- n(this, V, 0);
128
- n(this, D, 2);
129
- n(this, C, !1);
130
- n(this, d, null);
131
- n(this, v, (e) => {
132
- e instanceof CustomEvent || (a(this, R, t(this, f).clientWidth), a(this, z, t(this, f).clientHeight), a(this, V, Math.min(t(this, D), devicePixelRatio || 1)), t(this, l).setPixelRatio(t(this, V)), t(this, l).setSize(t(this, R), t(this, z)), t(this, d) && (t(this, d).setPixelRatio(t(this, V)), t(this, d).setSize(t(this, R), t(this, z))));
137
+ c(this, I, `https://unpkg.com/three@0.${ae}.x`);
138
+ c(this, f, null);
139
+ c(this, l, null);
140
+ c(this, m, /* @__PURE__ */ new Map());
141
+ c(this, z, 0);
142
+ c(this, V, 0);
143
+ c(this, C, 0);
144
+ c(this, v, 2);
145
+ c(this, T, !1);
146
+ c(this, d, null);
147
+ c(this, P, (e) => {
148
+ e instanceof CustomEvent || (n(this, z, t(this, f).clientWidth), n(this, V, t(this, f).clientHeight), n(this, C, Math.min(t(this, v), devicePixelRatio || 1)), t(this, l).setPixelRatio(t(this, C)), t(this, l).setSize(t(this, z), t(this, V)), t(this, d) && (t(this, d).setPixelRatio(t(this, C)), t(this, d).setSize(t(this, z), t(this, V))));
133
149
  });
134
- n(this, P, () => {
150
+ c(this, A, () => {
135
151
  t(this, l).setRenderTarget(null), t(this, m).forEach((e) => {
136
152
  this.render(e);
137
153
  });
138
154
  });
139
155
  }
140
156
  get CDNVersion() {
141
- return t(this, k);
157
+ return t(this, I);
142
158
  }
143
159
  get containerElement() {
144
160
  return t(this, f);
@@ -159,21 +175,21 @@ class we {
159
175
  return this.getView("default").scene;
160
176
  }
161
177
  get width() {
162
- return t(this, R);
178
+ return t(this, z);
163
179
  }
164
180
  get height() {
165
- return t(this, z);
181
+ return t(this, V);
166
182
  }
167
183
  get pixelRatio() {
168
- return t(this, V);
184
+ return t(this, C);
169
185
  }
170
186
  get composer() {
171
187
  return t(this, d);
172
188
  }
173
189
  setup(e) {
174
- if (t(this, C))
190
+ if (t(this, T))
175
191
  return;
176
- a(this, f, X(e == null ? void 0 : e.containerElement) || document.body), a(this, D, (e == null ? void 0 : e.maxPixelRatio) || 2), a(this, l, new ae(e == null ? void 0 : e.webGLRendererParameters)), t(this, l).domElement.style.cssText = `
192
+ n(this, f, Y(e == null ? void 0 : e.containerElement) || document.body), n(this, v, (e == null ? void 0 : e.maxPixelRatio) || 2), n(this, l, new ne(e == null ? void 0 : e.webGLRendererParameters)), t(this, l).domElement.style.cssText = `
177
193
  position: ${(e == null ? void 0 : e.position) || "fixed"};
178
194
  left: 0;
179
195
  top: 0;
@@ -182,25 +198,25 @@ class we {
182
198
  z-index: ${(e == null ? void 0 : e.zIndex) || 0};
183
199
  `, (t(this, f).shadowRoot || t(this, f)).append(t(this, l).domElement), t(this, m).set(
184
200
  "default",
185
- new Q(this, "default", O({
201
+ new X(this, "default", F({
186
202
  sizeElement: t(this, f)
187
203
  }, e == null ? void 0 : e.view))
188
- ), e != null && e.composer && (a(this, d, new e.composer(t(this, l))), this.render = () => {
204
+ ), e != null && e.composer && (n(this, d, new e.composer(t(this, l))), this.render = () => {
189
205
  t(this, d).render();
190
- }), a(this, C, !0), Z.subscribe(t(this, v), ne.CANVAS), q.subscribe(t(this, P), {
191
- order: ce.CANVAS,
206
+ }), n(this, T, !0), q.subscribe(t(this, P), ce.CANVAS), J.subscribe(t(this, A), {
207
+ order: le.CANVAS,
192
208
  culling: t(this, f)
193
209
  });
194
210
  }
195
211
  destroy() {
196
212
  var e;
197
- t(this, C) && (Z.unsubscribe(t(this, v)), q.unsubscribe(t(this, P)), t(this, m).forEach((s) => {
213
+ t(this, T) && (q.unsubscribe(t(this, P)), J.unsubscribe(t(this, A)), t(this, m).forEach((s) => {
198
214
  s.destroy();
199
- }), t(this, m).clear(), t(this, l).dispose(), t(this, l).domElement.remove(), a(this, l, null), (e = t(this, d)) == null || e.dispose(), a(this, d, null), a(this, C, !1));
215
+ }), t(this, m).clear(), t(this, l).dispose(), t(this, l).domElement.remove(), n(this, l, null), (e = t(this, d)) == null || e.dispose(), n(this, d, null), n(this, T, !1));
200
216
  }
201
217
  createView(e, s) {
202
- const i = t(this, m).size, h = new Q(this, e, s);
203
- return t(this, m).set(e, h), i === 1 && t(this, l).setScissorTest(!0), h;
218
+ const i = t(this, m).size, a = new X(this, e, s);
219
+ return t(this, m).set(e, a), i === 1 && t(this, l).setScissorTest(!0), a;
204
220
  }
205
221
  getView(e) {
206
222
  return t(this, m).get(e);
@@ -212,10 +228,10 @@ class we {
212
228
  render(e) {
213
229
  var s;
214
230
  if (t(this, m).size > 1 || this.view.isClipped) {
215
- const i = e.box.left + e.box.CSSTranslation.x + e.box.scrollValue.x, h = this.height - e.box.height - e.box.top + e.box.CSSTranslation.y + e.box.scrollValue.y * -1;
216
- t(this, l).setScissor(i, h, e.box.width, e.box.height), t(this, l).setViewport(
231
+ const i = e.box.left + e.box.CSSTranslation.x + e.box.scrollValue.x, a = this.height - e.box.height - e.box.top + e.box.CSSTranslation.y + e.box.scrollValue.y * -1;
232
+ t(this, l).setScissor(i, a, e.box.width, e.box.height), t(this, l).setViewport(
217
233
  i,
218
- h,
234
+ a,
219
235
  e.box.width,
220
236
  e.box.height
221
237
  );
@@ -223,46 +239,46 @@ class we {
223
239
  (s = e.beforeRenderCallback) == null || s.call(e), t(this, l).render(e.scene, e.camera);
224
240
  }
225
241
  }
226
- k = new WeakMap(), f = new WeakMap(), l = new WeakMap(), m = new WeakMap(), R = new WeakMap(), z = new WeakMap(), V = new WeakMap(), D = new WeakMap(), C = new WeakMap(), d = new WeakMap(), v = new WeakMap(), P = new WeakMap();
227
- function Re(r, e, s) {
228
- const i = e.x, h = e.y, E = s || r.image.width / r.image.height;
229
- let T = 0, b = 0, I = r.offset.x, A = r.offset.y, L = r.rotation, Y = r.center.x, j = r.center.y;
230
- i / h > E ? (T = 1, b = h / i * E) : (b = 1, T = i / h / E), r.matrix.setUvTransform(I, A, T, b, L, Y, j);
242
+ I = new WeakMap(), f = new WeakMap(), l = new WeakMap(), m = new WeakMap(), z = new WeakMap(), V = new WeakMap(), C = new WeakMap(), v = new WeakMap(), T = new WeakMap(), d = new WeakMap(), P = new WeakMap(), A = new WeakMap();
243
+ function Ce(r, e, s) {
244
+ const i = e.x, a = e.y, y = s || r.image.width / r.image.height;
245
+ let M = 0, E = 0, O = r.offset.x, L = r.offset.y, k = r.rotation, j = r.center.x, p = r.center.y;
246
+ i / a > y ? (M = 1, E = a / i * y) : (E = 1, M = i / a / y), r.matrix.setUvTransform(O, L, M, E, k, j, p);
231
247
  }
232
- const F = new $(), me = new $();
233
- function ze(r, e, s = "default") {
234
- const i = r.getView(s), { width: h, height: E } = r, T = h / E;
235
- e instanceof $ ? F.copy(e) : F.set(...e);
236
- const b = i.camera.getWorldPosition(me).distanceTo(F);
237
- if (i.camera instanceof H)
248
+ const H = new W(), de = new W();
249
+ function Te(r, e, s = "default") {
250
+ const i = r.getView(s), { width: a, height: y } = r, M = a / y;
251
+ e instanceof W ? H.copy(e) : H.set(...e);
252
+ const E = i.camera.getWorldPosition(de).distanceTo(H);
253
+ if (i.camera instanceof N)
238
254
  return {
239
- width: h / i.camera.zoom,
240
- height: E / i.camera.zoom,
255
+ width: a / i.camera.zoom,
256
+ height: y / i.camera.zoom,
241
257
  factor: 1,
242
- distance: b,
243
- aspect: T
258
+ distance: E,
259
+ aspect: M
244
260
  };
245
261
  {
246
- const I = i.camera.fov * Math.PI / 180, A = 2 * Math.tan(I / 2) * b, L = A * (h / E);
247
- return { width: L, height: A, factor: h / L, distance: b, aspect: T };
262
+ const O = i.camera.fov * Math.PI / 180, L = 2 * Math.tan(O / 2) * E, k = L * (a / y);
263
+ return { width: k, height: L, factor: a / k, distance: E, aspect: M };
248
264
  }
249
265
  }
250
- function Ve(r, e) {
266
+ function Me(r, e) {
251
267
  r.traverse((s) => {
252
- s instanceof N && s.material && (Array.isArray(s.material) ? s.material : [s.material]).forEach(e);
268
+ s instanceof $ && s.material && (Array.isArray(s.material) ? s.material : [s.material]).forEach(e);
253
269
  });
254
270
  }
255
- function Ce(r, e) {
271
+ function Se(r, e) {
256
272
  r.traverse((s) => {
257
- s instanceof N && e(s);
273
+ s instanceof $ && e(s);
258
274
  });
259
275
  }
260
276
  export {
261
- we as En3,
262
- Q as En3View,
263
- Re as coverTexture,
264
- le as dispose,
265
- ze as getCurrentViewport,
266
- Ve as traverseMaterials,
267
- Ce as traverseMeshes
277
+ Ve as En3,
278
+ X as En3View,
279
+ Ce as coverTexture,
280
+ fe as dispose,
281
+ Te as getCurrentViewport,
282
+ Me as traverseMaterials,
283
+ Se as traverseMeshes
268
284
  };
@@ -1 +1 @@
1
- "use strict";var ne=c=>{throw TypeError(c)};var te=(c,n,t)=>n.has(c)||ne("Cannot "+t);var e=(c,n,t)=>(te(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?ne("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(te(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),p=(c,n,t)=>(te(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const pe=require("../element-linked-store/index.cjs"),y=require("../css-property/index.cjs"),re=require("../index-DekP7OZe.cjs"),M=require("../events-KVanG9sR.cjs"),de=require("../function-MthRj-GJ.cjs"),he=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const ce=require("../url-Dns-01WU.cjs"),le=require("../window-resizer/index.cjs"),Z=require("../Viewport-DB0qAZPJ.cjs");var d,w,N,ee;class fe{constructor(){r(this,d,new Map);r(this,w,[]);r(this,N,n=>{var s;const t=[...e(this,w)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(oe=>oe instanceof HTMLElement&&oe.hasAttribute("data-popover-content")))return;const l=i[0],f=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),U=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!f||U)&&t.close()}});r(this,ee,n=>{if(n.code==="Escape"){const t=[...e(this,w)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,N)),addEventListener("keydown",e(this,ee))}get groups(){return e(this,d)}get stack(){return e(this,w)}add(n,t){if(t.closeRest.current)e(this,d).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,d).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,d).get(n);s!=null&&s.length||(s=[],e(this,d).set(n,s)),e(this,w).push(t),s.push(t)}remove(n,t){if(setTimeout(()=>{o(this,w,e(this,w).filter(s=>s!==t))}),t.closeRest.current){let s=[];e(this,d).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,d).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,d).get(n);e(this,d).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,d).get(n);s&&(s=s.filter(i=>i!==t),e(this,d).set(n,s))}}}d=new WeakMap,w=new WeakMap,N=new WeakMap,ee=new WeakMap;var v,B,H,x,W,m,C,T,R,q,b,$,V,P,E,O,a,z,G,u,ae,L,_,D,k,X,Y,F;const S=class S extends HTMLElement{constructor(){super();r(this,u);r(this,v);r(this,B);r(this,H);r(this,x);r(this,W);r(this,m);r(this,C);r(this,T);r(this,R);r(this,q);r(this,b);r(this,$);r(this,V);r(this,P);r(this,E);r(this,O);r(this,a);r(this,z);r(this,G);r(this,D);r(this,k);r(this,X);r(this,Y);r(this,F);this.urlValue="",o(this,v,!1),o(this,m,new y.CSSProperty(this,"--history",!1)),o(this,C,new y.CSSProperty(this,"--restore",!1)),o(this,T,new y.CSSProperty(this,"--dispatch-resize",!1)),o(this,R,new y.CSSProperty(this,"--close-rest",!1)),o(this,q,new y.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new y.CSSProperty(this,"--group","")),o(this,$,new y.CSSProperty(this,"--click-outside",!1)),o(this,V,new y.CSSProperty(this,"--escape",!1)),o(this,P,new y.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,E,!0),o(this,a,new pe.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,z,[]),o(this,G,[]),o(this,D,()=>{o(this,E,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)}),o(this,k,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,X).call(this)}),o(this,X,de.debounce(()=>{e(this,Y).call(this)},10)),o(this,Y,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,P).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>Z.viewport.width?s=Z.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>Z.viewport.height?i=Z.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,F,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(S.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,a).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=S.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,C)}get dispatchResize(){return e(this,T)}get closeRest(){return e(this,R)}get closeRestInGroup(){return e(this,q)}get group(){return e(this,b)}get clickOutside(){return e(this,$)}get escape(){return e(this,V)}get opened(){return e(this,v)}get lastTrigger(){return e(this,O)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&ce.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,O,t==null?void 0:t.trigger),clearTimeout(e(this,B)),clearTimeout(e(this,H)),p(this,u,L).call(this,!1,this.closingClass),e(this,a).set("closing",!1),e(this,a).set("triggered",!0),M.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,O)}}),e(this,m).current&&e(this,E)&&history.pushState(history.state,"",e(this,u,ae)),e(this,a).set("beforeopen",!0),o(this,v,!0);const s=()=>{S.stack.add(e(this,b).current,this),e(this,G).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),p(this,u,L).call(this,!0,this.openClass),e(this,a).set("opened",!0),e(this,T).current?M.dispatchEvent(window,"resize",{custom:!0}):e(this,k).call(this),M.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,O)},bubbles:!0}),o(this,x,void 0),o(this,W,setTimeout(()=>{e(this,a).set("transitionend",!0),M.dispatchEvent(this,"popoverTransitionend")},he.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,x,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,x)),clearTimeout(e(this,W)),S.stack.remove(e(this,b).current,this),p(this,u,_).call(this),o(this,B,setTimeout(()=>{e(this,a).set("transitionend",!1),e(this,a).set("opened",!1),e(this,a).set("closing",!0),p(this,u,L).call(this,!1,this.openClass),p(this,u,L).call(this,!0,this.closingClass),M.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,H,setTimeout(()=>{e(this,a).set("triggered",!1),e(this,a).set("beforeopen",!1),e(this,a).set("closing",!1),p(this,u,L).call(this,!1,this.closingClass),M.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},he.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,z,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,z).forEach(t=>{t.addEventListener("click",e(this,F))}),o(this,G,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,C).observe(),e(this,T).observe(),e(this,R).observe(),e(this,q).observe(),e(this,b).observe(),e(this,$).observe(),e(this,V).observe(),e(this,P).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,D)),setTimeout(()=>{e(this,C).current?(o(this,E,!1),this.urlValue=ce.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)):(p(this,u,_).call(this),o(this,E,!0))},0),e(this,P).subscribe(()=>{e(this,k).call(this)}),le.windowResizer.subscribe(e(this,k))}disconnectedCallback(){e(this,z).forEach(t=>{t.removeEventListener("click",e(this,F))}),S.stack.remove(e(this,b).current,this),le.windowResizer.unsubscribe(e(this,k)),e(this,m).close(),e(this,C).close(),e(this,T).close(),e(this,R).close(),e(this,q).close(),e(this,b).close(),e(this,$).close(),e(this,V).close(),e(this,P).close(),this.removeAttribute("role"),p(this,u,L).call(this,!1,this.openClass),p(this,u,L).call(this,!1,this.closingClass),clearTimeout(e(this,B)),clearTimeout(e(this,H)),clearTimeout(e(this,x)),clearTimeout(e(this,W)),removeEventListener("popstate",e(this,D)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),p(this,u,_).call(this)}};v=new WeakMap,B=new WeakMap,H=new WeakMap,x=new WeakMap,W=new WeakMap,m=new WeakMap,C=new WeakMap,T=new WeakMap,R=new WeakMap,q=new WeakMap,b=new WeakMap,$=new WeakMap,V=new WeakMap,P=new WeakMap,E=new WeakMap,O=new WeakMap,a=new WeakMap,z=new WeakMap,G=new WeakMap,u=new WeakSet,ae=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},L=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},_=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},D=new WeakMap,k=new WeakMap,X=new WeakMap,Y=new WeakMap,F=new WeakMap,S.stack=new fe;let j=S;re.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",j);var h,g,A,se,I,J,K,Q,ie;class ue extends HTMLElement{constructor(){super();r(this,A);r(this,h);r(this,g,new y.CSSProperty(this,"--type","open"));r(this,I,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,J,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,K,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,Q,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});re.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(p(this,A,se).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const f=this.getRootNode();f instanceof ShadowRoot?i=f.host.closest("[data-popover]"):f instanceof HTMLElement&&(i=f.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=f=>{if(!f)return null;let U=f.querySelector("[data-popover]");return!U&&(f!=null&&f.parentElement)&&(U=l(f.parentElement)),U};i=l(this.parentElement)||null}else!t.startsWith(".")&&!t.startsWith("[")&&(t=`#${t}`),i=document.querySelector(t)||this.getRootNode().querySelector(t);i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,I)),e(this,h).addEventListener("popoverOpened",e(this,J)),e(this,h).addEventListener("popoverClosing",e(this,K)),e(this,h).addEventListener("popoverClosed",e(this,Q))):console.warn(this,`target ${t} not found`)}p(this,A,ie).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{p(this,A,ie).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),p(this,A,se).call(this)}}h=new WeakMap,g=new WeakMap,A=new WeakSet,se=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,I)),e(this,h).removeEventListener("popoverOpened",e(this,J)),e(this,h).removeEventListener("popoverClosing",e(this,K)),e(this,h).removeEventListener("popoverClosed",e(this,Q)))},I=new WeakMap,J=new WeakMap,K=new WeakMap,Q=new WeakMap,ie=function(t){e(this,h)instanceof j&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};re.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ue);exports.PopoverButtonElement=ue;exports.PopoverElement=j;
1
+ "use strict";var ne=c=>{throw TypeError(c)};var se=(c,n,t)=>n.has(c)||ne("Cannot "+t);var e=(c,n,t)=>(se(c,n,"read from private field"),t?t.call(c):n.get(c)),r=(c,n,t)=>n.has(c)?ne("Cannot add the same private member more than once"):n instanceof WeakSet?n.add(c):n.set(c,t),o=(c,n,t,s)=>(se(c,n,"write to private field"),s?s.call(c,t):n.set(c,t),t),d=(c,n,t)=>(se(c,n,"access private method"),t);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const de=require("../element-linked-store/index.cjs"),y=require("../css-property/index.cjs"),oe=require("../index-DekP7OZe.cjs"),W=require("../events-KVanG9sR.cjs"),fe=require("../function-MthRj-GJ.cjs"),he=require("../style-At6aDoqG.cjs");require("construct-style-sheets-polyfill");const le=require("../url-Dns-01WU.cjs"),ce=require("../window-resizer/index.cjs"),_=require("../Viewport-DB0qAZPJ.cjs");var f,w,ee,te;class ge{constructor(){r(this,f,new Map);r(this,w,[]);r(this,ee,n=>{var s;const t=[...e(this,w)].reverse().find(i=>i.clickOutside.current);if(t){const i=n.composedPath();if(i.find(j=>j instanceof HTMLElement&&j.hasAttribute("data-popover-content")))return;const l=i[0],a=l instanceof Node&&(t.contains(l)||((s=t.shadowRoot)==null?void 0:s.contains(l))),x=l instanceof HTMLElement&&l.hasAttribute("data-outside");(!a||x)&&t.close()}});r(this,te,n=>{if(n.code==="Escape"){const t=[...e(this,w)].reverse().find(s=>s.escape.current);t&&t.close()}});document.documentElement.addEventListener("click",e(this,ee)),addEventListener("keydown",e(this,te))}get groups(){return e(this,f)}get stack(){return e(this,w)}add(n,t){if(t.closeRest.current)e(this,f).forEach(i=>{i.forEach(l=>{l.close()})});else if(t.closeRestInGroup.current){let i=e(this,f).get(n);i==null||i.forEach(l=>{l.close()})}let s=e(this,f).get(n);s!=null&&s.length||(s=[],e(this,f).set(n,s)),e(this,w).push(t),s.push(t)}remove(n,t){if(setTimeout(()=>{o(this,w,e(this,w).filter(s=>s!==t))}),t.closeRest.current){let s=[];e(this,f).forEach(i=>{i.forEach(l=>s.push(l))}),e(this,f).clear(),s.forEach(i=>i.close())}else if(t.closeRestInGroup.current){const s=e(this,f).get(n);e(this,f).delete(n),s==null||s.forEach(i=>{i.close()})}else{let s=e(this,f).get(n);s&&(s=s.filter(i=>i!==t),e(this,f).set(n,s))}}}f=new WeakMap,w=new WeakMap,ee=new WeakMap,te=new WeakMap;var v,B,H,R,G,m,C,T,q,$,b,V,O,P,E,z,u,M,D,p,ae,L,N,F,k,Y,I,U;const S=class S extends HTMLElement{constructor(){super();r(this,p);r(this,v);r(this,B);r(this,H);r(this,R);r(this,G);r(this,m);r(this,C);r(this,T);r(this,q);r(this,$);r(this,b);r(this,V);r(this,O);r(this,P);r(this,E);r(this,z);r(this,u);r(this,M);r(this,D);r(this,F);r(this,k);r(this,Y);r(this,I);r(this,U);this.urlValue="",o(this,v,!1),o(this,m,new y.CSSProperty(this,"--history",!1)),o(this,C,new y.CSSProperty(this,"--restore",!1)),o(this,T,new y.CSSProperty(this,"--dispatch-resize",!1)),o(this,q,new y.CSSProperty(this,"--close-rest",!1)),o(this,$,new y.CSSProperty(this,"--close-rest-in-group",!1)),o(this,b,new y.CSSProperty(this,"--group","")),o(this,V,new y.CSSProperty(this,"--click-outside",!1)),o(this,O,new y.CSSProperty(this,"--escape",!1)),o(this,P,new y.CSSProperty(this,"--check-viewport-bounds",!1)),o(this,E,!0),o(this,u,new de.ElementLinkedStore(this,{triggered:!1,beforeopen:!1,opened:!1,closing:!1,transitionend:!1})),o(this,M,[]),o(this,D,[]),o(this,F,()=>{o(this,E,!1),e(this,v)&&e(this,m).current&&!location.search.includes(this.id)?this.close():!e(this,v)&&e(this,m).current&&location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)}),o(this,k,()=>{this.style.setProperty("--content-width","initial"),this.style.setProperty("--content-height","initial"),this.style.setProperty("--viewport-offset-x","0px"),this.style.setProperty("--viewport-offset-y","0px"),e(this,Y).call(this)}),o(this,Y,fe.debounce(()=>{e(this,I).call(this)},10)),o(this,I,()=>{if(this.style.setProperty("--content-width",this.scrollWidth+"px"),this.style.setProperty("--content-height",this.scrollHeight+"px"),e(this,P).current){const t=this.getBoundingClientRect();let s=0,i=0;t.right>_.viewport.width?s=_.viewport.width-t.right:t.left<0&&(s=t.left*-1),t.bottom>_.viewport.height?i=_.viewport.height-t.bottom:t.top<0&&(i=t.top*-1),this.style.setProperty("--viewport-offset-x",s+"px"),this.style.setProperty("--viewport-offset-y",i+"px")}}),o(this,U,()=>{this.close()}),e(this,b).subscribe(t=>{t.previous&&(S.stack.remove(t.previous,this),t.current||(document.documentElement.classList.remove(`${this.group.previous}-closing`),document.documentElement.classList.remove(`${this.group.previous}-opened`)))}),e(this,u).subscribe(t=>{if(this.group.current){document.documentElement.classList.toggle(`${this.group.current}-closing`,t.current.closing);const s=S.stack.groups.get(this.group.current),i=s==null?void 0:s.find(l=>l.opened);document.documentElement.classList.toggle(`${this.group.current}-opened`,!!i)}})}get openClass(){return this.getAttribute("data-open-global-class")}get closingClass(){return this.getAttribute("data-closing-global-class")}get history(){return e(this,m)}get restore(){return e(this,C)}get dispatchResize(){return e(this,T)}get closeRest(){return e(this,q)}get closeRestInGroup(){return e(this,$)}get group(){return e(this,b)}get clickOutside(){return e(this,V)}get escape(){return e(this,O)}get opened(){return e(this,v)}get lastTrigger(){return e(this,z)}get idWithValue(){return`${this.id}${this.urlValue?"="+this.urlValue:""}`}updateUrlValue(t){this.urlValue=(t==null?void 0:t.toString())||"",e(this,v)&&le.updateSearchParameter(this.id,t)}open(t){if(e(this,v))return;o(this,z,t==null?void 0:t.trigger),clearTimeout(e(this,B)),clearTimeout(e(this,H)),d(this,p,L).call(this,!1,this.closingClass),e(this,u).set("closing",!1),e(this,u).set("triggered",!0),W.dispatchEvent(this,"popoverTriggered",{custom:!0,detail:{trigger:e(this,z)}}),e(this,m).current&&e(this,E)&&history.pushState(history.state,"",e(this,p,ae)),e(this,u).set("beforeopen",!0),o(this,v,!0);const s=()=>{S.stack.add(e(this,b).current,this),e(this,D).forEach(i=>{i.scroll({top:0,left:0,behavior:"instant"})}),d(this,p,L).call(this,!0,this.openClass),e(this,u).set("opened",!0),e(this,T).current?W.dispatchEvent(window,"resize",{custom:!0}):e(this,k).call(this),W.dispatchEvent(this,"popoverOpened",{custom:!0,detail:{trigger:e(this,z)},bubbles:!0}),o(this,R,void 0),o(this,G,setTimeout(()=>{e(this,u).set("transitionend",!0),W.dispatchEvent(this,"popoverTransitionend")},he.getElementTransitionDurationMS(this)+10))};t!=null&&t.skipTransition?s():o(this,R,requestAnimationFrame(s))}close(){e(this,v)&&(o(this,v,!1),cancelAnimationFrame(e(this,R)),clearTimeout(e(this,G)),S.stack.remove(e(this,b).current,this),d(this,p,N).call(this),o(this,B,setTimeout(()=>{e(this,u).set("transitionend",!1),e(this,u).set("opened",!1),e(this,u).set("closing",!0),d(this,p,L).call(this,!1,this.openClass),d(this,p,L).call(this,!0,this.closingClass),W.dispatchEvent(this,"popoverClosing",{custom:!0,bubbles:!0}),o(this,H,setTimeout(()=>{e(this,u).set("triggered",!1),e(this,u).set("beforeopen",!1),e(this,u).set("closing",!1),d(this,p,L).call(this,!1,this.closingClass),W.dispatchEvent(this,"popoverClosed",{custom:!0,bubbles:!0})},he.getElementTransitionDurationMS(this)+10))},10)))}connectedCallback(){o(this,M,[...this.querySelectorAll(`[data-popover-close${this.id?`="${this.id}"`:""}]`)]),e(this,M).forEach(t=>{t.addEventListener("click",e(this,U))}),o(this,D,[...this.querySelectorAll(`[data-popover-reset-scroll${this.id?`="${this.id}"`:""}]`)]),e(this,m).observe(),e(this,C).observe(),e(this,T).observe(),e(this,q).observe(),e(this,$).observe(),e(this,b).observe(),e(this,V).observe(),e(this,O).observe(),e(this,P).observe(),this.setAttribute("role","dialog"),addEventListener("popstate",e(this,F)),setTimeout(()=>{e(this,C).current?(o(this,E,!1),this.urlValue=le.parseSearchParameters(location.search)[this.id],location.search.includes(this.id)&&this.open({trigger:this.idWithValue}),o(this,E,!0)):(d(this,p,N).call(this),o(this,E,!0))},0),e(this,P).subscribe(()=>{e(this,k).call(this)}),ce.windowResizer.subscribe(e(this,k))}disconnectedCallback(){e(this,M).forEach(t=>{t.removeEventListener("click",e(this,U))}),S.stack.remove(e(this,b).current,this),ce.windowResizer.unsubscribe(e(this,k)),e(this,m).close(),e(this,C).close(),e(this,T).close(),e(this,q).close(),e(this,$).close(),e(this,b).close(),e(this,V).close(),e(this,O).close(),e(this,P).close(),this.removeAttribute("role"),d(this,p,L).call(this,!1,this.openClass),d(this,p,L).call(this,!1,this.closingClass),clearTimeout(e(this,B)),clearTimeout(e(this,H)),clearTimeout(e(this,R)),clearTimeout(e(this,G)),removeEventListener("popstate",e(this,F)),this.style.removeProperty("--content-width"),this.style.removeProperty("--content-height"),this.style.removeProperty("--viewport-offset-x"),this.style.removeProperty("--viewport-offset-y"),d(this,p,N).call(this)}};v=new WeakMap,B=new WeakMap,H=new WeakMap,R=new WeakMap,G=new WeakMap,m=new WeakMap,C=new WeakMap,T=new WeakMap,q=new WeakMap,$=new WeakMap,b=new WeakMap,V=new WeakMap,O=new WeakMap,P=new WeakMap,E=new WeakMap,z=new WeakMap,u=new WeakMap,M=new WeakMap,D=new WeakMap,p=new WeakSet,ae=function(){return`${location.pathname}${location.search?location.search+"&":"?"}${this.idWithValue}`},L=function(t,s){s&&s.split(" ").map(i=>{document.documentElement.classList.toggle(i.trim(),t)})},N=function(){if(e(this,m).current){const t=new URL(location.href);t.searchParams.delete(this.id),history.replaceState(history.state,"",t.href)}},F=new WeakMap,k=new WeakMap,Y=new WeakMap,I=new WeakMap,U=new WeakMap,S.stack=new ge;let X=S;oe.isBrowser&&!customElements.get("e-popover")&&customElements.define("e-popover",X);var h,g,A,ie,J,K,Q,Z,re;class ue extends HTMLElement{constructor(){super();r(this,A);r(this,h);r(this,g,new y.CSSProperty(this,"--type","open"));r(this,J,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.add("triggered")});r(this,K,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.add("opened"),this.setAttribute("aria-expanded","true"))});r(this,Q,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&this.classList.remove("opened")});r(this,Z,t=>{t.target===e(this,h)&&e(this,g).current!=="close"&&(this.classList.remove("triggered"),this.setAttribute("aria-expanded","false"))});oe.isBrowser&&(this.addEventListener("click",()=>{if(e(this,h)){const t=e(this,g).current;t==="open"||t==="toggle"&&!e(this,h).opened?e(this,h).open({trigger:this}):(t==="close"||t==="toggle"&&e(this,h).opened)&&e(this,h).close()}}),this.addEventListener("keydown",t=>{t.code==="Space"&&!this.hasAttribute("keydown-disabled")&&(t.preventDefault(),this.click())}))}get type(){return e(this,g)}get popoverElement(){return e(this,h)}changePopover(t){var s;if(d(this,A,ie).call(this),t){let i=null;if(t==="parent"){const l=this.closest("[data-popover]");if(l)i=l;else{const a=this.getRootNode();a instanceof ShadowRoot?i=a.host.closest("[data-popover]"):a instanceof HTMLElement&&(i=a.closest("[data-popover]"))}}else if(t==="sibling")i=(s=this.parentElement)==null?void 0:s.querySelector("[data-popover]");else if(t==="ancestor-child"){const l=a=>{if(!a)return null;let x=a.querySelector("[data-popover]");return!x&&(a!=null&&a.parentElement)&&(x=l(a.parentElement)),x};i=l(this.parentElement)||null}else if(!t.startsWith(".")&&!t.startsWith("[")&&t.startsWith("#"),i=document.querySelector(t)||this.getRootNode().querySelector(t),!i){const a=[...document.querySelectorAll("[data-popover-ids]")].find(x=>{var j;return(j=x.getAttribute("data-popover-ids"))==null?void 0:j.split(",").find(pe=>pe.trim()===t)});a&&(i=a)}i instanceof HTMLElement?(o(this,h,i),e(this,h).addEventListener("popoverTriggered",e(this,J)),e(this,h).addEventListener("popoverOpened",e(this,K)),e(this,h).addEventListener("popoverClosing",e(this,Q)),e(this,h).addEventListener("popoverClosed",e(this,Z))):console.warn(this,`target ${t} not found`)}d(this,A,re).call(this,e(this,g).current)}connectedCallback(){e(this,g).subscribe(s=>{d(this,A,re).call(this,s.current)}),this.hasAttribute("tabindex")||(this.tabIndex=0),this.hasAttribute("role")||this.setAttribute("role","button");const t=this.getAttribute("target");t&&this.changePopover(t),this.isConnected&&e(this,g).observe()}disconnectedCallback(){e(this,g).unobserve(),this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls"),this.removeAttribute("role"),this.removeAttribute("tabindex"),d(this,A,ie).call(this)}}h=new WeakMap,g=new WeakMap,A=new WeakSet,ie=function(){e(this,h)&&(e(this,h).removeEventListener("popoverTriggered",e(this,J)),e(this,h).removeEventListener("popoverOpened",e(this,K)),e(this,h).removeEventListener("popoverClosing",e(this,Q)),e(this,h).removeEventListener("popoverClosed",e(this,Z)))},J=new WeakMap,K=new WeakMap,Q=new WeakMap,Z=new WeakMap,re=function(t){e(this,h)instanceof X&&(t!=="close"?(this.setAttribute("aria-haspopup","true"),this.setAttribute("aria-expanded",e(this,h).opened?"true":"false"),this.setAttribute("aria-controls",e(this,h).id||"")):(this.removeAttribute("aria-haspopup"),this.removeAttribute("aria-expanded"),this.removeAttribute("aria-controls")))};oe.isBrowser&&!customElements.get("e-popover-button")&&customElements.define("e-popover-button",ue);exports.PopoverButtonElement=ue;exports.PopoverElement=X;
@@ -1,37 +1,37 @@
1
- var ht = (l) => {
2
- throw TypeError(l);
1
+ var ht = (c) => {
2
+ throw TypeError(c);
3
3
  };
4
- var et = (l, h, e) => h.has(l) || ht("Cannot " + e);
5
- var t = (l, h, e) => (et(l, h, "read from private field"), e ? e.call(l) : h.get(l)), r = (l, h, e) => h.has(l) ? ht("Cannot add the same private member more than once") : h instanceof WeakSet ? h.add(l) : h.set(l, e), o = (l, h, e, s) => (et(l, h, "write to private field"), s ? s.call(l, e) : h.set(l, e), e), p = (l, h, e) => (et(l, h, "access private method"), e);
6
- import { ElementLinkedStore as at } from "../element-linked-store/index.js";
4
+ var st = (c, h, e) => h.has(c) || ht("Cannot " + e);
5
+ var t = (c, h, e) => (st(c, h, "read from private field"), e ? e.call(c) : h.get(c)), r = (c, h, e) => h.has(c) ? ht("Cannot add the same private member more than once") : h instanceof WeakSet ? h.add(c) : h.set(c, e), o = (c, h, e, s) => (st(c, h, "write to private field"), s ? s.call(c, e) : h.set(c, e), e), d = (c, h, e) => (st(c, h, "access private method"), e);
6
+ import { ElementLinkedStore as ut } from "../element-linked-store/index.js";
7
7
  import { CSSProperty as E } from "../css-property/index.js";
8
- import { i as rt } from "../index-Bv9zgfdb.js";
9
- import { d as q } from "../events-CsVF98U6.js";
10
- import { d as ut } from "../function-C10DGppn.js";
8
+ import { i as ot } from "../index-Bv9zgfdb.js";
9
+ import { d as W } from "../events-CsVF98U6.js";
10
+ import { d as pt } from "../function-C10DGppn.js";
11
11
  import { g as nt } from "../style-j2TwriJ_.js";
12
12
  import "construct-style-sheets-polyfill";
13
- import { u as pt, p as dt } from "../url-CBKXmNOi.js";
13
+ import { u as dt, p as ft } from "../url-CBKXmNOi.js";
14
14
  import { windowResizer as lt } from "../window-resizer/index.js";
15
- import { v as Q } from "../Viewport-DA10iWAO.js";
16
- var d, w, _, tt;
17
- class ft {
15
+ import { v as Z } from "../Viewport-DA10iWAO.js";
16
+ var f, w, tt, et;
17
+ class gt {
18
18
  constructor() {
19
- r(this, d, /* @__PURE__ */ new Map());
19
+ r(this, f, /* @__PURE__ */ new Map());
20
20
  r(this, w, []);
21
- r(this, _, (h) => {
21
+ r(this, tt, (h) => {
22
22
  var s;
23
23
  const e = [...t(this, w)].reverse().find((i) => i.clickOutside.current);
24
24
  if (e) {
25
25
  const i = h.composedPath();
26
26
  if (i.find(
27
- (ot) => ot instanceof HTMLElement && ot.hasAttribute("data-popover-content")
27
+ (X) => X instanceof HTMLElement && X.hasAttribute("data-popover-content")
28
28
  ))
29
29
  return;
30
- const c = i[0], f = c instanceof Node && (e.contains(c) || ((s = e.shadowRoot) == null ? void 0 : s.contains(c))), U = c instanceof HTMLElement && c.hasAttribute("data-outside");
31
- (!f || U) && e.close();
30
+ const l = i[0], a = l instanceof Node && (e.contains(l) || ((s = e.shadowRoot) == null ? void 0 : s.contains(l))), x = l instanceof HTMLElement && l.hasAttribute("data-outside");
31
+ (!a || x) && e.close();
32
32
  }
33
33
  });
34
- r(this, tt, (h) => {
34
+ r(this, et, (h) => {
35
35
  if (h.code === "Escape") {
36
36
  const e = [...t(this, w)].reverse().find((s) => s.escape.current);
37
37
  e && e.close();
@@ -39,103 +39,103 @@ class ft {
39
39
  });
40
40
  document.documentElement.addEventListener(
41
41
  "click",
42
- t(this, _)
43
- ), addEventListener("keydown", t(this, tt));
42
+ t(this, tt)
43
+ ), addEventListener("keydown", t(this, et));
44
44
  }
45
45
  get groups() {
46
- return t(this, d);
46
+ return t(this, f);
47
47
  }
48
48
  get stack() {
49
49
  return t(this, w);
50
50
  }
51
51
  add(h, e) {
52
52
  if (e.closeRest.current)
53
- t(this, d).forEach((i) => {
54
- i.forEach((c) => {
55
- c.close();
53
+ t(this, f).forEach((i) => {
54
+ i.forEach((l) => {
55
+ l.close();
56
56
  });
57
57
  });
58
58
  else if (e.closeRestInGroup.current) {
59
- let i = t(this, d).get(h);
60
- i == null || i.forEach((c) => {
61
- c.close();
59
+ let i = t(this, f).get(h);
60
+ i == null || i.forEach((l) => {
61
+ l.close();
62
62
  });
63
63
  }
64
- let s = t(this, d).get(h);
65
- s != null && s.length || (s = [], t(this, d).set(h, s)), t(this, w).push(e), s.push(e);
64
+ let s = t(this, f).get(h);
65
+ s != null && s.length || (s = [], t(this, f).set(h, s)), t(this, w).push(e), s.push(e);
66
66
  }
67
67
  remove(h, e) {
68
68
  if (setTimeout(() => {
69
69
  o(this, w, t(this, w).filter((s) => s !== e));
70
70
  }), e.closeRest.current) {
71
71
  let s = [];
72
- t(this, d).forEach((i) => {
73
- i.forEach((c) => s.push(c));
74
- }), t(this, d).clear(), s.forEach((i) => i.close());
72
+ t(this, f).forEach((i) => {
73
+ i.forEach((l) => s.push(l));
74
+ }), t(this, f).clear(), s.forEach((i) => i.close());
75
75
  } else if (e.closeRestInGroup.current) {
76
- const s = t(this, d).get(h);
77
- t(this, d).delete(h), s == null || s.forEach((i) => {
76
+ const s = t(this, f).get(h);
77
+ t(this, f).delete(h), s == null || s.forEach((i) => {
78
78
  i.close();
79
79
  });
80
80
  } else {
81
- let s = t(this, d).get(h);
82
- s && (s = s.filter((i) => i !== e), t(this, d).set(h, s));
81
+ let s = t(this, f).get(h);
82
+ s && (s = s.filter((i) => i !== e), t(this, f).set(h, s));
83
83
  }
84
84
  }
85
85
  }
86
- d = new WeakMap(), w = new WeakMap(), _ = new WeakMap(), tt = new WeakMap();
87
- var m, H, W, S, G, v, k, A, R, $, b, V, O, C, y, z, a, M, B, u, ct, L, Z, F, P, X, Y, D;
86
+ f = new WeakMap(), w = new WeakMap(), tt = new WeakMap(), et = new WeakMap();
87
+ var m, H, G, R, B, v, k, A, $, V, b, O, q, C, y, z, u, M, F, p, ct, L, N, D, P, Y, j, U;
88
88
  const T = class T extends HTMLElement {
89
89
  constructor() {
90
90
  super();
91
- r(this, u);
91
+ r(this, p);
92
92
  r(this, m);
93
93
  r(this, H);
94
- r(this, W);
95
- r(this, S);
96
94
  r(this, G);
95
+ r(this, R);
96
+ r(this, B);
97
97
  r(this, v);
98
98
  r(this, k);
99
99
  r(this, A);
100
- r(this, R);
101
100
  r(this, $);
102
- r(this, b);
103
101
  r(this, V);
102
+ r(this, b);
104
103
  r(this, O);
104
+ r(this, q);
105
105
  r(this, C);
106
106
  r(this, y);
107
107
  r(this, z);
108
- r(this, a);
108
+ r(this, u);
109
109
  r(this, M);
110
- r(this, B);
111
110
  r(this, F);
111
+ r(this, D);
112
112
  r(this, P);
113
- r(this, X);
114
113
  r(this, Y);
115
- r(this, D);
116
- this.urlValue = "", o(this, m, !1), o(this, v, new E(this, "--history", !1)), o(this, k, new E(this, "--restore", !1)), o(this, A, new E(this, "--dispatch-resize", !1)), o(this, R, new E(this, "--close-rest", !1)), o(this, $, new E(
114
+ r(this, j);
115
+ r(this, U);
116
+ this.urlValue = "", o(this, m, !1), o(this, v, new E(this, "--history", !1)), o(this, k, new E(this, "--restore", !1)), o(this, A, new E(this, "--dispatch-resize", !1)), o(this, $, new E(this, "--close-rest", !1)), o(this, V, new E(
117
117
  this,
118
118
  "--close-rest-in-group",
119
119
  !1
120
- )), o(this, b, new E(this, "--group", "")), o(this, V, new E(this, "--click-outside", !1)), o(this, O, new E(this, "--escape", !1)), o(this, C, new E(this, "--check-viewport-bounds", !1)), o(this, y, !0), o(this, a, new at(this, {
120
+ )), o(this, b, new E(this, "--group", "")), o(this, O, new E(this, "--click-outside", !1)), o(this, q, new E(this, "--escape", !1)), o(this, C, new E(this, "--check-viewport-bounds", !1)), o(this, y, !0), o(this, u, new ut(this, {
121
121
  triggered: !1,
122
122
  beforeopen: !1,
123
123
  opened: !1,
124
124
  closing: !1,
125
125
  transitionend: !1
126
- })), o(this, M, []), o(this, B, []), o(this, F, () => {
126
+ })), o(this, M, []), o(this, F, []), o(this, D, () => {
127
127
  o(this, y, !1), t(this, m) && t(this, v).current && !location.search.includes(this.id) ? this.close() : !t(this, m) && t(this, v).current && location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), o(this, y, !0);
128
128
  }), o(this, P, () => {
129
- this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), this.style.setProperty("--viewport-offset-x", "0px"), this.style.setProperty("--viewport-offset-y", "0px"), t(this, X).call(this);
130
- }), o(this, X, ut(() => {
131
- t(this, Y).call(this);
132
- }, 10)), o(this, Y, () => {
129
+ this.style.setProperty("--content-width", "initial"), this.style.setProperty("--content-height", "initial"), this.style.setProperty("--viewport-offset-x", "0px"), this.style.setProperty("--viewport-offset-y", "0px"), t(this, Y).call(this);
130
+ }), o(this, Y, pt(() => {
131
+ t(this, j).call(this);
132
+ }, 10)), o(this, j, () => {
133
133
  if (this.style.setProperty("--content-width", this.scrollWidth + "px"), this.style.setProperty("--content-height", this.scrollHeight + "px"), t(this, C).current) {
134
134
  const e = this.getBoundingClientRect();
135
135
  let s = 0, i = 0;
136
- e.right > Q.width ? s = Q.width - e.right : e.left < 0 && (s = e.left * -1), e.bottom > Q.height ? i = Q.height - e.bottom : e.top < 0 && (i = e.top * -1), this.style.setProperty("--viewport-offset-x", s + "px"), this.style.setProperty("--viewport-offset-y", i + "px");
136
+ e.right > Z.width ? s = Z.width - e.right : e.left < 0 && (s = e.left * -1), e.bottom > Z.height ? i = Z.height - e.bottom : e.top < 0 && (i = e.top * -1), this.style.setProperty("--viewport-offset-x", s + "px"), this.style.setProperty("--viewport-offset-y", i + "px");
137
137
  }
138
- }), o(this, D, () => {
138
+ }), o(this, U, () => {
139
139
  this.close();
140
140
  }), t(this, b).subscribe((e) => {
141
141
  e.previous && (T.stack.remove(e.previous, this), e.current || (document.documentElement.classList.remove(
@@ -143,13 +143,13 @@ const T = class T extends HTMLElement {
143
143
  ), document.documentElement.classList.remove(
144
144
  `${this.group.previous}-opened`
145
145
  )));
146
- }), t(this, a).subscribe((e) => {
146
+ }), t(this, u).subscribe((e) => {
147
147
  if (this.group.current) {
148
148
  document.documentElement.classList.toggle(
149
149
  `${this.group.current}-closing`,
150
150
  e.current.closing
151
151
  );
152
- const s = T.stack.groups.get(this.group.current), i = s == null ? void 0 : s.find((c) => c.opened);
152
+ const s = T.stack.groups.get(this.group.current), i = s == null ? void 0 : s.find((l) => l.opened);
153
153
  document.documentElement.classList.toggle(
154
154
  `${this.group.current}-opened`,
155
155
  !!i
@@ -173,19 +173,19 @@ const T = class T extends HTMLElement {
173
173
  return t(this, A);
174
174
  }
175
175
  get closeRest() {
176
- return t(this, R);
176
+ return t(this, $);
177
177
  }
178
178
  get closeRestInGroup() {
179
- return t(this, $);
179
+ return t(this, V);
180
180
  }
181
181
  get group() {
182
182
  return t(this, b);
183
183
  }
184
184
  get clickOutside() {
185
- return t(this, V);
185
+ return t(this, O);
186
186
  }
187
187
  get escape() {
188
- return t(this, O);
188
+ return t(this, q);
189
189
  }
190
190
  get opened() {
191
191
  return t(this, m);
@@ -197,43 +197,43 @@ const T = class T extends HTMLElement {
197
197
  return `${this.id}${this.urlValue ? "=" + this.urlValue : ""}`;
198
198
  }
199
199
  updateUrlValue(e) {
200
- this.urlValue = (e == null ? void 0 : e.toString()) || "", t(this, m) && pt(this.id, e);
200
+ this.urlValue = (e == null ? void 0 : e.toString()) || "", t(this, m) && dt(this.id, e);
201
201
  }
202
202
  open(e) {
203
203
  if (t(this, m))
204
204
  return;
205
- o(this, z, e == null ? void 0 : e.trigger), clearTimeout(t(this, H)), clearTimeout(t(this, W)), p(this, u, L).call(this, !1, this.closingClass), t(this, a).set("closing", !1), t(this, a).set("triggered", !0), q(this, "popoverTriggered", {
205
+ o(this, z, e == null ? void 0 : e.trigger), clearTimeout(t(this, H)), clearTimeout(t(this, G)), d(this, p, L).call(this, !1, this.closingClass), t(this, u).set("closing", !1), t(this, u).set("triggered", !0), W(this, "popoverTriggered", {
206
206
  custom: !0,
207
207
  detail: {
208
208
  trigger: t(this, z)
209
209
  }
210
- }), t(this, v).current && t(this, y) && history.pushState(history.state, "", t(this, u, ct)), t(this, a).set("beforeopen", !0), o(this, m, !0);
210
+ }), t(this, v).current && t(this, y) && history.pushState(history.state, "", t(this, p, ct)), t(this, u).set("beforeopen", !0), o(this, m, !0);
211
211
  const s = () => {
212
- T.stack.add(t(this, b).current, this), t(this, B).forEach((i) => {
212
+ T.stack.add(t(this, b).current, this), t(this, F).forEach((i) => {
213
213
  i.scroll({
214
214
  top: 0,
215
215
  left: 0,
216
216
  behavior: "instant"
217
217
  });
218
- }), p(this, u, L).call(this, !0, this.openClass), t(this, a).set("opened", !0), t(this, A).current ? q(window, "resize", { custom: !0 }) : t(this, P).call(this), q(this, "popoverOpened", {
218
+ }), d(this, p, L).call(this, !0, this.openClass), t(this, u).set("opened", !0), t(this, A).current ? W(window, "resize", { custom: !0 }) : t(this, P).call(this), W(this, "popoverOpened", {
219
219
  custom: !0,
220
220
  detail: {
221
221
  trigger: t(this, z)
222
222
  },
223
223
  bubbles: !0
224
- }), o(this, S, void 0), o(this, G, setTimeout(() => {
225
- t(this, a).set("transitionend", !0), q(this, "popoverTransitionend");
224
+ }), o(this, R, void 0), o(this, B, setTimeout(() => {
225
+ t(this, u).set("transitionend", !0), W(this, "popoverTransitionend");
226
226
  }, nt(this) + 10));
227
227
  };
228
- e != null && e.skipTransition ? s() : o(this, S, requestAnimationFrame(s));
228
+ e != null && e.skipTransition ? s() : o(this, R, requestAnimationFrame(s));
229
229
  }
230
230
  close() {
231
- t(this, m) && (o(this, m, !1), cancelAnimationFrame(t(this, S)), clearTimeout(t(this, G)), T.stack.remove(t(this, b).current, this), p(this, u, Z).call(this), o(this, H, setTimeout(() => {
232
- t(this, a).set("transitionend", !1), t(this, a).set("opened", !1), t(this, a).set("closing", !0), p(this, u, L).call(this, !1, this.openClass), p(this, u, L).call(this, !0, this.closingClass), q(this, "popoverClosing", {
231
+ t(this, m) && (o(this, m, !1), cancelAnimationFrame(t(this, R)), clearTimeout(t(this, B)), T.stack.remove(t(this, b).current, this), d(this, p, N).call(this), o(this, H, setTimeout(() => {
232
+ t(this, u).set("transitionend", !1), t(this, u).set("opened", !1), t(this, u).set("closing", !0), d(this, p, L).call(this, !1, this.openClass), d(this, p, L).call(this, !0, this.closingClass), W(this, "popoverClosing", {
233
233
  custom: !0,
234
234
  bubbles: !0
235
- }), o(this, W, setTimeout(() => {
236
- t(this, a).set("triggered", !1), t(this, a).set("beforeopen", !1), t(this, a).set("closing", !1), p(this, u, L).call(this, !1, this.closingClass), q(this, "popoverClosed", {
235
+ }), o(this, G, setTimeout(() => {
236
+ t(this, u).set("triggered", !1), t(this, u).set("beforeopen", !1), t(this, u).set("closing", !1), d(this, p, L).call(this, !1, this.closingClass), W(this, "popoverClosed", {
237
237
  custom: !0,
238
238
  bubbles: !0
239
239
  });
@@ -246,57 +246,57 @@ const T = class T extends HTMLElement {
246
246
  `[data-popover-close${this.id ? `="${this.id}"` : ""}]`
247
247
  )
248
248
  ]), t(this, M).forEach((e) => {
249
- e.addEventListener("click", t(this, D));
250
- }), o(this, B, [
249
+ e.addEventListener("click", t(this, U));
250
+ }), o(this, F, [
251
251
  ...this.querySelectorAll(
252
252
  `[data-popover-reset-scroll${this.id ? `="${this.id}"` : ""}]`
253
253
  )
254
- ]), t(this, v).observe(), t(this, k).observe(), t(this, A).observe(), t(this, R).observe(), t(this, $).observe(), t(this, b).observe(), t(this, V).observe(), t(this, O).observe(), t(this, C).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", t(this, F)), setTimeout(() => {
255
- t(this, k).current ? (o(this, y, !1), this.urlValue = dt(location.search)[this.id], location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), o(this, y, !0)) : (p(this, u, Z).call(this), o(this, y, !0));
254
+ ]), t(this, v).observe(), t(this, k).observe(), t(this, A).observe(), t(this, $).observe(), t(this, V).observe(), t(this, b).observe(), t(this, O).observe(), t(this, q).observe(), t(this, C).observe(), this.setAttribute("role", "dialog"), addEventListener("popstate", t(this, D)), setTimeout(() => {
255
+ t(this, k).current ? (o(this, y, !1), this.urlValue = ft(location.search)[this.id], location.search.includes(this.id) && this.open({ trigger: this.idWithValue }), o(this, y, !0)) : (d(this, p, N).call(this), o(this, y, !0));
256
256
  }, 0), t(this, C).subscribe(() => {
257
257
  t(this, P).call(this);
258
258
  }), lt.subscribe(t(this, P));
259
259
  }
260
260
  disconnectedCallback() {
261
261
  t(this, M).forEach((e) => {
262
- e.removeEventListener("click", t(this, D));
263
- }), T.stack.remove(t(this, b).current, this), lt.unsubscribe(t(this, P)), t(this, v).close(), t(this, k).close(), t(this, A).close(), t(this, R).close(), t(this, $).close(), t(this, b).close(), t(this, V).close(), t(this, O).close(), t(this, C).close(), this.removeAttribute("role"), p(this, u, L).call(this, !1, this.openClass), p(this, u, L).call(this, !1, this.closingClass), clearTimeout(t(this, H)), clearTimeout(t(this, W)), clearTimeout(t(this, S)), clearTimeout(t(this, G)), removeEventListener("popstate", t(this, F)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), this.style.removeProperty("--viewport-offset-x"), this.style.removeProperty("--viewport-offset-y"), p(this, u, Z).call(this);
262
+ e.removeEventListener("click", t(this, U));
263
+ }), T.stack.remove(t(this, b).current, this), lt.unsubscribe(t(this, P)), t(this, v).close(), t(this, k).close(), t(this, A).close(), t(this, $).close(), t(this, V).close(), t(this, b).close(), t(this, O).close(), t(this, q).close(), t(this, C).close(), this.removeAttribute("role"), d(this, p, L).call(this, !1, this.openClass), d(this, p, L).call(this, !1, this.closingClass), clearTimeout(t(this, H)), clearTimeout(t(this, G)), clearTimeout(t(this, R)), clearTimeout(t(this, B)), removeEventListener("popstate", t(this, D)), this.style.removeProperty("--content-width"), this.style.removeProperty("--content-height"), this.style.removeProperty("--viewport-offset-x"), this.style.removeProperty("--viewport-offset-y"), d(this, p, N).call(this);
264
264
  }
265
265
  };
266
- m = new WeakMap(), H = new WeakMap(), W = new WeakMap(), S = new WeakMap(), G = new WeakMap(), v = new WeakMap(), k = new WeakMap(), A = new WeakMap(), R = new WeakMap(), $ = new WeakMap(), b = new WeakMap(), V = new WeakMap(), O = new WeakMap(), C = new WeakMap(), y = new WeakMap(), z = new WeakMap(), a = new WeakMap(), M = new WeakMap(), B = new WeakMap(), u = new WeakSet(), ct = function() {
266
+ m = new WeakMap(), H = new WeakMap(), G = new WeakMap(), R = new WeakMap(), B = new WeakMap(), v = new WeakMap(), k = new WeakMap(), A = new WeakMap(), $ = new WeakMap(), V = new WeakMap(), b = new WeakMap(), O = new WeakMap(), q = new WeakMap(), C = new WeakMap(), y = new WeakMap(), z = new WeakMap(), u = new WeakMap(), M = new WeakMap(), F = new WeakMap(), p = new WeakSet(), ct = function() {
267
267
  return `${location.pathname}${location.search ? location.search + "&" : "?"}${this.idWithValue}`;
268
268
  }, L = function(e, s) {
269
269
  s && s.split(" ").map((i) => {
270
270
  document.documentElement.classList.toggle(i.trim(), e);
271
271
  });
272
- }, Z = function() {
272
+ }, N = function() {
273
273
  if (t(this, v).current) {
274
274
  const e = new URL(location.href);
275
275
  e.searchParams.delete(this.id), history.replaceState(history.state, "", e.href);
276
276
  }
277
- }, F = new WeakMap(), P = new WeakMap(), X = new WeakMap(), Y = new WeakMap(), D = new WeakMap(), T.stack = new ft();
278
- let N = T;
279
- rt && !customElements.get("e-popover") && customElements.define("e-popover", N);
280
- var n, g, x, st, j, I, J, K, it;
281
- class gt extends HTMLElement {
277
+ }, D = new WeakMap(), P = new WeakMap(), Y = new WeakMap(), j = new WeakMap(), U = new WeakMap(), T.stack = new gt();
278
+ let _ = T;
279
+ ot && !customElements.get("e-popover") && customElements.define("e-popover", _);
280
+ var n, g, S, it, I, J, K, Q, rt;
281
+ class mt extends HTMLElement {
282
282
  constructor() {
283
283
  super();
284
- r(this, x);
284
+ r(this, S);
285
285
  r(this, n);
286
286
  r(this, g, new E(this, "--type", "open"));
287
- r(this, j, (e) => {
287
+ r(this, I, (e) => {
288
288
  e.target === t(this, n) && t(this, g).current !== "close" && this.classList.add("triggered");
289
289
  });
290
- r(this, I, (e) => {
290
+ r(this, J, (e) => {
291
291
  e.target === t(this, n) && t(this, g).current !== "close" && (this.classList.add("opened"), this.setAttribute("aria-expanded", "true"));
292
292
  });
293
- r(this, J, (e) => {
293
+ r(this, K, (e) => {
294
294
  e.target === t(this, n) && t(this, g).current !== "close" && this.classList.remove("opened");
295
295
  });
296
- r(this, K, (e) => {
296
+ r(this, Q, (e) => {
297
297
  e.target === t(this, n) && t(this, g).current !== "close" && (this.classList.remove("triggered"), this.setAttribute("aria-expanded", "false"));
298
298
  });
299
- rt && (this.addEventListener("click", () => {
299
+ ot && (this.addEventListener("click", () => {
300
300
  if (t(this, n)) {
301
301
  const e = t(this, g).current;
302
302
  e === "open" || e === "toggle" && !t(this, n).opened ? t(this, n).open({ trigger: this }) : (e === "close" || e === "toggle" && t(this, n).opened) && t(this, n).close();
@@ -313,77 +313,84 @@ class gt extends HTMLElement {
313
313
  }
314
314
  changePopover(e) {
315
315
  var s;
316
- if (p(this, x, st).call(this), e) {
316
+ if (d(this, S, it).call(this), e) {
317
317
  let i = null;
318
318
  if (e === "parent") {
319
- const c = this.closest("[data-popover]");
320
- if (c)
321
- i = c;
319
+ const l = this.closest("[data-popover]");
320
+ if (l)
321
+ i = l;
322
322
  else {
323
- const f = this.getRootNode();
324
- f instanceof ShadowRoot ? i = f.host.closest("[data-popover]") : f instanceof HTMLElement && (i = f.closest("[data-popover]"));
323
+ const a = this.getRootNode();
324
+ a instanceof ShadowRoot ? i = a.host.closest("[data-popover]") : a instanceof HTMLElement && (i = a.closest("[data-popover]"));
325
325
  }
326
326
  } else if (e === "sibling")
327
327
  i = (s = this.parentElement) == null ? void 0 : s.querySelector("[data-popover]");
328
328
  else if (e === "ancestor-child") {
329
- const c = (f) => {
330
- if (!f)
329
+ const l = (a) => {
330
+ if (!a)
331
331
  return null;
332
- let U = f.querySelector("[data-popover]");
333
- return !U && (f != null && f.parentElement) && (U = c(f.parentElement)), U;
332
+ let x = a.querySelector("[data-popover]");
333
+ return !x && (a != null && a.parentElement) && (x = l(a.parentElement)), x;
334
334
  };
335
- i = c(this.parentElement) || null;
336
- } else
337
- !e.startsWith(".") && !e.startsWith("[") && (e = `#${e}`), i = document.querySelector(e) || this.getRootNode().querySelector(e);
335
+ i = l(this.parentElement) || null;
336
+ } else if (!e.startsWith(".") && !e.startsWith("[") && e.startsWith("#"), i = document.querySelector(e) || this.getRootNode().querySelector(e), !i) {
337
+ const a = [...document.querySelectorAll("[data-popover-ids]")].find(
338
+ (x) => {
339
+ var X;
340
+ return (X = x.getAttribute("data-popover-ids")) == null ? void 0 : X.split(",").find((at) => at.trim() === e);
341
+ }
342
+ );
343
+ a && (i = a);
344
+ }
338
345
  i instanceof HTMLElement ? (o(this, n, i), t(this, n).addEventListener(
339
346
  "popoverTriggered",
340
- t(this, j)
347
+ t(this, I)
341
348
  ), t(this, n).addEventListener(
342
349
  "popoverOpened",
343
- t(this, I)
350
+ t(this, J)
344
351
  ), t(this, n).addEventListener(
345
352
  "popoverClosing",
346
- t(this, J)
353
+ t(this, K)
347
354
  ), t(this, n).addEventListener(
348
355
  "popoverClosed",
349
- t(this, K)
356
+ t(this, Q)
350
357
  )) : console.warn(this, `target ${e} not found`);
351
358
  }
352
- p(this, x, it).call(this, t(this, g).current);
359
+ d(this, S, rt).call(this, t(this, g).current);
353
360
  }
354
361
  connectedCallback() {
355
362
  t(this, g).subscribe((s) => {
356
- p(this, x, it).call(this, s.current);
363
+ d(this, S, rt).call(this, s.current);
357
364
  }), this.hasAttribute("tabindex") || (this.tabIndex = 0), this.hasAttribute("role") || this.setAttribute("role", "button");
358
365
  const e = this.getAttribute("target");
359
366
  e && this.changePopover(e), this.isConnected && t(this, g).observe();
360
367
  }
361
368
  disconnectedCallback() {
362
- t(this, g).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), this.removeAttribute("role"), this.removeAttribute("tabindex"), p(this, x, st).call(this);
369
+ t(this, g).unobserve(), this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls"), this.removeAttribute("role"), this.removeAttribute("tabindex"), d(this, S, it).call(this);
363
370
  }
364
371
  }
365
- n = new WeakMap(), g = new WeakMap(), x = new WeakSet(), st = function() {
372
+ n = new WeakMap(), g = new WeakMap(), S = new WeakSet(), it = function() {
366
373
  t(this, n) && (t(this, n).removeEventListener(
367
374
  "popoverTriggered",
368
- t(this, j)
375
+ t(this, I)
369
376
  ), t(this, n).removeEventListener(
370
377
  "popoverOpened",
371
- t(this, I)
378
+ t(this, J)
372
379
  ), t(this, n).removeEventListener(
373
380
  "popoverClosing",
374
- t(this, J)
381
+ t(this, K)
375
382
  ), t(this, n).removeEventListener(
376
383
  "popoverClosed",
377
- t(this, K)
384
+ t(this, Q)
378
385
  ));
379
- }, j = new WeakMap(), I = new WeakMap(), J = new WeakMap(), K = new WeakMap(), it = function(e) {
380
- t(this, n) instanceof N && (e !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
386
+ }, I = new WeakMap(), J = new WeakMap(), K = new WeakMap(), Q = new WeakMap(), rt = function(e) {
387
+ t(this, n) instanceof _ && (e !== "close" ? (this.setAttribute("aria-haspopup", "true"), this.setAttribute(
381
388
  "aria-expanded",
382
389
  t(this, n).opened ? "true" : "false"
383
390
  ), this.setAttribute("aria-controls", t(this, n).id || "")) : (this.removeAttribute("aria-haspopup"), this.removeAttribute("aria-expanded"), this.removeAttribute("aria-controls")));
384
391
  };
385
- rt && !customElements.get("e-popover-button") && customElements.define("e-popover-button", gt);
392
+ ot && !customElements.get("e-popover-button") && customElements.define("e-popover-button", mt);
386
393
  export {
387
- gt as PopoverButtonElement,
388
- N as PopoverElement
394
+ mt as PopoverButtonElement,
395
+ _ as PopoverElement
389
396
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aptechka",
3
- "version": "0.76.4",
3
+ "version": "0.76.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/denisavitski/aptechka.git"