zumly 0.92.4 → 0.92.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- .zumly-canvas{position:absolute;width:100%;height:100%;overflow:hidden;overflow:clip;margin:0;padding:0;perspective:1000px;cursor:zoom-out;contain:strict}.zumly-canvas:focus{outline:none}.z-view{position:absolute;contain:strict}.z-view.is-current-view{cursor:default}.z-view.is-previous-view,.z-view.is-last-view,.z-view.has-no-events{pointer-events:none;user-select:none}.z-view{content-visibility:auto}.zoom-current-view,.zoom-current-view-reverse,.zoom-previous-view,.zoom-previous-view-reverse,.zoom-last-view,.zoom-last-view-reverse,.zoom-lateral-back,.zoom-lateral-out,.zoom-lateral-in{will-change:transform,opacity,filter}.z-view.has-effect{transition:filter var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);filter:var(--z-effect-filter, none)}.z-view.has-effect-reverse{transition:filter var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);filter:none}.z-view.hide{opacity:0}.zoom-me.z-trigger-hidden{visibility:hidden}.zoom-me.z-trigger-fade{transition:opacity var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);opacity:0}.zoom-me.z-trigger-fade-reverse,.z-view.z-view-fade-in{transition:opacity var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);opacity:1}.z-view.z-view-fade-out{transition:opacity var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);opacity:0}.zoom-me{cursor:zoom-in}.zoom-me[role=button]{-webkit-tap-highlight-color:transparent}.zoom-current-view-reverse{animation-name:zoom-current-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both;animation-direction:reverse}.zoom-current-view{animation-name:zoom-current-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both}@keyframes zoom-current-view{0%{transform:var(--current-view-transform-start)}to{transform:var(--current-view-transform-end)}}.zoom-previous-view{animation-name:zoom-previous-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both}.zoom-previous-view-reverse{animation-name:zoom-previous-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both;animation-direction:reverse}@keyframes zoom-previous-view{0%{transform:var(--previous-view-transform-start)}to{transform:var(--previous-view-transform-end)}}.zoom-last-view-reverse{animation-name:zoom-last-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both;animation-direction:reverse}.zoom-last-view{animation-name:zoom-last-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both}@keyframes zoom-last-view{0%{transform:var(--last-view-transform-start)}to{transform:var(--last-view-transform-end)}}.zoom-lateral-back{animation:zoom-lateral-back var(--zoom-duration) var(--zoom-ease) forwards}@keyframes zoom-lateral-back{0%{transform:var(--lateral-from)}to{transform:var(--lateral-to)}}.zoom-lateral-out{animation:zoom-lateral-out var(--zoom-duration) var(--zoom-ease) forwards}@keyframes zoom-lateral-out{0%{transform:var(--lateral-out-from);opacity:1}to{transform:var(--lateral-out-to);opacity:0}}.zoom-lateral-in{animation:zoom-lateral-in var(--zoom-duration) var(--zoom-ease) forwards}@keyframes zoom-lateral-in{0%{transform:var(--lateral-in-from);opacity:0}to{transform:var(--lateral-in-to);opacity:1}}.z-depth-nav{position:absolute;z-index:10;pointer-events:none}.z-depth-nav>*{pointer-events:auto}.z-depth-nav--bottom-left{bottom:20px;left:20px}.z-depth-nav--top-left{top:20px;left:20px}.z-nav-back{width:32px;height:32px;border-radius:50%;border:1px solid rgba(255,255,255,.25);background:#00000080;backdrop-filter:blur(12px);color:#fff;font-size:1.1rem;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s;padding:0}.z-nav-back:hover{background:#ffffff2e;border-color:#fff6}.z-lateral-nav{position:absolute;z-index:10;display:flex;align-items:center;gap:0;pointer-events:none;background:#00000080;backdrop-filter:blur(12px);border:1px solid rgba(255,255,255,.12);border-radius:100px;padding:6px 10px}.z-lateral-nav>*{pointer-events:auto}.z-lateral-nav--bottom-center{bottom:20px;left:50%;transform:translate(-50%)}.z-lateral-nav--top-center{top:20px;left:50%;transform:translate(-50%)}.z-nav-arrow{width:28px;height:28px;border-radius:50%;border:1px solid rgba(255,255,255,.25);background:#ffffff14;color:#fff;font-size:1rem;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s;padding:0}.z-nav-arrow:hover:not(:disabled){background:#ffffff2e;border-color:#fff6}.z-nav-arrow:disabled{opacity:.2;cursor:default}.z-nav-lateral-dots{display:flex;align-items:center;gap:5px}.z-nav-dot{width:7px;height:7px;border-radius:50%;border:1px solid rgba(255,255,255,.3);background:#ffffff26;padding:0;cursor:default;transition:background .2s,transform .2s,border-color .2s}.z-nav-lat-dot{cursor:pointer}.z-nav-lat-dot:hover{background:#fff6}.z-nav-dot.is-active{background:#fff;border-color:#fff;transform:scale(1.35)}
1
+ .zumly-canvas{position:absolute;width:100%;height:100%;overflow:hidden;overflow:clip;margin:0;padding:0;perspective:1000px;cursor:zoom-out;contain:strict}.zumly-canvas:focus{outline:none}.z-view{position:absolute;contain:strict;content-visibility:auto}.z-view.is-current-view{cursor:default}.z-view.is-previous-view,.z-view.is-last-view,.z-view.has-no-events{pointer-events:none;user-select:none}.zoom-current-view,.zoom-current-view-reverse,.zoom-previous-view,.zoom-previous-view-reverse,.zoom-last-view,.zoom-last-view-reverse,.zoom-lateral-back,.zoom-lateral-out,.zoom-lateral-in{will-change:transform,opacity,filter}.z-view.has-effect{transition:filter var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);filter:var(--z-effect-filter, none)}.z-view.has-effect-reverse{transition:filter var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);filter:none}.z-view.hide{opacity:0}.zoom-me.z-trigger-hidden{visibility:hidden}.zoom-me.z-trigger-fade{transition:opacity var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);opacity:0}.zoom-me.z-trigger-fade-reverse,.z-view.z-view-fade-in{transition:opacity var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);opacity:1}.z-view.z-view-fade-out{transition:opacity var(--zoom-duration, 1s) var(--zoom-ease, ease-in-out);opacity:0}.zoom-me{cursor:zoom-in}.zoom-me[role=button]{-webkit-tap-highlight-color:transparent}.zoom-current-view-reverse{animation-name:zoom-current-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both;animation-direction:reverse}.zoom-current-view{animation-name:zoom-current-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both}@keyframes zoom-current-view{0%{transform:var(--current-view-transform-start)}to{transform:var(--current-view-transform-end)}}.zoom-previous-view{animation-name:zoom-previous-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both}.zoom-previous-view-reverse{animation-name:zoom-previous-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both;animation-direction:reverse}@keyframes zoom-previous-view{0%{transform:var(--previous-view-transform-start)}to{transform:var(--previous-view-transform-end)}}.zoom-last-view-reverse{animation-name:zoom-last-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both;animation-direction:reverse}.zoom-last-view{animation-name:zoom-last-view;animation-duration:var(--zoom-duration);animation-timing-function:var(--zoom-ease);animation-fill-mode:both}@keyframes zoom-last-view{0%{transform:var(--last-view-transform-start)}to{transform:var(--last-view-transform-end)}}.zoom-lateral-back{animation:zoom-lateral-back var(--zoom-duration) var(--zoom-ease) forwards}@keyframes zoom-lateral-back{0%{transform:var(--lateral-from)}to{transform:var(--lateral-to)}}.zoom-lateral-out{animation:zoom-lateral-out var(--zoom-duration) var(--zoom-ease) forwards}@keyframes zoom-lateral-out{0%{transform:var(--lateral-out-from);opacity:1}to{transform:var(--lateral-out-to);opacity:0}}.zoom-lateral-in{animation:zoom-lateral-in var(--zoom-duration) var(--zoom-ease) forwards}@keyframes zoom-lateral-in{0%{transform:var(--lateral-in-from);opacity:0}to{transform:var(--lateral-in-to);opacity:1}}.z-depth-nav{position:absolute;z-index:10;pointer-events:none}.z-depth-nav>*{pointer-events:auto}.z-depth-nav--bottom-left{bottom:20px;left:20px}.z-depth-nav--top-left{top:20px;left:20px}.z-nav-back{width:32px;height:32px;border-radius:50%;border:1px solid rgba(255,255,255,.25);background:#00000080;backdrop-filter:blur(12px);color:#fff;font-size:1.1rem;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s;padding:0}.z-nav-back:hover{background:#ffffff2e;border-color:#fff6}.z-lateral-nav{position:absolute;z-index:10;display:flex;align-items:center;gap:0;pointer-events:none;background:#00000080;backdrop-filter:blur(12px);border:1px solid rgba(255,255,255,.12);border-radius:100px;padding:6px 10px}.z-lateral-nav>*{pointer-events:auto}.z-lateral-nav--bottom-center{bottom:20px;left:50%;transform:translate(-50%)}.z-lateral-nav--top-center{top:20px;left:50%;transform:translate(-50%)}.z-nav-arrow{width:28px;height:28px;border-radius:50%;border:1px solid rgba(255,255,255,.25);background:#ffffff14;color:#fff;font-size:1rem;line-height:1;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s,border-color .15s;padding:0}.z-nav-arrow:hover:not(:disabled){background:#ffffff2e;border-color:#fff6}.z-nav-arrow:disabled{opacity:.2;cursor:default}.z-nav-lateral-dots{display:flex;align-items:center;gap:5px}.z-nav-dot{width:7px;height:7px;border-radius:50%;border:1px solid rgba(255,255,255,.3);background:#ffffff26;padding:0;cursor:default;transition:background .2s,transform .2s,border-color .2s}.z-nav-lat-dot{cursor:pointer}.z-nav-lat-dot:hover{background:#fff6}.z-nav-dot.is-active{background:#fff;border-color:#fff;transform:scale(1.35)}
package/dist/zumly.mjs CHANGED
@@ -1,7 +1,7 @@
1
1
  /*
2
2
  * zumly
3
- * v.0.92.3
3
+ * v.0.92.6
4
4
  * Author Juan Martin Muda - Zumerlab
5
5
  * License MIT
6
6
  */
7
- var at=class{#t={};constructor(t={}){this.#t=t}#e(t){return typeof t=="function"?"function":t instanceof HTMLElement?"element":typeof t=="object"&&t!==null&&typeof t.render=="function"?"object":typeof t!="string"?"unknown":/^https?:\/\/|^\/|\.html$|\.php$/i.test(t)?"url":t.includes("<")?"html":t.includes("-")?"webcomponent":"unknown"}async resolve(t,e=null){if(typeof t=="string"&&Object.prototype.hasOwnProperty.call(this.#t,t)){let o=this.#t[t];return this.resolve(o,e)}switch(this.#e(t)){case"html":{let o=document.createElement("div");o.innerHTML=t.trim();let n=o.firstElementChild;if(!n)throw new Error("Zumly: view produced no element (html)");return n}case"url":{let o=new AbortController,n=setTimeout(()=>o.abort(),1e4),i;try{i=await fetch(t,{signal:o.signal})}finally{clearTimeout(n)}if(!i.ok)throw new Error(`Zumly: fetch failed for "${t}" (${i.status})`);let a=await i.text(),l=document.createElement("div");l.innerHTML=a.trim();let c=l.firstElementChild;if(!c)throw new Error("Zumly: view produced no element (url)");return c}case"function":{let o=e&&e.target||document.createElement("div"),n=await t({...e,target:o});if(typeof n=="string")return this.resolve(n,e);if(n instanceof HTMLElement)return n;let i=o.firstElementChild||o;return i.classList.contains("z-view")||i.classList.add("z-view"),i}case"object":{let o=await t.render(e);if(typeof o!="string")throw new Error("Zumly: view render() must return string");return this.resolve(o,e)}case"element":return t.cloneNode(!0);case"webcomponent":return await customElements.whenDefined(t),document.createElement(t);default:throw new Error("Zumly: unknown view type for source")}}};async function Q(r,t,e,s,o,n){if(!r||!r.classList){let i=document.createElement("div");i.classList.add("z-view"),r&&i.appendChild(r),r=i}else r.classList.contains("z-view")||r.classList.add("z-view");return r.dataset.viewName=t,r.getAttribute("aria-label")||r.setAttribute("aria-label",`View: ${t}`),r.style.transformOrigin="0 0",r.style.position="absolute",s?r.classList.add("is-current-view"):r.classList.add("is-new-current-view","has-no-events","hide"),e.append(r),typeof o[t]=="object"&&typeof o[t].mounted=="function"&&await o[t].mounted(),r}function L(r,t,e){t&&e==="welcome"&&console.info(`%c Zumly %c ${t}`,"background: #424085; color: white; border-radius: 3px;","color: #424085"),t&&r&&(e==="info"||e===void 0)&&console.info(`%c Zumly %c ${t}`,"background: #6679A3; color: #304157; border-radius: 3px;","color: #6679A3"),t&&e==="warn"&&console.warn(`%c Zumly %c ${t}`,"background: #DCBF53; color: #424085; border-radius: 3px;","color: #424085"),t&&e==="error"&&console.error(`%c Zumly %c ${t}`,"background: #BE4747; color: white; border-radius: 3px;","color: #424085")}function Zt(r,t){if(t.isValid=!1,!r||typeof r!="object"){L(!1,"'options' object has to be provided when instance is defined","error");return}if(typeof r.mount!="string"){L(!1,"'mount' must be a string selector","error");return}if(t.mount=r.mount,typeof r.initialView!="string"){L(!1,"'initialView' must be a string","error");return}if(t.initialView=r.initialView,!r.views||typeof r.views!="object"){L(!1,"'views' must be an object","error");return}t.views=r.views,t.isValid=!0,t.preload=Array.isArray(r.preload)?r.preload:[],t.debug=typeof r.debug=="boolean"?r.debug:!1,t.componentContext=r.componentContext&&typeof r.componentContext=="object"?r.componentContext:new Map;let e=r.transitions&&typeof r.transitions=="object"?r.transitions:null,s=e&&e.cover,o=typeof s=="string"?s.toLowerCase():null,n=o==="width"||o==="height";t.cover=n?o:"width",!n&&e&&s!==void 0&&L(!1,`'transitions.cover' must be either "width" or "height". Falling back to "width".`,"warn"),t.duration=e&&typeof e.duration=="string"?e.duration:"1s",t.ease=e&&typeof e.ease=="string"?e.ease:"ease-in-out",t.deferred=typeof r.deferred=="boolean"?r.deferred:!1;let i=e&&e.hideTrigger;i===!0||i==="fade"?t.hideTrigger=i:(t.hideTrigger=!1,i!=null&&i!==!1&&L(!1,`'transitions.hideTrigger' must be true or "fade". Falling back to false.`,"warn"));let a=e&&e.effects;Array.isArray(a)&&a.length>=2&&typeof a[0]=="string"&&typeof a[1]=="string"?t.effects=[a[0],a[1]]:Array.isArray(a)&&a.length===1&&typeof a[0]=="string"?t.effects=[a[0],a[0]]:(t.effects=["none","none"],a!=null&&L(!1,`'transitions.effects' must be an array of 1-2 CSS filter strings (e.g. ["blur(3px)", "blur(8px) saturate(0)"]). Falling back to no effects.`,"warn"));let l=e&&e.driver,c=typeof l=="string"?l.toLowerCase():null,u=typeof l=="function"?l:null;if(c!==null){let y=["css","waapi","none","anime","gsap","motion"];t.transitionDriver=y.includes(c)?c:"css",y.includes(c)||L(!1,`'transitions.driver' must be "css", "waapi", "none", "anime", "gsap", "motion", or a function. Got "${l}". Falling back to "css".`,"warn")}else u!==null?t.transitionDriver=u:t.transitionDriver="css";let f=e&&e.stagger;typeof f=="number"&&f>0?t.stagger=f:(t.stagger=0,f!=null&&f!==0&&L(!1,"'transitions.stagger' must be a positive number (ms). Falling back to 0 (disabled).","warn")),t.parallax=0,t.threshold=null;let h=e&&e.threshold;h&&typeof h=="object"&&h.enabled&&(t.threshold={duration:typeof h.duration=="number"&&h.duration>0?h.duration:300,commitAt:typeof h.commitAt=="number"&&h.commitAt>0&&h.commitAt<=1?h.commitAt:.5});let d=r.lateralNav;if(d===!1)t.lateralNav=!1;else if(d&&typeof d=="object"){let y=typeof d.mode=="string"?d.mode.toLowerCase():null,b=y==="auto"||y==="always";y&&!b&&L(!1,`'lateralNav.mode' must be "auto" or "always". Falling back to "auto".`,"warn");let w=null;if(Array.isArray(d.siblings))w=d.siblings.filter(g=>typeof g=="string"&&g),w.length<2&&(L(!1,"'lateralNav.siblings' needs at least 2 view names. Ignoring.","warn"),w=null);else if(d.siblings&&typeof d.siblings=="object"){w={};for(let[g,x]of Object.entries(d.siblings))if(Array.isArray(x)){let k=x.filter(C=>typeof C=="string"&&C);k.length>=2&&(w[g]=k)}Object.keys(w).length===0&&(w=null)}else d.siblings!==void 0&&L(!1,"'lateralNav.siblings' must be an array of view names or a { parentView: [...] } map. Ignoring.","warn");t.lateralNav={mode:b?y:"auto",arrows:typeof d.arrows=="boolean"?d.arrows:!0,dots:typeof d.dots=="boolean"?d.dots:!0,keepAlive:d.keepAlive===!0||d.keepAlive==="visible"?d.keepAlive:!1,siblings:w}}else t.lateralNav={mode:"auto",arrows:!0,dots:!0,keepAlive:!1,siblings:null};let p=r.depthNav;if(p===!1)t.depthNav=!1;else if(p&&typeof p=="object"){let y=typeof p.position=="string"?p.position.toLowerCase():null,b=y==="bottom-left"||y==="top-left";y&&!b&&L(!1,`'depthNav.position' must be "bottom-left" or "top-left". Falling back to "bottom-left".`,"warn"),t.depthNav={position:b?y:"bottom-left"}}else t.depthNav={position:"bottom-left"};let v=r.lateralNav&&typeof r.lateralNav=="object"?r.lateralNav.position:void 0;if(t.lateralNav&&typeof t.lateralNav=="object"){let y=v==="bottom-center"||v==="top-center";v&&!y&&L(!1,`'lateralNav.position' must be "bottom-center" or "top-center". Falling back to "bottom-center".`,"warn"),t.lateralNav.position=y?v:"bottom-center"}let m=r.inputs;m&&typeof m=="object"?t.inputs={wheel:typeof m.wheel=="boolean"?m.wheel:!0,keyboard:typeof m.keyboard=="boolean"?m.keyboard:!0,click:typeof m.click=="boolean"?m.click:!0,touch:typeof m.touch=="boolean"?m.touch:!0}:t.inputs={wheel:!0,keyboard:!0,click:!0,touch:!0}}function $t(r,t,e,s,o){let n=e/r,i=s/t;return o==="height"?{scale:i,scaleInv:1/i}:{scale:n,scaleInv:1/n}}function Ft(r,t,e,s){let o=t.left,n=t.top,i=r.x-o+(r.width-e.width*s)/2,a=r.y-n+(r.height-e.height*s)/2;return`translate(${i}px, ${a}px) scale(${s})`}function Mt(r,t,e){let s=t.left,o=t.top,n=r.x-s+(r.width-e.width)/2,i=r.y-o+(r.height-e.height)/2;return`translate(${n}px, ${i}px)`}function Dt(r,t){let e=r.x+r.width/2-t.x,s=r.y+r.height/2-t.y;return`${e}px ${s}px`}function Ht(r,t,e,s,o=0){let n=r.width/2-t.width/2-t.x+e.x,i=r.height/2-t.height/2-t.y+e.y,a=1-o,l=n*a,c=i*a;return{x:n,y:i,transform:`translate(${l}px, ${c}px) scale(${s})`}}function jt({canvasRect:r,canvasOffset:t,triggerRect:e,previousViewRectAtBaseTransform:s,lastViewZoomedElementRect:o,previousViewRectWithPreviousAtEndTransform:n,scale:i,preScale:a,parallax:l=0}){let c=t.left,u=t.top,f=r.width/2-e.width/2-e.x,h=r.height/2-e.height/2-e.y,d=f+(s.x-o.x)+n.x-c+(n.width-o.width)/2,p=h+(s.y-o.y)+n.y-u+(n.height-o.height)/2,v=1-Math.min(l*2,.9);return`translate(${d*v}px, ${p*v}px) scale(${i*a})`}function Rt(r,t,e,s,o){return`translate(${r-e.left}px, ${t-e.top}px) scale(${s*o})`}function lt(r){let t=r.split(/\s+/);return{x:parseFloat(t[0])||0,y:parseFloat(t[1])||0}}function J(r){let t=r.match(/translate\(\s*([-\d.]+)px[,\s]+([-\d.]+)px\s*\)/),e=r.match(/scale\(\s*([-\d.]+)\s*\)/);return{tx:t?parseFloat(t[1]):0,ty:t?parseFloat(t[2]):0,scale:e?parseFloat(e[1]):1}}function ct(r,t,e,s,o,n,i,a,l,c){let u=t.x-e.x*(1-n)-s,f=t.y-e.y*(1-n)-o,h=t.width/n,d=t.height/n,p=u+e.x+(r.x-u-e.x-s)/n,v=f+e.y+(r.y-f-e.y-o)/n,m=r.width/n,y=r.height/n,b=u+i.x+a+c*(p-u-i.x),w=f+i.y+l+c*(v-f-i.y),g=m*c,x=y*c;return{x:b,y:w,width:g,height:x,left:b,top:w,right:b+g,bottom:w+x}}function tt(r,t,e){return{viewName:r,backwardState:t,forwardState:e}}function qt(r){return{detachedNode:r}}function Bt(r,t,e,s,o){let n=[];return t!==null&&n.push(t),e!==null&&n.push(e),s!==null&&n.push(s),o!==null&&n.push(o),{zoomLevel:r,views:n}}function Vt(r){let t=r.views?.[3];if(!(!t||!(t.detachedNode instanceof Node)))return t.detachedNode}var ft=class{#t=new Map;set(t,e,s=null){this.#t.set(t,{node:e,expires:s?Date.now()+s:null})}get(t){let e=this.#t.get(t);return e?e.expires!==null&&Date.now()>e.expires?(this.#t.delete(t),null):e.node.cloneNode(!0):null}has(t){let e=this.#t.get(t);return e?e.expires!==null&&Date.now()>e.expires?(this.#t.delete(t),!1):!0:!1}invalidate(t){this.#t.delete(t)}clear(){this.#t.clear()}};var Ee=300*1e3,_e=/^https?:\/\/|^\/|\.html$|\.php$/i,ut=class{#t;#e;#r;#s=new Map;constructor(t={}){this.#r=t,this.#t=new at(t),this.#e=new ft}#o(t){return typeof this.#r[t]=="string"}#n(t){return _e.test(t)?Ee:null}async get(t,e=null){if(this.#o(t)){let s=this.#e.get(t);if(s)return s;if(this.#s.has(t))return this.#s.get(t);let o=(async()=>{let n=await this.#t.resolve(t,e),i=this.#r[t],a=this.#n(i);return this.#e.set(t,n,a),this.#s.delete(t),n})();return this.#s.set(t,o),o}return this.#t.resolve(t,e)}async preloadEager(t,e=null){!Array.isArray(t)||t.length===0||await Promise.all(t.map(s=>this.get(s,e)))}prefetch(t,e=null){this.get(t,e).catch(()=>{})}prefetchOnHover(t,e=null){this.prefetch(t,e)}scanAndPrefetch(t,e=null){if(!t||!t.querySelectorAll)return;t.querySelectorAll(".zoom-me[data-to]").forEach(o=>{let n=o.dataset.to;n&&(o.hasAttribute("role")||o.setAttribute("role","button"),o.hasAttribute("aria-label")||o.setAttribute("aria-label",`Zoom to ${n}`),this.prefetch(n,e))})}};function Y(r){r&&(r.style.contentVisibility="hidden")}function R(r){r&&(r.style.contentVisibility="visible")}function Z(r){if(typeof r=="number"&&!Number.isNaN(r))return Math.max(0,r);let t=String(r).trim(),e=t.match(/^(\d*\.?\d+)\s*(ms|s)?$/i);if(!e)return typeof console<"u"&&console.warn(`[zumly] Could not parse duration "${t}" \u2014 falling back to 500ms.`),500;let s=parseFloat(e[1]);return(e[2]||"s").toLowerCase()==="ms"?Math.max(0,s):Math.max(0,s*1e3)}function ht(r){return Z(r)/1e3}function S(r,t){if(r.classList.contains("is-new-current-view")){let e=t.views[0].forwardState;r.classList.replace("is-new-current-view","is-current-view"),r.classList.remove("zoom-current-view","has-no-events"),r.style.transformOrigin=e.origin,r.style.transform=e.transform;return}if(r.classList.contains("is-previous-view")){let e=t.views[1].forwardState;r.classList.remove("zoom-previous-view","has-no-events"),r.style.transformOrigin=e.origin,r.style.transform=e.transform;return}if(r.classList.contains("is-last-view")){let e=t.views[2].forwardState;r.classList.remove("zoom-last-view","has-no-events"),r.style.transformOrigin=e.origin,r.style.transform=e.transform}}function O(r,t){r.classList.remove("zoom-previous-view-reverse","has-no-events","has-effect","has-effect-reverse"),r.style.removeProperty("--z-effect-filter"),r.style.transformOrigin="0 0",r.style.transform=t.transform}function A(r,t){r.classList.remove("zoom-last-view-reverse","has-no-events","has-effect","has-effect-reverse"),r.style.removeProperty("--z-effect-filter"),r.style.transformOrigin=t.origin,r.style.transform=t.transform}function z(r,t){try{t&&t.removeChild(r)}catch{try{r.parentElement&&t.removeChild(r.parentElement)}catch{}}}function T(...r){for(let t of r)t&&(t.classList.remove("hide"),R(t))}function F(r,t){let{currentView:e,previousView:s,backView:o,backViewState:n,lastView:i,lastViewState:a,incomingTransformEnd:l,currentStage:c,canvas:u}=r,f=c.views[0];T(e),e.classList.replace("is-new-current-view","is-current-view"),e.classList.remove("zoom-current-view","has-no-events"),e.style.transformOrigin=f.forwardState.origin,e.style.transform=l||f.forwardState.transform,o&&n&&(o.style.transform=n.transformEnd),i&&a&&(i.style.transform=a.transformEnd),r.keepAlive||z(s,u),t()}var M=150;function D(r,t){let e=!1,s=setTimeout(()=>{e||(e=!0,r())},t);return{finish(){e||(e=!0,clearTimeout(s),r())},safetyTimer:s}}function Xt(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function xe(r){if(!r||r==="none")return Xt();let t=String(r).match(/matrix\(([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+)\)/);return t?{a:parseFloat(t[1])||1,b:parseFloat(t[2])||0,c:parseFloat(t[3])||0,d:parseFloat(t[4])||1,e:parseFloat(t[5])||0,f:parseFloat(t[6])||0}:Xt()}function W(r){return`matrix(${r.a}, ${r.b}, ${r.c}, ${r.d}, ${r.e}, ${r.f})`}function U(r,t,e){return r+(t-r)*e}function K(r,t,e){let s=Math.max(0,Math.min(1,e));return{a:U(r.a,t.a,s),b:U(r.b,t.b,s),c:U(r.c,t.c,s),d:U(r.d,t.d,s),e:U(r.e,t.e,s),f:U(r.f,t.f,s)}}function P(r,t,e){r.style.transformOrigin=t,r.style.transform=e;try{r.getBoundingClientRect()}catch{}return xe(getComputedStyle(r).transform)}function Yt(r,t){let{type:e,currentView:s,previousView:o,lastView:n,currentStage:i,duration:a,ease:l,canvas:c}=r;if(!s||!o||!i){t();return}e==="lateral"?Le(r,t):e==="zoomIn"?Te(s,o,n,i,a,l,t):e==="zoomOut"?ze(s,o,n,i,a,l,c,t):t()}function Le(r,t){let{currentView:e,previousView:s,backView:o,backViewState:n,lastView:i,lastViewState:a,incomingTransformStart:l,incomingTransformEnd:c,outgoingTransform:u,outgoingTransformEnd:f,currentStage:h,duration:d,ease:p,canvas:v}=r,m=Z(d),y=h.views[0];T(e),e.classList.replace("is-new-current-view","is-current-view"),e.classList.remove("zoom-current-view","has-no-events"),e.style.transformOrigin=y.forwardState.origin,o&&n&&(I(o,d,p,{"--lateral-from":n.transformStart,"--lateral-to":n.transformEnd}),o.classList.add("zoom-lateral-back")),i&&a&&(I(i,d,p,{"--lateral-from":a.transformStart,"--lateral-to":a.transformEnd}),i.classList.add("zoom-lateral-back")),r.keepAlive!=="visible"&&(I(s,d,p,{"--lateral-out-from":u,"--lateral-out-to":f}),s.classList.add("zoom-lateral-out")),I(e,d,p,{"--lateral-in-from":l,"--lateral-in-to":c}),e.classList.add("zoom-lateral-in");let b=r.keepAlive==="visible"?[e]:[s,e];o&&n&&b.push(o),i&&a&&b.push(i);let w=b.length,{finish:g}=D(()=>{gt(b,x),r.keepAlive?(s.classList.remove("zoom-lateral-out"),s.style.opacity=""):z(s,v),o&&(o.classList.remove("zoom-lateral-back"),o.style.transform=n?.transformEnd||o.style.transform),i&&(i.classList.remove("zoom-lateral-back"),i.style.transform=a?.transformEnd||i.style.transform),e.classList.remove("zoom-lateral-in"),e.style.transform=c,t()},m+M);function x(k){let C=k?.target;C&&C.removeEventListener("animationend",x),w--,w<=0&&g()}b.forEach(k=>k.addEventListener("animationend",x))}function Te(r,t,e,s,o,n,i){T(r,t,e);let a=s.stagger||0;I(r,o,n,{"--current-view-transform-start":s.views[0].backwardState.transform,"--current-view-transform-end":s.views[0].forwardState.transform}),a>0&&r.style.setProperty("animation-delay","0ms"),I(t,o,n,{"--previous-view-transform-start":s.views[1].backwardState.transform,"--previous-view-transform-end":s.views[1].forwardState.transform}),a>0&&t.style.setProperty("animation-delay",`${a}ms`),e&&(I(e,o,n,{"--last-view-transform-start":s.views[2].backwardState.transform,"--last-view-transform-end":s.views[2].forwardState.transform}),a>0&&e.style.setProperty("animation-delay",`${a*2}ms`)),r.classList.add("zoom-current-view"),t.classList.add("zoom-previous-view"),e&&e.classList.add("zoom-last-view");let l=e?[r,t,e]:[r,t],c=l.length,u=Z(o),f=e?a*2:a,{finish:h}=D(()=>{gt(l,d),l.forEach(p=>p.style.removeProperty("animation-delay")),i()},u+f+M);function d(p){let v=p?.target;if(v&&v.removeEventListener("animationend",d),v?.isConnected)try{S(v,s)}catch{}c--,c<=0&&h()}l.forEach(p=>p.addEventListener("animationend",d))}function ze(r,t,e,s,o,n,i,a){let l=s.views[0],c=s.views[1],u=e&&s.views[2]?s.views[2]:null,f=s.stagger||0;I(r,o,n,{"--current-view-transform-start":l.backwardState.transform,"--current-view-transform-end":l.forwardState.transform}),f>0&&r.style.setProperty("animation-delay","0ms"),I(t,o,n,{"--previous-view-transform-start":c.backwardState.transform,"--previous-view-transform-end":c.forwardState.transform}),f>0&&t.style.setProperty("animation-delay",`${f}ms`),e&&u&&(I(e,o,n,{"--last-view-transform-start":u.backwardState.transform,"--last-view-transform-end":u.forwardState.transform}),f>0&&e.style.setProperty("animation-delay",`${f*2}ms`)),r.classList.add("zoom-current-view-reverse"),t.classList.add("zoom-previous-view-reverse"),e&&e.classList.add("zoom-last-view-reverse");let h=e?[r,t,e]:[r,t],d=h.length,p=Z(o),v=e?f*2:f,{finish:m}=D(()=>{gt(h,y),h.forEach(b=>b.style.removeProperty("animation-delay")),a()},p+v+M);function y(b){let w=b?.target;if(w&&w.removeEventListener("animationend",y),w?.isConnected)try{ke(w,s,i)}catch{}d--,d<=0&&m()}h.forEach(b=>b.addEventListener("animationend",y))}function ke(r,t,e){if(r.classList.contains("zoom-current-view-reverse")){z(r,e);return}if(r.classList.contains("zoom-previous-view-reverse")){O(r,t.views[1].backwardState);return}r.classList.contains("zoom-last-view-reverse")&&A(r,t.views[2].backwardState)}function I(r,t,e,s){r.style.setProperty("--zoom-duration",t),r.style.setProperty("--zoom-ease",e);for(let[o,n]of Object.entries(s))r.style.setProperty(o,n)}function gt(r,t){for(let e of r)e?.removeEventListener&&e.removeEventListener("animationend",t)}function Ut(r,t){let{type:e,currentView:s,previousView:o,lastView:n,currentStage:i,canvas:a}=r;if(!s||!o||!i){t();return}if(e==="lateral"){F(r,t);return}if(e==="zoomIn"){T(s,o,n),S(s,i),S(o,i),n&&S(n,i),t();return}if(e==="zoomOut"){z(s,a),T(o,n),O(o,i.views[1].backwardState),n&&A(n,i.views[2].backwardState),t();return}t()}function Wt(r,t){let{type:e,currentView:s,previousView:o,lastView:n,currentStage:i,duration:a,ease:l,canvas:c}=r;if(!s||!o||!i){t();return}let u=Z(a);if(e==="lateral"){Ae(r,u,l,t);return}if(e==="zoomIn"){Ce(s,o,n,i,u,l,t);return}if(e==="zoomOut"){Oe(s,o,n,i,u,l,c,t);return}t()}function Ce(r,t,e,s,o,n,i){T(r,t,e);let a=s.views[0],l=s.views[1],c=e&&s.views[2]?s.views[2]:null;r.style.transformOrigin=a.backwardState.origin,r.style.transform=a.backwardState.transform,t.style.transformOrigin=l.backwardState.origin,t.style.transform=l.backwardState.transform,c&&(e.style.transformOrigin=c.backwardState.origin,e.style.transform=c.backwardState.transform);let u=s.stagger||0,f=[];f.push(r.animate([{transform:a.backwardState.transform},{transform:a.forwardState.transform}],{duration:o,easing:n,fill:"forwards"})),f.push(t.animate([{transform:l.backwardState.transform},{transform:l.forwardState.transform}],{duration:o,delay:u,easing:n,fill:"forwards"})),c&&f.push(e.animate([{transform:c.backwardState.transform},{transform:c.forwardState.transform}],{duration:o,delay:u*2,easing:n,fill:"forwards"}));let h=c?u*2:u,{finish:d}=D(()=>{bt(f);try{S(r,s),S(t,s),e&&S(e,s)}catch{}i()},o+h+M);Promise.all(f.map(p=>p.finished)).then(d).catch(d)}function Oe(r,t,e,s,o,n,i,a){let l=s.views[0],c=s.views[1],u=e&&s.views[2]?s.views[2]:null,f=c.backwardState,h=u?u.backwardState:null;r.style.transformOrigin=l.forwardState.origin,r.style.transform=l.forwardState.transform,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transformOrigin=c.forwardState.origin,e&&u&&(e.style.transformOrigin=u.forwardState.origin);let d=t.style.transform||getComputedStyle(t).transform||c.forwardState.transform,p=e&&u?e.style.transform||getComputedStyle(e).transform||u.forwardState.transform:null,v=s.stagger||0,m=[];m.push(r.animate([{transform:l.forwardState.transform},{transform:l.backwardState.transform}],{duration:o,easing:n,fill:"forwards"})),m.push(t.animate([{transform:d},{transform:f.transform}],{duration:o,delay:v,easing:n,fill:"both"})),e&&h&&m.push(e.animate([{transform:p},{transform:h.transform}],{duration:o,delay:v*2,easing:n,fill:"both"})),t.style.removeProperty("transform"),e&&e.style.removeProperty("transform");let y=e&&h?v*2:v,{finish:b}=D(()=>{bt(m);try{z(r,i),O(t,f),e&&h&&A(e,h)}catch{}a()},o+y+M);Promise.all(m.map(w=>w.finished)).then(b).catch(b)})})}function Ae(r,t,e,s){let{currentView:o,previousView:n,backView:i,backViewState:a,lastView:l,lastViewState:c,incomingTransformStart:u,incomingTransformEnd:f,outgoingTransform:h,outgoingTransformEnd:d,currentStage:p,canvas:v}=r,m=p.views[0];T(o),o.classList.replace("is-new-current-view","is-current-view"),o.classList.remove("zoom-current-view","has-no-events"),o.style.transformOrigin=m.forwardState.origin;let y=[];y.push(o.animate([{transform:u,opacity:0},{transform:f,opacity:1}],{duration:t,easing:e,fill:"forwards"})),r.keepAlive!=="visible"&&y.push(n.animate([{transform:h,opacity:1},{transform:d,opacity:0}],{duration:t,easing:e,fill:"forwards"})),i&&a&&y.push(i.animate([{transform:a.transformStart},{transform:a.transformEnd}],{duration:t,easing:e,fill:"forwards"})),l&&c&&y.push(l.animate([{transform:c.transformStart},{transform:c.transformEnd}],{duration:t,easing:e,fill:"forwards"}));let{finish:b}=D(()=>{bt(y),o.style.transform=f||m.forwardState.transform,i&&a&&(i.style.transform=a.transformEnd),l&&c&&(l.style.transform=c.transformEnd),r.keepAlive?(n.style.opacity="",n.style.transform=d):z(n,v),s()},t+M);Promise.all(y.map(w=>w.finished)).then(b).catch(b)}function bt(r){for(let t of r)try{t.cancel()}catch{}}function Kt(r,t){let e=typeof globalThis<"u"&&globalThis.anime;if(!e||typeof e!="function"){console.warn('Zumly anime driver: Anime.js not loaded. Add <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.2/anime.min.js"><\/script>'),t();return}let{type:s,currentView:o,previousView:n,lastView:i,currentStage:a,duration:l,ease:c,canvas:u}=r;if(!o||!n||!a){t();return}let f=Z(l);s==="lateral"?F(r,t):s==="zoomIn"?Pe(e,o,n,i,a,f,c,t):s==="zoomOut"?Ie(e,o,n,i,a,f,c,u,t):t()}function Pe(r,t,e,s,o,n,i,a){T(t,e,s);let l=o.views[0],c=o.views[1],u=s&&o.views[2]?o.views[2]:null,f=Gt([{el:t,backward:l.backwardState,forward:l.forwardState},{el:e,backward:c.backwardState,forward:c.forwardState},...u?[{el:s,backward:u.backwardState,forward:u.forwardState}]:[]],"forward");Qt(f,0);let h=o.stagger||0,d=n+(u?h*2:h),p={value:0};r({targets:p,value:1,duration:d,easing:te(i),update:()=>{let v=p.value*d;Jt(f,v,n,h)},complete:()=>{S(t,o),S(e,o),s&&S(s,o),a()}})}function Ie(r,t,e,s,o,n,i,a,l){let c=o.views[0],u=o.views[1],f=s&&o.views[2]?o.views[2]:null,h=u.backwardState,d=f?f.backwardState:null,p=Gt([{el:t,backward:c.backwardState,forward:c.forwardState},{el:e,backward:u.backwardState,forward:u.forwardState},...f?[{el:s,backward:f.backwardState,forward:f.forwardState}]:[]],"backward");Qt(p,0);let v=o.stagger||0,m=n+(f?v*2:v),y={value:0};r({targets:y,value:1,duration:m,easing:te(i),update:()=>{let b=y.value*m;Jt(p,b,n,v)},complete:()=>{z(t,a),O(e,h),s&&d&&A(s,d),l()}})}function Gt(r,t){return r.map(({el:e,backward:s,forward:o})=>{if(t==="forward"){let n=P(e,s.origin,s.transform),i=P(e,s.origin,o.transform);return{el:e,from:n,to:i}}else{let n=P(e,o.origin,o.transform),i=P(e,o.origin,s.transform);return{el:e,from:n,to:i}}})}function Qt(r,t){for(let{el:e,from:s,to:o}of r)e.style.transform=W(K(s,o,t))}function Jt(r,t,e,s){for(let o=0;o<r.length;o++){let{el:n,from:i,to:a}=r[o],l=o*s,c=Math.max(0,t-l),u=e>0?Math.min(1,c/e):1;n.style.transform=W(K(i,a,u))}}function te(r){if(typeof r!="string")return"easeInOutQuad";let t=r.toLowerCase();return t==="linear"?"linear":t.includes("ease-in-out")?"easeInOutQuad":t.includes("ease-in")?"easeInQuad":t.includes("ease-out")?"easeOutQuad":t}function ee(r,t){let e=typeof globalThis<"u"&&globalThis.gsap;if(!e||typeof e.to!="function"){console.warn('Zumly GSAP driver: GSAP not loaded. Add <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"><\/script>'),t();return}let{type:s,currentView:o,previousView:n,lastView:i,currentStage:a,duration:l,ease:c,canvas:u}=r;if(!o||!n||!a){t();return}let f=ht(l);s==="lateral"?F(r,t):s==="zoomIn"?Ne(e,o,n,i,a,f,c,t):s==="zoomOut"?Ze(e,o,n,i,a,f,c,u,t):t()}function Ne(r,t,e,s,o,n,i,a){T(t,e,s);let l=o.views[0],c=o.views[1],u=s&&o.views[2]?o.views[2]:null;dt(t,l.backwardState),dt(e,c.backwardState),u&&dt(s,u.backwardState);let f=r.timeline({onComplete:()=>{S(t,o),S(e,o),s&&S(s,o),a()}}),h=se(i),d=(o.stagger||0)/1e3;f.to(t,{transform:l.forwardState.transform,duration:n,ease:h},0),f.to(e,{transform:c.forwardState.transform,duration:n,ease:h},d),u&&f.to(s,{transform:u.forwardState.transform,duration:n,ease:h},d*2)}function Ze(r,t,e,s,o,n,i,a,l){let c=o.views[0],u=o.views[1],f=s&&o.views[2]?o.views[2]:null,h=u.backwardState,d=f?f.backwardState:null;dt(t,c.forwardState);let p=e.style.transform||getComputedStyle(e).transform||u.forwardState.transform,v=s&&f?s.style.transform||getComputedStyle(s).transform||f.forwardState.transform:null;e.style.transformOrigin=u.forwardState.origin,s&&f&&(s.style.transformOrigin=f.forwardState.origin);let m=se(i),y=r.timeline({onComplete:()=>{z(t,a),O(e,h),s&&d&&A(s,d),l()}}),b=(o.stagger||0)/1e3;r.set(e,{transform:p}),s&&v&&r.set(s,{transform:v}),y.fromTo(t,{transform:c.forwardState.transform},{transform:c.backwardState.transform,duration:n,ease:m},0),y.fromTo(e,{transform:p},{transform:h.transform,duration:n,ease:m},b),s&&d&&y.fromTo(s,{transform:v},{transform:d.transform,duration:n,ease:m},b*2)}function dt(r,t){r.style.transformOrigin=t.origin,r.style.transform=t.transform}function se(r){if(typeof r!="string")return"power2.inOut";let t=r.toLowerCase();return t==="linear"?"none":t.includes("ease-in-out")?"power2.inOut":t.includes("ease-in")?"power2.in":t.includes("ease-out")?"power2.out":t}function re(r,t){let e=Me();if(!e||typeof e!="function"){console.warn('Zumly Motion driver: Motion not loaded. Add <script src="https://cdn.jsdelivr.net/npm/motion@11/dist/motion.min.js"><\/script>'),t();return}let{type:s,currentView:o,previousView:n,lastView:i,currentStage:a,duration:l,ease:c,canvas:u}=r;if(!o||!n||!a){t();return}let f=ht(l);s==="lateral"?F(r,t):s==="zoomIn"?$e(e,o,n,i,a,f,c,t):s==="zoomOut"?Fe(e,o,n,i,a,f,c,u,t):t()}function $e(r,t,e,s,o,n,i,a){T(t,e,s);let l=oe(t,e,s,o,"forward");ne(l,0);let c=o.stagger||0,u=c/1e3,f=n*1e3,h=n+(l.length>2?u*2:u);r(0,1,{duration:h,ease:ae(i),onUpdate:p=>{let v=p*h*1e3;ie(l,v,f,c)}}).then(()=>{S(t,o),S(e,o),s&&S(s,o),a()}).catch(()=>a())}function Fe(r,t,e,s,o,n,i,a,l){let c=o.views[1],u=s&&o.views[2]?o.views[2]:null,f=c.backwardState,h=u?u.backwardState:null,d=oe(t,e,s,o,"backward");ne(d,0);let p=o.stagger||0,v=p/1e3,m=n*1e3,y=n+(d.length>2?v*2:v);r(0,1,{duration:y,ease:ae(i),onUpdate:w=>{let g=w*y*1e3;ie(d,g,m,p)}}).then(()=>{z(t,a),O(e,f),s&&h&&A(s,h),l()}).catch(()=>l())}function oe(r,t,e,s,o){let n=s.views[0],i=s.views[1],a=e&&s.views[2]?s.views[2]:null,l=[{el:r,backward:n.backwardState,forward:n.forwardState},{el:t,backward:i.backwardState,forward:i.forwardState}];return a&&l.push({el:e,backward:a.backwardState,forward:a.forwardState}),l.map(({el:c,backward:u,forward:f})=>o==="forward"?{el:c,from:P(c,u.origin,u.transform),to:P(c,u.origin,f.transform)}:{el:c,from:P(c,f.origin,f.transform),to:P(c,f.origin,u.transform)})}function ne(r,t){for(let{el:e,from:s,to:o}of r)e.style.transform=W(K(s,o,t))}function ie(r,t,e,s){for(let o=0;o<r.length;o++){let{el:n,from:i,to:a}=r[o],l=o*s,c=Math.max(0,t-l),u=e>0?Math.min(1,c/e):1;n.style.transform=W(K(i,a,u))}}function Me(){let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r.motion?.animate||r.Motion?.animate||r.animate}function ae(r){if(typeof r!="string")return"easeInOut";let t=r.toLowerCase();return t==="linear"?"linear":t.includes("ease-in-out")?"easeInOut":t.includes("ease-in")?"easeIn":t.includes("ease-out")?"easeOut":r}var le={css:Yt,waapi:Wt,none:Ut,anime:Kt,gsap:ee,motion:re};function ce(r){if(typeof r=="function")return{runTransition(s,o){r(s,o)}};let t=typeof r=="string"?r.toLowerCase():"css";return{runTransition:le[t]||le.css}}function De(r){if(typeof r!="string"||r.trim()==="")return{tx:0,ty:0,rest:""};let t=r.match(/translate\s*\(\s*([-\d.eE]+)px\s*,\s*([-\d.eE]+)px\s*\)/);if(!t)return null;let e=parseFloat(t[1]),s=parseFloat(t[2]),o=r.replace(/translate\s*\([^)]+\)\s*/,"").trim();return{tx:e,ty:s,rest:o}}function St(r,t,e){let s=De(r);if(s===null)return r;let o=s.tx*t,n=s.ty*e,i=s.rest?` ${s.rest}`:"";return`translate(${o}px, ${n}px)${i}`.trim()}function He(r){if(typeof r!="string"||!r.trim())return null;let t=r.trim().match(/^([-\d.eE]+)px\s+([-\d.eE]+)px$/);return t?{x:parseFloat(t[1]),y:parseFloat(t[2])}:null}function Et(r,t,e){let s=He(r);return s===null?r:`${s.x*t}px ${s.y*e}px`}function _t(r,t,e,s,o){if(!r.storedViews?.length||!r.canvas||t<=0||e<=0)return;let n=s/t,i=o/e;for(let d of r.storedViews){let p=d.views;if(Array.isArray(p))for(let v=0;v<p.length;v++){let m=p[v];!m||m.detachedNode||(m.backwardState&&(m.backwardState.transform=St(m.backwardState.transform,n,i),m.backwardState.origin!=null&&(m.backwardState.origin=Et(m.backwardState.origin,n,i))),m.forwardState&&(m.forwardState.transform=St(m.forwardState.transform,n,i),m.forwardState.origin!=null&&(m.forwardState.origin=Et(m.forwardState.origin,n,i))))}}let a=r.canvas,l=a.querySelector(".is-current-view"),c=a.querySelector(".is-previous-view"),u=a.querySelector(".is-last-view"),f=a.querySelector(".is-new-current-view"),h=[l,c,u,f].filter(Boolean);for(let d of h){if(!d.style)continue;let p=d.style.transform;p!=null&&p!==""&&(d.style.transform=St(p,n,i));let v=d.style.transformOrigin;v!=null&&v!==""&&(d.style.transformOrigin=Et(v,n,i))}}var je=8e3,st=class{constructor(t){if(this.storedViews=[],this.currentStage=null,this.debug=!1,this.trace=[],this.blockEvents=!1,this._blockEventsSafetyTimer=null,this.touchstartX=0,this.touchstartY=0,this.touchendX=0,this.touchendY=0,this.touching=!1,this.lateralHistory=[],this._lastCanvasWidth=0,this._lastCanvasHeight=0,this._pendingResizeCorrection=!1,this._destroyed=!1,this._hooks={},this._plugins=[],Zt(t,this),!this.isValid){this.notify("is unable to start: invalid or missing required options (mount, initialView, views).","error");return}if(this.canvas=document.querySelector(this.mount),!this.canvas){this.notify(`mount selector "${this.mount}" did not match any element.`,"error"),this.isValid=!1;return}this.transitionDriver=ce(this.transitionDriver),this._onZoom=this.onZoom.bind(this),this._onTouchStart=this.onTouchStart.bind(this),this._onTouchEnd=this.onTouchEnd.bind(this),this._onKeyUp=this.onKeyUp.bind(this),this._onWheel=this.onWheel.bind(this),this._wheelCooldown=!1,this._onPrefetchTrigger=e=>{e.target.classList.contains("zoom-me")&&e.target.dataset.to&&this.prefetcher.prefetch(e.target.dataset.to,{trigger:e.target,...e.target.dataset})},this._onResize=this._handleResize.bind(this),this._resizeDebounceTimer=null,this._RESIZE_DEBOUNCE_MS=80,this.prefetcher=new ut(this.views),this._bindEvents()}_bindEvents(){let t=this.canvas;t&&(t.setAttribute("tabindex","0"),t.setAttribute("role","application"),t.setAttribute("aria-roledescription","zoomable interface"),t.setAttribute("aria-live","polite"),t.addEventListener("mouseup",this._onZoom,!1),t.addEventListener("touchend",this._onZoom,!1),t.addEventListener("touchstart",this._onTouchStart,{passive:!0}),t.addEventListener("touchend",this._onTouchEnd,!1),t.addEventListener("keyup",this._onKeyUp,!1),t.addEventListener("wheel",this._onWheel,{passive:!1}),t.addEventListener("mouseover",this._onPrefetchTrigger,{passive:!0}),t.addEventListener("focusin",this._onPrefetchTrigger,{passive:!0}),window.addEventListener("resize",this._onResize,{passive:!0}),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._handleResize()),this._resizeObserver.observe(t)))}_unbindEvents(){let t=this.canvas;t&&(t.removeEventListener("mouseup",this._onZoom,!1),t.removeEventListener("touchend",this._onZoom,!1),t.removeEventListener("touchstart",this._onTouchStart),t.removeEventListener("touchend",this._onTouchEnd,!1),t.removeEventListener("keyup",this._onKeyUp,!1),t.removeEventListener("wheel",this._onWheel),t.removeEventListener("mouseover",this._onPrefetchTrigger),t.removeEventListener("focusin",this._onPrefetchTrigger)),window.removeEventListener("resize",this._onResize),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}_resetCanvasScroll(t){if(t&&((t.scrollLeft!==0||t.scrollTop!==0)&&(this.notify(`canvas had a residual scroll (${t.scrollLeft}, ${t.scrollTop}) \u2014 resetting. Something scrolled the canvas mid-transition.`,"warn"),t.scrollLeft=0,t.scrollTop=0),!this._warnedScrolledAncestor)){for(let e=t.parentElement;e&&e!==document.body;e=e.parentElement)if(e.scrollLeft!==0||e.scrollTop!==0){let s=e.className?`.${String(e.className).trim().split(/\s+/).join(".")}`:e.tagName.toLowerCase();this.notify(`an ancestor of the canvas (${s}) is scrolled (${e.scrollLeft}, ${e.scrollTop}): all zooms will land displaced. Use 'overflow: clip' (not 'hidden') on containers around the canvas.`,"warn"),this._warnedScrolledAncestor=!0;break}}}_setBlockEvents(){this.blockEvents=!0,this._clearBlockEventsSafety(),this._blockEventsSafetyTimer=setTimeout(()=>{this.blockEvents&&!this._destroyed&&(this.notify("blockEvents safety timeout: driver did not call onComplete. Force-resetting.","warn"),this.blockEvents=!1,this._onTransitionComplete())},je)}_clearBlockEventsSafety(){this._blockEventsSafetyTimer!==null&&(clearTimeout(this._blockEventsSafetyTimer),this._blockEventsSafetyTimer=null)}storeViews(t){this.tracing("storedViews()"),this.storedViews.push(t),this.debug&&console.debug("Zumly storedViews",t)}tracing(t){if(this.debug)if(t==="ended"){let e=this.trace.map((s,o)=>`${o===0?`Instance ${this.instance}: ${s}`:`${s}`}`).join(" > ");this.notify(e),this.trace=[]}else this.trace.push(t)}notify(t,e){return L(this.debug,t,e)}_recordCanvasSize(){if(!this.canvas)return;let t=this.canvas.getBoundingClientRect();this._lastCanvasWidth=t.width,this._lastCanvasHeight=t.height}_handleResize(){this._destroyed||(this._resizeDebounceTimer&&clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=setTimeout(()=>{if(this._resizeDebounceTimer=null,!this.isValid||!this.canvas||this._lastCanvasWidth===0)return;let t=this.canvas.getBoundingClientRect(),e=t.width,s=t.height;if(!(e===this._lastCanvasWidth&&s===this._lastCanvasHeight)){if(this.blockEvents){this._pendingResizeCorrection=!0;return}_t(this,this._lastCanvasWidth,this._lastCanvasHeight,e,s),this._lastCanvasWidth=e,this._lastCanvasHeight=s}},this._RESIZE_DEBOUNCE_MS))}_onTransitionComplete(){if(this._clearBlockEventsSafety(),this._pendingResizeCorrection&&!this.blockEvents){this._pendingResizeCorrection=!1;let t=this.canvas?.getBoundingClientRect();if(t&&this._lastCanvasWidth>0){let e=t.width,s=t.height;(e!==this._lastCanvasWidth||s!==this._lastCanvasHeight)&&_t(this,this._lastCanvasWidth,this._lastCanvasHeight,e,s),this._lastCanvasWidth=e,this._lastCanvasHeight=s}}else this._recordCanvasSize();this._manageFocus()}_manageFocus(){if(!this.canvas)return;let t=this.canvas.querySelector(".is-current-view");if(!t)return;let e=t.querySelector('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])');e?e.focus({preventScroll:!0}):(t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}))}_resolveEffects(t){let e=t?.dataset?.withEffects;if(e&&typeof e=="string"){let s=e.split("|").map(o=>o.trim());return[s[0]||"none",s[1]||s[0]||"none"]}return this.effects}_applyEffects(t,e,s,o,n){!s||s[0]==="none"&&s[1]==="none"||(t&&s[0]!=="none"&&(t.style.setProperty("--z-effect-filter",s[0]),t.style.setProperty("--zoom-duration",o),t.style.setProperty("--zoom-ease",n),t.classList.add("has-effect")),e&&s[1]!=="none"&&(e.style.setProperty("--z-effect-filter",s[1]),e.style.setProperty("--zoom-duration",o),e.style.setProperty("--zoom-ease",n),e.classList.add("has-effect")))}_removeEffect(t){if(!t||!t.classList.contains("has-effect"))return;t.classList.remove("has-effect"),t.classList.add("has-effect-reverse");let e=()=>{t.classList.remove("has-effect-reverse"),t.style.removeProperty("--z-effect-filter"),t.removeEventListener("transitionend",e)};t.addEventListener("transitionend",e,{once:!0});let s=t.style.getPropertyValue("--zoom-duration");setTimeout(e,s?parseFloat(s)*(s.includes("ms")?1:1e3)+100:1100)}_resolveHideTrigger(t){return t?.dataset?.hideTrigger!==void 0?t.dataset.hideTrigger==="fade"?"fade":!0:this.hideTrigger}_applyHideTrigger(t,e,s,o,n){!s||!t||(s==="fade"?(t.style.setProperty("--zoom-duration",o),t.style.setProperty("--zoom-ease",n),t.classList.add("z-trigger-fade"),e.style.setProperty("--zoom-duration",o),e.style.setProperty("--zoom-ease",n),e.classList.add("z-view-fade-in"),e.offsetHeight,e.classList.remove("hide")):t.classList.add("z-trigger-hidden"))}_restoreHideTrigger(t,e,s,o){if(!(!e||!t))if(e==="fade"){t.classList.remove("z-trigger-fade"),t.style.setProperty("--zoom-duration",s),t.style.setProperty("--zoom-ease",o),t.classList.add("z-trigger-fade-reverse");let n=()=>{t.classList.remove("z-trigger-fade-reverse"),t.style.removeProperty("--zoom-duration"),t.style.removeProperty("--zoom-ease"),t.removeEventListener("transitionend",n)};t.addEventListener("transitionend",n,{once:!0}),setTimeout(n,parseFloat(s)*(s.includes("ms")?1:1e3)+100)}else t.classList.remove("z-trigger-hidden")}on(t,e){return typeof e!="function"?this:((this._hooks[t]||=[]).push(e),this)}use(t,e){if(!t)return this;let s={plugin:t,options:e};return this._plugins.push(s),this._initialized&&this._installPlugin(s),this}_installPlugin(t){let{plugin:e,options:s}=t;try{typeof e=="function"?e(this,s):typeof e.install=="function"&&e.install(this,s)}catch(o){this.notify(`plugin install error: ${o.message}`,"error")}}off(t,e){return e?this._hooks[t]&&(this._hooks[t]=this._hooks[t].filter(s=>s!==e)):delete this._hooks[t],this}_emit(t,e={}){let s=this._hooks[t];if(!(!s||s.length===0))for(let o of s)try{o(e)}catch(n){this.debug&&console.error(`Zumly hook "${t}" threw:`,n)}}zoomLevel(){return this.storedViews.length}getZoomLevel(){return this.zoomLevel()}getCurrentViewName(){return!this.storedViews||this.storedViews.length===0?null:this.storedViews[this.storedViews.length-1]?.views?.[0]?.viewName??null}back(){if(!this._destroyed){if(this.blockEvents){this.notify("back ignored: a transition is already running.","warn");return}if(this.lateralHistory&&this.lateralHistory.length>0){let t=this.lateralHistory.pop(),e=t&&typeof t=="object"?t.name:t,s=t&&typeof t=="object"?t.entry:void 0,o=t&&typeof t=="object"?t.node:void 0;return this._doLateral(e,!0,{savedEntry:s,keepAliveNode:o})}this.zoomOut()}}async goTo(t,e={}){return this._destroyed?void 0:(e.mode==="lateral"?"lateral":"depth")==="depth"?this.zoomTo(t,e):this._doLateral(t,!1,e)}async zoomTo(t,e={}){if(this._destroyed)return;if(!this.isValid||!this.canvas){this.notify("zoomTo() cannot run: instance is invalid or canvas not found.","error");return}if(typeof t!="string"||!t){this.notify("zoomTo() requires a non-empty view name.","warn");return}if(!Object.prototype.hasOwnProperty.call(this.views,t)){this.notify(`zoomTo("${t}"): view not found in views. Available: ${Object.keys(this.views).join(", ")}`,"warn");return}if(this.getCurrentViewName()===t)return;let o=this.canvas.getBoundingClientRect(),n=Math.max(40,o.width*.1),i=Math.max(40,o.height*.1),l={rect:{x:o.left+(o.width-n)/2,y:o.top+(o.height-i)/2,width:n,height:i},duration:e.duration??this.duration,ease:e.ease??this.ease,props:e.props??{}};await this._doZoomIn(t,l)}async init(){if(this._destroyed)return;if(!this.isValid||!this.canvas){this.notify("init() cannot run: instance is invalid or canvas element was not found.","error");return}this.tracing("init()"),this.preload&&this.preload.length&&await this.prefetcher.preloadEager(this.preload,null);let t=await this.prefetcher.get(this.initialView,null),e=await Q(t,this.initialView,this.canvas,!0,this.views,this.componentContext);this._emit("viewMounted",{viewName:this.initialView,node:e}),this.prefetcher.scanAndPrefetch(e,null),this.storeViews({zoomLevel:this.storedViews.length,scale:1,views:[{viewName:this.initialView,backwardState:{origin:"0 0",transform:""}}]}),this.currentStage=this.storedViews[this.storedViews.length-1],this._recordCanvasSize(),this._initialized=!0;for(let s of this._plugins)this._installPlugin(s)}destroy(){this._destroyed||(this._emit("destroy"),this._destroyed=!0,this._clearBlockEventsSafety(),this._resizeDebounceTimer&&(clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=null),this._unbindEvents(),this._removeNav(),this._cleanupLateralKeepAlive(),this.blockEvents=!1,this.storedViews=[],this.currentStage=null,this.lateralHistory=[],this.trace=[],this._hooks={},this.prefetcher=null,this.transitionDriver=null,this.canvas&&(this.canvas.removeAttribute("tabindex"),this.canvas.removeAttribute("role"),this.canvas.removeAttribute("aria-roledescription"),this.canvas.removeAttribute("aria-live")),this.isValid=!1)}async _doZoomIn(t,e){if(this._destroyed)return;if(this.blockEvents){this.notify("zoomIn ignored: a transition is already running.","warn");return}this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomIn",{viewName:t}),this.tracing("zoomIn()");let s=this.canvas,o=e.el;this._resetCanvasScroll(s);let n=s.getBoundingClientRect(),i=n.left,a=n.top,c=(this.storedViews.length>0?this.storedViews[this.storedViews.length-1]:null)?.scale??1;this.tracing("getView()");let u=o?{trigger:o,target:document.createElement("div"),context:this.componentContext,props:Object.assign({},o.dataset)}:{target:document.createElement("div"),context:this.componentContext,props:e.props??{}},f=o?.dataset?.deferred!==void 0?!0:this.deferred,h,d=null;if(f){let E=await this.prefetcher.get(t,u);if(this._destroyed)return;for(d=document.createDocumentFragment();E.firstChild;)d.appendChild(E.firstChild);h=await Q(E,t,s,!1,{},this.componentContext)}else{let E=await this.prefetcher.get(t,u);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(E,u),h=await Q(E,t,s,!1,this.views,this.componentContext)}if(!h)return;f||this._emit("viewMounted",{viewName:t,node:h}),o&&o.classList.add("zoomed");let p=o?(()=>{let E=o.getBoundingClientRect();return{x:E.x,y:E.y,width:E.width,height:E.height}})():e.rect,v=o?o.dataset.withDuration||this.duration:e.duration??this.duration,m=o?o.dataset.withEase||this.ease:e.ease??this.ease,y=o?o.dataset.withCover||this.cover:e.cover??this.cover,b=o?parseInt(o.dataset.withStagger,10)||this.stagger:e.stagger??this.stagger,w=s.querySelector(".is-current-view"),g=s.querySelector(".is-previous-view"),x=s.querySelector(".is-last-view");Y(h),Y(w),Y(g),x&&(Y(x),s.removeChild(x));let k,C,q,H,G,rt,_,N=w.style.transform,$=w.style.transformOrigin,B=g?g.style.transform:null,Lt=g?g.style.transformOrigin:null;try{w.classList.replace("is-current-view","is-previous-view"),g&&g.classList.replace("is-previous-view","is-last-view");let E=h.getBoundingClientRect(),j=w.getBoundingClientRect(),vt=null,Tt=null,nt=null;g&&(vt=g.getBoundingClientRect(),nt=g.querySelector(".zoomed"),Tt=nt&&nt.getBoundingClientRect?nt.getBoundingClientRect():vt);let it={left:i,top:a},zt={width:n.width,height:n.height},kt={width:E.width,height:E.height},Ct=$t(p.width,p.height,E.width,E.height,y);_=Ct.scale;let we=Ct.scaleInv;k=Ft(p,it,kt,we),q=w.style.transform;let Ot=Dt(p,j);H=Ht(zt,p,j,_,this.parallax);let At=lt($||"0 0"),V=J(q||""),Pt=lt(Ot),X=J(H.transform),It=p;if(o&&(It=ct(p,j,At,V.tx,V.ty,V.scale,Pt,X.tx,X.ty,X.scale)),C=Mt(It,it,kt),g){G=g.style.transform;let ge=ct(j,j,At,V.tx,V.ty,V.scale,Pt,X.tx,X.ty,X.scale),be=Rt(H.x,H.y,it,_,c),Nt=lt(Lt||"0 0"),yt=J(G||""),wt=J(be),Se=ct(Tt,vt,Nt,yt.tx,yt.ty,yt.scale,Nt,wt.tx,wt.ty,wt.scale);rt=jt({canvasRect:zt,canvasOffset:it,triggerRect:p,previousViewRectAtBaseTransform:j,lastViewZoomedElementRect:Se,previousViewRectWithPreviousAtEndTransform:ge,scale:_,preScale:c,parallax:this.parallax})}h.style.transform=k,w.style.transformOrigin=Ot}catch(E){this.notify(`zoomIn geometry computation failed: ${E.message}. Aborting zoom.`,"error"),this.debug&&console.error("Zumly _doZoomIn error:",E),w.style.transform=N,w.style.transformOrigin=$,w.classList.contains("is-previous-view")&&w.classList.replace("is-previous-view","is-current-view"),g&&(g.style.transform=B,g.style.transformOrigin=Lt,g.classList.contains("is-last-view")&&g.classList.replace("is-last-view","is-previous-view"));try{s.removeChild(h)}catch{}R(w),R(g);return}let he=tt(h.dataset.viewName,{origin:h.style.transformOrigin,duration:v,ease:m,transform:k},{origin:h.style.transformOrigin,duration:v,ease:m,transform:C}),de=tt(w.dataset.viewName,{origin:w.style.transformOrigin,duration:v,ease:m,transform:q},{origin:w.style.transformOrigin,duration:v,ease:m,transform:H.transform}),me=g?tt(g.dataset.viewName,{origin:g.style.transformOrigin,duration:v,ease:m,transform:G},{origin:g.style.transformOrigin,duration:v,ease:m,transform:rt}):null,pe=x?qt(x):null,ot=Bt(this.storedViews.length,he,de,me,pe);ot.scale=_,ot.stagger=b||0,this.storeViews(ot),this.currentStage=this.storedViews[this.storedViews.length-1],this.tracing("setCSSVariables()");let ve=this._resolveEffects(o);this._applyEffects(w,g,ve,v,m);let pt=this._resolveHideTrigger(o);this._applyHideTrigger(o,h,pt,v,m),pt&&(ot.hideTriggerMode=pt),this._setBlockEvents();let ye={type:"zoomIn",currentView:h,previousView:w,lastView:g,currentStage:this.currentStage,duration:v,ease:m};this.transitionDriver.runTransition(ye,async()=>{f&&d&&h&&!this._destroyed&&(h.appendChild(d),this.prefetcher.scanAndPrefetch(h,u),typeof this.views[t]=="object"&&typeof this.views[t].mounted=="function"&&await this.views[t].mounted(),this._emit("viewMounted",{viewName:t,node:h})),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterZoomIn",{viewName:t,zoomLevel:this.zoomLevel()}),this.tracing("ended")})}async zoomIn(t){this._destroyed||t?.dataset?.to&&await this._doZoomIn(t.dataset.to,{el:t})}async _doLateral(t,e=!1,s={}){if(this._destroyed)return;if(this.blockEvents){this.notify("lateral navigation ignored: a transition is already running.","warn");return}if(!this.isValid||!this.canvas)return;if(!Object.prototype.hasOwnProperty.call(this.views,t)){this.notify(`goTo("${t}", { mode: 'lateral' }): view not found in views. Available: ${Object.keys(this.views).join(", ")}`,"warn");return}let o=this.canvas.querySelector(".is-current-view");if(!o)return;let n=o.dataset?.viewName;if(n===t)return;this._emit("beforeLateral",{viewName:t,from:n,isBack:e});let i=this.lateralNav&&this.lateralNav.keepAlive;if(!e){this.lateralHistory=this.lateralHistory||[];let _=this.storedViews[this.storedViews.length-1];this.lateralHistory.push({name:n,entry:_.views[0],node:i?o:null})}this.tracing("lateral()");let a=s.duration??this.duration,l=s.ease??this.ease,c=this.canvas.querySelector(".is-previous-view"),u=this.canvas.querySelector(".is-last-view"),f=0,h=0,d=this._declaredSiblings(),p=d?d.indexOf(n):-1,v=d?d.indexOf(t):-1;if(p!==-1&&v!==-1){let _=this.canvas.getBoundingClientRect();f=(p-v)*_.width*.15}else if(c){let _=c.querySelector(`.zoom-me[data-to="${n}"]`),N=c.querySelector(`.zoom-me[data-to="${t}"]`);if(_&&N){let $=_.getBoundingClientRect(),B=N.getBoundingClientRect();f=$.left+$.width/2-(B.left+B.width/2),h=$.top+$.height/2-(B.top+B.height/2)}else f=this.canvas.getBoundingClientRect().width*.15}let m=null,y=null;if(i&&(e&&s.keepAliveNode?y=s.keepAliveNode:y=this.canvas.querySelector(`.is-lateral-hidden[data-view-name="${t}"]`)),y){if(y.style.display="",y.style.opacity="",y.classList.remove("is-lateral-hidden","zoom-lateral-out"),y.classList.add("is-new-current-view","has-no-events"),m=y,!e&&this.lateralHistory){let _=this.lateralHistory.findIndex(N=>N.node===y);_!==-1&&this.lateralHistory.splice(_,1)}}else{let _={target:document.createElement("div"),context:this.componentContext,props:s.props??{}},N=await this.prefetcher.get(t,_);if(this._destroyed||(this.prefetcher.scanAndPrefetch(N,_),m=await Q(N,t,this.canvas,!1,this.views,this.componentContext),!m))return;this._emit("viewMounted",{viewName:t,node:m})}Y(m);let b=o.style.transform||"",w=o.style.transformOrigin||"0 0";m.style.transform=b,m.style.transformOrigin=w;let g=this.storedViews[this.storedViews.length-1],x=e&&s.savedEntry?{...s.savedEntry,viewName:t}:tt(t,{origin:w,duration:a,ease:l,transform:b},{origin:w,duration:a,ease:l,transform:b});g.views[0]=x,this.currentStage=g;let k=c?{transformStart:c.style.transform||"",transformEnd:this._computeLateralBackTransform(c.style.transform||"",f,h)}:null,C=u&&g.views[2]?{transformStart:u.style.transform||"",transformEnd:this._computeLateralBackTransform(u.style.transform||"",f*.7,h*.7)}:null;k&&g.views[1]&&(g.views[1].forwardState={...g.views[1].forwardState,transform:k.transformEnd}),C&&g.views[2]&&(g.views[2].forwardState={...g.views[2].forwardState,transform:C.transformEnd});let q=b,H=this._computeLateralBackTransform(q,-f,-h),G=this._computeLateralBackTransform(b,f,h);this._setBlockEvents();let rt={type:"lateral",currentView:m,previousView:o,lastView:u||null,backView:c||null,backViewState:k,lastViewState:C,incomingTransformStart:H,incomingTransformEnd:q,outgoingTransform:b,outgoingTransformEnd:G,currentStage:this.currentStage,duration:a,ease:l,canvas:this.canvas,slideDeltaX:f,slideDeltaY:h,keepAlive:i&&!e?i:!1};this.transitionDriver.runTransition(rt,()=>{i&&!e&&(o.classList.remove("is-current-view","is-new-current-view","has-no-events"),o.classList.add("is-lateral-hidden"),i!=="visible"?o.style.display="none":(o.style.transform=b,o.style.opacity="")),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterLateral",{viewName:t,from:n,isBack:e}),this.tracing("ended")})}_computeLateralBackTransform(t,e,s){let o=t.match(/translate\s*\(\s*([-\d.eE]+)px\s*,\s*([-\d.eE]+)px\s*\)/);if(o){let n=parseFloat(o[1])+e,i=parseFloat(o[2])+s,a=t.replace(/translate\s*\([^)]+\)\s*/,"");return`translate(${n}px, ${i}px) ${a}`.trim()}return`translate(${e}px, ${s}px) ${t}`.trim()}zoomOut(){if(this._destroyed)return;if(this.blockEvents){this.notify("zoomOut ignored: a transition is already running.","warn");return}this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("zoomOut()");let t=this.canvas;this._resetCanvasScroll(t);let e=t.querySelector(".is-current-view"),s=t.querySelector(".is-previous-view");if(!e||!s){this.notify("zoomOut: current or previous view not found (animation may still be running)","warn");return}this._setBlockEvents(),this.currentStage=this.storedViews[this.storedViews.length-1];let o=t.querySelector(".is-last-view");this.tracing("setCSSVariables()");let n=this.currentStage.views[0]?.forwardState?.duration??this.duration,i=this.currentStage.views[0]?.forwardState?.ease??this.ease,a=s.querySelector(".zoomed");a&&a.classList.remove("zoomed");let l=this.currentStage.hideTriggerMode;l&&a&&this._restoreHideTrigger(a,l,n,i),l==="fade"?(e.classList.remove("z-view-fade-in"),e.style.setProperty("--zoom-duration",n),e.style.setProperty("--zoom-ease",i),e.classList.add("z-view-fade-out")):(e.classList.remove("z-view-fade-in"),e.style.removeProperty("opacity")),this._removeEffect(s),s.classList.replace("is-previous-view","is-current-view"),o!==null&&(o.classList.contains("has-effect")&&this.effects[0]!=="none"&&o.style.setProperty("--z-effect-filter",this.effects[0]),o.classList.replace("is-last-view","is-previous-view"),o.classList.remove("hide"),R(o));let c=Vt(this.currentStage);if(c){t.prepend(c);let f=t.querySelector(".z-view:first-child");f&&(R(f),f.classList.add("hide"))}let u={type:"zoomOut",currentView:e,previousView:s,lastView:o,currentStage:this.currentStage,duration:n,ease:i,canvas:t};this.transitionDriver.runTransition(u,()=>{this.blockEvents=!1,this._onTransitionComplete(),this.storedViews.pop(),this._updateNav(),this._emit("afterZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("ended")})}onZoom(t){if(this._destroyed||t.type==="mouseup"&&!this.inputs.click||t.type==="touchend"&&!this.inputs.touch)return;let e=t.target;if(e.closest(".z-depth-nav")||e.closest(".z-lateral-nav"))return;let s=e.classList.contains("zoom-me")||e.closest(".zoom-me");if(!this.blockEvents&&s&&!this.touching){this.tracing("onZoom() \u2192 zoomIn"),t.stopPropagation();let o=e.classList.contains("zoom-me")?e:e.closest(".zoom-me");this.zoomIn(o);return}if(this.storedViews.length>1&&!this.blockEvents&&!s&&!this.touching){let o=this.canvas.querySelector(".is-current-view");if(o&&o.contains(e))return;let n=this._findSiblingTriggerAtPoint(t.clientX,t.clientY);if(n){this.tracing("onZoom() \u2192 lateral"),t.stopPropagation(),this._doLateral(n.dataset.to);return}this.tracing("onZoom() \u2192 zoomOut"),t.stopPropagation(),this.zoomOut()}}_findSiblingTriggerAtPoint(t,e){let s=this.canvas.querySelector(".is-previous-view");if(!s)return null;let n=this.canvas.querySelector(".is-current-view")?.dataset?.viewName;if(!n)return null;let i=s.querySelectorAll(".zoom-me[data-to]");for(let a of i){if(a.dataset.to===n)continue;let l=a.getBoundingClientRect();if(t>=l.left&&t<=l.right&&e>=l.top&&e<=l.bottom)return a}return null}_getSiblings(){let e=this.canvas.querySelector(".is-current-view")?.dataset?.viewName,s=this._declaredSiblings();if(s&&s.indexOf(e)!==-1)return{siblings:s,currentIndex:s.indexOf(e)};let o=this.canvas.querySelector(".is-previous-view");if(!o)return{siblings:[],currentIndex:-1};let n=o.querySelectorAll(".zoom-me[data-to]"),i=[];for(let l of n)l.dataset.to&&i.push(l.dataset.to);let a=i.indexOf(e);return{siblings:i,currentIndex:a}}_declaredSiblings(){let t=this.lateralNav&&typeof this.lateralNav=="object"?this.lateralNav.siblings:null;if(!t)return null;if(Array.isArray(t))return t;let e=this.canvas.querySelector(".is-previous-view")?.dataset?.viewName;return e&&Array.isArray(t[e])?t[e]:null}_updateNav(){this._destroyed||(this._removeNav(),this._updateDepthNav(),this._updateLateralNav())}_updateDepthNav(){if(!this.depthNav||this.storedViews.length-1<1)return;let e=this.canvas.querySelector(".z-view.is-current-view");if(e&&e.querySelector(".z-depth-nav"))return;let s=this.depthNav.position||"bottom-left",o=document.createElement("div");o.className="z-depth-nav z-depth-nav--"+s;let n=document.createElement("button");n.className="z-nav-back",n.setAttribute("aria-label","Zoom out (go back)"),n.innerHTML="&#8249;",n.addEventListener("mouseup",i=>{i.stopPropagation(),!this.blockEvents&&this.storedViews.length>1&&this.zoomOut()}),o.appendChild(n),this.canvas.appendChild(o)}_updateLateralNav(){if(!this.lateralNav)return;let t=this.storedViews.length-1,e=this._getSiblings();if(e.siblings.length<2)return;if(this.lateralNav.mode==="auto"&&t>=1){let a=this.canvas.querySelector(".z-view.is-current-view");if(a&&a.offsetWidth>=this.canvas.offsetWidth&&a.offsetHeight>=this.canvas.offsetHeight)return}let{siblings:s,currentIndex:o}=e,n=this.lateralNav.position||"bottom-center",i=document.createElement("div");if(i.className="z-lateral-nav z-lateral-nav--"+n,this.lateralNav.arrows){let a=document.createElement("button");a.className="z-nav-arrow z-nav-prev",a.setAttribute("aria-label","Previous sibling view"),a.innerHTML="&#8249;",a.disabled=o<=0,a.addEventListener("mouseup",l=>{l.stopPropagation(),o>0&&this._doLateral(s[o-1])}),i.appendChild(a)}if(this.lateralNav.dots){let a=document.createElement("div");a.className="z-nav-lateral-dots";for(let l=0;l<s.length;l++){let c=document.createElement("button");c.className="z-nav-dot z-nav-lat-dot"+(l===o?" is-active":""),c.setAttribute("aria-label",`Go to ${s[l]}`),c.dataset.to=s[l],c.addEventListener("mouseup",(u=>f=>{f.stopPropagation(),u!==o&&this._doLateral(s[u])})(l)),a.appendChild(c)}i.appendChild(a)}if(this.lateralNav.arrows){let a=document.createElement("button");a.className="z-nav-arrow z-nav-next",a.setAttribute("aria-label","Next sibling view"),a.innerHTML="&#8250;",a.disabled=o>=s.length-1,a.addEventListener("mouseup",l=>{l.stopPropagation(),o<s.length-1&&this._doLateral(s[o+1])}),i.appendChild(a)}this.canvas.appendChild(i)}_removeNav(){this.canvas&&this.canvas.querySelectorAll(".z-depth-nav, .z-lateral-nav").forEach(t=>t.remove())}_cleanupLateralKeepAlive(){if(!this.canvas)return;let t=this.canvas.querySelectorAll(".is-lateral-hidden");for(let e of t)e.remove()}onKeyUp(t){this._destroyed||this.inputs.keyboard&&(this.tracing("onKeyUp()"),(t.key==="ArrowLeft"||t.key==="ArrowDown")&&(t.preventDefault(),this.storedViews.length>1&&!this.blockEvents?this.zoomOut():this.notify(`is on level zero. Can't zoom out. Trigger: ${t.key}`,"warn")),(t.key==="ArrowRight"||t.key==="ArrowUp")&&(t.preventDefault(),this.notify(t.key+" has no actions defined")))}onWheel(t){this._destroyed||this.inputs.wheel&&(this._isInsideScrollable(t.target,t.deltaY)||(t.preventDefault(),!(this.blockEvents||this._wheelCooldown)&&t.deltaY>0&&this.storedViews.length>1&&(this.tracing("onWheel() \u2192 zoomOut"),this._wheelCooldown=!0,setTimeout(()=>{this._wheelCooldown=!1},500),this.zoomOut())))}_isInsideScrollable(t,e){let s=t,o=this.canvas.querySelector(".is-current-view");for(;s&&s!==this.canvas;){if(s===o||o&&o.contains(s)){let{overflowY:n}=window.getComputedStyle(s);if((n==="auto"||n==="scroll")&&(e>0?s.scrollTop+s.clientHeight<s.scrollHeight-1:s.scrollTop>0))return!0}s=s.parentElement}return!1}onTouchStart(t){this._destroyed||this.inputs.touch&&(this.tracing("onTouchStart()"),this.touching=!0,this.touchstartX=t.changedTouches[0].screenX,this.touchstartY=t.changedTouches[0].screenY)}onTouchEnd(t){this._destroyed||this.inputs.touch&&(this.blockEvents||(this.tracing("onTouchEnd()"),this.touchendX=t.changedTouches[0].screenX,this.touchendY=t.changedTouches[0].screenY,this.handleGesture(t)))}handleGesture(t){t.stopPropagation(),this.tracing("handleGesture()");let e=this.touchendX-this.touchstartX,s=this.touchendY-this.touchstartY,o=Math.abs(e)<10&&Math.abs(s)<10;e<-30&&(this.storedViews.length>1&&!this.blockEvents?(this.tracing("swipe left"),this.zoomOut()):this.notify("is on level zero. Can't zoom out. Trigger: Swipe left","warn"));let n=t.target.classList.contains("zoom-me")?t.target:t.target.closest(".zoom-me");o&&!this.blockEvents&&n&&this.touching&&(this.touching=!1,this.tracing("tap"),t.preventDefault(),this.zoomIn(n)),o&&this.storedViews.length>1&&!this.blockEvents&&!n&&t.target.closest(".is-current-view")===null&&this.touching&&(this.touching=!1,this.tracing("tap"),this.zoomOut())}};var Re={separator:"/",prefix:"/"};function fe(r,t){let e=[];for(let s of r.storedViews){let o=s.views&&s.views[0];o&&o.viewName&&e.push(o.viewName)}return e.join(t)}function qe(r,t){let e=window.location.hash.slice(1);return e.startsWith(r)&&(e=e.slice(r.length)),e?e.split(t).filter(Boolean):[]}var ue={install(r,t){let e=Object.assign({},Re,t),s=e.separator,o=e.prefix,n=!1;function i(u){if(n)return;let f=fe(r,s),h="#"+o+f;window.location.hash!==h&&(n=!0,window.history[u](null,"",h),n=!1)}function a(){i("pushState")}function l(){i("replaceState")}r.on("afterZoomIn",a),r.on("afterLateral",a),r.on("afterZoomOut",l);function c(){if(n)return;n=!0;let u=qe(o,s),f=fe(r,s).split(s).filter(Boolean);if(u.join(s)===f.join(s)){n=!1;return}if(u.length<f.length){let h=f.length-u.length;for(let d=0;d<h;d++)r.zoomOut()}else if(u.length===f.length&&u.length>0){let h=u[u.length-1];h!==f[f.length-1]&&r.goTo(h,{mode:"lateral"})}else u.length>f.length&&window.history.back();n=!1}window.addEventListener("popstate",c),l(),r.on("destroy",function(){r.off("afterZoomIn",a),r.off("afterLateral",a),r.off("afterZoomOut",l),window.removeEventListener("popstate",c)})}};st.Router=ue;var Ns=st;export{st as Zumly,ue as ZumlyRouter,Ns as default};
7
+ var ft=class{#t={};constructor(t={}){this.#t=t}#e(t){return typeof t=="function"?"function":t instanceof HTMLElement?"element":typeof t=="object"&&t!==null&&typeof t.render=="function"?"object":typeof t!="string"?"unknown":/^https?:\/\/|^\/|\.html$|\.php$/i.test(t)?"url":t.includes("<")?"html":t.includes("-")?"webcomponent":"unknown"}async resolve(t,e=null){if(typeof t=="string"&&Object.prototype.hasOwnProperty.call(this.#t,t)){let n=this.#t[t];return this.resolve(n,e)}switch(this.#e(t)){case"html":{let n=document.createElement("div");n.innerHTML=t.trim();let o=n.firstElementChild;if(!o)throw new Error("Zumly: view produced no element (html)");return o}case"url":{let n=new AbortController,o=setTimeout(()=>n.abort(),1e4),i;try{i=await fetch(t,{signal:n.signal})}finally{clearTimeout(o)}if(!i.ok)throw new Error(`Zumly: fetch failed for "${t}" (${i.status})`);let a=await i.text(),l=document.createElement("div");l.innerHTML=a.trim();let c=l.firstElementChild;if(!c)throw new Error("Zumly: view produced no element (url)");return c}case"function":{let n=e&&e.target||document.createElement("div"),o=await t({...e,target:n});if(typeof o=="string")return this.resolve(o,e);if(o instanceof HTMLElement)return o;let i=n.firstElementChild||n;return i.classList.contains("z-view")||i.classList.add("z-view"),i}case"object":{let n=await t.render(e);if(typeof n!="string")throw new Error("Zumly: view render() must return string");return this.resolve(n,e)}case"element":return t.cloneNode(!0);case"webcomponent":return await customElements.whenDefined(t),document.createElement(t);default:throw new Error("Zumly: unknown view type for source")}}};async function et(r,t,e,s,n,o){if(!r||!r.classList){let i=document.createElement("div");i.classList.add("z-view"),r&&i.appendChild(r),r=i}else r.classList.contains("z-view")||r.classList.add("z-view");return r.dataset.viewName=t,r.getAttribute("aria-label")||r.setAttribute("aria-label",`View: ${t}`),r.style.transformOrigin="0 0",r.style.position="absolute",s?r.classList.add("is-current-view"):r.classList.add("is-new-current-view","has-no-events","hide"),e.append(r),typeof n[t]=="object"&&typeof n[t].mounted=="function"&&await n[t].mounted(),r}function L(r,t,e){t&&e==="welcome"&&console.info(`%c Zumly %c ${t}`,"background: #424085; color: white; border-radius: 3px;","color: #424085"),t&&r&&(e==="info"||e===void 0)&&console.info(`%c Zumly %c ${t}`,"background: #6679A3; color: #304157; border-radius: 3px;","color: #6679A3"),t&&e==="warn"&&console.warn(`%c Zumly %c ${t}`,"background: #DCBF53; color: #424085; border-radius: 3px;","color: #424085"),t&&e==="error"&&console.error(`%c Zumly %c ${t}`,"background: #BE4747; color: white; border-radius: 3px;","color: #424085")}function Dt(r,t){if(t.isValid=!1,!r||typeof r!="object"){L(!1,"'options' object has to be provided when instance is defined","error");return}if(typeof r.mount!="string"){L(!1,"'mount' must be a string selector","error");return}if(t.mount=r.mount,typeof r.initialView!="string"){L(!1,"'initialView' must be a string","error");return}if(t.initialView=r.initialView,!r.views||typeof r.views!="object"){L(!1,"'views' must be an object","error");return}t.views=r.views,t.isValid=!0,t.preload=Array.isArray(r.preload)?r.preload:[],t.debug=typeof r.debug=="boolean"?r.debug:!1,t.componentContext=r.componentContext&&typeof r.componentContext=="object"?r.componentContext:new Map;let e=r.transitions&&typeof r.transitions=="object"?r.transitions:null,s=e&&e.cover,n=typeof s=="string"?s.toLowerCase():null,o=n==="width"||n==="height";t.cover=o?n:"width",!o&&e&&s!==void 0&&L(!1,`'transitions.cover' must be either "width" or "height". Falling back to "width".`,"warn"),t.duration=e&&typeof e.duration=="string"?e.duration:"1s",t.ease=e&&typeof e.ease=="string"?e.ease:"ease-in-out",t.deferred=typeof r.deferred=="boolean"?r.deferred:!1;let i=e&&e.hideTrigger;i===!0||i==="fade"?t.hideTrigger=i:(t.hideTrigger=!1,i!=null&&i!==!1&&L(!1,`'transitions.hideTrigger' must be true or "fade". Falling back to false.`,"warn"));let a=e&&e.effects;Array.isArray(a)&&a.length>=2&&typeof a[0]=="string"&&typeof a[1]=="string"?t.effects=[a[0],a[1]]:Array.isArray(a)&&a.length===1&&typeof a[0]=="string"?t.effects=[a[0],a[0]]:(t.effects=["none","none"],a!=null&&L(!1,`'transitions.effects' must be an array of 1-2 CSS filter strings (e.g. ["blur(3px)", "blur(8px) saturate(0)"]). Falling back to no effects.`,"warn"));let l=e&&e.driver,c=typeof l=="string"?l.toLowerCase():null,f=typeof l=="function"?l:null;if(c!==null){let d=["css","waapi","none","anime","gsap","motion"];t.transitionDriver=d.includes(c)?c:"css",d.includes(c)||L(!1,`'transitions.driver' must be "css", "waapi", "none", "anime", "gsap", "motion", or a function. Got "${l}". Falling back to "css".`,"warn")}else f!==null?t.transitionDriver=f:t.transitionDriver="css";let u=e&&e.stagger;typeof u=="number"&&u>0?t.stagger=u:(t.stagger=0,u!=null&&u!==0&&L(!1,"'transitions.stagger' must be a positive number (ms). Falling back to 0 (disabled).","warn")),t.parallax=0;let h=r.lateralNav;if(h===!1)t.lateralNav=!1;else if(h&&typeof h=="object"){let d=typeof h.mode=="string"?h.mode.toLowerCase():null,g=d==="auto"||d==="always";d&&!g&&L(!1,`'lateralNav.mode' must be "auto" or "always". Falling back to "auto".`,"warn");let v=null;if(Array.isArray(h.siblings))v=h.siblings.filter(w=>typeof w=="string"&&w),v.length<2&&(L(!1,"'lateralNav.siblings' needs at least 2 view names. Ignoring.","warn"),v=null);else if(h.siblings&&typeof h.siblings=="object"){v={};for(let[w,b]of Object.entries(h.siblings))if(Array.isArray(b)){let _=b.filter(S=>typeof S=="string"&&S);_.length>=2&&(v[w]=_)}Object.keys(v).length===0&&(v=null)}else h.siblings!==void 0&&L(!1,"'lateralNav.siblings' must be an array of view names or a { parentView: [...] } map. Ignoring.","warn");t.lateralNav={mode:g?d:"auto",arrows:typeof h.arrows=="boolean"?h.arrows:!0,dots:typeof h.dots=="boolean"?h.dots:!0,keepAlive:h.keepAlive===!0||h.keepAlive==="visible"?h.keepAlive:!1,siblings:v}}else t.lateralNav={mode:"auto",arrows:!0,dots:!0,keepAlive:!1,siblings:null};let m=r.depthNav;if(m===!1)t.depthNav=!1;else if(m&&typeof m=="object"){let d=typeof m.position=="string"?m.position.toLowerCase():null,g=d==="bottom-left"||d==="top-left";d&&!g&&L(!1,`'depthNav.position' must be "bottom-left" or "top-left". Falling back to "bottom-left".`,"warn"),t.depthNav={position:g?d:"bottom-left"}}else t.depthNav={position:"bottom-left"};let y=r.lateralNav&&typeof r.lateralNav=="object"?r.lateralNav.position:void 0;if(t.lateralNav&&typeof t.lateralNav=="object"){let d=y==="bottom-center"||y==="top-center";y&&!d&&L(!1,`'lateralNav.position' must be "bottom-center" or "top-center". Falling back to "bottom-center".`,"warn"),t.lateralNav.position=d?y:"bottom-center"}let p=r.inputs;p&&typeof p=="object"?t.inputs={wheel:typeof p.wheel=="boolean"?p.wheel:!0,keyboard:typeof p.keyboard=="boolean"?p.keyboard:!0,click:typeof p.click=="boolean"?p.click:!0,touch:typeof p.touch=="boolean"?p.touch:!0}:t.inputs={wheel:!0,keyboard:!0,click:!0,touch:!0}}function Ft(r,t,e,s,n){let o=e/r,i=s/t;return n==="height"?{scale:i,scaleInv:1/i}:{scale:o,scaleInv:1/o}}function Ht(r,t,e,s){let n=t.left,o=t.top,i=r.x-n+(r.width-e.width*s)/2,a=r.y-o+(r.height-e.height*s)/2;return`translate(${i}px, ${a}px) scale(${s})`}function jt(r,t,e){let s=t.left,n=t.top,o=r.x-s+(r.width-e.width)/2,i=r.y-n+(r.height-e.height)/2;return`translate(${o}px, ${i}px)`}function Rt(r,t){let e=r.x+r.width/2-t.x,s=r.y+r.height/2-t.y;return`${e}px ${s}px`}function qt(r,t,e,s,n=0){let o=r.width/2-t.width/2-t.x+e.x,i=r.height/2-t.height/2-t.y+e.y,a=1-n,l=o*a,c=i*a;return{x:o,y:i,transform:`translate(${l}px, ${c}px) scale(${s})`}}function Bt({canvasRect:r,canvasOffset:t,triggerRect:e,previousViewRectAtBaseTransform:s,lastViewZoomedElementRect:n,previousViewRectWithPreviousAtEndTransform:o,scale:i,preScale:a,parallax:l=0}){let c=t.left,f=t.top,u=r.width/2-e.width/2-e.x,h=r.height/2-e.height/2-e.y,m=u+(s.x-n.x)+o.x-c+(o.width-n.width)/2,y=h+(s.y-n.y)+o.y-f+(o.height-n.height)/2,p=1-Math.min(l*2,.9);return`translate(${m*p}px, ${y*p}px) scale(${i*a})`}function Vt(r,t,e,s,n){return`translate(${r-e.left}px, ${t-e.top}px) scale(${s*n})`}function ut(r){let t=r.split(/\s+/);return{x:parseFloat(t[0])||0,y:parseFloat(t[1])||0}}function st(r){let t=typeof r=="string"?r:"",e=t.match(/translate\s*\(\s*([-+\d.eE]+)px\s*,\s*([-+\d.eE]+)px\s*\)/);if(!e)return{tx:0,ty:0,rest:t.trim(),matched:!1};let s=t.replace(/translate\s*\([^)]+\)\s*/,"").trim();return{tx:parseFloat(e[1]),ty:parseFloat(e[2]),rest:s,matched:!0}}function rt(r){let t=st(r),e=r.match(/scale\s*\(\s*([-+\d.eE]+)\s*\)/);return{tx:t.matched?t.tx:0,ty:t.matched?t.ty:0,scale:e?parseFloat(e[1]):1}}function ht(r,t,e,s,n,o,i,a,l,c){let f=t.x-e.x*(1-o)-s,u=t.y-e.y*(1-o)-n,h=t.width/o,m=t.height/o,y=f+e.x+(r.x-f-e.x-s)/o,p=u+e.y+(r.y-u-e.y-n)/o,d=r.width/o,g=r.height/o,v=f+i.x+a+c*(y-f-i.x),w=u+i.y+l+c*(p-u-i.y),b=d*c,_=g*c;return{x:v,y:w,width:b,height:_,left:v,top:w,right:v+b,bottom:w+_}}function nt(r,t,e){return{viewName:r,backwardState:t,forwardState:e}}function Xt(r){return{detachedNode:r}}function Yt(r,t,e,s,n){let o=[];return t!==null&&o.push(t),e!==null&&o.push(e),s!==null&&o.push(s),n!==null&&o.push(n),{zoomLevel:r,views:o}}function Ut(r){let t=r.views?.[3];if(!(!t||!(t.detachedNode instanceof Node)))return t.detachedNode}var dt=class{#t=new Map;set(t,e,s=null){this.#t.set(t,{node:e,expires:s?Date.now()+s:null})}get(t){let e=this.#t.get(t);return e?e.expires!==null&&Date.now()>e.expires?(this.#t.delete(t),null):e.node.cloneNode(!0):null}has(t){let e=this.#t.get(t);return e?e.expires!==null&&Date.now()>e.expires?(this.#t.delete(t),!1):!0:!1}invalidate(t){this.#t.delete(t)}clear(){this.#t.clear()}};var xe=300*1e3,Le=/^https?:\/\/|^\/|\.html$|\.php$/i,mt=class{#t;#e;#r;#s=new Map;constructor(t={}){this.#r=t,this.#t=new ft(t),this.#e=new dt}#n(t){return typeof this.#r[t]=="string"}#o(t){return Le.test(t)?xe:null}async get(t,e=null){if(this.#n(t)){let s=this.#e.get(t);if(s)return s;if(this.#s.has(t))return this.#s.get(t);let n=(async()=>{try{let o=await this.#t.resolve(t,e),i=this.#r[t],a=this.#o(i);return this.#e.set(t,o,a),o}finally{this.#s.delete(t)}})();return this.#s.set(t,n),n}return this.#t.resolve(t,e)}async preloadEager(t,e=null){!Array.isArray(t)||t.length===0||await Promise.all(t.map(s=>this.get(s,e)))}prefetch(t,e=null){this.get(t,e).catch(()=>{})}prefetchOnHover(t,e=null){this.prefetch(t,e)}scanAndPrefetch(t,e=null){if(!t||!t.querySelectorAll)return;t.querySelectorAll(".zoom-me[data-to]").forEach(n=>{let o=n.dataset.to;o&&(n.hasAttribute("role")||n.setAttribute("role","button"),n.hasAttribute("aria-label")||n.setAttribute("aria-label",`Zoom to ${o}`),this.prefetch(o,e))})}};function K(r){r&&(r.style.contentVisibility="hidden")}function X(r){r&&(r.style.contentVisibility="visible")}function F(r){if(typeof r=="number"&&!Number.isNaN(r))return Math.max(0,r);let t=String(r).trim(),e=t.match(/^(\d*\.?\d+)\s*(ms|s)?$/i);if(!e)return typeof console<"u"&&console.warn(`[zumly] Could not parse duration "${t}" \u2014 falling back to 500ms.`),500;let s=parseFloat(e[1]);return(e[2]||"s").toLowerCase()==="ms"?Math.max(0,s):Math.max(0,s*1e3)}function pt(r){return F(r)/1e3}function T(r,t){if(r.classList.contains("is-new-current-view")){let e=t.views[0].forwardState;r.classList.replace("is-new-current-view","is-current-view"),r.classList.remove("zoom-current-view","has-no-events"),r.style.transformOrigin=e.origin,r.style.transform=e.transform;return}if(r.classList.contains("is-previous-view")){let e=t.views[1].forwardState;r.classList.remove("zoom-previous-view","has-no-events"),r.style.transformOrigin=e.origin,r.style.transform=e.transform;return}if(r.classList.contains("is-last-view")){let e=t.views[2].forwardState;r.classList.remove("zoom-last-view","has-no-events"),r.style.transformOrigin=e.origin,r.style.transform=e.transform}}function N(r,t){r.classList.remove("zoom-previous-view-reverse","has-no-events","has-effect","has-effect-reverse"),r.style.removeProperty("--z-effect-filter"),r.style.transformOrigin="0 0",r.style.transform=t.transform}function $(r,t){r.classList.remove("zoom-last-view-reverse","has-no-events","has-effect","has-effect-reverse"),r.style.removeProperty("--z-effect-filter"),r.style.transformOrigin=t.origin,r.style.transform=t.transform}function C(r,t){try{t&&t.removeChild(r)}catch{try{r.parentElement&&t.removeChild(r.parentElement)}catch{}}}function z(...r){for(let t of r)t&&(t.classList.remove("hide"),X(t))}function H(r,t){let{currentView:e,previousView:s,backView:n,backViewState:o,lastView:i,lastViewState:a,incomingTransformEnd:l,currentStage:c,canvas:f}=r,u=c.views[0];z(e),e.classList.replace("is-new-current-view","is-current-view"),e.classList.remove("zoom-current-view","has-no-events"),e.style.transformOrigin=u.forwardState.origin,e.style.transform=l||u.forwardState.transform,n&&o&&(n.style.transform=o.transformEnd),i&&a&&(i.style.transform=a.transformEnd),r.keepAlive||C(s,f),t()}var j=150;function R(r,t){let e=!1,s=setTimeout(()=>{e||(e=!0,r())},t);return{finish(){e||(e=!0,clearTimeout(s),r())},extend(n){e||(clearTimeout(s),s=setTimeout(()=>{e||(e=!0,r())},n))},safetyTimer:s}}function Wt(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function ze(r){if(!r||r==="none")return Wt();let t=String(r).match(/matrix\(([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+)\)/);return t?{a:parseFloat(t[1])||1,b:parseFloat(t[2])||0,c:parseFloat(t[3])||0,d:parseFloat(t[4])||1,e:parseFloat(t[5])||0,f:parseFloat(t[6])||0}:Wt()}function Q(r){return`matrix(${r.a}, ${r.b}, ${r.c}, ${r.d}, ${r.e}, ${r.f})`}function G(r,t,e){return r+(t-r)*e}function J(r,t,e){let s=Math.max(0,Math.min(1,e));return{a:G(r.a,t.a,s),b:G(r.b,t.b,s),c:G(r.c,t.c,s),d:G(r.d,t.d,s),e:G(r.e,t.e,s),f:G(r.f,t.f,s)}}function Z(r,t,e){r.style.transformOrigin=t,r.style.transform=e;try{r.getBoundingClientRect()}catch{}return ze(getComputedStyle(r).transform)}function Gt(r,t){let{type:e,currentView:s,previousView:n,lastView:o,currentStage:i,duration:a,ease:l,canvas:c}=r;if(!s||!n||!i){t();return}e==="lateral"?ke(r,t):e==="zoomIn"?Ce(s,n,o,i,a,l,t):e==="zoomOut"?Oe(s,n,o,i,a,l,c,t):t()}function ke(r,t){let{currentView:e,previousView:s,backView:n,backViewState:o,lastView:i,lastViewState:a,incomingTransformStart:l,incomingTransformEnd:c,outgoingTransform:f,outgoingTransformEnd:u,currentStage:h,duration:m,ease:y,canvas:p}=r,d=F(m),g=h.views[0];z(e),e.classList.replace("is-new-current-view","is-current-view"),e.classList.remove("zoom-current-view","has-no-events"),e.style.transformOrigin=g.forwardState.origin,n&&o&&(M(n,m,y,{"--lateral-from":o.transformStart,"--lateral-to":o.transformEnd}),n.classList.add("zoom-lateral-back")),i&&a&&(M(i,m,y,{"--lateral-from":a.transformStart,"--lateral-to":a.transformEnd}),i.classList.add("zoom-lateral-back")),r.keepAlive!=="visible"&&(M(s,m,y,{"--lateral-out-from":f,"--lateral-out-to":u}),s.classList.add("zoom-lateral-out")),M(e,m,y,{"--lateral-in-from":l,"--lateral-in-to":c}),e.classList.add("zoom-lateral-in");let v=r.keepAlive==="visible"?[e]:[s,e];n&&o&&v.push(n),i&&a&&v.push(i);let w=v.length,b=d+j,_=new Set(["zoom-lateral-in","zoom-lateral-out","zoom-lateral-back"]),{finish:S,extend:O}=R(()=>{Tt(v,I,P),r.keepAlive?(s.classList.remove("zoom-lateral-out"),s.style.opacity=""):C(s,p),n&&(n.classList.remove("zoom-lateral-back"),n.style.transform=o?.transformEnd||n.style.transform),i&&(i.classList.remove("zoom-lateral-back"),i.style.transform=a?.transformEnd||i.style.transform),e.classList.remove("zoom-lateral-in"),e.style.transform=c,t()},b);function P(x){x.target!==x.currentTarget||!_.has(x.animationName)||O(b)}function I(x){if(x.target!==x.currentTarget||!_.has(x.animationName))return;let q=x.currentTarget;q.removeEventListener("animationend",I),q.removeEventListener("animationstart",P),w--,w<=0&&S()}v.forEach(x=>{x.addEventListener("animationstart",P),x.addEventListener("animationend",I)})}function Ce(r,t,e,s,n,o,i){z(r,t,e);let a=s.stagger||0;M(r,n,o,{"--current-view-transform-start":s.views[0].backwardState.transform,"--current-view-transform-end":s.views[0].forwardState.transform}),a>0&&r.style.setProperty("animation-delay","0ms"),M(t,n,o,{"--previous-view-transform-start":s.views[1].backwardState.transform,"--previous-view-transform-end":s.views[1].forwardState.transform}),a>0&&t.style.setProperty("animation-delay",`${a}ms`),e&&(M(e,n,o,{"--last-view-transform-start":s.views[2].backwardState.transform,"--last-view-transform-end":s.views[2].forwardState.transform}),a>0&&e.style.setProperty("animation-delay",`${a*2}ms`)),r.classList.add("zoom-current-view"),t.classList.add("zoom-previous-view"),e&&e.classList.add("zoom-last-view");let l=e?[r,t,e]:[r,t],c=l.length,f=F(n),u=e?a*2:a,h=f+u+j,m=new Set(["zoom-current-view","zoom-previous-view","zoom-last-view"]),{finish:y,extend:p}=R(()=>{Tt(l,g,d),l.forEach(v=>v.style.removeProperty("animation-delay")),l.forEach(v=>{if(v?.isConnected)try{T(v,s)}catch{}}),i()},h);function d(v){v.target!==v.currentTarget||!m.has(v.animationName)||p(h)}function g(v){if(v.target!==v.currentTarget||!m.has(v.animationName))return;let w=v.currentTarget;if(w.removeEventListener("animationend",g),w.removeEventListener("animationstart",d),w.isConnected)try{T(w,s)}catch{}c--,c<=0&&y()}l.forEach(v=>{v.addEventListener("animationstart",d),v.addEventListener("animationend",g)})}function Oe(r,t,e,s,n,o,i,a){let l=s.views[0],c=s.views[1],f=e&&s.views[2]?s.views[2]:null,u=s.stagger||0;M(r,n,o,{"--current-view-transform-start":l.backwardState.transform,"--current-view-transform-end":l.forwardState.transform}),u>0&&r.style.setProperty("animation-delay","0ms"),M(t,n,o,{"--previous-view-transform-start":c.backwardState.transform,"--previous-view-transform-end":c.forwardState.transform}),u>0&&t.style.setProperty("animation-delay",`${u}ms`),e&&f&&(M(e,n,o,{"--last-view-transform-start":f.backwardState.transform,"--last-view-transform-end":f.forwardState.transform}),u>0&&e.style.setProperty("animation-delay",`${u*2}ms`)),r.classList.add("zoom-current-view-reverse"),t.classList.add("zoom-previous-view-reverse"),e&&e.classList.add("zoom-last-view-reverse");let h=e?[r,t,e]:[r,t],m=h.length,y=F(n),p=e?u*2:u,d=y+p+j,g=new Set(["zoom-current-view-reverse","zoom-previous-view-reverse","zoom-last-view-reverse"]),{finish:v,extend:w}=R(()=>{Tt(h,_,b),h.forEach(S=>S.style.removeProperty("animation-delay")),h.forEach(S=>{if(S?.isConnected)try{Kt(S,s,i)}catch{}}),a()},d);function b(S){S.target!==S.currentTarget||!g.has(S.animationName)||w(d)}function _(S){if(S.target!==S.currentTarget||!g.has(S.animationName))return;let O=S.currentTarget;if(O.removeEventListener("animationend",_),O.removeEventListener("animationstart",b),O.isConnected)try{Kt(O,s,i)}catch{}m--,m<=0&&v()}h.forEach(S=>{S.addEventListener("animationstart",b),S.addEventListener("animationend",_)})}function Kt(r,t,e){if(r.classList.contains("zoom-current-view-reverse")){C(r,e);return}if(r.classList.contains("zoom-previous-view-reverse")){N(r,t.views[1].backwardState);return}r.classList.contains("zoom-last-view-reverse")&&$(r,t.views[2].backwardState)}function M(r,t,e,s){r.style.setProperty("--zoom-duration",t),r.style.setProperty("--zoom-ease",e);for(let[n,o]of Object.entries(s))r.style.setProperty(n,o)}function Tt(r,t,e){for(let s of r)s?.removeEventListener&&(s.removeEventListener("animationend",t),s.removeEventListener("animationstart",e))}function Qt(r,t){let{type:e,currentView:s,previousView:n,lastView:o,currentStage:i,canvas:a}=r;if(!s||!n||!i){t();return}if(e==="lateral"){H(r,t);return}if(e==="zoomIn"){z(s,n,o),T(s,i),T(n,i),o&&T(o,i),t();return}if(e==="zoomOut"){C(s,a),z(n,o),N(n,i.views[1].backwardState),o&&$(o,i.views[2].backwardState),t();return}t()}function Jt(r,t){let{type:e,currentView:s,previousView:n,lastView:o,currentStage:i,duration:a,ease:l,canvas:c}=r;if(!s||!n||!i){t();return}let f=F(a);if(e==="lateral"){Ie(r,f,l,t);return}if(e==="zoomIn"){Ae(s,n,o,i,f,l,t);return}if(e==="zoomOut"){Pe(s,n,o,i,f,l,c,t);return}t()}function Ae(r,t,e,s,n,o,i){z(r,t,e);let a=s.views[0],l=s.views[1],c=e&&s.views[2]?s.views[2]:null;r.style.transformOrigin=a.backwardState.origin,r.style.transform=a.backwardState.transform,t.style.transformOrigin=l.backwardState.origin,t.style.transform=l.backwardState.transform,c&&(e.style.transformOrigin=c.backwardState.origin,e.style.transform=c.backwardState.transform);let f=s.stagger||0,u=[];u.push(r.animate([{transform:a.backwardState.transform},{transform:a.forwardState.transform}],{duration:n,easing:o,fill:"forwards"})),u.push(t.animate([{transform:l.backwardState.transform},{transform:l.forwardState.transform}],{duration:n,delay:f,easing:o,fill:"forwards"})),c&&u.push(e.animate([{transform:c.backwardState.transform},{transform:c.forwardState.transform}],{duration:n,delay:f*2,easing:o,fill:"forwards"}));let h=c?f*2:f,{finish:m}=R(()=>{Et(u);try{T(r,s),T(t,s),e&&T(e,s)}catch{}i()},n+h+j);Promise.all(u.map(y=>y.finished)).then(m).catch(m)}function Pe(r,t,e,s,n,o,i,a){let l=s.views[0],c=s.views[1],f=e&&s.views[2]?s.views[2]:null,u=c.backwardState,h=f?f.backwardState:null;r.style.transformOrigin=l.forwardState.origin,r.style.transform=l.forwardState.transform,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t.style.transformOrigin=c.forwardState.origin,e&&f&&(e.style.transformOrigin=f.forwardState.origin);let m=t.style.transform||getComputedStyle(t).transform||c.forwardState.transform,y=e&&f?e.style.transform||getComputedStyle(e).transform||f.forwardState.transform:null,p=s.stagger||0,d=[];d.push(r.animate([{transform:l.forwardState.transform},{transform:l.backwardState.transform}],{duration:n,easing:o,fill:"forwards"})),d.push(t.animate([{transform:m},{transform:u.transform}],{duration:n,delay:p,easing:o,fill:"both"})),e&&h&&d.push(e.animate([{transform:y},{transform:h.transform}],{duration:n,delay:p*2,easing:o,fill:"both"})),t.style.removeProperty("transform"),e&&e.style.removeProperty("transform");let g=e&&h?p*2:p,{finish:v}=R(()=>{Et(d);try{C(r,i),N(t,u),e&&h&&$(e,h)}catch{}a()},n+g+j);Promise.all(d.map(w=>w.finished)).then(v).catch(v)})})}function Ie(r,t,e,s){let{currentView:n,previousView:o,backView:i,backViewState:a,lastView:l,lastViewState:c,incomingTransformStart:f,incomingTransformEnd:u,outgoingTransform:h,outgoingTransformEnd:m,currentStage:y,canvas:p}=r,d=y.views[0];z(n),n.classList.replace("is-new-current-view","is-current-view"),n.classList.remove("zoom-current-view","has-no-events"),n.style.transformOrigin=d.forwardState.origin;let g=[];g.push(n.animate([{transform:f,opacity:0},{transform:u,opacity:1}],{duration:t,easing:e,fill:"forwards"})),r.keepAlive!=="visible"&&g.push(o.animate([{transform:h,opacity:1},{transform:m,opacity:0}],{duration:t,easing:e,fill:"forwards"})),i&&a&&g.push(i.animate([{transform:a.transformStart},{transform:a.transformEnd}],{duration:t,easing:e,fill:"forwards"})),l&&c&&g.push(l.animate([{transform:c.transformStart},{transform:c.transformEnd}],{duration:t,easing:e,fill:"forwards"}));let{finish:v}=R(()=>{Et(g),n.style.transform=u||d.forwardState.transform,i&&a&&(i.style.transform=a.transformEnd),l&&c&&(l.style.transform=c.transformEnd),r.keepAlive?(o.style.opacity="",o.style.transform=m):C(o,p),s()},t+j);Promise.all(g.map(w=>w.finished)).then(v).catch(v)}function Et(r){for(let t of r)try{t.cancel()}catch{}}function te(r,t){let e=typeof globalThis<"u"&&globalThis.anime;if(!e||typeof e!="function"){console.warn('Zumly anime driver: Anime.js not loaded. Add <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.2/anime.min.js"><\/script>'),t();return}let{type:s,currentView:n,previousView:o,lastView:i,currentStage:a,duration:l,ease:c,canvas:f}=r;if(!n||!o||!a){t();return}let u=F(l);s==="lateral"?H(r,t):s==="zoomIn"?Ne(e,n,o,i,a,u,c,t):s==="zoomOut"?$e(e,n,o,i,a,u,c,f,t):t()}function Ne(r,t,e,s,n,o,i,a){z(t,e,s);let l=n.views[0],c=n.views[1],f=s&&n.views[2]?n.views[2]:null,u=ee([{el:t,backward:l.backwardState,forward:l.forwardState},{el:e,backward:c.backwardState,forward:c.forwardState},...f?[{el:s,backward:f.backwardState,forward:f.forwardState}]:[]],"forward");se(u,0);let h=n.stagger||0,m=o+(f?h*2:h),y={value:0};r({targets:y,value:1,duration:m,easing:ne(i),update:()=>{let p=y.value*m;re(u,p,o,h)},complete:()=>{T(t,n),T(e,n),s&&T(s,n),a()}})}function $e(r,t,e,s,n,o,i,a,l){let c=n.views[0],f=n.views[1],u=s&&n.views[2]?n.views[2]:null,h=f.backwardState,m=u?u.backwardState:null,y=ee([{el:t,backward:c.backwardState,forward:c.forwardState},{el:e,backward:f.backwardState,forward:f.forwardState},...u?[{el:s,backward:u.backwardState,forward:u.forwardState}]:[]],"backward");se(y,0);let p=n.stagger||0,d=o+(u?p*2:p),g={value:0};r({targets:g,value:1,duration:d,easing:ne(i),update:()=>{let v=g.value*d;re(y,v,o,p)},complete:()=>{C(t,a),N(e,h),s&&m&&$(s,m),l()}})}function ee(r,t){return r.map(({el:e,backward:s,forward:n})=>{if(t==="forward"){let o=Z(e,s.origin,s.transform),i=Z(e,s.origin,n.transform);return{el:e,from:o,to:i}}else{let o=Z(e,n.origin,n.transform),i=Z(e,n.origin,s.transform);return{el:e,from:o,to:i}}})}function se(r,t){for(let{el:e,from:s,to:n}of r)e.style.transform=Q(J(s,n,t))}function re(r,t,e,s){for(let n=0;n<r.length;n++){let{el:o,from:i,to:a}=r[n],l=n*s,c=Math.max(0,t-l),f=e>0?Math.min(1,c/e):1;o.style.transform=Q(J(i,a,f))}}function ne(r){if(typeof r!="string")return"easeInOutQuad";let t=r.toLowerCase();return t==="linear"?"linear":t.includes("ease-in-out")?"easeInOutQuad":t.includes("ease-in")?"easeInQuad":t.includes("ease-out")?"easeOutQuad":t}function oe(r,t){let e=typeof globalThis<"u"&&globalThis.gsap;if(!e||typeof e.to!="function"){console.warn('Zumly GSAP driver: GSAP not loaded. Add <script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.5/gsap.min.js"><\/script>'),t();return}let{type:s,currentView:n,previousView:o,lastView:i,currentStage:a,duration:l,ease:c,canvas:f}=r;if(!n||!o||!a){t();return}let u=pt(l);s==="lateral"?H(r,t):s==="zoomIn"?Ze(e,n,o,i,a,u,c,t):s==="zoomOut"?Me(e,n,o,i,a,u,c,f,t):t()}function Ze(r,t,e,s,n,o,i,a){z(t,e,s);let l=n.views[0],c=n.views[1],f=s&&n.views[2]?n.views[2]:null;vt(t,l.backwardState),vt(e,c.backwardState),f&&vt(s,f.backwardState);let u=r.timeline({onComplete:()=>{T(t,n),T(e,n),s&&T(s,n),a()}}),h=ie(i),m=(n.stagger||0)/1e3;u.to(t,{transform:l.forwardState.transform,duration:o,ease:h},0),u.to(e,{transform:c.forwardState.transform,duration:o,ease:h},m),f&&u.to(s,{transform:f.forwardState.transform,duration:o,ease:h},m*2)}function Me(r,t,e,s,n,o,i,a,l){let c=n.views[0],f=n.views[1],u=s&&n.views[2]?n.views[2]:null,h=f.backwardState,m=u?u.backwardState:null;vt(t,c.forwardState);let y=e.style.transform||getComputedStyle(e).transform||f.forwardState.transform,p=s&&u?s.style.transform||getComputedStyle(s).transform||u.forwardState.transform:null;e.style.transformOrigin=f.forwardState.origin,s&&u&&(s.style.transformOrigin=u.forwardState.origin);let d=ie(i),g=r.timeline({onComplete:()=>{C(t,a),N(e,h),s&&m&&$(s,m),l()}}),v=(n.stagger||0)/1e3;r.set(e,{transform:y}),s&&p&&r.set(s,{transform:p}),g.fromTo(t,{transform:c.forwardState.transform},{transform:c.backwardState.transform,duration:o,ease:d},0),g.fromTo(e,{transform:y},{transform:h.transform,duration:o,ease:d},v),s&&m&&g.fromTo(s,{transform:p},{transform:m.transform,duration:o,ease:d},v*2)}function vt(r,t){r.style.transformOrigin=t.origin,r.style.transform=t.transform}function ie(r){if(typeof r!="string")return"power2.inOut";let t=r.toLowerCase();return t==="linear"?"none":t.includes("ease-in-out")?"power2.inOut":t.includes("ease-in")?"power2.in":t.includes("ease-out")?"power2.out":t}function ae(r,t){let e=He();if(!e||typeof e!="function"){console.warn('Zumly Motion driver: Motion not loaded. Add <script src="https://cdn.jsdelivr.net/npm/motion@11/dist/motion.min.js"><\/script>'),t();return}let{type:s,currentView:n,previousView:o,lastView:i,currentStage:a,duration:l,ease:c,canvas:f}=r;if(!n||!o||!a){t();return}let u=pt(l);s==="lateral"?H(r,t):s==="zoomIn"?De(e,n,o,i,a,u,c,t):s==="zoomOut"?Fe(e,n,o,i,a,u,c,f,t):t()}function De(r,t,e,s,n,o,i,a){z(t,e,s);let l=le(t,e,s,n,"forward");ce(l,0);let c=n.stagger||0,f=c/1e3,u=o*1e3,h=o+(l.length>2?f*2:f);r(0,1,{duration:h,ease:ue(i),onUpdate:y=>{let p=y*h*1e3;fe(l,p,u,c)}}).then(()=>{T(t,n),T(e,n),s&&T(s,n),a()}).catch(()=>a())}function Fe(r,t,e,s,n,o,i,a,l){let c=n.views[1],f=s&&n.views[2]?n.views[2]:null,u=c.backwardState,h=f?f.backwardState:null,m=le(t,e,s,n,"backward");ce(m,0);let y=n.stagger||0,p=y/1e3,d=o*1e3,g=o+(m.length>2?p*2:p);r(0,1,{duration:g,ease:ue(i),onUpdate:w=>{let b=w*g*1e3;fe(m,b,d,y)}}).then(()=>{C(t,a),N(e,u),s&&h&&$(s,h),l()}).catch(()=>l())}function le(r,t,e,s,n){let o=s.views[0],i=s.views[1],a=e&&s.views[2]?s.views[2]:null,l=[{el:r,backward:o.backwardState,forward:o.forwardState},{el:t,backward:i.backwardState,forward:i.forwardState}];return a&&l.push({el:e,backward:a.backwardState,forward:a.forwardState}),l.map(({el:c,backward:f,forward:u})=>n==="forward"?{el:c,from:Z(c,f.origin,f.transform),to:Z(c,f.origin,u.transform)}:{el:c,from:Z(c,u.origin,u.transform),to:Z(c,u.origin,f.transform)})}function ce(r,t){for(let{el:e,from:s,to:n}of r)e.style.transform=Q(J(s,n,t))}function fe(r,t,e,s){for(let n=0;n<r.length;n++){let{el:o,from:i,to:a}=r[n],l=n*s,c=Math.max(0,t-l),f=e>0?Math.min(1,c/e):1;o.style.transform=Q(J(i,a,f))}}function He(){let r=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return r.motion?.animate||r.Motion?.animate||r.animate}function ue(r){if(typeof r!="string")return"easeInOut";let t=r.toLowerCase();return t==="linear"?"linear":t.includes("ease-in-out")?"easeInOut":t.includes("ease-in")?"easeIn":t.includes("ease-out")?"easeOut":r}var he={css:Gt,waapi:Jt,none:Qt,anime:te,gsap:oe,motion:ae};function de(r){if(typeof r=="function")return{runTransition(s,n){r(s,n)}};let t=typeof r=="string"?r.toLowerCase():"css";return{runTransition:he[t]||he.css}}function je(r){if(typeof r!="string"||r.trim()==="")return{tx:0,ty:0,rest:""};let t=st(r);return t.matched?{tx:t.tx,ty:t.ty,rest:t.rest}:null}function xt(r,t,e){let s=je(r);if(s===null)return r;let n=s.tx*t,o=s.ty*e,i=s.rest?` ${s.rest}`:"";return`translate(${n}px, ${o}px)${i}`.trim()}function Re(r){if(typeof r!="string"||!r.trim())return null;let t=r.trim().match(/^([-\d.eE]+)px\s+([-\d.eE]+)px$/);return t?{x:parseFloat(t[1]),y:parseFloat(t[2])}:null}function Lt(r,t,e){let s=Re(r);return s===null?r:`${s.x*t}px ${s.y*e}px`}function zt(r,t,e,s,n){if(!r.storedViews?.length||!r.canvas||t<=0||e<=0)return;let o=s/t,i=n/e;for(let m of r.storedViews){let y=m.views;if(Array.isArray(y))for(let p=0;p<y.length;p++){let d=y[p];!d||d.detachedNode||(d.backwardState&&(d.backwardState.transform=xt(d.backwardState.transform,o,i),d.backwardState.origin!=null&&(d.backwardState.origin=Lt(d.backwardState.origin,o,i))),d.forwardState&&(d.forwardState.transform=xt(d.forwardState.transform,o,i),d.forwardState.origin!=null&&(d.forwardState.origin=Lt(d.forwardState.origin,o,i))))}}let a=r.canvas,l=a.querySelector(".is-current-view"),c=a.querySelector(".is-previous-view"),f=a.querySelector(".is-last-view"),u=a.querySelector(".is-new-current-view"),h=[l,c,f,u].filter(Boolean);for(let m of h){if(!m.style)continue;let y=m.style.transform;y!=null&&y!==""&&(m.style.transform=xt(y,o,i));let p=m.style.transformOrigin;p!=null&&p!==""&&(m.style.transformOrigin=Lt(p,o,i))}}var qe=8e3,it=class{constructor(t){if(this.storedViews=[],this.currentStage=null,this.debug=!1,this.trace=[],this.blockEvents=!1,this._blockEventsSafetyTimer=null,this.touchstartX=0,this.touchstartY=0,this.touchendX=0,this.touchendY=0,this.touching=!1,this.lateralHistory=[],this._lastCanvasWidth=0,this._lastCanvasHeight=0,this._pendingResizeCorrection=!1,this._destroyed=!1,this._trackedTimers=new Set,this._pendingTransitionComplete=null,this._hooks={},this._plugins=[],Dt(t,this),!this.isValid){this.notify("is unable to start: invalid or missing required options (mount, initialView, views).","error");return}if(this.canvas=document.querySelector(this.mount),!this.canvas){this.notify(`mount selector "${this.mount}" did not match any element.`,"error"),this.isValid=!1;return}this.transitionDriver=de(this.transitionDriver),this._onZoom=this.onZoom.bind(this),this._onTouchStart=this.onTouchStart.bind(this),this._onTouchEnd=this.onTouchEnd.bind(this),this._onTouchCancel=()=>{this.touching=!1},this._onKeyUp=this.onKeyUp.bind(this),this._onWheel=this.onWheel.bind(this),this._wheelCooldown=!1,this._onPrefetchTrigger=e=>{e.target.classList.contains("zoom-me")&&e.target.dataset.to&&this.prefetcher.prefetch(e.target.dataset.to,{trigger:e.target,...e.target.dataset})},this._onResize=this._handleResize.bind(this),this._resizeDebounceTimer=null,this._RESIZE_DEBOUNCE_MS=80,this.prefetcher=new mt(this.views),this._bindEvents()}_bindEvents(){let t=this.canvas;t&&(t.setAttribute("tabindex","0"),t.setAttribute("role","application"),t.setAttribute("aria-roledescription","zoomable interface"),t.setAttribute("aria-live","polite"),t.addEventListener("mouseup",this._onZoom,!1),t.addEventListener("touchend",this._onZoom,!1),t.addEventListener("touchstart",this._onTouchStart,{passive:!0}),t.addEventListener("touchend",this._onTouchEnd,!1),t.addEventListener("touchcancel",this._onTouchCancel,{passive:!0}),t.addEventListener("keyup",this._onKeyUp,!1),t.addEventListener("wheel",this._onWheel,{passive:!1}),t.addEventListener("mouseover",this._onPrefetchTrigger,{passive:!0}),t.addEventListener("focusin",this._onPrefetchTrigger,{passive:!0}),window.addEventListener("resize",this._onResize,{passive:!0}),typeof ResizeObserver<"u"&&(this._resizeObserver=new ResizeObserver(()=>this._handleResize()),this._resizeObserver.observe(t)))}_unbindEvents(){let t=this.canvas;t&&(t.removeEventListener("mouseup",this._onZoom,!1),t.removeEventListener("touchend",this._onZoom,!1),t.removeEventListener("touchstart",this._onTouchStart),t.removeEventListener("touchend",this._onTouchEnd,!1),t.removeEventListener("touchcancel",this._onTouchCancel),t.removeEventListener("keyup",this._onKeyUp,!1),t.removeEventListener("wheel",this._onWheel),t.removeEventListener("mouseover",this._onPrefetchTrigger),t.removeEventListener("focusin",this._onPrefetchTrigger)),window.removeEventListener("resize",this._onResize),this._resizeObserver&&(this._resizeObserver.disconnect(),this._resizeObserver=null)}_resetCanvasScroll(t){if(t&&((t.scrollLeft!==0||t.scrollTop!==0)&&(this.notify(`canvas had a residual scroll (${t.scrollLeft}, ${t.scrollTop}) \u2014 resetting. Something scrolled the canvas mid-transition.`,"warn"),t.scrollLeft=0,t.scrollTop=0),!this._warnedScrolledAncestor)){for(let e=t.parentElement;e&&e!==document.body;e=e.parentElement)if(e.scrollLeft!==0||e.scrollTop!==0){let s=e.className?`.${String(e.className).trim().split(/\s+/).join(".")}`:e.tagName.toLowerCase();this.notify(`an ancestor of the canvas (${s}) is scrolled (${e.scrollLeft}, ${e.scrollTop}): all zooms will land displaced. Use 'overflow: clip' (not 'hidden') on containers around the canvas.`,"warn"),this._warnedScrolledAncestor=!0;break}}}_setBlockEvents(){this.blockEvents=!0,this._clearBlockEventsSafety(),this._blockEventsSafetyTimer=setTimeout(()=>{if(this.blockEvents&&!this._destroyed){this.notify("blockEvents safety timeout: driver did not call onComplete. Force-resetting.","warn"),this.blockEvents=!1;let t=this._pendingTransitionComplete;t?t():this._onTransitionComplete()}},qe)}_clearBlockEventsSafety(){this._blockEventsSafetyTimer!==null&&(clearTimeout(this._blockEventsSafetyTimer),this._blockEventsSafetyTimer=null)}_setTrackedTimeout(t,e){let s=setTimeout(()=>{this._trackedTimers.delete(s),!this._destroyed&&t()},e);return this._trackedTimers.add(s),s}_clearTrackedTimeouts(){for(let t of this._trackedTimers)clearTimeout(t);this._trackedTimers.clear()}storeViews(t){this.tracing("storedViews()"),this.storedViews.push(t),this.debug&&console.debug("Zumly storedViews",t)}tracing(t){if(this.debug)if(t==="ended"){let e=this.trace.map((s,n)=>`${n===0?`Instance ${this.mount}: ${s}`:`${s}`}`).join(" > ");this.notify(e),this.trace=[]}else this.trace.push(t)}notify(t,e){return L(this.debug,t,e)}_recordCanvasSize(){if(!this.canvas)return;let t=this.canvas.getBoundingClientRect();this._lastCanvasWidth=t.width,this._lastCanvasHeight=t.height}_handleResize(){this._destroyed||(this._resizeDebounceTimer&&clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=setTimeout(()=>{if(this._resizeDebounceTimer=null,!this.isValid||!this.canvas||this._lastCanvasWidth===0)return;let t=this.canvas.getBoundingClientRect(),e=t.width,s=t.height;if(!(e===this._lastCanvasWidth&&s===this._lastCanvasHeight)){if(this.blockEvents){this._pendingResizeCorrection=!0;return}zt(this,this._lastCanvasWidth,this._lastCanvasHeight,e,s),this._lastCanvasWidth=e,this._lastCanvasHeight=s}},this._RESIZE_DEBOUNCE_MS))}_onTransitionComplete(){if(this._clearBlockEventsSafety(),this._pendingResizeCorrection&&!this.blockEvents){this._pendingResizeCorrection=!1;let t=this.canvas?.getBoundingClientRect();if(t&&this._lastCanvasWidth>0){let e=t.width,s=t.height;(e!==this._lastCanvasWidth||s!==this._lastCanvasHeight)&&zt(this,this._lastCanvasWidth,this._lastCanvasHeight,e,s),this._lastCanvasWidth=e,this._lastCanvasHeight=s}}else this._recordCanvasSize();this._manageFocus()}_manageFocus(){if(!this.canvas)return;let t=this.canvas.querySelector(".is-current-view");if(!t)return;let e=t.querySelector('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])');e?e.focus({preventScroll:!0}):(t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0}))}_resolveEffects(t){let e=t?.dataset?.withEffects;if(e&&typeof e=="string"){let s=e.split("|").map(n=>n.trim());return[s[0]||"none",s[1]||s[0]||"none"]}return this.effects}_applyEffects(t,e,s,n,o){!s||s[0]==="none"&&s[1]==="none"||(t&&s[0]!=="none"&&(t.style.setProperty("--z-effect-filter",s[0]),t.style.setProperty("--zoom-duration",n),t.style.setProperty("--zoom-ease",o),t.classList.add("has-effect")),e&&s[1]!=="none"&&(e.style.setProperty("--z-effect-filter",s[1]),e.style.setProperty("--zoom-duration",n),e.style.setProperty("--zoom-ease",o),e.classList.add("has-effect")))}_removeEffect(t){if(!t||!t.classList.contains("has-effect"))return;t.classList.remove("has-effect"),t.classList.add("has-effect-reverse");let e=()=>{t.classList.remove("has-effect-reverse"),t.style.removeProperty("--z-effect-filter"),t.removeEventListener("transitionend",e)};t.addEventListener("transitionend",e,{once:!0});let s=t.style.getPropertyValue("--zoom-duration");this._setTrackedTimeout(e,s?parseFloat(s)*(s.includes("ms")?1:1e3)+100:1100)}_resolveHideTrigger(t){return t?.dataset?.hideTrigger!==void 0?t.dataset.hideTrigger==="fade"?"fade":!0:this.hideTrigger}_applyHideTrigger(t,e,s,n,o){!s||!t||(s==="fade"?(t.style.setProperty("--zoom-duration",n),t.style.setProperty("--zoom-ease",o),t.classList.add("z-trigger-fade"),e.style.setProperty("--zoom-duration",n),e.style.setProperty("--zoom-ease",o),e.classList.add("z-view-fade-in"),e.offsetHeight,e.classList.remove("hide")):t.classList.add("z-trigger-hidden"))}_restoreHideTrigger(t,e,s,n){if(!(!e||!t))if(e==="fade"){t.classList.remove("z-trigger-fade"),t.style.setProperty("--zoom-duration",s),t.style.setProperty("--zoom-ease",n),t.classList.add("z-trigger-fade-reverse");let o=()=>{t.classList.remove("z-trigger-fade-reverse"),t.style.removeProperty("--zoom-duration"),t.style.removeProperty("--zoom-ease"),t.removeEventListener("transitionend",o)};t.addEventListener("transitionend",o,{once:!0}),this._setTrackedTimeout(o,parseFloat(s)*(s.includes("ms")?1:1e3)+100)}else t.classList.remove("z-trigger-hidden")}on(t,e){return typeof e!="function"?this:((this._hooks[t]||=[]).push(e),this)}use(t,e){if(!t)return this;let s={plugin:t,options:e};return this._plugins.push(s),this._initialized&&this._installPlugin(s),this}_installPlugin(t){let{plugin:e,options:s}=t;try{typeof e=="function"?e(this,s):typeof e.install=="function"&&e.install(this,s)}catch(n){this.notify(`plugin install error: ${n.message}`,"error")}}off(t,e){return e?this._hooks[t]&&(this._hooks[t]=this._hooks[t].filter(s=>s!==e)):delete this._hooks[t],this}_emit(t,e={}){let s=this._hooks[t];if(!(!s||s.length===0))for(let n of s)try{n(e)}catch(o){this.debug&&console.error(`Zumly hook "${t}" threw:`,o)}}zoomLevel(){return this.storedViews.length}getZoomLevel(){return this.zoomLevel()}getCurrentViewName(){return!this.storedViews||this.storedViews.length===0?null:this.storedViews[this.storedViews.length-1]?.views?.[0]?.viewName??null}back(){if(!this._destroyed){if(this.blockEvents){this.notify("back ignored: a transition is already running.","warn");return}if(this.lateralHistory&&this.lateralHistory.length>0){let t=this.lateralHistory.pop(),e=t&&typeof t=="object"?t.name:t,s=t&&typeof t=="object"?t.entry:void 0,n=t&&typeof t=="object"?t.node:void 0;return this._doLateral(e,!0,{savedEntry:s,keepAliveNode:n})}this.zoomOut()}}async goTo(t,e={}){return this._destroyed?void 0:(e.mode==="lateral"?"lateral":"depth")==="depth"?this.zoomTo(t,e):this._doLateral(t,!1,e)}async zoomTo(t,e={}){if(this._destroyed)return;if(!this.isValid||!this.canvas){this.notify("zoomTo() cannot run: instance is invalid or canvas not found.","error");return}if(typeof t!="string"||!t){this.notify("zoomTo() requires a non-empty view name.","warn");return}if(!Object.prototype.hasOwnProperty.call(this.views,t)){this.notify(`zoomTo("${t}"): view not found in views. Available: ${Object.keys(this.views).join(", ")}`,"warn");return}if(this.getCurrentViewName()===t)return;let n=this.canvas.getBoundingClientRect(),o=Math.max(40,n.width*.1),i=Math.max(40,n.height*.1),l={rect:{x:n.left+(n.width-o)/2,y:n.top+(n.height-i)/2,width:o,height:i},duration:e.duration??this.duration,ease:e.ease??this.ease,props:e.props??{}};await this._doZoomIn(t,l)}async init(){if(this._destroyed)return;if(!this.isValid||!this.canvas){this.notify("init() cannot run: instance is invalid or canvas element was not found.","error");return}this.tracing("init()"),this.preload&&this.preload.length&&await this.prefetcher.preloadEager(this.preload,null).catch(e=>{this.notify(`preload failed: ${e.message}`,"warn")});let t;try{let e=await this.prefetcher.get(this.initialView,null);t=await et(e,this.initialView,this.canvas,!0,this.views,this.componentContext)}catch(e){this.notify(`init() failed to resolve initial view "${this.initialView}": ${e.message}`,"error");return}this._emit("viewMounted",{viewName:this.initialView,node:t}),this.prefetcher.scanAndPrefetch(t,null),this.storeViews({zoomLevel:this.storedViews.length,scale:1,views:[{viewName:this.initialView,backwardState:{origin:"0 0",transform:""}}]}),this.currentStage=this.storedViews[this.storedViews.length-1],this._recordCanvasSize(),this._initialized=!0;for(let e of this._plugins)this._installPlugin(e)}destroy(){this._destroyed||(this._emit("destroy"),this._destroyed=!0,this._clearBlockEventsSafety(),this._clearTrackedTimeouts(),this._pendingTransitionComplete=null,this._resizeDebounceTimer&&(clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=null),this._unbindEvents(),this._removeNav(),this._cleanupLateralKeepAlive(),this.blockEvents=!1,this.storedViews=[],this.currentStage=null,this.lateralHistory=[],this.trace=[],this._hooks={},this.prefetcher=null,this.transitionDriver=null,this.canvas&&(this.canvas.removeAttribute("tabindex"),this.canvas.removeAttribute("role"),this.canvas.removeAttribute("aria-roledescription"),this.canvas.removeAttribute("aria-live")),this.isValid=!1)}async _doZoomIn(t,e){if(this._destroyed)return;if(this.blockEvents){this.notify("zoomIn ignored: a transition is already running.","warn");return}this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomIn",{viewName:t}),this.tracing("zoomIn()");let s=this.canvas,n=e.el;this._resetCanvasScroll(s);let o=s.getBoundingClientRect(),i=o.left,a=o.top,c=(this.storedViews.length>0?this.storedViews[this.storedViews.length-1]:null)?.scale??1;this.tracing("getView()");let f=n?{trigger:n,target:document.createElement("div"),context:this.componentContext,props:Object.assign({},n.dataset)}:{target:document.createElement("div"),context:this.componentContext,props:e.props??{}},u=n?.dataset?.deferred!==void 0?!0:this.deferred,h,m=null;try{if(u){let E=await this.prefetcher.get(t,f);if(this._destroyed)return;for(m=document.createDocumentFragment();E.firstChild;)m.appendChild(E.firstChild);h=await et(E,t,s,!1,{},this.componentContext)}else{let E=await this.prefetcher.get(t,f);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(E,f),h=await et(E,t,s,!1,this.views,this.componentContext)}}catch(E){this.notify(`zoomIn aborted: failed to resolve view "${t}": ${E.message}`,"error");return}if(!h)return;u||this._emit("viewMounted",{viewName:t,node:h}),n&&n.classList.add("zoomed");let y=n?(()=>{let E=n.getBoundingClientRect();return{x:E.x,y:E.y,width:E.width,height:E.height}})():e.rect,p=n?n.dataset.withDuration||this.duration:e.duration??this.duration,d=n?n.dataset.withEase||this.ease:e.ease??this.ease,g=n?n.dataset.withCover||this.cover:e.cover??this.cover,v=n?parseInt(n.dataset.withStagger,10)||this.stagger:e.stagger??this.stagger,w=s.querySelector(".is-current-view"),b=s.querySelector(".is-previous-view"),_=s.querySelector(".is-last-view");if(!w){this.notify("zoomIn aborted: no current view found in canvas. Call init() before navigating and keep Zumly view classes intact.","error"),n&&n.classList.remove("zoomed");try{s.removeChild(h)}catch{}return}K(h),K(w),K(b),_&&(K(_),s.removeChild(_));let S,O,P,I,x,q,B,tt=w.style.transform,k=w.style.transformOrigin,D=b?b.style.transform:null,A=b?b.style.transformOrigin:null;try{w.classList.replace("is-current-view","is-previous-view"),b&&b.classList.replace("is-previous-view","is-last-view");let E=h.getBoundingClientRect(),V=w.getBoundingClientRect(),bt=null,Ct=null,lt=null;b&&(bt=b.getBoundingClientRect(),lt=b.querySelector(".zoomed"),Ct=lt&&lt.getBoundingClientRect?lt.getBoundingClientRect():bt);let ct={left:i,top:a},Ot={width:o.width,height:o.height},At={width:E.width,height:E.height},Pt=Ft(y.width,y.height,E.width,E.height,g);B=Pt.scale;let _e=Pt.scaleInv;S=Ht(y,ct,At,_e),P=w.style.transform;let It=Rt(y,V);I=qt(Ot,y,V,B,this.parallax);let Nt=ut(k||"0 0"),U=rt(P||""),$t=ut(It),W=rt(I.transform),Zt=y;if(n&&(Zt=ht(y,V,Nt,U.tx,U.ty,U.scale,$t,W.tx,W.ty,W.scale)),O=jt(Zt,ct,At),b){x=b.style.transform;let Se=ht(V,V,Nt,U.tx,U.ty,U.scale,$t,W.tx,W.ty,W.scale),Te=Vt(I.x,I.y,ct,B,c),Mt=ut(A||"0 0"),_t=rt(x||""),St=rt(Te),Ee=ht(Ct,bt,Mt,_t.tx,_t.ty,_t.scale,Mt,St.tx,St.ty,St.scale);q=Bt({canvasRect:Ot,canvasOffset:ct,triggerRect:y,previousViewRectAtBaseTransform:V,lastViewZoomedElementRect:Ee,previousViewRectWithPreviousAtEndTransform:Se,scale:B,preScale:c,parallax:this.parallax})}h.style.transform=S,w.style.transformOrigin=It}catch(E){this.notify(`zoomIn geometry computation failed: ${E.message}. Aborting zoom.`,"error"),this.debug&&console.error("Zumly _doZoomIn error:",E),w.style.transform=tt,w.style.transformOrigin=k,w.classList.contains("is-previous-view")&&w.classList.replace("is-previous-view","is-current-view"),b&&(b.style.transform=D,b.style.transformOrigin=A,b.classList.contains("is-last-view")&&b.classList.replace("is-last-view","is-previous-view"));try{s.removeChild(h)}catch{}n&&n.classList.remove("zoomed"),X(w),X(b);return}let Y=nt(h.dataset.viewName,{origin:h.style.transformOrigin,duration:p,ease:d,transform:S},{origin:h.style.transformOrigin,duration:p,ease:d,transform:O}),ve=nt(w.dataset.viewName,{origin:w.style.transformOrigin,duration:p,ease:d,transform:P},{origin:w.style.transformOrigin,duration:p,ease:d,transform:I.transform}),ye=b?nt(b.dataset.viewName,{origin:b.style.transformOrigin,duration:p,ease:d,transform:x},{origin:b.style.transformOrigin,duration:p,ease:d,transform:q}):null,we=_?Xt(_):null,at=Yt(this.storedViews.length,Y,ve,ye,we);at.scale=B,at.stagger=v||0,this.storeViews(at),this.currentStage=this.storedViews[this.storedViews.length-1],this.tracing("setCSSVariables()");let ge=this._resolveEffects(n);this._applyEffects(w,b,ge,p,d);let wt=this._resolveHideTrigger(n);this._applyHideTrigger(n,h,wt,p,d),wt&&(at.hideTriggerMode=wt),this._setBlockEvents();let be={type:"zoomIn",currentView:h,previousView:w,lastView:b,currentStage:this.currentStage,duration:p,ease:d},gt=async()=>{this._pendingTransitionComplete===gt&&(this._pendingTransitionComplete=null,!this._destroyed&&(u&&m&&h&&(h.appendChild(m),this.prefetcher.scanAndPrefetch(h,f),typeof this.views[t]=="object"&&typeof this.views[t].mounted=="function"&&await this.views[t].mounted(),this._emit("viewMounted",{viewName:t,node:h})),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterZoomIn",{viewName:t,zoomLevel:this.zoomLevel()}),this.tracing("ended")))};this._pendingTransitionComplete=gt,this.transitionDriver.runTransition(be,gt)}async zoomIn(t){this._destroyed||t?.dataset?.to&&await this._doZoomIn(t.dataset.to,{el:t})}async _doLateral(t,e=!1,s={}){if(this._destroyed)return;if(this.blockEvents){this.notify("lateral navigation ignored: a transition is already running.","warn");return}if(!this.isValid||!this.canvas)return;if(!Object.prototype.hasOwnProperty.call(this.views,t)){this.notify(`goTo("${t}", { mode: 'lateral' }): view not found in views. Available: ${Object.keys(this.views).join(", ")}`,"warn");return}let n=this.canvas.querySelector(".is-current-view");if(!n)return;let o=n.dataset?.viewName;if(o===t)return;this._emit("beforeLateral",{viewName:t,from:o,isBack:e});let i=this.lateralNav&&this.lateralNav.keepAlive,a=null;if(!e){this.lateralHistory=this.lateralHistory||[];let k=this.storedViews[this.storedViews.length-1];a={name:o,entry:k.views[0],node:i?n:null}}this.tracing("lateral()");let l=s.duration??this.duration,c=s.ease??this.ease,f=this.canvas.querySelector(".is-previous-view"),u=this.canvas.querySelector(".is-last-view"),h=0,m=0,y=this._declaredSiblings(),p=y?y.indexOf(o):-1,d=y?y.indexOf(t):-1;if(p!==-1&&d!==-1){let k=this.canvas.getBoundingClientRect();h=(p-d)*k.width*.15}else if(f){let k=f.querySelector(`.zoom-me[data-to="${o}"]`),D=f.querySelector(`.zoom-me[data-to="${t}"]`);if(k&&D){let A=k.getBoundingClientRect(),Y=D.getBoundingClientRect();h=A.left+A.width/2-(Y.left+Y.width/2),m=A.top+A.height/2-(Y.top+Y.height/2)}else h=this.canvas.getBoundingClientRect().width*.15}let g=null,v=null;if(i&&(e&&s.keepAliveNode?v=s.keepAliveNode:v=this.canvas.querySelector(`.is-lateral-hidden[data-view-name="${t}"]`)),v){if(v.style.display="",v.style.opacity="",v.classList.remove("is-lateral-hidden","zoom-lateral-out"),v.classList.add("is-new-current-view","has-no-events"),g=v,!e&&this.lateralHistory){let k=this.lateralHistory.findIndex(D=>D.node===v);k!==-1&&this.lateralHistory.splice(k,1)}}else{let k=()=>{e&&this.lateralHistory.push({name:t,entry:s.savedEntry,node:s.keepAliveNode??null})},D={target:document.createElement("div"),context:this.componentContext,props:s.props??{}};try{let A=await this.prefetcher.get(t,D);if(this._destroyed)return;this.prefetcher.scanAndPrefetch(A,D),g=await et(A,t,this.canvas,!1,this.views,this.componentContext)}catch(A){this.notify(`lateral navigation aborted: failed to resolve view "${t}": ${A.message}`,"error"),k();return}if(!g){k();return}this._emit("viewMounted",{viewName:t,node:g})}a&&this.lateralHistory.push(a),K(g);let w=n.style.transform||"",b=n.style.transformOrigin||"0 0";g.style.transform=w,g.style.transformOrigin=b;let _=this.storedViews[this.storedViews.length-1],S=e&&s.savedEntry?{...s.savedEntry,viewName:t}:nt(t,{origin:b,duration:l,ease:c,transform:w},{origin:b,duration:l,ease:c,transform:w});_.views[0]=S,this.currentStage=_;let O=f?{transformStart:f.style.transform||"",transformEnd:this._computeLateralBackTransform(f.style.transform||"",h,m)}:null,P=u&&_.views[2]?{transformStart:u.style.transform||"",transformEnd:this._computeLateralBackTransform(u.style.transform||"",h*.7,m*.7)}:null;O&&_.views[1]&&(_.views[1].forwardState={..._.views[1].forwardState,transform:O.transformEnd}),P&&_.views[2]&&(_.views[2].forwardState={..._.views[2].forwardState,transform:P.transformEnd});let I=w,x=this._computeLateralBackTransform(I,-h,-m),q=this._computeLateralBackTransform(w,h,m);this._setBlockEvents();let B={type:"lateral",currentView:g,previousView:n,lastView:u||null,backView:f||null,backViewState:O,lastViewState:P,incomingTransformStart:x,incomingTransformEnd:I,outgoingTransform:w,outgoingTransformEnd:q,currentStage:this.currentStage,duration:l,ease:c,canvas:this.canvas,slideDeltaX:h,slideDeltaY:m,keepAlive:i&&!e?i:!1},tt=()=>{this._pendingTransitionComplete===tt&&(this._pendingTransitionComplete=null,!this._destroyed&&(i&&!e&&(n.classList.remove("is-current-view","is-new-current-view","has-no-events"),n.classList.add("is-lateral-hidden"),i!=="visible"?n.style.display="none":(n.style.transform=w,n.style.opacity="")),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterLateral",{viewName:t,from:o,isBack:e}),this.tracing("ended")))};this._pendingTransitionComplete=tt,this.transitionDriver.runTransition(B,tt)}_computeLateralBackTransform(t,e,s){let n=st(t);return n.matched?`translate(${n.tx+e}px, ${n.ty+s}px) ${n.rest}`.trim():`translate(${e}px, ${s}px) ${t}`.trim()}zoomOut(){if(this._destroyed)return;if(this.blockEvents){this.notify("zoomOut ignored: a transition is already running.","warn");return}this._cleanupLateralKeepAlive(),this.lateralHistory=[],this._emit("beforeZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("zoomOut()");let t=this.canvas;this._resetCanvasScroll(t);let e=t.querySelector(".is-current-view"),s=t.querySelector(".is-previous-view");if(!e||!s){this.notify("zoomOut: current or previous view not found (animation may still be running)","warn");return}this._setBlockEvents(),this.currentStage=this.storedViews[this.storedViews.length-1];let n=t.querySelector(".is-last-view");this.tracing("setCSSVariables()");let o=this.currentStage.views[0]?.forwardState?.duration??this.duration,i=this.currentStage.views[0]?.forwardState?.ease??this.ease,a=s.querySelector(".zoomed");a&&a.classList.remove("zoomed");let l=this.currentStage.hideTriggerMode;l&&a&&this._restoreHideTrigger(a,l,o,i),l==="fade"?(e.classList.remove("z-view-fade-in"),e.style.setProperty("--zoom-duration",o),e.style.setProperty("--zoom-ease",i),e.classList.add("z-view-fade-out")):(e.classList.remove("z-view-fade-in"),e.style.removeProperty("opacity")),this._removeEffect(s),s.classList.replace("is-previous-view","is-current-view"),n!==null&&(n.classList.contains("has-effect")&&this.effects[0]!=="none"&&n.style.setProperty("--z-effect-filter",this.effects[0]),n.classList.replace("is-last-view","is-previous-view"),n.classList.remove("hide"),X(n));let c=Ut(this.currentStage);if(c){t.prepend(c);let h=t.querySelector(".z-view:first-child");h&&(X(h),h.classList.add("hide"))}let f={type:"zoomOut",currentView:e,previousView:s,lastView:n,currentStage:this.currentStage,duration:o,ease:i,canvas:t},u=()=>{this._pendingTransitionComplete===u&&(this._pendingTransitionComplete=null,!this._destroyed&&(this.blockEvents=!1,this._onTransitionComplete(),this.storedViews.pop(),this._updateNav(),this._emit("afterZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("ended")))};this._pendingTransitionComplete=u,this.transitionDriver.runTransition(f,u)}onZoom(t){if(this._destroyed||t.type==="mouseup"&&!this.inputs.click||t.type==="touchend"&&!this.inputs.touch)return;let e=t.target;if(e.closest(".z-depth-nav")||e.closest(".z-lateral-nav"))return;let s=e.classList.contains("zoom-me")||e.closest(".zoom-me");if(!this.blockEvents&&s&&!this.touching){this.tracing("onZoom() \u2192 zoomIn"),t.stopPropagation();let n=e.classList.contains("zoom-me")?e:e.closest(".zoom-me");this.zoomIn(n);return}if(this.storedViews.length>1&&!this.blockEvents&&!s&&!this.touching){let n=this.canvas.querySelector(".is-current-view");if(n&&n.contains(e))return;let o=this._findSiblingTriggerAtPoint(t.clientX,t.clientY);if(o){this.tracing("onZoom() \u2192 lateral"),t.stopPropagation(),this._doLateral(o.dataset.to);return}this.tracing("onZoom() \u2192 zoomOut"),t.stopPropagation(),this.zoomOut()}}_findSiblingTriggerAtPoint(t,e){let s=this.canvas.querySelector(".is-previous-view");if(!s)return null;let o=this.canvas.querySelector(".is-current-view")?.dataset?.viewName;if(!o)return null;let i=s.querySelectorAll(".zoom-me[data-to]");for(let a of i){if(a.dataset.to===o)continue;let l=a.getBoundingClientRect();if(t>=l.left&&t<=l.right&&e>=l.top&&e<=l.bottom)return a}return null}_getSiblings(){let e=this.canvas.querySelector(".is-current-view")?.dataset?.viewName,s=this._declaredSiblings();if(s&&s.indexOf(e)!==-1)return{siblings:s,currentIndex:s.indexOf(e)};let n=this.canvas.querySelector(".is-previous-view");if(!n)return{siblings:[],currentIndex:-1};let o=n.querySelectorAll(".zoom-me[data-to]"),i=[];for(let l of o)l.dataset.to&&i.push(l.dataset.to);let a=i.indexOf(e);return{siblings:i,currentIndex:a}}_declaredSiblings(){let t=this.lateralNav&&typeof this.lateralNav=="object"?this.lateralNav.siblings:null;if(!t)return null;if(Array.isArray(t))return t;let e=this.canvas.querySelector(".is-previous-view")?.dataset?.viewName;return e&&Array.isArray(t[e])?t[e]:null}_updateNav(){this._destroyed||(this._removeNav(),this._updateDepthNav(),this._updateLateralNav())}_updateDepthNav(){if(!this.depthNav||this.storedViews.length-1<1)return;let e=this.canvas.querySelector(".z-view.is-current-view");if(e&&e.querySelector(".z-depth-nav"))return;let s=this.depthNav.position||"bottom-left",n=document.createElement("div");n.className="z-depth-nav z-depth-nav--"+s;let o=document.createElement("button");o.className="z-nav-back",o.setAttribute("aria-label","Zoom out (go back)"),o.innerHTML="&#8249;",o.addEventListener("mouseup",i=>{i.stopPropagation(),!this.blockEvents&&this.storedViews.length>1&&this.zoomOut()}),n.appendChild(o),this.canvas.appendChild(n)}_updateLateralNav(){if(!this.lateralNav)return;let t=this.storedViews.length-1,e=this._getSiblings();if(e.siblings.length<2)return;if(this.lateralNav.mode==="auto"&&t>=1){let a=this.canvas.querySelector(".z-view.is-current-view");if(a&&a.offsetWidth>=this.canvas.offsetWidth&&a.offsetHeight>=this.canvas.offsetHeight)return}let{siblings:s,currentIndex:n}=e,o=this.lateralNav.position||"bottom-center",i=document.createElement("div");if(i.className="z-lateral-nav z-lateral-nav--"+o,this.lateralNav.arrows){let a=document.createElement("button");a.className="z-nav-arrow z-nav-prev",a.setAttribute("aria-label","Previous sibling view"),a.innerHTML="&#8249;",a.disabled=n<=0,a.addEventListener("mouseup",l=>{l.stopPropagation(),n>0&&this._doLateral(s[n-1])}),i.appendChild(a)}if(this.lateralNav.dots){let a=document.createElement("div");a.className="z-nav-lateral-dots";for(let l=0;l<s.length;l++){let c=document.createElement("button");c.className="z-nav-dot z-nav-lat-dot"+(l===n?" is-active":""),c.setAttribute("aria-label",`Go to ${s[l]}`),c.dataset.to=s[l],c.addEventListener("mouseup",(f=>u=>{u.stopPropagation(),f!==n&&this._doLateral(s[f])})(l)),a.appendChild(c)}i.appendChild(a)}if(this.lateralNav.arrows){let a=document.createElement("button");a.className="z-nav-arrow z-nav-next",a.setAttribute("aria-label","Next sibling view"),a.innerHTML="&#8250;",a.disabled=n>=s.length-1,a.addEventListener("mouseup",l=>{l.stopPropagation(),n<s.length-1&&this._doLateral(s[n+1])}),i.appendChild(a)}this.canvas.appendChild(i)}_removeNav(){this.canvas&&this.canvas.querySelectorAll(".z-depth-nav, .z-lateral-nav").forEach(t=>t.remove())}_cleanupLateralKeepAlive(){if(!this.canvas)return;let t=this.canvas.querySelectorAll(".is-lateral-hidden");for(let e of t)e.remove()}onKeyUp(t){this._destroyed||this.inputs.keyboard&&(this.tracing("onKeyUp()"),(t.key==="ArrowLeft"||t.key==="ArrowDown")&&(t.preventDefault(),this.storedViews.length>1&&!this.blockEvents?this.zoomOut():this.notify(`is on level zero. Can't zoom out. Trigger: ${t.key}`,"warn")),(t.key==="ArrowRight"||t.key==="ArrowUp")&&(t.preventDefault(),this.notify(t.key+" has no actions defined")))}onWheel(t){this._destroyed||this.inputs.wheel&&(this._isInsideScrollable(t.target,t.deltaY)||(t.preventDefault(),!(this.blockEvents||this._wheelCooldown)&&t.deltaY>0&&this.storedViews.length>1&&(this.tracing("onWheel() \u2192 zoomOut"),this._wheelCooldown=!0,this._setTrackedTimeout(()=>{this._wheelCooldown=!1},500),this.zoomOut())))}_isInsideScrollable(t,e){let s=t,n=this.canvas.querySelector(".is-current-view");for(;s&&s!==this.canvas;){if(s===n||n&&n.contains(s)){let{overflowY:o}=window.getComputedStyle(s);if((o==="auto"||o==="scroll")&&(e>0?s.scrollTop+s.clientHeight<s.scrollHeight-1:s.scrollTop>0))return!0}s=s.parentElement}return!1}onTouchStart(t){this._destroyed||this.inputs.touch&&(this.tracing("onTouchStart()"),this.touching=!0,this.touchstartX=t.changedTouches[0].screenX,this.touchstartY=t.changedTouches[0].screenY)}onTouchEnd(t){this._destroyed||this.inputs.touch&&(this.blockEvents||(this.tracing("onTouchEnd()"),this.touchendX=t.changedTouches[0].screenX,this.touchendY=t.changedTouches[0].screenY,this.handleGesture(t)),this.touching=!1)}handleGesture(t){t.stopPropagation(),this.tracing("handleGesture()");let e=this.touchendX-this.touchstartX,s=this.touchendY-this.touchstartY,n=Math.abs(e)<10&&Math.abs(s)<10;e<-30&&(this.storedViews.length>1&&!this.blockEvents?(this.tracing("swipe left"),this.zoomOut()):this.notify("is on level zero. Can't zoom out. Trigger: Swipe left","warn"));let o=t.target.classList.contains("zoom-me")?t.target:t.target.closest(".zoom-me");n&&!this.blockEvents&&o&&this.touching&&(this.touching=!1,this.tracing("tap"),t.preventDefault(),this.zoomIn(o)),n&&this.storedViews.length>1&&!this.blockEvents&&!o&&t.target.closest(".is-current-view")===null&&this.touching&&(this.touching=!1,this.tracing("tap"),this.zoomOut())}};var Be={separator:"/",prefix:"/"};function me(r,t){let e=[];for(let s of r.storedViews){let n=s.views&&s.views[0];n&&n.viewName&&e.push(n.viewName)}return e.join(t)}function Ve(r,t){let e=window.location.hash.slice(1);return e.startsWith(r)&&(e=e.slice(r.length)),e?e.split(t).filter(Boolean):[]}var pe={install(r,t){let e=Object.assign({},Be,t),s=e.separator,n=e.prefix,o=!1;function i(f){if(o)return;let u=me(r,s),h="#"+n+u;window.location.hash!==h&&(o=!0,window.history[f](null,"",h),o=!1)}function a(){i("pushState")}function l(){i("replaceState")}r.on("afterZoomIn",a),r.on("afterLateral",a),r.on("afterZoomOut",l);function c(){if(o)return;o=!0;let f=Ve(n,s),u=me(r,s).split(s).filter(Boolean);if(f.join(s)===u.join(s)){o=!1;return}if(f.length<u.length){let h=u.length-f.length;for(let m=0;m<h;m++)r.zoomOut()}else if(f.length===u.length&&f.length>0){let h=f[f.length-1];h!==u[u.length-1]&&r.goTo(h,{mode:"lateral"})}else f.length>u.length&&window.history.back();o=!1}window.addEventListener("popstate",c),l(),r.on("destroy",function(){r.off("afterZoomIn",a),r.off("afterLateral",a),r.off("afterZoomOut",l),window.removeEventListener("popstate",c)})}};it.Router=pe;var Zs=it;export{it as Zumly,pe as ZumlyRouter,Zs as default};
@@ -169,7 +169,7 @@ Your driver receives `spec.type` which is one of:
169
169
  - `'zoomOut'` — go back
170
170
  - `'lateral'` — same-level swap
171
171
 
172
- For lateral, the built-in **`waapi`** driver runs a **slide animation**. If you author a minimal custom driver and want **no** lateral motion, call the instant helper:
172
+ For lateral, the built-in **`css`** and **`waapi`** drivers run a **slide animation** (the other built-ins are instant). If you author a minimal custom driver and want **no** lateral motion, call the instant helper:
173
173
 
174
174
  ```js
175
175
  import { runLateralInstant } from 'zumly/driver-helpers'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zumly",
3
- "version": "0.92.4",
3
+ "version": "0.92.6",
4
4
  "description": "Javascript library for building zooming user interfaces",
5
5
  "type": "module",
6
6
  "author": "Juan Martin Muda - Zumerlab",
@@ -21,14 +21,14 @@
21
21
  "library",
22
22
  "ZUI"
23
23
  ],
24
- "main": "dist/zumly.js",
24
+ "main": "dist/zumly.cjs",
25
25
  "module": "dist/zumly.mjs",
26
26
  "types": "types/zumly.d.ts",
27
27
  "exports": {
28
28
  ".": {
29
29
  "types": "./types/zumly.d.ts",
30
30
  "import": "./dist/zumly.mjs",
31
- "require": "./dist/zumly.js",
31
+ "require": "./dist/zumly.cjs",
32
32
  "default": "./dist/zumly.mjs"
33
33
  },
34
34
  "./style.css": "./dist/zumly.css",
@@ -37,6 +37,7 @@
37
37
  "import": "./src/drivers/index.js"
38
38
  },
39
39
  "./driver-helpers": {
40
+ "types": "./src/drivers/driver-helpers.d.ts",
40
41
  "import": "./src/drivers/driver-helpers.js"
41
42
  }
42
43
  },
@@ -53,16 +54,19 @@
53
54
  "test:coverage": "npx vitest run --browser.headless --coverage",
54
55
  "test:install-browsers": "npx playwright install chromium",
55
56
  "bump": "npx @zumerbox/bump && npx @zumerbox/changelog",
56
- "prebuild": "git add CHANGELOG.md && git commit -m \"Bumped version\" && git push --follow-tags"
57
+ "prebuild": "git add CHANGELOG.md && git commit -m \"Bumped version\" && git push --follow-tags",
58
+ "prepack": "npm run compile"
57
59
  },
58
60
  "files": [
59
61
  "dist",
60
62
  "types",
61
- "src/drivers/driver-helpers.js",
62
- "src/drivers/index.js",
63
+ "src/drivers",
63
64
  "docs/DRIVER_API.md",
64
65
  "README.md"
65
66
  ],
67
+ "engines": {
68
+ "node": ">=18"
69
+ },
66
70
  "devDependencies": {
67
71
  "esbuild": "^0.24.0",
68
72
  "@vitest/browser": "^3.1.2",
@@ -0,0 +1,185 @@
1
+ /**
2
+ * Anime.js transition driver.
3
+ * Requires global `anime` — load from CDN before use:
4
+ * <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.2/anime.min.js"></script>
5
+ *
6
+ * Interpolates computed transform matrices to keep intermediate coordinates correct
7
+ * when transform-origin varies between states.
8
+ *
9
+ * @param {Object} spec - Transition spec from the engine
10
+ * @param {function} onComplete - MUST be called exactly once when done
11
+ */
12
+ import {
13
+ parseDurationMs,
14
+ showViews,
15
+ applyZoomInEndState,
16
+ applyZoomOutPreviousState,
17
+ applyZoomOutLastState,
18
+ removeViewFromCanvas,
19
+ runLateralInstant,
20
+ readComputedMatrix,
21
+ interpolateMatrix,
22
+ matrixToString,
23
+ } from './driver-helpers.js'
24
+
25
+ export function runTransition (spec, onComplete) {
26
+ const anime = typeof globalThis !== 'undefined' && globalThis.anime
27
+ if (!anime || typeof anime !== 'function') {
28
+ console.warn('Zumly anime driver: Anime.js not loaded. Add <script src="https://cdnjs.cloudflare.com/ajax/libs/animejs/3.2.2/anime.min.js"></script>')
29
+ onComplete()
30
+ return
31
+ }
32
+
33
+ const { type, currentView, previousView, lastView, currentStage, duration, ease, canvas } = spec
34
+ if (!currentView || !previousView || !currentStage) {
35
+ onComplete()
36
+ return
37
+ }
38
+
39
+ const durationMs = parseDurationMs(duration)
40
+
41
+ if (type === 'lateral') {
42
+ runLateralInstant(spec, onComplete)
43
+ } else if (type === 'zoomIn') {
44
+ runZoomIn(anime, currentView, previousView, lastView, currentStage, durationMs, ease, onComplete)
45
+ } else if (type === 'zoomOut') {
46
+ runZoomOut(anime, currentView, previousView, lastView, currentStage, durationMs, ease, canvas, onComplete)
47
+ } else {
48
+ onComplete()
49
+ }
50
+ }
51
+
52
+ // ─── Zoom In ─────────────────────────────────────────────────────────
53
+
54
+ function runZoomIn (anime, currentView, previousView, lastView, currentStage, durationMs, ease, onComplete) {
55
+ showViews(currentView, previousView, lastView)
56
+
57
+ const v0 = currentStage.views[0]
58
+ const v1 = currentStage.views[1]
59
+ const v2 = lastView && currentStage.views[2] ? currentStage.views[2] : null
60
+
61
+ // Read computed matrices for all views
62
+ const matrices = computeMatrixPairs(
63
+ [
64
+ { el: currentView, backward: v0.backwardState, forward: v0.forwardState },
65
+ { el: previousView, backward: v1.backwardState, forward: v1.forwardState },
66
+ ...(v2 ? [{ el: lastView, backward: v2.backwardState, forward: v2.forwardState }] : []),
67
+ ],
68
+ 'forward' // zoom-in: backward → forward
69
+ )
70
+
71
+ // Set initial transforms
72
+ applyMatrices(matrices, 0)
73
+
74
+ const stagger = currentStage.stagger || 0
75
+ const totalDuration = durationMs + (v2 ? stagger * 2 : stagger)
76
+ const progress = { value: 0 }
77
+ anime({
78
+ targets: progress,
79
+ value: 1,
80
+ duration: totalDuration,
81
+ easing: normalizeEasing(ease),
82
+ update: () => {
83
+ const elapsed = progress.value * totalDuration
84
+ applyStaggeredMatrices(matrices, elapsed, durationMs, stagger)
85
+ },
86
+ complete: () => {
87
+ applyZoomInEndState(currentView, currentStage)
88
+ applyZoomInEndState(previousView, currentStage)
89
+ if (lastView) applyZoomInEndState(lastView, currentStage)
90
+ onComplete()
91
+ }
92
+ })
93
+ }
94
+
95
+ // ─── Zoom Out ────────────────────────────────────────────────────────
96
+
97
+ function runZoomOut (anime, currentView, previousView, lastView, currentStage, durationMs, ease, canvas, onComplete) {
98
+ const v0 = currentStage.views[0]
99
+ const v1 = currentStage.views[1]
100
+ const v2 = lastView && currentStage.views[2] ? currentStage.views[2] : null
101
+ const to1 = v1.backwardState
102
+ const to2 = v2 ? v2.backwardState : null
103
+
104
+ // Read computed matrices (zoom-out: forward → backward)
105
+ const matrices = computeMatrixPairs(
106
+ [
107
+ { el: currentView, backward: v0.backwardState, forward: v0.forwardState },
108
+ { el: previousView, backward: v1.backwardState, forward: v1.forwardState },
109
+ ...(v2 ? [{ el: lastView, backward: v2.backwardState, forward: v2.forwardState }] : []),
110
+ ],
111
+ 'backward' // zoom-out: forward → backward
112
+ )
113
+
114
+ applyMatrices(matrices, 0)
115
+
116
+ const stagger = currentStage.stagger || 0
117
+ const totalDuration = durationMs + (v2 ? stagger * 2 : stagger)
118
+ const progress = { value: 0 }
119
+ anime({
120
+ targets: progress,
121
+ value: 1,
122
+ duration: totalDuration,
123
+ easing: normalizeEasing(ease),
124
+ update: () => {
125
+ const elapsed = progress.value * totalDuration
126
+ applyStaggeredMatrices(matrices, elapsed, durationMs, stagger)
127
+ },
128
+ complete: () => {
129
+ removeViewFromCanvas(currentView, canvas)
130
+ applyZoomOutPreviousState(previousView, to1)
131
+ if (lastView && to2) applyZoomOutLastState(lastView, to2)
132
+ onComplete()
133
+ }
134
+ })
135
+ }
136
+
137
+ // ─── Matrix pair computation ─────────────────────────────────────────
138
+
139
+ /**
140
+ * Compute from/to matrix pairs for a set of views.
141
+ * @param {{ el, backward, forward }[]} views
142
+ * @param {'forward'|'backward'} direction - 'forward' = backward→forward, 'backward' = forward→backward
143
+ * @returns {{ el, from, to }[]}
144
+ */
145
+ function computeMatrixPairs (views, direction) {
146
+ return views.map(({ el, backward, forward }) => {
147
+ if (direction === 'forward') {
148
+ const from = readComputedMatrix(el, backward.origin, backward.transform)
149
+ const to = readComputedMatrix(el, backward.origin, forward.transform)
150
+ return { el, from, to }
151
+ } else {
152
+ const from = readComputedMatrix(el, forward.origin, forward.transform)
153
+ const to = readComputedMatrix(el, forward.origin, backward.transform)
154
+ return { el, from, to }
155
+ }
156
+ })
157
+ }
158
+
159
+ function applyMatrices (matrices, t) {
160
+ for (const { el, from, to } of matrices) {
161
+ el.style.transform = matrixToString(interpolateMatrix(from, to, t))
162
+ }
163
+ }
164
+
165
+ function applyStaggeredMatrices (matrices, elapsed, durationMs, stagger) {
166
+ for (let i = 0; i < matrices.length; i++) {
167
+ const { el, from, to } = matrices[i]
168
+ const delay = i * stagger
169
+ const localElapsed = Math.max(0, elapsed - delay)
170
+ const t = durationMs > 0 ? Math.min(1, localElapsed / durationMs) : 1
171
+ el.style.transform = matrixToString(interpolateMatrix(from, to, t))
172
+ }
173
+ }
174
+
175
+ // ─── Easing normalization ────────────────────────────────────────────
176
+
177
+ function normalizeEasing (ease) {
178
+ if (typeof ease !== 'string') return 'easeInOutQuad'
179
+ const s = ease.toLowerCase()
180
+ if (s === 'linear') return 'linear'
181
+ if (s.includes('ease-in-out')) return 'easeInOutQuad'
182
+ if (s.includes('ease-in')) return 'easeInQuad'
183
+ if (s.includes('ease-out')) return 'easeOutQuad'
184
+ return s
185
+ }