hyperframes 0.4.22 → 0.4.24

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/cli.js CHANGED
@@ -54,7 +54,7 @@ var VERSION;
54
54
  var init_version = __esm({
55
55
  "src/version.ts"() {
56
56
  "use strict";
57
- VERSION = true ? "0.4.22" : "0.0.0-dev";
57
+ VERSION = true ? "0.4.24" : "0.0.0-dev";
58
58
  }
59
59
  });
60
60
 
@@ -3956,7 +3956,7 @@ function getAttr(tag, attr) {
3956
3956
  return match ? match[1] ?? null : null;
3957
3957
  }
3958
3958
  function hasAttr(tag, attr) {
3959
- return new RegExp(`${attr}=["']`).test(tag);
3959
+ return new RegExp(`\\s${attr}(?:\\s|=|>|/)`).test(tag);
3960
3960
  }
3961
3961
  function injectAttr(tag, attr, value) {
3962
3962
  return tag.replace(/>$/, ` ${attr}="${value}">`);
@@ -4067,7 +4067,8 @@ function extractResolvedMedia(html) {
4067
4067
  src: getAttr(tag, "src") ?? void 0,
4068
4068
  start: startStr !== null ? parseFloat(startStr) : 0,
4069
4069
  duration,
4070
- mediaStart: mediaStartStr ? parseFloat(mediaStartStr) : 0
4070
+ mediaStart: mediaStartStr ? parseFloat(mediaStartStr) : 0,
4071
+ loop: hasAttr(tag, "loop")
4071
4072
  });
4072
4073
  }
4073
4074
  return resolved;
@@ -6112,7 +6113,7 @@ var RUNTIME_IIFE;
6112
6113
  var init_runtime_inline = __esm({
6113
6114
  "../core/src/generated/runtime-inline.ts"() {
6114
6115
  "use strict";
6115
- RUNTIME_IIFE = '"use strict";(()=>{function me(e){try{window.parent.postMessage(e,"*")}catch{}}function At(e){let t=n=>{let o=n.data;if(!o||o.source!=="hf-parent"||o.type!=="control")return;let r=o.action;if(r==="play"){e.onPlay();return}if(r==="pause"){e.onPause();return}if(r==="seek"){e.onSeek(Number(o.frame??0),o.seekMode??"commit");return}if(r==="set-muted"){e.onSetMuted(!!o.muted);return}if(r==="set-media-output-muted"){e.onSetMediaOutputMuted(!!o.muted);return}if(r==="set-playback-rate"){e.onSetPlaybackRate(Number(o.playbackRate??1));return}if(r==="enable-pick-mode"){e.onEnablePickMode();return}if(r==="disable-pick-mode"){e.onDisablePickMode();return}if(r==="flash-elements"){let i=o.selectors,u=o.duration||800;i&&Nn(i,u)}};return window.addEventListener("message",t),t}function Nn(e,t){if(!document.getElementById("__hf-flash-styles")){let n=document.createElement("style");n.id="__hf-flash-styles",n.textContent=`\n .__hf-flash {\n outline: 2px solid rgba(59, 130, 246, 0.6) !important;\n outline-offset: 2px !important;\n animation: __hf-flash-pulse ${t}ms ease-out forwards !important;\n }\n @keyframes __hf-flash-pulse {\n 0% { outline-color: rgba(59, 130, 246, 0.8); }\n 100% { outline-color: transparent; }\n }\n `,document.head.appendChild(n)}for(let n of e)try{document.querySelectorAll(n).forEach(r=>{r.classList.add("__hf-flash"),setTimeout(()=>r.classList.remove("__hf-flash"),t)})}catch{}}var et=null;function Nt(e){et=e}function Oe(e,t){if(et)try{et({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch{}}function Et(e){let t=[],n=d=>{if(typeof d.getAnimations!="function")return[];try{return d.getAnimations()}catch{return[]}},o=(d,c)=>{for(let s of d){try{s.currentTime=c}catch{}try{s.pause()}catch{}}},r=d=>{for(let c of d)try{c.play()}catch{}},i=d=>{for(let c of d)try{c.pause()}catch{}},u=d=>{d.baseDelay?d.el.style.animationDelay=d.baseDelay:d.el.style.removeProperty("animation-delay"),d.basePlayState?d.el.style.animationPlayState=d.basePlayState:d.el.style.removeProperty("animation-play-state")};return{name:"css",discover:()=>{t=[];let d=document.querySelectorAll("*");for(let c of d){if(!(c instanceof HTMLElement))continue;let s=window.getComputedStyle(c);!s.animationName||s.animationName==="none"||t.push({el:c,baseDelay:c.style.animationDelay||"",basePlayState:c.style.animationPlayState||""})}},seek:d=>{let c=Number(d.time)||0;for(let s of t){if(!s.el.isConnected)continue;let a=e?.resolveStartSeconds?e.resolveStartSeconds(s.el):Number.parseFloat(s.el.getAttribute("data-start")??"0")||0,m=Math.max(0,c-a)*1e3,p=n(s.el);if(p.length>0){o(p,m);continue}s.el.style.animationPlayState="paused",s.el.style.animationDelay=`-${(m/1e3).toFixed(3)}s`}},pause:()=>{for(let d of t){if(!d.el.isConnected)continue;let c=n(d.el);c.length>0&&i(c),u(d)}},play:()=>{for(let d of t)d.el.isConnected&&(u(d),r(n(d.el)))},revert:()=>{t=[]}}}function yt(e){return{name:"gsap",discover:()=>{},seek:t=>{let n=e.getTimeline();if(!n)return;n.pause();let o=Math.max(0,Number(t.time)||0);typeof n.totalTime=="function"?n.totalTime(o,!1):n.seek(o,!1)},pause:()=>{let t=e.getTimeline();t&&t.pause()}}}function Ct(){return{name:"lottie",discover:()=>{try{let e=window.lottie;if(e&&typeof e.getRegisteredAnimations=="function"){let t=e.getRegisteredAnimations();if(Array.isArray(t)&&t.length>0){let n=window.__hfLottie??[],o=new Set(n);for(let r of t)o.has(r)||n.push(r);window.__hfLottie=n}}}catch{}},seek:e=>{let t=Math.max(0,Number(e.time)||0),n=window.__hfLottie;if(!(!n||n.length===0))for(let o of n)try{if(bt(o))o.goToAndStop(t*1e3,!1);else if(Mt(o)){if(typeof o.setCurrentRawFrameValue=="function"){let r=o.totalFrames??0,i=o.frameRate??30,u=t*i;r>0&&o.setCurrentRawFrameValue(Math.min(u,r-1))}else if(typeof o.seek=="function"){let r=o.duration??1,i=Math.min(100,t/r*100);o.seek(i)}}}catch{}},pause:()=>{let e=window.__hfLottie;if(!(!e||e.length===0))for(let t of e)try{(bt(t)||Mt(t))&&t.pause()}catch{}},revert:()=>{}}}function bt(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function Mt(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}function Dt(){let e=null,t=0;return{name:"three",discover:()=>{},seek:n=>{e=Math.max(0,Number(n.time)||0),t=e,window.__hfThreeTime=e;try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:{time:e}}))}catch{}},pause:()=>{e==null&&(e=Math.max(0,t))},play:()=>{e=null},revert:()=>{e=null,t=0}}}function kt(){return{name:"waapi",discover:()=>{},seek:e=>{if(!document.getAnimations)return;let t=Math.max(0,(Number(e.time)||0)*1e3);for(let n of document.getAnimations()){try{n.currentTime=t}catch{}try{n.pause()}catch{}}},pause:()=>{if(document.getAnimations)for(let e of document.getAnimations())try{e.pause()}catch{}}}}function Lt(e){let t=Array.from(document.querySelectorAll("video[data-start], audio[data-start]")),n=[],o=[],r=0;for(let i of t){let u=e?.resolveStartSeconds?e.resolveStartSeconds(i):Number.parseFloat(i.dataset.start??"0");if(!Number.isFinite(u))continue;let d=Number.parseFloat(i.dataset.playbackStart??i.dataset.mediaStart??"0")||0,c=i.defaultPlaybackRate,s=Number.isFinite(c)&&c>0?Math.max(.1,Math.min(5,c)):1,a=i.loop,m=Number.isFinite(i.duration)&&i.duration>0?i.duration:null,p=Number.parseFloat(i.dataset.duration??"");(!Number.isFinite(p)||p<=0)&&m!=null&&(p=Math.max(0,(m-d)/s));let F=Number.isFinite(p)&&p>0?u+p:Number.POSITIVE_INFINITY,D=Number.parseFloat(i.dataset.volume??""),C={el:i,start:u,mediaStart:d,duration:Number.isFinite(p)&&p>0?p:Number.POSITIVE_INFINITY,end:F,volume:Number.isFinite(D)?D:null,playbackRate:s,loop:a,sourceDuration:m};n.push(C),i.tagName==="VIDEO"&&o.push(C),Number.isFinite(F)&&(r=Math.max(r,F))}return{timedMediaEls:t,mediaClips:n,videoClips:o,maxMediaEnd:r}}var tt=new WeakMap,_e=new WeakSet;function En(e){if(_e.has(e))return;_e.add(e);let t=()=>_e.delete(e);e.addEventListener("playing",t,{once:!0}),e.addEventListener("pause",t,{once:!0}),e.addEventListener("error",t,{once:!0})}function Tt(e){let t=!!(e.outputMuted||e.userMuted);for(let n of e.clips){let{el:o}=n;if(!o.isConnected)continue;let r=(e.timeSeconds-n.start)*n.playbackRate+n.mediaStart;if(e.timeSeconds>=n.start&&e.timeSeconds<n.end&&r>=0){if(n.loop&&n.sourceDuration!=null&&n.sourceDuration>0){let F=n.sourceDuration-n.mediaStart;F>0&&r>=n.sourceDuration&&(r=n.mediaStart+(r-n.mediaStart)%F)}n.volume!=null&&(o.volume=n.volume),t&&(o.muted=!0);try{o.playbackRate=n.playbackRate*e.playbackRate}catch{}let u=o.currentTime||0,d=Math.abs(u-r),c=r-u,s=tt.get(o);tt.set(o,c);let a=s===void 0,m=!a&&Math.abs(c-s)>.5,p=d>3;if(d>.5&&(a||m||p))try{o.currentTime=r}catch{}e.playing&&o.paused&&!_e.has(o)?(o.preload!=="auto"&&(o.preload="auto"),En(o),o.play().catch(F=>{_e.delete(o),(F&&typeof F=="object"&&"name"in F?String(F.name??""):"")==="NotAllowedError"&&e.onAutoplayBlocked?.()})):!e.playing&&!o.paused&&o.pause();continue}tt.delete(o),o.paused||o.pause()}}function wt(e){let t=!1,n=null,o=null,r=null,i=null;function u(S,x){try{window.dispatchEvent(new CustomEvent(S,{detail:x}))}catch{}}function d(S){r=S,u("hyperframe:picker:hovered",{elementInfo:r,isPickMode:t,timestamp:Date.now()})}function c(S){i=S,u("hyperframe:picker:selected",{elementInfo:i,isPickMode:t,timestamp:Date.now()})}function s(S){if(!S||S===document.body||S===document.documentElement)return!1;let x=S.tagName.toLowerCase();return!(x==="script"||x==="style"||x==="link"||x==="meta"||S.classList.contains("__hf-pick-highlight"))}function a(S){let x=S;if(x.id)return`#${x.id}`;let g=S.getAttribute("data-composition-id");if(g)return`[data-composition-id="${g}"]`;let E=S.getAttribute("data-composition-src");if(E)return`[data-composition-src="${E}"]`;let b=S.getAttribute("data-track-index");if(b)return`[data-track-index="${b}"]`;let y=S.tagName.toLowerCase(),v=S.parentElement;if(!v)return y;let _=v.querySelectorAll(`:scope > ${y}`);if(_.length===1)return y;for(let O=0;O<_.length;O+=1)if(_[O]===S)return`${y}:nth-of-type(${O+1})`;return y}function m(S){let x=S.tagName.toLowerCase(),g=(S.textContent??"").trim().replace(/\\s+/g," "),E=(b,y)=>b.length>y?`${b.slice(0,y-1)}\\u2026`:b;return x==="h1"||x==="h2"||x==="h3"?"Heading":x==="p"||x==="span"||x==="div"?g.length>0?E(g,56):"Text":x==="img"?"Image":x==="video"?"Video":x==="audio"?"Audio":x==="svg"?"Shape":S.getAttribute("data-composition-src")?"Composition":x==="section"?"Section":`${x.charAt(0).toUpperCase()}${x.slice(1)}`}function p(S,x,g){let E=typeof g=="number"&&g>0?g:8,b=[];if(document.elementsFromPoint)b=document.elementsFromPoint(S,x);else if(document.elementFromPoint){let _=document.elementFromPoint(S,x);b=_?[_]:[]}let y={},v=[];for(let _=0;_<b.length;_+=1){let O=b[_];if(!s(O))continue;let V=`${O.tagName}::${O.id||""}::${_}`;if(!y[V]&&(y[V]=!0,v.push(O),v.length>=E))break}return v}function F(S){let x=S.getBoundingClientRect(),g={};for(let b=0;b<S.attributes.length;b+=1){let y=S.attributes[b];y.name.startsWith("data-")&&(g[y.name]=y.value)}return{id:S.id||null,tagName:S.tagName.toLowerCase(),selector:a(S),label:m(S),boundingBox:{x:x.left,y:x.top,width:x.width,height:x.height},textContent:S.textContent?S.textContent.trim().slice(0,200):null,src:S.getAttribute("src")||S.getAttribute("data-composition-src")||null,dataAttributes:g}}function D(S,x,g){return p(S,x,g).map(F)}function C(S){if(!t)return;let g=p(S.clientX,S.clientY,1)[0]??(S.target instanceof Element?S.target:null);if(!s(g)||n===g)return;n&&n.classList.remove("__hf-pick-highlight"),n=g,g.classList.add("__hf-pick-highlight");let E=F(g);d(E),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:E})}function T(S){if(!t)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();let x=D(S.clientX,S.clientY,8);x.length!==0&&(d(x[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:x,selectedIndex:0,point:{x:S.clientX,y:S.clientY}}))}function U(S){S.key==="Escape"&&(k(),e.postMessage({source:"hf-preview",type:"pick-mode-cancelled"}))}function z(){t||(t=!0,o=document.createElement("style"),o.textContent=[".__hf-pick-highlight { outline: 2px solid #4f8cf7 !important; outline-offset: 2px; cursor: crosshair !important; }",".__hf-pick-active * { cursor: crosshair !important; }"].join(`\n`),document.head.appendChild(o),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",C,!0),document.addEventListener("click",T,!0),document.addEventListener("keydown",U,!0),u("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function k(){t&&(t=!1,n&&(n.classList.remove("__hf-pick-highlight"),n=null),o&&(o.remove(),o=null),document.body.classList.remove("__hf-pick-active"),document.removeEventListener("mousemove",C,!0),document.removeEventListener("click",T,!0),document.removeEventListener("keydown",U,!0),u("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function Q(){window.__HF_PICKER_API={enable:z,disable:k,isActive:()=>t,getHovered:()=>r,getSelected:()=>i,getCandidatesAtPoint:(S,x,g)=>Number.isFinite(S)&&Number.isFinite(x)?D(S,x,g):[],pickAtPoint:(S,x,g)=>{if(!Number.isFinite(S)||!Number.isFinite(x))return null;let E=D(S,x,8);if(!E.length)return null;let b=Math.max(0,Math.min(E.length-1,Number(g??0))),y=E[b]??null;return y?(c(y),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:y}),k(),y):null},pickManyAtPoint:(S,x,g)=>{if(!Number.isFinite(S)||!Number.isFinite(x))return[];let E=D(S,x,8);if(!E.length)return[];let b=[],y=Array.isArray(g)?g:[0];for(let v of y){let _=Math.max(0,Math.min(E.length-1,Math.floor(Number(v)))),O=E[_];if(!O)continue;b.some(w=>w.selector===O.selector&&w.tagName===O.tagName)||b.push(O)}return b.length?(c(b[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:b}),k(),b):[]}},u("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:z,disablePickMode:k,installPickerApi:Q}}function nt(e,t){let n=Number.isFinite(t)&&t>0?t:30,o=Number.isFinite(e)&&e>0?e:0;return Math.floor(o*n+1e-9)/n}function Ge(e,t,n){if(e){for(let o of Object.values(e))if(!(!o||o===t))try{n(o)}catch{}}}function Bt(e,t,n){let o=nt(t,n);return e.pause(),typeof e.totalTime=="function"?e.totalTime(o,!1):e.seek(o,!1),o}function yn(e,t,n,o){let r=[];Ge(e,t,i=>{i.play(),r.push(i)});try{return Bt(t,n,o)}finally{for(let i of r)try{i.pause()}catch{}}}function bn(e,t){Ge(e,t,n=>{n.play()})}function Rt(e){return{_timeline:null,play:()=>{let t=e.getTimeline();if(!t||e.getIsPlaying())return;let n=Math.max(0,Number(e.getSafeDuration?.()??t.duration()??0)||0);n>0&&Math.max(0,Number(t.time())||0)>=n&&(t.pause(),t.seek(0,!1),e.onDeterministicSeek(0),e.setIsPlaying(!1),e.onSyncMedia(0,!1),e.onRenderFrameSeek(0)),typeof t.timeScale=="function"&&t.timeScale(e.getPlaybackRate()),t.play(),Ge(e.getTimelineRegistry?.(),t,o=>{typeof o.timeScale=="function"&&o.timeScale(e.getPlaybackRate()),o.play()}),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let t=e.getTimeline();if(!t)return;t.pause(),Ge(e.getTimelineRegistry?.(),t,o=>{o.pause()});let n=Math.max(0,Number(t.time())||0);e.onDeterministicSeek(n),e.onDeterministicPause(),e.setIsPlaying(!1),e.onSyncMedia(n,!1),e.onRenderFrameSeek(n),e.onStatePost(!0)},seek:t=>{let n=e.getTimeline();if(!n)return;let o=Math.max(0,Number(t)||0),r=yn(e.getTimelineRegistry?.(),n,o,e.getCanonicalFps());e.onDeterministicSeek(r),e.setIsPlaying(!1),e.onSyncMedia(r,!1),e.onRenderFrameSeek(r),e.onStatePost(!0)},renderSeek:t=>{let n=e.getTimeline(),o=e.getCanonicalFps(),r=n?(bn(e.getTimelineRegistry?.(),n),Bt(n,t,o)):nt(Math.max(0,Number(t)||0),o);e.onDeterministicSeek(r),e.setIsPlaying(!1),e.onSyncMedia(r,!1),e.onRenderFrameSeek(r),e.onStatePost(!0)},getTime:()=>Number(e.getTimeline()?.time()??0),getDuration:()=>Number(e.getTimeline()?.duration()??0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:t=>e.setPlaybackRate(t),getPlaybackRate:()=>e.getPlaybackRate()}}function vt(){return{capturedTimeline:null,isPlaying:!1,rafId:null,currentTime:0,deterministicAdapters:[],parityModeEnabled:!0,canonicalFps:30,bridgeMuted:!1,mediaOutputMuted:!1,mediaAutoplayBlockedPosted:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,timelinePollIntervalId:null,controlBridgeHandler:null,clampDurationLoggedRaw:null,beforeUnloadHandler:null,domReadyHandler:null,injectedCompStyles:[],injectedCompScripts:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,maxTimelineDurationSeconds:1800,nativeVisualWatchdogTick:0}}var Mn="data-hf-authored-duration",Cn="data-hf-authored-end";function De(e){if(e==null||e==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}function Dn(e){return De(e.getAttribute("data-duration"))}function kn(e){return De(e.getAttribute("data-end"))}function Ln(e){return De(e.getAttribute(Mn))}function Tn(e){return De(e.getAttribute(Cn))}function wn(e){let t=(e??"").trim();if(!t)return null;let n=De(t);if(n!=null)return{kind:"absolute",value:n};let o=t.match(/^([A-Za-z0-9_.:-]+)(?:\\s*([+-])\\s*([0-9]*\\.?[0-9]+))?$/);if(!o)return null;let r=(o[1]??"").trim();if(!r)return null;let i=o[2]??"+",u=o[3]??"0",d=Number.parseFloat(u),c=Number.isFinite(d)?Math.max(0,d):0,s=i==="-"?-c:c;return{kind:"reference",refId:r,offset:s}}function Be(e){let t=e.timelineRegistry??{},n=e.includeAuthoredTimingAttrs??!1,o=new WeakMap,r=new WeakMap,i=new Set,u=a=>{let m=document.getElementById(a);return m||(document.querySelector(`[data-composition-id="${CSS.escape(a)}"]`)??null)},d=a=>{let m=r.get(a);if(m!==void 0)return m;let p=null,F=Dn(a)??(n?Ln(a):null);if(F!=null&&F>0&&(p=F),p==null||p<=0){let D=kn(a)??(n?Tn(a):null);if(D!=null){let C=s(a,0),T=D-C;Number.isFinite(T)&&T>0&&(p=T)}}if((p==null||p<=0)&&a instanceof HTMLMediaElement){let D=De(a.getAttribute("data-playback-start"))??De(a.getAttribute("data-media-start"))??0;Number.isFinite(a.duration)&&a.duration>D&&(p=a.duration-D)}if(p==null||p<=0){let D=a.getAttribute("data-composition-id");if(D){let C=t[D]??null;if(C&&typeof C.duration=="function")try{let T=Number(C.duration());Number.isFinite(T)&&T>0&&(p=T)}catch{}}}return p!=null&&Number.isFinite(p)&&p>0?(r.set(a,p),p):(r.set(a,null),null)},c=(a,m)=>{if(a.hasAttribute("data-composition-id")){let F=a.parentElement?.closest("[data-composition-id]");return F?s(F,m):0}let p=a.closest("[data-composition-id]");return p?s(p,m):0},s=(a,m)=>{let p=o.get(a);if(p!==void 0)return p??m;if(i.has(a))return m;i.add(a);try{let F=wn(a.getAttribute("data-start"));if(!F){if(a.hasAttribute("data-composition-id")){let z=a.parentElement;if(z&&(z.hasAttribute("data-composition-src")||z.hasAttribute("data-composition-id"))){let k=s(z,m);return o.set(a,k),k}}return o.set(a,m),m}if(F.kind==="absolute"){let z=Math.max(0,F.value),k=Math.max(0,c(a,m)+z);return o.set(a,k),k}let D=u(F.refId);if(!D)return o.set(a,m),m;let C=s(D,0),T=d(D);if(T==null||T<=0){let z=Math.max(0,C+F.offset);return o.set(a,z),z}let U=Math.max(0,C+T+F.offset);return o.set(a,U),U}finally{i.delete(a)}};return{resolveStartForElement:(a,m=0)=>s(a,Math.max(0,m)),resolveDurationForElement:a=>d(a)}}var Bn="data-hf-authored-duration",Rn="data-hf-authored-end";function xe(e){if(e==null||e==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}function it(e){return xe(e.getAttribute("data-duration"))??xe(e.getAttribute(Bn))}function It(e){return xe(e.getAttribute("data-end"))??xe(e.getAttribute(Rn))}function ot(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}var Pt={composition:0,video:1,image:2,element:3,audio:4};function vn(e){if(e.length===0)return;let t=new Map;for(let u of e){let d=t.get(u.track)??new Set;d.add(u.kind),t.set(u.track,d)}if(!Array.from(t.values()).some(u=>u.size>1))return;let o=0,r=new Map,i=[...t.keys()].sort((u,d)=>u-d);for(let u of i){let d=t.get(u);if(d.size===1)r.set(`${u}:${[...d][0]}`,o++);else{let c=[...d].sort((s,a)=>(Pt[s]??99)-(Pt[a]??99));for(let s of c)r.set(`${u}:${s}`,o++)}}for(let u of e){let d=`${u.track}:${u.kind}`,c=r.get(d);c!=null&&(u.track=c)}}function We(e){let t=String(e??"").trim();if(!t)return null;let n=t.toLowerCase();if(n.startsWith("data:")||n.startsWith("javascript:"))return null;try{return new URL(t,document.baseURI).toString()}catch{return t}}function In(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return We(t);let n=e.getAttribute("data-composition-src");if(n)return We(n);let o=e.querySelector("img[src], video[src], audio[src], source[src]");return o?We(o.getAttribute("src")):null}function Ot(e){let n=window.__timelines??{},o=Be({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),r=B=>{if(!B)return null;let M=n[B]??null;if(!M||typeof M.duration!="function")return null;try{let L=Number(M.duration());return Number.isFinite(L)&&L>0?L:null}catch{return null}},i=B=>{let M=xe(B.getAttribute("data-duration"));if(M!=null&&M>0)return M;let L=xe(B.getAttribute("data-playback-start"))??xe(B.getAttribute("data-media-start"))??0;return Number.isFinite(B.duration)&&B.duration>L?Math.max(0,B.duration-L):null},u=()=>{let B=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(B.length===0)return null;let M=0;for(let L of B){let J=o.resolveStartForElement(L,0);if(!Number.isFinite(J))continue;let X=i(L);X==null||X<=0||(M=Math.max(M,Math.max(0,J)+X))}return M>0?M:null},d=B=>{let M=B.trim().toLowerCase();return!(!M||M==="main"||M.includes("caption")||M.includes("ambient"))},c=(B,M)=>{let L=[],J=null,X=null,I=null,P=B.parentElement;for(;P;){let H=P.getAttribute("data-composition-id");H&&(L.push(H),!I&&P!==M&&(I=H),J==null&&(J=o.resolveStartForElement(P,0)),X==null&&(X=xe(P.getAttribute("data-duration"))??r(H)??null)),P=P.parentElement}return{parentCompositionId:I,compositionAncestors:L.reverse(),inheritedStart:J,inheritedDuration:X}},s=document.querySelector("[data-composition-id]"),a=Array.from(document.querySelectorAll("[data-composition-id]")),m=s?.getAttribute("data-composition-id")??null,p=s?o.resolveStartForElement(s,0):0,F=u(),D=F!=null?Math.max(0,F-Math.max(0,p)):null,C=r(m),T=it(s??document.body),U=ot(...a.filter(B=>B!==s).map(B=>{let M=o.resolveStartForElement(B,0),L=o.resolveDurationForElement(B)??r(B.getAttribute("data-composition-id"))??null;return!Number.isFinite(M)||L==null||L<=0?null:Math.max(0,M)+L})),z=U!=null?Math.max(0,U-Math.max(0,p)):null,k=typeof C=="number"&&Number.isFinite(C)&&C>0?C:null,Q=typeof T=="number"&&Number.isFinite(T)&&T>0?T:null,S=typeof D=="number"&&Number.isFinite(D)&&D>0?D:null,x=typeof z=="number"&&Number.isFinite(z)&&z>0?z:null,g=ot(S,x),E=k!=null&&g!=null&&k>g+1,b=Q??(E?g:ot(k,S,x)),y=b!=null?Math.min(b,e.maxTimelineDurationSeconds):null,_=(y!=null?p+y:null)??(typeof F=="number"&&Number.isFinite(F)&&F>0?F:null),O=(B,M)=>!Number.isFinite(M)||M<=0?0:_==null||!Number.isFinite(_)?M:!Number.isFinite(B)||B>=_?0:Math.max(0,Math.min(M,_-B)),V=[],w=[],K=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),Z=0;for(let B=0;B<K.length;B+=1){let M=K[B];if(M===s||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(M.tagName))continue;let L=c(M,s),J=o.resolveStartForElement(M,L.inheritedStart??0),X=M.getAttribute("data-composition-id"),I=it(M);if((I==null||I<=0)&&X&&X!==m&&(I=r(X)),(I==null||I<=0)&&M instanceof HTMLMediaElement){let de=xe(M.getAttribute("data-playback-start"))??xe(M.getAttribute("data-media-start"))??0;Number.isFinite(M.duration)&&M.duration>0&&(I=Math.max(0,M.duration-de))}if(I==null||I<=0){let de=L.inheritedDuration;if(de!=null&&de>0){let ge=(L.inheritedStart??0)+de;I=Math.max(0,ge-J)}}if(I==null||I<=0||(I=O(J,I),I<=0))continue;let P=J+I;Z=Math.max(Z,P);let H=M.tagName.toLowerCase(),ue=X&&X!==m?"composition":H==="video"?"video":H==="audio"?"audio":H==="img"?"image":"element";V.push({id:M.id||X||`__node__index_${B}`,label:M.getAttribute("data-timeline-label")??M.getAttribute("data-label")??M.getAttribute("aria-label")??X??M.id??M.className?.split(" ")[0]??ue,start:J,duration:I,track:Number.parseInt(M.getAttribute("data-track-index")??M.getAttribute("data-track")??String(B),10)||0,kind:ue,tagName:H,compositionId:M.getAttribute("data-composition-id"),compositionAncestors:L.compositionAncestors,parentCompositionId:L.parentCompositionId,nodePath:null,compositionSrc:We(M.getAttribute("data-composition-src")),assetUrl:In(M),timelineRole:M.getAttribute("data-timeline-role"),timelineLabel:M.getAttribute("data-timeline-label"),timelineGroup:M.getAttribute("data-timeline-group"),timelinePriority:xe(M.getAttribute("data-timeline-priority"))})}let W=new Set(V.map(B=>B.id)),j=s?.getAttribute("data-composition-id")??null,R=j?n[j]??null:null;if(R&&s){let B=R;if(typeof B.getChildren=="function")try{let M=B.getChildren(!0,!0,!1)??[],L=new Map;for(let I of s.children){let P=I;if(!P.id)continue;let H=P.tagName.toLowerCase();H==="script"||H==="style"||H==="link"||L.set(P,{id:P.id,start:1/0,end:-1/0})}let J=I=>{let P=I;for(;P;){if(L.has(P))return P;if(P===s)return null;P=P.parentElement}return null};for(let I of M){if(typeof I.targets!="function"||typeof I.startTime!="function"||typeof I.duration!="function")continue;let P=I.startTime(),H=I.parent;for(;H&&typeof H.startTime=="function";)P+=H.startTime(),H=H.parent;let ue=P+I.duration();if(!(!Number.isFinite(P)||!Number.isFinite(ue)))for(let de of I.targets()){if(!(de instanceof Element))continue;let Ee=J(de);if(!Ee)continue;let ge=L.get(Ee);ge&&(ge.start=Math.min(ge.start,P),ge.end=Math.max(ge.end,ue))}}let X=V.length>0?Math.max(...V.map(I=>I.track))+1:0;for(let[I,P]of L){if(P.start===1/0||P.end===-1/0)continue;let H=I;if(W.has(H.id))continue;let ue=Math.max(0,P.end-P.start);if(ue<=0)continue;let de=O(P.start,ue);de<=0||(Z=Math.max(Z,P.start+de),V.push({id:H.id,label:H.getAttribute("data-timeline-label")??H.getAttribute("data-label")??H.getAttribute("aria-label")??H.id,start:P.start,duration:de,track:Number.parseInt(H.getAttribute("data-track-index")??H.getAttribute("data-track")??"",10)||X,kind:"element",tagName:H.tagName.toLowerCase(),compositionId:H.getAttribute("data-composition-id"),compositionAncestors:j?[j]:[],parentCompositionId:j,nodePath:null,compositionSrc:null,assetUrl:null,timelineRole:H.getAttribute("data-timeline-role"),timelineLabel:H.getAttribute("data-timeline-label"),timelineGroup:H.getAttribute("data-timeline-group"),timelinePriority:xe(H.getAttribute("data-timeline-priority"))}),W.add(H.id))}}catch{}}if(s&&y!=null&&y>0){let B=V.length>0?Math.max(...V.map(M=>M.track))+1:0;for(let M of s.children){let L=M;if(!L.id||W.has(L.id))continue;let J=L.getAttribute("data-timeline-role");if(J!=="overlay"&&J!=="persistent-overlay")continue;let X=L.tagName.toLowerCase();if(X==="script"||X==="style"||X==="link"||X==="meta"||window.getComputedStyle(L).display==="none")continue;let P=O(0,y);P<=0||(Z=Math.max(Z,P),V.push({id:L.id,label:L.getAttribute("data-timeline-label")??L.getAttribute("data-label")??L.getAttribute("aria-label")??L.id,start:0,duration:P,track:Number.parseInt(L.getAttribute("data-track-index")??L.getAttribute("data-track")??"",10)||B,kind:"element",tagName:X,compositionId:L.getAttribute("data-composition-id"),compositionAncestors:j?[j]:[],parentCompositionId:j,nodePath:null,compositionSrc:null,assetUrl:null,timelineRole:J,timelineLabel:L.getAttribute("data-timeline-label"),timelineGroup:L.getAttribute("data-timeline-group"),timelinePriority:xe(L.getAttribute("data-timeline-priority"))}),W.add(L.id))}}vn(V);for(let B of a){if(B===s)continue;let M=B.getAttribute("data-composition-id");if(!M||!d(M))continue;let L=o.resolveStartForElement(B,0),J=it(B);if((J==null||J<=0)&&It(B)!=null){let H=It(B);J=Math.max(0,H-L)}let X=r(M),I=J&&J>0?J:X;if(I==null||I<=0)continue;let P=O(L,I);P<=0||w.push({id:M,label:B.getAttribute("data-label")??M,start:L,duration:P,thumbnailUrl:We(B.getAttribute("data-thumbnail-url")),avatarName:null})}let $=Math.max(1,Math.min(Math.max(Z||1,y??0),e.maxTimelineDurationSeconds));return{source:"hf-preview",type:"timeline",durationInFrames:E&&Q==null?Number.POSITIVE_INFINITY:Math.max(1,Math.round($*Math.max(1,e.canonicalFps))),clips:V,scenes:w,compositionWidth:xe(s?.getAttribute("data-width"))??1920,compositionHeight:xe(s?.getAttribute("data-height"))??1080}}var Pn=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,On=e=>new Promise(t=>{let n=!1,o=Date.now(),r=null,i=u=>{n||(n=!0,r!=null&&window.clearTimeout(r),t({status:u,elapsedMs:Math.max(0,Date.now()-o)}))};e.addEventListener("load",()=>i("load"),{once:!0}),e.addEventListener("error",()=>i("error"),{once:!0}),r=window.setTimeout(()=>i("timeout"),8e3)});function rt(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function _t(e,t){let n=e.trim();if(!n)return e;try{return Pn.test(n)?new URL(n,document.baseURI).toString():t?new URL(n,t).toString():new URL(n,document.baseURI).toString()}catch{return e}}async function st(e){let t=null;e.hostCompositionId&&(t=Array.from(e.sourceNode.querySelectorAll("[data-composition-id]")).find(s=>s.getAttribute("data-composition-id")===e.hostCompositionId)??null);let n=t??e.sourceNode;if(e.headStyles)for(let c of e.headStyles){let s=c.cloneNode(!0);s instanceof HTMLStyleElement&&(document.head.appendChild(s),e.injectedStyles.push(s))}let o=Array.from(n.querySelectorAll("style"));for(let c of o){let s=c.cloneNode(!0);s instanceof HTMLStyleElement&&(document.head.appendChild(s),e.injectedStyles.push(s))}let r=[];if(e.headScripts)for(let c of e.headScripts){let s=c.getAttribute("type")?.trim()??"",a=c.getAttribute("src")?.trim()??"";if(a){let m=_t(a,e.compositionUrl);r.push({kind:"external",src:m,type:s})}else{let m=c.textContent?.trim()??"";m&&r.push({kind:"inline",content:m,type:s})}}let i=Array.from(n.querySelectorAll("script")),u=[...r];for(let c of i){let s=c.getAttribute("type")?.trim()??"",a=c.getAttribute("src")?.trim()??"";if(a){let m=_t(a,e.compositionUrl);u.push({kind:"external",src:m,type:s})}else{let m=c.textContent?.trim()??"";m&&u.push({kind:"inline",content:m,type:s})}c.parentNode?.removeChild(c)}let d=Array.from(n.querySelectorAll("style"));for(let c of d)c.parentNode?.removeChild(c);if(t){let c=document.importNode(t,!0),s=t.getAttribute("data-width"),a=t.getAttribute("data-height"),m=e.parseDimensionPx(s),p=e.parseDimensionPx(a);c.style.position="relative",c.style.width=m||"100%",c.style.height=p||"100%",m&&c.style.setProperty("--comp-width",m),p&&c.style.setProperty("--comp-height",p),s&&e.host.setAttribute("data-width",s),a&&e.host.setAttribute("data-height",a),m&&e.host instanceof HTMLElement&&(e.host.style.width=m),p&&e.host instanceof HTMLElement&&(e.host.style.height=p),e.host.appendChild(c)}else e.hasTemplate?e.host.appendChild(document.importNode(n,!0)):e.host.innerHTML=e.fallbackBodyInnerHtml;for(let c of u){let s=document.createElement("script");if(c.type&&(s.type=c.type),s.async=!1,c.kind==="external"?s.src=c.src:c.type.toLowerCase()==="module"?s.textContent=c.content:s.textContent=`(function(){${c.content}})();`,document.body.appendChild(s),e.injectedScripts.push(s),c.kind==="external"){let a=await On(s);a.status!=="load"&&e.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:e.hostCompositionId,hostCompositionSrc:e.hostCompositionSrc,resolvedScriptSrc:c.src,loadStatus:a.status,elapsedMs:a.elapsedMs}})}}}async function Wt(e){let t=Array.from(document.querySelectorAll("[data-composition-id]:not([data-composition-src])")).filter(n=>{if(n.children.length>0)return!1;let o=n.getAttribute("data-composition-id");return o?!!document.querySelector(`template#${CSS.escape(o)}-template`):!1});if(t.length!==0)for(let n of t){let o=n.getAttribute("data-composition-id"),r=document.querySelector(`template#${CSS.escape(o)}-template`);rt(n),await st({host:n,hostCompositionId:o,hostCompositionSrc:`template#${o}-template`,sourceNode:r.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:null,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic})}}async function Ht(e){let t=Array.from(document.querySelectorAll("[data-composition-src]"));t.length!==0&&await Promise.all(t.map(async n=>{let o=n.getAttribute("data-composition-src");if(!o)return;let r=null;try{r=new URL(o,document.baseURI)}catch{r=null}rt(n);try{let i=n.getAttribute("data-composition-id"),u=i!=null?document.querySelector(`template#${CSS.escape(i)}-template`):null;if(u){await st({host:n,hostCompositionId:i,hostCompositionSrc:o,sourceNode:u.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:r,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic});return}let d=await fetch(o);if(!d.ok)throw new Error(`HTTP ${d.status}`);let c=await d.text(),a=new DOMParser().parseFromString(c,"text/html"),m=(i?a.querySelector(`template#${CSS.escape(i)}-template`):null)??a.querySelector("template"),p=m?m.content:a.body,F=m?void 0:Array.from(a.head.querySelectorAll("style")),D=m?void 0:Array.from(a.head.querySelectorAll("script"));await st({host:n,hostCompositionId:i,hostCompositionSrc:o,sourceNode:p,hasTemplate:!!m,fallbackBodyInnerHtml:a.body.innerHTML,compositionUrl:r,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,parseDimensionPx:e.parseDimensionPx,headStyles:F,headScripts:D,onDiagnostic:e.onDiagnostic})}catch(i){e.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:n.getAttribute("data-composition-id"),hostCompositionSrc:o,errorMessage:i instanceof Error?i.message:"unknown_error"}}),rt(n)}}))}function at(){let e=window.gsap;e&&document.querySelectorAll(".caption-group").length!==0&&fetch("caption-overrides.json").then(t=>t.ok?t.json():null).then(t=>{if(!t||!Array.isArray(t)||t.length===0)return;let n=[],o=document.querySelectorAll(".caption-group");for(let r of o){let i=r.querySelectorAll(":scope > span");for(let u of i)n.push(u)}for(let r of t){let i=null;if(r.wordId&&(i=document.getElementById(r.wordId)),!i&&r.wordIndex!==void 0&&(i=n[r.wordIndex]??null),!i||!(i instanceof HTMLElement))continue;let u={},d={};if(r.x!==void 0&&(u.x=r.x),r.y!==void 0&&(u.y=r.y),r.scale!==void 0&&(u.scale=r.scale),r.rotation!==void 0&&(u.rotation=r.rotation),r.opacity!==void 0&&(d.opacity=r.opacity),r.fontSize!==void 0&&(d.fontSize=`${r.fontSize}px`),r.fontWeight!==void 0&&(d.fontWeight=r.fontWeight),r.fontFamily!==void 0&&(d.fontFamily=r.fontFamily),r.activeColor||r.dimColor){let s=e.getTweensOf(i).filter(m=>m.vars.color!==void 0).sort((m,p)=>m.startTime()-p.startTime()),a=s.length>0?String(s[0].vars.color):"";for(let m of s)String(m.vars.color)===a?r.dimColor&&(m.vars.color=r.dimColor):r.activeColor&&(m.vars.color=r.activeColor);r.dimColor&&e.set(i,{color:r.dimColor})}if(Object.keys(d).length>0&&e.set(i,d),Object.keys(u).length>0){let c=document.createElement("span");c.style.display="inline-block",c.dataset.captionWrapper="true",i.parentNode?.insertBefore(c,i),c.appendChild(i),e.set(c,u)}}}).catch(()=>{})}var jt="data-hf-authored-duration",zt="data-hf-authored-end";function Ut(){let e=vt(),t=window,n=null,o=null,r=[],i=new Set,u=null;if(typeof t.__hfRuntimeTeardown=="function")try{t.__hfRuntimeTeardown()}catch{}document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden"),window.__timelines=window.__timelines||{};let d=l=>{r.push(l)},c=(l,h,f)=>{let N=f??`${l}:${JSON.stringify(h)}`;i.has(N)||(i.add(N),me({source:"hf-preview",type:"diagnostic",code:l,details:h}))},s=l=>{let h={scale:1,focusX:960,focusY:540},f=[],N=[],A={time:l.getTime(),duration:l.getDuration(),isPlaying:l.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:l.play,pause:l.pause,seek:l.seek,getTime:l.getTime,getDuration:l.getDuration,isPlaying:l.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>h,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>f,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:l.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>N,getRenderState:()=>({...A,time:l.getTime(),duration:l.getDuration(),isPlaying:l.isPlaying()})}},a=1/60,m=.75,p=.75,F=.35,D=900,C=3,T=2,U=.05,z=100,k=240,Q=l=>{if(l instanceof Error)return l.message||String(l);if(typeof l=="string")return l;try{return JSON.stringify(l)}catch{return String(l??"")}},S=l=>{let h=l.toLowerCase();return h.includes("cannot read properties of null")||h.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:h.includes("failed to execute \'queryselector\'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:h.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},x=l=>{if(l==null||l.trim()==="")return null;let h=Number.parseFloat(l);return!Number.isFinite(h)||h<=0?null:`${h}px`},g=()=>{let l=document.querySelector(\'[data-composition-id][data-root="true"]\');if(l instanceof HTMLElement)return l;let h=Array.from(document.querySelectorAll("[data-composition-id]"));return h.length===0?null:h.find(f=>!f.parentElement?.closest("[data-composition-id]"))??h[0]??null},E=()=>{let l=g();if(!l)return;let h=x(l.getAttribute("data-width")),f=x(l.getAttribute("data-height"));h&&(l.style.width=h),f&&(l.style.height=f),h&&l.style.setProperty("--comp-width",h),f&&l.style.setProperty("--comp-height",f)},b=()=>{let l=g(),h=Array.from(document.querySelectorAll("[data-composition-id]")).filter(f=>f.hasAttribute("data-duration")||f.hasAttribute("data-end"));for(let f of h){if(l&&f===l)continue;let N=f.getAttribute("data-duration"),A=f.getAttribute("data-end");N!=null&&!f.hasAttribute(jt)&&f.setAttribute(jt,N),A!=null&&!f.hasAttribute(zt)&&f.setAttribute(zt,A),f.removeAttribute("data-duration"),f.removeAttribute("data-end")}},y=()=>{let l=g();if(!l)return;l.style.position||(l.style.position="relative"),l.style.overflow="hidden";let h=x(l.getAttribute("data-width")),f=x(l.getAttribute("data-height"));h&&(l.style.width=h),f&&(l.style.height=f);let N=Array.from(l.children);for(let A of N){let te=A.tagName.toLowerCase();if(te==="script"||te==="style"||te==="link"||te==="meta"||!A.hasAttribute("data-start"))continue;let ce=(A.style.top==="0px"||A.style.top==="0")&&(A.style.left==="0px"||A.style.left==="0")&&A.style.width==="100%"&&A.style.height==="100%",pe=/translate\\(\\s*-50%\\s*,\\s*-50%\\s*\\)/.test(A.style.transform);if(ce&&pe&&!A.hasAttribute("data-width")&&!A.hasAttribute("data-height")){let Ae=A.style.top,Y=A.style.left,G=A.style.width,ee=A.style.height;A.style.top="",A.style.left="",A.style.width="",A.style.height="";let q=window.getComputedStyle(A);q.top!=="auto"||q.bottom!=="auto"||q.left!=="auto"||q.right!=="auto"||q.width!=="0px"||q.height!=="0px"||(A.style.top=Ae,A.style.left=Y,A.style.width=G,A.style.height=ee)}let re=window.getComputedStyle(A),ie=re.position;if(ie!=="absolute"&&ie!=="fixed"&&(A.style.position="absolute"),!!A.style.top||!!A.style.bottom||re.top!=="auto"||re.bottom!=="auto"||(A.style.top="0"),!!A.style.left||!!A.style.right||re.left!=="auto"||re.right!=="auto"||(A.style.left="0"),te!=="audio"){let Ae=x(A.getAttribute("data-width")),Y=x(A.getAttribute("data-height")),G=re.width!=="0px"&&re.width!=="auto",ee=re.height!=="0px"&&re.height!=="auto";Ae?!A.style.width&&!G&&(A.style.width=Ae):!A.style.width&&re.width==="0px"&&(A.style.width="100%"),Y?!A.style.height&&!ee&&(A.style.height=Y):!A.style.height&&re.height==="0px"&&(A.style.height="100%")}}},v=(l,h=0)=>Be({timelineRegistry:window.__timelines??{}}).resolveStartForElement(l,h),_=(l,h)=>Be({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:h?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(l),O=!!document.querySelector("[data-composition-src]"),V=!1;{let l=document.querySelectorAll("[data-composition-id]:not([data-composition-src])");for(let h of l){let f=h.getAttribute("data-composition-id");if(f&&h.children.length===0&&document.querySelector(`template#${CSS.escape(f)}-template`)){V=!0;break}}}let w=!O&&!V,K=l=>{if(!l||typeof l.duration!="function")return null;try{let h=Number(l.duration());return Number.isFinite(h)?Math.max(0,h):null}catch{return null}},Z=l=>typeof l=="number"&&Number.isFinite(l)&&l>a,W=l=>{let h=Number(l.getAttribute("data-duration"));if(Number.isFinite(h)&&h>0)return h;let f=Number(l.getAttribute("data-playback-start")??l.getAttribute("data-media-start")??"0"),N=Number.isFinite(f)?Math.max(0,f):0;return Number.isFinite(l.duration)&&l.duration>N?Math.max(0,l.duration-N):null},j=()=>{let l=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(l.length===0)return null;let h=0;for(let f of l){let N=v(f,0);if(!Number.isFinite(N))continue;let A=W(f);A==null||A<=a||(h=Math.max(h,Math.max(0,N)+A))}return h>a?h:null},R=()=>{let l=j();return typeof l!="number"||!Number.isFinite(l)||l<=a?null:l},$=l=>Z(l)?Math.max(a,l*m):a,fe=(l,h=0)=>{let f=K(l),N=R(),A=Number.isFinite(h)&&h>a?h:0,te=0;Z(f)?te=Math.max(f,A):Z(N)?te=Math.max(N,A):te=A;let ce=Math.max(1,Number(e.maxTimelineDurationSeconds)||1800);return te>0?Math.max(0,Math.min(te,ce)):0},le=()=>{let l=window.__timelines??{},h=Be({timelineRegistry:l}),f=R(),N=$(f),A=Y=>{let G=document.querySelector(`[data-composition-id="${CSS.escape(Y)}"]`);return G?h.resolveStartForElement(G,0):0},te=Y=>{let G=window.gsap;if(!G||typeof G.timeline!="function")return null;let ee=G.timeline({paused:!0});for(let q of Y)ee.add(q.timeline,A(q.compositionId));return ee},ce=(Y,G)=>{if(!Z(Y))return null;let ee=window.gsap;if(!ee||typeof ee.timeline!="function")return null;let q=ee.timeline({paused:!0});if(G)try{q.add(G,0)}catch{}let ne=q;if(typeof ne.to=="function")try{ne.to({},{duration:Y})}catch{}return q},pe=(Y,G)=>{let ee=Y;if(typeof ee.getChildren!="function")return[];try{let q=ee.getChildren(!0,!0,!0)??[];if(!Array.isArray(q))return[];let ne=[];for(let se of G)if(!q.some(Ce=>Ce===se.timeline))try{let Ce=A(se.compositionId);Y.add(se.timeline,Ce),ne.push(se.compositionId)}catch{}return ne}catch{return[]}},re=g(),ie=re?.getAttribute("data-composition-id")??null;if(!ie)return{timeline:null};let he=l[ie]??null,oe=(()=>{if(!re)return[];let Y=new Set,G=Array.from(re.querySelectorAll("[data-composition-id]")),ee=[];for(let q of G){let ne=q.getAttribute("data-composition-id");if(!ne||ne===ie||Y.has(ne))continue;Y.add(ne);let se=l[ne]??null;if(!se||typeof se.play!="function"||typeof se.pause!="function")continue;let we=K(se);ee.push({compositionId:ne,timeline:se,durationSeconds:we??0})}return ee})(),Ae=Y=>{for(let G of Y){let ee=G.timeline;if(typeof ee.paused=="function")try{ee.paused(!1)}catch{}}};if(oe.length>0&&Ae(oe),he){let Y=oe.length>0?pe(he,oe):[];if((oe.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+ie+"\'])"))&&(M=!0),Y.length>0)try{let q=he.time();he.seek(q,!1)}catch{}let G=K(he);if(!Z(G)&&oe.length>0){let q=oe.map(An=>An.compositionId),ne=te(oe),se=K(ne);if(ne&&Z(se))return{timeline:ne,selectedTimelineIds:q,selectedDurationSeconds:se,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:ie,rootDurationSeconds:G,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:N,selectedDurationSeconds:se,mediaDurationFloorSeconds:f,selectedTimelineIds:q,autoNestedChildren:Y}}};let we=ce(f??0,he),Ce=K(we);if(we&&Z(Ce))return{timeline:we,selectedTimelineIds:[ie],selectedDurationSeconds:Ce,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:ie,rootDurationSeconds:G,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:f,selectedDurationSeconds:Ce,selectedTimelineIds:[ie],autoNestedChildren:Y}}}}if(!Z(G)&&oe.length===0){let q=ce(f??0,he),ne=K(q);if(q&&Z(ne))return{timeline:q,selectedTimelineIds:[ie],selectedDurationSeconds:ne,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:ie,rootDurationSeconds:G,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:f,selectedDurationSeconds:ne,selectedTimelineIds:[ie]}}}}let ee=re?.getAttribute("data-duration");if(ee){let q=parseFloat(ee);if(Z(q)&&Z(G)&&q>=G+.5){let ne=he;if(typeof ne.to=="function")try{ne.to({},{duration:0},q)}catch{}let se=K(he);if(Z(se))return{timeline:he,selectedTimelineIds:[ie],selectedDurationSeconds:se,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:ie,rootDurationSeconds:G,rootDeclaredDur:q,newDur:se}}}}}return{timeline:he,selectedTimelineIds:[ie],selectedDurationSeconds:G,mediaDurationFloorSeconds:f,diagnostics:Y.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:ie,selectedDurationSeconds:G,autoNestedChildren:Y}}:void 0}}if(oe.length>0){let Y=oe.map(q=>q.compositionId),G=te(oe),ee=K(G);if(G)return{timeline:G,selectedTimelineIds:Y,selectedDurationSeconds:ee,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:ie,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:N,selectedDurationSeconds:ee,mediaDurationFloorSeconds:f,selectedTimelineIds:Y}}}}return{timeline:null}},B=()=>{let l=e.capturedTimeline;if(!l||typeof l.time!="function")return;let h=Number(l.time());Number.isFinite(h)&&(e.currentTime=Math.max(0,h))},M=!1,L=()=>{if(!w)return!1;let l=e.capturedTimeline,h=K(l),f=Z(h);if(l&&f&&M)return!1;let N=le();return N.timeline?l&&l===N.timeline?(typeof l.timeScale=="function"&&l.timeScale(e.playbackRate),!1):(e.capturedTimeline=N.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),N.diagnostics&&me({source:"hf-preview",type:"diagnostic",code:N.diagnostics.code,details:N.diagnostics.details}),me({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:N.selectedTimelineIds??[],selectedDurationSeconds:N.selectedDurationSeconds??null,mediaDurationFloorSeconds:N.mediaDurationFloorSeconds??null}}),!0):!1},J=()=>{let l=g();if(!(l instanceof HTMLElement))return;let h=l.getBoundingClientRect(),f=Number(l.getAttribute("data-width")),N=Number(l.getAttribute("data-height")),A=window.getComputedStyle(l),te=Number.isFinite(f)&&f>0&&Number.isFinite(N)&&N>0,ce=h.width<=0||h.height<=0||l.clientWidth<=0||l.clientHeight<=0;!te||!ce||c("root_stage_layout_zero",{compositionId:l.getAttribute("data-composition-id")??null,declaredWidth:f,declaredHeight:N,rectWidth:Math.round(h.width),rectHeight:Math.round(h.height),clientWidth:l.clientWidth,clientHeight:l.clientHeight,display:A.display,visibility:A.visibility,overflow:A.overflow},`root-stage-layout-zero:${l.getAttribute("data-composition-id")??"unknown"}`)},X=()=>{e.tornDown||(u!=null&&window.cancelAnimationFrame(u),u=window.requestAnimationFrame(()=>{u=null,J()}))},I=()=>{n=l=>{let h=Q(l.error??l.message).slice(0,k);if(!h)return;let f=S(h);me({source:"hf-preview",type:"diagnostic",code:f.code,details:{category:f.category,message:h,filename:l.filename||null,line:Number.isFinite(l.lineno)?l.lineno:null,column:Number.isFinite(l.colno)?l.colno:null}})},o=l=>{let h=Q(l.reason).slice(0,k);if(!h)return;let f=S(h);me({source:"hf-preview",type:"diagnostic",code:`${f.code}_unhandled_rejection`,details:{category:`${f.category}-unhandled-rejection`,message:h}})},window.addEventListener("error",n),window.addEventListener("unhandledrejection",o)},P=()=>{let l=Array.from(document.querySelectorAll("img, video, audio, source, link[rel=\'stylesheet\']"));for(let f of l){let N=()=>{if(!(f instanceof Element))return;let A=f.tagName.toLowerCase(),te=f.getAttribute("src")??f.getAttribute("href")??f.getAttribute("poster")??null,ce=A==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";c(ce,{tagName:A,assetUrl:te,currentSrc:(f instanceof HTMLImageElement||f instanceof HTMLMediaElement)&&f.currentSrc||null,readyState:f instanceof HTMLMediaElement?f.readyState:null,networkState:f instanceof HTMLMediaElement?f.networkState:null},`${ce}:${A}:${te??"unknown"}`)};f.addEventListener("error",N),d(()=>{f.removeEventListener("error",N)})}let h=document.fonts;h&&h.ready.then(()=>{if(e.tornDown)return;let f=Array.from(h).filter(N=>N.status==="error").map(N=>N.family).filter(N=>!!N).slice(0,10);f.length!==0&&c("runtime_font_load_issue",{failedFamilies:f,totalFaces:Array.from(h).length},`runtime-font-load-issue:${f.join("|")}`)}).catch(()=>{})},H=(l,h)=>{if(!l.timeline)return!1;let f=e.capturedTimeline;if(f&&f===l.timeline)return!1;let N=Math.max(0,e.currentTime||0),A=e.isPlaying;e.capturedTimeline=l.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{e.capturedTimeline.pause(),e.capturedTimeline.seek(N,!1),A&&e.capturedTimeline.play()}catch{}return me({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:h,previousTime:N,selectedTimelineIds:l.selectedTimelineIds??[],selectedDurationSeconds:l.selectedDurationSeconds??null,mediaDurationFloorSeconds:l.mediaDurationFloorSeconds??null}}),!0},ue=null,de=!1,Ee=new Set,ge=()=>{e.tornDown||(ue!=null&&window.clearTimeout(ue),ue=window.setTimeout(()=>{if(e.tornDown)return;ue=null;let l=le();if(!l.timeline||!Z(l.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){L()&&(ke(),ye(!0));return}if(de)return;let f=K(e.capturedTimeline),N=l.selectedDurationSeconds??K(l.timeline);Z(N)&&(!Z(f)||N>=f+U)&&H(l,"manual")&&(de=!0,me({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:f??null,selectedDurationSeconds:N??null,selectedTimelineIds:l.selectedTimelineIds??[],mediaDurationFloorSeconds:l.mediaDurationFloorSeconds??null}}),ke(),ye(!0))},z))},gn=()=>{for(let l of Ee)l.removeEventListener("loadedmetadata",ge),l.removeEventListener("durationchange",ge);Ee.clear()},Qe=()=>{if(e.tornDown)return;let l=Array.from(document.querySelectorAll("video, audio"));for(let h of l)Ee.has(h)||(Ee.add(h),h.addEventListener("loadedmetadata",ge),h.addEventListener("durationchange",ge),h.preload!=="auto"&&(h.preload="auto"),h.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&h.load())},ht=()=>{let l=Lt({resolveStartSeconds:N=>v(N,0)});Tt({clips:l.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,me({source:"hf-preview",type:"media-autoplay-blocked"}))}});let h=document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null,f=Array.from(document.querySelectorAll("[data-start]"));for(let N of f){if(!(N instanceof HTMLElement))continue;let A=N.tagName.toLowerCase();if(A==="script"||A==="style"||A==="link"||A==="meta")continue;if(!N.getAttribute("data-composition-id")){let oe=N.closest("[data-composition-id]")?.getAttribute("data-composition-id")??null;if(oe&&oe!==h)continue}let ce=v(N,0),pe=_(N),re=N.getAttribute("data-composition-id");if(re){let Te=(window.__timelines??{})[re],oe=null;if(Te&&typeof Te.duration=="function"){let Ae=Number(Te.duration());Number.isFinite(Ae)&&Ae>0&&(oe=Ae)}pe!=null&&pe>0&&oe!=null?pe=Math.min(pe,oe):(pe==null||pe<=0)&&oe!=null&&(pe=oe)}let ie=pe!=null&&pe>0?ce+pe:Number.POSITIVE_INFINITY,he=e.currentTime>=ce&&(Number.isFinite(ie)?e.currentTime<ie:!0);N.style.visibility=he?"visible":"hidden"}},ye=l=>{B();let h=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),f=Date.now();(l||h!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||f-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=h,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=f,me({source:"hf-preview",type:"state",frame:h,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},ke=()=>{b(),E(),y();let l=g();if(l){let f=x(l.getAttribute("data-width")),N=x(l.getAttribute("data-height")),A=f?parseInt(f,10):0,te=N?parseInt(N,10):0;A>0&&te>0&&me({source:"hf-preview",type:"stage-size",width:A,height:te})}L();let h=Ot({canonicalFps:e.canonicalFps,maxTimelineDurationSeconds:e.maxTimelineDurationSeconds});window.__clipManifest=h,me(h),X()},Pe=(l,h=0)=>{for(let f of e.deterministicAdapters){try{l==="discover"&&f.discover(),l==="pause"&&f.pause(),l==="play"&&f.play&&f.play()}catch{}if(l==="discover")try{f.seek({time:h})}catch{}}};if(w)at();else{let l={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,parseDimensionPx:x,onDiagnostic:({code:h,details:f})=>{me({source:"hf-preview",type:"diagnostic",code:h,details:f})}};Ht(l).then(()=>Wt(l)).finally(()=>{w=!0,Pe("discover",e.currentTime),Qe(),P(),at(),ke(),ye(!0)})}let ze=wt({postMessage:l=>me(l)});ze.installPickerApi();let gt=l=>{let h=Number(l);!Number.isFinite(h)||h<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,h)),e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let f=document.querySelectorAll("video, audio");for(let N of f)if(N instanceof HTMLMediaElement)try{N.playbackRate=e.playbackRate}catch{}},ae=Rt({getTimeline:()=>e.capturedTimeline,setTimeline:l=>{e.capturedTimeline=l},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:l=>{e.isPlaying=l},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:gt,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(l,h)=>{e.currentTime=Math.max(0,Number(l)||0),e.isPlaying=h,ht()},onStatePost:ye,onDeterministicSeek:l=>{for(let h of e.deterministicAdapters)try{h.seek({time:Number(l)||0})}catch{}},onDeterministicPause:()=>Pe("pause"),onDeterministicPlay:()=>Pe("play"),onRenderFrameSeek:()=>{},onShowNativeVideos:()=>{},getSafeDuration:()=>fe(e.capturedTimeline,0)});window.__player=s(ae),window.__playerReady=!0,window.__renderReady=!0,Nt(me),Oe("composition_loaded",{duration:ae.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.controlBridgeHandler=At({onPlay:()=>{ae.play(),Oe("composition_played",{time:ae.getTime()})},onPause:()=>{ae.pause(),Oe("composition_paused",{time:ae.getTime()})},onSeek:(l,h)=>{let f=Math.max(0,l)/e.canonicalFps;ae.seek(f),Oe("composition_seeked",{time:f})},onSetMuted:l=>{e.bridgeMuted=l;let h=l||e.mediaOutputMuted,f=document.querySelectorAll("video, audio");for(let N of f)N instanceof HTMLMediaElement&&(N.muted=h)},onSetMediaOutputMuted:l=>{e.mediaOutputMuted=l;let h=l||e.bridgeMuted,f=document.querySelectorAll("video, audio");for(let N of f)N instanceof HTMLMediaElement&&(N.muted=h)},onSetPlaybackRate:l=>gt(l),onEnablePickMode:()=>ze.enablePickMode(),onDisablePickMode:()=>ze.disablePickMode()}),L(),e.capturedTimeline&&(ae._timeline=e.capturedTimeline),w&&setTimeout(()=>{let l=e.capturedTimeline;L()&&e.capturedTimeline!==l&&(ae._timeline=e.capturedTimeline),Pe("discover",e.currentTime),ke(),ye(!0)},0),e.deterministicAdapters=[kt(),Et({resolveStartSeconds:l=>v(l,0)}),Ct(),Dt(),yt({getTimeline:()=>e.capturedTimeline})],I(),Pe("discover"),Qe(),e.timelinePollIntervalId&&clearInterval(e.timelinePollIntervalId);let Ze=0,Ue=null,St=0,Ye=!1,Le=0,Ft=()=>{St=Date.now(),Ye=!1,Le=0};e.timelinePollIntervalId=setInterval(()=>{Ze+=1;let h=e.isPlaying&&e.capturedTimeline!=null&&Math.max(0,e.currentTime||0)<T?!1:L();if(e.capturedTimeline&&!ae._timeline&&(ae._timeline=e.capturedTimeline),(h||Ze%20===0)&&ke(),Ze%10===0&&Qe(),B(),e.isPlaying&&e.capturedTimeline){let f=Math.max(0,e.currentTime||0),N=Ue,A=fe(e.capturedTimeline,0);if(A>0&&f>=A){ae.pause(),ae.seek(A),Ue=A,Le=0,ye(!0);return}if(N!=null&&N>=p&&f<=F?Le+=1:Le=0,!Ye&&Le>=C&&Date.now()-St>D){let ce=le();H(ce,"loop_guard")&&(Ye=!0,Le=0)}Ue=Math.max(0,e.currentTime||0)}else Ue=Math.max(0,e.currentTime||0);e.isPlaying&&ht(),ye(!1)},50),ke(),ye(!0);let Sn=ae.seek;ae.seek=l=>{Ft(),Sn(l)};let Fn=ae.renderSeek;ae.renderSeek=l=>{Ft(),Fn(l)};let Xe=()=>{if(!e.tornDown){e.tornDown=!0,e.timelinePollIntervalId&&(clearInterval(e.timelinePollIntervalId),e.timelinePollIntervalId=null),ue!=null&&(window.clearTimeout(ue),ue=null),u!=null&&(window.cancelAnimationFrame(u),u=null),gn(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),n&&(window.removeEventListener("error",n),n=null),o&&(window.removeEventListener("unhandledrejection",o),o=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),ze.disablePickMode();for(let l of e.deterministicAdapters)if(!(!l||typeof l.revert!="function"))try{l.revert()}catch{}e.deterministicAdapters=[];for(let l of r.splice(0))try{l()}catch{}for(let l of e.injectedCompStyles)try{l.remove()}catch{}e.injectedCompStyles=[];for(let l of e.injectedCompScripts)try{l.remove()}catch{}e.injectedCompScripts=[],e.capturedTimeline=null,t.__hfRuntimeTeardown===Xe&&(t.__hfRuntimeTeardown=null)}};t.__hfRuntimeTeardown=Xe,e.beforeUnloadHandler=Xe,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Gt=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],lt=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function _n(e){if(e<=255)return Gt[e];let t=0,n=lt.length-1;for(;t<=n;){let o=t+n>>1,r=lt[o];if(e<r[0]){n=o-1;continue}if(e>r[1]){t=o+1;continue}return r[2]}return"L"}function Wn(e){let t=e.length;if(t===0)return null;let n=new Array(t),o=!1;for(let s=0;s<t;){let a=e.charCodeAt(s),m=a,p=1;if(a>=55296&&a<=56319&&s+1<t){let D=e.charCodeAt(s+1);D>=56320&&D<=57343&&(m=(a-55296<<10)+(D-56320)+65536,p=2)}let F=_n(m);(F==="R"||F==="AL"||F==="AN")&&(o=!0);for(let D=0;D<p;D++)n[s+D]=F;s+=p}if(!o)return null;let r=0;for(let s=0;s<t;s++){let a=n[s];if(a==="L"){r=0;break}if(a==="R"||a==="AL"){r=1;break}}let i=new Int8Array(t);for(let s=0;s<t;s++)i[s]=r;let u=r&1?"R":"L",d=u,c=d;for(let s=0;s<t;s++)n[s]==="NSM"?n[s]=c:c=n[s];c=d;for(let s=0;s<t;s++){let a=n[s];a==="EN"?n[s]=c==="AL"?"AN":"EN":(a==="R"||a==="L"||a==="AL")&&(c=a)}for(let s=0;s<t;s++)n[s]==="AL"&&(n[s]="R");for(let s=1;s<t-1;s++)n[s]==="ES"&&n[s-1]==="EN"&&n[s+1]==="EN"&&(n[s]="EN"),n[s]==="CS"&&(n[s-1]==="EN"||n[s-1]==="AN")&&n[s+1]===n[s-1]&&(n[s]=n[s-1]);for(let s=0;s<t;s++){if(n[s]!=="EN")continue;let a;for(a=s-1;a>=0&&n[a]==="ET";a--)n[a]="EN";for(a=s+1;a<t&&n[a]==="ET";a++)n[a]="EN"}for(let s=0;s<t;s++){let a=n[s];(a==="WS"||a==="ES"||a==="ET"||a==="CS")&&(n[s]="ON")}c=d;for(let s=0;s<t;s++){let a=n[s];a==="EN"?n[s]=c==="L"?"L":"EN":(a==="R"||a==="L")&&(c=a)}for(let s=0;s<t;s++){if(n[s]!=="ON")continue;let a=s+1;for(;a<t&&n[a]==="ON";)a++;let m=s>0?n[s-1]:d,p=a<t?n[a]:d,F=m!=="L"?"R":"L";if(F===(p!=="L"?"R":"L"))for(let C=s;C<a;C++)n[C]=F;s=a-1}for(let s=0;s<t;s++)n[s]==="ON"&&(n[s]=u);for(let s=0;s<t;s++){let a=n[s];(i[s]&1)===0?a==="R"?i[s]++:(a==="AN"||a==="EN")&&(i[s]+=2):(a==="L"||a==="AN"||a==="EN")&&i[s]++}return i}function qt(e,t){let n=Wn(e);if(n===null)return null;let o=new Int8Array(t.length);for(let r=0;r<t.length;r++)o[r]=n[t[r]];return o}var Hn=/[ \\t\\n\\r\\f]+/g,jn=/[\\t\\n\\r\\f]| {2,}|^ | $/;function zn(e){let t=e??"normal";return t==="pre-wrap"?{mode:t,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:t,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function Un(e){if(!jn.test(e))return e;let t=e.replace(Hn," ");return t.charCodeAt(0)===32&&(t=t.slice(1)),t.length>0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function Gn(e){return/[\\r\\f]/.test(e)?e.replace(/\\r\\n/g,`\n`).replace(/[\\r\\f]/g,`\n`):e.replace(/\\r\\n/g,`\n`)}var ut=null,qn;function $n(){return ut===null&&(ut=new Intl.Segmenter(qn,{granularity:"word"})),ut}var Kn=/\\p{Script=Arabic}/u,qe=/\\p{M}/u,Xt=/\\p{Nd}/u;function $t(e){return Kn.test(e)}function Kt(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function Fe(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n<12288)){if(n>=55296&&n<=56319&&t+1<e.length){let o=e.charCodeAt(t+1);if(o>=56320&&o<=57343){let r=(n-55296<<10)+(o-56320)+65536;if(Kt(r))return!0;t++;continue}}if(Kt(n))return!0}}return!1}function Vn(e){let t=Ve(e);return t!==null&&(Ke.has(t)||be.has(t))}var Jn=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function Qn(e){return Fe(e)}function Zn(e){let t=Ve(e);return t!==null&&Jn.has(t)}function $e(e){return!Vn(e)&&!Zn(e)}var Ke=new Set(["\\uFF0C","\\uFF0E","\\uFF01","\\uFF1A","\\uFF1B","\\uFF1F","\\u3001","\\u3002","\\u30FB","\\uFF09","\\u3015","\\u3009","\\u300B","\\u300D","\\u300F","\\u3011","\\u3017","\\u3019","\\u301B","\\u30FC","\\u3005","\\u303B","\\u309D","\\u309E","\\u30FD","\\u30FE"]),je=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),dt=new Set(["\'","\\u2019"]),be=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),Yn=new Set([":",".","\\u060C","\\u061B"]),Xn=new Set(["\\u104F"]),ei=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function ti(e){if(mt(e))return!0;let t=!1;for(let n of e){if(be.has(n)){t=!0;continue}if(!(t&&qe.test(n)))return!1}return t}function ni(e){for(let t of e)if(!Ke.has(t)&&!be.has(t))return!1;return e.length>0}function ii(e){if(mt(e))return!0;for(let t of e)if(!je.has(t)&&!dt.has(t)&&!qe.test(t))return!1;return e.length>0}function mt(e){let t=!1;for(let n of e)if(!(n==="\\\\"||qe.test(n))){if(je.has(n)||be.has(n)||dt.has(n)){t=!0;continue}return!1}return t}function en(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let o=e.charCodeAt(n);if(o<56320||o>57343)return n;let r=n-1;if(r<0)return n;let i=e.charCodeAt(r);return i>=55296&&i<=56319?r:n}function Ve(e){if(e.length===0)return null;let t=en(e,e.length);return e.slice(t)}function oi(e){let t=Array.from(e),n=t.length;for(;n>0;){let o=t[n-1];if(qe.test(o)){n--;continue}if(je.has(o)||dt.has(o)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function ri(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\\u2014"?e:null}function Vt(e,t,n,o){let r=t[o],i=e[o];if(r==null)return i;let u=n[o];if(i.length===u)return i;let d=r.repeat(u);return e[o]=d,d}function Jt(e,t){return e&&t!==null&&Yn.has(t)}function si(e){let t=Ve(e);return t!==null&&Xn.has(t)}function ai(e){if(e.length<2||e[0]!==" ")return null;let t=e.slice(1);return/^\\p{M}+$/u.test(t)?{space:" ",marks:t}:null}function Je(e){let t=e.length;for(;t>0;){let n=en(e,t),o=e.slice(n,t);if(ei.has(o))return!0;if(!be.has(o))return!1;t=n}return!1}function li(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`\n`)return"hard-break"}return e===" "?"space":e==="\\xA0"||e==="\\u202F"||e==="\\u2060"||e==="\\uFEFF"?"glue":e==="\\u200B"?"zero-width-break":e==="\\xAD"?"soft-hyphen":"text"}var ui=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function Se(e){return e.length===1?e[0]:e.join("")}function ci(e,t){let n=[];for(let o=e.length-1;o>=0;o--)n.push(e[o]);return n.push(t),Se(n)}function di(e,t,n,o){if(!ui.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];let r=[],i=null,u=[],d=n,c=!1,s=0;for(let a of e){let m=li(a,o),p=m==="text"&&t;if(i!==null&&m===i&&p===c){u.push(a),s+=a.length;continue}i!==null&&r.push({text:Se(u),isWordLike:c,kind:i,start:d}),i=m,u=[a],d=n+s,c=p,s+=a.length}return i!==null&&r.push({text:Se(u),isWordLike:c,kind:i,start:d}),r}function ct(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}var mi=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function xi(e,t){let n=e.texts[t];return n.startsWith("www.")?!0:mi.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function fi(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}function pi(e){let t=e.texts.slice(),n=e.isWordLike.slice(),o=e.kinds.slice(),r=e.starts.slice();for(let u=0;u<e.len;u++){if(o[u]!=="text"||!xi(e,u))continue;let d=[t[u]],c=u+1;for(;c<e.len&&!ct(o[c]);){d.push(t[c]),n[u]=!0;let s=t[c].includes("?");if(o[c]="text",t[c]="",c++,s)break}t[u]=Se(d)}let i=0;for(let u=0;u<t.length;u++){let d=t[u];d.length!==0&&(i!==u&&(t[i]=d,n[i]=n[u],o[i]=o[u],r[i]=r[u]),i++)}return t.length=i,n.length=i,o.length=i,r.length=i,{len:i,texts:t,isWordLike:n,kinds:o,starts:r}}function hi(e){let t=[],n=[],o=[],r=[];for(let i=0;i<e.len;i++){let u=e.texts[i];if(t.push(u),n.push(e.isWordLike[i]),o.push(e.kinds[i]),r.push(e.starts[i]),!fi(u))continue;let d=i+1;if(d>=e.len||ct(e.kinds[d]))continue;let c=[],s=e.starts[d],a=d;for(;a<e.len&&!ct(e.kinds[a]);)c.push(e.texts[a]),a++;c.length>0&&(t.push(Se(c)),n.push(!0),o.push("text"),r.push(s),i=a-1)}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:r}}var gi=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),Qt=/^[A-Za-z0-9_]+[,:;]*$/,Zt=/[,:;]+$/;function tn(e){for(let t of e)if(Xt.test(t))return!0;return!1}function He(e){if(e.length===0)return!1;for(let t of e)if(!(Xt.test(t)||gi.has(t)))return!1;return!0}function Si(e){let t=[],n=[],o=[],r=[];for(let i=0;i<e.len;i++){let u=e.texts[i],d=e.kinds[i];if(d==="text"&&He(u)&&tn(u)){let c=[u],s=i+1;for(;s<e.len&&e.kinds[s]==="text"&&He(e.texts[s]);)c.push(e.texts[s]),s++;t.push(Se(c)),n.push(!0),o.push("text"),r.push(e.starts[i]),i=s-1;continue}t.push(u),n.push(e.isWordLike[i]),o.push(d),r.push(e.starts[i])}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:r}}function Fi(e){let t=[],n=[],o=[],r=[];for(let i=0;i<e.len;i++){let u=e.texts[i],d=e.kinds[i],c=e.isWordLike[i];if(d==="text"&&c&&Qt.test(u)){let s=[u],a=Zt.test(u),m=i+1;for(;a&&m<e.len&&e.kinds[m]==="text"&&e.isWordLike[m]&&Qt.test(e.texts[m]);){let p=e.texts[m];s.push(p),a=Zt.test(p),m++}t.push(Se(s)),n.push(!0),o.push("text"),r.push(e.starts[i]),i=m-1;continue}t.push(u),n.push(c),o.push(d),r.push(e.starts[i])}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:r}}function Ai(e){let t=[],n=[],o=[],r=[];for(let i=0;i<e.len;i++){let u=e.texts[i];if(e.kinds[i]==="text"&&u.includes("-")){let d=u.split("-"),c=d.length>1;for(let s=0;s<d.length;s++){let a=d[s];if(!c)break;(a.length===0||!tn(a)||!He(a))&&(c=!1)}if(c){let s=0;for(let a=0;a<d.length;a++){let m=d[a],p=a<d.length-1?`${m}-`:m;t.push(p),n.push(!0),o.push("text"),r.push(e.starts[i]+s),s+=p.length}continue}}t.push(u),n.push(e.isWordLike[i]),o.push(e.kinds[i]),r.push(e.starts[i])}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:r}}function Ni(e){let t=[],n=[],o=[],r=[],i=0;for(;i<e.len;){let u=[e.texts[i]],d=e.isWordLike[i],c=e.kinds[i],s=e.starts[i];if(c==="glue"){let a=[u[0]],m=s;for(i++;i<e.len&&e.kinds[i]==="glue";)a.push(e.texts[i]),i++;let p=Se(a);if(i<e.len&&e.kinds[i]==="text")u[0]=p,u.push(e.texts[i]),d=e.isWordLike[i],c="text",s=m,i++;else{t.push(p),n.push(!1),o.push("glue"),r.push(m);continue}}else i++;if(c==="text")for(;i<e.len&&e.kinds[i]==="glue";){let a=[];for(;i<e.len&&e.kinds[i]==="glue";)a.push(e.texts[i]),i++;let m=Se(a);if(i<e.len&&e.kinds[i]==="text"){u.push(m,e.texts[i]),d=d||e.isWordLike[i],i++;continue}u.push(m)}t.push(Se(u)),n.push(d),o.push(c),r.push(s)}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:r}}function Ei(e){let t=e.texts.slice(),n=e.isWordLike.slice(),o=e.kinds.slice(),r=e.starts.slice();for(let i=0;i<t.length-1;i++){if(o[i]!=="text"||o[i+1]!=="text"||!Fe(t[i])||!Fe(t[i+1]))continue;let u=oi(t[i]);u!==null&&(t[i]=u.head,t[i+1]=u.tail+t[i+1],r[i+1]=r[i]+u.head.length)}return{len:t.length,texts:t,isWordLike:n,kinds:o,starts:r}}function Yt(e,t,n){let o=$n(),r=0,i=[],u=[],d=[],c=[],s=[],a=[],m=[],p=[],F=[],D=[],C=[],T=[];for(let x of o.segment(e))for(let g of di(x.segment,x.isWordLike??!1,x.index,n)){let K=function(){a[w]!==null&&(u[w]=[Vt(i,a,m,w)],a[w]=null),u[w].push(g.text),d[w]=d[w]||g.isWordLike,p[w]=p[w]||y,F[w]=F[w]||v,D[w]=O,C[w]=V,T[w]=Jt(F[w],_)},E=g.kind==="text",b=ri(g.text,g.isWordLike,g.kind),y=Fe(g.text),v=$t(g.text),_=Ve(g.text),O=Je(g.text),V=si(g.text),w=r-1;t.carryCJKAfterClosingQuote&&E&&r>0&&c[w]==="text"&&y&&p[w]&&D[w]||E&&r>0&&c[w]==="text"&&ni(g.text)&&p[w]||E&&r>0&&c[w]==="text"&&C[w]?K():E&&r>0&&c[w]==="text"&&g.isWordLike&&v&&T[w]?(K(),d[w]=!0):b!==null&&r>0&&c[w]==="text"&&a[w]===b?m[w]=(m[w]??1)+1:E&&!g.isWordLike&&r>0&&c[w]==="text"&&(ti(g.text)||g.text==="-"&&d[w])?K():(i[r]=g.text,u[r]=[g.text],d[r]=g.isWordLike,c[r]=g.kind,s[r]=g.start,a[r]=b,m[r]=b===null?0:1,p[r]=y,F[r]=v,D[r]=O,C[r]=V,T[r]=Jt(v,_),r++)}for(let x=0;x<r;x++){if(a[x]!==null){i[x]=Vt(i,a,m,x);continue}i[x]=Se(u[x])}for(let x=1;x<r;x++)c[x]==="text"&&!d[x]&&mt(i[x])&&c[x-1]==="text"&&(i[x-1]+=i[x],d[x-1]=d[x-1]||d[x],i[x]="");let U=Array.from({length:r},()=>null),z=-1;for(let x=r-1;x>=0;x--){let g=i[x];if(g.length!==0){if(c[x]==="text"&&!d[x]&&ii(g)&&z>=0&&c[z]==="text"){let E=U[z]??[];E.push(g),U[z]=E,s[z]=s[x],i[x]="";continue}z=x}}for(let x=0;x<r;x++){let g=U[x];g!=null&&(i[x]=ci(g,i[x]))}let k=0;for(let x=0;x<r;x++){let g=i[x];g.length!==0&&(k!==x&&(i[k]=g,d[k]=d[x],c[k]=c[x],s[k]=s[x]),k++)}i.length=k,d.length=k,c.length=k,s.length=k;let Q=Ni({len:k,texts:i,isWordLike:d,kinds:c,starts:s}),S=Ei(Fi(Ai(Si(hi(pi(Q))))));for(let x=0;x<S.len-1;x++){let g=ai(S.texts[x]);g!==null&&(S.kinds[x]!=="space"&&S.kinds[x]!=="preserved-space"||S.kinds[x+1]!=="text"||!$t(S.texts[x+1])||(S.texts[x]=g.space,S.isWordLike[x]=!1,S.kinds[x]=S.kinds[x]==="preserved-space"?"preserved-space":"space",S.texts[x+1]=g.marks+S.texts[x+1],S.starts[x+1]=S.starts[x]+g.space.length))}return S}function yi(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];let n=[],o=0;for(let r=0;r<e.len;r++)e.kinds[r]==="hard-break"&&(n.push({startSegmentIndex:o,endSegmentIndex:r,consumedEndSegmentIndex:r+1}),o=r+1);return o<e.len&&n.push({startSegmentIndex:o,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),n}function bi(e){if(e.len<=1)return e;let t=[],n=[],o=[],r=[],i=null,u=!1,d=0,c=!1,s=!1;function a(){i!==null&&(t.push(Se(i)),n.push(u),o.push("text"),r.push(d),i=null)}for(let m=0;m<e.len;m++){let p=e.texts[m],F=e.kinds[m],D=e.isWordLike[m],C=e.starts[m];if(F==="text"){let T=Qn(p),U=$e(p);if(i!==null&&c&&s){i.push(p),u=u||D,c=c||T,s=U;continue}a(),i=[p],u=D,d=C,c=T,s=U;continue}a(),t.push(p),n.push(D),o.push(F),r.push(C)}return a(),{len:t.length,texts:t,isWordLike:n,kinds:o,starts:r}}function nn(e,t,n="normal",o="normal"){let r=zn(n),i=r.mode==="pre-wrap"?Gn(e):Un(e);if(i.length===0)return{normalized:i,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let u=o==="keep-all"?bi(Yt(i,t,r)):Yt(i,t,r);return{normalized:i,chunks:yi(u,r),...u}}var Re=null,on=new Map,ve=null,Mi=96,Ci=/\\p{Emoji_Presentation}/u,Di=/[\\p{Emoji_Presentation}\\p{Extended_Pictographic}\\p{Regional_Indicator}\\uFE0F\\u20E3]/u,xt=null,rn=new Map;function ft(){if(Re!==null)return Re;if(typeof OffscreenCanvas<"u")return Re=new OffscreenCanvas(1,1).getContext("2d"),Re;if(typeof document<"u")return Re=document.createElement("canvas").getContext("2d"),Re;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function ki(e){let t=on.get(e);return t||(t=new Map,on.set(e,t)),t}function Ne(e,t){let n=t.get(e);return n===void 0&&(n={width:ft().measureText(e).width,containsCJK:Fe(e)},t.set(e,n)),n}function Ie(){if(ve!==null)return ve;if(typeof navigator>"u")return ve={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},ve;let e=navigator.userAgent,n=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),o=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return ve={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:o,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},ve}function Li(e){let t=e.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return t?parseFloat(t[1]):16}function sn(){return xt===null&&(xt=new Intl.Segmenter(void 0,{granularity:"grapheme"})),xt}function Ti(e){return Ci.test(e)||e.includes("\\uFE0F")}function an(e){return Di.test(e)}function wi(e,t){let n=rn.get(e);if(n!==void 0)return n;let o=ft();o.font=e;let r=o.measureText("\\u{1F600}").width;if(n=0,r>t+.5&&typeof document<"u"&&document.body!==null){let i=document.createElement("span");i.style.font=e,i.style.display="inline-block",i.style.visibility="hidden",i.style.position="absolute",i.textContent="\\u{1F600}",document.body.appendChild(i);let u=i.getBoundingClientRect().width;document.body.removeChild(i),r-u>.5&&(n=r-u)}return rn.set(e,n),n}function Bi(e){let t=0,n=sn();for(let o of n.segment(e))Ti(o.segment)&&t++;return t}function Ri(e,t){return t.emojiCount===void 0&&(t.emojiCount=Bi(e)),t.emojiCount}function Me(e,t,n){return n===0?t.width:t.width-Ri(e,t)*n}function ln(e,t,n,o,r){if(t.breakableFitAdvances!==void 0)return t.breakableFitAdvances;let i=sn(),u=[];for(let a of i.segment(e))u.push(a.segment);if(u.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(r==="sum-graphemes"){let a=[];for(let m of u){let p=Ne(m,n);a.push(Me(m,p,o))}return t.breakableFitAdvances=a,t.breakableFitAdvances}if(r==="pair-context"||u.length>Mi){let a=[],m=null,p=0;for(let F of u){let D=Ne(F,n),C=Me(F,D,o);if(m===null)a.push(C);else{let T=m+F,U=Ne(T,n);a.push(Me(T,U,o)-p)}m=F,p=C}return t.breakableFitAdvances=a,t.breakableFitAdvances}let d=[],c="",s=0;for(let a of u){c+=a;let m=Ne(c,n),p=Me(c,m,o);d.push(p-s),s=p}return t.breakableFitAdvances=d,t.breakableFitAdvances}function un(e,t){let n=ft();n.font=e;let o=ki(e),r=Li(e),i=t?wi(e,r):0;return{cache:o,fontSize:r,emojiCorrection:i}}function vi(e,t){for(;t<e.widths.length;){let n=e.kinds[t];if(n!=="space"&&n!=="zero-width-break"&&n!=="soft-hyphen")break;t++}return t}function Ii(e,t){if(t<=0)return 0;let n=e%t;return Math.abs(n)<=1e-6?t:t-n}function Pi(e,t,n,o,r){let i=0,u=t;for(;i<e.length;){let d=u+e[i];if((i+1<e.length?d+r:d)>n+o)break;u=d,i++}return{fitCount:i,fittedWidth:u}}function cn(e,t){return e.simpleLineWalkFastPath?dn(e,t):mn(e,t)}function dn(e,t,n){let{widths:o,kinds:r,breakableFitAdvances:i}=e;if(o.length===0)return 0;let d=Ie().lineFitEpsilon,c=t+d,s=0,a=0,m=!1,p=0,F=0,D=0,C=0,T=-1,U=0;function z(){T=-1,U=0}function k(b=D,y=C,v=a){s++,n?.({startSegmentIndex:p,startGraphemeIndex:F,endSegmentIndex:b,endGraphemeIndex:y,width:v}),a=0,m=!1,z()}function Q(b,y){m=!0,p=b,F=0,D=b+1,C=0,a=y}function S(b,y,v){m=!0,p=b,F=y,D=b,C=y+1,a=v}function x(b,y){if(!m){Q(b,y);return}a+=y,D=b+1,C=0}function g(b,y){let v=i[b];for(let _=y;_<v.length;_++){let O=v[_];m?a+O>c?(k(),S(b,_,O)):(a+=O,D=b,C=_+1):S(b,_,O)}m&&D===b&&C===v.length&&(D=b+1,C=0)}let E=0;for(;E<o.length&&!(!m&&(E=vi(e,E),E>=o.length));){let b=o[E],y=r[E],v=y==="space"||y==="preserved-space"||y==="tab"||y==="zero-width-break"||y==="soft-hyphen";if(!m){b>t&&i[E]!==null?g(E,0):Q(E,b),v&&(T=E+1,U=a-b),E++;continue}if(a+b>c){if(v){x(E,b),k(E+1,0,a-b),E++;continue}if(T>=0){if(D>T||D===T&&C>0){k();continue}k(T,0,U);continue}if(b>t&&i[E]!==null){k(),g(E,0),E++;continue}k();continue}x(E,b),v&&(T=E+1,U=a-b),E++}return m&&k(),s}function mn(e,t,n){if(e.simpleLineWalkFastPath)return dn(e,t,n);let{widths:o,lineEndFitAdvances:r,lineEndPaintAdvances:i,kinds:u,breakableFitAdvances:d,discretionaryHyphenWidth:c,tabStopAdvance:s,chunks:a}=e;if(o.length===0||a.length===0)return 0;let m=Ie(),p=m.lineFitEpsilon,F=t+p,D=0,C=0,T=!1,U=0,z=0,k=0,Q=0,S=-1,x=0,g=0,E=null;function b(){S=-1,x=0,g=0,E=null}function y(W=k,j=Q,R=C){D++,n?.({startSegmentIndex:U,startGraphemeIndex:z,endSegmentIndex:W,endGraphemeIndex:j,width:R}),C=0,T=!1,b()}function v(W,j){T=!0,U=W,z=0,k=W+1,Q=0,C=j}function _(W,j,R){T=!0,U=W,z=j,k=W,Q=j+1,C=R}function O(W,j){if(!T){v(W,j);return}C+=j,k=W+1,Q=0}function V(W,j,R,$){if(!j)return;let fe=W==="tab"?0:r[R],le=W==="tab"?$:i[R];S=R+1,x=C-$+fe,g=C-$+le,E=W}function w(W,j){let R=d[W];for(let $=j;$<R.length;$++){let fe=R[$];T?C+fe>F?(y(),_(W,$,fe)):(C+=fe,k=W,Q=$+1):_(W,$,fe)}T&&k===W&&Q===R.length&&(k=W+1,Q=0)}function K(W){if(E!=="soft-hyphen")return!1;let j=d[W];if(j==null)return!1;let{fitCount:R,fittedWidth:$}=Pi(j,C,t,p,c);return R===0?!1:(C=$,k=W,Q=R,b(),R===j.length?(k=W+1,Q=0,!0):(y(W,R,$+c),w(W,R),!0))}function Z(W){D++,n?.({startSegmentIndex:W.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:W.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),b()}for(let W=0;W<a.length;W++){let j=a[W];if(j.startSegmentIndex===j.endSegmentIndex){Z(j);continue}T=!1,C=0,U=j.startSegmentIndex,z=0,k=j.startSegmentIndex,Q=0,b();let R=j.startSegmentIndex;for(;R<j.endSegmentIndex;){let $=u[R],fe=$==="space"||$==="preserved-space"||$==="tab"||$==="zero-width-break"||$==="soft-hyphen",le=$==="tab"?Ii(C,s):o[R];if($==="soft-hyphen"){T&&(k=R+1,Q=0,S=R+1,x=C+c,g=C+c,E=$),R++;continue}if(!T){le>t&&d[R]!==null?w(R,0):v(R,le),V($,fe,R,le),R++;continue}if(C+le>F){let M=C+($==="tab"?0:r[R]),L=C+($==="tab"?le:i[R]);if(E==="soft-hyphen"&&m.preferEarlySoftHyphenBreak&&x<=F){y(S,0,g);continue}if(E==="soft-hyphen"&&K(R)){R++;continue}if(fe&&M<=F){O(R,le),y(R+1,0,L),R++;continue}if(S>=0&&x<=F){if(k>S||k===S&&Q>0){y();continue}let J=S;y(J,0,g),R=J;continue}if(le>t&&d[R]!==null){y(),w(R,0),R++;continue}y();continue}O(R,le),V($,fe,R,le),R++}if(T){let $=S===j.consumedEndSegmentIndex?g:C;y(j.consumedEndSegmentIndex,0,$)}}return D}var pt=null;function Oi(){return pt===null&&(pt=new Intl.Segmenter(void 0,{granularity:"grapheme"})),pt}function _i(e){return e?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]}}function Wi(e,t){let n=[],o=[],r=0,i=!1,u=!1,d=!1;function c(){o.length!==0&&(n.push({text:o.length===1?o[0]:o.join(""),start:r}),o=[],i=!1,u=!1,d=!1)}function s(m,p,F){o=[m],r=p,i=F,u=Je(m),d=je.has(m)}function a(m,p){o.push(m),i=i||p;let F=Je(m);m.length===1&&be.has(m)?u=u||F:u=F,d=!1}for(let m of Oi().segment(e)){let p=m.segment,F=Fe(p);if(o.length===0){s(p,m.index,F);continue}if(d||Ke.has(p)||be.has(p)||t.carryCJKAfterClosingQuote&&F&&u){a(p,F);continue}if(!i&&!F){a(p,F);continue}c(),s(p,m.index,F)}return c(),n}function Hi(e){if(e.length<=1)return e;let t=[],n=[e[0].text],o=e[0].start,r=Fe(e[0].text),i=$e(e[0].text);function u(){t.push({text:n.length===1?n[0]:n.join(""),start:o})}for(let d=1;d<e.length;d++){let c=e[d],s=Fe(c.text),a=$e(c.text);if(r&&i){n.push(c.text),r=r||s,i=a;continue}u(),n=[c.text],o=c.start,r=s,i=a}return u(),t}function ji(e,t,n,o){let r=Ie(),{cache:i,emojiCorrection:u}=un(t,an(e.normalized)),d=Me("-",Ne("-",i),u),s=Me(" ",Ne(" ",i),u)*8;if(e.len===0)return _i(n);let a=[],m=[],p=[],F=[],D=e.chunks.length<=1,C=n?[]:null,T=[],U=n?[]:null,z=Array.from({length:e.len});function k(g,E,b,y,v,_,O){v!=="text"&&v!=="space"&&v!=="zero-width-break"&&(D=!1),a.push(E),m.push(b),p.push(y),F.push(v),C?.push(_),T.push(O),U!==null&&U.push(g)}function Q(g,E,b,y,v){let _=Ne(g,i),O=Me(g,_,u),V=E==="space"||E==="preserved-space"||E==="zero-width-break"?0:O,w=E==="space"||E==="zero-width-break"?0:O;if(v&&y&&g.length>1){let K="sum-graphemes";He(g)?K="pair-context":r.preferPrefixWidthsForBreakableRuns&&(K="segment-prefixes");let Z=ln(g,_,i,u,K);k(g,O,V,w,E,b,Z);return}k(g,O,V,w,E,b,null)}for(let g=0;g<e.len;g++){z[g]=a.length;let E=e.texts[g],b=e.isWordLike[g],y=e.kinds[g],v=e.starts[g];if(y==="soft-hyphen"){k(E,0,d,d,y,v,null);continue}if(y==="hard-break"){k(E,0,0,0,y,v,null);continue}if(y==="tab"){k(E,0,0,0,y,v,null);continue}let _=Ne(E,i);if(y==="text"&&_.containsCJK){let O=Wi(E,r),V=o==="keep-all"?Hi(O):O;for(let w=0;w<V.length;w++){let K=V[w];Q(K.text,"text",v+K.start,b,o==="keep-all"||!Fe(K.text))}continue}Q(E,y,v,b,!0)}let S=zi(e.chunks,z,a.length),x=C===null?null:qt(e.normalized,C);return U!==null?{widths:a,lineEndFitAdvances:m,lineEndPaintAdvances:p,kinds:F,simpleLineWalkFastPath:D,segLevels:x,breakableFitAdvances:T,discretionaryHyphenWidth:d,tabStopAdvance:s,chunks:S,segments:U}:{widths:a,lineEndFitAdvances:m,lineEndPaintAdvances:p,kinds:F,simpleLineWalkFastPath:D,segLevels:x,breakableFitAdvances:T,discretionaryHyphenWidth:d,tabStopAdvance:s,chunks:S}}function zi(e,t,n){let o=[];for(let r=0;r<e.length;r++){let i=e[r],u=i.startSegmentIndex<t.length?t[i.startSegmentIndex]:n,d=i.endSegmentIndex<t.length?t[i.endSegmentIndex]:n,c=i.consumedEndSegmentIndex<t.length?t[i.consumedEndSegmentIndex]:n;o.push({startSegmentIndex:u,endSegmentIndex:d,consumedEndSegmentIndex:c})}return o}function Ui(e,t,n,o){let r=o?.wordBreak??"normal",i=nn(e,Ie(),o?.whiteSpace,r);return ji(i,t,n,r)}function xn(e,t,n){return Ui(e,t,!1,n)}function fn(e,t,n){let o=cn(e,t);return{lineCount:o,height:o*n}}var Gi={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function pn(e,t){let n={...Gi,...t},o=1.2;for(let r=n.baseFontSize;r>=n.minFontSize;r-=n.step){let i=`${n.fontWeight} ${r}px ${n.fontFamily}`,u=xn(e,i),{lineCount:d}=fn(u,n.maxWidth,r*o);if(d<=1)return{fontSize:r,fits:!0}}return{fontSize:n.minFontSize,fits:!1}}window.__timelines=window.__timelines||{};window.__hyperframes={fitTextFontSize:pn};function hn(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,Ut())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",hn,{once:!0}):hn();})();\n';
6116
+ RUNTIME_IIFE = '"use strict";(()=>{function fe(e){try{window.parent.postMessage(e,"*")}catch{}}function At(e){let t=n=>{let i=n.data;if(!i||i.source!=="hf-parent"||i.type!=="control")return;let r=i.action;if(r==="play"){e.onPlay();return}if(r==="pause"){e.onPause();return}if(r==="seek"){e.onSeek(Number(i.frame??0),i.seekMode??"commit");return}if(r==="set-muted"){e.onSetMuted(!!i.muted);return}if(r==="set-media-output-muted"){e.onSetMediaOutputMuted(!!i.muted);return}if(r==="set-playback-rate"){e.onSetPlaybackRate(Number(i.playbackRate??1));return}if(r==="enable-pick-mode"){e.onEnablePickMode();return}if(r==="disable-pick-mode"){e.onDisablePickMode();return}if(r==="flash-elements"){let o=i.selectors,u=i.duration||800;o&&Nn(o,u)}};return window.addEventListener("message",t),t}function Nn(e,t){if(!document.getElementById("__hf-flash-styles")){let n=document.createElement("style");n.id="__hf-flash-styles",n.textContent=`\n .__hf-flash {\n outline: 2px solid rgba(59, 130, 246, 0.6) !important;\n outline-offset: 2px !important;\n animation: __hf-flash-pulse ${t}ms ease-out forwards !important;\n }\n @keyframes __hf-flash-pulse {\n 0% { outline-color: rgba(59, 130, 246, 0.8); }\n 100% { outline-color: transparent; }\n }\n `,document.head.appendChild(n)}for(let n of e)try{document.querySelectorAll(n).forEach(r=>{r.classList.add("__hf-flash"),setTimeout(()=>r.classList.remove("__hf-flash"),t)})}catch{}}var et=null;function Nt(e){et=e}function Pe(e,t){if(et)try{et({source:"hf-preview",type:"analytics",event:e,properties:t??{}})}catch{}}function Et(e){let t=[],n=d=>{if(typeof d.getAnimations!="function")return[];try{return d.getAnimations()}catch{return[]}},i=(d,c)=>{for(let s of d){try{s.currentTime=c}catch{}try{s.pause()}catch{}}},r=d=>{for(let c of d)try{c.play()}catch{}},o=d=>{for(let c of d)try{c.pause()}catch{}},u=d=>{d.baseDelay?d.el.style.animationDelay=d.baseDelay:d.el.style.removeProperty("animation-delay"),d.basePlayState?d.el.style.animationPlayState=d.basePlayState:d.el.style.removeProperty("animation-play-state")};return{name:"css",discover:()=>{t=[];let d=document.querySelectorAll("*");for(let c of d){if(!(c instanceof HTMLElement))continue;let s=window.getComputedStyle(c);!s.animationName||s.animationName==="none"||t.push({el:c,baseDelay:c.style.animationDelay||"",basePlayState:c.style.animationPlayState||""})}},seek:d=>{let c=Number(d.time)||0;for(let s of t){if(!s.el.isConnected)continue;let a=e?.resolveStartSeconds?e.resolveStartSeconds(s.el):Number.parseFloat(s.el.getAttribute("data-start")??"0")||0,m=Math.max(0,c-a)*1e3,h=n(s.el);if(h.length>0){i(h,m);continue}s.el.style.animationPlayState="paused",s.el.style.animationDelay=`-${(m/1e3).toFixed(3)}s`}},pause:()=>{for(let d of t){if(!d.el.isConnected)continue;let c=n(d.el);c.length>0&&o(c),u(d)}},play:()=>{for(let d of t)d.el.isConnected&&(u(d),r(n(d.el)))},revert:()=>{t=[]}}}function yt(e){return{name:"gsap",discover:()=>{},seek:t=>{let n=e.getTimeline();if(!n)return;n.pause();let i=Math.max(0,Number(t.time)||0);typeof n.totalTime=="function"?n.totalTime(i,!1):n.seek(i,!1)},pause:()=>{let t=e.getTimeline();t&&t.pause()}}}function Ct(){return{name:"lottie",discover:()=>{try{let e=window.lottie;if(e&&typeof e.getRegisteredAnimations=="function"){let t=e.getRegisteredAnimations();if(Array.isArray(t)&&t.length>0){let n=window.__hfLottie??[],i=new Set(n);for(let r of t)i.has(r)||n.push(r);window.__hfLottie=n}}}catch{}},seek:e=>{let t=Math.max(0,Number(e.time)||0),n=window.__hfLottie;if(!(!n||n.length===0))for(let i of n)try{if(bt(i))i.goToAndStop(t*1e3,!1);else if(Mt(i)){if(typeof i.setCurrentRawFrameValue=="function"){let r=i.totalFrames??0,o=i.frameRate??30,u=t*o;r>0&&i.setCurrentRawFrameValue(Math.min(u,r-1))}else if(typeof i.seek=="function"){let r=i.duration??1,o=Math.min(100,t/r*100);i.seek(o)}}}catch{}},pause:()=>{let e=window.__hfLottie;if(!(!e||e.length===0))for(let t of e)try{(bt(t)||Mt(t))&&t.pause()}catch{}},revert:()=>{}}}function bt(e){return typeof e=="object"&&e!==null&&typeof e.goToAndStop=="function"}function Mt(e){return typeof e=="object"&&e!==null&&typeof e.pause=="function"&&("totalFrames"in e||"duration"in e)}function Dt(){let e=null,t=0;return{name:"three",discover:()=>{},seek:n=>{e=Math.max(0,Number(n.time)||0),t=e,window.__hfThreeTime=e;try{window.dispatchEvent(new CustomEvent("hf-seek",{detail:{time:e}}))}catch{}},pause:()=>{e==null&&(e=Math.max(0,t))},play:()=>{e=null},revert:()=>{e=null,t=0}}}function kt(){return{name:"waapi",discover:()=>{},seek:e=>{if(!document.getAnimations)return;let t=Math.max(0,(Number(e.time)||0)*1e3);for(let n of document.getAnimations()){try{n.currentTime=t}catch{}try{n.pause()}catch{}}},pause:()=>{if(document.getAnimations)for(let e of document.getAnimations())try{e.pause()}catch{}}}}function Lt(e){let t=Array.from(document.querySelectorAll("video, audio")),n=e?.shouldIncludeElement?t.filter(u=>e.shouldIncludeElement?.(u)):t.filter(u=>u.hasAttribute("data-start")),i=[],r=[],o=0;for(let u of n){let d=e?.resolveStartSeconds?e.resolveStartSeconds(u):Number.parseFloat(u.dataset.start??"0");if(!Number.isFinite(d))continue;let c=Number.parseFloat(u.dataset.playbackStart??u.dataset.mediaStart??"0")||0,s=u.defaultPlaybackRate,a=Number.isFinite(s)&&s>0?Math.max(.1,Math.min(5,s)):1,m=u.loop,h=Number.isFinite(u.duration)&&u.duration>0?u.duration:null,A=e?.resolveDurationSeconds?.(u)??Number.parseFloat(u.dataset.duration??"");(!Number.isFinite(A)||A<=0)&&h!=null&&(A=Math.max(0,(h-c)/a));let C=Number.isFinite(A)&&A>0?d+A:Number.POSITIVE_INFINITY,D=Number.parseFloat(u.dataset.volume??""),L={el:u,start:d,mediaStart:c,duration:Number.isFinite(A)&&A>0?A:Number.POSITIVE_INFINITY,end:C,volume:Number.isFinite(D)?D:null,playbackRate:a,loop:m,sourceDuration:h};i.push(L),u.tagName==="VIDEO"&&r.push(L),Number.isFinite(C)&&(o=Math.max(o,C))}return{timedMediaEls:n,mediaClips:i,videoClips:r,maxMediaEnd:o}}var tt=new WeakMap,Oe=new WeakSet;function En(e){if(Oe.has(e))return;Oe.add(e);let t=()=>Oe.delete(e);e.addEventListener("playing",t,{once:!0}),e.addEventListener("pause",t,{once:!0}),e.addEventListener("error",t,{once:!0})}function Tt(e){let t=!!(e.outputMuted||e.userMuted);for(let n of e.clips){let{el:i}=n;if(!i.isConnected)continue;let r=(e.timeSeconds-n.start)*n.playbackRate+n.mediaStart;if(e.timeSeconds>=n.start&&e.timeSeconds<n.end&&r>=0){if(n.loop&&n.sourceDuration!=null&&n.sourceDuration>0){let A=n.sourceDuration-n.mediaStart;A>0&&r>=n.sourceDuration&&(r=n.mediaStart+(r-n.mediaStart)%A)}n.volume!=null&&(i.volume=n.volume),t&&(i.muted=!0);try{i.playbackRate=n.playbackRate*e.playbackRate}catch{}let u=i.currentTime||0,d=Math.abs(u-r),c=r-u,s=tt.get(i);tt.set(i,c);let a=s===void 0,m=!a&&Math.abs(c-s)>.5,h=d>3;if(d>.5&&(a||m||h))try{i.currentTime=r}catch{}e.playing&&i.paused&&!Oe.has(i)?(i.preload!=="auto"&&(i.preload="auto"),En(i),i.play().catch(A=>{Oe.delete(i),(A&&typeof A=="object"&&"name"in A?String(A.name??""):"")==="NotAllowedError"&&e.onAutoplayBlocked?.()})):!e.playing&&!i.paused&&i.pause();continue}tt.delete(i),i.paused||i.pause()}}function wt(e){let t=!1,n=null,i=null,r=null,o=null;function u(S,x){try{window.dispatchEvent(new CustomEvent(S,{detail:x}))}catch{}}function d(S){r=S,u("hyperframe:picker:hovered",{elementInfo:r,isPickMode:t,timestamp:Date.now()})}function c(S){o=S,u("hyperframe:picker:selected",{elementInfo:o,isPickMode:t,timestamp:Date.now()})}function s(S){if(!S||S===document.body||S===document.documentElement)return!1;let x=S.tagName.toLowerCase();return!(x==="script"||x==="style"||x==="link"||x==="meta"||S.classList.contains("__hf-pick-highlight"))}function a(S){let x=S;if(x.id)return`#${x.id}`;let g=S.getAttribute("data-composition-id");if(g)return`[data-composition-id="${g}"]`;let N=S.getAttribute("data-composition-src");if(N)return`[data-composition-src="${N}"]`;let y=S.getAttribute("data-track-index");if(y)return`[data-track-index="${y}"]`;let E=S.tagName.toLowerCase(),R=S.parentElement;if(!R)return E;let _=R.querySelectorAll(`:scope > ${E}`);if(_.length===1)return E;for(let W=0;W<_.length;W+=1)if(_[W]===S)return`${E}:nth-of-type(${W+1})`;return E}function m(S){let x=S.tagName.toLowerCase(),g=(S.textContent??"").trim().replace(/\\s+/g," "),N=(y,E)=>y.length>E?`${y.slice(0,E-1)}\\u2026`:y;return x==="h1"||x==="h2"||x==="h3"?"Heading":x==="p"||x==="span"||x==="div"?g.length>0?N(g,56):"Text":x==="img"?"Image":x==="video"?"Video":x==="audio"?"Audio":x==="svg"?"Shape":S.getAttribute("data-composition-src")?"Composition":x==="section"?"Section":`${x.charAt(0).toUpperCase()}${x.slice(1)}`}function h(S,x,g){let N=typeof g=="number"&&g>0?g:8,y=[];if(document.elementsFromPoint)y=document.elementsFromPoint(S,x);else if(document.elementFromPoint){let _=document.elementFromPoint(S,x);y=_?[_]:[]}let E={},R=[];for(let _=0;_<y.length;_+=1){let W=y[_];if(!s(W))continue;let Z=`${W.tagName}::${W.id||""}::${_}`;if(!E[Z]&&(E[Z]=!0,R.push(W),R.length>=N))break}return R}function A(S){let x=S.getBoundingClientRect(),g={};for(let y=0;y<S.attributes.length;y+=1){let E=S.attributes[y];E.name.startsWith("data-")&&(g[E.name]=E.value)}return{id:S.id||null,tagName:S.tagName.toLowerCase(),selector:a(S),label:m(S),boundingBox:{x:x.left,y:x.top,width:x.width,height:x.height},textContent:S.textContent?S.textContent.trim().slice(0,200):null,src:S.getAttribute("src")||S.getAttribute("data-composition-src")||null,dataAttributes:g}}function C(S,x,g){return h(S,x,g).map(A)}function D(S){if(!t)return;let g=h(S.clientX,S.clientY,1)[0]??(S.target instanceof Element?S.target:null);if(!s(g)||n===g)return;n&&n.classList.remove("__hf-pick-highlight"),n=g,g.classList.add("__hf-pick-highlight");let N=A(g);d(N),e.postMessage({source:"hf-preview",type:"element-hovered",elementInfo:N})}function L(S){if(!t)return;S.preventDefault(),S.stopPropagation(),S.stopImmediatePropagation();let x=C(S.clientX,S.clientY,8);x.length!==0&&(d(x[0]??null),e.postMessage({source:"hf-preview",type:"element-pick-candidates",candidates:x,selectedIndex:0,point:{x:S.clientX,y:S.clientY}}))}function G(S){S.key==="Escape"&&(k(),e.postMessage({source:"hf-preview",type:"pick-mode-cancelled"}))}function U(){t||(t=!0,i=document.createElement("style"),i.textContent=[".__hf-pick-highlight { outline: 2px solid #4f8cf7 !important; outline-offset: 2px; cursor: crosshair !important; }",".__hf-pick-active * { cursor: crosshair !important; }"].join(`\n`),document.head.appendChild(i),document.body.classList.add("__hf-pick-active"),document.addEventListener("mousemove",D,!0),document.addEventListener("click",L,!0),document.addEventListener("keydown",G,!0),u("hyperframe:picker:mode",{isPickMode:!0,timestamp:Date.now()}))}function k(){t&&(t=!1,n&&(n.classList.remove("__hf-pick-highlight"),n=null),i&&(i.remove(),i=null),document.body.classList.remove("__hf-pick-active"),document.removeEventListener("mousemove",D,!0),document.removeEventListener("click",L,!0),document.removeEventListener("keydown",G,!0),u("hyperframe:picker:mode",{isPickMode:!1,timestamp:Date.now()}))}function X(){window.__HF_PICKER_API={enable:U,disable:k,isActive:()=>t,getHovered:()=>r,getSelected:()=>o,getCandidatesAtPoint:(S,x,g)=>Number.isFinite(S)&&Number.isFinite(x)?C(S,x,g):[],pickAtPoint:(S,x,g)=>{if(!Number.isFinite(S)||!Number.isFinite(x))return null;let N=C(S,x,8);if(!N.length)return null;let y=Math.max(0,Math.min(N.length-1,Number(g??0))),E=N[y]??null;return E?(c(E),e.postMessage({source:"hf-preview",type:"element-picked",elementInfo:E}),k(),E):null},pickManyAtPoint:(S,x,g)=>{if(!Number.isFinite(S)||!Number.isFinite(x))return[];let N=C(S,x,8);if(!N.length)return[];let y=[],E=Array.isArray(g)?g:[0];for(let R of E){let _=Math.max(0,Math.min(N.length-1,Math.floor(Number(R)))),W=N[_];if(!W)continue;y.some(w=>w.selector===W.selector&&w.tagName===W.tagName)||y.push(W)}return y.length?(c(y[0]??null),e.postMessage({source:"hf-preview",type:"element-picked-many",elementInfos:y}),k(),y):[]}},u("hyperframe:picker:api-ready",{hasApi:!0,timestamp:Date.now()})}return{enablePickMode:U,disablePickMode:k,installPickerApi:X}}function nt(e,t){let n=Number.isFinite(t)&&t>0?t:30,i=Number.isFinite(e)&&e>0?e:0;return Math.floor(i*n+1e-9)/n}function Ue(e,t,n){if(e){for(let i of Object.values(e))if(!(!i||i===t))try{n(i)}catch{}}}function Bt(e,t,n){let i=nt(t,n);return e.pause(),typeof e.totalTime=="function"?e.totalTime(i,!1):e.seek(i,!1),i}function yn(e,t,n,i){let r=[];Ue(e,t,o=>{o.play(),r.push(o)});try{return Bt(t,n,i)}finally{for(let o of r)try{o.pause()}catch{}}}function bn(e,t){Ue(e,t,n=>{n.play()})}function Rt(e){return{_timeline:null,play:()=>{let t=e.getTimeline();if(!t||e.getIsPlaying())return;let n=Math.max(0,Number(e.getSafeDuration?.()??t.duration()??0)||0);n>0&&Math.max(0,Number(t.time())||0)>=n&&(t.pause(),t.seek(0,!1),e.onDeterministicSeek(0),e.setIsPlaying(!1),e.onSyncMedia(0,!1),e.onRenderFrameSeek(0)),typeof t.timeScale=="function"&&t.timeScale(e.getPlaybackRate()),t.play(),Ue(e.getTimelineRegistry?.(),t,i=>{typeof i.timeScale=="function"&&i.timeScale(e.getPlaybackRate()),i.play()}),e.onDeterministicPlay(),e.setIsPlaying(!0),e.onShowNativeVideos(),e.onStatePost(!0)},pause:()=>{let t=e.getTimeline();if(!t)return;t.pause(),Ue(e.getTimelineRegistry?.(),t,i=>{i.pause()});let n=Math.max(0,Number(t.time())||0);e.onDeterministicSeek(n),e.onDeterministicPause(),e.setIsPlaying(!1),e.onSyncMedia(n,!1),e.onRenderFrameSeek(n),e.onStatePost(!0)},seek:t=>{let n=e.getTimeline();if(!n)return;let i=Math.max(0,Number(t)||0),r=yn(e.getTimelineRegistry?.(),n,i,e.getCanonicalFps());e.onDeterministicSeek(r),e.setIsPlaying(!1),e.onSyncMedia(r,!1),e.onRenderFrameSeek(r),e.onStatePost(!0)},renderSeek:t=>{let n=e.getTimeline(),i=e.getCanonicalFps(),r=n?(bn(e.getTimelineRegistry?.(),n),Bt(n,t,i)):nt(Math.max(0,Number(t)||0),i);e.onDeterministicSeek(r),e.setIsPlaying(!1),e.onSyncMedia(r,!1),e.onRenderFrameSeek(r),e.onStatePost(!0)},getTime:()=>Number(e.getTimeline()?.time()??0),getDuration:()=>Number(e.getTimeline()?.duration()??0),isPlaying:()=>e.getIsPlaying(),setPlaybackRate:t=>e.setPlaybackRate(t),getPlaybackRate:()=>e.getPlaybackRate()}}function vt(){return{capturedTimeline:null,isPlaying:!1,rafId:null,currentTime:0,deterministicAdapters:[],parityModeEnabled:!0,canonicalFps:30,bridgeMuted:!1,mediaOutputMuted:!1,mediaAutoplayBlockedPosted:!1,playbackRate:1,bridgeLastPostedFrame:-1,bridgeLastPostedAt:0,bridgeLastPostedPlaying:!1,bridgeLastPostedMuted:!1,bridgeMaxPostIntervalMs:80,timelinePollIntervalId:null,controlBridgeHandler:null,clampDurationLoggedRaw:null,beforeUnloadHandler:null,domReadyHandler:null,injectedCompStyles:[],injectedCompScripts:[],cachedTimedMediaEls:[],cachedMediaClips:[],cachedVideoClips:[],cachedMediaTimelineDurationSeconds:0,tornDown:!1,maxTimelineDurationSeconds:1800,nativeVisualWatchdogTick:0}}var Mn="data-hf-authored-duration",Cn="data-hf-authored-end";function De(e){if(e==null||e==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}function Dn(e){return De(e.getAttribute("data-duration"))}function kn(e){return De(e.getAttribute("data-end"))}function Ln(e){return De(e.getAttribute(Mn))}function Tn(e){return De(e.getAttribute(Cn))}function wn(e){let t=(e??"").trim();if(!t)return null;let n=De(t);if(n!=null)return{kind:"absolute",value:n};let i=t.match(/^([A-Za-z0-9_.:-]+)(?:\\s*([+-])\\s*([0-9]*\\.?[0-9]+))?$/);if(!i)return null;let r=(i[1]??"").trim();if(!r)return null;let o=i[2]??"+",u=i[3]??"0",d=Number.parseFloat(u),c=Number.isFinite(d)?Math.max(0,d):0,s=o==="-"?-c:c;return{kind:"reference",refId:r,offset:s}}function we(e){let t=e.timelineRegistry??{},n=e.includeAuthoredTimingAttrs??!1,i=new WeakMap,r=new WeakMap,o=new Set,u=a=>{let m=document.getElementById(a);return m||(document.querySelector(`[data-composition-id="${CSS.escape(a)}"]`)??null)},d=a=>{let m=r.get(a);if(m!==void 0)return m;let h=null,A=Dn(a)??(n?Ln(a):null);if(A!=null&&A>0&&(h=A),h==null||h<=0){let C=kn(a)??(n?Tn(a):null);if(C!=null){let D=s(a,0),L=C-D;Number.isFinite(L)&&L>0&&(h=L)}}if((h==null||h<=0)&&a instanceof HTMLMediaElement){let C=De(a.getAttribute("data-playback-start"))??De(a.getAttribute("data-media-start"))??0;Number.isFinite(a.duration)&&a.duration>C&&(h=a.duration-C)}if(h==null||h<=0){let C=a.getAttribute("data-composition-id");if(C){let D=t[C]??null;if(D&&typeof D.duration=="function")try{let L=Number(D.duration());Number.isFinite(L)&&L>0&&(h=L)}catch{}}}return h!=null&&Number.isFinite(h)&&h>0?(r.set(a,h),h):(r.set(a,null),null)},c=(a,m)=>{if(a.hasAttribute("data-composition-id")){let A=a.parentElement?.closest("[data-composition-id]");return A?s(A,m):0}let h=a.closest("[data-composition-id]");return h?s(h,m):0},s=(a,m)=>{let h=i.get(a);if(h!==void 0)return h??m;if(o.has(a))return m;o.add(a);try{let A=wn(a.getAttribute("data-start"));if(!A){if(a.hasAttribute("data-composition-id")){let U=a.parentElement;if(U&&(U.hasAttribute("data-composition-src")||U.hasAttribute("data-composition-id"))){let k=s(U,m);return i.set(a,k),k}}return i.set(a,m),m}if(A.kind==="absolute"){let U=Math.max(0,A.value),k=Math.max(0,c(a,m)+U);return i.set(a,k),k}let C=u(A.refId);if(!C)return i.set(a,m),m;let D=s(C,0),L=d(C);if(L==null||L<=0){let U=Math.max(0,D+A.offset);return i.set(a,U),U}let G=Math.max(0,D+L+A.offset);return i.set(a,G),G}finally{o.delete(a)}};return{resolveStartForElement:(a,m=0)=>s(a,Math.max(0,m)),resolveDurationForElement:a=>d(a)}}var Bn="data-hf-authored-duration",Rn="data-hf-authored-end";function pe(e){if(e==null||e==="")return null;let t=Number(e);return Number.isFinite(t)?t:null}function it(e){return pe(e.getAttribute("data-duration"))??pe(e.getAttribute(Bn))}function It(e){return pe(e.getAttribute("data-end"))??pe(e.getAttribute(Rn))}function ot(...e){let t=e.filter(n=>Number.isFinite(n??null));return t.length===0?null:Math.max(...t)}var Pt={composition:0,video:1,image:2,element:3,audio:4};function vn(e){if(e.length===0)return;let t=new Map;for(let u of e){let d=t.get(u.track)??new Set;d.add(u.kind),t.set(u.track,d)}if(!Array.from(t.values()).some(u=>u.size>1))return;let i=0,r=new Map,o=[...t.keys()].sort((u,d)=>u-d);for(let u of o){let d=t.get(u);if(d.size===1)r.set(`${u}:${[...d][0]}`,i++);else{let c=[...d].sort((s,a)=>(Pt[s]??99)-(Pt[a]??99));for(let s of c)r.set(`${u}:${s}`,i++)}}for(let u of e){let d=`${u.track}:${u.kind}`,c=r.get(d);c!=null&&(u.track=c)}}function _e(e){let t=String(e??"").trim();if(!t)return null;let n=t.toLowerCase();if(n.startsWith("data:")||n.startsWith("javascript:"))return null;try{return new URL(t,document.baseURI).toString()}catch{return t}}function In(e){let t=e.getAttribute("src")??e.getAttribute("data-src");if(t)return _e(t);let n=e.getAttribute("data-composition-src");if(n)return _e(n);let i=e.querySelector("img[src], video[src], audio[src], source[src]");return i?_e(i.getAttribute("src")):null}function Ot(e){let n=window.__timelines??{},i=we({timelineRegistry:n,includeAuthoredTimingAttrs:!0}),r=B=>{if(!B)return null;let b=n[B]??null;if(!b||typeof b.duration!="function")return null;try{let T=Number(b.duration());return Number.isFinite(T)&&T>0?T:null}catch{return null}},o=B=>{let b=pe(B.getAttribute("data-duration"));if(b!=null&&b>0)return b;let T=pe(B.getAttribute("data-playback-start"))??pe(B.getAttribute("data-media-start"))??0;return Number.isFinite(B.duration)&&B.duration>T?Math.max(0,B.duration-T):null},u=()=>{let B=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(B.length===0)return null;let b=0;for(let T of B){let Y=i.resolveStartForElement(T,0);if(!Number.isFinite(Y))continue;let te=o(T);te==null||te<=0||(b=Math.max(b,Math.max(0,Y)+te))}return b>0?b:null},d=B=>{let b=B.trim().toLowerCase();return!(!b||b==="main"||b.includes("caption")||b.includes("ambient"))},c=(B,b)=>{let T=[],Y=null,te=null,I=null,P=B.parentElement;for(;P;){let j=P.getAttribute("data-composition-id");j&&(T.push(j),!I&&P!==b&&(I=j),Y==null&&(Y=i.resolveStartForElement(P,0)),te==null&&(te=pe(P.getAttribute("data-duration"))??r(j)??null)),P=P.parentElement}return{parentCompositionId:I,compositionAncestors:T.reverse(),inheritedStart:Y,inheritedDuration:te}},s=document.querySelector("[data-composition-id]"),a=Array.from(document.querySelectorAll("[data-composition-id]")),m=s?.getAttribute("data-composition-id")??null,h=s?i.resolveStartForElement(s,0):0,A=u(),C=A!=null?Math.max(0,A-Math.max(0,h)):null,D=r(m),L=it(s??document.body),G=ot(...a.filter(B=>B!==s).map(B=>{let b=i.resolveStartForElement(B,0),T=i.resolveDurationForElement(B)??r(B.getAttribute("data-composition-id"))??null;return!Number.isFinite(b)||T==null||T<=0?null:Math.max(0,b)+T})),U=G!=null?Math.max(0,G-Math.max(0,h)):null,k=typeof D=="number"&&Number.isFinite(D)&&D>0?D:null,X=typeof L=="number"&&Number.isFinite(L)&&L>0?L:null,S=typeof C=="number"&&Number.isFinite(C)&&C>0?C:null,x=typeof U=="number"&&Number.isFinite(U)&&U>0?U:null,g=ot(S,x),N=k!=null&&g!=null&&k>g+1,y=X??(N?g:ot(k,S,x)),E=y!=null?Math.min(y,e.maxTimelineDurationSeconds):null,_=(E!=null?h+E:null)??(typeof A=="number"&&Number.isFinite(A)&&A>0?A:null),W=(B,b)=>!Number.isFinite(b)||b<=0?0:_==null||!Number.isFinite(_)?b:!Number.isFinite(B)||B>=_?0:Math.max(0,Math.min(b,_-B)),Z=[],w=[],Q=Array.from(document.querySelectorAll("[data-start], [data-track-index], [data-composition-id], video, audio, img")),ee=0;for(let B=0;B<Q.length;B+=1){let b=Q[B];if(b===s||["SCRIPT","STYLE","LINK","META","TEMPLATE","NOSCRIPT"].includes(b.tagName))continue;let T=c(b,s),Y=i.resolveStartForElement(b,T.inheritedStart??0),te=b.getAttribute("data-composition-id"),I=it(b);if((I==null||I<=0)&&te&&te!==m&&(I=r(te)),(I==null||I<=0)&&b instanceof HTMLMediaElement){let de=pe(b.getAttribute("data-playback-start"))??pe(b.getAttribute("data-media-start"))??0;Number.isFinite(b.duration)&&b.duration>0&&(I=Math.max(0,b.duration-de))}if(I==null||I<=0){let de=T.inheritedDuration;if(de!=null&&de>0){let ge=(T.inheritedStart??0)+de;I=Math.max(0,ge-Y)}}if(I==null||I<=0||(I=W(Y,I),I<=0))continue;let P=Y+I;ee=Math.max(ee,P);let j=b.tagName.toLowerCase(),ce=te&&te!==m?"composition":j==="video"?"video":j==="audio"?"audio":j==="img"?"image":"element";Z.push({id:b.id||te||`__node__index_${B}`,label:b.getAttribute("data-timeline-label")??b.getAttribute("data-label")??b.getAttribute("aria-label")??te??b.id??b.className?.split(" ")[0]??ce,start:Y,duration:I,track:Number.parseInt(b.getAttribute("data-track-index")??b.getAttribute("data-track")??String(B),10)||0,kind:ce,tagName:j,compositionId:b.getAttribute("data-composition-id"),compositionAncestors:T.compositionAncestors,parentCompositionId:T.parentCompositionId,nodePath:null,compositionSrc:_e(b.getAttribute("data-composition-src")),assetUrl:In(b),timelineRole:b.getAttribute("data-timeline-role"),timelineLabel:b.getAttribute("data-timeline-label"),timelineGroup:b.getAttribute("data-timeline-group"),timelinePriority:pe(b.getAttribute("data-timeline-priority"))})}let H=new Set(Z.map(B=>B.id)),z=s?.getAttribute("data-composition-id")??null,v=z?n[z]??null:null;if(v&&s){let B=v;if(typeof B.getChildren=="function")try{let b=B.getChildren(!0,!0,!1)??[],T=new Map;for(let I of s.children){let P=I;if(!P.id)continue;let j=P.tagName.toLowerCase();j==="script"||j==="style"||j==="link"||T.set(P,{id:P.id,start:1/0,end:-1/0})}let Y=I=>{let P=I;for(;P;){if(T.has(P))return P;if(P===s)return null;P=P.parentElement}return null};for(let I of b){if(typeof I.targets!="function"||typeof I.startTime!="function"||typeof I.duration!="function")continue;let P=I.startTime(),j=I.parent;for(;j&&typeof j.startTime=="function";)P+=j.startTime(),j=j.parent;let ce=P+I.duration();if(!(!Number.isFinite(P)||!Number.isFinite(ce)))for(let de of I.targets()){if(!(de instanceof Element))continue;let Ee=Y(de);if(!Ee)continue;let ge=T.get(Ee);ge&&(ge.start=Math.min(ge.start,P),ge.end=Math.max(ge.end,ce))}}let te=Z.length>0?Math.max(...Z.map(I=>I.track))+1:0;for(let[I,P]of T){if(P.start===1/0||P.end===-1/0)continue;let j=I;if(H.has(j.id))continue;let ce=Math.max(0,P.end-P.start);if(ce<=0)continue;let de=W(P.start,ce);de<=0||(ee=Math.max(ee,P.start+de),Z.push({id:j.id,label:j.getAttribute("data-timeline-label")??j.getAttribute("data-label")??j.getAttribute("aria-label")??j.id,start:P.start,duration:de,track:Number.parseInt(j.getAttribute("data-track-index")??j.getAttribute("data-track")??"",10)||te,kind:"element",tagName:j.tagName.toLowerCase(),compositionId:j.getAttribute("data-composition-id"),compositionAncestors:z?[z]:[],parentCompositionId:z,nodePath:null,compositionSrc:null,assetUrl:null,timelineRole:j.getAttribute("data-timeline-role"),timelineLabel:j.getAttribute("data-timeline-label"),timelineGroup:j.getAttribute("data-timeline-group"),timelinePriority:pe(j.getAttribute("data-timeline-priority"))}),H.add(j.id))}}catch{}}if(s&&E!=null&&E>0){let B=Z.length>0?Math.max(...Z.map(b=>b.track))+1:0;for(let b of s.children){let T=b;if(!T.id||H.has(T.id))continue;let Y=T.getAttribute("data-timeline-role");if(Y!=="overlay"&&Y!=="persistent-overlay")continue;let te=T.tagName.toLowerCase();if(te==="script"||te==="style"||te==="link"||te==="meta"||window.getComputedStyle(T).display==="none")continue;let P=W(0,E);P<=0||(ee=Math.max(ee,P),Z.push({id:T.id,label:T.getAttribute("data-timeline-label")??T.getAttribute("data-label")??T.getAttribute("aria-label")??T.id,start:0,duration:P,track:Number.parseInt(T.getAttribute("data-track-index")??T.getAttribute("data-track")??"",10)||B,kind:"element",tagName:te,compositionId:T.getAttribute("data-composition-id"),compositionAncestors:z?[z]:[],parentCompositionId:z,nodePath:null,compositionSrc:null,assetUrl:null,timelineRole:Y,timelineLabel:T.getAttribute("data-timeline-label"),timelineGroup:T.getAttribute("data-timeline-group"),timelinePriority:pe(T.getAttribute("data-timeline-priority"))}),H.add(T.id))}}vn(Z);for(let B of a){if(B===s)continue;let b=B.getAttribute("data-composition-id");if(!b||!d(b))continue;let T=i.resolveStartForElement(B,0),Y=it(B);if((Y==null||Y<=0)&&It(B)!=null){let j=It(B);Y=Math.max(0,j-T)}let te=r(b),I=Y&&Y>0?Y:te;if(I==null||I<=0)continue;let P=W(T,I);P<=0||w.push({id:b,label:B.getAttribute("data-label")??b,start:T,duration:P,thumbnailUrl:_e(B.getAttribute("data-thumbnail-url")),avatarName:null})}let K=Math.max(1,Math.min(Math.max(ee||1,E??0),e.maxTimelineDurationSeconds));return{source:"hf-preview",type:"timeline",durationInFrames:N&&X==null?Number.POSITIVE_INFINITY:Math.max(1,Math.round(K*Math.max(1,e.canonicalFps))),clips:Z,scenes:w,compositionWidth:pe(s?.getAttribute("data-width"))??1920,compositionHeight:pe(s?.getAttribute("data-height"))??1080}}var Pn=/^(?![a-zA-Z][a-zA-Z\\d+\\-.]*:)(?!\\/\\/)(?!\\/)(?!\\.\\.?\\/).+/,On=e=>new Promise(t=>{let n=!1,i=Date.now(),r=null,o=u=>{n||(n=!0,r!=null&&window.clearTimeout(r),t({status:u,elapsedMs:Math.max(0,Date.now()-i)}))};e.addEventListener("load",()=>o("load"),{once:!0}),e.addEventListener("error",()=>o("error"),{once:!0}),r=window.setTimeout(()=>o("timeout"),8e3)});function rt(e){for(;e.firstChild;)e.removeChild(e.firstChild);e.textContent=""}function _t(e,t){let n=e.trim();if(!n)return e;try{return Pn.test(n)?new URL(n,document.baseURI).toString():t?new URL(n,t).toString():new URL(n,document.baseURI).toString()}catch{return e}}async function st(e){let t=null;e.hostCompositionId&&(t=Array.from(e.sourceNode.querySelectorAll("[data-composition-id]")).find(s=>s.getAttribute("data-composition-id")===e.hostCompositionId)??null);let n=t??e.sourceNode;if(e.headStyles)for(let c of e.headStyles){let s=c.cloneNode(!0);s instanceof HTMLStyleElement&&(document.head.appendChild(s),e.injectedStyles.push(s))}let i=Array.from(n.querySelectorAll("style"));for(let c of i){let s=c.cloneNode(!0);s instanceof HTMLStyleElement&&(document.head.appendChild(s),e.injectedStyles.push(s))}let r=[];if(e.headScripts)for(let c of e.headScripts){let s=c.getAttribute("type")?.trim()??"",a=c.getAttribute("src")?.trim()??"";if(a){let m=_t(a,e.compositionUrl);r.push({kind:"external",src:m,type:s})}else{let m=c.textContent?.trim()??"";m&&r.push({kind:"inline",content:m,type:s})}}let o=Array.from(n.querySelectorAll("script")),u=[...r];for(let c of o){let s=c.getAttribute("type")?.trim()??"",a=c.getAttribute("src")?.trim()??"";if(a){let m=_t(a,e.compositionUrl);u.push({kind:"external",src:m,type:s})}else{let m=c.textContent?.trim()??"";m&&u.push({kind:"inline",content:m,type:s})}c.parentNode?.removeChild(c)}let d=Array.from(n.querySelectorAll("style"));for(let c of d)c.parentNode?.removeChild(c);if(t){let c=document.importNode(t,!0),s=t.getAttribute("data-width"),a=t.getAttribute("data-height"),m=e.parseDimensionPx(s),h=e.parseDimensionPx(a);c.style.position="relative",c.style.width=m||"100%",c.style.height=h||"100%",m&&c.style.setProperty("--comp-width",m),h&&c.style.setProperty("--comp-height",h),s&&e.host.setAttribute("data-width",s),a&&e.host.setAttribute("data-height",a),m&&e.host instanceof HTMLElement&&(e.host.style.width=m),h&&e.host instanceof HTMLElement&&(e.host.style.height=h),e.host.appendChild(c)}else e.hasTemplate?e.host.appendChild(document.importNode(n,!0)):e.host.innerHTML=e.fallbackBodyInnerHtml;for(let c of u){let s=document.createElement("script");if(c.type&&(s.type=c.type),s.async=!1,c.kind==="external"?s.src=c.src:c.type.toLowerCase()==="module"?s.textContent=c.content:s.textContent=`(function(){${c.content}})();`,document.body.appendChild(s),e.injectedScripts.push(s),c.kind==="external"){let a=await On(s);a.status!=="load"&&e.onDiagnostic?.({code:"external_composition_script_load_issue",details:{hostCompositionId:e.hostCompositionId,hostCompositionSrc:e.hostCompositionSrc,resolvedScriptSrc:c.src,loadStatus:a.status,elapsedMs:a.elapsedMs}})}}}async function Wt(e){let t=Array.from(document.querySelectorAll("[data-composition-id]:not([data-composition-src])")).filter(n=>{if(n.children.length>0)return!1;let i=n.getAttribute("data-composition-id");return i?!!document.querySelector(`template#${CSS.escape(i)}-template`):!1});if(t.length!==0)for(let n of t){let i=n.getAttribute("data-composition-id"),r=document.querySelector(`template#${CSS.escape(i)}-template`);rt(n),await st({host:n,hostCompositionId:i,hostCompositionSrc:`template#${i}-template`,sourceNode:r.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:null,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic})}}async function Ht(e){let t=Array.from(document.querySelectorAll("[data-composition-src]"));t.length!==0&&await Promise.all(t.map(async n=>{let i=n.getAttribute("data-composition-src");if(!i)return;let r=null;try{r=new URL(i,document.baseURI)}catch{r=null}rt(n);try{let o=n.getAttribute("data-composition-id"),u=o!=null?document.querySelector(`template#${CSS.escape(o)}-template`):null;if(u){await st({host:n,hostCompositionId:o,hostCompositionSrc:i,sourceNode:u.content,hasTemplate:!0,fallbackBodyInnerHtml:"",compositionUrl:r,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,parseDimensionPx:e.parseDimensionPx,onDiagnostic:e.onDiagnostic});return}let d=await fetch(i);if(!d.ok)throw new Error(`HTTP ${d.status}`);let c=await d.text(),a=new DOMParser().parseFromString(c,"text/html"),m=(o?a.querySelector(`template#${CSS.escape(o)}-template`):null)??a.querySelector("template"),h=m?m.content:a.body,A=m?void 0:Array.from(a.head.querySelectorAll("style")),C=m?void 0:Array.from(a.head.querySelectorAll("script"));await st({host:n,hostCompositionId:o,hostCompositionSrc:i,sourceNode:h,hasTemplate:!!m,fallbackBodyInnerHtml:a.body.innerHTML,compositionUrl:r,injectedStyles:e.injectedStyles,injectedScripts:e.injectedScripts,parseDimensionPx:e.parseDimensionPx,headStyles:A,headScripts:C,onDiagnostic:e.onDiagnostic})}catch(o){e.onDiagnostic?.({code:"external_composition_load_failed",details:{hostCompositionId:n.getAttribute("data-composition-id"),hostCompositionSrc:i,errorMessage:o instanceof Error?o.message:"unknown_error"}}),rt(n)}}))}function at(){let e=window.gsap;e&&document.querySelectorAll(".caption-group").length!==0&&fetch("caption-overrides.json").then(t=>t.ok?t.json():null).then(t=>{if(!t||!Array.isArray(t)||t.length===0)return;let n=[],i=document.querySelectorAll(".caption-group");for(let r of i){let o=r.querySelectorAll(":scope > span");for(let u of o)n.push(u)}for(let r of t){let o=null;if(r.wordId&&(o=document.getElementById(r.wordId)),!o&&r.wordIndex!==void 0&&(o=n[r.wordIndex]??null),!o||!(o instanceof HTMLElement))continue;let u={},d={};if(r.x!==void 0&&(u.x=r.x),r.y!==void 0&&(u.y=r.y),r.scale!==void 0&&(u.scale=r.scale),r.rotation!==void 0&&(u.rotation=r.rotation),r.opacity!==void 0&&(d.opacity=r.opacity),r.fontSize!==void 0&&(d.fontSize=`${r.fontSize}px`),r.fontWeight!==void 0&&(d.fontWeight=r.fontWeight),r.fontFamily!==void 0&&(d.fontFamily=r.fontFamily),r.activeColor||r.dimColor){let s=e.getTweensOf(o).filter(m=>m.vars.color!==void 0).sort((m,h)=>m.startTime()-h.startTime()),a=s.length>0?String(s[0].vars.color):"";for(let m of s)String(m.vars.color)===a?r.dimColor&&(m.vars.color=r.dimColor):r.activeColor&&(m.vars.color=r.activeColor);r.dimColor&&e.set(o,{color:r.dimColor})}if(Object.keys(d).length>0&&e.set(o,d),Object.keys(u).length>0){let c=document.createElement("span");c.style.display="inline-block",c.dataset.captionWrapper="true",o.parentNode?.insertBefore(c,o),c.appendChild(o),e.set(c,u)}}}).catch(()=>{})}var jt="data-hf-authored-duration",zt="data-hf-authored-end";function Ut(){let e=vt(),t=window,n=null,i=null,r=[],o=new Set,u=null;if(typeof t.__hfRuntimeTeardown=="function")try{t.__hfRuntimeTeardown()}catch{}document.documentElement&&(document.documentElement.style.margin="0",document.documentElement.style.padding="0",document.documentElement.style.overflow="hidden"),document.body&&(document.body.style.margin="0",document.body.style.padding="0",document.body.style.overflow="hidden"),window.__timelines=window.__timelines||{};let d=l=>{r.push(l)},c=(l,p,f)=>{let M=f??`${l}:${JSON.stringify(p)}`;o.has(M)||(o.add(M),fe({source:"hf-preview",type:"diagnostic",code:l,details:p}))},s=l=>{let p={scale:1,focusX:960,focusY:540},f=[],M=[],F={time:l.getTime(),duration:l.getDuration(),isPlaying:l.isPlaying(),renderMode:!1,timelineDirty:!1};return{play:l.play,pause:l.pause,seek:l.seek,getTime:l.getTime,getDuration:l.getDuration,isPlaying:l.isPlaying,getMainTimeline:()=>null,getElementBounds:()=>{},getElementsAtPoint:()=>{},setElementPosition:()=>{},previewElementPosition:()=>{},setElementKeyframes:()=>{},setElementScale:()=>{},setElementFontSize:()=>{},setElementTextContent:()=>{},setElementTextColor:()=>{},setElementTextShadow:()=>{},setElementTextFontWeight:()=>{},setElementTextFontFamily:()=>{},setElementTextOutline:()=>{},setElementTextHighlight:()=>{},setElementVolume:()=>{},setStageZoom:()=>{},getStageZoom:()=>p,setStageZoomKeyframes:()=>{},getStageZoomKeyframes:()=>f,addElement:()=>!1,removeElement:()=>!1,updateElementTiming:()=>!1,setElementTiming:()=>{},updateElementSrc:()=>!1,updateElementLayer:()=>!1,updateElementBasePosition:()=>!1,markTimelineDirty:()=>{},isTimelineDirty:()=>!1,rebuildTimeline:()=>{},ensureTimeline:()=>{},enableRenderMode:()=>{},disableRenderMode:()=>{},renderSeek:l.renderSeek,getElementVisibility:()=>({visible:!1}),getVisibleElements:()=>M,getRenderState:()=>({...F,time:l.getTime(),duration:l.getDuration(),isPlaying:l.isPlaying()})}},a=1/60,m=.75,h=.75,A=.35,C=900,D=3,L=2,G=.05,U=100,k=240,X=l=>{if(l instanceof Error)return l.message||String(l);if(typeof l=="string")return l;try{return JSON.stringify(l)}catch{return String(l??"")}},S=l=>{let p=l.toLowerCase();return p.includes("cannot read properties of null")||p.includes("cannot set properties of null")?{code:"runtime_null_dom_access",category:"dom-null-access"}:p.includes("failed to execute \'queryselector\'")?{code:"runtime_invalid_selector",category:"selector-invalid"}:p.includes("is not defined")?{code:"runtime_reference_missing",category:"reference-missing"}:{code:"runtime_script_error",category:"script-error"}},x=l=>{if(l==null||l.trim()==="")return null;let p=Number.parseFloat(l);return!Number.isFinite(p)||p<=0?null:`${p}px`},g=()=>{let l=document.querySelector(\'[data-composition-id][data-root="true"]\');if(l instanceof HTMLElement)return l;let p=Array.from(document.querySelectorAll("[data-composition-id]"));return p.length===0?null:p.find(f=>!f.parentElement?.closest("[data-composition-id]"))??p[0]??null},N=()=>{let l=g();if(!l)return;let p=x(l.getAttribute("data-width")),f=x(l.getAttribute("data-height"));p&&(l.style.width=p),f&&(l.style.height=f),p&&l.style.setProperty("--comp-width",p),f&&l.style.setProperty("--comp-height",f)},y=()=>{let l=g(),p=Array.from(document.querySelectorAll("[data-composition-id]")).filter(f=>f.hasAttribute("data-duration")||f.hasAttribute("data-end"));for(let f of p){if(l&&f===l)continue;let M=f.getAttribute("data-duration"),F=f.getAttribute("data-end");M!=null&&!f.hasAttribute(jt)&&f.setAttribute(jt,M),F!=null&&!f.hasAttribute(zt)&&f.setAttribute(zt,F),f.removeAttribute("data-duration"),f.removeAttribute("data-end")}},E=()=>{let l=g();if(!l)return;l.style.position||(l.style.position="relative"),l.style.overflow="hidden";let p=x(l.getAttribute("data-width")),f=x(l.getAttribute("data-height"));p&&(l.style.width=p),f&&(l.style.height=f);let M=Array.from(l.children);for(let F of M){let O=F.tagName.toLowerCase();if(O==="script"||O==="style"||O==="link"||O==="meta"||!F.hasAttribute("data-start"))continue;let re=(F.style.top==="0px"||F.style.top==="0")&&(F.style.left==="0px"||F.style.left==="0")&&F.style.width==="100%"&&F.style.height==="100%",Fe=/translate\\(\\s*-50%\\s*,\\s*-50%\\s*\\)/.test(F.style.transform);if(re&&Fe&&!F.hasAttribute("data-width")&&!F.hasAttribute("data-height")){let xe=F.style.top,V=F.style.left,q=F.style.width,ie=F.style.height;F.style.top="",F.style.left="",F.style.width="",F.style.height="";let $=window.getComputedStyle(F);$.top!=="auto"||$.bottom!=="auto"||$.left!=="auto"||$.right!=="auto"||$.width!=="0px"||$.height!=="0px"||(F.style.top=xe,F.style.left=V,F.style.width=q,F.style.height=ie)}let J=window.getComputedStyle(F),ne=J.position;if(ne!=="absolute"&&ne!=="fixed"&&(F.style.position="absolute"),!!F.style.top||!!F.style.bottom||J.top!=="auto"||J.bottom!=="auto"||(F.style.top="0"),!!F.style.left||!!F.style.right||J.left!=="auto"||J.right!=="auto"||(F.style.left="0"),O!=="audio"){let xe=x(F.getAttribute("data-width")),V=x(F.getAttribute("data-height")),q=J.width!=="0px"&&J.width!=="auto",ie=J.height!=="0px"&&J.height!=="auto";xe?!F.style.width&&!q&&(F.style.width=xe):!F.style.width&&J.width==="0px"&&(F.style.width="100%"),V?!F.style.height&&!ie&&(F.style.height=V):!F.style.height&&J.height==="0px"&&(F.style.height="100%")}}},R=(l,p=0)=>we({timelineRegistry:window.__timelines??{}}).resolveStartForElement(l,p),_=(l,p)=>we({timelineRegistry:window.__timelines??{},includeAuthoredTimingAttrs:p?.includeAuthoredTimingAttrs??!0}).resolveDurationForElement(l),W=!!document.querySelector("[data-composition-src]"),Z=!1;{let l=document.querySelectorAll("[data-composition-id]:not([data-composition-src])");for(let p of l){let f=p.getAttribute("data-composition-id");if(f&&p.children.length===0&&document.querySelector(`template#${CSS.escape(f)}-template`)){Z=!0;break}}}let w=!W&&!Z,Q=l=>{if(!l||typeof l.duration!="function")return null;try{let p=Number(l.duration());return Number.isFinite(p)?Math.max(0,p):null}catch{return null}},ee=l=>typeof l=="number"&&Number.isFinite(l)&&l>a,H=l=>{let p=Number(l.getAttribute("data-duration"));if(Number.isFinite(p)&&p>0)return p;let f=Number(l.getAttribute("data-playback-start")??l.getAttribute("data-media-start")??"0"),M=Number.isFinite(f)?Math.max(0,f):0;return Number.isFinite(l.duration)&&l.duration>M?Math.max(0,l.duration-M):null},z=()=>{let l=Array.from(document.querySelectorAll("video[data-start], audio[data-start]"));if(l.length===0)return null;let p=0;for(let f of l){let M=R(f,0);if(!Number.isFinite(M))continue;let F=H(f);F==null||F<=a||(p=Math.max(p,Math.max(0,M)+F))}return p>a?p:null},v=()=>{let l=z();return typeof l!="number"||!Number.isFinite(l)||l<=a?null:l},K=l=>ee(l)?Math.max(a,l*m):a,he=(l,p=0)=>{let f=Q(l),M=v(),F=Number.isFinite(p)&&p>a?p:0,O=0;ee(f)?O=Math.max(f,F):ee(M)?O=Math.max(M,F):O=F;let re=Math.max(1,Number(e.maxTimelineDurationSeconds)||1800);return O>0?Math.max(0,Math.min(O,re)):0},ue=()=>{let l=window.__timelines??{},p=we({timelineRegistry:l}),f=v(),M=K(f),F=V=>{let q=document.querySelector(`[data-composition-id="${CSS.escape(V)}"]`);return q?p.resolveStartForElement(q,0):0},O=V=>{let q=window.gsap;if(!q||typeof q.timeline!="function")return null;let ie=q.timeline({paused:!0});for(let $ of V)ie.add($.timeline,F($.compositionId));return ie},re=(V,q)=>{if(!ee(V))return null;let ie=window.gsap;if(!ie||typeof ie.timeline!="function")return null;let $=ie.timeline({paused:!0});if(q)try{$.add(q,0)}catch{}let oe=$;if(typeof oe.to=="function")try{oe.to({},{duration:V})}catch{}return $},Fe=(V,q)=>{let ie=V;if(typeof ie.getChildren!="function")return[];try{let $=ie.getChildren(!0,!0,!0)??[];if(!Array.isArray($))return[];let oe=[];for(let ae of q)if(!$.some(Ce=>Ce===ae.timeline))try{let Ce=F(ae.compositionId);V.add(ae.timeline,Ce),oe.push(ae.compositionId)}catch{}return oe}catch{return[]}},J=g(),ne=J?.getAttribute("data-composition-id")??null;if(!ne)return{timeline:null};let me=l[ne]??null,se=(()=>{if(!J)return[];let V=new Set,q=Array.from(J.querySelectorAll("[data-composition-id]")),ie=[];for(let $ of q){let oe=$.getAttribute("data-composition-id");if(!oe||oe===ne||V.has(oe))continue;V.add(oe);let ae=l[oe]??null;if(!ae||typeof ae.play!="function"||typeof ae.pause!="function")continue;let Te=Q(ae);ie.push({compositionId:oe,timeline:ae,durationSeconds:Te??0})}return ie})(),xe=V=>{for(let q of V){let ie=q.timeline;if(typeof ie.paused=="function")try{ie.paused(!1)}catch{}}};if(se.length>0&&xe(se),me){let V=se.length>0?Fe(me,se):[];if((se.length>0||!document.querySelector("[data-composition-id]:not([data-composition-id=\'"+ne+"\'])"))&&(b=!0),V.length>0)try{let $=me.time();me.seek($,!1)}catch{}let q=Q(me);if(!ee(q)&&se.length>0){let $=se.map(An=>An.compositionId),oe=O(se),ae=Q(oe);if(oe&&ee(ae))return{timeline:oe,selectedTimelineIds:$,selectedDurationSeconds:ae,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_unusable_fallback",details:{rootCompositionId:ne,rootDurationSeconds:q,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:M,selectedDurationSeconds:ae,mediaDurationFloorSeconds:f,selectedTimelineIds:$,autoNestedChildren:V}}};let Te=re(f??0,me),Ce=Q(Te);if(Te&&ee(Ce))return{timeline:Te,selectedTimelineIds:[ne],selectedDurationSeconds:Ce,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:ne,rootDurationSeconds:q,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:f,selectedDurationSeconds:Ce,selectedTimelineIds:[ne],autoNestedChildren:V}}}}if(!ee(q)&&se.length===0){let $=re(f??0,me),oe=Q($);if($&&ee(oe))return{timeline:$,selectedTimelineIds:[ne],selectedDurationSeconds:oe,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_unusable_media_floor_fallback",details:{rootCompositionId:ne,rootDurationSeconds:q,fallbackKind:"media_duration_floor",mediaDurationFloorSeconds:f,selectedDurationSeconds:oe,selectedTimelineIds:[ne]}}}}let ie=J?.getAttribute("data-duration");if(ie){let $=parseFloat(ie);if(ee($)&&ee(q)&&$>=q+.5){let oe=me;if(typeof oe.to=="function")try{oe.to({},{duration:0},$)}catch{}let ae=Q(me);if(ee(ae))return{timeline:me,selectedTimelineIds:[ne],selectedDurationSeconds:ae,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_padded_to_declared_duration",details:{rootCompositionId:ne,rootDurationSeconds:q,rootDeclaredDur:$,newDur:ae}}}}}return{timeline:me,selectedTimelineIds:[ne],selectedDurationSeconds:q,mediaDurationFloorSeconds:f,diagnostics:V.length>0?{code:"root_timeline_auto_nested_children",details:{rootCompositionId:ne,selectedDurationSeconds:q,autoNestedChildren:V}}:void 0}}if(se.length>0){let V=se.map($=>$.compositionId),q=O(se),ie=Q(q);if(q)return{timeline:q,selectedTimelineIds:V,selectedDurationSeconds:ie,mediaDurationFloorSeconds:f,diagnostics:{code:"root_timeline_missing_fallback",details:{rootCompositionId:ne,fallbackKind:"composite_by_root_children",minCandidateDurationSeconds:M,selectedDurationSeconds:ie,mediaDurationFloorSeconds:f,selectedTimelineIds:V}}}}return{timeline:null}},B=()=>{let l=e.capturedTimeline;if(!l||typeof l.time!="function")return;let p=Number(l.time());Number.isFinite(p)&&(e.currentTime=Math.max(0,p))},b=!1,T=()=>{if(!w)return!1;let l=e.capturedTimeline,p=Q(l),f=ee(p);if(l&&f&&b)return!1;let M=ue();return M.timeline?l&&l===M.timeline?(typeof l.timeScale=="function"&&l.timeScale(e.playbackRate),!1):(e.capturedTimeline=M.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate),M.diagnostics&&fe({source:"hf-preview",type:"diagnostic",code:M.diagnostics.code,details:M.diagnostics.details}),fe({source:"hf-preview",type:"diagnostic",code:"timeline_bound",details:{selectedTimelineIds:M.selectedTimelineIds??[],selectedDurationSeconds:M.selectedDurationSeconds??null,mediaDurationFloorSeconds:M.mediaDurationFloorSeconds??null}}),!0):!1},Y=()=>{let l=g();if(!(l instanceof HTMLElement))return;let p=l.getBoundingClientRect(),f=Number(l.getAttribute("data-width")),M=Number(l.getAttribute("data-height")),F=window.getComputedStyle(l),O=Number.isFinite(f)&&f>0&&Number.isFinite(M)&&M>0,re=p.width<=0||p.height<=0||l.clientWidth<=0||l.clientHeight<=0;!O||!re||c("root_stage_layout_zero",{compositionId:l.getAttribute("data-composition-id")??null,declaredWidth:f,declaredHeight:M,rectWidth:Math.round(p.width),rectHeight:Math.round(p.height),clientWidth:l.clientWidth,clientHeight:l.clientHeight,display:F.display,visibility:F.visibility,overflow:F.overflow},`root-stage-layout-zero:${l.getAttribute("data-composition-id")??"unknown"}`)},te=()=>{e.tornDown||(u!=null&&window.cancelAnimationFrame(u),u=window.requestAnimationFrame(()=>{u=null,Y()}))},I=()=>{n=l=>{let p=X(l.error??l.message).slice(0,k);if(!p)return;let f=S(p);fe({source:"hf-preview",type:"diagnostic",code:f.code,details:{category:f.category,message:p,filename:l.filename||null,line:Number.isFinite(l.lineno)?l.lineno:null,column:Number.isFinite(l.colno)?l.colno:null}})},i=l=>{let p=X(l.reason).slice(0,k);if(!p)return;let f=S(p);fe({source:"hf-preview",type:"diagnostic",code:`${f.code}_unhandled_rejection`,details:{category:`${f.category}-unhandled-rejection`,message:p}})},window.addEventListener("error",n),window.addEventListener("unhandledrejection",i)},P=()=>{let l=Array.from(document.querySelectorAll("img, video, audio, source, link[rel=\'stylesheet\']"));for(let f of l){let M=()=>{if(!(f instanceof Element))return;let F=f.tagName.toLowerCase(),O=f.getAttribute("src")??f.getAttribute("href")??f.getAttribute("poster")??null,re=F==="link"?"runtime_stylesheet_load_failed":"runtime_asset_load_failed";c(re,{tagName:F,assetUrl:O,currentSrc:(f instanceof HTMLImageElement||f instanceof HTMLMediaElement)&&f.currentSrc||null,readyState:f instanceof HTMLMediaElement?f.readyState:null,networkState:f instanceof HTMLMediaElement?f.networkState:null},`${re}:${F}:${O??"unknown"}`)};f.addEventListener("error",M),d(()=>{f.removeEventListener("error",M)})}let p=document.fonts;p&&p.ready.then(()=>{if(e.tornDown)return;let f=Array.from(p).filter(M=>M.status==="error").map(M=>M.family).filter(M=>!!M).slice(0,10);f.length!==0&&c("runtime_font_load_issue",{failedFamilies:f,totalFaces:Array.from(p).length},`runtime-font-load-issue:${f.join("|")}`)}).catch(()=>{})},j=(l,p)=>{if(!l.timeline)return!1;let f=e.capturedTimeline;if(f&&f===l.timeline)return!1;let M=Math.max(0,e.currentTime||0),F=e.isPlaying;e.capturedTimeline=l.timeline,typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);try{e.capturedTimeline.pause(),e.capturedTimeline.seek(M,!1),F&&e.capturedTimeline.play()}catch{}return fe({source:"hf-preview",type:"diagnostic",code:"timeline_loop_guard_rebind",details:{reason:p,previousTime:M,selectedTimelineIds:l.selectedTimelineIds??[],selectedDurationSeconds:l.selectedDurationSeconds??null,mediaDurationFloorSeconds:l.mediaDurationFloorSeconds??null}}),!0},ce=null,de=!1,Ee=new Set,ge=()=>{e.tornDown||(ce!=null&&window.clearTimeout(ce),ce=window.setTimeout(()=>{if(e.tornDown)return;ce=null;let l=ue();if(!l.timeline||!ee(l.mediaDurationFloorSeconds??null))return;if(!e.capturedTimeline){T()&&(ke(),ye(!0));return}if(de)return;let f=Q(e.capturedTimeline),M=l.selectedDurationSeconds??Q(l.timeline);ee(M)&&(!ee(f)||M>=f+G)&&j(l,"manual")&&(de=!0,fe({source:"hf-preview",type:"diagnostic",code:"timeline_rebind_after_media_metadata",details:{previousDurationSeconds:f??null,selectedDurationSeconds:M??null,selectedTimelineIds:l.selectedTimelineIds??[],mediaDurationFloorSeconds:l.mediaDurationFloorSeconds??null}}),ke(),ye(!0))},U))},gn=()=>{for(let l of Ee)l.removeEventListener("loadedmetadata",ge),l.removeEventListener("durationchange",ge);Ee.clear()},Je=()=>{if(e.tornDown)return;let l=Array.from(document.querySelectorAll("video, audio"));for(let p of l)Ee.has(p)||(Ee.add(p),p.addEventListener("loadedmetadata",ge),p.addEventListener("durationchange",ge),p.preload!=="auto"&&(p.preload="auto"),p.readyState<HTMLMediaElement.HAVE_FUTURE_DATA&&p.load())},ht=()=>{let l=F=>{let O=F.closest("[data-composition-id]"),re=O?R(O,0):null,Fe=O?_(O,{includeAuthoredTimingAttrs:!0}):null;return{compositionRoot:O,inheritedStart:re,inheritedDuration:Fe}},p=Lt({shouldIncludeElement:F=>F.hasAttribute("data-start")||!!l(F).compositionRoot,resolveStartSeconds:F=>{let O=l(F);return R(F,O.inheritedStart??0)},resolveDurationSeconds:F=>{let O=l(F),re=R(F,O.inheritedStart??0),Fe=Number.parseFloat(F.dataset.playbackStart??F.dataset.mediaStart??"0")||0,J=O.inheritedStart!=null&&O.inheritedDuration!=null&&O.inheritedDuration>0?Math.max(0,O.inheritedStart+O.inheritedDuration-re):null,ne=Number.isFinite(F.duration)&&F.duration>Fe?Math.max(0,F.duration-Fe):null;return ne!=null&&J!=null?Math.min(ne,J):ne??J}});Tt({clips:p.mediaClips,timeSeconds:e.currentTime,playing:e.isPlaying,playbackRate:e.playbackRate,outputMuted:e.mediaOutputMuted,userMuted:e.bridgeMuted,onAutoplayBlocked:()=>{e.mediaAutoplayBlockedPosted||(e.mediaAutoplayBlockedPosted=!0,fe({source:"hf-preview",type:"media-autoplay-blocked"}))}});let f=document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null,M=Array.from(document.querySelectorAll("[data-start]"));for(let F of M){if(!(F instanceof HTMLElement))continue;let O=F.tagName.toLowerCase();if(O==="script"||O==="style"||O==="link"||O==="meta")continue;if(!F.getAttribute("data-composition-id")){let xe=F.closest("[data-composition-id]")?.getAttribute("data-composition-id")??null;if(xe&&xe!==f)continue}let Fe=R(F,0),J=_(F),ne=F.getAttribute("data-composition-id");if(ne){let se=(window.__timelines??{})[ne],xe=null;if(se&&typeof se.duration=="function"){let V=Number(se.duration());Number.isFinite(V)&&V>0&&(xe=V)}J!=null&&J>0&&xe!=null?J=Math.min(J,xe):(J==null||J<=0)&&xe!=null&&(J=xe)}let me=J!=null&&J>0?Fe+J:Number.POSITIVE_INFINITY,Xe=e.currentTime>=Fe&&(Number.isFinite(me)?e.currentTime<me:!0);F.style.visibility=Xe?"visible":"hidden"}},ye=l=>{B();let p=Math.max(0,Math.round((e.currentTime||0)*e.canonicalFps)),f=Date.now();(l||p!==e.bridgeLastPostedFrame||e.isPlaying!==e.bridgeLastPostedPlaying||e.bridgeMuted!==e.bridgeLastPostedMuted||f-e.bridgeLastPostedAt>=e.bridgeMaxPostIntervalMs)&&(e.bridgeLastPostedFrame=p,e.bridgeLastPostedPlaying=e.isPlaying,e.bridgeLastPostedMuted=e.bridgeMuted,e.bridgeLastPostedAt=f,fe({source:"hf-preview",type:"state",frame:p,isPlaying:e.isPlaying,muted:e.bridgeMuted,playbackRate:e.playbackRate}))},ke=()=>{y(),N(),E();let l=g();if(l){let f=x(l.getAttribute("data-width")),M=x(l.getAttribute("data-height")),F=f?parseInt(f,10):0,O=M?parseInt(M,10):0;F>0&&O>0&&fe({source:"hf-preview",type:"stage-size",width:F,height:O})}T();let p=Ot({canonicalFps:e.canonicalFps,maxTimelineDurationSeconds:e.maxTimelineDurationSeconds});window.__clipManifest=p,fe(p),te()},Ie=(l,p=0)=>{for(let f of e.deterministicAdapters){try{l==="discover"&&f.discover(),l==="pause"&&f.pause(),l==="play"&&f.play&&f.play()}catch{}if(l==="discover")try{f.seek({time:p})}catch{}}};if(w)at();else{let l={injectedStyles:e.injectedCompStyles,injectedScripts:e.injectedCompScripts,parseDimensionPx:x,onDiagnostic:({code:p,details:f})=>{fe({source:"hf-preview",type:"diagnostic",code:p,details:f})}};Ht(l).then(()=>Wt(l)).finally(()=>{w=!0,Ie("discover",e.currentTime),Je(),P(),at(),ke(),ye(!0)})}let je=wt({postMessage:l=>fe(l)});je.installPickerApi();let gt=l=>{let p=Number(l);!Number.isFinite(p)||p<=0?e.playbackRate=1:e.playbackRate=Math.max(.1,Math.min(5,p)),e.capturedTimeline&&typeof e.capturedTimeline.timeScale=="function"&&e.capturedTimeline.timeScale(e.playbackRate);let f=document.querySelectorAll("video, audio");for(let M of f)if(M instanceof HTMLMediaElement)try{M.playbackRate=e.playbackRate}catch{}},le=Rt({getTimeline:()=>e.capturedTimeline,setTimeline:l=>{e.capturedTimeline=l},getTimelineRegistry:()=>window.__timelines??{},getIsPlaying:()=>e.isPlaying,setIsPlaying:l=>{e.isPlaying=l},getPlaybackRate:()=>e.playbackRate,setPlaybackRate:gt,getCanonicalFps:()=>e.canonicalFps,onSyncMedia:(l,p)=>{e.currentTime=Math.max(0,Number(l)||0),e.isPlaying=p,ht()},onStatePost:ye,onDeterministicSeek:l=>{for(let p of e.deterministicAdapters)try{p.seek({time:Number(l)||0})}catch{}},onDeterministicPause:()=>Ie("pause"),onDeterministicPlay:()=>Ie("play"),onRenderFrameSeek:()=>{},onShowNativeVideos:()=>{},getSafeDuration:()=>he(e.capturedTimeline,0)});window.__player=s(le),window.__playerReady=!0,window.__renderReady=!0,Nt(fe),Pe("composition_loaded",{duration:le.getDuration(),compositionId:document.querySelector("[data-composition-id]")?.getAttribute("data-composition-id")??null}),e.controlBridgeHandler=At({onPlay:()=>{le.play(),Pe("composition_played",{time:le.getTime()})},onPause:()=>{le.pause(),Pe("composition_paused",{time:le.getTime()})},onSeek:(l,p)=>{let f=Math.max(0,l)/e.canonicalFps;le.seek(f),Pe("composition_seeked",{time:f})},onSetMuted:l=>{e.bridgeMuted=l;let p=l||e.mediaOutputMuted,f=document.querySelectorAll("video, audio");for(let M of f)M instanceof HTMLMediaElement&&(M.muted=p)},onSetMediaOutputMuted:l=>{e.mediaOutputMuted=l;let p=l||e.bridgeMuted,f=document.querySelectorAll("video, audio");for(let M of f)M instanceof HTMLMediaElement&&(M.muted=p)},onSetPlaybackRate:l=>gt(l),onEnablePickMode:()=>je.enablePickMode(),onDisablePickMode:()=>je.disablePickMode()}),T(),e.capturedTimeline&&(le._timeline=e.capturedTimeline),w&&setTimeout(()=>{let l=e.capturedTimeline;T()&&e.capturedTimeline!==l&&(le._timeline=e.capturedTimeline),Ie("discover",e.currentTime),ke(),ye(!0)},0),e.deterministicAdapters=[kt(),Et({resolveStartSeconds:l=>R(l,0)}),Ct(),Dt(),yt({getTimeline:()=>e.capturedTimeline})],I(),Ie("discover"),Je(),e.timelinePollIntervalId&&clearInterval(e.timelinePollIntervalId);let Qe=0,ze=null,St=0,Ze=!1,Le=0,Ft=()=>{St=Date.now(),Ze=!1,Le=0};e.timelinePollIntervalId=setInterval(()=>{Qe+=1;let p=e.isPlaying&&e.capturedTimeline!=null&&Math.max(0,e.currentTime||0)<L?!1:T();if(e.capturedTimeline&&!le._timeline&&(le._timeline=e.capturedTimeline),(p||Qe%20===0)&&ke(),Qe%10===0&&Je(),B(),e.isPlaying&&e.capturedTimeline){let f=Math.max(0,e.currentTime||0),M=ze,F=he(e.capturedTimeline,0);if(F>0&&f>=F){le.pause(),le.seek(F),ze=F,Le=0,ye(!0);return}if(M!=null&&M>=h&&f<=A?Le+=1:Le=0,!Ze&&Le>=D&&Date.now()-St>C){let re=ue();j(re,"loop_guard")&&(Ze=!0,Le=0)}ze=Math.max(0,e.currentTime||0)}else ze=Math.max(0,e.currentTime||0);e.isPlaying&&ht(),ye(!1)},50),ke(),ye(!0);let Sn=le.seek;le.seek=l=>{Ft(),Sn(l)};let Fn=le.renderSeek;le.renderSeek=l=>{Ft(),Fn(l)};let Ye=()=>{if(!e.tornDown){e.tornDown=!0,e.timelinePollIntervalId&&(clearInterval(e.timelinePollIntervalId),e.timelinePollIntervalId=null),ce!=null&&(window.clearTimeout(ce),ce=null),u!=null&&(window.cancelAnimationFrame(u),u=null),gn(),e.controlBridgeHandler&&(window.removeEventListener("message",e.controlBridgeHandler),e.controlBridgeHandler=null),n&&(window.removeEventListener("error",n),n=null),i&&(window.removeEventListener("unhandledrejection",i),i=null),e.beforeUnloadHandler&&(window.removeEventListener("beforeunload",e.beforeUnloadHandler),e.beforeUnloadHandler=null),je.disablePickMode();for(let l of e.deterministicAdapters)if(!(!l||typeof l.revert!="function"))try{l.revert()}catch{}e.deterministicAdapters=[];for(let l of r.splice(0))try{l()}catch{}for(let l of e.injectedCompStyles)try{l.remove()}catch{}e.injectedCompStyles=[];for(let l of e.injectedCompScripts)try{l.remove()}catch{}e.injectedCompScripts=[],e.capturedTimeline=null,t.__hfRuntimeTeardown===Ye&&(t.__hfRuntimeTeardown=null)}};t.__hfRuntimeTeardown=Ye,e.beforeUnloadHandler=Ye,window.addEventListener("beforeunload",e.beforeUnloadHandler)}var Gt=["BN","BN","BN","BN","BN","BN","BN","BN","BN","S","B","S","WS","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","B","B","B","S","WS","ON","ON","ET","ET","ET","ON","ON","ON","ON","ON","ES","CS","ES","CS","CS","EN","EN","EN","EN","EN","EN","EN","EN","EN","EN","CS","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","ON","ON","ON","BN","BN","BN","BN","BN","BN","B","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","BN","CS","ON","ET","ET","ET","ET","ON","ON","ON","ON","L","ON","ON","BN","ON","ON","ET","ET","EN","EN","ON","L","ON","ON","ON","EN","L","ON","ON","ON","ON","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","L","ON","L","L","L","L","L","L","L","L"],lt=[[697,698,"ON"],[706,719,"ON"],[722,735,"ON"],[741,749,"ON"],[751,767,"ON"],[768,879,"NSM"],[884,885,"ON"],[894,894,"ON"],[900,901,"ON"],[903,903,"ON"],[1014,1014,"ON"],[1155,1161,"NSM"],[1418,1418,"ON"],[1421,1422,"ON"],[1423,1423,"ET"],[1424,1424,"R"],[1425,1469,"NSM"],[1470,1470,"R"],[1471,1471,"NSM"],[1472,1472,"R"],[1473,1474,"NSM"],[1475,1475,"R"],[1476,1477,"NSM"],[1478,1478,"R"],[1479,1479,"NSM"],[1480,1535,"R"],[1536,1541,"AN"],[1542,1543,"ON"],[1544,1544,"AL"],[1545,1546,"ET"],[1547,1547,"AL"],[1548,1548,"CS"],[1549,1549,"AL"],[1550,1551,"ON"],[1552,1562,"NSM"],[1563,1610,"AL"],[1611,1631,"NSM"],[1632,1641,"AN"],[1642,1642,"ET"],[1643,1644,"AN"],[1645,1647,"AL"],[1648,1648,"NSM"],[1649,1749,"AL"],[1750,1756,"NSM"],[1757,1757,"AN"],[1758,1758,"ON"],[1759,1764,"NSM"],[1765,1766,"AL"],[1767,1768,"NSM"],[1769,1769,"ON"],[1770,1773,"NSM"],[1774,1775,"AL"],[1776,1785,"EN"],[1786,1808,"AL"],[1809,1809,"NSM"],[1810,1839,"AL"],[1840,1866,"NSM"],[1867,1957,"AL"],[1958,1968,"NSM"],[1969,1983,"AL"],[1984,2026,"R"],[2027,2035,"NSM"],[2036,2037,"R"],[2038,2041,"ON"],[2042,2044,"R"],[2045,2045,"NSM"],[2046,2069,"R"],[2070,2073,"NSM"],[2074,2074,"R"],[2075,2083,"NSM"],[2084,2084,"R"],[2085,2087,"NSM"],[2088,2088,"R"],[2089,2093,"NSM"],[2094,2136,"R"],[2137,2139,"NSM"],[2140,2143,"R"],[2144,2191,"AL"],[2192,2193,"AN"],[2194,2198,"AL"],[2199,2207,"NSM"],[2208,2249,"AL"],[2250,2273,"NSM"],[2274,2274,"AN"],[2275,2306,"NSM"],[2362,2362,"NSM"],[2364,2364,"NSM"],[2369,2376,"NSM"],[2381,2381,"NSM"],[2385,2391,"NSM"],[2402,2403,"NSM"],[2433,2433,"NSM"],[2492,2492,"NSM"],[2497,2500,"NSM"],[2509,2509,"NSM"],[2530,2531,"NSM"],[2546,2547,"ET"],[2555,2555,"ET"],[2558,2558,"NSM"],[2561,2562,"NSM"],[2620,2620,"NSM"],[2625,2626,"NSM"],[2631,2632,"NSM"],[2635,2637,"NSM"],[2641,2641,"NSM"],[2672,2673,"NSM"],[2677,2677,"NSM"],[2689,2690,"NSM"],[2748,2748,"NSM"],[2753,2757,"NSM"],[2759,2760,"NSM"],[2765,2765,"NSM"],[2786,2787,"NSM"],[2801,2801,"ET"],[2810,2815,"NSM"],[2817,2817,"NSM"],[2876,2876,"NSM"],[2879,2879,"NSM"],[2881,2884,"NSM"],[2893,2893,"NSM"],[2901,2902,"NSM"],[2914,2915,"NSM"],[2946,2946,"NSM"],[3008,3008,"NSM"],[3021,3021,"NSM"],[3059,3064,"ON"],[3065,3065,"ET"],[3066,3066,"ON"],[3072,3072,"NSM"],[3076,3076,"NSM"],[3132,3132,"NSM"],[3134,3136,"NSM"],[3142,3144,"NSM"],[3146,3149,"NSM"],[3157,3158,"NSM"],[3170,3171,"NSM"],[3192,3198,"ON"],[3201,3201,"NSM"],[3260,3260,"NSM"],[3276,3277,"NSM"],[3298,3299,"NSM"],[3328,3329,"NSM"],[3387,3388,"NSM"],[3393,3396,"NSM"],[3405,3405,"NSM"],[3426,3427,"NSM"],[3457,3457,"NSM"],[3530,3530,"NSM"],[3538,3540,"NSM"],[3542,3542,"NSM"],[3633,3633,"NSM"],[3636,3642,"NSM"],[3647,3647,"ET"],[3655,3662,"NSM"],[3761,3761,"NSM"],[3764,3772,"NSM"],[3784,3790,"NSM"],[3864,3865,"NSM"],[3893,3893,"NSM"],[3895,3895,"NSM"],[3897,3897,"NSM"],[3898,3901,"ON"],[3953,3966,"NSM"],[3968,3972,"NSM"],[3974,3975,"NSM"],[3981,3991,"NSM"],[3993,4028,"NSM"],[4038,4038,"NSM"],[4141,4144,"NSM"],[4146,4151,"NSM"],[4153,4154,"NSM"],[4157,4158,"NSM"],[4184,4185,"NSM"],[4190,4192,"NSM"],[4209,4212,"NSM"],[4226,4226,"NSM"],[4229,4230,"NSM"],[4237,4237,"NSM"],[4253,4253,"NSM"],[4957,4959,"NSM"],[5008,5017,"ON"],[5120,5120,"ON"],[5760,5760,"WS"],[5787,5788,"ON"],[5906,5908,"NSM"],[5938,5939,"NSM"],[5970,5971,"NSM"],[6002,6003,"NSM"],[6068,6069,"NSM"],[6071,6077,"NSM"],[6086,6086,"NSM"],[6089,6099,"NSM"],[6107,6107,"ET"],[6109,6109,"NSM"],[6128,6137,"ON"],[6144,6154,"ON"],[6155,6157,"NSM"],[6158,6158,"BN"],[6159,6159,"NSM"],[6277,6278,"NSM"],[6313,6313,"NSM"],[6432,6434,"NSM"],[6439,6440,"NSM"],[6450,6450,"NSM"],[6457,6459,"NSM"],[6464,6464,"ON"],[6468,6469,"ON"],[6622,6655,"ON"],[6679,6680,"NSM"],[6683,6683,"NSM"],[6742,6742,"NSM"],[6744,6750,"NSM"],[6752,6752,"NSM"],[6754,6754,"NSM"],[6757,6764,"NSM"],[6771,6780,"NSM"],[6783,6783,"NSM"],[6832,6877,"NSM"],[6880,6891,"NSM"],[6912,6915,"NSM"],[6964,6964,"NSM"],[6966,6970,"NSM"],[6972,6972,"NSM"],[6978,6978,"NSM"],[7019,7027,"NSM"],[7040,7041,"NSM"],[7074,7077,"NSM"],[7080,7081,"NSM"],[7083,7085,"NSM"],[7142,7142,"NSM"],[7144,7145,"NSM"],[7149,7149,"NSM"],[7151,7153,"NSM"],[7212,7219,"NSM"],[7222,7223,"NSM"],[7376,7378,"NSM"],[7380,7392,"NSM"],[7394,7400,"NSM"],[7405,7405,"NSM"],[7412,7412,"NSM"],[7416,7417,"NSM"],[7616,7679,"NSM"],[8125,8125,"ON"],[8127,8129,"ON"],[8141,8143,"ON"],[8157,8159,"ON"],[8173,8175,"ON"],[8189,8190,"ON"],[8192,8202,"WS"],[8203,8205,"BN"],[8207,8207,"R"],[8208,8231,"ON"],[8232,8232,"WS"],[8233,8233,"B"],[8234,8238,"BN"],[8239,8239,"CS"],[8240,8244,"ET"],[8245,8259,"ON"],[8260,8260,"CS"],[8261,8286,"ON"],[8287,8287,"WS"],[8288,8303,"BN"],[8304,8304,"EN"],[8308,8313,"EN"],[8314,8315,"ES"],[8316,8318,"ON"],[8320,8329,"EN"],[8330,8331,"ES"],[8332,8334,"ON"],[8352,8399,"ET"],[8400,8432,"NSM"],[8448,8449,"ON"],[8451,8454,"ON"],[8456,8457,"ON"],[8468,8468,"ON"],[8470,8472,"ON"],[8478,8483,"ON"],[8485,8485,"ON"],[8487,8487,"ON"],[8489,8489,"ON"],[8494,8494,"ET"],[8506,8507,"ON"],[8512,8516,"ON"],[8522,8525,"ON"],[8528,8543,"ON"],[8585,8587,"ON"],[8592,8721,"ON"],[8722,8722,"ES"],[8723,8723,"ET"],[8724,9013,"ON"],[9083,9108,"ON"],[9110,9257,"ON"],[9280,9290,"ON"],[9312,9351,"ON"],[9352,9371,"EN"],[9450,9899,"ON"],[9901,10239,"ON"],[10496,11123,"ON"],[11126,11263,"ON"],[11493,11498,"ON"],[11503,11505,"NSM"],[11513,11519,"ON"],[11647,11647,"NSM"],[11744,11775,"NSM"],[11776,11869,"ON"],[11904,11929,"ON"],[11931,12019,"ON"],[12032,12245,"ON"],[12272,12287,"ON"],[12288,12288,"WS"],[12289,12292,"ON"],[12296,12320,"ON"],[12330,12333,"NSM"],[12336,12336,"ON"],[12342,12343,"ON"],[12349,12351,"ON"],[12441,12442,"NSM"],[12443,12444,"ON"],[12448,12448,"ON"],[12539,12539,"ON"],[12736,12773,"ON"],[12783,12783,"ON"],[12829,12830,"ON"],[12880,12895,"ON"],[12924,12926,"ON"],[12977,12991,"ON"],[13004,13007,"ON"],[13175,13178,"ON"],[13278,13279,"ON"],[13311,13311,"ON"],[19904,19967,"ON"],[42128,42182,"ON"],[42509,42511,"ON"],[42607,42610,"NSM"],[42611,42611,"ON"],[42612,42621,"NSM"],[42622,42623,"ON"],[42654,42655,"NSM"],[42736,42737,"NSM"],[42752,42785,"ON"],[42888,42888,"ON"],[43010,43010,"NSM"],[43014,43014,"NSM"],[43019,43019,"NSM"],[43045,43046,"NSM"],[43048,43051,"ON"],[43052,43052,"NSM"],[43064,43065,"ET"],[43124,43127,"ON"],[43204,43205,"NSM"],[43232,43249,"NSM"],[43263,43263,"NSM"],[43302,43309,"NSM"],[43335,43345,"NSM"],[43392,43394,"NSM"],[43443,43443,"NSM"],[43446,43449,"NSM"],[43452,43453,"NSM"],[43493,43493,"NSM"],[43561,43566,"NSM"],[43569,43570,"NSM"],[43573,43574,"NSM"],[43587,43587,"NSM"],[43596,43596,"NSM"],[43644,43644,"NSM"],[43696,43696,"NSM"],[43698,43700,"NSM"],[43703,43704,"NSM"],[43710,43711,"NSM"],[43713,43713,"NSM"],[43756,43757,"NSM"],[43766,43766,"NSM"],[43882,43883,"ON"],[44005,44005,"NSM"],[44008,44008,"NSM"],[44013,44013,"NSM"],[64285,64285,"R"],[64286,64286,"NSM"],[64287,64296,"R"],[64297,64297,"ES"],[64298,64335,"R"],[64336,64450,"AL"],[64451,64466,"ON"],[64467,64829,"AL"],[64830,64847,"ON"],[64848,64911,"AL"],[64912,64913,"ON"],[64914,64967,"AL"],[64968,64975,"ON"],[64976,65007,"BN"],[65008,65020,"AL"],[65021,65023,"ON"],[65024,65039,"NSM"],[65040,65049,"ON"],[65056,65071,"NSM"],[65072,65103,"ON"],[65104,65104,"CS"],[65105,65105,"ON"],[65106,65106,"CS"],[65108,65108,"ON"],[65109,65109,"CS"],[65110,65118,"ON"],[65119,65119,"ET"],[65120,65121,"ON"],[65122,65123,"ES"],[65124,65126,"ON"],[65128,65128,"ON"],[65129,65130,"ET"],[65131,65131,"ON"],[65136,65278,"AL"],[65279,65279,"BN"],[65281,65282,"ON"],[65283,65285,"ET"],[65286,65290,"ON"],[65291,65291,"ES"],[65292,65292,"CS"],[65293,65293,"ES"],[65294,65295,"CS"],[65296,65305,"EN"],[65306,65306,"CS"],[65307,65312,"ON"],[65339,65344,"ON"],[65371,65381,"ON"],[65504,65505,"ET"],[65506,65508,"ON"],[65509,65510,"ET"],[65512,65518,"ON"],[65520,65528,"BN"],[65529,65533,"ON"],[65534,65535,"BN"],[65793,65793,"ON"],[65856,65932,"ON"],[65936,65948,"ON"],[65952,65952,"ON"],[66045,66045,"NSM"],[66272,66272,"NSM"],[66273,66299,"EN"],[66422,66426,"NSM"],[67584,67870,"R"],[67871,67871,"ON"],[67872,68096,"R"],[68097,68099,"NSM"],[68100,68100,"R"],[68101,68102,"NSM"],[68103,68107,"R"],[68108,68111,"NSM"],[68112,68151,"R"],[68152,68154,"NSM"],[68155,68158,"R"],[68159,68159,"NSM"],[68160,68324,"R"],[68325,68326,"NSM"],[68327,68408,"R"],[68409,68415,"ON"],[68416,68863,"R"],[68864,68899,"AL"],[68900,68903,"NSM"],[68904,68911,"AL"],[68912,68921,"AN"],[68922,68927,"AL"],[68928,68937,"AN"],[68938,68968,"R"],[68969,68973,"NSM"],[68974,68974,"ON"],[68975,69215,"R"],[69216,69246,"AN"],[69247,69290,"R"],[69291,69292,"NSM"],[69293,69311,"R"],[69312,69327,"AL"],[69328,69336,"ON"],[69337,69369,"AL"],[69370,69375,"NSM"],[69376,69423,"R"],[69424,69445,"AL"],[69446,69456,"NSM"],[69457,69487,"AL"],[69488,69505,"R"],[69506,69509,"NSM"],[69510,69631,"R"],[69633,69633,"NSM"],[69688,69702,"NSM"],[69714,69733,"ON"],[69744,69744,"NSM"],[69747,69748,"NSM"],[69759,69761,"NSM"],[69811,69814,"NSM"],[69817,69818,"NSM"],[69826,69826,"NSM"],[69888,69890,"NSM"],[69927,69931,"NSM"],[69933,69940,"NSM"],[70003,70003,"NSM"],[70016,70017,"NSM"],[70070,70078,"NSM"],[70089,70092,"NSM"],[70095,70095,"NSM"],[70191,70193,"NSM"],[70196,70196,"NSM"],[70198,70199,"NSM"],[70206,70206,"NSM"],[70209,70209,"NSM"],[70367,70367,"NSM"],[70371,70378,"NSM"],[70400,70401,"NSM"],[70459,70460,"NSM"],[70464,70464,"NSM"],[70502,70508,"NSM"],[70512,70516,"NSM"],[70587,70592,"NSM"],[70606,70606,"NSM"],[70608,70608,"NSM"],[70610,70610,"NSM"],[70625,70626,"NSM"],[70712,70719,"NSM"],[70722,70724,"NSM"],[70726,70726,"NSM"],[70750,70750,"NSM"],[70835,70840,"NSM"],[70842,70842,"NSM"],[70847,70848,"NSM"],[70850,70851,"NSM"],[71090,71093,"NSM"],[71100,71101,"NSM"],[71103,71104,"NSM"],[71132,71133,"NSM"],[71219,71226,"NSM"],[71229,71229,"NSM"],[71231,71232,"NSM"],[71264,71276,"ON"],[71339,71339,"NSM"],[71341,71341,"NSM"],[71344,71349,"NSM"],[71351,71351,"NSM"],[71453,71453,"NSM"],[71455,71455,"NSM"],[71458,71461,"NSM"],[71463,71467,"NSM"],[71727,71735,"NSM"],[71737,71738,"NSM"],[71995,71996,"NSM"],[71998,71998,"NSM"],[72003,72003,"NSM"],[72148,72151,"NSM"],[72154,72155,"NSM"],[72160,72160,"NSM"],[72193,72198,"NSM"],[72201,72202,"NSM"],[72243,72248,"NSM"],[72251,72254,"NSM"],[72263,72263,"NSM"],[72273,72278,"NSM"],[72281,72283,"NSM"],[72330,72342,"NSM"],[72344,72345,"NSM"],[72544,72544,"NSM"],[72546,72548,"NSM"],[72550,72550,"NSM"],[72752,72758,"NSM"],[72760,72765,"NSM"],[72850,72871,"NSM"],[72874,72880,"NSM"],[72882,72883,"NSM"],[72885,72886,"NSM"],[73009,73014,"NSM"],[73018,73018,"NSM"],[73020,73021,"NSM"],[73023,73029,"NSM"],[73031,73031,"NSM"],[73104,73105,"NSM"],[73109,73109,"NSM"],[73111,73111,"NSM"],[73459,73460,"NSM"],[73472,73473,"NSM"],[73526,73530,"NSM"],[73536,73536,"NSM"],[73538,73538,"NSM"],[73562,73562,"NSM"],[73685,73692,"ON"],[73693,73696,"ET"],[73697,73713,"ON"],[78912,78912,"NSM"],[78919,78933,"NSM"],[90398,90409,"NSM"],[90413,90415,"NSM"],[92912,92916,"NSM"],[92976,92982,"NSM"],[94031,94031,"NSM"],[94095,94098,"NSM"],[94178,94178,"ON"],[94180,94180,"NSM"],[113821,113822,"NSM"],[113824,113827,"BN"],[117760,117973,"ON"],[118e3,118009,"EN"],[118010,118012,"ON"],[118016,118451,"ON"],[118458,118480,"ON"],[118496,118512,"ON"],[118528,118573,"NSM"],[118576,118598,"NSM"],[119143,119145,"NSM"],[119155,119162,"BN"],[119163,119170,"NSM"],[119173,119179,"NSM"],[119210,119213,"NSM"],[119273,119274,"ON"],[119296,119361,"ON"],[119362,119364,"NSM"],[119365,119365,"ON"],[119552,119638,"ON"],[120513,120513,"ON"],[120539,120539,"ON"],[120571,120571,"ON"],[120597,120597,"ON"],[120629,120629,"ON"],[120655,120655,"ON"],[120687,120687,"ON"],[120713,120713,"ON"],[120745,120745,"ON"],[120771,120771,"ON"],[120782,120831,"EN"],[121344,121398,"NSM"],[121403,121452,"NSM"],[121461,121461,"NSM"],[121476,121476,"NSM"],[121499,121503,"NSM"],[121505,121519,"NSM"],[122880,122886,"NSM"],[122888,122904,"NSM"],[122907,122913,"NSM"],[122915,122916,"NSM"],[122918,122922,"NSM"],[123023,123023,"NSM"],[123184,123190,"NSM"],[123566,123566,"NSM"],[123628,123631,"NSM"],[123647,123647,"ET"],[124140,124143,"NSM"],[124398,124399,"NSM"],[124643,124643,"NSM"],[124646,124646,"NSM"],[124654,124655,"NSM"],[124661,124661,"NSM"],[124928,125135,"R"],[125136,125142,"NSM"],[125143,125251,"R"],[125252,125258,"NSM"],[125259,126063,"R"],[126064,126143,"AL"],[126144,126207,"R"],[126208,126287,"AL"],[126288,126463,"R"],[126464,126703,"AL"],[126704,126705,"ON"],[126706,126719,"AL"],[126720,126975,"R"],[126976,127019,"ON"],[127024,127123,"ON"],[127136,127150,"ON"],[127153,127167,"ON"],[127169,127183,"ON"],[127185,127221,"ON"],[127232,127242,"EN"],[127243,127247,"ON"],[127279,127279,"ON"],[127338,127343,"ON"],[127405,127405,"ON"],[127584,127589,"ON"],[127744,128728,"ON"],[128732,128748,"ON"],[128752,128764,"ON"],[128768,128985,"ON"],[128992,129003,"ON"],[129008,129008,"ON"],[129024,129035,"ON"],[129040,129095,"ON"],[129104,129113,"ON"],[129120,129159,"ON"],[129168,129197,"ON"],[129200,129211,"ON"],[129216,129217,"ON"],[129232,129240,"ON"],[129280,129623,"ON"],[129632,129645,"ON"],[129648,129660,"ON"],[129664,129674,"ON"],[129678,129734,"ON"],[129736,129736,"ON"],[129741,129756,"ON"],[129759,129770,"ON"],[129775,129784,"ON"],[129792,129938,"ON"],[129940,130031,"ON"],[130032,130041,"EN"],[130042,130042,"ON"],[131070,131071,"BN"],[196606,196607,"BN"],[262142,262143,"BN"],[327678,327679,"BN"],[393214,393215,"BN"],[458750,458751,"BN"],[524286,524287,"BN"],[589822,589823,"BN"],[655358,655359,"BN"],[720894,720895,"BN"],[786430,786431,"BN"],[851966,851967,"BN"],[917502,917759,"BN"],[917760,917999,"NSM"],[918e3,921599,"BN"],[983038,983039,"BN"],[1048574,1048575,"BN"],[1114110,1114111,"BN"]];function _n(e){if(e<=255)return Gt[e];let t=0,n=lt.length-1;for(;t<=n;){let i=t+n>>1,r=lt[i];if(e<r[0]){n=i-1;continue}if(e>r[1]){t=i+1;continue}return r[2]}return"L"}function Wn(e){let t=e.length;if(t===0)return null;let n=new Array(t),i=!1;for(let s=0;s<t;){let a=e.charCodeAt(s),m=a,h=1;if(a>=55296&&a<=56319&&s+1<t){let C=e.charCodeAt(s+1);C>=56320&&C<=57343&&(m=(a-55296<<10)+(C-56320)+65536,h=2)}let A=_n(m);(A==="R"||A==="AL"||A==="AN")&&(i=!0);for(let C=0;C<h;C++)n[s+C]=A;s+=h}if(!i)return null;let r=0;for(let s=0;s<t;s++){let a=n[s];if(a==="L"){r=0;break}if(a==="R"||a==="AL"){r=1;break}}let o=new Int8Array(t);for(let s=0;s<t;s++)o[s]=r;let u=r&1?"R":"L",d=u,c=d;for(let s=0;s<t;s++)n[s]==="NSM"?n[s]=c:c=n[s];c=d;for(let s=0;s<t;s++){let a=n[s];a==="EN"?n[s]=c==="AL"?"AN":"EN":(a==="R"||a==="L"||a==="AL")&&(c=a)}for(let s=0;s<t;s++)n[s]==="AL"&&(n[s]="R");for(let s=1;s<t-1;s++)n[s]==="ES"&&n[s-1]==="EN"&&n[s+1]==="EN"&&(n[s]="EN"),n[s]==="CS"&&(n[s-1]==="EN"||n[s-1]==="AN")&&n[s+1]===n[s-1]&&(n[s]=n[s-1]);for(let s=0;s<t;s++){if(n[s]!=="EN")continue;let a;for(a=s-1;a>=0&&n[a]==="ET";a--)n[a]="EN";for(a=s+1;a<t&&n[a]==="ET";a++)n[a]="EN"}for(let s=0;s<t;s++){let a=n[s];(a==="WS"||a==="ES"||a==="ET"||a==="CS")&&(n[s]="ON")}c=d;for(let s=0;s<t;s++){let a=n[s];a==="EN"?n[s]=c==="L"?"L":"EN":(a==="R"||a==="L")&&(c=a)}for(let s=0;s<t;s++){if(n[s]!=="ON")continue;let a=s+1;for(;a<t&&n[a]==="ON";)a++;let m=s>0?n[s-1]:d,h=a<t?n[a]:d,A=m!=="L"?"R":"L";if(A===(h!=="L"?"R":"L"))for(let D=s;D<a;D++)n[D]=A;s=a-1}for(let s=0;s<t;s++)n[s]==="ON"&&(n[s]=u);for(let s=0;s<t;s++){let a=n[s];(o[s]&1)===0?a==="R"?o[s]++:(a==="AN"||a==="EN")&&(o[s]+=2):(a==="L"||a==="AN"||a==="EN")&&o[s]++}return o}function qt(e,t){let n=Wn(e);if(n===null)return null;let i=new Int8Array(t.length);for(let r=0;r<t.length;r++)i[r]=n[t[r]];return i}var Hn=/[ \\t\\n\\r\\f]+/g,jn=/[\\t\\n\\r\\f]| {2,}|^ | $/;function zn(e){let t=e??"normal";return t==="pre-wrap"?{mode:t,preserveOrdinarySpaces:!0,preserveHardBreaks:!0}:{mode:t,preserveOrdinarySpaces:!1,preserveHardBreaks:!1}}function Un(e){if(!jn.test(e))return e;let t=e.replace(Hn," ");return t.charCodeAt(0)===32&&(t=t.slice(1)),t.length>0&&t.charCodeAt(t.length-1)===32&&(t=t.slice(0,-1)),t}function Gn(e){return/[\\r\\f]/.test(e)?e.replace(/\\r\\n/g,`\n`).replace(/[\\r\\f]/g,`\n`):e.replace(/\\r\\n/g,`\n`)}var ut=null,qn;function $n(){return ut===null&&(ut=new Intl.Segmenter(qn,{granularity:"word"})),ut}var Kn=/\\p{Script=Arabic}/u,Ge=/\\p{M}/u,Xt=/\\p{Nd}/u;function $t(e){return Kn.test(e)}function Kt(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=131072&&e<=173791||e>=173824&&e<=177983||e>=177984&&e<=178207||e>=178208&&e<=183983||e>=183984&&e<=191471||e>=191472&&e<=192093||e>=194560&&e<=195103||e>=196608&&e<=201551||e>=201552&&e<=205743||e>=205744&&e<=210041||e>=63744&&e<=64255||e>=12288&&e<=12351||e>=12352&&e<=12447||e>=12448&&e<=12543||e>=44032&&e<=55215||e>=65280&&e<=65519}function Ae(e){for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(!(n<12288)){if(n>=55296&&n<=56319&&t+1<e.length){let i=e.charCodeAt(t+1);if(i>=56320&&i<=57343){let r=(n-55296<<10)+(i-56320)+65536;if(Kt(r))return!0;t++;continue}}if(Kt(n))return!0}}return!1}function Vn(e){let t=Ke(e);return t!==null&&($e.has(t)||be.has(t))}var Jn=new Set(["\\xA0","\\u202F","\\u2060","\\uFEFF"]);function Qn(e){return Ae(e)}function Zn(e){let t=Ke(e);return t!==null&&Jn.has(t)}function qe(e){return!Vn(e)&&!Zn(e)}var $e=new Set(["\\uFF0C","\\uFF0E","\\uFF01","\\uFF1A","\\uFF1B","\\uFF1F","\\u3001","\\u3002","\\u30FB","\\uFF09","\\u3015","\\u3009","\\u300B","\\u300D","\\u300F","\\u3011","\\u3017","\\u3019","\\u301B","\\u30FC","\\u3005","\\u303B","\\u309D","\\u309E","\\u30FD","\\u30FE"]),He=new Set([\'"\',"(","[","{","\\u201C","\\u2018","\\xAB","\\u2039","\\uFF08","\\u3014","\\u3008","\\u300A","\\u300C","\\u300E","\\u3010","\\u3016","\\u3018","\\u301A"]),dt=new Set(["\'","\\u2019"]),be=new Set([".",",","!","?",":",";","\\u060C","\\u061B","\\u061F","\\u0964","\\u0965","\\u104A","\\u104B","\\u104C","\\u104D","\\u104F",")","]","}","%",\'"\',"\\u201D","\\u2019","\\xBB","\\u203A","\\u2026"]),Yn=new Set([":",".","\\u060C","\\u061B"]),Xn=new Set(["\\u104F"]),ei=new Set(["\\u201D","\\u2019","\\xBB","\\u203A","\\u300D","\\u300F","\\u3011","\\u300B","\\u3009","\\u3015","\\uFF09"]);function ti(e){if(mt(e))return!0;let t=!1;for(let n of e){if(be.has(n)){t=!0;continue}if(!(t&&Ge.test(n)))return!1}return t}function ni(e){for(let t of e)if(!$e.has(t)&&!be.has(t))return!1;return e.length>0}function ii(e){if(mt(e))return!0;for(let t of e)if(!He.has(t)&&!dt.has(t)&&!Ge.test(t))return!1;return e.length>0}function mt(e){let t=!1;for(let n of e)if(!(n==="\\\\"||Ge.test(n))){if(He.has(n)||be.has(n)||dt.has(n)){t=!0;continue}return!1}return t}function en(e,t){let n=t-1;if(n<=0)return Math.max(n,0);let i=e.charCodeAt(n);if(i<56320||i>57343)return n;let r=n-1;if(r<0)return n;let o=e.charCodeAt(r);return o>=55296&&o<=56319?r:n}function Ke(e){if(e.length===0)return null;let t=en(e,e.length);return e.slice(t)}function oi(e){let t=Array.from(e),n=t.length;for(;n>0;){let i=t[n-1];if(Ge.test(i)){n--;continue}if(He.has(i)||dt.has(i)){n--;continue}break}return n<=0||n===t.length?null:{head:t.slice(0,n).join(""),tail:t.slice(n).join("")}}function ri(e,t,n){return n==="text"&&!t&&e.length===1&&e!=="-"&&e!=="\\u2014"?e:null}function Vt(e,t,n,i){let r=t[i],o=e[i];if(r==null)return o;let u=n[i];if(o.length===u)return o;let d=r.repeat(u);return e[i]=d,d}function Jt(e,t){return e&&t!==null&&Yn.has(t)}function si(e){let t=Ke(e);return t!==null&&Xn.has(t)}function ai(e){if(e.length<2||e[0]!==" ")return null;let t=e.slice(1);return/^\\p{M}+$/u.test(t)?{space:" ",marks:t}:null}function Ve(e){let t=e.length;for(;t>0;){let n=en(e,t),i=e.slice(n,t);if(ei.has(i))return!0;if(!be.has(i))return!1;t=n}return!1}function li(e,t){if(t.preserveOrdinarySpaces||t.preserveHardBreaks){if(e===" ")return"preserved-space";if(e===" ")return"tab";if(t.preserveHardBreaks&&e===`\n`)return"hard-break"}return e===" "?"space":e==="\\xA0"||e==="\\u202F"||e==="\\u2060"||e==="\\uFEFF"?"glue":e==="\\u200B"?"zero-width-break":e==="\\xAD"?"soft-hyphen":"text"}var ui=/[\\x20\\t\\n\\xA0\\xAD\\u200B\\u202F\\u2060\\uFEFF]/;function Se(e){return e.length===1?e[0]:e.join("")}function ci(e,t){let n=[];for(let i=e.length-1;i>=0;i--)n.push(e[i]);return n.push(t),Se(n)}function di(e,t,n,i){if(!ui.test(e))return[{text:e,isWordLike:t,kind:"text",start:n}];let r=[],o=null,u=[],d=n,c=!1,s=0;for(let a of e){let m=li(a,i),h=m==="text"&&t;if(o!==null&&m===o&&h===c){u.push(a),s+=a.length;continue}o!==null&&r.push({text:Se(u),isWordLike:c,kind:o,start:d}),o=m,u=[a],d=n+s,c=h,s+=a.length}return o!==null&&r.push({text:Se(u),isWordLike:c,kind:o,start:d}),r}function ct(e){return e==="space"||e==="preserved-space"||e==="zero-width-break"||e==="hard-break"}var mi=/^[A-Za-z][A-Za-z0-9+.-]*:$/;function xi(e,t){let n=e.texts[t];return n.startsWith("www.")?!0:mi.test(n)&&t+1<e.len&&e.kinds[t+1]==="text"&&e.texts[t+1]==="//"}function fi(e){return e.includes("?")&&(e.includes("://")||e.startsWith("www."))}function pi(e){let t=e.texts.slice(),n=e.isWordLike.slice(),i=e.kinds.slice(),r=e.starts.slice();for(let u=0;u<e.len;u++){if(i[u]!=="text"||!xi(e,u))continue;let d=[t[u]],c=u+1;for(;c<e.len&&!ct(i[c]);){d.push(t[c]),n[u]=!0;let s=t[c].includes("?");if(i[c]="text",t[c]="",c++,s)break}t[u]=Se(d)}let o=0;for(let u=0;u<t.length;u++){let d=t[u];d.length!==0&&(o!==u&&(t[o]=d,n[o]=n[u],i[o]=i[u],r[o]=r[u]),o++)}return t.length=o,n.length=o,i.length=o,r.length=o,{len:o,texts:t,isWordLike:n,kinds:i,starts:r}}function hi(e){let t=[],n=[],i=[],r=[];for(let o=0;o<e.len;o++){let u=e.texts[o];if(t.push(u),n.push(e.isWordLike[o]),i.push(e.kinds[o]),r.push(e.starts[o]),!fi(u))continue;let d=o+1;if(d>=e.len||ct(e.kinds[d]))continue;let c=[],s=e.starts[d],a=d;for(;a<e.len&&!ct(e.kinds[a]);)c.push(e.texts[a]),a++;c.length>0&&(t.push(Se(c)),n.push(!0),i.push("text"),r.push(s),o=a-1)}return{len:t.length,texts:t,isWordLike:n,kinds:i,starts:r}}var gi=new Set([":","-","/","\\xD7",",",".","+","\\u2013","\\u2014"]),Qt=/^[A-Za-z0-9_]+[,:;]*$/,Zt=/[,:;]+$/;function tn(e){for(let t of e)if(Xt.test(t))return!0;return!1}function We(e){if(e.length===0)return!1;for(let t of e)if(!(Xt.test(t)||gi.has(t)))return!1;return!0}function Si(e){let t=[],n=[],i=[],r=[];for(let o=0;o<e.len;o++){let u=e.texts[o],d=e.kinds[o];if(d==="text"&&We(u)&&tn(u)){let c=[u],s=o+1;for(;s<e.len&&e.kinds[s]==="text"&&We(e.texts[s]);)c.push(e.texts[s]),s++;t.push(Se(c)),n.push(!0),i.push("text"),r.push(e.starts[o]),o=s-1;continue}t.push(u),n.push(e.isWordLike[o]),i.push(d),r.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:i,starts:r}}function Fi(e){let t=[],n=[],i=[],r=[];for(let o=0;o<e.len;o++){let u=e.texts[o],d=e.kinds[o],c=e.isWordLike[o];if(d==="text"&&c&&Qt.test(u)){let s=[u],a=Zt.test(u),m=o+1;for(;a&&m<e.len&&e.kinds[m]==="text"&&e.isWordLike[m]&&Qt.test(e.texts[m]);){let h=e.texts[m];s.push(h),a=Zt.test(h),m++}t.push(Se(s)),n.push(!0),i.push("text"),r.push(e.starts[o]),o=m-1;continue}t.push(u),n.push(c),i.push(d),r.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:i,starts:r}}function Ai(e){let t=[],n=[],i=[],r=[];for(let o=0;o<e.len;o++){let u=e.texts[o];if(e.kinds[o]==="text"&&u.includes("-")){let d=u.split("-"),c=d.length>1;for(let s=0;s<d.length;s++){let a=d[s];if(!c)break;(a.length===0||!tn(a)||!We(a))&&(c=!1)}if(c){let s=0;for(let a=0;a<d.length;a++){let m=d[a],h=a<d.length-1?`${m}-`:m;t.push(h),n.push(!0),i.push("text"),r.push(e.starts[o]+s),s+=h.length}continue}}t.push(u),n.push(e.isWordLike[o]),i.push(e.kinds[o]),r.push(e.starts[o])}return{len:t.length,texts:t,isWordLike:n,kinds:i,starts:r}}function Ni(e){let t=[],n=[],i=[],r=[],o=0;for(;o<e.len;){let u=[e.texts[o]],d=e.isWordLike[o],c=e.kinds[o],s=e.starts[o];if(c==="glue"){let a=[u[0]],m=s;for(o++;o<e.len&&e.kinds[o]==="glue";)a.push(e.texts[o]),o++;let h=Se(a);if(o<e.len&&e.kinds[o]==="text")u[0]=h,u.push(e.texts[o]),d=e.isWordLike[o],c="text",s=m,o++;else{t.push(h),n.push(!1),i.push("glue"),r.push(m);continue}}else o++;if(c==="text")for(;o<e.len&&e.kinds[o]==="glue";){let a=[];for(;o<e.len&&e.kinds[o]==="glue";)a.push(e.texts[o]),o++;let m=Se(a);if(o<e.len&&e.kinds[o]==="text"){u.push(m,e.texts[o]),d=d||e.isWordLike[o],o++;continue}u.push(m)}t.push(Se(u)),n.push(d),i.push(c),r.push(s)}return{len:t.length,texts:t,isWordLike:n,kinds:i,starts:r}}function Ei(e){let t=e.texts.slice(),n=e.isWordLike.slice(),i=e.kinds.slice(),r=e.starts.slice();for(let o=0;o<t.length-1;o++){if(i[o]!=="text"||i[o+1]!=="text"||!Ae(t[o])||!Ae(t[o+1]))continue;let u=oi(t[o]);u!==null&&(t[o]=u.head,t[o+1]=u.tail+t[o+1],r[o+1]=r[o]+u.head.length)}return{len:t.length,texts:t,isWordLike:n,kinds:i,starts:r}}function Yt(e,t,n){let i=$n(),r=0,o=[],u=[],d=[],c=[],s=[],a=[],m=[],h=[],A=[],C=[],D=[],L=[];for(let x of i.segment(e))for(let g of di(x.segment,x.isWordLike??!1,x.index,n)){let Q=function(){a[w]!==null&&(u[w]=[Vt(o,a,m,w)],a[w]=null),u[w].push(g.text),d[w]=d[w]||g.isWordLike,h[w]=h[w]||E,A[w]=A[w]||R,C[w]=W,D[w]=Z,L[w]=Jt(A[w],_)},N=g.kind==="text",y=ri(g.text,g.isWordLike,g.kind),E=Ae(g.text),R=$t(g.text),_=Ke(g.text),W=Ve(g.text),Z=si(g.text),w=r-1;t.carryCJKAfterClosingQuote&&N&&r>0&&c[w]==="text"&&E&&h[w]&&C[w]||N&&r>0&&c[w]==="text"&&ni(g.text)&&h[w]||N&&r>0&&c[w]==="text"&&D[w]?Q():N&&r>0&&c[w]==="text"&&g.isWordLike&&R&&L[w]?(Q(),d[w]=!0):y!==null&&r>0&&c[w]==="text"&&a[w]===y?m[w]=(m[w]??1)+1:N&&!g.isWordLike&&r>0&&c[w]==="text"&&(ti(g.text)||g.text==="-"&&d[w])?Q():(o[r]=g.text,u[r]=[g.text],d[r]=g.isWordLike,c[r]=g.kind,s[r]=g.start,a[r]=y,m[r]=y===null?0:1,h[r]=E,A[r]=R,C[r]=W,D[r]=Z,L[r]=Jt(R,_),r++)}for(let x=0;x<r;x++){if(a[x]!==null){o[x]=Vt(o,a,m,x);continue}o[x]=Se(u[x])}for(let x=1;x<r;x++)c[x]==="text"&&!d[x]&&mt(o[x])&&c[x-1]==="text"&&(o[x-1]+=o[x],d[x-1]=d[x-1]||d[x],o[x]="");let G=Array.from({length:r},()=>null),U=-1;for(let x=r-1;x>=0;x--){let g=o[x];if(g.length!==0){if(c[x]==="text"&&!d[x]&&ii(g)&&U>=0&&c[U]==="text"){let N=G[U]??[];N.push(g),G[U]=N,s[U]=s[x],o[x]="";continue}U=x}}for(let x=0;x<r;x++){let g=G[x];g!=null&&(o[x]=ci(g,o[x]))}let k=0;for(let x=0;x<r;x++){let g=o[x];g.length!==0&&(k!==x&&(o[k]=g,d[k]=d[x],c[k]=c[x],s[k]=s[x]),k++)}o.length=k,d.length=k,c.length=k,s.length=k;let X=Ni({len:k,texts:o,isWordLike:d,kinds:c,starts:s}),S=Ei(Fi(Ai(Si(hi(pi(X))))));for(let x=0;x<S.len-1;x++){let g=ai(S.texts[x]);g!==null&&(S.kinds[x]!=="space"&&S.kinds[x]!=="preserved-space"||S.kinds[x+1]!=="text"||!$t(S.texts[x+1])||(S.texts[x]=g.space,S.isWordLike[x]=!1,S.kinds[x]=S.kinds[x]==="preserved-space"?"preserved-space":"space",S.texts[x+1]=g.marks+S.texts[x+1],S.starts[x+1]=S.starts[x]+g.space.length))}return S}function yi(e,t){if(e.len===0)return[];if(!t.preserveHardBreaks)return[{startSegmentIndex:0,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}];let n=[],i=0;for(let r=0;r<e.len;r++)e.kinds[r]==="hard-break"&&(n.push({startSegmentIndex:i,endSegmentIndex:r,consumedEndSegmentIndex:r+1}),i=r+1);return i<e.len&&n.push({startSegmentIndex:i,endSegmentIndex:e.len,consumedEndSegmentIndex:e.len}),n}function bi(e){if(e.len<=1)return e;let t=[],n=[],i=[],r=[],o=null,u=!1,d=0,c=!1,s=!1;function a(){o!==null&&(t.push(Se(o)),n.push(u),i.push("text"),r.push(d),o=null)}for(let m=0;m<e.len;m++){let h=e.texts[m],A=e.kinds[m],C=e.isWordLike[m],D=e.starts[m];if(A==="text"){let L=Qn(h),G=qe(h);if(o!==null&&c&&s){o.push(h),u=u||C,c=c||L,s=G;continue}a(),o=[h],u=C,d=D,c=L,s=G;continue}a(),t.push(h),n.push(C),i.push(A),r.push(D)}return a(),{len:t.length,texts:t,isWordLike:n,kinds:i,starts:r}}function nn(e,t,n="normal",i="normal"){let r=zn(n),o=r.mode==="pre-wrap"?Gn(e):Un(e);if(o.length===0)return{normalized:o,chunks:[],len:0,texts:[],isWordLike:[],kinds:[],starts:[]};let u=i==="keep-all"?bi(Yt(o,t,r)):Yt(o,t,r);return{normalized:o,chunks:yi(u,r),...u}}var Be=null,on=new Map,Re=null,Mi=96,Ci=/\\p{Emoji_Presentation}/u,Di=/[\\p{Emoji_Presentation}\\p{Extended_Pictographic}\\p{Regional_Indicator}\\uFE0F\\u20E3]/u,xt=null,rn=new Map;function ft(){if(Be!==null)return Be;if(typeof OffscreenCanvas<"u")return Be=new OffscreenCanvas(1,1).getContext("2d"),Be;if(typeof document<"u")return Be=document.createElement("canvas").getContext("2d"),Be;throw new Error("Text measurement requires OffscreenCanvas or a DOM canvas context.")}function ki(e){let t=on.get(e);return t||(t=new Map,on.set(e,t)),t}function Ne(e,t){let n=t.get(e);return n===void 0&&(n={width:ft().measureText(e).width,containsCJK:Ae(e)},t.set(e,n)),n}function ve(){if(Re!==null)return Re;if(typeof navigator>"u")return Re={lineFitEpsilon:.005,carryCJKAfterClosingQuote:!1,preferPrefixWidthsForBreakableRuns:!1,preferEarlySoftHyphenBreak:!1},Re;let e=navigator.userAgent,n=navigator.vendor==="Apple Computer, Inc."&&e.includes("Safari/")&&!e.includes("Chrome/")&&!e.includes("Chromium/")&&!e.includes("CriOS/")&&!e.includes("FxiOS/")&&!e.includes("EdgiOS/"),i=e.includes("Chrome/")||e.includes("Chromium/")||e.includes("CriOS/")||e.includes("Edg/");return Re={lineFitEpsilon:n?1/64:.005,carryCJKAfterClosingQuote:i,preferPrefixWidthsForBreakableRuns:n,preferEarlySoftHyphenBreak:n},Re}function Li(e){let t=e.match(/(\\d+(?:\\.\\d+)?)\\s*px/);return t?parseFloat(t[1]):16}function sn(){return xt===null&&(xt=new Intl.Segmenter(void 0,{granularity:"grapheme"})),xt}function Ti(e){return Ci.test(e)||e.includes("\\uFE0F")}function an(e){return Di.test(e)}function wi(e,t){let n=rn.get(e);if(n!==void 0)return n;let i=ft();i.font=e;let r=i.measureText("\\u{1F600}").width;if(n=0,r>t+.5&&typeof document<"u"&&document.body!==null){let o=document.createElement("span");o.style.font=e,o.style.display="inline-block",o.style.visibility="hidden",o.style.position="absolute",o.textContent="\\u{1F600}",document.body.appendChild(o);let u=o.getBoundingClientRect().width;document.body.removeChild(o),r-u>.5&&(n=r-u)}return rn.set(e,n),n}function Bi(e){let t=0,n=sn();for(let i of n.segment(e))Ti(i.segment)&&t++;return t}function Ri(e,t){return t.emojiCount===void 0&&(t.emojiCount=Bi(e)),t.emojiCount}function Me(e,t,n){return n===0?t.width:t.width-Ri(e,t)*n}function ln(e,t,n,i,r){if(t.breakableFitAdvances!==void 0)return t.breakableFitAdvances;let o=sn(),u=[];for(let a of o.segment(e))u.push(a.segment);if(u.length<=1)return t.breakableFitAdvances=null,t.breakableFitAdvances;if(r==="sum-graphemes"){let a=[];for(let m of u){let h=Ne(m,n);a.push(Me(m,h,i))}return t.breakableFitAdvances=a,t.breakableFitAdvances}if(r==="pair-context"||u.length>Mi){let a=[],m=null,h=0;for(let A of u){let C=Ne(A,n),D=Me(A,C,i);if(m===null)a.push(D);else{let L=m+A,G=Ne(L,n);a.push(Me(L,G,i)-h)}m=A,h=D}return t.breakableFitAdvances=a,t.breakableFitAdvances}let d=[],c="",s=0;for(let a of u){c+=a;let m=Ne(c,n),h=Me(c,m,i);d.push(h-s),s=h}return t.breakableFitAdvances=d,t.breakableFitAdvances}function un(e,t){let n=ft();n.font=e;let i=ki(e),r=Li(e),o=t?wi(e,r):0;return{cache:i,fontSize:r,emojiCorrection:o}}function vi(e,t){for(;t<e.widths.length;){let n=e.kinds[t];if(n!=="space"&&n!=="zero-width-break"&&n!=="soft-hyphen")break;t++}return t}function Ii(e,t){if(t<=0)return 0;let n=e%t;return Math.abs(n)<=1e-6?t:t-n}function Pi(e,t,n,i,r){let o=0,u=t;for(;o<e.length;){let d=u+e[o];if((o+1<e.length?d+r:d)>n+i)break;u=d,o++}return{fitCount:o,fittedWidth:u}}function cn(e,t){return e.simpleLineWalkFastPath?dn(e,t):mn(e,t)}function dn(e,t,n){let{widths:i,kinds:r,breakableFitAdvances:o}=e;if(i.length===0)return 0;let d=ve().lineFitEpsilon,c=t+d,s=0,a=0,m=!1,h=0,A=0,C=0,D=0,L=-1,G=0;function U(){L=-1,G=0}function k(y=C,E=D,R=a){s++,n?.({startSegmentIndex:h,startGraphemeIndex:A,endSegmentIndex:y,endGraphemeIndex:E,width:R}),a=0,m=!1,U()}function X(y,E){m=!0,h=y,A=0,C=y+1,D=0,a=E}function S(y,E,R){m=!0,h=y,A=E,C=y,D=E+1,a=R}function x(y,E){if(!m){X(y,E);return}a+=E,C=y+1,D=0}function g(y,E){let R=o[y];for(let _=E;_<R.length;_++){let W=R[_];m?a+W>c?(k(),S(y,_,W)):(a+=W,C=y,D=_+1):S(y,_,W)}m&&C===y&&D===R.length&&(C=y+1,D=0)}let N=0;for(;N<i.length&&!(!m&&(N=vi(e,N),N>=i.length));){let y=i[N],E=r[N],R=E==="space"||E==="preserved-space"||E==="tab"||E==="zero-width-break"||E==="soft-hyphen";if(!m){y>t&&o[N]!==null?g(N,0):X(N,y),R&&(L=N+1,G=a-y),N++;continue}if(a+y>c){if(R){x(N,y),k(N+1,0,a-y),N++;continue}if(L>=0){if(C>L||C===L&&D>0){k();continue}k(L,0,G);continue}if(y>t&&o[N]!==null){k(),g(N,0),N++;continue}k();continue}x(N,y),R&&(L=N+1,G=a-y),N++}return m&&k(),s}function mn(e,t,n){if(e.simpleLineWalkFastPath)return dn(e,t,n);let{widths:i,lineEndFitAdvances:r,lineEndPaintAdvances:o,kinds:u,breakableFitAdvances:d,discretionaryHyphenWidth:c,tabStopAdvance:s,chunks:a}=e;if(i.length===0||a.length===0)return 0;let m=ve(),h=m.lineFitEpsilon,A=t+h,C=0,D=0,L=!1,G=0,U=0,k=0,X=0,S=-1,x=0,g=0,N=null;function y(){S=-1,x=0,g=0,N=null}function E(H=k,z=X,v=D){C++,n?.({startSegmentIndex:G,startGraphemeIndex:U,endSegmentIndex:H,endGraphemeIndex:z,width:v}),D=0,L=!1,y()}function R(H,z){L=!0,G=H,U=0,k=H+1,X=0,D=z}function _(H,z,v){L=!0,G=H,U=z,k=H,X=z+1,D=v}function W(H,z){if(!L){R(H,z);return}D+=z,k=H+1,X=0}function Z(H,z,v,K){if(!z)return;let he=H==="tab"?0:r[v],ue=H==="tab"?K:o[v];S=v+1,x=D-K+he,g=D-K+ue,N=H}function w(H,z){let v=d[H];for(let K=z;K<v.length;K++){let he=v[K];L?D+he>A?(E(),_(H,K,he)):(D+=he,k=H,X=K+1):_(H,K,he)}L&&k===H&&X===v.length&&(k=H+1,X=0)}function Q(H){if(N!=="soft-hyphen")return!1;let z=d[H];if(z==null)return!1;let{fitCount:v,fittedWidth:K}=Pi(z,D,t,h,c);return v===0?!1:(D=K,k=H,X=v,y(),v===z.length?(k=H+1,X=0,!0):(E(H,v,K+c),w(H,v),!0))}function ee(H){C++,n?.({startSegmentIndex:H.startSegmentIndex,startGraphemeIndex:0,endSegmentIndex:H.consumedEndSegmentIndex,endGraphemeIndex:0,width:0}),y()}for(let H=0;H<a.length;H++){let z=a[H];if(z.startSegmentIndex===z.endSegmentIndex){ee(z);continue}L=!1,D=0,G=z.startSegmentIndex,U=0,k=z.startSegmentIndex,X=0,y();let v=z.startSegmentIndex;for(;v<z.endSegmentIndex;){let K=u[v],he=K==="space"||K==="preserved-space"||K==="tab"||K==="zero-width-break"||K==="soft-hyphen",ue=K==="tab"?Ii(D,s):i[v];if(K==="soft-hyphen"){L&&(k=v+1,X=0,S=v+1,x=D+c,g=D+c,N=K),v++;continue}if(!L){ue>t&&d[v]!==null?w(v,0):R(v,ue),Z(K,he,v,ue),v++;continue}if(D+ue>A){let b=D+(K==="tab"?0:r[v]),T=D+(K==="tab"?ue:o[v]);if(N==="soft-hyphen"&&m.preferEarlySoftHyphenBreak&&x<=A){E(S,0,g);continue}if(N==="soft-hyphen"&&Q(v)){v++;continue}if(he&&b<=A){W(v,ue),E(v+1,0,T),v++;continue}if(S>=0&&x<=A){if(k>S||k===S&&X>0){E();continue}let Y=S;E(Y,0,g),v=Y;continue}if(ue>t&&d[v]!==null){E(),w(v,0),v++;continue}E();continue}W(v,ue),Z(K,he,v,ue),v++}if(L){let K=S===z.consumedEndSegmentIndex?g:D;E(z.consumedEndSegmentIndex,0,K)}}return C}var pt=null;function Oi(){return pt===null&&(pt=new Intl.Segmenter(void 0,{granularity:"grapheme"})),pt}function _i(e){return e?{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[],segments:[]}:{widths:[],lineEndFitAdvances:[],lineEndPaintAdvances:[],kinds:[],simpleLineWalkFastPath:!0,segLevels:null,breakableFitAdvances:[],discretionaryHyphenWidth:0,tabStopAdvance:0,chunks:[]}}function Wi(e,t){let n=[],i=[],r=0,o=!1,u=!1,d=!1;function c(){i.length!==0&&(n.push({text:i.length===1?i[0]:i.join(""),start:r}),i=[],o=!1,u=!1,d=!1)}function s(m,h,A){i=[m],r=h,o=A,u=Ve(m),d=He.has(m)}function a(m,h){i.push(m),o=o||h;let A=Ve(m);m.length===1&&be.has(m)?u=u||A:u=A,d=!1}for(let m of Oi().segment(e)){let h=m.segment,A=Ae(h);if(i.length===0){s(h,m.index,A);continue}if(d||$e.has(h)||be.has(h)||t.carryCJKAfterClosingQuote&&A&&u){a(h,A);continue}if(!o&&!A){a(h,A);continue}c(),s(h,m.index,A)}return c(),n}function Hi(e){if(e.length<=1)return e;let t=[],n=[e[0].text],i=e[0].start,r=Ae(e[0].text),o=qe(e[0].text);function u(){t.push({text:n.length===1?n[0]:n.join(""),start:i})}for(let d=1;d<e.length;d++){let c=e[d],s=Ae(c.text),a=qe(c.text);if(r&&o){n.push(c.text),r=r||s,o=a;continue}u(),n=[c.text],i=c.start,r=s,o=a}return u(),t}function ji(e,t,n,i){let r=ve(),{cache:o,emojiCorrection:u}=un(t,an(e.normalized)),d=Me("-",Ne("-",o),u),s=Me(" ",Ne(" ",o),u)*8;if(e.len===0)return _i(n);let a=[],m=[],h=[],A=[],C=e.chunks.length<=1,D=n?[]:null,L=[],G=n?[]:null,U=Array.from({length:e.len});function k(g,N,y,E,R,_,W){R!=="text"&&R!=="space"&&R!=="zero-width-break"&&(C=!1),a.push(N),m.push(y),h.push(E),A.push(R),D?.push(_),L.push(W),G!==null&&G.push(g)}function X(g,N,y,E,R){let _=Ne(g,o),W=Me(g,_,u),Z=N==="space"||N==="preserved-space"||N==="zero-width-break"?0:W,w=N==="space"||N==="zero-width-break"?0:W;if(R&&E&&g.length>1){let Q="sum-graphemes";We(g)?Q="pair-context":r.preferPrefixWidthsForBreakableRuns&&(Q="segment-prefixes");let ee=ln(g,_,o,u,Q);k(g,W,Z,w,N,y,ee);return}k(g,W,Z,w,N,y,null)}for(let g=0;g<e.len;g++){U[g]=a.length;let N=e.texts[g],y=e.isWordLike[g],E=e.kinds[g],R=e.starts[g];if(E==="soft-hyphen"){k(N,0,d,d,E,R,null);continue}if(E==="hard-break"){k(N,0,0,0,E,R,null);continue}if(E==="tab"){k(N,0,0,0,E,R,null);continue}let _=Ne(N,o);if(E==="text"&&_.containsCJK){let W=Wi(N,r),Z=i==="keep-all"?Hi(W):W;for(let w=0;w<Z.length;w++){let Q=Z[w];X(Q.text,"text",R+Q.start,y,i==="keep-all"||!Ae(Q.text))}continue}X(N,E,R,y,!0)}let S=zi(e.chunks,U,a.length),x=D===null?null:qt(e.normalized,D);return G!==null?{widths:a,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:A,simpleLineWalkFastPath:C,segLevels:x,breakableFitAdvances:L,discretionaryHyphenWidth:d,tabStopAdvance:s,chunks:S,segments:G}:{widths:a,lineEndFitAdvances:m,lineEndPaintAdvances:h,kinds:A,simpleLineWalkFastPath:C,segLevels:x,breakableFitAdvances:L,discretionaryHyphenWidth:d,tabStopAdvance:s,chunks:S}}function zi(e,t,n){let i=[];for(let r=0;r<e.length;r++){let o=e[r],u=o.startSegmentIndex<t.length?t[o.startSegmentIndex]:n,d=o.endSegmentIndex<t.length?t[o.endSegmentIndex]:n,c=o.consumedEndSegmentIndex<t.length?t[o.consumedEndSegmentIndex]:n;i.push({startSegmentIndex:u,endSegmentIndex:d,consumedEndSegmentIndex:c})}return i}function Ui(e,t,n,i){let r=i?.wordBreak??"normal",o=nn(e,ve(),i?.whiteSpace,r);return ji(o,t,n,r)}function xn(e,t,n){return Ui(e,t,!1,n)}function fn(e,t,n){let i=cn(e,t);return{lineCount:i,height:i*n}}var Gi={maxWidth:1600,baseFontSize:78,minFontSize:42,fontWeight:900,fontFamily:"Outfit",step:2};function pn(e,t){let n={...Gi,...t},i=1.2;for(let r=n.baseFontSize;r>=n.minFontSize;r-=n.step){let o=`${n.fontWeight} ${r}px ${n.fontFamily}`,u=xn(e,o),{lineCount:d}=fn(u,n.maxWidth,r*i);if(d<=1)return{fontSize:r,fits:!0}}return{fontSize:n.minFontSize,fits:!1}}window.__timelines=window.__timelines||{};window.__hyperframes={fitTextFontSize:pn};function hn(){let e=window;e.__hyperframeRuntimeBootstrapped||(e.__hyperframeRuntimeBootstrapped=!0,Ut())}document.readyState==="loading"?document.addEventListener("DOMContentLoaded",hn,{once:!0}):hn();})();\n';
6116
6117
  }
6117
6118
  });
6118
6119
 
@@ -9972,7 +9973,7 @@ import { get as httpsGet } from "https";
9972
9973
  import { pipeline } from "stream/promises";
9973
9974
  function downloadFile(url, dest) {
9974
9975
  const tmp = `${dest}.tmp`;
9975
- return new Promise((resolve38, reject) => {
9976
+ return new Promise((resolve39, reject) => {
9976
9977
  const follow = (u) => {
9977
9978
  httpsGet(u, (res) => {
9978
9979
  if (res.statusCode === 301 || res.statusCode === 302) {
@@ -9989,7 +9990,7 @@ function downloadFile(url, dest) {
9989
9990
  const file = createWriteStream(tmp);
9990
9991
  pipeline(res, file).then(() => {
9991
9992
  renameSync(tmp, dest);
9992
- resolve38();
9993
+ resolve39();
9993
9994
  }).catch((err) => {
9994
9995
  try {
9995
9996
  unlinkSync(tmp);
@@ -10707,7 +10708,7 @@ function hasNpx() {
10707
10708
  }
10708
10709
  }
10709
10710
  function runSkillsAdd(repo) {
10710
- return new Promise((resolve38, reject) => {
10711
+ return new Promise((resolve39, reject) => {
10711
10712
  const child = spawn("npx", ["skills", "add", repo, "--all"], {
10712
10713
  stdio: "inherit",
10713
10714
  timeout: 12e4,
@@ -10721,7 +10722,7 @@ function runSkillsAdd(repo) {
10721
10722
  env: { ...process.env, GIT_CLONE_PROTECTION_ACTIVE: "0" }
10722
10723
  });
10723
10724
  child.on("close", (code, signal) => {
10724
- if (code === 0) resolve38();
10725
+ if (code === 0) resolve39();
10725
10726
  else if (signal === "SIGINT" || code === 130) process.exit(0);
10726
10727
  else reject(new Error(`npx skills add exited with code ${code}`));
10727
10728
  });
@@ -14855,10 +14856,10 @@ function compareDocumentPosition(nodeA, nodeB) {
14855
14856
  function uniqueSort(nodes) {
14856
14857
  nodes = nodes.filter((node, i2, arr) => !arr.includes(node, i2 + 1));
14857
14858
  nodes.sort((a, b) => {
14858
- const relative6 = compareDocumentPosition(a, b);
14859
- if (relative6 & DocumentPosition.PRECEDING) {
14859
+ const relative7 = compareDocumentPosition(a, b);
14860
+ if (relative7 & DocumentPosition.PRECEDING) {
14860
14861
  return -1;
14861
- } else if (relative6 & DocumentPosition.FOLLOWING) {
14862
+ } else if (relative7 & DocumentPosition.FOLLOWING) {
14862
14863
  return 1;
14863
14864
  }
14864
14865
  return 0;
@@ -15320,8 +15321,8 @@ var init_custom_element_registry = __esm({
15320
15321
  } : (element) => element.localName === localName;
15321
15322
  registry.set(localName, { Class, check });
15322
15323
  if (waiting.has(localName)) {
15323
- for (const resolve38 of waiting.get(localName))
15324
- resolve38(Class);
15324
+ for (const resolve39 of waiting.get(localName))
15325
+ resolve39(Class);
15325
15326
  waiting.delete(localName);
15326
15327
  }
15327
15328
  ownerDocument.querySelectorAll(
@@ -15361,13 +15362,13 @@ var init_custom_element_registry = __esm({
15361
15362
  */
15362
15363
  whenDefined(localName) {
15363
15364
  const { registry, waiting } = this;
15364
- return new Promise((resolve38) => {
15365
+ return new Promise((resolve39) => {
15365
15366
  if (registry.has(localName))
15366
- resolve38(registry.get(localName).Class);
15367
+ resolve39(registry.get(localName).Class);
15367
15368
  else {
15368
15369
  if (!waiting.has(localName))
15369
15370
  waiting.set(localName, []);
15370
- waiting.get(localName).push(resolve38);
15371
+ waiting.get(localName).push(resolve39);
15371
15372
  }
15372
15373
  });
15373
15374
  }
@@ -25730,7 +25731,7 @@ async function pollPageExpression(page, expression, timeoutMs, intervalMs = 100)
25730
25731
  while (Date.now() < deadline) {
25731
25732
  const ready = Boolean(await page.evaluate(expression));
25732
25733
  if (ready) return true;
25733
- await new Promise((resolve38) => setTimeout(resolve38, intervalMs));
25734
+ await new Promise((resolve39) => setTimeout(resolve39, intervalMs));
25734
25735
  }
25735
25736
  return Boolean(await page.evaluate(expression));
25736
25737
  }
@@ -25752,8 +25753,12 @@ async function initializeSession(session) {
25752
25753
  }
25753
25754
  });
25754
25755
  page.on("pageerror", (err) => {
25755
- const text = `[Browser:PAGEERROR] ${err instanceof Error ? err.message : String(err)}`;
25756
- console.error(text);
25756
+ const message = err instanceof Error ? err.message : String(err);
25757
+ const text = `[Browser:PAGEERROR] ${message}`;
25758
+ const isPlayAbort = /^AbortError:/.test(message) && message.includes("play()") && message.includes("pause()");
25759
+ if (!isPlayAbort) {
25760
+ console.error(text);
25761
+ }
25757
25762
  session.browserConsoleBuffer.push(text);
25758
25763
  if (session.browserConsoleBuffer.length > BROWSER_CONSOLE_BUFFER_SIZE) {
25759
25764
  session.browserConsoleBuffer.shift();
@@ -26019,7 +26024,7 @@ var init_frameCapture = __esm({
26019
26024
  // ../engine/src/utils/gpuEncoder.ts
26020
26025
  import { spawn as spawn2 } from "child_process";
26021
26026
  async function detectGpuEncoder() {
26022
- return new Promise((resolve38) => {
26027
+ return new Promise((resolve39) => {
26023
26028
  const ffmpeg = spawn2("ffmpeg", ["-encoders"], {
26024
26029
  stdio: ["pipe", "pipe", "pipe"]
26025
26030
  });
@@ -26028,13 +26033,13 @@ async function detectGpuEncoder() {
26028
26033
  stdout2 += data.toString();
26029
26034
  });
26030
26035
  ffmpeg.on("close", () => {
26031
- if (stdout2.includes("h264_nvenc")) resolve38("nvenc");
26032
- else if (stdout2.includes("h264_videotoolbox")) resolve38("videotoolbox");
26033
- else if (stdout2.includes("h264_vaapi")) resolve38("vaapi");
26034
- else if (stdout2.includes("h264_qsv")) resolve38("qsv");
26035
- else resolve38(null);
26036
+ if (stdout2.includes("h264_nvenc")) resolve39("nvenc");
26037
+ else if (stdout2.includes("h264_videotoolbox")) resolve39("videotoolbox");
26038
+ else if (stdout2.includes("h264_vaapi")) resolve39("vaapi");
26039
+ else if (stdout2.includes("h264_qsv")) resolve39("qsv");
26040
+ else resolve39(null);
26036
26041
  });
26037
- ffmpeg.on("error", () => resolve38(null));
26042
+ ffmpeg.on("error", () => resolve39(null));
26038
26043
  });
26039
26044
  }
26040
26045
  async function getCachedGpuEncoder() {
@@ -26155,7 +26160,7 @@ async function runFfmpeg(args, opts) {
26155
26160
  const signal = opts?.signal;
26156
26161
  const timeout = opts?.timeout ?? DEFAULT_TIMEOUT;
26157
26162
  const onStderr = opts?.onStderr;
26158
- return new Promise((resolve38) => {
26163
+ return new Promise((resolve39) => {
26159
26164
  const ffmpeg = spawn3("ffmpeg", args);
26160
26165
  let stderr = "";
26161
26166
  const onAbort = () => {
@@ -26181,7 +26186,7 @@ async function runFfmpeg(args, opts) {
26181
26186
  ffmpeg.on("close", (code) => {
26182
26187
  clearTimeout(timer);
26183
26188
  if (signal) signal.removeEventListener("abort", onAbort);
26184
- resolve38({
26189
+ resolve39({
26185
26190
  success: !signal?.aborted && code === 0,
26186
26191
  exitCode: code,
26187
26192
  stderr,
@@ -26191,7 +26196,7 @@ async function runFfmpeg(args, opts) {
26191
26196
  ffmpeg.on("error", (err) => {
26192
26197
  clearTimeout(timer);
26193
26198
  if (signal) signal.removeEventListener("abort", onAbort);
26194
- resolve38({
26199
+ resolve39({
26195
26200
  success: false,
26196
26201
  exitCode: null,
26197
26202
  stderr: err.message,
@@ -26383,7 +26388,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
26383
26388
  const inputPath = join20(framesDir, framePattern);
26384
26389
  const inputArgs = ["-framerate", String(options.fps), "-i", inputPath];
26385
26390
  const args = buildEncoderArgs(options, inputArgs, outputPath, gpuEncoder);
26386
- return new Promise((resolve38) => {
26391
+ return new Promise((resolve39) => {
26387
26392
  const ffmpeg = spawn4("ffmpeg", args);
26388
26393
  let stderr = "";
26389
26394
  const onAbort = () => {
@@ -26408,7 +26413,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
26408
26413
  if (signal) signal.removeEventListener("abort", onAbort);
26409
26414
  const durationMs = Date.now() - startTime;
26410
26415
  if (signal?.aborted) {
26411
- resolve38({
26416
+ resolve39({
26412
26417
  success: false,
26413
26418
  outputPath,
26414
26419
  durationMs,
@@ -26419,7 +26424,7 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
26419
26424
  return;
26420
26425
  }
26421
26426
  if (code !== 0) {
26422
- resolve38({
26427
+ resolve39({
26423
26428
  success: false,
26424
26429
  outputPath,
26425
26430
  durationMs,
@@ -26430,12 +26435,12 @@ async function encodeFramesFromDir(framesDir, framePattern, outputPath, options,
26430
26435
  return;
26431
26436
  }
26432
26437
  const fileSize = existsSync17(outputPath) ? statSync4(outputPath).size : 0;
26433
- resolve38({ success: true, outputPath, durationMs, framesEncoded: frameCount, fileSize });
26438
+ resolve39({ success: true, outputPath, durationMs, framesEncoded: frameCount, fileSize });
26434
26439
  });
26435
26440
  ffmpeg.on("error", (err) => {
26436
26441
  clearTimeout(timer);
26437
26442
  if (signal) signal.removeEventListener("abort", onAbort);
26438
- resolve38({
26443
+ resolve39({
26439
26444
  success: false,
26440
26445
  outputPath,
26441
26446
  durationMs: Date.now() - startTime,
@@ -26493,18 +26498,18 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
26493
26498
  let gpuEncoder = null;
26494
26499
  if (options.useGpu) gpuEncoder = await getCachedGpuEncoder();
26495
26500
  const args = buildEncoderArgs(options, inputArgs, chunkPath, gpuEncoder);
26496
- const chunkResult = await new Promise((resolve38) => {
26501
+ const chunkResult = await new Promise((resolve39) => {
26497
26502
  const ffmpeg = spawn4("ffmpeg", args);
26498
26503
  let stderr = "";
26499
26504
  ffmpeg.stderr.on("data", (d) => {
26500
26505
  stderr += d.toString();
26501
26506
  });
26502
26507
  ffmpeg.on("close", (code) => {
26503
- if (code === 0) resolve38({ success: true });
26504
- else resolve38({ success: false, error: `Chunk ${i2} encode failed: ${stderr.slice(-400)}` });
26508
+ if (code === 0) resolve39({ success: true });
26509
+ else resolve39({ success: false, error: `Chunk ${i2} encode failed: ${stderr.slice(-400)}` });
26505
26510
  });
26506
26511
  ffmpeg.on("error", (err) => {
26507
- resolve38({ success: false, error: `Chunk ${i2} encode error: ${err.message}` });
26512
+ resolve39({ success: false, error: `Chunk ${i2} encode error: ${err.message}` });
26508
26513
  });
26509
26514
  });
26510
26515
  if (!chunkResult.success) {
@@ -26534,18 +26539,18 @@ async function encodeFramesChunkedConcat(framesDir, framePattern, outputPath, op
26534
26539
  "-y",
26535
26540
  outputPath
26536
26541
  ];
26537
- const concatResult = await new Promise((resolve38) => {
26542
+ const concatResult = await new Promise((resolve39) => {
26538
26543
  const ffmpeg = spawn4("ffmpeg", concatArgs);
26539
26544
  let stderr = "";
26540
26545
  ffmpeg.stderr.on("data", (d) => {
26541
26546
  stderr += d.toString();
26542
26547
  });
26543
26548
  ffmpeg.on("close", (code) => {
26544
- if (code === 0) resolve38({ success: true });
26545
- else resolve38({ success: false, error: `Chunk concat failed: ${stderr.slice(-400)}` });
26549
+ if (code === 0) resolve39({ success: true });
26550
+ else resolve39({ success: false, error: `Chunk concat failed: ${stderr.slice(-400)}` });
26546
26551
  });
26547
26552
  ffmpeg.on("error", (err) => {
26548
- resolve38({ success: false, error: `Chunk concat error: ${err.message}` });
26553
+ resolve39({ success: false, error: `Chunk concat error: ${err.message}` });
26549
26554
  });
26550
26555
  });
26551
26556
  if (!concatResult.success) {
@@ -26645,37 +26650,37 @@ import { dirname as dirname7 } from "path";
26645
26650
  function createFrameReorderBuffer(startFrame, endFrame) {
26646
26651
  let cursor = startFrame;
26647
26652
  const pending = /* @__PURE__ */ new Map();
26648
- const enqueueAt = (frame, resolve38) => {
26653
+ const enqueueAt = (frame, resolve39) => {
26649
26654
  const list = pending.get(frame);
26650
26655
  if (list === void 0) {
26651
- pending.set(frame, [resolve38]);
26656
+ pending.set(frame, [resolve39]);
26652
26657
  } else {
26653
- list.push(resolve38);
26658
+ list.push(resolve39);
26654
26659
  }
26655
26660
  };
26656
26661
  const flushAt = (frame) => {
26657
26662
  const list = pending.get(frame);
26658
26663
  if (list === void 0) return;
26659
26664
  pending.delete(frame);
26660
- for (const resolve38 of list) resolve38();
26665
+ for (const resolve39 of list) resolve39();
26661
26666
  };
26662
- const waitForFrame = (frame) => new Promise((resolve38) => {
26667
+ const waitForFrame = (frame) => new Promise((resolve39) => {
26663
26668
  if (frame === cursor) {
26664
- resolve38();
26669
+ resolve39();
26665
26670
  return;
26666
26671
  }
26667
- enqueueAt(frame, resolve38);
26672
+ enqueueAt(frame, resolve39);
26668
26673
  });
26669
26674
  const advanceTo = (frame) => {
26670
26675
  cursor = frame;
26671
26676
  flushAt(frame);
26672
26677
  };
26673
- const waitForAllDone = () => new Promise((resolve38) => {
26678
+ const waitForAllDone = () => new Promise((resolve39) => {
26674
26679
  if (cursor >= endFrame) {
26675
- resolve38();
26680
+ resolve39();
26676
26681
  return;
26677
26682
  }
26678
- enqueueAt(endFrame, resolve38);
26683
+ enqueueAt(endFrame, resolve39);
26679
26684
  });
26680
26685
  return { waitForFrame, advanceTo, waitForAllDone };
26681
26686
  }
@@ -26837,7 +26842,7 @@ async function spawnStreamingEncoder(outputPath, options, signal, config) {
26837
26842
  let stderr = "";
26838
26843
  let exitCode = null;
26839
26844
  let exitPromiseResolve = null;
26840
- const exitPromise = new Promise((resolve38) => exitPromiseResolve = resolve38);
26845
+ const exitPromise = new Promise((resolve39) => exitPromiseResolve = resolve39);
26841
26846
  ffmpeg.stderr?.on("data", (data) => {
26842
26847
  stderr += data.toString();
26843
26848
  });
@@ -26883,8 +26888,8 @@ Process error: ${err.message}`;
26883
26888
  if (signal) signal.removeEventListener("abort", onAbort);
26884
26889
  const stdin = ffmpeg.stdin;
26885
26890
  if (stdin && !stdin.destroyed) {
26886
- await new Promise((resolve38) => {
26887
- stdin.end(() => resolve38());
26891
+ await new Promise((resolve39) => {
26892
+ stdin.end(() => resolve39());
26888
26893
  });
26889
26894
  }
26890
26895
  await exitPromise;
@@ -26927,7 +26932,7 @@ import { spawn as spawn6 } from "child_process";
26927
26932
  import { readFileSync as readFileSync15 } from "fs";
26928
26933
  import { extname as extname4 } from "path";
26929
26934
  function runFfprobe(args) {
26930
- return new Promise((resolve38, reject) => {
26935
+ return new Promise((resolve39, reject) => {
26931
26936
  const proc = spawn6("ffprobe", args);
26932
26937
  let stdout2 = "";
26933
26938
  let stderr = "";
@@ -26941,7 +26946,7 @@ function runFfprobe(args) {
26941
26946
  if (code !== 0) {
26942
26947
  reject(new Error(`[FFmpeg] ffprobe exited with code ${code}: ${stderr}`));
26943
26948
  } else {
26944
- resolve38(stdout2);
26949
+ resolve39(stdout2);
26945
26950
  }
26946
26951
  });
26947
26952
  proc.on("error", (err) => {
@@ -27064,6 +27069,7 @@ async function extractMediaMetadata(filePath) {
27064
27069
  videoCodec: "png",
27065
27070
  hasAudio: false,
27066
27071
  isVFR: false,
27072
+ hasAlpha: false,
27067
27073
  colorSpace: stillImageMeta.colorSpace
27068
27074
  };
27069
27075
  }
@@ -27078,6 +27084,9 @@ async function extractMediaMetadata(filePath) {
27078
27084
  const colorSpaceVal = videoStream.color_space || "";
27079
27085
  const ffprobeColorSpace = colorTransfer || colorPrimaries || colorSpaceVal ? { colorTransfer, colorPrimaries, colorSpace: colorSpaceVal } : null;
27080
27086
  const colorSpace = ffprobeColorSpace ?? stillImageMeta?.colorSpace ?? null;
27087
+ const pixelFormat = videoStream.pix_fmt || "";
27088
+ const alphaMode = videoStream.tags?.alpha_mode || "";
27089
+ const hasAlpha = /(^|[^a-z])yuva|rgba|argb|bgra|gbrap|gray[a-z0-9]*a/i.test(pixelFormat) || alphaMode === "1";
27081
27090
  return {
27082
27091
  durationSeconds: output?.format.duration ? parseFloat(output.format.duration) : 0,
27083
27092
  width: videoStream.width || stillImageMeta?.width || 0,
@@ -27086,6 +27095,7 @@ async function extractMediaMetadata(filePath) {
27086
27095
  videoCodec: videoStream.codec_name || "unknown",
27087
27096
  hasAudio: output?.streams.some((s2) => s2.codec_type === "audio") ?? false,
27088
27097
  isVFR,
27098
+ hasAlpha,
27089
27099
  colorSpace
27090
27100
  };
27091
27101
  })();
@@ -27416,6 +27426,7 @@ function parseVideoElements(html) {
27416
27426
  start,
27417
27427
  end,
27418
27428
  mediaStart: mediaStartAttr ? parseFloat(mediaStartAttr) : 0,
27429
+ loop: el.hasAttribute("loop"),
27419
27430
  hasAudio: hasAudioAttr === "true"
27420
27431
  });
27421
27432
  }
@@ -27451,10 +27462,11 @@ function parseImageElements(html) {
27451
27462
  }
27452
27463
  async function extractVideoFramesRange(videoPath, videoId, startTime, duration, options, signal, config, outputDirOverride) {
27453
27464
  const ffmpegProcessTimeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
27454
- const { fps, outputDir, quality = 95, format = "jpg" } = options;
27465
+ const { fps, outputDir, quality = 95 } = options;
27455
27466
  const videoOutputDir = outputDirOverride ?? join23(outputDir, videoId);
27456
27467
  if (!existsSync21(videoOutputDir)) mkdirSync13(videoOutputDir, { recursive: true });
27457
27468
  const metadata = await extractMediaMetadata(videoPath);
27469
+ const format = resolveFrameFormat(metadata, options.format);
27458
27470
  const framePattern = `${FRAME_FILENAME_PREFIX}%05d.${format}`;
27459
27471
  const outputPattern = join23(videoOutputDir, framePattern);
27460
27472
  const isHdr = isHdrColorSpace(metadata.colorSpace);
@@ -27463,6 +27475,9 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
27463
27475
  if (isHdr && isMacOS) {
27464
27476
  args.push("-hwaccel", "videotoolbox");
27465
27477
  }
27478
+ if (metadata.hasAlpha && metadata.videoCodec === "vp9") {
27479
+ args.push("-c:v", "libvpx-vp9");
27480
+ }
27466
27481
  args.push("-ss", String(startTime), "-i", videoPath, "-t", String(duration));
27467
27482
  const vfFilters = [];
27468
27483
  if (isHdr && isMacOS) {
@@ -27473,7 +27488,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
27473
27488
  args.push("-q:v", format === "jpg" ? String(Math.ceil((100 - quality) / 3)) : "0");
27474
27489
  if (format === "png") args.push("-compression_level", "6");
27475
27490
  args.push("-y", outputPattern);
27476
- return new Promise((resolve38, reject) => {
27491
+ return new Promise((resolve39, reject) => {
27477
27492
  const ffmpeg = spawn7("ffmpeg", args);
27478
27493
  let stderr = "";
27479
27494
  const onAbort = () => {
@@ -27508,7 +27523,7 @@ async function extractVideoFramesRange(videoPath, videoId, startTime, duration,
27508
27523
  files.forEach((file, index) => {
27509
27524
  framePaths.set(index, join23(videoOutputDir, file));
27510
27525
  });
27511
- resolve38({
27526
+ resolve39({
27512
27527
  videoId,
27513
27528
  srcPath: videoPath,
27514
27529
  outputDir: videoOutputDir,
@@ -27574,6 +27589,10 @@ function resolveSegmentDuration(requested, mediaStart, metadata) {
27574
27589
  const sourceRemaining = metadata.durationSeconds - mediaStart;
27575
27590
  return sourceRemaining > 0 ? sourceRemaining : metadata.durationSeconds;
27576
27591
  }
27592
+ function resolveFrameFormat(metadata, requested) {
27593
+ if (requested) return requested;
27594
+ return metadata.hasAlpha ? "png" : "jpg";
27595
+ }
27577
27596
  async function convertVfrToCfr(inputPath, outputPath, targetFps, startTime, duration, signal, config) {
27578
27597
  const timeout = config?.ffmpegProcessTimeout ?? DEFAULT_CONFIG2.ffmpegProcessTimeout;
27579
27598
  const args = [
@@ -27766,12 +27785,12 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
27766
27785
  breakdown.vfrPreflightMs = Date.now() - vfrPreflightStart;
27767
27786
  const phase3Start = Date.now();
27768
27787
  const cacheRootDir = config?.extractCacheDir;
27769
- const cacheFormat = options.format ?? "jpg";
27770
27788
  async function tryCachedExtract(video, videoPath, videoDuration, i2) {
27771
27789
  if (!cacheRootDir) return null;
27772
27790
  const keyInput = cacheKeyInputs[i2];
27773
27791
  const probedMeta = videoMetadata[i2];
27774
27792
  if (!keyInput || !probedMeta) return null;
27793
+ const cacheFormat = resolveFrameFormat(probedMeta, options.format);
27775
27794
  const keyDuration = resolveSegmentDuration(
27776
27795
  keyInput.end - keyInput.start,
27777
27796
  keyInput.mediaStart,
@@ -27804,7 +27823,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
27804
27823
  video.id,
27805
27824
  video.mediaStart,
27806
27825
  videoDuration,
27807
- options,
27826
+ { ...options, format: cacheFormat },
27808
27827
  signal,
27809
27828
  config,
27810
27829
  lookup.entry.dir
@@ -27834,7 +27853,7 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
27834
27853
  video.id,
27835
27854
  video.mediaStart,
27836
27855
  videoDuration,
27837
- options,
27856
+ { ...options, format: resolveFrameFormat(probedMeta, options.format) },
27838
27857
  signal,
27839
27858
  config
27840
27859
  );
@@ -27867,10 +27886,17 @@ async function extractAllVideoFrames(videos, baseDir, options, signal, config, c
27867
27886
  phaseBreakdown: breakdown
27868
27887
  };
27869
27888
  }
27870
- function getFrameAtTime(extracted, globalTime, videoStart) {
27871
- const localTime = globalTime - videoStart;
27889
+ function getFrameAtTime(extracted, globalTime, videoStart, loop = false, mediaStart = 0) {
27890
+ let localTime = globalTime - videoStart;
27872
27891
  if (localTime < 0) return null;
27892
+ const loopDuration = Math.max(0, extracted.metadata.durationSeconds - mediaStart);
27893
+ if (loop && loopDuration > 0 && localTime >= loopDuration) {
27894
+ localTime %= loopDuration;
27895
+ }
27873
27896
  const frameIndex = Math.floor(localTime * extracted.fps);
27897
+ if (loop && frameIndex >= extracted.totalFrames && extracted.totalFrames > 0) {
27898
+ return extracted.framePaths.get(extracted.totalFrames - 1) || null;
27899
+ }
27874
27900
  if (frameIndex < 0 || frameIndex >= extracted.totalFrames) return null;
27875
27901
  return extracted.framePaths.get(frameIndex) || null;
27876
27902
  }
@@ -27880,7 +27906,7 @@ function createFrameLookupTable(videos, extracted) {
27880
27906
  for (const ext of extracted) extractedMap.set(ext.videoId, ext);
27881
27907
  for (const video of videos) {
27882
27908
  const ext = extractedMap.get(video.id);
27883
- if (ext) table.addVideo(ext, video.start, video.end, video.mediaStart);
27909
+ if (ext) table.addVideo(ext, video.start, video.end, video.mediaStart, video.loop);
27884
27910
  }
27885
27911
  return table;
27886
27912
  }
@@ -27902,8 +27928,8 @@ var init_videoFrameExtractor = __esm({
27902
27928
  activeVideoIds = /* @__PURE__ */ new Set();
27903
27929
  startCursor = 0;
27904
27930
  lastTime = null;
27905
- addVideo(extracted, start, end, mediaStart) {
27906
- this.videos.set(extracted.videoId, { extracted, start, end, mediaStart });
27931
+ addVideo(extracted, start, end, mediaStart, loop = false) {
27932
+ this.videos.set(extracted.videoId, { extracted, start, end, mediaStart, loop });
27907
27933
  this.orderedVideos = Array.from(this.videos.entries()).map(([videoId, video]) => ({ videoId, ...video })).sort((a, b) => a.start - b.start);
27908
27934
  this.resetActiveState();
27909
27935
  }
@@ -27911,7 +27937,7 @@ var init_videoFrameExtractor = __esm({
27911
27937
  const video = this.videos.get(videoId);
27912
27938
  if (!video) return null;
27913
27939
  if (globalTime < video.start || globalTime >= video.end) return null;
27914
- return getFrameAtTime(video.extracted, globalTime, video.start);
27940
+ return getFrameAtTime(video.extracted, globalTime, video.start, video.loop, video.mediaStart);
27915
27941
  }
27916
27942
  resetActiveState() {
27917
27943
  this.activeVideoIds.clear();
@@ -27960,8 +27986,19 @@ var init_videoFrameExtractor = __esm({
27960
27986
  for (const videoId of this.activeVideoIds) {
27961
27987
  const video = this.videos.get(videoId);
27962
27988
  if (!video) continue;
27963
- const localTime = globalTime - video.start;
27989
+ let localTime = globalTime - video.start;
27990
+ const loopDuration = Math.max(0, video.extracted.metadata.durationSeconds - video.mediaStart);
27991
+ if (video.loop && loopDuration > 0 && localTime >= loopDuration) {
27992
+ localTime %= loopDuration;
27993
+ }
27964
27994
  const frameIndex = Math.floor(localTime * video.extracted.fps);
27995
+ if (video.loop && frameIndex >= video.extracted.totalFrames) {
27996
+ const framePath2 = video.extracted.framePaths.get(video.extracted.totalFrames - 1);
27997
+ if (framePath2) {
27998
+ frames.set(videoId, { framePath: framePath2, frameIndex: video.extracted.totalFrames - 1 });
27999
+ }
28000
+ continue;
28001
+ }
27965
28002
  if (frameIndex < 0 || frameIndex >= video.extracted.totalFrames) continue;
27966
28003
  const framePath = video.extracted.framePaths.get(frameIndex);
27967
28004
  if (!framePath) continue;
@@ -28893,11 +28930,11 @@ function createFileServer(options) {
28893
28930
  headers: { "Content-Type": contentType }
28894
28931
  });
28895
28932
  });
28896
- return new Promise((resolve38) => {
28933
+ return new Promise((resolve39) => {
28897
28934
  const server = serve({ fetch: app.fetch, port }, (info) => {
28898
28935
  const actualPort = info.port;
28899
28936
  const url = `http://localhost:${actualPort}`;
28900
- resolve38({
28937
+ resolve39({
28901
28938
  url,
28902
28939
  port: actualPort,
28903
28940
  close: () => server.close()
@@ -30522,6 +30559,7 @@ async function compileHtml(rawHtml, projectDir, probeMediaDuration) {
30522
30559
  const clampList = [];
30523
30560
  for (const el of preResolved) {
30524
30561
  if (!el.src) continue;
30562
+ if (el.loop) continue;
30525
30563
  const src = resolveMediaSrc(el.src, projectDir);
30526
30564
  const fileDuration = await probeMediaDuration(src);
30527
30565
  if (fileDuration <= 0) continue;
@@ -31296,13 +31334,13 @@ function createFileServer2(options) {
31296
31334
  let filePath = null;
31297
31335
  if (compiledDir) {
31298
31336
  const candidate = join29(compiledDir, relativePath);
31299
- if (existsSync28(candidate) && isPathInside(candidate, compiledDir, { resolveSymlinks: true }) && statSync8(candidate).isFile()) {
31337
+ if (existsSync28(candidate) && isPathInside(candidate, compiledDir) && statSync8(candidate).isFile()) {
31300
31338
  filePath = candidate;
31301
31339
  }
31302
31340
  }
31303
31341
  if (!filePath) {
31304
31342
  const candidate = join29(projectDir, relativePath);
31305
- if (existsSync28(candidate) && isPathInside(candidate, projectDir, { resolveSymlinks: true }) && statSync8(candidate).isFile()) {
31343
+ if (existsSync28(candidate) && isPathInside(candidate, projectDir) && statSync8(candidate).isFile()) {
31306
31344
  filePath = candidate;
31307
31345
  }
31308
31346
  }
@@ -31330,10 +31368,10 @@ function createFileServer2(options) {
31330
31368
  headers: { "Content-Type": contentType }
31331
31369
  });
31332
31370
  });
31333
- return new Promise((resolve38) => {
31371
+ return new Promise((resolve39) => {
31334
31372
  const connections = /* @__PURE__ */ new Set();
31335
31373
  const server = serve2({ fetch: app.fetch, port }, (info) => {
31336
- resolve38({
31374
+ resolve39({
31337
31375
  url: `http://localhost:${info.port}`,
31338
31376
  port: info.port,
31339
31377
  close: () => {
@@ -32195,7 +32233,7 @@ async function compileHtmlFile(html, baseDir, downloadDir) {
32195
32233
  let compiledHtml = resolutions.length > 0 ? injectDurations(staticCompiled, resolutions) : staticCompiled;
32196
32234
  const preResolved = extractResolvedMedia(compiledHtml);
32197
32235
  const clampResults = await Promise.all(
32198
- preResolved.filter((el) => !!el.src).map(async (el) => {
32236
+ preResolved.filter((el) => !!el.src && !el.loop).map(async (el) => {
32199
32237
  const { duration: maxDuration } = await resolveMediaDuration(
32200
32238
  el.src,
32201
32239
  el.mediaStart,
@@ -32803,6 +32841,7 @@ async function discoverMediaFromBrowser(page) {
32803
32841
  const end = parseFloat(htmlEl.getAttribute("data-end") || "0");
32804
32842
  const duration = parseFloat(htmlEl.getAttribute("data-duration") || "0");
32805
32843
  const mediaStart = parseFloat(htmlEl.getAttribute("data-media-start") || "0");
32844
+ const loop = htmlEl.hasAttribute("loop");
32806
32845
  const hasAudio = htmlEl.getAttribute("data-has-audio") === "true";
32807
32846
  const volume = parseFloat(htmlEl.getAttribute("data-volume") || "1");
32808
32847
  results.push({
@@ -32813,6 +32852,7 @@ async function discoverMediaFromBrowser(page) {
32813
32852
  end,
32814
32853
  duration,
32815
32854
  mediaStart,
32855
+ loop,
32816
32856
  hasAudio,
32817
32857
  volume
32818
32858
  });
@@ -33728,6 +33768,9 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
33728
33768
  if (el.hasAudio && !existing.hasAudio) {
33729
33769
  existing.hasAudio = true;
33730
33770
  }
33771
+ if (el.loop && !existing.loop) {
33772
+ existing.loop = true;
33773
+ }
33731
33774
  }
33732
33775
  } else {
33733
33776
  composition.videos.push({
@@ -33736,6 +33779,7 @@ async function executeRenderJob(job, projectDir, outputPath, onProgress, abortSi
33736
33779
  start: el.start,
33737
33780
  end: el.end,
33738
33781
  mediaStart: el.mediaStart,
33782
+ loop: el.loop,
33739
33783
  hasAudio: el.hasAudio
33740
33784
  });
33741
33785
  existingVideoIds.add(el.id);
@@ -35018,10 +35062,10 @@ var init_semaphore = __esm({
35018
35062
  this.active++;
35019
35063
  return () => this.release();
35020
35064
  }
35021
- return new Promise((resolve38) => {
35065
+ return new Promise((resolve39) => {
35022
35066
  this.queue.push(() => {
35023
35067
  this.active++;
35024
- resolve38(() => this.release());
35068
+ resolve39(() => this.release());
35025
35069
  });
35026
35070
  });
35027
35071
  }
@@ -35576,18 +35620,38 @@ var init_src3 = __esm({
35576
35620
  // src/server/studioServer.ts
35577
35621
  var studioServer_exports = {};
35578
35622
  __export(studioServer_exports, {
35579
- createStudioServer: () => createStudioServer
35623
+ createStudioServer: () => createStudioServer,
35624
+ resolveStudioBundle: () => resolveStudioBundle
35580
35625
  });
35581
35626
  import { Hono as Hono5 } from "hono";
35582
35627
  import { streamSSE as streamSSE3 } from "hono/streaming";
35583
35628
  import { existsSync as existsSync34, readFileSync as readFileSync24, writeFileSync as writeFileSync14, statSync as statSync12 } from "fs";
35584
35629
  import { resolve as resolve20, join as join36, basename as basename3 } from "path";
35585
35630
  function resolveDistDir() {
35631
+ return resolveStudioBundle().dir;
35632
+ }
35633
+ function resolveStudioBundle() {
35586
35634
  const builtPath = resolve20(__dirname, "studio");
35587
- if (existsSync34(resolve20(builtPath, "index.html"))) return builtPath;
35635
+ const builtIndex = resolve20(builtPath, "index.html");
35636
+ if (existsSync34(builtIndex)) {
35637
+ return { dir: builtPath, indexPath: builtIndex, available: true, checkedPaths: [builtIndex] };
35638
+ }
35588
35639
  const devPath = resolve20(__dirname, "..", "..", "..", "studio", "dist");
35589
- if (existsSync34(resolve20(devPath, "index.html"))) return devPath;
35590
- return builtPath;
35640
+ const devIndex = resolve20(devPath, "index.html");
35641
+ if (existsSync34(devIndex)) {
35642
+ return {
35643
+ dir: devPath,
35644
+ indexPath: devIndex,
35645
+ available: true,
35646
+ checkedPaths: [builtIndex, devIndex]
35647
+ };
35648
+ }
35649
+ return {
35650
+ dir: builtPath,
35651
+ indexPath: builtIndex,
35652
+ available: false,
35653
+ checkedPaths: [builtIndex, devIndex]
35654
+ };
35591
35655
  }
35592
35656
  function resolveRuntimePath() {
35593
35657
  const builtPath = resolve20(__dirname, "hyperframe-runtime.js");
@@ -35833,7 +35897,60 @@ function createStudioServer(options) {
35833
35897
  app.get("*", (c2) => {
35834
35898
  const indexPath = resolve20(studioDir, "index.html");
35835
35899
  if (!existsSync34(indexPath)) {
35836
- return c2.text("Studio not found. Rebuild with: pnpm run build", 500);
35900
+ return c2.html(
35901
+ `<!doctype html>
35902
+ <html>
35903
+ <head>
35904
+ <meta charset="utf-8" />
35905
+ <meta name="viewport" content="width=device-width, initial-scale=1" />
35906
+ <title>HyperFrames Studio unavailable</title>
35907
+ <style>
35908
+ body {
35909
+ margin: 0;
35910
+ min-height: 100vh;
35911
+ display: grid;
35912
+ place-items: center;
35913
+ background: #0d0f14;
35914
+ color: #eef2f7;
35915
+ font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
35916
+ }
35917
+ main {
35918
+ width: min(560px, calc(100vw - 48px));
35919
+ border: 1px solid rgba(255, 255, 255, 0.14);
35920
+ border-radius: 8px;
35921
+ padding: 28px;
35922
+ background: #151923;
35923
+ }
35924
+ h1 {
35925
+ margin: 0 0 12px;
35926
+ font-size: 22px;
35927
+ line-height: 1.2;
35928
+ }
35929
+ p {
35930
+ margin: 0 0 18px;
35931
+ color: #aab3c2;
35932
+ line-height: 1.5;
35933
+ }
35934
+ code {
35935
+ display: block;
35936
+ padding: 12px 14px;
35937
+ border-radius: 6px;
35938
+ background: #090b10;
35939
+ color: #8ff0c2;
35940
+ overflow-wrap: anywhere;
35941
+ }
35942
+ </style>
35943
+ </head>
35944
+ <body>
35945
+ <main>
35946
+ <h1>Studio bundle missing</h1>
35947
+ <p>The preview server started, but this CLI build does not contain the Studio assets.</p>
35948
+ <code>pnpm run build</code>
35949
+ </main>
35950
+ </body>
35951
+ </html>`,
35952
+ 500
35953
+ );
35837
35954
  }
35838
35955
  return c2.html(readFileSync24(indexPath, "utf-8"));
35839
35956
  });
@@ -35931,8 +36048,8 @@ async function runDevMode(dir, projectName) {
35931
36048
  }
35932
36049
  });
35933
36050
  }
35934
- return new Promise((resolve38) => {
35935
- child.on("close", () => resolve38());
36051
+ return new Promise((resolve39) => {
36052
+ child.on("close", () => resolve39());
35936
36053
  });
35937
36054
  }
35938
36055
  function hasLocalStudio(dir) {
@@ -36002,17 +36119,31 @@ async function runLocalStudioMode(dir, projectName) {
36002
36119
  }
36003
36120
  });
36004
36121
  }
36005
- return new Promise((resolve38) => {
36006
- child.on("close", () => resolve38());
36122
+ return new Promise((resolve39) => {
36123
+ child.on("close", () => resolve39());
36007
36124
  });
36008
36125
  }
36009
36126
  async function runEmbeddedMode(dir, startPort, projectName, forceNew = false) {
36010
- const { createStudioServer: createStudioServer2 } = await Promise.resolve().then(() => (init_studioServer(), studioServer_exports));
36127
+ const { createStudioServer: createStudioServer2, resolveStudioBundle: resolveStudioBundle2 } = await Promise.resolve().then(() => (init_studioServer(), studioServer_exports));
36011
36128
  const pName = projectName ?? basename4(dir);
36012
- const { app } = createStudioServer2({ projectDir: dir, projectName: pName });
36129
+ const studioBundle = resolveStudioBundle2();
36013
36130
  Wt2(c.bold("hyperframes preview"));
36014
36131
  const s2 = be();
36015
36132
  s2.start("Starting studio...");
36133
+ if (!studioBundle.available) {
36134
+ s2.stop(c.error("Studio build missing"));
36135
+ console.error();
36136
+ console.error(` ${c.dim("Could not find")} ${c.accent("index.html")} ${c.dim("in:")}`);
36137
+ for (const checkedPath of studioBundle.checkedPaths) {
36138
+ console.error(` ${c.dim("-")} ${checkedPath}`);
36139
+ }
36140
+ console.error();
36141
+ console.error(` ${c.dim("Rebuild the CLI package with")} ${c.accent("pnpm run build")}`);
36142
+ console.error();
36143
+ process.exitCode = 1;
36144
+ return;
36145
+ }
36146
+ const { app } = createStudioServer2({ projectDir: dir, projectName: pName });
36016
36147
  let result;
36017
36148
  try {
36018
36149
  result = await findPortAndServe(app.fetch, startPort, dir, forceNew);
@@ -36056,7 +36187,29 @@ async function runEmbeddedMode(dir, startPort, projectName, forceNew = false) {
36056
36187
  console.log();
36057
36188
  import("open").then((mod) => mod.default(`${url}#project/${pName}`)).catch(() => {
36058
36189
  });
36059
- return new Promise(() => {
36190
+ let rl;
36191
+ if (process.platform === "win32") {
36192
+ const readline = await import("readline");
36193
+ rl = readline.createInterface({ input: process.stdin, output: process.stdout });
36194
+ rl.on("SIGINT", () => {
36195
+ process.emit("SIGINT", "SIGINT");
36196
+ });
36197
+ }
36198
+ return new Promise((resolveRun) => {
36199
+ let shuttingDown = false;
36200
+ const shutdown = () => {
36201
+ if (shuttingDown) return;
36202
+ shuttingDown = true;
36203
+ process.off("SIGINT", shutdown);
36204
+ process.off("SIGTERM", shutdown);
36205
+ rl?.close();
36206
+ console.log();
36207
+ console.log(` ${c.dim("Shutting down studio...")}`);
36208
+ result.server.close(() => resolveRun());
36209
+ setTimeout(() => process.exit(0), 2e3).unref();
36210
+ };
36211
+ process.once("SIGINT", shutdown);
36212
+ process.once("SIGTERM", shutdown);
36060
36213
  });
36061
36214
  }
36062
36215
  var examples, preview_default;
@@ -38424,6 +38577,558 @@ var init_lint3 = __esm({
38424
38577
  }
38425
38578
  });
38426
38579
 
38580
+ // src/utils/layoutAudit.ts
38581
+ function buildLayoutSampleTimes({ duration, samples, at: at2 }) {
38582
+ if (at2?.length) {
38583
+ return uniqueSortedTimes(
38584
+ at2.filter(
38585
+ (time) => Number.isFinite(time) && time >= 0 && (duration <= 0 || time <= duration)
38586
+ )
38587
+ );
38588
+ }
38589
+ if (!Number.isFinite(duration) || duration <= 0 || samples <= 0) return [];
38590
+ const count = Math.max(1, Math.floor(samples));
38591
+ return Array.from({ length: count }, (_2, index) => roundTime((index + 0.5) / count * duration));
38592
+ }
38593
+ function summarizeLayoutIssues(issues) {
38594
+ const errorCount = issues.filter((issue) => issue.severity === "error").length;
38595
+ const warningCount = issues.filter((issue) => issue.severity === "warning").length;
38596
+ const infoCount = issues.filter((issue) => issue.severity === "info").length;
38597
+ return {
38598
+ ok: errorCount === 0,
38599
+ errorCount,
38600
+ warningCount,
38601
+ infoCount,
38602
+ issueCount: issues.length
38603
+ };
38604
+ }
38605
+ function formatLayoutIssue(issue) {
38606
+ const timeLabel = issue.occurrences && issue.occurrences > 1 ? `t=${formatNumber(issue.firstSeen ?? issue.time)}-${formatNumber(issue.lastSeen ?? issue.time)}s (${issue.occurrences} samples)` : `t=${formatNumber(issue.time)}s`;
38607
+ const parts = [
38608
+ timeLabel,
38609
+ issue.code,
38610
+ issue.selector,
38611
+ issue.containerSelector ? `inside ${issue.containerSelector}` : "",
38612
+ issue.overflow ? `overflowed ${formatOverflow(issue.overflow)}` : "",
38613
+ issue.text ? quoteText(issue.text) : ""
38614
+ ].filter(Boolean);
38615
+ const line = `${parts.join(" ")} \u2014 ${issue.message}`;
38616
+ return issue.fixHint ? `${line}
38617
+ Fix: ${issue.fixHint}` : line;
38618
+ }
38619
+ function dedupeLayoutIssues(issues) {
38620
+ const seen = /* @__PURE__ */ new Set();
38621
+ const result = [];
38622
+ for (const issue of issues) {
38623
+ const key2 = [
38624
+ issue.code,
38625
+ issue.severity,
38626
+ issue.time.toFixed(3),
38627
+ issue.selector,
38628
+ issue.containerSelector ?? "",
38629
+ issue.text ?? "",
38630
+ issue.overflow ? formatOverflow(issue.overflow) : ""
38631
+ ].join("|");
38632
+ if (seen.has(key2)) continue;
38633
+ seen.add(key2);
38634
+ result.push(issue);
38635
+ }
38636
+ return result;
38637
+ }
38638
+ function collapseStaticLayoutIssues(issues) {
38639
+ const groups = /* @__PURE__ */ new Map();
38640
+ for (const issue of issues) {
38641
+ const key2 = staticIssueKey(issue);
38642
+ const existing = groups.get(key2);
38643
+ if (!existing) {
38644
+ groups.set(key2, {
38645
+ issue,
38646
+ firstSeen: issue.time,
38647
+ lastSeen: issue.time,
38648
+ occurrences: 1
38649
+ });
38650
+ continue;
38651
+ }
38652
+ existing.firstSeen = Math.min(existing.firstSeen, issue.time);
38653
+ existing.lastSeen = Math.max(existing.lastSeen, issue.time);
38654
+ existing.occurrences += 1;
38655
+ }
38656
+ return [...groups.values()].map(({ issue, firstSeen, lastSeen, occurrences }) => ({
38657
+ ...issue,
38658
+ time: firstSeen,
38659
+ firstSeen,
38660
+ lastSeen,
38661
+ occurrences
38662
+ }));
38663
+ }
38664
+ function limitLayoutIssues(issues, maxIssues) {
38665
+ const limit = Math.max(1, Math.floor(maxIssues));
38666
+ const sortedIssues = [...issues].sort((a, b) => {
38667
+ const severityDelta = severityRank(a.severity) - severityRank(b.severity);
38668
+ if (severityDelta !== 0) return severityDelta;
38669
+ return a.time - b.time;
38670
+ });
38671
+ return {
38672
+ issues: sortedIssues.slice(0, limit),
38673
+ totalIssueCount: issues.length,
38674
+ truncated: issues.length > limit
38675
+ };
38676
+ }
38677
+ function severityRank(severity) {
38678
+ if (severity === "error") return 0;
38679
+ if (severity === "warning") return 1;
38680
+ return 2;
38681
+ }
38682
+ function staticIssueKey(issue) {
38683
+ return [
38684
+ issue.code,
38685
+ issue.severity,
38686
+ issue.selector,
38687
+ issue.containerSelector ?? "",
38688
+ issue.text ?? "",
38689
+ issue.overflow ? formatOverflow(issue.overflow) : ""
38690
+ ].join("|");
38691
+ }
38692
+ function uniqueSortedTimes(times) {
38693
+ const rounded = times.map(roundTime);
38694
+ return [...new Set(rounded)].sort((a, b) => a - b);
38695
+ }
38696
+ function formatOverflow(overflow) {
38697
+ return ["left", "right", "top", "bottom"].flatMap((side) => {
38698
+ const value = overflow[side];
38699
+ return value == null ? [] : `${side} ${formatNumber(value)}px`;
38700
+ }).join(", ");
38701
+ }
38702
+ function quoteText(text) {
38703
+ const normalized = text.replace(/\s+/g, " ").trim();
38704
+ const truncated = normalized.length > 80 ? `${normalized.slice(0, 77)}...` : normalized;
38705
+ return `"${truncated}"`;
38706
+ }
38707
+ function formatNumber(value) {
38708
+ return Number.isInteger(value) ? String(value) : value.toFixed(2).replace(/0+$/, "").replace(/\.$/, "");
38709
+ }
38710
+ function roundTime(value) {
38711
+ return Math.round(value * 1e3) / 1e3;
38712
+ }
38713
+ var init_layoutAudit = __esm({
38714
+ "src/utils/layoutAudit.ts"() {
38715
+ "use strict";
38716
+ }
38717
+ });
38718
+
38719
+ // src/commands/layout.ts
38720
+ var layout_exports = {};
38721
+ __export(layout_exports, {
38722
+ createInspectCommand: () => createInspectCommand,
38723
+ default: () => layout_default,
38724
+ examples: () => examples9
38725
+ });
38726
+ import { createServer } from "http";
38727
+ import { existsSync as existsSync41, readFileSync as readFileSync29 } from "fs";
38728
+ import { dirname as dirname17, isAbsolute as isAbsolute6, join as join42, relative as relative5, resolve as resolve29 } from "path";
38729
+ import { fileURLToPath as fileURLToPath6 } from "url";
38730
+ async function getCompositionDuration2(page) {
38731
+ return page.evaluate(() => {
38732
+ const win = window;
38733
+ if (typeof win.__hf?.duration === "number" && win.__hf.duration > 0) return win.__hf.duration;
38734
+ const playerDuration = win.__player?.duration;
38735
+ if (typeof playerDuration === "function") return playerDuration();
38736
+ if (typeof playerDuration === "number" && playerDuration > 0) return playerDuration;
38737
+ const root = document.querySelector("[data-composition-id][data-duration]");
38738
+ const attrDuration = root ? parseFloat(root.getAttribute("data-duration") ?? "0") : 0;
38739
+ if (attrDuration > 0) return attrDuration;
38740
+ const timelines = win.__timelines;
38741
+ if (timelines) {
38742
+ for (const timeline of Object.values(timelines)) {
38743
+ const duration = timeline.duration;
38744
+ if (typeof duration === "function") return duration();
38745
+ if (typeof duration === "number" && duration > 0) return duration;
38746
+ }
38747
+ }
38748
+ return 0;
38749
+ });
38750
+ }
38751
+ async function seekTo(page, time) {
38752
+ await page.evaluate((t3) => {
38753
+ const win = window;
38754
+ if (typeof win.__hf?.seek === "function") {
38755
+ win.__hf.seek(t3);
38756
+ return;
38757
+ }
38758
+ if (typeof win.__player?.seek === "function") {
38759
+ win.__player.seek(t3);
38760
+ return;
38761
+ }
38762
+ const timelines = win.__timelines;
38763
+ if (timelines) {
38764
+ for (const timeline of Object.values(timelines)) {
38765
+ if (typeof timeline.pause === "function") timeline.pause();
38766
+ if (typeof timeline.seek === "function") timeline.seek(t3);
38767
+ }
38768
+ }
38769
+ }, time);
38770
+ await page.evaluate(
38771
+ () => new Promise(
38772
+ (resolveFrame) => requestAnimationFrame(() => requestAnimationFrame(() => resolveFrame()))
38773
+ )
38774
+ );
38775
+ await page.evaluate(() => {
38776
+ const fonts = document.fonts;
38777
+ if (!fonts?.ready) return Promise.resolve();
38778
+ return Promise.race([
38779
+ fonts.ready.then(() => void 0),
38780
+ new Promise((resolve39) => setTimeout(resolve39, 500))
38781
+ ]);
38782
+ }).catch(() => {
38783
+ });
38784
+ await new Promise((resolveSettle) => setTimeout(resolveSettle, SEEK_SETTLE_MS));
38785
+ }
38786
+ async function bundleProjectHtml(projectDir) {
38787
+ const { bundleToSingleHtml: bundleToSingleHtml2 } = await Promise.resolve().then(() => (init_compiler(), compiler_exports));
38788
+ let html = await bundleToSingleHtml2(projectDir);
38789
+ const runtimePath = resolve29(
38790
+ __dirname2,
38791
+ "..",
38792
+ "..",
38793
+ "..",
38794
+ "core",
38795
+ "dist",
38796
+ "hyperframe.runtime.iife.js"
38797
+ );
38798
+ if (existsSync41(runtimePath)) {
38799
+ const runtimeSource = readFileSync29(runtimePath, "utf-8");
38800
+ html = html.replace(
38801
+ /<script[^>]*data-hyperframes-preview-runtime[^>]*src="[^"]*"[^>]*><\/script>/,
38802
+ () => `<script data-hyperframes-preview-runtime="1">${runtimeSource}</script>`
38803
+ );
38804
+ }
38805
+ return html;
38806
+ }
38807
+ async function serveProject(projectDir, html) {
38808
+ const { getMimeType: getMimeType2 } = await Promise.resolve().then(() => (init_studio_api(), studio_api_exports));
38809
+ const server = createServer((req, res) => {
38810
+ const url = req.url ?? "/";
38811
+ if (url === "/" || url === "/index.html") {
38812
+ res.writeHead(200, { "Content-Type": "text/html" });
38813
+ res.end(html);
38814
+ return;
38815
+ }
38816
+ const filePath = resolve29(projectDir, decodeURIComponent(url).replace(/^\//, ""));
38817
+ const rel = relative5(projectDir, filePath);
38818
+ if (rel.startsWith("..") || isAbsolute6(rel)) {
38819
+ res.writeHead(403);
38820
+ res.end();
38821
+ return;
38822
+ }
38823
+ if (existsSync41(filePath)) {
38824
+ res.writeHead(200, { "Content-Type": getMimeType2(filePath) });
38825
+ res.end(readFileSync29(filePath));
38826
+ return;
38827
+ }
38828
+ res.writeHead(404);
38829
+ res.end();
38830
+ });
38831
+ const port = await new Promise((resolvePort, rejectPort) => {
38832
+ server.on("error", rejectPort);
38833
+ server.listen(0, () => {
38834
+ const addr = server.address();
38835
+ const resolvedPort = typeof addr === "object" && addr ? addr.port : 0;
38836
+ if (!resolvedPort) rejectPort(new Error("Failed to bind local layout audit server"));
38837
+ else resolvePort(resolvedPort);
38838
+ });
38839
+ });
38840
+ return {
38841
+ url: `http://127.0.0.1:${port}/`,
38842
+ close: () => new Promise((resolveClose) => {
38843
+ server.close(() => resolveClose());
38844
+ })
38845
+ };
38846
+ }
38847
+ async function alignViewportToComposition(page, url) {
38848
+ const size = await page.evaluate(() => {
38849
+ const root = document.querySelector("[data-composition-id][data-width][data-height]");
38850
+ const width = root ? parseInt(root.getAttribute("data-width") ?? "", 10) : 0;
38851
+ const height = root ? parseInt(root.getAttribute("data-height") ?? "", 10) : 0;
38852
+ return {
38853
+ width: Number.isFinite(width) && width > 0 ? Math.min(width, 4096) : 1920,
38854
+ height: Number.isFinite(height) && height > 0 ? Math.min(height, 4096) : 1080
38855
+ };
38856
+ });
38857
+ await page.setViewport(size);
38858
+ await page.goto(url, { waitUntil: "domcontentloaded", timeout: 1e4 });
38859
+ }
38860
+ async function runLayoutAudit(projectDir, opts) {
38861
+ const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
38862
+ const puppeteer = await import("puppeteer-core");
38863
+ const html = await bundleProjectHtml(projectDir);
38864
+ const server = await serveProject(projectDir, html);
38865
+ let chromeBrowser;
38866
+ try {
38867
+ const browser = await ensureBrowser2();
38868
+ chromeBrowser = await puppeteer.default.launch({
38869
+ headless: true,
38870
+ executablePath: browser.executablePath,
38871
+ args: [
38872
+ "--no-sandbox",
38873
+ "--disable-gpu",
38874
+ "--disable-dev-shm-usage",
38875
+ "--enable-webgl",
38876
+ "--use-gl=angle",
38877
+ "--use-angle=swiftshader"
38878
+ ]
38879
+ });
38880
+ const page = await chromeBrowser.newPage();
38881
+ await page.setViewport({ width: 1920, height: 1080 });
38882
+ await page.goto(server.url, { waitUntil: "domcontentloaded", timeout: 1e4 });
38883
+ await alignViewportToComposition(page, server.url);
38884
+ await page.waitForFunction(() => !!window.__timelines, {
38885
+ timeout: opts.timeout
38886
+ }).catch(() => {
38887
+ });
38888
+ await page.evaluate(() => {
38889
+ const fonts = document.fonts;
38890
+ if (!fonts?.ready) return Promise.resolve();
38891
+ return Promise.race([
38892
+ fonts.ready.then(() => void 0),
38893
+ new Promise((resolve39) => setTimeout(resolve39, 750))
38894
+ ]);
38895
+ }).catch(() => {
38896
+ });
38897
+ await new Promise((resolveSettle) => setTimeout(resolveSettle, 250));
38898
+ const duration = await getCompositionDuration2(page);
38899
+ const samples = buildLayoutSampleTimes({ duration, samples: opts.samples, at: opts.at });
38900
+ if (samples.length === 0) return { duration, samples, rawIssues: [] };
38901
+ await page.addScriptTag({ content: loadLayoutAuditScript() });
38902
+ const issues = [];
38903
+ for (const time of samples) {
38904
+ await seekTo(page, time);
38905
+ const sampleIssues = await page.evaluate(
38906
+ (auditOptions) => {
38907
+ const win = window;
38908
+ return win.__hyperframesLayoutAudit?.(auditOptions) ?? [];
38909
+ },
38910
+ { time, tolerance: opts.tolerance }
38911
+ );
38912
+ issues.push(...sampleIssues);
38913
+ }
38914
+ return {
38915
+ duration,
38916
+ samples,
38917
+ rawIssues: dedupeLayoutIssues(issues)
38918
+ };
38919
+ } finally {
38920
+ await chromeBrowser?.close().catch(() => {
38921
+ });
38922
+ await server.close();
38923
+ }
38924
+ }
38925
+ function loadLayoutAuditScript() {
38926
+ const candidates = [
38927
+ join42(__dirname2, "layout-audit.browser.js"),
38928
+ join42(__dirname2, "commands", "layout-audit.browser.js")
38929
+ ];
38930
+ for (const candidate of candidates) {
38931
+ if (existsSync41(candidate)) return readFileSync29(candidate, "utf-8");
38932
+ }
38933
+ throw new Error("Missing layout audit browser script");
38934
+ }
38935
+ function parseAt(value) {
38936
+ if (!value) return void 0;
38937
+ const times = String(value).split(",").map((entry) => parseFloat(entry.trim())).filter((time) => Number.isFinite(time) && time >= 0);
38938
+ return times.length > 0 ? times : void 0;
38939
+ }
38940
+ function createInspectCommand(commandName) {
38941
+ return defineCommand({
38942
+ meta: {
38943
+ name: commandName,
38944
+ description: "Inspect rendered composition layout for text and container overflow"
38945
+ },
38946
+ args: {
38947
+ dir: { type: "positional", description: "Project directory", required: false },
38948
+ json: { type: "boolean", description: "Output agent-readable JSON", default: false },
38949
+ samples: {
38950
+ type: "string",
38951
+ description: "Number of midpoint samples across the duration (default: 9)",
38952
+ default: "9"
38953
+ },
38954
+ at: {
38955
+ type: "string",
38956
+ description: "Comma-separated timestamps in seconds (e.g., --at 1.5,4,7.25)"
38957
+ },
38958
+ tolerance: {
38959
+ type: "string",
38960
+ description: "Allowed pixel overflow before reporting an issue (default: 2)",
38961
+ default: "2"
38962
+ },
38963
+ timeout: {
38964
+ type: "string",
38965
+ description: "Ms to wait for runtime to initialize (default: 5000)",
38966
+ default: "5000"
38967
+ },
38968
+ "max-issues": {
38969
+ type: "string",
38970
+ description: "Maximum issues to print or return after static collapse (default: 80)",
38971
+ default: "80"
38972
+ },
38973
+ "collapse-static": {
38974
+ type: "boolean",
38975
+ description: "Collapse repeated static issues across samples (default: true)",
38976
+ default: true
38977
+ },
38978
+ strict: {
38979
+ type: "boolean",
38980
+ description: "Exit non-zero on warnings too",
38981
+ default: false
38982
+ }
38983
+ },
38984
+ async run({ args }) {
38985
+ const project = resolveProject(args.dir);
38986
+ const samples = Math.max(1, parseInt(args.samples, 10) || 9);
38987
+ const tolerance = Math.max(0, parseFloat(args.tolerance) || 2);
38988
+ const timeout = Math.max(500, parseInt(args.timeout, 10) || 5e3);
38989
+ const maxIssues = Math.max(1, parseInt(args["max-issues"], 10) || 80);
38990
+ const at2 = parseAt(args.at);
38991
+ const strict = !!args.strict;
38992
+ const collapseStatic = args["collapse-static"] !== false;
38993
+ if (!args.json) {
38994
+ const sampleLabel = at2 ? `${at2.length} explicit timestamp(s)` : `${samples} timeline samples`;
38995
+ console.log(
38996
+ `${c.accent("\u25C6")} Inspecting layout for ${c.accent(project.name)} (${sampleLabel})`
38997
+ );
38998
+ }
38999
+ try {
39000
+ const result = await runLayoutAudit(project.dir, {
39001
+ samples,
39002
+ at: at2,
39003
+ timeout,
39004
+ tolerance
39005
+ });
39006
+ const allIssues = collapseStatic ? collapseStaticLayoutIssues(result.rawIssues) : result.rawIssues;
39007
+ const limited = limitLayoutIssues(allIssues, maxIssues);
39008
+ const summary = summarizeLayoutIssues(allIssues);
39009
+ const ok = summary.errorCount === 0 && (!strict || summary.warningCount === 0);
39010
+ if (args.json) {
39011
+ console.log(
39012
+ JSON.stringify(
39013
+ withMeta({
39014
+ schemaVersion: INSPECT_SCHEMA_VERSION,
39015
+ duration: result.duration,
39016
+ samples: result.samples,
39017
+ tolerance,
39018
+ strict,
39019
+ collapseStatic,
39020
+ ...summary,
39021
+ totalIssueCount: limited.totalIssueCount,
39022
+ truncated: limited.truncated,
39023
+ ok,
39024
+ issues: limited.issues
39025
+ }),
39026
+ null,
39027
+ 2
39028
+ )
39029
+ );
39030
+ process.exit(ok ? 0 : 1);
39031
+ }
39032
+ if (result.samples.length === 0) {
39033
+ console.log();
39034
+ console.log(
39035
+ `${c.error("\u2717")} Could not determine composition duration \u2014 no layout samples run`
39036
+ );
39037
+ process.exit(1);
39038
+ }
39039
+ console.log();
39040
+ if (limited.issues.length === 0) {
39041
+ console.log(
39042
+ `${c.success("\u25C7")} 0 layout issues across ${result.samples.length} sample(s)`
39043
+ );
39044
+ return;
39045
+ }
39046
+ for (const issue of limited.issues) {
39047
+ const icon = issue.severity === "error" ? c.error("\u2717") : issue.severity === "warning" ? c.warn("\u26A0") : c.dim("\u2139");
39048
+ const formatted = formatLayoutIssue(issue).replace(/\n/g, "\n ");
39049
+ console.log(` ${icon} ${c.dim(formatted)}`);
39050
+ }
39051
+ console.log();
39052
+ const parts = [
39053
+ `${summary.errorCount} error(s)`,
39054
+ `${summary.warningCount} warning(s)`,
39055
+ `${summary.infoCount} info(s)`
39056
+ ];
39057
+ const suffix = limited.truncated ? c.dim(`, truncated at ${maxIssues} issue(s)`) : "";
39058
+ console.log(`${ok ? c.success("\u25C7") : c.error("\u25C7")} ${parts.join(", ")}${suffix}`);
39059
+ process.exit(ok ? 0 : 1);
39060
+ } catch (err) {
39061
+ const message = err instanceof Error ? err.message : String(err);
39062
+ if (args.json) {
39063
+ console.log(
39064
+ JSON.stringify(
39065
+ withMeta({
39066
+ schemaVersion: INSPECT_SCHEMA_VERSION,
39067
+ ok: false,
39068
+ error: message,
39069
+ issues: [],
39070
+ errorCount: 0,
39071
+ warningCount: 0,
39072
+ infoCount: 0,
39073
+ issueCount: 0
39074
+ }),
39075
+ null,
39076
+ 2
39077
+ )
39078
+ );
39079
+ process.exit(1);
39080
+ }
39081
+ console.error(`${c.error("\u2717")} Inspect failed: ${message}`);
39082
+ process.exit(1);
39083
+ }
39084
+ }
39085
+ });
39086
+ }
39087
+ var __filename, __dirname2, SEEK_SETTLE_MS, INSPECT_SCHEMA_VERSION, examples9, layout_default;
39088
+ var init_layout2 = __esm({
39089
+ "src/commands/layout.ts"() {
39090
+ "use strict";
39091
+ init_dist();
39092
+ init_colors();
39093
+ init_project();
39094
+ init_updateCheck();
39095
+ init_layoutAudit();
39096
+ __filename = fileURLToPath6(import.meta.url);
39097
+ __dirname2 = dirname17(__filename);
39098
+ SEEK_SETTLE_MS = 120;
39099
+ INSPECT_SCHEMA_VERSION = 1;
39100
+ examples9 = [
39101
+ ["Inspect visual layout across the current composition", "hyperframes layout"],
39102
+ ["Inspect a specific project", "hyperframes layout ./my-video"],
39103
+ ["Output agent-readable JSON", "hyperframes layout --json"],
39104
+ ["Use explicit hero-frame timestamps", "hyperframes layout --at 1.5,4.0,7.25"]
39105
+ ];
39106
+ layout_default = createInspectCommand("layout");
39107
+ }
39108
+ });
39109
+
39110
+ // src/commands/inspect.ts
39111
+ var inspect_exports = {};
39112
+ __export(inspect_exports, {
39113
+ default: () => inspect_default,
39114
+ examples: () => examples10
39115
+ });
39116
+ var examples10, inspect_default;
39117
+ var init_inspect = __esm({
39118
+ "src/commands/inspect.ts"() {
39119
+ "use strict";
39120
+ init_layout2();
39121
+ examples10 = [
39122
+ ["Inspect visual layout across the current composition", "hyperframes inspect"],
39123
+ ["Inspect a specific project", "hyperframes inspect ./my-video"],
39124
+ ["Output agent-readable JSON", "hyperframes inspect --json"],
39125
+ ["Use explicit hero-frame timestamps", "hyperframes inspect --at 1.5,4.0,7.25"],
39126
+ ["Run the compatibility alias", "hyperframes layout --json"]
39127
+ ];
39128
+ inspect_default = createInspectCommand("inspect");
39129
+ }
39130
+ });
39131
+
38427
39132
  // src/utils/dom.ts
38428
39133
  function ensureDOMParser() {
38429
39134
  if (typeof globalThis.DOMParser === "undefined") {
@@ -38441,14 +39146,14 @@ var init_dom = __esm({
38441
39146
  var info_exports = {};
38442
39147
  __export(info_exports, {
38443
39148
  default: () => info_default,
38444
- examples: () => examples9
39149
+ examples: () => examples11
38445
39150
  });
38446
- import { readFileSync as readFileSync29, readdirSync as readdirSync16, statSync as statSync16 } from "fs";
38447
- import { join as join42 } from "path";
39151
+ import { readFileSync as readFileSync30, readdirSync as readdirSync16, statSync as statSync16 } from "fs";
39152
+ import { join as join43 } from "path";
38448
39153
  function totalSize(dir) {
38449
39154
  let total = 0;
38450
39155
  for (const entry of readdirSync16(dir, { withFileTypes: true })) {
38451
- const path2 = join42(dir, entry.name);
39156
+ const path2 = join43(dir, entry.name);
38452
39157
  if (entry.isDirectory()) {
38453
39158
  total += totalSize(path2);
38454
39159
  } else {
@@ -38457,7 +39162,7 @@ function totalSize(dir) {
38457
39162
  }
38458
39163
  return total;
38459
39164
  }
38460
- var examples9, info_default;
39165
+ var examples11, info_default;
38461
39166
  var init_info = __esm({
38462
39167
  "src/commands/info.ts"() {
38463
39168
  "use strict";
@@ -38468,7 +39173,7 @@ var init_info = __esm({
38468
39173
  init_dom();
38469
39174
  init_project();
38470
39175
  init_updateCheck();
38471
- examples9 = [
39176
+ examples11 = [
38472
39177
  ["Show project metadata", "hyperframes info"],
38473
39178
  ["Output as JSON", "hyperframes info --json"]
38474
39179
  ];
@@ -38480,7 +39185,7 @@ var init_info = __esm({
38480
39185
  },
38481
39186
  async run({ args }) {
38482
39187
  const project = resolveProject(args.dir);
38483
- const html = readFileSync29(project.indexPath, "utf-8");
39188
+ const html = readFileSync30(project.indexPath, "utf-8");
38484
39189
  ensureDOMParser();
38485
39190
  const parsed = parseHtml(html);
38486
39191
  const tracks = new Set(parsed.elements.map((el) => el.zIndex));
@@ -38534,10 +39239,10 @@ var init_info = __esm({
38534
39239
  var compositions_exports = {};
38535
39240
  __export(compositions_exports, {
38536
39241
  default: () => compositions_default,
38537
- examples: () => examples10
39242
+ examples: () => examples12
38538
39243
  });
38539
- import { existsSync as existsSync41, readFileSync as readFileSync30 } from "fs";
38540
- import { resolve as resolve29, dirname as dirname17 } from "path";
39244
+ import { existsSync as existsSync42, readFileSync as readFileSync31 } from "fs";
39245
+ import { resolve as resolve30, dirname as dirname18 } from "path";
38541
39246
  function parseCompositions(html, baseDir) {
38542
39247
  const parser = new DOMParser();
38543
39248
  const doc = parser.parseFromString(html, "text/html");
@@ -38549,9 +39254,9 @@ function parseCompositions(html, baseDir) {
38549
39254
  const height = parseInt(div.getAttribute("data-height") ?? "1080", 10);
38550
39255
  const compositionSrc = div.getAttribute("data-composition-src");
38551
39256
  if (compositionSrc) {
38552
- const subPath = resolve29(baseDir, compositionSrc);
38553
- if (existsSync41(subPath)) {
38554
- const subHtml = readFileSync30(subPath, "utf-8");
39257
+ const subPath = resolve30(baseDir, compositionSrc);
39258
+ if (existsSync42(subPath)) {
39259
+ const subHtml = readFileSync31(subPath, "utf-8");
38555
39260
  const subInfo = parseSubComposition(subHtml, id, width, height);
38556
39261
  compositions.push({ ...subInfo, source: compositionSrc });
38557
39262
  return;
@@ -38624,7 +39329,7 @@ function parseSubComposition(html, fallbackId, fallbackWidth, fallbackHeight) {
38624
39329
  }
38625
39330
  return { id, duration, width, height, elementCount };
38626
39331
  }
38627
- var examples10, compositions_default;
39332
+ var examples12, compositions_default;
38628
39333
  var init_compositions = __esm({
38629
39334
  "src/commands/compositions.ts"() {
38630
39335
  "use strict";
@@ -38633,7 +39338,7 @@ var init_compositions = __esm({
38633
39338
  init_dom();
38634
39339
  init_project();
38635
39340
  init_updateCheck();
38636
- examples10 = [
39341
+ examples12 = [
38637
39342
  ["List compositions in the current project", "hyperframes compositions"],
38638
39343
  ["Output as JSON", "hyperframes compositions --json"]
38639
39344
  ];
@@ -38645,9 +39350,9 @@ var init_compositions = __esm({
38645
39350
  },
38646
39351
  async run({ args }) {
38647
39352
  const project = resolveProject(args.dir);
38648
- const html = readFileSync30(project.indexPath, "utf-8");
39353
+ const html = readFileSync31(project.indexPath, "utf-8");
38649
39354
  ensureDOMParser();
38650
- const compositions = parseCompositions(html, dirname17(project.indexPath));
39355
+ const compositions = parseCompositions(html, dirname18(project.indexPath));
38651
39356
  if (compositions.length === 0) {
38652
39357
  console.log(`${c.success("\u25C7")} ${c.accent(project.name)} \u2014 no compositions found`);
38653
39358
  return;
@@ -38681,11 +39386,11 @@ var init_compositions = __esm({
38681
39386
  var benchmark_exports = {};
38682
39387
  __export(benchmark_exports, {
38683
39388
  default: () => benchmark_default,
38684
- examples: () => examples11
39389
+ examples: () => examples13
38685
39390
  });
38686
- import { existsSync as existsSync42, statSync as statSync17 } from "fs";
38687
- import { resolve as resolve30, join as join43 } from "path";
38688
- var examples11, DEFAULT_CONFIGS, benchmark_default;
39391
+ import { existsSync as existsSync43, statSync as statSync17 } from "fs";
39392
+ import { resolve as resolve31, join as join44 } from "path";
39393
+ var examples13, DEFAULT_CONFIGS, benchmark_default;
38689
39394
  var init_benchmark = __esm({
38690
39395
  "src/commands/benchmark.ts"() {
38691
39396
  "use strict";
@@ -38696,7 +39401,7 @@ var init_benchmark = __esm({
38696
39401
  init_format();
38697
39402
  init_dist3();
38698
39403
  init_updateCheck();
38699
- examples11 = [
39404
+ examples13 = [
38700
39405
  ["Run benchmarks with default settings (3 runs)", "hyperframes benchmark"],
38701
39406
  ["Run 5 iterations per config", "hyperframes benchmark --runs 5"],
38702
39407
  ["Output results as JSON", "hyperframes benchmark --json"]
@@ -38726,7 +39431,7 @@ var init_benchmark = __esm({
38726
39431
  process.exit(1);
38727
39432
  }
38728
39433
  const jsonOutput = args.json ?? false;
38729
- const benchDir = resolve30("renders", ".benchmark");
39434
+ const benchDir = resolve31("renders", ".benchmark");
38730
39435
  let producer = null;
38731
39436
  try {
38732
39437
  producer = await loadProducer();
@@ -38759,7 +39464,7 @@ var init_benchmark = __esm({
38759
39464
  s2?.start(`Benchmarking ${config.label}...`);
38760
39465
  for (let i2 = 0; i2 < runsPerConfig; i2++) {
38761
39466
  s2?.message(`${config.label} \u2014 run ${i2 + 1}/${runsPerConfig}`);
38762
- const outputPath = join43(
39467
+ const outputPath = join44(
38763
39468
  benchDir,
38764
39469
  `${config.label.replace(/[^a-zA-Z0-9]/g, "_")}_run${i2}.mp4`
38765
39470
  );
@@ -38773,7 +39478,7 @@ var init_benchmark = __esm({
38773
39478
  await producer.executeRenderJob(job, project.dir, outputPath);
38774
39479
  const elapsedMs = Date.now() - startTime;
38775
39480
  let fileSize = null;
38776
- if (existsSync42(outputPath)) {
39481
+ if (existsSync43(outputPath)) {
38777
39482
  const stat3 = statSync17(outputPath);
38778
39483
  fileSize = stat3.size;
38779
39484
  }
@@ -38856,7 +39561,7 @@ var init_benchmark = __esm({
38856
39561
  var browser_exports = {};
38857
39562
  __export(browser_exports, {
38858
39563
  default: () => browser_default,
38859
- examples: () => examples12
39564
+ examples: () => examples14
38860
39565
  });
38861
39566
  async function runEnsure() {
38862
39567
  Wt2(c.bold("hyperframes browser ensure"));
@@ -38919,7 +39624,7 @@ function runClear() {
38919
39624
  Gt(c.dim("No cached browser to remove."));
38920
39625
  }
38921
39626
  }
38922
- var examples12, browser_default;
39627
+ var examples14, browser_default;
38923
39628
  var init_browser = __esm({
38924
39629
  "src/commands/browser.ts"() {
38925
39630
  "use strict";
@@ -38929,7 +39634,7 @@ var init_browser = __esm({
38929
39634
  init_format();
38930
39635
  init_manager2();
38931
39636
  init_events();
38932
- examples12 = [
39637
+ examples14 = [
38933
39638
  ["Find or download Chrome for rendering", "hyperframes browser ensure"],
38934
39639
  ["Print the Chrome executable path", "hyperframes browser path"],
38935
39640
  ["Remove cached Chrome download", "hyperframes browser clear"]
@@ -38987,10 +39692,10 @@ Run ${c.accent("hyperframes browser --help")} for usage.`
38987
39692
  var transcribe_exports2 = {};
38988
39693
  __export(transcribe_exports2, {
38989
39694
  default: () => transcribe_default,
38990
- examples: () => examples13
39695
+ examples: () => examples15
38991
39696
  });
38992
- import { existsSync as existsSync43, writeFileSync as writeFileSync17 } from "fs";
38993
- import { resolve as resolve31, join as join44, extname as extname8 } from "path";
39697
+ import { existsSync as existsSync44, writeFileSync as writeFileSync17 } from "fs";
39698
+ import { resolve as resolve32, join as join45, extname as extname8 } from "path";
38994
39699
  async function importTranscript(inputPath, dir, json) {
38995
39700
  const { loadTranscript: loadTranscript2, patchCaptionHtml: patchCaptionHtml2 } = await Promise.resolve().then(() => (init_normalize(), normalize_exports));
38996
39701
  const { words, format } = loadTranscript2(inputPath);
@@ -38998,7 +39703,7 @@ async function importTranscript(inputPath, dir, json) {
38998
39703
  console.error(c.error("No words found in transcript."));
38999
39704
  process.exit(1);
39000
39705
  }
39001
- const outPath = join44(dir, "transcript.json");
39706
+ const outPath = join45(dir, "transcript.json");
39002
39707
  writeFileSync17(outPath, JSON.stringify(words, null, 2));
39003
39708
  patchCaptionHtml2(dir, words);
39004
39709
  if (json) {
@@ -39065,7 +39770,7 @@ async function transcribeAudio(inputPath, dir, opts) {
39065
39770
  process.exit(1);
39066
39771
  }
39067
39772
  }
39068
- var examples13, transcribe_default;
39773
+ var examples15, transcribe_default;
39069
39774
  var init_transcribe2 = __esm({
39070
39775
  "src/commands/transcribe.ts"() {
39071
39776
  "use strict";
@@ -39073,7 +39778,7 @@ var init_transcribe2 = __esm({
39073
39778
  init_dist3();
39074
39779
  init_colors();
39075
39780
  init_manager();
39076
- examples13 = [
39781
+ examples15 = [
39077
39782
  ["Transcribe an audio file", "hyperframes transcribe audio.mp3"],
39078
39783
  ["Transcribe a video file", "hyperframes transcribe video.mp4"],
39079
39784
  ["Use a larger model for better accuracy", "hyperframes transcribe audio.mp3 --model medium.en"],
@@ -39114,12 +39819,12 @@ var init_transcribe2 = __esm({
39114
39819
  }
39115
39820
  },
39116
39821
  async run({ args }) {
39117
- const inputPath = resolve31(args.input);
39118
- if (!existsSync43(inputPath)) {
39822
+ const inputPath = resolve32(args.input);
39823
+ if (!existsSync44(inputPath)) {
39119
39824
  console.error(c.error(`File not found: ${args.input}`));
39120
39825
  process.exit(1);
39121
39826
  }
39122
- const dir = resolve31(args.dir ?? ".");
39827
+ const dir = resolve32(args.dir ?? ".");
39123
39828
  const ext = extname8(inputPath).toLowerCase();
39124
39829
  const isImport = ext === ".json" || ext === ".srt" || ext === ".vtt";
39125
39830
  if (isImport) {
@@ -39136,9 +39841,9 @@ var init_transcribe2 = __esm({
39136
39841
  });
39137
39842
 
39138
39843
  // src/tts/manager.ts
39139
- import { existsSync as existsSync44, mkdirSync as mkdirSync23 } from "fs";
39844
+ import { existsSync as existsSync45, mkdirSync as mkdirSync23 } from "fs";
39140
39845
  import { homedir as homedir8 } from "os";
39141
- import { join as join45 } from "path";
39846
+ import { join as join46 } from "path";
39142
39847
  function inferLangFromVoiceId(voiceId) {
39143
39848
  const first = voiceId.charAt(0).toLowerCase();
39144
39849
  return VOICE_PREFIX_LANG[first] ?? "en-us";
@@ -39147,8 +39852,8 @@ function isSupportedLang(value) {
39147
39852
  return SUPPORTED_LANGS.includes(value);
39148
39853
  }
39149
39854
  async function ensureModel2(model = DEFAULT_MODEL2, options) {
39150
- const modelPath = join45(MODELS_DIR2, `${model}.onnx`);
39151
- if (existsSync44(modelPath)) return modelPath;
39855
+ const modelPath = join46(MODELS_DIR2, `${model}.onnx`);
39856
+ if (existsSync45(modelPath)) return modelPath;
39152
39857
  const url = MODEL_URLS[model];
39153
39858
  if (!url) {
39154
39859
  throw new Error(
@@ -39158,18 +39863,18 @@ async function ensureModel2(model = DEFAULT_MODEL2, options) {
39158
39863
  mkdirSync23(MODELS_DIR2, { recursive: true });
39159
39864
  options?.onProgress?.(`Downloading TTS model ${model} (~311 MB)...`);
39160
39865
  await downloadFile(url, modelPath);
39161
- if (!existsSync44(modelPath)) {
39866
+ if (!existsSync45(modelPath)) {
39162
39867
  throw new Error(`Model download failed: ${model}`);
39163
39868
  }
39164
39869
  return modelPath;
39165
39870
  }
39166
39871
  async function ensureVoices(options) {
39167
- const voicesPath = join45(VOICES_DIR, "voices-v1.0.bin");
39168
- if (existsSync44(voicesPath)) return voicesPath;
39872
+ const voicesPath = join46(VOICES_DIR, "voices-v1.0.bin");
39873
+ if (existsSync45(voicesPath)) return voicesPath;
39169
39874
  mkdirSync23(VOICES_DIR, { recursive: true });
39170
39875
  options?.onProgress?.("Downloading voice data (~27 MB)...");
39171
39876
  await downloadFile(VOICES_URL, voicesPath);
39172
- if (!existsSync44(voicesPath)) {
39877
+ if (!existsSync45(voicesPath)) {
39173
39878
  throw new Error("Voice data download failed");
39174
39879
  }
39175
39880
  return voicesPath;
@@ -39179,9 +39884,9 @@ var init_manager3 = __esm({
39179
39884
  "src/tts/manager.ts"() {
39180
39885
  "use strict";
39181
39886
  init_download();
39182
- CACHE_DIR3 = join45(homedir8(), ".cache", "hyperframes", "tts");
39183
- MODELS_DIR2 = join45(CACHE_DIR3, "models");
39184
- VOICES_DIR = join45(CACHE_DIR3, "voices");
39887
+ CACHE_DIR3 = join46(homedir8(), ".cache", "hyperframes", "tts");
39888
+ MODELS_DIR2 = join46(CACHE_DIR3, "models");
39889
+ VOICES_DIR = join46(CACHE_DIR3, "voices");
39185
39890
  DEFAULT_MODEL2 = "kokoro-v1.0";
39186
39891
  MODEL_URLS = {
39187
39892
  "kokoro-v1.0": "https://github.com/thewh1teagle/kokoro-onnx/releases/download/model-files-v1.0/kokoro-v1.0.onnx"
@@ -39242,8 +39947,8 @@ __export(synthesize_exports, {
39242
39947
  synthesize: () => synthesize
39243
39948
  });
39244
39949
  import { execFileSync as execFileSync6 } from "child_process";
39245
- import { existsSync as existsSync45, writeFileSync as writeFileSync18, mkdirSync as mkdirSync24, readdirSync as readdirSync17, unlinkSync as unlinkSync6 } from "fs";
39246
- import { join as join46, dirname as dirname18, basename as basename10 } from "path";
39950
+ import { existsSync as existsSync46, writeFileSync as writeFileSync18, mkdirSync as mkdirSync24, readdirSync as readdirSync17, unlinkSync as unlinkSync6 } from "fs";
39951
+ import { join as join47, dirname as dirname19, basename as basename10 } from "path";
39247
39952
  import { homedir as homedir9 } from "os";
39248
39953
  function findPython() {
39249
39954
  for (const name of ["python3", "python"]) {
@@ -39279,7 +39984,7 @@ function hasPythonPackage(python, pkg) {
39279
39984
  }
39280
39985
  }
39281
39986
  function ensureSynthScript() {
39282
- if (!existsSync45(SCRIPT_PATH)) {
39987
+ if (!existsSync46(SCRIPT_PATH)) {
39283
39988
  mkdirSync24(SCRIPT_DIR, { recursive: true });
39284
39989
  writeFileSync18(SCRIPT_PATH, SYNTH_SCRIPT);
39285
39990
  const currentName = basename10(SCRIPT_PATH);
@@ -39287,7 +39992,7 @@ function ensureSynthScript() {
39287
39992
  for (const entry of readdirSync17(SCRIPT_DIR)) {
39288
39993
  if (entry !== currentName && /^synth(-v\d+)?\.py$/.test(entry)) {
39289
39994
  try {
39290
- unlinkSync6(join46(SCRIPT_DIR, entry));
39995
+ unlinkSync6(join47(SCRIPT_DIR, entry));
39291
39996
  } catch {
39292
39997
  }
39293
39998
  }
@@ -39321,7 +40026,7 @@ async function synthesize(text, outputPath, options) {
39321
40026
  ensureVoices({ onProgress: options?.onProgress })
39322
40027
  ]);
39323
40028
  const scriptPath = ensureSynthScript();
39324
- mkdirSync24(dirname18(outputPath), { recursive: true });
40029
+ mkdirSync24(dirname19(outputPath), { recursive: true });
39325
40030
  options?.onProgress?.(`Generating speech with voice ${voice} (${lang})...`);
39326
40031
  try {
39327
40032
  const stdout2 = execFileSync6(
@@ -39333,7 +40038,7 @@ async function synthesize(text, outputPath, options) {
39333
40038
  stdio: ["pipe", "pipe", "pipe"]
39334
40039
  }
39335
40040
  );
39336
- if (!existsSync45(outputPath)) {
40041
+ if (!existsSync46(outputPath)) {
39337
40042
  throw new Error("Synthesis completed but no output file was created");
39338
40043
  }
39339
40044
  const lines = stdout2.trim().split("\n");
@@ -39346,7 +40051,7 @@ async function synthesize(text, outputPath, options) {
39346
40051
  langApplied: result.langApplied
39347
40052
  };
39348
40053
  } catch (err) {
39349
- if (err instanceof SyntaxError && existsSync45(outputPath)) {
40054
+ if (err instanceof SyntaxError && existsSync46(outputPath)) {
39350
40055
  throw new Error(
39351
40056
  "Speech was generated but metadata could not be read. Check the output file manually."
39352
40057
  );
@@ -39397,8 +40102,8 @@ print(json.dumps({
39397
40102
  "langApplied": bool(lang and supports_lang),
39398
40103
  }))
39399
40104
  `;
39400
- SCRIPT_DIR = join46(homedir9(), ".cache", "hyperframes", "tts");
39401
- SCRIPT_PATH = join46(SCRIPT_DIR, "synth-v2.py");
40105
+ SCRIPT_DIR = join47(homedir9(), ".cache", "hyperframes", "tts");
40106
+ SCRIPT_PATH = join47(SCRIPT_DIR, "synth-v2.py");
39402
40107
  }
39403
40108
  });
39404
40109
 
@@ -39406,10 +40111,10 @@ print(json.dumps({
39406
40111
  var tts_exports = {};
39407
40112
  __export(tts_exports, {
39408
40113
  default: () => tts_default,
39409
- examples: () => examples14
40114
+ examples: () => examples16
39410
40115
  });
39411
- import { existsSync as existsSync46, readFileSync as readFileSync31 } from "fs";
39412
- import { resolve as resolve32, extname as extname9 } from "path";
40116
+ import { existsSync as existsSync47, readFileSync as readFileSync32 } from "fs";
40117
+ import { resolve as resolve33, extname as extname9 } from "path";
39413
40118
  function listVoices(json) {
39414
40119
  const rows = BUNDLED_VOICES.map((v) => ({ ...v, defaultLang: inferLangFromVoiceId(v.id) }));
39415
40120
  if (json) {
@@ -39439,7 +40144,7 @@ ${c.bold("Available voices")} (Kokoro-82M)
39439
40144
  `
39440
40145
  );
39441
40146
  }
39442
- var examples14, voiceList, langList, tts_default;
40147
+ var examples16, voiceList, langList, tts_default;
39443
40148
  var init_tts = __esm({
39444
40149
  "src/commands/tts.ts"() {
39445
40150
  "use strict";
@@ -39448,7 +40153,7 @@ var init_tts = __esm({
39448
40153
  init_colors();
39449
40154
  init_format();
39450
40155
  init_manager3();
39451
- examples14 = [
40156
+ examples16 = [
39452
40157
  ["Generate speech from text", 'hyperframes tts "Welcome to HyperFrames"'],
39453
40158
  ["Choose a voice", 'hyperframes tts "Hello world" --voice am_adam'],
39454
40159
  ["Save to a specific file", 'hyperframes tts "Intro" --voice bf_emma --output narration.wav'],
@@ -39517,9 +40222,9 @@ var init_tts = __esm({
39517
40222
  process.exit(1);
39518
40223
  }
39519
40224
  let text;
39520
- const maybeFile = resolve32(args.input);
39521
- if (existsSync46(maybeFile) && extname9(maybeFile).toLowerCase() === ".txt") {
39522
- text = readFileSync31(maybeFile, "utf-8").trim();
40225
+ const maybeFile = resolve33(args.input);
40226
+ if (existsSync47(maybeFile) && extname9(maybeFile).toLowerCase() === ".txt") {
40227
+ text = readFileSync32(maybeFile, "utf-8").trim();
39523
40228
  if (!text) {
39524
40229
  console.error(c.error("File is empty."));
39525
40230
  process.exit(1);
@@ -39531,7 +40236,7 @@ var init_tts = __esm({
39531
40236
  console.error(c.error("No text provided."));
39532
40237
  process.exit(1);
39533
40238
  }
39534
- const output = resolve32(args.output ?? "speech.wav");
40239
+ const output = resolve33(args.output ?? "speech.wav");
39535
40240
  const voice = args.voice ?? DEFAULT_VOICE;
39536
40241
  const speed = args.speed ? parseFloat(args.speed) : 1;
39537
40242
  if (isNaN(speed) || speed <= 0 || speed > 3) {
@@ -39609,17 +40314,17 @@ var init_tts = __esm({
39609
40314
  var docs_exports = {};
39610
40315
  __export(docs_exports, {
39611
40316
  default: () => docs_default,
39612
- examples: () => examples15
40317
+ examples: () => examples17
39613
40318
  });
39614
- import { readFileSync as readFileSync32, existsSync as existsSync47 } from "fs";
39615
- import { resolve as resolve33, dirname as dirname19, join as join47 } from "path";
39616
- import { fileURLToPath as fileURLToPath6 } from "url";
40319
+ import { readFileSync as readFileSync33, existsSync as existsSync48 } from "fs";
40320
+ import { resolve as resolve34, dirname as dirname20, join as join48 } from "path";
40321
+ import { fileURLToPath as fileURLToPath7 } from "url";
39617
40322
  function docsDir() {
39618
- const thisFile = fileURLToPath6(import.meta.url);
39619
- const dir = dirname19(thisFile);
39620
- const devPath = resolve33(dir, "..", "docs");
39621
- const builtPath = resolve33(dir, "docs");
39622
- return existsSync47(devPath) ? devPath : builtPath;
40323
+ const thisFile = fileURLToPath7(import.meta.url);
40324
+ const dir = dirname20(thisFile);
40325
+ const devPath = resolve34(dir, "..", "docs");
40326
+ const builtPath = resolve34(dir, "docs");
40327
+ return existsSync48(devPath) ? devPath : builtPath;
39623
40328
  }
39624
40329
  function formatInlineCode(line) {
39625
40330
  return line.replace(/`([^`]+)`/g, (_match, code) => c.accent(code));
@@ -39646,13 +40351,13 @@ function renderMarkdown(content) {
39646
40351
  console.log(formatInlineCode(line));
39647
40352
  }
39648
40353
  }
39649
- var examples15, TOPICS, TOPIC_NAMES, docs_default;
40354
+ var examples17, TOPICS, TOPIC_NAMES, docs_default;
39650
40355
  var init_docs = __esm({
39651
40356
  "src/commands/docs.ts"() {
39652
40357
  "use strict";
39653
40358
  init_dist();
39654
40359
  init_colors();
39655
- examples15 = [
40360
+ examples17 = [
39656
40361
  ["List all available topics", "hyperframes docs"],
39657
40362
  ["Read about data attributes", "hyperframes docs data-attributes"],
39658
40363
  ["Read about rendering", "hyperframes docs rendering"],
@@ -39716,12 +40421,12 @@ var init_docs = __esm({
39716
40421
  }
39717
40422
  process.exit(1);
39718
40423
  }
39719
- const filePath = join47(docsDir(), entry.file);
39720
- if (!existsSync47(filePath)) {
40424
+ const filePath = join48(docsDir(), entry.file);
40425
+ if (!existsSync48(filePath)) {
39721
40426
  console.error(c.error(`Doc file not found: ${filePath}`));
39722
40427
  process.exit(1);
39723
40428
  }
39724
- const content = readFileSync32(filePath, "utf-8");
40429
+ const content = readFileSync33(filePath, "utf-8");
39725
40430
  console.log();
39726
40431
  renderMarkdown(content);
39727
40432
  }
@@ -39733,7 +40438,7 @@ var init_docs = __esm({
39733
40438
  var doctor_exports = {};
39734
40439
  __export(doctor_exports, {
39735
40440
  default: () => doctor_default,
39736
- examples: () => examples16
40441
+ examples: () => examples18
39737
40442
  });
39738
40443
  import { execSync as execSync3 } from "child_process";
39739
40444
  import { freemem as freemem4, platform as platform4 } from "os";
@@ -39875,7 +40580,7 @@ function checkEnvironment() {
39875
40580
  }
39876
40581
  return { ok: true, detail: parts.join(" \xB7 ") };
39877
40582
  }
39878
- var examples16, doctor_default;
40583
+ var examples18, doctor_default;
39879
40584
  var init_doctor = __esm({
39880
40585
  "src/commands/doctor.ts"() {
39881
40586
  "use strict";
@@ -39886,7 +40591,7 @@ var init_doctor = __esm({
39886
40591
  init_version();
39887
40592
  init_updateCheck();
39888
40593
  init_system();
39889
- examples16 = [["Check system dependencies", "hyperframes doctor"]];
40594
+ examples18 = [["Check system dependencies", "hyperframes doctor"]];
39890
40595
  doctor_default = defineCommand({
39891
40596
  meta: { name: "doctor", description: "Check system dependencies and environment" },
39892
40597
  args: {},
@@ -39941,10 +40646,10 @@ var init_doctor = __esm({
39941
40646
  var upgrade_exports = {};
39942
40647
  __export(upgrade_exports, {
39943
40648
  default: () => upgrade_default,
39944
- examples: () => examples17
40649
+ examples: () => examples19
39945
40650
  });
39946
40651
  import { execSync as execSync4 } from "child_process";
39947
- var examples17, upgrade_default;
40652
+ var examples19, upgrade_default;
39948
40653
  var init_upgrade = __esm({
39949
40654
  "src/commands/upgrade.ts"() {
39950
40655
  "use strict";
@@ -39953,7 +40658,7 @@ var init_upgrade = __esm({
39953
40658
  init_colors();
39954
40659
  init_version();
39955
40660
  init_updateCheck();
39956
- examples17 = [
40661
+ examples19 = [
39957
40662
  ["Check for updates interactively", "hyperframes upgrade"],
39958
40663
  ["Check for updates without prompting", "hyperframes upgrade --check"],
39959
40664
  ["Upgrade non-interactively", "hyperframes upgrade --yes"]
@@ -40031,7 +40736,7 @@ var init_upgrade = __esm({
40031
40736
  var telemetry_exports = {};
40032
40737
  __export(telemetry_exports, {
40033
40738
  default: () => telemetry_default,
40034
- examples: () => examples18
40739
+ examples: () => examples20
40035
40740
  });
40036
40741
  function runEnable() {
40037
40742
  const config = readConfig();
@@ -40061,14 +40766,14 @@ function runStatus() {
40061
40766
  console.log(` ${c.dim("Env var:")} ${c.accent("HYPERFRAMES_NO_TELEMETRY=1")}`);
40062
40767
  console.log();
40063
40768
  }
40064
- var examples18, telemetry_default;
40769
+ var examples20, telemetry_default;
40065
40770
  var init_telemetry = __esm({
40066
40771
  "src/commands/telemetry.ts"() {
40067
40772
  "use strict";
40068
40773
  init_dist();
40069
40774
  init_colors();
40070
40775
  init_config();
40071
- examples18 = [
40776
+ examples20 = [
40072
40777
  ["Check current telemetry status", "hyperframes telemetry status"],
40073
40778
  ["Disable telemetry", "hyperframes telemetry disable"],
40074
40779
  ["Enable telemetry", "hyperframes telemetry enable"]
@@ -40147,17 +40852,17 @@ var validate_exports = {};
40147
40852
  __export(validate_exports, {
40148
40853
  default: () => validate_default
40149
40854
  });
40150
- import { existsSync as existsSync48, readFileSync as readFileSync33 } from "fs";
40151
- import { resolve as resolve34, join as join48, dirname as dirname20 } from "path";
40152
- import { fileURLToPath as fileURLToPath7 } from "url";
40153
- async function getCompositionDuration2(page) {
40855
+ import { existsSync as existsSync49, readFileSync as readFileSync34 } from "fs";
40856
+ import { resolve as resolve35, join as join49, dirname as dirname21 } from "path";
40857
+ import { fileURLToPath as fileURLToPath8 } from "url";
40858
+ async function getCompositionDuration3(page) {
40154
40859
  return page.evaluate(() => {
40155
40860
  if (window.__hf?.duration && window.__hf.duration > 0) return window.__hf.duration;
40156
40861
  const root = document.querySelector("[data-composition-id][data-duration]");
40157
40862
  return root ? parseFloat(root.getAttribute("data-duration") ?? "0") : 0;
40158
40863
  });
40159
40864
  }
40160
- async function seekTo(page, time) {
40865
+ async function seekTo2(page, time) {
40161
40866
  await page.evaluate((t3) => {
40162
40867
  if (window.__hf && typeof window.__hf.seek === "function") {
40163
40868
  window.__hf.seek(t3);
@@ -40170,16 +40875,16 @@ async function seekTo(page, time) {
40170
40875
  }
40171
40876
  }
40172
40877
  }, time);
40173
- await new Promise((r2) => setTimeout(r2, SEEK_SETTLE_MS));
40878
+ await new Promise((r2) => setTimeout(r2, SEEK_SETTLE_MS2));
40174
40879
  }
40175
40880
  async function runContrastAudit(page) {
40176
- const duration = await getCompositionDuration2(page);
40881
+ const duration = await getCompositionDuration3(page);
40177
40882
  if (duration <= 0) return [];
40178
40883
  await page.addScriptTag({ content: contrast_audit_browser_default });
40179
40884
  const results = [];
40180
40885
  for (let i2 = 0; i2 < CONTRAST_SAMPLES; i2++) {
40181
40886
  const t3 = +((i2 + 0.5) / CONTRAST_SAMPLES * duration).toFixed(3);
40182
- await seekTo(page, t3);
40887
+ await seekTo2(page, t3);
40183
40888
  const screenshot = await page.screenshot({ encoding: "base64", type: "png" });
40184
40889
  const entries2 = await page.evaluate(
40185
40890
  (b64, time) => typeof window.__contrastAudit === "function" ? window.__contrastAudit(b64, time) : [],
@@ -40194,8 +40899,8 @@ async function validateInBrowser(projectDir, opts) {
40194
40899
  const { bundleToSingleHtml: bundleToSingleHtml2 } = await Promise.resolve().then(() => (init_compiler(), compiler_exports));
40195
40900
  const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
40196
40901
  let html = await bundleToSingleHtml2(projectDir);
40197
- const runtimePath = resolve34(
40198
- __dirname2,
40902
+ const runtimePath = resolve35(
40903
+ __dirname3,
40199
40904
  "..",
40200
40905
  "..",
40201
40906
  "..",
@@ -40203,26 +40908,26 @@ async function validateInBrowser(projectDir, opts) {
40203
40908
  "dist",
40204
40909
  "hyperframe.runtime.iife.js"
40205
40910
  );
40206
- if (existsSync48(runtimePath)) {
40207
- const runtimeSource = readFileSync33(runtimePath, "utf-8");
40911
+ if (existsSync49(runtimePath)) {
40912
+ const runtimeSource = readFileSync34(runtimePath, "utf-8");
40208
40913
  html = html.replace(
40209
40914
  /<script[^>]*data-hyperframes-preview-runtime[^>]*src="[^"]*"[^>]*><\/script>/,
40210
40915
  () => `<script data-hyperframes-preview-runtime="1">${runtimeSource}</script>`
40211
40916
  );
40212
40917
  }
40213
- const { createServer } = await import("http");
40918
+ const { createServer: createServer2 } = await import("http");
40214
40919
  const { getMimeType: getMimeType2 } = await Promise.resolve().then(() => (init_studio_api(), studio_api_exports));
40215
- const server = createServer((req, res) => {
40920
+ const server = createServer2((req, res) => {
40216
40921
  const url = req.url ?? "/";
40217
40922
  if (url === "/" || url === "/index.html") {
40218
40923
  res.writeHead(200, { "Content-Type": "text/html" });
40219
40924
  res.end(html);
40220
40925
  return;
40221
40926
  }
40222
- const filePath = join48(projectDir, decodeURIComponent(url));
40223
- if (existsSync48(filePath)) {
40927
+ const filePath = join49(projectDir, decodeURIComponent(url));
40928
+ if (existsSync49(filePath)) {
40224
40929
  res.writeHead(200, { "Content-Type": getMimeType2(filePath) });
40225
- res.end(readFileSync33(filePath));
40930
+ res.end(readFileSync34(filePath));
40226
40931
  return;
40227
40932
  }
40228
40933
  res.writeHead(404);
@@ -40300,7 +41005,7 @@ function printContrastFailures(failures) {
40300
41005
  );
40301
41006
  }
40302
41007
  }
40303
- var __filename, __dirname2, CONTRAST_SAMPLES, SEEK_SETTLE_MS, validate_default;
41008
+ var __filename2, __dirname3, CONTRAST_SAMPLES, SEEK_SETTLE_MS2, validate_default;
40304
41009
  var init_validate = __esm({
40305
41010
  "src/commands/validate.ts"() {
40306
41011
  "use strict";
@@ -40309,10 +41014,10 @@ var init_validate = __esm({
40309
41014
  init_colors();
40310
41015
  init_updateCheck();
40311
41016
  init_contrast_audit_browser();
40312
- __filename = fileURLToPath7(import.meta.url);
40313
- __dirname2 = dirname20(__filename);
41017
+ __filename2 = fileURLToPath8(import.meta.url);
41018
+ __dirname3 = dirname21(__filename2);
40314
41019
  CONTRAST_SAMPLES = 5;
40315
- SEEK_SETTLE_MS = 150;
41020
+ SEEK_SETTLE_MS2 = 150;
40316
41021
  validate_default = defineCommand({
40317
41022
  meta: {
40318
41023
  name: "validate",
@@ -40410,23 +41115,24 @@ Examples:
40410
41115
  var snapshot_exports = {};
40411
41116
  __export(snapshot_exports, {
40412
41117
  default: () => snapshot_default,
40413
- examples: () => examples19
41118
+ examples: () => examples21
40414
41119
  });
40415
41120
  import { spawn as spawn11 } from "child_process";
40416
- import { existsSync as existsSync49, mkdtempSync as mkdtempSync3, readFileSync as readFileSync34, mkdirSync as mkdirSync25, rmSync as rmSync10 } from "fs";
41121
+ import { existsSync as existsSync50, mkdtempSync as mkdtempSync3, readFileSync as readFileSync35, mkdirSync as mkdirSync25, rmSync as rmSync10 } from "fs";
40417
41122
  import { tmpdir as tmpdir5 } from "os";
40418
- import { resolve as resolve35, join as join49, dirname as dirname21, relative as relative5, isAbsolute as isAbsolute6 } from "path";
40419
- import { fileURLToPath as fileURLToPath8 } from "url";
40420
- async function extractVideoFrameToBuffer(videoPath, timeSeconds) {
40421
- const tmp = mkdtempSync3(join49(tmpdir5(), "hf-snapshot-frame-"));
40422
- const outPath = join49(tmp, "frame.png");
41123
+ import { resolve as resolve36, join as join50, dirname as dirname22, relative as relative6, isAbsolute as isAbsolute7 } from "path";
41124
+ import { fileURLToPath as fileURLToPath9 } from "url";
41125
+ async function extractVideoFrameToBuffer(videoPath, timeSeconds, useVp9AlphaDecoder = false) {
41126
+ const tmp = mkdtempSync3(join50(tmpdir5(), "hf-snapshot-frame-"));
41127
+ const outPath = join50(tmp, "frame.png");
40423
41128
  try {
40424
41129
  const result = await new Promise(
40425
41130
  (resolvePromise) => {
40426
- const ff = spawn11("ffmpeg", [
40427
- "-hide_banner",
40428
- "-loglevel",
40429
- "error",
41131
+ const args = ["-hide_banner", "-loglevel", "error"];
41132
+ if (useVp9AlphaDecoder) {
41133
+ args.push("-c:v", "libvpx-vp9");
41134
+ }
41135
+ args.push(
40430
41136
  "-ss",
40431
41137
  String(Math.max(0, timeSeconds)),
40432
41138
  "-i",
@@ -40437,7 +41143,8 @@ async function extractVideoFrameToBuffer(videoPath, timeSeconds) {
40437
41143
  "2",
40438
41144
  "-y",
40439
41145
  outPath
40440
- ]);
41146
+ );
41147
+ const ff = spawn11("ffmpeg", args);
40441
41148
  let stderr = "";
40442
41149
  let timedOut = false;
40443
41150
  const timer = setTimeout(() => {
@@ -40457,8 +41164,8 @@ async function extractVideoFrameToBuffer(videoPath, timeSeconds) {
40457
41164
  });
40458
41165
  }
40459
41166
  );
40460
- if (result.code !== 0 || result.timedOut || !existsSync49(outPath)) return null;
40461
- return readFileSync34(outPath);
41167
+ if (result.code !== 0 || result.timedOut || !existsSync50(outPath)) return null;
41168
+ return readFileSync35(outPath);
40462
41169
  } finally {
40463
41170
  try {
40464
41171
  rmSync10(tmp, { recursive: true, force: true });
@@ -40471,8 +41178,8 @@ async function captureSnapshots(projectDir, opts) {
40471
41178
  const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
40472
41179
  const numFrames = opts.frames ?? 5;
40473
41180
  let html = await bundleToSingleHtml2(projectDir);
40474
- const runtimePath = resolve35(
40475
- __dirname3,
41181
+ const runtimePath = resolve36(
41182
+ __dirname4,
40476
41183
  "..",
40477
41184
  "..",
40478
41185
  "..",
@@ -40480,32 +41187,32 @@ async function captureSnapshots(projectDir, opts) {
40480
41187
  "dist",
40481
41188
  "hyperframe.runtime.iife.js"
40482
41189
  );
40483
- if (existsSync49(runtimePath)) {
40484
- const runtimeSource = readFileSync34(runtimePath, "utf-8");
41190
+ if (existsSync50(runtimePath)) {
41191
+ const runtimeSource = readFileSync35(runtimePath, "utf-8");
40485
41192
  html = html.replace(
40486
41193
  /<script[^>]*data-hyperframes-preview-runtime[^>]*src="[^"]*"[^>]*><\/script>/,
40487
41194
  () => `<script data-hyperframes-preview-runtime="1">${runtimeSource}</script>`
40488
41195
  );
40489
41196
  }
40490
- const { createServer } = await import("http");
41197
+ const { createServer: createServer2 } = await import("http");
40491
41198
  const { getMimeType: getMimeType2 } = await Promise.resolve().then(() => (init_studio_api(), studio_api_exports));
40492
- const server = createServer((req, res) => {
41199
+ const server = createServer2((req, res) => {
40493
41200
  const url = req.url ?? "/";
40494
41201
  if (url === "/" || url === "/index.html") {
40495
41202
  res.writeHead(200, { "Content-Type": "text/html" });
40496
41203
  res.end(html);
40497
41204
  return;
40498
41205
  }
40499
- const filePath = resolve35(projectDir, decodeURIComponent(url).replace(/^\//, ""));
40500
- const rel = relative5(projectDir, filePath);
40501
- if (rel.startsWith("..") || isAbsolute6(rel)) {
41206
+ const filePath = resolve36(projectDir, decodeURIComponent(url).replace(/^\//, ""));
41207
+ const rel = relative6(projectDir, filePath);
41208
+ if (rel.startsWith("..") || isAbsolute7(rel)) {
40502
41209
  res.writeHead(403);
40503
41210
  res.end();
40504
41211
  return;
40505
41212
  }
40506
- if (existsSync49(filePath)) {
41213
+ if (existsSync50(filePath)) {
40507
41214
  res.writeHead(200, { "Content-Type": getMimeType2(filePath) });
40508
- res.end(readFileSync34(filePath));
41215
+ res.end(readFileSync35(filePath));
40509
41216
  return;
40510
41217
  }
40511
41218
  res.writeHead(404);
@@ -40578,16 +41285,27 @@ async function captureSnapshots(projectDir, opts) {
40578
41285
  return [];
40579
41286
  }
40580
41287
  const positions = opts.at?.length ? opts.at : numFrames === 1 ? [duration / 2] : Array.from({ length: numFrames }, (_2, i2) => i2 / (numFrames - 1) * duration);
40581
- const snapshotDir = join49(projectDir, "snapshots");
41288
+ const snapshotDir = join50(projectDir, "snapshots");
40582
41289
  mkdirSync25(snapshotDir, { recursive: true });
40583
41290
  let injectVideoFramesBatch2 = null;
40584
41291
  let syncVideoFrameVisibility2 = null;
41292
+ let extractMediaMetadata2 = null;
40585
41293
  try {
40586
41294
  const engine = await Promise.resolve().then(() => (init_src2(), src_exports2));
40587
41295
  injectVideoFramesBatch2 = engine.injectVideoFramesBatch;
40588
41296
  syncVideoFrameVisibility2 = engine.syncVideoFrameVisibility;
41297
+ extractMediaMetadata2 = engine.extractMediaMetadata;
40589
41298
  } catch {
40590
41299
  }
41300
+ const alphaDecoderCache = /* @__PURE__ */ new Map();
41301
+ const shouldUseVp9AlphaDecoder = (filePath) => {
41302
+ if (!extractMediaMetadata2) return Promise.resolve(false);
41303
+ const cached2 = alphaDecoderCache.get(filePath);
41304
+ if (cached2) return cached2;
41305
+ const pending = extractMediaMetadata2(filePath).then((meta) => meta.hasAlpha && meta.videoCodec === "vp9").catch(() => false);
41306
+ alphaDecoderCache.set(filePath, pending);
41307
+ return pending;
41308
+ };
40591
41309
  for (let i2 = 0; i2 < positions.length; i2++) {
40592
41310
  const time = positions[i2];
40593
41311
  await page.evaluate((t3) => {
@@ -40621,7 +41339,10 @@ async function captureSnapshots(projectDir, opts) {
40621
41339
  const rawDuration = parseFloat(v.dataset.duration ?? "");
40622
41340
  const srcDur = Number.isFinite(v.duration) && v.duration > 0 ? v.duration : 0;
40623
41341
  const duration2 = Number.isFinite(rawDuration) && rawDuration > 0 ? rawDuration : srcDur > 0 ? Math.max(0, (srcDur - mediaStart) / playbackRate) : Number.POSITIVE_INFINITY;
40624
- const relTime = (t3 - start) * playbackRate + mediaStart;
41342
+ let relTime = (t3 - start) * playbackRate + mediaStart;
41343
+ if (v.loop && srcDur > mediaStart && relTime >= srcDur) {
41344
+ relTime = mediaStart + (relTime - mediaStart) % (srcDur - mediaStart);
41345
+ }
40625
41346
  const activeNow = t3 >= start && t3 < start + duration2 && relTime >= 0 && !!v.id;
40626
41347
  return {
40627
41348
  id: v.id,
@@ -40637,15 +41358,19 @@ async function captureSnapshots(projectDir, opts) {
40637
41358
  try {
40638
41359
  const url = new URL(v.src);
40639
41360
  const decodedPath = decodeURIComponent(url.pathname).replace(/^\//, "");
40640
- const candidate = resolve35(projectDir, decodedPath);
40641
- const rel = relative5(projectDir, candidate);
40642
- if (!rel.startsWith("..") && !isAbsolute6(rel) && existsSync49(candidate)) {
41361
+ const candidate = resolve36(projectDir, decodedPath);
41362
+ const rel = relative6(projectDir, candidate);
41363
+ if (!rel.startsWith("..") && !isAbsolute7(rel) && existsSync50(candidate)) {
40643
41364
  filePath = candidate;
40644
41365
  }
40645
41366
  } catch {
40646
41367
  }
40647
41368
  if (!filePath) continue;
40648
- const png = await extractVideoFrameToBuffer(filePath, Math.max(0, v.relTime));
41369
+ const png = await extractVideoFrameToBuffer(
41370
+ filePath,
41371
+ Math.max(0, v.relTime),
41372
+ await shouldUseVp9AlphaDecoder(filePath)
41373
+ );
40649
41374
  if (!png) continue;
40650
41375
  updates.push({
40651
41376
  videoId: v.id,
@@ -40665,7 +41390,7 @@ async function captureSnapshots(projectDir, opts) {
40665
41390
  }
40666
41391
  const timeLabel = opts.at?.length ? `${time.toFixed(1)}s` : `${Math.round(time / duration * 100)}pct`;
40667
41392
  const filename = `frame-${String(i2).padStart(2, "0")}-at-${timeLabel}.png`;
40668
- const framePath = join49(snapshotDir, filename);
41393
+ const framePath = join50(snapshotDir, filename);
40669
41394
  await page.screenshot({ path: framePath, type: "png" });
40670
41395
  savedPaths.push(`snapshots/${filename}`);
40671
41396
  }
@@ -40677,17 +41402,17 @@ async function captureSnapshots(projectDir, opts) {
40677
41402
  }
40678
41403
  return savedPaths;
40679
41404
  }
40680
- var __filename2, __dirname3, FFMPEG_EXTRACT_TIMEOUT_MS, examples19, snapshot_default;
41405
+ var __filename3, __dirname4, FFMPEG_EXTRACT_TIMEOUT_MS, examples21, snapshot_default;
40681
41406
  var init_snapshot = __esm({
40682
41407
  "src/commands/snapshot.ts"() {
40683
41408
  "use strict";
40684
41409
  init_dist();
40685
41410
  init_project();
40686
41411
  init_colors();
40687
- __filename2 = fileURLToPath8(import.meta.url);
40688
- __dirname3 = dirname21(__filename2);
41412
+ __filename3 = fileURLToPath9(import.meta.url);
41413
+ __dirname4 = dirname22(__filename3);
40689
41414
  FFMPEG_EXTRACT_TIMEOUT_MS = 3e4;
40690
- examples19 = [
41415
+ examples21 = [
40691
41416
  ["Capture 5 key frames from a composition", "snapshot captures/stripe"],
40692
41417
  ["Capture 10 evenly-spaced frames", "snapshot captures/stripe --frames 10"]
40693
41418
  ];
@@ -40751,13 +41476,13 @@ ${c.error("\u2717")} Snapshot failed: ${msg}`);
40751
41476
 
40752
41477
  // src/capture/assetDownloader.ts
40753
41478
  import { writeFileSync as writeFileSync19, mkdirSync as mkdirSync26 } from "fs";
40754
- import { join as join50, extname as extname10 } from "path";
41479
+ import { join as join51, extname as extname10 } from "path";
40755
41480
  async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks) {
40756
- const assetsDir = join50(outputDir, "assets");
41481
+ const assetsDir = join51(outputDir, "assets");
40757
41482
  mkdirSync26(assetsDir, { recursive: true });
40758
41483
  const assets = [];
40759
41484
  const downloadedUrls = /* @__PURE__ */ new Set();
40760
- mkdirSync26(join50(outputDir, "assets", "svgs"), { recursive: true });
41485
+ mkdirSync26(join51(outputDir, "assets", "svgs"), { recursive: true });
40761
41486
  for (let i2 = 0; i2 < tokens.svgs.length && i2 < 30; i2++) {
40762
41487
  const svg = tokens.svgs[i2];
40763
41488
  if (!svg.outerHTML || svg.outerHTML.length < 50) continue;
@@ -40765,7 +41490,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
40765
41490
  const name = label2 ? slugify(label2) + ".svg" : svg.isLogo ? `logo-${i2}.svg` : `icon-${i2}.svg`;
40766
41491
  const localPath = `assets/svgs/${name}`;
40767
41492
  try {
40768
- writeFileSync19(join50(outputDir, localPath), svg.outerHTML, "utf-8");
41493
+ writeFileSync19(join51(outputDir, localPath), svg.outerHTML, "utf-8");
40769
41494
  assets.push({ url: "", localPath, type: "svg" });
40770
41495
  } catch {
40771
41496
  }
@@ -40778,7 +41503,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
40778
41503
  const localPath = `assets/${name}`;
40779
41504
  const buffer = await fetchBuffer(icon.href);
40780
41505
  if (buffer) {
40781
- writeFileSync19(join50(outputDir, localPath), buffer);
41506
+ writeFileSync19(join51(outputDir, localPath), buffer);
40782
41507
  assets.push({ url: icon.href, localPath, type: "favicon" });
40783
41508
  break;
40784
41509
  }
@@ -40835,7 +41560,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
40835
41560
  const slug = isMeaningful ? slugify(rawName) : `${prefix}-${imgIdx}`;
40836
41561
  const name = `${slug}${ext}`;
40837
41562
  const localPath = `assets/${name}`;
40838
- writeFileSync19(join50(outputDir, localPath), buffer);
41563
+ writeFileSync19(join51(outputDir, localPath), buffer);
40839
41564
  assets.push({ url, localPath, type: "image" });
40840
41565
  imgIdx++;
40841
41566
  } catch {
@@ -40848,7 +41573,7 @@ async function downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks)
40848
41573
  const localPath = `assets/og-image${ext}`;
40849
41574
  const buffer = await fetchBuffer(tokens.ogImage);
40850
41575
  if (buffer && buffer.length > 5e3) {
40851
- writeFileSync19(join50(outputDir, localPath), buffer);
41576
+ writeFileSync19(join51(outputDir, localPath), buffer);
40852
41577
  assets.push({ url: tokens.ogImage, localPath, type: "image" });
40853
41578
  }
40854
41579
  } catch {
@@ -40871,7 +41596,7 @@ function normalizeUrl(u) {
40871
41596
  }
40872
41597
  }
40873
41598
  async function downloadAndRewriteFonts(css, outputDir) {
40874
- const assetsDir = join50(outputDir, "assets", "fonts");
41599
+ const assetsDir = join51(outputDir, "assets", "fonts");
40875
41600
  mkdirSync26(assetsDir, { recursive: true });
40876
41601
  const fontUrlRegex = /url\(['"]?(https?:\/\/[^'")\s]+\.(?:woff2?|ttf|otf)[^'")\s]*?)['"]?\)/g;
40877
41602
  const fontUrls = /* @__PURE__ */ new Set();
@@ -40907,7 +41632,7 @@ async function downloadAndRewriteFonts(css, outputDir) {
40907
41632
  try {
40908
41633
  const urlObj = new URL(fontUrl);
40909
41634
  const filename = urlObj.pathname.split("/").pop() || `font-${count}.woff2`;
40910
- const localPath = join50(assetsDir, filename);
41635
+ const localPath = join51(assetsDir, filename);
40911
41636
  const relativePath = `assets/fonts/${filename}`;
40912
41637
  const buffer = await fetchBuffer(fontUrl);
40913
41638
  if (buffer) {
@@ -41704,8 +42429,8 @@ var init_animationCataloger = __esm({
41704
42429
  });
41705
42430
 
41706
42431
  // src/capture/mediaCapture.ts
41707
- import { mkdirSync as mkdirSync27, writeFileSync as writeFileSync20, readdirSync as readdirSync18, readFileSync as readFileSync35, statSync as statSync18 } from "fs";
41708
- import { join as join51 } from "path";
42432
+ import { mkdirSync as mkdirSync27, writeFileSync as writeFileSync20, readdirSync as readdirSync18, readFileSync as readFileSync36, statSync as statSync18 } from "fs";
42433
+ import { join as join52 } from "path";
41709
42434
  async function saveLottieAnimations(discoveredLotties, lottieDir) {
41710
42435
  let savedCount = 0;
41711
42436
  const savedHashes = /* @__PURE__ */ new Set();
@@ -41738,7 +42463,7 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
41738
42463
  const hash2 = buf.toString("base64").slice(0, 100);
41739
42464
  if (savedHashes.has(hash2)) continue;
41740
42465
  savedHashes.add(hash2);
41741
- writeFileSync20(join51(lottieDir, `animation-${savedCount}.lottie`), buf);
42466
+ writeFileSync20(join52(lottieDir, `animation-${savedCount}.lottie`), buf);
41742
42467
  savedCount++;
41743
42468
  continue;
41744
42469
  }
@@ -41756,7 +42481,7 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
41756
42481
  } catch {
41757
42482
  continue;
41758
42483
  }
41759
- writeFileSync20(join51(lottieDir, `animation-${savedCount}.json`), jsonData, "utf-8");
42484
+ writeFileSync20(join52(lottieDir, `animation-${savedCount}.json`), jsonData, "utf-8");
41760
42485
  savedCount++;
41761
42486
  }
41762
42487
  } catch {
@@ -41766,22 +42491,22 @@ async function saveLottieAnimations(discoveredLotties, lottieDir) {
41766
42491
  }
41767
42492
  async function renderLottiePreviews(chromeBrowser, lottieDir, outputDir) {
41768
42493
  const manifest = [];
41769
- const previewDir = join51(lottieDir, "previews");
42494
+ const previewDir = join52(lottieDir, "previews");
41770
42495
  mkdirSync27(previewDir, { recursive: true });
41771
42496
  for (const file of readdirSync18(lottieDir)) {
41772
42497
  if (!file.endsWith(".json")) continue;
41773
42498
  try {
41774
- const raw = JSON.parse(readFileSync35(join51(lottieDir, file), "utf-8"));
42499
+ const raw = JSON.parse(readFileSync36(join52(lottieDir, file), "utf-8"));
41775
42500
  const fr = raw.fr || 30;
41776
42501
  const dur = ((raw.op || 0) - (raw.ip || 0)) / fr;
41777
42502
  const previewName = file.replace(".json", "-preview.png");
41778
- const fileSize = statSync18(join51(lottieDir, file)).size;
42503
+ const fileSize = statSync18(join52(lottieDir, file)).size;
41779
42504
  if (fileSize > 2e6) continue;
41780
42505
  let previewPage;
41781
42506
  try {
41782
42507
  previewPage = await chromeBrowser.newPage();
41783
42508
  await previewPage.setViewport({ width: 400, height: 400 });
41784
- const animData = JSON.parse(readFileSync35(join51(lottieDir, file), "utf-8"));
42509
+ const animData = JSON.parse(readFileSync36(join52(lottieDir, file), "utf-8"));
41785
42510
  const midFrame = Math.floor(((raw.op || 0) - (raw.ip || 0)) * 0.3);
41786
42511
  await previewPage.setContent(
41787
42512
  `<!DOCTYPE html>
@@ -41811,7 +42536,7 @@ async function renderLottiePreviews(chromeBrowser, lottieDir, outputDir) {
41811
42536
  await previewPage.waitForFunction(() => window.__READY === true, { timeout: 5e3 }).catch(() => {
41812
42537
  });
41813
42538
  await previewPage.screenshot({
41814
- path: join51(previewDir, previewName),
42539
+ path: join52(previewDir, previewName),
41815
42540
  type: "png",
41816
42541
  omitBackground: true
41817
42542
  });
@@ -41835,7 +42560,7 @@ async function renderLottiePreviews(chromeBrowser, lottieDir, outputDir) {
41835
42560
  }
41836
42561
  if (manifest.length > 0) {
41837
42562
  writeFileSync20(
41838
- join51(outputDir, "extracted", "lottie-manifest.json"),
42563
+ join52(outputDir, "extracted", "lottie-manifest.json"),
41839
42564
  JSON.stringify(manifest, null, 2),
41840
42565
  "utf-8"
41841
42566
  );
@@ -41897,15 +42622,15 @@ async function captureVideoManifest(page, outputDir, progress) {
41897
42622
  return true;
41898
42623
  });
41899
42624
  if (uniqueVideos.length > 0) {
41900
- const videoManifestDir = join51(outputDir, "assets", "videos");
42625
+ const videoManifestDir = join52(outputDir, "assets", "videos");
41901
42626
  mkdirSync27(videoManifestDir, { recursive: true });
41902
- const previewDir = join51(videoManifestDir, "previews");
42627
+ const previewDir = join52(videoManifestDir, "previews");
41903
42628
  mkdirSync27(previewDir, { recursive: true });
41904
42629
  const videoManifest = [];
41905
42630
  for (let vi = 0; vi < uniqueVideos.length && vi < 20; vi++) {
41906
42631
  const v = uniqueVideos[vi];
41907
42632
  const previewName = `video-${vi}-preview.png`;
41908
- const previewPath = join51(previewDir, previewName);
42633
+ const previewPath = join52(previewDir, previewName);
41909
42634
  try {
41910
42635
  await page.evaluate(`window.scrollTo(0, ${Math.max(0, v.top - 100)})`);
41911
42636
  await new Promise((r2) => setTimeout(r2, 300));
@@ -41944,7 +42669,7 @@ async function captureVideoManifest(page, outputDir, progress) {
41944
42669
  }
41945
42670
  if (videoManifest.length > 0) {
41946
42671
  writeFileSync20(
41947
- join51(outputDir, "extracted", "video-manifest.json"),
42672
+ join52(outputDir, "extracted", "video-manifest.json"),
41948
42673
  JSON.stringify(videoManifest, null, 2),
41949
42674
  "utf-8"
41950
42675
  );
@@ -42226,7 +42951,7 @@ var require_p_retry = __commonJS({
42226
42951
  return error;
42227
42952
  };
42228
42953
  var isNetworkError = (errorMessage) => networkErrorMsgs.includes(errorMessage);
42229
- var pRetry2 = (input, options) => new Promise((resolve38, reject) => {
42954
+ var pRetry2 = (input, options) => new Promise((resolve39, reject) => {
42230
42955
  options = {
42231
42956
  onFailedAttempt: () => {
42232
42957
  },
@@ -42236,7 +42961,7 @@ var require_p_retry = __commonJS({
42236
42961
  const operation = retry.operation(options);
42237
42962
  operation.attempt(async (attemptNumber) => {
42238
42963
  try {
42239
- resolve38(await input(attemptNumber));
42964
+ resolve39(await input(attemptNumber));
42240
42965
  } catch (error) {
42241
42966
  if (!(error instanceof Error)) {
42242
42967
  reject(new TypeError(`Non-error was thrown: "${error}". You should only throw errors.`));
@@ -42772,8 +43497,8 @@ var require_retry3 = __commonJS({
42772
43497
  }
42773
43498
  const delay = getNextRetryDelay(config);
42774
43499
  err.config.retryConfig.currentRetryAttempt += 1;
42775
- const backoff = config.retryBackoff ? config.retryBackoff(err, delay) : new Promise((resolve38) => {
42776
- setTimeout(resolve38, delay);
43500
+ const backoff = config.retryBackoff ? config.retryBackoff(err, delay) : new Promise((resolve39) => {
43501
+ setTimeout(resolve39, delay);
42777
43502
  });
42778
43503
  if (config.onRetryAttempt) {
42779
43504
  await config.onRetryAttempt(err);
@@ -43681,8 +44406,8 @@ var require_helpers = __commonJS({
43681
44406
  function req(url, opts = {}) {
43682
44407
  const href = typeof url === "string" ? url : url.href;
43683
44408
  const req2 = (href.startsWith("https:") ? https2 : http4).request(url, opts);
43684
- const promise = new Promise((resolve38, reject) => {
43685
- req2.once("response", resolve38).once("error", reject).end();
44409
+ const promise = new Promise((resolve39, reject) => {
44410
+ req2.once("response", resolve39).once("error", reject).end();
43686
44411
  });
43687
44412
  req2.then = promise.then.bind(promise);
43688
44413
  return req2;
@@ -43859,7 +44584,7 @@ var require_parse_proxy_response = __commonJS({
43859
44584
  var debug_1 = __importDefault(require_src2());
43860
44585
  var debug = (0, debug_1.default)("https-proxy-agent:parse-proxy-response");
43861
44586
  function parseProxyResponse(socket) {
43862
- return new Promise((resolve38, reject) => {
44587
+ return new Promise((resolve39, reject) => {
43863
44588
  let buffersLength = 0;
43864
44589
  const buffers = [];
43865
44590
  function read() {
@@ -43925,7 +44650,7 @@ var require_parse_proxy_response = __commonJS({
43925
44650
  }
43926
44651
  debug("got proxy server response: %o %o", firstLine, headers);
43927
44652
  cleanup();
43928
- resolve38({
44653
+ resolve39({
43929
44654
  connect: {
43930
44655
  statusCode,
43931
44656
  statusText,
@@ -44169,7 +44894,7 @@ var require_ponyfill_es2018 = __commonJS({
44169
44894
  return new originalPromise(executor);
44170
44895
  }
44171
44896
  function promiseResolvedWith(value) {
44172
- return newPromise((resolve38) => resolve38(value));
44897
+ return newPromise((resolve39) => resolve39(value));
44173
44898
  }
44174
44899
  function promiseRejectedWith(reason) {
44175
44900
  return originalPromiseReject(reason);
@@ -44339,8 +45064,8 @@ var require_ponyfill_es2018 = __commonJS({
44339
45064
  return new TypeError("Cannot " + name + " a stream using a released reader");
44340
45065
  }
44341
45066
  function defaultReaderClosedPromiseInitialize(reader) {
44342
- reader._closedPromise = newPromise((resolve38, reject) => {
44343
- reader._closedPromise_resolve = resolve38;
45067
+ reader._closedPromise = newPromise((resolve39, reject) => {
45068
+ reader._closedPromise_resolve = resolve39;
44344
45069
  reader._closedPromise_reject = reject;
44345
45070
  });
44346
45071
  }
@@ -44514,8 +45239,8 @@ var require_ponyfill_es2018 = __commonJS({
44514
45239
  }
44515
45240
  let resolvePromise;
44516
45241
  let rejectPromise;
44517
- const promise = newPromise((resolve38, reject) => {
44518
- resolvePromise = resolve38;
45242
+ const promise = newPromise((resolve39, reject) => {
45243
+ resolvePromise = resolve39;
44519
45244
  rejectPromise = reject;
44520
45245
  });
44521
45246
  const readRequest = {
@@ -44620,8 +45345,8 @@ var require_ponyfill_es2018 = __commonJS({
44620
45345
  const reader = this._reader;
44621
45346
  let resolvePromise;
44622
45347
  let rejectPromise;
44623
- const promise = newPromise((resolve38, reject) => {
44624
- resolvePromise = resolve38;
45348
+ const promise = newPromise((resolve39, reject) => {
45349
+ resolvePromise = resolve39;
44625
45350
  rejectPromise = reject;
44626
45351
  });
44627
45352
  const readRequest = {
@@ -45640,8 +46365,8 @@ var require_ponyfill_es2018 = __commonJS({
45640
46365
  }
45641
46366
  let resolvePromise;
45642
46367
  let rejectPromise;
45643
- const promise = newPromise((resolve38, reject) => {
45644
- resolvePromise = resolve38;
46368
+ const promise = newPromise((resolve39, reject) => {
46369
+ resolvePromise = resolve39;
45645
46370
  rejectPromise = reject;
45646
46371
  });
45647
46372
  const readIntoRequest = {
@@ -45953,10 +46678,10 @@ var require_ponyfill_es2018 = __commonJS({
45953
46678
  wasAlreadyErroring = true;
45954
46679
  reason = void 0;
45955
46680
  }
45956
- const promise = newPromise((resolve38, reject) => {
46681
+ const promise = newPromise((resolve39, reject) => {
45957
46682
  stream._pendingAbortRequest = {
45958
46683
  _promise: void 0,
45959
- _resolve: resolve38,
46684
+ _resolve: resolve39,
45960
46685
  _reject: reject,
45961
46686
  _reason: reason,
45962
46687
  _wasAlreadyErroring: wasAlreadyErroring
@@ -45973,9 +46698,9 @@ var require_ponyfill_es2018 = __commonJS({
45973
46698
  if (state === "closed" || state === "errored") {
45974
46699
  return promiseRejectedWith(new TypeError(`The stream (in ${state} state) is not in the writable state and cannot be closed`));
45975
46700
  }
45976
- const promise = newPromise((resolve38, reject) => {
46701
+ const promise = newPromise((resolve39, reject) => {
45977
46702
  const closeRequest = {
45978
- _resolve: resolve38,
46703
+ _resolve: resolve39,
45979
46704
  _reject: reject
45980
46705
  };
45981
46706
  stream._closeRequest = closeRequest;
@@ -45988,9 +46713,9 @@ var require_ponyfill_es2018 = __commonJS({
45988
46713
  return promise;
45989
46714
  }
45990
46715
  function WritableStreamAddWriteRequest(stream) {
45991
- const promise = newPromise((resolve38, reject) => {
46716
+ const promise = newPromise((resolve39, reject) => {
45992
46717
  const writeRequest = {
45993
- _resolve: resolve38,
46718
+ _resolve: resolve39,
45994
46719
  _reject: reject
45995
46720
  };
45996
46721
  stream._writeRequests.push(writeRequest);
@@ -46606,8 +47331,8 @@ var require_ponyfill_es2018 = __commonJS({
46606
47331
  return new TypeError("Cannot " + name + " a stream using a released writer");
46607
47332
  }
46608
47333
  function defaultWriterClosedPromiseInitialize(writer) {
46609
- writer._closedPromise = newPromise((resolve38, reject) => {
46610
- writer._closedPromise_resolve = resolve38;
47334
+ writer._closedPromise = newPromise((resolve39, reject) => {
47335
+ writer._closedPromise_resolve = resolve39;
46611
47336
  writer._closedPromise_reject = reject;
46612
47337
  writer._closedPromiseState = "pending";
46613
47338
  });
@@ -46643,8 +47368,8 @@ var require_ponyfill_es2018 = __commonJS({
46643
47368
  writer._closedPromiseState = "resolved";
46644
47369
  }
46645
47370
  function defaultWriterReadyPromiseInitialize(writer) {
46646
- writer._readyPromise = newPromise((resolve38, reject) => {
46647
- writer._readyPromise_resolve = resolve38;
47371
+ writer._readyPromise = newPromise((resolve39, reject) => {
47372
+ writer._readyPromise_resolve = resolve39;
46648
47373
  writer._readyPromise_reject = reject;
46649
47374
  });
46650
47375
  writer._readyPromiseState = "pending";
@@ -46731,7 +47456,7 @@ var require_ponyfill_es2018 = __commonJS({
46731
47456
  source._disturbed = true;
46732
47457
  let shuttingDown = false;
46733
47458
  let currentWrite = promiseResolvedWith(void 0);
46734
- return newPromise((resolve38, reject) => {
47459
+ return newPromise((resolve39, reject) => {
46735
47460
  let abortAlgorithm;
46736
47461
  if (signal !== void 0) {
46737
47462
  abortAlgorithm = () => {
@@ -46876,7 +47601,7 @@ var require_ponyfill_es2018 = __commonJS({
46876
47601
  if (isError) {
46877
47602
  reject(error);
46878
47603
  } else {
46879
- resolve38(void 0);
47604
+ resolve39(void 0);
46880
47605
  }
46881
47606
  return null;
46882
47607
  }
@@ -47157,8 +47882,8 @@ var require_ponyfill_es2018 = __commonJS({
47157
47882
  let branch1;
47158
47883
  let branch2;
47159
47884
  let resolveCancelPromise;
47160
- const cancelPromise = newPromise((resolve38) => {
47161
- resolveCancelPromise = resolve38;
47885
+ const cancelPromise = newPromise((resolve39) => {
47886
+ resolveCancelPromise = resolve39;
47162
47887
  });
47163
47888
  function pullAlgorithm() {
47164
47889
  if (reading) {
@@ -47249,8 +47974,8 @@ var require_ponyfill_es2018 = __commonJS({
47249
47974
  let branch1;
47250
47975
  let branch2;
47251
47976
  let resolveCancelPromise;
47252
- const cancelPromise = newPromise((resolve38) => {
47253
- resolveCancelPromise = resolve38;
47977
+ const cancelPromise = newPromise((resolve39) => {
47978
+ resolveCancelPromise = resolve39;
47254
47979
  });
47255
47980
  function forwardReaderError(thisReader) {
47256
47981
  uponRejection(thisReader._closedPromise, (r2) => {
@@ -48030,8 +48755,8 @@ var require_ponyfill_es2018 = __commonJS({
48030
48755
  const writableHighWaterMark = ExtractHighWaterMark(writableStrategy, 1);
48031
48756
  const writableSizeAlgorithm = ExtractSizeAlgorithm(writableStrategy);
48032
48757
  let startPromise_resolve;
48033
- const startPromise = newPromise((resolve38) => {
48034
- startPromise_resolve = resolve38;
48758
+ const startPromise = newPromise((resolve39) => {
48759
+ startPromise_resolve = resolve39;
48035
48760
  });
48036
48761
  InitializeTransformStream(this, startPromise, writableHighWaterMark, writableSizeAlgorithm, readableHighWaterMark, readableSizeAlgorithm);
48037
48762
  SetUpTransformStreamDefaultControllerFromTransformer(this, transformer);
@@ -48124,8 +48849,8 @@ var require_ponyfill_es2018 = __commonJS({
48124
48849
  if (stream._backpressureChangePromise !== void 0) {
48125
48850
  stream._backpressureChangePromise_resolve();
48126
48851
  }
48127
- stream._backpressureChangePromise = newPromise((resolve38) => {
48128
- stream._backpressureChangePromise_resolve = resolve38;
48852
+ stream._backpressureChangePromise = newPromise((resolve39) => {
48853
+ stream._backpressureChangePromise_resolve = resolve39;
48129
48854
  });
48130
48855
  stream._backpressure = backpressure;
48131
48856
  }
@@ -48293,8 +49018,8 @@ var require_ponyfill_es2018 = __commonJS({
48293
49018
  return controller._finishPromise;
48294
49019
  }
48295
49020
  const readable = stream._readable;
48296
- controller._finishPromise = newPromise((resolve38, reject) => {
48297
- controller._finishPromise_resolve = resolve38;
49021
+ controller._finishPromise = newPromise((resolve39, reject) => {
49022
+ controller._finishPromise_resolve = resolve39;
48298
49023
  controller._finishPromise_reject = reject;
48299
49024
  });
48300
49025
  const cancelPromise = controller._cancelAlgorithm(reason);
@@ -48320,8 +49045,8 @@ var require_ponyfill_es2018 = __commonJS({
48320
49045
  return controller._finishPromise;
48321
49046
  }
48322
49047
  const readable = stream._readable;
48323
- controller._finishPromise = newPromise((resolve38, reject) => {
48324
- controller._finishPromise_resolve = resolve38;
49048
+ controller._finishPromise = newPromise((resolve39, reject) => {
49049
+ controller._finishPromise_resolve = resolve39;
48325
49050
  controller._finishPromise_reject = reject;
48326
49051
  });
48327
49052
  const flushPromise = controller._flushAlgorithm();
@@ -48351,8 +49076,8 @@ var require_ponyfill_es2018 = __commonJS({
48351
49076
  return controller._finishPromise;
48352
49077
  }
48353
49078
  const writable = stream._writable;
48354
- controller._finishPromise = newPromise((resolve38, reject) => {
48355
- controller._finishPromise_resolve = resolve38;
49079
+ controller._finishPromise = newPromise((resolve39, reject) => {
49080
+ controller._finishPromise_resolve = resolve39;
48356
49081
  controller._finishPromise_reject = reject;
48357
49082
  });
48358
49083
  const cancelPromise = controller._cancelAlgorithm(reason);
@@ -50321,7 +51046,7 @@ import zlib from "zlib";
50321
51046
  import Stream2, { PassThrough as PassThrough2, pipeline as pump } from "stream";
50322
51047
  import { Buffer as Buffer3 } from "buffer";
50323
51048
  async function fetch3(url, options_) {
50324
- return new Promise((resolve38, reject) => {
51049
+ return new Promise((resolve39, reject) => {
50325
51050
  const request = new Request2(url, options_);
50326
51051
  const { parsedURL, options } = getNodeRequestOptions(request);
50327
51052
  if (!supportedSchemas.has(parsedURL.protocol)) {
@@ -50330,7 +51055,7 @@ async function fetch3(url, options_) {
50330
51055
  if (parsedURL.protocol === "data:") {
50331
51056
  const data = dist_default(request.url);
50332
51057
  const response2 = new Response2(data, { headers: { "Content-Type": data.typeFull } });
50333
- resolve38(response2);
51058
+ resolve39(response2);
50334
51059
  return;
50335
51060
  }
50336
51061
  const send = (parsedURL.protocol === "https:" ? https : http3).request;
@@ -50452,7 +51177,7 @@ async function fetch3(url, options_) {
50452
51177
  if (responseReferrerPolicy) {
50453
51178
  requestOptions.referrerPolicy = responseReferrerPolicy;
50454
51179
  }
50455
- resolve38(fetch3(new Request2(locationURL, requestOptions)));
51180
+ resolve39(fetch3(new Request2(locationURL, requestOptions)));
50456
51181
  finalize();
50457
51182
  return;
50458
51183
  }
@@ -50485,7 +51210,7 @@ async function fetch3(url, options_) {
50485
51210
  const codings = headers.get("Content-Encoding");
50486
51211
  if (!request.compress || request.method === "HEAD" || codings === null || response_.statusCode === 204 || response_.statusCode === 304) {
50487
51212
  response = new Response2(body, responseOptions);
50488
- resolve38(response);
51213
+ resolve39(response);
50489
51214
  return;
50490
51215
  }
50491
51216
  const zlibOptions = {
@@ -50499,7 +51224,7 @@ async function fetch3(url, options_) {
50499
51224
  }
50500
51225
  });
50501
51226
  response = new Response2(body, responseOptions);
50502
- resolve38(response);
51227
+ resolve39(response);
50503
51228
  return;
50504
51229
  }
50505
51230
  if (codings === "deflate" || codings === "x-deflate") {
@@ -50523,12 +51248,12 @@ async function fetch3(url, options_) {
50523
51248
  });
50524
51249
  }
50525
51250
  response = new Response2(body, responseOptions);
50526
- resolve38(response);
51251
+ resolve39(response);
50527
51252
  });
50528
51253
  raw.once("end", () => {
50529
51254
  if (!response) {
50530
51255
  response = new Response2(body, responseOptions);
50531
- resolve38(response);
51256
+ resolve39(response);
50532
51257
  }
50533
51258
  });
50534
51259
  return;
@@ -50540,11 +51265,11 @@ async function fetch3(url, options_) {
50540
51265
  }
50541
51266
  });
50542
51267
  response = new Response2(body, responseOptions);
50543
- resolve38(response);
51268
+ resolve39(response);
50544
51269
  return;
50545
51270
  }
50546
51271
  response = new Response2(body, responseOptions);
50547
- resolve38(response);
51272
+ resolve39(response);
50548
51273
  });
50549
51274
  writeToStream(request_, request).catch(reject);
50550
51275
  });
@@ -56626,7 +57351,7 @@ var require_jwtaccess = __commonJS({
56626
57351
  }
56627
57352
  }
56628
57353
  fromStreamAsync(inputStream) {
56629
- return new Promise((resolve38, reject) => {
57354
+ return new Promise((resolve39, reject) => {
56630
57355
  if (!inputStream) {
56631
57356
  reject(new Error("Must pass in a stream containing the service account auth settings."));
56632
57357
  }
@@ -56635,7 +57360,7 @@ var require_jwtaccess = __commonJS({
56635
57360
  try {
56636
57361
  const data = JSON.parse(s2);
56637
57362
  this.fromJSON(data);
56638
- resolve38();
57363
+ resolve39();
56639
57364
  } catch (err) {
56640
57365
  reject(err);
56641
57366
  }
@@ -56874,7 +57599,7 @@ var require_jwtclient = __commonJS({
56874
57599
  }
56875
57600
  }
56876
57601
  fromStreamAsync(inputStream) {
56877
- return new Promise((resolve38, reject) => {
57602
+ return new Promise((resolve39, reject) => {
56878
57603
  if (!inputStream) {
56879
57604
  throw new Error("Must pass in a stream containing the service account auth settings.");
56880
57605
  }
@@ -56883,7 +57608,7 @@ var require_jwtclient = __commonJS({
56883
57608
  try {
56884
57609
  const data = JSON.parse(s2);
56885
57610
  this.fromJSON(data);
56886
- resolve38();
57611
+ resolve39();
56887
57612
  } catch (e2) {
56888
57613
  reject(e2);
56889
57614
  }
@@ -57016,7 +57741,7 @@ var require_refreshclient = __commonJS({
57016
57741
  }
57017
57742
  }
57018
57743
  async fromStreamAsync(inputStream) {
57019
- return new Promise((resolve38, reject) => {
57744
+ return new Promise((resolve39, reject) => {
57020
57745
  if (!inputStream) {
57021
57746
  return reject(new Error("Must pass in a stream containing the user refresh token."));
57022
57747
  }
@@ -57025,7 +57750,7 @@ var require_refreshclient = __commonJS({
57025
57750
  try {
57026
57751
  const data = JSON.parse(s2);
57027
57752
  this.fromJSON(data);
57028
- return resolve38();
57753
+ return resolve39();
57029
57754
  } catch (err) {
57030
57755
  return reject(err);
57031
57756
  }
@@ -58858,7 +59583,7 @@ var require_pluggable_auth_handler = __commonJS({
58858
59583
  * @return A promise that resolves with the executable response.
58859
59584
  */
58860
59585
  retrieveResponseFromExecutable(envMap) {
58861
- return new Promise((resolve38, reject) => {
59586
+ return new Promise((resolve39, reject) => {
58862
59587
  const child = childProcess.spawn(this.commandComponents[0], this.commandComponents.slice(1), {
58863
59588
  env: { ...process.env, ...Object.fromEntries(envMap) }
58864
59589
  });
@@ -58880,7 +59605,7 @@ var require_pluggable_auth_handler = __commonJS({
58880
59605
  try {
58881
59606
  const responseJson = JSON.parse(output);
58882
59607
  const response = new executable_response_1.ExecutableResponse(responseJson);
58883
- return resolve38(response);
59608
+ return resolve39(response);
58884
59609
  } catch (error) {
58885
59610
  if (error instanceof executable_response_1.ExecutableResponseError) {
58886
59611
  return reject(error);
@@ -59783,7 +60508,7 @@ var require_googleauth = __commonJS({
59783
60508
  }
59784
60509
  }
59785
60510
  fromStreamAsync(inputStream, options) {
59786
- return new Promise((resolve38, reject) => {
60511
+ return new Promise((resolve39, reject) => {
59787
60512
  if (!inputStream) {
59788
60513
  throw new Error("Must pass in a stream containing the Google auth settings.");
59789
60514
  }
@@ -59793,7 +60518,7 @@ var require_googleauth = __commonJS({
59793
60518
  try {
59794
60519
  const data = JSON.parse(chunks.join(""));
59795
60520
  const r2 = this._cacheClientFromJSON(data, options);
59796
- return resolve38(r2);
60521
+ return resolve39(r2);
59797
60522
  } catch (err) {
59798
60523
  if (!this.keyFilename)
59799
60524
  throw err;
@@ -59803,7 +60528,7 @@ var require_googleauth = __commonJS({
59803
60528
  });
59804
60529
  this.cachedCredential = client;
59805
60530
  this.setGapicJWTValues(client);
59806
- return resolve38(client);
60531
+ return resolve39(client);
59807
60532
  }
59808
60533
  } catch (err) {
59809
60534
  return reject(err);
@@ -59839,17 +60564,17 @@ var require_googleauth = __commonJS({
59839
60564
  * Run the Google Cloud SDK command that prints the default project ID
59840
60565
  */
59841
60566
  async getDefaultServiceProjectId() {
59842
- return new Promise((resolve38) => {
60567
+ return new Promise((resolve39) => {
59843
60568
  (0, child_process_1.exec)("gcloud config config-helper --format json", (err, stdout2) => {
59844
60569
  if (!err && stdout2) {
59845
60570
  try {
59846
60571
  const projectId = JSON.parse(stdout2).configuration.properties.core.project;
59847
- resolve38(projectId);
60572
+ resolve39(projectId);
59848
60573
  return;
59849
60574
  } catch (e2) {
59850
60575
  }
59851
60576
  }
59852
- resolve38(null);
60577
+ resolve39(null);
59853
60578
  });
59854
60579
  });
59855
60580
  }
@@ -67621,14 +68346,14 @@ function __asyncValues(o) {
67621
68346
  }, i2);
67622
68347
  function verb(n) {
67623
68348
  i2[n] = o[n] && function(v) {
67624
- return new Promise(function(resolve38, reject) {
67625
- v = o[n](v), settle(resolve38, reject, v.done, v.value);
68349
+ return new Promise(function(resolve39, reject) {
68350
+ v = o[n](v), settle(resolve39, reject, v.done, v.value);
67626
68351
  });
67627
68352
  };
67628
68353
  }
67629
- function settle(resolve38, reject, d, v) {
68354
+ function settle(resolve39, reject, d, v) {
67630
68355
  Promise.resolve(v).then(function(v2) {
67631
- resolve38({ value: v2, done: d });
68356
+ resolve39({ value: v2, done: d });
67632
68357
  }, reject);
67633
68358
  }
67634
68359
  }
@@ -78131,8 +78856,8 @@ var init_node4 = __esm({
78131
78856
  const url = `${websocketBaseUrl}/ws/google.ai.generativelanguage.${apiVersion}.GenerativeService.BidiGenerateMusic?key=${apiKey}`;
78132
78857
  let onopenResolve = () => {
78133
78858
  };
78134
- const onopenPromise = new Promise((resolve38) => {
78135
- onopenResolve = resolve38;
78859
+ const onopenPromise = new Promise((resolve39) => {
78860
+ onopenResolve = resolve39;
78136
78861
  });
78137
78862
  const callbacks = params.callbacks;
78138
78863
  const onopenAwaitedCallback = function() {
@@ -78338,8 +79063,8 @@ var init_node4 = __esm({
78338
79063
  }
78339
79064
  let onopenResolve = () => {
78340
79065
  };
78341
- const onopenPromise = new Promise((resolve38) => {
78342
- onopenResolve = resolve38;
79066
+ const onopenPromise = new Promise((resolve39) => {
79067
+ onopenResolve = resolve39;
78343
79068
  });
78344
79069
  const callbacks = params.callbacks;
78345
79070
  const onopenAwaitedCallback = function() {
@@ -80648,7 +81373,7 @@ var init_node4 = __esm({
80648
81373
  return void 0;
80649
81374
  }
80650
81375
  };
80651
- sleep$1 = (ms) => new Promise((resolve38) => setTimeout(resolve38, ms));
81376
+ sleep$1 = (ms) => new Promise((resolve39) => setTimeout(resolve39, ms));
80652
81377
  FallbackEncoder = ({ headers, body }) => {
80653
81378
  return {
80654
81379
  bodyHeaders: {
@@ -81157,8 +81882,8 @@ ${underline2}`);
81157
81882
  };
81158
81883
  APIPromise = class _APIPromise extends Promise {
81159
81884
  constructor(client, responsePromise, parseResponse = defaultParseResponse) {
81160
- super((resolve38) => {
81161
- resolve38(null);
81885
+ super((resolve39) => {
81886
+ resolve39(null);
81162
81887
  });
81163
81888
  this.responsePromise = responsePromise;
81164
81889
  this.parseResponse = parseResponse;
@@ -82399,8 +83124,8 @@ ${underline2}`);
82399
83124
  });
82400
83125
 
82401
83126
  // src/capture/contentExtractor.ts
82402
- import { readdirSync as readdirSync19, statSync as statSync20, readFileSync as readFileSync36 } from "fs";
82403
- import { join as join52 } from "path";
83127
+ import { readdirSync as readdirSync19, statSync as statSync20, readFileSync as readFileSync37 } from "fs";
83128
+ import { join as join53 } from "path";
82404
83129
  async function detectLibraries(page, capturedShaders) {
82405
83130
  let detectedLibraries = [];
82406
83131
  try {
@@ -82520,7 +83245,7 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
82520
83245
  try {
82521
83246
  const { GoogleGenAI: GoogleGenAI2 } = await Promise.resolve().then(() => (init_node4(), node_exports));
82522
83247
  const ai = new GoogleGenAI2({ apiKey: geminiKey });
82523
- const imageFiles = readdirSync19(join52(outputDir, "assets")).filter(
83248
+ const imageFiles = readdirSync19(join53(outputDir, "assets")).filter(
82524
83249
  (f3) => /\.(png|jpg|jpeg|webp|gif)$/i.test(f3)
82525
83250
  );
82526
83251
  const model = process.env.HYPERFRAMES_GEMINI_MODEL || "gemini-3.1-flash-lite-preview";
@@ -82529,10 +83254,10 @@ async function captionImagesWithGemini(outputDir, progress, warnings) {
82529
83254
  const batch = imageFiles.slice(i2, i2 + BATCH_SIZE);
82530
83255
  const results = await Promise.allSettled(
82531
83256
  batch.map(async (file) => {
82532
- const filePath = join52(outputDir, "assets", file);
83257
+ const filePath = join53(outputDir, "assets", file);
82533
83258
  const stat3 = statSync20(filePath);
82534
83259
  if (stat3.size > 4e6) return { file, caption: "" };
82535
- const buffer = readFileSync36(filePath);
83260
+ const buffer = readFileSync37(filePath);
82536
83261
  const base64 = buffer.toString("base64");
82537
83262
  const ext = file.split(".").pop()?.toLowerCase() || "png";
82538
83263
  const mimeType = ext === "jpg" ? "image/jpeg" : `image/${ext}`;
@@ -82578,11 +83303,11 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
82578
83303
  const uncaptionedLines = [];
82579
83304
  const svgLines = [];
82580
83305
  const fontLines = [];
82581
- const assetsPath = join52(outputDir, "assets");
83306
+ const assetsPath = join53(outputDir, "assets");
82582
83307
  try {
82583
83308
  for (const file of readdirSync19(assetsPath)) {
82584
83309
  if (file === "svgs" || file === "fonts" || file === "lottie" || file === "videos") continue;
82585
- const filePath = join52(assetsPath, file);
83310
+ const filePath = join53(assetsPath, file);
82586
83311
  const stat3 = statSync20(filePath);
82587
83312
  if (!stat3.isFile()) continue;
82588
83313
  const sizeKb = Math.round(stat3.size / 1024);
@@ -82611,7 +83336,7 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
82611
83336
  } catch {
82612
83337
  }
82613
83338
  try {
82614
- const svgsPath = join52(assetsPath, "svgs");
83339
+ const svgsPath = join53(assetsPath, "svgs");
82615
83340
  for (const file of readdirSync19(svgsPath)) {
82616
83341
  if (!file.endsWith(".svg")) continue;
82617
83342
  const svgMatch = tokens.svgs.find(
@@ -82626,7 +83351,7 @@ function generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCap
82626
83351
  } catch {
82627
83352
  }
82628
83353
  try {
82629
- const fontsPath = join52(assetsPath, "fonts");
83354
+ const fontsPath = join53(assetsPath, "fonts");
82630
83355
  for (const file of readdirSync19(fontsPath)) {
82631
83356
  fontLines.push(`fonts/${file} \u2014 font file`);
82632
83357
  }
@@ -82646,12 +83371,12 @@ __export(agentPromptGenerator_exports, {
82646
83371
  generateAgentPrompt: () => generateAgentPrompt
82647
83372
  });
82648
83373
  import { writeFileSync as writeFileSync21 } from "fs";
82649
- import { join as join53 } from "path";
83374
+ import { join as join54 } from "path";
82650
83375
  function generateAgentPrompt(outputDir, url, tokens, _animations, hasScreenshot, hasLottie, hasShaders, _catalogedAssets, detectedLibraries) {
82651
83376
  const prompt = buildPrompt(url, tokens, hasScreenshot, hasLottie, hasShaders, detectedLibraries);
82652
- writeFileSync21(join53(outputDir, "AGENTS.md"), prompt, "utf-8");
82653
- writeFileSync21(join53(outputDir, "CLAUDE.md"), prompt, "utf-8");
82654
- writeFileSync21(join53(outputDir, ".cursorrules"), prompt, "utf-8");
83377
+ writeFileSync21(join54(outputDir, "AGENTS.md"), prompt, "utf-8");
83378
+ writeFileSync21(join54(outputDir, "CLAUDE.md"), prompt, "utf-8");
83379
+ writeFileSync21(join54(outputDir, ".cursorrules"), prompt, "utf-8");
82655
83380
  }
82656
83381
  function buildPrompt(url, tokens, hasScreenshot, hasLottie, hasShaders, detectedLibraries) {
82657
83382
  const title = tokens.title || new URL(url).hostname.replace(/^www\./, "");
@@ -82718,15 +83443,15 @@ var init_agentPromptGenerator = __esm({
82718
83443
  });
82719
83444
 
82720
83445
  // src/capture/scaffolding.ts
82721
- import { existsSync as existsSync50, writeFileSync as writeFileSync22, readFileSync as readFileSync37 } from "fs";
82722
- import { join as join54, resolve as resolve36 } from "path";
83446
+ import { existsSync as existsSync51, writeFileSync as writeFileSync22, readFileSync as readFileSync38 } from "fs";
83447
+ import { join as join55, resolve as resolve37 } from "path";
82723
83448
  function loadEnvFile(startDir) {
82724
83449
  try {
82725
- let dir = resolve36(startDir);
83450
+ let dir = resolve37(startDir);
82726
83451
  for (let i2 = 0; i2 < 5; i2++) {
82727
- const envPath = resolve36(dir, ".env");
83452
+ const envPath = resolve37(dir, ".env");
82728
83453
  try {
82729
- const envContent = readFileSync37(envPath, "utf-8");
83454
+ const envContent = readFileSync38(envPath, "utf-8");
82730
83455
  for (const line of envContent.split("\n")) {
82731
83456
  const trimmed = line.trim();
82732
83457
  if (!trimmed || trimmed.startsWith("#")) continue;
@@ -82738,15 +83463,15 @@ function loadEnvFile(startDir) {
82738
83463
  }
82739
83464
  break;
82740
83465
  } catch {
82741
- dir = resolve36(dir, "..");
83466
+ dir = resolve37(dir, "..");
82742
83467
  }
82743
83468
  }
82744
83469
  } catch {
82745
83470
  }
82746
83471
  }
82747
83472
  async function generateProjectScaffold(outputDir, url, tokens, animationCatalog, hasScreenshots, hasLotties, hasShaders, catalogedAssets, progress, warnings, detectedLibraries) {
82748
- const metaPath = join54(outputDir, "meta.json");
82749
- if (!existsSync50(metaPath)) {
83473
+ const metaPath = join55(outputDir, "meta.json");
83474
+ if (!existsSync51(metaPath)) {
82750
83475
  const hostname = new URL(url).hostname.replace(/^www\./, "");
82751
83476
  writeFileSync22(
82752
83477
  metaPath,
@@ -82784,9 +83509,9 @@ __export(screenshotCapture_exports, {
82784
83509
  captureScrollScreenshots: () => captureScrollScreenshots
82785
83510
  });
82786
83511
  import { writeFileSync as writeFileSync23, mkdirSync as mkdirSync28 } from "fs";
82787
- import { join as join55 } from "path";
83512
+ import { join as join56 } from "path";
82788
83513
  async function captureScrollScreenshots(page, outputDir) {
82789
- const screenshotsDir = join55(outputDir, "screenshots");
83514
+ const screenshotsDir = join56(outputDir, "screenshots");
82790
83515
  mkdirSync28(screenshotsDir, { recursive: true });
82791
83516
  const MAX_SCREENSHOTS = 20;
82792
83517
  const filePaths = [];
@@ -82820,7 +83545,7 @@ async function captureScrollScreenshots(page, outputDir) {
82820
83545
  finalPositions[i2] / Math.max(1, scrollHeight - viewportHeight) * 100
82821
83546
  );
82822
83547
  const filename = `scroll-${String(Math.min(pct, 100)).padStart(3, "0")}.png`;
82823
- const filePath = join55(screenshotsDir, filename);
83548
+ const filePath = join56(screenshotsDir, filename);
82824
83549
  const buffer = await page.screenshot({ type: "png" });
82825
83550
  writeFileSync23(filePath, buffer);
82826
83551
  filePaths.push(`screenshots/${filename}`);
@@ -83133,8 +83858,8 @@ var capture_exports = {};
83133
83858
  __export(capture_exports, {
83134
83859
  captureWebsite: () => captureWebsite
83135
83860
  });
83136
- import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync24, existsSync as existsSync51 } from "fs";
83137
- import { join as join56 } from "path";
83861
+ import { mkdirSync as mkdirSync29, writeFileSync as writeFileSync24, existsSync as existsSync52 } from "fs";
83862
+ import { join as join57 } from "path";
83138
83863
  async function captureWebsite(opts, onProgress) {
83139
83864
  const {
83140
83865
  url,
@@ -83151,9 +83876,9 @@ async function captureWebsite(opts, onProgress) {
83151
83876
  onProgress?.(stage, detail);
83152
83877
  };
83153
83878
  loadEnvFile(outputDir);
83154
- mkdirSync29(join56(outputDir, "extracted"), { recursive: true });
83155
- mkdirSync29(join56(outputDir, "screenshots"), { recursive: true });
83156
- mkdirSync29(join56(outputDir, "assets"), { recursive: true });
83879
+ mkdirSync29(join57(outputDir, "extracted"), { recursive: true });
83880
+ mkdirSync29(join57(outputDir, "screenshots"), { recursive: true });
83881
+ mkdirSync29(join57(outputDir, "assets"), { recursive: true });
83157
83882
  progress("browser", "Launching headless Chrome...");
83158
83883
  const { ensureBrowser: ensureBrowser2 } = await Promise.resolve().then(() => (init_manager2(), manager_exports2));
83159
83884
  const browser = await ensureBrowser2();
@@ -83309,7 +84034,7 @@ async function captureWebsite(opts, onProgress) {
83309
84034
  } catch {
83310
84035
  }
83311
84036
  if (discoveredLotties.length > 0) {
83312
- const lottieDir = join56(outputDir, "assets", "lottie");
84037
+ const lottieDir = join57(outputDir, "assets", "lottie");
83313
84038
  mkdirSync29(lottieDir, { recursive: true });
83314
84039
  const savedCount = await saveLottieAnimations(discoveredLotties, lottieDir);
83315
84040
  if (savedCount > 0) {
@@ -83329,7 +84054,7 @@ async function captureWebsite(opts, onProgress) {
83329
84054
  });
83330
84055
  capturedShaders = unique;
83331
84056
  writeFileSync24(
83332
- join56(outputDir, "extracted", "shaders.json"),
84057
+ join57(outputDir, "extracted", "shaders.json"),
83333
84058
  JSON.stringify(unique, null, 2),
83334
84059
  "utf-8"
83335
84060
  );
@@ -83340,7 +84065,7 @@ async function captureWebsite(opts, onProgress) {
83340
84065
  progress("tokens", "Extracting design tokens...");
83341
84066
  const tokens = await extractTokens(page1);
83342
84067
  writeFileSync24(
83343
- join56(outputDir, "extracted", "tokens.json"),
84068
+ join57(outputDir, "extracted", "tokens.json"),
83344
84069
  JSON.stringify(tokens, null, 2),
83345
84070
  "utf-8"
83346
84071
  );
@@ -83414,7 +84139,7 @@ async function captureWebsite(opts, onProgress) {
83414
84139
  representativeAnimations: representativeAnims
83415
84140
  };
83416
84141
  writeFileSync24(
83417
- join56(outputDir, "extracted", "animations.json"),
84142
+ join57(outputDir, "extracted", "animations.json"),
83418
84143
  JSON.stringify(leanCatalog, null, 2),
83419
84144
  "utf-8"
83420
84145
  );
@@ -83425,18 +84150,18 @@ async function captureWebsite(opts, onProgress) {
83425
84150
  assets = await downloadAssets(tokens, outputDir, catalogedAssets, faviconLinks);
83426
84151
  }
83427
84152
  if (visibleTextContent) {
83428
- writeFileSync24(join56(outputDir, "extracted", "visible-text.txt"), visibleTextContent, "utf-8");
84153
+ writeFileSync24(join57(outputDir, "extracted", "visible-text.txt"), visibleTextContent, "utf-8");
83429
84154
  }
83430
84155
  if (catalogedAssets.length > 0) {
83431
84156
  writeFileSync24(
83432
- join56(outputDir, "extracted", "assets-catalog.json"),
84157
+ join57(outputDir, "extracted", "assets-catalog.json"),
83433
84158
  JSON.stringify(catalogedAssets, null, 2),
83434
84159
  "utf-8"
83435
84160
  );
83436
84161
  }
83437
84162
  if (detectedLibraries.length > 0) {
83438
84163
  writeFileSync24(
83439
- join56(outputDir, "extracted", "detected-libraries.json"),
84164
+ join57(outputDir, "extracted", "detected-libraries.json"),
83440
84165
  JSON.stringify(detectedLibraries, null, 2),
83441
84166
  "utf-8"
83442
84167
  );
@@ -83447,7 +84172,7 @@ async function captureWebsite(opts, onProgress) {
83447
84172
  const lines = generateAssetDescriptions(outputDir, tokens, catalogedAssets, geminiCaptions);
83448
84173
  if (lines.length > 0) {
83449
84174
  writeFileSync24(
83450
- join56(outputDir, "extracted", "asset-descriptions.md"),
84175
+ join57(outputDir, "extracted", "asset-descriptions.md"),
83451
84176
  "# Asset Descriptions\n\nOne line per file. Read this instead of opening every image individually.\n\n" + lines.map((l) => "- " + l).join("\n") + "\n",
83452
84177
  "utf-8"
83453
84178
  );
@@ -83463,7 +84188,7 @@ async function captureWebsite(opts, onProgress) {
83463
84188
  animationCatalog,
83464
84189
  screenshots.length > 0,
83465
84190
  discoveredLotties.length > 0,
83466
- existsSync51(join56(outputDir, "extracted", "shaders.json")),
84191
+ existsSync52(join57(outputDir, "extracted", "shaders.json")),
83467
84192
  catalogedAssets,
83468
84193
  progress,
83469
84194
  warnings,
@@ -83503,15 +84228,15 @@ var init_capture = __esm({
83503
84228
  var capture_exports2 = {};
83504
84229
  __export(capture_exports2, {
83505
84230
  default: () => capture_default,
83506
- examples: () => examples20
84231
+ examples: () => examples22
83507
84232
  });
83508
- import { resolve as resolve37 } from "path";
83509
- var examples20, capture_default;
84233
+ import { resolve as resolve38 } from "path";
84234
+ var examples22, capture_default;
83510
84235
  var init_capture2 = __esm({
83511
84236
  "src/commands/capture.ts"() {
83512
84237
  "use strict";
83513
84238
  init_dist();
83514
- examples20 = [
84239
+ examples22 = [
83515
84240
  ["Capture a website", "hyperframes capture https://stripe.com"],
83516
84241
  ["Capture to a specific directory", "hyperframes capture https://linear.app -o linear-video"],
83517
84242
  ["JSON output for AI agents", "hyperframes capture https://example.com --json"]
@@ -83564,7 +84289,7 @@ var init_capture2 = __esm({
83564
84289
  const hostname = new URL(url).hostname.replace(/^www\./, "");
83565
84290
  outputName = `captures/${hostname.replace(/\./g, "-")}`;
83566
84291
  }
83567
- const outputDir = resolve37(outputName);
84292
+ const outputDir = resolve38(outputName);
83568
84293
  const isJson = args.json;
83569
84294
  if (!isJson) {
83570
84295
  const { c: c2 } = await Promise.resolve().then(() => (init_colors(), colors_exports));
@@ -83812,7 +84537,7 @@ __export(autoUpdate_exports, {
83812
84537
  import { spawn as spawn12 } from "child_process";
83813
84538
  import { appendFileSync as appendFileSync2, mkdirSync as mkdirSync30, openSync } from "fs";
83814
84539
  import { homedir as homedir10 } from "os";
83815
- import { join as join57 } from "path";
84540
+ import { join as join58 } from "path";
83816
84541
  import { compareVersions as compareVersions2 } from "compare-versions";
83817
84542
  function isAutoInstallDisabled() {
83818
84543
  if (isDevMode()) return true;
@@ -83835,7 +84560,7 @@ function log(line) {
83835
84560
  }
83836
84561
  function launchDetachedInstall(installCommand, version) {
83837
84562
  mkdirSync30(CONFIG_DIR2, { recursive: true, mode: 448 });
83838
- const configFile = join57(CONFIG_DIR2, "config.json");
84563
+ const configFile = join58(CONFIG_DIR2, "config.json");
83839
84564
  const nodeScript = `
83840
84565
  const { exec } = require("node:child_process");
83841
84566
  const { readFileSync, renameSync, writeFileSync } = require("node:fs");
@@ -83954,18 +84679,31 @@ var init_autoUpdate = __esm({
83954
84679
  init_config();
83955
84680
  init_env();
83956
84681
  init_installerDetection();
83957
- CONFIG_DIR2 = join57(homedir10(), ".hyperframes");
83958
- LOG_FILE = join57(CONFIG_DIR2, "auto-update.log");
84682
+ CONFIG_DIR2 = join58(homedir10(), ".hyperframes");
84683
+ LOG_FILE = join58(CONFIG_DIR2, "auto-update.log");
83959
84684
  PENDING_TIMEOUT_MS = 10 * 60 * 1e3;
83960
84685
  }
83961
84686
  });
83962
84687
 
84688
+ // src/commands/layout-audit.browser.js
84689
+ var layout_audit_browser_exports = {};
84690
+ __export(layout_audit_browser_exports, {
84691
+ default: () => layout_audit_browser_default
84692
+ });
84693
+ var layout_audit_browser_default;
84694
+ var init_layout_audit_browser = __esm({
84695
+ "src/commands/layout-audit.browser.js"() {
84696
+ layout_audit_browser_default = '(function () {\n const IGNORE_TAGS = new Set(["SCRIPT", "STYLE", "TEMPLATE", "NOSCRIPT", "META", "LINK"]);\n\n function toRect(rect) {\n return {\n left: round(rect.left),\n top: round(rect.top),\n right: round(rect.right),\n bottom: round(rect.bottom),\n width: round(rect.width),\n height: round(rect.height),\n };\n }\n\n function rectFromOrigin(left, top, width, height) {\n return {\n left: round(left),\n top: round(top),\n right: round(left + width),\n bottom: round(top + height),\n width: round(width),\n height: round(height),\n };\n }\n\n function round(value) {\n return Math.round(value * 100) / 100;\n }\n\n function overflowFor(subject, container, tolerance) {\n const overflow = {};\n if (subject.left < container.left - tolerance)\n overflow.left = round(container.left - subject.left);\n if (subject.right > container.right + tolerance)\n overflow.right = round(subject.right - container.right);\n if (subject.top < container.top - tolerance) overflow.top = round(container.top - subject.top);\n if (subject.bottom > container.bottom + tolerance)\n overflow.bottom = round(subject.bottom - container.bottom);\n return Object.keys(overflow).length > 0 ? overflow : null;\n }\n\n function escapeCss(value) {\n if (window.CSS && typeof window.CSS.escape === "function") return window.CSS.escape(value);\n return value.replace(/[^a-zA-Z0-9_-]/g, "\\\\$&");\n }\n\n function escapeAttr(value) {\n return value.replace(/\\\\/g, "\\\\\\\\").replace(/"/g, \'\\\\"\');\n }\n\n function selectorFor(element) {\n if (element.id) return `#${escapeCss(element.id)}`;\n const dataName =\n element.getAttribute("data-layout-name") ||\n element.getAttribute("data-composition-id") ||\n element.getAttribute("data-start");\n if (dataName) {\n const attr = element.hasAttribute("data-layout-name")\n ? "data-layout-name"\n : element.hasAttribute("data-composition-id")\n ? "data-composition-id"\n : "data-start";\n const attrSelector = `[${attr}="${escapeAttr(dataName)}"]`;\n if (document.querySelectorAll(attrSelector).length === 1) return attrSelector;\n return `${element.tagName.toLowerCase()}${attrSelector}`;\n }\n const classes = Array.from(element.classList).slice(0, 2);\n if (classes.length > 0) {\n return `${element.tagName.toLowerCase()}.${classes.map(escapeCss).join(".")}`;\n }\n const parent = element.parentElement;\n if (!parent) return element.tagName.toLowerCase();\n const siblings = Array.from(parent.children).filter(\n (child) => child.tagName === element.tagName,\n );\n const index = siblings.indexOf(element) + 1;\n return `${selectorFor(parent)} > ${element.tagName.toLowerCase()}:nth-of-type(${index})`;\n }\n\n function hasIgnoreFlag(element) {\n return !!element.closest("[data-layout-ignore], [data-layout-check=\'ignore\']");\n }\n\n function hasAllowOverflowFlag(element) {\n return !!element.closest("[data-layout-allow-overflow]");\n }\n\n function opacityChain(element) {\n let opacity = 1;\n for (let current = element; current; current = current.parentElement) {\n const parsed = Number.parseFloat(getComputedStyle(current).opacity || "1");\n if (Number.isFinite(parsed)) opacity *= parsed;\n }\n return opacity;\n }\n\n function isVisibleElement(element) {\n if (IGNORE_TAGS.has(element.tagName)) return false;\n if (hasIgnoreFlag(element)) return false;\n const style = getComputedStyle(element);\n if (\n style.display === "none" ||\n style.visibility === "hidden" ||\n style.visibility === "collapse"\n ) {\n return false;\n }\n if (opacityChain(element) < 0.2) return false;\n const rect = element.getBoundingClientRect();\n return rect.width > 0.5 && rect.height > 0.5;\n }\n\n function textContentFor(element) {\n return (element.innerText || element.textContent || "").replace(/\\s+/g, " ").trim();\n }\n\n function hasOwnTextCandidate(element) {\n const text = textContentFor(element);\n if (!text) return false;\n for (const child of Array.from(element.children)) {\n if (isVisibleElement(child) && textContentFor(child)) return false;\n }\n return true;\n }\n\n function textRectFor(element) {\n const range = document.createRange();\n range.selectNodeContents(element);\n const rects = Array.from(range.getClientRects()).filter(\n (rect) => rect.width > 0.5 && rect.height > 0.5,\n );\n range.detach();\n if (rects.length === 0) return null;\n\n const union = rects.reduce(\n (acc, rect) => ({\n left: Math.min(acc.left, rect.left),\n top: Math.min(acc.top, rect.top),\n right: Math.max(acc.right, rect.right),\n bottom: Math.max(acc.bottom, rect.bottom),\n }),\n {\n left: Number.POSITIVE_INFINITY,\n top: Number.POSITIVE_INFINITY,\n right: Number.NEGATIVE_INFINITY,\n bottom: Number.NEGATIVE_INFINITY,\n },\n );\n\n return toRect({\n ...union,\n width: union.right - union.left,\n height: union.bottom - union.top,\n });\n }\n\n function parsePx(value) {\n const parsed = Number.parseFloat(value);\n return Number.isFinite(parsed) ? parsed : 0;\n }\n\n function hasMeaningfulBoxStyle(style) {\n return (\n parsePx(style.paddingTop) +\n parsePx(style.paddingRight) +\n parsePx(style.paddingBottom) +\n parsePx(style.paddingLeft) +\n parsePx(style.borderTopWidth) +\n parsePx(style.borderRightWidth) +\n parsePx(style.borderBottomWidth) +\n parsePx(style.borderLeftWidth) +\n parsePx(style.borderTopLeftRadius) +\n parsePx(style.borderTopRightRadius) +\n parsePx(style.borderBottomRightRadius) +\n parsePx(style.borderBottomLeftRadius) >\n 0\n );\n }\n\n function hasPaint(style) {\n const backgroundColor = style.backgroundColor || "";\n const hasBackground =\n backgroundColor !== "" &&\n backgroundColor !== "transparent" &&\n !backgroundColor.endsWith(", 0)") &&\n backgroundColor !== "rgba(0, 0, 0, 0)";\n const hasImage = style.backgroundImage && style.backgroundImage !== "none";\n const hasBorder =\n parsePx(style.borderTopWidth) +\n parsePx(style.borderRightWidth) +\n parsePx(style.borderBottomWidth) +\n parsePx(style.borderLeftWidth) >\n 0;\n const hasRadius =\n parsePx(style.borderTopLeftRadius) +\n parsePx(style.borderTopRightRadius) +\n parsePx(style.borderBottomRightRadius) +\n parsePx(style.borderBottomLeftRadius) >\n 0;\n return hasBackground || hasImage || hasBorder || hasRadius;\n }\n\n function clipsOverflow(style) {\n return [style.overflowX, style.overflowY, style.overflow].some(\n (value) => value && value !== "visible" && value !== "clip visible",\n );\n }\n\n function rootRectFor(root) {\n const measured = toRect(root.getBoundingClientRect());\n const authoredWidth = Number.parseFloat(root.getAttribute("data-width") || "");\n const authoredHeight = Number.parseFloat(root.getAttribute("data-height") || "");\n const hasAuthoredSize =\n Number.isFinite(authoredWidth) &&\n authoredWidth > 0 &&\n Number.isFinite(authoredHeight) &&\n authoredHeight > 0;\n\n if (!hasAuthoredSize) return measured;\n if (measured.width > 0.5 && measured.height > 0.5) return measured;\n return rectFromOrigin(measured.left, measured.top, authoredWidth, authoredHeight);\n }\n\n function isConstraintCandidate(element, root, rootRect) {\n if (element === root) return true;\n const style = getComputedStyle(element);\n if (clipsOverflow(style)) return true;\n if (element.hasAttribute("data-layout-boundary")) return true;\n if (!hasPaint(style)) return false;\n if (!hasMeaningfulBoxStyle(style)) return false;\n const rect = element.getBoundingClientRect();\n const rootArea = rootRect.width * rootRect.height;\n const area = rect.width * rect.height;\n return area > 0 && area < rootArea * 0.95;\n }\n\n function nearestConstraint(element, root, rootRect) {\n for (\n let current = element;\n current && current !== document.body;\n current = current.parentElement\n ) {\n if (!isVisibleElement(current)) continue;\n if (isConstraintCandidate(current, root, rootRect)) return current;\n if (current === root) return current;\n }\n return root;\n }\n\n function formatPx(value) {\n return `${Math.round(value)}px`;\n }\n\n function maxOverflow(overflow) {\n return Math.max(...Object.values(overflow).filter((value) => typeof value === "number"));\n }\n\n function textOverflowFixHint(textRect, containerRect, overflow, fontSize, targetName) {\n const horizontalOverflow = (overflow.left || 0) + (overflow.right || 0);\n const verticalOverflow = (overflow.top || 0) + (overflow.bottom || 0);\n const neededWidth = containerRect.width + horizontalOverflow;\n const neededHeight = containerRect.height + verticalOverflow;\n const widthRatio = containerRect.width > 0 ? containerRect.width / textRect.width : 0;\n const heightRatio = containerRect.height > 0 ? containerRect.height / textRect.height : 0;\n const limitingRatio = Math.min(\n widthRatio > 0 ? widthRatio : Number.POSITIVE_INFINITY,\n heightRatio > 0 ? heightRatio : Number.POSITIVE_INFINITY,\n );\n const shrinkPercent =\n Number.isFinite(limitingRatio) && limitingRatio < 1\n ? Math.ceil((1 - limitingRatio) * 100)\n : 0;\n const targetFont =\n shrinkPercent > 0 && Number.isFinite(fontSize) && fontSize > 0\n ? ` or shrink font-size from ${formatPx(fontSize)} to ~${formatPx(fontSize * limitingRatio)}`\n : "";\n const sizeTarget =\n horizontalOverflow > 0 && verticalOverflow > 0\n ? `resize ${targetName} to at least ~${formatPx(neededWidth)} x ${formatPx(neededHeight)}`\n : horizontalOverflow > 0\n ? `widen ${targetName} to at least ~${formatPx(neededWidth)}`\n : `increase ${targetName} height to at least ~${formatPx(neededHeight)}`;\n\n return `Text is ${formatPx(textRect.width)} x ${formatPx(textRect.height)} inside ${formatPx(containerRect.width)} x ${formatPx(containerRect.height)} and overflows by up to ${formatPx(maxOverflow(overflow))}; ${sizeTarget}${targetFont}, or allow wrapping with max-width/fitTextFontSize.`;\n }\n\n function clippedTextIssue(element, time, tolerance) {\n const style = getComputedStyle(element);\n if (!clipsOverflow(style)) return null;\n const overflowX = element.scrollWidth - element.clientWidth;\n const overflowY = element.scrollHeight - element.clientHeight;\n if (overflowX <= tolerance && overflowY <= tolerance) return null;\n const overflow = {};\n if (overflowX > tolerance) overflow.right = round(overflowX);\n if (overflowY > tolerance) overflow.bottom = round(overflowY);\n const selector = selectorFor(element);\n const text = textContentFor(element);\n const rect = toRect(element.getBoundingClientRect());\n const fontSize = parsePx(style.fontSize);\n return {\n code: "clipped_text",\n severity: "error",\n time,\n selector,\n text,\n message: "Text content is clipped by its own box.",\n rect,\n overflow,\n fixHint: textOverflowFixHint(rect, rect, overflow, fontSize, "the text box"),\n };\n }\n\n function textOverflowIssues(element, root, rootRect, time, tolerance) {\n const textRect = textRectFor(element);\n if (!textRect) return [];\n const text = textContentFor(element);\n const selector = selectorFor(element);\n const issues = [];\n\n const container = nearestConstraint(element, root, rootRect);\n const containerRect = container === root ? rootRect : toRect(container.getBoundingClientRect());\n const containerOverflow = overflowFor(textRect, containerRect, tolerance);\n if (containerOverflow && !hasAllowOverflowFlag(element)) {\n const style = getComputedStyle(element);\n issues.push({\n code: "text_box_overflow",\n severity: "error",\n time,\n selector,\n containerSelector: selectorFor(container),\n text,\n message: "Text extends outside its nearest visual/container box.",\n rect: textRect,\n containerRect,\n overflow: containerOverflow,\n fixHint: textOverflowFixHint(\n textRect,\n containerRect,\n containerOverflow,\n parsePx(style.fontSize),\n "the container",\n ),\n });\n }\n\n const canvasOverflow = overflowFor(textRect, rootRect, tolerance);\n if (canvasOverflow && !hasAllowOverflowFlag(element)) {\n issues.push({\n code: "canvas_overflow",\n severity: "info",\n time,\n selector,\n containerSelector: selectorFor(root),\n text,\n message: "Text extends outside the composition canvas.",\n rect: textRect,\n containerRect: rootRect,\n overflow: canvasOverflow,\n fixHint:\n "Move the text inward, reduce its size, or mark intentional off-canvas animation with data-layout-allow-overflow.",\n });\n }\n\n return issues;\n }\n\n function containerOverflowIssues(root, time, tolerance) {\n const issues = [];\n const containers = Array.from(root.querySelectorAll("*")).filter((element) => {\n if (!isVisibleElement(element) || hasAllowOverflowFlag(element)) return false;\n const style = getComputedStyle(element);\n return clipsOverflow(style) || element.hasAttribute("data-layout-boundary");\n });\n\n for (const container of containers) {\n const containerRect = toRect(container.getBoundingClientRect());\n for (const child of Array.from(container.children)) {\n if (!isVisibleElement(child) || hasAllowOverflowFlag(child)) continue;\n const childRect = toRect(child.getBoundingClientRect());\n const overflow = overflowFor(childRect, containerRect, tolerance);\n if (!overflow) continue;\n issues.push({\n code: "container_overflow",\n severity: "warning",\n time,\n selector: selectorFor(child),\n containerSelector: selectorFor(container),\n message: "Element extends outside a clipping layout container.",\n rect: childRect,\n containerRect,\n overflow,\n fixHint:\n "Resize/reposition the child or container, or mark intentional overflow with data-layout-allow-overflow.",\n });\n }\n }\n\n return issues;\n }\n\n window.__hyperframesLayoutAudit = function auditLayout(options) {\n const time = options && typeof options.time === "number" ? options.time : 0;\n const tolerance =\n options && typeof options.tolerance === "number" ? Math.max(0, options.tolerance) : 2;\n const root =\n document.querySelector("[data-composition-id][data-width][data-height]") ||\n document.querySelector("[data-composition-id]") ||\n document.body;\n const rootRect = rootRectFor(root);\n const elements = Array.from(root.querySelectorAll("*")).filter(isVisibleElement);\n const issues = [];\n\n for (const element of elements) {\n if (!hasOwnTextCandidate(element)) continue;\n const clipped = clippedTextIssue(element, time, tolerance);\n if (clipped) issues.push(clipped);\n issues.push(...textOverflowIssues(element, root, rootRect, time, tolerance));\n }\n\n issues.push(...containerOverflowIssues(root, time, tolerance));\n return issues;\n };\n})();\n';
84697
+ }
84698
+ });
84699
+
83963
84700
  // import("./commands/**/*.js") in src/help.ts
83964
84701
  var globImport_commands_js;
83965
84702
  var init_ = __esm({
83966
84703
  'import("./commands/**/*.js") in src/help.ts'() {
83967
84704
  globImport_commands_js = __glob({
83968
- "./commands/contrast-audit.browser.js": () => Promise.resolve().then(() => (init_contrast_audit_browser(), contrast_audit_browser_exports))
84705
+ "./commands/contrast-audit.browser.js": () => Promise.resolve().then(() => (init_contrast_audit_browser(), contrast_audit_browser_exports)),
84706
+ "./commands/layout-audit.browser.js": () => Promise.resolve().then(() => (init_layout_audit_browser(), layout_audit_browser_exports))
83969
84707
  });
83970
84708
  }
83971
84709
  });
@@ -84008,10 +84746,10 @@ function renderRootHelp() {
84008
84746
  lines.push(`Run ${c.cyan("hyperframes <command> --help")} for more information about a command.`);
84009
84747
  return lines.join("\n");
84010
84748
  }
84011
- function formatExamples(examples21) {
84749
+ function formatExamples(examples23) {
84012
84750
  const lines = [];
84013
84751
  lines.push(c.bold("Examples:"));
84014
- for (const [comment, command2] of examples21) {
84752
+ for (const [comment, command2] of examples23) {
84015
84753
  lines.push(` ${c.gray(`# ${comment}`)}`);
84016
84754
  lines.push(` ${command2}`);
84017
84755
  lines.push("");
@@ -84028,9 +84766,9 @@ async function showUsage2(cmd, parent) {
84028
84766
  console.log(usage + "\n");
84029
84767
  const name = meta?.name;
84030
84768
  if (name) {
84031
- const examples21 = STATIC_EXAMPLES[name] ?? await loadExamples(name);
84032
- if (examples21) {
84033
- console.log(formatExamples(examples21) + "\n");
84769
+ const examples23 = STATIC_EXAMPLES[name] ?? await loadExamples(name);
84770
+ if (examples23) {
84771
+ console.log(formatExamples(examples23) + "\n");
84034
84772
  }
84035
84773
  }
84036
84774
  }
@@ -84059,6 +84797,7 @@ var init_help = __esm({
84059
84797
  title: "Project",
84060
84798
  commands: [
84061
84799
  ["lint", "Validate a composition for common mistakes"],
84800
+ ["inspect", "Inspect rendered visual layout across the timeline"],
84062
84801
  ["snapshot", "Capture key frames as PNG screenshots for visual verification"],
84063
84802
  ["info", "Print project metadata"],
84064
84803
  ["compositions", "List all compositions in a project"],
@@ -84100,6 +84839,7 @@ var init_help = __esm({
84100
84839
  ["Render to MP4", "hyperframes render -o out.mp4"],
84101
84840
  ["Transparent WebM overlay", "hyperframes render --format webm -o out.webm"],
84102
84841
  ["Validate your composition", "hyperframes lint"],
84842
+ ["Inspect visual layout", "hyperframes inspect"],
84103
84843
  ["Check system dependencies", "hyperframes doctor"]
84104
84844
  ];
84105
84845
  STATIC_EXAMPLES = {
@@ -84125,6 +84865,8 @@ var subCommands = {
84125
84865
  publish: () => Promise.resolve().then(() => (init_publish(), publish_exports)).then((m2) => m2.default),
84126
84866
  render: () => Promise.resolve().then(() => (init_render2(), render_exports)).then((m2) => m2.default),
84127
84867
  lint: () => Promise.resolve().then(() => (init_lint3(), lint_exports2)).then((m2) => m2.default),
84868
+ inspect: () => Promise.resolve().then(() => (init_inspect(), inspect_exports)).then((m2) => m2.default),
84869
+ layout: () => Promise.resolve().then(() => (init_layout2(), layout_exports)).then((m2) => m2.default),
84128
84870
  info: () => Promise.resolve().then(() => (init_info(), info_exports)).then((m2) => m2.default),
84129
84871
  compositions: () => Promise.resolve().then(() => (init_compositions(), compositions_exports)).then((m2) => m2.default),
84130
84872
  benchmark: () => Promise.resolve().then(() => (init_benchmark(), benchmark_exports)).then((m2) => m2.default),