allyhub 0.9.0 → 0.11.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 +16 -0
- package/dist/commands/auth.js +4 -4
- package/dist/commands/cloud-tools.js +11 -11
- package/dist/commands/dev.js +2 -2
- package/dist/commands/frames/compare.js +2 -2
- package/dist/commands/frames/piece.js +1 -1
- package/dist/commands/frames/report.js +2 -0
- package/dist/commands/frames.js +11 -9
- package/dist/commands/index.js +1 -1
- package/dist/commands/inspect/common.js +4 -2
- package/dist/commands/inspect/facts.js +3 -3
- package/dist/commands/inspect/layout.js +1 -1
- package/dist/commands/orgs.js +2 -2
- package/dist/commands/render.js +2 -2
- package/dist/help.js +4 -4
- package/dist/main.js +8 -7
- package/dist/node_modules/@allyhub/3d-extension/dist/stage-routes.js +1 -1
- package/dist/node_modules/@allyhub/3d-extension/package.json +34 -2
- package/dist/node_modules/@allyhub/audio/package.json +1 -1
- package/dist/node_modules/@allyhub/browser/dist/emoji.d.ts +29 -0
- package/dist/node_modules/@allyhub/browser/dist/emoji.js +57 -0
- package/dist/node_modules/@allyhub/browser/dist/picture.d.ts +18 -0
- package/dist/node_modules/@allyhub/browser/dist/picture.js +2 -0
- package/dist/node_modules/@allyhub/browser/package.json +9 -1
- package/dist/node_modules/@allyhub/build/dist/index.d.ts +1 -0
- package/dist/node_modules/@allyhub/build/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/build/dist/kind-build.d.ts +7 -0
- package/dist/node_modules/@allyhub/build/dist/made-notes.d.ts +9 -0
- package/dist/node_modules/@allyhub/build/dist/made-notes.js +2 -0
- package/dist/node_modules/@allyhub/build/dist/project-tool.d.ts +17 -0
- package/dist/node_modules/@allyhub/build/dist/stage-route.d.ts +7 -0
- package/dist/node_modules/@allyhub/build/package.json +1 -1
- package/dist/node_modules/@allyhub/canvas-extension/package.json +2 -1
- package/dist/node_modules/@allyhub/canvas-extension/skills/allyhub/references/canvas.md +4 -24
- package/dist/node_modules/@allyhub/canvas-model/package.json +1 -1
- package/dist/node_modules/@allyhub/chart/dist/chart-xml.js +2 -2
- package/dist/node_modules/@allyhub/chart/dist/chart.js +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/client.d.ts +10 -0
- package/dist/node_modules/@allyhub/cloud/dist/client.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/config.d.ts +9 -0
- package/dist/node_modules/@allyhub/cloud/dist/config.js +1 -1
- package/dist/node_modules/@allyhub/cloud/dist/credentials.d.ts +4 -4
- package/dist/node_modules/@allyhub/cloud/dist/credentials.js +2 -2
- package/dist/node_modules/@allyhub/cloud/dist/device.d.ts +12 -0
- package/dist/node_modules/@allyhub/cloud/dist/device.js +2 -0
- 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/components/r/callout.json +1 -1
- package/dist/node_modules/@allyhub/components/src/callout.ts +98 -13
- package/dist/node_modules/@allyhub/dev-server/dist/exports.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/inputs.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/live.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/pages.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/ports.js +2 -0
- 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/respond.js +2 -0
- package/dist/node_modules/@allyhub/dev-server/dist/reveal.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/routes.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/server.js +2 -2
- package/dist/node_modules/@allyhub/dev-server/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/dist/watcher.js +1 -1
- package/dist/node_modules/@allyhub/dev-server/package.json +1 -1
- package/dist/node_modules/@allyhub/diagnostics/dist/problem.d.ts +7 -0
- package/dist/node_modules/@allyhub/diagnostics/package.json +1 -1
- package/dist/node_modules/@allyhub/doc/dist/captions.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/docx.js +4 -4
- package/dist/node_modules/@allyhub/doc/dist/html.js +51 -92
- package/dist/node_modules/@allyhub/doc/dist/model.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/page.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/paper.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/table.js +1 -1
- package/dist/node_modules/@allyhub/doc/dist/write.js +22 -22
- package/dist/node_modules/@allyhub/doc/package.json +1 -1
- package/dist/node_modules/@allyhub/doc-extension/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/doc-extension/package.json +19 -6
- package/dist/node_modules/@allyhub/doc-print/dist/pages.js +5 -5
- package/dist/node_modules/@allyhub/doc-print/dist/print.js +10 -10
- 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/faces.d.ts +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.d.ts +87 -1
- package/dist/node_modules/@allyhub/formats/dist/data/sheet.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/data/slides.d.ts +89 -0
- package/dist/node_modules/@allyhub/formats/dist/data/slides.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/note-shape.d.ts +20 -0
- package/dist/node_modules/@allyhub/formats/dist/note-shape.js +1 -1
- package/dist/node_modules/@allyhub/formats/dist/schemas.d.ts +50 -0
- package/dist/node_modules/@allyhub/formats/package.json +1 -1
- package/dist/node_modules/@allyhub/i18n/package.json +1 -1
- package/dist/node_modules/@allyhub/image-draw/package.json +1 -1
- package/dist/node_modules/@allyhub/image-extension/dist/export.js +4 -1
- package/dist/node_modules/@allyhub/image-extension/package.json +16 -6
- package/dist/node_modules/@allyhub/image-extension/skills/allyhub/references/images.md +7 -39
- 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/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/LICENSE +241 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/article-build.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/article-kind.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/build-plugins.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/build.js +5 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/media.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/stage-module.js +82 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/stage.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-extension/dist/workspace.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-extension/package.json +287 -0
- package/dist/node_modules/@allyhub/linkedin-extension/skills/allyhub/references/linkedin.md +12 -0
- package/dist/node_modules/@allyhub/linkedin-model/LICENSE +241 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/article-check.js +5 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/article.js +3 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/check.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/count.js +3 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/edit.js +3 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/html.js +19 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/limits.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/little.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/post.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-model/dist/requests.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-model/package.json +14 -0
- package/dist/node_modules/@allyhub/linkedin-view/LICENSE +241 -0
- package/dist/node_modules/@allyhub/linkedin-view/dist/article.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-view/dist/fold.js +3 -0
- package/dist/node_modules/@allyhub/linkedin-view/dist/index.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-view/dist/post.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-view/dist/stage.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-view/dist/text.js +2 -0
- package/dist/node_modules/@allyhub/linkedin-view/package.json +21 -0
- package/dist/node_modules/@allyhub/linkedin-view/src/style.css +600 -0
- 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/dist/vision/faces.js +1 -1
- package/dist/node_modules/@allyhub/media-extension/package.json +7 -4
- package/dist/node_modules/@allyhub/model/package.json +1 -1
- package/dist/node_modules/@allyhub/ooxml/dist/geometry/index.js +1 -1
- package/dist/node_modules/@allyhub/ooxml/package.json +1 -1
- package/dist/node_modules/@allyhub/piece/dist/layer.d.ts +2 -0
- package/dist/node_modules/@allyhub/piece/dist/layout.d.ts +16 -0
- package/dist/node_modules/@allyhub/piece/dist/page/index.d.ts +1 -1
- package/dist/node_modules/@allyhub/piece/dist/page/index.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/page/locate.d.ts +14 -1
- package/dist/node_modules/@allyhub/piece/dist/page/locate.js +1 -1
- package/dist/node_modules/@allyhub/piece/dist/stage.d.ts +18 -0
- package/dist/node_modules/@allyhub/piece/package.json +1 -1
- package/dist/node_modules/@allyhub/project/dist/version.js +1 -1
- package/dist/node_modules/@allyhub/project/package.json +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/account.d.ts +140 -0
- package/dist/node_modules/@allyhub/protocol/dist/account.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/auth.d.ts +19 -1
- package/dist/node_modules/@allyhub/protocol/dist/auth.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/cloud.d.ts +157 -0
- package/dist/node_modules/@allyhub/protocol/dist/cloud.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/editor.d.ts +10 -2
- package/dist/node_modules/@allyhub/protocol/dist/editor.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/frame.d.ts +101 -186
- package/dist/node_modules/@allyhub/protocol/dist/frame.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/mail.d.ts +1 -0
- package/dist/node_modules/@allyhub/protocol/dist/mail.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/notes.d.ts +92 -94
- package/dist/node_modules/@allyhub/protocol/dist/notes.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.d.ts +17 -0
- package/dist/node_modules/@allyhub/protocol/dist/snapshots.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/teams.d.ts +7 -0
- package/dist/node_modules/@allyhub/protocol/dist/teams.js +1 -1
- package/dist/node_modules/@allyhub/protocol/dist/tools.d.ts +15 -3
- package/dist/node_modules/@allyhub/protocol/dist/tools.js +1 -1
- 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/dist/encode.js +1 -1
- package/dist/node_modules/@allyhub/render/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/render/dist/look.js +1 -1
- package/dist/node_modules/@allyhub/render/dist/render.js +2 -2
- package/dist/node_modules/@allyhub/render/package.json +1 -1
- package/dist/node_modules/@allyhub/report-extension/LICENSE +241 -0
- package/dist/node_modules/@allyhub/report-extension/dist/build.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/check.js +3 -0
- package/dist/node_modules/@allyhub/report-extension/dist/cli/find.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/cli/index.js +5 -0
- package/dist/node_modules/@allyhub/report-extension/dist/cli/picture.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/export.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/inline.js +58 -0
- package/dist/node_modules/@allyhub/report-extension/dist/page.js +21 -0
- package/dist/node_modules/@allyhub/report-extension/dist/project-tools.js +21 -0
- package/dist/node_modules/@allyhub/report-extension/dist/styles.js +5 -0
- package/dist/node_modules/@allyhub/report-extension/dist/theme.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/tools.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/dist/workspace.js +2 -0
- package/dist/node_modules/@allyhub/report-extension/package.json +182 -0
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/STYLE.md +132 -0
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/style.css +105 -0
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/style.json +17 -0
- package/dist/node_modules/@allyhub/report-extension/styles/allyhub/tokens.js +38 -0
- 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/player/clips.js +1 -1
- 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/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery/dist/index.d.ts +2 -2
- package/dist/node_modules/@allyhub/scenery/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/scenery/dist/moire.d.ts +45 -5
- package/dist/node_modules/@allyhub/scenery/dist/moire.js +2 -2
- package/dist/node_modules/@allyhub/scenery/dist/phone.d.ts +4 -3
- package/dist/node_modules/@allyhub/scenery/dist/phone.js +1 -1
- package/dist/node_modules/@allyhub/scenery/package.json +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/grade.d.ts +7 -0
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/grade.js +2 -0
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/index.d.ts +4 -3
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/index.js +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/screens.d.ts +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/layer/screens.js +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/measure/facts.js +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/page/screens.d.ts +8 -0
- package/dist/node_modules/@allyhub/scenery-host/dist/page/screens.js +1 -1
- package/dist/node_modules/@allyhub/scenery-host/dist/viewer.d.ts +6 -0
- package/dist/node_modules/@allyhub/scenery-host/dist/viewer.js +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/define.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/kernels.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/maths.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/functions/text.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/indexes.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/calc/types.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/chart.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/export.js +2 -4
- package/dist/node_modules/@allyhub/sheet/dist/formula/move.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/parse.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/formula/print.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/inspect.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/printed.js +2 -0
- package/dist/node_modules/@allyhub/sheet/dist/values.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/workbook.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/write.js +15 -15
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/charts.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/formula.js +2 -2
- 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/sax.js +3 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/styles.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/write.js +1 -1
- package/dist/node_modules/@allyhub/sheet/dist/xlsx/xml.js +3 -2
- package/dist/node_modules/@allyhub/sheet/package.json +1 -1
- package/dist/node_modules/@allyhub/sheet-extension/dist/export.js +2 -6
- package/dist/node_modules/@allyhub/sheet-extension/package.json +24 -9
- package/dist/node_modules/@allyhub/slides-core/dist/api.js +2 -2
- package/dist/node_modules/@allyhub/slides-core/dist/capabilities.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/enums.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/measure.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/resolve.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/dist/sdk.js +1 -1
- package/dist/node_modules/@allyhub/slides-core/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-extension/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/slides-extension/package.json +22 -16
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/code.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/import/index.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/common.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/shapes.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/read/text.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/shapes.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/text.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/dist/write.js +2 -2
- package/dist/node_modules/@allyhub/slides-pptx/dist/xml.js +1 -1
- package/dist/node_modules/@allyhub/slides-pptx/package.json +1 -1
- package/dist/node_modules/@allyhub/slides-runtime/dist/draw.js +2 -2
- package/dist/node_modules/@allyhub/slides-runtime/dist/load.js +5 -5
- 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/fonts/caladea/400-italic.css +19 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/400.css +19 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/700-italic.css +19 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/700.css +19 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/cambria.css +76 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/caladea/files/caladea-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/400-italic.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/400.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/700-italic.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/700.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/courier-new.css +316 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-greek-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-hebrew-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-hebrew-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-hebrew-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-hebrew-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-vietnamese-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-vietnamese-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-vietnamese-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/cousine/files/cousine-vietnamese-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/400-italic.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/400.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/700-italic.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/700.css +79 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/LICENSE +93 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-cyrillic-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-greek-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-hebrew-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-hebrew-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-hebrew-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-hebrew-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-ext-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-ext-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-ext-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-latin-ext-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-vietnamese-400-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-vietnamese-400-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-vietnamese-700-italic.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/files/tinos-vietnamese-700-normal.woff2 +0 -0
- package/dist/node_modules/@allyhub/stage-page/dist/fonts/tinos/times-new-roman.css +316 -0
- package/dist/node_modules/@allyhub/stage-page/dist/host.js +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 +3 -0
- package/dist/node_modules/@allyhub/stage-page/dist/runtime/stage.js +1 -1
- package/dist/node_modules/@allyhub/stage-page/package.json +1 -1
- package/dist/node_modules/@allyhub/stage-runtime/dist/runtime.js +18 -18
- package/dist/node_modules/@allyhub/stage-runtime/package.json +1 -1
- package/dist/node_modules/@allyhub/video-core/dist/schema.js +1 -1
- package/dist/node_modules/@allyhub/video-core/package.json +1 -1
- package/dist/node_modules/@allyhub/video-extension/dist/export.js +1 -1
- package/dist/node_modules/@allyhub/video-extension/package.json +17 -4
- package/dist/node_modules/@allyhub/video-measure/dist/version.js +1 -1
- package/dist/node_modules/@allyhub/video-measure/package.json +1 -1
- package/dist/node_modules/@allyhub/video-sdk/dist/phone.js +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/dist/held.js +2 -0
- package/dist/node_modules/@allyhub/website-extension/dist/preview.js +5 -5
- package/dist/node_modules/@allyhub/website-extension/dist/project-tools.js +24 -1
- package/dist/node_modules/@allyhub/website-extension/dist/tools.js +1 -1
- package/dist/node_modules/@allyhub/website-extension/package.json +49 -2
- package/dist/node_modules/@allyhub/x-extension/dist/build.js +4 -3
- package/dist/node_modules/@allyhub/x-extension/package.json +43 -15
- package/dist/node_modules/@allyhub/x-extension/skills/allyhub/references/x.md +7 -62
- package/dist/node_modules/@allyhub/x-model/package.json +1 -1
- package/dist/node_modules/@allyhub/x-view/dist/article.js +1 -1
- package/dist/node_modules/@allyhub/x-view/dist/index.js +1 -1
- package/dist/node_modules/@allyhub/x-view/dist/post.js +2 -2
- package/dist/node_modules/@allyhub/x-view/package.json +1 -1
- package/dist/package.json +12 -10
- package/dist/text/facts-text.js +5 -5
- package/dist/text/index.js +1 -1
- package/dist/text/long-text.js +4 -0
- package/dist/works.js +1 -1
- package/editor-web/assets/{abnfDiagram-WEYOIA3C-CN5PiJYY.js → abnfDiagram-WEYOIA3C-BKmMA6gn.js} +1 -1
- package/editor-web/assets/{architecture-WOLXFQ4H-BnvZtQYk.js → architecture-WOLXFQ4H-BEFBgb4k.js} +1 -1
- package/editor-web/assets/{architectureDiagram-ZHVYKT53-tkcEcFQ8.js → architectureDiagram-ZHVYKT53-_u5YfCjY.js} +1 -1
- package/editor-web/assets/{arrow-up-DTP2yVSU.js → arrow-up-B5rJbBv0.js} +1 -1
- package/editor-web/assets/article-BUmD3xtR.js +8 -0
- package/editor-web/assets/article-DNioBb3p.js +7 -0
- package/editor-web/assets/{audio-lines-Ti8-m7H2.js → audio-lines-CzuzsGjI.js} +1 -1
- package/editor-web/assets/{blockDiagram-RJAE7QA3-DhqEIpie.js → blockDiagram-RJAE7QA3-DybfaO3Z.js} +1 -1
- package/editor-web/assets/bookmark-Dsd3kHJJ.js +1 -0
- package/editor-web/assets/button-eGxLxbv9.js +41 -0
- package/editor-web/assets/{c4Diagram-XDPPPE54-Bg9G95tl.js → c4Diagram-XDPPPE54-BfqLHB5i.js} +1 -1
- package/editor-web/assets/calc-worker-D2pGis6e.js +45 -0
- package/editor-web/assets/channel-TNPgFDrw.js +1 -0
- package/editor-web/assets/chart-C37xvZT2.js +1 -0
- package/editor-web/assets/chart-no-axes-column-BVkeF_Mr.js +1 -0
- package/editor-web/assets/{chunk-2E7WHVMD-C8Ve9lAa.js → chunk-2E7WHVMD-BVp1I_d0.js} +1 -1
- package/editor-web/assets/{chunk-4EMNKR2T-BDWwPUnT.js → chunk-4EMNKR2T-CTdgWEMr.js} +1 -1
- package/editor-web/assets/{chunk-55XCU76K-BQiNPKgx.js → chunk-55XCU76K-7pnsxeaP.js} +1 -1
- package/editor-web/assets/{chunk-7S6XSTFO-QoEt-6jf.js → chunk-7S6XSTFO-Dc0Dvkq7.js} +1 -1
- package/editor-web/assets/{chunk-AQDTSKZB-BeuwIv0-.js → chunk-AQDTSKZB-VAILIsfx.js} +1 -1
- package/editor-web/assets/{chunk-DSNLSHJZ-BHW7sLAz.js → chunk-DSNLSHJZ-CUDx1Rv5.js} +1 -1
- package/editor-web/assets/{chunk-HAGFOTED-bbGED0hu.js → chunk-HAGFOTED-DAoEe-dJ.js} +1 -1
- package/editor-web/assets/{chunk-HNE4Q36P-FltWp8yo.js → chunk-HNE4Q36P-g0akya12.js} +1 -1
- package/editor-web/assets/{chunk-NQOKRVIF-NeQzr6kH.js → chunk-NQOKRVIF-hTGjzXdJ.js} +1 -1
- package/editor-web/assets/{chunk-UHW7PFBP-eA4-WUhn.js → chunk-UHW7PFBP-BgLV8BIJ.js} +1 -1
- package/editor-web/assets/{chunk-VQ5W62QI-BPPv325z.js → chunk-VQ5W62QI-Bw19OOSD.js} +1 -1
- package/editor-web/assets/{chunk-WQQL4CDK-DOCIz7Te.js → chunk-WQQL4CDK-CMST9dyE.js} +1 -1
- package/editor-web/assets/{chunk-YZO67HFG-Dc_ihQJi.js → chunk-YZO67HFG-Bbpu36XF.js} +1 -1
- package/editor-web/assets/{chunk-ZAUX2LTX-CoqwCPSm.js → chunk-ZAUX2LTX-C48Ri0Gs.js} +1 -1
- package/editor-web/assets/{chunk-ZCHMQSOR-CZUQPkJx.js → chunk-ZCHMQSOR-DN1g01Oe.js} +1 -1
- package/editor-web/assets/{classDiagram-v2-4MYWR3UA-DUh9c50k.js → classDiagram-v2-4MYWR3UA-U6jbPr2d.js} +1 -1
- package/editor-web/assets/collaborator-B1u2td9m.js +1 -0
- package/editor-web/assets/createLucideIcon-GFZ_fxLc.js +1 -0
- package/editor-web/assets/{cynefin-EF2NZ3EQ-DUTZiog0.js → cynefin-EF2NZ3EQ-gzkai_7-.js} +1 -1
- package/editor-web/assets/{cynefinDiagram-WF24UDRP-oAjpfbrU.js → cynefinDiagram-WF24UDRP-DtSekSr6.js} +1 -1
- package/editor-web/assets/{dagre-NK4GIZVX-BrKvKCvb.js → dagre-NK4GIZVX-CiUwYVT6.js} +1 -1
- package/editor-web/assets/{diagram-CBK3MWTC-GekVRnmm.js → diagram-CBK3MWTC-r9XHCV-k.js} +1 -1
- package/editor-web/assets/{diagram-I5XIIV2D-CDd1VFRT.js → diagram-I5XIIV2D-DxVsDZ34.js} +1 -1
- package/editor-web/assets/{diagram-ODIL2UCW-535RISTn.js → diagram-ODIL2UCW-B0eNQoHV.js} +1 -1
- package/editor-web/assets/{diagram-PFBEJUXE-MXzzKCGG.js → diagram-PFBEJUXE-C7f2MfJT.js} +1 -1
- package/editor-web/assets/{diagram-RJA3I4VV-vKVwkQxY.js → diagram-RJA3I4VV-CSXcnvct.js} +1 -1
- package/editor-web/assets/{diagram-TYUNFSNR-UwGAiQLx.js → diagram-TYUNFSNR-DXzOD_ii.js} +1 -1
- package/editor-web/assets/dist-BGRwhCQO.js +1 -0
- package/editor-web/assets/{dist-9ymlIMhr.js → dist-BW4X7BrF.js} +1 -1
- package/editor-web/assets/dist-BgDRE85b.js +2 -0
- package/editor-web/assets/dist-Blq5nJnU.js +24 -0
- package/editor-web/assets/dist-BuWaZ3Y4.js +274 -0
- package/editor-web/assets/dist-C1emZ9wX.js +37 -0
- package/editor-web/assets/dist-CC7OeU1e.js +6 -0
- package/editor-web/assets/dist-CX-fiPSn.js +38 -0
- package/editor-web/assets/dist-C_VvG-_9.js +5 -0
- package/editor-web/assets/dist-Ce7HrBxv.js +3 -0
- package/editor-web/assets/dist-D2k6w-_a.js +1 -0
- package/editor-web/assets/dist-DDv_SbKw.js +84 -0
- package/editor-web/assets/dist-DEoEO4zs.js +1 -0
- package/editor-web/assets/dist-DlDxxPIP.js +16 -0
- package/editor-web/assets/dist-Gz6NDS0J.js +4 -0
- package/editor-web/assets/{ebnfDiagram-V4P3TTPT-73yGokYa.js → ebnfDiagram-V4P3TTPT-Cs4YRvDD.js} +1 -1
- package/editor-web/assets/{elk-QONTBCTQ-BW6V9y6a.js → elk-QONTBCTQ-Bh3LZ9WI.js} +1 -1
- package/editor-web/assets/{erDiagram-KYQIGQAA-BPqIJ22h.js → erDiagram-KYQIGQAA-C4vYTYXp.js} +1 -1
- package/editor-web/assets/{eventmodeling-K75KTNOO-_VZ8jvuy.js → eventmodeling-K75KTNOO-BN1kkHWS.js} +1 -1
- package/editor-web/assets/flowDiagram-IUGLLWBU-B04NGsyi.js +1 -0
- package/editor-web/assets/{ganttDiagram-R7GPNTJY-DZ157JN2.js → ganttDiagram-R7GPNTJY-CA1LkkC5.js} +1 -1
- package/editor-web/assets/{gitGraph-VSP46ZUC-fmcNL9bq.js → gitGraph-VSP46ZUC-Dy5tA7dG.js} +1 -1
- package/editor-web/assets/{gitGraphDiagram-PDYL7XHY-DiZDyksR.js → gitGraphDiagram-PDYL7XHY-hJIB8EkH.js} +1 -1
- package/editor-web/assets/hint-B8JpEypy.js +1 -0
- package/editor-web/assets/index-CgB5osVc.js +28 -0
- package/editor-web/assets/index-Daytem9N.css +2 -0
- package/editor-web/assets/{info-OHQRW6UA-V06620kN.js → info-OHQRW6UA-DvzSf7rQ.js} +1 -1
- package/editor-web/assets/{infoDiagram-MVDRKAX5-CbIgheWX.js → infoDiagram-MVDRKAX5-BjIMm4Af.js} +1 -1
- package/editor-web/assets/{ishikawaDiagram-HPEHV2GE-D5oJQPkG.js → ishikawaDiagram-HPEHV2GE-Bpz71S40.js} +1 -1
- package/editor-web/assets/{italic-CDhZKo_q.js → italic-D10w8n6C.js} +1 -1
- package/editor-web/assets/{journeyDiagram-BOSHW7O7-BZEv6JI4.js → journeyDiagram-BOSHW7O7-DAB-pZjD.js} +1 -1
- package/editor-web/assets/{kanban-definition-FNSA4HC5-CLG1R8y_.js → kanban-definition-FNSA4HC5-cYeyh3P6.js} +1 -1
- package/editor-web/assets/katex-5Z2zF-9g.js +257 -0
- package/editor-web/assets/link-BC5xK1-1.js +1 -0
- package/editor-web/assets/{mermaid-parser.core-DxDwXM7z.js → mermaid-parser.core-req5LE0X.js} +3 -3
- package/editor-web/assets/{mermaid.core-tU55ZwVG.js → mermaid.core-zFwZug4C.js} +4 -4
- package/editor-web/assets/{mindmap-definition-6OY57UG3-CYf4zzAh.js → mindmap-definition-6OY57UG3-TStWb7DG.js} +1 -1
- package/editor-web/assets/minus-DaWs5i8B.js +1 -0
- package/editor-web/assets/{packet-JDAUHWVQ-DsHeKYNL.js → packet-JDAUHWVQ-smFhVKcB.js} +1 -1
- package/editor-web/assets/palette-BIOudGkm.js +1 -0
- package/editor-web/assets/{pegDiagram-ECIUJNBX-CQyh6TTa.js → pegDiagram-ECIUJNBX-DvSNRv0-.js} +1 -1
- package/editor-web/assets/{pie-XZMESJXO-3vCIvpNB.js → pie-XZMESJXO-qjaGsBZG.js} +1 -1
- package/editor-web/assets/{pieDiagram-GNMPY74T-DF5yGBLn.js → pieDiagram-GNMPY74T-Dd9P-Pdc.js} +1 -1
- package/editor-web/assets/play-CrMmPghG.js +1 -0
- package/editor-web/assets/progress-DE4C5_3x.js +6 -0
- package/editor-web/assets/props-form-CsmDBqzy.js +1 -0
- package/editor-web/assets/{quadrantDiagram-D57K4MC3-B7pxlDYP.js → quadrantDiagram-D57K4MC3-h2IIKUUA.js} +1 -1
- package/editor-web/assets/{radar-ABXABTNO-cpEA41mL.js → radar-ABXABTNO-DlVrSA1d.js} +1 -1
- package/editor-web/assets/{railroad-I3PHUGI6-BLyy5R2c.js → railroad-I3PHUGI6-nFbuLAtc.js} +1 -1
- package/editor-web/assets/{railroad-abnf-LNEFI6M7-Y-oyol19.js → railroad-abnf-LNEFI6M7-Daj8h2iV.js} +1 -1
- package/editor-web/assets/{railroad-ebnf-DWYD2UWJ-o58wHZsr.js → railroad-ebnf-DWYD2UWJ-eYJyl5PH.js} +1 -1
- package/editor-web/assets/{railroad-peg-JR7BVNR7-CcD3PXZ8.js → railroad-peg-JR7BVNR7-BTRhKZQq.js} +1 -1
- package/editor-web/assets/{railroadDiagram-Y72NRBL7-BuCC4eyy.js → railroadDiagram-Y72NRBL7-CeLGUjdp.js} +1 -1
- package/editor-web/assets/react-WA6wlt8S.js +1 -0
- package/editor-web/assets/{repeat-2-C5PCbNsg.js → repeat-2-VQP1EVOZ.js} +1 -1
- package/editor-web/assets/{requirementDiagram-EQYSW5RA-Dp-JFGn4.js → requirementDiagram-EQYSW5RA-Dmk9XRM5.js} +1 -1
- package/editor-web/assets/row-BRlEWRrK.js +1 -0
- package/editor-web/assets/{sankeyDiagram-SY24JHO5-rYuCqEvw.js → sankeyDiagram-SY24JHO5-Yn4zlrAM.js} +1 -1
- package/editor-web/assets/schemas-VikZYZIK.js +1 -0
- package/editor-web/assets/{sequenceDiagram-BLEHNHQU-DryW8x6d.js → sequenceDiagram-BLEHNHQU-BTRnp_PW.js} +1 -1
- package/editor-web/assets/session-Do9AqS38.js +1 -0
- package/editor-web/assets/slides-diTEQ3C5.js +1 -0
- package/editor-web/assets/snapshots-BUGlKQIB.js +56 -0
- package/editor-web/assets/sound-Bj3o9_Fa.js +1 -0
- package/editor-web/assets/split-CNU1RHcX.js +3 -0
- package/editor-web/assets/{stateDiagram-v2-A6IESKWZ-Bnp0XfpT.js → stateDiagram-v2-A6IESKWZ-kstrRKv2.js} +1 -1
- package/editor-web/assets/{strikethrough-DJckA35o.js → strikethrough-CfXx6IYH.js} +1 -1
- package/editor-web/assets/{svg-BjM9RazX.js → svg-Cx50MpxK.js} +1 -1
- package/editor-web/assets/swatch-WeJD41aW.js +1 -0
- package/editor-web/assets/{swimlanes-B3ENRKFQ-BiRRhhbd.js → swimlanes-B3ENRKFQ-DaZsZkeP.js} +1 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-CBZAujYY.js +8 -0
- package/editor-web/assets/switch-N0G_sbqt.js +1 -0
- package/editor-web/assets/syntax-BVsgRJ4I.js +66 -0
- package/editor-web/assets/syntax-oWsKBWFw.js +1 -0
- package/editor-web/assets/table-B6hVZAMi.js +1 -0
- package/editor-web/assets/tabs-DIFDqj-l.js +1 -0
- package/editor-web/assets/{textarea-BGtPqZdB.js → textarea-tEWvBY9p.js} +1 -1
- package/editor-web/assets/{timeline-definition-JXYKGLGB-D-Q5ZtDF.js → timeline-definition-JXYKGLGB-CLCvY-Yf.js} +1 -1
- package/editor-web/assets/{trash-2-Bjj6cWzP.js → trash-2-BP6nqpg2.js} +1 -1
- package/editor-web/assets/{treeView-D4JQ5SDB-B6DDatXq.js → treeView-D4JQ5SDB-BmN0gwdC.js} +1 -1
- package/editor-web/assets/{treemap-SAJKECNS-D7j5ZhiI.js → treemap-SAJKECNS-DN29G_E_.js} +1 -1
- package/editor-web/assets/{undo-2-yOSG766T.js → undo-2-CHR0nvWL.js} +1 -1
- package/editor-web/assets/{usecaseDiagram-WPOLBNNX-tkrdKUJB.js → usecaseDiagram-WPOLBNNX-DTRS54cB.js} +1 -1
- package/editor-web/assets/{vennDiagram-Q3Y3IDCW-Ch4XbSnD.js → vennDiagram-Q3Y3IDCW-DAAc11Hx.js} +1 -1
- package/editor-web/assets/video-BlvmR8BK.js +1 -0
- package/editor-web/assets/{wardley-7MLQ67FV-Bynt7qNQ.js → wardley-7MLQ67FV-B-UYkmdB.js} +1 -1
- package/editor-web/assets/{wardleyDiagram-IVAIDKWA-DRuSgm_L.js → wardleyDiagram-IVAIDKWA-BmbwCaky.js} +1 -1
- package/editor-web/assets/words-D_4T9Adq.js +3 -0
- package/editor-web/assets/words-WgdEQdYP.js +2 -0
- package/editor-web/assets/{xychartDiagram-4URNHDU4-DctpvfkL.js → xychartDiagram-4URNHDU4-ChAfAq1U.js} +1 -1
- package/editor-web/index.html +6 -5
- package/package.json +8 -2
- package/editor-web/assets/alt-BOVao_9S.js +0 -4
- package/editor-web/assets/article-B6YCzhj8.js +0 -73
- package/editor-web/assets/calc-worker-B5-fDWnb.js +0 -45
- package/editor-web/assets/channel-C26aBI4o.js +0 -1
- package/editor-web/assets/chart-BOnxneyw.js +0 -1
- package/editor-web/assets/choice-O5nwc2N0.js +0 -1
- package/editor-web/assets/collaborator-BJU5qwHd.js +0 -1
- package/editor-web/assets/createLucideIcon-B3B95oX5.js +0 -1
- package/editor-web/assets/dist-C6NqUEG4.js +0 -16
- package/editor-web/assets/dist-C9UGmCG9.js +0 -6
- package/editor-web/assets/dist-CAk5bjBm.js +0 -1
- package/editor-web/assets/dist-CKyfo5RM.js +0 -340
- package/editor-web/assets/dist-CRaWqNwq.js +0 -37
- package/editor-web/assets/dist-CwIBc7HQ.js +0 -1
- package/editor-web/assets/dist-DXRmkezB.js +0 -38
- package/editor-web/assets/dist-EKK5i0dG.js +0 -219
- package/editor-web/assets/dist-hHJlpLWo.js +0 -5
- package/editor-web/assets/dist-oYKcwWUj.js +0 -4
- package/editor-web/assets/dist-shKo7XVN.js +0 -2
- package/editor-web/assets/dist-wrKxBrVu.js +0 -24
- package/editor-web/assets/flowDiagram-IUGLLWBU-ouDQYiTr.js +0 -1
- package/editor-web/assets/hint-_AQWCDMj.js +0 -1
- package/editor-web/assets/index-BsstP-cI.js +0 -28
- package/editor-web/assets/index-DQRcmxBO.css +0 -2
- package/editor-web/assets/minus-Cgmm6ncD.js +0 -1
- package/editor-web/assets/progress-0B_TVsPi.js +0 -6
- package/editor-web/assets/react-BP46yLMB.js +0 -1
- package/editor-web/assets/react-pgBZqVxJ.js +0 -96
- package/editor-web/assets/schemas-Ewwjtbf4.js +0 -1
- package/editor-web/assets/session-DiI9KYRI.js +0 -1
- package/editor-web/assets/slides-CCwgBcGH.js +0 -1
- package/editor-web/assets/sound-CqryteNl.js +0 -1
- package/editor-web/assets/swatch-DL3HqIjW.js +0 -1
- package/editor-web/assets/swimlanesDiagram-AYQRV4AK-BkOls8Tv.js +0 -8
- package/editor-web/assets/switch-DltnKqN-.js +0 -1
- package/editor-web/assets/syntax-CC6QYhCz.js +0 -1
- package/editor-web/assets/tabs-C-re0Kxn.js +0 -1
- package/editor-web/assets/video-DXFiCNGc.js +0 -1
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,d as n,h as r,o as i,p as a,s as o,y as s}from"./react-WA6wlt8S.js";import{Dt as c,Tt as l,_t as u,gt as d,t as f}from"./button-eGxLxbv9.js";import{B as p,R as m,V as h,Y as g,et as _,tt as v}from"./snapshots-BUGlKQIB.js";import{t as y}from"./session-Do9AqS38.js";import{t as ee}from"./jsx-runtime-DePvh3-m.js";import{t as b}from"./createLucideIcon-GFZ_fxLc.js";import{n as te,t as ne}from"./arrow-up-B5rJbBv0.js";import{t as re}from"./chart-no-axes-column-BVkeF_Mr.js";import{C as ie,D as ae,a as oe,w as se,x as ce}from"./dist-CC7OeU1e.js";import{_ as x,c as le,d as ue,g as S,h as de,i as fe,l as pe,n as C,o as me,s as he,t as w,u as ge,y as T}from"./words-WgdEQdYP.js";import{a as _e,c as E,i as ve,l as ye,n as be,r as D,s as xe,t as Se}from"./split-CNU1RHcX.js";import{n as Ce,t as we}from"./undo-2-CHR0nvWL.js";import{D as O,Z as k,b as A,g as j,h as M,m as N,x as P,y as F}from"./index-CgB5osVc.js";import{t as I}from"./collaborator-B1u2td9m.js";import{a as L,c as Te,d as R,p as z,r as B,s as V}from"./textarea-tEWvBY9p.js";var H=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`}]]),Ee=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`}]]),U=[`following`,`mentionedUsers`,`subscribers`,`verified`],W=v().regex(/^[0-9]{1,19}$/u,`a post's id: 1 to 19 digits`),De=_({file:v().min(1),alt:v().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}),Oe=_({options:p(v()),duration_minutes:g().int()},{error:e=>e.code===`invalid_type`?`a poll is { options: [ … ], duration_minutes: … }`:void 0}),ke=_({text:v().default(``).transform(e=>e.replace(/\n+$/u,``)),media:p(De).optional(),poll:Oe.optional(),made_with_ai:h().optional(),paid_partnership:h().optional(),reply:_({in_reply_to_tweet_id:W}).optional(),quote_tweet_id:W.optional()},{error:e=>e.code===`invalid_type`?`a post is { text: …, media: [ … ], poll: … }`:void 0}),Ae=_({reply_settings:m(U).optional(),posts:p(ke,{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 je(e,t){let n=e;for(let e of t)if(R(n)){let t=n.items.find(t=>t.key?.value===e);if(!t)return n;n=t.value??t.key}else if(z(n)&&typeof e==`number`){let t=n.items[e];if(!t)return n;n=t}else return n;return n}function G(e){let t=new L,n=B(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,t){let n=e.createNode(t);return t.includes(`
|
|
2
|
+
`)&&(n.type=Te.BLOCK_LITERAL),n}var K=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),q=(e,t)=>K(e)===K(t);function Ne(e){return{text:e.text,media:e.media===void 0||e.media.length===0?void 0:e.media,poll:e.poll}}function Pe(e,t){let n=B(e),r=G(e).value;if(r!==void 0&&q(r,t))return e;R(n.contents)||(n.contents=new V),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=z(i)?i:void 0,o=(a?.items??[]).map(e=>R(e)?e:void 0),s=(r?.posts??[]).map(e=>K(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===K(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=Ne(e);if(!i){let t=n.createNode({});t.set(`text`,Me(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`,Me(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):q(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 Fe(e,t,n){let r=(e,t,n)=>q(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,...J(`media`,r(i.media,s.media,c.media)),...J(`poll`,r(i.poll,s.poll,c.poll))})}let o={...n,posts:a};return delete o.reply_settings,{...o,...J(`reply_settings`,r(e.reply_settings,t.reply_settings,n.reply_settings))}}function J(e,t){return t===void 0?{}:{[e]:t}}var Y=e(s(),1),X=ee();function Ie(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 Le=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function Re(e,t){let n=e?.posts??[],r=t.posts;for(let e=0;e<r.length;e++)if(!Le(n[e],r[e]))return e;if(n.length>r.length&&r.length>0)return r.length-1}function ze(e,t){let n=G(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 Be(e,t){if(e.from!==void 0&&e.path===t.path)return ze(t.text,{from:e.from,to:e.to??e.from})}var Ve=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=Pe(e,this.file);return t===e?void 0:t},take:(e,t,n)=>{let r=G(e),i=G(t).value,a=n?.kind===`agent`&&r.value?Re(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:Fe(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=G(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 y.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()}},Z=(e,t,n)=>({...e,posts:e.posts.map((e,r)=>r===t?n(e):e)});function He(e,t){let n={...e};return t===void 0||t.length===0?delete n.media:n.media=t,n}function Ue(e){let t={...e};return delete t.poll,t}function We({text:e}){let t=w(),{weighted:n}=x(e),r=T.length.most,i=r-n,a=i<0&&n<=T.length.premium,o=n>T.length.premium,s=Math.min(1,n/r),c=2*Math.PI*9;return(0,X.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,X.jsx)(`span`,{className:d(o?`text-destructive`:a?`text-warning`:`text-muted-foreground`),children:a?n:i}):null,(0,X.jsxs)(`svg`,{width:`22`,height:`22`,viewBox:`0 0 22 22`,"aria-hidden":`true`,children:[(0,X.jsx)(`circle`,{cx:`11`,cy:`11`,r:9,fill:`none`,stroke:`var(--ak-x-line)`,strokeWidth:`2`}),(0,X.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 Ge(e){let t=w();return(0,X.jsx)(E,{alt:e.alt??``,onAlt:e.onAlt,most:T.alt,trigger:(0,X.jsx)(f,{variant:`secondary`,size:`xs`,className:`bg-media/75 text-on-media font-bold`,"aria-label":t.altText,children:t.alt})})}function Ke(e){let t=w();return(0,X.jsx)(f,{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,X.jsx)(u,{})})}function qe(e){let t=w(),{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,X.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=S(r)-T.poll.option;return(0,X.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,X.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:T.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,X.jsx)(`span`,{className:`text-destructive text-sm`,children:t.over(a)}):null,n.length>T.poll.least?(0,X.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":t.removeOption,onClick:()=>{e.onChange({...e.poll,options:n.filter((e,t)=>t!==i)})},children:(0,X.jsx)(u,{})}):null]},i)}),n.length<T.poll.most?(0,X.jsxs)(f,{variant:`ghost`,size:`sm`,className:`self-start text-[var(--ak-x-link)]`,onClick:()=>{e.onChange({...e.poll,options:[...n,``]})},children:[(0,X.jsx)(k,{}),t.addOption]}):null,(0,X.jsxs)(`div`,{className:`flex flex-wrap items-end gap-2 border-t border-[var(--ak-x-line)] pt-2 text-sm`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground mr-auto self-center`,children:t.pollLength}),[`days`,`hours`,`minutes`].map(e=>(0,X.jsxs)(`label`,{className:`flex flex-col gap-0.5 text-xs`,children:[(0,X.jsx)(`span`,{className:`text-muted-foreground`,children:t[e]}),(0,X.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,X.jsx)(f,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:e.onRemove,children:t.removePoll})]})]})}function Je(e){let t=w(),n=t.replies[e.value??`everyone`];return(0,X.jsxs)(N,{children:[(0,X.jsx)(O,{asChild:!0,disabled:e.disabled,children:(0,X.jsxs)(f,{variant:`ghost`,size:`sm`,className:`ak-x-c-replies -ml-2 gap-1 px-2 font-bold text-[var(--ak-x-link)]`,children:[(0,X.jsx)(H,{}),n]})}),(0,X.jsxs)(j,{align:`start`,className:`w-72`,children:[(0,X.jsx)(F,{children:t.whoCanReply}),(0,X.jsx)(A,{value:e.value??`everyone`,onValueChange:t=>{e.onChange(t===`everyone`?void 0:U.includes(t)?t:void 0)},children:[`everyone`,...U].map(e=>(0,X.jsx)(P,{value:e,children:t.replies[e]},e))})]})]})}function Ye(e){let t=w(),n=e.post.made_with_ai===!0||e.post.paid_partnership===!0;return(0,X.jsxs)(N,{children:[(0,X.jsx)(O,{asChild:!0,children:(0,X.jsx)(f,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)]`,"aria-label":t.disclosure,title:t.disclosure,"aria-pressed":n,children:(0,X.jsx)(Ee,{className:d(n&&`fill-current`)})})}),(0,X.jsxs)(j,{align:`start`,className:`w-56`,children:[(0,X.jsx)(F,{children:t.disclosure}),(0,X.jsx)(M,{checked:e.post.made_with_ai===!0,onCheckedChange:t=>{e.onChange({made_with_ai:t})},children:t.madeWithAi}),(0,X.jsx)(M,{checked:e.post.paid_partnership===!0,onCheckedChange:t=>{e.onChange({paid_partnership:t})},children:t.paidPartnership})]})]})}function Q(e){return(0,X.jsx)(f,{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 Xe=3e4;function Ze({doc:e,dir:i,entry:s}){let d=w(),p=o(),m=a(),h=r(),g=m||h,_=(0,Y.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get()),[v,y]=(0,Y.useState)(),[ee,b]=(0,Y.useState)(0),[x,S]=(0,Y.useState)(),C=(0,Y.useRef)([]);(0,Y.useEffect)(()=>{if(x===void 0)return;let e=C.current[x.post];e!=null&&(e.focus(),e.setSelectionRange(x.at,x.at),b(x.post),S(void 0))},[x]);let E=_.file,{agent:O,following:A}=t(),j=ae(),M=(()=>{if(O?.doing===void 0)return;let t=Ie(O.place);if(t!==void 0)return t;let n=_.landed!==void 0&&_.landed.at>=O.at-Xe;return n&&O.source?.path===s?_.landed?.post:(O.source?Be(O.source,{path:s,text:e.text}):void 0)??(n?_.landed?.post:void 0)})(),N=M!==void 0&&M<(E?.posts.length??0)?M:void 0,P=(0,Y.useRef)([]),F=(0,Y.useRef)([]);(0,Y.useEffect)(()=>{if(A&&N!==void 0)for(let e of[P.current[N],F.current[N]])e?.scrollIntoView({block:`nearest`})},[A,N,_.landed]);let L=ve(i,(E?.posts??[]).flatMap(e=>(e.media??[]).map(e=>e.file)));n({hold:()=>Promise.resolve({key:`${s}@${String(e.text.length)}`,what:`The X post ${s}${(E?.posts.length??0)>1?`, a thread of ${String(E?.posts.length??0)} posts`:``}`,source:{path:s}}),locate:t=>{let n=E?.posts??[],r=G(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&&c(t,e),o=n.flatMap((e,t)=>{if(!a(i(P.current[t]))&&!a(i(F.current[t])))return[];let n=r.line([`posts`,t]);return[{name:`post ${String(t+1)} of the thread`,source:{path:s,...n===void 0?{}:{line:n}},...e.text===``?{}:{text:e.text}}]}),u=l(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(P.current[t]))),p=n.findIndex((e,t)=>d(i(F.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:o,...m===void 0?{}:{where:m}})}});let Te=t=>{(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`z`&&(t.preventDefault(),t.shiftKey?e.redo():e.undo())},R=(t,n,r)=>{g||e.edit(t,n,r)},z=e=>(e.media??[]).map(e=>{let t=L.get(e.file),n=D(e.file),r=n?void 0:de(e.file.split(`.`).pop()??``);return t===void 0?{kind:`made`,label:n?d.made:e.file}:{kind:r??`picture`,src:t,alt:e.alt,file:e.file}}),B=(0,X.jsx)(oe,{start:g?void 0:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":d.undo,title:d.undo,disabled:!_.canUndo,onClick:()=>{e.undo()},children:(0,X.jsx)(we,{})}),(0,X.jsx)(f,{variant:`ghost`,size:`icon-sm`,"aria-label":d.redo,title:d.redo,disabled:!_.canRedo,onClick:()=>{e.redo()},children:(0,X.jsx)(Ce,{})})]}),saved:{state:_.state},exports:{}}),V=p?.theme===`dark`;if(E===void 0)return(0,X.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`x-post-editor`,children:[B,(0,X.jsx)(`p`,{className:`text-muted-foreground mx-auto max-w-xl p-6 text-sm`,children:d.unreadable(_.unreadable??``)})]});let H=E.posts,Ee=Math.min(ee,H.length-1),U=e=>{R(d.steps.add,t=>({...t,posts:[...t.posts.slice(0,e+1),{text:``},...t.posts.slice(e+1)]})),S({post:e+1,at:0})},W=e=>{let t=H[e],n=H[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 R(d.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)]})),S({post:e-1,at:n.text.length+i.length}),!0},De=(0,X.jsx)(`div`,{className:`ak-x ak-x-editing ak-x-composer`,"data-theme":V?`dark`:`light`,children:H.map((t,n)=>{let r=n===H.length-1,a=n===Ee,o=t.media??[],c=o.filter(e=>de(e.file.split(`.`).pop()??``)===`picture`||D(e.file)).length,l=o.length>=T.pictures||o.length>c;return(0,X.jsxs)(`div`,{ref:e=>{P.current[n]=e},className:`ak-x-c-post`,"data-here":a?``:void 0,"data-testid":`x-post`,onFocusCapture:()=>{b(n)},onPointerDown:()=>{b(n)},children:[(0,X.jsxs)(`div`,{className:`ak-x-side`,children:[(0,X.jsx)(`div`,{className:`ak-x-avatar`,"aria-hidden":`true`,children:he.name.slice(0,1)}),r?null:(0,X.jsx)(`div`,{className:`ak-x-thread-line`})]}),(0,X.jsxs)(`div`,{className:`ak-x-body`,children:[a&&n>0&&!g?(0,X.jsx)(f,{variant:`ghost`,size:`icon-sm`,className:`ak-x-c-remove`,"aria-label":d.remove,title:d.remove,onClick:()=>{R(d.steps.remove,e=>({...e,posts:e.posts.filter((e,t)=>t!==n)})),S({post:n-1,at:H[n-1]?.text.length??0})},children:(0,X.jsx)(u,{})}):null,(0,X.jsxs)(`div`,{className:`ak-x-field`,children:[(0,X.jsx)(pe,{text:t.text,whole:!0}),(0,X.jsx)(`textarea`,{ref:e=>{C.current[n]=e},dir:`auto`,value:t.text,placeholder:n===0?d.whatsHappening:d.addAnother,"aria-label":n===0?d.whatsHappening:d.addAnother,readOnly:g,"data-testid":`x-text`,onChange:e=>{let t=e.target.value;R(d.steps.text,e=>Z(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&&!g){W(n)&&e.preventDefault();return}if(e.key!==`Enter`||!(e.metaKey||e.ctrlKey))return;e.preventDefault();let r=t.selectionStart;R(d.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)]}}),S({post:n+1,at:0})}})]}),(0,X.jsx)(me,{media:z(t),onAlt:g?void 0:e=>(0,X.jsx)(Ge,{alt:o[e]?.alt,onAlt:t=>{R(d.steps.alt,r=>Z(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:g?void 0:e=>(0,X.jsx)(Ke,{onRemove:()=>{R(d.steps.media,t=>Z(t,n,t=>He(t,(t.media??[]).filter((t,n)=>n!==e))))}})}),t.poll===void 0?null:g?(0,X.jsx)(`div`,{className:`ak-x-poll`,children:t.poll.options.map((e,t)=>(0,X.jsx)(`div`,{className:`ak-x-option`,dir:`auto`,children:e},t))}):(0,X.jsx)(qe,{poll:t.poll,onChange:(e,t)=>{R(d.steps.poll,t=>Z(t,n,t=>({...t,poll:e})),t===void 0?void 0:`${t}-${String(n)}`)},onRemove:()=>{R(d.steps.poll,e=>Z(e,n,e=>Ue(e)))}}),t.quote_tweet_id===void 0?null:(0,X.jsx)(ge,{id:t.quote_tweet_id}),a?(0,X.jsx)(Je,{value:E.reply_settings,disabled:g,onChange:e=>{R(d.whoCanReply,t=>{let n={...t};return e===void 0?delete n.reply_settings:n.reply_settings=e,n})}}):null,a&&!g?(0,X.jsxs)(`div`,{className:`ak-x-c-tools`,children:[(0,X.jsxs)(ce,{open:v===n,onOpenChange:e=>{y(e?n:void 0)},children:[(0,X.jsx)(se,{asChild:!0,children:(0,X.jsx)(f,{variant:`ghost`,size:`icon-sm`,className:`text-[var(--ak-x-link)] disabled:text-[var(--ak-x-muted)]`,"aria-label":d.addMedia,title:d.addMedia,disabled:l||t.poll!==void 0,children:(0,X.jsx)(ye,{})})}),(0,X.jsx)(ie,{className:`w-auto`,align:`start`,children:(0,X.jsx)(be,{self:s,types:fe,testId:`x-picker`,onPick:e=>{y(void 0),R(d.steps.media,t=>Z(t,n,t=>({...t,media:[...t.media??[],{file:_e(i,e)}]})))}})})]}),(0,X.jsx)(Q,{label:d.addPoll,disabled:t.poll!==void 0||o.length>0,onClick:()=>{R(d.steps.poll,e=>Z(e,n,e=>({...e,poll:{options:[``,``],duration_minutes:1440}})))},children:(0,X.jsx)(re,{})}),(0,X.jsx)(Ye,{post:t,onChange:e=>{R(d.disclosure,t=>Z(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,X.jsx)(`span`,{className:`flex-1`}),(0,X.jsx)(Q,{label:d.moveUp,disabled:n===0,onClick:()=>{R(d.steps.move,e=>{let t=[...e.posts],[r]=t.splice(n,1);return r&&t.splice(n-1,0,r),{...e,posts:t}}),b(n-1)},children:(0,X.jsx)(ne,{})}),(0,X.jsx)(Q,{label:d.moveDown,disabled:r,onClick:()=>{R(d.steps.move,e=>{let t=[...e.posts],[r]=t.splice(n,1);return r&&t.splice(n+1,0,r),{...e,posts:t}}),b(n+1)},children:(0,X.jsx)(te,{})}),(0,X.jsx)(We,{text:t.text}),(0,X.jsx)(`span`,{className:`bg-rule mx-1 h-6 w-px`,"aria-hidden":`true`}),(0,X.jsx)(f,{variant:`outline`,size:`icon-xs`,className:`rounded-full border-[var(--ak-x-line)] text-[var(--ak-x-link)]`,"aria-label":d.addPost,title:d.addPost,onClick:()=>{U(n)},children:(0,X.jsx)(k,{})})]}):null]}),O&&N===n?(0,X.jsx)(I,{"data-testid":`x-agent-box`,label:j(O),className:`inset-x-1 inset-y-0`}):null]},n)})}),Oe=(0,X.jsx)(`div`,{className:`ak-x`,"data-theme":V?`dark`:`light`,children:H.map((e,t)=>(0,X.jsxs)(`div`,{ref:e=>{F.current[t]=e},className:`relative`,children:[(0,X.jsx)(le,{post:{text:e.text,media:z(e),poll:e.poll,quote:e.quote_tweet_id},joined:t<H.length-1,published:!0}),O&&N===t?(0,X.jsx)(I,{"data-testid":`x-agent-shown`,className:`inset-0`}):null]},t))});return(0,X.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`x-post-editor`,onKeyDown:Te,children:[B,(0,X.jsx)(ue.Provider,{value:xe,children:(0,X.jsx)(Se,{edit:De,preview:Oe,width:598,background:V?`#000000`:`#ffffff`,testId:`x-preview`})})]})}function $(){let e=w(),t=i(),n=o(),r=n?.item.entry,a=n?.item.dir??``,[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)();return(0,Y.useEffect)(()=>{if(r===void 0)return;let e,n=!0;return Ve.open(t,r).then(t=>{n?(e=t,c(t)):t.close()},e=>{n&&u(e instanceof Error?e.message:String(e))}),()=>{n=!1,e?.close()}},[t,r]),!s||r===void 0?(0,X.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,X.jsx)(Ze,{doc:s,dir:a,entry:r})}export{Ve as PostDocument,C as WORDS,$ as XPostEditor,$ as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{a as t,d as n,h as r,o as i,p as a,s as o,y as s}from"./react-WA6wlt8S.js";import{Dt as c,_t as l,gt as u,t as d}from"./button-eGxLxbv9.js";import{B as f,R as p,V as m,at as h,et as g,tt as _}from"./snapshots-BUGlKQIB.js";import{t as ee}from"./session-Do9AqS38.js";import{t as v}from"./jsx-runtime-DePvh3-m.js";import{t as te}from"./chart-no-axes-column-BVkeF_Mr.js";import{C as ne,D as re,a as ie,w as y,x as b}from"./dist-CC7OeU1e.js";import{_ as x,a as ae,c as oe,d as se,f as ce,g as S,h as C,i as le,m as w,n as ue,o as de,p as T,s as fe,t as E,u as D,v as O,y as pe}from"./words-D_4T9Adq.js";import{a as me,c as k,i as he,l as A,n as ge,r as j,s as _e,t as ve}from"./split-CNU1RHcX.js";import{t as ye}from"./link-BC5xK1-1.js";import{n as be,t as xe}from"./undo-2-CHR0nvWL.js";import{D as Se,Z as M,b as Ce,g as we,lt as Te,m as Ee,rt as De,tt as Oe,x as N}from"./index-CgB5osVc.js";import{t as P}from"./collaborator-B1u2td9m.js";import{a as F,c as I,d as L,p as R,r as z,s as B}from"./textarea-tEWvBY9p.js";var V=_().min(1),H=g({file:V,title:_().optional(),altText:_().optional()},{error:e=>e.code===`invalid_type`?`content.media is { file: ./demo.mp4, title: …, altText: … }`:void 0}),ke=g({file:V,altText:_().optional()},{error:e=>e.code===`invalid_type`?`a picture of multiImage is { file: ./a.png, altText: … }`:void 0}),Ae=g({images:f(ke)},{error:e=>e.code===`invalid_type`?`content.multiImage is { images: [ { file: ./a.png }, … ] }`:void 0}),U=g({question:_(),options:f(g({text:_()},{error:`a poll's option is { text: … }`})),settings:g({duration:p(C).optional()}).optional()},{error:e=>e.code===`invalid_type`?`content.poll is { question: …, options: [ { text: … }, … ], settings: { duration: SEVEN_DAYS } }`:void 0}),W=g({source:h({error:`an article's source is a web address`}),title:_().optional(),description:_().optional(),thumbnail:V.optional()},{error:e=>e.code===`invalid_type`?`content.article is { source: https://…, title: …, description: …, thumbnail: ./card.png }`:void 0}),G=g({media:H.optional(),multiImage:Ae.optional(),poll:U.optional(),article:W.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`})}),K=g({commentary:_().default(``).transform(e=>e.replace(/\n+$/u,``)),visibility:p(O).optional(),content:G.optional(),isReshareDisabledByAuthor:m().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(L(n)){let t=n.items.find(t=>t.key?.value===e);if(!t)return n;n=t.value??t.key}else if(R(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 F,n=z(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=K.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(x[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=I.BLOCK_LITERAL),n}function Le(e,t){let n=q(e).value;if(n!==void 0&&J(n,t))return e;let r=z(e);L(r.contents)||(r.contents=new B);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(s(),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 ee.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 j(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=E(),{left:n}=w(e);return n>100?null:(0,X.jsx)(`span`,{className:u(`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)(d,{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=E();return(0,X.jsxs)(`div`,{className:`absolute top-2 right-2 flex gap-1`,children:[e.alt===void 0?null:(0,X.jsx)(k,{alt:e.alt.value??``,onAlt:e.alt.onAlt,most:S.alt,trigger:(0,X.jsx)(d,{variant:`secondary`,size:`xs`,className:`bg-media/75 text-on-media font-bold`,children:t.alt})}),(0,X.jsx)(d,{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)(l,{})})]})}function Ge(e){let t=E(),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=T(e.poll.question)-S.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:S.poll.question,onChange:t=>{e.onChange({...e.poll,question:t.target.value},`question`)}})]}),e.poll.options.map((r,i)=>{let a=T(r.text)-S.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:S.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>S.poll.least?(0,X.jsx)(d,{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)(l,{})}):null]})]},i)}),!e.locked&&e.poll.options.length<S.poll.most?(0,X.jsxs)(d,{variant:`outline`,size:`sm`,className:`self-start rounded-full`,onClick:()=>{e.onChange({...e.poll,options:[...e.poll.options,{text:``}]})},children:[(0,X.jsx)(M,{}),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:C.map(e=>(0,X.jsx)(`option`,{value:e,children:t.durations[e]},e))})]}),e.locked?null:(0,X.jsx)(d,{variant:`ghost`,size:`sm`,className:`text-destructive`,onClick:e.onRemove,children:t.removePoll})]})]})}function Ke(e){let t=E(),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:i,entry:s}){let l=E(),u=o(),f=a(),p=r(),m=f||p,h=(0,Y.useSyncExternalStore)(t=>e.subscribe(t),()=>e.get()),[g,_]=(0,Y.useState)(),[ee,v]=(0,Y.useState)(!1),x=h.file,{agent:C,following:w}=t(),ue=re(),T=C?.doing!==void 0&&(C.source?.path===s||h.landed!==void 0&&h.landed>=C.at-Ve),O=(0,Y.useRef)(null),k=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{w&&T&&(O.current?.scrollIntoView({block:`nearest`}),k.current?.scrollIntoView({block:`nearest`}))},[w,T,h.landed]);let M=he(i,x?Me(x).map(e=>e.file):[]);n({hold:()=>Promise.resolve({key:`${s}@${String(e.text.length)}`,what:`The LinkedIn post ${s}`,source:{path:s}}),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(O.current),r=t(k.current),i=n!==void 0&&c(e,n),a=r!==void 0&&c(e,r);if(!i&&!a)return Promise.resolve({elements:[]});let o=new Map;for(let n of[O.current,k.current])n?.querySelectorAll(`.ak-li-content img`).forEach((n,r)=>{let i=t(n);i!==void 0&&c(e,i)&&o.set(r,n.alt)});return Promise.resolve({elements:[{name:`the post`,source:{path:s},...x?.commentary?{text:x.commentary}:{}},...[...o].map(([e,t])=>({name:`picture ${String(e+1)} of the post`,source:{path:s},...t===``?{}:{text:t}}))],where:i?`where the post is written`:`as LinkedIn's feed will show it`})}});let F=t=>{(t.metaKey||t.ctrlKey)&&t.key.toLowerCase()===`z`&&(t.preventDefault(),t.shiftKey?e.redo():e.undo())},I=(t,n,r)=>{m||e.edit(t,n,r)},L=(0,X.jsx)(ie,{start:m?void 0:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)($,{label:l.undo,disabled:!h.canUndo,onClick:()=>{e.undo()},children:(0,X.jsx)(xe,{})}),(0,X.jsx)($,{label:l.redo,disabled:!h.canRedo,onClick:()=>{e.redo()},children:(0,X.jsx)(be,{})})]}),saved:{state:h.state},exports:{}}),R=u?.theme===`dark`;if(x===void 0)return(0,X.jsxs)(`div`,{className:`bg-background flex size-full flex-col`,"data-testid":`linkedin-post-editor`,children:[L,(0,X.jsx)(`p`,{className:`text-muted-foreground mx-auto max-w-xl p-6 text-sm`,children:l.unreadable(h.unreadable??``)})]});let z=x.content,B=(e,t)=>{let n=M.get(e),r=Q(e);return r===`document`?{kind:`document`,file:e,label:e.split(`/`).pop()}:n===void 0?{kind:`made`,label:j(e)?`${e} · ${l.made}`:e,file:e}:{kind:r??`picture`,src:n,alt:t,file:e}},V=z?.media?{type:`media`,medium:B(z.media.file,z.media.altText),title:z.media.title}:z?.multiImage?{type:`multiImage`,images:z.multiImage.images.map(e=>B(e.file,e.altText))}:z?.poll?{type:`poll`,question:z.poll.question,options:z.poll.options.map(e=>e.text),duration:z.poll.settings?.duration}:z?.article?{type:`article`,source:z.article.source,title:z.article.title,description:z.article.description,thumbnail:z.article.thumbnail===void 0?void 0:B(z.article.thumbnail)}:void 0,H=e=>{I(l.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)})},ke=e=>{let t=(z?.multiImage?z.multiImage.images:z?.media&&Q(z.media.file)===`picture`?[z.media]:[])[e];if(t!==void 0)return{value:t.altText,onAlt:t=>{I(l.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})}}},Ae=z?.poll!==void 0||z?.article!==void 0||(z?.multiImage?.images.length??0)>=S.pictures.most||z?.media!==void 0&&Q(z.media.file)!==`picture`,U=(e,t)=>(0,X.jsx)(ne,{className:`w-auto`,align:`start`,children:(0,X.jsx)(ge,{self:s,types:e,testId:`linkedin-picker`,onPick:e=>{_(void 0),t(me(i,e))}})}),W=x.visibility??`PUBLIC`,G=(0,X.jsxs)(`div`,{ref:O,className:`ak-li ak-li-composer relative`,"data-theme":R?`dark`:`light`,"data-testid":`linkedin-composer`,children:[(0,X.jsxs)(`div`,{className:`ak-li-c-head`,children:[(0,X.jsx)(fe,{visibility:W,avatar:64}),(0,X.jsxs)(Ee,{children:[(0,X.jsx)(Se,{asChild:!0,disabled:m,children:(0,X.jsxs)(d,{variant:`secondary`,size:`sm`,className:`ak-li-pill`,"data-testid":`linkedin-visibility`,children:[W===`CONNECTIONS`?(0,X.jsx)(pe,{}):(0,X.jsx)(Oe,{}),l.postTo(W===`CONNECTIONS`?l.connections:l.anyone),(0,X.jsx)(Te,{})]})}),(0,X.jsx)(we,{align:`start`,children:(0,X.jsxs)(Ce,{value:W,onValueChange:e=>{I(l.steps.visibility,t=>{let n={...t};return e===`PUBLIC`?delete n.visibility:n.visibility=`CONNECTIONS`,n})},children:[(0,X.jsx)(N,{value:`PUBLIC`,children:l.anyone}),(0,X.jsx)(N,{value:`CONNECTIONS`,children:l.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:x.commentary}),x.commentary.endsWith(`
|
|
3
|
+
`)?``:null]}),(0,X.jsx)(`textarea`,{dir:`auto`,value:x.commentary,placeholder:l.share,"aria-label":l.share,readOnly:m,"data-testid":`linkedin-commentary`,onChange:e=>{let t=e.target.value;I(l.steps.text,e=>({...e,commentary:t}),`commentary`)},onBlur:()=>{e.settle()}})]}),z?.poll?(0,X.jsx)(Ge,{poll:z.poll,locked:m,onChange:(e,t)=>{I(l.steps.poll,t=>Z(t,{poll:e}),t===void 0?void 0:`poll-${t}`)},onRemove:()=>{I(l.steps.poll,e=>Z(e,void 0))}}):(0,X.jsxs)(X.Fragment,{children:[z?.article?(0,X.jsx)(Ke,{article:z.article,locked:m,onChange:(e,t)=>{I(l.steps.link,t=>Z(t,{article:e}),`link-${t??``}`)}}):null,(0,X.jsx)(oe,{content:V,onMedium:m?void 0:e=>(0,X.jsx)(We,{alt:ke(e),onRemove:()=>{H(e)}})}),z?.media&&Q(z.media.file)!==`picture`?(0,X.jsx)(`input`,{className:`ak-li-doc-title-field`,value:z.media.title??``,placeholder:l.documentTitle,"aria-label":l.documentTitle,readOnly:m,onChange:e=>{let t=e.target.value;I(l.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]}),m?null:(0,X.jsxs)(`div`,{className:`ak-li-c-tools`,children:[(0,X.jsxs)(b,{open:g===`media`,onOpenChange:e=>{_(e?`media`:void 0)},children:[(0,X.jsx)(y,{asChild:!0,children:(0,X.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":z?.multiImage?l.addPicture:l.addMedia,title:z?.multiImage?l.addPicture:l.addMedia,disabled:Ae,children:(0,X.jsx)(A,{})})}),U(z?.multiImage||z?.media?de:ae,e=>{I(l.steps.media,t=>Z(t,He(t.content,e)))})]}),(0,X.jsxs)(b,{open:g===`document`,onOpenChange:e=>{_(e?`document`:void 0)},children:[(0,X.jsx)(y,{asChild:!0,children:(0,X.jsx)(d,{variant:`ghost`,size:`icon-sm`,"aria-label":l.addDocument,title:l.addDocument,disabled:z!==void 0,children:(0,X.jsx)(De,{})})}),U(le,e=>{I(l.steps.media,t=>Z(t,{media:{file:e}}))})]}),(0,X.jsx)($,{label:l.addPoll,disabled:z!==void 0,onClick:()=>{I(l.steps.poll,e=>Z(e,{poll:{question:``,options:[{text:``},{text:``}]}}))},children:(0,X.jsx)(te,{})}),(0,X.jsx)($,{label:l.addLink,disabled:z!==void 0,onClick:()=>{I(l.steps.link,e=>Z(e,{article:{source:`https://`}}))},children:(0,X.jsx)(ye,{})}),z?.article&&z.article.thumbnail===void 0?(0,X.jsxs)(b,{open:g===`thumbnail`,onOpenChange:e=>{_(e?`thumbnail`:void 0)},children:[(0,X.jsx)(y,{asChild:!0,children:(0,X.jsxs)(d,{variant:`ghost`,size:`sm`,children:[(0,X.jsx)(A,{}),l.link.thumbnail]})}),U(de,e=>{I(l.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:x.commentary})]}),C&&T?(0,X.jsx)(P,{"data-testid":`linkedin-agent-box`,label:ue(C),className:`inset-1`}):null]}),K={commentary:x.commentary,visibility:W,content:V},je=(0,X.jsxs)(`div`,{ref:k,className:`ak-li ak-li-previews relative`,"data-theme":R?`dark`:`light`,children:[(0,X.jsx)(D,{post:K,lines:3,onFolded:v}),ee?(0,X.jsx)(D,{post:K}):null,C&&T?(0,X.jsx)(P,{"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:F,children:[L,(0,X.jsx)(se.Provider,{value:_e,children:(0,X.jsx)(ve,{edit:G,preview:je,width:552,background:R?`#000000`:`#f4f2ee`,testId:`linkedin-preview`})})]})}function Je(){let e=E(),t=i(),n=o(),r=n?.item.entry,a=n?.item.dir??``,[s,c]=(0,Y.useState)(),[l,u]=(0,Y.useState)();return(0,Y.useEffect)(()=>{if(r===void 0)return;let e,n=!0;return Be.open(t,r).then(t=>{n?(e=t,c(t)):t.close()},e=>{n&&u(e instanceof Error?e.message:String(e))}),()=>{n=!1,e?.close()}},[t,r]),!s||r===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:a,entry:r})}export{Je as LinkedInPostEditor,Je as default,Be as PostDocument,ue as WORDS};
|
|
@@ -0,0 +1 @@
|
|
|
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,y as s}from"./react-WA6wlt8S.js";import{Tt as c,gt as l,t as u,yt as d}from"./button-eGxLxbv9.js";import{A as f,P as p,Y as m,et as h,g,nt as _,x as v}from"./snapshots-BUGlKQIB.js";import{t as y}from"./jsx-runtime-DePvh3-m.js";import{t as b}from"./createLucideIcon-GFZ_fxLc.js";import{a as x}from"./dist-CC7OeU1e.js";var ee=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`}]]),te=b(`zoom-in`,[[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`line`,{x1:`21`,x2:`16.65`,y1:`21`,y2:`16.65`,key:`13gj7c`}],[`line`,{x1:`11`,x2:`11`,y1:`8`,y2:`14`,key:`1vmskp`}],[`line`,{x1:`8`,x2:`14`,y1:`11`,y2:`11`,key:`durymu`}]]),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,ie]=(0,S.useState)(),[I,L]=(0,S.useState)(),[R,z]=(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&&L({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`){L({n:x.n,message:t.message});return}let n=t.event;switch(n.type){case`ready`:ie(x.n),z(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,$=I?.n===y.n?I.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:[R.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)(ee,{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)(te,{size:14}),f.zoomIn]})]})]})}export{P as SceneryViewer,P as default,D as WORDS,k as cardPlace,A as metres};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import{i as e,t}from"./rolldown-runtime-COiEfhsA.js";import{y as n}from"./react-WA6wlt8S.js";import{kt as r}from"./button-eGxLxbv9.js";import{t as i}from"./jsx-runtime-DePvh3-m.js";import{t as a}from"./createLucideIcon-GFZ_fxLc.js";import{C as o,E as s,S as c,T as l,_ as u,b as d,d as f,f as p,g as m,h,l as g,m as _,o as v,p as y,s as b,t as ee,u as te,v as ne,w as re,x as ie,y as x}from"./dist-BgDRE85b.js";import{I as ae,P as S,_ as oe}from"./syntax-C0iPON60.js";import{D as se,E as C,O as ce,S as le,T as ue,_ as de,a as fe,b as pe,c as w,d as T,g as me,h as he,i as ge,k as E,l as D,m as _e,n as O,o as k,p as ve,r as ye,s as A,t as be,v as xe,w as Se,x as Ce}from"./dist-YW8hS4IM.js";var we=a(`quote`,[[`path`,{d:`M16 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`rib7q0`}],[`path`,{d:`M5 3a2 2 0 0 0-2 2v6a2 2 0 0 0 2 2 1 1 0 0 1 1 1v1a2 2 0 0 1-2 2 1 1 0 0 0-1 1v2a1 1 0 0 0 1 1 6 6 0 0 0 6-6V5a2 2 0 0 0-2-2z`,key:`1ymkrd`}]]),Te=e(t(((e,t)=>{(function(){var e=t===void 0?function(){return this||(0,eval)(`this`)}():t.exports=i;e.format=i,e.vsprintf=r,typeof console<`u`&&typeof console.log==`function`&&(e.printf=n);function n(){console.log(i.apply(null,arguments))}function r(e,t){return i.apply(null,[e].concat(t))}function i(e){for(var t=1,n=[].slice.call(arguments),r=0,i=e.length,a=``,o,s=!1,c,l,u=!1,d,f=function(){return n[t++]},p=function(){for(var t=``;/\d/.test(e[r]);)t+=e[r++],o=e[r];return t.length>0?parseInt(t):null};r<i;++r)if(o=e[r],s)switch(s=!1,o==`.`?(u=!1,o=e[++r]):o==`0`&&e[r+1]==`.`?(u=!0,r+=2,o=e[r]):u=!0,d=p(),o){case`b`:a+=parseInt(f(),10).toString(2);break;case`c`:c=f(),typeof c==`string`||c instanceof String?a+=c:a+=String.fromCharCode(parseInt(c,10));break;case`d`:a+=parseInt(f(),10);break;case`f`:l=String(parseFloat(f()).toFixed(d||6)),a+=u?l:l.replace(/^0/,``);break;case`j`:a+=JSON.stringify(f());break;case`o`:a+=`0`+parseInt(f(),10).toString(8);break;case`s`:a+=f();break;case`x`:a+=`0x`+parseInt(f(),10).toString(16);break;case`X`:a+=`0x`+parseInt(f(),10).toString(16).toUpperCase();break;default:a+=o}else o===`%`?s=!0:a+=o;return a}})()}))(),1),Ee=Object.assign(j(Error),{eval:j(EvalError),range:j(RangeError),reference:j(ReferenceError),syntax:j(SyntaxError),type:j(TypeError),uri:j(URIError)});function j(e){return t.displayName=e.displayName||e.name,t;function t(t,...n){return new e(t&&(0,Te.default)(t,...n))}}var De={}.hasOwnProperty,Oe={yaml:`-`,toml:`+`};function ke(e){let t=[],n=-1,r=Array.isArray(e)?e:e?[e]:[`yaml`];for(;++n<r.length;)t[n]=Ae(r[n]);return t}function Ae(e){let t=e;if(typeof t==`string`){if(!De.call(Oe,t))throw Ee("Missing matter definition for `%s`",t);t={type:t,marker:Oe[t]}}else if(typeof t!=`object`)throw Ee("Expected matter to be an object, not `%j`",t);if(!De.call(t,`type`))throw Ee("Missing `type` in matter `%j`",t);if(!De.call(t,`fence`)&&!De.call(t,`marker`))throw Ee("Missing `marker` or `fence` in matter `%j`",t);return t}function je(e){let t=ke(e),n={},r=-1;for(;++r<t.length;){let e=t[r],i=Ne(e,`open`).charCodeAt(0),a=Me(e),o=n[i];Array.isArray(o)?o.push(a):n[i]=[a]}return{flow:n}}function Me(e){let t=e.anywhere,n=e.type,r=n+`Fence`,i=r+`Sequence`,a=n+`Value`,o={tokenize:u,partial:!0},s,c=0;return{tokenize:l,concrete:!0};function l(l,u,d){let f=this;return p;function p(a){let o=f.now();return o.column===1&&(o.line===1||t)&&(s=Ne(e,`open`),c=0,a===s.charCodeAt(c))?(l.enter(n),l.enter(r),l.enter(i),m(a)):d(a)}function m(e){return c===s.length?(l.exit(i),ae(e)?(l.enter(`whitespace`),h(e)):g(e)):e===s.charCodeAt(c++)?(l.consume(e),m):d(e)}function h(e){return ae(e)?(l.consume(e),h):(l.exit(`whitespace`),g(e))}function g(t){return S(t)?(l.exit(r),l.enter(`lineEnding`),l.consume(t),l.exit(`lineEnding`),s=Ne(e,`close`),c=0,l.attempt(o,b,_)):d(t)}function _(e){return e===null||S(e)?y(e):(l.enter(a),v(e))}function v(e){return e===null||S(e)?(l.exit(a),y(e)):(l.consume(e),v)}function y(e){return e===null?d(e):(l.enter(`lineEnding`),l.consume(e),l.exit(`lineEnding`),l.attempt(o,b,_))}function b(e){return l.exit(n),u(e)}}function u(e,t,n){let a=0;return o;function o(t){return t===s.charCodeAt(a)?(e.enter(r),e.enter(i),c(t)):n(t)}function c(t){return a===s.length?(e.exit(i),ae(t)?(e.enter(`whitespace`),l(t)):u(t)):t===s.charCodeAt(a++)?(e.consume(t),c):n(t)}function l(t){return ae(t)?(e.consume(t),l):(e.exit(`whitespace`),u(t))}function u(i){return i===null||S(i)?(e.exit(r),t(i)):n(i)}}}function Ne(e,t){return e.marker?Pe(e.marker,t).repeat(3):Pe(e.fence,t)}function Pe(e,t){return typeof e==`string`?e:e[t]}function Fe(e){let t=ke(e),n={},r={},i=-1;for(;++i<t.length;){let e=t[i];n[e.type]=Ie(e),r[e.type]=Le,r[e.type+`Value`]=Re}return{enter:n,exit:r}}function Ie(e){return t;function t(t){this.enter({type:e.type,value:``},t),this.buffer()}}function Le(e){let t=this.resume(),n=this.stack[this.stack.length-1];`value`in n,this.exit(e),n.value=t.replace(/^(\r?\n|\r)|(\r?\n|\r)$/g,``)}function Re(e){this.config.enter.data.call(this,e),this.config.exit.data.call(this,e)}function ze(e){let t=[],n={},r=ke(e),i=-1;for(;++i<r.length;){let e=r[i];n[e.type]=Be(e);let a=Ve(e,`open`);t.push({atBreak:!0,character:a.charAt(0),after:oe(a.charAt(1))})}return{unsafe:t,handlers:n}}function Be(e){let t=Ve(e,`open`),n=Ve(e,`close`);return r;function r(e){return t+(e.value?`
|
|
2
|
+
`+e.value:``)+`
|
|
3
|
+
`+n}}function Ve(e,t){return e.marker?He(e.marker,t).repeat(3):He(e.fence,t)}function He(e,t){return typeof e==`string`?e:e[t]}var Ue=Object.defineProperty,We=(e,t)=>{let n={};for(var r in e)Ue(n,r,{get:e[r],enumerable:!0});return t||Ue(n,Symbol.toStringTag,{value:`Module`}),n};function Ge(e,t=null){return function(n,r){let{$from:i,$to:a}=n.selection,o=i.blockRange(a);if(!o)return!1;let s=r?n.tr:null;return Ke(s,o,e,t)?(r&&r(s.scrollIntoView()),!0):!1}}function Ke(e,t,n,r=null){let i=!1,a=t,o=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&t.startIndex==0){if(t.$from.index(t.depth-1)==0)return!1;let e=o.resolve(t.start-2);a=new se(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new se(t.$from,o.resolve(t.$to.end(t.depth)),t.depth)),i=!0}let s=pe(a,n,r,t);return s?(e&&qe(e,t,s,i,n),!0):!1}function qe(e,t,n,r,i){let a=C.empty;for(let e=n.length-1;e>=0;e--)a=C.from(n[e].type.create(n[e].attrs,a));e.step(new _e(t.start-(r?2:0),t.end,t.start,t.end,new E(a,0,0),n.length,!0));let o=0;for(let e=0;e<n.length;e++)n[e].type==i&&(o=e+1);let s=n.length-o,c=t.start+n.length-(r?2:0),l=t.parent;for(let n=t.startIndex,r=t.endIndex,i=!0;n<r;n++,i=!1)!i&&xe(e.doc,c,s)&&(e.split(c,s),c+=2*s),c+=l.child(n).nodeSize;return e}function Je(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);return a?n?r.node(a.depth-1).type==e?Ye(t,n,e,a):Xe(t,n,a):!0:!1}}function Ye(e,t,n,r){let i=e.tr,a=r.end,o=r.$to.end(r.depth);a<o&&(i.step(new _e(a-1,o,a,o,new E(C.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new se(i.doc.resolve(r.$from.pos),i.doc.resolve(o),r.depth));let s=le(r);if(s==null)return!1;i.lift(r,s);let c=i.doc.resolve(i.mapping.map(a,-1)-1);return de(i.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&i.join(c.pos),t(i.scrollIntoView()),!0}function Xe(e,t,n){let r=e.tr,i=n.parent;for(let e=n.end,t=n.endIndex-1,a=n.startIndex;t>a;t--)e-=i.child(t).nodeSize,r.delete(e-1,e+1);let a=r.doc.resolve(n.start),o=a.nodeAfter;if(r.mapping.map(n.end)!=n.start+a.nodeAfter.nodeSize)return!1;let s=n.startIndex==0,c=n.endIndex==i.childCount,l=a.node(-1),u=a.index(-1);if(!l.canReplace(u+ +!s,u+1,o.content.append(c?C.empty:C.from(i))))return!1;let d=a.pos,f=d+o.nodeSize;return r.step(new _e(d-+!!s,f+ +!!c,d+1,f-1,new E((s?C.empty:C.from(i.copy(C.empty))).append(c?C.empty:C.from(i.copy(C.empty))),+!s,+!c),+!s)),t(r.scrollIntoView()),!0}function Ze(e){return function(t,n){let{$from:r,$to:i}=t.selection,a=r.blockRange(i,t=>t.childCount>0&&t.firstChild.type==e);if(!a)return!1;let o=a.startIndex;if(o==0)return!1;let s=a.parent,c=s.child(o-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==s.type,i=C.from(r?e.create():null),o=new E(C.from(e.create(null,C.from(s.type.create(null,i)))),r?3:1,0),l=a.start,u=a.end;n(t.tr.step(new _e(l-(r?3:1),u,l,u,o,1,!0)).scrollIntoView())}return!0}}function Qe(e){let{state:t,transaction:n}=e,{selection:r}=n,{doc:i}=n,{storedMarks:a}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return a},get selection(){return r},get doc(){return i},get tr(){return r=n.selection,i=n.doc,a=n.storedMarks,n}}}var M=class e{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:i}=n,a=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{let n=t(...e)(a);return!i.getMeta(`preventDispatch`)&&!this.hasCustomState&&r.dispatch(i),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o=[],s=!!e,c=e||i.tr,l=()=>(!s&&t&&!c.getMeta(`preventDispatch`)&&!this.hasCustomState&&a.dispatch(c),o.every(e=>e===!0)),u={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{let r=this.buildProps(c,t),i=n(...e)(r);return o.push(i),u}])),run:l};return u}static createFakeChain(){let e=new Proxy({},{get:(t,n)=>{if(n!==`then`)return n===`run`?()=>!1:()=>e}});return e}createCan(e){let{rawCommands:t,state:n}=this,r=e||n.tr,i=this.buildProps(r,!1);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,!1)}}static createFallbackCan(){let t=e.createFakeChain();return new Proxy({chain:()=>t},{get:(e,t)=>{if(t!==`then`)return t===`chain`?e.chain:()=>!1}})}buildProps(e,t=!0){let{rawCommands:n,editor:r,state:i}=this,{view:a}=r,o={tr:e,editor:r,view:a,state:Qe({state:i,transaction:e}),dispatch:t?()=>void 0:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(o)]))}};return o}},$e=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{if(!e.isDestroyed){var n;t.dom.blur(),(n=window)==null||(n=n.getSelection())==null||n.removeAllRanges()}}),!0),et=(e=!0)=>({commands:t})=>t.setContent(``,{emitUpdate:e}),tt=()=>({state:e,tr:t,dispatch:n})=>{let{selection:r}=t,{ranges:i}=r;return n&&i.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;let{doc:r,mapping:i}=t,a=r.resolve(i.map(n)),o=r.resolve(i.map(n+e.nodeSize)),s=a.blockRange(o);if(!s)return;let c=le(s);if(e.type.isTextblock){let{defaultType:e}=a.parent.contentMatchAt(a.index());t.setNodeMarkup(s.start,e)}(c||c===0)&&t.lift(s,c)})}),!0},nt=e=>t=>e(t),rt=()=>({state:e,dispatch:t})=>g(e,t),it=(e,t)=>({editor:n,tr:r})=>{let{state:i}=n,a=i.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);let o=r.mapping.map(t);return r.insert(o,a.content),r.setSelection(new T(r.doc.resolve(Math.max(o-1,0)))),!0},at=()=>({tr:e,dispatch:t})=>{let{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;let i=e.selection.$anchor;for(let n=i.depth;n>0;--n)if(i.node(n).type===r.type){if(t){let t=i.before(n),r=i.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function N(e,t){if(typeof e==`string`){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var ot=e=>({tr:t,state:n,dispatch:r})=>{let i=N(e,n.schema),a=t.selection.$anchor;for(let e=a.depth;e>0;--e)if(a.node(e).type===i){if(r){let n=a.before(e),r=a.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},st=e=>({tr:t,dispatch:n})=>{let{from:r,to:i}=e;return n&&t.delete(r,i),!0},ct=e=>e.content?/^text(\*|\+)/.test(e.content):!1,lt=(e,t,n)=>{if(!e.parent.isInline||n===`left`&&e.pos>e.start()||n===`right`&&e.pos<e.end())return e.pos;let r=t.nodes[e.parent.type.name].spec;return ct(r)?n===`left`?e.start()-1:e.end()+1:e.pos},ut=(e,t,n)=>({from:lt(e,n,`left`),to:lt(t,n,`right`)}),dt=()=>({state:e,dispatch:t})=>{if(e.selection.empty)return!1;if(t){let n=e.tr,{ranges:r}=e.selection,i=n.steps.length;r.forEach(t=>{let r=n.mapping.slice(i),{from:a,to:o}=ut(n.doc.resolve(r.map(t.$from.pos)),n.doc.resolve(r.map(t.$to.pos)),e.schema);n.deleteRange(a,o)}),n.selection.empty||n.setSelection(T.near(n.doc.resolve(n.selection.from))),n.scrollIntoView(),t(n)}return!0},ft=()=>({commands:e})=>e.keyboardShortcut(`Enter`),pt=()=>({state:e,dispatch:t})=>te(e,t);function mt(e){return Object.prototype.toString.call(e)===`[object RegExp]`}function ht(e,t,n={strict:!0}){let r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:mt(t[r])?t[r].test(e[r]):t[r]===e[r])}function gt(e,t,n={}){return e.find(e=>e.type===t&&ht(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function _t(e,t,n={}){return!!gt(e,t,n)}function vt(e,t,n){if(!e||!t)return;let r=e.parent.childAfter(e.parentOffset);if(r.node&&r.node.marks.some(e=>e.type===t)||(r=e.parent.childBefore(e.parentOffset)),!r.node||!r.node.marks.some(e=>e.type===t))return;if(!n){let e=r.node.marks.find(e=>e.type===t);e&&(n=e.attrs)}if(!gt([...r.node.marks],t,n))return;let i=r.index,a=e.start()+r.offset,o=i+1,s=a+r.node.nodeSize;for(;i>0&&_t([...e.parent.child(i-1).marks],t,n);)--i,a-=e.parent.child(i).nodeSize;for(;o<e.parent.childCount&&_t([...e.parent.child(o).marks],t,n);)s+=e.parent.child(o).nodeSize,o+=1;return{from:a,to:s}}function P(e,t){if(typeof e==`string`){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var yt=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=P(e,r.schema),{doc:o,selection:s}=n,{$from:c,from:l,to:u}=s;if(i){let e=vt(c,a,t);if(e&&e.from<=l&&e.to>=u){let t=T.create(o,e.from,e.to);n.setSelection(t)}}return!0},bt=e=>t=>{let n=typeof e==`function`?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function xt(e){return e instanceof T}function F(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function St(e,t=null){if(!t)return null;let n=D.atStart(e),r=D.atEnd(e);if(t===`start`||t===!0)return n;if(t===`end`)return r;let i=n.from,a=r.to;return t===`all`?T.create(e,F(0,i,a),F(e.content.size,i,a)):T.create(e,F(t,i,a),F(t,i,a))}function Ct(){return[`Android`].includes(navigator.platform)||/android/i.test(navigator.userAgent)}function I(){return[`iPad Simulator`,`iPhone Simulator`,`iPod Simulator`,`iPad`,`iPhone`,`iPod`].includes(navigator.platform)||navigator.userAgent.includes(`Mac`)&&`ontouchend`in document}function wt(){return typeof navigator<`u`&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var Tt=(e=null,t={})=>({editor:n,view:r,tr:i,dispatch:a})=>{t={scrollIntoView:!0,...t};let o=()=>{(I()||Ct())&&r.dom.focus(),wt()&&!I()&&!Ct()&&r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),t?.scrollIntoView&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&e===null||e===!1)return!0}catch{return!1}if(a&&e===null&&!xt(n.state.selection))return o(),!0;let s=St(i.doc,e)||n.state.selection,c=n.state.selection.eq(s);return a&&(c||i.setSelection(s),c&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Et=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Dt=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Ot=e=>{let t=e.childNodes;for(let n=t.length-1;n>=0;--n){let r=t[n];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):r.nodeType===1&&Ot(r)}return e};function kt(e){if(typeof window>`u`)throw Error(`[tiptap error]: there is no window object available, so this function cannot be used`);let t=`<body>${e}</body>`,n=new window.DOMParser().parseFromString(t,`text/html`).body;return Ot(n)}function At(e){return typeof e?.nodesBetween==`function`}function jt(e,t,n){if(At(e))return e;let r=typeof e==`object`&&!!e;n={slice:!0,parseOptions:{},...n};let i=typeof e==`string`;if(r)try{if(Array.isArray(e)&&e.length>0)return C.fromArray(e.map(e=>t.nodeFromJSON(e)));let r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw Error(`[tiptap error]: Invalid JSON content`,{cause:r});return console.warn(`[tiptap warn]: Invalid content.`,`Passed value:`,e,`Error:`,r),jt(``,t,n)}if(i){if(n.errorOnInvalidContent){let r=!1,i=``,a=new ce({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:`inline*`,group:`block`,parseDOM:[{tag:`*`,getAttrs:e=>(r=!0,i=typeof e==`string`?e:e.outerHTML,null)}]}})});if(n.slice?Se.fromSchema(a).parseSlice(kt(e),n.parseOptions):Se.fromSchema(a).parse(kt(e),n.parseOptions),n.errorOnInvalidContent&&r)throw Error(`[tiptap error]: Invalid HTML content`,{cause:Error(`Invalid element found: ${i}`)})}let r=Se.fromSchema(t);return n.slice?r.parseSlice(kt(e),n.parseOptions).content:r.parse(kt(e),n.parseOptions)}return jt(``,t,n)}function Mt(e){return!(`type`in e)}function Nt(e,t,n){let r=e.steps.length-1;if(r<t)return;let i=e.steps[r];if(!(i instanceof he||i instanceof _e))return;let a=e.mapping.maps[r],o=0;a.forEach((e,t,n,r)=>{o===0&&(o=r)}),e.setSelection(D.near(e.doc.resolve(o),n))}var Pt=(e,t,n)=>({tr:r,dispatch:i,editor:a})=>{if(i){n={parseOptions:a.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};let i,o=e=>{a.emit(`contentError`,{editor:a,error:e,disableCollaboration:()=>{`collaboration`in a.storage&&typeof a.storage.collaboration==`object`&&a.storage.collaboration&&(a.storage.collaboration.isDisabled=!0)}})},s={preserveWhitespace:`full`,...n.parseOptions};if(!n.errorOnInvalidContent&&!a.options.enableContentCheck&&a.options.emitContentError)try{jt(t,a.schema,{parseOptions:s,errorOnInvalidContent:!0})}catch(e){o(e)}try{i=jt(t,a.schema,{parseOptions:s,errorOnInvalidContent:n.errorOnInvalidContent??a.options.enableContentCheck})}catch(e){return o(e),!1}let{from:c,to:l}=typeof e==`number`?{from:e,to:e}:{from:e.from,to:e.to},u=!0,d=!0,f=Mt(i)?i.content:[i];if(f.forEach(e=>{e.check(),u=u?e.isText&&e.marks.length===0:!1,d=d?e.isBlock:!1}),c===l&&d){let{parent:e}=r.doc.resolve(c);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(--c,l+=1)}let p;if(u)p=Array.isArray(t)?t.map(e=>e.text||``).join(``):At(t)?f.map(e=>e.text??``).join(``):typeof t==`object`&&t&&t.text?t.text:t,r.insertText(p,c,l);else{p=C.from(f);let e=r.doc.resolve(c),t=e.node(),n=e.parentOffset===0,i=t.isText||t.isTextblock,a=t.content.size>0;n&&i&&a&&d&&(c=Math.max(0,c-1)),r.replaceWith(c,l,f)}n.updateSelection&&Nt(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta(`applyInputRules`,{from:c,text:p}),n.applyPasteRules&&r.setMeta(`applyPasteRules`,{from:c,text:p})}return!0};function Ft(e){for(let t=0;t<e.edgeCount;t+=1){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var It=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{pos:i,attrs:a,content:o,updateSelection:s=!0}=e,c;c=typeof i==`number`?t.doc.resolve(i):i||t.selection.$from;let l=Ft(c.parent.contentMatchAt(c.index()));if(!l)return!1;let u=Object.keys(l.spec.attrs||{}),d=a?Object.fromEntries(Object.entries(a).filter(([e])=>u.includes(e))):{},f;if(o){let e=jt(o,r.schema);f=l.createAndFill(d,e)}else f=l.createAndFill(d);return f?(n&&(t.insert(c.pos,f),s&&Nt(t,t.steps.length-1,-1)),!0):!1},Lt=()=>({state:e,dispatch:t})=>m(e,t),Rt=()=>({state:e,dispatch:t})=>p(e,t),zt=()=>({state:e,dispatch:t})=>f(e,t),Bt=()=>({state:e,dispatch:t})=>y(e,t),Vt=(e,t)=>{let n=e.resolve(t),r=n.nodeBefore,i=n.nodeAfter;return!r||!i?!1:!r.type.spec.isolating&&!i.type.spec.isolating},Ht=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Ce(e.doc,e.selection.$from.pos,-1);return r==null||!Vt(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Ut=()=>({state:e,dispatch:t,tr:n})=>{try{let r=Ce(e.doc,e.selection.$from.pos,1);return r==null||!Vt(e.doc,r)?!1:(n.join(r,2),t&&t(n),!0)}catch{return!1}},Wt=()=>({state:e,dispatch:t})=>_(e,t),Gt=()=>({state:e,dispatch:t})=>h(e,t);function Kt(){return typeof navigator<`u`&&/Mac/.test(navigator.platform)}function qt(e){let t=e.split(/-(?!$)/),n=t[t.length-1];n===`Space`&&(n=` `);let r,i,a,o;for(let e=0;e<t.length-1;e+=1){let n=t[e];if(/^(cmd|meta|m)$/i.test(n))o=!0;else if(/^a(lt)?$/i.test(n))r=!0;else if(/^(c|ctrl|control)$/i.test(n))i=!0;else if(/^s(hift)?$/i.test(n))a=!0;else if(/^mod$/i.test(n))I()||Kt()?o=!0:i=!0;else throw Error(`Unrecognized modifier name: ${n}`)}return r&&(n=`Alt-${n}`),i&&(n=`Ctrl-${n}`),o&&(n=`Meta-${n}`),a&&(n=`Shift-${n}`),n}var Jt=e=>({editor:t,view:n,tr:r,dispatch:i})=>{let a=qt(e).split(/-(?!$)/),o=a.find(e=>![`Alt`,`Ctrl`,`Meta`,`Shift`].includes(e)),s=new KeyboardEvent(`keydown`,{key:o===`Space`?` `:o,altKey:a.includes(`Alt`),ctrlKey:a.includes(`Ctrl`),metaKey:a.includes(`Meta`),shiftKey:a.includes(`Shift`),bubbles:!0,cancelable:!0});return t.captureTransaction(()=>{n.someProp(`handleKeyDown`,e=>e(n,s))})?.steps.forEach(e=>{let t=e.map(r.mapping);t&&i&&r.maybeStep(t)}),!0};function Yt(e,t,n={}){let{from:r,to:i,empty:a}=e.selection,o=t?N(t,e.schema):null,s=[];e.doc.nodesBetween(r,i,(e,t)=>{if(e.isText)return;let n=Math.max(r,t),a=Math.min(i,t+e.nodeSize);s.push({node:e,from:n,to:a})});let c=i-r,l=s.filter(e=>!o||o.name===e.node.type.name).filter(e=>ht(e.node.attrs,n,{strict:!1}));return a?!!l.length:l.reduce((e,t)=>e+t.to-t.from,0)>=c}var Xt=(e,t={})=>({state:n,dispatch:r})=>Yt(n,N(e,n.schema),t)?u(n,r):!1,Zt=()=>({state:e,dispatch:t})=>ne(e,t),Qt=e=>({state:t,dispatch:n})=>Je(N(e,t.schema))(t,n),$t=()=>({state:e,dispatch:t})=>x(e,t);function en(e,t){return t.nodes[e]?`node`:t.marks[e]?`mark`:null}function tn(e,t){let n=typeof t==`string`?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var nn=(e,t)=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=en(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=N(e,r.schema)),s===`mark`&&(o=P(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,tn(e.attrs,t))),o&&e.marks.length&&e.marks.forEach(a=>{o===a.type&&(c=!0,i&&n.addMark(r,r+e.nodeSize,o.create(tn(a.attrs,t))))})})}),c},rn=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),an=()=>({tr:e,dispatch:t})=>{if(t){let t=new ge(e.doc);e.setSelection(t)}return!0},on=()=>({state:e,dispatch:t})=>d(e,t),sn=()=>({state:e,dispatch:t})=>ie(e,t),cn=()=>({state:e,dispatch:t})=>c(e,t),ln=()=>({state:e,dispatch:t})=>o(e,t),un=()=>({state:e,dispatch:t})=>re(e,t);function dn(e,t,n={},r={}){return jt(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var fn=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:i,tr:a,dispatch:o,commands:s})=>{let{doc:c}=a;if(r.preserveWhitespace!==`full`){let s=dn(e,i.schema,r,{errorOnInvalidContent:t??i.options.enableContentCheck});if(o){let e=Mt(s)?s.content:[s];a.replaceWith(0,c.content.size,e).setMeta(`preventUpdate`,!n)}return!0}return o&&a.setMeta(`preventUpdate`,!n),s.insertContentAt({from:0,to:c.content.size},e,{parseOptions:r,errorOnInvalidContent:t??i.options.enableContentCheck})};function pn(e,t){let n=P(t,e.schema),{from:r,to:i,empty:a}=e.selection,o=[];a?(e.storedMarks&&o.push(...e.storedMarks),o.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,i,e=>{o.push(...e.marks)});let s=o.find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function mn(e,t){let n=new me(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function hn(e,t,n){let r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function gn(e,t){for(let n=e.depth;n>0;--n){let r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function _n(e){return t=>gn(t.$from,e)}function L(e,t,n){return e.config[t]===void 0&&e.parent?L(e.parent,t,n):typeof e.config[t]==`function`?e.config[t].bind({...n,parent:e.parent?L(e.parent,t,n):null}):e.config[t]}function vn(e){return e.map(e=>{let t=L(e,`addExtensions`,{name:e.name,options:e.options,storage:e.storage});return t?[e,...vn(t())]:e}).flat(10)}function yn(e,t){let n=ue.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement(`div`);return r.appendChild(n),r.innerHTML}function bn(e,t){let n=new Map;for(let t of e){let e=n.get(t.type)??new Map;e.set(t.name,t),n.set(t.type,e)}return[...Object.values(t.nodes),...Object.values(t.marks)].flatMap(e=>Object.entries(e.spec.attrs??{}).map(([t,r])=>{let i=n.get(e.name)?.get(t),a=Object.hasOwn(r,`default`);return{type:e.name,name:t,attribute:{rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,...i?.attribute,default:r.default,isRequired:!a,validate:r.validate}}}))}var xn={content:`string`,marks:`string`,group:`string`,inline:`boolean`,atom:`boolean`,selectable:`boolean`,draggable:`boolean`,code:`boolean`,whitespace:[`pre`,`normal`],definingAsContext:`boolean`,definingForContent:`boolean`,defining:`boolean`,isolating:`boolean`,linebreakReplacement:`boolean`},Sn={inclusive:`boolean`,excludes:`string`,group:`string`,spanning:`boolean`,code:`boolean`};function Cn(e,t,n){return Object.fromEntries(Object.entries(t).flatMap(([t,r])=>{let i=e[t];if(i===void 0)return[];if(!(typeof r==`string`?typeof i===r:typeof i==`string`&&r.includes(i)))throw RangeError(`Invalid schemaSpec field '${n}.${t}'`);return[[t,i]]}))}function wn(e,t,n,r){return{...Object.fromEntries(Object.entries(t).filter(([e])=>e!==`attrs`&&!Object.hasOwn(r,e))),...Cn(n,r,e),attrs:n.attrs}}function Tn(e,t,n){for(let r of Object.keys(t))if(!Object.hasOwn(e,r))throw RangeError(`schemaSpec requires a local ${n} extension named '${r}'`);for(let r of Object.keys(e))if(!Object.hasOwn(t,r))throw RangeError(`Local ${n} extension '${r}' is not in schemaSpec`)}function En(e,t){Tn(e.nodes,t.nodes,`node`),Tn(e.marks,t.marks,`mark`);let n=t.spec.nodes,r=t.spec.marks;return t.spec.nodes.forEach((t,r)=>{n=n.update(t,wn(t,e.nodes[t],r,xn))}),t.spec.marks.forEach((t,n)=>{r=r.update(t,wn(t,e.marks[t],n,Sn))}),{topNode:t.topNodeType.name,nodes:n,marks:r}}function Dn(e){let t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function On(e){return{baseExtensions:e.filter(e=>e.type===`extension`),nodeExtensions:e.filter(e=>e.type===`node`),markExtensions:e.filter(e=>e.type===`mark`)}}function kn(e){let t=[],{nodeExtensions:n,markExtensions:r}=On(e),i=[...n,...r],a={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},o=n.filter(e=>e.name!==`text`).map(e=>e.name),s=r.map(e=>e.name),c=[...o,...s];return e.forEach(e=>{let n=L(e,`addGlobalAttributes`,{name:e.name,options:e.options,storage:e.storage,extensions:i});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:e.types===`*`?c:e.types===`nodes`?o:e.types===`marks`?s:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...a,...r}})})})})}),i.forEach(e=>{let n=L(e,`addAttributes`,{name:e.name,options:e.options,storage:e.storage});if(!n)return;let r=n();Object.entries(r).forEach(([n,r])=>{let i={...a,...r};typeof i?.default==`function`&&(i.default=i.default()),i?.isRequired&&i?.default===void 0&&delete i.default,t.push({type:e.name,name:n,attribute:i})})}),t}function An(e){return typeof e==`function`}function R(e,t=void 0,...n){return An(e)?t?e.bind(t)(...n):e(...n):e}function jn(e={}){return Object.keys(e).length===0&&e.constructor===Object}function Mn(e){let t=[],n=``,r=!1,i=!1,a=0,o=e.length;for(let s=0;s<o;s+=1){let o=e[s];if(o===`'`&&!i)r=!r,n+=o;else if(o===`"`&&!r)i=!i,n+=o;else{if(!r&&!i){if(o===`(`){a+=1,n+=o;continue}if(o===`)`&&a>0){--a,n+=o;continue}if(o===`;`&&a===0){t.push(n),n=``;continue}}n+=o}}return n&&t.push(n),t}function Nn(e){let t=[],n=Mn(e||``),r=n.length;for(let e=0;e<r;e+=1){let r=n[e],i=r.indexOf(`:`);if(i===-1)continue;let a=r.slice(0,i).trim(),o=r.slice(i+1).trim();a&&o&&t.push([a,o])}return t}function z(...e){return e.filter(e=>!!e).reduce((e,t)=>{let n={...e};return Object.entries(t).forEach(([e,t])=>{if(e===`__proto__`)Object.defineProperty(n,e,{configurable:!0,enumerable:!0,value:t,writable:!0});else if(!n[e])n[e]=t;else if(e===`class`){let r=t?String(t).split(` `):[],i=n[e]?n[e].split(` `):[],a=r.filter(e=>!i.includes(e));n[e]=[...i,...a].join(` `)}else if(e===`style`){let r=new Map([...Nn(n[e]),...Nn(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join(`; `)}else n[e]=t}),n},{})}function B(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>z(e,t),{})}function Pn(e){return typeof e==`string`?e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):e===`true`||e!==`false`&&e:e}function Fn(e,t){return`style`in e?e:{...e,getAttrs:n=>{let r=e.getAttrs?e.getAttrs(n):e.attrs;if(r===!1)return!1;let i=t.reduce((e,t)=>{let r=t.attribute.parseHTML?t.attribute.parseHTML(n):Pn(n.getAttribute(t.name));return r==null?e:{...e,[t.name]:r}},{});return{...r,...i}}}}function In(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>e===`attrs`&&jn(t)?!1:t!=null))}function Ln(e){var t,n;let r={};return!(e!=null&&(t=e.attribute)!=null&&t.isRequired)&&`default`in(e?.attribute||{})&&(r.default=e.attribute.default),(e==null||(n=e.attribute)==null?void 0:n.validate)!==void 0&&(r.validate=e.attribute.validate),[e.name,r]}function Rn(e,t,n=kn(e)){let{nodeExtensions:r,markExtensions:i}=On(e);return{topNode:r.find(e=>L(e,`topNode`))?.name,nodes:Object.fromEntries(r.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=In({...e.reduce((e,t)=>{let n=L(t,`extendNodeSchema`,a);return{...e,...n?n(r):{}}},{}),content:R(L(r,`content`,a)),marks:R(L(r,`marks`,a)),group:R(L(r,`group`,a)),inline:R(L(r,`inline`,a)),atom:R(L(r,`atom`,a)),selectable:R(L(r,`selectable`,a)),draggable:R(L(r,`draggable`,a)),code:R(L(r,`code`,a)),whitespace:R(L(r,`whitespace`,a)),linebreakReplacement:R(L(r,`linebreakReplacement`,a)),defining:R(L(r,`defining`,a)),isolating:R(L(r,`isolating`,a)),attrs:Object.fromEntries(i.map(Ln))}),s=R(L(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>Fn(e,i)));let c=L(r,`renderHTML`,a);c&&(o.toDOM=e=>c({node:e,HTMLAttributes:B(e,i)}));let l=L(r,`renderText`,a);return l&&(o.toText=l),[r.name,o]})),marks:Object.fromEntries(i.map(r=>{let i=n.filter(e=>e.type===r.name),a={name:r.name,options:r.options,storage:r.storage,editor:t},o=In({...e.reduce((e,t)=>{let n=L(t,`extendMarkSchema`,a);return{...e,...n?n(r):{}}},{}),inclusive:R(L(r,`inclusive`,a)),excludes:R(L(r,`excludes`,a)),group:R(L(r,`group`,a)),spanning:R(L(r,`spanning`,a)),code:R(L(r,`code`,a)),attrs:Object.fromEntries(i.map(Ln))}),s=R(L(r,`parseHTML`,a));s&&(o.parseDOM=s.map(e=>Fn(e,i)));let c=L(r,`renderHTML`,a);return c&&(o.toDOM=e=>c({mark:e,HTMLAttributes:B(e,i)})),[r.name,o]}))}}function zn(e,t,n){if(n===void 0)return new ce(Rn(e,t));let r=Dn(e.filter(e=>e.type!==`extension`).map(e=>e.name));if(r.length)throw RangeError(`Duplicate local schema types: ${r.join(`, `)}`);let i=new ce(n),a=Rn(e,t,bn(kn(e),i));return new ce(En(a,i))}function Bn(e){return e.sort((e,t)=>{let n=L(e,`priority`)||100,r=L(t,`priority`)||100;return n>r?-1:+(n<r)})}function Vn(e){let t=Bn(vn(e)),n=Dn(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(`, `)}]. This can lead to issues.`),t}function Hn(e,t){return zn(Vn(e),t)}function Un(e,t,n){let{from:r,to:i}=t,{blockSeparator:a=`
|
|
4
|
+
|
|
5
|
+
`,textSerializers:o={}}=n||{},s=``;return e.nodesBetween(r,i,(e,n,c,l)=>{e.isBlock&&n>r&&(s+=a);let u=o?.[e.type.name];if(u)return c&&(s+=u({node:e,pos:n,parent:c,index:l,range:t})),!1;if(e.isText){var d;s+=e==null||(d=e.text)==null?void 0:d.slice(Math.max(r,n)-n,i-n)}}),s}function Wn(e,t){return Un(e,{from:0,to:e.content.size},t)}function Gn(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Kn(e,t){let n=N(t,e.schema),{from:r,to:i}=e.selection,a=[];e.doc.nodesBetween(r,i,e=>{a.push(e)});let o=a.reverse().find(e=>e.type.name===n.name);return o?{...o.attrs}:{}}function qn(e,t){let n=en(typeof t==`string`?t:t.name,e.schema);return n===`node`?Kn(e,t):n===`mark`?pn(e,t):{}}function Jn(e,t=JSON.stringify){let n={};return e.filter(e=>{let r=t(e);return Object.prototype.hasOwnProperty.call(n,r)?!1:n[r]=!0})}function Yn(e){let t=Jn(e);return t.length===1?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}function Xn(e){let{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,i)=>{let a=[];if(e.ranges.length)e.forEach((e,t)=>{a.push({from:e,to:t})});else{let{from:e,to:t}=n[i];if(e===void 0||t===void 0)return;a.push({from:e,to:t})}a.forEach(({from:e,to:n})=>{let a=t.slice(i).map(e,-1),o=t.slice(i).map(n),s=t.invert().map(a,-1),c=t.invert().map(o);r.push({oldRange:{from:s,to:c},newRange:{from:a,to:o}})})}),Yn(r)}function Zn(e,t,n){let r=[];return e===t?n.resolve(e).marks().forEach(t=>{let i=vt(n.resolve(e),t.type);i&&r.push({mark:t,...i})}):n.nodesBetween(e,t,(e,t)=>{e&&e?.nodeSize!==void 0&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var Qn=(e,t,n,r=20)=>{let i=e.doc.resolve(n),a=r,o=null;for(;a>0&&o===null;){let e=i.node(a);e?.type.name===t?o=e:--a}return[o,a]},$n=e=>{let t=e.depth-1;if(t<0)return null;let n=e.index(t);return n===0?null:e.node(t).child(n-1)};function V(e,t){return t.nodes[e]||t.marks[e]||null}function er(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{let r=e.find(e=>e.type===t&&e.name===n);return r?r.attribute.keepOnSplit:!1}))}var tr=(e,t=500)=>{let n=``,r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,i,a)=>{var o;let s=(o=e.type.spec).toText?.call(o,{node:e,pos:t,parent:i,index:a})||e.textContent||`%leaf%`;n+=e.isAtom&&!e.isText?s:s.slice(0,Math.max(0,r-t))}),n};function nr(e,t,n={}){let{empty:r,ranges:i}=e.selection,a=t?P(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!a||a.name===e.type.name).find(e=>ht(e.attrs,n,{strict:!1}));let o=0,s=[];if(i.forEach(({$from:t,$to:n})=>{let r=t.pos,i=n.pos;e.doc.nodesBetween(r,i,(e,t)=>{if(a&&e.inlineContent&&!e.type.allowsMarkType(a))return!1;if(!e.isText&&!e.marks.length)return;let n=Math.max(r,t),c=Math.min(i,t+e.nodeSize),l=c-n;o+=l,s.push(...e.marks.map(e=>({mark:e,from:n,to:c})))})}),o===0)return!1;let c=s.filter(e=>!a||a.name===e.mark.type.name).filter(e=>ht(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),l=s.filter(e=>!a||e.mark.type!==a&&e.mark.type.excludes(a)).reduce((e,t)=>e+t.to-t.from,0);return(c>0?c+l:c)>=o}function rr(e,t,n={}){if(!t)return Yt(e,null,n)||nr(e,null,n);let r=en(t,e.schema);return r===`node`?Yt(e,t,n):r===`mark`&&nr(e,t,n)}var ir=(e,t)=>{let{$from:n,$to:r,$anchor:i}=e.selection;if(t){let n=_n(e=>e.type.name===t)(e.selection);if(!n)return!1;let r=e.doc.resolve(n.pos+1);return i.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},ar=e=>{let{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function or(e,t){return Array.isArray(t)?t.some(t=>(typeof t==`string`?t:t.name)===e.name):t}function sr(e,t){let{nodeExtensions:n}=On(t),r=n.find(t=>t.name===e);if(!r)return!1;let i=R(L(r,`group`,{name:r.name,options:r.options,storage:r.storage}));return typeof i==`string`&&i.split(` `).includes(`list`)}function cr(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){if(n){if(e.type.name===`hardBreak`)return!0;if(e.isText)return!/\S/.test(e.text??``)}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(e.content.childCount===0)return!0;if(t){let r=!0;return e.content.forEach(e=>{r!==!1&&(cr(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function lr(e){return e instanceof k}function ur(e){if(typeof e!=`object`||!e)return!1;let t=e;return typeof t.apply==`function`&&typeof t.getMap==`function`&&typeof t.invert==`function`&&typeof t.map==`function`&&typeof t.merge==`function`&&typeof t.toJSON==`function`}function dr(e){if(typeof e!=`object`||!e)return!1;let t=e;if(!ur(t))return!1;let n=t.toJSON();return!(typeof n!=`object`||!n||n.stepType!==`replace`)}var fr=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function pr(e,t){let n=t.mapping.mapResult(e.position);return{position:new fr(n.pos),mapResult:n}}function mr(e){return new fr(e)}function hr(e,t,n){let r=e.state.doc.content.size,i=F(t,0,r),a=F(n,0,r),o=e.coordsAtPos(i),s=e.coordsAtPos(a,-1),c=Math.min(o.top,s.top),l=Math.max(o.bottom,s.bottom),u=Math.min(o.left,s.left),d=Math.max(o.right,s.right),f={top:c,bottom:l,left:u,right:d,width:d-u,height:l-c,x:u,y:c};return{...f,toJSON:()=>f}}function gr(e,t,n){let{selection:r}=t,i=null;if(xt(r)&&(i=r.$cursor),i){let t=e.storedMarks??i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}let{ranges:a}=r;return a.some(({$from:t,$to:r})=>{let i=t.depth===0&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(i)return!1;if(e.isInline){let t=!r||r.type.allowsMarkType(n),a=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));i=t&&a}return!i}),i})}var _r=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=n,{empty:o,ranges:s}=a,c=P(e,r.schema);if(i){if(o){let e=pn(r,c);n.addStoredMark(c.create({...e,...t}))}else s.forEach(e=>{let i=e.$from.pos,a=e.$to.pos;r.doc.nodesBetween(i,a,(e,r)=>{let o=Math.max(r,i),s=Math.min(r+e.nodeSize,a);e.marks.find(e=>e.type===c)?e.marks.forEach(e=>{c===e.type&&n.addMark(o,s,c.create({...e.attrs,...t}))}):n.addMark(o,s,c.create(t))})})}return gr(r,n,c)},vr=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),yr=(e,t={})=>({state:n,dispatch:r,chain:i})=>{let a=N(e,n.schema),o;return n.selection.$anchor.sameParent(n.selection.$head)&&(o=n.selection.$anchor.parent.attrs),a.isTextblock?i().command(({commands:e})=>l(a,{...o,...t})(n)?!0:e.clearNodes()).command(({state:e})=>l(a,{...o,...t})(e,r)).run():(console.warn(`[tiptap warn]: Currently "setNode()" only supports text block nodes.`),!1)},br=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,r=F(e,0,n.content.size),i=k.create(n,r);t.setSelection(i)}return!0},xr=(e,t)=>({tr:n,state:r,dispatch:i})=>{let{selection:a}=r,o,s;return typeof t==`number`?(o=t,s=t):t&&`from`in t&&`to`in t?(o=t.from,s=t.to):(o=a.from,s=a.to),i&&n.doc.nodesBetween(o,s,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},Sr=e=>({tr:t,dispatch:n})=>{if(n){let{doc:n}=t,{from:r,to:i}=typeof e==`number`?{from:e,to:e}:e,a=T.atStart(n).from,o=T.atEnd(n).to,s=F(r,a,o),c=F(i,a,o),l=T.create(n,s,c);t.setSelection(l)}return!0},Cr=e=>({state:t,dispatch:n})=>Ze(N(e,t.schema))(t,n);function wr(e,t){let n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){let r=n.filter(e=>t?.includes(e.type.name));e.tr.ensureMarks(r)}}var Tr=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:i})=>{let{selection:a,doc:o}=t,{$from:s,$to:c}=a,l=i.extensionManager.attributes,u=er(l,s.node().type.name,s.node().attrs);if(a instanceof k&&a.node.isBlock)return!s.parentOffset||!xe(o,s.pos)?!1:(r&&(e&&wr(n,i.extensionManager.splittableMarks),t.split(s.pos).scrollIntoView()),!0);if(!s.parent.isBlock)return!1;let d=c.parentOffset===c.parent.content.size,f=s.depth===0?void 0:Ft(s.node(-1).contentMatchAt(s.indexAfter(-1))),p=d&&f?[{type:f,attrs:u}]:void 0,m=a instanceof T&&!a.empty?fe.create({doc:t.doc,selection:a}).tr.deleteSelection():null,h=m?m.doc:t.doc,g=m?m.mapping.map(s.pos):s.pos,_=xe(h,g,1,p);if(!p&&!_&&xe(h,g,1,f?[{type:f}]:void 0)&&(_=!0,p=f?[{type:f,attrs:u}]:void 0),r){if(_){let e=t.steps.length;if(a instanceof T&&t.deleteSelection(),t.split(t.mapping.slice(e).map(s.pos),1,p),f&&!d&&!s.parentOffset&&s.parent.type!==f){let n=t.mapping.slice(e).map(s.before()),r=t.doc.resolve(n);s.node(-1).canReplaceWith(r.index(),r.index()+1,f)&&t.setNodeMarkup(t.mapping.slice(e).map(s.before()),f)}}e&&wr(n,i.extensionManager.splittableMarks),t.scrollIntoView()}return _},Er=(e,t={})=>({tr:n,state:r,dispatch:i,editor:a})=>{let o=N(e,r.schema),{$from:s,$to:c}=r.selection,l=r.selection.node;if(l&&l.isBlock||s.depth<2||!s.sameParent(c))return!1;let u=s.node(-1);if(u.type!==o)return!1;let d=a.extensionManager.attributes;if(s.parent.content.size===0&&s.node(-1).childCount===s.indexAfter(-1)){if(s.depth===2||s.node(-3).type!==o||s.index(-2)!==s.node(-2).childCount-1)return!1;if(i){let e=C.empty,r=s.index(-1)?1:s.index(-2)?2:3;for(let t=s.depth-r;t>=s.depth-3;--t)e=C.from(s.node(t).copy(e));let i=s.indexAfter(-1)<s.node(-2).childCount?1:s.indexAfter(-2)<s.node(-3).childCount?2:3,a={...er(d,s.node().type.name,s.node().attrs),...t},c=o.contentMatch.defaultType?.createAndFill(a)||void 0;e=e.append(C.from(o.createAndFill(null,c)||void 0));let l=s.before(s.depth-(r-1));n.replace(l,s.after(-i),new E(e,4-r,0));let u=-1;n.doc.nodesBetween(l,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&e.content.size===0&&(u=t+1)}),u>-1&&n.setSelection(T.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}let f=c.pos===s.end()?u.contentMatchAt(0).defaultType:null,p={...er(d,u.type.name,u.attrs),...t},m={...er(d,s.node().type.name,s.node().attrs),...t},h=s.parentOffset===0&&s.index(-1)===0,g=s.before(-1);n.delete(s.pos,c.pos);let _=h?u.attrs:p,v=f?[{type:o,attrs:_},{type:f,attrs:m}]:[{type:o,attrs:_}];if(!xe(n.doc,s.pos,2))return!1;if(i){let{selection:e,storedMarks:t}=r,{splittableMarks:o}=a.extensionManager,c=t||e.$to.parentOffset&&e.$from.marks();if(n.split(s.pos,2,v).scrollIntoView(),h&&n.setNodeMarkup(g,void 0,p),!c||!i)return!0;let l=c.filter(e=>o.includes(e.type.name));n.ensureMarks(l)}return!0};function Dr(e,t,n){if(!e.validContent(t))return null;try{return e.create(n,t)}catch{return null}}function Or(e,t){if(e.pendingContent.length===0)return!0;let n=Dr(t,C.from(e.pendingContent));return n?(e.items.push(n),e.pendingContent=[],!0):!1}function kr(e,t,n){return n.validContent(C.from([...t.pendingContent,e]))?(t.pendingContent.push(e),!0):!Or(t,n)||!n.validContent(C.from(e))?!1:(t.pendingContent.push(e),!0)}function Ar(e,t,n,r){let i=r(e,n);if(!i)return!1;let a=Dr(n.listType,C.from(i),e.attrs);return a?n.itemType.validContent(C.from([...t.pendingContent,a]))?(t.pendingContent.push(a),!0):Or(t,n.itemType)?(t.items.push(...i),!0):!1:!1}function jr(e,t,n){let r={items:[],pendingContent:[]};for(let i=0;i<e.childCount;i+=1){let a=e.child(i);if(!(t.isListNode(a)?Ar(a,r,t,n):kr(a,r,t.itemType)))return null}return Or(r,t.itemType)?r.items:null}function Mr(e,t){let n=[];for(let r=0;r<e.childCount;r+=1){let i=jr(e.child(r),t,Mr);if(!i)return null;n.push(...i)}return n}function Nr(e,t){let n=null;return e.descendants((e,r)=>e!==t||(n=r,!1)),n}function Pr(e){return!e||e===`1`?null:e}function Fr(e,t){return Pr(e)===Pr(t)}var Ir=(e,t)=>{let n=_n(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&de(e.doc,n.pos))||!Fr(n.node.attrs.type,i?.attrs.type)||e.join(n.pos),!0},Lr=(e,t)=>{let n=_n(e=>e.type===t)(e.selection);if(!n)return!0;let r=e.doc.resolve(n.start).after(n.depth);if(r===void 0)return!0;let i=e.doc.nodeAt(r);return!(n.node.type===i?.type&&de(e.doc,r))||!Fr(n.node.attrs.type,i?.attrs.type)||e.join(r),!0};function Rr(e){let t=e.doc,n=t.firstChild;if(!n)return null;let r=t.resolve(1),i=t.resolve(n.nodeSize-1);return T.between(r,i)}var zr=(e,t,n,r={})=>({editor:i,tr:a,state:o,dispatch:s,chain:c,commands:l,can:u})=>{let{extensions:d,splittableMarks:f}=i.extensionManager,p=N(e,o.schema),m=N(t,o.schema),{selection:h,storedMarks:g}=o,{$from:_,$to:v}=h,y=_.blockRange(v),b=g||h.$to.parentOffset&&h.$from.marks();if(!y)return!1;let ee=_n(e=>sr(e.type.name,d))(h),te=h.from===0&&h.to===o.doc.content.size,ne=o.doc.content.content,re=ne.length===1?ne[0]:null,ie=te&&re&&sr(re.type.name,d)?{node:re,pos:0,depth:0}:null,x=ee??ie,ae=!!ee&&y.depth>=1&&y.depth-ee.depth<=1,S=!!ie;if((ae||S)&&x){if(x.node.type===p)return te&&S?c().command(({tr:e,dispatch:t})=>{let n=Rr(e);return n?(e.setSelection(n),t&&t(e),!0):!1}).liftListItem(m).run():l.liftListItem(m);if(sr(x.node.type.name,d)&&p.validContent(x.node.content))return c().command(()=>(a.setNodeMarkup(x.pos,p),!0)).command(()=>Ir(a,p)).command(()=>Lr(a,p)).run();if(sr(x.node.type.name,d)){let e=x.node.firstChild?.type;if(e&&e!==m){let e=Mr(x.node,{listType:p,itemType:m,isListNode:e=>sr(e.type.name,d)}),t=e?C.from(e):null;return!t||!p.validContent(t)?!1:c().command(()=>{let{$anchor:e,$head:n}=a.selection,i=e.parent,o=n.parent,s=e.parentOffset,c=n.parentOffset,l;try{l=p.create(r,t)}catch{return!1}if(a.replaceWith(x.pos,x.pos+x.node.nodeSize,l),i.inlineContent&&o.inlineContent){let e=Nr(l,i),t=Nr(l,o);if(e!==null&&t!==null){let n=x.pos+e+2+s,r=x.pos+t+2+c;a.setSelection(T.create(a.doc,n,r))}}return!0}).command(()=>Ir(a,p)).command(()=>Lr(a,p)).run()}}}return!n||!b||!s?c().command(()=>u().wrapInList(p,r)?!0:l.clearNodes()).wrapInList(p,r).command(()=>Ir(a,p)).command(()=>Lr(a,p)).run():c().command(()=>{let e=u().wrapInList(p,r),t=b.filter(e=>f.includes(e.type.name));return a.ensureMarks(t),e?!0:l.clearNodes()}).wrapInList(p,r).command(()=>Ir(a,p)).command(()=>Lr(a,p)).run()},Br=(e,t={},n={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:a=!1}=n,o=P(e,r.schema);return nr(r,o,t)?i.unsetMark(o,{extendEmptyMarkRange:a}):i.setMark(o,t)},Vr=(e,t,n={})=>({state:r,commands:i})=>{let a=N(e,r.schema),o=N(t,r.schema),s=Yt(r,a,n),c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),s?i.setNode(o,c):i.setNode(a,{...c,...n})},Hr=(e,t={})=>({state:n,commands:r})=>{let i=N(e,n.schema);return Yt(n,i,t)?r.lift(i):r.wrapIn(i,t)},Ur=()=>({state:e,dispatch:t})=>{let n=e.plugins;for(let r=0;r<n.length;r+=1){let i=n[r],a;if(i.spec.isInputRules&&(a=i.getState(e))){if(t){let t=e.tr,n=a.transform;for(let e=n.steps.length-1;e>=0;--e)t.step(n.steps[e].invert(n.docs[e]));if(a.text){let n=t.doc.resolve(a.from).marks();t.replaceWith(a.from,a.to,e.schema.text(a.text,n))}else t.delete(a.from,a.to)}return!0}}return!1},Wr=(e={})=>({tr:t,dispatch:n,editor:r})=>{let{ignoreClearable:i=!1}=e,{selection:a}=t,{empty:o,ranges:s}=a;if(o)return!0;let{nonClearableMarks:c}=r.extensionManager;if(n){let e=Object.values(r.schema.marks).filter(e=>i||!c.includes(e.name));s.forEach(n=>{for(let r of e)t.removeMark(n.$from.pos,n.$to.pos,r)})}return!0},Gr=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let{extendEmptyMarkRange:a=!1}=t,{selection:o}=n,s=P(e,r.schema),{$from:c,empty:l,ranges:u}=o;if(!i)return!0;if(l&&a){let{from:e,to:t}=o,r=vt(c,s,c.marks().find(e=>e.type===s)?.attrs);r&&(e=r.from,t=r.to),n.removeMark(e,t,s)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,s)});return n.removeStoredMark(s),!0},Kr=e=>({tr:t,state:n,dispatch:r})=>{let{selection:i}=n,a,o;return typeof e==`number`?(a=e,o=e):e&&`from`in e&&`to`in e?(a=e.from,o=e.to):(a=i.from,o=i.to),r&&t.doc.nodesBetween(a,o,(e,n)=>{if(e.isText)return;let r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},qr=(e,t={})=>({tr:n,state:r,dispatch:i})=>{let a=null,o=null,s=en(typeof e==`string`?e:e.name,r.schema);if(!s)return!1;s===`node`&&(a=N(e,r.schema)),s===`mark`&&(o=P(e,r.schema));let c=!1;return n.selection.ranges.forEach(e=>{let s=e.$from.pos,l=e.$to.pos,u,d,f,p;n.selection.empty?r.doc.nodesBetween(s,l,(e,t)=>{a&&a===e.type&&(c=!0,f=Math.max(t,s),p=Math.min(t+e.nodeSize,l),u=t,d=e)}):r.doc.nodesBetween(s,l,(e,r)=>{r<s&&a&&a===e.type&&(c=!0,f=Math.max(r,s),p=Math.min(r+e.nodeSize,l),u=r,d=e),r>=s&&r<=l&&(a&&a===e.type&&(c=!0,i&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),o&&e.marks.length&&e.marks.forEach(a=>{if(o===a.type&&(c=!0,i)){let i=Math.max(r,s),c=Math.min(r+e.nodeSize,l);n.addMark(i,c,o.create({...a.attrs,...t}))}}))}),d&&(u!==void 0&&i&&n.setNodeMarkup(u,void 0,{...d.attrs,...t}),o&&d.marks.length&&d.marks.forEach(e=>{o===e.type&&i&&n.addMark(f,p,o.create({...e.attrs,...t}))}))}),c},H=new w(`__tiptap_decorations__`),Jr=e=>({tr:t,dispatch:n})=>(n&&t.setMeta(H,{type:`force`,name:e}),!0),Yr=(e,t={})=>({state:n,dispatch:r})=>{let i=N(e,n.schema);return s(i,t)(n,r)},Xr=(e,t={})=>({state:n,dispatch:r})=>Ge(N(e,n.schema),t)(n,r),Zr=We({blur:()=>$e,clearContent:()=>et,clearNodes:()=>tt,command:()=>nt,createParagraphNear:()=>rt,cut:()=>it,deleteCurrentNode:()=>at,deleteNode:()=>ot,deleteRange:()=>st,deleteSelection:()=>dt,enter:()=>ft,exitCode:()=>pt,extendMarkRange:()=>yt,first:()=>bt,focus:()=>Tt,forEach:()=>Et,insertContent:()=>Dt,insertContentAt:()=>Pt,insertDefaultBlock:()=>It,joinBackward:()=>zt,joinDown:()=>Rt,joinForward:()=>Bt,joinItemBackward:()=>Ht,joinItemForward:()=>Ut,joinTextblockBackward:()=>Wt,joinTextblockForward:()=>Gt,joinUp:()=>Lt,keyboardShortcut:()=>Jt,lift:()=>Xt,liftEmptyBlock:()=>Zt,liftListItem:()=>Qt,newlineInCode:()=>$t,resetAttributes:()=>nn,scrollIntoView:()=>rn,selectAll:()=>an,selectNodeBackward:()=>on,selectNodeForward:()=>sn,selectParentNode:()=>cn,selectTextblockEnd:()=>ln,selectTextblockStart:()=>un,setContent:()=>fn,setMark:()=>_r,setMeta:()=>vr,setNode:()=>yr,setNodeSelection:()=>br,setTextDirection:()=>xr,setTextSelection:()=>Sr,sinkListItem:()=>Cr,splitBlock:()=>Tr,splitListItem:()=>Er,toggleList:()=>zr,toggleMark:()=>Br,toggleNode:()=>Vr,toggleWrap:()=>Hr,undoInputRule:()=>Ur,unsetAllMarks:()=>Wr,unsetMark:()=>Gr,unsetTextDirection:()=>Kr,updateAttributes:()=>qr,updateDecorations:()=>Jr,wrapIn:()=>Yr,wrapInList:()=>Xr}),U=new WeakMap;function Qr(e,t){U.set(e,(U.get(e)??0)+1);try{return t()}finally{let t=(U.get(e)??1)-1;t>0?U.set(e,t):U.delete(e)}}function $r(e){return U.has(e)}var ei=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){let n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){let n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},ti=typeof process<`u`&&!1;function ni(e){return e.kind===`widget`}function ri(e,t){let n=[],r=new Set;for(let i of e)i.kind===`widget`&&ni(i)&&r.add(i.key),n.push(i.toPMDecoration(t));return{decorations:n,widgetKeys:r}}function ii(e,t,n){let{decorations:r,widgetKeys:i}=ri(t,n);return{set:O.create(e,r),widgetKeys:i}}function ai({position:e,from:t,to:n,docSize:r}){return e<t?!1:e<n||e===n&&n===r}function oi({decorations:e,from:t,to:n,docSize:r,extensionName:i,warnedExtensions:a}){return e.filter(e=>ai({position:e.anchor,from:t,to:n,docSize:r})?!0:(e.anchor===n||a.has(i)||(a.add(i),console.warn(`[tiptap warn]: Extension "${i}" returned a decoration outside the requested range [${t}, ${n}). It was ignored.`)),!1))}function si(e){let t=e.spec?.key;return typeof t==`string`?t:void 0}function ci(e){let t=new Map,n=new Map;for(let r of e.find()){let e=si(r);if(!e)continue;let i=r.spec.extensionName??`unknown`,a=t.get(e)??new Set;a.add(i),t.set(e,a),n.set(e,(n.get(e)??0)+1)}return Array.from(t,([e,t])=>({key:e,extensions:t})).filter(({key:e})=>(n.get(e)??0)>1)}function li(e){return e.jsonID===`attr`}function ui(e){let t=!1;if(e.getMap().forEach(()=>{t=!0}),t||li(e))return!0;let n=e;return typeof n.from==`number`&&typeof n.to==`number`}function di(e,t){let n=null,r=0,i=0;for(let a=0;a<e.childCount&&!(i>t.to);a+=1){let o=i+e.child(a).nodeSize;o>=t.from&&(n===null&&(n=i),r=o),i=o}return n===null?null:{from:n,to:r}}function fi(e,t){if(e.steps.some(e=>!ui(e)))return{type:`full`};let n=Xn(e).map(({newRange:e})=>e);e.steps.forEach((t,r)=>{if(!li(t))return;let i=e.mapping.slice(r);n.push({from:i.map(t.pos,-1),to:i.map(t.pos+1)})});let r=[];for(let e of n){let n=di(t,e);n&&r.push(n)}r.sort((e,t)=>e.from-t.from);let i=[];for(let e of r){let t=i[i.length-1];t&&e.from<=t.to?t.to=Math.max(t.to,e.to):i.push({...e})}return{type:`ranges`,ranges:i}}function pi(e,t,n,r){return e.map(t,n,{onRemove:e=>{let t=e?.key;typeof t==`string`&&r.delete(t)}})}function mi(e,t,n){let r=t.decorationSetsByExtension[e]??O.empty,i=new Set(t.widgetKeysByExtension[e]??[]);return{set:pi(r,n.mapping,n.doc,i),widgetKeys:i}}function hi(e,t){let n=Object.values(t).flatMap(e=>e.find());return O.create(e,n)}function gi(e){let t=new Set;for(let n of Object.values(e))for(let e of n)t.add(e);return t}function _i(e,t){switch(t.update??`document`){case`document`:if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" provides createInRange() but does not use the "changedRanges" decoration update strategy.`);return;case`changedRanges`:if(!t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "changedRanges" decoration update strategy but does not provide createInRange().`);return;case`manual`:if(t.createInRange)throw Error(`[tiptap error]: Extension "${e}" uses the "manual" decoration update strategy, which is not compatible with createInRange(). createInRange() requires the "changedRanges" strategy.`);if(t.shouldUpdate)throw Error(`[tiptap error]: Extension "${e}" cannot combine the "manual" decoration update strategy with shouldUpdate().`);return;default:throw Error(`[tiptap error]: Extension "${e}" uses an unknown decoration update strategy. Expected "document", "changedRanges", or "manual".`)}}function vi(e,t,n){return n?!0:e.update===`manual`?!1:e.shouldUpdate?e.shouldUpdate(t):t.tr.docChanged}var yi=new Set,bi=class{constructor(e){this.warnedWidgetKeys=new Set,this.warnedOutOfRangeExtensions=new Set,this.handleBeforeTransaction=({nextState:e})=>{let t=H.getState(e);t&&this.warnDuplicateWidgetKeys(t)},this.editor=e.editor,this.entries=this.resolveEntries(e.entries),this.entries.forEach(({name:e,spec:t})=>_i(e,t)),this.plugin=this.entries.length>0?this.createPlugin():null,this.editor.on(`beforeTransaction`,this.handleBeforeTransaction)}destroy(){this.editor.off(`beforeTransaction`,this.handleBeforeTransaction)}liveWidgetKeys(){return H.getState(this.editor.state)?.widgetKeys??yi}get mountedView(){return this.editor.isDestroyed?null:this.editor.view}resolveEntries(e){let t=[];for(let{name:n,addDecorations:r}of e){let e=r();e&&t.push({name:n,spec:e})}return t}createPlugin(){let{editor:e,entries:t}=this;return new A({key:H,state:{init:(e,n)=>{let r={},i={};for(let{name:e,spec:a}of t){let{set:t,widgetKeys:o}=this.buildFullSet(e,a,n);r[e]=t,i[e]=o}let a={decorationSetsByExtension:r,widgetKeysByExtension:i,mergedDecorationSet:this.buildMergedSet(n.doc,r),widgetKeys:gi(i)};return this.warnDuplicateWidgetKeys(a),a},apply:(n,r,i,a)=>{let o=n.getMeta(H),s=o?.type===`force`&&!o.name,c=o?.type===`force`?o.name:void 0,l={},u={},d=new Set;return Qr(e,()=>{for(let{name:o,spec:f}of t){let t=s||c===o;if(!vi(f,{editor:e,tr:n,oldState:i,newState:a},t)){let e=mi(o,r,n);l[o]=e.set,u[o]=e.widgetKeys}else if(f.update===`changedRanges`&&n.docChanged&&!t){let e=this.applyChangedRangesRecompute(o,f,r,n,a);l[o]=e.set,u[o]=e.widgetKeys,d.add(o)}else{let{set:e,widgetKeys:t}=this.buildFullSet(o,f,a);l[o]=e,u[o]=t,d.add(o)}}}),d.size===0&&!n.docChanged?r:{decorationSetsByExtension:l,widgetKeysByExtension:u,mergedDecorationSet:this.mergeAfterApply({entries:t,previous:r,tr:n,decorationSetsByExtension:l,recomputedNames:d}),widgetKeys:gi(u)}}},props:{decorations(e){return H.getState(e)?.mergedDecorationSet??O.empty}}})}applyChangedRangesRecompute(e,t,n,r,i){let a=fi(r,i.doc);return a.type===`full`?this.buildFullSet(e,t,i):this.rebuildRanges(e,t,n,r,i,a.ranges)}rebuildRanges(e,t,n,r,i,a){let o=n.decorationSetsByExtension[e]??O.empty,s=new Set(n.widgetKeysByExtension[e]??[]),c=pi(o,r.mapping,r.doc,s),l=i.doc.content.size;for(let{from:n,to:r}of a){let a=c.find(n,r).filter(e=>ai({position:e.from,from:n,to:r,docSize:l}));for(let e of a){let t=si(e);t&&s.delete(t)}c=c.remove(a);let{decorations:o,widgetKeys:u}=ri(oi({decorations:this.runCreate(e,`createInRange`,()=>t.createInRange({editor:this.editor,state:i,view:this.mountedView,from:n,to:r})),from:n,to:r,docSize:l,extensionName:e,warnedExtensions:this.warnedOutOfRangeExtensions}),e);c=c.add(i.doc,o);for(let e of u)s.add(e)}return{set:c,widgetKeys:s}}buildFullSet(e,t,n){let r=this.runCreate(e,`create`,()=>t.create({editor:this.editor,state:n,view:this.mountedView}));return ii(n.doc,r,e)}runCreate(e,t,n){try{return n()}catch(n){return console.error(`[tiptap error]: Extension "${e}" threw in \`addDecorations().${t}()\`. Its decorations were dropped for this update.`,n),[]}}warnDuplicateWidgetKeys(e){if(!ti)return;if(e.widgetKeys.size===0){this.warnedWidgetKeys.clear();return}let t=ci(e.mergedDecorationSet),n=new Set(t.map(({key:e})=>e));for(let{key:e,extensions:n}of t){if(this.warnedWidgetKeys.has(e))continue;let t=Array.from(n).map(e=>`"${e}"`).join(`, `);console.warn(`[tiptap warn]: Duplicate widget decoration key "${e}" in extension${n.size===1?``:`s`} ${t}. Widget decoration keys must be globally unique, otherwise ProseMirror misplaces the widget DOM. Use a stable, unique key (e.g. \`comment-\${id}\`).`)}this.warnedWidgetKeys=n}buildMergedSet(e,t){let n=Object.keys(t);return n.length===1?t[n[0]]:hi(e,t)}mergeAfterApply({entries:e,previous:t,tr:n,decorationSetsByExtension:r,recomputedNames:i}){return e.length===1?r[e[0].name]:i.size===0?t.mergedDecorationSet.map(n.mapping,n.doc):hi(n.doc,r)}};function xi(e,t){let{selection:n}=e,{$from:r}=n;if(n instanceof k){let e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let i=r.depth;for(;i>=0;){let e=r.index(i);if(r.node(i).contentMatchAt(e).matchType(t))return!0;--i}return!1}function Si(e,t,n){let r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:``}]`);if(r!==null)return r;let i=document.createElement(`style`);return t&&i.setAttribute(`nonce`,t),i.setAttribute(`data-tiptap-style${n?`-${n}`:``}`,``),i.innerHTML=e,document.getElementsByTagName(`head`)[0].appendChild(i),i}function Ci(e){return typeof e==`number`}function wi(e){return Object.prototype.toString.call(e).slice(8,-1)}function Ti(e){return wi(e)===`Object`&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Ei(e,t,n){let r=e.split(`
|
|
6
|
+
`),i=[],a=``,o=0,s=t.baseIndentSize||2;for(;o<r.length;){let e=r[o],u=e.match(t.itemPattern);if(!u){if(i.length>0)break;if(e.trim()===``){o+=1,a=`${a}${e}\n`;continue}return}let d=t.extractItemData(u),{indentLevel:f,mainContent:p}=d;a=`${a}${e}\n`;let m=[p];for(o+=1;o<r.length;){var c;let e=r[o];if(e.trim()===``){var l;let t=r.slice(o+1).findIndex(e=>e.trim()!==``);if(t===-1)break;if((((l=r[o+1+t].match(/^(\s*)/))==null||(l=l[1])==null?void 0:l.length)||0)>f){m.push(e),a=`${a}${e}\n`,o+=1;continue}break}if((((c=e.match(/^(\s*)/))==null||(c=c[1])==null?void 0:c.length)||0)>f)m.push(e),a=`${a}${e}\n`,o+=1;else break}let h,g=m.slice(1);if(g.length>0){let e=g.map(e=>e.slice(f+s)).join(`
|
|
7
|
+
`);e.trim()&&(h=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}let _=t.createToken(d,h);i.push(_)}if(i.length!==0)return{items:i,raw:a}}var Di=4;function Oi(e){let t=0;for(let n of e)t=n===` `?t+Di-t%Di:t+1;return t}function ki(e,t,n,r,i){if(!e||!Array.isArray(e.content))return``;let a=typeof n==`function`?n(r):n,[o,...s]=e.content,c=`${a}${t.renderChildren([o])}`;return s&&s.length>0&&s.forEach((e,n)=>{let r=t.renderChild?.call(t,e,n+1)??t.renderChildren([e]);if(r!=null){let n=e=>{if(!i?.alignNestedToPrefix)return t.indent(e);let n=t.indent(``),r=Oi(a);return(Oi(n)>=r?n:` `.repeat(r))+e},o=r.split(`
|
|
8
|
+
`).map(e=>n(e||``)).join(`
|
|
9
|
+
`);c+=e.type===`paragraph`?`\n\n${o}`:`\n${o}`}}),c}function Ai(e,t){let n={...e};return Ti(e)&&Ti(t)&&Object.keys(t).forEach(r=>{Ti(t[r])&&Ti(e[r])?n[r]=Ai(e[r],t[r]):n[r]=t[r]}),n}function ji(e,t,n={}){let{state:r}=t,{doc:i,tr:a}=r,o=e;i.descendants((t,r)=>{let i=a.mapping.map(r),s=a.mapping.map(r)+t.nodeSize,c=null;if(t.marks.forEach(e=>{if(e!==o)return!1;c=e}),!c)return;let l=!1;if(Object.keys(n).forEach(e=>{n[e]!==c.attrs[e]&&(l=!0)}),l){let t=e.type.create({...e.attrs,...n});a.removeMark(i,s,e.type),a.addMark(i,s,t)}}),a.docChanged&&t.view.dispatch(a)}var Mi=class{constructor(e,t,n){this.component=e,this.editor=t.editor,this.options={...n},this.mark=t.mark,this.HTMLAttributes=t.HTMLAttributes}get dom(){return this.editor.view.dom}get contentDOM(){return null}updateAttributes(e,t){ji(t||this.mark,this.editor,e)}ignoreMutation(e){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation==`function`?this.options.ignoreMutation({mutation:e}):e.type===`selection`||this.contentDOM.contains(e.target)&&e.type===`childList`&&(I()||Ct())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===e.target&&e.type===`attributes`||!this.contentDOM.contains(e.target)}},Ni=class{constructor(e){this.find=e.find,this.handler=e.handler,this.undoable=e.undoable??!0}},Pi=(e,t)=>{if(mt(t))return t.exec(e);let n=t(e);if(!n)return null;let r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn(`[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".`),r.push(n.replaceWith)),r};function Fi(e){let{editor:t,from:n,to:r,text:i,insertText:a}=e;if(!a)return{inputTransaction:null,tr:t.view.state.tr};let o=t.view.state.tr.insertText(i,n,r);return{inputTransaction:o,tr:fe.create({doc:o.doc,selection:o.selection,storedMarks:o.storedMarks}).tr}}function Ii(e){let{editor:t,from:n,to:r,text:i,rule:a,match:o,plugin:s,insertText:c}=e,{view:l}=t,{inputTransaction:u,tr:d}=Fi({editor:t,from:n,to:r,text:i,insertText:c}),f=u?n+i.length:r,p=Qe({state:l.state,transaction:d}),m={from:n-(o[0].length-i.length),to:f},{commands:h,chain:g,can:_}=new M({editor:t,state:p});return a.handler({state:p,range:m,match:o,commands:h,chain:g,can:_})===null||!d.steps.length?!1:(u&&(l.dispatch(u),!l.state.doc.eq(u.doc))||(ee(d),d.setMeta(`inputRule`,!0),a.undoable&&d.setMeta(s,{transform:d,from:n,to:f,text:i}),l.dispatch(d)),!0)}function Li(e,t,n){let r=t[0].length-n.length;if(r<=0)return!0;let i=e.parentOffset-r;return i>=0&&e.parent.textBetween(i,e.parentOffset)===t[0].slice(0,r)}function Ri(e){let{editor:t,from:n,to:r,text:i,rules:a,plugin:o,insertText:s}=e,{view:c}=t;if(c.composing)return!1;let l=c.state.doc.resolve(n);if(l.parent.type.spec.code||(l.nodeBefore||l.nodeAfter)?.marks.find(e=>e.type.spec.code))return!1;let u=tr(l)+i;for(let e of a){let a=Pi(u,e.find);if(a&&Li(l,a,i)&&Ii({editor:t,from:n,to:r,text:i,rule:e,match:a,plugin:o,insertText:s}))return!0}return!1}function zi(e){let{editor:t,rules:n}=e,r=new A({state:{init(){return null},apply(e,i,a){let o=e.getMeta(r);if(o)return o;let s=e.getMeta(`applyInputRules`);return s&&setTimeout(()=>{let{text:e}=s;e=typeof e==`string`?e:yn(C.from(e),a.schema);let{from:i}=s,o=i+e.length;Ri({editor:t,from:i,to:o,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:i}},props:{handleTextInput(e,i,a,o){return Ri({editor:t,from:i,to:a,text:o,rules:n,plugin:r,insertText:!0})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{let{$cursor:i}=e.state.selection;i&&Ri({editor:t,from:i.pos,to:i.pos,text:``,rules:n,plugin:r})}),!1)},handleKeyDown(e,i){if(i.key!==`Enter`)return!1;let{$cursor:a}=e.state.selection;return a?Ri({editor:t,from:a.pos,to:a.pos,text:`
|
|
10
|
+
`,rules:n,plugin:r}):!1}},isInputRules:!0});return r}var Bi=class{constructor(e={}){this.type=`extendable`,this.parent=null,this.child=null,this.name=``,this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...R(L(this,`addOptions`,{name:this.name}))}}get storage(){return{...R(L(this,`addStorage`,{name:this.name,options:this.options}))}}configure(e={}){let t=this.extend({...this.config,addOptions:()=>Ai(this.options,e)});return t.name=this.name,t.parent=this.parent,this.child=null,t}extend(e={}){let t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name=`name`in e?e.name:t.parent.name,t}},W=class e extends Bi{constructor(...e){super(...e),this.type=`mark`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}static handleExit({editor:e,mark:t}){let{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){let i=r.marks();if(!i.find(e=>e?.type.name===t.name))return!1;let a=i.find(e=>e?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(` `,r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},Vi=class{constructor(e){this.find=e.find,this.handler=e.handler}},Hi=(e,t,n)=>{if(mt(t))return[...e.matchAll(t)];let r=t(e,n);return r?r.map(t=>{let n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn(`[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".`),n.push(t.replaceWith)),n}):[]};function Ui(e){let{editor:t,state:n,from:r,to:i,rule:a,pasteEvent:o,dropEvent:s}=e,{commands:c,chain:l,can:u}=new M({editor:t,state:n}),d=[];return n.doc.nodesBetween(r,i,(e,t)=>{var f;if((f=e.type)!=null&&(f=f.spec)!=null&&f.code||!(e.isText||e.isTextblock||e.isInline))return;let p=e.content?.size??e.nodeSize??0,m=Math.max(r,t),h=Math.min(i,t+p);m>=h||Hi(e.isText?e.text||``:e.textBetween(m-t,h-t,void 0,``),a.find,o).forEach(e=>{if(e.index===void 0)return;let t=m+e.index+1,r=t+e[0].length,i={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},f=a.handler({state:n,range:i,match:e,commands:c,chain:l,can:u,pasteEvent:o,dropEvent:s});d.push(f)})}),d.every(e=>e!==null)}var Wi=null,Gi=e=>{var t;let n=new ClipboardEvent(`paste`,{clipboardData:new DataTransfer});return(t=n.clipboardData)==null||t.setData(`text/html`,e),n};function Ki(e){let{editor:t,rules:n}=e,r=null,i=!1,a=!1,o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,s;try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}let c=({state:e,from:n,to:r,rule:i,pasteEvt:a})=>{let c=e.tr,l=Qe({state:e,transaction:c});if(Ui({editor:t,state:l,from:Math.max(n-1,0),to:r.b-1,rule:i,pasteEvent:a,dropEvent:s})&&c.steps.length){try{s=typeof DragEvent<`u`?new DragEvent(`drop`):null}catch{s=null}return o=typeof ClipboardEvent<`u`?new ClipboardEvent(`paste`):null,c}};return t.on(`destroy`,()=>{Wi===t&&(Wi=null)}),n.map(e=>new A({view(e){let n=n=>{r=e.dom.parentElement?.contains(n.target)?e.dom.parentElement:null,r&&(Wi=t)},i=()=>{Wi&&=null};return window.addEventListener(`dragstart`,n),window.addEventListener(`dragend`,i),{destroy(){window.removeEventListener(`dragstart`,n),window.removeEventListener(`dragend`,i)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(a=r===e.dom.parentElement,s=t,!a){let e=Wi;e?.isEditable&&setTimeout(()=>{if(e.isDestroyed)return;let t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{let n=t.clipboardData?.getData(`text/html`);return o=t,i=!!n?.includes(`data-pm-slice`),!1}}},appendTransaction:(t,n,r)=>{let s=t[0],l=s.getMeta(`uiEvent`)===`paste`&&!i,u=s.getMeta(`uiEvent`)===`drop`&&!a,d=s.getMeta(`applyPasteRules`),f=!!d;if(!l&&!u&&!f)return;if(f){let{text:t}=d;t=typeof t==`string`?t:yn(C.from(t),r.schema);let{from:n}=d,i=n+t.length,a=Gi(t);return c({rule:e,state:r,from:n,to:{b:i},pasteEvt:a})}let p=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);if(Ci(p)&&m&&p!==m.b)return c({rule:e,state:r,from:p,to:m,pasteEvt:o})}}))}var qi=class{constructor(e,t){this.splittableMarks=[],this.nonClearableMarks=[],this.decorationManager=null,this.editor=t,this.baseExtensions=e,this.extensions=Vn(e),this.hasSchemaSpec=t.options.schemaSpec!==void 0,this.schema=zn(this.extensions,t,t.options.schemaSpec),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{let n=L(t,`addCommands`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:V(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){let{editor:e}=this,t=Bn([...this.extensions].reverse()).flatMap(t=>{let n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:V(t.name,this.schema)},r=[],i=L(t,`addKeyboardShortcuts`,n),a={};if(t.type===`mark`&&L(t,`exitable`,n)&&(a.ArrowRight=()=>W.handleExit({editor:e,mark:t})),i){let t=Object.fromEntries(Object.entries(i()).map(([t,n])=>[t,()=>n({editor:e})]));a={...a,...t}}let o=b(a);r.push(o);let s=L(t,`addInputRules`,n);if(or(t,e.options.enableInputRules)&&s){let t=s();if(t&&t.length){let n=zi({editor:e,rules:t}),i=Array.isArray(n)?n:[n];r.push(...i)}}let c=L(t,`addPasteRules`,n);if(or(t,e.options.enablePasteRules)&&c){let t=c();if(t&&t.length){let n=Ki({editor:e,rules:t});r.push(...n)}}let l=L(t,`addProseMirrorPlugins`,n);if(l){let e=l();r.push(...e)}return r}),n=this.createDecorationPlugin();return n&&t.push(n),t}createDecorationPlugin(){var e;let{editor:t}=this;(e=this.decorationManager)==null||e.destroy();let n=[];return this.extensions.forEach(e=>{let r=L(e,`addDecorations`,{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:V(e.name,this.schema)});r&&n.push({name:e.name,addDecorations:r})}),this.decorationManager=new bi({editor:t,entries:n}),this.decorationManager.plugin}get attributes(){let e=kn(this.extensions);return this.hasSchemaSpec?bn(e,this.schema):e}get nodeViews(){let{editor:e}=this,{nodeExtensions:t}=On(this.extensions);return Object.fromEntries(t.filter(e=>!!L(e,`addNodeView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=L(t,`addNodeView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:N(t.name,this.schema)});if(!r)return[];let i=r();return i?[t.name,(r,a,o,s,c)=>{let l=B(r,n);return i({node:r,view:a,getPos:o,decorations:s,innerDecorations:c,editor:e,extension:t,HTMLAttributes:l})}]:[]}))}dispatchTransaction(e){let{editor:t}=this;return Bn([...this.extensions].reverse()).reduceRight((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:V(n.name,this.schema)},i=L(n,`dispatchTransaction`,r);return i?t=>{i.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){let{editor:t}=this;return Bn([...this.extensions]).reduce((e,n)=>{let r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:V(n.name,this.schema)},i=L(n,`transformPastedHTML`,r);return i?(t,n)=>{let a=e(t,n);return i.call(r,a)}:e},e||(e=>e))}get markViews(){let{editor:e}=this,{markExtensions:t}=On(this.extensions);return Object.fromEntries(t.filter(e=>!!L(e,`addMarkView`)).map(t=>{let n=this.attributes.filter(e=>e.type===t.name),r=L(t,`addMarkView`,{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:P(t.name,this.schema)});return r?[t.name,(i,a,o)=>{let s=B(i,n);return r()({mark:i,view:a,inline:o,editor:e,extension:t,HTMLAttributes:s,updateAttributes:t=>{ji(i,e,t)}})}]:[]}))}destroy(){var e;(e=this.decorationManager)==null||e.destroy(),this.extensions.forEach(e=>{let t=e;for(;t.parent;){let e=t.parent;e.child===t&&(e.child=null),t=e}}),this.extensions=[],this.baseExtensions=[],this.decorationManager=null,this.schema=null,this.editor=null}setupExtensions(){let e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{let t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:V(e.name,this.schema)};e.type===`mark`&&((R(L(e,`keepOnSplit`,t))??!0)&&this.splittableMarks.push(e.name),(R(L(e,`clearable`,t))??!0)||this.nonClearableMarks.push(e.name));let n=L(e,`onBeforeCreate`,t),r=L(e,`onCreate`,t),i=L(e,`onUpdate`,t),a=L(e,`onSelectionUpdate`,t),o=L(e,`onTransaction`,t),s=L(e,`onFocus`,t),c=L(e,`onBlur`,t),l=L(e,`onDestroy`,t);n&&this.editor.on(`beforeCreate`,n),r&&this.editor.on(`create`,r),i&&this.editor.on(`update`,i),a&&this.editor.on(`selectionUpdate`,a),o&&this.editor.on(`transaction`,o),s&&this.editor.on(`focus`,s),c&&this.editor.on(`blur`,c),l&&this.editor.on(`destroy`,l)})}};qi.resolve=Vn,qi.sort=Bn,qi.flatten=vn;var G=class e extends Bi{constructor(...e){super(...e),this.type=`extension`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},Ji=G.create({name:`clipboardTextSerializer`,addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new A({key:new w(`clipboardTextSerializer`),props:{clipboardTextSerializer:()=>{let{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:i}=t,a=Gn(n),{blockSeparator:o}=this.options,s={...o===void 0?{}:{blockSeparator:o},textSerializers:a};return[...i.ranges].sort((e,t)=>e.$from.pos-t.$from.pos).map(({$from:e,$to:t})=>Un(r,{from:e.pos,to:t.pos},s)).join(o??`
|
|
11
|
+
|
|
12
|
+
`)}}})]}}),Yi=G.create({name:`commands`,addCommands(){return{...Zr}}}),Xi=G.create({name:`delete`,onUpdate({transaction:e,appendedTransactions:t}){var n;let r=()=>{var n,r;if(((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null||(r=n.filterTransaction)==null?void 0:r.call(n,e))??e.getMeta(`y-sync$`))return;let i=mn(e.before,[e,...t]);Xn(i).forEach(t=>{i.mapping.mapResult(t.oldRange.from).deletedAfter&&i.mapping.mapResult(t.oldRange.to).deletedBefore&&i.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{let a=r+n.nodeSize-2,o=t.oldRange.from<=r&&a<=t.oldRange.to;this.editor.emit(`delete`,{type:`node`,node:n,from:r,to:a,newFrom:i.mapping.map(r),newTo:i.mapping.map(a),deletedRange:t.oldRange,newRange:t.newRange,partial:!o,editor:this.editor,transaction:e,combinedTransform:i})})});let a=i.mapping;i.steps.forEach((t,n)=>{if(t instanceof ve){let r=a.slice(n).map(t.from,-1),o=a.slice(n).map(t.to),s=a.invert().map(r,-1),c=a.invert().map(o),l=r>0&&i.doc.nodeAt(r-1)?.marks.some(e=>e.eq(t.mark)),u=i.doc.nodeAt(o)?.marks.some(e=>e.eq(t.mark));this.editor.emit(`delete`,{type:`mark`,mark:t.mark,from:t.from,to:t.to,deletedRange:{from:s,to:c},newRange:{from:r,to:o},partial:!!(u||l),editor:this.editor,transaction:e,combinedTransform:i})}})};((n=this.editor.options.coreExtensionOptions)==null||(n=n.delete)==null?void 0:n.async)??!0?setTimeout(r,0):r()}}),Zi=G.create({name:`drop`,addProseMirrorPlugins(){return[new A({key:new w(`tiptapDrop`),props:{handleDrop:(e,t,n,r)=>{this.editor.emit(`drop`,{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Qi=G.create({name:`editable`,addProseMirrorPlugins(){return[new A({key:new w(`editable`),props:{editable:()=>this.editor.options.editable}})]}}),$i=new w(`focusEvents`),ea=G.create({name:`focusEvents`,addProseMirrorPlugins(){let{editor:e}=this;return[new A({key:$i,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;let r=e.state.tr.setMeta(`focus`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;let r=e.state.tr.setMeta(`blur`,{event:n}).setMeta(`addToHistory`,!1);return t.dispatch(r),!1}}}})]}}),ta=G.create({name:`keymap`,addKeyboardShortcuts(){let e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{let{selection:n,doc:r}=t,{empty:i,$anchor:a}=n,{pos:o,parent:s}=a,c=a.parent.isTextblock&&o>0?t.doc.resolve(o-1):a,l=c.parent.type.spec.isolating,u=a.pos-a.parentOffset,d=l&&c.parent.childCount===1?u===a.pos:D.atStart(r).from===o;return!i||!s.type.isTextblock||s.textContent.length||!d||d&&a.parent.type.name===`paragraph`?!1:e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},i={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return I()||Kt()?i:r},addProseMirrorPlugins(){return[new A({key:new w(`clearDocument`),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta(`composition`)))return;let r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta(`preventClearDocument`));if(!r||i)return;let{empty:a,from:o,to:s}=t.selection,c=D.atStart(t.doc).from,l=D.atEnd(t.doc).to;if(a||o!==c||s!==l||!cr(n.doc))return;let u=n.tr,d=Qe({state:n,transaction:u}),{commands:f}=new M({editor:this.editor,state:d});if(f.clearNodes(),u.steps.length)return u}})]}}),na=G.create({name:`paste`,addProseMirrorPlugins(){return[new A({key:new w(`tiptapPaste`),props:{handlePaste:(e,t,n)=>{this.editor.emit(`paste`,{editor:this.editor,event:t,slice:n})}}})]}}),ra=G.create({name:`tabindex`,addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new A({key:new w(`tabindex`),props:{attributes:()=>!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:this.options.value??`0`}}})]}}),ia=G.create({name:`textDirection`,addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];let{nodeExtensions:e}=On(this.extensions);return[{types:e.filter(e=>e.name!==`text`).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{let t=e.getAttribute(`dir`);return t&&(t===`ltr`||t===`rtl`||t===`auto`)?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new A({key:new w(`textDirection`),props:{attributes:()=>{let e=this.options.direction;return e?{dir:e}:{}}}})]}}),aa=We({ClipboardTextSerializer:()=>Ji,Commands:()=>Yi,Delete:()=>Xi,Drop:()=>Zi,Editable:()=>Qi,FocusEvents:()=>ea,Keymap:()=>ta,Paste:()=>na,Tabindex:()=>ra,TextDirection:()=>ia,focusEventsPluginKey:()=>$i}),oa=!1;function sa(e){if(oa)return;oa=!0;let t;try{let n=he.fromJSON(e,{from:0,to:0});if(!dr(n))return;t=n.slice.content}catch{return}t instanceof C||console.warn(`[tiptap warn]: prosemirror-model is loaded more than once. Wrapping and splitting nodes will fail. Deduplicate it in your lock file, or alias it to a single copy in your bundler.`)}var ca=class e{get name(){return this.node.type.name}constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){return this.actualDepth??this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+ +!this.node.isText}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){let t=[];return this.node.content.forEach((n,r)=>{let i=n.isBlock&&!n.isTextblock,a=n.isAtom&&!n.isText,o=n.isInline,s=this.pos+r+ +!a;if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;let c=this.resolvedPos.doc.resolve(s);if(!i&&!o&&c.depth<=this.depth)return;let l=new e(c,this.editor,i,i||o?n:null);i&&(l.actualDepth=this.depth+1),t.push(l)}),t}get firstChild(){return this.children[0]||null}get lastChild(){let e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e){if(Object.keys(t).length>0){let e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==t[i])break}}else n=r}r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||this.children.length===0)return r;let i=Object.keys(t);return this.children.forEach(a=>{n&&r.length>0||(a.node.type.name===e&&i.every(e=>t[e]===a.node.attrs[e])&&r.push(a),!(n&&r.length>0)&&(r=r.concat(a.querySelectorAll(e,t,n))))}),r}setAttribute(e){let{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},la=`.ProseMirror {
|
|
13
|
+
position: relative;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.ProseMirror {
|
|
17
|
+
word-wrap: break-word;
|
|
18
|
+
white-space: pre-wrap;
|
|
19
|
+
white-space: break-spaces;
|
|
20
|
+
-webkit-font-variant-ligatures: none;
|
|
21
|
+
font-variant-ligatures: none;
|
|
22
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.ProseMirror [contenteditable="false"] {
|
|
26
|
+
white-space: normal;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
30
|
+
white-space: pre-wrap;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ProseMirror pre {
|
|
34
|
+
white-space: pre-wrap;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
img.ProseMirror-separator {
|
|
38
|
+
display: inline !important;
|
|
39
|
+
border: none !important;
|
|
40
|
+
margin: 0 !important;
|
|
41
|
+
width: 0 !important;
|
|
42
|
+
height: 0 !important;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.ProseMirror-gapcursor {
|
|
46
|
+
display: none;
|
|
47
|
+
pointer-events: none;
|
|
48
|
+
position: absolute;
|
|
49
|
+
margin: 0;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.ProseMirror-gapcursor:after {
|
|
53
|
+
content: "";
|
|
54
|
+
display: block;
|
|
55
|
+
position: absolute;
|
|
56
|
+
top: -2px;
|
|
57
|
+
width: 20px;
|
|
58
|
+
border-top: 1px solid black;
|
|
59
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
@keyframes ProseMirror-cursor-blink {
|
|
63
|
+
to {
|
|
64
|
+
visibility: hidden;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.ProseMirror-hideselection *::selection {
|
|
69
|
+
background: transparent;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
73
|
+
background: transparent;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ProseMirror-hideselection * {
|
|
77
|
+
caret-color: transparent;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
81
|
+
display: block;
|
|
82
|
+
}`,ua=class extends ei{constructor(e={}){super(),this.css=null,this.className=`tiptap`,this.editorView=null,this.isFocused=!1,this.destroyed=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.hasWarnedStaleDecorationRead=!1,this.options={element:typeof document<`u`?document.createElement(`div`):null,content:``,injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:pr,createMappablePosition:mr},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on(`beforeCreate`,this.options.onBeforeCreate),this.emit(`beforeCreate`,{editor:this}),this.on(`mount`,this.options.onMount),this.on(`unmount`,this.options.onUnmount),this.on(`contentError`,this.options.onContentError),this.on(`create`,this.options.onCreate),this.on(`update`,this.options.onUpdate),this.on(`selectionUpdate`,this.options.onSelectionUpdate),this.on(`transaction`,this.options.onTransaction),this.on(`focus`,this.options.onFocus),this.on(`blur`,this.options.onBlur),this.on(`destroy`,this.options.onDestroy),this.on(`drop`,({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on(`paste`,({event:e,slice:t})=>this.options.onPaste(e,t)),this.on(`delete`,this.options.onDelete);let t=this.createDoc();if(!this.editorState){let e=St(t,this.options.autofocus);this.editorState=fe.create({doc:t,schema:this.schema,selection:e||void 0})}sa(this.schema),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>`u`)throw Error(`[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.`);this.createView(e),this.emit(`mount`,{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(this.options.autofocus!==!1&&this.options.autofocus!==null&&this.commands.focus(this.options.autofocus),this.emit(`create`,{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){this.editorState=this.editorView.state;let e=this.editorView.dom;e?.editor&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{typeof this.css.remove==`function`?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn(`Failed to remove CSS element:`,e)}this.css=null,this.emit(`unmount`,{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager?this.commandManager.chain():M.createFakeChain()}can(){return this.commandManager?this.commandManager.can():M.createFallbackCan()}injectCSS(){this.options.injectCSS&&typeof document<`u`&&(this.css=Si(la,this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps({...this.options.editorProps,attributes:this.getEditorViewAttributes()}),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit(`update`,{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if(t===`state`)return this.editorState;if(t in e)return Reflect.get(e,t);throw Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return ti&&!this.hasWarnedStaleDecorationRead&&$r(this)&&(this.hasWarnedStaleDecorationRead=!0,console.warn("[tiptap warn]: `editor.state` was read while decoration `create()` was running. It returns the pre-transaction document. Use the `state` argument passed to `create()` instead. Helpers like `editor.isActive()` read `editor.state` too, so pass `state` to their standalone versions instead of calling them on the editor.")),this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){let n=An(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;let t=this.state.plugins,n=t;if([].concat(e).forEach(e=>{let t=typeof e==`string`?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;let r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;let n=[...this.options.enableCoreExtensions?[Qi,Ji.configure({blockSeparator:(e=this.options.coreExtensionOptions)==null||(e=e.clipboardTextSerializer)==null?void 0:e.blockSeparator}),Yi,ea,ta,ra.configure({value:(t=this.options.coreExtensionOptions)==null||(t=t.tabindex)==null?void 0:t.value}),Zi,na,Xi,ia.configure({direction:this.options.textDirection})].filter(e=>typeof this.options.enableCoreExtensions!=`object`||this.options.enableCoreExtensions[e.name]!==!1):[],...this.options.extensions].filter(e=>[`extension`,`node`,`mark`].includes(e?.type));this.extensionManager=new qi(n,this)}createCommandManager(){this.commandManager=new M({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=dn(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error)||![`[tiptap error]: Invalid JSON content`,`[tiptap error]: Invalid HTML content`].includes(e.message))throw e;let t=dn(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1});return this.editorState=fe.create({doc:t,schema:this.schema,selection:St(t,this.options.autofocus)||void 0}),this.emit(`contentError`,{editor:this,error:e,disableCollaboration:()=>{`collaboration`in this.storage&&typeof this.storage.collaboration==`object`&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>e.name!==`collaboration`),this.createExtensionManager()}}),this.editorState.doc}return e}getEditorViewAttributes(){let e=this.options.editorProps?.attributes;return An(e)?t=>({role:`textbox`,...e(t)}):{role:`textbox`,...e}}createView(e){let{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=n?this.extensionManager.dispatchTransaction(r):r,a=t.transformPastedHTML,o=this.extensionManager.transformPastedHTML(a);this.editorView=new ye(e,{...t,attributes:this.getEditorViewAttributes(),dispatchTransaction:i,transformPastedHTML:o,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});let s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();let c=this.view.dom;c.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;let t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=e;return}e.steps.forEach(e=>this.capturedTransaction?.step(e));return}let{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=n.includes(e),a=this.state;if(this.emit(`beforeTransaction`,{editor:this,transaction:e,nextState:t}),!i)return;this.view.updateState(t),this.emit(`transaction`,{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit(`selectionUpdate`,{editor:this,transaction:e});let o=n.findLast(e=>e.getMeta(`focus`)||e.getMeta(`blur`)),s=o?.getMeta(`focus`),c=o?.getMeta(`blur`);s&&this.emit(`focus`,{editor:this,event:s.event,transaction:o}),c&&this.emit(`blur`,{editor:this,event:c.event,transaction:o}),!(e.getMeta(`preventUpdate`)||!n.some(e=>e.docChanged)||a.doc.eq(t.doc))&&this.emit(`update`,{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return qn(this.state,e)}isActive(e,t){let n=typeof e==`string`?e:null,r=typeof e==`string`?t:e;return rr(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return yn(this.state.doc.content,this.schema)}getText(e){let{blockSeparator:t=`
|
|
83
|
+
|
|
84
|
+
`,textSerializers:n={}}=e||{};return Wn(this.state.doc,{blockSeparator:t,textSerializers:{...Gn(this.schema),...n}})}get isEmpty(){return cr(this.state.doc)}destroy(){this.destroyed||(this.destroyed=!0,this.emit(`destroy`),this.unmount(),this.removeAllListeners(),this.extensionManager.destroy(),this.extensionManager=null,this.schema=null,this.commandManager=null,this.extensionStorage={})}get isDestroyed(){return this.editorView?.isDestroyed??!0}$node(e,t){return this.$doc?.querySelector(e,t)||null}$nodes(e,t){return this.$doc?.querySelectorAll(e,t)||null}$pos(e){let t=this.state.doc.resolve(e),n=e>0&&t.nodeAfter&&!t.nodeAfter.isText&&t.nodeAfter.isAtom?t.nodeAfter:null;return new ca(t,this,!1,n)}get $doc(){return this.$pos(0)}};function K(e){return new Ni({find:e.find,handler:({state:t,range:n,match:r})=>{let i=R(e.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:a}=t,o=r[r.length-1],s=r[0];if(o){let r=s.search(/\S/),c=n.from+s.indexOf(o),l=c+o.length;if(Zn(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>c).length)return null;l<n.to&&a.delete(l,n.to),c>n.from&&a.delete(n.from+r,c);let u=n.from+r+o.length;a.addMark(n.from+r,u,e.type.create(i||{})),a.removeStoredMark(e.type)}},undoable:e.undoable})}function da(e){return new Ni({find:e.find,handler:({state:t,range:n,match:r})=>{let i=R(e.getAttributes,void 0,r)||{},{tr:a}=t,o=n.from,s=n.to,c=e.type.create(i);if(r[1]){let e=o+r[0].lastIndexOf(r[1]);e>s?e=s:s=e+r[1].length;let t=r[0][r[0].length-1];a.insertText(t,o+r[0].length-1),a.replaceWith(e,s,c)}else if(r[0]){let t=e.type.isInline?o:o-1;a.insert(t,e.type.create(i)).delete(a.mapping.map(o),a.mapping.map(s))}a.scrollIntoView()},undoable:e.undoable})}function fa(e){return new Ni({find:e.find,handler:({state:t,range:n,match:r})=>{let i=t.doc.resolve(n.from),a=R(e.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,a)},undoable:e.undoable})}function pa(e){return new Ni({find:e.find,handler:({state:t,range:n,match:r,chain:i})=>{let a=R(e.getAttributes,void 0,r)||{},o=t.tr.delete(n.from,n.to),s=o.doc.resolve(n.from).blockRange(),c=s&&pe(s,e.type,a);if(!c)return null;if(o.wrap(s,c),e.keepMarks&&e.editor){let{selection:n,storedMarks:r}=t,{splittableMarks:i}=e.editor.extensionManager,a=r||n.$to.parentOffset&&n.$from.marks();if(a){let e=a.filter(e=>i.includes(e.type.name));o.ensureMarks(e)}}if(e.keepAttributes){let t=e.type.name===`bulletList`||e.type.name===`orderedList`?`listItem`:`taskList`;i().updateAttributes(t,a).run()}let l=o.doc.resolve(n.from-1).nodeBefore;l&&l.type===e.type&&de(o.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,l))&&o.join(n.from-1)},undoable:e.undoable})}var ma=class e extends Bi{constructor(...e){super(...e),this.type=`node`}static create(t={}){let n=typeof t==`function`?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){let t=typeof e==`function`?e():e;return super.extend(t)}},ha=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=()=>{try{return t.getPos()}catch{return}},this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){let{view:t}=this.editor,n=e.target,r=n.nodeType===3?n.parentElement?.closest(`[data-drag-handle]`):n.closest(`[data-drag-handle]`);if(!this.dom||this.contentDOM?.contains(n)||!r)return;let i=0,a=0;if(this.dom!==r){let t=this.dom.getBoundingClientRect(),n=r.getBoundingClientRect(),o=e.offsetX??e.nativeEvent?.offsetX,s=e.offsetY??e.nativeEvent?.offsetY;i=n.x-t.x+o,a=n.y-t.y+s}let o=this.dom.cloneNode(!0);try{let e=this.dom.getBoundingClientRect();o.style.width=`${Math.round(e.width)}px`,o.style.height=`${Math.round(e.height)}px`,o.style.boxSizing=`border-box`,o.style.pointerEvents=`none`}catch{}let s=null;try{var c;s=document.createElement(`div`),s.style.position=`absolute`,s.style.top=`-9999px`,s.style.left=`-9999px`,s.style.pointerEvents=`none`,s.appendChild(o),document.body.appendChild(s),(c=e.dataTransfer)==null||c.setDragImage(o,i,a)}finally{s&&setTimeout(()=>{try{s?.remove()}catch{}},0)}let l=this.getPos();if(typeof l!=`number`)return;let u=k.create(t.state.doc,l),d=t.state.tr.setSelection(u);t.dispatch(d)}stopEvent(e){if(!this.dom)return!1;if(typeof this.options.stopEvent==`function`)return this.options.stopEvent({event:e});let t=e.target;if(!this.dom.contains(t)||this.contentDOM?.contains(t))return!1;let n=e.type.startsWith(`drag`),r=e.type===`dragover`||e.type===`dragenter`,i=e.type===`drop`;if(([`INPUT`,`BUTTON`,`SELECT`,`TEXTAREA`].includes(t.tagName)||t.isContentEditable)&&!i&&!n)return!0;let{isEditable:a}=this.editor,{isDragging:o}=this,s=!!this.node.type.spec.draggable,c=k.isSelectable(this.node),l=e.type===`copy`,u=e.type===`paste`,d=e.type===`cut`,f=e.type===`mousedown`;if(!s&&c&&n&&e.target===this.dom&&e.preventDefault(),s&&n&&!o&&e.target===this.dom)return e.preventDefault(),!1;if(s&&a&&!o&&f){let e=t.closest(`[data-drag-handle]`);e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener(`dragend`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`drop`,()=>{this.isDragging=!1},{once:!0}),document.addEventListener(`mouseup`,()=>{this.isDragging=!1},{once:!0}))}return!(o||r||i||l||u||d||f&&c)}ignoreMutation(e){return this.dom?this.contentDOM?typeof this.options.ignoreMutation==`function`?this.options.ignoreMutation({mutation:e}):this.node.isLeaf||this.node.isAtom?!0:e.type===`selection`||this.contentDOM.contains(e.target)&&e.type===`childList`&&(I()||Ct())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable)?!1:this.contentDOM===e.target&&e.type===`attributes`||!this.contentDOM.contains(e.target):e.type!==`selection`:!0}updateAttributes(e){this.editor.commands.command(({tr:t})=>{let n=this.getPos();return typeof n==`number`&&(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){let e=this.getPos();if(typeof e!=`number`)return;let t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function q(e){return new Vi({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:i})=>{let a=R(e.getAttributes,void 0,r,i);if(a===!1||a===null)return null;let{tr:o}=t,s=r[r.length-1],c=r[0],l=n.to;if(s){let i=c.search(/\S/),u=n.from+c.indexOf(s),d=u+s.length;if(Zn(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>u).length)return null;d<n.to&&o.delete(d,n.to),u>n.from&&o.delete(n.from+i,u),l=n.from+i+s.length,o.addMark(n.from+i,l,e.type.create(a||{})),r.index!==void 0&&r.input!==void 0&&r.index+r[0].length>=r.input.length||o.removeStoredMark(e.type)}}})}var ga=new WeakSet,_a=new WeakSet;function J(e){let t=e;return ga.add(t),t}function va(e){return Array.isArray(e)&&ga.has(e)}function ya(e){return e.flatMap(e=>e==null?[]:Array.isArray(e)&&_a.has(e)&&!va(e)?ya(e):[e])}function ba(e,t){if(e===`slot`)return 0;if(e instanceof Function){let n=e(t);return Array.isArray(n)&&!va(n)&&!_a.has(n)?J(n):n}let{children:n,...r}=t??{};if(e===`svg`)throw Error(`SVG elements are not supported in the JSX syntax, use the array syntax instead`);if(Array.isArray(n)){if(va(n))return J([e,r,n]);if(n.length===0)return J([e,r]);let t=ya(n);return t.length===0?J([e,r]):J([e,r,...t])}return J(n==null?[e,r]:[e,r,n])}var xa=(e,t)=>ba(e,t),Sa=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Ca=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,wa=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,Ta=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Ea=W.create({name:`bold`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`strong`},{tag:`b`,getAttrs:e=>e.style.fontWeight!==`normal`&&null},{style:`font-weight=400`,clearMark:e=>e.type.name===this.name},{style:`font-weight`,getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return xa(`strong`,{...z(this.options.HTMLAttributes,e),children:xa(`slot`,{})})},markdownTokenName:`strong`,parseMarkdown:(e,t)=>t.applyMark(`bold`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<strong>`,close:`</strong>`}},renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[K({find:Sa,type:this.type}),K({find:wa,type:this.type})]},addPasteRules(){return[q({find:Ca,type:this.type}),q({find:Ta,type:this.type})]}}),Da=Ea,Oa=e=>{let t=/`([^`]+)`(?!`)$/.exec(e);return!t||t.index>0&&e[t.index-1]==="`"?null:{index:t.index,text:t[0],replaceWith:t[1]}},ka=e=>{let t=/`([^`]+)`(?!`)/g,n=[],r;for(;(r=t.exec(e))!==null;)r.index>0&&e[r.index-1]==="`"||n.push({index:r.index,text:r[0],replaceWith:r[1]});return n};function Aa(e){let t=new Set((e.match(/`+/g)||[]).map(e=>e.length)),n=1;for(;t.has(n);)n+=1;return n}var ja=W.create({name:`code`,addOptions(){return{HTMLAttributes:{}}},excludes:`_`,code:!0,exitable:!0,parseHTML(){return[{tag:`code`}]},renderHTML({HTMLAttributes:e}){return[`code`,z(this.options.HTMLAttributes,e),0]},markdownTokenName:`codespan`,parseMarkdown:(e,t)=>t.applyMark(`code`,[{type:`text`,text:e.text||``}]),renderMarkdown:(e,t,n)=>{var r;if(!e.content)return``;let i=typeof(n==null||(r=n.meta)==null?void 0:r.markText)==`string`?n.meta.markText:``,a="`".repeat(Aa(i)),o=i.startsWith("`")||i.endsWith("`")?` `:``;return`${a}${o}${t.renderChildren(e.content)}${o}${a}`},addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[K({find:Oa,type:this.type})]},addPasteRules(){return[q({find:ka,type:this.type})]}}),Ma=ja,Na=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Pa=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Fa=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Ia=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,La=W.create({name:`italic`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`em`},{tag:`i`,getAttrs:e=>e.style.fontStyle!==`normal`&&null},{style:`font-style=normal`,clearMark:e=>e.type.name===this.name},{style:`font-style=italic`}]},renderHTML({HTMLAttributes:e}){return[`em`,z(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:`em`,parseMarkdown:(e,t)=>t.applyMark(`italic`,t.parseInline(e.tokens||[])),markdownOptions:{htmlReopen:{open:`<em>`,close:`</em>`}},renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[K({find:Na,type:this.type}),K({find:Fa,type:this.type})]},addPasteRules(){return[q({find:Pa,type:this.type}),q({find:Ia,type:this.type})]}}),Ra=La,za=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ba=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,Va=W.create({name:`strike`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`s`},{tag:`del`},{tag:`strike`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`line-through`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`s`,z(this.options.HTMLAttributes,e),0]},markdownTokenName:`del`,parseMarkdown:(e,t)=>t.applyMark(`strike`,t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[K({find:za,type:this.type})]},addPasteRules(){return[q({find:Ba,type:this.type})]}}),Ha=Va,Ua=W.create({name:`underline`,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`u`},{style:`text-decoration`,consuming:!1,getAttrs:e=>e.includes(`underline`)?{}:!1}]},renderHTML({HTMLAttributes:e}){return[`u`,z(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||`underline`,t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:`underline`,level:`inline`,start(e){return e.indexOf(`++`)},tokenize(e,t,n){let r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;let i=r[2].trim();return{type:`underline`,raw:r[0],text:i,tokens:n.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Wa=Ua,Ga=ma.create({name:`text`,group:`inline`,parseMarkdown:e=>({type:`text`,text:e.text||``}),renderMarkdown:e=>e.text||``}),Y=class e extends D{constructor(e){super(e,e)}map(t,n){let r=t.resolve(n.map(this.head));return e.valid(r)?new e(r):D.near(r)}content(){return E.empty}eq(t){return t instanceof e&&t.head==this.head}toJSON(){return{type:`gapcursor`,pos:this.head}}static fromJSON(t,n){if(typeof n.pos!=`number`)throw RangeError(`Invalid input for GapCursor.fromJSON`);return new e(t.resolve(n.pos))}getBookmark(){return new Ka(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!Ja(e)||!Ya(e))return!1;let n=t.type.spec.allowGapCursor;if(n!=null)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(t,n,r=!1){search:for(;;){if(!r&&e.valid(t))return t;let i=t.pos,a=null;for(let r=t.depth;;r--){let o=t.node(r);if(n>0?t.indexAfter(r)<o.childCount:t.index(r)>0){a=o.child(n>0?t.indexAfter(r):t.index(r)-1);break}if(r==0)return null;i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}for(;;){let o=n>0?a.firstChild:a.lastChild;if(!o){if(a.isAtom&&!a.isText&&!k.isSelectable(a)){t=t.doc.resolve(i+a.nodeSize*n),r=!1;continue search}break}a=o,i+=n;let s=t.doc.resolve(i);if(e.valid(s))return s}return null}}};Y.prototype.visible=!1,Y.findFrom=Y.findGapCursorFrom,D.jsonID(`gapcursor`,Y);var Ka=class e{constructor(e){this.pos=e}map(t){return new e(t.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Y.valid(t)?new Y(t):D.near(t)}};function qa(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}function Ja(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(n==0){if(r.type.spec.isolating)return!0}else for(let e=r.child(n-1);;e=e.lastChild){if(e.childCount==0&&!e.inlineContent||qa(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Ya(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n==r.childCount){if(r.type.spec.isolating)return!0}else for(let e=r.child(n);;e=e.firstChild){if(e.childCount==0&&!e.inlineContent||qa(e.type))return!0;if(e.inlineContent)return!1}}return!0}function Xa(){return new A({props:{decorations:to,createSelectionBetween(e,t,n){return t.pos==n.pos&&Y.valid(n)?new Y(n):null},handleClick:$a,handleKeyDown:Za,handleDOMEvents:{beforeinput:eo}}})}var Za=v({ArrowLeft:Qa(`horiz`,-1),ArrowRight:Qa(`horiz`,1),ArrowUp:Qa(`vert`,-1),ArrowDown:Qa(`vert`,1)});function Qa(e,t){let n=e==`vert`?t>0?`down`:`up`:t>0?`right`:`left`;return function(e,r,i){let a=e.selection,o=t>0?a.$to:a.$from,s=a.empty;if(a instanceof T){if(!i.endOfTextblock(n)||o.depth==0)return!1;s=!1,o=e.doc.resolve(t>0?o.after():o.before())}let c=Y.findGapCursorFrom(o,t,s);return c?(r&&r(e.tr.setSelection(new Y(c))),!0):!1}}function $a(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Y.valid(r))return!1;let i=e.posAtCoords({left:n.clientX,top:n.clientY});return i&&i.inside>-1&&k.isSelectable(e.state.doc.nodeAt(i.inside))?!1:(e.dispatch(e.state.tr.setSelection(new Y(r))),!0)}function eo(e,t){if(t.inputType!=`insertCompositionText`||!(e.state.selection instanceof Y))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let i=C.empty;for(let e=r.length-1;e>=0;e--)i=C.from(r[e].createAndFill(null,i));let a=e.state.tr.replace(n.pos,n.pos,new E(i,0,0));return a.setSelection(T.near(a.doc.resolve(n.pos+1))),e.dispatch(a),!1}function to(e){if(!(e.selection instanceof Y))return null;let t=document.createElement(`div`);return t.className=`ProseMirror-gapcursor`,O.create(e.doc,[be.widget(e.selection.head,t,{key:`gapcursor`})])}var no=t((e=>{var t=n();function r(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var i=typeof Object.is==`function`?Object.is:r,a=t.useState,o=t.useEffect,s=t.useLayoutEffect,c=t.useDebugValue;function l(e,t){var n=t(),r=a({inst:{value:n,getSnapshot:t}}),i=r[0].inst,l=r[1];return s(function(){i.value=n,i.getSnapshot=t,u(i)&&l({inst:i})},[e,n,t]),o(function(){return u(i)&&l({inst:i}),e(function(){u(i)&&l({inst:i})})},[e]),c(n),n}function u(e){var t=e.getSnapshot;e=e.value;try{var n=t();return!i(e,n)}catch{return!0}}function d(e,t){return t()}var f=typeof window>`u`||window.document===void 0||window.document.createElement===void 0?d:l;e.useSyncExternalStore=t.useSyncExternalStore===void 0?f:t.useSyncExternalStore})),ro=t(((e,t)=>{t.exports=no()})),X=e(n(),1),io=e(r(),1),Z=i(),ao=ro(),{getOwnPropertyNames:oo,getOwnPropertySymbols:so}=Object,{hasOwnProperty:co}=Object.prototype;function lo(e,t){return function(n,r,i){return e(n,r,i)&&t(n,r,i)}}function uo(e){return function(t,n,r){if(!t||!n||typeof t!=`object`||typeof n!=`object`)return e(t,n,r);let{cache:i}=r,a=i.get(t),o=i.get(n);if(a&&o)return a===n&&o===t;i.set(t,n),i.set(n,t);let s=e(t,n,r);return i.delete(t),i.delete(n),s}}function fo(e){return e?.[Symbol.toStringTag]}function po(e){return oo(e).concat(so(e))}var mo=Object.hasOwn||((e,t)=>co.call(e,t));function Q(e,t){return e===t||!e&&!t&&e!==e&&t!==t}var ho=`__v`,go=`__o`,_o=`_owner`,vo=64,{getOwnPropertyDescriptor:yo,keys:bo}=Object,{propertyIsEnumerable:xo}=Object.prototype,So=yo(Object.getPrototypeOf(Int8Array.prototype),Symbol.toStringTag).get;function Co(e,t){return e.byteLength===t.byteLength&&Lo(new Uint8Array(e),new Uint8Array(t))}function wo(e,t,n){let r=e.length;if(t.length!==r)return!1;for(;r-->0;)if(!n.equals(e[r],t[r],r,r,e,t,n))return!1;return!0}function To(e,t){return e.byteLength===t.byteLength&&Lo(new Uint8Array(e.buffer,e.byteOffset,e.byteLength),new Uint8Array(t.buffer,t.byteOffset,t.byteLength))}function Eo(e,t){return Q(e.getTime(),t.getTime())}function Do(e,t,n){if(e.name!==t.name||e.message!==t.message||e.stack!==t.stack)return!1;let r=e.cause,i=t.cause;if(r!==i&&!n.equals(r,i,`cause`,`cause`,e,t,n))return!1;let a=e.errors,o=t.errors;if(a!==o&&!n.equals(a,o,`errors`,`errors`,e,t,n))return!1;let s=bo(e),c=bo(t),l=s.length;if(!l&&!c.length)return!0;let u=0,d;for(;l-->0;)if(d=s[l],d!==`cause`&&d!==`errors`){if(d!==c[l]&&!xo.call(t,d)||!n.equals(e[d],t[d],d,d,e,t,n))return!1;++u}let f=c.length-u;return!f||f===+!!xo.call(t,`cause`)+ +!!xo.call(t,`errors`)}function Oo(e,t){return e===t}function ko(e,t,n){return e.name===t.name&&e.message===t.message&&e.stack===t.stack&&No(e,t,n)}function Ao(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.entries(),o,s,c=0;for(;(o=a.next())&&!o.done;){let r=t.entries(),a=!1,l=0;for(;(s=r.next())&&!s.done;){if(i[l]){l++;continue}let r=o.value,u=s.value;if(n.equals(r[0],u[0],c,l,e,t,n)&&n.equals(r[1],u[1],r[0],u[0],e,t,n)){a=i[l]=!0;break}l++}if(!a)return!1;c++}return!0}var jo=Q;function Mo(e,t,n){let r=bo(e),i=bo(t),a=r.length;if(i.length!==a)return!1;let o=a<=vo,s;for(;a-->0;)if(s=r[a],!Vo(e,t,s)&&(s!==i[a]&&!(o?i.includes(s):xo.call(t,s))||!n.equals(e[s],t[s],s,s,e,t,n)))return!1;return!0}function No(e,t,n){let r=po(e),i=r.length;if(po(t).length!==i)return!1;let a,o,s;for(;i-->0;)if(a=r[i],!Vo(e,t,a)&&(!mo(t,a)||!n.equals(e[a],t[a],a,a,e,t,n))||(o=yo(e,a),s=yo(t,a),(o||s)&&(!o||!s||o.configurable!==s.configurable||o.enumerable!==s.enumerable||o.writable!==s.writable)))return!1;return!0}function Po(e,t){return Q(e.valueOf(),t.valueOf())}function Fo(e,t){return e.source===t.source&&e.flags===t.flags}function Io(e,t,n){let r=e.size;if(r!==t.size)return!1;if(!r)return!0;let i=Array(r),a=e.values(),o,s;for(;(o=a.next())&&!o.done;){let r=t.values(),a=!1,c=0;for(;(s=r.next())&&!s.done;){if(!i[c]&&n.equals(o.value,s.value,o.value,s.value,e,t,n)){a=i[c]=!0;break}c++}if(!a)return!1}return!0}function Lo(e,t){let n=e.length;if(t.length!==n||e.byteOffset!==t.byteOffset)return!1;let r=So.call(e);if(r===`Float64Array`||r===`Float32Array`||r===`Float16Array`){for(;n-->0;)if(e[n]!==t[n]&&(e[n]===e[n]||t[n]===t[n]))return!1;return!0}for(;n-->0;)if(e[n]!==t[n])return!1;return!0}function Ro(e,t){return e.href===t.href||e.protocol===t.protocol&&e.username===t.username&&e.password===t.password&&e.host===t.host&&e.pathname===t.pathname&&e.hash===t.hash&&zo(e.searchParams,t.searchParams)}function zo(e,t){let n=e.toString(),r=t.toString();return n===r||Bo(n)===Bo(r)}function Bo(e){return e.split(`&`).sort().join(`&`)}function Vo(e,t,n){return(n===_o||n===go||n===ho)&&!!(e.$$typeof||t.$$typeof)}var Ho=`[object ArrayBuffer]`,Uo=`[object Arguments]`,Wo=`[object Boolean]`,Go=`[object DataView]`,Ko=`[object Date]`,qo=`[object Error]`,Jo=`[object Map]`,Yo=`[object Number]`,Xo=`[object Object]`,Zo=`[object RegExp]`,Qo=`[object Set]`,$o=`[object String]`,es={"[object Int8Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Int16Array]":!0,"[object Uint16Array]":!0,"[object Int32Array]":!0,"[object Uint32Array]":!0,"[object Float16Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0,"[object BigInt64Array]":!0,"[object BigUint64Array]":!0},ts=`[object URL]`,ns=Object.prototype.toString;function rs({areArrayBuffersEqual:e,areArraysEqual:t,areDataViewsEqual:n,areDatesEqual:r,areErrorsEqual:i,areFunctionsEqual:a,areMapsEqual:o,areNumbersEqual:s,areObjectsEqual:c,arePrimitiveWrappersEqual:l,areRegExpsEqual:u,areSetsEqual:d,areTypedArraysEqual:f,areUrlsEqual:p,unknownTagComparators:m}){return function(h,g,_){if(h===g)return!0;if(h==null||g==null)return!1;let v=typeof h;if(v!==typeof g)return!1;if(v!==`object`)return v===`number`?s(h,g,_):v===`function`&&a(h,g,_);let y=h.constructor;if(y!==g.constructor)return!1;if(y===Object)return c(h,g,_);if(Array.isArray(h))return t(h,g,_);if(y===Date)return r(h,g,_);if(y===RegExp)return u(h,g,_);if(y===Map)return o(h,g,_);if(y===Set)return d(h,g,_);if(y==null)return c(h,g,_);let b=ns.call(h);if(b===Ko)return r(h,g,_);if(b===Zo)return u(h,g,_);if(b===Jo)return o(h,g,_);if(b===Qo)return d(h,g,_);if(b===Xo)return typeof h.then!=`function`&&typeof g.then!=`function`&&c(h,g,_);if(b===ts)return p(h,g,_);if(b===qo)return i(h,g,_);if(b===Uo)return c(h,g,_);if(es[b])return f(h,g,_);if(b===Ho)return e(h,g,_);if(b===Go)return n(h,g,_);if(b===Wo||b===Yo||b===$o)return l(h,g,_);if(m){let e=m[b];if(!e){let t=fo(h);t&&(e=m[t])}if(e)return e(h,g,_)}return!1}}function is({circular:e,createCustomConfig:t,strict:n}){let r={areArrayBuffersEqual:Co,areArraysEqual:n?No:wo,areDataViewsEqual:To,areDatesEqual:Eo,areErrorsEqual:n?ko:Do,areFunctionsEqual:Oo,areMapsEqual:n?lo(Ao,No):Ao,areNumbersEqual:jo,areObjectsEqual:n?No:Mo,arePrimitiveWrappersEqual:Po,areRegExpsEqual:Fo,areSetsEqual:n?lo(Io,No):Io,areTypedArraysEqual:n?lo(Lo,No):Lo,areUrlsEqual:Ro,unknownTagComparators:void 0};if(t&&(r=Object.assign({},r,t(r))),e){let e=uo(r.areArraysEqual),t=uo(r.areErrorsEqual),n=uo(r.areMapsEqual),i=uo(r.areObjectsEqual),a=uo(r.areSetsEqual);r=Object.assign({},r,{areArraysEqual:e,areErrorsEqual:t,areMapsEqual:n,areObjectsEqual:i,areSetsEqual:a})}return r}function as(e){return function(t,n,r,i,a,o,s){return e(t,n,s)}}function os({circular:e,comparator:t,createState:n,equals:r,strict:i}){if(n)return function(a,o){let{cache:s=e?new WeakMap:void 0,meta:c}=n();return t(a,o,{cache:s,equals:r,meta:c,strict:i})};if(e)return function(e,n){return t(e,n,{cache:new WeakMap,equals:r,meta:void 0,strict:i})};let a={cache:void 0,equals:r,meta:void 0,strict:i};return function(e,n){return t(e,n,a)}}$(),$({strict:!0});var ss=$({circular:!0});$({circular:!0,strict:!0}),$({createInternalComparator:()=>Q}),$({strict:!0,createInternalComparator:()=>Q}),$({circular:!0,createInternalComparator:()=>Q}),$({circular:!0,createInternalComparator:()=>Q,strict:!0});function $(e={}){let{circular:t=!1,createInternalComparator:n,createState:r,strict:i=!1}=e,a=rs(is(e));return os({circular:t,comparator:a,createState:r,equals:n?n(a):as(a),strict:i})}var cs=t((e=>{var t=n(),r=ro();function i(e,t){return e===t&&(e!==0||1/e==1/t)||e!==e&&t!==t}var a=typeof Object.is==`function`?Object.is:i,o=r.useSyncExternalStore,s=t.useRef,c=t.useEffect,l=t.useMemo,u=t.useDebugValue;e.useSyncExternalStoreWithSelector=function(e,t,n,r,i){var d=s(null);if(d.current===null){var f={hasValue:!1,value:null};d.current=f}else f=d.current;d=l(function(){function e(e){if(!o){if(o=!0,s=e,e=r(e),i!==void 0&&f.hasValue){var t=f.value;if(i(t,e))return c=t}return c=e}if(t=c,a(s,e))return t;var n=r(e);return i!==void 0&&i(t,n)?(s=e,t):(s=e,c=n)}var o=!1,s,c,l=n===void 0?null:n;return[function(){return e(t())},l===null?void 0:function(){return e(l())}]},[t,n,r,i]);var p=o(e,d[0],d[1]);return c(function(){f.hasValue=!0,f.value=p},[p]),u(p),p}})),ls=t(((e,t)=>{t.exports=cs()})),us=ls();function ds(e,t){if(e.isDestroyed||t.defaultPrevented||!t.cancelable||!e.isEditable||t.inputType!==`insertParagraph`&&t.inputType!==`insertLineBreak`||!I()&&!Ct())return;let n=e.view,r=n.root,i=(r.getSelection?.call(r)??n.dom.ownerDocument.getSelection())?.anchorNode,a=(i?.nodeType===1?i:i?.parentElement)?.closest(`[data-node-view-content-react]`);if(!a||!n.dom.contains(a))return;let o=n.input.lastKeyCode;o===13&&(n.input.lastKeyCode=null),n.domObserver.forceFlush(),n.domObserver.flush();let s=new KeyboardEvent(`keydown`,{key:`Enter`,code:`Enter`,keyCode:13,shiftKey:t.inputType===`insertLineBreak`,bubbles:!0,cancelable:!0});n.someProp(`handleKeyDown`,e=>e(n,s))?(t.preventDefault(),n.input.lastIOSEnter=0,clearTimeout(n.input.lastIOSEnterFallbackTimeout)):o===13&&(n.input.lastKeyCode=o)}var fs=new w(`reactMobileEnter`),ps=(...e)=>t=>{e.forEach(e=>{typeof e==`function`?e(t):e&&(e.current=t)})},ms=({contentComponent:e})=>{let t=(0,ao.useSyncExternalStore)(e.subscribe,e.getSnapshot,e.getServerSnapshot);return(0,Z.jsx)(Z.Fragment,{children:Object.values(t)})};function hs(){let e=new Set,t={},n=!1,r=()=>{!n&&e.size&&(n=!0,queueMicrotask(()=>{n=!1,e.forEach(e=>e())}))};return{subscribe(t){return e.add(t),()=>{e.delete(t)}},getSnapshot(){return t},getServerSnapshot(){return t},setRenderer(e,n){t={...t,[e]:io.createPortal(n.reactElement,n.element,e)},r()},removeRenderer(e){let n={...t};delete n[e],t=n,r()}}}var gs=class extends X.Component{constructor(e){super(e),this.editorContentRef=X.createRef()}componentDidMount(){this.init()}componentDidUpdate(){this.init()}init(){let e=this.props.editor;if(e&&!e.isDestroyed&&e.view.dom?.parentNode){if(e.contentComponent)return;let t=this.editorContentRef.current;t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t}),e.contentComponent=hs(),e.createNodeViews(),e.registerPlugin(new A({key:fs,props:{handleDOMEvents:{beforeinput:(t,n)=>ds(e,n)}}})),e.isEditorContentInitialized=!0,this.forceUpdate()}}componentWillUnmount(){let e=this.props.editor;if(e){e.isEditorContentInitialized=!1,e.isDestroyed||(e.unregisterPlugin(fs),e.view.setProps({nodeViews:{}})),e.contentComponent=null;try{if(!e.view.dom?.parentNode)return;let t=document.createElement(`div`);t.append(...e.view.dom.parentNode.childNodes),e.setOptions({element:t})}catch{}}}render(){let{editor:e,innerRef:t,...n}=this.props;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{ref:ps(t,this.editorContentRef),...n}),e?.contentComponent&&(0,Z.jsx)(ms,{contentComponent:e.contentComponent})]})}},_s=(0,X.forwardRef)((e,t)=>{let n=X.useMemo(()=>Math.floor(Math.random()*4294967295).toString(),[e.editor]);return X.createElement(gs,{key:n,innerRef:t,...e})}),vs=X.memo(_s),ys=typeof window<`u`?X.useLayoutEffect:X.useEffect,bs=class{constructor(e){this.transactionNumber=0,this.lastTransactionNumber=0,this.subscribers=new Set,this.editor=e,this.lastSnapshot={editor:e,transactionNumber:0},this.getSnapshot=this.getSnapshot.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.watch=this.watch.bind(this),this.subscribe=this.subscribe.bind(this)}getSnapshot(){return this.transactionNumber===this.lastTransactionNumber||(this.lastTransactionNumber=this.transactionNumber,this.lastSnapshot={editor:this.editor,transactionNumber:this.transactionNumber}),this.lastSnapshot}getServerSnapshot(){return{editor:null,transactionNumber:0}}subscribe(e){return this.subscribers.add(e),()=>{this.subscribers.delete(e)}}watch(e){if(this.editor=e,this.editor){let e,t=t=>{(t?.transaction===void 0||t.transaction!==e)&&(e=t?.transaction,this.transactionNumber+=1,this.subscribers.forEach(e=>e()))},n=this.editor;return n.on(`transaction`,t),n.on(`update`,t),()=>{n.off(`transaction`,t),n.off(`update`,t)}}}};function xs(e){let[t]=(0,X.useState)(()=>new bs(e.editor)),n=(0,us.useSyncExternalStoreWithSelector)(t.subscribe,t.getSnapshot,t.getServerSnapshot,e.selector,e.equalityFn??ss);return ys(()=>t.watch(e.editor),[e.editor,t]),(0,X.useDebugValue)(n),n}var Ss=typeof window>`u`,Cs=Ss||!!(typeof window<`u`&&window.next),ws=class e{constructor(e){this.editor=null,this.subscriptions=new Set,this.isComponentMounted=!1,this.previousDeps=null,this.instanceId=``,this.options=e,this.subscriptions=new Set,this.setEditor(this.getInitialEditor()),this.scheduleDestroy(),this.getEditor=this.getEditor.bind(this),this.getServerSnapshot=this.getServerSnapshot.bind(this),this.subscribe=this.subscribe.bind(this),this.refreshEditorInstance=this.refreshEditorInstance.bind(this),this.scheduleDestroy=this.scheduleDestroy.bind(this),this.onRender=this.onRender.bind(this),this.createEditor=this.createEditor.bind(this)}setEditor(e){this.editor=e,this.instanceId=Math.random().toString(36).slice(2,9),this.subscriptions.forEach(e=>e())}getInitialEditor(){let e=this.options.current.immediatelyRender,t=e??!0;return(Ss||Cs&&e===void 0)&&(t=!1),t?this.createEditor():null}createEditor(){return new ua({...this.options.current,onBeforeCreate:(...e)=>{var t;return(t=this.options.current).onBeforeCreate?.call(t,...e)},onBlur:(...e)=>{var t;return(t=this.options.current).onBlur?.call(t,...e)},onCreate:(...e)=>{var t;return(t=this.options.current).onCreate?.call(t,...e)},onDestroy:(...e)=>{var t;return(t=this.options.current).onDestroy?.call(t,...e)},onFocus:(...e)=>{var t;return(t=this.options.current).onFocus?.call(t,...e)},onSelectionUpdate:(...e)=>{var t;return(t=this.options.current).onSelectionUpdate?.call(t,...e)},onTransaction:(...e)=>{var t;return(t=this.options.current).onTransaction?.call(t,...e)},onUpdate:(...e)=>{var t;return(t=this.options.current).onUpdate?.call(t,...e)},onContentError:(...e)=>{var t;return(t=this.options.current).onContentError?.call(t,...e)},onDrop:(...e)=>{var t;return(t=this.options.current).onDrop?.call(t,...e)},onPaste:(...e)=>{var t;return(t=this.options.current).onPaste?.call(t,...e)},onDelete:(...e)=>{var t;return(t=this.options.current).onDelete?.call(t,...e)},onMount:(...e)=>{var t;return(t=this.options.current).onMount?.call(t,...e)},onUnmount:(...e)=>{var t;return(t=this.options.current).onUnmount?.call(t,...e)}})}getEditor(){return this.editor}getServerSnapshot(){return null}subscribe(e){return this.subscriptions.add(e),()=>{this.subscriptions.delete(e)}}static compareOptions(e,t){return Object.keys(e).every(n=>[`onCreate`,`onBeforeCreate`,`onDestroy`,`onUpdate`,`onTransaction`,`onFocus`,`onBlur`,`onSelectionUpdate`,`onContentError`,`onDrop`,`onPaste`].includes(n)?!0:n===`extensions`&&e.extensions&&t.extensions?e.extensions.length===t.extensions.length&&e.extensions.every((e,n)=>e===t.extensions?.[n]):e[n]===t[n])}onRender(t){return()=>(this.isComponentMounted=!0,clearTimeout(this.scheduledDestructionTimeout),this.editor&&!this.editor.isDestroyed&&t.length===0?e.compareOptions(this.options.current,this.editor.options)||this.editor.setOptions({...this.options.current,editable:this.editor.isEditable}):this.refreshEditorInstance(t),()=>{this.isComponentMounted=!1,this.scheduleDestroy()})}refreshEditorInstance(e){if(this.editor&&!this.editor.isDestroyed){if(this.previousDeps===null){this.previousDeps=e;return}if(this.previousDeps.length===e.length&&this.previousDeps.every((t,n)=>t===e[n]))return}this.editor&&!this.editor.isDestroyed&&this.editor.destroy(),this.setEditor(this.createEditor()),this.previousDeps=e}scheduleDestroy(){let e=this.instanceId,t=this.editor;this.scheduledDestructionTimeout=setTimeout(()=>{this.isComponentMounted&&this.instanceId===e?t&&t.setOptions(this.options.current):t&&!t.isDestroyed&&(t.destroy(),this.instanceId===e&&this.setEditor(null))},1)}};function Ts(e={},t=[]){let n=(0,X.useRef)(e);n.current=e;let[r]=(0,X.useState)(()=>new ws(n)),i=(0,ao.useSyncExternalStore)(r.subscribe,r.getEditor,r.getServerSnapshot);return(0,X.useDebugValue)(i),(0,X.useEffect)(r.onRender(t)),xs({editor:i,selector:({transactionNumber:t})=>e.shouldRerenderOnTransaction===!1||e.shouldRerenderOnTransaction===void 0?null:e.immediatelyRender&&t===0?0:t+1}),i}var Es=(0,X.createContext)({editor:null});Es.Consumer;var Ds=(0,X.createContext)({onDragStart:()=>{},nodeViewContentChildren:void 0,nodeViewContentRef:()=>{}}),Os=()=>(0,X.useContext)(Ds),ks=X.forwardRef((e,t)=>{let{onDragStart:n}=Os(),r=e.as||`div`;return(0,Z.jsx)(r,{...e,ref:t,"data-node-view-wrapper":``,onDragStart:n,style:{whiteSpace:`normal`,...e.style}})});function As(e){return!!(typeof e==`function`&&e.prototype&&e.prototype.isReactComponent)}function js(e){return!(typeof e!=`object`||!e.$$typeof||e.$$typeof.toString()!==`Symbol(react.forward_ref)`&&e.$$typeof.description!==`react.forward_ref`)}function Ms(e){return!(typeof e!=`object`||!e.$$typeof||e.$$typeof.toString()!==`Symbol(react.memo)`&&e.$$typeof.description!==`react.memo`)}function Ns(e){if(As(e)||js(e))return!0;if(Ms(e)){let t=e.type;if(t)return As(t)||js(t)}return!1}function Ps(){try{if(X.version)return parseInt(X.version.split(`.`)[0],10)>=19}catch{}return!1}var Fs=class{constructor(e,{editor:t,props:n={},as:r=`div`,className:i=``}){this.ref=null,this.destroyed=!1,this.id=Math.floor(Math.random()*4294967295).toString(),this.component=e,this.editor=t,this.props=n,this.element=document.createElement(r),this.element.classList.add(`react-renderer`),i&&this.element.classList.add(...i.split(` `)),this.editor.isEditorContentInitialized?(0,io.flushSync)(()=>{this.render()}):queueMicrotask(()=>{this.destroyed||this.render()})}render(){var e;if(this.destroyed)return;let t=this.component,n=this.props,r=this.editor,i=Ps(),a=Ns(t),o={...n};o.ref&&!(i||a)&&delete o.ref,!o.ref&&(i||a)&&(o.ref=e=>{this.ref=e}),this.reactElement=(0,Z.jsx)(t,{...o}),r==null||(e=r.contentComponent)==null||e.setRenderer(this.id,this)}updateProps(e={}){if(this.destroyed)return;let t=!1,n=Object.keys(e);for(let r=0;r<n.length;r+=1){let i=n[r];if(e[i]!==this.props[i]){t=!0;break}}t&&(this.props={...this.props,...e},this.render())}destroy(){var e;this.destroyed=!0;let t=this.editor;t==null||(e=t.contentComponent)==null||e.removeRenderer(this.id);try{this.element&&this.element.parentNode&&this.element.parentNode.removeChild(this.element)}catch{}}updateAttributes(e){Object.keys(e).forEach(t=>{this.element.setAttribute(t,e[t])})}},Is=X.createContext({markViewContentRef:()=>{}}),Ls=class extends Mi{constructor(e,t,n){super(e,t,n);let{as:r=`span`,attrs:i,className:a=``}=n||{},o={...t,updateAttributes:this.updateAttributes.bind(this)};this.contentDOMElement=document.createElement(`span`);let s={markViewContentRef:e=>{e&&!e.contains(this.contentDOMElement)&&e.appendChild(this.contentDOMElement)}},c=X.memo(t=>(0,Z.jsx)(Is.Provider,{value:s,children:X.createElement(e,t)}));c.displayName=`ReactMarkView`,this.renderer=new Fs(c,{editor:t.editor,props:o,as:r,className:`mark-${t.mark.type.name} ${a}`.trim()}),i&&this.renderer.updateAttributes(i)}get dom(){return this.renderer.element}get contentDOM(){return this.contentDOMElement}};function Rs(e,t={}){return n=>new Ls(e,n,t)}function zs(e){var t;let n=e.getRootNode(),r=typeof n.getSelection==`function`?n.getSelection():(t=e.ownerDocument)==null||(t=t.defaultView)==null?void 0:t.getSelection();if(!r||r.rangeCount===0)return null;let{anchorNode:i,anchorOffset:a,focusNode:o,focusOffset:s}=r;return!i||!o||!e.contains(i)||!e.contains(o)?null:()=>{try{r.setBaseAndExtent(i,a,o,s)}catch{}}}function Bs(e,t,n){return e.node(n)===t.node(n)&&e.before(n)===t.before(n)}function Vs(e){if(!xt(e))return[];let{$from:t,$to:n}=e,r=[],i=Math.min(t.depth,n.depth);for(let e=1;e<=i&&Bs(t,n,e);e+=1)r.push(t.before(e));return r}var Hs=class{constructor(e){this.views=new WeakMap,this.viewCount=0,this.insideViews=new Set,this.syncQueued=!1,this.scheduleSync=()=>{this.syncQueued||(this.syncQueued=!0,queueMicrotask(()=>{this.syncQueued=!1,this.sync()}))},this.handleTransaction=()=>this.scheduleSync(),this.editor=e}register(e){this.viewCount===0&&this.editor.on(`transaction`,this.handleTransaction),this.views.set(e.dom,e),this.viewCount+=1,this.scheduleSync()}unregister(e){this.views.delete(e.dom),--this.viewCount,this.insideViews.delete(e),this.viewCount===0&&this.editor.off(`transaction`,this.handleTransaction)}sync(){if(this.viewCount===0||this.editor.isDestroyed)return;let e=this.findInsideViews();this.updateViews(this.insideViews,e,!1),this.updateViews(e,this.insideViews,!0),this.insideViews=e}updateViews(e,t,n){for(let r of e)t.has(r)||r.setSelectionInside(n)}findInsideViews(){let e=new Set;for(let t of Vs(this.editor.state.selection)){let n=this.editor.view.nodeDOM(t),r=n?this.views.get(n):void 0;r&&e.add(r)}return e}},Us=new WeakMap;function Ws(e){let t=Us.get(e);return t||(t=new Hs(e),Us.set(e,t)),t}var Gs=class extends ha{constructor(e,t,n){if(super(e,t,n),this.nodeSelected=!1,this.handlePositionUpdate=()=>{let e=this.getPos();typeof e==`number`&&e!==this.currentPos&&(this.currentPos=e,this.renderer.updateProps({getPos:()=>this.getPos()}),typeof this.options.attrs==`function`&&this.updateElementAttributes())},this.cachedExtensionWithSyncedStorage=null,!this.node.isLeaf){this.contentDOMElement=this.options.contentDOMElementTag?document.createElement(this.options.contentDOMElementTag):document.createElement(this.node.isInline?`span`:`div`),this.contentDOMElement.dataset.nodeViewContentReact=``,this.contentDOMElement.dataset.nodeViewWrapper=``,this.contentDOMElement.style.whiteSpace=`inherit`;let e=this.dom.querySelector(`[data-node-view-content]`);e?e.appendChild(this.contentDOMElement):this.dom.appendChild(this.contentDOMElement)}this.options.trackNodeViewPosition&&this.editor.on(`update`,this.handlePositionUpdate)}get extensionWithSyncedStorage(){if(!this.cachedExtensionWithSyncedStorage){let e=this.editor,t=this.extension;this.cachedExtensionWithSyncedStorage=new Proxy(t,{get(n,r,i){return r===`storage`?e.storage[t.name]??{}:Reflect.get(n,r,i)}})}return this.cachedExtensionWithSyncedStorage}mount(){let e={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,selectionInside:!1,extension:this.extensionWithSyncedStorage,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode(),ref:(0,X.createRef)()};if(!this.component.displayName){let e=e=>e.charAt(0).toUpperCase()+e.substring(1);this.component.displayName=e(this.extension.name)}let t={onDragStart:this.onDragStart.bind(this),nodeViewContentRef:e=>{if(e&&this.contentDOMElement&&e.firstChild!==this.contentDOMElement){e.hasAttribute(`data-node-view-wrapper`)&&e.removeAttribute(`data-node-view-wrapper`);let t=zs(this.contentDOMElement);e.appendChild(this.contentDOMElement),t?.()}}},n=this.component,r=(0,X.memo)(e=>(0,Z.jsx)(Ds.Provider,{value:t,children:(0,X.createElement)(n,e)}));r.displayName=`ReactNodeView`;let i=this.node.isInline?`span`:`div`;this.options.as&&(i=this.options.as);let{className:a=``}=this.options;this.renderer=new Fs(r,{editor:this.editor,props:e,as:i,className:`node-${this.node.type.name} ${a}`.trim()}),Ws(this.editor).register(this),this.updateElementAttributes(),this.currentPos=this.getPos()}get dom(){if(this.renderer.element.firstElementChild&&!this.renderer.element.firstElementChild?.hasAttribute(`data-node-view-wrapper`))throw Error(`Please use the NodeViewWrapper component for your node view.`);return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}update(e,t,n){let r=e=>{this.renderer.updateProps(e),typeof this.options.attrs==`function`&&this.updateElementAttributes()};if(e.type!==this.node.type)return!1;if(typeof this.options.update==`function`){let i=this.node,a=this.decorations,o=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=this.getPos(),this.options.update({oldNode:i,oldDecorations:a,newNode:e,newDecorations:t,oldInnerDecorations:o,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage})})}if(e===this.node)return this.node=e,this.decorations=t,this.innerDecorations=n,!0;let i=this.getPos();this.node=e,this.decorations=t,this.innerDecorations=n,this.currentPos=i;let a={node:e,decorations:t,innerDecorations:n,extension:this.extensionWithSyncedStorage};return this.options.trackNodeViewPosition&&(a.getPos=()=>this.getPos()),r(a),!0}selectNode(){this.nodeSelected=!0,this.updateSelectedState(!0)}deselectNode(){this.nodeSelected=!1,this.updateSelectedState(this.options.selectedOnTextSelection===!0&&this.isTextSelectionInside())}setSelectionInside(e){let t=this.nodeSelected||this.options.selectedOnTextSelection===!0&&e;this.renderer.updateProps({selectionInside:e,selected:t}),this.renderer.element.classList.toggle(`ProseMirror-selectednode`,t)}updateSelectedState(e){this.renderer.updateProps({selected:e}),this.renderer.element.classList.toggle(`ProseMirror-selectednode`,e)}isTextSelectionInside(){let e=this.getPos();return typeof e==`number`&&Vs(this.editor.state.selection).includes(e)}destroy(){this.renderer.destroy(),Ws(this.editor).unregister(this),this.options.trackNodeViewPosition&&this.editor.off(`update`,this.handlePositionUpdate),this.contentDOMElement=null}updateElementAttributes(){if(this.options.attrs){let e={};if(typeof this.options.attrs==`function`){let t=this.editor.extensionManager.attributes,n=B(this.node,t);e=this.options.attrs({node:this.node,HTMLAttributes:n})}else e=this.options.attrs;this.renderer.updateAttributes(e)}}};function Ks(e,t){return n=>n.editor.contentComponent?new Gs(e,n,t):{dom:document.createElement(`span`),contentDOM:null,update:()=>!1,destroy:()=>{},selectNode:()=>{},deselectNode:()=>{},stopEvent:()=>!1,ignoreMutation:()=>!0}}var qs=(0,X.createContext)({get editor(){throw Error(`useTiptap must be used within a <Tiptap> provider`)}});qs.displayName=`TiptapContext`;var Js=()=>(0,X.useContext)(qs);function Ys({children:e,...t}){let n=`editor`in t?t.editor:t.instance;if(!n)throw Error("Tiptap: An editor instance is required. Pass a non-null `editor` prop.");let r=(0,X.useMemo)(()=>({editor:n}),[n]),i=(0,X.useMemo)(()=>({editor:n}),[n]);return(0,Z.jsx)(Es.Provider,{value:i,children:(0,Z.jsx)(qs.Provider,{value:r,children:e})})}Ys.displayName=`Tiptap`;function Xs({...e}){let{editor:t}=Js();return(0,Z.jsx)(vs,{editor:t,...e})}Xs.displayName=`Tiptap.Content`,Object.assign(Ys,{Content:Xs});export{lr as $,R as A,Xn as B,xa as C,W as D,Ni as E,hn as F,N as G,vt as H,_n as I,Hn as J,$n as K,gn as L,mn as M,dn as N,ma as O,aa as P,cr as Q,vn as R,Da as S,G as T,Zn as U,L as V,Qn as W,ar as X,ir as Y,Yt as Z,La as _,Gs as a,hr as at,Ma as b,Os as c,fa as ct,Xa as d,ze as dt,K as et,Ga as f,je as ft,Ha as g,Va as h,Rs as i,Ei as it,xi as j,Vi as k,ls as l,pa as lt,Wa as m,ks as n,z as nt,Ks as o,ki as ot,Ua as p,we as pt,B as q,Is as r,da as rt,Ts as s,Nt as st,vs as t,q as tt,ro as u,Fe as ut,Ra as v,ua as w,Ea as x,ja as y,qn as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-COiEfhsA.js";import{d as t,h as n,l as r,o as i,p as a,s as o,u as ee,y as s}from"./react-WA6wlt8S.js";import{Tt as te,bt as c,gt as l,t as u,yt as d}from"./button-eGxLxbv9.js";import{A as f,B as p,P as m,Y as h,et as g,o as ne,tt as _,x as v}from"./snapshots-BUGlKQIB.js";import{t as y}from"./jsx-runtime-DePvh3-m.js";import{t as b}from"./createLucideIcon-GFZ_fxLc.js";import{C as re,a as ie,b as ae,w as oe,x as se,y as ce}from"./dist-CC7OeU1e.js";import{t as le}from"./palette-BIOudGkm.js";import{i as ue,n as x,r as S,t as C}from"./hint-B8JpEypy.js";import{gt as w,n as T}from"./index-CgB5osVc.js";import{t as E}from"./swatch-WeJD41aW.js";var D=b(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),O=b(`monitor`,[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]),k=b(`smartphone`,[[`rect`,{width:`14`,height:`20`,x:`5`,y:`2`,rx:`2`,ry:`2`,key:`1yt0o3`}],[`path`,{d:`M12 18h.01`,key:`mhygvu`}]]),A=b(`tablet`,[[`rect`,{width:`16`,height:`20`,x:`4`,y:`2`,rx:`2`,ry:`2`,key:`76otgf`}],[`line`,{x1:`12`,x2:`12.01`,y1:`18`,y2:`18`,key:`1dp563`}]]),j=e(s(),1),M=y(),N=/^(#[0-9a-f]{3,8}|(?:rgb|rgba|hsl|hsla|oklch|oklab|lab|lch)\([^)]*\))$/iu;function P(e){let t=new Map;for(let n of e.matchAll(/\[data-theme="([\w-]+)"\]\s*\{([^}]*)\}/gu)){let e=n[1]??``;if(e===``||t.has(e))continue;let r=[];for(let e of(n[2]??``).split(`;`)){let t=e.slice(e.indexOf(`:`)+1).trim();e.includes(`:`)&&N.test(t)&&r.push(t)}t.set(e,{name:e,colors:r})}return[...t.values()]}function F(e,t){let n=RegExp(`\\s${t}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s"'=<>\`]+))`,`iu`).exec(e);if(n)return{value:n[1]??n[2]??n[3]??``,at:n.index,length:n[0].length}}function I(e){let t=[];for(let n of e.matchAll(/<link\b[^>]*>/giu)){let e=n[0],r=F(e,`rel`)?.value.toLowerCase().split(/\s+/u)??[],i=F(e,`href`)?.value;r.includes(`stylesheet`)&&i&&t.push(i)}return t}var L=e=>/<html\b[^>]*>/iu.exec(e);function R(e){let t=L(e),n=t?F(t[0],`data-theme`)?.value:void 0;return n===void 0||n===``?void 0:n}function z(e,t){let n=L(e);if(!n)return;let r=n.index,i=F(n[0],`data-theme`),a=i?`${n[0].slice(0,i.at)} data-theme="${t}"${n[0].slice(i.at+i.length)}`:`<html data-theme="${t}"${n[0].slice(5)}`;return`${e.slice(0,r)}${a}${e.slice(r+n[0].length)}`}function B(e,t){if(/^[a-z][a-z0-9+.-]*:|^\/\//iu.test(t))return;let n=new URL(t,`file:///${e}`),r=decodeURIComponent(n.pathname).replace(/^\/+/u,``);return r===``?void 0:r}var V=g({item:f}),H={width:h().int().positive().max(4096),height:h().int().positive().max(4096)},U={"report/still":m(V.extend({...H,scale:h().positive().max(4).default(1),hold:_().optional()}),g({image:g({mime:_(),data:_()})}),`A report's page drawn as the render draws it, at a frame's size from its top: what Mark up lays over a report's frame, which the window cannot read.`),"report/hold":m(V.extend({...H,scale:h().positive().max(4).default(1)}),g({hold:_()}),`A report's page opened at a frame's size and kept as it is while a person marks it: report/still and report/at draw and read it as it was, until report/release.`),"report/release":m(g({hold:_()}),g({}),`Lets a page held for notes go.`),"report/at":m(V.extend({...H,points:p(g({x:h(),y:h()})).min(1).max(24),hold:_().optional()}),g({elements:p(g({selector:_(),tag:_(),text:_()}))}),`What is at places of a report's page drawn at a frame's size from its top (as report/still draws it): what a person's mark on its frame is on.`)},W=v(U),G=d({en:{starting:`Opening the report…`,failed:`The report could not be shown`,copy:`Copy details`,retry:`Retry`,asleep:`A report's preview needs the agent awake.`,edit:`Edit`,width:`Width`,fit:`Fit the window`,desktop:`Desktop`,tablet:`Tablet`,phone:`Phone`,theme:`Theme`,wide:(e,t)=>`${e}, ${String(t)} px`},"zh-cn":{starting:`正在打开报告…`,failed:`报告没能显示出来`,copy:`复制详情`,retry:`重试`,asleep:`报告预览需要 Agent 处于唤醒状态。`,edit:`编辑`,width:`宽度`,fit:`适应窗口`,desktop:`桌面`,tablet:`平板`,phone:`手机`,theme:`主题`,wide:(e,t)=>`${e}, ${String(t)} px`},"zh-tw":{starting:`正在開啟報告…`,failed:`報告沒能顯示出來`,copy:`複製詳情`,retry:`重試`,asleep:`報告預覽需要 Agent 處於喚醒狀態。`,edit:`編輯`,width:`寬度`,fit:`符合視窗`,desktop:`桌面`,tablet:`平板`,phone:`手機`,theme:`主題`,wide:(e,t)=>`${e}, ${String(t)} px`},ja:{starting:`レポートを開いています…`,failed:`レポートを表示できませんでした`,copy:`詳細をコピー`,retry:`再試行`,asleep:`レポートのプレビューにはエージェントの起動が必要です。`,edit:`編集`,width:`幅`,fit:`ウィンドウに合わせる`,desktop:`デスクトップ`,tablet:`タブレット`,phone:`スマートフォン`,theme:`テーマ`,wide:(e,t)=>`${e}, ${String(t)} px`},ko:{starting:`리포트를 여는 중…`,failed:`리포트를 표시하지 못했습니다`,copy:`세부 정보 복사`,retry:`다시 시도`,asleep:`리포트 미리 보기는 에이전트가 깨어 있어야 합니다.`,edit:`편집`,width:`너비`,fit:`창에 맞추기`,desktop:`데스크톱`,tablet:`태블릿`,phone:`휴대폰`,theme:`테마`,wide:(e,t)=>`${e}, ${String(t)} px`},es:{starting:`Abriendo el informe…`,failed:`No se pudo mostrar el informe`,copy:`Copiar detalles`,retry:`Reintentar`,asleep:`La vista previa de un informe necesita al agente activo.`,edit:`Editar`,width:`Ancho`,fit:`Ajustar a la ventana`,desktop:`Escritorio`,tablet:`Tableta`,phone:`Teléfono`,theme:`Tema`,wide:(e,t)=>`${e}, ${String(t)} px`},fr:{starting:`Ouverture du rapport…`,failed:`Le rapport n’a pas pu s’afficher`,copy:`Copier les détails`,retry:`Réessayer`,asleep:`L’aperçu d’un rapport a besoin de l’agent éveillé.`,edit:`Modifier`,width:`Largeur`,fit:`Ajuster à la fenêtre`,desktop:`Ordinateur`,tablet:`Tablette`,phone:`Téléphone`,theme:`Thème`,wide:(e,t)=>`${e}, ${String(t)} px`},de:{starting:`Bericht wird geöffnet…`,failed:`Der Bericht konnte nicht angezeigt werden`,copy:`Details kopieren`,retry:`Erneut versuchen`,asleep:`Die Vorschau eines Berichts braucht den wachen Agenten.`,edit:`Bearbeiten`,width:`Breite`,fit:`An Fenster anpassen`,desktop:`Desktop`,tablet:`Tablet`,phone:`Smartphone`,theme:`Farbschema`,wide:(e,t)=>`${e}, ${String(t)} px`},pt:{starting:`Abrindo o relatório…`,failed:`Não foi possível mostrar o relatório`,copy:`Copiar detalhes`,retry:`Tentar novamente`,asleep:`A prévia de um relatório precisa do agente ativo.`,edit:`Editar`,width:`Largura`,fit:`Ajustar à janela`,desktop:`Desktop`,tablet:`Tablet`,phone:`Celular`,theme:`Tema`,wide:(e,t)=>`${e}, ${String(t)} px`}}),K={desktop:1440,tablet:768,phone:375},de={fit:D,desktop:O,tablet:A,phone:k};function q({className:e}){let t=o();if(t===void 0)return null;let{id:n,entry:r}=t.item;return(0,M.jsx)(Y,{id:n,entry:r,w:G.of(c(t.locale)),className:e},n)}function fe(e,t){let n=i(),[r,a]=(0,j.useState)({themes:[],current:void 0});return(0,j.useEffect)(()=>{let t=new AbortController;return(async()=>{let{text:r}=await n[`files/read`]({path:e}),i=new Map;for(let t of I(r)){let r=B(e,t);if(r===void 0)continue;let a=await n[`files/read`]({path:r}).then(e=>e.text,()=>``);for(let e of P(a))i.has(e.name)||i.set(e.name,e)}t.signal.aborted||a({themes:[...i.values()],current:R(r)})})().catch(()=>void 0),()=>{t.abort()}},[n,e,t]),r}var pe=e=>{let t=e.at(0)??`transparent`;return`linear-gradient(135deg, ${t} 50%, ${e.at(-1)??t} 50%)`};function J(e){let[t,n]=(0,j.useState)({width:0,height:0});return(0,j.useLayoutEffect)(()=>{let t=e.current;if(!t)return;let r=new ResizeObserver(([e])=>{e&&n({width:e.contentRect.width,height:e.contentRect.height})});return r.observe(t),()=>{r.disconnect()}},[e]),t}function Y({id:e,entry:o,w:s,className:c}){let d=i(),f=e.slice(e.lastIndexOf(`/`)+1),[p,m]=(0,j.useState)({at:`starting`}),[h,g]=(0,j.useState)(0),[_,v]=(0,j.useState)(`fit`),[y,b]=(0,j.useState)(0);r(e,()=>{b(e=>e+1)});let[D,O]=(0,j.useState)(0),{themes:k,current:A}=fe(o,y),N=a(),P=n(),F=!N&&!P&&k.length>0,[I,L]=(0,j.useState)(),R=I!==void 0&&I.over===A?I.name:A,B=async e=>{L({name:e,over:A});for(let t=0;t<2;t++){let{text:n,version:r}=await d[`files/read`]({path:o}),i=z(n,e);if(i===void 0||i===n)return;try{await d[`files/write`]({path:o,text:i,over:r});return}catch(e){if(t===1)throw e}}},V=(0,j.useRef)(null),H=J(V),U=(0,j.useRef)(null);(0,j.useEffect)(()=>{let t=!0;return w(d,`items/page`,{item:e}).then(({url:e})=>{t&&m({at:`ready`,url:e})},e=>{t&&m(ne(e)?{at:`asleep`}:{at:`failed`,message:e instanceof Error?e.message:String(e)})}),()=>{t=!1}},[d,e,h]);let G=_===`fit`?Math.max(1,Math.round(H.width)):K[_],q=H.width>0?Math.min(1,H.width/G):1,Y=q>0?Math.round(H.height/q):H.height;t({hold:()=>Promise.resolve({key:`report@${e}@${crypto.randomUUID()}`,what:f,source:{path:o}}),locate:()=>Promise.resolve({elements:[]})});let X=()=>{let e=U.current?.getBoundingClientRect();return e&&e.width>0&&e.height>0?{x:e.x,y:e.y,width:e.width,height:e.height}:void 0},Z=(0,j.useRef)(void 0),Q=()=>Z.current??Promise.resolve(void 0),$=()=>Math.min(4,Math.max(1,window.devicePixelRatio*q));return ee({element:()=>U.current,hold:()=>(Z.current=W(d,`report/hold`,{item:e,width:G,height:Y,scale:$()}).then(e=>e.hold,()=>void 0),Z.current.then(()=>void 0)),release:()=>{let e=Z.current;Z.current=void 0,e?.then(e=>e===void 0?void 0:W(d,`report/release`,{hold:e}).catch(()=>void 0))},pictures:async()=>{let t=X();if(!t)return[];let n=await Q(),{image:r}=await W(d,`report/still`,{item:e,width:G,height:Y,scale:$(),...n===void 0?{}:{hold:n}});return[{...r,rect:t}]},locate:async t=>{let n=X(),r=n?te(t).map(e=>({x:(e.x-n.x)/q,y:(e.y-n.y)/q})).filter(e=>e.x>=0&&e.y>=0&&e.x<=G&&e.y<=Y):[],i=await Q(),a=r.length>0?await W(d,`report/at`,{item:e,width:G,height:Y,points:r,...i===void 0?{}:{hold:i}}).catch(()=>void 0):void 0;return{elements:a&&a.elements.length>0?a.elements.map(e=>({name:`the element ${e.selector} of the report`,source:{path:o},...e.text===``?{}:{text:e.text}})):[{name:`the report ${f}`,source:{path:o}}],where:`on the report ${f}, ${String(G)} px wide, from its top`}}}),p.at===`asleep`?(0,M.jsxs)(`div`,{className:l(`absolute inset-0 flex flex-col items-center justify-center gap-3 p-6`,c),children:[(0,M.jsx)(`p`,{className:`text-sm text-lead`,children:s.asleep}),(0,M.jsx)(u,{size:`xs`,onClick:()=>{d[`edit/request`]({}).catch(()=>void 0)},children:s.edit})]}):(0,M.jsxs)(`div`,{className:l(`absolute inset-0 flex flex-col`,c),children:[(0,M.jsx)(ie,{start:(0,M.jsxs)(C,{children:[F&&(0,M.jsxs)(se,{children:[(0,M.jsx)(oe,{asChild:!0,children:(0,M.jsxs)(T,{"data-testid":`report-theme`,children:[(0,M.jsx)(le,{}),s.theme]})}),(0,M.jsx)(re,{align:`start`,className:`w-auto p-3`,children:(0,M.jsx)(`div`,{role:`radiogroup`,"aria-label":s.theme,className:`flex flex-wrap gap-1.5`,children:k.map(e=>(0,M.jsx)(E,{color:pe(e.colors),label:e.name,checked:e.name===R,onClick:()=>{B(e.name).catch(()=>{L(void 0)})}},e.name))})})]}),(0,M.jsx)(ce,{type:`single`,size:`sm`,"aria-label":s.width,value:_,onValueChange:e=>{(e===`fit`||e in K)&&v(e)},children:[`fit`,`desktop`,`tablet`,`phone`].map(e=>{let t=de[e],n=e===`fit`?s.fit:s.wide(s[e],K[e]);return(0,M.jsxs)(S,{children:[(0,M.jsx)(x,{asChild:!0,children:(0,M.jsx)(ae,{value:e,"aria-label":n,children:(0,M.jsx)(t,{className:`size-4`})})}),(0,M.jsx)(ue,{children:n})]},e)})})]})}),(0,M.jsxs)(`div`,{ref:V,className:`relative min-h-0 flex-1 overflow-hidden bg-shade`,children:[p.at===`ready`&&H.width>0&&(D===y?[y]:[D,y]).map(e=>{let t=e===D;return(0,M.jsx)(`iframe`,{ref:t?U:void 0,title:f,src:p.url,"data-testid":t?`report`:void 0,"aria-hidden":!t||void 0,tabIndex:t?void 0:-1,sandbox:`allow-scripts allow-same-origin allow-popups allow-popups-to-escape-sandbox`,className:`absolute top-0 border-0 bg-page`,onLoad:t?void 0:()=>{setTimeout(()=>{O(t=>e>t?e:t)},250)},style:{width:G,height:Y,left:Math.max(0,(H.width-G*q)/2),transform:`scale(${String(q)})`,transformOrigin:`top left`,zIndex:+!!t}},e)}),p.at===`starting`&&(0,M.jsx)(`div`,{className:`absolute inset-0 flex items-center justify-center text-sm text-lead`,children:(0,M.jsx)(`span`,{className:`animate-pulse`,children:s.starting})}),p.at===`failed`&&(0,M.jsxs)(`div`,{className:`absolute inset-0 flex flex-col items-center justify-center gap-3 p-6`,children:[(0,M.jsx)(`p`,{className:`text-sm text-ink`,children:s.failed}),(0,M.jsxs)(`div`,{className:`flex gap-1.5`,children:[(0,M.jsx)(u,{size:`xs`,variant:`ghost`,className:`text-lead`,onClick:()=>{navigator.clipboard.writeText(p.message).catch(()=>void 0)},children:s.copy}),(0,M.jsx)(u,{size:`xs`,onClick:()=>{m({at:`starting`}),g(e=>e+1)},children:s.retry})]})]})]})]})}export{G as WORDS,q as default};
|