@mevdragon/vidfarm-devcli 0.20.5 → 0.20.8
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/.agents/skills/editor-capabilities/SKILL.md +15 -1
- package/.agents/skills/vidfarm-director/SKILL.md +106 -0
- package/.agents/skills/vidfarm-director/recipes/find-and-fork-template.md +16 -0
- package/.agents/skills/vidfarm-director/recipes/local-edit-render-approve.md +13 -0
- package/.agents/skills/vidfarm-director/recipes/onboard-a-new-director.md +13 -0
- package/.agents/skills/vidfarm-director/recipes/retheme-template.md +17 -0
- package/.agents/skills/vidfarm-director/references/assets-and-sourcing.md +111 -0
- package/.agents/skills/vidfarm-director/references/automation-and-local-dev.md +243 -0
- package/.agents/skills/vidfarm-director/references/core-workflows.md +273 -0
- package/.agents/skills/vidfarm-director/references/editor-workflows.md +365 -0
- package/.agents/skills/vidfarm-director/references/onboarding.md +28 -0
- package/.agents/skills/vidfarm-director/references/primitives.md +265 -0
- package/SKILL.director.md +521 -261
- package/dist/src/cli.js +404 -96
- package/dist/src/devcli/clips.js +15 -10
- package/dist/src/devcli/doctor.js +2 -2
- package/dist/src/devcli/local-backend.js +46 -2
- package/dist/src/services/clip-curation/cost.js +5 -1
- package/dist/src/services/clip-curation/gemini.js +10 -0
- package/package.json +30 -10
- package/SKILL.platform.md +0 -432
- package/demo/README.md +0 -28
- package/demo/dist/app.css +0 -1
- package/demo/dist/app.js +0 -1850
- package/demo/dist/chunks/chunk-DXB73IDG.js +0 -1
- package/demo/dist/chunks/chunk-S7OWAJDS.js +0 -36
- package/demo/dist/chunks/chunk-VTIBZ6AN.js +0 -1
- package/demo/dist/chunks/dist-ADSJKBVE.js +0 -332
- package/demo/dist/chunks/domEditingLayers-VZMLL4AP-SGHWPND4.js +0 -1
- package/demo/dist/chunks/hyperframes-player-XB65TCD6.js +0 -425
- package/demo/dist/chunks/lib-XAQ37YOE.js +0 -1
- package/demo/dist/chunks/src-TJ2QYA4U.js +0 -207
- package/demo/dist/favicon.ico +0 -0
- package/demo/dist/icons/timeline/audio.svg +0 -7
- package/demo/dist/icons/timeline/captions.svg +0 -5
- package/demo/dist/icons/timeline/composition.svg +0 -12
- package/demo/dist/icons/timeline/image.svg +0 -18
- package/demo/dist/icons/timeline/music.svg +0 -10
- package/demo/dist/icons/timeline/text.svg +0 -3
- package/demo/dist/index.html +0 -15
- package/dist/src/account-pages-legacy.js +0 -9396
- package/dist/src/account-pages.js +0 -61
- package/dist/src/app.js +0 -21602
- package/dist/src/composition-runtime.js +0 -1053
- package/dist/src/config.js +0 -217
- package/dist/src/context.js +0 -447
- package/dist/src/dev-app-legacy.js +0 -739
- package/dist/src/dev-app.js +0 -6
- package/dist/src/devcli/migrate-local.js +0 -140
- package/dist/src/devcli/sync.js +0 -368
- package/dist/src/domain.js +0 -5
- package/dist/src/editor-chat-history.js +0 -82
- package/dist/src/editor-chat.js +0 -756
- package/dist/src/editor-dark-theme.js +0 -1128
- package/dist/src/frontend/debug.js +0 -71
- package/dist/src/frontend/discover-client.js +0 -130
- package/dist/src/frontend/discover-store.js +0 -23
- package/dist/src/frontend/file-directory.js +0 -1018
- package/dist/src/frontend/flockposter-cache-store.js +0 -124
- package/dist/src/frontend/homepage-client.js +0 -446
- package/dist/src/frontend/homepage-shared.js +0 -201
- package/dist/src/frontend/homepage-store.js +0 -66
- package/dist/src/frontend/homepage-view.js +0 -705
- package/dist/src/frontend/page-runtime-client.js +0 -132
- package/dist/src/frontend/page-runtime-store.js +0 -9
- package/dist/src/frontend/sentry.js +0 -42
- package/dist/src/frontend/template-editor-chat.js +0 -4181
- package/dist/src/help-page.js +0 -346
- package/dist/src/homepage.js +0 -1458
- package/dist/src/index.js +0 -16
- package/dist/src/instrument.js +0 -30
- package/dist/src/landing-page.js +0 -384
- package/dist/src/page-runtime.js +0 -2
- package/dist/src/page-shell.js +0 -1452
- package/dist/src/primitive-context.js +0 -416
- package/dist/src/primitive-registry.js +0 -3940
- package/dist/src/primitive-sdk.js +0 -4
- package/dist/src/primitives/hyperframes-media.js +0 -108
- package/dist/src/react-page-shell.js +0 -35
- package/dist/src/ready-post-schedule-component.js +0 -1540
- package/dist/src/registry.js +0 -296
- package/dist/src/reskin/agency-page.js +0 -299
- package/dist/src/reskin/calendar-page.js +0 -568
- package/dist/src/reskin/chat-page.js +0 -942
- package/dist/src/reskin/discover-page.js +0 -1788
- package/dist/src/reskin/document.js +0 -1587
- package/dist/src/reskin/help-page.js +0 -357
- package/dist/src/reskin/index-page.js +0 -62
- package/dist/src/reskin/inpaint-clipper-page.js +0 -890
- package/dist/src/reskin/inpaint-page.js +0 -2554
- package/dist/src/reskin/inpaint-video-page.js +0 -1339
- package/dist/src/reskin/job-runs-page.js +0 -477
- package/dist/src/reskin/library-page.js +0 -1634
- package/dist/src/reskin/login-page.js +0 -262
- package/dist/src/reskin/portfolio-page.js +0 -687
- package/dist/src/reskin/pricing-page.js +0 -390
- package/dist/src/reskin/settings-page.js +0 -732
- package/dist/src/reskin/theme.js +0 -711
- package/dist/src/runtime.js +0 -35
- package/dist/src/services/api-call-history.js +0 -249
- package/dist/src/services/auth.js +0 -152
- package/dist/src/services/billing-pricing.js +0 -39
- package/dist/src/services/billing.js +0 -241
- package/dist/src/services/cast.js +0 -127
- package/dist/src/services/chat-threads.js +0 -92
- package/dist/src/services/clip-records.js +0 -250
- package/dist/src/services/clip-search.js +0 -77
- package/dist/src/services/clip-vectors.js +0 -125
- package/dist/src/services/composition-sanitize.js +0 -124
- package/dist/src/services/composition-watch.js +0 -79
- package/dist/src/services/elevenlabs.js +0 -222
- package/dist/src/services/file-directory.js +0 -117
- package/dist/src/services/fork-access.js +0 -93
- package/dist/src/services/fork-manifest.js +0 -42
- package/dist/src/services/ghostcut.js +0 -179
- package/dist/src/services/hyperframes.js +0 -3517
- package/dist/src/services/job-capacity.js +0 -14
- package/dist/src/services/job-logs.js +0 -197
- package/dist/src/services/jobs.js +0 -136
- package/dist/src/services/local-dynamo.js +0 -0
- package/dist/src/services/media-processing.js +0 -766
- package/dist/src/services/primitive-media-lambda.js +0 -280
- package/dist/src/services/providers.js +0 -2748
- package/dist/src/services/rate-limits.js +0 -262
- package/dist/src/services/scene-annotations.js +0 -32
- package/dist/src/services/serverless-auth.js +0 -382
- package/dist/src/services/serverless-jobs.js +0 -1084
- package/dist/src/services/serverless-provider-keys.js +0 -409
- package/dist/src/services/serverless-records.js +0 -1515
- package/dist/src/services/serverless-template-configs.js +0 -75
- package/dist/src/services/storage.js +0 -461
- package/dist/src/services/swipe-customize.js +0 -437
- package/dist/src/services/template-certification.js +0 -413
- package/dist/src/services/template-loader.js +0 -99
- package/dist/src/services/template-runtime-bundles.js +0 -217
- package/dist/src/services/template-sources.js +0 -1017
- package/dist/src/services/upstream.js +0 -248
- package/dist/src/services/video-normalization.js +0 -2
- package/dist/src/services/webhooks.js +0 -62
- package/dist/src/template-editor-pages.js +0 -2576
- package/dist/src/template-editor-shell.js +0 -2893
- package/dist/src/template-sdk.js +0 -4
- package/dist/src/worker.js +0 -17
- package/public/assets/discover-client-app.js +0 -1
- package/public/assets/file-directory-app.js +0 -3
- package/public/assets/homepage-app.js +0 -54
- package/public/assets/homepage-client-app.js +0 -80
- package/public/assets/page-runtime-client-app.js +0 -94
- package/public/assets/placeholders/scene-placeholder.png +0 -0
- package/src/assets/SELLING_AWARENESS_STAGES.md +0 -579
- package/src/assets/SELLING_WITH_HOOKS.md +0 -377
- package/src/assets/SELLING_WITH_VSLS.md +0 -606
- package/src/assets/favicon.ico +0 -0
- package/src/assets/logo-vidfarm.png +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{h as e,i as t,j as i,k as o,l as d,m as l,n as a,o as m,p as E,q as r,r as D,s,t as c,u as b,v as n,w as T,x}from"./chunk-VTIBZ6AN.js";import"./chunk-DXB73IDG.js";export{o as buildDefaultDomEditTextField,x as buildDomEditPatchTarget,D as buildDomEditStylePatchOperation,s as buildDomEditTextPatchOperation,r as collectDomEditLayerItems,t as collectDomEditTextFields,E as countDomEditChildLayers,m as getDomEditLayerKey,c as getDomEditNonEditableReason,b as getDomEditTargetKey,e as isEditableTextLeaf,n as isTextEditableSelection,T as readHfId,a as refreshDomEditSelection,d as resolveDomEditCapabilities,l as resolveDomEditSelection,i as serializeDomEditTextFields};
|
|
@@ -1,425 +0,0 @@
|
|
|
1
|
-
import"./chunk-DXB73IDG.js";function ce(e){return e.hasRuntime||e.runtimeInjected?!1:!!(e.hasNestedCompositions||e.hasTimelines&&e.attempts>=5)}function D(e){return typeof e=="object"&&e!==null}function me(e){return D(e)&&typeof e.getDuration=="function"}function fe(e){return D(e)&&typeof e.duration=="function"&&typeof e.time=="function"&&typeof e.seek=="function"&&typeof e.play=="function"&&typeof e.pause=="function"}var _e="https://cdn.jsdelivr.net/npm/@hyperframes/core/dist/hyperframe.runtime.iife.js";function $(e){if(e===null)return null;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:null}function ge(e){let t=e?.querySelector("[data-composition-id][data-width][data-height]")??e?.querySelector("[data-width][data-height]");if(!t)return null;let i=$(t.getAttribute("data-width")),r=$(t.getAttribute("data-height"));return i!==null&&r!==null?{width:i,height:r}:null}var ve=class{constructor(e,t){this._iframe=e,this._callbacks=t}_iframe;_callbacks;_interval=null;_runtimeInjected=!1;get runtimeInjected(){return this._runtimeInjected}start(){this.stop(),this._runtimeInjected=!1;let e=0;this._interval=setInterval(()=>{e++;try{let t=this._iframe.contentWindow;if(!t)return;let i=!!(t.__hf||t.__player),r=!!(t.__timelines&&Object.keys(t.__timelines).length>0),a=!!this._iframe.contentDocument?.querySelector("[data-composition-src]");if(ce({hasRuntime:i,hasTimelines:r,hasNestedCompositions:a,runtimeInjected:this._runtimeInjected,attempts:e})){this._injectRuntime();return}if(this._runtimeInjected&&!i)return;let s=this._resolvePlaybackDurationAdapter(t);if(s&&s.getDuration()>0){this.stop();let o=ge(this._iframe.contentDocument);this._callbacks.onReady({duration:s.getDuration(),adapter:s,compositionSize:o});return}}catch{}e>=40&&(this.stop(),this._callbacks.onError("Composition timeline not found after 8s"))},200)}stop(){this._interval!==null&&(clearInterval(this._interval),this._interval=null)}resolveDirectTimelineAdapter(){try{let e=this._iframe.contentWindow;return e?this._resolveDirectTimelineAdapterFromWindow(e):null}catch{return null}}resolveDirectTimelineAdapterFromWindow(e){return this._resolveDirectTimelineAdapterFromWindow(e)}hasRuntimeBridge(e){return Reflect.get(e,"__hf")!==void 0||D(Reflect.get(e,"__player"))}_injectRuntime(){this._runtimeInjected=!0;try{let e=this._iframe.contentDocument;if(!e)return;let t=e.createElement("script");t.src=_e,(e.head||e.documentElement).appendChild(t),this._callbacks.onRuntimeInjected?.()}catch{}}_resolveDirectTimelineAdapterFromWindow(e){if(this.hasRuntimeBridge(e))return null;let t=Reflect.get(e,"__timelines");if(!D(t))return null;let i=Object.keys(t);if(i.length===0)return null;let r=this._iframe.contentDocument?.querySelector("[data-composition-id]")?.getAttribute("data-composition-id"),a=r&&r in t?r:i[i.length-1],s=t[a];return fe(s)?s:null}_resolvePlaybackDurationAdapter(e){let t=Reflect.get(e,"__player");if(me(t))return{kind:"runtime",getDuration:()=>t.getDuration()};let i=this._resolveDirectTimelineAdapterFromWindow(e);return i?{kind:"direct-timeline",timeline:i,getDuration:()=>i.duration()}:null}},be=`
|
|
2
|
-
:host {
|
|
3
|
-
display: block;
|
|
4
|
-
position: relative;
|
|
5
|
-
overflow: hidden;
|
|
6
|
-
background: #000;
|
|
7
|
-
contain: layout style;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.hfp-container {
|
|
11
|
-
position: absolute;
|
|
12
|
-
inset: 0;
|
|
13
|
-
overflow: hidden;
|
|
14
|
-
pointer-events: none;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
.hfp-iframe {
|
|
19
|
-
position: absolute;
|
|
20
|
-
top: 50%;
|
|
21
|
-
left: 50%;
|
|
22
|
-
border: none;
|
|
23
|
-
pointer-events: none;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/* Opt-in: an interactive composition (e.g. a live slideshow/app with playable
|
|
27
|
-
media or controls) \u2014 let pointer events reach the iframe content. */
|
|
28
|
-
:host([interactive]) .hfp-container,
|
|
29
|
-
:host([interactive]) .hfp-iframe {
|
|
30
|
-
pointer-events: auto;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
.hfp-poster {
|
|
34
|
-
position: absolute;
|
|
35
|
-
inset: 0;
|
|
36
|
-
object-fit: contain;
|
|
37
|
-
z-index: 1;
|
|
38
|
-
pointer-events: none;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.hfp-shader-loader {
|
|
42
|
-
position: absolute;
|
|
43
|
-
inset: 0;
|
|
44
|
-
z-index: 20;
|
|
45
|
-
display: grid;
|
|
46
|
-
place-items: center;
|
|
47
|
-
visibility: hidden;
|
|
48
|
-
opacity: 0;
|
|
49
|
-
pointer-events: none;
|
|
50
|
-
background: #030504;
|
|
51
|
-
color: #f4f7fb;
|
|
52
|
-
cursor: default;
|
|
53
|
-
user-select: none;
|
|
54
|
-
-webkit-user-select: none;
|
|
55
|
-
transition: opacity 420ms ease-out, visibility 420ms ease-out;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.hfp-shader-loader.hfp-visible,
|
|
59
|
-
.hfp-shader-loader.hfp-hiding {
|
|
60
|
-
visibility: visible;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.hfp-shader-loader.hfp-visible {
|
|
64
|
-
opacity: 1;
|
|
65
|
-
pointer-events: auto;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.hfp-shader-loader.hfp-hiding {
|
|
69
|
-
opacity: 0;
|
|
70
|
-
pointer-events: none;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
.hfp-shader-loader-panel {
|
|
74
|
-
display: grid;
|
|
75
|
-
grid-template-rows: 86px 40px 26px 12px 44px;
|
|
76
|
-
justify-items: center;
|
|
77
|
-
align-items: center;
|
|
78
|
-
gap: 8px;
|
|
79
|
-
width: min(620px, 82%);
|
|
80
|
-
text-align: center;
|
|
81
|
-
font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.hfp-shader-loader-mark {
|
|
85
|
-
width: 86px;
|
|
86
|
-
height: 86px;
|
|
87
|
-
display: grid;
|
|
88
|
-
place-items: center;
|
|
89
|
-
overflow: visible;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.hfp-shader-loader-mark svg {
|
|
93
|
-
display: block;
|
|
94
|
-
overflow: visible;
|
|
95
|
-
filter: drop-shadow(0 0 5px rgba(79, 219, 94, 0.16));
|
|
96
|
-
pointer-events: none;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
.hfp-shader-loader-title {
|
|
100
|
-
width: 100%;
|
|
101
|
-
height: 40px;
|
|
102
|
-
overflow: hidden;
|
|
103
|
-
white-space: nowrap;
|
|
104
|
-
text-overflow: ellipsis;
|
|
105
|
-
font-size: 26px;
|
|
106
|
-
line-height: 40px;
|
|
107
|
-
font-weight: 700;
|
|
108
|
-
letter-spacing: 0;
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
.hfp-shader-loader-title-text {
|
|
112
|
-
color: transparent;
|
|
113
|
-
background: linear-gradient(
|
|
114
|
-
90deg,
|
|
115
|
-
rgba(244, 247, 251, 0.84) 0%,
|
|
116
|
-
#ffffff 42%,
|
|
117
|
-
#80efe4 52%,
|
|
118
|
-
#ffffff 62%,
|
|
119
|
-
rgba(244, 247, 251, 0.84) 100%
|
|
120
|
-
);
|
|
121
|
-
background-size: 220% 100%;
|
|
122
|
-
-webkit-background-clip: text;
|
|
123
|
-
background-clip: text;
|
|
124
|
-
animation: hfp-shader-loader-sheen 1.9s linear infinite;
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
.hfp-shader-loader-detail {
|
|
128
|
-
width: 100%;
|
|
129
|
-
height: 26px;
|
|
130
|
-
overflow: hidden;
|
|
131
|
-
white-space: nowrap;
|
|
132
|
-
text-overflow: ellipsis;
|
|
133
|
-
color: rgba(244, 247, 251, 0.62);
|
|
134
|
-
font-size: 15px;
|
|
135
|
-
line-height: 26px;
|
|
136
|
-
font-weight: 500;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
.hfp-shader-loader-track {
|
|
140
|
-
width: min(360px, 100%);
|
|
141
|
-
height: 8px;
|
|
142
|
-
overflow: hidden;
|
|
143
|
-
border-radius: 999px;
|
|
144
|
-
background: rgba(255, 255, 255, 0.1);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.hfp-shader-loader-fill {
|
|
148
|
-
width: 100%;
|
|
149
|
-
height: 100%;
|
|
150
|
-
border-radius: inherit;
|
|
151
|
-
background: linear-gradient(90deg, #06e3fa, #4fdb5e);
|
|
152
|
-
transform: scaleX(0);
|
|
153
|
-
transform-origin: left center;
|
|
154
|
-
transition: transform 160ms ease;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.hfp-shader-loader-progress {
|
|
158
|
-
width: min(420px, 100%);
|
|
159
|
-
height: 44px;
|
|
160
|
-
display: grid;
|
|
161
|
-
grid-template-rows: repeat(2, 22px);
|
|
162
|
-
color: rgba(244, 247, 251, 0.48);
|
|
163
|
-
font: 600 13px/22px "IBM Plex Mono", "SF Mono", "Fira Code", "Courier New", monospace;
|
|
164
|
-
font-variant-numeric: tabular-nums;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.hfp-shader-loader-row {
|
|
168
|
-
display: grid;
|
|
169
|
-
grid-template-columns: minmax(0, 1fr) 74px;
|
|
170
|
-
align-items: center;
|
|
171
|
-
column-gap: 20px;
|
|
172
|
-
width: 100%;
|
|
173
|
-
white-space: nowrap;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
.hfp-shader-loader-label {
|
|
177
|
-
min-width: 0;
|
|
178
|
-
overflow: hidden;
|
|
179
|
-
text-align: left;
|
|
180
|
-
text-overflow: ellipsis;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.hfp-shader-loader-value {
|
|
184
|
-
text-align: right;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
@keyframes hfp-shader-loader-sheen {
|
|
188
|
-
from {
|
|
189
|
-
background-position: 140% 0;
|
|
190
|
-
}
|
|
191
|
-
to {
|
|
192
|
-
background-position: -140% 0;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/* \u2500\u2500 Theming via CSS custom properties \u2500\u2500
|
|
197
|
-
*
|
|
198
|
-
* Override from outside the shadow DOM:
|
|
199
|
-
* hyperframes-player {
|
|
200
|
-
* --hfp-controls-bg: linear-gradient(transparent, rgba(0,0,0,0.9));
|
|
201
|
-
* --hfp-accent: #ff6b6b;
|
|
202
|
-
* --hfp-font: "Inter", sans-serif;
|
|
203
|
-
* }
|
|
204
|
-
*/
|
|
205
|
-
|
|
206
|
-
.hfp-controls {
|
|
207
|
-
position: absolute;
|
|
208
|
-
bottom: 0;
|
|
209
|
-
left: 0;
|
|
210
|
-
right: 0;
|
|
211
|
-
display: flex;
|
|
212
|
-
align-items: center;
|
|
213
|
-
gap: var(--hfp-controls-gap, 12px);
|
|
214
|
-
padding: var(--hfp-controls-padding, 8px 16px);
|
|
215
|
-
background: var(--hfp-controls-bg, linear-gradient(transparent, rgba(0, 0, 0, 0.7)));
|
|
216
|
-
color: var(--hfp-color, #fff);
|
|
217
|
-
font-family: var(--hfp-font, system-ui, -apple-system, sans-serif);
|
|
218
|
-
font-size: var(--hfp-font-size, 13px);
|
|
219
|
-
z-index: 10;
|
|
220
|
-
pointer-events: auto;
|
|
221
|
-
opacity: 1;
|
|
222
|
-
transition: opacity 0.3s ease;
|
|
223
|
-
user-select: none;
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
.hfp-controls.hfp-hidden {
|
|
227
|
-
opacity: 0;
|
|
228
|
-
pointer-events: none;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.hfp-play-btn {
|
|
232
|
-
background: none;
|
|
233
|
-
border: none;
|
|
234
|
-
color: var(--hfp-color, #fff);
|
|
235
|
-
cursor: pointer;
|
|
236
|
-
padding: 8px;
|
|
237
|
-
display: flex;
|
|
238
|
-
align-items: center;
|
|
239
|
-
justify-content: center;
|
|
240
|
-
width: 40px;
|
|
241
|
-
height: 40px;
|
|
242
|
-
flex-shrink: 0;
|
|
243
|
-
z-index: 10;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
.hfp-play-btn:hover {
|
|
247
|
-
opacity: 0.8;
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
.hfp-play-btn svg,
|
|
251
|
-
.hfp-play-btn svg * {
|
|
252
|
-
pointer-events: none;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
.hfp-scrubber {
|
|
256
|
-
flex: 1;
|
|
257
|
-
min-width: 0;
|
|
258
|
-
height: var(--hfp-scrubber-height, 4px);
|
|
259
|
-
background: var(--hfp-scrubber-bg, rgba(255, 255, 255, 0.3));
|
|
260
|
-
border-radius: var(--hfp-scrubber-radius, 2px);
|
|
261
|
-
cursor: pointer;
|
|
262
|
-
position: relative;
|
|
263
|
-
overflow: hidden;
|
|
264
|
-
}
|
|
265
|
-
|
|
266
|
-
.hfp-scrubber:hover {
|
|
267
|
-
height: var(--hfp-scrubber-height-hover, 6px);
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
.hfp-progress {
|
|
271
|
-
position: absolute;
|
|
272
|
-
top: 0;
|
|
273
|
-
left: 0;
|
|
274
|
-
height: 100%;
|
|
275
|
-
background: var(--hfp-accent, #fff);
|
|
276
|
-
pointer-events: none;
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
.hfp-time {
|
|
280
|
-
flex-shrink: 0;
|
|
281
|
-
font-variant-numeric: tabular-nums;
|
|
282
|
-
opacity: 0.9;
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
.hfp-speed-wrap {
|
|
286
|
-
position: relative;
|
|
287
|
-
flex-shrink: 0;
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
.hfp-speed-btn {
|
|
291
|
-
background: var(--hfp-speed-btn-bg, rgba(255, 255, 255, 0.15));
|
|
292
|
-
border: none;
|
|
293
|
-
border-radius: var(--hfp-speed-btn-radius, 4px);
|
|
294
|
-
color: var(--hfp-color, #fff);
|
|
295
|
-
cursor: pointer;
|
|
296
|
-
font-family: var(--hfp-font, system-ui, -apple-system, sans-serif);
|
|
297
|
-
font-size: 12px;
|
|
298
|
-
font-variant-numeric: tabular-nums;
|
|
299
|
-
font-weight: 600;
|
|
300
|
-
padding: 4px 8px;
|
|
301
|
-
min-width: 40px;
|
|
302
|
-
text-align: center;
|
|
303
|
-
transition: background 0.15s ease;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
.hfp-speed-btn:hover {
|
|
307
|
-
background: var(--hfp-speed-btn-bg-hover, rgba(255, 255, 255, 0.3));
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
.hfp-speed-menu {
|
|
311
|
-
position: absolute;
|
|
312
|
-
bottom: calc(100% + 8px);
|
|
313
|
-
right: 0;
|
|
314
|
-
background: var(--hfp-menu-bg, rgba(20, 20, 20, 0.95));
|
|
315
|
-
backdrop-filter: blur(12px);
|
|
316
|
-
-webkit-backdrop-filter: blur(12px);
|
|
317
|
-
border: 1px solid var(--hfp-menu-border, rgba(255, 255, 255, 0.1));
|
|
318
|
-
border-radius: var(--hfp-menu-radius, 8px);
|
|
319
|
-
padding: 4px;
|
|
320
|
-
display: flex;
|
|
321
|
-
flex-direction: column;
|
|
322
|
-
gap: 2px;
|
|
323
|
-
min-width: 80px;
|
|
324
|
-
opacity: 0;
|
|
325
|
-
visibility: hidden;
|
|
326
|
-
transform: translateY(4px);
|
|
327
|
-
transition: opacity 0.15s ease, transform 0.15s ease, visibility 0.15s;
|
|
328
|
-
box-shadow: var(--hfp-menu-shadow, 0 8px 24px rgba(0, 0, 0, 0.4));
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
.hfp-speed-menu.hfp-open {
|
|
332
|
-
opacity: 1;
|
|
333
|
-
visibility: visible;
|
|
334
|
-
transform: translateY(0);
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
.hfp-speed-option {
|
|
338
|
-
background: none;
|
|
339
|
-
border: none;
|
|
340
|
-
border-radius: 4px;
|
|
341
|
-
color: var(--hfp-menu-color, rgba(255, 255, 255, 0.7));
|
|
342
|
-
cursor: pointer;
|
|
343
|
-
font-family: var(--hfp-font, system-ui, -apple-system, sans-serif);
|
|
344
|
-
font-size: 13px;
|
|
345
|
-
font-variant-numeric: tabular-nums;
|
|
346
|
-
padding: 6px 12px;
|
|
347
|
-
text-align: left;
|
|
348
|
-
transition: background 0.1s ease, color 0.1s ease;
|
|
349
|
-
white-space: nowrap;
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
.hfp-speed-option:hover {
|
|
353
|
-
background: var(--hfp-menu-hover-bg, rgba(255, 255, 255, 0.1));
|
|
354
|
-
color: var(--hfp-color, #fff);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
.hfp-speed-option.hfp-active {
|
|
358
|
-
color: var(--hfp-accent, #fff);
|
|
359
|
-
font-weight: 600;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
|
-
.hfp-volume-wrap {
|
|
363
|
-
position: relative;
|
|
364
|
-
flex-shrink: 0;
|
|
365
|
-
display: flex;
|
|
366
|
-
align-items: center;
|
|
367
|
-
gap: 0;
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
.hfp-mute-btn {
|
|
371
|
-
background: none;
|
|
372
|
-
border: none;
|
|
373
|
-
color: var(--hfp-color, #fff);
|
|
374
|
-
cursor: pointer;
|
|
375
|
-
padding: 4px;
|
|
376
|
-
display: flex;
|
|
377
|
-
align-items: center;
|
|
378
|
-
justify-content: center;
|
|
379
|
-
width: 32px;
|
|
380
|
-
height: 32px;
|
|
381
|
-
flex-shrink: 0;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
.hfp-mute-btn:hover {
|
|
385
|
-
opacity: 0.8;
|
|
386
|
-
}
|
|
387
|
-
|
|
388
|
-
.hfp-mute-btn svg,
|
|
389
|
-
.hfp-mute-btn svg * {
|
|
390
|
-
pointer-events: none;
|
|
391
|
-
}
|
|
392
|
-
|
|
393
|
-
.hfp-volume-slider-wrap {
|
|
394
|
-
width: 0;
|
|
395
|
-
overflow: hidden;
|
|
396
|
-
transition: width 0.2s ease;
|
|
397
|
-
display: flex;
|
|
398
|
-
align-items: center;
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
.hfp-volume-wrap:hover .hfp-volume-slider-wrap {
|
|
402
|
-
width: 64px;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
.hfp-volume-slider {
|
|
406
|
-
width: 56px;
|
|
407
|
-
height: var(--hfp-scrubber-height, 4px);
|
|
408
|
-
background: var(--hfp-scrubber-bg, rgba(255, 255, 255, 0.3));
|
|
409
|
-
border-radius: var(--hfp-scrubber-radius, 2px);
|
|
410
|
-
cursor: pointer;
|
|
411
|
-
position: relative;
|
|
412
|
-
overflow: hidden;
|
|
413
|
-
margin-left: 4px;
|
|
414
|
-
margin-right: 4px;
|
|
415
|
-
}
|
|
416
|
-
|
|
417
|
-
.hfp-volume-fill {
|
|
418
|
-
position: absolute;
|
|
419
|
-
top: 0;
|
|
420
|
-
left: 0;
|
|
421
|
-
height: 100%;
|
|
422
|
-
background: var(--hfp-accent, #fff);
|
|
423
|
-
pointer-events: none;
|
|
424
|
-
}
|
|
425
|
-
`,se='<svg width="24" height="24" viewBox="0 0 18 18" fill="currentColor"><polygon points="4,2 16,9 4,16"/></svg>',ye='<svg width="24" height="24" viewBox="0 0 18 18" fill="currentColor"><rect x="3" y="2" width="4" height="14"/><rect x="11" y="2" width="4" height="14"/></svg>',ne='<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3z"/><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/><path d="M14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"/></svg>',oe='<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3z"/><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z"/></svg>',we='<svg width="20" height="20" viewBox="0 0 24 24" fill="currentColor"><path d="M3 9v6h4l5 5V4L7 9H3z"/><path d="M16.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02z" opacity="0.3"/><line x1="18" y1="7" x2="14" y2="17" stroke="currentColor" stroke-width="2"/></svg>',ke=[.25,.5,1,1.5,2,4];function z(e){return Number.isInteger(e)?`${e}x`:`${e}x`}function le(e){if(!Number.isFinite(e)||e<0)return"0:00";let t=Math.floor(e),i=Math.floor(t/60),r=t%60;return`${i}:${r.toString().padStart(2,"0")}`}function Ae(e,t,i={}){let r=i.speedPresets??ke,a=document.createElement("div");a.className="hfp-controls",a.addEventListener("click",n=>{n.stopPropagation()});let s=document.createElement("button");s.className="hfp-play-btn",s.type="button",s.innerHTML=se,s.setAttribute("aria-label","Play");let o=document.createElement("div");o.className="hfp-scrubber";let d=document.createElement("div");d.className="hfp-progress",d.style.width="0%",o.appendChild(d);let u=document.createElement("span");u.className="hfp-time",u.textContent="0:00 / 0:00";let h=document.createElement("div");h.className="hfp-speed-wrap";let c=document.createElement("button");c.className="hfp-speed-btn",c.type="button",c.textContent="1x",c.setAttribute("aria-label","Playback speed");let _=document.createElement("div");_.className="hfp-speed-menu",_.setAttribute("role","menu");for(let n of r){let l=document.createElement("button");l.className="hfp-speed-option",l.type="button",l.setAttribute("role","menuitem"),l.dataset.speed=String(n),l.textContent=z(n),n===1&&l.classList.add("hfp-active"),_.appendChild(l)}h.appendChild(_),h.appendChild(c);let g=document.createElement("div");g.className="hfp-volume-wrap";let m=document.createElement("button");m.className="hfp-mute-btn",m.type="button",m.innerHTML=ne,m.setAttribute("aria-label","Mute");let b=document.createElement("div");b.className="hfp-volume-slider-wrap";let p=document.createElement("div");p.className="hfp-volume-slider",p.setAttribute("role","slider"),p.setAttribute("aria-label","Volume"),p.setAttribute("aria-valuemin","0"),p.setAttribute("aria-valuemax","100"),p.setAttribute("aria-valuenow","100"),p.tabIndex=0;let v=document.createElement("div");v.className="hfp-volume-fill",v.style.width="100%",p.appendChild(v),b.appendChild(p),g.appendChild(b),g.appendChild(m),i.audioLocked&&(g.style.display="none"),a.appendChild(s),a.appendChild(o),a.appendChild(u),a.appendChild(g),a.appendChild(h),e.appendChild(a);let L=!1,k=!1,w=1,x=null,S=r.indexOf(1);S===-1&&(S=0);let P=(n,l)=>n?we:l===0||l<.5?oe:ne;s.addEventListener("click",n=>{n.stopPropagation(),L?t.onPause():t.onPlay()}),m.addEventListener("click",n=>{n.stopPropagation(),t.onMuteToggle()});let A=!1,I=n=>{let l=p.getBoundingClientRect(),f=Math.max(0,Math.min(1,(n-l.left)/l.width));w=f,v.style.width=`${f*100}%`,p.setAttribute("aria-valuenow",String(Math.round(f*100))),k&&f>0&&t.onMuteToggle(),m.innerHTML=P(k,f),t.onVolumeChange(f)};p.addEventListener("mousedown",n=>{n.stopPropagation(),A=!0,I(n.clientX)});let q=n=>{A&&I(n.clientX)},W=()=>{A=!1};document.addEventListener("mousemove",q),document.addEventListener("mouseup",W),p.addEventListener("touchstart",n=>{A=!0;let l=n.touches[0];l&&I(l.clientX)},{passive:!0});let X=n=>{if(A){let l=n.touches[0];l&&I(l.clientX)}},G=()=>{A=!1};document.addEventListener("touchmove",X,{passive:!0}),document.addEventListener("touchend",G);let Y=.05;p.addEventListener("keydown",n=>{let l=w;if(n.key==="ArrowRight"||n.key==="ArrowUp")l=Math.min(1,w+Y);else if(n.key==="ArrowLeft"||n.key==="ArrowDown")l=Math.max(0,w-Y);else return;n.preventDefault(),n.stopPropagation(),w=l,v.style.width=`${l*100}%`,p.setAttribute("aria-valuenow",String(Math.round(l*100))),k&&l>0&&t.onMuteToggle(),m.innerHTML=P(k,l),t.onVolumeChange(l)});let J=n=>{for(let l of _.querySelectorAll(".hfp-speed-option"))l.classList.toggle("hfp-active",l.dataset.speed===String(n))};c.addEventListener("click",n=>{n.stopPropagation();let l=_.classList.toggle("hfp-open");c.setAttribute("aria-expanded",String(l))}),_.addEventListener("click",n=>{n.stopPropagation();let l=n.target.closest(".hfp-speed-option");if(!l)return;let f=parseFloat(l.dataset.speed);S=r.indexOf(f),c.textContent=z(f),J(f),_.classList.remove("hfp-open"),c.setAttribute("aria-expanded","false"),t.onSpeedChange(f)});let Z=()=>{_.classList.remove("hfp-open"),c.setAttribute("aria-expanded","false")};document.addEventListener("click",Z);let R=n=>{let l=o.getBoundingClientRect(),f=Math.max(0,Math.min(1,(n-l.left)/l.width));t.onSeek(f)},E=!1;o.addEventListener("mousedown",n=>{n.stopPropagation(),E=!0,R(n.clientX)});let Q=n=>{E&&R(n.clientX)},K=()=>{E=!1};document.addEventListener("mousemove",Q),document.addEventListener("mouseup",K),o.addEventListener("touchstart",n=>{E=!0;let l=n.touches[0];l&&R(l.clientX)},{passive:!0});let ee=n=>{if(E){let l=n.touches[0];l&&R(l.clientX)}},te=()=>{E=!1};document.addEventListener("touchmove",ee,{passive:!0}),document.addEventListener("touchend",te);let ie=()=>{x&&clearTimeout(x),x=setTimeout(()=>{L&&a.classList.add("hfp-hidden")},3e3)},N=e instanceof ShadowRoot?e.host:e,re=()=>{a.classList.remove("hfp-hidden"),ie()},ae=()=>{L&&a.classList.add("hfp-hidden")};return N.addEventListener("mousemove",re),N.addEventListener("mouseleave",ae),{updateTime(n,l){let f=l>0?Math.min(n,l):n,pe=l>0?f/l*100:0;d.style.width=`${pe}%`,u.textContent=`${le(f)} / ${le(l)}`},updatePlaying(n){L=n,s.innerHTML=n?ye:se,s.setAttribute("aria-label",n?"Pause":"Play"),n?ie():a.classList.remove("hfp-hidden")},updateSpeed(n){let l=r.indexOf(n);l!==-1&&(S=l),c.textContent=z(n),J(n)},updateMuted(n){k=n,m.innerHTML=P(n,w),m.setAttribute("aria-label",n?"Unmute":"Mute")},updateVolume(n){w=n,v.style.width=`${n*100}%`,p.setAttribute("aria-valuenow",String(Math.round(n*100))),m.innerHTML=P(k,n)},setVolumeControlsHidden(n){g.style.display=n?"none":""},show(){a.style.display=""},hide(){a.style.display="none"},destroy(){document.removeEventListener("mousemove",Q),document.removeEventListener("mouseup",K),document.removeEventListener("touchmove",ee),document.removeEventListener("touchend",te),document.removeEventListener("mousemove",q),document.removeEventListener("mouseup",W),document.removeEventListener("touchmove",X),document.removeEventListener("touchend",G),document.removeEventListener("click",Z),N.removeEventListener("mousemove",re),N.removeEventListener("mouseleave",ae),x&&clearTimeout(x),a.remove()}}}function Ee(e,t,i,r,a,s=!1){let o=r?r.split(",").map(Number).filter(h=>!isNaN(h)&&h>0):void 0,d={...o?{speedPresets:o}:{},audioLocked:s},u=Ae(e,a,d);return u.updateMuted(t),u.updateVolume(i),u}function de(e,t,i){return t?(i||(i=document.createElement("img"),i.className="hfp-poster",e.appendChild(i)),i.src=t,i):(i?.remove(),null)}function Ce(e){return e.composedPath().some(t=>t instanceof HTMLElement&&t.classList.contains("hfp-controls"))}var F=null;function xe(e,t){if(typeof CSSStyleSheet<"u")try{F||(F=new CSSStyleSheet,F.replaceSync(t)),e.adoptedStyleSheets=[F];return}catch{}let i=document.createElement("style");i.textContent=t,e.appendChild(i)}function Te(){let e=document.createElement("div");e.className="hfp-container";let t=document.createElement("iframe");return t.className="hfp-iframe",t.sandbox.add("allow-scripts","allow-same-origin"),t.allow="autoplay; fullscreen",t.referrerPolicy="no-referrer",t.title="HyperFrames Composition",e.appendChild(t),{container:e,iframe:t}}function Me(e,t,i,r){let a=e.offsetWidth,s=e.offsetHeight;if(a===0||s===0)return;let o=Math.min(a/i,s/r);t.style.width=`${i}px`,t.style.height=`${r}px`,t.style.transform=`translate(-50%, -50%) scale(${o})`}var Le=class{constructor(e){this._callbacks=e}_callbacks;_raf=null;_lastUpdateMs=0;start(e,t,i,r){this.stop();let a=()=>{if(r()){this._raf=null;return}let s;try{s=e.time()}catch{this._raf=null;return}let o=i();o>0&&(s=Math.min(s,o));let d=o>0&&s>=o,u=performance.now();if((u-this._lastUpdateMs>100||d)&&(this._lastUpdateMs=u,this._callbacks.onTimeUpdate(s,o)),d){if(this._callbacks.getLoop()){this._callbacks.restart();return}try{e.pause()}catch{}this._callbacks.onPaused(),this._raf=null;return}this._raf=requestAnimationFrame(a)};this._raf=requestAnimationFrame(a)}stop(){this._raf!==null&&(cancelAnimationFrame(this._raf),this._raf=null)}get isRunning(){return this._raf!==null}};function Se(e){let t=Array.from(e.querySelectorAll("[data-composition-id]"));if(t.length===0)return e.body?[e.body]:[];let i=[];for(let r of t)Ie(r)||i.push(r);return Pe(e),i}function Pe(e){let t=e.body;if(!t||typeof console>"u"||typeof console.warn!="function")return;let i=t.querySelectorAll("audio[data-start], video[data-start]");if(i.length===0)return;let r=[];for(let a of i)a.closest("[data-composition-id]")||r.push(a);r.length!==0&&console.warn(`[hyperframes-player] selectMediaObserverTargets: composition hosts are present, but ${r.length} body-level timed media element(s) sit outside every [data-composition-id] subtree and will not be observed. Move them inside a composition host or the parent-frame proxy will never adopt them.`,r)}function Ie(e){let t=e.parentElement;for(;t;){if(t.hasAttribute("data-composition-id"))return!0;t=t.parentElement}return!1}function j(e){let t=e.ownerDocument?.defaultView;return t&&e instanceof t.Element?!0:e instanceof Element}function y(e){if(!j(e)||e.tagName!=="AUDIO"&&e.tagName!=="VIDEO")return!1;let t=e.ownerDocument?.defaultView;return t&&e instanceof t.HTMLMediaElement?!0:e instanceof HTMLMediaElement}var Re=.05,Ne=2,Fe=class{_entries=[];_mediaObserver;_playbackErrorPosted=!1;_audioOwner="runtime";_urlAudioEntry=null;_urlAudioSrc=null;_dispatchEvent;_getMuted;_getVolume;_getPlaybackRate;_getCurrentTime;_isPaused;constructor(e){this._dispatchEvent=e.dispatchEvent,this._getMuted=e.getMuted,this._getVolume=e.getVolume,this._getPlaybackRate=e.getPlaybackRate,this._getCurrentTime=e.getCurrentTime,this._isPaused=e.isPaused}get audioOwner(){return this._audioOwner}get entries(){return this._entries}resetForIframeLoad(){this._playbackErrorPosted=!1;let e=this._audioOwner==="parent";this._audioOwner="runtime",this.pauseAll(),this.teardownObserver(),e&&this._dispatchEvent(new CustomEvent("audioownershipchange",{detail:{owner:"runtime",reason:"iframe-reload"}}))}destroy(){this.teardownObserver();for(let e of this._entries)e.el.pause(),e.el.src="";this._entries=[],this._urlAudioEntry=null,this._urlAudioSrc=null}updateMuted(e){for(let t of this._entries)t.el.muted=e}updateVolume(e){for(let t of this._entries)t.el.volume=e}updatePlaybackRate(e){for(let t of this._entries)t.el.playbackRate=e}_playEntry(e){e.el.src&&e.el.play().catch(t=>this._reportPlaybackError(t))}_playEntryIfActive(e){this._refreshEntryBounds(e);let t=this._getCurrentTime()-e.start;t<0||t>=e.duration||this._playEntry(e)}_refreshEntryBounds(e){if(!e.source?.isConnected)return;let t=parseFloat(e.source.getAttribute("data-start")||"0");e.start=Number.isFinite(t)?t:0;let i=parseFloat(e.source.getAttribute("data-duration")||"");e.duration=Number.isFinite(i)&&i>0?i:Number.POSITIVE_INFINITY}_gateEntryPlayback(e,t){return t<0||t>=e.duration?(e.el.paused||e.el.pause(),e.driftSamples=0,!1):(this._audioOwner==="parent"&&!this._isPaused()&&e.el.paused&&this._playEntry(e),!0)}playAll(){for(let e of this._entries)this._playEntryIfActive(e)}pauseAll(){for(let e of this._entries)e.el.pause()}stopAdoptedMedia(){for(let e of this._entries)e.source&&e.el.pause()}seekAll(e){for(let t of this._entries){this._refreshEntryBounds(t);let i=e-t.start;i>=0&&i<t.duration&&(t.el.currentTime=i)}}mirrorTime(e,t){let i=t?.force===!0;for(let r of this._entries){this._refreshEntryBounds(r);let a=e-r.start;this._gateEntryPlayback(r,a)&&(Math.abs(r.el.currentTime-a)>Re?(r.driftSamples+=1,(i||r.driftSamples>=Ne)&&(r.el.currentTime=a,r.driftSamples=0)):r.driftSamples=0)}}promoteToParentProxy(e,t){if(this._audioOwner==="parent")return;if(this._audioOwner="parent",e)for(let r of e.querySelectorAll("video, audio"))y(r)&&(r.muted=!0);let i=this._getCurrentTime();t?t(i,{force:!0}):this.mirrorTime(i,{force:!0}),this._isPaused()||this.playAll(),this._dispatchEvent(new CustomEvent("audioownershipchange",{detail:{owner:"parent",reason:"autoplay-blocked"}}))}setupFromIframe(e){let t=e.querySelectorAll("audio[data-start], video[data-start]");for(let i of t)y(i)&&this._adoptIframeMedia(i);this._observeDynamicMedia(e)}setupFromUrl(e){if(this._urlAudioSrc===e&&this._urlAudioEntry)return;this.teardownUrlAudio();let t=this._createEntry(e,"audio",0,1/0);this._urlAudioEntry=t,this._urlAudioSrc=t?e:null,t&&this._audioOwner==="parent"&&!this._isPaused()&&(this.mirrorTime(this._getCurrentTime(),{force:!0}),this.playAll())}teardownUrlAudio(){let e=this._urlAudioEntry;if(this._urlAudioEntry=null,this._urlAudioSrc=null,!e)return;e.el.pause(),e.el.src="";let t=this._entries.indexOf(e);t!==-1&&this._entries.splice(t,1)}teardownObserver(){this._mediaObserver?.disconnect(),this._mediaObserver=void 0}_reportPlaybackError(e){this._playbackErrorPosted||(this._playbackErrorPosted=!0,this._dispatchEvent(new CustomEvent("playbackerror",{detail:{source:"parent-proxy",error:e}})))}_createEntry(e,t,i,r,a){if(this._entries.some(u=>u.el.src===e))return null;let s=t==="video"?document.createElement("video"):new Audio;s.preload="auto",s.src=e,s.load(),s.muted=this._getMuted(),s.volume=this._getVolume();let o=this._getPlaybackRate();o!==1&&(s.playbackRate=o);let d={el:s,start:i,duration:r,driftSamples:0,source:a};return this._entries.push(d),d}_resolveIframeMediaSrc(e){let t=e.getAttribute("src")||e.querySelector("source")?.getAttribute("src");return t?new URL(t,e.ownerDocument.baseURI).href:null}_adoptIframeMedia(e){if(e.preload==="metadata"||e.preload==="none")return;let t=this._resolveIframeMediaSrc(e);if(!t)return;let i=parseFloat(e.getAttribute("data-start")||"0"),r=parseFloat(e.getAttribute("data-duration")||"Infinity"),a=e.tagName==="VIDEO"?"video":"audio",s=this._createEntry(t,a,i,r,e);s&&this._audioOwner==="parent"&&(this.mirrorTime(this._getCurrentTime(),{force:!0}),this._isPaused()||this._playEntryIfActive(s))}_detachIframeMedia(e){let t=this._resolveIframeMediaSrc(e);if(!t)return;let i=this._entries.findIndex(a=>a.el.src===t);if(i===-1)return;let r=this._entries[i];r.el.pause(),r.el.src="",this._entries.splice(i,1)}_observeDynamicMedia(e){if(this.teardownObserver(),typeof MutationObserver>"u"||!e.body)return;let t=new MutationObserver(a=>{for(let s of a){if(s.type==="attributes"&&s.attributeName==="preload"){let o=s.target;y(o)&&o.matches("audio[data-start], video[data-start]")&&o.preload==="auto"&&this._adoptIframeMedia(o);continue}for(let o of s.addedNodes){if(!j(o))continue;let d=[];y(o)&&o.matches("audio[data-start], video[data-start]")&&d.push(o);let u=o.querySelectorAll("audio[data-start], video[data-start]");for(let h of u)y(h)&&d.push(h);for(let h of d)this._adoptIframeMedia(h)}for(let o of s.removedNodes){if(!j(o))continue;let d=[];y(o)&&o.matches("audio[data-start], video[data-start]")&&d.push(o);let u=o.querySelectorAll("audio[data-start], video[data-start]");for(let h of u)y(h)&&d.push(h);for(let h of d)this._detachIframeMedia(h)}}}),i={childList:!0,subtree:!0,attributes:!0,attributeFilter:["preload"]},r=Se(e);for(let a of r)t.observe(a,i);this._mediaObserver=t}};function Oe(e,t,i,r){let a=(e.frame??0)/t,s=i.duration>0?Math.min(a,i.duration):a,o=!i.paused,d=!e.isPlaying,u=i.duration>0&&s>=i.duration&&(o||e.isPlaying);if(u&&r.getLoop())return r.media.audioOwner==="parent"&&r.media.pauseAll(),r.seek(0),r.play(),{...i,currentTime:s,paused:!1};let h={...i,currentTime:s,paused:d};r.media.audioOwner==="parent"&&(o&&d?r.media.pauseAll():!o&&!d&&r.media.playAll(),r.media.mirrorTime(s));let c=performance.now(),_=d!==i.paused;return(c-i.lastUpdateMs>100||_)&&(h.lastUpdateMs=c,r.updateControlsTime(s,i.duration),r.updateControlsPlaying(!d),r.dispatchEvent(new CustomEvent("timeupdate",{detail:{currentTime:s}}))),u&&(r.media.audioOwner==="parent"&&r.media.pauseAll(),h.paused=!0,r.updateControlsPlaying(!1),r.dispatchEvent(new Event("ended"))),h}var he=30;function De(e){return Array.isArray(e)?e.filter(t=>typeof t=="object"&&t!==null&&typeof t.id=="string"&&typeof t.start=="number"&&typeof t.duration=="number"):[]}function $e(e,t,i){if(e.source!==t)return;let r=e.data;if(!(!r||r.source!=="hf-preview")){if(r.type==="shader-transition-state"){let a=r.state&&typeof r.state=="object"?r.state:{};i.shaderLoader.update(a,i.getShaderLoadingMode()),i.dispatchEvent(new CustomEvent("shadertransitionstate",{detail:{compositionId:r.compositionId,state:a}}));return}if(r.type==="ready"){i.onRuntimeReady();return}if(r.type==="state"){i.setPlaybackState(Oe({frame:r.frame??0,isPlaying:!!r.isPlaying},he,i.getPlaybackState(),i));return}if(r.type==="media-autoplay-blocked"){if(i.shouldPromoteMediaAutoplayFallback?.()===!1)return;let a=null;try{a=i.getIframeDoc()}catch{}i.media.promoteToParentProxy(a,(s,o)=>i.media.mirrorTime(s,o)),i.sendControl("set-media-output-muted",{muted:!0});return}if(r.type==="timeline"&&r.durationInFrames>0){if(Number.isFinite(r.durationInFrames)){let a=i.getPlaybackState(),s=r.durationInFrames/he;i.setPlaybackState({...a,duration:s}),i.updateControlsTime(a.currentTime,s),i.onRuntimeTimelineReady(s)}i.setScenes(De(r.scenes));return}r.type==="stage-size"&&Number.isFinite(r.width)&&r.width>0&&Number.isFinite(r.height)&&r.height>0&&i.setCompositionSize(r.width,r.height)}}var C="shader-capture-scale",T="shader-loading",ze="__hf_shader_capture_scale",He="__hf_shader_loading",O=["Preparing scene transitions","Sampling outgoing scene motion","Sampling incoming scene motion","Caching transition frames","Finalizing transition preview"];function B(e){if(e===null)return null;let t=Number(e);return!Number.isFinite(t)||t<=0?null:String(Math.min(1,Math.max(.25,t)))}function Ue(e){if(e===null||e.trim()==="")return"composition";let t=e.trim().toLowerCase();return t==="none"||t==="false"||t==="0"||t==="off"?"none":t==="player"||t==="true"||t==="1"||t==="on"?"player":"composition"}function ue(e,t,i){i===null?e.delete(t):e.set(t,i)}function Ve(e,t,i){let r=e.indexOf("#"),a=r>=0?e.slice(0,r):e,s=r>=0?e.slice(r):"",o=a.indexOf("?"),d=o>=0?a.slice(0,o):a,u=o>=0?a.slice(o+1):"",h=new URLSearchParams(u);ue(h,ze,t),ue(h,He,i==="composition"?null:i);let c=h.toString();return`${d}${c?`?${c}`:""}${s}`}function je(e,t,i){if(t===null&&i==="composition")return e;let r=[];t!==null&&r.push(`window.__HF_SHADER_CAPTURE_SCALE=${JSON.stringify(t)};`),i!=="composition"&&r.push(`window.__HF_SHADER_LOADING=${JSON.stringify(i)};`);let a=`<script data-hyperframes-player-shader-options>${r.join("")}<\/script>`;return/<head\b[^>]*>/i.test(e)?e.replace(/<head\b[^>]*>/i,s=>`${s}${a}`):/<html\b[^>]*>/i.test(e)?e.replace(/<html\b[^>]*>/i,s=>`${s}${a}`):`${a}${e}`}function M(e){return Ue(e.getAttribute(T))}function Be(e){return Number(B(e.getAttribute(C))??"1")}function H(e,t){return Ve(t,B(e.getAttribute(C)),M(e))}function U(e,t){return je(t,B(e.getAttribute(C)),M(e))}function qe(){let e=document.createElement("div");e.className="hfp-shader-loader",e.setAttribute("role","status"),e.setAttribute("aria-live","polite"),e.setAttribute("aria-label","Preparing scene transitions"),e.setAttribute("data-hyperframes-ignore",""),e.draggable=!1;let t=m=>{m.preventDefault(),m.stopPropagation()};for(let m of["selectstart","dragstart","pointerdown","mousedown","click","dblclick","contextmenu","touchstart"])e.addEventListener(m,t,{capture:!0});let i=document.createElement("div");i.className="hfp-shader-loader-panel",i.draggable=!1;let r=document.createElement("div");r.className="hfp-shader-loader-mark",r.draggable=!1,r.innerHTML=['<svg width="78" height="78" viewBox="0 0 100 100" fill="none" aria-hidden="true" draggable="false">','<path d="M10.1851 57.8021L33.1145 73.8313C36.2202 75.9978 41.5173 73.5433 42.4816 69.4984L51.7611 30.4271C52.7253 26.3822 48.5802 23.9277 44.4602 26.0942L13.917 42.1235C6.96677 45.7676 4.97564 54.1579 10.1851 57.8021Z" fill="url(#hfp-shader-loader-grad-left)"/>','<path d="M87.5129 57.5141L56.9696 73.5433C52.8371 75.7098 48.7046 73.2553 49.6688 69.2104L58.9483 30.1391C59.9125 26.0942 65.2097 23.6397 68.3154 25.8062L91.2447 41.8354C96.4668 45.4796 94.4631 53.8699 87.5129 57.5141Z" fill="url(#hfp-shader-loader-grad-right)"/>',"<defs>",'<linearGradient id="hfp-shader-loader-grad-left" x1="48.5676" y1="25" x2="44.7804" y2="71.9384" gradientUnits="userSpaceOnUse">','<stop stop-color="#06E3FA"/>','<stop offset="1" stop-color="#4FDB5E"/>',"</linearGradient>",'<linearGradient id="hfp-shader-loader-grad-right" x1="54.8282" y1="73.8392" x2="72.0989" y2="32.8932" gradientUnits="userSpaceOnUse">','<stop stop-color="#06E3FA"/>','<stop offset="1" stop-color="#4FDB5E"/>',"</linearGradient>","</defs>","</svg>"].join("");let a=document.createElement("div");a.className="hfp-shader-loader-title";let s=document.createElement("span");s.className="hfp-shader-loader-title-text",s.textContent=O[0]||"Preparing scene transitions",a.appendChild(s);let o=document.createElement("div");o.className="hfp-shader-loader-detail",o.textContent="Rendering animated scene samples for shader transitions.";let d=document.createElement("div");d.className="hfp-shader-loader-track",d.setAttribute("aria-hidden","true");let u=document.createElement("div");u.className="hfp-shader-loader-fill",d.appendChild(u);let h=document.createElement("div");h.className="hfp-shader-loader-progress";let c=m=>{let b=document.createElement("div");b.className="hfp-shader-loader-row";let p=document.createElement("span");p.className="hfp-shader-loader-label",p.textContent=m;let v=document.createElement("span");return v.className="hfp-shader-loader-value",b.appendChild(p),b.appendChild(v),h.appendChild(b),{row:b,label:p,value:v}},_=c("transition"),g=c("transition frame");return i.appendChild(r),i.appendChild(a),i.appendChild(o),i.appendChild(d),i.appendChild(h),e.appendChild(i),{root:e,fill:u,title:s,detail:o,transitionValue:_.value,frameLabel:g.label,frameValue:g.value,frameRow:g.row}}var We=420,Xe=class{_el;_hideTimeout=null;constructor(e){this._el=e}show(){this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null),this._el.root.classList.remove("hfp-hiding"),this._el.root.classList.add("hfp-visible")}hide(){if(this._el.root.classList.contains("hfp-hiding")){this._hideTimeout||this._scheduleCleanup();return}this._el.root.classList.contains("hfp-visible")&&(this._el.root.classList.add("hfp-hiding"),this._el.root.classList.remove("hfp-visible"),this._scheduleCleanup())}reset(){this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null),this._el.root.classList.remove("hfp-visible","hfp-hiding"),this._el.fill.style.transform="scaleX(0)",this._el.transitionValue.textContent="",this._el.frameValue.textContent="",this._el.frameRow.style.visibility="hidden"}update(e,t){if(t!=="player"){this.reset();return}if(e.ready||!e.loading){this.hide();return}let i=typeof e.progress=="number"&&Number.isFinite(e.progress)?e.progress:0,r=typeof e.total=="number"&&Number.isFinite(e.total)?e.total:0,a=r>0?Math.min(1,Math.max(0,i/r)):0,s=Math.min(O.length-1,Math.floor(a*O.length));this._el.title.textContent=O[s]||"Preparing scene transitions",this._el.detail.textContent=e.phase==="cached"?"Loading cached transition frames before playback.":e.phase==="finalizing"?"Uploading transition textures for smooth playback.":"Rendering animated scene samples for shader transitions.",this._el.fill.style.transform=`scaleX(${a})`,this._el.transitionValue.textContent=e.currentTransition!==void 0&&e.transitionTotal!==void 0?`${e.currentTransition}/${e.transitionTotal}`:r>0?`${i}/${r}`:"";let o=e.transitionFrame!==void 0&&e.transitionFrames!==void 0?`${e.transitionFrame}/${e.transitionFrames}`:"";this._el.frameLabel.textContent=e.phase==="cached"?"cached transition frames":e.phase==="finalizing"?"finalizing transition frames":"rendering transition frames",this._el.frameValue.textContent=o,this._el.frameRow.style.visibility=o?"visible":"hidden",this._el.root.setAttribute("aria-valuenow",String(Math.round(a*100))),this.show()}get hideTimeout(){return this._hideTimeout}destroy(){this._hideTimeout&&(clearTimeout(this._hideTimeout),this._hideTimeout=null)}_scheduleCleanup(){this._hideTimeout&&clearTimeout(this._hideTimeout),this._hideTimeout=setTimeout(()=>{this._el.root.classList.remove("hfp-hiding"),this._hideTimeout=null},We)}},Ge=.1,Ye=5;function V(e){return!Number.isFinite(e)||e<=0?1:Math.max(Ge,Math.min(Ye,e))}var Je=class extends HTMLElement{static get observedAttributes(){return["src","srcdoc","width","height","controls","muted","audio-locked","volume","poster","playback-rate","audio-src",C,T]}shadow;container;iframe;posterEl=null;controlsApi=null;resizeObserver;shaderLoader;probe;_ready=!1;_currentTime=0;_duration=0;_paused=!0;_lastUpdateMs=0;_volume=1;_compositionWidth=1920;_compositionHeight=1080;_directTimelineAdapter=null;_directTimelineClock;_parentTickRaf=null;_media;_scenes=[];constructor(){super(),this.shadow=this.attachShadow({mode:"open"}),xe(this.shadow,be),{container:this.container,iframe:this.iframe}=Te(),this.shadow.appendChild(this.container);let e=qe();this.shadow.appendChild(e.root),this.shaderLoader=new Xe(e),this._media=new Fe({dispatchEvent:t=>this.dispatchEvent(t),getMuted:()=>this.muted,getVolume:()=>this._volume,getPlaybackRate:()=>this.playbackRate,getCurrentTime:()=>this._currentTime,isPaused:()=>this._paused}),this._directTimelineClock=new Le({onTimeUpdate:(t,i)=>{this._currentTime=t,this.controlsApi?.updateTime(t,i),this.dispatchEvent(new CustomEvent("timeupdate",{detail:{currentTime:t}}))},getLoop:()=>this.loop,restart:()=>{this.seek(0),this.play()},onPaused:()=>{this._media.audioOwner==="parent"&&this._media.pauseAll(),this._paused=!0,this.controlsApi?.updatePlaying(!1),this.dispatchEvent(new Event("ended"))},onEnded:()=>this.loop}),this.probe=new ve(this.iframe,{onReady:t=>this._onProbeReady(t),onError:t=>this.dispatchEvent(new CustomEvent("error",{detail:{message:t}}))}),this.addEventListener("click",t=>{Ce(t)||(this._paused?this.play():this.pause())}),this.resizeObserver=new ResizeObserver(()=>this._rescale()),this._onMessage=this._onMessage.bind(this),this._onIframeLoad=this._onIframeLoad.bind(this)}connectedCallback(){this.resizeObserver.observe(this),window.addEventListener("message",this._onMessage),this.iframe.addEventListener("load",this._onIframeLoad),this.hasAttribute("controls")&&this._setupControls(),this.hasAttribute("poster")&&(this.posterEl=de(this.shadow,this.getAttribute("poster"),this.posterEl)),this.hasAttribute("audio-src")&&this._media.setupFromUrl(this.getAttribute("audio-src")),this.hasAttribute("srcdoc")&&(this.iframe.srcdoc=U(this,this.getAttribute("srcdoc"))),this.hasAttribute("src")&&(this.iframe.src=H(this,this.getAttribute("src"))),!this.hasAttribute("audio-locked")&&this._isLockedHostEnvironment()&&this._applyAudioLock(!0)}disconnectedCallback(){this.resizeObserver.disconnect(),window.removeEventListener("message",this._onMessage),this.iframe.removeEventListener("load",this._onIframeLoad),this.probe.stop(),this._directTimelineClock.stop(),this._stopParentTickClock(),this._directTimelineAdapter=null,this.shaderLoader.destroy(),this._media.destroy(),this.controlsApi?.destroy()}attributeChangedCallback(e,t,i){switch(e){case"src":i&&(this._ready=!1,this.iframe.src=H(this,i));break;case"srcdoc":this._ready=!1,i!==null?this.iframe.srcdoc=U(this,i):this.iframe.removeAttribute("srcdoc");break;case"width":this._compositionWidth=$(i)??1920,this._rescale();break;case"height":this._compositionHeight=$(i)??1080,this._rescale();break;case"controls":i!==null?this._setupControls():(this.controlsApi?.destroy(),this.controlsApi=null);break;case"poster":this.posterEl=de(this.shadow,i,this.posterEl);break;case"playback-rate":{let r=V(parseFloat(i||"1"));this._media.updatePlaybackRate(r),this._sendControl("set-playback-rate",{playbackRate:r}),this._directTimelineAdapter?.timeScale?.(r),this.controlsApi?.updateSpeed(r),this.dispatchEvent(new Event("ratechange"));break}case"muted":this._handleMutedChange(i);break;case"audio-locked":this._applyAudioLock(i!==null);break;case"volume":{let r=Math.max(0,Math.min(1,parseFloat(i||"1")));this._volume=r,this._media.updateVolume(r),this._sendControl("set-volume",{volume:r}),this.controlsApi?.updateVolume(r),this.dispatchEvent(new Event("volumechange"));break}case"audio-src":i?this._media.setupFromUrl(i):this._media.teardownUrlAudio();break;case C:case T:this._reloadShaderOptions();break}}get iframeElement(){return this.iframe}get scenes(){return this._scenes}play(){this.posterEl?.remove(),this.posterEl=null,this._duration>0&&this._currentTime>=this._duration&&this.seek(0),this._paused=!1;let e=this._tryDirectTimelinePlay();e||(this._sendControl("play"),this._ready&&!this._directTimelineAdapter&&this._startParentTickClock()),this._media.audioOwner==="parent"&&this._media.playAll(),this.controlsApi?.updatePlaying(!0),this.dispatchEvent(new Event("play")),e&&this._directTimelineAdapter&&this._directTimelineClock.start(this._directTimelineAdapter,()=>this._currentTime,()=>this._duration,()=>this._paused)}pause(){this._tryDirectTimelinePause()||this._sendControl("pause"),this._directTimelineClock.stop(),this._stopParentTickClock(),this._media.audioOwner==="parent"&&this._media.pauseAll(),this._paused=!0,this.controlsApi?.updatePlaying(!1),this.dispatchEvent(new Event("pause"))}stopMedia(){this._sendControl("stop-media"),this._stopIframeMedia(),this._media.stopAdoptedMedia()}seek(e){!this._trySyncSeek(e)&&!this._tryDirectTimelineSeek(e)&&this._sendControl("seek",{frame:Math.round(e*30)}),this._directTimelineClock.stop(),this._stopParentTickClock(),this._currentTime=e,this._media.audioOwner==="parent"&&(this._media.pauseAll(),this._media.seekAll(e)),this._paused=!0,this.controlsApi?.updatePlaying(!1),this.controlsApi?.updateTime(this._currentTime,this._duration)}setColorGrading(e,t){this._sendControl("set-color-grading",{target:e,grading:t})}clearColorGrading(e){this._sendControl("set-color-grading",{target:e,grading:null})}setColorGradingCompare(e,t){this._sendControl("set-color-grading-compare",{target:e,compare:t})}clearColorGradingCompare(e){this._sendControl("set-color-grading-compare",{target:e,compare:{enabled:!1}})}get currentTime(){return this._currentTime}set currentTime(e){this.seek(e)}get duration(){return this._duration}get paused(){return this._paused}get ready(){return this._ready}get playbackRate(){return V(parseFloat(this.getAttribute("playback-rate")||"1"))}set playbackRate(e){this.setAttribute("playback-rate",String(V(e)))}get shaderCaptureScale(){return Be(this)}set shaderCaptureScale(e){this.setAttribute(C,String(e))}get shaderLoading(){return M(this)}set shaderLoading(e){e==="composition"?this.removeAttribute(T):this.setAttribute(T,e)}get muted(){return this.hasAttribute("muted")}set muted(e){e?this.setAttribute("muted",""):this.removeAttribute("muted")}get audioLocked(){return this.hasAttribute("audio-locked")}set audioLocked(e){e?this.setAttribute("audio-locked",""):this.removeAttribute("audio-locked")}_isLockedHostEnvironment(){if(typeof navigator>"u")return!1;let e=navigator.userAgent||"";return/\bClaude\/\d/.test(e)&&/\bElectron\b/.test(e)}_isAudioLocked(){return this.hasAttribute("audio-locked")||this._isLockedHostEnvironment()}_isSlideshowPlayer(){return this.closest("hyperframes-slideshow")!==null}_handleMutedChange(e){if(e===null&&this._isAudioLocked()){this.setAttribute("muted","");return}this._media.updateMuted(e!==null),this._setIframeMediaMuted(e!==null),this._sendControl("set-muted",{muted:e!==null}),this.controlsApi?.updateMuted(e!==null),this.dispatchEvent(new Event("volumechange"))}_applyAudioLock(e){e&&(this.muted=!0),this.controlsApi?.setVolumeControlsHidden(e)}get volume(){return this._volume}set volume(e){this.setAttribute("volume",String(Math.max(0,Math.min(1,e))))}get loop(){return this.hasAttribute("loop")}set loop(e){e?this.setAttribute("loop",""):this.removeAttribute("loop")}_sendControl(e,t={}){try{this.iframe.contentWindow?.postMessage({source:"hf-parent",type:"control",action:e,...t},"*")}catch{}}_getSameOriginIframeDocument(){try{return this.iframe.contentDocument}catch{return null}}_setIframeMediaMuted(e){let t=this._getSameOriginIframeDocument();if(t)for(let i of t.querySelectorAll("video, audio"))y(i)&&(i.muted=e||i.defaultMuted)}_stopIframeMedia(){let e=this._getSameOriginIframeDocument();if(e)for(let t of e.querySelectorAll("video, audio"))y(t)&&t.pause()}_replayBridgeState(){this._sendControl("set-muted",{muted:this.muted}),this._sendControl("set-volume",{volume:this._volume}),this._sendControl("set-playback-rate",{playbackRate:this.playbackRate}),this._sendControl("set-native-media-sync-disabled",{disabled:this._isSlideshowPlayer()}),this._sendControl("set-web-audio-media-disabled",{disabled:this._isSlideshowPlayer()})}_reloadShaderOptions(){if(M(this)!=="player"&&this.shaderLoader.reset(),this.hasAttribute("srcdoc")){this.iframe.srcdoc=U(this,this.getAttribute("srcdoc")||"");return}this.hasAttribute("src")&&(this.iframe.src=H(this,this.getAttribute("src")||""))}_trySyncSeek(e){try{let t=this.iframe.contentWindow?.__player;return typeof t?.seek!="function"?!1:(t.seek.call(t,e),!0)}catch{return!1}}_withDirectTimeline(e){let t=this._directTimelineAdapter||this.probe.resolveDirectTimelineAdapter();if(!t)return!1;try{return e(t),this._directTimelineAdapter=t,!0}catch{return!1}}_tryDirectTimelineSeek(e){return this._withDirectTimeline(t=>{t.seek(e,!1),t.pause()})}_tryDirectTimelinePlay(){return this._withDirectTimeline(e=>{e.play()})}_tryDirectTimelinePause(){return this._withDirectTimeline(e=>{e.pause()})}_startParentTickClock(){this._stopParentTickClock();let e=()=>{if(this._paused){this._parentTickRaf=null;return}this._sendControl("tick"),this._parentTickRaf=requestAnimationFrame(e)};this._parentTickRaf=requestAnimationFrame(e)}_stopParentTickClock(){this._parentTickRaf!==null&&(cancelAnimationFrame(this._parentTickRaf),this._parentTickRaf=null)}_onMessage(e){$e(e,this.iframe.contentWindow,{getPlaybackState:()=>({currentTime:this._currentTime,duration:this._duration,paused:this._paused,lastUpdateMs:this._lastUpdateMs}),setPlaybackState:({currentTime:t,duration:i,paused:r,lastUpdateMs:a})=>{this._currentTime=t,this._duration=i,this._paused=r,this._lastUpdateMs=a},getShaderLoadingMode:()=>M(this),shaderLoader:this.shaderLoader,setCompositionSize:(t,i)=>{this._compositionWidth=t,this._compositionHeight=i,this._rescale()},sendControl:(t,i)=>this._sendControl(t,i),getIframeDoc:()=>this.iframe.contentDocument,onRuntimeReady:()=>this._replayBridgeState(),onRuntimeTimelineReady:t=>this._onRuntimeTimelineReady(t),shouldPromoteMediaAutoplayFallback:()=>!this._isSlideshowPlayer(),setScenes:t=>{this._scenes=t,this.dispatchEvent(new CustomEvent("scenes",{detail:{scenes:t}}))},updateControlsTime:(t,i)=>this.controlsApi?.updateTime(t,i),updateControlsPlaying:t=>this.controlsApi?.updatePlaying(t),dispatchEvent:t=>this.dispatchEvent(t),seek:t=>this.seek(t),play:()=>this.play(),getLoop:()=>this.loop,media:this._media})}_onRuntimeTimelineReady(e){if(this._ready)return;this.probe.stop(),this._duration=e,this._directTimelineAdapter=null,this._ready=!0,this.controlsApi?.updateTime(this._currentTime,e),this.dispatchEvent(new CustomEvent("ready",{detail:{duration:e}}));let t=this._getSameOriginIframeDocument();t&&this._media.setupFromIframe(t),this._replayBridgeState(),this._setIframeMediaMuted(this.muted),this.hasAttribute("autoplay")&&this.play()}_onProbeReady({duration:e,adapter:t,compositionSize:i}){this._duration=e,this._directTimelineAdapter=t.kind==="direct-timeline"?t.timeline:null,this._ready=!0,this.controlsApi?.updateTime(0,e),this.dispatchEvent(new CustomEvent("ready",{detail:{duration:e}})),i&&(this._compositionWidth=i.width,this._compositionHeight=i.height,this._rescale());try{let r=this.iframe.contentDocument;r&&this._media.setupFromIframe(r)}catch{}this._setIframeMediaMuted(this.muted),this.hasAttribute("autoplay")&&this.play()}_rescale(){Me(this,this.iframe,this._compositionWidth,this._compositionHeight)}_onIframeLoad(){this._directTimelineAdapter=null,this._directTimelineClock.stop(),this._stopParentTickClock(),this.shaderLoader.reset(),this._media.resetForIframeLoad(),this.probe.start()}_setupControls(){this.controlsApi||(this.controlsApi=Ee(this.shadow,this.muted,this._volume,this.getAttribute("speed-presets"),{onPlay:()=>this.play(),onPause:()=>this.pause(),onSeek:e=>this.seek(e*this._duration),onSpeedChange:e=>{this.playbackRate=e},onMuteToggle:()=>{this.muted=!this.muted},onVolumeChange:e=>{this.volume=e}},this._isAudioLocked()))}get _audioOwner(){return this._media.audioOwner}get _parentMedia(){return this._media.entries}_mirrorParentMediaTime(e,t){this._media.mirrorTime(e,t)}_promoteToParentProxy(){let e=null;try{e=this.iframe.contentDocument}catch{}this._media.promoteToParentProxy(e,(t,i)=>this._mirrorParentMediaTime(t,i)),this._sendControl("set-media-output-muted",{muted:!0})}_observeDynamicMedia(e){this._media.setupFromIframe(e)}};customElements.get("hyperframes-player")||customElements.define("hyperframes-player",Je);export{Je as HyperframesPlayer,ke as SPEED_PRESETS,z as formatSpeed,le as formatTime};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{c}from"./chunk-DXB73IDG.js";var l=c(f=>{"use strict";Object.defineProperty(f,"__esModule",{value:!0});f.default=w;var p=window.OfflineAudioContext||window.webkitOfflineAudioContext;function w(n){var e=m(n);return e.start(0),[O,x,P(n.sampleRate),g].reduce(function(t,u){return u(t)},e.buffer.getChannelData(0))}function g(n){return n.sort(function(e,t){return t.count-e.count}).splice(0,5)[0].tempo}function m(n){var e=n.length,t=n.numberOfChannels,u=n.sampleRate,r=new p(t,e,u),o=r.createBufferSource();o.buffer=n;var a=r.createBiquadFilter();return a.type="lowpass",o.connect(a),a.connect(r.destination),o}function O(n){for(var e=[],t=.9,u=.3,r=15;e.length<r&&t>=u;)e=k(n,t),t-=.05;if(e.length<r)throw new Error("Could not find enough samples for a reliable detection.");return e}function k(n,e){for(var t=[],u=0,r=n.length;u<r;u+=1)n[u]>e&&(t.push(u),u+=1e4);return t}function x(n){var e=[];return n.forEach(function(t,u){for(var r=function(d){var i=n[u+d]-t,h=e.some(function(s){if(s.interval===i)return s.count+=1});h||e.push({interval:i,count:1})},o=0;o<10;o+=1)r(o)}),e}function P(n){return function(e){var t=[];return e.forEach(function(u){if(u.interval!==0){for(var r=60/(u.interval/n);r<90;)r*=2;for(;r>180;)r/=2;r=Math.round(r);var o=t.some(function(a){if(a.tempo===r)return a.count+=u.count});o||t.push({tempo:r,count:u.count})}}),t}}});var y=c((_,v)=>{v.exports=l().default});export default y();
|