allyhub 0.15.2 → 0.17.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 +24 -0
- package/dist/commands/add.js +1 -1
- package/dist/commands/cloud-tools.js +1 -1
- package/dist/commands/dev.js +6 -2
- package/dist/commands/doctor.js +3 -3
- package/dist/commands/frames/doc.js +1 -1
- package/dist/commands/inspect/common.js +3 -3
- package/dist/commands/inspect/facts.js +2 -2
- package/dist/commands/inspect/index.js +1 -1
- package/dist/commands/inspect/layout.js +1 -1
- package/dist/commands/inspect/uses.js +3 -0
- package/dist/commands/mail.js +6 -6
- package/dist/commands/render.js +1 -1
- package/dist/main.js +8 -8
- package/dist/node_modules/@allyhub/3d-extension/dist/cli/scenery-text.js +2 -2
- package/dist/node_modules/@allyhub/3d-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/audio/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/audio/dist/place.js +2 -0
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/browser/package.json +1 -1
- package/dist/node_modules/@allyhub/build/dist/content.d.ts +7 -0
- package/dist/node_modules/@allyhub/build/dist/file-check.d.ts +2 -2
- package/dist/node_modules/@allyhub/build/dist/imports.d.ts +17 -0
- package/dist/node_modules/@allyhub/build/dist/imports.js +2 -0
- package/dist/node_modules/@allyhub/build/dist/index.d.ts +3 -2
- package/dist/node_modules/@allyhub/build/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/inspect-view.d.ts +1 -1
- package/dist/node_modules/@allyhub/build/dist/inspect-view.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/kind-build.d.ts +19 -3
- package/dist/node_modules/@allyhub/build/dist/prepare.js +3 -3
- package/dist/node_modules/@allyhub/build/dist/uses.d.ts +27 -6
- package/dist/node_modules/@allyhub/build/dist/uses.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/work.d.ts +9 -1
- package/dist/node_modules/@allyhub/build/dist/work.js +3 -3
- package/dist/node_modules/@allyhub/build/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-extension/skills/allyhub/references/canvas.md +2 -2
- package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/package.json +1 -1
- package/dist/node_modules/@allyhub/check/package.json +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/blobs.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/client.d.ts +12 -3
- package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/index.d.ts +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/cloud/package.json +1 -1
- package/dist/node_modules/@allyhub/components/package.json +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/deletion.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/inputs.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/live.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/project.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/record.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/writer.js +3 -2
- package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/doc/dist/docx.js +4 -4
- package/dist/node_modules/@allyhub/doc/dist/html.js +40 -40
- package/dist/node_modules/@allyhub/doc/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/markdown.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/parse.js +4 -4
- package/dist/node_modules/@allyhub/doc/dist/table.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/write.js +26 -26
- package/dist/node_modules/@allyhub/doc/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/build.js +2 -2
- package/dist/node_modules/@allyhub/doc-extension/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-print/package.json +1 -1
- package/dist/node_modules/@allyhub/export/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/export/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-api/package.json +1 -1
- package/dist/node_modules/@allyhub/extension-host/dist/points.js +1 -1
- package/dist/node_modules/@allyhub/extension-host/package.json +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +15 -3
- package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/website.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/items.d.ts +70 -11
- package/dist/node_modules/@allyhub/formats/dist/items.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/layout.d.ts +15 -4
- package/dist/node_modules/@allyhub/formats/dist/layout.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +4 -0
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/i18n/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/i18n/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/dist/stage.js +1 -1
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/workspace.js +1 -1
- package/dist/node_modules/@allyhub/image-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/image-extension/skills/allyhub/references/images.md +3 -3
- package/dist/node_modules/@allyhub/image-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/image-psd/package.json +1 -1
- package/dist/node_modules/@allyhub/image-render/package.json +1 -1
- package/dist/node_modules/@allyhub/image-runtime/dist/load.js +2 -2
- package/dist/node_modules/@allyhub/image-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/image-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/jobs/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-extension/package.json +3 -1
- package/dist/node_modules/@allyhub/linkedin-extension/skills/allyhub/references/linkedin.md +1 -1
- package/dist/node_modules/@allyhub/linkedin-model/package.json +1 -1
- package/dist/node_modules/@allyhub/linkedin-view/package.json +1 -1
- package/dist/node_modules/@allyhub/measure/package.json +1 -1
- package/dist/node_modules/@allyhub/media/package.json +1 -1
- package/dist/node_modules/@allyhub/media-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/model/package.json +1 -1
- package/dist/node_modules/@allyhub/office-extension/LICENSE +241 -0
- package/dist/node_modules/@allyhub/office-extension/markup/csv/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/csv/data/leads.csv +5 -0
- package/dist/node_modules/@allyhub/office-extension/markup/csv/markup.json +19 -0
- package/dist/node_modules/@allyhub/office-extension/markup/document/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/document/briefs/launch.docx +0 -0
- package/dist/node_modules/@allyhub/office-extension/markup/document/markup.json +11 -0
- package/dist/node_modules/@allyhub/office-extension/markup/presentation/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/presentation/decks/pitch.pptx +0 -0
- package/dist/node_modules/@allyhub/office-extension/markup/presentation/markup.json +11 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/data/plans.xlsx +0 -0
- package/dist/node_modules/@allyhub/office-extension/markup/workbook/markup.json +10 -0
- package/dist/node_modules/@allyhub/office-extension/package.json +124 -0
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/dist/layer.d.ts +15 -0
- package/dist/node_modules/@allyhub/piece/dist/page/index.d.ts +1 -0
- package/dist/node_modules/@allyhub/piece/dist/page/index.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/page/runtimes.d.ts +9 -0
- package/dist/node_modules/@allyhub/piece/dist/page/runtimes.js +2 -0
- package/dist/node_modules/@allyhub/piece/dist/source.d.ts +53 -10
- package/dist/node_modules/@allyhub/piece/dist/source.js +1 -1
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/project/dist/digest.js +1 -1
- package/dist/node_modules/@allyhub/project/dist/part-keys.js +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +10 -11
- package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +7 -0
- package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/blobs.d.ts +9 -0
- package/dist/node_modules/@allyhub/protocol/dist/blobs.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cli.d.ts +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/cli.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cloud-computer.d.ts +77 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud-computer.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +39 -9
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +15 -15
- package/dist/node_modules/@allyhub/protocol/dist/events.d.ts +441 -5
- package/dist/node_modules/@allyhub/protocol/dist/events.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/files.d.ts +2 -2
- package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +4 -1
- package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/index.d.ts +8 -0
- package/dist/node_modules/@allyhub/protocol/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/jobs.d.ts +5 -5
- package/dist/node_modules/@allyhub/protocol/dist/kinds.d.ts +45 -0
- package/dist/node_modules/@allyhub/protocol/dist/kinds.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/paywall.d.ts +134 -0
- package/dist/node_modules/@allyhub/protocol/dist/paywall.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/place.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/presence.d.ts +3 -3
- package/dist/node_modules/@allyhub/protocol/dist/purposes.d.ts +47 -0
- package/dist/node_modules/@allyhub/protocol/dist/purposes.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/routes.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/shares.d.ts +52 -5
- package/dist/node_modules/@allyhub/protocol/dist/shares.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/sidebar-deletion.d.ts +34 -0
- package/dist/node_modules/@allyhub/protocol/dist/sidebar-deletion.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/sites.d.ts +1 -0
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +21 -52
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/studio-server.d.ts +264 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-server.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-tool-calls.d.ts +18 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-tool-calls.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-window-requests.d.ts +97 -0
- package/dist/node_modules/@allyhub/protocol/dist/studio-window-requests.js +2 -0
- package/dist/node_modules/@allyhub/protocol/dist/teams.d.ts +3 -2
- package/dist/node_modules/@allyhub/protocol/dist/teams.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +26 -20
- package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/turns.d.ts +71 -0
- package/dist/node_modules/@allyhub/protocol/dist/turns.js +2 -0
- package/dist/node_modules/@allyhub/protocol/package.json +1 -1
- package/dist/node_modules/@allyhub/registry/package.json +1 -1
- package/dist/node_modules/@allyhub/render/package.json +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/compose.js +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/embed.js +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/film.js +1 -1
- package/dist/node_modules/@allyhub/runtime/dist/piece.js +2 -2
- package/dist/node_modules/@allyhub/runtime/dist/player/player.js +1 -1
- package/dist/node_modules/@allyhub/runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/runtimes/package.json +1 -1
- package/dist/node_modules/@allyhub/scaffold/dist/index.js +4 -4
- package/dist/node_modules/@allyhub/scaffold/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery-host/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/coerce.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/engine.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/criteria.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/date.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/dynamic.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/info.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/logical.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/lookup.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/text.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/parse.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/import.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/read.js +2 -2
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/build.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/cli/sheet.js +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/package.json +3 -3
- package/dist/node_modules/@allyhub/slides-core/dist/animation.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/api.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/components.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/build.js +2 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/cli/slides.js +2 -2
- package/dist/node_modules/@allyhub/slides-extension/dist/deck-pptx.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/evaluate.js +2 -2
- package/dist/node_modules/@allyhub/slides-extension/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/audio-icon.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/write.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/package.json +5 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/component.js +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/draw.js +2 -2
- package/dist/node_modules/@allyhub/slides-runtime/dist/item.js +2 -0
- package/dist/node_modules/@allyhub/slides-runtime/dist/load.js +5 -5
- package/dist/node_modules/@allyhub/slides-runtime/dist/slide-css.js +20 -0
- package/dist/node_modules/@allyhub/slides-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/stage/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/install.js +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/runtime/stage.html +1 -1
- package/dist/node_modules/@allyhub/stage-page/dist/runtime/stage.js +2 -2
- package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/dist/runtime.js +20 -20
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/telemetry/dist/doc.js +17 -2
- package/dist/node_modules/@allyhub/telemetry/dist/level.js +2 -2
- package/dist/node_modules/@allyhub/telemetry/dist/levels.js +2 -0
- package/dist/node_modules/@allyhub/telemetry/dist/scrub.js +1 -1
- package/dist/node_modules/@allyhub/telemetry/package.json +5 -1
- package/dist/node_modules/@allyhub/text-extension/markup/markup.json +1 -1
- package/dist/node_modules/@allyhub/text-extension/markup-file/allyhub.yaml +2 -0
- package/dist/node_modules/@allyhub/text-extension/markup-file/archive/assets.zip +0 -0
- package/dist/node_modules/@allyhub/text-extension/markup-file/markup.json +10 -0
- package/dist/node_modules/@allyhub/text-extension/package.json +35 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/build.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/cli/reference-text.js +3 -3
- package/dist/node_modules/@allyhub/video-extension/package.json +2 -2
- package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/package.json +1 -1
- package/dist/node_modules/@allyhub/website/package.json +1 -1
- package/dist/node_modules/@allyhub/website-extension/package.json +1 -1
- package/dist/node_modules/@allyhub/x-extension/package.json +3 -1
- package/dist/node_modules/@allyhub/x-extension/skills/allyhub/references/x.md +1 -1
- package/dist/node_modules/@allyhub/x-model/package.json +1 -1
- package/dist/node_modules/@allyhub/x-view/package.json +1 -1
- package/dist/package.json +13 -12
- package/dist/project.js +1 -1
- package/dist/telemetry.js +3 -3
- package/dist/text/console-text.js +2 -2
- package/dist/works.js +1 -1
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-9z0ZEYUq.js → abnfDiagram-WEYOIA3C-CHNpVSPv.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-ELMO_PA6.js → architecture-WOLXFQ4H-gPsJqQwV.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-C0yuCWU3.js → architectureDiagram-ZHVYKT53-CEIDcC6r.js} +1 -1
- package/editor-web/assets/arrow-down-B8VUPCGi.js +1 -0
- package/editor-web/assets/arrow-up-Ds4juY8X.js +1 -0
- package/editor-web/assets/article-BHTjq0_Y.js +3 -0
- package/editor-web/assets/article-DfELjJ2o.js +7 -0
- package/editor-web/assets/{audio-lines-1s1eRs4Q.js → audio-lines-PZj77e7t.js} +1 -1
- package/editor-web/assets/bar-button-J9vbfzTx.js +1 -0
- package/editor-web/assets/{blockDiagram-RJAE7QA3-vi6JOg4o.js → blockDiagram-RJAE7QA3-CUzEGVet.js} +4 -4
- package/editor-web/assets/browser-C1XuTMlp.js +1 -0
- package/editor-web/assets/{c4Diagram-XDPPPE54-Agf_H8uS.js → c4Diagram-XDPPPE54-CB94NR9s.js} +1 -1
- package/editor-web/assets/calc-worker-BdHh5LXM.js +45 -0
- package/editor-web/assets/channel-DCDCx5Es.js +1 -0
- package/editor-web/assets/chart-amT4lgX3.js +2 -0
- package/editor-web/assets/chart-file-CfbWK9l1.js +1 -0
- package/editor-web/assets/{chart-no-axes-column-CJmeYOSo.js → chart-no-axes-column-Be0lFcGF.js} +1 -1
- package/editor-web/assets/{chunk-2E7WHVMD-XalaZaha.js → chunk-2E7WHVMD-DFYo_Boi.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-DUlRZkCS.js → chunk-4EMNKR2T-CLLjmweX.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-DTa7whGr.js → chunk-55XCU76K-CkwQ_3m1.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-85zCPzj0.js → chunk-7S6XSTFO-V-AvHpAB.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-CWBseIyh.js → chunk-AQDTSKZB-PjHyYpb8.js} +1 -1
- package/editor-web/assets/chunk-DSNLSHJZ-QaczBS3J.js +127 -0
- package/editor-web/assets/{chunk-HAGFOTED-DFWda2Rk.js → chunk-HAGFOTED-aLaQB5Xu.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-aXibFitC.js → chunk-HNE4Q36P-De3ftDQR.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-CtJUuFdN.js → chunk-NQOKRVIF-CrhVQyvP.js} +17 -17
- package/editor-web/assets/{chunk-UHW7PFBP-B6QKSKWE.js → chunk-UHW7PFBP-BFmZ5ZLn.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-CF6Al55P.js → chunk-VQ5W62QI-CzppUHLA.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-w2TKLkyw.js → chunk-WQQL4CDK-BrAU7V6v.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-DVGOATM3.js → chunk-YZO67HFG-BSiF71qj.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-Cq7MMjDP.js → chunk-ZAUX2LTX-BJc4r5b1.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-GMW_lBh4.js → chunk-ZCHMQSOR-CkGTuehB.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-C7AK5Bkj.js → classDiagram-v2-4MYWR3UA-Byxc7J88.js} +7 -7
- package/editor-web/assets/code-CD-CbJG9.js +1 -0
- package/editor-web/assets/collaborator-BU4qU7O3.js +1 -0
- package/editor-web/assets/{copy-DvOiv9Ra.js → copy-CuJSs0nI.js} +1 -1
- package/editor-web/assets/{createLucideIcon-REX213UO.js → createLucideIcon-lm_6n8YT.js} +1 -1
- package/editor-web/assets/csv-Bwre9FdI.js +11 -0
- package/editor-web/assets/{cynefin-EF2NZ3EQ-ZnDieQsN.js → cynefin-EF2NZ3EQ-BSxkVbdf.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-BrukKIBF.js → cynefinDiagram-WF24UDRP-IkCgARNs.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-DfO0S2p_.js → dagre-NK4GIZVX-9PgeH6nY.js} +1 -1
- package/editor-web/assets/deck-tTzKONci.js +1 -0
- package/editor-web/assets/{diagram-CBK3MWTC-D43RLesi.js → diagram-CBK3MWTC-DRzeg3Ds.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-bA1B1QQG.js → diagram-I5XIIV2D-B_zeKMN6.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-DAdXBD2K.js → diagram-ODIL2UCW-FFm0O8SN.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-C_KyEaws.js → diagram-PFBEJUXE-DrtCT8OA.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-oXTtENF7.js → diagram-RJA3I4VV-DtxJ3V0q.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-Czupe6mO.js → diagram-TYUNFSNR-DmxF_8H_.js} +16 -16
- package/editor-web/assets/dist-BEpzsYn_.js +6 -0
- package/editor-web/assets/dist-BUD4ywMB.js +18 -0
- package/editor-web/assets/{dist-BrGYx10E.js → dist-Bd8IxQPP.js} +1 -1
- package/editor-web/assets/dist-C21CkR7Z.js +531 -0
- package/editor-web/assets/dist-C56mWAec.js +5 -0
- package/editor-web/assets/dist-CAb3W9_P.js +43 -0
- package/editor-web/assets/dist-CEknsRDd.js +24 -0
- package/editor-web/assets/dist-CbZAznNW.js +19 -0
- package/editor-web/assets/{dist-2lNSE-G_.js → dist-D3C6FyrO.js} +1 -1
- package/editor-web/assets/dist-DDzjbKIg.js +4 -0
- package/editor-web/assets/dist-DaEbElXI.js +3 -0
- package/editor-web/assets/dist-Dr3o4vee.js +1 -0
- package/editor-web/assets/{dist-BtRMClDw.js → dist-DruvDNQe.js} +1 -1
- package/editor-web/assets/dist-JLyDtl9X.js +1 -0
- package/editor-web/assets/dist-PBbWAsrV.js +17 -0
- package/editor-web/assets/dist-ZZlQa66J.js +1 -0
- package/editor-web/assets/dist-bQKpw3Zz.js +16 -0
- package/editor-web/assets/dist-d4dayaWE.js +17 -0
- package/editor-web/assets/docx-draw-9Q_fArBC.js +4 -0
- package/editor-web/assets/docx-preview-pcg9ioe3.js +21 -0
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-BOhNZmtp.js → ebnfDiagram-V4P3TTPT-DSX1Aoty.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-DoZH3OoE.js → elk-QONTBCTQ-C7gy9q56.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-Bv0KDJi4.js → erDiagram-KYQIGQAA-CKx_HoY4.js} +2 -2
- package/editor-web/assets/esm-BZb5QMQf.js +21 -0
- package/editor-web/assets/{eventmodeling-K75KTNOO-C-_xzqfj.js → eventmodeling-K75KTNOO-DL4HvSrd.js} +1 -1
- package/editor-web/assets/{file-exclamation-point-C_fX4fpI.js → file-exclamation-point-_L3ElCJ5.js} +1 -1
- package/editor-web/assets/file-question-mark-DlIjUK37.js +1 -0
- package/editor-web/assets/flowDiagram-IUGLLWBU-BUnRtJ8q.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-CAuJlaZX.js → ganttDiagram-R7GPNTJY-N-AP4slN.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-Dx2xLi5C.js → gitGraph-VSP46ZUC-BKRGJKWm.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-DHsk_UOT.js → gitGraphDiagram-PDYL7XHY-ClwL7w2_.js} +1 -1
- package/editor-web/assets/{group-pebHQTdP.js → group-BdrTp7gi.js} +1 -1
- package/editor-web/assets/hint-rlht0uxG.js +1 -0
- package/editor-web/assets/index-BedbINE5.css +2 -0
- package/editor-web/assets/index-DG2nHq4D.js +28 -0
- package/editor-web/assets/{info-OHQRW6UA-CnKQHx5m.js → info-OHQRW6UA-DpcY8t23.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-ibAVFw_2.js → infoDiagram-MVDRKAX5-ChtmtWni.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-C1OCHt3y.js → ishikawaDiagram-HPEHV2GE-BZNTuG_F.js} +1 -1
- package/editor-web/assets/iso-ahTwmFwH.js +56 -0
- package/editor-web/assets/{italic-CtlNOXN9.js → italic-zw4_eUNF.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-BDdqMOM1.js → journeyDiagram-BOSHW7O7-C3uVmZbL.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-CSAS_zGn.js → kanban-definition-FNSA4HC5-puEhftGG.js} +4 -4
- package/editor-web/assets/{link-CW2KxKT_.js → link-DopSU3aa.js} +1 -1
- package/editor-web/assets/{mermaid-parser.core-DTLyYXbn.js → mermaid-parser.core-Bw8re-WE.js} +3 -3
- package/editor-web/assets/mermaid.core-Cc2GIqBr.js +44 -0
- package/editor-web/assets/{mindmap-definition-6OY57UG3-DSWHcglH.js → mindmap-definition-6OY57UG3-C6MUl_S_.js} +3 -3
- package/editor-web/assets/minus-CbPnUIOy.js +1 -0
- package/editor-web/assets/{packet-JDAUHWVQ-_k1BF29s.js → packet-JDAUHWVQ-C75RnvC5.js} +1 -1
- package/editor-web/assets/{pegDiagram-ECIUJNBX-B22YyWAa.js → pegDiagram-ECIUJNBX-ChjmsdV4.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-CSwV32hj.js → pie-XZMESJXO-BaKxJQpj.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-rSFNeWnq.js → pieDiagram-GNMPY74T-CT2ez8pr.js} +1 -1
- package/editor-web/assets/progress-CwKcXARv.js +6 -0
- package/editor-web/assets/props-form-D5oKHfpk.js +1 -0
- package/editor-web/assets/purify.es-B9ve_eFf.js +3 -0
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-Xrntfg4j.js → quadrantDiagram-D57K4MC3-BJItlTfk.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-Dwq5qiNw.js → radar-ABXABTNO-DnLzBlTo.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-sIUGWcZh.js → railroad-I3PHUGI6-D5hj6Yv3.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-1rWlT9BX.js → railroad-abnf-LNEFI6M7-DUZlZoPu.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-DWdkzEHc.js → railroad-ebnf-DWYD2UWJ-CDyyDC6d.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-CME0JBbV.js → railroad-peg-JR7BVNR7-CC3ImNnT.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-Ch4BpP22.js → railroadDiagram-Y72NRBL7-Bjw-8Se5.js} +1 -1
- package/editor-web/assets/{react-Bk7NnOLX.js → react-Edyoga_4.js} +1 -1
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-CgE-x3wN.js → requirementDiagram-EQYSW5RA-CDFnuEIO.js} +1 -1
- package/editor-web/assets/row-C_svyL8o.js +1 -0
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-DBf4G6n3.js → sankeyDiagram-SY24JHO5-CQPVLY1w.js} +1 -1
- package/editor-web/assets/schemas-moE_A7Nj.js +1 -0
- package/editor-web/assets/{scissors-BURkYWPv.js → scissors-B_xOiUhd.js} +1 -1
- package/editor-web/assets/{search-jKDvFIEU.js → search-Ba2BbT6T.js} +1 -1
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-Bz07CoUS.js → sequenceDiagram-BLEHNHQU-BQzuLmBX.js} +1 -1
- package/editor-web/assets/{session-CUCSWPTE.js → session-s1I85rox.js} +1 -1
- package/editor-web/assets/{sigma-CY2Chbro.js → sigma-DSUsJhMn.js} +1 -1
- package/editor-web/assets/slides-oQ_C0SVJ.js +1 -0
- package/editor-web/assets/snapshots-BPJKywuN.js +1 -0
- package/editor-web/assets/{sound-DUCxe9eC.js → sound-bTlco_K3.js} +1 -1
- package/editor-web/assets/split-7CVjIkSU.js +3 -0
- package/editor-web/assets/square-arrow-out-up-right-DF5dvsSp.js +1 -0
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-DuqAmDPP.js → stateDiagram-v2-A6IESKWZ-DOuageUf.js} +7 -7
- package/editor-web/assets/{sticky-note-C5qUDHhC.js → sticky-note-BdkIu5_D.js} +1 -1
- package/editor-web/assets/{strikethrough-DP-7tMz0.js → strikethrough-BwXWi4zg.js} +1 -1
- package/editor-web/assets/surface-DtCjIlrq.js +1 -0
- package/editor-web/assets/svg-CWIBMIQ9.js +1 -0
- package/editor-web/assets/swatch-DhztHwPU.js +1 -0
- package/editor-web/assets/{swimlanes-B3ENRKFQ-C7sOL6rB.js → swimlanes-B3ENRKFQ-CXKkok7X.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-C3Car2M0.js +8 -0
- package/editor-web/assets/switch-8MU4Nfxe.js +1 -0
- package/editor-web/assets/{syntax-DSsHrzWF.js → syntax-CU_WPKxt.js} +1 -1
- package/editor-web/assets/{table-CTjNpE4W.js → table-DRbddzx0.js} +1 -1
- package/editor-web/assets/tabs-CiF1N-pL.js +1 -0
- package/editor-web/assets/tag-CIfWT8B_.js +1 -0
- package/editor-web/assets/text-align-start-Cic2-TLh.js +1 -0
- package/editor-web/assets/textarea-D7TnPwv1.js +1 -0
- package/editor-web/assets/{timeline-definition-JXYKGLGB-CaLYz9mc.js → timeline-definition-JXYKGLGB-DgAjAeZp.js} +3 -3
- package/editor-web/assets/{treeView-D4JQ5SDB-D1P1Kyxc.js → treeView-D4JQ5SDB-C0Xvnhck.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-2YaFL53t.js → treemap-SAJKECNS-aXfKAeSX.js} +1 -1
- package/editor-web/assets/{undo-2-DUGGyBdX.js → undo-2-C47jrRp5.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX-uYdbUhUS.js → usecaseDiagram-WPOLBNNX-CvUlBa-L.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-DHepmX4t.js → vennDiagram-Q3Y3IDCW-qMJ1iCxs.js} +3 -3
- package/editor-web/assets/{video-Xl-OaXRc.js → video-DQrjo1TI.js} +1 -1
- package/editor-web/assets/{wardley-7MLQ67FV-Dx0MOPV1.js → wardley-7MLQ67FV-DEdnH0by.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-BX8ElwDW.js → wardleyDiagram-IVAIDKWA-Bt-B2hQ5.js} +1 -1
- package/editor-web/assets/{whole-word-6DliXke2.js → whole-word-D3ZAtnkw.js} +1 -1
- package/editor-web/assets/{words-B2FXYyeZ.js → words-0Ww2RyT4.js} +1 -1
- package/editor-web/assets/{words-DFIhHhHF.js → words-XlXG79Ur.js} +1 -1
- package/editor-web/assets/workbook-FSSUiIp9.js +45 -0
- package/editor-web/assets/x-DlhyIKuu.js +41 -0
- package/editor-web/assets/{xychartDiagram-4URNHDU4-DoWQRJUS.js → xychartDiagram-4URNHDU4-DV4bSzTb.js} +1 -1
- package/editor-web/assets/{zoom-in-C4lxmIDE.js → zoom-in-PgsC94hP.js} +1 -1
- package/editor-web/index.html +8 -6
- package/package.json +2 -2
- package/editor-web/assets/arrow-down-DzZjFrBL.js +0 -1
- package/editor-web/assets/arrow-up-hdmh9LVD.js +0 -1
- package/editor-web/assets/article-DHFgHYjv.js +0 -3
- package/editor-web/assets/article-Dt9id9Y9.js +0 -7
- package/editor-web/assets/button-BVQH7zxz.js +0 -41
- package/editor-web/assets/calc-worker-jImBXoeb.js +0 -45
- package/editor-web/assets/channel-Dkg198L0.js +0 -1
- package/editor-web/assets/chart-BC3kUUDD.js +0 -2
- package/editor-web/assets/chunk-DSNLSHJZ-BFnyvrWg.js +0 -129
- package/editor-web/assets/code-BID_OoRp.js +0 -1
- package/editor-web/assets/collaborator-2qfw-8OJ.js +0 -1
- package/editor-web/assets/dist-5HNrQ9AU.js +0 -45
- package/editor-web/assets/dist-BPecIPz6.js +0 -530
- package/editor-web/assets/dist-BXJKASX4.js +0 -24
- package/editor-web/assets/dist-BeDRTqQ8.js +0 -38
- package/editor-web/assets/dist-BlL-4sl3.js +0 -43
- package/editor-web/assets/dist-BuqBg8k8.js +0 -1
- package/editor-web/assets/dist-BwW08gSh.js +0 -1
- package/editor-web/assets/dist-C30Thvb3.js +0 -1
- package/editor-web/assets/dist-Cj5AmpVb.js +0 -5
- package/editor-web/assets/dist-CjjnDOa8.js +0 -3
- package/editor-web/assets/dist-D7ur8721.js +0 -6
- package/editor-web/assets/dist-DOHhp09C.js +0 -4
- package/editor-web/assets/dist-LhFEYZza.js +0 -16
- package/editor-web/assets/flowDiagram-IUGLLWBU-C7ZmHJZW.js +0 -1
- package/editor-web/assets/hint-mQB8slJ2.js +0 -1
- package/editor-web/assets/index-BGAXezRR.js +0 -28
- package/editor-web/assets/index-Br4a-QEv.css +0 -2
- package/editor-web/assets/mermaid.core-B8478wZ1.js +0 -44
- package/editor-web/assets/minus-D1tgAHbU.js +0 -1
- package/editor-web/assets/progress-udl4pNsP.js +0 -6
- package/editor-web/assets/props-form-B6mYjTgZ.js +0 -1
- package/editor-web/assets/row-dgHEAE7h.js +0 -1
- package/editor-web/assets/schemas-B89k2jEC.js +0 -1
- package/editor-web/assets/slides-BdaWgL_N.js +0 -1
- package/editor-web/assets/snapshots-CTS2iez5.js +0 -56
- package/editor-web/assets/split-mDSkdQkd.js +0 -3
- package/editor-web/assets/surface-D9qJjJQL.js +0 -1
- package/editor-web/assets/svg-nJtFNJ-7.js +0 -1
- package/editor-web/assets/swatch-S8YuBYyj.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-CQ2aWYP-.js +0 -8
- package/editor-web/assets/switch-D5kPl2jO.js +0 -1
- package/editor-web/assets/tabs-C0AHyuE5.js +0 -1
- package/editor-web/assets/textarea-mzr9Kfuf.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{d as t,l as n,m as r,o as i,s as a,u as o,v as s}from"./react-Bk7NnOLX.js";import{Tt as c,gt as l,t as u,yt as d}from"./button-BVQH7zxz.js";import{A as f,P as p,Y as m,et as h,g,nt as _,x as v}from"./snapshots-CTS2iez5.js";import{t as y}from"./jsx-runtime-DePvh3-m.js";import{t as b}from"./createLucideIcon-REX213UO.js";import{i as x}from"./dist-D7ur8721.js";import{t as ee}from"./zoom-in-C4lxmIDE.js";var te=b(`corner-up-left`,[[`path`,{d:`M20 20v-7a4 4 0 0 0-4-4H4`,key:`1nkjon`}],[`path`,{d:`M9 14 4 9l5-5`,key:`102s5s`}]]),S=e(s(),1),C=y(),w=_([m(),m(),m()]),T={"scenery/viewer":p(h({item:f,camera:h({position:w,target:w}).optional()}),g,`The address of a scenery's viewer page, for a sandboxed frame: it tells what the person does by postMessage.`)},E=v(T),D=d({en:{title:`3D scenery`,loading:`Loading the scenery`,loadFailed:`The scenery did not load`,zoomIn:`Zoom in`,back:`Back`,size:(e,t,n)=>`${e} × ${t} × ${n} m`},"zh-cn":{title:`3D 布景`,loading:`正在加载布景`,loadFailed:`布景没能加载`,zoomIn:`放大`,back:`返回`,size:(e,t,n)=>`${e} × ${t} × ${n} 米`},"zh-tw":{title:`3D 布景`,loading:`正在載入布景`,loadFailed:`布景無法載入`,zoomIn:`放大`,back:`返回`,size:(e,t,n)=>`${e} × ${t} × ${n} 公尺`},ja:{title:`3D セット`,loading:`セットを読み込み中`,loadFailed:`セットを読み込めませんでした`,zoomIn:`ズームイン`,back:`戻る`,size:(e,t,n)=>`${e} × ${t} × ${n} m`},ko:{title:`3D 세트`,loading:`세트를 불러오는 중`,loadFailed:`세트를 불러오지 못했습니다`,zoomIn:`확대`,back:`뒤로`,size:(e,t,n)=>`${e} × ${t} × ${n} m`},es:{title:`Decorado 3D`,loading:`Cargando el decorado`,loadFailed:`El decorado no se cargó`,zoomIn:`Acercar`,back:`Atrás`,size:(e,t,n)=>`${e} × ${t} × ${n} m`},fr:{title:`Décor 3D`,loading:`Chargement du décor`,loadFailed:`Le décor ne s’est pas chargé`,zoomIn:`Zoomer`,back:`Retour`,size:(e,t,n)=>`${e} × ${t} × ${n} m`},de:{title:`3D-Kulisse`,loading:`Kulisse wird geladen`,loadFailed:`Die Kulisse wurde nicht geladen`,zoomIn:`Heranzoomen`,back:`Zurück`,size:(e,t,n)=>`${e} × ${t} × ${n} m`},pt:{title:`Cenário 3D`,loading:`Carregando o cenário`,loadFailed:`O cenário não carregou`,zoomIn:`Aproximar`,back:`Voltar`,size:(e,t,n)=>`${e} × ${t} × ${n} m`}}),O=8;function k(e,t,n,r=8){let i={left:n.left+O,top:n.top+O},a={left:Math.max(i.left,n.right-O-t.width),top:Math.max(i.top,n.bottom-O-t.height)},o=e=>Math.max(i.left,Math.min(e,a.left)),s=e=>Math.max(i.top,Math.min(e,a.top)),c=o(e.left),l=e.bottom+r;if(l<=a.top)return{left:c,top:l};let u=e.top-r-t.height;if(u>=i.top)return{left:c,top:u};let d=e.right+r;return{left:d<=a.left?d:o(e.left-r-t.width),top:s((e.top+e.bottom)/2-t.height/2)}}var A=e=>e>=1?e.toFixed(2):e>=.1?e.toFixed(3):e.toFixed(4),j=1500,M={width:300,height:56},N=e=>[e[0],e[1],e[2]],ne=e=>Array.isArray(e)&&e.length===3&&e.every(e=>typeof e==`number`);function re(e){if(typeof e!=`object`||!e)return;let t=e;if(t.allyhub===!0){if(t.type===`error`)return{type:`error`,message:typeof t.message==`string`?t.message:``};if(t.type===`scenery`&&typeof t.event==`object`)return{type:`scenery`,event:t.event}}}function P({className:e}){return(0,C.jsxs)(`div`,{className:`flex size-full min-h-0 flex-col`,children:[(0,C.jsx)(x,{}),(0,C.jsx)(`div`,{className:`min-h-0 flex-1`,children:(0,C.jsx)(F,{...e===void 0?{}:{className:e}})})]})}function F({className:e}){let s=i(),d=a(),f=D.of(d?.locale),p=d?.item,m=p?.id,h=p?.entry,g=(0,S.useRef)(null),_=(0,S.useRef)(null),v=(0,S.useRef)(void 0),[y,b]=(0,S.useState)({n:0}),[x,w]=(0,S.useState)(),[T,O]=(0,S.useState)(),P=r(T),[F,I]=(0,S.useState)(),[L,R]=(0,S.useState)(),[z,ie]=(0,S.useState)([]),[B,V]=(0,S.useState)(null),[H,ae]=(0,S.useState)({hover:null,select:null}),[oe,se]=(0,S.useState)(!1);(0,S.useEffect)(()=>{if(m===void 0)return;let e=!0,t=y.from;return E(s,`scenery/viewer`,{item:m,...t?{camera:{position:N(t.position),target:N(t.target)}}:{}}).then(t=>{e&&(w({n:y.n,url:t.url}),O(t.probe))},t=>{e&&R({n:y.n,message:t instanceof Error?t.message:String(t)})}),()=>{e=!1}},[s,m,y]),n(m,()=>{let e=v.current;b(t=>({n:t.n+1,...e?{from:e}:{}}))});let U=(0,S.useCallback)(e=>{g.current?.contentWindow?.postMessage({allyhub:!0,command:e},`*`)},[]),W=(0,S.useRef)([]),G=(0,S.useRef)(new Map),K=(0,S.useRef)(!1),q=()=>{let e=g.current?.getBoundingClientRect();return e&&e.width>0&&e.height>0?{x:e.x,y:e.y,width:e.width,height:e.height}:void 0};t({hold:()=>Promise.resolve({key:`${m??``}@${String(y.n)}@${JSON.stringify(v.current??null)}`,what:`The 3D scene ${m??``}`,...h===void 0?{}:{source:{path:h}}}),locate:()=>Promise.resolve({elements:[]})}),o({element:()=>g.current,pictures:()=>new Promise(e=>{let t=q();W.current.push(n=>{e(t?[{rect:t,mime:n.slice(5,n.indexOf(`;`)),data:n.slice(n.indexOf(`,`)+1)}]:[])}),K.current&&U({type:`shot`})}),locate:async e=>{let t=q(),n=await Promise.all(c(e).map(({x:e,y:n})=>new Promise(r=>{let i=crypto.randomUUID(),a=setTimeout(()=>{G.current.delete(i),r(null)},j);G.current.set(i,e=>{clearTimeout(a),r(e)}),U({type:`pick`,id:i,x:e-(t?.x??0),y:n-(t?.y??0)})})));return{elements:[...new Set(n.flatMap(e=>e?[e.path.join(` > `)]:[]))].map(e=>({name:`the object ${e}`,...h===void 0?{}:{source:{path:h}}}))}},pick:e=>new Promise(t=>{let n=q(),r=crypto.randomUUID(),i=setTimeout(()=>{G.current.delete(r),t(void 0)},j);G.current.set(r,e=>{clearTimeout(i),t(e?.screen&&n?{element:{name:`the object ${e.path.join(` > `)}`,...h===void 0?{}:{source:{path:h}}},outline:[e.screen.map(([e,t])=>({x:n.x+e,y:n.y+t}))]}:void 0)}),U({type:`pick`,id:r,x:e.x-(n?.x??0),y:e.y-(n?.y??0)})})}),(0,S.useEffect)(()=>{let e=_.current;if(!e)return;let t=e=>{K.current&&(e.preventDefault(),U({type:`wheel`,deltaY:e.deltaY,ctrlKey:e.ctrlKey}))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>{e.removeEventListener(`wheel`,t)}},[U]);let J=(0,S.useRef)(null);(0,S.useEffect)(()=>{J.current=B},[B]),(0,S.useEffect)(()=>{let e=e=>{if(!x||e.source!==g.current?.contentWindow)return;let t=re(e.data);if(!t)return;if(t.type===`error`){R({n:x.n,message:t.message});return}let n=t.event;switch(n.type){case`ready`:I(x.n),ie(n.cameras),K.current=!0,W.current.forEach(()=>{U({type:`shot`})}),J.current&&U({type:`select`,path:J.current.path});return;case`select`:V(n.object);return;case`camera`:{let e=n.camera;ne(e.target)&&(v.current={position:e.position,target:e.target,...e.lens===void 0?{}:{lens:e.lens}}),se(n.framed);return}case`place`:ae({hover:n.hover,select:n.select});return;case`shot`:W.current.shift()?.(n.picture);return;case`picked`:G.current.get(n.id)?.(n.object),G.current.delete(n.id);return;default:return}};return window.addEventListener(`message`,e),()=>{window.removeEventListener(`message`,e)}},[U,s,x]);let ce=(0,S.useCallback)(()=>{B&&U({type:`select`,path:null}),V(null)},[U,B]),[Y,le]=(0,S.useState)({width:0,height:0});(0,S.useEffect)(()=>{let e=_.current;if(!e)return;let t=new ResizeObserver(()=>{le({width:e.clientWidth,height:e.clientHeight})});return t.observe(e),()=>{t.disconnect()}},[]);let X=B?H.select:null,Z=B&&X?k({left:X.x,top:X.y,right:X.x+X.width,bottom:X.y+X.height},M,{left:0,top:0,right:Y.width,bottom:Y.height}):void 0,Q=x!==void 0&&F===x.n,$=L?.n===y.n?L.message:void 0;return(0,C.jsxs)(`div`,{ref:_,"data-testid":`scenery-viewer`,className:l(`bg-paper relative size-full overflow-hidden`,e),onKeyDown:e=>{e.key===`Escape`&&B&&ce()},children:[x&&P!==void 0&&(0,C.jsx)(`iframe`,{ref:g,src:x.url,title:f.title,...P?{sandbox:`allow-scripts`}:{},"data-testid":`scenery-frame`,...Q?{"data-ready":``}:{},className:l(`absolute inset-0 size-full border-0 transition-opacity`,Q?`opacity-100`:`opacity-0`)},x.n),!Q&&$===void 0&&(0,C.jsx)(`p`,{className:`text-lead absolute inset-0 grid place-items-center text-sm`,children:f.loading}),$!==void 0&&(0,C.jsxs)(`div`,{role:`alert`,className:`absolute inset-x-6 top-6 text-sm`,"data-testid":`scenery-error`,children:[(0,C.jsx)(`p`,{className:`text-problem-text`,children:f.loadFailed}),$&&(0,C.jsx)(`p`,{className:`text-lead mt-1 font-mono text-xs`,children:$})]}),Q&&H.hover&&(0,C.jsx)(`div`,{"aria-hidden":!0,className:`border-pencil pointer-events-none absolute rounded-sm border border-dashed`,style:{left:H.hover.x,top:H.hover.y,width:H.hover.width,height:H.hover.height}}),Q&&B&&H.select&&(0,C.jsx)(`div`,{"aria-hidden":!0,className:`border-pencil pointer-events-none absolute rounded-sm border-2`,style:{left:H.select.x,top:H.select.y,width:H.select.width,height:H.select.height}}),Q&&(0,C.jsxs)(`div`,{className:`pointer-events-none absolute inset-x-3 bottom-3 flex flex-wrap items-center gap-1.5`,children:[z.map(e=>(0,C.jsx)(u,{size:`sm`,variant:`outline`,className:`bg-card pointer-events-auto`,"data-testid":`scenery-camera`,onClick:()=>{U({type:`camera`,name:e})},children:e},e)),oe&&(0,C.jsxs)(u,{size:`sm`,variant:`outline`,className:`bg-card pointer-events-auto ml-auto`,"data-testid":`scenery-back`,onClick:()=>{U({type:`back`})},children:[(0,C.jsx)(te,{size:14}),f.back]})]}),Z&&B&&(0,C.jsxs)(`div`,{role:`dialog`,"aria-label":B.path.join(` › `),"data-testid":`scenery-card`,className:`bg-card animate-set-in shadow-overlay absolute z-10 flex items-start gap-2 rounded-lg border p-3`,style:{left:Z.left,top:Z.top,width:M.width},children:[(0,C.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,C.jsx)(`p`,{className:`truncate text-sm font-semibold`,children:B.path.join(` › `)}),(0,C.jsx)(`p`,{className:`text-lead text-xs`,children:f.size(A(B.size[0]),A(B.size[1]),A(B.size[2]))})]}),(0,C.jsxs)(u,{size:`sm`,variant:`ghost`,"data-testid":`scenery-zoom`,onClick:()=>{U({type:`frame`,path:B.path})},children:[(0,C.jsx)(ee,{size:14}),f.zoomIn]})]})]})}export{P as SceneryViewer,P as default,D as WORDS,k as cardPlace,A as metres};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{c as t,d as n,l as r,o as i,p as a,s as o,u as s,v as c}from"./react-Bk7NnOLX.js";import{Tt as l,bt as u,gt as d,t as f,vt as p,yt as m}from"./button-BVQH7zxz.js";import{A as h,B as g,I as _,P as v,Q as y,R as b,V as x,X as S,Y as C,at as w,et as T,f as E,h as D,j as O,m as k,o as ee,p as A,q as j,rt as M,tt as N,x as te}from"./snapshots-CTS2iez5.js";import{t as ne}from"./jsx-runtime-DePvh3-m.js";import{t as re}from"./createLucideIcon-REX213UO.js";import{n as P,t as ie}from"./progress-udl4pNsP.js";import{t as F}from"./switch-D5kPl2jO.js";import{i as ae,n as oe,r as se,t as ce}from"./hint-mQB8slJ2.js";import{A as I,D as L,O as R,f as le,j as z,k as B,nt as ue}from"./index-BGAXezRR.js";import{t as de}from"./surface-D9qJjJQL.js";var V={files:2e4,bytes:5368709120,redirects:2e3,headers:100},H={min:3,max:40},fe=new Set(`abuse.account.accounts.admin.administrator.allyhub.api.app.assets.auth.autoconfig.autodiscover.billing.blog.cdn.dashboard.dev.dns.docs.download.downloads.ftp.help.hostmaster.imap.login.mail.mta-sts.ns1.ns2.ops.pop.postmaster.preview.root.security.signin.smtp.staging.static.status.studio.support.test.webmaster.wpad.www`.split(`.`));function pe(e){if(e.length<H.min||e.length>H.max)return`length`;if(!/^[a-z0-9-]+$/u.test(e))return`characters`;if(e.startsWith(`-`)||e.endsWith(`-`))return`hyphenEnds`;if(e.includes(`--`))return`doubleHyphen`;if(fe.has(e))return`reserved`}var me={length:`An address is ${String(H.min)} to ${String(H.max)} characters.`,characters:`An address is lowercase letters, digits and hyphens.`,hyphenEnds:`An address neither starts nor ends with a hyphen.`,doubleHyphen:`An address does not have two hyphens in a row.`,reserved:`That address is reserved.`};function he(e){let t=pe(e);return t===void 0?void 0:me[t]}var ge=N().superRefine((e,t)=>{let n=he(e);n!==void 0&&t.addIssue({code:`custom`,message:n})}),_e=[200,301,302,303,307,308,404,410],ve=N().min(1).max(1024).regex(/^\/[^\s]*$/u,`A rule's path starts with /.`),ye=T({from:ve,to:N().min(1).max(2048).regex(/^(\/[^\s]*|https?:\/\/[^\s]+)$/u,`A rule goes to a path or an http(s) address.`),status:M(_e.map(e=>j(e))),force:x()}),be=new Set([`accept-ranges`,`connection`,`content-encoding`,`content-length`,`content-range`,`date`,`keep-alive`,`set-cookie`,`strict-transport-security`,`trailer`,`transfer-encoding`,`upgrade`,`x-content-type-options`]),xe=N().regex(/^[A-Za-z0-9-]+$/u).max(128).refine(e=>!be.has(e.toLowerCase()),`That header is the platform's.`),Se=T({for:ve,set:y(xe,N().max(2048))});T({format:j(1),files:y(k,A),redirects:g(ye).max(V.redirects),headers:g(Se).max(V.headers)});var Ce=[`upload`,`git`],we=T({kind:b(Ce),commit:N().min(1).max(64).optional(),digest:E.optional()}),U=S({id:N(),siteId:N(),source:S({...we.shape,kind:D(Ce)}),note:N().nullable(),files:C(),bytes:C(),createdBy:N(),createdAt:_(),live:x()}),W=S({id:N(),slug:N(),name:N(),url:w(),liveDeployment:N().nullable(),approved:x(),autoPublish:x(),indexing:x(),createdAt:_()});T({slug:ge,name:N().min(1).max(255)}),S({sites:g(W),domain:N(),hosting:x()});var Te=S({site:W,deployments:g(U)});T({manifest:E,source:we,note:N().max(500).optional()}),S({site:W,deployment:U}),T({deployment:N().min(1)}),S({site:W,live:x(),confirm:w().optional()}),T({autoPublish:x().optional(),indexing:x().optional()}),S({site:N(),organization:N(),deployment:N(),manifest:E,indexing:x()});var Ee=re(`settings-2`,[[`path`,{d:`M14 17H5`,key:`gfn3mx`}],[`path`,{d:`M19 7h-9`,key:`6i9tg`}],[`circle`,{cx:`17`,cy:`17`,r:`3`,key:`18b49y`}],[`circle`,{cx:`7`,cy:`7`,r:`3`,key:`dfmy0x`}]]),De=e=>e.state===`running`||e.state===`queued`;function G(e){if(e.state===`done`)return 1;if(!(e.total===void 0||e.total<=0))return Math.min(1,Math.max(0,e.completed/e.total))}var K=e(c(),1),q=ne(),J=T({item:h}),Oe=T({hosting:x(),detail:Te.optional(),elsewhere:x().optional(),changed:x().optional(),slug:N().optional(),domain:N().optional()}),Y={confirm:N().optional()},ke={"website/preview":v(J,T({url:N()}),`A website's address as its own dev server serves it, for a frame: its dependencies installed if it has none, then its website.json's dev command on a free port; it answers once the page does.`),"website/still":v(J.extend({width:C().int().positive().max(4096),height:C().int().positive().max(4096),scale:C().positive().max(4).default(1),hold:N().optional()}),T({image:T({mime:N(),data:N()})}),`A website's page as its own dev server serves it, drawn at a frame's size from its top: what Mark up lays over a website's frame where the window cannot read another origin's pixels.`),"website/hold":v(J.extend({width:C().int().positive().max(4096),height:C().int().positive().max(4096),scale:C().positive().max(4).default(1)}),T({hold:N()}),`A website's page opened at a frame's size and kept as it is while a person marks it: website/still and website/at draw and read it as it was, until website/release.`),"website/release":v(T({hold:N()}),T({}),`Lets a page held for notes go.`),"website/at":v(J.extend({width:C().int().positive().max(4096),height:C().int().positive().max(4096),points:g(T({x:C(),y:C()})).min(1).max(24),hold:N().optional()}),T({page:N(),elements:g(T({selector:N(),tag:N(),text:N()}))}),`What is at places of a website's page as its own dev server serves it, drawn at a frame's size from its top (as website/still draws it): what a person's mark on its frame is on.`),"website/status":v(J,Oe,`A website's hosted site, its versions, and whether what is here differs from what is live; where the server has no person's sign-in, not hosted.`),"website/publish":v(J.extend({slug:N().optional(),note:N().optional(),anew:x().optional()}),T({live:x(),url:N(),...Y}),"Builds a website, uploads it as a version and makes it live, for the person who pressed Publish. The first time, it waits for their yes in a browser (`confirm`, a page to open there)."),"website/live":v(J.extend({version:N().min(1)}),T({live:x(),...Y}),`Makes a version what the site serves, as the person asked.`),"website/settings":v(J.extend({autoPublish:x().optional(),indexing:x().optional()}),T({}),`Changes what the person controls of a site.`),"website/unpublish":v(J,T({}),`Takes a site offline; it keeps its address and versions.`),"website/remove":v(J,T({}),`Takes a site offline for good. Its address is never given to anyone else.`)},X=te(ke);function Z({className:e,...t}){return(0,q.jsx)(de,{className:d(`divide-y divide-rule`,e),...t})}function Q({icon:e,label:t,detail:n,children:r,className:i}){return(0,q.jsxs)(`div`,{"data-slot":`setting-row`,className:d(`flex items-center gap-4 px-4.5 py-4`,i),children:[e!==void 0&&(0,q.jsx)(`span`,{className:`-mr-1 flex-none`,children:e}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`div`,{className:`text-sm`,children:t}),n!==void 0&&(0,q.jsx)(`div`,{className:`mt-0.5 text-xs text-lead`,children:n})]}),r]})}function Ae({label:e,detail:t,children:n}){return(0,q.jsxs)(`label`,{"data-slot":`setting-row`,className:`flex items-center gap-4 px-4.5 py-4 transition-colors has-[[role=checkbox]:not(:disabled),[role=switch]:not(:disabled)]:hover:bg-hover`,children:[(0,q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,q.jsx)(`span`,{className:`block text-sm`,children:e}),t!==void 0&&(0,q.jsx)(`span`,{className:`mt-0.5 block text-xs text-lead`,children:t})]}),n]})}function je(e){let[n,r]=(0,K.useState)([]);return t(`jobs/changed`,({job:t,item:n})=>{n===e&&r(e=>[...e.filter(e=>e.id!==t.id),t])}),n}var Me=(e,t)=>e.findLast(e=>(t===void 0||e.what===t)&&De(e)),Ne=[[`year`,31536e6],[`month`,2592e6],[`week`,6048e5],[`day`,864e5],[`hour`,36e5],[`minute`,6e4]];function Pe(e,t,n=Date.now()){let r=new Intl.RelativeTimeFormat(t,{numeric:`auto`}),i=e-n;for(let[e,t]of Ne)if(Math.abs(i)>=t)return r.format(Math.round(i/t),e);return r.format(0,`minute`)}var $={content:`max-w-[min(28rem,calc(100%-2rem))]`,header:`text-left`,footer:`flex-row justify-end`},Fe=e=>e instanceof Error?e.message:String(e),Ie=(e,t)=>({message:Fe(e),...t!==void 0&&typeof e==`object`&&e&&e.code===O.conflict?{refused:t}:{}});function Le(e,t,n){let r=i(),[a,o]=(0,K.useState)(),[s,c]=(0,K.useState)(!1),[l,u]=(0,K.useState)(),[d,f]=(0,K.useState)(),p=(0,K.useCallback)(()=>X(r,`website/status`,{item:e}).then(e=>{o(e),e.detail?.site.liveDeployment!=null&&f(void 0)}),[r,e]);(0,K.useEffect)(()=>{let e=()=>{p().catch(()=>void 0)};e();let t=()=>{document.visibilityState===`visible`&&e()};return window.addEventListener(`focus`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`focus`,e),document.removeEventListener(`visibilitychange`,t)}},[r,p,t]);let m=(0,K.useCallback)((e,t)=>{c(!0),u(void 0),e().then(p).catch(e=>{u(Ie(e,t))}).finally(()=>{c(!1)})},[p]),h=(0,K.useCallback)(e=>{r[`items/open`]({target:{type:`browser`,url:e}}).catch(()=>void 0)},[r]),g=(0,K.useCallback)(e=>{e.confirm!==void 0&&(f(e.confirm),h(e.confirm))},[h]),_={item:e};return{status:a,publishing:Me(n,`publish`),busy:s,failure:l,confirm:d,stopWaiting:()=>{f(void 0)},openAgain:()=>{d!==void 0&&h(d)},publish:(e={})=>{m(()=>X(r,`website/publish`,{..._,...e}).then(g),e.slug)},goLive:e=>{m(()=>X(r,`website/live`,{..._,version:e}).then(g))},settings:e=>{m(()=>X(r,`website/settings`,{..._,...e}))},unpublish:()=>{m(()=>X(r,`website/unpublish`,_))},remove:()=>{m(()=>X(r,`website/remove`,_))}}}function Re({words:e,from:t=`center`,children:n}){return(0,q.jsx)(ce,{disableHoverableContent:!0,children:(0,q.jsxs)(se,{children:[(0,q.jsx)(oe,{asChild:!0,children:(0,q.jsx)(`span`,{className:`flex min-w-0`,children:n})}),(0,q.jsx)(ae,{side:`top`,align:t,sideOffset:6,collisionPadding:8,children:e})]})})}var ze=e=>new URL(e).host;function Be({hosting:e,said:t,settings:n,onSettings:r}){let i=t.w.hosting,{status:a,busy:o,failure:s,confirm:c,publishing:l}=e,[u,d]=(0,K.useState)(!1),[p,m]=(0,K.useState)(),h=a?.detail?.site,g=h?.liveDeployment!=null,_=p??a?.slug??``,v=_===``?void 0:pe(_),y=!o&&_!==``&&v===void 0,b=v===`length`?i.slug.length(H.min,H.max):v===void 0?s?.refused===_?i.unavailable(`${_}.${a?.domain??``}`):void 0:i.slug[v];return a?.hosting===!0?(0,q.jsxs)(`div`,{className:`flex h-10 flex-none items-center gap-2 border-b border-rule bg-sheet px-3`,children:[g&&(0,q.jsxs)(`a`,{href:h.url,target:`_blank`,rel:`noreferrer`,className:`flex min-w-0 items-center gap-1.5 truncate font-mono text-xs text-lead hover:text-ink`,children:[(0,q.jsx)(ue,{"aria-hidden":!0,className:`size-3.5 flex-none`}),ze(h.url)]}),(0,q.jsx)(`span`,{className:`flex-1`}),s!==void 0&&!u&&(0,q.jsx)(`span`,{className:`min-w-0 truncate text-xs text-problem-text`,children:s.message}),a.elsewhere===!0&&(0,q.jsx)(`span`,{className:`text-xs whitespace-nowrap text-lead`,children:i.elsewhere}),g&&(0,q.jsx)(`span`,{className:`text-xs whitespace-nowrap text-lead`,children:a.changed===!0?i.unpublished:i.live}),(0,q.jsx)(Re,{words:n?i.preview:i.settings,from:`end`,children:(0,q.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":n?i.preview:i.settings,"aria-pressed":n,disabled:h===void 0,onClick:r,children:(0,q.jsx)(Ee,{"aria-hidden":!0})})}),(0,q.jsxs)(f,{size:`xs`,disabled:o,onClick:()=>{h===void 0?d(!0):e.publish()},children:[l!==void 0&&(0,q.jsx)(P,{value:G(l)}),o?i.publishing:g?i.update:i.publish]}),(0,q.jsx)(L,{open:u&&c===void 0&&h===void 0,onOpenChange:d,children:(0,q.jsxs)(R,{className:$.content,children:[(0,q.jsx)(I,{className:$.header,children:(0,q.jsx)(z,{className:`font-serif`,children:i.first})}),(0,q.jsxs)(`form`,{className:`contents`,onSubmit:t=>{t.preventDefault(),y&&e.publish({slug:_,...a.elsewhere===!0?{anew:!0}:{}})},children:[(0,q.jsxs)(`div`,{className:`flex flex-col gap-1.5`,children:[(0,q.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(le,{"aria-label":i.address,"aria-invalid":b!==void 0,"aria-describedby":`site-address-why`,value:_,onChange:e=>{m(e.target.value.toLowerCase())},className:`font-mono`}),(0,q.jsxs)(`span`,{className:`font-mono text-sm text-lead`,children:[`.`,a.domain]})]}),(0,q.jsx)(`p`,{id:`site-address-why`,role:`status`,className:`min-h-5 text-sm text-problem-text`,children:b})]}),(0,q.jsx)(`p`,{className:`text-sm text-lead`,children:a.elsewhere===!0?i.elsewhereNote:i.firstNote}),s!==void 0&&s.refused===void 0&&(0,q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm text-problem-text`,children:[i.buildFailed,(0,q.jsx)(f,{type:`button`,size:`xs`,variant:`ghost`,className:`text-lead`,onClick:()=>{navigator.clipboard.writeText(s.message).catch(()=>void 0)},children:t.w.copy})]}),(0,q.jsx)(B,{className:$.footer,children:(0,q.jsx)(f,{type:`submit`,disabled:!y,children:o?i.publishing:i.publish})})]})]})}),(0,q.jsx)(L,{open:c!==void 0&&!g,onOpenChange:t=>{t||e.stopWaiting()},children:(0,q.jsxs)(R,{className:$.content,children:[(0,q.jsx)(I,{className:$.header,children:(0,q.jsx)(z,{className:`font-serif`,children:i.askTitle})}),(0,q.jsx)(`p`,{className:`text-sm text-lead`,children:i.ask}),(0,q.jsxs)(B,{className:$.footer,children:[(0,q.jsx)(f,{variant:`outline`,onClick:e.stopWaiting,children:t.w.cancel}),(0,q.jsx)(f,{autoFocus:!0,onClick:e.openAgain,children:i.openAgain})]})]})})]}):null}function Ve({hosting:e,said:t}){let n=t.w.hosting,{tag:r}=t,[i,a]=(0,K.useState)(!1),{status:o,busy:s}=e,c=o?.detail;if(c===void 0)return null;let{site:l,deployments:u}=c,d=ze(l.url),p=u.find(e=>e.live)?.createdAt,m=e=>p!==void 0&&Date.parse(e)<Date.parse(p);return(0,q.jsxs)(`div`,{className:`absolute inset-0 overflow-y-auto bg-sheet`,children:[(0,q.jsxs)(`div`,{className:`mx-auto flex w-full max-w-2xl flex-col gap-6 px-6 py-8`,children:[(0,q.jsxs)(Z,{children:[(0,q.jsx)(Q,{label:n.address,children:(0,q.jsx)(`a`,{href:l.url,target:`_blank`,rel:`noreferrer`,className:`font-mono text-sm hover:underline`,children:d})}),(0,q.jsx)(Ae,{label:n.agent,children:(0,q.jsx)(F,{checked:l.autoPublish,disabled:s,onCheckedChange:t=>{e.settings({autoPublish:t})}})}),(0,q.jsx)(Ae,{label:n.search,children:(0,q.jsx)(F,{checked:l.indexing,disabled:s,onCheckedChange:t=>{e.settings({indexing:t})}})})]}),(0,q.jsxs)(`section`,{children:[(0,q.jsx)(`h2`,{className:`mb-2 text-sm font-medium`,children:n.versions}),(0,q.jsx)(Z,{children:u.map(t=>(0,q.jsx)(Q,{label:t.note??Pe(Date.parse(t.createdAt),r),detail:t.note===null?void 0:Pe(Date.parse(t.createdAt),r),children:t.live?(0,q.jsx)(`span`,{className:`text-xs text-lead`,children:n.live}):(0,q.jsx)(f,{variant:`outline`,size:`xs`,disabled:s,onClick:()=>{e.goLive(t.id)},children:m(t.createdAt)?n.rollBack:n.makeLive})},t.id))})]}),(0,q.jsxs)(Z,{children:[l.liveDeployment!==null&&(0,q.jsx)(Q,{label:n.unpublishNote,children:(0,q.jsx)(f,{variant:`outline`,size:`xs`,disabled:s,onClick:e.unpublish,children:n.unpublish})}),(0,q.jsx)(Q,{label:n.removeNote(d),children:(0,q.jsx)(f,{variant:`outline`,size:`xs`,disabled:s,onClick:()=>{a(!0)},children:n.remove})})]})]}),(0,q.jsx)(L,{open:i,onOpenChange:a,children:(0,q.jsxs)(R,{className:$.content,children:[(0,q.jsx)(I,{className:$.header,children:(0,q.jsx)(z,{className:`font-serif`,children:n.remove})}),(0,q.jsx)(`p`,{className:`text-sm text-lead`,children:n.removeNote(d)}),(0,q.jsxs)(B,{className:$.footer,children:[(0,q.jsx)(f,{variant:`outline`,onClick:()=>{a(!1)},children:t.w.cancel}),(0,q.jsx)(f,{variant:`destructive`,onClick:()=>{a(!1),e.remove()},children:n.remove})]})]})})]})}var He=m({en:{starting:`Starting the website…`,startingJob:e=>`Starting ${e}`,failed:`The website did not start`,copy:`Copy details`,retry:`Retry`,cancel:`Cancel`,asleep:`A website's preview needs the agent awake.`,edit:`Edit`,hosting:{buildFailed:`The website could not be built.`,publish:`Publish`,update:`Update`,settings:`Website settings`,preview:`Preview`,unpublished:`Unpublished changes`,address:`Address`,first:`Publish this website`,firstNote:`Anyone with the address can see it.`,publishing:`Publishing…`,askTitle:`Confirm in your browser`,ask:`A site's first publish is confirmed in your browser.`,openAgain:`Open again`,versions:`Versions`,live:`Live`,rollBack:`Roll back`,makeLive:`Make live`,elsewhere:`Published by another team`,elsewhereNote:`This folder names another team’s site. Publishing makes a new one of yours; theirs stays as it is. Anyone with the address can see it.`,slug:{length:(e,t)=>`An address is ${String(e)} to ${String(t)} characters.`,characters:`Use lowercase letters, digits and hyphens.`,hyphenEnds:`An address can’t start or end with a hyphen.`,doubleHyphen:`An address can’t have two hyphens in a row.`,reserved:`That address is reserved.`},unavailable:e=>`${e} is not available.`,agent:`Let the agent update the live site`,search:`Show in search engines`,unpublish:`Unpublish`,unpublishNote:`Takes the site offline within a minute. It keeps its address and versions.`,remove:`Delete site`,removeNote:e=>`${e} goes offline for good, and its address can never be used again.`}},"zh-cn":{starting:`正在启动网站…`,startingJob:e=>`正在启动 ${e}`,failed:`网站没有启动`,copy:`复制详情`,retry:`重试`,cancel:`取消`,asleep:`网站预览需要 Agent 处于唤醒状态。`,edit:`编辑`,hosting:{buildFailed:`网站没能构建成功。`,publish:`发布`,update:`更新`,settings:`网站设置`,preview:`预览`,unpublished:`有未发布的更改`,address:`地址`,first:`发布这个网站`,firstNote:`知道地址的人都能看到。`,publishing:`正在发布…`,askTitle:`请在浏览器中确认`,ask:`网站第一次发布需要在浏览器中确认。`,openAgain:`再次打开`,versions:`版本`,live:`线上`,rollBack:`回滚`,makeLive:`设为上线`,elsewhere:`由其他团队发布`,elsewhereNote:`这个文件夹指向另一个团队的网站。发布会为你新建一个网站,他们的保持不变。知道地址的人都能看到。`,slug:{length:(e,t)=>`地址为 ${String(e)} 到 ${String(t)} 个字符。`,characters:`只能用小写字母、数字和连字符。`,hyphenEnds:`地址不能以连字符开头或结尾。`,doubleHyphen:`地址里不能有两个连续的连字符。`,reserved:`这个地址是保留的。`},unavailable:e=>`${e} 不可用。`,agent:`允许 agent 更新线上网站`,search:`在搜索引擎中显示`,unpublish:`取消发布`,unpublishNote:`一分钟内让网站下线,地址和版本都会保留。`,remove:`删除网站`,removeNote:e=>`${e} 将永久下线,这个地址也不能再使用。`}},"zh-tw":{starting:`正在啟動網站…`,startingJob:e=>`正在啟動 ${e}`,failed:`網站沒有啟動`,copy:`複製詳情`,retry:`重試`,cancel:`取消`,asleep:`網站預覽需要 Agent 處於喚醒狀態。`,edit:`編輯`,hosting:{buildFailed:`網站無法建置。`,publish:`發布`,update:`更新`,settings:`網站設定`,preview:`預覽`,unpublished:`有未發布的變更`,address:`網址`,first:`發布這個網站`,firstNote:`知道網址的人都能看到。`,publishing:`正在發布…`,askTitle:`請在瀏覽器中確認`,ask:`網站第一次發布需要在瀏覽器中確認。`,openAgain:`再次開啟`,versions:`版本`,live:`線上`,rollBack:`復原`,makeLive:`設為上線`,elsewhere:`由其他團隊發布`,elsewhereNote:`這個資料夾指向另一個團隊的網站。發布會為你新建一個網站,他們的保持不變。知道網址的人都能看到。`,slug:{length:(e,t)=>`網址為 ${String(e)} 到 ${String(t)} 個字元。`,characters:`只能用小寫字母、數字和連字號。`,hyphenEnds:`網址不能以連字號開頭或結尾。`,doubleHyphen:`網址裡不能有兩個連續的連字號。`,reserved:`這個網址是保留的。`},unavailable:e=>`${e} 無法使用。`,agent:`允許 agent 更新線上網站`,search:`在搜尋引擎中顯示`,unpublish:`取消發布`,unpublishNote:`一分鐘內讓網站下線,網址和版本都會保留。`,remove:`刪除網站`,removeNote:e=>`${e} 將永久下線,這個網址也不能再使用。`}},ja:{starting:`ウェブサイトを起動しています…`,startingJob:e=>`${e} を起動しています`,failed:`ウェブサイトを起動できませんでした`,copy:`詳細をコピー`,retry:`再試行`,cancel:`キャンセル`,asleep:`ウェブサイトのプレビューにはエージェントが起きている必要があります。`,edit:`編集`,hosting:{buildFailed:`Web サイトをビルドできませんでした。`,publish:`公開`,update:`更新`,settings:`ウェブサイトの設定`,preview:`プレビュー`,unpublished:`未公開の変更`,address:`アドレス`,first:`このウェブサイトを公開`,firstNote:`アドレスを知っている人は誰でも見られます。`,publishing:`公開しています…`,askTitle:`ブラウザで確認してください`,ask:`サイトの最初の公開はブラウザで確認します。`,openAgain:`もう一度開く`,versions:`バージョン`,live:`公開中`,rollBack:`戻す`,makeLive:`公開する`,elsewhere:`別のチームが公開`,elsewhereNote:`このフォルダーは別のチームのサイトを指しています。公開するとあなたの新しいサイトができ、相手のサイトはそのままです。アドレスを知っている人は誰でも見られます。`,slug:{length:(e,t)=>`アドレスは ${String(e)}〜${String(t)} 文字です。`,characters:`小文字、数字、ハイフンだけが使えます。`,hyphenEnds:`アドレスの最初と最後にハイフンは使えません。`,doubleHyphen:`ハイフンを2つ続けては使えません。`,reserved:`このアドレスは予約されています。`},unavailable:e=>`${e} は使えません。`,agent:`公開中のサイトをエージェントに更新させる`,search:`検索エンジンに表示`,unpublish:`非公開にする`,unpublishNote:`1 分以内にサイトを非公開にします。アドレスとバージョンは残ります。`,remove:`サイトを削除`,removeNote:e=>`${e} は完全にオフラインになり、このアドレスは二度と使えません。`}},ko:{starting:`웹사이트를 시작하는 중…`,startingJob:e=>`${e} 시작하는 중`,failed:`웹사이트가 시작되지 않았습니다`,copy:`세부 정보 복사`,retry:`다시 시도`,cancel:`취소`,asleep:`웹사이트 미리보기는 에이전트가 깨어 있어야 합니다.`,edit:`편집`,hosting:{buildFailed:`웹사이트를 빌드하지 못했습니다.`,publish:`게시`,update:`업데이트`,settings:`웹사이트 설정`,preview:`미리 보기`,unpublished:`게시되지 않은 변경 사항`,address:`주소`,first:`이 웹사이트 게시`,firstNote:`주소를 아는 사람은 누구나 볼 수 있습니다.`,publishing:`게시 중…`,askTitle:`브라우저에서 확인하세요`,ask:`사이트의 첫 게시는 브라우저에서 확인합니다.`,openAgain:`다시 열기`,versions:`버전`,live:`게시 중`,rollBack:`되돌리기`,makeLive:`게시하기`,elsewhere:`다른 팀이 게시함`,elsewhereNote:`이 폴더는 다른 팀의 사이트를 가리킵니다. 게시하면 내 사이트가 새로 만들어지고, 그 팀의 사이트는 그대로 남습니다. 주소를 아는 사람은 누구나 볼 수 있습니다.`,slug:{length:(e,t)=>`주소는 ${String(e)}~${String(t)}자입니다.`,characters:`소문자, 숫자, 하이픈만 쓸 수 있습니다.`,hyphenEnds:`주소는 하이픈으로 시작하거나 끝날 수 없습니다.`,doubleHyphen:`하이픈을 두 개 연달아 쓸 수 없습니다.`,reserved:`예약된 주소입니다.`},unavailable:e=>`${e}은(는) 사용할 수 없습니다.`,agent:`에이전트가 게시된 사이트를 업데이트하도록 허용`,search:`검색 엔진에 표시`,unpublish:`게시 취소`,unpublishNote:`1분 안에 사이트를 내립니다. 주소와 버전은 그대로 남습니다.`,remove:`사이트 삭제`,removeNote:e=>`${e} 영구히 오프라인이 되며, 이 주소는 다시 사용할 수 없습니다.`}},es:{starting:`Iniciando el sitio web…`,startingJob:e=>`Iniciando ${e}`,failed:`El sitio web no se inició`,copy:`Copiar detalles`,retry:`Reintentar`,cancel:`Cancelar`,asleep:`La vista previa de un sitio web necesita al agente despierto.`,edit:`Editar`,hosting:{buildFailed:`No se pudo crear el sitio web.`,publish:`Publicar`,update:`Actualizar`,settings:`Ajustes del sitio web`,preview:`Vista previa`,unpublished:`Cambios sin publicar`,address:`Dirección`,first:`Publicar este sitio web`,firstNote:`Cualquiera con la dirección puede verlo.`,publishing:`Publicando…`,askTitle:`Confirma en tu navegador`,ask:`La primera publicación de un sitio se confirma en tu navegador.`,openAgain:`Abrir de nuevo`,versions:`Versiones`,live:`En línea`,rollBack:`Restaurar`,makeLive:`Poner en línea`,elsewhere:`Publicado por otro equipo`,elsewhereNote:`Esta carpeta es del sitio de otro equipo. Al publicar se crea uno nuevo tuyo; el suyo queda como está. Cualquiera con la dirección puede verlo.`,slug:{length:(e,t)=>`Una dirección tiene de ${String(e)} a ${String(t)} caracteres.`,characters:`Usa minúsculas, números y guiones.`,hyphenEnds:`Una dirección no empieza ni termina con guion.`,doubleHyphen:`Una dirección no lleva dos guiones seguidos.`,reserved:`Esa dirección está reservada.`},unavailable:e=>`${e} no está disponible.`,agent:`Dejar que el agente actualice el sitio publicado`,search:`Mostrar en buscadores`,unpublish:`Retirar`,unpublishNote:`Desconecta el sitio en menos de un minuto. Conserva su dirección y sus versiones.`,remove:`Eliminar sitio`,removeNote:e=>`${e} deja de estar en línea para siempre, y la dirección no podrá volver a usarse.`}},fr:{starting:`Démarrage du site web…`,startingJob:e=>`Démarrage de ${e}`,failed:`Le site web n’a pas démarré`,copy:`Copier les détails`,retry:`Réessayer`,cancel:`Annuler`,asleep:`L'aperçu d'un site web nécessite que l'agent soit éveillé.`,edit:`Modifier`,hosting:{buildFailed:`Le site n’a pas pu être construit.`,publish:`Publier`,update:`Mettre à jour`,settings:`Réglages du site web`,preview:`Aperçu`,unpublished:`Modifications non publiées`,address:`Adresse`,first:`Publier ce site web`,firstNote:`Toute personne ayant l'adresse peut le voir.`,publishing:`Publication…`,askTitle:`Confirmez dans votre navigateur`,ask:`La première publication d'un site se confirme dans votre navigateur.`,openAgain:`Rouvrir`,versions:`Versions`,live:`En ligne`,rollBack:`Restaurer`,makeLive:`Mettre en ligne`,elsewhere:`Publié par une autre équipe`,elsewhereNote:`Ce dossier désigne le site d’une autre équipe. Publier en crée un nouveau à vous ; le leur reste tel quel. Toute personne ayant l’adresse peut le voir.`,slug:{length:(e,t)=>`Une adresse compte de ${String(e)} à ${String(t)} caractères.`,characters:`Utilisez des minuscules, des chiffres et des tirets.`,hyphenEnds:`Une adresse ne commence ni ne finit par un tiret.`,doubleHyphen:`Une adresse n’a pas deux tirets d’affilée.`,reserved:`Cette adresse est réservée.`},unavailable:e=>`${e} n’est pas disponible.`,agent:`Laisser l'agent mettre à jour le site en ligne`,search:`Afficher dans les moteurs de recherche`,unpublish:`Dépublier`,unpublishNote:`Met le site hors ligne en moins d’une minute. Il garde son adresse et ses versions.`,remove:`Supprimer le site`,removeNote:e=>`${e} est mis hors ligne définitivement, et l'adresse ne pourra plus jamais servir.`}},de:{starting:`Website wird gestartet…`,startingJob:e=>`${e} wird gestartet`,failed:`Die Website wurde nicht gestartet`,copy:`Details kopieren`,retry:`Erneut versuchen`,cancel:`Abbrechen`,asleep:`Die Vorschau einer Website braucht einen wachen Agenten.`,edit:`Bearbeiten`,hosting:{buildFailed:`Die Website konnte nicht erstellt werden.`,publish:`Veröffentlichen`,update:`Aktualisieren`,settings:`Website-Einstellungen`,preview:`Vorschau`,unpublished:`Unveröffentlichte Änderungen`,address:`Adresse`,first:`Diese Website veröffentlichen`,firstNote:`Jeder mit der Adresse kann sie sehen.`,publishing:`Wird veröffentlicht…`,askTitle:`Im Browser bestätigen`,ask:`Die erste Veröffentlichung einer Website wird im Browser bestätigt.`,openAgain:`Erneut öffnen`,versions:`Versionen`,live:`Live`,rollBack:`Zurücksetzen`,makeLive:`Live schalten`,elsewhere:`Von einem anderen Team veröffentlicht`,elsewhereNote:`Dieser Ordner gehört zur Website eines anderen Teams. Beim Veröffentlichen entsteht eine neue von dir; ihre bleibt, wie sie ist. Jeder mit der Adresse kann sie sehen.`,slug:{length:(e,t)=>`Eine Adresse hat ${String(e)} bis ${String(t)} Zeichen.`,characters:`Nur Kleinbuchstaben, Ziffern und Bindestriche.`,hyphenEnds:`Eine Adresse beginnt und endet nicht mit einem Bindestrich.`,doubleHyphen:`Eine Adresse hat keine zwei Bindestriche hintereinander.`,reserved:`Diese Adresse ist reserviert.`},unavailable:e=>`${e} ist nicht verfügbar.`,agent:`Den Agenten die Live-Website aktualisieren lassen`,search:`In Suchmaschinen anzeigen`,unpublish:`Offline nehmen`,unpublishNote:`Nimmt die Website innerhalb einer Minute offline. Adresse und Versionen bleiben.`,remove:`Website löschen`,removeNote:e=>`${e} geht endgültig offline, und die Adresse kann nie wieder verwendet werden.`}},pt:{starting:`Iniciando o site…`,startingJob:e=>`Iniciando ${e}`,failed:`O site não foi iniciado`,copy:`Copiar detalhes`,retry:`Tentar de novo`,cancel:`Cancelar`,asleep:`A prévia de um site precisa do agente acordado.`,edit:`Editar`,hosting:{buildFailed:`Não foi possível montar o site.`,publish:`Publicar`,update:`Atualizar`,settings:`Configurações do site`,preview:`Pré-visualização`,unpublished:`Alterações não publicadas`,address:`Endereço`,first:`Publicar este site`,firstNote:`Qualquer pessoa com o endereço pode vê-lo.`,publishing:`Publicando…`,askTitle:`Confirme no navegador`,ask:`A primeira publicação de um site é confirmada no navegador.`,openAgain:`Abrir de novo`,versions:`Versões`,live:`No ar`,rollBack:`Restaurar`,makeLive:`Pôr no ar`,elsewhere:`Publicado por outra equipe`,elsewhereNote:`Esta pasta aponta para o site de outra equipe. Publicar cria um novo seu; o deles continua como está. Qualquer pessoa com o endereço pode vê-lo.`,slug:{length:(e,t)=>`Um endereço tem de ${String(e)} a ${String(t)} caracteres.`,characters:`Use letras minúsculas, números e hifens.`,hyphenEnds:`Um endereço não começa nem termina com hífen.`,doubleHyphen:`Um endereço não tem dois hifens seguidos.`,reserved:`Esse endereço é reservado.`},unavailable:e=>`${e} não está disponível.`,agent:`Deixar o agente atualizar o site no ar`,search:`Mostrar em buscadores`,unpublish:`Tirar do ar`,unpublishNote:`Deixa o site offline em até um minuto. Ele mantém o endereço e as versões.`,remove:`Excluir site`,removeNote:e=>`${e} sai do ar para sempre, e o endereço nunca mais poderá ser usado.`}}});function Ue({className:e}){let t=o();if(t===void 0)return null;let n=u(t.locale),{id:r,entry:i}=t.item;return(0,q.jsx)(Ke,{id:r,entry:i,said:{w:He.of(n),tag:p[n]},className:e},r)}function We(e){let[t,n]=(0,K.useState)(0);return r(e,()=>{n(e=>e+1)}),t}function Ge(e){try{let t=JSON.parse(e).dev;return typeof t!=`string`||t.trim()===``}catch{return!1}}function Ke({id:e,entry:r,said:o,className:c}){let u=i(),{w:p}=o,m=e.slice(e.lastIndexOf(`/`)+1),[h,g]=(0,K.useState)({at:`starting`}),[_,v]=(0,K.useState)(0),[y,b]=(0,K.useState)(!1),x=We(e),S=je(r),C=Le(e,x,S),w=h.at===`failed`?x:void 0,T=a(),E=h.at===`asleep`?T:void 0;(0,K.useEffect)(()=>{let t=!0;return X(u,`website/preview`,{item:e}).then(({url:e})=>{t&&g({at:`ready`,url:e})},e=>{t&&g(ee(e)?{at:`asleep`}:{at:`failed`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!1}},[u,e,_,w,E]);let[D,O]=(0,K.useState)(!1);(0,K.useEffect)(()=>{let e=!0;return u[`files/read`]({path:r}).then(({text:t})=>{e&&O(Ge(t))},()=>void 0),()=>{e=!1}},[u,r,x]);let k=h.at===`failed`;t(`jobs/changed`,({job:e,item:t})=>{k&&t===r&&e.what===`start`&&e.state===`running`&&(g({at:`starting`}),v(e=>e+1))});let A=(0,K.useRef)(null);n({hold:()=>Promise.resolve({key:`website@${e}@${crypto.randomUUID()}`,what:m,source:{path:r}}),locate:()=>Promise.resolve({elements:[]})});let j=()=>{let e=A.current?.getBoundingClientRect();return e&&e.width>0&&e.height>0?{x:e.x,y:e.y,width:e.width,height:e.height}:void 0},M=(0,K.useRef)(void 0),N=()=>M.current??Promise.resolve(void 0);return s({element:()=>A.current,hold:()=>{let t=j();return M.current=t?X(u,`website/hold`,{item:e,width:Math.round(t.width),height:Math.round(t.height),scale:Math.min(4,Math.max(1,window.devicePixelRatio))}).then(e=>e.hold,()=>void 0):Promise.resolve(void 0),M.current.then(()=>void 0)},release:()=>{let e=M.current;M.current=void 0,e?.then(e=>e===void 0?void 0:X(u,`website/release`,{hold:e}).catch(()=>void 0))},pictures:async()=>{let t=j();if(!t)return[];let n=await N(),{image:r}=await X(u,`website/still`,{item:e,width:Math.round(t.width),height:Math.round(t.height),scale:Math.min(4,Math.max(1,window.devicePixelRatio)),...n===void 0?{}:{hold:n}});return[{...r,rect:t}]},locate:async t=>{let n=j(),i=n?l(t).map(e=>({x:e.x-n.x,y:e.y-n.y})).filter(e=>e.x>=0&&e.y>=0&&e.x<=n.width&&e.y<=n.height):[],a=await N(),o=n&&i.length>0?await X(u,`website/at`,{item:e,width:Math.round(n.width),height:Math.round(n.height),points:i,...a===void 0?{}:{hold:a}}).catch(()=>void 0):void 0,s=o?.page??``;return{elements:o&&o.elements.length>0?o.elements.map(e=>({name:`the element ${e.selector} of the page ${s}`,source:{path:r},...e.text===``?{}:{text:e.text}})):[{name:`the page of the website ${m}`,source:{path:r}}],where:`on the website ${m}${s===``?``:` at ${s}`}, as its dev server serves it`}}}),h.at===`asleep`?(0,q.jsxs)(`div`,{className:d(`absolute inset-0 flex flex-col items-center justify-center gap-3 p-6`,c),children:[(0,q.jsx)(`p`,{className:`text-sm text-lead`,children:p.asleep}),(0,q.jsx)(f,{size:`xs`,onClick:()=>{u[`edit/request`]({}).catch(()=>void 0)},children:p.edit})]}):(0,q.jsxs)(`div`,{className:d(`absolute inset-0 flex flex-col`,c),children:[(0,q.jsx)(Be,{hosting:C,said:o,settings:y,onSettings:()=>{b(e=>!e)}}),(0,q.jsxs)(`div`,{className:`relative min-h-0 flex-1`,children:[h.at===`ready`&&(0,q.jsx)(`iframe`,{ref:A,title:m,src:h.url,"data-testid":`site`,sandbox:`allow-scripts allow-same-origin allow-forms allow-popups`,className:`absolute inset-0 size-full border-0 bg-page`},D?x:void 0),h.at===`starting`&&(0,q.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-lead`,children:(0,q.jsx)(qe,{job:Me(S,`start`),name:m,w:p})}),h.at===`failed`&&(0,q.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 p-6`,children:[(0,q.jsx)(`p`,{className:`text-sm text-ink`,children:p.failed}),(0,q.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,q.jsx)(f,{size:`xs`,variant:`ghost`,className:`text-lead`,onClick:()=>{navigator.clipboard.writeText(h.message).catch(()=>void 0)},children:p.copy}),(0,q.jsx)(f,{size:`xs`,onClick:()=>{g({at:`starting`}),v(e=>e+1)},children:p.retry})]})]}),y&&C.status?.detail!==void 0&&(0,q.jsx)(Ve,{hosting:C,said:o})]})]})}function qe({job:e,name:t,w:n}){if(e===void 0)return(0,q.jsx)(`span`,{className:`animate-pulse`,children:n.starting});let r=G(e);return(0,q.jsxs)(`span`,{role:`status`,className:`flex flex-col items-center gap-2`,children:[(0,q.jsxs)(`span`,{className:`flex items-center gap-2`,children:[r===void 0&&(0,q.jsx)(P,{className:`text-ink`}),n.startingJob(e.name??t)]}),r!==void 0&&(0,q.jsx)(ie,{value:r*100,className:`h-1 w-48`})]})}export{He as WORDS,Ue as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{_ as t,d as n,o as r,s as i,u as a,v as o}from"./react-Bk7NnOLX.js";import{Dt as s,Et as c,Ot as l,gt as u,yt as d}from"./button-BVQH7zxz.js";import{t as f}from"./jsx-runtime-DePvh3-m.js";import{t as p}from"./audio-lines-1s1eRs4Q.js";import{i as m}from"./dist-D7ur8721.js";import{t as h}from"./file-exclamation-point-C_fX4fpI.js";import{q as g}from"./index-BGAXezRR.js";import{t as _}from"./surface-D9qJjJQL.js";var v=e(o(),1),y=f(),b=d({en:{loading:`Opening the file…`,couldNotOpen:e=>`The file could not be opened: ${e}`,page:(e,t)=>`Page ${String(e)} of ${String(t)}`},"zh-cn":{loading:`正在打开文件…`,couldNotOpen:e=>`无法打开文件:${e}`,page:(e,t)=>`第 ${String(e)} 页,共 ${String(t)} 页`},"zh-tw":{loading:`正在開啟檔案…`,couldNotOpen:e=>`無法開啟檔案:${e}`,page:(e,t)=>`第 ${String(e)} 頁,共 ${String(t)} 頁`},ja:{loading:`ファイルを開いています…`,couldNotOpen:e=>`ファイルを開けませんでした:${e}`,page:(e,t)=>`${String(t)} ページ中 ${String(e)} ページ`},ko:{loading:`파일을 여는 중…`,couldNotOpen:e=>`파일을 열 수 없습니다: ${e}`,page:(e,t)=>`${String(t)}페이지 중 ${String(e)}페이지`},es:{loading:`Abriendo el archivo…`,couldNotOpen:e=>`No se pudo abrir el archivo: ${e}`,page:(e,t)=>`Página ${String(e)} de ${String(t)}`},fr:{loading:`Ouverture du fichier…`,couldNotOpen:e=>`Impossible d’ouvrir le fichier : ${e}`,page:(e,t)=>`Page ${String(e)} sur ${String(t)}`},de:{loading:`Datei wird geöffnet …`,couldNotOpen:e=>`Die Datei konnte nicht geöffnet werden: ${e}`,page:(e,t)=>`Seite ${String(e)} von ${String(t)}`},pt:{loading:`Abrindo o arquivo…`,couldNotOpen:e=>`Não foi possível abrir o arquivo: ${e}`,page:(e,t)=>`Página ${String(e)} de ${String(t)}`}}),x={png:`picture`,jpg:`picture`,jpeg:`picture`,gif:`picture`,webp:`picture`,avif:`picture`,bmp:`picture`,ico:`picture`,svg:`picture`,mp4:`video`,m4v:`video`,mov:`video`,webm:`video`,mp3:`sound`,wav:`sound`,m4a:`sound`,aac:`sound`,ogg:`sound`,oga:`sound`,opus:`sound`,flac:`sound`,pdf:`pdf`},S=Object.keys(x);function C(e){let t=e.slice(e.lastIndexOf(`/`)+1),n=t.lastIndexOf(`.`);return n<=0?void 0:x[t.slice(n+1).toLowerCase()]}var w=300,T=1200,E=16;async function D(e){let[t,n]=await Promise.all([g(()=>import(`./pdf-BHx8b9rl.js`),[],import.meta.url),g(()=>import(`./pdf.worker.min-DI4FfYVf.js`),[],import.meta.url)]);t.GlobalWorkerOptions.workerSrc=n.default;let r=t.getDocument({url:e});return{pdf:await r.promise,close:()=>r.destroy()}}var O=e=>{let t=e.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}};function k({pdf:e,number:t,width:n,drawing:r}){let i=(0,v.useRef)(null),[a,o]=(0,v.useState)(),[s,c]=(0,v.useState)(!1);return(0,v.useEffect)(()=>{let r=!0;return e.getPage(t).then(e=>{if(!r)return;let t=e.getViewport({scale:1});o({width:n,height:n*t.height/t.width})}),()=>{r=!1}},[e,t,n]),(0,v.useEffect)(()=>{let e=i.current;if(!e||s)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&c(!0)},{rootMargin:`800px 0px`});return t.observe(e),()=>{t.disconnect()}},[s,a]),(0,v.useEffect)(()=>{let n=i.current;if(!n||!s||!a)return;let o;return r((async()=>{let r=await e.getPage(t),i=window.devicePixelRatio||1,s=r.getViewport({scale:1}),c=r.getViewport({scale:a.width/s.width*i});n.width=Math.round(c.width),n.height=Math.round(c.height);let l=r.render({canvas:n,viewport:c});o=l,await l.promise.catch(()=>void 0)})()),()=>{o?.cancel()}},[e,t,s,a,r]),(0,y.jsx)(`canvas`,{ref:i,"data-page":t,"data-testid":`media-viewer-pdf-page`,className:`border-rule border bg-white`,style:{width:a?.width??n,height:a?.height??n*1.3}})}function A({path:e,url:t,version:r}){let a=b.of(i()?.locale),o=(0,v.useRef)(null),[s,d]=(0,v.useState)(),[f,p]=(0,v.useState)(),[m,h]=(0,v.useState)(0),g=(0,v.useRef)(new Set),_=(0,v.useCallback)(e=>{g.current.add(e),e.finally(()=>g.current.delete(e))},[]);(0,v.useEffect)(()=>{let e=!0,n;return D(t).then(t=>{e?(n=t.close,d(t.pdf)):t.close()},t=>{e&&p(t instanceof Error?t.message:String(t))}),()=>{e=!1,n?.()}},[t]),(0,v.useEffect)(()=>{let e=o.current;if(!e)return;let t=new ResizeObserver(()=>{h(Math.max(0,Math.min(e.clientWidth-32,960)))});return t.observe(e),()=>{t.disconnect()}},[]);let x=()=>[...o.current?.querySelectorAll(`canvas[data-page]`)??[]],S=e=>`page ${e.dataset.page??`?`}`;n({hold:async()=>(await Promise.all([...g.current]),{key:`${e}@${String(r)}`,what:`The PDF ${e}`,source:{path:e}}),locate:t=>{let n=x().filter(e=>l(t,O(e)));return Promise.resolve({elements:n.map(t=>({name:`${S(t)} of the PDF ${e}`,source:{path:e}})),...n.length===0?{}:{where:`on ${n.map(S).join(`, `)}`}})},pick:t=>{let n=x().find(e=>{let n=O(e);return t.x>=n.x&&t.x<=n.x+n.width&&t.y>=n.y&&t.y<=n.y+n.height});return Promise.resolve(n&&{element:{name:`${S(n)} of the PDF ${e}`,source:{path:e}},outline:c(O(n)),where:`on ${S(n)}`})}});let C=Math.min(s?.numPages??0,w),[A,j]=(0,v.useState)(),M=(0,v.useRef)(void 0);return(0,v.useEffect)(()=>()=>{clearTimeout(M.current)},[]),(0,y.jsxs)(`div`,{ref:o,onScroll:()=>{let e=o.current;if(!e)return;let t=e.getBoundingClientRect().top+e.clientHeight/2,n=1;for(let e of x())e.getBoundingClientRect().top<=t&&(n=Number(e.dataset.page));j({at:n,live:!0}),clearTimeout(M.current),M.current=setTimeout(()=>{j(e=>e&&{...e,live:!1})},T)},className:`size-full overflow-auto`,"data-testid":`media-viewer-pdf`,"data-state":f===void 0?s?`open`:`loading`:`error`,children:[(f!==void 0||!s)&&(0,y.jsx)(`p`,{className:`text-lead p-6 text-center text-sm`,children:f===void 0?a.loading:a.couldNotOpen(f)}),(0,y.jsx)(`div`,{className:`flex flex-col items-center`,style:{gap:E,padding:E},children:s&&m>0&&Array.from({length:C},(e,t)=>(0,y.jsx)(k,{pdf:s,number:t+1,width:m,drawing:_},t))}),A&&C>1&&(0,y.jsx)(`p`,{className:u(`bg-background text-lead shadow-overlay pointer-events-none absolute bottom-4 left-1/2 -translate-x-1/2 rounded-md px-2.5 py-1 text-xs tabular-nums motion-safe:transition-opacity`,A.live?`opacity-100`:`opacity-0`),"data-testid":`media-viewer-pdf-page-number`,"aria-live":`polite`,children:a.page(A.at,C)})]})}var j=()=>b.of(i()?.locale);function M(e){let t=r(),[n,i]=(0,v.useState)(0),[a,o]=(0,v.useState)({});return(0,v.useEffect)(()=>{let n=!0,r,a=t.on(`files/changed`,t=>{t.watch===r&&t.changes.some(t=>t.path===e)&&i(e=>e+1)});return t[`files/watch`]({paths:[e]}).then(e=>{n?r=e.watch:t[`files/unwatch`]({watch:e.watch}).catch(()=>void 0)},()=>void 0),()=>{n=!1,a(),r!==void 0&&t[`files/unwatch`]({watch:r}).catch(()=>void 0)}},[t,e]),(0,v.useEffect)(()=>{let r=!0;return t[`files/url`]({path:e}).then(({url:e})=>{if(!r)return;let t=new URL(e,location.href);n>0&&t.searchParams.set(`v`,String(n)),o({url:t.href})},e=>{r&&o({failed:e instanceof Error?e.message:String(e)})}),()=>{r=!1}},[t,e,n]),{url:a.url,version:n,failed:a.failed}}function N(e,t){let n=e.getBoundingClientRect();if(t.width<=0||t.height<=0||n.width<=0)return;let r=Math.min(n.width/t.width,n.height/t.height),i=t.width*r,a=t.height*r;return{x:n.x+(n.width-i)/2,y:n.y+(n.height-a)/2,width:i,height:a}}var P=(e,t)=>e.x>=t.x&&e.x<=t.x+t.width&&e.y>=t.y&&e.y<=t.y+t.height;function F({path:e,url:t,version:r}){let i=(0,v.useRef)(null),[a,o]=(0,v.useState)(!1),d=()=>{let e=i.current;if(!e?.complete)return;let t={width:e.naturalWidth,height:e.naturalHeight},n=N(e,t);return n&&{box:n,...t}},f=()=>({name:`the picture ${e}`,source:{path:e}});return n({hold:()=>Promise.resolve({key:`${e}@${String(r)}`,what:`The picture ${e}`,source:{path:e}}),locate:t=>{let n=d();if(!n||!l(t,n.box))return Promise.resolve({elements:[]});let r=n.width/n.box.width,i=e=>({x:(e.x-n.box.x)*r,y:(e.y-n.box.y)*r});return Promise.resolve({elements:[{...f(),regions:[{in:`the picture`,file:e,width:n.width,height:n.height,...s(t,i),scale:r}]}]})},pick:e=>{let t=d();return Promise.resolve(t&&P(e,t.box)?{element:f(),outline:c(t.box)}:void 0)}}),(0,y.jsx)(`div`,{className:u(`size-full`,a?`overflow-auto`:`flex items-center justify-center p-6`),onDoubleClick:()=>{o(e=>!e)},"data-testid":`media-viewer-stage`,"data-size":a?`actual`:`fit`,children:(0,y.jsx)(`img`,{ref:i,src:t,alt:``,draggable:!1,className:u(`select-none`,a?`m-auto block max-w-none p-6`:`size-full object-contain`),"data-testid":`media-viewer-picture`})})}function I({path:e,url:r,version:i}){let o=(0,v.useRef)(null),s=(0,v.useRef)(!1),c=()=>(o.current?.currentTime??0).toFixed(2);return n({hold:()=>Promise.resolve({key:`${e}@${String(i)}`,what:`The video ${e}`,source:{path:e}}),locate:()=>Promise.resolve({elements:[]})}),a({element:()=>o.current,hold:()=>{let e=o.current;return s.current=e!==null&&!e.paused,e?.pause(),Promise.resolve()},release:()=>{s.current&&o.current?.play().catch(()=>void 0),s.current=!1},pictures:()=>{let e=o.current,n=e?t(e):void 0;return Promise.resolve(n?[n]:[])},locate:()=>Promise.resolve({elements:[{name:`the video ${e}`,source:{path:e}}],where:`on the video ${e} at ${c()} s`})}),(0,y.jsx)(`video`,{ref:o,src:r,controls:!0,playsInline:!0,preload:`metadata`,className:`size-full object-contain`,"data-testid":`media-viewer-video`})}function L({path:e,url:t,version:r}){let i=(0,v.useRef)(null),a=(0,v.useRef)(!1);return n({hold:()=>{let t=i.current;return a.current=t!==null&&!t.paused,t?.pause(),Promise.resolve({key:`${e}@${String(r)}`,what:`The sound ${e}`,source:{path:e}})},locate:()=>Promise.resolve({elements:[{name:`the sound ${e}`,source:{path:e}}],where:`at ${(i.current?.currentTime??0).toFixed(2)} s`}),release:()=>{a.current&&i.current?.play().catch(()=>void 0),a.current=!1}}),(0,y.jsxs)(_,{className:`flex w-full max-w-sm flex-col items-center gap-2 p-5 text-center`,children:[(0,y.jsx)(p,{className:`text-lead-soft size-5`,strokeWidth:1.5,"aria-hidden":!0}),(0,y.jsx)(`p`,{className:`text-ink font-serif text-sm font-semibold`,children:e.slice(e.lastIndexOf(`/`)+1)}),(0,y.jsx)(`audio`,{ref:i,src:t,controls:!0,preload:`metadata`,className:`mt-1 w-full`,"data-testid":`media-viewer-sound`})]})}var R={picture:F,video:I,sound:L,pdf:A};function z(){let e=j(),t=i()?.item.entry??``,n=C(t),{url:r,version:a,failed:o}=M(t),s=n===void 0?void 0:R[n];return(0,y.jsxs)(`div`,{className:`flex size-full flex-col`,"data-testid":`media-viewer`,children:[(0,y.jsx)(m,{}),(0,y.jsx)(`div`,{className:u(`bg-stone relative min-h-0 flex-1`,(n===`video`||n===`sound`)&&`flex items-center justify-center p-6`),children:r!==void 0&&s?(0,y.jsx)(s,{path:t,url:r,version:a},r):o===void 0?null:(0,y.jsxs)(`div`,{className:`flex size-full flex-col items-center justify-center gap-2 p-6 text-center`,children:[(0,y.jsx)(h,{className:`text-lead-soft size-5`,strokeWidth:1.5,"aria-hidden":!0}),(0,y.jsx)(`p`,{className:`text-ink font-serif text-sm font-semibold`,children:t.slice(t.lastIndexOf(`/`)+1)}),(0,y.jsx)(`p`,{className:`text-lead text-xs`,children:e.couldNotOpen(o)})]})})]})}export{S as MEDIA_EXTENSIONS,z as MediaViewer,z as default,b as WORDS,C as mediaOf};
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,d as n,o as r,p as i,s as a,v as o}from"./react-Bk7NnOLX.js";import{Ot as s,Tt as c,_t as l,gt as u,t as d}from"./button-BVQH7zxz.js";import{B as f,R as p,V as m,Y as h,et as g,tt as _}from"./snapshots-CTS2iez5.js";import{t as v}from"./session-CUCSWPTE.js";import{t as y}from"./jsx-runtime-DePvh3-m.js";import{t as b}from"./createLucideIcon-REX213UO.js";import{t as ee}from"./arrow-down-DzZjFrBL.js";import{t as te}from"./arrow-up-hdmh9LVD.js";import{t as ne}from"./chart-no-axes-column-CJmeYOSo.js";import{b as re,i as ie,v as ae,w as oe,x as se}from"./dist-D7ur8721.js";import{a as ce,c as x,i as le,l as ue,n as de,r as fe,s as pe,t as me}from"./split-mDSkdQkd.js";import{n as he,t as ge}from"./undo-2-DUGGyBdX.js";import{E as S,Q as C,b as w,h as T,m as E,p as D,v as O,y as k}from"./index-BGAXezRR.js";import{t as A}from"./collaborator-2qfw-8OJ.js";import{f as j,i as M,n as N,o as P,s as F,u as I}from"./browser-C9NP0ZYz.js";import{S as L,b as R,d as _e,f as ve,i as ye,l as be,m as xe,n as z,p as Se,t as B,u as Ce,v as V,y as H}from"./words-B2FXYyeZ.js";var U=b(`earth`,[[`path`,{d:`M21.54 15H17a2 2 0 0 0-2 2v4.54`,key:`1djwo0`}],[`path`,{d:`M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17`,key:`1tzkfa`}],[`path`,{d:`M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05`,key:`14pb5j`}],[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}]]),we=b(`flag`,[[`path`,{d:`M4 22V4a1 1 0 0 1 .4-.8A6 6 0 0 1 8 2c3 0 5 2 7.333 2q2 0 3.067-.8A1 1 0 0 1 20 4v10a1 1 0 0 1-.4.8A6 6 0 0 1 16 16c-3 0-5-2-8-2a6 6 0 0 0-4 1.528`,key:`1jaruq`}]]),W=[`following`,`mentionedUsers`,`subscribers`,`verified`],G=_().regex(/^[0-9]{1,19}$/u,`a post's id: 1 to 19 digits`),Te=g({file:_().min(1),alt:_().optional()},{error:e=>e.code===`invalid_type`?`a medium is { file: ./picture.png, alt: … }: its file, from this file's folder, and its alt text`:void 0}),Ee=g({options:f(_()),duration_minutes:h().int()},{error:e=>e.code===`invalid_type`?`a poll is { options: [ … ], duration_minutes: … }`:void 0}),De=g({text:_().default(``).transform(e=>e.replace(/\n+$/u,``)),media:f(Te).optional(),poll:Ee.optional(),made_with_ai:m().optional(),paid_partnership:m().optional(),reply:g({in_reply_to_tweet_id:G}).optional(),quote_tweet_id:G.optional()},{error:e=>e.code===`invalid_type`?`a post is { text: …, media: [ … ], poll: … }`:void 0}),Oe=g({reply_settings:p(W).optional(),posts:f(De,{error:`posts is the list of its posts: posts: [ { text: … }, … ]`}).min(1,`posts holds at least one post`)},{error:e=>e.code===`invalid_type`?`an x-post's file is { posts: [ { text: … }, … ] }, with reply_settings beside posts`:void 0});function ke(e,t){let n=e;for(let e of t)if(I(n)){let t=n.items.find(t=>t.key?.value===e);if(!t)return n;n=t.value??t.key}else if(j(n)&&typeof e==`number`){let t=n.items[e];if(!t)return n;n=t}else return n;return n}function K(e){let t=new M,n=N(e,{lineCounter:t,prettyErrors:!1}),r=e=>{let r=ke(n.contents,e)?.range?.[0];return r===void 0?void 0:t.linePos(r).line};if(n.errors.length>0)return{errors:n.errors.map(e=>({path:[],message:e.message})),line:e=>e.length===0&&n.errors[0]?.linePos?.[0]?n.errors[0].linePos[0].line:r(e)};let i=Oe.safeParse(n.toJS());return i.success?{value:i.data,errors:[],line:r}:{errors:i.error.issues.map(e=>({path:e.path.filter(e=>typeof e==`string`||typeof e==`number`),message:e.message})),line:r}}function Ae(e,t){let n=e.createNode(t);return t.includes(`
|
|
2
|
-
`)&&(n.type=F.BLOCK_LITERAL),n}var q=e=>JSON.stringify(e,(e,t)=>typeof t==`object`&&t&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e<t?-1:+(e>t))):t),J=(e,t)=>q(e)===q(t);function je(e){return{text:e.text,media:e.media===void 0||e.media.length===0?void 0:e.media,poll:e.poll}}function Me(e,t){let n=N(e),r=K(e).value;if(r!==void 0&&J(r,t))return e;I(n.contents)||(n.contents=new P),t.reply_settings===void 0?n.deleteIn([`reply_settings`]):n.getIn([`reply_settings`])!==t.reply_settings&&n.setIn([`reply_settings`],t.reply_settings);let i=n.getIn([`posts`]),a=j(i)?i:void 0,o=(a?.items??[]).map(e=>I(e)?e:void 0),s=(r?.posts??[]).map(e=>q(e)),c=new Set,l=t.posts.map(()=>void 0);t.posts.forEach((e,t)=>{let n=s.findIndex((t,n)=>!c.has(n)&&o[n]&&t===q(e));n>=0&&(c.add(n),l[t]=n)}),t.posts.forEach((e,t)=>{l[t]===void 0&&o[t]&&!c.has(t)&&(c.add(t),l[t]=t)});let u=t.posts.map((e,t)=>{let r=l[t],i=r===void 0?void 0:o[r],a=je(e);if(!i){let t=n.createNode({});t.set(`text`,Ae(n,e.text));for(let e of[`media`,`poll`])a[e]!==void 0&&t.set(e,n.createNode(a[e]));return t}let s=i.get(`text`);(typeof s!=`string`||s.replace(/\n+$/u,``)!==e.text)&&i.set(`text`,Ae(n,e.text));for(let e of[`media`,`poll`]){let t=a[e],r=i.get(e,!0);t===void 0?r!==void 0&&i.delete(e):J(r?.toJSON?.(),t)||i.set(e,n.createNode(t))}return i});return a?a.items=u:n.setIn([`posts`],n.createNode(u)),n.toString({flowCollectionPadding:!1,lineWidth:0})}function Ne(e,t,n){let r=(e,t,n)=>J(t,e)?n:t,i=t.posts.length===e.posts.length?n.posts.length:n.posts.length===e.posts.length?t.posts.length:n.posts.length,a=[];for(let o=0;o<i;o++){let i=e.posts[o],s=t.posts[o],c=n.posts[o],l=c??s;if(l===void 0)continue;if(s===void 0||c===void 0||i===void 0){a.push(l);continue}let u={...c,text:r(i.text,s.text,c.text)};delete u.media,delete u.poll,a.push({...u,...Y(`media`,r(i.media,s.media,c.media)),...Y(`poll`,r(i.poll,s.poll,c.poll))})}let o={...n,posts:a};return delete o.reply_settings,{...o,...Y(`reply_settings`,r(e.reply_settings,t.reply_settings,n.reply_settings))}}function Y(e,t){return t===void 0?{}:{[e]:t}}var X=e(o(),1),Z=y();function Pe(e){let t=e?.part??e?.board;if(typeof t!=`string`)return;let n=/^post-(\d+)$/u.exec(t)?.[1];return n===void 0?void 0:Number(n)-1}var Fe=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Ie(e,t){let n=e?.posts??[],r=t.posts;for(let e=0;e<r.length;e++)if(!Fe(n[e],r[e]))return e;if(n.length>r.length&&r.length>0)return r.length-1}function Le(e,t){let n=K(e),r=n.value?.posts.length??0,i=e.split(`
|
|
3
|
-
`).length;for(let e=0;e<r;e++){let a=n.line([`posts`,e]);if(a===void 0)continue;let o=e+1<r?n.line([`posts`,e+1]):void 0,s=o===void 0?i:o-1;if(a<=t.to&&t.from<=s)return e}}function Re(e,t){if(e.from!==void 0&&e.path===t.path)return Le(t.text,{from:e.from,to:e.to??e.from})}var ze=class e{session;file;unreadable;landed;snapshot;listeners=new Set;amending;stops=[];constructor(e){this.session=e,this.read(e.text),this.snapshot=this.make(),e.attach({save:e=>{if(this.file===void 0||this.unreadable!==void 0)return;let t=Me(e,this.file);return t===e?void 0:t},take:(e,t,n)=>{let r=K(e),i=K(t).value,a=n?.kind===`agent`&&r.value?Ie(i,r.value):void 0;a!==void 0&&(this.landed={post:a,at:Date.now()}),r.value?(this.file=this.file===void 0||i===void 0?r.value:Ne(i,this.file,r.value),this.unreadable=void 0):(this.file=void 0,this.unreadable=r.errors.map(e=>e.message).join(` `)),this.emit()}}),this.stops.push(e.onState(()=>{this.emit()}),e.onUndo(()=>{this.emit()}))}read(e){let t=K(e);this.file=t.value,this.unreadable=t.value?void 0:t.errors.map(e=>e.message).join(` `)}static async open(t,n){return new e(await v.open(t,n))}make(){return{file:this.file,state:this.session.state,canUndo:this.session.canUndo,canRedo:this.session.canRedo,unreadable:this.unreadable,landed:this.landed}}emit(){this.snapshot=this.make();for(let e of this.listeners)e()}get text(){return this.session.text}get(){return this.snapshot}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}edit(e,t,n){let r=this.file;if(r===void 0||this.unreadable!==void 0)return;let i=t(r);if(i!==r){if(n!==void 0&&this.amending?.key===n&&this.session.canUndo){let e=this.amending.from;this.session.undo(),this.push(this.amending.label,e,i)}else this.amending=n===void 0?void 0:{key:n,from:r,label:e},this.push(e,r,i)}}settle(){this.amending=void 0}push(e,t,n){this.file=n,this.session.pushEdit({label:e,undo:()=>{this.file=t,this.emit()},redo:()=>{this.file=n,this.emit()}}),this.emit()}undo(){this.amending=void 0,this.session.undo()}redo(){this.amending=void 0,this.session.redo()}async close(){for(let e of this.stops.splice(0))e();await this.session.close()}},Q=(e,t,n)=>({...e,posts:e.posts.map((e,r)=>r===t?n(e):e)});function Be(e,t){let n={...e};return t===void 0||t.length===0?delete n.media:n.media=t,n}function Ve(e){let t={...e};return delete t.poll,t}function He({text:e}){let t=B(),{weighted:n}=R(e),r=L.length.most,i=r-n,a=i<0&&n<=L.length.premium,o=n>L.length.premium,s=Math.min(1,n/r),c=2*Math.PI*9;return(0,Z.jsxs)(`span`,{className:`inline-flex items-center gap-1 text-xs tabular-nums`,"aria-label":i>=0?t.left(i):t.over(-i),"data-testid":`x-count`,children:[i<=20?(0,Z.jsx)(`span`,{className:u(o?`text-destructive`:a?`text-warning`:`text-muted-foreground`),children:a?n:i}):null,(0,Z.jsxs)(`svg`,{width:`22`,height:`22`,viewBox:`0 0 22 22`,"aria-hidden":`true`,children:[(0,Z.jsx)(`circle`,{cx:`11`,cy:`11`,r:9,fill:`none`,stroke:`var(--ak-x-line)`,strokeWidth:`2`}),(0,Z.jsx)(`circle`,{cx:`11`,cy:`11`,r:9,fill:`none`,stroke:o?`#f4212e`:a||i<=20?`#ffd400`:`var(--ak-x-link)`,strokeWidth:`2`,strokeDasharray:`${String(s*c)} ${String(c)}`,transform:`rotate(-90 11 11)`})]})]})}function Ue(e){let t=B();return(0,Z.jsx)(x,{alt:e.alt??``,onAlt:e.onAlt,most:L.alt,trigger:(0,Z.jsx)(d,{variant:`secondary`,size:`xs`,className:`bg-media/75 text-on-media font-bold`,"aria-label":t.altText,children:t.alt})})}function We(e){let t=B();return(0,Z.jsx)(d,{variant:`secondary`,size:`icon-sm`,className:`bg-media/75 text-on-media absolute top-2 right-2 rounded-full`,"aria-label":t.removeMedium,onClick:e.onRemove,children:(0,Z.jsx)(l,{})})}function Ge(e){let t=B(),{options:n,duration_minutes:r}=e.poll,i={days:Math.floor(r/1440),hours:Math.floor(r%1440/60),minutes:r%60},a=(t,n)=>{let r={...i,[t]:Math.max(0,Math.floor(n))};e.onChange({...e.poll,duration_minutes:r.days*1440+r.hours*60+r.minutes})};return(0,Z.jsxs)(`div`,{className:`mt-3 flex flex-col gap-2 rounded-2xl border border-[var(--ak-x-line)] p-3`,"data-testid":`x-poll`,children:[n.map((r,i)=>{let a=H(r)-L.poll.option;return(0,Z.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Z.jsx)(`input`,{className:`aria-invalid:border-destructive h-10 flex-1 rounded-md border border-[var(--ak-x-line)] bg-transparent px-3 text-[15px] outline-none focus:border-[var(--ak-x-link)]`,value:r,"aria-invalid":a>0||void 0,maxLength:L.poll.option,placeholder:t.option(i+1),"aria-label":t.option(i+1),onChange:t=>{e.onChange({...e.poll,options:n.map((e,n)=>n===i?t.target.value:e)},`option-${String(i)}`)}}),a>0?(0,Z.jsx)(`span`,{className:`text-destructive text-sm`,children:t.over(a)}):null,n.length>L.poll.least?(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":t.removeOption,onClick:()=>{e.onChange({...e.poll,options:n.filter((e,t)=>t!==i)})},children:(0,Z.jsx)(l,{})}):null]},i)}),n.length<L.poll.most?(0,Z.jsxs)(d,{variant:`ghost`,size:`sm`,className:`self-start text-[var(--ak-x-link)]`,onClick:()=>{e.onChange({...e.poll,options:[...n,``]})},children:[(0,Z.jsx)(C,{}),t.addOption]}):null,(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 border-t border-[var(--ak-x-line)] pt-2 text-sm`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground mr-auto self-center`,children:t.pollLength}),[`days`,`hours`,`minutes`].map(e=>(0,Z.jsxs)(`label`,{className:`flex flex-col gap-0.5 text-xs`,children:[(0,Z.jsx)(`span`,{className:`text-muted-foreground`,children:t[e]}),(0,Z.jsx)(`input`,{type:`number`,min:0,className:`h-8 w-16 rounded-md border border-[var(--ak-x-line)] bg-transparent px-2 text-sm`,value:i[e],onChange:t=>{a(e,Number(t.target.value))}})]},e)),(0,Z.jsx)(d,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:e.onRemove,children:t.removePoll})]})]})}function Ke(e){let t=B(),n=t.replies[e.value??`everyone`];return(0,Z.jsxs)(D,{children:[(0,Z.jsx)(S,{asChild:!0,disabled:e.disabled,children:(0,Z.jsxs)(d,{variant:`ghost`,size:`sm`,className:`ak-x-c-replies -ml-2 gap-1 px-2 font-bold text-[var(--ak-x-link)]`,children:[(0,Z.jsx)(U,{}),n]})}),(0,Z.jsxs)(T,{align:`start`,className:`w-72`,children:[(0,Z.jsx)(O,{children:t.whoCanReply}),(0,Z.jsx)(k,{value:e.value??`everyone`,onValueChange:t=>{e.onChange(t===`everyone`?void 0:W.includes(t)?t:void 0)},children:[`everyone`,...W].map(e=>(0,Z.jsx)(w,{value:e,children:t.replies[e]},e))})]})]})}function qe(e){let t=B(),n=e.post.made_with_ai===!0||e.post.paid_partnership===!0;return(0,Z.jsxs)(D,{children:[(0,Z.jsx)(S,{asChild:!0,children:(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)]`,"aria-label":t.disclosure,title:t.disclosure,"aria-pressed":n,children:(0,Z.jsx)(we,{className:u(n&&`fill-current`)})})}),(0,Z.jsxs)(T,{align:`start`,className:`w-56`,children:[(0,Z.jsx)(O,{children:t.disclosure}),(0,Z.jsx)(E,{checked:e.post.made_with_ai===!0,onCheckedChange:t=>{e.onChange({made_with_ai:t})},children:t.madeWithAi}),(0,Z.jsx)(E,{checked:e.post.paid_partnership===!0,onCheckedChange:t=>{e.onChange({paid_partnership:t})},children:t.paidPartnership})]})]})}function $(e){return(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)] disabled:text-[var(--ak-x-muted)]`,"aria-label":e.label,title:e.label,disabled:e.disabled,onClick:e.onClick,children:e.children})}var Je=3e4;function Ye({doc:e,dir:r,entry:o}){let u=B(),f=a(),p=i(),m=(0,X.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get()),[h,g]=(0,X.useState)(),[_,v]=(0,X.useState)(0),[y,b]=(0,X.useState)(),x=(0,X.useRef)([]);(0,X.useEffect)(()=>{if(y===void 0)return;let e=x.current[y.post];e!=null&&(e.focus(),e.setSelectionRange(y.at,y.at),v(y.post),b(void 0))},[y]);let S=m.file,{agent:w,following:T}=t(),E=oe(),D=(()=>{if(w?.doing===void 0)return;let t=Pe(w.place);if(t!==void 0)return t;let n=m.landed!==void 0&&m.landed.at>=w.at-Je;return n&&w.source?.path===o?m.landed?.post:(w.source?Re(w.source,{path:o,text:e.text}):void 0)??(n?m.landed?.post:void 0)})(),O=D!==void 0&&D<(S?.posts.length??0)?D:void 0,k=(0,X.useRef)([]),j=(0,X.useRef)([]);(0,X.useEffect)(()=>{if(T&&O!==void 0)for(let e of[k.current[O],j.current[O]])e?.scrollIntoView({block:`nearest`})},[T,O,m.landed]);let M=le(r,(S?.posts??[]).flatMap(e=>(e.media??[]).map(e=>e.file)));n({hold:()=>Promise.resolve({key:`${o}@${String(e.text.length)}`,what:`The X post ${o}${(S?.posts.length??0)>1?`, a thread of ${String(S?.posts.length??0)} posts`:``}`,source:{path:o}}),locate:t=>{let n=S?.posts??[],r=K(e.text),i=e=>{let t=e?.getBoundingClientRect();return t&&t.width>0&&t.height>0?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0},a=e=>e!==void 0&&s(t,e),l=n.flatMap((e,t)=>{if(!a(i(k.current[t]))&&!a(i(j.current[t])))return[];let n=r.line([`posts`,t]);return[{name:`post ${String(t+1)} of the thread`,source:{path:o,...n===void 0?{}:{line:n}},...e.text===``?{}:{text:e.text}}]}),u=c(t)[0],d=e=>e!==void 0&&u!==void 0&&u.x>=e.x&&u.x<=e.x+e.width&&u.y>=e.y&&u.y<=e.y+e.height,f=n.findIndex((e,t)=>d(i(k.current[t]))),p=n.findIndex((e,t)=>d(i(j.current[t]))),m=f>=0?`in post ${String(f+1)}, where it is written`:p>=0?`in post ${String(p+1)}, as X's timeline will show it`:void 0;return Promise.resolve({elements:l,...m===void 0?{}:{where:m}})}});let N=t=>{(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`z`&&(t.preventDefault(),t.shiftKey?e.redo():e.undo())},P=(t,n,r)=>{p||e.edit(t,n,r)},F=e=>(e.media??[]).map(e=>{let t=M.get(e.file),n=fe(e.file),r=n?void 0:V(e.file.split(`.`).pop()??``);return t===void 0?{kind:`made`,label:n?u.made:e.file}:{kind:r??`picture`,src:t,alt:e.alt,file:e.file}}),I=(0,Z.jsx)(ie,{start:p?void 0:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":u.undo,title:u.undo,disabled:!m.canUndo,onClick:()=>{e.undo()},children:(0,Z.jsx)(ge,{})}),(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":u.redo,title:u.redo,disabled:!m.canRedo,onClick:()=>{e.redo()},children:(0,Z.jsx)(he,{})})]}),saved:{state:m.state},exports:{}}),R=f?.theme===`dark`;if(S===void 0)return(0,Z.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`x-post-editor`,children:[I,(0,Z.jsx)(`p`,{className:`text-muted-foreground mx-auto max-w-xl p-6 text-sm`,children:u.unreadable(m.unreadable??``)})]});let z=S.posts,H=Math.min(_,z.length-1),U=e=>{P(u.steps.add,t=>({...t,posts:[...t.posts.slice(0,e+1),{text:``},...t.posts.slice(e+1)]})),b({post:e+1,at:0})},we=e=>{let t=z[e],n=z[e-1];if(t===void 0||n===void 0)return!1;let r=e=>(e.media?.length??0)>0||e.poll!==void 0;if(r(t)&&r(n))return!1;let i=n.text===``||t.text===``?``:`
|
|
4
|
-
|
|
5
|
-
`;return P(u.steps.join,a=>({...a,posts:[...a.posts.slice(0,e-1),{...n,...r(t)?{...t.media?{media:t.media}:{},...t.poll?{poll:t.poll}:{}}:{},text:n.text+i+t.text},...a.posts.slice(e+1)]})),b({post:e-1,at:n.text.length+i.length}),!0},W=(0,Z.jsx)(`div`,{className:`ak-x ak-x-editing ak-x-composer`,"data-theme":R?`dark`:`light`,children:z.map((t,n)=>{let i=n===z.length-1,a=n===H,s=t.media??[],c=s.filter(e=>V(e.file.split(`.`).pop()??``)===`picture`||fe(e.file)).length,f=s.length>=L.pictures||s.length>c;return(0,Z.jsxs)(`div`,{ref:e=>{k.current[n]=e},className:`ak-x-c-post`,"data-here":a?``:void 0,"data-testid":`x-post`,onFocusCapture:()=>{v(n)},onPointerDown:()=>{v(n)},children:[(0,Z.jsxs)(`div`,{className:`ak-x-side`,children:[(0,Z.jsx)(`div`,{className:`ak-x-avatar`,"aria-hidden":`true`,children:Ce.name.slice(0,1)}),i?null:(0,Z.jsx)(`div`,{className:`ak-x-thread-line`})]}),(0,Z.jsxs)(`div`,{className:`ak-x-body`,children:[a&&n>0&&!p?(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,className:`ak-x-c-remove`,"aria-label":u.remove,title:u.remove,onClick:()=>{P(u.steps.remove,e=>({...e,posts:e.posts.filter((e,t)=>t!==n)})),b({post:n-1,at:z[n-1]?.text.length??0})},children:(0,Z.jsx)(l,{})}):null,(0,Z.jsxs)(`div`,{className:`ak-x-field`,children:[(0,Z.jsx)(ve,{text:t.text,whole:!0}),(0,Z.jsx)(`textarea`,{ref:e=>{x.current[n]=e},dir:`auto`,value:t.text,placeholder:n===0?u.whatsHappening:u.addAnother,"aria-label":n===0?u.whatsHappening:u.addAnother,readOnly:p,"data-testid":`x-text`,onChange:e=>{let t=e.target.value;P(u.steps.text,e=>Q(e,n,e=>({...e,text:t})),`text-${String(n)}`)},onBlur:()=>{e.settle()},onKeyDown:e=>{let t=e.currentTarget;if(e.key===`Backspace`&&n>0&&t.selectionStart===0&&t.selectionEnd===0&&!p){we(n)&&e.preventDefault();return}if(e.key!==`Enter`||!(e.metaKey||e.ctrlKey))return;e.preventDefault();let r=t.selectionStart;P(u.steps.split,e=>{let t=e.posts[n];if(!t)return e;let i=t.text.slice(0,r).replace(/\s+$/u,``),a=t.text.slice(r).replace(/^\s+/u,``);return{...e,posts:[...e.posts.slice(0,n),{...t,text:i},{text:a},...e.posts.slice(n+1)]}}),b({post:n+1,at:0})}})]}),(0,Z.jsx)(be,{media:F(t),onAlt:p?void 0:e=>(0,Z.jsx)(Ue,{alt:s[e]?.alt,onAlt:t=>{P(u.steps.alt,r=>Q(r,n,n=>({...n,media:(n.media??[]).map((n,r)=>{if(r!==e)return n;let i={file:n.file};return t.trim()===``?i:{...i,alt:t}})})))}}),onMedium:p?void 0:e=>(0,Z.jsx)(We,{onRemove:()=>{P(u.steps.media,t=>Q(t,n,t=>Be(t,(t.media??[]).filter((t,n)=>n!==e))))}})}),t.poll===void 0?null:p?(0,Z.jsx)(`div`,{className:`ak-x-poll`,children:t.poll.options.map((e,t)=>(0,Z.jsx)(`div`,{className:`ak-x-option`,dir:`auto`,children:e},t))}):(0,Z.jsx)(Ge,{poll:t.poll,onChange:(e,t)=>{P(u.steps.poll,t=>Q(t,n,t=>({...t,poll:e})),t===void 0?void 0:`${t}-${String(n)}`)},onRemove:()=>{P(u.steps.poll,e=>Q(e,n,e=>Ve(e)))}}),t.quote_tweet_id===void 0?null:(0,Z.jsx)(Se,{id:t.quote_tweet_id}),a?(0,Z.jsx)(Ke,{value:S.reply_settings,disabled:p,onChange:e=>{P(u.whoCanReply,t=>{let n={...t};return e===void 0?delete n.reply_settings:n.reply_settings=e,n})}}):null,a&&!p?(0,Z.jsxs)(`div`,{className:`ak-x-c-tools`,children:[(0,Z.jsxs)(ae,{open:h===n,onOpenChange:e=>{g(e?n:void 0)},children:[(0,Z.jsx)(se,{asChild:!0,children:(0,Z.jsx)(d,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)] disabled:text-[var(--ak-x-muted)]`,"aria-label":u.addMedia,title:u.addMedia,disabled:f||t.poll!==void 0,children:(0,Z.jsx)(ue,{})})}),(0,Z.jsx)(re,{className:`w-auto`,align:`start`,children:(0,Z.jsx)(de,{self:o,types:ye,testId:`x-picker`,onPick:e=>{g(void 0),P(u.steps.media,t=>Q(t,n,t=>({...t,media:[...t.media??[],{file:ce(r,e)}]})))}})})]}),(0,Z.jsx)($,{label:u.addPoll,disabled:t.poll!==void 0||s.length>0,onClick:()=>{P(u.steps.poll,e=>Q(e,n,e=>({...e,poll:{options:[``,``],duration_minutes:1440}})))},children:(0,Z.jsx)(ne,{})}),(0,Z.jsx)(qe,{post:t,onChange:e=>{P(u.disclosure,t=>Q(t,n,t=>{let n={...t,...e};return n.made_with_ai!==!0&&delete n.made_with_ai,n.paid_partnership!==!0&&delete n.paid_partnership,n}))}}),(0,Z.jsx)(`span`,{className:`flex-1`}),(0,Z.jsx)($,{label:u.moveUp,disabled:n===0,onClick:()=>{P(u.steps.move,e=>{let t=[...e.posts],[r]=t.splice(n,1);return r&&t.splice(n-1,0,r),{...e,posts:t}}),v(n-1)},children:(0,Z.jsx)(te,{})}),(0,Z.jsx)($,{label:u.moveDown,disabled:i,onClick:()=>{P(u.steps.move,e=>{let t=[...e.posts],[r]=t.splice(n,1);return r&&t.splice(n+1,0,r),{...e,posts:t}}),v(n+1)},children:(0,Z.jsx)(ee,{})}),(0,Z.jsx)(He,{text:t.text}),(0,Z.jsx)(`span`,{className:`bg-rule mx-1 h-6 w-px`,"aria-hidden":`true`}),(0,Z.jsx)(d,{variant:`outline`,size:`icon-xs`,className:`rounded-full border-[var(--ak-x-line)] text-[var(--ak-x-link)]`,"aria-label":u.addPost,title:u.addPost,onClick:()=>{U(n)},children:(0,Z.jsx)(C,{})})]}):null]}),w&&O===n?(0,Z.jsx)(A,{"data-testid":`x-agent-box`,label:E(w),className:`inset-x-1 inset-y-0`}):null]},n)})}),G=(0,Z.jsx)(`div`,{className:`ak-x`,"data-theme":R?`dark`:`light`,children:z.map((e,t)=>(0,Z.jsxs)(`div`,{ref:e=>{j.current[t]=e},className:`relative`,children:[(0,Z.jsx)(_e,{post:{text:e.text,media:F(e),poll:e.poll,quote:e.quote_tweet_id},joined:t<z.length-1,published:!0}),w&&O===t?(0,Z.jsx)(A,{"data-testid":`x-agent-shown`,className:`inset-0`}):null]},t))});return(0,Z.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`x-post-editor`,onKeyDown:N,children:[I,(0,Z.jsx)(xe.Provider,{value:pe,children:(0,Z.jsx)(me,{edit:W,preview:G,width:598,background:R?`#000000`:`#ffffff`,testId:`x-preview`})})]})}function Xe(){let e=B(),t=r(),n=a(),i=n?.item.entry,o=n?.item.dir??``,[s,c]=(0,X.useState)(),[l,u]=(0,X.useState)();return(0,X.useEffect)(()=>{if(i===void 0)return;let e,n=!0;return ze.open(t,i).then(t=>{n?(e=t,c(t)):t.close()},e=>{n&&u(e instanceof Error?e.message:String(e))}),()=>{n=!1,e?.close()}},[t,i]),!s||i===void 0?(0,Z.jsx)(`div`,{className:`text-muted-foreground flex size-full items-center justify-center text-sm`,"data-testid":`x-post-editor`,"data-state":l===void 0?`loading`:`error`,children:l===void 0?e.loading:e.couldNotOpen(l)}):(0,Z.jsx)(Ye,{doc:s,dir:o,entry:i})}export{ze as PostDocument,z as WORDS,Xe as XPostEditor,Xe as default};
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,d as n,o as r,p as i,s as a,v as o}from"./react-Bk7NnOLX.js";import{Ot as s,_t as c,gt as l,t as u}from"./button-BVQH7zxz.js";import{B as d,R as f,V as p,at as m,et as h,tt as g}from"./snapshots-CTS2iez5.js";import{t as _}from"./session-CUCSWPTE.js";import{t as v}from"./jsx-runtime-DePvh3-m.js";import{t as y}from"./createLucideIcon-REX213UO.js";import{t as ee}from"./chart-no-axes-column-CJmeYOSo.js";import{b as te,i as ne,v as b,w as re,x}from"./dist-D7ur8721.js";import{a as ie,c as S,i as ae,l as C,n as oe,r as w,s as se,t as ce}from"./split-mDSkdQkd.js";import{t as le}from"./link-CW2KxKT_.js";import{n as ue,t as de}from"./undo-2-DUGGyBdX.js";import{E as fe,Q as T,b as E,h as pe,it as me,nt as he,p as ge,ut as _e,y as ve}from"./index-BGAXezRR.js";import{t as ye}from"./collaborator-2qfw-8OJ.js";import{f as D,i as O,n as k,o as A,s as j,u as M}from"./browser-C9NP0ZYz.js";import{_ as N,a as be,b as P,c as xe,f as F,g as I,h as L,i as Se,m as Ce,n as R,o as z,p as we,t as B,u as Te,v as V,y as H}from"./words-DFIhHhHF.js";var Ee=y(`users`,[[`path`,{d:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2`,key:`1yyitq`}],[`path`,{d:`M16 3.128a4 4 0 0 1 0 7.744`,key:`16gr8j`}],[`path`,{d:`M22 21v-2a4 4 0 0 0-3-3.87`,key:`kshegd`}],[`circle`,{cx:`9`,cy:`7`,r:`4`,key:`nufk8`}]]),U=g().min(1),W=h({file:U,title:g().optional(),altText:g().optional()},{error:e=>e.code===`invalid_type`?`content.media is { file: ./demo.mp4, title: …, altText: … }`:void 0}),G=h({file:U,altText:g().optional()},{error:e=>e.code===`invalid_type`?`a picture of multiImage is { file: ./a.png, altText: … }`:void 0}),De=h({images:d(G)},{error:e=>e.code===`invalid_type`?`content.multiImage is { images: [ { file: ./a.png }, … ] }`:void 0}),K=h({question:g(),options:d(h({text:g()},{error:`a poll's option is { text: … }`})),settings:h({duration:f(N).optional()}).optional()},{error:e=>e.code===`invalid_type`?`content.poll is { question: …, options: [ { text: … }, … ], settings: { duration: SEVEN_DAYS } }`:void 0}),Oe=h({source:m({error:`an article's source is a web address`}),title:g().optional(),description:g().optional(),thumbnail:U.optional()},{error:e=>e.code===`invalid_type`?`content.article is { source: https://…, title: …, description: …, thumbnail: ./card.png }`:void 0}),ke=h({media:W.optional(),multiImage:De.optional(),poll:K.optional(),article:Oe.optional()},{error:e=>e.code===`invalid_type`?`content is one of media, multiImage, poll or article`:void 0}).superRefine((e,t)=>{let n=Object.keys(e).filter(t=>e[t]!==void 0);n.length>1&&t.addIssue({code:`custom`,message:`content holds one kind, and holds ${n.join(` and `)}: a post is pictures, a video, a document, a poll or a link, never two`})}),Ae=h({commentary:g().default(``).transform(e=>e.replace(/\n+$/u,``)),visibility:f(P).optional(),content:ke.optional(),isReshareDisabledByAuthor:p().optional()},{error:e=>e.code===`invalid_type`?`a linkedin-post's file is { commentary: …, content: … }, with visibility beside them`:void 0});function je(e,t){let n=e;for(let e of t)if(M(n)){let t=n.items.find(t=>t.key?.value===e);if(!t)return n;n=t.value??t.key}else if(D(n)&&typeof e==`number`){let t=n.items[e];if(!t)return n;n=t}else return n;return n}function q(e){let t=new O,n=k(e,{lineCounter:t,prettyErrors:!1}),r=e=>{let r=je(n.contents,e)?.range?.[0];return r===void 0?void 0:t.linePos(r).line};if(n.errors.length>0)return{errors:n.errors.map(e=>({path:[],message:e.message})),line:e=>e.length===0&&n.errors[0]?.linePos?.[0]?n.errors[0].linePos[0].line:r(e)};let i=Ae.safeParse(n.toJS()??{});return i.success?{value:i.data,errors:[],line:r}:{errors:i.error.issues.map(e=>({path:e.path.filter(e=>typeof e==`string`||typeof e==`number`),message:e.message})),line:r}}function Me(e){let t=e.content;return t===void 0?[]:t.media?[{file:t.media.file,path:[`content`,`media`,`file`],role:`media`,altText:t.media.altText}]:t.multiImage?t.multiImage.images.map((e,t)=>({file:e.file,path:[`content`,`multiImage`,`images`,t,`file`],role:`picture`,altText:e.altText})):t.article?.thumbnail===void 0?[]:[{file:t.article.thumbnail,path:[`content`,`article`,`thumbnail`],role:`thumbnail`}]}function Ne(e){let t=e.toLowerCase();for(let e of[`picture`,`video`,`document`])if(H[e].includes(t))return e}var Pe=[`commentary`,`visibility`,`content`],Fe=e=>JSON.stringify(e,(e,t)=>typeof t==`object`&&t&&!Array.isArray(t)?Object.fromEntries(Object.entries(t).sort(([e],[t])=>e<t?-1:+(e>t))):t),J=(e,t)=>Fe(e)===Fe(t);function Ie(e,t){let n=e.createNode(t);return t.includes(`
|
|
2
|
-
`)&&(n.type=j.BLOCK_LITERAL),n}function Le(e,t){let n=q(e).value;if(n!==void 0&&J(n,t))return e;let r=k(e);M(r.contents)||(r.contents=new A);let i=r.contents;for(let e of Pe){let n=t[e],a=i.get(e,!0);if(n===void 0||e===`commentary`&&n===``)a!==void 0&&i.delete(e);else if(e===`commentary`){let t=i.get(e);(typeof t!=`string`||t.replace(/\n+$/u,``)!==n)&&i.set(e,Ie(r,n))}else J(a?.toJSON?.(),n)||i.set(e,r.createNode(n))}if(i.items.length>1){let e=i.items.findIndex(e=>e.key?.value===`commentary`);if(e>0){let[t]=i.items.splice(e,1);t&&i.items.unshift(t)}}return r.toString({flowCollectionPadding:!1,lineWidth:0})}function Re(e,t,n){let r=r=>J(t[r],e[r])?n[r]:t[r],i=r(`visibility`),a=r(`content`);return{...n.isReshareDisabledByAuthor===void 0?{}:{isReshareDisabledByAuthor:n.isReshareDisabledByAuthor},commentary:r(`commentary`),...i===void 0?{}:{visibility:i},...a===void 0?{}:{content:a}}}var Y=e(o(),1),X=v(),ze=(e,t)=>JSON.stringify(e)===JSON.stringify(t),Be=class e{session;file;unreadable;landed;snapshot;listeners=new Set;amending;stops=[];constructor(e){this.session=e,this.read(e.text),this.snapshot=this.make(),e.attach({save:e=>{if(this.file===void 0||this.unreadable!==void 0)return;let t=Le(e,this.file);return t===e?void 0:t},take:(e,t,n)=>{let r=q(e),i=q(t).value;n?.kind===`agent`&&r.value&&!ze(i,r.value)&&(this.landed=Date.now()),r.value?(this.file=this.file===void 0||i===void 0?r.value:Re(i,this.file,r.value),this.unreadable=void 0):(this.file=void 0,this.unreadable=r.errors.map(e=>e.message).join(` `)),this.emit()}}),this.stops.push(e.onState(()=>{this.emit()}),e.onUndo(()=>{this.emit()}))}read(e){let t=q(e);this.file=t.value,this.unreadable=t.value?void 0:t.errors.map(e=>e.message).join(` `)}static async open(t,n){return new e(await _.open(t,n))}make(){return{file:this.file,state:this.session.state,canUndo:this.session.canUndo,canRedo:this.session.canRedo,unreadable:this.unreadable,landed:this.landed}}emit(){this.snapshot=this.make();for(let e of this.listeners)e()}get text(){return this.session.text}get(){return this.snapshot}subscribe(e){return this.listeners.add(e),()=>this.listeners.delete(e)}edit(e,t,n){let r=this.file;if(r===void 0||this.unreadable!==void 0)return;let i=t(r);if(i!==r){if(n!==void 0&&this.amending?.key===n&&this.session.canUndo){let e=this.amending.from;this.session.undo(),this.push(this.amending.label,e,i)}else this.amending=n===void 0?void 0:{key:n,from:r,label:e},this.push(e,r,i)}}settle(){this.amending=void 0}push(e,t,n){this.file=n,this.session.pushEdit({label:e,undo:()=>{this.file=t,this.emit()},redo:()=>{this.file=n,this.emit()}}),this.emit()}undo(){this.amending=void 0,this.session.undo()}redo(){this.amending=void 0,this.session.redo()}async close(){for(let e of this.stops.splice(0))e();await this.session.close()}},Ve=3e4;function Z(e,t){let n={...e};return t===void 0?delete n.content:n.content=t,n}function Q(e){return w(e)?e.includes(`#`)?`picture`:void 0:Ne(e.split(`.`).pop()??``)}function He(e,t){if(Q(t)===`picture`){if(e?.multiImage)return{multiImage:{images:[...e.multiImage.images,{file:t}]}};if(e?.media&&Q(e.media.file)===`picture`)return{multiImage:{images:[{file:e.media.file,...e.media.altText===void 0?{}:{altText:e.media.altText}},{file:t}]}}}return{media:{file:t}}}function Ue({text:e}){let t=B(),{left:n}=I(e);return n>100?null:(0,X.jsx)(`span`,{className:l(`text-sm tabular-nums`,n<0?`text-destructive font-semibold`:`text-muted-foreground`),"aria-label":n>=0?t.left(n):t.over(-n),"data-testid":`linkedin-count`,children:n})}function $(e){return(0,X.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":e.label,title:e.label,disabled:e.disabled,onClick:e.onClick,children:e.children})}function We(e){let t=B();return(0,X.jsxs)(`div`,{className:`absolute top-2 right-2 flex gap-1`,children:[e.alt===void 0?null:(0,X.jsx)(S,{alt:e.alt.value??``,onAlt:e.alt.onAlt,most:V.alt,trigger:(0,X.jsx)(u,{variant:`secondary`,size:`xs`,className:`bg-media/75 text-on-media font-bold`,children:t.alt})}),(0,X.jsx)(u,{variant:`secondary`,size:`icon-sm`,className:`bg-media/75 text-on-media rounded-full`,"aria-label":t.remove,title:t.remove,onClick:e.onRemove,children:(0,X.jsx)(c,{})})]})}function Ge(e){let t=B(),n=`aria-invalid:border-destructive h-10 w-full rounded-md border border-[var(--ak-li-border)] bg-transparent px-3 text-sm outline-none focus:border-[var(--ak-li-link)]`,r=L(e.poll.question)-V.poll.question;return(0,X.jsxs)(`div`,{className:`mx-3 flex flex-col gap-2 rounded-lg border border-[var(--ak-li-border)] p-3`,"data-testid":`linkedin-poll`,children:[(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-[var(--ak-li-muted)]`,children:[t.question,(0,X.jsx)(`input`,{className:n,value:e.poll.question,readOnly:e.locked,"aria-invalid":r>0||void 0,maxLength:V.poll.question,onChange:t=>{e.onChange({...e.poll,question:t.target.value},`question`)}})]}),e.poll.options.map((r,i)=>{let a=L(r.text)-V.poll.option;return(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-[var(--ak-li-muted)]`,children:[t.option(i+1),(0,X.jsxs)(`span`,{className:`flex items-center gap-1`,children:[(0,X.jsx)(`input`,{className:n,value:r.text,readOnly:e.locked,"aria-invalid":a>0||void 0,maxLength:V.poll.option,onChange:t=>{e.onChange({...e.poll,options:e.poll.options.map((e,n)=>n===i?{text:t.target.value}:e)},`option-${String(i)}`)}}),a>0?(0,X.jsx)(`span`,{className:`text-destructive text-xs`,children:t.over(a)}):null,!e.locked&&e.poll.options.length>V.poll.least?(0,X.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":t.removeOption,title:t.removeOption,onClick:()=>{e.onChange({...e.poll,options:e.poll.options.filter((e,t)=>t!==i)})},children:(0,X.jsx)(c,{})}):null]})]},i)}),!e.locked&&e.poll.options.length<V.poll.most?(0,X.jsxs)(u,{variant:`outline`,size:`sm`,className:`self-start rounded-full`,onClick:()=>{e.onChange({...e.poll,options:[...e.poll.options,{text:``}]})},children:[(0,X.jsx)(T,{}),t.addOption]}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-t border-[var(--ak-li-border)] pt-2 text-sm`,children:[(0,X.jsxs)(`label`,{className:`mr-auto flex items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`text-[var(--ak-li-muted)]`,children:t.duration}),(0,X.jsx)(`select`,{className:`h-8 rounded-md border border-[var(--ak-li-border)] bg-transparent px-2`,value:e.poll.settings?.duration??`SEVEN_DAYS`,disabled:e.locked,onChange:t=>{e.onChange({...e.poll,settings:{duration:t.target.value}})},children:N.map(e=>(0,X.jsx)(`option`,{value:e,children:t.durations[e]},e))})]}),e.locked?null:(0,X.jsx)(u,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:e.onRemove,children:t.removePoll})]})]})}function Ke(e){let t=B(),n=(t,n)=>(0,X.jsxs)(`label`,{className:`flex flex-col gap-1 text-xs text-[var(--ak-li-muted)]`,children:[n,(0,X.jsx)(`input`,{className:`h-9 w-full rounded-md border border-[var(--ak-li-border)] bg-transparent px-3 text-sm text-[var(--ak-li-fg)] outline-none focus:border-[var(--ak-li-link)]`,value:e.article[t]??``,readOnly:e.locked,onChange:n=>{let r=n.target.value,{title:i,description:a,...o}={...e.article,[t]:r};e.onChange({...o,...i===void 0||i===``?{}:{title:i},...a===void 0||a===``?{}:{description:a}},t)}})]});return(0,X.jsxs)(`div`,{className:`mx-3 mb-2 flex flex-col gap-2 rounded-lg border border-[var(--ak-li-border)] p-3`,"data-testid":`linkedin-link`,children:[n(`source`,t.link.source),n(`title`,t.link.title),n(`description`,t.link.description)]})}function qe({doc:e,dir:r,entry:o}){let c=B(),l=a(),d=i(),f=(0,Y.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get()),[p,m]=(0,Y.useState)(),[h,g]=(0,Y.useState)(!1),_=f.file,{agent:v,following:y}=t(),S=re(),T=v?.doing!==void 0&&(v.source?.path===o||f.landed!==void 0&&f.landed>=v.at-Ve),D=(0,Y.useRef)(null),O=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{y&&T&&(D.current?.scrollIntoView({block:`nearest`}),O.current?.scrollIntoView({block:`nearest`}))},[y,T,f.landed]);let k=ae(r,_?Me(_).map(e=>e.file):[]);n({hold:()=>Promise.resolve({key:`${o}@${String(e.text.length)}`,what:`The LinkedIn post ${o}`,source:{path:o}}),locate:e=>{let t=e=>{let t=e?.getBoundingClientRect();return t&&t.width>0&&t.height>0?{x:t.x,y:t.y,width:t.width,height:t.height}:void 0},n=t(D.current),r=t(O.current),i=n!==void 0&&s(e,n),a=r!==void 0&&s(e,r);if(!i&&!a)return Promise.resolve({elements:[]});let c=new Map;for(let n of[D.current,O.current])n?.querySelectorAll(`.ak-li-content img`).forEach((n,r)=>{let i=t(n);i!==void 0&&s(e,i)&&c.set(r,n.alt)});return Promise.resolve({elements:[{name:`the post`,source:{path:o},..._?.commentary?{text:_.commentary}:{}},...[...c].map(([e,t])=>({name:`picture ${String(e+1)} of the post`,source:{path:o},...t===``?{}:{text:t}}))],where:i?`where the post is written`:`as LinkedIn's feed will show it`})}});let A=t=>{(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`z`&&(t.preventDefault(),t.shiftKey?e.redo():e.undo())},j=(t,n,r)=>{d||e.edit(t,n,r)},M=(0,X.jsx)(ne,{start:d?void 0:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{label:c.undo,disabled:!f.canUndo,onClick:()=>{e.undo()},children:(0,X.jsx)(de,{})}),(0,X.jsx)($,{label:c.redo,disabled:!f.canRedo,onClick:()=>{e.redo()},children:(0,X.jsx)(ue,{})})]}),saved:{state:f.state},exports:{}}),N=l?.theme===`dark`;if(_===void 0)return(0,X.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`linkedin-post-editor`,children:[M,(0,X.jsx)(`p`,{className:`text-muted-foreground mx-auto max-w-xl p-6 text-sm`,children:c.unreadable(f.unreadable??``)})]});let P=_.content,I=(e,t)=>{let n=k.get(e),r=Q(e);return r===`document`?{kind:`document`,file:e,label:e.split(`/`).pop()}:n===void 0?{kind:`made`,label:w(e)?`${e} · ${c.made}`:e,file:e}:{kind:r??`picture`,src:n,alt:t,file:e}},L=P?.media?{type:`media`,medium:I(P.media.file,P.media.altText),title:P.media.title}:P?.multiImage?{type:`multiImage`,images:P.multiImage.images.map(e=>I(e.file,e.altText))}:P?.poll?{type:`poll`,question:P.poll.question,options:P.poll.options.map(e=>e.text),duration:P.poll.settings?.duration}:P?.article?{type:`article`,source:P.article.source,title:P.article.title,description:P.article.description,thumbnail:P.article.thumbnail===void 0?void 0:I(P.article.thumbnail)}:void 0,R=e=>{j(c.steps.media,t=>{let n=t.content;if(n?.multiImage){let r=n.multiImage.images.filter((t,n)=>n!==e),[i]=r;return Z(t,r.length>1?{multiImage:{images:r}}:i?{media:i}:void 0)}if(n?.article){let e={...n.article};return delete e.thumbnail,Z(t,{article:e})}return Z(t,void 0)})},H=e=>{let t=(P?.multiImage?P.multiImage.images:P?.media&&Q(P.media.file)===`picture`?[P.media]:[])[e];if(t!==void 0)return{value:t.altText,onAlt:t=>{j(c.steps.alt,n=>{let r=e=>{let n={...e};return t.trim()===``?delete n.altText:n.altText=t,n},i=n.content;return i?.multiImage?Z(n,{multiImage:{images:i.multiImage.images.map((t,n)=>n===e?r(t):t)}}):i?.media?Z(n,{media:r(i.media)}):n})}}},U=P?.poll!==void 0||P?.article!==void 0||(P?.multiImage?.images.length??0)>=V.pictures.most||P?.media!==void 0&&Q(P.media.file)!==`picture`,W=(e,t)=>(0,X.jsx)(te,{className:`w-auto`,align:`start`,children:(0,X.jsx)(oe,{self:o,types:e,testId:`linkedin-picker`,onPick:e=>{m(void 0),t(ie(r,e))}})}),G=_.visibility??`PUBLIC`,De=(0,X.jsxs)(`div`,{ref:D,className:`ak-li ak-li-composer relative`,"data-theme":N?`dark`:`light`,"data-testid":`linkedin-composer`,children:[(0,X.jsxs)(`div`,{className:`ak-li-c-head`,children:[(0,X.jsx)(xe,{visibility:G,avatar:64}),(0,X.jsxs)(ge,{children:[(0,X.jsx)(fe,{asChild:!0,disabled:d,children:(0,X.jsxs)(u,{variant:`secondary`,size:`sm`,className:`ak-li-pill`,"data-testid":`linkedin-visibility`,children:[G===`CONNECTIONS`?(0,X.jsx)(Ee,{}):(0,X.jsx)(he,{}),c.postTo(G===`CONNECTIONS`?c.connections:c.anyone),(0,X.jsx)(_e,{})]})}),(0,X.jsx)(pe,{align:`start`,children:(0,X.jsxs)(ve,{value:G,onValueChange:e=>{j(c.steps.visibility,t=>{let n={...t};return e===`PUBLIC`?delete n.visibility:n.visibility=`CONNECTIONS`,n})},children:[(0,X.jsx)(E,{value:`PUBLIC`,children:c.anyone}),(0,X.jsx)(E,{value:`CONNECTIONS`,children:c.connections})]})})]})]}),(0,X.jsxs)(`div`,{className:`ak-li-field`,children:[(0,X.jsxs)(`div`,{className:`ak-li-field-words`,"aria-hidden":`true`,children:[(0,X.jsx)(Ce,{text:_.commentary}),_.commentary.endsWith(`
|
|
3
|
-
`)?``:null]}),(0,X.jsx)(`textarea`,{dir:`auto`,value:_.commentary,placeholder:c.share,"aria-label":c.share,readOnly:d,"data-testid":`linkedin-commentary`,onChange:e=>{let t=e.target.value;j(c.steps.text,e=>({...e,commentary:t}),`commentary`)},onBlur:()=>{e.settle()}})]}),P?.poll?(0,X.jsx)(Ge,{poll:P.poll,locked:d,onChange:(e,t)=>{j(c.steps.poll,t=>Z(t,{poll:e}),t===void 0?void 0:`poll-${t}`)},onRemove:()=>{j(c.steps.poll,e=>Z(e,void 0))}}):(0,X.jsxs)(X.Fragment,{children:[P?.article?(0,X.jsx)(Ke,{article:P.article,locked:d,onChange:(e,t)=>{j(c.steps.link,t=>Z(t,{article:e}),`link-${t??``}`)}}):null,(0,X.jsx)(Te,{content:L,onMedium:d?void 0:e=>(0,X.jsx)(We,{alt:H(e),onRemove:()=>{R(e)}})}),P?.media&&Q(P.media.file)!==`picture`?(0,X.jsx)(`input`,{className:`ak-li-doc-title-field`,value:P.media.title??``,placeholder:c.documentTitle,"aria-label":c.documentTitle,readOnly:d,onChange:e=>{let t=e.target.value;j(c.steps.title,e=>{let n=e.content?.media;if(!n)return e;let r={...n};return t===``?delete r.title:r.title=t,Z(e,{media:r})},`title`)}}):null]}),d?null:(0,X.jsxs)(`div`,{className:`ak-li-c-tools`,children:[(0,X.jsxs)(b,{open:p===`media`,onOpenChange:e=>{m(e?`media`:void 0)},children:[(0,X.jsx)(x,{asChild:!0,children:(0,X.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":P?.multiImage?c.addPicture:c.addMedia,title:P?.multiImage?c.addPicture:c.addMedia,disabled:U,children:(0,X.jsx)(C,{})})}),W(P?.multiImage||P?.media?z:be,e=>{j(c.steps.media,t=>Z(t,He(t.content,e)))})]}),(0,X.jsxs)(b,{open:p===`document`,onOpenChange:e=>{m(e?`document`:void 0)},children:[(0,X.jsx)(x,{asChild:!0,children:(0,X.jsx)(u,{variant:`ghost`,size:`icon-sm`,"aria-label":c.addDocument,title:c.addDocument,disabled:P!==void 0,children:(0,X.jsx)(me,{})})}),W(Se,e=>{j(c.steps.media,t=>Z(t,{media:{file:e}}))})]}),(0,X.jsx)($,{label:c.addPoll,disabled:P!==void 0,onClick:()=>{j(c.steps.poll,e=>Z(e,{poll:{question:``,options:[{text:``},{text:``}]}}))},children:(0,X.jsx)(ee,{})}),(0,X.jsx)($,{label:c.addLink,disabled:P!==void 0,onClick:()=>{j(c.steps.link,e=>Z(e,{article:{source:`https://`}}))},children:(0,X.jsx)(le,{})}),P?.article&&P.article.thumbnail===void 0?(0,X.jsxs)(b,{open:p===`thumbnail`,onOpenChange:e=>{m(e?`thumbnail`:void 0)},children:[(0,X.jsx)(x,{asChild:!0,children:(0,X.jsxs)(u,{variant:`ghost`,size:`sm`,children:[(0,X.jsx)(C,{}),c.link.thumbnail]})}),W(z,e=>{j(c.steps.link,t=>t.content?.article?Z(t,{article:{...t.content.article,thumbnail:e}}):t)})]}):null,(0,X.jsx)(`span`,{className:`flex-1`}),(0,X.jsx)(Ue,{text:_.commentary})]}),v&&T?(0,X.jsx)(ye,{"data-testid":`linkedin-agent-box`,label:S(v),className:`inset-1`}):null]}),K={commentary:_.commentary,visibility:G,content:L},Oe=(0,X.jsxs)(`div`,{ref:O,className:`ak-li ak-li-previews relative`,"data-theme":N?`dark`:`light`,children:[(0,X.jsx)(F,{post:K,lines:3,onFolded:g}),h?(0,X.jsx)(F,{post:K}):null,v&&T?(0,X.jsx)(ye,{"data-testid":`linkedin-agent-shown`,className:`inset-0`}):null]});return(0,X.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`linkedin-post-editor`,onKeyDown:A,children:[M,(0,X.jsx)(we.Provider,{value:se,children:(0,X.jsx)(ce,{edit:De,preview:Oe,width:552,background:N?`#000000`:`#f4f2ee`,testId:`linkedin-preview`})})]})}function Je(){let e=B(),t=r(),n=a(),i=n?.item.entry,o=n?.item.dir??``,[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)();return(0,Y.useEffect)(()=>{if(i===void 0)return;let e,n=!0;return Be.open(t,i).then(t=>{n?(e=t,c(t)):t.close()},e=>{n&&u(e instanceof Error?e.message:String(e))}),()=>{n=!1,e?.close()}},[t,i]),!s||i===void 0?(0,X.jsx)(`div`,{className:`text-muted-foreground flex size-full items-center justify-center text-sm`,"data-testid":`linkedin-post-editor`,"data-state":l===void 0?`loading`:`error`,children:l===void 0?e.loading:e.couldNotOpen(l)}):(0,X.jsx)(qe,{doc:s,dir:o,entry:i})}export{Je as LinkedInPostEditor,Je as default,Be as PostDocument,R as WORDS};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,c as n,i as r,o as i,s as a,t as o,v as s}from"./react-Bk7NnOLX.js";import{$ as c,At as l,B as u,G as d,H as f,J as p,K as m,Q as h,R as g,U as _,V as v,W as y,X as b,Y as x,Z as S,_t as C,a as ee,at as w,dt as T,gt as E,i as te,lt as D,mt as O,n as ne,nt as k,o as re,ot as A,pt as j,q as ie,r as ae,rt as M,t as oe,tt as se,yt as ce,z as le}from"./button-BVQH7zxz.js";import{o as ue}from"./snapshots-CTS2iez5.js";import{t as de}from"./jsx-runtime-DePvh3-m.js";import{t as N}from"./createLucideIcon-REX213UO.js";import{n as fe,t as pe}from"./progress-udl4pNsP.js";import{B as me,E as he,F as ge,G as _e,H as ve,I as ye,J as be,L as xe,M as Se,N as Ce,P as we,R as Te,U as Ee,V as De,W as Oe,Y as ke,_ as Ae,_t as P,a as je,c as Me,dt as Ne,h as Pe,i as Fe,it as Ie,l as Le,lt as Re,o as ze,p as Be,s as Ve,t as F,x as He,z as Ue}from"./index-BGAXezRR.js";var We=N(`chevron-left`,[[`path`,{d:`m15 18-6-6 6-6`,key:`1wnfg3`}]]),Ge=N(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),Ke=N(`ellipsis-vertical`,[[`circle`,{cx:`12`,cy:`12`,r:`1`,key:`41hilf`}],[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`circle`,{cx:`12`,cy:`19`,r:`1`,key:`lyex9k`}]]),qe=N(`file-archive`,[[`path`,{d:`M13.659 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v11.5`,key:`4pqfef`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 12v-1`,key:`1ej8lb`}],[`path`,{d:`M8 18v-2`,key:`qcmpov`}],[`path`,{d:`M8 7V6`,key:`1nbb54`}],[`circle`,{cx:`8`,cy:`20`,r:`2`,key:`ckkr5m`}]]),Je=N(`file-box`,[[`path`,{d:`M14.5 22H18a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v3.8`,key:`1kchwa`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11.7 14.2 7 17l-4.7-2.8`,key:`1yk8tc`}],[`path`,{d:`M3 13.1a2 2 0 0 0-.999 1.76v3.24a2 2 0 0 0 .969 1.78L6 21.7a2 2 0 0 0 2.03.01L11 19.9a2 2 0 0 0 1-1.76V14.9a2 2 0 0 0-.97-1.78L8 11.3a2 2 0 0 0-2.03-.01z`,key:`19flxy`}],[`path`,{d:`M7 17v5`,key:`1yj1jh`}]]),Ye=N(`file-braces`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1`,key:`1oajmo`}],[`path`,{d:`M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1`,key:`mpwhp6`}]]),Xe=N(`file-chart-column`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 18v-1`,key:`zg0ygc`}],[`path`,{d:`M12 18v-6`,key:`17g6i2`}],[`path`,{d:`M16 18v-3`,key:`j5jt4h`}]]),Ze=N(`file-code`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M10 12.5 8 15l2 2.5`,key:`1tg20x`}],[`path`,{d:`m14 12.5 2 2.5-2 2.5`,key:`yinavb`}]]),Qe=N(`file-image`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`circle`,{cx:`10`,cy:`12`,r:`2`,key:`737tya`}],[`path`,{d:`m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22`,key:`wt3hpn`}]]),$e=N(`file-pen-line`,[[`path`,{d:`M14.364 13.634a2 2 0 0 0-.506.854l-.837 2.87a.5.5 0 0 0 .62.62l2.87-.837a2 2 0 0 0 .854-.506l4.013-4.009a1 1 0 0 0-3.004-3.004z`,key:`ukzhwg`}],[`path`,{d:`M14.487 7.858A1 1 0 0 1 14 7V2`,key:`1klhew`}],[`path`,{d:`M20 19.645V20a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l2.516 2.516`,key:`rxaxab`}],[`path`,{d:`M8 18h1`,key:`13wk12`}]]),et=N(`file-output`,[[`path`,{d:`M4.226 20.925A2 2 0 0 0 6 22h12a2 2 0 0 0 2-2V8a2.4 2.4 0 0 0-.706-1.706l-3.588-3.588A2.4 2.4 0 0 0 14 2H6a2 2 0 0 0-2 2v3.127`,key:`wfxp4w`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 11-3 3`,key:`1dgrs4`}],[`path`,{d:`m5 17-3-3h10`,key:`1mvvaf`}]]),tt=N(`file-play`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M15.033 13.44a.647.647 0 0 1 0 1.12l-4.065 2.352a.645.645 0 0 1-.968-.56v-4.704a.645.645 0 0 1 .967-.56z`,key:`1tzo1f`}]]),nt=N(`file-spreadsheet`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M8 13h2`,key:`yr2amv`}],[`path`,{d:`M14 13h2`,key:`un5t4a`}],[`path`,{d:`M8 17h2`,key:`2yhykz`}],[`path`,{d:`M14 17h2`,key:`10kma7`}]]),rt=N(`file-stack`,[[`path`,{d:`M11 21a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1v-8a1 1 0 0 1 1-1`,key:`likhh7`}],[`path`,{d:`M16 16a1 1 0 0 1-1 1H9a1 1 0 0 1-1-1V8a1 1 0 0 1 1-1`,key:`17ky3x`}],[`path`,{d:`M21 6a2 2 0 0 0-.586-1.414l-2-2A2 2 0 0 0 17 2h-3a1 1 0 0 0-1 1v8a1 1 0 0 0 1 1h6a1 1 0 0 0 1-1z`,key:`1hyeo0`}]]),it=N(`file-type`,[[`path`,{d:`M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z`,key:`1oefj6`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`M11 18h2`,key:`12mj7e`}],[`path`,{d:`M12 12v6`,key:`3ahymv`}],[`path`,{d:`M9 13v-.5a.5.5 0 0 1 .5-.5h5a.5.5 0 0 1 .5.5v.5`,key:`qbrxap`}]]),at=N(`file-video-camera`,[[`path`,{d:`M4 12V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2`,key:`jrl274`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m10 17.843 3.033-1.755a.64.64 0 0 1 .967.56v4.704a.65.65 0 0 1-.967.56L10 20.157`,key:`17aeo9`}],[`rect`,{width:`7`,height:`6`,x:`3`,y:`16`,rx:`1`,key:`s27ndx`}]]),ot=N(`folder-open`,[[`path`,{d:`m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2`,key:`usdka0`}]]),I=N(`pen-line`,[[`path`,{d:`M13 21h8`,key:`1jsn5i`}],[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}]]),st=N(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),ct=N(`share`,[[`path`,{d:`M12 2v13`,key:`1km8f5`}],[`path`,{d:`m16 6-4-4-4 4`,key:`13yo43`}],[`path`,{d:`M4 12v8a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-8`,key:`1b2hhj`}]]),L=e(s(),1),R=de(),lt=Object.defineProperty,z=(e,t)=>lt(e,`name`,{value:t,configurable:!0}),ut=`Checkbox`,[dt,ft]=A(ut),[pt,mt]=dt(ut);function ht(e){let{__scopeCheckbox:t,checked:n,children:r,defaultChecked:i,disabled:a,form:o,name:s,onCheckedChange:c,required:l,value:u=`on`,internal_do_not_use_render:d}=e,[f,p]=M({prop:n,defaultProp:i??!1,onChange:c,caller:ut}),[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useRef(!1),[y,b]=L.useReducer(e=>e+1,0),x=!m||!!o||!!m.closest(`form`),S={checked:f,disabled:a,setChecked:p,control:m,setControl:h,name:s,form:o,value:u,hasConsumerStoppedPropagationRef:v,userInteractionCount:y,onUserInteraction:b,required:l,defaultChecked:!B(i)&&i,isFormControl:x,bubbleInput:g,setBubbleInput:_};return(0,R.jsx)(pt,{scope:t,...S,children:Ct(d)?d(S):r})}z(ht,`CheckboxProvider`);var gt=`CheckboxTrigger`,_t=L.forwardRef(z(function({__scopeCheckbox:e,onKeyDown:t,onClick:n,...r},i){let{control:a,value:o,disabled:s,checked:c,required:l,setControl:u,setChecked:d,hasConsumerStoppedPropagationRef:f,onUserInteraction:p,isFormControl:m,bubbleInput:h}=mt(gt,e),g=j(i,u),_=L.useRef(c);return L.useEffect(()=>{let e=a?.form;if(e){let t=z(()=>d(_.current),`reset`);return e.addEventListener(`reset`,t),()=>e.removeEventListener(`reset`,t)}},[a,d]),(0,R.jsx)(D.button,{type:`button`,role:`checkbox`,"aria-checked":B(c)?`mixed`:c,"aria-required":l,"data-state":wt(c),"data-disabled":s?``:void 0,disabled:s,value:o,...r,ref:g,onKeyDown:w(t,e=>{e.key===`Enter`&&e.preventDefault()}),onClick:w(n,e=>{p(),d(e=>B(e)?!0:!e),h&&m&&(f.current=e.isPropagationStopped(),f.current||e.stopPropagation())})})},`CheckboxTrigger`)),vt=L.forwardRef(z(function(e,t){let{__scopeCheckbox:n,name:r,checked:i,defaultChecked:a,required:o,disabled:s,value:c,onCheckedChange:l,form:u,...d}=e;return(0,R.jsx)(ht,{__scopeCheckbox:n,checked:i,defaultChecked:a,disabled:s,required:o,onCheckedChange:l,name:r,form:u,value:c,internal_do_not_use_render:({isFormControl:e})=>(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(_t,{...d,ref:t,__scopeCheckbox:n}),e&&(0,R.jsx)(St,{__scopeCheckbox:n})]})})},`Checkbox`)),yt=`CheckboxIndicator`,bt=L.forwardRef(z(function(e,t){let{__scopeCheckbox:n,forceMount:r,...i}=e,a=mt(yt,n);return(0,R.jsx)(k,{present:r||B(a.checked)||a.checked===!0,children:(0,R.jsx)(D.span,{"data-state":wt(a.checked),"data-disabled":a.disabled?``:void 0,...i,ref:t,style:{pointerEvents:`none`,...e.style}})})},`CheckboxIndicator`)),xt=`CheckboxBubbleInput`,St=L.forwardRef(z(function({__scopeCheckbox:e,onClick:t,...n},r){let{control:i,hasConsumerStoppedPropagationRef:a,userInteractionCount:o,checked:s,defaultChecked:c,required:l,disabled:u,name:d,value:f,form:p,bubbleInput:m,setBubbleInput:h}=mt(xt,e),_=j(r,h),v=g(i),y=L.useRef(!1),b=L.useRef(s),x=L.useRef(o);L.useEffect(()=>{let e=m;if(!e)return;let t=window.HTMLInputElement.prototype,n=Object.getOwnPropertyDescriptor(t,`checked`).set,r=o!==x.current;x.current=o;let i=b.current!==s;b.current=s;let c=!(r&&a.current);if(i&&n){y.current=!r;let t=new Event(`click`,{bubbles:c});e.indeterminate=B(s),n.call(e,!B(s)&&s),e.dispatchEvent(t),y.current=!1}},[m,s,a,o]);let S=L.useRef(!B(s)&&s);return(0,R.jsx)(D.input,{type:`checkbox`,"aria-hidden":!0,defaultChecked:c??S.current,required:l,disabled:u,name:d,value:f,form:p,...n,tabIndex:-1,ref:_,onClick:w(t,e=>{y.current&&e.stopPropagation()}),style:{...n.style,...v,position:`absolute`,pointerEvents:`none`,opacity:0,margin:0,transform:`translateX(-100%)`}})},`CheckboxBubbleInput`));function Ct(e){return typeof e==`function`}z(Ct,`isFunction`);function B(e){return e===`indeterminate`}z(B,`isIndeterminate`);function wt(e){return B(e)?`indeterminate`:e?`checked`:`unchecked`}z(wt,`getState`);var Tt=Object.defineProperty,V=(e,t)=>Tt(e,`name`,{value:t,configurable:!0}),Et=`ContextMenu`,[Dt,Ot]=A(Et,[De]),H=De(),[kt,At]=Dt(Et),jt=V(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,s=L.useRef(!1),[c,l]=M({prop:i,defaultProp:!1,onChange:r,caller:Et}),u=H(t);return(0,R.jsx)(kt,{scope:t,open:c,onOpenChange:l,modal:o,hasInteractedRef:s,children:(0,R.jsx)(Se,{...u,dir:a,open:c,onOpenChange:l,modal:o,children:n})})},`ContextMenu`),Mt=`ContextMenuTrigger`,Nt=L.forwardRef(V(function(e,t){let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=At(Mt,n),o=H(n),[s,c]=L.useState({x:0,y:0}),l=L.useMemo(()=>({current:{getBoundingClientRect:V(()=>DOMRect.fromRect({width:0,height:0,...s}),`getBoundingClientRect`)}}),[s]),u=L.useRef(0),d=L.useCallback(()=>window.clearTimeout(u.current),[]),f=V(e=>{a.hasInteractedRef.current=!0,c({x:e.clientX,y:e.clientY}),a.onOpenChange(!0)},`handleOpen`);return L.useEffect(()=>d,[d]),L.useEffect(()=>void(r&&d()),[r,d]),(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(Ce,{...o,virtualRef:l}),(0,R.jsx)(D.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:w(e.onContextMenu,e=>{d(),f(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:w(e.onPointerDown,Ut(e=>{d(),a.open&&a.onOpenChange(!1),u.current=window.setTimeout(()=>f(e),700)})),onPointerMove:r?e.onPointerMove:w(e.onPointerMove,Ut(d)),onPointerCancel:r?e.onPointerCancel:w(e.onPointerCancel,Ut(d)),onPointerUp:r?e.onPointerUp:w(e.onPointerUp,Ut(d))})]})},`ContextMenuTrigger`)),Pt=V(e=>{let{__scopeContextMenu:t,...n}=e,r=H(t);return(0,R.jsx)(ye,{...r,...n})},`ContextMenuPortal`),Ft=`ContextMenuContent`,It=L.forwardRef(V(function(e,t){let{__scopeContextMenu:n,...r}=e,i=At(Ft,n),a=H(n),o=L.useRef(!1);return(0,R.jsx)(we,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuContent`)),Lt=L.forwardRef(V(function(e,t){let{__scopeContextMenu:n,...r}=e,i=H(n);return(0,R.jsx)(ge,{...i,...r,ref:t})},`ContextMenuItem`)),Rt=L.forwardRef(V(function(e,t){let{__scopeContextMenu:n,...r}=e,i=H(n);return(0,R.jsx)(xe,{...i,...r,ref:t})},`ContextMenuSeparator`)),zt=`ContextMenuSub`,Bt=V(e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=H(t),[s,c]=M({prop:i,defaultProp:a??!1,onChange:r,caller:zt});return(0,R.jsx)(Te,{...o,open:s,onOpenChange:c,children:n})},`ContextMenuSub`),Vt=L.forwardRef(V(function(e,t){let{__scopeContextMenu:n,...r}=e,i=H(n);return(0,R.jsx)(me,{...i,...r,ref:t})},`ContextMenuSubTrigger`)),Ht=L.forwardRef(V(function(e,t){let{__scopeContextMenu:n,...r}=e,i=H(n);return(0,R.jsx)(Ue,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})},`ContextMenuSubContent`));function Ut(e){return t=>t.pointerType===`mouse`?void 0:e(t)}V(Ut,`whenTouchOrPen`);var Wt=Object.defineProperty,U=(e,t)=>Wt(e,`name`,{value:t,configurable:!0}),Gt=`Popover`,[Kt,qt]=A(Gt,[re]),W=re(),[Jt,G]=Kt(Gt),Yt=U(e=>{let{__scopePopover:t,children:n,open:r,defaultOpen:i,onOpenChange:a,modal:o=!1}=e,s=W(t),c=L.useRef(null),[l,u]=L.useState(!1),[d,f]=L.useState(0),[p,m]=L.useState(0),[h,g]=M({prop:r,defaultProp:i??!1,onChange:a,caller:Gt});return(0,R.jsx)(ne,{...s,children:(0,R.jsx)(Jt,{scope:t,contentId:se(),titleId:se(),descriptionId:se(),titlePresent:d>0,descriptionPresent:p>0,setTitleCount:f,setDescriptionCount:m,triggerRef:c,open:h,onOpenChange:g,onOpenToggle:L.useCallback(()=>g(e=>!e),[g]),hasCustomAnchor:l,onCustomAnchorAdd:L.useCallback(()=>u(!0),[]),onCustomAnchorRemove:L.useCallback(()=>u(!1),[]),modal:o,children:n})})},`Popover`),Xt=`PopoverAnchor`,Zt=L.forwardRef(U(function(e,t){let{__scopePopover:n,...r}=e,i=G(Xt,n),a=W(n),{onCustomAnchorAdd:o,onCustomAnchorRemove:s}=i;return L.useEffect(()=>(o(),()=>s()),[o,s]),(0,R.jsx)(ae,{...a,...r,ref:t})},`PopoverAnchor`)),Qt=`PopoverTrigger`,$t=L.forwardRef(U(function(e,t){let{__scopePopover:n,...r}=e,i=G(Qt,n),a=W(n),o=j(t,i.triggerRef),s=(0,R.jsx)(D.button,{type:`button`,"aria-haspopup":`dialog`,"aria-expanded":i.open,"aria-controls":i.open?i.contentId:void 0,"data-state":dn(i.open),...r,ref:o,onClick:w(e.onClick,i.onOpenToggle)});return i.hasCustomAnchor?s:(0,R.jsx)(ae,{asChild:!0,...a,children:s})},`PopoverTrigger`)),en=`PopoverPortal`,[tn,nn]=Kt(en,{forceMount:void 0}),rn=U(e=>{let{__scopePopover:t,forceMount:n,children:r,container:i}=e,a=G(en,t);return(0,R.jsx)(tn,{scope:t,forceMount:n,children:(0,R.jsx)(k,{present:n||a.open,children:(0,R.jsx)(p,{asChild:!0,container:i,children:r})})})},`PopoverPortal`),K=`PopoverContent`,an=L.forwardRef(U(function(e,t){let n=nn(K,e.__scopePopover),{forceMount:r=n.forceMount,...i}=e,a=G(K,e.__scopePopover);return(0,R.jsx)(k,{present:r||a.open,children:a.modal?(0,R.jsx)(sn,{...i,ref:t}):(0,R.jsx)(cn,{...i,ref:t})})},`PopoverContent`)),on=T(`PopoverContent.RemoveScroll`),sn=L.forwardRef(U(function(e,t){let n=G(K,e.__scopePopover),r=L.useRef(null),i=j(t,r),a=L.useRef(!1),{nodes:o,registry:s}=h();return L.useEffect(()=>{let e=r.current;if(e)return d(e)},[]),(0,R.jsx)(m,{as:on,allowPinchZoom:!0,shards:L.useMemo(()=>[r,...o.map(e=>({current:e}))],[r,o]),children:(0,R.jsx)(ln,{...e,ref:i,branchNodes:o,branchRegistry:s,trapFocus:n.open,disableOutsidePointerEvents:!0,onCloseAutoFocus:w(e.onCloseAutoFocus,e=>{e.preventDefault(),a.current||n.triggerRef.current?.focus()}),onPointerDownOutside:w(e.onPointerDownOutside,e=>{let t=e.detail.originalEvent,n=t.button===0&&t.ctrlKey===!0,r=t.button===2||n;a.current=r},{checkForDefaultPrevented:!1}),onFocusOutside:w(e.onFocusOutside,e=>e.preventDefault(),{checkForDefaultPrevented:!1})})})},`PopoverContentModal`)),cn=L.forwardRef(U(function(e,t){let n=G(K,e.__scopePopover),r=L.useRef(!1),i=L.useRef(!1);return(0,R.jsx)(ln,{...e,ref:t,trapFocus:!1,disableOutsidePointerEvents:!1,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),t.defaultPrevented||(r.current||n.triggerRef.current?.focus(),t.preventDefault()),r.current=!1,i.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),t.defaultPrevented||(r.current=!0,t.detail.originalEvent.type===`pointerdown`&&(i.current=!0));let a=t.target;n.triggerRef.current?.contains(a)&&t.preventDefault(),t.detail.originalEvent.type===`focusin`&&i.current&&t.preventDefault()}})},`PopoverContentNonModal`)),ln=L.forwardRef(U(function(e,t){let{__scopePopover:n,trapFocus:r,onOpenAutoFocus:i,onCloseAutoFocus:a,disableOutsidePointerEvents:o,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u,onInteractOutside:d,"aria-describedby":f,branchNodes:p,branchRegistry:m,...h}=e,g=G(K,n),_=W(n),[v,y]=L.useState(null),C=j(t,y);return S(v),ie(),(0,R.jsx)(b,{registry:m,children:(0,R.jsx)(x,{asChild:!0,loop:!0,trapped:r,branches:p,onMountAutoFocus:i,onUnmountAutoFocus:a,children:(0,R.jsx)(c,{asChild:!0,disableOutsidePointerEvents:o,onInteractOutside:d,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:u,onDismiss:()=>g.onOpenChange(!1),deferPointerDownOutside:!0,children:(0,R.jsx)(ee,{"data-state":dn(g.open),role:`dialog`,id:g.contentId,"aria-labelledby":g.titlePresent?g.titleId:void 0,"aria-describedby":g.descriptionPresent?fn(f,g.descriptionId):f,..._,...h,ref:C,style:{...h.style,"--radix-popover-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-popover-content-available-width":`var(--radix-popper-available-width)`,"--radix-popover-content-available-height":`var(--radix-popper-available-height)`,"--radix-popover-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-popover-trigger-height":`var(--radix-popper-anchor-height)`}})})})})},`PopoverContentImpl`)),un=L.forwardRef(U(function(e,t){let{__scopePopover:n,...r}=e,i=W(n);return(0,R.jsx)(te,{...i,...r,ref:t})},`PopoverArrow`));function dn(e){return e?`open`:`closed`}U(dn,`getState`);function fn(...e){let t=new Set;for(let n of e)if(typeof n==`string`)for(let e of String(n).trim().split(/\s+/))e&&t.add(e);return t.size>0?Array.from(t).join(` `):void 0}U(fn,`concatAriaDescribedby`);var pn=Object.defineProperty,mn=(e,t)=>pn(e,`name`,{value:t,configurable:!0}),hn=`Toggle`,gn=L.forwardRef(mn(function(e,t){let{pressed:n,defaultPressed:r,onPressedChange:i,...a}=e,[o,s]=M({prop:n,onChange:i,defaultProp:r??!1,caller:hn});return(0,R.jsx)(D.button,{type:`button`,"aria-pressed":o,"data-state":o?`on`:`off`,"data-disabled":e.disabled?``:void 0,...a,ref:t,onClick:w(e.onClick,()=>{e.disabled||s(!o)})})},`Toggle`)),_n=Object.defineProperty,q=(e,t)=>_n(e,`name`,{value:t,configurable:!0}),J=`ToggleGroup`,Y={Single:`single`,Multiple:`multiple`},[vn,yn]=A(J,[Oe]),bn=Oe(),xn=L.forwardRef(q(function(e,t){let{type:n,...r}=e;if(n===Y.Single)return(0,R.jsx)(wn,{role:`radiogroup`,...r,ref:t});if(n===Y.Multiple)return(0,R.jsx)(Tn,{role:`toolbar`,...r,ref:t});throw Error(`Missing prop \`type\` expected on \`${J}\``)},`ToggleGroup`)),[Sn,Cn]=vn(J),wn=L.forwardRef(q(function(e,t){let{value:n,defaultValue:r,onValueChange:i=q(()=>{},`onValueChange`),...a}=e,[o,s]=M({prop:n,defaultProp:r??``,onChange:i,caller:J});return(0,R.jsx)(Sn,{scope:e.__scopeToggleGroup,type:Y.Single,value:L.useMemo(()=>o?[o]:[],[o]),onItemActivate:s,onItemDeactivate:L.useCallback(()=>s(``),[s]),children:(0,R.jsx)(On,{...a,ref:t})})},`ToggleGroupImplSingle`)),Tn=L.forwardRef(q(function(e,t){let{value:n,defaultValue:r,onValueChange:i=q(()=>{},`onValueChange`),...a}=e,[o,s]=M({prop:n,defaultProp:r??[],onChange:i,caller:J}),c=L.useCallback(e=>s((t=[])=>[...t,e]),[s]),l=L.useCallback(e=>s((t=[])=>t.filter(t=>t!==e)),[s]);return(0,R.jsx)(Sn,{scope:e.__scopeToggleGroup,type:Y.Multiple,value:o,onItemActivate:c,onItemDeactivate:l,children:(0,R.jsx)(On,{...a,ref:t})})},`ToggleGroupImplMultiple`)),[En,Dn]=vn(J),On=L.forwardRef(q(function(e,t){let{__scopeToggleGroup:n,disabled:r=!1,rovingFocus:i=!0,orientation:a,dir:o,loop:s=!0,...c}=e,l=bn(n),u=_e(o),d={dir:u,...c};return(0,R.jsx)(En,{scope:n,rovingFocus:i,disabled:r,children:i?(0,R.jsx)(ve,{asChild:!0,...l,orientation:a,dir:u,loop:s,children:(0,R.jsx)(D.div,{...d,ref:t})}):(0,R.jsx)(D.div,{...d,ref:t})})},`ToggleGroupImpl`)),kn=`ToggleGroupItem`,An=L.forwardRef(q(function(e,t){let n=Cn(kn,e.__scopeToggleGroup),r=Dn(kn,e.__scopeToggleGroup),i=bn(e.__scopeToggleGroup),a=n.value.includes(e.value),o=r.disabled||e.disabled,s={...e,pressed:a,disabled:o},c=L.useRef(null);return r.rovingFocus?(0,R.jsx)(Ee,{asChild:!0,...i,focusable:!o,active:a,ref:c,children:(0,R.jsx)(jn,{...s,ref:t})}):(0,R.jsx)(jn,{...s,ref:t})},`ToggleGroupItem`)),jn=L.forwardRef(q(function(e,t){let{__scopeToggleGroup:n,value:r,...i}=e,a=Cn(kn,n),o={role:`radio`,"aria-checked":e.pressed,"aria-pressed":void 0},s=a.type===Y.Single?o:void 0;return(0,R.jsx)(gn,{...s,...i,ref:t,onPressedChange:e=>{e?a.onItemActivate(r):a.onItemDeactivate(r)}})},`ToggleGroupItemImpl`)),X=ce({en:{saved:{saved:`Saved`,saving:`Saving…`,unsaved:`Not saved yet`,error:`Not saved`},agentDoing:{editing:e=>`${e} is editing`,looking:e=>`${e} is looking`},follow:e=>`Follow ${e}`,unfollow:e=>`Stop following ${e}`,markUp:`Mark up`,markUpHint:`Mark up what is on show, and AI makes the changes`,moreTools:`More`,export:`Export`,share:`Share`,exported:`Exported`,exportFailed:`Export failed`,format:`Format`,versions:`Languages`,include:`Include`,onShow:`On show`,all:e=>`All ${String(e)} languages`,choose:`Choose…`,chosen:e=>`${String(e)} chosen`,back:`Back`,checking:`Checking…`,blocked:e=>e===1?`1 must-fix problem stops the export`:`${String(e)} must-fix problems stop the export`,start:`Export`,queued:`Waiting`,queuedAhead:e=>`Waiting, ${String(e)} ahead`,running:e=>`Exporting ${String(e)}%`,cancel:`Cancel`,retry:`Try again`,failedHelp:e=>`Try again, or ask ${e} what went wrong.`,partial:`Some files could not be made.`,startFailed:`The export did not start`,nVersions:e=>`${String(e)} versions`,show:`Show in folder`,download:`Download`,option:{pptx:{label:`Slides`,values:{native:`Editable`,picture:`Pictures`}},steps:{label:`Each animation step`},scale:{label:`Size`}},type:{mov:`MOV (ProRes)`,srt:`Captions`,cover:`Cover image`,pptx:`PowerPoint`,zip:`ZIP (each board as a PNG)`}},"zh-cn":{saved:{saved:`已保存`,saving:`正在保存…`,unsaved:`尚未保存`,error:`没能保存`},agentDoing:{editing:e=>`${e} 正在编辑`,looking:e=>`${e} 正在查看`},follow:e=>`跟随 ${e}`,unfollow:e=>`停止跟随 ${e}`,markUp:`批改`,markUpHint:`在画面上批改,AI 照着改`,moreTools:`更多`,export:`导出`,share:`分享`,exported:`已导出`,exportFailed:`导出失败`,format:`格式`,versions:`语言`,include:`附带`,onShow:`当前`,all:e=>`全部 ${String(e)} 种语言`,choose:`选择…`,chosen:e=>`已选 ${String(e)} 个`,back:`返回`,checking:`检查中…`,blocked:e=>`有 ${String(e)} 个必修问题,暂时不能导出`,start:`导出`,queued:`排队中`,queuedAhead:e=>`排队中,前面还有 ${String(e)} 个`,running:e=>`导出中 ${String(e)}%`,cancel:`取消`,retry:`重试`,failedHelp:e=>`请重试,或让 ${e} 看看哪里出了问题。`,partial:`部分文件没能生成。`,startFailed:`导出没有开始`,nVersions:e=>`${String(e)} 个版本`,show:`在文件夹中显示`,download:`下载`,option:{pptx:{label:`幻灯片`,values:{native:`可编辑`,picture:`图片`}},steps:{label:`每个动画步骤`},scale:{label:`尺寸`}},type:{mov:`MOV(ProRes)`,srt:`字幕`,cover:`封面图`,pptx:`PowerPoint`,zip:`ZIP(每个画板一张 PNG)`}},"zh-tw":{saved:{saved:`已儲存`,saving:`正在儲存…`,unsaved:`尚未儲存`,error:`沒能儲存`},agentDoing:{editing:e=>`${e} 正在編輯`,looking:e=>`${e} 正在查看`},follow:e=>`跟隨 ${e}`,unfollow:e=>`停止跟隨 ${e}`,markUp:`批改`,markUpHint:`在畫面上批改,AI 照著改`,moreTools:`更多`,export:`匯出`,share:`分享`,exported:`已匯出`,exportFailed:`匯出失敗`,format:`格式`,versions:`語言`,include:`附帶`,onShow:`目前`,all:e=>`全部 ${String(e)} 種語言`,choose:`選擇…`,chosen:e=>`已選 ${String(e)} 個`,back:`返回`,checking:`檢查中…`,blocked:e=>`有 ${String(e)} 個必須修正的問題,暫時無法匯出`,start:`匯出`,queued:`排隊中`,queuedAhead:e=>`排隊中,前面還有 ${String(e)} 個`,running:e=>`匯出中 ${String(e)}%`,cancel:`取消`,retry:`重試`,failedHelp:e=>`請重試,或讓 ${e} 看看哪裡出了問題。`,partial:`部分檔案沒能產生。`,startFailed:`匯出沒有開始`,nVersions:e=>`${String(e)} 個版本`,show:`在資料夾中顯示`,download:`下載`,option:{pptx:{label:`投影片`,values:{native:`可編輯`,picture:`圖片`}},steps:{label:`每個動畫步驟`},scale:{label:`尺寸`}},type:{mov:`MOV(ProRes)`,srt:`字幕`,cover:`封面圖`,pptx:`PowerPoint`,zip:`ZIP(每個畫板一張 PNG)`}},ja:{saved:{saved:`保存済み`,saving:`保存中…`,unsaved:`未保存`,error:`保存できませんでした`},agentDoing:{editing:e=>`${e}が編集中`,looking:e=>`${e}が表示中`},follow:e=>`${e}をフォロー`,unfollow:e=>`${e}のフォローをやめる`,markUp:`赤入れ`,markUpHint:`画面に赤を入れると、AI が直します`,moreTools:`その他`,export:`書き出し`,share:`共有`,exported:`書き出し済み`,exportFailed:`書き出しに失敗`,format:`形式`,versions:`言語`,include:`追加`,onShow:`表示中`,all:e=>`全 ${String(e)} 言語`,choose:`選択…`,chosen:e=>`${String(e)} 件選択`,back:`戻る`,checking:`チェック中…`,blocked:e=>`要修正の問題が ${String(e)} 件あるため書き出せません`,start:`書き出す`,queued:`待機中`,queuedAhead:e=>`待機中、前に ${String(e)} 件`,running:e=>`書き出し中 ${String(e)}%`,cancel:`キャンセル`,retry:`再試行`,failedHelp:e=>`もう一度試すか、${e} に原因を確認してください。`,partial:`一部のファイルを作成できませんでした。`,startFailed:`書き出しを開始できませんでした`,nVersions:e=>`${String(e)} 個のバージョン`,show:`フォルダに表示`,download:`ダウンロード`,option:{pptx:{label:`スライド`,values:{native:`編集可能`,picture:`画像`}},steps:{label:`アニメーションの各ステップ`},scale:{label:`サイズ`}},type:{mov:`MOV(ProRes)`,srt:`字幕`,cover:`カバー画像`,pptx:`PowerPoint`,zip:`ZIP(各ボードを PNG で)`}},ko:{saved:{saved:`저장됨`,saving:`저장 중…`,unsaved:`아직 저장되지 않음`,error:`저장되지 않음`},agentDoing:{editing:e=>`${e} 편집 중`,looking:e=>`${e} 보는 중`},follow:e=>`${e} 따라가기`,unfollow:e=>`${e} 따라가기 중지`,markUp:`첨삭`,markUpHint:`화면에 첨삭하면 AI가 고쳐 줍니다`,moreTools:`더보기`,export:`내보내기`,share:`공유`,exported:`내보냄`,exportFailed:`내보내기 실패`,format:`형식`,versions:`언어`,include:`포함`,onShow:`현재`,all:e=>`${String(e)}개 언어 모두`,choose:`선택…`,chosen:e=>`${String(e)}개 선택`,back:`뒤로`,checking:`확인 중…`,blocked:e=>`수정이 필요한 문제 ${String(e)}개 때문에 내보낼 수 없습니다`,start:`내보내기`,queued:`대기 중`,queuedAhead:e=>`대기 중, 앞에 ${String(e)}개`,running:e=>`내보내는 중 ${String(e)}%`,cancel:`취소`,retry:`다시 시도`,failedHelp:e=>`다시 시도하거나 ${e}에게 원인을 물어보세요.`,partial:`일부 파일을 만들지 못했습니다.`,startFailed:`내보내기를 시작하지 못했습니다`,nVersions:e=>`버전 ${String(e)}개`,show:`폴더에서 보기`,download:`다운로드`,option:{pptx:{label:`슬라이드`,values:{native:`편집 가능`,picture:`이미지`}},steps:{label:`애니메이션 단계별로`},scale:{label:`크기`}},type:{mov:`MOV (ProRes)`,srt:`자막`,cover:`표지 이미지`,pptx:`PowerPoint`,zip:`ZIP (보드마다 PNG)`}},es:{saved:{saved:`Guardado`,saving:`Guardando…`,unsaved:`Aún sin guardar`,error:`No guardado`},agentDoing:{editing:e=>`${e} está editando`,looking:e=>`${e} está mirando`},follow:e=>`Seguir a ${e}`,unfollow:e=>`Dejar de seguir a ${e}`,markUp:`Corregir`,markUpHint:`Corrige lo que ves y la IA hace los cambios`,moreTools:`Más`,export:`Exportar`,share:`Compartir`,exported:`Exportado`,exportFailed:`Error al exportar`,format:`Formato`,versions:`Idiomas`,include:`Incluir`,onShow:`Actual`,all:e=>`Los ${String(e)} idiomas`,choose:`Elegir…`,chosen:e=>`${String(e)} elegidos`,back:`Atrás`,checking:`Comprobando…`,blocked:e=>`${String(e)} problemas obligatorios detienen la exportación`,start:`Exportar`,queued:`En espera`,queuedAhead:e=>`En espera, ${String(e)} delante`,running:e=>`Exportando ${String(e)} %`,cancel:`Cancelar`,retry:`Reintentar`,failedHelp:e=>`Reinténtalo o pregunta a ${e} qué ha fallado.`,partial:`No se pudieron crear algunos archivos.`,startFailed:`La exportación no empezó`,nVersions:e=>`${String(e)} versiones`,show:`Mostrar en la carpeta`,download:`Descargar`,option:{pptx:{label:`Diapositivas`,values:{native:`Editables`,picture:`Imágenes`}},steps:{label:`Cada paso de animación`},scale:{label:`Tamaño`}},type:{mov:`MOV (ProRes)`,srt:`Subtítulos`,cover:`Imagen de portada`,pptx:`PowerPoint`,zip:`ZIP (cada mesa de trabajo en PNG)`}},fr:{saved:{saved:`Enregistré`,saving:`Enregistrement…`,unsaved:`Pas encore enregistré`,error:`Non enregistré`},agentDoing:{editing:e=>`${e} modifie`,looking:e=>`${e} regarde`},follow:e=>`Suivre ${e}`,unfollow:e=>`Ne plus suivre ${e}`,markUp:`Annoter`,markUpHint:`Annotez ce qui est affiché, et l'IA fait les changements`,moreTools:`Plus`,export:`Exporter`,share:`Partager`,exported:`Exporté`,exportFailed:`Échec de l’export`,format:`Format`,versions:`Langues`,include:`Inclure`,onShow:`Affichée`,all:e=>`Les ${String(e)} langues`,choose:`Choisir…`,chosen:e=>`${String(e)} choisies`,back:`Retour`,checking:`Vérification…`,blocked:e=>`${String(e)} problèmes à corriger bloquent l’export`,start:`Exporter`,queued:`En attente`,queuedAhead:e=>`En attente, ${String(e)} avant celui-ci`,running:e=>`Export ${String(e)}\u00a0%`,cancel:`Annuler`,retry:`Réessayer`,failedHelp:e=>`Réessayez ou demandez à ${e} ce qui n’a pas marché.`,partial:`Certains fichiers n’ont pas pu être créés.`,startFailed:`L’export n’a pas démarré`,nVersions:e=>`${String(e)} versions`,show:`Afficher dans le dossier`,download:`Télécharger`,option:{pptx:{label:`Diapositives`,values:{native:`Modifiables`,picture:`Images`}},steps:{label:`Chaque étape d'animation`},scale:{label:`Taille`}},type:{mov:`MOV (ProRes)`,srt:`Sous-titres`,cover:`Image de couverture`,pptx:`PowerPoint`,zip:`ZIP (chaque plan de travail en PNG)`}},de:{saved:{saved:`Gespeichert`,saving:`Wird gespeichert…`,unsaved:`Noch nicht gespeichert`,error:`Nicht gespeichert`},agentDoing:{editing:e=>`${e} bearbeitet`,looking:e=>`${e} schaut sich um`},follow:e=>`${e} folgen`,unfollow:e=>`${e} nicht mehr folgen`,markUp:`Korrigieren`,markUpHint:`Korrigieren Sie, was zu sehen ist, und die KI setzt es um`,moreTools:`Mehr`,export:`Exportieren`,share:`Teilen`,exported:`Exportiert`,exportFailed:`Export fehlgeschlagen`,format:`Format`,versions:`Sprachen`,include:`Dazu`,onShow:`Aktuell`,all:e=>`Alle ${String(e)} Sprachen`,choose:`Auswählen…`,chosen:e=>`${String(e)} ausgewählt`,back:`Zurück`,checking:`Wird geprüft…`,blocked:e=>`${String(e)} Probleme verhindern den Export`,start:`Exportieren`,queued:`Wartet`,queuedAhead:e=>`Wartet, ${String(e)} davor`,running:e=>`Export läuft: ${String(e)} %`,cancel:`Abbrechen`,retry:`Erneut versuchen`,failedHelp:e=>`Versuche es erneut oder frage ${e}, was schiefgelaufen ist.`,partial:`Einige Dateien konnten nicht erstellt werden.`,startFailed:`Der Export ist nicht gestartet`,nVersions:e=>`${String(e)} Versionen`,show:`Im Ordner zeigen`,download:`Herunterladen`,option:{pptx:{label:`Folien`,values:{native:`Bearbeitbar`,picture:`Bilder`}},steps:{label:`Jeden Animationsschritt`},scale:{label:`Größe`}},type:{mov:`MOV (ProRes)`,srt:`Untertitel`,cover:`Titelbild`,pptx:`PowerPoint`,zip:`ZIP (jede Zeichenfläche als PNG)`}},pt:{saved:{saved:`Salvo`,saving:`Salvando…`,unsaved:`Ainda não salvo`,error:`Não salvo`},agentDoing:{editing:e=>`${e} está editando`,looking:e=>`${e} está olhando`},follow:e=>`Seguir ${e}`,unfollow:e=>`Parar de seguir ${e}`,markUp:`Corrigir`,markUpHint:`Corrija o que vê e a IA faz as alterações`,moreTools:`Mais`,export:`Exportar`,share:`Compartilhar`,exported:`Exportado`,exportFailed:`Falha ao exportar`,format:`Formato`,versions:`Idiomas`,include:`Incluir`,onShow:`Atual`,all:e=>`Todos os ${String(e)} idiomas`,choose:`Escolher…`,chosen:e=>`${String(e)} escolhidos`,back:`Voltar`,checking:`Verificando…`,blocked:e=>`${String(e)} problemas obrigatórios impedem a exportação`,start:`Exportar`,queued:`Aguardando`,queuedAhead:e=>`Aguardando, ${String(e)} na frente`,running:e=>`Exportando ${String(e)}%`,cancel:`Cancelar`,retry:`Tentar novamente`,failedHelp:e=>`Tente novamente ou pergunte a ${e} o que deu errado.`,partial:`Não foi possível criar alguns arquivos.`,startFailed:`A exportação não começou`,nVersions:e=>`${String(e)} versões`,show:`Mostrar na pasta`,download:`Baixar`,option:{pptx:{label:`Slides`,values:{native:`Editáveis`,picture:`Imagens`}},steps:{label:`Cada etapa da animação`},scale:{label:`Tamanho`}},type:{mov:`MOV (ProRes)`,srt:`Legendas`,cover:`Imagem de capa`,pptx:`PowerPoint`,zip:`ZIP (cada prancheta em PNG)`}}});function Mn(){let e=a(),t=X.of(e?.locale);return e=>e.doing===void 0?e.name:t.agentDoing[e.doing](e.name)}function Nn(){let e=a(),n=Mn(),{agent:r,following:i,follow:s,unfollow:c}=t();if(r?.doing===void 0)return null;let l=X.of(e?.locale);return(0,R.jsxs)(F,{[o]:``,"data-testid":`agent-here`,"data-doing":r.doing,"aria-pressed":i,title:i?l.unfollow(r.name):l.follow(r.name),className:`text-agent-text hover:text-agent-text aria-pressed:text-agent-text`,onClick:()=>{i?c():s()},children:[(0,R.jsx)(`span`,{"aria-hidden":!0,className:E(`size-2 flex-none rounded-full`,i?`bg-agent motion-safe:animate-pulse`:`border-agent border`)}),n(r)]})}function Pn(){let e=i(),{agent:r,following:a,follow:o,unfollow:s}=t(),c=r?.doing,l=r?.name;return(0,L.useEffect)(()=>{e[`agent/here`]({...c===void 0||l===void 0?{}:{agent:{name:l,doing:c}},following:a}).catch(()=>void 0)},[e,c,l,a]),n(`editor/command`,({command:e})=>{e===`follow`?o():e===`unfollow`&&s()}),null}function Fn({checked:e,multiple:t=!1,variant:n=`row`,className:r,children:i,...a}){return(0,R.jsxs)(`button`,{type:`button`,role:t?`checkbox`:`radio`,"aria-checked":e,"data-slot":`choice`,...a,className:E(`text-sm text-ink transition-colors focus-visible:outline focus-visible:-outline-offset-1 focus-visible:outline-pencil disabled:cursor-default disabled:opacity-50`,n===`row`?`flex min-h-8 items-center gap-2.5 rounded-md px-2 py-1 text-left`:`flex flex-col items-center rounded-md border px-2 py-2.5`,e?E(`bg-pencil-wash`,n===`box`&&`border-pencil`):E(`hover:bg-hover active:bg-press`,n===`box`&&`border-rule hover:border-rule-strong`),r),children:[n===`row`&&(0,R.jsx)(`span`,{"aria-hidden":!0,className:E(`flex size-4 flex-none items-center justify-center border text-on-pencil`,t?`rounded-sm`:`rounded-full`,e?t?`border-pencil bg-pencil`:`border-4 border-pencil`:`border-rule-strong`),children:t&&e&&(0,R.jsx)(Ne,{className:`size-3`})}),i]})}var Z=16,In=8;function Ln(){return(0,R.jsx)(un,{asChild:!0,width:Z,height:In,children:(0,R.jsxs)(`svg`,{viewBox:`0 0 ${String(Z)} ${String(In)}`,"aria-hidden":!0,className:`-mt-px block overflow-visible`,children:[(0,R.jsx)(`path`,{d:`M0 -1 L${String(Z/2)} 7 L${String(Z)} -1 Z`,className:`fill-popover`}),(0,R.jsx)(`path`,{d:`M0 0 L${String(Z/2)} 7 L${String(Z)} 0`,className:`fill-none stroke-border`})]})})}function Rn({className:e,...t}){return(0,R.jsx)(vt,{"data-slot":`checkbox`,className:E(`peer size-4 shrink-0 rounded-[4px] border border-input shadow-xs transition-shadow outline-none focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=checked]:border-primary data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground dark:bg-input/30 dark:aria-invalid:ring-destructive/40 dark:data-[state=checked]:bg-primary`,e),...t,children:(0,R.jsx)(bt,{"data-slot":`checkbox-indicator`,className:`grid place-content-center text-current transition-none`,children:(0,R.jsx)(Ne,{className:`size-3.5`})})})}function zn({...e}){return(0,R.jsx)(Yt,{"data-slot":`popover`,...e})}function Bn({...e}){return(0,R.jsx)($t,{"data-slot":`popover-trigger`,...e})}function Vn({className:e,align:t=`center`,sideOffset:n=4,...r}){return(0,R.jsx)(rn,{children:(0,R.jsx)(an,{"data-slot":`popover-content`,align:t,sideOffset:n,className:E(`z-50 w-72 origin-(--radix-popover-content-transform-origin) rounded-md border bg-popover p-4 text-popover-foreground shadow-md outline-hidden data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...r})})}function Hn({...e}){return(0,R.jsx)(Zt,{"data-slot":`popover-anchor`,...e})}function Un({...e}){return(0,R.jsx)(le,{"data-slot":`sheet`,...e})}function Wn({...e}){return(0,R.jsx)(_,{"data-slot":`sheet-portal`,...e})}function Gn({className:e,...t}){return(0,R.jsx)(f,{"data-slot":`sheet-overlay`,className:E(`fixed inset-0 z-50 bg-black/50 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:animate-in data-[state=open]:fade-in-0`,e),...t})}function Kn({className:e,children:t,side:n=`right`,showCloseButton:r=!0,...i}){return(0,R.jsxs)(Wn,{children:[(0,R.jsx)(Gn,{}),(0,R.jsxs)(v,{"data-slot":`sheet-content`,className:E(`fixed z-50 flex flex-col gap-4 bg-background shadow-lg transition ease-in-out data-[state=closed]:animate-out data-[state=closed]:duration-300 data-[state=open]:animate-in data-[state=open]:duration-500`,n===`right`&&`inset-y-0 right-0 h-full w-3/4 border-l data-[state=closed]:slide-out-to-right data-[state=open]:slide-in-from-right sm:max-w-sm`,n===`left`&&`inset-y-0 left-0 h-full w-3/4 border-r data-[state=closed]:slide-out-to-left data-[state=open]:slide-in-from-left sm:max-w-sm`,n===`top`&&`inset-x-0 top-0 h-auto border-b data-[state=closed]:slide-out-to-top data-[state=open]:slide-in-from-top`,n===`bottom`&&`inset-x-0 bottom-0 h-auto border-t data-[state=closed]:slide-out-to-bottom data-[state=open]:slide-in-from-bottom`,e),...i,children:[t,r&&(0,R.jsxs)(u,{className:`absolute top-2.5 right-2.5 grid size-7 place-items-center rounded-md text-lead ring-offset-background hover:bg-hover hover:text-ink focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus:outline-hidden active:bg-press disabled:pointer-events-none motion-safe:transition-colors [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,children:[(0,R.jsx)(C,{className:`size-4`}),(0,R.jsx)(`span`,{className:`sr-only`,children:`Close`})]})]})]})}function qn({className:e,...t}){return(0,R.jsx)(y,{"data-slot":`sheet-title`,className:E(`font-semibold text-foreground`,e),...t})}var Jn=O(`inline-flex items-center justify-center gap-2 rounded-md text-sm font-medium whitespace-nowrap transition-[color,box-shadow] outline-none hover:bg-muted hover:text-muted-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 data-[state=on]:bg-accent data-[state=on]:text-accent-foreground dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent shadow-xs hover:bg-accent hover:text-accent-foreground`},size:{default:`h-9 min-w-9 px-2`,sm:`h-8 min-w-8 px-1.5`,lg:`h-10 min-w-10 px-2.5`}},defaultVariants:{variant:`default`,size:`default`}}),Yn=L.createContext({size:`default`,variant:`default`,spacing:0});function Xn({className:e,variant:t,size:n,spacing:r=0,children:i,...a}){return(0,R.jsx)(xn,{"data-slot":`toggle-group`,"data-variant":t,"data-size":n,"data-spacing":r,style:{"--gap":r},className:E(`group/toggle-group flex w-fit items-center gap-[--spacing(var(--gap))] rounded-md data-[spacing=default]:data-[variant=outline]:shadow-xs`,e),...a,children:(0,R.jsx)(Yn.Provider,{value:{variant:t,size:n,spacing:r},children:i})})}function Zn({className:e,children:t,variant:n,size:r,...i}){let a=L.useContext(Yn);return(0,R.jsx)(An,{"data-slot":`toggle-group-item`,"data-variant":a.variant||n,"data-size":a.size||r,"data-spacing":a.spacing,className:E(Jn({variant:a.variant||n,size:a.size||r}),`w-auto min-w-0 shrink-0 px-3 focus:z-10 focus-visible:z-10`,`data-[spacing=0]:rounded-none data-[spacing=0]:shadow-none data-[spacing=0]:first:rounded-l-md data-[spacing=0]:last:rounded-r-md data-[spacing=0]:data-[variant=outline]:border-l-0 data-[spacing=0]:data-[variant=outline]:first:border-l`,e),...i,children:t})}var Qn=5;function $n(e,t){let n=new Set;return e.filter(e=>e.item===t&&e.state!==`cancelled`).reverse().filter(e=>{if(e.state!==`done`||e.files.length===0)return!0;let t=[...e.files].sort().join(`
|
|
2
|
-
`);return!n.has(t)&&(n.add(t),!0)}).slice(0,Qn)}var Q=e=>e.state===`queued`||e.state===`running`;function er(e,t,n,r={}){let i=(e,t)=>e.length===t.length&&e.every(e=>t.includes(e));return Q(e)&&i(e.versions,t)&&i(e.types,n)&&tr(e.options??{},r)}var tr=(e,t)=>Object.keys({...e,...t}).every(n=>e[n]===t[n]);function nr(e,t,n){return Object.fromEntries(e.flatMap(e=>{let r=n[e.name];return!e.only.includes(t)||r===void 0?[]:e.values?e.values.includes(String(r))?[[e.name,r]]:[]:r===!0?[[e.name,!0]]:[]}))}function rr(e,t){return Math.max(0,e.filter(Q).map(e=>e.id).indexOf(t))}function ir(e,t,n,r){if(n.length!==0)return e===`all`?[...n]:e===`some`?n.filter(e=>r.includes(e)):t===void 0?[...n]:[t]}function ar(e,t){let n=e.findLast(Q);if(n)return n.state===`running`?{at:`running`,percent:Math.round(n.progress*100)}:{at:`queued`};let r=e[0];return r===void 0||!t.has(r.id)?{at:`idle`}:r.state===`failed`?{at:`failed`}:{at:`done`}}var or=e=>e.slice(e.lastIndexOf(`/`)+1),sr={mp4:`MP4`,gif:`GIF`,png:`PNG`,jpeg:`JPEG`,webp:`WebP`,avif:`AVIF`,pdf:`PDF`,html:`HTML`,zip:`ZIP`,psd:`PSD`,docx:`Word`,md:`Markdown`,xlsx:`Excel`,csv:`CSV`,json:`JSON`,glb:`GLB`},cr=(e,t)=>sr[t]??(t in e.type?e.type[t]:t);function lr(){let e=a(),t=X.of(e?.locale),n=e?.item.kindInfo.exports?.names,r=e?.locale??`en`;return e=>{let i=n?.[e];return i?.[r]??i?.en??cr(t,e)}}function ur(){let[e,t]=(0,L.useState)(()=>window.matchMedia(`(max-width: 479px)`).matches);return(0,L.useEffect)(()=>{let e=window.matchMedia(`(max-width: 479px)`),n=()=>{t(e.matches)};return e.addEventListener(`change`,n),()=>{e.removeEventListener(`change`,n)}},[]),e}function dr(e){let t=i(),[r,a]=(0,L.useState)([]),[o,s]=(0,L.useState)(new Set),[c,l]=(0,L.useState)(!1);(0,L.useEffect)(()=>{let e=!0;return P(t,`export/list`,{}).then(t=>{e&&(a(t.jobs),l(t.reveal))},()=>void 0),()=>{e=!1}},[t]),n(`export/changed`,({job:t})=>{a(e=>{let n=e.findIndex(e=>e.id===t.id);return n<0?[...e,t]:e.map((e,r)=>r===n?t:e)}),!Q(t)&&!e&&s(e=>new Set(e).add(t.id))});let[u,d]=(0,L.useState)(e);return u!==e&&(d(e),e&&s(new Set)),{all:r,fresh:o,reveals:c}}function fr(e,t){let n=i(),r=`item-bar.export.${e}`,[a,o]=(0,L.useState)({type:t.types[0]??``,extras:[],options:{}});return(0,L.useEffect)(()=>{let e=!0;return n[`storage/get`]({key:r}).then(({value:n})=>{let r=n;if(!e||!r)return;let i=t.types.find(e=>e===r.type);i!==void 0&&o({type:i,extras:t.extras.filter(e=>r.extras?.includes(e)),options:r.options??{}})},()=>void 0),()=>{e=!1}},[n,r,t]),[a,e=>{o(e),n[`storage/set`]({key:r,value:e}).catch(()=>void 0)}]}async function pr(e,t){let{url:n}=await e[`files/url`]({path:t}),r=document.createElement(`a`);r.href=n,r.download=or(t),r.click()}async function mr(e,t,n){n&&await P(e,`export/reveal`,{path:t}).then(()=>!0,()=>!1)||await pr(e,t)}function hr({job:e,versions:t,ahead:n,words:r,reveals:o}){let s=lr(),c=i(),l=a()?.agent?.name??`AllyHub`,u=Math.round(e.progress*100),d=o?ot:Ge,f=o?r.show:r.download,p=e.versions.length===0?void 0:e.versions.length>2?r.nVersions(e.versions.length):e.versions.map(e=>t.find(t=>t.key===e)?.label??e).join(`, `),m=[e.types.map(e=>s(e)).join(`, `),...t.length>1&&p!==void 0?[p]:[]].join(` · `);return(0,R.jsxs)(`div`,{className:`border-t py-2 pr-2 pl-4`,"data-testid":`export-job`,"data-state":e.state,children:[Q(e)&&(0,R.jsxs)(`div`,{className:`pr-2`,children:[(0,R.jsxs)(`div`,{className:`flex h-7 items-center gap-2`,children:[(0,R.jsx)(`span`,{className:`text-dense min-w-0 flex-1 truncate`,children:m}),(0,R.jsx)(`span`,{className:`text-lead text-xs tabular-nums`,children:e.state===`running`?`${String(u)}%`:n>0?r.queuedAhead(n):r.queued}),(0,R.jsx)(F,{icon:!0,"aria-label":r.cancel,title:r.cancel,"data-testid":`export-cancel`,onClick:()=>{P(c,`export/cancel`,{job:e.id}).catch(()=>void 0)},children:(0,R.jsx)(C,{"aria-hidden":!0})})]}),(0,R.jsx)(pe,{value:u,className:`mt-1 h-1`})]}),e.state===`failed`&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsxs)(`div`,{className:`flex h-7 items-center gap-2`,children:[(0,R.jsx)(ke,{className:`text-destructive size-3.5 flex-none`,"aria-hidden":!0}),(0,R.jsxs)(`span`,{className:`text-dense text-destructive min-w-0 flex-1 truncate`,children:[r.exportFailed,` · `,m]}),(0,R.jsx)(F,{icon:!0,"aria-label":r.retry,title:r.retry,"data-testid":`export-retry`,onClick:()=>{P(c,`export/start`,{item:e.item,versions:e.versions,types:e.types,...e.options?{options:e.options}:{}}).catch(e=>{be.error(r.startFailed,{description:e instanceof Error?e.message:String(e)})})},children:(0,R.jsx)(st,{"aria-hidden":!0})})]}),(0,R.jsx)(`p`,{className:`text-lead pr-2 pl-5.5 text-xs`,title:e.error,children:r.failedHelp(l)})]}),e.files.map(e=>(0,R.jsxs)(`div`,{className:`flex h-7 items-center gap-2`,"data-testid":`export-file`,children:[(0,R.jsx)(Ne,{className:`text-success size-3.5 flex-none`,"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`text-dense min-w-0 flex-1 truncate`,title:e,children:or(e)}),(0,R.jsx)(F,{icon:!0,"aria-label":f,title:f,"data-testid":`export-give`,onClick:()=>{mr(c,e,o)},children:(0,R.jsx)(d,{"aria-hidden":!0})})]},e)),e.state===`done`&&e.error!==void 0&&(0,R.jsx)(`p`,{className:`text-lead pr-2 pl-5.5 text-xs`,title:e.error,children:r.partial})]})}function gr({versions:e,shown:t,picked:n,onPick:r,onBack:i,words:a}){return(0,R.jsxs)(`div`,{"data-testid":`export-choose`,children:[(0,R.jsxs)(`div`,{className:`flex h-11 items-center gap-1 border-b pr-4 pl-2`,children:[(0,R.jsx)(F,{icon:!0,"aria-label":a.back,title:a.back,onClick:i,children:(0,R.jsx)(We,{"aria-hidden":!0})}),(0,R.jsx)(`span`,{className:`text-sm font-medium`,children:a.versions}),(0,R.jsxs)(`span`,{className:`text-lead ml-auto text-xs tabular-nums`,children:[n.length,`/`,e.length]})]}),(0,R.jsx)(`ul`,{className:`max-h-64 overflow-y-auto p-2`,children:e.map(e=>(0,R.jsx)(`li`,{children:(0,R.jsxs)(`label`,{className:`pressable flex h-8 items-center gap-2 rounded-md px-2 text-sm`,children:[(0,R.jsx)(Rn,{checked:n.includes(e.key),"data-version":e.key,onCheckedChange:t=>{r(t===!0?[...n,e.key]:n.filter(t=>t!==e.key))}}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.key===t&&(0,R.jsx)(`span`,{className:`text-lead text-xs`,children:a.onShow})]})},e.key))})]})}function _r({kind:e,offer:t,item:n,props:r,jobs:a,all:o,words:s,reveals:c,startRef:l}){let u=lr(),d=i(),f=r.versions??[],p=f.map(e=>e.key),m=f.find(e=>e.key===r.shown)?.label,h=r.unavailable??{},[g,_]=fr(e,t),[v,y]=(0,L.useState)(`shown`),[b,x]=(0,L.useState)(r.shown===void 0?[]:[r.shown]),[S,C]=(0,L.useState)(!1),[ee,w]=(0,L.useState)(!1),T=ir(v,r.shown,p,b),te=T?.length??1,D=[g.type,...g.extras.filter(e=>h[e]===void 0)],O=t.options.filter(e=>e.only.includes(g.type)),ne=nr(O,g.type,g.options),k=O.filter(e=>e.values===void 0),re=(e,t)=>{_({...g,options:{...g.options,[e]:t}})},A=r.check?.waiting===!0,j=A?0:r.check?.problems(T)??0,ie=a.some(e=>er(e,T??[],D,ne)),ae=async()=>{w(!0);try{await P(d,`export/start`,{item:n,...T?{versions:T}:{},types:D,...Object.keys(ne).length>0?{options:ne}:{}})}catch(e){if(ue(e))return;be.error(s.startFailed,{description:e instanceof Error?e.message:String(e)})}finally{w(!1)}},M=(0,R.jsx)(yr,{label:s.format,types:t.types,chosen:g.type,name:u,onChoose:e=>{_({...g,type:e})}}),se=(0,R.jsx)(oe,{ref:l,size:`sm`,disabled:A||j>0||ee||te===0||ie,"data-testid":`export-start`,onClick:()=>{ae()},children:A?s.checking:s.start});return(0,R.jsxs)(`div`,{className:`overflow-hidden rounded-lg text-sm`,"data-testid":`export-panel`,children:[S?(0,R.jsx)(gr,{versions:f,shown:r.shown,picked:b,onPick:x,onBack:()=>{C(!1)},words:s}):(0,R.jsxs)(R.Fragment,{children:[t.types.length>1&&(0,R.jsx)(`div`,{className:`px-4 pt-4`,children:M}),(p.length>1||t.extras.length+O.length>0)&&(0,R.jsxs)(`div`,{className:`grid grid-cols-[max-content_minmax(0,1fr)] items-center gap-x-4 gap-y-3 px-4 pt-4`,children:[O.map(e=>e.values?(0,R.jsxs)(L.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-lead`,children:s.option[e.name]?.label}),(0,R.jsx)(Xn,{type:`single`,variant:`outline`,size:`sm`,className:`w-full`,"aria-label":s.option[e.name]?.label,"data-testid":`export-option-${e.name}`,value:String(g.options[e.name]??e.values[0]),onValueChange:t=>{t!==``&&re(e.name,t)},children:e.values.map(t=>(0,R.jsx)(Zn,{value:t,"data-value":t,className:`flex-1`,children:s.option[e.name]?.values?.[t]??t},t))})]},e.name):null),p.length>1&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-lead`,children:s.versions}),(0,R.jsxs)(Fe,{value:v,onValueChange:e=>{y(e),e===`some`&&C(!0)},children:[(0,R.jsx)(Me,{size:`sm`,"aria-label":s.versions,className:`w-full min-w-0`,"data-testid":`export-scope`,children:(0,R.jsx)(Le,{})}),(0,R.jsxs)(je,{position:`popper`,align:`start`,children:[(0,R.jsx)(ze,{value:`shown`,children:m??s.onShow}),(0,R.jsx)(ze,{value:`all`,children:s.all(p.length)}),(0,R.jsx)(Ve,{}),(0,R.jsx)(ze,{value:`some`,onPointerUp:()=>{C(!0)},children:v===`some`?s.chosen(b.length):s.choose})]})]})]}),t.extras.length+k.length>0&&(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(`span`,{className:`text-lead self-start`,children:s.include}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,"data-testid":`export-include`,children:[k.map(e=>(0,R.jsxs)(`label`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(Rn,{checked:g.options[e.name]===!0,"data-option":e.name,onCheckedChange:t=>{re(e.name,t===!0)}}),(0,R.jsx)(`span`,{className:`truncate`,children:s.option[e.name]?.label})]},e.name)),t.extras.map(e=>{let t=h[e];return(0,R.jsxs)(`label`,{title:t,className:E(`flex items-center gap-2`,t!==void 0&&`text-lead-soft`),children:[(0,R.jsx)(Rn,{checked:t===void 0&&g.extras.includes(e),disabled:t!==void 0,"data-type":e,onCheckedChange:t=>{_({...g,extras:t===!0?[...g.extras,e]:g.extras.filter(t=>t!==e)})}}),(0,R.jsx)(`span`,{className:`truncate`,children:u(e)})]},e)})]})]})]}),j>0&&(0,R.jsxs)(`p`,{className:`text-dense text-destructive flex items-start gap-1.5 px-4 pt-3`,"data-testid":`export-blocked`,children:[(0,R.jsx)(ke,{className:`mt-0.5 size-3.5 flex-none`,"aria-hidden":!0}),s.blocked(j)]}),(0,R.jsxs)(`div`,{className:`flex items-center gap-3 p-4`,children:[(0,R.jsx)(`span`,{className:`text-lead min-w-0 flex-1 truncate text-xs`,children:r.facts??(t.types.length===1?u(g.type):void 0)}),se]})]}),a.length>0&&(0,R.jsx)(`div`,{className:`max-h-56 overflow-y-auto`,children:a.map(e=>(0,R.jsx)(hr,{job:e,versions:f,ahead:rr(o,e.id),words:s,reveals:c},e.id))})]})}var vr={png:Qe,jpeg:Qe,webp:Qe,avif:Qe,gif:tt,mp4:at,mov:at,pdf:Ie,docx:$e,md:it,txt:it,html:Ze,xlsx:nt,csv:nt,json:Ye,pptx:Xe,zip:qe,psd:rt,glb:Je};function yr(e){let t=(0,L.useRef)(null),n=e.types.length,r=n<=4?n:Math.min(4,Math.ceil(n/2));return(0,R.jsx)(`div`,{ref:t,role:`radiogroup`,"aria-label":e.label,"data-testid":`export-format`,className:`grid gap-2`,style:{gridTemplateColumns:`repeat(${String(r)}, minmax(0, 1fr))`},onKeyDown:r=>{let i=r.key===`ArrowRight`||r.key===`ArrowDown`?1:r.key===`ArrowLeft`||r.key===`ArrowUp`?-1:0;if(i===0)return;r.preventDefault();let a=e.types[(e.types.indexOf(e.chosen)+i+n)%n];a!==void 0&&(e.onChoose(a),t.current?.querySelector(`[data-type="${a}"]`)?.focus())},children:e.types.map(t=>{let n=vr[t]??et,r=e.chosen===t;return(0,R.jsxs)(Fn,{variant:`box`,checked:r,tabIndex:r?0:-1,"data-type":t,title:e.name(t),className:`min-h-16 min-w-0 justify-center gap-1.5 rounded-lg px-1.5 py-2.5`,onClick:()=>{e.onChoose(t)},children:[(0,R.jsx)(n,{"aria-hidden":!0,strokeWidth:1.5,className:E(`size-5`,r?`text-pencil`:`text-lead`)}),(0,R.jsx)(`span`,{className:`line-clamp-2 w-full text-center text-xs leading-tight text-balance break-words`,children:e.name(t)})]},t)})})}function br(e){let t=/Mac|iPhone|iPad/u.test(navigator.userAgent),n=e.target;return e.code===`KeyE`&&(t?e.metaKey&&!e.ctrlKey:e.ctrlKey&&!e.metaKey)&&!e.shiftKey&&!e.altKey&&!(n instanceof HTMLElement&&(n.isContentEditable||n.tagName===`INPUT`||n.tagName===`TEXTAREA`))}function xr(e){let t=i(),r=a(),o=r?.commands===!0,s=r?.item.kind,c=r?.item.kindInfo.exports,l=r?.item.id,u=X.of(r?.locale),d=ur(),f=(0,L.useRef)(null),[p,m]=(0,L.useState)(!1),{all:h,fresh:g,reveals:_}=dr(p);n(`editor/command`,({command:e,open:t})=>{e===`export`&&m(e=>t??!e)}),(0,L.useEffect)(()=>{let e=e=>{br(e)&&(e.preventDefault(),m(e=>!e))};return window.addEventListener(`keydown`,e),()=>{window.removeEventListener(`keydown`,e)}},[]),(0,L.useEffect)(()=>{if(!p||d)return;let e=()=>{m(!1)};return window.addEventListener(`blur`,e),()=>{window.removeEventListener(`blur`,e)}},[p,d]);let v=c!==void 0,y=l===void 0?[]:$n(h,l),b=ar(y,g),x=b.at===`running`?b.percent:void 0;if((0,L.useEffect)(()=>{o&&v&&t[`export/state`]({at:b.at,...x===void 0?{}:{percent:x},open:p}).catch(()=>void 0)},[t,o,v,b.at,x,p]),s===void 0||l===void 0||c===void 0)return null;let S=b.at===`running`?`${String(b.percent)}%`:b.at===`queued`?u.queued:b.at===`done`?u.exported:b.at===`failed`?u.exportFailed:u.export,C=(0,R.jsxs)(F,{"data-testid":`export`,"data-state":b.at,"aria-pressed":p,"aria-label":b.at===`running`?u.running(b.percent):S,title:S,onClick:()=>{d&&m(!0)},children:[b.at===`running`&&(0,R.jsx)(fe,{value:b.percent/100}),b.at===`queued`&&(0,R.jsx)(fe,{value:0}),b.at===`done`&&(0,R.jsx)(Ne,{className:`text-success`,"aria-hidden":!0}),b.at===`failed`&&(0,R.jsx)(ke,{className:`text-destructive`,"aria-hidden":!0}),b.at===`idle`&&(0,R.jsx)(Ge,{"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`@max-lg/item:hidden`,children:S})]}),ee=(0,R.jsx)(_r,{kind:s,offer:c,item:l,props:e,jobs:y,all:h,words:u,reveals:_,startRef:f});return d?(0,R.jsxs)(R.Fragment,{children:[!o&&C,(0,R.jsx)(Un,{open:p,onOpenChange:m,children:(0,R.jsxs)(Kn,{side:`bottom`,showCloseButton:!1,className:`gap-0 rounded-t-lg`,children:[(0,R.jsx)(qn,{className:`sr-only`,children:u.export}),ee]})})]}):(0,R.jsxs)(zn,{open:p,onOpenChange:m,children:[o?(0,R.jsx)(Hn,{className:`pointer-events-none fixed top-0 right-2 size-0`}):(0,R.jsx)(Bn,{asChild:!0,children:C}),(0,R.jsxs)(Vn,{align:`end`,sideOffset:o?4:8,className:`w-88 p-0`,onOpenAutoFocus:e=>{f.current&&!f.current.disabled&&(e.preventDefault(),f.current.focus())},children:[!o&&(0,R.jsx)(Ln,{}),ee]})]})}function Sr({...e}){return(0,R.jsx)(jt,{"data-slot":`context-menu`,...e})}function Cr({...e}){return(0,R.jsx)(Nt,{"data-slot":`context-menu-trigger`,...e})}function wr({...e}){return(0,R.jsx)(Bt,{"data-slot":`context-menu-sub`,...e})}function Tr({className:e,inset:t,children:n,...r}){return(0,R.jsxs)(Vt,{"data-slot":`context-menu-sub-trigger`,"data-inset":t,className:E(`flex cursor-default items-center rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[inset]:pl-8 data-[state=open]:bg-accent data-[state=open]:text-accent-foreground [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground`,e),...r,children:[n,(0,R.jsx)(Re,{className:`ml-auto`})]})}function Er({className:e,...t}){return(0,R.jsx)(Ht,{"data-slot":`context-menu-sub-content`,className:E(`z-50 min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-hidden rounded-md border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...t})}function Dr({className:e,container:t,...n}){return(0,R.jsx)(Pt,{container:t,children:(0,R.jsx)(It,{"data-slot":`context-menu-content`,className:E(`z-50 max-h-(--radix-context-menu-content-available-height) min-w-[8rem] origin-(--radix-context-menu-content-transform-origin) overflow-x-hidden overflow-y-auto rounded-md border bg-popover p-1 text-popover-foreground shadow-md data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...n})})}function Or({className:e,inset:t,variant:n=`default`,...r}){return(0,R.jsx)(Lt,{"data-slot":`context-menu-item`,"data-inset":t,"data-variant":n,className:E(`relative flex cursor-default items-center gap-2 rounded-sm px-2 py-1.5 text-sm outline-hidden select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 data-[inset]:pl-8 data-[variant=destructive]:text-destructive data-[variant=destructive]:focus:bg-destructive/10 data-[variant=destructive]:focus:text-destructive dark:data-[variant=destructive]:focus:bg-destructive/20 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4 [&_svg:not([class*='text-'])]:text-muted-foreground data-[variant=destructive]:*:[svg]:text-destructive!`,e),...r})}function kr({className:e,...t}){return(0,R.jsx)(Rt,{"data-slot":`context-menu-separator`,className:E(`-mx-1 my-1 h-px bg-border`,e),...t})}function Ar({className:e,...t}){return(0,R.jsx)(`span`,{"data-slot":`context-menu-shortcut`,className:E(`ml-auto text-xs tracking-widest text-muted-foreground`,e),...t})}var jr=150,Mr=e=>{if(!(e.currentTarget instanceof Element))return;let t=e.currentTarget.getBoundingClientRect();return{x:t.x,y:t.y,width:t.width,height:t.height}},Nr=(e,t,n=!0)=>{let r=Mr(t);setTimeout(()=>{e.begin(r,n)},jr)};function $(){let e=i(),t=a();if(t?.notes!==!0)return;let n=X.of(t.locale);return{label:n.markUp,hint:n.markUpHint,begin:(t,n)=>{e[`note/begin`]({...t?{from:t}:{},...n===!0?{selection:n}:{}}).catch(()=>void 0)}}}function Pr(){let e=$();return e?(0,R.jsxs)(F,{title:e.hint,"data-testid":`mark-up`,className:`text-ink`,onClick:t=>{e.begin(Mr(t))},children:[(0,R.jsx)(I,{"aria-hidden":!0}),e.label]}):null}function Fr(e){let t=$();return t?(0,R.jsx)(`div`,{role:`toolbar`,"aria-label":t.label,"data-note-chrome":``,"data-testid":`mark-up-bar`,className:`border-rule bg-sheet shadow-overlay flex items-center rounded-lg border p-0.5 ${e.className??``}`,style:e.style,onPointerDown:e=>{e.stopPropagation()},children:(0,R.jsxs)(F,{title:t.hint,"data-testid":`mark-up-selected`,className:`text-ink`,onClick:e=>{t.begin(Mr(e),!0)},children:[(0,R.jsx)(I,{"aria-hidden":!0}),t.label]})}):null}function Ir({selection:e=!0}={}){let t=$();return t?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(He,{}),(0,R.jsxs)(Ae,{title:t.hint,"data-testid":`mark-up-item`,onSelect:n=>{Nr(t,n,e)},children:[(0,R.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),t.label]})]}):null}function Lr(){let e=$();return e?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(kr,{}),(0,R.jsxs)(Or,{title:e.hint,"data-testid":`mark-up-item`,onSelect:t=>{Nr(e,t)},children:[(0,R.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),e.label]})]}):null}var Rr=e=>e instanceof Element&&e.closest(`input, textarea`)!==null;function zr(){let e=$(),t=e!==void 0,[n,r]=(0,L.useState)();return(0,L.useEffect)(()=>{if(!t)return;let e=e=>{e.defaultPrevented||Rr(e.target)||(e.preventDefault(),r({x:e.clientX,y:e.clientY}))};return document.addEventListener(`contextmenu`,e),()=>{document.removeEventListener(`contextmenu`,e)}},[t]),!e||!n?null:(0,R.jsxs)(Be,{open:!0,onOpenChange:e=>{e||r(void 0)},children:[(0,R.jsx)(he,{asChild:!0,children:(0,R.jsx)(`span`,{style:{position:`fixed`,left:n.x,top:n.y,width:0,height:0}})}),(0,R.jsx)(Pe,{align:`start`,className:`text-xs`,children:(0,R.jsxs)(Ae,{title:e.hint,"data-testid":`mark-up-item`,onSelect:t=>{Nr(e,t)},children:[(0,R.jsx)(I,{className:`size-3.5`,"aria-hidden":!0}),e.label]})})]})}function Br(){let e=a();return e?.share===!0&&e.mode===`edit`&&e.item.kindInfo.share===!0}function Vr(){let e=i(),t=a();if(!Br())return null;let n=X.of(t?.locale);return(0,R.jsxs)(F,{"data-testid":`share`,"aria-label":n.share,title:n.share,onClick:()=>{e[`share/begin`]({}).catch(()=>void 0)},children:[(0,R.jsx)(ct,{"aria-hidden":!0}),(0,R.jsx)(`span`,{className:`@max-lg/item:hidden`,children:n.share})]})}var Hr=800;function Ur(e){let t=e?.state===`saving`||e?.state===`unsaved`,[n,r]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{if(!t)return;let e=setTimeout(()=>{r(!0)},Hr);return()=>{clearTimeout(e),r(!1)}},[t]),e!==void 0&&e.state!==`saved`&&(!t||n)}function Wr({saved:e,words:t}){return(0,R.jsx)(`span`,{"data-testid":`save-state`,"data-state":e.state,title:e.message,className:E(`px-1 text-xs`,e.state===`error`?`text-destructive`:`text-lead`),children:t.saved[e.state]})}function Gr({start:e,saved:t,exports:n}){let i=a(),o=Br(),s=X.of(i?.locale),c=Ur(t),l=r()?.doing!==void 0;if(i?.mode!==`edit`)return e?(0,R.jsx)(`div`,{className:`bg-background flex min-h-9 flex-none items-center gap-1 border-b px-1 font-sans text-sm`,"data-testid":`item-bar`,children:e}):null;if(i.commands===!0)return(0,R.jsxs)(R.Fragment,{children:[e?(0,R.jsx)(`div`,{className:`bg-background @container/item flex min-h-9 flex-none items-center gap-1 border-b px-1 font-sans text-sm`,"data-testid":`item-bar`,children:e}):null,(0,R.jsx)(Pn,{}),(0,R.jsx)(xr,{...n}),(0,R.jsx)(zr,{})]});let u=i.item.kindInfo.exports!==void 0;return!e&&!c&&!u&&!o&&!l?(0,R.jsx)(zr,{}):(0,R.jsxs)(`div`,{className:`bg-background @container/item flex min-h-9 flex-none items-center gap-1 border-b px-1 font-sans text-sm`,"data-testid":`item-bar`,children:[e,(0,R.jsxs)(`div`,{className:`ml-auto flex flex-none items-center gap-1`,children:[(0,R.jsx)(Nn,{}),t&&c&&(0,R.jsx)(Wr,{saved:t,words:s}),(0,R.jsx)(Pr,{}),(0,R.jsx)(xr,{...n}),(0,R.jsx)(Vr,{})]}),(0,R.jsx)(zr,{})]})}var Kr=e(l(),1),qr=`group-data-[compact]/bar:hidden`,Jr=32,Yr={compact:!1,out:[],firsts:[],order:{}},Xr=(0,L.createContext)(null),Zr=(e,t)=>e.compact===t.compact&&e.out.join(`
|
|
3
|
-
`)===t.out.join(`
|
|
4
|
-
`)&&e.firsts.join(`
|
|
5
|
-
`)===t.firsts.join(`
|
|
6
|
-
`)&&JSON.stringify(e.order)===JSON.stringify(t.order);function Qr({children:e,id:t,priority:n=0,keep:r=!1,ruled:i=!0}){let a=(0,L.useContext)(Xr),o=(0,L.useId)(),s=t??o,c=a?.fit.firsts.includes(s)??!1,l=a?.touch;(0,L.useLayoutEffect)(()=>(l?.(),l),[l]);let u=(0,R.jsx)(`span`,{className:E(`relative flex h-8 flex-none items-center gap-0.5`,!c&&`pl-2`,!c&&i&&`before:bg-rule before:absolute before:top-2 before:bottom-2 before:left-0.75 before:w-px`),children:e});if(!a)return u;let d=a.fit.out.includes(s);return(0,R.jsx)(`span`,{"data-group":s,"data-priority":n,"data-keep":r?``:void 0,className:d?`hidden`:`flex flex-none`,children:d?a.panel?(0,Kr.createPortal)((0,R.jsx)(`span`,{"data-group":s,"data-away":``,className:`flex flex-none`,style:{order:a.fit.order[s]??0},children:u}),a.panel):null:u})}function $r({testid:e,className:t,children:n,...r}){let i=a(),o=X.of(i?.locale),s=(0,L.useRef)(null),[c,l]=(0,L.useState)(null),u=(0,L.useRef)(new Map),[d,f]=(0,L.useState)(Yr),[p,m]=(0,L.useState)(!1),[h,g]=(0,L.useState)(0),_=(0,L.useCallback)(()=>{g(e=>e+1)},[]),v=(0,L.useRef)(null);return(0,L.useLayoutEffect)(()=>{let e=new ResizeObserver(()=>{g(e=>e+1)});return v.current=e,s.current&&e.observe(s.current),()=>{e.disconnect(),v.current=null}},[]),(0,L.useLayoutEffect)(()=>{let e=s.current;if(!e)return;let t=[],n=new Set,r=!0;for(let i of e.querySelectorAll(`[data-group]:not([data-away]), [data-spacer]`)){if(i.dataset.spacer!==void 0){r=!0;continue}let e=i.dataset.group??``;if(t.push({key:e,priority:Number(i.dataset.priority??0),keep:i.dataset.keep!==void 0,at:t.length}),d.out.includes(e))continue;r&&n.add(e),r=!1,v.current?.observe(i);let a=i.getBoundingClientRect().width;a>0&&u.current.set(`${String(d.compact)}:${e}`,a)}for(let e of c?.querySelectorAll(`[data-away]`)??[]){let t=e.getBoundingClientRect().width;t>0&&u.current.set(`${String(d.compact)}:${e.dataset.group??``}`,t)}let i=e.clientWidth,a=(e,t)=>u.current.get(`${String(e)}:${t.key}`),o=e=>t.every(t=>a(e,t)!==void 0),l=e=>t.reduce((t,n)=>t+(a(e,n)??0),0),h=!1,g=[];if(!o(!1)||l(!1)<=i)h=!1;else if(!o(!0)||l(!0)<=i)h=!0;else{h=!0;let e=t.filter(e=>!e.keep).sort((e,t)=>e.priority-t.priority||t.at-e.at),n=new Set,r=l(!0)+Jr;for(let t of e){if(r<=i)break;n.add(t.key),r-=a(!0,t)??0}g=t.filter(e=>n.has(e.key)).map(e=>e.key)}let _={compact:h,out:g,firsts:[...n],order:Object.fromEntries(t.map(e=>[e.key,e.at]))};Zr(_,d)||f(_),g.length===0&&p&&m(!1)},[d,p,h,c,n]),(0,R.jsx)(Xr.Provider,{value:{fit:d,panel:p?c:null,touch:_},children:(0,R.jsxs)(`div`,{...r,ref:s,role:r.role??`toolbar`,"data-testid":e,"data-compact":d.compact?``:void 0,className:E(`group/bar relative flex h-8 min-w-0 flex-1 items-center overflow-hidden`,t),children:[n,d.out.length>0?(0,R.jsxs)(zn,{open:p,onOpenChange:m,children:[(0,R.jsx)(Bn,{asChild:!0,children:(0,R.jsx)(F,{icon:!0,className:`ml-auto flex-none`,"aria-label":o.moreTools,title:o.moreTools,"data-testid":`${e}-more`,onMouseDown:e=>{e.preventDefault()},children:(0,R.jsx)(Ke,{})})}),(0,R.jsx)(Vn,{align:`end`,collisionPadding:8,role:`toolbar`,"aria-label":o.moreTools,"data-testid":`${e}-panel`,"data-compact":d.compact?``:void 0,onOpenAutoFocus:e=>{e.preventDefault()},onCloseAutoFocus:e=>{e.preventDefault()},onInteractOutside:e=>{let t=e.target;t instanceof Element&&t.closest(`[data-radix-popper-content-wrapper]`)&&e.preventDefault()},className:`group/bar w-auto max-w-[calc(100vw-1rem)] overflow-hidden p-1`,children:(0,R.jsx)(`div`,{ref:l,className:`-ml-2 flex flex-wrap items-center`})})]}):null]})})}export{Fn as C,I as E,Rn as S,st as T,Cr as _,Fr as a,Vn as b,$ as c,Or as d,kr as f,Tr as g,Er as h,Gr as i,Sr as l,wr as m,Qr as n,Lr as o,Ar as p,$r as r,Ir as s,qr as t,Dr as u,zn as v,Mn as w,Bn as x,Hn as y};
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,d as n,m as r,o as i,s as a,u as o,v as s}from"./react-Bk7NnOLX.js";import{Dt as c,Et as l,Ot as u,Tt as d,yt as f}from"./button-BVQH7zxz.js";import{A as p,B as m,H as h,P as g,Q as _,R as v,S as y,U as b,V as x,W as S,X as C,Y as w,b as T,et as E,g as ee,it as D,nt as O,q as k,rt as A,tt as j,x as te}from"./snapshots-CTS2iez5.js";import{t as ne}from"./jsx-runtime-DePvh3-m.js";import{_ as re,a as ie,c as ae,d as oe,i as M,l as se,n as ce,o as le,p as ue,r as de,u as fe,w as pe}from"./dist-D7ur8721.js";import{E as me,S as N,_ as P,f as he,h as F,p as ge,t as I,ut as _e}from"./index-BGAXezRR.js";import{t as ve}from"./collaborator-2qfw-8OJ.js";var L=ne(),ye=f({en:{loading:`Drawing the boards`,noBoards:`This image has no boards yet`,boards:`Boards`,zoom:`Zoom`,zoomIn:`Zoom In`,zoomOut:`Zoom Out`,zoomFit:`Zoom to Fit`,zoomActual:`Actual Size`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`The boards could not be drawn: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 board`:`${String(e)} boards`},"zh-cn":{loading:`正在绘制画板`,noBoards:`这张图片还没有画板`,boards:`画板`,zoom:`缩放`,zoomIn:`放大`,zoomOut:`缩小`,zoomFit:`缩放到适合`,zoomActual:`实际大小`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`无法绘制画板:${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 个画板`},"zh-tw":{loading:`正在繪製畫板`,noBoards:`這張圖片還沒有畫板`,boards:`畫板`,zoom:`縮放`,zoomIn:`放大`,zoomOut:`縮小`,zoomFit:`縮放至適合大小`,zoomActual:`實際大小`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`無法繪製畫板:${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 個畫板`},ja:{loading:`ボードを描画中`,noBoards:`この画像にはまだボードがありません`,boards:`ボード`,zoom:`ズーム`,zoomIn:`拡大`,zoomOut:`縮小`,zoomFit:`全体を表示`,zoomActual:`実寸`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`ボードを描画できませんでした:${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`${String(e)} 枚のボード`},ko:{loading:`보드를 그리는 중`,noBoards:`이 이미지에는 아직 보드가 없습니다`,boards:`보드`,zoom:`확대/축소`,zoomIn:`확대`,zoomOut:`축소`,zoomFit:`화면에 맞추기`,zoomActual:`실제 크기`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`보드를 그리지 못했습니다: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>`보드 ${String(e)}개`},es:{loading:`Dibujando las mesas de trabajo`,noBoards:`Esta imagen aún no tiene mesas de trabajo`,boards:`Mesas de trabajo`,zoom:`Zoom`,zoomIn:`Acercar`,zoomOut:`Alejar`,zoomFit:`Ajustar a la ventana`,zoomActual:`Tamaño real`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`No se pudieron dibujar las mesas de trabajo: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 mesa de trabajo`:`${String(e)} mesas de trabajo`},fr:{loading:`Dessin des plans de travail`,noBoards:`Cette image n’a pas encore de plan de travail`,boards:`Plans de travail`,zoom:`Zoom`,zoomIn:`Zoom avant`,zoomOut:`Zoom arrière`,zoomFit:`Ajuster à la fenêtre`,zoomActual:`Taille réelle`,percent:e=>`${String(e)}\u202f%`,couldNotDraw:e=>`Les plans de travail n’ont pas pu être dessinés : ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 plan de travail`:`${String(e)} plans de travail`},de:{loading:`Zeichenflächen werden gezeichnet`,noBoards:`Dieses Bild hat noch keine Zeichenflächen`,boards:`Zeichenflächen`,zoom:`Zoom`,zoomIn:`Vergrößern`,zoomOut:`Verkleinern`,zoomFit:`An Fenster anpassen`,zoomActual:`Originalgröße`,percent:e=>`${String(e)}\u00a0%`,couldNotDraw:e=>`Die Zeichenflächen konnten nicht gezeichnet werden: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 Zeichenfläche`:`${String(e)} Zeichenflächen`},pt:{loading:`Desenhando as pranchetas`,noBoards:`Esta imagem ainda não tem pranchetas`,boards:`Pranchetas`,zoom:`Zoom`,zoomIn:`Ampliar`,zoomOut:`Reduzir`,zoomFit:`Ajustar à janela`,zoomActual:`Tamanho real`,percent:e=>`${String(e)}%`,couldNotDraw:e=>`Não foi possível desenhar as pranchetas: ${e}`,size:(e,t)=>`${String(e)} × ${String(t)}`,boardCount:e=>e===1?`1 prancheta`:`${String(e)} pranchetas`}});function be(){return ye.of(a()?.locale)}var xe=typeof navigator<`u`&&navigator.userAgent.includes(`Mac`)?`⌘`:`Ctrl+`;function Se(e){let t=be();return(0,L.jsx)(L.Fragment,{children:(0,L.jsx)(ce,{id:`zoom`,priority:3,children:(0,L.jsxs)(ge,{children:[(0,L.jsx)(me,{asChild:!0,children:(0,L.jsxs)(I,{"aria-label":t.zoom,title:t.zoom,className:`tabular-nums`,"data-testid":`image-zoom`,children:[t.percent(Math.round(e.zoom*100)),(0,L.jsx)(_e,{className:`size-3`})]})}),(0,L.jsxs)(F,{align:`start`,children:[(0,L.jsx)(`div`,{className:`px-1 pb-1`,children:(0,L.jsx)(he,{"aria-label":t.zoom,className:`h-7 tabular-nums`,inputMode:`decimal`,defaultValue:t.percent(Math.round(e.zoom*100)),"data-testid":`image-zoom-typed`,onKeyDown:t=>{if(t.stopPropagation(),t.key!==`Enter`)return;let n=parseFloat(t.currentTarget.value.replace(`,`,`.`));Number.isFinite(n)&&n>0&&e.onZoom(n/100)}},Math.round(e.zoom*100))}),(0,L.jsxs)(P,{onSelect:()=>{e.onZoom(`in`)},children:[t.zoomIn,(0,L.jsx)(N,{children:`${xe}+`})]}),(0,L.jsxs)(P,{onSelect:()=>{e.onZoom(`out`)},children:[t.zoomOut,(0,L.jsx)(N,{children:`${xe}−`})]}),(0,L.jsxs)(P,{"data-testid":`image-zoom-fit`,onSelect:()=>{e.onZoom(`fit`)},children:[t.zoomFit,(0,L.jsx)(N,{children:`⇧1`})]}),(0,L.jsxs)(P,{"data-testid":`image-zoom-actual`,onSelect:()=>{e.onZoom(1)},children:[t.zoomActual,(0,L.jsx)(N,{children:`⇧0`})]})]})]})})})}var Ce=`normal.dissolve.darken.multiply.colorBurn.linearBurn.darkerColor.lighten.screen.colorDodge.linearDodge.lighterColor.overlay.softLight.hardLight.vividLight.linearLight.pinLight.hardMix.difference.exclusion.subtract.divide.hue.saturation.color.luminosity.passThrough`.split(`.`),we=e=>typeof e==`object`&&!!e&&(`__allyhubMedia`in e||`sha256`in e),R=w().min(0).max(1),Te=O([R,R,R,R]).refine(([e,t,n,r])=>n>0&&r>0&&e+n<=1+1e-9&&t+r<=1+1e-9,`[x, y, w, h] as shares of the frame, inside it, its sides more than 0`),z=A([j().min(1),h(we,`an imported picture`)]),B=w().min(0).max(100).refine(Number.isFinite,`a percent from 0 to 100`),V=w().min(0).max(1e3).refine(Number.isFinite),H=w().min(-360).max(360),U=v(Ce),Ee=/^#(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/iu,De=/^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)$/iu;function Oe(e){if(typeof e!=`string`)return!1;let t=e.trim();if(Ee.test(t)||De.test(t))return!0;if(!/^[a-z]+$/iu.test(t))return!1;let n=globalThis.CSS;return n?n.supports(`color`,t):t.length>2}var W=j().refine(Oe,`a CSS colour (#rrggbb, rgb(…), hsl(…) or a colour's name)`),ke=C({color:W,location:B,midpoint:B.optional()}),Ae=C({stops:m(ke).min(2),style:v([`linear`,`radial`,`angle`,`reflected`,`diamond`]).optional(),angle:H.optional(),scale:w().min(10).max(1e3).optional(),reverse:x().optional()});A([C({color:W}),C({gradient:Ae}),C({pattern:z,scale:w().min(1).max(1e3).optional()})]);var je=C({src:z.optional(),path:j().min(1).optional(),box:Te.optional(),mode:v([`alpha`,`luminance`]).optional(),density:B.optional(),feather:V.optional(),invert:x().optional(),enabled:x().optional()}),Me=A([z,je]),G={enabled:x().optional(),blendMode:U.optional(),opacity:B.optional()},Ne={...G,color:W.optional(),angle:H.optional(),distance:V.optional(),size:V.optional()},Pe=C({dropShadow:C({...Ne,spread:B.optional()}).optional(),innerShadow:C({...Ne,choke:B.optional()}).optional(),outerGlow:C({...G,color:W.optional(),spread:B.optional(),size:V.optional()}).optional(),innerGlow:C({...G,color:W.optional(),choke:B.optional(),size:V.optional(),source:v([`edge`,`center`]).optional()}).optional(),stroke:C({...G,color:W.optional(),size:V.optional(),position:v([`outside`,`inside`,`center`]).optional()}).optional(),colorOverlay:C({...G,color:W.optional()}).optional(),gradientOverlay:C({...G,gradient:Ae.optional()}).optional(),patternOverlay:C({...G,pattern:z,scale:w().min(1).max(1e3).optional()}).optional(),satin:C({...G,color:W.optional(),angle:H.optional(),distance:V.optional(),size:V.optional(),invert:x().optional()}).optional(),bevelEmboss:C({...G,style:v([`innerBevel`,`outerBevel`,`emboss`,`pillowEmboss`,`strokeEmboss`]).optional(),technique:v([`smooth`,`chiselHard`,`chiselSoft`]).optional(),depth:w().min(1).max(1e3).optional(),direction:v([`up`,`down`]).optional(),size:V.optional(),soften:V.optional(),angle:H.optional(),altitude:w().min(0).max(90).optional(),highlightMode:U.optional(),highlightColor:W.optional(),highlightOpacity:B.optional(),shadowMode:U.optional(),shadowColor:W.optional(),shadowOpacity:B.optional()}).optional()}),Fe=C({rotation:w().min(-360).max(360).optional(),flipH:x().optional(),flipV:x().optional()});C({blendMode:U.optional(),opacity:B.optional(),fillOpacity:B.optional(),clipping:x().optional(),mask:Me.optional(),effects:Pe.optional(),transform:Fe.optional(),visible:x().optional()});var K=w().min(0).max(255),Ie=C({inputBlack:K.optional(),inputWhite:K.optional(),gamma:w().min(.1).max(9.99).optional(),outputBlack:K.optional(),outputWhite:K.optional()}),Le=O([K,K]),Re=m(Le).min(2).max(16);b(`kind`,[C({kind:k(`levels`),rgb:Ie.optional(),red:Ie.optional(),green:Ie.optional(),blue:Ie.optional()}),C({kind:k(`curves`),rgb:Re.optional(),red:Re.optional(),green:Re.optional(),blue:Re.optional()}),C({kind:k(`brightnessContrast`),brightness:w().min(-150).max(150).optional(),contrast:w().min(-50).max(100).optional(),useLegacy:x().optional()}),C({kind:k(`hueSaturation`),hue:w().min(-180).max(180).optional(),saturation:w().min(-100).max(100).optional(),lightness:w().min(-100).max(100).optional(),colorize:x().optional()}),C({kind:k(`vibrance`),vibrance:w().min(-100).max(100).optional(),saturation:w().min(-100).max(100).optional()}),C({kind:k(`colorBalance`),shadows:O([w(),w(),w()]).optional(),midtones:O([w(),w(),w()]).optional(),highlights:O([w(),w(),w()]).optional(),preserveLuminosity:x().optional()}),C({kind:k(`blackAndWhite`),reds:w().min(-200).max(300).optional(),yellows:w().min(-200).max(300).optional(),greens:w().min(-200).max(300).optional(),cyans:w().min(-200).max(300).optional(),blues:w().min(-200).max(300).optional(),magentas:w().min(-200).max(300).optional()}),C({kind:k(`photoFilter`),color:W.optional(),density:B.optional(),preserveLuminosity:x().optional()}),C({kind:k(`invert`)}),C({kind:k(`threshold`),level:w().int().min(1).max(255).optional()}),C({kind:k(`gradientMap`),gradient:Ae.optional(),reverse:x().optional()}),C({kind:k(`exposure`),exposure:w().min(-20).max(20).optional(),offset:w().min(-.5).max(.5).optional(),gammaCorrection:w().min(.01).max(9.99).optional()})]),C({color:W.optional(),width:V.optional(),alignment:v([`inside`,`center`,`outside`]).optional(),dashes:m(w().min(0).max(1e3)).max(8).optional(),cap:v([`butt`,`round`,`square`]).optional(),join:v([`miter`,`round`,`bevel`]).optional(),opacity:B.optional()}),C({font:j().min(1).optional(),weight:w().int().min(100).max(900).optional(),italic:x().optional(),size:w().min(1).max(4096).optional(),color:W.optional(),tracking:w().min(-1e3).max(1e4).optional(),leading:A([w().min(0).max(5e3),k(`auto`)]).optional(),capitalization:v([`normal`,`allCaps`,`smallCaps`]).optional(),underline:x().optional(),strikeThrough:x().optional()}),C({justification:v([`left`,`center`,`right`,`justifyLeft`,`justifyCenter`,`justifyRight`,`justifyAll`]).optional(),firstLineIndent:w().min(-1296).max(1296).optional(),leftIndent:w().min(0).max(1296).optional(),rightIndent:w().min(0).max(1296).optional(),spaceBefore:w().min(0).max(1296).optional(),spaceAfter:w().min(0).max(1296).optional()});var ze=[`pixel`,`type`,`shape`,`smartObject`,`adjustment`,`fill`,`group`],q=e(s(),1),J=O([w(),w(),w(),w()]),Be=E({text:j(),box:J,size:w(),capHeight:w().optional(),color:j(),font:j(),weight:j(),lineHeight:w(),align:j(),letterSpacing:w().optional()}),Ve=E({key:j(),component:j(),kind:v(ze),parent:j().optional(),hidden:x(),style:_(j(),D()),box:J.optional(),words:m(E({prop:j(),key:j(),text:j()})),texts:m(Be),picture:E({file:j(),source:O([w(),w()]),whole:J,box:J,fit:j(),position:O([w(),w()]),crop:J.optional()}).optional()}),He=E({key:j(),title:j().optional(),width:S().positive(),height:S().positive(),background:j(),picture:y,layers:m(Ve)}),Ue=E({from:S().positive(),to:S().positive()}),We=Ue.extend({key:j().min(1)}),Ge=Ue.extend({key:j().min(1),layers:m(We)}),Ke={"image/versions":g(E({item:p}),E({piece:j(),title:j().optional(),script:j().min(1).optional(),versions:m(E({key:j(),lang:j().optional(),variant:j().optional(),script:p.optional()}))}),`An image's versions, one per combo, and its script in each version's language.`),"image/boards":g(E({...T,height:S().min(16).max(2048).optional()}),E({image:y,width:S().positive(),height:S().positive(),boards:m(E({key:j(),width:S().positive(),height:S().positive(),x:S().nonnegative()}))}),`An image version's boards drawn side by side, in order, at one height: its card and its preview.`),"image/edit":g(E({...T,scale:w().min(.05).max(2).optional()}),E({piece:j(),boards:m(He)}),`An image version's boards as its viewer shows them: each drawn, and its named layers with what each draws, the messages it shows and its picture (what Mark up finds under a mark).`),"image/stage":g(E({...T,board:j().min(1).optional()}),ee,"The address of an image version's stage page, for its viewer's sandboxed frame: a board drawn live, as large as the frame holds it, which moves to another board (`seek` by `part`)."),"image/sources":g(E({item:p}),E({path:p,boards:m(Ge)}),`Where each board and its layers are written in the image's module, by line: what a change to those lines changes.`)},qe=te(Ke),Je=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Ye(e,t){for(let n of t){let t=e.find(e=>e.key===n.key);if(!t)return{board:n.key};for(let e of n.layers){let r=t.layers.find(t=>t.key===e.key);if(!r||!Je(r,e))return{board:n.key,layer:e.key}}if(t.layers.length!==n.layers.length)return{board:n.key}}}var Xe=(e,t)=>e.from<=t.to&&t.from<=e.to,Ze=(e,t)=>e.filter(e=>Xe(e,t)).sort((e,t)=>e.to-e.from-(t.to-t.from))[0];function Qe(e,t,n=t){let r={from:t,to:n},i=Ze(e,r);if(!i)return;let a=Ze(i.layers,r);return{board:i.key,...a?{layer:a.key}:{}}}var $e=1,et=e=>`data:${e.mime};base64,${e.data}`;function tt(e){let t=i(),[n,r]=(0,q.useState)(),[a,o]=(0,q.useState)([]),[s,c]=(0,q.useState)(new Map),[l,u]=(0,q.useState)(),[d,f]=(0,q.useState)(0),[p,m]=(0,q.useState)(),[h,g]=(0,q.useState)(),[_,v]=(0,q.useState)(0),y=(0,q.useRef)(0),b=(0,q.useRef)(new Map);return(0,q.useEffect)(()=>t.on(`project/changed`,e=>{y.current=e.revision,v(e=>e+1)}),[t]),(0,q.useEffect)(()=>{if(e===void 0)return;let n={on:!0},i=y.current;return qe(t,`image/sources`,{item:e}).then(e=>{n.on&&m(e)},()=>void 0),(async()=>{let a=(await qe(t,`image/versions`,{item:e})).versions.map(e=>({key:e.key,lang:e.lang,variant:e.variant})),s=new Map,l;for(let n of a){let r=await qe(t,`image/edit`,{item:e,version:n.key,scale:$e});l=r.piece,s.set(n.key,{version:n,boards:r.boards})}if(n.on){for(let[e,t]of s){let n=b.current.get(e),r=n&&Ye(n.boards,t.boards);if(r){g({spot:r,version:e,at:Date.now()});break}}b.current=s,r(l),o(a),c(s),u(void 0),f(i)}})().catch(e=>{n.on&&u(e instanceof Error?e.message:String(e))}),()=>{n.on=!1}},[t,e,_]),{item:e,piece:n,versions:a,drawn:s,revision:d,sources:p,landed:h,error:l}}var nt=e=>typeof e==`object`&&!!e&&e.allyhub===!0&&typeof e.type==`string`;function rt(e){let t=i(),[n,a]=(0,q.useState)(),o=r(n),[s,c]=(0,q.useState)(new Map),l=(0,q.useRef)(new Map),u=(0,q.useRef)(1),d=e.wanted.map(e=>e.id).join(`
|
|
2
|
-
`);return(0,q.useEffect)(()=>{if(e.item===void 0)return;let n=!0,r=e.item;return Promise.all(e.wanted.slice(0,8).map(e=>qe(t,`image/stage`,{item:r,version:e.version,board:e.board}).then(t=>({w:e,r:t}),()=>void 0))).then(e=>{if(!n)return;let t=e.find(e=>e!==void 0);t&&a(t.r.probe),c(t=>{let n=new Map;for(let r of e){if(!r)continue;let e=t.get(r.w.id),i=()=>({n:u.current++,src:r.r.url,drawn:!1});e?.shown?e.shown.src===r.r.url?n.set(r.w.id,e):n.set(r.w.id,{shown:e.shown,pending:e.pending?.src===r.r.url?e.pending:i()}):n.set(r.w.id,{shown:i(),pending:void 0})}return n})}),()=>{n=!1}},[t,e.item,d,e.revision]),(0,q.useEffect)(()=>{let e=e=>{if(!nt(e.data)||e.data.type!==`ready`)return;let t;for(let[n,r]of l.current)r.contentWindow===e.source&&(t=n);t!==void 0&&c(e=>{let n=!1,r=new Map(e);for(let[i,a]of e)a.shown?.n===t&&!a.shown.drawn?(r.set(i,{...a,shown:{...a.shown,drawn:!0}}),n=!0):a.pending?.n===t&&(r.set(i,{shown:{...a.pending,drawn:!0},pending:void 0}),n=!0);return n?r:e})};return addEventListener(`message`,e),()=>{removeEventListener(`message`,e)}},[]),{frame:(e,t)=>{let n=s.get(e);return!n||o===void 0?null:(0,L.jsx)(at,{frames:n,sandbox:o,els:l,picture:t})},drawn:e=>s.get(e)?.shown?.drawn===!0}}function it(e){let t=/^data:([^;,]+);base64,(.*)$/su.exec(e);return t?.[1]!==void 0&&t[2]!==void 0?{mime:t[1],data:t[2]}:void 0}function at({frames:e,sandbox:t,els:n,picture:r}){let i=(0,q.useRef)(null),a=()=>{let e=i.current?.getBoundingClientRect();return e&&e.width>0&&e.height>0?{x:e.x,y:e.y,width:e.width,height:e.height}:void 0};o({element:()=>i.current,pictures:()=>{let e=a(),t=it(r);return Promise.resolve(e&&t?[{rect:e,...t}]:[])}});let s=(e,r)=>(0,L.jsx)(`iframe`,{ref:t=>{t?n.current.set(e.n,t):n.current.delete(e.n),r||(i.current=t)},src:e.src,title:``,tabIndex:-1,...t?{sandbox:`allow-scripts`}:{},"data-testid":r?`image-live-pending`:`image-live`,"data-drawn":e.drawn?``:void 0,className:`pointer-events-none absolute inset-0 size-full border-0`,style:{opacity:!r&&e.drawn?1:0}},e.n);return(0,L.jsxs)(L.Fragment,{children:[e.shown?s(e.shown,!1):null,e.pending?s(e.pending,!0):null]})}function ot(e,t,n,r){let i=e=>({x:(e.x-t.x)/t.zoom,y:(e.y-t.y)/t.zoom}),a=c(n,i),o=t=>st(e,t),s=[...e.layers].reverse(),l=e=>!e.hidden&&e.shown!==void 0&&u(n,{x:t.x+e.shown.left*t.zoom,y:t.y+e.shown.top*t.zoom,width:e.shown.width*t.zoom,height:e.shown.height*t.zoom}),d=s.filter(e=>e.kind!==`group`&&!o(e)&&l(e)),f=d.length>0?d:s.filter(e=>e.kind!==`group`&&l(e)),p=new Set,m=new Map(e.layers.map(e=>[e.key,e.parent]));for(let e of f)for(let t=e.parent;t!==void 0;t=m.get(t))p.add(t);let h=new Set([...f.map(e=>e.key),...p]);return s.filter(e=>h.has(e.key)).map(o=>{let s=[{in:`board ${e.key}`,width:e.width,height:e.height,...a,scale:1/t.zoom}],l=o.info.picture;if(l&&l.whole[2]>0&&l.whole[3]>0){let[e,r,a,o]=l.whole,[u,d]=l.source;s.push({in:`the picture`,file:l.file,width:u,height:d,...c(n,t=>{let n=i(t);return{x:(n.x-e)*u/a,y:(n.y-r)*d/o}}),scale:u/a/t.zoom})}return{...ct(e,o,r),regions:s}})}var st=(e,t)=>(t.kind===`adjustment`||t.kind===`fill`)&&t.box!==void 0&&t.box.left<=0&&t.box.top<=0&&t.box.left+t.box.width>=e.width&&t.box.top+t.box.height>=e.height;function ct(e,t,n){let r=t.info.picture,i=t.info.words[0]?.text??t.info.texts[0]?.text,a=n.lineOf(t.key);return{name:`layer ${t.name===t.key?`"${t.key}"`:`"${t.key}" (${t.name})`}, a ${t.kind}${r?` of ${r.file}`:``}, of board ${e.key}`,source:{path:n.file,...a===void 0?{}:{line:a}},...i===void 0?{}:{text:i}}}function lt(e,t,n){let r=(n.x-t.x)/t.zoom,i=(n.y-t.y)/t.zoom,a=e=>!e.hidden&&e.kind!==`group`&&e.shown!==void 0&&r>=e.shown.left&&r<=e.shown.left+e.shown.width&&i>=e.shown.top&&i<=e.shown.top+e.shown.height,o=[...e.layers].reverse();return o.find(t=>a(t)&&!st(e,t))??o.find(a)}function ut(e,t,n,r){if(n.shown!==void 0)return{element:ct(e,n,r),outline:l({x:t.x+n.shown.left*t.zoom,y:t.y+n.shown.top*t.zoom,width:n.shown.width*t.zoom,height:n.shown.height*t.zoom})}}function dt(e,t){let n=e.split(`
|
|
3
|
-
`).findIndex(e=>RegExp(`key:\\s*["'\`]${t.replace(/[.*+?^${}()|[\]\\]/gu,`\\$&`)}["'\`]`,`u`).test(e));return n<0?void 0:n+1}var ft=e=>e===void 0?void 0:{left:e[0],top:e[1],width:e[2],height:e[3]};function pt(e,t){let n=Math.max(e.left,t.left),r=Math.max(e.top,t.top),i=Math.min(e.left+e.width,t.left+t.width),a=Math.min(e.top+e.height,t.top+t.height);return i>n&&a>r?{left:n,top:r,width:i-n,height:a-r}:void 0}function mt(e){let t=new Map;for(let n of e){let e=n.info.style.clipping===!0&&n.kind!==`group`,r=e?t.get(n.parent):void 0;n.shown=r===void 0?n.box:r.shown&&n.box?pt(n.box,r.shown):void 0,e||t.set(n.parent,n)}}function ht(e,t,n){let r=t.layers.map(e=>({key:e.key,name:e.key,component:e.component,kind:e.kind,hidden:e.hidden,parent:e.parent,box:ft(e.box),shown:void 0,info:e}));return mt(r),{version:e,key:t.key,title:t.title??t.key,width:t.width,height:t.height,background:t.background,picture:n,layers:r}}function gt(e,t,n){return e.flatMap(e=>{let r=t.get(e.key);return r?[r.boards.map(t=>ht(e,t,n(t.picture)))]:[]})}var Y=48,_t=80,vt=20,yt=22,bt=26,X=40,Z=(e,t)=>`${e} ${t}`;function xt(e){let t=[];for(let n of e)n.forEach((e,n)=>{t[n]=Math.max(t[n]??0,e.width)});return t}var St=e=>Math.max(vt,_t*e);function Ct(e,t){let n=xt(e),r=e.length>1;return{width:n.reduce((e,n)=>e+n*t,0)+St(t)*Math.max(0,n.length-1)+96,height:e.reduce((e,n)=>e+Math.max(0,...n.map(e=>e.height))*t+yt+(r?bt:0),0)+X*Math.max(0,e.length-1)+96}}function wt(e,t,n,r){let i=xt(e),a=St(t),o=Ct(e,t),s=Math.max(0,((r?.width??0)-o.width)/2),c=Math.max(0,((r?.height??0)-o.height)/2),l=new Map,u=[],d=c+Y,f=0,p=e.length>1;for(let r of e){let e=r[0];p&&e&&(u.push({x:s+Y,y:d,label:n(e)}),d+=bt);let o=d;d+=yt;let c=s+Y,m=0;r.forEach((e,n)=>{l.set(Z(e.version.key,e.key),{x:c,y:d,labelY:o}),c+=(i[n]??e.width)*t+a,m=Math.max(m,e.height*t)}),f=Math.max(f,c-a+Y+s),d+=m+X}return{width:f,height:d-X+Y+c,boards:l,rows:u}}function Tt(e,t){let n=xt(e);if(n.length===0||t.width<=0||t.height<=0)return 1;let r=n.reduce((e,t)=>e+t,0),i=n.length-1,a=(t.width-96)/(r+_t*i),o=_t*a>=vt?a:(t.width-96-vt*i)/r,s=e.reduce((e,t)=>e+Math.max(...t.map(e=>e.height)),0),c=e.length*(yt+(e.length>1?bt:0))+X*(e.length-1),l=Math.min(o,(t.height-96-c)/s,1);return Math.max(.02,l)}var Q=e=>`${String(e)}px`,$=e=>`${String(e*100)}%`;function Et(e){let t=e.board.layers.find(t=>t.key===e.layer)?.shown;return t?(0,L.jsx)(`div`,{"data-note-chrome":``,"data-testid":e.selected?`image-selected`:`image-hovered`,"data-layer":e.layer,className:e.selected?`outline-pencil absolute shadow-[0_0_0_4px_var(--color-sheet),inset_0_0_0_2px_var(--color-sheet)] outline-2`:`outline-pencil absolute shadow-[0_0_0_2px_var(--color-sheet),inset_0_0_0_1px_var(--color-sheet)] outline-1`,style:{left:$(t.left/e.board.width),top:$(t.top/e.board.height),width:$(t.width/e.board.width),height:$(t.height/e.board.height)},children:e.selected&&e.bar!==void 0?(0,L.jsx)(`div`,{className:`pointer-events-auto absolute top-full left-1/2 mt-2 -translate-x-1/2`,children:e.bar}):null}):null}function Dt(e){let t=(e.agent.layer===void 0?void 0:e.board.layers.find(t=>t.key===e.agent.layer))?.box;return t?(0,L.jsx)(ve,{"data-testid":`image-agent`,label:e.agent.label,style:{left:$(t.left/e.board.width),top:$(t.top/e.board.height),width:$(t.width/e.board.width),height:$(t.height/e.board.height)}}):(0,L.jsx)(ve,{"data-testid":`image-agent`,label:e.agent.label,flag:`end`,className:`inset-0`})}function Ot(e){let t=be(),{board:n,zoom:r}=e;return(0,L.jsxs)(L.Fragment,{children:[(0,L.jsxs)(`div`,{className:`text-lead text-micro absolute flex h-5 items-end gap-2 truncate`,style:{left:Q(e.at.x),top:Q(e.at.labelY),width:Q(n.width*r)},"data-testid":`image-board-label`,children:[(0,L.jsx)(`span`,{className:`text-ink truncate font-medium`,children:n.title}),n.title.replace(/\s/gu,``).toLowerCase().replace(`×`,`x`).includes(`${String(n.width)}x${String(n.height)}`)?null:(0,L.jsx)(`span`,{className:`tabular-nums`,children:t.size(n.width,n.height)})]}),(0,L.jsxs)(`div`,{className:`bg-sheet absolute overflow-hidden shadow-[0_0_0_1px_var(--color-rule)]`,style:{left:Q(e.at.x),top:Q(e.at.y),width:Q(n.width*r),height:Q(n.height*r)},"data-testid":`image-board`,"data-board":n.key,"data-version":n.version.key,children:[(0,L.jsx)(`img`,{src:n.picture,alt:``,draggable:!1,className:`absolute inset-0 size-full max-w-none select-none`}),e.frame]}),e.agent||e.hovered!==void 0||e.selected!==void 0?(0,L.jsxs)(`div`,{className:`pointer-events-none absolute`,style:{left:Q(e.at.x),top:Q(e.at.y),width:Q(n.width*r),height:Q(n.height*r)},children:[e.agent?(0,L.jsx)(Dt,{board:n,agent:e.agent}):null,e.hovered===void 0?null:(0,L.jsx)(Et,{board:n,layer:e.hovered,selected:!1}),e.selected===void 0?null:(0,L.jsx)(Et,{board:n,layer:e.selected,selected:!0,bar:e.selectionBar})]}):null]})}function kt({ref:e,...t}){let n=(0,q.useRef)(null),r=(0,q.useCallback)(t=>{n.current=t,typeof e==`function`?e(t):e&&(e.current=t)},[e]),i=(0,q.useRef)(t.onZoomAt);return(0,q.useEffect)(()=>{i.current=t.onZoomAt}),(0,q.useEffect)(()=>{let e=n.current;if(!e)return;let t=t=>{if(!t.ctrlKey&&!t.metaKey)return;t.preventDefault();let n=e.getBoundingClientRect();i.current(Math.exp(-t.deltaY/200),{x:t.clientX-n.left,y:t.clientY-n.top})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>{e.removeEventListener(`wheel`,t)}},[]),(0,L.jsx)(`div`,{ref:r,className:`bg-stone focus-visible:outline-pencil relative min-h-0 min-w-0 flex-1 overflow-auto outline-none focus-visible:-outline-offset-1 focus-visible:outline-1`,tabIndex:0,role:`application`,"aria-label":t.label,"data-testid":`image-surface`,style:{cursor:t.cursor},onPointerDown:t.onPointerDown,onPointerMove:t.onPointerMove,onPointerUp:t.onPointerUp,onPointerCancel:t.onPointerUp,onLostPointerCapture:t.onPointerUp,onPointerLeave:t.onPointerLeave,onKeyDown:t.onKeyDown,onKeyUp:t.onKeyUp,children:(0,L.jsxs)(`div`,{className:`relative`,style:{width:Q(t.layout.width),height:Q(t.layout.height)},"data-testid":`image-world`,children:[t.layout.rows.map(e=>(0,L.jsx)(`div`,{className:`text-lead absolute text-xs font-medium`,style:{left:Q(e.x),top:Q(e.y)},"data-testid":`image-row-label`,children:e.label},e.y)),t.rows.flatMap(e=>e.map(e=>{let n=Z(e.version.key,e.key),r=t.layout.boards.get(n);return r?(0,L.jsx)(Ot,{board:e,zoom:t.zoom,at:r,frame:t.frame?.(n,e.picture),agent:t.agent?.id===n?{label:t.agent.label,layer:t.agent.layer}:void 0,hovered:t.hovered?.id===n?t.hovered.layer:void 0,selected:t.selected?.id===n?t.selected.layer:void 0,selectionBar:t.selectionBar},n):null}))]})})}function At(e,t){if(e!==void 0)try{return new Intl.DisplayNames([t??`en`],{type:`language`}).of(e)}catch{return e}}var jt=3e4;function Mt(e){let t=e?.board??e?.part;if(typeof t!=`string`)return;let n=e?.layer;return typeof n==`string`?{board:t,layer:n}:{board:t}}var Nt=e=>e instanceof Element&&e.closest(`input, textarea, [contenteditable='true'], [role='combobox']`)!==null;function Pt(e){return e.bar(e.tools)}function Ft(e){let r=be(),o=i(),s=a(),c=(0,q.useMemo)(()=>gt(e.data.versions,e.data.drawn,et),[e.data.versions,e.data.drawn]),l=c.flat(),u=(0,q.useRef)(null),[f,p]=(0,q.useState)(),[m,h]=(0,q.useState)(!0),[g,_]=(0,q.useState)(`default`),[v,y]=(0,q.useState)(!1),b=(0,q.useRef)(void 0),x=e=>[At(e.version.lang,s?.locale),e.version.variant].filter(e=>e!==void 0).join(` · `)||e.version.key,[S,C]=(0,q.useState)();(0,q.useLayoutEffect)(()=>{let e=u.current;if(!e)return;let t=()=>{C(t=>t?.width===e.offsetWidth&&t.height===e.offsetHeight?t:{width:e.offsetWidth,height:e.offsetHeight})};t();let n=new ResizeObserver(t);return n.observe(e),()=>{n.disconnect()}},[]);let w=m&&S&&c.length>0?Tt(c,S):f??1,T=(0,q.useMemo)(()=>wt(c,w,x,S),[c,w,s?.locale,S]),E=(0,q.useRef)(void 0);(0,q.useLayoutEffect)(()=>{let e=u.current,t=E.current;if(!e||!t)return;E.current=void 0;let n=w/t.from;e.scrollLeft=(e.scrollLeft+t.at.x)*n-t.at.x,e.scrollTop=(e.scrollTop+t.at.y)*n-t.at.y},[w]);let ee=(0,q.useRef)(!1);(0,q.useEffect)(()=>{if(ee.current||e.board===void 0||c.length===0)return;let t=u.current?.querySelector(`[data-testid="image-board"][data-board="${CSS.escape(e.board)}"]`);t&&(ee.current=!0,t.scrollIntoView({block:`nearest`,inline:`nearest`}))},[e.board,c.length,T]);let{agent:D,following:O}=t(),k=pe(),A=(()=>{if(D?.doing===void 0)return;let{landed:t,sources:n}=e.data,r=D.source,i=r?.path!==void 0&&r.path===n?.path&&r.from!==void 0?Qe(n.boards,r.from,r.to):void 0,a=t&&t.at>=D.at-jt?t:void 0,o=Mt(D.place)??i??a?.spot;if(!o)return;let s=l.filter(e=>e.key===o.board),c=s.find(e=>e.version.key===a?.version)??s[0];if(!c)return;let u=c.layers.some(e=>e.key===o.layer)?o.layer:void 0;return{id:Z(c.version.key,c.key),layer:u,label:k(D)}})(),j=O&&A?`${A.id}\n${A.layer??``}`:void 0;(0,q.useEffect)(()=>{let e=u.current;if(j===void 0||!e)return;let[t=``,n=``]=j.split(`
|
|
4
|
-
`),r=l.find(e=>Z(e.version.key,e.key)===t),i=T.boards.get(t);if(!r||!i)return;let a=r.layers.find(e=>e.key===n)?.box??{left:0,top:0,width:r.width,height:r.height},o=(e,t,n,r)=>t+96>r||e-48<n?e-48:e+t+48>n+r?e+t+48-r:n;e.scrollTo({left:o(i.x+a.left*w,a.width*w,e.scrollLeft,e.clientWidth),top:o(i.y+a.top*w,a.height*w,e.scrollTop,e.clientHeight)})},[j]);let te=rt({item:e.data.item,wanted:l.map(e=>({id:Z(e.version.key,e.key),version:e.version.key,board:e.key})),revision:e.data.revision}),ne=(e,t)=>{h(!1);let n=u.current;E.current={at:t??{x:(n?.clientWidth??0)/2,y:(n?.clientHeight??0)/2},from:w},p(Math.min(8,Math.max(.02,e)))},M=e=>{e===`fit`?h(!0):ne(typeof e==`number`?e:w*(e===`in`?1.25:.8))},ce=(e,t)=>u.current?.querySelector(`[data-testid="image-board"][data-version="${CSS.escape(e)}"][data-board="${CSS.escape(t)}"]`)?.getBoundingClientRect(),de=(0,q.useRef)(``),me=e=>{for(let t of l){let n=ce(t.version.key,t.key);if(n&&e.x>=n.left&&e.x<=n.right&&e.y>=n.top&&e.y<=n.bottom)return{b:t,r:n}}},N=ae()!==void 0,[P,he]=(0,q.useState)(),[F,ge]=(0,q.useState)(),I=(e,t)=>({x:e.x,y:e.y,zoom:e.width/t.width}),_e=e=>{let t=me(e),n=t?lt(t.b,I(t.r,t.b),e):void 0;return t&&n?{id:Z(t.b.version.key,t.b.key),layer:n.key}:void 0},ve=(e,t)=>e?.id===t?.id&&e?.layer===t?.layer,ye={file:e.entry,lineOf:e=>dt(de.current,e)},xe=t=>{let n=At(t.version.lang,`en`);return`on board ${t.key}${n===void 0||e.data.versions.length<2?``:` (${n})`}`},Se=e=>{u.current?.focus({preventScroll:!0});let t=u.current;if(N&&!v&&e.button!==1){let t=_e({x:e.clientX,y:e.clientY});(e.button===0||t)&&ge(t)}(v||e.button===1)&&t&&(e.currentTarget.setPointerCapture(e.pointerId),b.current={x:e.clientX,y:e.clientY,left:t.scrollLeft,top:t.scrollTop},_(`grabbing`))},Ce=()=>{b.current&&(b.current=void 0,_(v?`grab`:`default`))};return n({hold:async()=>(de.current=await o[`files/read`]({path:e.entry}).then(e=>e.text,()=>``),{key:`${e.entry}@${String(e.data.revision)}`,what:`The image ${e.entry}, its boards side by side${e.data.versions.length>1?`, a version a row`:``}`,source:{path:e.entry}}),locate:t=>{let n=d(t)[0],r=n?me(n):void 0;if(!n||!r)return Promise.resolve({elements:[]});let i=At(r.b.version.lang,`en`),a=e=>`${String(Math.round(Math.min(1,Math.max(0,e))*100))}%`,o=a((n.x-r.r.x)/r.r.width),s=a((n.y-r.r.y)/r.r.height);return Promise.resolve({elements:ot(r.b,{x:r.r.x,y:r.r.y,zoom:r.r.width/r.b.width},t,{file:e.entry,lineOf:e=>dt(de.current,e)}),where:`on board ${r.b.key}${i===void 0||e.data.versions.length<2?``:` (${i})`}, at ${o} across and ${s} down it`})},pick:e=>{let t=me(e),n=t?lt(t.b,I(t.r,t.b),e):void 0,r=t&&n?ut(t.b,I(t.r,t.b),n,ye):void 0;return Promise.resolve(t&&r?{...r,where:xe(t.b)}:void 0)},selected:()=>{let e=l.find(e=>Z(e.version.key,e.key)===F?.id),t=e?.layers.find(e=>e.key===F?.layer),n=e?ce(e.version.key,e.key):void 0,r=e&&t&&n?ut(e,I(n,e),t,ye):void 0;return Promise.resolve(e&&r?[{...r,where:xe(e)}]:[])}}),(0,L.jsxs)(`div`,{className:`relative flex size-full min-h-0 flex-col`,"data-testid":`image-viewer`,children:[(0,L.jsx)(Pt,{bar:e.bar,tools:{zoom:w,onZoom:M}}),(0,L.jsxs)(se,{children:[(0,L.jsx)(re,{asChild:!0,children:(0,L.jsx)(`div`,{className:`flex min-h-0 flex-1`,children:(0,L.jsx)(kt,{ref:u,rows:c,layout:T,zoom:w,cursor:v&&g==="default"?`grab`:g,frame:te.frame,agent:A,hovered:ve(P,F)?void 0:P,selected:F,selectionBar:(0,L.jsx)(ie,{}),onPointerLeave:()=>{he(void 0)},onPointerDown:Se,onPointerMove:e=>{let t=b.current,n=u.current;if(t&&e.buttons===0){Ce();return}if(t&&n){n.scrollLeft=t.left-(e.clientX-t.x),n.scrollTop=t.top-(e.clientY-t.y);return}if(!N)return;let r=v||e.buttons!==0?void 0:_e({x:e.clientX,y:e.clientY});ve(r,P)||he(r)},onPointerUp:Ce,onKeyDown:e=>{if(Nt(e.target))return;let t=e.metaKey||e.ctrlKey,n=e.key===`Escape`&&F?()=>{ge(void 0)}:e.key===` `?()=>{e.repeat||y(!0),_(`grab`)}:e.shiftKey&&e.code===`Digit1`?()=>{M(`fit`)}:e.shiftKey&&e.code===`Digit0`?()=>{M(1)}:t&&(e.key===`=`||e.key===`+`)?()=>{M(`in`)}:t&&e.key===`-`?()=>{M(`out`)}:void 0;n&&(e.preventDefault(),n())},onKeyUp:e=>{e.key===` `&&(y(!1),_(`default`))},onZoomAt:(e,t)=>{ne(w*e,t)},label:r.boards})})}),(0,L.jsxs)(fe,{className:`w-60`,"data-testid":`image-menu`,children:[(0,L.jsxs)(oe,{onSelect:()=>{M(`fit`)},children:[r.zoomFit,(0,L.jsx)(ue,{children:`⇧1`})]}),(0,L.jsx)(le,{})]})]})]})}var It=e=>typeof e==`object`&&!!e&&typeof e.board==`string`;function Lt(){let e=be(),t=a(),n=tt(t?.item.id);if(n.piece===void 0||t===void 0)return(0,L.jsx)(`div`,{className:`text-lead flex size-full items-center justify-center text-sm`,"data-testid":`image-editor`,"data-state":n.error===void 0?`loading`:`error`,children:n.error===void 0?e.loading:e.couldNotDraw(n.error)});let r=It(t.place)?t.place:void 0;return(0,L.jsxs)(`div`,{className:`flex size-full min-h-0 flex-col`,"data-testid":`image-editor`,"data-state":`ready`,children:[(0,L.jsx)(Ft,{entry:t.item.entry,data:n,board:r?.board,bar:t=>(0,L.jsx)(M,{start:(0,L.jsx)(de,{testid:`image-bar`,"aria-label":e.zoom,children:(0,L.jsx)(Se,{...t})}),exports:{versions:n.versions.map(e=>({key:e.key,label:e.lang??e.key})),facts:e.boardCount(n.drawn.values().next().value?.boards.length??0)}})}),n.drawn.size>0&&[...n.drawn.values()].every(e=>e.boards.length===0)?(0,L.jsx)(`p`,{className:`text-lead p-6 text-sm`,children:e.noBoards}):null]})}export{Lt as ImageEditor,Lt as default,ye as WORDS};
|