@getv.design/embed 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! @getv.design/embed v0.1.0. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
- import{a as y}from"./chunks/chunk-EPAA36UG.js";import"./chunks/chunk-622PUN2F.js";var d=["view","edit","play"];async function l(a,i,e){let o=e?.mode;if(!d.includes(o))throw new TypeError(`mount: mode must be one of ${d.join(", ")}; got ${String(o)}.`);if(o==="edit"){let{edit:t}=await import("./edit.js");return t(a,i,e)}let{view:s}=await import("./view.js"),n=await s(a,i,e);if(o==="view")return n;let r;try{r=await n.play(e.page===void 0?{}:{page:e.page})}catch(t){throw n.destroy(),t}return{goTo:t=>r.goTo(t),destroy(){r.destroy(),n.destroy()}}}export{l as mount,y as version};
1
+ /*! @getv.design/embed v0.1.1. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
+ import{a as y}from"./chunks/chunk-BBJ6N4ZS.js";import"./chunks/chunk-Q6QQ2HGJ.js";var d=["view","edit","play"];async function l(a,i,e){let o=e?.mode;if(!d.includes(o))throw new TypeError(`mount: mode must be one of ${d.join(", ")}; got ${String(o)}.`);if(o==="edit"){let{edit:t}=await import("./edit.js");return t(a,i,e)}let{view:s}=await import("./view.js"),n=await s(a,i,e);if(o==="view")return n;let r;try{r=await n.play(e.page===void 0?{}:{page:e.page})}catch(t){throw n.destroy(),t}return{goTo:t=>r.goTo(t),destroy(){r.destroy(),n.destroy()}}}export{l as mount,y as version};
package/dist/static.js CHANGED
@@ -1,2 +1,2 @@
1
- /*! @getv.design/embed v0.1.0. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
- import{a as g,c as h,e as b,f as v,g as f}from"./chunks/chunk-ZF2CPBI7.js";import{a as P,b as l}from"./chunks/chunk-EPAA36UG.js";import{j as d,x as m}from"./chunks/chunk-ZCGIXCW3.js";import"./chunks/chunk-622PUN2F.js";function A(e){return g(e)}async function F(e,t={}){let o=t.fonts??"approximate";if(!S.includes(o))throw new TypeError(`renderSvg: fonts must be one of ${S.join(", ")}; got ${String(o)}.`);let n=o==="exact"?v(t.fontBase,w()):void 0,{document:c,blocks:x,problems:y}=await h(e),u=t.page===void 0?c:O(c,t.page),p=s=>{let r=x.get(s.hash);return r===void 0?void 0:d(s.type,r)},i=[...y],a;if(o==="exact")if(n===void 0)i.push(f([],"no fontBase was given and this build has no default"));else{let{exactSvg:s}=await import("./chunks/fonts.js"),r=await s(u,{base:n,resolveAsset:p});"svg"in r?a=r.svg:i.push(f(r.failures))}return a??=m(u,{ids:!1,resolveAsset:p}),t.onProblems?.(i),a}var S=["approximate","exact"];function w(){let e=import.meta.url,o=typeof globalThis.process?.getBuiltinModule=="function";return e.startsWith("file:")&&o?new URL("../fonts/",e).href:l}function O(e,t){let o=b(e,t);return{...e,root:{...e.root,children:e.root.children.map(n=>n===o?n:{...n,hidden:!0})}}}export{A as parse,F as renderSvg,P as version};
1
+ /*! @getv.design/embed v0.1.1. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
+ import{a as g,c as h,e as b,f as v,g as f}from"./chunks/chunk-2H24PH2F.js";import{a as P,b as l}from"./chunks/chunk-BBJ6N4ZS.js";import{j as d,x as m}from"./chunks/chunk-QFL2QGB3.js";import"./chunks/chunk-Q6QQ2HGJ.js";function A(e){return g(e)}async function F(e,t={}){let o=t.fonts??"approximate";if(!S.includes(o))throw new TypeError(`renderSvg: fonts must be one of ${S.join(", ")}; got ${String(o)}.`);let n=o==="exact"?v(t.fontBase,w()):void 0,{document:c,blocks:x,problems:y}=await h(e),u=t.page===void 0?c:O(c,t.page),p=s=>{let r=x.get(s.hash);return r===void 0?void 0:d(s.type,r)},i=[...y],a;if(o==="exact")if(n===void 0)i.push(f([],"no fontBase was given and this build has no default"));else{let{exactSvg:s}=await import("./chunks/fonts.js"),r=await s(u,{base:n,resolveAsset:p});"svg"in r?a=r.svg:i.push(f(r.failures))}return a??=m(u,{ids:!1,resolveAsset:p}),t.onProblems?.(i),a}var S=["approximate","exact"];function w(){let e=import.meta.url,o=typeof globalThis.process?.getBuiltinModule=="function";return e.startsWith("file:")&&o?new URL("../fonts/",e).href:l}function O(e,t){let o=b(e,t);return{...e,root:{...e.root,children:e.root.children.map(n=>n===o?n:{...n,hidden:!0})}}}export{A as parse,F as renderSvg,P as version};
package/dist/view.js CHANGED
@@ -1,5 +1,5 @@
1
- /*! @getv.design/embed v0.1.0. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
- import{b as Qe,c as Ae,d as ee,e as ue,f as et,g as me}from"./chunks/chunk-ZF2CPBI7.js";import{a as Ft,b as Re}from"./chunks/chunk-EPAA36UG.js";import{a as Ve,b as $e,c as ge,d as be,e as He,f as Be,g as je,h as Ue,j as We,k as Ke,m as Se,n as Ee,o as Ge,p as ke,s as Ye,t as Ze,u as qe,v as Xe,w as Je}from"./chunks/chunk-ZCGIXCW3.js";import"./chunks/chunk-622PUN2F.js";var It=.8,Nt=.2;function Oe(e,t){let i=e.createElement("canvas").getContext("2d"),n=Ge(),l=new Map,c=new Map,m=new Set;function u(f){return`${f.italic?"italic ":""}${f.weight} ${f.size}px ${f.family}`}function y(){l.clear(),c.clear()}return{advance(f,p){if(!i)return n.advance(f,p);let A=u(p),S=`${A}\0${p.letterSpacing}\0${f}`,E=l.get(S);if(E!==void 0)return E;i.font=A;let x=i.measureText(f).width+p.letterSpacing*[...f].length;return l.set(S,x),x},metrics(f){if(!i)return n.metrics(f);let p=u(f),A=c.get(p);if(A)return A;i.font=p;let S=i.measureText("Hxg"),E=S.fontBoundingBoxAscent??f.size*It,x=S.fontBoundingBoxDescent??f.size*Nt,C={ascent:E,descent:x,lineGap:0};return c.set(p,C),C},load(f,p){let A=e.fonts;if(!A||typeof FontFace!="function")return!1;let S=!1;for(let E of Object.values(f.fonts))for(let x of zt(E)){let C=`${E.family}\0${x.src}\0${x.weight??400}\0${x.style??"normal"}`;if(m.has(C))continue;m.add(C);let O=x.src.startsWith("data:")?void 0:p?.(x.src),_={weight:String(x.weight??400),style:x.style??"normal"},N=$=>{let P=new FontFace(E.family,typeof $=="string"?`url(${$})`:Rt($),_);A.add(P),P.load().then(()=>{y(),t?.()},()=>{A.delete(P)})};O===void 0?N(x.src):(S=!0,O.then(N,()=>{}))}return S},invalidate:y,destroy(){y(),m.clear()}}}function zt(e){return e.faces??[]}function Rt(e){return e instanceof Uint8Array?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}var ye={x:0,y:0,zoom:1},tt=.02,nt=64;function Me(e){return Number.isFinite(e)?Math.min(Math.max(e,tt),nt):1}function we(e,t){return{x:(t.x-e.x)/e.zoom,y:(t.y-e.y)/e.zoom}}function Te(e,t){return{x:t.x*e.zoom+e.x,y:t.y*e.zoom+e.y}}function ve(e,t,r){let i=Me(e.zoom*r),n=we(e,t);return{zoom:i,x:t.x-n.x*i,y:t.y-n.y*i}}function fe(e,t,r){return{...e,x:e.x+t,y:e.y+r}}function _e(e){return`translate(${e.x} ${e.y}) scale(${e.zoom})`}function oe(e,t,r){let i={width:Math.max(1,t.width-r*2),height:Math.max(1,t.height-r*2)};if(e.width<=0||e.height<=0)return ye;let n=Me(Math.min(i.width/e.width,i.height/e.height));return{zoom:n,x:(t.width-e.width*n)/2-(e.x??0)*n,y:(t.height-e.height*n)/2-(e.y??0)*n}}var j="http://www.w3.org/2000/svg",rt="vd-viewer-styles",it=`
1
+ /*! @getv.design/embed v0.1.1. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
+ import{b as Qe,c as Ae,d as ee,e as ue,f as et,g as ye}from"./chunks/chunk-2H24PH2F.js";import{a as Ft,b as Re}from"./chunks/chunk-BBJ6N4ZS.js";import{a as Ve,b as $e,c as ge,d as Se,e as He,f as Be,g as je,h as Ue,j as We,k as Ke,m as Ee,n as me,o as Ge,p as ke,s as Ye,t as Ze,u as qe,v as Xe,w as Je}from"./chunks/chunk-QFL2QGB3.js";import"./chunks/chunk-Q6QQ2HGJ.js";var It=.8,Nt=.2;function Oe(e,t){let i=e.createElement("canvas").getContext("2d"),n=Ge(),l=new Map,c=new Map,m=new Set;function u(f){return`${f.italic?"italic ":""}${f.weight} ${f.size}px ${f.family}`}function y(){l.clear(),c.clear()}return{advance(f,p){if(!i)return n.advance(f,p);let A=u(p),S=`${A}\0${p.letterSpacing}\0${f}`,E=l.get(S);if(E!==void 0)return E;i.font=A;let x=i.measureText(f).width+p.letterSpacing*[...f].length;return l.set(S,x),x},metrics(f){if(!i)return n.metrics(f);let p=u(f),A=c.get(p);if(A)return A;i.font=p;let S=i.measureText("Hxg"),E=S.fontBoundingBoxAscent??f.size*It,x=S.fontBoundingBoxDescent??f.size*Nt,C={ascent:E,descent:x,lineGap:0};return c.set(p,C),C},load(f,p){let A=e.fonts;if(!A||typeof FontFace!="function")return!1;let S=!1;for(let E of Object.values(f.fonts))for(let x of zt(E)){let C=`${E.family}\0${x.src}\0${x.weight??400}\0${x.style??"normal"}`;if(m.has(C))continue;m.add(C);let O=x.src.startsWith("data:")?void 0:p?.(x.src),_={weight:String(x.weight??400),style:x.style??"normal"},N=$=>{let P=new FontFace(E.family,typeof $=="string"?`url(${$})`:Rt($),_);A.add(P),P.load().then(()=>{y(),t?.()},()=>{A.delete(P)})};O===void 0?N(x.src):(S=!0,O.then(N,()=>{}))}return S},invalidate:y,destroy(){y(),m.clear()}}}function zt(e){return e.faces??[]}function Rt(e){return e instanceof Uint8Array?e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength):e}var we={x:0,y:0,zoom:1},tt=.02,nt=64;function Me(e){return Number.isFinite(e)?Math.min(Math.max(e,tt),nt):1}function ve(e,t){return{x:(t.x-e.x)/e.zoom,y:(t.y-e.y)/e.zoom}}function Te(e,t){return{x:t.x*e.zoom+e.x,y:t.y*e.zoom+e.y}}function xe(e,t,r){let i=Me(e.zoom*r),n=ve(e,t);return{zoom:i,x:t.x-n.x*i,y:t.y-n.y*i}}function fe(e,t,r){return{...e,x:e.x+t,y:e.y+r}}function _e(e){return`translate(${e.x} ${e.y}) scale(${e.zoom})`}function oe(e,t,r){let i={width:Math.max(1,t.width-r*2),height:Math.max(1,t.height-r*2)};if(e.width<=0||e.height<=0)return we;let n=Me(Math.min(i.width/e.width,i.height/e.height));return{zoom:n,x:(t.width-e.width*n)/2-(e.x??0)*n,y:(t.height-e.height*n)/2-(e.y??0)*n}}var j="http://www.w3.org/2000/svg",rt="vd-viewer-styles",it=`
3
3
  .vd-viewer {
4
4
  position: relative;
5
5
  overflow: hidden;
@@ -97,4 +97,4 @@ import{b as Qe,c as Ae,d as ee,e as ue,f as et,g as me}from"./chunks/chunk-ZF2CP
97
97
  .vd-viewer--interacting .vd-viewer__page {
98
98
  filter: none;
99
99
  }
100
- `;function ot(e){if(e.getElementById(rt))return;let t=e.createElement("style");t.id=rt,t.textContent=it,e.head.appendChild(t)}function at(e,t,r,i){return t?$t(e,t,r,i):Vt(e,r,i)}function Vt(e,t,r){let i=Oe(e,r);return{measurer:i,update:n=>{i.load(n,t)},afterPaint:()=>{},destroy:()=>i.destroy()}}var st=new WeakMap;function $t(e,t,r,i){let n,l,c,m=()=>{if(!n)throw new Error("canvasFonts: update() before measuring");return n};return{measurer:{advance:(y,f)=>m().measurer.advance(y,f),metrics:y=>m().measurer.metrics(y),itemize:y=>m().measurer.itemize(y)},update(y){n&&y.fonts===l||(c?.(),n?.dispose(),n=t.forDocument(y,r?{loader:r}:{}),l=y.fonts,c=n.onChange(i))},afterPaint(){let y=e.fonts;if(!n||!y||typeof FontFace!="function")return;let f=st.get(e);f||st.set(e,f=new Set);for(let p of n.usedFaces()){if(f.has(p.id))continue;f.add(p.id);let A=new FontFace(p.id,Ht(p.bytes),{weight:String(p.weight),style:p.style});y.add(A),A.load().catch(()=>y.delete(A))}},destroy(){c?.(),n?.dispose(),n=void 0}}}function Ht(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}var Bt=.01,jt=.004,ct=40,Ut=16;function le(e,t){ot(e.ownerDocument);let r=t.document,i=a=>at(e.ownerDocument,a,t.loadFont,()=>{$(r)}),n=i(t.fonts),l={advance:(a,v)=>n.measurer.advance(a,v),metrics:a=>n.measurer.metrics(a),itemize:a=>n.measurer.itemize?.(a)??[a]};n.update(r);let c=Ee(r),m=()=>t.resolveAsset?{measure:l,resolveAsset:t.resolveAsset}:{measure:l},u=ke(r,c,m()),y=t.camera??ye,f=t.interactive??!0,p=t.wheel??"always";e.classList.add("vd-viewer"),t.surface&&(e.style.background=t.surface);let A=e.ownerDocument.createElementNS(j,"svg");A.setAttribute("class","vd-viewer__surface"),A.setAttribute("width","100%"),A.setAttribute("height","100%");let S=e.ownerDocument.createElementNS(j,"g");S.setAttribute("class","vd-viewer__camera"),S.style.isolation="isolate",A.appendChild(S);let E=e.ownerDocument.createElementNS(j,"defs");S.appendChild(E);let x=e.ownerDocument.createElementNS(j,"rect");x.setAttribute("class","vd-viewer__page"),S.appendChild(x),e.appendChild(A);let C=new Map;function O(){S.setAttribute("transform",_e(y))}function _(){N();let a=u.background!==void 0;x.setAttribute("x",String(u.x)),x.setAttribute("y",String(u.y)),x.setAttribute("width",String(a?u.width:0)),x.setAttribute("height",String(a?u.height:0)),D(x,"fill",u.background??null);let v=new Set,M=x;for(let w of u.items){v.add(w.id);let L=C.get(w.id);(!L||L.tagName!==dt(w))&&(L?.remove(),L=e.ownerDocument.createElementNS(j,dt(w)),L.setAttribute("data-vd-id",w.id),C.set(w.id,L)),Kt(L,w),M.nextSibling!==L&&S.insertBefore(L,M.nextSibling),M=L}for(let[w,L]of C)v.has(w)||(L.remove(),C.delete(w));n.afterPaint(),t.onSceneChange?.(u)}function N(){E.replaceChildren();let a=u.items.filter(v=>v.shadows.length>0);if(u.gradients.length>0||a.length>0){let v=`<svg xmlns="${j}">${u.gradients.map(Ye).join("")}${a.map(w=>qe(w)).join("")}</svg>`,M=new DOMParser().parseFromString(v,"image/svg+xml");for(let w of[...M.documentElement.children])E.appendChild(e.ownerDocument.importNode(w,!0))}for(let v of u.clips){let M=e.ownerDocument.createElementNS(j,"clipPath");M.setAttribute("id",ft(v.id)),v.parent!==void 0&&M.setAttribute("clip-path",Pe(v.parent));let w=e.ownerDocument.createElementNS(j,"rect");w.setAttribute("x",String(v.x)),w.setAttribute("y",String(v.y)),w.setAttribute("width",String(v.w)),w.setAttribute("height",String(v.h)),M.appendChild(w),E.appendChild(M)}}function $(a){r=a,n.update(r),c=Ee(r),u=ke(r,c,m()),_()}function P(a){let v=e.getBoundingClientRect();return{x:a.clientX-v.left,y:a.clientY-v.top}}let F=0,I=0;function U(){e.classList.add("vd-viewer--interacting"),I&&clearTimeout(I),I=setTimeout(()=>{I=0,e.classList.remove("vd-viewer--interacting")},180)}function K(){F&&(cancelAnimationFrame(F),F=0),O(),t.onCameraChange?.(y)}function z(a){y=a,K()}function q(a){y=a,U(),!F&&(F=requestAnimationFrame(()=>{F=0,O(),t.onCameraChange?.(y)}))}let X=null,W=null,B=!1,te=a=>{if(p==="modifier"&&!a.ctrlKey&&!a.metaKey)return;a.preventDefault();let v=P(a),M=a.deltaMode===1?Ut:a.deltaMode===2?e.clientHeight||800:1,w=a.deltaX*M,L=a.deltaY*M;if(a.ctrlKey||a.metaKey){let s=a.ctrlKey?Bt:jt,d=Math.max(-ct,Math.min(ct,L));q(ve(y,v,Math.exp(-d*s)));return}if(a.shiftKey&&w===0){q(fe(y,-L,0));return}q(fe(y,-w,-L))},Z=a=>{(a.button===1||a.button===0&&B)&&(a.preventDefault(),X=a.pointerId,W=P(a),e.setPointerCapture(a.pointerId))},J=a=>{if(X!==a.pointerId||!W)return;let v=P(a);q(fe(y,v.x-W.x,v.y-W.y)),W=v},H=a=>{X===a.pointerId&&(X=null,W=null,e.hasPointerCapture(a.pointerId)&&e.releasePointerCapture(a.pointerId))},Q=a=>{a.code==="Space"&&(B=!0)},G=a=>{a.code==="Space"&&(B=!1)};f&&(e.addEventListener("wheel",te,{passive:!1}),e.addEventListener("pointerdown",Z),e.addEventListener("pointermove",J),e.addEventListener("pointerup",H),e.addEventListener("pointercancel",H),e.ownerDocument.addEventListener("keydown",Q),e.ownerDocument.addEventListener("keyup",G)),O(),_();let ne={element:e,surface:A,update:$,getDocument:()=>r,getScene:()=>u,getResolution:()=>c,getMeasurer:()=>l,setFonts(a){n.destroy(),n=i(a),$(r)},getCamera:()=>y,setCamera:z,zoomBy(a,v){let M=e.getBoundingClientRect(),w=v??{x:M.width/2,y:M.height/2};z(ve(y,w,a))},fitToContent(a=32){let v=e.getBoundingClientRect();z(oe({x:u.x,y:u.y,width:u.width,height:u.height},{width:v.width||u.width,height:v.height||u.height},a))},screenToDocument:a=>we(y,a),documentToScreen:a=>Te(y,a),pointerPoint:P,hitTest(a,v){for(let M=u.items.length-1;M>=0;M--){let w=u.items[M];if(w&&tn(w,a,en/y.zoom)&&(!v||v(w.id)))return w.id}return null},linkAt(a,v){for(let M=u.items.length-1;M>=0;M--){let w=u.items[M];if(w?.kind!=="text"||v&&!v(w.id))continue;let L=w.rotation===0?a:Se(a,{x:w.x+w.w/2,y:w.y+w.h/2},-w.rotation);for(let s of w.lines){if(L.y<s.y||L.y>s.y+s.h)continue;let d=s.spans.find(o=>L.x>=o.x&&L.x<=o.x+o.w);if(d)return d.style.link}}},itemOf:a=>u.items.find(v=>v.id===a),elementOf:a=>C.get(a),destroy(){f&&(e.removeEventListener("wheel",te),e.removeEventListener("pointerdown",Z),e.removeEventListener("pointermove",J),e.removeEventListener("pointerup",H),e.removeEventListener("pointercancel",H),e.ownerDocument.removeEventListener("keydown",Q),e.ownerDocument.removeEventListener("keyup",G)),F&&cancelAnimationFrame(F),I&&clearTimeout(I),F=0,I=0,n.destroy(),e.classList.remove("vd-viewer--interacting"),A.remove(),C.clear(),e.classList.remove("vd-viewer")}};return t.autoFit&&ne.fitToContent(),ne}var Wt="vd-clip-";function ft(e){return Wt+e}function Pe(e){return`url(#${ft(e)})`}function dt(e){return Je(e)?"g":Le(e)}function Le(e){switch(e.kind){case"ellipse":return"ellipse";case"frame":return"rect";case"image":return e.href===void 0?"rect":"image";case"rect":return"rect";case"text":return"text";case"vector":return"path"}}function Kt(e,t){if(e.tagName!=="g"){ut(e,t);return}D(e,"clip-path",t.clip===void 0?null:Pe(t.clip)),e.style.mixBlendMode=t.blend==="normal"?"":t.blend;let r=e.firstElementChild;(!r||r.tagName!==Le(t))&&(r?.remove(),r=e.ownerDocument.createElementNS(j,Le(t)),e.appendChild(r)),ut(r,{...t,clip:void 0,blend:"normal"})}function ut(e,t){switch(D(e,"clip-path",t.clip===void 0?null:Pe(t.clip)),D(e,"transform",t.rotation===0?null:Xe(t)),e.style.mixBlendMode=t.blend==="normal"?"":t.blend,e.style.filter=t.shadows.length>0?`url(#${Ze}${t.id})`:"",t.kind){case"ellipse":Jt(e,t);return;case"frame":Gt(e,t);return;case"image":Yt(e,t);return;case"rect":Xt(e,t);return;case"text":qt(e,t);return;case"vector":Qt(e,t);return}}function Gt(e,t){e.setAttribute("class","vd-viewer__page"),e.setAttribute("x",String(t.x)),e.setAttribute("y",String(t.y)),e.setAttribute("width",String(t.w)),e.setAttribute("height",String(t.h)),D(e,"fill",t.background??null)}function Yt(e,t){if(e.setAttribute("x",String(t.x)),e.setAttribute("y",String(t.y)),e.setAttribute("width",String(t.w)),e.setAttribute("height",String(t.h)),D(e,"opacity",t.opacity<1?String(t.opacity):null),t.href===void 0){e.setAttribute("class","vd-viewer__missing"),D(e,"rx",t.radius>0?String(t.radius):null);return}e.setAttribute("href",t.href),e.setAttribute("preserveAspectRatio",Zt[t.fit])}var Zt={cover:"xMidYMid slice",contain:"xMidYMid meet",fill:"none"};function qt(e,t){D(e,"opacity",t.opacity<1?String(t.opacity):null),e.setAttribute("xml:space","preserve");let r=t.lines.flatMap(n=>n.spans).filter(n=>n.text!==""),i=e.ownerDocument;for(;e.childNodes.length>r.length;)e.lastChild?.remove();for(;e.childNodes.length<r.length;)e.appendChild(i.createElementNS(j,"tspan"));r.forEach((n,l)=>{let c=e.childNodes[l];c.textContent=n.text,c.setAttribute("x",String(n.x)),c.setAttribute("y",String(n.y)),c.setAttribute("font-family",n.style.family),c.setAttribute("font-size",String(n.style.size)),c.setAttribute("fill",n.style.fill),D(c,"font-weight",n.style.weight===400?null:String(n.style.weight)),D(c,"font-style",n.style.italic?"italic":null),D(c,"letter-spacing",n.style.letterSpacing===0?null:String(n.style.letterSpacing)),D(c,"data-vd-link",n.style.link??null);let m=[n.style.underline?"underline":"",n.style.strike?"line-through":""].filter(Boolean).join(" ");D(c,"text-decoration",m===""?null:m)})}function Xt(e,t){e.removeAttribute("class"),e.setAttribute("x",String(t.x)),e.setAttribute("y",String(t.y)),e.setAttribute("width",String(t.w)),e.setAttribute("height",String(t.h)),e.setAttribute("fill",t.fill),D(e,"rx",t.radius>0?String(t.radius):null),D(e,"stroke",t.stroke??null),D(e,"stroke-width",t.stroke&&t.strokeWidth>0?String(t.strokeWidth):null),D(e,"opacity",t.opacity<1?String(t.opacity):null)}function lt(e,t){e.setAttribute("fill",t.fill),D(e,"stroke",t.stroke??null),D(e,"stroke-width",t.stroke&&t.strokeWidth>0?String(t.strokeWidth):null),D(e,"opacity",t.opacity<1?String(t.opacity):null)}function Jt(e,t){e.setAttribute("cx",String(t.x+t.w/2)),e.setAttribute("cy",String(t.y+t.h/2)),e.setAttribute("rx",String(t.w/2)),e.setAttribute("ry",String(t.h/2)),lt(e,t)}function Qt(e,t){e.setAttribute("d",t.d),lt(e,t),D(e,"fill-rule",t.rule==="nonzero"?null:t.rule),D(e,"stroke-linecap",t.cap==="butt"?null:t.cap),D(e,"stroke-linejoin",t.join==="miter"?null:t.join)}function D(e,t,r){r===null?e.removeAttribute(t):e.setAttribute(t,r)}var en=4;function tn(e,t,r){let i=e.rotation===0?t:Se(t,{x:e.x+e.w/2,y:e.y+e.h/2},-e.rotation),n=i.x>=e.x&&i.x<=e.x+e.w&&i.y>=e.y&&i.y<=e.y+e.h;if(e.kind==="ellipse"){let l=e.stroke!==void 0?e.strokeWidth/2:0,c=e.w/2+l,m=e.h/2+l;if(c<=0||m<=0)return!1;let u=(i.x-(e.x+e.w/2))/c,y=(i.y-(e.y+e.h/2))/m;return u*u+y*y<=1}if(e.kind==="vector"){let l=e.stroke!==void 0&&e.strokeWidth>0;return Ue(e.contours,i,{fill:e.fill!=="none",rule:e.rule,reach:(l?e.strokeWidth/2:0)+r})}return n}function ae(e,t){let r=new Map;for(let n of t.items)n.kind==="frame"&&n.w>0&&n.h>0&&r.set(n.id,{id:n.id,x:n.x,y:n.y,w:n.w,h:n.h});let i=e.root.children.flatMap(n=>{let l=n.type==="frame"?r.get(n.id):void 0;return l&&n.type==="frame"?[{...l,skip:n.skip===!0}]:[]});return i.length===0?[{id:null,x:t.x,y:t.y,w:t.width,h:t.height,skip:!1}]:i.every(n=>n.skip)?i.map(n=>({...n,skip:!1})):i}function pt(e,t){return e.root.children.find(i=>i.type==="frame"&&$e(i,t)!==void 0)?.id}function ht(e,t){let r=t===void 0?-1:e.findIndex(i=>i.id===t);return r!==-1?r:Math.max(0,e.findIndex(i=>!i.skip))}function ce(e,t,r){for(let i=t+r;i>=0&&i<e.length;i+=r)if(!e[i]?.skip)return i;return t}function gt(e){return e.filter(t=>!t.skip).length}function Ce(e,t){return e[t]?.skip!==!1?null:e.slice(0,t+1).filter(r=>!r.skip).length}function mt(e,t){if(!/^\d+$/.test(e))return null;let r=Number(e),i=t.findIndex((n,l)=>Ce(t,l)===r);return i===-1?null:i}function yt(e,t,r){let i=pt(e,r),n=t.findIndex(l=>l.id!==null&&l.id===i);return n===-1?null:n}var nn="cubic-bezier(0.2, 0, 0, 1)",rn="cubic-bezier(0.4, 0, 1, 1)",wt="cubic-bezier(0.4, 0, 0.2, 1)";function vt(e,t,r,i,n){let l={opacity:r},c=on(e,t,i,n);if(e==="cut")return{keyframes:t==="enter"?[{visibility:"hidden"},{visibility:"hidden"}]:[{visibility:"visible"},{visibility:"visible"}],easing:"linear"};if(e==="pop"){let m=`${n.x}px ${n.y}px`;l.scale="1",l.transformOrigin=m}else(e==="rise"||e==="drop")&&(l.translate="0 0");return t==="enter"?{keyframes:[c,l],easing:nn}:{keyframes:[l,c],easing:rn}}function on(e,t,r,i){switch(e){case"rise":return{opacity:0,translate:`0 ${t==="enter"?r:-r}px`};case"drop":return{opacity:0,translate:`0 ${t==="enter"?-r:r}px`};case"pop":return{opacity:0,scale:String(.85),transformOrigin:`${i.x}px ${i.y}px`};case"fade":case"cut":return{opacity:0}}}function xt(e,t){let r=t==="forward"?"-100%":"100%",i=t==="forward"?"100%":"-100%";switch(e){case"cut":return null;case"fade":return{still:[{opacity:1},{opacity:0}],live:null,stillOnTop:!0};case"push":return{still:[{translate:"0 0"},{translate:`${r} 0`}],live:[{translate:`${i} 0`},{translate:"0 0"}],stillOnTop:!1};case"slide":return t==="forward"?{still:null,live:[{translate:"100% 0"},{translate:"0 0"}],stillOnTop:!1}:{still:[{translate:"0 0"},{translate:"100% 0"}],live:null,stillOnTop:!0}}}var sn={enter:"cut",duration:0,steps:[[]],clicks:new Map};function De(e){let t=new Map,r=new Map,i=new Map;Ve(e.root,(m,u)=>{u&&(r.set(m.id,u.id),i.set(u.id,[...i.get(u.id)??[],m.id]))});let n=je(e),l=Be(e);for(let[m,u]of Object.entries(e.motion??{})){if(!l.has(m))continue;let y=[[]],f=new Map;for(let p of u.lines){if(p.id===m||n.get(p.id)!==m)continue;let A=p.go===void 0?void 0:He(p.go);A&&f.set(p.id,A);let S=p.enter!==void 0?"enter":p.exit!==void 0?"exit":null,E=p.enter??p.exit;S===null||E===void 0||(p.step&&y.push([]),y.at(-1).push({id:p.id,kind:S,effect:E,duration:E==="cut"?0:p.duration??be,delay:p.delay??0,together:p.together===!0}))}t.set(m,{enter:u.enter??"cut",duration:u.duration??be,steps:y,clicks:f})}let c=m=>[m,...(i.get(m)??[]).flatMap(u=>c(u))];return{pages:t,parents:r,within:c}}function bt(e,t){let r=t?.id;return(r?e.pages.get(r):void 0)??sn}function Fe(e){let t=0,r=0;return e.map((i,n)=>(t=(n===0?0:i.together?t:r)+i.delay,r=t+i.duration,{build:i,at:t}))}function St(e){return Math.max(0,...Fe(e).map(({build:t,at:r})=>r+t.duration))}function se(e,t){let r=new Set,i=new Set;for(let n of e.steps.flat())i.has(n.id)||(i.add(n.id),n.kind==="enter"&&r.add(n.id));for(let n of e.steps.slice(0,t).flat())n.kind==="enter"?r.delete(n.id):r.add(n.id);return r}function Et(e,t,r){for(let i=r;i!==void 0;i=e.parents.get(i)){let n=t.clicks.get(i);if(n)return{id:i,target:n}}}function kt(e,t,r){let i=[...e];for(;i.length>0;){let n=i.pop(),l=t.findIndex(c=>c.id!==null&&c.id===n);if(l!==-1&&l!==r)return{index:l,history:i}}return null}var cn=1500,dn=2e3,un=50;function Ie(e,t){let r=e.ownerDocument;e.classList.add("vd-player"),e.tabIndex=-1;let i=new Set,n=new Set,l=!1,c=le(e,{document:t.document,interactive:!1,surface:"#000",...t.fonts?{fonts:t.fonts}:{},...t.loadFont?{loadFont:t.loadFont}:{},...t.resolveAsset?{resolveAsset:t.resolveAsset}:{},onSceneChange:()=>{l&&z()}}),m=r.createElementNS(j,"path");m.setAttribute("class","vd-player__mask"),m.setAttribute("fill","#000"),m.setAttribute("fill-rule","evenodd"),c.surface.appendChild(m);let u=r.createElement("div");u.className="vd-player__counter",u.setAttribute("aria-live","polite"),e.appendChild(u);let y=De(t.document),f=ae(t.document,c.getScene()),p=ht(f,t.start),A=[],S=0,E=[],x,C=0,O="",_,N,$=r.defaultView,P=()=>typeof c.surface.animate=="function"&&!($?.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1),F=()=>bt(y,f[p]);function I(){let s=e.getBoundingClientRect(),d=f[p];return{width:s.width||d?.w||1,height:s.height||d?.h||1}}function U(){let s=f[p];if(!s)return;let d=I(),o=oe({x:s.x,y:s.y,width:s.w,height:s.h},d,0);c.setCamera(o);let h=s.x*o.zoom+o.x,g=s.y*o.zoom+o.y,b=s.w*o.zoom,T=s.h*o.zoom;m.setAttribute("d",`M0 0H${d.width}V${d.height}H0ZM${h} ${g}h${b}v${T}h${-b}Z`),m.dataset.slide=s.id??""}function K(){let s=Ce(f,p),d=gt(f);u.textContent=s===null?"Skipped":`${s} / ${d}`,u.classList.add("vd-player__counter--shown"),_&&clearTimeout(_),_=setTimeout(()=>u.classList.remove("vd-player__counter--shown"),cn),t.onChange?.(s,d)}function z(){let s=new Set;for(let d of i)for(let o of y.within(d))s.add(o);n=s;for(let d of c.surface.querySelectorAll("[data-vd-hidden]")){let o=d.getAttribute("data-vd-id");(o===null||!s.has(o))&&d.removeAttribute("data-vd-hidden")}for(let d of s)c.elementOf(d)?.setAttribute("data-vd-hidden","")}function q(s){return y.within(s).flatMap(d=>{let o=c.elementOf(d);return o?[o]:[]})}function X(s){let d=1/0,o=1/0,h=-1/0,g=-1/0;for(let b of y.within(s)){let T=c.itemOf(b);T&&(d=Math.min(d,T.x),o=Math.min(o,T.y),h=Math.max(h,T.x+T.w),g=Math.max(g,T.y+T.h))}return Number.isFinite(d)?{x:(d+h)/2,y:(o+g)/2}:{x:0,y:0}}function W(){if(!(E.length===0&&!x)){C+=1,S===0&&(S=1),i=se(F(),S),z();for(let s of E)s.cancel();E=[],x?.remove(),x=void 0}}function B(){return E.length===0&&!x?!1:(W(),!0)}function te(s,d){return new Promise(o=>{let h=!1,g=()=>{h||(h=!0,o())};Promise.all(s.map(b=>b.finished)).then(g,()=>{h=!0}),setTimeout(()=>{if(!h){for(let b of s)(b.playState==="running"||b.playState==="paused")&&b.finish();g()}},d+un)})}function Z(s,d,o){if(s===p||!f[s])return;let h=F();p=s;let g=F(),b=o==="forward"?g:h,T=P()?xt(b.enter,o):null;if(T&&(x=c.surface.cloneNode(!0),x.classList.add("vd-player__still"),x.setAttribute("aria-hidden","true"),T.stillOnTop?c.surface.after(x):c.surface.before(x)),U(),S=d?0:g.steps.length,i=se(g,S),z(),K(),!T||!x){d&&J();return}let R={duration:b.duration,easing:wt},k=[];T.still&&k.push(x.animate(T.still,{...R,fill:"forwards"})),T.live&&k.push(c.surface.animate(T.live,R)),E.push(...k);let re=C;te(k,b.duration).then(()=>{if(re===C){E=E.filter(ie=>!k.includes(ie));for(let ie of k)ie.cancel();x?.remove(),x=void 0,d&&J()}})}function J(){let s=F(),d=s.steps[S];if(d===void 0)return;S+=1;let o=se(s,S);if(d.length===0)return;if(!P()){i=o,z();return}let h=new Set(d.filter(k=>k.kind==="enter").map(k=>k.id));i=new Set([...se(s,S-1)].filter(k=>!h.has(k))),z();let g=f[p],b=.04*Math.min(g?.w??0,g?.h??0),T=C,R=[];for(let{build:k,at:re}of Fe(d)){let ie=X(k.id),Y=[];for(let V of q(k.id)){let de=Number(V.getAttribute("opacity")??1),{keyframes:xe,easing:he}=vt(k.effect,k.kind,Number.isFinite(de)?de:1,b,ie);Y.push(V.animate(xe,{duration:k.duration,delay:re,easing:he,fill:k.kind==="enter"?"backwards":"forwards"}))}R.push(...Y),k.kind==="exit"&&Y.length>0&&te(Y,re+k.duration).then(()=>{if(T===C){i.add(k.id),z();for(let V of Y)V.cancel()}})}E.push(...R),te(R,St(d)).then(()=>{if(T===C){E=E.filter(k=>!R.includes(k)),i=o,z();for(let k of R)k.cancel()}})}function H(s){let d=Math.min(Math.max(0,s),f.length-1);if(d===p)return;let o=f[p]?.id;o&&A.push(o),Z(d,!0,"forward")}function Q(){if(!B()){if(S<F().steps.length){J();return}H(ce(f,p,1))}}function G(){if(B())return;let s=kt(A,f,p);if(s){A=s.history,Z(s.index,!1,"back");return}Z(ce(f,p,-1),!1,"back")}function ne(s){switch(s.kind){case"url":t.onLink?.(s.url);return;case"back":G();return;case"next":H(ce(f,p,1));return;case"frame":{let d=yt(c.getDocument(),f,s.id);d===null?Q():H(d)}}}function a(s){let d=f[p];if(!d||s.x<d.x||s.y<d.y||s.x>d.x+d.w||s.y>d.y+d.h)return;let o=T=>!n.has(T),h=c.hitTest(s,o),g=h===null?void 0:Et(y,F(),h);if(g)return g.target;let b=c.linkAt(s,o);return b===void 0?void 0:ge(b)}let v=s=>{if(s.stopPropagation(),s.metaKey||s.ctrlKey||s.altKey)return;let d=s.key;if(/^\d$/.test(d))O+=d;else if(d==="Enter"&&O!==""){let o=mt(O,f);O="",!B()&&o!==null&&H(o)}else if(d==="Escape")O!==""?O="":t.onExit?.();else if(["ArrowRight","ArrowDown","PageDown"," ","Enter"].includes(d))O="",Q();else if(["ArrowLeft","ArrowUp","PageUp","Backspace"].includes(d))O="",G();else if(d==="Home")B()||H(ce(f,-1,1));else if(d==="End")B()||H(ce(f,f.length,-1));else return;s.preventDefault()},M=s=>{if(B())return;let d=a(c.screenToDocument(c.pointerPoint(s)));d?ne(d):Q()},w=s=>{if(e.classList.remove("vd-player--idle"),N&&clearTimeout(N),N=setTimeout(()=>e.classList.add("vd-player--idle"),dn),!s)return;let d=c.screenToDocument(c.pointerPoint(s));e.classList.toggle("vd-player--link",a(d)!==void 0)},L=$&&"ResizeObserver"in $?new $.ResizeObserver(()=>U()):void 0;return L?.observe(e),e.addEventListener("keydown",v),e.addEventListener("click",M),e.addEventListener("pointermove",w),l=!0,U(),i=se(F(),0),z(),K(),w(),e.focus({preventScroll:!0}),J(),{viewer:c,index:()=>p,count:()=>f.length,next:Q,back:G,go(s){W(),H(s)},update(s){if(s===c.getDocument())return;W();let d=f[p]?.id;c.update(s),y=De(s),f=ae(s,c.getScene());let o=f.findIndex(h=>h.id===d);p=o===-1?Math.min(p,f.length-1):o,U(),S=F().steps.length,i=se(F(),S),z()},refit:U,destroy(){C+=1;for(let s of E)s.cancel();E=[],x?.remove(),L?.disconnect(),e.removeEventListener("keydown",v),e.removeEventListener("click",M),e.removeEventListener("pointermove",w),_&&clearTimeout(_),N&&clearTimeout(N),m.remove(),u.remove(),c.destroy(),e.classList.remove("vd-player","vd-player--idle","vd-player--link"),e.removeAttribute("tabindex")}}}function At(e){let t=e,r=new Map,i=typeof URL.createObjectURL=="function"&&typeof URL.revokeObjectURL=="function";return{resolve(n){let l=r.get(n.hash);if(l!==void 0)return l;let c=t.get(n.hash);if(c===void 0)return;if(!i)return We(n.type,c);let m;try{m=Ke(c)}catch{return}let u=URL.createObjectURL(new Blob([m],{type:n.type}));return r.set(n.hash,u),u},replace(n){t=n;for(let[l,c]of r)n.has(l)||(URL.revokeObjectURL(c),r.delete(l))},destroy(){for(let n of r.values())URL.revokeObjectURL(n);r.clear(),t=new Map}}}var Ne=["page","content","none"],Ot=24;function pe(e){let t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function Mt(e,t){let r=t===void 0?void 0:e.itemOf(t);if(!(!r||r.w<=0||r.h<=0))return{x:r.x,y:r.y,width:r.w,height:r.h}}function Tt(e,t,r,i){if(r==="none")return;let n=r==="page"?Mt(e,i):void 0;if(!n){e.fitToContent(Ot);return}let l=pe(t);e.setCamera(oe(n,{width:l.width||n.width,height:l.height||n.height},Ot))}function _t(e,t,r){let i=Mt(e,r);if(!i)return;let n=e.getCamera(),l=pe(t),c=l.width||i.width*n.zoom,m=l.height||i.height*n.zoom;e.setCamera({zoom:n.zoom,x:c/2-(i.x+i.width/2)*n.zoom,y:m/2-(i.y+i.height/2)*n.zoom})}var ze=Symbol.for("vdesign.embed.handover");function Lt(e){return e[ze]}var Pt=["exact","browser"],Ct=["ready","problems","page","fonts"];async function fn(e,t){try{let{exactFontsAt:r}=await import("./chunks/fonts.js"),i=r(e);return(await i.ensure(t)).length===0?i:void 0}catch{return}}async function sr(e,t,r={}){let i=r.fit??"page";if(!Ne.includes(i))throw new TypeError(`view: fit must be one of ${Ne.join(", ")}; got ${String(i)}.`);let n=r.fonts??"exact";if(!Pt.includes(n))throw new TypeError(`view: fonts must be one of ${Pt.join(", ")}; got ${String(n)}.`);let l=n==="exact"?et(r.fontBase,Re,e.ownerDocument.baseURI):void 0,c=Lt(r),m=await Ae(t),u=c?.page!==void 0&&ee(m.document).some(o=>o.id===c.page)?c.page:r.page===void 0?ee(m.document)[0]?.id:ue(m.document,r.page).id,y=c?.exact&&l?await fn(l,m.document):void 0,f=e.ownerDocument,p=f.defaultView,A=At(m.blocks),S=m.blocks,E=[...m.problems],x,C=()=>x?[...E,x]:[...E],O=f.createElement("div");O.className="vd-embed",O.style.width="100%",O.style.height="100%",e.appendChild(O);let _=le(O,{document:m.document,interactive:r.interactive??!0,wheel:"modifier",resolveAsset:o=>A.resolve(o),...r.surface?{surface:r.surface}:{},...c?{camera:c.camera}:{},...y?{fonts:y.library}:{}}),N={ready:new Set,problems:new Set,page:new Set,fonts:new Set},$=!1,P=!1,F=0,I,U,K=y,z=n==="browser"?"browser":void 0,q;function X(){$=!0;for(let o of N.ready)o()}function W(){for(let o of N.problems)o(C())}function B(o){z=o;for(let h of N.fonts)h(o)}function te(){return q??=(async()=>{if(l)try{let{exactFontsAt:o}=await import("./chunks/fonts.js");return o(l)}catch{return}})(),q}function Z(o){K=void 0,_.setFonts(void 0),I?.fonts(void 0),x=o,W(),B("browser")}async function J(){let o=await te();if(!P){if(!o){Z(me([],l?"the fonts chunk would not load":"no fontBase was given and this build has no default"));return}for(;;){let h=_.getDocument(),g=await o.ensure(h);if(P)return;if(g.length>0){Z(me(g));return}if(_.getDocument()===h)break}K=o,_.setFonts(o.library),I?.fonts(o),B("exact")}}function H(){let o=Q(u);if(o)for(let h of N.page)h(o)}function Q(o){let h=ee(_.getDocument()).find(g=>g.id===o);if(h)return h.name===void 0?{id:h.id}:{id:h.id,name:h.name}}let G=()=>Tt(_,O,i,u),ne=()=>_t(_,O,u);function a(o){if(P)return;let h=ue(_.getDocument(),o).id,g=h!==u;u=h,i==="page"?G():ne(),g&&H()}function v(o){r.onLink?r.onLink(o):p?.open(o,"_blank","noopener,noreferrer")}let M=o=>{if(o.button!==0||I)return;let h=_.linkAt(_.screenToDocument(_.pointerPoint(o)));if(h===void 0)return;let g=ge(h);if(g){if(o.preventDefault(),g.kind==="frame"){ee(_.getDocument()).some(b=>b.id===g.id)&&a(g.id);return}v(g.url)}};O.addEventListener("click",M);let w=pe(O),L=p&&"ResizeObserver"in p?new p.ResizeObserver(()=>{let o=pe(O);o.width===w.width&&o.height===w.height||(w=o,G())}):void 0;L?.observe(O),c||(i==="none"&&u!==void 0&&r.page!==void 0?ne():G()),X(),y?B("exact"):n==="exact"&&J();let s={async load(o){if(P)throw new Error("view: this view was destroyed.");let h=++F,g=await Ae(o),b=K,T=b?await b.ensure(g.document):[];if(U&&await U||P||h!==F)return;T.length>0&&K===b&&Z(me(T)),A.replace(g.blocks),S=g.blocks,_.update(g.document),E=[...g.problems],I?.update(g.document),ee(g.document).some(k=>k.id===u)||(u=ee(g.document)[0]?.id,i==="page"?G():ne(),H()),W(),X()},pages:()=>ee(_.getDocument()).map(o=>o.name===void 0?{id:o.id}:{id:o.id,name:o.name}),goTo:a,fit:()=>{P||G()},play(o={}){if(P)return Promise.reject(new Error("view: this view was destroyed."));try{return I?.stop(),Promise.resolve(d(_.getDocument(),o.page))}catch(h){return Promise.reject(h instanceof Error?h:new Error(String(h)))}},async edit(o={}){if(P)throw new Error("view: this view was destroyed.");if(U)throw new Error("view: edit() is already opening an editor.");let h;U=new Promise(b=>h=b);let g=!1;try{let{edit:b}=await import("./edit.js");if(P)throw new Error("view: this view was destroyed.");let T={camera:_.getCamera(),page:u,exact:K!==void 0},R=Qe(_.getDocument(),S,E),k=await b(e,R,{...r,...o,[ze]:T});if(P)throw k.destroy(),new Error("view: this view was destroyed.");return g=!0,s.destroy(),k}finally{U=void 0,h(g)}},on(o,h){if(!Ct.includes(o))throw new TypeError(`view: on() takes one of ${Ct.join(", ")}; got ${String(o)}.`);let g=N[o];if(g.add(h),o==="ready"&&$&&queueMicrotask(()=>{g.has(h)&&h()}),o==="problems"&&queueMicrotask(()=>{g.has(h)&&h(C())}),o==="fonts"&&z!==void 0){let b=z;queueMicrotask(()=>{g.has(h)&&h(b)})}return()=>{g.delete(h)}},destroy(){if(!P){P=!0,I?.stop(),O.removeEventListener("click",M),L?.disconnect(),_.destroy(),A.destroy(),O.remove();for(let o of Object.values(N))o.clear()}}};function d(o,h){let g=h===void 0?u:ue(o,h).id,b=f.createElement("div");b.className="vd-embed__play",b.style.position="absolute",b.style.inset="0";let T=V=>V.stopPropagation();b.addEventListener("wheel",T);let R=f.activeElement;O.appendChild(b);let k=!1,re=()=>{if(k)return;k=!0,I===ie&&(I=void 0),Y.destroy(),b.removeEventListener("wheel",T);let V=b.contains(f.activeElement);b.remove(),V&&R&&"focus"in R&&typeof R.focus=="function"&&R.focus({preventScroll:!0})},ie={stop:re,update:V=>Y.update(V),fonts:V=>Y.viewer.setFonts(V?.library)},Y=Ie(b,{document:o,resolveAsset:V=>A.resolve(V),...K?{fonts:K.library}:{},...g===void 0?{}:{start:g},onExit:re,onLink:v});return I=ie,{goTo(V){if(k)return;let de=Y.viewer.getDocument(),xe=ue(de,V).id,he=ae(de,Y.viewer.getScene()).findIndex(Dt=>Dt.id===xe);he!==-1&&Y.go(he)},destroy:re}}return s}export{Ft as version,sr as view};
100
+ `;function ot(e){if(e.getElementById(rt))return;let t=e.createElement("style");t.id=rt,t.textContent=it,e.head.appendChild(t)}function at(e,t,r,i){return t?$t(e,t,r,i):Vt(e,r,i)}function Vt(e,t,r){let i=Oe(e,r);return{measurer:i,update:n=>{i.load(n,t)},afterPaint:()=>{},destroy:()=>i.destroy()}}var st=new WeakMap;function $t(e,t,r,i){let n,l,c,m=()=>{if(!n)throw new Error("canvasFonts: update() before measuring");return n};return{measurer:{advance:(y,f)=>m().measurer.advance(y,f),metrics:y=>m().measurer.metrics(y),itemize:y=>m().measurer.itemize(y)},update(y){n&&y.fonts===l||(c?.(),n?.dispose(),n=t.forDocument(y,r?{loader:r}:{}),l=y.fonts,c=n.onChange(i))},afterPaint(){let y=e.fonts;if(!n||!y||typeof FontFace!="function")return;let f=st.get(e);f||st.set(e,f=new Set);for(let p of n.usedFaces()){if(f.has(p.id))continue;f.add(p.id);let A=new FontFace(p.id,Ht(p.bytes),{weight:String(p.weight),style:p.style});y.add(A),A.load().catch(()=>y.delete(A))}},destroy(){c?.(),n?.dispose(),n=void 0}}}function Ht(e){return e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength)}var Bt=.01,jt=.004,ct=40,Ut=16;function le(e,t){ot(e.ownerDocument);let r=t.document,i=a=>at(e.ownerDocument,a,t.loadFont,()=>{$(r)}),n=i(t.fonts),l={advance:(a,v)=>n.measurer.advance(a,v),metrics:a=>n.measurer.metrics(a),itemize:a=>n.measurer.itemize?.(a)??[a]};n.update(r);let c=me(r),m=()=>t.resolveAsset?{measure:l,resolveAsset:t.resolveAsset}:{measure:l},u=ke(r,c,m()),y=t.camera??we,f=t.interactive??!0,p=t.wheel??"always";e.classList.add("vd-viewer"),t.surface&&(e.style.background=t.surface);let A=e.ownerDocument.createElementNS(j,"svg");A.setAttribute("class","vd-viewer__surface"),A.setAttribute("width","100%"),A.setAttribute("height","100%");let S=e.ownerDocument.createElementNS(j,"g");S.setAttribute("class","vd-viewer__camera"),S.style.isolation="isolate",A.appendChild(S);let E=e.ownerDocument.createElementNS(j,"defs");S.appendChild(E);let x=e.ownerDocument.createElementNS(j,"rect");x.setAttribute("class","vd-viewer__page"),S.appendChild(x),e.appendChild(A);let C=new Map;function O(){S.setAttribute("transform",_e(y))}function _(){N();let a=u.background!==void 0;x.setAttribute("x",String(u.x)),x.setAttribute("y",String(u.y)),x.setAttribute("width",String(a?u.width:0)),x.setAttribute("height",String(a?u.height:0)),D(x,"fill",u.background??null);let v=new Set,M=x;for(let w of u.items){v.add(w.id);let L=C.get(w.id);(!L||L.tagName!==dt(w))&&(L?.remove(),L=e.ownerDocument.createElementNS(j,dt(w)),L.setAttribute("data-vd-id",w.id),C.set(w.id,L)),Kt(L,w),M.nextSibling!==L&&S.insertBefore(L,M.nextSibling),M=L}for(let[w,L]of C)v.has(w)||(L.remove(),C.delete(w));n.afterPaint(),t.onSceneChange?.(u,r)}function N(){E.replaceChildren();let a=u.items.filter(v=>v.shadows.length>0);if(u.gradients.length>0||a.length>0){let v=`<svg xmlns="${j}">${u.gradients.map(Ye).join("")}${a.map(w=>qe(w)).join("")}</svg>`,M=new DOMParser().parseFromString(v,"image/svg+xml");for(let w of[...M.documentElement.children])E.appendChild(e.ownerDocument.importNode(w,!0))}for(let v of u.clips){let M=e.ownerDocument.createElementNS(j,"clipPath");M.setAttribute("id",ft(v.id)),v.parent!==void 0&&M.setAttribute("clip-path",Pe(v.parent));let w=e.ownerDocument.createElementNS(j,"rect");w.setAttribute("x",String(v.x)),w.setAttribute("y",String(v.y)),w.setAttribute("width",String(v.w)),w.setAttribute("height",String(v.h)),M.appendChild(w),E.appendChild(M)}}function $(a){r=a,n.update(r),c=me(r),u=ke(r,c,m()),_()}function P(a){let v=e.getBoundingClientRect();return{x:a.clientX-v.left,y:a.clientY-v.top}}let F=0,I=0;function U(){e.classList.add("vd-viewer--interacting"),I&&clearTimeout(I),I=setTimeout(()=>{I=0,e.classList.remove("vd-viewer--interacting")},180)}function K(){F&&(cancelAnimationFrame(F),F=0),O(),t.onCameraChange?.(y)}function z(a){y=a,K()}function q(a){y=a,U(),!F&&(F=requestAnimationFrame(()=>{F=0,O(),t.onCameraChange?.(y)}))}let X=null,W=null,B=!1,te=a=>{if(p==="modifier"&&!a.ctrlKey&&!a.metaKey)return;a.preventDefault();let v=P(a),M=a.deltaMode===1?Ut:a.deltaMode===2?e.clientHeight||800:1,w=a.deltaX*M,L=a.deltaY*M;if(a.ctrlKey||a.metaKey){let s=a.ctrlKey?Bt:jt,d=Math.max(-ct,Math.min(ct,L));q(xe(y,v,Math.exp(-d*s)));return}if(a.shiftKey&&w===0){q(fe(y,-L,0));return}q(fe(y,-w,-L))},Z=a=>{(a.button===1||a.button===0&&B)&&(a.preventDefault(),X=a.pointerId,W=P(a),e.setPointerCapture(a.pointerId))},J=a=>{if(X!==a.pointerId||!W)return;let v=P(a);q(fe(y,v.x-W.x,v.y-W.y)),W=v},H=a=>{X===a.pointerId&&(X=null,W=null,e.hasPointerCapture(a.pointerId)&&e.releasePointerCapture(a.pointerId))},Q=a=>{a.code==="Space"&&(B=!0)},G=a=>{a.code==="Space"&&(B=!1)};f&&(e.addEventListener("wheel",te,{passive:!1}),e.addEventListener("pointerdown",Z),e.addEventListener("pointermove",J),e.addEventListener("pointerup",H),e.addEventListener("pointercancel",H),e.ownerDocument.addEventListener("keydown",Q),e.ownerDocument.addEventListener("keyup",G)),O(),_();let ne={element:e,surface:A,update:$,getDocument:()=>r,getScene:()=>u,getResolution:()=>c,getMeasurer:()=>l,setFonts(a){n.destroy(),n=i(a),$(r)},getCamera:()=>y,setCamera:z,zoomBy(a,v){let M=e.getBoundingClientRect(),w=v??{x:M.width/2,y:M.height/2};z(xe(y,w,a))},fitToContent(a=32){let v=e.getBoundingClientRect();z(oe({x:u.x,y:u.y,width:u.width,height:u.height},{width:v.width||u.width,height:v.height||u.height},a))},screenToDocument:a=>ve(y,a),documentToScreen:a=>Te(y,a),pointerPoint:P,hitTest(a,v){for(let M=u.items.length-1;M>=0;M--){let w=u.items[M];if(w&&tn(w,a,en/y.zoom)&&(!v||v(w.id)))return w.id}return null},linkAt(a,v){for(let M=u.items.length-1;M>=0;M--){let w=u.items[M];if(w?.kind!=="text"||v&&!v(w.id))continue;let L=w.rotation===0?a:Ee(a,{x:w.x+w.w/2,y:w.y+w.h/2},-w.rotation);for(let s of w.lines){if(L.y<s.y||L.y>s.y+s.h)continue;let d=s.spans.find(o=>L.x>=o.x&&L.x<=o.x+o.w);if(d)return d.style.link}}},itemOf:a=>u.items.find(v=>v.id===a),elementOf:a=>C.get(a),destroy(){f&&(e.removeEventListener("wheel",te),e.removeEventListener("pointerdown",Z),e.removeEventListener("pointermove",J),e.removeEventListener("pointerup",H),e.removeEventListener("pointercancel",H),e.ownerDocument.removeEventListener("keydown",Q),e.ownerDocument.removeEventListener("keyup",G)),F&&cancelAnimationFrame(F),I&&clearTimeout(I),F=0,I=0,n.destroy(),e.classList.remove("vd-viewer--interacting"),A.remove(),C.clear(),e.classList.remove("vd-viewer")}};return t.autoFit&&ne.fitToContent(),ne}var Wt="vd-clip-";function ft(e){return Wt+e}function Pe(e){return`url(#${ft(e)})`}function dt(e){return Je(e)?"g":Le(e)}function Le(e){switch(e.kind){case"ellipse":return"ellipse";case"frame":return"rect";case"image":return e.href===void 0?"rect":"image";case"rect":return"rect";case"text":return"text";case"vector":return"path"}}function Kt(e,t){if(e.tagName!=="g"){ut(e,t);return}D(e,"clip-path",t.clip===void 0?null:Pe(t.clip)),e.style.mixBlendMode=t.blend==="normal"?"":t.blend;let r=e.firstElementChild;(!r||r.tagName!==Le(t))&&(r?.remove(),r=e.ownerDocument.createElementNS(j,Le(t)),e.appendChild(r)),ut(r,{...t,clip:void 0,blend:"normal"})}function ut(e,t){switch(D(e,"clip-path",t.clip===void 0?null:Pe(t.clip)),D(e,"transform",t.rotation===0?null:Xe(t)),e.style.mixBlendMode=t.blend==="normal"?"":t.blend,e.style.filter=t.shadows.length>0?`url(#${Ze}${t.id})`:"",t.kind){case"ellipse":Jt(e,t);return;case"frame":Gt(e,t);return;case"image":Yt(e,t);return;case"rect":Xt(e,t);return;case"text":qt(e,t);return;case"vector":Qt(e,t);return}}function Gt(e,t){e.setAttribute("class","vd-viewer__page"),e.setAttribute("x",String(t.x)),e.setAttribute("y",String(t.y)),e.setAttribute("width",String(t.w)),e.setAttribute("height",String(t.h)),D(e,"fill",t.background??null)}function Yt(e,t){if(e.setAttribute("x",String(t.x)),e.setAttribute("y",String(t.y)),e.setAttribute("width",String(t.w)),e.setAttribute("height",String(t.h)),D(e,"opacity",t.opacity<1?String(t.opacity):null),t.href===void 0){e.setAttribute("class","vd-viewer__missing"),D(e,"rx",t.radius>0?String(t.radius):null);return}e.setAttribute("href",t.href),e.setAttribute("preserveAspectRatio",Zt[t.fit])}var Zt={cover:"xMidYMid slice",contain:"xMidYMid meet",fill:"none"};function qt(e,t){D(e,"opacity",t.opacity<1?String(t.opacity):null),e.setAttribute("xml:space","preserve");let r=t.lines.flatMap(n=>n.spans).filter(n=>n.text!==""),i=e.ownerDocument;for(;e.childNodes.length>r.length;)e.lastChild?.remove();for(;e.childNodes.length<r.length;)e.appendChild(i.createElementNS(j,"tspan"));r.forEach((n,l)=>{let c=e.childNodes[l];c.textContent=n.text,c.setAttribute("x",String(n.x)),c.setAttribute("y",String(n.y)),c.setAttribute("font-family",n.style.family),c.setAttribute("font-size",String(n.style.size)),c.setAttribute("fill",n.style.fill),D(c,"font-weight",n.style.weight===400?null:String(n.style.weight)),D(c,"font-style",n.style.italic?"italic":null),D(c,"letter-spacing",n.style.letterSpacing===0?null:String(n.style.letterSpacing)),D(c,"data-vd-link",n.style.link??null);let m=[n.style.underline?"underline":"",n.style.strike?"line-through":""].filter(Boolean).join(" ");D(c,"text-decoration",m===""?null:m)})}function Xt(e,t){e.removeAttribute("class"),e.setAttribute("x",String(t.x)),e.setAttribute("y",String(t.y)),e.setAttribute("width",String(t.w)),e.setAttribute("height",String(t.h)),e.setAttribute("fill",t.fill),D(e,"rx",t.radius>0?String(t.radius):null),D(e,"stroke",t.stroke??null),D(e,"stroke-width",t.stroke&&t.strokeWidth>0?String(t.strokeWidth):null),D(e,"opacity",t.opacity<1?String(t.opacity):null)}function lt(e,t){e.setAttribute("fill",t.fill),D(e,"stroke",t.stroke??null),D(e,"stroke-width",t.stroke&&t.strokeWidth>0?String(t.strokeWidth):null),D(e,"opacity",t.opacity<1?String(t.opacity):null)}function Jt(e,t){e.setAttribute("cx",String(t.x+t.w/2)),e.setAttribute("cy",String(t.y+t.h/2)),e.setAttribute("rx",String(t.w/2)),e.setAttribute("ry",String(t.h/2)),lt(e,t)}function Qt(e,t){e.setAttribute("d",t.d),lt(e,t),D(e,"fill-rule",t.rule==="nonzero"?null:t.rule),D(e,"stroke-linecap",t.cap==="butt"?null:t.cap),D(e,"stroke-linejoin",t.join==="miter"?null:t.join)}function D(e,t,r){r===null?e.removeAttribute(t):e.setAttribute(t,r)}var en=4;function tn(e,t,r){let i=e.rotation===0?t:Ee(t,{x:e.x+e.w/2,y:e.y+e.h/2},-e.rotation),n=i.x>=e.x&&i.x<=e.x+e.w&&i.y>=e.y&&i.y<=e.y+e.h;if(e.kind==="ellipse"){let l=e.stroke!==void 0?e.strokeWidth/2:0,c=e.w/2+l,m=e.h/2+l;if(c<=0||m<=0)return!1;let u=(i.x-(e.x+e.w/2))/c,y=(i.y-(e.y+e.h/2))/m;return u*u+y*y<=1}if(e.kind==="vector"){let l=e.stroke!==void 0&&e.strokeWidth>0;return Ue(e.contours,i,{fill:e.fill!=="none",rule:e.rule,reach:(l?e.strokeWidth/2:0)+r})}return n}function ae(e,t){let r=new Map;for(let n of t.items)n.kind==="frame"&&n.w>0&&n.h>0&&r.set(n.id,{id:n.id,x:n.x,y:n.y,w:n.w,h:n.h});let i=e.root.children.flatMap(n=>{let l=n.type==="frame"?r.get(n.id):void 0;return l&&n.type==="frame"?[{...l,skip:n.skip===!0}]:[]});return i.length===0?[{id:null,x:t.x,y:t.y,w:t.width,h:t.height,skip:!1}]:i.every(n=>n.skip)?i.map(n=>({...n,skip:!1})):i}function pt(e,t){return e.root.children.find(i=>i.type==="frame"&&$e(i,t)!==void 0)?.id}function ht(e,t){let r=t===void 0?-1:e.findIndex(i=>i.id===t);return r!==-1?r:Math.max(0,e.findIndex(i=>!i.skip))}function ce(e,t,r){for(let i=t+r;i>=0&&i<e.length;i+=r)if(!e[i]?.skip)return i;return t}function gt(e){return e.filter(t=>!t.skip).length}function Ce(e,t){return e[t]?.skip!==!1?null:e.slice(0,t+1).filter(r=>!r.skip).length}function mt(e,t){if(!/^\d+$/.test(e))return null;let r=Number(e),i=t.findIndex((n,l)=>Ce(t,l)===r);return i===-1?null:i}function yt(e,t,r){let i=pt(e,r),n=t.findIndex(l=>l.id!==null&&l.id===i);return n===-1?null:n}var nn="cubic-bezier(0.2, 0, 0, 1)",rn="cubic-bezier(0.4, 0, 1, 1)",wt="cubic-bezier(0.4, 0, 0.2, 1)";function vt(e,t,r,i,n){let l={opacity:r},c=on(e,t,i,n);if(e==="cut")return{keyframes:t==="enter"?[{visibility:"hidden"},{visibility:"hidden"}]:[{visibility:"visible"},{visibility:"visible"}],easing:"linear"};if(e==="pop"){let m=`${n.x}px ${n.y}px`;l.scale="1",l.transformOrigin=m}else(e==="rise"||e==="drop")&&(l.translate="0 0");return t==="enter"?{keyframes:[c,l],easing:nn}:{keyframes:[l,c],easing:rn}}function on(e,t,r,i){switch(e){case"rise":return{opacity:0,translate:`0 ${t==="enter"?r:-r}px`};case"drop":return{opacity:0,translate:`0 ${t==="enter"?-r:r}px`};case"pop":return{opacity:0,scale:String(.85),transformOrigin:`${i.x}px ${i.y}px`};case"fade":case"cut":return{opacity:0}}}function xt(e,t){let r=t==="forward"?"-100%":"100%",i=t==="forward"?"100%":"-100%";switch(e){case"cut":return null;case"fade":return{still:[{opacity:1},{opacity:0}],live:null,stillOnTop:!0};case"push":return{still:[{translate:"0 0"},{translate:`${r} 0`}],live:[{translate:`${i} 0`},{translate:"0 0"}],stillOnTop:!1};case"slide":return t==="forward"?{still:null,live:[{translate:"100% 0"},{translate:"0 0"}],stillOnTop:!1}:{still:[{translate:"0 0"},{translate:"100% 0"}],live:null,stillOnTop:!0}}}var sn={enter:"cut",duration:0,steps:[[]],clicks:new Map};function De(e){let t=new Map,r=new Map,i=new Map;Ve(e.root,(m,u)=>{u&&(r.set(m.id,u.id),i.set(u.id,[...i.get(u.id)??[],m.id]))});let n=je(e),l=Be(e);for(let[m,u]of Object.entries(e.motion??{})){if(!l.has(m))continue;let y=[[]],f=new Map;for(let p of u.lines){if(p.id===m||n.get(p.id)!==m)continue;let A=p.go===void 0?void 0:He(p.go);A&&f.set(p.id,A);let S=p.enter!==void 0?"enter":p.exit!==void 0?"exit":null,E=p.enter??p.exit;S===null||E===void 0||(p.step&&y.push([]),y.at(-1).push({id:p.id,kind:S,effect:E,duration:E==="cut"?0:p.duration??Se,delay:p.delay??0,together:p.together===!0}))}t.set(m,{enter:u.enter??"cut",duration:u.duration??Se,steps:y,clicks:f})}let c=m=>[m,...(i.get(m)??[]).flatMap(u=>c(u))];return{pages:t,parents:r,within:c}}function bt(e,t){let r=t?.id;return(r?e.pages.get(r):void 0)??sn}function Fe(e){let t=0,r=0;return e.map((i,n)=>(t=(n===0?0:i.together?t:r)+i.delay,r=t+i.duration,{build:i,at:t}))}function St(e){return Math.max(0,...Fe(e).map(({build:t,at:r})=>r+t.duration))}function se(e,t){let r=new Set,i=new Set;for(let n of e.steps.flat())i.has(n.id)||(i.add(n.id),n.kind==="enter"&&r.add(n.id));for(let n of e.steps.slice(0,t).flat())n.kind==="enter"?r.delete(n.id):r.add(n.id);return r}function Et(e,t,r){for(let i=r;i!==void 0;i=e.parents.get(i)){let n=t.clicks.get(i);if(n)return{id:i,target:n}}}function kt(e,t,r){let i=[...e];for(;i.length>0;){let n=i.pop(),l=t.findIndex(c=>c.id!==null&&c.id===n);if(l!==-1&&l!==r)return{index:l,history:i}}return null}var cn=1500,dn=2e3,un=50;function Ie(e,t){let r=e.ownerDocument;e.classList.add("vd-player"),e.tabIndex=-1;let i=new Set,n=new Set,l=!1,c=le(e,{document:t.document,interactive:!1,surface:"#000",...t.fonts?{fonts:t.fonts}:{},...t.loadFont?{loadFont:t.loadFont}:{},...t.resolveAsset?{resolveAsset:t.resolveAsset}:{},onSceneChange:()=>{l&&z()}}),m=r.createElementNS(j,"path");m.setAttribute("class","vd-player__mask"),m.setAttribute("fill","#000"),m.setAttribute("fill-rule","evenodd"),c.surface.appendChild(m);let u=r.createElement("div");u.className="vd-player__counter",u.setAttribute("aria-live","polite"),e.appendChild(u);let y=De(t.document),f=ae(t.document,c.getScene()),p=ht(f,t.start),A=[],S=0,E=[],x,C=0,O="",_,N,$=r.defaultView,P=()=>typeof c.surface.animate=="function"&&!($?.matchMedia?.("(prefers-reduced-motion: reduce)").matches??!1),F=()=>bt(y,f[p]);function I(){let s=e.getBoundingClientRect(),d=f[p];return{width:s.width||d?.w||1,height:s.height||d?.h||1}}function U(){let s=f[p];if(!s)return;let d=I(),o=oe({x:s.x,y:s.y,width:s.w,height:s.h},d,0);c.setCamera(o);let h=s.x*o.zoom+o.x,g=s.y*o.zoom+o.y,b=s.w*o.zoom,T=s.h*o.zoom;m.setAttribute("d",`M0 0H${d.width}V${d.height}H0ZM${h} ${g}h${b}v${T}h${-b}Z`),m.dataset.slide=s.id??""}function K(){let s=Ce(f,p),d=gt(f);u.textContent=s===null?"Skipped":`${s} / ${d}`,u.classList.add("vd-player__counter--shown"),_&&clearTimeout(_),_=setTimeout(()=>u.classList.remove("vd-player__counter--shown"),cn),t.onChange?.(s,d)}function z(){let s=new Set;for(let d of i)for(let o of y.within(d))s.add(o);n=s;for(let d of c.surface.querySelectorAll("[data-vd-hidden]")){let o=d.getAttribute("data-vd-id");(o===null||!s.has(o))&&d.removeAttribute("data-vd-hidden")}for(let d of s)c.elementOf(d)?.setAttribute("data-vd-hidden","")}function q(s){return y.within(s).flatMap(d=>{let o=c.elementOf(d);return o?[o]:[]})}function X(s){let d=1/0,o=1/0,h=-1/0,g=-1/0;for(let b of y.within(s)){let T=c.itemOf(b);T&&(d=Math.min(d,T.x),o=Math.min(o,T.y),h=Math.max(h,T.x+T.w),g=Math.max(g,T.y+T.h))}return Number.isFinite(d)?{x:(d+h)/2,y:(o+g)/2}:{x:0,y:0}}function W(){if(!(E.length===0&&!x)){C+=1,S===0&&(S=1),i=se(F(),S),z();for(let s of E)s.cancel();E=[],x?.remove(),x=void 0}}function B(){return E.length===0&&!x?!1:(W(),!0)}function te(s,d){return new Promise(o=>{let h=!1,g=()=>{h||(h=!0,o())};Promise.all(s.map(b=>b.finished)).then(g,()=>{h=!0}),setTimeout(()=>{if(!h){for(let b of s)(b.playState==="running"||b.playState==="paused")&&b.finish();g()}},d+un)})}function Z(s,d,o){if(s===p||!f[s])return;let h=F();p=s;let g=F(),b=o==="forward"?g:h,T=P()?xt(b.enter,o):null;if(T&&(x=c.surface.cloneNode(!0),x.classList.add("vd-player__still"),x.setAttribute("aria-hidden","true"),T.stillOnTop?c.surface.after(x):c.surface.before(x)),U(),S=d?0:g.steps.length,i=se(g,S),z(),K(),!T||!x){d&&J();return}let R={duration:b.duration,easing:wt},k=[];T.still&&k.push(x.animate(T.still,{...R,fill:"forwards"})),T.live&&k.push(c.surface.animate(T.live,R)),E.push(...k);let re=C;te(k,b.duration).then(()=>{if(re===C){E=E.filter(ie=>!k.includes(ie));for(let ie of k)ie.cancel();x?.remove(),x=void 0,d&&J()}})}function J(){let s=F(),d=s.steps[S];if(d===void 0)return;S+=1;let o=se(s,S);if(d.length===0)return;if(!P()){i=o,z();return}let h=new Set(d.filter(k=>k.kind==="enter").map(k=>k.id));i=new Set([...se(s,S-1)].filter(k=>!h.has(k))),z();let g=f[p],b=.04*Math.min(g?.w??0,g?.h??0),T=C,R=[];for(let{build:k,at:re}of Fe(d)){let ie=X(k.id),Y=[];for(let V of q(k.id)){let de=Number(V.getAttribute("opacity")??1),{keyframes:be,easing:he}=vt(k.effect,k.kind,Number.isFinite(de)?de:1,b,ie);Y.push(V.animate(be,{duration:k.duration,delay:re,easing:he,fill:k.kind==="enter"?"backwards":"forwards"}))}R.push(...Y),k.kind==="exit"&&Y.length>0&&te(Y,re+k.duration).then(()=>{if(T===C){i.add(k.id),z();for(let V of Y)V.cancel()}})}E.push(...R),te(R,St(d)).then(()=>{if(T===C){E=E.filter(k=>!R.includes(k)),i=o,z();for(let k of R)k.cancel()}})}function H(s){let d=Math.min(Math.max(0,s),f.length-1);if(d===p)return;let o=f[p]?.id;o&&A.push(o),Z(d,!0,"forward")}function Q(){if(!B()){if(S<F().steps.length){J();return}H(ce(f,p,1))}}function G(){if(B())return;let s=kt(A,f,p);if(s){A=s.history,Z(s.index,!1,"back");return}Z(ce(f,p,-1),!1,"back")}function ne(s){switch(s.kind){case"url":t.onLink?.(s.url);return;case"back":G();return;case"next":H(ce(f,p,1));return;case"frame":{let d=yt(c.getDocument(),f,s.id);d===null?Q():H(d)}}}function a(s){let d=f[p];if(!d||s.x<d.x||s.y<d.y||s.x>d.x+d.w||s.y>d.y+d.h)return;let o=T=>!n.has(T),h=c.hitTest(s,o),g=h===null?void 0:Et(y,F(),h);if(g)return g.target;let b=c.linkAt(s,o);return b===void 0?void 0:ge(b)}let v=s=>{if(s.stopPropagation(),s.metaKey||s.ctrlKey||s.altKey)return;let d=s.key;if(/^\d$/.test(d))O+=d;else if(d==="Enter"&&O!==""){let o=mt(O,f);O="",!B()&&o!==null&&H(o)}else if(d==="Escape")O!==""?O="":t.onExit?.();else if(["ArrowRight","ArrowDown","PageDown"," ","Enter"].includes(d))O="",Q();else if(["ArrowLeft","ArrowUp","PageUp","Backspace"].includes(d))O="",G();else if(d==="Home")B()||H(ce(f,-1,1));else if(d==="End")B()||H(ce(f,f.length,-1));else return;s.preventDefault()},M=s=>{if(B())return;let d=a(c.screenToDocument(c.pointerPoint(s)));d?ne(d):Q()},w=s=>{if(e.classList.remove("vd-player--idle"),N&&clearTimeout(N),N=setTimeout(()=>e.classList.add("vd-player--idle"),dn),!s)return;let d=c.screenToDocument(c.pointerPoint(s));e.classList.toggle("vd-player--link",a(d)!==void 0)},L=$&&"ResizeObserver"in $?new $.ResizeObserver(()=>U()):void 0;return L?.observe(e),e.addEventListener("keydown",v),e.addEventListener("click",M),e.addEventListener("pointermove",w),l=!0,U(),i=se(F(),0),z(),K(),w(),e.focus({preventScroll:!0}),J(),{viewer:c,index:()=>p,count:()=>f.length,next:Q,back:G,go(s){W(),H(s)},update(s){if(s===c.getDocument())return;W();let d=f[p]?.id;c.update(s),y=De(s),f=ae(s,c.getScene());let o=f.findIndex(h=>h.id===d);p=o===-1?Math.min(p,f.length-1):o,U(),S=F().steps.length,i=se(F(),S),z()},refit:U,destroy(){C+=1;for(let s of E)s.cancel();E=[],x?.remove(),L?.disconnect(),e.removeEventListener("keydown",v),e.removeEventListener("click",M),e.removeEventListener("pointermove",w),_&&clearTimeout(_),N&&clearTimeout(N),m.remove(),u.remove(),c.destroy(),e.classList.remove("vd-player","vd-player--idle","vd-player--link"),e.removeAttribute("tabindex")}}}function At(e){let t=e,r=new Map,i=typeof URL.createObjectURL=="function"&&typeof URL.revokeObjectURL=="function";return{resolve(n){let l=r.get(n.hash);if(l!==void 0)return l;let c=t.get(n.hash);if(c===void 0)return;if(!i)return We(n.type,c);let m;try{m=Ke(c)}catch{return}let u=URL.createObjectURL(new Blob([m],{type:n.type}));return r.set(n.hash,u),u},replace(n){t=n;for(let[l,c]of r)n.has(l)||(URL.revokeObjectURL(c),r.delete(l))},destroy(){for(let n of r.values())URL.revokeObjectURL(n);r.clear(),t=new Map}}}var Ne=["page","content","none"],Ot=24;function pe(e){let t=e.getBoundingClientRect();return{width:t.width,height:t.height}}function Mt(e,t){let r=t===void 0?void 0:e.itemOf(t);if(!(!r||r.w<=0||r.h<=0))return{x:r.x,y:r.y,width:r.w,height:r.h}}function Tt(e,t,r,i){if(r==="none")return;let n=r==="page"?Mt(e,i):void 0;if(!n){e.fitToContent(Ot);return}let l=pe(t);e.setCamera(oe(n,{width:l.width||n.width,height:l.height||n.height},Ot))}function _t(e,t,r){let i=Mt(e,r);if(!i)return;let n=e.getCamera(),l=pe(t),c=l.width||i.width*n.zoom,m=l.height||i.height*n.zoom;e.setCamera({zoom:n.zoom,x:c/2-(i.x+i.width/2)*n.zoom,y:m/2-(i.y+i.height/2)*n.zoom})}var ze=Symbol.for("vdesign.embed.handover");function Lt(e){return e[ze]}var Pt=["exact","browser"],Ct=["ready","problems","page","fonts"];async function fn(e,t){try{let{exactFontsAt:r}=await import("./chunks/fonts.js"),i=r(e);return(await i.ensure(t)).length===0?i:void 0}catch{return}}async function ur(e,t,r={}){let i=r.fit??"page";if(!Ne.includes(i))throw new TypeError(`view: fit must be one of ${Ne.join(", ")}; got ${String(i)}.`);let n=r.fonts??"exact";if(!Pt.includes(n))throw new TypeError(`view: fonts must be one of ${Pt.join(", ")}; got ${String(n)}.`);let l=n==="exact"?et(r.fontBase,Re,e.ownerDocument.baseURI):void 0,c=Lt(r),m=await Ae(t),u=c?.page!==void 0&&ee(m.document).some(o=>o.id===c.page)?c.page:r.page===void 0?ee(m.document)[0]?.id:ue(m.document,r.page).id,y=c?.exact&&l?await fn(l,m.document):void 0,f=e.ownerDocument,p=f.defaultView,A=At(m.blocks),S=m.blocks,E=[...m.problems],x,C=()=>x?[...E,x]:[...E],O=f.createElement("div");O.className="vd-embed",O.style.width="100%",O.style.height="100%",e.appendChild(O);let _=le(O,{document:m.document,interactive:r.interactive??!0,wheel:"modifier",resolveAsset:o=>A.resolve(o),...r.surface?{surface:r.surface}:{},...c?{camera:c.camera}:{},...y?{fonts:y.library}:{}}),N={ready:new Set,problems:new Set,page:new Set,fonts:new Set},$=!1,P=!1,F=0,I,U,K=y,z=n==="browser"?"browser":void 0,q;function X(){$=!0;for(let o of N.ready)o()}function W(){for(let o of N.problems)o(C())}function B(o){z=o;for(let h of N.fonts)h(o)}function te(){return q??=(async()=>{if(l)try{let{exactFontsAt:o}=await import("./chunks/fonts.js");return o(l)}catch{return}})(),q}function Z(o){K=void 0,_.setFonts(void 0),I?.fonts(void 0),x=o,W(),B("browser")}async function J(){let o=await te();if(!P){if(!o){Z(ye([],l?"the fonts chunk would not load":"no fontBase was given and this build has no default"));return}for(;;){let h=_.getDocument(),g=await o.ensure(h);if(P)return;if(g.length>0){Z(ye(g));return}if(_.getDocument()===h)break}K=o,_.setFonts(o.library),I?.fonts(o),B("exact")}}function H(){let o=Q(u);if(o)for(let h of N.page)h(o)}function Q(o){let h=ee(_.getDocument()).find(g=>g.id===o);if(h)return h.name===void 0?{id:h.id}:{id:h.id,name:h.name}}let G=()=>Tt(_,O,i,u),ne=()=>_t(_,O,u);function a(o){if(P)return;let h=ue(_.getDocument(),o).id,g=h!==u;u=h,i==="page"?G():ne(),g&&H()}function v(o){r.onLink?r.onLink(o):p?.open(o,"_blank","noopener,noreferrer")}let M=o=>{if(o.button!==0||I)return;let h=_.linkAt(_.screenToDocument(_.pointerPoint(o)));if(h===void 0)return;let g=ge(h);if(g){if(o.preventDefault(),g.kind==="frame"){ee(_.getDocument()).some(b=>b.id===g.id)&&a(g.id);return}v(g.url)}};O.addEventListener("click",M);let w=pe(O),L=p&&"ResizeObserver"in p?new p.ResizeObserver(()=>{let o=pe(O);o.width===w.width&&o.height===w.height||(w=o,G())}):void 0;L?.observe(O),c||(i==="none"&&u!==void 0&&r.page!==void 0?ne():G()),X(),y?B("exact"):n==="exact"&&J();let s={async load(o){if(P)throw new Error("view: this view was destroyed.");let h=++F,g=await Ae(o),b=K,T=b?await b.ensure(g.document):[];if(U&&await U||P||h!==F)return;T.length>0&&K===b&&Z(ye(T)),A.replace(g.blocks),S=g.blocks,_.update(g.document),E=[...g.problems],I?.update(g.document),ee(g.document).some(k=>k.id===u)||(u=ee(g.document)[0]?.id,i==="page"?G():ne(),H()),W(),X()},pages:()=>ee(_.getDocument()).map(o=>o.name===void 0?{id:o.id}:{id:o.id,name:o.name}),goTo:a,fit:()=>{P||G()},play(o={}){if(P)return Promise.reject(new Error("view: this view was destroyed."));try{return I?.stop(),Promise.resolve(d(_.getDocument(),o.page))}catch(h){return Promise.reject(h instanceof Error?h:new Error(String(h)))}},async edit(o={}){if(P)throw new Error("view: this view was destroyed.");if(U)throw new Error("view: edit() is already opening an editor.");let h;U=new Promise(b=>h=b);let g=!1;try{let{edit:b}=await import("./edit.js");if(P)throw new Error("view: this view was destroyed.");let T={camera:_.getCamera(),page:u,exact:K!==void 0},R=Qe(_.getDocument(),S,E),k=await b(e,R,{...r,...o,[ze]:T});if(P)throw k.destroy(),new Error("view: this view was destroyed.");return g=!0,s.destroy(),k}finally{U=void 0,h(g)}},on(o,h){if(!Ct.includes(o))throw new TypeError(`view: on() takes one of ${Ct.join(", ")}; got ${String(o)}.`);let g=N[o];if(g.add(h),o==="ready"&&$&&queueMicrotask(()=>{g.has(h)&&h()}),o==="problems"&&queueMicrotask(()=>{g.has(h)&&h(C())}),o==="fonts"&&z!==void 0){let b=z;queueMicrotask(()=>{g.has(h)&&h(b)})}return()=>{g.delete(h)}},destroy(){if(!P){P=!0,I?.stop(),O.removeEventListener("click",M),L?.disconnect(),_.destroy(),A.destroy(),O.remove();for(let o of Object.values(N))o.clear()}}};function d(o,h){let g=h===void 0?u:ue(o,h).id,b=f.createElement("div");b.className="vd-embed__play",b.style.position="absolute",b.style.inset="0";let T=V=>V.stopPropagation();b.addEventListener("wheel",T);let R=f.activeElement;O.appendChild(b);let k=!1,re=()=>{if(k)return;k=!0,I===ie&&(I=void 0),Y.destroy(),b.removeEventListener("wheel",T);let V=b.contains(f.activeElement);b.remove(),V&&R&&"focus"in R&&typeof R.focus=="function"&&R.focus({preventScroll:!0})},ie={stop:re,update:V=>Y.update(V),fonts:V=>Y.viewer.setFonts(V?.library)},Y=Ie(b,{document:o,resolveAsset:V=>A.resolve(V),...K?{fonts:K.library}:{},...g===void 0?{}:{start:g},onExit:re,onLink:v});return I=ie,{goTo(V){if(k)return;let de=Y.viewer.getDocument(),be=ue(de,V).id,he=ae(de,Y.viewer.getScene()).findIndex(Dt=>Dt.id===be);he!==-1&&Y.go(he)},destroy:re}}return s}export{Ft as version,ur as view};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getv.design/embed",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Render, present and edit vDesign (.vd) documents in any web page. Free to use.",
5
5
  "license": "SEE LICENSE IN LICENSE",
6
6
  "author": {
@@ -1,2 +0,0 @@
1
- /*! @getv.design/embed v0.1.0. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
- var _="0.1.0",e="https://cdn.jsdelivr.net/npm/@getv.design/embed@0.1.0/fonts/";export{_ as a,e as b};
@@ -1,8 +0,0 @@
1
- /*! @getv.design/embed v0.1.0. Free to use under the vDesign Embed Licence. © 2026 Sagar Saini. https://getv.design/docs/licence/ */
2
- function D(e){let n=e.trim();if(n.startsWith("#")){let r=n.slice(1);return r===""?void 0:{kind:"frame",id:r}}let t;try{t=new URL(n)}catch{return}if(!(t.protocol!=="https:"&&t.protocol!=="mailto:"))return{kind:"url",url:n}}var G="--- payload base64 ---",_t="sha256-";function Un(e){let n=Vt(e);return n===-1?{head:e,payload:""}:{head:e.slice(0,n),payload:e.slice(n+G.length)}}function Pt(e){let{head:n,payload:t}=Un(e);return{head:n,blocks:Wn(t)}}function Wn(e){let n=new Map;for(let t of e.split(`
3
- `)){let r=t.indexOf(" ");if(r===-1)continue;let o=t.slice(0,r);o.startsWith(_t)&&n.set(o,t.slice(r+1).trim())}return n}function Rt(e,n){return`data:${e};base64,${n}`}function Lt(e){let n=Uint8Array.fromBase64;if(typeof n=="function")return n(e);let t=atob(e),r=new Uint8Array(t.length);for(let o=0;o<t.length;o+=1)r[o]=t.charCodeAt(o);return r}function Vt(e){if(e.startsWith(G))return 0;let n=e.indexOf(`
4
- ${G}`);return n===-1?-1:n+1}function Q(e){return{expr:e}}function P(e){return typeof e=="object"&&e!==null&&typeof e.expr=="string"}var ye=["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],ee=["left","center","right","justify"],ne=["top","middle","bottom"],te=["cover","contain","fill"],me=["nonzero","evenodd"],ge=["butt","round","square"],xe=["miter","round","bevel"],Bn=["canvas","frame","group"];function $e(e){return Bn.includes(e)}function _(e){return $e(e.type)}function re(e){return e.type==="group"}var zn={canvas:["w","h"],ellipse:["x","y","w","h","rotation","strokeWidth","opacity"],frame:["x","y","w","h"],group:[],image:["x","y","w","h","rotation","radius","opacity"],rect:["x","y","w","h","rotation","strokeWidth","radius","opacity"],text:["x","y","w","h","rotation","size","weight","lineHeight","letterSpacing","opacity"],vector:["x","y","w","h","rotation","strokeWidth","opacity"]};function we(e){return zn[e.type]}function N(e,n,t){if(n(e,t)!==!1&&_(e))for(let r of e.children)N(r,n,e)}function Xe(e,n){let t;return N(e,r=>{if(t)return!1;r.id===n&&(t=r)}),t}var oe=["design"],J="design";var ke=[1,2,3,4],F="doc";function ie(e){return{type:"canvas",...e}}function ve(e={}){return{version:4,kind:e.kind??J,...e.title===void 0?{}:{title:e.title},tokens:e.tokens??{},fonts:e.fonts??{},assets:e.assets??{},...e.motion===void 0||Object.keys(e.motion).length===0?{}:{motion:e.motion},root:e.root??ie({id:F,children:[]})}}var be=["cut","fade","push","slide"],Ee=["cut","fade","rise","drop","pop"],Dt=400,se=1e4;function X(e){let n=e.trim();return n==="back"?{kind:"back"}:n==="next"?{kind:"next"}:D(n)}function ae(e){return e===void 0||e.enter===void 0&&e.duration===void 0&&e.lines.length===0}function Se(e){return e.enter!==void 0||e.exit!==void 0||e.go!==void 0}function Oe(e){let n=e.motion;if(!n)return[];let t=e.root.children.map(o=>o.id).filter(o=>o in n),r=Object.keys(n).filter(o=>!t.includes(o)).sort();return[...t,...r]}function Ye(e){return new Set(e.root.children.filter(n=>n.type==="frame").map(n=>n.id))}function He(e){let n=new Map;for(let t of e.root.children)t.type==="frame"&&N(t,r=>{n.set(r.id,t.id)});return n}function Ft(e){let n=new Set;return N(e,t=>{n.add(t.id)}),n}function ue(e,n){let t=e.motion;if(!t)return[];let r=[],o=Ye(e),i=He(e),s=Ft(e.root),u=(a,c)=>{let f=n?.(a,c);return f===void 0?"":`Line ${f}: `};for(let a of Oe(e)){let c=t[a];if(c){if(!o.has(a)){r.push({severity:"warning",code:"motion-not-a-page",message:`${u(a)}motion ${a}: ${a} is not a page (a top-level frame), so none of it plays`,nodeId:a});continue}for(let f of c.lines){let d=u(a,f.id);s.has(f.id)?i.get(f.id)!==a&&r.push({severity:"warning",code:"motion-wrong-page",message:`${d}motion ${a}: ${f.id} is not on ${a}, so Play skips it`,nodeId:f.id}):r.push({severity:"warning",code:"unknown-reference",message:`${d}motion ${a}: no node ${f.id}`,nodeId:f.id});let l=f.go===void 0?void 0:X(f.go);l?.kind==="frame"&&!jt(e,l.id)&&r.push({severity:"warning",code:"unknown-reference",message:`${d}motion ${a}: go=#${l.id} names no frame`,nodeId:f.id})}}}return r}function jt(e,n){let t=!1;return N(e.root,r=>{if(t)return!1;r.id===n&&(t=r.type==="frame")}),t}function h(e){if(!Number.isFinite(e))return"0";let n=Math.round(e*1e4)/1e4,t=Object.is(n,-0)?0:n;return Math.abs(t)>=1e21?t.toFixed(0):String(t)}var Ct={M:2,L:2,H:1,V:1,C:6,S:4,Q:4,T:2,A:7,Z:0};function Ke(e){let n=[],t,r=0,o=0,i=0,s=0,u,a,c=Wt(e),f=()=>(t||(t={anchors:[{x:r,y:o}],closed:!1},n.push(t)),t.anchors[t.anchors.length-1]),d=(p,$)=>{f(),t?.anchors.push({x:p,y:$}),r=p,o=$},l=(p,$,k,g)=>{f().out=p,t?.anchors.push({x:k,y:g,in:$}),r=k,o=g},y="",b=!0;for(;c.more();){let p=c.command();if(p!==void 0)y=p,b=!0;else if(y===""||y.toUpperCase()==="Z")return{contours:Me(n),error:`Expected a command at ${c.at()}`};let $=y.toUpperCase(),k=y!==$,g=Ct[$];if(g===void 0)return{contours:Me(n),error:`Unknown command ${y}`};if($==="Z"){t&&(t.closed=!0),t=void 0,r=i,o=s,u=void 0,a=void 0,y="";continue}let T=$==="A"?c.arc():c.numbers(g);if(T===void 0)return{contours:Me(n),error:`${y} expects ${g} numbers at ${c.at()}`};let m=k?r:0,w=k?o:0,x=v=>T[v];switch($){case"M":b&&(t={anchors:[{x:m+x(0),y:w+x(1)}],closed:!1},n.push(t),r=i=m+x(0),o=s=w+x(1),y=k?"l":"L"),u=a=void 0;break;case"L":d(m+x(0),w+x(1)),u=a=void 0;break;case"H":d(m+x(0),o),u=a=void 0;break;case"V":d(r,w+x(0)),u=a=void 0;break;case"C":{let v={x:m+x(2),y:w+x(3)};l({x:m+x(0),y:w+x(1)},v,m+x(4),w+x(5)),u=v,a=void 0;break}case"S":{let v=u?{x:2*r-u.x,y:2*o-u.y}:{x:r,y:o},S={x:m+x(0),y:w+x(1)};l(v,S,m+x(2),w+x(3)),u=S,a=void 0;break}case"Q":case"T":{let v=$==="Q"?{x:m+x(0),y:w+x(1)}:a?{x:2*r-a.x,y:2*o-a.y}:{x:r,y:o},S=$==="Q"?m+x(2):m+x(0),L=$==="Q"?w+x(3):w+x(1),C={x:r+2/3*(v.x-r),y:o+2/3*(v.y-o)},U={x:S+2/3*(v.x-S),y:L+2/3*(v.y-L)};l(C,U,S,L),a=v,u=void 0;break}case"A":{let v=m+x(5),S=w+x(6);for(let[L,C,U]of Bt(r,o,x(0),x(1),x(2),x(3)!==0,x(4)!==0,v,S))l(L,C,U.x,U.y);(r!==v||o!==S)&&d(v,S),u=a=void 0;break}}b=!1}return{contours:Me(n)}}function Me(e){return e.map(n=>{let t=[...n.anchors];if(n.closed&&t.length>1){let r=t[0],o=t[t.length-1];ce(r,o)&&(t.pop(),t[0]={...r,...o.in?{in:o.in}:{}})}return{anchors:t.map(Ut),closed:n.closed}})}function Ut(e){let n={x:e.x,y:e.y};return e.in&&!ce(e.in,e)&&(n.in=e.in),e.out&&!ce(e.out,e)&&(n.out=e.out),n}function ce(e,n,t=1e-6){return Math.abs(e.x-n.x)<t&&Math.abs(e.y-n.y)<t}function Wt(e){let n=0,t=()=>{for(;n<e.length&&/[\s,]/.test(e[n]);)n+=1},r=()=>{t();let i=/^[+-]?(?:\d+\.?\d*|\.\d+)(?:[eE][+-]?\d+)?/.exec(e.slice(n));if(i)return n+=i[0].length,Number(i[0])},o=()=>{t();let i=e[n];if(!(i!=="0"&&i!=="1"))return n+=1,Number(i)};return{more(){return t(),n<e.length},command(){t();let i=e[n];if(/[a-zA-Z]/.test(i))return n+=1,i},numbers(i){let s=[];for(let u=0;u<i;u+=1){let a=r();if(a===void 0)return;s.push(a)}return s},arc(){let i=this.numbers(3),s=o(),u=o(),a=this.numbers(2);if(!(!i||s===void 0||u===void 0||!a))return[...i,s,u,...a]},at(){return n}}}function Bt(e,n,t,r,o,i,s,u,a){let c=Math.abs(t),f=Math.abs(r);if(c===0||f===0||e===u&&n===a)return[];let d=o*Math.PI/180,l=Math.cos(d),y=Math.sin(d),b=(e-u)/2,p=(n-a)/2,$=l*b+y*p,k=-y*b+l*p,g=$*$/(c*c)+k*k/(f*f);g>1&&(c*=Math.sqrt(g),f*=Math.sqrt(g));let T=c*c*f*f-c*c*k*k-f*f*$*$,m=c*c*k*k+f*f*$*$,w=(i===s?-1:1)*Math.sqrt(Math.max(0,T/m)),x=w*c*k/f,v=-w*f*$/c,S=l*x-y*v+(e+u)/2,L=y*x+l*v+(n+a)/2,C=(O,V,B,z)=>{let q=O*B+V*z,he=Math.hypot(O,V)*Math.hypot(B,z),Z=Math.acos(Math.min(1,Math.max(-1,q/he)));return O*z-V*B<0?-Z:Z},U=C(1,0,($-x)/c,(k-v)/f),W=C(($-x)/c,(k-v)/f,(-$-x)/c,(-k-v)/f);!s&&W>0&&(W-=2*Math.PI),s&&W<0&&(W+=2*Math.PI);let Ge=Math.max(1,Math.ceil(Math.abs(W)/(Math.PI/2)-1e-9)),Je=W/Ge,pe=4/3*Math.tan(Je/4),Fn=O=>({x:S+c*Math.cos(O)*l-f*Math.sin(O)*y,y:L+c*Math.cos(O)*y+f*Math.sin(O)*l}),jn=O=>({x:-c*Math.sin(O)*l-f*Math.cos(O)*y,y:-c*Math.sin(O)*y+f*Math.cos(O)*l}),Cn=[];for(let O=0;O<Ge;O+=1){let V=U+O*Je,B=V+Je,z=Fn(V),q=O===Ge-1?{x:u,y:a}:Fn(B),he=jn(V),Z=jn(B);Cn.push([{x:z.x+pe*he.x,y:z.y+pe*he.y},{x:q.x-pe*Z.x,y:q.y-pe*Z.y},q])}return Cn}function qe(e){let n=[],t=r=>`${h(r.x)} ${h(r.y)}`;for(let r of e){let{anchors:o}=r,i=o[0];if(!i)continue;n.push(`M${t(i)}`);let s=Te(r);for(let u=0;u<s;u+=1){let a=o[u],c=o[(u+1)%o.length],f=r.closed&&u===o.length-1;!a.out&&!c.in?f||n.push(`L${t(c)}`):n.push(`C${t(a.out??a)} ${t(c.in??c)} ${t(c)}`)}r.closed&&n.push("Z")}return n.join(" ")}function Te(e){let n=e.anchors.length;return n<2?0:e.closed?n:n-1}function Ze(e,n){let t=e.anchors[n],r=e.anchors[(n+1)%e.anchors.length];return[{x:t.x,y:t.y},t.out??{x:t.x,y:t.y},r.in??{x:r.x,y:r.y},{x:r.x,y:r.y}]}function Qe(e,n){let[t,r,o,i]=e,s=1-n,u=s*s*s,a=3*s*s*n,c=3*s*n*n,f=n*n*n;return{x:u*t.x+a*r.x+c*o.x+f*i.x,y:u*t.y+a*r.y+c*o.y+f*i.y}}function en(e,n){return e.map(t=>({closed:t.closed,anchors:t.anchors.map(r=>{let o=n(r);return{x:o.x,y:o.y,...r.in?{in:n(r.in)}:{},...r.out?{out:n(r.out)}:{}}})}))}function nn(e){let n=1/0,t=1/0,r=-1/0,o=-1/0,i=s=>{n=Math.min(n,s.x),t=Math.min(t,s.y),r=Math.max(r,s.x),o=Math.max(o,s.y)};for(let s of e){for(let a of s.anchors)i(a);let u=Te(s);for(let a=0;a<u;a+=1){let c=Ze(s,a);for(let f of zt(c))i(Qe(c,f))}}if(n!==1/0)return{x:n,y:t,w:r-n,h:o-t}}function zt(e){let[n,t,r,o]=e,i=[];for(let s of["x","y"]){let u=-n[s]+3*t[s]-3*r[s]+o[s],a=2*(n[s]-2*t[s]+r[s]),c=t[s]-n[s];if(Math.abs(u)<1e-12){Math.abs(a)>1e-12&&i.push(-c/a);continue}let f=a*a-4*u*c;if(f<0)continue;let d=Math.sqrt(f);i.push((-a+d)/(2*u),(-a-d)/(2*u))}return i.filter(s=>s>0&&s<1)}function Ne(e){if(e===void 0)return;let n=e.trim().split(/[\s,]+/).map(Number);if(n.length!==4||n.some(s=>!Number.isFinite(s)))return;let[t,r,o,i]=n;return{x:t,y:r,w:o,h:i}}function tn(e,n,t){return Ne(e)??{x:0,y:0,w:n,h:t}}function rn(e,n){let t=e.w===0?1:n.w/e.w,r=e.h===0?1:n.h/e.h;return o=>({x:n.x+(o.x-e.x)*t,y:n.y+(o.y-e.y)*r})}function Gn(e,n=.5){let[t,r,o,i]=e;if(ce(t,r)&&ce(o,i))return[t,i];let u=Math.hypot(r.x-t.x,r.y-t.y)+Math.hypot(o.x-r.x,o.y-r.y)+Math.hypot(i.x-o.x,i.y-o.y),a=Math.min(256,Math.max(4,Math.ceil(Math.sqrt(u/n)))),c=[];for(let f=0;f<=a;f+=1)c.push(Qe(e,f/a));return c}function Gt(e,n,t){let r=0,o=0;for(let i of e){let s=Jt(i);if(s.length!==0){if(t.reach>0){let u=i.closed?s.length:s.length-1;for(let a=0;a<u;a+=1){let c=s[a],f=s[(a+1)%s.length];if(Xt(n,c,f)<=t.reach)return!0}if(s.length===1&&Math.hypot(n.x-s[0].x,n.y-s[0].y)<=t.reach)return!0}if(t.fill)for(let u=0;u<s.length;u+=1){let a=s[u],c=s[(u+1)%s.length];a.y<=n.y!=c.y<=n.y&&a.x+(n.y-a.y)/(c.y-a.y)*(c.x-a.x)>n.x&&(o+=1,r+=c.y>a.y?1:-1)}}}return t.fill?t.rule==="evenodd"?o%2===1:r!==0:!1}function Jt(e){let n=e.anchors[0];if(!n)return[];let t=[{x:n.x,y:n.y}],r=Te(e);for(let o=0;o<r;o+=1)t.push(...Gn(Ze(e,o)).slice(1));return e.closed&&t.length>1&&t.pop(),t}function Xt(e,n,t){let r=t.x-n.x,o=t.y-n.y,i=r*r+o*o,s=i===0?0:Math.max(0,Math.min(1,((e.x-n.x)*r+(e.y-n.y)*o)/i));return Math.hypot(e.x-(n.x+s*r),e.y-(n.y+s*o))}var Ie={canvas:[["name","string"],["w","numberValue"],["h","numberValue"],["background","stringValue"]],frame:[["name","string"],["x","numberValue"],["y","numberValue"],["w","numberValue"],["h","numberValue"],["background","stringValue"],["clip","boolean"],["skip","boolean"],["blend","blendMode"],["shadow","stringValue"],["hidden","boolean"],["locked","boolean"]],group:[["name","string"],["hidden","boolean"],["locked","boolean"]],ellipse:[["name","string"],["x","numberValue"],["y","numberValue"],["w","numberValue"],["h","numberValue"],["rotation","numberValue"],["fill","stringValue"],["stroke","stringValue"],["strokeWidth","numberValue"],["opacity","numberValue"],["blend","blendMode"],["shadow","stringValue"],["hidden","boolean"],["locked","boolean"]],vector:[["name","string"],["x","numberValue"],["y","numberValue"],["w","numberValue"],["h","numberValue"],["rotation","numberValue"],["view","string"],["d","string"],["fill","stringValue"],["stroke","stringValue"],["strokeWidth","numberValue"],["opacity","numberValue"],["rule","fillRule"],["cap","lineCap"],["join","lineJoin"],["blend","blendMode"],["shadow","stringValue"],["hidden","boolean"],["locked","boolean"]],rect:[["name","string"],["x","numberValue"],["y","numberValue"],["w","numberValue"],["h","numberValue"],["rotation","numberValue"],["fill","stringValue"],["stroke","stringValue"],["strokeWidth","numberValue"],["radius","numberValue"],["opacity","numberValue"],["blend","blendMode"],["shadow","stringValue"],["hidden","boolean"],["locked","boolean"]],image:[["name","string"],["x","numberValue"],["y","numberValue"],["w","numberValue"],["h","numberValue"],["rotation","numberValue"],["src","stringValue"],["fit","imageFit"],["radius","numberValue"],["opacity","numberValue"],["blend","blendMode"],["shadow","stringValue"],["hidden","boolean"],["locked","boolean"]],text:[["name","string"],["x","numberValue"],["y","numberValue"],["w","numberValue"],["h","numberValue"],["rotation","numberValue"],["font","stringValue"],["size","numberValue"],["weight","numberValue"],["lineHeight","numberValue"],["letterSpacing","numberValue"],["align","align"],["valign","valign"],["italic","boolean"],["fill","stringValue"],["opacity","numberValue"],["blend","blendMode"],["shadow","stringValue"],["hidden","boolean"],["locked","boolean"]]},Ae=[["font","string"],["size","number"],["weight","number"],["italic","boolean"],["underline","boolean"],["strike","boolean"],["fill","string"],["letterSpacing","number"],["link","string"]];var on=[["enter","pageEffect"],["duration","number"]],_e=[["enter","nodeEffect"],["exit","nodeEffect"],["duration","number"],["delay","number"],["step","boolean"],["together","boolean"],["go","string"]],Yn=Object.keys(Ie);function Pe(e){return Yn.includes(e)}function sn(e,n){return Ie[e].find(([t])=>t===n)?.[1]}function I(e,n){if(n==="boolean")return e===""||e==="true"?{value:!0}:e==="false"?{value:!1}:{error:`Expected true or false, got ${e}`};if(e.startsWith('"')){let r=H(e);return r===void 0?{error:`Malformed quoted string ${e}`}:Jn(r,n,e)}if(er(e)){if(!qt(n))return{error:Zt(e,n)};let r=Kn(e).trim();return r===""?{error:"Empty expression"}:{value:Q(r)}}return n==="numberValue"&&Hn.test(e)?{value:Q(e)}:Jn(e,n,e)}var Hn=/^-?\d+(?:\.\d+)?%$/;function qt(e){return e==="numberValue"||e==="stringValue"}function Zt(e,n){return n==="number"?`Expected a plain number, not an expression, got ${e}`:n==="string"&&/^\$\w+$/.test(e)?`Expected a literal, got ${e} \u2014 name a token without the $: ${e.slice(1)}`:`Expected a literal, not an expression, got ${e} \u2014 quote it if you meant the text`}function Qt(e,n){let t=/^(-?\d+(?:\.\d+)?)([A-Za-z]+)$/.exec(e);return t?t[2]==="s"&&n==="number"?` \u2014 durations are milliseconds: ${Number(t[1])*1e3}`:/^(?:px|pt|deg|ms)$/.test(t[2])?` \u2014 drop the unit: ${t[1]}`:" \u2014 units are not supported: use a number, a percentage like (100%), or an expression":n==="number"?Hn.test(e)?" \u2014 a percentage is not allowed here":"":/^-[$@(]/.test(e)?` \u2014 wrap an expression in parentheses: (${e})`:/^-?[A-Za-z_]\w*(?:\.\w+)+$/.test(e)?` \u2014 wrap an expression in parentheses: (${e})`:""}function Jn(e,n,t){switch(n){case"numberValue":case"number":{let r=Number(e);return Number.isFinite(r)&&e.trim()!==""?{value:r}:{error:`Expected a number, got ${t}${Qt(e,n)}`}}case"align":return ee.includes(e)?{value:e}:{error:`Expected one of ${ee.join(", ")}, got ${t}`};case"valign":return ne.includes(e)?{value:e}:{error:`Expected one of ${ne.join(", ")}, got ${t}`};case"fontStyle":return e==="normal"||e==="italic"?{value:e}:{error:`Expected normal or italic, got ${t}`};case"imageFit":return te.includes(e)?{value:e}:{error:`Expected one of ${te.join(", ")}, got ${t}`};case"fillRule":return Y(me,e,t);case"lineCap":return Y(ge,e,t);case"lineJoin":return Y(xe,e,t);case"blendMode":return Y(ye,e,t);case"pageEffect":return Y(be,e,t);case"nodeEffect":return Y(Ee,e,t);default:return{value:e}}}function Y(e,n,t){return e.includes(n)?{value:n}:{error:`Expected one of ${e.join(", ")}, got ${t}`}}function er(e){return/^[$@(]/.test(e)}function H(e){try{let n=JSON.parse(e);return typeof n=="string"?n:void 0}catch{return}}function Kn(e){if(!e.startsWith("("))return e;let n=0;for(let t=0;t<e.length;t+=1){let r=e[t];if(r==="(")n+=1;else if(r===")"&&(n-=1,n===0))return t===e.length-1?e.slice(1,-1):e}return e}function qn(e){let n=[],t="",r=0,o=!1;for(let i=0;i<e.length;i+=1){let s=e[i];if(o){t+=s,s==="\\"?(t+=e[i+1]??"",i+=1):s==='"'&&(o=!1);continue}if(s==='"'){o=!0,t+=s;continue}if(s==="("?r+=1:s===")"&&(r=Math.max(0,r-1)),r===0&&/\s/.test(s)){t!==""&&n.push(t),t="";continue}t+=s}return t!==""&&n.push(t),n}function an(e,n,t){let r=t===void 0?void 0:A(t);if(r?.value===void 0||!Xn(e[n]??""))return;let o=n;for(;o<e.length&&Xn(e[o]??"");)o+=1;let i=[Kn(r.value),...e.slice(n,o)].join(" ");return{end:o,message:`${r.key}: an expression with spaces needs parentheses \u2014 write ${r.key}=(${i})`}}function Xn(e){return!e.includes("=")&&/^(?:[-+*/]|-?\d+(?:\.\d+)?%?|[$@][\w.]*|[A-Za-z_]\w*(?:\.\w+)+|\(.*|.*\))$/.test(e)}function A(e){let n=e.indexOf("=");return n===-1?{key:e,value:void 0}:{key:e.slice(0,n),value:e.slice(n+1)}}var rr=new Set(["exit","delay","step","together","go"]);function un(e,n){let t=e.words[1];if(t===void 0||t.includes("=")){n(e.number,"invalid-motion","Expected motion <page>, e.g. motion intro enter=fade");return}let r={};for(let o of e.words.slice(2)){let{key:i,value:s}=A(o),u=on.find(([c])=>c===i)?.[1];if(u===void 0){let c=rr.has(i)?` \u2014 ${i} goes on a node's line, under the header`:"";n(e.number,"invalid-motion",`motion ${t} has no "${i}"${c}`,t);continue}let a=I(s??"",u);"error"in a?n(e.number,"invalid-motion",`${i}: ${a.error}`,t):i==="duration"&&!Zn(a.value)?n(e.number,"invalid-motion",Qn(i,s),t):r[i]=a.value}return{page:t,number:e.number,head:r,lines:[],where:new Map,taken:new Map}}function cn(e,n,t){let r=n.words[0];if(n.indent!==1){t(n.number,"invalid-motion","A motion line sits one level under its page");return}if(r.includes("=")){t(n.number,"invalid-motion",`Expected a node id first, got ${r}`);return}if(r===e.page){t(n.number,"invalid-motion",`${r} is the page: its transition goes on the header (motion ${r} enter=fade)`,r);return}let o={id:r},i=!0;for(let u of n.words.slice(1)){let{key:a,value:c}=A(u),f=_e.find(([l])=>l===a)?.[1];if(f===void 0){t(n.number,"invalid-motion",`A motion line has no "${a}"`,r),i=!1;continue}let d=I(c??"",f);"error"in d?(t(n.number,"invalid-motion",`${a}: ${d.error}`,r),i=!1):(a==="duration"||a==="delay")&&!Zn(d.value)?(t(n.number,"invalid-motion",Qn(a,c),r),i=!1):a==="go"&&X(d.value)===void 0?(t(n.number,"invalid-motion",`go: expected #<page>, back, next, or an https: or mailto: link, got ${c??""}`,r),i=!1):d.value!==!1&&(o[a]=d.value)}if(o.enter!==void 0&&o.exit!==void 0&&(t(n.number,"invalid-motion",`${r} either enters or exits on one line \u2014 write a second line for the other`,r),i=!1),o.step===!0&&o.together===!0&&(t(n.number,"invalid-motion",`${r} waits for a step or starts together with the line above, not both`,r),i=!1),!i)return;let s=or(o);if(!Se(s)){t(n.number,"invalid-motion",`${r} says nothing: give it enter=, exit= or go=`,r);return}for(let u of["enter","exit","go"]){if(s[u]===void 0)continue;let a=e.taken.get(`${r} ${u}`);if(a!==void 0){let c=u==="go"?"has a go=":u==="enter"?"enters":"exits";t(n.number,"invalid-motion",`${r} already ${c} on line ${a}`,r);return}}for(let u of["enter","exit","go"])s[u]!==void 0&&e.taken.set(`${r} ${u}`,n.number);e.where.has(r)||e.where.set(r,n.number),e.lines.push(s)}function fn(e){let n={...e.head.enter===void 0?{}:{enter:e.head.enter},...e.head.duration===void 0?{}:{duration:e.head.duration},lines:e.lines};return ae(n)?void 0:n}function or(e){let n={id:e.id};for(let[t]of _e)e[t]!==void 0&&(n[t]=e[t]);return n}function Zn(e){return typeof e=="number"&&e>=0&&e<=se}function Qn(e,n){return`${e}: expected 0 to ${se} milliseconds, got ${n??""}`}function dn(e){return(n,t,r,o)=>{e.push({severity:"error",code:t,message:`Line ${n}: ${r}`,...o===void 0?{}:{nodeId:o}})}}function ln(e){let n=[],t=e.split(`
5
- `);for(let r=0;r<t.length;r+=1){let o=t[r],i=o.trim();if(i===G)break;if(i===""||i.startsWith("```"))continue;let s=o.length-o.trimStart().length;n.push({number:r+1,indent:Math.floor(s/2),text:i,words:qn(i)})}return n}function pn(e){let n=[],t=[],r=o=>{for(;n.length>0&&n[n.length-1].indent>=o;)ar(n.pop())};return{push(o){let i=o.words[0];if(i.startsWith('"')){let c=n[n.length-1];if(!c||c.type!=="text")return e(o.number,"invalid-content","A quoted line must sit inside a text node"),!0;let f=cr(o,e);return f!==void 0&&c.runs.push(f),!0}if(!Pe(i))return!1;r(o.indent);let s=o.words[1];if(s===void 0||s.includes("="))return e(o.number,"missing-id",`A ${i} needs an id`),!0;let u=sr(i,s,o.words.slice(2),o,e),a=n[n.length-1];return a?a.children.push(u.record):t.push(u.record),n.push(u),!0},finish(){return r(0),t}}}function sr(e,n,t,r,o){let i={type:e,id:n},s=[];for(let u=0;u<t.length;u+=1){let{key:a,value:c}=A(t[u]),f=sn(e,a);if(f===void 0){let l=an(t,u,t[u-1]);l?(o(r.number,"invalid-value",l.message,n),u=l.end-1):o(r.number,"invalid-value",`${e} has no property "${a}"`,n);continue}let d=I(c??"",f);"error"in d?o(r.number,"invalid-value",`${a}: ${d.error}`,n):i[a]=d.value}return $e(e)&&(i.children=s),e==="text"&&(i.content=""),{indent:r.indent,type:e,record:i,children:s,runs:[]}}function ar(e){e.type==="text"&&(e.record.content=ur(e.runs))}function ur(e){if(e.length===0)return"";let n=e[0];return e.length===1&&typeof n=="string"?n:[...e]}function cr(e,n){let t=H(e.words[0]);if(t===void 0){n(e.number,"invalid-run","Malformed quoted string");return}if(e.words.length===1)return t;let r={text:t};for(let o of e.words.slice(1)){let{key:i,value:s}=A(o),u=Ae.find(([c])=>c===i);if(!u){n(e.number,"invalid-run",`A run has no mark "${i}"`);continue}let a=I(s??"",u[1]);"error"in a?n(e.number,"invalid-run",`${i}: ${a.error}`):r[i]=a.value}return r}function fr(e){let n=[],t=dn(n),r=J,o,i=!1,s={},u={},a={},c=pn(t),f,d={},l=new Map,y,b=!1,p=()=>{if(!y)return;let m=y;y=void 0;let w=l.get(m.page);if(w!==void 0){t(m.number,"invalid-motion",`motion ${m.page} is written twice \u2014 put its lines in the block on line ${w}`,m.page);return}l.set(m.page,m.number);for(let[v,S]of m.where)l.set(`${m.page} ${v}`,S);let x=fn(m);x&&(d[m.page]=x)};for(let m of ln(e)){let w=m.words[0];if(y&&m.indent>0){cn(y,m,t);continue}if(!(b&&m.indent>0)){if(b=!1,p(),w==="motion"&&m.indent===0){f=void 0,y=un(m,t),b=y===void 0;continue}if(w==="version"){i=!0,lr(m,n);continue}if(w==="kind"&&m.indent===0){r=pr(m,n);continue}if(w==="title"&&m.indent===0){o=nt(m,t);continue}if(w.startsWith("$")){f=void 0,hr(m,s,t);continue}if(w==="asset"&&m.indent===0){f=void 0,yr(m,a,t);continue}if(w==="font"&&m.indent===0){f=gr(m,u,t);continue}if((w==="fallback"||w==="face")&&f){xr(w,m,f,t);continue}f=void 0,!c.push(m)&&t(m.number,"unknown-node-type",`Unknown statement "${w}"`)}}p();let $=dr(c.finish(),n),k=Object.keys(d).length===0?{}:{motion:d},g=(m,w)=>l.get(w===void 0?m:`${m} ${w}`);if(!$){i||n.push({severity:"error",code:"invalid-document",message:"No nodes found"});let m=ie({id:F,children:[]}),w=ve({kind:r,...o===void 0?{}:{title:o},tokens:s,fonts:u,assets:a,...k,root:m});return n.push(...ue(w,g)),{document:w,problems:n}}let T={version:4,kind:r,...o===void 0?{}:{title:o},tokens:s,fonts:u,assets:a,...k,root:$};return n.push(...ue(T,g)),{document:T,problems:n}}function dr(e,n){let t=e[0];if(t!==void 0){if(e.length===1&&t.type==="canvas")return t;for(let r of e){if(r.type!=="canvas")continue;let o=r.id;n.push({severity:"error",code:"invalid-document",message:"A canvas must be the only top-level node",...typeof o=="string"?{nodeId:o}:{}})}return{type:"canvas",id:F,children:[...e]}}}function lr(e,n){ke.includes(Number(e.words[1]))||n.push({severity:"warning",code:"version-mismatch",message:`Line ${e.number}: expected version ${4} or older, got ${e.words[1]??"nothing"}`})}function pr(e,n){let t=e.words[1];return t!==void 0&&oe.includes(t)?t:(n.push({severity:"error",code:"unknown-kind",message:`Line ${e.number}: unknown kind "${t??"nothing"}" \u2014 this build reads ${oe.join(", ")}`}),J)}function nt(e,n){let t=e.words.slice(1).join(" ").trim();if(t===""){n(e.number,"invalid-value",'title needs a name, e.g. title "Pitch deck"');return}let r=t.startsWith('"')?H(t):t;if(r===void 0){n(e.number,"invalid-value",`Could not read the title ${t}`);return}return r.trim()===""?void 0:r}function hr(e,n,t){let{name:r,value:o}=hn(e.words);if(r===void 0||o===void 0){t(e.number,"invalid-token","Expected $name = value");return}if(!o.startsWith('"')&&/\s/.test(o)){t(e.number,"invalid-token",`$${r}: expected one value, got "${o}". Quote it if the value has spaces; there are no comments.`);return}let i=I(o,"stringValue");if("error"in i){t(e.number,"invalid-token",`$${r}: ${i.error}`);return}if(typeof i.value!="string"){t(e.number,"invalid-token",`$${r} may not be an expression`);return}n[r]=tt(i.value,o)}function tt(e,n){let t=Number(e);return n.startsWith('"')||!Number.isFinite(t)||e.trim()===""?e:t}function hn(e){let n=e[0],t=i=>i.startsWith("$")?i.slice(1):i;if(e[1]==="=")return{name:t(n),value:e.slice(2).join(" ")||void 0};let{key:r,value:o}=A(n);return o!==void 0?{name:t(r),value:o}:{name:t(n)}}function yr(e,n,t){let r=e.words.slice(1),o=r[0],i=r[1]==="=",s=o===void 0?void 0:A(o),u=s?.key,a=i?r[2]:s?.value,c=r.slice(i?3:1);if(u===void 0||u===""||a===void 0){t(e.number,"invalid-asset","Expected asset <name> = <type> hash=\u2026 bytes=\u2026");return}let f={};for(let y of c){let{key:b,value:p}=A(y);if(p===void 0){t(e.number,"invalid-asset",`Asset "${u}" has a stray word "${y}"`);continue}f[b]=mr(p)}let d=f.hash,l=Number(f.bytes);if(d===void 0||!Number.isFinite(l)){t(e.number,"invalid-asset",`Asset "${u}" needs a hash and a bytes count`);return}n[u]={type:a,hash:d,bytes:l,...f.credit===void 0?{}:{credit:f.credit},...f.source===void 0?{}:{source:f.source},...f.license===void 0?{}:{license:f.license}}}function mr(e){return e.startsWith('"')?H(e)??e:e}function gr(e,n,t){let{name:r,value:o}=hn(e.words.slice(1));if(r===void 0||o===void 0){t(e.number,"invalid-font","Expected font <name> = <family>");return}let i=I(o,"string"),s={family:"error"in i?o:i.value};return n[r]=s,{family:s,faces:[]}}function xr(e,n,t,r){if(e==="fallback"){let u=I(n.words.slice(1).join(" "),"string");"error"in u?r(n.number,"invalid-font",`fallback: ${u.error}`):t.family.fallback=u.value;return}let o=n.words[1];if(o===void 0){r(n.number,"invalid-font-face","A face needs a src");return}let i=I(o,"string"),s={src:"error"in i?o:i.value};for(let u of n.words.slice(2)){let{key:a,value:c}=A(u);if(a!=="weight"&&a!=="style"){r(n.number,"invalid-font-face",`A face has no property "${a}"`);continue}let f=I(c??"",a==="weight"?"number":"fontStyle");"error"in f?r(n.number,"invalid-font-face",`${a}: ${f.error}`):s[a]=f.value}t.faces.push(s),t.family.faces=t.faces}function Le(e){return/^\s*(linear|radial|conic|repeating-[a-z]+)-gradient\s*\(/i.test(e)}function yn(e){let n=e.trim(),t=/^([a-z-]+)-gradient\s*\(([\s\S]*)\)$/i.exec(n);if(!t)return Le(n)?{error:'A gradient needs its closing ")"'}:{kind:"solid",colour:n};let r=t[1].toLowerCase(),o=br(t[2]).map(i=>i.trim());if(o.some(i=>i===""))return{error:"A gradient has an empty argument"};if(r==="linear"){let i=Sr(o[0]),s=ot(i===void 0?o:o.slice(1));return"error"in s?s:{kind:"linear",angle:i??180,stops:s.stops}}if(r==="radial"){let i=Mr(o[0]);if(i&&"error"in i)return i;let s=ot(i?o.slice(1):o);return"error"in s?s:{kind:"radial",shape:i?.shape??"ellipse",cx:i?.cx??.5,cy:i?.cy??.5,stops:s.stops}}return{error:`${r}-gradient is not supported; use linear-gradient or radial-gradient`}}function mn(e){let n=e.map(r=>r.at);n[0]===void 0&&(n[0]=0),n[n.length-1]===void 0&&(n[n.length-1]=1);let t=0;for(let r=0;r<n.length;r+=1){let o=n[r];o!==void 0&&(t=Math.max(t,o),n[r]=t)}for(let r=1;r<n.length;r+=1){if(n[r]!==void 0)continue;let o=r-1,i=r;for(;n[i]===void 0;)i+=1;let s=n[o],u=n[i];for(let a=r;a<i;a+=1)n[a]=s+(u-s)*(a-o)/(i-o);r=i}return e.map((r,o)=>({colour:r.colour,at:n[o]}))}function br(e){let n=[],t=0,r=0;for(let o=0;o<e.length;o+=1){let i=e[o];i==="("?t+=1:i===")"?t=Math.max(0,t-1):i===","&&t===0&&(n.push(e.slice(r,o)),r=o+1)}return n.push(e.slice(r)),n}var Er={top:[0,-1],bottom:[0,1],left:[-1,0],right:[1,0]};function Sr(e){let n=/^(-?\d*\.?\d+)(deg|turn|rad)$/i.exec(e);if(n){let i=Number(n[1]),s=n[2].toLowerCase();return s==="turn"?i*360:s==="rad"?i*180/Math.PI:i}let t=/^to\s+([a-z]+)(?:\s+([a-z]+))?$/i.exec(e);if(!t)return;let r=0,o=0;for(let i of[t[1],t[2]]){if(i===void 0)continue;let s=Er[i.toLowerCase()];if(!s)return;r+=s[0],o+=s[1]}return(Math.atan2(r,-o)*180/Math.PI+360)%360}var Or={left:0,top:0,center:.5,right:1,bottom:1};function Mr(e){let n=/^(circle|ellipse)?\s*(?:at\s+(\S+)(?:\s+(\S+))?)?$/i.exec(e);if(!n||n[1]===void 0&&n[2]===void 0)return;let t=n[1]?.toLowerCase();if(n[2]===void 0)return t?{shape:t}:void 0;let r=rt(n[2]),o=n[3]===void 0?.5:rt(n[3]);return r===void 0||o===void 0?{error:`A radial centre is two percentages or keywords, not "${e}"`}:{...t?{shape:t}:{},cx:r,cy:o}}function rt(e){let n=Or[e.toLowerCase()];if(n!==void 0)return n;let t=/^(-?\d*\.?\d+)%$/.exec(e);return t?Number(t[1])/100:void 0}function ot(e){if(e.length<2)return{error:"A gradient needs at least two colours"};let n=[];for(let t of e){let r=/^([\s\S]*?\S)\s+(-?\d*\.?\d+)%$/.exec(t);if(r&&Tr(r[1]))n.push({colour:r[1],at:Number(r[2])/100});else{if(/\s/.test(t.replace(/\([^)]*\)/g,"")))return{error:`"${t}" is not a colour with an optional percentage`};n.push({colour:t})}}return{stops:n}}function Tr(e){let n=0;for(let t of e)if(t==="("&&(n+=1),t===")"&&(n-=1),n<0)return!1;return n===0}function gn(e){let n=e.trim();if(n===""||n==="none")return{shadows:[]};let t=[];for(let r of Nr(n)){let o=Ir(r.trim());if(o.includes("inset"))return{error:"Inner shadows (inset) are not supported yet"};let i=[],s=[];for(let d of o){let l=/^(-?\d*\.?\d+)(px)?$/.exec(d);l&&s.length===0?i.push(Number(l[1])):s.push(d)}if(i.length<2||i.length>4)return{error:`"${r.trim()}" needs x, y, then optional blur and spread`};if(s.length!==1)return{error:`"${r.trim()}" needs one colour after its numbers`};let[u=0,a=0,c=0,f=0]=i;if(c<0)return{error:"A shadow cannot have a negative blur"};t.push({x:u,y:a,blur:c,spread:f,colour:s[0]})}return{shadows:t}}function Nr(e){let n=[],t=0,r=0;for(let o=0;o<e.length;o+=1){let i=e[o];i==="("?t+=1:i===")"?t=Math.max(0,t-1):i===","&&t===0&&(n.push(e.slice(r,o)),r=o+1)}return n.push(e.slice(r)),n}function Ir(e){let n=[],t=0,r="";for(let o of e){if(o==="("&&(t+=1),o===")"&&(t=Math.max(0,t-1)),/\s/.test(o)&&t===0){r!==""&&n.push(r),r="";continue}r+=o}return r!==""&&n.push(r),n}function Ve(e){return{x:e.x+e.w/2,y:e.y+e.h/2}}function it(e,n,t){if(t===0)return e;let r=t*Math.PI/180,o=Math.cos(r),i=Math.sin(r),s=e.x-n.x,u=e.y-n.y;return{x:n.x+s*o-u*i,y:n.y+s*i+u*o}}function xn(e,n,t=Ve(e)){if(n%360===0)return e;let r=[{x:e.x,y:e.y},{x:e.x+e.w,y:e.y},{x:e.x+e.w,y:e.y+e.h},{x:e.x,y:e.y+e.h}].map(a=>it(a,t,n)),o=r.map(a=>a.x),i=r.map(a=>a.y),s=Math.min(...o),u=Math.min(...i);return{x:s,y:u,w:Math.max(...o)-s,h:Math.max(...i)-u}}var at="system-ui, -apple-system, Segoe UI, Roboto, sans-serif",ut=16,ct=400,ft=1.2,De="#0F172A";function wn(){return{advance(e,n){return e.length*(n.size*.5+n.letterSpacing)},metrics(e){return{ascent:e.size*.8,descent:e.size*.2,lineGap:0}}}}function $n(e,n){if(e===void 0)return at;let t=n[e];return t?t.fallback?`${st(t.family)}, ${t.fallback}`:st(t.family):e}function st(e){return/^[A-Za-z][A-Za-z0-9 -]*$/.test(e)?e:JSON.stringify(e)}function dt(e,n,t,r){let o={family:$n(n.font,t),size:n.size,weight:n.weight,italic:n.italic,underline:!1,strike:!1,fill:r(n.fill),letterSpacing:n.letterSpacing},i=typeof e=="string"?[e]:e,s=[];for(let u of i){if(typeof u=="string"){u.length>0&&s.push({text:u,style:o});continue}let a=u;a.text.length!==0&&s.push({text:a.text,style:{family:a.font===void 0?o.family:$n(a.font,t),size:a.size??o.size,weight:a.weight??o.weight,italic:a.italic??o.italic,underline:a.underline??!1,strike:a.strike??!1,fill:a.fill===void 0?o.fill:r(a.fill),letterSpacing:a.letterSpacing??o.letterSpacing,...a.link!==void 0&&D(a.link)?{link:a.link}:{}}})}return s}function Ar(e,n){let t=[];for(let r of e)for(let o of r.text.split(/(\n)/))if(o!==""){if(o===`
6
- `){let i=t[t.length-1];i&&!i.hardBreak?t[t.length-1]={...i,hardBreak:!0}:t.push({text:"",style:r.style,w:0,hardBreak:!0});continue}for(let i of o.match(/\S+\s*|\s+/g)??[])t.push({text:i,style:r.style,w:n.advance(i,r.style),hardBreak:!1})}return t}function _r(e,n,t){let r=[...e.text],o=[],i="";for(let s of r){let u=i+s;if(i!==""&&t.advance(u,e.style)>n){o.push({text:i,style:e.style,w:t.advance(i,e.style),hardBreak:!1}),i=s;continue}i=u}return i!==""&&o.push({text:i,style:e.style,w:t.advance(i,e.style),hardBreak:e.hardBreak}),o.length>0?o:[e]}function lt(e,n){let{width:t,measure:r}=n,o=Ar(r.itemize?e.flatMap(c=>r.itemize?.(c)??[c]):e,r);if(o.length===0){let c=e[0]?.style,f=c?n.lineHeight*c.size:0;return{lines:c?[Pr(c,n.lineHeight)]:[],width:0,height:f}}let i=[],s=[],u=0,a=()=>{i.push(s),s=[],u=0};for(let c of o){let f=s.length===0&&c.w>t&&t>0?_r(c,t,r):[c];for(let d of f){let l=d.text.trimEnd(),y=l===d.text?d.w:r.advance(l,d.style);s.length>0&&u+y>t&&a(),s.push(d),u+=d.w,d.hardBreak&&a()}}return s.length>0&&i.push(s),Rr(i,n)}function Pr(e,n){let t=n*e.size;return{y:0,h:t,baseline:t*.8,w:0,spans:[]}}function Rr(e,n){let t=[],r=0,o=0;return e.forEach((i,s)=>{let u=i.map(v=>v.style.size),a=Math.max(...u,0),c=n.lineHeight*a,f=i.map(v=>n.measure.metrics(v.style)),d=Math.max(...f.map(v=>v.ascent),0),l=Math.max(...f.map(v=>v.descent),0),y=r+(c-(d+l))/2+d,b=Lr(i,n.measure),p=b.reduce((v,S)=>v+S.w,0);o=Math.max(o,p);let $=s===e.length-1||(i[i.length-1]?.hardBreak??!1),k=n.align==="justify"&&!$&&b.length>1,g=Math.max(0,n.width-p),T=n.align==="center"?g/2:n.align==="right"?g:0,m=k?g/(b.length-1):0,w=[],x=T;b.forEach((v,S)=>{w.push({text:v.text,style:v.style,x,w:v.w}),x+=v.w+(S<b.length-1?m:0)}),t.push({y:r,h:c,baseline:y,w:p,spans:Vr(w,k)}),r+=c}),{lines:t,width:o,height:r}}function Lr(e,n){let t=[...e];for(;t.length>0;){let r=t[t.length-1],o=r.text.trimEnd();if(o===r.text)break;if(o===""){t.pop();continue}t[t.length-1]={...r,text:o,w:n.advance(o,r.style)};break}return t}function Vr(e,n){if(n)return[...e];let t=[];for(let r of e){let o=t[t.length-1];if(o&&pt(o.style,r.style)&&Math.abs(o.x+o.w-r.x)<.01){t[t.length-1]={...o,text:o.text+r.text,w:o.w+r.w};continue}t.push(r)}return t}function pt(e,n){return e.family===n.family&&e.size===n.size&&e.weight===n.weight&&e.italic===n.italic&&e.underline===n.underline&&e.strike===n.strike&&e.fill===n.fill&&e.letterSpacing===n.letterSpacing&&e.link===n.link}function kn(e,n,t,r,o,i){let s={size:n.size??ut,weight:n.weight??ct,lineHeight:n.lineHeight??ft,letterSpacing:n.letterSpacing??0,italic:e.italic??!1,font:typeof e.font=="string"?e.font:void 0,fill:typeof e.fill=="string"?e.fill:De};return lt(dt(e.content,s,r,o),{width:t,align:e.align??"left",lineHeight:s.lineHeight,measure:i})}function vn(e,n,t){let r=n-t;return e.valign==="middle"?r/2:e.valign==="bottom"?r:0}var ht=["x","y","w","h","left","right","top","bottom","cx","cy"];function fe(e){return ht.includes(e)}var yt=["parent","prev","next","self","root"];function bn(e){return yt.includes(e)}var M=class extends Error{position;constructor(n,t){super(n),this.position=t,this.name="ExprSyntaxError"}},mt=/[A-Za-z_]/,En=/[A-Za-z0-9_]/;function Sn(e){let n=[],t=0,r=()=>{if(!mt.test(e[t]??""))throw new M(`Expected a name at position ${t}`,t);let s=t;for(;t<e.length&&En.test(e[t]??"");)t++;return e.slice(s,t)},o=()=>{if(!En.test(e[t]??""))throw new M(`Expected a name at position ${t}`,t);let s=t;for(;t<e.length&&En.test(e[t]??"");)t++;return e.slice(s,t)},i=()=>{let s=[r()];for(;e[t]===".";)t++,s.push(o());return s};for(;t<e.length;){let s=e[t]??"";if(/\s/.test(s)){t++;continue}if(/[0-9]/.test(s)){let u=t;for(;t<e.length&&/[0-9]/.test(e[t]??"");)t++;if(e[t]==="."&&/[0-9]/.test(e[t+1]??""))for(t++;t<e.length&&/[0-9]/.test(e[t]??"");)t++;let a=e.slice(u,t),c=Number(a);if(!Number.isFinite(c))throw new M(`Bad number "${a}"`,u);e[t]==="%"?(t++,n.push({type:"percent",value:c})):n.push({type:"number",value:c});continue}if(s==="$"){t++,n.push({type:"token",name:r()});continue}if(s==="@"){t++,n.push({type:"ref",path:i()});continue}if(mt.test(s)){n.push({type:"word",path:i()});continue}if("+-*/()".includes(s)){t++,n.push({type:"op",value:s});continue}throw new M(`Unexpected character "${s}" at position ${t}`,t)}return n.push({type:"eof"}),n}var Dr={"+":1,"-":1,"*":2,"/":2};function Fe(e){try{let n=Sn(e),t=new On(n),r=t.parseBinary(0);return t.expectEof(),{ok:!0,ast:r}}catch(n){if(n instanceof M)return{ok:!1,message:n.message};throw n}}var On=class{tokens;index=0;constructor(n){this.tokens=n}peek(){return this.tokens[this.index]??{type:"eof"}}next(){let n=this.peek();return this.index++,n}expectEof(){if(this.peek().type!=="eof")throw new M("Unexpected trailing input",this.index)}parseBinary(n){let t=this.parseUnary();for(;;){let r=this.peek();if(r.type!=="op"||!Fr(r.value))break;let o=Dr[r.value];if(o<n)break;this.next();let i=this.parseBinary(o+1);t={kind:"binary",op:r.value,left:t,right:i}}return t}parseUnary(){let n=this.peek();return n.type==="op"&&(n.value==="-"||n.value==="+")?(this.next(),{kind:"unary",op:n.value,operand:this.parseUnary()}):this.parsePrimary()}parsePrimary(){let n=this.next();switch(n.type){case"number":return{kind:"number",value:n.value};case"percent":return{kind:"percent",value:n.value};case"token":return{kind:"token",name:n.name};case"ref":{if(n.path.length<2)throw new M(`@${n.path.join(".")} needs an edge, for example @${n.path.join(".")}.right`,this.index);return{kind:"nodeRef",path:n.path}}case"word":{let[t,r,...o]=n.path;if(t===void 0||!bn(t))throw new M(`Unknown name "${n.path.join(".")}". Use $token for a token or @id.edge for a node.`,this.index);if(r===void 0||!fe(r)||o.length>0)throw new M(`${t} needs an edge, for example ${t}.w`,this.index);return{kind:"relRef",word:t,edge:r}}case"op":{if(n.value==="("){let t=this.parseBinary(0),r=this.next();if(r.type!=="op"||r.value!==")")throw new M("Missing closing parenthesis",this.index);return t}throw new M(`Unexpected "${n.value}"`,this.index)}case"eof":throw new M("Unexpected end of expression",this.index)}}};function Fr(e){return e==="+"||e==="-"||e==="*"||e==="/"}function R(e,n){return`${e} ${n}`}function Mn(e){switch(e){case"x":case"left":return["x"];case"y":case"top":return["y"];case"w":return["w"];case"h":return["h"];case"right":case"cx":return["x","w"];case"bottom":case"cy":return["y","h"]}}function Tn(e,n,t,r,o){switch(e){case"x":case"left":return n;case"y":case"top":return t;case"w":return r;case"h":return o;case"right":return n+r;case"bottom":return t+o;case"cx":return n+r/2;case"cy":return t+o/2}}function Nn(e){switch(e){case"x":case"left":case"right":case"cx":return"x";case"y":case"top":case"bottom":case"cy":return"y";case"w":case"h":return}}function In(e,n,t){let r=d=>{let l=[];for(let y=t.parentOf.get(d);y!==void 0;y=t.parentOf.get(y))l.push(y);return l},o=r(e),i=r(n),s=new Set(i),u=o.find(d=>s.has(d)),a=d=>u===void 0?d:d.slice(0,d.indexOf(u)),c=new Map([[e,1]]),f=(d,l)=>{let y=(c.get(d)??0)+l;y===0?c.delete(d):c.set(d,y)};for(let d of a(o))f(d,1);for(let d of a(i))f(d,-1);return c}function An(e){switch(e){case"right":case"bottom":return 1;case"cx":case"cy":return .5;default:return 0}}function je(e){if(e==="x"||e==="w")return"w";if(e==="y"||e==="h")return"h"}function _n(e){let n=new Map,t=new Map,r=new Map,o=new Map,i=[];N(e.root,(f,d)=>{n.has(f.id)||n.set(f.id,f),i.push(f),d&&t.set(f.id,d.id),_(f)&&f.children.forEach((l,y)=>{let b=f.children[y-1],p=f.children[y+1];b&&r.set(l.id,b.id),p&&o.set(l.id,p.id)})});let s=new Map;for(let f of i){let d=t.get(f.id);for(;d!==void 0;){let l=n.get(d);if(!l||!re(l))break;d=t.get(d)}d!==void 0&&s.set(f.id,d)}let u=new Map,a=new Map,c=f=>{if(_(f)){if(!re(f)){let d=gt(f);d.forEach((l,y)=>{let b=d[y-1],p=d[y+1];b&&u.set(l.id,b.id),p&&a.set(l.id,p.id)})}for(let d of f.children)c(d)}};return c(e.root),{rootId:e.root.id,byId:n,parentOf:t,prevOf:r,nextOf:o,layoutParentOf:s,layoutPrevOf:u,layoutNextOf:a,order:i}}function gt(e){let n=[];for(let t of e.children)_(t)&&re(t)?n.push(...gt(t)):n.push(t);return n}function Ce(e,n,t){if(e.kind==="relRef"){let i=jr(e.word,n,t);return i===void 0?{ok:!1,message:`${n} has no ${e.word}`}:{ok:!0,nodeId:i,edge:e.edge}}let r=e.path[e.path.length-1]??"",o=e.path.slice(0,-1).join(".");return fe(r)?t.byId.has(o)?{ok:!0,nodeId:o,edge:r}:{ok:!1,message:`No node @${o}`}:{ok:!1,message:`"${r}" is not an edge of @${o}`}}function jr(e,n,t){switch(e){case"self":return n;case"root":return t.rootId;case"parent":return t.layoutParentOf.get(n);case"prev":return t.layoutPrevOf.get(n);case"next":return t.layoutNextOf.get(n)}}function Pn(e){let n=[],t=_n(e),r=Cr(t),o=new Set;Ur(r,n),Wr(r,e,t,o,n);let i=Br(r);zr(r,i,n);let s=Gr(r,i,e,t,o,n);return{nodes:Xr(e.root,s,r,n),problems:n}}function Cr(e){let n=new Map;for(let t of e.order){let r=t;for(let o of we(t)){let i=r[o];i!==void 0&&n.set(R(t.id,o),{nodeId:t.id,prop:o,value:i,deps:[]})}}return n}function Ur(e,n){for(let t of e.values()){if(!P(t.value))continue;let r=Fe(t.value.expr);if(r.ok){t.ast=r.ast;continue}n.push({severity:"error",code:"expression-syntax",message:r.message,nodeId:t.nodeId,prop:t.prop})}}function Wr(e,n,t,r,o){for(let i of e.values()){if(!i.ast)continue;let s=new Set,u=a=>{switch(a.kind){case"number":return;case"token":{let c=n.tokens[a.name];typeof c!="number"&&o.push({severity:"error",code:c===void 0?"unknown-token":"token-not-a-number",message:c===void 0?`Unknown token $${a.name}`:`Token $${a.name} is not a number`,nodeId:i.nodeId,prop:i.prop});return}case"percent":{let c=je(i.prop);if(!c)return;let f=t.layoutParentOf.get(i.nodeId),d=f===void 0?void 0:R(f,c);if(d===void 0||!e.has(d)){o.push({severity:"error",code:"percent-without-parent",message:`${i.nodeId}.${i.prop} uses a percentage but has no parent to measure against`,nodeId:i.nodeId,prop:i.prop});return}s.add(d);return}case"nodeRef":case"relRef":{let c=Ce(a,i.nodeId,t);if(!c.ok){r.add(a),o.push({severity:"error",code:"unknown-reference",message:c.message,nodeId:i.nodeId,prop:i.prop});return}let f=l=>{e.has(l)&&s.add(l)},d=Nn(c.edge);if(!d){for(let l of Mn(c.edge))f(R(c.nodeId,l));return}for(let l of In(c.nodeId,i.nodeId,t).keys())f(R(l,d));An(c.edge)!==0&&f(R(c.nodeId,d==="x"?"w":"h"));return}case"unary":u(a.operand);return;case"binary":u(a.left),u(a.right);return}};u(i.ast),i.deps=[...s]}}function Br(e){let n=new Map,t=new Map;for(let[i,s]of e){n.set(i,s.deps.length);for(let u of s.deps){let a=t.get(u);a?a.push(i):t.set(u,[i])}}let r=[];for(let[i,s]of n)s===0&&r.push(i);let o=[];for(let i=0;i<r.length;i++){let s=r[i];o.push(s);for(let u of t.get(s)??[]){let a=(n.get(u)??0)-1;n.set(u,a),a===0&&r.push(u)}}return o}function zr(e,n,t){if(n.length===e.size)return;let r=new Set(n);for(let[o,i]of e)r.has(o)||t.push({severity:"error",code:"cycle",message:`${i.nodeId}.${i.prop} is part of a dependency cycle`,nodeId:i.nodeId,prop:i.prop})}function Gr(e,n,t,r,o,i){let s=new Map,u=(a,c)=>s.get(R(a,c))??0;for(let a of n){let c=e.get(a);if(c){if(!P(c.value)){s.set(a,c.value);continue}if(!c.ast){s.set(a,0);continue}s.set(a,xt(c.ast,c,t,r,o,i,u))}}return s}function xt(e,n,t,r,o,i,s){let u=a=>xt(a,n,t,r,o,i,s);switch(e.kind){case"number":return e.value;case"token":{let a=t.tokens[e.name];return typeof a=="number"?a:0}case"percent":{let a=je(n.prop);if(!a)return e.value/100;let c=r.layoutParentOf.get(n.nodeId);return c===void 0?0:e.value/100*s(c,a)}case"nodeRef":case"relRef":{if(o.has(e))return 0;let a=Ce(e,n.nodeId,r);if(!a.ok)return 0;let c=Nn(a.edge);if(!c)return Tn(a.edge,s(a.nodeId,"x"),s(a.nodeId,"y"),s(a.nodeId,"w"),s(a.nodeId,"h"));let f=An(a.edge)*s(a.nodeId,c==="x"?"w":"h");for(let[d,l]of In(a.nodeId,n.nodeId,r))f+=l*s(d,c);return f}case"unary":{let a=u(e.operand);return e.op==="-"?-a:a}case"binary":{let a=u(e.left),c=u(e.right);if(e.op==="/"&&c===0)return i.push({severity:"error",code:"divide-by-zero",message:`${n.nodeId}.${n.prop} divides by zero`,nodeId:n.nodeId,prop:n.prop}),0;let f=Jr(e.op,a,c);return Number.isFinite(f)?f:(i.push({severity:"error",code:"not-a-number",message:`${n.nodeId}.${n.prop} did not produce a finite number`,nodeId:n.nodeId,prop:n.prop}),0)}}}function Jr(e,n,t){switch(e){case"+":return n+t;case"-":return n-t;case"*":return n*t;case"/":return n/t}}function Xr(e,n,t,r){let o=new Map,i=(u,a)=>n.get(R(u,a))??0,s=(u,a,c)=>{let f=i(u.id,"x"),d=i(u.id,"y"),l=i(u.id,"w"),y=i(u.id,"h"),b={};for(let k of we(u)){let g=R(u.id,k);t.has(g)&&(b[k]=n.get(g)??0)}(l<0||y<0)&&r.push({severity:"warning",code:"negative-size",message:`${u.id} resolved to a negative size`,nodeId:u.id});let p=a+f,$=c+d;if(o.set(u.id,{id:u.id,type:u.type,x:f,y:d,w:l,h:y,left:f,top:d,right:f+l,bottom:d+y,cx:f+l/2,cy:d+y/2,absX:p,absY:$,values:b}),_(u))for(let k of u.children)s(k,p,$)};return s(e,0,0),o}function Rn(e){switch(e.kind){case"text":{let n=Math.max(e.w,...e.lines.map(r=>r.w)),t=Math.max(e.y+e.h,...e.lines.map(r=>r.y+r.h));return{x:e.x,y:e.y,w:n,h:t-e.y}}case"vector":{let n=nn(e.contours)??{x:e.x,y:e.y,w:e.w,h:e.h},t=e.stroke!==void 0?e.strokeWidth*2:0;return{x:n.x-t,y:n.y-t,w:n.w+t*2,h:n.h+t*2}}case"rect":case"ellipse":{let n=e.stroke!==void 0?e.strokeWidth/2:0;return{x:e.x-n,y:e.y-n,w:e.w+n*2,h:e.h+n*2}}case"frame":case"image":return{x:e.x,y:e.y,w:e.w,h:e.h}}}function Be(e,n){let t=e.x,r=e.y,o=e.x+e.w,i=e.y+e.h;for(let s of n){let u=s.spread+s.blur;t=Math.min(t,e.x+s.x-u),r=Math.min(r,e.y+s.y-u),o=Math.max(o,e.x+e.w+s.x+u),i=Math.max(i,e.y+e.h+s.y+u)}return{x:t,y:r,w:o-t,h:i-r}}var kt="vd-paint-";var We="#CBD5E1",vt="#FFFFFF";function bt(e,n,t={}){let r=[...n.problems],o=[],i=[],s=t.measure??wn(),u=no(e.tokens,r),a=u.paint,c=new Map;N(e.root,(p,$)=>{if("hidden"in p&&p.hidden===!0)return!1;let k=$?c.get($.id):void 0,g=n.nodes.get(p.id);if(!g){c.set(p.id,k);return}if(p.type==="frame"){p.skip===!0&&$!==e.root&&r.push({severity:"warning",code:"skip-not-a-page",message:`${p.id}: skip only applies to a page, a frame at the top level`,nodeId:p.id,prop:"skip"});let m={x:g.absX,y:g.absY,w:Math.max(0,g.w),h:Math.max(0,g.h)};c.set(p.id,p.clip===!0?p.id:k),p.clip===!0&&i.push({id:p.id,...m,parent:k}),o.push({kind:"frame",id:p.id,...m,background:a(p.background,p.id,"background",m),clip:k,blend:p.blend??"normal",shadows:K(p.shadow,p.id,e.tokens,r),rotation:0});return}if(c.set(p.id,k),p.type==="text"){o.push(Hr(p,g,e,s,r,k,a));return}if(p.type==="image"){o.push({kind:"image",id:p.id,x:g.absX,y:g.absY,w:Math.max(0,g.w),h:Math.max(0,g.h),href:oo(p,e,t.resolveAsset,r),fit:p.fit??"fill",radius:Math.max(0,g.values.radius??0),opacity:le(g.values.opacity??1),clip:k,blend:p.blend??"normal",shadows:K(p.shadow,p.id,e.tokens,r),rotation:g.values.rotation??0});return}if(p.type==="ellipse"){let m=wt(g);o.push({kind:"ellipse",id:p.id,...m,fill:a(p.fill,p.id,"fill",m)??We,stroke:a(p.stroke,p.id,"stroke",m),strokeWidth:g.values.strokeWidth??0,opacity:le(g.values.opacity??1),clip:k,blend:p.blend??"normal",shadows:K(p.shadow,p.id,e.tokens,r),rotation:g.values.rotation??0});return}if(p.type==="vector"){o.push(eo(p,g,r,k,a,K(p.shadow,p.id,e.tokens,r)));return}if(p.type!=="rect")return;let T=wt(g);o.push({kind:"rect",id:p.id,...T,fill:a(p.fill,p.id,"fill",T)??We,stroke:a(p.stroke,p.id,"stroke",T),strokeWidth:g.values.strokeWidth??0,radius:Math.max(0,g.values.radius??0),opacity:le(g.values.opacity??1),clip:k,blend:p.blend??"normal",shadows:K(p.shadow,p.id,e.tokens,r),rotation:g.values.rotation??0})});let f=n.nodes.get(e.root.id),d=e.root.w!==void 0&&e.root.h!==void 0,l=d?{x:0,y:0,width:Math.max(0,f?.w??0),height:Math.max(0,f?.h??0)}:Yr(o,i),y={x:l.x,y:l.y,w:l.width,h:l.height},b=a(e.root.background,e.root.id,"background",y);return{...l,background:d?b??vt:b,items:o,clips:i,gradients:u.gradients,problems:r}}function Yr(e,n){let t=new Map;for(let u of n){let a=u.parent===void 0?void 0:t.get(u.parent);t.set(u.id,a?$t(u,a):u)}let r=1/0,o=1/0,i=-1/0,s=-1/0;for(let u of e){let a=u.kind==="text"?Math.max(u.h,u.height):u.h,c=u.clip===void 0?void 0:t.get(u.clip),f=xn(Be({x:u.x,y:u.y,w:u.w,h:a},u.shadows),u.rotation,Ve(u)),d=c?$t(f,c):f;d.w<=0||d.h<=0||(r=Math.min(r,d.x),o=Math.min(o,d.y),i=Math.max(i,d.x+d.w),s=Math.max(s,d.y+d.h))}return Number.isFinite(r)?{x:r,y:o,width:i-r,height:s-o}:{x:0,y:0,width:0,height:0}}function $t(e,n){let t=Math.max(e.x,n.x),r=Math.max(e.y,n.y);return{x:t,y:r,w:Math.min(e.x+e.w,n.x+n.w)-t,h:Math.min(e.y+e.h,n.y+n.h)-r}}function Ln(e,n={}){return bt(e,Pn(e),n)}function Hr(e,n,t,r,o,i,s){let u=Math.max(0,n.w),a=Math.max(0,n.h),c={x:n.absX,y:n.absY,w:u,h:a},f=kn(e,n.values,u,t.fonts,l=>s(l,e.id,"fill",c)??De,r);f.height>a+.5&&o.push({severity:"warning",code:"text-overflow",message:`${e.id} needs ${Math.ceil(f.height)}px but its height is ${Math.round(a)}px`,nodeId:e.id,prop:"h"}),Kr(e,t,o);let d=n.absY+vn(e,a,f.height);return{kind:"text",id:e.id,x:n.absX,y:n.absY,w:u,h:a,clip:i,blend:e.blend??"normal",shadows:K(e.shadow,e.id,t.tokens,o),rotation:n.values.rotation??0,opacity:le(n.values.opacity??1),height:f.height,lines:f.lines.map(l=>({y:d+l.y,h:l.h,baseline:d+l.baseline,w:l.w,spans:l.spans.map(y=>({text:y.text,x:n.absX+y.x,y:d+l.baseline,w:y.w,style:y.style}))}))}}function Kr(e,n,t){if(typeof e.content!="string")for(let r of e.content){if(typeof r=="string"||r.link===void 0)continue;let o=D(r.link);if(!o){t.push({severity:"warning",code:"invalid-link",message:`${e.id}: links go to https:, mailto: or #<frame>, not ${JSON.stringify(r.link)}`,nodeId:e.id,prop:"content"});continue}o.kind==="frame"&&!qr(n,o.id)&&t.push({severity:"warning",code:"link-target-missing",message:`${e.id}: links to #${o.id}, which is not a frame`,nodeId:e.id,prop:"content"})}}function qr(e,n){let t=!1;return N(e.root,r=>{if(t)return!1;r.id===n&&r.type==="frame"&&(t=!0)}),t}var de=new Map,Zr=512;function Qr(e){let n=de.get(e);if(n)return n;let t=Ke(e);return de.size>=Zr&&de.delete(de.keys().next().value),de.set(e,t),t}function eo(e,n,t,r,o,i){let s=Math.max(0,n.w),u=Math.max(0,n.h),a={x:n.absX,y:n.absY,w:s,h:u},{contours:c,error:f}=Qr(e.d);f!==void 0&&t.push({severity:"error",code:"bad-path",message:`${e.id}: ${f}`,nodeId:e.id,prop:"d"}),e.view!==void 0&&Ne(e.view)===void 0&&t.push({severity:"warning",code:"bad-view",message:`${e.id}: view must be four numbers, like "0 0 24 24"`,nodeId:e.id,prop:"view"});let d=en(c,rn(tn(e.view,s,u),a));return{kind:"vector",id:e.id,...a,d:qe(d),contours:d,fill:o(e.fill,e.id,"fill",a)??We,stroke:o(e.stroke,e.id,"stroke",a),strokeWidth:n.values.strokeWidth??0,opacity:le(n.values.opacity??1),rule:e.rule??"nonzero",cap:e.cap??"butt",join:e.join??"miter",clip:r,blend:e.blend??"normal",shadows:i,rotation:n.values.rotation??0}}function Et(e,n,t,r,o){if(e===void 0)return;if(P(e)){o.push({severity:"warning",code:"expression-not-supported",message:`Expressions are not supported for ${r} yet; grammar v0 is numeric only`,nodeId:t,prop:r});return}let i=n[e];if(i===void 0)return e;if(typeof i=="string")return i;o.push({severity:"error",code:"token-not-a-colour",message:`Token $${e} is a number, not a colour`,nodeId:t,prop:r})}function wt(e){return{x:e.absX,y:e.absY,w:Math.max(0,e.w),h:Math.max(0,e.h)}}function no(e,n){let t=[],r=new Map;return{paint:(i,s,u,a)=>{let c=Et(i,e,s,u,n);if(c===void 0)return;let f=yn(c);if("error"in f){n.push({severity:"error",code:"invalid-paint",message:`${s}: ${f.error}`,nodeId:s,prop:u});return}if(f.kind==="solid")return c;let d=`${s}\0${u}\0${c}`,l=r.get(d);if(l!==void 0)return`url(#${l})`;let y=[...r.keys()].filter($=>$.startsWith(`${s}\0${u}\0`)).length,b=`${kt}${s}-${u}${y===0?"":`-${y+1}`}`;r.set(d,b);let p=mn(f.stops).map($=>({offset:$.at,colour:St($.colour,e,s,u,n)}));return t.push(ro(f,b,a,to(p))),`url(#${b})`},gradients:t}}function K(e,n,t,r){let o=Et(e,t,n,"shadow",r);if(o===void 0)return[];let i=gn(o);return"error"in i?(r.push({severity:"error",code:"invalid-shadow",message:`${n}: ${i.error}`,nodeId:n,prop:"shadow"}),[]):i.shadows.map(s=>({...s,colour:St(s.colour,t,n,"shadow",r)}))}function to(e){return e.map((n,t)=>{if(n.colour.trim().toLowerCase()!=="transparent")return n;let r=[e[t-1],e[t+1]].find(o=>o!==void 0&&o.colour.trim().toLowerCase()!=="transparent");return r===void 0?n:{offset:n.offset,colour:r.colour,opacity:0}})}function St(e,n,t,r,o){let i=n[e];return i===void 0?e:typeof i=="string"&&!Le(i)?i:(o.push({severity:"error",code:"invalid-paint",message:`${t}: a gradient stop names $${e}, which is not a colour`,nodeId:t,prop:r}),"transparent")}function ro(e,n,t,r){if(e.kind==="linear"){let c=e.angle*Math.PI/180,f=Math.sin(c),d=-Math.cos(c),l=(Math.abs(t.w*f)+Math.abs(t.h*d))/2,y=t.x+t.w/2,b=t.y+t.h/2;return{id:n,kind:"linear",x1:Ue(y-f*l),y1:Ue(b-d*l),x2:Ue(y+f*l),y2:Ue(b+d*l),stops:r}}let o=t.x+t.w*e.cx,i=t.y+t.h*e.cy,s={x:Math.max(o-t.x,t.x+t.w-o),y:Math.max(i-t.y,t.y+t.h-i)};if(e.shape==="circle"||s.x===0||s.y===0){let c=Math.hypot(s.x,s.y);return{id:n,kind:"radial",cx:o,cy:i,rx:c,ry:c,stops:r}}let u=s.x/s.y,a=Math.hypot(s.x/u,s.y);return{id:n,kind:"radial",cx:o,cy:i,rx:a*u,ry:a,stops:r}}function Ue(e){return Math.round(e*1e6)/1e6}function le(e){return Math.min(Math.max(e,0),1)}function oo(e,n,t,r){let o=P(e.src)?void 0:e.src,i=o===void 0?void 0:n.assets[o];if(!i){r.push({severity:"warning",code:"missing-asset",message:`No picture for ${JSON.stringify(o??e.src)} yet: an image slot waiting for one`,nodeId:e.id,prop:"src"});return}let s=t?.(i,o);return s===void 0&&r.push({severity:"warning",code:"unresolved-asset",message:`The bytes for asset "${o}" are not available here`,nodeId:e.id,prop:"src"}),s}var ze="vd-clip-";function Vn(e,n={}){let t=n.indent??" ",r=n.ids??!0,o=h(e.width),i=h(e.height),s=`${h(e.x)} ${h(e.y)} ${o} ${i}`,u=[`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${i}" viewBox="${s}">`],a=e.items.filter(c=>c.shadows.length>0);if(e.clips.length>0||e.gradients.length>0||a.length>0){u.push(`${t}<defs>`);for(let c of e.clips)u.push(t+t+io(c));for(let c of e.gradients)u.push(t+t+Mt(c));for(let c of a)u.push(t+t+Tt(c,n.shadowsOnly));u.push(`${t}</defs>`)}e.background!==void 0&&u.push(`${t}<rect x="${h(e.x)}" y="${h(e.y)}" width="${o}" height="${i}" fill="${E(e.background)}"/>`);for(let c of e.items){let f=uo(c,r);f!==""&&u.push(t+f)}return u.push("</svg>"),`${u.join(`
7
- `)}
8
- `}function io(e){let n=e.parent===void 0?"":` clip-path="url(#${E(ze+e.parent)})"`;return`<clipPath id="${E(ze+e.id)}"${n}><rect x="${h(e.x)}" y="${h(e.y)}" width="${h(e.w)}" height="${h(e.h)}"/></clipPath>`}function Mt(e){let n=e.stops.map(r=>`<stop offset="${h(r.offset)}" stop-color="${E(r.colour)}"${r.opacity===void 0?"":` stop-opacity="${h(r.opacity)}"`}/>`).join(""),t=E(e.id);return e.kind==="linear"?`<linearGradient id="${t}" gradientUnits="userSpaceOnUse" x1="${h(e.x1)}" y1="${h(e.y1)}" x2="${h(e.x2)}" y2="${h(e.y2)}">${n}</linearGradient>`:`<radialGradient id="${t}" gradientUnits="userSpaceOnUse" cx="0" cy="0" r="1" gradientTransform="matrix(${h(e.rx)} 0 0 ${h(e.ry)} ${h(e.cx)} ${h(e.cy)})">${n}</radialGradient>`}var so={cover:"xMidYMid slice",contain:"xMidYMid meet",fill:"none"},ao="#94A3B8";function j(e){let n=e.clip===void 0?[]:[`clip-path="url(#${E(ze+e.clip)})"`];return e.rotation!==0&&n.push(`transform="${Nt(e)}"`),e.shadows.length>0&&n.push(`filter="url(#${E(Dn+e.id)})"`),e.blend!=="normal"&&n.push(`style="mix-blend-mode:${e.blend}"`),n}var Dn="vd-shadow-";function Tt(e,n=!1){let t=Be(Rn(e),e.shadows),r=2,o=[];e.shadows.forEach((s,u)=>{let a=`s${u}`,c="SourceAlpha";s.spread!==0&&(o.push(`<feMorphology in="${c}" operator="${s.spread>0?"dilate":"erode"}" radius="${h(Math.abs(s.spread))}" result="${a}m"/>`),c=`${a}m`),s.blur>0&&(o.push(`<feGaussianBlur in="${c}" stdDeviation="${h(s.blur/2)}" result="${a}b"/>`),c=`${a}b`),o.push(`<feOffset in="${c}" dx="${h(s.x)}" dy="${h(s.y)}" result="${a}o"/>`,`<feFlood flood-color="${E(s.colour)}" result="${a}c"/>`,`<feComposite in="${a}c" in2="${a}o" operator="in" result="${a}"/>`)});let i=e.shadows.map((s,u)=>`<feMergeNode in="s${e.shadows.length-1-u}"/>`).join("");return`<filter id="${E(Dn+e.id)}" filterUnits="userSpaceOnUse" x="${h(t.x-r)}" y="${h(t.y-r)}" width="${h(t.w+r*2)}" height="${h(t.h+r*2)}" color-interpolation-filters="sRGB">`+o.join("")+`<feMerge>${i}${n?"":'<feMergeNode in="SourceGraphic"/>'}</feMerge></filter>`}function Nt(e){return`rotate(${h(e.rotation)} ${h(e.x+e.w/2)} ${h(e.y+e.h/2)})`}function It(e){return e.rotation!==0&&e.clip!==void 0}function uo(e,n){if(It(e)){let t=[`clip-path="url(#${E(ze+e.clip)})"`];e.blend!=="normal"&&t.push(`style="mix-blend-mode:${e.blend}"`);let r=Ot({...e,clip:void 0,blend:"normal"},n);return r===""?"":`<g ${t.join(" ")}>${r}</g>`}return Ot(e,n)}function Ot(e,n){switch(e.kind){case"ellipse":return po(e,n);case"frame":return co(e,n);case"image":return fo(e,n);case"rect":return lo(e,n);case"text":return yo(e,n);case"vector":return ho(e,n)}}function co(e,n){let t=[];return n&&t.push(`id="${E(e.id)}"`),t.push(`x="${h(e.x)}"`,`y="${h(e.y)}"`,`width="${h(e.w)}"`,`height="${h(e.h)}"`,`fill="${e.background===void 0?"none":E(e.background)}"`,...j(e)),`<rect ${t.join(" ")}/>`}function fo(e,n){let t=[];return n&&t.push(`id="${E(e.id)}"`),t.push(`x="${h(e.x)}"`,`y="${h(e.y)}"`,`width="${h(e.w)}"`,`height="${h(e.h)}"`),e.href===void 0?(e.radius>0&&t.push(`rx="${h(e.radius)}"`),t.push('fill="none"',`stroke="${E(ao)}"`,'stroke-width="1"','stroke-dasharray="4 4"',...j(e)),`<rect ${t.join(" ")}/>`):(t.push(`href="${E(e.href)}"`,`preserveAspectRatio="${so[e.fit]}"`),e.opacity<1&&t.push(`opacity="${h(e.opacity)}"`),t.push(...j(e)),`<image ${t.join(" ")}/>`)}function lo(e,n){let t=[];return n&&t.push(`id="${E(e.id)}"`),t.push(`x="${h(e.x)}"`,`y="${h(e.y)}"`,`width="${h(e.w)}"`,`height="${h(e.h)}"`),e.radius>0&&t.push(`rx="${h(e.radius)}"`),t.push(`fill="${E(e.fill)}"`),e.stroke!==void 0&&e.strokeWidth>0&&t.push(`stroke="${E(e.stroke)}"`,`stroke-width="${h(e.strokeWidth)}"`),e.opacity<1&&t.push(`opacity="${h(e.opacity)}"`),t.push(...j(e)),`<rect ${t.join(" ")}/>`}function At(e){let n=[`fill="${E(e.fill)}"`];return e.stroke!==void 0&&e.strokeWidth>0&&n.push(`stroke="${E(e.stroke)}"`,`stroke-width="${h(e.strokeWidth)}"`),e.opacity<1&&n.push(`opacity="${h(e.opacity)}"`),n}function po(e,n){let t=[];return n&&t.push(`id="${E(e.id)}"`),t.push(`cx="${h(e.x+e.w/2)}"`,`cy="${h(e.y+e.h/2)}"`,`rx="${h(e.w/2)}"`,`ry="${h(e.h/2)}"`,...At(e),...j(e)),`<ellipse ${t.join(" ")}/>`}function ho(e,n){if(e.d==="")return"";let t=[];return n&&t.push(`id="${E(e.id)}"`),t.push(`d="${E(e.d)}"`,...At(e)),e.rule!=="nonzero"&&t.push(`fill-rule="${e.rule}"`),e.cap!=="butt"&&t.push(`stroke-linecap="${e.cap}"`),e.join!=="miter"&&t.push(`stroke-linejoin="${e.join}"`),t.push(...j(e)),`<path ${t.join(" ")}/>`}function yo(e,n){if(e.lines.every(o=>o.spans.length===0))return"";let t=[];n&&t.push(`id="${E(e.id)}"`),t.push('xml:space="preserve"'),e.opacity<1&&t.push(`opacity="${h(e.opacity)}"`),t.push(...j(e));let r=[];for(let o of e.lines)for(let i of o.spans)i.text!==""&&r.push(mo(i));return`<text ${t.join(" ")}>${r.join("")}</text>`}function mo(e){let t=`<tspan ${[`x="${h(e.x)}"`,`y="${h(e.y)}"`,...go(e.style)].join(" ")}>${xo(e.text)}</tspan>`;return e.style.link===void 0?t:`<a href="${E(e.style.link)}">${t}</a>`}function go(e){let n=[`font-family="${E(e.family)}"`,`font-size="${h(e.size)}"`,`fill="${E(e.fill)}"`];e.weight!==400&&n.push(`font-weight="${h(e.weight)}"`),e.italic&&n.push('font-style="italic"'),e.letterSpacing!==0&&n.push(`letter-spacing="${h(e.letterSpacing)}"`);let t=[e.underline?"underline":"",e.strike?"line-through":""].filter(Boolean).join(" ");return t&&n.push(`text-decoration="${t}"`),n}function xo(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function E(e){return e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ca(e,n={}){let{resolveAsset:t,measure:r,...o}=n;return Vn(Ln(e,{...t?{resolveAsset:t}:{},...r?{measure:r}:{}}),o)}export{N as a,Xe as b,D as c,Dt as d,X as e,Ye as f,He as g,Gt as h,Pt as i,Rt as j,Lt as k,fr as l,it as m,Pn as n,wn as o,bt as p,Ln as q,Vn as r,Mt as s,Dn as t,Tt as u,Nt as v,It as w,Ca as x};