UNPKG

zircle

Version:

Zircle's circular components, rebuilt with Orbit and Zumly for the web. No Vue required.

128 lines 148 kB
/*! Zircle, Orbit, and Zumly are MIT licensed. See LICENSES.txt for copyright and permission notices. */
var Zircle=(()=>{var re=Object.defineProperty;var Si=Object.getOwnPropertyDescriptor;var Ai=Object.getOwnPropertyNames;var zi=Object.prototype.hasOwnProperty;var ki=(t,e)=>{for(var i in e)re(t,i,{get:e[i],enumerable:!0})},Ei=(t,e,i,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of Ai(e))!zi.call(t,r)&&r!==i&&re(t,r,{get:()=>e[r],enumerable:!(s=Si(e,r))||s.enumerable});return t};var Pi=t=>Ei(re({},"__esModule",{value:!0}),t);var Os={};ki(Os,{MODES:()=>Qt,Orbit:()=>lt,THEMES:()=>Gt,ZCanvas:()=>vt,ZDialog:()=>xt,ZKnob:()=>St,ZList:()=>_t,ZPagination:()=>kt,ZScroll:()=>zt,ZSlider:()=>At,ZSpot:()=>yt,ZView:()=>bt,Zumly:()=>Ct,ZumlyRouter:()=>Nt,createZircle:()=>Vt,default:()=>Vt,registerElements:()=>Jt});var st=Symbol.for("zumer.orbit.layout.state.v1"),ne=Symbol.for("zumer.orbit.layout.registry.v1"),Me=Symbol.for("zumer.orbit.layout.probe.v1"),oe="o-arc, o-progress",Ie={subtree:!0,childList:!0,characterData:!0,attributes:!0,attributeOldValue:!0};function le(t){var e;for(let i of t.classList||[])if(/^orbit-\d+$/.test(i))return Number(i.slice(6));return(e=t.classList)!=null&&e.contains("orbit")?null:void 0}function ot(t,e,i){let s=String(i);t.style.getPropertyValue(e)!==s&&t.style.setProperty(e,s)}function Lt(t,e,i=0,s="number"){let r=String(e||"").trim();if(!r)return i;if(s==="number"&&/^[+-]?(?:\d+\.?\d*|\.\d+)$/.test(r))return Number(r);let n=r.match(/^([+-]?(?:\d+\.?\d*|\.\d+))(deg|rad|grad|turn)?$/);if(s==="angle"&&n)return Number(n[1])*({deg:1,rad:180/Math.PI,grad:.9,turn:360}[n[2]]||1);let o=t.ownerDocument;if(!o?.documentElement)return i;let a=o[Me];a||(a=o.createElement("span"),a.setAttribute("data-orbit-measure",""),a.setAttribute("aria-hidden","true"),a.style.cssText="all:initial!important;position:fixed!important;visibility:hidden!important;pointer-events:none!important;width:0!important;height:0!important;overflow:hidden!important;",o.documentElement.appendChild(a),Object.defineProperty(o,Me,{value:a,configurable:!0}));let l=s==="angle"?"rotate":"scale";if(a.style.removeProperty(l),a.style.setProperty(l,r,"important"),!a.style.getPropertyValue(l))return i;let c=o.defaultView.getComputedStyle(a).getPropertyValue(l),h=parseFloat(c);return Number.isFinite(h)?h:i}function Li(t){if(t.localName==="o-arc")return"arc";for(let e of["satellite","vector","side"])if(t.classList.contains(e))return e;return null}function $i(t){let e={arc:0,satellite:0,vector:0,side:0};for(let r of t.children){let n=Li(r);n?ot(r,"--o-layout-index",e[n]++-(n==="side"?1:0)):r.localName==="o-progress"&&ot(r,"--o-layout-index",0)}let i=Math.max(e.arc,e.satellite,e.vector,1),s=e.side?String(e.side):`max(1, ${i} - var(--o-fit-range, 0))`;ot(t,"--o-layout-angle",`calc(var(--o-range, 360deg) / ${s})`)}function Oe(t){return t?.nodeType===9||t?.nodeType===11&&!!t.host}function ce(t){var e;if(Oe(t))return t;let i=(e=t?.getRootNode)==null?void 0:e.call(t);return Oe(i)?i:null}function De(t,e){var i,s;for(let r=e;r;r=(i=r.getRootNode)==null?void 0:i.call(r).host)if(t===r||(s=t.contains)!=null&&s.call(t,r))return!0;return!1}function Ti(t){return t[ne]||Object.defineProperty(t,ne,{value:{states:new Set},configurable:!0}),t[ne]}function he(t){if(!t.disposed){t.disposed=!0,t.view.cancelAnimationFrame(t.frame),t.observer.disconnect(),t.resize.disconnect();for(let e of t.listeners)e();t.rings.clear(),t.visuals.clear(),t.dirty.clear(),t.registry.states.delete(t),t.scope[st]===t&&delete t.scope[st]}}function Re(t){for(let e of t.states)e.scope.host&&!e.scope.host.isConnected&&he(e)}function It(t,e=t.scope){for(let i of t.registry.states)i!==t&&i.scope.host&&De(e,i.scope.host)&&(i.all=!0,i.queue())}function Ci(t){return t.nodeType!==1||t.hasAttribute("data-orbit-measure")?!1:le(t)!==void 0||t.matches(".gravity-spot, o-arc, o-progress")?!0:!!t.querySelector(".gravity-spot, .orbit, [data-orbit-ring], o-arc, o-progress")}function Ni(t){return t.nodeType===1&&(t.matches('style, link[rel~="stylesheet"]')||!!t.querySelector('style, link[rel~="stylesheet"]'))}function Vi(t,e){if(t.type==="childList")return[...t.addedNodes,...t.removedNodes].some(Ci);if(t.attributeName!=="class")return!1;let i=t.target;return e.rings.has(i)||i.classList.contains("gravity-spot")||le(i)!==void 0||(t.oldValue||"").split(/\s+/).some(s=>s==="gravity-spot"||s==="orbit"||/^orbit-\d+$/.test(s))}function Mi(t){let e=t.nodeType===9?t:t.ownerDocument,i=e.defaultView,s=Ti(e),r={scope:t,doc:e,view:i,registry:s,rings:new Set,visuals:new Set,dirty:new Set,scan:!0,all:!0,frame:0,disposed:!1,listeners:[]},n=(l,c,h,u)=>{l?.addEventListener(c,h,u),r.listeners.push(()=>l?.removeEventListener(c,h,u))},o=()=>{!r.disposed&&!r.frame&&(r.frame=i.requestAnimationFrame(()=>{r.frame=0,r.flush()}))};r.queue=o,r.flush=()=>qi(r),r.invalidate=(l=t,c=!0)=>{var h,u;if(c&&(l===t||l===e.documentElement||l===e.head))r.all=!0;else{for(let d of r.rings)(d===l||d.contains(l)||c&&((h=l.contains)!=null&&h.call(l,d)))&&r.dirty.add(d);for(let d of r.visuals)(d===l||d.contains(l)||c&&((u=l.contains)!=null&&u.call(l,d)))&&r.dirty.add(d)}(r.all||r.dirty.size||r.scan)&&o()},r.observer=new i.MutationObserver(l=>{var c,h;if(l.some(u=>u.type==="childList")&&Re(s),!r.disposed)for(let u of l){let d=u.target.nodeType===3?u.target.parentElement:u.target;if(!d||(c=d.hasAttribute)!=null&&c.call(d,"data-orbit-measure"))continue;let f=Vi(u,r);f&&(r.scan=!0),u.type==="childList"&&[...u.addedNodes,...u.removedNodes].some(Ni)||(h=d.closest)!=null&&h.call(d,"head, style")||d.localName==="link"?(r.all=!0,It(r)):u.type==="attributes"&&It(r,d),r.invalidate(d,u.type==="attributes"||f)}}),r.observer.observe(t,Ie),r.resize=new i.ResizeObserver(l=>{for(let c of l)r.dirty.add(c.target);o()});let a=()=>{r.all=!0,It(r),o()};t===e&&(n(i,"resize",a),n(e.fonts,"loadingdone",a)),n(t,"load",l=>{l.target.localName==="link"&&a()},!0);for(let l of["pointerover","pointerout","focusin","focusout"])n(t,l,c=>{r.invalidate(c.target),It(r,c.target)},!0);return Object.defineProperty(t,st,{value:r,configurable:!0}),s.states.add(r),o(),r}function ue(t){let e=t.nodeType===9?t:t.ownerDocument;if(!e?.defaultView||!e.documentElement||t.host&&!t.host.isConnected)return null;if(t[st]&&t[st].doc!==e&&he(t[st]),t.host){let i=ce(t.host);i&&ue(i)}return t[st]||Mi(t)}function Oi(t){let e=new Set,i=new Map;for(let r of t.scope.querySelectorAll(".gravity-spot > *")){let n=le(r);if(n===void 0)continue;let o=i.get(r.parentElement)||0;r.classList.contains("orbit")&&i.set(r.parentElement,++o);let a=n===null?o:n;r.setAttribute("data-orbit-ring",""),ot(r,"--o-layout-number",a===0?1e-5:a),e.add(r),t.dirty.add(r),t.rings.has(r)||t.resize.observe(r)}for(let r of t.rings)if(!e.has(r)){t.resize.unobserve(r),r.removeAttribute("data-orbit-ring");for(let n of["--o-layout-number","--o-layout-angle"])r.style.removeProperty(n)}t.rings=e;let s=new Set(t.scope.querySelectorAll(oe));for(let r of t.visuals)s.has(r)||t.resize.unobserve(r);for(let r of s)t.visuals.has(r)||(t.resize.observe(r),t.dirty.add(r));t.visuals=s,t.scan=!1}function qi(t){var e;if(!t.disposed){if(t.scope.host&&!t.scope.host.isConnected){he(t);return}t.observer.disconnect();try{t.scan&&Oi(t);let i=t.all?new Set([...t.rings,...t.visuals]):t.dirty,s=new Set;for(let r of i)if(r.isConnected)if(t.rings.has(r)){$i(r);for(let n of r.querySelectorAll(oe))s.add(n)}else t.visuals.has(r)&&s.add(r);for(let r of t.visuals)s.has(r)&&((e=r.update)==null||e.call(r));t.dirty=new Set,t.all=!1}finally{t.disposed||t.observer.observe(t.scope,Ie)}}}function Ze(t=globalThis.document){var e;let i=ce(t);if(!i)return;let s=ue(i);s&&((e=t?.matches)!=null&&e.call(t,oe)&&!s.visuals.has(t)&&(s.scan=!0),s.invalidate(t||i))}function qe(t=globalThis.document){let e=ce(t);if(!e)return;let i=ue(e);if(i){Re(i.registry);for(let s of i.registry.states)s!==i&&(!s.scope.host||!De(t,s.scope.host))||(s.scan=!0,s.all=!0,s.view.cancelAnimationFrame(s.frame),s.frame=0,s.flush())}}var Fe=class extends(globalThis.HTMLElement||class{}){constructor(){super()}connectedCallback(){Ze(this)}disconnectedCallback(){this._textFrame&&this.ownerDocument.defaultView.cancelAnimationFrame(this._textFrame),this._textFrame=0}readNumber(t,e,i=0){return Lt(this,t.getPropertyValue(e),i)}readAngle(t,e,i=0){return Lt(this,t.getPropertyValue(e),i,"angle")}getCommonAttributes(t){var e;let i=t.ownerDocument.defaultView.getComputedStyle(t),s=parseFloat(i.getPropertyValue("r")),r=Math.max(0,Number.isFinite(s)?s:(((e=t.parentElement)==null?void 0:e.clientWidth)||0)/2),n=Math.max(1e-5,this.readNumber(i,"--o-orbit-number",1)),o=Math.max(0,this.readNumber(i,"--o-size-ratio",1)),a=Math.max(0,this.readNumber(i,"--o-stroke-width",1)),l=t.getAttribute("shape")||"none",c=Math.max(0,r/n*o-a+.3),h=r>0?Math.min(49.999,c*25/r):0,u=0;t.classList.contains("outer-orbit")?u=h:t.classList.contains("quarter-outer-orbit")?u=h*-.5:t.classList.contains("inner-orbit")?u=h*-1:t.classList.contains("quarter-inner-orbit")&&(u=h*.5);let d=50+u;return{orbitRadius:r,arcHeight:c,realRadius:d,arcAngle:0,shape:l,arcHeightPercentage:h,orbitNumber:n,size:o,strokeWidth:a,style:i}}getProgressAngle(t,e,i=100){return!Number.isFinite(e)||!Number.isFinite(i)||i<=0?0:Math.min(1,Math.max(0,e/i))*Math.max(0,Math.min(360,t))}getControlPoint(t,e,i,s,r="clockwise"){let n=(t+i)/2,o=(e+s)/2,a=i-t,l=s-e;return r==="clockwise"?{xc:n+l*.4,yc:o-a*.4}:{xc:n-l*.4,yc:o+a*.4}}arcPoint(t,e,i=0,s=0){let r=t+i,n=e+s*Math.PI/180;return{x:50+r*Math.cos(n),y:50+r*Math.sin(n)}}calculateCommonArcParameters(t,e,i,s,r,n,o,a=0){let l=Math.PI/2,c=Math.max(0,Math.min(359.999999,t))*Math.PI/180,h=e+i,u=Math.max(.001,e-i),d=Math.min(c*.49,(a+n*1.25)/s/h),f=Math.min(c*.49,(a+n*1.25)/s/u),m=d-l,g=c-d-l,p=f-l,b=c-f-l,v=this.arcPoint(h,m),y=this.arcPoint(h,g),_=this.arcPoint(u,p),z=this.arcPoint(u,b),x=g-m,E=b-p,w=x>Math.PI?1:0,S=E>Math.PI?1:0;return{upperArcStart:v,upperArcEnd:y,innerArcStart:_,innerArcEnd:z,largeArcFlag:w,largeArcFlagUpper:w,largeArcFlagInner:S,bigRadius:h,smallRadius:u,radius:e,upperAngleStart:m,upperAngleEnd:g,innerAngleStart:p,innerAngleEnd:b}}generatePathData(t,e,i,s){let r="";switch(t){case"rounded":r=this.generateRoundedPath(e,i,s);break;case"circle":case"circle-a":case"bullet":r=this.generateCirclePath(e,t);break;case"circle-b":r=this.generateCircleBPath(e,i,s);break;case"arrow":r=this.generateArrowPath(e,s);break;case"backslash":case"slash":r=this.generateSlashPath(e,t,s);break;case"zigzag":r=this.generateZigzagPath(e,i,s);break;default:r=this.generateDefaultPath(e)}return r}generateRoundedPath(t,e,i){let{bigRadius:s,smallRadius:r}=t,n=Math.min(t.upperAngleEnd-t.upperAngleStart,t.innerAngleEnd-t.innerAngleStart),o=Math.min(e<5?2.5:e<10?5:10,n*180/Math.PI*i*.49),a=o/i*Math.PI/180,l=t.upperAngleEnd-t.upperAngleStart-2*a>Math.PI?1:0,c=t.innerAngleEnd-t.innerAngleStart-2*a>Math.PI?1:0,h=this.arcPoint(s,t.upperAngleStart,0,o/i),u=this.arcPoint(s,t.upperAngleEnd,0,-o/i),d=this.arcPoint(r,t.innerAngleStart,0,o/i),f=this.arcPoint(r,t.innerAngleEnd,0,-o/i),m=this.arcPoint(s,t.upperAngleStart,-(o/2)/i,0),g=this.arcPoint(s,t.upperAngleEnd,-(o/2)/i,0),p=this.arcPoint(r,t.innerAngleStart,o/2/i,0),b=this.arcPoint(r,t.innerAngleEnd,o/2/i,0),v=this.getControlPoint(u.x,u.y,g.x,g.y),y=this.getControlPoint(b.x,b.y,f.x,f.y),_=this.getControlPoint(d.x,d.y,p.x,p.y),z=this.getControlPoint(m.x,m.y,h.x,h.y),x=`M ${h.x},${h.y} A ${s},${s} 0 ${l} 1 ${u.x},${u.y}`;return x+=`Q ${v.xc},${v.yc} ${g.x},${g.y} L ${b.x},${b.y}`,x+=`Q ${y.xc},${y.yc} ${f.x},${f.y}`,x+=`A ${r},${r} 0 ${c} 0 ${d.x},${d.y}`,x+=`Q ${_.xc},${_.yc} ${p.x},${p.y} L ${m.x},${m.y}`,x+=` Q ${z.xc},${z.yc} ${h.x},${h.y}`,x+=" Z",x}generateCirclePath(t,e){let{upperArcStart:i,upperArcEnd:s,innerArcStart:r,innerArcEnd:n,bigRadius:o,smallRadius:a,largeArcFlagUpper:l,largeArcFlagInner:c}=t,h=`M ${i.x},${i.y} A ${o},${o} 0 ${l} 1 ${s.x},${s.y}`;return h+=` A 1,1 0 0 1 ${n.x},${n.y} `,h+=` A ${a},${a} 0 ${c} 0 ${r.x},${r.y}`,h+=` A 1,1 0 0 ${e==="circle"||e==="circle-a"?1:0} ${i.x},${i.y} `,h+=" Z",h}generateCircleBPath(t,e,i){let{upperAngleStart:s,upperAngleEnd:r,innerAngleStart:n,innerAngleEnd:o,bigRadius:a,smallRadius:l}=t,c=Math.min(r-s,o-n),h=Math.min(e*1.36,c*180/Math.PI*i*.49),u=h/i*Math.PI/180,d=r-s-2*u>Math.PI?1:0,f=o-n-2*u>Math.PI?1:0,m=this.arcPoint(a,s,0,h/i),g=this.arcPoint(a,r,0,-h/i),p=this.arcPoint(l,n,0,h/i),b=this.arcPoint(l,o,0,-h/i),v=`M ${m.x},${m.y} A ${a},${a} 0 ${d} 1 ${g.x},${g.y}`;return v+=` A 1,1 0 0 1 ${b.x},${b.y} `,v+=` A ${l},${l} 0 ${f} 0 ${p.x},${p.y}`,v+=` A 1,1 0 0 1 ${m.x},${m.y} `,v+=" Z",v}generateArrowPath(t,e){let{upperArcStart:i,upperArcEnd:s,innerArcStart:r,innerArcEnd:n,bigRadius:o,smallRadius:a,largeArcFlagUpper:l,largeArcFlagInner:c,radius:h}=t,u=this.arcPoint(h,t.upperAngleEnd,0,24/e/2),d=this.arcPoint(h,t.upperAngleStart,0,24/e/2),f=`M ${i.x},${i.y} A ${o},${o} 0 ${l} 1 ${s.x},${s.y}`;return f+=`L ${u.x} ${u.y}`,f+=`L ${n.x} ${n.y}`,f+=`A ${a},${a} 0 ${c} 0 ${r.x}, ${r.y}`,f+=`L ${d.x} ${d.y}`,f+="Z",f}generateSlashPath(t,e,i){let{upperAngleStart:s,upperAngleEnd:r,innerAngleStart:n,innerAngleEnd:o,bigRadius:a,smallRadius:l,largeArcFlagUpper:c,largeArcFlagInner:h}=t,u=this.arcPoint(a,s,0,e==="backslash"?0:24/i/2),d=this.arcPoint(a,r,0,e==="backslash"?0:24/i/2),f=this.arcPoint(l,n,0,e==="backslash"?24/i/2:0),m=this.arcPoint(l,o,0,e==="backslash"?24/i/2:0),g=`M ${u.x},${u.y} A ${a},${a} 0 ${c} 1 ${d.x},${d.y}`;return g+=`L ${m.x} ${m.y}`,g+=`A ${l},${l} 0 ${h} 0 ${f.x}, ${f.y}`,g+="Z",g}generateZigzagPath(t,e,i){let{upperArcStart:s,upperArcEnd:r,innerArcStart:n,innerArcEnd:o,bigRadius:a,smallRadius:l,largeArcFlagUpper:c,largeArcFlagInner:h,radius:u}=t,d=e/i/2,f=this.arcPoint(u,t.upperAngleStart,-d,3),m=this.arcPoint(u,t.upperAngleStart,0,0),g=this.arcPoint(u,t.upperAngleStart,d,3),p=this.arcPoint(u,t.innerAngleEnd,d,3),b=this.arcPoint(u,t.innerAngleEnd,0,0),v=this.arcPoint(u,t.innerAngleEnd,-d,3),y=`M ${s.x},${s.y} A ${a},${a} 0 ${c} 1 ${r.x},${r.y}`;return y+=`L ${p.x} ${p.y}`,y+=`L ${b.x} ${b.y}`,y+=`L ${v.x} ${v.y}`,y+=`L ${o.x} ${o.y}`,y+=`A ${l},${l} 0 ${h} 0 ${n.x}, ${n.y}`,y+=`L ${f.x} ${f.y}`,y+=`L ${m.x} ${m.y}`,y+=`L ${g.x} ${g.y}`,y+="Z",y}generateDefaultPath(t){let{upperArcStart:e,upperArcEnd:i,innerArcStart:s,innerArcEnd:r,bigRadius:n,smallRadius:o,largeArcFlagUpper:a,largeArcFlagInner:l}=t,c=`M ${e.x},${e.y} A ${n},${n} 0 ${a} 1 ${i.x},${i.y}`;return c+=`L ${r.x} ${r.y}`,c+=`A ${o},${o} 0 ${l} 0 ${s.x}, ${s.y}`,c+="Z",c}},Ii=class extends Fe{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.innerHTML=`
      <style>
        :host {
          --o-fill: var(--o-gray-light);
          --o-stroke: var(--o-fill);
          --o-stroke-width: 1;
          --o-back-fill: transparent;
          --o-back-stroke: none;
          --o-back-stroke-width: 1;
        }
        :host(:hover) {
          --o-fill: var(--o-gray-light);
          --o-stroke: var(--o-fill);
          --o-stroke-width: 1;
          --o-back-fill: transparent;
          --o-back-stroke: none;
          --o-back-stroke-width: 1;
        }
        svg {
          width: 100%;
          height: 100%;
          overflow: visible;
          pointer-events: none;
        }
        /* Display element by default: never steals clicks (see orbit-arc).
           Interaction is opt-in via the "interactive" attribute. */
        svg * {
          pointer-events: none;
        }
        :host([interactive]) svg * {
          pointer-events: visiblePainted;
        }
        :host([interactive]) {
          cursor: pointer;
        }
        .progress-bar {
          fill: var(--o-fill);
          stroke: var(--o-stroke);
          stroke-width: var(--o-stroke-width);
          transition: fill 0.25s, stroke 0.25s;
          stroke-linejoin: round;
        }
        .progress-bg {
          fill: var(--o-back-fill);
          stroke: var(--o-back-stroke);
          stroke-width: var(--o-back-stroke-width);
        }
        /* variant="stroke": the thin, legible gauge (registro "medidor").
           The default band is a FILLED donut wedge, so everyone building a
           thin gauge tripped on --o-fill/--o-back-fill. With this variant the
           paths are open arcs and the data color lives where you expect it:
           --o-stroke for the bar, --o-back-stroke for the track. */
        :host([variant="stroke"]) .progress-bar {
          fill: none;
          stroke: var(--o-stroke);
          stroke-width: var(--o-stroke-width, 2);
          stroke-linecap: round;
        }
        :host([variant="stroke"]) .progress-bg {
          fill: none;
          stroke: var(--o-back-stroke, var(--o-gray-light));
          stroke-width: var(--o-back-stroke-width, 1);
          stroke-linecap: round;
        }
      </style>
      <svg viewBox="0 0 100 100">
        <path class="progress-bg" shape-rendering="geometricPrecision" vector-effect="non-scaling-stroke"></path>
        <path class="progress-bar" shape-rendering="geometricPrecision" vector-effect="non-scaling-stroke"></path>
      </svg>
    `}update(){let t=this.getAttributes(),e=this.getAttribute("variant")==="stroke",i=e?this.calculateStrokeArc(t,!0):this.calculateArcParameters(t,!0),s=e?this.calculateStrokeArc(t,!1):this.calculateArcParameters(t,!1);this.shadowRoot.querySelector(".progress-bg").setAttribute("d",i),this.shadowRoot.querySelector(".progress-bar").setAttribute("d",s)}calculateStrokeArc(t,e){let{realRadius:i}=t,s=Math.max(0,Math.min(this.getProgressAngle(t,e),359.999999));if(!(s>0)||!(t.orbitRadius>0))return"";let r=-90*(Math.PI/180),n=(-90+s)*(Math.PI/180),o=50+i*Math.cos(r),a=50+i*Math.sin(r),l=50+i*Math.cos(n),c=50+i*Math.sin(n),h=s>180?1:0;return`M ${o},${a} A ${i},${i} 0 ${h} 1 ${l},${c}`}getAttributes(){let t=super.getCommonAttributes(this),e=Math.max(0,Math.min(360,this.readAngle(t.style,"--o-range",360))),s=t.style.getPropertyValue("--o-progress").trim()?this.readNumber(t.style,"--o-progress",0):Number(this.getAttribute("value")||0),r=this.getAttribute("max"),n=r===null?100:Number(r);return{...t,range:e,progress:s,maxValue:n}}getProgressAngle(t,e){let{range:i,progress:s,maxValue:r}=t;return e?i:super.getProgressAngle(i,s,r)}calculateArcParameters(t,e){let{shape:i,realRadius:s,arcHeightPercentage:r,orbitNumber:n,strokeWidth:o,arcHeight:a}=t,l=this.getProgressAngle(t,e);if(!(l>0)||!(t.orbitRadius>0))return"";let c=super.calculateCommonArcParameters(l,s,r,n,i,o,a);return super.generatePathData(i,c,a,n)}},ae=typeof document>"u"?null:document.createElement("template");ae&&(ae.innerHTML=`
  <style>
    :host {
      --o-fill: var(--o-gray-light);
      --o-stroke: var(--o-fill);
      --o-stroke-width: 1;
      --o-color: currentcolor;
    }
    :host(:hover) {
      --o-fill: var(--o-gray-light);
      --o-stroke: var(--o-fill);
      --o-stroke-width: 1;
      --o-color: currentcolor;
    }
    svg {
      width: 100%;
      height: 100%;
      overflow: visible;
      pointer-events: none;
    }
    /* Arcs are display elements by default: they must NOT steal clicks from
       satellites/controls nearby (a painted arc used to capture clicks even
       at opacity 0, and pointer-events:none on the host could not pierce the
       shadow). Interaction is opt-in via the "interactive" attribute. */
    svg * {
      pointer-events: none;
    }
    :host([interactive]) svg * {
      pointer-events: visiblePainted;
    }
    :host([interactive]) {
      cursor: pointer;
    }
    #orbitShape {
      fill: var(--o-fill);
      stroke: var(--o-stroke);
      stroke-width: var(--o-stroke-width);
      transition: fill 0.25s, stroke 0.25s;
    }
    text {
      fill: var(--o-color);
    }
    #orbitPath {
      fill: transparent;
      stroke: none;
      stroke-width: 0;
    }
  </style>
  <svg viewBox="0 0 100 100">
    <path id="orbitShape" shape-rendering="geometricPrecision" vector-effect="non-scaling-stroke"></path>
    <path id="orbitPath" shape-rendering="geometricPrecision" vector-effect="non-scaling-stroke"></path>
    <text>
      <textPath href="#orbitPath" alignment-baseline="middle"></textPath>
    </text>
  </svg>
`);var Di=class extends Fe{constructor(){super(),this.attachShadow({mode:"open"}),this.shadowRoot.appendChild(ae.content.cloneNode(!0))}update(){let t=this.getAttributes(),{length:e,fontSize:i,textAnchor:s,fitRange:r}=t;this.hasAttribute("value")?(ot(this,"--o-arc-start",`${t.stackOffset}deg`),ot(this,"--o_stack",t.stackOffset+t.arcAngle)):(this.style.removeProperty("--o-arc-start"),this.style.removeProperty("--o_stack"));let n=this.shadowRoot.querySelector("#orbitPath"),o=this.shadowRoot.querySelector("#orbitShape"),a=this.shadowRoot.querySelector("textPath");o.setAttribute("d",this.calculateArcParameters(t).dShape),n.setAttribute("d",this.calculateTextArcParameters(t).dPath),s==="start"?(a.setAttribute("startOffset","0%"),a.setAttribute("text-anchor","start")):s==="middle"?(a.setAttribute("startOffset","50%"),a.setAttribute("text-anchor","middle")):s==="end"&&(a.setAttribute("startOffset","100%"),a.setAttribute("text-anchor","end")),r?a.parentElement.setAttribute("textLength",n.getTotalLength()):a.parentElement.removeAttribute("textLength"),a.parentElement.style.fontSize=`calc(${i} * (100 / (${e}) * (12 / var(--o-orbit-number)))`,a.textContent=this.textContent,this.warnIfTextOverflows(n,a,r)}warnIfTextOverflows(t,e,i){let s=(this.textContent||"").trim();!s||i||!this.isConnected||(this._textFrame&&this.ownerDocument.defaultView.cancelAnimationFrame(this._textFrame),this._textFrame=this.ownerDocument.defaultView.requestAnimationFrame(()=>{if(this._textFrame=0,!!this.isConnected)try{let r=t.getTotalLength(),n=e.parentElement.getComputedTextLength();r>0&&n>r&&this._truncWarned!==s&&(this._truncWarned=s,console.warn(`[orbit] <o-arc> text "${s.length>34?s.slice(0,34)+"\u2026":s}" overflows its arc (${Math.round(n)} > ${Math.round(r)} units) and will clip. Shorten the text, widen --o-range, or use fit-range to squeeze it.`))}catch{}}))}getAttributes(){let t=super.getCommonAttributes(this),{style:e}=t,i=Math.max(0,Math.min(360,this.readAngle(e,"--o-range",360))),s=this.hasAttribute("flip")||this.classList.contains("flip"),r=this.hasAttribute("fit-range")||this.classList.contains("fit-range"),n=t.orbitRadius*24/t.orbitNumber||100,o=this.getAttribute("text-anchor")||"middle",a=e.fontSize||"16px",l=Math.max(0,this.readNumber(e,"--o-gap",1)),c=Number(this.getAttribute("value")),h=this.getAttribute("max"),u=h===null?100:Number(h),d=this.hasAttribute("value")?super.getProgressAngle(i,c,u):Math.max(0,Math.min(360,this.readAngle(e,"--o-angle",0))),f=0;if(this.hasAttribute("value"))for(let m=this.previousElementSibling;m;m=m.previousElementSibling){if(m.localName!=="o-arc")continue;let g=this.ownerDocument.defaultView.getComputedStyle(m);if(m.hasAttribute("value")){let p=m.hasAttribute("max")?Number(m.getAttribute("max")):100,b=Lt(m,g.getPropertyValue("--o-range"),i,"angle");f+=super.getProgressAngle(b,Number(m.getAttribute("value")),p)}else f+=Lt(m,g.getPropertyValue("--o-angle"),0,"angle")}return{...t,gap:l,arcAngle:d,stackOffset:f,flip:s,fitRange:r,length:n,fontSize:a,textAnchor:o}}calculateArcParameters(t){let{arcAngle:e,realRadius:i,arcHeightPercentage:s,orbitNumber:r,shape:n,strokeWidth:o,arcHeight:a,gap:l}=t;if(!(e>0)||!(t.orbitRadius>0))return{dShape:""};let c=super.calculateCommonArcParameters(e,i,s,r,n,o,a,l);return{dShape:super.generatePathData(n,c,a,r)}}calculateTextArcParameters(t){let{arcAngle:e,realRadius:i,gap:s,flip:r}=t;if(!(e>0))return{dPath:""};let n=Math.min(s*.5,e*.49),o=r?0:1,a=e<=180?0:1,l=50+i*Math.cos((-90+n)*(Math.PI/180)),c=50+i*Math.sin((-90+n)*(Math.PI/180)),h=50+i*Math.cos((e-90-n)*Math.PI/180),u=50+i*Math.sin((e-90-n)*Math.PI/180),[d,f,m,g]=r?[h,u,l,c]:[l,c,h,u];return{dPath:`M ${d},${f} A ${i},${i} 0 ${a} ${o} ${m},${g}`}}calcularExpresionCSS(t){return Lt(this,t,0,"angle")}},Dt=new WeakMap,lt={refresh:qe,resize(t){var e,i;let s=typeof t=="string"?(e=globalThis.document)==null?void 0:e.querySelector(t):t;if(!s?.ownerDocument)return console.error("Orbit.resize: element not found:",t),()=>{};(i=Dt.get(s))==null||i();let r=s.ownerDocument.defaultView,n=l=>{if(l>0){for(let c of s.querySelectorAll(".gravity-spot")){let h=String(l/500);c.style.getPropertyValue("--o-force-ratio")!==h&&c.style.setProperty("--o-force-ratio",h)}qe(s)}},o=new r.ResizeObserver(l=>{for(let c of l)n(c.contentRect.width)});o.observe(s),n(s.clientWidth||s.getBoundingClientRect().width);let a=()=>{o.disconnect(),Dt.get(s)===a&&Dt.delete(s)};return Dt.set(s,a),a}};function de(){typeof customElements>"u"||typeof document>"u"||(customElements.get("o-progress")||customElements.define("o-progress",Ii),customElements.get("o-arc")||customElements.define("o-arc",Di),Ze(document),window.Orbit=lt)}de();var ht=Symbol.for("zumly.viewLifecycles");function Be(t){try{let e=t();e&&typeof e.then=="function"&&e.catch(i=>console.error("Zumly: view cleanup failed:",i))}catch(e){console.error("Zumly: view cleanup failed:",e)}}function Ri(){let t=!1,e=[],i={onCleanup(s){if(typeof s!="function")throw new TypeError("Zumly: onCleanup expects a function");t?Be(s):e.push(s)},attach(s){let r=s[ht];r||(r=new Set,Object.defineProperty(s,ht,{value:r,configurable:!0})),r.add(i)},dispose(){if(!t){t=!0;for(let s of e.splice(0).reverse())Be(s)}}};return i}function I(t){if(!t)return;let e=[];t[ht]&&e.push(t);let i=(t.ownerDocument||t).createTreeWalker(t,1),s;for(;s=i.nextNode();)s[ht]&&e.push(s);for(let r=e.length-1;r>=0;r--){let n=e[r],o=n[ht];if(o){for(let a of o)a.dispose();delete n[ht]}}}var Zi=1e4,Fi=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){let i=new Set;for(;typeof t=="string"&&Object.prototype.hasOwnProperty.call(this.#t,t);){if(i.has(t))throw new Error(`Zumly: circular view alias "${t}"`);i.add(t),t=this.#t[t]}let s=this.#e(t);switch(s){case"html":{let r=document.createElement("div");r.innerHTML=t.trim();let n=r.firstElementChild;if(!n)throw new Error("Zumly: view produced no element (html)");return n}case"url":{let r=new AbortController,n=setTimeout(()=>r.abort(),Zi),o;try{let c=await fetch(t,{signal:r.signal});if(!c.ok)throw new Error(`Zumly: fetch failed for "${t}" (${c.status})`);o=await c.text()}finally{clearTimeout(n)}let a=document.createElement("div");a.innerHTML=o.trim();let l=a.firstElementChild;if(!l)throw new Error("Zumly: view produced no element (url)");return l}case"function":case"object":{let r=Ri(),n=e?.target||document.createElement("div");r.attach(n);let o={...e,target:n,props:e?.props||{},context:e?.context||new Map,onCleanup:r.onCleanup};try{let a=await(s==="function"?t(o):t.render(o)),l;if(typeof a=="string")l=await this.resolve(a,o);else if(a instanceof HTMLElement)l=a;else if(s==="function")l=n,n.classList.length||(n.style.width||(n.style.width="100%"),n.style.height||(n.style.height="100%"));else throw new Error("Zumly: view render() must return a string or HTMLElement");return r.attach(l),l}catch(a){throw r.dispose(),a}}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 Rt(t,e,i,s,r,n){if(!t||!t.classList){let o=document.createElement("div");o.classList.add("z-view"),t&&o.appendChild(t),t=o}else t.classList.contains("z-view")||t.classList.add("z-view");t.dataset.viewName=e,t.getAttribute("aria-label")||t.setAttribute("aria-label",`View: ${e}`),t.style.transformOrigin="0 0",t.style.position="absolute",s?t.classList.add("is-current-view"):t.classList.add("is-new-current-view","has-no-events","hide"),i.append(t);try{r[e]&&typeof r[e]=="object"&&typeof r[e].mounted=="function"&&await r[e].mounted()}catch(o){throw I(t),t.remove(),o}return t}function R(t,e,i){e&&i==="welcome"&&console.info(`%c Zumly %c ${e}`,"background: #424085; color: white; border-radius: 3px;","color: #424085"),e&&t&&(i==="info"||i===void 0)&&console.info(`%c Zumly %c ${e}`,"background: #6679A3; color: #304157; border-radius: 3px;","color: #6679A3"),e&&i==="warn"&&console.warn(`%c Zumly %c ${e}`,"background: #DCBF53; color: #424085; border-radius: 3px;","color: #424085"),e&&i==="error"&&console.error(`%c Zumly %c ${e}`,"background: #BE4747; color: white; border-radius: 3px;","color: #424085")}function Bi(t,e){if(e.isValid=!1,!t||typeof t!="object"){R(!1,"'options' object has to be provided when instance is defined","error");return}if(typeof t.mount!="string"){R(!1,"'mount' must be a string selector","error");return}if(e.mount=t.mount,typeof t.initialView!="string"){R(!1,"'initialView' must be a string","error");return}if(e.initialView=t.initialView,!t.views||typeof t.views!="object"){R(!1,"'views' must be an object","error");return}e.views=t.views,e.isValid=!0,e.preload=Array.isArray(t.preload)?t.preload:[],e.debug=typeof t.debug=="boolean"?t.debug:!1,e.componentContext=t.componentContext&&typeof t.componentContext=="object"?t.componentContext:new Map;let i=t.transitions&&typeof t.transitions=="object"?t.transitions:null,s=i&&i.cover,r=typeof s=="string"?s.toLowerCase():null,n=r==="width"||r==="height";e.cover=n?r:"width",!n&&i&&s!==void 0&&R(!1,`'transitions.cover' must be either "width" or "height". Falling back to "width".`,"warn"),e.duration=i&&typeof i.duration=="string"?i.duration:"1s",e.ease=i&&typeof i.ease=="string"?i.ease:"ease-in-out",e.deferred=typeof t.deferred=="boolean"?t.deferred:!1;let o=i&&i.hideTrigger;o===!0||o==="fade"?e.hideTrigger=o:(e.hideTrigger=!1,o!=null&&o!==!1&&R(!1,`'transitions.hideTrigger' must be true or "fade". Falling back to false.`,"warn"));let a=i&&i.effects;Array.isArray(a)&&a.length>=2&&typeof a[0]=="string"&&typeof a[1]=="string"?e.effects=[a[0],a[1]]:Array.isArray(a)&&a.length===1&&typeof a[0]=="string"?e.effects=[a[0],a[0]]:(e.effects=["none","none"],a!=null&&R(!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=i&&i.driver,c=typeof l=="string"?l.toLowerCase():null,h=typeof l=="function"?l:null;if(c!==null){let p=["css","waapi","none","anime","gsap","motion"];e.transitionDriver=p.includes(c)?c:"css",p.includes(c)||R(!1,`'transitions.driver' must be "css", "waapi", "none", "anime", "gsap", "motion", or a function. Got "${l}". Falling back to "css".`,"warn")}else h!==null?e.transitionDriver=h:e.transitionDriver="css";let u=i&&i.stagger;typeof u=="number"&&u>0?e.stagger=u:(e.stagger=0,u!=null&&u!==0&&R(!1,"'transitions.stagger' must be a positive number (ms). Falling back to 0 (disabled).","warn")),e.parallax=0;let d=t.lateralNav;if(d===!1)e.lateralNav=!1;else if(d&&typeof d=="object"){let p=typeof d.mode=="string"?d.mode.toLowerCase():null,b=p==="auto"||p==="always";p&&!b&&R(!1,`'lateralNav.mode' must be "auto" or "always". Falling back to "auto".`,"warn");let v=null;if(Array.isArray(d.siblings))v=d.siblings.filter(y=>typeof y=="string"&&y),v.length<2&&(R(!1,"'lateralNav.siblings' needs at least 2 view names. Ignoring.","warn"),v=null);else if(d.siblings&&typeof d.siblings=="object"){v={};for(let[y,_]of Object.entries(d.siblings))if(Array.isArray(_)){let z=_.filter(x=>typeof x=="string"&&x);z.length>=2&&(v[y]=z)}Object.keys(v).length===0&&(v=null)}else d.siblings!==void 0&&R(!1,"'lateralNav.siblings' must be an array of view names or a { parentView: [...] } map. Ignoring.","warn");e.lateralNav={mode:b?p:"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:v}}else e.lateralNav={mode:"auto",arrows:!0,dots:!0,keepAlive:!1,siblings:null};let f=t.depthNav;if(f===!1)e.depthNav=!1;else if(f&&typeof f=="object"){let p=typeof f.position=="string"?f.position.toLowerCase():null,b=p==="bottom-left"||p==="top-left";p&&!b&&R(!1,`'depthNav.position' must be "bottom-left" or "top-left". Falling back to "bottom-left".`,"warn"),e.depthNav={position:b?p:"bottom-left"}}else e.depthNav={position:"bottom-left"};let m=t.lateralNav&&typeof t.lateralNav=="object"?t.lateralNav.position:void 0;if(e.lateralNav&&typeof e.lateralNav=="object"){let p=m==="bottom-center"||m==="top-center";m&&!p&&R(!1,`'lateralNav.position' must be "bottom-center" or "top-center". Falling back to "bottom-center".`,"warn"),e.lateralNav.position=p?m:"bottom-center"}let g=t.inputs;g===!1?e.inputs={wheel:!1,keyboard:!1,click:!1,touch:!1}:g&&typeof g=="object"?e.inputs={wheel:typeof g.wheel=="boolean"?g.wheel:!0,keyboard:typeof g.keyboard=="boolean"?g.keyboard:!0,click:typeof g.click=="boolean"?g.click:!0,touch:typeof g.touch=="boolean"?g.touch:!0}:e.inputs={wheel:!0,keyboard:!0,click:!0,touch:!0}}function fe(t,e,i,s,r){let n=i/t,o=s/e;return r==="height"?{scale:o,scaleInv:1/o}:{scale:n,scaleInv:1/n}}function He(t,e,i,s){let r=e.left,n=e.top,o=t.x-r+(t.width-i.width*s)/2,a=t.y-n+(t.height-i.height*s)/2;return`translate(${o}px, ${a}px) scale(${s})`}function Hi(t,e,i){let s=e.left,r=e.top,n=t.x-s+(t.width-i.width)/2,o=t.y-r+(t.height-i.height)/2;return`translate(${n}px, ${o}px)`}function ji(t,e){let i=t.x+t.width/2-e.x,s=t.y+t.height/2-e.y;return`${i}px ${s}px`}function Wi(t,e,i,s,r=0){let n=t.width/2-e.width/2-e.x+i.x,o=t.height/2-e.height/2-e.y+i.y,a=1-r,l=n*a,c=o*a;return{x:n,y:o,transform:`translate(${l}px, ${c}px) scale(${s})`}}function Ki({canvasRect:t,canvasOffset:e,triggerRect:i,previousViewRectAtBaseTransform:s,lastViewZoomedElementRect:r,previousViewRectWithPreviousAtEndTransform:n,scale:o,preScale:a,parallax:l=0}){let c=e.left,h=e.top,u=t.width/2-i.width/2-i.x,d=t.height/2-i.height/2-i.y,f=u+(s.x-r.x)+n.x-c+(n.width-r.width)/2,m=d+(s.y-r.y)+n.y-h+(n.height-r.height)/2,g=1-Math.min(l*2,.9);return`translate(${f*g}px, ${m*g}px) scale(${o*a})`}function Ui(t,e,i,s,r){return`translate(${t-i.left}px, ${e-i.top}px) scale(${s*r})`}function $t(t){let e=t.split(/\s+/);return{x:parseFloat(e[0])||0,y:parseFloat(e[1])||0}}function Tt(t){let e=typeof t=="string"?t:"",i=e.match(/translate\s*\(\s*([-+\d.eE]+)px\s*,\s*([-+\d.eE]+)px\s*\)/);if(!i)return{tx:0,ty:0,rest:e.trim(),matched:!1};let s=e.replace(/translate\s*\([^)]+\)\s*/,"").trim();return{tx:parseFloat(i[1]),ty:parseFloat(i[2]),rest:s,matched:!0}}function et(t){let e=Tt(t),i=t.match(/scale\s*\(\s*([-+\d.eE]+)\s*\)/);return{tx:e.matched?e.tx:0,ty:e.matched?e.ty:0,scale:i?parseFloat(i[1]):1}}function Zt(t,e,i,s,r,n,o,a,l,c){let h=e.x-i.x*(1-n)-s,u=e.y-i.y*(1-n)-r,d=e.width/n,f=e.height/n,m=h+i.x+(t.x-h-i.x-s)/n,g=u+i.y+(t.y-u-i.y-r)/n,p=t.width/n,b=t.height/n,v=h+o.x+a+c*(m-h-o.x),y=u+o.y+l+c*(g-u-o.y),_=p*c,z=b*c;return{x:v,y,width:_,height:z,left:v,top:y,right:v+_,bottom:y+z}}function Ft(t,e,i){return{viewName:t,backwardState:e,forwardState:i}}function Yi(t){return{detachedNode:t}}function Xi(t,e,i,s,r){let n=[];return e!==null&&n.push(e),i!==null&&n.push(i),s!==null&&n.push(s),r!==null&&n.push(r),{zoomLevel:t,views:n}}function je(t){let e=t.views?.[3];if(!(!e||!(e.detachedNode instanceof Node)))return e.detachedNode}var Gi=class{#t=new Map;#e;constructor({maxEntries:t=64}={}){this.#e=Number.isInteger(t)&&t>=0?t:64}set(t,e,i=null){this.#e!==0&&this.adopt(t,e.cloneNode(!0),i)}adopt(t,e,i=null){let s=Date.now();for(let[r,n]of this.#t)n.expires!==null&&s>=n.expires&&this.#t.delete(r);if(this.#e!==0)for(this.#t.delete(t),this.#t.set(t,{node:e,expires:i===null?null:s+i});this.#t.size>this.#e;)this.#t.delete(this.#t.keys().next().value)}get(t){let e=this.#t.get(t);return e?e.expires!==null&&Date.now()>=e.expires?(this.#t.delete(t),null):(this.#t.delete(t),this.#t.set(t,e),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()}},Qi="button, input, select, textarea, a[href], summary";function ve(t){return t?.matches?.(Qi)||!1}function We(t){return!!t?.closest?.('input, textarea, select, [contenteditable]:not([contenteditable="false"]), [role="textbox"], [role="combobox"], [role="slider"], [role="spinbutton"]')}function Ji(t){let e=t.querySelectorAll(".zoom-me[data-to]");return e.forEach(i=>{ve(i)||(i.hasAttribute("role")||i.setAttribute("role","button"),i.hasAttribute("tabindex")||i.setAttribute("tabindex","0")),!i.hasAttribute("aria-label")&&!i.hasAttribute("aria-labelledby")&&!i.textContent.trim()&&i.setAttribute("aria-label",`Zoom to ${i.dataset.to}`)}),e}var ts=class{constructor(){this.backgrounds=new Map}sync(t){for(let e of t.children)e.classList.contains("z-view")&&(e.classList.contains("is-current-view")?this.restore(e):(this.backgrounds.has(e)||this.backgrounds.set(e,{inert:e.inert,hidden:e.getAttribute("aria-hidden")}),e.inert=!0,e.setAttribute("aria-hidden","true")));for(let e of this.backgrounds.keys())t.contains(e)||this.restore(e)}restore(t){let e=this.backgrounds.get(t);e&&(t.inert=e.inert,e.hidden===null?t.removeAttribute("aria-hidden"):t.setAttribute("aria-hidden",e.hidden),this.backgrounds.delete(t))}destroy(){for(let t of this.backgrounds.keys())this.restore(t)}},es=300*1e3,Ke=/^https?:\/\/|^\/|\.(?:html|php)(?:[?#].*)?$/i,is=class{#t;#e;#l;#n=new Map;#i=new Map;#s=null;#c=0;#f;#h;#r=!1;#a=!1;constructor(t={},{maxCacheEntries:e=64,prefetchConcurrency:i=2,maxPendingPrefetch:s=32}={}){this.#l=t,this.#t=new Fi(t),this.#e=new Gi({maxEntries:e}),this.#f=Number.isInteger(i)&&i>0?i:2,this.#h=Number.isInteger(s)&&s>=0?s:32}#u(t){let e=new Set;for(;typeof t=="string"&&Object.prototype.hasOwnProperty.call(this.#l,t);){if(e.has(t))return null;e.add(t),t=this.#l[t]}return typeof t=="string"&&(t.includes("<")||Ke.test(t))?t:null}#g(t){return Ke.test(t)?es:null}async get(t,e=null){if(this.#r)throw new Error("Zumly: view prefetcher has been destroyed");this.#i.delete(t);let i=this.#u(t);return i!==null?this.#e.get(t)||(await this.#m(t,i,e)).cloneNode(!0):this.#t.resolve(t,e)}#m(t,e,i){if(this.#n.has(t))return this.#n.get(t);let s=(async()=>{try{let r=await this.#t.resolve(t,i);return this.#r||this.#e.adopt(t,r,this.#g(e)),r}finally{this.#n.delete(t)}})();return this.#n.set(t,s),s}async#d(t,e){if(this.#r)return;this.#i.delete(t);let i=this.#u(t);i===null||this.#e.has(t)||await this.#m(t,i,e)}async preloadEager(t,e=null){!Array.isArray(t)||t.length===0||await Promise.all([...new Set(t)].map(i=>this.#d(i,e)))}prefetch(t,e=null){if(this.#a){this.#p(t,e);return}this.#d(t,e).catch(()=>{})}prefetchOnHover(t,e=null){this.prefetch(t,e)}scanAndPrefetch(t,e=null){if(this.#r||!t||!t.querySelectorAll)return;let i=Ji(t);this.#i.clear();let s=new Set;for(let r of i){let n=r.dataset.to;if(!(!n||s.has(n))){if(s.add(n),this.#i.size>=this.#h)break;this.#p(n,e)}}this.#o()}#p(t,e){this.#r||this.#i.size>=this.#h||this.#i.has(t)||this.#u(t)===null||this.#e.has(t)||this.#n.has(t)||this.#i.set(t,e)}#o(){this.#r||this.#a||this.#s!==null||this.#i.size===0||this.#c>=this.#f||(this.#s=setTimeout(()=>{if(this.#s=null,this.#r||this.#i.size===0)return;let[t,e]=this.#i.entries().next().value;this.#i.delete(t),this.#c++,this.#d(t,e).catch(()=>{}).finally(()=>{this.#c--,this.#o()}),this.#o()},0))}pause(){this.#a=!0,this.#s!==null&&clearTimeout(this.#s),this.#s=null}resume(){this.#a=!1,this.#o()}destroy(){this.#r=!0,this.#s!==null&&clearTimeout(this.#s),this.#s=null,this.#i.clear(),this.#e.clear()}},jt=Symbol.for("zumly.viewVisibility");function ti(t){t[jt]||Object.defineProperty(t,jt,{configurable:!0,value:{value:t.style.getPropertyValue("content-visibility"),priority:t.style.getPropertyPriority("content-visibility")}})}function me(t){t&&(ti(t),t.style.contentVisibility="hidden")}function be(t){t&&(ti(t),t.style.contentVisibility="visible")}function Bt(t){let e=t?.[jt];e&&(e.value?t.style.setProperty("content-visibility",e.value,e.priority):t.style.removeProperty("content-visibility"),delete t[jt])}function ut(t){if(typeof t=="number"&&!Number.isNaN(t))return Math.max(0,t);let e=String(t).trim(),i=e.match(/^(\d*\.?\d+)\s*(ms|s)?$/i);if(!i)return typeof console<"u"&&console.warn(`[zumly] Could not parse duration "${e}" \u2014 falling back to 500ms.`),500;let s=parseFloat(i[1]);return(i[2]||"s").toLowerCase()==="ms"?Math.max(0,s):Math.max(0,s*1e3)}function ei(t){return ut(t)/1e3}function M(t,e){if(t.classList.contains("is-new-current-view")){let i=e.views[0].forwardState;t.classList.replace("is-new-current-view","is-current-view"),t.classList.remove("zoom-current-view","has-no-events"),t.style.transformOrigin=i.origin,t.style.transform=i.transform;return}if(t.classList.contains("is-previous-view")){let i=e.views[1].forwardState;t.classList.remove("zoom-previous-view","has-no-events"),t.style.transformOrigin=i.origin,t.style.transform=i.transform;return}if(t.classList.contains("is-last-view")){let i=e.views[2].forwardState;t.classList.remove("zoom-last-view","has-no-events"),t.style.transformOrigin=i.origin,t.style.transform=i.transform}}function dt(t,e){t.classList.remove("zoom-previous-view-reverse","has-no-events","has-effect","has-effect-reverse"),t.style.removeProperty("--z-effect-filter"),t.style.transformOrigin="0 0",t.style.transform=e.transform}function ft(t,e){t.classList.remove("zoom-last-view-reverse","has-no-events","has-effect","has-effect-reverse"),t.style.removeProperty("--z-effect-filter"),t.style.transformOrigin=e.origin,t.style.transform=e.transform}function Y(t,e){I(t);try{e&&e.removeChild(t)}catch{try{t?.parentElement&&e&&(I(t.parentElement),e.removeChild(t.parentElement))}catch{}}}function K(...t){for(let e of t)e&&(e.classList.remove("hide"),be(e))}function Wt(t,e){let{currentView:i,previousView:s,backView:r,backViewState:n,lastView:o,lastViewState:a,incomingTransformEnd:l,currentStage:c,canvas:h}=t,u=c.views[0];K(i),i.classList.replace("is-new-current-view","is-current-view"),i.classList.remove("zoom-current-view","has-no-events"),i.style.transformOrigin=u.forwardState.origin,i.style.transform=l||u.forwardState.transform,r&&n&&(r.style.transform=n.transformEnd),o&&a&&(o.style.transform=a.transformEnd),t.keepAlive||Y(s,h),e()}var mt=150;function pt(t,e){let i=!1,s=setTimeout(()=>{i||(i=!0,t())},e);return{finish(){i||(i=!0,clearTimeout(s),t())},extend(r){i||(clearTimeout(s),s=setTimeout(()=>{i||(i=!0,t())},r))},safetyTimer:s}}function ye(){return{a:1,b:0,c:0,d:1,e:0,f:0}}function ss(t){if(!t||t==="none")return ye();let e=String(t).match(/matrix\(([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+),\s*([-\d.eE]+)\)/);return e?{a:parseFloat(e[1]),b:parseFloat(e[2])||0,c:parseFloat(e[3])||0,d:parseFloat(e[4]),e:parseFloat(e[5])||0,f:parseFloat(e[6])||0}:ye()}function Kt(t){return`matrix(${t.a}, ${t.b}, ${t.c}, ${t.d}, ${t.e}, ${t.f})`}function ct(t,e,i){return t+(e-t)*i}function Ut(t,e,i){let s=Math.max(0,Math.min(1,i));return{a:ct(t.a,e.a,s),b:ct(t.b,e.b,s),c:ct(t.c,e.c,s),d:ct(t.d,e.d,s),e:ct(t.e,e.e,s),f:ct(t.f,e.f,s)}}function rs(t,e,i){t.style.transformOrigin=e,t.style.transform=i;try{t.getBoundingClientRect()}catch{}return ss(getComputedStyle(t).transform)}function ns(t,e){let{type:i,currentView:s,previousView:r,lastView:n,currentStage:o,duration:a,ease:l,canvas:c}=t;if(!s||!r||!o){e();return}i==="lateral"?as(t,e):i==="zoomIn"?os(s,r,n,o,a,l,e):i==="zoomOut"?ls(s,r,n,o,a,l,c,e):e()}function as(t,e){let{currentView:i,previousView:s,backView:r,backViewState:n,lastView:o,lastViewState:a,incomingTransformStart:l,incomingTransformEnd:c,outgoingTransform:h,outgoingTransformEnd:u,currentStage:d,duration:f,ease:m,canvas:g}=t,p=ut(f),b=d.views[0];K(i),i.classList.replace("is-new-current-view","is-current-view"),i.classList.remove("zoom-current-view","has-no-events"),i.style.transformOrigin=b.forwardState.origin,r&&n&&(W(r,f,m,{"--lateral-from":n.transformStart,"--lateral-to":n.transformEnd}),r.classList.add("zoom-lateral-back")),o&&a&&(W(o,f,m,{"--lateral-from":a.transformStart,"--lateral-to":a.transformEnd}),o.classList.add("zoom-lateral-back")),t.keepAlive!=="visible"&&(W(s,f,m,{"--lateral-out-from":h,"--lateral-out-to":u}),s.classList.add("zoom-lateral-out")),W(i,f,m,{"--lateral-in-from":l,"--lateral-in-to":c}),i.classList.add("zoom-lateral-in");let v=t.keepAlive==="visible"?[i]:[s,i];r&&n&&v.push(r),o&&a&&v.push(o);let y=v.length,_=p+mt,z=new Set(["zoom-lateral-in","zoom-lateral-out","zoom-lateral-back"]),{finish:x,extend:E}=pt(()=>{we(v,S,w),t.keepAlive?(s.classList.remove("zoom-lateral-out"),s.style.opacity=""):Y(s,g),r&&(r.classList.remove("zoom-lateral-back"),r.style.transform=n?.transformEnd||r.style.transform),o&&(o.classList.remove("zoom-lateral-back"),o.style.transform=a?.transformEnd||o.style.transform),i.classList.remove("zoom-lateral-in"),i.style.transform=c,e()},_);function w(k){k.target!==k.currentTarget||!z.has(k.animationName)||E(_)}function S(k){if(k.target!==k.currentTarget||!z.has(k.animationName))return;let $=k.currentTarget;$.removeEventListener("animationend",S),$.removeEventListener("animationstart",w),y--,y<=0&&x()}v.forEach(k=>{k.addEventListener("animationstart",w),k.addEventListener("animationend",S)})}function os(t,e,i,s,r,n,o){K(t,e,i);let a=s.stagger||0;W(t,r,n,{"--current-view-transform-start":s.views[0].backwardState.transform,"--current-view-transform-end":s.views[0].forwardState.transform}),a>0&&t.style.setProperty("animation-delay","0ms"),W(e,r,n,{"--previous-view-transform-start":s.views[1].backwardState.transform,"--previous-view-transform-end":s.views[1].forwardState.transform}),a>0&&e.style.setProperty("animation-delay",`${a}ms`),i&&(W(i,r,n,{"--last-view-transform-start":s.views[2].backwardState.transform,"--last-view-transform-end":s.views[2].forwardState.transform}),a>0&&i.style.setProperty("animation-delay",`${a*2}ms`)),t.classList.add("zoom-current-view"),e.classList.add("zoom-previous-view"),i&&i.classList.add("zoom-last-view");let l=i?[t,e,i]:[t,e],c=l.length,h=ut(r),u=i?a*2:a,d=h+u+mt,f=new Set(["zoom-current-view","zoom-previous-view","zoom-last-view"]),{finish:m,extend:g}=pt(()=>{we(l,b,p),l.forEach(v=>v.style.removeProperty("animation-delay")),l.forEach(v=>{if(v?.isConnected)try{M(v,s)}catch{}}),o()},d);function p(v){v.target!==v.currentTarget||!f.has(v.animationName)||g(d)}function b(v){if(v.target!==v.currentTarget||!f.has(v.animationName))return;let y=v.currentTarget;if(y.removeEventListener("animationend",b),y.removeEventListener("animationstart",p),y.isConnected)try{M(y,s)}catch{}c--,c<=0&&m()}l.forEach(v=>{v.addEventListener("animationstart",p),v.addEventListener("animationend",b)})}function ls(t,e,i,s,r,n,o,a){let l=s.views[0],c=s.views[1],h=i&&s.views[2]?s.views[2]:null,u=s.stagger||0;W(t,r,n,{"--current-view-transform-start":l.backwardState.transform,"--current-view-transform-end":l.forwardState.transform}),u>0&&t.style.setProperty("animation-delay","0ms"),W(e,r,n,{"--previous-view-transform-start":c.backwardState.transform,"--previous-view-transform-end":c.forwardState.transform}),u>0&&e.style.setProperty("animation-delay",`${u}ms`),i&&h&&(W(i,r,n,{"--last-view-transform-start":h.backwardState.transform,"--last-view-transform-end":h.forwardState.transform}),u>0&&i.style.setProperty("animation-delay",`${u*2}ms`)),t.classList.add("zoom-current-view-reverse"),e.classList.add("zoom-previous-view-reverse"),i&&i.classList.add("zoom-last-view-reverse");let d=i?[t,e,i]:[t,e],f=d.length,m=ut(r),g=i?u*2:u,p=m+g+mt,b=new Set(["zoom-current-view-reverse","zoom-previous-view-reverse","zoom-last-view-reverse"]),{finish:v,extend:y}=pt(()=>{we(d,z,_),d.forEach(x=>x.style.removeProperty("animation-delay")),d.forEach(x=>{if(x?.isConnected)try{Ue(x,s,o)}catch{}}),a()},p);function _(x){x.target!==x.currentTarget||!b.has(x.animationName)||y(p)}function z(x){if(x.target!==x.currentTarget||!b.has(x.animationName))return;let E=x.currentTarget;if(E.removeEventListener("animationend",z),E.removeEventListener("animationstart",_),E.isConnected)try{Ue(E,s,o)}catch{}f--,f<=0&&v()}d.forEach(x=>{x.addEventListener("animationstart",_),x.addEventListener("animationend",z)})}function Ue(t,e,i){if(t.classList.contains("zoom-current-view-reverse")){Y(t,i);return}if(t.classList.contains("zoom-previous-view-reverse")){dt(t,e.views[1].backwardState);return}t.classList.contains("zoom-last-view-reverse")&&ft(t,e.views[2].backwardState)}function W(t,e,i,s){t.style.setProperty("--zoom-duration",e),t.style.setProperty("--zoom-ease",i);for(let[r,n]of Object.entries(s))t.style.setProperty(r,n)}function we(t,e,i){for(let s of t)s?.removeEventListener&&(s.removeEventListener("animationend",e),s.removeEventListener("animationstart",i))}function cs(t,e){let{type:i,currentView:s,previousView:r,lastView:n,currentStage:o,canvas:a}=t;if(!s||!r||!o){e();return}if(i==="lateral"){Wt(t,e);return}if(i==="zoomIn"){K(s,r,n),M(s,o),M(r,o),n&&M(n,o),e();return}if(i==="zoomOut"){Y(s,a),K(r,n),dt(r,o.views[1].backwardState),n&&ft(n,o.views[2].backwardState),e();return}e()}function hs(t,e){let{type:i,currentView:s,previousView:r,lastView:n,currentStage:o,duration:a,ease:l,canvas:c}=t;if(!s||!r||!o){e();return}let h=ut(a);if(i==="lateral"){fs(t,h,l,e);return}if(i==="zoomIn"){us(s,r,n,o,h,l,e);return}if(i==="zoomOut"){ds(s,r,n,o,h,l,c,e);return}e()}function us(t,e,i,s,r,n,o){K(t,e,i);let a=s.views[0],l=s.views[1],c=i&&s.views[2]?s.views[2]:null;t.style.transformOrigin=a.backwardState.origin,t.style.transform=a.backwardState.transform,e.style.transformOrigin=l.backwardState.origin,e.style.transform=l.backwardState.transform,c&&(i.style.transformOrigin=c.backwardState.origin,i.style.transform=c.backwardState.transform);let h=s.stagger||0,u=[];u.push(t.animate([{transform:a.backwardState.transform},{transform:a.forwardState.transform}],{duration:r,easing:n,fill:"forwards"})),u.push(e.animate([{transform:l.backwardState.transform},{transform:l.forwardState.transform}],{duration:r,delay:h,easing:n,fill:"forwards"})),c&&u.push(i.animate([{transform:c.backwardState.transform},{transform:c.forwardState.transform}],{duration:r,delay:h*2,easing:n,fill:"forwards"}));let d=c?h*2:h,{finish:f}=pt(()=>{_e(u);try{M(t,s),M(e,s),i&&M(i,s)}catch{}o()},r+d+mt);Promise.all(u.map(m=>m.finished)).then(f).catch(f)}function ds(t,e,i,s,r,n,o,a){let l=s.views[0],c=s.views[1],h=i&&s.views[2]?s.views[2]:null,u=c.backwardState,d=h?h.backwardState:null;t.style.transformOrigin=l.forwardState.origin,t.style.transform=l.forwardState.transform,requestAnimationFrame(()=>{requestAnimationFrame(()=>{e.style.transformOrigin=c.forwardState.origin,i&&h&&(i.style.transformOrigin=h.forwardState.origin);let f=e.style.transform||getComputedStyle(e).transform||c.forwardState.transform,m=i&&h?i.style.transform||getComputedStyle(i).transform||h.forwardState.transform:null,g=s.stagger||0,p=[];p.push(t.animate([{transform:l.forwardState.transform},{transform:l.backwardState.transform}],{duration:r,easing:n,fill:"forwards"})),p.push(e.animate([{transform:f},{transform:u.transform}],{duration:r,delay:g,easing:n,fill:"both"})),i&&d&&p.push(i.animate([{transform:m},{transform:d.transform}],{duration:r,delay:g*2,easing:n,fill:"both"})),e.style.removeProperty("transform"),i&&i.style.removeProperty("transform");let b=i&&d?g*2:g,{finish:v}=pt(()=>{_e(p);try{Y(t,o),dt(e,u),i&&d&&ft(i,d)}catch{}a()},r+b+mt);Promise.all(p.map(y=>y.finished)).then(v).catch(v)})})}function fs(t,e,i,s){let{currentView:r,previousView:n,backView:o,backViewState:a,lastView:l,lastViewState:c,incomingTransformStart:h,incomingTransformEnd:u,outgoingTransform:d,outgoingTransformEnd:f,currentStage:m,canvas:g}=t,p=m.views[0];K(r),r.classList.replace("is-new-current-view","is-current-view"),r.classList.remove("zoom-current-view","has-no-events"),r.style.transformOrigin=p.forwardState.origin;let b=[];b.push(r.animate([{transform:h,opacity:0},{transform:u,opacity:1}],{duration:e,easing:i,fill:"forwards"})),t.keepAlive!=="visible"&&b.push(n.animate([{transform:d,opacity:1},{transform:f,opacity:0}],{duration:e,easing:i,fill:"forwards"})),o&&a&&b.push(o.animate([{transform:a.transformStart},{transform:a.transformEnd}],{duration:e,easing:i,fill:"forwards"})),l&&c&&b.push(l.animate([{transform:c.transformStart},{transform:c.transformEnd}],{duration:e,easing:i,fill:"forwards"}));let{finish:v}=pt(()=>{_e(b),r.style.transform=u||p.forwardState.transform,o&&a&&(o.style.transform=a.transformEnd),l&&c&&(l.style.transform=c.transformEnd),t.keepAlive?(n.style.opacity="",n.style.transform=f):Y(n,g),s()},e+mt);Promise.all(b.map(y=>y.finished)).then(v).catch(v)}function _e(t){for(let e of t)try{e.cancel()}catch{}}var ii="[-+]?(?:\\d*\\.\\d+|\\d+)(?:[eE][-+]?\\d+)?",Ye=`(${ii})(px)?`,ms=new RegExp(`^(?:translate\\(\\s*${Ye}\\s*,\\s*${Ye}\\s*\\)\\s*)?(?:scale\\(\\s*(${ii})\\s*\\))?$`);function ps(t){if(typeof t!="string")return null;let e=t.trim();if(e==="none")return ye();if(!e)return null;let i=e.match(ms);if(!i)return null;let s=Number(i[1]??0),r=Number(i[3]??0),n=Number(i[5]??1);return s!==0&&!i[2]||r!==0&&!i[4]||![s,r,n].every(Number.isFinite)?null:{a:n,b:0,c:0,d:n,e:s,f:r}}function it(t,e,i){let s=ps(i);return s?(t.style.transformOrigin=e,t.style.transform=i,s):rs(t,e,i)}function gs(t,e){let i=typeof globalThis<"u"&&globalThis.anime;if(!i||typeof i!="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>'),e();return}let{type:s,currentView:r,previousView:n,lastView:o,currentStage:a,duration:l,ease:c,canvas:h}=t;if(!r||!n||!a){e();return}let u=ut(l);s==="lateral"?Wt(t,e):s==="zoomIn"?vs(i,r,n,o,a,u,c,e):s==="zoomOut"?bs(i,r,n,o,a,u,c,h,e):e()}function vs(t,e,i,s,r,n,o,a){K(e,i,s);let l=r.views[0],c=r.views[1],h=s&&r.views[2]?r.views[2]:null,u=si([{el:e,backward:l.backwardState,forward:l.forwardState},{el:i,backward:c.backwardState,forward:c.forwardState},...h?[{el:s,backward:h.backwardState,forward:h.forwardState}]:[]],"forward");ri(u,0);let d=r.stagger||0,f=n+(h?d*2:d),m={value:0};t({targets:m,value:1,duration:f,easing:ai(o),update:()=>{let g=m.value*f;ni(u,g,n,d)},complete:()=>{M(e,r),M(i,r),s&&M(s,r),a()}})}function bs(t,e,i,s,r,n,o,a,l){let c=r.views[0],h=r.views[1],u=s&&r.views[2]?r.views[2]:null,d=h.backwardState,f=u?u.backwardState:null,m=si([{el:e,backward:c.backwardState,forward:c.forwardState},{el:i,backward:h.backwardState,forward:h.forwardState},...u?[{el:s,backward:u.backwardState,forward:u.forwardState}]:[]],"backward");ri(m,0);let g=r.stagger||0,p=n+(u?g*2:g),b={value:0};t({targets:b,value:1,duration:p,easing:ai(o),update:()=>{let v=b.value*p;ni(m,v,n,g)},complete:()=>{Y(e,a),dt(i,d),s&&f&&ft(s,f),l()}})}function si(t,e){return t.map(({el:i,backward:s,forward:r})=>{if(e==="forward"){let n=it(i,s.origin,s.transform),o=it(i,s.origin,r.transform);return{el:i,from:n,to:o}}else{let n=it(i,r.origin,r.transform),o=it(i,r.origin,s.transform);return{el:i,from:n,to:o}}})}function ri(t,e){for(let{el:i,from:s,to:r}of t)i.style.transform=Kt(Ut(s,r,e))}function ni(t,e,i,s){for(let r=0;r<t.length;r++){let{el:n,from:o,to:a}=t[r],l=r*s,c=Math.max(0,e-l),h=i>0?Math.min(1,c/i):1;n.style.transform=Kt(Ut(o,a,h))}}function ai(t){if(typeof t!="string")return"easeInOutQuad";let e=t.toLowerCase();return e==="linear"?"linear":e.includes("ease-in-out")?"easeInOutQuad":e.includes("ease-in")?"easeInQuad":e.includes("ease-out")?"easeOutQuad":e}function ys(t,e){let i=typeof globalThis<"u"&&globalThis.gsap;if(!i||typeof i.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>'),e();return}let{type:s,currentView:r,previousView:n,lastView:o,currentStage:a,duration:l,ease:c,canvas:h}=t;if(!r||!n||!a){e();return}let u=ei(l);s==="lateral"?Wt(t,e):s==="zoomIn"?ws(i,r,n,o,a,u,c,e):s==="zoomOut"?_s(i,r,n,o,a,u,c,h,e):e()}function ws(t,e,i,s,r,n,o,a){K(e,i,s);let l=r.views[0],c=r.views[1],h=s&&r.views[2]?r.views[2]:null;Ht(e,l.backwardState),Ht(i,c.backwardState),h&&Ht(s,h.backwardState);let u=t.timeline({onComplete:()=>{M(e,r),M(i,r),s&&M(s,r),a()}}),d=oi(o),f=(r.stagger||0)/1e3;u.to(e,{transform:l.forwardState.transform,duration:n,ease:d},0),u.to(i,{transform:c.forwardState.transform,duration:n,ease:d},f),h&&u.to(s,{transform:h.forwardState.transform,duration:n,ease:d},f*2)}function _s(t,e,i,s,r,n,o,a,l){let c=r.views[0],h=r.views[1],u=s&&r.views[2]?r.views[2]:null,d=h.backwardState,f=u?u.backwardState:null;Ht(e,c.forwardState);let m=i.style.transform||getComputedStyle(i).transform||h.forwardState.transform,g=s&&u?s.style.transform||getComputedStyle(s).transform||u.forwardState.transform:null;i.style.transformOrigin=h.forwardState.origin,s&&u&&(s.style.transformOrigin=u.forwardState.origin);let p=oi(o),b=t.timeline({onComplete:()=>{Y(e,a),dt(i,d),s&&f&&ft(s,f),l()}}),v=(r.stagger||0)/1e3;t.set(i,{transform:m}),s&&g&&t.set(s,{transform:g}),b.fromTo(e,{transform:c.forwardState.transform},{transform:c.backwardState.transform,duration:n,ease:p},0),b.fromTo(i,{transform:m},{transform:d.transform,duration:n,ease:p},v),s&&f&&b.fromTo(s,{transform:g},{transform:f.transform,duration:n,ease:p},v*2)}function Ht(t,e){t.style.transformOrigin=e.origin,t.style.transform=e.transform}function oi(t){if(typeof t!="string")return"power2.inOut";let e=t.toLowerCase();return e==="linear"?"none":e.includes("ease-in-out")?"power2.inOut":e.includes("ease-in")?"power2.in":e.includes("ease-out")?"power2.out":e}function xs(t,e){let i=zs();if(!i||typeof i!="function"){console.warn('Zumly Motion driver: Motion not loaded. Add <script src="https://cdn.jsdelivr.net/npm/motion@11/dist/motion.min.js"><\/script>'),e();return}let{type:s,currentView:r,previousView:n,lastView:o,currentStage:a,duration:l,ease:c,canvas:h}=t;if(!r||!n||!a){e();return}let u=ei(l);s==="lateral"?Wt(t,e):s==="zoomIn"?Ss(i,r,n,o,a,u,c,e):s==="zoomOut"?As(i,r,n,o,a,u,c,h,e):e()}function Ss(t,e,i,s,r,n,o,a){K(e,i,s);let l=li(e,i,s,r,"forward");ci(l,0);let c=r.stagger||0,h=c/1e3,u=n*1e3,d=n+(l.length>2?h*2:h);t(0,1,{duration:d,ease:ui(o),onUpdate:f=>{let m=f*d*1e3;hi(l,m,u,c)}}).then(()=>{M(e,r),M(i,r),s&&M(s,r),a()}).catch(()=>a())}function As(t,e,i,s,r,n,o,a,l){let c=r.views[1],h=s&&r.views[2]?r.views[2]:null,u=c.backwardState,d=h?h.backwardState:null,f=li(e,i,s,r,"backward");ci(f,0);let m=r.stagger||0,g=m/1e3,p=n*1e3,b=n+(f.length>2?g*2:g);t(0,1,{duration:b,ease:ui(o),onUpdate:v=>{let y=v*b*1e3;hi(f,y,p,m)}}).then(()=>{Y(e,a),dt(i,u),s&&d&&ft(s,d),l()}).catch(()=>l())}function li(t,e,i,s,r){let n=s.views[0],o=s.views[1],a=i&&s.views[2]?s.views[2]:null,l=[{el:t,backward:n.backwardState,forward:n.forwardState},{el:e,backward:o.backwardState,forward:o.forwardState}];return a&&l.push({el:i,backward:a.backwardState,forward:a.forwardState}),l.map(({el:c,backward:h,forward:u})=>r==="forward"?{el:c,from:it(c,h.origin,h.transform),to:it(c,h.origin,u.transform)}:{el:c,from:it(c,u.origin,u.transform),to:it(c,u.origin,h.transform)})}function ci(t,e){for(let{el:i,from:s,to:r}of t)i.style.transform=Kt(Ut(s,r,e))}function hi(t,e,i,s){for(let r=0;r<t.length;r++){let{el:n,from:o,to:a}=t[r],l=r*s,c=Math.max(0,e-l),h=i>0?Math.min(1,c/i):1;n.style.transform=Kt(Ut(o,a,h))}}function zs(){let t=typeof globalThis<"u"?globalThis:typeof window<"u"?window:{};return t.motion?.animate||t.Motion?.animate||t.animate}function ui(t){if(typeof t!="string")return"easeInOut";let e=t.toLowerCase();return e==="linear"?"linear":e.includes("ease-in-out")?"easeInOut":e.includes("ease-in")?"easeIn":e.includes("ease-out")?"easeOut":t}var Xe={css:ns,waapi:hs,none:cs,anime:gs,gsap:ys,motion:xs};function pe(t){if(typeof t=="function")return{runTransition(i,s){t(i,s)}};let e=typeof t=="string"?t.toLowerCase():"css";return{runTransition:Xe[e]||Xe.css}}function ks(t){if(typeof t!="string"||t.trim()==="")return{tx:0,ty:0,rest:""};let e=Tt(t);return e.matched?{tx:e.tx,ty:e.ty,rest:e.rest}:null}function Ge(t,e,i){let s=ks(t);if(s===null)return t;let r=s.tx*e,n=s.ty*i,o=s.rest?` ${s.rest}`:"";return`translate(${r}px, ${n}px)${o}`.trim()}function Es(t){if(typeof t!="string"||!t.trim())return null;let e=t.trim().match(/^([-\d.eE]+)px\s+([-\d.eE]+)px$/);return e?{x:parseFloat(e[1]),y:parseFloat(e[2])}:null}function Qe(t,e,i){let s=Es(t);return s===null?t:`${s.x*e}px ${s.y*i}px`}function Je(t,e,i,s,r){if(!t.storedViews?.length||!t.canvas||e<=0||i<=0)return;let n=s/e,o=r/i,a=new Set,l=p=>{if(!(!p||p.detachedNode))for(let b of[p.backwardState,p.forwardState])!b||a.has(b)||(a.add(b),b.transform=Ge(b.transform,n,o),b.origin!=null&&(b.origin=Qe(b.origin,n,o)))},c=[...t.storedViews];for(let p of t.lateralHistory||[])p.stage&&c.push(p.stage),l(p.entry);for(let p of c)Array.isArray(p.views)&&p.views.forEach(l);let h=t.canvas,u=h.querySelector(".is-current-view"),d=h.querySelector(".is-previous-view"),f=h.querySelector(".is-last-view"),m=h.querySelector(".is-new-current-view"),g=[u,d,f,m].filter(Boolean);for(let p of g){if(!p.style)continue;let b=p.style.transform;b!=null&&b!==""&&(p.style.transform=Ge(b,n,o));let v=p.style.transformOrigin;v!=null&&v!==""&&(p.style.transformOrigin=Qe(v,n,o))}}var Ps=8e3,Ct=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._navigationTask=null,this._initPromise=null,this._accessibility=new ts,this._hooks={},this._plugins=[],Bi(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=pe(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._onKeyDown=this.onKeyDown.bind(this),this._onKeyboardClick=e=>{e.target.closest?.(".zoom-me[data-to]")&&((e.detail===0?!this.inputs.keyboard:!this.inputs.click)||(e.preventDefault(),e.detail===0&&this.onZoom(e)))},this._onWheel=this.onWheel.bind(this),this._wheelCooldown=!1,this._onPrefetchTrigger=e=>{let i=e.target.closest?.(".zoom-me[data-to]");!this._destroyed&&i&&this.canvas.contains(i)&&this.prefetcher.prefetch(i.dataset.to,{trigger:i,context:this.componentContext,props:{...i.dataset}})},this._onResize=this._handleResize.bind(this),this._resizeDebounceTimer=null,this._RESIZE_DEBOUNCE_MS=80,this.prefetcher=new is(this.views),this._bindEvents()}_bindEvents(){let t=this.canvas;t&&(this._canvasAttributes=new Map(["tabindex","role","aria-roledescription","aria-live"].map(e=>[e,t.getAttribute(e)])),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("keydown",this._onKeyDown,!1),t.addEventListener("click",this._onKeyboardClick,!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("keydown",this._onKeyDown,!1),t.removeEventListener("click",this._onKeyboardClick,!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 i=e.className?`.${String(e.className).trim().split(/\s+/).join(".")}`:e.tagName.toLowerCase();this.notify(`an ancestor of the canvas (${i}) 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()}},Ps)}_clearBlockEventsSafety(){this._blockEventsSafetyTimer!==null&&(clearTimeout(this._blockEventsSafetyTimer),this._blockEventsSafetyTimer=null)}_setTrackedTimeout(t,e){let i=setTimeout(()=>{this._trackedTimers.delete(i),!this._destroyed&&t()},e);return this._trackedTimers.add(i),i}_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((i,s)=>`${s===0?`Instance ${this.mount}: ${i}`:`${i}`}`).join(" > ");this.notify(e),this.trace=[]}else this.trace.push(t)}notify(t,e){return R(this.debug,t,e)}_recordCanvasSize(){this.canvas&&(this._lastCanvasWidth=this.canvas.offsetWidth,this._lastCanvasHeight=this.canvas.offsetHeight)}_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.offsetWidth,e=this.canvas.offsetHeight;if(!(t===this._lastCanvasWidth&&e===this._lastCanvasHeight)){if(this.blockEvents){this._pendingResizeCorrection=!0;return}Je(this,this._lastCanvasWidth,this._lastCanvasHeight,t,e),this._lastCanvasWidth=t,this._lastCanvasHeight=e}},this._RESIZE_DEBOUNCE_MS))}_onTransitionComplete(){if(this._clearBlockEventsSafety(),this._pendingResizeCorrection&&!this.blockEvents){if(this._pendingResizeCorrection=!1,this.canvas&&this._lastCanvasWidth>0){let e=this.canvas.offsetWidth,i=this.canvas.offsetHeight;(e!==this._lastCanvasWidth||i!==this._lastCanvasHeight)&&Je(this,this._lastCanvasWidth,this._lastCanvasHeight,e,i),this._lastCanvasWidth=e,this._lastCanvasHeight=i}}else this._recordCanvasSize();for(let e of this.canvas?.children||[])e.classList.contains("z-view")&&Bt(e);let t=this.canvas?.querySelector(".is-current-view");t&&this._accessibility.restore(t),this._manageFocus(),this.canvas&&this._accessibility.sync(this.canvas)}_manageFocus(){if(!this.canvas)return;let t=this.canvas.querySelector(".is-current-view");if(!t)return;let e='a[href], button:not([disabled]), input:not([disabled]):not([type="hidden"]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])',i=r=>!r||r.closest("[inert], [hidden]")?!1:(r.focus({preventScroll:!0}),document.activeElement===r||r.contains(document.activeElement)),s=t.querySelector(e);if(!i(s)){for(let r of t.querySelectorAll(e))if(r!==s&&i(r))return;t.setAttribute("tabindex","-1"),t.focus({preventScroll:!0})}}_prefersReducedMotion(){return typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}_resolveEffects(t){if(this._prefersReducedMotion())return["none","none"];let e=t?.dataset?.withEffects;if(e&&typeof e=="string"){let i=e.split("|").map(s=>s.trim());return[i[0]||"none",i[1]||i[0]||"none"]}return this.effects}_applyEffects(t,e,i,s,r){!i||i[0]==="none"&&i[1]==="none"||(t&&i[0]!=="none"&&(t.style.setProperty("--z-effect-filter",i[0]),t.style.setProperty("--zoom-duration",s),t.style.setProperty("--zoom-ease",r),t.classList.add("has-effect")),e&&i[1]!=="none"&&(e.style.setProperty("--z-effect-filter",i[1]),e.style.setProperty("--zoom-duration",s),e.style.setProperty("--zoom-ease",r),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 i=t.style.getPropertyValue("--zoom-duration");this._setTrackedTimeout(e,i?parseFloat(i)*(i.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,i,s,r,n=!0){if(!(!i||!t))if(i==="fade"){if(t.style.setProperty("--zoom-duration",s),t.style.setProperty("--zoom-ease",r),t.classList.add("z-trigger-fade"),!n)return;e.style.setProperty("--zoom-duration",s),e.style.setProperty("--zoom-ease",r),e.classList.add("z-view-fade-in"),e.offsetHeight,e.classList.remove("hide")}else t.classList.add("z-trigger-hidden")}_restoreHideTrigger(t,e,i,s){if(!(!e||!t))if(e==="fade"){t.classList.remove("z-trigger-fade"),t.style.setProperty("--zoom-duration",i),t.style.setProperty("--zoom-ease",s),t.classList.add("z-trigger-fade-reverse");let r=()=>{t.classList.remove("z-trigger-fade-reverse"),t.style.removeProperty("--zoom-duration"),t.style.removeProperty("--zoom-ease"),t.removeEventListener("transitionend",r)};t.addEventListener("transitionend",r,{once:!0}),this._setTrackedTimeout(r,parseFloat(i)*(i.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 i={plugin:t,options:e};return this._plugins.push(i),this._initialized&&this._installPlugin(i),this}_installPlugin(t){let{plugin:e,options:i}=t;try{typeof e=="function"?e(this,i):typeof e.install=="function"&&e.install(this,i)}catch(s){this.notify(`plugin install error: ${s.message}`,"error")}}off(t,e){return e?this._hooks[t]&&(this._hooks[t]=this._hooks[t].filter(i=>i!==e)):delete this._hooks[t],this}_emit(t,e={}){let i=this._hooks[t];if(!(!i||i.length===0))for(let s of i)try{s(e)}catch(r){this.debug&&console.error(`Zumly hook "${t}" threw:`,r)}}_runNavigation(t){if(this._destroyed||this.blockEvents)return Promise.resolve();let e={pendingViews:new Set};e.promise=new Promise(s=>{e.resolve=s}),this._navigationTask=e,this.blockEvents=!0,this.prefetcher?.pause();let i=()=>{this._navigationTask===e&&(this._navigationTask=null,this.blockEvents=!1,this._clearBlockEventsSafety(),this.prefetcher?.resume()),e.resolve()};try{Promise.resolve(t()).then(i,s=>{this.notify(`navigation aborted: ${s.message}`,"error"),i()})}catch(s){this.notify(`navigation aborted: ${s.message}`,"error"),i()}return e.promise}_cancelNavigation(){let t=this._navigationTask;if(this._navigationTask=null,this._pendingTransitionComplete=null,this._clearBlockEventsSafety(),this.blockEvents=!1,t){for(let e of t.pendingViews)I(e);t.pendingViews.clear(),t.releaseTransition?.(),t.resolve()}}_createViewContext(t={},e){let i={target:document.createElement("div"),context:this.componentContext,props:t};return e&&(i.trigger=e),this._navigationTask?.pendingViews.add(i.target),i}_runNavigationTransition(t,e){if(this._destroyed)return Promise.resolve();let i=this._navigationTask;return new Promise(s=>{i&&(i.releaseTransition=s);let r=()=>{if(this._pendingTransitionComplete===r){if(this._pendingTransitionComplete=null,this._destroyed){s();return}try{Promise.resolve(e()).then(s,l=>{this.notify(`transition completion failed: ${l.message}`,"error"),s()})}catch(l){this.notify(`transition completion failed: ${l.message}`,"error"),s()}}};this._setBlockEvents(),this._pendingTransitionComplete=r;let n=this._prefersReducedMotion?.(),o=n?pe("none"):this.transitionDriver,a=n?{...t,duration:"0s",currentStage:{...t.currentStage,stagger:0}}:t;try{o.runTransition(a,r)}catch(l){this.notify(`transition driver failed: ${l.message}. Finishing without animation.`,"error");try{pe("none").runTransition(a,r)}catch{r()}}})}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}async 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,i=t&&typeof t=="object"?t.entry:void 0,s=t&&typeof t=="object"?t.node:void 0;return this._doLateral(e,!0,{savedEntry:i,keepAliveNode:s,savedStage:t?.stage})}return 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 i=this.canvas.getBoundingClientRect(),s=Math.max(40,i.width*.1),r=Math.max(40,i.height*.1),n={rect:{x:i.left+(i.width-s)/2,y:i.top+(i.height-r)/2,width:s,height:r},duration:e.duration??this.duration,ease:e.ease??this.ease,props:e.props??{}};await this._doZoomIn(t,n)}init(){return this._destroyed||this._initialized?Promise.resolve():this._initPromise?this._initPromise:!this.isValid||!this.canvas?(this.notify("init() cannot run: instance is invalid or canvas element was not found.","error"),Promise.resolve()):(this._initPromise=this._runNavigation(()=>this._initialize()).finally(()=>{this._initPromise=null}),this._initPromise)}async _initialize(){this.tracing("init()");let t=this.prefetcher,e=this._createViewContext();if(this.preload&&this.preload.length&&(await t.preloadEager(this.preload,null).catch(s=>{this.notify(`preload failed: ${s.message}`,"warn")}),this._destroyed))return;let i;try{let s=await t.get(this.initialView,e);if(this._destroyed){I(s);return}if(i=await Rt(s,this.initialView,this.canvas,!0,this.views,this.componentContext),this._destroyed){I(i),i.remove();return}}catch(s){this.notify(`init() failed to resolve initial view "${this.initialView}": ${s.message}`,"error");return}if(this._emit("viewMounted",{viewName:this.initialView,node:i}),!this._destroyed){t.scanAndPrefetch(i,e),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._accessibility.sync(this.canvas),this._initialized=!0;for(let s of this._plugins)this._installPlugin(s)}}destroy(){if(!this._destroyed){this._destroyed=!0,this._emit("destroy"),this._cancelNavigation(),this._clearBlockEventsSafety(),this._clearTrackedTimeouts(),this._pendingTransitionComplete=null,this._resizeDebounceTimer&&(clearTimeout(this._resizeDebounceTimer),this._resizeDebounceTimer=null),this._unbindEvents(),this._removeNav(),this._cleanupLateralKeepAlive(),this._accessibility.destroy(),this.canvas&&I(this.canvas);for(let t of this.storedViews){let e=je(t);e&&I(e)}if(this.blockEvents=!1,this.storedViews=[],this.currentStage=null,this.lateralHistory=[],this.trace=[],this._hooks={},this.prefetcher?.destroy(),this.prefetcher=null,this.transitionDriver=null,this.canvas)for(let[t,e]of this._canvasAttributes||[])e===null?this.canvas.removeAttribute(t):this.canvas.setAttribute(t,e);this.isValid=!1}}async _doZoomIn(t,e){return this._runNavigation(()=>this._performZoomIn(t,e))}async _performZoomIn(t,e){if(this._emit("beforeZoomIn",{viewName:t}),this._destroyed)return;this.tracing("zoomIn()");let i=this.canvas,s=e.el;this._resetCanvasScroll(i);let r=(this.storedViews.length>0?this.storedViews[this.storedViews.length-1]:null)?.scale??1;this.tracing("getView()");let n=this._createViewContext(s?{...s.dataset}:e.props??{},s),o=s?.dataset?.deferred!==void 0?!0:this.deferred,a,l=null,c=()=>{I(l),I(a),a?.remove()};try{if(o){let P=await this.prefetcher.get(t,n);if(this._destroyed){I(P);return}for(l=document.createDocumentFragment();P.firstChild;)l.appendChild(P.firstChild);a=await Rt(P,t,i,!1,{},this.componentContext)}else{let P=await this.prefetcher.get(t,n);if(this._destroyed){I(P);return}this.prefetcher.scanAndPrefetch(P,n),a=await Rt(P,t,i,!1,this.views,this.componentContext)}}catch(P){c(),this.notify(`zoomIn aborted: failed to resolve view "${t}": ${P.message}`,"error");return}if(!a){c();return}if(this._destroyed){c();return}if(o||this._emit("viewMounted",{viewName:t,node:a}),this._destroyed)return;s&&s.classList.add("zoomed");let h=i.getBoundingClientRect(),u=h.left,d=h.top,f=s?(()=>{let P=s.getBoundingClientRect();return{x:P.x,y:P.y,width:P.width,height:P.height}})():e.rect,m=s?s.dataset.withDuration||this.duration:e.duration??this.duration,g=s?s.dataset.withEase||this.ease:e.ease??this.ease,p=s?s.dataset.withCover||this.cover:e.cover??this.cover,b=s?parseInt(s.dataset.withStagger,10)||this.stagger:e.stagger??this.stagger,v=i.querySelector(".is-current-view"),y=i.querySelector(".is-previous-view"),_=i.querySelector(".is-last-view");if(!v){this.notify("zoomIn aborted: no current view found in canvas. Call init() before navigating and keep Zumly view classes intact.","error"),s&&s.classList.remove("zoomed"),c();return}this._cleanupLateralKeepAlive(),this.lateralHistory=[],me(a),_&&(me(_),i.removeChild(_));let z,x,E,w,S,k,$,L=v.style.transform,C=v.style.transformOrigin,N=y?y.style.transform:null,V=y?y.style.transformOrigin:null;try{v.classList.replace("is-current-view","is-previous-view"),y&&y.classList.replace("is-previous-view","is-last-view");let P=a.getBoundingClientRect(),A=v.getBoundingClientRect(),q=null,tt=null,Ot=null;y&&(q=y.getBoundingClientRect(),Ot=y.querySelector(".zoomed"),tt=Ot&&Ot.getBoundingClientRect?Ot.getBoundingClientRect():q);let qt={left:u,top:d},Ee={width:h.width,height:h.height},Pe={width:P.width,height:P.height},Le=fe(f.width,f.height,P.width,P.height,p);$=Le.scale;let yi=Le.scaleInv;z=He(f,qt,Pe,yi),E=v.style.transform;let $e=ji(f,A);w=Wi(Ee,f,A,$,this.parallax);let Te=$t(C||"0 0"),nt=et(E||""),Ce=$t($e),at=et(w.transform),Ne=f;if(s&&(Ne=Zt(f,A,Te,nt.tx,nt.ty,nt.scale,Ce,at.tx,at.ty,at.scale)),x=Hi(Ne,qt,Pe),y){S=y.style.transform;let wi=Zt(A,A,Te,nt.tx,nt.ty,nt.scale,Ce,at.tx,at.ty,at.scale),_i=Ui(w.x,w.y,qt,$,r),Ve=$t(V||"0 0"),ie=et(S||""),se=et(_i),xi=Zt(tt,q,Ve,ie.tx,ie.ty,ie.scale,Ve,se.tx,se.ty,se.scale);k=Ki({canvasRect:Ee,canvasOffset:qt,triggerRect:f,previousViewRectAtBaseTransform:A,lastViewZoomedElementRect:xi,previousViewRectWithPreviousAtEndTransform:wi,scale:$,preScale:r,parallax:this.parallax})}a.style.transform=z,v.style.transformOrigin=$e}catch(P){this.notify(`zoomIn geometry computation failed: ${P.message}. Aborting zoom.`,"error"),this.debug&&console.error("Zumly _doZoomIn error:",P),v.style.transform=L,v.style.transformOrigin=C,v.classList.contains("is-previous-view")&&v.classList.replace("is-previous-view","is-current-view"),y&&(y.style.transform=N,y.style.transformOrigin=V,y.classList.contains("is-last-view")&&y.classList.replace("is-last-view","is-previous-view")),c(),_&&i.prepend(_),s&&s.classList.remove("zoomed"),Bt(v),Bt(y),Bt(_);return}let B=Ft(a.dataset.viewName,{origin:a.style.transformOrigin,duration:m,ease:g,transform:z},{origin:a.style.transformOrigin,duration:m,ease:g,transform:x}),D=Ft(v.dataset.viewName,{origin:v.style.transformOrigin,duration:m,ease:g,transform:E},{origin:v.style.transformOrigin,duration:m,ease:g,transform:w.transform}),Mt=y?Ft(y.dataset.viewName,{origin:y.style.transformOrigin,duration:m,ease:g,transform:S},{origin:y.style.transformOrigin,duration:m,ease:g,transform:k}):null,Et=_?Yi(_):null,H=Xi(this.storedViews.length,B,D,Mt,Et);H.scale=$,H.stagger=b||0,this.storeViews(H),this.currentStage=this.storedViews[this.storedViews.length-1],this.tracing("setCSSVariables()");let rt=this._resolveEffects(s);this._applyEffects(v,y,rt,m,g);let Pt=this._resolveHideTrigger(s);this._applyHideTrigger(s,a,Pt,m,g),Pt&&(H.hideTriggerMode=Pt);let te={type:"zoomIn",currentView:a,previousView:v,lastView:y,currentStage:this.currentStage,duration:m,ease:g},ee=async()=>{if(o&&l&&a){if(a.appendChild(l),this.prefetcher.scanAndPrefetch(a,n),typeof this.views[t]=="object"&&typeof this.views[t].mounted=="function")try{await this.views[t].mounted()}catch(P){this.notify(`deferred view mounted() failed: ${P.message}`,"error")}if(this._destroyed)return;this._emit("viewMounted",{viewName:t,node:a})}this._destroyed||(this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterZoomIn",{viewName:t,zoomLevel:this.zoomLevel()}),this.tracing("ended"))};await this._runNavigationTransition(te,ee),this._destroyed&&l&&I(l)}async zoomIn(t){this._destroyed||t?.dataset?.to&&await this._doZoomIn(t.dataset.to,{el:t})}async _doLateral(t,e=!1,i={}){return this._runNavigation(()=>this._performLateral(t,e,i))}async _performLateral(t,e=!1,i={}){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 s=this.canvas.querySelector(".is-current-view");if(!s)return;let r=s.dataset?.viewName;if(r===t||(this._emit("beforeLateral",{viewName:t,from:r,isBack:e}),this._destroyed))return;let n=this.lateralNav&&this.lateralNav.keepAlive,o=null;if(!e){this.lateralHistory=this.lateralHistory||[];let A=this.storedViews[this.storedViews.length-1];o={name:r,stage:this._copyLateralStage(A),node:n?s:null},o.entry=o.stage.views[0]}this.tracing("lateral()");let a=i.duration??this.duration,l=i.ease??this.ease,c=this.canvas.querySelector(".is-previous-view"),h=this.canvas.querySelector(".is-last-view"),u=null,d=null;if(n&&(e&&i.keepAliveNode?d=i.keepAliveNode:d=this.canvas.querySelector(`.is-lateral-hidden[data-view-name="${t}"]`)),d){if(d.style.display="",d.style.opacity="",d.classList.remove("is-lateral-hidden","zoom-lateral-out"),d.classList.add("is-new-current-view","has-no-events"),u=d,!e&&this.lateralHistory){let A=this.lateralHistory.findIndex(q=>q.node===d);A!==-1&&this.lateralHistory.splice(A,1)}}else{let A=()=>{e&&this.lateralHistory.push({name:t,entry:i.savedEntry,stage:i.savedStage,node:i.keepAliveNode??null})},q=this._createViewContext(i.props??{});try{let tt=await this.prefetcher.get(t,q);if(this._destroyed){I(tt);return}this.prefetcher.scanAndPrefetch(tt,q),u=await Rt(tt,t,this.canvas,!1,this.views,this.componentContext)}catch(tt){this.notify(`lateral navigation aborted: failed to resolve view "${t}": ${tt.message}`,"error"),A();return}if(!u){A();return}if(this._destroyed){I(u),u.remove();return}if(this._emit("viewMounted",{viewName:t,node:u}),this._destroyed)return}let f=s.style.transform||"",m=this.storedViews[this.storedViews.length-1];u.style.transform="",u.style.transformOrigin="0 0";let g=new Map,p=A=>(g.has(A)||g.set(A,A.getBoundingClientRect()),g.get(A)),b=p(u),v=p(s),y=p(this.canvas),_=y.width/this.canvas.offsetWidth||1,z=y.height/this.canvas.offsetHeight||1,x=c?c.querySelectorAll(".zoom-me[data-to]"):[],E,w;for(let A of x)if(!E&&A.dataset.to===r&&(E=A),!w&&A.dataset.to===t&&(w=A),E&&w)break;let S=0,k=0,$=this._declaredSiblings(),L=$?$.indexOf(r):-1,C=$?$.indexOf(t):-1;if(L!==-1&&C!==-1)S=(L-C)*y.width*.15;else if(c)if(E&&w){let A=p(E),q=p(w);S=A.left+A.width/2-(q.left+q.width/2),k=A.top+A.height/2-(q.top+q.height/2)}else S=y.width*.15;let N=c?{transformStart:c.style.transform||"",transformEnd:this._computeLateralBackTransform(c.style.transform||"",S,k)}:null,V=h&&m.views[2]?{transformStart:h.style.transform||"",transformEnd:this._computeLateralBackTransform(h.style.transform||"",S*.7,k*.7)}:null,B=m.views[0],D=this._computeLateralBackTransform("",(v.x-b.x+(v.width-b.width)/2)/_,(v.y-b.y+(v.height-b.height)/2)/z),Mt=et(B.backwardState.transform||"").scale,Et=this._computeLateralBackTransform(B.backwardState.transform||"",(v.width-b.width)*Mt/(2*_),(v.height-b.height)*Mt/(2*z)),H=c?.querySelector(".zoomed");if(w&&N&&!(e&&i.savedStage)){let A=this._lateralTargetGeometry(u,w,c,h,m,{measure:p,outgoingView:s,canvasRect:y,sx:_,sy:z});A&&(D=A.currentEnd,Et=A.currentBack,N.transformEnd=A.previousEnd,V&&A.lastEnd&&(V.transformEnd=A.lastEnd),m.scale=A.scale)}if(e&&i.savedStage){Object.assign(m,this._copyLateralStage(i.savedStage)),D=m.views[0].forwardState?.transform||"",Et=m.views[0].backwardState.transform,N&&(N.transformEnd=m.views[1].forwardState.transform),V&&(V.transformEnd=m.views[2].forwardState.transform);let A=Tt(N?.transformStart||f),q=Tt(N?.transformEnd||D);S=q.tx-A.tx,k=q.ty-A.ty}else m.views[0]=Ft(t,{origin:"0 0",duration:a,ease:l,transform:Et},{origin:"0 0",duration:a,ease:l,transform:D});this.currentStage=m,o&&this.lateralHistory.push(o),H?.classList.remove("zoomed");let rt=w?this._resolveHideTrigger(w):!1;m.hideTriggerMode=rt,w&&(w.classList.add("zoomed"),this._applyHideTrigger(w,u,rt,a,l,!1),rt&&w.classList.add("z-trigger-hidden")),me(u),N&&m.views[1]&&(m.views[1].forwardState={...m.views[1].forwardState,transform:N.transformEnd}),V&&m.views[2]&&(m.views[2].forwardState={...m.views[2].forwardState,transform:V.transformEnd});let Pt=this._computeLateralBackTransform(D,-S,-k),te=this._computeLateralBackTransform(f,S,k),ee={type:"lateral",currentView:u,previousView:s,lastView:h||null,backView:c||null,backViewState:N,lastViewState:V,incomingTransformStart:Pt,incomingTransformEnd:D,outgoingTransform:f,outgoingTransformEnd:te,currentStage:this.currentStage,duration:a,ease:l,canvas:this.canvas,slideDeltaX:S,slideDeltaY:k,keepAlive:n&&!e?n:!1},P=()=>{H&&H!==w&&(H.classList.remove("z-trigger-hidden","z-trigger-fade","z-trigger-fade-reverse"),H.style.removeProperty("--zoom-duration"),H.style.removeProperty("--zoom-ease")),rt==="fade"&&w.classList.remove("z-trigger-hidden"),n&&!e&&(s.classList.remove("is-current-view","is-new-current-view","has-no-events"),s.classList.add("is-lateral-hidden"),n!=="visible"?s.style.display="none":(s.style.transform=f,s.style.opacity="")),this.blockEvents=!1,this._onTransitionComplete(),this._updateNav(),this._emit("afterLateral",{viewName:t,from:r,isBack:e}),this.tracing("ended")};return this._runNavigationTransition(ee,P)}_copyLateralStage(t){return{...t,views:t.views.map(e=>({...e,...e.backwardState&&{backwardState:{...e.backwardState}},...(e.forwardState||e.backwardState)&&{forwardState:{...e.forwardState||e.backwardState}}}))}}_lateralTargetGeometry(t,e,i,s,r,n){let{measure:o,outgoingView:a,canvasRect:l,sx:c,sy:h}=n,u=L=>{let C=o(L);return{x:(C.x-l.x)/c,y:(C.y-l.y)/h,width:C.width/c,height:C.height/h}},d=u(t),f=u(a),m=u(i),g=u(e);if(!d.width||!d.height||!g.width||!g.height)return null;let p=et(i.style.transform||""),b=$t(i.style.transformOrigin||"0 0"),v=e.dataset.withCover||this.cover,y=fe(g.width,g.height,d.width,d.height,v).scale,_=p.scale*y,z=(L,C,N,V,B,D)=>Zt(L,C,N,V.tx,V.ty,V.scale,B,D.tx,D.ty,D.scale),x=z(g,m,b,p,b,{...p,scale:_}),E={tx:p.tx+f.x+f.width/2-x.x-x.width/2,ty:p.ty+f.y+f.height/2-x.y-x.height/2,scale:_},w=L=>`translate(${L.tx}px, ${L.ty}px) scale(${L.scale})`,S=z(g,m,b,p,{x:0,y:0},et(r.views[1].backwardState.transform||"")),k=fe(S.width,S.height,d.width,d.height,v).scaleInv,$={currentEnd:`translate(${f.x-d.x+(f.width-d.width)/2}px, ${f.y-d.y+(f.height-d.height)/2}px)`,currentBack:He(S,{left:d.x,top:d.y},d,k),previousEnd:w(E),scale:_};if(s&&r.views[2]){let L=u(s),C=$t(s.style.transformOrigin||"0 0"),N=et(s.style.transform||""),V=z(m,m,b,p,b,E),B={...N,scale:N.scale*y},D=z(L,L,C,N,C,B);B.tx+=V.x+y*(L.x-m.x)-D.x,B.ty+=V.y+y*(L.y-m.y)-D.y,$.lastEnd=w(B)}return $}_computeLateralBackTransform(t,e,i){let s=Tt(t);return s.matched?`translate(${s.tx+e}px, ${s.ty+i}px) ${s.rest}`.trim():`translate(${e}px, ${i}px) ${t}`.trim()}zoomOut(){return this._runNavigation(()=>this._performZoomOut())}_performZoomOut(){if(this._emit("beforeZoomOut",{zoomLevel:this.zoomLevel()}),this._destroyed)return;this.tracing("zoomOut()");let t=this.canvas;this._resetCanvasScroll(t);let e=t.querySelector(".is-current-view"),i=t.querySelector(".is-previous-view");if(!e||!i){this.notify("zoomOut: current or previous view not found (animation may still be running)","warn");return}this._cleanupLateralKeepAlive(),this.lateralHistory=[],this.currentStage=this.storedViews[this.storedViews.length-1];let s=t.querySelector(".is-last-view");this.tracing("setCSSVariables()");let r=this.currentStage.views[0]?.forwardState?.duration??this.duration,n=this.currentStage.views[0]?.forwardState?.ease??this.ease,o=i.querySelector(".zoomed");o&&o.classList.remove("zoomed");let a=this.currentStage.hideTriggerMode;a&&o&&this._restoreHideTrigger(o,a,r,n),a==="fade"?(e.classList.remove("z-view-fade-in"),e.style.setProperty("--zoom-duration",r),e.style.setProperty("--zoom-ease",n),e.classList.add("z-view-fade-out")):(e.classList.remove("z-view-fade-in"),e.style.removeProperty("opacity")),this._removeEffect(i),i.classList.replace("is-previous-view","is-current-view"),s!==null&&(s.classList.contains("has-effect")&&this.effects[0]!=="none"&&s.style.setProperty("--z-effect-filter",this.effects[0]),s.classList.replace("is-last-view","is-previous-view"),s.classList.remove("hide"),be(s));let l=je(this.currentStage);if(l){t.prepend(l);let u=t.querySelector(".z-view:first-child");u&&(be(u),u.classList.add("hide"))}let c={type:"zoomOut",currentView:e,previousView:i,lastView:s,currentStage:this.currentStage,duration:r,ease:n,canvas:t},h=()=>{this.blockEvents=!1,this._onTransitionComplete(),this.storedViews.pop(),this._updateNav(),this._emit("afterZoomOut",{zoomLevel:this.zoomLevel()}),this.tracing("ended")};return this._runNavigationTransition(c,h)}onZoom(t){if(this._destroyed||t.type==="mouseup"&&t.button!==0||t.type==="click"&&!this.inputs.keyboard||t.type==="mouseup"&&!this.inputs.click||t.type==="touchend"&&!this.inputs.touch)return;let e=t.target;if(e.closest?.("[inert]")||e.closest(".z-depth-nav")||e.closest(".z-lateral-nav"))return;let i=e.classList.contains("zoom-me")||e.closest(".zoom-me");if(!this.blockEvents&&i&&!this.touching){this.tracing("onZoom() \u2192 zoomIn"),t.preventDefault(),t.stopPropagation();let s=e.classList.contains("zoom-me")?e:e.closest(".zoom-me");this.zoomIn(s);return}if(this.storedViews.length>1&&!this.blockEvents&&!i&&!this.touching){let s=this.canvas.querySelector(".is-current-view");if(s&&s.contains(e))return;let r=this._findSiblingTriggerAtPoint(t.clientX,t.clientY);if(r){this.tracing("onZoom() \u2192 lateral"),t.stopPropagation(),this._doLateral(r.dataset.to);return}this.tracing("onZoom() \u2192 zoomOut"),t.stopPropagation(),this.zoomOut()}}_findSiblingTriggerAtPoint(t,e){let i=this.canvas.querySelector(".is-previous-view");if(!i)return null;let s=this.canvas.querySelector(".is-current-view")?.dataset?.viewName;if(!s)return null;let r=i.querySelectorAll(".zoom-me[data-to]");for(let n of r){if(n.dataset.to===s)continue;let o=n.getBoundingClientRect();if(t>=o.left&&t<=o.right&&e>=o.top&&e<=o.bottom)return n}return null}_getSiblings(){let t=this.canvas.querySelector(".is-current-view")?.dataset?.viewName,e=this._declaredSiblings();if(e&&e.indexOf(t)!==-1)return{siblings:e,currentIndex:e.indexOf(t)};let i=this.canvas.querySelector(".is-previous-view");if(!i)return{siblings:[],currentIndex:-1};let s=i.querySelectorAll(".zoom-me[data-to]"),r=[];for(let o of s)o.dataset.to&&r.push(o.dataset.to);let n=r.indexOf(t);return{siblings:r,currentIndex:n}}_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(){if(this._destroyed)return;let t=this.storedViews.length-1,e=this.canvas.querySelector(":scope > .z-view.is-current-view"),i=!!this.depthNav&&t>=1&&!e?.querySelector(".z-depth-nav"),s=this.lateralNav?this._getSiblings():null;s?.siblings.length<2&&(s=null),s&&this.lateralNav.mode==="auto"&&t>=1&&e&&e.offsetWidth>=this.canvas.offsetWidth&&e.offsetHeight>=this.canvas.offsetHeight&&(s=null),this._updateDepthNav(i),this._updateLateralNav(s)}_updateDepthNav(t){if(t===void 0){let r=this.canvas.querySelector(":scope > .z-view.is-current-view");t=!!this.depthNav&&this.storedViews.length>1&&!r?.querySelector(".z-depth-nav")}if(!t){this._depthNavElement?.remove();return}let e=this.depthNav.position||"bottom-left",i=this._depthNavElement;if(!i){i=document.createElement("div");let r=document.createElement("button");r.className="z-nav-back",r.setAttribute("aria-label","Zoom out (go back)"),r.innerHTML="&#8249;",r.type="button",r.addEventListener("click",n=>{n.stopPropagation(),!this._destroyed&&i.parentNode===this.canvas&&!this.blockEvents&&this.storedViews.length>1&&this.zoomOut()}),i.appendChild(r),this._depthNavElement=i}let s="z-depth-nav z-depth-nav--"+e;i.className!==s&&(i.className=s),i.parentNode!==this.canvas&&this.canvas.appendChild(i)}_updateLateralNav(t){if(t===void 0&&(t=this.lateralNav?this._getSiblings():null,t?.siblings.length<2&&(t=null),t&&this.lateralNav.mode==="auto"&&this.storedViews.length>1)){let l=this.canvas.querySelector(":scope > .z-view.is-current-view");l&&l.offsetWidth>=this.canvas.offsetWidth&&l.offsetHeight>=this.canvas.offsetHeight&&(t=null)}if(!t){this._lateralNavState?.element.remove();return}let{siblings:e,currentIndex:i}=t,s=this.lateralNav.position||"bottom-center",r=!!this.lateralNav.arrows,n=!!this.lateralNav.dots,o=this._lateralNavState;if(!o||o.arrows!==r||o.dots!==n||o.siblings.length!==e.length||o.siblings.some((l,c)=>l!==e[c])){o?.element.remove();let l=document.createElement("div");o={element:l,siblings:[...e],currentIndex:-1,arrows:r,dots:n,dotButtons:[]};let c=(h,u,d)=>{let f=document.createElement("button");return f.className="z-nav-arrow z-nav-"+h,f.setAttribute("aria-label",u),f.innerHTML=d,f.type="button",f};if(r&&(o.prevButton=c("prev","Previous sibling view","&#8249;"),l.appendChild(o.prevButton)),n){let h=document.createElement("div");h.className="z-nav-lateral-dots";for(let u of e){let d=document.createElement("button");d.className="z-nav-dot z-nav-lat-dot",d.setAttribute("aria-label",`Go to ${u}`),d.dataset.to=u,d.type="button",o.dotButtons.push(d),h.appendChild(d)}l.appendChild(h)}r&&(o.nextButton=c("next","Next sibling view","&#8250;"),l.appendChild(o.nextButton)),l.addEventListener("click",h=>{let u=h.target.closest?.("button");if(!u||!l.contains(u))return;h.stopPropagation();let d=this._lateralNavState;if(this._destroyed||this.blockEvents||d?.element!==l||l.parentNode!==this.canvas)return;let f=u===d.prevButton?d.currentIndex-1:u===d.nextButton?d.currentIndex+1:d.dotButtons.indexOf(u);f>=0&&f<d.siblings.length&&f!==d.currentIndex&&this._doLateral(d.siblings[f])}),this._lateralNavState=o}if(o.currentIndex!==i){let l=o.dotButtons[o.currentIndex];l?.classList.remove("is-active"),l?.removeAttribute("aria-current");let c=o.dotButtons[i];c?.classList.add("is-active"),c?.setAttribute("aria-current","true"),o.currentIndex=i}o.prevButton&&o.prevButton.disabled!==i<=0&&(o.prevButton.disabled=i<=0),o.nextButton&&o.nextButton.disabled!==i>=e.length-1&&(o.nextButton.disabled=i>=e.length-1);let a="z-lateral-nav z-lateral-nav--"+s;o.element.className!==a&&(o.element.className=a),o.element.parentNode!==this.canvas&&this.canvas.appendChild(o.element)}_removeNav(){this._depthNavElement?.remove(),this._lateralNavState?.element.remove(),this._depthNavElement=null,this._lateralNavState=null}_cleanupLateralKeepAlive(){if(!this.canvas)return;let t=this.canvas.querySelectorAll(".is-lateral-hidden");for(let e of t)this._accessibility.restore(e),I(e),e.remove()}onKeyDown(t){if(this._destroyed||!this.inputs.keyboard||t.defaultPrevented||We(t.target))return;let e=t.target.closest?.(".zoom-me[data-to]");!e||ve(e)||e.closest("[inert]")||(t.key===" "||t.key==="Enter")&&(t.preventDefault(),t.key==="Enter"&&!t.repeat&&!this.blockEvents&&this.zoomIn(e))}onKeyUp(t){if(this._destroyed||!this.inputs.keyboard||t.defaultPrevented||We(t.target)||t.target.closest?.("[inert]"))return;let e=t.target.closest?.(".zoom-me[data-to]");if(t.key===" "&&e&&!ve(e)){t.preventDefault(),this.blockEvents||this.zoomIn(e);return}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"))}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 i=t,s=this.canvas.querySelector(".is-current-view");for(;i&&i!==this.canvas;){if(i===s||s&&s.contains(i)){let{overflowY:r}=window.getComputedStyle(i);if((r==="auto"||r==="scroll")&&(e>0?i.scrollTop+i.clientHeight<i.scrollHeight-1:i.scrollTop>0))return!0}i=i.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){if(t.target.closest?.(".z-depth-nav, .z-lateral-nav"))return;t.stopPropagation(),this.tracing("handleGesture()");let e=this.touchendX-this.touchstartX,i=this.touchendY-this.touchstartY,s=Math.abs(e)<10&&Math.abs(i)<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 r=t.target.classList.contains("zoom-me")?t.target:t.target.closest(".zoom-me");s&&!this.blockEvents&&r&&this.touching&&(this.touching=!1,this.tracing("tap"),t.preventDefault(),this.zoomIn(r)),s&&this.storedViews.length>1&&!this.blockEvents&&!r&&t.target.closest(".is-current-view")===null&&this.touching&&(this.touching=!1,this.tracing("tap"),this.zoomOut())}},Ls={separator:"/",prefix:"/"};function ge(t,e){let i=[];for(let s of t.storedViews){let r=s.views&&s.views[0];r&&r.viewName&&i.push(r.viewName)}return i.join(e)}function $s(t,e){let i=window.location.hash.slice(1);return i.startsWith(t)&&(i=i.slice(t.length)),i?i.split(e).filter(Boolean):[]}var Nt={install(t,e){let i=Object.assign({},Ls,e),s=i.separator,r=i.prefix,n=!1,o=!1,a=null,l=!1;function c(m){if(n)return;let g=ge(t,s),p="#"+r+g;window.location.hash!==p&&(n=!0,window.history[m](null,"",p),n=!1)}function h(){c("pushState")}function u(){c("replaceState")}t.on("afterZoomIn",h),t.on("afterLateral",h),t.on("afterZoomOut",u);async function d(){if(!(o||l)){o=!0,n=!0;try{for(;a&&!l;){let m=a;if(a=null,await t._navigationTask?.promise,l)return;if(a)continue;let g=ge(t,s).split(s).filter(Boolean);if(m.join(s)!==g.join(s)){if(m.length>g.length){window.history.back();continue}for(;g.length>m.length&&g.length>1;){let p=g.length;if(await t.zoomOut(),l)return;if(g=ge(t,s).split(s).filter(Boolean),a||g.length>=p)break}if(!a&&m.length===g.length&&m.length>0){let p=m[m.length-1];if(p!==g[g.length-1]){let b=t.lateralHistory||[],v=_=>typeof _=="object"?_?.name:_,y=b.map(v).lastIndexOf(p);if(y!==-1)for(;t.lateralHistory.length>y;){let _=t.lateralHistory.length;if(await t.back(),l||a||t.lateralHistory.length>=_)break}else await t.goTo(p,{mode:"lateral"})}}}}}finally{n=!1,o=!1}}}function f(){l||(a=$s(r,s),d())}window.addEventListener("popstate",f),u(),t.on("destroy",function(){l=!0,a=null,t.off("afterZoomIn",h),t.off("afterLateral",h),t.off("afterZoomOut",u),window.removeEventListener("popstate",f)})}};Ct.Router=Nt;var Ts=Object.freeze({xxl:1,xl:.6190476190476191,l:.38095238095238093,m:.23809523809523808,s:.14761904761904762,xs:.09047619047619047,xxs:.0380952380952381}),di=Object.freeze(Object.keys(Ts)),Cs=Object.freeze({extralarge:"xl",large:"l",medium:"m",small:"s",extrasmall:"xs"});function U(t,e="m"){let i=String(t??"").trim().toLowerCase(),s=Cs[i]||i;return di.includes(s)?s:di.includes(e)?e:"m"}function xe(t,e="m"){return`var(--z-size-${U(t,e)})`}var Ns=globalThis.HTMLElement||class{},pi=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),fi=new Set(["circle","square","button","disabled","slider","knob"]),gi=["size","distance","angle","circle","square","label","label-pos","image-path","to-view","button","disabled","slider","progress","knob","qty","unit","min","max","step","pos"],mi={distance:100,angle:0,progress:0,qty:0,min:0,max:100,step:1},vi=Object.fromEntries(gi.map(t=>[t.replace(/-([a-z])/g,(e,i)=>i.toUpperCase()),t]));function Yt(t,e,i){let s=t.getAttribute(e),r=s===null||s.trim()===""?i:Number(s);return Number.isFinite(r)?r:i}function Z(t,e,i="div",s=""){let r=Array.from(t.children).find(n=>n.dataset.zPart===e);return r||(r=t.ownerDocument.createElement(i),r.dataset.zPart=e,s&&(r.className=s),t.append(r)),r}function Se(t){let e=t.localName==="z-view"?t:t.closest("z-view");return e?.hasAttribute("name")&&!e.hasAttribute("data-view-name")&&e.parentElement?.localName==="z-canvas"}function Vs(t){return t.parentElement?.closest("z-view, z-spot, z-list")||null}function j(t,e,i){t.getAttribute(e)!==String(i)&&t.setAttribute(e,String(i))}var X=class t extends Ns{static get observedAttributes(){return gi}constructor(){super(),this._surfaceUpdating=!1,this._surfaceQueued=!1,this._surfaceListening=!1,this._surfaceParts=null,this._surfaceObserver=null,this._surfaceResizeObserver=null,this._onSurfaceAction=e=>this._handleAction(e),this._onSurfaceDisabled=e=>{this.hasAttribute("disabled")&&e.target.closest?.("z-spot")===this&&(e.preventDefault(),e.stopImmediatePropagation())},this._onSurfaceKey=e=>this._handleKey(e),this._onSurfaceValue=e=>this._handleValue(e),this._onSurfaceScroll=()=>this._syncScrollValue()}connectedCallback(){Se(this)||this.refresh()}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||(this._surfaceObserver?.disconnect(),this._surfaceResizeObserver?.disconnect(),this._unlisten())})}attributeChangedCallback(){this.isConnected&&!Se(this)&&this.refresh()}get contentElement(){return this._surfaceParts?.content||null}refresh(){if(this._surfaceUpdating||!this.isConnected||Se(this))return this;this._surfaceUpdating=!0,this._surfaceObserver?.disconnect();try{for(let i of Object.keys(vi))if(pi(this,i)){let s=this[i];delete this[i],this[i]=s}this.classList.add("z-surface",`z-${this.surfaceType}`),this.surfaceType==="spot"&&this.classList.add("satellite");let e=Z(this,"surface","div","z-surface-body");this._surfaceParts={body:e,plate:Z(this,"plate","div","z-plate"),image:Z(e,"image","div","z-image"),content:Z(e,"content","div","z-content"),media:Z(e,"media","div","z-media"),extensions:Z(this,"extensions","div","z-extensions")},this._adoptContent(),this._syncAppearance(),this._syncControls(),this._syncPosition(),this._syncScroll(),this._listen()}finally{this._surfaceUpdating=!1,this._observe()}return this}_adoptContent(){let e=this._surfaceParts,i=[this,e.content,e.image,e.media,e.extensions].flatMap(s=>Array.from(s.childNodes));for(let s of i){if(s.nodeType===1&&s.hasAttribute("data-z-part"))continue;let r=s.nodeType===1?s.getAttribute("slot"):null,n=s.nodeType===1&&s.matches("z-spot, z-list"),o=r==="image"?e.image:r==="media"?e.media:r==="extension"||n?e.extensions:e.content;s.parentNode!==o&&o.append(s)}for(let s of Array.from(e.extensions.children))s.localName==="z-spot"&&this._adoptSpot(s)}_adoptSpot(e){let i=this._surfaceParts?.extensions;if(!i||e===this)return;let s=Z(i,"layout","div","bigbang z-orbit-layout"),r=Z(s,"gravity","div","gravity-spot"),n=e.parentElement;(n?.dataset.zPart!=="spot-orbit"||n.parentElement!==r)&&(n=this.ownerDocument.createElement("div"),n.className="orbit-12 z-spot-orbit",n.dataset.zPart="spot-orbit",r.append(n),n.append(e)),this._sizeSpotOrbit(e,n)}_sizeSpotOrbit(e,i){let s=xe(this.getAttribute("size"),this.defaultSize),r=Yt(e,"distance",100);i.style.setProperty("--o-force",`calc(${s} * ${r/100})`),i.style.setProperty("--o-force-ratio","1"),i.style.setProperty("--o-range","0deg")}_syncPosition(){let e=U(this.getAttribute("size"),this.defaultSize);if(this.style.setProperty("--z-diameter",xe(e)),this.dataset.zSize=e,this.surfaceType==="spot"){this.style.setProperty("--o-from",`${Yt(this,"angle",0)}deg`),this.style.setProperty("--o-offset","0deg");let s=Vs(this);s instanceof t&&s._adoptSpot(this)}let i=this._surfaceParts.extensions.querySelector(':scope > [data-z-part="layout"] > [data-z-part="gravity"]');if(i)for(let s of i.children){if(s.dataset.zPart!=="spot-orbit")continue;let r=Array.from(s.children).find(n=>n.localName==="z-spot");r?this._sizeSpotOrbit(r,s):s.remove()}}_syncAppearance(){let e=this.hasAttribute("square");this.classList.toggle("is-square",e),this.classList.toggle("is-circle",!e),this.classList.toggle("z-button",this.hasAttribute("button"));let i=this.hasAttribute("disabled");this.classList.toggle("is-disabled",i);let s=this.getAttribute("to-view"),r=this.surfaceType==="spot"&&!!s&&!i;this.classList.toggle("zoom-me",r),r?this.dataset.to=s:delete this.dataset.to,this.surfaceType==="spot"&&(!!s||this.hasAttribute("button")?(j(this,"role","button"),j(this,"tabindex",i?"-1":"0"),j(this,"aria-disabled",i?"true":"false"),this.dataset.zInteractive=""):this.hasAttribute("data-z-interactive")&&(this.removeAttribute("role"),this.removeAttribute("tabindex"),this.removeAttribute("aria-disabled"),delete this.dataset.zInteractive));let n=this._surfaceParts.image,o=Array.from(n.children).find(d=>d.dataset.zPart==="image-source"),a=this.getAttribute("image-path");a?(o||=Z(n,"image-source","img","z-image-source"),j(o,"src",a),j(o,"alt","")):o?.remove(),n.hidden=!n.childNodes.length,this._surfaceParts.media.hidden=!this._surfaceParts.media.childNodes.length;let l=this.getAttribute("label")||"",c=this.getAttribute("pos")==="outside"&&this.hasAttribute("qty")&&!this.hasAttribute("knob"),h=Array.from(this.children).find(d=>d.dataset.zPart==="label");if(l||c){h||=Z(this,"label","div","z-label");let d=this.getAttribute("label-pos")||"bottom";for(let m of["top","bottom","left","right","center"])h.classList.toggle(m,m===d);h.dataset.position=d;let f=Z(h,"label-text","span","inside");f.textContent!==l&&(f.textContent=l)}else h?.remove();let u=this.querySelector(':scope > [data-z-part="label"] > [data-z-part="quantity"], :scope > [data-z-part="surface"] > [data-z-part="content"] > [data-z-part="quantity"]');if(this.hasAttribute("qty")&&!this.hasAttribute("knob")){let d=c?h:this._surfaceParts.content;u?u.parentElement!==d&&d.append(u):u=Z(d,"quantity","span","z-quantity");let f=`${Yt(this,"qty",0)}${this.getAttribute("unit")||""}`;u.textContent!==f&&(u.textContent=f)}else u?.remove()}_syncControls(){for(let[e,i,s,r]of[["slider","z-slider","z-surface-slider",["progress"]],["knob","z-knob","z-surface-knob",["qty","unit","min","max","step","disabled"]]]){let n=Array.from(this.children).find(o=>o.dataset.zPart===e);if(this.hasAttribute(e)&&(e!=="slider"||!this.hasAttribute("square"))){n||=Z(this,e,i,s);for(let o of r)this.hasAttribute(o)?j(n,o,this.getAttribute(o)):n.removeAttribute(o);j(n,"aria-label",this.getAttribute("aria-label")||this.getAttribute("label")||(e==="knob"?"Value":"Progress"))}else n?.remove()}this._surfaceParts.content.hidden=this.hasAttribute("knob")}_syncScroll(){if(this.surfaceType!=="view")return;let e=this._surfaceParts.content,s=!(this.hasAttribute("square")||!this.hasAttribute("circle")&&this.closest("[data-shape]")?.dataset.shape==="square")&&e.clientHeight>0&&e.scrollHeight>e.clientHeight+1,r=Array.from(this.children).find(n=>n.dataset.zPart==="scroll");s?(r||=Z(this,"scroll","z-scroll","z-surface-scroll"),j(r,"aria-label","Scroll content"),this._syncScrollValue()):r?.remove()}_syncScrollValue(){let e=Array.from(this.children).find(r=>r.dataset.zPart==="scroll");if(!e||!this._surfaceParts)return;let i=this._surfaceParts.content,s=i.scrollHeight-i.clientHeight;j(e,"scroll-val",s>0?-45+90*i.scrollTop/s:-45)}_listen(){if(!this._surfaceListening){this._surfaceListening=!0;for(let e of["mouseup","touchend","click"])this.addEventListener(e,this._onSurfaceAction),this.addEventListener(e,this._onSurfaceDisabled,!0);this.addEventListener("keydown",this._onSurfaceKey),this.addEventListener("input",this._onSurfaceValue,!0),this.addEventListener("change",this._onSurfaceValue,!0),this._surfaceParts.content.addEventListener("scroll",this._onSurfaceScroll,{passive:!0})}}_unlisten(){if(this._surfaceListening){this._surfaceListening=!1;for(let e of["mouseup","touchend","click"])this.removeEventListener(e,this._onSurfaceAction),this.removeEventListener(e,this._onSurfaceDisabled,!0);this.removeEventListener("keydown",this._onSurfaceKey),this.removeEventListener("input",this._onSurfaceValue,!0),this.removeEventListener("change",this._onSurfaceValue,!0),this._surfaceParts?.content.removeEventListener("scroll",this._onSurfaceScroll)}}_handleAction(e){if(this.surfaceType!=="spot"||e.target.closest?.("z-spot")!==this)return;let i=e.target.closest?.("button, a, input, select, textarea, z-knob, z-scroll");e.type==="click"&&!this.getAttribute("to-view")&&!this.parentElement?.closest(".zoom-me")||(this.hasAttribute("disabled")||!this.getAttribute("to-view")||i&&i!==this)&&(e.stopPropagation(),this.hasAttribute("disabled")&&e.preventDefault())}_handleKey(e){if(!(this.surfaceType!=="spot"||e.target!==this)){if(this.hasAttribute("disabled")){(e.key==="Enter"||e.key===" ")&&(e.preventDefault(),e.stopPropagation());return}this.getAttribute("to-view")||!this.hasAttribute("button")||(e.key==="Enter"||e.key===" ")&&!e.repeat&&(e.preventDefault(),e.stopPropagation(),this.click())}}_handleValue(e){if(e.target.parentElement===this&&e.target.dataset.zPart==="scroll"){let s=Number(e.detail?.scrollVal??e.detail?.value);if(Number.isFinite(s)){let r=this._surfaceParts.content;r.scrollTop=(Math.min(45,Math.max(-45,s))+45)/90*Math.max(0,r.scrollHeight-r.clientHeight)}e.stopPropagation();return}if(e.target.parentElement!==this||e.target.dataset.zPart!=="knob")return;let i=e.detail?.qty??e.detail?.value;Number.isFinite(Number(i))&&(j(this,"qty",Number(i)),e.stopImmediatePropagation(),this.dispatchEvent(new CustomEvent(e.type,{detail:{...e.detail,qty:Number(i),value:Number(i)},bubbles:!0,composed:!0})))}_observe(){if(this.isConnected&&(this._surfaceObserver||=new MutationObserver(e=>{let i=[this,this._surfaceParts?.extensions,this._surfaceParts?.content,this._surfaceParts?.image,this._surfaceParts?.media];e.some(s=>s.type==="attributes"||i.includes(s.target)&&s.addedNodes.length||this._surfaceParts?.content.contains(s.target))&&this._queueRefresh()}),this._surfaceObserver.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["slot"]}),this.surfaceType==="view")){this._surfaceResizeObserver||=new ResizeObserver(()=>this._syncScroll()),this._surfaceResizeObserver.disconnect(),this._surfaceResizeObserver.observe(this._surfaceParts.content);for(let e of this._surfaceParts.content.children)this._surfaceResizeObserver.observe(e)}}_queueRefresh(){this._surfaceQueued||(this._surfaceQueued=!0,queueMicrotask(()=>{this._surfaceQueued=!1,this.refresh()}))}};for(let[t,e]of Object.entries(vi))Object.defineProperty(X.prototype,t,{configurable:!0,get(){return fi.has(e)?this.hasAttribute(e):pi(mi,e)?Yt(this,e,e==="distance"&&this.surfaceType==="view"?0:mi[e]):e==="size"?U(this.getAttribute(e),this.defaultSize):this.getAttribute(e)??""},set(i){fi.has(e)?this.toggleAttribute(e,!!i):i==null?this.removeAttribute(e):j(this,e,i)}});function Xt(t){if(t){t instanceof X&&t.refresh();for(let e of t.querySelectorAll?.("z-view, z-spot")||[])e instanceof X&&e.refresh()}}var Gt=Object.freeze(["white","light-blue","black","purple","orange","yellow","blue","green","red","gray"]),Qt=Object.freeze(["light","light-filled","dark","dark-filled"]),Ae=new WeakMap,bi=0;function gt(t,e,i){if(!e.includes(t))throw new TypeError(`Zircle: unknown ${i} "${t}". Use ${e.join(", ")}.`);return t}async function Vt(t={}){if(typeof document>"u")throw new Error("Zircle: createZircle() needs a browser. Call it after mounting your component.");if(t.signal?.aborted)throw new DOMException("Zircle initialization was cancelled.","AbortError");let e=typeof t.mount=="string"?document.querySelector(t.mount):t.mount;if(!(e instanceof HTMLElement)||!e.isConnected)throw new Error("Zircle: mount must be a connected HTML element or a matching selector.");if(e.getRootNode()!==document)throw new Error("Zircle: Zumly requires a mount in the document light DOM.");if(Ae.has(e))throw new Error("Zircle: this element already has an instance. Destroy it before mounting again.");let i=t.views;if(!i||typeof i!="object"||!Object.keys(i).length)throw new TypeError("Zircle: provide a nonempty views map.");let s=t.initialView??Object.keys(i)[0];if(!Object.hasOwn(i,s))throw new Error(`Zircle: initial view "${s}" is not registered.`);let r=gt(t.theme??"black",Gt,"theme"),n=gt(t.mode??"dark",Qt,"mode"),o=gt(t.shape??"circle",["circle","square"],"shape"),a=!1,l,c=document.createElement("div");c.className="zircle z-stage";let h=document.createElement("div");h.className="zircle zumly-canvas",h.dataset.zircleInstance=String(++bi),h.setAttribute("aria-label",t.label??"Zircle");let u=()=>{h.dataset.theme=r,h.dataset.mode=n,h.dataset.shape=o,c.dataset.theme=r,c.dataset.mode=n,c.dataset.shape=o};u();let d=e.style.position,f=getComputedStyle(e).position==="static";f&&(e.style.position="relative"),c.append(h),e.append(c);let m=()=>{let{width:w,height:S}=e.getBoundingClientRect(),k=Math.max(1,Math.min(840,w,S));h.style.width=`${k}px`,h.style.height=`${k}px`,h.style.left=`${(w-k)/2}px`,h.style.top=`${(S-k)/2}px`;let $=k*.5;for(let[L,C]of Object.entries({xxl:1,xl:260/420,l:160/420,m:100/420,s:62/420,xs:38/420,xxs:16/420}))h.style.setProperty(`--z-size-${L}`,`${$*C}px`);lt.refresh(h)};m();let g=new ResizeObserver(m);g.observe(e);let p=new Ct({mount:`[data-zircle-instance="${bi}"]`,initialView:s,views:i,transitions:{driver:"css",duration:"700ms",ease:"ease-in-out",cover:"width",effects:["blur(1px) opacity(0.35)","blur(3px) opacity(0.12)"],hideTrigger:!1,...t.transitions},depthNav:!1,lateralNav:!1,inputs:{click:!0,touch:!0,keyboard:!0,wheel:!1,...t.inputs},debug:t.debug??!1,componentContext:t.context??new Map,preload:t.preload,deferred:!1}),b=new EventTarget,v=(w,S)=>{b.dispatchEvent(new CustomEvent(w,{detail:S})),e.dispatchEvent(new CustomEvent(`zircle:${w}`,{detail:S,bubbles:!0}))},y=()=>{Xt(h),m()};p.on("viewMounted",({node:w,viewName:S})=>{Xt(w),lt.refresh(w),w.classList.contains("is-current-view")&&!w.style.transform&&(w.style.transform=`translate(${(h.clientWidth-w.offsetWidth)/2}px, ${(h.clientHeight-w.offsetHeight)/2}px)`),v("viewmount",{view:S,node:w})});let _=document.createElement("button");_.type="button",_.className="z-back z-depth-nav",_.textContent="\u2190",_.setAttribute("aria-label",t.backLabel??"Go back"),_.hidden=!0,_.addEventListener("click",()=>E.back());let z=()=>{_.hidden=p.zoomLevel()<=1,t.backButton!==!1&&h.append(_),v("viewchange",{view:p.getCurrentViewName(),depth:Math.max(0,p.zoomLevel()-1)})};for(let w of["afterZoomIn","afterZoomOut","afterLateral"])p.on(w,z);t.router&&p.use(Nt,typeof t.router=="object"?t.router:void 0);let x=w=>{if(a)throw new Error("Zircle: this instance has been destroyed.");if(!Object.hasOwn(i,w))throw new Error(`Zircle: view "${w}" is not registered.`)},E={app:p,canvas:h,mount:e,getCurrentViewName:()=>p.getCurrentViewName(),getHistory:()=>p.storedViews.map(w=>w.views[0].viewName),getHistoryLength:()=>p.storedViews.length,getTheme:()=>r,getMode:()=>n,getShape:()=>o,setTheme(w){return r=gt(w,Gt,"theme"),u(),v("stylechange",{theme:r,mode:n,shape:o}),E},setMode(w){return n=gt(w,Qt,"mode"),u(),v("stylechange",{theme:r,mode:n,shape:o}),E},setShape(w){return o=gt(w,["circle","square"],"shape"),u(),Xt(h),v("stylechange",{theme:r,mode:n,shape:o}),E},async goTo(w,S={}){x(w),await p.goTo(w,S)},async zoomTo(w,S={}){x(w),await p.zoomTo(w,S)},async setView(w,S={}){let k=typeof w=="string"?w:w?.name;x(k),await p.goTo(k,{...S,props:typeof w=="object"?w.params??S.props:S.props})},async back(){a||await p.back()},async zoomOut(){a||await p.zoomOut()},goBack(){return E.back()},refresh:y,on(w,S){return b.addEventListener(w,S),()=>b.removeEventListener(w,S)},destroy(){a||(a=!0,l&&t.signal.removeEventListener("abort",l),g.disconnect(),p.destroy(),c.remove(),f&&e.style.position==="relative"&&(e.style.position=d),Ae.delete(e),v("destroy",{}))}};Ae.set(e,E),t.signal&&(l=()=>E.destroy(),t.signal.addEventListener("abort",l,{once:!0}));try{if(await p.init(),t.signal?.aborted)throw new DOMException("Zircle initialization was cancelled.","AbortError");if(!p.isValid||!p.getCurrentViewName())throw new Error(`Zircle: could not render initial view "${s}".`);return y(),z(),v("ready",{instance:E}),E}catch(w){throw E.destroy(),w}}var Ms=globalThis.HTMLElement??class{},vt=class extends Ms{static observedAttributes=["theme","mode","shape"];connectedCallback(){this._upgradeProperty("views"),this._upgradeProperty("options"),queueMicrotask(()=>{this.isConnected&&!this._ready&&this.init()})}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||this.destroy()})}_upgradeProperty(e){if(Object.hasOwn(this,e)){let i=this[e];delete this[e],this[e]=i}}get ready(){return this._ready??this.init()}get instance(){return this._instance??null}get views(){return this._views}set views(e){this._views=e}get options(){return this._options}set options(e){this._options=e}init(){if(this._ready)return this._ready;let e=this._generation=(this._generation??0)+1;this._controller=new AbortController;let i=this._controller.signal,s={...this._views},r;for(let n of this.querySelectorAll(":scope > template[data-view]")){let o=n.dataset.view;if(Object.hasOwn(s,o)){r=new Error(`Zircle: duplicate view "${o}".`);break}if(!o.trim()||n.content.children.length!==1){r=new Error("Zircle: each view template needs a nonempty data-view name and exactly one root element.");break}s[o]=()=>n.content.firstElementChild.cloneNode(!0)}return this._ready=(r?Promise.reject(r):Vt({...this._options,mount:this,views:s,signal:i,initialView:this.getAttribute("initial-view")??this._options?.initialView??Object.keys(s)[0],theme:this.getAttribute("theme")??this._options?.theme,mode:this.getAttribute("mode")??this._options?.mode,shape:this.getAttribute("shape")??this._options?.shape,label:this.getAttribute("aria-label")??this._options?.label,router:this.hasAttribute("router")||this._options?.router})).then(n=>{if(e!==this._generation||!this.isConnected)return n.destroy(),null;this._instance=n;for(let o of["theme","mode","shape"])this._applyStyleAttribute(o);return this.setAttribute("data-ready",""),n}).catch(n=>{if(i.aborted)return null;throw n}),this._ready.catch(n=>this.dispatchEvent(new CustomEvent("zircle:error",{detail:{error:n},bubbles:!0}))),this._ready}attributeChangedCallback(e,i,s){i===s||!this._instance||this._applyStyleAttribute(e)}_applyStyleAttribute(e){let i={theme:"black",mode:"dark",shape:"circle"},s=this.getAttribute(e)??this._options?.[e]??i[e],r=`${e[0].toUpperCase()}${e.slice(1)}`;this._instance[`get${r}`]()!==s&&this._instance[`set${r}`](s)}async setView(e,i){return(await this.ready)?.setView(e,i)}async back(){return(await this.ready)?.back()}destroy(){this._generation=(this._generation??0)+1,this._controller?.abort(),this._controller=null,this._instance?.destroy(),this._instance=null,this._ready=null,this.removeAttribute("data-ready")}};var bt=class extends X{get defaultSize(){return"xxl"}get surfaceType(){return"view"}};var yt=class extends X{get defaultSize(){return"m"}get surfaceType(){return"spot"}};var G=globalThis.HTMLElement??class{},ze="359.99deg";function Q(t){let e=t.closest("z-view");return e?.hasAttribute("name")&&!e.hasAttribute("data-view-name")&&e.parentElement?.localName==="z-canvas"}function T(t,e,i){let s=t.getAttribute(e),r=s===null||s.trim()===""?NaN:Number(s);return Number.isFinite(r)?r:i}function O(t,e,i){i==null?t.removeAttribute(e):Number.isFinite(Number(i))&&t.setAttribute(e,String(i))}function F(t,e,i,s={}){return t.dispatchEvent(new t.ownerDocument.defaultView.CustomEvent(e,{bubbles:!0,composed:!0,detail:i,...s}))}function J(t,e){for(let i of e){if(!Object.prototype.hasOwnProperty.call(t,i))continue;let s=t[i];delete t[i],t[i]=s}}function ke(t,e=!1){let i=t.ownerDocument;t.classList.add("gravity-spot");let s=Array.from(t.children).find(o=>o.classList.contains("z-control-orbit"))??i.createElement("div");s.className="orbit-12 z-control-orbit",s.setAttribute("aria-hidden","true");let r=s.querySelector("o-progress")??i.createElement("o-progress");r.className="z-control-progress",r.setAttribute("variant","stroke"),r.setAttribute("max","100"),s.append(r);let n;return e&&(n=s.querySelector(".z-control-handle")??i.createElement("span"),n.className="satellite z-control-handle",n.style.setProperty("--o-from","0deg"),n.style.setProperty("--o-angle","0deg"),s.append(n)),t.append(s),{orbit:s,progress:r,handle:n}}var wt=class extends G{get step(){let e=T(this,"step",1);return e>0?e:1}set step(e){O(this,"step",e)}get unit(){return this.getAttribute("unit")??""}set unit(e){this.setAttribute("unit",e??"")}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",!!e)}get value(){return this.normalize(T(this,this.valueAttribute,this.min))}set value(e){O(this,this.valueAttribute,this.normalize(Number(e)))}normalize(e){if(!Number.isFinite(e))return this.min;let i=Math.min(this.max,Math.max(this.min,e)),s=this.min+Math.round((i-this.min)/this.step)*this.step;return Math.min(this.max,Math.max(this.min,Number(s.toFixed(10))))}upgradeProperties(e){J(this,e)}connectedCallback(){if(Q(this)||this._listeners)return;this._ring??=ke(this,!0),this._ring.progress.toggleAttribute("interactive",this.controlKind==="scroll"),this.controlKind==="knob"&&!this._valueLabel&&(this._valueLabel=this.querySelector(":scope > .z-knob-value")??this.ownerDocument.createElement("span"),this._valueLabel.className="z-knob-value",this._valueLabel.setAttribute("aria-hidden","true"),this._numberLabel=this._valueLabel.querySelector(".z-knob-number")??this.ownerDocument.createElement("span"),this._numberLabel.className="z-knob-number",this._unitLabel=this._valueLabel.querySelector(".z-knob-unit")??this.ownerDocument.createElement("span"),this._unitLabel.className="z-knob-unit",this._valueLabel.append(this._numberLabel,this._unitLabel),this.append(this._valueLabel)),this.classList.add(`z-${this.controlKind}`),this.setAttribute("role","slider"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label",this.defaultLabel),this._listeners=new this.ownerDocument.defaultView.AbortController;let e={signal:this._listeners.signal};this.addEventListener("keydown",i=>this._onKey(i),e),this.addEventListener("pointerdown",i=>this._onPointerDown(i),e),this.ownerDocument.addEventListener("pointermove",i=>this._onPointerMove(i),e),this.ownerDocument.addEventListener("pointerup",i=>this._onPointerEnd(i),e),this.ownerDocument.addEventListener("pointercancel",i=>this._onPointerEnd(i),e),this.addEventListener("click",i=>i.stopPropagation(),e),this._render()}disconnectedCallback(){this._releasePointer(),this._listeners?.abort(),this._listeners=null}attributeChangedCallback(){this._render()}_render(){if(!this._ring)return;let e=this.max-this.min,i=e?(this.value-this.min)/e*100:0,s=this.startAngle+i/100*this.angleRange;this.style.setProperty(`--z-${this.controlKind}-angle`,`${s}deg`),this._ring.progress.setAttribute("value",String(this.controlKind==="scroll"?100:i)),this._ring.progress.style.setProperty("--o-range",this.angleRange===360?ze:`${this.angleRange}deg`),this._ring.progress.style.setProperty("--o-from",`${this.startAngle+90}deg`),this._ring.handle.style.setProperty("--o-offset",`${s}deg`),this._valueLabel&&(this._numberLabel.textContent=String(this.value),this._unitLabel.textContent=this.unit,this._unitLabel.hidden=!this.unit),this.setAttribute("aria-valuemin",String(this.min)),this.setAttribute("aria-valuemax",String(this.max)),this.setAttribute("aria-valuenow",String(this.value)),this.setAttribute("aria-valuetext",`${this.value}${this.unit?` ${this.unit}`:""}`),this.setAttribute("aria-disabled",String(this.disabled)),this.disabled?(this.tabIndex>=0&&(this._enabledTabIndex=this.tabIndex),this.tabIndex=-1,this._releasePointer()):(!this.hasAttribute("tabindex")||this.tabIndex===-1)&&(this.tabIndex=this._enabledTabIndex??0)}valueFromPointer(e){let i=this.getBoundingClientRect(),s=(Math.atan2(e.clientY-i.top-i.height/2,e.clientX-i.left-i.width/2)*180/Math.PI+360)%360;return this.min+s/360*(this.max-this.min)}_input(e){let i=this.value;return this.value=e,this.value===i?!1:(F(this,"input",this.eventDetail),!0)}_onKey(e){if(this.disabled||e.altKey||e.ctrlKey||e.metaKey)return;let i={ArrowUp:this.value+this.step,ArrowRight:this.value+this.step,ArrowDown:this.value-this.step,ArrowLeft:this.value-this.step,PageUp:this.value+this.step*10,PageDown:this.value-this.step*10,Home:this.min,End:this.max};e.key in i&&(e.preventDefault(),e.stopPropagation(),this._input(i[e.key])&&F(this,"change",this.eventDetail))}_onPointerDown(e){if(!(this.disabled||e.button!==0||this._pointerId!==void 0)){e.preventDefault(),e.stopPropagation(),this.focus({preventScroll:!0}),this._pointerId=e.pointerId,this._pointerStart=this.value;try{this.setPointerCapture(e.pointerId)}catch{}this._input(this.valueFromPointer(e))}}_onPointerMove(e){this._pointerId===void 0||e.pointerId!==this._pointerId||(e.preventDefault(),this._input(this.valueFromPointer(e)))}_onPointerEnd(e){if(this._pointerId===void 0||e.pointerId!==this._pointerId)return;let i=this.value!==this._pointerStart;this._releasePointer(),i&&F(this,"change",this.eventDetail)}_releasePointer(){if(this._pointerId!==void 0){try{this.releasePointerCapture(this._pointerId)}catch{}this._pointerId=void 0}}};var _t=class extends G{static observedAttributes=["per-page","page","size","square"];get perPage(){return Math.max(1,Math.floor(T(this,"per-page",5)))}set perPage(e){O(this,"per-page",e)}get page(){return Math.max(1,Math.min(this.pageCount||1,Math.floor(T(this,"page",1))))}set page(e){O(this,"page",e)}get pageCount(){return Math.ceil(this._spots().length/this.perPage)}get size(){return U(this.getAttribute("size"),"xxl")}set size(e){this.setAttribute("size",e)}get square(){return this.hasAttribute("square")}set square(e){this.toggleAttribute("square",!!e)}get items(){return this._items?.slice()??[]}set items(e){if(!Array.isArray(e))throw new TypeError("z-list.items must be an array.");this._items=e.slice(),this._itemsDirty=!0,this.isConnected&&this._pager&&this._render()}get renderItem(){return this._renderItem}set renderItem(e){if(e!=null&&typeof e!="function")throw new TypeError("z-list.renderItem must be a function.");this._renderItem=e,this._itemsDirty=!0,this.isConnected&&this._pager&&this._render()}connectedCallback(){Q(this)||(J(this,["items","renderItem","page","perPage","size","square"]),this.classList.add("z-list","gravity-spot"),this._orbit||(this._orbit=this.querySelector(":scope > .z-list-orbit")??this.ownerDocument.createElement("div"),this._orbit.className="orbit-12 z-list-orbit",this._orbit.style.setProperty("--o-range","0deg"),this._pager=this.querySelector(":scope > .z-list-pagination")??this.ownerDocument.createElement("nav"),this._pager.className="z-list-pagination orbit-12",this._pager.style.setProperty("--o-range","0deg"),this._pager.setAttribute("aria-label","List pages"),this.append(this._orbit,this._pager)),this._listeners||(this._listeners=new this.ownerDocument.defaultView.AbortController,this._pager.addEventListener("click",e=>{let i=e.target.closest("button[data-page]");!i||i.disabled||!this._pager.contains(i)||(e.stopPropagation(),this.page=Number(i.dataset.page))},{signal:this._listeners.signal})),this._observer??=new this.ownerDocument.defaultView.MutationObserver(()=>this._render()),this._render())}disconnectedCallback(){this._observer?.disconnect(),this._listeners?.abort(),this._listeners=null}attributeChangedCallback(){this.isConnected&&this._pager&&this._render()}next(){return this.page+=1,this.page}previous(){return this.page-=1,this.page}_spots(){let e=Array.from(this.children).filter(i=>i.localName==="z-spot");return this._orbit?[...this._orbit.children,...e].filter(i=>i.localName==="z-spot"):e}_renderItems(){if(!this._itemsDirty||!this._items)return;let e=this._items.map((i,s)=>{let r=this._renderItem?this._renderItem(i,s):typeof i=="object"&&i!==null?i.label??i.name??String(i):String(i);if(r?.nodeType===1&&r.localName==="z-spot")return r;let n=this.ownerDocument.createElement("z-spot");return r?.nodeType?n.append(r):n.textContent=r==null?"":String(r),n});for(let i of this._generated??[])e.includes(i)||i.remove();this._generated=e,this._orbit.append(...e),this._itemsDirty=!1}_renderPager(e,i){let s=e>5?Math.max(1,Math.min(i-2,e-4)):1,r=Array.from({length:Math.min(5,e)},(a,l)=>({kind:"page",page:s+l,text:String(s+l),label:`Page ${s+l}`}));e>5&&(r.unshift({kind:"previous",page:Math.max(1,i-1),text:"\u2039",label:"Previous page",disabled:i===1}),r.push({kind:"next",page:Math.min(e,i+1),text:"\u203A",label:"Next page",disabled:i===e}));let n=r.map(a=>a.kind==="page"?a.page:a.kind).join(","),o;if(n!==this._pagerSignature){let a=this.ownerDocument.activeElement;a?.parentElement===this._pager&&(o={kind:a.dataset.kind,page:a.dataset.page});let l=this.ownerDocument.createDocumentFragment();for(let c of r){let h=this.ownerDocument.createElement("button");h.className=`z-list-page satellite${c.kind==="page"?"":` z-list-${c.kind}`}`,h.type="button",l.append(h)}this._pager.replaceChildren(l),this._pagerSignature=n}if(this._pager.hidden=e<2,[...this._pager.children].forEach((a,l)=>{let c=r[l];a.dataset.page=String(c.page),a.dataset.kind=c.kind,a.textContent=c.text,a.setAttribute("aria-label",c.label),a.disabled=!!c.disabled,a.style.setProperty("--o-offset",`${90+(r.length-1)*11-l*22}deg`),a.style.setProperty("--o-from","0deg"),a.style.setProperty("--o-angle","0deg"),c.kind==="page"&&c.page===i?a.setAttribute("aria-current","page"):a.removeAttribute("aria-current")}),o&&e>1){let a=[...this._pager.children];(a.find(c=>c.dataset.kind===o.kind&&(o.kind!=="page"||c.dataset.page===o.page))??a.find(c=>c.getAttribute("aria-current")==="page"))?.focus({preventScroll:!0})}}_render(){if(!(!this._pager||this._rendering)){this._rendering=!0,this._observer?.disconnect();try{this._renderItems();for(let a of Array.from(this.children))a.localName==="z-spot"&&this._orbit.append(a);let e=this._spots(),i=this.page,s=this.pageCount,r=(i-1)*this.perPage,n=e.slice(r,r+this.perPage);this._originalDistances??=new WeakMap,this._originalAlignments??=new WeakMap;for(let a of this._managedSpots??[]){if(e.includes(a))continue;let l=this._originalAlignments.get(a);l?a.style.setProperty("--o-aligment",l):a.style.removeProperty("--o-aligment"),a.classList.remove("at-center"),a.hidden=!1}this._managedSpots=e,e.forEach(a=>{if(a.hidden=!n.includes(a),!this._originalDistances.has(a)){let l=a.hasAttribute("data-z-list-distance")?a.getAttribute("data-z-list-distance")||null:a.getAttribute("distance");this._originalDistances.set(a,l),a.setAttribute("data-z-list-distance",l??"")}this._originalAlignments.has(a)||this._originalAlignments.set(a,a.style.getPropertyValue("--o-aligment"))}),n.forEach((a,l)=>{a.setAttribute("angle",String(360/n.length*l-90)),a.classList.toggle("at-center",n.length===1);let c=n.length===1?"0":this._originalDistances.get(a)??"100";a.setAttribute("distance",c),a.style.setProperty("--o-aligment",`calc(var(--o-radius) * ${1-Math.max(0,T(a,"distance",100))/100})`)}),this.style.setProperty("--z-list-size",`var(--z-size-${this.size}, var(--z-size-xxl))`),this.classList.toggle("is-square",this.hasAttribute("square")),this._renderPager(s,i);let o=this._lastPage;this._lastPage=i,this.hasAttribute("page")&&this.getAttribute("page")!==String(i)&&this.setAttribute("page",String(i)),o!==void 0&&o!==i&&F(this,"pagechange",{page:i,pageCount:s,previousPage:o})}finally{this._rendering=!1,this.isConnected&&(this._observer?.observe(this,{childList:!0}),this._observer?.observe(this._orbit,{childList:!0}))}}}};var xt=class extends G{static observedAttributes=["open","visible","duration","self-close","size","square","circle","image-path","aria-label","aria-labelledby","aria-describedby"];get open(){return this.hasAttribute("open")||this.hasAttribute("visible")}set open(e){e?this.show():this.close()}get visible(){return this.open}set visible(e){this.open=e}get duration(){return Math.max(0,T(this,"duration",this.selfClose?1e4:0))}set duration(e){O(this,"duration",e)}get selfClose(){return this.hasAttribute("self-close")}set selfClose(e){this.toggleAttribute("self-close",!!e)}get size(){return U(this.getAttribute("size"),"xxl")}set size(e){this.setAttribute("size",e)}get square(){return this.hasAttribute("square")}set square(e){this.toggleAttribute("square",!!e)}get circle(){return this.hasAttribute("circle")}set circle(e){this.toggleAttribute("circle",!!e)}get imagePath(){return this.getAttribute("image-path")??""}set imagePath(e){e?this.setAttribute("image-path",e):this.removeAttribute("image-path")}get returnValue(){return this._panel?.returnValue??""}connectedCallback(){if(Q(this))return;if(J(this,["open","visible","duration","selfClose","size","imagePath","square","circle"]),this.classList.add("z-dialog"),this._panel||this._build(),!this._listeners){this._listeners=new this.ownerDocument.defaultView.AbortController;let i={signal:this._listeners.signal};this._closeButton.addEventListener("click",()=>this.close("","button"),i),this._panel.addEventListener("cancel",s=>{s.preventDefault(),F(this,"cancel",{},{cancelable:!0})&&this.close("","escape")},i),this._panel.addEventListener("close",()=>{this._visible&&!this._panel.open&&this.close(this._panel.returnValue,"form")},i),this._panel.addEventListener("click",s=>{if(s.stopPropagation(),s.target!==this._panel)return;let r=this._panel.getBoundingClientRect();(s.clientX<r.left||s.clientX>r.right||s.clientY<r.top||s.clientY>r.bottom)&&this.close("","backdrop")},i),this._panel.addEventListener("keydown",s=>this._fallbackKeys(s),i),this._content.addEventListener("scroll",()=>this._measureScroll(),{...i,passive:!0}),this._scroll.addEventListener("input",s=>{s.stopPropagation();let r=this._content.scrollHeight-this._content.clientHeight;r>0&&(this._content.scrollTop=(s.detail.scrollVal+45)/90*r)},i)}this._observer??=new this.ownerDocument.defaultView.MutationObserver(()=>this._adoptContent());let e=this.ownerDocument.defaultView.ResizeObserver;e&&(this._resize??=new e(()=>this._measureScroll())),this._adoptContent(),this._observer.observe(this,{childList:!0,subtree:!0,characterData:!0,attributes:!0,attributeFilter:["slot"]}),this._render()}disconnectedCallback(){this._stopTimer(),this._observer?.disconnect(),this._resize?.disconnect(),this._listeners?.abort(),this._listeners=null,this._panel?.open&&this._panel.close?.(),this._panel?.removeAttribute("open"),this._visible=!1,this._restoreFocus()}attributeChangedCallback(e,i,s){i===s||!this._panel||this._syncing||(this._render(),this._visible&&(e==="duration"||e==="self-close")&&this._startTimer())}show(){return this.hidden=!1,this.setAttribute("open",""),this.isConnected&&this._render(),this}close(e="",i="api"){let s=this._visible;return this._syncing=!0,this.removeAttribute("open"),this.removeAttribute("visible"),this._syncing=!1,this._stopTimer(),this._visible=!1,this._panel&&(this._panel.returnValue=String(e),this._panel.open&&typeof this._panel.close=="function"&&this._panel.close(String(e)),this._panel.removeAttribute("open")),this._restoreFocus(),s&&F(this,"close",{returnValue:String(e),reason:i}),this}_build(){let e=this.ownerDocument;this._panel=this.querySelector(":scope > .z-dialog-panel")??e.createElement("dialog"),this._panel.className="z-dialog-panel",this._image=this._panel.querySelector(":scope > img.z-dialog-image"),this._closeButton=this._panel.querySelector(":scope > .z-dialog-close")??e.createElement("button"),this._closeButton.type="button",this._closeButton.className="z-dialog-close",this._closeButton.setAttribute("aria-label","Close dialog"),this._closeButton.textContent="\xD7",this._content=this._panel.querySelector(":scope > .z-dialog-content")??e.createElement("div"),this._content.className="z-dialog-content",this._progress=this._panel.querySelector(":scope > .z-dialog-progress")??e.createElement("z-slider"),this._progress.className="z-dialog-progress",this._progress.setAttribute("aria-label","Time until dialog closes"),this._progress.setAttribute("aria-hidden","true"),this._scroll=this._panel.querySelector(":scope > .z-dialog-scroll")??e.createElement("z-scroll"),this._scroll.className="z-dialog-scroll",this._scroll.setAttribute("aria-label","Scroll dialog content"),this._scroll.hidden=!0,this._imageSlot=this._panel.querySelector(":scope > .z-dialog-image-slot")??e.createElement("div"),this._imageSlot.className="z-dialog-image-slot",this._media=this._panel.querySelector(":scope > .z-dialog-media")??e.createElement("div"),this._media.className="z-dialog-media",this._extensions=this._panel.querySelector(":scope > .z-dialog-extensions")??e.createElement("div"),this._extensions.className="z-dialog-extensions",this._panel.append(this._imageSlot,this._content,this._media,this._extensions,this._progress,this._scroll,this._closeButton),this.append(this._panel)}_adoptContent(){let e=[...this.childNodes,...this._content.childNodes,...this._imageSlot.childNodes,...this._media.childNodes,...this._extensions.childNodes];for(let i of e){if(i===this._panel)continue;let s=i.nodeType===1?i.getAttribute("slot"):null,r=s==="image"?this._imageSlot:s==="media"?this._media:s==="extension"?this._extensions:this._content;i.parentNode!==r&&r.append(i)}if(this._imageSlot.hidden=!this._imageSlot.childNodes.length||!!this.imagePath,this._media.hidden=!this._media.childNodes.length,this._extensions.hidden=!this._extensions.childNodes.length,this._resize?.disconnect(),this.isConnected){this._resize?.observe(this._content);for(let i of this._content.children)this._resize?.observe(i)}this._measureScroll()}_render(){if(this._panel){this.style.setProperty("--z-dialog-size",`var(--z-size-${this.size}, var(--z-size-xxl))`),this._panel.classList.toggle("is-square",this.hasAttribute("square")),this._panel.classList.toggle("is-circle",!this.hasAttribute("square"));for(let e of["aria-label","aria-labelledby","aria-describedby"])this.hasAttribute(e)?this._panel.setAttribute(e,this.getAttribute(e)):this._panel.removeAttribute(e);!this._panel.hasAttribute("aria-label")&&!this._panel.hasAttribute("aria-labelledby")&&this._panel.setAttribute("aria-label","Dialog"),this.imagePath?(this._image||(this._image=this.ownerDocument.createElement("img"),this._image.className="z-dialog-image",this._image.alt="",this._panel.prepend(this._image)),this._image.src=this.imagePath):this._image&&(this._image.remove(),this._image=null),this._imageSlot.hidden=!this._imageSlot.childNodes.length||!!this.imagePath,this._progress.hidden=this.duration===0,this.isConnected&&(this.open&&!this._visible?(this._returnFocus=this.ownerDocument.activeElement,this.hidden=!1,this._visible=!0,this._panel.returnValue="",typeof this._panel.showModal=="function"?(this._panel.removeAttribute("open"),this._panel.showModal()):(this._panel.setAttribute("open",""),this._panel.setAttribute("role","dialog"),this._panel.setAttribute("aria-modal","true"),this._closeButton.focus()),this._startTimer(),this._measureScroll(),F(this,"open",{})):!this.open&&this._visible&&this.close("","attribute"))}}_measureScroll(){if(!this._scroll)return;let e=this._content.scrollHeight-this._content.clientHeight;this._scroll.hidden=!this._visible||e<2||this.hasAttribute("square"),this._scroll.scrollVal=e>0?-45+this._content.scrollTop/e*90:-45}_startTimer(){if(this._stopTimer(),!this.duration||!this._visible)return;let e=this.ownerDocument.defaultView,i=this.duration,s=e.performance.now();this._progress.progress=0;let r=()=>{let n=e.performance.now()-s;this._progress.progress=Math.min(100,n/i*100),this._visible&&n<i&&(this._timerFrame=e.requestAnimationFrame(r))};this._timerFrame=e.requestAnimationFrame(r),this._timer=e.setTimeout(()=>{this._progress.progress=100,this.close("","timeout"),F(this,"done",{reason:"timeout"})},i)}_stopTimer(){let e=this.ownerDocument.defaultView;e.clearTimeout(this._timer),e.cancelAnimationFrame(this._timerFrame),this._timer=this._timerFrame=null}_restoreFocus(){this._returnFocus?.isConnected&&typeof this._returnFocus.focus=="function"&&this._returnFocus.focus({preventScroll:!0}),this._returnFocus=null}_fallbackKeys(e){if(typeof this._panel.showModal=="function"||(e.key==="Escape"&&(e.preventDefault(),F(this,"cancel",{},{cancelable:!0})&&this.close("","escape")),e.key!=="Tab"))return;let i=[...this._panel.querySelectorAll("a[href],button,input,select,textarea,[tabindex]")].filter(n=>!n.disabled&&n.tabIndex>=0&&!n.hidden&&n.getClientRects().length),s=i[0]??this._closeButton,r=i.at(-1)??this._closeButton;e.shiftKey&&this.ownerDocument.activeElement===s?(e.preventDefault(),r.focus()):!e.shiftKey&&this.ownerDocument.activeElement===r&&(e.preventDefault(),s.focus())}};var St=class extends wt{static observedAttributes=["qty","min","max","step","unit","disabled"];get controlKind(){return"knob"}get min(){return T(this,"min",0)}set min(e){O(this,"min",e)}get max(){return Math.max(this.min,T(this,"max",100))}set max(e){O(this,"max",e)}get qty(){return this.value}set qty(e){this.value=e}get valueAttribute(){return"qty"}get startAngle(){return 0}get angleRange(){return 360}get defaultLabel(){return"Value"}get eventDetail(){return{value:this.value,qty:this.value}}connectedCallback(){this.upgradeProperties(["qty","min","max","step","unit","value","disabled"]),super.connectedCallback()}};var At=class extends G{static observedAttributes=["progress","unit"];get progress(){return Math.max(0,Math.min(100,T(this,"progress",0)))}set progress(e){O(this,"progress",e)}get value(){return this.progress}set value(e){this.progress=e}get unit(){return this.getAttribute("unit")??"%"}set unit(e){this.setAttribute("unit",e??"")}connectedCallback(){Q(this)||(J(this,["progress","value","unit"]),this._ring??=ke(this),this.classList.add("z-slider"),this.setAttribute("role","progressbar"),this.setAttribute("aria-valuemin","0"),this.setAttribute("aria-valuemax","100"),!this.hasAttribute("aria-label")&&!this.hasAttribute("aria-labelledby")&&this.setAttribute("aria-label","Progress"),this._render())}attributeChangedCallback(){this._render()}_render(){this._ring&&(this._ring.progress.setAttribute("value",String(this.progress)),this._ring.progress.style.setProperty("--o-range",ze),this._ring.progress.style.setProperty("--o-from","0deg"),this.setAttribute("aria-valuenow",String(this.progress)),this.setAttribute("aria-valuetext",`${this.progress}${this.unit}`))}};var zt=class extends wt{static observedAttributes=["scroll-val","step","unit","disabled"];get controlKind(){return"scroll"}get min(){return-45}get max(){return 45}get scrollVal(){return this.value}set scrollVal(e){this.value=e}get valueAttribute(){return"scroll-val"}get startAngle(){return-45}get angleRange(){return 90}get defaultLabel(){return"Scroll position"}get eventDetail(){return{value:this.value,scrollVal:this.value}}connectedCallback(){this.upgradeProperties(["scrollVal","step","unit","value","disabled"]),super.connectedCallback()}valueFromPointer(e){let i=this.getBoundingClientRect();return this.normalize(Math.atan2(e.clientY-i.top-i.height/2,e.clientX-i.left-i.width/2)*180/Math.PI)}};var kt=class extends G{static observedAttributes=["index","active","angle","distance","size","disabled"];get index(){return Math.max(0,Math.floor(T(this,"index",0)))}set index(e){O(this,"index",e)}get active(){return Math.max(0,Math.floor(T(this,"active",0)))}set active(e){O(this,"active",e)}get angle(){return T(this,"angle",0)}set angle(e){O(this,"angle",e)}get distance(){return Math.max(0,T(this,"distance",100))}set distance(e){O(this,"distance",e)}get size(){return U(this.getAttribute("size"),"xs")}set size(e){this.setAttribute("size",e)}get disabled(){return this.hasAttribute("disabled")}set disabled(e){this.toggleAttribute("disabled",!!e)}connectedCallback(){Q(this)||(J(this,["index","active","angle","distance","size","disabled"]),this._button||(this._button=this.querySelector(":scope > .z-pagination-button")??this.ownerDocument.createElement("button"),this._button.type="button",this._button.className="z-pagination-button",this.append(this._button)),this.classList.add("z-pagination","satellite"),this._listeners||(this._listeners=new this.ownerDocument.defaultView.AbortController,this._button.addEventListener("click",e=>{e.stopPropagation(),this.disabled||F(this,"change",{index:this.index,page:this.index+1})},{signal:this._listeners.signal})),this._render())}disconnectedCallback(){this._listeners?.abort(),this._listeners=null}attributeChangedCallback(){this._render()}_render(){this._button&&(this._button.textContent=String(this.index+1),this._button.setAttribute("aria-label",`Page ${this.index+1}`),this._button.disabled=this.disabled,this._button.toggleAttribute("data-active",this.index===this.active),this.index===this.active?this._button.setAttribute("aria-current","page"):this._button.removeAttribute("aria-current"),this.classList.toggle("active",this.index===this.active),this.classList.toggle("deactive",this.index!==this.active),this.style.setProperty("--o-from",`${this.angle}deg`),this.style.setProperty("--o-offset","0deg"),this.style.setProperty("--o-angle","0deg"),this.style.setProperty("--z-pagination-distance",String(this.distance/100)),this.style.setProperty("--o-aligment",`calc(var(--o-radius) * ${1-this.distance/100})`),this.style.setProperty("--z-pagination-size",`var(--z-size-${this.size}, var(--z-size-xs))`))}};function Jt(){if(typeof customElements>"u")return;de();let t={"z-canvas":vt,"z-view":bt,"z-spot":yt,"z-list":_t,"z-dialog":xt,"z-knob":St,"z-slider":At,"z-scroll":zt,"z-pagination":kt};for(let[e,i]of Object.entries(t))customElements.get(e)||customElements.define(e,i)}typeof window<"u"&&Jt();return Pi(Os);})();
//# sourceMappingURL=zircle.iife.js.map