aptechka 0.84.5 → 0.85.0

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.
Files changed (50) hide show
  1. package/lib/{DerivedArray-BePrxcLC.js → DerivedArray-C1gHUvCT.js} +2 -2
  2. package/lib/{DerivedArray-xYBpcTp8.cjs → DerivedArray-CiMrwSDt.cjs} +1 -1
  3. package/lib/{DragControls-owFuNKoh.js → DragControls-BNaevZBQ.js} +2 -2
  4. package/lib/{LocalLinks-BdqYzt1b.js → LocalLinks-CI-vxMaR.js} +1 -1
  5. package/lib/{Tweened-DabaFaHX.js → Tweened-C1FsHjhN.js} +1 -1
  6. package/lib/animation/index.js +1 -1
  7. package/lib/controls/index.js +1 -1
  8. package/lib/{easings-BSGJFMAo.js → easings-DE1AUrbN.js} +14 -14
  9. package/lib/jsx/h.d.ts +0 -3
  10. package/lib/jsx/hooks/component/useShadow.d.ts +1 -1
  11. package/lib/jsx/index.cjs +1 -1
  12. package/lib/jsx/index.js +12 -9
  13. package/lib/jsx/render.d.ts +1 -1
  14. package/lib/{layout-C26zkY7D.js → layout-BL6AX9-r.js} +3 -3
  15. package/lib/layout-box/index.cjs +1 -1
  16. package/lib/layout-box/index.d.ts +2 -2
  17. package/lib/layout-box/index.js +11 -5
  18. package/lib/local-links/index.js +1 -1
  19. package/lib/morph/index.cjs +1 -1
  20. package/lib/morph/index.js +5 -2
  21. package/lib/{morph-BtgB1YQP.js → morph-BByLJAAh.js} +8 -8
  22. package/lib/need_redo_tweaker/TweakerFolderElement.d.ts +1 -1
  23. package/lib/need_redo_tweaker/index.cjs +2 -2
  24. package/lib/need_redo_tweaker/index.js +4 -8
  25. package/lib/promises-BsIKOEDq.js +13 -0
  26. package/lib/promises-nDm8_iG6.cjs +1 -0
  27. package/lib/{render-LpimRXgl.js → render-DHKcgkoZ.js} +22 -11
  28. package/lib/render-R8P4qkHo.cjs +1 -0
  29. package/lib/router/index.cjs +1 -1
  30. package/lib/router/index.js +2 -2
  31. package/lib/scroll/index.cjs +1 -1
  32. package/lib/scroll/index.js +5 -5
  33. package/lib/scroll-BtUpTUwr.cjs +1 -0
  34. package/lib/{scroll-DoNeuIgT.js → scroll-CHhF7Put.js} +10 -14
  35. package/lib/scroll-kit/index.cjs +1 -1
  36. package/lib/scroll-kit/index.js +23 -5
  37. package/lib/spa/index.js +2 -2
  38. package/lib/store/index.cjs +1 -1
  39. package/lib/store/index.js +1 -1
  40. package/lib/utils/color.d.ts +1 -0
  41. package/lib/utils/index.cjs +1 -1
  42. package/lib/utils/index.d.ts +4 -0
  43. package/lib/utils/index.js +142 -33
  44. package/lib/utils/lang.d.ts +6 -0
  45. package/lib/utils/loading.d.ts +1 -0
  46. package/lib/utils/progress.d.ts +2 -0
  47. package/lib/utils/scroll.d.ts +4 -2
  48. package/package.json +3 -3
  49. package/lib/render-H9BjFLZ3.cjs +0 -1
  50. package/lib/scroll-D2tOpCnP.cjs +0 -1
