markdown-flow-ui 0.3.2-dev.1 → 0.3.2
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/README.md +0 -13
- package/dist/_virtual/index.es6.js +3 -5
- package/dist/_virtual/index.es6.js.map +1 -1
- package/dist/_virtual/index.es7.js +5 -3
- package/dist/_virtual/index.es7.js.map +1 -1
- package/dist/_virtual/index.es8.js +2 -2
- package/dist/_virtual/index.es9.js +2 -2
- package/dist/_virtual/index6.cjs +1 -1
- package/dist/_virtual/index7.cjs +1 -1
- package/dist/_virtual/index8.cjs +1 -1
- package/dist/_virtual/index9.cjs +1 -1
- package/dist/assets/markdown-flow-ui.css +1 -1
- package/dist/components/ContentRender/IframeSandbox.cjs.map +1 -1
- package/dist/components/ContentRender/IframeSandbox.es.js.map +1 -1
- package/dist/components/ContentRender/utils/video-markdown-run.cjs.map +1 -1
- package/dist/components/ContentRender/utils/video-markdown-run.es.js.map +1 -1
- package/dist/components/MarkdownFlow/ScrollToBottomButton.cjs.map +1 -1
- package/dist/components/MarkdownFlow/ScrollToBottomButton.es.js.map +1 -1
- package/dist/components/MarkdownFlow/ScrollToBottomControl.cjs.map +1 -1
- package/dist/components/MarkdownFlow/ScrollToBottomControl.es.js.map +1 -1
- package/dist/components/MarkdownFlow/useScrollToBottom.cjs.map +1 -1
- package/dist/components/MarkdownFlow/useScrollToBottom.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.d.ts +2 -2
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js +323 -558
- package/dist/components/MarkdownFlowEditor/MarkdownFlowEditor.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.d.ts +0 -8
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js +64 -107
- package/dist/components/MarkdownFlowEditor/components/EditorToolbar.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/editor-context.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/editor-context.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/editor-context.es.js +4 -10
- package/dist/components/MarkdownFlowEditor/editor-context.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/editorI18n.d.ts +0 -308
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js +87 -115
- package/dist/components/MarkdownFlowEditor/locales/ar-SA.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js +88 -116
- package/dist/components/MarkdownFlowEditor/locales/de-DE.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js +88 -116
- package/dist/components/MarkdownFlowEditor/locales/en-US.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js +80 -108
- package/dist/components/MarkdownFlowEditor/locales/es-ES.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js +82 -110
- package/dist/components/MarkdownFlowEditor/locales/fil-PH.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js +86 -114
- package/dist/components/MarkdownFlowEditor/locales/fr-FR.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js +88 -116
- package/dist/components/MarkdownFlowEditor/locales/ja-JP.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js +85 -113
- package/dist/components/MarkdownFlowEditor/locales/th-TH.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js +94 -122
- package/dist/components/MarkdownFlowEditor/locales/ur-PK.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js +74 -102
- package/dist/components/MarkdownFlowEditor/locales/vi-VN.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.d.ts +1 -15
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js +72 -100
- package/dist/components/MarkdownFlowEditor/locales/zh-CN.json.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.d.ts +2 -1
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js +62 -53
- package/dist/components/MarkdownFlowEditor/plugins/ImgPlaceholder.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.d.ts +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/PlaceholderWidget.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs +3 -3
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.d.ts +1 -5
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js +149 -154
- package/dist/components/MarkdownFlowEditor/plugins/SyntaxHighlighter.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.d.ts +2 -1
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js +53 -42
- package/dist/components/MarkdownFlowEditor/plugins/VideoPlaceholder.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/types.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/types.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/types.d.ts +1 -11
- package/dist/components/MarkdownFlowEditor/types.es.js +2 -2
- package/dist/components/MarkdownFlowEditor/types.es.js.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs +1 -1
- package/dist/components/MarkdownFlowEditor/utils.cjs.map +1 -1
- package/dist/components/MarkdownFlowEditor/utils.d.ts +0 -10
- package/dist/components/MarkdownFlowEditor/utils.es.js +59 -73
- package/dist/components/MarkdownFlowEditor/utils.es.js.map +1 -1
- package/dist/components/Slide/MarkdownSlideScaling.cjs.map +1 -1
- package/dist/components/Slide/MarkdownSlideScaling.es.js.map +1 -1
- package/dist/components/Slide/MobilePlayerSettingsSheet.es.js +16 -16
- package/dist/components/Slide/Player.cjs.map +1 -1
- package/dist/components/Slide/Player.es.js.map +1 -1
- package/dist/components/Slide/Slide.cjs.map +1 -1
- package/dist/components/Slide/Slide.es.js.map +1 -1
- package/dist/components/Slide/SubtitleOverlay.cjs.map +1 -1
- package/dist/components/Slide/SubtitleOverlay.es.js.map +1 -1
- package/dist/components/Slide/slideI18n.cjs.map +1 -1
- package/dist/components/Slide/slideI18n.es.js.map +1 -1
- package/dist/components/Slide/useSlide.cjs.map +1 -1
- package/dist/components/Slide/useSlide.es.js.map +1 -1
- package/dist/components/Slide/utils/streamingNavigation.cjs.map +1 -1
- package/dist/components/Slide/utils/streamingNavigation.es.js.map +1 -1
- package/dist/components/ui/dialog.cjs +1 -1
- package/dist/components/ui/dialog.cjs.map +1 -1
- package/dist/components/ui/dialog.es.js +27 -27
- package/dist/components/ui/dialog.es.js.map +1 -1
- package/dist/lib/interaction-defaults.cjs.map +1 -1
- package/dist/lib/interaction-defaults.es.js.map +1 -1
- package/dist/markdown-flow-ui-lib.css +1 -1
- package/dist/markdown-flow-ui.css +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.cjs +1 -1
- package/dist/node_modules/@braintree/sanitize-url/dist/index.es.js +1 -1
- package/dist/node_modules/@radix-ui/react-context/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-context/dist/index.es.js +34 -49
- package/dist/node_modules/@radix-ui/react-context/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs +1 -5
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js +206 -220
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.es.js +50 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/primitive/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.es.js +34 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-compose-refs/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.es.js +82 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-context/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js +216 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-dismissable-layer/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.es.js +15 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-id/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.es.js +18 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-portal/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.es.js +104 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-presence/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.es.js +39 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js +13 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js +70 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-controllable-state/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.es.js +20 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-effect-event/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.es.js +7 -0
- package/dist/node_modules/@radix-ui/react-dialog/node_modules/@radix-ui/react-use-layout-effect/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.es.js +18 -9
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js +148 -100
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.es.js +34 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-compose-refs/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.es.js +39 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-primitive/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js +13 -0
- package/dist/node_modules/@radix-ui/react-focus-scope/node_modules/@radix-ui/react-use-callback-ref/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-id/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-id/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-id/dist/index.es.js +8 -8
- package/dist/node_modules/@radix-ui/react-id/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.es.js +1 -1
- package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.es.js +50 -0
- package/dist/node_modules/@radix-ui/react-primitive/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js +80 -41
- package/dist/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -1
- package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.es.js +34 -0
- package/dist/node_modules/@radix-ui/react-slot/node_modules/@radix-ui/react-compose-refs/dist/index.es.js.map +1 -0
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs +1 -1
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.cjs.map +1 -1
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.es.js +1 -1
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.cjs +2 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.cjs.map +1 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js +12 -0
- package/dist/node_modules/@radix-ui/react-tooltip/node_modules/@radix-ui/react-slot/dist/index.es.js.map +1 -0
- package/dist/node_modules/classnames/index.cjs +1 -1
- package/dist/node_modules/classnames/index.es.js +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.cjs +1 -1
- package/dist/node_modules/hast-util-to-jsx-runtime/lib/index.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-5PPSVZJV.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/c4Diagram-5PPSVZJV.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-2GRJ4B5K.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-2GRJ4B5K.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-NSK5VX7P.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/chunk-NSK5VX7P.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-JCYQIIEL.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-JCYQIIEL.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-OCEON4UE.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/classDiagram-v2-OCEON4UE.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-UKHOOZJN.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/flowDiagram-UKHOOZJN.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-PKOTCBZU.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/ganttDiagram-PKOTCBZU.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-SI44F4Z6.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/sequenceDiagram-SI44F4Z6.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-OKZ733FA.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-OKZ733FA.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-UEYNNEHI.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/stateDiagram-v2-UEYNNEHI.es.js +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-ULZ7WXOC.cjs +1 -1
- package/dist/node_modules/mermaid/dist/chunks/mermaid.core/swimlanesDiagram-ULZ7WXOC.es.js +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs +2 -2
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.cjs.map +1 -1
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.es.js +75 -72
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.es.js.map +1 -1
- package/package.json +10 -10
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs +0 -2
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.cjs.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.d.ts +0 -17
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js +0 -46
- package/dist/components/MarkdownFlowEditor/components/CustomPopover.es.js.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs +0 -2
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.cjs.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.d.ts +0 -18
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js +0 -184
- package/dist/components/MarkdownFlowEditor/components/VariableSearchDropdown.es.js.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs +0 -2
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.cjs.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.d.ts +0 -11
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js +0 -172
- package/dist/components/MarkdownFlowEditor/components/VariableSelect.es.js.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs +0 -2
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.cjs.map +0 -1
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.d.ts +0 -3
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js +0 -32
- package/dist/components/MarkdownFlowEditor/components/icons/SearchBracesIcon.es.js.map +0 -1
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs +0 -3
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.cjs.map +0 -1
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.d.ts +0 -9
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js +0 -53
- package/dist/components/MarkdownFlowEditor/plugins/VariablePlaceholder.es.js.map +0 -1
- package/dist/components/ui/popover.cjs +0 -2
- package/dist/components/ui/popover.cjs.map +0 -1
- package/dist/components/ui/popover.es.js +0 -24
- package/dist/components/ui/popover.es.js.map +0 -1
- package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs +0 -2
- package/dist/node_modules/@radix-ui/react-popover/dist/index.cjs.map +0 -1
- package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js +0 -241
- package/dist/node_modules/@radix-ui/react-popover/dist/index.es.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/braces.cjs +0 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/braces.cjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/braces.es.js +0 -25
- package/dist/node_modules/lucide-react/dist/esm/icons/braces.es.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/plus.cjs +0 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/plus.cjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/plus.es.js +0 -16
- package/dist/node_modules/lucide-react/dist/esm/icons/plus.es.js.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/search.cjs +0 -7
- package/dist/node_modules/lucide-react/dist/esm/icons/search.cjs.map +0 -1
- package/dist/node_modules/lucide-react/dist/esm/icons/search.es.js +0 -16
- package/dist/node_modules/lucide-react/dist/esm/icons/search.es.js.map +0 -1
- /package/dist/components/MarkdownFlowEditor/plugins/{VariablePlaceholder.test.d.ts → MediaPlaceholder.variables.test.d.ts} +0 -0
|
@@ -1,141 +1,113 @@
|
|
|
1
|
-
const o = "输入'/'快速插入内容", e = "请输入你的内容", t = "请输入你的内容,输入 / 唤起更多",
|
|
1
|
+
const o = "输入'/'快速插入内容", e = "请输入你的内容", t = "请输入你的内容,输入 / 唤起更多", F = "设置", M = "关闭", l = "添加图片", i = "添加视频", n = "请输入图片地址", N = "URL", Q = "预览", a = "请输入图片标题", s = "使用图片", c = "图片名称", j = "上传", d = "拖拽文件或点击上传", r = "正在上传...", u = "上传完成", g = "上传失败,请重试", b = "添加固定文本", h = "固定文本", y = "分割线", m = "图片标题", v = "缩放比例", A = "取消", T = "请输入图片地址", U = "请输入有效的图片地址", p = "请输入 B 站或 YouTube 视频链接", G = "URL", H = "预览", I = "使用资源", B = "请输入视频标题", J = "标题", C = "视频标题", L = "哔哩哔哩视频", P = "YouTube 视频", f = "请输入有效的 B 站或 YouTube 视频链接", K = "取消", x = "使用视频", R = "预览将在这里显示", D = "视频预览", W = "图片", X = "视频", O = "固定文本", V = "插入确定内容", Y = "插入链接", E = "插入按钮", S = "插入单选", Z = "选项1", _ = "选项2", k = "插入多选", w = "插入输入框", $ = "请输入", q = "插入图片", z = "插入视频", oo = {
|
|
2
2
|
placeholder: o,
|
|
3
3
|
placeholderCodeEdit: e,
|
|
4
4
|
placeholderQuickEdit: t,
|
|
5
5
|
dialogTitle: "设置",
|
|
6
6
|
dialogCloseLabel: "关闭",
|
|
7
7
|
dialogTitleImage: l,
|
|
8
|
-
dialogTitleVideo:
|
|
9
|
-
imageUrlPlaceholder:
|
|
8
|
+
dialogTitleVideo: i,
|
|
9
|
+
imageUrlPlaceholder: n,
|
|
10
10
|
imageUrlLabel: "URL",
|
|
11
11
|
imageRunButton: "预览",
|
|
12
|
-
imageTitlePlaceholder:
|
|
12
|
+
imageTitlePlaceholder: a,
|
|
13
13
|
imageUseButton: s,
|
|
14
14
|
imageDefaultTitle: c,
|
|
15
15
|
imageUploadLabel: "上传",
|
|
16
|
-
imageUploadPlaceholder:
|
|
17
|
-
imageUploading:
|
|
18
|
-
imageUploadSuccess:
|
|
19
|
-
imageUploadError:
|
|
20
|
-
fixedTextPlaceholder:
|
|
21
|
-
fixedTextTooltip:
|
|
16
|
+
imageUploadPlaceholder: d,
|
|
17
|
+
imageUploading: r,
|
|
18
|
+
imageUploadSuccess: u,
|
|
19
|
+
imageUploadError: g,
|
|
20
|
+
fixedTextPlaceholder: b,
|
|
21
|
+
fixedTextTooltip: h,
|
|
22
22
|
slashDivider: "分割线",
|
|
23
|
-
imageTitleLabel:
|
|
24
|
-
imageScaleLabel:
|
|
23
|
+
imageTitleLabel: m,
|
|
24
|
+
imageScaleLabel: v,
|
|
25
25
|
imageCancelButton: "取消",
|
|
26
26
|
imageUrlRequired: T,
|
|
27
|
-
imageInvalidUrl:
|
|
28
|
-
videoUrlPlaceholder:
|
|
27
|
+
imageInvalidUrl: U,
|
|
28
|
+
videoUrlPlaceholder: p,
|
|
29
29
|
videoUrlLabel: "URL",
|
|
30
30
|
videoRunButton: "预览",
|
|
31
31
|
videoUseButton: I,
|
|
32
|
-
videoTitlePlaceholder:
|
|
32
|
+
videoTitlePlaceholder: B,
|
|
33
33
|
videoTitleLabel: "标题",
|
|
34
|
-
videoDefaultTitle:
|
|
34
|
+
videoDefaultTitle: C,
|
|
35
35
|
videoDefaultTitleBilibili: L,
|
|
36
36
|
videoDefaultTitleYoutube: P,
|
|
37
|
-
videoInvalidUrl:
|
|
37
|
+
videoInvalidUrl: f,
|
|
38
38
|
videoCancelButton: "取消",
|
|
39
39
|
videoUseVideoButton: x,
|
|
40
|
-
videoPreviewPlaceholder:
|
|
41
|
-
videoPreviewTitle:
|
|
40
|
+
videoPreviewPlaceholder: R,
|
|
41
|
+
videoPreviewTitle: D,
|
|
42
42
|
slashImage: "图片",
|
|
43
43
|
slashVideo: "视频",
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
variableEmpty: O,
|
|
50
|
-
variableNamePlaceholder: w,
|
|
51
|
-
variableAlreadyExists: Y,
|
|
52
|
-
variableNameInvalid: y,
|
|
53
|
-
variableSectionSystem: k,
|
|
54
|
-
variableSectionCustom: q,
|
|
55
|
-
variableAddNew: A,
|
|
56
|
-
toolbarInsertNewVariable: F,
|
|
57
|
-
toolbarInsertExistingVariable: z,
|
|
58
|
-
toolbarConfirmOutput: M,
|
|
59
|
-
toolbarInsertLink: Q,
|
|
60
|
-
toolbarInsertButton: j,
|
|
61
|
-
toolbarInsertSingleChoice: G,
|
|
44
|
+
slashFixedText: O,
|
|
45
|
+
toolbarConfirmOutput: V,
|
|
46
|
+
toolbarInsertLink: Y,
|
|
47
|
+
toolbarInsertButton: E,
|
|
48
|
+
toolbarInsertSingleChoice: S,
|
|
62
49
|
toolbarChoiceOption1: "选项1",
|
|
63
50
|
toolbarChoiceOption2: "选项2",
|
|
64
|
-
toolbarInsertMultiChoice:
|
|
65
|
-
toolbarInsertInput:
|
|
51
|
+
toolbarInsertMultiChoice: k,
|
|
52
|
+
toolbarInsertInput: w,
|
|
66
53
|
toolbarInputPlaceholder: "请输入",
|
|
67
|
-
toolbarInsertImage:
|
|
68
|
-
toolbarInsertVideo:
|
|
69
|
-
questionPlaceholder: X
|
|
54
|
+
toolbarInsertImage: q,
|
|
55
|
+
toolbarInsertVideo: z
|
|
70
56
|
};
|
|
71
57
|
export {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
58
|
+
oo as default,
|
|
59
|
+
M as dialogCloseLabel,
|
|
60
|
+
F as dialogTitle,
|
|
75
61
|
l as dialogTitleImage,
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
lo as imageCancelButton,
|
|
62
|
+
i as dialogTitleVideo,
|
|
63
|
+
b as fixedTextPlaceholder,
|
|
64
|
+
h as fixedTextTooltip,
|
|
65
|
+
A as imageCancelButton,
|
|
81
66
|
c as imageDefaultTitle,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
67
|
+
U as imageInvalidUrl,
|
|
68
|
+
Q as imageRunButton,
|
|
69
|
+
v as imageScaleLabel,
|
|
70
|
+
m as imageTitleLabel,
|
|
71
|
+
a as imageTitlePlaceholder,
|
|
72
|
+
g as imageUploadError,
|
|
73
|
+
j as imageUploadLabel,
|
|
74
|
+
d as imageUploadPlaceholder,
|
|
75
|
+
u as imageUploadSuccess,
|
|
76
|
+
r as imageUploading,
|
|
77
|
+
N as imageUrlLabel,
|
|
78
|
+
n as imageUrlPlaceholder,
|
|
94
79
|
T as imageUrlRequired,
|
|
95
80
|
s as imageUseButton,
|
|
96
81
|
o as placeholder,
|
|
97
82
|
e as placeholderCodeEdit,
|
|
98
83
|
t as placeholderQuickEdit,
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
G as toolbarInsertSingleChoice,
|
|
117
|
-
W as toolbarInsertVideo,
|
|
118
|
-
A as variableAddNew,
|
|
119
|
-
Y as variableAlreadyExists,
|
|
120
|
-
O as variableEmpty,
|
|
121
|
-
y as variableNameInvalid,
|
|
122
|
-
w as variableNamePlaceholder,
|
|
123
|
-
N as variableNotFound,
|
|
124
|
-
E as variableSearchPlaceholder,
|
|
125
|
-
q as variableSectionCustom,
|
|
126
|
-
k as variableSectionSystem,
|
|
127
|
-
so as videoCancelButton,
|
|
128
|
-
B as videoDefaultTitle,
|
|
84
|
+
y as slashDivider,
|
|
85
|
+
O as slashFixedText,
|
|
86
|
+
W as slashImage,
|
|
87
|
+
X as slashVideo,
|
|
88
|
+
Z as toolbarChoiceOption1,
|
|
89
|
+
_ as toolbarChoiceOption2,
|
|
90
|
+
V as toolbarConfirmOutput,
|
|
91
|
+
$ as toolbarInputPlaceholder,
|
|
92
|
+
E as toolbarInsertButton,
|
|
93
|
+
q as toolbarInsertImage,
|
|
94
|
+
w as toolbarInsertInput,
|
|
95
|
+
Y as toolbarInsertLink,
|
|
96
|
+
k as toolbarInsertMultiChoice,
|
|
97
|
+
S as toolbarInsertSingleChoice,
|
|
98
|
+
z as toolbarInsertVideo,
|
|
99
|
+
K as videoCancelButton,
|
|
100
|
+
C as videoDefaultTitle,
|
|
129
101
|
L as videoDefaultTitleBilibili,
|
|
130
102
|
P as videoDefaultTitleYoutube,
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
103
|
+
f as videoInvalidUrl,
|
|
104
|
+
R as videoPreviewPlaceholder,
|
|
105
|
+
D as videoPreviewTitle,
|
|
106
|
+
H as videoRunButton,
|
|
107
|
+
J as videoTitleLabel,
|
|
108
|
+
B as videoTitlePlaceholder,
|
|
109
|
+
G as videoUrlLabel,
|
|
110
|
+
p as videoUrlPlaceholder,
|
|
139
111
|
I as videoUseButton,
|
|
140
112
|
x as videoUseVideoButton
|
|
141
113
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zh-CN.json.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"zh-CN.json.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("../../../node_modules/@codemirror/view/dist/index.cjs"),f=require("../types.cjs"),x=require("../utils.cjs"),b=require("./PlaceholderWidget.cjs"),u=require("./mediaPlaceholderLabels.cjs"),P=require("../../../_virtual/index.cjs"),w=/!\[([^\]]*)\]\(([^)]+)\)|<img\b[^>]*>/i,M=/===\s*(?:!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>)\s*===|!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>/gi,l=(e,c)=>{const t=new RegExp(`${c}\\s*=\\s*("(.*?)"|'(.*?)'|([^\\s"'<>]+))`,"i"),r=e.match(t);if(r)return r[2]??r[3]??r[4]},D=e=>Math.max(1,Math.min(1e3,Math.round(e))),q=e=>{const c=e?.[0]??"",t=x.unwrapFixedOutput(c),r=/^\s*===/.test(c);if(/^<img\b/i.test(t)){const n=l(t,"src")??"",d=l(t,"alt")??l(t,"title")??"",h=l(t,"width");let m;if(h){const g=Number.parseFloat(h);Number.isFinite(g)&&(m=D(g))}return{text:d,url:n,title:d,scalePercent:m,fixedOutput:r}}const s=t.match(w),o=s?.[1]??"",a=s?.[2]??"";return{text:o,url:a,title:o,scalePercent:void 0,fixedOutput:r}},p=e=>{const c=P.distExports.findDocumentVariableMarkers(e.state.doc.toString()).filter(t=>t.name!==null);return new i.MatchDecorator({regexp:M,decoration:(t,r,s)=>{const o=s+t[0].length;if(c.some(n=>s<n.end&&o>n.start))return null;const a=q(t);return i.Decoration.replace({widget:new b.default(a.text||r.state.facet(u.mediaPlaceholderLabels).image,{tag:"image",url:a.url,title:a.title,scalePercent:a.scalePercent,fixedOutput:a.fixedOutput},"tag-image",f.SelectedOption.Image,r)})}})},v=i.ViewPlugin.fromClass(class{constructor(e){this.matcher=p(e),this.placeholders=this.matcher.createDeco(e)}update(e){if(e.docChanged&&(this.matcher=p(e.view)),e.docChanged||e.startState.facet(u.mediaPlaceholderLabels)!==e.state.facet(u.mediaPlaceholderLabels)){this.placeholders=this.matcher.createDeco(e.view);return}this.placeholders=this.matcher.updateDeco(e,this.placeholders)}},{decorations:e=>e.placeholders,provide:e=>i.EditorView.atomicRanges.of(c=>c.plugin(e)?.placeholders||i.Decoration.none)});exports.default=v;
|
|
2
2
|
//# sourceMappingURL=ImgPlaceholder.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImgPlaceholder.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/ImgPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\nimport { mediaPlaceholderLabels } from \"./mediaPlaceholderLabels\";\n\nconst imageMarkupRegexp = /!\\[([^\\]]*)\\]\\(([^)]+)\\)|<img\\b[^>]*>/i;\nconst agiImgContextRegexp =\n /===\\s*(?:!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>)\\s*===|!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>/gi;\n\nconst extractAttributeValue = (tag: string, attribute: string) => {\n const regexp = new RegExp(\n `${attribute}\\\\s*=\\\\s*(\"(.*?)\"|'(.*?)'|([^\\\\s\"'<>]+))`,\n \"i\"\n );\n const match = tag.match(regexp);\n if (!match) return undefined;\n return match[2] ?? match[3] ?? match[4];\n};\n\nconst clampScalePercent = (value: number) =>\n Math.max(1, Math.min(1000, Math.round(value)));\n\nconst getImageMatchInfo = (match: RegExpMatchArray) => {\n const source = match?.[0] ?? \"\";\n const raw = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n if (/^<img\\b/i.test(raw)) {\n const src = extractAttributeValue(raw, \"src\") ?? \"\";\n const alt =\n extractAttributeValue(raw, \"alt\") ??\n extractAttributeValue(raw, \"title\") ??\n \"\";\n const widthAttr = extractAttributeValue(raw, \"width\");\n let scalePercent: number | undefined;\n if (widthAttr) {\n const numeric = Number.parseFloat(widthAttr);\n if (Number.isFinite(numeric)) {\n scalePercent = clampScalePercent(numeric);\n }\n }\n return {\n text: alt,\n url: src,\n title: alt,\n scalePercent,\n fixedOutput,\n };\n }\n const markdownMatch = raw.match(imageMarkupRegexp);\n const title = markdownMatch?.[1] ?? \"\";\n const url = markdownMatch?.[2] ?? \"\";\n return {\n text: title,\n url,\n title,\n scalePercent: undefined,\n fixedOutput,\n };\n};\n\nconst
|
|
1
|
+
{"version":3,"file":"ImgPlaceholder.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/ImgPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { findDocumentVariableMarkers, unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\nimport { mediaPlaceholderLabels } from \"./mediaPlaceholderLabels\";\n\nconst imageMarkupRegexp = /!\\[([^\\]]*)\\]\\(([^)]+)\\)|<img\\b[^>]*>/i;\nconst agiImgContextRegexp =\n /===\\s*(?:!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>)\\s*===|!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>/gi;\n\nconst extractAttributeValue = (tag: string, attribute: string) => {\n const regexp = new RegExp(\n `${attribute}\\\\s*=\\\\s*(\"(.*?)\"|'(.*?)'|([^\\\\s\"'<>]+))`,\n \"i\"\n );\n const match = tag.match(regexp);\n if (!match) return undefined;\n return match[2] ?? match[3] ?? match[4];\n};\n\nconst clampScalePercent = (value: number) =>\n Math.max(1, Math.min(1000, Math.round(value)));\n\nconst getImageMatchInfo = (match: RegExpMatchArray) => {\n const source = match?.[0] ?? \"\";\n const raw = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n if (/^<img\\b/i.test(raw)) {\n const src = extractAttributeValue(raw, \"src\") ?? \"\";\n const alt =\n extractAttributeValue(raw, \"alt\") ??\n extractAttributeValue(raw, \"title\") ??\n \"\";\n const widthAttr = extractAttributeValue(raw, \"width\");\n let scalePercent: number | undefined;\n if (widthAttr) {\n const numeric = Number.parseFloat(widthAttr);\n if (Number.isFinite(numeric)) {\n scalePercent = clampScalePercent(numeric);\n }\n }\n return {\n text: alt,\n url: src,\n title: alt,\n scalePercent,\n fixedOutput,\n };\n }\n const markdownMatch = raw.match(imageMarkupRegexp);\n const title = markdownMatch?.[1] ?? \"\";\n const url = markdownMatch?.[2] ?? \"\";\n return {\n text: title,\n url,\n title,\n scalePercent: undefined,\n fixedOutput,\n };\n};\n\nconst createImageUrlMatcher = (view: EditorView) => {\n const variables = findDocumentVariableMarkers(\n view.state.doc.toString()\n ).filter((marker) => marker.name !== null);\n return new MatchDecorator({\n regexp: agiImgContextRegexp,\n decoration: (match, view, from) => {\n const to = from + match[0].length;\n if (variables.some((marker) => from < marker.end && to > marker.start)) {\n return null;\n }\n const info = getImageMatchInfo(match);\n return Decoration.replace({\n widget: new PlaceholderWidget(\n info.text || view.state.facet(mediaPlaceholderLabels).image,\n {\n tag: \"image\",\n url: info.url,\n title: info.title,\n scalePercent: info.scalePercent,\n fixedOutput: info.fixedOutput,\n },\n \"tag-image\",\n SelectedOption.Image,\n view\n ),\n });\n },\n });\n};\n\nconst ImgPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n matcher: MatchDecorator;\n constructor(view: EditorView) {\n this.matcher = createImageUrlMatcher(view);\n this.placeholders = this.matcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n if (update.docChanged) {\n this.matcher = createImageUrlMatcher(update.view);\n }\n if (\n update.docChanged ||\n update.startState.facet(mediaPlaceholderLabels) !==\n update.state.facet(mediaPlaceholderLabels)\n ) {\n this.placeholders = this.matcher.createDeco(update.view);\n return;\n }\n this.placeholders = this.matcher.updateDeco(update, this.placeholders);\n }\n },\n {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) =>\n EditorView.atomicRanges.of((view) => {\n return view.plugin(plugin)?.placeholders || Decoration.none;\n }),\n }\n);\n\nexport default ImgPlaceholder;\n"],"names":["imageMarkupRegexp","agiImgContextRegexp","extractAttributeValue","tag","attribute","regexp","match","clampScalePercent","value","getImageMatchInfo","source","raw","unwrapFixedOutput","fixedOutput","src","alt","widthAttr","scalePercent","numeric","markdownMatch","title","url","createImageUrlMatcher","view","variables","findDocumentVariableMarkers","marker","MatchDecorator","from","to","info","Decoration","PlaceholderWidget","mediaPlaceholderLabels","SelectedOption","ImgPlaceholder","ViewPlugin","update","instance","plugin","EditorView"],"mappings":"iWAaMA,EAAoB,yCACpBC,EACJ,wFAEIC,EAAwB,CAACC,EAAaC,IAAsB,CAChE,MAAMC,EAAS,IAAI,OACjB,GAAGD,CAAS,2CACZ,GAAA,EAEIE,EAAQH,EAAI,MAAME,CAAM,EAC9B,GAAKC,EACL,OAAOA,EAAM,CAAC,GAAKA,EAAM,CAAC,GAAKA,EAAM,CAAC,CACxC,EAEMC,EAAqBC,GACzB,KAAK,IAAI,EAAG,KAAK,IAAI,IAAM,KAAK,MAAMA,CAAK,CAAC,CAAC,EAEzCC,EAAqBH,GAA4B,CACrD,MAAMI,EAASJ,IA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IACV,MAAOA,EAAK,MACZ,aAAcA,EAAK,aACnB,YAAaA,EAAK,WAAA,EAEpB,YACAI,EAAAA,eAAe,MACfX,CAAA,CACF,CACD,CACH,CAAA,CACD,CACH,EAEMY,EAAiBC,EAAAA,WAAW,UAChC,KAAM,CAGJ,YAAYb,EAAkB,CAC5B,KAAK,QAAUD,EAAsBC,CAAI,EACzC,KAAK,aAAe,KAAK,QAAQ,WAAWA,CAAI,CAClD,CACA,OAAOc,EAAoB,CAIzB,GAHIA,EAAO,aACT,KAAK,QAAUf,EAAsBe,EAAO,IAAI,GAGhDA,EAAO,YACPA,EAAO,WAAW,MAAMJ,wBAAsB,IAC5CI,EAAO,MAAM,MAAMJ,EAAAA,sBAAsB,EAC3C,CACA,KAAK,aAAe,KAAK,QAAQ,WAAWI,EAAO,IAAI,EACvD,MACF,CACA,KAAK,aAAe,KAAK,QAAQ,WAAWA,EAAQ,KAAK,YAAY,CACvE,CAAA,EAEF,CACE,YAAcC,GAAaA,EAAS,aACpC,QAAUC,GACRC,EAAAA,WAAW,aAAa,GAAIjB,GACnBA,EAAK,OAAOgB,CAAM,GAAG,cAAgBR,EAAAA,WAAW,IACxD,CAAA,CAEP"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DecorationSet, ViewPlugin, ViewUpdate } from '@codemirror/view';
|
|
1
|
+
import { DecorationSet, ViewPlugin, ViewUpdate, MatchDecorator } from '@codemirror/view';
|
|
2
2
|
declare const ImgPlaceholder: ViewPlugin<{
|
|
3
3
|
placeholders: DecorationSet;
|
|
4
|
+
matcher: MatchDecorator;
|
|
4
5
|
update(update: ViewUpdate): void;
|
|
5
6
|
}, undefined>;
|
|
6
7
|
export default ImgPlaceholder;
|
|
@@ -1,76 +1,85 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SelectedOption as
|
|
3
|
-
import { unwrapFixedOutput as
|
|
4
|
-
import
|
|
5
|
-
import { mediaPlaceholderLabels as
|
|
6
|
-
|
|
1
|
+
import { ViewPlugin as f, EditorView as x, Decoration as p, MatchDecorator as w } from "../../../node_modules/@codemirror/view/dist/index.es.js";
|
|
2
|
+
import { SelectedOption as b } from "../types.es.js";
|
|
3
|
+
import { unwrapFixedOutput as M } from "../utils.es.js";
|
|
4
|
+
import P from "./PlaceholderWidget.es.js";
|
|
5
|
+
import { mediaPlaceholderLabels as l } from "./mediaPlaceholderLabels.es.js";
|
|
6
|
+
import { d as D } from "../../../_virtual/index.es.js";
|
|
7
|
+
const I = /!\[([^\]]*)\]\(([^)]+)\)|<img\b[^>]*>/i, O = /===\s*(?:!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>)\s*===|!\[[^\]]*\]\([^)]+\)|<img\b[^>]*>/gi, n = (t, c) => {
|
|
7
8
|
const e = new RegExp(
|
|
8
|
-
`${
|
|
9
|
+
`${c}\\s*=\\s*("(.*?)"|'(.*?)'|([^\\s"'<>]+))`,
|
|
9
10
|
"i"
|
|
10
|
-
),
|
|
11
|
-
if (
|
|
12
|
-
return
|
|
13
|
-
},
|
|
14
|
-
const
|
|
11
|
+
), r = t.match(e);
|
|
12
|
+
if (r)
|
|
13
|
+
return r[2] ?? r[3] ?? r[4];
|
|
14
|
+
}, v = (t) => Math.max(1, Math.min(1e3, Math.round(t))), C = (t) => {
|
|
15
|
+
const c = t?.[0] ?? "", e = M(c), r = /^\s*===/.test(c);
|
|
15
16
|
if (/^<img\b/i.test(e)) {
|
|
16
|
-
const
|
|
17
|
-
let
|
|
18
|
-
if (
|
|
19
|
-
const
|
|
20
|
-
Number.isFinite(
|
|
17
|
+
const s = n(e, "src") ?? "", m = n(e, "alt") ?? n(e, "title") ?? "", h = n(e, "width");
|
|
18
|
+
let d;
|
|
19
|
+
if (h) {
|
|
20
|
+
const u = Number.parseFloat(h);
|
|
21
|
+
Number.isFinite(u) && (d = v(u));
|
|
21
22
|
}
|
|
22
23
|
return {
|
|
23
|
-
text:
|
|
24
|
-
url:
|
|
25
|
-
title:
|
|
26
|
-
scalePercent:
|
|
27
|
-
fixedOutput:
|
|
24
|
+
text: m,
|
|
25
|
+
url: s,
|
|
26
|
+
title: m,
|
|
27
|
+
scalePercent: d,
|
|
28
|
+
fixedOutput: r
|
|
28
29
|
};
|
|
29
30
|
}
|
|
30
|
-
const
|
|
31
|
+
const a = e.match(I), i = a?.[1] ?? "", o = a?.[2] ?? "";
|
|
31
32
|
return {
|
|
32
|
-
text:
|
|
33
|
-
url:
|
|
34
|
-
title:
|
|
33
|
+
text: i,
|
|
34
|
+
url: o,
|
|
35
|
+
title: i,
|
|
35
36
|
scalePercent: void 0,
|
|
36
|
-
fixedOutput:
|
|
37
|
+
fixedOutput: r
|
|
37
38
|
};
|
|
38
|
-
},
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
}
|
|
39
|
+
}, g = (t) => {
|
|
40
|
+
const c = D.findDocumentVariableMarkers(
|
|
41
|
+
t.state.doc.toString()
|
|
42
|
+
).filter((e) => e.name !== null);
|
|
43
|
+
return new w({
|
|
44
|
+
regexp: O,
|
|
45
|
+
decoration: (e, r, a) => {
|
|
46
|
+
const i = a + e[0].length;
|
|
47
|
+
if (c.some((s) => a < s.end && i > s.start))
|
|
48
|
+
return null;
|
|
49
|
+
const o = C(e);
|
|
50
|
+
return p.replace({
|
|
51
|
+
widget: new P(
|
|
52
|
+
o.text || r.state.facet(l).image,
|
|
53
|
+
{
|
|
54
|
+
tag: "image",
|
|
55
|
+
url: o.url,
|
|
56
|
+
title: o.title,
|
|
57
|
+
scalePercent: o.scalePercent,
|
|
58
|
+
fixedOutput: o.fixedOutput
|
|
59
|
+
},
|
|
60
|
+
"tag-image",
|
|
61
|
+
b.Image,
|
|
62
|
+
r
|
|
63
|
+
)
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
}, A = f.fromClass(
|
|
59
68
|
class {
|
|
60
69
|
constructor(t) {
|
|
61
|
-
this.placeholders =
|
|
70
|
+
this.matcher = g(t), this.placeholders = this.matcher.createDeco(t);
|
|
62
71
|
}
|
|
63
72
|
update(t) {
|
|
64
|
-
if (t.startState.facet(
|
|
65
|
-
this.placeholders =
|
|
73
|
+
if (t.docChanged && (this.matcher = g(t.view)), t.docChanged || t.startState.facet(l) !== t.state.facet(l)) {
|
|
74
|
+
this.placeholders = this.matcher.createDeco(t.view);
|
|
66
75
|
return;
|
|
67
76
|
}
|
|
68
|
-
this.placeholders =
|
|
77
|
+
this.placeholders = this.matcher.updateDeco(t, this.placeholders);
|
|
69
78
|
}
|
|
70
79
|
},
|
|
71
80
|
{
|
|
72
81
|
decorations: (t) => t.placeholders,
|
|
73
|
-
provide: (t) =>
|
|
82
|
+
provide: (t) => x.atomicRanges.of((c) => c.plugin(t)?.placeholders || p.none)
|
|
74
83
|
}
|
|
75
84
|
);
|
|
76
85
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ImgPlaceholder.es.js","sources":["../../../../src/components/MarkdownFlowEditor/plugins/ImgPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\nimport { mediaPlaceholderLabels } from \"./mediaPlaceholderLabels\";\n\nconst imageMarkupRegexp = /!\\[([^\\]]*)\\]\\(([^)]+)\\)|<img\\b[^>]*>/i;\nconst agiImgContextRegexp =\n /===\\s*(?:!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>)\\s*===|!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>/gi;\n\nconst extractAttributeValue = (tag: string, attribute: string) => {\n const regexp = new RegExp(\n `${attribute}\\\\s*=\\\\s*(\"(.*?)\"|'(.*?)'|([^\\\\s\"'<>]+))`,\n \"i\"\n );\n const match = tag.match(regexp);\n if (!match) return undefined;\n return match[2] ?? match[3] ?? match[4];\n};\n\nconst clampScalePercent = (value: number) =>\n Math.max(1, Math.min(1000, Math.round(value)));\n\nconst getImageMatchInfo = (match: RegExpMatchArray) => {\n const source = match?.[0] ?? \"\";\n const raw = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n if (/^<img\\b/i.test(raw)) {\n const src = extractAttributeValue(raw, \"src\") ?? \"\";\n const alt =\n extractAttributeValue(raw, \"alt\") ??\n extractAttributeValue(raw, \"title\") ??\n \"\";\n const widthAttr = extractAttributeValue(raw, \"width\");\n let scalePercent: number | undefined;\n if (widthAttr) {\n const numeric = Number.parseFloat(widthAttr);\n if (Number.isFinite(numeric)) {\n scalePercent = clampScalePercent(numeric);\n }\n }\n return {\n text: alt,\n url: src,\n title: alt,\n scalePercent,\n fixedOutput,\n };\n }\n const markdownMatch = raw.match(imageMarkupRegexp);\n const title = markdownMatch?.[1] ?? \"\";\n const url = markdownMatch?.[2] ?? \"\";\n return {\n text: title,\n url,\n title,\n scalePercent: undefined,\n fixedOutput,\n };\n};\n\nconst
|
|
1
|
+
{"version":3,"file":"ImgPlaceholder.es.js","sources":["../../../../src/components/MarkdownFlowEditor/plugins/ImgPlaceholder.ts"],"sourcesContent":["import {\n EditorView,\n Decoration,\n DecorationSet,\n ViewPlugin,\n ViewUpdate,\n MatchDecorator,\n} from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\nimport { findDocumentVariableMarkers, unwrapFixedOutput } from \"../utils\";\nimport PlaceholderWidget from \"./PlaceholderWidget\";\nimport { mediaPlaceholderLabels } from \"./mediaPlaceholderLabels\";\n\nconst imageMarkupRegexp = /!\\[([^\\]]*)\\]\\(([^)]+)\\)|<img\\b[^>]*>/i;\nconst agiImgContextRegexp =\n /===\\s*(?:!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>)\\s*===|!\\[[^\\]]*\\]\\([^)]+\\)|<img\\b[^>]*>/gi;\n\nconst extractAttributeValue = (tag: string, attribute: string) => {\n const regexp = new RegExp(\n `${attribute}\\\\s*=\\\\s*(\"(.*?)\"|'(.*?)'|([^\\\\s\"'<>]+))`,\n \"i\"\n );\n const match = tag.match(regexp);\n if (!match) return undefined;\n return match[2] ?? match[3] ?? match[4];\n};\n\nconst clampScalePercent = (value: number) =>\n Math.max(1, Math.min(1000, Math.round(value)));\n\nconst getImageMatchInfo = (match: RegExpMatchArray) => {\n const source = match?.[0] ?? \"\";\n const raw = unwrapFixedOutput(source);\n const fixedOutput = /^\\s*===/.test(source);\n if (/^<img\\b/i.test(raw)) {\n const src = extractAttributeValue(raw, \"src\") ?? \"\";\n const alt =\n extractAttributeValue(raw, \"alt\") ??\n extractAttributeValue(raw, \"title\") ??\n \"\";\n const widthAttr = extractAttributeValue(raw, \"width\");\n let scalePercent: number | undefined;\n if (widthAttr) {\n const numeric = Number.parseFloat(widthAttr);\n if (Number.isFinite(numeric)) {\n scalePercent = clampScalePercent(numeric);\n }\n }\n return {\n text: alt,\n url: src,\n title: alt,\n scalePercent,\n fixedOutput,\n };\n }\n const markdownMatch = raw.match(imageMarkupRegexp);\n const title = markdownMatch?.[1] ?? \"\";\n const url = markdownMatch?.[2] ?? \"\";\n return {\n text: title,\n url,\n title,\n scalePercent: undefined,\n fixedOutput,\n };\n};\n\nconst createImageUrlMatcher = (view: EditorView) => {\n const variables = findDocumentVariableMarkers(\n view.state.doc.toString()\n ).filter((marker) => marker.name !== null);\n return new MatchDecorator({\n regexp: agiImgContextRegexp,\n decoration: (match, view, from) => {\n const to = from + match[0].length;\n if (variables.some((marker) => from < marker.end && to > marker.start)) {\n return null;\n }\n const info = getImageMatchInfo(match);\n return Decoration.replace({\n widget: new PlaceholderWidget(\n info.text || view.state.facet(mediaPlaceholderLabels).image,\n {\n tag: \"image\",\n url: info.url,\n title: info.title,\n scalePercent: info.scalePercent,\n fixedOutput: info.fixedOutput,\n },\n \"tag-image\",\n SelectedOption.Image,\n view\n ),\n });\n },\n });\n};\n\nconst ImgPlaceholder = ViewPlugin.fromClass(\n class {\n placeholders: DecorationSet;\n matcher: MatchDecorator;\n constructor(view: EditorView) {\n this.matcher = createImageUrlMatcher(view);\n this.placeholders = this.matcher.createDeco(view);\n }\n update(update: ViewUpdate) {\n if (update.docChanged) {\n this.matcher = createImageUrlMatcher(update.view);\n }\n if (\n update.docChanged ||\n update.startState.facet(mediaPlaceholderLabels) !==\n update.state.facet(mediaPlaceholderLabels)\n ) {\n this.placeholders = this.matcher.createDeco(update.view);\n return;\n }\n this.placeholders = this.matcher.updateDeco(update, this.placeholders);\n }\n },\n {\n decorations: (instance) => instance.placeholders,\n provide: (plugin) =>\n EditorView.atomicRanges.of((view) => {\n return view.plugin(plugin)?.placeholders || Decoration.none;\n }),\n }\n);\n\nexport default ImgPlaceholder;\n"],"names":["imageMarkupRegexp","agiImgContextRegexp","extractAttributeValue","tag","attribute","regexp","match","clampScalePercent","value","getImageMatchInfo","source","raw","unwrapFixedOutput","fixedOutput","src","alt","widthAttr","scalePercent","numeric","markdownMatch","title","url","createImageUrlMatcher","view","variables","findDocumentVariableMarkers","marker","MatchDecorator","from","to","info","Decoration","PlaceholderWidget","mediaPlaceholderLabels","SelectedOption","ImgPlaceholder","ViewPlugin","update","instance","plugin","EditorView"],"mappings":";;;;;;AAaA,MAAMA,IAAoB,0CACpBC,IACJ,yFAEIC,IAAwB,CAACC,GAAaC,MAAsB;AAChE,QAAMC,IAAS,IAAI;AAAA,IACjB,GAAGD,CAAS;AAAA,IACZ;AAAA,EAAA,GAEIE,IAAQH,EAAI,MAAME,CAAM;AAC9B,MAAKC;AACL,WAAOA,EAAM,CAAC,KAAKA,EAAM,CAAC,KAAKA,EAAM,CAAC;AACxC,GAEMC,IAAoB,CAACC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AO,OAAOG,IAAKH,EAAO,KAAK;AACnE,eAAO;AAET,YAAMI,IAAOrB,EAAkBH,CAAK;AACpC,aAAOyB,EAAW,QAAQ;AAAA,QACxB,QAAQ,IAAIC;AAAA,UACVF,EAAK,QAAQP,EAAK,MAAM,MAAMU,CAAsB,EAAE;AAAA,UACtD;AAAA,YACE,KAAK;AAAA,YACL,KAAKH,EAAK;AAAA,YACV,OAAOA,EAAK;AAAA,YACZ,cAAcA,EAAK;AAAA,YACnB,aAAaA,EAAK;AAAA,UAAA;AAAA,UAEpB;AAAA,UACAI,EAAe;AAAA,UACfX;AAAAA,QAAA;AAAA,MACF,CACD;AAAA,IACH;AAAA,EAAA,CACD;AACH,GAEMY,IAAiBC,EAAW;AAAA,EAChC,MAAM;AAAA,IAGJ,YAAYb,GAAkB;AAC5B,WAAK,UAAUD,EAAsBC,CAAI,GACzC,KAAK,eAAe,KAAK,QAAQ,WAAWA,CAAI;AAAA,IAClD;AAAA,IACA,OAAOc,GAAoB;AAIzB,UAHIA,EAAO,eACT,KAAK,UAAUf,EAAsBe,EAAO,IAAI,IAGhDA,EAAO,cACPA,EAAO,WAAW,MAAMJ,CAAsB,MAC5CI,EAAO,MAAM,MAAMJ,CAAsB,GAC3C;AACA,aAAK,eAAe,KAAK,QAAQ,WAAWI,EAAO,IAAI;AACvD;AAAA,MACF;AACA,WAAK,eAAe,KAAK,QAAQ,WAAWA,GAAQ,KAAK,YAAY;AAAA,IACvE;AAAA,EAAA;AAAA,EAEF;AAAA,IACE,aAAa,CAACC,MAAaA,EAAS;AAAA,IACpC,SAAS,CAACC,MACRC,EAAW,aAAa,GAAG,CAACjB,MACnBA,EAAK,OAAOgB,CAAM,GAAG,gBAAgBR,EAAW,IACxD;AAAA,EAAA;AAEP;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaceholderWidget.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/PlaceholderWidget.ts"],"sourcesContent":["import { EditorView, Decoration, WidgetType } from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nconst createSvgElement = (tag: string) => document.createElementNS(SVG_NS, tag);\n// TODO: if use renderToStaticMarkup & createElement, it will cause react & react-dom version mismatch\n// so we use lucide-react to build the icon\n// lucide-react image icon\nconst buildImageIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n rect.setAttribute(\"ry\", \"2\");\n\n const circle = createSvgElement(\"circle\");\n circle.setAttribute(\"cx\", \"9\");\n circle.setAttribute(\"cy\", \"9\");\n circle.setAttribute(\"r\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\");\n\n svg.append(rect, circle, path);\n return svg;\n};\n\n// lucide-react image icon\nconst buildVideoIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m9 8 6 4-6 4Z\");\n\n svg.append(rect, path);\n return svg;\n};\n\nclass PlaceholderWidget extends WidgetType {\n constructor(\n private text: string,\n private dataset: {\n tag: \"image\" | \"video\"
|
|
1
|
+
{"version":3,"file":"PlaceholderWidget.cjs","sources":["../../../../src/components/MarkdownFlowEditor/plugins/PlaceholderWidget.ts"],"sourcesContent":["import { EditorView, Decoration, WidgetType } from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nconst createSvgElement = (tag: string) => document.createElementNS(SVG_NS, tag);\n// TODO: if use renderToStaticMarkup & createElement, it will cause react & react-dom version mismatch\n// so we use lucide-react to build the icon\n// lucide-react image icon\nconst buildImageIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n rect.setAttribute(\"ry\", \"2\");\n\n const circle = createSvgElement(\"circle\");\n circle.setAttribute(\"cx\", \"9\");\n circle.setAttribute(\"cy\", \"9\");\n circle.setAttribute(\"r\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\");\n\n svg.append(rect, circle, path);\n return svg;\n};\n\n// lucide-react image icon\nconst buildVideoIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m9 8 6 4-6 4Z\");\n\n svg.append(rect, path);\n return svg;\n};\n\nclass PlaceholderWidget extends WidgetType {\n constructor(\n private text: string,\n private dataset: {\n tag: \"image\" | \"video\";\n title?: string;\n url?: string;\n scalePercent?: number;\n fixedOutput?: boolean;\n },\n private styleClass: string,\n private type: SelectedOption,\n private view: EditorView\n ) {\n super();\n }\n\n getPosition() {\n let from = -1;\n let to = -1;\n const decorations = this.view.state.facet(EditorView.decorations);\n for (const deco of decorations) {\n const decoSet = typeof deco === \"function\" ? deco(this.view) : deco;\n decoSet.between(\n 0,\n this.view.state.doc.length,\n (start: number, end: number, decoration: Decoration) => {\n if (decoration.spec.widget === this) {\n from = start;\n to = end;\n return false;\n }\n }\n );\n if (from !== -1) break;\n }\n if (from !== -1 && to !== -1) {\n return [from, to];\n }\n }\n\n toDOM() {\n const container = document.createElement(\"span\");\n container.className = this.styleClass;\n const content = document.createElement(\"span\");\n content.className = \"tag-placeholder-content\";\n const span = document.createElement(\"span\");\n span.className = \"tag-placeholder-label\";\n span.textContent = this.text;\n span.dataset[\"tag\"] = this.dataset.tag || \"\";\n span.dataset[\"url\"] = this.dataset.url || \"\";\n span.dataset[\"title\"] = this.dataset.title || \"\";\n // const icon = document.createElement(\"span\");\n // icon.className = \"tag-icon\";\n // icon.innerHTML = \"✕\";\n // icon.addEventListener(\"click\", (e) => {\n // e.stopPropagation();\n // const [from, to] = this.getPosition() ?? [-1, -1];\n // if (from !== -1 && to !== -1) {\n // this.view.dispatch({\n // changes: { from, to, insert: \"\" },\n // });\n // }\n // });\n content.addEventListener(\"click\", (e) => {\n const [from, to] = this.getPosition() ?? [-1, -1];\n const event = new CustomEvent(\"globalTagClick\", {\n detail: {\n view: this.view,\n type: this.type,\n dataset: this.dataset,\n content: span.textContent,\n from,\n to,\n target: e.currentTarget,\n },\n });\n window.dispatchEvent(event);\n });\n\n if (this.dataset.fixedOutput) {\n const prefix = document.createElement(\"span\");\n prefix.className = \"tag-fixed-output-marker\";\n prefix.textContent = \"===\";\n container.appendChild(prefix);\n }\n\n if (this.dataset.tag === \"image\" || this.dataset.tag === \"video\") {\n const iconWrapper = document.createElement(\"span\");\n iconWrapper.className = \"tag-placeholder-icon\";\n\n const icon =\n this.dataset.tag === \"image\" ? buildImageIcon() : buildVideoIcon();\n iconWrapper.appendChild(icon);\n content.appendChild(iconWrapper);\n }\n content.appendChild(span);\n container.appendChild(content);\n\n if (this.dataset.fixedOutput) {\n const suffix = document.createElement(\"span\");\n suffix.className = \"tag-fixed-output-marker\";\n suffix.textContent = \"===\";\n container.appendChild(suffix);\n }\n\n // container.appendChild(icon);\n return container;\n }\n\n ignoreEvent() {\n return false;\n }\n}\n\nexport default PlaceholderWidget;\n"],"names":["SVG_NS","createSvgElement","tag","buildImageIcon","svg","rect","circle","path","buildVideoIcon","PlaceholderWidget","WidgetType","text","dataset","styleClass","type","view","from","to","decorations","EditorView","deco","start","end","decoration","container","content","span","e","event","prefix","iconWrapper","icon","suffix"],"mappings":"qLAGMA,EAAS,6BAETC,EAAoBC,GAAgB,SAAS,gBAAgBF,EAAQE,CAAG,EAIxEC,E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M,CAACX,EAAMC,CAAE,EAAI,KAAK,eAAiB,CAAC,GAAI,EAAE,EAC1CW,EAAQ,IAAI,YAAY,iBAAkB,CAC9C,OAAQ,CACN,KAAM,KAAK,KACX,KAAM,KAAK,KACX,QAAS,KAAK,QACd,QAASF,EAAK,YACd,KAAAV,EACA,GAAAC,EACA,OAAQU,EAAE,aAAA,CACZ,CACD,EACD,OAAO,cAAcC,CAAK,CAC5B,CAAC,EAEG,KAAK,QAAQ,YAAa,CAC5B,MAAMC,EAAS,SAAS,cAAc,MAAM,EAC5CA,EAAO,UAAY,0BACnBA,EAAO,YAAc,MACrBL,EAAU,YAAYK,CAAM,CAC9B,CAEA,GAAI,KAAK,QAAQ,MAAQ,SAAW,KAAK,QAAQ,MAAQ,QAAS,CAChE,MAAMC,EAAc,SAAS,cAAc,MAAM,EACjDA,EAAY,UAAY,uBAExB,MAAMC,EACJ,KAAK,QAAQ,MAAQ,QAAU5B,EAAA,EAAmBK,EAAA,EACpDsB,EAAY,YAAYC,CAAI,EAC5BN,EAAQ,YAAYK,CAAW,CACjC,CAIA,GAHAL,EAAQ,YAAYC,CAAI,EACxBF,EAAU,YAAYC,CAAO,EAEzB,KAAK,QAAQ,YAAa,CAC5B,MAAMO,EAAS,SAAS,cAAc,MAAM,EAC5CA,EAAO,UAAY,0BACnBA,EAAO,YAAc,MACrBR,EAAU,YAAYQ,CAAM,CAC9B,CAGA,OAAOR,CACT,CAEA,aAAc,CACZ,MAAO,EACT,CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlaceholderWidget.es.js","sources":["../../../../src/components/MarkdownFlowEditor/plugins/PlaceholderWidget.ts"],"sourcesContent":["import { EditorView, Decoration, WidgetType } from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nconst createSvgElement = (tag: string) => document.createElementNS(SVG_NS, tag);\n// TODO: if use renderToStaticMarkup & createElement, it will cause react & react-dom version mismatch\n// so we use lucide-react to build the icon\n// lucide-react image icon\nconst buildImageIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n rect.setAttribute(\"ry\", \"2\");\n\n const circle = createSvgElement(\"circle\");\n circle.setAttribute(\"cx\", \"9\");\n circle.setAttribute(\"cy\", \"9\");\n circle.setAttribute(\"r\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\");\n\n svg.append(rect, circle, path);\n return svg;\n};\n\n// lucide-react image icon\nconst buildVideoIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m9 8 6 4-6 4Z\");\n\n svg.append(rect, path);\n return svg;\n};\n\nclass PlaceholderWidget extends WidgetType {\n constructor(\n private text: string,\n private dataset: {\n tag: \"image\" | \"video\"
|
|
1
|
+
{"version":3,"file":"PlaceholderWidget.es.js","sources":["../../../../src/components/MarkdownFlowEditor/plugins/PlaceholderWidget.ts"],"sourcesContent":["import { EditorView, Decoration, WidgetType } from \"@codemirror/view\";\nimport { SelectedOption } from \"../types\";\n\nconst SVG_NS = \"http://www.w3.org/2000/svg\";\n\nconst createSvgElement = (tag: string) => document.createElementNS(SVG_NS, tag);\n// TODO: if use renderToStaticMarkup & createElement, it will cause react & react-dom version mismatch\n// so we use lucide-react to build the icon\n// lucide-react image icon\nconst buildImageIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n rect.setAttribute(\"ry\", \"2\");\n\n const circle = createSvgElement(\"circle\");\n circle.setAttribute(\"cx\", \"9\");\n circle.setAttribute(\"cy\", \"9\");\n circle.setAttribute(\"r\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21\");\n\n svg.append(rect, circle, path);\n return svg;\n};\n\n// lucide-react image icon\nconst buildVideoIcon = () => {\n const svg = createSvgElement(\"svg\");\n svg.setAttribute(\"viewBox\", \"0 0 24 24\");\n svg.setAttribute(\"width\", \"14\");\n svg.setAttribute(\"height\", \"14\");\n svg.setAttribute(\"fill\", \"none\");\n svg.setAttribute(\"stroke\", \"currentColor\");\n svg.setAttribute(\"stroke-width\", \"1.5\");\n svg.setAttribute(\"stroke-linecap\", \"round\");\n svg.setAttribute(\"stroke-linejoin\", \"round\");\n\n const rect = createSvgElement(\"rect\");\n rect.setAttribute(\"width\", \"18\");\n rect.setAttribute(\"height\", \"18\");\n rect.setAttribute(\"x\", \"3\");\n rect.setAttribute(\"y\", \"3\");\n rect.setAttribute(\"rx\", \"2\");\n\n const path = createSvgElement(\"path\");\n path.setAttribute(\"d\", \"m9 8 6 4-6 4Z\");\n\n svg.append(rect, path);\n return svg;\n};\n\nclass PlaceholderWidget extends WidgetType {\n constructor(\n private text: string,\n private dataset: {\n tag: \"image\" | \"video\";\n title?: string;\n url?: string;\n scalePercent?: number;\n fixedOutput?: boolean;\n },\n private styleClass: string,\n private type: SelectedOption,\n private view: EditorView\n ) {\n super();\n }\n\n getPosition() {\n let from = -1;\n let to = -1;\n const decorations = this.view.state.facet(EditorView.decorations);\n for (const deco of decorations) {\n const decoSet = typeof deco === \"function\" ? deco(this.view) : deco;\n decoSet.between(\n 0,\n this.view.state.doc.length,\n (start: number, end: number, decoration: Decoration) => {\n if (decoration.spec.widget === this) {\n from = start;\n to = end;\n return false;\n }\n }\n );\n if (from !== -1) break;\n }\n if (from !== -1 && to !== -1) {\n return [from, to];\n }\n }\n\n toDOM() {\n const container = document.createElement(\"span\");\n container.className = this.styleClass;\n const content = document.createElement(\"span\");\n content.className = \"tag-placeholder-content\";\n const span = document.createElement(\"span\");\n span.className = \"tag-placeholder-label\";\n span.textContent = this.text;\n span.dataset[\"tag\"] = this.dataset.tag || \"\";\n span.dataset[\"url\"] = this.dataset.url || \"\";\n span.dataset[\"title\"] = this.dataset.title || \"\";\n // const icon = document.createElement(\"span\");\n // icon.className = \"tag-icon\";\n // icon.innerHTML = \"✕\";\n // icon.addEventListener(\"click\", (e) => {\n // e.stopPropagation();\n // const [from, to] = this.getPosition() ?? [-1, -1];\n // if (from !== -1 && to !== -1) {\n // this.view.dispatch({\n // changes: { from, to, insert: \"\" },\n // });\n // }\n // });\n content.addEventListener(\"click\", (e) => {\n const [from, to] = this.getPosition() ?? [-1, -1];\n const event = new CustomEvent(\"globalTagClick\", {\n detail: {\n view: this.view,\n type: this.type,\n dataset: this.dataset,\n content: span.textContent,\n from,\n to,\n target: e.currentTarget,\n },\n });\n window.dispatchEvent(event);\n });\n\n if (this.dataset.fixedOutput) {\n const prefix = document.createElement(\"span\");\n prefix.className = \"tag-fixed-output-marker\";\n prefix.textContent = \"===\";\n container.appendChild(prefix);\n }\n\n if (this.dataset.tag === \"image\" || this.dataset.tag === \"video\") {\n const iconWrapper = document.createElement(\"span\");\n iconWrapper.className = \"tag-placeholder-icon\";\n\n const icon =\n this.dataset.tag === \"image\" ? buildImageIcon() : buildVideoIcon();\n iconWrapper.appendChild(icon);\n content.appendChild(iconWrapper);\n }\n content.appendChild(span);\n container.appendChild(content);\n\n if (this.dataset.fixedOutput) {\n const suffix = document.createElement(\"span\");\n suffix.className = \"tag-fixed-output-marker\";\n suffix.textContent = \"===\";\n container.appendChild(suffix);\n }\n\n // container.appendChild(icon);\n return container;\n }\n\n ignoreEvent() {\n return false;\n }\n}\n\nexport default PlaceholderWidget;\n"],"names":["SVG_NS","createSvgElement","tag","buildImageIcon","svg","rect","circle","path","buildVideoIcon","PlaceholderWidget","WidgetType","text","dataset","styleClass","type","view","from","to","decorations","EditorView","deco","start","end","decoration","container","content","span","e","event","prefix","iconWrapper","icon","suffix"],"mappings":";AAGA,MAAMA,IAAS,8BAETC,IAAmB,CAACC,MAAgB,SAAS,gBAAgBF,GAAQE,CAAG,GAIxEC,IAAiB,MAAM;AAC3B,QAAMC,IAAMH,EAAiB,KAAK;AAClC,EAAAG,EAAI,aAAa,WAAW,WAAW,GACvCA,EAAI,aAAa,SAAS,IAAI,GAC9BA,EAAI,aAAa,UAAU,IAAI,GAC/BA,EAAI,aA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