@vfrey/vfrey 0.0.1 → 1.0.0-beta.0
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/LICENSE +33 -0
- package/README.md +78 -3
- package/accounts.example.json +61 -0
- package/accounts.first-run.json +41 -0
- package/bin/vfrey.mjs +36 -0
- package/integration-tools/README.md +43 -0
- package/integration-tools/image/pillow.md +32 -0
- package/integration-tools/image/playwright.md +33 -0
- package/integration-tools/image/resvg.md +36 -0
- package/integration-tools/image/satori.md +36 -0
- package/integration-tools/image/sharp.md +38 -0
- package/integration-tools/video/blender.md +34 -0
- package/integration-tools/video/ffmpeg.md +41 -0
- package/integration-tools/video/manim.md +37 -0
- package/integration-tools/video/motion-canvas.md +37 -0
- package/integration-tools/video/remotion.md +50 -0
- package/integration-tools/video/revideo.md +32 -0
- package/package.json +74 -6
- package/skills/vfrey-orchestrator/SKILL.md +15 -0
- package/skills/vfrey-orchestrator/channel-video/SKILL.md +41 -0
- package/skills/vfrey-product/SKILL.md +63 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/framey/cook-one.svg +14 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/framey/cook-two.svg +22 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/framey/index.html +70 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/remotion/cook-one.svg +14 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/remotion/cook-two.svg +22 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/remotion/index.tsx +49 -0
- package/skills/vfrey-product/examples/concurrency-vs-parallelism/script.json +15 -0
- package/skills/vfrey-product/examples/octopus-facts/index.html +60 -0
- package/skills/vfrey-product/examples/octopus-facts/octopus.svg +8 -0
- package/skills/vfrey-product/examples/octopus-facts/script.json +14 -0
- package/skills/vfrey-product/push/SKILL.md +15 -0
- package/skills/vfrey-product/scenes/NOTICE +5 -0
- package/skills/vfrey-product/scenes/blocks.md +57 -0
- package/skills/vfrey-product/scenes/craft.md +118 -0
- package/skills/vfrey-product/scenes/motion.md +88 -0
- package/src/analytics/dashboard.ts +109 -0
- package/src/analytics/index.ts +260 -0
- package/src/api/client.ts +282 -0
- package/src/api/commands.ts +330 -0
- package/src/api/config.ts +34 -0
- package/src/api/creators.ts +463 -0
- package/src/api/credentials.ts +152 -0
- package/src/api/mail.ts +333 -0
- package/src/api/topics.ts +207 -0
- package/src/api/types.ts +205 -0
- package/src/cli.ts +467 -0
- package/src/cloud/executor.ts +281 -0
- package/src/cloud/job.ts +106 -0
- package/src/cloud/render-job.ts +187 -0
- package/src/config.ts +309 -0
- package/src/dashboard-link.ts +180 -0
- package/src/dashboard-start.ts +103 -0
- package/src/desk/channel.ts +64 -0
- package/src/desk/cli.ts +216 -0
- package/src/desk/creators-route.ts +129 -0
- package/src/desk/fonts/JetBrainsMono-OFL.txt +93 -0
- package/src/desk/fonts/google-sans-flex-latin.woff2 +0 -0
- package/src/desk/fonts/jetbrains-mono-medium.woff2 +0 -0
- package/src/desk/http.ts +460 -0
- package/src/desk/mail-route.ts +103 -0
- package/src/desk/overlay.ts +112 -0
- package/src/desk/preview.ts +422 -0
- package/src/desk/screens.ts +149 -0
- package/src/desk/secrets.ts +143 -0
- package/src/desk/series.ts +127 -0
- package/src/desk/state.ts +77 -0
- package/src/desk/studio-route.ts +119 -0
- package/src/desk/tick-runner.ts +66 -0
- package/src/desk/tick.ts +56 -0
- package/src/desk/topics-route.ts +41 -0
- package/src/desk/ui/app.css +505 -0
- package/src/desk/ui/app.js +185 -0
- package/src/desk/ui/apple-icon.png +0 -0
- package/src/desk/ui/components.js +79 -0
- package/src/desk/ui/core.js +156 -0
- package/src/desk/ui/favicon.ico +0 -0
- package/src/desk/ui/icon.svg +1 -0
- package/src/desk/ui/icons.js +49 -0
- package/src/desk/ui/index.html +41 -0
- package/src/desk/ui/metrics-math.d.ts +22 -0
- package/src/desk/ui/metrics-math.js +135 -0
- package/src/desk/ui/theme.js +5 -0
- package/src/desk/ui/views-creators.js +209 -0
- package/src/desk/ui/views-keys.js +114 -0
- package/src/desk/ui/views-mail.js +188 -0
- package/src/desk/ui/views-misc.js +123 -0
- package/src/desk/ui/views-review.js +119 -0
- package/src/desk/ui/views-runs.js +350 -0
- package/src/desk/ui/views-screens.js +163 -0
- package/src/desk/ui/views-series.js +318 -0
- package/src/desk/ui/views-topics.js +87 -0
- package/src/desk/verbs.ts +361 -0
- package/src/doctor.ts +212 -0
- package/src/drain.ts +14 -0
- package/src/engage/index.ts +217 -0
- package/src/generate/index.ts +110 -0
- package/src/generate/script.ts +152 -0
- package/src/generate/title.ts +78 -0
- package/src/help.ts +233 -0
- package/src/home.ts +45 -0
- package/src/llm/client.ts +177 -0
- package/src/log.ts +7 -0
- package/src/oauth/tokens.ts +189 -0
- package/src/oauth/vault.ts +72 -0
- package/src/pipeline/review.ts +642 -0
- package/src/pipeline/run.ts +443 -0
- package/src/pipeline/series-guard.ts +26 -0
- package/src/pipeline/source-fetch.ts +69 -0
- package/src/pipeline/stages.ts +728 -0
- package/src/pipeline/topics-source.ts +90 -0
- package/src/product/commands.ts +296 -0
- package/src/product/config-file.ts +38 -0
- package/src/product/engine-choice.ts +89 -0
- package/src/product/engines.ts +103 -0
- package/src/product/insights.ts +50 -0
- package/src/product/keys.ts +67 -0
- package/src/product/paths.ts +18 -0
- package/src/product/probes.ts +88 -0
- package/src/product/push-flow.ts +90 -0
- package/src/product/render-video.ts +21 -0
- package/src/product/short.ts +62 -0
- package/src/product/update.ts +32 -0
- package/src/project/canonical.ts +14 -0
- package/src/project/commands.ts +177 -0
- package/src/project/dashboard-status.ts +28 -0
- package/src/project/discover.ts +19 -0
- package/src/project/index-file.ts +73 -0
- package/src/project/marker.ts +87 -0
- package/src/project/migrate.ts +201 -0
- package/src/project/names.ts +27 -0
- package/src/project/notice.ts +16 -0
- package/src/project/open.ts +88 -0
- package/src/project/scaffold.ts +112 -0
- package/src/project/templates.ts +42 -0
- package/src/project/videos.ts +64 -0
- package/src/publish/facebook.ts +91 -0
- package/src/publish/index.ts +12 -0
- package/src/publish/instagram.ts +97 -0
- package/src/publish/rate.ts +62 -0
- package/src/publish/session.ts +242 -0
- package/src/publish/tiktok.ts +202 -0
- package/src/publish/youtube.ts +177 -0
- package/src/queue/desk-ops.ts +1170 -0
- package/src/queue/seal.ts +3 -0
- package/src/queue/store.ts +1006 -0
- package/src/remotion/AiLabel.tsx +26 -0
- package/src/remotion/Root.tsx +73 -0
- package/src/remotion/defaults.ts +26 -0
- package/src/remotion/films/claude/ClaudeFilm.tsx +1014 -0
- package/src/remotion/films/engine/EngineMark.tsx +17 -0
- package/src/remotion/films/rea/ReaShort.tsx +552 -0
- package/src/remotion/films/rea/drawings.tsx +907 -0
- package/src/remotion/films/rea/timing.ts +144 -0
- package/src/remotion/index.ts +4 -0
- package/src/remotion/templates/EditorialSplit.tsx +39 -0
- package/src/remotion/templates/KineticType.tsx +39 -0
- package/src/remotion/templates/SignalBoard.tsx +50 -0
- package/src/remotion/timing.ts +22 -0
- package/src/render/chrome.ts +78 -0
- package/src/render/engine-mark.ts +29 -0
- package/src/render/framey-template.ts +130 -0
- package/src/render/html-engine.ts +149 -0
- package/src/render/node-crypto-stub.ts +11 -0
- package/src/render/probe.ts +29 -0
- package/src/render/props.ts +17 -0
- package/src/render/vertical-short.ts +35 -0
- package/src/render/webpack.ts +33 -0
- package/src/render/worker.ts +65 -0
- package/src/scene/assets/fonts/TitanOne-OFL.txt +94 -0
- package/src/scene/assets/fonts/titan-one.woff2 +0 -0
- package/src/scene/assets/gsap/LICENSE.txt +8 -0
- package/src/scene/assets/gsap/gsap.min.js +11 -0
- package/src/scene/audio.ts +54 -0
- package/src/scene/blocks/LICENSE +190 -0
- package/src/scene/blocks/NOTICE +5 -0
- package/src/scene/blocks/bar-chart-race/bar-chart-race.html +585 -0
- package/src/scene/blocks/beat-freeze-cut/beat-freeze-cut.html +874 -0
- package/src/scene/blocks/camcorder-hud/camcorder-hud.html +164 -0
- package/src/scene/blocks/camera-dolly-zoom/camera-dolly-zoom.html +355 -0
- package/src/scene/blocks/code-diff/code-diff.html +817 -0
- package/src/scene/blocks/code-snippet-apple-terminal-pro/code-snippet-apple-terminal-pro.html +248 -0
- package/src/scene/blocks/code-typing/code-typing.html +764 -0
- package/src/scene/blocks/data-chart/data-chart.html +452 -0
- package/src/scene/blocks/flowchart-vertical/flowchart-vertical.html +454 -0
- package/src/scene/blocks/hw-scribble-transition/hw-scribble-transition.html +153 -0
- package/src/scene/blocks/index.json +824 -0
- package/src/scene/blocks/lt-accent-underline/lt-accent-underline.html +107 -0
- package/src/scene/blocks/lt-bold-block/lt-bold-block.html +109 -0
- package/src/scene/blocks/lt-clean-bar/lt-clean-bar.html +112 -0
- package/src/scene/blocks/lt-dark-card/lt-dark-card.html +111 -0
- package/src/scene/blocks/lt-kicker-name/lt-kicker-name.html +114 -0
- package/src/scene/blocks/lt-mask-reveal/lt-mask-reveal.html +120 -0
- package/src/scene/blocks/lt-neon-border/lt-neon-border.html +391 -0
- package/src/scene/blocks/lt-stack-bars/lt-stack-bars.html +109 -0
- package/src/scene/blocks/macos-notification/macos-notification.html +194 -0
- package/src/scene/blocks/mk-background/mk-background.html +236 -0
- package/src/scene/blocks/mk-callout-highlight/mk-callout-highlight.html +183 -0
- package/src/scene/blocks/mk-clone-wall-transition/mk-clone-wall-transition.html +226 -0
- package/src/scene/blocks/mk-line-graph/mk-line-graph.html +293 -0
- package/src/scene/blocks/mk-progress-stat/mk-progress-stat.html +186 -0
- package/src/scene/blocks/mk-specs-list/mk-specs-list.html +223 -0
- package/src/scene/blocks/news-ticker/news-ticker.html +409 -0
- package/src/scene/blocks/organic-light-leak-overlay/organic-light-leak-overlay.html +126 -0
- package/src/scene/blocks/oscilloscope-trace/oscilloscope-trace.html +519 -0
- package/src/scene/blocks/snow/snow.html +205 -0
- package/src/scene/blocks/split-flap-board/split-flap-board.html +347 -0
- package/src/scene/blocks/spotify-card/spotify-card.html +294 -0
- package/src/scene/blocks/starfield/starfield.html +188 -0
- package/src/scene/blocks/thread-message-stack/thread-message-stack.html +239 -0
- package/src/scene/blocks/week-in-merges/week-in-merges.html +470 -0
- package/src/scene/blocks/x-post/x-post.html +437 -0
- package/src/scene/blocks/yt-comment-card/yt-comment-card.html +319 -0
- package/src/scene/blocks/yt-lcd-background/yt-lcd-background.html +307 -0
- package/src/scene/blocks/yt-prism-title/yt-prism-title.html +205 -0
- package/src/scene/blocks.ts +229 -0
- package/src/scene/command.ts +272 -0
- package/src/scene/figure.ts +181 -0
- package/src/scene/glyphs.ts +107 -0
- package/src/scene/init.ts +86 -0
- package/src/scene/inspect/css-tree.d.ts +6 -0
- package/src/scene/inspect/page-scripts.ts +272 -0
- package/src/scene/inspect/report.ts +405 -0
- package/src/scene/inspect/run.ts +200 -0
- package/src/scene/inspect/source.ts +236 -0
- package/src/scene/label.ts +131 -0
- package/src/scene/net-guard.ts +74 -0
- package/src/scene/render.ts +292 -0
- package/src/scene/runtime/browser.ts +199 -0
- package/src/scene/runtime/core.ts +181 -0
- package/src/scene/runtime/react.tsx +115 -0
- package/src/scene/runtime/transitions.ts +133 -0
- package/src/scene/sanitize.ts +181 -0
- package/src/scene/scene.ts +152 -0
- package/src/scene/studio-command.ts +48 -0
- package/src/scene/studio-skin.ts +59 -0
- package/src/scene/studio.ts +337 -0
- package/src/scene/supply.ts +111 -0
- package/src/scene/timing.ts +288 -0
- package/src/scene/transitions/LICENSE +190 -0
- package/src/scene/transitions/NOTICE +5 -0
- package/src/scene/transitions/SOURCE.json +24 -0
- package/src/scene/transitions/transitions.global.js +38 -0
- package/src/scene/transitions.ts +26 -0
- package/src/service/all-projects.ts +153 -0
- package/src/service/commands.ts +256 -0
- package/src/service/due.ts +82 -0
- package/src/service/lock.ts +101 -0
- package/src/service/log-file.ts +56 -0
- package/src/service/state.ts +41 -0
- package/src/service/units.ts +90 -0
- package/src/service/worker.ts +51 -0
- package/src/skill-agents.ts +74 -0
- package/src/skill-install.ts +334 -0
- package/src/sync-write.ts +21 -0
- package/src/tick-report.ts +205 -0
- package/src/tts.ts +124 -0
- package/vendor/@vfrey/contracts/dist/account.d.ts +97 -0
- package/vendor/@vfrey/contracts/dist/account.js +27 -0
- package/vendor/@vfrey/contracts/dist/checks.d.ts +8 -0
- package/vendor/@vfrey/contracts/dist/checks.js +1 -0
- package/vendor/@vfrey/contracts/dist/credentials/crypto.d.ts +4 -0
- package/vendor/@vfrey/contracts/dist/credentials/crypto.js +38 -0
- package/vendor/@vfrey/contracts/dist/domain/advice-persona.d.ts +10 -0
- package/vendor/@vfrey/contracts/dist/domain/advice-persona.js +24 -0
- package/vendor/@vfrey/contracts/dist/domain/backoff.d.ts +13 -0
- package/vendor/@vfrey/contracts/dist/domain/backoff.js +27 -0
- package/vendor/@vfrey/contracts/dist/domain/cadence.d.ts +29 -0
- package/vendor/@vfrey/contracts/dist/domain/cadence.js +95 -0
- package/vendor/@vfrey/contracts/dist/domain/creators.d.ts +146 -0
- package/vendor/@vfrey/contracts/dist/domain/creators.js +2 -0
- package/vendor/@vfrey/contracts/dist/domain/disclosure.d.ts +127 -0
- package/vendor/@vfrey/contracts/dist/domain/disclosure.js +250 -0
- package/vendor/@vfrey/contracts/dist/domain/errors.d.ts +34 -0
- package/vendor/@vfrey/contracts/dist/domain/errors.js +68 -0
- package/vendor/@vfrey/contracts/dist/domain/redact.d.ts +1 -0
- package/vendor/@vfrey/contracts/dist/domain/redact.js +21 -0
- package/vendor/@vfrey/contracts/dist/domain/revenue.d.ts +13 -0
- package/vendor/@vfrey/contracts/dist/domain/revenue.js +16 -0
- package/vendor/@vfrey/contracts/dist/domain/safety.d.ts +20 -0
- package/vendor/@vfrey/contracts/dist/domain/safety.js +61 -0
- package/vendor/@vfrey/contracts/dist/domain/similarity.d.ts +13 -0
- package/vendor/@vfrey/contracts/dist/domain/similarity.js +100 -0
- package/vendor/@vfrey/contracts/dist/domain/templates.d.ts +18 -0
- package/vendor/@vfrey/contracts/dist/domain/templates.js +67 -0
- package/vendor/@vfrey/contracts/dist/domain/tiktok-chunks.d.ts +19 -0
- package/vendor/@vfrey/contracts/dist/domain/tiktok-chunks.js +52 -0
- package/vendor/@vfrey/contracts/dist/domain/topics.d.ts +78 -0
- package/vendor/@vfrey/contracts/dist/domain/topics.js +4 -0
- package/vendor/@vfrey/contracts/dist/domain/types.d.ts +216 -0
- package/vendor/@vfrey/contracts/dist/domain/types.js +1 -0
- package/vendor/@vfrey/contracts/dist/domain/variation.d.ts +57 -0
- package/vendor/@vfrey/contracts/dist/domain/variation.js +278 -0
- package/vendor/@vfrey/contracts/dist/events.d.ts +20 -0
- package/vendor/@vfrey/contracts/dist/events.js +1 -0
- package/vendor/@vfrey/contracts/dist/http.d.ts +11 -0
- package/vendor/@vfrey/contracts/dist/http.js +37 -0
- package/vendor/@vfrey/contracts/dist/index.d.ts +22 -0
- package/vendor/@vfrey/contracts/dist/index.js +22 -0
- package/vendor/@vfrey/contracts/dist/log.d.ts +2 -0
- package/vendor/@vfrey/contracts/dist/log.js +10 -0
- package/vendor/@vfrey/contracts/dist/mail.d.ts +55 -0
- package/vendor/@vfrey/contracts/dist/mail.js +1 -0
- package/vendor/@vfrey/contracts/package.json +18 -0
- package/vendor/@vfrey/ingest/dist/index.d.ts +41 -0
- package/vendor/@vfrey/ingest/dist/index.js +221 -0
- package/vendor/@vfrey/ingest/dist/parse.d.ts +5 -0
- package/vendor/@vfrey/ingest/dist/parse.js +165 -0
- package/vendor/@vfrey/ingest/package.json +21 -0
- package/vendor/framey/LICENSE +190 -0
- package/vendor/framey/NOTICE +15 -0
- package/vendor/framey/SOURCE.json +24 -0
- package/vendor/framey/STUDIO-SOURCE.json +9 -0
- package/vendor/framey/bin/framey-localize-fonts.mjs +12 -0
- package/vendor/framey/bin/framey.mjs +16 -0
- package/vendor/framey/dist/add-VMJD5KBS.js +75 -0
- package/vendor/framey/dist/animatedGifPrep-QPKGJ6PM.js +43 -0
- package/vendor/framey/dist/api.d.ts +211 -0
- package/vendor/framey/dist/api.js +76 -0
- package/vendor/framey/dist/appHistory-WW56FZTT.js +31 -0
- package/vendor/framey/dist/asset-WQKGOELE.js +26 -0
- package/vendor/framey/dist/audio-RSJWVWRA.js +1936 -0
- package/vendor/framey/dist/batchRender-3HPICDCT.js +366 -0
- package/vendor/framey/dist/beats-HL2BDUZI.js +273 -0
- package/vendor/framey/dist/benchmark-RWCWHI5Z.js +230 -0
- package/vendor/framey/dist/browser-ECYET3Q2.js +206 -0
- package/vendor/framey/dist/bundleWithLocalizedFonts-ALYBQEQT.js +52 -0
- package/vendor/framey/dist/captureCompositionFrame-4DA6SEH2.js +94 -0
- package/vendor/framey/dist/catalog-5JVDEUWK.js +979 -0
- package/vendor/framey/dist/catch-up-NEBCL5NO.js +106 -0
- package/vendor/framey/dist/check-F5N544ML.js +111 -0
- package/vendor/framey/dist/checkBrowser-LZ66CMJG.js +110 -0
- package/vendor/framey/dist/chunk-2K7Z2HVP.js +372 -0
- package/vendor/framey/dist/chunk-2UZQHDM7.js +323 -0
- package/vendor/framey/dist/chunk-2X4PQEYM.js +34 -0
- package/vendor/framey/dist/chunk-3422KMTD.js +168 -0
- package/vendor/framey/dist/chunk-3FYD4YEK.js +72 -0
- package/vendor/framey/dist/chunk-3GXQPCJC.js +682 -0
- package/vendor/framey/dist/chunk-3LM6YPBR.js +179 -0
- package/vendor/framey/dist/chunk-442JNXRM.js +20 -0
- package/vendor/framey/dist/chunk-4BNN5FGX.js +182 -0
- package/vendor/framey/dist/chunk-4P7NX5BM.js +11532 -0
- package/vendor/framey/dist/chunk-4UMPIPCQ.js +88 -0
- package/vendor/framey/dist/chunk-4YYJOFKS.js +28 -0
- package/vendor/framey/dist/chunk-54HJ63Q2.js +29 -0
- package/vendor/framey/dist/chunk-5ETJX6WM.js +89 -0
- package/vendor/framey/dist/chunk-5SG54JRS.js +68 -0
- package/vendor/framey/dist/chunk-634HSJ3J.js +58 -0
- package/vendor/framey/dist/chunk-66LREXGS.js +48 -0
- package/vendor/framey/dist/chunk-6BEFEWFB.js +25 -0
- package/vendor/framey/dist/chunk-6BNTGNGD.js +286 -0
- package/vendor/framey/dist/chunk-6DDPOHMK.js +140 -0
- package/vendor/framey/dist/chunk-6GV5XSOR.js +214 -0
- package/vendor/framey/dist/chunk-6JR2XUEE.js +127 -0
- package/vendor/framey/dist/chunk-73QVATIM.js +362 -0
- package/vendor/framey/dist/chunk-7FMUTGOH.js +279 -0
- package/vendor/framey/dist/chunk-7JQFJ6JJ.js +291 -0
- package/vendor/framey/dist/chunk-AHPGAESX.js +113 -0
- package/vendor/framey/dist/chunk-AHX34EFP.js +15 -0
- package/vendor/framey/dist/chunk-AJ5CSAEZ.js +487 -0
- package/vendor/framey/dist/chunk-B7RJV74O.js +5047 -0
- package/vendor/framey/dist/chunk-BL4U6U52.js +254 -0
- package/vendor/framey/dist/chunk-BSQ7XANM.js +210 -0
- package/vendor/framey/dist/chunk-BZ56MTDX.js +6 -0
- package/vendor/framey/dist/chunk-C5BO7PMT.js +282 -0
- package/vendor/framey/dist/chunk-CFUCHO4T.js +358 -0
- package/vendor/framey/dist/chunk-CZGHFATT.js +31 -0
- package/vendor/framey/dist/chunk-DLA44CMS.js +5649 -0
- package/vendor/framey/dist/chunk-DPVXBVLL.js +31292 -0
- package/vendor/framey/dist/chunk-DQBY7FRR.js +397 -0
- package/vendor/framey/dist/chunk-EAMLBAHA.js +154 -0
- package/vendor/framey/dist/chunk-EOVYQ3IG.js +143 -0
- package/vendor/framey/dist/chunk-EVMY7IPL.js +612 -0
- package/vendor/framey/dist/chunk-FG4BBFZI.js +122 -0
- package/vendor/framey/dist/chunk-FI4I7CME.js +56 -0
- package/vendor/framey/dist/chunk-FLREUEHW.js +2081 -0
- package/vendor/framey/dist/chunk-FUFP7A7S.js +1126 -0
- package/vendor/framey/dist/chunk-FV3PIKGH.js +56 -0
- package/vendor/framey/dist/chunk-FXMKHHPO.js +123 -0
- package/vendor/framey/dist/chunk-GGZAM5VH.js +1187 -0
- package/vendor/framey/dist/chunk-GKZEVJIB.js +39 -0
- package/vendor/framey/dist/chunk-GMECXFAN.js +57 -0
- package/vendor/framey/dist/chunk-GNEFDLFB.js +621 -0
- package/vendor/framey/dist/chunk-GPMLSOEG.js +19274 -0
- package/vendor/framey/dist/chunk-GPYVT5EE.js +59 -0
- package/vendor/framey/dist/chunk-H6IEMZEV.js +40 -0
- package/vendor/framey/dist/chunk-HEFQCIXR.js +170 -0
- package/vendor/framey/dist/chunk-HFQ4CWHA.js +118 -0
- package/vendor/framey/dist/chunk-HPDTCOKE.js +304 -0
- package/vendor/framey/dist/chunk-HTUHQKDB.js +548 -0
- package/vendor/framey/dist/chunk-HU2SPFNG.js +103 -0
- package/vendor/framey/dist/chunk-HVW7ABXD.js +19 -0
- package/vendor/framey/dist/chunk-IG7NDKXO.js +26 -0
- package/vendor/framey/dist/chunk-II3J3WXK.js +246 -0
- package/vendor/framey/dist/chunk-IR35BCLK.js +13 -0
- package/vendor/framey/dist/chunk-ISN5GRYI.js +20 -0
- package/vendor/framey/dist/chunk-IUONB55J.js +669 -0
- package/vendor/framey/dist/chunk-IVSUQR2B.js +161 -0
- package/vendor/framey/dist/chunk-IXU6PQSW.js +259 -0
- package/vendor/framey/dist/chunk-IZCW2NKT.js +29 -0
- package/vendor/framey/dist/chunk-JGXJU5PF.js +68 -0
- package/vendor/framey/dist/chunk-JHOCK3DG.js +27 -0
- package/vendor/framey/dist/chunk-JVBRJMOP.js +121 -0
- package/vendor/framey/dist/chunk-K4MJX7SR.js +17 -0
- package/vendor/framey/dist/chunk-K4WKGXRC.js +18 -0
- package/vendor/framey/dist/chunk-KGPLIH7B.js +127 -0
- package/vendor/framey/dist/chunk-KLIKCX6Q.js +63 -0
- package/vendor/framey/dist/chunk-KXTKKBOC.js +61 -0
- package/vendor/framey/dist/chunk-KZI44OPA.js +185 -0
- package/vendor/framey/dist/chunk-LEKZNRKI.js +45 -0
- package/vendor/framey/dist/chunk-LFGJWOVA.js +61 -0
- package/vendor/framey/dist/chunk-LLMSX6V6.js +17 -0
- package/vendor/framey/dist/chunk-LTGTN2TH.js +195 -0
- package/vendor/framey/dist/chunk-M2WBOQ2Q.js +54 -0
- package/vendor/framey/dist/chunk-MI5FTLYK.js +399 -0
- package/vendor/framey/dist/chunk-MLQP2QUF.js +1809 -0
- package/vendor/framey/dist/chunk-MMQ52NIZ.js +956 -0
- package/vendor/framey/dist/chunk-ND46XKK3.js +742 -0
- package/vendor/framey/dist/chunk-NYEXNSHM.js +504 -0
- package/vendor/framey/dist/chunk-O4YRB27L.js +57 -0
- package/vendor/framey/dist/chunk-O7BGSQ5F.js +92 -0
- package/vendor/framey/dist/chunk-OFQWTKPW.js +117 -0
- package/vendor/framey/dist/chunk-P5ZBLXJ6.js +91 -0
- package/vendor/framey/dist/chunk-P6LJ4Y32.js +4662 -0
- package/vendor/framey/dist/chunk-PKZ7RK5N.js +281 -0
- package/vendor/framey/dist/chunk-PURHAXFL.js +15 -0
- package/vendor/framey/dist/chunk-Q5X2B5WT.js +29 -0
- package/vendor/framey/dist/chunk-QAMKOG67.js +248 -0
- package/vendor/framey/dist/chunk-R6YBK4XX.js +514 -0
- package/vendor/framey/dist/chunk-RGLQURIX.js +2997 -0
- package/vendor/framey/dist/chunk-RNV3DM4S.js +3573 -0
- package/vendor/framey/dist/chunk-ROEW726S.js +4638 -0
- package/vendor/framey/dist/chunk-RQVDTPGD.js +6 -0
- package/vendor/framey/dist/chunk-RVZHGOGR.js +26 -0
- package/vendor/framey/dist/chunk-RXATE6FZ.js +385 -0
- package/vendor/framey/dist/chunk-S3S4TGEH.js +424 -0
- package/vendor/framey/dist/chunk-SDYDNHEE.js +11202 -0
- package/vendor/framey/dist/chunk-SSWBU67I.js +173 -0
- package/vendor/framey/dist/chunk-ST35C4K6.js +28 -0
- package/vendor/framey/dist/chunk-SZNTYTIV.js +990 -0
- package/vendor/framey/dist/chunk-T2EUWCJE.js +29 -0
- package/vendor/framey/dist/chunk-T6AGUTZJ.js +444 -0
- package/vendor/framey/dist/chunk-THJALHFJ.js +11131 -0
- package/vendor/framey/dist/chunk-TIQB63MX.js +18128 -0
- package/vendor/framey/dist/chunk-U242RTCT.js +134 -0
- package/vendor/framey/dist/chunk-UJZREAV6.js +3901 -0
- package/vendor/framey/dist/chunk-UMD3V7CU.js +264 -0
- package/vendor/framey/dist/chunk-UOFAE5RF.js +42 -0
- package/vendor/framey/dist/chunk-UTEIUGAZ.js +29 -0
- package/vendor/framey/dist/chunk-VAS6HQX3.js +138 -0
- package/vendor/framey/dist/chunk-VC76R6W2.js +27 -0
- package/vendor/framey/dist/chunk-VFZ7W5W7.js +226 -0
- package/vendor/framey/dist/chunk-VHNLZAE2.js +348 -0
- package/vendor/framey/dist/chunk-VMC4WSH5.js +278 -0
- package/vendor/framey/dist/chunk-VORQIH64.js +108 -0
- package/vendor/framey/dist/chunk-VTXFRIHO.js +186 -0
- package/vendor/framey/dist/chunk-W2LGJSEN.js +182 -0
- package/vendor/framey/dist/chunk-WKBM7NDG.js +32 -0
- package/vendor/framey/dist/chunk-WMQNIQDJ.js +2057 -0
- package/vendor/framey/dist/chunk-WN4XZC5F.js +504 -0
- package/vendor/framey/dist/chunk-WQ6ZXHFQ.js +133 -0
- package/vendor/framey/dist/chunk-X7HBSTCZ.js +53 -0
- package/vendor/framey/dist/chunk-X7MTZ4T2.js +6 -0
- package/vendor/framey/dist/chunk-XPTOJZJF.js +308 -0
- package/vendor/framey/dist/chunk-XT6MXC7A.js +6 -0
- package/vendor/framey/dist/chunk-XT7X6QCP.js +6 -0
- package/vendor/framey/dist/chunk-XTMDWNEC.js +2820 -0
- package/vendor/framey/dist/chunk-XUHOIDKG.js +6 -0
- package/vendor/framey/dist/chunk-XX7LTW5Y.js +138 -0
- package/vendor/framey/dist/chunk-Y3YGTZEG.js +382 -0
- package/vendor/framey/dist/chunk-Y5SBSGN7.js +346 -0
- package/vendor/framey/dist/chunk-YCMVI4MZ.js +625 -0
- package/vendor/framey/dist/chunk-YOR4CTCE.js +261 -0
- package/vendor/framey/dist/chunk-YPRBGITP.js +2748 -0
- package/vendor/framey/dist/chunk-ZKDMAOFU.js +32 -0
- package/vendor/framey/dist/chunk-ZW6DURPF.js +1318 -0
- package/vendor/framey/dist/clean-ZJOGDKDM.js +336 -0
- package/vendor/framey/dist/cli.js +439 -0
- package/vendor/framey/dist/cloudrun-HGJ3B6ZV.js +767 -0
- package/vendor/framey/dist/commands/contrast-audit.browser.js +643 -0
- package/vendor/framey/dist/commands/layout-audit.browser.js +2914 -0
- package/vendor/framey/dist/commands/motion-sample.browser.js +74 -0
- package/vendor/framey/dist/commands/motion-signature.browser.js +475 -0
- package/vendor/framey/dist/compare-W7UY3BAZ.js +463 -0
- package/vendor/framey/dist/compiler-TM3W6GYF.js +136 -0
- package/vendor/framey/dist/component-QF5VGYMU.js +176 -0
- package/vendor/framey/dist/compositions-XT3PMNDF.js +238 -0
- package/vendor/framey/dist/contactSheet-7W6GYHBQ.js +24 -0
- package/vendor/framey/dist/deploy-6FJPWKF2.js +299 -0
- package/vendor/framey/dist/destroy-HE2RIPKZ.js +57 -0
- package/vendor/framey/dist/deterministicFonts-RADD3BSX.js +50 -0
- package/vendor/framey/dist/dist-4S2FGGVY.js +422 -0
- package/vendor/framey/dist/dist-BE4B2EZE.js +32 -0
- package/vendor/framey/dist/dist-EWXJGN63.js +129 -0
- package/vendor/framey/dist/docs-VKIRFEEX.js +131 -0
- package/vendor/framey/dist/doctor-2UNJ2G7U.js +74 -0
- package/vendor/framey/dist/dom-37K6YOH4.js +14 -0
- package/vendor/framey/dist/dotEnv-7PZQTVIM.js +54 -0
- package/vendor/framey/dist/events-ACY3P2PA.js +76 -0
- package/vendor/framey/dist/events-IHB3B2MK.js +69 -0
- package/vendor/framey/dist/ffmpeg-DR5LGGSK.js +63 -0
- package/vendor/framey/dist/figma-BODVUPHB.js +63 -0
- package/vendor/framey/dist/fontData.generated-NXAOI4GH.js +13 -0
- package/vendor/framey/dist/fontLocalizeCli.js +142 -0
- package/vendor/framey/dist/gpuPolicy-XLEXORZY.js +49 -0
- package/vendor/framey/dist/grade-compare-GAXFQ74C.js +661 -0
- package/vendor/framey/dist/gsapParser-IEUSLYDJ.js +2885 -0
- package/vendor/framey/dist/gsapParserAcorn-LZJKCFQI.js +30 -0
- package/vendor/framey/dist/help-VCB5X2HS.js +184 -0
- package/vendor/framey/dist/history-ENGZEVFT.js +471 -0
- package/vendor/framey/dist/hyperframe.manifest.json +22 -0
- package/vendor/framey/dist/hyperframe.runtime.iife.js +1132 -0
- package/vendor/framey/dist/hyperframes-player.global.js +478 -0
- package/vendor/framey/dist/hyperframes-slideshow.global.js +148 -0
- package/vendor/framey/dist/info-WPCJHBMU.js +182 -0
- package/vendor/framey/dist/init-G4WGLYGD.js +1176 -0
- package/vendor/framey/dist/inspect-5IQ6CNEQ.js +106 -0
- package/vendor/framey/dist/installer-ML4HWUV7.js +40 -0
- package/vendor/framey/dist/keyframes-Q6XJO7VW.js +2755 -0
- package/vendor/framey/dist/lambda-A7JC74JF.js +468 -0
- package/vendor/framey/dist/layout-YET6XNXA.js +95 -0
- package/vendor/framey/dist/lint-I7FZN2VJ.js +162 -0
- package/vendor/framey/dist/lintProject-PDB3UN72.js +30 -0
- package/vendor/framey/dist/manager-CD6LJ7ZN.js +45 -0
- package/vendor/framey/dist/manager-WA4F2GST.js +67 -0
- package/vendor/framey/dist/media-treatment-BXYS4WVA.js +1030 -0
- package/vendor/framey/dist/media-use-LWH3MANK.js +113 -0
- package/vendor/framey/dist/models-K363FYM4.js +195 -0
- package/vendor/framey/dist/motionShot-GPAVWXLH.js +640 -0
- package/vendor/framey/dist/normalize-FASIPBUM.js +24 -0
- package/vendor/framey/dist/normalize-audio-VDWYRHN6.js +268 -0
- package/vendor/framey/dist/open-E3TB6P6J.js +128 -0
- package/vendor/framey/dist/parakeetRunner-UP34UOI2.js +58 -0
- package/vendor/framey/dist/pipeline-VXIUYEBU.js +64 -0
- package/vendor/framey/dist/play-BUTDQ4DV.js +353 -0
- package/vendor/framey/dist/policies-OLDYGFK5.js +309 -0
- package/vendor/framey/dist/preflight-2KZ2GWAZ.js +55 -0
- package/vendor/framey/dist/present-GXYSM7NX.js +353 -0
- package/vendor/framey/dist/preview-EKZ33JOJ.js +1910 -0
- package/vendor/framey/dist/producer-SKU5EV3J.js +13 -0
- package/vendor/framey/dist/progress-ZWB4Z4ET.js +76 -0
- package/vendor/framey/dist/projectConfig-3MZAYVTS.js +60 -0
- package/vendor/framey/dist/publication-DTKWNF74.js +33 -0
- package/vendor/framey/dist/remove-background-OY5L7XN2.js +265 -0
- package/vendor/framey/dist/render-CDV4GDFX.js +187 -0
- package/vendor/framey/dist/render-YE5YAMOD.js +2620 -0
- package/vendor/framey/dist/render-batch-ZAMFPCLL.js +274 -0
- package/vendor/framey/dist/renderSetupWorker.js +120 -0
- package/vendor/framey/dist/resolver-D5BIPSEW.js +42 -0
- package/vendor/framey/dist/runtimeVersion.js +18 -0
- package/vendor/framey/dist/sam-WFZXI4F7.js +23 -0
- package/vendor/framey/dist/shaderTransitionWorker.js +44 -0
- package/vendor/framey/dist/sherpa-RQWLV7I3.js +79 -0
- package/vendor/framey/dist/sherpaWorker.js +84 -0
- package/vendor/framey/dist/sites-AMOVABTK.js +54 -0
- package/vendor/framey/dist/skill-ZHVLH7KX.js +15 -0
- package/vendor/framey/dist/slideshow-SJGK4RQS.js +24 -0
- package/vendor/framey/dist/snapshot-TUXL6LBQ.js +1515 -0
- package/vendor/framey/dist/src-JHQGB2S6.js +215 -0
- package/vendor/framey/dist/src-Z5PGEMXB.js +532 -0
- package/vendor/framey/dist/state-B6H3WHCF.js +28 -0
- package/vendor/framey/dist/staticProjectServer-DFVZOUGI.js +63 -0
- package/vendor/framey/dist/studio/assets/hyperframes-player-DLaKjw0L.js +478 -0
- package/vendor/framey/dist/studio/assets/index-BX3KHhGX.js +71 -0
- package/vendor/framey/dist/studio/assets/index-CYbvOVp-.css +1 -0
- package/vendor/framey/dist/studio/assets/index-Dp3QEUGL.js +402 -0
- package/vendor/framey/dist/studio/assets/index-qrTAXbqc.js +531 -0
- package/vendor/framey/dist/studio/favicon.svg +14 -0
- package/vendor/framey/dist/studio/icons/timeline/audio.svg +7 -0
- package/vendor/framey/dist/studio/icons/timeline/captions.svg +5 -0
- package/vendor/framey/dist/studio/icons/timeline/composition.svg +12 -0
- package/vendor/framey/dist/studio/icons/timeline/image.svg +18 -0
- package/vendor/framey/dist/studio/icons/timeline/music.svg +10 -0
- package/vendor/framey/dist/studio/icons/timeline/text.svg +3 -0
- package/vendor/framey/dist/studio/index.html +23 -0
- package/vendor/framey/dist/studio-api-2NECGRMB.js +179 -0
- package/vendor/framey/dist/studioSelectionClient-IUUPKUHZ.js +25 -0
- package/vendor/framey/dist/studioServer-N2OPUMOQ.js +1569 -0
- package/vendor/framey/dist/synthesize-PKTB5ATG.js +183 -0
- package/vendor/framey/dist/system-7F3UEHQT.js +27 -0
- package/vendor/framey/dist/telemetry-DQGPEKM6.js +145 -0
- package/vendor/framey/dist/telemetry-UN55N6U6.js +77 -0
- package/vendor/framey/dist/timeline-LHUUMK63.js +1295 -0
- package/vendor/framey/dist/tokens-OLECWDFK.js +92 -0
- package/vendor/framey/dist/transcribe-O7HQKMIV.js +331 -0
- package/vendor/framey/dist/transcribe-UJESPBT5.js +76 -0
- package/vendor/framey/dist/tts-YCCQHZD4.js +234 -0
- package/vendor/framey/dist/urlDownloader-H2LXLG4U.js +48 -0
- package/vendor/framey/dist/usage-HG4WMM7A.js +2167 -0
- package/vendor/framey/dist/validate-F2XMN6EV.js +87 -0
- package/vendor/framey/dist/vendor/npm/gsap@3.15.0/GSAP-LICENSE.txt +8 -0
- package/vendor/framey/dist/vendor/npm/gsap@3.15.0/dist/CustomEase.min.js +11 -0
- package/vendor/framey/dist/vendor/npm/gsap@3.15.0/dist/MotionPathPlugin.min.js +11 -0
- package/vendor/framey/dist/vendor/npm/gsap@3.15.0/dist/gsap.min.js +11 -0
- package/vendor/framey/dist/warmCheck.js +220 -0
- package/vendor/framey/dist/warmCheckClient.js +139 -0
- package/vendor/framey/dist/workspaceBuildCheck-XYD2YTFW.js +133 -0
- package/vendor/framey-player/LICENSE +190 -0
- package/vendor/framey-player/NOTICE +16 -0
- package/vendor/framey-player/SOURCE.json +6 -0
- package/vendor/framey-player/hyperframes-player.global.js +478 -0
- package/vendor/framey.pin +1 -0
- package/bin/index.js +0 -3
|
@@ -0,0 +1,282 @@
|
|
|
1
|
+
import { createRequire as __hf_createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __hf_fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname as __hf_dirname } from "node:path";
|
|
4
|
+
var require = __hf_createRequire(import.meta.url);
|
|
5
|
+
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __hf_dirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
PROXY_VARIANT_CONFIG,
|
|
9
|
+
ProxyCapacityError,
|
|
10
|
+
ProxyTranscodeError,
|
|
11
|
+
decideMediaProxyEligibility,
|
|
12
|
+
getMimeType,
|
|
13
|
+
injectMediaCodecMapIntoHtml,
|
|
14
|
+
isProxyVariantRequest,
|
|
15
|
+
probeAssetCodec,
|
|
16
|
+
recordProxyRequest,
|
|
17
|
+
resolveProxy,
|
|
18
|
+
resolveProxyVariantRequest
|
|
19
|
+
} from "./chunk-THJALHFJ.js";
|
|
20
|
+
import {
|
|
21
|
+
findStageProxyBox
|
|
22
|
+
} from "./chunk-LEKZNRKI.js";
|
|
23
|
+
import {
|
|
24
|
+
resolveAutoProxy
|
|
25
|
+
} from "./chunk-4BNN5FGX.js";
|
|
26
|
+
import {
|
|
27
|
+
PREVIEW_PROXY_BOX_PARAM,
|
|
28
|
+
parsePreviewProxyBox
|
|
29
|
+
} from "./chunk-DLA44CMS.js";
|
|
30
|
+
import {
|
|
31
|
+
decodeWellFormedEscapes
|
|
32
|
+
} from "./chunk-BSQ7XANM.js";
|
|
33
|
+
|
|
34
|
+
// src/utils/staticProjectServer.ts
|
|
35
|
+
import { createServer, request as httpRequest } from "http";
|
|
36
|
+
import { Duplex } from "stream";
|
|
37
|
+
import { createReadStream, existsSync, statSync } from "fs";
|
|
38
|
+
import { isAbsolute, relative, resolve } from "path";
|
|
39
|
+
var REFUSED_LISTEN = /* @__PURE__ */ new Set(["EPERM", "EACCES"]);
|
|
40
|
+
function socketPair() {
|
|
41
|
+
const sides = [];
|
|
42
|
+
const side = (other) => new Duplex({
|
|
43
|
+
read() {
|
|
44
|
+
},
|
|
45
|
+
write(chunk, _encoding, done) {
|
|
46
|
+
other().push(chunk);
|
|
47
|
+
done();
|
|
48
|
+
},
|
|
49
|
+
final(done) {
|
|
50
|
+
other().push(null);
|
|
51
|
+
done();
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
sides.push(
|
|
55
|
+
side(() => sides[1]),
|
|
56
|
+
side(() => sides[0])
|
|
57
|
+
);
|
|
58
|
+
return [sides[0], sides[1]];
|
|
59
|
+
}
|
|
60
|
+
function answerInProcess(server, request) {
|
|
61
|
+
const [client, served] = socketPair();
|
|
62
|
+
server.emit("connection", served);
|
|
63
|
+
return new Promise((resolveAnswer, rejectAnswer) => {
|
|
64
|
+
const req = httpRequest(
|
|
65
|
+
{
|
|
66
|
+
method: request.method,
|
|
67
|
+
path: request.path,
|
|
68
|
+
headers: { ...request.headers, connection: "close" },
|
|
69
|
+
// No `agent`: Node uses createConnection only when no agent is given.
|
|
70
|
+
createConnection: () => client
|
|
71
|
+
},
|
|
72
|
+
(res) => {
|
|
73
|
+
const chunks = [];
|
|
74
|
+
res.on("data", (chunk) => chunks.push(chunk));
|
|
75
|
+
res.on("error", rejectAnswer);
|
|
76
|
+
res.on("end", () => {
|
|
77
|
+
const headers = {};
|
|
78
|
+
for (const [name, value] of Object.entries(res.headers)) {
|
|
79
|
+
if (value !== void 0 && name !== "connection" && name !== "transfer-encoding")
|
|
80
|
+
headers[name] = Array.isArray(value) ? value.join(", ") : value;
|
|
81
|
+
}
|
|
82
|
+
resolveAnswer({ status: res.statusCode ?? 500, headers, body: Buffer.concat(chunks) });
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
req.on("error", rejectAnswer);
|
|
87
|
+
req.end();
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
var inProcessServers = 0;
|
|
91
|
+
var inProcessAnswers = /* @__PURE__ */ new Map();
|
|
92
|
+
function inProcessAnswer(url) {
|
|
93
|
+
return inProcessAnswers.get(new URL(url).origin);
|
|
94
|
+
}
|
|
95
|
+
function serveFileWithRange(filePath, rangeHeader, res, contentType = getMimeType(filePath)) {
|
|
96
|
+
const size = statSync(filePath).size;
|
|
97
|
+
const headers = {
|
|
98
|
+
"Content-Type": contentType,
|
|
99
|
+
"Accept-Ranges": "bytes"
|
|
100
|
+
};
|
|
101
|
+
const last = size - 1;
|
|
102
|
+
let start = 0;
|
|
103
|
+
let end = last;
|
|
104
|
+
let status = 200;
|
|
105
|
+
const match = rangeHeader ? /^bytes=(\d*)-(\d*)$/.exec(rangeHeader.trim()) : null;
|
|
106
|
+
if (match) {
|
|
107
|
+
const hasStart = match[1] !== "";
|
|
108
|
+
start = hasStart ? Number(match[1]) : Math.max(0, size - Number(match[2]));
|
|
109
|
+
end = !hasStart ? last : match[2] !== "" ? Math.min(Number(match[2]), last) : last;
|
|
110
|
+
if (start > end || start > last) {
|
|
111
|
+
res.writeHead(416, { ...headers, "Content-Range": `bytes */${size}` });
|
|
112
|
+
res.end();
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
status = 206;
|
|
116
|
+
headers["Content-Range"] = `bytes ${start}-${end}/${size}`;
|
|
117
|
+
}
|
|
118
|
+
headers["Content-Length"] = String(end - start + 1);
|
|
119
|
+
if (size === 0) {
|
|
120
|
+
res.writeHead(status, headers);
|
|
121
|
+
res.end();
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
const stream = createReadStream(filePath, { start, end });
|
|
125
|
+
res.once("close", () => stream.destroy());
|
|
126
|
+
stream.on("open", () => {
|
|
127
|
+
res.writeHead(status, headers);
|
|
128
|
+
stream.pipe(res);
|
|
129
|
+
});
|
|
130
|
+
stream.on("error", () => {
|
|
131
|
+
if (!res.headersSent) res.writeHead(500);
|
|
132
|
+
res.end();
|
|
133
|
+
stream.destroy();
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
function writeProxyError(err, res) {
|
|
137
|
+
if (err instanceof ProxyCapacityError) {
|
|
138
|
+
res.writeHead(503, { "Content-Type": "text/plain", "Retry-After": "1" });
|
|
139
|
+
res.end(`Proxy transcode deferred: ${err.message}`);
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
if (err instanceof ProxyTranscodeError) {
|
|
143
|
+
res.writeHead(502, { "Content-Type": "text/plain" });
|
|
144
|
+
res.end(`Proxy transcode failed: ${err.message}`);
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
res.writeHead(500);
|
|
148
|
+
res.end();
|
|
149
|
+
}
|
|
150
|
+
async function serveProxyRequest(projectDir, filePath, request, box, autoProxy, rangeHeader, res, signal) {
|
|
151
|
+
const contentType = getMimeType(filePath);
|
|
152
|
+
if (!autoProxy || !contentType.startsWith("video/")) {
|
|
153
|
+
res.writeHead(404);
|
|
154
|
+
res.end();
|
|
155
|
+
return;
|
|
156
|
+
}
|
|
157
|
+
try {
|
|
158
|
+
const facts = await probeAssetCodec(filePath);
|
|
159
|
+
const eligibility = decideMediaProxyEligibility(facts);
|
|
160
|
+
if (!eligibility.eligible) {
|
|
161
|
+
res.writeHead(422, { "Content-Type": "text/plain" });
|
|
162
|
+
res.end(`media proxy unavailable: ${eligibility.reason}`);
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
if (!facts) {
|
|
166
|
+
res.writeHead(422, { "Content-Type": "text/plain" });
|
|
167
|
+
res.end("media proxy unavailable: unknown_codec");
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const variant = resolveProxyVariantRequest(request, facts);
|
|
171
|
+
if (!variant) {
|
|
172
|
+
res.writeHead(422, { "Content-Type": "text/plain" });
|
|
173
|
+
res.end("media proxy variant does not match asset");
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
recordProxyRequest();
|
|
177
|
+
const proxyPath = await resolveProxy(projectDir, filePath, variant, box, { signal });
|
|
178
|
+
if (res.writableEnded || res.destroyed) return;
|
|
179
|
+
serveFileWithRange(proxyPath, rangeHeader, res, PROXY_VARIANT_CONFIG[variant].contentType);
|
|
180
|
+
} catch (err) {
|
|
181
|
+
writeProxyError(err, res);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
async function serveStaticProjectHtml(projectDir, html, bindErrorMessage = "Failed to bind local HTTP server", assetRoots = [], autoProxyOverride) {
|
|
185
|
+
const roots = [projectDir, ...assetRoots];
|
|
186
|
+
const autoProxy = resolveAutoProxy(projectDir, autoProxyOverride);
|
|
187
|
+
const copies = new AbortController();
|
|
188
|
+
const servedHtml = autoProxy ? await injectMediaCodecMapIntoHtml(
|
|
189
|
+
html,
|
|
190
|
+
projectDir,
|
|
191
|
+
[{ html }],
|
|
192
|
+
void 0,
|
|
193
|
+
true,
|
|
194
|
+
copies.signal,
|
|
195
|
+
findStageProxyBox(html)
|
|
196
|
+
) : html;
|
|
197
|
+
const server = createServer((req, res) => {
|
|
198
|
+
const url = req.url ?? "/";
|
|
199
|
+
if (url === "/" || url === "/index.html") {
|
|
200
|
+
res.writeHead(200, { "Content-Type": getMimeType("index.html") });
|
|
201
|
+
res.end(servedHtml);
|
|
202
|
+
return;
|
|
203
|
+
}
|
|
204
|
+
const queryIndex = url.indexOf("?");
|
|
205
|
+
const pathOnly = queryIndex === -1 ? url : url.slice(0, queryIndex);
|
|
206
|
+
const query = new URLSearchParams(queryIndex === -1 ? "" : url.slice(queryIndex + 1));
|
|
207
|
+
const proxyParam = query.get("hf-proxy");
|
|
208
|
+
const proxyRequest = proxyParam !== null && isProxyVariantRequest(proxyParam) ? proxyParam : null;
|
|
209
|
+
const boxParam = query.get(PREVIEW_PROXY_BOX_PARAM);
|
|
210
|
+
const proxyBox = boxParam === null ? void 0 : parsePreviewProxyBox(boxParam);
|
|
211
|
+
if (proxyBox === null || proxyBox && !proxyRequest) {
|
|
212
|
+
res.writeHead(404);
|
|
213
|
+
res.end();
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
const requestPath = decodeWellFormedEscapes(pathOnly).replace(/^\//, "");
|
|
217
|
+
for (const root of roots) {
|
|
218
|
+
const filePath = resolve(root, requestPath);
|
|
219
|
+
const rel = relative(root, filePath);
|
|
220
|
+
if (rel.startsWith("..") || isAbsolute(rel)) continue;
|
|
221
|
+
if (existsSync(filePath)) {
|
|
222
|
+
if (proxyRequest) {
|
|
223
|
+
void serveProxyRequest(
|
|
224
|
+
projectDir,
|
|
225
|
+
filePath,
|
|
226
|
+
proxyRequest,
|
|
227
|
+
proxyBox,
|
|
228
|
+
autoProxy,
|
|
229
|
+
req.headers.range,
|
|
230
|
+
res,
|
|
231
|
+
copies.signal
|
|
232
|
+
);
|
|
233
|
+
} else {
|
|
234
|
+
serveFileWithRange(filePath, req.headers.range, res);
|
|
235
|
+
}
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
res.writeHead(404);
|
|
240
|
+
res.end();
|
|
241
|
+
});
|
|
242
|
+
const port = await new Promise((resolvePort, rejectPort) => {
|
|
243
|
+
server.on("error", rejectPort);
|
|
244
|
+
server.listen(0, "127.0.0.1", () => {
|
|
245
|
+
const addr = server.address();
|
|
246
|
+
const resolvedPort = typeof addr === "object" && addr ? addr.port : 0;
|
|
247
|
+
if (!resolvedPort) rejectPort(new Error(bindErrorMessage));
|
|
248
|
+
else resolvePort(resolvedPort);
|
|
249
|
+
});
|
|
250
|
+
}).catch((error) => {
|
|
251
|
+
if (REFUSED_LISTEN.has(error.code ?? "")) return 0;
|
|
252
|
+
throw error;
|
|
253
|
+
});
|
|
254
|
+
if (port === 0) {
|
|
255
|
+
server.removeAllListeners("error");
|
|
256
|
+
const url = `http://hyperframes-${++inProcessServers}.localhost/`;
|
|
257
|
+
const answer = (request) => answerInProcess(server, request);
|
|
258
|
+
inProcessAnswers.set(new URL(url).origin, answer);
|
|
259
|
+
return {
|
|
260
|
+
url,
|
|
261
|
+
port: 0,
|
|
262
|
+
close: async () => {
|
|
263
|
+
copies.abort();
|
|
264
|
+
inProcessAnswers.delete(new URL(url).origin);
|
|
265
|
+
},
|
|
266
|
+
answer
|
|
267
|
+
};
|
|
268
|
+
}
|
|
269
|
+
return {
|
|
270
|
+
url: `http://127.0.0.1:${port}/`,
|
|
271
|
+
port,
|
|
272
|
+
close: () => new Promise((resolveClose) => {
|
|
273
|
+
copies.abort();
|
|
274
|
+
server.close(() => resolveClose());
|
|
275
|
+
})
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
export {
|
|
280
|
+
inProcessAnswer,
|
|
281
|
+
serveStaticProjectHtml
|
|
282
|
+
};
|
|
@@ -0,0 +1,358 @@
|
|
|
1
|
+
import { createRequire as __hf_createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __hf_fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname as __hf_dirname } from "node:path";
|
|
4
|
+
var require = __hf_createRequire(import.meta.url);
|
|
5
|
+
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __hf_dirname(__filename);
|
|
7
|
+
import {
|
|
8
|
+
parseHTML
|
|
9
|
+
} from "./chunk-SDYDNHEE.js";
|
|
10
|
+
|
|
11
|
+
// src/whisper/normalize.ts
|
|
12
|
+
import { readFileSync, readdirSync, writeFileSync } from "fs";
|
|
13
|
+
import { extname, join } from "path";
|
|
14
|
+
import { parseExpressionAt, tokenizer } from "acorn";
|
|
15
|
+
function detectFormat(filePath) {
|
|
16
|
+
const ext = extname(filePath).toLowerCase();
|
|
17
|
+
if (ext === ".srt") return "srt";
|
|
18
|
+
if (ext === ".vtt") return "vtt";
|
|
19
|
+
if (ext === ".json") return detectJsonFormat(JSON.parse(readFileSync(filePath, "utf-8")));
|
|
20
|
+
throw new Error(`Unsupported transcript file extension: ${ext}. Use .json, .srt, or .vtt`);
|
|
21
|
+
}
|
|
22
|
+
function detectJsonFormat(raw) {
|
|
23
|
+
if (raw && typeof raw === "object" && !Array.isArray(raw)) {
|
|
24
|
+
const obj = raw;
|
|
25
|
+
if (obj.transcription && Array.isArray(obj.transcription)) return "whisper-cpp";
|
|
26
|
+
if (obj.words && Array.isArray(obj.words)) return "openai";
|
|
27
|
+
}
|
|
28
|
+
if (Array.isArray(raw) && raw.slice(0, 1).every((w) => w?.text !== void 0 && w?.start !== void 0)) {
|
|
29
|
+
return "words-json";
|
|
30
|
+
}
|
|
31
|
+
throw new Error(
|
|
32
|
+
"Unrecognized JSON transcript format. Expected whisper.cpp (transcription[].tokens), OpenAI API (words[]), or normalized ([{text, start, end}])."
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
function mergeFragments(words) {
|
|
36
|
+
for (let i = 0; i < words.length - 1; i++) {
|
|
37
|
+
const curr = words[i];
|
|
38
|
+
const next = words[i + 1];
|
|
39
|
+
if (!curr || !next) continue;
|
|
40
|
+
const isSingleLetterFragment = curr.text.length === 1 && /^[A-Z]$/.test(curr.text) && !/^[IAO]$/.test(curr.text) && /^[a-z]/.test(next.text);
|
|
41
|
+
const shouldMerge = isSingleLetterFragment || /[a-z]$/.test(curr.text) && /^in'$/i.test(next.text);
|
|
42
|
+
if (shouldMerge) {
|
|
43
|
+
curr.text += next.text;
|
|
44
|
+
curr.end = next.end;
|
|
45
|
+
words.splice(i + 1, 1);
|
|
46
|
+
i--;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
function interpolateZeroDuration(words) {
|
|
51
|
+
for (let i = 0; i < words.length; i++) {
|
|
52
|
+
const wi = words[i];
|
|
53
|
+
if (!wi || wi.start < wi.end) continue;
|
|
54
|
+
let j = i;
|
|
55
|
+
while (j < words.length) {
|
|
56
|
+
const wj = words[j];
|
|
57
|
+
if (!wj || wj.start < wj.end) break;
|
|
58
|
+
j++;
|
|
59
|
+
}
|
|
60
|
+
const clusterLen = j - i;
|
|
61
|
+
const prev = i > 0 ? words[i - 1] : void 0;
|
|
62
|
+
const prevEnd = prev ? prev.end : wi.start;
|
|
63
|
+
const nextWord = j < words.length ? words[j] : void 0;
|
|
64
|
+
const nextStart = nextWord ? nextWord.start : prevEnd + clusterLen * 0.3;
|
|
65
|
+
const span = nextStart - prevEnd;
|
|
66
|
+
const perWord = span / clusterLen;
|
|
67
|
+
for (let k = i; k < j; k++) {
|
|
68
|
+
const wk = words[k];
|
|
69
|
+
if (!wk) continue;
|
|
70
|
+
wk.start = round3(prevEnd + (k - i) * perWord);
|
|
71
|
+
wk.end = round3(prevEnd + (k - i + 1) * perWord);
|
|
72
|
+
}
|
|
73
|
+
i = j - 1;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
var TRAILING_PUNCTUATION = /^[.,!?;:'")\]}>…–—¡¿\-,。!?、;:」』)】》〉]+$/;
|
|
77
|
+
function crossesCjkBoundary(left, right) {
|
|
78
|
+
return CJK_CHAR.test(left.at(-1) ?? "") || CJK_CHAR.test(right[0] ?? "");
|
|
79
|
+
}
|
|
80
|
+
function continuesWord(previous, rawText, text) {
|
|
81
|
+
return TRAILING_PUNCTUATION.test(text) || /^'(t|m|s|ve|re|ll|d)$/i.test(text) || !rawText.startsWith(" ") && !crossesCjkBoundary(previous, text);
|
|
82
|
+
}
|
|
83
|
+
function parseWhisperCpp(data) {
|
|
84
|
+
const words = [];
|
|
85
|
+
const transcription = data.transcription;
|
|
86
|
+
for (const seg of transcription ?? []) {
|
|
87
|
+
for (const token of seg.tokens ?? []) {
|
|
88
|
+
const rawText = token.text ?? "";
|
|
89
|
+
const text = rawText.trim();
|
|
90
|
+
if (!text || text.startsWith("[_") || text.startsWith("[BLANK")) continue;
|
|
91
|
+
const lastWord = words[words.length - 1];
|
|
92
|
+
if (lastWord && continuesWord(lastWord.text, rawText, text)) {
|
|
93
|
+
lastWord.text += text;
|
|
94
|
+
lastWord.end = round3((token.offsets?.to ?? 0) / 1e3);
|
|
95
|
+
continue;
|
|
96
|
+
}
|
|
97
|
+
words.push({
|
|
98
|
+
text,
|
|
99
|
+
start: round3((token.offsets?.from ?? 0) / 1e3),
|
|
100
|
+
end: round3((token.offsets?.to ?? 0) / 1e3)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
mergeFragments(words);
|
|
105
|
+
interpolateZeroDuration(words);
|
|
106
|
+
return words;
|
|
107
|
+
}
|
|
108
|
+
function parseOpenAI(data) {
|
|
109
|
+
const words = data.words ?? [];
|
|
110
|
+
return words.map((w) => ({
|
|
111
|
+
text: (w.word ?? w.text ?? "").trim(),
|
|
112
|
+
start: round3(w.start ?? 0),
|
|
113
|
+
end: round3(w.end ?? 0)
|
|
114
|
+
})).filter((w) => w.text.length > 0);
|
|
115
|
+
}
|
|
116
|
+
function parseSrt(content) {
|
|
117
|
+
const blocks = content.replace(/\r\n?/g, "\n").trim().split(/\n\n+/);
|
|
118
|
+
const words = [];
|
|
119
|
+
for (const block of blocks) {
|
|
120
|
+
const lines = block.trim().split("\n");
|
|
121
|
+
const timeLine = lines.find((l) => l.includes("-->"));
|
|
122
|
+
if (!timeLine) continue;
|
|
123
|
+
const [startStr, endStr] = timeLine.split("-->").map((s) => s.trim());
|
|
124
|
+
if (!startStr || !endStr) continue;
|
|
125
|
+
const text = lines.slice(lines.indexOf(timeLine) + 1).join(" ").replace(/<[^>]+>/g, "").trim();
|
|
126
|
+
if (!text) continue;
|
|
127
|
+
words.push({
|
|
128
|
+
text,
|
|
129
|
+
start: parseSrtTimestamp(startStr),
|
|
130
|
+
end: parseSrtTimestamp(endStr)
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return words;
|
|
134
|
+
}
|
|
135
|
+
function decodeVttText(text) {
|
|
136
|
+
if (!text.includes("&")) return text;
|
|
137
|
+
const { document } = parseHTML("<html><body></body></html>");
|
|
138
|
+
const element = document.createElement("span");
|
|
139
|
+
element.innerHTML = text.replace(/</g, "<");
|
|
140
|
+
return element.textContent ?? "";
|
|
141
|
+
}
|
|
142
|
+
function parseVtt(content) {
|
|
143
|
+
const body = content.replace(/\r\n?/g, "\n").replace(/^WEBVTT[^\n]*\n/, "");
|
|
144
|
+
const blocks = body.trim().split(/\n\n+/);
|
|
145
|
+
const words = [];
|
|
146
|
+
for (const block of blocks) {
|
|
147
|
+
const lines = block.trim().split("\n");
|
|
148
|
+
const timeLine = lines.find((l) => l.includes("-->"));
|
|
149
|
+
if (!timeLine) continue;
|
|
150
|
+
const [startStr, endStr] = timeLine.split("-->").map((s) => s.trim());
|
|
151
|
+
if (!startStr || !endStr) continue;
|
|
152
|
+
const text = lines.slice(lines.indexOf(timeLine) + 1).join(" ").replace(/<[^>]+>/g, "").trim();
|
|
153
|
+
if (!text) continue;
|
|
154
|
+
words.push({
|
|
155
|
+
text: decodeVttText(text),
|
|
156
|
+
start: parseVttTimestamp(startStr),
|
|
157
|
+
end: parseVttTimestamp(endStr)
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
return words;
|
|
161
|
+
}
|
|
162
|
+
function parseSrtTimestamp(ts) {
|
|
163
|
+
const m = ts.match(/(\d+):(\d+):(\d+)[,.](\d+)/);
|
|
164
|
+
if (!m) return 0;
|
|
165
|
+
return parseInt(m[1], 10) * 3600 + parseInt(m[2], 10) * 60 + parseInt(m[3], 10) + parseInt(m[4].padEnd(3, "0"), 10) / 1e3;
|
|
166
|
+
}
|
|
167
|
+
function parseVttTimestamp(ts) {
|
|
168
|
+
const timestamp = ts.split(/[ \t]+/, 1)[0] ?? "";
|
|
169
|
+
const parts = timestamp.split(":");
|
|
170
|
+
if (parts.length === 3) return parseSrtTimestamp(timestamp);
|
|
171
|
+
if (parts.length === 2) {
|
|
172
|
+
const [min, secMs] = parts;
|
|
173
|
+
const [sec, ms] = (secMs ?? "0.0").split(".");
|
|
174
|
+
return parseInt(min, 10) * 60 + parseInt(sec, 10) + parseInt((ms ?? "0").padEnd(3, "0"), 10) / 1e3;
|
|
175
|
+
}
|
|
176
|
+
return 0;
|
|
177
|
+
}
|
|
178
|
+
function formatSrtTimestamp(seconds) {
|
|
179
|
+
const { hours, minutes, wholeSeconds, milliseconds } = timestampParts(seconds);
|
|
180
|
+
return `${pad2(hours)}:${pad2(minutes)}:${pad2(wholeSeconds)},${pad3(milliseconds)}`;
|
|
181
|
+
}
|
|
182
|
+
function formatVttTimestamp(seconds) {
|
|
183
|
+
const { hours, minutes, wholeSeconds, milliseconds } = timestampParts(seconds);
|
|
184
|
+
return `${pad2(hours)}:${pad2(minutes)}:${pad2(wholeSeconds)}.${pad3(milliseconds)}`;
|
|
185
|
+
}
|
|
186
|
+
function round3(n) {
|
|
187
|
+
return Math.round(n * 1e3) / 1e3;
|
|
188
|
+
}
|
|
189
|
+
function timestampParts(seconds) {
|
|
190
|
+
const safeSeconds = Number.isFinite(seconds) ? seconds : 0;
|
|
191
|
+
const totalMs = Math.max(0, Math.round(safeSeconds * 1e3));
|
|
192
|
+
const milliseconds = totalMs % 1e3;
|
|
193
|
+
const totalSeconds = (totalMs - milliseconds) / 1e3;
|
|
194
|
+
const wholeSeconds = totalSeconds % 60;
|
|
195
|
+
const totalMinutes = (totalSeconds - wholeSeconds) / 60;
|
|
196
|
+
const minutes = totalMinutes % 60;
|
|
197
|
+
const hours = (totalMinutes - minutes) / 60;
|
|
198
|
+
return { hours, minutes, wholeSeconds, milliseconds };
|
|
199
|
+
}
|
|
200
|
+
function pad2(n) {
|
|
201
|
+
return n.toString().padStart(2, "0");
|
|
202
|
+
}
|
|
203
|
+
function pad3(n) {
|
|
204
|
+
return n.toString().padStart(3, "0");
|
|
205
|
+
}
|
|
206
|
+
function endsSentence(text) {
|
|
207
|
+
return /[.!?。!?][)"'\]}」』)]*$/.test(text);
|
|
208
|
+
}
|
|
209
|
+
function pushCue(cues, cue) {
|
|
210
|
+
if (!cue) return;
|
|
211
|
+
const text = cue.text.trim();
|
|
212
|
+
if (!text) return;
|
|
213
|
+
cues.push({ text, start: round3(cue.start), end: round3(cue.end) });
|
|
214
|
+
}
|
|
215
|
+
function breaksCue(current, word, text, maxChars, maxGap) {
|
|
216
|
+
const nextLength = current.text.length + 1 + text.length;
|
|
217
|
+
const gap = word.start - current.end;
|
|
218
|
+
return nextLength > maxChars || gap > maxGap;
|
|
219
|
+
}
|
|
220
|
+
function entriesToCues(words) {
|
|
221
|
+
const cues = [];
|
|
222
|
+
for (const word of words) {
|
|
223
|
+
pushCue(cues, { text: word.text, start: word.start, end: word.end });
|
|
224
|
+
}
|
|
225
|
+
return cues;
|
|
226
|
+
}
|
|
227
|
+
var CJK_CHAR = /[ -〿-ヿ㐀-䶿一-鿿豈--]/;
|
|
228
|
+
var SPACELESS_SCRIPT_CHAR = /[--က-႟ក- -〿-ヿ㐀-䶿一-鿿豈--]/;
|
|
229
|
+
var SPACELESS_PHRASE_MIN_CHARS = 4;
|
|
230
|
+
function median(values) {
|
|
231
|
+
const sorted = [...values].sort((a, b) => a - b);
|
|
232
|
+
const mid = Math.floor(sorted.length / 2);
|
|
233
|
+
if (sorted.length === 0) return 0;
|
|
234
|
+
if (sorted.length % 2 === 1) return sorted[mid] ?? 0;
|
|
235
|
+
return ((sorted[mid - 1] ?? 0) + (sorted[mid] ?? 0)) / 2;
|
|
236
|
+
}
|
|
237
|
+
function inferPreGrouped(words) {
|
|
238
|
+
if (words.some((w) => /\s/.test(w.text.trim()))) return true;
|
|
239
|
+
const spaceless = words.filter((w) => SPACELESS_SCRIPT_CHAR.test(w.text));
|
|
240
|
+
if (spaceless.length === 0) return false;
|
|
241
|
+
return median(spaceless.map((w) => w.text.trim().length)) >= SPACELESS_PHRASE_MIN_CHARS;
|
|
242
|
+
}
|
|
243
|
+
function joinTokens(left, right) {
|
|
244
|
+
return `${left}${crossesCjkBoundary(left, right) ? "" : " "}${right}`;
|
|
245
|
+
}
|
|
246
|
+
function wordsToCues(words, opts = {}) {
|
|
247
|
+
const preGrouped = opts.preGrouped ?? inferPreGrouped(words);
|
|
248
|
+
if (preGrouped) return entriesToCues(words);
|
|
249
|
+
const maxChars = opts.maxChars ?? 42;
|
|
250
|
+
const maxGap = opts.maxGap ?? 0.8;
|
|
251
|
+
const cues = [];
|
|
252
|
+
let current;
|
|
253
|
+
const flush = () => {
|
|
254
|
+
pushCue(cues, current);
|
|
255
|
+
current = void 0;
|
|
256
|
+
};
|
|
257
|
+
for (const word of words) {
|
|
258
|
+
const text = word.text.trim();
|
|
259
|
+
if (!text) continue;
|
|
260
|
+
if (current && !breaksCue(current, word, text, maxChars, maxGap)) {
|
|
261
|
+
current.text = joinTokens(current.text, text);
|
|
262
|
+
current.end = word.end;
|
|
263
|
+
} else {
|
|
264
|
+
flush();
|
|
265
|
+
current = { text, start: word.start, end: word.end };
|
|
266
|
+
}
|
|
267
|
+
if (endsSentence(text)) flush();
|
|
268
|
+
}
|
|
269
|
+
flush();
|
|
270
|
+
return cues;
|
|
271
|
+
}
|
|
272
|
+
function formatSrt(words, opts) {
|
|
273
|
+
const cues = wordsToCues(words, opts);
|
|
274
|
+
if (cues.length === 0) return "";
|
|
275
|
+
return cues.map(
|
|
276
|
+
(cue, i) => `${i + 1}
|
|
277
|
+
${formatSrtTimestamp(cue.start)} --> ${formatSrtTimestamp(cue.end)}
|
|
278
|
+
${cue.text}`
|
|
279
|
+
).join("\n\n") + "\n";
|
|
280
|
+
}
|
|
281
|
+
function formatVtt(words, opts) {
|
|
282
|
+
const cues = wordsToCues(words, opts);
|
|
283
|
+
if (cues.length === 0) return "WEBVTT\n\n";
|
|
284
|
+
return "WEBVTT\n\n" + cues.map(
|
|
285
|
+
(cue) => `${formatVttTimestamp(cue.start)} --> ${formatVttTimestamp(cue.end)}
|
|
286
|
+
${cue.text.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">")}`
|
|
287
|
+
).join("\n\n") + "\n";
|
|
288
|
+
}
|
|
289
|
+
function loadTranscript(filePath) {
|
|
290
|
+
const ext = extname(filePath).toLowerCase();
|
|
291
|
+
const content = readFileSync(filePath, "utf-8");
|
|
292
|
+
if (ext === ".srt") {
|
|
293
|
+
const words2 = parseSrt(content).map((w, i) => ({ ...w, id: w.id ?? `w${i}` }));
|
|
294
|
+
return { words: words2, format: "srt" };
|
|
295
|
+
}
|
|
296
|
+
if (ext === ".vtt") {
|
|
297
|
+
const words2 = parseVtt(content).map((w, i) => ({ ...w, id: w.id ?? `w${i}` }));
|
|
298
|
+
return { words: words2, format: "vtt" };
|
|
299
|
+
}
|
|
300
|
+
const parsed = JSON.parse(content);
|
|
301
|
+
const format = detectJsonFormat(parsed);
|
|
302
|
+
const words = (format === "whisper-cpp" ? parseWhisperCpp(parsed) : format === "openai" ? parseOpenAI(parsed) : parsed.map((w) => ({
|
|
303
|
+
id: w.id,
|
|
304
|
+
text: w.text.trim(),
|
|
305
|
+
start: round3(w.start),
|
|
306
|
+
end: round3(w.end)
|
|
307
|
+
}))).map((w, i) => ({ ...w, id: w.id || `w${i}` }));
|
|
308
|
+
return { words, format };
|
|
309
|
+
}
|
|
310
|
+
function findCaptionArray(source, name) {
|
|
311
|
+
const prefix = `const ${name} = `;
|
|
312
|
+
const start = source.indexOf(`${prefix}[`);
|
|
313
|
+
if (start < 0) return void 0;
|
|
314
|
+
try {
|
|
315
|
+
const array = parseExpressionAt(source, start + prefix.length, { ecmaVersion: "latest" });
|
|
316
|
+
if (array.type !== "ArrayExpression") return void 0;
|
|
317
|
+
const terminator = tokenizer(source.slice(array.end), { ecmaVersion: "latest" }).getToken();
|
|
318
|
+
if (terminator.type.label !== ";") return void 0;
|
|
319
|
+
return source.slice(start, array.end + terminator.end);
|
|
320
|
+
} catch {
|
|
321
|
+
return void 0;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
function patchCaptionHtml(dir, words) {
|
|
325
|
+
if (words.length === 0) return;
|
|
326
|
+
const wordsJson = JSON.stringify(words, null, 2).replace(/</g, "\\u003c").replace(/\n/g, "\n ");
|
|
327
|
+
let htmlFiles;
|
|
328
|
+
try {
|
|
329
|
+
htmlFiles = readdirSync(dir, { withFileTypes: true, recursive: true }).filter((e) => e.isFile() && e.name.endsWith(".html")).map((e) => join(e.parentPath, e.name));
|
|
330
|
+
} catch {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
for (const file of htmlFiles) {
|
|
334
|
+
let content = readFileSync(file, "utf-8");
|
|
335
|
+
const scriptBlocks = content.match(/<script>[\s\S]*?<\/script>/g) ?? [];
|
|
336
|
+
let scriptMatch;
|
|
337
|
+
let transcriptMatch;
|
|
338
|
+
for (const block of scriptBlocks) {
|
|
339
|
+
scriptMatch = scriptMatch ?? findCaptionArray(block, "script");
|
|
340
|
+
transcriptMatch = transcriptMatch ?? findCaptionArray(block, "TRANSCRIPT");
|
|
341
|
+
}
|
|
342
|
+
const match = scriptMatch ?? transcriptMatch;
|
|
343
|
+
if (match) {
|
|
344
|
+
const varName = scriptMatch ? "script" : "TRANSCRIPT";
|
|
345
|
+
content = content.replace(match, () => `const ${varName} = ${wordsJson};`);
|
|
346
|
+
writeFileSync(file, content, "utf-8");
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
|
|
351
|
+
export {
|
|
352
|
+
detectFormat,
|
|
353
|
+
wordsToCues,
|
|
354
|
+
formatSrt,
|
|
355
|
+
formatVtt,
|
|
356
|
+
loadTranscript,
|
|
357
|
+
patchCaptionHtml
|
|
358
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createRequire as __hf_createRequire } from "node:module";
|
|
2
|
+
import { fileURLToPath as __hf_fileURLToPath } from "node:url";
|
|
3
|
+
import { dirname as __hf_dirname } from "node:path";
|
|
4
|
+
var require = __hf_createRequire(import.meta.url);
|
|
5
|
+
var __filename = __hf_fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = __hf_dirname(__filename);
|
|
7
|
+
|
|
8
|
+
// ../parsers/dist/compositionDuration.js
|
|
9
|
+
var TIMING_TOLERANCE_SECONDS = 0.05;
|
|
10
|
+
var isPositiveFinite = (value) => value !== null && Number.isFinite(value) && value > 0;
|
|
11
|
+
function resolveCompositionDuration(input) {
|
|
12
|
+
const pendingClips = input.clipEndsSeconds.filter((end) => end === null).length;
|
|
13
|
+
if (isPositiveFinite(input.authoredDurationSeconds)) {
|
|
14
|
+
return { seconds: input.authoredDurationSeconds, source: "authored", pendingClips };
|
|
15
|
+
}
|
|
16
|
+
const known = input.clipEndsSeconds.filter(isPositiveFinite);
|
|
17
|
+
if (known.length > 0) {
|
|
18
|
+
return { seconds: Math.max(...known), source: "derived", pendingClips };
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
seconds: null,
|
|
22
|
+
source: "unresolved",
|
|
23
|
+
pendingClips,
|
|
24
|
+
reason: pendingClips > 0 ? "every clip's length is still pending" : "no authored duration and no clip with a length"
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
TIMING_TOLERANCE_SECONDS,
|
|
30
|
+
resolveCompositionDuration
|
|
31
|
+
};
|