@@ -33,13 +33,13 @@ const _DerivedKeyedArray = class _DerivedKeyedArray extends Store {
33
33
  __privateAdd(this, _revalidateAll2);
34
34
  __privateSet(this, _revalidateAll2, !!(options != null && options.revalidateAll)), __privateSet(this, _unsubscriber2, store.subscribe((e) => {
35
35
  this.current = e.current.map((item, i, arr) => {
36
- var _a;
36
+ var _a, _b;
37
37
  if (!__privateGet(this, _revalidateAll2)) {
38
38
  const same = (_a = e.previous) == null ? void 0 : _a.find(
39
39
  (previous) => previous.key === item.key && JSON.stringify(previous) === JSON.stringify(item)
40
40
  );
41
41
  if (same) {
42
- const founded = this.current.find(
42
+ const founded = (_b = this.current) == null ? void 0 : _b.find(
43
43
  (current) => typeof current == "object" && current && "__key" in current && current.__key === same.key
44
44
  );
45
45
  if (founded)
@@ -1 +1 @@
1
- "use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value);const Store=require("./Store-DZnOrofs.cjs");var _unsubscriber,_revalidateAll;const _DerivedArray=class _DerivedArray extends Store.Store{constructor(store,callback,options){super(null,options);__privateAdd(this,_unsubscriber);__privateAdd(this,_revalidateAll);__privateSet(this,_revalidateAll,!!(options!=null&&options.revalidateAll)),__privateSet(this,_unsubscriber,store.subscribe(e=>{this.current=e.current.map((item,i,arr)=>{var _a,_b;return!__privateGet(this,_revalidateAll)&&((_a=this.current)!=null&&_a.length)&&((_b=e.previous)!=null&&_b.length)&&e.previous[i]===item?this.current[i]:callback(item,i,arr)})}))}close(){super.close(),__privateGet(this,_unsubscriber).call(this)}};_unsubscriber=new WeakMap,_revalidateAll=new WeakMap,__name(_DerivedArray,"DerivedArray");let DerivedArray=_DerivedArray;var _unsubscriber2,_revalidateAll2;const _DerivedKeyedArray=class _DerivedKeyedArray extends Store.Store{constructor(store,callback,options){super(null,options);__privateAdd(this,_unsubscriber2);__privateAdd(this,_revalidateAll2);__privateSet(this,_revalidateAll2,!!(options!=null&&options.revalidateAll)),__privateSet(this,_unsubscriber2,store.subscribe(e=>{this.current=e.current.map((item,i,arr)=>{var _a;if(!__privateGet(this,_revalidateAll2)){const same=(_a=e.previous)==null?void 0:_a.find(previous=>previous.key===item.key&&JSON.stringify(previous)===JSON.stringify(item));if(same){const founded=this.current.find(current=>typeof current=="object"&&current&&"__key"in current&&current.__key===same.key);if(founded)return founded}}const callbackResult=callback(item,i,arr);return callbackResult&&typeof callbackResult=="object"&&(callbackResult.__key=item.key),callbackResult})}))}close(){super.close(),__privateGet(this,_unsubscriber2).call(this)}};_unsubscriber2=new WeakMap,_revalidateAll2=new WeakMap,__name(_DerivedKeyedArray,"DerivedKeyedArray");let DerivedKeyedArray=_DerivedKeyedArray;exports.DerivedArray=DerivedArray;exports.DerivedKeyedArray=DerivedKeyedArray;
1
+ "use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value);const Store=require("./Store-DZnOrofs.cjs");var _unsubscriber,_revalidateAll;const _DerivedArray=class _DerivedArray extends Store.Store{constructor(store,callback,options){super(null,options);__privateAdd(this,_unsubscriber);__privateAdd(this,_revalidateAll);__privateSet(this,_revalidateAll,!!(options!=null&&options.revalidateAll)),__privateSet(this,_unsubscriber,store.subscribe(e=>{this.current=e.current.map((item,i,arr)=>{var _a,_b;return!__privateGet(this,_revalidateAll)&&((_a=this.current)!=null&&_a.length)&&((_b=e.previous)!=null&&_b.length)&&e.previous[i]===item?this.current[i]:callback(item,i,arr)})}))}close(){super.close(),__privateGet(this,_unsubscriber).call(this)}};_unsubscriber=new WeakMap,_revalidateAll=new WeakMap,__name(_DerivedArray,"DerivedArray");let DerivedArray=_DerivedArray;var _unsubscriber2,_revalidateAll2;const _DerivedKeyedArray=class _DerivedKeyedArray extends Store.Store{constructor(store,callback,options){super(null,options);__privateAdd(this,_unsubscriber2);__privateAdd(this,_revalidateAll2);__privateSet(this,_revalidateAll2,!!(options!=null&&options.revalidateAll)),__privateSet(this,_unsubscriber2,store.subscribe(e=>{this.current=e.current.map((item,i,arr)=>{var _a,_b;if(!__privateGet(this,_revalidateAll2)){const same=(_a=e.previous)==null?void 0:_a.find(previous=>previous.key===item.key&&JSON.stringify(previous)===JSON.stringify(item));if(same){const founded=(_b=this.current)==null?void 0:_b.find(current=>typeof current=="object"&&current&&"__key"in current&&current.__key===same.key);if(founded)return founded}}const callbackResult=callback(item,i,arr);return callbackResult&&typeof callbackResult=="object"&&(callbackResult.__key=item.key),callbackResult})}))}close(){super.close(),__privateGet(this,_unsubscriber2).call(this)}};_unsubscriber2=new WeakMap,_revalidateAll2=new WeakMap,__name(_DerivedKeyedArray,"DerivedKeyedArray");let DerivedKeyedArray=_DerivedKeyedArray;exports.DerivedArray=DerivedArray;exports.DerivedKeyedArray=DerivedKeyedArray;
@@ -9,8 +9,8 @@ import { i as isBrowser, a as intersector, t as ticker } from "./index-ClTMVKJp.
9
9
  import { g as getElement } from "./dom-D8D-_9ty.js";
10
10
  import "construct-style-sheets-polyfill";
11
11
  import "./Store-BRTHeZmO.js";
12
- import { a as easeInQuad } from "./easings-BSGJFMAo.js";
13
- import { T as Tweened } from "./Tweened-DabaFaHX.js";
12
+ import { a as easeInQuad } from "./easings-DE1AUrbN.js";
13
+ import { T as Tweened } from "./Tweened-C1FsHjhN.js";
14
14
  import { s as setupDrag } from "./gestures-DmKKNnh4.js";
15
15
  import { p as preciseNumber } from "./number-DiVt2xnh.js";
16
16
  import { TICK_ORDER } from "./order/index.js";
@@ -5,7 +5,7 @@ var __typeError = (msg) => {
5
5
  var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
6
6
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
7
7
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value), __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value), __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
8
- import { N as NODE_TYPE_ELEMENT } from "./morph-BtgB1YQP.js";
8
+ import { N as NODE_TYPE_ELEMENT } from "./morph-BByLJAAh.js";
9
9
  import "construct-style-sheets-polyfill";
10
10
  import "./index-ClTMVKJp.js";
11
11
  import { n as normalizeURL, i as isLocalUrl } from "./url-CWCY_qe_.js";
@@ -15,7 +15,7 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
15
15
  }, __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b)), __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
16
16
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
17
17
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value), __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
18
- import { l as linear, e as easings } from "./easings-BSGJFMAo.js";
18
+ import { l as linear, e as easings } from "./easings-DE1AUrbN.js";
19
19
  import { c as clamp } from "./math-r8V23YFe.js";
20
20
  import { p as preciseNumber } from "./number-DiVt2xnh.js";
21
21
  import { n as nullishCoalescing } from "./polyfills-CG1XJNia.js";
@@ -1,6 +1,6 @@
1
1
  import { A } from "../Animation-BUD5w3AB.js";
2
2
  import { D } from "../Damped-Ds17AUU-.js";
3
- import { T } from "../Tweened-DabaFaHX.js";
3
+ import { T } from "../Tweened-C1FsHjhN.js";
4
4
  export {
5
5
  A as Animation,
6
6
  D as Damped,
@@ -1,4 +1,4 @@
1
- import { A, C, D, K, W } from "../DragControls-owFuNKoh.js";
1
+ import { A, C, D, K, W } from "../DragControls-BNaevZBQ.js";
2
2
  export {
3
3
  A as AutoplayControls,
4
4
  C as Controls,
@@ -21,20 +21,20 @@ const linear = /* @__PURE__ */ __name((t) => t, "linear"), easeInQuad = /* @__PU
21
21
  }, Symbol.toStringTag, { value: "Module" }));
22
22
  export {
23
23
  easeInQuad as a,
24
- easeOutQuad as b,
25
- easeInOutQuad as c,
26
- easeInCubic as d,
24
+ easeInOutExpo as b,
25
+ easeOutQuad as c,
26
+ easeInOutQuad as d,
27
27
  easings as e,
28
- easeOutCubic as f,
29
- easeInOutCubic as g,
30
- easeInQuart as h,
31
- easeOutQuart as i,
32
- easeInOutQuart as j,
33
- easeInQuint as k,
28
+ easeInCubic as f,
29
+ easeOutCubic as g,
30
+ easeInOutCubic as h,
31
+ easeInQuart as i,
32
+ easeOutQuart as j,
33
+ easeInOutQuart as k,
34
34
  linear as l,
35
- easeOutQuint as m,
36
- easeInOutQuint as n,
37
- easeInExpo as o,
38
- easeOutExpo as p,
39
- easeInOutExpo as q
35
+ easeInQuint as m,
36
+ easeOutQuint as n,
37
+ easeInOutQuint as o,
38
+ easeInExpo as p,
39
+ easeOutExpo as q
40
40
  };
package/lib/jsx/h.d.ts CHANGED
@@ -1,9 +1,6 @@
1
1
  export declare const isHydrating: {
2
2
  value: boolean;
3
3
  };
4
- export declare const isDefining: {
5
- value: boolean;
6
- };
7
4
  export declare const indexMap: Map<string, number>;
8
5
  export declare function h(jsxTag: string | Function, attributes?: JSX.Attributes, ...children: JSX.Children): any;
9
6
  export declare function Fragment(children: JSX.Children): DocumentFragment;
@@ -1,2 +1,2 @@
1
1
  export type UseShadowCallback = (shadowRoot: ShadowRoot) => void;
2
- export declare function useShadow(init?: Partial<ShadowRootInit>, callback?: UseShadowCallback): ShadowRoot;
2
+ export declare function useShadow(init?: Partial<ShadowRootInit>, callback?: UseShadowCallback): ShadowRoot | null;
package/lib/jsx/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const render=require("../render-H9BjFLZ3.cjs"),cssProperty_index=require("../css-property/index.cjs"),string=require("../string-CbRNzmd9.cjs");require("construct-style-sheets-polyfill");const intersector_index=require("../index-DZ44osDT.cjs"),Store=require("../Store-DZnOrofs.cjs"),Composed=require("../Composed-BI5oe4Ij.cjs"),DerivedArray=require("../DerivedArray-xYBpcTp8.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),windowResizer_index=require("../window-resizer/index.cjs");function useRef(){return{value:null}}__name(useRef,"useRef");function useConnect(callback){render.activeComponent.current.addConnectCallback(callback)}__name(useConnect,"useConnect");function useDisconnect(callback){render.activeComponent.current.addDisconnectCallback(callback)}__name(useDisconnect,"useDisconnect");function useCSSProperty(property,defaultValue,options){if(render.activeComponent.current){const cssProperty=new cssProperty_index.CSSProperty(render.activeComponent.current,property,defaultValue,options);return useConnect(()=>(options!=null&&options.callback&&cssProperty.subscribe(options.callback),cssProperty.observe(),()=>{cssProperty.close()})),cssProperty}}__name(useCSSProperty,"useCSSProperty");function useInternals(callback){const internals=render.activeComponent.current.attachInternals();return callback==null||callback(internals),internals}__name(useInternals,"useInternals");function useShadow(init,callback){const shadowRoot=render.activeComponent.current.attachShadow(__spreadValues({mode:"open"},init));return callback==null||callback(shadowRoot),shadowRoot}__name(useShadow,"useShadow");function createStylesheet(cssText){const styleSheet=new CSSStyleSheet;return styleSheet.replaceSync(cssText),styleSheet}__name(createStylesheet,"createStylesheet");function generateCSS(source){let cssText="";const processObject=__name((obj,selector)=>{selector&&(cssText+=`${selector} {`);for(const[key,value]of Object.entries(obj))typeof value=="object"&&value!==null?processObject(value,key):cssText+=`${string.camelToKebab(key)}: ${value};`;selector&&(cssText+="}")},"processObject");return processObject(source),cssText}__name(generateCSS,"generateCSS");function addStylesToShadowRoot(shadowRoot,cssText){const newStylesheet=createStylesheet(cssText),destroyCallbacks=[];for(const currentStylesheet of shadowRoot.adoptedStyleSheets)Array.from(newStylesheet.cssRules).filter(newRule=>!Array.from(currentStylesheet.cssRules).some(currentRule=>currentRule.cssText===newRule.cssText)).forEach(newRule=>{const index=currentStylesheet.insertRule(newRule.cssText);destroyCallbacks.push(()=>currentStylesheet.deleteRule(index))});return()=>destroyCallbacks.forEach(callback=>callback())}__name(addStylesToShadowRoot,"addStylesToShadowRoot");function addStylesToDocument(cssText){const styleElement=document.createElement("style");return styleElement.textContent=cssText,document.head.appendChild(styleElement),()=>styleElement.remove()}__name(addStylesToDocument,"addStylesToDocument");function useStylesheet(source){const cssText=generateCSS(source);if(render.activeComponent.current.shadowRoot){render.activeComponent.current.shadowRoot.adoptedStyleSheets=[...render.activeComponent.current.shadowRoot.adoptedStyleSheets,createStylesheet(cssText)];return}useConnect(element=>{const rootNode=element.getRootNode();if(rootNode===document){if(!Array.from(document.head.querySelectorAll("style")).find(style=>style.textContent===cssText))return addStylesToDocument(cssText)}else if(rootNode instanceof ShadowRoot)return addStylesToShadowRoot(rootNode,cssText)})}__name(useStylesheet,"useStylesheet");function subscribe(create){const store=create();return render.activeComponent.current&&render.activeComponent.current.addDisconnectCallback(()=>{store.close()}),store}__name(subscribe,"subscribe");function useStore(...parameters){return subscribe(()=>new Store.Store(...parameters))}__name(useStore,"useStore");function useDerivedStore(...parameters){return subscribe(()=>new Composed.Derived(...parameters))}__name(useDerivedStore,"useDerivedStore");function useDerivedArrayStore(...parameters){return subscribe(()=>new DerivedArray.DerivedArray(...parameters))}__name(useDerivedArrayStore,"useDerivedArrayStore");function useDerivedKeyedArrayStore(...parameters){return subscribe(()=>new DerivedArray.DerivedKeyedArray(...parameters))}__name(useDerivedKeyedArrayStore,"useDerivedKeyedArrayStore");function useResourceStore(...parameters){return subscribe(()=>new Composed.Resource(...parameters))}__name(useResourceStore,"useResourceStore");function useComposedStore(...parameters){return subscribe(()=>new Composed.Composed(...parameters))}__name(useComposedStore,"useComposedStore");function useWindowResize(...parameters){render.activeComponent.current?useConnect(()=>windowResizer_index.windowResizer.subscribe(...parameters)):windowResizer_index.windowResizer.subscribe(...parameters)}__name(useWindowResize,"useWindowResize");function useElementResize(callback){useConnect(element=>elementResizer_index.elementResizer.subscribe(element,callback))}__name(useElementResize,"useElementResize");function useTicker(callback,options){if(render.activeComponent.current)useConnect(()=>intersector_index.ticker.subscribe(callback,__spreadProps(__spreadValues({},options),{culling:options!=null&&options.componentCulling?render.activeComponent.current:options==null?void 0:options.culling})));else return intersector_index.ticker.subscribe(callback,options)}__name(useTicker,"useTicker");exports.Fragment=render.Fragment;exports.h=render.h;exports.hydrate=render.hydrate;exports.indexMap=render.indexMap;exports.render=render.render;exports.useCSSProperty=useCSSProperty;exports.useComposedStore=useComposedStore;exports.useConnect=useConnect;exports.useDerivedArrayStore=useDerivedArrayStore;exports.useDerivedKeyedArrayStore=useDerivedKeyedArrayStore;exports.useDerivedStore=useDerivedStore;exports.useDisconnect=useDisconnect;exports.useElementResize=useElementResize;exports.useInternals=useInternals;exports.useRef=useRef;exports.useResourceStore=useResourceStore;exports.useShadow=useShadow;exports.useStore=useStore;exports.useStylesheet=useStylesheet;exports.useTicker=useTicker;exports.useWindowResize=useWindowResize;
1
+ "use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const render=require("../render-R8P4qkHo.cjs"),cssProperty_index=require("../css-property/index.cjs"),string=require("../string-CbRNzmd9.cjs");require("construct-style-sheets-polyfill");const intersector_index=require("../index-DZ44osDT.cjs"),Store=require("../Store-DZnOrofs.cjs"),Composed=require("../Composed-BI5oe4Ij.cjs"),DerivedArray=require("../DerivedArray-CiMrwSDt.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),windowResizer_index=require("../window-resizer/index.cjs");function useRef(){return{value:null}}__name(useRef,"useRef");function useConnect(callback){render.activeComponent.current.addConnectCallback(callback)}__name(useConnect,"useConnect");function useDisconnect(callback){render.activeComponent.current.addDisconnectCallback(callback)}__name(useDisconnect,"useDisconnect");function useCSSProperty(property,defaultValue,options){if(render.activeComponent.current){const cssProperty=new cssProperty_index.CSSProperty(render.activeComponent.current,property,defaultValue,options);return useConnect(()=>(options!=null&&options.callback&&cssProperty.subscribe(options.callback),cssProperty.observe(),()=>{cssProperty.close()})),cssProperty}}__name(useCSSProperty,"useCSSProperty");function useInternals(callback){const internals=render.activeComponent.current.attachInternals();return callback==null||callback(internals),internals}__name(useInternals,"useInternals");function useShadow(init,callback){if(!render.activeComponent.current.shadowRoot){const shadowRoot=render.activeComponent.current.attachShadow(__spreadValues({mode:"open"},init));callback==null||callback(shadowRoot)}return render.activeComponent.current.shadowRoot}__name(useShadow,"useShadow");function createStylesheet(cssText){const styleSheet=new CSSStyleSheet;return styleSheet.replaceSync(cssText),styleSheet}__name(createStylesheet,"createStylesheet");function generateCSS(source){let cssText="";const processObject=__name((obj,selector)=>{selector&&(cssText+=`${selector} {`);for(const[key,value]of Object.entries(obj))typeof value=="object"&&value!==null?processObject(value,key):cssText+=`${string.camelToKebab(key)}: ${value};`;selector&&(cssText+="}")},"processObject");return processObject(source),cssText}__name(generateCSS,"generateCSS");function addStylesToShadowRoot(shadowRoot,cssText){const newStylesheet=createStylesheet(cssText),destroyCallbacks=[];for(const currentStylesheet of shadowRoot.adoptedStyleSheets)Array.from(newStylesheet.cssRules).filter(newRule=>!Array.from(currentStylesheet.cssRules).some(currentRule=>currentRule.cssText===newRule.cssText)).forEach(newRule=>{const index=currentStylesheet.insertRule(newRule.cssText);destroyCallbacks.push(()=>currentStylesheet.deleteRule(index))});return()=>destroyCallbacks.forEach(callback=>callback())}__name(addStylesToShadowRoot,"addStylesToShadowRoot");function addStylesToDocument(cssText){const styleElement=document.createElement("style");return styleElement.textContent=cssText,document.head.appendChild(styleElement),()=>styleElement.remove()}__name(addStylesToDocument,"addStylesToDocument");function useStylesheet(source){const cssText=generateCSS(source);if(render.activeComponent.current.shadowRoot){render.activeComponent.current.shadowRoot.adoptedStyleSheets=[...render.activeComponent.current.shadowRoot.adoptedStyleSheets,createStylesheet(cssText)];return}useConnect(element=>{const rootNode=element.getRootNode();if(rootNode===document){if(!Array.from(document.head.querySelectorAll("style")).find(style=>style.textContent===cssText))return addStylesToDocument(cssText)}else if(rootNode instanceof ShadowRoot)return addStylesToShadowRoot(rootNode,cssText)})}__name(useStylesheet,"useStylesheet");function subscribe(create){const store=create();return console.log("subscribe",render.activeComponent.current),render.activeComponent.current&&render.activeComponent.current.addDisconnectCallback(()=>{store.close(),console.log(store.name,"close")}),store}__name(subscribe,"subscribe");function useStore(...parameters){return subscribe(()=>new Store.Store(...parameters))}__name(useStore,"useStore");function useDerivedStore(...parameters){return subscribe(()=>new Composed.Derived(...parameters))}__name(useDerivedStore,"useDerivedStore");function useDerivedArrayStore(...parameters){return subscribe(()=>new DerivedArray.DerivedArray(...parameters))}__name(useDerivedArrayStore,"useDerivedArrayStore");function useDerivedKeyedArrayStore(...parameters){return subscribe(()=>new DerivedArray.DerivedKeyedArray(...parameters))}__name(useDerivedKeyedArrayStore,"useDerivedKeyedArrayStore");function useResourceStore(...parameters){return subscribe(()=>new Composed.Resource(...parameters))}__name(useResourceStore,"useResourceStore");function useComposedStore(...parameters){return subscribe(()=>new Composed.Composed(...parameters))}__name(useComposedStore,"useComposedStore");function useWindowResize(...parameters){render.activeComponent.current?useConnect(()=>windowResizer_index.windowResizer.subscribe(...parameters)):windowResizer_index.windowResizer.subscribe(...parameters)}__name(useWindowResize,"useWindowResize");function useElementResize(callback){useConnect(element=>elementResizer_index.elementResizer.subscribe(element,callback))}__name(useElementResize,"useElementResize");function useTicker(callback,options){if(render.activeComponent.current)useConnect(()=>intersector_index.ticker.subscribe(callback,__spreadProps(__spreadValues({},options),{culling:options!=null&&options.componentCulling?render.activeComponent.current:options==null?void 0:options.culling})));else return intersector_index.ticker.subscribe(callback,options)}__name(useTicker,"useTicker");exports.Fragment=render.Fragment;exports.h=render.h;exports.hydrate=render.hydrate;exports.indexMap=render.indexMap;exports.render=render.render;exports.useCSSProperty=useCSSProperty;exports.useComposedStore=useComposedStore;exports.useConnect=useConnect;exports.useDerivedArrayStore=useDerivedArrayStore;exports.useDerivedKeyedArrayStore=useDerivedKeyedArrayStore;exports.useDerivedStore=useDerivedStore;exports.useDisconnect=useDisconnect;exports.useElementResize=useElementResize;exports.useInternals=useInternals;exports.useRef=useRef;exports.useResourceStore=useResourceStore;exports.useShadow=useShadow;exports.useStore=useStore;exports.useStylesheet=useStylesheet;exports.useTicker=useTicker;exports.useWindowResize=useWindowResize;
package/lib/jsx/index.js CHANGED
@@ -10,15 +10,15 @@ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { en
10
10
  __propIsEnum.call(b2, prop) && __defNormalProp(a, prop, b2[prop]);
11
11
  return a;
12
12
  }, __spreadProps = (a, b2) => __defProps(a, __getOwnPropDescs(b2)), __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
13
- import { a as activeComponent } from "../render-LpimRXgl.js";
14
- import { F, h, b, i, r } from "../render-LpimRXgl.js";
13
+ import { a as activeComponent } from "../render-DHKcgkoZ.js";
14
+ import { F, h, b, i, r } from "../render-DHKcgkoZ.js";
15
15
  import { CSSProperty } from "../css-property/index.js";
16
16
  import { c as camelToKebab } from "../string-B3lm2b7v.js";
17
17
  import "construct-style-sheets-polyfill";
18
18
  import { t as ticker } from "../index-ClTMVKJp.js";
19
19
  import { S as Store } from "../Store-BRTHeZmO.js";
20
20
  import { D as Derived, R as Resource, C as Composed } from "../Composed-BaevH-MP.js";
21
- import { D as DerivedArray, a as DerivedKeyedArray } from "../DerivedArray-BePrxcLC.js";
21
+ import { D as DerivedArray, a as DerivedKeyedArray } from "../DerivedArray-C1gHUvCT.js";
22
22
  import { elementResizer } from "../element-resizer/index.js";
23
23
  import { windowResizer } from "../window-resizer/index.js";
24
24
  function useRef() {
@@ -53,10 +53,13 @@ function useInternals(callback) {
53
53
  }
54
54
  __name(useInternals, "useInternals");
55
55
  function useShadow(init, callback) {
56
- const shadowRoot = activeComponent.current.attachShadow(__spreadValues({
57
- mode: "open"
58
- }, init));
59
- return callback == null || callback(shadowRoot), shadowRoot;
56
+ if (!activeComponent.current.shadowRoot) {
57
+ const shadowRoot = activeComponent.current.attachShadow(__spreadValues({
58
+ mode: "open"
59
+ }, init));
60
+ callback == null || callback(shadowRoot);
61
+ }
62
+ return activeComponent.current.shadowRoot;
60
63
  }
61
64
  __name(useShadow, "useShadow");
62
65
  function createStylesheet(cssText) {
@@ -115,8 +118,8 @@ function useStylesheet(source) {
115
118
  __name(useStylesheet, "useStylesheet");
116
119
  function subscribe(create) {
117
120
  const store = create();
118
- return activeComponent.current && activeComponent.current.addDisconnectCallback(() => {
119
- store.close();
121
+ return console.log("subscribe", activeComponent.current), activeComponent.current && activeComponent.current.addDisconnectCallback(() => {
122
+ store.close(), console.log(store.name, "close");
120
123
  }), store;
121
124
  }
122
125
  __name(subscribe, "subscribe");
@@ -1,3 +1,3 @@
1
1
  export declare function render(container: ParentNode, Component: JSX.Component, params?: object, children?: any): any;
2
2
  export declare function hydrate(Component: JSX.Component, params?: object, children?: any): any;
3
- export declare function define(Component: JSX.Component): any;
3
+ export declare function define(Component: JSX.Component<any>): any;
@@ -28,8 +28,8 @@ function getStickyOffset(el, type) {
28
28
  }
29
29
  __name(getStickyOffset, "getStickyOffset");
30
30
  export {
31
- getCumulativeOffsetTop as a,
32
- getStickyOffset as b,
31
+ getCumulativeOffsetLeft as a,
32
+ getCumulativeOffsetTop as b,
33
33
  getCumulativePosition as c,
34
- getCumulativeOffsetLeft as g
34
+ getStickyOffset as g
35
35
  };
@@ -1 +1 @@
1
- "use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const cssUnitParser_index=require("../css-unit-parser/index.cjs"),ladder_index=require("../ladder/index.cjs"),order_index=require("../order/index.cjs"),scrollEntries_index=require("../scroll-entries/index.cjs"),intersector_index=require("../index-DZ44osDT.cjs"),dom=require("../dom-B40i6NXw.cjs"),layout=require("../layout-CnGLl7oe.cjs");require("construct-style-sheets-polyfill");const elementResizer_index=require("../element-resizer/index.cjs"),windowResizer_index=require("../window-resizer/index.cjs"),notifier_index=require("../notifier/index.cjs");function decomposeCSSMatrix(matrix){const scaleX=Math.sqrt(matrix.m11*matrix.m11+matrix.m12*matrix.m12+matrix.m13*matrix.m13),scaleY=Math.sqrt(matrix.m21*matrix.m21+matrix.m22*matrix.m22+matrix.m23*matrix.m23),scaleZ=Math.sqrt(matrix.m31*matrix.m31+matrix.m32*matrix.m32+matrix.m33*matrix.m33),rotationX=Math.atan2(matrix.m32,matrix.m33),rotationY=Math.atan2(-matrix.m31,Math.sqrt(matrix.m32*matrix.m32+matrix.m33*matrix.m33)),rotationZ=Math.atan2(matrix.m21,matrix.m11),translationX=matrix.m41,translationY=matrix.m42*-1,translationZ=matrix.m43;return{scaleX,scaleY,scaleZ,rotationX,rotationY,rotationZ,translationX,translationY,translationZ}}__name(decomposeCSSMatrix,"decomposeCSSMatrix");var _element,_containerElement,_scrollStepSetterCallbacks,_scrollAxis,_frontSide,_isCartesian,_isSizeStep,_isPositionStep,_isTransformStep,_isScrollStep,_width,_height,_depth,_top,_left,_front,_x,_y,_z,_CSSTranslation,_CSSRotation,_CSSScale,_rotation,_position,_scale,_scrollValue,_scrollEntries,_resizeNotifier,_LayoutBox_instances,recalculate_fn,composeSteps_fn,updateDimensions_fn,updateScrollPosition_fn,_resizeListener,_tickListener,_scrollEntriesListener;const _LayoutBox=class _LayoutBox{constructor(element,options){__privateAdd(this,_LayoutBox_instances);__privateAdd(this,_element,null);__privateAdd(this,_containerElement,null);__privateAdd(this,_scrollStepSetterCallbacks,[]);__privateAdd(this,_scrollAxis,"auto");__privateAdd(this,_frontSide,"top");__privateAdd(this,_isCartesian,!1);__privateAdd(this,_isSizeStep,!0);__privateAdd(this,_isPositionStep,!0);__privateAdd(this,_isTransformStep,!0);__privateAdd(this,_isScrollStep,!0);__privateAdd(this,_width,0);__privateAdd(this,_height,0);__privateAdd(this,_depth,0);__privateAdd(this,_top,0);__privateAdd(this,_left,0);__privateAdd(this,_front,0);__privateAdd(this,_x,0);__privateAdd(this,_y,0);__privateAdd(this,_z,0);__privateAdd(this,_CSSTranslation,{x:0,y:0,z:0});__privateAdd(this,_CSSRotation,{x:0,y:0,z:0});__privateAdd(this,_CSSScale,{x:1,y:1,z:1});__privateAdd(this,_rotation,new ladder_index.Ladder({x:0,y:0,z:0}));__privateAdd(this,_position,new ladder_index.Ladder({x:0,y:0,z:0}));__privateAdd(this,_scale,new ladder_index.Ladder({x:0,y:0,z:0}));__privateAdd(this,_scrollValue,{x:0,y:0,z:0});__privateAdd(this,_scrollEntries,new Map);__privateAdd(this,_resizeNotifier,new notifier_index.Notifier);__privateAdd(this,_resizeListener,__name(()=>{intersector_index.isBrowser&&__privateMethod(this,_LayoutBox_instances,updateDimensions_fn).call(this)},"#resizeListener"));__privateAdd(this,_tickListener,__name(()=>{__privateMethod(this,_LayoutBox_instances,updateScrollPosition_fn).call(this),__privateMethod(this,_LayoutBox_instances,recalculate_fn).call(this)},"#tickListener"));__privateAdd(this,_scrollEntriesListener,__name(()=>{const allEntries=scrollEntries_index.scrollEntries.getAll(this.element);__privateGet(this,_scrollEntries).forEach((value,key)=>{allEntries.includes(key)||(this.deleteScrollStep(value),__privateGet(this,_scrollEntries).delete(key))}),allEntries.forEach(entry=>{if(!__privateGet(this,_scrollEntries).has(entry)){const callback=__name(()=>entry,"callback");__privateGet(this,_scrollEntries).set(entry,callback),this.setScrollStep(callback)}})},"#scrollEntriesListener"));intersector_index.isBrowser&&(__privateSet(this,_element,dom.getElement(element)||document.body),__privateSet(this,_containerElement,dom.getElement(options==null?void 0:options.containerElement)||document.body),__privateSet(this,_scrollAxis,(options==null?void 0:options.scrollAxis)||"auto"),__privateSet(this,_frontSide,(options==null?void 0:options.frontSide)||"top"),__privateSet(this,_isCartesian,(options==null?void 0:options.cartesian)||!1),__privateSet(this,_isSizeStep,(options==null?void 0:options.sizeStep)!==void 0?options.sizeStep:!0),__privateSet(this,_isPositionStep,(options==null?void 0:options.positionStep)!==void 0?options.positionStep:!0),__privateSet(this,_isTransformStep,(options==null?void 0:options.transformStep)!==void 0?options.transformStep:!0),__privateSet(this,_isScrollStep,(options==null?void 0:options.scrollStep)!==void 0?options.scrollStep:!0),__privateGet(this,_scale).setStep("_size","+",{x:1,y:1,z:1}),__privateGet(this,_position).setStep("_position","+",{x:0,y:0,z:0}),__privateGet(this,_scale).setStep("_scale","*",{x:1,y:1,z:1}),__privateGet(this,_position).setStep("_translation","+",{x:0,y:0,z:0}),__privateGet(this,_rotation).setStep("_rotation","+",{x:0,y:0,z:0}),__privateGet(this,_isScrollStep)&&(scrollEntries_index.scrollEntries.notifier.subscribe(__privateGet(this,_scrollEntriesListener)),__privateGet(this,_scrollEntriesListener).call(this)),elementResizer_index.elementResizer.subscribe(this.element,__privateGet(this,_resizeListener)),windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener),order_index.RESIZE_ORDER.LAYOUT_BOX),intersector_index.ticker.subscribe(__privateGet(this,_tickListener),{order:order_index.TICK_ORDER.LAYOUT_BOX,culling:options!=null&&options.culling?this.element:void 0}))}get element(){return __privateGet(this,_element)}get containerElement(){return __privateGet(this,_containerElement)}get position(){return __privateGet(this,_position).current}get rotation(){return __privateGet(this,_rotation).current}get scale(){return __privateGet(this,_scale).current}get scrollValue(){return __privateGet(this,_scrollValue)}get left(){return __privateGet(this,_left)}get top(){return __privateGet(this,_top)}get CSSTranslation(){return __privateGet(this,_CSSTranslation)}get CSSRotation(){return __privateGet(this,_CSSRotation)}get CSSScale(){return __privateGet(this,_CSSScale)}get front(){return __privateGet(this,_front)}get width(){return __privateGet(this,_width)}get height(){return __privateGet(this,_height)}get depth(){return __privateGet(this,_depth)}destroy(){intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener)),elementResizer_index.elementResizer.unsubscribe(__privateGet(this,_resizeListener)),windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener)),scrollEntries_index.scrollEntries.notifier.unsubscribe(__privateGet(this,_scrollEntriesListener)),__privateGet(this,_scrollEntries).clear(),__privateGet(this,_position).close(),__privateGet(this,_rotation).close(),__privateGet(this,_scale).close()}bindObject(object){object.position&&__privateGet(this,_position).bind(object.position),object.rotation&&__privateGet(this,_rotation).bind(object.rotation),object.scale&&__privateGet(this,_scale).bind(object.scale)}unbindObject(object){object.position&&__privateGet(this,_position).unbind(object.position),object.rotation&&__privateGet(this,_rotation).unbind(object.rotation),object.scale&&__privateGet(this,_scale).unbind(object.scale)}setScrollStep(callback){return __privateGet(this,_scrollStepSetterCallbacks).includes(callback)||__privateGet(this,_scrollStepSetterCallbacks).push(callback),()=>this.deleteScrollStep(callback)}deleteScrollStep(callback){__privateSet(this,_scrollStepSetterCallbacks,__privateGet(this,_scrollStepSetterCallbacks).filter(s=>s!==callback))}setPositionStep(...args){__privateGet(this,_position).setStep(...args)}getPositionStep(...args){return __privateGet(this,_position).getStepValue(...args)}setRotationStep(...args){__privateGet(this,_rotation).setStep(...args)}getRotationStep(...args){return __privateGet(this,_rotation).getStepValue(...args)}getExcludedRotationSteps(...args){return __privateGet(this,_rotation).getExcludedStepsValue(...args)}getIncludedRotationSteps(...args){return __privateGet(this,_rotation).getIncludedStepsValue(...args)}setScaleStep(...args){__privateGet(this,_scale).setStep(...args)}getScaleStep(...args){return __privateGet(this,_scale).getStepValue(...args)}getExcludedScaleSteps(...args){return __privateGet(this,_scale).getExcludedStepsValue(...args)}getIncludedScaleSteps(...args){return __privateGet(this,_scale).getIncludedStepsValue(...args)}deletePositionStep(...args){__privateGet(this,_position).deleteStep(...args)}getExcludedPositionSteps(...args){return __privateGet(this,_position).getExcludedStepsValue(...args)}getIncludedPositionSteps(...args){return __privateGet(this,_position).getIncludedStepsValue(...args)}deleteRotationStep(...args){__privateGet(this,_rotation).deleteStep(...args)}deleteScaleStep(...args){__privateGet(this,_scale).deleteStep(...args)}onPosition(...args){return __privateGet(this,_position).subscribe(...args)}offPosition(...args){__privateGet(this,_position).unsubscribe(...args)}onScale(...args){return __privateGet(this,_scale).subscribe(...args)}offScale(...args){__privateGet(this,_scale).unsubscribe(...args)}onRotation(...args){return __privateGet(this,_rotation).subscribe(...args)}offRotation(...args){__privateGet(this,_rotation).unsubscribe(...args)}onResize(...args){return __privateGet(this,_resizeNotifier).subscribe(...args)}offResize(...args){return __privateGet(this,_resizeNotifier).unsubscribe(...args)}};_element=new WeakMap,_containerElement=new WeakMap,_scrollStepSetterCallbacks=new WeakMap,_scrollAxis=new WeakMap,_frontSide=new WeakMap,_isCartesian=new WeakMap,_isSizeStep=new WeakMap,_isPositionStep=new WeakMap,_isTransformStep=new WeakMap,_isScrollStep=new WeakMap,_width=new WeakMap,_height=new WeakMap,_depth=new WeakMap,_top=new WeakMap,_left=new WeakMap,_front=new WeakMap,_x=new WeakMap,_y=new WeakMap,_z=new WeakMap,_CSSTranslation=new WeakMap,_CSSRotation=new WeakMap,_CSSScale=new WeakMap,_rotation=new WeakMap,_position=new WeakMap,_scale=new WeakMap,_scrollValue=new WeakMap,_scrollEntries=new WeakMap,_resizeNotifier=new WeakMap,_LayoutBox_instances=new WeakSet,recalculate_fn=__name(function(){__privateGet(this,_scale).calculate(),__privateGet(this,_position).calculate(),__privateGet(this,_rotation).calculate()},"#recalculate"),composeSteps_fn=__name(function(){__privateGet(this,_scale).setStep("_size","+",{x:__privateGet(this,_isSizeStep)?__privateGet(this,_width):1,y:__privateGet(this,_isSizeStep)?__privateGet(this,_height):1,z:__privateGet(this,_isSizeStep)?__privateGet(this,_depth):1});const xPosition=__privateGet(this,_isPositionStep)?__privateGet(this,_x):0,yPosition=__privateGet(this,_isPositionStep)?__privateGet(this,_y):0,zPosition=__privateGet(this,_isPositionStep)?__privateGet(this,_z):0;__privateGet(this,_position).setStep("_position","+",{x:xPosition,y:yPosition,z:zPosition}),__privateGet(this,_isTransformStep)?(__privateGet(this,_scale).setStep("_scale","*",{x:__privateGet(this,_CSSScale).x,y:__privateGet(this,_CSSScale).y,z:__privateGet(this,_CSSScale).z}),__privateGet(this,_position).setStep("_translation","+",{x:__privateGet(this,_CSSTranslation).x,y:__privateGet(this,_CSSTranslation).y,z:__privateGet(this,_CSSTranslation).z}),__privateGet(this,_rotation).setStep("_rotation","+",{x:__privateGet(this,_CSSRotation).x,y:__privateGet(this,_CSSRotation).y,z:__privateGet(this,_CSSRotation).z})):(__privateGet(this,_scale).setStep("_scale","*",{x:1,y:1,z:1}),__privateGet(this,_position).setStep("_translation","+",{x:0,y:0,z:0}),__privateGet(this,_rotation).setStep("_rotation","+",{x:0,y:0,z:0}))},"#composeSteps"),updateDimensions_fn=__name(function(){const computed=getComputedStyle(__privateGet(this,_element));__privateSet(this,_width,Math.max(__privateGet(this,_element).clientWidth,1)),__privateSet(this,_height,Math.max(__privateGet(this,_element).clientHeight,1)),__privateSet(this,_depth,Math.max(cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--depth")||"0px"),1));const vl=layout.getCumulativeOffsetLeft(__privateGet(this,_containerElement)),vt=layout.getCumulativeOffsetTop(__privateGet(this,_containerElement)),vw=__privateGet(this,_containerElement).clientWidth,vh=__privateGet(this,_containerElement).clientHeight;if(__privateSet(this,_left,layout.getCumulativeOffsetLeft(__privateGet(this,_element))-vl),__privateSet(this,_top,layout.getCumulativeOffsetTop(__privateGet(this,_element))-vt),__privateGet(this,_scrollAxis)==="z"){const nl=__privateGet(this,_left)/vw,nt=__privateGet(this,_top)/vh;__privateSet(this,_left,(nl-Math.floor(nl))*vw),__privateSet(this,_top,(nt-Math.floor(nt))*vh),__privateGet(this,_frontSide)==="left"?__privateSet(this,_front,layout.getCumulativeOffsetLeft(__privateGet(this,_element))-vl-__privateGet(this,_left)):__privateSet(this,_front,layout.getCumulativeOffsetTop(__privateGet(this,_element))-vt-__privateGet(this,_top))}if(__privateSet(this,_left,__privateGet(this,_left)+__privateGet(this,_element).clientLeft),__privateSet(this,_top,__privateGet(this,_top)+__privateGet(this,_element).clientTop),__privateGet(this,_isCartesian)){const viewHalfWidth=Math.round(vw/2),viewHalfHeight=Math.round(vh/2),thisHalfWidth=__privateGet(this,_width)?Math.round(__privateGet(this,_width)/2):0,thisHalfHeight=__privateGet(this,_height)?Math.round(__privateGet(this,_height)/2):0,positionX=__privateGet(this,_left)-viewHalfWidth+thisHalfWidth,positionY=(__privateGet(this,_top)-viewHalfHeight+thisHalfHeight)*-1;__privateSet(this,_x,positionX),__privateSet(this,_y,positionY)}else __privateSet(this,_x,__privateGet(this,_left)),__privateSet(this,_y,__privateGet(this,_top));__privateSet(this,_z,__privateGet(this,_front)*-1);const cssMatrix=new WebKitCSSMatrix(computed.transform),decomposedMatrix=decomposeCSSMatrix(cssMatrix);__privateGet(this,_CSSTranslation).x=decomposedMatrix.translationX,__privateGet(this,_CSSTranslation).y=decomposedMatrix.translationY,__privateGet(this,_CSSTranslation).z=decomposedMatrix.translationZ,__privateGet(this,_CSSScale).x=decomposedMatrix.scaleX,__privateGet(this,_CSSScale).y=decomposedMatrix.scaleY,__privateGet(this,_CSSScale).z=decomposedMatrix.scaleZ,__privateGet(this,_CSSRotation).x=decomposedMatrix.rotationX,__privateGet(this,_CSSRotation).y=decomposedMatrix.rotationY,__privateGet(this,_CSSRotation).z=decomposedMatrix.rotationZ,__privateMethod(this,_LayoutBox_instances,composeSteps_fn).call(this),__privateMethod(this,_LayoutBox_instances,recalculate_fn).call(this),__privateGet(this,_resizeNotifier).notify()},"#updateDimensions"),updateScrollPosition_fn=__name(function(){__privateGet(this,_scrollValue).x=0,__privateGet(this,_scrollValue).y=0,__privateGet(this,_scrollValue).z=0;for(let index=0;index<__privateGet(this,_scrollStepSetterCallbacks).length;index++){const callbackReturn=__privateGet(this,_scrollStepSetterCallbacks)[index]();let axis=callbackReturn.axis;__privateGet(this,_scrollAxis)!=="auto"&&(axis=__privateGet(this,_scrollAxis));const value=callbackReturn.value*(axis==="x"?-1:__privateGet(this,_isCartesian)?1:-1);__privateGet(this,_scrollValue)[axis]+=value,__privateGet(this,_position).setStep(`_scroll_${index}`,"+",{[axis]:value})}},"#updateScrollPosition"),_resizeListener=new WeakMap,_tickListener=new WeakMap,_scrollEntriesListener=new WeakMap,__name(_LayoutBox,"LayoutBox");let LayoutBox=_LayoutBox;exports.LayoutBox=LayoutBox;exports.decomposeCSSMatrix=decomposeCSSMatrix;
1
+ "use strict";var __defProp=Object.defineProperty;var __typeError=msg=>{throw TypeError(msg)};var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const cssUnitParser_index=require("../css-unit-parser/index.cjs"),elementResizer_index=require("../element-resizer/index.cjs"),ladder_index=require("../ladder/index.cjs"),notifier_index=require("../notifier/index.cjs"),order_index=require("../order/index.cjs"),scrollEntries_index=require("../scroll-entries/index.cjs"),intersector_index=require("../index-DZ44osDT.cjs"),dom=require("../dom-B40i6NXw.cjs"),layout=require("../layout-CnGLl7oe.cjs");require("construct-style-sheets-polyfill");const windowResizer_index=require("../window-resizer/index.cjs");function decomposeCSSMatrix(matrix){const scaleX=Math.sqrt(matrix.m11*matrix.m11+matrix.m12*matrix.m12+matrix.m13*matrix.m13),scaleY=Math.sqrt(matrix.m21*matrix.m21+matrix.m22*matrix.m22+matrix.m23*matrix.m23),scaleZ=Math.sqrt(matrix.m31*matrix.m31+matrix.m32*matrix.m32+matrix.m33*matrix.m33),rotationX=Math.atan2(matrix.m32,matrix.m33),rotationY=Math.atan2(-matrix.m31,Math.sqrt(matrix.m32*matrix.m32+matrix.m33*matrix.m33)),rotationZ=Math.atan2(matrix.m21,matrix.m11),translationX=matrix.m41,translationY=matrix.m42*-1,translationZ=matrix.m43;return{scaleX,scaleY,scaleZ,rotationX,rotationY,rotationZ,translationX,translationY,translationZ}}__name(decomposeCSSMatrix,"decomposeCSSMatrix");var _element,_containerElement,_scrollStepSetterCallbacks,_scrollAxis,_frontSide,_isCartesian,_isSizeStep,_isPositionStep,_isTransformStep,_isScrollStep,_width,_height,_depth,_top,_left,_front,_x,_y,_z,_CSSTranslation,_CSSRotation,_CSSScale,_rotation,_position,_scale,_scrollValue,_scrollEntries,_resizeNotifier,_LayoutBox_instances,recalculate_fn,composeSteps_fn,updateDimensions_fn,updateScrollPosition_fn,_resizeListener,_tickListener,_scrollEntriesListener;const _LayoutBox=class _LayoutBox{constructor(element,options){__privateAdd(this,_LayoutBox_instances);__privateAdd(this,_element,null);__privateAdd(this,_containerElement,null);__privateAdd(this,_scrollStepSetterCallbacks,[]);__privateAdd(this,_scrollAxis,"auto");__privateAdd(this,_frontSide,"top");__privateAdd(this,_isCartesian,!1);__privateAdd(this,_isSizeStep,!0);__privateAdd(this,_isPositionStep,!0);__privateAdd(this,_isTransformStep,!0);__privateAdd(this,_isScrollStep,!0);__privateAdd(this,_width,0);__privateAdd(this,_height,0);__privateAdd(this,_depth,0);__privateAdd(this,_top,0);__privateAdd(this,_left,0);__privateAdd(this,_front,0);__privateAdd(this,_x,0);__privateAdd(this,_y,0);__privateAdd(this,_z,0);__privateAdd(this,_CSSTranslation,{x:0,y:0,z:0});__privateAdd(this,_CSSRotation,{x:0,y:0,z:0});__privateAdd(this,_CSSScale,{x:1,y:1,z:1});__privateAdd(this,_rotation,new ladder_index.Ladder({x:0,y:0,z:0}));__privateAdd(this,_position,new ladder_index.Ladder({x:0,y:0,z:0}));__privateAdd(this,_scale,new ladder_index.Ladder({x:0,y:0,z:0}));__privateAdd(this,_scrollValue,{x:0,y:0,z:0});__privateAdd(this,_scrollEntries,new Map);__privateAdd(this,_resizeNotifier,new notifier_index.Notifier);__privateAdd(this,_resizeListener,__name(()=>{intersector_index.isBrowser&&__privateMethod(this,_LayoutBox_instances,updateDimensions_fn).call(this)},"#resizeListener"));__privateAdd(this,_tickListener,__name(()=>{__privateMethod(this,_LayoutBox_instances,updateScrollPosition_fn).call(this),__privateMethod(this,_LayoutBox_instances,recalculate_fn).call(this)},"#tickListener"));__privateAdd(this,_scrollEntriesListener,__name(()=>{const allEntries=scrollEntries_index.scrollEntries.getAll(this.element);__privateGet(this,_scrollEntries).forEach((value,key)=>{allEntries.includes(key)||(this.deleteScrollStep(value),__privateGet(this,_scrollEntries).delete(key))}),allEntries.forEach(entry=>{if(!__privateGet(this,_scrollEntries).has(entry)){const callback=__name(()=>entry,"callback");__privateGet(this,_scrollEntries).set(entry,callback),this.setScrollStep(callback)}})},"#scrollEntriesListener"));intersector_index.isBrowser&&(__privateSet(this,_element,dom.getElement(element)||document.body),__privateSet(this,_containerElement,dom.getElement(options==null?void 0:options.containerElement)||document.body),__privateSet(this,_scrollAxis,(options==null?void 0:options.scrollAxis)||"auto"),__privateSet(this,_frontSide,(options==null?void 0:options.frontSide)||"top"),__privateSet(this,_isCartesian,(options==null?void 0:options.cartesian)||!1),__privateSet(this,_isSizeStep,(options==null?void 0:options.sizeStep)!==void 0?options.sizeStep:!0),__privateSet(this,_isPositionStep,(options==null?void 0:options.positionStep)!==void 0?options.positionStep:!0),__privateSet(this,_isTransformStep,(options==null?void 0:options.transformStep)!==void 0?options.transformStep:!0),__privateSet(this,_isScrollStep,(options==null?void 0:options.scrollStep)!==void 0?options.scrollStep:!0),__privateGet(this,_scale).setStep("_size","+",{x:1,y:1,z:1}),__privateGet(this,_position).setStep("_position","+",{x:0,y:0,z:0}),__privateGet(this,_scale).setStep("_scale","*",{x:1,y:1,z:1}),__privateGet(this,_position).setStep("_translation","+",{x:0,y:0,z:0}),__privateGet(this,_rotation).setStep("_rotation","+",{x:0,y:0,z:0}),__privateGet(this,_isScrollStep)&&(scrollEntries_index.scrollEntries.notifier.subscribe(__privateGet(this,_scrollEntriesListener)),__privateGet(this,_scrollEntriesListener).call(this),this.setScrollStep(()=>({axis:"y",value:layout.getStickyOffset(this.element,"top")*-1})),this.setScrollStep(()=>({axis:"x",value:layout.getStickyOffset(this.element,"left")*-1}))),elementResizer_index.elementResizer.subscribe(this.element,__privateGet(this,_resizeListener)),windowResizer_index.windowResizer.subscribe(__privateGet(this,_resizeListener),order_index.RESIZE_ORDER.LAYOUT_BOX),intersector_index.ticker.subscribe(__privateGet(this,_tickListener),{order:order_index.TICK_ORDER.LAYOUT_BOX,culling:options!=null&&options.culling?this.element:void 0}))}get element(){return __privateGet(this,_element)}get containerElement(){return __privateGet(this,_containerElement)}get position(){return __privateGet(this,_position).current}get rotation(){return __privateGet(this,_rotation).current}get scale(){return __privateGet(this,_scale).current}get scrollValue(){return __privateGet(this,_scrollValue)}get left(){return __privateGet(this,_left)}get top(){return __privateGet(this,_top)}get CSSTranslation(){return __privateGet(this,_CSSTranslation)}get CSSRotation(){return __privateGet(this,_CSSRotation)}get CSSScale(){return __privateGet(this,_CSSScale)}get front(){return __privateGet(this,_front)}get width(){return __privateGet(this,_width)}get height(){return __privateGet(this,_height)}get depth(){return __privateGet(this,_depth)}destroy(){intersector_index.ticker.unsubscribe(__privateGet(this,_tickListener)),elementResizer_index.elementResizer.unsubscribe(__privateGet(this,_resizeListener)),windowResizer_index.windowResizer.unsubscribe(__privateGet(this,_resizeListener)),scrollEntries_index.scrollEntries.notifier.unsubscribe(__privateGet(this,_scrollEntriesListener)),__privateGet(this,_scrollEntries).clear(),__privateGet(this,_position).close(),__privateGet(this,_rotation).close(),__privateGet(this,_scale).close()}bindObject(object){object.position&&__privateGet(this,_position).bind(object.position),object.rotation&&__privateGet(this,_rotation).bind(object.rotation),object.scale&&__privateGet(this,_scale).bind(object.scale)}unbindObject(object){object.position&&__privateGet(this,_position).unbind(object.position),object.rotation&&__privateGet(this,_rotation).unbind(object.rotation),object.scale&&__privateGet(this,_scale).unbind(object.scale)}setScrollStep(callback){return __privateGet(this,_scrollStepSetterCallbacks).includes(callback)||__privateGet(this,_scrollStepSetterCallbacks).push(callback),()=>this.deleteScrollStep(callback)}deleteScrollStep(callback){__privateSet(this,_scrollStepSetterCallbacks,__privateGet(this,_scrollStepSetterCallbacks).filter(s=>s!==callback))}setPositionStep(...args){__privateGet(this,_position).setStep(...args)}getPositionStep(...args){return __privateGet(this,_position).getStepValue(...args)}setRotationStep(...args){__privateGet(this,_rotation).setStep(...args)}getRotationStep(...args){return __privateGet(this,_rotation).getStepValue(...args)}getExcludedRotationSteps(...args){return __privateGet(this,_rotation).getExcludedStepsValue(...args)}getIncludedRotationSteps(...args){return __privateGet(this,_rotation).getIncludedStepsValue(...args)}setScaleStep(...args){__privateGet(this,_scale).setStep(...args)}getScaleStep(...args){return __privateGet(this,_scale).getStepValue(...args)}getExcludedScaleSteps(...args){return __privateGet(this,_scale).getExcludedStepsValue(...args)}getIncludedScaleSteps(...args){return __privateGet(this,_scale).getIncludedStepsValue(...args)}deletePositionStep(...args){__privateGet(this,_position).deleteStep(...args)}getExcludedPositionSteps(...args){return __privateGet(this,_position).getExcludedStepsValue(...args)}getIncludedPositionSteps(...args){return __privateGet(this,_position).getIncludedStepsValue(...args)}deleteRotationStep(...args){__privateGet(this,_rotation).deleteStep(...args)}deleteScaleStep(...args){__privateGet(this,_scale).deleteStep(...args)}onPosition(...args){return __privateGet(this,_position).subscribe(...args)}offPosition(...args){__privateGet(this,_position).unsubscribe(...args)}onScale(...args){return __privateGet(this,_scale).subscribe(...args)}offScale(...args){__privateGet(this,_scale).unsubscribe(...args)}onRotation(...args){return __privateGet(this,_rotation).subscribe(...args)}offRotation(...args){__privateGet(this,_rotation).unsubscribe(...args)}onResize(...args){return __privateGet(this,_resizeNotifier).subscribe(...args)}offResize(...args){return __privateGet(this,_resizeNotifier).unsubscribe(...args)}};_element=new WeakMap,_containerElement=new WeakMap,_scrollStepSetterCallbacks=new WeakMap,_scrollAxis=new WeakMap,_frontSide=new WeakMap,_isCartesian=new WeakMap,_isSizeStep=new WeakMap,_isPositionStep=new WeakMap,_isTransformStep=new WeakMap,_isScrollStep=new WeakMap,_width=new WeakMap,_height=new WeakMap,_depth=new WeakMap,_top=new WeakMap,_left=new WeakMap,_front=new WeakMap,_x=new WeakMap,_y=new WeakMap,_z=new WeakMap,_CSSTranslation=new WeakMap,_CSSRotation=new WeakMap,_CSSScale=new WeakMap,_rotation=new WeakMap,_position=new WeakMap,_scale=new WeakMap,_scrollValue=new WeakMap,_scrollEntries=new WeakMap,_resizeNotifier=new WeakMap,_LayoutBox_instances=new WeakSet,recalculate_fn=__name(function(){__privateGet(this,_scale).calculate(),__privateGet(this,_position).calculate(),__privateGet(this,_rotation).calculate()},"#recalculate"),composeSteps_fn=__name(function(){__privateGet(this,_scale).setStep("_size","+",{x:__privateGet(this,_isSizeStep)?__privateGet(this,_width):1,y:__privateGet(this,_isSizeStep)?__privateGet(this,_height):1,z:__privateGet(this,_isSizeStep)?__privateGet(this,_depth):1});const xPosition=__privateGet(this,_isPositionStep)?__privateGet(this,_x):0,yPosition=__privateGet(this,_isPositionStep)?__privateGet(this,_y):0,zPosition=__privateGet(this,_isPositionStep)?__privateGet(this,_z):0;__privateGet(this,_position).setStep("_position","+",{x:xPosition,y:yPosition,z:zPosition}),__privateGet(this,_isTransformStep)?(__privateGet(this,_scale).setStep("_scale","*",{x:__privateGet(this,_CSSScale).x,y:__privateGet(this,_CSSScale).y,z:__privateGet(this,_CSSScale).z}),__privateGet(this,_position).setStep("_translation","+",{x:__privateGet(this,_CSSTranslation).x,y:__privateGet(this,_CSSTranslation).y,z:__privateGet(this,_CSSTranslation).z}),__privateGet(this,_rotation).setStep("_rotation","+",{x:__privateGet(this,_CSSRotation).x,y:__privateGet(this,_CSSRotation).y,z:__privateGet(this,_CSSRotation).z})):(__privateGet(this,_scale).setStep("_scale","*",{x:1,y:1,z:1}),__privateGet(this,_position).setStep("_translation","+",{x:0,y:0,z:0}),__privateGet(this,_rotation).setStep("_rotation","+",{x:0,y:0,z:0}))},"#composeSteps"),updateDimensions_fn=__name(function(){const computed=getComputedStyle(__privateGet(this,_element));__privateSet(this,_width,Math.max(__privateGet(this,_element).clientWidth,1)),__privateSet(this,_height,Math.max(__privateGet(this,_element).clientHeight,1)),__privateSet(this,_depth,Math.max(cssUnitParser_index.cssUnitParser.parse(computed.getPropertyValue("--depth")||"0px"),1));const vl=layout.getCumulativeOffsetLeft(__privateGet(this,_containerElement)),vt=layout.getCumulativeOffsetTop(__privateGet(this,_containerElement)),vw=__privateGet(this,_containerElement).clientWidth,vh=__privateGet(this,_containerElement).clientHeight;if(__privateSet(this,_left,layout.getCumulativeOffsetLeft(__privateGet(this,_element))-vl),__privateSet(this,_top,layout.getCumulativeOffsetTop(__privateGet(this,_element))-vt),__privateGet(this,_scrollAxis)==="z"){const nl=__privateGet(this,_left)/vw,nt=__privateGet(this,_top)/vh;__privateSet(this,_left,(nl-Math.floor(nl))*vw),__privateSet(this,_top,(nt-Math.floor(nt))*vh),__privateGet(this,_frontSide)==="left"?__privateSet(this,_front,layout.getCumulativeOffsetLeft(__privateGet(this,_element))-vl-__privateGet(this,_left)):__privateSet(this,_front,layout.getCumulativeOffsetTop(__privateGet(this,_element))-vt-__privateGet(this,_top))}if(__privateSet(this,_left,__privateGet(this,_left)+__privateGet(this,_element).clientLeft),__privateSet(this,_top,__privateGet(this,_top)+__privateGet(this,_element).clientTop),__privateSet(this,_left,__privateGet(this,_left)+layout.getStickyOffset(this.element,"left")*-1),__privateSet(this,_top,__privateGet(this,_top)+layout.getStickyOffset(this.element,"top")*-1),__privateGet(this,_isCartesian)){const viewHalfWidth=Math.round(vw/2),viewHalfHeight=Math.round(vh/2),thisHalfWidth=__privateGet(this,_width)?Math.round(__privateGet(this,_width)/2):0,thisHalfHeight=__privateGet(this,_height)?Math.round(__privateGet(this,_height)/2):0,positionX=__privateGet(this,_left)-viewHalfWidth+thisHalfWidth,positionY=(__privateGet(this,_top)-viewHalfHeight+thisHalfHeight)*-1;__privateSet(this,_x,positionX),__privateSet(this,_y,positionY)}else __privateSet(this,_x,__privateGet(this,_left)),__privateSet(this,_y,__privateGet(this,_top));__privateSet(this,_z,__privateGet(this,_front)*-1);const cssMatrix=new WebKitCSSMatrix(computed.transform),decomposedMatrix=decomposeCSSMatrix(cssMatrix);__privateGet(this,_CSSTranslation).x=decomposedMatrix.translationX,__privateGet(this,_CSSTranslation).y=decomposedMatrix.translationY,__privateGet(this,_CSSTranslation).z=decomposedMatrix.translationZ,__privateGet(this,_CSSScale).x=decomposedMatrix.scaleX,__privateGet(this,_CSSScale).y=decomposedMatrix.scaleY,__privateGet(this,_CSSScale).z=decomposedMatrix.scaleZ,__privateGet(this,_CSSRotation).x=decomposedMatrix.rotationX,__privateGet(this,_CSSRotation).y=decomposedMatrix.rotationY,__privateGet(this,_CSSRotation).z=decomposedMatrix.rotationZ,__privateMethod(this,_LayoutBox_instances,composeSteps_fn).call(this),__privateMethod(this,_LayoutBox_instances,recalculate_fn).call(this),__privateGet(this,_resizeNotifier).notify()},"#updateDimensions"),updateScrollPosition_fn=__name(function(){__privateGet(this,_scrollValue).x=0,__privateGet(this,_scrollValue).y=0,__privateGet(this,_scrollValue).z=0;for(let index=0;index<__privateGet(this,_scrollStepSetterCallbacks).length;index++){const callbackReturn=__privateGet(this,_scrollStepSetterCallbacks)[index]();let axis=callbackReturn.axis;__privateGet(this,_scrollAxis)!=="auto"&&(axis=__privateGet(this,_scrollAxis));const value=callbackReturn.value*(axis==="x"?-1:__privateGet(this,_isCartesian)?1:-1);__privateGet(this,_scrollValue)[axis]+=value,__privateGet(this,_position).setStep(`_scroll_${index}`,"+",{[axis]:value})}},"#updateScrollPosition"),_resizeListener=new WeakMap,_tickListener=new WeakMap,_scrollEntriesListener=new WeakMap,__name(_LayoutBox,"LayoutBox");let LayoutBox=_LayoutBox;exports.LayoutBox=LayoutBox;exports.decomposeCSSMatrix=decomposeCSSMatrix;
@@ -1,7 +1,7 @@
1
1
  import { Ladder } from '../ladder';
2
- import { StoreSubscribeCallback } from '../store';
3
- import { ElementOrSelector, Axes3D, Axes2D } from '../utils';
4
2
  import { Notifier } from '../notifier';
3
+ import { StoreSubscribeCallback } from '../store';
4
+ import { Axes2D, Axes3D, ElementOrSelector } from '../utils';
5
5
  export declare function decomposeCSSMatrix(matrix: WebKitCSSMatrix): {
6
6
  scaleX: number;
7
7
  scaleY: number;
@@ -6,16 +6,16 @@ var __name = (target, value) => __defProp(target, "name", { value, configurable:
6
6
  var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
7
7
  var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj)), __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value), __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value), __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
8
8
  import { cssUnitParser } from "../css-unit-parser/index.js";
9
+ import { elementResizer } from "../element-resizer/index.js";
9
10
  import { Ladder } from "../ladder/index.js";
11
+ import { Notifier } from "../notifier/index.js";
10
12
  import { RESIZE_ORDER, TICK_ORDER } from "../order/index.js";
11
13
  import { scrollEntries } from "../scroll-entries/index.js";
12
14
  import { i as isBrowser, t as ticker } from "../index-ClTMVKJp.js";
13
15
  import { g as getElement } from "../dom-D8D-_9ty.js";
14
- import { g as getCumulativeOffsetLeft, a as getCumulativeOffsetTop } from "../layout-C26zkY7D.js";
16
+ import { g as getStickyOffset, a as getCumulativeOffsetLeft, b as getCumulativeOffsetTop } from "../layout-BL6AX9-r.js";
15
17
  import "construct-style-sheets-polyfill";
16
- import { elementResizer } from "../element-resizer/index.js";
17
18
  import { windowResizer } from "../window-resizer/index.js";
18
- import { Notifier } from "../notifier/index.js";
19
19
  function decomposeCSSMatrix(matrix) {
20
20
  const scaleX = Math.sqrt(
21
21
  matrix.m11 * matrix.m11 + matrix.m12 * matrix.m12 + matrix.m13 * matrix.m13
@@ -109,7 +109,13 @@ const _LayoutBox = class _LayoutBox {
109
109
  x: 0,
110
110
  y: 0,
111
111
  z: 0
112
- }), __privateGet(this, _isScrollStep) && (scrollEntries.notifier.subscribe(__privateGet(this, _scrollEntriesListener)), __privateGet(this, _scrollEntriesListener).call(this)), elementResizer.subscribe(this.element, __privateGet(this, _resizeListener)), windowResizer.subscribe(__privateGet(this, _resizeListener), RESIZE_ORDER.LAYOUT_BOX), ticker.subscribe(__privateGet(this, _tickListener), {
112
+ }), __privateGet(this, _isScrollStep) && (scrollEntries.notifier.subscribe(__privateGet(this, _scrollEntriesListener)), __privateGet(this, _scrollEntriesListener).call(this), this.setScrollStep(() => ({
113
+ axis: "y",
114
+ value: getStickyOffset(this.element, "top") * -1
115
+ })), this.setScrollStep(() => ({
116
+ axis: "x",
117
+ value: getStickyOffset(this.element, "left") * -1
118
+ }))), elementResizer.subscribe(this.element, __privateGet(this, _resizeListener)), windowResizer.subscribe(__privateGet(this, _resizeListener), RESIZE_ORDER.LAYOUT_BOX), ticker.subscribe(__privateGet(this, _tickListener), {
113
119
  order: TICK_ORDER.LAYOUT_BOX,
114
120
  culling: options != null && options.culling ? this.element : void 0
115
121
  }));
@@ -295,7 +301,7 @@ _element = new WeakMap(), _containerElement = new WeakMap(), _scrollStepSetterCa
295
301
  const nl = __privateGet(this, _left) / vw, nt = __privateGet(this, _top) / vh;
296
302
  __privateSet(this, _left, (nl - Math.floor(nl)) * vw), __privateSet(this, _top, (nt - Math.floor(nt)) * vh), __privateGet(this, _frontSide) === "left" ? __privateSet(this, _front, getCumulativeOffsetLeft(__privateGet(this, _element)) - vl - __privateGet(this, _left)) : __privateSet(this, _front, getCumulativeOffsetTop(__privateGet(this, _element)) - vt - __privateGet(this, _top));
297
303
  }
298
- if (__privateSet(this, _left, __privateGet(this, _left) + __privateGet(this, _element).clientLeft), __privateSet(this, _top, __privateGet(this, _top) + __privateGet(this, _element).clientTop), __privateGet(this, _isCartesian)) {
304
+ if (__privateSet(this, _left, __privateGet(this, _left) + __privateGet(this, _element).clientLeft), __privateSet(this, _top, __privateGet(this, _top) + __privateGet(this, _element).clientTop), __privateSet(this, _left, __privateGet(this, _left) + getStickyOffset(this.element, "left") * -1), __privateSet(this, _top, __privateGet(this, _top) + getStickyOffset(this.element, "top") * -1), __privateGet(this, _isCartesian)) {
299
305
  const viewHalfWidth = Math.round(vw / 2), viewHalfHeight = Math.round(vh / 2), thisHalfWidth = __privateGet(this, _width) ? Math.round(__privateGet(this, _width) / 2) : 0, thisHalfHeight = __privateGet(this, _height) ? Math.round(__privateGet(this, _height) / 2) : 0, positionX = __privateGet(this, _left) - viewHalfWidth + thisHalfWidth, positionY = (__privateGet(this, _top) - viewHalfHeight + thisHalfHeight) * -1;
300
306
  __privateSet(this, _x, positionX), __privateSet(this, _y, positionY);
301
307
  } else
@@ -1,4 +1,4 @@
1
- import { L } from "../LocalLinks-BdqYzt1b.js";
1
+ import { L } from "../LocalLinks-CI-vxMaR.js";
2
2
  export {
3
3
  L as LocalLinks
4
4
  };
@@ -1 +1 @@
1
- "use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __knownSymbol=(name,symbol)=>(symbol=Symbol[name])?symbol:Symbol.for("Symbol."+name),__typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);var __async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())});var __forAwait=(obj,it,method)=>(it=obj[__knownSymbol("asyncIterator")])?it.call(obj):(obj=obj[__knownSymbol("iterator")](),it={},method=(key,fn)=>(fn=obj[key])&&(it[key]=arg=>new Promise((yes,no,done)=>(arg=fn.call(obj,arg),done=arg.done,Promise.resolve(arg.value).then(value=>yes({value,done}),no)))),method("next"),method("return"),it);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const intersector_index=require("../index-DZ44osDT.cjs"),dom=require("../dom-B40i6NXw.cjs"),events=require("../events-UlGk63iC.cjs"),scroll=require("../scroll-D2tOpCnP.cjs");require("construct-style-sheets-polyfill");const url=require("../url-CPCO10Sy.cjs"),cssValueParser_index=require("../css-value-parser/index.cjs"),string=require("../string-CbRNzmd9.cjs"),_MorphAnnouncer=class _MorphAnnouncer extends HTMLElement{connectedCallback(){const attrs={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[key,value]of Object.entries(attrs))this.setAttribute(key,value)}};__name(_MorphAnnouncer,"MorphAnnouncer");let MorphAnnouncer=_MorphAnnouncer;intersector_index.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",MorphAnnouncer);var _morph,_element,_MorphLink_instances,path_get,click_fn,_clickListener,_pointerListener;const _MorphLink=class _MorphLink{constructor(element,morph){__privateAdd(this,_MorphLink_instances);__privateAdd(this,_morph);__privateAdd(this,_element);__privateAdd(this,_clickListener,__name(e=>{e.preventDefault(),__privateMethod(this,_MorphLink_instances,click_fn).call(this)},"#clickListener"));__privateAdd(this,_pointerListener,__name(()=>{const revalidate=__privateGet(this,_element).hasAttribute("data-revalidate");__privateGet(this,_morph).prefetch(__privateGet(this,_MorphLink_instances,path_get),revalidate),__privateGet(this,_element).removeEventListener("pointerenter",__privateGet(this,_pointerListener))},"#pointerListener"));__privateSet(this,_morph,morph),__privateSet(this,_element,element),__privateGet(this,_element).addEventListener("click",__privateGet(this,_clickListener)),this.checkCurrent(location.href.replace(location.origin,"")),__privateGet(this,_element).hasAttribute("data-prefetch")&&__privateGet(this,_element).addEventListener("pointerenter",__privateGet(this,_pointerListener))}get element(){return __privateGet(this,_element)}checkCurrent(path){var _a,_b;const locationUrl=__privateGet(this,_morph).normalizePath(path),linkUrl=__privateGet(this,_morph).normalizePath(__privateGet(this,_MorphLink_instances,path_get));__privateGet(this,_element).hasAttribute("data-include")&&locationUrl.pathname.includes(linkUrl.pathname)?__privateGet(this,_element).classList.add("current"):linkUrl.pathname===locationUrl.pathname?__privateGet(this,_element).classList.add("current"):(_a=__privateGet(this,_element).getAttribute("data-associated-paths"))!=null&&_a.split(",").find(path2=>locationUrl.pathname.includes(path2))?__privateGet(this,_element).classList.add("current"):__privateGet(this,_element).classList.remove("current"),locationUrl.path===linkUrl.path?__privateGet(this,_element).classList.add("exact"):__privateGet(this,_element).classList.remove("exact");const[pathWithoutParams,pathParamsStr]=(_b=__privateGet(this,_MorphLink_instances,path_get).split("#")[0])==null?void 0:_b.split("?"),pathParams=new URLSearchParams(pathParamsStr),locationParams=new URLSearchParams(location.search);let matchCounter=0;for(const[key]of locationParams)pathParams.has(key)&&locationParams.get(key)===pathParams.get(key)&&matchCounter++;matchCounter?(__privateGet(this,_element).classList.toggle("all-params-matched",locationParams.size===matchCounter),__privateGet(this,_element).classList.toggle("some-params-matched",locationParams.size!==matchCounter)):!locationParams.size&&__privateGet(this,_element).hasAttribute("data-match-no-params")?__privateGet(this,_element).classList.add("all-params-matched"):(__privateGet(this,_element).classList.remove("all-params-matched"),__privateGet(this,_element).classList.remove("some-params-matched"));for(const key in __privateGet(this,_element).dataset){const kebabKey=string.camelToKebab(key);if(kebabKey.startsWith("match-param-")){const name=kebabKey.split("match-param-")[1],value=__privateGet(this,_element).dataset[key],className=`param-${name}-matched`;locationParams.has(name)&&locationParams.get(name)===value||!locationParams.has(name)&&(value===""||value==="*"||value==="all"||value==="any"||value==="vse")?__privateGet(this,_element).classList.add(className):__privateGet(this,_element).classList.remove(className)}}}destroy(){__privateGet(this,_element).removeEventListener("click",__privateGet(this,_clickListener)),__privateGet(this,_element).removeEventListener("pointerenter",__privateGet(this,_pointerListener)),__privateGet(this,_element).classList.remove("current","exact")}};_morph=new WeakMap,_element=new WeakMap,_MorphLink_instances=new WeakSet,path_get=__name(function(){const url2=new URL(__privateGet(this,_element).href);return __privateGet(this,_morph).normalizePath(url2.pathname+url2.search+url2.hash).path},"#path"),click_fn=__name(function(){var _a;if(document.documentElement.classList.contains("click-disabled"))return;if(__privateGet(this,_element).hasAttribute("data-back")&&__privateGet(this,_morph).previousURL)history.back();else{const historyAction=__privateGet(this,_element).getAttribute("data-history-action")||"push",centerScroll=__privateGet(this,_element).hasAttribute("data-center-scroll"),offsetScrollRawValue=getComputedStyle(__privateGet(this,_element)).getPropertyValue("--offset-scroll").trim(),offsetScroll=offsetScrollRawValue?cssValueParser_index.cssValueParser.parse(offsetScrollRawValue):void 0,revalidate=__privateGet(this,_element).hasAttribute("data-revalidate")||__privateGet(this,_element).hasAttribute("data-pagination-more-link")||__privateGet(this,_element).hasAttribute("data-pagination-set-link")||__privateGet(this,_element).hasAttribute("data-pagination-next-link")||__privateGet(this,_element).hasAttribute("data-pagination-prev-link"),keepSearchParameters=__privateGet(this,_element).hasAttribute("data-keep-search-parameters"),keepScrollPosition=__privateGet(this,_element).hasAttribute("data-keep-scroll-position")||__privateGet(this,_element).hasAttribute("data-pagination-more-link"),scrollBehaviour=__privateGet(this,_element).getAttribute("data-scroll-behaviour"),submorph=(_a=__privateGet(this,_element).getAttribute("data-submorph")||__privateGet(this,_element).getAttribute("data-submorph-append"))==null?void 0:_a.split(",").map(v=>v.trim()),clearState=__privateGet(this,_element).hasAttribute("data-clear-state");let path=__privateGet(this,_MorphLink_instances,path_get);if(__privateGet(this,_element).hasAttribute("data-toggle-params")){const[pathWithoutParams,pathParamsStr]=__privateGet(this,_MorphLink_instances,path_get).split("?"),pathParams=new URLSearchParams(pathParamsStr),locationParams=new URLSearchParams(location.search),resultParams=new URLSearchParams;for(const[key]of pathParams)(!locationParams.has(key)||locationParams.has(key)&&locationParams.get(key)!==pathParams.get(key))&&resultParams.append(key,pathParams.get(key));if(__privateGet(this,_element).hasAttribute("data-merge-params"))for(const[key]of locationParams)pathParams.has(key)||resultParams.append(key,locationParams.get(key));path=`${pathWithoutParams}?${resultParams.toString()}`}__privateGet(this,_morph).navigate(path,{historyAction,centerScroll,offsetScroll,revalidate,keepSearchParameters,submorph,clearState,keepScrollPosition,scrollBehaviour,submorphAppend:__privateGet(this,_element).hasAttribute("data-submorph-append"),mergeParams:__privateGet(this,_element).hasAttribute("data-merge-params")&&!__privateGet(this,_element).hasAttribute("data-toggle-params"),detail:__privateGet(this,_element).getAttribute("data-detail"),removeParams:__privateGet(this,_element).getAttribute("data-remove-params")||void 0,scrollTo:__privateGet(this,_element).getAttribute("data-scroll-to")||void 0})}},"#click"),_clickListener=new WeakMap,_pointerListener=new WeakMap,__name(_MorphLink,"MorphLink");let MorphLink=_MorphLink;var _element2,_params,_MorphParamsDependent_instances,update_fn,_urlChangeListener;const _MorphParamsDependent=class _MorphParamsDependent{constructor(element){__privateAdd(this,_MorphParamsDependent_instances);__privateAdd(this,_element2);__privateAdd(this,_params,[]);__privateAdd(this,_urlChangeListener,__name(()=>{__privateMethod(this,_MorphParamsDependent_instances,update_fn).call(this)},"#urlChangeListener"));__privateSet(this,_element2,element);for(const key in __privateGet(this,_element2).dataset){const kebabKey=string.camelToKebab(key);if(kebabKey.startsWith("param-")){const name=kebabKey.split("param-")[1],value=__privateGet(this,_element2).dataset[key];__privateGet(this,_params).push({name,value})}}document.addEventListener("morphURLParametersChange",__privateGet(this,_urlChangeListener)),__privateMethod(this,_MorphParamsDependent_instances,update_fn).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",__privateGet(this,_urlChangeListener))}};_element2=new WeakMap,_params=new WeakMap,_MorphParamsDependent_instances=new WeakSet,update_fn=__name(function(){const locationParams=new URLSearchParams(location.search);let matched=!!__privateGet(this,_params).find(param=>locationParams.has(param.name)&&(locationParams.get(param.name)===param.value||param.value==="*"||param.value==="all"||param.value==="any"||param.value==="vse"||locationParams.get(param.name)==="*"||locationParams.get(param.name)==="all"||locationParams.get(param.name)==="any"||locationParams.get(param.name)==="vse"));!matched&&__privateGet(this,_element2).hasAttribute("data-match-no-params")&&(matched=!__privateGet(this,_params).filter(param=>locationParams.has(param.name)).length);const hideClass=__privateGet(this,_element2).getAttribute("data-hide-class");matched?hideClass?__privateGet(this,_element2).classList.remove(hideClass):__privateGet(this,_element2).style.display="":hideClass?__privateGet(this,_element2).classList.add(hideClass):__privateGet(this,_element2).style.display="none"},"#update"),_urlChangeListener=new WeakMap,__name(_MorphParamsDependent,"MorphParamsDependent");let MorphParamsDependent=_MorphParamsDependent;const domParser=new DOMParser;var _morph2,_pathname,_scrollState,_initialDocument,_modifiedDocument,_currentDocument,_savedState,_abortController,_fetching,_headers,_needRavalidation;const _MorphRoute=class _MorphRoute{constructor(morph,pathname){__privateAdd(this,_morph2);__privateAdd(this,_pathname);__privateAdd(this,_scrollState,{x:0,y:0});__privateAdd(this,_initialDocument,null);__privateAdd(this,_modifiedDocument,null);__privateAdd(this,_currentDocument,null);__privateAdd(this,_savedState,null);__privateAdd(this,_abortController,null);__privateAdd(this,_fetching,null);__privateAdd(this,_headers);__privateAdd(this,_needRavalidation,!1);__privateSet(this,_morph2,morph),__privateSet(this,_pathname,pathname)}get pathname(){return __privateGet(this,_pathname)}get scrollState(){return __privateGet(this,_scrollState)}get document(){return __privateGet(this,_currentDocument)}needRavalidation(){__privateSet(this,_needRavalidation,!0)}setHeaders(headers){__privateSet(this,_headers,headers)}setInitialDocument(document2){__privateSet(this,_initialDocument,document2.cloneNode(!0))}abort(){var _a;return(_a=__privateGet(this,_abortController))==null?void 0:_a.abort(`[${__privateGet(this,_pathname)}] page loading cancelled`)}fetch(path,currentPath,revalidate){return __async(this,null,function*(){var _a;if(!revalidate&&!__privateGet(this,_needRavalidation)){const shouldUseCache=((_a=__privateGet(this,_initialDocument))==null?void 0:_a.documentElement.getAttribute("data-cache"))&&currentPath!==path,isPopstateNavigation=__privateGet(this,_initialDocument)&&__privateGet(this,_morph2).isPopstateNavigation;if(__privateGet(this,_fetching)||shouldUseCache||isPopstateNavigation)return __privateGet(this,_fetching)}return __privateSet(this,_fetching,new Promise(res=>__async(this,null,function*(){try{__privateSet(this,_abortController,new AbortController);const text=yield(yield fetch(path,{signal:__privateGet(this,_abortController).signal,headers:__spreadValues({"X-MORPH":"true","X-MORPH-REVALIDATE":revalidate?"true":"false","X-MORPH-CURRENT-PATH":encodeURIComponent(currentPath),"X-MORPH-NEW-PATH":encodeURIComponent(path)},__privateGet(this,_headers))})).text(),document2=domParser.parseFromString(text,"text/html");this.setInitialDocument(document2),__privateSet(this,_needRavalidation,!1)}catch(e){console.warn(e)}finally{__privateSet(this,_abortController,null),__privateSet(this,_fetching,null),res()}}))),__privateGet(this,_fetching)})}cloneDocument(){__privateSet(this,_currentDocument,(__privateGet(this,_modifiedDocument)||__privateGet(this,_initialDocument)).cloneNode(!0))}get title(){let title="";if(__privateGet(this,_currentDocument).title)title=__privateGet(this,_currentDocument).title;else{const h1=__privateGet(this,_currentDocument).querySelector("h1");title=(h1==null?void 0:h1.innerText)||(h1==null?void 0:h1.textContent)||__privateGet(this,_pathname)}return title}clearScrollState(){__privateGet(this,_scrollState).x=0,__privateGet(this,_scrollState).y=0}clearDocumentState(){__privateSet(this,_modifiedDocument,null)}saveScrollState(){__privateGet(this,_initialDocument).documentElement.hasAttribute("data-no-scroll-restoration")?(__privateGet(this,_scrollState).x=0,__privateGet(this,_scrollState).y=0):(__privateGet(this,_scrollState).x=__privateGet(this,_morph2).scrollValue.left,__privateGet(this,_scrollState).y=__privateGet(this,_morph2).scrollValue.top)}restoreScrollPosition(){__privateGet(this,_morph2).scrollElement.scroll({top:__privateGet(this,_scrollState).y,left:__privateGet(this,_scrollState).x,behavior:"instant"})}saveDocumentState(){__privateGet(this,_initialDocument).documentElement.hasAttribute("data-no-page-restoration")?__privateSet(this,_modifiedDocument,null):__privateSet(this,_modifiedDocument,document.cloneNode(!0))}renewScrollPosition(){__privateGet(this,_morph2).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(state){__privateSet(this,_savedState,state)}clearState(){const state=__privateGet(this,_savedState);return __privateSet(this,_savedState,null),state}};_morph2=new WeakMap,_pathname=new WeakMap,_scrollState=new WeakMap,_initialDocument=new WeakMap,_modifiedDocument=new WeakMap,_currentDocument=new WeakMap,_savedState=new WeakMap,_abortController=new WeakMap,_fetching=new WeakMap,_headers=new WeakMap,_needRavalidation=new WeakMap,__name(_MorphRoute,"MorphRoute");let MorphRoute=_MorphRoute;var _options,_morphElements,_links,_candidateURL,_currentURL,_previousURL,_promises,_isPopstateNavigation,_currentScrollElement,_isWindowScroll,_routes,_paramDependent,_announcer,_currentScrollX,_currentScrollY,_lastSubmorph,_lastRevalidate,_lastKeepScrollPosition,_checkLink,_Morph_instances,getRoute_fn,getMorphElements_fn,isElementEmitsLoadEvent_fn,updateCurrentScrollElement_fn,tryScrollToElement_fn,_popStateListener,_scrollListener;const _Morph=class _Morph{constructor(parameters){__privateAdd(this,_Morph_instances);__privateAdd(this,_options,null);__privateAdd(this,_morphElements,null);__privateAdd(this,_links,[]);__privateAdd(this,_candidateURL);__privateAdd(this,_currentURL,null);__privateAdd(this,_previousURL);__privateAdd(this,_promises,[]);__privateAdd(this,_isPopstateNavigation,!1);__privateAdd(this,_currentScrollElement,null);__privateAdd(this,_isWindowScroll,!1);__privateAdd(this,_routes,new Map);__privateAdd(this,_paramDependent,[]);__privateAdd(this,_announcer,null);__privateAdd(this,_currentScrollX,0);__privateAdd(this,_currentScrollY,0);__privateAdd(this,_lastSubmorph);__privateAdd(this,_lastRevalidate);__privateAdd(this,_lastKeepScrollPosition);__privateAdd(this,_checkLink,__name(element=>{var _a,_b;return(((_a=element.getAttribute("href"))==null?void 0:_a.startsWith("/"))||((_b=element.getAttribute("href"))==null?void 0:_b.startsWith("?")))&&!element.hasAttribute("download")&&!element.hasAttribute("data-morph-skip")&&!element.closest("[data-morph-skip]")&&element.getAttribute("target")!=="_blank"},"#checkLink"));__privateAdd(this,_popStateListener,__name(event=>__async(this,null,function*(){event.preventDefault(),__privateSet(this,_isPopstateNavigation,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:__privateGet(this,_lastRevalidate)?void 0:__privateGet(this,_lastSubmorph),revalidate:__privateGet(this,_lastRevalidate),keepScrollPosition:__privateGet(this,_lastKeepScrollPosition)}),__privateSet(this,_isPopstateNavigation,!1)}),"#popStateListener"));__privateAdd(this,_scrollListener,__name(()=>{const{left,top}=this.scrollValue,directionY=top-__privateGet(this,_currentScrollY),directionX=left-__privateGet(this,_currentScrollX);__privateSet(this,_currentScrollY,top),__privateSet(this,_currentScrollX,left),document.documentElement.classList.toggle("scroll-y",top>0),document.documentElement.classList.toggle("scroll-x",left>0),document.documentElement.classList.toggle("scroll-y-forward",directionY>0),document.documentElement.classList.toggle("scroll-y-backward",directionY<0),document.documentElement.classList.toggle("scroll-x-forward",directionX>0),document.documentElement.classList.toggle("scroll-x-backward",directionX<0),events.dispatchEvent(document,"morphScroll",{detail:{left,top}})},"#scrollListener"));if(intersector_index.isBrowser&&!_Morph.instance){_Morph.instance=this,__privateSet(this,_options,{base:url.normalizeBase(parameters==null?void 0:parameters.base),waitForHeadToLoad:(parameters==null?void 0:parameters.waitForHeadToLoad)!==!1,trailingSlash:(parameters==null?void 0:parameters.trailingSlash)||!1,scrollSelector:parameters==null?void 0:parameters.scrollSelector,morphInsideScrollContainer:(parameters==null?void 0:parameters.morphInsideScrollContainer)||!1}),__privateSet(this,_morphElements,__privateMethod(this,_Morph_instances,getMorphElements_fn).call(this,document.body));const normalizedURL=this.normalizePath(location.pathname+location.search+location.hash);__privateSet(this,_currentURL,normalizedURL);const initialRoute=new MorphRoute(this,__privateGet(this,_currentURL).pathname);initialRoute.setInitialDocument(document),__privateGet(this,_routes).set(__privateGet(this,_currentURL).pathname,initialRoute),document.documentElement.setAttribute("data-current-pathname",__privateGet(this,_currentURL).pathname),document.documentElement.setAttribute("data-current-leaf",normalizedURL.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",__privateGet(this,_popStateListener)),url.changeHistory({action:"replace",pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters,hash:normalizedURL.hash}),__privateSet(this,_announcer,new MorphAnnouncer),__privateMethod(this,_Morph_instances,updateCurrentScrollElement_fn).call(this,document)}}get currentURL(){return __privateGet(this,_currentURL)}get previousURL(){return __privateGet(this,_previousURL)}get links(){return __privateGet(this,_links)}get scrollElement(){return __privateGet(this,_currentScrollElement)}get isPopstateNavigation(){return __privateGet(this,_isPopstateNavigation)}get scrollValue(){let top=0,left=0;return __privateGet(this,_isWindowScroll)?(top=window.scrollY,left=window.scrollX):(top=__privateGet(this,_currentScrollElement).scrollTop,left=__privateGet(this,_currentScrollElement).scrollLeft),{top,left}}get isNavigating(){return!!__privateGet(this,_promises).length}saveState(state){const route=__privateGet(this,_routes).get(__privateGet(this,_currentURL).path);route&&route.saveState(state)}getState(){const route=__privateGet(this,_routes).get(__privateGet(this,_currentURL).path);return route==null?void 0:route.clearState()}normalizePath(path,options){return url.splitPath(path,{base:__privateGet(this,_options).base,trailingSlash:__privateGet(this,_options).trailingSlash,mergeParams:options!=null&&options.mergeParams?location.search:"",removeParams:options==null?void 0:options.removeParams})}prefetch(path,revalidate){return __async(this,null,function*(){var _a;if(__privateGet(this,_promises).length)return;path=((_a=this.pathnameModifier)==null?void 0:_a.call(this,path))||path;const route=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,path);route==null||route.fetch(path,__privateGet(this,_currentURL).path,revalidate)})}excludeHeadChild(child){return!1}setHeaders(path){}needRavalidation(path){const normalizedURL=this.normalizePath(path),route=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,normalizedURL.path);route==null||route.needRavalidation()}navigate(_0){return __async(this,arguments,function*(path,{historyAction="push",centerScroll,offsetScroll,scrollBehaviour,revalidate,keepSearchParameters,submorph,submorphAppend,clearState,keepScrollPosition,mergeParams,removeParams,detail,scrollTo}={}){var _a,_b,_c,_d;if(__privateGet(this,_promises).length)return;__privateSet(this,_lastSubmorph,submorph),__privateSet(this,_lastRevalidate,revalidate),__privateSet(this,_lastKeepScrollPosition,keepScrollPosition);const modifiedPath=((_a=this.pathnameModifier)==null?void 0:_a.call(this,path))||path,normalizedURL=this.normalizePath(modifiedPath,{mergeParams,removeParams});if(!revalidate&&(((_b=__privateGet(this,_candidateURL))==null?void 0:_b.pathname)===normalizedURL.pathname||__privateGet(this,_currentURL).pathname===normalizedURL.pathname)){keepScrollPosition||__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,scrollTo||normalizedURL.hash||0,{centerScroll,offsetScroll,behavior:"smooth"}),events.dispatchEvent(document,"morphSamePath",{detail:{detail}}),((_c=__privateGet(this,_currentURL))==null?void 0:_c.parameters)!==normalizedURL.parameters&&(__privateSet(this,_previousURL,__privateGet(this,_currentURL)),__privateSet(this,_currentURL,normalizedURL),url.changeHistory({action:((_d=__privateGet(this,_currentURL))==null?void 0:_d.hash)!==normalizedURL.hash?"replace":historyAction,pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters,hash:normalizedURL.hash}),events.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:__privateGet(this,_currentURL),previousURL:__privateGet(this,_previousURL),detail}})),__privateGet(this,_links).forEach(link=>{link.checkCurrent(normalizedURL.path)});return}else __privateGet(this,_links).forEach(link=>{link.checkCurrent(normalizedURL.path)});__privateSet(this,_candidateURL,normalizedURL);try{let preprocessedSuccesfully=!0;if(this.preprocessor)try{yield new Promise((resolve,reject)=>{var _a2;(_a2=this.preprocessor)==null||_a2.call(this,{url:normalizedURL,resolve,reject,submorph,detail})})}catch(e){e?console.error(e):console.log("Route change canceled"),preprocessedSuccesfully=!1}if(!preprocessedSuccesfully||__privateGet(this,_candidateURL).pathname!==normalizedURL.pathname){__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)});return}const navigationEntry={url:normalizedURL,submorph,detail};submorph?submorphAppend||submorph.forEach(sel=>{document.querySelectorAll(sel).forEach(el=>{el.classList.add("out"),el.setAttribute("data-morph-out","")})}):__privateGet(this,_morphElements).forEach(el=>{var _a2,_b2;(_a2=el.firstElementChild)==null||_a2.classList.add("out"),(_b2=el.firstElementChild)==null||_b2.setAttribute("data-morph-out","")}),events.dispatchEvent(document,"morphNavigation",{detail:navigationEntry});const currentRoute=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,__privateGet(this,_currentURL).pathname),nextRoute=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,normalizedURL.pathname);if(__privateGet(this,_routes).forEach(el=>{el.pathname!==normalizedURL.pathname&&el.abort()}),yield nextRoute==null?void 0:nextRoute.fetch(modifiedPath,__privateGet(this,_currentURL).path,revalidate),__privateGet(this,_candidateURL).pathname!==normalizedURL.pathname){__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)});return}currentRoute.clearState(),currentRoute.saveScrollState(),currentRoute.saveDocumentState(),(!__privateGet(this,_isPopstateNavigation)||revalidate)&&(nextRoute.clearScrollState(),nextRoute.clearDocumentState()),clearState&&nextRoute.clearState(),nextRoute.cloneDocument(),__privateGet(this,_announcer).textContent=nextRoute.title,document.body.appendChild(__privateGet(this,_announcer));const documentFetchedEntry=__spreadProps(__spreadValues({},navigationEntry),{document:nextRoute.document});submorphAppend||documentFetchedEntry.document.querySelectorAll("[data-morph-out]").forEach(el=>{el.classList.remove("out")}),events.dispatchEvent(document,"morphStart",{detail:documentFetchedEntry});const currentHeadChildren=Array.from(document.head.children),newHeadChildren=Array.from(nextRoute.document.head.children),identicalHeadChildren=dom.intersectElements(currentHeadChildren,newHeadChildren),removeHeadChildren=dom.excludeElements(currentHeadChildren,identicalHeadChildren),addHeadChildren=dom.excludeElements(newHeadChildren,identicalHeadChildren).filter(child=>!this.excludeHeadChild(child));addHeadChildren.forEach((child,index)=>{child.tagName==="SCRIPT"&&(addHeadChildren[index]=dom.createScriptElement(child))}),addHeadChildren.forEach(child=>{document.head.appendChild(child)});const elementsWithLoad=addHeadChildren.filter(child=>{if(child.hasAttribute("data-no-waiting"))return!1;if(__privateMethod(this,_Morph_instances,isElementEmitsLoadEvent_fn).call(this,child))return!0});__privateGet(this,_options).waitForHeadToLoad&&elementsWithLoad.length&&(yield new Promise(res=>__async(this,null,function*(){let counter=0;try{for(var iter=__forAwait(elementsWithLoad),more,temp,error;more=!(temp=yield iter.next()).done;more=!1){const element=temp.value;element.onload=()=>{counter++,counter===elementsWithLoad.length&&res()}}}catch(temp){error=[temp]}finally{try{more&&(temp=iter.return)&&(yield temp.call(iter))}finally{if(error)throw error[0]}}}))),yield scroll.wait(10);const oldElementsWithLoadEvent=[];submorphAppend||removeHeadChildren.forEach(child=>{child.hasAttribute("data-permanent")||(__privateMethod(this,_Morph_instances,isElementEmitsLoadEvent_fn).call(this,child)?oldElementsWithLoadEvent.push(child):child.remove())});const newMorphElements=__privateMethod(this,_Morph_instances,getMorphElements_fn).call(this,nextRoute.document.body);!__privateGet(this,_options).morphInsideScrollContainer&&!submorph&&__privateMethod(this,_Morph_instances,updateCurrentScrollElement_fn).call(this,nextRoute.document),document.documentElement.setAttribute("data-current-pathname",normalizedURL.pathname),document.documentElement.setAttribute("data-current-leaf",normalizedURL.leaf),url.changeHistory({action:historyAction,pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters||(keepSearchParameters?location.search:""),hash:normalizedURL.hash}),__privateGet(this,_announcer).remove(),__privateSet(this,_previousURL,__privateGet(this,_currentURL)),__privateSet(this,_currentURL,normalizedURL);const morphedElements=[];__privateGet(this,_morphElements).forEach((morphElement,i)=>{const newMorphElement=newMorphElements[i],duration=getComputedStyle(morphElement).getPropertyValue("--morph-duration");let newMorphElementChildNodes=[],currentMorphElementChildNodes=[];submorph?(submorph.forEach(selector=>{const curSubMorphElement=morphElement.querySelector(selector),newSubMorphElement=newMorphElement.querySelector(selector);curSubMorphElement&&newSubMorphElement&&(currentMorphElementChildNodes.push(curSubMorphElement),newMorphElementChildNodes.push(newSubMorphElement))}),currentMorphElementChildNodes.forEach(el=>{el.parentElement&&morphedElements.push(el.parentElement)})):(newMorphElementChildNodes.push(...newMorphElement.childNodes),currentMorphElementChildNodes.push(...morphElement.childNodes),morphedElements.push(morphElement));const transfer=[];submorphAppend||currentMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&(this.destroyOldLinks(element),element.classList.add("old"),element.querySelectorAll("[data-morph-transfer]").forEach(el=>{const selector=el.getAttribute("data-morph-transfer");transfer.push({element:el,selector})}))}),newMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&(transfer.forEach(item=>{const nestlement=element.querySelector(item.selector);nestlement&&nestlement.replaceWith(nextRoute.document.importNode(item.element,!0))}),this.findNewLinks(element),element.classList.add("new"))}),submorph?submorphAppend?newMorphElementChildNodes.forEach((el,i2)=>{currentMorphElementChildNodes[i2]instanceof HTMLElement&&currentMorphElementChildNodes[i2].append(...el.childNodes)}):newMorphElementChildNodes.forEach((el,i2)=>{var _a2;(_a2=currentMorphElementChildNodes[i2].parentElement)==null||_a2.insertBefore(el,currentMorphElementChildNodes[i2])}):morphElement.prepend(...newMorphElementChildNodes),setTimeout(()=>{submorphAppend||currentMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&element.classList.add("old-idle")}),newMorphElementChildNodes.forEach(element=>{var _a2;element instanceof HTMLElement&&((_a2=element.parentElement)==null||_a2.style.setProperty("--new-content-height",element.offsetHeight+"px"),element.classList.add("new-idle"))})},0);const detail2=__spreadProps(__spreadValues({},documentFetchedEntry),{morphElement});events.dispatchEvent(document,"morphNewChildrenAdded",{detail:detail2});const promise=new Promise(res=>{setTimeout(()=>{submorphAppend||currentMorphElementChildNodes.forEach(el=>{el.remove()}),newMorphElementChildNodes.forEach(element=>{var _a2;element instanceof HTMLElement&&((_a2=element.parentElement)==null||_a2.style.removeProperty("--new-content-height"),element.classList.remove("new-idle","new"))}),submorphAppend||events.dispatchEvent(document,"morphOldChildrenRemoved",{detail:detail2}),res()},(parseFloat(duration)||0)*1e3+10)});__privateGet(this,_promises).push(promise)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-nextRoute.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),events.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:nextRoute.scrollState}),scrollTo?(nextRoute.clearScrollState(),__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,scrollTo,{centerScroll,offsetScroll,behavior:scrollBehaviour})):normalizedURL.hash?(nextRoute.clearScrollState(),__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,normalizedURL.hash,{centerScroll,offsetScroll,behavior:scrollBehaviour})):__privateGet(this,_isPopstateNavigation)?nextRoute.restoreScrollPosition():keepScrollPosition||nextRoute.renewScrollPosition(),yield Promise.all(__privateGet(this,_promises)),submorphAppend||oldElementsWithLoadEvent.forEach(child=>child.remove()),__privateSet(this,_promises,[]),morphedElements.forEach(el=>{el.querySelectorAll("script").forEach(element=>{element.replaceWith(dom.createScriptElement(element))})}),__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)}),this.findParamsDependent(),events.dispatchEvent(document,"morphComplete",{detail:documentFetchedEntry}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(e){console.error(e)}__privateSet(this,_candidateURL,void 0)})}addLink(element){__privateGet(this,_links).push(new MorphLink(element,this))}addLinks(elements){elements.forEach(element=>{this.addLink(element)})}removeLink(element){__privateSet(this,_links,__privateGet(this,_links).filter(link=>link.element===element?(link.destroy(),!1):!0))}destroyOldLinks(morphElement){__privateSet(this,_links,__privateGet(this,_links).filter(link=>morphElement.contains(link.element)?(link.destroy(),!1):!0))}findNewLinks(morphElement){const linkElements=[...morphElement.querySelectorAll("a")].filter(__privateGet(this,_checkLink));__privateGet(this,_links).push(...linkElements.map(element=>new MorphLink(element,this)))}findLinks(){const linkElements=[...document.documentElement.querySelectorAll("a")].filter(__privateGet(this,_checkLink));__privateGet(this,_links).forEach(link=>link.destroy()),__privateSet(this,_links,linkElements.map(element=>new MorphLink(element,this)))}findParamsDependent(){const elements=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];__privateGet(this,_paramDependent).forEach(link=>link.destroy()),__privateSet(this,_paramDependent,elements.map(element=>new MorphParamsDependent(element)))}};_options=new WeakMap,_morphElements=new WeakMap,_links=new WeakMap,_candidateURL=new WeakMap,_currentURL=new WeakMap,_previousURL=new WeakMap,_promises=new WeakMap,_isPopstateNavigation=new WeakMap,_currentScrollElement=new WeakMap,_isWindowScroll=new WeakMap,_routes=new WeakMap,_paramDependent=new WeakMap,_announcer=new WeakMap,_currentScrollX=new WeakMap,_currentScrollY=new WeakMap,_lastSubmorph=new WeakMap,_lastRevalidate=new WeakMap,_lastKeepScrollPosition=new WeakMap,_checkLink=new WeakMap,_Morph_instances=new WeakSet,getRoute_fn=__name(function(path){const normalizedURL=this.normalizePath(path);let route=__privateGet(this,_routes).get(normalizedURL.pathname);return route||(route=new MorphRoute(this,normalizedURL.pathname),__privateGet(this,_routes).set(normalizedURL.pathname,route)),route},"#getRoute"),getMorphElements_fn=__name(function(el){const morphElements=[...el.querySelectorAll("[data-morph]")];return morphElements.length?morphElements:[el]},"#getMorphElements"),isElementEmitsLoadEvent_fn=__name(function(element){return element.tagName==="SCRIPT"||element.tagName==="STYLE"||element.tagName==="LINK"&&element.getAttribute("rel")==="stylesheet"},"#isElementEmitsLoadEvent"),updateCurrentScrollElement_fn=__name(function(document2){var _a,_b;(_a=__privateGet(this,_currentScrollElement))==null||_a.removeEventListener("scroll",__privateGet(this,_scrollListener)),__privateSet(this,_currentScrollY,0),__privateSet(this,_currentScrollX,0),__privateSet(this,_currentScrollElement,__privateGet(this,_options).scrollSelector&&document2.querySelector(__privateGet(this,_options).scrollSelector)||window),__privateSet(this,_isWindowScroll,__privateGet(this,_currentScrollElement)===window),(_b=__privateGet(this,_currentScrollElement))==null||_b.addEventListener("scroll",__privateGet(this,_scrollListener)),__privateGet(this,_scrollListener).call(this)},"#updateCurrentScrollElement"),tryScrollToElement_fn=__name(function(id,options){const value=typeof id=="string"?document.querySelector(id):id;(typeof value=="number"||value)&&scroll.scrollToElement(value,{scrollElement:__privateGet(this,_currentScrollElement),behavior:(options==null?void 0:options.behavior)||"instant",center:options==null?void 0:options.centerScroll,offset:options==null?void 0:options.offsetScroll})},"#tryScrollToElement"),_popStateListener=new WeakMap,_scrollListener=new WeakMap,__name(_Morph,"Morph"),_Morph.instance=null;let Morph=_Morph;exports.Morph=Morph;
1
+ "use strict";var __defProp=Object.defineProperty,__defProps=Object.defineProperties;var __getOwnPropDescs=Object.getOwnPropertyDescriptors;var __getOwnPropSymbols=Object.getOwnPropertySymbols;var __hasOwnProp=Object.prototype.hasOwnProperty,__propIsEnum=Object.prototype.propertyIsEnumerable;var __knownSymbol=(name,symbol)=>(symbol=Symbol[name])?symbol:Symbol.for("Symbol."+name),__typeError=msg=>{throw TypeError(msg)};var __defNormalProp=(obj,key,value)=>key in obj?__defProp(obj,key,{enumerable:!0,configurable:!0,writable:!0,value}):obj[key]=value,__spreadValues=(a,b)=>{for(var prop in b||(b={}))__hasOwnProp.call(b,prop)&&__defNormalProp(a,prop,b[prop]);if(__getOwnPropSymbols)for(var prop of __getOwnPropSymbols(b))__propIsEnum.call(b,prop)&&__defNormalProp(a,prop,b[prop]);return a},__spreadProps=(a,b)=>__defProps(a,__getOwnPropDescs(b)),__name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);var __async=(__this,__arguments,generator)=>new Promise((resolve,reject)=>{var fulfilled=value=>{try{step(generator.next(value))}catch(e){reject(e)}},rejected=value=>{try{step(generator.throw(value))}catch(e){reject(e)}},step=x=>x.done?resolve(x.value):Promise.resolve(x.value).then(fulfilled,rejected);step((generator=generator.apply(__this,__arguments)).next())});var __forAwait=(obj,it,method)=>(it=obj[__knownSymbol("asyncIterator")])?it.call(obj):(obj=obj[__knownSymbol("iterator")](),it={},method=(key,fn)=>(fn=obj[key])&&(it[key]=arg=>new Promise((yes,no,done)=>(arg=fn.call(obj,arg),done=arg.done,Promise.resolve(arg.value).then(value=>yes({value,done}),no)))),method("next"),method("return"),it);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const intersector_index=require("../index-DZ44osDT.cjs"),dom=require("../dom-B40i6NXw.cjs"),events=require("../events-UlGk63iC.cjs"),promises=require("../promises-nDm8_iG6.cjs"),scroll=require("../scroll-BtUpTUwr.cjs");require("construct-style-sheets-polyfill");const url=require("../url-CPCO10Sy.cjs"),cssValueParser_index=require("../css-value-parser/index.cjs"),string=require("../string-CbRNzmd9.cjs"),_MorphAnnouncer=class _MorphAnnouncer extends HTMLElement{connectedCallback(){const attrs={"aria-live":"assertive","aria-atomic":"true",style:"position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px"};for(const[key,value]of Object.entries(attrs))this.setAttribute(key,value)}};__name(_MorphAnnouncer,"MorphAnnouncer");let MorphAnnouncer=_MorphAnnouncer;intersector_index.isBrowser&&!customElements.get("morph-announcer")&&customElements.define("morph-announcer",MorphAnnouncer);var _morph,_element,_MorphLink_instances,path_get,click_fn,_clickListener,_pointerListener;const _MorphLink=class _MorphLink{constructor(element,morph){__privateAdd(this,_MorphLink_instances);__privateAdd(this,_morph);__privateAdd(this,_element);__privateAdd(this,_clickListener,__name(e=>{e.preventDefault(),__privateMethod(this,_MorphLink_instances,click_fn).call(this)},"#clickListener"));__privateAdd(this,_pointerListener,__name(()=>{const revalidate=__privateGet(this,_element).hasAttribute("data-revalidate");__privateGet(this,_morph).prefetch(__privateGet(this,_MorphLink_instances,path_get),revalidate),__privateGet(this,_element).removeEventListener("pointerenter",__privateGet(this,_pointerListener))},"#pointerListener"));__privateSet(this,_morph,morph),__privateSet(this,_element,element),__privateGet(this,_element).addEventListener("click",__privateGet(this,_clickListener)),this.checkCurrent(location.href.replace(location.origin,"")),__privateGet(this,_element).hasAttribute("data-prefetch")&&__privateGet(this,_element).addEventListener("pointerenter",__privateGet(this,_pointerListener))}get element(){return __privateGet(this,_element)}checkCurrent(path){var _a,_b;const locationUrl=__privateGet(this,_morph).normalizePath(path),linkUrl=__privateGet(this,_morph).normalizePath(__privateGet(this,_MorphLink_instances,path_get));__privateGet(this,_element).hasAttribute("data-include")&&locationUrl.pathname.includes(linkUrl.pathname)?__privateGet(this,_element).classList.add("current"):linkUrl.pathname===locationUrl.pathname?__privateGet(this,_element).classList.add("current"):(_a=__privateGet(this,_element).getAttribute("data-associated-paths"))!=null&&_a.split(",").find(path2=>locationUrl.pathname.includes(path2))?__privateGet(this,_element).classList.add("current"):__privateGet(this,_element).classList.remove("current"),locationUrl.path===linkUrl.path?__privateGet(this,_element).classList.add("exact"):__privateGet(this,_element).classList.remove("exact");const[pathWithoutParams,pathParamsStr]=(_b=__privateGet(this,_MorphLink_instances,path_get).split("#")[0])==null?void 0:_b.split("?"),pathParams=new URLSearchParams(pathParamsStr),locationParams=new URLSearchParams(location.search);let matchCounter=0;for(const[key]of locationParams)pathParams.has(key)&&locationParams.get(key)===pathParams.get(key)&&matchCounter++;matchCounter?(__privateGet(this,_element).classList.toggle("all-params-matched",locationParams.size===matchCounter),__privateGet(this,_element).classList.toggle("some-params-matched",locationParams.size!==matchCounter)):!locationParams.size&&__privateGet(this,_element).hasAttribute("data-match-no-params")?__privateGet(this,_element).classList.add("all-params-matched"):(__privateGet(this,_element).classList.remove("all-params-matched"),__privateGet(this,_element).classList.remove("some-params-matched"));for(const key in __privateGet(this,_element).dataset){const kebabKey=string.camelToKebab(key);if(kebabKey.startsWith("match-param-")){const name=kebabKey.split("match-param-")[1],value=__privateGet(this,_element).dataset[key],className=`param-${name}-matched`;locationParams.has(name)&&locationParams.get(name)===value||!locationParams.has(name)&&(value===""||value==="*"||value==="all"||value==="any"||value==="vse")?__privateGet(this,_element).classList.add(className):__privateGet(this,_element).classList.remove(className)}}}destroy(){__privateGet(this,_element).removeEventListener("click",__privateGet(this,_clickListener)),__privateGet(this,_element).removeEventListener("pointerenter",__privateGet(this,_pointerListener)),__privateGet(this,_element).classList.remove("current","exact")}};_morph=new WeakMap,_element=new WeakMap,_MorphLink_instances=new WeakSet,path_get=__name(function(){const url2=new URL(__privateGet(this,_element).href);return __privateGet(this,_morph).normalizePath(url2.pathname+url2.search+url2.hash).path},"#path"),click_fn=__name(function(){var _a;if(document.documentElement.classList.contains("click-disabled"))return;if(__privateGet(this,_element).hasAttribute("data-back")&&__privateGet(this,_morph).previousURL)history.back();else{const historyAction=__privateGet(this,_element).getAttribute("data-history-action")||"push",centerScroll=__privateGet(this,_element).hasAttribute("data-center-scroll"),offsetScrollRawValue=getComputedStyle(__privateGet(this,_element)).getPropertyValue("--offset-scroll").trim(),offsetScroll=offsetScrollRawValue?cssValueParser_index.cssValueParser.parse(offsetScrollRawValue):void 0,revalidate=__privateGet(this,_element).hasAttribute("data-revalidate")||__privateGet(this,_element).hasAttribute("data-pagination-more-link")||__privateGet(this,_element).hasAttribute("data-pagination-set-link")||__privateGet(this,_element).hasAttribute("data-pagination-next-link")||__privateGet(this,_element).hasAttribute("data-pagination-prev-link"),keepSearchParameters=__privateGet(this,_element).hasAttribute("data-keep-search-parameters"),keepScrollPosition=__privateGet(this,_element).hasAttribute("data-keep-scroll-position")||__privateGet(this,_element).hasAttribute("data-pagination-more-link"),scrollBehaviour=__privateGet(this,_element).getAttribute("data-scroll-behaviour"),submorph=(_a=__privateGet(this,_element).getAttribute("data-submorph")||__privateGet(this,_element).getAttribute("data-submorph-append"))==null?void 0:_a.split(",").map(v=>v.trim()),clearState=__privateGet(this,_element).hasAttribute("data-clear-state");let path=__privateGet(this,_MorphLink_instances,path_get);if(__privateGet(this,_element).hasAttribute("data-toggle-params")){const[pathWithoutParams,pathParamsStr]=__privateGet(this,_MorphLink_instances,path_get).split("?"),pathParams=new URLSearchParams(pathParamsStr),locationParams=new URLSearchParams(location.search),resultParams=new URLSearchParams;for(const[key]of pathParams)(!locationParams.has(key)||locationParams.has(key)&&locationParams.get(key)!==pathParams.get(key))&&resultParams.append(key,pathParams.get(key));if(__privateGet(this,_element).hasAttribute("data-merge-params"))for(const[key]of locationParams)pathParams.has(key)||resultParams.append(key,locationParams.get(key));path=`${pathWithoutParams}?${resultParams.toString()}`}__privateGet(this,_morph).navigate(path,{historyAction,centerScroll,offsetScroll,revalidate,keepSearchParameters,submorph,clearState,keepScrollPosition,scrollBehaviour,submorphAppend:__privateGet(this,_element).hasAttribute("data-submorph-append"),mergeParams:__privateGet(this,_element).hasAttribute("data-merge-params")&&!__privateGet(this,_element).hasAttribute("data-toggle-params"),detail:__privateGet(this,_element).getAttribute("data-detail"),removeParams:__privateGet(this,_element).getAttribute("data-remove-params")||void 0,scrollTo:__privateGet(this,_element).getAttribute("data-scroll-to")||void 0})}},"#click"),_clickListener=new WeakMap,_pointerListener=new WeakMap,__name(_MorphLink,"MorphLink");let MorphLink=_MorphLink;var _element2,_params,_MorphParamsDependent_instances,update_fn,_urlChangeListener;const _MorphParamsDependent=class _MorphParamsDependent{constructor(element){__privateAdd(this,_MorphParamsDependent_instances);__privateAdd(this,_element2);__privateAdd(this,_params,[]);__privateAdd(this,_urlChangeListener,__name(()=>{__privateMethod(this,_MorphParamsDependent_instances,update_fn).call(this)},"#urlChangeListener"));__privateSet(this,_element2,element);for(const key in __privateGet(this,_element2).dataset){const kebabKey=string.camelToKebab(key);if(kebabKey.startsWith("param-")){const name=kebabKey.split("param-")[1],value=__privateGet(this,_element2).dataset[key];__privateGet(this,_params).push({name,value})}}document.addEventListener("morphURLParametersChange",__privateGet(this,_urlChangeListener)),__privateMethod(this,_MorphParamsDependent_instances,update_fn).call(this)}destroy(){document.removeEventListener("morphURLParametersChange",__privateGet(this,_urlChangeListener))}};_element2=new WeakMap,_params=new WeakMap,_MorphParamsDependent_instances=new WeakSet,update_fn=__name(function(){const locationParams=new URLSearchParams(location.search);let matched=!!__privateGet(this,_params).find(param=>locationParams.has(param.name)&&(locationParams.get(param.name)===param.value||param.value==="*"||param.value==="all"||param.value==="any"||param.value==="vse"||locationParams.get(param.name)==="*"||locationParams.get(param.name)==="all"||locationParams.get(param.name)==="any"||locationParams.get(param.name)==="vse"));!matched&&__privateGet(this,_element2).hasAttribute("data-match-no-params")&&(matched=!__privateGet(this,_params).filter(param=>locationParams.has(param.name)).length);const hideClass=__privateGet(this,_element2).getAttribute("data-hide-class");matched?hideClass?__privateGet(this,_element2).classList.remove(hideClass):__privateGet(this,_element2).style.display="":hideClass?__privateGet(this,_element2).classList.add(hideClass):__privateGet(this,_element2).style.display="none",requestAnimationFrame(()=>{window.dispatchEvent(new CustomEvent("resize"))})},"#update"),_urlChangeListener=new WeakMap,__name(_MorphParamsDependent,"MorphParamsDependent");let MorphParamsDependent=_MorphParamsDependent;const domParser=new DOMParser;var _morph2,_pathname,_scrollState,_initialDocument,_modifiedDocument,_currentDocument,_savedState,_abortController,_fetching,_headers,_needRavalidation;const _MorphRoute=class _MorphRoute{constructor(morph,pathname){__privateAdd(this,_morph2);__privateAdd(this,_pathname);__privateAdd(this,_scrollState,{x:0,y:0});__privateAdd(this,_initialDocument,null);__privateAdd(this,_modifiedDocument,null);__privateAdd(this,_currentDocument,null);__privateAdd(this,_savedState,null);__privateAdd(this,_abortController,null);__privateAdd(this,_fetching,null);__privateAdd(this,_headers);__privateAdd(this,_needRavalidation,!1);__privateSet(this,_morph2,morph),__privateSet(this,_pathname,pathname)}get pathname(){return __privateGet(this,_pathname)}get scrollState(){return __privateGet(this,_scrollState)}get document(){return __privateGet(this,_currentDocument)}needRavalidation(){__privateSet(this,_needRavalidation,!0)}setHeaders(headers){__privateSet(this,_headers,headers)}setInitialDocument(document2){__privateSet(this,_initialDocument,document2.cloneNode(!0))}abort(){var _a;return(_a=__privateGet(this,_abortController))==null?void 0:_a.abort(`[${__privateGet(this,_pathname)}] page loading cancelled`)}fetch(path,currentPath,revalidate){return __async(this,null,function*(){var _a;if(!revalidate&&!__privateGet(this,_needRavalidation)){const shouldUseCache=((_a=__privateGet(this,_initialDocument))==null?void 0:_a.documentElement.getAttribute("data-cache"))&&currentPath!==path,isPopstateNavigation=__privateGet(this,_initialDocument)&&__privateGet(this,_morph2).isPopstateNavigation;if(__privateGet(this,_fetching)||shouldUseCache||isPopstateNavigation)return __privateGet(this,_fetching)}return __privateSet(this,_fetching,new Promise(res=>__async(this,null,function*(){try{__privateSet(this,_abortController,new AbortController);const text=yield(yield fetch(path,{signal:__privateGet(this,_abortController).signal,headers:__spreadValues({"X-MORPH":"true","X-MORPH-REVALIDATE":revalidate?"true":"false","X-MORPH-CURRENT-PATH":encodeURIComponent(currentPath),"X-MORPH-NEW-PATH":encodeURIComponent(path)},__privateGet(this,_headers))})).text(),document2=domParser.parseFromString(text,"text/html");this.setInitialDocument(document2),__privateSet(this,_needRavalidation,!1)}catch(e){console.warn(e)}finally{__privateSet(this,_abortController,null),__privateSet(this,_fetching,null),res()}}))),__privateGet(this,_fetching)})}cloneDocument(){__privateSet(this,_currentDocument,(__privateGet(this,_modifiedDocument)||__privateGet(this,_initialDocument)).cloneNode(!0))}get title(){let title="";if(__privateGet(this,_currentDocument).title)title=__privateGet(this,_currentDocument).title;else{const h1=__privateGet(this,_currentDocument).querySelector("h1");title=(h1==null?void 0:h1.innerText)||(h1==null?void 0:h1.textContent)||__privateGet(this,_pathname)}return title}clearScrollState(){__privateGet(this,_scrollState).x=0,__privateGet(this,_scrollState).y=0}clearDocumentState(){__privateSet(this,_modifiedDocument,null)}saveScrollState(){__privateGet(this,_initialDocument).documentElement.hasAttribute("data-no-scroll-restoration")?(__privateGet(this,_scrollState).x=0,__privateGet(this,_scrollState).y=0):(__privateGet(this,_scrollState).x=__privateGet(this,_morph2).scrollValue.left,__privateGet(this,_scrollState).y=__privateGet(this,_morph2).scrollValue.top)}restoreScrollPosition(){__privateGet(this,_morph2).scrollElement.scroll({top:__privateGet(this,_scrollState).y,left:__privateGet(this,_scrollState).x,behavior:"instant"})}saveDocumentState(){__privateGet(this,_initialDocument).documentElement.hasAttribute("data-no-page-restoration")?__privateSet(this,_modifiedDocument,null):__privateSet(this,_modifiedDocument,document.cloneNode(!0))}renewScrollPosition(){__privateGet(this,_morph2).scrollElement.scroll({top:0,left:0,behavior:"instant"})}saveState(state){__privateSet(this,_savedState,state)}clearState(){const state=__privateGet(this,_savedState);return __privateSet(this,_savedState,null),state}};_morph2=new WeakMap,_pathname=new WeakMap,_scrollState=new WeakMap,_initialDocument=new WeakMap,_modifiedDocument=new WeakMap,_currentDocument=new WeakMap,_savedState=new WeakMap,_abortController=new WeakMap,_fetching=new WeakMap,_headers=new WeakMap,_needRavalidation=new WeakMap,__name(_MorphRoute,"MorphRoute");let MorphRoute=_MorphRoute;var _options,_morphElements,_links,_candidateURL,_currentURL,_previousURL,_promises,_isPopstateNavigation,_currentScrollElement,_isWindowScroll,_routes,_paramDependent,_announcer,_currentScrollX,_currentScrollY,_lastSubmorph,_lastRevalidate,_lastKeepScrollPosition,_checkLink,_Morph_instances,getRoute_fn,getMorphElements_fn,isElementEmitsLoadEvent_fn,updateCurrentScrollElement_fn,tryScrollToElement_fn,_popStateListener,_scrollListener;const _Morph=class _Morph{constructor(parameters){__privateAdd(this,_Morph_instances);__privateAdd(this,_options,null);__privateAdd(this,_morphElements,null);__privateAdd(this,_links,[]);__privateAdd(this,_candidateURL);__privateAdd(this,_currentURL,null);__privateAdd(this,_previousURL);__privateAdd(this,_promises,[]);__privateAdd(this,_isPopstateNavigation,!1);__privateAdd(this,_currentScrollElement,null);__privateAdd(this,_isWindowScroll,!1);__privateAdd(this,_routes,new Map);__privateAdd(this,_paramDependent,[]);__privateAdd(this,_announcer,null);__privateAdd(this,_currentScrollX,0);__privateAdd(this,_currentScrollY,0);__privateAdd(this,_lastSubmorph);__privateAdd(this,_lastRevalidate);__privateAdd(this,_lastKeepScrollPosition);__privateAdd(this,_checkLink,__name(element=>{var _a,_b;return(((_a=element.getAttribute("href"))==null?void 0:_a.startsWith("/"))||((_b=element.getAttribute("href"))==null?void 0:_b.startsWith("?")))&&!element.hasAttribute("download")&&!element.hasAttribute("data-morph-skip")&&!element.closest("[data-morph-skip]")&&element.getAttribute("target")!=="_blank"},"#checkLink"));__privateAdd(this,_popStateListener,__name(event=>__async(this,null,function*(){event.preventDefault(),__privateSet(this,_isPopstateNavigation,!0),yield this.navigate(location.href.replace(location.origin,""),{historyAction:"none",submorph:__privateGet(this,_lastRevalidate)?void 0:__privateGet(this,_lastSubmorph),revalidate:__privateGet(this,_lastRevalidate),keepScrollPosition:__privateGet(this,_lastKeepScrollPosition)}),__privateSet(this,_isPopstateNavigation,!1)}),"#popStateListener"));__privateAdd(this,_scrollListener,__name(()=>{const{left,top}=this.scrollValue,directionY=top-__privateGet(this,_currentScrollY),directionX=left-__privateGet(this,_currentScrollX);__privateSet(this,_currentScrollY,top),__privateSet(this,_currentScrollX,left),document.documentElement.classList.toggle("scroll-y",top>0),document.documentElement.classList.toggle("scroll-x",left>0),document.documentElement.classList.toggle("scroll-y-forward",directionY>0),document.documentElement.classList.toggle("scroll-y-backward",directionY<0),document.documentElement.classList.toggle("scroll-x-forward",directionX>0),document.documentElement.classList.toggle("scroll-x-backward",directionX<0),events.dispatchEvent(document,"morphScroll",{detail:{left,top}})},"#scrollListener"));if(intersector_index.isBrowser&&!_Morph.instance){_Morph.instance=this,__privateSet(this,_options,{base:url.normalizeBase(parameters==null?void 0:parameters.base),waitForHeadToLoad:(parameters==null?void 0:parameters.waitForHeadToLoad)!==!1,trailingSlash:(parameters==null?void 0:parameters.trailingSlash)||!1,scrollSelector:parameters==null?void 0:parameters.scrollSelector,morphInsideScrollContainer:(parameters==null?void 0:parameters.morphInsideScrollContainer)||!1}),__privateSet(this,_morphElements,__privateMethod(this,_Morph_instances,getMorphElements_fn).call(this,document.body));const normalizedURL=this.normalizePath(location.pathname+location.search+location.hash);__privateSet(this,_currentURL,normalizedURL);const initialRoute=new MorphRoute(this,__privateGet(this,_currentURL).pathname);initialRoute.setInitialDocument(document),__privateGet(this,_routes).set(__privateGet(this,_currentURL).pathname,initialRoute),document.documentElement.setAttribute("data-current-pathname",__privateGet(this,_currentURL).pathname),document.documentElement.setAttribute("data-current-leaf",normalizedURL.leaf),this.findLinks(),this.findParamsDependent(),history.scrollRestoration="manual",addEventListener("popstate",__privateGet(this,_popStateListener)),url.changeHistory({action:"replace",pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters,hash:normalizedURL.hash}),__privateSet(this,_announcer,new MorphAnnouncer),__privateMethod(this,_Morph_instances,updateCurrentScrollElement_fn).call(this,document)}}get currentURL(){return __privateGet(this,_currentURL)}get previousURL(){return __privateGet(this,_previousURL)}get links(){return __privateGet(this,_links)}get scrollElement(){return __privateGet(this,_currentScrollElement)}get isPopstateNavigation(){return __privateGet(this,_isPopstateNavigation)}get scrollValue(){let top=0,left=0;return __privateGet(this,_isWindowScroll)?(top=window.scrollY,left=window.scrollX):(top=__privateGet(this,_currentScrollElement).scrollTop,left=__privateGet(this,_currentScrollElement).scrollLeft),{top,left}}get isNavigating(){return!!__privateGet(this,_promises).length}saveState(state){const route=__privateGet(this,_routes).get(__privateGet(this,_currentURL).path);route&&route.saveState(state)}getState(){const route=__privateGet(this,_routes).get(__privateGet(this,_currentURL).path);return route==null?void 0:route.clearState()}normalizePath(path,options){return url.splitPath(path,{base:__privateGet(this,_options).base,trailingSlash:__privateGet(this,_options).trailingSlash,mergeParams:options!=null&&options.mergeParams?location.search:"",removeParams:options==null?void 0:options.removeParams})}prefetch(path,revalidate){return __async(this,null,function*(){var _a;if(__privateGet(this,_promises).length)return;path=((_a=this.pathnameModifier)==null?void 0:_a.call(this,path))||path;const route=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,path);route==null||route.fetch(path,__privateGet(this,_currentURL).path,revalidate)})}excludeHeadChild(child){return!1}setHeaders(path){}needRavalidation(path){const normalizedURL=this.normalizePath(path),route=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,normalizedURL.path);route==null||route.needRavalidation()}navigate(_0){return __async(this,arguments,function*(path,{historyAction="push",centerScroll,offsetScroll,scrollBehaviour,revalidate,keepSearchParameters,submorph,submorphAppend,clearState,keepScrollPosition,mergeParams,removeParams,detail,scrollTo}={}){var _a,_b,_c,_d;if(__privateGet(this,_promises).length)return;__privateSet(this,_lastSubmorph,submorph),__privateSet(this,_lastRevalidate,revalidate),__privateSet(this,_lastKeepScrollPosition,keepScrollPosition);const modifiedPath=((_a=this.pathnameModifier)==null?void 0:_a.call(this,path))||path,normalizedURL=this.normalizePath(modifiedPath,{mergeParams,removeParams});if(!revalidate&&(((_b=__privateGet(this,_candidateURL))==null?void 0:_b.pathname)===normalizedURL.pathname||__privateGet(this,_currentURL).pathname===normalizedURL.pathname)){keepScrollPosition||__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,scrollTo||normalizedURL.hash||0,{centerScroll,offsetScroll,behavior:"smooth"}),events.dispatchEvent(document,"morphSamePath",{detail:{detail}}),((_c=__privateGet(this,_currentURL))==null?void 0:_c.parameters)!==normalizedURL.parameters&&(__privateSet(this,_previousURL,__privateGet(this,_currentURL)),__privateSet(this,_currentURL,normalizedURL),url.changeHistory({action:((_d=__privateGet(this,_currentURL))==null?void 0:_d.hash)!==normalizedURL.hash?"replace":historyAction,pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters,hash:normalizedURL.hash}),events.dispatchEvent(document,"morphURLParametersChange",{detail:{newURL:__privateGet(this,_currentURL),previousURL:__privateGet(this,_previousURL),detail}})),__privateGet(this,_links).forEach(link=>{link.checkCurrent(normalizedURL.path)});return}else __privateGet(this,_links).forEach(link=>{link.checkCurrent(normalizedURL.path)});__privateSet(this,_candidateURL,normalizedURL);try{let preprocessedSuccesfully=!0;if(this.preprocessor)try{yield new Promise((resolve,reject)=>{var _a2;(_a2=this.preprocessor)==null||_a2.call(this,{url:normalizedURL,resolve,reject,submorph,detail})})}catch(e){e?console.error(e):console.log("Route change canceled"),preprocessedSuccesfully=!1}if(!preprocessedSuccesfully||__privateGet(this,_candidateURL).pathname!==normalizedURL.pathname){__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)});return}const navigationEntry={url:normalizedURL,submorph,detail};submorph?submorphAppend||submorph.forEach(sel=>{document.querySelectorAll(sel).forEach(el=>{el.classList.add("out"),el.setAttribute("data-morph-out","")})}):__privateGet(this,_morphElements).forEach(el=>{var _a2,_b2;(_a2=el.firstElementChild)==null||_a2.classList.add("out"),(_b2=el.firstElementChild)==null||_b2.setAttribute("data-morph-out","")}),events.dispatchEvent(document,"morphNavigation",{detail:navigationEntry});const currentRoute=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,__privateGet(this,_currentURL).pathname),nextRoute=__privateMethod(this,_Morph_instances,getRoute_fn).call(this,normalizedURL.pathname);if(__privateGet(this,_routes).forEach(el=>{el.pathname!==normalizedURL.pathname&&el.abort()}),yield nextRoute==null?void 0:nextRoute.fetch(modifiedPath,__privateGet(this,_currentURL).path,revalidate),__privateGet(this,_candidateURL).pathname!==normalizedURL.pathname){__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)});return}currentRoute.clearState(),currentRoute.saveScrollState(),currentRoute.saveDocumentState(),(!__privateGet(this,_isPopstateNavigation)||revalidate)&&(nextRoute.clearScrollState(),nextRoute.clearDocumentState()),clearState&&nextRoute.clearState(),nextRoute.cloneDocument(),__privateGet(this,_announcer).textContent=nextRoute.title,document.body.appendChild(__privateGet(this,_announcer));const documentFetchedEntry=__spreadProps(__spreadValues({},navigationEntry),{document:nextRoute.document});submorphAppend||documentFetchedEntry.document.querySelectorAll("[data-morph-out]").forEach(el=>{el.classList.remove("out")}),events.dispatchEvent(document,"morphStart",{detail:documentFetchedEntry});const currentHeadChildren=Array.from(document.head.children),newHeadChildren=Array.from(nextRoute.document.head.children),identicalHeadChildren=dom.intersectElements(currentHeadChildren,newHeadChildren),removeHeadChildren=dom.excludeElements(currentHeadChildren,identicalHeadChildren),addHeadChildren=dom.excludeElements(newHeadChildren,identicalHeadChildren).filter(child=>!this.excludeHeadChild(child));addHeadChildren.forEach((child,index)=>{child.tagName==="SCRIPT"&&(addHeadChildren[index]=dom.createScriptElement(child))}),addHeadChildren.forEach(child=>{document.head.appendChild(child)});const elementsWithLoad=addHeadChildren.filter(child=>{if(child.hasAttribute("data-no-waiting"))return!1;if(__privateMethod(this,_Morph_instances,isElementEmitsLoadEvent_fn).call(this,child))return!0});__privateGet(this,_options).waitForHeadToLoad&&elementsWithLoad.length&&(yield new Promise(res=>__async(this,null,function*(){let counter=0;try{for(var iter=__forAwait(elementsWithLoad),more,temp,error;more=!(temp=yield iter.next()).done;more=!1){const element=temp.value;element.onload=()=>{counter++,counter===elementsWithLoad.length&&res()}}}catch(temp){error=[temp]}finally{try{more&&(temp=iter.return)&&(yield temp.call(iter))}finally{if(error)throw error[0]}}}))),yield promises.wait(10);const oldElementsWithLoadEvent=[];submorphAppend||removeHeadChildren.forEach(child=>{child.hasAttribute("data-permanent")||(__privateMethod(this,_Morph_instances,isElementEmitsLoadEvent_fn).call(this,child)?oldElementsWithLoadEvent.push(child):child.remove())});const newMorphElements=__privateMethod(this,_Morph_instances,getMorphElements_fn).call(this,nextRoute.document.body);!__privateGet(this,_options).morphInsideScrollContainer&&!submorph&&__privateMethod(this,_Morph_instances,updateCurrentScrollElement_fn).call(this,nextRoute.document),document.documentElement.setAttribute("data-current-pathname",normalizedURL.pathname),document.documentElement.setAttribute("data-current-leaf",normalizedURL.leaf),url.changeHistory({action:historyAction,pathname:normalizedURL.pathname,searchParameters:normalizedURL.parameters||(keepSearchParameters?location.search:""),hash:normalizedURL.hash}),__privateGet(this,_announcer).remove(),__privateSet(this,_previousURL,__privateGet(this,_currentURL)),__privateSet(this,_currentURL,normalizedURL);const morphedElements=[];__privateGet(this,_morphElements).forEach((morphElement,i)=>{const newMorphElement=newMorphElements[i],duration=getComputedStyle(morphElement).getPropertyValue("--morph-duration");let newMorphElementChildNodes=[],currentMorphElementChildNodes=[];submorph?(submorph.forEach(selector=>{const curSubMorphElement=morphElement.querySelector(selector),newSubMorphElement=newMorphElement.querySelector(selector);curSubMorphElement&&newSubMorphElement&&(currentMorphElementChildNodes.push(curSubMorphElement),newMorphElementChildNodes.push(newSubMorphElement))}),currentMorphElementChildNodes.forEach(el=>{el.parentElement&&morphedElements.push(el.parentElement)})):(newMorphElementChildNodes.push(...newMorphElement.childNodes),currentMorphElementChildNodes.push(...morphElement.childNodes),morphedElements.push(morphElement));const transfer=[];submorphAppend||currentMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&(this.destroyOldLinks(element),element.classList.add("old"),element.querySelectorAll("[data-morph-transfer]").forEach(el=>{const selector=el.getAttribute("data-morph-transfer");transfer.push({element:el,selector})}))}),newMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&(transfer.forEach(item=>{const nestlement=element.querySelector(item.selector);nestlement&&nestlement.replaceWith(nextRoute.document.importNode(item.element,!0))}),this.findNewLinks(element),element.classList.add("new"))}),submorph?submorphAppend?newMorphElementChildNodes.forEach((el,i2)=>{currentMorphElementChildNodes[i2]instanceof HTMLElement&&currentMorphElementChildNodes[i2].append(...el.childNodes)}):newMorphElementChildNodes.forEach((el,i2)=>{var _a2;(_a2=currentMorphElementChildNodes[i2].parentElement)==null||_a2.insertBefore(el,currentMorphElementChildNodes[i2])}):morphElement.prepend(...newMorphElementChildNodes),setTimeout(()=>{submorphAppend||currentMorphElementChildNodes.forEach(element=>{element instanceof HTMLElement&&element.classList.add("old-idle")}),newMorphElementChildNodes.forEach(element=>{var _a2;element instanceof HTMLElement&&((_a2=element.parentElement)==null||_a2.style.setProperty("--new-content-height",element.offsetHeight+"px"),element.classList.add("new-idle"))})},0);const detail2=__spreadProps(__spreadValues({},documentFetchedEntry),{morphElement});events.dispatchEvent(document,"morphNewChildrenAdded",{detail:detail2});const promise=new Promise(res=>{setTimeout(()=>{submorphAppend||currentMorphElementChildNodes.forEach(el=>{el.remove()}),newMorphElementChildNodes.forEach(element=>{var _a2;element instanceof HTMLElement&&((_a2=element.parentElement)==null||_a2.style.removeProperty("--new-content-height"),element.classList.remove("new-idle","new"))}),submorphAppend||events.dispatchEvent(document,"morphOldChildrenRemoved",{detail:detail2}),res()},(parseFloat(duration)||0)*1e3+10)});__privateGet(this,_promises).push(promise)}),this.isPopstateNavigation?document.documentElement.style.setProperty("--new-document-scroll-position",(this.scrollValue.top-nextRoute.scrollState.y)*1+"px"):document.documentElement.style.setProperty("--new-document-scroll-position",this.scrollValue.top+"px"),events.dispatchEvent(document,"morphBeforeNavigationScroll",{detail:nextRoute.scrollState}),scrollTo?(nextRoute.clearScrollState(),__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,scrollTo,{centerScroll,offsetScroll,behavior:scrollBehaviour})):normalizedURL.hash?(nextRoute.clearScrollState(),__privateMethod(this,_Morph_instances,tryScrollToElement_fn).call(this,normalizedURL.hash,{centerScroll,offsetScroll,behavior:scrollBehaviour})):__privateGet(this,_isPopstateNavigation)?nextRoute.restoreScrollPosition():keepScrollPosition||nextRoute.renewScrollPosition(),yield Promise.all(__privateGet(this,_promises)),submorphAppend||oldElementsWithLoadEvent.forEach(child=>child.remove()),__privateSet(this,_promises,[]),morphedElements.forEach(el=>{el.querySelectorAll("script").forEach(element=>{element.replaceWith(dom.createScriptElement(element))})}),__privateGet(this,_links).forEach(link=>{link.checkCurrent(__privateGet(this,_currentURL).path)}),this.findParamsDependent(),events.dispatchEvent(document,"morphComplete",{detail:documentFetchedEntry}),document.documentElement.style.removeProperty("--new-document-scroll-position"),window.dispatchEvent(new Event("resize"))}catch(e){console.error(e)}__privateSet(this,_candidateURL,void 0)})}addLink(element){__privateGet(this,_links).push(new MorphLink(element,this))}addLinks(elements){elements.forEach(element=>{this.addLink(element)})}removeLink(element){__privateSet(this,_links,__privateGet(this,_links).filter(link=>link.element===element?(link.destroy(),!1):!0))}destroyOldLinks(morphElement){__privateSet(this,_links,__privateGet(this,_links).filter(link=>morphElement.contains(link.element)?(link.destroy(),!1):!0))}findNewLinks(morphElement){const linkElements=[...morphElement.querySelectorAll("a")].filter(__privateGet(this,_checkLink));__privateGet(this,_links).push(...linkElements.map(element=>new MorphLink(element,this)))}findLinks(){const linkElements=[...document.documentElement.querySelectorAll("a")].filter(__privateGet(this,_checkLink));__privateGet(this,_links).forEach(link=>link.destroy()),__privateSet(this,_links,linkElements.map(element=>new MorphLink(element,this)))}findParamsDependent(){const elements=[...document.documentElement.querySelectorAll("[data-morph-params-dependent]")];__privateGet(this,_paramDependent).forEach(link=>link.destroy()),__privateSet(this,_paramDependent,elements.map(element=>new MorphParamsDependent(element)))}};_options=new WeakMap,_morphElements=new WeakMap,_links=new WeakMap,_candidateURL=new WeakMap,_currentURL=new WeakMap,_previousURL=new WeakMap,_promises=new WeakMap,_isPopstateNavigation=new WeakMap,_currentScrollElement=new WeakMap,_isWindowScroll=new WeakMap,_routes=new WeakMap,_paramDependent=new WeakMap,_announcer=new WeakMap,_currentScrollX=new WeakMap,_currentScrollY=new WeakMap,_lastSubmorph=new WeakMap,_lastRevalidate=new WeakMap,_lastKeepScrollPosition=new WeakMap,_checkLink=new WeakMap,_Morph_instances=new WeakSet,getRoute_fn=__name(function(path){const normalizedURL=this.normalizePath(path);let route=__privateGet(this,_routes).get(normalizedURL.pathname);return route||(route=new MorphRoute(this,normalizedURL.pathname),__privateGet(this,_routes).set(normalizedURL.pathname,route)),route},"#getRoute"),getMorphElements_fn=__name(function(el){const morphElements=[...el.querySelectorAll("[data-morph]")];return morphElements.length?morphElements:[el]},"#getMorphElements"),isElementEmitsLoadEvent_fn=__name(function(element){return element.tagName==="SCRIPT"||element.tagName==="STYLE"||element.tagName==="LINK"&&element.getAttribute("rel")==="stylesheet"},"#isElementEmitsLoadEvent"),updateCurrentScrollElement_fn=__name(function(document2){var _a,_b;(_a=__privateGet(this,_currentScrollElement))==null||_a.removeEventListener("scroll",__privateGet(this,_scrollListener)),__privateSet(this,_currentScrollY,0),__privateSet(this,_currentScrollX,0),__privateSet(this,_currentScrollElement,__privateGet(this,_options).scrollSelector&&document2.querySelector(__privateGet(this,_options).scrollSelector)||window),__privateSet(this,_isWindowScroll,__privateGet(this,_currentScrollElement)===window),(_b=__privateGet(this,_currentScrollElement))==null||_b.addEventListener("scroll",__privateGet(this,_scrollListener)),__privateGet(this,_scrollListener).call(this)},"#updateCurrentScrollElement"),tryScrollToElement_fn=__name(function(id,options){const value=typeof id=="string"?document.querySelector(id):id;(typeof value=="number"||value)&&scroll.scrollToElement(value,{scrollElement:__privateGet(this,_currentScrollElement),behavior:(options==null?void 0:options.behavior)||"instant",center:options==null?void 0:options.centerScroll,offset:options==null?void 0:options.offsetScroll})},"#tryScrollToElement"),_popStateListener=new WeakMap,_scrollListener=new WeakMap,__name(_Morph,"Morph"),_Morph.instance=null;let Morph=_Morph;exports.Morph=Morph;