videobook 0.0.0-stage → 0.2.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/CHANGELOG.md +54 -0
- package/LICENSE +21 -0
- package/README.md +195 -2
- package/bin/videobook.js +7 -0
- package/dist/acestep/client.js +203 -0
- package/dist/acestep/config.js +62 -0
- package/dist/acestep/errors.js +8 -0
- package/dist/acestep/process.js +175 -0
- package/dist/alive-captions/analyze.js +117 -0
- package/dist/alive-captions/audio.js +179 -0
- package/dist/alive-captions/frames.js +59 -0
- package/dist/alive-captions/model.js +37 -0
- package/dist/alive-captions/schema.js +49 -0
- package/dist/alive-captions/track.js +9 -0
- package/dist/api-key.js +33 -0
- package/dist/app-state.js +56 -0
- package/dist/app.js +257 -0
- package/dist/archive-b2.js +332 -0
- package/dist/archive-store.js +169 -0
- package/dist/artifact-label.js +36 -0
- package/dist/artifact-refs.js +49 -0
- package/dist/asset-tag-extraction.js +169 -0
- package/dist/asset-tags.js +228 -0
- package/dist/asset-usage.js +23 -0
- package/dist/audio-cue.js +71 -0
- package/dist/audio-encoding.js +32 -0
- package/dist/audio-sync-request.js +1 -0
- package/dist/audio-sync.js +223 -0
- package/dist/audio-trim-range.js +31 -0
- package/dist/book-context.js +31 -0
- package/dist/book-manager.js +374 -0
- package/dist/catalog-gc.js +26 -0
- package/dist/chain-executor.js +815 -0
- package/dist/chain-generation.js +115 -0
- package/dist/chain-plan.js +746 -0
- package/dist/chain-step-review.js +60 -0
- package/dist/character-name.js +25 -0
- package/dist/chat-generation-routing.js +73 -0
- package/dist/chat-generation-settings.js +78 -0
- package/dist/chat-models.js +44 -0
- package/dist/chat-prompt-rewrite.js +67 -0
- package/dist/chat-router.js +628 -0
- package/dist/chat-view-actions.js +49 -0
- package/dist/cli/args.js +242 -0
- package/dist/cli/config-command.js +103 -0
- package/dist/cli/doctor-command.js +289 -0
- package/dist/cli/entry.js +2 -0
- package/dist/cli/key-report.js +16 -0
- package/dist/cli/main.js +104 -0
- package/dist/cli/mcp-command.js +88 -0
- package/dist/cli/mcp-relay.js +51 -0
- package/dist/cli/open-browser.js +14 -0
- package/dist/cli/run-command.js +231 -0
- package/dist/cli/serve-command.js +62 -0
- package/dist/cli/setup-command.js +60 -0
- package/dist/cli/stdio-guard.js +8 -0
- package/dist/cold-open-model.js +7 -0
- package/dist/cold-open.js +79 -0
- package/dist/command-reference.js +95 -0
- package/dist/content-store.js +74 -0
- package/dist/cost.js +8 -0
- package/dist/crop-geometry.js +23 -0
- package/dist/dancing-workflow.js +447 -0
- package/dist/data-home.js +44 -0
- package/dist/diagnostics.js +109 -0
- package/dist/dialog-quality.js +34 -0
- package/dist/downloads-dest.js +56 -0
- package/dist/editing-moments.js +194 -0
- package/dist/elevenlabs-audio-extension.js +66 -0
- package/dist/engine.js +54 -0
- package/dist/env-file.js +91 -0
- package/dist/env-secrets.js +148 -0
- package/dist/ffmpeg-binary.js +12 -0
- package/dist/ffmpeg.js +425 -0
- package/dist/ffprobe-binary.js +77 -0
- package/dist/forget-asset.js +216 -0
- package/dist/frame-utils.js +27 -0
- package/dist/generation-credit-error.js +11 -0
- package/dist/generation-input-mentions.js +117 -0
- package/dist/generation-input-policy.js +68 -0
- package/dist/generation-reference-mentions.js +97 -0
- package/dist/goal-characters.js +49 -0
- package/dist/goal-plan-v3.js +273 -0
- package/dist/goal-plan.js +220 -0
- package/dist/goal-planner-prompt.js +28 -0
- package/dist/goal-prompt-budget.js +4 -0
- package/dist/goal-reference-images.js +25 -0
- package/dist/goal-state.js +261 -0
- package/dist/goal-stills.js +153 -0
- package/dist/goal-store.js +144 -0
- package/dist/goal-styles.js +144 -0
- package/dist/goal-v3-runtime.js +157 -0
- package/dist/guides/character_schema_guide.md +70 -0
- package/dist/guides/gpt_image_2_5_prompting_guide.md +21 -0
- package/dist/guides/grok_imagine_prompting_guide.md +72 -0
- package/dist/guides/image_reproduction_guide.md +84 -0
- package/dist/guides/kling_3_0_prompting_guide.md +136 -0
- package/dist/guides/nano_banana_pro_prompting_guide.md +28 -0
- package/dist/guides/seedance_2_prompting_guide.md +172 -0
- package/dist/http-access.js +49 -0
- package/dist/http-byte-range.js +31 -0
- package/dist/hydration.js +56 -0
- package/dist/image-compress.js +77 -0
- package/dist/image-edit-default.js +1 -0
- package/dist/image-edit-models.js +41 -0
- package/dist/image-edit-settings.js +11 -0
- package/dist/image-region-edit.js +32 -0
- package/dist/image-subject-map.js +523 -0
- package/dist/image.js +46 -0
- package/dist/index.js +12 -0
- package/dist/job-deadline.js +60 -0
- package/dist/jobs/_alibaba-upload.js +30 -0
- package/dist/jobs/_audio-chunks.js +31 -0
- package/dist/jobs/_download-into-asset.js +15 -0
- package/dist/jobs/_fal-shared.js +22 -0
- package/dist/jobs/_fal-upload.js +35 -0
- package/dist/jobs/_image-edit-adapter.js +213 -0
- package/dist/jobs/_kie-poll.js +119 -0
- package/dist/jobs/_kie-upload.js +32 -0
- package/dist/jobs/_lease.js +163 -0
- package/dist/jobs/_persist-output.js +19 -0
- package/dist/jobs/_storage-retry.js +21 -0
- package/dist/jobs/_transcribe.js +245 -0
- package/dist/jobs/_translate-transcript.js +270 -0
- package/dist/jobs/analyze-alive-captions.js +10 -0
- package/dist/jobs/analyze-editing-moments.js +104 -0
- package/dist/jobs/analyze-jokes.js +143 -0
- package/dist/jobs/analyze-keyword-placement.js +155 -0
- package/dist/jobs/analyze-music.js +14 -0
- package/dist/jobs/analyze-video.js +282 -0
- package/dist/jobs/apply-cuts.js +83 -0
- package/dist/jobs/apply-sfx.js +107 -0
- package/dist/jobs/archive-clip.js +458 -0
- package/dist/jobs/assemble-goal.js +98 -0
- package/dist/jobs/audio-boost.js +71 -0
- package/dist/jobs/audio-mix.js +161 -0
- package/dist/jobs/backfill-asset-tags.js +144 -0
- package/dist/jobs/burn-watermark.js +316 -0
- package/dist/jobs/change-video-speed.js +176 -0
- package/dist/jobs/clean-video-audio.js +207 -0
- package/dist/jobs/cold-open.js +166 -0
- package/dist/jobs/combine-goal.js +108 -0
- package/dist/jobs/complete-provider-task.js +185 -0
- package/dist/jobs/copy-library-asset.js +33 -0
- package/dist/jobs/cost-estimate-assessment.js +113 -0
- package/dist/jobs/crop-image.js +47 -0
- package/dist/jobs/crop-video.js +71 -0
- package/dist/jobs/describe-image.js +181 -0
- package/dist/jobs/detect-scenes.js +33 -0
- package/dist/jobs/doctor-fix.js +100 -0
- package/dist/jobs/download-video.js +427 -0
- package/dist/jobs/enqueue-search-index.js +24 -0
- package/dist/jobs/even-split.js +122 -0
- package/dist/jobs/export-sequence.js +365 -0
- package/dist/jobs/extend-audio.js +229 -0
- package/dist/jobs/extract-audio.js +72 -0
- package/dist/jobs/extract-frame.js +58 -0
- package/dist/jobs/extract-notebook-audio.js +82 -0
- package/dist/jobs/extract-notebook-frame.js +93 -0
- package/dist/jobs/extract-video-clip.js +8 -0
- package/dist/jobs/extract-video-poster.js +55 -0
- package/dist/jobs/extract-waveform.js +25 -0
- package/dist/jobs/finish-goal.js +255 -0
- package/dist/jobs/forget-asset.js +11 -0
- package/dist/jobs/generate-acestep-cover.js +219 -0
- package/dist/jobs/generate-media.js +70 -0
- package/dist/jobs/image-subjects.js +1059 -0
- package/dist/jobs/index.js +18 -0
- package/dist/jobs/inject-first-frame.js +175 -0
- package/dist/jobs/isolate-vocals.js +69 -0
- package/dist/jobs/kie-paygate.js +177 -0
- package/dist/jobs/label-music-sections.js +5 -0
- package/dist/jobs/osg-placement.js +135 -0
- package/dist/jobs/pad-video.js +72 -0
- package/dist/jobs/plan-goal.js +97 -0
- package/dist/jobs/post-record.js +21 -0
- package/dist/jobs/post-to-x.js +21 -0
- package/dist/jobs/prepare-search-reference.js +190 -0
- package/dist/jobs/prepare-temporal-search.js +16 -0
- package/dist/jobs/process-audio.js +67 -0
- package/dist/jobs/process-image.js +58 -0
- package/dist/jobs/process-upload.js +166 -0
- package/dist/jobs/process-video.js +438 -0
- package/dist/jobs/register-all.js +161 -0
- package/dist/jobs/relayout-notebook.js +78 -0
- package/dist/jobs/remove-sound.js +299 -0
- package/dist/jobs/render-project.js +380 -0
- package/dist/jobs/render-qr-outro.js +138 -0
- package/dist/jobs/render-timeline.js +283 -0
- package/dist/jobs/repair-search-indexes.js +42 -0
- package/dist/jobs/replace-video-audio.js +64 -0
- package/dist/jobs/restore-archive-clip.js +53 -0
- package/dist/jobs/reverse-video.js +53 -0
- package/dist/jobs/rewrite-script.js +173 -0
- package/dist/jobs/run-notebook.js +3335 -0
- package/dist/jobs/semantic-index.js +797 -0
- package/dist/jobs/smooth-scene-concat.js +257 -0
- package/dist/jobs/splice-video.js +280 -0
- package/dist/jobs/split-video.js +127 -0
- package/dist/jobs/suggest-cuts.js +149 -0
- package/dist/jobs/suggest-sfx.js +135 -0
- package/dist/jobs/sync-video-to-audio.js +329 -0
- package/dist/jobs/tag-asset.js +266 -0
- package/dist/jobs/task-failure.js +16 -0
- package/dist/jobs/timewarp-video.js +152 -0
- package/dist/jobs/transcribe-video-audio.js +117 -0
- package/dist/jobs/transcribe.js +35 -0
- package/dist/jobs/translate-transcript.js +55 -0
- package/dist/jobs/trim-audio.js +133 -0
- package/dist/jobs/trim-video.js +291 -0
- package/dist/jobs/xai-paygate.js +26 -0
- package/dist/keyword-placement-cache.js +74 -0
- package/dist/lazy-render.js +142 -0
- package/dist/library-browse.js +78 -0
- package/dist/lightning-defaults.js +206 -0
- package/dist/load-env.js +12 -0
- package/dist/local-search-models.js +206 -0
- package/dist/local-upload.js +318 -0
- package/dist/logger.js +69 -0
- package/dist/media/adapters/alibaba.js +20 -0
- package/dist/media/adapters/elevenlabs.js +58 -0
- package/dist/media/adapters/fal.js +45 -0
- package/dist/media/adapters/index.js +26 -0
- package/dist/media/adapters/kie.js +120 -0
- package/dist/media/adapters/pending.js +21 -0
- package/dist/media/adapters/types.js +5 -0
- package/dist/media/adapters/xai.js +18 -0
- package/dist/media/catalog.js +236 -0
- package/dist/media/complete.js +191 -0
- package/dist/media/cost.js +45 -0
- package/dist/media/descriptor.js +157 -0
- package/dist/media/endpoints.js +11 -0
- package/dist/media/frame-options.js +18 -0
- package/dist/media/insert-video-timing.js +17 -0
- package/dist/media/json-schema.js +75 -0
- package/dist/media/legacy-task-types.js +129 -0
- package/dist/media/listing.js +24 -0
- package/dist/media/model-id.js +14 -0
- package/dist/media/preview.js +86 -0
- package/dist/media/prompt-dialects.js +65 -0
- package/dist/media/ref-fields.js +106 -0
- package/dist/media/refs.js +131 -0
- package/dist/media/request.js +188 -0
- package/dist/media/types.js +6 -0
- package/dist/media/wire.js +161 -0
- package/dist/media-library.js +535 -0
- package/dist/media-output-path.js +33 -0
- package/dist/multyculty-workflow.js +757 -0
- package/dist/notebook-action-catalog.js +608 -0
- package/dist/notebook-cell-outputs.js +726 -0
- package/dist/notebook-credit-retry.js +45 -0
- package/dist/notebook-fixtures.js +8 -0
- package/dist/notebook-generation-contract.js +77 -0
- package/dist/notebook-generation-controls.js +145 -0
- package/dist/notebook-goal-layout.js +40 -0
- package/dist/notebook-graph.js +37 -0
- package/dist/notebook-image-edit.js +84 -0
- package/dist/notebook-initial-generation-prompt.js +222 -0
- package/dist/notebook-live-analysis.js +941 -0
- package/dist/notebook-media-ops.js +579 -0
- package/dist/notebook-mutations.js +20 -0
- package/dist/notebook-placement.js +41 -0
- package/dist/notebook-provider-failure.js +87 -0
- package/dist/notebook-published-post.js +26 -0
- package/dist/notebook-reference-resolver.js +227 -0
- package/dist/notebook-relayout.js +270 -0
- package/dist/notebook-run-plan.js +519 -0
- package/dist/notebook-shots.js +162 -0
- package/dist/notebook-workflow.js +856 -0
- package/dist/one-password.js +200 -0
- package/dist/openai-intelligence.js +99 -0
- package/dist/original-media-file.js +12 -0
- package/dist/osg-assets.js +36 -0
- package/dist/osg-placement-cache.js +64 -0
- package/dist/osg-settings.js +27 -0
- package/dist/paid-tools.js +22 -0
- package/dist/platform-guidance.js +26 -0
- package/dist/posts/dropbox-auth.js +91 -0
- package/dist/posts/dropbox-upload.js +132 -0
- package/dist/posts/icloud-drive.js +134 -0
- package/dist/posts/icloud-status.js +64 -0
- package/dist/posts/post-contract.js +2 -0
- package/dist/posts/post-copy-format.js +43 -0
- package/dist/posts/post-copy.js +193 -0
- package/dist/posts/post-folder.js +18 -0
- package/dist/posts/post-metrics.js +119 -0
- package/dist/posts/post-store.js +340 -0
- package/dist/posts/x-post-target.js +43 -0
- package/dist/preview-payload.js +90 -0
- package/dist/prompt-surfaces.js +22 -0
- package/dist/provider-prompt-transform.js +77 -0
- package/dist/provider-status-link.js +21 -0
- package/dist/provider-task-record.js +78 -0
- package/dist/provider-task-status.js +47 -0
- package/dist/provider-usage.js +294 -0
- package/dist/queue.js +810 -0
- package/dist/reference-video-duration.js +17 -0
- package/dist/remotion/BlurFillVideo.js +51 -0
- package/dist/remotion/KeywordGraphicsOverlay.js +68 -0
- package/dist/remotion/OsgOverlay.js +30 -0
- package/dist/remotion/QrOutroComposition.js +47 -0
- package/dist/remotion/RenderComposition.js +11 -0
- package/dist/remotion/browser.js +59 -0
- package/dist/remotion/constants.js +35 -0
- package/dist/remotion/index.js +66 -0
- package/dist/remotion/keyword-graphics.js +151 -0
- package/dist/remotion/keyword-placement.js +182 -0
- package/dist/remotion/osg-spec.js +198 -0
- package/dist/remotion/public/qr-outro-impact.wav +0 -0
- package/dist/remotion/qr-outro-audio.js +1 -0
- package/dist/remotion/qr-outro-spec.js +211 -0
- package/dist/remotion/shared-bundle.js +37 -0
- package/dist/remotion/subtitles/AliveCaptions.js +83 -0
- package/dist/remotion/subtitles/Highlight.js +58 -0
- package/dist/remotion/subtitles/Impact.js +67 -0
- package/dist/remotion/subtitles/SubtitleOverlay.js +9 -0
- package/dist/remotion/subtitles/alive-layout.js +321 -0
- package/dist/remotion/subtitles/alive-types.js +17 -0
- package/dist/remotion/subtitles/chunker.js +68 -0
- package/dist/remotion/subtitles/segments.js +42 -0
- package/dist/remotion/subtitles/styles.js +4 -0
- package/dist/remotion/subtitles/types.js +1 -0
- package/dist/remotion/util.js +18 -0
- package/dist/remotion-cancellation.js +15 -0
- package/dist/rename-helpers.js +204 -0
- package/dist/rhythm/analyze.js +128 -0
- package/dist/rhythm/contract.js +14 -0
- package/dist/rhythm/draft-model.js +19 -0
- package/dist/rhythm/energy.js +133 -0
- package/dist/rhythm/fft.js +44 -0
- package/dist/rhythm/model.js +71 -0
- package/dist/rhythm/music-analysis.js +124 -0
- package/dist/rhythm/music-draft.js +261 -0
- package/dist/rhythm/onset.js +101 -0
- package/dist/rhythm/run-worker.js +51 -0
- package/dist/rhythm/score.js +47 -0
- package/dist/rhythm/section-labels.js +168 -0
- package/dist/rhythm/sequence-rhythm.js +67 -0
- package/dist/rhythm/synthesize.js +103 -0
- package/dist/rhythm/timing.js +98 -0
- package/dist/rhythm/track.js +320 -0
- package/dist/rhythm/visual-fit.js +4 -0
- package/dist/rhythm/worker.js +25 -0
- package/dist/scene-detect.js +200 -0
- package/dist/scene-transition.js +12 -0
- package/dist/scheduled-posts.js +200 -0
- package/dist/search-index-coverage.js +13 -0
- package/dist/search-index-media.js +71 -0
- package/dist/search-reference-store.js +60 -0
- package/dist/search-scoring.js +17 -0
- package/dist/serve.js +125 -0
- package/dist/server-lock.js +143 -0
- package/dist/server.js +42 -0
- package/dist/srt.js +16 -0
- package/dist/tag-backfill-state.js +121 -0
- package/dist/tag-settings.js +30 -0
- package/dist/tag-vocabulary.js +237 -0
- package/dist/test-queue-cleanup.js +1 -0
- package/dist/time-parse.js +50 -0
- package/dist/timeline-helpers.js +554 -0
- package/dist/timewarp.js +87 -0
- package/dist/tools/_image-inputs.js +9 -0
- package/dist/tools/_media-refs.js +84 -0
- package/dist/tools/_shared.js +59 -0
- package/dist/tools/_suggest-shared.js +279 -0
- package/dist/tools/add-timeline-audio.js +73 -0
- package/dist/tools/alive-captions.js +157 -0
- package/dist/tools/analyze-jokes.js +56 -0
- package/dist/tools/analyze-video.js +66 -0
- package/dist/tools/animate-keywords.js +217 -0
- package/dist/tools/api-status.js +42 -0
- package/dist/tools/application-commands.js +34 -0
- package/dist/tools/apply-cuts.js +112 -0
- package/dist/tools/apply-sfx.js +152 -0
- package/dist/tools/apply-watermark.js +670 -0
- package/dist/tools/archive-clip.js +74 -0
- package/dist/tools/asset-history.js +61 -0
- package/dist/tools/asset-manifest.js +24 -0
- package/dist/tools/asset-tags.js +151 -0
- package/dist/tools/assign-slot.js +97 -0
- package/dist/tools/audio-boost.js +107 -0
- package/dist/tools/audio-mix.js +121 -0
- package/dist/tools/book-usage.js +16 -0
- package/dist/tools/chain.js +136 -0
- package/dist/tools/change-video-speed.js +105 -0
- package/dist/tools/chat-history.js +5 -0
- package/dist/tools/chat.js +848 -0
- package/dist/tools/clean-video-audio.js +97 -0
- package/dist/tools/clear-failed-tasks.js +66 -0
- package/dist/tools/cold-open.js +114 -0
- package/dist/tools/command-plan.js +1680 -0
- package/dist/tools/commands.js +1666 -0
- package/dist/tools/concat-images.js +236 -0
- package/dist/tools/connect-service.js +55 -0
- package/dist/tools/copy-file-to-clipboard.js +58 -0
- package/dist/tools/create-character.js +114 -0
- package/dist/tools/create-qart.js +253 -0
- package/dist/tools/create-qr-outro.js +149 -0
- package/dist/tools/create-qrbtf.js +215 -0
- package/dist/tools/create-watermark.js +97 -0
- package/dist/tools/crop-asset.js +18 -0
- package/dist/tools/crop-image.js +120 -0
- package/dist/tools/crop-video.js +97 -0
- package/dist/tools/delete-asset.js +104 -0
- package/dist/tools/describe-image.js +69 -0
- package/dist/tools/detect-scenes.js +44 -0
- package/dist/tools/doctor.js +126 -0
- package/dist/tools/download-video.js +114 -0
- package/dist/tools/duplicate-asset.js +184 -0
- package/dist/tools/edit-timeline.js +59 -0
- package/dist/tools/editing-moments.js +105 -0
- package/dist/tools/estimate-cost.js +171 -0
- package/dist/tools/even-split.js +295 -0
- package/dist/tools/export-asset-file.js +22 -0
- package/dist/tools/export-asset.js +140 -0
- package/dist/tools/export-sequence.js +250 -0
- package/dist/tools/export-to-downloads.js +54 -0
- package/dist/tools/export-transcript-srt.js +79 -0
- package/dist/tools/extend-audio.js +100 -0
- package/dist/tools/extract-audio.js +174 -0
- package/dist/tools/extract-frame.js +108 -0
- package/dist/tools/extract-notebook-audio.js +173 -0
- package/dist/tools/extract-notebook-frame.js +160 -0
- package/dist/tools/extract-video-clip.js +101 -0
- package/dist/tools/generate-media.js +157 -0
- package/dist/tools/generation-payload.js +48 -0
- package/dist/tools/get-timeline.js +12 -0
- package/dist/tools/get-watermark-config.js +38 -0
- package/dist/tools/goal.js +644 -0
- package/dist/tools/image-subjects.js +711 -0
- package/dist/tools/index.js +323 -0
- package/dist/tools/inject-first-frame.js +154 -0
- package/dist/tools/invert-image.js +70 -0
- package/dist/tools/isolate-vocals.js +66 -0
- package/dist/tools/list-assets.js +98 -0
- package/dist/tools/list-cell-generations.js +225 -0
- package/dist/tools/list-elevenlabs-voices.js +163 -0
- package/dist/tools/log-wrapper.js +29 -0
- package/dist/tools/make-cover-song.js +95 -0
- package/dist/tools/mark-asset-seen.js +23 -0
- package/dist/tools/media-library.js +245 -0
- package/dist/tools/move-timeline-audio.js +35 -0
- package/dist/tools/music-analysis.js +60 -0
- package/dist/tools/music-draft.js +29 -0
- package/dist/tools/pad-video.js +87 -0
- package/dist/tools/post-record.js +83 -0
- package/dist/tools/post.js +168 -0
- package/dist/tools/prompt-history.js +164 -0
- package/dist/tools/provider-key-status.js +248 -0
- package/dist/tools/qrbtf-render.js +849 -0
- package/dist/tools/read-asset-metadata.js +26 -0
- package/dist/tools/read-file-at-commit.js +29 -0
- package/dist/tools/read-transcript.js +41 -0
- package/dist/tools/reconcile-project-work.js +1452 -0
- package/dist/tools/recover-asset.js +28 -0
- package/dist/tools/remove-sound.js +72 -0
- package/dist/tools/remove-timeline-audio.js +34 -0
- package/dist/tools/remove-timeline-slot.js +40 -0
- package/dist/tools/rename-all.js +434 -0
- package/dist/tools/rename-asset.js +34 -0
- package/dist/tools/render-settings.js +47 -0
- package/dist/tools/render-timeline.js +120 -0
- package/dist/tools/render.js +384 -0
- package/dist/tools/reorder-character-images.js +45 -0
- package/dist/tools/replace-video-audio.js +133 -0
- package/dist/tools/restore-archive-clips.js +209 -0
- package/dist/tools/restore-asset-version.js +37 -0
- package/dist/tools/retry-generation.js +54 -0
- package/dist/tools/reverse-video.js +74 -0
- package/dist/tools/rewrite-prompt.js +388 -0
- package/dist/tools/rewrite-script.js +67 -0
- package/dist/tools/schema-from-apicity.js +66 -0
- package/dist/tools/search-archive.js +150 -0
- package/dist/tools/semantic-search.js +1214 -0
- package/dist/tools/sequence-rhythm.js +43 -0
- package/dist/tools/set-character-metadata.js +84 -0
- package/dist/tools/set-env-secret.js +40 -0
- package/dist/tools/set-osg.js +143 -0
- package/dist/tools/show-folder.js +37 -0
- package/dist/tools/smooth-scene-concat.js +122 -0
- package/dist/tools/splice-video.js +149 -0
- package/dist/tools/split-video.js +202 -0
- package/dist/tools/suggest-cuts.js +45 -0
- package/dist/tools/suggest-sfx.js +43 -0
- package/dist/tools/sync-video-to-audio.js +115 -0
- package/dist/tools/tag-backfill.js +177 -0
- package/dist/tools/timewarp-video.js +85 -0
- package/dist/tools/tool-def.js +1 -0
- package/dist/tools/tool-json-schema.js +116 -0
- package/dist/tools/transcribe.js +90 -0
- package/dist/tools/translate-subtitles.js +59 -0
- package/dist/tools/trim-audio.js +139 -0
- package/dist/tools/trim-video.js +168 -0
- package/dist/tools/update-script.js +25 -0
- package/dist/tools/update-timeline-audio.js +40 -0
- package/dist/tools/upload-file.js +41 -0
- package/dist/tools/verify-x-mentions.js +141 -0
- package/dist/tools/video-editing-command-contract.js +291 -0
- package/dist/tools/video-source-reference.js +30 -0
- package/dist/tools/video-time-input.js +18 -0
- package/dist/tools/videobook-domain.js +2021 -0
- package/dist/tools/wait-for-asset-ready.js +143 -0
- package/dist/tools/workspace-actions.js +54 -0
- package/dist/transcript-projection.js +202 -0
- package/dist/transcript-srt.js +33 -0
- package/dist/upload.js +76 -0
- package/dist/usage-providers.js +25 -0
- package/dist/video-analysis-projection.js +46 -0
- package/dist/video-poster.js +33 -0
- package/dist/video-proxy.js +99 -0
- package/dist/vision-regions.js +111 -0
- package/dist/voice-actions.js +90 -0
- package/dist/voice-audio.js +55 -0
- package/dist/voice-config.js +122 -0
- package/dist/voice-continuation.js +54 -0
- package/dist/voice-contract.js +1 -0
- package/dist/voice-http.js +145 -0
- package/dist/voice-reply-progress.js +55 -0
- package/dist/voice-session.js +992 -0
- package/dist/watermark-badge.js +259 -0
- package/dist/watermark-config.js +111 -0
- package/dist/watermark-handle-position.js +55 -0
- package/dist/watermark-platform.js +15 -0
- package/dist/watermark-timing.js +16 -0
- package/dist/workspace-action-catalog.js +315 -0
- package/dist/workspace-action-contract.js +21 -0
- package/dist/workspace-action-groups.js +98 -0
- package/dist/workspace-action-surfaces.js +7 -0
- package/dist/x/account.js +88 -0
- package/dist/x/authenticated-handle.js +30 -0
- package/dist/x/oauth-flow.js +191 -0
- package/dist/x/post-contract.js +1 -0
- package/dist/x/post-metadata.js +44 -0
- package/dist/x/post-to-x.js +456 -0
- package/dist/x/published-post-cell.js +90 -0
- package/dist/x/x-tokens.js +69 -0
- package/dist/ytdlp-binary.js +65 -0
- package/dist/zod-slots.js +334 -0
- package/package.json +84 -4
- package/ui/assets/alive-captions-BWb5nLKj.css +1 -0
- package/ui/assets/alive-captions-DPEr1nKM.js +1 -0
- package/ui/assets/confirm-bodies-D8ouHXKy.js +1 -0
- package/ui/assets/confirm-bodies-DrMhaXC6.css +1 -0
- package/ui/assets/fullscreen-B7nw4YbE.js +1 -0
- package/ui/assets/goal-ui-DK-xTCK0.js +2 -0
- package/ui/assets/goal-ui-DXdUM2KF.css +1 -0
- package/ui/assets/index-DzPAnCUj.css +1 -0
- package/ui/assets/index-kS1905s5.js +37 -0
- package/ui/assets/inspector-MlzQbTVo.js +1 -0
- package/ui/assets/jobs-ui-CoinOWx0.js +1 -0
- package/ui/assets/music-video-Cbe80kmQ.js +1 -0
- package/ui/assets/music-video-DPaiKKEq.css +1 -0
- package/ui/assets/ui-Oirr9VOf.css +1 -0
- package/ui/assets/ui-xo_Y1yQg.js +2 -0
- package/ui/assets/vendor-D2rfiZ5j.css +1 -0
- package/ui/assets/vendor-DfTCWgKm.js +19 -0
- package/ui/assets/vendor-flow-BXbeWxW7.js +7 -0
- package/ui/assets/vendor-flow-BnuhLJ6X.css +1 -0
- package/ui/assets/vendor-icons-CGqhCIXV.js +1 -0
- package/ui/assets/vendor-mcp-BTlEJcHV.js +67 -0
- package/ui/assets/vendor-react-Dj7D1fD4.js +9 -0
- package/ui/assets/vendor-remotion-CH1HXrlc.js +95 -0
- package/ui/assets/videobook-Qlp9HQFu.js +20 -0
- package/ui/favicon.svg +8 -0
- package/ui/index.html +126 -0
|
@@ -0,0 +1,849 @@
|
|
|
1
|
+
import QRCode from "qrcode";
|
|
2
|
+
const PATTERN_POSITION_TABLE = [
|
|
3
|
+
[],
|
|
4
|
+
[6, 18],
|
|
5
|
+
[6, 22],
|
|
6
|
+
[6, 26],
|
|
7
|
+
[6, 30],
|
|
8
|
+
[6, 34],
|
|
9
|
+
[6, 22, 38],
|
|
10
|
+
[6, 24, 42],
|
|
11
|
+
[6, 26, 46],
|
|
12
|
+
[6, 28, 50],
|
|
13
|
+
[6, 30, 54],
|
|
14
|
+
[6, 32, 58],
|
|
15
|
+
[6, 34, 62],
|
|
16
|
+
[6, 26, 46, 66],
|
|
17
|
+
[6, 26, 48, 70],
|
|
18
|
+
[6, 26, 50, 74],
|
|
19
|
+
[6, 30, 54, 78],
|
|
20
|
+
[6, 30, 56, 82],
|
|
21
|
+
[6, 30, 58, 86],
|
|
22
|
+
[6, 34, 62, 90],
|
|
23
|
+
[6, 28, 50, 72, 94],
|
|
24
|
+
[6, 26, 50, 74, 98],
|
|
25
|
+
[6, 30, 54, 78, 102],
|
|
26
|
+
[6, 28, 54, 80, 106],
|
|
27
|
+
[6, 32, 58, 84, 110],
|
|
28
|
+
[6, 30, 58, 86, 114],
|
|
29
|
+
[6, 34, 62, 90, 118],
|
|
30
|
+
[6, 26, 50, 74, 98, 122],
|
|
31
|
+
[6, 30, 54, 78, 102, 126],
|
|
32
|
+
[6, 26, 52, 78, 104, 130],
|
|
33
|
+
[6, 30, 56, 82, 108, 134],
|
|
34
|
+
[6, 34, 60, 86, 112, 138],
|
|
35
|
+
[6, 30, 58, 86, 114, 142],
|
|
36
|
+
[6, 34, 62, 90, 118, 146],
|
|
37
|
+
[6, 30, 54, 78, 102, 126, 150],
|
|
38
|
+
[6, 24, 50, 76, 102, 128, 154],
|
|
39
|
+
[6, 28, 54, 80, 106, 132, 158],
|
|
40
|
+
[6, 32, 58, 84, 110, 136, 162],
|
|
41
|
+
[6, 26, 54, 82, 110, 138, 166],
|
|
42
|
+
[6, 30, 58, 86, 114, 142, 170],
|
|
43
|
+
];
|
|
44
|
+
const QRPointType = {
|
|
45
|
+
DATA: 0,
|
|
46
|
+
POS_CENTER: 1,
|
|
47
|
+
POS_OTHER: 2,
|
|
48
|
+
ALIGN_CENTER: 3,
|
|
49
|
+
ALIGN_OTHER: 4,
|
|
50
|
+
TIMING: 5,
|
|
51
|
+
FORMAT: 6,
|
|
52
|
+
VERSION: 7,
|
|
53
|
+
};
|
|
54
|
+
const SQ25_PATH = "M32.048565,-1.29480038e-15 L67.951435,1.29480038e-15 C79.0954192,-7.52316311e-16 83.1364972,1.16032014 87.2105713,3.3391588 C91.2846454,5.51799746 94.4820025,8.71535463 96.6608412,12.7894287 C98.8396799,16.8635028 100,20.9045808 100,32.048565 L100,67.951435 C100,79.0954192 98.8396799,83.1364972 96.6608412,87.2105713 C94.4820025,91.2846454 91.2846454,94.4820025 87.2105713,96.6608412 C83.1364972,98.8396799 79.0954192,100 67.951435,100 L32.048565,100 C20.9045808,100 16.8635028,98.8396799 12.7894287,96.6608412 C8.71535463,94.4820025 5.51799746,91.2846454 3.3391588,87.2105713 C1.16032014,83.1364972 5.01544207e-16,79.0954192 -8.63200256e-16,67.951435 L8.63200256e-16,32.048565 C-5.01544207e-16,20.9045808 1.16032014,16.8635028 3.3391588,12.7894287 C5.51799746,8.71535463 8.71535463,5.51799746 12.7894287,3.3391588 C16.8635028,1.16032014 20.9045808,7.52316311e-16 32.048565,-1.29480038e-15 Z";
|
|
55
|
+
let randSeed = 142857;
|
|
56
|
+
function rand(min, max) {
|
|
57
|
+
randSeed = (randSeed * 9301 + 49297) % 233280;
|
|
58
|
+
return min + (randSeed / 233280.0) * (max - min);
|
|
59
|
+
}
|
|
60
|
+
function resetRand(seed = 142857) {
|
|
61
|
+
randSeed = seed;
|
|
62
|
+
}
|
|
63
|
+
function getAlignmentPositions(version, nCount) {
|
|
64
|
+
const pos = PATTERN_POSITION_TABLE[version - 1];
|
|
65
|
+
const positions = [];
|
|
66
|
+
for (const row of pos) {
|
|
67
|
+
for (const col of pos) {
|
|
68
|
+
if (row <= 8 && col <= 8)
|
|
69
|
+
continue;
|
|
70
|
+
if (row <= 8 && col >= nCount - 8)
|
|
71
|
+
continue;
|
|
72
|
+
if (row >= nCount - 8 && col <= 8)
|
|
73
|
+
continue;
|
|
74
|
+
positions.push([row, col]);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return positions;
|
|
78
|
+
}
|
|
79
|
+
function createQrMatrix(value, level) {
|
|
80
|
+
const qr = QRCode.create(value, { errorCorrectionLevel: level });
|
|
81
|
+
const nCount = qr.modules.size;
|
|
82
|
+
const alignmentPositions = getAlignmentPositions(qr.version, nCount);
|
|
83
|
+
return {
|
|
84
|
+
version: qr.version,
|
|
85
|
+
matrix: {
|
|
86
|
+
isDark: (x, y) => qr.modules.get(y, x) === 1,
|
|
87
|
+
getModuleCount: () => nCount,
|
|
88
|
+
getPositionTable: () => alignmentPositions,
|
|
89
|
+
},
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
function getTypeTable(qr) {
|
|
93
|
+
const nCount = qr.getModuleCount();
|
|
94
|
+
const position = qr.getPositionTable();
|
|
95
|
+
const PD = [
|
|
96
|
+
[3, 3],
|
|
97
|
+
[3, nCount - 4],
|
|
98
|
+
[nCount - 4, 3],
|
|
99
|
+
];
|
|
100
|
+
const typeTable = new Array(nCount);
|
|
101
|
+
for (let i = 0; i < nCount; i++)
|
|
102
|
+
typeTable[i] = new Array(nCount);
|
|
103
|
+
for (let i = 8; i < nCount - 7; i++) {
|
|
104
|
+
typeTable[i][6] = QRPointType.TIMING;
|
|
105
|
+
typeTable[6][i] = QRPointType.TIMING;
|
|
106
|
+
}
|
|
107
|
+
for (const [row, col] of position) {
|
|
108
|
+
typeTable[row][col] = QRPointType.ALIGN_CENTER;
|
|
109
|
+
for (let r = -2; r <= 2; r++) {
|
|
110
|
+
for (let c = -2; c <= 2; c++) {
|
|
111
|
+
if (!(r === 0 && c === 0))
|
|
112
|
+
typeTable[row + r][col + c] = QRPointType.ALIGN_OTHER;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
for (const [row, col] of PD) {
|
|
117
|
+
typeTable[row][col] = QRPointType.POS_CENTER;
|
|
118
|
+
for (let r = -4; r <= 4; r++) {
|
|
119
|
+
for (let c = -4; c <= 4; c++) {
|
|
120
|
+
if (row + r >= 0 && row + r < nCount && col + c >= 0 && col + c < nCount) {
|
|
121
|
+
if (!(r === 0 && c === 0))
|
|
122
|
+
typeTable[row + r][col + c] = QRPointType.POS_OTHER;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
for (let i = 0; i <= 8; i++) {
|
|
128
|
+
if (i !== 6) {
|
|
129
|
+
typeTable[i][8] = QRPointType.FORMAT;
|
|
130
|
+
typeTable[8][i] = QRPointType.FORMAT;
|
|
131
|
+
}
|
|
132
|
+
if (i < 7)
|
|
133
|
+
typeTable[nCount - i - 1][8] = QRPointType.FORMAT;
|
|
134
|
+
if (i < 8)
|
|
135
|
+
typeTable[8][nCount - i - 1] = QRPointType.FORMAT;
|
|
136
|
+
}
|
|
137
|
+
for (let i = nCount - 11; i <= nCount - 9; i++) {
|
|
138
|
+
for (let j = 0; j <= 5; j++) {
|
|
139
|
+
typeTable[i][j] = QRPointType.VERSION;
|
|
140
|
+
typeTable[j][i] = QRPointType.VERSION;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
for (let i = 0; i < nCount; i++) {
|
|
144
|
+
for (let j = 0; j < nCount; j++) {
|
|
145
|
+
if (typeTable[i][j] === undefined)
|
|
146
|
+
typeTable[i][j] = QRPointType.DATA;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
return typeTable;
|
|
150
|
+
}
|
|
151
|
+
function defaultViewBox(nCount) {
|
|
152
|
+
const margin = nCount / 5;
|
|
153
|
+
return `${-margin} ${-margin} ${nCount + margin * 2} ${nCount + margin * 2}`;
|
|
154
|
+
}
|
|
155
|
+
function esc(s) {
|
|
156
|
+
return s.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """);
|
|
157
|
+
}
|
|
158
|
+
function svgRect(x, y, w, h, fill, opacity, stroke, sw) {
|
|
159
|
+
let a = `x="${x}" y="${y}" width="${w}" height="${h}" fill="${esc(fill)}"`;
|
|
160
|
+
if (opacity != null && opacity !== 1)
|
|
161
|
+
a += ` opacity="${opacity}"`;
|
|
162
|
+
if (stroke)
|
|
163
|
+
a += ` stroke="${esc(stroke)}"`;
|
|
164
|
+
if (sw != null)
|
|
165
|
+
a += ` stroke-width="${sw}"`;
|
|
166
|
+
return `<rect ${a}/>`;
|
|
167
|
+
}
|
|
168
|
+
function svgCircle(cx, cy, r, fill, opacity, stroke, sw, dash) {
|
|
169
|
+
let a = `cx="${cx}" cy="${cy}" r="${r}"`;
|
|
170
|
+
a += fill === "none" ? ` fill="none"` : ` fill="${esc(fill)}"`;
|
|
171
|
+
if (opacity != null && opacity !== 1)
|
|
172
|
+
a += ` opacity="${opacity}"`;
|
|
173
|
+
if (stroke)
|
|
174
|
+
a += ` stroke="${esc(stroke)}"`;
|
|
175
|
+
if (sw != null)
|
|
176
|
+
a += ` stroke-width="${sw}"`;
|
|
177
|
+
if (dash)
|
|
178
|
+
a += ` stroke-dasharray="${dash}"`;
|
|
179
|
+
return `<circle ${a}/>`;
|
|
180
|
+
}
|
|
181
|
+
function svgLine(x1, y1, x2, y2, stroke, sw, opacity, cap) {
|
|
182
|
+
let a = `x1="${x1}" y1="${y1}" x2="${x2}" y2="${y2}" stroke="${esc(stroke)}" stroke-width="${sw}"`;
|
|
183
|
+
if (opacity != null && opacity !== 1)
|
|
184
|
+
a += ` opacity="${opacity}"`;
|
|
185
|
+
if (cap)
|
|
186
|
+
a += ` stroke-linecap="${cap}"`;
|
|
187
|
+
return `<line ${a}/>`;
|
|
188
|
+
}
|
|
189
|
+
function svgPath(d, stroke, sw, fill, transform) {
|
|
190
|
+
let a = `d="${d}" stroke="${esc(stroke)}" stroke-width="${sw}" fill="${esc(fill)}"`;
|
|
191
|
+
if (transform)
|
|
192
|
+
a += ` transform="${transform}"`;
|
|
193
|
+
return `<path ${a}/>`;
|
|
194
|
+
}
|
|
195
|
+
const VW = [3, -3];
|
|
196
|
+
const VH = [3, -3];
|
|
197
|
+
function renderPosCenter(x, y, posType, posColor, size) {
|
|
198
|
+
if (posType === "rect") {
|
|
199
|
+
return svgRect(x, y, 1, 1, posColor);
|
|
200
|
+
}
|
|
201
|
+
if (posType === "round") {
|
|
202
|
+
return svgCircle(x + 0.5, y + 0.5, 1.5, posColor) + svgCircle(x + 0.5, y + 0.5, 3, "none", undefined, posColor, 1);
|
|
203
|
+
}
|
|
204
|
+
if (posType === "planet") {
|
|
205
|
+
let s = svgCircle(x + 0.5, y + 0.5, 1.5, posColor);
|
|
206
|
+
s += svgCircle(x + 0.5, y + 0.5, 3, "none", undefined, posColor, 0.15, "0.5,0.5");
|
|
207
|
+
for (const w of VW)
|
|
208
|
+
s += svgCircle(x + w + 0.5, y + 0.5, 0.5, posColor);
|
|
209
|
+
for (const h of VH)
|
|
210
|
+
s += svgCircle(x + 0.5, y + h + 0.5, 0.5, posColor);
|
|
211
|
+
return s;
|
|
212
|
+
}
|
|
213
|
+
if (posType === "roundRect") {
|
|
214
|
+
let s = svgCircle(x + 0.5, y + 0.5, 1.5, posColor);
|
|
215
|
+
const sw = (100 / 6) * (1 - (1 - size) * 0.75);
|
|
216
|
+
const tr = `translate(${x - 2.5},${y - 2.5}) scale(${6 / 100},${6 / 100})`;
|
|
217
|
+
s += svgPath(SQ25_PATH, posColor, sw, "none", tr);
|
|
218
|
+
return s;
|
|
219
|
+
}
|
|
220
|
+
return "";
|
|
221
|
+
}
|
|
222
|
+
function renderPosOther(x, y, posType, posColor) {
|
|
223
|
+
if (posType === "rect")
|
|
224
|
+
return svgRect(x, y, 1, 1, posColor);
|
|
225
|
+
return "";
|
|
226
|
+
}
|
|
227
|
+
function renderNormal(qr, tt, p) {
|
|
228
|
+
const nCount = qr.getModuleCount();
|
|
229
|
+
const type = p.pointType;
|
|
230
|
+
const size = p.pointSize / 100;
|
|
231
|
+
const opacity = p.pointOpacity / 100;
|
|
232
|
+
let svg = "";
|
|
233
|
+
for (let x = 0; x < nCount; x++) {
|
|
234
|
+
for (let y = 0; y < nCount; y++) {
|
|
235
|
+
if (!qr.isDark(x, y))
|
|
236
|
+
continue;
|
|
237
|
+
const t = tt[x][y];
|
|
238
|
+
if (t === QRPointType.ALIGN_CENTER || t === QRPointType.ALIGN_OTHER || t === QRPointType.TIMING) {
|
|
239
|
+
if (type === "rect") {
|
|
240
|
+
svg += svgRect(x + (1 - size) / 2, y + (1 - size) / 2, size, size, p.otherColor, opacity);
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
svg += svgCircle(x + 0.5, y + 0.5, size / 2, p.otherColor, opacity);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
else if (t === QRPointType.POS_CENTER) {
|
|
247
|
+
svg += renderPosCenter(x, y, p.posType, p.posColor, size);
|
|
248
|
+
}
|
|
249
|
+
else if (t === QRPointType.POS_OTHER) {
|
|
250
|
+
svg += renderPosOther(x, y, p.posType, p.posColor);
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
if (type === "rect") {
|
|
254
|
+
svg += svgRect(x + (1 - size) / 2, y + (1 - size) / 2, size, size, p.otherColor, opacity);
|
|
255
|
+
}
|
|
256
|
+
else if (type === "round") {
|
|
257
|
+
svg += svgCircle(x + 0.5, y + 0.5, size / 2, p.otherColor, opacity);
|
|
258
|
+
}
|
|
259
|
+
else {
|
|
260
|
+
svg += svgCircle(x + 0.5, y + 0.5, 0.5 * rand(0.33, 1.0), p.otherColor, opacity);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return svg;
|
|
266
|
+
}
|
|
267
|
+
function renderLine(qr, tt, p) {
|
|
268
|
+
const nCount = qr.getModuleCount();
|
|
269
|
+
const type = p.direction;
|
|
270
|
+
let size = p.lineWidth / 100;
|
|
271
|
+
const opacity = p.lineOpacity / 100;
|
|
272
|
+
const otherColor = p.lineColor;
|
|
273
|
+
if (size <= 0)
|
|
274
|
+
size = 1.0;
|
|
275
|
+
const available = [];
|
|
276
|
+
const ava2 = [];
|
|
277
|
+
for (let x = 0; x < nCount; x++) {
|
|
278
|
+
available[x] = [];
|
|
279
|
+
ava2[x] = [];
|
|
280
|
+
for (let y = 0; y < nCount; y++) {
|
|
281
|
+
available[x][y] = true;
|
|
282
|
+
ava2[x][y] = true;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
let svg = "";
|
|
286
|
+
for (let x = 0; x < nCount; x++) {
|
|
287
|
+
for (let y = 0; y < nCount; y++) {
|
|
288
|
+
if (!qr.isDark(x, y))
|
|
289
|
+
continue;
|
|
290
|
+
const t = tt[x][y];
|
|
291
|
+
if (t === QRPointType.POS_CENTER) {
|
|
292
|
+
svg += renderPosCenter(x, y, p.posType, p.posColor, size);
|
|
293
|
+
}
|
|
294
|
+
else if (t === QRPointType.POS_OTHER) {
|
|
295
|
+
svg += renderPosOther(x, y, p.posType, p.posColor);
|
|
296
|
+
}
|
|
297
|
+
else {
|
|
298
|
+
if (type === "left-right") {
|
|
299
|
+
if (x === 0 || (x > 0 && (!qr.isDark(x - 1, y) || !ava2[x - 1][y]))) {
|
|
300
|
+
let end = 0;
|
|
301
|
+
let ctn = true;
|
|
302
|
+
while (ctn && x + end < nCount) {
|
|
303
|
+
if (qr.isDark(x + end, y) && ava2[x + end][y])
|
|
304
|
+
end++;
|
|
305
|
+
else
|
|
306
|
+
ctn = false;
|
|
307
|
+
}
|
|
308
|
+
if (end > 1) {
|
|
309
|
+
for (let i = 0; i < end; i++) {
|
|
310
|
+
ava2[x + i][y] = false;
|
|
311
|
+
available[x + i][y] = false;
|
|
312
|
+
}
|
|
313
|
+
svg += svgLine(x + 0.5, y + 0.5, x + end - 0.5, y + 0.5, otherColor, size, opacity, "round");
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
if (available[x][y])
|
|
317
|
+
svg += svgCircle(x + 0.5, y + 0.5, size / 2, otherColor, opacity);
|
|
318
|
+
}
|
|
319
|
+
if (type === "up-down") {
|
|
320
|
+
if (y === 0 || (y > 0 && (!qr.isDark(x, y - 1) || !ava2[x][y - 1]))) {
|
|
321
|
+
let end = 0;
|
|
322
|
+
let ctn = true;
|
|
323
|
+
while (ctn && y + end < nCount) {
|
|
324
|
+
if (qr.isDark(x, y + end) && ava2[x][y + end])
|
|
325
|
+
end++;
|
|
326
|
+
else
|
|
327
|
+
ctn = false;
|
|
328
|
+
}
|
|
329
|
+
if (end > 1) {
|
|
330
|
+
for (let i = 0; i < end; i++) {
|
|
331
|
+
ava2[x][y + i] = false;
|
|
332
|
+
available[x][y + i] = false;
|
|
333
|
+
}
|
|
334
|
+
svg += svgLine(x + 0.5, y + 0.5, x + 0.5, y + end - 1 + 0.5, otherColor, size, opacity, "round");
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
if (available[x][y])
|
|
338
|
+
svg += svgCircle(x + 0.5, y + 0.5, size / 2, otherColor, opacity);
|
|
339
|
+
}
|
|
340
|
+
if (type === "h-v") {
|
|
341
|
+
if (y === 0 || (y > 0 && (!qr.isDark(x, y - 1) || !ava2[x][y - 1]))) {
|
|
342
|
+
let end = 0;
|
|
343
|
+
let ctn = true;
|
|
344
|
+
while (ctn && y + end < nCount) {
|
|
345
|
+
if (qr.isDark(x, y + end) && ava2[x][y + end] && end <= 3)
|
|
346
|
+
end++;
|
|
347
|
+
else
|
|
348
|
+
ctn = false;
|
|
349
|
+
}
|
|
350
|
+
if (end > 1) {
|
|
351
|
+
for (let i = 0; i < end; i++) {
|
|
352
|
+
ava2[x][y + i] = false;
|
|
353
|
+
available[x][y + i] = false;
|
|
354
|
+
}
|
|
355
|
+
svg += svgLine(x + 0.5, y + 0.5, x + 0.5, y + end - 1 + 0.5, otherColor, size, opacity, "round");
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (x === 0 || (x > 0 && (!qr.isDark(x - 1, y) || !ava2[x - 1][y]))) {
|
|
359
|
+
let end = 0;
|
|
360
|
+
let ctn = true;
|
|
361
|
+
while (ctn && x + end < nCount) {
|
|
362
|
+
if (qr.isDark(x + end, y) && ava2[x + end][y] && end <= 3)
|
|
363
|
+
end++;
|
|
364
|
+
else
|
|
365
|
+
ctn = false;
|
|
366
|
+
}
|
|
367
|
+
if (end > 1) {
|
|
368
|
+
for (let i = 0; i < end; i++) {
|
|
369
|
+
ava2[x + i][y] = false;
|
|
370
|
+
available[x + i][y] = false;
|
|
371
|
+
}
|
|
372
|
+
svg += svgLine(x + 0.5, y + 0.5, x + end - 0.5, y + 0.5, otherColor, size, opacity, "round");
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
if (available[x][y])
|
|
376
|
+
svg += svgCircle(x + 0.5, y + 0.5, size / 2, otherColor, opacity);
|
|
377
|
+
}
|
|
378
|
+
if (type === "loop") {
|
|
379
|
+
if ((Number(x > y) ^ Number(x + y < nCount))) {
|
|
380
|
+
if (y === 0 || (y > 0 && (!qr.isDark(x, y - 1) || !ava2[x][y - 1]))) {
|
|
381
|
+
let end = 0;
|
|
382
|
+
let ctn = true;
|
|
383
|
+
while (ctn && y + end < nCount) {
|
|
384
|
+
if (qr.isDark(x, y + end) && ava2[x][y + end] && end <= 3)
|
|
385
|
+
end++;
|
|
386
|
+
else
|
|
387
|
+
ctn = false;
|
|
388
|
+
}
|
|
389
|
+
if (end > 1) {
|
|
390
|
+
for (let i = 0; i < end; i++) {
|
|
391
|
+
ava2[x][y + i] = false;
|
|
392
|
+
available[x][y + i] = false;
|
|
393
|
+
}
|
|
394
|
+
svg += svgLine(x + 0.5, y + 0.5, x + 0.5, y + end - 1 + 0.5, otherColor, size, opacity, "round");
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
else {
|
|
399
|
+
if (x === 0 || (x > 0 && (!qr.isDark(x - 1, y) || !ava2[x - 1][y]))) {
|
|
400
|
+
let end = 0;
|
|
401
|
+
let ctn = true;
|
|
402
|
+
while (ctn && x + end < nCount) {
|
|
403
|
+
if (qr.isDark(x + end, y) && ava2[x + end][y] && end <= 3)
|
|
404
|
+
end++;
|
|
405
|
+
else
|
|
406
|
+
ctn = false;
|
|
407
|
+
}
|
|
408
|
+
if (end > 1) {
|
|
409
|
+
for (let i = 0; i < end; i++) {
|
|
410
|
+
ava2[x + i][y] = false;
|
|
411
|
+
available[x + i][y] = false;
|
|
412
|
+
}
|
|
413
|
+
svg += svgLine(x + 0.5, y + 0.5, x + end - 0.5, y + 0.5, otherColor, size, opacity, "round");
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
if (available[x][y])
|
|
418
|
+
svg += svgCircle(x + 0.5, y + 0.5, size / 2, otherColor, opacity);
|
|
419
|
+
}
|
|
420
|
+
if (type === "topLeft-bottomRight") {
|
|
421
|
+
if (y === 0 || x === 0 || ((y > 0 && x > 0) && (!qr.isDark(x - 1, y - 1) || !ava2[x - 1][y - 1]))) {
|
|
422
|
+
let end = 0;
|
|
423
|
+
let ctn = true;
|
|
424
|
+
while (ctn && y + end < nCount && x + end < nCount) {
|
|
425
|
+
if (qr.isDark(x + end, y + end) && ava2[x + end][y + end])
|
|
426
|
+
end++;
|
|
427
|
+
else
|
|
428
|
+
ctn = false;
|
|
429
|
+
}
|
|
430
|
+
if (end > 1) {
|
|
431
|
+
for (let i = 0; i < end; i++) {
|
|
432
|
+
ava2[x + i][y + i] = false;
|
|
433
|
+
available[x + i][y + i] = false;
|
|
434
|
+
}
|
|
435
|
+
svg += svgLine(x + 0.5, y + 0.5, x + end - 1 + 0.5, y + end - 1 + 0.5, otherColor, size, opacity, "round");
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
if (available[x][y])
|
|
439
|
+
svg += svgCircle(x + 0.5, y + 0.5, size / 2, otherColor, opacity);
|
|
440
|
+
}
|
|
441
|
+
if (type === "topRight-bottomLeft") {
|
|
442
|
+
if (x === 0 || y === nCount - 1 || ((x > 0 && y < nCount - 1) && (!qr.isDark(x - 1, y + 1) || !ava2[x - 1][y + 1]))) {
|
|
443
|
+
let end = 0;
|
|
444
|
+
let ctn = true;
|
|
445
|
+
while (ctn && x + end < nCount && y - end >= 0) {
|
|
446
|
+
if (qr.isDark(x + end, y - end) && available[x + end][y - end])
|
|
447
|
+
end++;
|
|
448
|
+
else
|
|
449
|
+
ctn = false;
|
|
450
|
+
}
|
|
451
|
+
if (end > 1) {
|
|
452
|
+
for (let i = 0; i < end; i++) {
|
|
453
|
+
ava2[x + i][y - i] = false;
|
|
454
|
+
available[x + i][y - i] = false;
|
|
455
|
+
}
|
|
456
|
+
svg += svgLine(x + 0.5, y + 0.5, x + (end - 1) + 0.5, y - (end - 1) + 0.5, otherColor, size, opacity, "round");
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
if (available[x][y])
|
|
460
|
+
svg += svgCircle(x + 0.5, y + 0.5, size / 2, otherColor, opacity);
|
|
461
|
+
}
|
|
462
|
+
if (type === "cross") {
|
|
463
|
+
if (x === 0 || y === nCount - 1 || ((x > 0 && y < nCount - 1) && (!qr.isDark(x - 1, y + 1) || !ava2[x - 1][y + 1]))) {
|
|
464
|
+
let end = 0;
|
|
465
|
+
let ctn = true;
|
|
466
|
+
while (ctn && x + end < nCount && y - end >= 0) {
|
|
467
|
+
if (qr.isDark(x + end, y - end) && ava2[x + end][y - end])
|
|
468
|
+
end++;
|
|
469
|
+
else
|
|
470
|
+
ctn = false;
|
|
471
|
+
}
|
|
472
|
+
if (end > 1) {
|
|
473
|
+
for (let i = 0; i < end; i++)
|
|
474
|
+
ava2[x + i][y - i] = false;
|
|
475
|
+
svg += svgLine(x + 0.5, y + 0.5, x + (end - 1) + 0.5, y - (end - 1) + 0.5, otherColor, (size / 2) * rand(0.3, 1), opacity, "round");
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (y === 0 || x === 0 || ((y > 0 && x > 0) && (!qr.isDark(x - 1, y - 1) || !available[x - 1][y - 1]))) {
|
|
479
|
+
let end = 0;
|
|
480
|
+
let ctn = true;
|
|
481
|
+
while (ctn && y + end < nCount && x + end < nCount) {
|
|
482
|
+
if (qr.isDark(x + end, y + end) && available[x + end][y + end])
|
|
483
|
+
end++;
|
|
484
|
+
else
|
|
485
|
+
ctn = false;
|
|
486
|
+
}
|
|
487
|
+
if (end > 1) {
|
|
488
|
+
for (let i = 0; i < end; i++)
|
|
489
|
+
available[x + i][y + i] = false;
|
|
490
|
+
svg += svgLine(x + 0.5, y + 0.5, x + end - 1 + 0.5, y + end - 1 + 0.5, otherColor, (size / 2) * rand(0.3, 1), opacity, "round");
|
|
491
|
+
}
|
|
492
|
+
}
|
|
493
|
+
svg += svgCircle(x + 0.5, y + 0.5, 0.5 * rand(0.33, 0.9), otherColor, opacity);
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
return svg;
|
|
499
|
+
}
|
|
500
|
+
function renderDsj(qr, tt, p) {
|
|
501
|
+
const nCount = qr.getModuleCount();
|
|
502
|
+
const scale = p.scale / 100;
|
|
503
|
+
const crossWidth = p.crossWidth / 100;
|
|
504
|
+
const posWidth = p.posWidth / 100;
|
|
505
|
+
const posType = p.posType;
|
|
506
|
+
const available = [];
|
|
507
|
+
const available2 = [];
|
|
508
|
+
for (let x = 0; x < nCount; x++) {
|
|
509
|
+
available[x] = [];
|
|
510
|
+
available2[x] = [];
|
|
511
|
+
for (let y = 0; y < nCount; y++) {
|
|
512
|
+
available[x][y] = true;
|
|
513
|
+
available2[x][y] = true;
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
const pointList = [];
|
|
517
|
+
const g1 = [];
|
|
518
|
+
const g2 = [];
|
|
519
|
+
const BLUE = "#5B8DEF";
|
|
520
|
+
const RED = "#FF5252";
|
|
521
|
+
const YELLOW = "#FFD93D";
|
|
522
|
+
const inv = 1 - posWidth;
|
|
523
|
+
for (let y = 0; y < nCount; y++) {
|
|
524
|
+
for (let x = 0; x < nCount; x++) {
|
|
525
|
+
if (!qr.isDark(x, y))
|
|
526
|
+
continue;
|
|
527
|
+
const t = tt[x][y];
|
|
528
|
+
if (t === QRPointType.POS_CENTER) {
|
|
529
|
+
if (posType === "rect") {
|
|
530
|
+
pointList.push(svgRect(x, y, 1, 1, BLUE));
|
|
531
|
+
}
|
|
532
|
+
else {
|
|
533
|
+
pointList.push(svgRect(x - 1 + inv / 2, y - 1 + inv / 2, 3 - inv, 3 - inv, BLUE));
|
|
534
|
+
pointList.push(svgRect(x - 3 + inv / 2, y - 1 + inv / 2, posWidth, 3 - inv, BLUE));
|
|
535
|
+
pointList.push(svgRect(x + 3 + inv / 2, y - 1 + inv / 2, posWidth, 3 - inv, BLUE));
|
|
536
|
+
pointList.push(svgRect(x - 1 + inv / 2, y - 3 + inv / 2, 3 - inv, posWidth, BLUE));
|
|
537
|
+
pointList.push(svgRect(x - 1 + inv / 2, y + 3 + inv / 2, 3 - inv, posWidth, BLUE));
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
else if (t === QRPointType.POS_OTHER) {
|
|
541
|
+
if (posType === "rect")
|
|
542
|
+
pointList.push(svgRect(x, y, 1, 1, BLUE));
|
|
543
|
+
}
|
|
544
|
+
else {
|
|
545
|
+
if (available[x][y] && available2[x][y] && x < nCount - 2 && y < nCount - 2) {
|
|
546
|
+
let ctn = true;
|
|
547
|
+
for (let i = 0; i < 3; i++)
|
|
548
|
+
for (let j = 0; j < 3; j++)
|
|
549
|
+
if (!available2[x + i][y + j])
|
|
550
|
+
ctn = false;
|
|
551
|
+
if (ctn && qr.isDark(x + 2, y) && qr.isDark(x + 1, y + 1) && qr.isDark(x, y + 2) && qr.isDark(x + 2, y + 2)) {
|
|
552
|
+
const o = crossWidth / Math.sqrt(8);
|
|
553
|
+
g1.push(svgLine(x + o, y + o, x + 3 - o, y + 3 - o, BLUE, crossWidth));
|
|
554
|
+
g1.push(svgLine(x + 3 - o, y + o, x + o, y + 3 - o, BLUE, crossWidth));
|
|
555
|
+
available[x][y] = false;
|
|
556
|
+
available[x + 2][y] = false;
|
|
557
|
+
available[x][y + 2] = false;
|
|
558
|
+
available[x + 2][y + 2] = false;
|
|
559
|
+
available[x + 1][y + 1] = false;
|
|
560
|
+
for (let i = 0; i < 3; i++)
|
|
561
|
+
for (let j = 0; j < 3; j++)
|
|
562
|
+
available2[x + i][y + j] = false;
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
if (available[x][y] && available2[x][y] && x < nCount - 1 && y < nCount - 1) {
|
|
566
|
+
let ctn = true;
|
|
567
|
+
for (let i = 0; i < 2; i++)
|
|
568
|
+
for (let j = 0; j < 2; j++)
|
|
569
|
+
if (!available2[x + i][y + j])
|
|
570
|
+
ctn = false;
|
|
571
|
+
if (ctn && qr.isDark(x + 1, y) && qr.isDark(x, y + 1) && qr.isDark(x + 1, y + 1)) {
|
|
572
|
+
const o = crossWidth / Math.sqrt(8);
|
|
573
|
+
g1.push(svgLine(x + o, y + o, x + 2 - o, y + 2 - o, BLUE, crossWidth));
|
|
574
|
+
g1.push(svgLine(x + 2 - o, y + o, x + o, y + 2 - o, BLUE, crossWidth));
|
|
575
|
+
for (let i = 0; i < 2; i++)
|
|
576
|
+
for (let j = 0; j < 2; j++) {
|
|
577
|
+
available[x + i][y + j] = false;
|
|
578
|
+
available2[x + i][y + j] = false;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
}
|
|
582
|
+
if (available[x][y] && available2[x][y]) {
|
|
583
|
+
if (y === 0 || (y > 0 && (!qr.isDark(x, y - 1) || !available2[x][y - 1]))) {
|
|
584
|
+
const start = y;
|
|
585
|
+
let end = y;
|
|
586
|
+
let ctn = true;
|
|
587
|
+
while (ctn && end < nCount) {
|
|
588
|
+
if (qr.isDark(x, end) && available2[x][end])
|
|
589
|
+
end++;
|
|
590
|
+
else
|
|
591
|
+
ctn = false;
|
|
592
|
+
}
|
|
593
|
+
if (end - start > 2) {
|
|
594
|
+
for (let i = start; i < end; i++) {
|
|
595
|
+
available2[x][i] = false;
|
|
596
|
+
available[x][i] = false;
|
|
597
|
+
}
|
|
598
|
+
g2.push(svgRect(x + (1 - scale) / 2, y + (1 - scale) / 2, scale, end - start - 1 - (1 - scale), RED));
|
|
599
|
+
g2.push(svgRect(x + (1 - scale) / 2, end - 1 + (1 - scale) / 2, scale, scale, RED));
|
|
600
|
+
}
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
if (available[x][y] && available2[x][y]) {
|
|
604
|
+
if (x === 0 || (x > 0 && (!qr.isDark(x - 1, y) || !available2[x - 1][y]))) {
|
|
605
|
+
const start = x;
|
|
606
|
+
let end = x;
|
|
607
|
+
let ctn = true;
|
|
608
|
+
while (ctn && end < nCount) {
|
|
609
|
+
if (qr.isDark(end, y) && available2[end][y])
|
|
610
|
+
end++;
|
|
611
|
+
else
|
|
612
|
+
ctn = false;
|
|
613
|
+
}
|
|
614
|
+
if (end - start > 1) {
|
|
615
|
+
for (let i = start; i < end; i++) {
|
|
616
|
+
available2[i][y] = false;
|
|
617
|
+
available[i][y] = false;
|
|
618
|
+
}
|
|
619
|
+
g2.push(svgRect(x + (1 - scale) / 2, y + (1 - scale) / 2, end - start - (1 - scale), scale, YELLOW));
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
if (available[x][y]) {
|
|
624
|
+
pointList.push(svgRect(x + (1 - scale) / 2, y + (1 - scale) / 2, scale, scale, YELLOW));
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
for (const s of g1)
|
|
630
|
+
pointList.push(s);
|
|
631
|
+
for (const s of g2)
|
|
632
|
+
pointList.push(s);
|
|
633
|
+
return pointList.join("");
|
|
634
|
+
}
|
|
635
|
+
function renderBubble(qr, tt, p) {
|
|
636
|
+
const nCount = qr.getModuleCount();
|
|
637
|
+
const pointList = [];
|
|
638
|
+
const g1 = [];
|
|
639
|
+
const g2 = [];
|
|
640
|
+
const available = [];
|
|
641
|
+
const ava2 = [];
|
|
642
|
+
for (let x = 0; x < nCount; x++) {
|
|
643
|
+
available[x] = [];
|
|
644
|
+
ava2[x] = [];
|
|
645
|
+
for (let y = 0; y < nCount; y++) {
|
|
646
|
+
available[x][y] = true;
|
|
647
|
+
ava2[x][y] = true;
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
for (let y = 0; y < nCount; y++) {
|
|
651
|
+
for (let x = 0; x < nCount; x++) {
|
|
652
|
+
if (qr.isDark(x, y) && tt[x][y] === QRPointType.POS_CENTER) {
|
|
653
|
+
pointList.push(svgCircle(x + 0.5, y + 0.5, 1.5, p.posColor));
|
|
654
|
+
pointList.push(svgCircle(x + 0.5, y + 0.5, 3, "none", undefined, p.posColor, 1));
|
|
655
|
+
}
|
|
656
|
+
else if (qr.isDark(x, y) && tt[x][y] === QRPointType.POS_OTHER) {
|
|
657
|
+
// skip
|
|
658
|
+
}
|
|
659
|
+
else {
|
|
660
|
+
if (available[x][y] && ava2[x][y] && x < nCount - 2 && y < nCount - 2) {
|
|
661
|
+
let ctn = true;
|
|
662
|
+
for (let i = 0; i < 3; i++)
|
|
663
|
+
for (let j = 0; j < 3; j++)
|
|
664
|
+
if (!ava2[x + i][y + j])
|
|
665
|
+
ctn = false;
|
|
666
|
+
if (ctn && qr.isDark(x + 1, y) && qr.isDark(x + 1, y + 2) && qr.isDark(x, y + 1) && qr.isDark(x + 2, y + 1)) {
|
|
667
|
+
g1.push(svgCircle(x + 1.5, y + 1.5, 1, p.bgColor, undefined, p.circleColor, rand(0.33, 0.6)));
|
|
668
|
+
if (qr.isDark(x + 1, y + 1)) {
|
|
669
|
+
g1.push(svgCircle(x + 1.5, y + 1.5, 0.5 * rand(0.5, 1), p.circleColor));
|
|
670
|
+
}
|
|
671
|
+
available[x + 1][y] = false;
|
|
672
|
+
available[x][y + 1] = false;
|
|
673
|
+
available[x + 2][y + 1] = false;
|
|
674
|
+
available[x + 1][y + 2] = false;
|
|
675
|
+
for (let i = 0; i < 3; i++)
|
|
676
|
+
for (let j = 0; j < 3; j++)
|
|
677
|
+
ava2[x + i][y + j] = false;
|
|
678
|
+
}
|
|
679
|
+
}
|
|
680
|
+
if (x < nCount - 1 && y < nCount - 1) {
|
|
681
|
+
if (qr.isDark(x, y) && qr.isDark(x + 1, y) && qr.isDark(x, y + 1) && qr.isDark(x + 1, y + 1)) {
|
|
682
|
+
g1.push(svgCircle(x + 1, y + 1, Math.sqrt(1 / 2), p.bgColor, undefined, p.circleColor, rand(0.33, 0.6)));
|
|
683
|
+
for (let i = 0; i < 2; i++)
|
|
684
|
+
for (let j = 0; j < 2; j++) {
|
|
685
|
+
available[x + i][y + j] = false;
|
|
686
|
+
ava2[x + i][y + j] = false;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
if (available[x][y] && y < nCount - 1) {
|
|
691
|
+
if (qr.isDark(x, y) && qr.isDark(x, y + 1)) {
|
|
692
|
+
pointList.push(svgCircle(x + 0.5, y + 1, 0.5 * rand(0.95, 1.05), p.bgColor, undefined, p.circleColor, rand(0.36, 0.4)));
|
|
693
|
+
available[x][y] = false;
|
|
694
|
+
available[x][y + 1] = false;
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
if (available[x][y] && x < nCount - 1) {
|
|
698
|
+
if (qr.isDark(x, y) && qr.isDark(x + 1, y)) {
|
|
699
|
+
pointList.push(svgCircle(x + 1, y + 0.5, 0.5 * rand(0.95, 1.05), p.bgColor, undefined, p.circleColor, rand(0.36, 0.4)));
|
|
700
|
+
available[x][y] = false;
|
|
701
|
+
available[x + 1][y] = false;
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
if (available[x][y]) {
|
|
705
|
+
if (qr.isDark(x, y)) {
|
|
706
|
+
pointList.push(svgCircle(x + 0.5, y + 0.5, 0.5 * rand(0.5, 1), p.circleColor));
|
|
707
|
+
}
|
|
708
|
+
else if (tt[x][y] === QRPointType.DATA) {
|
|
709
|
+
if (rand(0, 1) > 0.85) {
|
|
710
|
+
g2.push(svgCircle(x + 0.5, y + 0.5, 0.5 * rand(0.85, 1.3), p.bgColor, undefined, p.circleColor, rand(0.15, 0.33)));
|
|
711
|
+
}
|
|
712
|
+
}
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
}
|
|
717
|
+
for (const s of g1)
|
|
718
|
+
pointList.push(s);
|
|
719
|
+
for (const s of g2)
|
|
720
|
+
pointList.push(s);
|
|
721
|
+
return pointList.join("");
|
|
722
|
+
}
|
|
723
|
+
function renderFunc(qr, tt, p) {
|
|
724
|
+
const nCount = qr.getModuleCount();
|
|
725
|
+
const type = p.pointType;
|
|
726
|
+
const pointList = [];
|
|
727
|
+
const size = 0.8;
|
|
728
|
+
if (p.funcType === "B" && type === "round") {
|
|
729
|
+
pointList.push(svgCircle(nCount / 2, nCount / 2, (nCount / 2) * Math.sqrt(2) * (13 / 40), "none", undefined, p.otherColor2, nCount / 15));
|
|
730
|
+
}
|
|
731
|
+
for (let x = 0; x < nCount; x++) {
|
|
732
|
+
for (let y = 0; y < nCount; y++) {
|
|
733
|
+
if (qr.isDark(x, y) && tt[x][y] === QRPointType.POS_CENTER) {
|
|
734
|
+
pointList.push(renderPosCenter(x, y, p.posType, p.posColor, size));
|
|
735
|
+
}
|
|
736
|
+
else if (qr.isDark(x, y) && tt[x][y] === QRPointType.POS_OTHER) {
|
|
737
|
+
pointList.push(renderPosOther(x, y, p.posType, p.posColor));
|
|
738
|
+
}
|
|
739
|
+
else {
|
|
740
|
+
const dist = Math.sqrt(Math.pow((nCount - 1) / 2 - x, 2) + Math.pow((nCount - 1) / 2 - y, 2)) / ((nCount / 2) * Math.sqrt(2));
|
|
741
|
+
if (p.funcType === "A") {
|
|
742
|
+
let sizeF = (1 - Math.cos(Math.PI * dist)) / 6 + 1 / 5;
|
|
743
|
+
const opacityF = qr.isDark(x, y) ? 1 : 0;
|
|
744
|
+
if (type === "rect") {
|
|
745
|
+
sizeF += 0.2;
|
|
746
|
+
pointList.push(svgRect(x + (1 - sizeF) / 2, y + (1 - sizeF) / 2, sizeF, sizeF, p.otherColor1, opacityF));
|
|
747
|
+
}
|
|
748
|
+
else {
|
|
749
|
+
pointList.push(svgCircle(x + 0.5, y + 0.5, sizeF, p.otherColor1, opacityF));
|
|
750
|
+
}
|
|
751
|
+
}
|
|
752
|
+
if (p.funcType === "B") {
|
|
753
|
+
let sizeF = 0;
|
|
754
|
+
let colorF = p.otherColor1;
|
|
755
|
+
let opacityF = qr.isDark(x, y) ? 1 : 0;
|
|
756
|
+
if (dist > 5 / 20 && dist < 8 / 20) {
|
|
757
|
+
sizeF = 5 / 10;
|
|
758
|
+
colorF = p.otherColor2;
|
|
759
|
+
opacityF = 1;
|
|
760
|
+
}
|
|
761
|
+
else {
|
|
762
|
+
sizeF = 1 / 4;
|
|
763
|
+
if (type === "rect")
|
|
764
|
+
sizeF = 1 / 4 - 0.1;
|
|
765
|
+
}
|
|
766
|
+
if (type === "rect") {
|
|
767
|
+
sizeF = 2 * sizeF + 0.1;
|
|
768
|
+
if (qr.isDark(x, y)) {
|
|
769
|
+
pointList.push(svgRect(x + (1 - sizeF) / 2, y + (1 - sizeF) / 2, sizeF, sizeF, colorF, opacityF));
|
|
770
|
+
}
|
|
771
|
+
else {
|
|
772
|
+
sizeF -= 0.1;
|
|
773
|
+
pointList.push(svgRect(x + (1 - sizeF) / 2, y + (1 - sizeF) / 2, sizeF, sizeF, p.bgColor, opacityF, colorF, 0.1));
|
|
774
|
+
}
|
|
775
|
+
}
|
|
776
|
+
else {
|
|
777
|
+
if (qr.isDark(x, y)) {
|
|
778
|
+
pointList.push(svgCircle(x + 0.5, y + 0.5, sizeF, colorF, opacityF));
|
|
779
|
+
}
|
|
780
|
+
else {
|
|
781
|
+
pointList.push(svgCircle(x + 0.5, y + 0.5, sizeF, p.bgColor, opacityF, colorF, 0.1));
|
|
782
|
+
}
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
}
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
return pointList.join("");
|
|
789
|
+
}
|
|
790
|
+
export function buildQrbtfSvg(value, style, params) {
|
|
791
|
+
resetRand();
|
|
792
|
+
const { matrix, version } = createQrMatrix(value, "H");
|
|
793
|
+
const tt = getTypeTable(matrix);
|
|
794
|
+
const nCount = matrix.getModuleCount();
|
|
795
|
+
const viewBox = defaultViewBox(nCount);
|
|
796
|
+
const bgColor = params.bgColor ?? "#000000";
|
|
797
|
+
let content;
|
|
798
|
+
if (style === "normal") {
|
|
799
|
+
content = renderNormal(matrix, tt, {
|
|
800
|
+
pointType: (params.pointType ?? "rect"),
|
|
801
|
+
pointSize: params.pointSize ?? 100,
|
|
802
|
+
pointOpacity: params.pointOpacity ?? 100,
|
|
803
|
+
posType: (params.posType ?? "rect"),
|
|
804
|
+
otherColor: params.otherColor ?? "#FFFFFF",
|
|
805
|
+
posColor: params.posColor ?? "#FFFFFF",
|
|
806
|
+
});
|
|
807
|
+
}
|
|
808
|
+
else if (style === "line") {
|
|
809
|
+
content = renderLine(matrix, tt, {
|
|
810
|
+
direction: (params.direction ?? "left-right"),
|
|
811
|
+
lineWidth: params.lineWidth ?? 100,
|
|
812
|
+
lineOpacity: params.lineOpacity ?? 100,
|
|
813
|
+
posType: (params.posType ?? "rect"),
|
|
814
|
+
lineColor: params.otherColor ?? "#FFFFFF",
|
|
815
|
+
posColor: params.posColor ?? "#FFFFFF",
|
|
816
|
+
});
|
|
817
|
+
}
|
|
818
|
+
else if (style === "dsj") {
|
|
819
|
+
content = renderDsj(matrix, tt, {
|
|
820
|
+
scale: params.scale ?? 70,
|
|
821
|
+
crossWidth: params.crossWidth ?? 70,
|
|
822
|
+
posWidth: params.posWidth ?? 90,
|
|
823
|
+
posType: params.dsjPosType ?? "dsj",
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
else if (style === "bubble") {
|
|
827
|
+
content = renderBubble(matrix, tt, {
|
|
828
|
+
circleColor: params.circleColor ?? params.otherColor ?? "#8ED1FC",
|
|
829
|
+
posColor: params.posColor ?? "#4DA6FF",
|
|
830
|
+
bgColor,
|
|
831
|
+
});
|
|
832
|
+
}
|
|
833
|
+
else {
|
|
834
|
+
content = renderFunc(matrix, tt, {
|
|
835
|
+
funcType: params.funcType ?? "A",
|
|
836
|
+
pointType: (params.pointType ?? "rect"),
|
|
837
|
+
posType: (params.posType ?? "rect"),
|
|
838
|
+
otherColor1: params.otherColor ?? "#FFFFFF",
|
|
839
|
+
otherColor2: params.otherColor2 ?? "#FFFFFF",
|
|
840
|
+
posColor: params.posColor ?? "#FFFFFF",
|
|
841
|
+
bgColor,
|
|
842
|
+
});
|
|
843
|
+
}
|
|
844
|
+
return { content, viewBox, version, moduleCount: nCount, bgColor };
|
|
845
|
+
}
|
|
846
|
+
export function wrapQrbtfSvg(r, width, height) {
|
|
847
|
+
const [vx, vy, vw, vh] = r.viewBox.split(" ");
|
|
848
|
+
return `<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="${width}" height="${height}" viewBox="${r.viewBox}" shape-rendering="crispEdges"><rect x="${vx}" y="${vy}" width="${vw}" height="${vh}" fill="${esc(r.bgColor)}"/>${r.content}</svg>`;
|
|
849
|
+
}
|