@yiitap/vue 0.12.0 → 0.14.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/dist/index.cjs +262 -22
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +262 -22
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +52163 -26690
- package/dist/index.mjs.map +1 -1
- package/dist/vue.css +1 -1
- package/package.json +27 -30
- package/types/components/YiiEditor.vue.d.ts +8 -12
- package/types/components/common/OBlockPlaceholder.vue.d.ts +1 -1
- package/types/components/common/OBlockPopover.vue.d.ts +2 -2
- package/types/components/common/OCommandBtn.vue.d.ts +6 -6
- package/types/components/common/OCommonBtn.vue.d.ts +6 -6
- package/types/components/common/OMenubarBtn.vue.d.ts +6 -6
- package/types/components/common/OMetaInput.vue.d.ts +1 -1
- package/types/components/menus/OSideMenu.vue.d.ts +9 -0
- package/types/components/ui/OBtn.vue.d.ts +3 -3
- package/types/components/ui/OBtnGroup.vue.d.ts +3 -3
- package/types/components/ui/OCheckbox.vue.d.ts +1 -1
- package/types/components/ui/ODialog.vue.d.ts +6 -24
- package/types/components/ui/OIcon.vue.d.ts +1 -1
- package/types/components/ui/OImageViewer.vue.d.ts +1 -1
- package/types/components/ui/OInput.vue.d.ts +4 -2
- package/types/components/ui/OTextarea.vue.d.ts +2 -2
- package/types/constants/brand-color.d.ts +4 -0
- package/types/constants/index.d.ts +1 -1
- package/types/extensions/blockquote/index.d.ts +1 -1
- package/types/extensions/char-command/emoji/view.vue.d.ts +2 -2
- package/types/extensions/char-command/index.d.ts +4 -0
- package/types/extensions/char-command/slash/view.vue.d.ts +1 -1
- package/types/extensions/code-block/index.d.ts +3 -3
- package/types/extensions/details/index.d.ts +1 -1
- package/types/extensions/extensions.d.ts +55 -0
- package/types/extensions/factory.d.ts +110 -0
- package/types/extensions/heading/index.d.ts +2 -2
- package/types/extensions/horizontal-rule/index.d.ts +3 -1
- package/types/extensions/index.d.ts +3 -51
- package/types/extensions/paragraph/index.d.ts +3 -1
- package/types/extensions/starter-kit.d.ts +20 -0
- package/types/hooks/useI18n.d.ts +2 -2
- package/types/index.d.ts +1 -0
- package/types/types/types.d.ts +6 -0
- package/types/constants/color.d.ts +0 -5
- package/types/extensions/dynamic.d.ts +0 -8
- package/types/i18n/index.d.ts +0 -4
- package/types/i18n/messages/en.d.ts +0 -243
- package/types/i18n/messages/pl.d.ts +0 -182
- package/types/i18n/messages/pt-br.d.ts +0 -182
- package/types/i18n/messages/zh-hans.d.ts +0 -241
- package/types/i18n/messages/zh-hant.d.ts +0 -200
package/dist/index.cjs
CHANGED
|
@@ -1,36 +1,178 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var FT=Object.defineProperty;var HT=(n,e,t)=>e in n?FT(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var Je=(n,e,t)=>HT(n,typeof e!="symbol"?e+"":e,t);/**
|
|
2
2
|
* Copyright 2026 Yiitap
|
|
3
3
|
* @license MIT
|
|
4
|
-
**/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("vue"),G=require("@tiptap/vue-3"),Al=require("@tiptap/starter-kit"),Pr=require("@tiptap/extension-document"),Bl=require("@tiptap/extension-collaboration"),Ml=require("@tiptap/extension-collaboration-caret"),Rl=require("@tiptap/extensions"),Wo=require("@tiptap/extension-details"),Il=require("@tiptap/extension-list"),jo=require("@tiptap/extension-mathematics"),Wt=require("@tiptap/extension-table"),Un=require("@tiptap/extension-text-style"),Dl=require("@tiptap/markdown"),Ll=require("@tiptap/extension-highlight"),Fr=require("@tiptap/extension-emoji"),Vl=require("@tiptap/extension-image"),Oa=require("@tiptap/extension-link");require("@tiptap/extension-mention");const $l=require("@tiptap/extension-subscript"),Pl=require("@tiptap/extension-superscript"),Fl=require("@tiptap/extension-text-align"),Ul=require("@tiptap/extension-typography"),zl=require("@tiptap/extension-underline"),Hl=require("@tiptap/extension-unique-id"),ql=require("@yiitap/extension-color-highlighter");require("@yiitap/extension-focus");const Gl=require("@yiitap/extension-inline-placeholder"),cn=require("@yiitap/extension-placeholder"),Kl=require("@yiitap/extension-selection-decoration"),Ur=require("@yiitap/extension-shortcut"),Wl=require("@yiitap/extension-table"),jl=require("@yiitap/extension-task-item"),Lo=require("@yiitap/extension-char-command"),Yl=require("@yiitap/extension-ai-block"),Ae=require("@tiptap/core"),Zl=require("openai"),Xl=require("markdown-it"),Ql=require("katex"),Jl=require("@tiptap/extension-blockquote"),Ct=require("@tiptap/pm/state"),es=require("@yiitap/extension-callout"),ts=require("@tiptap/extension-code-block-lowlight"),Vo=require("mermaid"),ns=require("@mermaid-js/layout-elk"),os=require("@yiitap/core"),rs=require("@tiptap/extension-heading"),as=require("@tiptap/extension-horizontal-rule"),is=require("@yiitap/extension-image"),ls=require("@tiptap/extension-paragraph"),ss=require("@yiitap/extension-table-wrapper"),cs=require("@yiitap/extension-video"),Nn=require("@yiitap/util-emoji"),Aa=require("@tiptap/vue-3/menus"),us=require("@tiptap/pm/model");require("@tiptap/suggestion");const zr={isoName:"en-us",name:"English",nativeName:"English (US)",diagram:{name:"Text Diagram",flow:"Flow Diagram",sequence:"Sequence Diagram",class:"Class Diagram",state:"State Diagram",gantt:"Gantt Diagram",tips:"Generation of diagram and chart from text in a similar manner as markdown"},editor:{add:"Add",addMore:"Add More",url:"URL",bold:"Bold",italic:"Italic",strikethrough:"Strikethrough",underline:"Underline",textFormat:"More text format",list:"List",unorderedList:"Unordered List",orderedList:"Ordered List",todoList:"Todo List",subscript:"Subscript",superscript:"Superscript",hyperlink:"Hyperlink",toggleFullscreen:"Toggle Fullscreen",quote:"Quote",left:"Left align",center:"Center align",right:"Right align",justify:"Justify align",print:"Print",outdent:"Decrease indentation",indent:"Increase indentation",indentDropdown:"Indent",removeFormat:"Remove formatting",formatting:"Formatting",fontFamily:"Font Family",defaultFont:"Default Font",fontSize:"Font Size",align:"Align",hr:"Insert Horizontal Rule",undo:"Undo",redo:"Redo",heading:"Heading & Paragraph",heading1:"Heading 1",heading2:"Heading 2",heading3:"Heading 3",heading4:"Heading 4",heading5:"Heading 5",headings:"Headings",paragraph:"Paragraph",code:"Code",codeBlock:"Code Block",size1:"Very small",size2:"A bit small",size3:"Normal",size4:"Medium-large",size5:"Big",size6:"Very big",size7:"Maximum",viewSource:"View Source",textColor:"Text Color",backgroundColor:"Background Color",highlightColor:"Highlight Color",default:"Default",lineHeight:"Line Height",blockquote:"Blockquote",table:"Table",photo:"Insert Photo",video:"Insert Video",formula:"Formula",inlineFormula:"Inline",blockFormula:"Block",thirdPartyService:"Third party services",horizontal:"Horizontal Rule",callout:"Callout",emoji:"Emoji",defaultColor:"Default Color",noColor:"No Color",delete:"Delete",duplicate:"Duplicate",aiBlock:"AI Block",toggleList:"Toggle List",inlineMath:"Inline Math",blockMath:"Block Math"},label:{ai:"AI",advanced:"Advanced",cancel:"Cancel",color:"Color",edit:"Edit",write:"Write",link:"Link",linkAddress:"Link Address",ok:"Ok",preview:"Preview",template:"Template",example:"Example",submit:"Submit",settings:"Settings",remove:"Remove",replace:"Replace",help:"Help",back:"Back",styles:"Styles",basic:"Basic",basicBlocks:"Basic Blocks",common:"Common",media:"Media",image:"Image",video:"Video",model:"Model",modelViewer:"Model Viewer",more:"More",toc:"Table of Contents",untitled:"Untitled",typeForCommands:"Type '/' for commands",empty:"Empty",emptyTips:"Press Enter to continue with an empty note, or select following",copy:"Copy",cut:"Cut",search:"Search",think:"Think",suggested:"Suggested",noResults:"No results",generate:"Generate",generatedBy:"Generated by",update:"Update",turnInto:"Turn into",splitVertical:"Split Vertical",splitHorizontal:"Split Horizontal",view:"View",download:"Download"},table:{cellBackground:"Cell Background",insert:"Insert Table",remove:"Remove Table",addColumn:"Add Column",selectColumn:"Select Column",removeColumn:"Remove Column",addRow:"Add Row",selectRow:"Select Row",removeRow:"Remove Row",merge:"Merge Cells",split:"Split Cells"},image:{preferences:"Image Preferences",ratio:"Ratio",size:"Size",width:"Width",height:"Height",src:"Image Source",caption:"Caption",link:"Link",lockAspectRatio:"Lock aspect ratio",unlockAspectRatio:"Unlock aspect ratio",original:"Original",small:"Small",medium:"Medium",large:"Large",zoom:"Zoom"},embed:{video:"Video",map:"Map",design:"Design",develop:"Develop",data:"Data",others:"Others",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"Youku",iqiyi:"iQiyi",bilibili:"Bilibili",qqvideo:"QQ Video",google_map:"Google Map",amap:"AMap",baidu_map:"Baidu Map",modao:"Modao",lanhu:"Lanhu",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"Jinshuju",iframe:"IFrame",linkTips:"Link or embed code",linkWarning:"Invalid link"},link:{back:"Back to main menu",edit:"Edit Link",off:"Disable Link",open:"Open Link",open_in_new_tab:"Open in new tab"},ai:{askAi:"Ask AI",tellAi:"Tell the AI what to write",improve_writing:"Improve writing",fix_spelling_grammar:"Fix spelling & grammar",enrich_with_emoji:"Enrich with Emoji",translate:"Translate to",make_longer:"Make longer",make_shorter:"Make shorter",continuation:"Continuation",change_tone:"Change tone",write:"Write anything",explain:"Explain",summarize:"Summarize",error:"Please provide correct AI configuration",tone:{formal:"Formal",casual:"Casual",friendly:"Friendly",enthusiastic:"Enthusiastic",authoritative:"Authoritative",humorous:"Humorous",inspirational:"Inspirational",empathetic:"Empathetic",mysterious:"Mysterious"}},language:{chinese_simplified:"Simplified Chinese",chinese_traditional:"Traditional Chinese",german:"German",french:"French",japanese:"Japanese",korean:"Korean"}},ds={isoName:"pl",nativeName:"Polski",diagram:{name:"Schemat tekstowy",flow:"Schemat przepływu",sequence:"Schemat sekwencji",class:"Schemat klas",state:"Diagram stanu",gantt:"Diagram Gantta",tips:"Generowanie diagramu i wykresu z tekstu w podobny sposób jak markdown"},editor:{add:"Dodaj",addMore:"Dodaj więcej",url:"URL",bold:"Pogrubienie",italic:"Kursywa",strikethrough:"Przekreślenie",underline:"Podkreślenie",textFormat:"More text format",unorderedList:"Lista wypunktowana",orderedList:"Lista numerowana",list:"List",todoList:"Lista rzeczy do zrobienia",subscript:"Indeks dolny",superscript:"Indeks górny",hyperlink:"Hiperłącze",toggleFullscreen:"Przełącz na tryb pełnoekranowy",quote:"Zacytuj",left:"Wyrównaj do lewej",center:"Wyrównaj do środka",right:"Wyrównaj do prawej",justify:"Wyjustuj",print:"Drukuj",outdent:"Zmniejsz wcięcie",indent:"Zwiększ wcięcie",indentDropdown:"Wcięcie",removeFormat:"Usuń formatowanie",formatting:"Formatowanie",fontFamily:"Nazwa czcionki",defaultFont:"Domyślna czcionka",fontSize:"Rozmiar czcionki",align:"Wyrównanie",hr:"Wstaw poziomą linię",undo:"Cofnij",redo:"Przywróć",heading:"Heading & Paragraph",heading1:"Nagłówek 1",heading2:"Nagłówek 2",heading3:"Nagłówek 3",heading4:"Nagłówek 4",heading5:"Nagłówek 5",headings:"Nagłówki",paragraph:"Paragraf",code:"Kod",codeBlock:"Blok kodu",size1:"Bardzo mała",size2:"Mała",size3:"Normalna",size4:"Średnio-duża",size5:"Duża",size6:"Bardzo duża",size7:"Maksymalna",viewSource:"Pokaż źródło",textColor:"Kolor czcionki",highlightColor:"Kolor wyróżnienia",default:"Dymyślny",lineHeight:"Wysokość linii",blockquote:"Cytat",table:"Tabela",photo:"Wstaw obraz",video:"Insert Video",formula:"Formuła",inlineFormula:"Formuła w treści",blockFormula:"Blokowa formuła",thirdPartyService:"Third party services",horizontal:"Horizontal Rule",callout:"Callout",emoji:"Emoji",defaultColor:"Default Color",noColor:"No Color",delete:"Delete",duplicate:"Duplicate"},label:{ai:"AI",cancel:"Anuluj",edit:"Edycja",link:"Łącze",linkAddress:"Adres łącza",ok:"Ok",preview:"Podgląd",template:"Szablon",example:"Example",submit:"Submit",settings:"Settings",remove:"Remove",help:"Help",back:"Back",styles:"Styles",basic:"Basic",basicBlocks:"Basic Blocks",common:"Common",media:"Media",image:"Image",video:"Video",model:"Model",modelViewer:"Model Viewer",toc:"Table of Contents",untitled:"Untitled",typeForCommands:"Type '/' for commands",empty:"Empty",emptyTips:"Press Enter to continue with an empty note, or select following",copy:"Copy",cut:"Cut",search:"Search"},table:{cellBackground:"Cell Background",insert:"Insert Table",remove:"Remove Table",addColumn:"Add Column",removeColumn:"Remove Column",addRow:"Add Row",removeRow:"Remove Row",merge:"Merge/Unmerge Cells"},image:{preferences:"Preferencje obrazu",ratio:"Ratio",size:"Rozmiar",width:"Szerokość",height:"Wysokość",src:"Źródło obrazu",caption:"Nagłówek",link:"Łącze",lockAspectRatio:"Lock aspect ratio",unlockAspectRatio:"Unlock aspect ratio",original:"Original",small:"Small",medium:"Medium",large:"Large"},embed:{video:"Video",map:"Map",design:"Design",develop:"Develop",data:"Data",others:"Others",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"Youku",iqiyi:"iQiyi",bilibili:"Bilibili",qqvideo:"QQ Video",google_map:"Google Map",amap:"AMap",baidu_map:"Baidu Map",modao:"Modao",lanhu:"Lanhu",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"Jinshuju",iframe:"IFrame",linkTips:"Link or embed code",linkWarning:"Invalid link"},link:{back:"Back to main menu",edit:"Edit Link",off:"Disable Link",open:"Open Link",open_in_new_tab:"Open in new tab"}},ps={isoName:"pt-br",nativeName:"Português (BR)",diagram:{name:"Diagrama de Texto",flow:"Diagrama de Fluxo",sequence:"Diagrama de sequência",class:"Diagrama de Classe",state:"Diagrama de Estado",gantt:"Diagrama de Gantt",tips:"Geração de diagrama ou gráfico a partir de texto semelhante a markdown"},editor:{add:"Adicionar",addMore:"Adicione Mais",url:"URL",bold:"Negrito",italic:"Itálico",strikethrough:"Tachar",underline:"Sublinhado",textFormat:"Mais formatos de textos",list:"Lista",unorderedList:"Lista com Marcadores",orderedList:"Lista Numerada",todoList:"Lista de afazer",subscript:"Subscrito",superscript:"Sobrescrito",hyperlink:"Hyperlink",toggleFullscreen:"Alternar tela-cheia",quote:"Citação",left:"Alinhar à esquerda",center:"Alinhar ao centro",right:"Alinhar à direita",justify:"Justificar",print:"Imprimir",outdent:"Diminuir recuo",indent:"Aumentar recuo",indentDropdown:"Recuo",removeFormat:"Limpar formatação",formatting:"Formatação",fontFamily:"Fonte",defaultFont:"Fonte Padrão",fontSize:"Tamanho da fontee",align:"Alinhamento",hr:"Linha Horizontal",undo:"Desfazer",redo:"Refazer",heading:"Heading & Paragraph",heading1:"Título 1",heading2:"Título 2",heading3:"Título 3",heading4:"Título 4",heading5:"Título 5",headings:"Estilos de Parágrafo",paragraph:"Parágrafo",code:"Código",codeBlock:"Bloco de Código",size1:"Muito Pequeno",size2:"Pequeno",size3:"Normal",size4:"Médio",size5:"Grande",size6:"Enorme",size7:"Máximo",viewSource:"Código Fonte",textColor:"Cor do texto",highlightColor:"Cor do fundo",default:"Padrão",lineHeight:"Espaço entre linhas",blockquote:"Bloco de citação",table:"Tabela",photo:"Inserir Foto",video:"Insert Video",formula:"Fórmula",inlineFormula:"Linha",blockFormula:"Bloco",thirdPartyService:"Serviços de terceiros",horizontal:"Horizontal Rule",callout:"Callout",emoji:"Emoji",defaultColor:"Default Color",noColor:"No Color",delete:"Delete",duplicate:"Duplicate"},label:{ai:"AI",cancel:"Cancelar",edit:"Editar",link:"Link",linkAddress:"Endereço do Link",ok:"Ok",preview:"Pré Visualização",template:"Modelo",example:"Exemplo",submit:"Enviar",settings:"Configurações",remove:"Excluir",help:"Ajuda",back:"Voltar",styles:"Styles",basic:"Basic",basicBlocks:"Basic Blocks",common:"Common",media:"Media",image:"Image",video:"Video",model:"Model",modelViewer:"Model Viewer",toc:"Table of Contents",untitled:"Untitled",typeForCommands:"Type '/' for commands",empty:"Empty",emptyTips:"Press Enter to continue with an empty note, or select following",copy:"Copy",cut:"Cut",search:"Search"},table:{cellBackground:"Cell Background",insert:"Insert Table",remove:"Remove Table",addColumn:"Add Column",removeColumn:"Remove Column",addRow:"Add Row",removeRow:"Remove Row",merge:"Merge/Unmerge Cells"},image:{preferences:"Preferências da Imagem",ratio:"Ratio",size:"Tamanho",width:"Largura",height:"Altura",src:"Origem da imagem",caption:"Legenda",link:"Link",lockAspectRatio:"Bloquear proporção",unlockAspectRatio:"Desbloquear proporção",original:"Original",small:"Small",medium:"Medium",large:"Large"},embed:{video:"Vídeo",map:"Mapa",design:"Design",develop:"Desenvolvimento",data:"Dados",others:"Outros",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"Youku",iqiyi:"iQiyi",bilibili:"Bilibili",qqvideo:"QQ Video",google_map:"Google Map",amap:"AMap",baidu_map:"Baidu Map",modao:"Modao",lanhu:"Lanhu",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"Jinshuju",iframe:"IFrame",linkTips:"Link or embed code",linkWarning:"Invalid link"},link:{back:"Back to main menu",edit:"Edit Link",off:"Disable Link",open:"Open Link",open_in_new_tab:"Open in new tab"}},Hr={isoName:"zh-hans",name:"Simplified Chinese",nativeName:"简体中文",diagram:{name:"文本绘图",flow:"流程图",sequence:"时序图",class:"类图",state:"状态图",gantt:"甘特图",tips:"使用Markdown风格文本生成流程图、顺序图、类图、状态图和甘特图"},editor:{add:"添加",addMore:"添加更多",url:"URL",bold:"粗体",italic:"斜体",strikethrough:"删除线",underline:"下划线",textFormat:"更多格式",list:"列表",unorderedList:"无序列表",orderedList:"有序列表",todoList:"任务列表",subscript:"下标",superscript:"上标",hyperlink:"超链接",toggleFullscreen:"全屏切换",quote:"引号",left:"左对齐",center:"居中对齐",right:"右对齐",justify:"两端对齐",print:"打印",outdent:"减少缩进",indent:"增加缩进",indentDropdown:"缩进",removeFormat:"清除格式",formatting:"格式化",fontFamily:"字体",defaultFont:"默认字体",fontSize:"字体大小",align:"对齐方式",hr:"插入分割线",undo:"撤消",redo:"重做",heading:"标题与段落",heading1:"标题一",heading2:"标题二",heading3:"标题三",heading4:"标题四",heading5:"标题五",headings:"标题",paragraph:"正文",code:"代码",codeBlock:"代码块",size1:"非常小",size2:"比较小",size3:"正常",size4:"中等偏大",size5:"大",size6:"非常大",size7:"超级大",viewSource:"查看资料",textColor:"文字颜色",backgroundColor:"背景颜色",highlightColor:"高亮颜色",default:"默认",lineHeight:"行高",blockquote:"引用",table:"表格",photo:"图片",video:"视频",formula:"数学公式",inlineFormula:"行内公式",blockFormula:"块级公式",thirdPartyService:"第三方服务",horizontal:"水平线",callout:"高亮块",emoji:"表情",defaultColor:"默认颜色",noColor:"无色",delete:"删除",duplicate:"创建副本",aiBlock:"AI块",toggleList:"折叠列表",inlineMath:"行内公式",blockMath:"块级公式"},label:{ai:"AI",advanced:"进阶",cancel:"取消",color:"颜色",edit:"编辑",link:"链接",linkAddress:"链接地址",ok:"确定",preview:"预览",template:"模板",example:"示例",submit:"确定",settings:"设置",remove:"删除",replace:"替换",help:"帮助",back:"返回",styles:"样式",basic:"基础",basicBlocks:"基础块",common:"常用",media:"多媒体",image:"图片",video:"视频",model:"模型",modelViewer:"模型",more:"更多",toc:"目录",untitled:"未命名",typeForCommands:"输入 '/' 显示命令",empty:"空白页面",emptyTips:"按回车开始编辑,或从下方选择",copy:"复制",cut:"剪切",search:"搜索",think:"思考",noResults:"没有结果",generate:"生成",generatedBy:"生成自",update:"更新",turnInto:"转成",splitVertical:"垂直分割",splitHorizontal:"水平分割",view:"视图",download:"下载"},table:{cellBackground:"单元格背景色",insert:"插入表格",remove:"删除表格",addColumn:"添加列",selectColumn:"选择列",removeColumn:"删除列",addRow:"添加行",selectRow:"选择行",removeRow:"删除行",merge:"合并单元格",split:"拆分单元格"},image:{preferences:"图片设置",ratio:"比例",size:"尺寸",width:"宽度",height:"高度",src:"图片地址",caption:"图片说明",link:"链接",lockAspectRatio:"锁定长宽比",unlockAspectRatio:"解锁长宽比",original:"原始",small:"小",medium:"中",large:"大",zoom:"缩放"},embed:{video:"视频",map:"地图",design:"设计",develop:"开发",data:"数据",others:"其它",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"优酷",iqiyi:"爱奇艺",bilibili:"Bilibili",qqvideo:"腾讯视频",google_map:"谷歌地图",amap:"高德地图",baidu_map:"百度",modao:"墨刀",lanhu:"蓝湖",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"金数据",iframe:"IFrame",linkTips:"链接或代码",linkWarning:"无效的链接"},link:{back:"返回主菜单",edit:"编辑链接",off:"取消链接",open:"打开链接",open_in_new_tab:"在新标签页打开"},ai:{askAi:"探索AI",tellAi:"告诉AI需要写什么",improve_writing:"文本润色",fix_spelling_grammar:"修正拼写和语法",enrich_with_emoji:"丰富表情符号",translate:"翻译成",make_longer:"扩写",make_shorter:"简化",continuation:"续写",change_tone:"调整语气",write:"Write anything",explain:"解释",summarize:"总结",error:"请提供正确的 AI 配置信息",tone:{formal:"正式",casual:"休闲",friendly:"友好",enthusiastic:"热情",authoritative:"权威",humorous:"幽默",inspirational:"鼓舞人心",empathetic:"同理心",mysterious:"神秘"}},language:{chinese_simplified:"简体中文",chinese_traditional:"繁体中文",german:"德语",french:"法语",japanese:"日语",korean:"韩语"}},fs={isoName:"zh-hant",name:"Traditional Chinese",nativeName:"繁體中文",diagram:{name:"文本繪圖",flow:"流程圖",sequence:"時序圖",class:"類圖",state:"狀態圖",gantt:"甘特圖",tips:"使用Markdown風格文本生成流程圖、順序圖、類圖、狀態圖和甘特圖"},editor:{add:"添加",addMore:"添加更多",url:"URL",bold:"粗體",italic:"斜體",strikethrough:"刪除線",underline:"下劃線",textFormat:"更多格式",list:"列表",unorderedList:"無序列表",orderedList:"有序列表",todoList:"任務列表",subscript:"下標",superscript:"上標",hyperlink:"超鏈接",toggleFullscreen:"全屏切換",quote:"引號",left:"左對齊",center:"居中對齊",right:"右對齊",justify:"兩端對齊",print:"打印",outdent:"減少縮進",indent:"增加縮進",indentDropdown:"縮進",removeFormat:"清除格式",formatting:"格式化",fontFamily:"字體",defaultFont:"默認字體",fontSize:"字體大小",align:"對齊方式",hr:"插入分割線",undo:"撤消",redo:"重做",heading:"標題與段落",heading1:"標題一",heading2:"標題二",heading3:"標題三",heading4:"標題四",heading5:"標題五",headings:"標題",paragraph:"正文",code:"代碼",codeBlock:"代碼塊",size1:"非常小",size2:"比較小",size3:"正常",size4:"中等偏大",size5:"大",size6:"非常大",size7:"超級大",viewSource:"查看資料",textColor:"文字顏色",backgroundColor:"背景颜色",highlightColor:"高亮顏色",default:"默認",lineHeight:"行高",blockquote:"引用",table:"表格",photo:"圖片",video:"視頻",formula:"數學公式",inlineFormula:"行內公式",blockFormula:"塊級公式",thirdPartyService:"第三方服務",horizontal:"水平線",callout:"高亮塊",emoji:"表情",defaultColor:"默認顏色",noColor:"無色",delete:"刪除",duplicate:"創建副本",aiBlock:"AI块",toggleList:"折叠列表",inlineMath:"行内公式",blockMath:"块级公式"},label:{ai:"AI",advanced:"进阶",cancel:"取消",edit:"編輯",link:"鏈接",linkAddress:"鏈接地址",ok:"確定",preview:"預覽",template:"模板",example:"示例",submit:"確定",settings:"設置",remove:"刪除",help:"幫助",back:"返回",styles:"樣式",basic:"基础",basicBlocks:"基础块",common:"常用",media:"多媒體",image:"圖片",video:"視頻",model:"模型",modelViewer:"模型",toc:"目錄",untitled:"未命名",typeForCommands:"輸入 '/' 顯示命令",empty:"空白页面",emptyTips:"按回车开始编辑,或从下方选择",copy:"複製",cut:"剪切",search:"搜索",think:"思考",noResults:"没有结果",generate:"生成",generatedBy:"生成自",update:"更新",turnInto:"转成",splitVertical:"垂直分割",splitHorizontal:"水平分割",view:"视图",download:"下载"},table:{cellBackground:"單元格背景色",insert:"插入表格",remove:"刪除表格",addColumn:"添加列",removeColumn:"刪除列",addRow:"添加行",removeRow:"刪除行",merge:"合併/拆分 單元格"},image:{preferences:"圖片設置",ratio:"比例",size:"尺寸",width:"寬度",height:"高度",src:"圖片地址",caption:"圖片說明",link:"鏈接",lockAspectRatio:"鎖定長寬比",unlockAspectRatio:"解鎖長寬比",original:"原始",small:"小",medium:"中",large:"大",zoom:"缩放"},embed:{video:"視頻",map:"地圖",design:"設計",develop:"開發",data:"數據",others:"其它",youtube:"Youtube",vimeo:"Vimeo",netflix:"Netflix",youku:"優酷",iqiyi:"愛奇藝",bilibili:"Bilibili",qqvideo:"騰訊視頻",google_map:"谷歌地圖",amap:"高德地圖",baidu_map:"百度",modao:"墨刀",lanhu:"藍湖",figma:"Figma",canva:"Canva",processon:"ProcessOn",codepen:"CodePen",google_forms:"Google Forms",jinshuju:"金數據",iframe:"IFrame",linkTips:"鏈接或代碼",linkWarning:"無效的鏈接"},link:{back:"返回主菜單",edit:"編輯鏈接",off:"取消鏈接",open:"打開鏈接",open_in_new_tab:"在新標籤頁打開"}},Ba={en:zr,"en-us":zr,pl:ds,"pt-br":ps,zh:Hr,"zh-hans":Hr,"zh-hant":fs},ms="en",gs=Ba[ms],bs=t=>Ba[t]||gs;function Z(){const t=e.inject("locale",{value:"en"}),n=e.computed(()=>bs(t.value)),o=e.computed(()=>{var a;return((a=n.value)==null?void 0:a.name)||"English"});function r(a){return a.split(".").reduce((l,i)=>{if(l)return l[i]},n.value)}return{languageName:o,locale:t,message:n,tr:r}}const ln=[{type:"paragraph",content:[]}],Ma=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],Ra=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],vs=[{type:"details",attrs:{open:!1},content:[{type:"detailsSummary",content:[]},{type:"detailsContent",content:ln}]}],Ia=[{type:"codeBlock",attrs:{language:"mermaid"},content:[{type:"text",text:`graph TD
|
|
5
|
-
Mermaid --> Diagram`}]}];function oe(){const t=e.inject("isEditable",{value:!0});function n(l,i,s={}){if(!l.isEditable)return;const c=l==null?void 0:l.chain().focus(),d=l==null?void 0:l.commands;switch(i){case"inlineMath":r(l);break;default:o(d,c,i,s);break}}function o(l,i,s,c={}){switch(s){case"aiBlock":i.toggleAiBlock().run();break;case"highlight":c.color?l.setHighlight({color:c.color}):l.unsetHighlight();break;case"backgroundColor":c.color?l.setBackgroundColor(c.color):l.unsetBackgroundColor();break;case"blockMath":l.insertBlockMath({latex:""});break;case"blockquote":i.toggleBlockquote().run();break;case"bold":i.toggleBold().run();break;case"bulletList":i.toggleBulletList().run();break;case"callout":i.toggleCallout().run();break;case"clearFormat":i.unsetAllMarks().run();break;case"code":i.toggleCode().run();break;case"codeBlock":l.toggleCodeBlock({language:"bash"});break;case"color":i.setColor(c.color).run();break;case"copySelected":l.copySelected();break;case"content":l.insertContent(c.content);break;case"deleteSelected":l.deleteSelected();break;case"details":c.type==="detailsSummary"?l.unsetDetails():l.setDetails();break;case"diagram":l.insertContent(Ia);break;case"duplicateSelected":l.duplicateSelected();break;case"emoji":l.insertContent(":");break;case"fontFamily":l.setFontFamily(c.fontFamily);break;case"heading":i.toggleHeading(c).run();break;case"horizontalRule":i.setHorizontalRule().run();break;case"image":i.setImage({src:"init"}).run();break;case"imageUpdate":i.setImage(c).run();break;case"inlineMathDelete":l.deleteInlineMath(c);break;case"inlineMathInsert":l.insertInlineMath(c);break;case"inlineMathUpdate":l.updateInlineMath(c);break;case"italic":i.toggleItalic().run();break;case"linkSet":i.extendMarkRange("link").setLink(c).run();break;case"linkUnset":i.extendMarkRange("link").unsetLink().run();break;case"orderedList":i.toggleOrderedList().run();break;case"paragraph":i.setParagraph().run();break;case"strike":i.toggleStrike().run();break;case"subscript":l.toggleSubscript();break;case"superscript":l.toggleSuperscript();break;case"table":i.insertTable({rows:3,cols:3,withHeaderRow:!0}).run();break;case"tableAddColumn":i.addColumnAfter().run();break;case"tableAddRow":i.addRowAfter().run();break;case"tableCellAttribute":i.setCellAttribute(c.name,c.value).run();break;case"tableDeleteColumn":i.deleteColumn().run();break;case"tableDeleteRow":i.deleteRow().run();break;case"tableDelete":i.deleteTable().run();break;case"tableInsert":i.insertTable(c).run();break;case"tableMergeCells":i.mergeCells().run();break;case"tableSelectColumn":i.selectColumn(c.pos).run();break;case"tableSelectRow":i.selectRow(c.pos).run();break;case"tableSplitCell":i.splitCell().run();break;case"taskList":l.toggleTaskList();break;case"textAlign":i.setTextAlign(c.textAlign).run();break;case"underline":i.toggleUnderline().run();break;case"video":i.setVideo({src:"init"}).run()}}function r(l){const{state:i,view:s}=l,{from:c}=i.selection,u=s.domAtPos(c).node.getBoundingClientRect(),p=i.tr.setMeta(cn.InlinePlaceholderKey,{type:"show",payload:{type:"inlineMath",label:"New equation",pos:c,rect:u}}).setSelection(i.selection);s.dispatch(p)}function a(l){const i=[];return l.state.doc.descendants((s,c)=>{s.type.name==="image"&&i.push({pos:c,attrs:s.attrs})}),i}return{isEditable:t,onCommand:o,run:n,getEditorImages:a}}const ar=e.defineComponent({__name:"OAlignDropdown",props:{editor:{type:Object},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"click"}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(null),l=e.computed(()=>[{label:o("editor.left"),value:"left",icon:"format_align_left"},{label:o("editor.center"),value:"center",icon:"format_align_center"},{label:o("editor.right"),value:"right",icon:"format_align_right"},{label:o("editor.justify"),value:"justify",icon:"format_align_justify"}]);function i(s){var c;(c=a.value)==null||c.setShow(!1),r(n.editor,"textAlign",{textAlign:s})}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",placement:t.placement,trigger:t.trigger,"show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"format_align_center","content-class":"o-align-dropdown dropdown",tooltip:e.unref(o)("editor.align")},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(We),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(d,u)=>{var p;return e.openBlock(),e.createBlock(e.unref(qe),{key:u,class:e.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive({textAlign:d.value})}),onClick:m=>i(d.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:d.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var m;return[(m=t.editor)!=null&&m.isActive({textAlign:d.value})?(e.openBlock(),e.createBlock(e.unref($),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},8,["placement","trigger"]))}}),Da=e.defineComponent({__name:"OCodeBlockDownloadDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["download"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Z(),{run:l}=oe(),i=e.ref(null),s=e.computed(()=>[{label:a("editor.code"),value:"code",icon:"code"},{label:"SVG",value:"svg",icon:"mermaid"}]);function c(u){return o.modelValue===u.value}function d(u){var p;(p=i.value)==null||p.setShow(!1),r("download",u.value)}return(u,p)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:i,class:"o-simple-command-btn","content-class":"dropdown",placement:"bottom-end",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{"content-class":"o-code-block-download-dropdown dropdown",icon:"download",tooltip:e.unref(a)("label.download")},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(We),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(m,f)=>(e.openBlock(),e.createBlock(e.unref(qe),{key:f,class:e.normalizeClass({"is-active":c(m)}),onClick:v=>d(m)},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:m.icon},null,8,["name"])]),suffix:e.withCtx(()=>[c(m)?(e.openBlock(),e.createBlock(e.unref($),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(m.label)+" ",1)]),_:2},1032,["class","onClick"]))),128))]),_:1})]),_:1},512))}}),La=e.defineComponent({__name:"OCodeBlockViewDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["update:modelValue"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Z(),{run:l}=oe(),i=e.ref(null),s=e.computed(()=>[{label:a("editor.code"),value:"code",icon:"code"},{label:a("label.preview"),value:"preview",icon:"mermaid"},{label:a("label.splitHorizontal"),value:"splitHorizontal",icon:"splitscreen_right"},{label:a("label.splitVertical"),value:"splitVertical",icon:"splitscreen_bottom"},{label:a("label.help"),value:"help",icon:"help",suffixIcon:"open_in_new",separator:!0}]),c=e.computed(()=>s.value.find(p=>p.value===o.modelValue));function d(p){return o.modelValue===p.value}function u(p){var m;switch((m=i.value)==null||m.setShow(!1),p.value){case"help":window.open("https://mermaid.js.org/intro/","target");break;default:r("update:modelValue",p.value)}}return(p,m)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:i,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{"content-class":"o-code-block-view-dropdown dropdown",icon:c.value.icon,tooltip:e.unref(a)("label.view")},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["icon","tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(We),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(f,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:v},[f.separator?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(qe),{class:e.normalizeClass({"is-active":d(f)}),onClick:b=>u(f)},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:f.icon},null,8,["name"])]),suffix:e.withCtx(()=>[f.suffixIcon?(e.openBlock(),e.createBlock(e.unref($),{key:0,name:f.suffixIcon,small:""},null,8,["name"])):d(f)?(e.openBlock(),e.createBlock(e.unref($),{key:1,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(f.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),ir=e.defineComponent({__name:"OLinkBtn",props:{editor:{type:Ae.Editor}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(),l=e.ref(!1),i=e.ref(""),s=e.ref(!0);function c(){var m;i.value="",s.value=!0;const p=(m=n.editor)==null?void 0:m.getAttributes("link");p!=null&&p.href&&(i.value=p.href,s.value=p.target==="_blank",console.log("show",l.value,p,s.value))}function d(){var p;(p=a.value)==null||p.setShow(!1)}function u(p){var m;p?r(n.editor,"linkSet",{href:p,target:s.value?"_blank":""}):r(n.editor,"linkUnset"),(m=a.value)==null||m.setShow(!1)}return(p,m)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:l.value,"onUpdate:show":[m[1]||(m[1]=f=>l.value=f),c]},{trigger:e.withCtx(()=>{var f;return[e.createVNode(e.unref(Te),{icon:"link","content-class":{"is-active":(f=t.editor)==null?void 0:f.isActive("link")},tooltip:e.unref(o)("editor.hyperlink")},null,8,["content-class","tooltip"])]}),default:e.withCtx(()=>[l.value?(e.openBlock(),e.createBlock(e.unref(bo),{key:0,title:e.unref(o)("editor.hyperlink"),val:i.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":e.withCtx(()=>[e.createVNode(e.unref(Nr),{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=f=>s.value=f),label:e.unref(o)("link.open_in_new_tab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):e.createCommentVNode("",!0)]),_:1},8,["show"]))}}),hs={class:"o-block-placeholder"},_s={class:"icon"},ks={class:"placeholder"},uo=e.defineComponent({__name:"OBlockPlaceholder",props:{icon:{type:String,default:"image"},placeholder:{type:String,default:""}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("section",hs,[e.createElementVNode("div",_s,[e.createVNode(e.unref($),{name:t.icon},null,8,["name"])]),e.createElementVNode("div",ks,e.toDisplayString(t.placeholder),1)]))}}),ys={class:"group o-tips"},ws={key:1,class:"item"},po=e.defineComponent({__name:"OBlockList",props:{items:{type:Array,required:!0},useKeyboard:{type:Boolean,required:!1}},emits:["select"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Z(),l=e.ref([]),i=(f,v)=>{f&&(l.value[v]=f)},s=e.ref(0);function c(f,v,b){r("select",f,b),l.value[v]&&l.value[v].setShow(!1)}function d(){s.value=(s.value+o.items.length-1)%o.items.length}function u(){s.value=(s.value+1)%o.items.length}function p(){c(o.items[s.value],s.value)}function m(f){switch(f.key){case"ArrowUp":f.preventDefault(),d();break;case"ArrowDown":f.preventDefault(),u();break;case"Enter":f.preventDefault(),p();break}}return e.watch(()=>o.useKeyboard,f=>{f?window.addEventListener("keydown",m):window.removeEventListener("keydown",m)}),e.onMounted(()=>{o.useKeyboard&&window.addEventListener("keydown",m)}),e.onBeforeUnmount(()=>{o.useKeyboard&&window.removeEventListener("keydown",m)}),(f,v)=>(e.openBlock(),e.createBlock(e.unref(We),{class:"o-block-list",hoverable:"",clickable:""},{default:e.withCtx(()=>[t.items.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(t.items,(b,_)=>{var h;return e.openBlock(),e.createElementBlock(e.Fragment,{key:_},[b.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[_>0?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",ys,e.toDisplayString(e.unref(a)(b.group)),1)],64)):e.createCommentVNode("",!0),(h=b.children)!=null&&h.length?(e.openBlock(),e.createBlock(e.unref(fe),{key:1,ref_for:!0,ref:w=>i(w,_),placement:"right-start",offset:[-10,16]},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Yo),{item:b,class:e.normalizeClass(["item",{"is-active":_===s.value}]),clickable:""},null,8,["item","class"])]),default:e.withCtx(()=>[e.createVNode(e.unref(po),{items:b.children,onSelect:w=>c(b,_,w)},null,8,["items","onSelect"])]),_:2},1536)):(e.openBlock(),e.createBlock(e.unref(Yo),{key:2,item:b,class:e.normalizeClass(["item",{"is-active":_===s.value}]),clickable:"",onClick:w=>c(b,_)},null,8,["item","class","onClick"]))],64)}),128)):(e.openBlock(),e.createElementBlock("div",ws,e.toDisplayString(e.unref(a)("label.noResults")),1))]),_:1}))}}),Es={key:0,class:"o-tips"},Yo=e.defineComponent({__name:"OBlockListItem",props:{item:{type:Object,required:!0}},emits:["select"],setup(t,{emit:n}){const{tr:o}=Z();return(r,a)=>(e.openBlock(),e.createBlock(e.unref(qe),{class:"o-block-list-item",clickable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:t.item.icon,color:t.item.color},null,8,["name","color"])]),suffix:e.withCtx(()=>{var l;return[t.item.tips?(e.openBlock(),e.createElementBlock("span",Es,e.toDisplayString(t.item.tips),1)):e.createCommentVNode("",!0),(l=t.item.children)!=null&&l.length?(e.openBlock(),e.createBlock(e.unref($),{key:1,name:"navigate_next",class:"o-tips"})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(o)(t.item.label)),1)]),_:1}))}}),Zo=(t,n)=>Ae.generateJSON(n,t.extensionManager.extensions),Cs=()=>{const t=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);return{mod:t?"⌘":"Ctrl",alt:t?"⌥":"Alt",shift:t?"⇧":"Shift",ctrl:t?"⌃":"Ctrl",meta:t?"⌘":"Meta"}},xs=t=>{const n=t==null?void 0:t.split("+").map(a=>a.trim().toLowerCase()).filter(Boolean);if(!n||!n.length)return t;const o=Cs();return n.map(a=>o[a]??a.toUpperCase()).join("+")},J={amber:"#ffc107",blue:"#2172e0",brown:"#795548",cyan:"#00bcd4",deepOrange:"#ff5722",deepPurple:"#673ab7",green:"#4caf50",indigo:"#3f51b5",lightBlue:"#03a9f4",lightGreen:"#8bc34a",lime:"#cddc39",orange:"#ff9800",purple:"#9c27b0",pink:"#e91e63",red:"#f44336",teal:"#009688",yellow:"#ffeb3b"},Ns=[{label:"blue",value:"#2172e0",name:"blue"},{label:"indigo",value:"#3f51b5",name:"indigo"},{label:"cyan",value:"#00bcd4",name:"cyan"},{label:"teal",value:"#009688",name:"teal"},{label:"green",value:"#4caf50",name:"green"},{label:"deep-purple",value:"#673ab7",name:"deep-purple"},{label:"red",value:"#f44336",name:"red"},{label:"deep-orange",value:"#ff5722",name:"deep-orange"}],vn=[{label:"editor.paragraph",value:"paragraph",icon:"title",color:"",style:!0,group:"label.basic"},{label:"editor.heading1",value:"heading",keywords:"h1",tips:"#",icon:"format_h1",color:J.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",keywords:"h2",tips:"##",icon:"format_h2",color:J.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",keywords:"h3",tips:"###",icon:"format_h3",color:J.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",keywords:"task",tips:"[]",icon:"check_box",color:J.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",keywords:"bullet",tips:"-",icon:"format_list_bulleted",color:J.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",keywords:"ordered",tips:"1.",icon:"format_list_numbered",color:J.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",keywords:"quote",tips:'"',icon:"format_quote_open",color:J.brown,style:!0},{label:"editor.toggleList",value:"details",keywords:"details, toggle",tips:">",icon:"toggle_list",color:J.indigo,style:!0},{label:"editor.codeBlock",value:"codeBlock",keywords:"code",tips:"```",icon:"code_braces",color:J.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",tips:"---",icon:"horizontal_rule",color:J.blue},{label:"editor.callout",value:"callout",color:J.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",keywords:"emoji",tips:":",icon:"emoji_emotions",color:J.blue}],un=vn.filter(t=>t.style),dn=[{label:"editor.aiBlock",value:"aiBlock",icon:"auto_awesome",color:J.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:J.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:J.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:J.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:J.indigo},{label:"diagram.name",value:"diagram",icon:"mermaid",color:J.purple,tips:"diagram",keywords:"code, diagram, mermaid"},{label:"label.image",value:"image",icon:"image",color:J.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:J.purple},{label:"label.model",value:"modelViewer",icon:"3d_rotation",tips:"model",color:J.purple}],Va=[{label:"editor.inlineMath",value:"inlineMath",icon:"function",color:J.blue,tips:"math",keywords:"inline, math, equation",group:"label.advanced"},{label:"editor.blockMath",value:"blockMath",icon:"functions",color:J.indigo,tips:"math",keywords:"block, math, equation"}],fo=[...vn,...dn,...Va],Xn=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:J.blue,tips:"Mod+D",group:"label.common",filter:"common"},{label:"label.copy",value:"copy",icon:"copy_all",color:J.indigo,filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Mod+X",color:J.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Mod+R",color:J.blue,filter:"image,video,model"},{label:"label.color",value:"color",icon:"palette",color:J.purple,filter:"style",component:"OTextColorBoard"},{label:"label.color",value:"callout_color",icon:"palette",color:J.purple,filter:"callout",component:"OCalloutColorBoard"}],$a=[{label:"ai.improve_writing",value:"improve_writing",icon:"title",color:J.purple,group:"label.suggested",options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"improve"},{label:"ai.fix_spelling_grammar",value:"fix_spelling_grammar",icon:"spellcheck",color:J.purple,options:{prompt:"Fix spelling and grammar of the following content: [CONTENT]"},tips:"fix"},{label:"ai.enrich_with_emoji",value:"enrich_with_emoji",icon:"emoji_emotions",color:J.purple,options:{prompt:"Enrich the following content with Emoji: [CONTENT]"},tips:"emoji"},{label:"ai.translate",value:"translate",icon:"translate",color:J.purple,options:{prompt:"Translate the following content to [LANGUAGE]: [CONTENT]"},children:[{label:"language.chinese_simplified",value:"Simplified Chinese",icon:"language"},{label:"language.chinese_traditional",value:"Traditional Chinese",icon:"language"},{label:"language.german",value:"German",icon:"language"},{label:"language.french",value:"French",icon:"language"},{label:"language.japanese",value:"Japanese",icon:"language"},{label:"language.korean",value:"Korean",icon:"language"}]},{label:"ai.make_longer",value:"make_longer",icon:"subject",color:J.purple,options:{prompt:"Make following content longer: [CONTENT]"},group:"label.edit",tips:"long"},{label:"ai.make_shorter",value:"make_shorter",icon:"short_text",color:J.purple,options:{prompt:"Make following content shorter: [CONTENT]"},tips:"short"},{label:"ai.change_tone",value:"change_tone",icon:"invert_colors",color:J.purple,options:{prompt:"Change tone of the following content to [TONE]: [CONTENT]"},children:[{label:"ai.tone.formal",value:"Formal",icon:"invert_colors"},{label:"ai.tone.casual",value:"Casual",icon:"invert_colors"},{label:"ai.tone.friendly",value:"Friendly",icon:"invert_colors"},{label:"ai.tone.enthusiastic",value:"Enthusiastic",icon:"invert_colors"},{label:"ai.tone.authoritative",value:"Authoritative",icon:"invert_colors"},{label:"ai.tone.humorous",value:"Humorous",icon:"invert_colors"},{label:"ai.tone.inspirational",value:"Inspirational",icon:"invert_colors"},{label:"ai.tone.empathetic",value:"Empathetic",icon:"invert_colors"},{label:"ai.tone.mysterious",value:"Mysterious",icon:"invert_colors"}]},{label:"ai.explain",value:"explain",icon:"format_quote_open",color:J.purple,options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"explain",group:"label.think"}],Pa=[{label:"ai.summarize",value:"summarize",icon:"notes",color:J.purple,options:{prompt:"Summarize the following content: [CONTENT]"},group:"label.suggested"},{label:"ai.continuation",value:"continuation",icon:"edit_note",color:J.purple,options:{prompt:"Continue writing with the content: [CONTENT]"}}],Ss={key:1,class:"group o-tips"},Ts={class:"suffix o-tips"},Os={key:1,class:"item"},Ut=e.defineComponent({__name:"OBlockMenu",props:{...G.nodeViewProps,colorful:{type:Boolean,default:!1},showGroup:{type:Boolean,default:!1}},emits:["action"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Z(),{run:l}=oe(),i=e.ref([]),s=e.computed(()=>{var h;return(h=o.node)==null?void 0:h.type.name}),c=e.computed(()=>un.find(h=>h.value===s.value)),d=e.computed(()=>{const h=c.value?Xn.filter(g=>{var C;return((C=g.filter)==null?void 0:C.indexOf("style"))>=0})??[]:[];let w=Xn.filter(g=>{var C;return((C=g.filter)==null?void 0:C.indexOf(s.value))>=0})??[];if(w=w.concat(h),w.length>0){const g=w[0];g.group=`editor.${s.value}`}const y=Xn.filter(g=>{var C;return((C=g.filter)==null?void 0:C.indexOf("common"))>=0});return[...w,...y]});function u(h){switch(h.component){case"OCalloutColorBoard":return dr;case"OTextColorBoard":return yr;default:return null}}function p(h){setTimeout(()=>{m(h),r("action",h)},0)}function m(h){switch(h.value){case"copy":f();break;case"delete":v();break;case"duplicate":b();break}}function f(){l(o.editor,"copySelected")}function v(){l(o.editor,"deleteSelected")}function b(){l(o.editor,"duplicateSelected")}function _(h,w){switch(console.log("select",h,w),w.name){case"backColor":o.updateAttributes({backColor:w.value});break;case"foreColor":o.updateAttributes({borderColor:w.value});break;case"color":l(o.editor,w.name,{color:w.value});break;case"backgroundColor":l(o.editor,w.name,{color:w.value});break}}return(h,w)=>(e.openBlock(),e.createBlock(e.unref(We),{class:"o-block-menu",hoverable:"",clickable:""},{default:e.withCtx(()=>[d.value.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(d.value,(y,g)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:g},[y.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[g>0||c.value?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0})):e.createCommentVNode("",!0),t.showGroup?(e.openBlock(),e.createElementBlock("div",Ss,e.toDisplayString(e.unref(a)(y.group)),1)):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0),u(y)?(e.openBlock(),e.createBlock(e.unref(fe),{key:1,ref_for:!0,ref:i.value[y.value],offset:[0,4],placement:"right"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(qe),{class:"item",clickable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:y.icon,color:t.colorful?y.color:""},null,8,["name","color"])]),suffix:e.withCtx(()=>[e.createVNode(e.unref($),{name:"navigate_next",class:"o-tips"})]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(a)(y.label)),1)]),_:2},1024)]),default:e.withCtx(()=>[(e.openBlock(),e.createBlock(e.resolveDynamicComponent(u(y)),{onSelect:C=>_(y,C)},null,40,["onSelect"]))]),_:2},1536)):(e.openBlock(),e.createBlock(e.unref(qe),{key:2,class:"item",clickable:"",onClick:e.withModifiers(C=>p(y),["stop"])},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:y.icon,color:t.colorful?y.color:""},null,8,["name","color"])]),suffix:e.withCtx(()=>[e.createElementVNode("div",Ts,e.toDisplayString(e.unref(xs)(y.tips)),1)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(a)(y.label)),1)]),_:2},1032,["onClick"]))],64))),128)):(e.openBlock(),e.createElementBlock("div",Os,"No result"))]),_:1}))}}),St=e.defineComponent({__name:"OBlockPopover",props:{modelValue:{type:Boolean,default:!1},placement:{type:String,default:"bottom-center"},showArrow:{type:Boolean,default:!1},hideClickOutside:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},tippyClass:{type:String,default:""},contentClass:{type:String,default:""},offset:{type:Object,default:function(){return[0,10]}}},emits:["update:modelValue","show","hide"],setup(t,{emit:n}){const o=t,r=n,a=e.ref();function l(s){r("update:modelValue",s)}function i(){console.log("click outside"),o.hideClickOutside&&r("update:modelValue",!1)}return e.watch(()=>o.modelValue,s=>{var c,d;s&&!o.readonly?(c=a.value)==null||c.setShow(!0):(d=a.value)==null||d.setShow(!1)}),e.onMounted(()=>{var s;o.modelValue&&((s=a.value)==null||s.setShow(!0))}),e.onUnmounted(()=>{var s;(s=a.value)==null||s.setShow(!1)}),(s,c)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,placement:t.placement,"tippy-class":t.tippyClass,"content-class":t.contentClass,trigger:"manual",arrow:t.showArrow,offset:t.offset,show:t.modelValue&&!t.readonly,"onUpdate:show":l,onClickoutside:i},{trigger:e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),default:e.withCtx(()=>[e.renderSlot(s.$slots,"popover-content")]),_:3},8,["placement","tippy-class","content-class","arrow","offset","show"]))}}),Fa={deepseek:{baseURL:"https://api.deepseek.com/v1",name:"DeepSeek"},openai:{baseURL:"https://api.openai.com/v1",name:"OpenAI"}},lr=(t,n)=>{const o=Fa[t];return o?o[n]:null},sr={writing:"You are a professional writing assistant. Please answer in [LANGUAGE]."},Ua=["bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","color","highlight","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","list-dropdown","codeBlock","link","image","video","modelViewer","table","callout","emoji","columns","aiBlock"],za=["table-group","separator","bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","details","list-dropdown","link","image"],Ha=["bold","strike","text-color-dropdown","clearFormat","separator","ai","separator","list-group","link","callout","separator","align-dropdown","more"],qa=["inline-math-edit","inlineMathDelete"],Ga=["link-open","link-edit","linkUnset"],Ka=["align-group","separator","link"],Wa=["align-group","separator","link-open","link-edit","linkUnset"],ja=["heading","separator","text-format-dropdown","italic","underline","font-family","separator","code","blockquote","details"],Ya=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],As=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],Za=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],Bs=["table-group","separator","align-group"],Ms={video:["youtube","youku","bilibili","qqvideo"],map:["google_map","amap","baidu_map"],design:["modao","lanhu","figma","canva","processon"],develop:["codepen"],data:["google_forms","jinshuju"],others:["iframe"]},Rs=new Xl({breaks:!0});function cr(){const t=e.inject("aiOption"),n=e.ref(null);function o(){if(!t.value)return;const{provider:a,apiKey:l,baseURL:i}=t.value,s=i||lr(a,"baseURL");!a||!l||!s||(n.value=new Zl({apiKey:l,baseURL:s,dangerouslyAllowBrowser:!0}))}const r=async(a,l)=>{var i,s,c;if(!n.value)throw new Error("AI SDK is not initialized, please check AI options.");try{const d=await((i=n.value)==null?void 0:i.chat.completions.create({model:"deepseek-chat",messages:a,temperature:.7,stream:!0}));let u="";for await(const p of d){const m=((c=(s=p.choices[0])==null?void 0:s.delta)==null?void 0:c.content)||"";u+=m,l(m)}return u}catch(d){throw console.error("API Error:",d),new Error(d.message||"API request failed")}};return e.watch(()=>t,a=>{o()},{deep:!0}),e.onMounted(()=>{o()}),{md:Rs,aiOption:t,createStreamingChatCompletion:r}}function mo(){const t=(r,a,l)=>{const i={type:"text/plain"};switch(r){case"svg":i.type="image/svg+xml;charset=utf-8";break}const s=new Blob([l],i),c=URL.createObjectURL(s),d=document.createElement("a");d.href=c,d.download=a,d.click(),URL.revokeObjectURL(c)},n=async r=>{try{const l=await(await fetch(r)).blob(),i=window.URL.createObjectURL(l),s=o(r),c=document.createElement("a");c.href=i,c.download=s,document.body.appendChild(c),c.click(),document.body.removeChild(c),window.URL.revokeObjectURL(i)}catch{window.open(r,"_blank")}},o=(r,a="png")=>{try{const s=new URL(r).pathname.split("/"),c=s[s.length-1];return c&&c.includes(".")?decodeURIComponent(c):`image-${Date.now()}.${a}`}catch{return`download-${Date.now()}.${a}`}};return{commonDownload:t,downloadImage:n}}function Xa(){const t=e.ref(),n=e.ref(!1);function o(i){t.value=i,i.editor.on("selectionUpdate",l)}function r(){var i;(i=t.value)==null||i.editor.off("selectionUpdate",l)}const a=e.computed(()=>{var c;const i=(c=t.value)==null?void 0:c.getPos();if(typeof i!="number")return null;const s=t.value.editor.state.doc.nodeAt(i);return s?{start:i+1,end:i+s.nodeSize-1}:null}),l=()=>{if(!t.value)return;const{editor:i}=t.value;if(!i.isFocused){n.value=!1;return}const{selection:s}=i.state;s&&(n.value=(s==null?void 0:s.$from.pos)>=a.value.start&&(s==null?void 0:s.$to.pos)<=a.value.end)};return{isFocused:n,bind:o,unbind:r,checkFocus:l}}function tn(){const t=e.inject("darkMode",{value:!1}),n=e.computed(()=>t.value?"dark":"light");return{darkMode:t,theme:n}}const Is={class:"o-block-toolbar editable-only"},Ds={class:"button-group"},ur=e.defineComponent({__name:"OBlockToolbar",props:{...G.nodeViewProps,type:{type:String,default:"link"},trigger:{type:String,default:"click"}},emits:["action"],setup(t,{emit:n}){const o=t,r=n,{locale:a,tr:l}=Z(),{isEditable:i,run:s}=oe(),c=e.ref();function d(u){var p;r("action",u),(p=c.value)==null||p.setShow(!1)}return(u,p)=>(e.openBlock(),e.createElementBlock("div",Is,[e.createElementVNode("section",Ds,[e.renderSlot(u.$slots,"default"),e.createVNode(e.unref(fe),{ref_key:"popover",ref:c,placement:"bottom-end",size:"medium",trigger:t.trigger,"show-arrow":!1},{trigger:e.withCtx(()=>[e.unref(i)?(e.openBlock(),e.createBlock(e.unref(Te),{key:0,icon:"more_horiz",tooltip:e.unref(l)("label.more")},null,8,["tooltip"])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createVNode(e.unref(Ut),e.mergeProps(o,{onAction:d}),null,16)]),_:1},8,["trigger"])])]))}}),Ls={class:"o-callout-color-board"},Vs={class:"fore-colors"},$s={class:"color-row"},Ps={class:"color-row"},Fs={class:"back-colors"},Us={class:"color-row"},zs={class:"color-row"},dr=e.defineComponent({__name:"OCalloutColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:n}){const o=n;function r(i,s){o("select",{name:i,value:s.value})}const a=e.computed(()=>[{label:"Grey",value:"#e9e9e9"},{label:"Brown",value:"#ffd591"},{label:"Orange",value:"#ffbb96"},{label:"Yellow",value:"#fff08f"},{label:"Green",value:"#b7eb8f"},{label:"Blue",value:"#91d5ff"},{label:"Purple",value:"#d3adf7"},{label:"Pink",value:"#ffadd2"},{label:"Red",value:"#ffa39e"}]),l=e.computed(()=>[{label:"Grey",value:"#F5F5F5"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(i,s)=>(e.openBlock(),e.createElementBlock("section",Ls,[e.createElementVNode("section",Vs,[s[4]||(s[4]=e.createElementVNode("div",{class:"label o-tips"},"Border color",-1)),e.createElementVNode("div",$s,[e.createVNode(e.unref(me),{icon:"slash_forward",tooltip:"No color","content-class":"border",onClick:s[0]||(s[0]=c=>r("foreColor",{value:""}))}),t.foreColor?(e.openBlock(),e.createBlock(e.unref(me),{key:0,tooltip:"Last used","content-style":{borderColor:t.foreColor},onClick:s[1]||(s[1]=c=>r("foreColor",{value:t.foreColor}))},null,8,["content-style"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",Ps,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(c,d)=>(e.openBlock(),e.createBlock(e.unref(me),{key:`col-${d}`,tooltip:c.label,"content-style":{borderColor:c.value},onClick:u=>r("foreColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])]),e.createElementVNode("section",Fs,[s[5]||(s[5]=e.createElementVNode("div",{class:"label o-tips"},"Background",-1)),e.createElementVNode("div",Us,[e.createVNode(e.unref(me),{icon:"slash_forward",tooltip:"Default Color","content-class":"border",onClick:s[2]||(s[2]=c=>r("backColor",{value:"#F5F5F5"}))}),t.backColor?(e.openBlock(),e.createBlock(e.unref(me),{key:0,"content-style":{backgroundColor:t.backColor},tooltip:"Last used","content-class":"border",onClick:s[3]||(s[3]=c=>r("backColor",{value:t.backColor}))},null,8,["content-style"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",zs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(c,d)=>(e.openBlock(),e.createBlock(e.unref(me),{key:`col-${d}`,tooltip:c.label,"content-style":{backgroundColor:c.value},onClick:u=>r("backColor",c)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),Hs=e.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(t,{emit:n}){const o=n,{tr:r}=Z(),{run:a}=oe(),l=e.ref(null),i=e.ref(""),s=e.ref("");function c(d,u){d==="foreColor"?(i.value=u,localStorage.setItem("yiitap.text-color.fore",u)):d==="backColor"&&(s.value=u,localStorage.setItem("yiitap.text-color.back",u)),o("select",d,u)}return e.onMounted(()=>{i.value=localStorage.getItem("yiitap.text-color.fore")||"",s.value=localStorage.getItem("yiitap.text-color.back")||""}),(d,u)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:l,placement:"bottom-center",trigger:"hover",arrow:""},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"palette",tooltip:e.unref(r)("editor.textColor")},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>{var p;return[e.createVNode(e.unref(dr),{"fore-color":i.value,"back-color":s.value,"default-label":e.unref(r)("editor.defaultColor"),"active-color":(p=t.editor)==null?void 0:p.getAttributes("textStyle").color,onSelect:c},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),Mn=e.defineComponent({__name:"OContextMenu",props:{modelValue:{type:Boolean,default:!1},clientX:{type:Number,default:0},clientY:{type:Number,default:0},event:{type:Object,default:function(){return{}}}},emits:["update:modelValue"],setup(t,{emit:n}){const o=t,r=n,a=e.ref();e.computed(()=>{var s;return o.clientX||((s=o.event)==null?void 0:s.clientX)||0}),e.computed(()=>{var s;return o.clientY||((s=o.event)==null?void 0:s.clientY)||0});function l(s){r("update:modelValue",s)}function i(){r("update:modelValue",!1)}return e.watch(()=>o.modelValue,s=>{var c;s?setTimeout(()=>{var d;(d=a.value)==null||d.setShow(s)},0):(c=a.value)==null||c.setShow(s)}),(s,c)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,placement:"bottom-start",trigger:"manual",show:t.modelValue,"show-arrow":!1,event:t.event,"onUpdate:show":l,onClickoutside:i},{default:e.withCtx(()=>[e.renderSlot(s.$slots,"default")]),_:3},8,["show","event"]))}}),qs={class:"o-color-board"},Gs={class:"cell-container"},Ks={class:"label"},Ws=["onClick"],Xt=e.defineComponent({__name:"OColorBoard",props:{defaultColor:{type:String,default:""},defaultLabel:{type:String,default:""},defaultDisabled:{type:Boolean,default:!1},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:n}){const o=t,r=n;function a(c){r("select",c.hex)}function l(c){return o.activeColor===c}function i(c){return"abc"}const s=e.computed(()=>[[{label:"color",rgb:"rgb(0, 0, 0)",hex:"#000000"},{label:"color",rgb:"rgb(38, 38, 38)",hex:"#262626"},{label:"color",rgb:"rgb(89, 89, 89)",hex:"#595959"},{label:"color",rgb:"rgb(140, 140, 140)",hex:"#8c8c8c"},{label:"color",rgb:"rgb(191, 191, 191)",hex:"#bfbfbf"},{label:"color",rgb:"rgb(217, 217, 217)",hex:"#d9d9d9"},{label:"color",rgb:"rgb(233, 233, 233)",hex:"#e9e9e9"},{label:"color",rgb:"rgb(245, 245, 245)",hex:"#f5f5f5"},{label:"color",rgb:"rgb(250, 250, 250)",hex:"#fafafa",border:!0},{label:"color",rgb:"rgb(255, 255, 255)",hex:"#ffffff",border:!0}],[{label:"color",rgb:"rgb(245, 34, 45)",hex:"#f5222d"},{label:"color",rgb:"rgb(250, 84, 28)",hex:"#fa541c"},{label:"color",rgb:"rgb(250, 140, 22)",hex:"#fa8c16"},{label:"color",rgb:"rgb(250, 219, 20)",hex:"#fadb14"},{label:"color",rgb:"rgb(82, 196, 26)",hex:"#52c41a"},{label:"color",rgb:"rgb(19, 194, 194)",hex:"#13c2c2"},{label:"color",rgb:"rgb(24, 144, 255)",hex:"#1890ff"},{label:"color",rgb:"rgb(47, 84, 235)",hex:"#2f54eb"},{label:"color",rgb:"rgb(114, 46, 209)",hex:"#722ed1"},{label:"color",rgb:"rgb(235, 47, 150)",hex:"#eb2f96"}],[{label:"color",rgb:"rgb(255, 232, 230)",hex:"#ffe8e6"},{label:"color",rgb:"rgb(255, 236, 224)",hex:"#ffece0"},{label:"color",rgb:"rgb(255, 239, 209)",hex:"#ffefd1"},{label:"color",rgb:"rgb(255, 248, 189)",hex:"#fff8bd"},{label:"color",rgb:"rgb(228, 247, 210)",hex:"#e4f7d2"},{label:"color",rgb:"rgb(211, 245, 240)",hex:"#d3f5f0"},{label:"color",rgb:"rgb(212, 238, 252)",hex:"#d4eefc"},{label:"color",rgb:"rgb(222, 232, 252)",hex:"#dee8fc"},{label:"color",rgb:"rgb(239, 225, 250)",hex:"#efe1fa"},{label:"color",rgb:"rgb(250, 225, 235)",hex:"#fae1eb"}],[{label:"color",rgb:"rgb(255, 163, 158)",hex:"#ffa39e"},{label:"color",rgb:"rgb(255, 187, 150)",hex:"#ffbb96"},{label:"color",rgb:"rgb(255, 213, 145)",hex:"#ffd591"},{label:"color",rgb:"rgb(255, 240, 143)",hex:"#fff08f"},{label:"color",rgb:"rgb(183, 235, 143)",hex:"#b7eb8f"},{label:"color",rgb:"rgb(135, 232, 222)",hex:"#87e8de"},{label:"color",rgb:"rgb(145, 213, 255)",hex:"#91d5ff"},{label:"color",rgb:"rgb(173, 198, 255)",hex:"#adc6ff"},{label:"color",rgb:"rgb(211, 173, 247)",hex:"#d3adf7"},{label:"color",rgb:"rgb(255, 173, 210)",hex:"#ffadd2"}],[{label:"color",rgb:"rgb(255, 77, 79)",hex:"#ff4d4f"},{label:"color",rgb:"rgb(255, 122, 69)",hex:"#ff7a45"},{label:"color",rgb:"rgb(255, 169, 64)",hex:"#ffa940"},{label:"color",rgb:"rgb(255, 236, 61)",hex:"#ffec3d"},{label:"color",rgb:"rgb(115, 209, 61)",hex:"#73d13d"},{label:"color",rgb:"rgb(54, 207, 201)",hex:"#36cfc9"},{label:"color",rgb:"rgb(64, 169, 255)",hex:"#40a9ff"},{label:"color",rgb:"rgb(89, 126, 247)",hex:"#597ef7"},{label:"color",rgb:"rgb(146, 84, 222)",hex:"#9254de"},{label:"color",rgb:"rgb(247, 89, 171)",hex:"#f759ab"}],[{label:"color",rgb:"rgb(207, 19, 34)",hex:"#cf1322"},{label:"color",rgb:"rgb(212, 56, 13)",hex:"#d4380d"},{label:"color",rgb:"rgb(212, 107, 8)",hex:"#d46b08"},{label:"color",rgb:"rgb(212, 177, 6)",hex:"#d4b106"},{label:"color",rgb:"rgb(56, 158, 13)",hex:"#389e0d"},{label:"color",rgb:"rgb(8, 151, 156)",hex:"#08979c"},{label:"color",rgb:"rgb(9, 109, 217)",hex:"#096dd9"},{label:"color",rgb:"rgb(29, 57, 196)",hex:"#1d39c4"},{label:"color",rgb:"rgb(83, 29, 171)",hex:"#531dab"},{label:"color",rgb:"rgb(196, 29, 127)",hex:"#c41d7f"}],[{label:"color",rgb:"rgb(130, 0, 20)",hex:"#820014"},{label:"color",rgb:"rgb(135, 20, 0)",hex:"#871400"},{label:"color",rgb:"rgb(135, 56, 0)",hex:"#873800"},{label:"color",rgb:"rgb(97, 71, 0)",hex:"#614700"},{label:"color",rgb:"rgb(19, 82, 0)",hex:"#135200"},{label:"color",rgb:"rgb(0, 71, 79)",hex:"#00474f"},{label:"color",rgb:"rgb(0, 58, 140)",hex:"#003a8c"},{label:"color",rgb:"rgb(6, 17, 120)",hex:"#061178"},{label:"color",rgb:"rgb(34, 7, 94)",hex:"#22075e"},{label:"color",rgb:"rgb(120, 6, 80)",hex:"#780650"}]]);return(c,d)=>(e.openBlock(),e.createElementBlock("section",qs,[t.defaultDisabled?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,class:"default-color",onClick:d[0]||(d[0]=u=>a({hex:t.defaultColor}))},[e.createElementVNode("div",Gs,[e.createElementVNode("div",{class:"cell border",style:e.normalizeStyle({background:t.defaultColor})},[e.createVNode(e.unref($),{name:"slash_forward"})],4)]),e.createElementVNode("div",Ks,e.toDisplayString(t.defaultLabel),1)])),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(s.value,(u,p)=>(e.openBlock(),e.createElementBlock("div",{class:"color-row",key:`row-${p}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u,(m,f)=>(e.openBlock(),e.createElementBlock("div",{class:"",key:`col-${f}`},[e.createElementVNode("div",{class:"cell-container",onClick:v=>a(m)},[e.createElementVNode("div",{class:e.normalizeClass(["cell",{border:m.border}]),style:e.normalizeStyle({backgroundColor:m.hex})},[l(m.hex)?(e.openBlock(),e.createBlock(e.unref($),{key:0,name:"done",style:e.normalizeStyle({color:i(m.rgb)})},null,8,["style"])):e.createCommentVNode("",!0)],6)],8,Ws)]))),128))]))),128))]))}}),Te=e.defineComponent({__name:"OCommandBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:n}){const o=n;return(r,a)=>(e.openBlock(),e.createBlock(e.unref(ct),{placement:t.placement},{trigger:e.withCtx(()=>[e.createElementVNode("button",{class:e.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:e.normalizeStyle(t.contentStyle),onClick:a[0]||(a[0]=l=>o("click",l))},[t.icon?(e.openBlock(),e.createBlock(e.unref($),{key:0,name:t.icon,color:t.color,class:e.normalizeClass(t.iconClass)},null,8,["name","color","class"])):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"default")],6)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),js={key:0,class:"spinner"},mt=e.defineComponent({__name:"OCommonBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:n}){const o=t,r=n;function a(l){o.loading||r("click",l)}return(l,i)=>(e.openBlock(),e.createBlock(e.unref(ct),{placement:t.placement},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:e.normalizeStyle(t.contentStyle),onClick:e.withModifiers(a,["stop"])},[t.loading?(e.openBlock(),e.createElementBlock("div",js)):(e.openBlock(),e.createBlock(e.unref($),{key:1,name:t.icon,color:t.color,class:e.normalizeClass(t.iconClass)},null,8,["name","color","class"])),e.renderSlot(l.$slots,"default")],6)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),Ys={key:0,class:"o-doc-toc toc"},Zs={class:"mini-view"},Xs={class:"toc__list"},Qs={class:"main-view o-scroll",style:{"max-width":"480px"}},Js={class:"toc__title"},ec={class:"toc__list"},tc=["onClick"],nc=e.defineComponent({name:"ODocToc",__name:"ODocToc",props:{editor:{type:Ae.Editor},maxLevel:{type:Number,default:3}},emits:["docScroll"],setup(t,{expose:n,emit:o}){const r=t,a=o,{tr:l}=Z(),i=e.ref([]),s=e.ref("");function c(){var f;s.value=window.location.hash,(f=r.editor)==null||f.on("update",u),setTimeout(()=>{d(),u()},0)}function d(){const f=document.querySelector(".yiitap"),v=f==null?void 0:f.parentElement;v==null||v.addEventListener("scroll",p)}function u(){var v;const f=[];(v=r.editor)==null||v.state.doc.descendants((b,_)=>{if(b.type.name==="heading"){const h=b.attrs.id;f.push({level:b.attrs.level,text:b.textContent,id:h})}}),i.value=f}function p(f){for(const v of i.value){const b=document.querySelector(`[data-id="${v.id}"]`);if(!b)continue;const _=b.getBoundingClientRect();if(_.top>=0&&_.top<window.innerHeight/2){s.value=v.id;break}}a("docScroll",f)}function m(f){s.value=f.id;const v=document.querySelector(`[data-id="${f.id}"]`);v&&v.scrollIntoView({behavior:"smooth",block:"start"})}return e.watch(()=>r.editor,f=>{c()}),n({onScroll:p,headings:i}),(f,v)=>i.value.length?(e.openBlock(),e.createElementBlock("section",Ys,[e.createVNode(e.unref(fe),{ref:"popover","tippy-class":"o-toc-popover",placement:"left-start",offset:[0,-50],delay:0,duration:100},{trigger:e.withCtx(()=>[e.createElementVNode("div",Zs,[e.createElementVNode("ul",Xs,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(b,_)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:_},[b.level<=Math.max(Math.min(t.maxLevel,3),2)?(e.openBlock(),e.createElementBlock("li",{key:0,class:e.normalizeClass(["toc__item",[s.value===b.id?"selected":"",`toc__item--${b.level}`]])},null,2)):e.createCommentVNode("",!0)],64))),128))])])]),default:e.withCtx(()=>[e.createElementVNode("div",Qs,[e.createElementVNode("div",Js,e.toDisplayString(e.unref(l)("label.toc")),1),e.renderSlot(f.$slots,"title"),e.createElementVNode("ul",ec,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(b,_)=>(e.openBlock(),e.createElementBlock("li",{class:e.normalizeClass(["toc__item",`toc__item--${b.level}`]),key:_},[e.createElementVNode("span",{class:e.normalizeClass(["heading",{selected:s.value===b.id}]),onClick:h=>m(b)},e.toDisplayString(b.text),11,tc)],2))),128))])])]),_:3},512)])):e.createCommentVNode("",!0)}}),oc={class:"o-emoji-select"},rc={key:0},ac={class:"groups o-scroll"},ic={class:"items"},lc=["onClick"],sc={key:0,class:"groups-empty"},cc={class:"group-icons"},uc=["onClick"],go=e.defineComponent({__name:"OEmojiSelect",props:{items:{type:Array,required:!0},enableSearch:{type:Boolean,default:!1}},emits:["select"],setup(t,{emit:n}){const o=t,r=n,a=e.ref(null),l=e.ref(""),i=e.ref([]),s=e.ref([]),c=e.ref(0),d=e.computed(()=>l.value?i.value:o.items),u=e.computed(()=>{let v=!1;return d.value.map(b=>{v=v||b.emojis.length}),v});function p(){c.value=0,i.value=l.value?Nn.filterEmojiGroups(l.value):[]}function m(v){r("select",v)}function f(v,b){c.value=b,s.value[b].scrollIntoView({behavior:"instant",block:"start"})}return e.onMounted(()=>{}),(v,b)=>(e.openBlock(),e.createElementBlock("section",oc,[t.enableSearch?(e.openBlock(),e.createElementBlock("div",rc,[e.createVNode(e.unref(vt),{ref_key:"input",ref:a,modelValue:l.value,"onUpdate:modelValue":[b[0]||(b[0]=_=>l.value=_),p],type:"text",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0),e.createElementVNode("section",ac,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(_,h)=>{var w;return e.withDirectives((e.openBlock(),e.createElementBlock("div",{key:`group-${h}`,class:"group"},[e.createElementVNode("header",{ref_for:!0,ref_key:"groupRefs",ref:s},e.toDisplayString(_.name),513),e.createElementVNode("section",ic,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(_.emojis,(y,g)=>(e.openBlock(),e.createElementBlock("div",{key:`item-${g}`},[e.createElementVNode("div",{class:"item",onClick:C=>m(y)},e.toDisplayString(y.emoji),9,lc)]))),128))])],512)),[[e.vShow,(w=_.emojis)==null?void 0:w.length]])}),128)),u.value?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",sc,"没有记录"))]),e.createElementVNode("section",cc,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(d.value,(_,h)=>(e.openBlock(),e.createBlock(e.unref(ct),{key:`target-${h}`,delay:300},{trigger:e.withCtx(()=>{var w;return[e.withDirectives(e.createElementVNode("div",{class:e.normalizeClass(["item",{active:c.value===h}]),onClick:y=>f(_,h)},[e.createVNode(e.unref($),{name:e.unref(Nn.emojiGroupIcons)[_.slug]},null,8,["name"])],10,uc),[[e.vShow,(w=_.emojis)==null?void 0:w.length]])]}),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(_.name),1)]),_:2},1024))),128))])]))}}),Qn=[{label:"1C Enterprise",value:"1c",ext:["1c","v8c"],icon:"code_blocks"},{label:"ABNF",value:"abnf",ext:["abnf"],icon:"code_blocks"},{label:"Access Log",value:"accesslog",ext:["log"],icon:"code_blocks"},{label:"ActionScript",value:"actionscript",ext:["as"],icon:"code_blocks"},{label:"Ada",value:"ada",ext:["adb","ads","ada"],icon:"code_blocks"},{label:"AngelScript",value:"angelscript",ext:["as","asc"],icon:"code_blocks"},{label:"Apache Config",value:"apache",ext:["conf","htaccess"],icon:"code_blocks"},{label:"AppleScript",value:"applescript",ext:["scpt","applescript"],icon:"code_blocks"},{label:"Arcade",value:"arcade",ext:["arcade"],icon:"code_blocks"},{label:"Arduino",value:"arduino",ext:["ino","pde"],icon:"code_blocks"},{label:"ARM Assembly",value:"armasm",ext:["s","asm"],icon:"code_blocks"},{label:"AsciiDoc",value:"asciidoc",ext:["adoc","asciidoc"],icon:"code_blocks"},{label:"AspectJ",value:"aspectj",ext:["aj"],icon:"code_blocks"},{label:"AutoHotkey",value:"autohotkey",ext:["ahk"],icon:"code_blocks"},{label:"AutoIt",value:"autoit",ext:["au3"],icon:"code_blocks"},{label:"AVR Assembly",value:"avrasm",ext:["s","asm"],icon:"code_blocks"},{label:"AWK",value:"awk",ext:["awk","gawk","mawk"," nawk"],icon:"code_blocks"},{label:"Axapta",value:"axapta",ext:["xpo","axp"],icon:"code_blocks"},{label:"BASIC",value:"basic",ext:["bas"],icon:"code_blocks"},{label:"Bash",value:"bash",ext:["sh","bash","zsh"],icon:"code_blocks"},{label:"BNF",value:"bnf",ext:["bnf"],icon:"code_blocks"},{label:"Brainfuck",value:"brainfuck",ext:["bf","b"],icon:"code_blocks"},{label:"CAL",value:"cal",ext:["cal"],icon:"code_blocks"},{label:"Capn Proto",value:"capnproto",ext:["capnp"],icon:"code_blocks"},{label:"Ceylon",value:"ceylon",ext:["ceylon"],icon:"code_blocks"},{label:"Clean",value:"clean",ext:["icl","dcl","prg"],icon:"code_blocks"},{label:"Clojure",value:"clojure",ext:["clj","cljs","cljc"],icon:"code_blocks"},{label:"Clojure REPL",value:"clojure-repl",ext:["clj"],icon:"code_blocks"},{label:"CMake",value:"cmake",ext:["cmake","CMakeLists.txt"],icon:"code_blocks"},{label:"CoffeeScript",value:"coffeescript",ext:["coffee","litcoffee"],icon:"code_blocks"},{label:"Coq",value:"coq",ext:["v"],icon:"code_blocks"},{label:"COS",value:"cos",ext:["cos"],icon:"code_blocks"},{label:"C++",value:"cpp",ext:["cpp","hpp","cc","cxx","h","hxx"],icon:"code_blocks"},{label:"crmsh",value:"crmsh",ext:["crm","pcs"],icon:"code_blocks"},{label:"Crystal",value:"crystal",ext:["cr"],icon:"code_blocks"},{label:"C#",value:"csharp",ext:["cs"],icon:"code_blocks"},{label:"CSP",value:"csp",ext:["csp"],icon:"code_blocks"},{label:"CSS",value:"css",ext:["css"],icon:"code_blocks"},{label:"C",value:"c",ext:["c","h"],icon:"code_blocks"},{label:"D",value:"d",ext:["d","di"],icon:"code_blocks"},{label:"Dart",value:"dart",ext:["dart"],icon:"code_blocks"},{label:"Delphi",value:"delphi",ext:["pas","dfm","dpr","dpk"],icon:"code_blocks"},{label:"Diff",value:"diff",ext:["diff","patch"],icon:"code_blocks"},{label:"Django",value:"django",ext:["html","py","css","js"],icon:"code_blocks"},{label:"DNS Zone File",value:"dns",ext:["zone","dns"],icon:"code_blocks"},{label:"Dockerfile",value:"dockerfile",ext:["Dockerfile","dockerfile"],icon:"code_blocks"},{label:"DOS Batch",value:"dos",ext:["bat","cmd"],icon:"code_blocks"},{label:"dsconfig",value:"dsconfig",ext:["dsconfig"],icon:"code_blocks"},{label:"DTS",value:"dts",ext:["dts","dtsi"],icon:"code_blocks"},{label:"Dust",value:"dust",ext:["dust","dst"],icon:"code_blocks"},{label:"EBNF",value:"ebnf",ext:["ebnf"],icon:"code_blocks"},{label:"Elixir",value:"elixir",ext:["ex","exs"],icon:"code_blocks"},{label:"Elm",value:"elm",ext:["elm"],icon:"code_blocks"},{label:"ERB",value:"erb",ext:["erb","rhtml"],icon:"code_blocks"},{label:"Erlang",value:"erlang",ext:["erl","hrl"],icon:"code_blocks"},{label:"Erlang REPL",value:"erlang-repl",ext:["erl"],icon:"code_blocks"},{label:"Excel",value:"excel",ext:["xls","xlsx"],icon:"code_blocks"},{label:"FIX",value:"fix",ext:["fix"],icon:"code_blocks"},{label:"Flix",value:"flix",ext:["flix"],icon:"code_blocks"},{label:"Fortran",value:"fortran",ext:["f","for","f90","f95","f03","f08"],icon:"code_blocks"},{label:"F#",value:"fsharp",ext:["fs","fsi","fsx"],icon:"code_blocks"},{label:"GAMS",value:"gams",ext:["gms","gams"],icon:"code_blocks"},{label:"Gauss",value:"gauss",ext:["gss","prg"],icon:"code_blocks"},{label:"G-code",value:"gcode",ext:["nc","gcode","g","ngc"],icon:"code_blocks"},{label:"Gherkin",value:"gherkin",ext:["feature"],icon:"code_blocks"},{label:"GLSL",value:"glsl",ext:["vert","frag","geom","comp","tesc","tese","glsl"],icon:"code_blocks"},{label:"GameMaker Language",value:"gml",ext:["gml","gm81","gm"],icon:"code_blocks"},{label:"Golo",value:"golo",ext:["golo"],icon:"code_blocks"},{label:"Go",value:"go",ext:["go"],icon:"code_blocks"},{label:"Gradle",value:"gradle",ext:["gradle","gradle.kts"],icon:"code_blocks"},{label:"GraphQL",value:"graphql",ext:["graphql","gql"],icon:"code_blocks"},{label:"Groovy",value:"groovy",ext:["groovy","gvy","gy","gsh"],icon:"code_blocks"},{label:"Haml",value:"haml",ext:["haml"],icon:"code_blocks"},{label:"Handlebars",value:"handlebars",ext:["hbs","handlebars","html"],icon:"code_blocks"},{label:"Haskell",value:"haskell",ext:["hs","lhs"],icon:"code_blocks"},{label:"Haxe",value:"haxe",ext:["hx"],icon:"code_blocks"},{label:"HSP",value:"hsp",ext:["hsp"],icon:"code_blocks"},{label:"HTML",value:"html",ext:["html"],icon:"code_blocks"},{label:"HTTP",value:"http",ext:["http","rest"],icon:"code_blocks"},{label:"Hy",value:"hy",ext:["hy"],icon:"code_blocks"},{label:"Inform 7",value:"inform7",ext:["ni","i7x"],icon:"code_blocks"},{label:"INI",value:"ini",ext:["ini","cfg","conf"],icon:"code_blocks"},{label:"IRPF90",value:"irpf90",ext:["90","f90","f95","f03","f08"],icon:"code_blocks"},{label:"ISBL",value:"isbl",ext:["isbl"],icon:"code_blocks"},{label:"Java",value:"java",ext:["java"],icon:"code_blocks"},{label:"JavaScript",value:"javascript",ext:["js","jsx"],icon:"code_blocks"},{label:"JBoss CLI",value:"jboss-cli",ext:["cli"],icon:"code_blocks"},{label:"Julia",value:"julia",ext:["jl"],icon:"code_blocks"},{label:"Julia REPL",value:"julia-repl",ext:["jl"],icon:"code_blocks"},{label:"JSON",value:"json",ext:["json"],icon:"code_blocks"},{label:"Kotlin",value:"kotlin",ext:["kt","kts"],icon:"code_blocks"},{label:"Lasso",value:"lasso",ext:["lasso","ls","lasso9"],icon:"code_blocks"},{label:"LaTeX",value:"latex",ext:["tex","latex"],icon:"code_blocks"},{label:"LDIF",value:"ldif",ext:["ldif"],icon:"code_blocks"},{label:"Leaf",value:"leaf",ext:["leaf"],icon:"code_blocks"},{label:"Less",value:"less",ext:["less"],icon:"code_blocks"},{label:"Lisp",value:"lisp",ext:["lisp","lsp","cl"],icon:"code_blocks"},{label:"LiveCode Server",value:"livecodeserver",ext:["lc","livecode"],icon:"code_blocks"},{label:"LiveScript",value:"livescript",ext:["ls"],icon:"code_blocks"},{label:"LLVM",value:"llvm",ext:["ll","bc"],icon:"code_blocks"},{label:"LSL",value:"lsl",ext:["lsl"],icon:"code_blocks"},{label:"Lua",value:"lua",ext:["lua"],icon:"code_blocks"},{label:"Makefile",value:"makefile",ext:["make","Makefile","GNUmakefile"],icon:"code_blocks"},{label:"Markdown",value:"markdown",ext:["md","markdown","mdown","mkdn"],icon:"code_blocks"},{label:"Mathematica",value:"mathematica",ext:["nb","m","wl"],icon:"code_blocks"},{label:"MATLAB",value:"matlab",ext:["m"],icon:"code_blocks"},{label:"Maxima",value:"maxima",ext:["mac","max"],icon:"code_blocks"},{label:"MEL",value:"mel",ext:["mel"],icon:"code_blocks"},{label:"Mermaid",value:"mermaid",ext:["mermaid"],icon:"mermaid"},{label:"Mercury",value:"mercury",ext:["m","moo"],icon:"code_blocks"},{label:"MIPS Assembly",value:"mipsasm",ext:["s","asm"],icon:"code_blocks"},{label:"Mizar",value:"mizar",ext:["miz"],icon:"code_blocks"},{label:"Mojolicious",value:"mojolicious",ext:["pl","pm"],icon:"code_blocks"},{label:"Monkey",value:"monkey",ext:["monkey","mk"],icon:"code_blocks"},{label:"MoonScript",value:"moonscript",ext:["moon"],icon:"code_blocks"},{label:"N1QL",value:"n1ql",ext:["n1ql"],icon:"code_blocks"},{label:"NestedText",value:"nestedtext",ext:["nt"],icon:"code_blocks"},{label:"Nginx",value:"nginx",ext:["conf","nginx"],icon:"code_blocks"},{label:"Nim",value:"nim",ext:["nim","nims"],icon:"code_blocks"},{label:"Nix",value:"nix",ext:["nix"],icon:"code_blocks"},{label:"Node.js REPL",value:"node-repl",ext:["js"],icon:"code_blocks"},{label:"NSIS",value:"nsis",ext:["nsi","nsh"],icon:"code_blocks"},{label:"Objective-C",value:"objectivec",ext:["m","mm"],icon:"code_blocks"},{label:"OCaml",value:"ocaml",ext:["ml","mli","mll","mly"],icon:"code_blocks"},{label:"OpenSCAD",value:"openscad",ext:["scad"],icon:"code_blocks"},{label:"Oxygene",value:"oxygene",ext:["pas","dpr","pp"],icon:"code_blocks"},{label:"Parser3",value:"parser3",ext:["p3"],icon:"code_blocks"},{label:"Perl",value:"perl",ext:["pl","pm","t","pod"],icon:"code_blocks"},{label:"PF",value:"pf",ext:["pf"],icon:"code_blocks"},{label:"PostgreSQL",value:"pgsql",ext:["sql","pgsql"],icon:"code_blocks"},{label:"PHP Template",value:"php-template",ext:["phtml","php"],icon:"code_blocks"},{label:"PHP",value:"php",ext:["php","php3","php4","php5","phps","phpt"],icon:"code_blocks"},{label:"Plain Text",value:"plaintext",ext:["txt","text","md","markdown"],icon:"code_blocks"},{label:"Pony",value:"pony",ext:["pony"],icon:"code_blocks"},{label:"PowerShell",value:"powershell",ext:["ps1","psm1","psd1"],icon:"code_blocks"},{label:"Processing",value:"processing",ext:["pde"],icon:"code_blocks"},{label:"Profile",value:"profile",ext:["profile","rc","bashrc","zshrc"],icon:"code_blocks"},{label:"Prolog",value:"prolog",ext:["pl","pro","prolog"],icon:"code_blocks"},{label:"Properties",value:"properties",ext:["properties","ini","cfg"],icon:"code_blocks"},{label:"Protocol Buffers",value:"protobuf",ext:["proto"],icon:"code_blocks"},{label:"Puppet",value:"puppet",ext:["pp"],icon:"code_blocks"},{label:"PureBasic",value:"purebasic",ext:["pb","pbi"],icon:"code_blocks"},{label:"Python REPL",value:"python-repl",ext:["py"],icon:"code_blocks"},{label:"Python",value:"python",ext:["py","pyw","cpy","gyp"],icon:"code_blocks"},{label:"Q",value:"q",ext:["q"],icon:"code_blocks"},{label:"QML",value:"qml",ext:["qml","js"],icon:"code_blocks"},{label:"R",value:"r",ext:["r","R","rmd","Rmd"],icon:"code_blocks"},{label:"ReasonML",value:"reasonml",ext:["re","rei"],icon:"code_blocks"},{label:"RIB",value:"rib",ext:["rib"],icon:"code_blocks"},{label:"Roboconf",value:"roboconf",ext:["graph","instances"],icon:"code_blocks"},{label:"RouterOS",value:"routeros",ext:["rsc","txt"],icon:"code_blocks"},{label:"RSL",value:"rsl",ext:["rsl"],icon:"code_blocks"},{label:"Ruby",value:"ruby",ext:["rb","rbw","rake","gemspec","ru"],icon:"code_blocks"},{label:"Rust",value:"rust",ext:["rs","rlib"],icon:"code_blocks"},{label:"Rules Language",value:"ruleslanguage",ext:["rules"],icon:"code_blocks"},{label:"SAS",value:"sas",ext:["sas"],icon:"code_blocks"},{label:"Scala",value:"scala",ext:["scala","sc","sbt"],icon:"code_blocks"},{label:"Scheme",value:"scheme",ext:["scm","ss","rkt","rktd","rktl"],icon:"code_blocks"},{label:"Scilab",value:"scilab",ext:["sci","sce"],icon:"code_blocks"},{label:"SCSS",value:"scss",ext:["scss","sass"],icon:"code_blocks"},{label:"Shell",value:"shell",ext:["sh","bash","zsh","ksh","csh","tcsh"],icon:"code_blocks"},{label:"Smali",value:"smali",ext:["smali"],icon:"code_blocks"},{label:"Smalltalk",value:"smalltalk",ext:["st"],icon:"code_blocks"},{label:"Standard ML",value:"sml",ext:["sml","sig","fun"],icon:"code_blocks"},{label:"SQL",value:"sql",ext:["sql","ddl","dml"],icon:"code_blocks"},{label:"SQF",value:"sqf",ext:["sqf"],icon:"code_blocks"},{label:"Stan",value:"stan",ext:["stan"],icon:"code_blocks"},{label:"Stata",value:"stata",ext:["do","ado","mata"],icon:"code_blocks"},{label:"Step21",value:"step21",ext:["stp","step"],icon:"code_blocks"},{label:"Stylus",value:"stylus",ext:["styl","stylus"],icon:"code_blocks"},{label:"Subunit",value:"subunit",ext:["subunit"],icon:"code_blocks"},{label:"SVG",value:"svg",ext:["svg"],icon:"code_blocks"},{label:"Swift",value:"swift",ext:["swift"],icon:"code_blocks"},{label:"Tagger Script",value:"taggerscript",ext:["tag"],icon:"code_blocks"},{label:"TAP",value:"tap",ext:["tap"],icon:"code_blocks"},{label:"Tcl",value:"tcl",ext:["tcl","tk","itcl","itk"],icon:"code_blocks"},{label:"Thrift",value:"thrift",ext:["thrift"],icon:"code_blocks"},{label:"TP",value:"tp",ext:["tp"],icon:"code_blocks"},{label:"Twig",value:"twig",ext:["twig","tpl"],icon:"code_blocks"},{label:"TypeScript",value:"typescript",ext:["ts","tsx"],icon:"code_blocks"},{label:"Vala",value:"vala",ext:["vala","vapi"],icon:"code_blocks"},{label:"VB.NET",value:"vbnet",ext:["vb"],icon:"code_blocks"},{label:"VBScript (HTML)",value:"vbscript-html",ext:["html","htm","asp","vbs"],icon:"code_blocks"},{label:"VBScript",value:"vbscript",ext:["vbs","vbe"],icon:"code_blocks"},{label:"Verilog",value:"verilog",ext:["v","vh","sv","svh"],icon:"code_blocks"},{label:"VHDL",value:"vhdl",ext:["vhd","vhdl"],icon:"code_blocks"},{label:"Vim",value:"vim",ext:["vim","vba","vbe","exrc"],icon:"code_blocks"},{label:"WebAssembly",value:"wasm",ext:["wasm","wat"],icon:"code_blocks"},{label:"Wren",value:"wren",ext:["wren"],icon:"code_blocks"},{label:"x86 Assembly",value:"x86asm",ext:["asm","s","S"],icon:"code_blocks"},{label:"XL",value:"xl",ext:["xl","xls","xlsx"],icon:"code_blocks"},{label:"XML",value:"xml",ext:["xml","xsd","xsl","xslt","rss","atom","svg"],icon:"code_blocks"},{label:"XQuery",value:"xquery",ext:["xq","xquery","xql","xqm"],icon:"code_blocks"},{label:"YAML",value:"yaml",ext:["yaml","yml"],icon:"code_blocks"},{label:"Zephir",value:"zephir",ext:["zep"],icon:"code_blocks"}],dc={class:"selected-language"},pc={class:"header"},fc={class:"o-scroll"},Qa=e.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Z(),l=e.ref(),i=e.ref(),s=e.ref(""),c=e.ref(0),d=e.ref(""),u=e.computed(()=>s.value?Qn.filter(h=>h.value.toLowerCase().indexOf(s.value.toLowerCase())>=0):Qn),p=e.computed(()=>Qn.find(h=>h.value===d.value));function m(h){h&&setTimeout(()=>{var w;(w=i.value)==null||w.focus(),c.value=0,window.addEventListener("keyup",_)},0)}function f(){var h;window.removeEventListener("keyup",_),(h=l.value)==null||h.setShow(!1)}function v(h){f(),d.value=h.value,r("select",h.value)}function b(){v(u.value[c.value])}function _(h){if(u.value.length>0){switch(h.code){case"ArrowDown":c.value=c.value+1;break;case"ArrowUp":c.value=c.value-1;break;case"Enter":b();break}c.value>=u.value.length&&(c.value=0),c.value<0&&(c.value=u.value.length-1)}else c.value=0}return e.onMounted(()=>{d.value=o.language}),(h,w)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:l,placement:"bottom-start",trigger:"click","tippy-class":"o-language-popover","conten-class":"dropdown","onUpdate:show":m},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ke),{class:"o-dropdown-btn"},{default:e.withCtx(()=>{var y;return[e.createElementVNode("span",dc,e.toDisplayString((y=p.value)==null?void 0:y.label),1),e.createVNode(e.unref($),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:e.withCtx(()=>[e.createElementVNode("header",pc,[e.createVNode(e.unref(vt),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":w[0]||(w[0]=y=>s.value=y),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),e.createElementVNode("section",fc,[e.createVNode(e.unref(We),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(u.value,(y,g)=>(e.openBlock(),e.createBlock(e.unref(qe),{key:g,onClick:C=>v(y),class:e.normalizeClass({"is-active":y.value===d.value,"is-select":g===c.value})},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:y.icon},null,8,["name"])]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(y.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),mc={class:"o-media-input"},gc={class:"fields"},bc={class:"actions"},pr=e.defineComponent({__name:"OMediaInput",props:{val:{type:String,default:""},type:{type:String,default:""}},emits:["input"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Z(),l=e.ref(),i=e.ref(""),s=e.ref("");function c(){return s.value?(i.value="null",!0):(i.value="error",!1)}function d(){c()&&r("input",s.value)}return e.onMounted(()=>{s.value=o.val,setTimeout(()=>{var u;(u=l.value)==null||u.focus()},0)}),(u,p)=>(e.openBlock(),e.createElementBlock("section",mc,[e.createElementVNode("section",gc,[p[1]||(p[1]=e.createElementVNode("div",{class:"o-media-title"},"Link",-1)),e.createVNode(e.unref(vt),{ref_key:"input",ref:l,modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=m=>s.value=m),status:i.value,type:"text",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),e.createElementVNode("footer",bc,[e.createVNode(e.unref(ke),{type:"info",onClick:d},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("label.ok")),1)]),_:1})])]))}}),vc={class:"o-meta-input"},hc={class:"header"},_c={class:"title"},kc={class:"fields"},yc={class:"actions"},bo=e.defineComponent({__name:"OMetaInput",props:{val:{type:String,default:""},title:{type:String,default:"Link"},type:{type:String,default:"link"},icon:{type:String,default:"link"},secondIcon:{type:String,default:""},secondLabel:{type:String,default:""}},emits:["cancel","confirm"],setup(t,{emit:n}){const o=t,r=n,{tr:a}=Z(),l=e.ref(null),i=e.ref("");function s(){console.log("confirm",i.value),r("confirm",i.value)}return e.onMounted(()=>{i.value=o.val,setTimeout(()=>{var c;(c=l.value)==null||c.focus()},0)}),(c,d)=>(e.openBlock(),e.createElementBlock("section",vc,[e.createElementVNode("section",hc,[e.createElementVNode("div",_c,e.toDisplayString(t.title),1),e.createElementVNode("div",null,[e.renderSlot(c.$slots,"header-right")])]),e.createElementVNode("section",kc,[e.createVNode(e.unref(vt),{ref_key:"input",ref:l,modelValue:i.value,"onUpdate:modelValue":d[0]||(d[0]=u=>i.value=u),type:"text",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:t.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),e.createElementVNode("footer",yc,[e.createVNode(e.unref(ke),{type:"tertiary",onClick:d[1]||(d[1]=u=>r("cancel"))},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("label.cancel")),1)]),_:1}),e.createVNode(e.unref(ke),{type:"info",onClick:s},{default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(e.unref(a)("label.ok")),1)]),_:1})])]))}}),$=e.defineComponent({name:"ICon",__name:"OIcon",props:{name:{type:String,default:""},color:{type:String,default:""},small:{type:Boolean,default:!1}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("span",{class:e.normalizeClass(["o-icon",{small:t.small}]),style:e.normalizeStyle({color:t.color})},[e.createElementVNode("i",{class:e.normalizeClass(["yiitip-icon",`icon-${t.name}`])},null,2)],6))}});var Ye="top",lt="bottom",st="right",Ze="left",fr="auto",Rn=[Ye,lt,st,Ze],pn="start",Sn="end",wc="clippingParents",Ja="viewport",yn="popper",Ec="reference",qr=Rn.reduce(function(t,n){return t.concat([n+"-"+pn,n+"-"+Sn])},[]),ei=[].concat(Rn,[fr]).reduce(function(t,n){return t.concat([n,n+"-"+pn,n+"-"+Sn])},[]),Cc="beforeRead",xc="read",Nc="afterRead",Sc="beforeMain",Tc="main",Oc="afterMain",Ac="beforeWrite",Bc="write",Mc="afterWrite",Rc=[Cc,xc,Nc,Sc,Tc,Oc,Ac,Bc,Mc];function Tt(t){return t?(t.nodeName||"").toLowerCase():null}function nt(t){if(t==null)return window;if(t.toString()!=="[object Window]"){var n=t.ownerDocument;return n&&n.defaultView||window}return t}function Qt(t){var n=nt(t).Element;return t instanceof n||t instanceof Element}function it(t){var n=nt(t).HTMLElement;return t instanceof n||t instanceof HTMLElement}function mr(t){if(typeof ShadowRoot>"u")return!1;var n=nt(t).ShadowRoot;return t instanceof n||t instanceof ShadowRoot}function Ic(t){var n=t.state;Object.keys(n.elements).forEach(function(o){var r=n.styles[o]||{},a=n.attributes[o]||{},l=n.elements[o];!it(l)||!Tt(l)||(Object.assign(l.style,r),Object.keys(a).forEach(function(i){var s=a[i];s===!1?l.removeAttribute(i):l.setAttribute(i,s===!0?"":s)}))})}function Dc(t){var n=t.state,o={popper:{position:n.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(n.elements.popper.style,o.popper),n.styles=o,n.elements.arrow&&Object.assign(n.elements.arrow.style,o.arrow),function(){Object.keys(n.elements).forEach(function(r){var a=n.elements[r],l=n.attributes[r]||{},i=Object.keys(n.styles.hasOwnProperty(r)?n.styles[r]:o[r]),s=i.reduce(function(c,d){return c[d]="",c},{});!it(a)||!Tt(a)||(Object.assign(a.style,s),Object.keys(l).forEach(function(c){a.removeAttribute(c)}))})}}const ti={name:"applyStyles",enabled:!0,phase:"write",fn:Ic,effect:Dc,requires:["computeStyles"]};function xt(t){return t.split("-")[0]}var jt=Math.max,to=Math.min,fn=Math.round;function Xo(){var t=navigator.userAgentData;return t!=null&&t.brands&&Array.isArray(t.brands)?t.brands.map(function(n){return n.brand+"/"+n.version}).join(" "):navigator.userAgent}function ni(){return!/^((?!chrome|android).)*safari/i.test(Xo())}function mn(t,n,o){n===void 0&&(n=!1),o===void 0&&(o=!1);var r=t.getBoundingClientRect(),a=1,l=1;n&&it(t)&&(a=t.offsetWidth>0&&fn(r.width)/t.offsetWidth||1,l=t.offsetHeight>0&&fn(r.height)/t.offsetHeight||1);var i=Qt(t)?nt(t):window,s=i.visualViewport,c=!ni()&&o,d=(r.left+(c&&s?s.offsetLeft:0))/a,u=(r.top+(c&&s?s.offsetTop:0))/l,p=r.width/a,m=r.height/l;return{width:p,height:m,top:u,right:d+p,bottom:u+m,left:d,x:d,y:u}}function gr(t){var n=mn(t),o=t.offsetWidth,r=t.offsetHeight;return Math.abs(n.width-o)<=1&&(o=n.width),Math.abs(n.height-r)<=1&&(r=n.height),{x:t.offsetLeft,y:t.offsetTop,width:o,height:r}}function oi(t,n){var o=n.getRootNode&&n.getRootNode();if(t.contains(n))return!0;if(o&&mr(o)){var r=n;do{if(r&&t.isSameNode(r))return!0;r=r.parentNode||r.host}while(r)}return!1}function Dt(t){return nt(t).getComputedStyle(t)}function Lc(t){return["table","td","th"].indexOf(Tt(t))>=0}function zt(t){return((Qt(t)?t.ownerDocument:t.document)||window.document).documentElement}function vo(t){return Tt(t)==="html"?t:t.assignedSlot||t.parentNode||(mr(t)?t.host:null)||zt(t)}function Gr(t){return!it(t)||Dt(t).position==="fixed"?null:t.offsetParent}function Vc(t){var n=/firefox/i.test(Xo()),o=/Trident/i.test(Xo());if(o&&it(t)){var r=Dt(t);if(r.position==="fixed")return null}var a=vo(t);for(mr(a)&&(a=a.host);it(a)&&["html","body"].indexOf(Tt(a))<0;){var l=Dt(a);if(l.transform!=="none"||l.perspective!=="none"||l.contain==="paint"||["transform","perspective"].indexOf(l.willChange)!==-1||n&&l.willChange==="filter"||n&&l.filter&&l.filter!=="none")return a;a=a.parentNode}return null}function In(t){for(var n=nt(t),o=Gr(t);o&&Lc(o)&&Dt(o).position==="static";)o=Gr(o);return o&&(Tt(o)==="html"||Tt(o)==="body"&&Dt(o).position==="static")?n:o||Vc(t)||n}function br(t){return["top","bottom"].indexOf(t)>=0?"x":"y"}function En(t,n,o){return jt(t,to(n,o))}function $c(t,n,o){var r=En(t,n,o);return r>o?o:r}function ri(){return{top:0,right:0,bottom:0,left:0}}function ai(t){return Object.assign({},ri(),t)}function ii(t,n){return n.reduce(function(o,r){return o[r]=t,o},{})}var Pc=function(n,o){return n=typeof n=="function"?n(Object.assign({},o.rects,{placement:o.placement})):n,ai(typeof n!="number"?n:ii(n,Rn))};function Fc(t){var n,o=t.state,r=t.name,a=t.options,l=o.elements.arrow,i=o.modifiersData.popperOffsets,s=xt(o.placement),c=br(s),d=[Ze,st].indexOf(s)>=0,u=d?"height":"width";if(!(!l||!i)){var p=Pc(a.padding,o),m=gr(l),f=c==="y"?Ye:Ze,v=c==="y"?lt:st,b=o.rects.reference[u]+o.rects.reference[c]-i[c]-o.rects.popper[u],_=i[c]-o.rects.reference[c],h=In(l),w=h?c==="y"?h.clientHeight||0:h.clientWidth||0:0,y=b/2-_/2,g=p[f],C=w-m[u]-p[v],E=w/2-m[u]/2+y,R=En(g,E,C),D=c;o.modifiersData[r]=(n={},n[D]=R,n.centerOffset=R-E,n)}}function Uc(t){var n=t.state,o=t.options,r=o.element,a=r===void 0?"[data-popper-arrow]":r;a!=null&&(typeof a=="string"&&(a=n.elements.popper.querySelector(a),!a)||oi(n.elements.popper,a)&&(n.elements.arrow=a))}const zc={name:"arrow",enabled:!0,phase:"main",fn:Fc,effect:Uc,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function gn(t){return t.split("-")[1]}var Hc={top:"auto",right:"auto",bottom:"auto",left:"auto"};function qc(t,n){var o=t.x,r=t.y,a=n.devicePixelRatio||1;return{x:fn(o*a)/a||0,y:fn(r*a)/a||0}}function Kr(t){var n,o=t.popper,r=t.popperRect,a=t.placement,l=t.variation,i=t.offsets,s=t.position,c=t.gpuAcceleration,d=t.adaptive,u=t.roundOffsets,p=t.isFixed,m=i.x,f=m===void 0?0:m,v=i.y,b=v===void 0?0:v,_=typeof u=="function"?u({x:f,y:b}):{x:f,y:b};f=_.x,b=_.y;var h=i.hasOwnProperty("x"),w=i.hasOwnProperty("y"),y=Ze,g=Ye,C=window;if(d){var E=In(o),R="clientHeight",D="clientWidth";if(E===nt(o)&&(E=zt(o),Dt(E).position!=="static"&&s==="absolute"&&(R="scrollHeight",D="scrollWidth")),E=E,a===Ye||(a===Ze||a===st)&&l===Sn){g=lt;var A=p&&E===C&&C.visualViewport?C.visualViewport.height:E[R];b-=A-r.height,b*=c?1:-1}if(a===Ze||(a===Ye||a===lt)&&l===Sn){y=st;var P=p&&E===C&&C.visualViewport?C.visualViewport.width:E[D];f-=P-r.width,f*=c?1:-1}}var j=Object.assign({position:s},d&&Hc),O=u===!0?qc({x:f,y:b},nt(o)):{x:f,y:b};if(f=O.x,b=O.y,c){var M;return Object.assign({},j,(M={},M[g]=w?"0":"",M[y]=h?"0":"",M.transform=(C.devicePixelRatio||1)<=1?"translate("+f+"px, "+b+"px)":"translate3d("+f+"px, "+b+"px, 0)",M))}return Object.assign({},j,(n={},n[g]=w?b+"px":"",n[y]=h?f+"px":"",n.transform="",n))}function Gc(t){var n=t.state,o=t.options,r=o.gpuAcceleration,a=r===void 0?!0:r,l=o.adaptive,i=l===void 0?!0:l,s=o.roundOffsets,c=s===void 0?!0:s,d={placement:xt(n.placement),variation:gn(n.placement),popper:n.elements.popper,popperRect:n.rects.popper,gpuAcceleration:a,isFixed:n.options.strategy==="fixed"};n.modifiersData.popperOffsets!=null&&(n.styles.popper=Object.assign({},n.styles.popper,Kr(Object.assign({},d,{offsets:n.modifiersData.popperOffsets,position:n.options.strategy,adaptive:i,roundOffsets:c})))),n.modifiersData.arrow!=null&&(n.styles.arrow=Object.assign({},n.styles.arrow,Kr(Object.assign({},d,{offsets:n.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:c})))),n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-placement":n.placement})}const Kc={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:Gc,data:{}};var zn={passive:!0};function Wc(t){var n=t.state,o=t.instance,r=t.options,a=r.scroll,l=a===void 0?!0:a,i=r.resize,s=i===void 0?!0:i,c=nt(n.elements.popper),d=[].concat(n.scrollParents.reference,n.scrollParents.popper);return l&&d.forEach(function(u){u.addEventListener("scroll",o.update,zn)}),s&&c.addEventListener("resize",o.update,zn),function(){l&&d.forEach(function(u){u.removeEventListener("scroll",o.update,zn)}),s&&c.removeEventListener("resize",o.update,zn)}}const jc={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:Wc,data:{}};var Yc={left:"right",right:"left",bottom:"top",top:"bottom"};function Jn(t){return t.replace(/left|right|bottom|top/g,function(n){return Yc[n]})}var Zc={start:"end",end:"start"};function Wr(t){return t.replace(/start|end/g,function(n){return Zc[n]})}function vr(t){var n=nt(t),o=n.pageXOffset,r=n.pageYOffset;return{scrollLeft:o,scrollTop:r}}function hr(t){return mn(zt(t)).left+vr(t).scrollLeft}function Xc(t,n){var o=nt(t),r=zt(t),a=o.visualViewport,l=r.clientWidth,i=r.clientHeight,s=0,c=0;if(a){l=a.width,i=a.height;var d=ni();(d||!d&&n==="fixed")&&(s=a.offsetLeft,c=a.offsetTop)}return{width:l,height:i,x:s+hr(t),y:c}}function Qc(t){var n,o=zt(t),r=vr(t),a=(n=t.ownerDocument)==null?void 0:n.body,l=jt(o.scrollWidth,o.clientWidth,a?a.scrollWidth:0,a?a.clientWidth:0),i=jt(o.scrollHeight,o.clientHeight,a?a.scrollHeight:0,a?a.clientHeight:0),s=-r.scrollLeft+hr(t),c=-r.scrollTop;return Dt(a||o).direction==="rtl"&&(s+=jt(o.clientWidth,a?a.clientWidth:0)-l),{width:l,height:i,x:s,y:c}}function _r(t){var n=Dt(t),o=n.overflow,r=n.overflowX,a=n.overflowY;return/auto|scroll|overlay|hidden/.test(o+a+r)}function li(t){return["html","body","#document"].indexOf(Tt(t))>=0?t.ownerDocument.body:it(t)&&_r(t)?t:li(vo(t))}function Cn(t,n){var o;n===void 0&&(n=[]);var r=li(t),a=r===((o=t.ownerDocument)==null?void 0:o.body),l=nt(r),i=a?[l].concat(l.visualViewport||[],_r(r)?r:[]):r,s=n.concat(i);return a?s:s.concat(Cn(vo(i)))}function Qo(t){return Object.assign({},t,{left:t.x,top:t.y,right:t.x+t.width,bottom:t.y+t.height})}function Jc(t,n){var o=mn(t,!1,n==="fixed");return o.top=o.top+t.clientTop,o.left=o.left+t.clientLeft,o.bottom=o.top+t.clientHeight,o.right=o.left+t.clientWidth,o.width=t.clientWidth,o.height=t.clientHeight,o.x=o.left,o.y=o.top,o}function jr(t,n,o){return n===Ja?Qo(Xc(t,o)):Qt(n)?Jc(n,o):Qo(Qc(zt(t)))}function eu(t){var n=Cn(vo(t)),o=["absolute","fixed"].indexOf(Dt(t).position)>=0,r=o&&it(t)?In(t):t;return Qt(r)?n.filter(function(a){return Qt(a)&&oi(a,r)&&Tt(a)!=="body"}):[]}function tu(t,n,o,r){var a=n==="clippingParents"?eu(t):[].concat(n),l=[].concat(a,[o]),i=l[0],s=l.reduce(function(c,d){var u=jr(t,d,r);return c.top=jt(u.top,c.top),c.right=to(u.right,c.right),c.bottom=to(u.bottom,c.bottom),c.left=jt(u.left,c.left),c},jr(t,i,r));return s.width=s.right-s.left,s.height=s.bottom-s.top,s.x=s.left,s.y=s.top,s}function si(t){var n=t.reference,o=t.element,r=t.placement,a=r?xt(r):null,l=r?gn(r):null,i=n.x+n.width/2-o.width/2,s=n.y+n.height/2-o.height/2,c;switch(a){case Ye:c={x:i,y:n.y-o.height};break;case lt:c={x:i,y:n.y+n.height};break;case st:c={x:n.x+n.width,y:s};break;case Ze:c={x:n.x-o.width,y:s};break;default:c={x:n.x,y:n.y}}var d=a?br(a):null;if(d!=null){var u=d==="y"?"height":"width";switch(l){case pn:c[d]=c[d]-(n[u]/2-o[u]/2);break;case Sn:c[d]=c[d]+(n[u]/2-o[u]/2);break}}return c}function Tn(t,n){n===void 0&&(n={});var o=n,r=o.placement,a=r===void 0?t.placement:r,l=o.strategy,i=l===void 0?t.strategy:l,s=o.boundary,c=s===void 0?wc:s,d=o.rootBoundary,u=d===void 0?Ja:d,p=o.elementContext,m=p===void 0?yn:p,f=o.altBoundary,v=f===void 0?!1:f,b=o.padding,_=b===void 0?0:b,h=ai(typeof _!="number"?_:ii(_,Rn)),w=m===yn?Ec:yn,y=t.rects.popper,g=t.elements[v?w:m],C=tu(Qt(g)?g:g.contextElement||zt(t.elements.popper),c,u,i),E=mn(t.elements.reference),R=si({reference:E,element:y,placement:a}),D=Qo(Object.assign({},y,R)),A=m===yn?D:E,P={top:C.top-A.top+h.top,bottom:A.bottom-C.bottom+h.bottom,left:C.left-A.left+h.left,right:A.right-C.right+h.right},j=t.modifiersData.offset;if(m===yn&&j){var O=j[a];Object.keys(P).forEach(function(M){var L=[st,lt].indexOf(M)>=0?1:-1,U=[Ye,lt].indexOf(M)>=0?"y":"x";P[M]+=O[U]*L})}return P}function nu(t,n){n===void 0&&(n={});var o=n,r=o.placement,a=o.boundary,l=o.rootBoundary,i=o.padding,s=o.flipVariations,c=o.allowedAutoPlacements,d=c===void 0?ei:c,u=gn(r),p=u?s?qr:qr.filter(function(v){return gn(v)===u}):Rn,m=p.filter(function(v){return d.indexOf(v)>=0});m.length===0&&(m=p);var f=m.reduce(function(v,b){return v[b]=Tn(t,{placement:b,boundary:a,rootBoundary:l,padding:i})[xt(b)],v},{});return Object.keys(f).sort(function(v,b){return f[v]-f[b]})}function ou(t){if(xt(t)===fr)return[];var n=Jn(t);return[Wr(t),n,Wr(n)]}function ru(t){var n=t.state,o=t.options,r=t.name;if(!n.modifiersData[r]._skip){for(var a=o.mainAxis,l=a===void 0?!0:a,i=o.altAxis,s=i===void 0?!0:i,c=o.fallbackPlacements,d=o.padding,u=o.boundary,p=o.rootBoundary,m=o.altBoundary,f=o.flipVariations,v=f===void 0?!0:f,b=o.allowedAutoPlacements,_=n.options.placement,h=xt(_),w=h===_,y=c||(w||!v?[Jn(_)]:ou(_)),g=[_].concat(y).reduce(function($e,Re){return $e.concat(xt(Re)===fr?nu(n,{placement:Re,boundary:u,rootBoundary:p,padding:d,flipVariations:v,allowedAutoPlacements:b}):Re)},[]),C=n.rects.reference,E=n.rects.popper,R=new Map,D=!0,A=g[0],P=0;P<g.length;P++){var j=g[P],O=xt(j),M=gn(j)===pn,L=[Ye,lt].indexOf(O)>=0,U=L?"width":"height",S=Tn(n,{placement:j,boundary:u,rootBoundary:p,altBoundary:m,padding:d}),H=L?M?st:Ze:M?lt:Ye;C[U]>E[U]&&(H=Jn(H));var T=Jn(H),X=[];if(l&&X.push(S[O]<=0),s&&X.push(S[H]<=0,S[T]<=0),X.every(function($e){return $e})){A=j,D=!1;break}R.set(j,X)}if(D)for(var ie=v?3:1,ge=function(Re){var Y=g.find(function(le){var ce=R.get(le);if(ce)return ce.slice(0,Re).every(function(Ne){return Ne})});if(Y)return A=Y,"break"},be=ie;be>0;be--){var Be=ge(be);if(Be==="break")break}n.placement!==A&&(n.modifiersData[r]._skip=!0,n.placement=A,n.reset=!0)}}const au={name:"flip",enabled:!0,phase:"main",fn:ru,requiresIfExists:["offset"],data:{_skip:!1}};function Yr(t,n,o){return o===void 0&&(o={x:0,y:0}),{top:t.top-n.height-o.y,right:t.right-n.width+o.x,bottom:t.bottom-n.height+o.y,left:t.left-n.width-o.x}}function Zr(t){return[Ye,st,lt,Ze].some(function(n){return t[n]>=0})}function iu(t){var n=t.state,o=t.name,r=n.rects.reference,a=n.rects.popper,l=n.modifiersData.preventOverflow,i=Tn(n,{elementContext:"reference"}),s=Tn(n,{altBoundary:!0}),c=Yr(i,r),d=Yr(s,a,l),u=Zr(c),p=Zr(d);n.modifiersData[o]={referenceClippingOffsets:c,popperEscapeOffsets:d,isReferenceHidden:u,hasPopperEscaped:p},n.attributes.popper=Object.assign({},n.attributes.popper,{"data-popper-reference-hidden":u,"data-popper-escaped":p})}const lu={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:iu};function su(t,n,o){var r=xt(t),a=[Ze,Ye].indexOf(r)>=0?-1:1,l=typeof o=="function"?o(Object.assign({},n,{placement:t})):o,i=l[0],s=l[1];return i=i||0,s=(s||0)*a,[Ze,st].indexOf(r)>=0?{x:s,y:i}:{x:i,y:s}}function cu(t){var n=t.state,o=t.options,r=t.name,a=o.offset,l=a===void 0?[0,0]:a,i=ei.reduce(function(u,p){return u[p]=su(p,n.rects,l),u},{}),s=i[n.placement],c=s.x,d=s.y;n.modifiersData.popperOffsets!=null&&(n.modifiersData.popperOffsets.x+=c,n.modifiersData.popperOffsets.y+=d),n.modifiersData[r]=i}const uu={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:cu};function du(t){var n=t.state,o=t.name;n.modifiersData[o]=si({reference:n.rects.reference,element:n.rects.popper,placement:n.placement})}const pu={name:"popperOffsets",enabled:!0,phase:"read",fn:du,data:{}};function fu(t){return t==="x"?"y":"x"}function mu(t){var n=t.state,o=t.options,r=t.name,a=o.mainAxis,l=a===void 0?!0:a,i=o.altAxis,s=i===void 0?!1:i,c=o.boundary,d=o.rootBoundary,u=o.altBoundary,p=o.padding,m=o.tether,f=m===void 0?!0:m,v=o.tetherOffset,b=v===void 0?0:v,_=Tn(n,{boundary:c,rootBoundary:d,padding:p,altBoundary:u}),h=xt(n.placement),w=gn(n.placement),y=!w,g=br(h),C=fu(g),E=n.modifiersData.popperOffsets,R=n.rects.reference,D=n.rects.popper,A=typeof b=="function"?b(Object.assign({},n.rects,{placement:n.placement})):b,P=typeof A=="number"?{mainAxis:A,altAxis:A}:Object.assign({mainAxis:0,altAxis:0},A),j=n.modifiersData.offset?n.modifiersData.offset[n.placement]:null,O={x:0,y:0};if(E){if(l){var M,L=g==="y"?Ye:Ze,U=g==="y"?lt:st,S=g==="y"?"height":"width",H=E[g],T=H+_[L],X=H-_[U],ie=f?-D[S]/2:0,ge=w===pn?R[S]:D[S],be=w===pn?-D[S]:-R[S],Be=n.elements.arrow,$e=f&&Be?gr(Be):{width:0,height:0},Re=n.modifiersData["arrow#persistent"]?n.modifiersData["arrow#persistent"].padding:ri(),Y=Re[L],le=Re[U],ce=En(0,R[S],$e[S]),Ne=y?R[S]/2-ie-ce-Y-P.mainAxis:ge-ce-Y-P.mainAxis,Me=y?-R[S]/2+ie+ce+le+P.mainAxis:be+ce+le+P.mainAxis,rt=n.elements.arrow&&In(n.elements.arrow),ht=rt?g==="y"?rt.clientTop||0:rt.clientLeft||0:0,Xe=(M=j==null?void 0:j[g])!=null?M:0,ut=H+Ne-Xe-ht,dt=H+Me-Xe,ue=En(f?to(T,ut):T,H,f?jt(X,dt):X);E[g]=ue,O[g]=ue-H}if(s){var ne,re=g==="x"?Ye:Ze,ze=g==="x"?lt:st,Ce=E[C],Se=C==="y"?"height":"width",_t=Ce+_[re],at=Ce-_[ze],Qe=[Ye,Ze].indexOf(h)!==-1,Ht=(ne=j==null?void 0:j[C])!=null?ne:0,pt=Qe?_t:Ce-R[Se]-D[Se]-Ht+P.altAxis,Mt=Qe?Ce+R[Se]+D[Se]-Ht-P.altAxis:at,qt=f&&Qe?$c(pt,Ce,Mt):En(f?pt:_t,Ce,f?Mt:at);E[C]=qt,O[C]=qt-Ce}n.modifiersData[r]=O}}const gu={name:"preventOverflow",enabled:!0,phase:"main",fn:mu,requiresIfExists:["offset"]};function bu(t){return{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}}function vu(t){return t===nt(t)||!it(t)?vr(t):bu(t)}function hu(t){var n=t.getBoundingClientRect(),o=fn(n.width)/t.offsetWidth||1,r=fn(n.height)/t.offsetHeight||1;return o!==1||r!==1}function _u(t,n,o){o===void 0&&(o=!1);var r=it(n),a=it(n)&&hu(n),l=zt(n),i=mn(t,a,o),s={scrollLeft:0,scrollTop:0},c={x:0,y:0};return(r||!r&&!o)&&((Tt(n)!=="body"||_r(l))&&(s=vu(n)),it(n)?(c=mn(n,!0),c.x+=n.clientLeft,c.y+=n.clientTop):l&&(c.x=hr(l))),{x:i.left+s.scrollLeft-c.x,y:i.top+s.scrollTop-c.y,width:i.width,height:i.height}}function ku(t){var n=new Map,o=new Set,r=[];t.forEach(function(l){n.set(l.name,l)});function a(l){o.add(l.name);var i=[].concat(l.requires||[],l.requiresIfExists||[]);i.forEach(function(s){if(!o.has(s)){var c=n.get(s);c&&a(c)}}),r.push(l)}return t.forEach(function(l){o.has(l.name)||a(l)}),r}function yu(t){var n=ku(t);return Rc.reduce(function(o,r){return o.concat(n.filter(function(a){return a.phase===r}))},[])}function wu(t){var n;return function(){return n||(n=new Promise(function(o){Promise.resolve().then(function(){n=void 0,o(t())})})),n}}function Eu(t){var n=t.reduce(function(o,r){var a=o[r.name];return o[r.name]=a?Object.assign({},a,r,{options:Object.assign({},a.options,r.options),data:Object.assign({},a.data,r.data)}):r,o},{});return Object.keys(n).map(function(o){return n[o]})}var Xr={placement:"bottom",modifiers:[],strategy:"absolute"};function Qr(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];return!n.some(function(r){return!(r&&typeof r.getBoundingClientRect=="function")})}function Cu(t){t===void 0&&(t={});var n=t,o=n.defaultModifiers,r=o===void 0?[]:o,a=n.defaultOptions,l=a===void 0?Xr:a;return function(s,c,d){d===void 0&&(d=l);var u={placement:"bottom",orderedModifiers:[],options:Object.assign({},Xr,l),modifiersData:{},elements:{reference:s,popper:c},attributes:{},styles:{}},p=[],m=!1,f={state:u,setOptions:function(h){var w=typeof h=="function"?h(u.options):h;b(),u.options=Object.assign({},l,u.options,w),u.scrollParents={reference:Qt(s)?Cn(s):s.contextElement?Cn(s.contextElement):[],popper:Cn(c)};var y=yu(Eu([].concat(r,u.options.modifiers)));return u.orderedModifiers=y.filter(function(g){return g.enabled}),v(),f.update()},forceUpdate:function(){if(!m){var h=u.elements,w=h.reference,y=h.popper;if(Qr(w,y)){u.rects={reference:_u(w,In(y),u.options.strategy==="fixed"),popper:gr(y)},u.reset=!1,u.placement=u.options.placement,u.orderedModifiers.forEach(function(P){return u.modifiersData[P.name]=Object.assign({},P.data)});for(var g=0;g<u.orderedModifiers.length;g++){if(u.reset===!0){u.reset=!1,g=-1;continue}var C=u.orderedModifiers[g],E=C.fn,R=C.options,D=R===void 0?{}:R,A=C.name;typeof E=="function"&&(u=E({state:u,options:D,name:A,instance:f})||u)}}}},update:wu(function(){return new Promise(function(_){f.forceUpdate(),_(u)})}),destroy:function(){b(),m=!0}};if(!Qr(s,c))return f;f.setOptions(d).then(function(_){!m&&d.onFirstUpdate&&d.onFirstUpdate(_)});function v(){u.orderedModifiers.forEach(function(_){var h=_.name,w=_.options,y=w===void 0?{}:w,g=_.effect;if(typeof g=="function"){var C=g({state:u,name:h,instance:f,options:y}),E=function(){};p.push(C||E)}})}function b(){p.forEach(function(_){return _()}),p=[]}return f}}var xu=[jc,pu,Kc,ti,uu,au,gu,zc,lu],Nu=Cu({defaultModifiers:xu}),Su="tippy-box",ci="tippy-content",Tu="tippy-backdrop",ui="tippy-arrow",di="tippy-svg-arrow",Kt={passive:!0,capture:!0},pi=function(){return document.body};function Ou(t,n){return{}.hasOwnProperty.call(t,n)}function $o(t,n,o){if(Array.isArray(t)){var r=t[n];return r??(Array.isArray(o)?o[n]:o)}return t}function kr(t,n){var o={}.toString.call(t);return o.indexOf("[object")===0&&o.indexOf(n+"]")>-1}function fi(t,n){return typeof t=="function"?t.apply(void 0,n):t}function Jr(t,n){if(n===0)return t;var o;return function(r){clearTimeout(o),o=setTimeout(function(){t(r)},n)}}function Au(t,n){var o=Object.assign({},t);return n.forEach(function(r){delete o[r]}),o}function Bu(t){return t.split(/\s+/).filter(Boolean)}function on(t){return[].concat(t)}function ea(t,n){t.indexOf(n)===-1&&t.push(n)}function Mu(t){return t.filter(function(n,o){return t.indexOf(n)===o})}function Ru(t){return t.split("-")[0]}function no(t){return[].slice.call(t)}function ta(t){return Object.keys(t).reduce(function(n,o){return t[o]!==void 0&&(n[o]=t[o]),n},{})}function xn(){return document.createElement("div")}function On(t){return["Element","Fragment"].some(function(n){return kr(t,n)})}function Iu(t){return kr(t,"NodeList")}function Du(t){return kr(t,"MouseEvent")}function Lu(t){return!!(t&&t._tippy&&t._tippy.reference===t)}function Vu(t){return On(t)?[t]:Iu(t)?no(t):Array.isArray(t)?t:no(document.querySelectorAll(t))}function Po(t,n){t.forEach(function(o){o&&(o.style.transitionDuration=n+"ms")})}function na(t,n){t.forEach(function(o){o&&o.setAttribute("data-state",n)})}function $u(t){var n,o=on(t),r=o[0];return r!=null&&(n=r.ownerDocument)!=null&&n.body?r.ownerDocument:document}function Pu(t,n){var o=n.clientX,r=n.clientY;return t.every(function(a){var l=a.popperRect,i=a.popperState,s=a.props,c=s.interactiveBorder,d=Ru(i.placement),u=i.modifiersData.offset;if(!u)return!0;var p=d==="bottom"?u.top.y:0,m=d==="top"?u.bottom.y:0,f=d==="right"?u.left.x:0,v=d==="left"?u.right.x:0,b=l.top-r+p>c,_=r-l.bottom-m>c,h=l.left-o+f>c,w=o-l.right-v>c;return b||_||h||w})}function Fo(t,n,o){var r=n+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(a){t[r](a,o)})}function oa(t,n){for(var o=n;o;){var r;if(t.contains(o))return!0;o=o.getRootNode==null||(r=o.getRootNode())==null?void 0:r.host}return!1}var Et={isTouch:!1},ra=0;function Fu(){Et.isTouch||(Et.isTouch=!0,window.performance&&document.addEventListener("mousemove",mi))}function mi(){var t=performance.now();t-ra<20&&(Et.isTouch=!1,document.removeEventListener("mousemove",mi)),ra=t}function Uu(){var t=document.activeElement;if(Lu(t)){var n=t._tippy;t.blur&&!n.state.isVisible&&t.blur()}}function zu(){document.addEventListener("touchstart",Fu,Kt),window.addEventListener("blur",Uu)}var Hu=typeof window<"u"&&typeof document<"u",qu=Hu?!!window.msCrypto:!1;function nn(t){var n=t==="destroy"?"n already-":" ";return[t+"() was called on a"+n+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function aa(t){var n=/[ \t]{2,}/g,o=/^[ \t]*/gm;return t.replace(n," ").replace(o,"").trim()}function Gu(t){return aa(`
|
|
4
|
+
**/Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("vue"),jT=require("openai"),UT=require("markdown-it"),WT=require("@yiitap/i18n"),Tl=require("@yiitap/util-emoji"),Nl=require("@tiptap/extension-mathematics"),uw=require("@tiptap/markdown"),Zi=require("yjs"),qT=require("katex"),py=require("lowlight"),rf=require("mermaid"),KT=require("@mermaid-js/layout-elk");function JT(n){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const t in n)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(n,t);Object.defineProperty(e,t,o.get?o:{enumerable:!0,get:()=>n[t]})}}return e.default=n,Object.freeze(e)}const oe=JT(Zi);function Ot(n){this.content=n}Ot.prototype={constructor:Ot,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var o=t&&t!=n?this.remove(t):this,r=o.find(n),i=o.content.slice();return r==-1?i.push(t||n,e):(i[r+1]=e,t&&(i[r]=t)),new Ot(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new Ot(t)},addToStart:function(n,e){return new Ot([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new Ot(t)},addBefore:function(n,e,t){var o=this.remove(e),r=o.content.slice(),i=o.find(n);return r.splice(i==-1?r.length:i,0,e,t),new Ot(r)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=Ot.from(n),n.size?new Ot(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=Ot.from(n),n.size?new Ot(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=Ot.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};Ot.from=function(n){if(n instanceof Ot)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new Ot(e)};function dw(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(o),i=e.child(o);if(r==i){t+=r.nodeSize;continue}if(!r.sameMarkup(i))return t;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)t++;return t}if(r.content.size||i.content.size){let s=dw(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function fw(n,e,t,o){for(let r=n.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:t,b:o};let s=n.child(--r),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,o-=a;continue}if(!s.sameMarkup(l))return{a:t,b:o};if(s.isText&&s.text!=l.text){let u=0,d=Math.min(s.text.length,l.text.length);for(;u<d&&s.text[s.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let u=fw(s.content,l.content,t-1,o-1);if(u)return u}t-=a,o-=a}}class D{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,r=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],u=l+a.nodeSize;if(u>e&&o(a,r+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),o,r+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,r){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(o)&&(r[r.length-1]=t.withText(t.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new D(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),o.push(l),r+=l.nodeSize),s=a}return new D(o,r)}cutByIndex(e,t){return e==t?D.empty:e==0&&t==this.content.length?this:new D(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-o.nodeSize;return r[e]=t,new D(r,i)}addToStart(e){return new D([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new D(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,o=0;t<this.content.length;t++){let r=this.content[t];e(r,o,t),o+=r.nodeSize}}findDiffStart(e,t=0){return dw(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return fw(this,e,t,o)}findIndex(e){if(e==0)return $a(0,e);if(e==this.size)return $a(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,o=0;;t++){let r=this.child(t),i=o+r.nodeSize;if(i>=e)return i==e?$a(t+1,i):$a(t,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return D.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new D(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return D.empty;let t,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new D(t||e,o)}static from(e){if(!e)return D.empty;if(e instanceof D)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new D([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}D.empty=new D([],0);const sf={index:0,offset:0};function $a(n,e){return sf.index=n,sf.offset=e,sf}function Rc(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let o=0;o<n.length;o++)if(!Rc(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!Rc(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let je=class up{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),o=!0),t&&t.push(i)}}return t||(t=e.slice()),o||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Rc(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=o.create(t.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return up.none;if(e instanceof up)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}};je.none=[];class _c extends Error{}class H{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=hw(this.content,e+this.openStart,t);return o&&new H(o,this.openStart,this.openEnd)}removeBetween(e,t){return new H(pw(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return H.empty;let o=t.openStart||0,r=t.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new H(D.fromJSON(e,t.content),o,r)}static maxOpen(e,t=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new H(e,o,r)}}H.empty=new H(D.empty,0,0);function pw(n,e,t){let{index:o,offset:r}=n.findIndex(e),i=n.maybeChild(o),{index:s,offset:l}=n.findIndex(t);if(r==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(pw(i.content,e-r-1,t-r-1)))}function hw(n,e,t,o){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=hw(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function GT(n,e,t){if(t.openStart>n.depth)throw new _c("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new _c("Inconsistent open depths");return mw(n,e,t,0)}function mw(n,e,t,o){let r=n.index(o),i=n.node(o);if(r==e.index(o)&&o<n.depth-t.openStart){let s=mw(n,e,t,o+1);return i.copy(i.content.replaceChild(r,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==o&&e.depth==o){let s=n.parent,l=s.content;return ti(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=XT(t,n);return ti(i,yw(n,s,l,e,o))}else return ti(i,Dc(n,e,o))}function gw(n,e){if(!e.type.compatibleContent(n.type))throw new _c("Cannot join "+e.type.name+" onto "+n.type.name)}function dp(n,e,t){let o=n.node(t);return gw(o,e.node(t)),o}function ei(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function al(n,e,t,o){let r=(e||n).node(t),i=0,s=e?e.index(t):r.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(ei(n.nodeAfter,o),i++));for(let l=i;l<s;l++)ei(r.child(l),o);e&&e.depth==t&&e.textOffset&&ei(e.nodeBefore,o)}function ti(n,e){return n.type.checkContent(e),n.copy(e)}function yw(n,e,t,o,r){let i=n.depth>r&&dp(n,e,r+1),s=o.depth>r&&dp(t,o,r+1),l=[];return al(null,n,r,l),i&&s&&e.index(r)==t.index(r)?(gw(i,s),ei(ti(i,yw(n,e,t,o,r+1)),l)):(i&&ei(ti(i,Dc(n,e,r+1)),l),al(e,t,r,l),s&&ei(ti(s,Dc(t,o,r+1)),l)),al(o,null,r,l),new D(l)}function Dc(n,e,t){let o=[];if(al(null,n,t,o),n.depth>t){let r=dp(n,e,t+1);ei(ti(r,Dc(n,e,t+1)),o)}return al(e,null,t,o),new D(o)}function XT(n,e){let t=e.depth-n.openStart,r=e.node(t).copy(n.content);for(let i=t-1;i>=0;i--)r=e.node(i).copy(D.from(r));return{start:r.resolveNoCache(n.openStart+t),end:r.resolveNoCache(r.content.size-n.openEnd-t)}}class Al{constructor(e,t,o){this.pos=e,this.path=t,this.parentOffset=o,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(t);return o?e.child(t).cut(o):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let o=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return je.none;if(this.textOffset)return e.child(t).marks;let o=e.maybeChild(t-1),r=e.maybeChild(t);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let o=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!t||t(this.node(o))))return new Ic(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let o=[],r=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),u=i-a;if(o.push(s,l,r+a),!u||(s=s.child(l),s.isText))break;i=u-1,r+=a+1}return new Al(t,o,i)}static resolveCached(e,t){let o=hy.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==t)return s}else hy.set(e,o=new YT);let r=o.elts[o.i]=Al.resolve(e,t);return o.i=(o.i+1)%QT,r}}class YT{constructor(){this.elts=[],this.i=0}}const QT=12,hy=new WeakMap;class Ic{constructor(e,t,o){this.$from=e,this.$to=t,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const ZT=Object.create(null);let _n=class fp{constructor(e,t,o,r=je.none){this.type=e,this.attrs=t,this.marks=r,this.content=o||D.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,o,r=0){this.content.nodesBetween(e,t,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,o,r){return this.content.textBetween(e,t,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,o){return this.type==e&&Rc(this.attrs,t||e.defaultAttrs||ZT)&&je.sameSet(this.marks,o||je.none)}copy(e=null){return e==this.content?this:new fp(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new fp(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,o=!1){if(e==t)return H.empty;let r=this.resolve(e),i=this.resolve(t),s=o?0:r.sharedDepth(t),l=r.start(s),u=r.node(s).content.cut(r.pos-l,i.pos-l);return new H(u,r.depth-s,i.depth-s)}replace(e,t,o){return GT(this.resolve(e),this.resolve(t),o)}nodeAt(e){for(let t=this;;){let{index:o,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(o),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(t),index:t,offset:o};let r=this.content.child(t-1);return{node:r,index:t-1,offset:o-r.nodeSize}}resolve(e){return Al.resolveCached(this,e)}resolveNoCache(e){return Al.resolve(this,e)}rangeHasMark(e,t,o){let r=!1;return t>e&&this.nodesBetween(e,t,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),bw(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,o=D.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=r;a<i;a++)if(!this.type.allowsMarks(o.child(a).marks))return!1;return!0}canReplaceWith(e,t,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=je.none;for(let t=0;t<this.marks.length;t++){let o=this.marks[t];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!je.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let o;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,o)}let r=D.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};_n.prototype.text=void 0;class Lc extends _n{constructor(e,t,o,r){if(super(e,t,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):bw(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new Lc(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Lc(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function bw(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}class hi{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new eN(e,t);if(o.next==null)return hi.empty;let r=vw(o);o.next&&o.err("Unexpected trailing text");let i=lN(sN(r));return aN(i,o),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,o=e.childCount){let r=this;for(let i=t;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let o=0;o<e.next.length;o++)if(this.next[t].type==e.next[o].type)return!0;return!1}fillBefore(e,t=!1,o=0){let r=[this];function i(s,l){let a=s.matchFragment(e,o);if(a&&(!t||a.validEnd))return D.from(l.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:d,next:f}=s.next[u];if(!(d.isText||d.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(d));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!r.type||a.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&t(o.next[r].next)}return t(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
|
|
5
|
+
`)}}hi.empty=new hi(!0);class eN{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function vw(n){let e=[];do e.push(tN(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function tN(n){let e=[];do e.push(nN(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function nN(n){let e=iN(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=oN(n,e);else break;return e}function my(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function oN(n,e){let t=my(n),o=t;return n.eat(",")&&(n.next!="}"?o=my(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function rN(n,e){let t=n.nodeTypes,o=t[e];if(o)return[o];let r=[];for(let i in t){let s=t[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&n.err("No node type or group '"+e+"' found"),r}function iN(n){if(n.eat("(")){let e=vw(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=rN(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function sN(n){let e=[[]];return r(i(n,0),t()),e;function t(){return e.push([])-1}function o(s,l,a){let u={term:a,to:l};return e[s].push(u),u}function r(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,u)=>a.concat(i(u,l)),[]);if(s.type=="seq")for(let a=0;;a++){let u=i(s.exprs[a],l);if(a==s.exprs.length-1)return u;r(u,l=t())}else if(s.type=="star"){let a=t();return o(l,a),r(i(s.expr,a),a),[o(a)]}else if(s.type=="plus"){let a=t();return r(i(s.expr,l),a),r(i(s.expr,a),a),[o(a)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let u=0;u<s.min;u++){let d=t();r(i(s.expr,a),d),a=d}if(s.max==-1)r(i(s.expr,a),a);else for(let u=s.min;u<s.max;u++){let d=t();o(a,d),r(i(s.expr,a),d),a=d}return[o(a)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function kw(n,e){return e-n}function gy(n,e){let t=[];return o(e),t.sort(kw);function o(r){let i=n[r];if(i.length==1&&!i[0].term)return o(i[0].to);t.push(r);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&t.indexOf(a)==-1&&o(a)}}}function lN(n){let e=Object.create(null);return t(gy(n,0));function t(o){let r=[];o.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let d=0;d<r.length;d++)r[d][0]==l&&(u=r[d][1]);gy(n,a).forEach(d=>{u||r.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[o.join(",")]=new hi(o.indexOf(n.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(kw);i.next.push({type:r[s][0],next:e[l.join(",")]||t(l)})}return i}}function aN(n,e){for(let t=0,o=[n];t<o.length;t++){let r=o[t],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:a,next:u}=r.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),o.indexOf(u)==-1&&o.push(u)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function ww(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function xw(n,e){let t=Object.create(null);for(let o in n){let r=e&&e[o];if(r===void 0){let i=n[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=r}return t}function Cw(n,e,t,o){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let i=n[r];i.validate&&i.validate(e[r])}}function Sw(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new uN(n,o,e[o]);return t}let yy=class Ew{constructor(e,t,o){this.name=e,this.schema=t,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=Sw(e,o.attrs),this.defaultAttrs=ww(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==hi.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:xw(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new _n(this,this.computeAttrs(e),D.from(t),je.setFrom(o))}createChecked(e=null,t,o){return t=D.from(t),this.checkContent(t),new _n(this,this.computeAttrs(e),t,je.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=D.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(D.empty,!0);return i?new _n(this,e,t.append(i),je.setFrom(o)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){Cw(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?t&&t.push(e[o]):t||(t=e.slice(0,o));return t?t.length?t:je.none:e}static compile(e,t){let o=Object.create(null);e.forEach((i,s)=>o[i]=new Ew(i,t,s));let r=t.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function cN(n,e,t){let o=t.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${i}`)}}class uN{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?cN(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class td{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=Sw(e,r.attrs),this.excluded=null;let i=ww(this.attrs);this.instance=i?new je(this,i):null}create(e=null){return!e&&this.instance?this.instance:new je(this,xw(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new td(i,r++,t,s)),o}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){Cw(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}let Mw=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=Ot.from(e.nodes),t.marks=Ot.from(e.marks||{}),this.nodes=yy.compile(this.spec.nodes,this),this.marks=td.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=hi.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?by(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:by(this,s.split(" "))}this.nodeFromJSON=r=>_n.fromJSON(this,r),this.markFromJSON=r=>je.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof yy){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,o,r)}text(e,t){let o=this.nodes.text;return new Lc(o,o.defaultAttrs,e,je.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function by(n,e){let t=[];for(let o=0;o<e.length;o++){let r=e[o],i=n.marks[r],s=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(r=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(r)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return t}function dN(n){return n.tag!=null}function fN(n){return n.style!=null}let ts=class pp{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(dN(r))this.tags.push(r);else if(fN(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let o=new ky(this,t,!1);return o.addAll(e,je.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new ky(this,t,!0);return o.addAll(e,je.none,t.from,t.to),H.maxOpen(o.finish())}matchTag(e,t,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(mN(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=wy(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=wy(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new pp(e,pp.schemaRules(e)))}};const Tw={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},pN={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Nw={ol:!0,ul:!0},Ol=1,hp=2,cl=4;function vy(n,e,t){return e!=null?(e?Ol:0)|(e==="full"?hp:0):n&&n.whitespace=="pre"?Ol|hp:t&~cl}class Ba{constructor(e,t,o,r,i,s){this.type=e,this.attrs=t,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=je.none,this.match=i||(s&cl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(D.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&Ol)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let t=D.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(D.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Tw.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class ky{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,s=vy(null,t.preserveWhitespace,0)|(o?cl:0);r?i=new Ba(r.type,r.attrs,je.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new Ba(null,null,je.none,!0,null,s):i=new Ba(e.schema.topNodeType,null,je.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let o=e.nodeValue,r=this.top,i=r.options&hp?"full":this.localPreserveWS||(r.options&Ol)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
|
|
6
|
+
`);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),t,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;Nw.hasOwnProperty(s)&&this.parser.normalizeLists&&hN(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(a?a.ignore:pN.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let u,d=this.needsBlock;if(Tw.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
7
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(u=>!a.clearMark(u)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,o,r){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let a=this.enter(s,t.attrs||null,o,t.preserveWhitespace);a&&(i=!0,o=a)}else{let a=this.parser.schema.marks[t.mark];o=o.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,o,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,o),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],u=a.findWrapping(e);if(u&&(!r||r.length>u.length+l)&&(r=u,i=a,!u.length))break;if(a.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)t=this.enterInner(r[s],null,t,!1);return t}insertNode(e,t,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=je.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):xy(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,o,r){let i=this.findPlace(e.create(t),o,!1);return i&&(i=this.enterInner(e,t,o,!0,r)),i}enterInner(e,t,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=vy(e,i,s.options);s.options&cl&&s.content.length==0&&(l|=cl);let a=je.none;return o=o.filter(u=>(s.type?s.type.allowsMarkType(u.type):xy(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new Ba(e,t,a,r,null,l)),this.open++,o}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=Ol)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let o=this.nodes[t].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,o){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,a)=>{for(;l>=0;l--){let u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}}function hN(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&Nw.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function mN(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function wy(n){let e={};for(let t in n)e[t]=n[t];return e}function xy(n,e){let t=e.schema.nodes;for(let o in t){let r=t[o];if(!r.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:d}=l.edge(a);if(u==e||i.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}class Oi{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=lf(t).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let u=s.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(i[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)r=i.pop()[1];for(;a<s.marks.length;){let u=s.marks[a++],d=this.serializeMark(u,s.isInline,t);d&&(i.push([u,r]),r.appendChild(d.dom),r=d.contentDOM||d.dom)}}r.appendChild(this.serializeNodeInner(s,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:r}=uc(lf(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return o}serializeNode(e,t={}){let o=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,t,o={}){let r=this.marks[e.type.name];return r&&uc(lf(o),r(e,t),null,e.attrs)}static renderSpec(e,t,o=null,r){return uc(e,t,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Oi(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Cy(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return Cy(e.marks)}}function Cy(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function lf(n){return n.document||window.document}const Sy=new WeakMap;function gN(n){let e=Sy.get(n);return e===void 0&&Sy.set(n,e=yN(n)),e}function yN(n){let e=null;function t(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)t(o[r]);else for(let r in o)t(o[r])}return t(n),e}function uc(n,e,t,o){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=gN(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(t=r.slice(0,s),r=r.slice(s+1));let l,a=t?n.createElementNS(t,r):n.createElement(r),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let p=f.indexOf(" ");p>0?a.setAttributeNS(f.slice(0,p),f.slice(p+1),u[f]):f=="style"&&a.style?a.style.cssText=u[f]:a.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:m}=uc(n,p,t,o);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const Aw=65535,Ow=Math.pow(2,16);function bN(n,e){return n+e*Ow}function Ey(n){return n&Aw}function vN(n){return(n-(n&Aw))/Ow}const $w=1,Bw=2,dc=4,Rw=8;class mp{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&Rw)>0}get deletedBefore(){return(this.delInfo&($w|dc))>0}get deletedAfter(){return(this.delInfo&(Bw|dc))>0}get deletedAcross(){return(this.delInfo&dc)>0}}class bn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&bn.empty)return bn.empty}recover(e){let t=0,o=Ey(e);if(!this.inverted)for(let r=0;r<o;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+t+vN(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[l+i],d=this.ranges[l+s],f=a+u;if(e<=f){let p=u?e==a?-1:e==f?1:t:t,h=a+r+(p<0?0:d);if(o)return h;let m=e==(t<0?a:f)?null:bN(l/3,e-a),g=e==a?Bw:e==f?$w:dc;return(t<0?e!=a:e!=f)&&(g|=Rw),new mp(h,g,m)}r+=d-u}return o?e+r:new mp(e+r,0,null)}touches(e,t){let o=0,r=Ey(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let u=this.ranges[l+i],d=a+u;if(e<=d&&l==r*3)return!0;o+=this.ranges[l+s]-u}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[r+t],d=this.ranges[r+o];e(l,l+u,a,a+d),i+=d-u}}invert(){return new bn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?bn.empty:new bn(e<0?[0,-e,0]:[0,0,e])}}bn.empty=new bn([]);class $l{constructor(e,t,o=0,r=e?e.length:0){this.mirror=t,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new $l(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,o=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?o+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,o=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?o-r-1:void 0)}}invert(){let e=new $l;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new mp(e,r,null)}}const af=Object.create(null);class Kt{getMap(){return bn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=af[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in af)throw new RangeError("Duplicate use of step JSON ID "+e);return af[e]=t,t.prototype.jsonID=e,t}}class ft{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new ft(e,null)}static fail(e){return new ft(null,e)}static fromReplace(e,t,o,r){try{return ft.ok(e.replace(t,o,r))}catch(i){if(i instanceof _c)return ft.fail(i.message);throw i}}}function qh(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(qh(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return D.fromArray(o)}class kr extends Kt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new H(qh(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),t.openStart,t.openEnd);return ft.fromReplace(e,this.from,this.to,i)}invert(){return new qn(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new kr(t.pos,o.pos,this.mark)}merge(e){return e instanceof kr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new kr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new kr(t.from,t.to,e.markFromJSON(t.mark))}}Kt.jsonID("addMark",kr);class qn extends Kt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new H(qh(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return ft.fromReplace(e,this.from,this.to,o)}invert(){return new kr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new qn(t.pos,o.pos,this.mark)}merge(e){return e instanceof qn&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new qn(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new qn(t.from,t.to,e.markFromJSON(t.mark))}}Kt.jsonID("removeMark",qn);class wr extends Kt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ft.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return ft.fromReplace(e,this.pos,this.pos+1,new H(D.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(o))return new wr(this.pos,t.marks[r]);return new wr(this.pos,this.mark)}}return new mi(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new wr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new wr(t.pos,e.markFromJSON(t.mark))}}Kt.jsonID("addNodeMark",wr);class mi extends Kt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return ft.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return ft.fromReplace(e,this.pos,this.pos+1,new H(D.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new wr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new mi(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new mi(t.pos,e.markFromJSON(t.mark))}}Kt.jsonID("removeNodeMark",mi);class kt extends Kt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&gp(e,this.from,this.to)?ft.fail("Structure replace would overwrite content"):ft.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new bn([this.from,this.to-this.from,this.slice.size])}invert(e){return new kt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new kt(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof kt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?H.empty:new H(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new kt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?H.empty:new H(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new kt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new kt(t.from,t.to,H.fromJSON(e,t.slice),!!t.structure)}}Kt.jsonID("replace",kt);class Ct extends Kt{constructor(e,t,o,r,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(gp(e,this.from,this.gapFrom)||gp(e,this.gapTo,this.to)))return ft.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return ft.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?ft.fromReplace(e,this.from,this.to,o):ft.fail("Content does not fit in gap")}getMap(){return new bn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ct(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||r<t.pos||i>o.pos?null:new Ct(t.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ct(t.from,t.to,t.gapFrom,t.gapTo,H.fromJSON(e,t.slice),t.insert,!!t.structure)}}Kt.jsonID("replaceAround",Ct);function gp(n,e,t){let o=n.resolve(e),r=t-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function kN(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!o.isInSet(f)&&d.type.allowsMarkType(o.type)){let p=Math.max(u,e),h=Math.min(u+a.nodeSize,t),m=o.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[g])?s.to=h:r.push(s=new qn(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new kr(p,h,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function wN(n,e,t,o){let r=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(o instanceof td){let u=s.marks,d;for(;d=o.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let u=Math.min(l+s.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=u,p.step=i):r.push({style:f,from:Math.max(l,e),to:u,step:i})}}}),r.forEach(s=>n.step(new qn(s.from,s.to,s.style)))}function Kh(n,e,t,o=t.contentMatch,r=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let u=i.child(a),d=l+u.nodeSize,f=o.matchType(u.type);if(!f)s.push(new kt(l,d,H.empty));else{o=f;for(let p=0;p<u.marks.length;p++)t.allowsMarkType(u.marks[p].type)||n.step(new qn(l,d,u.marks[p]));if(r&&u.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(u.text);)m||(m=new H(D.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),s.push(new kt(l+p.index,l+p.index+p[0].length,m))}}l=d}if(!o.validEnd){let a=o.fillBefore(D.empty,!0);n.replace(l,l,new H(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function xN(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Bs(n){let t=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let o=n.depth,r=0,i=0;;--o){let s=n.$from.node(o),l=n.$from.index(o)+r,a=n.$to.indexAfter(o)-i;if(o<n.depth&&s.canReplace(l,a,t))return o;if(o==0||s.type.spec.isolating||!xN(s,l,a))break;l&&(r=1),a<s.childCount&&(i=1)}return null}function CN(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),a=s,u=l,d=D.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,d=D.from(o.node(m).copy(d)),f++):a--;let p=D.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=D.from(r.node(m).copy(p)),h++):u++;n.step(new Ct(a,u,s,l,new H(d.append(p),f,h),d.size-f,!0))}function Jh(n,e,t=null,o=n){let r=SN(n,e),i=r&&EN(o,e);return i?r.map(My).concat({type:e,attrs:t}).concat(i.map(My)):null}function My(n){return{type:n,attrs:null}}function SN(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(o,r,s)?i:null}function EN(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:e).contentMatch;for(let u=o;a&&u<r;u++)a=a.matchType(t.child(u).type);return!a||!a.validEnd?null:s}function MN(n,e,t){let o=D.empty;for(let s=t.length-1;s>=0;s--){if(o.size){let l=t[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=D.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new Ct(r,i,r,i,new H(o,0,0),t.length,!0))}function TN(n,e,t,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,a)&&NN(n.doc,n.mapping.slice(i).map(l),o)){let u=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&Dw(n,s,l,i),Kh(n,n.mapping.slice(i).map(l,1),o,void 0,u===null);let d=n.mapping.slice(i),f=d.map(l,1),p=d.map(l+s.nodeSize,1);return n.step(new Ct(f,p,f+1,p-1,new H(D.from(o.create(a,null,s.marks)),0,0),1,!0)),u===!0&&_w(n,s,l,i),!1}})}function _w(n,e,t,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let a=n.mapping.slice(o).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function Dw(n,e,t,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=n.mapping.slice(o).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
|
|
8
|
+
`))}})}function NN(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function AN(n,e,t,o,r){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Ct(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new H(D.from(s),0,0),1,!0))}function Jo(n,e,t=1,o){let r=n.resolve(e),i=r.depth-t,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let u=r.depth-1,d=t-2;u>i;u--,d--){let f=r.node(u),p=r.index(u);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[d+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[d]||f;if(!f.canReplace(p+1,f.childCount)||!g.type.validContent(h))return!1}let l=r.indexAfter(i),a=o&&o[0];return r.node(i).canReplaceWith(l,l,a?a.type:r.node(i+1).type)}function ON(n,e,t=1,o){let r=n.doc.resolve(e),i=D.empty,s=D.empty;for(let l=r.depth,a=r.depth-t,u=t-1;l>a;l--,u--){i=D.from(r.node(l).copy(i));let d=o&&o[u];s=D.from(d?d.type.create(d.attrs,s):r.node(l).copy(s))}n.step(new kt(e,e,new H(i.append(s),t,t),!0))}function Lr(n,e){let t=n.resolve(e),o=t.index();return Iw(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function $N(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:o}=n.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?n.type.schema.nodes.text:i.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function Iw(n,e){return!!(n&&e&&!n.isLeaf&&$N(n,e))}function nd(n,e,t=-1){let o=n.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):t>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&Iw(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=t<0?o.before(r):o.after(r)}}function BN(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(r&&s.inlineContent){let d=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);d&&!f?o=!1:!d&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let d=n.doc.resolve(e+t);Dw(n,d.node(),d.before(),l)}s.inlineContent&&Kh(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),u=a.map(e-t);if(n.step(new kt(u,a.map(e+t,-1),H.empty,!0)),o===!0){let d=n.doc.resolve(u);_w(n,d.node(),d.before(),n.steps.length)}return n}function RN(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,t))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,t))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function Lw(n,e,t){let o=n.resolve(e);if(!t.content.size)return e;let r=t.content;for(let i=0;i<t.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,a=o.index(s)+(l>0?1:0),u=o.node(s),d=!1;if(i==1)d=u.canReplace(a,a,r);else{let f=u.contentMatchAt(a).findWrapping(r.firstChild.type);d=f&&u.canReplaceWith(a,a,f[0])}if(d)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function od(n,e,t=e,o=H.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return Pw(r,i,o)?new kt(e,t,o):new _N(r,i,o).fit()}function Pw(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class _N{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=D.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=D.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new H(i,s,l);return e>-1?new Ct(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new kt(o.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}t=i.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=cf(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],d,f=null;if(t==1&&(s?u.matchType(s.type)||(f=u.fillBefore(D.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(d=u.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=cf(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new H(e,t+1,Math.max(o,r.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=cf(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new H(Ks(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new H(Ks(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=o?o.content:s.content,a=s.openStart-e,u=0,d=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)d.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;u<l.childCount;){let g=l.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||a==0||g.content.size)&&(f=y,d.push(Vw(g.mark(p.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?h:-1)))}let m=u==l.childCount;m||(h=-1),this.placed=Js(this.placed,t,D.from(d)),this.frontier[t].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?H.empty:new H(Ks(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new H(Ks(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!uf(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=uf(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=uf(e,l,u,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Js(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,t=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Js(this.placed,this.depth,D.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(D.empty,!0);t.childCount&&(this.placed=Js(this.placed,this.frontier.length,t))}}function Ks(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(Ks(n.firstChild.content,e-1,t)))}function Js(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(Js(n.lastChild.content,e-1,t)))}function cf(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function Vw(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,Vw(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(D.empty,!0)))),n.copy(o)}function uf(n,e,t,o,r){let i=n.node(e),s=r?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!DN(t,i.content,s)?l:null}function DN(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function IN(n){return n.spec.defining||n.spec.definingForContent}function LN(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(Pw(r,i,o))return n.step(new kt(e,t,o));let s=Fw(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let a=s.indexOf(l),u=[],d=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(u.push(m),h==o.openStart)break;p=m.content}for(let p=d-1;p>=0;p--){let h=u[p],m=IN(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))d=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+d+1)%(o.openStart+1),m=u[h];if(m)for(let g=0;g<s.length;g++){let y=s[(g+a)%s.length],b=!0;y<0&&(b=!1,y=-y);let v=r.node(y-1),w=r.index(y-1);if(v.canReplaceWith(w,w,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new H(zw(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=s.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),t=i.after(h))}}function zw(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(zw(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(D.empty,!0))}return n}function PN(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=RN(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new H(D.from(o),0,0))}function VN(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=Fw(o,r);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),r.end(l));if(l>0&&(a||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return n.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&t>o.end(s)&&r.end(s)-t!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return n.delete(o.before(s),t);n.delete(e,t)}function Fw(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let r=o;r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&t.push(r)}return t}class ns extends Kt{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return ft.fail("No node at attribute step's position");let o=Object.create(null);for(let i in t.attrs)o[i]=t.attrs[i];o[this.attr]=this.value;let r=t.type.create(o,null,t.marks);return ft.fromReplace(e,this.pos,this.pos+1,new H(D.from(r),0,t.isLeaf?0:1))}getMap(){return bn.empty}invert(e){return new ns(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new ns(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new ns(t.pos,t.attr,t.value)}}Kt.jsonID("attr",ns);class Bl extends Kt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return ft.ok(o)}getMap(){return bn.empty}invert(e){return new Bl(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Bl(t.attr,t.value)}}Kt.jsonID("docAttr",Bl);let us=class extends Error{};us=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};us.prototype=Object.create(Error.prototype);us.prototype.constructor=us;us.prototype.name="TransformError";class Gh{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new $l}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new us(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let o=0;o<this.mapping.maps.length;o++){let r=this.mapping.maps[o];o&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((i,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,o=H.empty){let r=od(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new H(D.from(o),0,0))}delete(e,t){return this.replace(e,t,H.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return LN(this,e,t,o),this}replaceRangeWith(e,t,o){return PN(this,e,t,o),this}deleteRange(e,t){return VN(this,e,t),this}lift(e,t){return CN(this,e,t),this}join(e,t=1){return BN(this,e,t),this}wrap(e,t){return MN(this,e,t),this}setBlockType(e,t=e,o,r=null){return TN(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return AN(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new ns(e,t,o)),this}setDocAttribute(e,t){return this.step(new Bl(e,t)),this}addNodeMark(e,t){return this.step(new wr(e,t)),this}removeNodeMark(e,t){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t instanceof je)t.isInSet(o.marks)&&this.step(new mi(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new mi(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,o){return ON(this,e,t,o),this}addMark(e,t,o){return kN(this,e,t,o),this}removeMark(e,t,o){return wN(this,e,t,o),this}clearIncompatible(e,t,o){return Kh(this,e,t,o),this}}const df=Object.create(null);class se{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new Hw(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=H.empty){let o=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:u}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(u.pos),l?H.empty:t),l==0&&Ay(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],a=e.mapping.slice(o),u=a.map(s.pos),d=a.map(l.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),Ay(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new q(e):ji(e.node(0),e.parent,e.pos,e.index(),t,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=t<0?ji(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):ji(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new on(e.node(0))}static atStart(e){return ji(e,e,0,0,1)||new on(e)}static atEnd(e){return ji(e,e,e.content.size,e.childCount,-1)||new on(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=df[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in df)throw new RangeError("Duplicate use of selection JSON ID "+e);return df[e]=t,t.prototype.jsonID=e,t}getBookmark(){return q.between(this.$anchor,this.$head).getBookmark()}}se.prototype.visible=!0;class Hw{constructor(e,t){this.$from=e,this.$to=t}}let Ty=!1;function Ny(n){!Ty&&!n.parent.inlineContent&&(Ty=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class q extends se{constructor(e,t=e){Ny(e),Ny(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return se.near(o);let r=e.resolve(t.map(this.anchor));return new q(r.parent.inlineContent?r:o,o)}replace(e,t=H.empty){if(super.replace(e,t),t==H.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof q&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new rd(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new q(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let r=e.resolve(t);return new this(r,o==t?r:e.resolve(o))}static between(e,t,o){let r=e.pos-t.pos;if((!o||r)&&(o=r>=0?1:-1),!t.parent.inlineContent){let i=se.findFrom(t,o,!0)||se.findFrom(t,-o,!0);if(i)t=i.$head;else return se.near(t,o)}return e.parent.inlineContent||(r==0?e=t:(e=(se.findFrom(e,-o,!0)||se.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new q(e,t)}}se.jsonID("text",q);class rd{constructor(e,t){this.anchor=e,this.head=t}map(e){return new rd(e.map(this.anchor),e.map(this.head))}resolve(e){return q.between(e.resolve(this.anchor),e.resolve(this.head))}}class Q extends se{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return o?se.near(i):new Q(i)}content(){return new H(D.from(this.node),0,0)}eq(e){return e instanceof Q&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Xh(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Q(e.resolve(t.anchor))}static create(e,t){return new Q(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Q.prototype.visible=!1;se.jsonID("node",Q);class Xh{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new rd(o,o):new Xh(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&Q.isSelectable(o)?new Q(t):se.near(t)}}class on extends se{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=H.empty){if(t==H.empty){e.delete(0,e.doc.content.size);let o=se.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new on(e)}map(e){return new on(e)}eq(e){return e instanceof on}getBookmark(){return zN}}se.jsonID("all",on);const zN={map(){return this},resolve(n){return new on(n)}};function ji(n,e,t,o,r,i=!1){if(e.inlineContent)return q.create(n,t);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&Q.isSelectable(l))return Q.create(n,t-(r<0?l.nodeSize:0))}else{let a=ji(n,l,t+r,r<0?l.childCount:0,r,i);if(a)return a}t+=l.nodeSize*r}return null}function Ay(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof kt||r instanceof Ct))return;let i=n.mapping.maps[o],s;i.forEach((l,a,u,d)=>{s==null&&(s=d)}),n.setSelection(se.near(n.doc.resolve(s),t))}const Oy=1,Ra=2,$y=4;class FN extends Gh{constructor(e){super(e.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=e.selection,this.storedMarks=e.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Oy)&~Ra,this.storedMarks=null,this}get selectionSet(){return(this.updated&Oy)>0}setStoredMarks(e){return this.storedMarks=e,this.updated|=Ra,this}ensureMarks(e){return je.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}addStoredMark(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ra)>0}addStep(e,t){super.addStep(e,t),this.updated=this.updated&~Ra,this.storedMarks=null}setTime(e){return this.time=e,this}replaceSelection(e){return this.selection.replace(this,e),this}replaceSelectionWith(e,t=!0){let o=this.selection;return t&&(e=e.mark(this.storedMarks||(o.empty?o.$from.marks():o.$from.marksAcross(o.$to)||je.none))),o.replaceWith(this,e),this}deleteSelection(){return this.selection.replace(this),this}insertText(e,t,o){let r=this.doc.type.schema;if(t==null)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();{if(o==null&&(o=t),!e)return this.deleteRange(t,o);let i=this.storedMarks;if(!i){let s=this.doc.resolve(t);i=o==t?s.marks():s.marksAcross(this.doc.resolve(o))}return this.replaceRangeWith(t,o,r.text(e,i)),!this.selection.empty&&this.selection.to==t+e.length&&this.setSelection(se.near(this.selection.$to)),this}}setMeta(e,t){return this.meta[typeof e=="string"?e:e.key]=t,this}getMeta(e){return this.meta[typeof e=="string"?e:e.key]}get isGeneric(){for(let e in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=$y,this}get scrolledIntoView(){return(this.updated&$y)>0}}function By(n,e){return!e||!n?n:n.bind(e)}class Gs{constructor(e,t,o){this.name=e,this.init=By(t.init,o),this.apply=By(t.apply,o)}}const HN=[new Gs("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new Gs("selection",{init(n,e){return n.selection||se.atStart(e.doc)},apply(n){return n.selection}}),new Gs("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new Gs("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}})];class ff{constructor(e,t){this.schema=e,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=HN.slice(),t&&t.forEach(o=>{if(this.pluginsByKey[o.key])throw new RangeError("Adding different instances of a keyed plugin ("+o.key+")");this.plugins.push(o),this.pluginsByKey[o.key]=o,o.spec.state&&this.fields.push(new Gs(o.key,o.spec.state,o))})}}class es{constructor(e){this.config=e}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(e){return this.applyTransaction(e).state}filterTransaction(e,t=-1){for(let o=0;o<this.config.plugins.length;o++)if(o!=t){let r=this.config.plugins[o];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}applyTransaction(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};let t=[e],o=this.applyInner(e),r=null;for(;;){let i=!1;for(let s=0;s<this.config.plugins.length;s++){let l=this.config.plugins[s];if(l.spec.appendTransaction){let a=r?r[s].n:0,u=r?r[s].state:this,d=a<t.length&&l.spec.appendTransaction.call(l,a?t.slice(a):t,u,o);if(d&&o.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",e),!r){r=[];for(let f=0;f<this.config.plugins.length;f++)r.push(f<s?{state:o,n:t.length}:{state:this,n:0})}t.push(d),o=o.applyInner(d),i=!0}r&&(r[s]={state:o,n:t.length})}}if(!i)return{state:o,transactions:t}}}applyInner(e){if(!e.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let t=new es(this.config),o=this.config.fields;for(let r=0;r<o.length;r++){let i=o[r];t[i.name]=i.apply(e,this[i.name],this,t)}return t}get tr(){return new FN(this)}static create(e){let t=new ff(e.doc?e.doc.type.schema:e.schema,e.plugins),o=new es(t);for(let r=0;r<t.fields.length;r++)o[t.fields[r].name]=t.fields[r].init(e,o);return o}reconfigure(e){let t=new ff(this.schema,e.plugins),o=t.fields,r=new es(t);for(let i=0;i<o.length;i++){let s=o[i].name;r[s]=this.hasOwnProperty(s)?this[s]:o[i].init(e,r)}return r}toJSON(e){let t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(o=>o.toJSON())),e&&typeof e=="object")for(let o in e){if(o=="doc"||o=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let r=e[o],i=r.spec.state;i&&i.toJSON&&(t[o]=i.toJSON.call(r,this[r.key]))}return t}static fromJSON(e,t,o){if(!t)throw new RangeError("Invalid input for EditorState.fromJSON");if(!e.schema)throw new RangeError("Required config field 'schema' missing");let r=new ff(e.schema,e.plugins),i=new es(r);return r.fields.forEach(s=>{if(s.name=="doc")i.doc=_n.fromJSON(e.schema,t.doc);else if(s.name=="selection")i.selection=se.fromJSON(i.doc,t.selection);else if(s.name=="storedMarks")t.storedMarks&&(i.storedMarks=t.storedMarks.map(e.schema.markFromJSON));else{if(o)for(let l in o){let a=o[l],u=a.spec.state;if(a.key==s.name&&u&&u.fromJSON&&Object.prototype.hasOwnProperty.call(t,l)){i[s.name]=u.fromJSON.call(a,e,t[l],i);return}}i[s.name]=s.init(e,i)}}),i}}function jw(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=jw(r,e,{})),t[o]=r}return t}class ue{constructor(e){this.spec=e,this.props={},e.props&&jw(e.props,this,this.props),this.key=e.key?e.key.key:Uw("plugin")}getState(e){return e[this.key]}}const pf=Object.create(null);function Uw(n){return n in pf?n+"$"+ ++pf[n]:(pf[n]=0,n+"$")}class ce{constructor(e="key"){this.key=Uw(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Yh=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function Ww(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const qw=(n,e,t)=>{let o=Ww(n,t);if(!o)return!1;let r=Qh(o);if(!r){let s=o.blockRange(),l=s&&Bs(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(t0(n,r,e,-1))return!0;if(o.parent.content.size==0&&(ds(i,"end")||Q.isSelectable(i)))for(let s=o.depth;;s--){let l=od(n.doc,o.before(s),o.after(s),H.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(ds(i,"end")?se.findFrom(a.doc.resolve(a.mapping.map(r.pos,-1)),-1):Q.create(a.doc,r.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},jN=(n,e,t)=>{let o=Ww(n,t);if(!o)return!1;let r=Qh(o);return r?Kw(n,r,e):!1},UN=(n,e,t)=>{let o=Gw(n,t);if(!o)return!1;let r=Zh(o);return r?Kw(n,r,e):!1};function Kw(n,e,t){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let d=r.lastChild;if(!d)return!1;r=d}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let u=od(n.doc,i,a,H.empty);if(!u||u.from!=i||u instanceof kt&&u.slice.size>=a-i)return!1;if(t){let d=n.tr.step(u);d.setSelection(q.create(d.doc,i)),t(d.scrollIntoView())}return!0}function ds(n,e,t=!1){for(let o=n;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(t&&o.childCount!=1)return!1}return!1}const Jw=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):o.parentOffset>0)return!1;i=Qh(o)}let s=i&&i.nodeBefore;return!s||!Q.isSelectable(s)?!1:(e&&e(n.tr.setSelection(Q.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function Qh(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function Gw(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const Xw=(n,e,t)=>{let o=Gw(n,t);if(!o)return!1;let r=Zh(o);if(!r)return!1;let i=r.nodeAfter;if(t0(n,r,e,1))return!0;if(o.parent.content.size==0&&(ds(i,"start")||Q.isSelectable(i))){let s=od(n.doc,o.before(),o.after(),H.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(ds(i,"start")?se.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):Q.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},Yw=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):o.parentOffset<o.parent.content.size)return!1;i=Zh(o)}let s=i&&i.nodeAfter;return!s||!Q.isSelectable(s)?!1:(e&&e(n.tr.setSelection(Q.create(n.doc,i.pos)).scrollIntoView()),!0)};function Zh(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const WN=(n,e)=>{let t=n.selection,o=t instanceof Q,r;if(o){if(t.node.isTextblock||!Lr(n.doc,t.from))return!1;r=t.from}else if(r=nd(n.doc,t.from,-1),r==null)return!1;if(e){let i=n.tr.join(r);o&&i.setSelection(Q.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},qN=(n,e)=>{let t=n.selection,o;if(t instanceof Q){if(t.node.isTextblock||!Lr(n.doc,t.to))return!1;o=t.to}else if(o=nd(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},KN=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&Bs(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},Qw=(n,e)=>{let{$head:t,$anchor:o}=n.selection;return!t.parent.type.spec.code||!t.sameParent(o)?!1:(e&&e(n.tr.insertText(`
|
|
9
|
+
`).scrollIntoView()),!0)};function em(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const JN=(n,e)=>{let{$head:t,$anchor:o}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(o))return!1;let r=t.node(-1),i=t.indexAfter(-1),s=em(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(se.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Zw=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof on||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=em(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=n.tr.insert(s,i.createAndFill());l.setSelection(q.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},e0=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Jo(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&Bs(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function GN(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof Q&&e.selection.node.isBlock)return!o.parentOffset||!Jo(e.doc,o.pos)?!1:(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,a=!1,u=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){a=o.end(h)==o.pos+(o.depth-h),u=o.start(h)==o.pos-(o.depth-h),l=em(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof q||e.selection instanceof on)&&d.deleteSelection();let f=d.mapping.map(o.pos),p=Jo(d.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=Jo(d.doc,f,i.length,i)),!p)return!1;if(d.split(f,i.length,i),!a&&u&&o.node(s).type!=l){let h=d.mapping.map(o.before(s)),m=d.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(o.before(s)),l)}return t&&t(d.scrollIntoView()),!0}}const XN=GN(),YN=(n,e)=>{let{$from:t,to:o}=n.selection,r,i=t.sharedDepth(o);return i==0?!1:(r=t.before(i),e&&e(n.tr.setSelection(Q.create(n.doc,r))),!0)};function QN(n,e,t){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||Lr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function t0(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,a=r.type.spec.isolating||i.type.spec.isolating;if(!a&&QN(n,e,t))return!0;let u=!a&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=D.empty;for(let b=s.length-1;b>=0;b--)m=D.from(s[b].create(null,m));m=D.from(r.copy(m));let g=n.tr.step(new Ct(e.pos-1,h,e.pos,h,new H(m,1,0),s.length,!0)),y=g.doc.resolve(h+2*s.length);y.nodeAfter&&y.nodeAfter.type==r.type&&Lr(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||o>0&&a?null:se.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),p=f&&Bs(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(u&&ds(i,"start",!0)&&ds(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let b=D.empty;for(let w=m.length-1;w>=0;w--)b=D.from(m[w].copy(b));let v=n.tr.step(new Ct(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new H(b,m.length,0),0,!0));t(v.scrollIntoView())}return!0}}return!1}function n0(n){return function(e,t){let o=e.selection,r=n<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(t&&t(e.tr.setSelection(q.create(e.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const ZN=n0(-1),eA=n0(1);function tA(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i),l=s&&Jh(s,n,e);return l?(o&&o(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function Ry(n,e=null){return function(t,o){let r=!1;for(let i=0;i<t.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(s,l,(a,u)=>{if(r)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)r=!0;else{let d=t.doc.resolve(u),f=d.index();r=d.parent.canReplaceWith(f,f+1,n)}})}if(!r)return!1;if(o){let i=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];i.setBlockType(l,a,n,e)}o(i.scrollIntoView())}return!0}}function tm(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}tm(Yh,qw,Jw);tm(Yh,Xw,Yw);tm(Qw,Zw,e0,XN);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function nA(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i);if(!s)return!1;let l=o?t.tr:null;return oA(l,s,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function oA(n,e,t,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new Ic(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new Ic(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Jh(i,t,o,e);return l?(n&&rA(n,e,l,r,t),!0):!1}function rA(n,e,t,o,r){let i=D.empty;for(let d=t.length-1;d>=0;d--)i=D.from(t[d].type.create(t[d].attrs,i));n.step(new Ct(e.start-(o?2:0),e.end,e.start,e.end,new H(i,0,0),t.length,!0));let s=0;for(let d=0;d<t.length;d++)t[d].type==r&&(s=d+1);let l=t.length-s,a=e.start+t.length-(o?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,p=!0;d<f;d++,p=!1)!p&&Jo(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=u.child(d).nodeSize;return n}function iA(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==n);return i?t?o.node(i.depth-1).type==n?sA(e,t,n,i):lA(e,t,i):!0:!1}}function sA(n,e,t,o){let r=n.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new Ct(i-1,s,i,s,new H(D.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new Ic(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=Bs(o);if(l==null)return!1;r.lift(o,l);let a=r.doc.resolve(r.mapping.map(i,-1)-1);return Lr(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),!0}function lA(n,e,t){let o=n.tr,r=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(t.start),s=i.nodeAfter;if(o.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==r.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(l?0:1),d+1,s.content.append(a?D.empty:D.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new Ct(f-(l?1:0),p+(a?1:0),f+1,p-1,new H((l?D.empty:D.from(r.copy(D.empty))).append(a?D.empty:D.from(r.copy(D.empty))),l?0:1,a?0:1),l?0:1)),e(o.scrollIntoView()),!0}function aA(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,u=>u.childCount>0&&u.firstChild.type==n);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let u=a.lastChild&&a.lastChild.type==l.type,d=D.from(u?n.create():null),f=new H(D.from(n.create(null,D.from(l.type.create(null,d)))),u?3:1,0),p=i.start,h=i.end;t(e.tr.step(new Ct(p-(u?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}const Rt=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},fs=function(n){let e=n.assignedSlot||n.parentNode;return e&&e.nodeType==11?e.host:e};let yp=null;const jo=function(n,e,t){let o=yp||(yp=document.createRange());return o.setEnd(n,t??n.nodeValue.length),o.setStart(n,e||0),o},cA=function(){yp=null},gi=function(n,e,t,o){return t&&(_y(n,e,t,o,-1)||_y(n,e,t,o,1))},uA=/^(img|br|input|textarea|hr)$/i;function _y(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:Bn(n))){let s=n.parentNode;if(!s||s.nodeType!=1||da(n)||uA.test(n.nodeName)||n.contentEditable=="false")return!1;e=Rt(n)+(r<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else n=s,e=r<0?Bn(n):0}else return!1}}function Bn(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function dA(n,e){for(;;){if(n.nodeType==3&&e)return n;if(n.nodeType==1&&e>0){if(n.contentEditable=="false")return null;n=n.childNodes[e-1],e=Bn(n)}else if(n.parentNode&&!da(n))e=Rt(n),n=n.parentNode;else return null}}function fA(n,e){for(;;){if(n.nodeType==3&&e<n.nodeValue.length)return n;if(n.nodeType==1&&e<n.childNodes.length){if(n.contentEditable=="false")return null;n=n.childNodes[e],e=0}else if(n.parentNode&&!da(n))e=Rt(n)+1,n=n.parentNode;else return null}}function pA(n,e,t){for(let o=e==0,r=e==Bn(n);o||r;){if(n==t)return!0;let i=Rt(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==Bn(n)}}function da(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const id=function(n){return n.focusNode&&gi(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Jr(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}function hA(n){let e=n.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}function mA(n,e,t){if(n.caretPositionFromPoint)try{let o=n.caretPositionFromPoint(e,t);if(o)return{node:o.offsetNode,offset:Math.min(Bn(o.offsetNode),o.offset)}}catch{}if(n.caretRangeFromPoint){let o=n.caretRangeFromPoint(e,t);if(o)return{node:o.startContainer,offset:Math.min(Bn(o.startContainer),o.startOffset)}}}const xo=typeof navigator<"u"?navigator:null,Dy=typeof document<"u"?document:null,Pr=xo&&xo.userAgent||"",bp=/Edge\/(\d+)/.exec(Pr),o0=/MSIE \d/.exec(Pr),vp=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Pr),un=!!(o0||vp||bp),Mr=o0?document.documentMode:vp?+vp[1]:bp?+bp[1]:0,Dn=!un&&/gecko\/(\d+)/i.test(Pr);Dn&&+(/Firefox\/(\d+)/.exec(Pr)||[0,0])[1];const kp=!un&&/Chrome\/(\d+)/.exec(Pr),xt=!!kp,r0=kp?+kp[1]:0,It=!un&&!!xo&&/Apple Computer/.test(xo.vendor),ps=It&&(/Mobile\/\w+/.test(Pr)||!!xo&&xo.maxTouchPoints>2),On=ps||(xo?/Mac/.test(xo.platform):!1),i0=xo?/Win/.test(xo.platform):!1,Wo=/Android \d/.test(Pr),fa=!!Dy&&"webkitFontSmoothing"in Dy.documentElement.style,gA=fa?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function yA(n){let e=n.defaultView&&n.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Lo(n,e){return typeof n=="number"?n:n[e]}function bA(n){let e=n.getBoundingClientRect(),t=e.width/n.offsetWidth||1,o=e.height/n.offsetHeight||1;return{left:e.left,right:e.left+n.clientWidth*t,top:e.top,bottom:e.top+n.clientHeight*o}}function Iy(n,e,t){let o=n.someProp("scrollThreshold")||0,r=n.someProp("scrollMargin")||5,i=n.dom.ownerDocument;for(let s=t||n.dom;s;){if(s.nodeType!=1){s=fs(s);continue}let l=s,a=l==i.body,u=a?yA(i):bA(l),d=0,f=0;if(e.top<u.top+Lo(o,"top")?f=-(u.top-e.top+Lo(r,"top")):e.bottom>u.bottom-Lo(o,"bottom")&&(f=e.bottom-e.top>u.bottom-u.top?e.top+Lo(r,"top")-u.top:e.bottom-u.bottom+Lo(r,"bottom")),e.left<u.left+Lo(o,"left")?d=-(u.left-e.left+Lo(r,"left")):e.right>u.right-Lo(o,"right")&&(d=e.right-u.right+Lo(r,"right")),d||f)if(a)i.defaultView.scrollBy(d,f);else{let h=l.scrollLeft,m=l.scrollTop;f&&(l.scrollTop+=f),d&&(l.scrollLeft+=d);let g=l.scrollLeft-h,y=l.scrollTop-m;e={left:e.left-g,top:e.top-y,right:e.right-g,bottom:e.bottom-y}}let p=a?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(p))break;s=p=="absolute"?s.offsetParent:fs(s)}}function vA(n){let e=n.dom.getBoundingClientRect(),t=Math.max(0,e.top),o,r;for(let i=(e.left+e.right)/2,s=t+1;s<Math.min(innerHeight,e.bottom);s+=5){let l=n.root.elementFromPoint(i,s);if(!l||l==n.dom||!n.dom.contains(l))continue;let a=l.getBoundingClientRect();if(a.top>=t-20){o=l,r=a.top;break}}return{refDOM:o,refTop:r,stack:s0(n.dom)}}function s0(n){let e=[],t=n.ownerDocument;for(let o=n;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),n!=t);o=fs(o));return e}function kA({refDOM:n,refTop:e,stack:t}){let o=n?n.getBoundingClientRect().top:0;l0(t,o==0?0:o-e)}function l0(n,e){for(let t=0;t<n.length;t++){let{dom:o,top:r,left:i}=n[t];o.scrollTop!=r+e&&(o.scrollTop=r+e),o.scrollLeft!=i&&(o.scrollLeft=i)}}let Pi=null;function wA(n){if(n.setActive)return n.setActive();if(Pi)return n.focus(Pi);let e=s0(n);n.focus(Pi==null?{get preventScroll(){return Pi={preventScroll:!0},!0}}:void 0),Pi||(Pi=!1,l0(e,0))}function a0(n,e){let t,o=2e8,r,i=0,s=e.top,l=e.top,a,u;for(let d=n.firstChild,f=0;d;d=d.nextSibling,f++){let p;if(d.nodeType==1)p=d.getClientRects();else if(d.nodeType==3)p=jo(d).getClientRects();else continue;for(let h=0;h<p.length;h++){let m=p[h];if(m.top<=s&&m.bottom>=l){s=Math.max(m.bottom,s),l=Math.min(m.top,l);let g=m.left>e.left?m.left-e.left:m.right<e.left?e.left-m.right:0;if(g<o){t=d,o=g,r=g&&t.nodeType==3?{left:m.right<e.left?m.right:m.left,top:e.top}:e,d.nodeType==1&&g&&(i=f+(e.left>=(m.left+m.right)/2?1:0));continue}}else m.top>e.top&&!a&&m.left<=e.left&&m.right>=e.left&&(a=d,u={left:Math.max(m.left,Math.min(m.right,e.left)),top:m.top});!t&&(e.left>=m.right&&e.top>=m.top||e.left>=m.left&&e.top>=m.bottom)&&(i=f+1)}}return!t&&a&&(t=a,r=u,o=0),t&&t.nodeType==3?xA(t,r):!t||o&&t.nodeType==1?{node:n,offset:i}:a0(t,r)}function xA(n,e){let t=n.nodeValue.length,o=document.createRange(),r;for(let i=0;i<t;i++){o.setEnd(n,i+1),o.setStart(n,i);let s=dr(o,1);if(s.top!=s.bottom&&nm(e,s)){r={node:n,offset:i+(e.left>=(s.left+s.right)/2?1:0)};break}}return o.detach(),r||{node:n,offset:0}}function nm(n,e){return n.left>=e.left-1&&n.left<=e.right+1&&n.top>=e.top-1&&n.top<=e.bottom+1}function CA(n,e){let t=n.parentNode;return t&&/^li$/i.test(t.nodeName)&&e.left<n.getBoundingClientRect().left?t:n}function SA(n,e,t){let{node:o,offset:r}=a0(e,t),i=-1;if(o.nodeType==1&&!o.firstChild){let s=o.getBoundingClientRect();i=s.left!=s.right&&t.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(o,r,i)}function EA(n,e,t,o){let r=-1;for(let i=e,s=!1;i!=n.dom;){let l=n.docView.nearestDesc(i,!0),a;if(!l)return null;if(l.dom.nodeType==1&&(l.node.isBlock&&l.parent||!l.contentDOM)&&((a=l.dom.getBoundingClientRect()).width||a.height)&&(l.node.isBlock&&l.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(l.dom.nodeName)&&(!s&&a.left>o.left||a.top>o.top?r=l.posBefore:(!s&&a.right<o.left||a.bottom<o.top)&&(r=l.posAfter),s=!0),!l.contentDOM&&r<0&&!l.node.isText))return(l.node.isBlock?o.top<(a.top+a.bottom)/2:o.left<(a.left+a.right)/2)?l.posBefore:l.posAfter;i=l.dom.parentNode}return r>-1?r:n.docView.posFromDOM(e,t,-1)}function c0(n,e,t){let o=n.childNodes.length;if(o&&t.top<t.bottom)for(let r=Math.max(0,Math.min(o-1,Math.floor(o*(e.top-t.top)/(t.bottom-t.top))-2)),i=r;;){let s=n.childNodes[i];if(s.nodeType==1){let l=s.getClientRects();for(let a=0;a<l.length;a++){let u=l[a];if(nm(e,u))return c0(s,e,u)}}if((i=(i+1)%o)==r)break}return n}function MA(n,e){let t=n.dom.ownerDocument,o,r=0,i=mA(t,e.left,e.top);i&&({node:o,offset:r}=i);let s=(n.root.elementFromPoint?n.root:t).elementFromPoint(e.left,e.top),l;if(!s||!n.dom.contains(s.nodeType!=1?s.parentNode:s)){let u=n.dom.getBoundingClientRect();if(!nm(e,u)||(s=c0(n.dom,e,u),!s))return null}if(It)for(let u=s;o&&u;u=fs(u))u.draggable&&(o=void 0);if(s=CA(s,e),o){if(Dn&&o.nodeType==1&&(r=Math.min(r,o.childNodes.length),r<o.childNodes.length)){let d=o.childNodes[r],f;d.nodeName=="IMG"&&(f=d.getBoundingClientRect()).right<=e.left&&f.bottom>e.top&&r++}let u;fa&&r&&o.nodeType==1&&(u=o.childNodes[r-1]).nodeType==1&&u.contentEditable=="false"&&u.getBoundingClientRect().top>=e.top&&r--,o==n.dom&&r==o.childNodes.length-1&&o.lastChild.nodeType==1&&e.top>o.lastChild.getBoundingClientRect().bottom?l=n.state.doc.content.size:(r==0||o.nodeType!=1||o.childNodes[r-1].nodeName!="BR")&&(l=EA(n,o,r,e))}l==null&&(l=SA(n,s,e));let a=n.docView.nearestDesc(s,!0);return{pos:l,inside:a?a.posAtStart-a.border:-1}}function Ly(n){return n.top<n.bottom||n.left<n.right}function dr(n,e){let t=n.getClientRects();if(t.length){let o=t[e<0?0:t.length-1];if(Ly(o))return o}return Array.prototype.find.call(t,Ly)||n.getBoundingClientRect()}const TA=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function u0(n,e,t){let{node:o,offset:r,atom:i}=n.docView.domFromPos(e,t<0?-1:1),s=fa||Dn;if(o.nodeType==3)if(s&&(TA.test(o.nodeValue)||(t<0?!r:r==o.nodeValue.length))){let a=dr(jo(o,r,r),t);if(Dn&&r&&/\s/.test(o.nodeValue[r-1])&&r<o.nodeValue.length){let u=dr(jo(o,r-1,r-1),-1);if(u.top==a.top){let d=dr(jo(o,r,r+1),-1);if(d.top!=a.top)return js(d,d.left<u.left)}}return a}else{let a=r,u=r,d=t<0?1:-1;return t<0&&!r?(u++,d=-1):t>=0&&r==o.nodeValue.length?(a--,d=1):t<0?a--:u++,js(dr(jo(o,a,u),d),d<0)}if(!n.state.doc.resolve(e-(i||0)).parent.inlineContent){if(i==null&&r&&(t<0||r==Bn(o))){let a=o.childNodes[r-1];if(a.nodeType==1)return hf(a.getBoundingClientRect(),!1)}if(i==null&&r<Bn(o)){let a=o.childNodes[r];if(a.nodeType==1)return hf(a.getBoundingClientRect(),!0)}return hf(o.getBoundingClientRect(),t>=0)}if(i==null&&r&&(t<0||r==Bn(o))){let a=o.childNodes[r-1],u=a.nodeType==3?jo(a,Bn(a)-(s?0:1)):a.nodeType==1&&(a.nodeName!="BR"||!a.nextSibling)?a:null;if(u)return js(dr(u,1),!1)}if(i==null&&r<Bn(o)){let a=o.childNodes[r];for(;a.pmViewDesc&&a.pmViewDesc.ignoreForCoords;)a=a.nextSibling;let u=a?a.nodeType==3?jo(a,0,s?0:1):a.nodeType==1?a:null:null;if(u)return js(dr(u,-1),!0)}return js(dr(o.nodeType==3?jo(o):o,-t),t>=0)}function js(n,e){if(n.width==0)return n;let t=e?n.left:n.right;return{top:n.top,bottom:n.bottom,left:t,right:t}}function hf(n,e){if(n.height==0)return n;let t=e?n.top:n.bottom;return{top:t,bottom:t,left:n.left,right:n.right}}function d0(n,e,t){let o=n.state,r=n.root.activeElement;o!=e&&n.updateState(e),r!=n.dom&&n.focus();try{return t()}finally{o!=e&&n.updateState(o),r!=n.dom&&r&&r.focus()}}function NA(n,e,t){let o=e.selection,r=t=="up"?o.$from:o.$to;return d0(n,e,()=>{let{node:i}=n.docView.domFromPos(r.pos,t=="up"?-1:1);for(;;){let l=n.docView.nearestDesc(i,!0);if(!l)break;if(l.node.isBlock){i=l.contentDOM||l.dom;break}i=l.dom.parentNode}let s=u0(n,r.pos,1);for(let l=i.firstChild;l;l=l.nextSibling){let a;if(l.nodeType==1)a=l.getClientRects();else if(l.nodeType==3)a=jo(l,0,l.nodeValue.length).getClientRects();else continue;for(let u=0;u<a.length;u++){let d=a[u];if(d.bottom>d.top+1&&(t=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}const AA=/[\u0590-\u08ac]/;function OA(n,e,t){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let r=o.parentOffset,i=!r,s=r==o.parent.content.size,l=n.domSelection();return l?!AA.test(o.parent.textContent)||!l.modify?t=="left"||t=="backward"?i:s:d0(n,e,()=>{let{focusNode:a,focusOffset:u,anchorNode:d,anchorOffset:f}=n.domSelectionRange(),p=l.caretBidiLevel;l.modify("move",t,"character");let h=o.depth?n.docView.domAfterPos(o.before()):n.dom,{focusNode:m,focusOffset:g}=n.domSelectionRange(),y=m&&!h.contains(m.nodeType==1?m:m.parentNode)||a==m&&u==g;try{l.collapse(d,f),a&&(a!=d||u!=f)&&l.extend&&l.extend(a,u)}catch{}return p!=null&&(l.caretBidiLevel=p),y}):o.pos==o.start()||o.pos==o.end()}let Py=null,Vy=null,zy=!1;function $A(n,e,t){return Py==e&&Vy==t?zy:(Py=e,Vy=t,zy=t=="up"||t=="down"?NA(n,e,t):OA(n,e,t))}const In=0,Fy=1,Xr=2,Co=3;class pa{constructor(e,t,o,r){this.parent=e,this.children=t,this.dom=o,this.contentDOM=r,this.dirty=In,o.pmViewDesc=this}matchesWidget(e){return!1}matchesMark(e){return!1}matchesNode(e,t,o){return!1}matchesHack(e){return!1}parseRule(){return null}stopEvent(e){return!1}get size(){let e=0;for(let t=0;t<this.children.length;t++)e+=this.children[t].size;return e}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let e=0;e<this.children.length;e++)this.children[e].destroy()}posBeforeChild(e){for(let t=0,o=this.posAtStart;;t++){let r=this.children[t];if(r==e)return o;o+=r.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(e,t,o){if(this.contentDOM&&this.contentDOM.contains(e.nodeType==1?e:e.parentNode))if(o<0){let i,s;if(e==this.contentDOM)i=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.previousSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.previousSibling;return i?this.posBeforeChild(s)+s.size:this.posAtStart}else{let i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&!((s=i.pmViewDesc)&&s.parent==this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}let r;if(e==this.dom&&this.contentDOM)r=t>Rt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))r=e.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(t==0)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!1;break}if(i.previousSibling)break}if(r==null&&t==e.childNodes.length)for(let i=e;;i=i.parentNode){if(i==this.dom){r=!0;break}if(i.nextSibling)break}}return r??o>0?this.posAtEnd:this.posAtStart}nearestDesc(e,t=!1){for(let o=!0,r=e;r;r=r.parentNode){let i=this.getDesc(r),s;if(i&&(!t||i.node))if(o&&(s=i.nodeDOM)&&!(s.nodeType==1?s.contains(e.nodeType==1?e:e.parentNode):s==e))o=!1;else return i}}getDesc(e){let t=e.pmViewDesc;for(let o=t;o;o=o.parent)if(o==this)return t}posFromDOM(e,t,o){for(let r=e;r;r=r.parentNode){let i=this.getDesc(r);if(i)return i.localPosFromDOM(e,t,o)}return-1}descAt(e){for(let t=0,o=0;t<this.children.length;t++){let r=this.children[t],i=o+r.size;if(o==e&&i!=o){for(;!r.border&&r.children.length;)for(let s=0;s<r.children.length;s++){let l=r.children[s];if(l.size){r=l;break}}return r}if(e<i)return r.descAt(e-o-r.border);o=i}}domFromPos(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};let o=0,r=0;for(let i=0;o<this.children.length;o++){let s=this.children[o],l=i+s.size;if(l>e||s instanceof p0){r=e-i;break}i=l}if(r)return this.children[o].domFromPos(r-this.children[o].border,t);for(let i;o&&!(i=this.children[o-1]).size&&i instanceof f0&&i.side>=0;o--);if(t<=0){let i,s=!0;for(;i=o?this.children[o-1]:null,!(!i||i.dom.parentNode==this.contentDOM);o--,s=!1);return i&&t&&s&&!i.border&&!i.domAtom?i.domFromPos(i.size,t):{node:this.contentDOM,offset:i?Rt(i.dom)+1:0}}else{let i,s=!0;for(;i=o<this.children.length?this.children[o]:null,!(!i||i.dom.parentNode==this.contentDOM);o++,s=!1);return i&&s&&!i.border&&!i.domAtom?i.domFromPos(0,t):{node:this.contentDOM,offset:i?Rt(i.dom):this.contentDOM.childNodes.length}}}parseRange(e,t,o=0){if(this.children.length==0)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let r=-1,i=-1;for(let s=o,l=0;;l++){let a=this.children[l],u=s+a.size;if(r==-1&&e<=u){let d=s+a.border;if(e>=d&&t<=u-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,d);e=s;for(let f=l;f>0;f--){let p=this.children[f-1];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(1)){r=Rt(p.dom)+1;break}e-=p.size}r==-1&&(r=0)}if(r>-1&&(u>t||l==this.children.length-1)){t=u;for(let d=l+1;d<this.children.length;d++){let f=this.children[d];if(f.size&&f.dom.parentNode==this.contentDOM&&!f.emptyChildAt(-1)){i=Rt(f.dom);break}t+=f.size}i==-1&&(i=this.contentDOM.childNodes.length);break}s=u}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:i}}emptyChildAt(e){if(this.border||!this.contentDOM||!this.children.length)return!1;let t=this.children[e<0?0:this.children.length-1];return t.size==0||t.emptyChildAt(e)}domAfterPos(e){let{node:t,offset:o}=this.domFromPos(e,0);if(t.nodeType!=1||o==t.childNodes.length)throw new RangeError("No node after pos "+e);return t.childNodes[o]}setSelection(e,t,o,r=!1){let i=Math.min(e,t),s=Math.max(e,t);for(let h=0,m=0;h<this.children.length;h++){let g=this.children[h],y=m+g.size;if(i>m&&s<y)return g.setSelection(e-m-g.border,t-m-g.border,o,r);m=y}let l=this.domFromPos(e,e?-1:1),a=t==e?l:this.domFromPos(t,t?-1:1),u=o.root.getSelection(),d=o.domSelectionRange(),f=!1;if((Dn||It)&&e==t){let{node:h,offset:m}=l;if(h.nodeType==3){if(f=!!(m&&h.nodeValue[m-1]==`
|
|
10
|
+
`),f&&m==h.nodeValue.length)for(let g=h,y;g;g=g.parentNode){if(y=g.nextSibling){y.nodeName=="BR"&&(l=a={node:y.parentNode,offset:Rt(y)+1});break}let b=g.pmViewDesc;if(b&&b.node&&b.node.isBlock)break}}else{let g=h.childNodes[m-1];f=g&&(g.nodeName=="BR"||g.contentEditable=="false")}}if(Dn&&d.focusNode&&d.focusNode!=a.node&&d.focusNode.nodeType==1){let h=d.focusNode.childNodes[d.focusOffset];h&&h.contentEditable=="false"&&(r=!0)}if(!(r||f&&It)&&gi(l.node,l.offset,d.anchorNode,d.anchorOffset)&&gi(a.node,a.offset,d.focusNode,d.focusOffset))return;let p=!1;if((u.extend||e==t)&&!(f&&Dn)){u.collapse(l.node,l.offset);try{e!=t&&u.extend(a.node,a.offset),p=!0}catch{}}if(!p){if(e>t){let m=l;l=a,a=m}let h=document.createRange();h.setEnd(a.node,a.offset),h.setStart(l.node,l.offset),u.removeAllRanges(),u.addRange(h)}}ignoreMutation(e){return!this.contentDOM&&e.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(e,t){for(let o=0,r=0;r<this.children.length;r++){let i=this.children[r],s=o+i.size;if(o==s?e<=s&&t>=o:e<s&&t>o){let l=o+i.border,a=s-i.border;if(e>=l&&t<=a){this.dirty=e==o||t==s?Xr:Fy,e==l&&t==a&&(i.contentLost||i.dom.parentNode!=this.contentDOM)?i.dirty=Co:i.markDirty(e-l,t-l);return}else i.dirty=i.dom==i.contentDOM&&i.dom.parentNode==this.contentDOM&&!i.children.length?Xr:Co}o=s}this.dirty=Xr}markParentsDirty(){let e=1;for(let t=this.parent;t;t=t.parent,e++){let o=e==1?Xr:Fy;t.dirty<o&&(t.dirty=o)}}get domAtom(){return!1}get ignoreForCoords(){return!1}get ignoreForSelection(){return!1}isText(e){return!1}}class f0 extends pa{constructor(e,t,o,r){let i,s=t.type.toDOM;if(typeof s=="function"&&(s=s(o,()=>{if(!i)return r;if(i.parent)return i.parent.posBeforeChild(i)})),!t.type.spec.raw){if(s.nodeType!=1){let l=document.createElement("span");l.appendChild(s),s=l}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(e,[],s,null),this.widget=t,this.widget=t,i=this}matchesWidget(e){return this.dirty==In&&e.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(e){let t=this.widget.spec.stopEvent;return t?t(e):!1}ignoreMutation(e){return e.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get ignoreForSelection(){return!!this.widget.type.spec.relaxedSide}get side(){return this.widget.type.side}}class BA extends pa{constructor(e,t,o,r){super(e,[],t,null),this.textDOM=o,this.text=r}get size(){return this.text.length}localPosFromDOM(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}domFromPos(e){return{node:this.textDOM,offset:e}}ignoreMutation(e){return e.type==="characterData"&&e.target.nodeValue==e.oldValue}}class yi extends pa{constructor(e,t,o,r,i){super(e,[],o,r),this.mark=t,this.spec=i}static create(e,t,o,r){let i=r.nodeViews[t.type.name],s=i&&i(t,r,o);return(!s||!s.dom)&&(s=Oi.renderSpec(document,t.type.spec.toDOM(t,o),null,t.attrs)),new yi(e,t,s.dom,s.contentDOM||s.dom,s)}parseRule(){return this.dirty&Co||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(e){return this.dirty!=Co&&this.mark.eq(e)}markDirty(e,t){if(super.markDirty(e,t),this.dirty!=In){let o=this.parent;for(;!o.node;)o=o.parent;o.dirty<this.dirty&&(o.dirty=this.dirty),this.dirty=In}}slice(e,t,o){let r=yi.create(this.parent,this.mark,!0,o),i=this.children,s=this.size;t<s&&(i=xp(i,t,s,o)),e>0&&(i=xp(i,0,e,o));for(let l=0;l<i.length;l++)i[l].parent=r;return r.children=i,r}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}}class Tr extends pa{constructor(e,t,o,r,i,s,l,a,u){super(e,[],i,s),this.node=t,this.outerDeco=o,this.innerDeco=r,this.nodeDOM=l}static create(e,t,o,r,i,s){let l=i.nodeViews[t.type.name],a,u=l&&l(t,i,()=>{if(!a)return s;if(a.parent)return a.parent.posBeforeChild(a)},o,r),d=u&&u.dom,f=u&&u.contentDOM;if(t.isText){if(!d)d=document.createTextNode(t.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:f}=Oi.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs));!f&&!t.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));let p=d;return d=g0(d,o,t),u?a=new RA(e,t,o,r,d,f||null,p,u,i,s+1):t.isText?new sd(e,t,o,r,d,p,i):new Tr(e,t,o,r,d,f||null,p,i,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let e={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(e.preserveWhitespace="full"),!this.contentDOM)e.getContent=()=>this.node.content;else if(!this.contentLost)e.contentElement=this.contentDOM;else{for(let t=this.children.length-1;t>=0;t--){let o=this.children[t];if(this.dom.contains(o.dom.parentNode)){e.contentElement=o.dom.parentNode;break}}e.contentElement||(e.getContent=()=>D.empty)}return e}matchesNode(e,t,o){return this.dirty==In&&e.eq(this.node)&&Pc(t,this.outerDeco)&&o.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(e,t){let o=this.node.inlineContent,r=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,l=i&&i.pos<0,a=new DA(this,s&&s.node,e);PA(this.node,this.innerDeco,(u,d,f)=>{u.spec.marks?a.syncToMarks(u.spec.marks,o,e,d):u.type.side>=0&&!f&&a.syncToMarks(d==this.node.childCount?je.none:this.node.child(d).marks,o,e,d),a.placeWidget(u,e,r)},(u,d,f,p)=>{a.syncToMarks(u.marks,o,e,p);let h;a.findNodeMatch(u,d,f,p)||l&&e.state.selection.from>r&&e.state.selection.to<r+u.nodeSize&&(h=a.findIndexWithChild(i.node))>-1&&a.updateNodeAt(u,d,f,h,e)||a.updateNextNode(u,d,f,e,p,r)||a.addNode(u,d,f,e,r),r+=u.nodeSize}),a.syncToMarks([],o,e,0),this.node.isTextblock&&a.addTextblockHacks(),a.destroyRest(),(a.changed||this.dirty==Xr)&&(s&&this.protectLocalComposition(e,s),h0(this.contentDOM,this.children,e),ps&&VA(this.dom))}localCompositionInfo(e,t){let{from:o,to:r}=e.state.selection;if(!(e.state.selection instanceof q)||o<t||r>t+this.node.content.size)return null;let i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){let s=i.nodeValue,l=zA(this.node.content,s,o-t,r-t);return l<0?null:{node:i,pos:l,text:s}}else return{node:i,pos:-1,text:""}}protectLocalComposition(e,{node:t,pos:o,text:r}){if(this.getDesc(t))return;let i=t;for(;i.parentNode!=this.contentDOM;i=i.parentNode){for(;i.previousSibling;)i.parentNode.removeChild(i.previousSibling);for(;i.nextSibling;)i.parentNode.removeChild(i.nextSibling);i.pmViewDesc&&(i.pmViewDesc=void 0)}let s=new BA(this,i,t,r);e.input.compositionNodes.push(s),this.children=xp(this.children,o,o+r.length,e,s)}update(e,t,o,r){return this.dirty==Co||!e.sameMarkup(this.node)?!1:(this.updateInner(e,t,o,r),!0)}updateInner(e,t,o,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=o,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=In}updateOuterDeco(e){if(Pc(e,this.outerDeco))return;let t=this.nodeDOM.nodeType!=1,o=this.dom;this.dom=m0(this.dom,this.nodeDOM,wp(this.outerDeco,this.node,t),wp(e,this.node,t)),this.dom!=o&&(o.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}selectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.nodeDOM.draggable=!0))}deselectNode(){this.nodeDOM.nodeType==1&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.nodeDOM.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function Hy(n,e,t,o,r){g0(o,e,n);let i=new Tr(void 0,n,e,t,o,o,o,r,0);return i.contentDOM&&i.updateChildren(r,0),i}class sd extends Tr{constructor(e,t,o,r,i,s,l){super(e,t,o,r,i,null,s,l,0)}parseRule(){let e=this.nodeDOM.parentNode;for(;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}update(e,t,o,r){return this.dirty==Co||this.dirty!=In&&!this.inParent()||!e.sameMarkup(this.node)?!1:(this.updateOuterDeco(t),(this.dirty!=In||e.text!=this.node.text)&&e.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=In,!0)}inParent(){let e=this.parent.contentDOM;for(let t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}domFromPos(e){return{node:this.nodeDOM,offset:e}}localPosFromDOM(e,t,o){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):super.localPosFromDOM(e,t,o)}ignoreMutation(e){return e.type!="characterData"&&e.type!="selection"}slice(e,t,o){let r=this.node.cut(e,t),i=document.createTextNode(r.text);return new sd(this.parent,r,this.outerDeco,this.innerDeco,i,i,o)}markDirty(e,t){super.markDirty(e,t),this.dom!=this.nodeDOM&&(e==0||t==this.nodeDOM.nodeValue.length)&&(this.dirty=Co)}get domAtom(){return!1}isText(e){return this.node.text==e}}class p0 extends pa{parseRule(){return{ignore:!0}}matchesHack(e){return this.dirty==In&&this.dom.nodeName==e}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}}class RA extends Tr{constructor(e,t,o,r,i,s,l,a,u,d){super(e,t,o,r,i,s,l,u,d),this.spec=a}update(e,t,o,r){if(this.dirty==Co)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){let i=this.spec.update(e,t,o);return i&&this.updateInner(e,t,o,r),i}else return!this.contentDOM&&!e.isLeaf?!1:super.update(e,t,o,r)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(e,t,o,r){this.spec.setSelection?this.spec.setSelection(e,t,o.root):super.setSelection(e,t,o,r)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(e){return this.spec.stopEvent?this.spec.stopEvent(e):!1}ignoreMutation(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):super.ignoreMutation(e)}}function h0(n,e,t){let o=n.firstChild,r=!1;for(let i=0;i<e.length;i++){let s=e[i],l=s.dom;if(l.parentNode==n){for(;l!=o;)o=jy(o),r=!0;o=o.nextSibling}else r=!0,n.insertBefore(l,o);if(s instanceof yi){let a=o?o.previousSibling:n.lastChild;h0(s.contentDOM,s.children,t),o=a?a.nextSibling:n.firstChild}}for(;o;)o=jy(o),r=!0;r&&t.trackWrites==n&&(t.trackWrites=null)}const ul=function(n){n&&(this.nodeName=n)};ul.prototype=Object.create(null);const Yr=[new ul];function wp(n,e,t){if(n.length==0)return Yr;let o=t?Yr[0]:new ul,r=[o];for(let i=0;i<n.length;i++){let s=n[i].type.attrs;if(s){s.nodeName&&r.push(o=new ul(s.nodeName));for(let l in s){let a=s[l];a!=null&&(t&&r.length==1&&r.push(o=new ul(e.isInline?"span":"div")),l=="class"?o.class=(o.class?o.class+" ":"")+a:l=="style"?o.style=(o.style?o.style+";":"")+a:l!="nodeName"&&(o[l]=a))}}}return r}function m0(n,e,t,o){if(t==Yr&&o==Yr)return e;let r=e;for(let i=0;i<o.length;i++){let s=o[i],l=t[i];if(i){let a;l&&l.nodeName==s.nodeName&&r!=n&&(a=r.parentNode)&&a.nodeName.toLowerCase()==s.nodeName||(a=document.createElement(s.nodeName),a.pmIsDeco=!0,a.appendChild(r),l=Yr[0]),r=a}_A(r,l||Yr[0],s)}return r}function _A(n,e,t){for(let o in e)o!="class"&&o!="style"&&o!="nodeName"&&!(o in t)&&n.removeAttribute(o);for(let o in t)o!="class"&&o!="style"&&o!="nodeName"&&t[o]!=e[o]&&n.setAttribute(o,t[o]);if(e.class!=t.class){let o=e.class?e.class.split(" ").filter(Boolean):[],r=t.class?t.class.split(" ").filter(Boolean):[];for(let i=0;i<o.length;i++)r.indexOf(o[i])==-1&&n.classList.remove(o[i]);for(let i=0;i<r.length;i++)o.indexOf(r[i])==-1&&n.classList.add(r[i]);n.classList.length==0&&n.removeAttribute("class")}if(e.style!=t.style){if(e.style){let o=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,r;for(;r=o.exec(e.style);)n.style.removeProperty(r[1])}t.style&&(n.style.cssText+=t.style)}}function g0(n,e,t){return m0(n,n,Yr,wp(e,t,n.nodeType!=1))}function Pc(n,e){if(n.length!=e.length)return!1;for(let t=0;t<n.length;t++)if(!n[t].type.eq(e[t].type))return!1;return!0}function jy(n){let e=n.nextSibling;return n.parentNode.removeChild(n),e}class DA{constructor(e,t,o){this.lock=t,this.view=o,this.index=0,this.stack=[],this.changed=!1,this.top=e,this.preMatch=IA(e.node.content,e)}destroyBetween(e,t){if(e!=t){for(let o=e;o<t;o++)this.top.children[o].destroy();this.top.children.splice(e,t-e),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(e,t,o,r){let i=0,s=this.stack.length>>1,l=Math.min(s,e.length);for(;i<l&&(i==s-1?this.top:this.stack[i+1<<1]).matchesMark(e[i])&&e[i].type.spec.spanning!==!1;)i++;for(;i<s;)this.destroyRest(),this.top.dirty=In,this.index=this.stack.pop(),this.top=this.stack.pop(),s--;for(;s<e.length;){this.stack.push(this.top,this.index+1);let a=-1,u=this.top.children.length;r<this.preMatch.index&&(u=Math.min(this.index+3,u));for(let d=this.index;d<u;d++){let f=this.top.children[d];if(f.matchesMark(e[s])&&!this.isLocked(f.dom)){a=d;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let d=yi.create(this.top,e[s],t,o);this.top.children.splice(this.index,0,d),this.top=d,this.changed=!0}this.index=0,s++}}findNodeMatch(e,t,o,r){let i=-1,s;if(r>=this.preMatch.index&&(s=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&s.matchesNode(e,t,o))i=this.top.children.indexOf(s,this.index);else for(let l=this.index,a=Math.min(this.top.children.length,l+5);l<a;l++){let u=this.top.children[l];if(u.matchesNode(e,t,o)&&!this.preMatch.matched.has(u)){i=l;break}}return i<0?!1:(this.destroyBetween(this.index,i),this.index++,!0)}updateNodeAt(e,t,o,r,i){let s=this.top.children[r];return s.dirty==Co&&s.dom==s.contentDOM&&(s.dirty=Xr),s.update(e,t,o,i)?(this.destroyBetween(this.index,r),this.index++,!0):!1}findIndexWithChild(e){for(;;){let t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){let o=e.pmViewDesc;if(o){for(let r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==o)return r}return-1}e=t}}updateNextNode(e,t,o,r,i,s){for(let l=this.index;l<this.top.children.length;l++){let a=this.top.children[l];if(a instanceof Tr){let u=this.preMatch.matched.get(a);if(u!=null&&u!=i)return!1;let d=a.dom,f,p=this.isLocked(d)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&a.dirty!=Co&&Pc(t,a.outerDeco));if(!p&&a.update(e,t,o,r))return this.destroyBetween(this.index,l),a.dom!=d&&(this.changed=!0),this.index++,!0;if(!p&&(f=this.recreateWrapper(a,e,t,o,r,s)))return this.destroyBetween(this.index,l),this.top.children[this.index]=f,f.contentDOM&&(f.dirty=Xr,f.updateChildren(r,s+1),f.dirty=In),this.changed=!0,this.index++,!0;break}}return!1}recreateWrapper(e,t,o,r,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Pc(o,e.outerDeco)||!r.eq(e.innerDeco))return null;let l=Tr.create(this.top,t,o,r,i,s);if(l.contentDOM){l.children=e.children,e.children=[];for(let a of l.children)a.parent=l}return e.destroy(),l}addNode(e,t,o,r,i){let s=Tr.create(this.top,e,t,o,r,i);s.contentDOM&&s.updateChildren(r,i+1),this.top.children.splice(this.index++,0,s),this.changed=!0}placeWidget(e,t,o){let r=this.index<this.top.children.length?this.top.children[this.index]:null;if(r&&r.matchesWidget(e)&&(e==r.widget||!r.widget.type.toDOM.parentNode))this.index++;else{let i=new f0(this.top,e,t,o);this.top.children.splice(this.index++,0,i),this.changed=!0}}addTextblockHacks(){let e=this.top.children[this.index-1],t=this.top;for(;e instanceof yi;)t=e,e=t.children[t.children.length-1];(!e||!(e instanceof sd)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((It||xt)&&e&&e.dom.contentEditable=="false"&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}addHackNode(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{let o=document.createElement(e);e=="IMG"&&(o.className="ProseMirror-separator",o.alt=""),e=="BR"&&(o.className="ProseMirror-trailingBreak");let r=new p0(this.top,[],o,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}isLocked(e){return this.lock&&(e==this.lock||e.nodeType==1&&e.contains(this.lock.parentNode))}}function IA(n,e){let t=e,o=t.children.length,r=n.childCount,i=new Map,s=[];e:for(;r>0;){let l;for(;;)if(o){let u=t.children[o-1];if(u instanceof yi)t=u,o=u.children.length;else{l=u,o--;break}}else{if(t==e)break e;o=t.parent.children.indexOf(t),t=t.parent}let a=l.node;if(a){if(a!=n.child(r-1))break;--r,i.set(l,r),s.push(l)}}return{index:r,matched:i,matches:s.reverse()}}function LA(n,e){return n.type.side-e.type.side}function PA(n,e,t,o){let r=e.locals(n),i=0;if(r.length==0){for(let u=0;u<n.childCount;u++){let d=n.child(u);o(d,r,e.forChild(i,d),u),i+=d.nodeSize}return}let s=0,l=[],a=null;for(let u=0;;){let d,f;for(;s<r.length&&r[s].to==i;){let y=r[s++];y.widget&&(d?(f||(f=[d])).push(y):d=y)}if(d)if(f){f.sort(LA);for(let y=0;y<f.length;y++)t(f[y],u,!!a)}else t(d,u,!!a);let p,h;if(a)h=-1,p=a,a=null;else if(u<n.childCount)h=u,p=n.child(u++);else break;for(let y=0;y<l.length;y++)l[y].to<=i&&l.splice(y--,1);for(;s<r.length&&r[s].from<=i&&r[s].to>i;)l.push(r[s++]);let m=i+p.nodeSize;if(p.isText){let y=m;s<r.length&&r[s].from<y&&(y=r[s].from);for(let b=0;b<l.length;b++)l[b].to<y&&(y=l[b].to);y<m&&(a=p.cut(y-i),p=p.cut(0,y-i),m=y,h=-1)}else for(;s<r.length&&r[s].to<m;)s++;let g=p.isInline&&!p.isLeaf?l.filter(y=>!y.inline):l.slice();o(p,g,e.forChild(i,p),h),i=m}}function VA(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let e=n.style.cssText;n.style.cssText=e+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=e}}function zA(n,e,t,o){for(let r=0,i=0;r<n.childCount&&i<=o;){let s=n.child(r++),l=i;if(i+=s.nodeSize,!s.isText)continue;let a=s.text;for(;r<n.childCount;){let u=n.child(r++);if(i+=u.nodeSize,!u.isText)break;a+=u.text}if(i>=t){if(i>=o&&a.slice(o-e.length-l,o-l)==e)return o-e.length;let u=l<o?a.lastIndexOf(e,o-l-1):-1;if(u>=0&&u+e.length+l>=t)return l+u;if(t==o&&a.length>=o+e.length-l&&a.slice(o-l,o-l+e.length)==e)return o}}return-1}function xp(n,e,t,o,r){let i=[];for(let s=0,l=0;s<n.length;s++){let a=n[s],u=l,d=l+=a.size;u>=t||d<=e?i.push(a):(u<e&&i.push(a.slice(0,e-u,o)),r&&(i.push(r),r=void 0),d>t&&i.push(a.slice(t-u,a.size,o)))}return i}function om(n,e=null){let t=n.domSelectionRange(),o=n.state.doc;if(!t.focusNode)return null;let r=n.docView.nearestDesc(t.focusNode),i=r&&r.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=o.resolve(s),a,u;if(id(t)){for(a=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Q.isSelectable(f)&&r.parent&&!(f.isInline&&pA(t.focusNode,t.focusOffset,r.dom))){let p=r.posBefore;u=new Q(s==p?l:o.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=s,p=s;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[a,s]=p==n.state.selection.anchor?[p,f]:[f,p],l=o.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let d=o.resolve(a);if(!u){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;u=rm(n,d,l,f)}return u}function y0(n){return n.editable?n.hasFocus():v0(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Go(n,e=!1){let t=n.state.selection;if(b0(n,t),!!y0(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&xt){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&gi(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)HA(n);else{let{anchor:o,head:r}=t,i,s;Uy&&!(t instanceof q)&&(t.$from.parent.inlineContent||(i=Wy(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Wy(n,t.to))),n.docView.setSelection(o,r,n,e),Uy&&(i&&qy(i),s&&qy(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&FA(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Uy=It||xt&&r0<63;function Wy(n,e){let{node:t,offset:o}=n.docView.domFromPos(e,0),r=o<t.childNodes.length?t.childNodes[o]:null,i=o?t.childNodes[o-1]:null;if(It&&r&&r.contentEditable=="false")return mf(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return mf(r);if(i)return mf(i)}}function mf(n){return n.contentEditable="true",It&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function qy(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function FA(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),o=t.anchorNode,r=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=o||t.anchorOffset!=r)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!y0(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function HA(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,Rt(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&un&&Mr<=11&&(t.disabled=!0,t.disabled=!1)}function b0(n,e){if(e instanceof Q){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Ky(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Ky(n)}function Ky(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function rm(n,e,t,o){return n.someProp("createSelectionBetween",r=>r(n,e,t))||q.between(e,t,o)}function Jy(n){return n.editable&&!n.hasFocus()?!1:v0(n)}function v0(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function jA(n){let e=n.docView.domFromPos(n.state.selection.anchor,0),t=n.domSelectionRange();return gi(e.node,e.offset,t.anchorNode,t.anchorOffset)}function Cp(n,e){let{$anchor:t,$head:o}=n.selection,r=e>0?t.max(o):t.min(o),i=r.parent.inlineContent?r.depth?n.doc.resolve(e>0?r.after():r.before()):null:r;return i&&se.findFrom(i,e)}function fr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Gy(n,e,t){let o=n.state.selection;if(o instanceof q)if(t.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return fr(n,new q(o.$anchor,s))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=Cp(n.state,e);return r&&r instanceof Q?fr(n,r):!1}else if(!(On&&t.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?Q.isSelectable(i)?fr(n,new Q(e<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):fa?fr(n,new q(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Q&&o.node.isInline)return fr(n,new q(e>0?o.$to:o.$from));{let r=Cp(n.state,e);return r?fr(n,r):!1}}}function Vc(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function dl(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Vi(n,e){return e<0?UA(n):WA(n)}function UA(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r,i,s=!1;for(Dn&&t.nodeType==1&&o<Vc(t)&&dl(t.childNodes[o],-1)&&(s=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(dl(l,-1))r=t,i=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(k0(t))break;{let l=t.previousSibling;for(;l&&dl(l,-1);)r=t.parentNode,i=Rt(l),l=l.previousSibling;if(l)t=l,o=Vc(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}s?Sp(n,t,o):r&&Sp(n,r,i)}function WA(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r=Vc(t),i,s;for(;;)if(o<r){if(t.nodeType!=1)break;let l=t.childNodes[o];if(dl(l,1))i=t,s=++o;else break}else{if(k0(t))break;{let l=t.nextSibling;for(;l&&dl(l,1);)i=l.parentNode,s=Rt(l)+1,l=l.nextSibling;if(l)t=l,o=0,r=Vc(t);else{if(t=t.parentNode,t==n.dom)break;o=r=0}}}i&&Sp(n,i,s)}function k0(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function qA(n,e){for(;n&&e==n.childNodes.length&&!da(n);)e=Rt(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function KA(n,e){for(;n&&!e&&!da(n);)e=Rt(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Sp(n,e,t){if(e.nodeType!=3){let i,s;(s=qA(e,t))?(e=s,t=0):(i=KA(e,t))&&(e=i,t=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if(id(o)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,t);n.domObserver.setCurSelection();let{state:r}=n;setTimeout(()=>{n.state==r&&Go(n)},50)}function Xy(n,e){let t=n.state.doc.resolve(e);if(!(xt||i0)&&t.parent.inlineContent){let r=n.coordsAtPos(e);if(e>t.start()){let i=n.coordsAtPos(e-1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left<r.left?"ltr":"rtl"}if(e<t.end()){let i=n.coordsAtPos(e+1),s=(i.top+i.bottom)/2;if(s>r.top&&s<r.bottom&&Math.abs(i.left-r.left)>1)return i.left>r.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Yy(n,e,t){let o=n.state.selection;if(o instanceof q&&!o.empty||t.indexOf("s")>-1||On&&t.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Cp(n.state,e);if(s&&s instanceof Q)return fr(n,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof on?se.near(s,e):se.findFrom(s,e);return l?fr(n,l):!1}return!1}function Qy(n,e){if(!(n.state.selection instanceof q))return!0;let{$head:t,$anchor:o,empty:r}=n.state.selection;if(!t.sameParent(o))return!0;if(!r)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function Zy(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function JA(n){if(!It||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;Zy(n,o,"true"),setTimeout(()=>Zy(n,o,"false"),20)}return!1}function GA(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function XA(n,e){let t=e.keyCode,o=GA(e);if(t==8||On&&t==72&&o=="c")return Qy(n,-1)||Vi(n,-1);if(t==46&&!e.shiftKey||On&&t==68&&o=="c")return Qy(n,1)||Vi(n,1);if(t==13||t==27)return!0;if(t==37||On&&t==66&&o=="c"){let r=t==37?Xy(n,n.state.selection.from)=="ltr"?-1:1:-1;return Gy(n,r,o)||Vi(n,r)}else if(t==39||On&&t==70&&o=="c"){let r=t==39?Xy(n,n.state.selection.from)=="ltr"?1:-1:1;return Gy(n,r,o)||Vi(n,r)}else{if(t==38||On&&t==80&&o=="c")return Yy(n,-1,o)||Vi(n,-1);if(t==40||On&&t==78&&o=="c")return JA(n)||Yy(n,1,o)||Vi(n,1);if(o==(On?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function im(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=n.someProp("clipboardSerializer")||Oi.fromSchema(n.state.schema),l=M0(),a=l.createElement("div");a.appendChild(s.serializeFragment(o,{document:l}));let u=a.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=E0[u.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let m=l.createElement(d[h]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
|
|
11
|
+
|
|
12
|
+
`);return{dom:a,text:p,slice:e}}function w0(n,e,t,o,r){let i=r.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=!!e&&(o||i||!t);if(a){if(n.someProp("transformPastedText",p=>{e=p(e,i||o,n)}),i)return l=new H(D.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
13
|
+
`))),0,0),n.someProp("transformPasted",p=>{l=p(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",p=>p(e,r,o,n));if(f)l=f;else{let p=r.marks(),{schema:h}=n.state,m=Oi.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),s=eO(t),fa&&tO(s);let u=s&&s.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||ts.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:r,ruleFromNode(p){return p.nodeName=="BR"&&!p.nextSibling&&p.parentNode&&!YA.test(p.parentNode.nodeName)?{ignore:!0}:null}})),d)l=nO(eb(l,+d[1],+d[2]),d[4]);else if(l=H.maxOpen(QA(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=eb(l,f,p)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}const YA=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function QA(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let r=e.node(t).contentMatchAt(e.index(t)),i,s=[];if(n.forEach(l=>{if(!s)return;let a=r.findWrapping(l.type),u;if(!a)return s=null;if(u=s.length&&i.length&&C0(a,i,l,s[s.length-1],0))s[s.length-1]=u;else{s.length&&(s[s.length-1]=S0(s[s.length-1],i.length));let d=x0(l,a);s.push(d),r=r.matchType(d.type),i=a}}),s)return D.from(s)}return n}function x0(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,D.from(n));return n}function C0(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=C0(n,e,t,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==n.length-1?t.type:n[r+1]))return o.copy(o.content.append(D.from(x0(t,n,r+1))))}}function S0(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,S0(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(D.empty,!0);return n.copy(t.append(o))}function Ep(n,e,t,o,r,i){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(i=0),r<o-1&&(l=Ep(l,e,t,o,r+1,i)),r>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(D.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function eb(n,e,t){return e<n.openStart&&(n=new H(Ep(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new H(Ep(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const E0={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let tb=null;function M0(){return tb||(tb=document.implementation.createHTMLDocument("title"))}let gf=null;function ZA(n){let e=window.trustedTypes;return e?(gf||(gf=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),gf.createHTML(n)):n}function eO(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=M0().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&E0[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=ZA(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function tO(n){let e=n.querySelectorAll(xt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let o=e[t];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),o)}}function nO(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return n}let{content:r,openStart:i,openEnd:s}=n;for(let l=o.length-2;l>=0;l-=2){let a=t.nodes[o[l]];if(!a||a.hasRequiredAttrs())break;r=D.from(a.create(o[l+1],r)),i++,s++}return new H(r,i,s)}const rn={},sn={},oO={touchstart:!0,touchmove:!0};class rO{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}}function iO(n){for(let e in rn){let t=rn[e];n.dom.addEventListener(e,n.input.eventHandlers[e]=o=>{lO(n,o)&&!sm(n,o)&&(n.editable||!(o.type in sn))&&t(n,o)},oO[e]?{passive:!0}:void 0)}It&&n.dom.addEventListener("input",()=>null),Mp(n)}function xr(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}function sO(n){n.domObserver.stop();for(let e in n.input.eventHandlers)n.dom.removeEventListener(e,n.input.eventHandlers[e]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Mp(n){n.someProp("handleDOMEvents",e=>{for(let t in e)n.input.eventHandlers[t]||n.dom.addEventListener(t,n.input.eventHandlers[t]=o=>sm(n,o))})}function sm(n,e){return n.someProp("handleDOMEvents",t=>{let o=t[e.type];return o?o(n,e)||e.defaultPrevented:!1})}function lO(n,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let t=e.target;t!=n.dom;t=t.parentNode)if(!t||t.nodeType==11||t.pmViewDesc&&t.pmViewDesc.stopEvent(e))return!1;return!0}function aO(n,e){!sm(n,e)&&rn[e.type]&&(n.editable||!(e.type in sn))&&rn[e.type](n,e)}sn.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!N0(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Wo&&xt&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),ps&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let o=Date.now();n.input.lastIOSEnter=o,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==o&&(n.someProp("handleKeyDown",r=>r(n,Jr(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||XA(n,t)?t.preventDefault():xr(n,"key")};sn.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};sn.keypress=(n,e)=>{let t=e;if(N0(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||On&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof q)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!n.someProp("handleTextInput",s=>s(n,o.$from.pos,o.$to.pos,r,i))&&n.dispatch(i()),t.preventDefault()}};function ld(n){return{left:n.clientX,top:n.clientY}}function cO(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function lm(n,e,t,o,r){if(o==-1)return!1;let i=n.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),r,!0):l(n,t,i.node(s),i.before(s),r,!1)))return!0;return!1}function rs(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let o=n.state.tr.setSelection(e);o.setMeta("pointer",!0),n.dispatch(o)}function uO(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&Q.isSelectable(o)?(rs(n,new Q(t)),!0):!1}function dO(n,e){if(e==-1)return!1;let t=n.state.selection,o,r;t instanceof Q&&(o=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(Q.isSelectable(l)){o&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?r=i.before(t.$from.depth):r=i.before(s);break}}return r!=null?(rs(n,Q.create(n.state.doc,r)),!0):!1}function fO(n,e,t,o,r){return lm(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?dO(n,t):uO(n,t))}function pO(n,e,t,o){return lm(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function hO(n,e,t,o){return lm(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||mO(n,t,o)}function mO(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(rs(n,q.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)rs(n,q.create(o,l+1,l+1+s.content.size));else if(Q.isSelectable(s))rs(n,Q.create(o,l));else continue;return!0}}function am(n){return zc(n)}const T0=On?"metaKey":"ctrlKey";rn.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=am(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&cO(t,n.input.lastClick)&&!t[T0]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:i,button:t.button};let s=n.posAtCoords(ld(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new gO(n,s,t,!!o)):(i=="doubleClick"?pO:hO)(n,s.pos,s.inside,t)?t.preventDefault():xr(n,"pointer"))};class gO{constructor(e,t,o,r){this.view=e,this.pos=t,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[T0],this.allowDefault=o.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,s=d.depth?d.before():0}const l=r?null:o.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:u}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof Q&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Dn&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),xr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Go(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ld(e))),this.updateAllowDefault(e),this.allowDefault||!t?xr(this.view,"pointer"):fO(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||It&&this.mightDrag&&!this.mightDrag.node.isAtom||xt&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(rs(this.view,se.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):xr(this.view,"pointer")}move(e){this.updateAllowDefault(e),xr(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}rn.touchstart=n=>{n.input.lastTouch=Date.now(),am(n),xr(n,"pointer")};rn.touchmove=n=>{n.input.lastTouch=Date.now(),xr(n,"pointer")};rn.contextmenu=n=>am(n);function N0(n,e){return n.composing?!0:It&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const yO=Wo?5e3:-1;sn.compositionstart=sn.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof q&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||xt&&i0&&bO(n)))n.markCursor=n.state.storedMarks||t.marks(),zc(n,!0),n.markCursor=null;else if(zc(n,!e.selection.empty),Dn&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let o=n.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}n.input.composing=!0}A0(n,yO)};function bO(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let o=e.childNodes[t];return o.nodeType==1&&o.contentEditable=="false"}sn.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,A0(n,20))};function A0(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>zc(n),e))}function O0(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=kO());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function vO(n){let e=n.domSelectionRange();if(!e.focusNode)return null;let t=dA(e.focusNode,e.focusOffset),o=fA(e.focusNode,e.focusOffset);if(t&&o&&t!=o){let r=o.pmViewDesc,i=n.domObserver.lastChangedTextNode;if(t==i||o==i)return i;if(!r||!r.isText(o.nodeValue))return o;if(n.input.compositionNode==o){let s=t.pmViewDesc;if(!(!s||!s.isText(t.nodeValue)))return o}}return t||o}function kO(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function zc(n,e=!1){if(!(Wo&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),O0(n),e||n.docView&&n.docView.dirty){let t=om(n),o=n.state.selection;return t&&!t.eq(o)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function wO(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),n.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const Rl=un&&Mr<15||ps&&gA<604;rn.copy=sn.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=Rl?null:t.clipboardData,s=o.content(),{dom:l,text:a}=im(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):wO(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function xO(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function CO(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,o=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),o.parentNode&&o.parentNode.removeChild(o),t?_l(n,o.value,null,r,e):_l(n,o.textContent,o.innerHTML,r,e)},50)}function _l(n,e,t,o,r){let i=w0(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,i||H.empty)))return!0;if(!i)return!1;let s=xO(i),l=s?n.state.tr.replaceSelectionWith(s,o):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function $0(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}sn.paste=(n,e)=>{let t=e;if(n.composing&&!Wo)return;let o=Rl?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&_l(n,$0(o),o.getData("text/html"),r,t)?t.preventDefault():CO(n,t)};class B0{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const SO=On?"altKey":"ctrlKey";function R0(n,e){let t=n.someProp("dragCopies",o=>!o(e));return t??!e[SO]}rn.dragstart=(n,e)=>{let t=e,o=n.input.mouseDown;if(o&&o.done(),!t.dataTransfer)return;let r=n.state.selection,i=r.empty?null:n.posAtCoords(ld(t)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Q?r.to-1:r.to))){if(o&&o.mightDrag)s=Q.create(n.state.doc,o.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(s=Q.create(n.state.doc,f.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:u,slice:d}=im(n,l);(!t.dataTransfer.files.length||!xt||r0>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(Rl?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",Rl||t.dataTransfer.setData("text/plain",u),n.dragging=new B0(d,R0(n,t),s)};rn.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};sn.dragover=sn.dragenter=(n,e)=>e.preventDefault();sn.drop=(n,e)=>{try{EO(n,e,n.dragging)}finally{n.dragging=null}};function EO(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(ld(e));if(!o)return;let r=n.state.doc.resolve(o.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=w0(n,$0(e.dataTransfer),Rl?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(t&&R0(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||H.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?Lw(n.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let a=n.state.tr;if(s){let{node:h}=t;h?h.replace(a):a.deleteSelection()}let u=a.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(d?a.replaceRangeWith(u,u,i.content.firstChild):a.replaceRange(u,u,i),a.doc.eq(f))return;let p=a.doc.resolve(u);if(d&&Q.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new Q(p));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((m,g,y,b)=>h=b),a.setSelection(rm(n,p,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}rn.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Go(n)},20))};rn.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};rn.beforeinput=(n,e)=>{if(xt&&Wo&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:o}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=o||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",i=>i(n,Jr(8,"Backspace")))))return;let{$cursor:r}=n.state.selection;r&&r.pos>0&&n.dispatch(n.state.tr.delete(r.pos-1,r.pos).scrollIntoView())},50)}};for(let n in sn)rn[n]=sn[n];function Dl(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Fc{constructor(e,t){this.toDOM=e,this.spec=t||ni,this.side=this.spec.side||0}map(e,t,o,r){let{pos:i,deleted:s}=e.mapResult(t.from+r,this.side<0?-1:1);return s?null:new Ve(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Fc&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Dl(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Nr{constructor(e,t){this.attrs=e,this.spec=t||ni}map(e,t,o,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new Ve(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Nr&&Dl(this.attrs,e.attrs)&&Dl(this.spec,e.spec)}static is(e){return e.type instanceof Nr}destroy(){}}class cm{constructor(e,t){this.attrs=e,this.spec=t||ni}map(e,t,o,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let s=e.mapResult(t.to+r,-1);return s.deleted||s.pos<=i.pos?null:new Ve(i.pos-o,s.pos-o,this)}valid(e,t){let{index:o,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(o)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof cm&&Dl(this.attrs,e.attrs)&&Dl(this.spec,e.spec)}destroy(){}}class Ve{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new Ve(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,o){return this.type.map(e,this,t,o)}static widget(e,t,o){return new Ve(e,e,new Fc(t,o))}static inline(e,t,o,r){return new Ve(e,t,new Nr(o,r))}static node(e,t,o,r){return new Ve(e,t,new cm(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Nr}get widget(){return this.type instanceof Fc}}const Ui=[],ni={};class Se{constructor(e,t){this.local=e.length?e:Ui,this.children=t.length?t:Ui}static create(e,t){return t.length?Hc(t,e,0,ni):Ft}find(e,t,o){let r=[];return this.findInner(e??0,t??1e9,r,0,o),r}findInner(e,t,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,o,r+l,i)}}map(e,t,o){return this==Ft||e.maps.length==0?this:this.mapInner(e,t,0,0,o||ni)}mapInner(e,t,o,r,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,o,r);a&&a.type.valid(t,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?MO(this.children,s||[],e,t,o,r,i):s?new Se(s.sort(oi),Ui):Ft}add(e,t){return t.length?this==Ft?Se.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let r,i=0;e.forEach((l,a)=>{let u=a+o,d;if(d=D0(t,l,u)){for(r||(r=this.children.slice());i<r.length&&r[i]<a;)i+=3;r[i]==a?r[i+2]=r[i+2].addInner(l,d,u+1):r.splice(i,0,a,a+l.nodeSize,Hc(d,l,u+1,ni)),i+=3}});let s=_0(i?I0(t):t,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new Se(s.length?this.local.concat(s).sort(oi):this.local,r||this.children)}remove(e){return e.length==0||this==Ft?this:this.removeInner(e,0)}removeInner(e,t){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+t,a=o[i+1]+t;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let u=o[i+2].removeInner(s,l+1);u!=Ft?o[i+2]=u:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,t)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new Se(r,o):Ft}forChild(e,t){if(this==Ft)return this;if(t.isLeaf)return Se.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof Nr){let u=Math.max(i,a.from)-i,d=Math.min(s,a.to)-i;u<d&&(r||(r=[])).push(a.copy(u,d))}}if(r){let l=new Se(r.sort(oi),Ui);return o?new gr([l,o]):l}return o||Ft}eq(e){if(this==e)return!0;if(!(e instanceof Se)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return um(this.localsInner(e))}localsInner(e){if(this==Ft)return Ui;if(e.inlineContent||!this.local.some(Nr.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof Nr||t.push(this.local[o]);return t}forEachSet(e){e(this)}}Se.empty=new Se([],[]);Se.removeOverlap=um;const Ft=Se.empty;class gr{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,ni));return gr.from(o)}forChild(e,t){if(t.isLeaf)return Se.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=Ft&&(i instanceof gr?o=o.concat(i.members):o.push(i))}return gr.from(o)}eq(e){if(!(e instanceof gr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{o&&(t=t.slice(),o=!1);for(let s=0;s<i.length;s++)t.push(i[s])}}return t?um(o?t:t.sort(oi)):Ui}static from(e){switch(e.length){case 0:return Ft;case 1:return e[0];default:return new gr(e.every(t=>t instanceof Se)?e:e.reduce((t,o)=>t.concat(o instanceof Se?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function MO(n,e,t,o,r,i,s){let l=n.slice();for(let u=0,d=i;u<t.maps.length;u++){let f=0;t.maps[u].forEach((p,h,m,g)=>{let y=g-m-(h-p);for(let b=0;b<l.length;b+=3){let v=l[b+1];if(v<0||p>v+d-f)continue;let w=l[b]+d-f;h>=w?l[b+1]=p<=w?-2:-1:p>=d&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),d=t.maps[u].map(d,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let d=t.map(n[u]+i),f=d-r;if(f<0||f>=o.content.size){a=!0;continue}let p=t.map(n[u+1]+i,-1),h=p-r,{index:m,offset:g}=o.content.findIndex(f),y=o.maybeChild(m);if(y&&g==f&&g+y.nodeSize==h){let b=l[u+2].mapInner(t,y,d+1,n[u]+i+1,s);b!=Ft?(l[u]=f,l[u+1]=h,l[u+2]=b):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=TO(l,n,e,t,r,i,s),d=Hc(u,o,0,s);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<d.children.length;f+=3){let h=d.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,d.children[f],d.children[f+1],d.children[f+2])}}return new Se(e.sort(oi),l)}function _0(n,e){if(!e||!n.length)return n;let t=[];for(let o=0;o<n.length;o++){let r=n[o];t.push(new Ve(r.from+e,r.to+e,r.type))}return t}function TO(n,e,t,o,r,i,s){function l(a,u){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(o,r,u);f?t.push(f):s.onRemove&&s.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+u+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function D0(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,r=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>t&&s.to<o&&((r||(r=[])).push(s),n[i]=null);return r}function I0(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Hc(n,e,t,o){let r=[],i=!1;e.forEach((l,a)=>{let u=D0(n,l,a+t);if(u){i=!0;let d=Hc(u,l,t+a+1,o);d!=Ft&&r.push(a,a+l.nodeSize,d)}});let s=_0(i?I0(n):n,-t).sort(oi);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new Se(s,r):Ft}function oi(n,e){return n.from-e.from||n.to-e.to}function um(n){let e=n;for(let t=0;t<e.length-1;t++){let o=e[t];if(o.from!=o.to)for(let r=t+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==n&&(e=n.slice()),e[r]=i.copy(i.from,o.to),nb(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==n&&(e=n.slice()),e[t]=o.copy(o.from,i.from),nb(e,r,o.copy(i.from,o.to)));break}}}return e}function nb(n,e,t){for(;e<n.length&&oi(t,n[e])>0;)e++;n.splice(e,0,t)}function yf(n){let e=[];return n.someProp("decorations",t=>{let o=t(n.state);o&&o!=Ft&&e.push(o)}),n.cursorWrapper&&e.push(Se.create(n.state.doc,[n.cursorWrapper.deco])),gr.from(e)}const NO={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},AO=un&&Mr<=11;class OO{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}class $O{constructor(e,t){this.view=e,this.handleDOMChange=t,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new OO,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(o=>{for(let r=0;r<o.length;r++)this.queue.push(o[r]);un&&Mr<=11&&o.some(r=>r.type=="childList"&&r.removedNodes.length||r.type=="characterData"&&r.oldValue.length>r.target.nodeValue.length)?this.flushSoon():It&&e.composing&&o.some(r=>r.type=="childList"&&r.target.nodeName=="TR")?(e.input.badSafariComposition=!0,this.flushSoon()):this.flush()}),AO&&(this.onCharData=o=>{this.queue.push({target:o.target,type:"characterData",oldValue:o.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,NO)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let e=this.observer.takeRecords();if(e.length){for(let t=0;t<e.length;t++)this.queue.push(e[t]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(Jy(this.view)){if(this.suppressingSelectionUpdates)return Go(this.view);if(un&&Mr<=11&&!this.view.state.selection.empty){let e=this.view.domSelectionRange();if(e.focusNode&&gi(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(e){if(!e.focusNode)return!0;let t=new Set,o;for(let i=e.focusNode;i;i=fs(i))t.add(i);for(let i=e.anchorNode;i;i=fs(i))if(t.has(i)){o=i;break}let r=o&&this.view.docView.nearestDesc(o);if(r&&r.ignoreMutation({type:"selection",target:o.nodeType==3?o.parentNode:o}))return this.setCurSelection(),!0}pendingRecords(){if(this.observer)for(let e of this.observer.takeRecords())this.queue.push(e);return this.queue}flush(){let{view:e}=this;if(!e.docView||this.flushingSoon>-1)return;let t=this.pendingRecords();t.length&&(this.queue=[]);let o=e.domSelectionRange(),r=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(o)&&Jy(e)&&!this.ignoreSelectionChange(o),i=-1,s=-1,l=!1,a=[];if(e.editable)for(let d=0;d<t.length;d++){let f=this.registerMutation(t[d],a);f&&(i=i<0?f.from:Math.min(f.from,i),s=s<0?f.to:Math.max(f.to,s),f.typeOver&&(l=!0))}if(Dn&&a.length){let d=a.filter(f=>f.nodeName=="BR");if(d.length==2){let[f,p]=d;f.parentNode&&f.parentNode.parentNode==p.parentNode?p.remove():f.remove()}else{let{focusNode:f}=this.currentSelection;for(let p of d){let h=p.parentNode;h&&h.nodeName=="LI"&&(!f||_O(e,f)!=h)&&p.remove()}}}else if((xt||It)&&a.some(d=>d.nodeName=="BR")&&(e.input.lastKeyCode==8||e.input.lastKeyCode==46)){for(let d of a)if(d.nodeName=="BR"&&d.parentNode){let f=d.nextSibling;f&&f.nodeType==1&&f.contentEditable=="false"&&d.parentNode.removeChild(d)}}let u=null;i<0&&r&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&id(o)&&(u=om(e))&&u.eq(se.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,Go(e),this.currentSelection.set(o),e.scrollToSelection()):(i>-1||r)&&(i>-1&&(e.docView.markDirty(i,s),BO(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,DO(e,a)),this.handleDOMChange(i,s,l,a),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(o)||Go(e),this.currentSelection.set(o))}registerMutation(e,t){if(t.indexOf(e.target)>-1)return null;let o=this.view.docView.nearestDesc(e.target);if(e.type=="attributes"&&(o==this.view.docView||e.attributeName=="contenteditable"||e.attributeName=="style"&&!e.oldValue&&!e.target.getAttribute("style"))||!o||o.ignoreMutation(e))return null;if(e.type=="childList"){for(let d=0;d<e.addedNodes.length;d++){let f=e.addedNodes[d];t.push(f),f.nodeType==3&&(this.lastChangedTextNode=f)}if(o.contentDOM&&o.contentDOM!=o.dom&&!o.contentDOM.contains(e.target))return{from:o.posBefore,to:o.posAfter};let r=e.previousSibling,i=e.nextSibling;if(un&&Mr<=11&&e.addedNodes.length)for(let d=0;d<e.addedNodes.length;d++){let{previousSibling:f,nextSibling:p}=e.addedNodes[d];(!f||Array.prototype.indexOf.call(e.addedNodes,f)<0)&&(r=f),(!p||Array.prototype.indexOf.call(e.addedNodes,p)<0)&&(i=p)}let s=r&&r.parentNode==e.target?Rt(r)+1:0,l=o.localPosFromDOM(e.target,s,-1),a=i&&i.parentNode==e.target?Rt(i):e.target.childNodes.length,u=o.localPosFromDOM(e.target,a,1);return{from:l,to:u}}else return e.type=="attributes"?{from:o.posAtStart-o.border,to:o.posAtEnd+o.border}:(this.lastChangedTextNode=e.target,{from:o.posAtStart,to:o.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}let ob=new WeakMap,rb=!1;function BO(n){if(!ob.has(n)&&(ob.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=Dn,rb)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),rb=!0}}function ib(n,e){let t=e.startContainer,o=e.startOffset,r=e.endContainer,i=e.endOffset,s=n.domAtPos(n.state.selection.anchor);return gi(s.node,s.offset,r,i)&&([t,o,r,i]=[r,i,t,o]),{anchorNode:t,anchorOffset:o,focusNode:r,focusOffset:i}}function RO(n,e){if(e.getComposedRanges){let r=e.getComposedRanges(n.root)[0];if(r)return ib(n,r)}let t;function o(r){r.preventDefault(),r.stopImmediatePropagation(),t=r.getTargetRanges()[0]}return n.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",o,!0),t?ib(n,t):null}function _O(n,e){for(let t=e.parentNode;t&&t!=n.dom;t=t.parentNode){let o=n.docView.nearestDesc(t,!0);if(o&&o.node.isBlock)return t}return null}function DO(n,e){var t;let{focusNode:o,focusOffset:r}=n.domSelectionRange();for(let i of e)if(((t=i.parentNode)===null||t===void 0?void 0:t.nodeName)=="TR"){let s=i.nextSibling;for(;s&&s.nodeName!="TD"&&s.nodeName!="TH";)s=s.nextSibling;if(s){let l=s;for(;;){let a=l.firstChild;if(!a||a.nodeType!=1||a.contentEditable=="false"||/^(BR|IMG)$/.test(a.nodeName))break;l=a}l.insertBefore(i,l.firstChild),o==i&&n.domSelection().collapse(i,r)}else i.parentNode.removeChild(i)}}function IO(n,e,t){let{node:o,fromOffset:r,toOffset:i,from:s,to:l}=n.docView.parseRange(e,t),a=n.domSelectionRange(),u,d=a.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(u=[{node:d,offset:a.anchorOffset}],id(a)||u.push({node:a.focusNode,offset:a.focusOffset})),xt&&n.input.lastKeyCode===8)for(let y=i;y>r;y--){let b=o.childNodes[y-1],v=b.pmViewDesc;if(b.nodeName=="BR"&&!v){i=y;break}if(!v||v.size)break}let f=n.state.doc,p=n.someProp("domParser")||ts.fromSchema(n.state.schema),h=f.resolve(s),m=null,g=p.parse(o,{topNode:h.parent,topMatch:h.parent.contentMatchAt(h.index()),topOpen:!0,from:r,to:i,preserveWhitespace:h.parent.type.whitespace=="pre"?"full":!0,findPositions:u,ruleFromNode:LO,context:h});if(u&&u[0].pos!=null){let y=u[0].pos,b=u[1]&&u[1].pos;b==null&&(b=y),m={anchor:y+s,head:b+s}}return{doc:g,sel:m,from:s,to:l}}function LO(n){let e=n.pmViewDesc;if(e)return e.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(It&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let t=document.createElement("div");return t.appendChild(document.createElement("li")),{skip:t}}else if(n.parentNode.lastChild==n||It&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}const PO=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function VO(n,e,t,o,r){let i=n.input.compositionPendingChanges||(n.composing?n.input.compositionID:0);if(n.input.compositionPendingChanges=0,e<0){let S=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,M=om(n,S);if(M&&!n.state.selection.eq(M)){if(xt&&Wo&&n.input.lastKeyCode===13&&Date.now()-100<n.input.lastKeyCodeTime&&n.someProp("handleKeyDown",A=>A(n,Jr(13,"Enter"))))return;let N=n.state.tr.setSelection(M);S=="pointer"?N.setMeta("pointer",!0):S=="key"&&N.scrollIntoView(),i&&N.setMeta("composition",i),n.dispatch(N)}return}let s=n.state.doc.resolve(e),l=s.sharedDepth(t);e=s.before(l+1),t=n.state.doc.resolve(t).after(l+1);let a=n.state.selection,u=IO(n,e,t),d=n.state.doc,f=d.slice(u.from,u.to),p,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(p=n.state.selection.to,h="end"):(p=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let m=HO(f.content,u.doc.content,u.from,p,h);if(m&&n.input.domChangeCount++,(ps&&n.input.lastIOSEnter>Date.now()-225||Wo)&&r.some(S=>S.nodeType==1&&!PO.test(S.nodeName))&&(!m||m.endA>=m.endB)&&n.someProp("handleKeyDown",S=>S(n,Jr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!m)if(o&&a instanceof q&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(u.sel&&u.sel.anchor!=u.sel.head))m={start:a.from,endA:a.to,endB:a.to};else{if(u.sel){let S=sb(n,n.state.doc,u.sel);if(S&&!S.eq(n.state.selection)){let M=n.state.tr.setSelection(S);i&&M.setMeta("composition",i),n.dispatch(M)}}return}n.state.selection.from<n.state.selection.to&&m.start==m.endB&&n.state.selection instanceof q&&(m.start>n.state.selection.from&&m.start<=n.state.selection.from+2&&n.state.selection.from>=u.from?m.start=n.state.selection.from:m.endA<n.state.selection.to&&m.endA>=n.state.selection.to-2&&n.state.selection.to<=u.to&&(m.endB+=n.state.selection.to-m.endA,m.endA=n.state.selection.to)),un&&Mr<=11&&m.endB==m.start+1&&m.endA==m.start&&m.start>u.from&&u.doc.textBetween(m.start-u.from-1,m.start-u.from+1)==" "&&(m.start--,m.endA--,m.endB--);let g=u.doc.resolveNoCache(m.start-u.from),y=u.doc.resolveNoCache(m.endB-u.from),b=d.resolve(m.start),v=g.sameParent(y)&&g.parent.inlineContent&&b.end()>=m.endA;if((ps&&n.input.lastIOSEnter>Date.now()-225&&(!v||r.some(S=>S.nodeName=="DIV"||S.nodeName=="P"))||!v&&g.pos<u.doc.content.size&&(!g.sameParent(y)||!g.parent.inlineContent)&&g.pos<y.pos&&!/\S/.test(u.doc.textBetween(g.pos,y.pos,"","")))&&n.someProp("handleKeyDown",S=>S(n,Jr(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>m.start&&FO(d,m.start,m.endA,g,y)&&n.someProp("handleKeyDown",S=>S(n,Jr(8,"Backspace")))){Wo&&xt&&n.domObserver.suppressSelectionUpdates();return}xt&&m.endB==m.start&&(n.input.lastChromeDelete=Date.now()),Wo&&!v&&g.start()!=y.start()&&y.parentOffset==0&&g.depth==y.depth&&u.sel&&u.sel.anchor==u.sel.head&&u.sel.head==m.endA&&(m.endB-=2,y=u.doc.resolveNoCache(m.endB-u.from),setTimeout(()=>{n.someProp("handleKeyDown",function(S){return S(n,Jr(13,"Enter"))})},20));let w=m.start,k=m.endA,x=S=>{let M=S||n.state.tr.replace(w,k,u.doc.slice(m.start-u.from,m.endB-u.from));if(u.sel){let N=sb(n,M.doc,u.sel);N&&!(xt&&n.composing&&N.empty&&(m.start!=m.endB||n.input.lastChromeDelete<Date.now()-100)&&(N.head==w||N.head==M.mapping.map(k)-1)||un&&N.empty&&N.head==w)&&M.setSelection(N)}return i&&M.setMeta("composition",i),M.scrollIntoView()},C;if(v)if(g.pos==y.pos){un&&Mr<=11&&g.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>Go(n),20));let S=x(n.state.tr.delete(w,k)),M=d.resolve(m.start).marksAcross(d.resolve(m.endA));M&&S.ensureMarks(M),n.dispatch(S)}else if(m.endA==m.endB&&(C=zO(g.parent.content.cut(g.parentOffset,y.parentOffset),b.parent.content.cut(b.parentOffset,m.endA-b.start())))){let S=x(n.state.tr);C.type=="add"?S.addMark(w,k,C.mark):S.removeMark(w,k,C.mark),n.dispatch(S)}else if(g.parent.child(g.index()).isText&&g.index()==y.index()-(y.textOffset?0:1)){let S=g.parent.textBetween(g.parentOffset,y.parentOffset),M=()=>x(n.state.tr.insertText(S,w,k));n.someProp("handleTextInput",N=>N(n,w,k,S,M))||n.dispatch(M())}else n.dispatch(x());else n.dispatch(x())}function sb(n,e,t){return Math.max(t.anchor,t.head)>e.content.size?null:rm(n,e.resolve(t.anchor),e.resolve(t.head))}function zO(n,e){let t=n.firstChild.marks,o=e.firstChild.marks,r=t,i=o,s,l,a;for(let d=0;d<o.length;d++)r=o[d].removeFromSet(r);for(let d=0;d<t.length;d++)i=t[d].removeFromSet(i);if(r.length==1&&i.length==0)l=r[0],s="add",a=d=>d.mark(l.addToSet(d.marks));else if(r.length==0&&i.length==1)l=i[0],s="remove",a=d=>d.mark(l.removeFromSet(d.marks));else return null;let u=[];for(let d=0;d<e.childCount;d++)u.push(a(e.child(d)));if(D.from(u).eq(n))return{mark:l,type:s}}function FO(n,e,t,o,r){if(t-e<=r.pos-o.pos||bf(o,!0,!1)<r.pos)return!1;let i=n.resolve(e);if(!o.parent.isTextblock){let l=i.nodeAfter;return l!=null&&t==e+l.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;let s=n.resolve(bf(i,!0,!0));return!s.parent.isTextblock||s.pos>t||bf(s,!0,!1)<t?!1:o.parent.content.cut(o.parentOffset).eq(s.parent.content)}function bf(n,e,t){let o=n.depth,r=e?n.end():n.pos;for(;o>0&&(e||n.indexAfter(o)==n.node(o).childCount);)o--,r++,e=!1;if(t){let i=n.node(o).maybeChild(n.indexAfter(o));for(;i&&!i.isLeaf;)i=i.firstChild,r++}return r}function HO(n,e,t,o,r){let i=n.findDiffStart(e,t);if(i==null)return null;let{a:s,b:l}=n.findDiffEnd(e,t+n.size,t+e.size);if(r=="end"){let a=Math.max(0,i-Math.min(s,l));o-=s+a-i}if(s<i&&n.size<e.size){let a=o<=i&&o>=s?i-o:0;i-=a,i&&i<e.size&&lb(e.textBetween(i-1,i+1))&&(i+=a?1:-1),l=i+(l-s),s=i}else if(l<i){let a=o<=i&&o>=l?i-o:0;i-=a,i&&i<n.size&&lb(n.textBetween(i-1,i+1))&&(i+=a?1:-1),s=i+(s-l),l=i}return{start:i,endA:s,endB:l}}function lb(n){if(n.length!=2)return!1;let e=n.charCodeAt(0),t=n.charCodeAt(1);return e>=56320&&e<=57343&&t>=55296&&t<=56319}class L0{constructor(e,t){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new rO,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=t,this.state=t.state,this.directPlugins=t.plugins||[],this.directPlugins.forEach(fb),this.dispatch=this.dispatch.bind(this),this.dom=e&&e.mount||document.createElement("div"),e&&(e.appendChild?e.appendChild(this.dom):typeof e=="function"?e(this.dom):e.mount&&(this.mounted=!0)),this.editable=ub(this),cb(this),this.nodeViews=db(this),this.docView=Hy(this.state.doc,ab(this),yf(this),this.dom,this),this.domObserver=new $O(this,(o,r,i,s)=>VO(this,o,r,i,s)),this.domObserver.start(),iO(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let e=this._props;this._props={};for(let t in e)this._props[t]=e[t];this._props.state=this.state}return this._props}update(e){e.handleDOMEvents!=this._props.handleDOMEvents&&Mp(this);let t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(fb),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}setProps(e){let t={};for(let o in this._props)t[o]=this._props[o];t.state=this.state;for(let o in e)t[o]=e[o];this.update(t)}updateState(e){this.updateStateInner(e,this._props)}updateStateInner(e,t){var o;let r=this.state,i=!1,s=!1;e.storedMarks&&this.composing&&(O0(this),s=!0),this.state=e;let l=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(l||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){let h=db(this);UO(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(l||t.handleDOMEvents!=this._props.handleDOMEvents)&&Mp(this),this.editable=ub(this),cb(this);let a=yf(this),u=ab(this),d=r.plugins!=e.plugins&&!r.doc.eq(e.doc)?"reset":e.scrollToSelection>r.scrollToSelection?"to selection":"preserve",f=i||!this.docView.matchesNode(e.doc,u,a);(f||!e.selection.eq(r.selection))&&(s=!0);let p=d=="preserve"&&s&&this.dom.style.overflowAnchor==null&&vA(this);if(s){this.domObserver.stop();let h=f&&(un||xt)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&jO(r.selection,e.selection);if(f){let m=xt?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=vO(this)),(i||!this.docView.update(e.doc,u,a,this))&&(this.docView.updateOuterDeco(u),this.docView.destroy(),this.docView=Hy(e.doc,u,a,this.dom,this)),m&&(!this.trackWrites||!this.dom.contains(this.trackWrites))&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&jA(this))?Go(this,h):(b0(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),!((o=this.dragging)===null||o===void 0)&&o.node&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),d=="reset"?this.dom.scrollTop=0:d=="to selection"?this.scrollToSelection():p&&kA(p)}scrollToSelection(){let e=this.domSelectionRange().focusNode;if(!(!e||!this.dom.contains(e.nodeType==1?e:e.parentNode))){if(!this.someProp("handleScrollToSelection",t=>t(this)))if(this.state.selection instanceof Q){let t=this.docView.domAfterPos(this.state.selection.from);t.nodeType==1&&Iy(this,t.getBoundingClientRect(),e)}else Iy(this,this.coordsAtPos(this.state.selection.head,1),e)}}destroyPluginViews(){let e;for(;e=this.pluginViews.pop();)e.destroy&&e.destroy()}updatePluginViews(e){if(!e||e.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let t=0;t<this.directPlugins.length;t++){let o=this.directPlugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(let t=0;t<this.state.plugins.length;t++){let o=this.state.plugins[t];o.spec.view&&this.pluginViews.push(o.spec.view(this))}}else for(let t=0;t<this.pluginViews.length;t++){let o=this.pluginViews[t];o.update&&o.update(this,e)}}updateDraggedNode(e,t){let o=e.node,r=-1;if(this.state.doc.nodeAt(o.from)==o.node)r=o.from;else{let i=o.from+(this.state.doc.content.size-t.doc.content.size);(i>0&&this.state.doc.nodeAt(i))==o.node&&(r=i)}this.dragging=new B0(e.slice,e.move,r<0?void 0:Q.create(this.state.doc,r))}someProp(e,t){let o=this._props&&this._props[e],r;if(o!=null&&(r=t?t(o):o))return r;for(let s=0;s<this.directPlugins.length;s++){let l=this.directPlugins[s].props[e];if(l!=null&&(r=t?t(l):l))return r}let i=this.state.plugins;if(i)for(let s=0;s<i.length;s++){let l=i[s].props[e];if(l!=null&&(r=t?t(l):l))return r}}hasFocus(){if(un){let e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if(e.contentEditable=="false")return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&wA(this.dom),Go(this),this.domObserver.start()}get root(){let e=this._root;if(e==null){for(let t=this.dom.parentNode;t;t=t.parentNode)if(t.nodeType==9||t.nodeType==11&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=()=>t.ownerDocument.getSelection()),this._root=t}return e||document}updateRoot(){this._root=null}posAtCoords(e){return MA(this,e)}coordsAtPos(e,t=1){return u0(this,e,t)}domAtPos(e,t=0){return this.docView.domFromPos(e,t)}nodeDOM(e){let t=this.docView.descAt(e);return t?t.nodeDOM:null}posAtDOM(e,t,o=-1){let r=this.docView.posFromDOM(e,t,o);if(r==null)throw new RangeError("DOM position not inside the editor");return r}endOfTextblock(e,t){return $A(this,t||this.state,e)}pasteHTML(e,t){return _l(this,"",e,!1,t||new ClipboardEvent("paste"))}pasteText(e,t){return _l(this,e,null,!0,t||new ClipboardEvent("paste"))}serializeForClipboard(e){return im(this,e)}destroy(){this.docView&&(sO(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],yf(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,cA())}get isDestroyed(){return this.docView==null}dispatchEvent(e){return aO(this,e)}domSelectionRange(){let e=this.domSelection();return e?It&&this.root.nodeType===11&&hA(this.dom.ownerDocument)==this.dom&&RO(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}L0.prototype.dispatch=function(n){let e=this._props.dispatchTransaction;e?e.call(this,n):this.updateState(this.state.apply(n))};function ab(n){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(n.editable),n.someProp("attributes",t=>{if(typeof t=="function"&&(t=t(n.state)),t)for(let o in t)o=="class"?e.class+=" "+t[o]:o=="style"?e.style=(e.style?e.style+";":"")+t[o]:!e[o]&&o!="contenteditable"&&o!="nodeName"&&(e[o]=String(t[o]))}),e.translate||(e.translate="no"),[Ve.node(0,n.state.doc.content.size,e)]}function cb(n){if(n.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),n.cursorWrapper={dom:e,deco:Ve.widget(n.state.selection.from,e,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function ub(n){return!n.someProp("editable",e=>e(n.state)===!1)}function jO(n,e){let t=Math.min(n.$anchor.sharedDepth(n.head),e.$anchor.sharedDepth(e.head));return n.$anchor.start(t)!=e.$anchor.start(t)}function db(n){let e=Object.create(null);function t(o){for(let r in o)Object.prototype.hasOwnProperty.call(e,r)||(e[r]=o[r])}return n.someProp("nodeViews",t),n.someProp("markViews",t),e}function UO(n,e){let t=0,o=0;for(let r in n){if(n[r]!=e[r])return!0;t++}for(let r in e)o++;return t!=o}function fb(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var Br={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},jc={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},WO=typeof navigator<"u"&&/Mac/.test(navigator.platform),qO=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var _t=0;_t<10;_t++)Br[48+_t]=Br[96+_t]=String(_t);for(var _t=1;_t<=24;_t++)Br[_t+111]="F"+_t;for(var _t=65;_t<=90;_t++)Br[_t]=String.fromCharCode(_t+32),jc[_t]=String.fromCharCode(_t);for(var vf in Br)jc.hasOwnProperty(vf)||(jc[vf]=Br[vf]);function KO(n){var e=WO&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||qO&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?jc:Br)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const JO=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),GO=typeof navigator<"u"&&/Win/.test(navigator.platform);function XO(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))JO?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+a)}return o&&(t="Alt-"+t),r&&(t="Ctrl-"+t),s&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function YO(n){let e=Object.create(null);for(let t in n)e[XO(t)]=n[t];return e}function kf(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function QO(n){return new ue({props:{handleKeyDown:dm(n)}})}function dm(n){let e=YO(n);return function(t,o){let r=KO(o),i,s=e[kf(r,o)];if(s&&s(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[kf(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(GO&&o.ctrlKey&&o.altKey)&&(i=Br[o.keyCode])&&i!=r){let l=e[kf(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}var ZO=Object.defineProperty,fm=(n,e)=>{for(var t in e)ZO(n,t,{get:e[t],enumerable:!0})};function ad(n){const{state:e,transaction:t}=n;let{selection:o}=t,{doc:r}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=t.selection,r=t.doc,i=t.storedMarks,t}}}var cd=class{constructor(n){this.editor=n.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=n.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:n,editor:e,state:t}=this,{view:o}=e,{tr:r}=t,i=this.buildProps(r);return Object.fromEntries(Object.entries(n).map(([s,l])=>[s,(...u)=>{const d=l(...u)(i);return!r.getMeta("preventDispatch")&&!this.hasCustomState&&o.dispatch(r),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(n,e=!0){const{rawCommands:t,editor:o,state:r}=this,{view:i}=o,s=[],l=!!n,a=n||r.tr,u=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(a),s.every(f=>f===!0)),d={...Object.fromEntries(Object.entries(t).map(([f,p])=>[f,(...m)=>{const g=this.buildProps(a,e),y=p(...m)(g);return s.push(y),d}])),run:u};return d}createCan(n){const{rawCommands:e,state:t}=this,o=!1,r=n||t.tr,i=this.buildProps(r,o);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>a(...u)({...i,dispatch:void 0})])),chain:()=>this.createChain(r,o)}}buildProps(n,e=!0){const{rawCommands:t,editor:o,state:r}=this,{view:i}=o,s={tr:n,editor:o,view:i,state:ad({state:r,transaction:n}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(n,e),can:()=>this.createCan(n),get commands(){return Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...u)=>a(...u)(s)]))}};return s}},P0={};fm(P0,{blur:()=>e$,clearContent:()=>t$,clearNodes:()=>n$,command:()=>o$,createParagraphNear:()=>r$,cut:()=>i$,deleteCurrentNode:()=>s$,deleteNode:()=>l$,deleteRange:()=>a$,deleteSelection:()=>c$,enter:()=>u$,exitCode:()=>d$,extendMarkRange:()=>f$,first:()=>p$,focus:()=>m$,forEach:()=>g$,insertContent:()=>y$,insertContentAt:()=>k$,joinBackward:()=>C$,joinDown:()=>x$,joinForward:()=>S$,joinItemBackward:()=>E$,joinItemForward:()=>M$,joinTextblockBackward:()=>T$,joinTextblockForward:()=>N$,joinUp:()=>w$,keyboardShortcut:()=>O$,lift:()=>$$,liftEmptyBlock:()=>B$,liftListItem:()=>R$,newlineInCode:()=>_$,resetAttributes:()=>D$,scrollIntoView:()=>I$,selectAll:()=>L$,selectNodeBackward:()=>P$,selectNodeForward:()=>V$,selectParentNode:()=>z$,selectTextblockEnd:()=>F$,selectTextblockStart:()=>H$,setContent:()=>j$,setMark:()=>oB,setMeta:()=>rB,setNode:()=>iB,setNodeSelection:()=>sB,setTextDirection:()=>lB,setTextSelection:()=>aB,sinkListItem:()=>cB,splitBlock:()=>uB,splitListItem:()=>dB,toggleList:()=>fB,toggleMark:()=>pB,toggleNode:()=>hB,toggleWrap:()=>mB,undoInputRule:()=>gB,unsetAllMarks:()=>yB,unsetMark:()=>bB,unsetTextDirection:()=>vB,updateAttributes:()=>kB,wrapIn:()=>wB,wrapInList:()=>xB});var e$=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),t$=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),n$=()=>({state:n,tr:e,dispatch:t})=>{const{selection:o}=e,{ranges:r}=o;return t&&r.forEach(({$from:i,$to:s})=>{n.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:u,mapping:d}=e,f=u.resolve(d.map(a)),p=u.resolve(d.map(a+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=Bs(h);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},o$=n=>e=>n(e),r$=()=>({state:n,dispatch:e})=>Zw(n,e),i$=(n,e)=>({editor:t,tr:o})=>{const{state:r}=t,i=r.doc.slice(n.from,n.to);o.deleteRange(n.from,n.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new q(o.doc.resolve(Math.max(s-1,0)))),!0},s$=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,o=t.$anchor.node();if(o.content.size>0)return!1;const r=n.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const l=r.before(i),a=r.after(i);n.delete(l,a).scrollIntoView()}return!0}return!1};function ht(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var l$=n=>({tr:e,state:t,dispatch:o})=>{const r=ht(n,t.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const a=i.before(s),u=i.after(s);e.delete(a,u).scrollIntoView()}return!0}return!1},a$=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},c$=()=>({state:n,dispatch:e})=>Yh(n,e),u$=()=>({commands:n})=>n.keyboardShortcut("Enter"),d$=()=>({state:n,dispatch:e})=>JN(n,e);function pm(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Uc(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:pm(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function V0(n,e,t={}){return n.find(o=>o.type===e&&Uc(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function pb(n,e,t={}){return!!V0(n,e,t)}function Rs(n,e,t){var o;if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(d=>d.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(d=>d.type===e)||(t=t||((o=r.node.marks[0])==null?void 0:o.attrs),!V0([...r.node.marks],e,t)))return;let s=r.index,l=n.start()+r.offset,a=s+1,u=l+r.node.nodeSize;for(;s>0&&pb([...n.parent.child(s-1).marks],e,t);)s-=1,l-=n.parent.child(s).nodeSize;for(;a<n.parent.childCount&&pb([...n.parent.child(a).marks],e,t);)u+=n.parent.child(a).nodeSize,a+=1;return{from:l,to:u}}function er(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var f$=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const i=er(n,o.schema),{doc:s,selection:l}=t,{$from:a,from:u,to:d}=l;if(r){const f=Rs(a,i,e);if(f&&f.from<=u&&f.to>=d){const p=q.create(s,f.from,f.to);t.setSelection(p)}}return!0},p$=n=>e=>{const t=typeof n=="function"?n(e):n;for(let o=0;o<t.length;o+=1)if(t[o](e))return!0;return!1};function ud(n){return n instanceof q}function qo(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function z0(n,e=null){if(!e)return null;const t=se.atStart(n),o=se.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return o;const r=t.from,i=o.to;return e==="all"?q.create(n,qo(0,r,i),qo(n.content.size,r,i)):q.create(n,qo(e,r,i),qo(e,r,i))}function Tp(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function Il(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function h$(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var m$=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(Il()||Tp())&&o.dom.focus(),h$()&&!Il()&&!Tp()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(o.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(o.hasFocus()&&n===null||n===!1)return!0;if(i&&n===null&&!ud(t.state.selection))return s(),!0;const l=z0(r.doc,n)||t.state.selection,a=t.state.selection.eq(l);return i&&(a||r.setSelection(l),a&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},g$=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),y$=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),F0=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const o=e[t];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?n.removeChild(o):o.nodeType===1&&F0(o)}return n};function Xs(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return F0(t)}function Ll(n,e,t){if(n instanceof _n||n instanceof D)return n;t={slice:!0,parseOptions:{},...t};const o=typeof n=="object"&&n!==null,r=typeof n=="string";if(o)try{if(Array.isArray(n)&&n.length>0)return D.fromArray(n.map(l=>e.nodeFromJSON(l)));const s=e.nodeFromJSON(n);return t.errorOnInvalidContent&&s.check(),s}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),Ll("",e,t)}if(r){if(t.errorOnInvalidContent){let s=!1,l="";const a=new Mw({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(s=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?ts.fromSchema(a).parseSlice(Xs(n),t.parseOptions):ts.fromSchema(a).parse(Xs(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=ts.fromSchema(e);return t.slice?i.parseSlice(Xs(n),t.parseOptions).content:i.parse(Xs(n),t.parseOptions)}return Ll("",e,t)}function b$(n,e,t){const o=n.steps.length-1;if(o<e)return;const r=n.steps[o];if(!(r instanceof kt||r instanceof Ct))return;const i=n.mapping.maps[o];let s=0;i.forEach((l,a,u,d)=>{s===0&&(s=d)}),n.setSelection(se.near(n.doc.resolve(s),t))}var v$=n=>!("type"in n),k$=(n,e,t)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const a=y=>{i.emit("contentError",{editor:i,error:y,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{Ll(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(y){a(y)}try{l=Ll(e,i.schema,{parseOptions:u,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(y){return a(y),!1}let{from:d,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((v$(l)?l:[l]).forEach(y=>{y.check(),p=p?y.isText&&y.marks.length===0:!1,h=h?y.isBlock:!1}),d===f&&h){const{parent:y}=o.doc.resolve(d);y.isTextblock&&!y.type.spec.code&&!y.childCount&&(d-=1,f+=1)}let g;if(p){if(Array.isArray(e))g=e.map(y=>y.text||"").join("");else if(e instanceof D){let y="";e.forEach(b=>{b.text&&(y+=b.text)}),g=y}else typeof e=="object"&&e&&e.text?g=e.text:g=e;o.insertText(g,d,f)}else{g=l;const y=o.doc.resolve(d),b=y.node(),v=y.parentOffset===0,w=b.isText||b.isTextblock,k=b.content.size>0;v&&w&&k&&(d=Math.max(0,d-1)),o.replaceWith(d,f,g)}t.updateSelection&&b$(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:d,text:g}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:d,text:g})}return!0},w$=()=>({state:n,dispatch:e})=>WN(n,e),x$=()=>({state:n,dispatch:e})=>qN(n,e),C$=()=>({state:n,dispatch:e})=>qw(n,e),S$=()=>({state:n,dispatch:e})=>Xw(n,e),E$=()=>({state:n,dispatch:e,tr:t})=>{try{const o=nd(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},M$=()=>({state:n,dispatch:e,tr:t})=>{try{const o=nd(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},T$=()=>({state:n,dispatch:e})=>jN(n,e),N$=()=>({state:n,dispatch:e})=>UN(n,e);function H0(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function A$(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Il()||H0()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return o&&(t=`Alt-${t}`),r&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var O$=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=A$(n).split(/-(?!$)/),s=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,l))});return a==null||a.steps.forEach(u=>{const d=u.map(o.mapping);d&&r&&o.maybeStep(d)}),!0};function Rr(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,s=e?ht(e,n.schema):null,l=[];n.doc.nodesBetween(o,r,(f,p)=>{if(f.isText)return;const h=Math.max(o,p),m=Math.min(r,p+f.nodeSize);l.push({node:f,from:h,to:m})});const a=r-o,u=l.filter(f=>s?s.name===f.node.type.name:!0).filter(f=>Uc(f.node.attrs,t,{strict:!1}));return i?!!u.length:u.reduce((f,p)=>f+p.to-p.from,0)>=a}var $$=(n,e={})=>({state:t,dispatch:o})=>{const r=ht(n,t.schema);return Rr(t,r,e)?KN(t,o):!1},B$=()=>({state:n,dispatch:e})=>e0(n,e),R$=n=>({state:e,dispatch:t})=>{const o=ht(n,e.schema);return iA(o)(e,t)},_$=()=>({state:n,dispatch:e})=>Qw(n,e);function dd(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function hb(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((o,r)=>(t.includes(r)||(o[r]=n[r]),o),{})}var D$=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=dd(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=ht(n,o.schema)),l==="mark"&&(s=er(n,o.schema));let a=!1;return t.selection.ranges.forEach(u=>{o.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,f)=>{i&&i===d.type&&(a=!0,r&&t.setNodeMarkup(f,void 0,hb(d.attrs,e))),s&&d.marks.length&&d.marks.forEach(p=>{s===p.type&&(a=!0,r&&t.addMark(f,f+d.nodeSize,s.create(hb(p.attrs,e))))})})}),a},I$=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),L$=()=>({tr:n,dispatch:e})=>{if(e){const t=new on(n.doc);n.setSelection(t)}return!0},P$=()=>({state:n,dispatch:e})=>Jw(n,e),V$=()=>({state:n,dispatch:e})=>Yw(n,e),z$=()=>({state:n,dispatch:e})=>YN(n,e),F$=()=>({state:n,dispatch:e})=>eA(n,e),H$=()=>({state:n,dispatch:e})=>ZN(n,e);function Np(n,e,t={},o={}){return Ll(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var j$=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{const{doc:a}=i;if(o.preserveWhitespace!=="full"){const u=Np(n,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!t),!0}return s&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function j0(n,e){const t=er(e,n.schema),{from:o,to:r,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(o,r,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function hm(n,e){const t=new Gh(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function mm(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Ar(n,e){const t=[];return n.descendants((o,r)=>{e(o)&&t.push({node:o,pos:r})}),t}function U0(n,e,t){const o=[];return n.nodesBetween(e.from,e.to,(r,i)=>{t(r)&&o.push({node:r,pos:i})}),o}function gm(n,e){for(let t=n.depth;t>0;t-=1){const o=n.node(t);if(e(o))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:o}}}function $i(n){return e=>gm(e.$from,n)}function re(n,e,t){return n.config[e]===void 0&&n.parent?re(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?re(n.parent,e,t):null}):n.config[e]}function ym(n){return n.map(e=>{const t={name:e.name,options:e.options,storage:e.storage},o=re(e,"addExtensions",t);return o?[e,...ym(o())]:e}).flat(10)}function fd(n,e){const t=Oi.fromSchema(e).serializeFragment(n),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(t),r.innerHTML}function W0(n){return typeof n=="function"}function _e(n,e=void 0,...t){return W0(n)?e?n.bind(e)(...t):n(...t):n}function U$(n={}){return Object.keys(n).length===0&&n.constructor===Object}function hs(n){const e=n.filter(r=>r.type==="extension"),t=n.filter(r=>r.type==="node"),o=n.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:o}}function q0(n){const e=[],{nodeExtensions:t,markExtensions:o}=hs(n),r=[...t,...o],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage,extensions:r},a=re(s,"addGlobalAttributes",l);if(!a)return;a().forEach(d=>{d.types.forEach(f=>{Object.entries(d.attributes).forEach(([p,h])=>{e.push({type:f,name:p,attribute:{...i,...h}})})})})}),r.forEach(s=>{const l={name:s.name,options:s.options,storage:s.storage},a=re(s,"addAttributes",l);if(!a)return;const u=a();Object.entries(u).forEach(([d,f])=>{const p={...i,...f};typeof(p==null?void 0:p.default)=="function"&&(p.default=p.default()),p!=null&&p.isRequired&&(p==null?void 0:p.default)===void 0&&delete p.default,e.push({type:s.name,name:d,attribute:p})})}),e}function he(...n){return n.filter(e=>!!e).reduce((e,t)=>{const o={...e};return Object.entries(t).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const l=i?String(i).split(" "):[],a=o[r]?o[r].split(" "):[],u=l.filter(d=>!a.includes(d));o[r]=[...a,...u].join(" ")}else if(r==="style"){const l=i?i.split(";").map(d=>d.trim()).filter(Boolean):[],a=o[r]?o[r].split(";").map(d=>d.trim()).filter(Boolean):[],u=new Map;a.forEach(d=>{const[f,p]=d.split(":").map(h=>h.trim());u.set(f,p)}),l.forEach(d=>{const[f,p]=d.split(":").map(h=>h.trim());u.set(f,p)}),o[r]=Array.from(u.entries()).map(([d,f])=>`${d}: ${f}`).join("; ")}else o[r]=i}),o},{})}function Pl(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,o)=>he(t,o),{})}function W$(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function mb(n,e){return"style"in n?n:{...n,getAttrs:t=>{const o=n.getAttrs?n.getAttrs(t):n.attrs;if(o===!1)return!1;const r=e.reduce((i,s)=>{const l=s.attribute.parseHTML?s.attribute.parseHTML(t):W$(t.getAttribute(s.name));return l==null?i:{...i,[s.name]:l}},{});return{...o,...r}}}}function gb(n){return Object.fromEntries(Object.entries(n).filter(([e,t])=>e==="attrs"&&U$(t)?!1:t!=null))}function yb(n){var e,t;const o={};return!((e=n==null?void 0:n.attribute)!=null&&e.isRequired)&&"default"in((n==null?void 0:n.attribute)||{})&&(o.default=n.attribute.default),((t=n==null?void 0:n.attribute)==null?void 0:t.validate)!==void 0&&(o.validate=n.attribute.validate),[n.name,o]}function K0(n,e){var t;const o=q0(n),{nodeExtensions:r,markExtensions:i}=hs(n),s=(t=r.find(u=>re(u,"topNode")))==null?void 0:t.name,l=Object.fromEntries(r.map(u=>{const d=o.filter(b=>b.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},p=n.reduce((b,v)=>{const w=re(v,"extendNodeSchema",f);return{...b,...w?w(u):{}}},{}),h=gb({...p,content:_e(re(u,"content",f)),marks:_e(re(u,"marks",f)),group:_e(re(u,"group",f)),inline:_e(re(u,"inline",f)),atom:_e(re(u,"atom",f)),selectable:_e(re(u,"selectable",f)),draggable:_e(re(u,"draggable",f)),code:_e(re(u,"code",f)),whitespace:_e(re(u,"whitespace",f)),linebreakReplacement:_e(re(u,"linebreakReplacement",f)),defining:_e(re(u,"defining",f)),isolating:_e(re(u,"isolating",f)),attrs:Object.fromEntries(d.map(yb))}),m=_e(re(u,"parseHTML",f));m&&(h.parseDOM=m.map(b=>mb(b,d)));const g=re(u,"renderHTML",f);g&&(h.toDOM=b=>g({node:b,HTMLAttributes:Pl(b,d)}));const y=re(u,"renderText",f);return y&&(h.toText=y),[u.name,h]})),a=Object.fromEntries(i.map(u=>{const d=o.filter(y=>y.type===u.name),f={name:u.name,options:u.options,storage:u.storage,editor:e},p=n.reduce((y,b)=>{const v=re(b,"extendMarkSchema",f);return{...y,...v?v(u):{}}},{}),h=gb({...p,inclusive:_e(re(u,"inclusive",f)),excludes:_e(re(u,"excludes",f)),group:_e(re(u,"group",f)),spanning:_e(re(u,"spanning",f)),code:_e(re(u,"code",f)),attrs:Object.fromEntries(d.map(yb))}),m=_e(re(u,"parseHTML",f));m&&(h.parseDOM=m.map(y=>mb(y,d)));const g=re(u,"renderHTML",f);return g&&(h.toDOM=y=>g({mark:y,HTMLAttributes:Pl(y,d)})),[u.name,h]}));return new Mw({topNode:s,nodes:l,marks:a})}function q$(n){const e=n.filter((t,o)=>n.indexOf(t)!==o);return Array.from(new Set(e))}function Wc(n){return n.sort((t,o)=>{const r=re(t,"priority")||100,i=re(o,"priority")||100;return r>i?-1:r<i?1:0})}function bm(n){const e=Wc(ym(n)),t=q$(e.map(o=>o.name));return t.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${t.map(o=>`'${o}'`).join(", ")}]. This can lead to issues.`),e}function J0(n,e){const t=bm(n);return K0(t,e)}function K$(n,e){const t=J0(e),o=_n.fromJSON(t,n);return fd(o.content,t)}function G0(n,e){const t=J0(e),o=Xs(n);return ts.fromSchema(t).parse(o).toJSON()}function X0(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
|
|
14
|
+
|
|
15
|
+
`,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(o,r,(a,u,d,f)=>{var p;a.isBlock&&u>o&&(l+=i);const h=s==null?void 0:s[a.type.name];if(h)return d&&(l+=h({node:a,pos:u,parent:d,index:f,range:e})),!1;a.isText&&(l+=(p=a==null?void 0:a.text)==null?void 0:p.slice(Math.max(o,u)-u,r-u))}),l}function Y0(n,e){const t={from:0,to:n.content.size};return X0(n,t,e)}function vm(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function J$(n,e){const t=ht(e,n.schema),{from:o,to:r}=n.selection,i=[];n.doc.nodesBetween(o,r,l=>{i.push(l)});const s=i.reverse().find(l=>l.type.name===t.name);return s?{...s.attrs}:{}}function Q0(n,e){const t=dd(typeof e=="string"?e:e.name,n.schema);return t==="node"?J$(n,e):t==="mark"?j0(n,e):{}}function G$(n,e=JSON.stringify){const t={};return n.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(t,r)?!1:t[r]=!0})}function X$(n){const e=G$(n);return e.length===1?e:e.filter((t,o)=>!e.filter((i,s)=>s!==o).some(i=>t.oldRange.from>=i.oldRange.from&&t.oldRange.to<=i.oldRange.to&&t.newRange.from>=i.newRange.from&&t.newRange.to<=i.newRange.to))}function km(n){const{mapping:e,steps:t}=n,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=t[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const u=e.slice(i).map(l,-1),d=e.slice(i).map(a),f=e.invert().map(u,-1),p=e.invert().map(d);o.push({oldRange:{from:f,to:p},newRange:{from:u,to:d}})})}),X$(o)}function wm(n,e,t){const o=[];return n===e?t.resolve(n).marks().forEach(r=>{const i=t.resolve(n),s=Rs(i,r.type);s&&o.push({mark:r,...s})}):t.nodesBetween(n,e,(r,i)=>{!r||(r==null?void 0:r.nodeSize)===void 0||o.push(...r.marks.map(s=>({from:i,to:i+r.nodeSize,mark:s})))}),o}var Y$=(n,e,t,o=20)=>{const r=n.doc.resolve(t);let i=o,s=null;for(;i>0&&s===null;){const l=r.node(i);(l==null?void 0:l.type.name)===e?s=l:i-=1}return[s,i]};function _a(n,e){return e.nodes[n]||e.marks[n]||null}function fc(n,e,t){return Object.fromEntries(Object.entries(t).filter(([o])=>{const r=n.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}var Q$=(n,e=500)=>{let t="";const o=n.parentOffset;return n.parent.nodesBetween(Math.max(0,o-e),o,(r,i,s,l)=>{var a,u;const d=((u=(a=r.type.spec).toText)==null?void 0:u.call(a,{node:r,pos:i,parent:s,index:l}))||r.textContent||"%leaf%";t+=r.isAtom&&!r.isText?d:d.slice(0,Math.max(0,o-i))}),t};function Ap(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?er(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(f=>i?i.name===f.type.name:!0).find(f=>Uc(f.attrs,t,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:f,$to:p})=>{const h=f.pos,m=p.pos;n.doc.nodesBetween(h,m,(g,y)=>{if(!g.isText&&!g.marks.length)return;const b=Math.max(h,y),v=Math.min(m,y+g.nodeSize),w=v-b;s+=w,l.push(...g.marks.map(k=>({mark:k,from:b,to:v})))})}),s===0)return!1;const a=l.filter(f=>i?i.name===f.mark.type.name:!0).filter(f=>Uc(f.mark.attrs,t,{strict:!1})).reduce((f,p)=>f+p.to-p.from,0),u=l.filter(f=>i?f.mark.type!==i&&f.mark.type.excludes(i):!0).reduce((f,p)=>f+p.to-p.from,0);return(a>0?a+u:a)>=s}function Z0(n,e,t={}){if(!e)return Rr(n,null,t)||Ap(n,null,t);const o=dd(e,n.schema);return o==="node"?Rr(n,e,t):o==="mark"?Ap(n,e,t):!1}var Z$=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=$i(l=>l.type.name===e)(n.selection);if(!i)return!1;const s=n.doc.resolve(i.pos+1);return r.pos+1===s.end()}return!(o.parentOffset<o.parent.nodeSize-2||t.pos!==o.pos)},eB=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function bb(n,e){return Array.isArray(e)?e.some(t=>(typeof t=="string"?t:t.name)===n.name):e}function vb(n,e){const{nodeExtensions:t}=hs(e),o=t.find(s=>s.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=_e(re(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function pd(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var o;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((o=n.text)!=null?o:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let r=!0;return n.content.forEach(i=>{r!==!1&&(pd(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}function ex(n){return n instanceof Q}var xm=class tx{constructor(e){this.position=e}static fromJSON(e){return new tx(e.position)}toJSON(){return{position:this.position}}};function nx(n,e){const t=e.mapping.mapResult(n.position);return{position:new xm(t.pos),mapResult:t}}function tB(n){return new xm(n)}function ox(n,e,t){const r=n.state.doc.content.size,i=qo(e,0,r),s=qo(t,0,r),l=n.coordsAtPos(i),a=n.coordsAtPos(s,-1),u=Math.min(l.top,a.top),d=Math.max(l.bottom,a.bottom),f=Math.min(l.left,a.left),p=Math.max(l.right,a.right),h=p-f,m=d-u,b={top:u,bottom:d,left:f,right:p,width:h,height:m,x:f,y:u};return{...b,toJSON:()=>b}}function nB(n,e,t){var o;const{selection:r}=e;let i=null;if(ud(r)&&(i=r.$cursor),i){const l=(o=n.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(u=>u.type.excludes(t)))}const{ranges:s}=r;return s.some(({$from:l,$to:a})=>{let u=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(d,f,p)=>{if(u)return!1;if(d.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(t));u=h&&m}return!u}),u})}var oB=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:s,ranges:l}=i,a=er(n,o.schema);if(r)if(s){const u=j0(o,a);t.addStoredMark(a.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;o.doc.nodesBetween(d,f,(p,h)=>{const m=Math.max(h,d),g=Math.min(h+p.nodeSize,f);p.marks.find(b=>b.type===a)?p.marks.forEach(b=>{a===b.type&&t.addMark(m,g,a.create({...b.attrs,...e}))}):t.addMark(m,g,a.create(e))})});return nB(o,t,a)},rB=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),iB=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=ht(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>Ry(i,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Ry(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},sB=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,r=qo(n,0,o.content.size),i=Q.create(o,r);e.setSelection(i)}return!0},lB=(n,e)=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=o;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&t.doc.nodesBetween(s,l,(a,u)=>{a.isText||t.setNodeMarkup(u,void 0,{...a.attrs,dir:n})}),!0},aB=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,{from:r,to:i}=typeof n=="number"?{from:n,to:n}:n,s=q.atStart(o).from,l=q.atEnd(o).to,a=qo(r,s,l),u=qo(i,s,l),d=q.create(o,a,u);e.setSelection(d)}return!0},cB=n=>({state:e,dispatch:t})=>{const o=ht(n,e.schema);return aA(o)(e,t)};function kb(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const o=t.filter(r=>e==null?void 0:e.includes(r.type.name));n.tr.ensureMarks(o)}}var uB=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,u=r.extensionManager.attributes,d=fc(u,l.node().type.name,l.node().attrs);if(i instanceof Q&&i.node.isBlock)return!l.parentOffset||!Jo(s,l.pos)?!1:(o&&(n&&kb(t,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=a.parentOffset===a.parent.content.size,p=l.depth===0?void 0:mm(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:d}]:void 0,m=Jo(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&Jo(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:d}]:void 0),o){if(m&&(i instanceof q&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}n&&kb(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},dB=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var s;const l=ht(n,o.schema),{$from:a,$to:u}=o.selection,d=o.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(u))return!1;const f=a.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let b=D.empty;const v=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-v;M>=a.depth-3;M-=1)b=D.from(a.node(M).copy(b));const w=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k={...fc(p,a.node().type.name,a.node().attrs),...e},x=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(k))||void 0;b=b.append(D.from(l.createAndFill(null,x)||void 0));const C=a.before(a.depth-(v-1));t.replace(C,a.after(-w),new H(b,4-v,0));let S=-1;t.doc.nodesBetween(C,t.doc.content.size,(M,N)=>{if(S>-1)return!1;M.isTextblock&&M.content.size===0&&(S=N+1)}),S>-1&&t.setSelection(q.near(t.doc.resolve(S))),t.scrollIntoView()}return!0}const h=u.pos===a.end()?f.contentMatchAt(0).defaultType:null,m={...fc(p,f.type.name,f.attrs),...e},g={...fc(p,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,u.pos);const y=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!Jo(t.doc,a.pos,2))return!1;if(r){const{selection:b,storedMarks:v}=o,{splittableMarks:w}=i.extensionManager,k=v||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!k||!r)return!0;const x=k.filter(C=>w.includes(C.type.name));t.ensureMarks(x)}return!0},wf=(n,e)=>{const t=$i(s=>s.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===(r==null?void 0:r.type)&&Lr(n.doc,t.pos)&&n.join(t.pos),!0},xf=(n,e)=>{const t=$i(s=>s.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(t.start).after(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===(r==null?void 0:r.type)&&Lr(n.doc,o)&&n.join(o),!0},fB=(n,e,t,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:a,commands:u,can:d})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=ht(n,s.schema),m=ht(e,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:v}=g,w=b.blockRange(v),k=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const x=$i(C=>vb(C.type.name,f))(g);if(w.depth>=1&&x&&w.depth-x.depth<=1){if(x.node.type===h)return u.liftListItem(m);if(vb(x.node.type.name,f)&&h.validContent(x.node.content)&&l)return a().command(()=>(i.setNodeMarkup(x.pos,h),!0)).command(()=>wf(i,h)).command(()=>xf(i,h)).run()}return!t||!k||!l?a().command(()=>d().wrapInList(h,o)?!0:u.clearNodes()).wrapInList(h,o).command(()=>wf(i,h)).command(()=>xf(i,h)).run():a().command(()=>{const C=d().wrapInList(h,o),S=k.filter(M=>p.includes(M.type.name));return i.ensureMarks(S),C?!0:u.clearNodes()}).wrapInList(h,o).command(()=>wf(i,h)).command(()=>xf(i,h)).run()},pB=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,s=er(n,o.schema);return Ap(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},hB=(n,e,t={})=>({state:o,commands:r})=>{const i=ht(n,o.schema),s=ht(e,o.schema),l=Rr(o,i,t);let a;return o.selection.$anchor.sameParent(o.selection.$head)&&(a=o.selection.$anchor.parent.attrs),l?r.setNode(s,a):r.setNode(i,{...a,...t})},mB=(n,e={})=>({state:t,commands:o})=>{const r=ht(n,t.schema);return Rr(t,r,e)?o.lift(r):o.wrapIn(r,e)},gB=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let o=0;o<t.length;o+=1){const r=t[o];let i;if(r.spec.isInputRules&&(i=r.getState(n))){if(e){const s=n.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},yB=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:o,ranges:r}=t;return o||e&&r.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},bB=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=er(n,o.schema),{$from:u,empty:d,ranges:f}=l;if(!r)return!0;if(d&&s){let{from:p,to:h}=l;const m=(i=u.marks().find(y=>y.type===a))==null?void 0:i.attrs,g=Rs(u,a,m);g&&(p=g.from,h=g.to),t.removeMark(p,h,a)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,a)});return t.removeStoredMark(a),!0},vB=n=>({tr:e,state:t,dispatch:o})=>{const{selection:r}=t;let i,s;return typeof n=="number"?(i=n,s=n):n&&"from"in n&&"to"in n?(i=n.from,s=n.to):(i=r.from,s=r.to),o&&e.doc.nodesBetween(i,s,(l,a)=>{if(l.isText)return;const u={...l.attrs};delete u.dir,e.setNodeMarkup(a,void 0,u)}),!0},kB=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=dd(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=ht(n,o.schema)),l==="mark"&&(s=er(n,o.schema));let a=!1;return t.selection.ranges.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;let p,h,m,g;t.selection.empty?o.doc.nodesBetween(d,f,(y,b)=>{i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,f),p=b,h=y)}):o.doc.nodesBetween(d,f,(y,b)=>{b<d&&i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,f),p=b,h=y),b>=d&&b<=f&&(i&&i===y.type&&(a=!0,r&&t.setNodeMarkup(b,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(v=>{if(s===v.type&&(a=!0,r)){const w=Math.max(b,d),k=Math.min(b+y.nodeSize,f);t.addMark(w,k,s.create({...v.attrs,...e}))}}))}),h&&(p!==void 0&&r&&t.setNodeMarkup(p,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(y=>{s===y.type&&r&&t.addMark(m,g,s.create({...y.attrs,...e}))}))}),a},wB=(n,e={})=>({state:t,dispatch:o})=>{const r=ht(n,t.schema);return tA(r,e)(t,o)},xB=(n,e={})=>({state:t,dispatch:o})=>{const r=ht(n,t.schema);return nA(r,e)(t,o)},CB=class{constructor(){this.callbacks={}}on(n,e){return this.callbacks[n]||(this.callbacks[n]=[]),this.callbacks[n].push(e),this}emit(n,...e){const t=this.callbacks[n];return t&&t.forEach(o=>o.apply(this,e)),this}off(n,e){const t=this.callbacks[n];return t&&(e?this.callbacks[n]=t.filter(o=>o!==e):delete this.callbacks[n]),this}once(n,e){const t=(...o)=>{this.off(n,t),e.apply(this,o)};return this.on(n,t)}removeAllListeners(){this.callbacks={}}},Vr=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}},SB=(n,e)=>{if(pm(e))return e.exec(n);const t=e(n);if(!t)return null;const o=[t.text];return o.index=t.index,o.input=n,o.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(t.replaceWith)),o};function Da(n){var e;const{editor:t,from:o,to:r,text:i,rules:s,plugin:l}=n,{view:a}=t;if(a.composing)return!1;const u=a.state.doc.resolve(o);if(u.parent.type.spec.code||(e=u.nodeBefore||u.nodeAfter)!=null&&e.marks.find(p=>p.type.spec.code))return!1;let d=!1;const f=Q$(u)+i;return s.forEach(p=>{if(d)return;const h=SB(f,p.find);if(!h)return;const m=a.state.tr,g=ad({state:a.state,transaction:m}),y={from:o-(h[0].length-i.length),to:r},{commands:b,chain:v,can:w}=new cd({editor:t,state:g});p.handler({state:g,range:y,match:h,commands:b,chain:v,can:w})===null||!m.steps.length||(p.undoable&&m.setMeta(l,{transform:m,from:o,to:r,text:i}),a.dispatch(m),d=!0)}),d}function EB(n){const{editor:e,rules:t}=n,o=new ue({state:{init(){return null},apply(r,i,s){const l=r.getMeta(o);if(l)return l;const a=r.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:d}=a;typeof d=="string"?d=d:d=fd(D.from(d),s.schema);const{from:f}=a,p=f+d.length;Da({editor:e,from:f,to:p,text:d,rules:t,plugin:o})}),r.selectionSet||r.docChanged?null:i}},props:{handleTextInput(r,i,s,l){return Da({editor:e,from:i,to:s,text:l,rules:t,plugin:o})},handleDOMEvents:{compositionend:r=>(setTimeout(()=>{const{$cursor:i}=r.state.selection;i&&Da({editor:e,from:i.pos,to:i.pos,text:"",rules:t,plugin:o})}),!1)},handleKeyDown(r,i){if(i.key!=="Enter")return!1;const{$cursor:s}=r.state.selection;return s?Da({editor:e,from:s.pos,to:s.pos,text:`
|
|
16
|
+
`,rules:t,plugin:o}):!1}},isInputRules:!0});return o}function MB(n){return Object.prototype.toString.call(n).slice(8,-1)}function Ia(n){return MB(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function rx(n,e){const t={...n};return Ia(n)&&Ia(e)&&Object.keys(e).forEach(o=>{Ia(e[o])&&Ia(n[o])?t[o]=rx(n[o],e[o]):t[o]=e[o]}),t}var Cm=class{constructor(n={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...n},this.name=this.config.name}get options(){return{..._e(re(this,"addOptions",{name:this.name}))||{}}}get storage(){return{..._e(re(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(n={}){const e=this.extend({...this.config,addOptions:()=>rx(this.options,n)});return e.name=this.name,e.parent=this.parent,e}extend(n={}){const e=new this.constructor({...this.config,...n});return e.parent=this,this.child=e,e.name="name"in n?n.name:e.parent.name,e}},eo=class ix extends Cm{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new ix(t)}static handleExit({editor:e,mark:t}){const{tr:o}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const s=r.marks();if(!!!s.find(u=>(u==null?void 0:u.type.name)===t.name))return!1;const a=s.find(u=>(u==null?void 0:u.type.name)===t.name);return a&&o.removeStoredMark(a),o.insertText(" ",r.pos),e.view.dispatch(o),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function TB(n){return typeof n=="number"}var NB=class{constructor(n){this.find=n.find,this.handler=n.handler}},AB=(n,e,t)=>{if(pm(e))return[...n.matchAll(e)];const o=e(n,t);return o?o.map(r=>{const i=[r.text];return i.index=r.index,i.input=n,i.data=r.data,r.replaceWith&&(r.text.includes(r.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),i.push(r.replaceWith)),i}):[]};function OB(n){const{editor:e,state:t,from:o,to:r,rule:i,pasteEvent:s,dropEvent:l}=n,{commands:a,chain:u,can:d}=new cd({editor:e,state:t}),f=[];return t.doc.nodesBetween(o,r,(h,m)=>{var g,y,b,v,w;if((y=(g=h.type)==null?void 0:g.spec)!=null&&y.code||!(h.isText||h.isTextblock||h.isInline))return;const k=(w=(v=(b=h.content)==null?void 0:b.size)!=null?v:h.nodeSize)!=null?w:0,x=Math.max(o,m),C=Math.min(r,m+k);if(x>=C)return;const S=h.isText?h.text||"":h.textBetween(x-m,C-m,void 0,"");AB(S,i.find,s).forEach(N=>{if(N.index===void 0)return;const A=x+N.index+1,$=A+N[0].length,O={from:t.tr.mapping.map(A),to:t.tr.mapping.map($)},R=i.handler({state:t,range:O,match:N,commands:a,chain:u,can:d,pasteEvent:s,dropEvent:l});f.push(R)})}),f.every(h=>h!==null)}var La=null,$B=n=>{var e;const t=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(e=t.clipboardData)==null||e.setData("text/html",n),t};function BB(n){const{editor:e,rules:t}=n;let o=null,r=!1,i=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,l;try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}const a=({state:d,from:f,to:p,rule:h,pasteEvt:m})=>{const g=d.tr,y=ad({state:d,transaction:g});if(!(!OB({editor:e,state:y,from:Math.max(f-1,0),to:p.b-1,rule:h,pasteEvent:m,dropEvent:l})||!g.steps.length)){try{l=typeof DragEvent<"u"?new DragEvent("drop"):null}catch{l=null}return s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,g}};return t.map(d=>new ue({view(f){const p=m=>{var g;o=(g=f.dom.parentElement)!=null&&g.contains(m.target)?f.dom.parentElement:null,o&&(La=e)},h=()=>{La&&(La=null)};return window.addEventListener("dragstart",p),window.addEventListener("dragend",h),{destroy(){window.removeEventListener("dragstart",p),window.removeEventListener("dragend",h)}}},props:{handleDOMEvents:{drop:(f,p)=>{if(i=o===f.dom.parentElement,l=p,!i){const h=La;h!=null&&h.isEditable&&setTimeout(()=>{const m=h.state.selection;m&&h.commands.deleteRange({from:m.from,to:m.to})},10)}return!1},paste:(f,p)=>{var h;const m=(h=p.clipboardData)==null?void 0:h.getData("text/html");return s=p,r=!!(m!=null&&m.includes("data-pm-slice")),!1}}},appendTransaction:(f,p,h)=>{const m=f[0],g=m.getMeta("uiEvent")==="paste"&&!r,y=m.getMeta("uiEvent")==="drop"&&!i,b=m.getMeta("applyPasteRules"),v=!!b;if(!g&&!y&&!v)return;if(v){let{text:x}=b;typeof x=="string"?x=x:x=fd(D.from(x),h.schema);const{from:C}=b,S=C+x.length,M=$B(x);return a({rule:d,state:h,from:C,to:{b:S},pasteEvt:M})}const w=p.doc.content.findDiffStart(h.doc.content),k=p.doc.content.findDiffEnd(h.doc.content);if(!(!TB(w)||!k||w===k.b))return a({rule:d,state:h,from:w,to:k,pasteEvt:s})}}))}var hd=class{constructor(n,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=n,this.extensions=bm(n),this.schema=K0(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((n,e)=>{const t={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_a(e.name,this.schema)},o=re(e,"addCommands",t);return o?{...n,...o()}:n},{})}get plugins(){const{editor:n}=this;return Wc([...this.extensions].reverse()).flatMap(o=>{const r={name:o.name,options:o.options,storage:this.editor.extensionStorage[o.name],editor:n,type:_a(o.name,this.schema)},i=[],s=re(o,"addKeyboardShortcuts",r);let l={};if(o.type==="mark"&&re(o,"exitable",r)&&(l.ArrowRight=()=>eo.handleExit({editor:n,mark:o})),s){const p=Object.fromEntries(Object.entries(s()).map(([h,m])=>[h,()=>m({editor:n})]));l={...l,...p}}const a=QO(l);i.push(a);const u=re(o,"addInputRules",r);if(bb(o,n.options.enableInputRules)&&u){const p=u();if(p&&p.length){const h=EB({editor:n,rules:p}),m=Array.isArray(h)?h:[h];i.push(...m)}}const d=re(o,"addPasteRules",r);if(bb(o,n.options.enablePasteRules)&&d){const p=d();if(p&&p.length){const h=BB({editor:n,rules:p});i.push(...h)}}const f=re(o,"addProseMirrorPlugins",r);if(f){const p=f();i.push(...p)}return i})}get attributes(){return q0(this.extensions)}get nodeViews(){const{editor:n}=this,{nodeExtensions:e}=hs(this.extensions);return Object.fromEntries(e.filter(t=>!!re(t,"addNodeView")).map(t=>{const o=this.attributes.filter(a=>a.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:ht(t.name,this.schema)},i=re(t,"addNodeView",r);if(!i)return[];const s=i();if(!s)return[];const l=(a,u,d,f,p)=>{const h=Pl(a,o);return s({node:a,view:u,getPos:d,decorations:f,innerDecorations:p,editor:n,extension:t,HTMLAttributes:h})};return[t.name,l]}))}dispatchTransaction(n){const{editor:e}=this;return Wc([...this.extensions].reverse()).reduceRight((o,r)=>{const i={name:r.name,options:r.options,storage:this.editor.extensionStorage[r.name],editor:e,type:_a(r.name,this.schema)},s=re(r,"dispatchTransaction",i);return s?l=>{s.call(i,{transaction:l,next:o})}:o},n)}get markViews(){const{editor:n}=this,{markExtensions:e}=hs(this.extensions);return Object.fromEntries(e.filter(t=>!!re(t,"addMarkView")).map(t=>{const o=this.attributes.filter(l=>l.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:n,type:er(t.name,this.schema)},i=re(t,"addMarkView",r);if(!i)return[];const s=(l,a,u)=>{const d=Pl(l,o);return i()({mark:l,view:a,inline:u,editor:n,extension:t,HTMLAttributes:d,updateAttributes:f=>{jB(l,n,f)}})};return[t.name,s]}))}setupExtensions(){const n=this.extensions;this.editor.extensionStorage=Object.fromEntries(n.map(e=>[e.name,e.storage])),n.forEach(e=>{var t;const o={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:_a(e.name,this.schema)};e.type==="mark"&&((t=_e(re(e,"keepOnSplit",o)))==null||t)&&this.splittableMarks.push(e.name);const r=re(e,"onBeforeCreate",o),i=re(e,"onCreate",o),s=re(e,"onUpdate",o),l=re(e,"onSelectionUpdate",o),a=re(e,"onTransaction",o),u=re(e,"onFocus",o),d=re(e,"onBlur",o),f=re(e,"onDestroy",o);r&&this.editor.on("beforeCreate",r),i&&this.editor.on("create",i),s&&this.editor.on("update",s),l&&this.editor.on("selectionUpdate",l),a&&this.editor.on("transaction",a),u&&this.editor.on("focus",u),d&&this.editor.on("blur",d),f&&this.editor.on("destroy",f)})}};hd.resolve=bm;hd.sort=Wc;hd.flatten=ym;var RB={};fm(RB,{ClipboardTextSerializer:()=>lx,Commands:()=>ax,Delete:()=>cx,Drop:()=>ux,Editable:()=>dx,FocusEvents:()=>px,Keymap:()=>hx,Paste:()=>mx,Tabindex:()=>gx,TextDirection:()=>yx,focusEventsPluginKey:()=>fx});var ve=class sx extends Cm{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new sx(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},lx=ve.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ue({key:new ce("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(d=>d.$from.pos)),l=Math.max(...i.map(d=>d.$to.pos)),a=vm(t);return X0(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),ax=ve.create({name:"commands",addCommands(){return{...P0}}}),cx=ve.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,r;const i=()=>{var s,l,a,u;if((u=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,n))!=null?u:n.getMeta("y-sync$"))return;const d=hm(n.before,[n,...e]);km(d).forEach(h=>{d.mapping.mapResult(h.oldRange.from).deletedAfter&&d.mapping.mapResult(h.oldRange.to).deletedBefore&&d.before.nodesBetween(h.oldRange.from,h.oldRange.to,(m,g)=>{const y=g+m.nodeSize-2,b=h.oldRange.from<=g&&y<=h.oldRange.to;this.editor.emit("delete",{type:"node",node:m,from:g,to:y,newFrom:d.mapping.map(g),newTo:d.mapping.map(y),deletedRange:h.oldRange,newRange:h.newRange,partial:!b,editor:this.editor,transaction:n,combinedTransform:d})})});const p=d.mapping;d.steps.forEach((h,m)=>{var g,y;if(h instanceof qn){const b=p.slice(m).map(h.from,-1),v=p.slice(m).map(h.to),w=p.invert().map(b,-1),k=p.invert().map(v),x=(g=d.doc.nodeAt(b-1))==null?void 0:g.marks.some(S=>S.eq(h.mark)),C=(y=d.doc.nodeAt(v))==null?void 0:y.marks.some(S=>S.eq(h.mark));this.editor.emit("delete",{type:"mark",mark:h.mark,from:h.from,to:h.to,deletedRange:{from:w,to:k},newRange:{from:b,to:v},partial:!!(C||x),editor:this.editor,transaction:n,combinedTransform:d})}})};(r=(o=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),ux=ve.create({name:"drop",addProseMirrorPlugins(){return[new ue({key:new ce("tiptapDrop"),props:{handleDrop:(n,e,t,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:o})}}})]}}),dx=ve.create({name:"editable",addProseMirrorPlugins(){return[new ue({key:new ce("editable"),props:{editable:()=>this.editor.options.editable}})]}}),fx=new ce("focusEvents"),px=ve.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ue({key:fx,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const o=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,t)=>{n.isFocused=!1;const o=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),hx=ve.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:l})=>{const{selection:a,doc:u}=l,{empty:d,$anchor:f}=a,{pos:p,parent:h}=f,m=f.parent.isTextblock&&p>0?l.doc.resolve(p-1):f,g=m.parent.type.spec.isolating,y=f.pos-f.parentOffset,b=g&&m.parent.childCount===1?y===f.pos:se.atStart(u).from===p;return!d||!h.type.isTextblock||h.textContent.length||!b||b&&f.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),o={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...o},i={...o,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Il()||H0()?i:r},addProseMirrorPlugins(){return[new ue({key:new ce("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(g=>g.getMeta("composition")))return;const o=n.some(g=>g.docChanged)&&!e.doc.eq(t.doc),r=n.some(g=>g.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,a=se.atStart(e.doc).from,u=se.atEnd(e.doc).to;if(i||!(s===a&&l===u)||!pd(t.doc))return;const p=t.tr,h=ad({state:t,transaction:p}),{commands:m}=new cd({editor:this.editor,state:h});if(m.clearNodes(),!!p.steps.length)return p}})]}}),mx=ve.create({name:"paste",addProseMirrorPlugins(){return[new ue({key:new ce("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),gx=ve.create({name:"tabindex",addProseMirrorPlugins(){return[new ue({key:new ce("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),yx=ve.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=hs(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const 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 ue({key:new ce("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}}),_B=class Wi{constructor(e,t,o=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=o,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return(e=this.actualDepth)!=null?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,o=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,o=this.to-1}this.editor.commands.insertContentAt({from:t,to:o},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?0:1)}get parent(){if(this.depth===0)return null;const e=this.resolvedPos.start(this.resolvedPos.depth-1),t=this.resolvedPos.doc.resolve(e);return new Wi(t,this.editor)}get before(){let e=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.from-3)),new Wi(e,this.editor)}get after(){let e=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return e.depth!==this.depth&&(e=this.resolvedPos.doc.resolve(this.to+3)),new Wi(e,this.editor)}get children(){const e=[];return this.node.content.forEach((t,o)=>{const r=t.isBlock&&!t.isTextblock,i=t.isAtom&&!t.isText,s=this.pos+o+(i?0:1);if(s<0||s>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(s);if(!r&&l.depth<=this.depth)return;const a=new Wi(l,this.editor,r,r?t:null);r&&(a.actualDepth=this.depth+1),e.push(new Wi(l,this.editor,r,r?t:null))}),e}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let o=null,r=this.parent;for(;r&&!o;){if(r.node.type.name===e)if(Object.keys(t).length>0){const i=r.node.attrs,s=Object.keys(t);for(let l=0;l<s.length;l+=1){const a=s[l];if(i[a]!==t[a])break}}else o=r;r=r.parent}return o}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},o=!1){let r=[];if(!this.children||this.children.length===0)return r;const i=Object.keys(t);return this.children.forEach(s=>{o&&r.length>0||(s.node.type.name===e&&i.every(a=>t[a]===s.node.attrs[a])&&r.push(s),!(o&&r.length>0)&&(r=r.concat(s.querySelectorAll(e,t,o))))}),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}},DB=`.ProseMirror {
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.ProseMirror {
|
|
21
|
+
word-wrap: break-word;
|
|
22
|
+
white-space: pre-wrap;
|
|
23
|
+
white-space: break-spaces;
|
|
24
|
+
-webkit-font-variant-ligatures: none;
|
|
25
|
+
font-variant-ligatures: none;
|
|
26
|
+
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
.ProseMirror [contenteditable="false"] {
|
|
30
|
+
white-space: normal;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
|
|
34
|
+
white-space: pre-wrap;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.ProseMirror pre {
|
|
38
|
+
white-space: pre-wrap;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
img.ProseMirror-separator {
|
|
42
|
+
display: inline !important;
|
|
43
|
+
border: none !important;
|
|
44
|
+
margin: 0 !important;
|
|
45
|
+
width: 0 !important;
|
|
46
|
+
height: 0 !important;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.ProseMirror-gapcursor {
|
|
50
|
+
display: none;
|
|
51
|
+
pointer-events: none;
|
|
52
|
+
position: absolute;
|
|
53
|
+
margin: 0;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.ProseMirror-gapcursor:after {
|
|
57
|
+
content: "";
|
|
58
|
+
display: block;
|
|
59
|
+
position: absolute;
|
|
60
|
+
top: -2px;
|
|
61
|
+
width: 20px;
|
|
62
|
+
border-top: 1px solid black;
|
|
63
|
+
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
@keyframes ProseMirror-cursor-blink {
|
|
67
|
+
to {
|
|
68
|
+
visibility: hidden;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.ProseMirror-hideselection *::selection {
|
|
73
|
+
background: transparent;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.ProseMirror-hideselection *::-moz-selection {
|
|
77
|
+
background: transparent;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
.ProseMirror-hideselection * {
|
|
81
|
+
caret-color: transparent;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.ProseMirror-focused .ProseMirror-gapcursor {
|
|
85
|
+
display: block;
|
|
86
|
+
}`;function IB(n,e,t){const o=document.querySelector("style[data-tiptap-style]");if(o!==null)return o;const r=document.createElement("style");return e&&r.setAttribute("nonce",e),r.setAttribute("data-tiptap-style",""),r.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(r),r}var Jt=class extends CB{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),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:r})=>{throw r},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:nx,createMappablePosition:tB},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:r,slice:i,moved:s})=>this.options.onDrop(r,i,s)),this.on("paste",({event:r,slice:i})=>this.options.onPaste(r,i)),this.on("delete",this.options.onDelete);const t=this.createDoc(),o=z0(t,this.options.autofocus);this.editorState=es.create({doc:t,schema:this.schema,selection:o||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if(typeof document>"u")throw new 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){const e=this.editorView.dom;e!=null&&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.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&typeof document<"u"&&(this.css=IB(DB,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),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 new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const o=W0(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let o=t;if([].concat(e).forEach(i=>{const s=typeof i=="string"?`${i}$`:i.key;o=o.filter(l=>!l.key.startsWith(s))}),t.length===o.length)return;const r=this.state.reconfigure({plugins:o});return this.view.updateState(r),r}createExtensionManager(){var e,t;const r=[...this.options.enableCoreExtensions?[dx,lx.configure({blockSeparator:(t=(e=this.options.coreExtensionOptions)==null?void 0:e.clipboardTextSerializer)==null?void 0:t.blockSeparator}),ax,px,hx,gx,ux,mx,cx,yx.configure({direction:this.options.textDirection})].filter(i=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[i.name]!==!1:!0):[],...this.options.extensions].filter(i=>["extension","node","mark"].includes(i==null?void 0:i.type));this.extensionManager=new hd(r,this)}createCommandManager(){this.commandManager=new cd({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Np(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message))throw t;this.emit("contentError",{editor:this,error:t,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(o=>o.name!=="collaboration"),this.createExtensionManager()}}),e=Np(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:o}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),i=o?this.extensionManager.dispatchTransaction(r):r;this.editorView=new L0(e,{...t,attributes:{role:"textbox",...t==null?void 0:t.attributes},dispatchTransaction:i,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const s=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(s),this.prependClass(),this.injectCSS();const l=this.view.dom;l.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;const 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(d=>{var f;return(f=this.capturedTransaction)==null?void 0:f.step(d)});return}const{state:t,transactions:o}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),i=o.includes(e),s=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:o.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const l=o.findLast(d=>d.getMeta("focus")||d.getMeta("blur")),a=l==null?void 0:l.getMeta("focus"),u=l==null?void 0:l.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:l}),u&&this.emit("blur",{editor:this,event:u.event,transaction:l}),!(e.getMeta("preventUpdate")||!o.some(d=>d.docChanged)||s.doc.eq(t.doc))&&this.emit("update",{editor:this,transaction:e,appendedTransactions:o.slice(1)})}getAttributes(e){return Q0(this.state,e)}isActive(e,t){const o=typeof e=="string"?e:null,r=typeof e=="string"?t:e;return Z0(this.state,o,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return fd(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t=`
|
|
87
|
+
|
|
88
|
+
`,textSerializers:o={}}=e||{};return Y0(this.state.doc,{blockSeparator:t,textSerializers:{...vm(this.schema),...o}})}get isEmpty(){return pd(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return(t=(e=this.editorView)==null?void 0:e.isDestroyed)!=null?t:!0}$node(e,t){var o;return((o=this.$doc)==null?void 0:o.querySelector(e,t))||null}$nodes(e,t){var o;return((o=this.$doc)==null?void 0:o.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new _B(t,this)}get $doc(){return this.$pos(0)}};function bi(n){return new Vr({find:n.find,handler:({state:e,range:t,match:o})=>{const r=_e(n.getAttributes,void 0,o);if(r===!1||r===null)return null;const{tr:i}=e,s=o[o.length-1],l=o[0];if(s){const a=l.search(/\S/),u=t.from+l.indexOf(s),d=u+s.length;if(wm(t.from,t.to,e.doc).filter(h=>h.mark.type.excluded.find(g=>g===n.type&&g!==h.mark.type)).filter(h=>h.to>u).length)return null;d<t.to&&i.delete(d,t.to),u>t.from&&i.delete(t.from+a,u);const p=t.from+a+s.length;i.addMark(t.from+a,p,n.type.create(r||{})),i.removeStoredMark(n.type)}},undoable:n.undoable})}function md(n){return new Vr({find:n.find,handler:({state:e,range:t,match:o})=>{const r=_e(n.getAttributes,void 0,o)||{},{tr:i}=e,s=t.from;let l=t.to;const a=n.type.create(r);if(o[1]){const u=o[0].lastIndexOf(o[1]);let d=s+u;d>l?d=l:l=d+o[1].length;const f=o[0][o[0].length-1];i.insertText(f,s+o[0].length-1),i.replaceWith(d,l,a)}else if(o[0]){const u=n.type.isInline?s:s-1;i.insert(u,n.type.create(r)).delete(i.mapping.map(s),i.mapping.map(l))}i.scrollIntoView()},undoable:n.undoable})}function Op(n){return new Vr({find:n.find,handler:({state:e,range:t,match:o})=>{const r=e.doc.resolve(t.from),i=_e(n.getAttributes,void 0,o)||{};if(!r.node(-1).canReplaceWith(r.index(-1),r.indexAfter(-1),n.type))return null;e.tr.delete(t.from,t.to).setBlockType(t.from,t.from,n.type,i)},undoable:n.undoable})}function at(n){return new Vr({find:n.find,handler:({state:e,range:t,match:o})=>{let r=n.replace,i=t.from;const s=t.to;if(o[1]){const l=o[0].lastIndexOf(o[1]);r+=o[0].slice(l+o[1].length),i+=l;const a=i-s;a>0&&(r=o[0].slice(l-a,l)+r,i=s)}e.tr.insertText(r,i,s)},undoable:n.undoable})}function ms(n){return new Vr({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=_e(n.getAttributes,void 0,o)||{},s=e.tr.delete(t.from,t.to),a=s.doc.resolve(t.from).blockRange(),u=a&&Jh(a,n.type,i);if(!u)return null;if(s.wrap(a,u),n.keepMarks&&n.editor){const{selection:f,storedMarks:p}=e,{splittableMarks:h}=n.editor.extensionManager,m=p||f.$to.parentOffset&&f.$from.marks();if(m){const g=m.filter(y=>h.includes(y.type.name));s.ensureMarks(g)}}if(n.keepAttributes){const f=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(f,i).run()}const d=s.doc.resolve(t.from-1).nodeBefore;d&&d.type===n.type&&Lr(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,d))&&s.join(t.from-1)},undoable:n.undoable})}var LB=n=>"touches"in n,bx=class{constructor(n){this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.clientX-this.startX,u=l.clientY-this.startY;this.handleResize(a,u)},this.handleTouchMove=l=>{if(!this.isResizing||!this.activeHandle)return;const a=l.touches[0];if(!a)return;const u=a.clientX-this.startX,d=a.clientY-this.startY;this.handleResize(u,d)},this.handleMouseUp=()=>{if(!this.isResizing)return;const l=this.element.offsetWidth,a=this.element.offsetHeight;this.onCommit(l,a),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=l=>{l.key==="Shift"&&(this.isShiftKeyPressed=!1)};var e,t,o,r,i,s;this.node=n.node,this.editor=n.editor,this.element=n.element,this.contentElement=n.contentElement,this.getPos=n.getPos,this.onResize=n.onResize,this.onCommit=n.onCommit,this.onUpdate=n.onUpdate,(e=n.options)!=null&&e.min&&(this.minSize={...this.minSize,...n.options.min}),(t=n.options)!=null&&t.max&&(this.maxSize=n.options.max),(o=n==null?void 0:n.options)!=null&&o.directions&&(this.directions=n.options.directions),(r=n.options)!=null&&r.preserveAspectRatio&&(this.preserveAspectRatio=n.options.preserveAspectRatio),(i=n.options)!=null&&i.className&&(this.classNames={container:n.options.className.container||"",wrapper:n.options.className.wrapper||"",handle:n.options.className.handle||"",resizing:n.options.className.resizing||""}),(s=n.options)!=null&&s.createCustomHandle&&(this.createCustomHandle=n.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){return this.contentElement}handleEditorUpdate(){const n=this.editor.isEditable;n!==this.lastEditableState&&(this.lastEditableState=n,n?n&&this.handleMap.size===0&&this.attachHandles():this.removeHandles())}update(n,e,t){return n.type!==this.node.type?!1:(this.node=n,this.onUpdate?this.onUpdate(n,e,t):!0)}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const n=document.createElement("div");return n.dataset.resizeContainer="",n.dataset.node=this.node.type.name,n.style.display="flex",this.classNames.container&&(n.className=this.classNames.container),n.appendChild(this.wrapper),n}createWrapper(){const n=document.createElement("div");return n.style.position="relative",n.style.display="block",n.dataset.resizeWrapper="",this.classNames.wrapper&&(n.className=this.classNames.wrapper),n.appendChild(this.element),n}createHandle(n){const e=document.createElement("div");return e.dataset.resizeHandle=n,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(n,e){const t=e.includes("top"),o=e.includes("bottom"),r=e.includes("left"),i=e.includes("right");t&&(n.style.top="0"),o&&(n.style.bottom="0"),r&&(n.style.left="0"),i&&(n.style.right="0"),(e==="top"||e==="bottom")&&(n.style.left="0",n.style.right="0"),(e==="left"||e==="right")&&(n.style.top="0",n.style.bottom="0")}attachHandles(){this.directions.forEach(n=>{let e;this.createCustomHandle?e=this.createCustomHandle(n):e=this.createHandle(n),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${n}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(n)),this.createCustomHandle||this.positionHandle(e,n),e.addEventListener("mousedown",t=>this.handleResizeStart(t,n)),e.addEventListener("touchstart",t=>this.handleResizeStart(t,n)),this.handleMap.set(n,e),this.wrapper.appendChild(e)})}removeHandles(){this.handleMap.forEach(n=>n.remove()),this.handleMap.clear()}applyInitialSize(){const n=this.node.attrs.width,e=this.node.attrs.height;n?(this.element.style.width=`${n}px`,this.initialWidth=n):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(n,e){n.preventDefault(),n.stopPropagation(),this.isResizing=!0,this.activeHandle=e,LB(n)?(this.startX=n.touches[0].clientX,this.startY=n.touches[0].clientY):(this.startX=n.clientX,this.startY=n.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(n,e){if(!this.activeHandle)return;const t=this.preserveAspectRatio||this.isShiftKeyPressed,{width:o,height:r}=this.calculateNewDimensions(this.activeHandle,n,e),i=this.applyConstraints(o,r,t);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(n,e,t){let o=this.startWidth,r=this.startHeight;const i=n.includes("right"),s=n.includes("left"),l=n.includes("bottom"),a=n.includes("top");return i?o=this.startWidth+e:s&&(o=this.startWidth-e),l?r=this.startHeight+t:a&&(r=this.startHeight-t),(n==="right"||n==="left")&&(o=this.startWidth+(i?e:-e)),(n==="top"||n==="bottom")&&(r=this.startHeight+(l?t:-t)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(o,r,n):{width:o,height:r}}applyConstraints(n,e,t){var o,r,i,s;if(!t){let u=Math.max(this.minSize.width,n),d=Math.max(this.minSize.height,e);return(o=this.maxSize)!=null&&o.width&&(u=Math.min(this.maxSize.width,u)),(r=this.maxSize)!=null&&r.height&&(d=Math.min(this.maxSize.height,d)),{width:u,height:d}}let l=n,a=e;return l<this.minSize.width&&(l=this.minSize.width,a=l/this.aspectRatio),a<this.minSize.height&&(a=this.minSize.height,l=a*this.aspectRatio),(i=this.maxSize)!=null&&i.width&&l>this.maxSize.width&&(l=this.maxSize.width,a=l/this.aspectRatio),(s=this.maxSize)!=null&&s.height&&a>this.maxSize.height&&(a=this.maxSize.height,l=a*this.aspectRatio),{width:l,height:a}}applyAspectRatio(n,e,t){const o=t==="left"||t==="right",r=t==="top"||t==="bottom";return o?{width:n,height:n/this.aspectRatio}:r?{width:e*this.aspectRatio,height:e}:{width:n,height:n/this.aspectRatio}}};function PB(n,e){const{selection:t}=n,{$from:o}=t;if(t instanceof Q){const i=o.index();return o.parent.canReplaceWith(i,i+1,e)}let r=o.depth;for(;r>=0;){const i=o.index(r);if(o.node(r).contentMatchAt(i).matchType(e))return!0;r-=1}return!1}function vx(n){return n.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}var VB={};fm(VB,{createAtomBlockMarkdownSpec:()=>zB,createBlockMarkdownSpec:()=>gd,createInlineMarkdownSpec:()=>kx,parseAttributes:()=>Sm,parseIndentedBlocks:()=>$p,renderNestedMarkdownContent:()=>Mm,serializeAttributes:()=>Em});function Sm(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],o=n.replace(/["']([^"']*)["']/g,u=>(t.push(u),`__QUOTED_${t.length-1}__`)),r=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const u=r.map(d=>d.trim().slice(1));e.class=u.join(" ")}const i=o.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(s)).forEach(([,u,d])=>{var f;const p=parseInt(((f=d.match(/__QUOTED_(\d+)__/))==null?void 0:f[1])||"0",10),h=t[p];h&&(e[u]=h.slice(1,-1))});const a=o.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(d=>{d.match(/^[a-zA-Z][\w-]*$/)&&(e[d]=!0)}),e}function Em(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(o=>e.push(`.${o}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,o])=>{t==="class"||t==="id"||(o===!0?e.push(t):o!==!1&&o!=null&&e.push(`${t}="${String(o)}"`))}),e.join(" ")}function zB(n){const{nodeName:e,name:t,parseAttributes:o=Sm,serializeAttributes:r=Em,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=n,a=t||e,u=d=>{if(!l)return d;const f={};return l.forEach(p=>{p in d&&(f[p]=d[p])}),f};return{parseMarkdown:(d,f)=>{const p={...i,...d.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const p=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(f=d.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(d,f,p){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(h);if(!m)return;const g=m[1]||"",y=o(g);if(!s.find(v=>!(v in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:d=>{const f=u(d.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${a}${h} :::`}}}function gd(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=Sm,serializeAttributes:i=Em,defaultAttributes:s={},content:l="block",allowedAttributes:a}=n,u=t||e,d=f=>{if(!a)return f;const p={};return a.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(o){const g=o(f);h=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...s,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${u}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const g=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,v=""]=y,w=r(v);let k=1;const x=b.length;let C="";const S=/^:::([\w-]*)(\s.*)?/gm,M=f.slice(x);for(S.lastIndex=0;;){const N=S.exec(M);if(N===null)break;const A=N.index,$=N[1];if(!((m=N[2])!=null&&m.endsWith(":::"))){if($)k+=1;else if(k-=1,k===0){const O=M.slice(0,A);C=O.trim();const R=f.slice(0,x+A+N[0].length);let I=[];if(C)if(l==="block")for(I=h.blockTokens(O),I.forEach(L=>{L.text&&(!L.tokens||L.tokens.length===0)&&(L.tokens=h.inlineTokens(L.text))});I.length>0;){const L=I[I.length-1];if(L.type==="paragraph"&&(!L.text||L.text.trim()===""))I.pop();else break}else I=h.inlineTokens(C);return{type:e,raw:R,attributes:w,content:C,tokens:I}}}}}},renderMarkdown:(f,p)=>{const h=d(f.attrs||{}),m=i(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
|
|
89
|
+
|
|
90
|
+
`);return`:::${u}${g}
|
|
91
|
+
|
|
92
|
+
${y}
|
|
93
|
+
|
|
94
|
+
:::`}}}function FB(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,s]=o;e[r]=i||s,o=t.exec(n)}return e}function HB(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function kx(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=FB,serializeAttributes:i=HB,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=n,u=t||e,d=p=>{if(!a)return p;const h={};return a.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in p){const b=p[g];if(y!==void 0&&b===y)return;h[g]=b}}),h},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...s,...p.attributes};if(l)return h.createNode(e,m);const g=o?o(p):p.content||"";return g?h.createNode(e,m,[h.createTextNode(g)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(p){const h=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=p.match(h),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(p,h,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=p.match(g);if(!y)return;let b="",v="";if(l){const[,k]=y;v=k}else{const[,k,x]=y;v=k,b=x||""}const w=r(v.trim());return{type:e,raw:y[0],content:b.trim(),attributes:w}}},renderMarkdown:p=>{let h="";o?h=o(p):p.content&&p.content.length>0&&(h=p.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=d(p.attrs||{}),g=i(m),y=g?` ${g}`:"";return l?`[${u}${y}]`:`[${u}${y}]${h}[/${u}]`}}}function $p(n,e,t){var o,r,i,s;const l=n.split(`
|
|
95
|
+
`),a=[];let u="",d=0;const f=e.baseIndentSize||2;for(;d<l.length;){const p=l[d],h=p.match(e.itemPattern);if(!h){if(a.length>0)break;if(p.trim()===""){d+=1,u=`${u}${p}
|
|
96
|
+
`;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;u=`${u}${p}
|
|
97
|
+
`;const b=[y];for(d+=1;d<l.length;){const x=l[d];if(x.trim()===""){const S=l.slice(d+1).findIndex(A=>A.trim()!=="");if(S===-1)break;if((((r=(o=l[d+1+S].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>g){b.push(x),u=`${u}${x}
|
|
98
|
+
`,d+=1;continue}else break}if((((s=(i=x.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>g)b.push(x),u=`${u}${x}
|
|
99
|
+
`,d+=1;else break}let v;const w=b.slice(1);if(w.length>0){const x=w.map(C=>C.slice(g+f)).join(`
|
|
100
|
+
`);x.trim()&&(e.customNestedParser?v=e.customNestedParser(x):v=t.blockTokens(x))}const k=e.createToken(m,v);a.push(k)}if(a.length!==0)return{items:a,raw:u}}function Mm(n,e,t,o){if(!n||!Array.isArray(n.content))return"";const r=typeof t=="function"?t(o):t,[i,...s]=n.content,l=e.renderChildren([i]),a=[`${r}${l}`];return s&&s.length>0&&s.forEach(u=>{const d=e.renderChildren([u]);if(d){const f=d.split(`
|
|
101
|
+
`).map(p=>p?e.indent(p):"").join(`
|
|
102
|
+
`);a.push(f)}}),a.join(`
|
|
103
|
+
`)}function jB(n,e,t={}){const{state:o}=e,{doc:r,tr:i}=o,s=n;r.descendants((l,a)=>{const u=i.mapping.map(a),d=i.mapping.map(a)+l.nodeSize;let f=null;if(l.marks.forEach(h=>{if(h!==s)return!1;f=h}),!f)return;let p=!1;if(Object.keys(t).forEach(h=>{t[h]!==f.attrs[h]&&(p=!0)}),p){const h=n.type.create({...n.attrs,...t});i.removeMark(u,d,n.type),i.addMark(u,d,h)}}),i.docChanged&&e.view.dispatch(i)}var Ie=class wx extends Cm{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new wx(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},UB=class{constructor(n,e,t){this.isDragging=!1,this.component=n,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...t},this.extension=e.extension,this.node=e.node,this.decorations=e.decorations,this.innerDecorations=e.innerDecorations,this.view=e.view,this.HTMLAttributes=e.HTMLAttributes,this.getPos=e.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(n){var e,t,o,r,i,s,l;const{view:a}=this.editor,u=n.target,d=u.nodeType===3?(e=u.parentElement)==null?void 0:e.closest("[data-drag-handle]"):u.closest("[data-drag-handle]");if(!this.dom||(t=this.contentDOM)!=null&&t.contains(u)||!d)return;let f=0,p=0;if(this.dom!==d){const v=this.dom.getBoundingClientRect(),w=d.getBoundingClientRect(),k=(r=n.offsetX)!=null?r:(o=n.nativeEvent)==null?void 0:o.offsetX,x=(s=n.offsetY)!=null?s:(i=n.nativeEvent)==null?void 0:i.offsetY;f=w.x-v.x+k,p=w.y-v.y+x}const h=this.dom.cloneNode(!0);try{const v=this.dom.getBoundingClientRect();h.style.width=`${Math.round(v.width)}px`,h.style.height=`${Math.round(v.height)}px`,h.style.boxSizing="border-box",h.style.pointerEvents="none"}catch{}let m=null;try{m=document.createElement("div"),m.style.position="absolute",m.style.top="-9999px",m.style.left="-9999px",m.style.pointerEvents="none",m.appendChild(h),document.body.appendChild(m),(l=n.dataTransfer)==null||l.setDragImage(h,f,p)}finally{m&&setTimeout(()=>{try{m==null||m.remove()}catch{}},0)}const g=this.getPos();if(typeof g!="number")return;const y=Q.create(a.state.doc,g),b=a.state.tr.setSelection(y);a.dispatch(b)}stopEvent(n){var e;if(!this.dom)return!1;if(typeof this.options.stopEvent=="function")return this.options.stopEvent({event:n});const t=n.target;if(!(this.dom.contains(t)&&!((e=this.contentDOM)!=null&&e.contains(t))))return!1;const r=n.type.startsWith("drag"),i=n.type==="drop";if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(t.tagName)||t.isContentEditable)&&!i&&!r)return!0;const{isEditable:l}=this.editor,{isDragging:a}=this,u=!!this.node.type.spec.draggable,d=Q.isSelectable(this.node),f=n.type==="copy",p=n.type==="paste",h=n.type==="cut",m=n.type==="mousedown";if(!u&&d&&r&&n.target===this.dom&&n.preventDefault(),u&&r&&!a&&n.target===this.dom)return n.preventDefault(),!1;if(u&&l&&!a&&m){const g=t.closest("[data-drag-handle]");g&&(this.dom===g||this.dom.contains(g))&&(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!(a||i||f||p||h||m&&d)}ignoreMutation(n){return!this.dom||!this.contentDOM?!0:typeof this.options.ignoreMutation=="function"?this.options.ignoreMutation({mutation:n}):this.node.isLeaf||this.node.isAtom?!0:n.type==="selection"||this.dom.contains(n.target)&&n.type==="childList"&&(Il()||Tp())&&this.editor.isFocused&&[...Array.from(n.addedNodes),...Array.from(n.removedNodes)].every(t=>t.isContentEditable)?!1:this.contentDOM===n.target&&n.type==="attributes"?!0:!this.contentDOM.contains(n.target)}updateAttributes(n){this.editor.commands.command(({tr:e})=>{const t=this.getPos();return typeof t!="number"?!1:(e.setNodeMarkup(t,void 0,{...this.node.attrs,...n}),!0)})}deleteNode(){const n=this.getPos();if(typeof n!="number")return;const e=n+this.node.nodeSize;this.editor.commands.deleteRange({from:n,to:e})}};function _r(n){return new NB({find:n.find,handler:({state:e,range:t,match:o,pasteEvent:r})=>{const i=_e(n.getAttributes,void 0,o,r);if(i===!1||i===null)return null;const{tr:s}=e,l=o[o.length-1],a=o[0];let u=t.to;if(l){const d=a.search(/\S/),f=t.from+a.indexOf(l),p=f+l.length;if(wm(t.from,t.to,e.doc).filter(m=>m.mark.type.excluded.find(y=>y===n.type&&y!==m.mark.type)).filter(m=>m.to>f).length)return null;p<t.to&&s.delete(p,t.to),f>t.from&&s.delete(t.from+d,f),u=t.from+d+l.length,s.addMark(t.from+d,u,n.type.create(i||{})),s.removeStoredMark(n.type)}}})}function wb(n){return c.customRef((e,t)=>({get(){return e(),n},set(o){n=o,requestAnimationFrame(()=>{requestAnimationFrame(()=>{t()})})}}))}var xx=class extends Jt{constructor(n={}){return super(n),this.contentComponent=null,this.appContext=null,this.reactiveState=wb(this.view.state),this.reactiveExtensionStorage=wb(this.extensionStorage),this.on("beforeTransaction",({nextState:e})=>{this.reactiveState.value=e,this.reactiveExtensionStorage.value=this.extensionStorage}),c.markRaw(this)}get state(){return this.reactiveState?this.reactiveState.value:this.view.state}get storage(){return this.reactiveExtensionStorage?this.reactiveExtensionStorage.value:super.storage}registerPlugin(n,e){const t=super.registerPlugin(n,e);return this.reactiveState&&(this.reactiveState.value=t),t}unregisterPlugin(n){const e=super.unregisterPlugin(n);return this.reactiveState&&e&&(this.reactiveState.value=e),e}},WB=c.defineComponent({name:"EditorContent",props:{editor:{default:null,type:Object}},setup(n){const e=c.ref(),t=c.getCurrentInstance();return c.watchEffect(()=>{const o=n.editor;o&&o.options.element&&e.value&&c.nextTick(()=>{var r;if(!e.value||!((r=o.view.dom)!=null&&r.parentNode))return;const i=c.unref(e.value);e.value.append(...o.view.dom.parentNode.childNodes),o.contentComponent=t.ctx._,t&&(o.appContext={...t.appContext,provides:t.provides}),o.setOptions({element:i}),o.createNodeViews()})}),c.onBeforeUnmount(()=>{const o=n.editor;o&&(o.contentComponent=null,o.appContext=null)}),{rootEl:e}},render(){return c.h("div",{ref:n=>{this.rootEl=n}})}}),to=c.defineComponent({name:"NodeViewContent",props:{as:{type:String,default:"div"}},render(){return c.h(this.as,{style:{whiteSpace:"pre-wrap"},"data-node-view-content":""})}}),Tm=c.defineComponent({name:"NodeViewWrapper",props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(){var n,e;return c.h(this.as,{class:this.decorationClasses,style:{whiteSpace:"normal"},"data-node-view-wrapper":"",onDragstart:this.onDragStart},(e=(n=this.$slots).default)==null?void 0:e.call(n))}}),qB=(n={})=>{const e=c.shallowRef();return c.onMounted(()=>{e.value=new xx(n)}),c.onBeforeUnmount(()=>{var t,o,r,i;const s=(o=(t=e.value)==null?void 0:t.view.dom)==null?void 0:o.parentNode,l=s==null?void 0:s.cloneNode(!0);(r=s==null?void 0:s.parentNode)==null||r.replaceChild(l,s),(i=e.value)==null||i.destroy()}),e},yd=class{constructor(n,{props:e={},editor:t}){this.editor=t,this.component=c.markRaw(n),this.el=document.createElement("div"),this.props=c.reactive(e),this.renderedComponent=this.renderComponent()}get element(){return this.renderedComponent.el}get ref(){var n,e,t,o;return(e=(n=this.renderedComponent.vNode)==null?void 0:n.component)!=null&&e.exposed?this.renderedComponent.vNode.component.exposed:(o=(t=this.renderedComponent.vNode)==null?void 0:t.component)==null?void 0:o.proxy}renderComponent(){let n=c.h(this.component,this.props);return this.editor.appContext&&(n.appContext=this.editor.appContext),typeof document<"u"&&this.el&&c.render(n,this.el),{vNode:n,destroy:()=>{this.el&&c.render(null,this.el),this.el=null,n=null},el:this.el?this.el.firstElementChild:null}}updateProps(n={}){Object.entries(n).forEach(([e,t])=>{this.props[e]=t}),this.renderComponent()}destroy(){this.renderedComponent.destroy()}};c.defineComponent({name:"MarkViewContent",props:{as:{type:String,default:"span"}},render(){return c.h(this.as,{style:{whiteSpace:"inherit"},"data-mark-view-content":""})}});var Ye={editor:{type:Object,required:!0},node:{type:Object,required:!0},decorations:{type:Object,required:!0},selected:{type:Boolean,required:!0},extension:{type:Object,required:!0},getPos:{type:Function,required:!0},updateAttributes:{type:Function,required:!0},deleteNode:{type:Function,required:!0},view:{type:Object,required:!0},innerDecorations:{type:Object,required:!0},HTMLAttributes:{type:Object,required:!0}},KB=class extends UB{mount(){const n={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(o={})=>this.updateAttributes(o),deleteNode:()=>this.deleteNode()},e=this.onDragStart.bind(this);this.decorationClasses=c.ref(this.getDecorationClasses());const t=c.defineComponent({extends:{...this.component},props:Object.keys(n),template:this.component.template,setup:o=>{var r,i;return c.provide("onDragStart",e),c.provide("decorationClasses",this.decorationClasses),(i=(r=this.component).setup)==null?void 0:i.call(r,o,{expose:()=>{}})},__scopeId:this.component.__scopeId,__cssModules:this.component.__cssModules,__name:this.component.__name,__file:this.component.__file});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new yd(t,{editor:this.editor,props:n})}get dom(){if(!this.renderer.element||!this.renderer.element.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.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:n,to:e}=this.editor.state.selection,t=this.getPos();if(typeof t=="number")if(n<=t&&e>=t+this.node.nodeSize){if(this.renderer.props.selected)return;this.selectNode()}else{if(!this.renderer.props.selected)return;this.deselectNode()}}update(n,e,t){const o=r=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(r)};if(typeof this.options.update=="function"){const r=this.node,i=this.decorations,s=this.innerDecorations;return this.node=n,this.decorations=e,this.innerDecorations=t,this.options.update({oldNode:r,oldDecorations:i,newNode:n,newDecorations:e,oldInnerDecorations:s,innerDecorations:t,updateProps:()=>o({node:n,decorations:e,innerDecorations:t})})}return n.type!==this.node.type?!1:(n===this.node&&this.decorations===e&&this.innerDecorations===t||(this.node=n,this.decorations=e,this.innerDecorations=t,o({node:n,decorations:e,innerDecorations:t})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element&&this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element&&this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.flatMap(n=>n.type.attrs.class).join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}};function hn(n,e){return t=>{if(!t.editor.contentComponent)return{};const o=typeof n=="function"&&"__vccOpts"in n?n.__vccOpts:n;return new KB(o,t,e)}}var qc=(n,e)=>{if(n==="slot")return 0;if(n instanceof Function)return n(e);const{children:t,...o}=e??{};if(n==="svg")throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[n,o,t]},JB=/^\s*>\s$/,Cx=Ie.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return qc("blockquote",{...he(this.options.HTMLAttributes,n),children:qc("slot",{})})},parseMarkdown:(n,e)=>e.createNode("blockquote",void 0,e.parseChildren(n.tokens||[])),renderMarkdown:(n,e)=>{if(!n.content)return"";const t=">",o=[];return n.content.forEach(r=>{const l=e.renderChildren([r]).split(`
|
|
104
|
+
`).map(a=>a.trim()===""?t:`${t} ${a}`);o.push(l.join(`
|
|
105
|
+
`))}),o.join(`
|
|
106
|
+
${t}
|
|
107
|
+
`)},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[ms({find:JB,type:this.type})]}}),GB=Cx,XB=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,YB=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,QB=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ZB=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,eR=eo.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return qc("strong",{...he(this.options.HTMLAttributes,n),children:qc("slot",{})})},markdownTokenName:"strong",parseMarkdown:(n,e)=>e.applyMark("bold",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`**${e.renderChildren(n)}**`,addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[bi({find:XB,type:this.type}),bi({find:QB,type:this.type})]},addPasteRules(){return[_r({find:YB,type:this.type}),_r({find:ZB,type:this.type})]}}),tR=/(^|[^`])`([^`]+)`(?!`)$/,nR=/(^|[^`])`([^`]+)`(?!`)/g,oR=eo.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",he(this.options.HTMLAttributes,n),0]},markdownTokenName:"codespan",parseMarkdown:(n,e)=>e.applyMark("code",[{type:"text",text:n.text||""}]),renderMarkdown:(n,e)=>n.content?`\`${e.renderChildren(n.content)}\``:"",addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[bi({find:tR,type:this.type})]},addPasteRules(){return[_r({find:nR,type:this.type})]}}),Cf=4,rR=/^```([a-z]+)?[\s\n]$/,iR=/^~~~([a-z]+)?[\s\n]$/,Sx=Ie.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:Cf,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var e;const{languageClassPrefix:t}=this.options;if(!t)return null;const i=[...((e=n.firstElementChild)==null?void 0:e.classList)||[]].filter(s=>s.startsWith(t)).map(s=>s.replace(t,""))[0];return i||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:e}){return["pre",he(this.options.HTMLAttributes,e),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(n,e)=>{var t;return((t=n.raw)==null?void 0:t.startsWith("```"))===!1&&n.codeBlockStyle!=="indented"?[]:e.createNode("codeBlock",{language:n.lang||null},n.text?[e.createTextNode(n.text)]:[])},renderMarkdown:(n,e)=>{var t;let o="";const r=((t=n.attrs)==null?void 0:t.language)||"";return n.content?o=[`\`\`\`${r}`,e.renderChildren(n.content),"```"].join(`
|
|
108
|
+
`):o=`\`\`\`${r}
|
|
109
|
+
|
|
110
|
+
\`\`\``,o},addCommands(){return{setCodeBlock:n=>({commands:e})=>e.setNode(this.name,n),toggleCodeBlock:n=>({commands:e})=>e.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:n,$anchor:e}=this.editor.state.selection,t=e.pos===1;return!n||e.parent.type.name!==this.name?!1:t||!e.parent.textContent.length?this.editor.commands.clearNodes():!1},Tab:({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Cf,{state:o}=n,{selection:r}=o,{$from:i,empty:s}=r;if(i.parent.type!==this.type)return!1;const l=" ".repeat(t);return s?n.commands.insertContent(l):n.commands.command(({tr:a})=>{const{from:u,to:d}=r,h=o.doc.textBetween(u,d,`
|
|
111
|
+
`,`
|
|
112
|
+
`).split(`
|
|
113
|
+
`).map(m=>l+m).join(`
|
|
114
|
+
`);return a.replaceWith(u,d,o.schema.text(h)),!0})},"Shift-Tab":({editor:n})=>{var e;if(!this.options.enableTabIndentation)return!1;const t=(e=this.options.tabSize)!=null?e:Cf,{state:o}=n,{selection:r}=o,{$from:i,empty:s}=r;return i.parent.type!==this.type?!1:s?n.commands.command(({tr:l})=>{var a;const{pos:u}=i,d=i.start(),f=i.end(),h=o.doc.textBetween(d,f,`
|
|
115
|
+
`,`
|
|
116
|
+
`).split(`
|
|
117
|
+
`);let m=0,g=0;const y=u-d;for(let C=0;C<h.length;C+=1){if(g+h[C].length>=y){m=C;break}g+=h[C].length+1}const v=((a=h[m].match(/^ */))==null?void 0:a[0])||"",w=Math.min(v.length,t);if(w===0)return!0;let k=d;for(let C=0;C<m;C+=1)k+=h[C].length+1;return l.delete(k,k+w),u-k<=w&&l.setSelection(q.create(l.doc,k)),!0}):n.commands.command(({tr:l})=>{const{from:a,to:u}=r,p=o.doc.textBetween(a,u,`
|
|
118
|
+
`,`
|
|
119
|
+
`).split(`
|
|
120
|
+
`).map(h=>{var m;const g=((m=h.match(/^ */))==null?void 0:m[0])||"",y=Math.min(g.length,t);return h.slice(y)}).join(`
|
|
121
|
+
`);return l.replaceWith(a,u,o.schema.text(p)),!0})},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=n,{selection:t}=e,{$from:o,empty:r}=t;if(!r||o.parent.type!==this.type)return!1;const i=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith(`
|
|
122
|
+
|
|
123
|
+
`);return!i||!s?!1:n.chain().command(({tr:l})=>(l.delete(o.pos-2,o.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=n,{selection:t,doc:o}=e,{$from:r,empty:i}=t;if(!i||r.parent.type!==this.type||!(r.parentOffset===r.parent.nodeSize-2))return!1;const l=r.after();return l===void 0?!1:o.nodeAt(l)?n.commands.command(({tr:u})=>(u.setSelection(se.near(o.resolve(l))),!0)):n.commands.exitCode()}}},addInputRules(){return[Op({find:rR,type:this.type,getAttributes:n=>({language:n[1]})}),Op({find:iR,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new ue({key:new ce("codeBlockVSCodeHandler"),props:{handlePaste:(n,e)=>{if(!e.clipboardData||this.editor.isActive(this.type.name))return!1;const t=e.clipboardData.getData("text/plain"),o=e.clipboardData.getData("vscode-editor-data"),r=o?JSON.parse(o):void 0,i=r==null?void 0:r.mode;if(!t||!i)return!1;const{tr:s,schema:l}=n.state,a=l.text(t.replace(/\r\n?/g,`
|
|
124
|
+
`));return s.replaceSelectionWith(this.type.create({language:i},a)),s.selection.$from.parent.type!==this.type&&s.setSelection(q.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}}),sR=Sx,Ex=Ie.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
125
|
+
|
|
126
|
+
`):""}),Bp=Ex,lR=Ie.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",he(this.options.HTMLAttributes,n)]},renderText(){return`
|
|
127
|
+
`},renderMarkdown:()=>`
|
|
128
|
+
`,parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:n,chain:e,state:t,editor:o})=>n.first([()=>n.exitCode(),()=>n.command(()=>{const{selection:r,storedMarks:i}=t;if(r.$from.parent.type.spec.isolating)return!1;const{keepMarks:s}=this.options,{splittableMarks:l}=o.extensionManager,a=i||r.$to.parentOffset&&r.$from.marks();return e().insertContent({type:this.name}).command(({tr:u,dispatch:d})=>{if(d&&a&&s){const f=a.filter(p=>l.includes(p.type.name));u.ensureMarks(f)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),Mx=Ie.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:e}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,he(this.options.HTMLAttributes,e),0]},parseMarkdown:(n,e)=>e.createNode("heading",{level:n.depth||1},e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>{var t;const o=(t=n.attrs)!=null&&t.level?parseInt(n.attrs.level,10):1,r="#".repeat(o);return n.content?`${r} ${e.renderChildren(n.content)}`:""},addCommands(){return{setHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.setNode(this.name,n):!1,toggleHeading:n=>({commands:e})=>this.options.levels.includes(n.level)?e.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,e)=>({...n,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})}),{})},addInputRules(){return this.options.levels.map(n=>Op({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}}),aR=Mx,Tx=Ie.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",he(this.options.HTMLAttributes,n)]},markdownTokenName:"hr",parseMarkdown:(n,e)=>e.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:n,state:e})=>{if(!PB(e,e.schema.nodes[this.name]))return!1;const{selection:t}=e,{$to:o}=t,r=n();return ex(t)?r.insertContentAt(o.pos,{type:this.name}):r.insertContent({type:this.name}),r.command(({state:i,tr:s,dispatch:l})=>{if(l){const{$to:a}=s.selection,u=a.end();if(a.nodeAfter)a.nodeAfter.isTextblock?s.setSelection(q.create(s.doc,a.pos+1)):a.nodeAfter.isBlock?s.setSelection(Q.create(s.doc,a.pos)):s.setSelection(q.create(s.doc,a.pos));else{const d=i.schema.nodes[this.options.nextNodeType]||a.parent.type.contentMatch.defaultType,f=d==null?void 0:d.create();f&&(s.insert(u,f),s.setSelection(q.create(s.doc,u+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[md({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),cR=Tx,uR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,dR=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,fR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,pR=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,hR=eo.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",he(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(n,e)=>e.applyMark("italic",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`*${e.renderChildren(n)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[bi({find:uR,type:this.type}),bi({find:fR,type:this.type})]},addPasteRules(){return[_r({find:dR,type:this.type}),_r({find:pR,type:this.type})]}});const mR="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",gR="ελ1υ2бг1ел3дети4ею2католик6ом3мкд2он1сква6онлайн5рг3рус2ф2сайт3рб3укр3қаз3հայ3ישראל5קום3ابوظبي5رامكو5لاردن4بحرين5جزائر5سعودية6عليان5مغرب5مارات5یران5بارت2زار4يتك3ھارت5تونس4سودان3رية5شبكة4عراق2ب2مان4فلسطين6قطر3كاثوليك6وم3مصر2ليسيا5وريتانيا7قع4همراه5پاکستان7ڀارت4कॉम3नेट3भारत0म्3ोत5संगठन5বাংলা5ভারত2ৰত4ਭਾਰਤ4ભારત4ଭାରତ4இந்தியா6லங்கை6சிங்கப்பூர்11భారత్5ಭಾರತ4ഭാരതം5ලංකා4คอม3ไทย3ລາວ3გე2みんな3アマゾン4クラウド4グーグル4コム2ストア3セール3ファッション6ポイント4世界2中信1国1國1文网3亚马逊3企业2佛山2信息2健康2八卦2公司1益2台湾1灣2商城1店1标2嘉里0大酒店5在线2大拿2天主教3娱乐2家電2广东2微博2慈善2我爱你3手机2招聘2政务1府2新加坡2闻2时尚2書籍2机构2淡马锡3游戏2澳門2点看2移动2组织机构4网址1店1站1络2联通2谷歌2购物2通販2集团2電訊盈科4飞利浦3食品2餐厅2香格里拉3港2닷넷1컴2삼성2한국2",Rp="numeric",_p="ascii",Dp="alpha",fl="asciinumeric",Ys="alphanumeric",Ip="domain",Nx="emoji",yR="scheme",bR="slashscheme",Sf="whitespace";function vR(n,e){return n in e||(e[n]=[]),e[n]}function Qr(n,e,t){e[Rp]&&(e[fl]=!0,e[Ys]=!0),e[_p]&&(e[fl]=!0,e[Dp]=!0),e[fl]&&(e[Ys]=!0),e[Dp]&&(e[Ys]=!0),e[Ys]&&(e[Ip]=!0),e[Nx]&&(e[Ip]=!0);for(const o in e){const r=vR(o,t);r.indexOf(n)<0&&r.push(n)}}function kR(n,e){const t={};for(const o in e)e[o].indexOf(n)>=0&&(t[o]=!0);return t}function cn(n=null){this.j={},this.jr=[],this.jd=null,this.t=n}cn.groups={};cn.prototype={accepts(){return!!this.t},go(n){const e=this,t=e.j[n];if(t)return t;for(let o=0;o<e.jr.length;o++){const r=e.jr[o][0],i=e.jr[o][1];if(i&&r.test(n))return i}return e.jd},has(n,e=!1){return e?n in this.j:!!this.go(n)},ta(n,e,t,o){for(let r=0;r<n.length;r++)this.tt(n[r],e,t,o)},tr(n,e,t,o){o=o||cn.groups;let r;return e&&e.j?r=e:(r=new cn(e),t&&o&&Qr(e,t,o)),this.jr.push([n,r]),r},ts(n,e,t,o){let r=this;const i=n.length;if(!i)return r;for(let s=0;s<i-1;s++)r=r.tt(n[s]);return r.tt(n[i-1],e,t,o)},tt(n,e,t,o){o=o||cn.groups;const r=this;if(e&&e.j)return r.j[n]=e,e;const i=e;let s,l=r.go(n);if(l?(s=new cn,Object.assign(s.j,l.j),s.jr.push.apply(s.jr,l.jr),s.jd=l.jd,s.t=l.t):s=new cn,i){if(o)if(s.t&&typeof s.t=="string"){const a=Object.assign(kR(s.t,o),t);Qr(i,a,o)}else t&&Qr(i,t,o);s.t=i}return r.j[n]=s,s}};const Ce=(n,e,t,o,r)=>n.ta(e,t,o,r),rt=(n,e,t,o,r)=>n.tr(e,t,o,r),xb=(n,e,t,o,r)=>n.ts(e,t,o,r),V=(n,e,t,o,r)=>n.tt(e,t,o,r),zo="WORD",Lp="UWORD",Ax="ASCIINUMERICAL",Ox="ALPHANUMERICAL",Vl="LOCALHOST",Pp="TLD",Vp="UTLD",pc="SCHEME",qi="SLASH_SCHEME",Nm="NUM",zp="WS",Am="NL",pl="OPENBRACE",hl="CLOSEBRACE",Kc="OPENBRACKET",Jc="CLOSEBRACKET",Gc="OPENPAREN",Xc="CLOSEPAREN",Yc="OPENANGLEBRACKET",Qc="CLOSEANGLEBRACKET",Zc="FULLWIDTHLEFTPAREN",eu="FULLWIDTHRIGHTPAREN",tu="LEFTCORNERBRACKET",nu="RIGHTCORNERBRACKET",ou="LEFTWHITECORNERBRACKET",ru="RIGHTWHITECORNERBRACKET",iu="FULLWIDTHLESSTHAN",su="FULLWIDTHGREATERTHAN",lu="AMPERSAND",au="APOSTROPHE",cu="ASTERISK",pr="AT",uu="BACKSLASH",du="BACKTICK",fu="CARET",yr="COLON",Om="COMMA",pu="DOLLAR",fo="DOT",hu="EQUALS",$m="EXCLAMATION",An="HYPHEN",ml="PERCENT",mu="PIPE",gu="PLUS",yu="POUND",gl="QUERY",Bm="QUOTE",$x="FULLWIDTHMIDDLEDOT",Rm="SEMI",po="SLASH",yl="TILDE",bu="UNDERSCORE",Bx="EMOJI",vu="SYM";var Rx=Object.freeze({__proto__:null,ALPHANUMERICAL:Ox,AMPERSAND:lu,APOSTROPHE:au,ASCIINUMERICAL:Ax,ASTERISK:cu,AT:pr,BACKSLASH:uu,BACKTICK:du,CARET:fu,CLOSEANGLEBRACKET:Qc,CLOSEBRACE:hl,CLOSEBRACKET:Jc,CLOSEPAREN:Xc,COLON:yr,COMMA:Om,DOLLAR:pu,DOT:fo,EMOJI:Bx,EQUALS:hu,EXCLAMATION:$m,FULLWIDTHGREATERTHAN:su,FULLWIDTHLEFTPAREN:Zc,FULLWIDTHLESSTHAN:iu,FULLWIDTHMIDDLEDOT:$x,FULLWIDTHRIGHTPAREN:eu,HYPHEN:An,LEFTCORNERBRACKET:tu,LEFTWHITECORNERBRACKET:ou,LOCALHOST:Vl,NL:Am,NUM:Nm,OPENANGLEBRACKET:Yc,OPENBRACE:pl,OPENBRACKET:Kc,OPENPAREN:Gc,PERCENT:ml,PIPE:mu,PLUS:gu,POUND:yu,QUERY:gl,QUOTE:Bm,RIGHTCORNERBRACKET:nu,RIGHTWHITECORNERBRACKET:ru,SCHEME:pc,SEMI:Rm,SLASH:po,SLASH_SCHEME:qi,SYM:vu,TILDE:yl,TLD:Pp,UNDERSCORE:bu,UTLD:Vp,UWORD:Lp,WORD:zo,WS:zp});const Po=/[a-z]/,Us=new RegExp("\\p{L}","u"),Ef=new RegExp("\\p{Emoji}","u"),Vo=/\d/,Mf=/\s/,Cb="\r",Tf=`
|
|
129
|
+
`,wR="️",xR="",Nf="";let Pa=null,Va=null;function CR(n=[]){const e={};cn.groups=e;const t=new cn;Pa==null&&(Pa=Sb(mR)),Va==null&&(Va=Sb(gR)),V(t,"'",au),V(t,"{",pl),V(t,"}",hl),V(t,"[",Kc),V(t,"]",Jc),V(t,"(",Gc),V(t,")",Xc),V(t,"<",Yc),V(t,">",Qc),V(t,"(",Zc),V(t,")",eu),V(t,"「",tu),V(t,"」",nu),V(t,"『",ou),V(t,"』",ru),V(t,"<",iu),V(t,">",su),V(t,"&",lu),V(t,"*",cu),V(t,"@",pr),V(t,"`",du),V(t,"^",fu),V(t,":",yr),V(t,",",Om),V(t,"$",pu),V(t,".",fo),V(t,"=",hu),V(t,"!",$m),V(t,"-",An),V(t,"%",ml),V(t,"|",mu),V(t,"+",gu),V(t,"#",yu),V(t,"?",gl),V(t,'"',Bm),V(t,"/",po),V(t,";",Rm),V(t,"~",yl),V(t,"_",bu),V(t,"\\",uu),V(t,"・",$x);const o=rt(t,Vo,Nm,{[Rp]:!0});rt(o,Vo,o);const r=rt(o,Po,Ax,{[fl]:!0}),i=rt(o,Us,Ox,{[Ys]:!0}),s=rt(t,Po,zo,{[_p]:!0});rt(s,Vo,r),rt(s,Po,s),rt(r,Vo,r),rt(r,Po,r);const l=rt(t,Us,Lp,{[Dp]:!0});rt(l,Po),rt(l,Vo,i),rt(l,Us,l),rt(i,Vo,i),rt(i,Po),rt(i,Us,i);const a=V(t,Tf,Am,{[Sf]:!0}),u=V(t,Cb,zp,{[Sf]:!0}),d=rt(t,Mf,zp,{[Sf]:!0});V(t,Nf,d),V(u,Tf,a),V(u,Nf,d),rt(u,Mf,d),V(d,Cb),V(d,Tf),rt(d,Mf,d),V(d,Nf,d);const f=rt(t,Ef,Bx,{[Nx]:!0});V(f,"#"),rt(f,Ef,f),V(f,wR,f);const p=V(f,xR);V(p,"#"),rt(p,Ef,f);const h=[[Po,s],[Vo,r]],m=[[Po,null],[Us,l],[Vo,i]];for(let g=0;g<Pa.length;g++)ur(t,Pa[g],Pp,zo,h);for(let g=0;g<Va.length;g++)ur(t,Va[g],Vp,Lp,m);Qr(Pp,{tld:!0,ascii:!0},e),Qr(Vp,{utld:!0,alpha:!0},e),ur(t,"file",pc,zo,h),ur(t,"mailto",pc,zo,h),ur(t,"http",qi,zo,h),ur(t,"https",qi,zo,h),ur(t,"ftp",qi,zo,h),ur(t,"ftps",qi,zo,h),Qr(pc,{scheme:!0,ascii:!0},e),Qr(qi,{slashscheme:!0,ascii:!0},e),n=n.sort((g,y)=>g[0]>y[0]?1:-1);for(let g=0;g<n.length;g++){const y=n[g][0],v=n[g][1]?{[yR]:!0}:{[bR]:!0};y.indexOf("-")>=0?v[Ip]=!0:Po.test(y)?Vo.test(y)?v[fl]=!0:v[_p]=!0:v[Rp]=!0,xb(t,y,y,v)}return xb(t,"localhost",Vl,{ascii:!0}),t.jd=new cn(vu),{start:t,tokens:Object.assign({groups:e},Rx)}}function _x(n,e){const t=SR(e.replace(/[A-Z]/g,l=>l.toLowerCase())),o=t.length,r=[];let i=0,s=0;for(;s<o;){let l=n,a=null,u=0,d=null,f=-1,p=-1;for(;s<o&&(a=l.go(t[s]));)l=a,l.accepts()?(f=0,p=0,d=l):f>=0&&(f+=t[s].length,p++),u+=t[s].length,i+=t[s].length,s++;i-=f,s-=p,u-=f,r.push({t:d.t,v:e.slice(i-u,i),s:i-u,e:i})}return r}function SR(n){const e=[],t=n.length;let o=0;for(;o<t;){let r=n.charCodeAt(o),i,s=r<55296||r>56319||o+1===t||(i=n.charCodeAt(o+1))<56320||i>57343?n[o]:n.slice(o,o+2);e.push(s),o+=s.length}return e}function ur(n,e,t,o,r){let i;const s=e.length;for(let l=0;l<s-1;l++){const a=e[l];n.j[a]?i=n.j[a]:(i=new cn(o),i.jr=r.slice(),n.j[a]=i),n=i}return i=new cn(t),i.jr=r.slice(),n.j[e[s-1]]=i,i}function Sb(n){const e=[],t=[];let o=0,r="0123456789";for(;o<n.length;){let i=0;for(;r.indexOf(n[o+i])>=0;)i++;if(i>0){e.push(t.join(""));for(let s=parseInt(n.substring(o,o+i),10);s>0;s--)t.pop();o+=i}else t.push(n[o]),o++}return e}const zl={defaultProtocol:"http",events:null,format:Eb,formatHref:Eb,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function _m(n,e=null){let t=Object.assign({},zl);n&&(t=Object.assign(t,n instanceof _m?n.o:n));const o=t.ignoreTags,r=[];for(let i=0;i<o.length;i++)r.push(o[i].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=r}_m.prototype={o:zl,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const o=e!=null;let r=this.o[n];return r&&(typeof r=="object"?(r=t.t in r?r[t.t]:zl[n],typeof r=="function"&&o&&(r=r(e,t))):typeof r=="function"&&o&&(r=r(e,t.t,t)),r)},getObj(n,e,t){let o=this.o[n];return typeof o=="function"&&e!=null&&(o=o(e,t.t,t)),o},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function Eb(n){return n}function Dx(n,e){this.t="token",this.v=n,this.tk=e}Dx.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),o=n.get("format",e,this);return t&&o.length>t?o.substring(0,t)+"…":o},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n=zl.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),o=n.get("formatHref",t,this),r=n.get("tagName",t,e),i=this.toFormattedString(n),s={},l=n.get("className",t,e),a=n.get("target",t,e),u=n.get("rel",t,e),d=n.getObj("attributes",t,e),f=n.getObj("events",t,e);return s.href=o,l&&(s.class=l),a&&(s.target=a),u&&(s.rel=u),d&&Object.assign(s,d),{tagName:r,attributes:s,content:i,eventListeners:f}}};function bd(n,e){class t extends Dx{constructor(r,i){super(r,i),this.t=n}}for(const o in e)t.prototype[o]=e[o];return t.t=n,t}const Mb=bd("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Tb=bd("text"),ER=bd("nl"),za=bd("url",{isLink:!0,toHref(n=zl.defaultProtocol){return this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==Vl&&n[1].t===yr}}),Nn=n=>new cn(n);function MR({groups:n}){const e=n.domain.concat([lu,cu,pr,uu,du,fu,pu,hu,An,Nm,ml,mu,gu,yu,po,vu,yl,bu]),t=[au,yr,Om,fo,$m,ml,gl,Bm,Rm,Yc,Qc,pl,hl,Jc,Kc,Gc,Xc,Zc,eu,tu,nu,ou,ru,iu,su],o=[lu,au,cu,uu,du,fu,pu,hu,An,pl,hl,ml,mu,gu,yu,gl,po,vu,yl,bu],r=Nn(),i=V(r,yl);Ce(i,o,i),Ce(i,n.domain,i);const s=Nn(),l=Nn(),a=Nn();Ce(r,n.domain,s),Ce(r,n.scheme,l),Ce(r,n.slashscheme,a),Ce(s,o,i),Ce(s,n.domain,s);const u=V(s,pr);V(i,pr,u),V(l,pr,u),V(a,pr,u);const d=V(i,fo);Ce(d,o,i),Ce(d,n.domain,i);const f=Nn();Ce(u,n.domain,f),Ce(f,n.domain,f);const p=V(f,fo);Ce(p,n.domain,f);const h=Nn(Mb);Ce(p,n.tld,h),Ce(p,n.utld,h),V(u,Vl,h);const m=V(f,An);V(m,An,m),Ce(m,n.domain,f),Ce(h,n.domain,f),V(h,fo,p),V(h,An,m);const g=V(h,yr);Ce(g,n.numeric,Mb);const y=V(s,An),b=V(s,fo);V(y,An,y),Ce(y,n.domain,s),Ce(b,o,i),Ce(b,n.domain,s);const v=Nn(za);Ce(b,n.tld,v),Ce(b,n.utld,v),Ce(v,n.domain,s),Ce(v,o,i),V(v,fo,b),V(v,An,y),V(v,pr,u);const w=V(v,yr),k=Nn(za);Ce(w,n.numeric,k);const x=Nn(za),C=Nn();Ce(x,e,x),Ce(x,t,C),Ce(C,e,x),Ce(C,t,C),V(v,po,x),V(k,po,x);const S=V(l,yr),M=V(a,yr),N=V(M,po),A=V(N,po);Ce(l,n.domain,s),V(l,fo,b),V(l,An,y),Ce(a,n.domain,s),V(a,fo,b),V(a,An,y),Ce(S,n.domain,x),V(S,po,x),V(S,gl,x),Ce(A,n.domain,x),Ce(A,e,x),V(A,po,x);const $=[[pl,hl],[Kc,Jc],[Gc,Xc],[Yc,Qc],[Zc,eu],[tu,nu],[ou,ru],[iu,su]];for(let O=0;O<$.length;O++){const[R,I]=$[O],L=V(x,R);V(C,R,L),V(L,I,x);const B=Nn(za);Ce(L,e,B);const W=Nn();Ce(L,t),Ce(B,e,B),Ce(B,t,W),Ce(W,e,B),Ce(W,t,W),V(B,I,x),V(W,I,x)}return V(r,Vl,v),V(r,Am,ER),{start:r,tokens:Rx}}function TR(n,e,t){let o=t.length,r=0,i=[],s=[];for(;r<o;){let l=n,a=null,u=null,d=0,f=null,p=-1;for(;r<o&&!(a=l.go(t[r].t));)s.push(t[r++]);for(;r<o&&(u=a||l.go(t[r].t));)a=null,l=u,l.accepts()?(p=0,f=l):p>=0&&p++,r++,d++;if(p<0)r-=d,r<o&&(s.push(t[r]),r++);else{s.length>0&&(i.push(Af(Tb,e,s)),s=[]),r-=p,d-=p;const h=f.t,m=t.slice(r-d,r);i.push(Af(h,e,m))}}return s.length>0&&i.push(Af(Tb,e,s)),i}function Af(n,e,t){const o=t[0].s,r=t[t.length-1].e,i=e.slice(o,r);return new n(i,t)}const NR=typeof console<"u"&&console&&console.warn||(()=>{}),AR="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",Ze={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function OR(){return cn.groups={},Ze.scanner=null,Ze.parser=null,Ze.tokenQueue=[],Ze.pluginQueue=[],Ze.customSchemes=[],Ze.initialized=!1,Ze}function Nb(n,e=!1){if(Ze.initialized&&NR(`linkifyjs: already initialized - will not register custom scheme "${n}" ${AR}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
130
|
+
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
131
|
+
2. Cannot start or end with "-"
|
|
132
|
+
3. "-" cannot repeat`);Ze.customSchemes.push([n,e])}function $R(){Ze.scanner=CR(Ze.customSchemes);for(let n=0;n<Ze.tokenQueue.length;n++)Ze.tokenQueue[n][1]({scanner:Ze.scanner});Ze.parser=MR(Ze.scanner.tokens);for(let n=0;n<Ze.pluginQueue.length;n++)Ze.pluginQueue[n][1]({scanner:Ze.scanner,parser:Ze.parser});return Ze.initialized=!0,Ze}function Dm(n){return Ze.initialized||$R(),TR(Ze.parser.start,n,_x(Ze.scanner.start,n))}Dm.scan=_x;function Ix(n,e=null,t=null){if(e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const o=new _m(t),r=Dm(n),i=[];for(let s=0;s<r.length;s++){const l=r[s];l.isLink&&(!e||l.t===e)&&o.check(l)&&i.push(l.toFormattedObject(o))}return i}var Im="[\0- -\u2029 ]",BR=new RegExp(Im),RR=new RegExp(`${Im}$`),_R=new RegExp(Im,"g");function DR(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function IR(n){return new ue({key:new ce("autolink"),appendTransaction:(e,t,o)=>{const r=e.some(u=>u.docChanged)&&!t.doc.eq(o.doc),i=e.some(u=>u.getMeta("preventAutolink"));if(!r||i)return;const{tr:s}=o,l=hm(t.doc,[...e]);if(km(l).forEach(({newRange:u})=>{const d=U0(o.doc,u,h=>h.isTextblock);let f,p;if(d.length>1)f=d[0],p=o.doc.textBetween(f.pos,f.pos+f.node.nodeSize,void 0," ");else if(d.length){const h=o.doc.textBetween(u.from,u.to," "," ");if(!RR.test(h))return;f=d[0],p=o.doc.textBetween(f.pos,u.to,void 0," ")}if(f&&p){const h=p.split(BR).filter(Boolean);if(h.length<=0)return!1;const m=h[h.length-1],g=f.pos+p.lastIndexOf(m);if(!m)return!1;const y=Dm(m).map(b=>b.toObject(n.defaultProtocol));if(!DR(y))return!1;y.filter(b=>b.isLink).map(b=>({...b,from:g+b.start+1,to:g+b.end+1})).filter(b=>o.schema.marks.code?!o.doc.rangeHasMark(b.from,b.to,o.schema.marks.code):!0).filter(b=>n.validate(b.value)).filter(b=>n.shouldAutoLink(b.value)).forEach(b=>{wm(b.from,b.to,o.doc).some(v=>v.mark.type===n.type)||s.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function LR(n){return new ue({key:new ce("handleClickLink"),props:{handleClick:(e,t,o)=>{var r,i;if(o.button!==0||!e.editable)return!1;let s=null;if(o.target instanceof HTMLAnchorElement)s=o.target;else{const a=o.target;if(!a)return!1;const u=n.editor.view.dom;s=a.closest("a"),s&&!u.contains(s)&&(s=null)}if(!s)return!1;let l=!1;if(n.enableClickSelection&&(l=n.editor.commands.extendMarkRange(n.type.name)),n.openOnClick){const a=Q0(e.state,n.type.name),u=(r=s.href)!=null?r:a.href,d=(i=s.target)!=null?i:a.target;u&&(window.open(u,d),l=!0)}return l}}})}function PR(n){return new ue({key:new ce("handlePasteLink"),props:{handlePaste:(e,t,o)=>{const{shouldAutoLink:r}=n,{state:i}=e,{selection:s}=i,{empty:l}=s;if(l)return!1;let a="";o.content.forEach(d=>{a+=d.textContent});const u=Ix(a,{defaultProtocol:n.defaultProtocol}).find(d=>d.isLink&&d.value===a);return!a||!u||r!==void 0&&!r(u.value)?!1:n.editor.commands.setMark(n.type,{href:u.href})}}})}function qr(n,e){const t=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return e&&e.forEach(o=>{const r=typeof o=="string"?o:o.scheme;r&&t.push(r)}),!n||n.replace(_R,"").match(new RegExp(`^(?:(?:${t.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Lx=eo.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(n=>{if(typeof n=="string"){Nb(n);return}Nb(n.scheme,n.optionalSlashes)})},onDestroy(){OR()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(n,e)=>!!qr(n,e.protocols),validate:n=>!!n,shouldAutoLink:n=>{const e=/^[a-z][a-z0-9+.-]*:\/\//i.test(n),t=/^[a-z][a-z0-9+.-]*:/i.test(n);if(e||t&&!n.includes("@"))return!0;const r=(n.includes("@")?n.split("@").pop():n).split(/[/?#:]/)[0];return!(/^\d{1,3}(\.\d{1,3}){3}$/.test(r)||!/\./.test(r))}}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{const e=n.getAttribute("href");return!e||!this.options.isAllowedUri(e,{defaultValidate:t=>!!qr(t,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:null}}]},renderHTML({HTMLAttributes:n}){return this.options.isAllowedUri(n.href,{defaultValidate:e=>!!qr(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",he(this.options.HTMLAttributes,n),0]:["a",he(this.options.HTMLAttributes,{...n,href:""}),0]},markdownTokenName:"link",parseMarkdown:(n,e)=>e.applyMark("link",e.parseInline(n.tokens||[]),{href:n.href,title:n.title||null}),renderMarkdown:(n,e)=>{var t;const o=((t=n.attrs)==null?void 0:t.href)||"";return`[${e.renderChildren(n)}](${o})`},addCommands(){return{setLink:n=>({chain:e})=>{const{href:t}=n;return this.options.isAllowedUri(t,{defaultValidate:o=>!!qr(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?e().setMark(this.name,n).setMeta("preventAutolink",!0).run():!1},toggleLink:n=>({chain:e})=>{const{href:t}=n||{};return t&&!this.options.isAllowedUri(t,{defaultValidate:o=>!!qr(o,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?!1:e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[_r({find:n=>{const e=[];if(n){const{protocols:t,defaultProtocol:o}=this.options,r=Ix(n).filter(i=>i.isLink&&this.options.isAllowedUri(i.value,{defaultValidate:s=>!!qr(s,t),protocols:t,defaultProtocol:o}));r.length&&r.forEach(i=>{this.options.shouldAutoLink(i.value)&&e.push({text:i.value,data:{href:i.href},index:i.start})})}return e},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)==null?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[],{protocols:e,defaultProtocol:t}=this.options;return this.options.autolink&&n.push(IR({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:o=>this.options.isAllowedUri(o,{defaultValidate:r=>!!qr(r,e),protocols:e,defaultProtocol:t}),shouldAutoLink:this.options.shouldAutoLink})),n.push(LR({type:this.type,editor:this.editor,openOnClick:this.options.openOnClick==="whenNotEditable"?!0:this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&n.push(PR({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),n}}),Lm=Lx,VR=Object.defineProperty,zR=(n,e)=>{for(var t in e)VR(n,t,{get:e[t],enumerable:!0})},FR="listItem",Ab="textStyle",Ob=/^\s*([-+*])\s$/,Px=Ie.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",he(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
133
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(FR,this.editor.getAttributes(Ab)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=ms({find:Ob,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=ms({find:Ob,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Ab),editor:this.editor})),[n]}}),Vx=Ie.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",he(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(r=>r.type==="paragraph"))t=e.parseChildren(n.tokens);else{const r=n.tokens[0];if(r&&r.type==="text"&&r.tokens&&r.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(r.tokens)}],n.tokens.length>1){const s=n.tokens.slice(1),l=e.parseChildren(s);t.push(...l)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Mm(n,e,o=>o.parentType==="bulletList"?"- ":o.parentType==="orderedList"?`${o.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),HR={};zR(HR,{findListItemPos:()=>ha,getNextListDepth:()=>Pm,handleBackspace:()=>Fp,handleDelete:()=>Hp,hasListBefore:()=>zx,hasListItemAfter:()=>jR,hasListItemBefore:()=>Fx,listItemHasSubList:()=>Hx,nextListIsDeeper:()=>jx,nextListIsHigher:()=>Ux});var ha=(n,e)=>{const{$from:t}=e.selection,o=ht(n,e.schema);let r=null,i=t.depth,s=t.pos,l=null;for(;i>0&&l===null;)r=t.node(i),r.type===o?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Pm=(n,e)=>{const t=ha(n,e);if(!t)return!1;const[,o]=Y$(e,n,t.$pos.pos+4);return o},zx=(n,e,t)=>{const{$anchor:o}=n.selection,r=Math.max(0,o.pos-2),i=n.doc.resolve(r).node();return!(!i||!t.includes(i.type.name))},Fx=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-2);return!(r.index()===0||((t=r.nodeBefore)==null?void 0:t.type.name)!==n)},Hx=(n,e,t)=>{if(!t)return!1;const o=ht(n,e.schema);let r=!1;return t.descendants(i=>{i.type===o&&(r=!0)}),r},Fp=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Rr(n.state,e)&&zx(n.state,e,t)){const{$anchor:l}=n.state.selection,a=n.state.doc.resolve(l.before()-1),u=[];a.node().descendants((p,h)=>{p.type.name===e&&u.push({node:p,pos:h})});const d=u.at(-1);if(!d)return!1;const f=n.state.doc.resolve(a.start()+d.pos+1);return n.chain().cut({from:l.start()-1,to:l.end()+1},f.end()).joinForward().run()}if(!Rr(n.state,e)||!eB(n.state))return!1;const o=ha(e,n.state);if(!o)return!1;const i=n.state.doc.resolve(o.$pos.pos-2).node(o.depth),s=Hx(e,n.state,i);return Fx(e,n.state)&&!s?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},jx=(n,e)=>{const t=Pm(n,e),o=ha(n,e);return!o||!t?!1:t>o.depth},Ux=(n,e)=>{const t=Pm(n,e),o=ha(n,e);return!o||!t?!1:t<o.depth},Hp=(n,e)=>{if(!Rr(n.state,e)||!Z$(n.state,e))return!1;const{selection:t}=n.state,{$from:o,$to:r}=t;return!t.empty&&o.sameParent(r)?!1:jx(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():Ux(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},jR=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-o.parentOffset-2);return!(r.index()===r.parent.childCount-1||((t=r.nodeAfter)==null?void 0:t.type.name)!==n)},Wx=ve.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Hp(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Hp(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Fp(n,t,o)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Fp(n,t,o)&&(e=!0)}),e}}}}),$b=/^(\s*)(\d+)\.\s+(.*)$/,UR=/^\s/;function WR(n){const e=[];let t=0,o=0;for(;t<n.length;){const r=n[t],i=r.match($b);if(!i)break;const[,s,l,a]=i,u=s.length;let d=a,f=t+1;const p=[r];for(;f<n.length;){const h=n[f];if(h.match($b))break;if(h.trim()==="")p.push(h),d+=`
|
|
134
|
+
`,f+=1;else if(h.match(UR))p.push(h),d+=`
|
|
135
|
+
${h.slice(u+2)}`,f+=1;else break}e.push({indent:u,number:parseInt(l,10),content:d.trim(),raw:p.join(`
|
|
136
|
+
`)}),o=f,t=f}return[e,o]}function qx(n,e,t){var o;const r=[];let i=0;for(;i<n.length;){const s=n[i];if(s.indent===e){const l=s.content.split(`
|
|
137
|
+
`),a=((o=l[0])==null?void 0:o.trim())||"",u=[];a&&u.push({type:"paragraph",raw:a,tokens:t.inlineTokens(a)});const d=l.slice(1).join(`
|
|
138
|
+
`).trim();if(d){const h=t.blockTokens(d);u.push(...h)}let f=i+1;const p=[];for(;f<n.length&&n[f].indent>e;)p.push(n[f]),f+=1;if(p.length>0){const h=Math.min(...p.map(g=>g.indent)),m=qx(p,h,t);u.push({type:"list",ordered:!0,start:p[0].number,items:m,raw:p.map(g=>g.raw).join(`
|
|
139
|
+
`)})}r.push({type:"list_item",raw:s.raw,tokens:u}),i=f}else i+=1}return r}function qR(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const o=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(r=>{if(r.type==="paragraph"||r.type==="list"||r.type==="blockquote"||r.type==="code")o.push(...e.parseChildren([r]));else if(r.type==="text"&&r.tokens){const i=e.parseChildren([r]);o.push({type:"paragraph",content:i})}else{const i=e.parseChildren([r]);i.length>0&&o.push(...i)}}),{type:"listItem",content:o}})}var KR="listItem",Bb="textStyle",Rb=/^(\d+)\.\s$/,Kx=Ie.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",he(this.options.HTMLAttributes,t),0]:["ol",he(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,o=n.items?qR(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:o}:{type:"orderedList",content:o}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
140
|
+
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var o;const r=n.split(`
|
|
141
|
+
`),[i,s]=WR(r);if(i.length===0)return;const l=qx(i,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((o=i[0])==null?void 0:o.number)||1,items:l,raw:r.slice(0,s).join(`
|
|
142
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(KR,this.editor.getAttributes(Bb)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=ms({find:Rb,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=ms({find:Rb,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Bb)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),JR=/^\s*(\[([( |x])?\])\s$/,Jx=Ie.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",he(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const o=e.parseChildren(n.nestedTokens);t.push(...o)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const r=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Mm(n,e,r)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),u=f=>{var p,h;l.ariaLabel=((h=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:h.call(p,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};u(n),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:p}=f.target;o.isEditable&&typeof t=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=t();if(typeof m!="number")return!1;const g=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:p}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,p)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{r.setAttribute(f,p)}),r.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,i.append(l,s),r.append(i,a),Object.entries(e).forEach(([f,p])=>{r.setAttribute(f,p)});let d=new Set(Object.keys(e));return{dom:r,contentDOM:a,update:f=>{if(f.type!==this.type)return!1;r.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,u(f);const p=o.extensionManager.attributes,h=Pl(f,p),m=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return d.forEach(y=>{m.has(y)||(y in g?r.setAttribute(y,g[y]):r.removeAttribute(y))}),Object.entries(h).forEach(([y,b])=>{b==null?y in g?r.setAttribute(y,g[y]):r.removeAttribute(y):r.setAttribute(y,b)}),d=m,!0}}}},addInputRules(){return[ms({find:JR,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),Vm=Ie.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",he(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
143
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const o=i=>{const s=$p(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:o},t);return s?[{type:"taskList",raw:s.raw,items:s.items}]:t.blockTokens(i)},r=$p(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:o},t);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});ve.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(Px.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(Vx.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(Wx.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(Kx.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(Jx.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push(Vm.configure(this.options.taskList)),n}});var Gx=Ie.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",he(this.options.HTMLAttributes,n),0]},parseMarkdown:(n,e)=>{const t=n.tokens||[];return t.length===1&&t[0].type==="image"?e.parseChildren([t[0]]):e.createNode("paragraph",void 0,e.parseInline(t))},renderMarkdown:(n,e)=>!n||!Array.isArray(n.content)?"":e.renderChildren(n.content),addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),GR=Gx,XR=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,YR=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,QR=eo.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",he(this.options.HTMLAttributes,n),0]},markdownTokenName:"del",parseMarkdown:(n,e)=>e.applyMark("strike",e.parseInline(n.tokens||[])),renderMarkdown:(n,e)=>`~~${e.renderChildren(n)}~~`,addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[bi({find:XR,type:this.type})]},addPasteRules(){return[_r({find:YR,type:this.type})]}}),ZR=Ie.create({name:"text",group:"inline",parseMarkdown:n=>({type:"text",text:n.text||""}),renderMarkdown:n=>n.text||""}),Xx=eo.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",he(this.options.HTMLAttributes,n),0]},parseMarkdown(n,e){return e.applyMark(this.name||"underline",e.parseInline(n.tokens||[]))},renderMarkdown(n,e){return`++${e.renderChildren(n)}++`},markdownTokenizer:{name:"underline",level:"inline",start(n){return n.indexOf("++")},tokenize(n,e,t){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(n);if(!r)return;const i=r[2].trim();return{type:"underline",raw:r[0],text:i,tokens:t.inlineTokens(i)}}},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Yx=Xx;function e_(n={}){return new ue({view(e){return new t_(e,n)}})}class t_{constructor(e,t){var o;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(o=t.width)!==null&&o!==void 0?o:1,this.color=t.color===!1?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(r=>{let i=s=>{this[r](s)};return e.dom.addEventListener(r,i),{name:r,handler:i}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){this.cursorPos!=null&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,e==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e=this.editorView.state.doc.resolve(this.cursorPos),t=!e.parent.inlineContent,o,r=this.editorView.dom,i=r.getBoundingClientRect(),s=i.width/r.offsetWidth,l=i.height/r.offsetHeight;if(t){let f=e.nodeBefore,p=e.nodeAfter;if(f||p){let h=this.editorView.nodeDOM(this.cursorPos-(f?f.nodeSize:0));if(h){let m=h.getBoundingClientRect(),g=f?m.bottom:m.top;f&&p&&(g=(g+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let y=this.width/2*l;o={left:m.left,right:m.right,top:g-y,bottom:g+y}}}}if(!o){let f=this.editorView.coordsAtPos(this.cursorPos),p=this.width/2*s;o={left:f.left-p,right:f.left+p,top:f.top,bottom:f.bottom}}let a=this.editorView.dom.offsetParent;this.element||(this.element=a.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",t),this.element.classList.toggle("prosemirror-dropcursor-inline",!t);let u,d;if(!a||a==document.body&&getComputedStyle(a).position=="static")u=-pageXOffset,d=-pageYOffset;else{let f=a.getBoundingClientRect(),p=f.width/a.offsetWidth,h=f.height/a.offsetHeight;u=f.left-a.scrollLeft*p,d=f.top-a.scrollTop*h}this.element.style.left=(o.left-u)/s+"px",this.element.style.top=(o.top-d)/l+"px",this.element.style.width=(o.right-o.left)/s+"px",this.element.style.height=(o.bottom-o.top)/l+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),o=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=o&&o.type.spec.disableDropCursor,i=typeof r=="function"?r(this.editorView,t,e):r;if(t&&!i){let s=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let l=Lw(this.editorView.state.doc,s,this.editorView.dragging.slice);l!=null&&(s=l)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class et extends se{constructor(e){super(e,e)}map(e,t){let o=e.resolve(t.map(this.head));return et.valid(o)?new et(o):se.near(o)}content(){return H.empty}eq(e){return e instanceof et&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new et(e.resolve(t.pos))}getBookmark(){return new zm(this.anchor)}static valid(e){let t=e.parent;if(t.isTextblock||!n_(e)||!o_(e))return!1;let o=t.type.spec.allowGapCursor;if(o!=null)return o;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,o=!1){e:for(;;){if(!o&&et.valid(e))return e;let r=e.pos,i=null;for(let s=e.depth;;s--){let l=e.node(s);if(t>0?e.indexAfter(s)<l.childCount:e.index(s)>0){i=l.child(t>0?e.indexAfter(s):e.index(s)-1);break}else if(s==0)return null;r+=t;let a=e.doc.resolve(r);if(et.valid(a))return a}for(;;){let s=t>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!Q.isSelectable(i)){e=e.doc.resolve(r+i.nodeSize*t),o=!1;continue e}break}i=s,r+=t;let l=e.doc.resolve(r);if(et.valid(l))return l}return null}}}et.prototype.visible=!1;et.findFrom=et.findGapCursorFrom;se.jsonID("gapcursor",et);class zm{constructor(e){this.pos=e}map(e){return new zm(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return et.valid(t)?new et(t):se.near(t)}}function Qx(n){return n.isAtom||n.spec.isolating||n.spec.createGapCursor}function n_(n){for(let e=n.depth;e>=0;e--){let t=n.index(e),o=n.node(e);if(t==0){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(t-1);;r=r.lastChild){if(r.childCount==0&&!r.inlineContent||Qx(r.type))return!0;if(r.inlineContent)return!1}}return!0}function o_(n){for(let e=n.depth;e>=0;e--){let t=n.indexAfter(e),o=n.node(e);if(t==o.childCount){if(o.type.spec.isolating)return!0;continue}for(let r=o.child(t);;r=r.firstChild){if(r.childCount==0&&!r.inlineContent||Qx(r.type))return!0;if(r.inlineContent)return!1}}return!0}function r_(){return new ue({props:{decorations:a_,createSelectionBetween(n,e,t){return e.pos==t.pos&&et.valid(t)?new et(t):null},handleClick:s_,handleKeyDown:i_,handleDOMEvents:{beforeinput:l_}}})}const i_=dm({ArrowLeft:Fa("horiz",-1),ArrowRight:Fa("horiz",1),ArrowUp:Fa("vert",-1),ArrowDown:Fa("vert",1)});function Fa(n,e){const t=n=="vert"?e>0?"down":"up":e>0?"right":"left";return function(o,r,i){let s=o.selection,l=e>0?s.$to:s.$from,a=s.empty;if(s instanceof q){if(!i.endOfTextblock(t)||l.depth==0)return!1;a=!1,l=o.doc.resolve(e>0?l.after():l.before())}let u=et.findGapCursorFrom(l,e,a);return u?(r&&r(o.tr.setSelection(new et(u))),!0):!1}}function s_(n,e,t){if(!n||!n.editable)return!1;let o=n.state.doc.resolve(e);if(!et.valid(o))return!1;let r=n.posAtCoords({left:t.clientX,top:t.clientY});return r&&r.inside>-1&&Q.isSelectable(n.state.doc.nodeAt(r.inside))?!1:(n.dispatch(n.state.tr.setSelection(new et(o))),!0)}function l_(n,e){if(e.inputType!="insertCompositionText"||!(n.state.selection instanceof et))return!1;let{$from:t}=n.state.selection,o=t.parent.contentMatchAt(t.index()).findWrapping(n.state.schema.nodes.text);if(!o)return!1;let r=D.empty;for(let s=o.length-1;s>=0;s--)r=D.from(o[s].createAndFill(null,r));let i=n.state.tr.replace(t.pos,t.pos,new H(r,0,0));return i.setSelection(q.near(i.doc.resolve(t.pos+1))),n.dispatch(i),!1}function a_(n){if(!(n.selection instanceof et))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",Se.create(n.doc,[Ve.widget(n.selection.head,e,{key:"gapcursor"})])}var ku=200,St=function(){};St.prototype.append=function(e){return e.length?(e=St.from(e),!this.length&&e||e.length<ku&&this.leafAppend(e)||this.length<ku&&e.leafPrepend(this)||this.appendInner(e)):this};St.prototype.prepend=function(e){return e.length?St.from(e).append(this):this};St.prototype.appendInner=function(e){return new c_(this,e)};St.prototype.slice=function(e,t){return e===void 0&&(e=0),t===void 0&&(t=this.length),e>=t?St.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))};St.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)};St.prototype.forEach=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length),t<=o?this.forEachInner(e,t,o,0):this.forEachInvertedInner(e,t,o,0)};St.prototype.map=function(e,t,o){t===void 0&&(t=0),o===void 0&&(o=this.length);var r=[];return this.forEach(function(i,s){return r.push(e(i,s))},t,o),r};St.from=function(e){return e instanceof St?e:e&&e.length?new Zx(e):St.empty};var Zx=(function(n){function e(o){n.call(this),this.values=o}n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e;var t={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(r,i){return r==0&&i==this.length?this:new e(this.values.slice(r,i))},e.prototype.getInner=function(r){return this.values[r]},e.prototype.forEachInner=function(r,i,s,l){for(var a=i;a<s;a++)if(r(this.values[a],l+a)===!1)return!1},e.prototype.forEachInvertedInner=function(r,i,s,l){for(var a=i-1;a>=s;a--)if(r(this.values[a],l+a)===!1)return!1},e.prototype.leafAppend=function(r){if(this.length+r.length<=ku)return new e(this.values.concat(r.flatten()))},e.prototype.leafPrepend=function(r){if(this.length+r.length<=ku)return new e(r.flatten().concat(this.values))},t.length.get=function(){return this.values.length},t.depth.get=function(){return 0},Object.defineProperties(e.prototype,t),e})(St);St.empty=new Zx([]);var c_=(function(n){function e(t,o){n.call(this),this.left=t,this.right=o,this.length=t.length+o.length,this.depth=Math.max(t.depth,o.depth)+1}return n&&(e.__proto__=n),e.prototype=Object.create(n&&n.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(o){return o<this.left.length?this.left.get(o):this.right.get(o-this.left.length)},e.prototype.forEachInner=function(o,r,i,s){var l=this.left.length;if(r<l&&this.left.forEachInner(o,r,Math.min(i,l),s)===!1||i>l&&this.right.forEachInner(o,Math.max(r-l,0),Math.min(this.length,i)-l,s+l)===!1)return!1},e.prototype.forEachInvertedInner=function(o,r,i,s){var l=this.left.length;if(r>l&&this.right.forEachInvertedInner(o,r-l,Math.max(i,l)-l,s+l)===!1||i<l&&this.left.forEachInvertedInner(o,Math.min(r,l),i,s)===!1)return!1},e.prototype.sliceInner=function(o,r){if(o==0&&r==this.length)return this;var i=this.left.length;return r<=i?this.left.slice(o,r):o>=i?this.right.slice(o-i,r-i):this.left.slice(o,i).append(this.right.slice(0,r-i))},e.prototype.leafAppend=function(o){var r=this.right.leafAppend(o);if(r)return new e(this.left,r)},e.prototype.leafPrepend=function(o){var r=this.left.leafPrepend(o);if(r)return new e(r,this.right)},e.prototype.appendInner=function(o){return this.left.depth>=Math.max(this.right.depth,o.depth)+1?new e(this.left,new e(this.right,o)):new e(this,o)},e})(St);const u_=500;class Wn{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(this.eventCount==0)return null;let o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}let r,i;t&&(r=this.remapping(o,this.items.length),i=r.maps.length);let s=e.tr,l,a,u=[],d=[];return this.items.forEach((f,p)=>{if(!f.step){r||(r=this.remapping(o,p+1),i=r.maps.length),i--,d.push(f);return}if(r){d.push(new ho(f.map));let h=f.step.map(r.slice(i)),m;h&&s.maybeStep(h).doc&&(m=s.mapping.maps[s.mapping.maps.length-1],u.push(new ho(m,void 0,void 0,u.length+d.length))),i--,m&&r.appendMap(m,i)}else s.maybeStep(f.step);if(f.selection)return l=r?f.selection.map(r.slice(i)):f.selection,a=new Wn(this.items.slice(0,o).append(d.reverse().concat(u)),this.eventCount-1),!1},this.items.length,0),{remaining:a,transform:s,selection:l}}addTransform(e,t,o,r){let i=[],s=this.eventCount,l=this.items,a=!r&&l.length?l.get(l.length-1):null;for(let d=0;d<e.steps.length;d++){let f=e.steps[d].invert(e.docs[d]),p=new ho(e.mapping.maps[d],f,t),h;(h=a&&a.merge(p))&&(p=h,d?i.pop():l=l.slice(0,l.length-1)),i.push(p),t&&(s++,t=void 0),r||(a=p)}let u=s-o.depth;return u>f_&&(l=d_(l,u),s-=u),new Wn(l.append(i),s)}remapping(e,t){let o=new $l;return this.items.forEach((r,i)=>{let s=r.mirrorOffset!=null&&i-r.mirrorOffset>=e?o.maps.length-r.mirrorOffset:void 0;o.appendMap(r.map,s)},e,t),o}addMaps(e){return this.eventCount==0?this:new Wn(this.items.append(e.map(t=>new ho(t))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let o=[],r=Math.max(0,this.items.length-t),i=e.mapping,s=e.steps.length,l=this.eventCount;this.items.forEach(p=>{p.selection&&l--},r);let a=t;this.items.forEach(p=>{let h=i.getMirror(--a);if(h==null)return;s=Math.min(s,h);let m=i.maps[h];if(p.step){let g=e.steps[h].invert(e.docs[h]),y=p.selection&&p.selection.map(i.slice(a+1,h));y&&l++,o.push(new ho(m,g,y))}else o.push(new ho(m))},r);let u=[];for(let p=t;p<s;p++)u.push(new ho(i.maps[p]));let d=this.items.slice(0,r).append(u).append(o),f=new Wn(d,l);return f.emptyItemCount()>u_&&(f=f.compress(this.items.length-o.length)),f}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),o=t.maps.length,r=[],i=0;return this.items.forEach((s,l)=>{if(l>=e)r.push(s),s.selection&&i++;else if(s.step){let a=s.step.map(t.slice(o)),u=a&&a.getMap();if(o--,u&&t.appendMap(u,o),a){let d=s.selection&&s.selection.map(t.slice(o));d&&i++;let f=new ho(u.invert(),a,d),p,h=r.length-1;(p=r.length&&r[h].merge(f))?r[h]=p:r.push(f)}}else s.map&&o--},this.items.length,0),new Wn(St.from(r.reverse()),i)}}Wn.empty=new Wn(St.empty,0);function d_(n,e){let t;return n.forEach((o,r)=>{if(o.selection&&e--==0)return t=r,!1}),n.slice(t)}class ho{constructor(e,t,o,r){this.map=e,this.step=t,this.selection=o,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ho(t.getMap().invert(),t,this.selection)}}}class hr{constructor(e,t,o,r,i){this.done=e,this.undone=t,this.prevRanges=o,this.prevTime=r,this.prevComposition=i}}const f_=20;function p_(n,e,t,o){let r=t.getMeta(ri),i;if(r)return r.historyState;t.getMeta(g_)&&(n=new hr(n.done,n.undone,null,0,-1));let s=t.getMeta("appendedTransaction");if(t.steps.length==0)return n;if(s&&s.getMeta(ri))return s.getMeta(ri).redo?new hr(n.done.addTransform(t,void 0,o,hc(e)),n.undone,_b(t.mapping.maps),n.prevTime,n.prevComposition):new hr(n.done,n.undone.addTransform(t,void 0,o,hc(e)),null,n.prevTime,n.prevComposition);if(t.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let l=t.getMeta("composition"),a=n.prevTime==0||!s&&n.prevComposition!=l&&(n.prevTime<(t.time||0)-o.newGroupDelay||!h_(t,n.prevRanges)),u=s?Of(n.prevRanges,t.mapping):_b(t.mapping.maps);return new hr(n.done.addTransform(t,a?e.selection.getBookmark():void 0,o,hc(e)),Wn.empty,u,t.time,l??n.prevComposition)}else return(i=t.getMeta("rebased"))?new hr(n.done.rebased(t,i),n.undone.rebased(t,i),Of(n.prevRanges,t.mapping),n.prevTime,n.prevComposition):new hr(n.done.addMaps(t.mapping.maps),n.undone.addMaps(t.mapping.maps),Of(n.prevRanges,t.mapping),n.prevTime,n.prevComposition)}function h_(n,e){if(!e)return!1;if(!n.docChanged)return!0;let t=!1;return n.mapping.maps[0].forEach((o,r)=>{for(let i=0;i<e.length;i+=2)o<=e[i+1]&&r>=e[i]&&(t=!0)}),t}function _b(n){let e=[];for(let t=n.length-1;t>=0&&e.length==0;t--)n[t].forEach((o,r,i,s)=>e.push(i,s));return e}function Of(n,e){if(!n)return null;let t=[];for(let o=0;o<n.length;o+=2){let r=e.map(n[o],1),i=e.map(n[o+1],-1);r<=i&&t.push(r,i)}return t}function m_(n,e,t){let o=hc(e),r=ri.get(e).spec.config,i=(t?n.undone:n.done).popEvent(e,o);if(!i)return null;let s=i.selection.resolve(i.transform.doc),l=(t?n.done:n.undone).addTransform(i.transform,e.selection.getBookmark(),r,o),a=new hr(t?l:i.remaining,t?i.remaining:l,null,0,-1);return i.transform.setSelection(s).setMeta(ri,{redo:t,historyState:a})}let $f=!1,Db=null;function hc(n){let e=n.plugins;if(Db!=e){$f=!1,Db=e;for(let t=0;t<e.length;t++)if(e[t].spec.historyPreserveItems){$f=!0;break}}return $f}const ri=new ce("history"),g_=new ce("closeHistory");function y_(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new ue({key:ri,state:{init(){return new hr(Wn.empty,Wn.empty,null,0,-1)},apply(e,t,o){return p_(t,o,e,n)}},config:n,props:{handleDOMEvents:{beforeinput(e,t){let o=t.inputType,r=o=="historyUndo"?t1:o=="historyRedo"?n1:null;return!r||!e.editable?!1:(t.preventDefault(),r(e.state,e.dispatch))}}}})}function e1(n,e){return(t,o)=>{let r=ri.getState(t);if(!r||(n?r.undone:r.done).eventCount==0)return!1;if(o){let i=m_(r,t,n);i&&o(e?i.scrollIntoView():i)}return!0}}const t1=e1(!1,!0),n1=e1(!0,!0);ve.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:n=>n.length,wordCounter:n=>n.split(" ").filter(e=>e!=="").length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc;if(((n==null?void 0:n.mode)||this.options.mode)==="textSize"){const o=e.textBetween(0,e.content.size,void 0," ");return this.options.textCounter(o)}return e.nodeSize},this.storage.words=n=>{const e=(n==null?void 0:n.node)||this.editor.state.doc,t=e.textBetween(0,e.content.size," "," ");return this.options.wordCounter(t)}},addProseMirrorPlugins(){let n=!1;return[new ue({key:new ce("characterCount"),appendTransaction:(e,t,o)=>{if(n)return;const r=this.options.limit;if(r==null||r===0){n=!0;return}const i=this.storage.characters({node:o.doc});if(i>r){const s=i-r,l=0,a=s;console.warn(`[CharacterCount] Initial content exceeded limit of ${r} characters. Content was automatically trimmed.`);const u=o.tr.deleteRange(l,a);return n=!0,u}n=!0},filterTransaction:(e,t)=>{const o=this.options.limit;if(!e.docChanged||o===0||o===null||o===void 0)return!0;const r=this.storage.characters({node:t.doc}),i=this.storage.characters({node:e.doc});if(i<=o||r>o&&i>o&&i<=r)return!0;if(r>o&&i>o&&i>r||!e.getMeta("paste"))return!1;const l=e.selection.$head.pos,a=i-o,u=l-a,d=l;return e.deleteRange(u,d),!(this.storage.characters({node:e.doc})>o)}})]}});var b_=ve.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[e_(this.options)]}}),o1=ve.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ue({key:new ce("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!t||!o)return Se.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((a,u)=>{if(a.isText)return;if(!(r>=u&&r<=u+a.nodeSize-1))return!1;s+=1});let l=0;return n.descendants((a,u)=>{if(a.isText||!(r>=u&&r<=u+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ve.node(u,u+a.nodeSize,{class:this.options.className}))}),Se.create(n,i)}}})]}}),v_=ve.create({name:"gapCursor",addProseMirrorPlugins(){return[r_()]},extendNodeSchema(n){var e;const t={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(e=_e(re(n,"allowGapCursor",t)))!=null?e:null}}});ve.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new ue({key:new ce("placeholder"),props:{decorations:({doc:n,selection:e})=>{const t=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=e,r=[];if(!t)return null;const i=this.editor.isEmpty;return n.descendants((s,l)=>{const a=o>=l&&o<=l+s.nodeSize,u=!s.isLeaf&&pd(s);if((a||!this.options.showOnlyCurrent)&&u){const d=[this.options.emptyNodeClass];i&&d.push(this.options.emptyEditorClass);const f=Ve.node(l,l+s.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:l,hasAnchor:a}):this.options.placeholder});r.push(f)}return this.options.includeChildren}),Se.create(n,r)}}})]}});ve.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:n,options:e}=this;return[new ue({key:new ce("selection"),props:{decorations(t){return t.selection.empty||n.isFocused||!n.isEditable||ex(t.selection)||n.view.dragging?null:Se.create(t.doc,[Ve.inline(t.selection.from,t.selection.to,{class:e.className})])}}})]}});function Ib({types:n,node:e}){return e&&Array.isArray(n)&&n.includes(e.type)||(e==null?void 0:e.type)===n}var k_=ve.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var n;const e=new ce(this.name),t=this.options.node||((n=this.editor.schema.topNodeType.contentMatch.defaultType)==null?void 0:n.name)||"paragraph",o=Object.entries(this.editor.schema.nodes).map(([,r])=>r).filter(r=>(this.options.notAfter||[]).concat(t).includes(r.name));return[new ue({key:e,appendTransaction:(r,i,s)=>{const{doc:l,tr:a,schema:u}=s,d=e.getState(s),f=l.content.size,p=u.nodes[t];if(d)return a.insert(f,p.create())},state:{init:(r,i)=>{const s=i.tr.doc.lastChild;return!Ib({node:s,types:o})},apply:(r,i)=>{if(!r.docChanged||r.getMeta("__uniqueIDTransaction"))return i;const s=r.doc.lastChild;return!Ib({node:s,types:o})}}})]}}),w_=ve.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:e})=>t1(n,e),redo:()=>({state:n,dispatch:e})=>n1(n,e)}},addProseMirrorPlugins(){return[y_(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-я":()=>this.editor.commands.undo(),"Shift-Mod-я":()=>this.editor.commands.redo()}}}),x_=ve.create({name:"starterKit",addExtensions(){var n,e,t,o;const r=[];return this.options.bold!==!1&&r.push(eR.configure(this.options.bold)),this.options.blockquote!==!1&&r.push(Cx.configure(this.options.blockquote)),this.options.bulletList!==!1&&r.push(Px.configure(this.options.bulletList)),this.options.code!==!1&&r.push(oR.configure(this.options.code)),this.options.codeBlock!==!1&&r.push(Sx.configure(this.options.codeBlock)),this.options.document!==!1&&r.push(Ex.configure(this.options.document)),this.options.dropcursor!==!1&&r.push(b_.configure(this.options.dropcursor)),this.options.gapcursor!==!1&&r.push(v_.configure(this.options.gapcursor)),this.options.hardBreak!==!1&&r.push(lR.configure(this.options.hardBreak)),this.options.heading!==!1&&r.push(Mx.configure(this.options.heading)),this.options.undoRedo!==!1&&r.push(w_.configure(this.options.undoRedo)),this.options.horizontalRule!==!1&&r.push(Tx.configure(this.options.horizontalRule)),this.options.italic!==!1&&r.push(hR.configure(this.options.italic)),this.options.listItem!==!1&&r.push(Vx.configure(this.options.listItem)),this.options.listKeymap!==!1&&r.push(Wx.configure((n=this.options)==null?void 0:n.listKeymap)),this.options.link!==!1&&r.push(Lx.configure((e=this.options)==null?void 0:e.link)),this.options.orderedList!==!1&&r.push(Kx.configure(this.options.orderedList)),this.options.paragraph!==!1&&r.push(Gx.configure(this.options.paragraph)),this.options.strike!==!1&&r.push(QR.configure(this.options.strike)),this.options.text!==!1&&r.push(ZR.configure(this.options.text)),this.options.underline!==!1&&r.push(Xx.configure((t=this.options)==null?void 0:t.underline)),this.options.trailingNode!==!1&&r.push(k_.configure((o=this.options)==null?void 0:o.trailingNode)),r}}),C_=x_;const X=c.defineComponent({name:"ICon",__name:"OIcon",props:{name:{type:String,default:""},color:{type:String,default:""},small:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("span",{class:c.normalizeClass(["o-icon",{small:n.small}]),style:c.normalizeStyle({color:n.color})},[c.createElementVNode("i",{class:c.normalizeClass(["yiitip-icon",`icon-${n.name}`])},null,2)],6))}});var dn="top",Pn="bottom",Vn="right",fn="left",Fm="auto",ma=[dn,Pn,Vn,fn],gs="start",Fl="end",S_="clippingParents",r1="viewport",Ws="popper",E_="reference",Lb=ma.reduce(function(n,e){return n.concat([e+"-"+gs,e+"-"+Fl])},[]),i1=[].concat(ma,[Fm]).reduce(function(n,e){return n.concat([e,e+"-"+gs,e+"-"+Fl])},[]),M_="beforeRead",T_="read",N_="afterRead",A_="beforeMain",O_="main",$_="afterMain",B_="beforeWrite",R_="write",__="afterWrite",D_=[M_,T_,N_,A_,O_,$_,B_,R_,__];function So(n){return n?(n.nodeName||"").toLowerCase():null}function Sn(n){if(n==null)return window;if(n.toString()!=="[object Window]"){var e=n.ownerDocument;return e&&e.defaultView||window}return n}function vi(n){var e=Sn(n).Element;return n instanceof e||n instanceof Element}function Ln(n){var e=Sn(n).HTMLElement;return n instanceof e||n instanceof HTMLElement}function Hm(n){if(typeof ShadowRoot>"u")return!1;var e=Sn(n).ShadowRoot;return n instanceof e||n instanceof ShadowRoot}function I_(n){var e=n.state;Object.keys(e.elements).forEach(function(t){var o=e.styles[t]||{},r=e.attributes[t]||{},i=e.elements[t];!Ln(i)||!So(i)||(Object.assign(i.style,o),Object.keys(r).forEach(function(s){var l=r[s];l===!1?i.removeAttribute(s):i.setAttribute(s,l===!0?"":l)}))})}function L_(n){var e=n.state,t={popper:{position:e.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};return Object.assign(e.elements.popper.style,t.popper),e.styles=t,e.elements.arrow&&Object.assign(e.elements.arrow.style,t.arrow),function(){Object.keys(e.elements).forEach(function(o){var r=e.elements[o],i=e.attributes[o]||{},s=Object.keys(e.styles.hasOwnProperty(o)?e.styles[o]:t[o]),l=s.reduce(function(a,u){return a[u]="",a},{});!Ln(r)||!So(r)||(Object.assign(r.style,l),Object.keys(i).forEach(function(a){r.removeAttribute(a)}))})}}const s1={name:"applyStyles",enabled:!0,phase:"write",fn:I_,effect:L_,requires:["computeStyles"]};function bo(n){return n.split("-")[0]}var ii=Math.max,wu=Math.min,ys=Math.round;function jp(){var n=navigator.userAgentData;return n!=null&&n.brands&&Array.isArray(n.brands)?n.brands.map(function(e){return e.brand+"/"+e.version}).join(" "):navigator.userAgent}function l1(){return!/^((?!chrome|android).)*safari/i.test(jp())}function bs(n,e,t){e===void 0&&(e=!1),t===void 0&&(t=!1);var o=n.getBoundingClientRect(),r=1,i=1;e&&Ln(n)&&(r=n.offsetWidth>0&&ys(o.width)/n.offsetWidth||1,i=n.offsetHeight>0&&ys(o.height)/n.offsetHeight||1);var s=vi(n)?Sn(n):window,l=s.visualViewport,a=!l1()&&t,u=(o.left+(a&&l?l.offsetLeft:0))/r,d=(o.top+(a&&l?l.offsetTop:0))/i,f=o.width/r,p=o.height/i;return{width:f,height:p,top:d,right:u+f,bottom:d+p,left:u,x:u,y:d}}function jm(n){var e=bs(n),t=n.offsetWidth,o=n.offsetHeight;return Math.abs(e.width-t)<=1&&(t=e.width),Math.abs(e.height-o)<=1&&(o=e.height),{x:n.offsetLeft,y:n.offsetTop,width:t,height:o}}function a1(n,e){var t=e.getRootNode&&e.getRootNode();if(n.contains(e))return!0;if(t&&Hm(t)){var o=e;do{if(o&&n.isSameNode(o))return!0;o=o.parentNode||o.host}while(o)}return!1}function Qo(n){return Sn(n).getComputedStyle(n)}function P_(n){return["table","td","th"].indexOf(So(n))>=0}function zr(n){return((vi(n)?n.ownerDocument:n.document)||window.document).documentElement}function vd(n){return So(n)==="html"?n:n.assignedSlot||n.parentNode||(Hm(n)?n.host:null)||zr(n)}function Pb(n){return!Ln(n)||Qo(n).position==="fixed"?null:n.offsetParent}function V_(n){var e=/firefox/i.test(jp()),t=/Trident/i.test(jp());if(t&&Ln(n)){var o=Qo(n);if(o.position==="fixed")return null}var r=vd(n);for(Hm(r)&&(r=r.host);Ln(r)&&["html","body"].indexOf(So(r))<0;){var i=Qo(r);if(i.transform!=="none"||i.perspective!=="none"||i.contain==="paint"||["transform","perspective"].indexOf(i.willChange)!==-1||e&&i.willChange==="filter"||e&&i.filter&&i.filter!=="none")return r;r=r.parentNode}return null}function ga(n){for(var e=Sn(n),t=Pb(n);t&&P_(t)&&Qo(t).position==="static";)t=Pb(t);return t&&(So(t)==="html"||So(t)==="body"&&Qo(t).position==="static")?e:t||V_(n)||e}function Um(n){return["top","bottom"].indexOf(n)>=0?"x":"y"}function bl(n,e,t){return ii(n,wu(e,t))}function z_(n,e,t){var o=bl(n,e,t);return o>t?t:o}function c1(){return{top:0,right:0,bottom:0,left:0}}function u1(n){return Object.assign({},c1(),n)}function d1(n,e){return e.reduce(function(t,o){return t[o]=n,t},{})}var F_=function(e,t){return e=typeof e=="function"?e(Object.assign({},t.rects,{placement:t.placement})):e,u1(typeof e!="number"?e:d1(e,ma))};function H_(n){var e,t=n.state,o=n.name,r=n.options,i=t.elements.arrow,s=t.modifiersData.popperOffsets,l=bo(t.placement),a=Um(l),u=[fn,Vn].indexOf(l)>=0,d=u?"height":"width";if(!(!i||!s)){var f=F_(r.padding,t),p=jm(i),h=a==="y"?dn:fn,m=a==="y"?Pn:Vn,g=t.rects.reference[d]+t.rects.reference[a]-s[a]-t.rects.popper[d],y=s[a]-t.rects.reference[a],b=ga(i),v=b?a==="y"?b.clientHeight||0:b.clientWidth||0:0,w=g/2-y/2,k=f[h],x=v-p[d]-f[m],C=v/2-p[d]/2+w,S=bl(k,C,x),M=a;t.modifiersData[o]=(e={},e[M]=S,e.centerOffset=S-C,e)}}function j_(n){var e=n.state,t=n.options,o=t.element,r=o===void 0?"[data-popper-arrow]":o;r!=null&&(typeof r=="string"&&(r=e.elements.popper.querySelector(r),!r)||a1(e.elements.popper,r)&&(e.elements.arrow=r))}const U_={name:"arrow",enabled:!0,phase:"main",fn:H_,effect:j_,requires:["popperOffsets"],requiresIfExists:["preventOverflow"]};function vs(n){return n.split("-")[1]}var W_={top:"auto",right:"auto",bottom:"auto",left:"auto"};function q_(n,e){var t=n.x,o=n.y,r=e.devicePixelRatio||1;return{x:ys(t*r)/r||0,y:ys(o*r)/r||0}}function Vb(n){var e,t=n.popper,o=n.popperRect,r=n.placement,i=n.variation,s=n.offsets,l=n.position,a=n.gpuAcceleration,u=n.adaptive,d=n.roundOffsets,f=n.isFixed,p=s.x,h=p===void 0?0:p,m=s.y,g=m===void 0?0:m,y=typeof d=="function"?d({x:h,y:g}):{x:h,y:g};h=y.x,g=y.y;var b=s.hasOwnProperty("x"),v=s.hasOwnProperty("y"),w=fn,k=dn,x=window;if(u){var C=ga(t),S="clientHeight",M="clientWidth";if(C===Sn(t)&&(C=zr(t),Qo(C).position!=="static"&&l==="absolute"&&(S="scrollHeight",M="scrollWidth")),C=C,r===dn||(r===fn||r===Vn)&&i===Fl){k=Pn;var N=f&&C===x&&x.visualViewport?x.visualViewport.height:C[S];g-=N-o.height,g*=a?1:-1}if(r===fn||(r===dn||r===Pn)&&i===Fl){w=Vn;var A=f&&C===x&&x.visualViewport?x.visualViewport.width:C[M];h-=A-o.width,h*=a?1:-1}}var $=Object.assign({position:l},u&&W_),O=d===!0?q_({x:h,y:g},Sn(t)):{x:h,y:g};if(h=O.x,g=O.y,a){var R;return Object.assign({},$,(R={},R[k]=v?"0":"",R[w]=b?"0":"",R.transform=(x.devicePixelRatio||1)<=1?"translate("+h+"px, "+g+"px)":"translate3d("+h+"px, "+g+"px, 0)",R))}return Object.assign({},$,(e={},e[k]=v?g+"px":"",e[w]=b?h+"px":"",e.transform="",e))}function K_(n){var e=n.state,t=n.options,o=t.gpuAcceleration,r=o===void 0?!0:o,i=t.adaptive,s=i===void 0?!0:i,l=t.roundOffsets,a=l===void 0?!0:l,u={placement:bo(e.placement),variation:vs(e.placement),popper:e.elements.popper,popperRect:e.rects.popper,gpuAcceleration:r,isFixed:e.options.strategy==="fixed"};e.modifiersData.popperOffsets!=null&&(e.styles.popper=Object.assign({},e.styles.popper,Vb(Object.assign({},u,{offsets:e.modifiersData.popperOffsets,position:e.options.strategy,adaptive:s,roundOffsets:a})))),e.modifiersData.arrow!=null&&(e.styles.arrow=Object.assign({},e.styles.arrow,Vb(Object.assign({},u,{offsets:e.modifiersData.arrow,position:"absolute",adaptive:!1,roundOffsets:a})))),e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-placement":e.placement})}const J_={name:"computeStyles",enabled:!0,phase:"beforeWrite",fn:K_,data:{}};var Ha={passive:!0};function G_(n){var e=n.state,t=n.instance,o=n.options,r=o.scroll,i=r===void 0?!0:r,s=o.resize,l=s===void 0?!0:s,a=Sn(e.elements.popper),u=[].concat(e.scrollParents.reference,e.scrollParents.popper);return i&&u.forEach(function(d){d.addEventListener("scroll",t.update,Ha)}),l&&a.addEventListener("resize",t.update,Ha),function(){i&&u.forEach(function(d){d.removeEventListener("scroll",t.update,Ha)}),l&&a.removeEventListener("resize",t.update,Ha)}}const X_={name:"eventListeners",enabled:!0,phase:"write",fn:function(){},effect:G_,data:{}};var Y_={left:"right",right:"left",bottom:"top",top:"bottom"};function mc(n){return n.replace(/left|right|bottom|top/g,function(e){return Y_[e]})}var Q_={start:"end",end:"start"};function zb(n){return n.replace(/start|end/g,function(e){return Q_[e]})}function Wm(n){var e=Sn(n),t=e.pageXOffset,o=e.pageYOffset;return{scrollLeft:t,scrollTop:o}}function qm(n){return bs(zr(n)).left+Wm(n).scrollLeft}function Z_(n,e){var t=Sn(n),o=zr(n),r=t.visualViewport,i=o.clientWidth,s=o.clientHeight,l=0,a=0;if(r){i=r.width,s=r.height;var u=l1();(u||!u&&e==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}return{width:i,height:s,x:l+qm(n),y:a}}function eD(n){var e,t=zr(n),o=Wm(n),r=(e=n.ownerDocument)==null?void 0:e.body,i=ii(t.scrollWidth,t.clientWidth,r?r.scrollWidth:0,r?r.clientWidth:0),s=ii(t.scrollHeight,t.clientHeight,r?r.scrollHeight:0,r?r.clientHeight:0),l=-o.scrollLeft+qm(n),a=-o.scrollTop;return Qo(r||t).direction==="rtl"&&(l+=ii(t.clientWidth,r?r.clientWidth:0)-i),{width:i,height:s,x:l,y:a}}function Km(n){var e=Qo(n),t=e.overflow,o=e.overflowX,r=e.overflowY;return/auto|scroll|overlay|hidden/.test(t+r+o)}function f1(n){return["html","body","#document"].indexOf(So(n))>=0?n.ownerDocument.body:Ln(n)&&Km(n)?n:f1(vd(n))}function vl(n,e){var t;e===void 0&&(e=[]);var o=f1(n),r=o===((t=n.ownerDocument)==null?void 0:t.body),i=Sn(o),s=r?[i].concat(i.visualViewport||[],Km(o)?o:[]):o,l=e.concat(s);return r?l:l.concat(vl(vd(s)))}function Up(n){return Object.assign({},n,{left:n.x,top:n.y,right:n.x+n.width,bottom:n.y+n.height})}function tD(n,e){var t=bs(n,!1,e==="fixed");return t.top=t.top+n.clientTop,t.left=t.left+n.clientLeft,t.bottom=t.top+n.clientHeight,t.right=t.left+n.clientWidth,t.width=n.clientWidth,t.height=n.clientHeight,t.x=t.left,t.y=t.top,t}function Fb(n,e,t){return e===r1?Up(Z_(n,t)):vi(e)?tD(e,t):Up(eD(zr(n)))}function nD(n){var e=vl(vd(n)),t=["absolute","fixed"].indexOf(Qo(n).position)>=0,o=t&&Ln(n)?ga(n):n;return vi(o)?e.filter(function(r){return vi(r)&&a1(r,o)&&So(r)!=="body"}):[]}function oD(n,e,t,o){var r=e==="clippingParents"?nD(n):[].concat(e),i=[].concat(r,[t]),s=i[0],l=i.reduce(function(a,u){var d=Fb(n,u,o);return a.top=ii(d.top,a.top),a.right=wu(d.right,a.right),a.bottom=wu(d.bottom,a.bottom),a.left=ii(d.left,a.left),a},Fb(n,s,o));return l.width=l.right-l.left,l.height=l.bottom-l.top,l.x=l.left,l.y=l.top,l}function p1(n){var e=n.reference,t=n.element,o=n.placement,r=o?bo(o):null,i=o?vs(o):null,s=e.x+e.width/2-t.width/2,l=e.y+e.height/2-t.height/2,a;switch(r){case dn:a={x:s,y:e.y-t.height};break;case Pn:a={x:s,y:e.y+e.height};break;case Vn:a={x:e.x+e.width,y:l};break;case fn:a={x:e.x-t.width,y:l};break;default:a={x:e.x,y:e.y}}var u=r?Um(r):null;if(u!=null){var d=u==="y"?"height":"width";switch(i){case gs:a[u]=a[u]-(e[d]/2-t[d]/2);break;case Fl:a[u]=a[u]+(e[d]/2-t[d]/2);break}}return a}function Hl(n,e){e===void 0&&(e={});var t=e,o=t.placement,r=o===void 0?n.placement:o,i=t.strategy,s=i===void 0?n.strategy:i,l=t.boundary,a=l===void 0?S_:l,u=t.rootBoundary,d=u===void 0?r1:u,f=t.elementContext,p=f===void 0?Ws:f,h=t.altBoundary,m=h===void 0?!1:h,g=t.padding,y=g===void 0?0:g,b=u1(typeof y!="number"?y:d1(y,ma)),v=p===Ws?E_:Ws,w=n.rects.popper,k=n.elements[m?v:p],x=oD(vi(k)?k:k.contextElement||zr(n.elements.popper),a,d,s),C=bs(n.elements.reference),S=p1({reference:C,element:w,placement:r}),M=Up(Object.assign({},w,S)),N=p===Ws?M:C,A={top:x.top-N.top+b.top,bottom:N.bottom-x.bottom+b.bottom,left:x.left-N.left+b.left,right:N.right-x.right+b.right},$=n.modifiersData.offset;if(p===Ws&&$){var O=$[r];Object.keys(A).forEach(function(R){var I=[Vn,Pn].indexOf(R)>=0?1:-1,L=[dn,Pn].indexOf(R)>=0?"y":"x";A[R]+=O[L]*I})}return A}function rD(n,e){e===void 0&&(e={});var t=e,o=t.placement,r=t.boundary,i=t.rootBoundary,s=t.padding,l=t.flipVariations,a=t.allowedAutoPlacements,u=a===void 0?i1:a,d=vs(o),f=d?l?Lb:Lb.filter(function(m){return vs(m)===d}):ma,p=f.filter(function(m){return u.indexOf(m)>=0});p.length===0&&(p=f);var h=p.reduce(function(m,g){return m[g]=Hl(n,{placement:g,boundary:r,rootBoundary:i,padding:s})[bo(g)],m},{});return Object.keys(h).sort(function(m,g){return h[m]-h[g]})}function iD(n){if(bo(n)===Fm)return[];var e=mc(n);return[zb(n),e,zb(e)]}function sD(n){var e=n.state,t=n.options,o=n.name;if(!e.modifiersData[o]._skip){for(var r=t.mainAxis,i=r===void 0?!0:r,s=t.altAxis,l=s===void 0?!0:s,a=t.fallbackPlacements,u=t.padding,d=t.boundary,f=t.rootBoundary,p=t.altBoundary,h=t.flipVariations,m=h===void 0?!0:h,g=t.allowedAutoPlacements,y=e.options.placement,b=bo(y),v=b===y,w=a||(v||!m?[mc(y)]:iD(y)),k=[y].concat(w).reduce(function(Fe,Te){return Fe.concat(bo(Te)===Fm?rD(e,{placement:Te,boundary:d,rootBoundary:f,padding:u,flipVariations:m,allowedAutoPlacements:g}):Te)},[]),x=e.rects.reference,C=e.rects.popper,S=new Map,M=!0,N=k[0],A=0;A<k.length;A++){var $=k[A],O=bo($),R=vs($)===gs,I=[dn,Pn].indexOf(O)>=0,L=I?"width":"height",B=Hl(e,{placement:$,boundary:d,rootBoundary:f,altBoundary:p,padding:u}),W=I?R?Vn:fn:R?Pn:dn;x[L]>C[L]&&(W=mc(W));var z=mc(W),U=[];if(i&&U.push(B[O]<=0),l&&U.push(B[W]<=0,B[z]<=0),U.every(function(Fe){return Fe})){N=$,M=!1;break}S.set($,U)}if(M)for(var me=m?3:1,Ee=function(Te){var te=k.find(function(we){var Ne=S.get(we);if(Ne)return Ne.slice(0,Te).every(function(gt){return gt})});if(te)return N=te,"break"},Re=me;Re>0;Re--){var Ue=Ee(Re);if(Ue==="break")break}e.placement!==N&&(e.modifiersData[o]._skip=!0,e.placement=N,e.reset=!0)}}const lD={name:"flip",enabled:!0,phase:"main",fn:sD,requiresIfExists:["offset"],data:{_skip:!1}};function Hb(n,e,t){return t===void 0&&(t={x:0,y:0}),{top:n.top-e.height-t.y,right:n.right-e.width+t.x,bottom:n.bottom-e.height+t.y,left:n.left-e.width-t.x}}function jb(n){return[dn,Vn,Pn,fn].some(function(e){return n[e]>=0})}function aD(n){var e=n.state,t=n.name,o=e.rects.reference,r=e.rects.popper,i=e.modifiersData.preventOverflow,s=Hl(e,{elementContext:"reference"}),l=Hl(e,{altBoundary:!0}),a=Hb(s,o),u=Hb(l,r,i),d=jb(a),f=jb(u);e.modifiersData[t]={referenceClippingOffsets:a,popperEscapeOffsets:u,isReferenceHidden:d,hasPopperEscaped:f},e.attributes.popper=Object.assign({},e.attributes.popper,{"data-popper-reference-hidden":d,"data-popper-escaped":f})}const cD={name:"hide",enabled:!0,phase:"main",requiresIfExists:["preventOverflow"],fn:aD};function uD(n,e,t){var o=bo(n),r=[fn,dn].indexOf(o)>=0?-1:1,i=typeof t=="function"?t(Object.assign({},e,{placement:n})):t,s=i[0],l=i[1];return s=s||0,l=(l||0)*r,[fn,Vn].indexOf(o)>=0?{x:l,y:s}:{x:s,y:l}}function dD(n){var e=n.state,t=n.options,o=n.name,r=t.offset,i=r===void 0?[0,0]:r,s=i1.reduce(function(d,f){return d[f]=uD(f,e.rects,i),d},{}),l=s[e.placement],a=l.x,u=l.y;e.modifiersData.popperOffsets!=null&&(e.modifiersData.popperOffsets.x+=a,e.modifiersData.popperOffsets.y+=u),e.modifiersData[o]=s}const fD={name:"offset",enabled:!0,phase:"main",requires:["popperOffsets"],fn:dD};function pD(n){var e=n.state,t=n.name;e.modifiersData[t]=p1({reference:e.rects.reference,element:e.rects.popper,placement:e.placement})}const hD={name:"popperOffsets",enabled:!0,phase:"read",fn:pD,data:{}};function mD(n){return n==="x"?"y":"x"}function gD(n){var e=n.state,t=n.options,o=n.name,r=t.mainAxis,i=r===void 0?!0:r,s=t.altAxis,l=s===void 0?!1:s,a=t.boundary,u=t.rootBoundary,d=t.altBoundary,f=t.padding,p=t.tether,h=p===void 0?!0:p,m=t.tetherOffset,g=m===void 0?0:m,y=Hl(e,{boundary:a,rootBoundary:u,padding:f,altBoundary:d}),b=bo(e.placement),v=vs(e.placement),w=!v,k=Um(b),x=mD(k),C=e.modifiersData.popperOffsets,S=e.rects.reference,M=e.rects.popper,N=typeof g=="function"?g(Object.assign({},e.rects,{placement:e.placement})):g,A=typeof N=="number"?{mainAxis:N,altAxis:N}:Object.assign({mainAxis:0,altAxis:0},N),$=e.modifiersData.offset?e.modifiersData.offset[e.placement]:null,O={x:0,y:0};if(C){if(i){var R,I=k==="y"?dn:fn,L=k==="y"?Pn:Vn,B=k==="y"?"height":"width",W=C[k],z=W+y[I],U=W-y[L],me=h?-M[B]/2:0,Ee=v===gs?S[B]:M[B],Re=v===gs?-M[B]:-S[B],Ue=e.elements.arrow,Fe=h&&Ue?jm(Ue):{width:0,height:0},Te=e.modifiersData["arrow#persistent"]?e.modifiersData["arrow#persistent"].padding:c1(),te=Te[I],we=Te[L],Ne=bl(0,S[B],Fe[B]),gt=w?S[B]/2-me-Ne-te-A.mainAxis:Ee-Ne-te-A.mainAxis,yt=w?-S[B]/2+me+Ne+we+A.mainAxis:Re+Ne+we+A.mainAxis,io=e.elements.arrow&&ga(e.elements.arrow),or=io?k==="y"?io.clientTop||0:io.clientLeft||0:0,Bo=(R=$==null?void 0:$[k])!=null?R:0,Ro=W+gt-Bo-or,rr=W+yt-Bo,Tn=bl(h?wu(z,Ro):z,W,h?ii(U,rr):U);C[k]=Tn,O[k]=Tn-W}if(l){var _o,ir=k==="x"?dn:fn,sr=k==="x"?Pn:Vn,Pt=C[x],mn=x==="y"?"height":"width",so=Pt+y[ir],gn=Pt-y[sr],Qt=[dn,fn].indexOf(b)!==-1,Do=(_o=$==null?void 0:$[x])!=null?_o:0,Vt=Qt?so:Pt-S[mn]-M[mn]-Do+A.altAxis,jn=Qt?Pt+S[mn]+M[mn]-Do-A.altAxis:gn,lo=h&&Qt?z_(Vt,Pt,jn):bl(h?Vt:so,Pt,h?jn:gn);C[x]=lo,O[x]=lo-Pt}e.modifiersData[o]=O}}const yD={name:"preventOverflow",enabled:!0,phase:"main",fn:gD,requiresIfExists:["offset"]};function bD(n){return{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}}function vD(n){return n===Sn(n)||!Ln(n)?Wm(n):bD(n)}function kD(n){var e=n.getBoundingClientRect(),t=ys(e.width)/n.offsetWidth||1,o=ys(e.height)/n.offsetHeight||1;return t!==1||o!==1}function wD(n,e,t){t===void 0&&(t=!1);var o=Ln(e),r=Ln(e)&&kD(e),i=zr(e),s=bs(n,r,t),l={scrollLeft:0,scrollTop:0},a={x:0,y:0};return(o||!o&&!t)&&((So(e)!=="body"||Km(i))&&(l=vD(e)),Ln(e)?(a=bs(e,!0),a.x+=e.clientLeft,a.y+=e.clientTop):i&&(a.x=qm(i))),{x:s.left+l.scrollLeft-a.x,y:s.top+l.scrollTop-a.y,width:s.width,height:s.height}}function xD(n){var e=new Map,t=new Set,o=[];n.forEach(function(i){e.set(i.name,i)});function r(i){t.add(i.name);var s=[].concat(i.requires||[],i.requiresIfExists||[]);s.forEach(function(l){if(!t.has(l)){var a=e.get(l);a&&r(a)}}),o.push(i)}return n.forEach(function(i){t.has(i.name)||r(i)}),o}function CD(n){var e=xD(n);return D_.reduce(function(t,o){return t.concat(e.filter(function(r){return r.phase===o}))},[])}function SD(n){var e;return function(){return e||(e=new Promise(function(t){Promise.resolve().then(function(){e=void 0,t(n())})})),e}}function ED(n){var e=n.reduce(function(t,o){var r=t[o.name];return t[o.name]=r?Object.assign({},r,o,{options:Object.assign({},r.options,o.options),data:Object.assign({},r.data,o.data)}):o,t},{});return Object.keys(e).map(function(t){return e[t]})}var Ub={placement:"bottom",modifiers:[],strategy:"absolute"};function Wb(){for(var n=arguments.length,e=new Array(n),t=0;t<n;t++)e[t]=arguments[t];return!e.some(function(o){return!(o&&typeof o.getBoundingClientRect=="function")})}function MD(n){n===void 0&&(n={});var e=n,t=e.defaultModifiers,o=t===void 0?[]:t,r=e.defaultOptions,i=r===void 0?Ub:r;return function(l,a,u){u===void 0&&(u=i);var d={placement:"bottom",orderedModifiers:[],options:Object.assign({},Ub,i),modifiersData:{},elements:{reference:l,popper:a},attributes:{},styles:{}},f=[],p=!1,h={state:d,setOptions:function(b){var v=typeof b=="function"?b(d.options):b;g(),d.options=Object.assign({},i,d.options,v),d.scrollParents={reference:vi(l)?vl(l):l.contextElement?vl(l.contextElement):[],popper:vl(a)};var w=CD(ED([].concat(o,d.options.modifiers)));return d.orderedModifiers=w.filter(function(k){return k.enabled}),m(),h.update()},forceUpdate:function(){if(!p){var b=d.elements,v=b.reference,w=b.popper;if(Wb(v,w)){d.rects={reference:wD(v,ga(w),d.options.strategy==="fixed"),popper:jm(w)},d.reset=!1,d.placement=d.options.placement,d.orderedModifiers.forEach(function(A){return d.modifiersData[A.name]=Object.assign({},A.data)});for(var k=0;k<d.orderedModifiers.length;k++){if(d.reset===!0){d.reset=!1,k=-1;continue}var x=d.orderedModifiers[k],C=x.fn,S=x.options,M=S===void 0?{}:S,N=x.name;typeof C=="function"&&(d=C({state:d,options:M,name:N,instance:h})||d)}}}},update:SD(function(){return new Promise(function(y){h.forceUpdate(),y(d)})}),destroy:function(){g(),p=!0}};if(!Wb(l,a))return h;h.setOptions(u).then(function(y){!p&&u.onFirstUpdate&&u.onFirstUpdate(y)});function m(){d.orderedModifiers.forEach(function(y){var b=y.name,v=y.options,w=v===void 0?{}:v,k=y.effect;if(typeof k=="function"){var x=k({state:d,name:b,instance:h,options:w}),C=function(){};f.push(x||C)}})}function g(){f.forEach(function(y){return y()}),f=[]}return h}}var TD=[X_,hD,J_,s1,fD,lD,yD,U_,cD],ND=MD({defaultModifiers:TD}),AD="tippy-box",h1="tippy-content",OD="tippy-backdrop",m1="tippy-arrow",g1="tippy-svg-arrow",Kr={passive:!0,capture:!0},y1=function(){return document.body};function $D(n,e){return{}.hasOwnProperty.call(n,e)}function Bf(n,e,t){if(Array.isArray(n)){var o=n[e];return o??(Array.isArray(t)?t[e]:t)}return n}function Jm(n,e){var t={}.toString.call(n);return t.indexOf("[object")===0&&t.indexOf(e+"]")>-1}function b1(n,e){return typeof n=="function"?n.apply(void 0,e):n}function qb(n,e){if(e===0)return n;var t;return function(o){clearTimeout(t),t=setTimeout(function(){n(o)},e)}}function BD(n,e){var t=Object.assign({},n);return e.forEach(function(o){delete t[o]}),t}function RD(n){return n.split(/\s+/).filter(Boolean)}function Ki(n){return[].concat(n)}function Kb(n,e){n.indexOf(e)===-1&&n.push(e)}function _D(n){return n.filter(function(e,t){return n.indexOf(e)===t})}function DD(n){return n.split("-")[0]}function xu(n){return[].slice.call(n)}function Jb(n){return Object.keys(n).reduce(function(e,t){return n[t]!==void 0&&(e[t]=n[t]),e},{})}function kl(){return document.createElement("div")}function jl(n){return["Element","Fragment"].some(function(e){return Jm(n,e)})}function ID(n){return Jm(n,"NodeList")}function LD(n){return Jm(n,"MouseEvent")}function PD(n){return!!(n&&n._tippy&&n._tippy.reference===n)}function VD(n){return jl(n)?[n]:ID(n)?xu(n):Array.isArray(n)?n:xu(document.querySelectorAll(n))}function Rf(n,e){n.forEach(function(t){t&&(t.style.transitionDuration=e+"ms")})}function Gb(n,e){n.forEach(function(t){t&&t.setAttribute("data-state",e)})}function zD(n){var e,t=Ki(n),o=t[0];return o!=null&&(e=o.ownerDocument)!=null&&e.body?o.ownerDocument:document}function FD(n,e){var t=e.clientX,o=e.clientY;return n.every(function(r){var i=r.popperRect,s=r.popperState,l=r.props,a=l.interactiveBorder,u=DD(s.placement),d=s.modifiersData.offset;if(!d)return!0;var f=u==="bottom"?d.top.y:0,p=u==="top"?d.bottom.y:0,h=u==="right"?d.left.x:0,m=u==="left"?d.right.x:0,g=i.top-o+f>a,y=o-i.bottom-p>a,b=i.left-t+h>a,v=t-i.right-m>a;return g||y||b||v})}function _f(n,e,t){var o=e+"EventListener";["transitionend","webkitTransitionEnd"].forEach(function(r){n[o](r,t)})}function Xb(n,e){for(var t=e;t;){var o;if(n.contains(t))return!0;t=t.getRootNode==null||(o=t.getRootNode())==null?void 0:o.host}return!1}var mo={isTouch:!1},Yb=0;function HD(){mo.isTouch||(mo.isTouch=!0,window.performance&&document.addEventListener("mousemove",v1))}function v1(){var n=performance.now();n-Yb<20&&(mo.isTouch=!1,document.removeEventListener("mousemove",v1)),Yb=n}function jD(){var n=document.activeElement;if(PD(n)){var e=n._tippy;n.blur&&!e.state.isVisible&&n.blur()}}function UD(){document.addEventListener("touchstart",HD,Kr),window.addEventListener("blur",jD)}var WD=typeof window<"u"&&typeof document<"u",qD=WD?!!window.msCrypto:!1;function zi(n){var e=n==="destroy"?"n already-":" ";return[n+"() was called on a"+e+"destroyed instance. This is a no-op but","indicates a potential memory leak."].join(" ")}function Qb(n){var e=/[ \t]{2,}/g,t=/^[ \t]*/gm;return n.replace(e," ").replace(t,"").trim()}function KD(n){return Qb(`
|
|
6
144
|
%ctippy.js
|
|
7
145
|
|
|
8
|
-
%c`+
|
|
146
|
+
%c`+Qb(n)+`
|
|
9
147
|
|
|
10
148
|
%c👷 This is a development-only message. It will be removed in production.
|
|
11
|
-
`)}function
|
|
149
|
+
`)}function k1(n){return[KD(n),"color: #00C584; font-size: 1.3em; font-weight: bold;","line-height: 1.5","color: #a6a095;"]}var Ul;process.env.NODE_ENV!=="production"&&JD();function JD(){Ul=new Set}function Uo(n,e){if(n&&!Ul.has(e)){var t;Ul.add(e),(t=console).warn.apply(t,k1(e))}}function Wp(n,e){if(n&&!Ul.has(e)){var t;Ul.add(e),(t=console).error.apply(t,k1(e))}}function GD(n){var e=!n,t=Object.prototype.toString.call(n)==="[object Object]"&&!n.addEventListener;Wp(e,["tippy() was passed","`"+String(n)+"`","as its targets (first) argument. Valid types are: String, Element,","Element[], or NodeList."].join(" ")),Wp(t,["tippy() was passed a plain object which is not supported as an argument","for virtual positioning. Use props.getReferenceClientRect instead."].join(" "))}var w1={animateFill:!1,followCursor:!1,inlinePositioning:!1,sticky:!1},XD={allowHTML:!1,animation:"fade",arrow:!0,content:"",inertia:!1,maxWidth:350,role:"tooltip",theme:"",zIndex:9999},vn=Object.assign({appendTo:y1,aria:{content:"auto",expanded:"auto"},delay:0,duration:[300,250],getReferenceClientRect:null,hideOnClick:!0,ignoreAttributes:!1,interactive:!1,interactiveBorder:2,interactiveDebounce:0,moveTransition:"",offset:[0,10],onAfterUpdate:function(){},onBeforeUpdate:function(){},onCreate:function(){},onDestroy:function(){},onHidden:function(){},onHide:function(){},onMount:function(){},onShow:function(){},onShown:function(){},onTrigger:function(){},onUntrigger:function(){},onClickOutside:function(){},placement:"top",plugins:[],popperOptions:{},render:null,showOnCreate:!1,touch:!0,trigger:"mouseenter focus",triggerTarget:null},w1,XD),YD=Object.keys(vn),QD=function(e){process.env.NODE_ENV!=="production"&&C1(e,[]);var t=Object.keys(e);t.forEach(function(o){vn[o]=e[o]})};function x1(n){var e=n.plugins||[],t=e.reduce(function(o,r){var i=r.name,s=r.defaultValue;if(i){var l;o[i]=n[i]!==void 0?n[i]:(l=vn[i])!=null?l:s}return o},{});return Object.assign({},n,t)}function ZD(n,e){var t=e?Object.keys(x1(Object.assign({},vn,{plugins:e}))):YD,o=t.reduce(function(r,i){var s=(n.getAttribute("data-tippy-"+i)||"").trim();if(!s)return r;if(i==="content")r[i]=s;else try{r[i]=JSON.parse(s)}catch{r[i]=s}return r},{});return o}function Zb(n,e){var t=Object.assign({},e,{content:b1(e.content,[n])},e.ignoreAttributes?{}:ZD(n,e.plugins));return t.aria=Object.assign({},vn.aria,t.aria),t.aria={expanded:t.aria.expanded==="auto"?e.interactive:t.aria.expanded,content:t.aria.content==="auto"?e.interactive?null:"describedby":t.aria.content},t}function C1(n,e){n===void 0&&(n={}),e===void 0&&(e=[]);var t=Object.keys(n);t.forEach(function(o){var r=BD(vn,Object.keys(w1)),i=!$D(r,o);i&&(i=e.filter(function(s){return s.name===o}).length===0),Uo(i,["`"+o+"`","is not a valid prop. You may have spelled it incorrectly, or if it's","a plugin, forgot to pass it in an array as props.plugins.",`
|
|
12
150
|
|
|
13
151
|
`,`All props: https://atomiks.github.io/tippyjs/v6/all-props/
|
|
14
|
-
`,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var
|
|
152
|
+
`,"Plugins: https://atomiks.github.io/tippyjs/v6/plugins/"].join(" "))})}var eI=function(){return"innerHTML"};function qp(n,e){n[eI()]=e}function ev(n){var e=kl();return n===!0?e.className=m1:(e.className=g1,jl(n)?e.appendChild(n):qp(e,n)),e}function tv(n,e){jl(e.content)?(qp(n,""),n.appendChild(e.content)):typeof e.content!="function"&&(e.allowHTML?qp(n,e.content):n.textContent=e.content)}function Kp(n){var e=n.firstElementChild,t=xu(e.children);return{box:e,content:t.find(function(o){return o.classList.contains(h1)}),arrow:t.find(function(o){return o.classList.contains(m1)||o.classList.contains(g1)}),backdrop:t.find(function(o){return o.classList.contains(OD)})}}function S1(n){var e=kl(),t=kl();t.className=AD,t.setAttribute("data-state","hidden"),t.setAttribute("tabindex","-1");var o=kl();o.className=h1,o.setAttribute("data-state","hidden"),tv(o,n.props),e.appendChild(t),t.appendChild(o),r(n.props,n.props);function r(i,s){var l=Kp(e),a=l.box,u=l.content,d=l.arrow;s.theme?a.setAttribute("data-theme",s.theme):a.removeAttribute("data-theme"),typeof s.animation=="string"?a.setAttribute("data-animation",s.animation):a.removeAttribute("data-animation"),s.inertia?a.setAttribute("data-inertia",""):a.removeAttribute("data-inertia"),a.style.maxWidth=typeof s.maxWidth=="number"?s.maxWidth+"px":s.maxWidth,s.role?a.setAttribute("role",s.role):a.removeAttribute("role"),(i.content!==s.content||i.allowHTML!==s.allowHTML)&&tv(u,n.props),s.arrow?d?i.arrow!==s.arrow&&(a.removeChild(d),a.appendChild(ev(s.arrow))):a.appendChild(ev(s.arrow)):d&&a.removeChild(d)}return{popper:e,onUpdate:r}}S1.$$tippy=!0;var tI=1,ja=[],Df=[];function nI(n,e){var t=Zb(n,Object.assign({},vn,x1(Jb(e)))),o,r,i,s=!1,l=!1,a=!1,u=!1,d,f,p,h=[],m=qb(Ro,t.interactiveDebounce),g,y=tI++,b=null,v=_D(t.plugins),w={isEnabled:!0,isVisible:!1,isDestroyed:!1,isMounted:!1,isShown:!1},k={id:y,reference:n,popper:kl(),popperInstance:b,props:t,state:w,plugins:v,clearDelayTimeouts:Vt,setProps:jn,setContent:lo,show:Vs,hide:zs,hideWithInteractivity:Di,enable:Qt,disable:Do,unmount:Ii,destroy:Li};if(!t.render)return process.env.NODE_ENV!=="production"&&Wp(!0,"render() function has not been supplied."),k;var x=t.render(k),C=x.popper,S=x.onUpdate;C.setAttribute("data-tippy-root",""),C.id="tippy-"+k.id,k.popper=C,n._tippy=k,C._tippy=k;var M=v.map(function(T){return T.fn(k)}),N=n.hasAttribute("aria-expanded");return io(),me(),W(),z("onCreate",[k]),t.showOnCreate&&so(),C.addEventListener("mouseenter",function(){k.props.interactive&&k.state.isVisible&&k.clearDelayTimeouts()}),C.addEventListener("mouseleave",function(){k.props.interactive&&k.props.trigger.indexOf("mouseenter")>=0&&I().addEventListener("mousemove",m)}),k;function A(){var T=k.props.touch;return Array.isArray(T)?T:[T,0]}function $(){return A()[0]==="hold"}function O(){var T;return!!((T=k.props.render)!=null&&T.$$tippy)}function R(){return g||n}function I(){var T=R().parentNode;return T?zD(T):document}function L(){return Kp(C)}function B(T){return k.state.isMounted&&!k.state.isVisible||mo.isTouch||d&&d.type==="focus"?0:Bf(k.props.delay,T?0:1,vn.delay)}function W(T){T===void 0&&(T=!1),C.style.pointerEvents=k.props.interactive&&!T?"":"none",C.style.zIndex=""+k.props.zIndex}function z(T,P,ee){if(ee===void 0&&(ee=!0),M.forEach(function(fe){fe[T]&&fe[T].apply(fe,P)}),ee){var be;(be=k.props)[T].apply(be,P)}}function U(){var T=k.props.aria;if(T.content){var P="aria-"+T.content,ee=C.id,be=Ki(k.props.triggerTarget||n);be.forEach(function(fe){var ct=fe.getAttribute(P);if(k.state.isVisible)fe.setAttribute(P,ct?ct+" "+ee:ee);else{var Tt=ct&&ct.replace(ee,"").trim();Tt?fe.setAttribute(P,Tt):fe.removeAttribute(P)}})}}function me(){if(!(N||!k.props.aria.expanded)){var T=Ki(k.props.triggerTarget||n);T.forEach(function(P){k.props.interactive?P.setAttribute("aria-expanded",k.state.isVisible&&P===R()?"true":"false"):P.removeAttribute("aria-expanded")})}}function Ee(){I().removeEventListener("mousemove",m),ja=ja.filter(function(T){return T!==m})}function Re(T){if(!(mo.isTouch&&(a||T.type==="mousedown"))){var P=T.composedPath&&T.composedPath()[0]||T.target;if(!(k.props.interactive&&Xb(C,P))){if(Ki(k.props.triggerTarget||n).some(function(ee){return Xb(ee,P)})){if(mo.isTouch||k.state.isVisible&&k.props.trigger.indexOf("click")>=0)return}else z("onClickOutside",[k,T]);k.props.hideOnClick===!0&&(k.clearDelayTimeouts(),k.hide(),l=!0,setTimeout(function(){l=!1}),k.state.isMounted||te())}}}function Ue(){a=!0}function Fe(){a=!1}function Te(){var T=I();T.addEventListener("mousedown",Re,!0),T.addEventListener("touchend",Re,Kr),T.addEventListener("touchstart",Fe,Kr),T.addEventListener("touchmove",Ue,Kr)}function te(){var T=I();T.removeEventListener("mousedown",Re,!0),T.removeEventListener("touchend",Re,Kr),T.removeEventListener("touchstart",Fe,Kr),T.removeEventListener("touchmove",Ue,Kr)}function we(T,P){gt(T,function(){!k.state.isVisible&&C.parentNode&&C.parentNode.contains(C)&&P()})}function Ne(T,P){gt(T,P)}function gt(T,P){var ee=L().box;function be(fe){fe.target===ee&&(_f(ee,"remove",be),P())}if(T===0)return P();_f(ee,"remove",f),_f(ee,"add",be),f=be}function yt(T,P,ee){ee===void 0&&(ee=!1);var be=Ki(k.props.triggerTarget||n);be.forEach(function(fe){fe.addEventListener(T,P,ee),h.push({node:fe,eventType:T,handler:P,options:ee})})}function io(){$()&&(yt("touchstart",Bo,{passive:!0}),yt("touchend",rr,{passive:!0})),RD(k.props.trigger).forEach(function(T){if(T!=="manual")switch(yt(T,Bo),T){case"mouseenter":yt("mouseleave",rr);break;case"focus":yt(qD?"focusout":"blur",Tn);break;case"focusin":yt("focusout",Tn);break}})}function or(){h.forEach(function(T){var P=T.node,ee=T.eventType,be=T.handler,fe=T.options;P.removeEventListener(ee,be,fe)}),h=[]}function Bo(T){var P,ee=!1;if(!(!k.state.isEnabled||_o(T)||l)){var be=((P=d)==null?void 0:P.type)==="focus";d=T,g=T.currentTarget,me(),!k.state.isVisible&&LD(T)&&ja.forEach(function(fe){return fe(T)}),T.type==="click"&&(k.props.trigger.indexOf("mouseenter")<0||s)&&k.props.hideOnClick!==!1&&k.state.isVisible?ee=!0:so(T),T.type==="click"&&(s=!ee),ee&&!be&&gn(T)}}function Ro(T){var P=T.target,ee=R().contains(P)||C.contains(P);if(!(T.type==="mousemove"&&ee)){var be=mn().concat(C).map(function(fe){var ct,Tt=fe._tippy,lr=(ct=Tt.popperInstance)==null?void 0:ct.state;return lr?{popperRect:fe.getBoundingClientRect(),popperState:lr,props:t}:null}).filter(Boolean);FD(be,T)&&(Ee(),gn(T))}}function rr(T){var P=_o(T)||k.props.trigger.indexOf("click")>=0&&s;if(!P){if(k.props.interactive){k.hideWithInteractivity(T);return}gn(T)}}function Tn(T){k.props.trigger.indexOf("focusin")<0&&T.target!==R()||k.props.interactive&&T.relatedTarget&&C.contains(T.relatedTarget)||gn(T)}function _o(T){return mo.isTouch?$()!==T.type.indexOf("touch")>=0:!1}function ir(){sr();var T=k.props,P=T.popperOptions,ee=T.placement,be=T.offset,fe=T.getReferenceClientRect,ct=T.moveTransition,Tt=O()?Kp(C).arrow:null,lr=fe?{getBoundingClientRect:fe,contextElement:fe.contextElement||R()}:n,Fs={name:"$$tippy",enabled:!0,phase:"beforeWrite",requires:["computeStyles"],fn:function(_){var j=_.state;if(O()){var ge=L(),Qe=ge.box;["placement","reference-hidden","escaped"].forEach(function(We){We==="placement"?Qe.setAttribute("data-placement",j.placement):j.attributes.popper["data-popper-"+We]?Qe.setAttribute("data-"+We,""):Qe.removeAttribute("data-"+We)}),j.attributes.popper={}}}},an=[{name:"offset",options:{offset:be}},{name:"preventOverflow",options:{padding:{top:2,bottom:2,left:5,right:5}}},{name:"flip",options:{padding:5}},{name:"computeStyles",options:{adaptive:!ct}},Fs];O()&&Tt&&an.push({name:"arrow",options:{element:Tt,padding:3}}),an.push.apply(an,(P==null?void 0:P.modifiers)||[]),k.popperInstance=ND(lr,C,Object.assign({},P,{placement:ee,onFirstUpdate:p,modifiers:an}))}function sr(){k.popperInstance&&(k.popperInstance.destroy(),k.popperInstance=null)}function Pt(){var T=k.props.appendTo,P,ee=R();k.props.interactive&&T===y1||T==="parent"?P=ee.parentNode:P=b1(T,[ee]),P.contains(C)||P.appendChild(C),k.state.isMounted=!0,ir(),process.env.NODE_ENV!=="production"&&Uo(k.props.interactive&&T===vn.appendTo&&ee.nextElementSibling!==C,["Interactive tippy element may not be accessible via keyboard","navigation because it is not directly after the reference element","in the DOM source order.",`
|
|
15
153
|
|
|
16
154
|
`,"Using a wrapper <div> or <span> tag around the reference element","solves this by creating a new parentNode context.",`
|
|
17
155
|
|
|
18
156
|
`,"Specifying `appendTo: document.body` silences this warning, but it","assumes you are using a focus management solution to handle","keyboard navigation.",`
|
|
19
157
|
|
|
20
|
-
`,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function
|
|
158
|
+
`,"See: https://atomiks.github.io/tippyjs/v6/accessibility/#interactivity"].join(" "))}function mn(){return xu(C.querySelectorAll("[data-tippy-root]"))}function so(T){k.clearDelayTimeouts(),T&&z("onTrigger",[k,T]),Te();var P=B(!0),ee=A(),be=ee[0],fe=ee[1];mo.isTouch&&be==="hold"&&fe&&(P=fe),P?o=setTimeout(function(){k.show()},P):k.show()}function gn(T){if(k.clearDelayTimeouts(),z("onUntrigger",[k,T]),!k.state.isVisible){te();return}if(!(k.props.trigger.indexOf("mouseenter")>=0&&k.props.trigger.indexOf("click")>=0&&["mouseleave","mousemove"].indexOf(T.type)>=0&&s)){var P=B(!1);P?r=setTimeout(function(){k.state.isVisible&&k.hide()},P):i=requestAnimationFrame(function(){k.hide()})}}function Qt(){k.state.isEnabled=!0}function Do(){k.hide(),k.state.isEnabled=!1}function Vt(){clearTimeout(o),clearTimeout(r),cancelAnimationFrame(i)}function jn(T){if(process.env.NODE_ENV!=="production"&&Uo(k.state.isDestroyed,zi("setProps")),!k.state.isDestroyed){z("onBeforeUpdate",[k,T]),or();var P=k.props,ee=Zb(n,Object.assign({},P,Jb(T),{ignoreAttributes:!0}));k.props=ee,io(),P.interactiveDebounce!==ee.interactiveDebounce&&(Ee(),m=qb(Ro,ee.interactiveDebounce)),P.triggerTarget&&!ee.triggerTarget?Ki(P.triggerTarget).forEach(function(be){be.removeAttribute("aria-expanded")}):ee.triggerTarget&&n.removeAttribute("aria-expanded"),me(),W(),S&&S(P,ee),k.popperInstance&&(ir(),mn().forEach(function(be){requestAnimationFrame(be._tippy.popperInstance.forceUpdate)})),z("onAfterUpdate",[k,T])}}function lo(T){k.setProps({content:T})}function Vs(){process.env.NODE_ENV!=="production"&&Uo(k.state.isDestroyed,zi("show"));var T=k.state.isVisible,P=k.state.isDestroyed,ee=!k.state.isEnabled,be=mo.isTouch&&!k.props.touch,fe=Bf(k.props.duration,0,vn.duration);if(!(T||P||ee||be)&&!R().hasAttribute("disabled")&&(z("onShow",[k],!1),k.props.onShow(k)!==!1)){if(k.state.isVisible=!0,O()&&(C.style.visibility="visible"),W(),Te(),k.state.isMounted||(C.style.transition="none"),O()){var ct=L(),Tt=ct.box,lr=ct.content;Rf([Tt,lr],0)}p=function(){var an;if(!(!k.state.isVisible||u)){if(u=!0,C.offsetHeight,C.style.transition=k.props.moveTransition,O()&&k.props.animation){var E=L(),_=E.box,j=E.content;Rf([_,j],fe),Gb([_,j],"visible")}U(),me(),Kb(Df,k),(an=k.popperInstance)==null||an.forceUpdate(),z("onMount",[k]),k.props.animation&&O()&&Ne(fe,function(){k.state.isShown=!0,z("onShown",[k])})}},Pt()}}function zs(){process.env.NODE_ENV!=="production"&&Uo(k.state.isDestroyed,zi("hide"));var T=!k.state.isVisible,P=k.state.isDestroyed,ee=!k.state.isEnabled,be=Bf(k.props.duration,1,vn.duration);if(!(T||P||ee)&&(z("onHide",[k],!1),k.props.onHide(k)!==!1)){if(k.state.isVisible=!1,k.state.isShown=!1,u=!1,s=!1,O()&&(C.style.visibility="hidden"),Ee(),te(),W(!0),O()){var fe=L(),ct=fe.box,Tt=fe.content;k.props.animation&&(Rf([ct,Tt],be),Gb([ct,Tt],"hidden"))}U(),me(),k.props.animation?O()&&we(be,k.unmount):k.unmount()}}function Di(T){process.env.NODE_ENV!=="production"&&Uo(k.state.isDestroyed,zi("hideWithInteractivity")),I().addEventListener("mousemove",m),Kb(ja,m),m(T)}function Ii(){process.env.NODE_ENV!=="production"&&Uo(k.state.isDestroyed,zi("unmount")),k.state.isVisible&&k.hide(),k.state.isMounted&&(sr(),mn().forEach(function(T){T._tippy.unmount()}),C.parentNode&&C.parentNode.removeChild(C),Df=Df.filter(function(T){return T!==k}),k.state.isMounted=!1,z("onHidden",[k]))}function Li(){process.env.NODE_ENV!=="production"&&Uo(k.state.isDestroyed,zi("destroy")),!k.state.isDestroyed&&(k.clearDelayTimeouts(),k.unmount(),or(),delete n._tippy,k.state.isDestroyed=!0,z("onDestroy",[k]))}}function No(n,e){e===void 0&&(e={});var t=vn.plugins.concat(e.plugins||[]);process.env.NODE_ENV!=="production"&&(GD(n),C1(e,t)),UD();var o=Object.assign({},e,{plugins:t}),r=VD(n);if(process.env.NODE_ENV!=="production"){var i=jl(o.content),s=r.length>1;Uo(i&&s,["tippy() was passed an Element as the `content` prop, but more than","one tippy instance was created by this invocation. This means the","content element will only be appended to the last tippy instance.",`
|
|
21
159
|
|
|
22
160
|
`,"Instead, pass the .innerHTML of the element, or use a function that","returns a cloned version of the element instead.",`
|
|
23
161
|
|
|
24
162
|
`,`1) content: element.innerHTML
|
|
25
|
-
`,"2) content: () => element.cloneNode(true)"].join(" "))}var s=a.reduce(function(c,d){var u=d&&ed(d,r);return u&&c.push(u),c},[]);return On(t)?s[0]:s}At.defaultProps=et;At.setDefaultProps=Zu;At.currentInput=Et;Object.assign({},ti,{effect:function(n){var o=n.state,r={popper:{position:o.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(o.elements.popper.style,r.popper),o.styles=r,o.elements.arrow&&Object.assign(o.elements.arrow.style,r.arrow)}});At.setDefaultProps({render:_i});const ct=e.defineComponent({__name:"OTooltip",props:{placement:{type:String,default:"top"},trigger:{type:String,default:"mouseenter focus"},delay:{type:Number,default:100},duration:{type:Number,default:100},offset:{type:Object,default:function(){return[0,10]}}},setup(t){const n=t,{theme:o}=tn(),r=e.ref(),a=e.ref(),l=e.ref();function i(){l.value=At(r.value,{appendTo:()=>document.body,animation:"perspective",content:a.value,duration:n.duration,delay:n.delay,interactive:!0,offset:n.offset,placement:n.placement,trigger:n.trigger})}function s(){l.value.setProps({theme:o.value})}return e.watch(o,c=>{s()}),e.onMounted(()=>{i()}),e.onUnmounted(()=>{l.value&&l.value.destroy()}),(c,d)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"triggerRef",ref:r,"data-tippy-role":"tooltip"},[e.renderSlot(c.$slots,"trigger"),e.createElementVNode("div",{ref_key:"contentRef",ref:a,class:"tooltip-content"},[e.renderSlot(c.$slots,"default")],512)],512))}}),me=e.defineComponent({__name:"OMenubarBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(t,{emit:n}){const o=n;return(r,a)=>(e.openBlock(),e.createBlock(ct,{class:"o-tooltip",placement:t.placement},{trigger:e.withCtx(()=>[e.createElementVNode("button",{class:e.normalizeClass(["o-menubar-btn o-command-btn o-btn",t.contentClass]),style:e.normalizeStyle(t.contentStyle),onClick:a[0]||(a[0]=l=>o("click",l))},[e.createVNode($,{name:t.icon,color:t.color,class:e.normalizeClass(t.iconClass)},null,8,["name","color","class"]),e.renderSlot(r.$slots,"default")],6)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(t.tooltip),1)]),_:3},8,["placement"]))}}),td={class:"o-table-grid"},nd=["onMouseover"],ki=e.defineComponent({__name:"OTableGrid",emits:["select"],setup(t,{emit:n}){const o=n,r=e.ref(6),a=e.ref(6),l=e.ref(2),i=e.ref(2);function s(d,u){l.value=d,i.value=u,r.value===d&&r.value<10&&(r.value+=1),a.value===u&&a.value<10&&(a.value+=1)}function c(){o("select",{rows:l.value,cols:i.value,withHeaderRow:!0})}return(d,u)=>(e.openBlock(),e.createElementBlock("section",td,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(r.value,(p,m)=>(e.openBlock(),e.createElementBlock("div",{class:"rows",key:`row-${m}`},[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(f,v)=>(e.openBlock(),e.createElementBlock("div",{key:`col-${v}`},[e.createElementVNode("div",{class:e.normalizeClass(["cell",{selected:p<=l.value&&f<=i.value}]),onMouseover:b=>s(p,f),onClick:c},null,42,nd)]))),128))]))),128)),e.createElementVNode("footer",null,e.toDisplayString(l.value)+" x "+e.toDisplayString(i.value),1)]))}}),od={class:"o-table-cell-background o-button-group"},rd={class:"o-command-btn"},yi=e.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(),l=e.ref("#ffec3d");function i(){s(l.value)}function s(c){a.value.setShow(!1),l.value=c,r(n.editor,"tableCellAttribute",{name:"background",value:l.value})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn",placement:"bottom-start",trigger:"click"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ct),{trigger:"hover"},{trigger:e.withCtx(()=>[e.createElementVNode("div",od,[e.createElementVNode("div",{class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},[e.createVNode(e.unref($),{name:"crop_16_9",class:"arrow"}),e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${l.value}`)},null,4)]),e.createElementVNode("div",rd,[e.createVNode(e.unref($),{name:"arrow_drop_down"})])])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(o)("editor.highlightColor")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(Xt),{"default-color":"","default-label":e.unref(o)("editor.noColor"),onSelect:s},null,8,["default-label"])]),_:1},512))}}),ad={class:"o-simple-color-board"},id={class:"fore-colors"},ld={class:"label o-tips"},sd={class:"color-row"},cd={class:"color-row"},ud={class:"back-colors"},dd={class:"label o-tips"},pd={class:"color-row"},fd={class:"color-row"},yr=e.defineComponent({__name:"OTextColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(t,{emit:n}){const o=n,{tr:r}=Z();function a(s,c){o("select",{name:s,value:c.value})}const l=e.computed(()=>[{label:"Grey",value:"#787774"},{label:"Brown",value:"#9F6B53"},{label:"Orange",value:"#D9730D"},{label:"Yellow",value:"#CB912F"},{label:"Green",value:"#448361"},{label:"Blue",value:"#337EA9"},{label:"Purple",value:"#9065B0"},{label:"Pink",value:"#C14C8A"},{label:"Red",value:"#D44C47"}]),i=e.computed(()=>[{label:"Grey",value:"#F1F1EF"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(s,c)=>(e.openBlock(),e.createElementBlock("section",ad,[e.createElementVNode("section",id,[e.createElementVNode("header",null,[e.createElementVNode("div",ld,e.toDisplayString(e.unref(r)("editor.textColor")),1),e.createVNode(e.unref(fe),{ref:"popover",class:"o-simple-command-btn",size:"medium",placement:"right-start",trigger:"mouseenter",offset:[-9,14],"show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ct),null,{trigger:e.withCtx(()=>[e.createVNode(e.unref(ke),{icon:"more_horiz",class:"o-command-btn"})]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(r)("label.more")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(Xt),{"default-color":"","default-disabled":"",onSelect:c[0]||(c[0]=d=>a("color",{value:d}))})]),_:1},512)]),e.createElementVNode("div",sd,[e.createVNode(e.unref(me),{icon:"format_text",tooltip:"Default color","content-class":"border",onClick:c[1]||(c[1]=d=>a("color",{value:""}))}),t.foreColor?(e.openBlock(),e.createBlock(e.unref(me),{key:0,icon:"format_text",color:t.foreColor,tooltip:"Last used","content-class":"border",onClick:c[2]||(c[2]=d=>a("color",{value:t.foreColor}))},null,8,["color"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",cd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(d,u)=>(e.openBlock(),e.createBlock(e.unref(me),{key:`col-${u}`,icon:"format_text",color:d.value,tooltip:d.label,onClick:p=>a("color",d)},null,8,["color","tooltip","onClick"]))),128))])]),e.createElementVNode("section",ud,[e.createElementVNode("header",null,[e.createElementVNode("div",dd,e.toDisplayString(e.unref(r)("editor.backgroundColor")),1),e.createVNode(e.unref(fe),{ref:"popover",class:"o-simple-command-btn",size:"medium",placement:"right-start",trigger:"mouseenter",offset:[-9,14],"show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ct),null,{trigger:e.withCtx(()=>[e.createVNode(e.unref(ke),{icon:"more_horiz",class:"o-command-btn"})]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(r)("label.more")),1)]),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(Xt),{"default-color":"","default-disabled":"",onSelect:c[3]||(c[3]=d=>a("backgroundColor",{value:d}))})]),_:1},512)]),e.createElementVNode("div",pd,[e.createVNode(e.unref(me),{icon:"slash_forward",tooltip:"No Color","content-class":"border",onClick:c[4]||(c[4]=d=>a("backgroundColor",{value:""}))}),t.backColor?(e.openBlock(),e.createBlock(e.unref(me),{key:0,icon:"format_text",tooltip:"Last used","content-class":"border","content-style":{backgroundColor:t.backColor},onClick:c[5]||(c[5]=d=>a("backgroundColor",{value:t.backColor}))},null,8,["content-style"])):e.createCommentVNode("",!0)]),e.createElementVNode("div",fd,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(i.value,(d,u)=>(e.openBlock(),e.createBlock(e.unref(me),{key:`col-${u}`,icon:"format_text",tooltip:d.label,"content-style":{backgroundColor:d.value},onClick:p=>a("backgroundColor",d)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),oo=Math.min,Yt=Math.max,ro=Math.round,qn=Math.floor,Nt=t=>({x:t,y:t}),md={left:"right",right:"left",bottom:"top",top:"bottom"},gd={start:"end",end:"start"};function ca(t,n,o){return Yt(t,oo(n,o))}function ho(t,n){return typeof t=="function"?t(n):t}function Jt(t){return t.split("-")[0]}function _o(t){return t.split("-")[1]}function wi(t){return t==="x"?"y":"x"}function Ei(t){return t==="y"?"height":"width"}const bd=new Set(["top","bottom"]);function Pt(t){return bd.has(Jt(t))?"y":"x"}function Ci(t){return wi(Pt(t))}function vd(t,n,o){o===void 0&&(o=!1);const r=_o(t),a=Ci(t),l=Ei(a);let i=a==="x"?r===(o?"end":"start")?"right":"left":r==="start"?"bottom":"top";return n.reference[l]>n.floating[l]&&(i=ao(i)),[i,ao(i)]}function hd(t){const n=ao(t);return[nr(t),n,nr(n)]}function nr(t){return t.replace(/start|end/g,n=>gd[n])}const ua=["left","right"],da=["right","left"],_d=["top","bottom"],kd=["bottom","top"];function yd(t,n,o){switch(t){case"top":case"bottom":return o?n?da:ua:n?ua:da;case"left":case"right":return n?_d:kd;default:return[]}}function wd(t,n,o,r){const a=_o(t);let l=yd(Jt(t),o==="start",r);return a&&(l=l.map(i=>i+"-"+a),n&&(l=l.concat(l.map(nr)))),l}function ao(t){return t.replace(/left|right|bottom|top/g,n=>md[n])}function Ed(t){return{top:0,right:0,bottom:0,left:0,...t}}function Cd(t){return typeof t!="number"?Ed(t):{top:t,right:t,bottom:t,left:t}}function io(t){const{x:n,y:o,width:r,height:a}=t;return{width:r,height:a,top:o,left:n,right:n+r,bottom:o+a,x:n,y:o}}function pa(t,n,o){let{reference:r,floating:a}=t;const l=Pt(n),i=Ci(n),s=Ei(i),c=Jt(n),d=l==="y",u=r.x+r.width/2-a.width/2,p=r.y+r.height/2-a.height/2,m=r[s]/2-a[s]/2;let f;switch(c){case"top":f={x:u,y:r.y-a.height};break;case"bottom":f={x:u,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:p};break;case"left":f={x:r.x-a.width,y:p};break;default:f={x:r.x,y:r.y}}switch(_o(n)){case"start":f[i]-=m*(o&&d?-1:1);break;case"end":f[i]+=m*(o&&d?-1:1);break}return f}const xd=async(t,n,o)=>{const{placement:r="bottom",strategy:a="absolute",middleware:l=[],platform:i}=o,s=l.filter(Boolean),c=await(i.isRTL==null?void 0:i.isRTL(n));let d=await i.getElementRects({reference:t,floating:n,strategy:a}),{x:u,y:p}=pa(d,r,c),m=r,f={},v=0;for(let b=0;b<s.length;b++){const{name:_,fn:h}=s[b],{x:w,y,data:g,reset:C}=await h({x:u,y:p,initialPlacement:r,placement:m,strategy:a,middlewareData:f,rects:d,platform:i,elements:{reference:t,floating:n}});u=w??u,p=y??p,f={...f,[_]:{...f[_],...g}},C&&v<=50&&(v++,typeof C=="object"&&(C.placement&&(m=C.placement),C.rects&&(d=C.rects===!0?await i.getElementRects({reference:t,floating:n,strategy:a}):C.rects),{x:u,y:p}=pa(d,m,c)),b=-1)}return{x:u,y:p,placement:m,strategy:a,middlewareData:f}};async function xi(t,n){var o;n===void 0&&(n={});const{x:r,y:a,platform:l,rects:i,elements:s,strategy:c}=t,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:p="floating",altBoundary:m=!1,padding:f=0}=ho(n,t),v=Cd(f),_=s[m?p==="floating"?"reference":"floating":p],h=io(await l.getClippingRect({element:(o=await(l.isElement==null?void 0:l.isElement(_)))==null||o?_:_.contextElement||await(l.getDocumentElement==null?void 0:l.getDocumentElement(s.floating)),boundary:d,rootBoundary:u,strategy:c})),w=p==="floating"?{x:r,y:a,width:i.floating.width,height:i.floating.height}:i.reference,y=await(l.getOffsetParent==null?void 0:l.getOffsetParent(s.floating)),g=await(l.isElement==null?void 0:l.isElement(y))?await(l.getScale==null?void 0:l.getScale(y))||{x:1,y:1}:{x:1,y:1},C=io(l.convertOffsetParentRelativeRectToViewportRelativeRect?await l.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:w,offsetParent:y,strategy:c}):w);return{top:(h.top-C.top+v.top)/g.y,bottom:(C.bottom-h.bottom+v.bottom)/g.y,left:(h.left-C.left+v.left)/g.x,right:(C.right-h.right+v.right)/g.x}}const Nd=function(t){return t===void 0&&(t={}),{name:"flip",options:t,async fn(n){var o,r;const{placement:a,middlewareData:l,rects:i,initialPlacement:s,platform:c,elements:d}=n,{mainAxis:u=!0,crossAxis:p=!0,fallbackPlacements:m,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:v="none",flipAlignment:b=!0,..._}=ho(t,n);if((o=l.arrow)!=null&&o.alignmentOffset)return{};const h=Jt(a),w=Pt(s),y=Jt(s)===s,g=await(c.isRTL==null?void 0:c.isRTL(d.floating)),C=m||(y||!b?[ao(s)]:hd(s)),E=v!=="none";!m&&E&&C.push(...wd(s,b,v,g));const R=[s,...C],D=await xi(n,_),A=[];let P=((r=l.flip)==null?void 0:r.overflows)||[];if(u&&A.push(D[h]),p){const L=vd(a,i,g);A.push(D[L[0]],D[L[1]])}if(P=[...P,{placement:a,overflows:A}],!A.every(L=>L<=0)){var j,O;const L=(((j=l.flip)==null?void 0:j.index)||0)+1,U=R[L];if(U&&(!(p==="alignment"?w!==Pt(U):!1)||P.every(T=>Pt(T.placement)===w?T.overflows[0]>0:!0)))return{data:{index:L,overflows:P},reset:{placement:U}};let S=(O=P.filter(H=>H.overflows[0]<=0).sort((H,T)=>H.overflows[1]-T.overflows[1])[0])==null?void 0:O.placement;if(!S)switch(f){case"bestFit":{var M;const H=(M=P.filter(T=>{if(E){const X=Pt(T.placement);return X===w||X==="y"}return!0}).map(T=>[T.placement,T.overflows.filter(X=>X>0).reduce((X,ie)=>X+ie,0)]).sort((T,X)=>T[1]-X[1])[0])==null?void 0:M[0];H&&(S=H);break}case"initialPlacement":S=s;break}if(a!==S)return{reset:{placement:S}}}return{}}}},Sd=new Set(["left","top"]);async function Td(t,n){const{placement:o,platform:r,elements:a}=t,l=await(r.isRTL==null?void 0:r.isRTL(a.floating)),i=Jt(o),s=_o(o),c=Pt(o)==="y",d=Sd.has(i)?-1:1,u=l&&c?-1:1,p=ho(n,t);let{mainAxis:m,crossAxis:f,alignmentAxis:v}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return s&&typeof v=="number"&&(f=s==="end"?v*-1:v),c?{x:f*u,y:m*d}:{x:m*d,y:f*u}}const Od=function(t){return t===void 0&&(t=0),{name:"offset",options:t,async fn(n){var o,r;const{x:a,y:l,placement:i,middlewareData:s}=n,c=await Td(n,t);return i===((o=s.offset)==null?void 0:o.placement)&&(r=s.arrow)!=null&&r.alignmentOffset?{}:{x:a+c.x,y:l+c.y,data:{...c,placement:i}}}}},Ad=function(t){return t===void 0&&(t={}),{name:"shift",options:t,async fn(n){const{x:o,y:r,placement:a}=n,{mainAxis:l=!0,crossAxis:i=!1,limiter:s={fn:_=>{let{x:h,y:w}=_;return{x:h,y:w}}},...c}=ho(t,n),d={x:o,y:r},u=await xi(n,c),p=Pt(Jt(a)),m=wi(p);let f=d[m],v=d[p];if(l){const _=m==="y"?"top":"left",h=m==="y"?"bottom":"right",w=f+u[_],y=f-u[h];f=ca(w,f,y)}if(i){const _=p==="y"?"top":"left",h=p==="y"?"bottom":"right",w=v+u[_],y=v-u[h];v=ca(w,v,y)}const b=s.fn({...n,[m]:f,[p]:v});return{...b,data:{x:b.x-o,y:b.y-r,enabled:{[m]:l,[p]:i}}}}}};function ko(){return typeof window<"u"}function hn(t){return Ni(t)?(t.nodeName||"").toLowerCase():"#document"}function tt(t){var n;return(t==null||(n=t.ownerDocument)==null?void 0:n.defaultView)||window}function Bt(t){var n;return(n=(Ni(t)?t.ownerDocument:t.document)||window.document)==null?void 0:n.documentElement}function Ni(t){return ko()?t instanceof Node||t instanceof tt(t).Node:!1}function gt(t){return ko()?t instanceof Element||t instanceof tt(t).Element:!1}function Ot(t){return ko()?t instanceof HTMLElement||t instanceof tt(t).HTMLElement:!1}function fa(t){return!ko()||typeof ShadowRoot>"u"?!1:t instanceof ShadowRoot||t instanceof tt(t).ShadowRoot}const Bd=new Set(["inline","contents"]);function Dn(t){const{overflow:n,overflowX:o,overflowY:r,display:a}=bt(t);return/auto|scroll|overlay|hidden|clip/.test(n+r+o)&&!Bd.has(a)}const Md=new Set(["table","td","th"]);function Rd(t){return Md.has(hn(t))}const Id=[":popover-open",":modal"];function yo(t){return Id.some(n=>{try{return t.matches(n)}catch{return!1}})}const Dd=["transform","translate","scale","rotate","perspective"],Ld=["transform","translate","scale","rotate","perspective","filter"],Vd=["paint","layout","strict","content"];function wr(t){const n=Er(),o=gt(t)?bt(t):t;return Dd.some(r=>o[r]?o[r]!=="none":!1)||(o.containerType?o.containerType!=="normal":!1)||!n&&(o.backdropFilter?o.backdropFilter!=="none":!1)||!n&&(o.filter?o.filter!=="none":!1)||Ld.some(r=>(o.willChange||"").includes(r))||Vd.some(r=>(o.contain||"").includes(r))}function $d(t){let n=Ft(t);for(;Ot(n)&&!bn(n);){if(wr(n))return n;if(yo(n))return null;n=Ft(n)}return null}function Er(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const Pd=new Set(["html","body","#document"]);function bn(t){return Pd.has(hn(t))}function bt(t){return tt(t).getComputedStyle(t)}function wo(t){return gt(t)?{scrollLeft:t.scrollLeft,scrollTop:t.scrollTop}:{scrollLeft:t.scrollX,scrollTop:t.scrollY}}function Ft(t){if(hn(t)==="html")return t;const n=t.assignedSlot||t.parentNode||fa(t)&&t.host||Bt(t);return fa(n)?n.host:n}function Si(t){const n=Ft(t);return bn(n)?t.ownerDocument?t.ownerDocument.body:t.body:Ot(n)&&Dn(n)?n:Si(n)}function Bn(t,n,o){var r;n===void 0&&(n=[]),o===void 0&&(o=!0);const a=Si(t),l=a===((r=t.ownerDocument)==null?void 0:r.body),i=tt(a);if(l){const s=or(i);return n.concat(i,i.visualViewport||[],Dn(a)?a:[],s&&o?Bn(s):[])}return n.concat(a,Bn(a,[],o))}function or(t){return t.parent&&Object.getPrototypeOf(t.parent)?t.frameElement:null}function Ti(t){const n=bt(t);let o=parseFloat(n.width)||0,r=parseFloat(n.height)||0;const a=Ot(t),l=a?t.offsetWidth:o,i=a?t.offsetHeight:r,s=ro(o)!==l||ro(r)!==i;return s&&(o=l,r=i),{width:o,height:r,$:s}}function Cr(t){return gt(t)?t:t.contextElement}function sn(t){const n=Cr(t);if(!Ot(n))return Nt(1);const o=n.getBoundingClientRect(),{width:r,height:a,$:l}=Ti(n);let i=(l?ro(o.width):o.width)/r,s=(l?ro(o.height):o.height)/a;return(!i||!Number.isFinite(i))&&(i=1),(!s||!Number.isFinite(s))&&(s=1),{x:i,y:s}}const Fd=Nt(0);function Oi(t){const n=tt(t);return!Er()||!n.visualViewport?Fd:{x:n.visualViewport.offsetLeft,y:n.visualViewport.offsetTop}}function Ud(t,n,o){return n===void 0&&(n=!1),!o||n&&o!==tt(t)?!1:n}function en(t,n,o,r){n===void 0&&(n=!1),o===void 0&&(o=!1);const a=t.getBoundingClientRect(),l=Cr(t);let i=Nt(1);n&&(r?gt(r)&&(i=sn(r)):i=sn(t));const s=Ud(l,o,r)?Oi(l):Nt(0);let c=(a.left+s.x)/i.x,d=(a.top+s.y)/i.y,u=a.width/i.x,p=a.height/i.y;if(l){const m=tt(l),f=r&>(r)?tt(r):r;let v=m,b=or(v);for(;b&&r&&f!==v;){const _=sn(b),h=b.getBoundingClientRect(),w=bt(b),y=h.left+(b.clientLeft+parseFloat(w.paddingLeft))*_.x,g=h.top+(b.clientTop+parseFloat(w.paddingTop))*_.y;c*=_.x,d*=_.y,u*=_.x,p*=_.y,c+=y,d+=g,v=tt(b),b=or(v)}}return io({width:u,height:p,x:c,y:d})}function Eo(t,n){const o=wo(t).scrollLeft;return n?n.left+o:en(Bt(t)).left+o}function Ai(t,n){const o=t.getBoundingClientRect(),r=o.left+n.scrollLeft-Eo(t,o),a=o.top+n.scrollTop;return{x:r,y:a}}function zd(t){let{elements:n,rect:o,offsetParent:r,strategy:a}=t;const l=a==="fixed",i=Bt(r),s=n?yo(n.floating):!1;if(r===i||s&&l)return o;let c={scrollLeft:0,scrollTop:0},d=Nt(1);const u=Nt(0),p=Ot(r);if((p||!p&&!l)&&((hn(r)!=="body"||Dn(i))&&(c=wo(r)),Ot(r))){const f=en(r);d=sn(r),u.x=f.x+r.clientLeft,u.y=f.y+r.clientTop}const m=i&&!p&&!l?Ai(i,c):Nt(0);return{width:o.width*d.x,height:o.height*d.y,x:o.x*d.x-c.scrollLeft*d.x+u.x+m.x,y:o.y*d.y-c.scrollTop*d.y+u.y+m.y}}function Hd(t){return Array.from(t.getClientRects())}function qd(t){const n=Bt(t),o=wo(t),r=t.ownerDocument.body,a=Yt(n.scrollWidth,n.clientWidth,r.scrollWidth,r.clientWidth),l=Yt(n.scrollHeight,n.clientHeight,r.scrollHeight,r.clientHeight);let i=-o.scrollLeft+Eo(t);const s=-o.scrollTop;return bt(r).direction==="rtl"&&(i+=Yt(n.clientWidth,r.clientWidth)-a),{width:a,height:l,x:i,y:s}}const ma=25;function Gd(t,n){const o=tt(t),r=Bt(t),a=o.visualViewport;let l=r.clientWidth,i=r.clientHeight,s=0,c=0;if(a){l=a.width,i=a.height;const u=Er();(!u||u&&n==="fixed")&&(s=a.offsetLeft,c=a.offsetTop)}const d=Eo(r);if(d<=0){const u=r.ownerDocument,p=u.body,m=getComputedStyle(p),f=u.compatMode==="CSS1Compat"&&parseFloat(m.marginLeft)+parseFloat(m.marginRight)||0,v=Math.abs(r.clientWidth-p.clientWidth-f);v<=ma&&(l-=v)}else d<=ma&&(l+=d);return{width:l,height:i,x:s,y:c}}const Kd=new Set(["absolute","fixed"]);function Wd(t,n){const o=en(t,!0,n==="fixed"),r=o.top+t.clientTop,a=o.left+t.clientLeft,l=Ot(t)?sn(t):Nt(1),i=t.clientWidth*l.x,s=t.clientHeight*l.y,c=a*l.x,d=r*l.y;return{width:i,height:s,x:c,y:d}}function ga(t,n,o){let r;if(n==="viewport")r=Gd(t,o);else if(n==="document")r=qd(Bt(t));else if(gt(n))r=Wd(n,o);else{const a=Oi(t);r={x:n.x-a.x,y:n.y-a.y,width:n.width,height:n.height}}return io(r)}function Bi(t,n){const o=Ft(t);return o===n||!gt(o)||bn(o)?!1:bt(o).position==="fixed"||Bi(o,n)}function jd(t,n){const o=n.get(t);if(o)return o;let r=Bn(t,[],!1).filter(s=>gt(s)&&hn(s)!=="body"),a=null;const l=bt(t).position==="fixed";let i=l?Ft(t):t;for(;gt(i)&&!bn(i);){const s=bt(i),c=wr(i);!c&&s.position==="fixed"&&(a=null),(l?!c&&!a:!c&&s.position==="static"&&!!a&&Kd.has(a.position)||Dn(i)&&!c&&Bi(t,i))?r=r.filter(u=>u!==i):a=s,i=Ft(i)}return n.set(t,r),r}function Yd(t){let{element:n,boundary:o,rootBoundary:r,strategy:a}=t;const i=[...o==="clippingAncestors"?yo(n)?[]:jd(n,this._c):[].concat(o),r],s=i[0],c=i.reduce((d,u)=>{const p=ga(n,u,a);return d.top=Yt(p.top,d.top),d.right=oo(p.right,d.right),d.bottom=oo(p.bottom,d.bottom),d.left=Yt(p.left,d.left),d},ga(n,s,a));return{width:c.right-c.left,height:c.bottom-c.top,x:c.left,y:c.top}}function Zd(t){const{width:n,height:o}=Ti(t);return{width:n,height:o}}function Xd(t,n,o){const r=Ot(n),a=Bt(n),l=o==="fixed",i=en(t,!0,l,n);let s={scrollLeft:0,scrollTop:0};const c=Nt(0);function d(){c.x=Eo(a)}if(r||!r&&!l)if((hn(n)!=="body"||Dn(a))&&(s=wo(n)),r){const f=en(n,!0,l,n);c.x=f.x+n.clientLeft,c.y=f.y+n.clientTop}else a&&d();l&&!r&&a&&d();const u=a&&!r&&!l?Ai(a,s):Nt(0),p=i.left+s.scrollLeft-c.x-u.x,m=i.top+s.scrollTop-c.y-u.y;return{x:p,y:m,width:i.width,height:i.height}}function zo(t){return bt(t).position==="static"}function ba(t,n){if(!Ot(t)||bt(t).position==="fixed")return null;if(n)return n(t);let o=t.offsetParent;return Bt(t)===o&&(o=o.ownerDocument.body),o}function Mi(t,n){const o=tt(t);if(yo(t))return o;if(!Ot(t)){let a=Ft(t);for(;a&&!bn(a);){if(gt(a)&&!zo(a))return a;a=Ft(a)}return o}let r=ba(t,n);for(;r&&Rd(r)&&zo(r);)r=ba(r,n);return r&&bn(r)&&zo(r)&&!wr(r)?o:r||$d(t)||o}const Qd=async function(t){const n=this.getOffsetParent||Mi,o=this.getDimensions,r=await o(t.floating);return{reference:Xd(t.reference,await n(t.floating),t.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Jd(t){return bt(t).direction==="rtl"}const ep={convertOffsetParentRelativeRectToViewportRelativeRect:zd,getDocumentElement:Bt,getClippingRect:Yd,getOffsetParent:Mi,getElementRects:Qd,getClientRects:Hd,getDimensions:Zd,getScale:sn,isElement:gt,isRTL:Jd};function Ri(t,n){return t.x===n.x&&t.y===n.y&&t.width===n.width&&t.height===n.height}function tp(t,n){let o=null,r;const a=Bt(t);function l(){var s;clearTimeout(r),(s=o)==null||s.disconnect(),o=null}function i(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),l();const d=t.getBoundingClientRect(),{left:u,top:p,width:m,height:f}=d;if(s||n(),!m||!f)return;const v=qn(p),b=qn(a.clientWidth-(u+m)),_=qn(a.clientHeight-(p+f)),h=qn(u),y={rootMargin:-v+"px "+-b+"px "+-_+"px "+-h+"px",threshold:Yt(0,oo(1,c))||1};let g=!0;function C(E){const R=E[0].intersectionRatio;if(R!==c){if(!g)return i();R?i(!1,R):r=setTimeout(()=>{i(!1,1e-7)},1e3)}R===1&&!Ri(d,t.getBoundingClientRect())&&i(),g=!1}try{o=new IntersectionObserver(C,{...y,root:a.ownerDocument})}catch{o=new IntersectionObserver(C,y)}o.observe(t)}return i(!0),l}function np(t,n,o,r){r===void 0&&(r={});const{ancestorScroll:a=!0,ancestorResize:l=!0,elementResize:i=typeof ResizeObserver=="function",layoutShift:s=typeof IntersectionObserver=="function",animationFrame:c=!1}=r,d=Cr(t),u=a||l?[...d?Bn(d):[],...Bn(n)]:[];u.forEach(h=>{a&&h.addEventListener("scroll",o,{passive:!0}),l&&h.addEventListener("resize",o)});const p=d&&s?tp(d,o):null;let m=-1,f=null;i&&(f=new ResizeObserver(h=>{let[w]=h;w&&w.target===d&&f&&(f.unobserve(n),cancelAnimationFrame(m),m=requestAnimationFrame(()=>{var y;(y=f)==null||y.observe(n)})),o()}),d&&!c&&f.observe(d),f.observe(n));let v,b=c?en(t):null;c&&_();function _(){const h=en(t);b&&!Ri(b,h)&&o(),b=h,v=requestAnimationFrame(_)}return o(),()=>{var h;u.forEach(w=>{a&&w.removeEventListener("scroll",o),l&&w.removeEventListener("resize",o)}),p==null||p(),(h=f)==null||h.disconnect(),f=null,c&&cancelAnimationFrame(v)}}const va=Od,ha=Ad,_a=Nd,rr=(t,n,o)=>{const r=new Map,a={platform:ep,...o},l={...a.platform,_c:r};return xd(t,n,{...a,platform:l})};let op=class{constructor(){Oe(this,"instances",[])}error(n,o=3e3){this.show(n,"error",o)}info(n,o=3e3){this.show(n,"info",o)}success(n,o=3e3){this.show(n,"success",o)}warning(n,o=3e3){this.show(n,"warning",o)}show(n,o="info",r=3e3){const a=document.createElement("div");a.className=`o-toast ${o}`,a.innerHTML=`
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
<div class="o-toast ${o}">
|
|
30
|
-
|
|
31
|
-
|
|
163
|
+
`,"2) content: () => element.cloneNode(true)"].join(" "))}var l=r.reduce(function(a,u){var d=u&&nI(u,o);return d&&a.push(d),a},[]);return jl(n)?l[0]:l}No.defaultProps=vn;No.setDefaultProps=QD;No.currentInput=mo;Object.assign({},s1,{effect:function(e){var t=e.state,o={popper:{position:t.options.strategy,left:"0",top:"0",margin:"0"},arrow:{position:"absolute"},reference:{}};Object.assign(t.elements.popper.style,o.popper),t.styles=o,t.elements.arrow&&Object.assign(t.elements.arrow.style,o.arrow)}});No.setDefaultProps({render:S1});const E1={deepseek:{baseURL:"https://api.deepseek.com/v1",name:"DeepSeek"},openai:{baseURL:"https://api.openai.com/v1",name:"OpenAI"}},Gm=(n,e)=>{const t=E1[n];return t?t[e]:null},Xm={writing:"You are a professional writing assistant. Please answer in [LANGUAGE]."},pe={amber:"#ffc107",blue:"#2172e0",brown:"#795548",cyan:"#00bcd4",deepOrange:"#ff5722",deepPurple:"#673ab7",green:"#4caf50",indigo:"#3f51b5",lightBlue:"#03a9f4",lightGreen:"#8bc34a",lime:"#cddc39",orange:"#ff9800",purple:"#9c27b0",pink:"#e91e63",red:"#f44336",teal:"#009688",yellow:"#ffeb3b"},_s=[{label:"editor.paragraph",value:"paragraph",icon:"title",color:"",style:!0,group:"label.basic"},{label:"editor.heading1",value:"heading",keywords:"h1",tips:"#",icon:"format_h1",color:pe.blue,style:!0,options:{level:1}},{label:"editor.heading2",value:"heading",keywords:"h2",tips:"##",icon:"format_h2",color:pe.blue,style:!0,options:{level:2}},{label:"editor.heading3",value:"heading",keywords:"h3",tips:"###",icon:"format_h3",color:pe.blue,style:!0,options:{level:3}},{label:"editor.todoList",value:"taskList",keywords:"task",tips:"[]",icon:"check_box",color:pe.indigo,style:!0},{label:"editor.unorderedList",value:"bulletList",keywords:"bullet",tips:"-",icon:"format_list_bulleted",color:pe.indigo,style:!0},{label:"editor.orderedList",value:"orderedList",keywords:"ordered",tips:"1.",icon:"format_list_numbered",color:pe.indigo,style:!0},{label:"editor.blockquote",value:"blockquote",keywords:"quote",tips:'"',icon:"format_quote_open",color:pe.brown,style:!0},{label:"editor.toggleList",value:"details",keywords:"details, toggle",tips:">",icon:"toggle_list",color:pe.indigo,style:!0},{label:"editor.codeBlock",value:"codeBlock",keywords:"code",tips:"```",icon:"code_braces",color:pe.lightBlue,style:!0},{label:"editor.horizontal",value:"horizontalRule",tips:"---",icon:"horizontal_rule",color:pe.blue},{label:"editor.callout",value:"callout",color:pe.deepOrange,icon:"card_text",style:!1},{label:"editor.emoji",value:"emoji",keywords:"emoji",tips:":",icon:"emoji_emotions",color:pe.blue}],ks=_s.filter(n=>n.style),ws=[{label:"editor.aiBlock",value:"aiBlock",icon:"auto_awesome",color:pe.purple,tips:"ai",group:"label.ai"},{label:"editor.callout",value:"callout",icon:"card_text",color:pe.deepOrange,tips:"callout",group:"label.common"},{label:"editor.table",value:"table",icon:"window",tips:"table",color:pe.cyan},{label:"editor.codeBlock",value:"codeBlock",icon:"code_braces",tips:"code",color:pe.blue},{label:"editor.todoList",value:"taskList",icon:"check_box",tips:"task",color:pe.indigo},{label:"diagram.name",value:"diagram",icon:"mermaid",color:pe.purple,tips:"diagram",keywords:"code, diagram, mermaid"},{label:"label.image",value:"image",icon:"image",color:pe.amber,tips:"image",group:"label.media"},{label:"label.video",value:"video",icon:"videocam",tips:"video",color:pe.purple},{label:"label.model",value:"modelViewer",icon:"3d_rotation",tips:"model",color:pe.purple}],M1=[{label:"editor.inlineMath",value:"inlineMath",icon:"function",color:pe.blue,tips:"math",keywords:"inline, math, equation",group:"label.advanced"},{label:"editor.blockMath",value:"blockMath",icon:"functions",color:pe.indigo,tips:"math",keywords:"block, math, equation"}],kd=[..._s,...ws,...M1],gc=[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:pe.blue,tips:"Mod+D",group:"label.common",filter:"common"},{label:"label.copy",value:"copy",icon:"copy_all",color:pe.indigo,filter:"common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Mod+X",color:pe.deepOrange,filter:"common"},{label:"label.replace",value:"replace",icon:"cached",tips:"Mod+R",color:pe.blue,filter:"image,video,model"},{label:"label.color",value:"color",icon:"palette",color:pe.purple,filter:"style",component:"OTextColorBoard"},{label:"label.color",value:"callout_color",icon:"palette",color:pe.purple,filter:"callout",component:"OCalloutColorBoard"}],T1=[{label:"ai.improveWriting",value:"improveWriting",icon:"title",color:pe.purple,group:"label.suggested",options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"improve"},{label:"ai.fixSpellingGrammar",value:"fixSpellingGrammar",icon:"spellcheck",color:pe.purple,options:{prompt:"Fix spelling and grammar of the following content: [CONTENT]"},tips:"fix"},{label:"ai.enrichWithEmoji",value:"enrichWithEmoji",icon:"emoji_emotions",color:pe.purple,options:{prompt:"Enrich the following content with Emoji: [CONTENT]"},tips:"emoji"},{label:"ai.translate",value:"translate",icon:"translate",color:pe.purple,options:{prompt:"Translate the following content to [LANGUAGE]: [CONTENT]"},children:[{label:"language.chinese_simplified",value:"Simplified Chinese",icon:"language"},{label:"language.chinese_traditional",value:"Traditional Chinese",icon:"language"},{label:"language.german",value:"German",icon:"language"},{label:"language.french",value:"French",icon:"language"},{label:"language.japanese",value:"Japanese",icon:"language"},{label:"language.korean",value:"Korean",icon:"language"}]},{label:"ai.makeLonger",value:"makeLonger",icon:"subject",color:pe.purple,options:{prompt:"Make following content longer: [CONTENT]"},group:"label.edit",tips:"long"},{label:"ai.makeShorter",value:"makeShorter",icon:"short_text",color:pe.purple,options:{prompt:"Make following content shorter: [CONTENT]"},tips:"short"},{label:"ai.changeTone",value:"changeTone",icon:"invert_colors",color:pe.purple,options:{prompt:"Change tone of the following content to [TONE]: [CONTENT]"},children:[{label:"ai.tone.formal",value:"Formal",icon:"invert_colors"},{label:"ai.tone.casual",value:"Casual",icon:"invert_colors"},{label:"ai.tone.friendly",value:"Friendly",icon:"invert_colors"},{label:"ai.tone.enthusiastic",value:"Enthusiastic",icon:"invert_colors"},{label:"ai.tone.authoritative",value:"Authoritative",icon:"invert_colors"},{label:"ai.tone.humorous",value:"Humorous",icon:"invert_colors"},{label:"ai.tone.inspirational",value:"Inspirational",icon:"invert_colors"},{label:"ai.tone.empathetic",value:"Empathetic",icon:"invert_colors"},{label:"ai.tone.mysterious",value:"Mysterious",icon:"invert_colors"}]},{label:"ai.explain",value:"explain",icon:"format_quote_open",color:pe.purple,options:{prompt:"Improve writing of the following content: [CONTENT]"},tips:"explain",group:"label.think"}],N1=[{label:"ai.summarize",value:"summarize",icon:"notes",color:pe.purple,options:{prompt:"Summarize the following content: [CONTENT]"},group:"label.suggested"},{label:"ai.continuation",value:"continuation",icon:"edit_note",color:pe.purple,options:{prompt:"Continue writing with the content: [CONTENT]"}}],A1=["bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","color","highlight","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","list-dropdown","codeBlock","link","image","video","modelViewer","table","callout","emoji","columns","aiBlock"],O1=["table-group","separator","bold","italic","text-format-dropdown","separator","heading","font-family","text-color-dropdown","clearFormat","separator","align-dropdown","separator","horizontalRule","blockquote","details","list-dropdown","link","image"],$1=["bold","strike","text-color-dropdown","clearFormat","separator","ai","separator","list-group","link","callout","separator","align-dropdown","more"],B1=["inline-math-edit","inlineMathDelete"],R1=["link-open","link-edit","linkUnset"],_1=["align-group","separator","link"],D1=["align-group","separator","link-open","link-edit","linkUnset"],I1=["heading","separator","text-format-dropdown","italic","underline","font-family","separator","code","blockquote","details"],L1=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],oI=["table-group","separator","bold","italic","font-family","text-color-dropdown","separator","align-group"],P1=["style-dropdown","separator","bold","italic","text-color-dropdown","separator","align-dropdown"],rI=["table-group","separator","align-group"],iI={video:["youtube","youku","bilibili","qqvideo"],map:["google_map","amap","baidu_map"],design:["modao","lanhu","figma","canva","processon"],develop:["codepen"],data:["google_forms","jinshuju"],others:["iframe"]},sI=new UT({breaks:!0});function Ym(){const n=c.inject("aiOption"),e=c.ref(null);function t(){if(!n.value)return;const{provider:r,apiKey:i,baseURL:s}=n.value,l=s||Gm(r,"baseURL");!r||!i||!l||(e.value=new jT({apiKey:i,baseURL:l,dangerouslyAllowBrowser:!0}))}const o=async(r,i)=>{var s,l,a;if(!e.value)throw new Error("AI SDK is not initialized, please check AI options.");try{const u=await((s=e.value)==null?void 0:s.chat.completions.create({model:"deepseek-chat",messages:r,temperature:.7,stream:!0}));let d="";for await(const f of u){const p=((a=(l=f.choices[0])==null?void 0:l.delta)==null?void 0:a.content)||"";d+=p,i(p)}return d}catch(u){throw console.error("API Error:",u),new Error(u.message||"API request failed")}};return c.watch(()=>n,r=>{t()},{deep:!0}),c.onMounted(()=>{t()}),{md:sI,aiOption:n,createStreamingChatCompletion:o}}function wd(){const n=(o,r,i)=>{const s={type:"text/plain"};switch(o){case"svg":s.type="image/svg+xml;charset=utf-8";break}const l=new Blob([i],s),a=URL.createObjectURL(l),u=document.createElement("a");u.href=a,u.download=r,u.click(),URL.revokeObjectURL(a)},e=async o=>{try{const i=await(await fetch(o)).blob(),s=window.URL.createObjectURL(i),l=t(o),a=document.createElement("a");a.href=s,a.download=l,document.body.appendChild(a),a.click(),document.body.removeChild(a),window.URL.revokeObjectURL(s)}catch{window.open(o,"_blank")}},t=(o,r="png")=>{try{const l=new URL(o).pathname.split("/"),a=l[l.length-1];return a&&a.includes(".")?decodeURIComponent(a):`image-${Date.now()}.${r}`}catch{return`download-${Date.now()}.${r}`}};return{commonDownload:n,downloadImage:e}}function V1(){const n=c.ref(),e=c.ref(!1);function t(s){n.value=s,s.editor.on("selectionUpdate",i)}function o(){var s;(s=n.value)==null||s.editor.off("selectionUpdate",i)}const r=c.computed(()=>{var a;const s=(a=n.value)==null?void 0:a.getPos();if(typeof s!="number")return null;const l=n.value.editor.state.doc.nodeAt(s);return l?{start:s+1,end:s+l.nodeSize-1}:null}),i=()=>{if(!n.value)return;const{editor:s}=n.value;if(!s.isFocused){e.value=!1;return}const{selection:l}=s.state;l&&(e.value=(l==null?void 0:l.$from.pos)>=r.value.start&&(l==null?void 0:l.$to.pos)<=r.value.end)};return{isFocused:e,bind:t,unbind:o,checkFocus:i}}function de(){const n=c.inject("locale",{value:"en"}),e=c.computed(()=>WT.getMessage(n.value)),t=c.computed(()=>{var r;return((r=e.value)==null?void 0:r.name)||"English"});function o(r){return r.split(".").reduce((i,s)=>{if(i)return i[s]},e.value)}return{languageName:t,locale:n,message:e,tr:o}}function Bi(){const n=c.inject("darkMode",{value:!1}),e=c.computed(()=>n.value?"dark":"light");return{darkMode:n,theme:e}}/**
|
|
164
|
+
* Copyright 2026 Yiitap
|
|
165
|
+
* @license MIT
|
|
166
|
+
**/const Ko=new ce("inlinePlaceholder"),z1=ve.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1,onShowInline:n=>{},onHideInline:()=>{}}},addProseMirrorPlugins(){return[new ue({key:new ce("placeholder"),props:{decorations:n=>{var l;const{doc:e,selection:t,tr:o}=n,r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=t,s=[];return(l=Ko.getState(n))!=null&&l.active||!r?null:(e.descendants((a,u)=>{const d=i>=u&&i<=u+a.nodeSize,f=!a.isLeaf&&!a.childCount,p=this.options.showOnlyCurrent;if((d||!p)&&f){const h=[this.options.emptyNodeClass];this.editor.isEmpty&&h.push(this.options.emptyEditorClass);const m=Ve.node(u,u+a.nodeSize,{class:h.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:a,pos:u,hasAnchor:d}):this.options.placeholder});s.push(m)}return this.options.includeChildren}),Se.create(e,s))}}}),new ue({key:Ko,state:{init:()=>({active:null}),apply:(n,e)=>{const t=n.getMeta(Ko);return t&&console.log("apply",t),(t==null?void 0:t.type)==="show"?{active:t.payload}:(t==null?void 0:t.type)==="hide"?{active:null}:e}},props:{decorations:n=>{var o;const e=(o=Ko.getState(n))==null?void 0:o.active;if(!e)return null;const t=Ve.widget(e.pos,()=>{const r=document.createElement("span");return r.className="inline-placeholder",r.textContent=e.label||"Type...",r.addEventListener("click",()=>{this.options.onShowInline(e)}),r});return Se.create(n.doc,[t])}},view:()=>({destroy:this.options.onHideInline})})]}}),is=[{type:"paragraph",content:[]}],F1=[{type:"listItem",content:[{type:"paragraph",content:[]}]}],H1=[{type:"taskItem",content:[{type:"paragraph",content:[]}]}],lI=[{type:"details",attrs:{open:!1},content:[{type:"detailsSummary",content:[]},{type:"detailsContent",content:is}]}],j1=[{type:"codeBlock",attrs:{language:"mermaid"},content:[{type:"text",text:`graph TD
|
|
167
|
+
Mermaid --> Diagram`}]}];function ke(){const n=c.inject("isEditable",{value:!0});function e(i,s,l={}){if(!i.isEditable)return;const a=i==null?void 0:i.chain().focus(),u=i==null?void 0:i.commands;switch(s){case"inlineMath":o(i);break;default:t(u,a,s,l);break}}function t(i,s,l,a={}){switch(l){case"aiBlock":s.toggleAiBlock().run();break;case"highlight":a.color?i.setHighlight({color:a.color}):i.unsetHighlight();break;case"backgroundColor":a.color?i.setBackgroundColor(a.color):i.unsetBackgroundColor();break;case"blockMath":i.insertBlockMath({latex:""});break;case"blockquote":s.toggleBlockquote().run();break;case"bold":s.toggleBold().run();break;case"bulletList":s.toggleBulletList().run();break;case"callout":s.toggleCallout().run();break;case"clearFormat":s.unsetAllMarks().run();break;case"code":s.toggleCode().run();break;case"codeBlock":i.toggleCodeBlock({language:"bash"});break;case"color":s.setColor(a.color).run();break;case"copySelected":i.copySelected();break;case"content":i.insertContent(a.content);break;case"deleteSelected":i.deleteSelected();break;case"details":a.type==="detailsSummary"?i.unsetDetails():i.setDetails();break;case"diagram":i.insertContent(j1);break;case"duplicateSelected":i.duplicateSelected();break;case"emoji":i.insertContent(":");break;case"fontFamily":i.setFontFamily(a.fontFamily);break;case"heading":s.toggleHeading(a).run();break;case"horizontalRule":s.setHorizontalRule().run();break;case"image":s.setImage({src:"init"}).run();break;case"imageUpdate":s.setImage(a).run();break;case"inlineMathDelete":i.deleteInlineMath(a);break;case"inlineMathInsert":i.insertInlineMath(a);break;case"inlineMathUpdate":i.updateInlineMath(a);break;case"italic":s.toggleItalic().run();break;case"linkSet":s.extendMarkRange("link").setLink(a).run();break;case"linkUnset":s.extendMarkRange("link").unsetLink().run();break;case"orderedList":s.toggleOrderedList().run();break;case"paragraph":s.setParagraph().run();break;case"strike":s.toggleStrike().run();break;case"subscript":i.toggleSubscript();break;case"superscript":i.toggleSuperscript();break;case"table":s.insertTable({rows:3,cols:3,withHeaderRow:!0}).run();break;case"tableAddColumn":s.addColumnAfter().run();break;case"tableAddRow":s.addRowAfter().run();break;case"tableCellAttribute":s.setCellAttribute(a.name,a.value).run();break;case"tableDeleteColumn":s.deleteColumn().run();break;case"tableDeleteRow":s.deleteRow().run();break;case"tableDelete":s.deleteTable().run();break;case"tableInsert":s.insertTable(a).run();break;case"tableMergeCells":s.mergeCells().run();break;case"tableSelectColumn":s.selectColumn(a.pos).run();break;case"tableSelectRow":s.selectRow(a.pos).run();break;case"tableSplitCell":s.splitCell().run();break;case"taskList":i.toggleTaskList();break;case"textAlign":s.setTextAlign(a.textAlign).run();break;case"underline":s.toggleUnderline().run();break;case"video":s.setVideo({src:"init"}).run()}}function o(i){const{state:s,view:l}=i,{from:a}=s.selection,d=l.domAtPos(a).node.getBoundingClientRect(),f=s.tr.setMeta(Ko,{type:"show",payload:{type:"inlineMath",label:"New equation",pos:a,rect:d}}).setSelection(s.selection);l.dispatch(f)}function r(i){const s=[];return i.state.doc.descendants((l,a)=>{l.type.name==="image"&&s.push({pos:a,attrs:l.attrs})}),s}return{isEditable:n,onCommand:t,run:e,getEditorImages:r}}const zn=c.defineComponent({__name:"OTooltip",props:{placement:{type:String,default:"top"},trigger:{type:String,default:"mouseenter focus"},delay:{type:Number,default:100},duration:{type:Number,default:100},offset:{type:Object,default:function(){return[0,10]}}},setup(n){const e=n,{theme:t}=Bi(),o=c.ref(),r=c.ref(),i=c.ref();function s(){i.value=No(o.value,{appendTo:()=>document.body,animation:"perspective",content:r.value,duration:e.duration,delay:e.delay,interactive:!0,offset:e.offset,placement:e.placement,trigger:e.trigger})}function l(){i.value.setProps({theme:t.value})}return c.watch(t,a=>{l()}),c.onMounted(()=>{s()}),c.onUnmounted(()=>{i.value&&i.value.destroy()}),(a,u)=>(c.openBlock(),c.createElementBlock("div",{ref_key:"triggerRef",ref:o,"data-tippy-role":"tooltip"},[c.renderSlot(a.$slots,"trigger"),c.createElementVNode("div",{ref_key:"contentRef",ref:r,class:"tooltip-content"},[c.renderSlot(a.$slots,"default")],512)],512))}}),Ae=c.defineComponent({__name:"OMenubarBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(n,{emit:e}){const t=e;return(o,r)=>(c.openBlock(),c.createBlock(zn,{class:"o-tooltip",placement:n.placement},{trigger:c.withCtx(()=>[c.createElementVNode("button",{class:c.normalizeClass(["o-menubar-btn o-command-btn o-btn",n.contentClass]),style:c.normalizeStyle(n.contentStyle),onClick:r[0]||(r[0]=i=>t("click",i))},[c.createVNode(X,{name:n.icon,color:n.color,class:c.normalizeClass(n.iconClass)},null,8,["name","color","class"]),c.renderSlot(o.$slots,"default")],6)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(n.tooltip),1)]),_:3},8,["placement"]))}}),aI=c.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(n){const e=n,{run:t}=ke(),{tr:o}=de(),r=c.computed(()=>({aiViewer:{icon:"auto_awesome",tooltip:o("label.ai")},blockquote:{icon:"format_quote_open",tooltip:o("editor.blockquote")},bold:{icon:"format_bold",tooltip:o("editor.bold")},callout:{icon:"card_text",tooltip:o("editor.callout")},clearFormat:{icon:"format_clear",tooltip:o("editor.removeFormat")},code:{icon:"code",tooltip:o("editor.code")},codeBlock:{icon:"code_braces",tooltip:o("editor.codeBlock")},columns:{icon:"splitscreen_vertical_add",tooltip:"Column",rotate:!0},horizontalRule:{icon:"horizontal_rule",tooltip:o("editor.hr")},italic:{icon:"format_italic",tooltip:o("editor.italic")},image:{icon:"image",tooltip:o("editor.photo")},inlineMath:{icon:"function",tooltip:o("editor.inlineMath")},blockMath:{icon:"functions",tooltip:o("editor.blockMath")},inlineMathDelete:{icon:"close",tooltip:o("editor.delete")},linkUnset:{icon:"link_off",tooltip:o("link.off")},modelViewer:{icon:"3d_rotation",tooltip:o("label.modelViewer")},strike:{icon:"format_strikethrough",tooltip:o("editor.strikethrough")},underline:{icon:"format_underlined",tooltip:o("editor.underline")},video:{icon:"videocam",tooltip:o("editor.video")},aiBlock:{icon:"auto_awesome",tooltip:o("editor.aiBlock")},diagram:{icon:"mermaid",tooltip:o("diagram.name")}})),i=c.computed(()=>r.value[e.name]||{icon:"",isActive:!1,command:()=>{}});function s(){t(e.editor,e.name)}return(l,a)=>{var u;return c.openBlock(),c.createBlock(Ae,{class:"o-simple-command-btn",icon:i.value.icon,tooltip:i.value.tooltip,"content-class":{"is-active":(u=n.editor)==null?void 0:u.isActive(n.name),"rotate-90":i.value.rotate},onClick:s},null,8,["icon","tooltip","content-class"])}}}),Qm=c.defineComponent({__name:"OAlignDropdown",props:{editor:{type:Object},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"click"}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(null),i=c.computed(()=>[{label:t("editor.left"),value:"left",icon:"format_align_left"},{label:t("editor.center"),value:"center",icon:"format_align_center"},{label:t("editor.right"),value:"right",icon:"format_align_right"},{label:t("editor.justify"),value:"justify",icon:"format_align_justify"}]);function s(l){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,"textAlign",{textAlign:l})}return(l,a)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",placement:n.placement,trigger:n.trigger,"show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"format_align_center","content-class":"o-align-dropdown dropdown",tooltip:c.unref(t)("editor.align")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>{var f;return c.openBlock(),c.createBlock(c.unref(Ut),{key:d,class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive({textAlign:u.value})}),onClick:p=>s(u.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:u.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive({textAlign:u.value})?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},8,["placement","trigger"]))}}),U1=c.defineComponent({__name:"OCodeBlockDownloadDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["download"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),{run:i}=ke(),s=c.ref(null),l=c.computed(()=>[{label:r("editor.code"),value:"code",icon:"code"},{label:"SVG",value:"svg",icon:"mermaid"}]);function a(d){return t.modelValue===d.value}function u(d){var f;(f=s.value)==null||f.setShow(!1),o("download",d.value)}return(d,f)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:s,class:"o-simple-command-btn","content-class":"dropdown",placement:"bottom-end",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{"content-class":"o-code-block-download-dropdown dropdown",icon:"download",tooltip:c.unref(r)("label.download")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(l.value,(p,h)=>(c.openBlock(),c.createBlock(c.unref(Ut),{key:h,class:c.normalizeClass({"is-active":a(p)}),onClick:m=>u(p)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:p.icon},null,8,["name"])]),suffix:c.withCtx(()=>[a(p)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(p.label)+" ",1)]),_:2},1032,["class","onClick"]))),128))]),_:1})]),_:1},512))}}),W1=c.defineComponent({__name:"OCodeBlockViewDropdown",props:{modelValue:{type:String,default:"splitVertical"}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),{run:i}=ke(),s=c.ref(null),l=c.computed(()=>[{label:r("editor.code"),value:"code",icon:"code"},{label:r("label.preview"),value:"preview",icon:"mermaid"},{label:r("label.splitHorizontal"),value:"splitHorizontal",icon:"splitscreen_right"},{label:r("label.splitVertical"),value:"splitVertical",icon:"splitscreen_bottom"},{label:r("label.help"),value:"help",icon:"help",suffixIcon:"open_in_new",separator:!0}]),a=c.computed(()=>l.value.find(f=>f.value===t.modelValue));function u(f){return t.modelValue===f.value}function d(f){var p;switch((p=s.value)==null||p.setShow(!1),f.value){case"help":window.open("https://mermaid.js.org/intro/","target");break;default:o("update:modelValue",f.value)}}return(f,p)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:s,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{"content-class":"o-code-block-view-dropdown dropdown",icon:a.value.icon,tooltip:c.unref(r)("label.view")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["icon","tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(l.value,(h,m)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:m},[h.separator?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:c.normalizeClass({"is-active":u(h)}),onClick:g=>d(h)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:h.icon},null,8,["name"])]),suffix:c.withCtx(()=>[h.suffixIcon?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:h.suffixIcon,small:""},null,8,["name"])):u(h)?(c.openBlock(),c.createBlock(c.unref(X),{key:1,name:"done",small:""})):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(h.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),Zm=c.defineComponent({__name:"OLinkBtn",props:{editor:{type:Jt}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(),i=c.ref(!1),s=c.ref(""),l=c.ref(!0);function a(){var p;s.value="",l.value=!0;const f=(p=e.editor)==null?void 0:p.getAttributes("link");f!=null&&f.href&&(s.value=f.href,l.value=f.target==="_blank",console.log("show",i.value,f,l.value))}function u(){var f;(f=r.value)==null||f.setShow(!1)}function d(f){var p;f?o(e.editor,"linkSet",{href:f,target:l.value?"_blank":""}):o(e.editor,"linkUnset"),(p=r.value)==null||p.setShow(!1)}return(f,p)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[p[1]||(p[1]=h=>i.value=h),a]},{trigger:c.withCtx(()=>{var h;return[c.createVNode(c.unref(nt),{icon:"link","content-class":{"is-active":(h=n.editor)==null?void 0:h.isActive("link")},tooltip:c.unref(t)("editor.hyperlink")},null,8,["content-class","tooltip"])]}),default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(Ed),{key:0,title:c.unref(t)("editor.hyperlink"),val:s.value,icon:"link",onCancel:u,onConfirm:d},{"header-right":c.withCtx(()=>[c.createVNode(c.unref(dg),{modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=h=>l.value=h),label:c.unref(t)("link.openInNewTab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):c.createCommentVNode("",!0)]),_:1},8,["show"]))}}),cI={class:"o-block-placeholder"},uI={class:"icon"},dI={class:"placeholder"},xd=c.defineComponent({__name:"OBlockPlaceholder",props:{icon:{type:String,default:"image"},placeholder:{type:String,default:""}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("section",cI,[c.createElementVNode("div",uI,[c.createVNode(c.unref(X),{name:n.icon},null,8,["name"])]),c.createElementVNode("div",dI,c.toDisplayString(n.placeholder),1)]))}}),fI={class:"group o-tips"},pI={key:1,class:"item"},Cd=c.defineComponent({__name:"OBlockList",props:{items:{type:Array,required:!0},useKeyboard:{type:Boolean,required:!1}},emits:["select"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),i=c.ref([]),s=(h,m)=>{h&&(i.value[m]=h)},l=c.ref(0);function a(h,m,g){o("select",h,g),i.value[m]&&i.value[m].setShow(!1)}function u(){l.value=(l.value+t.items.length-1)%t.items.length}function d(){l.value=(l.value+1)%t.items.length}function f(){a(t.items[l.value],l.value)}function p(h){switch(h.key){case"ArrowUp":h.preventDefault(),u();break;case"ArrowDown":h.preventDefault(),d();break;case"Enter":h.preventDefault(),f();break}}return c.watch(()=>t.useKeyboard,h=>{h?window.addEventListener("keydown",p):window.removeEventListener("keydown",p)}),c.onMounted(()=>{t.useKeyboard&&window.addEventListener("keydown",p)}),c.onBeforeUnmount(()=>{t.useKeyboard&&window.removeEventListener("keydown",p)}),(h,m)=>(c.openBlock(),c.createBlock(c.unref(ln),{class:"o-block-list",hoverable:"",clickable:""},{default:c.withCtx(()=>[n.items.length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(n.items,(g,y)=>{var b;return c.openBlock(),c.createElementBlock(c.Fragment,{key:y},[g.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[y>0?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",fI,c.toDisplayString(c.unref(r)(g.group)),1)],64)):c.createCommentVNode("",!0),(b=g.children)!=null&&b.length?(c.openBlock(),c.createBlock(c.unref($e),{key:1,ref_for:!0,ref:v=>s(v,y),placement:"right-start",offset:[-10,16]},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Jp),{item:g,class:c.normalizeClass(["item",{"is-active":y===l.value}]),clickable:""},null,8,["item","class"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Cd),{items:g.children,onSelect:v=>a(g,y,v)},null,8,["items","onSelect"])]),_:2},1536)):(c.openBlock(),c.createBlock(c.unref(Jp),{key:2,item:g,class:c.normalizeClass(["item",{"is-active":y===l.value}]),clickable:"",onClick:v=>a(g,y)},null,8,["item","class","onClick"]))],64)}),128)):(c.openBlock(),c.createElementBlock("div",pI,c.toDisplayString(c.unref(r)("label.noResults")),1))]),_:1}))}}),hI={key:0,class:"o-tips"},Jp=c.defineComponent({__name:"OBlockListItem",props:{item:{type:Object,required:!0}},emits:["select"],setup(n,{emit:e}){const{tr:t}=de();return(o,r)=>(c.openBlock(),c.createBlock(c.unref(Ut),{class:"o-block-list-item",clickable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:n.item.icon,color:n.item.color},null,8,["name","color"])]),suffix:c.withCtx(()=>{var i;return[n.item.tips?(c.openBlock(),c.createElementBlock("span",hI,c.toDisplayString(n.item.tips),1)):c.createCommentVNode("",!0),(i=n.item.children)!=null&&i.length?(c.openBlock(),c.createBlock(c.unref(X),{key:1,name:"navigate_next",class:"o-tips"})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)(n.item.label)),1)]),_:1}))}}),Gp=(n,e)=>G0(e,n.extensionManager.extensions),mI=()=>{const n=typeof navigator<"u"&&/Mac|iPod|iPhone|iPad/.test(navigator.platform);return{mod:n?"⌘":"Ctrl",alt:n?"⌥":"Alt",shift:n?"⇧":"Shift",ctrl:n?"⌃":"Ctrl",meta:n?"⌘":"Meta"}},gI=n=>{const e=n==null?void 0:n.split("+").map(r=>r.trim().toLowerCase()).filter(Boolean);if(!e||!e.length)return n;const t=mI();return e.map(r=>t[r]??r.toUpperCase()).join("+")},yI={key:1,class:"group o-tips"},bI={class:"suffix o-tips"},vI={key:1,class:"item"},Fr=c.defineComponent({__name:"OBlockMenu",props:{...Ye,colorful:{type:Boolean,default:!1},showGroup:{type:Boolean,default:!1}},emits:["action"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),{run:i}=ke(),s=c.ref([]),l=c.computed(()=>{var b;return(b=t.node)==null?void 0:b.type.name}),a=c.computed(()=>ks.find(b=>b.value===l.value)),u=c.computed(()=>{const b=a.value?gc.filter(k=>{var x;return((x=k.filter)==null?void 0:x.indexOf("style"))>=0})??[]:[];let v=gc.filter(k=>{var x;return((x=k.filter)==null?void 0:x.indexOf(l.value))>=0})??[];if(v=v.concat(b),v.length>0){const k=v[0];k.group=`editor.${l.value}`}const w=gc.filter(k=>{var x;return((x=k.filter)==null?void 0:x.indexOf("common"))>=0});return[...v,...w]});function d(b){switch(b.component){case"OCalloutColorBoard":return tg;case"OTextColorBoard":return og;default:return null}}function f(b){setTimeout(()=>{p(b),o("action",b)},0)}function p(b){switch(b.value){case"copy":h();break;case"delete":m();break;case"duplicate":g();break}}function h(){i(t.editor,"copySelected")}function m(){i(t.editor,"deleteSelected")}function g(){i(t.editor,"duplicateSelected")}function y(b,v){switch(console.log("select",b,v),v.name){case"backColor":t.updateAttributes({backColor:v.value});break;case"foreColor":t.updateAttributes({borderColor:v.value});break;case"color":i(t.editor,v.name,{color:v.value});break;case"backgroundColor":i(t.editor,v.name,{color:v.value});break}}return(b,v)=>(c.openBlock(),c.createBlock(c.unref(ln),{class:"o-block-menu",hoverable:"",clickable:""},{default:c.withCtx(()=>[u.value.length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(u.value,(w,k)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:k},[w.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[k>0||a.value?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0})):c.createCommentVNode("",!0),n.showGroup?(c.openBlock(),c.createElementBlock("div",yI,c.toDisplayString(c.unref(r)(w.group)),1)):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0),d(w)?(c.openBlock(),c.createBlock(c.unref($e),{key:1,ref_for:!0,ref:s.value[w.value],offset:[0,4],placement:"right"},{trigger:c.withCtx(()=>[c.createVNode(c.unref(Ut),{class:"item",clickable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:w.icon,color:n.colorful?w.color:""},null,8,["name","color"])]),suffix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"navigate_next",class:"o-tips"})]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(r)(w.label)),1)]),_:2},1024)]),default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(d(w)),{onSelect:x=>y(w,x)},null,40,["onSelect"]))]),_:2},1536)):(c.openBlock(),c.createBlock(c.unref(Ut),{key:2,class:"item",clickable:"",onClick:c.withModifiers(x=>f(w),["stop"])},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:w.icon,color:n.colorful?w.color:""},null,8,["name","color"])]),suffix:c.withCtx(()=>[c.createElementVNode("div",bI,c.toDisplayString(c.unref(gI)(w.tips)),1)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(r)(w.label)),1)]),_:2},1032,["onClick"]))],64))),128)):(c.openBlock(),c.createElementBlock("div",vI,"No result"))]),_:1}))}}),Eo=c.defineComponent({__name:"OBlockPopover",props:{modelValue:{type:Boolean,default:!1},placement:{type:String,default:"bottom-center"},showArrow:{type:Boolean,default:!1},hideClickOutside:{type:Boolean,default:!1},readonly:{type:Boolean,default:!1},tippyClass:{type:String,default:""},contentClass:{type:String,default:""},offset:{type:Object,default:function(){return[0,10]}}},emits:["update:modelValue","show","hide"],setup(n,{emit:e}){const t=n,o=e,r=c.ref();function i(l){o("update:modelValue",l)}function s(){console.log("click outside"),t.hideClickOutside&&o("update:modelValue",!1)}return c.watch(()=>t.modelValue,l=>{var a,u;l&&!t.readonly?(a=r.value)==null||a.setShow(!0):(u=r.value)==null||u.setShow(!1)}),c.onMounted(()=>{var l;t.modelValue&&((l=r.value)==null||l.setShow(!0))}),c.onUnmounted(()=>{var l;(l=r.value)==null||l.setShow(!1)}),(l,a)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,placement:n.placement,"tippy-class":n.tippyClass,"content-class":n.contentClass,trigger:"manual",arrow:n.showArrow,offset:n.offset,show:n.modelValue&&!n.readonly,"onUpdate:show":i,onClickoutside:s},{trigger:c.withCtx(()=>[c.renderSlot(l.$slots,"default")]),default:c.withCtx(()=>[c.renderSlot(l.$slots,"popover-content")]),_:3},8,["placement","tippy-class","content-class","arrow","offset","show"]))}}),kI={class:"o-block-toolbar editable-only"},wI={class:"button-group"},eg=c.defineComponent({__name:"OBlockToolbar",props:{...Ye,type:{type:String,default:"link"},trigger:{type:String,default:"click"}},emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=de(),{isEditable:s,run:l}=ke(),a=c.ref();function u(d){var f;o("action",d),(f=a.value)==null||f.setShow(!1)}return(d,f)=>(c.openBlock(),c.createElementBlock("div",kI,[c.createElementVNode("section",wI,[c.renderSlot(d.$slots,"default"),c.createVNode(c.unref($e),{ref_key:"popover",ref:a,placement:"bottom-end",size:"medium",trigger:n.trigger,"show-arrow":!1},{trigger:c.withCtx(()=>[c.unref(s)?(c.openBlock(),c.createBlock(c.unref(nt),{key:0,icon:"more_horiz",tooltip:c.unref(i)("label.more")},null,8,["tooltip"])):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createVNode(c.unref(Fr),c.mergeProps(t,{onAction:u}),null,16)]),_:1},8,["trigger"])])]))}}),xI={class:"o-callout-color-board"},CI={class:"fore-colors"},SI={class:"color-row"},EI={class:"color-row"},MI={class:"back-colors"},TI={class:"color-row"},NI={class:"color-row"},tg=c.defineComponent({__name:"OCalloutColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(n,{emit:e}){const t=e;function o(s,l){t("select",{name:s,value:l.value})}const r=c.computed(()=>[{label:"Grey",value:"#e9e9e9"},{label:"Brown",value:"#ffd591"},{label:"Orange",value:"#ffbb96"},{label:"Yellow",value:"#fff08f"},{label:"Green",value:"#b7eb8f"},{label:"Blue",value:"#91d5ff"},{label:"Purple",value:"#d3adf7"},{label:"Pink",value:"#ffadd2"},{label:"Red",value:"#ffa39e"}]),i=c.computed(()=>[{label:"Grey",value:"#F5F5F5"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(s,l)=>(c.openBlock(),c.createElementBlock("section",xI,[c.createElementVNode("section",CI,[l[4]||(l[4]=c.createElementVNode("div",{class:"label o-tips"},"Border color",-1)),c.createElementVNode("div",SI,[c.createVNode(c.unref(Ae),{icon:"slash_forward",tooltip:"No color","content-class":"border",onClick:l[0]||(l[0]=a=>o("foreColor",{value:""}))}),n.foreColor?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,tooltip:"Last used","content-style":{borderColor:n.foreColor},onClick:l[1]||(l[1]=a=>o("foreColor",{value:n.foreColor}))},null,8,["content-style"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",EI,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(a,u)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:`col-${u}`,tooltip:a.label,"content-style":{borderColor:a.value},onClick:d=>o("foreColor",a)},null,8,["tooltip","content-style","onClick"]))),128))])]),c.createElementVNode("section",MI,[l[5]||(l[5]=c.createElementVNode("div",{class:"label o-tips"},"Background",-1)),c.createElementVNode("div",TI,[c.createVNode(c.unref(Ae),{icon:"slash_forward",tooltip:"Default Color","content-class":"border",onClick:l[2]||(l[2]=a=>o("backColor",{value:"#F5F5F5"}))}),n.backColor?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,"content-style":{backgroundColor:n.backColor},tooltip:"Last used","content-class":"border",onClick:l[3]||(l[3]=a=>o("backColor",{value:n.backColor}))},null,8,["content-style"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",NI,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(a,u)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:`col-${u}`,tooltip:a.label,"content-style":{backgroundColor:a.value},onClick:d=>o("backColor",a)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),AI=c.defineComponent({__name:"OCalloutColorDropdown",props:{editor:{type:Object}},emits:["select"],setup(n,{emit:e}){const t=e,{tr:o}=de(),{run:r}=ke(),i=c.ref(null),s=c.ref(""),l=c.ref("");function a(u,d){u==="foreColor"?(s.value=d,localStorage.setItem("yiitap.text-color.fore",d)):u==="backColor"&&(l.value=d,localStorage.setItem("yiitap.text-color.back",d)),t("select",u,d)}return c.onMounted(()=>{s.value=localStorage.getItem("yiitap.text-color.fore")||"",l.value=localStorage.getItem("yiitap.text-color.back")||""}),(u,d)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:i,placement:"bottom-center",trigger:"hover",arrow:""},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"palette",tooltip:c.unref(o)("editor.textColor")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>{var f;return[c.createVNode(c.unref(tg),{"fore-color":s.value,"back-color":l.value,"default-label":c.unref(o)("editor.defaultColor"),"active-color":(f=n.editor)==null?void 0:f.getAttributes("textStyle").color,onSelect:a},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),ya=c.defineComponent({__name:"OContextMenu",props:{modelValue:{type:Boolean,default:!1},clientX:{type:Number,default:0},clientY:{type:Number,default:0},event:{type:Object,default:function(){return{}}}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=c.ref();c.computed(()=>{var l;return t.clientX||((l=t.event)==null?void 0:l.clientX)||0}),c.computed(()=>{var l;return t.clientY||((l=t.event)==null?void 0:l.clientY)||0});function i(l){o("update:modelValue",l)}function s(){o("update:modelValue",!1)}return c.watch(()=>t.modelValue,l=>{var a;l?setTimeout(()=>{var u;(u=r.value)==null||u.setShow(l)},0):(a=r.value)==null||a.setShow(l)}),(l,a)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,placement:"bottom-start",trigger:"manual",show:n.modelValue,"show-arrow":!1,event:n.event,"onUpdate:show":i,onClickoutside:s},{default:c.withCtx(()=>[c.renderSlot(l.$slots,"default")]),_:3},8,["show","event"]))}}),OI={class:"o-color-board"},$I={class:"cell-container"},BI={class:"label"},RI=["onClick"],ki=c.defineComponent({__name:"OColorBoard",props:{defaultColor:{type:String,default:""},defaultLabel:{type:String,default:""},defaultDisabled:{type:Boolean,default:!1},activeColor:{type:String,default:""}},emits:["select"],setup(n,{emit:e}){const t=n,o=e;function r(a){o("select",a.hex)}function i(a){return t.activeColor===a}function s(a){return"abc"}const l=c.computed(()=>[[{label:"color",rgb:"rgb(0, 0, 0)",hex:"#000000"},{label:"color",rgb:"rgb(38, 38, 38)",hex:"#262626"},{label:"color",rgb:"rgb(89, 89, 89)",hex:"#595959"},{label:"color",rgb:"rgb(140, 140, 140)",hex:"#8c8c8c"},{label:"color",rgb:"rgb(191, 191, 191)",hex:"#bfbfbf"},{label:"color",rgb:"rgb(217, 217, 217)",hex:"#d9d9d9"},{label:"color",rgb:"rgb(233, 233, 233)",hex:"#e9e9e9"},{label:"color",rgb:"rgb(245, 245, 245)",hex:"#f5f5f5"},{label:"color",rgb:"rgb(250, 250, 250)",hex:"#fafafa",border:!0},{label:"color",rgb:"rgb(255, 255, 255)",hex:"#ffffff",border:!0}],[{label:"color",rgb:"rgb(245, 34, 45)",hex:"#f5222d"},{label:"color",rgb:"rgb(250, 84, 28)",hex:"#fa541c"},{label:"color",rgb:"rgb(250, 140, 22)",hex:"#fa8c16"},{label:"color",rgb:"rgb(250, 219, 20)",hex:"#fadb14"},{label:"color",rgb:"rgb(82, 196, 26)",hex:"#52c41a"},{label:"color",rgb:"rgb(19, 194, 194)",hex:"#13c2c2"},{label:"color",rgb:"rgb(24, 144, 255)",hex:"#1890ff"},{label:"color",rgb:"rgb(47, 84, 235)",hex:"#2f54eb"},{label:"color",rgb:"rgb(114, 46, 209)",hex:"#722ed1"},{label:"color",rgb:"rgb(235, 47, 150)",hex:"#eb2f96"}],[{label:"color",rgb:"rgb(255, 232, 230)",hex:"#ffe8e6"},{label:"color",rgb:"rgb(255, 236, 224)",hex:"#ffece0"},{label:"color",rgb:"rgb(255, 239, 209)",hex:"#ffefd1"},{label:"color",rgb:"rgb(255, 248, 189)",hex:"#fff8bd"},{label:"color",rgb:"rgb(228, 247, 210)",hex:"#e4f7d2"},{label:"color",rgb:"rgb(211, 245, 240)",hex:"#d3f5f0"},{label:"color",rgb:"rgb(212, 238, 252)",hex:"#d4eefc"},{label:"color",rgb:"rgb(222, 232, 252)",hex:"#dee8fc"},{label:"color",rgb:"rgb(239, 225, 250)",hex:"#efe1fa"},{label:"color",rgb:"rgb(250, 225, 235)",hex:"#fae1eb"}],[{label:"color",rgb:"rgb(255, 163, 158)",hex:"#ffa39e"},{label:"color",rgb:"rgb(255, 187, 150)",hex:"#ffbb96"},{label:"color",rgb:"rgb(255, 213, 145)",hex:"#ffd591"},{label:"color",rgb:"rgb(255, 240, 143)",hex:"#fff08f"},{label:"color",rgb:"rgb(183, 235, 143)",hex:"#b7eb8f"},{label:"color",rgb:"rgb(135, 232, 222)",hex:"#87e8de"},{label:"color",rgb:"rgb(145, 213, 255)",hex:"#91d5ff"},{label:"color",rgb:"rgb(173, 198, 255)",hex:"#adc6ff"},{label:"color",rgb:"rgb(211, 173, 247)",hex:"#d3adf7"},{label:"color",rgb:"rgb(255, 173, 210)",hex:"#ffadd2"}],[{label:"color",rgb:"rgb(255, 77, 79)",hex:"#ff4d4f"},{label:"color",rgb:"rgb(255, 122, 69)",hex:"#ff7a45"},{label:"color",rgb:"rgb(255, 169, 64)",hex:"#ffa940"},{label:"color",rgb:"rgb(255, 236, 61)",hex:"#ffec3d"},{label:"color",rgb:"rgb(115, 209, 61)",hex:"#73d13d"},{label:"color",rgb:"rgb(54, 207, 201)",hex:"#36cfc9"},{label:"color",rgb:"rgb(64, 169, 255)",hex:"#40a9ff"},{label:"color",rgb:"rgb(89, 126, 247)",hex:"#597ef7"},{label:"color",rgb:"rgb(146, 84, 222)",hex:"#9254de"},{label:"color",rgb:"rgb(247, 89, 171)",hex:"#f759ab"}],[{label:"color",rgb:"rgb(207, 19, 34)",hex:"#cf1322"},{label:"color",rgb:"rgb(212, 56, 13)",hex:"#d4380d"},{label:"color",rgb:"rgb(212, 107, 8)",hex:"#d46b08"},{label:"color",rgb:"rgb(212, 177, 6)",hex:"#d4b106"},{label:"color",rgb:"rgb(56, 158, 13)",hex:"#389e0d"},{label:"color",rgb:"rgb(8, 151, 156)",hex:"#08979c"},{label:"color",rgb:"rgb(9, 109, 217)",hex:"#096dd9"},{label:"color",rgb:"rgb(29, 57, 196)",hex:"#1d39c4"},{label:"color",rgb:"rgb(83, 29, 171)",hex:"#531dab"},{label:"color",rgb:"rgb(196, 29, 127)",hex:"#c41d7f"}],[{label:"color",rgb:"rgb(130, 0, 20)",hex:"#820014"},{label:"color",rgb:"rgb(135, 20, 0)",hex:"#871400"},{label:"color",rgb:"rgb(135, 56, 0)",hex:"#873800"},{label:"color",rgb:"rgb(97, 71, 0)",hex:"#614700"},{label:"color",rgb:"rgb(19, 82, 0)",hex:"#135200"},{label:"color",rgb:"rgb(0, 71, 79)",hex:"#00474f"},{label:"color",rgb:"rgb(0, 58, 140)",hex:"#003a8c"},{label:"color",rgb:"rgb(6, 17, 120)",hex:"#061178"},{label:"color",rgb:"rgb(34, 7, 94)",hex:"#22075e"},{label:"color",rgb:"rgb(120, 6, 80)",hex:"#780650"}]]);return(a,u)=>(c.openBlock(),c.createElementBlock("section",OI,[n.defaultDisabled?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,class:"default-color",onClick:u[0]||(u[0]=d=>r({hex:n.defaultColor}))},[c.createElementVNode("div",$I,[c.createElementVNode("div",{class:"cell border",style:c.normalizeStyle({background:n.defaultColor})},[c.createVNode(c.unref(X),{name:"slash_forward"})],4)]),c.createElementVNode("div",BI,c.toDisplayString(n.defaultLabel),1)])),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(l.value,(d,f)=>(c.openBlock(),c.createElementBlock("div",{class:"color-row",key:`row-${f}`},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(d,(p,h)=>(c.openBlock(),c.createElementBlock("div",{class:"",key:`col-${h}`},[c.createElementVNode("div",{class:"cell-container",onClick:m=>r(p)},[c.createElementVNode("div",{class:c.normalizeClass(["cell",{border:p.border}]),style:c.normalizeStyle({backgroundColor:p.hex})},[i(p.hex)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",style:c.normalizeStyle({color:s(p.rgb)})},null,8,["style"])):c.createCommentVNode("",!0)],6)],8,RI)]))),128))]))),128))]))}}),nt=c.defineComponent({__name:"OCommandBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(n,{emit:e}){const t=e;return(o,r)=>(c.openBlock(),c.createBlock(c.unref(zn),{placement:n.placement},{trigger:c.withCtx(()=>[c.createElementVNode("button",{class:c.normalizeClass(["o-menubar-btn o-command-btn o-btn",n.contentClass]),style:c.normalizeStyle(n.contentStyle),onClick:r[0]||(r[0]=i=>t("click",i))},[n.icon?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:n.icon,color:n.color,class:c.normalizeClass(n.iconClass)},null,8,["name","color","class"])):c.createCommentVNode("",!0),c.renderSlot(o.$slots,"default")],6)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(n.tooltip),1)]),_:3},8,["placement"]))}}),_I={key:0,class:"o-doc-toc toc"},DI={class:"mini-view"},II={class:"toc__list"},LI={class:"main-view o-scroll",style:{"max-width":"480px"}},PI={class:"toc__title"},VI={class:"toc__list"},zI=["onClick"],FI=c.defineComponent({name:"ODocToc",__name:"ODocToc",props:{editor:{type:Jt},maxLevel:{type:Number,default:3}},emits:["docScroll"],setup(n,{expose:e,emit:t}){const o=n,r=t,{tr:i}=de(),s=c.ref([]),l=c.ref("");function a(){var h;l.value=window.location.hash,(h=o.editor)==null||h.on("update",d),setTimeout(()=>{u(),d()},0)}function u(){const h=document.querySelector(".yiitap"),m=h==null?void 0:h.parentElement;m==null||m.addEventListener("scroll",f)}function d(){var m;const h=[];(m=o.editor)==null||m.state.doc.descendants((g,y)=>{if(g.type.name==="heading"){const b=g.attrs.id;h.push({level:g.attrs.level,text:g.textContent,id:b})}}),s.value=h}function f(h){for(const m of s.value){const g=document.querySelector(`[data-id="${m.id}"]`);if(!g)continue;const y=g.getBoundingClientRect();if(y.top>=0&&y.top<window.innerHeight/2){l.value=m.id;break}}r("docScroll",h)}function p(h){l.value=h.id;const m=document.querySelector(`[data-id="${h.id}"]`);m&&m.scrollIntoView({behavior:"smooth",block:"start"})}return c.watch(()=>o.editor,h=>{a()}),e({onScroll:f,headings:s}),(h,m)=>s.value.length?(c.openBlock(),c.createElementBlock("section",_I,[c.createVNode(c.unref($e),{ref:"popover","tippy-class":"o-toc-popover",placement:"left-start",offset:[0,-50],delay:0,duration:100},{trigger:c.withCtx(()=>[c.createElementVNode("div",DI,[c.createElementVNode("ul",II,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(s.value,(g,y)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:y},[g.level<=Math.max(Math.min(n.maxLevel,3),2)?(c.openBlock(),c.createElementBlock("li",{key:0,class:c.normalizeClass(["toc__item",[l.value===g.id?"selected":"",`toc__item--${g.level}`]])},null,2)):c.createCommentVNode("",!0)],64))),128))])])]),default:c.withCtx(()=>[c.createElementVNode("div",LI,[c.createElementVNode("div",PI,c.toDisplayString(c.unref(i)("label.toc")),1),c.renderSlot(h.$slots,"title"),c.createElementVNode("ul",VI,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(s.value,(g,y)=>(c.openBlock(),c.createElementBlock("li",{class:c.normalizeClass(["toc__item",`toc__item--${g.level}`]),key:y},[c.createElementVNode("span",{class:c.normalizeClass(["heading",{selected:l.value===g.id}]),onClick:b=>p(g)},c.toDisplayString(g.text),11,zI)],2))),128))])])]),_:3},512)])):c.createCommentVNode("",!0)}}),HI={class:"o-emoji-select"},jI={key:0},UI={class:"groups o-scroll"},WI={class:"items"},qI=["onClick"],KI={key:0,class:"groups-empty"},JI={class:"group-icons"},GI=["onClick"],Sd=c.defineComponent({__name:"OEmojiSelect",props:{items:{type:Array,required:!0},enableSearch:{type:Boolean,default:!1}},emits:["select"],setup(n,{emit:e}){const t=n,o=e,r=c.ref(null),i=c.ref(""),s=c.ref([]),l=c.ref([]),a=c.ref(0),u=c.computed(()=>i.value?s.value:t.items),d=c.computed(()=>{let m=!1;return u.value.map(g=>{m=m||g.emojis.length}),m});function f(){a.value=0,s.value=i.value?Tl.filterEmojiGroups(i.value):[]}function p(m){o("select",m)}function h(m,g){a.value=g,l.value[g].scrollIntoView({behavior:"instant",block:"start"})}return c.onMounted(()=>{}),(m,g)=>(c.openBlock(),c.createElementBlock("section",HI,[n.enableSearch?(c.openBlock(),c.createElementBlock("div",jI,[c.createVNode(c.unref(Zn),{ref_key:"input",ref:r,modelValue:i.value,"onUpdate:modelValue":[g[0]||(g[0]=y=>i.value=y),f],type:"text",autofocus:"",clearable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])])):c.createCommentVNode("",!0),c.createElementVNode("section",UI,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(u.value,(y,b)=>{var v;return c.withDirectives((c.openBlock(),c.createElementBlock("div",{key:`group-${b}`,class:"group"},[c.createElementVNode("header",{ref_for:!0,ref_key:"groupRefs",ref:l},c.toDisplayString(y.name),513),c.createElementVNode("section",WI,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(y.emojis,(w,k)=>(c.openBlock(),c.createElementBlock("div",{key:`item-${k}`},[c.createElementVNode("div",{class:"item",onClick:x=>p(w)},c.toDisplayString(w.emoji),9,qI)]))),128))])],512)),[[c.vShow,(v=y.emojis)==null?void 0:v.length]])}),128)),d.value?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",KI,"没有记录"))]),c.createElementVNode("section",JI,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(u.value,(y,b)=>(c.openBlock(),c.createBlock(c.unref(zn),{key:`target-${b}`,delay:300},{trigger:c.withCtx(()=>{var v;return[c.withDirectives(c.createElementVNode("div",{class:c.normalizeClass(["item",{active:a.value===b}]),onClick:w=>h(y,b)},[c.createVNode(c.unref(X),{name:c.unref(Tl.emojiGroupIcons)[y.slug]},null,8,["name"])],10,GI),[[c.vShow,(v=y.emojis)==null?void 0:v.length]])]}),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(y.name),1)]),_:2},1024))),128))])]))}}),Qs=[{label:"1C Enterprise",value:"1c",ext:["1c","v8c"],icon:"code_blocks"},{label:"ABNF",value:"abnf",ext:["abnf"],icon:"code_blocks"},{label:"Access Log",value:"accesslog",ext:["log"],icon:"code_blocks"},{label:"ActionScript",value:"actionscript",ext:["as"],icon:"code_blocks"},{label:"Ada",value:"ada",ext:["adb","ads","ada"],icon:"code_blocks"},{label:"AngelScript",value:"angelscript",ext:["as","asc"],icon:"code_blocks"},{label:"Apache Config",value:"apache",ext:["conf","htaccess"],icon:"code_blocks"},{label:"AppleScript",value:"applescript",ext:["scpt","applescript"],icon:"code_blocks"},{label:"Arcade",value:"arcade",ext:["arcade"],icon:"code_blocks"},{label:"Arduino",value:"arduino",ext:["ino","pde"],icon:"code_blocks"},{label:"ARM Assembly",value:"armasm",ext:["s","asm"],icon:"code_blocks"},{label:"AsciiDoc",value:"asciidoc",ext:["adoc","asciidoc"],icon:"code_blocks"},{label:"AspectJ",value:"aspectj",ext:["aj"],icon:"code_blocks"},{label:"AutoHotkey",value:"autohotkey",ext:["ahk"],icon:"code_blocks"},{label:"AutoIt",value:"autoit",ext:["au3"],icon:"code_blocks"},{label:"AVR Assembly",value:"avrasm",ext:["s","asm"],icon:"code_blocks"},{label:"AWK",value:"awk",ext:["awk","gawk","mawk"," nawk"],icon:"code_blocks"},{label:"Axapta",value:"axapta",ext:["xpo","axp"],icon:"code_blocks"},{label:"BASIC",value:"basic",ext:["bas"],icon:"code_blocks"},{label:"Bash",value:"bash",ext:["sh","bash","zsh"],icon:"code_blocks"},{label:"BNF",value:"bnf",ext:["bnf"],icon:"code_blocks"},{label:"Brainfuck",value:"brainfuck",ext:["bf","b"],icon:"code_blocks"},{label:"CAL",value:"cal",ext:["cal"],icon:"code_blocks"},{label:"Capn Proto",value:"capnproto",ext:["capnp"],icon:"code_blocks"},{label:"Ceylon",value:"ceylon",ext:["ceylon"],icon:"code_blocks"},{label:"Clean",value:"clean",ext:["icl","dcl","prg"],icon:"code_blocks"},{label:"Clojure",value:"clojure",ext:["clj","cljs","cljc"],icon:"code_blocks"},{label:"Clojure REPL",value:"clojure-repl",ext:["clj"],icon:"code_blocks"},{label:"CMake",value:"cmake",ext:["cmake","CMakeLists.txt"],icon:"code_blocks"},{label:"CoffeeScript",value:"coffeescript",ext:["coffee","litcoffee"],icon:"code_blocks"},{label:"Coq",value:"coq",ext:["v"],icon:"code_blocks"},{label:"COS",value:"cos",ext:["cos"],icon:"code_blocks"},{label:"C++",value:"cpp",ext:["cpp","hpp","cc","cxx","h","hxx"],icon:"code_blocks"},{label:"crmsh",value:"crmsh",ext:["crm","pcs"],icon:"code_blocks"},{label:"Crystal",value:"crystal",ext:["cr"],icon:"code_blocks"},{label:"C#",value:"csharp",ext:["cs"],icon:"code_blocks"},{label:"CSP",value:"csp",ext:["csp"],icon:"code_blocks"},{label:"CSS",value:"css",ext:["css"],icon:"code_blocks"},{label:"C",value:"c",ext:["c","h"],icon:"code_blocks"},{label:"D",value:"d",ext:["d","di"],icon:"code_blocks"},{label:"Dart",value:"dart",ext:["dart"],icon:"code_blocks"},{label:"Delphi",value:"delphi",ext:["pas","dfm","dpr","dpk"],icon:"code_blocks"},{label:"Diff",value:"diff",ext:["diff","patch"],icon:"code_blocks"},{label:"Django",value:"django",ext:["html","py","css","js"],icon:"code_blocks"},{label:"DNS Zone File",value:"dns",ext:["zone","dns"],icon:"code_blocks"},{label:"Dockerfile",value:"dockerfile",ext:["Dockerfile","dockerfile"],icon:"code_blocks"},{label:"DOS Batch",value:"dos",ext:["bat","cmd"],icon:"code_blocks"},{label:"dsconfig",value:"dsconfig",ext:["dsconfig"],icon:"code_blocks"},{label:"DTS",value:"dts",ext:["dts","dtsi"],icon:"code_blocks"},{label:"Dust",value:"dust",ext:["dust","dst"],icon:"code_blocks"},{label:"EBNF",value:"ebnf",ext:["ebnf"],icon:"code_blocks"},{label:"Elixir",value:"elixir",ext:["ex","exs"],icon:"code_blocks"},{label:"Elm",value:"elm",ext:["elm"],icon:"code_blocks"},{label:"ERB",value:"erb",ext:["erb","rhtml"],icon:"code_blocks"},{label:"Erlang",value:"erlang",ext:["erl","hrl"],icon:"code_blocks"},{label:"Erlang REPL",value:"erlang-repl",ext:["erl"],icon:"code_blocks"},{label:"Excel",value:"excel",ext:["xls","xlsx"],icon:"code_blocks"},{label:"FIX",value:"fix",ext:["fix"],icon:"code_blocks"},{label:"Flix",value:"flix",ext:["flix"],icon:"code_blocks"},{label:"Fortran",value:"fortran",ext:["f","for","f90","f95","f03","f08"],icon:"code_blocks"},{label:"F#",value:"fsharp",ext:["fs","fsi","fsx"],icon:"code_blocks"},{label:"GAMS",value:"gams",ext:["gms","gams"],icon:"code_blocks"},{label:"Gauss",value:"gauss",ext:["gss","prg"],icon:"code_blocks"},{label:"G-code",value:"gcode",ext:["nc","gcode","g","ngc"],icon:"code_blocks"},{label:"Gherkin",value:"gherkin",ext:["feature"],icon:"code_blocks"},{label:"GLSL",value:"glsl",ext:["vert","frag","geom","comp","tesc","tese","glsl"],icon:"code_blocks"},{label:"GameMaker Language",value:"gml",ext:["gml","gm81","gm"],icon:"code_blocks"},{label:"Golo",value:"golo",ext:["golo"],icon:"code_blocks"},{label:"Go",value:"go",ext:["go"],icon:"code_blocks"},{label:"Gradle",value:"gradle",ext:["gradle","gradle.kts"],icon:"code_blocks"},{label:"GraphQL",value:"graphql",ext:["graphql","gql"],icon:"code_blocks"},{label:"Groovy",value:"groovy",ext:["groovy","gvy","gy","gsh"],icon:"code_blocks"},{label:"Haml",value:"haml",ext:["haml"],icon:"code_blocks"},{label:"Handlebars",value:"handlebars",ext:["hbs","handlebars","html"],icon:"code_blocks"},{label:"Haskell",value:"haskell",ext:["hs","lhs"],icon:"code_blocks"},{label:"Haxe",value:"haxe",ext:["hx"],icon:"code_blocks"},{label:"HSP",value:"hsp",ext:["hsp"],icon:"code_blocks"},{label:"HTML",value:"html",ext:["html"],icon:"code_blocks"},{label:"HTTP",value:"http",ext:["http","rest"],icon:"code_blocks"},{label:"Hy",value:"hy",ext:["hy"],icon:"code_blocks"},{label:"Inform 7",value:"inform7",ext:["ni","i7x"],icon:"code_blocks"},{label:"INI",value:"ini",ext:["ini","cfg","conf"],icon:"code_blocks"},{label:"IRPF90",value:"irpf90",ext:["90","f90","f95","f03","f08"],icon:"code_blocks"},{label:"ISBL",value:"isbl",ext:["isbl"],icon:"code_blocks"},{label:"Java",value:"java",ext:["java"],icon:"code_blocks"},{label:"JavaScript",value:"javascript",ext:["js","jsx"],icon:"code_blocks"},{label:"JBoss CLI",value:"jboss-cli",ext:["cli"],icon:"code_blocks"},{label:"Julia",value:"julia",ext:["jl"],icon:"code_blocks"},{label:"Julia REPL",value:"julia-repl",ext:["jl"],icon:"code_blocks"},{label:"JSON",value:"json",ext:["json"],icon:"code_blocks"},{label:"Kotlin",value:"kotlin",ext:["kt","kts"],icon:"code_blocks"},{label:"Lasso",value:"lasso",ext:["lasso","ls","lasso9"],icon:"code_blocks"},{label:"LaTeX",value:"latex",ext:["tex","latex"],icon:"code_blocks"},{label:"LDIF",value:"ldif",ext:["ldif"],icon:"code_blocks"},{label:"Leaf",value:"leaf",ext:["leaf"],icon:"code_blocks"},{label:"Less",value:"less",ext:["less"],icon:"code_blocks"},{label:"Lisp",value:"lisp",ext:["lisp","lsp","cl"],icon:"code_blocks"},{label:"LiveCode Server",value:"livecodeserver",ext:["lc","livecode"],icon:"code_blocks"},{label:"LiveScript",value:"livescript",ext:["ls"],icon:"code_blocks"},{label:"LLVM",value:"llvm",ext:["ll","bc"],icon:"code_blocks"},{label:"LSL",value:"lsl",ext:["lsl"],icon:"code_blocks"},{label:"Lua",value:"lua",ext:["lua"],icon:"code_blocks"},{label:"Makefile",value:"makefile",ext:["make","Makefile","GNUmakefile"],icon:"code_blocks"},{label:"Markdown",value:"markdown",ext:["md","markdown","mdown","mkdn"],icon:"code_blocks"},{label:"Mathematica",value:"mathematica",ext:["nb","m","wl"],icon:"code_blocks"},{label:"MATLAB",value:"matlab",ext:["m"],icon:"code_blocks"},{label:"Maxima",value:"maxima",ext:["mac","max"],icon:"code_blocks"},{label:"MEL",value:"mel",ext:["mel"],icon:"code_blocks"},{label:"Mermaid",value:"mermaid",ext:["mermaid"],icon:"mermaid"},{label:"Mercury",value:"mercury",ext:["m","moo"],icon:"code_blocks"},{label:"MIPS Assembly",value:"mipsasm",ext:["s","asm"],icon:"code_blocks"},{label:"Mizar",value:"mizar",ext:["miz"],icon:"code_blocks"},{label:"Mojolicious",value:"mojolicious",ext:["pl","pm"],icon:"code_blocks"},{label:"Monkey",value:"monkey",ext:["monkey","mk"],icon:"code_blocks"},{label:"MoonScript",value:"moonscript",ext:["moon"],icon:"code_blocks"},{label:"N1QL",value:"n1ql",ext:["n1ql"],icon:"code_blocks"},{label:"NestedText",value:"nestedtext",ext:["nt"],icon:"code_blocks"},{label:"Nginx",value:"nginx",ext:["conf","nginx"],icon:"code_blocks"},{label:"Nim",value:"nim",ext:["nim","nims"],icon:"code_blocks"},{label:"Nix",value:"nix",ext:["nix"],icon:"code_blocks"},{label:"Node.js REPL",value:"node-repl",ext:["js"],icon:"code_blocks"},{label:"NSIS",value:"nsis",ext:["nsi","nsh"],icon:"code_blocks"},{label:"Objective-C",value:"objectivec",ext:["m","mm"],icon:"code_blocks"},{label:"OCaml",value:"ocaml",ext:["ml","mli","mll","mly"],icon:"code_blocks"},{label:"OpenSCAD",value:"openscad",ext:["scad"],icon:"code_blocks"},{label:"Oxygene",value:"oxygene",ext:["pas","dpr","pp"],icon:"code_blocks"},{label:"Parser3",value:"parser3",ext:["p3"],icon:"code_blocks"},{label:"Perl",value:"perl",ext:["pl","pm","t","pod"],icon:"code_blocks"},{label:"PF",value:"pf",ext:["pf"],icon:"code_blocks"},{label:"PostgreSQL",value:"pgsql",ext:["sql","pgsql"],icon:"code_blocks"},{label:"PHP Template",value:"php-template",ext:["phtml","php"],icon:"code_blocks"},{label:"PHP",value:"php",ext:["php","php3","php4","php5","phps","phpt"],icon:"code_blocks"},{label:"Plain Text",value:"plaintext",ext:["txt","text","md","markdown"],icon:"code_blocks"},{label:"Pony",value:"pony",ext:["pony"],icon:"code_blocks"},{label:"PowerShell",value:"powershell",ext:["ps1","psm1","psd1"],icon:"code_blocks"},{label:"Processing",value:"processing",ext:["pde"],icon:"code_blocks"},{label:"Profile",value:"profile",ext:["profile","rc","bashrc","zshrc"],icon:"code_blocks"},{label:"Prolog",value:"prolog",ext:["pl","pro","prolog"],icon:"code_blocks"},{label:"Properties",value:"properties",ext:["properties","ini","cfg"],icon:"code_blocks"},{label:"Protocol Buffers",value:"protobuf",ext:["proto"],icon:"code_blocks"},{label:"Puppet",value:"puppet",ext:["pp"],icon:"code_blocks"},{label:"PureBasic",value:"purebasic",ext:["pb","pbi"],icon:"code_blocks"},{label:"Python REPL",value:"python-repl",ext:["py"],icon:"code_blocks"},{label:"Python",value:"python",ext:["py","pyw","cpy","gyp"],icon:"code_blocks"},{label:"Q",value:"q",ext:["q"],icon:"code_blocks"},{label:"QML",value:"qml",ext:["qml","js"],icon:"code_blocks"},{label:"R",value:"r",ext:["r","R","rmd","Rmd"],icon:"code_blocks"},{label:"ReasonML",value:"reasonml",ext:["re","rei"],icon:"code_blocks"},{label:"RIB",value:"rib",ext:["rib"],icon:"code_blocks"},{label:"Roboconf",value:"roboconf",ext:["graph","instances"],icon:"code_blocks"},{label:"RouterOS",value:"routeros",ext:["rsc","txt"],icon:"code_blocks"},{label:"RSL",value:"rsl",ext:["rsl"],icon:"code_blocks"},{label:"Ruby",value:"ruby",ext:["rb","rbw","rake","gemspec","ru"],icon:"code_blocks"},{label:"Rust",value:"rust",ext:["rs","rlib"],icon:"code_blocks"},{label:"Rules Language",value:"ruleslanguage",ext:["rules"],icon:"code_blocks"},{label:"SAS",value:"sas",ext:["sas"],icon:"code_blocks"},{label:"Scala",value:"scala",ext:["scala","sc","sbt"],icon:"code_blocks"},{label:"Scheme",value:"scheme",ext:["scm","ss","rkt","rktd","rktl"],icon:"code_blocks"},{label:"Scilab",value:"scilab",ext:["sci","sce"],icon:"code_blocks"},{label:"SCSS",value:"scss",ext:["scss","sass"],icon:"code_blocks"},{label:"Shell",value:"shell",ext:["sh","bash","zsh","ksh","csh","tcsh"],icon:"code_blocks"},{label:"Smali",value:"smali",ext:["smali"],icon:"code_blocks"},{label:"Smalltalk",value:"smalltalk",ext:["st"],icon:"code_blocks"},{label:"Standard ML",value:"sml",ext:["sml","sig","fun"],icon:"code_blocks"},{label:"SQL",value:"sql",ext:["sql","ddl","dml"],icon:"code_blocks"},{label:"SQF",value:"sqf",ext:["sqf"],icon:"code_blocks"},{label:"Stan",value:"stan",ext:["stan"],icon:"code_blocks"},{label:"Stata",value:"stata",ext:["do","ado","mata"],icon:"code_blocks"},{label:"Step21",value:"step21",ext:["stp","step"],icon:"code_blocks"},{label:"Stylus",value:"stylus",ext:["styl","stylus"],icon:"code_blocks"},{label:"Subunit",value:"subunit",ext:["subunit"],icon:"code_blocks"},{label:"SVG",value:"svg",ext:["svg"],icon:"code_blocks"},{label:"Swift",value:"swift",ext:["swift"],icon:"code_blocks"},{label:"Tagger Script",value:"taggerscript",ext:["tag"],icon:"code_blocks"},{label:"TAP",value:"tap",ext:["tap"],icon:"code_blocks"},{label:"Tcl",value:"tcl",ext:["tcl","tk","itcl","itk"],icon:"code_blocks"},{label:"Thrift",value:"thrift",ext:["thrift"],icon:"code_blocks"},{label:"TOML",value:"toml",ext:["toml"],icon:"code_blocks"},{label:"TP",value:"tp",ext:["tp"],icon:"code_blocks"},{label:"Twig",value:"twig",ext:["twig","tpl"],icon:"code_blocks"},{label:"TypeScript",value:"typescript",ext:["ts","tsx"],icon:"code_blocks"},{label:"Vala",value:"vala",ext:["vala","vapi"],icon:"code_blocks"},{label:"VB.NET",value:"vbnet",ext:["vb"],icon:"code_blocks"},{label:"VBScript (HTML)",value:"vbscript-html",ext:["html","htm","asp","vbs"],icon:"code_blocks"},{label:"VBScript",value:"vbscript",ext:["vbs","vbe"],icon:"code_blocks"},{label:"Verilog",value:"verilog",ext:["v","vh","sv","svh"],icon:"code_blocks"},{label:"VHDL",value:"vhdl",ext:["vhd","vhdl"],icon:"code_blocks"},{label:"Vim",value:"vim",ext:["vim","vba","vbe","exrc"],icon:"code_blocks"},{label:"WebAssembly",value:"wasm",ext:["wasm","wat"],icon:"code_blocks"},{label:"Wren",value:"wren",ext:["wren"],icon:"code_blocks"},{label:"x86 Assembly",value:"x86asm",ext:["asm","s","S"],icon:"code_blocks"},{label:"XL",value:"xl",ext:["xl","xls","xlsx"],icon:"code_blocks"},{label:"XML",value:"xml",ext:["xml","xsd","xsl","xslt","rss","atom","svg"],icon:"code_blocks"},{label:"XQuery",value:"xquery",ext:["xq","xquery","xql","xqm"],icon:"code_blocks"},{label:"YAML",value:"yaml",ext:["yaml","yml"],icon:"code_blocks"},{label:"Zephir",value:"zephir",ext:["zep"],icon:"code_blocks"}],XI={class:"selected-language"},YI={class:"header"},QI={class:"o-scroll"},q1=c.defineComponent({__name:"OLanguageDropdown",props:{language:{type:String,default:"shell"}},emits:["select"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),i=c.ref(),s=c.ref(),l=c.ref(""),a=c.ref(0),u=c.ref(""),d=c.computed(()=>l.value?Qs.filter(b=>b.value.toLowerCase().indexOf(l.value.toLowerCase())>=0):Qs),f=c.computed(()=>{let b=Qs.find(v=>v.value===u.value);return b||(b=Qs.find(v=>v.ext.includes(u.value))),b});function p(b){b&&setTimeout(()=>{var v;(v=s.value)==null||v.focus(),a.value=0,window.addEventListener("keyup",y)},0)}function h(){var b;window.removeEventListener("keyup",y),(b=i.value)==null||b.setShow(!1)}function m(b){h(),u.value=b.value,o("select",b.value)}function g(){m(d.value[a.value])}function y(b){if(d.value.length>0){switch(b.code){case"ArrowDown":a.value=a.value+1;break;case"ArrowUp":a.value=a.value-1;break;case"Enter":g();break}a.value>=d.value.length&&(a.value=0),a.value<0&&(a.value=d.value.length-1)}else a.value=0}return c.onMounted(()=>{u.value=t.language}),(b,v)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:i,placement:"bottom-start",trigger:"click","tippy-class":"o-language-popover","conten-class":"dropdown","onUpdate:show":p},{trigger:c.withCtx(()=>[c.createVNode(c.unref(He),{class:"o-dropdown-btn"},{default:c.withCtx(()=>{var w;return[c.createElementVNode("span",XI,c.toDisplayString((w=f.value)==null?void 0:w.label),1),c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]}),_:1})]),default:c.withCtx(()=>[c.createElementVNode("header",YI,[c.createVNode(c.unref(Zn),{ref_key:"input",ref:s,modelValue:l.value,"onUpdate:modelValue":v[0]||(v[0]=w=>l.value=w),type:"text",placeholder:"Search",autofocus:"",clearable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"search",class:"o-tips"})]),_:1},8,["modelValue"])]),c.createElementVNode("section",QI,[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(d.value,(w,k)=>(c.openBlock(),c.createBlock(c.unref(Ut),{key:k,onClick:x=>m(w),class:c.normalizeClass({"is-active":w.value===u.value,"is-select":k===a.value})},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:w.icon},null,8,["name"])]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(w.label)+" ",1)]),_:2},1032,["onClick","class"]))),128))]),_:1})])]),_:1},512))}}),ZI={class:"o-media-input"},eL={class:"fields"},tL={class:"actions"},ng=c.defineComponent({__name:"OMediaInput",props:{val:{type:String,default:""},type:{type:String,default:""}},emits:["input"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),i=c.ref(),s=c.ref(""),l=c.ref("");function a(){return l.value?(s.value="null",!0):(s.value="error",!1)}function u(){a()&&o("input",l.value)}return c.onMounted(()=>{l.value=t.val,setTimeout(()=>{var d;(d=i.value)==null||d.focus()},0)}),(d,f)=>(c.openBlock(),c.createElementBlock("section",ZI,[c.createElementVNode("section",eL,[f[1]||(f[1]=c.createElementVNode("div",{class:"o-media-title"},"Link",-1)),c.createVNode(c.unref(Zn),{ref_key:"input",ref:i,modelValue:l.value,"onUpdate:modelValue":f[0]||(f[0]=p=>l.value=p),status:s.value,type:"text",autofocus:"",clearable:"",onEnter:u},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"link",class:"o-tips"})]),_:1},8,["modelValue","status"])]),c.createElementVNode("footer",tL,[c.createVNode(c.unref(He),{type:"info",onClick:u},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(r)("label.ok")),1)]),_:1})])]))}}),nL={class:"o-meta-input"},oL={class:"header"},rL={class:"title"},iL={class:"fields"},sL={class:"actions"},Ed=c.defineComponent({__name:"OMetaInput",props:{val:{type:String,default:""},title:{type:String,default:"Link"},type:{type:String,default:"link"},icon:{type:String,default:"link"},secondIcon:{type:String,default:""},secondLabel:{type:String,default:""}},emits:["cancel","confirm"],setup(n,{emit:e}){const t=n,o=e,{tr:r}=de(),i=c.ref(null),s=c.ref("");function l(){console.log("confirm",s.value),o("confirm",s.value)}return c.onMounted(()=>{s.value=t.val,setTimeout(()=>{var a;(a=i.value)==null||a.focus()},0)}),(a,u)=>(c.openBlock(),c.createElementBlock("section",nL,[c.createElementVNode("section",oL,[c.createElementVNode("div",rL,c.toDisplayString(n.title),1),c.createElementVNode("div",null,[c.renderSlot(a.$slots,"header-right")])]),c.createElementVNode("section",iL,[c.createVNode(c.unref(Zn),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":u[0]||(u[0]=d=>s.value=d),type:"text",autofocus:"",clearable:"",onEnter:l},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:n.icon,class:"o-tips"},null,8,["name"])]),_:1},8,["modelValue"])]),c.createElementVNode("footer",sL,[c.createVNode(c.unref(He),{type:"tertiary",onClick:u[1]||(u[1]=d=>o("cancel"))},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(r)("label.cancel")),1)]),_:1}),c.createVNode(c.unref(He),{type:"info",onClick:l},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(c.unref(r)("label.ok")),1)]),_:1})])]))}}),lL={class:"o-table-grid"},aL=["onMouseover"],K1=c.defineComponent({__name:"OTableGrid",emits:["select"],setup(n,{emit:e}){const t=e,o=c.ref(6),r=c.ref(6),i=c.ref(2),s=c.ref(2);function l(u,d){i.value=u,s.value=d,o.value===u&&o.value<10&&(o.value+=1),r.value===d&&r.value<10&&(r.value+=1)}function a(){t("select",{rows:i.value,cols:s.value,withHeaderRow:!0})}return(u,d)=>(c.openBlock(),c.createElementBlock("section",lL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(o.value,(f,p)=>(c.openBlock(),c.createElementBlock("div",{class:"rows",key:`row-${p}`},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(h,m)=>(c.openBlock(),c.createElementBlock("div",{key:`col-${m}`},[c.createElementVNode("div",{class:c.normalizeClass(["cell",{selected:f<=i.value&&h<=s.value}]),onMouseover:g=>l(f,h),onClick:a},null,42,aL)]))),128))]))),128)),c.createElementVNode("footer",null,c.toDisplayString(i.value)+" x "+c.toDisplayString(s.value),1)]))}}),cL={class:"o-table-cell-background o-button-group"},uL={class:"o-command-btn"},J1=c.defineComponent({__name:"OTableCellBackground",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(),i=c.ref("#ffec3d");function s(){l(i.value)}function l(a){r.value.setShow(!1),i.value=a,o(e.editor,"tableCellAttribute",{name:"background",value:i.value})}return(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom-start",trigger:"click"},{trigger:c.withCtx(()=>[c.createVNode(c.unref(zn),{trigger:"hover"},{trigger:c.withCtx(()=>[c.createElementVNode("div",cL,[c.createElementVNode("div",{class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},[c.createVNode(c.unref(X),{name:"crop_16_9",class:"arrow"}),c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),c.createElementVNode("div",uL,[c.createVNode(c.unref(X),{name:"arrow_drop_down"})])])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.highlightColor")),1)]),_:1})]),default:c.withCtx(()=>[c.createVNode(c.unref(ki),{"default-color":"","default-label":c.unref(t)("editor.noColor"),onSelect:l},null,8,["default-label"])]),_:1},512))}}),dL={class:"o-simple-color-board"},fL={class:"fore-colors"},pL={class:"label o-tips"},hL={class:"color-row"},mL={class:"color-row"},gL={class:"back-colors"},yL={class:"label o-tips"},bL={class:"color-row"},vL={class:"color-row"},og=c.defineComponent({__name:"OTextColorBoard",props:{foreColor:{type:String,default:""},backColor:{type:String,default:""},activeColor:{type:String,default:""}},emits:["select"],setup(n,{emit:e}){const t=e,{tr:o}=de();function r(l,a){t("select",{name:l,value:a.value})}const i=c.computed(()=>[{label:"Grey",value:"#787774"},{label:"Brown",value:"#9F6B53"},{label:"Orange",value:"#D9730D"},{label:"Yellow",value:"#CB912F"},{label:"Green",value:"#448361"},{label:"Blue",value:"#337EA9"},{label:"Purple",value:"#9065B0"},{label:"Pink",value:"#C14C8A"},{label:"Red",value:"#D44C47"}]),s=c.computed(()=>[{label:"Grey",value:"#F1F1EF"},{label:"Brown",value:"#F4EEEE"},{label:"Orange",value:"#FAEBDD"},{label:"Yellow",value:"#FBF3DB"},{label:"Green",value:"#EDF3EC"},{label:"Blue",value:"#E7F3F8"},{label:"Purple",value:"#F6F3F9"},{label:"Pink",value:"#FAF1F5"},{label:"Red",value:"#FDEBEC"}]);return(l,a)=>(c.openBlock(),c.createElementBlock("section",dL,[c.createElementVNode("section",fL,[c.createElementVNode("header",null,[c.createElementVNode("div",pL,c.toDisplayString(c.unref(o)("editor.textColor")),1),c.createVNode(c.unref($e),{ref:"popover",class:"o-simple-command-btn",size:"medium",placement:"right-start",trigger:"mouseenter",offset:[-9,14],"show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(zn),null,{trigger:c.withCtx(()=>[c.createVNode(c.unref(He),{icon:"more_horiz",class:"o-command-btn"})]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(o)("label.more")),1)]),_:1})]),default:c.withCtx(()=>[c.createVNode(c.unref(ki),{"default-color":"","default-disabled":"",onSelect:a[0]||(a[0]=u=>r("color",{value:u}))})]),_:1},512)]),c.createElementVNode("div",hL,[c.createVNode(c.unref(Ae),{icon:"format_text",tooltip:"Default color","content-class":"border",onClick:a[1]||(a[1]=u=>r("color",{value:""}))}),n.foreColor?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,icon:"format_text",color:n.foreColor,tooltip:"Last used","content-class":"border",onClick:a[2]||(a[2]=u=>r("color",{value:n.foreColor}))},null,8,["color"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",mL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:`col-${d}`,icon:"format_text",color:u.value,tooltip:u.label,onClick:f=>r("color",u)},null,8,["color","tooltip","onClick"]))),128))])]),c.createElementVNode("section",gL,[c.createElementVNode("header",null,[c.createElementVNode("div",yL,c.toDisplayString(c.unref(o)("editor.backgroundColor")),1),c.createVNode(c.unref($e),{ref:"popover",class:"o-simple-command-btn",size:"medium",placement:"right-start",trigger:"mouseenter",offset:[-9,14],"show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(zn),null,{trigger:c.withCtx(()=>[c.createVNode(c.unref(He),{icon:"more_horiz",class:"o-command-btn"})]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(o)("label.more")),1)]),_:1})]),default:c.withCtx(()=>[c.createVNode(c.unref(ki),{"default-color":"","default-disabled":"",onSelect:a[3]||(a[3]=u=>r("backgroundColor",{value:u}))})]),_:1},512)]),c.createElementVNode("div",bL,[c.createVNode(c.unref(Ae),{icon:"slash_forward",tooltip:"No Color","content-class":"border",onClick:a[4]||(a[4]=u=>r("backgroundColor",{value:""}))}),n.backColor?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,icon:"format_text",tooltip:"Last used","content-class":"border","content-style":{backgroundColor:n.backColor},onClick:a[5]||(a[5]=u=>r("backgroundColor",{value:n.backColor}))},null,8,["content-style"])):c.createCommentVNode("",!0)]),c.createElementVNode("div",vL,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(s.value,(u,d)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:`col-${d}`,icon:"format_text",tooltip:u.label,"content-style":{backgroundColor:u.value},onClick:f=>r("backgroundColor",u)},null,8,["tooltip","content-style","onClick"]))),128))])])]))}}),G1=["top","right","bottom","left"],nv=["start","end"],ov=G1.reduce((n,e)=>n.concat(e,e+"-"+nv[0],e+"-"+nv[1]),[]),Xn=Math.min,Ht=Math.max,Cu=Math.round,Ua=Math.floor,vo=n=>({x:n,y:n}),kL={left:"right",right:"left",bottom:"top",top:"bottom"},wL={start:"end",end:"start"};function Xp(n,e,t){return Ht(n,Xn(e,t))}function tr(n,e){return typeof n=="function"?n(e):n}function Fn(n){return n.split("-")[0]}function Kn(n){return n.split("-")[1]}function X1(n){return n==="x"?"y":"x"}function rg(n){return n==="y"?"height":"width"}const xL=new Set(["top","bottom"]);function go(n){return xL.has(Fn(n))?"y":"x"}function ig(n){return X1(go(n))}function Y1(n,e,t){t===void 0&&(t=!1);const o=Kn(n),r=ig(n),i=rg(r);let s=r==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=Eu(s)),[s,Eu(s)]}function CL(n){const e=Eu(n);return[Su(n),e,Su(e)]}function Su(n){return n.replace(/start|end/g,e=>wL[e])}const rv=["left","right"],iv=["right","left"],SL=["top","bottom"],EL=["bottom","top"];function ML(n,e,t){switch(n){case"top":case"bottom":return t?e?iv:rv:e?rv:iv;case"left":case"right":return e?SL:EL;default:return[]}}function TL(n,e,t,o){const r=Kn(n);let i=ML(Fn(n),t==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(Su)))),i}function Eu(n){return n.replace(/left|right|bottom|top/g,e=>kL[e])}function NL(n){return{top:0,right:0,bottom:0,left:0,...n}}function sg(n){return typeof n!="number"?NL(n):{top:n,right:n,bottom:n,left:n}}function xs(n){const{x:e,y:t,width:o,height:r}=n;return{width:o,height:r,top:t,left:e,right:e+o,bottom:t+r,x:e,y:t}}function sv(n,e,t){let{reference:o,floating:r}=n;const i=go(e),s=ig(e),l=rg(s),a=Fn(e),u=i==="y",d=o.x+o.width/2-r.width/2,f=o.y+o.height/2-r.height/2,p=o[l]/2-r[l]/2;let h;switch(a){case"top":h={x:d,y:o.y-r.height};break;case"bottom":h={x:d,y:o.y+o.height};break;case"right":h={x:o.x+o.width,y:f};break;case"left":h={x:o.x-r.width,y:f};break;default:h={x:o.x,y:o.y}}switch(Kn(e)){case"start":h[s]-=p*(t&&u?-1:1);break;case"end":h[s]+=p*(t&&u?-1:1);break}return h}const AL=async(n,e,t)=>{const{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=t,l=i.filter(Boolean),a=await(s.isRTL==null?void 0:s.isRTL(e));let u=await s.getElementRects({reference:n,floating:e,strategy:r}),{x:d,y:f}=sv(u,o,a),p=o,h={},m=0;for(let g=0;g<l.length;g++){const{name:y,fn:b}=l[g],{x:v,y:w,data:k,reset:x}=await b({x:d,y:f,initialPlacement:o,placement:p,strategy:r,middlewareData:h,rects:u,platform:s,elements:{reference:n,floating:e}});d=v??d,f=w??f,h={...h,[y]:{...h[y],...k}},x&&m<=50&&(m++,typeof x=="object"&&(x.placement&&(p=x.placement),x.rects&&(u=x.rects===!0?await s.getElementRects({reference:n,floating:e,strategy:r}):x.rects),{x:d,y:f}=sv(u,p,a)),g=-1)}return{x:d,y:f,placement:p,strategy:r,middlewareData:h}};async function Cs(n,e){var t;e===void 0&&(e={});const{x:o,y:r,platform:i,rects:s,elements:l,strategy:a}=n,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:p=!1,padding:h=0}=tr(e,n),m=sg(h),y=l[p?f==="floating"?"reference":"floating":f],b=xs(await i.getClippingRect({element:(t=await(i.isElement==null?void 0:i.isElement(y)))==null||t?y:y.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(l.floating)),boundary:u,rootBoundary:d,strategy:a})),v=f==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(l.floating)),k=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},x=xs(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:l,rect:v,offsetParent:w,strategy:a}):v);return{top:(b.top-x.top+m.top)/k.y,bottom:(x.bottom-b.bottom+m.bottom)/k.y,left:(b.left-x.left+m.left)/k.x,right:(x.right-b.right+m.right)/k.x}}const OL=n=>({name:"arrow",options:n,async fn(e){const{x:t,y:o,placement:r,rects:i,platform:s,elements:l,middlewareData:a}=e,{element:u,padding:d=0}=tr(n,e)||{};if(u==null)return{};const f=sg(d),p={x:t,y:o},h=ig(r),m=rg(h),g=await s.getDimensions(u),y=h==="y",b=y?"top":"left",v=y?"bottom":"right",w=y?"clientHeight":"clientWidth",k=i.reference[m]+i.reference[h]-p[h]-i.floating[m],x=p[h]-i.reference[h],C=await(s.getOffsetParent==null?void 0:s.getOffsetParent(u));let S=C?C[w]:0;(!S||!await(s.isElement==null?void 0:s.isElement(C)))&&(S=l.floating[w]||i.floating[m]);const M=k/2-x/2,N=S/2-g[m]/2-1,A=Xn(f[b],N),$=Xn(f[v],N),O=A,R=S-g[m]-$,I=S/2-g[m]/2+M,L=Xp(O,I,R),B=!a.arrow&&Kn(r)!=null&&I!==L&&i.reference[m]/2-(I<O?A:$)-g[m]/2<0,W=B?I<O?I-O:I-R:0;return{[h]:p[h]+W,data:{[h]:L,centerOffset:I-L-W,...B&&{alignmentOffset:W}},reset:B}}});function $L(n,e,t){return(n?[...t.filter(r=>Kn(r)===n),...t.filter(r=>Kn(r)!==n)]:t.filter(r=>Fn(r)===r)).filter(r=>n?Kn(r)===n||(e?Su(r)!==r:!1):!0)}const BL=function(n){return n===void 0&&(n={}),{name:"autoPlacement",options:n,async fn(e){var t,o,r;const{rects:i,middlewareData:s,placement:l,platform:a,elements:u}=e,{crossAxis:d=!1,alignment:f,allowedPlacements:p=ov,autoAlignment:h=!0,...m}=tr(n,e),g=f!==void 0||p===ov?$L(f||null,h,p):p,y=await Cs(e,m),b=((t=s.autoPlacement)==null?void 0:t.index)||0,v=g[b];if(v==null)return{};const w=Y1(v,i,await(a.isRTL==null?void 0:a.isRTL(u.floating)));if(l!==v)return{reset:{placement:g[0]}};const k=[y[Fn(v)],y[w[0]],y[w[1]]],x=[...((o=s.autoPlacement)==null?void 0:o.overflows)||[],{placement:v,overflows:k}],C=g[b+1];if(C)return{data:{index:b+1,overflows:x},reset:{placement:C}};const S=x.map(A=>{const $=Kn(A.placement);return[A.placement,$&&d?A.overflows.slice(0,2).reduce((O,R)=>O+R,0):A.overflows[0],A.overflows]}).sort((A,$)=>A[1]-$[1]),N=((r=S.filter(A=>A[2].slice(0,Kn(A[0])?2:3).every($=>$<=0))[0])==null?void 0:r[0])||S[0][0];return N!==l?{data:{index:b+1,overflows:x},reset:{placement:N}}:{}}}},RL=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,o;const{placement:r,middlewareData:i,rects:s,initialPlacement:l,platform:a,elements:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:p,fallbackStrategy:h="bestFit",fallbackAxisSideDirection:m="none",flipAlignment:g=!0,...y}=tr(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return{};const b=Fn(r),v=go(l),w=Fn(l)===l,k=await(a.isRTL==null?void 0:a.isRTL(u.floating)),x=p||(w||!g?[Eu(l)]:CL(l)),C=m!=="none";!p&&C&&x.push(...TL(l,g,m,k));const S=[l,...x],M=await Cs(e,y),N=[];let A=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&N.push(M[b]),f){const I=Y1(r,s,k);N.push(M[I[0]],M[I[1]])}if(A=[...A,{placement:r,overflows:N}],!N.every(I=>I<=0)){var $,O;const I=((($=i.flip)==null?void 0:$.index)||0)+1,L=S[I];if(L&&(!(f==="alignment"?v!==go(L):!1)||A.every(z=>go(z.placement)===v?z.overflows[0]>0:!0)))return{data:{index:I,overflows:A},reset:{placement:L}};let B=(O=A.filter(W=>W.overflows[0]<=0).sort((W,z)=>W.overflows[1]-z.overflows[1])[0])==null?void 0:O.placement;if(!B)switch(h){case"bestFit":{var R;const W=(R=A.filter(z=>{if(C){const U=go(z.placement);return U===v||U==="y"}return!0}).map(z=>[z.placement,z.overflows.filter(U=>U>0).reduce((U,me)=>U+me,0)]).sort((z,U)=>z[1]-U[1])[0])==null?void 0:R[0];W&&(B=W);break}case"initialPlacement":B=l;break}if(r!==B)return{reset:{placement:B}}}return{}}}};function lv(n,e){return{top:n.top-e.height,right:n.right-e.width,bottom:n.bottom-e.height,left:n.left-e.width}}function av(n){return G1.some(e=>n[e]>=0)}const _L=function(n){return n===void 0&&(n={}),{name:"hide",options:n,async fn(e){const{rects:t}=e,{strategy:o="referenceHidden",...r}=tr(n,e);switch(o){case"referenceHidden":{const i=await Cs(e,{...r,elementContext:"reference"}),s=lv(i,t.reference);return{data:{referenceHiddenOffsets:s,referenceHidden:av(s)}}}case"escaped":{const i=await Cs(e,{...r,altBoundary:!0}),s=lv(i,t.floating);return{data:{escapedOffsets:s,escaped:av(s)}}}default:return{}}}}};function Q1(n){const e=Xn(...n.map(i=>i.left)),t=Xn(...n.map(i=>i.top)),o=Ht(...n.map(i=>i.right)),r=Ht(...n.map(i=>i.bottom));return{x:e,y:t,width:o-e,height:r-t}}function DL(n){const e=n.slice().sort((r,i)=>r.y-i.y),t=[];let o=null;for(let r=0;r<e.length;r++){const i=e[r];!o||i.y-o.y>o.height/2?t.push([i]):t[t.length-1].push(i),o=i}return t.map(r=>xs(Q1(r)))}const IL=function(n){return n===void 0&&(n={}),{name:"inline",options:n,async fn(e){const{placement:t,elements:o,rects:r,platform:i,strategy:s}=e,{padding:l=2,x:a,y:u}=tr(n,e),d=Array.from(await(i.getClientRects==null?void 0:i.getClientRects(o.reference))||[]),f=DL(d),p=xs(Q1(d)),h=sg(l);function m(){if(f.length===2&&f[0].left>f[1].right&&a!=null&&u!=null)return f.find(y=>a>y.left-h.left&&a<y.right+h.right&&u>y.top-h.top&&u<y.bottom+h.bottom)||p;if(f.length>=2){if(go(t)==="y"){const A=f[0],$=f[f.length-1],O=Fn(t)==="top",R=A.top,I=$.bottom,L=O?A.left:$.left,B=O?A.right:$.right,W=B-L,z=I-R;return{top:R,bottom:I,left:L,right:B,width:W,height:z,x:L,y:R}}const y=Fn(t)==="left",b=Ht(...f.map(A=>A.right)),v=Xn(...f.map(A=>A.left)),w=f.filter(A=>y?A.left===v:A.right===b),k=w[0].top,x=w[w.length-1].bottom,C=v,S=b,M=S-C,N=x-k;return{top:k,bottom:x,left:C,right:S,width:M,height:N,x:C,y:k}}return p}const g=await i.getElementRects({reference:{getBoundingClientRect:m},floating:o.floating,strategy:s});return r.reference.x!==g.reference.x||r.reference.y!==g.reference.y||r.reference.width!==g.reference.width||r.reference.height!==g.reference.height?{reset:{rects:g}}:{}}}},LL=new Set(["left","top"]);async function PL(n,e){const{placement:t,platform:o,elements:r}=n,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=Fn(t),l=Kn(t),a=go(t)==="y",u=LL.has(s)?-1:1,d=i&&a?-1:1,f=tr(e,n);let{mainAxis:p,crossAxis:h,alignmentAxis:m}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return l&&typeof m=="number"&&(h=l==="end"?m*-1:m),a?{x:h*d,y:p*u}:{x:p*u,y:h*d}}const VL=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,o;const{x:r,y:i,placement:s,middlewareData:l}=e,a=await PL(e,n);return s===((t=l.offset)==null?void 0:t.placement)&&(o=l.arrow)!=null&&o.alignmentOffset?{}:{x:r+a.x,y:i+a.y,data:{...a,placement:s}}}}},zL=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){const{x:t,y:o,placement:r}=e,{mainAxis:i=!0,crossAxis:s=!1,limiter:l={fn:y=>{let{x:b,y:v}=y;return{x:b,y:v}}},...a}=tr(n,e),u={x:t,y:o},d=await Cs(e,a),f=go(Fn(r)),p=X1(f);let h=u[p],m=u[f];if(i){const y=p==="y"?"top":"left",b=p==="y"?"bottom":"right",v=h+d[y],w=h-d[b];h=Xp(v,h,w)}if(s){const y=f==="y"?"top":"left",b=f==="y"?"bottom":"right",v=m+d[y],w=m-d[b];m=Xp(v,m,w)}const g=l.fn({...e,[p]:h,[f]:m});return{...g,data:{x:g.x-t,y:g.y-o,enabled:{[p]:i,[f]:s}}}}}},FL=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(e){var t,o;const{placement:r,rects:i,platform:s,elements:l}=e,{apply:a=()=>{},...u}=tr(n,e),d=await Cs(e,u),f=Fn(r),p=Kn(r),h=go(r)==="y",{width:m,height:g}=i.floating;let y,b;f==="top"||f==="bottom"?(y=f,b=p===(await(s.isRTL==null?void 0:s.isRTL(l.floating))?"start":"end")?"left":"right"):(b=f,y=p==="end"?"top":"bottom");const v=g-d.top-d.bottom,w=m-d.left-d.right,k=Xn(g-d[y],v),x=Xn(m-d[b],w),C=!e.middlewareData.shift;let S=k,M=x;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(M=w),(o=e.middlewareData.shift)!=null&&o.enabled.y&&(S=v),C&&!p){const A=Ht(d.left,0),$=Ht(d.right,0),O=Ht(d.top,0),R=Ht(d.bottom,0);h?M=m-2*(A!==0||$!==0?A+$:Ht(d.left,d.right)):S=g-2*(O!==0||R!==0?O+R:Ht(d.top,d.bottom))}await a({...e,availableWidth:M,availableHeight:S});const N=await s.getDimensions(l.floating);return m!==N.width||g!==N.height?{reset:{rects:!0}}:{}}}};function Md(){return typeof window<"u"}function Ds(n){return Z1(n)?(n.nodeName||"").toLowerCase():"#document"}function Cn(n){var e;return(n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function Ao(n){var e;return(e=(Z1(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Z1(n){return Md()?n instanceof Node||n instanceof Cn(n).Node:!1}function Yn(n){return Md()?n instanceof Element||n instanceof Cn(n).Element:!1}function Mo(n){return Md()?n instanceof HTMLElement||n instanceof Cn(n).HTMLElement:!1}function cv(n){return!Md()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Cn(n).ShadowRoot}const HL=new Set(["inline","contents"]);function ba(n){const{overflow:e,overflowX:t,overflowY:o,display:r}=Qn(n);return/auto|scroll|overlay|hidden|clip/.test(e+o+t)&&!HL.has(r)}const jL=new Set(["table","td","th"]);function UL(n){return jL.has(Ds(n))}const WL=[":popover-open",":modal"];function Td(n){return WL.some(e=>{try{return n.matches(e)}catch{return!1}})}const qL=["transform","translate","scale","rotate","perspective"],KL=["transform","translate","scale","rotate","perspective","filter"],JL=["paint","layout","strict","content"];function lg(n){const e=ag(),t=Yn(n)?Qn(n):n;return qL.some(o=>t[o]?t[o]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||KL.some(o=>(t.willChange||"").includes(o))||JL.some(o=>(t.contain||"").includes(o))}function GL(n){let e=Dr(n);for(;Mo(e)&&!Ss(e);){if(lg(e))return e;if(Td(e))return null;e=Dr(e)}return null}function ag(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const XL=new Set(["html","body","#document"]);function Ss(n){return XL.has(Ds(n))}function Qn(n){return Cn(n).getComputedStyle(n)}function Nd(n){return Yn(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Dr(n){if(Ds(n)==="html")return n;const e=n.assignedSlot||n.parentNode||cv(n)&&n.host||Ao(n);return cv(e)?e.host:e}function eC(n){const e=Dr(n);return Ss(e)?n.ownerDocument?n.ownerDocument.body:n.body:Mo(e)&&ba(e)?e:eC(e)}function Wl(n,e,t){var o;e===void 0&&(e=[]),t===void 0&&(t=!0);const r=eC(n),i=r===((o=n.ownerDocument)==null?void 0:o.body),s=Cn(r);if(i){const l=Yp(s);return e.concat(s,s.visualViewport||[],ba(r)?r:[],l&&t?Wl(l):[])}return e.concat(r,Wl(r,[],t))}function Yp(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function tC(n){const e=Qn(n);let t=parseFloat(e.width)||0,o=parseFloat(e.height)||0;const r=Mo(n),i=r?n.offsetWidth:t,s=r?n.offsetHeight:o,l=Cu(t)!==i||Cu(o)!==s;return l&&(t=i,o=s),{width:t,height:o,$:l}}function cg(n){return Yn(n)?n:n.contextElement}function ss(n){const e=cg(n);if(!Mo(e))return vo(1);const t=e.getBoundingClientRect(),{width:o,height:r,$:i}=tC(e);let s=(i?Cu(t.width):t.width)/o,l=(i?Cu(t.height):t.height)/r;return(!s||!Number.isFinite(s))&&(s=1),(!l||!Number.isFinite(l))&&(l=1),{x:s,y:l}}const YL=vo(0);function nC(n){const e=Cn(n);return!ag()||!e.visualViewport?YL:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function QL(n,e,t){return e===void 0&&(e=!1),!t||e&&t!==Cn(n)?!1:e}function wi(n,e,t,o){e===void 0&&(e=!1),t===void 0&&(t=!1);const r=n.getBoundingClientRect(),i=cg(n);let s=vo(1);e&&(o?Yn(o)&&(s=ss(o)):s=ss(n));const l=QL(i,t,o)?nC(i):vo(0);let a=(r.left+l.x)/s.x,u=(r.top+l.y)/s.y,d=r.width/s.x,f=r.height/s.y;if(i){const p=Cn(i),h=o&&Yn(o)?Cn(o):o;let m=p,g=Yp(m);for(;g&&o&&h!==m;){const y=ss(g),b=g.getBoundingClientRect(),v=Qn(g),w=b.left+(g.clientLeft+parseFloat(v.paddingLeft))*y.x,k=b.top+(g.clientTop+parseFloat(v.paddingTop))*y.y;a*=y.x,u*=y.y,d*=y.x,f*=y.y,a+=w,u+=k,m=Cn(g),g=Yp(m)}}return xs({width:d,height:f,x:a,y:u})}function Ad(n,e){const t=Nd(n).scrollLeft;return e?e.left+t:wi(Ao(n)).left+t}function oC(n,e){const t=n.getBoundingClientRect(),o=t.left+e.scrollLeft-Ad(n,t),r=t.top+e.scrollTop;return{x:o,y:r}}function ZL(n){let{elements:e,rect:t,offsetParent:o,strategy:r}=n;const i=r==="fixed",s=Ao(o),l=e?Td(e.floating):!1;if(o===s||l&&i)return t;let a={scrollLeft:0,scrollTop:0},u=vo(1);const d=vo(0),f=Mo(o);if((f||!f&&!i)&&((Ds(o)!=="body"||ba(s))&&(a=Nd(o)),Mo(o))){const h=wi(o);u=ss(o),d.x=h.x+o.clientLeft,d.y=h.y+o.clientTop}const p=s&&!f&&!i?oC(s,a):vo(0);return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-a.scrollLeft*u.x+d.x+p.x,y:t.y*u.y-a.scrollTop*u.y+d.y+p.y}}function eP(n){return Array.from(n.getClientRects())}function tP(n){const e=Ao(n),t=Nd(n),o=n.ownerDocument.body,r=Ht(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=Ht(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight);let s=-t.scrollLeft+Ad(n);const l=-t.scrollTop;return Qn(o).direction==="rtl"&&(s+=Ht(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:l}}const uv=25;function nP(n,e){const t=Cn(n),o=Ao(n),r=t.visualViewport;let i=o.clientWidth,s=o.clientHeight,l=0,a=0;if(r){i=r.width,s=r.height;const d=ag();(!d||d&&e==="fixed")&&(l=r.offsetLeft,a=r.offsetTop)}const u=Ad(o);if(u<=0){const d=o.ownerDocument,f=d.body,p=getComputedStyle(f),h=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,m=Math.abs(o.clientWidth-f.clientWidth-h);m<=uv&&(i-=m)}else u<=uv&&(i+=u);return{width:i,height:s,x:l,y:a}}const oP=new Set(["absolute","fixed"]);function rP(n,e){const t=wi(n,!0,e==="fixed"),o=t.top+n.clientTop,r=t.left+n.clientLeft,i=Mo(n)?ss(n):vo(1),s=n.clientWidth*i.x,l=n.clientHeight*i.y,a=r*i.x,u=o*i.y;return{width:s,height:l,x:a,y:u}}function dv(n,e,t){let o;if(e==="viewport")o=nP(n,t);else if(e==="document")o=tP(Ao(n));else if(Yn(e))o=rP(e,t);else{const r=nC(n);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height}}return xs(o)}function rC(n,e){const t=Dr(n);return t===e||!Yn(t)||Ss(t)?!1:Qn(t).position==="fixed"||rC(t,e)}function iP(n,e){const t=e.get(n);if(t)return t;let o=Wl(n,[],!1).filter(l=>Yn(l)&&Ds(l)!=="body"),r=null;const i=Qn(n).position==="fixed";let s=i?Dr(n):n;for(;Yn(s)&&!Ss(s);){const l=Qn(s),a=lg(s);!a&&l.position==="fixed"&&(r=null),(i?!a&&!r:!a&&l.position==="static"&&!!r&&oP.has(r.position)||ba(s)&&!a&&rC(n,s))?o=o.filter(d=>d!==s):r=l,s=Dr(s)}return e.set(n,o),o}function sP(n){let{element:e,boundary:t,rootBoundary:o,strategy:r}=n;const s=[...t==="clippingAncestors"?Td(e)?[]:iP(e,this._c):[].concat(t),o],l=s[0],a=s.reduce((u,d)=>{const f=dv(e,d,r);return u.top=Ht(f.top,u.top),u.right=Xn(f.right,u.right),u.bottom=Xn(f.bottom,u.bottom),u.left=Ht(f.left,u.left),u},dv(e,l,r));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function lP(n){const{width:e,height:t}=tC(n);return{width:e,height:t}}function aP(n,e,t){const o=Mo(e),r=Ao(e),i=t==="fixed",s=wi(n,!0,i,e);let l={scrollLeft:0,scrollTop:0};const a=vo(0);function u(){a.x=Ad(r)}if(o||!o&&!i)if((Ds(e)!=="body"||ba(r))&&(l=Nd(e)),o){const h=wi(e,!0,i,e);a.x=h.x+e.clientLeft,a.y=h.y+e.clientTop}else r&&u();i&&!o&&r&&u();const d=r&&!o&&!i?oC(r,l):vo(0),f=s.left+l.scrollLeft-a.x-d.x,p=s.top+l.scrollTop-a.y-d.y;return{x:f,y:p,width:s.width,height:s.height}}function If(n){return Qn(n).position==="static"}function fv(n,e){if(!Mo(n)||Qn(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return Ao(n)===t&&(t=t.ownerDocument.body),t}function iC(n,e){const t=Cn(n);if(Td(n))return t;if(!Mo(n)){let r=Dr(n);for(;r&&!Ss(r);){if(Yn(r)&&!If(r))return r;r=Dr(r)}return t}let o=fv(n,e);for(;o&&UL(o)&&If(o);)o=fv(o,e);return o&&Ss(o)&&If(o)&&!lg(o)?t:o||GL(n)||t}const cP=async function(n){const e=this.getOffsetParent||iC,t=this.getDimensions,o=await t(n.floating);return{reference:aP(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function uP(n){return Qn(n).direction==="rtl"}const dP={convertOffsetParentRelativeRectToViewportRelativeRect:ZL,getDocumentElement:Ao,getClippingRect:sP,getOffsetParent:iC,getElementRects:cP,getClientRects:eP,getDimensions:lP,getScale:ss,isElement:Yn,isRTL:uP};function sC(n,e){return n.x===e.x&&n.y===e.y&&n.width===e.width&&n.height===e.height}function fP(n,e){let t=null,o;const r=Ao(n);function i(){var l;clearTimeout(o),(l=t)==null||l.disconnect(),t=null}function s(l,a){l===void 0&&(l=!1),a===void 0&&(a=1),i();const u=n.getBoundingClientRect(),{left:d,top:f,width:p,height:h}=u;if(l||e(),!p||!h)return;const m=Ua(f),g=Ua(r.clientWidth-(d+p)),y=Ua(r.clientHeight-(f+h)),b=Ua(d),w={rootMargin:-m+"px "+-g+"px "+-y+"px "+-b+"px",threshold:Ht(0,Xn(1,a))||1};let k=!0;function x(C){const S=C[0].intersectionRatio;if(S!==a){if(!k)return s();S?s(!1,S):o=setTimeout(()=>{s(!1,1e-7)},1e3)}S===1&&!sC(u,n.getBoundingClientRect())&&s(),k=!1}try{t=new IntersectionObserver(x,{...w,root:r.ownerDocument})}catch{t=new IntersectionObserver(x,w)}t.observe(n)}return s(!0),i}function pP(n,e,t,o){o===void 0&&(o={});const{ancestorScroll:r=!0,ancestorResize:i=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:l=typeof IntersectionObserver=="function",animationFrame:a=!1}=o,u=cg(n),d=r||i?[...u?Wl(u):[],...Wl(e)]:[];d.forEach(b=>{r&&b.addEventListener("scroll",t,{passive:!0}),i&&b.addEventListener("resize",t)});const f=u&&l?fP(u,t):null;let p=-1,h=null;s&&(h=new ResizeObserver(b=>{let[v]=b;v&&v.target===u&&h&&(h.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var w;(w=h)==null||w.observe(e)})),t()}),u&&!a&&h.observe(u),h.observe(e));let m,g=a?wi(n):null;a&&y();function y(){const b=wi(n);g&&!sC(g,b)&&t(),g=b,m=requestAnimationFrame(y)}return t(),()=>{var b;d.forEach(v=>{r&&v.removeEventListener("scroll",t),i&&v.removeEventListener("resize",t)}),f==null||f(),(b=h)==null||b.disconnect(),h=null,a&&cancelAnimationFrame(m)}}const Mu=VL,lC=BL,Tu=zL,Nu=RL,aC=FL,cC=_L,uC=OL,dC=IL,ql=(n,e,t)=>{const o=new Map,r={platform:dP,...t},i={...r.platform,_c:o};return AL(n,e,{...r,platform:i})};let hP=class{constructor(){Je(this,"instances",[])}error(e,t=3e3){this.show(e,"error",t)}info(e,t=3e3){this.show(e,"info",t)}success(e,t=3e3){this.show(e,"success",t)}warning(e,t=3e3){this.show(e,"warning",t)}show(e,t="info",o=3e3){const r=document.createElement("div");r.className=`o-toast ${t}`,r.innerHTML=`
|
|
168
|
+
<i class="yiitip-icon icon-${t}"></i>
|
|
169
|
+
<span class="message">${e}</span>
|
|
170
|
+
`,r.style.position="absolute",r.style.transition="opacity 0.3s ease, transform 0.3s ease",r.style.opacity="0",r.style.zIndex="9999",document.body.appendChild(r);const i=pP(document.body,r,()=>{ql(document.body,r,{placement:"bottom",middleware:[Mu(this.instances.length*15),Nu(),Tu()]}).then(({x:l,y:a})=>{Object.assign(r.style,{left:`${l}px`,top:`${a}px`})})});requestAnimationFrame(()=>{r.style.opacity="1",r.style.transform="translateY(0)"});const s={el:r,cleanup:i,type:t,duration:o};this.instances.push(s),this.repositionToasts(),o>0&&setTimeout(()=>this.hide(s),o)}hide(e){const{el:t}=e;t.style.opacity="0",t.style.transform="translateY(-10px)",setTimeout(()=>{e.cleanup(),t.remove(),this.instances=this.instances.filter(o=>o!==e),this.repositionToasts()},300)}repositionToasts(){this.instances.forEach((e,t)=>{const{el:o}=e;ql(document.body,o,{placement:"bottom",middleware:[Mu(t*55),Nu(),Tu()]}).then(({x:r,y:i})=>{Object.assign(o.style,{left:`${r}px`,top:`${i}px`})})})}};const mP=new hP;class gP{constructor(){Je(this,"instances",[])}error(e,t=3e3){this.show(e,"error",t)}info(e,t=3e3){this.show(e,"info",t)}success(e,t=3e3){this.show(e,"success",t)}warning(e,t=3e3){this.show(e,"warning",t)}show(e,t="info",o=3e3){const r=`
|
|
171
|
+
<div class="o-toast ${t}">
|
|
172
|
+
<i class="yiitip-icon icon-${t}"></i>
|
|
173
|
+
<span class="message">${e}</span>
|
|
32
174
|
</div>
|
|
33
|
-
`,l=At(document.body,{arrow:!1,allowHTML:!0,placement:"top",theme:"toast-theme",trigger:"manual",appendTo:()=>document.body,animation:"shift-away",duration:500,content:a,onHidden:i=>{i.destroy(),this.instances=this.instances.filter(s=>s!==i)}});l.show(),r>0&&setTimeout(()=>{l.hide()},r),this.instances.push(l),this.repositionToasts()}repositionToasts(){this.instances.forEach((n,o)=>{n.setProps({placement:"bottom",offset:[0,o*55]})})}}const xr=new ap,ip={class:"o-add-node-view"},lp={key:0,class:"view-main"},sp={class:"group o-tips"},cp={class:"panel"},up={class:"group o-tips"},dp={key:1,class:"item"},pp={key:1,class:"view-emoji"},fp=e.defineComponent({__name:"AddNodeView",props:G.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,{locale:a,tr:l}=Z(),{run:i}=oe(),s=e.ref("main"),c=e.ref(0);function d(m){const f=o.editor.chain();let v=null;switch(m.value){case"blockquote":v={content:ln};break;case"callout":v={content:ln,attrs:{icon:"💡"}};break;case"codeBlock":v={content:[],attrs:{language:"shell"}};break;case"emoji":v={type:"paragraph",content:[{type:"text",text:":"}]};break;case"heading":v={attrs:m.options};break;case"horizontalRule":v={};break;case"paragraph":v={content:[]};break;case"bulletList":case"orderedList":v={content:Ma};break;case"taskList":v={content:Ra};break;case"table":setTimeout(()=>{f.insertContentAt(p.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1);return;case"image":v={type:"paragraph",content:[{type:m.value,attrs:{src:"init"}}]};break;case"model-viewer":v={attrs:{src:"init"}};break}v&&(v.type=v.type||m.value,setTimeout(()=>{u.value?f.insertContent(v).focus().run():f.insertContentAt(p.value,v).focus().run()},1)),r("action",m)}const u=e.computed(()=>o.node.content.size===0),p=e.computed(()=>u.value?c.value:c.value+o.node.nodeSize);return e.onMounted(()=>{c.value=o.getPos()}),(m,f)=>(e.openBlock(),e.createElementBlock("section",ip,[s.value==="main"?(e.openBlock(),e.createElementBlock("section",lp,[e.createElementVNode("section",null,[e.createElementVNode("div",sp,e.toDisplayString(e.unref(l)("label.basic")),1),e.createElementVNode("section",cp,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(vn),(v,b)=>(e.openBlock(),e.createBlock(e.unref(me),{key:b,icon:v.icon,tooltip:e.unref(l)(v.label),quaternary:"",onClick:_=>d(v)},null,8,["icon","tooltip","onClick"]))),128))])]),e.createVNode(e.unref(We),{hoverable:"",clickable:""},{default:e.withCtx(()=>[e.unref(dn).length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(dn),(v,b)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:b},[v.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[b>0?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",up,e.toDisplayString(e.unref(l)(v.group)),1)],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(qe),{class:"item",clickable:"",onClick:_=>d(v)},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:v.icon,color:v.color},null,8,["name","color"])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(l)(v.label)),1)]),_:2},1032,["onClick"])],64))),128)):(e.openBlock(),e.createElementBlock("div",dp,"No result"))]),_:1})])):s.value==="emoji"?(e.openBlock(),e.createElementBlock("section",pp)):e.createCommentVNode("",!0)]))}}),mp=e.defineComponent({__name:"AddNode",props:G.nodeViewProps,setup(t){const n=t,o=e.ref(null),r=e.ref(!1);function a(i){r.value=i}function l(){var i;(i=o.value)==null||i.setShow(!1),r.value=!1}return(i,s)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:o,placement:"left",trigger:"mouseenter",arrow:"","onUpdate:show":a},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-add-node",{"is-selected":r.value}])},[e.createVNode(e.unref(ke),{type:"tertiary",class:"o-node-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:"add",small:""})]),_:1})],2)]),default:e.withCtx(()=>[e.createVNode(fp,e.mergeProps(n,{onAction:l}),null,16)]),_:1},512))}}),gp={class:"o-drag-node-view"},bp={key:0,class:"view-main"},vp={key:0},hp={class:"group o-tips"},_p={class:"panel"},kp=e.defineComponent({__name:"DragNodeView",props:G.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,{locale:a,tr:l}=Z(),{run:i,onCommand:s}=oe(),c=e.ref("main"),d=e.ref(["heading","codeBlock","paragraph"]),u=e.computed(()=>{var _,h;const b=(_=o.node)==null?void 0:_.content.content;if(b.length>0){const w=b[0];if(w.type.name==="image")return w.type.name}return(h=o.node)==null?void 0:h.type.name}),p=e.computed(()=>un.find(b=>b.value===u.value));function m(b){var _;return b.value===u.value&&((_=o.editor)==null?void 0:_.isActive(u.value,b.options))}function f(b){switch(b.value){default:v(b);break}r("action",b)}function v(b){var y,g,C,E,R;const _=o.getPos();if(b.value===u.value&&d.value.indexOf(u.value)<0){const D=(y=o.editor)==null?void 0:y.isActive(u.value),A=(g=o.editor)==null?void 0:g.commands.lift(u.value);console.log("lift",u.value,D,A);return}const h=(C=o.editor)==null?void 0:C.commands,w=(E=o.editor)==null?void 0:E.chain().focus(_+1);console.log("runCommand",b),s(h,w,b.value,b.options),(R=o.editor)==null||R.commands.setNodeSelection(_)}return e.computed(()=>[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:J.blue,tips:"Ctrl+D",group:"label.common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:J.deepOrange}]),(b,_)=>(e.openBlock(),e.createElementBlock("section",gp,[c.value==="main"?(e.openBlock(),e.createElementBlock("section",bp,[p.value?(e.openBlock(),e.createElementBlock("section",vp,[e.createElementVNode("div",hp,e.toDisplayString(e.unref(l)("label.turnInto")),1),e.createElementVNode("section",_p,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(un),(h,w)=>(e.openBlock(),e.createBlock(e.unref(me),{key:w,icon:h.icon,tooltip:e.unref(l)(h.label),"content-class":{"is-active":m(h)},quaternary:"",onClick:y=>f(h)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ut),e.mergeProps(o,{colorful:"","show-group":"",onAction:f}),null,16)])):e.createCommentVNode("",!0)]))}}),yp=e.defineComponent({__name:"DragNode",props:G.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,{run:a}=oe(),l=e.ref(null),i=e.ref(0),s=e.ref(!1),c=e.ref(["heading","codeBlock","paragraph"]),d=e.ref(!1),u=e.computed(()=>{var w,y;const h=(w=o.node)==null?void 0:w.content.content;if(h.length>0){const g=h[0];if(g.type.name==="image")return g.type.name}return(y=o.node)==null?void 0:y.type.name}),p=e.computed(()=>{var w;let h=u.value;return h==="heading"?{icon:`format_h${((w=o.node.attrs)==null?void 0:w.level)||1}`,color:J.blue}:(h==="table-wrapper"&&(h="table"),fo.find(y=>y.value===h)||{icon:"title"})});function m(h){var w;(w=l.value)==null||w.setShow(!1),r("action",h)}function f(h){s.value=h,console.log("show",h),h&&v()}function v(){var w;let h=o.getPos();c.value.includes(u.value)||(h+=1),(w=o.editor)==null||w.commands.setNodeSelection(h),i.value=h}function b(h){d.value=!0,setTimeout(()=>{d.value=!1},10)}function _(h){d.value=!1}return(h,w)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:l,placement:"left",size:"medium",trigger:"click",arrow:"","onUpdate:show":f},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-drag-node",{"is-selected":s.value,"is-dragging":d.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:b,onDragend:_},[e.createVNode(e.unref(ke),{type:"tertiary",class:"o-node-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:p.value.icon,color:p.value.color,small:""},null,8,["name","color"]),e.createVNode(e.unref($),{name:"drag_indicator",small:""})]),_:1})],34)]),default:e.withCtx(()=>[e.createVNode(kp,e.mergeProps(o,{onAction:m}),null,16)]),_:1},512))}}),wp=e.defineComponent({__name:"index",props:G.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,a=e.ref(!1),l=e.ref(0);e.ref(0);const i=e.computed(()=>s.value==="paragraph"&&o.node.content.size===0),s=e.computed(()=>{var m,f;const p=(m=o.node)==null?void 0:m.content.content;if(p.length>0){const v=p[0];if(v.type.name==="image")return v.type.name}return(f=o.node)==null?void 0:f.type.name}),c=e.computed(()=>{var p;return l.value||((p=o.node.attrs)==null?void 0:p.level)}),d=e.computed(()=>s.value==="heading"?`type-heading-${c.value}`:`type-${s.value}`);function u(p){r("action",p)}return e.onMounted(()=>{l.value=0}),(p,m)=>{var f;return(f=p.editor)!=null&&f.isEditable?(e.openBlock(),e.createElementBlock("section",{key:0,class:e.normalizeClass(["o-side-node",{"is-active":a.value,"is-empty":i.value}])},[e.createElementVNode("section",{class:e.normalizeClass(["action-container",d.value])},[e.createVNode(mp,e.normalizeProps(e.guardReactiveProps(o)),null,16),i.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(yp,e.mergeProps({key:0},o,{onAction:u}),null,16))],2)],2)):e.createCommentVNode("",!0)}}}),ot=e.defineComponent({__name:"ONodeView",props:G.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,a=e.inject("sideNode",{value:!1});return e.computed(()=>{const l={};return o.node.attrs["data-id"]&&(l["data-id"]=o.node.attrs["data-id"]),l}),(l,i)=>(e.openBlock(),e.createBlock(e.unref(G.NodeViewWrapper),{class:"o-node-view","data-id":l.node.attrs.id},{default:e.withCtx(()=>{var s;return[e.unref(a)&&((s=l.editor)!=null&&s.isEditable)?(e.openBlock(),e.createBlock(wp,e.mergeProps({key:0},o,{onAction:i[0]||(i[0]=c=>r("action"))}),null,16)):e.createCommentVNode("",!0),e.renderSlot(l.$slots,"default")]}),_:3},8,["data-id"]))}}),Ep={class:"o-add-node-view"},Cp={key:0,class:"view-main"},xp={class:"group o-tips"},Np={class:"panel"},Sp={class:"group o-tips"},Tp={key:1,class:"item"},Op=e.defineComponent({__name:"AddNodeView",props:G.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,{locale:a,tr:l}=Z(),{run:i}=oe(),s=e.ref("main");function c(p){const m=o.editor.chain();let f=null;switch(p.value){case"aiBlock":f={content:ln,attrs:{icon:"💡"}};break;case"blockquote":f={content:ln};break;case"callout":f={content:ln,attrs:{icon:"💡"}};break;case"codeBlock":f={content:[],attrs:{language:"shell"}};break;case"details":f=vs;break;case"diagram":f=Ia;break;case"emoji":f={type:"paragraph",content:[{type:"text",text:":"}]};break;case"heading":f={attrs:p.options};break;case"horizontalRule":f={};break;case"paragraph":f={content:[]};break;case"bulletList":case"orderedList":f={content:Ma};break;case"taskList":f={content:Ra};break;case"table":setTimeout(()=>{m.insertContentAt(u.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1),r("action",p);return;case"image":f={type:"paragraph",content:[{type:p.value,attrs:{src:"init"}}]};break;case"model-viewer":f={attrs:{src:"init"}};break}if(f){const v=u.value;f.type=f.type||p.value,setTimeout(()=>{d.value?m.insertContent(f).focus().run():m.insertContentAt(v,f).focus().run()},1)}r("action",p)}const d=e.computed(()=>{var p;return((p=o.node)==null?void 0:p.content.size)===0}),u=e.computed(()=>d.value?o.getPos():o.getPos()+o.node.nodeSize);return(p,m)=>(e.openBlock(),e.createElementBlock("section",Ep,[s.value==="main"?(e.openBlock(),e.createElementBlock("section",Cp,[e.createElementVNode("section",null,[e.createElementVNode("div",xp,e.toDisplayString(e.unref(l)("label.basic")),1),e.createElementVNode("section",Np,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(vn),(f,v)=>(e.openBlock(),e.createBlock(e.unref(me),{key:v,icon:f.icon,tooltip:e.unref(l)(f.label),quaternary:"",onClick:b=>c(f)},null,8,["icon","tooltip","onClick"]))),128))])]),e.createVNode(e.unref(Ue)),e.createVNode(e.unref(We),{hoverable:"",clickable:""},{default:e.withCtx(()=>[e.unref(dn).length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(e.unref(dn),(f,v)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:v},[f.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[v>0?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",Sp,e.toDisplayString(e.unref(l)(f.group)),1)],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(qe),{class:"item",clickable:"",onClick:b=>c(f)},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:f.icon,color:f.color},null,8,["name","color"])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(l)(f.label)),1)]),_:2},1032,["onClick"])],64))),128)):(e.openBlock(),e.createElementBlock("div",Tp,"No result"))]),_:1})])):e.createCommentVNode("",!0)]))}}),Ii=e.defineComponent({__name:"AddNode",props:{...G.nodeViewProps,add:{type:String,default:"menu"}},setup(t){const n=t,o=e.ref(),r=e.ref(!1),a=e.computed(()=>{var u;return((u=n.node)==null?void 0:u.content.size)===0}),l=e.computed(()=>a.value?n.getPos():n.getPos()+n.node.nodeSize);function i(u){r.value=u}function s(){var u;n.add==="menu"?(u=o.value)==null||u.setShow(!0):c()}function c(){const u={type:"paragraph",content:[{type:"text",text:"/"}]},p=n.editor.chain();setTimeout(()=>{a.value?p.insertContent(u).focus().run():p.insertContentAt(l.value,u).focus().run()},1)}function d(){var u;(u=o.value)==null||u.setShow(!1),r.value=!1}return(u,p)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:o,placement:"left","content-class":"dropdown",trigger:"manual",offset:[0,4],"onUpdate:show":i},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-add-btn",{"is-selected":r.value}])},[e.createVNode(e.unref(ke),{type:"tertiary",class:"o-node-btn",onClick:s},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:"add",small:""})]),_:1})],2)]),default:e.withCtx(()=>[e.createVNode(Op,e.mergeProps(n,{onAction:d}),null,16)]),_:1},512))}}),Ap={class:"o-drag-node-view"},Bp={key:0,class:"view-main"},Mp={key:0},Rp={class:"group o-tips"},Ip={class:"panel"},Dp=e.defineComponent({__name:"DragNodeView",props:G.nodeViewProps,emits:["action"],setup(t,{emit:n}){const o=t,r=n,{locale:a,tr:l}=Z(),{run:i,onCommand:s}=oe(),c=e.ref("main"),d=e.ref(["heading","codeBlock","paragraph"]),u=e.computed(()=>{var _,h;const b=(_=o.node)==null?void 0:_.content.content;if(b.length>0){const w=b[0];if(w.type.name==="image")return w.type.name}return(h=o.node)==null?void 0:h.type.name}),p=e.computed(()=>un.find(b=>b.value===u.value));function m(b){var _;return b.value===u.value&&((_=o.editor)==null?void 0:_.isActive(u.value,b.options))}function f(b){switch(b.value){case"copy":case"delete":case"duplicate":break;default:v(b);break}r("action",b)}function v(b){var y,g,C,E,R;const _=o.getPos();if(b.value===u.value&&d.value.indexOf(u.value)<0){const D=(y=o.editor)==null?void 0:y.isActive(u.value),A=(g=o.editor)==null?void 0:g.commands.lift(u.value);console.log("lift",u.value,D,A);return}const h=(C=o.editor)==null?void 0:C.commands,w=(E=o.editor)==null?void 0:E.chain().focus(_+1);console.log("runCommand",b),s(h,w,b.value,b.options),(R=o.editor)==null||R.commands.focus()}return(b,_)=>(e.openBlock(),e.createElementBlock("section",Ap,[c.value==="main"?(e.openBlock(),e.createElementBlock("section",Bp,[p.value?(e.openBlock(),e.createElementBlock("section",Mp,[e.createElementVNode("div",Rp,e.toDisplayString(e.unref(l)("label.turnInto")),1),e.createElementVNode("section",Ip,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(un),(h,w)=>(e.openBlock(),e.createBlock(e.unref(me),{key:w,icon:h.icon,tooltip:e.unref(l)(h.label),"content-class":{"is-active":m(h)},quaternary:"",onClick:y=>f(h)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):e.createCommentVNode("",!0),e.createVNode(e.unref(Ut),e.mergeProps(o,{colorful:"","show-group":"",onAction:f}),null,16)])):e.createCommentVNode("",!0)]))}}),Di=e.defineComponent({__name:"DragNode",props:G.nodeViewProps,emits:["dragstart","dragend"],setup(t,{emit:n}){const o=t,r=n,{run:a}=oe(),l=e.ref(null),i=e.ref(!1),s=e.ref(["heading","codeBlock","paragraph"]),c=e.computed(()=>{var _,h,w;const b=(h=(_=o.node)==null?void 0:_.content)==null?void 0:h.content;if((b==null?void 0:b.length)>0){const y=b[0];if(y.type.name==="image")return y.type.name}return(w=o.node)==null?void 0:w.type.name}),d=e.computed(()=>{var _;let b=c.value;return b==="heading"?{icon:`format_h${((_=o.node.attrs)==null?void 0:_.level)||1}`,color:J.blue}:(b==="table-wrapper"&&(b="table"),fo.find(h=>h.value===b)||{icon:"title"})});function u(b){r("dragstart",b)}function p(b){r("dragend",b)}function m(b){var _;(_=l.value)==null||_.setShow(!1)}function f(b){i.value=b,b&&v()}function v(){var _;let b=o.getPos();s.value.includes(c.value),(_=o.editor)==null||_.commands.setNodeSelection(b)}return e.watch(()=>o.getPos(),b=>{var _;(_=l.value)==null||_.setShow(!1)}),(b,_)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:l,placement:"left","content-class":"dropdown",trigger:"click",offset:[0,2],"onUpdate:show":f},{trigger:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["o-drag-btn",{selected:i.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:u,onDragend:p},[e.createVNode(e.unref(ke),{type:"tertiary",class:"o-node-btn"},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:d.value.icon,color:d.value.color,small:""},null,8,["name","color"]),e.createVNode(e.unref($),{name:"drag_indicator",small:""})]),_:1})],34)]),default:e.withCtx(()=>[e.createVNode(Dp,e.mergeProps(o,{onAction:m}),null,16)]),_:1},512))}}),Lp={key:0,class:"spinner"},Vp={key:2,class:"o-btn__label"},ke=e.defineComponent({__name:"OBtn",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["click"],setup(t,{emit:n}){const o=n;return(r,a)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass(["o-btn",t.type?`type-${t.type}`:""]),onClick:a[0]||(a[0]=l=>o("click",l))},[t.loading?(e.openBlock(),e.createElementBlock("div",Lp)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[t.icon?(e.openBlock(),e.createBlock(e.unref($),{key:0,name:t.icon,class:e.normalizeClass(t.iconClass)},null,8,["name","class"])):e.createCommentVNode("",!0)],64)),t.label?(e.openBlock(),e.createElementBlock("span",Vp,e.toDisplayString(t.label),1)):e.createCommentVNode("",!0),e.renderSlot(r.$slots,"default")],2))}}),$p={class:"o-btn-group"},Li=e.defineComponent({__name:"OBtnGroup",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""}},emits:["click"],setup(t,{emit:n}){return(o,r)=>(e.openBlock(),e.createElementBlock("div",$p,[e.renderSlot(o.$slots,"default")]))}}),Pp={class:"o-checkbox"},Fp={class:"o-checkbox__main"},Up={class:"o-checkbox__suffix"},Nr=e.defineComponent({__name:"OCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{type:String,default:""}},emits:["update:modelValue"],setup(t,{emit:n}){const o=t,r=n,a=e.computed({get(){return o.modelValue},set(l){r("update:modelValue",l)}});return(l,i)=>(e.openBlock(),e.createElementBlock("div",Pp,[e.createElementVNode("div",Fp,[e.withDirectives(e.createElementVNode("input",{"onUpdate:modelValue":i[0]||(i[0]=s=>a.value=s),type:"checkbox"},null,512),[[e.vModelCheckbox,a.value]])]),e.createElementVNode("div",Up,e.toDisplayString(t.label),1)]))}}),zp={class:"dialog-box"},Hp={class:"dialog-header"},qp={class:"dialog-body"},Gp={class:"dialog-footer"},Vi=e.defineComponent({name:"ODialog",__name:"ODialog",props:{show:{type:Boolean,default:!1},title:{type:String,default:""}},emits:["update:show"],setup(t,{emit:n}){const o=n,r=()=>{o("update:show",!1)};return(a,l)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.show?(e.openBlock(),e.createElementBlock("div",{key:0,class:"dialog-overlay o-dialog",onClick:e.withModifiers(r,["self"])},[e.createElementVNode("div",zp,[e.createElementVNode("div",Hp,[e.renderSlot(a.$slots,"title",{},()=>[e.createTextVNode(e.toDisplayString(t.title),1)]),e.createVNode(e.unref(ke),{icon:"close",class:"close",onClick:r})]),e.createElementVNode("div",qp,[e.renderSlot(a.$slots,"default")]),e.createElementVNode("div",Gp,[e.renderSlot(a.$slots,"footer")])])])):e.createCommentVNode("",!0)]))}}),Ue=e.defineComponent({__name:"ODivider",props:{vertical:{type:Boolean,default:!1}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["o-divider",{"o-divider-vertical":t.vertical}])},null,2))}}),Kp={key:0,class:"dialog-overlay o-image-viewer"},Wp={class:"dialog-box"},jp={class:"dialog-body"},Yp=["src"],Zp={class:"action-group"},Xp={class:"action-group"},Qp={class:"o-btn scale"},$i=e.defineComponent({name:"ODialog",__name:"OImageViewer",props:{show:{type:Boolean,default:!1},title:{type:String,default:""},images:{type:Array,default:()=>[]},current:{type:Number,default:0}},emits:["update:show"],setup(t,{emit:n}){const o=t,r=n,{downloadImage:a}=mo(),l=e.ref(0),i=e.ref(1),s=e.ref({x:0,y:0}),c=e.ref(!1),d=e.ref({x:0,y:0}),u=e.ref(null),p=e.ref(null),m={MIN_SCALE:.1,MAX_SCALE:10,STEP:.1,WHEEL_SENSITIVITY:.001},f=e.computed(()=>{const O=o.images.length;let M={};return O>0&&(M=l.value>=0&&l.value<O?o.images.at(l.value):o.images.at(0)),M}),v=e.computed(()=>({transform:`translate(${s.value.x}px, ${s.value.y}px) scale(${i.value})`,transformOrigin:"center center",cursor:c.value?"grabbing":i.value>1?"grab":"default"})),b=e.computed(()=>parseInt(`${i.value*100}`)),_=O=>{O.preventDefault();const M=-O.deltaY*m.WHEEL_SENSITIVITY;let L=i.value+M;if(L=Math.max(m.MIN_SCALE,Math.min(m.MAX_SCALE,L)),p.value&&u.value){const U=p.value.getBoundingClientRect(),S=O.clientX-U.left-U.width/2,H=O.clientY-U.top-U.height/2,T=L-i.value;s.value.x-=S*T,s.value.y-=H*T}i.value=L},h=O=>{i.value<=1||(O.preventDefault(),c.value=!0,d.value={x:O.clientX-s.value.x,y:O.clientY-s.value.y},document.addEventListener("mousemove",w),document.addEventListener("mouseup",y))},w=O=>{c.value&&(s.value.x=O.clientX-d.value.x,s.value.y=O.clientY-d.value.y)},y=()=>{c.value=!1,document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",y)},g=()=>{i.value=Math.min(m.MAX_SCALE,i.value+m.STEP)},C=()=>{i.value=Math.max(m.MIN_SCALE,i.value-m.STEP)},E=()=>{i.value=1,s.value={x:0,y:0}},R=()=>{l.value>0&&(l.value-=1,E())},D=()=>{l.value<o.images.length-1&&(l.value+=1,E())},A=()=>{E(),r("update:show",!1)},P=()=>{var O;a((O=f.value.attrs)==null?void 0:O.src)},j=O=>{if(o.show)switch(O.preventDefault(),O.stopPropagation(),O.key){case"+":case"=":O.preventDefault(),g();break;case"-":O.preventDefault(),C();break;case"0":O.preventDefault(),E();break;case"ArrowLeft":(O.ctrlKey||O.metaKey)&&(O.preventDefault(),R());break;case"ArrowRight":(O.ctrlKey||O.metaKey)&&(O.preventDefault(),D());break;case"Escape":A();break}};return e.watch(()=>o.current,O=>{l.value=O,E()}),e.onMounted(()=>{l.value=o.current,document.addEventListener("keydown",j)}),e.onBeforeUnmount(()=>{document.removeEventListener("keydown",j),document.removeEventListener("mousemove",w),document.removeEventListener("mouseup",y)}),(O,M)=>(e.openBlock(),e.createBlock(e.Teleport,{to:"body"},[t.show?(e.openBlock(),e.createElementBlock("div",Kp,[e.createElementVNode("header",null,[e.createVNode(e.unref(ke),{icon:"close",onClick:A})]),e.createElementVNode("div",Wp,[e.createElementVNode("div",jp,[e.createElementVNode("div",{class:"image-container",ref_key:"imageContainerRef",ref:p,onWheel:e.withModifiers(_,["prevent"]),onDblclick:E},[e.createElementVNode("img",{ref_key:"imageRef",ref:u,src:f.value.attrs.src,alt:"image",style:e.normalizeStyle(v.value),onMousedown:h},null,44,Yp)],544)])]),e.createElementVNode("footer",null,[e.createElementVNode("div",Zp,[e.createVNode(e.unref(ke),{icon:"arrow_back",class:e.normalizeClass({disabled:l.value<=0}),onClick:R},null,8,["class"]),e.createVNode(e.unref(ke),{icon:"arrow_back","icon-class":"rotate-180",class:e.normalizeClass({disabled:l.value>=o.images.length-1}),onClick:D},null,8,["class"])]),e.createElementVNode("div",Xp,[e.createVNode(e.unref(ke),{icon:"horizontal_rule",onClick:C}),e.createElementVNode("div",Qp,e.toDisplayString(b.value)+"%",1),e.createVNode(e.unref(ke),{icon:"add",onClick:g}),e.createVNode(e.unref(ke),{icon:"download",onClick:P}),e.createVNode(e.unref(ke),{icon:"close",onClick:A})])])])):e.createCommentVNode("",!0)]))}}),Jp={class:"o-input__prefix"},ef={class:"o-input__main"},tf=["placeholder"],nf={class:"o-input__suffix"},vt=e.defineComponent({__name:"OInput",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""}},emits:["blur","focus","update:modelValue"],setup(t,{expose:n,emit:o}){const r=t,a=o,l=e.ref(null),i=e.computed({get(){return r.modelValue},set(d){a("update:modelValue",d)}});function s(){var d;(d=l.value)==null||d.focus()}function c(){i.value="",s()}return n({clear:c,focus:s}),(d,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["o-input",`type-${t.type}`])},[e.createElementVNode("div",Jp,[e.renderSlot(d.$slots,"prefix")]),e.createElementVNode("div",ef,[e.withDirectives(e.createElementVNode("input",{ref_key:"input",ref:l,"onUpdate:modelValue":u[0]||(u[0]=p=>i.value=p),placeholder:t.placeholder,onFocus:u[1]||(u[1]=p=>a("focus")),onBlur:u[2]||(u[2]=p=>a("blur"))},null,40,tf),[[e.vModelText,i.value]])]),e.createElementVNode("div",nf,[e.renderSlot(d.$slots,"suffix"),t.clearable&&i.value?(e.openBlock(),e.createBlock($,{key:0,name:"close",class:"clear o-tips",onClick:c})):e.createCommentVNode("",!0)])],2))}}),We=e.defineComponent({__name:"OList",props:{clickable:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("ul",{class:e.normalizeClass(["o-list",{clickable:t.clickable,hoverable:t.hoverable}])},[e.renderSlot(n.$slots,"default")],2))}}),of={class:"o-list-item"},rf={class:"o-list-item__prefix"},af={class:"o-list-item__main"},lf={class:"o-list-item__suffix"},qe=e.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(t){return(n,o)=>(e.openBlock(),e.createElementBlock("li",of,[e.createElementVNode("div",rf,[e.renderSlot(n.$slots,"prefix")]),e.createElementVNode("div",af,[e.renderSlot(n.$slots,"default")]),e.createElementVNode("div",lf,[e.renderSlot(n.$slots,"suffix")])]))}}),fe=e.defineComponent({__name:"OPopover",props:{disable:{type:Boolean,default:!1},arrow:{type:Boolean,default:!1},offset:{type:Object,default:function(){return[0,10]}},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"mouseenter focus"},tippyClass:{type:String,default:"tippy"},contentClass:{type:String,default:""},event:{type:Object,default:function(){return{}}},delay:{type:Number,default:100},duration:{type:Number,default:200}},emits:["update:show"],setup(t,{expose:n,emit:o}){const r=t,a=o,{theme:l}=tn(),i=e.ref(null),s=e.ref(),c=e.ref();function d(f){var v,b,_,h;f?((b=c.value)==null||b.setProps({getReferenceClientRect:(v=r.event)!=null&&v.clientX?u:null}),(_=c.value)==null||_.show()):(h=c.value)==null||h.hide()}function u(){var f,v;return{width:0,height:0,left:r.event.clientX,right:r.event.clientX,top:r.event.clientY,bottom:r.event.clientY,x:((f=r.event)==null?void 0:f.clientX)||0,y:((v=r.event)==null?void 0:v.clientY)||0,toJSON:()=>{var b,_;return{width:100,height:100,left:((b=r.event)==null?void 0:b.clientX)||0,top:((_=r.event)==null?void 0:_.clientY)||0}}}}function p(){c.value=At(i.value,{appendTo:()=>document.body,animation:"shift-away",arrow:r.arrow,content:s.value,duration:r.duration,delay:r.delay,interactive:!0,offset:r.offset,placement:r.placement,trigger:r.trigger,theme:l.value,onShow:f=>{f.popper.classList.add(r.tippyClass||"tippy"),a("update:show",!0)},onHide:f=>{a("update:show",!1)}})}function m(){c.value.setProps({theme:l.value})}return e.watch(l,f=>{m()}),n({setShow:d}),e.onMounted(()=>{p()}),e.onUnmounted(()=>{c.value&&c.value.destroy()}),(f,v)=>(e.openBlock(),e.createElementBlock("div",{ref_key:"triggerRef",ref:i,"data-tippy-role":"popover",class:"o-popover"},[e.renderSlot(f.$slots,"trigger"),t.disable?e.createCommentVNode("",!0):(e.openBlock(),e.createElementBlock("div",{key:0,ref_key:"contentRef",ref:s,class:e.normalizeClass(["popover-content",t.contentClass])},[e.renderSlot(f.$slots,"default")],2))],512))}}),sf={class:"o-textarea__prefix"},cf={class:"o-textarea__main"},uf=["placeholder","rows"],df={class:"o-textarea__suffix"},Pi=e.defineComponent({__name:"OTextarea",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""},rows:{type:Number,default:3}},emits:["blur","focus","update:modelValue"],setup(t,{expose:n,emit:o}){const r=t,a=o,l=e.ref(null),i=e.computed({get(){return r.modelValue},set(d){a("update:modelValue",d)}});function s(){var d;(d=l.value)==null||d.focus()}function c(){i.value="",s()}return n({clear:c,focus:s}),(d,u)=>(e.openBlock(),e.createElementBlock("div",{class:e.normalizeClass(["o-textarea",`type-${t.type}`])},[e.createElementVNode("div",sf,[e.renderSlot(d.$slots,"prefix")]),e.createElementVNode("div",cf,[e.withDirectives(e.createElementVNode("textarea",{ref_key:"input",ref:l,"onUpdate:modelValue":u[0]||(u[0]=p=>i.value=p),placeholder:t.placeholder,rows:t.rows,onFocus:u[1]||(u[1]=p=>a("focus")),onBlur:u[2]||(u[2]=p=>a("blur"))},null,40,uf),[[e.vModelText,i.value]])]),e.createElementVNode("div",df,[e.renderSlot(d.$slots,"suffix"),t.clearable&&i.value?(e.openBlock(),e.createBlock($,{key:0,name:"close",class:"clear o-tips",onClick:c})):e.createCommentVNode("",!0)])],2))}}),pf=e.defineComponent({__name:"OSimpleCommandBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const n=t,{run:o}=oe(),{tr:r}=Z(),a=e.computed(()=>({aiViewer:{icon:"auto_awesome",tooltip:r("label.ai")},blockquote:{icon:"format_quote_open",tooltip:r("editor.blockquote")},bold:{icon:"format_bold",tooltip:r("editor.bold")},callout:{icon:"card_text",tooltip:r("editor.callout")},clearFormat:{icon:"format_clear",tooltip:r("editor.removeFormat")},code:{icon:"code",tooltip:r("editor.code")},codeBlock:{icon:"code_braces",tooltip:r("editor.codeBlock")},columns:{icon:"splitscreen_vertical_add",tooltip:"Column",rotate:!0},horizontalRule:{icon:"horizontal_rule",tooltip:r("editor.hr")},italic:{icon:"format_italic",tooltip:r("editor.italic")},image:{icon:"image",tooltip:r("editor.photo")},inlineMath:{icon:"function",tooltip:r("editor.inlineMath")},blockMath:{icon:"functions",tooltip:r("editor.blockMath")},inlineMathDelete:{icon:"close",tooltip:r("editor.delete")},linkUnset:{icon:"link_off",tooltip:r("link.off")},modelViewer:{icon:"3d_rotation",tooltip:r("label.modelViewer")},strike:{icon:"format_strikethrough",tooltip:r("editor.strikethrough")},underline:{icon:"format_underlined",tooltip:r("editor.underline")},video:{icon:"videocam",tooltip:r("editor.video")},aiBlock:{icon:"auto_awesome",tooltip:r("editor.aiBlock")},diagram:{icon:"mermaid",tooltip:r("diagram.name")}})),l=e.computed(()=>a.value[n.name]||{icon:"",isActive:!1,command:()=>{}});function i(){o(n.editor,n.name)}return(s,c)=>{var d;return e.openBlock(),e.createBlock(me,{class:"o-simple-command-btn",icon:l.value.icon,tooltip:l.value.tooltip,"content-class":{"is-active":(d=t.editor)==null?void 0:d.isActive(t.name),"rotate-90":l.value.rotate},onClick:i},null,8,["icon","tooltip","content-class"])}}}),ff=e.defineComponent({__name:"OAiBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(t){const{tr:n}=Z();return(o,r)=>(e.openBlock(),e.createBlock(mt,{"content-class":"o-ai-btn",icon:"auto_awesome",color:e.unref(J).purple,tooltip:e.unref(n)("ai.askAi")},null,8,["color","tooltip"]))}}),mf={class:"o-align-group"},gf=e.defineComponent({__name:"OAlignGroup",props:{editor:{type:Ae.Editor}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.computed(()=>[{label:o("editor.left"),value:"left",icon:"format_align_left"},{label:o("editor.center"),value:"center",icon:"format_align_center"},{label:o("editor.right"),value:"right",icon:"format_align_right"}]);function l(i){r(n.editor,"textAlign",{textAlign:i.value})}return(i,s)=>(e.openBlock(),e.createElementBlock("div",mf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(c,d)=>{var u;return e.openBlock(),e.createBlock(me,{key:d,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(u=t.editor)==null?void 0:u.isActive({textAlign:c.value})},onClick:p=>l(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),bf={class:"o-background-color-dropdown o-button-group"},vf=e.defineComponent({__name:"OBackgroundColorDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(null),l=e.ref("#ffec3d");function i(){s(l.value)}function s(c){a.value.setShow(!1),l.value=c,r(n.editor,"backgroundColor",{color:c})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ct),null,{trigger:e.withCtx(()=>[e.createElementVNode("div",bf,[e.createVNode(e.unref(ke),{icon:"background_color",class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${l.value}`)},null,4)]),_:1}),e.createVNode(e.unref(ke),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(o)("editor.highlightColor")),1)]),_:1})]),default:e.withCtx(()=>{var u;return[e.createVNode(e.unref(Xt),{"default-color":"","default-label":e.unref(o)("editor.noColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").backgroundColor,onSelect:s},null,8,["default-label","active-color"])]}),_:1},512))}}),hf={class:"o-highlight-dropdown o-button-group"},_f=e.defineComponent({__name:"OHighlightDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(null),l=e.ref("#ffec3d");function i(){s(l.value)}function s(c){a.value.setShow(!1),l.value=c,r(n.editor,"highlight",{color:c})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ct),null,{trigger:e.withCtx(()=>[e.createElementVNode("div",hf,[e.createVNode(e.unref(ke),{icon:"ink_highlighter",class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${l.value}`)},null,4)]),_:1}),e.createVNode(e.unref(ke),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(o)("editor.highlightColor")),1)]),_:1})]),default:e.withCtx(()=>{var u;return[e.createVNode(e.unref(Xt),{"default-color":"","default-label":e.unref(o)("editor.noColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("highlight").color,onSelect:s},null,8,["default-label","active-color"])]}),_:1},512))}}),kf=e.defineComponent({__name:"ODetailsBtn",props:{editor:{type:Object}},setup(t){const n=t,{run:o}=oe(),{tr:r}=Z();function a(){const{state:l}=n.editor,{selection:i}=l,{$from:s}=i,d=s.node().type.name;o(n.editor,"details",{type:d})}return(l,i)=>{var s;return e.openBlock(),e.createBlock(me,{class:"o-details-btn",icon:"toggle_list",tooltip:e.unref(r)("editor.toggleList"),"content-class":{"is-active":(s=t.editor)==null?void 0:s.isActive("details")},onClick:a},null,8,["tooltip","content-class"])}}}),yf=e.defineComponent({__name:"OEmojiBtn",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(null);function l(i){var s;(s=a.value)==null||s.setShow(!1),r(n.editor,"content",{content:i.emoji})}return(i,s)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn","tippy-class":"o-emoji-popover",placement:"bottom",trigger:"click",arrow:""},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"emoji_emotions","content-class":"o-emoji-btn",tooltip:e.unref(o)("editor.emoji")},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(go),{items:e.unref(Nn.emojiGroups),onSelect:l,"enable-search":""},null,8,["items"])]),_:1},512))}}),wf=e.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(null),l=e.computed(()=>[{label:o("editor.default"),value:"system-ui"},{label:"Arial",value:"Arial",separator:!0},{label:"Arial Black",value:"Arial Black"},{label:"Georgia",value:"Georgia"},{label:"Impact",value:"Impact"},{label:"Helvetica",value:"Helvetica"},{label:"Roboto",value:"Roboto"},{label:"Tahoma",value:"Tahoma"},{label:"Times New Roman",value:"Times New Roman"},{label:"Verdana",value:"Verdana"},{label:"Courier New",value:"Courier New",separator:!0},{label:"Monaco",value:"Monaco"},{label:"Monospace",value:"monospace"}]);function i(s){var c;(c=a.value)==null||c.setShow(!1),r(n.editor,"fontFamily",{fontFamily:s})}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"format_font","content-class":"o-font-family-dropdown dropdown",tooltip:e.unref(o)("editor.fontFamily")},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(We),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(d,u)=>{var p;return e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[d.separator?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(qe),{class:e.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive("textStyle",{fontFamily:d.value})}),onClick:m=>i(d.value)},{suffix:e.withCtx(()=>{var m;return[(m=t.editor)!=null&&m.isActive("textStyle",{fontFamily:d.value})?(e.openBlock(),e.createBlock(e.unref($),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createElementVNode("span",{style:e.normalizeStyle(`font-family: ${d.value}`)},e.toDisplayString(d.label),5)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),Ef={class:"o-fore-color-dropdown o-button-group"},Cf=e.defineComponent({__name:"OColorDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(null),l=e.ref("#ff4d4f");function i(){s(l.value)}function s(c){var d;(d=a.value)==null||d.setShow(!1),l.value=c,r(n.editor,"color",{color:c})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ct),null,{trigger:e.withCtx(()=>[e.createElementVNode("div",Ef,[e.createVNode(e.unref(ke),{icon:"format_color_text",class:"o-command-btn label",onClick:e.withModifiers(i,["stop"])},{default:e.withCtx(()=>[e.createElementVNode("div",{class:"indicator",style:e.normalizeStyle(`background: ${l.value}`)},null,4)]),_:1}),e.createVNode(e.unref(ke),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(e.unref(o)("editor.textColor")),1)]),_:1})]),default:e.withCtx(()=>{var u;return[e.createVNode(e.unref(Xt),{"default-color":"","default-label":e.unref(o)("editor.defaultColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:s},null,8,["default-label","active-color"])]}),_:1},512))}}),xf=e.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(null),l=e.computed(()=>[{label:o("editor.paragraph"),value:"paragraph",valueAlt:"",icon:"title"},{label:o("editor.heading1"),value:"heading",valueAlt:1,icon:"format_h1",separator:!0},{label:o("editor.heading2"),value:"heading",valueAlt:2,icon:"format_h2"},{label:o("editor.heading3"),value:"heading",valueAlt:3,icon:"format_h3"},{label:o("editor.heading4"),value:"heading",valueAlt:4,icon:"format_h4"},{label:o("editor.heading5"),value:"heading",valueAlt:5,icon:"format_h5"}]);function i(c){var d,u;return c.value==="heading"?(d=n.editor)==null?void 0:d.isActive(c.value,{level:c.valueAlt}):(u=n.editor)==null?void 0:u.isActive(c.value)}function s(c){var d;(d=a.value)==null||d.setShow(!1),r(n.editor,c.value,{level:c.valueAlt})}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"format_header_pound","content-class":"o-heading-dropdown dropdown",tooltip:e.unref(o)("editor.heading")},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(We),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(u,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[u.separator?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(qe),{class:e.normalizeClass({"is-active":i(u)}),onClick:m=>s(u)},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:u.icon},null,8,["name"])]),suffix:e.withCtx(()=>[i(u)?(e.openBlock(),e.createBlock(e.unref($),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),Nf=e.defineComponent({__name:"OInlineMathEditBtn",props:{editor:{type:Ae.Editor,required:!0}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(),l=e.ref(!1),i=e.ref(""),s=e.ref(null);function c(){if(n.editor.isActive("inlineMath")){const{state:m}=n.editor,{selection:f,schema:v}=m;if(f instanceof Ct.NodeSelection){const b=f.node;s.value=f.from,b.type.name==="inlineMath"&&(i.value=b.attrs.latex)}}}function d(){var m;(m=a.value)==null||m.setShow(!1)}function u(m){var f;console.log("confirm",m),m?r(n.editor,"inlineMathUpdate",{latex:m,pos:s.value}):r(n.editor,"inlineMathDelete",{pos:s.value}),(f=a.value)==null||f.setShow(!1)}function p(){window.open("https://katex.org/docs/supported.html","target")}return(m,f)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:l.value,"onUpdate:show":[f[0]||(f[0]=v=>l.value=v),c]},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"edit",tooltip:e.unref(o)("label.edit")},null,8,["tooltip"])]),default:e.withCtx(()=>[l.value?(e.openBlock(),e.createBlock(e.unref(bo),{key:0,title:e.unref(o)("label.edit"),val:i.value,icon:"function",onCancel:d,onConfirm:u},{"header-right":e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"help",tooltip:e.unref(o)("label.help"),onClick:p},null,8,["tooltip"])]),_:1},8,["title","val"])):e.createCommentVNode("",!0)]),_:1},8,["show"]))}}),Sf={class:"o-list-dropdown o-button-group"},Tf=e.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(null),l=e.ref();function i(){r(n.editor,l.value.value)}function s(d){a.value.setShow(!1),l.value=d,r(n.editor,d.value)}const c=e.computed(()=>[{label:o("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:o("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:o("editor.todoList"),value:"taskList",icon:"check_box"}]);return e.onMounted(()=>{l.value=c.value[0]}),(d,u)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(ct),null,{trigger:e.withCtx(()=>{var p;return[e.createElementVNode("div",Sf,[e.createVNode(e.unref(ke),{icon:(p=l.value)==null?void 0:p.icon,class:"o-command-btn",onClick:e.withModifiers(i,["stop"])},null,8,["icon"]),e.createVNode(e.unref(ke),{icon:"arrow_drop_down",class:"o-command-btn"})])]}),default:e.withCtx(()=>{var p;return[e.createTextVNode(" "+e.toDisplayString((p=l.value)==null?void 0:p.label),1)]}),_:1})]),default:e.withCtx(()=>[e.createVNode(e.unref(We),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(p,m)=>{var f;return e.openBlock(),e.createBlock(e.unref(qe),{key:m,class:e.normalizeClass({"is-active":(f=t.editor)==null?void 0:f.isActive(p.value)}),onClick:v=>s(p)},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:p.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var v;return[(v=t.editor)!=null&&v.isActive(p.value)?(e.openBlock(),e.createBlock(e.unref($),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(p.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),Of={class:"o-list-group"},Af=e.defineComponent({__name:"OListGroup",props:{editor:{type:Ae.Editor,required:!0}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.computed(()=>[{label:o("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:o("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:o("editor.todoList"),value:"taskList",icon:"check_box"}]);function l(i){r(n.editor,i.value)}return(i,s)=>(e.openBlock(),e.createElementBlock("div",Of,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(a.value,(c,d)=>{var u;return e.openBlock(),e.createBlock(me,{key:d,icon:c.icon,tooltip:c.label,"content-class":{"is-active":(u=t.editor)==null?void 0:u.isActive(c.value)},onClick:p=>l(c)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),Bf=e.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:Ae.Editor,required:!0}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(),l=e.ref(!1),i=e.ref(""),s=e.ref(!0);function c(){var m;i.value="",s.value=!0;const p=(m=n.editor)==null?void 0:m.getAttributes("link");p!=null&&p.href&&(i.value=p.href,s.value=p.target==="_blank")}function d(){var p;(p=a.value)==null||p.setShow(!1)}function u(p){var m;p?r(n.editor,"linkSet",{href:p,target:s.value?"_blank":""}):r(n.editor,"linkUnset"),(m=a.value)==null||m.setShow(!1)}return(p,m)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:l.value,"onUpdate:show":[m[1]||(m[1]=f=>l.value=f),c]},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"edit",tooltip:e.unref(o)("link.edit")},null,8,["tooltip"])]),default:e.withCtx(()=>[l.value?(e.openBlock(),e.createBlock(e.unref(bo),{key:0,title:e.unref(o)("link.edit"),val:i.value,icon:"link",onCancel:d,onConfirm:u},{"header-right":e.withCtx(()=>[e.createVNode(e.unref(Nr),{modelValue:s.value,"onUpdate:modelValue":m[0]||(m[0]=f=>s.value=f),label:e.unref(o)("link.open_in_new_tab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):e.createCommentVNode("",!0)]),_:1},8,["show"]))}}),Mf=e.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Z();function r(){var l;const a=(l=n.editor)==null?void 0:l.getAttributes("link");a!=null&&a.href&&window.open(a.href,"target")}return(a,l)=>(e.openBlock(),e.createBlock(me,{icon:"open_in_new",tooltip:e.unref(o)("link.open"),"content-class":"o-link-open-btn",onClick:r},null,8,["tooltip"]))}}),Rf={class:"o-command-btn"},If={class:"o-more-bubble"},Df=e.defineComponent({__name:"OMoreBubble",props:{editor:{type:Ae.Editor,required:!0}},setup(t){const n=e.ref();return(o,r)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:n,offset:[4,10],class:"o-simple-command-btn","content-class":"o-more-bubble-popover",placement:"top-end",size:"medium",trigger:"mouseenter"},{trigger:e.withCtx(()=>[e.createElementVNode("div",Rf,[e.createVNode(e.unref($),{name:"more_horiz"})])]),default:e.withCtx(()=>[e.createElementVNode("section",If,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(e.unref(ja),(a,l)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:l},[a==="separator"?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0,vertical:""})):typeof a=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Co)(a)),{key:1,name:a,editor:t.editor},null,8,["name","editor"])):e.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),Lf=e.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(null),l=e.computed(()=>[{label:o("editor.paragraph"),value:"paragraph",icon:"title"},{label:o("editor.heading1"),value:"heading",icon:"format_h1",options:{level:1}},{label:o("editor.heading2"),value:"heading",icon:"format_h2",options:{level:2}},{label:o("editor.heading3"),value:"heading",icon:"format_h3",options:{level:3}},{label:o("editor.todoList"),value:"taskList",icon:"check_box"},{label:o("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:o("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:o("editor.blockquote"),value:"blockquote",icon:"format_quote_open"},{label:o("editor.removeFormat"),value:"clearFormat",icon:"format_clear",separator:!0}]);function i(c){var d;return(d=n.editor)==null?void 0:d.isActive(c.value,c.options)}function s(c){a.value.setShow(!1),r(n.editor,c.value,c.options)}return(c,d)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click"},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"format_paint","content-class":"o-style-dropdown o-command-btn dropdown",tooltip:e.unref(o)("label.styles")},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(We),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(u,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[u.separator?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(qe),{class:e.normalizeClass({"is-active":i(u)}),onClick:m=>s(u)},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:u.icon},null,8,["name"])]),suffix:e.withCtx(()=>[i(u)?(e.openBlock(),e.createBlock(e.unref($),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),Vf=e.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(null);function l(i){var s;(s=a.value)==null||s.setShow(!1),r(n.editor,"tableInsert",i)}return(i,s)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:""},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"window","content-class":"o-table-btn",tooltip:e.unref(o)("table.insert")},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(ki),{onSelect:l})]),_:1},512))}}),$f={class:"o-table-group"},Pf=e.defineComponent({__name:"OTableGroup",props:{editor:{type:Ae.Editor,required:!0}},setup(t){const{tr:n}=Z(),{run:o}=oe();return(r,a)=>{var l,i;return e.openBlock(),e.createElementBlock("section",$f,[(l=t.editor)!=null&&l.can().mergeCells()?(e.openBlock(),e.createBlock(e.unref(me),{key:0,icon:"cell_merge",tooltip:e.unref(n)("table.merge"),onClick:a[0]||(a[0]=s=>e.unref(o)(t.editor,"tableMergeCells"))},null,8,["tooltip"])):e.createCommentVNode("",!0),(i=t.editor)!=null&&i.can().splitCell()?(e.openBlock(),e.createBlock(e.unref(me),{key:1,icon:"splitscreen_left",tooltip:e.unref(n)("table.split"),onClick:a[1]||(a[1]=s=>e.unref(o)(t.editor,"tableSplitCell"))},null,8,["tooltip"])):e.createCommentVNode("",!0),e.createVNode(e.unref(yi),{editor:t.editor},null,8,["editor"])])}}}),Ff=e.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:Ae.Editor}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(null),l=e.ref(""),i=e.ref("");function s(c){c.name==="color"?(l.value=c.value,localStorage.setItem("yiitap.text-color.fore",c.value)):c.name==="backColor"&&(i.value=c.value,localStorage.setItem("yiitap.text-color.back",c.value)),a.value.setShow(!1),r(n.editor,c.name,{color:c.value})}return e.onMounted(()=>{l.value=localStorage.getItem("yiitap.text-color.fore")||"",i.value=localStorage.getItem("yiitap.text-color.back")||""}),(c,d)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"format_text","content-class":"o-text-color-dropdown dropdown",tooltip:e.unref(o)("editor.textColor")},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>{var u;return[e.createVNode(e.unref(yr),{"fore-color":l.value,"back-color":i.value,"default-label":e.unref(o)("editor.defaultColor"),"active-color":(u=t.editor)==null?void 0:u.getAttributes("textStyle").color,onSelect:s},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),Uf=e.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:Ae.Editor}},setup(t){const n=t,{tr:o}=Z(),{run:r}=oe(),a=e.ref(),l=e.computed(()=>[{label:o("editor.strikethrough"),value:"strike",icon:"format_strikethrough"},{label:o("editor.underline"),value:"underline",icon:"format_underlined"},{label:o("editor.code"),value:"code",icon:"code",separator:!0},{label:o("editor.code"),value:"subscript",icon:"subscript",separator:!0},{label:o("editor.code"),value:"superscript",icon:"superscript"}]);function i(s){var c;(c=a.value)==null||c.setShow(!1),r(n.editor,s)}return(s,c)=>(e.openBlock(),e.createBlock(e.unref(fe),{ref_key:"popover",ref:a,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"title","content-class":"o-text-format-dropdown dropdown",tooltip:e.unref(o)("editor.textFormat")},{default:e.withCtx(()=>[e.createVNode(e.unref($),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:e.withCtx(()=>[e.createVNode(e.unref(We),{hoverable:"",clickable:""},{default:e.withCtx(()=>[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(l.value,(d,u)=>{var p;return e.openBlock(),e.createElementBlock(e.Fragment,{key:u},[d.separator?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0})):e.createCommentVNode("",!0),e.createVNode(e.unref(qe),{class:e.normalizeClass({"is-active":(p=t.editor)==null?void 0:p.isActive(d.value)}),onClick:m=>i(d.value)},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:d.icon},null,8,["name"])]),suffix:e.withCtx(()=>{var m;return[(m=t.editor)!=null&&m.isActive(d.value)?(e.openBlock(),e.createBlock(e.unref($),{key:0,name:"done",small:""})):e.createCommentVNode("",!0)]}),default:e.withCtx(()=>[e.createTextVNode(e.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),zf={ai:ff,"align-dropdown":ar,"align-group":gf,"background-color":vf,color:Cf,details:kf,"font-family":wf,heading:xf,highlight:_f,"inline-math-edit":Nf,"list-dropdown":Tf,"list-group":Af,link:ir,"link-edit":Bf,"link-open":Mf,emoji:yf,more:Df,"style-dropdown":Lf,table:Vf,"table-group":Pf,"text-color-dropdown":Ff,"text-format-dropdown":Uf},Co=t=>zf[t]||pf,Hf={key:0,class:"o-main-menu"},qf={class:"left"},Gf={class:"right"},Fi=e.defineComponent({__name:"OMainMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}}},setup(t){const n=t,o=e.computed(()=>{var a;let r=n.menu;return(a=n.editor)!=null&&a.isActive("table")&&(r=za),r.length>0?r:Ua});return(r,a)=>t.editor?(e.openBlock(),e.createElementBlock("section",Hf,[e.createElementVNode("section",qf,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.value,(l,i)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:i},[l==="separator"?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0,vertical:""})):typeof l=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Co)(l)),{key:1,name:l,editor:t.editor},null,8,["name","editor"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(l),{key:2,editor:t.editor},null,8,["editor"]))],64))),128)),e.renderSlot(r.$slots,"left")]),e.createElementVNode("section",Gf,[e.renderSlot(r.$slots,"right")])])):e.createCommentVNode("",!0)}}),Ui=[`
|
|
175
|
+
`,i=No(document.body,{arrow:!1,allowHTML:!0,placement:"top",theme:"toast-theme",trigger:"manual",appendTo:()=>document.body,animation:"shift-away",duration:500,content:r,onHidden:s=>{s.destroy(),this.instances=this.instances.filter(l=>l!==s)}});i.show(),o>0&&setTimeout(()=>{i.hide()},o),this.instances.push(i),this.repositionToasts()}repositionToasts(){this.instances.forEach((e,t)=>{e.setProps({placement:"bottom",offset:[0,t*55]})})}}const ug=new gP,yP={class:"o-add-node-view"},bP={key:0,class:"view-main"},vP={class:"group o-tips"},kP={class:"panel"},wP={class:"group o-tips"},xP={key:1,class:"item"},CP={key:1,class:"view-emoji"},SP=c.defineComponent({__name:"AddNodeView",props:Ye,emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=de(),{run:s}=ke(),l=c.ref("main"),a=c.ref(0);function u(p){const h=t.editor.chain();let m=null;switch(p.value){case"blockquote":m={content:is};break;case"callout":m={content:is,attrs:{icon:"💡"}};break;case"codeBlock":m={content:[],attrs:{language:"shell"}};break;case"emoji":m={type:"paragraph",content:[{type:"text",text:":"}]};break;case"heading":m={attrs:p.options};break;case"horizontalRule":m={};break;case"paragraph":m={content:[]};break;case"bulletList":case"orderedList":m={content:F1};break;case"taskList":m={content:H1};break;case"table":setTimeout(()=>{h.insertContentAt(f.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1);return;case"image":m={type:"paragraph",content:[{type:p.value,attrs:{src:"init"}}]};break;case"model-viewer":m={attrs:{src:"init"}};break}m&&(m.type=m.type||p.value,setTimeout(()=>{d.value?h.insertContent(m).focus().run():h.insertContentAt(f.value,m).focus().run()},1)),o("action",p)}const d=c.computed(()=>t.node.content.size===0),f=c.computed(()=>d.value?a.value:a.value+t.node.nodeSize);return c.onMounted(()=>{a.value=t.getPos()}),(p,h)=>(c.openBlock(),c.createElementBlock("section",yP,[l.value==="main"?(c.openBlock(),c.createElementBlock("section",bP,[c.createElementVNode("section",null,[c.createElementVNode("div",vP,c.toDisplayString(c.unref(i)("label.basic")),1),c.createElementVNode("section",kP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(_s),(m,g)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:g,icon:m.icon,tooltip:c.unref(i)(m.label),quaternary:"",onClick:y=>u(m)},null,8,["icon","tooltip","onClick"]))),128))])]),c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[c.unref(ws).length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(ws),(m,g)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:g},[m.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[g>0?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",wP,c.toDisplayString(c.unref(i)(m.group)),1)],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:"item",clickable:"",onClick:y=>u(m)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:m.icon,color:m.color},null,8,["name","color"])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(i)(m.label)),1)]),_:2},1032,["onClick"])],64))),128)):(c.openBlock(),c.createElementBlock("div",xP,"No result"))]),_:1})])):l.value==="emoji"?(c.openBlock(),c.createElementBlock("section",CP)):c.createCommentVNode("",!0)]))}}),EP=c.defineComponent({__name:"AddNode",props:Ye,setup(n){const e=n,t=c.ref(null),o=c.ref(!1);function r(s){o.value=s}function i(){var s;(s=t.value)==null||s.setShow(!1),o.value=!1}return(s,l)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:t,placement:"left",trigger:"mouseenter",arrow:"","onUpdate:show":r},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["o-add-node",{"is-selected":o.value}])},[c.createVNode(c.unref(He),{type:"tertiary",class:"o-node-btn"},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"add",small:""})]),_:1})],2)]),default:c.withCtx(()=>[c.createVNode(SP,c.mergeProps(e,{onAction:i}),null,16)]),_:1},512))}}),MP={class:"o-drag-node-view"},TP={key:0,class:"view-main"},NP={key:0},AP={class:"group o-tips"},OP={class:"panel"},$P=c.defineComponent({__name:"DragNodeView",props:Ye,emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=de(),{run:s,onCommand:l}=ke(),a=c.ref("main"),u=c.ref(["heading","codeBlock","paragraph"]),d=c.computed(()=>{var y,b;const g=(y=t.node)==null?void 0:y.content.content;if(g.length>0){const v=g[0];if(v.type.name==="image")return v.type.name}return(b=t.node)==null?void 0:b.type.name}),f=c.computed(()=>ks.find(g=>g.value===d.value));function p(g){var y;return g.value===d.value&&((y=t.editor)==null?void 0:y.isActive(d.value,g.options))}function h(g){switch(g.value){default:m(g);break}o("action",g)}function m(g){var w,k,x,C,S;const y=t.getPos();if(g.value===d.value&&u.value.indexOf(d.value)<0){const M=(w=t.editor)==null?void 0:w.isActive(d.value),N=(k=t.editor)==null?void 0:k.commands.lift(d.value);console.log("lift",d.value,M,N);return}const b=(x=t.editor)==null?void 0:x.commands,v=(C=t.editor)==null?void 0:C.chain().focus(y+1);console.log("runCommand",g),l(b,v,g.value,g.options),(S=t.editor)==null||S.commands.setNodeSelection(y)}return c.computed(()=>[{label:"editor.duplicate",value:"duplicate",icon:"content_copy",color:pe.blue,tips:"Ctrl+D",group:"label.common"},{label:"editor.delete",value:"delete",icon:"delete",tips:"Ctrl+D",color:pe.deepOrange}]),(g,y)=>(c.openBlock(),c.createElementBlock("section",MP,[a.value==="main"?(c.openBlock(),c.createElementBlock("section",TP,[f.value?(c.openBlock(),c.createElementBlock("section",NP,[c.createElementVNode("div",AP,c.toDisplayString(c.unref(i)("label.turnInto")),1),c.createElementVNode("section",OP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(ks),(b,v)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:v,icon:b.icon,tooltip:c.unref(i)(b.label),"content-class":{"is-active":p(b)},quaternary:"",onClick:w=>h(b)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):c.createCommentVNode("",!0),c.createVNode(c.unref(Fr),c.mergeProps(t,{colorful:"","show-group":"",onAction:h}),null,16)])):c.createCommentVNode("",!0)]))}}),BP=c.defineComponent({__name:"DragNode",props:Ye,emits:["action"],setup(n,{emit:e}){const t=n,o=e,{run:r}=ke(),i=c.ref(null),s=c.ref(0),l=c.ref(!1),a=c.ref(["heading","codeBlock","paragraph"]),u=c.ref(!1),d=c.computed(()=>{var v,w;const b=(v=t.node)==null?void 0:v.content.content;if(b.length>0){const k=b[0];if(k.type.name==="image")return k.type.name}return(w=t.node)==null?void 0:w.type.name}),f=c.computed(()=>{var v;let b=d.value;return b==="heading"?{icon:`format_h${((v=t.node.attrs)==null?void 0:v.level)||1}`,color:pe.blue}:(b==="table-wrapper"&&(b="table"),kd.find(w=>w.value===b)||{icon:"title"})});function p(b){var v;(v=i.value)==null||v.setShow(!1),o("action",b)}function h(b){l.value=b,console.log("show",b),b&&m()}function m(){var v;let b=t.getPos();a.value.includes(d.value)||(b+=1),(v=t.editor)==null||v.commands.setNodeSelection(b),s.value=b}function g(b){u.value=!0,setTimeout(()=>{u.value=!1},10)}function y(b){u.value=!1}return(b,v)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:i,placement:"left",size:"medium",trigger:"click",arrow:"","onUpdate:show":h},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["o-drag-node",{"is-selected":l.value,"is-dragging":u.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:g,onDragend:y},[c.createVNode(c.unref(He),{type:"tertiary",class:"o-node-btn"},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:f.value.icon,color:f.value.color,small:""},null,8,["name","color"]),c.createVNode(c.unref(X),{name:"drag_indicator",small:""})]),_:1})],34)]),default:c.withCtx(()=>[c.createVNode($P,c.mergeProps(t,{onAction:p}),null,16)]),_:1},512))}}),RP=c.defineComponent({__name:"index",props:Ye,emits:["action"],setup(n,{emit:e}){const t=n,o=e,r=c.ref(!1),i=c.ref(0);c.ref(0);const s=c.computed(()=>l.value==="paragraph"&&t.node.content.size===0),l=c.computed(()=>{var p,h;const f=(p=t.node)==null?void 0:p.content.content;if(f.length>0){const m=f[0];if(m.type.name==="image")return m.type.name}return(h=t.node)==null?void 0:h.type.name}),a=c.computed(()=>{var f;return i.value||((f=t.node.attrs)==null?void 0:f.level)}),u=c.computed(()=>l.value==="heading"?`type-heading-${a.value}`:`type-${l.value}`);function d(f){o("action",f)}return c.onMounted(()=>{i.value=0}),(f,p)=>{var h;return(h=f.editor)!=null&&h.isEditable?(c.openBlock(),c.createElementBlock("section",{key:0,class:c.normalizeClass(["o-side-node",{"is-active":r.value,"is-empty":s.value}])},[c.createElementVNode("section",{class:c.normalizeClass(["action-container",u.value])},[c.createVNode(EP,c.normalizeProps(c.guardReactiveProps(t)),null,16),s.value?c.createCommentVNode("",!0):(c.openBlock(),c.createBlock(BP,c.mergeProps({key:0},t,{onAction:d}),null,16))],2)],2)):c.createCommentVNode("",!0)}}}),Mn=c.defineComponent({__name:"ONodeView",props:Ye,emits:["action"],setup(n,{emit:e}){const t=n,o=e,r=c.inject("sideNode",{value:!1});return c.computed(()=>{const i={};return t.node.attrs["data-id"]&&(i["data-id"]=t.node.attrs["data-id"]),i}),(i,s)=>(c.openBlock(),c.createBlock(c.unref(Tm),{class:"o-node-view","data-id":i.node.attrs.id},{default:c.withCtx(()=>{var l;return[c.unref(r)&&((l=i.editor)!=null&&l.isEditable)?(c.openBlock(),c.createBlock(RP,c.mergeProps({key:0},t,{onAction:s[0]||(s[0]=a=>o("action"))}),null,16)):c.createCommentVNode("",!0),c.renderSlot(i.$slots,"default")]}),_:3},8,["data-id"]))}}),_P={class:"o-add-node-view"},DP={key:0,class:"view-main"},IP={class:"group o-tips"},LP={class:"panel"},PP={class:"group o-tips"},VP={key:1,class:"item"},zP=c.defineComponent({__name:"AddNodeView",props:Ye,emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=de(),{run:s}=ke(),l=c.ref("main");function a(f){const p=t.editor.chain();let h=null;switch(f.value){case"aiBlock":h={content:is,attrs:{icon:"💡"}};break;case"blockquote":h={content:is};break;case"callout":h={content:is,attrs:{icon:"💡"}};break;case"codeBlock":h={content:[],attrs:{language:"shell"}};break;case"details":h=lI;break;case"diagram":h=j1;break;case"emoji":h={type:"paragraph",content:[{type:"text",text:":"}]};break;case"heading":h={attrs:f.options};break;case"horizontalRule":h={};break;case"paragraph":h={content:[]};break;case"bulletList":case"orderedList":h={content:F1};break;case"taskList":h={content:H1};break;case"table":setTimeout(()=>{p.insertContentAt(d.value,{type:"paragraph",content:[]}).insertTable({rows:3,cols:3,withHeaderRow:!0}).focus().run()},1),o("action",f);return;case"image":h={type:"paragraph",content:[{type:f.value,attrs:{src:"init"}}]};break;case"model-viewer":h={attrs:{src:"init"}};break}if(h){const m=d.value;h.type=h.type||f.value,setTimeout(()=>{u.value?p.insertContent(h).focus().run():p.insertContentAt(m,h).focus().run()},1)}o("action",f)}const u=c.computed(()=>{var f;return((f=t.node)==null?void 0:f.content.size)===0}),d=c.computed(()=>u.value?t.getPos():t.getPos()+t.node.nodeSize);return(f,p)=>(c.openBlock(),c.createElementBlock("section",_P,[l.value==="main"?(c.openBlock(),c.createElementBlock("section",DP,[c.createElementVNode("section",null,[c.createElementVNode("div",IP,c.toDisplayString(c.unref(i)("label.basic")),1),c.createElementVNode("section",LP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(_s),(h,m)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:m,icon:h.icon,tooltip:c.unref(i)(h.label),quaternary:"",onClick:g=>a(h)},null,8,["icon","tooltip","onClick"]))),128))])]),c.createVNode(c.unref(Lt)),c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[c.unref(ws).length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(ws),(h,m)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:m},[h.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[m>0?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",PP,c.toDisplayString(c.unref(i)(h.group)),1)],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:"item",clickable:"",onClick:g=>a(h)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:h.icon,color:h.color},null,8,["name","color"])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(i)(h.label)),1)]),_:2},1032,["onClick"])],64))),128)):(c.openBlock(),c.createElementBlock("div",VP,"No result"))]),_:1})])):c.createCommentVNode("",!0)]))}}),fC=c.defineComponent({__name:"AddNode",props:{...Ye,add:{type:String,default:"menu"}},setup(n){const e=n,t=c.ref(),o=c.ref(!1),r=c.computed(()=>{var d;return((d=e.node)==null?void 0:d.content.size)===0}),i=c.computed(()=>r.value?e.getPos():e.getPos()+e.node.nodeSize);function s(d){o.value=d}function l(){var d;e.add==="menu"?(d=t.value)==null||d.setShow(!0):a()}function a(){const d={type:"paragraph",content:[{type:"text",text:"/"}]},f=e.editor.chain();setTimeout(()=>{r.value?f.insertContent(d).focus().run():f.insertContentAt(i.value,d).focus().run()},1)}function u(){var d;(d=t.value)==null||d.setShow(!1),o.value=!1}return(d,f)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:t,placement:"left","content-class":"dropdown",trigger:"manual",offset:[0,4],"onUpdate:show":s},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["o-add-btn",{"is-selected":o.value}])},[c.createVNode(c.unref(He),{type:"tertiary",class:"o-node-btn",onClick:l},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"add",small:""})]),_:1})],2)]),default:c.withCtx(()=>[c.createVNode(zP,c.mergeProps(e,{onAction:u}),null,16)]),_:1},512))}}),FP={class:"o-drag-node-view"},HP={key:0,class:"view-main"},jP={key:0},UP={class:"group o-tips"},WP={class:"panel"},qP=c.defineComponent({__name:"DragNodeView",props:Ye,emits:["action"],setup(n,{emit:e}){const t=n,o=e,{locale:r,tr:i}=de(),{run:s,onCommand:l}=ke(),a=c.ref("main"),u=c.ref(["heading","codeBlock","paragraph"]),d=c.computed(()=>{var y,b;const g=(y=t.node)==null?void 0:y.content.content;if(g.length>0){const v=g[0];if(v.type.name==="image")return v.type.name}return(b=t.node)==null?void 0:b.type.name}),f=c.computed(()=>ks.find(g=>g.value===d.value));function p(g){var y;return g.value===d.value&&((y=t.editor)==null?void 0:y.isActive(d.value,g.options))}function h(g){switch(g.value){case"copy":case"delete":case"duplicate":break;default:m(g);break}o("action",g)}function m(g){var w,k,x,C,S;const y=t.getPos();if(g.value===d.value&&u.value.indexOf(d.value)<0){const M=(w=t.editor)==null?void 0:w.isActive(d.value),N=(k=t.editor)==null?void 0:k.commands.lift(d.value);console.log("lift",d.value,M,N);return}const b=(x=t.editor)==null?void 0:x.commands,v=(C=t.editor)==null?void 0:C.chain().focus(y+1);console.log("runCommand",g),l(b,v,g.value,g.options),(S=t.editor)==null||S.commands.focus()}return(g,y)=>(c.openBlock(),c.createElementBlock("section",FP,[a.value==="main"?(c.openBlock(),c.createElementBlock("section",HP,[f.value?(c.openBlock(),c.createElementBlock("section",jP,[c.createElementVNode("div",UP,c.toDisplayString(c.unref(i)("label.turnInto")),1),c.createElementVNode("section",WP,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(ks),(b,v)=>(c.openBlock(),c.createBlock(c.unref(Ae),{key:v,icon:b.icon,tooltip:c.unref(i)(b.label),"content-class":{"is-active":p(b)},quaternary:"",onClick:w=>h(b)},null,8,["icon","tooltip","content-class","onClick"]))),128))])])):c.createCommentVNode("",!0),c.createVNode(c.unref(Fr),c.mergeProps(t,{colorful:"","show-group":"",onAction:h}),null,16)])):c.createCommentVNode("",!0)]))}}),pC=c.defineComponent({__name:"DragNode",props:Ye,emits:["dragstart","dragend"],setup(n,{emit:e}){const t=n,o=e,{run:r}=ke(),i=c.ref(null),s=c.ref(!1),l=c.ref(["heading","codeBlock","paragraph"]),a=c.computed(()=>{var y,b,v;const g=(b=(y=t.node)==null?void 0:y.content)==null?void 0:b.content;if((g==null?void 0:g.length)>0){const w=g[0];if(w.type.name==="image")return w.type.name}return(v=t.node)==null?void 0:v.type.name}),u=c.computed(()=>{var y;let g=a.value;return g==="heading"?{icon:`format_h${((y=t.node.attrs)==null?void 0:y.level)||1}`,color:pe.blue}:(g==="table-wrapper"&&(g="table"),kd.find(b=>b.value===g)||{icon:"title"})});function d(g){o("dragstart",g)}function f(g){o("dragend",g)}function p(g){var y;(y=i.value)==null||y.setShow(!1)}function h(g){s.value=g,g&&m()}function m(){var y;let g=t.getPos();l.value.includes(a.value),(y=t.editor)==null||y.commands.setNodeSelection(g)}return c.watch(()=>t.getPos(),g=>{var y;(y=i.value)==null||y.setShow(!1)}),(g,y)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:i,placement:"left","content-class":"dropdown",trigger:"click",offset:[0,2],"onUpdate:show":h},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["o-drag-btn",{selected:s.value}]),contenteditable:"false",draggable:"true","data-drag-handle":"",onDragstart:d,onDragend:f},[c.createVNode(c.unref(He),{type:"tertiary",class:"o-node-btn"},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:u.value.icon,color:u.value.color,small:""},null,8,["name","color"]),c.createVNode(c.unref(X),{name:"drag_indicator",small:""})]),_:1})],34)]),default:c.withCtx(()=>[c.createVNode(qP,c.mergeProps(t,{onAction:p}),null,16)]),_:1},512))}}),KP={key:0,class:"spinner"},JP={key:2,class:"o-btn__label"},He=c.defineComponent({__name:"OBtn",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""},loading:{type:Boolean,default:!1}},emits:["click"],setup(n,{emit:e}){const t=e;return(o,r)=>(c.openBlock(),c.createElementBlock("button",{class:c.normalizeClass(["o-btn",n.type?`type-${n.type}`:""]),onClick:r[0]||(r[0]=i=>t("click",i))},[n.loading?(c.openBlock(),c.createElementBlock("div",KP)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[n.icon?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:n.icon,class:c.normalizeClass(n.iconClass)},null,8,["name","class"])):c.createCommentVNode("",!0)],64)),n.label?(c.openBlock(),c.createElementBlock("span",JP,c.toDisplayString(n.label),1)):c.createCommentVNode("",!0),c.renderSlot(o.$slots,"default")],2))}}),GP={class:"o-btn-group"},hC=c.defineComponent({__name:"OBtnGroup",props:{icon:{type:String,default:""},iconClass:{type:[String,Object],default:""},label:{type:String,default:""},type:{type:String,default:""}},emits:["click"],setup(n,{emit:e}){return(t,o)=>(c.openBlock(),c.createElementBlock("div",GP,[c.renderSlot(t.$slots,"default")]))}}),XP={class:"o-checkbox"},YP={class:"o-checkbox__main"},QP={class:"o-checkbox__suffix"},dg=c.defineComponent({__name:"OCheckbox",props:{modelValue:{type:Boolean,default:!1},label:{type:String,default:""}},emits:["update:modelValue"],setup(n,{emit:e}){const t=n,o=e,r=c.computed({get(){return t.modelValue},set(i){o("update:modelValue",i)}});return(i,s)=>(c.openBlock(),c.createElementBlock("div",XP,[c.createElementVNode("div",YP,[c.withDirectives(c.createElementVNode("input",{"onUpdate:modelValue":s[0]||(s[0]=l=>r.value=l),type:"checkbox"},null,512),[[c.vModelCheckbox,r.value]])]),c.createElementVNode("div",QP,c.toDisplayString(n.label),1)]))}}),ZP={class:"dialog-header"},eV={class:"dialog-body"},tV={class:"dialog-footer"},mC=c.defineComponent({name:"ODialog",__name:"ODialog",props:{show:{type:Boolean},icon:{},title:{},fullscreen:{type:Boolean}},emits:["close","update:show"],setup(n,{emit:e}){const t=e,o=()=>{t("update:show",!1),t("close")};return(r,i)=>(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[n.show?(c.openBlock(),c.createElementBlock("div",{key:0,class:"dialog-overlay o-dialog",onClick:c.withModifiers(o,["self"])},[c.createElementVNode("div",{class:c.normalizeClass(["dialog-box",{fullscreen:n.fullscreen}])},[c.createElementVNode("div",ZP,[c.renderSlot(r.$slots,"title",{},()=>[c.createTextVNode(c.toDisplayString(n.title),1)]),c.createVNode(c.unref(He),{icon:"close",class:"close",onClick:o})]),c.createElementVNode("div",eV,[c.renderSlot(r.$slots,"default")]),c.createElementVNode("div",tV,[c.renderSlot(r.$slots,"footer")])],2)])):c.createCommentVNode("",!0)]))}}),Lt=c.defineComponent({__name:"ODivider",props:{vertical:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["o-divider",{"o-divider-vertical":n.vertical}])},null,2))}}),nV={key:0,class:"dialog-overlay o-image-viewer"},oV={class:"dialog-box"},rV={class:"dialog-body"},iV=["src"],sV={class:"action-group"},lV={class:"action-group"},aV={class:"o-btn scale"},gC=c.defineComponent({name:"ODialog",__name:"OImageViewer",props:{show:{type:Boolean,default:!1},title:{type:String,default:""},images:{type:Array,default:()=>[]},current:{type:Number,default:0}},emits:["update:show"],setup(n,{emit:e}){const t=n,o=e,{downloadImage:r}=wd(),i=c.ref(0),s=c.ref(1),l=c.ref({x:0,y:0}),a=c.ref(!1),u=c.ref({x:0,y:0}),d=c.ref(null),f=c.ref(null),p={MIN_SCALE:.1,MAX_SCALE:10,STEP:.1,WHEEL_SENSITIVITY:.001},h=c.computed(()=>{const O=t.images.length;let R={};return O>0&&(R=i.value>=0&&i.value<O?t.images.at(i.value):t.images.at(0)),R}),m=c.computed(()=>({transform:`translate(${l.value.x}px, ${l.value.y}px) scale(${s.value})`,transformOrigin:"center center",cursor:a.value?"grabbing":s.value>1?"grab":"default"})),g=c.computed(()=>parseInt(`${s.value*100}`)),y=O=>{O.preventDefault();const R=-O.deltaY*p.WHEEL_SENSITIVITY;let I=s.value+R;if(I=Math.max(p.MIN_SCALE,Math.min(p.MAX_SCALE,I)),f.value&&d.value){const L=f.value.getBoundingClientRect(),B=O.clientX-L.left-L.width/2,W=O.clientY-L.top-L.height/2,z=I-s.value;l.value.x-=B*z,l.value.y-=W*z}s.value=I},b=O=>{s.value<=1||(O.preventDefault(),a.value=!0,u.value={x:O.clientX-l.value.x,y:O.clientY-l.value.y},document.addEventListener("mousemove",v),document.addEventListener("mouseup",w))},v=O=>{a.value&&(l.value.x=O.clientX-u.value.x,l.value.y=O.clientY-u.value.y)},w=()=>{a.value=!1,document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",w)},k=()=>{s.value=Math.min(p.MAX_SCALE,s.value+p.STEP)},x=()=>{s.value=Math.max(p.MIN_SCALE,s.value-p.STEP)},C=()=>{s.value=1,l.value={x:0,y:0}},S=()=>{i.value>0&&(i.value-=1,C())},M=()=>{i.value<t.images.length-1&&(i.value+=1,C())},N=()=>{C(),o("update:show",!1)},A=()=>{var O;r((O=h.value.attrs)==null?void 0:O.src)},$=O=>{if(t.show)switch(O.preventDefault(),O.stopPropagation(),O.key){case"+":case"=":O.preventDefault(),k();break;case"-":O.preventDefault(),x();break;case"0":O.preventDefault(),C();break;case"ArrowLeft":(O.ctrlKey||O.metaKey)&&(O.preventDefault(),S());break;case"ArrowRight":(O.ctrlKey||O.metaKey)&&(O.preventDefault(),M());break;case"Escape":N();break}};return c.watch(()=>t.current,O=>{i.value=O,C()}),c.onMounted(()=>{i.value=t.current,document.addEventListener("keydown",$)}),c.onBeforeUnmount(()=>{document.removeEventListener("keydown",$),document.removeEventListener("mousemove",v),document.removeEventListener("mouseup",w)}),(O,R)=>(c.openBlock(),c.createBlock(c.Teleport,{to:"body"},[n.show?(c.openBlock(),c.createElementBlock("div",nV,[c.createElementVNode("header",null,[c.createVNode(c.unref(He),{icon:"close",onClick:N})]),c.createElementVNode("div",oV,[c.createElementVNode("div",rV,[c.createElementVNode("div",{class:"image-container",ref_key:"imageContainerRef",ref:f,onWheel:c.withModifiers(y,["prevent"]),onDblclick:C},[c.createElementVNode("img",{ref_key:"imageRef",ref:d,src:h.value.attrs.src,alt:"image",style:c.normalizeStyle(m.value),onMousedown:b},null,44,iV)],544)])]),c.createElementVNode("footer",null,[c.createElementVNode("div",sV,[c.createVNode(c.unref(He),{icon:"arrow_back",class:c.normalizeClass({disabled:i.value<=0}),onClick:S},null,8,["class"]),c.createVNode(c.unref(He),{icon:"arrow_back","icon-class":"rotate-180",class:c.normalizeClass({disabled:i.value>=t.images.length-1}),onClick:M},null,8,["class"])]),c.createElementVNode("div",lV,[c.createVNode(c.unref(He),{icon:"horizontal_rule",onClick:x}),c.createElementVNode("div",aV,c.toDisplayString(g.value)+"%",1),c.createVNode(c.unref(He),{icon:"add",onClick:k}),c.createVNode(c.unref(He),{icon:"download",onClick:A}),c.createVNode(c.unref(He),{icon:"close",onClick:N})])])])):c.createCommentVNode("",!0)]))}}),cV={class:"o-input__prefix"},uV={class:"o-input__main"},dV=["placeholder"],fV={class:"o-input__suffix"},Zn=c.defineComponent({__name:"OInput",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""}},emits:["blur","enter","focus","update:modelValue"],setup(n,{expose:e,emit:t}){const o=n,r=t,i=c.ref(null),s=c.computed({get(){return o.modelValue},set(u){r("update:modelValue",u)}});function l(){var u;(u=i.value)==null||u.focus()}function a(){s.value="",l()}return e({clear:a,focus:l}),(u,d)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["o-input",`type-${n.type}`])},[c.createElementVNode("div",cV,[c.renderSlot(u.$slots,"prefix")]),c.createElementVNode("div",uV,[c.withDirectives(c.createElementVNode("input",{ref_key:"input",ref:i,"onUpdate:modelValue":d[0]||(d[0]=f=>s.value=f),placeholder:n.placeholder,onFocus:d[1]||(d[1]=f=>r("focus")),onBlur:d[2]||(d[2]=f=>r("blur")),onKeyup:d[3]||(d[3]=c.withKeys(f=>r("enter"),["enter"]))},null,40,dV),[[c.vModelText,s.value]])]),c.createElementVNode("div",fV,[c.renderSlot(u.$slots,"suffix"),n.clearable&&s.value?(c.openBlock(),c.createBlock(X,{key:0,name:"close",class:"clear o-tips",onClick:a})):c.createCommentVNode("",!0)])],2))}}),ln=c.defineComponent({__name:"OList",props:{clickable:{type:Boolean,default:!1},hoverable:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("ul",{class:c.normalizeClass(["o-list",{clickable:n.clickable,hoverable:n.hoverable}])},[c.renderSlot(e.$slots,"default")],2))}}),pV={class:"o-list-item"},hV={class:"o-list-item__prefix"},mV={class:"o-list-item__main"},gV={class:"o-list-item__suffix"},Ut=c.defineComponent({__name:"OListItem",props:{hoverable:{type:Boolean,default:!1}},setup(n){return(e,t)=>(c.openBlock(),c.createElementBlock("li",pV,[c.createElementVNode("div",hV,[c.renderSlot(e.$slots,"prefix")]),c.createElementVNode("div",mV,[c.renderSlot(e.$slots,"default")]),c.createElementVNode("div",gV,[c.renderSlot(e.$slots,"suffix")])]))}}),$e=c.defineComponent({__name:"OPopover",props:{disable:{type:Boolean,default:!1},arrow:{type:Boolean,default:!1},offset:{type:Object,default:function(){return[0,10]}},placement:{type:String,default:"bottom-start"},trigger:{type:String,default:"mouseenter focus"},tippyClass:{type:String,default:"tippy"},contentClass:{type:String,default:""},event:{type:Object,default:function(){return{}}},delay:{type:Number,default:100},duration:{type:Number,default:200}},emits:["update:show"],setup(n,{expose:e,emit:t}){const o=n,r=t,{theme:i}=Bi(),s=c.ref(null),l=c.ref(),a=c.ref();function u(h){var m,g,y,b;h?((g=a.value)==null||g.setProps({getReferenceClientRect:(m=o.event)!=null&&m.clientX?d:null}),(y=a.value)==null||y.show()):(b=a.value)==null||b.hide()}function d(){var h,m;return{width:0,height:0,left:o.event.clientX,right:o.event.clientX,top:o.event.clientY,bottom:o.event.clientY,x:((h=o.event)==null?void 0:h.clientX)||0,y:((m=o.event)==null?void 0:m.clientY)||0,toJSON:()=>{var g,y;return{width:100,height:100,left:((g=o.event)==null?void 0:g.clientX)||0,top:((y=o.event)==null?void 0:y.clientY)||0}}}}function f(){a.value=No(s.value,{appendTo:()=>document.body,animation:"shift-away",arrow:o.arrow,content:l.value,duration:o.duration,delay:o.delay,interactive:!0,offset:o.offset,placement:o.placement,trigger:o.trigger,theme:i.value,onShow:h=>{h.popper.classList.add(o.tippyClass||"tippy"),r("update:show",!0)},onHide:h=>{r("update:show",!1)}})}function p(){a.value.setProps({theme:i.value})}return c.watch(i,h=>{p()}),e({setShow:u}),c.onMounted(()=>{f()}),c.onUnmounted(()=>{a.value&&a.value.destroy()}),(h,m)=>(c.openBlock(),c.createElementBlock("div",{ref_key:"triggerRef",ref:s,"data-tippy-role":"popover",class:"o-popover"},[c.renderSlot(h.$slots,"trigger"),n.disable?c.createCommentVNode("",!0):(c.openBlock(),c.createElementBlock("div",{key:0,ref_key:"contentRef",ref:l,class:c.normalizeClass(["popover-content",n.contentClass])},[c.renderSlot(h.$slots,"default")],2))],512))}}),yV={class:"o-textarea__prefix"},bV={class:"o-textarea__main"},vV=["placeholder","rows"],kV={class:"o-textarea__suffix"},yC=c.defineComponent({__name:"OTextarea",props:{modelValue:{type:String,default:""},placeholder:{type:String,default:""},clearable:{type:Boolean,default:!1},type:{type:String,default:""},rows:{type:Number,default:3}},emits:["blur","focus","update:modelValue"],setup(n,{expose:e,emit:t}){const o=n,r=t,i=c.ref(null),s=c.computed({get(){return o.modelValue},set(u){r("update:modelValue",u)}});function l(){var u;(u=i.value)==null||u.focus()}function a(){s.value="",l()}return e({clear:a,focus:l}),(u,d)=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(["o-textarea",`type-${n.type}`])},[c.createElementVNode("div",yV,[c.renderSlot(u.$slots,"prefix")]),c.createElementVNode("div",bV,[c.withDirectives(c.createElementVNode("textarea",{ref_key:"input",ref:i,"onUpdate:modelValue":d[0]||(d[0]=f=>s.value=f),placeholder:n.placeholder,rows:n.rows,onFocus:d[1]||(d[1]=f=>r("focus")),onBlur:d[2]||(d[2]=f=>r("blur"))},null,40,vV),[[c.vModelText,s.value]])]),c.createElementVNode("div",kV,[c.renderSlot(u.$slots,"suffix"),n.clearable&&s.value?(c.openBlock(),c.createBlock(X,{key:0,name:"close",class:"clear o-tips",onClick:a})):c.createCommentVNode("",!0)])],2))}}),bC=[`
|
|
34
176
|
Certainly! Here's a detailed prompt you can use to instruct a Large Language Model (LLM) to act as a writing expert:
|
|
35
177
|
|
|
36
178
|
---
|
|
@@ -56,14 +198,112 @@ Let’s begin! What type of writing assistance do you need today?"
|
|
|
56
198
|
---
|
|
57
199
|
|
|
58
200
|
This prompt ensures the LLM acts as a professional writing assistant, capable of handling diverse writing tasks with precision and creativity. Let me know if you'd like further customization!
|
|
59
|
-
`],Kf={key:0,class:"o-ai-menu tiptap-toolbar"},Wf={key:0,class:"o-scroll"},jf={class:"view-main"},Yf={key:1,class:"view-output"},Zf={class:"action-container"},Xf={class:"actions"},Qf={key:0,class:"o-scroll"},Jf=["innerHTML"],em={class:"ai-io-panel"},tm={class:"o-flex o-item-center actions"},zi=e.defineComponent({__name:"OAiMenu",props:{editor:{type:Ae.Editor,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(t,{emit:n}){const o=t,r=n,{md:a,aiOption:l,createStreamingChatCompletion:i}=cr(),{languageName:s,tr:c}=Z(),d=e.ref(),u=e.ref(!1),p=e.ref(""),m=e.ref(""),f=e.ref("main"),v=e.ref(""),b=e.ref(!1),_=e.ref(!1),h=e.computed(()=>({role:"system",content:sr.writing.replace("[LANGUAGE]",s.value)})),w=e.ref([{role:"system",content:"You are an assistant. Please answer in [LANGUAGE]."}]),y=e.computed(()=>$a.filter(M=>M.value.indexOf(p.value)>=0));function g(){const{from:M,to:L}=o.editor.state.selection;return o.editor.state.doc.textBetween(M,L,"")}function C(){setTimeout(()=>{u.value=!0},0)}function E(M,L){switch(L&&(u.value=!0),v.value=M.options.prompt.replaceAll("[CONTENT]",g()),M.value){case"translate":v.value=v.value.replace("[LANGUAGE]",L.value);break;case"change_tone":v.value=v.value.replace("[TONE]",L.value);break}return p.value=c(M.label),A(),!0}function R(){var M;O(),(M=d.value)==null||M.focus()}function D(){const M=Zo(o.editor,m.value);let L=0;for(const U of M.content){const S=us.Node.fromJSON(o.editor.schema,U);L+=S.nodeSize}o.editor.chain().focus().deleteSelection().insertContent(M.content).setTextSelection({from:o.editor.state.selection.from,to:o.editor.state.selection.from+L+1}).run(),O(),u.value=!1,setTimeout(()=>{r("confirm")},0)}function A(){f.value="output",b.value=!0,_.value?j():P()}async function P(){let M="";w.value.push({role:"user",content:v.value}),w.value[0].role==="system"&&(w.value.shift(),w.value.unshift(h.value));try{const L=await i(w.value,U=>{M+=U,w.value=[...w.value.slice(0,-1),{role:"assistant",content:M}],m.value=a.render(M)})}catch(L){w.value.pop(),console.error(L),xr.error(c("ai.error"))}b.value=!1}async function j(){let M="";for(const L of Ui)await new Promise(U=>setTimeout(U,500)),M+=L,m.value=a.render(M);b.value=!1}function O(){f.value="main",m.value="",p.value=""}return e.onMounted(()=>{setTimeout(()=>{var M;(M=d.value)==null||M.focus(),u.value=!0},300)}),(M,L)=>t.editor?(e.openBlock(),e.createElementBlock("section",Kf,[e.createVNode(e.unref(St),{modelValue:u.value,"onUpdate:modelValue":L[1]||(L[1]=U=>u.value=U),placement:"bottom-start","tippy-class":"ai-menu-popover","content-class":""},{"popover-content":e.withCtx(()=>[f.value==="main"?(e.openBlock(),e.createElementBlock("div",Wf,[e.createElementVNode("section",jf,[e.createVNode(e.unref(po),{items:y.value,onSelect:E,"use-keyboard":u.value},null,8,["items","use-keyboard"])])])):e.createCommentVNode("",!0),f.value==="output"?(e.openBlock(),e.createElementBlock("section",Yf,[e.createElementVNode("div",Zf,[e.createElementVNode("div",null,[e.createVNode(e.unref($),{name:"auto_awesome",class:"o-tips"})]),e.createElementVNode("div",Xf,[e.createVNode(e.unref(mt),{icon:"arrow_back","icon-class":"rotate-90",tooltip:"Confirm",loading:b.value,onClick:D},null,8,["loading"]),b.value?e.createCommentVNode("",!0):(e.openBlock(),e.createBlock(e.unref(mt),{key:0,icon:"close",tooltip:"Cancel",onClick:R}))])]),m.value?(e.openBlock(),e.createElementBlock("div",Qf,[e.createElementVNode("div",{class:"tiptap output",innerHTML:m.value},null,8,Jf)])):e.createCommentVNode("",!0)])):e.createCommentVNode("",!0)]),default:e.withCtx(()=>[e.createElementVNode("section",em,[e.createVNode(e.unref(vt),{ref_key:"inputRef",ref:d,class:"caption-input",modelValue:p.value,"onUpdate:modelValue":L[0]||(L[0]=U=>p.value=U),type:"text",placeholder:e.unref(c)("ai.askAi"),autofocus:"",onFocus:C},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:"auto_awesome",class:"o-tips"})]),suffix:e.withCtx(()=>[e.createElementVNode("div",tm,[e.createVNode(e.unref(mt),{icon:"keyboard_return",tooltip:"Submit"})])]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["modelValue"])])):e.createCommentVNode("",!0)}}),nm={key:0,class:"o-inline-math-menu tiptap-toolbar"},Hi=e.defineComponent({__name:"OInlineMathMenu",props:{editor:{type:Ae.Editor,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(t,{emit:n}){const o=t,r=n,{run:a}=oe(),l=e.ref(null),i=e.ref(""),s=e.ref(null);e.computed(()=>{const p=cn.InlinePlaceholderKey.getState(o.editor.state);return!!(p!=null&&p.active)});function c(){if(i.value="",s.value=null,o.editor.isActive("inlineMath")){const{state:p}=o.editor,{selection:m,schema:f}=p;if(m instanceof Ct.NodeSelection){const v=m.node;s.value=m.from,v.type.name==="inlineMath"&&(i.value=v.attrs.latex)}}setTimeout(()=>{var p;(p=l.value)==null||p.focus()},300)}function d(){console.log("latex",i.value,s.value),s.value?i.value?a(o.editor,"inlineMathUpdate",{latex:i.value}):a(o.editor,"inlineMathDelete",{pos:s.value}):i.value&&a(o.editor,"inlineMathInsert",{latex:i.value}),setTimeout(()=>{r("confirm")},0)}const u=()=>{o.editor.view.dispatch(o.editor.state.tr.setMeta(cn.InlinePlaceholderKey,{type:"hide"}))};return e.onMounted(()=>{c(),o.editor.on("focus",u)}),e.onUnmounted(()=>{o.editor.off("focus",u)}),(p,m)=>t.editor?(e.openBlock(),e.createElementBlock("section",nm,[e.createVNode(e.unref(vt),{ref_key:"input",ref:l,modelValue:i.value,"onUpdate:modelValue":m[0]||(m[0]=f=>i.value=f),type:"text",autofocus:"",clearable:"",onKeydown:e.withKeys(e.withModifiers(d,["prevent"]),["enter"])},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:"function",class:"o-tips"})]),suffix:e.withCtx(()=>[i.value?(e.openBlock(),e.createBlock(e.unref($),{key:0,name:"keyboard_return",class:"clear o-tips",onClick:d})):e.createCommentVNode("",!0)]),_:1},8,["modelValue","onKeydown"])])):e.createCommentVNode("",!0)}}),om={class:"o-scroll"},rm={class:"view-main"},am={class:"block-container"},im={class:"block-content"},lm={key:0,class:"edit-prompt"},sm={key:1},cm={"data-tippy-role":"tooltip"},um={class:"label"},dm={class:"block-container"},pm={class:"block-content"},fm=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t,{md:o,aiOption:r,createStreamingChatCompletion:a}=cr(),{languageName:l,tr:i}=Z(),{isFocused:s,bind:c,unbind:d,checkFocus:u}=Xa(),{theme:p}=tn(),{isEditable:m}=oe(),{getPos:f}=n,v=e.ref(null),b=e.ref(""),_=e.ref(!1),h=e.ref({}),w=e.ref(!1),y=e.ref(!1),g=e.ref(""),C=e.ref(null),E=e.ref(!1),R=e.ref(!1),D=e.computed(()=>({role:"system",content:sr.writing.replace("[LANGUAGE]",l.value)})),A=e.ref([D.value]),P=e.computed(()=>!n.node.textContent),j=e.computed(()=>Pa),O=e.computed({get(){return n.node.attrs.provider},set(Y){n.updateAttributes({provider:Y})}}),M=e.computed({get(){return n.node.attrs.prompt},set(Y){n.updateAttributes({prompt:Y})}}),L=e.computed({get(){return n.node.attrs.time},set(Y){n.updateAttributes({time:Y})}});function U(){b.value=M.value,P.value&&!M.value&&setTimeout(()=>{var Y;(Y=v.value)==null||Y.focus()},0)}function S(){setTimeout(()=>{},0)}function H(){g.value="edit",setTimeout(()=>{var Y;(Y=C.value)==null||Y.focus()},0)}function T(){O.value=r.value.provider,M.value=b.value,L.value=Date.now(),E.value=!0,g.value&&(g.value=""),R.value?ie():X()}async function X(){const Y=f();let le="";A.value.push({role:"user",content:M.value}),A.value[0].role==="system"&&(A.value.shift(),A.value.unshift(D.value));try{const ce=await a(A.value,Ne=>{le+=Ne,A.value=[...A.value.slice(0,-1),{role:"assistant",content:le}];const Me=Zo(n.editor,o.render(le));ge(Y,Me)})}catch(ce){A.value.pop(),console.error(ce),xr.error(i("ai.error"))}E.value=!1}async function ie(){const Y=f();let le="";try{for(const ce of Ui){await new Promise(Me=>setTimeout(Me,500)),le+=ce;const Ne=Zo(n.editor,o.render(le));ge(Y,Ne)}}catch(ce){console.error(ce)}E.value=!1}function ge(Y,le){var Ne;const ce=n.node.toJSON();ce.content=le.content,(Ne=n.editor)==null||Ne.commands.updateAiBlock(Y,ce),n.editor.commands.setNodeSelection(Y),n.editor.view.focus(),be()}function be(){const le=n.node.content.lastChild;if(le&&le.attrs["data-id"]){const ce=le.attrs["data-id"],Ne=document.querySelector(`[data-id="${ce}"]`);Ne&&Ne.scrollIntoView({behavior:"smooth",block:"center"})}}function Be(Y){_.value=!1,Y.value}function $e(Y,le){le?b.value=i(le.label):b.value=i(Y.label),w.value=!1}function Re(Y){_.value=!0,h.value=Y}return e.watch(()=>n.node.content,Y=>{u()}),e.watch(P,Y=>{Y&&(y.value=!1)}),e.watch(s,Y=>{Y&&!P.value&&setTimeout(()=>{b.value=M.value,g.value="",y.value=Y},100)}),e.onMounted(()=>{U(),c(n)}),e.onBeforeUnmount(()=>{d()}),(Y,le)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:["o-ai-block-view",{"is-empty":P.value,"has-focus":e.unref(s)}],onContextmenu:e.withModifiers(Re,["prevent"])}),{default:e.withCtx(()=>[P.value?(e.openBlock(),e.createBlock(e.unref(St),{key:0,modelValue:w.value,"onUpdate:modelValue":le[1]||(le[1]=ce=>w.value=ce),placement:"bottom-start","tippy-class":"ai-block-popover",offset:[0,14]},{"popover-content":e.withCtx(()=>[e.createElementVNode("section",om,[e.createElementVNode("section",rm,[e.createVNode(e.unref(po),{items:j.value,onSelect:$e,"use-keyboard":w.value},null,8,["items","use-keyboard"])])])]),default:e.withCtx(()=>[e.createElementVNode("div",am,[e.createElementVNode("div",im,[e.createVNode(e.unref(vt),{ref_key:"inputRef",ref:v,modelValue:b.value,"onUpdate:modelValue":le[0]||(le[0]=ce=>b.value=ce),placeholder:e.unref(i)("ai.tellAi"),type:"text",autofocus:"",clearable:"",onFocus:S},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:"auto_awesome"})]),suffix:e.withCtx(()=>[e.createVNode(e.unref(mt),{icon:"arrow_back","icon-class":"rotate-90",tooltip:e.unref(i)("label.generate"),loading:E.value,onClick:T},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])])]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),e.withDirectives(e.createVNode(e.unref(St),{modelValue:y.value,"onUpdate:modelValue":le[4]||(le[4]=ce=>y.value=ce),placement:"top-end","tippy-class":"ai-block-update-popover",offset:[0,18]},{"popover-content":e.withCtx(()=>[g.value==="edit"?(e.openBlock(),e.createElementBlock("section",lm,[e.createVNode(e.unref(vt),{ref_key:"updateInputRef",ref:C,modelValue:b.value,"onUpdate:modelValue":le[2]||(le[2]=ce=>b.value=ce),placeholder:e.unref(i)("ai.tellAi"),type:"text",autofocus:"",clearable:""},{prefix:e.withCtx(()=>[e.createVNode(e.unref($),{name:"auto_awesome"})]),suffix:e.withCtx(()=>[e.createVNode(e.unref(mt),{icon:"arrow_back","icon-class":"rotate-90",tooltip:e.unref(i)("label.generate"),loading:E.value,onClick:T},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])):(e.openBlock(),e.createElementBlock("section",sm,[e.createVNode(e.unref(Li),null,{default:e.withCtx(()=>[e.createElementVNode("div",cm,[e.createVNode(e.unref(ke),{icon:"auto_awesome",onClick:H},{default:e.withCtx(()=>[e.createElementVNode("span",um,e.toDisplayString(e.unref(i)("label.generatedBy"))+" "+e.toDisplayString(e.unref(lr)(O.value,"name")||"AI"),1)]),_:1})]),e.createVNode(e.unref(mt),{icon:"autorenew",tooltip:e.unref(i)("label.update"),loading:E.value,onClick:T},null,8,["tooltip","loading"])]),_:1})]))]),default:e.withCtx(()=>[e.createElementVNode("div",dm,[e.createElementVNode("div",pm,[e.createVNode(e.unref(G.NodeViewContent))]),e.unref(m)?(e.openBlock(),e.createBlock(e.unref(Mn),{key:0,modelValue:_.value,"onUpdate:modelValue":le[3]||(le[3]=ce=>_.value=ce),event:h.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ut),e.mergeProps(n,{onAction:Be}),null,16)]),_:1},8,["modelValue","event"])):e.createCommentVNode("",!0)])]),_:1},8,["modelValue"]),[[e.vShow,!P.value]])]),_:1},16,["class"]))}}),mm=Yl.extend({addNodeView(){return G.VueNodeViewRenderer(fm)}}),gm={class:"header o-tips"},bm={style:{display:"flex"}},vm=["innerHTML"],hm=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t,{tr:o}=Z(),{isEditable:r}=oe(),a=e.ref(!1),l=e.ref(null),i=e.computed({get(){return n.node.attrs.latex},set(u){n.updateAttributes({latex:u||""})}}),s=e.computed(()=>Ql.renderToString(i.value,{throwOnError:!1}));function c(u){a.value=u,u&&setTimeout(()=>{var p;(p=l.value)==null||p.focus()},100)}function d(){window.open("https://katex.org/docs/supported.html","target")}return e.onMounted(()=>{c(!i.value)}),(u,p)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:["o-block-math-view",{init:!i.value}],as:"div",onClick:p[3]||(p[3]=m=>c(!0))}),{default:e.withCtx(()=>[e.createVNode(e.unref(St),{modelValue:a.value,"onUpdate:modelValue":p[2]||(p[2]=m=>a.value=m),"content-class":"o-block-math-editor",placement:i.value==="init"?"bottom":"top",readonly:!e.unref(r),"show-arrow":""},{"popover-content":e.withCtx(()=>[e.createElementVNode("header",gm,[e.createElementVNode("div",bm,[e.createVNode(e.unref($),{name:"functions"}),e.createTextVNode(" "+e.toDisplayString(e.unref(o)("editor.blockMath")),1)]),e.createElementVNode("div",null,[e.createVNode(e.unref(Te),{icon:"help",tooltip:e.unref(o)("label.help"),onClick:d},null,8,["tooltip"])])]),e.createVNode(e.unref(Pi),{ref_key:"input",ref:l,modelValue:i.value,"onUpdate:modelValue":p[0]||(p[0]=m=>i.value=m),placeholder:"Input block math ...",autofocus:"",clearable:""},null,8,["modelValue"])]),default:e.withCtx(()=>[i.value?(e.openBlock(),e.createElementBlock("div",{key:1,class:"block-math-container",onClick:p[1]||(p[1]=m=>c(!0))},[e.createElementVNode("div",{class:"katex-container",innerHTML:s.value},null,8,vm)])):(e.openBlock(),e.createBlock(e.unref(uo),{key:0,class:"o-tips",icon:"functions",placeholder:"Add a TeX equation"}))]),_:1},8,["modelValue","placement","readonly"])]),_:1},16,["class"]))}}),_m=jo.BlockMath.extend({addCommands(){return{insertBlockMath:(t={})=>({tr:n,dispatch:o,state:r})=>{const a=r.schema.nodes.blockMath.create({latex:t.latex??""});return o&&(n.replaceSelectionWith(a),n.scrollIntoView()),!0}}},addNodeView(){return G.VueNodeViewRenderer(hm)}}),km=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t;return(o,r)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:"o-blockquote-view"}),{default:e.withCtx(()=>[e.createElementVNode("blockquote",null,[e.createVNode(e.unref(G.NodeViewContent))])]),_:1},16))}}),ym=Jl.extend({draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),triggerCharacters:[">"]}},addInputRules(){const{triggerCharacters:t}=this.options,n=t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),o=new RegExp(`^[${n}]\\s$`);return[new Ae.InputRule({find:o,handler:({state:r,range:a})=>{const{tr:l,schema:i}=r,{$from:s}=l.selection,c=s.before(s.depth),d=s.after(s.depth);l.delete(a.from,a.to);const u=i.nodes.blockquote.create(null,i.nodes.paragraph.create());l.replaceRangeWith(c,d,u);const p=Ct.TextSelection.near(l.doc.resolve(c+2));l.setSelection(p)}})]},addNodeView(){return G.VueNodeViewRenderer(km)}}),wm={class:"callout-container"},Em={class:"callout-icon"},Cm={class:"callout-content"},xm=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t,{theme:o}=tn(),{isEditable:r}=oe(),a=e.ref(!1),l=e.ref(!1),i=e.ref({}),s=e.ref(null),c=e.computed(()=>{const{selection:g}=n.editor.view.state,C=g.from,E=n.getPos(),R=E+n.node.nodeSize;return C>=E&&C<=R}),d=e.computed({get(){return n.node.attrs.backColor},set(g){n.updateAttributes({backColor:g})}}),u=e.computed({get(){return n.node.attrs.backColorDark},set(g){n.updateAttributes({backColorDark:g})}}),p=e.computed({get(){return n.node.attrs.borderColor},set(g){n.updateAttributes({borderColor:g})}}),m=e.computed({get(){return n.node.attrs.borderColorDark},set(g){n.updateAttributes({borderColorDark:g})}}),f=e.computed(()=>o.value==="dark"?u.value:d.value),v=e.computed(()=>o.value==="dark"?m.value:p.value);function b(g){n.updateAttributes({icon:g})}function _(g){switch(a.value=!1,g.value){case"palette":w(!0);break}}function h(g){a.value=!0,i.value=g}function w(g){l.value=g}function y(g,C){var E;switch(g){case"backColor":d.value=C;break;case"foreColor":p.value=C;break;case"icon":b(C.emoji),(E=s.value)==null||E.setShow(!1);break}}return e.watch(c,g=>{w(g)}),(g,C)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:"o-callout-view",style:`--callout-border-color: ${v.value}; --callout-back-color: ${f.value}`,onContextmenu:e.withModifiers(h,["prevent"])}),{default:e.withCtx(()=>[e.createElementVNode("div",wm,[e.createVNode(e.unref(fe),{ref_key:"iconPopover",ref:s,placement:"bottom-start",trigger:"click",offset:[0,0],disable:!e.unref(r)},{trigger:e.withCtx(()=>[e.createElementVNode("div",Em,e.toDisplayString(g.node.attrs.icon),1)]),default:e.withCtx(()=>[e.createVNode(e.unref(go),{items:e.unref(Nn.emojiGroups),onSelect:C[0]||(C[0]=E=>y("icon",E)),"enable-search":""},null,8,["items"])]),_:1},8,["disable"]),e.createElementVNode("div",Cm,[e.createVNode(e.unref(G.NodeViewContent))]),e.unref(r)?(e.openBlock(),e.createBlock(e.unref(Mn),{key:0,modelValue:a.value,"onUpdate:modelValue":C[1]||(C[1]=E=>a.value=E),event:i.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ut),e.mergeProps(n,{onAction:_}),null,16)]),_:1},8,["modelValue","event"])):e.createCommentVNode("",!0)])]),_:1},16,["style"]))}}),Nm=es.extend({addNodeView(){return G.VueNodeViewRenderer(xm)}});function Sm(t){const n=t.regex,o=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",i="(?!struct)("+r+"|"+n.optional(a)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",s={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},p={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},o,t.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:n.optional(a)+t.IDENT_RE,relevance:0},f=n.optional(a)+t.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],_=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],h=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],g={type:b,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},C={className:"function.dispatch",relevance:0,keywords:{_hint:h},begin:n.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,n.lookahead(/(<[^<>]+>|)\s*\(/))},E=[C,p,s,o,t.C_BLOCK_COMMENT_MODE,u,d],R={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:E.concat([{begin:/\(/,end:/\)/,keywords:g,contains:E.concat(["self"]),relevance:0}]),relevance:0},D={className:"function",begin:"("+i+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:f,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[o,t.C_BLOCK_COMMENT_MODE,d,u,s,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",o,t.C_BLOCK_COMMENT_MODE,d,u,s]}]},s,o,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:g,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(R,D,C,E,[p,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:g,contains:["self",s]},{begin:t.IDENT_RE+"::",keywords:g},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Tm(t){const n={type:["boolean","byte","word","String"],built_in:["KeyboardController","MouseController","SoftwareSerial","EthernetServer","EthernetClient","LiquidCrystal","RobotControl","GSMVoiceCall","EthernetUDP","EsploraTFT","HttpClient","RobotMotor","WiFiClient","GSMScanner","FileSystem","Scheduler","GSMServer","YunClient","YunServer","IPAddress","GSMClient","GSMModem","Keyboard","Ethernet","Console","GSMBand","Esplora","Stepper","Process","WiFiUDP","GSM_SMS","Mailbox","USBHost","Firmata","PImage","Client","Server","GSMPIN","FileIO","Bridge","Serial","EEPROM","Stream","Mouse","Audio","Servo","File","Task","GPRS","WiFi","Wire","TFT","GSM","SPI","SD"],_hints:["setup","loop","runShellCommandAsynchronously","analogWriteResolution","retrieveCallingNumber","printFirmwareVersion","analogReadResolution","sendDigitalPortPair","noListenOnLocalhost","readJoystickButton","setFirmwareVersion","readJoystickSwitch","scrollDisplayRight","getVoiceCallStatus","scrollDisplayLeft","writeMicroseconds","delayMicroseconds","beginTransmission","getSignalStrength","runAsynchronously","getAsynchronously","listenOnLocalhost","getCurrentCarrier","readAccelerometer","messageAvailable","sendDigitalPorts","lineFollowConfig","countryNameWrite","runShellCommand","readStringUntil","rewindDirectory","readTemperature","setClockDivider","readLightSensor","endTransmission","analogReference","detachInterrupt","countryNameRead","attachInterrupt","encryptionType","readBytesUntil","robotNameWrite","readMicrophone","robotNameRead","cityNameWrite","userNameWrite","readJoystickY","readJoystickX","mouseReleased","openNextFile","scanNetworks","noInterrupts","digitalWrite","beginSpeaker","mousePressed","isActionDone","mouseDragged","displayLogos","noAutoscroll","addParameter","remoteNumber","getModifiers","keyboardRead","userNameRead","waitContinue","processInput","parseCommand","printVersion","readNetworks","writeMessage","blinkVersion","cityNameRead","readMessage","setDataMode","parsePacket","isListening","setBitOrder","beginPacket","isDirectory","motorsWrite","drawCompass","digitalRead","clearScreen","serialEvent","rightToLeft","setTextSize","leftToRight","requestFrom","keyReleased","compassRead","analogWrite","interrupts","WiFiServer","disconnect","playMelody","parseFloat","autoscroll","getPINUsed","setPINUsed","setTimeout","sendAnalog","readSlider","analogRead","beginWrite","createChar","motorsStop","keyPressed","tempoWrite","readButton","subnetMask","debugPrint","macAddress","writeGreen","randomSeed","attachGPRS","readString","sendString","remotePort","releaseAll","mouseMoved","background","getXChange","getYChange","answerCall","getResult","voiceCall","endPacket","constrain","getSocket","writeJSON","getButton","available","connected","findUntil","readBytes","exitValue","readGreen","writeBlue","startLoop","IPAddress","isPressed","sendSysex","pauseMode","gatewayIP","setCursor","getOemKey","tuneWrite","noDisplay","loadImage","switchPIN","onRequest","onReceive","changePIN","playFile","noBuffer","parseInt","overflow","checkPIN","knobRead","beginTFT","bitClear","updateIR","bitWrite","position","writeRGB","highByte","writeRed","setSpeed","readBlue","noStroke","remoteIP","transfer","shutdown","hangCall","beginSMS","endWrite","attached","maintain","noCursor","checkReg","checkPUK","shiftOut","isValid","shiftIn","pulseIn","connect","println","localIP","pinMode","getIMEI","display","noBlink","process","getBand","running","beginSD","drawBMP","lowByte","setBand","release","bitRead","prepare","pointTo","readRed","setMode","noFill","remove","listen","stroke","detach","attach","noTone","exists","buffer","height","bitSet","circle","config","cursor","random","IRread","setDNS","endSMS","getKey","micros","millis","begin","print","write","ready","flush","width","isPIN","blink","clear","press","mkdir","rmdir","close","point","yield","image","BSSID","click","delay","read","text","move","peek","beep","rect","line","open","seek","fill","size","turn","stop","home","find","step","tone","sqrt","RSSI","SSID","end","bit","tan","cos","sin","pow","map","abs","max","min","get","run","put"],literal:["DIGITAL_MESSAGE","FIRMATA_STRING","ANALOG_MESSAGE","REPORT_DIGITAL","REPORT_ANALOG","INPUT_PULLUP","SET_PIN_MODE","INTERNAL2V56","SYSTEM_RESET","LED_BUILTIN","INTERNAL1V1","SYSEX_START","INTERNAL","EXTERNAL","DEFAULT","OUTPUT","INPUT","HIGH","LOW"]},o=Sm(t),r=o.keywords;return r.type=[...r.type,...n.type],r.literal=[...r.literal,...n.literal],r.built_in=[...r.built_in,...n.built_in],r._hints=n._hints,o.name="Arduino",o.aliases=["ino"],o.supersetOf="cpp",o}function Om(t){const n=t.regex,o={},r={begin:/\$\{/,end:/\}/,contains:["self",{begin:/:-/,contains:[o]}]};Object.assign(o,{className:"variable",variants:[{begin:n.concat(/\$[\w\d#@][\w\d_]*/,"(?![\\w\\d])(?![$])")},r]});const a={className:"subst",begin:/\$\(/,end:/\)/,contains:[t.BACKSLASH_ESCAPE]},l=t.inherit(t.COMMENT(),{match:[/(^|\s)/,/#.*$/],scope:{2:"comment"}}),i={begin:/<<-?\s*(?=\w+)/,starts:{contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,className:"string"})]}},s={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,o,a]};a.contains.push(s);const c={match:/\\"/},d={className:"string",begin:/'/,end:/'/},u={match:/\\'/},p={begin:/\$?\(\(/,end:/\)\)/,contains:[{begin:/\d+#[0-9a-f]+/,className:"number"},t.NUMBER_MODE,o]},m=["fish","bash","zsh","sh","csh","ksh","tcsh","dash","scsh"],f=t.SHEBANG({binary:`(${m.join("|")})`,relevance:10}),v={className:"function",begin:/\w[\w\d_]*\s*\(\s*\)\s*\{/,returnBegin:!0,contains:[t.inherit(t.TITLE_MODE,{begin:/\w[\w\d_]*/})],relevance:0},b=["if","then","else","elif","fi","time","for","while","until","in","do","done","case","esac","coproc","function","select"],_=["true","false"],h={match:/(\/[a-z._-]+)+/},w=["break","cd","continue","eval","exec","exit","export","getopts","hash","pwd","readonly","return","shift","test","times","trap","umask","unset"],y=["alias","bind","builtin","caller","command","declare","echo","enable","help","let","local","logout","mapfile","printf","read","readarray","source","sudo","type","typeset","ulimit","unalias"],g=["autoload","bg","bindkey","bye","cap","chdir","clone","comparguments","compcall","compctl","compdescribe","compfiles","compgroups","compquote","comptags","comptry","compvalues","dirs","disable","disown","echotc","echoti","emulate","fc","fg","float","functions","getcap","getln","history","integer","jobs","kill","limit","log","noglob","popd","print","pushd","pushln","rehash","sched","setcap","setopt","stat","suspend","ttyctl","unfunction","unhash","unlimit","unsetopt","vared","wait","whence","where","which","zcompile","zformat","zftp","zle","zmodload","zparseopts","zprof","zpty","zregexparse","zsocket","zstyle","ztcp"],C=["chcon","chgrp","chown","chmod","cp","dd","df","dir","dircolors","ln","ls","mkdir","mkfifo","mknod","mktemp","mv","realpath","rm","rmdir","shred","sync","touch","truncate","vdir","b2sum","base32","base64","cat","cksum","comm","csplit","cut","expand","fmt","fold","head","join","md5sum","nl","numfmt","od","paste","ptx","pr","sha1sum","sha224sum","sha256sum","sha384sum","sha512sum","shuf","sort","split","sum","tac","tail","tr","tsort","unexpand","uniq","wc","arch","basename","chroot","date","dirname","du","echo","env","expr","factor","groups","hostid","id","link","logname","nice","nohup","nproc","pathchk","pinky","printenv","printf","pwd","readlink","runcon","seq","sleep","stat","stdbuf","stty","tee","test","timeout","tty","uname","unlink","uptime","users","who","whoami","yes"];return{name:"Bash",aliases:["sh","zsh"],keywords:{$pattern:/\b[a-z][a-z0-9._-]+\b/,keyword:b,literal:_,built_in:[...w,...y,"set","shopt",...g,...C]},contains:[f,t.SHEBANG(),v,p,l,i,h,s,c,d,u,o]}}function Am(t){const n=t.regex,o=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",i="("+r+"|"+n.optional(a)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",s={className:"type",variants:[{begin:"\\b[a-z\\d_]*_t\\b"},{match:/\batomic_[a-z]{3,6}\b/}]},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{match:/\b(0b[01']+)/},{match:/(-?)\b([\d']+(\.[\d']*)?|\.[\d']+)((ll|LL|l|L)(u|U)?|(u|U)(ll|LL|l|L)?|f|F|b|B)/},{match:/(-?)\b(0[xX][a-fA-F0-9]+(?:'[a-fA-F0-9]+)*(?:\.[a-fA-F0-9]*(?:'[a-fA-F0-9]*)*)?(?:[pP][-+]?[0-9]+)?(l|L)?(u|U)?)/},{match:/(-?)\b\d+(?:'\d+)*(?:\.\d*(?:'\d*)*)?(?:[eE][-+]?\d+)?/}],relevance:0},p={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef elifdef elifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},o,t.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:n.optional(a)+t.IDENT_RE,relevance:0},f=n.optional(a)+t.IDENT_RE+"\\s*\\(",_={keyword:["asm","auto","break","case","continue","default","do","else","enum","extern","for","fortran","goto","if","inline","register","restrict","return","sizeof","typeof","typeof_unqual","struct","switch","typedef","union","volatile","while","_Alignas","_Alignof","_Atomic","_Generic","_Noreturn","_Static_assert","_Thread_local","alignas","alignof","noreturn","static_assert","thread_local","_Pragma"],type:["float","double","signed","unsigned","int","short","long","char","void","_Bool","_BitInt","_Complex","_Imaginary","_Decimal32","_Decimal64","_Decimal96","_Decimal128","_Decimal64x","_Decimal128x","_Float16","_Float32","_Float64","_Float128","_Float32x","_Float64x","_Float128x","const","static","constexpr","complex","bool","imaginary"],literal:"true false NULL",built_in:"std string wstring cin cout cerr clog stdin stdout stderr stringstream istringstream ostringstream auto_ptr deque list queue stack vector map set pair bitset multiset multimap unordered_set unordered_map unordered_multiset unordered_multimap priority_queue make_pair array shared_ptr abort terminate abs acos asin atan2 atan calloc ceil cosh cos exit exp fabs floor fmod fprintf fputs free frexp fscanf future isalnum isalpha iscntrl isdigit isgraph islower isprint ispunct isspace isupper isxdigit tolower toupper labs ldexp log10 log malloc realloc memchr memcmp memcpy memset modf pow printf putchar puts scanf sinh sin snprintf sprintf sqrt sscanf strcat strchr strcmp strcpy strcspn strlen strncat strncmp strncpy strpbrk strrchr strspn strstr tanh tan vfprintf vprintf vsprintf endl initializer_list unique_ptr"},h=[p,s,o,t.C_BLOCK_COMMENT_MODE,u,d],w={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:_,contains:h.concat([{begin:/\(/,end:/\)/,keywords:_,contains:h.concat(["self"]),relevance:0}]),relevance:0},y={begin:"("+i+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:_,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:_,relevance:0},{begin:f,returnBegin:!0,contains:[t.inherit(m,{className:"title.function"})],relevance:0},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:[o,t.C_BLOCK_COMMENT_MODE,d,u,s,{begin:/\(/,end:/\)/,keywords:_,relevance:0,contains:["self",o,t.C_BLOCK_COMMENT_MODE,d,u,s]}]},s,o,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C",aliases:["h"],keywords:_,disableAutodetect:!0,illegal:"</",contains:[].concat(w,y,h,[p,{begin:t.IDENT_RE+"::",keywords:_},{className:"class",beginKeywords:"enum class struct union",end:/[{;:<>=]/,contains:[{beginKeywords:"final class struct"},t.TITLE_MODE]}]),exports:{preprocessor:p,strings:d,keywords:_}}}function Bm(t){const n=t.regex,o=t.COMMENT("//","$",{contains:[{begin:/\\\n/}]}),r="decltype\\(auto\\)",a="[a-zA-Z_]\\w*::",i="(?!struct)("+r+"|"+n.optional(a)+"[a-zA-Z_]\\w*"+n.optional("<[^<>]+>")+")",s={className:"type",begin:"\\b[a-z\\d_]*_t\\b"},d={className:"string",variants:[{begin:'(u8?|U|L)?"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]},{begin:"(u8?|U|L)?'("+"\\\\(x[0-9A-Fa-f]{2}|u[0-9A-Fa-f]{4,8}|[0-7]{3}|\\S)"+"|.)",end:"'",illegal:"."},t.END_SAME_AS_BEGIN({begin:/(?:u8?|U|L)?R"([^()\\ ]{0,16})\(/,end:/\)([^()\\ ]{0,16})"/})]},u={className:"number",variants:[{begin:"[+-]?(?:(?:[0-9](?:'?[0-9])*\\.(?:[0-9](?:'?[0-9])*)?|\\.[0-9](?:'?[0-9])*)(?:[Ee][+-]?[0-9](?:'?[0-9])*)?|[0-9](?:'?[0-9])*[Ee][+-]?[0-9](?:'?[0-9])*|0[Xx](?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*(?:\\.(?:[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)?)?|\\.[0-9A-Fa-f](?:'?[0-9A-Fa-f])*)[Pp][+-]?[0-9](?:'?[0-9])*)(?:[Ff](?:16|32|64|128)?|(BF|bf)16|[Ll]|)"},{begin:"[+-]?\\b(?:0[Bb][01](?:'?[01])*|0[Xx][0-9A-Fa-f](?:'?[0-9A-Fa-f])*|0(?:'?[0-7])*|[1-9](?:'?[0-9])*)(?:[Uu](?:LL?|ll?)|[Uu][Zz]?|(?:LL?|ll?)[Uu]?|[Zz][Uu]|)"}],relevance:0},p={className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma _Pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(d,{className:"string"}),{className:"string",begin:/<.*?>/},o,t.C_BLOCK_COMMENT_MODE]},m={className:"title",begin:n.optional(a)+t.IDENT_RE,relevance:0},f=n.optional(a)+t.IDENT_RE+"\\s*\\(",v=["alignas","alignof","and","and_eq","asm","atomic_cancel","atomic_commit","atomic_noexcept","auto","bitand","bitor","break","case","catch","class","co_await","co_return","co_yield","compl","concept","const_cast|10","consteval","constexpr","constinit","continue","decltype","default","delete","do","dynamic_cast|10","else","enum","explicit","export","extern","false","final","for","friend","goto","if","import","inline","module","mutable","namespace","new","noexcept","not","not_eq","nullptr","operator","or","or_eq","override","private","protected","public","reflexpr","register","reinterpret_cast|10","requires","return","sizeof","static_assert","static_cast|10","struct","switch","synchronized","template","this","thread_local","throw","transaction_safe","transaction_safe_dynamic","true","try","typedef","typeid","typename","union","using","virtual","volatile","while","xor","xor_eq"],b=["bool","char","char16_t","char32_t","char8_t","double","float","int","long","short","void","wchar_t","unsigned","signed","const","static"],_=["any","auto_ptr","barrier","binary_semaphore","bitset","complex","condition_variable","condition_variable_any","counting_semaphore","deque","false_type","flat_map","flat_set","future","imaginary","initializer_list","istringstream","jthread","latch","lock_guard","multimap","multiset","mutex","optional","ostringstream","packaged_task","pair","promise","priority_queue","queue","recursive_mutex","recursive_timed_mutex","scoped_lock","set","shared_future","shared_lock","shared_mutex","shared_timed_mutex","shared_ptr","stack","string_view","stringstream","timed_mutex","thread","true_type","tuple","unique_lock","unique_ptr","unordered_map","unordered_multimap","unordered_multiset","unordered_set","variant","vector","weak_ptr","wstring","wstring_view"],h=["abort","abs","acos","apply","as_const","asin","atan","atan2","calloc","ceil","cerr","cin","clog","cos","cosh","cout","declval","endl","exchange","exit","exp","fabs","floor","fmod","forward","fprintf","fputs","free","frexp","fscanf","future","invoke","isalnum","isalpha","iscntrl","isdigit","isgraph","islower","isprint","ispunct","isspace","isupper","isxdigit","labs","launder","ldexp","log","log10","make_pair","make_shared","make_shared_for_overwrite","make_tuple","make_unique","malloc","memchr","memcmp","memcpy","memset","modf","move","pow","printf","putchar","puts","realloc","scanf","sin","sinh","snprintf","sprintf","sqrt","sscanf","std","stderr","stdin","stdout","strcat","strchr","strcmp","strcpy","strcspn","strlen","strncat","strncmp","strncpy","strpbrk","strrchr","strspn","strstr","swap","tan","tanh","terminate","to_underlying","tolower","toupper","vfprintf","visit","vprintf","vsprintf"],g={type:b,keyword:v,literal:["NULL","false","nullopt","nullptr","true"],built_in:["_Pragma"],_type_hints:_},C={className:"function.dispatch",relevance:0,keywords:{_hint:h},begin:n.concat(/\b/,/(?!decltype)/,/(?!if)/,/(?!for)/,/(?!switch)/,/(?!while)/,t.IDENT_RE,n.lookahead(/(<[^<>]+>|)\s*\(/))},E=[C,p,s,o,t.C_BLOCK_COMMENT_MODE,u,d],R={variants:[{begin:/=/,end:/;/},{begin:/\(/,end:/\)/},{beginKeywords:"new throw return else",end:/;/}],keywords:g,contains:E.concat([{begin:/\(/,end:/\)/,keywords:g,contains:E.concat(["self"]),relevance:0}]),relevance:0},D={className:"function",begin:"("+i+"[\\*&\\s]+)+"+f,returnBegin:!0,end:/[{;=]/,excludeEnd:!0,keywords:g,illegal:/[^\w\s\*&:<>.]/,contains:[{begin:r,keywords:g,relevance:0},{begin:f,returnBegin:!0,contains:[m],relevance:0},{begin:/::/,relevance:0},{begin:/:/,endsWithParent:!0,contains:[d,u]},{relevance:0,match:/,/},{className:"params",begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:[o,t.C_BLOCK_COMMENT_MODE,d,u,s,{begin:/\(/,end:/\)/,keywords:g,relevance:0,contains:["self",o,t.C_BLOCK_COMMENT_MODE,d,u,s]}]},s,o,t.C_BLOCK_COMMENT_MODE,p]};return{name:"C++",aliases:["cc","c++","h++","hpp","hh","hxx","cxx"],keywords:g,illegal:"</",classNameAliases:{"function.dispatch":"built_in"},contains:[].concat(R,D,C,E,[p,{begin:"\\b(deque|list|queue|priority_queue|pair|stack|vector|map|set|bitset|multiset|multimap|unordered_map|unordered_set|unordered_multiset|unordered_multimap|array|tuple|optional|variant|function|flat_map|flat_set)\\s*<(?!<)",end:">",keywords:g,contains:["self",s]},{begin:t.IDENT_RE+"::",keywords:g},{match:[/\b(?:enum(?:\s+(?:class|struct))?|class|struct|union)/,/\s+/,/\w+/],className:{1:"keyword",3:"title.class"}}])}}function Mm(t){const n=["bool","byte","char","decimal","delegate","double","dynamic","enum","float","int","long","nint","nuint","object","sbyte","short","string","ulong","uint","ushort"],o=["public","private","protected","static","internal","protected","abstract","async","extern","override","unsafe","virtual","new","sealed","partial"],r=["default","false","null","true"],a=["abstract","as","base","break","case","catch","class","const","continue","do","else","event","explicit","extern","finally","fixed","for","foreach","goto","if","implicit","in","interface","internal","is","lock","namespace","new","operator","out","override","params","private","protected","public","readonly","record","ref","return","scoped","sealed","sizeof","stackalloc","static","struct","switch","this","throw","try","typeof","unchecked","unsafe","using","virtual","void","volatile","while"],l=["add","alias","and","ascending","args","async","await","by","descending","dynamic","equals","file","from","get","global","group","init","into","join","let","nameof","not","notnull","on","or","orderby","partial","record","remove","required","scoped","select","set","unmanaged","value|0","var","when","where","with","yield"],i={keyword:a.concat(l),built_in:n,literal:r},s=t.inherit(t.TITLE_MODE,{begin:"[a-zA-Z](\\.?\\w)*"}),c={className:"number",variants:[{begin:"\\b(0b[01']+)"},{begin:"(-?)\\b([\\d']+(\\.[\\d']*)?|\\.[\\d']+)(u|U|l|L|ul|UL|f|F|b|B)"},{begin:"(-?)(\\b0[xX][a-fA-F0-9']+|(\\b[\\d']+(\\.[\\d']*)?|\\.[\\d']+)([eE][-+]?[\\d']+)?)"}],relevance:0},d={className:"string",begin:/"""("*)(?!")(.|\n)*?"""\1/,relevance:1},u={className:"string",begin:'@"',end:'"',contains:[{begin:'""'}]},p=t.inherit(u,{illegal:/\n/}),m={className:"subst",begin:/\{/,end:/\}/,keywords:i},f=t.inherit(m,{illegal:/\n/}),v={className:"string",begin:/\$"/,end:'"',illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},t.BACKSLASH_ESCAPE,f]},b={className:"string",begin:/\$@"/,end:'"',contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},m]},_=t.inherit(b,{illegal:/\n/,contains:[{begin:/\{\{/},{begin:/\}\}/},{begin:'""'},f]});m.contains=[b,v,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,c,t.C_BLOCK_COMMENT_MODE],f.contains=[_,v,p,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,c,t.inherit(t.C_BLOCK_COMMENT_MODE,{illegal:/\n/})];const h={variants:[d,b,v,u,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},w={begin:"<",end:">",contains:[{beginKeywords:"in out"},s]},y=t.IDENT_RE+"(<"+t.IDENT_RE+"(\\s*,\\s*"+t.IDENT_RE+")*>)?(\\[\\])?",g={begin:"@"+t.IDENT_RE,relevance:0};return{name:"C#",aliases:["cs","c#"],keywords:i,illegal:/::/,contains:[t.COMMENT("///","$",{returnBegin:!0,contains:[{className:"doctag",variants:[{begin:"///",relevance:0},{begin:"<!--|-->"},{begin:"</?",end:">"}]}]}),t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"meta",begin:"#",end:"$",keywords:{keyword:"if else elif endif define undef warning error line region endregion pragma checksum"}},h,c,{beginKeywords:"class interface",relevance:0,end:/[{;=]/,illegal:/[^\s:,]/,contains:[{beginKeywords:"where class"},s,w,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"namespace",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[s,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"record",relevance:0,end:/[{;=]/,illegal:/[^\s:]/,contains:[s,w,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"meta",begin:"^\\s*\\[(?=[\\w])",excludeBegin:!0,end:"\\]",excludeEnd:!0,contains:[{className:"string",begin:/"/,end:/"/}]},{beginKeywords:"new return throw await else",relevance:0},{className:"function",begin:"("+y+"\\s+)+"+t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,end:/\s*[{;=]/,excludeEnd:!0,keywords:i,contains:[{beginKeywords:o.join(" "),relevance:0},{begin:t.IDENT_RE+"\\s*(<[^=]+>\\s*)?\\(",returnBegin:!0,contains:[t.TITLE_MODE,w],relevance:0},{match:/\(\)/},{className:"params",begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:i,relevance:0,contains:[h,c,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},g]}}const Rm=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Im=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Dm=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],Lm=[...Im,...Dm],Vm=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),$m=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Pm=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Fm=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Um(t){const n=t.regex,o=Rm(t),r={begin:/-(webkit|moz|ms|o)-(?=[a-z])/},a="and or not only",l=/@-?\w[\w]*(-\w+)*/,i="[a-zA-Z-][a-zA-Z0-9_-]*",s=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE];return{name:"CSS",case_insensitive:!0,illegal:/[=|'\$]/,keywords:{keyframePosition:"from to"},classNameAliases:{keyframePosition:"selector-tag"},contains:[o.BLOCK_COMMENT,r,o.CSS_NUMBER_MODE,{className:"selector-id",begin:/#[A-Za-z0-9_-]+/,relevance:0},{className:"selector-class",begin:"\\."+i,relevance:0},o.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",variants:[{begin:":("+$m.join("|")+")"},{begin:":(:)?("+Pm.join("|")+")"}]},o.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Fm.join("|")+")\\b"},{begin:/:/,end:/[;}{]/,contains:[o.BLOCK_COMMENT,o.HEXCOLOR,o.IMPORTANT,o.CSS_NUMBER_MODE,...s,{begin:/(url|data-uri)\(/,end:/\)/,relevance:0,keywords:{built_in:"url data-uri"},contains:[...s,{className:"string",begin:/[^)]/,endsWithParent:!0,excludeEnd:!0}]},o.FUNCTION_DISPATCH]},{begin:n.lookahead(/@/),end:"[{;]",relevance:0,illegal:/:/,contains:[{className:"keyword",begin:l},{begin:/\s/,endsWithParent:!0,excludeEnd:!0,relevance:0,keywords:{$pattern:/[a-z-]+/,keyword:a,attribute:Vm.join(" ")},contains:[{begin:/[a-z-]+(?=:)/,className:"attribute"},...s,o.CSS_NUMBER_MODE]}]},{className:"selector-tag",begin:"\\b("+Lm.join("|")+")\\b"}]}}function zm(t){const n=t.regex;return{name:"Diff",aliases:["patch"],contains:[{className:"meta",relevance:10,match:n.either(/^@@ +-\d+,\d+ +\+\d+,\d+ +@@/,/^\*\*\* +\d+,\d+ +\*\*\*\*$/,/^--- +\d+,\d+ +----$/)},{className:"comment",variants:[{begin:n.either(/Index: /,/^index/,/={3,}/,/^-{3}/,/^\*{3} /,/^\+{3}/,/^diff --git/),end:/$/},{match:/^\*{15}$/}]},{className:"addition",begin:/^\+/,end:/$/},{className:"deletion",begin:/^-/,end:/$/},{className:"addition",begin:/^!/,end:/$/}]}}function Hm(t){const l={keyword:["break","case","chan","const","continue","default","defer","else","fallthrough","for","func","go","goto","if","import","interface","map","package","range","return","select","struct","switch","type","var"],type:["bool","byte","complex64","complex128","error","float32","float64","int8","int16","int32","int64","string","uint8","uint16","uint32","uint64","int","uint","uintptr","rune"],literal:["true","false","iota","nil"],built_in:["append","cap","close","complex","copy","imag","len","make","new","panic","print","println","real","recover","delete"]};return{name:"Go",aliases:["golang"],keywords:l,illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{className:"string",variants:[t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{begin:"`",end:"`"}]},{className:"number",variants:[{match:/-?\b0[xX]\.[a-fA-F0-9](_?[a-fA-F0-9])*[pP][+-]?\d(_?\d)*i?/,relevance:0},{match:/-?\b0[xX](_?[a-fA-F0-9])+((\.([a-fA-F0-9](_?[a-fA-F0-9])*)?)?[pP][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b0[oO](_?[0-7])*i?/,relevance:0},{match:/-?\.\d(_?\d)*([eE][+-]?\d(_?\d)*)?i?/,relevance:0},{match:/-?\b\d(_?\d)*(\.(\d(_?\d)*)?)?([eE][+-]?\d(_?\d)*)?i?/,relevance:0}]},{begin:/:=/},{className:"function",beginKeywords:"func",end:"\\s*(\\{|$)",excludeEnd:!0,contains:[t.TITLE_MODE,{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:l,illegal:/["']/}]}]}}function qm(t){const n=t.regex,o=/[_A-Za-z][_0-9A-Za-z]*/;return{name:"GraphQL",aliases:["gql"],case_insensitive:!0,disableAutodetect:!1,keywords:{keyword:["query","mutation","subscription","type","input","schema","directive","interface","union","scalar","fragment","enum","on"],literal:["true","false","null"]},contains:[t.HASH_COMMENT_MODE,t.QUOTE_STRING_MODE,t.NUMBER_MODE,{scope:"punctuation",match:/[.]{3}/,relevance:0},{scope:"punctuation",begin:/[\!\(\)\:\=\[\]\{\|\}]{1}/,relevance:0},{scope:"variable",begin:/\$/,end:/\W/,excludeEnd:!0,relevance:0},{scope:"meta",match:/@\w+/,excludeEnd:!0},{scope:"symbol",begin:n.concat(o,n.lookahead(/\s*:/)),relevance:0}],illegal:[/[;<']/,/BEGIN/]}}function Gm(t){const n=t.regex,o={className:"number",relevance:0,variants:[{begin:/([+-]+)?[\d]+_[\d_]+/},{begin:t.NUMBER_RE}]},r=t.COMMENT();r.variants=[{begin:/;/,end:/$/},{begin:/#/,end:/$/}];const a={className:"variable",variants:[{begin:/\$[\w\d"][\w\d_]*/},{begin:/\$\{(.*?)\}/}]},l={className:"literal",begin:/\bon|off|true|false|yes|no\b/},i={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:"'''",end:"'''",relevance:10},{begin:'"""',end:'"""',relevance:10},{begin:'"',end:'"'},{begin:"'",end:"'"}]},s={begin:/\[/,end:/\]/,contains:[r,l,a,i,o,"self"],relevance:0},c=/[A-Za-z0-9_-]+/,d=/"(\\"|[^"])*"/,u=/'[^']*'/,p=n.either(c,d,u),m=n.concat(p,"(\\s*\\.\\s*",p,")*",n.lookahead(/\s*=\s*[^#\s]/));return{name:"TOML, also INI",aliases:["toml"],case_insensitive:!0,illegal:/\S/,contains:[r,{className:"section",begin:/\[+/,end:/\]+/},{begin:m,className:"attr",starts:{end:/$/,contains:[r,s,l,a,i,o]}}]}}var rn="[0-9](_*[0-9])*",Gn=`\\.(${rn})`,Kn="[0-9a-fA-F](_*[0-9a-fA-F])*",ka={className:"number",variants:[{begin:`(\\b(${rn})((${Gn})|\\.)?|(${Gn}))[eE][+-]?(${rn})[fFdD]?\\b`},{begin:`\\b(${rn})((${Gn})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Gn})[fFdD]?\\b`},{begin:`\\b(${rn})[fFdD]\\b`},{begin:`\\b0[xX]((${Kn})\\.?|(${Kn})?\\.(${Kn}))[pP][+-]?(${rn})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${Kn})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function qi(t,n,o){return o===-1?"":t.replace(n,r=>qi(t,n,o-1))}function Km(t){const n=t.regex,o="[À-ʸa-zA-Z_$][À-ʸa-zA-Z_$0-9]*",r=o+qi("(?:<"+o+"~~~(?:\\s*,\\s*"+o+"~~~)*>)?",/~~~/g,2),c={keyword:["synchronized","abstract","private","var","static","if","const ","for","while","strictfp","finally","protected","import","native","final","void","enum","else","break","transient","catch","instanceof","volatile","case","assert","package","default","public","try","switch","continue","throws","protected","public","private","module","requires","exports","do","sealed","yield","permits","goto","when"],literal:["false","true","null"],type:["char","boolean","long","float","int","byte","short","double"],built_in:["super","this"]},d={className:"meta",begin:"@"+o,contains:[{begin:/\(/,end:/\)/,contains:["self"]}]},u={className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[t.C_BLOCK_COMMENT_MODE],endsParent:!0};return{name:"Java",aliases:["jsp"],keywords:c,illegal:/<\/|#/,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{begin:/\w+@/,relevance:0},{className:"doctag",begin:"@[A-Za-z]+"}]}),{begin:/import java\.[a-z]+\./,keywords:"import",relevance:2},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,{begin:/"""/,end:/"""/,className:"string",contains:[t.BACKSLASH_ESCAPE]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{match:[/\b(?:class|interface|enum|extends|implements|new)/,/\s+/,o],className:{1:"keyword",3:"title.class"}},{match:/non-sealed/,scope:"keyword"},{begin:[n.concat(/(?!else)/,o),/\s+/,o,/\s+/,/=(?!=)/],className:{1:"type",3:"variable",5:"operator"}},{begin:[/record/,/\s+/,o],className:{1:"keyword",3:"title.class"},contains:[u,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{beginKeywords:"new throw return else",relevance:0},{begin:["(?:"+r+"\\s+)",t.UNDERSCORE_IDENT_RE,/\s*(?=\()/],className:{2:"title.function"},keywords:c,contains:[{className:"params",begin:/\(/,end:/\)/,keywords:c,relevance:0,contains:[d,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,ka,t.C_BLOCK_COMMENT_MODE]},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},ka,d]}}const ya="[A-Za-z$_][0-9A-Za-z$_]*",Wm=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],jm=["true","false","null","undefined","NaN","Infinity"],Gi=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],Ki=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],Wi=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],Ym=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],Zm=[].concat(Wi,Gi,Ki);function Xm(t){const n=t.regex,o=(T,{after:X})=>{const ie="</"+T[0].slice(1);return T.input.indexOf(ie,X)!==-1},r=ya,a={begin:"<>",end:"</>"},l=/<[A-Za-z0-9\\._:-]+\s*\/>/,i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(T,X)=>{const ie=T[0].length+T.index,ge=T.input[ie];if(ge==="<"||ge===","){X.ignoreMatch();return}ge===">"&&(o(T,{after:ie})||X.ignoreMatch());let be;const Be=T.input.substring(ie);if(be=Be.match(/^\s*=/)){X.ignoreMatch();return}if((be=Be.match(/^\s+extends\s+/))&&be.index===0){X.ignoreMatch();return}}},s={$pattern:ya,keyword:Wm,literal:jm,built_in:Zm,"variable.language":Ym},c="[0-9](_?[0-9])*",d=`\\.(${c})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},v={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,m]},w={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},y=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,v,b,_,{match:/\$\d+/},p];m.contains=y.concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(y)});const g=[].concat(w,m.contains),C=g.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:["self"].concat(g)}]),E={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:C},R={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,n.concat(r,"(",n.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},D={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...Gi,...Ki]}},A={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},P={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[E],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function O(T){return n.concat("(?!",T.join("|"),")")}const M={match:n.concat(/\b/,O([...Wi,"super","import"].map(T=>`${T}\\s*\\(`)),r,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:n.concat(/\./,n.lookahead(n.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},E]},S="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",H={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(S)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[E]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:C,CLASS_REFERENCE:D},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),A,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,v,b,_,w,{match:/\$\d+/},p,D,{scope:"attr",match:r+n.lookahead(":"),relevance:0},H,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:S,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:C}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:l},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},P,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[E,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[E]},M,j,R,U,{match:/\$[(.]/}]}}function Qm(t){const n={className:"attr",begin:/"(\\.|[^\\"\r\n])*"(?=\s*:)/,relevance:1.01},o={match:/[{}[\],:]/,className:"punctuation",relevance:0},r=["true","false","null"],a={scope:"literal",beginKeywords:r.join(" ")};return{name:"JSON",aliases:["jsonc"],keywords:{literal:r},contains:[n,o,t.QUOTE_STRING_MODE,a,t.C_NUMBER_MODE,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE],illegal:"\\S"}}var an="[0-9](_*[0-9])*",Wn=`\\.(${an})`,jn="[0-9a-fA-F](_*[0-9a-fA-F])*",Jm={className:"number",variants:[{begin:`(\\b(${an})((${Wn})|\\.)?|(${Wn}))[eE][+-]?(${an})[fFdD]?\\b`},{begin:`\\b(${an})((${Wn})[fFdD]?\\b|\\.([fFdD]\\b)?)`},{begin:`(${Wn})[fFdD]?\\b`},{begin:`\\b(${an})[fFdD]\\b`},{begin:`\\b0[xX]((${jn})\\.?|(${jn})?\\.(${jn}))[pP][+-]?(${an})[fFdD]?\\b`},{begin:"\\b(0|[1-9](_*[0-9])*)[lL]?\\b"},{begin:`\\b0[xX](${jn})[lL]?\\b`},{begin:"\\b0(_*[0-7])*[lL]?\\b"},{begin:"\\b0[bB][01](_*[01])*[lL]?\\b"}],relevance:0};function eg(t){const n={keyword:"abstract as val var vararg get set class object open private protected public noinline crossinline dynamic final enum if else do while for when throw try catch finally import package is in fun override companion reified inline lateinit init interface annotation data sealed internal infix operator out by constructor super tailrec where const inner suspend typealias external expect actual",built_in:"Byte Short Char Int Long Boolean Float Double Void Unit Nothing",literal:"true false null"},o={className:"keyword",begin:/\b(break|continue|return|this)\b/,starts:{contains:[{className:"symbol",begin:/@\w+/}]}},r={className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"@"},a={className:"subst",begin:/\$\{/,end:/\}/,contains:[t.C_NUMBER_MODE]},l={className:"variable",begin:"\\$"+t.UNDERSCORE_IDENT_RE},i={className:"string",variants:[{begin:'"""',end:'"""(?=[^"])',contains:[l,a]},{begin:"'",end:"'",illegal:/\n/,contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"',illegal:/\n/,contains:[t.BACKSLASH_ESCAPE,l,a]}]};a.contains.push(i);const s={className:"meta",begin:"@(?:file|property|field|get|set|receiver|param|setparam|delegate)\\s*:(?:\\s*"+t.UNDERSCORE_IDENT_RE+")?"},c={className:"meta",begin:"@"+t.UNDERSCORE_IDENT_RE,contains:[{begin:/\(/,end:/\)/,contains:[t.inherit(i,{className:"string"}),"self"]}]},d=Jm,u=t.COMMENT("/\\*","\\*/",{contains:[t.C_BLOCK_COMMENT_MODE]}),p={variants:[{className:"type",begin:t.UNDERSCORE_IDENT_RE},{begin:/\(/,end:/\)/,contains:[]}]},m=p;return m.variants[1].contains=[p],p.variants[1].contains=[m],{name:"Kotlin",aliases:["kt","kts"],keywords:n,contains:[t.COMMENT("/\\*\\*","\\*/",{relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"}]}),t.C_LINE_COMMENT_MODE,u,o,r,s,c,{className:"function",beginKeywords:"fun",end:"[(]|$",returnBegin:!0,excludeEnd:!0,keywords:n,relevance:5,contains:[{begin:t.UNDERSCORE_IDENT_RE+"\\s*\\(",returnBegin:!0,relevance:0,contains:[t.UNDERSCORE_TITLE_MODE]},{className:"type",begin:/</,end:/>/,keywords:"reified",relevance:0},{className:"params",begin:/\(/,end:/\)/,endsParent:!0,keywords:n,relevance:0,contains:[{begin:/:/,end:/[=,\/]/,endsWithParent:!0,contains:[p,t.C_LINE_COMMENT_MODE,u],relevance:0},t.C_LINE_COMMENT_MODE,u,s,c,i,t.C_NUMBER_MODE]},u]},{begin:[/class|interface|trait/,/\s+/,t.UNDERSCORE_IDENT_RE],beginScope:{3:"title.class"},keywords:"class interface trait",end:/[:\{(]|$/,excludeEnd:!0,illegal:"extends implements",contains:[{beginKeywords:"public protected internal private constructor"},t.UNDERSCORE_TITLE_MODE,{className:"type",begin:/</,end:/>/,excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:/[,:]\s*/,end:/[<\(,){\s]|$/,excludeBegin:!0,returnEnd:!0},s,c]},i,{className:"meta",begin:"^#!/usr/bin/env",end:"$",illegal:`
|
|
60
|
-
`},d]}}const tg=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),ng=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],og=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],rg=[...ng,...og],ag=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),ji=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Yi=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),ig=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse(),lg=ji.concat(Yi).sort().reverse();function sg(t){const n=tg(t),o=lg,r="and or not only",a="[\\w-]+",l="("+a+"|@\\{"+a+"\\})",i=[],s=[],c=function(y){return{className:"string",begin:"~?"+y+".*?"+y}},d=function(y,g,C){return{className:y,begin:g,relevance:C}},u={$pattern:/[a-z-]+/,keyword:r,attribute:ag.join(" ")},p={begin:"\\(",end:"\\)",contains:s,keywords:u,relevance:0};s.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,c("'"),c('"'),n.CSS_NUMBER_MODE,{begin:"(url|data-uri)\\(",starts:{className:"string",end:"[\\)\\n]",excludeEnd:!0}},n.HEXCOLOR,p,d("variable","@@?"+a,10),d("variable","@\\{"+a+"\\}"),d("built_in","~?`[^`]*?`"),{className:"attribute",begin:a+"\\s*:",end:":",returnBegin:!0,excludeEnd:!0},n.IMPORTANT,{beginKeywords:"and not"},n.FUNCTION_DISPATCH);const m=s.concat({begin:/\{/,end:/\}/,contains:i}),f={beginKeywords:"when",endsWithParent:!0,contains:[{beginKeywords:"and not"}].concat(s)},v={begin:l+"\\s*:",returnBegin:!0,end:/[;}]/,relevance:0,contains:[{begin:/-(webkit|moz|ms|o)-/},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+ig.join("|")+")\\b",end:/(?=:)/,starts:{endsWithParent:!0,illegal:"[<=$]",relevance:0,contains:s}}]},b={className:"keyword",begin:"@(import|media|charset|font-face|(-[a-z]+-)?keyframes|supports|document|namespace|page|viewport|host)\\b",starts:{end:"[;{}]",keywords:u,returnEnd:!0,contains:s,relevance:0}},_={className:"variable",variants:[{begin:"@"+a+"\\s*:",relevance:15},{begin:"@"+a}],starts:{end:"[;}]",returnEnd:!0,contains:m}},h={variants:[{begin:"[\\.#:&\\[>]",end:"[;{}]"},{begin:l,end:/\{/}],returnBegin:!0,returnEnd:!0,illegal:`[<='$"]`,relevance:0,contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,f,d("keyword","all\\b"),d("variable","@\\{"+a+"\\}"),{begin:"\\b("+rg.join("|")+")\\b",className:"selector-tag"},n.CSS_NUMBER_MODE,d("selector-tag",l,0),d("selector-id","#"+l),d("selector-class","\\."+l,0),d("selector-tag","&",0),n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-pseudo",begin:":("+ji.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+Yi.join("|")+")"},{begin:/\(/,end:/\)/,relevance:0,contains:m},{begin:"!important"},n.FUNCTION_DISPATCH]},w={begin:a+`:(:)?(${o.join("|")})`,returnBegin:!0,contains:[h]};return i.push(t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,b,_,w,v,h,f,n.FUNCTION_DISPATCH),{name:"Less",case_insensitive:!0,illegal:`[=>'/<($"]`,contains:i}}function cg(t){const n="\\[=*\\[",o="\\]=*\\]",r={begin:n,end:o,contains:["self"]},a=[t.COMMENT("--(?!"+n+")","$"),t.COMMENT("--"+n,o,{contains:[r],relevance:10})];return{name:"Lua",aliases:["pluto"],keywords:{$pattern:t.UNDERSCORE_IDENT_RE,literal:"true false nil",keyword:"and break do else elseif end for goto if in local not or repeat return then until while",built_in:"_G _ENV _VERSION __index __newindex __mode __call __metatable __tostring __len __gc __add __sub __mul __div __mod __pow __concat __unm __eq __lt __le assert collectgarbage dofile error getfenv getmetatable ipairs load loadfile loadstring module next pairs pcall print rawequal rawget rawset require select setfenv setmetatable tonumber tostring type unpack xpcall arg self coroutine resume yield status wrap create running debug getupvalue debug sethook getmetatable gethook setmetatable setlocal traceback setfenv getinfo setupvalue getlocal getregistry getfenv io lines write close flush open output type read stderr stdin input stdout popen tmpfile math log max acos huge ldexp pi cos tanh pow deg tan cosh sinh random randomseed frexp ceil floor rad abs sqrt modf asin min mod fmod log10 atan2 exp sin atan os exit setlocale date getenv difftime remove time clock tmpname rename execute package preload loadlib loaded loaders cpath config path seeall string sub upper len gfind rep find match char dump gmatch reverse byte format gsub lower table setn insert getn foreachi maxn foreach concat sort remove"},contains:a.concat([{className:"function",beginKeywords:"function",end:"\\)",contains:[t.inherit(t.TITLE_MODE,{begin:"([_a-zA-Z]\\w*\\.)*([_a-zA-Z]\\w*:)?[_a-zA-Z]\\w*"}),{className:"params",begin:"\\(",endsWithParent:!0,contains:a}].concat(a)},t.C_NUMBER_MODE,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,{className:"string",begin:n,end:o,contains:[r],relevance:5}])}}function ug(t){const n={className:"variable",variants:[{begin:"\\$\\("+t.UNDERSCORE_IDENT_RE+"\\)",contains:[t.BACKSLASH_ESCAPE]},{begin:/\$[@%<?\^\+\*]/}]},o={className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,n]},r={className:"variable",begin:/\$\([\w-]+\s/,end:/\)/,keywords:{built_in:"subst patsubst strip findstring filter filter-out sort word wordlist firstword lastword dir notdir suffix basename addsuffix addprefix join wildcard realpath abspath error warning shell origin flavor foreach if or and call eval file value"},contains:[n,o]},a={begin:"^"+t.UNDERSCORE_IDENT_RE+"\\s*(?=[:+?]?=)"},l={className:"meta",begin:/^\.PHONY:/,end:/$/,keywords:{$pattern:/[\.\w]+/,keyword:".PHONY"}},i={className:"section",begin:/^[^\s]+:/,end:/$/,contains:[n]};return{name:"Makefile",aliases:["mk","mak","make"],keywords:{$pattern:/[\w-]+/,keyword:"define endef undefine ifdef ifndef ifeq ifneq else endif include -include sinclude override export unexport private vpath"},contains:[t.HASH_COMMENT_MODE,n,o,r,a,l,i]}}function dg(t){const n=t.regex,o={begin:/<\/?[A-Za-z_]/,end:">",subLanguage:"xml",relevance:0},r={begin:"^[-\\*]{3,}",end:"$"},a={className:"code",variants:[{begin:"(`{3,})[^`](.|\\n)*?\\1`*[ ]*"},{begin:"(~{3,})[^~](.|\\n)*?\\1~*[ ]*"},{begin:"```",end:"```+[ ]*$"},{begin:"~~~",end:"~~~+[ ]*$"},{begin:"`.+?`"},{begin:"(?=^( {4}|\\t))",contains:[{begin:"^( {4}|\\t)",end:"(\\n)$"}],relevance:0}]},l={className:"bullet",begin:"^[ ]*([*+-]|(\\d+\\.))(?=\\s+)",end:"\\s+",excludeEnd:!0},i={begin:/^\[[^\n]+\]:/,returnBegin:!0,contains:[{className:"symbol",begin:/\[/,end:/\]/,excludeBegin:!0,excludeEnd:!0},{className:"link",begin:/:\s*/,end:/$/,excludeBegin:!0}]},s=/[A-Za-z][A-Za-z0-9+.-]*/,c={variants:[{begin:/\[.+?\]\[.*?\]/,relevance:0},{begin:/\[.+?\]\(((data|javascript|mailto):|(?:http|ftp)s?:\/\/).*?\)/,relevance:2},{begin:n.concat(/\[.+?\]\(/,s,/:\/\/.*?\)/),relevance:2},{begin:/\[.+?\]\([./?&#].*?\)/,relevance:1},{begin:/\[.*?\]\(.*?\)/,relevance:0}],returnBegin:!0,contains:[{match:/\[(?=\])/},{className:"string",relevance:0,begin:"\\[",end:"\\]",excludeBegin:!0,returnEnd:!0},{className:"link",relevance:0,begin:"\\]\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0},{className:"symbol",relevance:0,begin:"\\]\\[",end:"\\]",excludeBegin:!0,excludeEnd:!0}]},d={className:"strong",contains:[],variants:[{begin:/_{2}(?!\s)/,end:/_{2}/},{begin:/\*{2}(?!\s)/,end:/\*{2}/}]},u={className:"emphasis",contains:[],variants:[{begin:/\*(?![*\s])/,end:/\*/},{begin:/_(?![_\s])/,end:/_/,relevance:0}]},p=t.inherit(d,{contains:[]}),m=t.inherit(u,{contains:[]});d.contains.push(m),u.contains.push(p);let f=[o,c];return[d,u,p,m].forEach(h=>{h.contains=h.contains.concat(f)}),f=f.concat(d,u),{name:"Markdown",aliases:["md","mkdown","mkd"],contains:[{className:"section",variants:[{begin:"^#{1,6}",end:"$",contains:f},{begin:"(?=^.+?\\n[=-]{2,}$)",contains:[{begin:"^[=-]*$"},{begin:"^",end:"\\n",contains:f}]}]},o,l,d,u,{className:"quote",begin:"^>\\s+",contains:f,end:"$"},a,r,c,i,{scope:"literal",match:/&([a-zA-Z0-9]+|#[0-9]{1,7}|#[Xx][0-9a-fA-F]{1,6});/}]}}function pg(t){const n={className:"built_in",begin:"\\b(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)\\w+"},o=/[a-zA-Z@][a-zA-Z0-9_]*/,s={"variable.language":["this","super"],$pattern:o,keyword:["while","export","sizeof","typedef","const","struct","for","union","volatile","static","mutable","if","do","return","goto","enum","else","break","extern","asm","case","default","register","explicit","typename","switch","continue","inline","readonly","assign","readwrite","self","@synchronized","id","typeof","nonatomic","IBOutlet","IBAction","strong","weak","copy","in","out","inout","bycopy","byref","oneway","__strong","__weak","__block","__autoreleasing","@private","@protected","@public","@try","@property","@end","@throw","@catch","@finally","@autoreleasepool","@synthesize","@dynamic","@selector","@optional","@required","@encode","@package","@import","@defs","@compatibility_alias","__bridge","__bridge_transfer","__bridge_retained","__bridge_retain","__covariant","__contravariant","__kindof","_Nonnull","_Nullable","_Null_unspecified","__FUNCTION__","__PRETTY_FUNCTION__","__attribute__","getter","setter","retain","unsafe_unretained","nonnull","nullable","null_unspecified","null_resettable","class","instancetype","NS_DESIGNATED_INITIALIZER","NS_UNAVAILABLE","NS_REQUIRES_SUPER","NS_RETURNS_INNER_POINTER","NS_INLINE","NS_AVAILABLE","NS_DEPRECATED","NS_ENUM","NS_OPTIONS","NS_SWIFT_UNAVAILABLE","NS_ASSUME_NONNULL_BEGIN","NS_ASSUME_NONNULL_END","NS_REFINED_FOR_SWIFT","NS_SWIFT_NAME","NS_SWIFT_NOTHROW","NS_DURING","NS_HANDLER","NS_ENDHANDLER","NS_VALUERETURN","NS_VOIDRETURN"],literal:["false","true","FALSE","TRUE","nil","YES","NO","NULL"],built_in:["dispatch_once_t","dispatch_queue_t","dispatch_sync","dispatch_async","dispatch_once"],type:["int","float","char","unsigned","signed","short","long","double","wchar_t","unichar","void","bool","BOOL","id|0","_Bool"]},c={$pattern:o,keyword:["@interface","@class","@protocol","@implementation"]};return{name:"Objective-C",aliases:["mm","objc","obj-c","obj-c++","objective-c++"],keywords:s,illegal:"</",contains:[n,t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,t.C_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,{className:"string",variants:[{begin:'@"',end:'"',illegal:"\\n",contains:[t.BACKSLASH_ESCAPE]}]},{className:"meta",begin:/#\s*[a-z]+\b/,end:/$/,keywords:{keyword:"if else elif endif define undef warning error line pragma ifdef ifndef include"},contains:[{begin:/\\\n/,relevance:0},t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),{className:"string",begin:/<.*?>/,end:/$/,illegal:"\\n"},t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE]},{className:"class",begin:"("+c.keyword.join("|")+")\\b",end:/(\{|$)/,excludeEnd:!0,keywords:c,contains:[t.UNDERSCORE_TITLE_MODE]},{begin:"\\."+t.UNDERSCORE_IDENT_RE,relevance:0}]}}function fg(t){const n=t.regex,o=["abs","accept","alarm","and","atan2","bind","binmode","bless","break","caller","chdir","chmod","chomp","chop","chown","chr","chroot","class","close","closedir","connect","continue","cos","crypt","dbmclose","dbmopen","defined","delete","die","do","dump","each","else","elsif","endgrent","endhostent","endnetent","endprotoent","endpwent","endservent","eof","eval","exec","exists","exit","exp","fcntl","field","fileno","flock","for","foreach","fork","format","formline","getc","getgrent","getgrgid","getgrnam","gethostbyaddr","gethostbyname","gethostent","getlogin","getnetbyaddr","getnetbyname","getnetent","getpeername","getpgrp","getpriority","getprotobyname","getprotobynumber","getprotoent","getpwent","getpwnam","getpwuid","getservbyname","getservbyport","getservent","getsockname","getsockopt","given","glob","gmtime","goto","grep","gt","hex","if","index","int","ioctl","join","keys","kill","last","lc","lcfirst","length","link","listen","local","localtime","log","lstat","lt","ma","map","method","mkdir","msgctl","msgget","msgrcv","msgsnd","my","ne","next","no","not","oct","open","opendir","or","ord","our","pack","package","pipe","pop","pos","print","printf","prototype","push","q|0","qq","quotemeta","qw","qx","rand","read","readdir","readline","readlink","readpipe","recv","redo","ref","rename","require","reset","return","reverse","rewinddir","rindex","rmdir","say","scalar","seek","seekdir","select","semctl","semget","semop","send","setgrent","sethostent","setnetent","setpgrp","setpriority","setprotoent","setpwent","setservent","setsockopt","shift","shmctl","shmget","shmread","shmwrite","shutdown","sin","sleep","socket","socketpair","sort","splice","split","sprintf","sqrt","srand","stat","state","study","sub","substr","symlink","syscall","sysopen","sysread","sysseek","system","syswrite","tell","telldir","tie","tied","time","times","tr","truncate","uc","ucfirst","umask","undef","unless","unlink","unpack","unshift","untie","until","use","utime","values","vec","wait","waitpid","wantarray","warn","when","while","write","x|0","xor","y|0"],r=/[dualxmsipngr]{0,12}/,a={$pattern:/[\w.]+/,keyword:o.join(" ")},l={className:"subst",begin:"[$@]\\{",end:"\\}",keywords:a},i={begin:/->\{/,end:/\}/},s={scope:"attr",match:/\s+:\s*\w+(\s*\(.*?\))?/},c={scope:"variable",variants:[{begin:/\$\d/},{begin:n.concat(/[$%@](?!")(\^\w\b|#\w+(::\w+)*|\{\w+\}|\w+(::\w*)*)/,"(?![A-Za-z])(?![@$%])")},{begin:/[$%@](?!")[^\s\w{=]|\$=/,relevance:0}],contains:[s]},d={className:"number",variants:[{match:/0?\.[0-9][0-9_]+\b/},{match:/\bv?(0|[1-9][0-9_]*(\.[0-9_]+)?|[1-9][0-9_]*)\b/},{match:/\b0[0-7][0-7_]*\b/},{match:/\b0x[0-9a-fA-F][0-9a-fA-F_]*\b/},{match:/\b0b[0-1][0-1_]*\b/}],relevance:0},u=[t.BACKSLASH_ESCAPE,l,c],p=[/!/,/\//,/\|/,/\?/,/'/,/"/,/#/],m=(b,_,h="\\1")=>{const w=h==="\\1"?h:n.concat(h,_);return n.concat(n.concat("(?:",b,")"),_,/(?:\\.|[^\\\/])*?/,w,/(?:\\.|[^\\\/])*?/,h,r)},f=(b,_,h)=>n.concat(n.concat("(?:",b,")"),_,/(?:\\.|[^\\\/])*?/,h,r),v=[c,t.HASH_COMMENT_MODE,t.COMMENT(/^=\w/,/=cut/,{endsWithParent:!0}),i,{className:"string",contains:u,variants:[{begin:"q[qwxr]?\\s*\\(",end:"\\)",relevance:5},{begin:"q[qwxr]?\\s*\\[",end:"\\]",relevance:5},{begin:"q[qwxr]?\\s*\\{",end:"\\}",relevance:5},{begin:"q[qwxr]?\\s*\\|",end:"\\|",relevance:5},{begin:"q[qwxr]?\\s*<",end:">",relevance:5},{begin:"qw\\s+q",end:"q",relevance:5},{begin:"'",end:"'",contains:[t.BACKSLASH_ESCAPE]},{begin:'"',end:'"'},{begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE]},{begin:/\{\w+\}/,relevance:0},{begin:"-?\\w+\\s*=>",relevance:0}]},d,{begin:"(\\/\\/|"+t.RE_STARTERS_RE+"|\\b(split|return|print|reverse|grep)\\b)\\s*",keywords:"split return print reverse grep",relevance:0,contains:[t.HASH_COMMENT_MODE,{className:"regexp",variants:[{begin:m("s|tr|y",n.either(...p,{capture:!0}))},{begin:m("s|tr|y","\\(","\\)")},{begin:m("s|tr|y","\\[","\\]")},{begin:m("s|tr|y","\\{","\\}")}],relevance:2},{className:"regexp",variants:[{begin:/(m|qr)\/\//,relevance:0},{begin:f("(?:m|qr)?",/\//,/\//)},{begin:f("m|qr",n.either(...p,{capture:!0}),/\1/)},{begin:f("m|qr",/\(/,/\)/)},{begin:f("m|qr",/\[/,/\]/)},{begin:f("m|qr",/\{/,/\}/)}]}]},{className:"function",beginKeywords:"sub method",end:"(\\s*\\(.*?\\))?[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,s]},{className:"class",beginKeywords:"class",end:"[;{]",excludeEnd:!0,relevance:5,contains:[t.TITLE_MODE,s,d]},{begin:"-\\w\\b",relevance:0},{begin:"^__DATA__$",end:"^__END__$",subLanguage:"mojolicious",contains:[{begin:"^@@.*",end:"$",className:"comment"}]}];return l.contains=v,i.contains=v,{name:"Perl",aliases:["pl","pm"],keywords:a,contains:v}}function mg(t){const n=t.regex,o=/(?![A-Za-z0-9])(?![$])/,r=n.concat(/[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*/,o),a=n.concat(/(\\?[A-Z][a-z0-9_\x7f-\xff]+|\\?[A-Z]+(?=[A-Z][a-z0-9_\x7f-\xff])){1,}/,o),l=n.concat(/[A-Z]+/,o),i={scope:"variable",match:"\\$+"+r},s={scope:"meta",variants:[{begin:/<\?php/,relevance:10},{begin:/<\?=/},{begin:/<\?/,relevance:.1},{begin:/\?>/}]},c={scope:"subst",variants:[{begin:/\$\w+/},{begin:/\{\$/,end:/\}/}]},d=t.inherit(t.APOS_STRING_MODE,{illegal:null}),u=t.inherit(t.QUOTE_STRING_MODE,{illegal:null,contains:t.QUOTE_STRING_MODE.contains.concat(c)}),p={begin:/<<<[ \t]*(?:(\w+)|"(\w+)")\n/,end:/[ \t]*(\w+)\b/,contains:t.QUOTE_STRING_MODE.contains.concat(c),"on:begin":(L,U)=>{U.data._beginMatch=L[1]||L[2]},"on:end":(L,U)=>{U.data._beginMatch!==L[1]&&U.ignoreMatch()}},m=t.END_SAME_AS_BEGIN({begin:/<<<[ \t]*'(\w+)'\n/,end:/[ \t]*(\w+)\b/}),f=`[
|
|
61
|
-
]`,v={scope:"string",variants:[u,d,p,m]},b={scope:"number",variants:[{begin:"\\b0[bB][01]+(?:_[01]+)*\\b"},{begin:"\\b0[oO][0-7]+(?:_[0-7]+)*\\b"},{begin:"\\b0[xX][\\da-fA-F]+(?:_[\\da-fA-F]+)*\\b"},{begin:"(?:\\b\\d+(?:_\\d+)*(\\.(?:\\d+(?:_\\d+)*))?|\\B\\.\\d+)(?:[eE][+-]?\\d+)?"}],relevance:0},_=["false","null","true"],h=["__CLASS__","__DIR__","__FILE__","__FUNCTION__","__COMPILER_HALT_OFFSET__","__LINE__","__METHOD__","__NAMESPACE__","__TRAIT__","die","echo","exit","include","include_once","print","require","require_once","array","abstract","and","as","binary","bool","boolean","break","callable","case","catch","class","clone","const","continue","declare","default","do","double","else","elseif","empty","enddeclare","endfor","endforeach","endif","endswitch","endwhile","enum","eval","extends","final","finally","float","for","foreach","from","global","goto","if","implements","instanceof","insteadof","int","integer","interface","isset","iterable","list","match|0","mixed","new","never","object","or","private","protected","public","readonly","real","return","string","switch","throw","trait","try","unset","use","var","void","while","xor","yield"],w=["Error|0","AppendIterator","ArgumentCountError","ArithmeticError","ArrayIterator","ArrayObject","AssertionError","BadFunctionCallException","BadMethodCallException","CachingIterator","CallbackFilterIterator","CompileError","Countable","DirectoryIterator","DivisionByZeroError","DomainException","EmptyIterator","ErrorException","Exception","FilesystemIterator","FilterIterator","GlobIterator","InfiniteIterator","InvalidArgumentException","IteratorIterator","LengthException","LimitIterator","LogicException","MultipleIterator","NoRewindIterator","OutOfBoundsException","OutOfRangeException","OuterIterator","OverflowException","ParentIterator","ParseError","RangeException","RecursiveArrayIterator","RecursiveCachingIterator","RecursiveCallbackFilterIterator","RecursiveDirectoryIterator","RecursiveFilterIterator","RecursiveIterator","RecursiveIteratorIterator","RecursiveRegexIterator","RecursiveTreeIterator","RegexIterator","RuntimeException","SeekableIterator","SplDoublyLinkedList","SplFileInfo","SplFileObject","SplFixedArray","SplHeap","SplMaxHeap","SplMinHeap","SplObjectStorage","SplObserver","SplPriorityQueue","SplQueue","SplStack","SplSubject","SplTempFileObject","TypeError","UnderflowException","UnexpectedValueException","UnhandledMatchError","ArrayAccess","BackedEnum","Closure","Fiber","Generator","Iterator","IteratorAggregate","Serializable","Stringable","Throwable","Traversable","UnitEnum","WeakReference","WeakMap","Directory","__PHP_Incomplete_Class","parent","php_user_filter","self","static","stdClass"],g={keyword:h,literal:(L=>{const U=[];return L.forEach(S=>{U.push(S),S.toLowerCase()===S?U.push(S.toUpperCase()):U.push(S.toLowerCase())}),U})(_),built_in:w},C=L=>L.map(U=>U.replace(/\|\d+$/,"")),E={variants:[{match:[/new/,n.concat(f,"+"),n.concat("(?!",C(w).join("\\b|"),"\\b)"),a],scope:{1:"keyword",4:"title.class"}}]},R=n.concat(r,"\\b(?!\\()"),D={variants:[{match:[n.concat(/::/,n.lookahead(/(?!class\b)/)),R],scope:{2:"variable.constant"}},{match:[/::/,/class/],scope:{2:"variable.language"}},{match:[a,n.concat(/::/,n.lookahead(/(?!class\b)/)),R],scope:{1:"title.class",3:"variable.constant"}},{match:[a,n.concat("::",n.lookahead(/(?!class\b)/))],scope:{1:"title.class"}},{match:[a,/::/,/class/],scope:{1:"title.class",3:"variable.language"}}]},A={scope:"attr",match:n.concat(r,n.lookahead(":"),n.lookahead(/(?!::)/))},P={relevance:0,begin:/\(/,end:/\)/,keywords:g,contains:[A,i,D,t.C_BLOCK_COMMENT_MODE,v,b,E]},j={relevance:0,match:[/\b/,n.concat("(?!fn\\b|function\\b|",C(h).join("\\b|"),"|",C(w).join("\\b|"),"\\b)"),r,n.concat(f,"*"),n.lookahead(/(?=\()/)],scope:{3:"title.function.invoke"},contains:[P]};P.contains.push(j);const O=[A,D,t.C_BLOCK_COMMENT_MODE,v,b,E],M={begin:n.concat(/#\[\s*\\?/,n.either(a,l)),beginScope:"meta",end:/]/,endScope:"meta",keywords:{literal:_,keyword:["new","array"]},contains:[{begin:/\[/,end:/]/,keywords:{literal:_,keyword:["new","array"]},contains:["self",...O]},...O,{scope:"meta",variants:[{match:a},{match:l}]}]};return{case_insensitive:!1,keywords:g,contains:[M,t.HASH_COMMENT_MODE,t.COMMENT("//","$"),t.COMMENT("/\\*","\\*/",{contains:[{scope:"doctag",match:"@[A-Za-z]+"}]}),{match:/__halt_compiler\(\);/,keywords:"__halt_compiler",starts:{scope:"comment",end:t.MATCH_NOTHING_RE,contains:[{match:/\?>/,scope:"meta",endsParent:!0}]}},s,{scope:"variable.language",match:/\$this\b/},i,j,D,{match:[/const/,/\s/,r],scope:{1:"keyword",3:"variable.constant"}},E,{scope:"function",relevance:0,beginKeywords:"fn function",end:/[;{]/,excludeEnd:!0,illegal:"[$%\\[]",contains:[{beginKeywords:"use"},t.UNDERSCORE_TITLE_MODE,{begin:"=>",endsParent:!0},{scope:"params",begin:"\\(",end:"\\)",excludeBegin:!0,excludeEnd:!0,keywords:g,contains:["self",M,i,D,t.C_BLOCK_COMMENT_MODE,v,b]}]},{scope:"class",variants:[{beginKeywords:"enum",illegal:/[($"]/},{beginKeywords:"class interface trait",illegal:/[:($"]/}],relevance:0,end:/\{/,excludeEnd:!0,contains:[{beginKeywords:"extends implements"},t.UNDERSCORE_TITLE_MODE]},{beginKeywords:"namespace",relevance:0,end:";",illegal:/[.']/,contains:[t.inherit(t.UNDERSCORE_TITLE_MODE,{scope:"title.class"})]},{beginKeywords:"use",relevance:0,end:";",contains:[{match:/\b(as|const|function)\b/,scope:"keyword"},t.UNDERSCORE_TITLE_MODE]},v,b]}}function gg(t){return{name:"PHP template",subLanguage:"xml",contains:[{begin:/<\?(php|=)?/,end:/\?>/,subLanguage:"php",contains:[{begin:"/\\*",end:"\\*/",skip:!0},{begin:'b"',end:'"',skip:!0},{begin:"b'",end:"'",skip:!0},t.inherit(t.APOS_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0}),t.inherit(t.QUOTE_STRING_MODE,{illegal:null,className:null,contains:null,skip:!0})]}]}}function bg(t){return{name:"Plain text",aliases:["text","txt"],disableAutodetect:!0}}function vg(t){const n=t.regex,o=new RegExp("[\\p{XID_Start}_]\\p{XID_Continue}*","u"),r=["and","as","assert","async","await","break","case","class","continue","def","del","elif","else","except","finally","for","from","global","if","import","in","is","lambda","match","nonlocal|10","not","or","pass","raise","return","try","while","with","yield"],s={$pattern:/[A-Za-z]\w+|__\w+__/,keyword:r,built_in:["__import__","abs","all","any","ascii","bin","bool","breakpoint","bytearray","bytes","callable","chr","classmethod","compile","complex","delattr","dict","dir","divmod","enumerate","eval","exec","filter","float","format","frozenset","getattr","globals","hasattr","hash","help","hex","id","input","int","isinstance","issubclass","iter","len","list","locals","map","max","memoryview","min","next","object","oct","open","ord","pow","print","property","range","repr","reversed","round","set","setattr","slice","sorted","staticmethod","str","sum","super","tuple","type","vars","zip"],literal:["__debug__","Ellipsis","False","None","NotImplemented","True"],type:["Any","Callable","Coroutine","Dict","List","Literal","Generic","Optional","Sequence","Set","Tuple","Type","Union"]},c={className:"meta",begin:/^(>>>|\.\.\.) /},d={className:"subst",begin:/\{/,end:/\}/,keywords:s,illegal:/#/},u={begin:/\{\{/,relevance:0},p={className:"string",contains:[t.BACKSLASH_ESCAPE],variants:[{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([uU]|[bB]|[rR]|[bB][rR]|[rR][bB])?"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c],relevance:10},{begin:/([fF][rR]|[rR][fF]|[fF])'''/,end:/'''/,contains:[t.BACKSLASH_ESCAPE,c,u,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"""/,end:/"""/,contains:[t.BACKSLASH_ESCAPE,c,u,d]},{begin:/([uU]|[rR])'/,end:/'/,relevance:10},{begin:/([uU]|[rR])"/,end:/"/,relevance:10},{begin:/([bB]|[bB][rR]|[rR][bB])'/,end:/'/},{begin:/([bB]|[bB][rR]|[rR][bB])"/,end:/"/},{begin:/([fF][rR]|[rR][fF]|[fF])'/,end:/'/,contains:[t.BACKSLASH_ESCAPE,u,d]},{begin:/([fF][rR]|[rR][fF]|[fF])"/,end:/"/,contains:[t.BACKSLASH_ESCAPE,u,d]},t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},m="[0-9](_?[0-9])*",f=`(\\b(${m}))?\\.(${m})|\\b(${m})\\.`,v=`\\b|${r.join("|")}`,b={className:"number",relevance:0,variants:[{begin:`(\\b(${m})|(${f}))[eE][+-]?(${m})[jJ]?(?=${v})`},{begin:`(${f})[jJ]?`},{begin:`\\b([1-9](_?[0-9])*|0+(_?0)*)[lLjJ]?(?=${v})`},{begin:`\\b0[bB](_?[01])+[lL]?(?=${v})`},{begin:`\\b0[oO](_?[0-7])+[lL]?(?=${v})`},{begin:`\\b0[xX](_?[0-9a-fA-F])+[lL]?(?=${v})`},{begin:`\\b(${m})[jJ](?=${v})`}]},_={className:"comment",begin:n.lookahead(/# type:/),end:/$/,keywords:s,contains:[{begin:/# type:/},{begin:/#/,end:/\b\B/,endsWithParent:!0}]},h={className:"params",variants:[{className:"",begin:/\(\s*\)/,skip:!0},{begin:/\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:["self",c,b,p,t.HASH_COMMENT_MODE]}]};return d.contains=[p,b,c],{name:"Python",aliases:["py","gyp","ipython"],unicodeRegex:!0,keywords:s,illegal:/(<\/|\?)|=>/,contains:[c,b,{scope:"variable.language",match:/\bself\b/},{beginKeywords:"if",relevance:0},{match:/\bor\b/,scope:"keyword"},p,_,t.HASH_COMMENT_MODE,{match:[/\bdef/,/\s+/,o],scope:{1:"keyword",3:"title.function"},contains:[h]},{variants:[{match:[/\bclass/,/\s+/,o,/\s*/,/\(\s*/,o,/\s*\)/]},{match:[/\bclass/,/\s+/,o]}],scope:{1:"keyword",3:"title.class",6:"title.class.inherited"}},{className:"meta",begin:/^[\t ]*@/,end:/(?=#)|$/,contains:[b,h,p]}]}}function hg(t){return{aliases:["pycon"],contains:[{className:"meta.prompt",starts:{end:/ |$/,starts:{end:"$",subLanguage:"python"}},variants:[{begin:/^>>>(?=[ ]|$)/},{begin:/^\.\.\.(?=[ ]|$)/}]}]}}function _g(t){const n=t.regex,o=/(?:(?:[a-zA-Z]|\.[._a-zA-Z])[._a-zA-Z0-9]*)|\.(?!\d)/,r=n.either(/0[xX][0-9a-fA-F]+\.[0-9a-fA-F]*[pP][+-]?\d+i?/,/0[xX][0-9a-fA-F]+(?:[pP][+-]?\d+)?[Li]?/,/(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?[Li]?/),a=/[=!<>:]=|\|\||&&|:::?|<-|<<-|->>|->|\|>|[-+*\/?!$&|:<=>@^~]|\*\*/,l=n.either(/[()]/,/[{}]/,/\[\[/,/[[\]]/,/\\/,/,/);return{name:"R",keywords:{$pattern:o,keyword:"function if in break next repeat else for while",literal:"NULL NA TRUE FALSE Inf NaN NA_integer_|10 NA_real_|10 NA_character_|10 NA_complex_|10",built_in:"LETTERS letters month.abb month.name pi T F abs acos acosh all any anyNA Arg as.call as.character as.complex as.double as.environment as.integer as.logical as.null.default as.numeric as.raw asin asinh atan atanh attr attributes baseenv browser c call ceiling class Conj cos cosh cospi cummax cummin cumprod cumsum digamma dim dimnames emptyenv exp expression floor forceAndCall gamma gc.time globalenv Im interactive invisible is.array is.atomic is.call is.character is.complex is.double is.environment is.expression is.finite is.function is.infinite is.integer is.language is.list is.logical is.matrix is.na is.name is.nan is.null is.numeric is.object is.pairlist is.raw is.recursive is.single is.symbol lazyLoadDBfetch length lgamma list log max min missing Mod names nargs nzchar oldClass on.exit pos.to.env proc.time prod quote range Re rep retracemem return round seq_along seq_len seq.int sign signif sin sinh sinpi sqrt standardGeneric substitute sum switch tan tanh tanpi tracemem trigamma trunc unclass untracemem UseMethod xtfrm"},contains:[t.COMMENT(/#'/,/$/,{contains:[{scope:"doctag",match:/@examples/,starts:{end:n.lookahead(n.either(/\n^#'\s*(?=@[a-zA-Z]+)/,/\n^(?!#')/)),endsParent:!0}},{scope:"doctag",begin:"@param",end:/$/,contains:[{scope:"variable",variants:[{match:o},{match:/`(?:\\.|[^`\\])+`/}],endsParent:!0}]},{scope:"doctag",match:/@[a-zA-Z]+/},{scope:"keyword",match:/\\[a-zA-Z]+/}]}),t.HASH_COMMENT_MODE,{scope:"string",contains:[t.BACKSLASH_ESCAPE],variants:[t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\(/,end:/\)(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\{/,end:/\}(-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]"(-*)\[/,end:/\](-*)"/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\(/,end:/\)(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\{/,end:/\}(-*)'/}),t.END_SAME_AS_BEGIN({begin:/[rR]'(-*)\[/,end:/\](-*)'/}),{begin:'"',end:'"',relevance:0},{begin:"'",end:"'",relevance:0}]},{relevance:0,variants:[{scope:{1:"operator",2:"number"},match:[a,r]},{scope:{1:"operator",2:"number"},match:[/%[^%]*%/,r]},{scope:{1:"punctuation",2:"number"},match:[l,r]},{scope:{2:"number"},match:[/[^a-zA-Z0-9._]|^/,r]}]},{scope:{3:"operator"},match:[o,/\s+/,/<-/,/\s+/]},{scope:"operator",relevance:0,variants:[{match:a},{match:/%[^%]*%/}]},{scope:"punctuation",relevance:0,match:l},{begin:"`",end:"`",contains:[{begin:/\\./}]}]}}function kg(t){const n=t.regex,o="([a-zA-Z_]\\w*[!?=]?|[-+~]@|<<|>>|=~|===?|<=>|[<>]=?|\\*\\*|[-/+%^&*~`|]|\\[\\]=?)",r=n.either(/\b([A-Z]+[a-z0-9]+)+/,/\b([A-Z]+[a-z0-9]+)+[A-Z]+/),a=n.concat(r,/(::\w+)*/),i={"variable.constant":["__FILE__","__LINE__","__ENCODING__"],"variable.language":["self","super"],keyword:["alias","and","begin","BEGIN","break","case","class","defined","do","else","elsif","end","END","ensure","for","if","in","module","next","not","or","redo","require","rescue","retry","return","then","undef","unless","until","when","while","yield",...["include","extend","prepend","public","private","protected","raise","throw"]],built_in:["proc","lambda","attr_accessor","attr_reader","attr_writer","define_method","private_constant","module_function"],literal:["true","false","nil"]},s={className:"doctag",begin:"@[A-Za-z]+"},c={begin:"#<",end:">"},d=[t.COMMENT("#","$",{contains:[s]}),t.COMMENT("^=begin","^=end",{contains:[s],relevance:10}),t.COMMENT("^__END__",t.MATCH_NOTHING_RE)],u={className:"subst",begin:/#\{/,end:/\}/,keywords:i},p={className:"string",contains:[t.BACKSLASH_ESCAPE,u],variants:[{begin:/'/,end:/'/},{begin:/"/,end:/"/},{begin:/`/,end:/`/},{begin:/%[qQwWx]?\(/,end:/\)/},{begin:/%[qQwWx]?\[/,end:/\]/},{begin:/%[qQwWx]?\{/,end:/\}/},{begin:/%[qQwWx]?</,end:/>/},{begin:/%[qQwWx]?\//,end:/\//},{begin:/%[qQwWx]?%/,end:/%/},{begin:/%[qQwWx]?-/,end:/-/},{begin:/%[qQwWx]?\|/,end:/\|/},{begin:/\B\?(\\\d{1,3})/},{begin:/\B\?(\\x[A-Fa-f0-9]{1,2})/},{begin:/\B\?(\\u\{?[A-Fa-f0-9]{1,6}\}?)/},{begin:/\B\?(\\M-\\C-|\\M-\\c|\\c\\M-|\\M-|\\C-\\M-)[\x20-\x7e]/},{begin:/\B\?\\(c|C-)[\x20-\x7e]/},{begin:/\B\?\\?\S/},{begin:n.concat(/<<[-~]?'?/,n.lookahead(/(\w+)(?=\W)[^\n]*\n(?:[^\n]*\n)*?\s*\1\b/)),contains:[t.END_SAME_AS_BEGIN({begin:/(\w+)/,end:/(\w+)/,contains:[t.BACKSLASH_ESCAPE,u]})]}]},m="[1-9](_?[0-9])*|0",f="[0-9](_?[0-9])*",v={className:"number",relevance:0,variants:[{begin:`\\b(${m})(\\.(${f}))?([eE][+-]?(${f})|r)?i?\\b`},{begin:"\\b0[dD][0-9](_?[0-9])*r?i?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*r?i?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*r?i?\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*r?i?\\b"},{begin:"\\b0(_?[0-7])+r?i?\\b"}]},b={variants:[{match:/\(\)/},{className:"params",begin:/\(/,end:/(?=\))/,excludeBegin:!0,endsParent:!0,keywords:i}]},E=[p,{variants:[{match:[/class\s+/,a,/\s+<\s+/,a]},{match:[/\b(class|module)\s+/,a]}],scope:{2:"title.class",4:"title.class.inherited"},keywords:i},{match:[/(include|extend)\s+/,a],scope:{2:"title.class"},keywords:i},{relevance:0,match:[a,/\.new[. (]/],scope:{1:"title.class"}},{relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"},{relevance:0,match:r,scope:"title.class"},{match:[/def/,/\s+/,o],scope:{1:"keyword",3:"title.function"},contains:[b]},{begin:t.IDENT_RE+"::"},{className:"symbol",begin:t.UNDERSCORE_IDENT_RE+"(!|\\?)?:",relevance:0},{className:"symbol",begin:":(?!\\s)",contains:[p,{begin:o}],relevance:0},v,{className:"variable",begin:"(\\$\\W)|((\\$|@@?)(\\w+))(?=[^@$?])(?![A-Za-z])(?![@$?'])"},{className:"params",begin:/\|(?!=)/,end:/\|/,excludeBegin:!0,excludeEnd:!0,relevance:0,keywords:i},{begin:"("+t.RE_STARTERS_RE+"|unless)\\s*",keywords:"unless",contains:[{className:"regexp",contains:[t.BACKSLASH_ESCAPE,u],illegal:/\n/,variants:[{begin:"/",end:"/[a-z]*"},{begin:/%r\{/,end:/\}[a-z]*/},{begin:"%r\\(",end:"\\)[a-z]*"},{begin:"%r!",end:"![a-z]*"},{begin:"%r\\[",end:"\\][a-z]*"}]}].concat(c,d),relevance:0}].concat(c,d);u.contains=E,b.contains=E;const P=[{begin:/^\s*=>/,starts:{end:"$",contains:E}},{className:"meta.prompt",begin:"^("+"[>?]>"+"|"+"[\\w#]+\\(\\w+\\):\\d+:\\d+[>*]"+"|"+"(\\w+-)?\\d+\\.\\d+\\.\\d+(p\\d+)?[^\\d][^>]+>"+")(?=[ ])",starts:{end:"$",keywords:i,contains:E}}];return d.unshift(c),{name:"Ruby",aliases:["rb","gemspec","podspec","thor","irb"],keywords:i,illegal:/\/\*/,contains:[t.SHEBANG({binary:"ruby"})].concat(P).concat(d).concat(E)}}function yg(t){const n=t.regex,o=/(r#)?/,r=n.concat(o,t.UNDERSCORE_IDENT_RE),a=n.concat(o,t.IDENT_RE),l={className:"title.function.invoke",relevance:0,begin:n.concat(/\b/,/(?!let|for|while|if|else|match\b)/,a,n.lookahead(/\s*\(/))},i="([ui](8|16|32|64|128|size)|f(32|64))?",s=["abstract","as","async","await","become","box","break","const","continue","crate","do","dyn","else","enum","extern","false","final","fn","for","if","impl","in","let","loop","macro","match","mod","move","mut","override","priv","pub","ref","return","self","Self","static","struct","super","trait","true","try","type","typeof","union","unsafe","unsized","use","virtual","where","while","yield"],c=["true","false","Some","None","Ok","Err"],d=["drop ","Copy","Send","Sized","Sync","Drop","Fn","FnMut","FnOnce","ToOwned","Clone","Debug","PartialEq","PartialOrd","Eq","Ord","AsRef","AsMut","Into","From","Default","Iterator","Extend","IntoIterator","DoubleEndedIterator","ExactSizeIterator","SliceConcatExt","ToString","assert!","assert_eq!","bitflags!","bytes!","cfg!","col!","concat!","concat_idents!","debug_assert!","debug_assert_eq!","env!","eprintln!","panic!","file!","format!","format_args!","include_bytes!","include_str!","line!","local_data_key!","module_path!","option_env!","print!","println!","select!","stringify!","try!","unimplemented!","unreachable!","vec!","write!","writeln!","macro_rules!","assert_ne!","debug_assert_ne!"],u=["i8","i16","i32","i64","i128","isize","u8","u16","u32","u64","u128","usize","f32","f64","str","char","bool","Box","Option","Result","String","Vec"];return{name:"Rust",aliases:["rs"],keywords:{$pattern:t.IDENT_RE+"!?",type:u,keyword:s,literal:c,built_in:d},illegal:"</",contains:[t.C_LINE_COMMENT_MODE,t.COMMENT("/\\*","\\*/",{contains:["self"]}),t.inherit(t.QUOTE_STRING_MODE,{begin:/b?"/,illegal:null}),{className:"symbol",begin:/'[a-zA-Z_][a-zA-Z0-9_]*(?!')/},{scope:"string",variants:[{begin:/b?r(#*)"(.|\n)*?"\1(?!#)/},{begin:/b?'/,end:/'/,contains:[{scope:"char.escape",match:/\\('|\w|x\w{2}|u\w{4}|U\w{8})/}]}]},{className:"number",variants:[{begin:"\\b0b([01_]+)"+i},{begin:"\\b0o([0-7_]+)"+i},{begin:"\\b0x([A-Fa-f0-9_]+)"+i},{begin:"\\b(\\d[\\d_]*(\\.[0-9_]+)?([eE][+-]?[0-9_]+)?)"+i}],relevance:0},{begin:[/fn/,/\s+/,r],className:{1:"keyword",3:"title.function"}},{className:"meta",begin:"#!?\\[",end:"\\]",contains:[{className:"string",begin:/"/,end:/"/,contains:[t.BACKSLASH_ESCAPE]}]},{begin:[/let/,/\s+/,/(?:mut\s+)?/,r],className:{1:"keyword",3:"keyword",4:"variable"}},{begin:[/for/,/\s+/,r,/\s+/,/in/],className:{1:"keyword",3:"variable",5:"keyword"}},{begin:[/type/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:[/(?:trait|enum|struct|union|impl|for)/,/\s+/,r],className:{1:"keyword",3:"title.class"}},{begin:t.IDENT_RE+"::",keywords:{keyword:"Self",built_in:d,type:u}},{className:"punctuation",begin:"->"},l]}}const wg=t=>({IMPORTANT:{scope:"meta",begin:"!important"},BLOCK_COMMENT:t.C_BLOCK_COMMENT_MODE,HEXCOLOR:{scope:"number",begin:/#(([0-9a-fA-F]{3,4})|(([0-9a-fA-F]{2}){3,4}))\b/},FUNCTION_DISPATCH:{className:"built_in",begin:/[\w-]+(?=\()/},ATTRIBUTE_SELECTOR_MODE:{scope:"selector-attr",begin:/\[/,end:/\]/,illegal:"$",contains:[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE]},CSS_NUMBER_MODE:{scope:"number",begin:t.NUMBER_RE+"(%|em|ex|ch|rem|vw|vh|vmin|vmax|cm|mm|in|pt|pc|px|deg|grad|rad|turn|s|ms|Hz|kHz|dpi|dpcm|dppx)?",relevance:0},CSS_VARIABLE:{className:"attr",begin:/--[A-Za-z_][A-Za-z0-9_-]*/}}),Eg=["a","abbr","address","article","aside","audio","b","blockquote","body","button","canvas","caption","cite","code","dd","del","details","dfn","div","dl","dt","em","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","html","i","iframe","img","input","ins","kbd","label","legend","li","main","mark","menu","nav","object","ol","optgroup","option","p","picture","q","quote","samp","section","select","source","span","strong","summary","sup","table","tbody","td","textarea","tfoot","th","thead","time","tr","ul","var","video"],Cg=["defs","g","marker","mask","pattern","svg","switch","symbol","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feFlood","feGaussianBlur","feImage","feMerge","feMorphology","feOffset","feSpecularLighting","feTile","feTurbulence","linearGradient","radialGradient","stop","circle","ellipse","image","line","path","polygon","polyline","rect","text","use","textPath","tspan","foreignObject","clipPath"],xg=[...Eg,...Cg],Ng=["any-hover","any-pointer","aspect-ratio","color","color-gamut","color-index","device-aspect-ratio","device-height","device-width","display-mode","forced-colors","grid","height","hover","inverted-colors","monochrome","orientation","overflow-block","overflow-inline","pointer","prefers-color-scheme","prefers-contrast","prefers-reduced-motion","prefers-reduced-transparency","resolution","scan","scripting","update","width","min-width","max-width","min-height","max-height"].sort().reverse(),Sg=["active","any-link","blank","checked","current","default","defined","dir","disabled","drop","empty","enabled","first","first-child","first-of-type","fullscreen","future","focus","focus-visible","focus-within","has","host","host-context","hover","indeterminate","in-range","invalid","is","lang","last-child","last-of-type","left","link","local-link","not","nth-child","nth-col","nth-last-child","nth-last-col","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","past","placeholder-shown","read-only","read-write","required","right","root","scope","target","target-within","user-invalid","valid","visited","where"].sort().reverse(),Tg=["after","backdrop","before","cue","cue-region","first-letter","first-line","grammar-error","marker","part","placeholder","selection","slotted","spelling-error"].sort().reverse(),Og=["accent-color","align-content","align-items","align-self","alignment-baseline","all","anchor-name","animation","animation-composition","animation-delay","animation-direction","animation-duration","animation-fill-mode","animation-iteration-count","animation-name","animation-play-state","animation-range","animation-range-end","animation-range-start","animation-timeline","animation-timing-function","appearance","aspect-ratio","backdrop-filter","backface-visibility","background","background-attachment","background-blend-mode","background-clip","background-color","background-image","background-origin","background-position","background-position-x","background-position-y","background-repeat","background-size","baseline-shift","block-size","border","border-block","border-block-color","border-block-end","border-block-end-color","border-block-end-style","border-block-end-width","border-block-start","border-block-start-color","border-block-start-style","border-block-start-width","border-block-style","border-block-width","border-bottom","border-bottom-color","border-bottom-left-radius","border-bottom-right-radius","border-bottom-style","border-bottom-width","border-collapse","border-color","border-end-end-radius","border-end-start-radius","border-image","border-image-outset","border-image-repeat","border-image-slice","border-image-source","border-image-width","border-inline","border-inline-color","border-inline-end","border-inline-end-color","border-inline-end-style","border-inline-end-width","border-inline-start","border-inline-start-color","border-inline-start-style","border-inline-start-width","border-inline-style","border-inline-width","border-left","border-left-color","border-left-style","border-left-width","border-radius","border-right","border-right-color","border-right-style","border-right-width","border-spacing","border-start-end-radius","border-start-start-radius","border-style","border-top","border-top-color","border-top-left-radius","border-top-right-radius","border-top-style","border-top-width","border-width","bottom","box-align","box-decoration-break","box-direction","box-flex","box-flex-group","box-lines","box-ordinal-group","box-orient","box-pack","box-shadow","box-sizing","break-after","break-before","break-inside","caption-side","caret-color","clear","clip","clip-path","clip-rule","color","color-interpolation","color-interpolation-filters","color-profile","color-rendering","color-scheme","column-count","column-fill","column-gap","column-rule","column-rule-color","column-rule-style","column-rule-width","column-span","column-width","columns","contain","contain-intrinsic-block-size","contain-intrinsic-height","contain-intrinsic-inline-size","contain-intrinsic-size","contain-intrinsic-width","container","container-name","container-type","content","content-visibility","counter-increment","counter-reset","counter-set","cue","cue-after","cue-before","cursor","cx","cy","direction","display","dominant-baseline","empty-cells","enable-background","field-sizing","fill","fill-opacity","fill-rule","filter","flex","flex-basis","flex-direction","flex-flow","flex-grow","flex-shrink","flex-wrap","float","flood-color","flood-opacity","flow","font","font-display","font-family","font-feature-settings","font-kerning","font-language-override","font-optical-sizing","font-palette","font-size","font-size-adjust","font-smooth","font-smoothing","font-stretch","font-style","font-synthesis","font-synthesis-position","font-synthesis-small-caps","font-synthesis-style","font-synthesis-weight","font-variant","font-variant-alternates","font-variant-caps","font-variant-east-asian","font-variant-emoji","font-variant-ligatures","font-variant-numeric","font-variant-position","font-variation-settings","font-weight","forced-color-adjust","gap","glyph-orientation-horizontal","glyph-orientation-vertical","grid","grid-area","grid-auto-columns","grid-auto-flow","grid-auto-rows","grid-column","grid-column-end","grid-column-start","grid-gap","grid-row","grid-row-end","grid-row-start","grid-template","grid-template-areas","grid-template-columns","grid-template-rows","hanging-punctuation","height","hyphenate-character","hyphenate-limit-chars","hyphens","icon","image-orientation","image-rendering","image-resolution","ime-mode","initial-letter","initial-letter-align","inline-size","inset","inset-area","inset-block","inset-block-end","inset-block-start","inset-inline","inset-inline-end","inset-inline-start","isolation","justify-content","justify-items","justify-self","kerning","left","letter-spacing","lighting-color","line-break","line-height","line-height-step","list-style","list-style-image","list-style-position","list-style-type","margin","margin-block","margin-block-end","margin-block-start","margin-bottom","margin-inline","margin-inline-end","margin-inline-start","margin-left","margin-right","margin-top","margin-trim","marker","marker-end","marker-mid","marker-start","marks","mask","mask-border","mask-border-mode","mask-border-outset","mask-border-repeat","mask-border-slice","mask-border-source","mask-border-width","mask-clip","mask-composite","mask-image","mask-mode","mask-origin","mask-position","mask-repeat","mask-size","mask-type","masonry-auto-flow","math-depth","math-shift","math-style","max-block-size","max-height","max-inline-size","max-width","min-block-size","min-height","min-inline-size","min-width","mix-blend-mode","nav-down","nav-index","nav-left","nav-right","nav-up","none","normal","object-fit","object-position","offset","offset-anchor","offset-distance","offset-path","offset-position","offset-rotate","opacity","order","orphans","outline","outline-color","outline-offset","outline-style","outline-width","overflow","overflow-anchor","overflow-block","overflow-clip-margin","overflow-inline","overflow-wrap","overflow-x","overflow-y","overlay","overscroll-behavior","overscroll-behavior-block","overscroll-behavior-inline","overscroll-behavior-x","overscroll-behavior-y","padding","padding-block","padding-block-end","padding-block-start","padding-bottom","padding-inline","padding-inline-end","padding-inline-start","padding-left","padding-right","padding-top","page","page-break-after","page-break-before","page-break-inside","paint-order","pause","pause-after","pause-before","perspective","perspective-origin","place-content","place-items","place-self","pointer-events","position","position-anchor","position-visibility","print-color-adjust","quotes","r","resize","rest","rest-after","rest-before","right","rotate","row-gap","ruby-align","ruby-position","scale","scroll-behavior","scroll-margin","scroll-margin-block","scroll-margin-block-end","scroll-margin-block-start","scroll-margin-bottom","scroll-margin-inline","scroll-margin-inline-end","scroll-margin-inline-start","scroll-margin-left","scroll-margin-right","scroll-margin-top","scroll-padding","scroll-padding-block","scroll-padding-block-end","scroll-padding-block-start","scroll-padding-bottom","scroll-padding-inline","scroll-padding-inline-end","scroll-padding-inline-start","scroll-padding-left","scroll-padding-right","scroll-padding-top","scroll-snap-align","scroll-snap-stop","scroll-snap-type","scroll-timeline","scroll-timeline-axis","scroll-timeline-name","scrollbar-color","scrollbar-gutter","scrollbar-width","shape-image-threshold","shape-margin","shape-outside","shape-rendering","speak","speak-as","src","stop-color","stop-opacity","stroke","stroke-dasharray","stroke-dashoffset","stroke-linecap","stroke-linejoin","stroke-miterlimit","stroke-opacity","stroke-width","tab-size","table-layout","text-align","text-align-all","text-align-last","text-anchor","text-combine-upright","text-decoration","text-decoration-color","text-decoration-line","text-decoration-skip","text-decoration-skip-ink","text-decoration-style","text-decoration-thickness","text-emphasis","text-emphasis-color","text-emphasis-position","text-emphasis-style","text-indent","text-justify","text-orientation","text-overflow","text-rendering","text-shadow","text-size-adjust","text-transform","text-underline-offset","text-underline-position","text-wrap","text-wrap-mode","text-wrap-style","timeline-scope","top","touch-action","transform","transform-box","transform-origin","transform-style","transition","transition-behavior","transition-delay","transition-duration","transition-property","transition-timing-function","translate","unicode-bidi","user-modify","user-select","vector-effect","vertical-align","view-timeline","view-timeline-axis","view-timeline-inset","view-timeline-name","view-transition-name","visibility","voice-balance","voice-duration","voice-family","voice-pitch","voice-range","voice-rate","voice-stress","voice-volume","white-space","white-space-collapse","widows","width","will-change","word-break","word-spacing","word-wrap","writing-mode","x","y","z-index","zoom"].sort().reverse();function Ag(t){const n=wg(t),o=Tg,r=Sg,a="@[a-z-]+",l="and or not only",s={className:"variable",begin:"(\\$"+"[a-zA-Z-][a-zA-Z0-9_-]*"+")\\b",relevance:0};return{name:"SCSS",case_insensitive:!0,illegal:"[=/|']",contains:[t.C_LINE_COMMENT_MODE,t.C_BLOCK_COMMENT_MODE,n.CSS_NUMBER_MODE,{className:"selector-id",begin:"#[A-Za-z0-9_-]+",relevance:0},{className:"selector-class",begin:"\\.[A-Za-z0-9_-]+",relevance:0},n.ATTRIBUTE_SELECTOR_MODE,{className:"selector-tag",begin:"\\b("+xg.join("|")+")\\b",relevance:0},{className:"selector-pseudo",begin:":("+r.join("|")+")"},{className:"selector-pseudo",begin:":(:)?("+o.join("|")+")"},s,{begin:/\(/,end:/\)/,contains:[n.CSS_NUMBER_MODE]},n.CSS_VARIABLE,{className:"attribute",begin:"\\b("+Og.join("|")+")\\b"},{begin:"\\b(whitespace|wait|w-resize|visible|vertical-text|vertical-ideographic|uppercase|upper-roman|upper-alpha|underline|transparent|top|thin|thick|text|text-top|text-bottom|tb-rl|table-header-group|table-footer-group|sw-resize|super|strict|static|square|solid|small-caps|separate|se-resize|scroll|s-resize|rtl|row-resize|ridge|right|repeat|repeat-y|repeat-x|relative|progress|pointer|overline|outside|outset|oblique|nowrap|not-allowed|normal|none|nw-resize|no-repeat|no-drop|newspaper|ne-resize|n-resize|move|middle|medium|ltr|lr-tb|lowercase|lower-roman|lower-alpha|loose|list-item|line|line-through|line-edge|lighter|left|keep-all|justify|italic|inter-word|inter-ideograph|inside|inset|inline|inline-block|inherit|inactive|ideograph-space|ideograph-parenthesis|ideograph-numeric|ideograph-alpha|horizontal|hidden|help|hand|groove|fixed|ellipsis|e-resize|double|dotted|distribute|distribute-space|distribute-letter|distribute-all-lines|disc|disabled|default|decimal|dashed|crosshair|collapse|col-resize|circle|char|center|capitalize|break-word|break-all|bottom|both|bolder|bold|block|bidi-override|below|baseline|auto|always|all-scroll|absolute|table|table-cell)\\b"},{begin:/:/,end:/[;}{]/,relevance:0,contains:[n.BLOCK_COMMENT,s,n.HEXCOLOR,n.CSS_NUMBER_MODE,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,n.IMPORTANT,n.FUNCTION_DISPATCH]},{begin:"@(page|font-face)",keywords:{$pattern:a,keyword:"@page @font-face"}},{begin:"@",end:"[{;]",returnBegin:!0,keywords:{$pattern:/[a-z-]+/,keyword:l,attribute:Ng.join(" ")},contains:[{begin:a,className:"keyword"},{begin:/[a-z-]+(?=:)/,className:"attribute"},s,t.QUOTE_STRING_MODE,t.APOS_STRING_MODE,n.HEXCOLOR,n.CSS_NUMBER_MODE]},n.FUNCTION_DISPATCH]}}function Bg(t){return{name:"Shell Session",aliases:["console","shellsession"],contains:[{className:"meta.prompt",begin:/^\s{0,3}[/~\w\d[\]()@-]*[>%$#][ ]?/,starts:{end:/[^\\](?=\s*$)/,subLanguage:"bash"}}]}}function Mg(t){const n=t.regex,o=t.COMMENT("--","$"),r={scope:"string",variants:[{begin:/'/,end:/'/,contains:[{match:/''/}]}]},a={begin:/"/,end:/"/,contains:[{match:/""/}]},l=["true","false","unknown"],i=["double precision","large object","with timezone","without timezone"],s=["bigint","binary","blob","boolean","char","character","clob","date","dec","decfloat","decimal","float","int","integer","interval","nchar","nclob","national","numeric","real","row","smallint","time","timestamp","varchar","varying","varbinary"],c=["add","asc","collation","desc","final","first","last","view"],d=["abs","acos","all","allocate","alter","and","any","are","array","array_agg","array_max_cardinality","as","asensitive","asin","asymmetric","at","atan","atomic","authorization","avg","begin","begin_frame","begin_partition","between","bigint","binary","blob","boolean","both","by","call","called","cardinality","cascaded","case","cast","ceil","ceiling","char","char_length","character","character_length","check","classifier","clob","close","coalesce","collate","collect","column","commit","condition","connect","constraint","contains","convert","copy","corr","corresponding","cos","cosh","count","covar_pop","covar_samp","create","cross","cube","cume_dist","current","current_catalog","current_date","current_default_transform_group","current_path","current_role","current_row","current_schema","current_time","current_timestamp","current_path","current_role","current_transform_group_for_type","current_user","cursor","cycle","date","day","deallocate","dec","decimal","decfloat","declare","default","define","delete","dense_rank","deref","describe","deterministic","disconnect","distinct","double","drop","dynamic","each","element","else","empty","end","end_frame","end_partition","end-exec","equals","escape","every","except","exec","execute","exists","exp","external","extract","false","fetch","filter","first_value","float","floor","for","foreign","frame_row","free","from","full","function","fusion","get","global","grant","group","grouping","groups","having","hold","hour","identity","in","indicator","initial","inner","inout","insensitive","insert","int","integer","intersect","intersection","interval","into","is","join","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","language","large","last_value","lateral","lead","leading","left","like","like_regex","listagg","ln","local","localtime","localtimestamp","log","log10","lower","match","match_number","match_recognize","matches","max","member","merge","method","min","minute","mod","modifies","module","month","multiset","national","natural","nchar","nclob","new","no","none","normalize","not","nth_value","ntile","null","nullif","numeric","octet_length","occurrences_regex","of","offset","old","omit","on","one","only","open","or","order","out","outer","over","overlaps","overlay","parameter","partition","pattern","per","percent","percent_rank","percentile_cont","percentile_disc","period","portion","position","position_regex","power","precedes","precision","prepare","primary","procedure","ptf","range","rank","reads","real","recursive","ref","references","referencing","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","release","result","return","returns","revoke","right","rollback","rollup","row","row_number","rows","running","savepoint","scope","scroll","search","second","seek","select","sensitive","session_user","set","show","similar","sin","sinh","skip","smallint","some","specific","specifictype","sql","sqlexception","sqlstate","sqlwarning","sqrt","start","static","stddev_pop","stddev_samp","submultiset","subset","substring","substring_regex","succeeds","sum","symmetric","system","system_time","system_user","table","tablesample","tan","tanh","then","time","timestamp","timezone_hour","timezone_minute","to","trailing","translate","translate_regex","translation","treat","trigger","trim","trim_array","true","truncate","uescape","union","unique","unknown","unnest","update","upper","user","using","value","values","value_of","var_pop","var_samp","varbinary","varchar","varying","versioning","when","whenever","where","width_bucket","window","with","within","without","year"],u=["abs","acos","array_agg","asin","atan","avg","cast","ceil","ceiling","coalesce","corr","cos","cosh","count","covar_pop","covar_samp","cume_dist","dense_rank","deref","element","exp","extract","first_value","floor","json_array","json_arrayagg","json_exists","json_object","json_objectagg","json_query","json_table","json_table_primitive","json_value","lag","last_value","lead","listagg","ln","log","log10","lower","max","min","mod","nth_value","ntile","nullif","percent_rank","percentile_cont","percentile_disc","position","position_regex","power","rank","regr_avgx","regr_avgy","regr_count","regr_intercept","regr_r2","regr_slope","regr_sxx","regr_sxy","regr_syy","row_number","sin","sinh","sqrt","stddev_pop","stddev_samp","substring","substring_regex","sum","tan","tanh","translate","translate_regex","treat","trim","trim_array","unnest","upper","value_of","var_pop","var_samp","width_bucket"],p=["current_catalog","current_date","current_default_transform_group","current_path","current_role","current_schema","current_transform_group_for_type","current_user","session_user","system_time","system_user","current_time","localtime","current_timestamp","localtimestamp"],m=["create table","insert into","primary key","foreign key","not null","alter table","add constraint","grouping sets","on overflow","character set","respect nulls","ignore nulls","nulls first","nulls last","depth first","breadth first"],f=u,v=[...d,...c].filter(C=>!u.includes(C)),b={scope:"variable",match:/@[a-z0-9][a-z0-9_]*/},_={scope:"operator",match:/[-+*/=%^~]|&&?|\|\|?|!=?|<(?:=>?|<|>)?|>[>=]?/,relevance:0},h={match:n.concat(/\b/,n.either(...f),/\s*\(/),relevance:0,keywords:{built_in:f}};function w(C){return n.concat(/\b/,n.either(...C.map(E=>E.replace(/\s+/,"\\s+"))),/\b/)}const y={scope:"keyword",match:w(m),relevance:0};function g(C,{exceptions:E,when:R}={}){const D=R;return E=E||[],C.map(A=>A.match(/\|\d+$/)||E.includes(A)?A:D(A)?`${A}|0`:A)}return{name:"SQL",case_insensitive:!0,illegal:/[{}]|<\//,keywords:{$pattern:/\b[\w\.]+/,keyword:g(v,{when:C=>C.length<3}),literal:l,type:s,built_in:p},contains:[{scope:"type",match:w(i)},y,h,b,r,a,t.C_NUMBER_MODE,t.C_BLOCK_COMMENT_MODE,o,_]}}function Zi(t){return t?typeof t=="string"?t:t.source:null}function wn(t){return _e("(?=",t,")")}function _e(...t){return t.map(o=>Zi(o)).join("")}function Rg(t){const n=t[t.length-1];return typeof n=="object"&&n.constructor===Object?(t.splice(t.length-1,1),n):{}}function Ke(...t){return"("+(Rg(t).capture?"":"?:")+t.map(r=>Zi(r)).join("|")+")"}const Sr=t=>_e(/\b/,t,/\w$/.test(t)?/\b/:/\B/),Ig=["Protocol","Type"].map(Sr),wa=["init","self"].map(Sr),Dg=["Any","Self"],Ho=["actor","any","associatedtype","async","await",/as\?/,/as!/,"as","borrowing","break","case","catch","class","consume","consuming","continue","convenience","copy","default","defer","deinit","didSet","distributed","do","dynamic","each","else","enum","extension","fallthrough",/fileprivate\(set\)/,"fileprivate","final","for","func","get","guard","if","import","indirect","infix",/init\?/,/init!/,"inout",/internal\(set\)/,"internal","in","is","isolated","nonisolated","lazy","let","macro","mutating","nonmutating",/open\(set\)/,"open","operator","optional","override","package","postfix","precedencegroup","prefix",/private\(set\)/,"private","protocol",/public\(set\)/,"public","repeat","required","rethrows","return","set","some","static","struct","subscript","super","switch","throws","throw",/try\?/,/try!/,"try","typealias",/unowned\(safe\)/,/unowned\(unsafe\)/,"unowned","var","weak","where","while","willSet"],Ea=["false","nil","true"],Lg=["assignment","associativity","higherThan","left","lowerThan","none","right"],Vg=["#colorLiteral","#column","#dsohandle","#else","#elseif","#endif","#error","#file","#fileID","#fileLiteral","#filePath","#function","#if","#imageLiteral","#keyPath","#line","#selector","#sourceLocation","#warning"],Ca=["abs","all","any","assert","assertionFailure","debugPrint","dump","fatalError","getVaList","isKnownUniquelyReferenced","max","min","numericCast","pointwiseMax","pointwiseMin","precondition","preconditionFailure","print","readLine","repeatElement","sequence","stride","swap","swift_unboxFromSwiftValueWithType","transcode","type","unsafeBitCast","unsafeDowncast","withExtendedLifetime","withUnsafeMutablePointer","withUnsafePointer","withVaList","withoutActuallyEscaping","zip"],Xi=Ke(/[/=\-+!*%<>&|^~?]/,/[\u00A1-\u00A7]/,/[\u00A9\u00AB]/,/[\u00AC\u00AE]/,/[\u00B0\u00B1]/,/[\u00B6\u00BB\u00BF\u00D7\u00F7]/,/[\u2016-\u2017]/,/[\u2020-\u2027]/,/[\u2030-\u203E]/,/[\u2041-\u2053]/,/[\u2055-\u205E]/,/[\u2190-\u23FF]/,/[\u2500-\u2775]/,/[\u2794-\u2BFF]/,/[\u2E00-\u2E7F]/,/[\u3001-\u3003]/,/[\u3008-\u3020]/,/[\u3030]/),Qi=Ke(Xi,/[\u0300-\u036F]/,/[\u1DC0-\u1DFF]/,/[\u20D0-\u20FF]/,/[\uFE00-\uFE0F]/,/[\uFE20-\uFE2F]/),qo=_e(Xi,Qi,"*"),Ji=Ke(/[a-zA-Z_]/,/[\u00A8\u00AA\u00AD\u00AF\u00B2-\u00B5\u00B7-\u00BA]/,/[\u00BC-\u00BE\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u00FF]/,/[\u0100-\u02FF\u0370-\u167F\u1681-\u180D\u180F-\u1DBF]/,/[\u1E00-\u1FFF]/,/[\u200B-\u200D\u202A-\u202E\u203F-\u2040\u2054\u2060-\u206F]/,/[\u2070-\u20CF\u2100-\u218F\u2460-\u24FF\u2776-\u2793]/,/[\u2C00-\u2DFF\u2E80-\u2FFF]/,/[\u3004-\u3007\u3021-\u302F\u3031-\u303F\u3040-\uD7FF]/,/[\uF900-\uFD3D\uFD40-\uFDCF\uFDF0-\uFE1F\uFE30-\uFE44]/,/[\uFE47-\uFEFE\uFF00-\uFFFD]/),lo=Ke(Ji,/\d/,/[\u0300-\u036F\u1DC0-\u1DFF\u20D0-\u20FF\uFE20-\uFE2F]/),wt=_e(Ji,lo,"*"),Yn=_e(/[A-Z]/,lo,"*"),$g=["attached","autoclosure",_e(/convention\(/,Ke("swift","block","c"),/\)/),"discardableResult","dynamicCallable","dynamicMemberLookup","escaping","freestanding","frozen","GKInspectable","IBAction","IBDesignable","IBInspectable","IBOutlet","IBSegueAction","inlinable","main","nonobjc","NSApplicationMain","NSCopying","NSManaged",_e(/objc\(/,wt,/\)/),"objc","objcMembers","propertyWrapper","requires_stored_property_inits","resultBuilder","Sendable","testable","UIApplicationMain","unchecked","unknown","usableFromInline","warn_unqualified_access"],Pg=["iOS","iOSApplicationExtension","macOS","macOSApplicationExtension","macCatalyst","macCatalystApplicationExtension","watchOS","watchOSApplicationExtension","tvOS","tvOSApplicationExtension","swift"];function Fg(t){const n={match:/\s+/,relevance:0},o=t.COMMENT("/\\*","\\*/",{contains:["self"]}),r=[t.C_LINE_COMMENT_MODE,o],a={match:[/\./,Ke(...Ig,...wa)],className:{2:"keyword"}},l={match:_e(/\./,Ke(...Ho)),relevance:0},i=Ho.filter(ue=>typeof ue=="string").concat(["_|0"]),s=Ho.filter(ue=>typeof ue!="string").concat(Dg).map(Sr),c={variants:[{className:"keyword",match:Ke(...s,...wa)}]},d={$pattern:Ke(/\b\w+/,/#\w+/),keyword:i.concat(Vg),literal:Ea},u=[a,l,c],p={match:_e(/\./,Ke(...Ca)),relevance:0},m={className:"built_in",match:_e(/\b/,Ke(...Ca),/(?=\()/)},f=[p,m],v={match:/->/,relevance:0},b={className:"operator",relevance:0,variants:[{match:qo},{match:`\\.(\\.|${Qi})+`}]},_=[v,b],h="([0-9]_*)+",w="([0-9a-fA-F]_*)+",y={className:"number",relevance:0,variants:[{match:`\\b(${h})(\\.(${h}))?([eE][+-]?(${h}))?\\b`},{match:`\\b0x(${w})(\\.(${w}))?([pP][+-]?(${h}))?\\b`},{match:/\b0o([0-7]_*)+\b/},{match:/\b0b([01]_*)+\b/}]},g=(ue="")=>({className:"subst",variants:[{match:_e(/\\/,ue,/[0\\tnr"']/)},{match:_e(/\\/,ue,/u\{[0-9a-fA-F]{1,8}\}/)}]}),C=(ue="")=>({className:"subst",match:_e(/\\/,ue,/[\t ]*(?:[\r\n]|\r\n)/)}),E=(ue="")=>({className:"subst",label:"interpol",begin:_e(/\\/,ue,/\(/),end:/\)/}),R=(ue="")=>({begin:_e(ue,/"""/),end:_e(/"""/,ue),contains:[g(ue),C(ue),E(ue)]}),D=(ue="")=>({begin:_e(ue,/"/),end:_e(/"/,ue),contains:[g(ue),E(ue)]}),A={className:"string",variants:[R(),R("#"),R("##"),R("###"),D(),D("#"),D("##"),D("###")]},P=[t.BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[t.BACKSLASH_ESCAPE]}],j={begin:/\/[^\s](?=[^/\n]*\/)/,end:/\//,contains:P},O=ue=>{const ne=_e(ue,/\//),re=_e(/\//,ue);return{begin:ne,end:re,contains:[...P,{scope:"comment",begin:`#(?!.*${re})`,end:/$/}]}},M={scope:"regexp",variants:[O("###"),O("##"),O("#"),j]},L={match:_e(/`/,wt,/`/)},U={className:"variable",match:/\$\d+/},S={className:"variable",match:`\\$${lo}+`},H=[L,U,S],T={match:/(@|#(un)?)available/,scope:"keyword",starts:{contains:[{begin:/\(/,end:/\)/,keywords:Pg,contains:[..._,y,A]}]}},X={scope:"keyword",match:_e(/@/,Ke(...$g),wn(Ke(/\(/,/\s+/)))},ie={scope:"meta",match:_e(/@/,wt)},ge=[T,X,ie],be={match:wn(/\b[A-Z]/),relevance:0,contains:[{className:"type",match:_e(/(AV|CA|CF|CG|CI|CL|CM|CN|CT|MK|MP|MTK|MTL|NS|SCN|SK|UI|WK|XC)/,lo,"+")},{className:"type",match:Yn,relevance:0},{match:/[?!]+/,relevance:0},{match:/\.\.\./,relevance:0},{match:_e(/\s+&\s+/,wn(Yn)),relevance:0}]},Be={begin:/</,end:/>/,keywords:d,contains:[...r,...u,...ge,v,be]};be.contains.push(Be);const $e={match:_e(wt,/\s*:/),keywords:"_|0",relevance:0},Re={begin:/\(/,end:/\)/,relevance:0,keywords:d,contains:["self",$e,...r,M,...u,...f,..._,y,A,...H,...ge,be]},Y={begin:/</,end:/>/,keywords:"repeat each",contains:[...r,be]},le={begin:Ke(wn(_e(wt,/\s*:/)),wn(_e(wt,/\s+/,wt,/\s*:/))),end:/:/,relevance:0,contains:[{className:"keyword",match:/\b_\b/},{className:"params",match:wt}]},ce={begin:/\(/,end:/\)/,keywords:d,contains:[le,...r,...u,..._,y,A,...ge,be,Re],endsParent:!0,illegal:/["']/},Ne={match:[/(func|macro)/,/\s+/,Ke(L.match,wt,qo)],className:{1:"keyword",3:"title.function"},contains:[Y,ce,n],illegal:[/\[/,/%/]},Me={match:[/\b(?:subscript|init[?!]?)/,/\s*(?=[<(])/],className:{1:"keyword"},contains:[Y,ce,n],illegal:/\[|%/},rt={match:[/operator/,/\s+/,qo],className:{1:"keyword",3:"title"}},ht={begin:[/precedencegroup/,/\s+/,Yn],className:{1:"keyword",3:"title"},contains:[be],keywords:[...Lg,...Ea],end:/}/},Xe={match:[/class\b/,/\s+/,/func\b/,/\s+/,/\b[A-Za-z_][A-Za-z0-9_]*\b/],scope:{1:"keyword",3:"keyword",5:"title.function"}},ut={match:[/class\b/,/\s+/,/var\b/],scope:{1:"keyword",3:"keyword"}},dt={begin:[/(struct|protocol|class|extension|enum|actor)/,/\s+/,wt,/\s*/],beginScope:{1:"keyword",3:"title.class"},keywords:d,contains:[Y,...u,{begin:/:/,end:/\{/,keywords:d,contains:[{scope:"title.class.inherited",match:Yn},...u],relevance:0}]};for(const ue of A.variants){const ne=ue.contains.find(ze=>ze.label==="interpol");ne.keywords=d;const re=[...u,...f,..._,y,A,...H];ne.contains=[...re,{begin:/\(/,end:/\)/,contains:["self",...re]}]}return{name:"Swift",keywords:d,contains:[...r,Ne,Me,Xe,ut,dt,rt,ht,{beginKeywords:"import",end:/$/,contains:[...r],relevance:0},M,...u,...f,..._,y,A,...H,...ge,be,Re]}}const so="[A-Za-z$_][0-9A-Za-z$_]*",el=["as","in","of","if","for","while","finally","var","new","function","do","return","void","else","break","catch","instanceof","with","throw","case","default","try","switch","continue","typeof","delete","let","yield","const","class","debugger","async","await","static","import","from","export","extends","using"],tl=["true","false","null","undefined","NaN","Infinity"],nl=["Object","Function","Boolean","Symbol","Math","Date","Number","BigInt","String","RegExp","Array","Float32Array","Float64Array","Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Int32Array","Uint16Array","Uint32Array","BigInt64Array","BigUint64Array","Set","Map","WeakSet","WeakMap","ArrayBuffer","SharedArrayBuffer","Atomics","DataView","JSON","Promise","Generator","GeneratorFunction","AsyncFunction","Reflect","Proxy","Intl","WebAssembly"],ol=["Error","EvalError","InternalError","RangeError","ReferenceError","SyntaxError","TypeError","URIError"],rl=["setInterval","setTimeout","clearInterval","clearTimeout","require","exports","eval","isFinite","isNaN","parseFloat","parseInt","decodeURI","decodeURIComponent","encodeURI","encodeURIComponent","escape","unescape"],al=["arguments","this","super","console","window","document","localStorage","sessionStorage","module","global"],il=[].concat(rl,nl,ol);function Ug(t){const n=t.regex,o=(T,{after:X})=>{const ie="</"+T[0].slice(1);return T.input.indexOf(ie,X)!==-1},r=so,a={begin:"<>",end:"</>"},l=/<[A-Za-z0-9\\._:-]+\s*\/>/,i={begin:/<[A-Za-z0-9\\._:-]+/,end:/\/[A-Za-z0-9\\._:-]+>|\/>/,isTrulyOpeningTag:(T,X)=>{const ie=T[0].length+T.index,ge=T.input[ie];if(ge==="<"||ge===","){X.ignoreMatch();return}ge===">"&&(o(T,{after:ie})||X.ignoreMatch());let be;const Be=T.input.substring(ie);if(be=Be.match(/^\s*=/)){X.ignoreMatch();return}if((be=Be.match(/^\s+extends\s+/))&&be.index===0){X.ignoreMatch();return}}},s={$pattern:so,keyword:el,literal:tl,built_in:il,"variable.language":al},c="[0-9](_?[0-9])*",d=`\\.(${c})`,u="0|[1-9](_?[0-9])*|0[0-7]*[89][0-9]*",p={className:"number",variants:[{begin:`(\\b(${u})((${d})|\\.)?|(${d}))[eE][+-]?(${c})\\b`},{begin:`\\b(${u})\\b((${d})\\b|\\.)?|(${d})\\b`},{begin:"\\b(0|[1-9](_?[0-9])*)n\\b"},{begin:"\\b0[xX][0-9a-fA-F](_?[0-9a-fA-F])*n?\\b"},{begin:"\\b0[bB][0-1](_?[0-1])*n?\\b"},{begin:"\\b0[oO][0-7](_?[0-7])*n?\\b"},{begin:"\\b0[0-7]+n?\\b"}],relevance:0},m={className:"subst",begin:"\\$\\{",end:"\\}",keywords:s,contains:[]},f={begin:".?html`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"xml"}},v={begin:".?css`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"css"}},b={begin:".?gql`",end:"",starts:{end:"`",returnEnd:!1,contains:[t.BACKSLASH_ESCAPE,m],subLanguage:"graphql"}},_={className:"string",begin:"`",end:"`",contains:[t.BACKSLASH_ESCAPE,m]},w={className:"comment",variants:[t.COMMENT(/\/\*\*(?!\/)/,"\\*/",{relevance:0,contains:[{begin:"(?=@[A-Za-z]+)",relevance:0,contains:[{className:"doctag",begin:"@[A-Za-z]+"},{className:"type",begin:"\\{",end:"\\}",excludeEnd:!0,excludeBegin:!0,relevance:0},{className:"variable",begin:r+"(?=\\s*(-)|$)",endsParent:!0,relevance:0},{begin:/(?=[^\n])\s/,relevance:0}]}]}),t.C_BLOCK_COMMENT_MODE,t.C_LINE_COMMENT_MODE]},y=[t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,v,b,_,{match:/\$\d+/},p];m.contains=y.concat({begin:/\{/,end:/\}/,keywords:s,contains:["self"].concat(y)});const g=[].concat(w,m.contains),C=g.concat([{begin:/(\s*)\(/,end:/\)/,keywords:s,contains:["self"].concat(g)}]),E={className:"params",begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:C},R={variants:[{match:[/class/,/\s+/,r,/\s+/,/extends/,/\s+/,n.concat(r,"(",n.concat(/\./,r),")*")],scope:{1:"keyword",3:"title.class",5:"keyword",7:"title.class.inherited"}},{match:[/class/,/\s+/,r],scope:{1:"keyword",3:"title.class"}}]},D={relevance:0,match:n.either(/\bJSON/,/\b[A-Z][a-z]+([A-Z][a-z]*|\d)*/,/\b[A-Z]{2,}([A-Z][a-z]+|\d)+([A-Z][a-z]*)*/,/\b[A-Z]{2,}[a-z]+([A-Z][a-z]+|\d)*([A-Z][a-z]*)*/),className:"title.class",keywords:{_:[...nl,...ol]}},A={label:"use_strict",className:"meta",relevance:10,begin:/^\s*['"]use (strict|asm)['"]/},P={variants:[{match:[/function/,/\s+/,r,/(?=\s*\()/]},{match:[/function/,/\s*(?=\()/]}],className:{1:"keyword",3:"title.function"},label:"func.def",contains:[E],illegal:/%/},j={relevance:0,match:/\b[A-Z][A-Z_0-9]+\b/,className:"variable.constant"};function O(T){return n.concat("(?!",T.join("|"),")")}const M={match:n.concat(/\b/,O([...rl,"super","import"].map(T=>`${T}\\s*\\(`)),r,n.lookahead(/\s*\(/)),className:"title.function",relevance:0},L={begin:n.concat(/\./,n.lookahead(n.concat(r,/(?![0-9A-Za-z$_(])/))),end:r,excludeBegin:!0,keywords:"prototype",className:"property",relevance:0},U={match:[/get|set/,/\s+/,r,/(?=\()/],className:{1:"keyword",3:"title.function"},contains:[{begin:/\(\)/},E]},S="(\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)|"+t.UNDERSCORE_IDENT_RE+")\\s*=>",H={match:[/const|var|let/,/\s+/,r,/\s*/,/=\s*/,/(async\s*)?/,n.lookahead(S)],keywords:"async",className:{1:"keyword",3:"title.function"},contains:[E]};return{name:"JavaScript",aliases:["js","jsx","mjs","cjs"],keywords:s,exports:{PARAMS_CONTAINS:C,CLASS_REFERENCE:D},illegal:/#(?![$_A-z])/,contains:[t.SHEBANG({label:"shebang",binary:"node",relevance:5}),A,t.APOS_STRING_MODE,t.QUOTE_STRING_MODE,f,v,b,_,w,{match:/\$\d+/},p,D,{scope:"attr",match:r+n.lookahead(":"),relevance:0},H,{begin:"("+t.RE_STARTERS_RE+"|\\b(case|return|throw)\\b)\\s*",keywords:"return throw case",relevance:0,contains:[w,t.REGEXP_MODE,{className:"function",begin:S,returnBegin:!0,end:"\\s*=>",contains:[{className:"params",variants:[{begin:t.UNDERSCORE_IDENT_RE,relevance:0},{className:null,begin:/\(\s*\)/,skip:!0},{begin:/(\s*)\(/,end:/\)/,excludeBegin:!0,excludeEnd:!0,keywords:s,contains:C}]}]},{begin:/,/,relevance:0},{match:/\s+/,relevance:0},{variants:[{begin:a.begin,end:a.end},{match:l},{begin:i.begin,"on:begin":i.isTrulyOpeningTag,end:i.end}],subLanguage:"xml",contains:[{begin:i.begin,end:i.end,skip:!0,contains:["self"]}]}]},P,{beginKeywords:"while if switch catch for"},{begin:"\\b(?!function)"+t.UNDERSCORE_IDENT_RE+"\\([^()]*(\\([^()]*(\\([^()]*\\)[^()]*)*\\)[^()]*)*\\)\\s*\\{",returnBegin:!0,label:"func.def",contains:[E,t.inherit(t.TITLE_MODE,{begin:r,className:"title.function"})]},{match:/\.\.\./,relevance:0},L,{match:"\\$"+r,relevance:0},{match:[/\bconstructor(?=\s*\()/],className:{1:"title.function"},contains:[E]},M,j,R,U,{match:/\$[(.]/}]}}function zg(t){const n=t.regex,o=Ug(t),r=so,a=["any","void","number","boolean","string","object","never","symbol","bigint","unknown"],l={begin:[/namespace/,/\s+/,t.IDENT_RE],beginScope:{1:"keyword",3:"title.class"}},i={beginKeywords:"interface",end:/\{/,excludeEnd:!0,keywords:{keyword:"interface extends",built_in:a},contains:[o.exports.CLASS_REFERENCE]},s={className:"meta",relevance:10,begin:/^\s*['"]use strict['"]/},c=["type","interface","public","private","protected","implements","declare","abstract","readonly","enum","override","satisfies"],d={$pattern:so,keyword:el.concat(c),literal:tl,built_in:il.concat(a),"variable.language":al},u={className:"meta",begin:"@"+r},p=(b,_,h)=>{const w=b.contains.findIndex(y=>y.label===_);if(w===-1)throw new Error("can not find mode to replace");b.contains.splice(w,1,h)};Object.assign(o.keywords,d),o.exports.PARAMS_CONTAINS.push(u);const m=o.contains.find(b=>b.scope==="attr"),f=Object.assign({},m,{match:n.concat(r,n.lookahead(/\s*\?:/))});o.exports.PARAMS_CONTAINS.push([o.exports.CLASS_REFERENCE,m,f]),o.contains=o.contains.concat([u,l,i,f]),p(o,"shebang",t.SHEBANG()),p(o,"use_strict",s);const v=o.contains.find(b=>b.label==="func.def");return v.relevance=0,Object.assign(o,{name:"TypeScript",aliases:["ts","tsx","mts","cts"]}),o}function Hg(t){const n=t.regex,o={className:"string",begin:/"(""|[^/n])"C\b/},r={className:"string",begin:/"/,end:/"/,illegal:/\n/,contains:[{begin:/""/}]},a=/\d{1,2}\/\d{1,2}\/\d{4}/,l=/\d{4}-\d{1,2}-\d{1,2}/,i=/(\d|1[012])(:\d+){0,2} *(AM|PM)/,s=/\d{1,2}(:\d{1,2}){1,2}/,c={className:"literal",variants:[{begin:n.concat(/# */,n.either(l,a),/ *#/)},{begin:n.concat(/# */,s,/ *#/)},{begin:n.concat(/# */,i,/ *#/)},{begin:n.concat(/# */,n.either(l,a),/ +/,n.either(i,s),/ *#/)}]},d={className:"number",relevance:0,variants:[{begin:/\b\d[\d_]*((\.[\d_]+(E[+-]?[\d_]+)?)|(E[+-]?[\d_]+))[RFD@!#]?/},{begin:/\b\d[\d_]*((U?[SIL])|[%&])?/},{begin:/&H[\dA-F_]+((U?[SIL])|[%&])?/},{begin:/&O[0-7_]+((U?[SIL])|[%&])?/},{begin:/&B[01_]+((U?[SIL])|[%&])?/}]},u={className:"label",begin:/^\w+:/},p=t.COMMENT(/'''/,/$/,{contains:[{className:"doctag",begin:/<\/?/,end:/>/}]}),m=t.COMMENT(null,/$/,{variants:[{begin:/'/},{begin:/([\t ]|^)REM(?=\s)/}]});return{name:"Visual Basic .NET",aliases:["vb"],case_insensitive:!0,classNameAliases:{label:"symbol"},keywords:{keyword:"addhandler alias aggregate ansi as async assembly auto binary by byref byval call case catch class compare const continue custom declare default delegate dim distinct do each equals else elseif end enum erase error event exit explicit finally for friend from function get global goto group handles if implements imports in inherits interface into iterator join key let lib loop me mid module mustinherit mustoverride mybase myclass namespace narrowing new next notinheritable notoverridable of off on operator option optional order overloads overridable overrides paramarray partial preserve private property protected public raiseevent readonly redim removehandler resume return select set shadows shared skip static step stop structure strict sub synclock take text then throw to try unicode until using when where while widening with withevents writeonly yield",built_in:"addressof and andalso await directcast gettype getxmlnamespace is isfalse isnot istrue like mod nameof new not or orelse trycast typeof xor cbool cbyte cchar cdate cdbl cdec cint clng cobj csbyte cshort csng cstr cuint culng cushort",type:"boolean byte char date decimal double integer long object sbyte short single string uinteger ulong ushort",literal:"true false nothing"},illegal:"//|\\{|\\}|endif|gosub|variant|wend|^\\$ ",contains:[o,r,c,d,u,p,m,{className:"meta",begin:/[\t ]*#(const|disable|else|elseif|enable|end|externalsource|if|region)\b/,end:/$/,keywords:{keyword:"const disable else elseif enable end externalsource if region then"},contains:[m]}]}}function qg(t){t.regex;const n=t.COMMENT(/\(;/,/;\)/);n.contains.push("self");const o=t.COMMENT(/;;/,/$/),r=["anyfunc","block","br","br_if","br_table","call","call_indirect","data","drop","elem","else","end","export","func","global.get","global.set","local.get","local.set","local.tee","get_global","get_local","global","if","import","local","loop","memory","memory.grow","memory.size","module","mut","nop","offset","param","result","return","select","set_global","set_local","start","table","tee_local","then","type","unreachable"],a={begin:[/(?:func|call|call_indirect)/,/\s+/,/\$[^\s)]+/],className:{1:"keyword",3:"title.function"}},l={className:"variable",begin:/\$[\w_]+/},i={match:/(\((?!;)|\))+/,className:"punctuation",relevance:0},s={className:"number",relevance:0,match:/[+-]?\b(?:\d(?:_?\d)*(?:\.\d(?:_?\d)*)?(?:[eE][+-]?\d(?:_?\d)*)?|0x[\da-fA-F](?:_?[\da-fA-F])*(?:\.[\da-fA-F](?:_?[\da-fA-D])*)?(?:[pP][+-]?\d(?:_?\d)*)?)\b|\binf\b|\bnan(?::0x[\da-fA-F](?:_?[\da-fA-D])*)?\b/},c={match:/(i32|i64|f32|f64)(?!\.)/,className:"type"},d={className:"keyword",match:/\b(f32|f64|i32|i64)(?:\.(?:abs|add|and|ceil|clz|const|convert_[su]\/i(?:32|64)|copysign|ctz|demote\/f64|div(?:_[su])?|eqz?|extend_[su]\/i32|floor|ge(?:_[su])?|gt(?:_[su])?|le(?:_[su])?|load(?:(?:8|16|32)_[su])?|lt(?:_[su])?|max|min|mul|nearest|neg?|or|popcnt|promote\/f32|reinterpret\/[fi](?:32|64)|rem_[su]|rot[lr]|shl|shr_[su]|store(?:8|16|32)?|sqrt|sub|trunc(?:_[su]\/f(?:32|64))?|wrap\/i64|xor))\b/};return{name:"WebAssembly",keywords:{$pattern:/[\w.]+/,keyword:r},contains:[o,n,{match:[/(?:offset|align)/,/\s*/,/=/],className:{1:"keyword",3:"operator"}},l,i,a,t.QUOTE_STRING_MODE,c,d,s]}}function Gg(t){const n=t.regex,o=n.concat(/[\p{L}_]/u,n.optional(/[\p{L}0-9_.-]*:/u),/[\p{L}0-9_.-]*/u),r=/[\p{L}0-9._:-]+/u,a={className:"symbol",begin:/&[a-z]+;|&#[0-9]+;|&#x[a-f0-9]+;/},l={begin:/\s/,contains:[{className:"keyword",begin:/#?[a-z_][a-z1-9_-]+/,illegal:/\n/}]},i=t.inherit(l,{begin:/\(/,end:/\)/}),s=t.inherit(t.APOS_STRING_MODE,{className:"string"}),c=t.inherit(t.QUOTE_STRING_MODE,{className:"string"}),d={endsWithParent:!0,illegal:/</,relevance:0,contains:[{className:"attr",begin:r,relevance:0},{begin:/=\s*/,relevance:0,contains:[{className:"string",endsParent:!0,variants:[{begin:/"/,end:/"/,contains:[a]},{begin:/'/,end:/'/,contains:[a]},{begin:/[^\s"'=<>`]+/}]}]}]};return{name:"HTML, XML",aliases:["html","xhtml","rss","atom","xjb","xsd","xsl","plist","wsf","svg"],case_insensitive:!0,unicodeRegex:!0,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,relevance:10,contains:[l,c,s,i,{begin:/\[/,end:/\]/,contains:[{className:"meta",begin:/<![a-z]/,end:/>/,contains:[l,i,c,s]}]}]},t.COMMENT(/<!--/,/-->/,{relevance:10}),{begin:/<!\[CDATA\[/,end:/\]\]>/,relevance:10},a,{className:"meta",end:/\?>/,variants:[{begin:/<\?xml/,relevance:10,contains:[c]},{begin:/<\?[a-z][a-z0-9]+/}]},{className:"tag",begin:/<style(?=\s|>)/,end:/>/,keywords:{name:"style"},contains:[d],starts:{end:/<\/style>/,returnEnd:!0,subLanguage:["css","xml"]}},{className:"tag",begin:/<script(?=\s|>)/,end:/>/,keywords:{name:"script"},contains:[d],starts:{end:/<\/script>/,returnEnd:!0,subLanguage:["javascript","handlebars","xml"]}},{className:"tag",begin:/<>|<\/>/},{className:"tag",begin:n.concat(/</,n.lookahead(n.concat(o,n.either(/\/>/,/>/,/\s/)))),end:/\/?>/,contains:[{className:"name",begin:o,relevance:0,starts:d}]},{className:"tag",begin:n.concat(/<\//,n.lookahead(n.concat(o,/>/))),contains:[{className:"name",begin:o,relevance:0},{begin:/>/,relevance:0,endsParent:!0}]}]}}function Kg(t){const n="true false yes no null",o="[\\w#;/?:@&=+$,.~*'()[\\]]+",r={className:"attr",variants:[{begin:/[\w*@][\w*@ :()\./-]*:(?=[ \t]|$)/},{begin:/"[\w*@][\w*@ :()\./-]*":(?=[ \t]|$)/},{begin:/'[\w*@][\w*@ :()\./-]*':(?=[ \t]|$)/}]},a={className:"template-variable",variants:[{begin:/\{\{/,end:/\}\}/},{begin:/%\{/,end:/\}/}]},l={className:"string",relevance:0,begin:/'/,end:/'/,contains:[{match:/''/,scope:"char.escape",relevance:0}]},i={className:"string",relevance:0,variants:[{begin:/"/,end:/"/},{begin:/\S+/}],contains:[t.BACKSLASH_ESCAPE,a]},s=t.inherit(i,{variants:[{begin:/'/,end:/'/,contains:[{begin:/''/,relevance:0}]},{begin:/"/,end:/"/},{begin:/[^\s,{}[\]]+/}]}),m={className:"number",begin:"\\b"+"[0-9]{4}(-[0-9][0-9]){0,2}"+"([Tt \\t][0-9][0-9]?(:[0-9][0-9]){2})?"+"(\\.[0-9]*)?"+"([ \\t])*(Z|[-+][0-9][0-9]?(:[0-9][0-9])?)?"+"\\b"},f={end:",",endsWithParent:!0,excludeEnd:!0,keywords:n,relevance:0},v={begin:/\{/,end:/\}/,contains:[f],illegal:"\\n",relevance:0},b={begin:"\\[",end:"\\]",contains:[f],illegal:"\\n",relevance:0},_=[r,{className:"meta",begin:"^---\\s*$",relevance:10},{className:"string",begin:"[\\|>]([1-9]?[+-])?[ ]*\\n( +)[^ ][^\\n]*\\n(\\2[^\\n]+\\n?)*"},{begin:"<%[%=-]?",end:"[%-]?%>",subLanguage:"ruby",excludeBegin:!0,excludeEnd:!0,relevance:0},{className:"type",begin:"!\\w+!"+o},{className:"type",begin:"!<"+o+">"},{className:"type",begin:"!"+o},{className:"type",begin:"!!"+o},{className:"meta",begin:"&"+t.UNDERSCORE_IDENT_RE+"$"},{className:"meta",begin:"\\*"+t.UNDERSCORE_IDENT_RE+"$"},{className:"bullet",begin:"-(?=[ ]|$)",relevance:0},t.HASH_COMMENT_MODE,{beginKeywords:n,keywords:{literal:n}},m,{className:"number",begin:t.C_NUMBER_RE+"\\b",relevance:0},v,b,l,i],h=[..._];return h.pop(),h.push(s),f.contains=h,{name:"YAML",case_insensitive:!0,aliases:["yml"],contains:_}}const Wg={arduino:Tm,bash:Om,c:Am,cpp:Bm,csharp:Mm,css:Um,diff:zm,go:Hm,graphql:qm,ini:Gm,java:Km,javascript:Xm,json:Qm,kotlin:eg,less:sg,lua:cg,makefile:ug,markdown:dg,objectivec:pg,perl:fg,php:mg,"php-template":gg,plaintext:bg,python:vg,"python-repl":hg,r:_g,ruby:kg,rust:yg,scss:Ag,shell:Bg,sql:Mg,swift:Fg,typescript:zg,vbnet:Hg,wasm:qg,xml:Gg,yaml:Kg};function jg(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Go,xa;function Yg(){if(xa)return Go;xa=1;function t(k){return k instanceof Map?k.clear=k.delete=k.set=function(){throw new Error("map is read-only")}:k instanceof Set&&(k.add=k.clear=k.delete=function(){throw new Error("set is read-only")}),Object.freeze(k),Object.getOwnPropertyNames(k).forEach(N=>{const I=k[N],ee=typeof I;(ee==="object"||ee==="function")&&!Object.isFrozen(I)&&t(I)}),k}class n{constructor(N){N.data===void 0&&(N.data={}),this.data=N.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function o(k){return k.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function r(k,...N){const I=Object.create(null);for(const ee in k)I[ee]=k[ee];return N.forEach(function(ee){for(const xe in ee)I[xe]=ee[xe]}),I}const a="</span>",l=k=>!!k.scope,i=(k,{prefix:N})=>{if(k.startsWith("language:"))return k.replace("language:","language-");if(k.includes(".")){const I=k.split(".");return[`${N}${I.shift()}`,...I.map((ee,xe)=>`${ee}${"_".repeat(xe+1)}`)].join(" ")}return`${N}${k}`};class s{constructor(N,I){this.buffer="",this.classPrefix=I.classPrefix,N.walk(this)}addText(N){this.buffer+=o(N)}openNode(N){if(!l(N))return;const I=i(N.scope,{prefix:this.classPrefix});this.span(I)}closeNode(N){l(N)&&(this.buffer+=a)}value(){return this.buffer}span(N){this.buffer+=`<span class="${N}">`}}const c=(k={})=>{const N={children:[]};return Object.assign(N,k),N};class d{constructor(){this.rootNode=c(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(N){this.top.children.push(N)}openNode(N){const I=c({scope:N});this.add(I),this.stack.push(I)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(N){return this.constructor._walk(N,this.rootNode)}static _walk(N,I){return typeof I=="string"?N.addText(I):I.children&&(N.openNode(I),I.children.forEach(ee=>this._walk(N,ee)),N.closeNode(I)),N}static _collapse(N){typeof N!="string"&&N.children&&(N.children.every(I=>typeof I=="string")?N.children=[N.children.join("")]:N.children.forEach(I=>{d._collapse(I)}))}}class u extends d{constructor(N){super(),this.options=N}addText(N){N!==""&&this.add(N)}startScope(N){this.openNode(N)}endScope(){this.closeNode()}__addSublanguage(N,I){const ee=N.root;I&&(ee.scope=`language:${I}`),this.add(ee)}toHTML(){return new s(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function p(k){return k?typeof k=="string"?k:k.source:null}function m(k){return b("(?=",k,")")}function f(k){return b("(?:",k,")*")}function v(k){return b("(?:",k,")?")}function b(...k){return k.map(I=>p(I)).join("")}function _(k){const N=k[k.length-1];return typeof N=="object"&&N.constructor===Object?(k.splice(k.length-1,1),N):{}}function h(...k){return"("+(_(k).capture?"":"?:")+k.map(ee=>p(ee)).join("|")+")"}function w(k){return new RegExp(k.toString()+"|").exec("").length-1}function y(k,N){const I=k&&k.exec(N);return I&&I.index===0}const g=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function C(k,{joinWith:N}){let I=0;return k.map(ee=>{I+=1;const xe=I;let ye=p(ee),q="";for(;ye.length>0;){const F=g.exec(ye);if(!F){q+=ye;break}q+=ye.substring(0,F.index),ye=ye.substring(F.index+F[0].length),F[0][0]==="\\"&&F[1]?q+="\\"+String(Number(F[1])+xe):(q+=F[0],F[0]==="("&&I++)}return q}).map(ee=>`(${ee})`).join(N)}const E=/\b\B/,R="[a-zA-Z]\\w*",D="[a-zA-Z_]\\w*",A="\\b\\d+(\\.\\d+)?",P="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",j="\\b(0b[01]+)",O="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",M=(k={})=>{const N=/^#![ ]*\//;return k.binary&&(k.begin=b(N,/.*\b/,k.binary,/\b.*/)),r({scope:"meta",begin:N,end:/$/,relevance:0,"on:begin":(I,ee)=>{I.index!==0&&ee.ignoreMatch()}},k)},L={begin:"\\\\[\\s\\S]",relevance:0},U={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[L]},S={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[L]},H={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},T=function(k,N,I={}){const ee=r({scope:"comment",begin:k,end:N,contains:[]},I);ee.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const xe=h("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return ee.contains.push({begin:b(/[ ]+/,"(",xe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ee},X=T("//","$"),ie=T("/\\*","\\*/"),ge=T("#","$"),be={scope:"number",begin:A,relevance:0},Be={scope:"number",begin:P,relevance:0},$e={scope:"number",begin:j,relevance:0},Re={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[L,{begin:/\[/,end:/\]/,relevance:0,contains:[L]}]},Y={scope:"title",begin:R,relevance:0},le={scope:"title",begin:D,relevance:0},ce={begin:"\\.\\s*"+D,relevance:0};var Me=Object.freeze({__proto__:null,APOS_STRING_MODE:U,BACKSLASH_ESCAPE:L,BINARY_NUMBER_MODE:$e,BINARY_NUMBER_RE:j,COMMENT:T,C_BLOCK_COMMENT_MODE:ie,C_LINE_COMMENT_MODE:X,C_NUMBER_MODE:Be,C_NUMBER_RE:P,END_SAME_AS_BEGIN:function(k){return Object.assign(k,{"on:begin":(N,I)=>{I.data._beginMatch=N[1]},"on:end":(N,I)=>{I.data._beginMatch!==N[1]&&I.ignoreMatch()}})},HASH_COMMENT_MODE:ge,IDENT_RE:R,MATCH_NOTHING_RE:E,METHOD_GUARD:ce,NUMBER_MODE:be,NUMBER_RE:A,PHRASAL_WORDS_MODE:H,QUOTE_STRING_MODE:S,REGEXP_MODE:Re,RE_STARTERS_RE:O,SHEBANG:M,TITLE_MODE:Y,UNDERSCORE_IDENT_RE:D,UNDERSCORE_TITLE_MODE:le});function rt(k,N){k.input[k.index-1]==="."&&N.ignoreMatch()}function ht(k,N){k.className!==void 0&&(k.scope=k.className,delete k.className)}function Xe(k,N){N&&k.beginKeywords&&(k.begin="\\b("+k.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",k.__beforeBegin=rt,k.keywords=k.keywords||k.beginKeywords,delete k.beginKeywords,k.relevance===void 0&&(k.relevance=0))}function ut(k,N){Array.isArray(k.illegal)&&(k.illegal=h(...k.illegal))}function dt(k,N){if(k.match){if(k.begin||k.end)throw new Error("begin & end are not supported with match");k.begin=k.match,delete k.match}}function ue(k,N){k.relevance===void 0&&(k.relevance=1)}const ne=(k,N)=>{if(!k.beforeMatch)return;if(k.starts)throw new Error("beforeMatch cannot be used with starts");const I=Object.assign({},k);Object.keys(k).forEach(ee=>{delete k[ee]}),k.keywords=I.keywords,k.begin=b(I.beforeMatch,m(I.begin)),k.starts={relevance:0,contains:[Object.assign(I,{endsParent:!0})]},k.relevance=0,delete I.beforeMatch},re=["of","and","for","in","not","or","if","then","parent","list","value"],ze="keyword";function Ce(k,N,I=ze){const ee=Object.create(null);return typeof k=="string"?xe(I,k.split(" ")):Array.isArray(k)?xe(I,k):Object.keys(k).forEach(function(ye){Object.assign(ee,Ce(k[ye],N,ye))}),ee;function xe(ye,q){N&&(q=q.map(F=>F.toLowerCase())),q.forEach(function(F){const te=F.split("|");ee[te[0]]=[ye,Se(te[0],te[1])]})}}function Se(k,N){return N?Number(N):_t(k)?0:1}function _t(k){return re.includes(k.toLowerCase())}const at={},Qe=k=>{console.error(k)},Ht=(k,...N)=>{console.log(`WARN: ${k}`,...N)},pt=(k,N)=>{at[`${k}/${N}`]||(console.log(`Deprecated as of ${k}. ${N}`),at[`${k}/${N}`]=!0)},Mt=new Error;function qt(k,N,{key:I}){let ee=0;const xe=k[I],ye={},q={};for(let F=1;F<=N.length;F++)q[F+ee]=xe[F],ye[F+ee]=!0,ee+=w(N[F-1]);k[I]=q,k[I]._emit=ye,k[I]._multi=!0}function xo(k){if(Array.isArray(k.begin)){if(k.skip||k.excludeBegin||k.returnBegin)throw Qe("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),Mt;if(typeof k.beginScope!="object"||k.beginScope===null)throw Qe("beginScope must be object"),Mt;qt(k,k.begin,{key:"beginScope"}),k.begin=C(k.begin,{joinWith:""})}}function No(k){if(Array.isArray(k.end)){if(k.skip||k.excludeEnd||k.returnEnd)throw Qe("skip, excludeEnd, returnEnd not compatible with endScope: {}"),Mt;if(typeof k.endScope!="object"||k.endScope===null)throw Qe("endScope must be object"),Mt;qt(k,k.end,{key:"endScope"}),k.end=C(k.end,{joinWith:""})}}function So(k){k.scope&&typeof k.scope=="object"&&k.scope!==null&&(k.beginScope=k.scope,delete k.scope)}function To(k){So(k),typeof k.beginScope=="string"&&(k.beginScope={_wrap:k.beginScope}),typeof k.endScope=="string"&&(k.endScope={_wrap:k.endScope}),xo(k),No(k)}function Oo(k){function N(q,F){return new RegExp(p(q),"m"+(k.case_insensitive?"i":"")+(k.unicodeRegex?"u":"")+(F?"g":""))}class I{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(F,te){te.position=this.position++,this.matchIndexes[this.matchAt]=te,this.regexes.push([te,F]),this.matchAt+=w(F)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const F=this.regexes.map(te=>te[1]);this.matcherRe=N(C(F,{joinWith:"|"}),!0),this.lastIndex=0}exec(F){this.matcherRe.lastIndex=this.lastIndex;const te=this.matcherRe.exec(F);if(!te)return null;const Ve=te.findIndex((kn,Ao)=>Ao>0&&kn!==void 0),Ie=this.matchIndexes[Ve];return te.splice(0,Ve),Object.assign(te,Ie)}}class ee{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(F){if(this.multiRegexes[F])return this.multiRegexes[F];const te=new I;return this.rules.slice(F).forEach(([Ve,Ie])=>te.addRule(Ve,Ie)),te.compile(),this.multiRegexes[F]=te,te}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(F,te){this.rules.push([F,te]),te.type==="begin"&&this.count++}exec(F){const te=this.getMatcher(this.regexIndex);te.lastIndex=this.lastIndex;let Ve=te.exec(F);if(this.resumingScanAtSamePosition()&&!(Ve&&Ve.index===this.lastIndex)){const Ie=this.getMatcher(0);Ie.lastIndex=this.lastIndex+1,Ve=Ie.exec(F)}return Ve&&(this.regexIndex+=Ve.position+1,this.regexIndex===this.count&&this.considerAll()),Ve}}function xe(q){const F=new ee;return q.contains.forEach(te=>F.addRule(te.begin,{rule:te,type:"begin"})),q.terminatorEnd&&F.addRule(q.terminatorEnd,{type:"end"}),q.illegal&&F.addRule(q.illegal,{type:"illegal"}),F}function ye(q,F){const te=q;if(q.isCompiled)return te;[ht,dt,To,ne].forEach(Ie=>Ie(q,F)),k.compilerExtensions.forEach(Ie=>Ie(q,F)),q.__beforeBegin=null,[Xe,ut,ue].forEach(Ie=>Ie(q,F)),q.isCompiled=!0;let Ve=null;return typeof q.keywords=="object"&&q.keywords.$pattern&&(q.keywords=Object.assign({},q.keywords),Ve=q.keywords.$pattern,delete q.keywords.$pattern),Ve=Ve||/\w+/,q.keywords&&(q.keywords=Ce(q.keywords,k.case_insensitive)),te.keywordPatternRe=N(Ve,!0),F&&(q.begin||(q.begin=/\B|\b/),te.beginRe=N(te.begin),!q.end&&!q.endsWithParent&&(q.end=/\B|\b/),q.end&&(te.endRe=N(te.end)),te.terminatorEnd=p(te.end)||"",q.endsWithParent&&F.terminatorEnd&&(te.terminatorEnd+=(q.end?"|":"")+F.terminatorEnd)),q.illegal&&(te.illegalRe=N(q.illegal)),q.contains||(q.contains=[]),q.contains=[].concat(...q.contains.map(function(Ie){return z(Ie==="self"?q:Ie)})),q.contains.forEach(function(Ie){ye(Ie,te)}),q.starts&&ye(q.starts,F),te.matcher=xe(te),te}if(k.compilerExtensions||(k.compilerExtensions=[]),k.contains&&k.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return k.classNameAliases=r(k.classNameAliases||{}),ye(k)}function x(k){return k?k.endsWithParent||x(k.starts):!1}function z(k){return k.variants&&!k.cachedVariants&&(k.cachedVariants=k.variants.map(function(N){return r(k,{variants:null},N)})),k.cachedVariants?k.cachedVariants:x(k)?r(k,{starts:k.starts?r(k.starts):null}):Object.isFrozen(k)?r(k):k}var Q="11.11.1";class ve extends Error{constructor(N,I){super(N),this.name="HTMLInjectionError",this.html=I}}const de=o,Le=r,Ge=Symbol("nomatch"),Lt=7,_n=function(k){const N=Object.create(null),I=Object.create(null),ee=[];let xe=!0;const ye="Could not find the language '{}', did you forget to load/include a language module?",q={disableAutodetect:!0,name:"Plain text",contains:[]};let F={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:u};function te(B){return F.noHighlightRe.test(B)}function Ve(B){let W=B.className+" ";W+=B.parentNode?B.parentNode.className:"";const pe=F.languageDetectRe.exec(W);if(pe){const we=Vt(pe[1]);return we||(Ht(ye.replace("{}",pe[1])),Ht("Falling back to no-highlight mode for this block.",B)),we?pe[1]:"no-highlight"}return W.split(/\s+/).find(we=>te(we)||Vt(we))}function Ie(B,W,pe){let we="",De="";typeof W=="object"?(we=B,pe=W.ignoreIllegals,De=W.language):(pt("10.7.0","highlight(lang, code, ...args) has been deprecated."),pt("10.7.0",`Please use highlight(code, options) instead.
|
|
62
|
-
|
|
63
|
-
`,1;if(Io>1e5&&Io>K.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ee+=se,se.length}const yt=Vt(B);if(!yt)throw Qe(ye.replace("{}",B)),new Error('Unknown language: "'+B+'"');const xl=Oo(yt);let Ro="",ae=we||xl;const $r={},Pe=new F.__emitter(F);Cl();let Ee="",Fn=0,Gt=0,Io=0,Do=!1;try{if(yt.__emitTokens)yt.__emitTokens(W,Pe);else{for(ae.matcher.considerAll();;){Io++,Do?Do=!1:ae.matcher.considerAll(),ae.matcher.lastIndex=Gt;const V=ae.matcher.exec(W);if(!V)break;const K=W.substring(Gt,V.index),se=Vr(K,V);Gt=V.index+se}Vr(W.substring(Gt))}return Pe.finalize(),Ro=Pe.toHTML(),{language:B,value:Ro,relevance:Fn,illegal:!1,_emitter:Pe,_top:ae}}catch(V){if(V.message&&V.message.includes("Illegal"))return{language:B,value:de(W),illegal:!0,relevance:0,_illegalBy:{message:V.message,index:Gt,context:W.slice(Gt-100,Gt+100),mode:V.mode,resultSoFar:Ro},_emitter:Pe};if(xe)return{language:B,value:de(W),illegal:!1,relevance:0,errorRaised:V,_emitter:Pe,_top:ae};throw V}}function Ao(B){const W={value:de(B),illegal:!1,relevance:0,_top:q,_emitter:new F.__emitter(F)};return W._emitter.addText(B),W}function Bo(B,W){W=W||F.languages||Object.keys(N);const pe=Ao(B),we=W.filter(Vt).filter(Rr).map(Je=>kn(Je,B,!1));we.unshift(pe);const De=we.sort((Je,kt)=>{if(Je.relevance!==kt.relevance)return kt.relevance-Je.relevance;if(Je.language&&kt.language){if(Vt(Je.language).supersetOf===kt.language)return 1;if(Vt(kt.language).supersetOf===Je.language)return-1}return 0}),[ft,$t]=De,$n=ft;return $n.secondBest=$t,$n}function ul(B,W,pe){const we=W&&I[W]||pe;B.classList.add("hljs"),B.classList.add(`language-${we}`)}function Mo(B){let W=null;const pe=Ve(B);if(te(pe))return;if(Vn("before:highlightElement",{el:B,language:pe}),B.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",B);return}if(B.children.length>0&&(F.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(B)),F.throwUnescapedHTML))throw new ve("One of your code blocks includes unescaped HTML.",B.innerHTML);W=B;const we=W.textContent,De=pe?Ie(we,{language:pe,ignoreIllegals:!0}):Bo(we);B.innerHTML=De.value,B.dataset.highlighted="yes",ul(B,pe,De.language),B.result={language:De.language,re:De.relevance,relevance:De.relevance},De.secondBest&&(B.secondBest={language:De.secondBest.language,relevance:De.secondBest.relevance}),Vn("after:highlightElement",{el:B,result:De,text:we})}function dl(B){F=Le(F,B)}const pl=()=>{Ln(),pt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function fl(){Ln(),pt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let Br=!1;function Ln(){function B(){Ln()}if(document.readyState==="loading"){Br||window.addEventListener("DOMContentLoaded",B,!1),Br=!0;return}document.querySelectorAll(F.cssSelector).forEach(Mo)}function ml(B,W){let pe=null;try{pe=W(k)}catch(we){if(Qe("Language definition for '{}' could not be registered.".replace("{}",B)),xe)Qe(we);else throw we;pe=q}pe.name||(pe.name=B),N[B]=pe,pe.rawDefinition=W.bind(null,k),pe.aliases&&Mr(pe.aliases,{languageName:B})}function gl(B){delete N[B];for(const W of Object.keys(I))I[W]===B&&delete I[W]}function bl(){return Object.keys(N)}function Vt(B){return B=(B||"").toLowerCase(),N[B]||N[I[B]]}function Mr(B,{languageName:W}){typeof B=="string"&&(B=[B]),B.forEach(pe=>{I[pe.toLowerCase()]=W})}function Rr(B){const W=Vt(B);return W&&!W.disableAutodetect}function vl(B){B["before:highlightBlock"]&&!B["before:highlightElement"]&&(B["before:highlightElement"]=W=>{B["before:highlightBlock"](Object.assign({block:W.el},W))}),B["after:highlightBlock"]&&!B["after:highlightElement"]&&(B["after:highlightElement"]=W=>{B["after:highlightBlock"](Object.assign({block:W.el},W))})}function hl(B){vl(B),ee.push(B)}function _l(B){const W=ee.indexOf(B);W!==-1&&ee.splice(W,1)}function Vn(B,W){const pe=B;ee.forEach(function(we){we[pe]&&we[pe](W)})}function kl(B){return pt("10.7.0","highlightBlock will be removed entirely in v12.0"),pt("10.7.0","Please use highlightElement now."),Mo(B)}Object.assign(k,{highlight:Ie,highlightAuto:Bo,highlightAll:Ln,highlightElement:Mo,highlightBlock:kl,configure:dl,initHighlighting:pl,initHighlightingOnLoad:fl,registerLanguage:ml,unregisterLanguage:gl,listLanguages:bl,getLanguage:Vt,registerAliases:Mr,autoDetection:Rr,inherit:Le,addPlugin:hl,removePlugin:_l}),k.debugMode=function(){xe=!1},k.safeMode=function(){xe=!0},k.versionString=Q,k.regex={concat:b,lookahead:m,either:h,optional:v,anyNumberOfTimes:f};for(const B in Me)typeof Me[B]=="object"&&t(Me[B]);return Object.assign(k,Me),k},je=_n({});return je.newInstance=()=>_n({}),Go=je,je.HighlightJS=je,je.default=je,Go}var Zg=Yg();const Xg=jg(Zg),Na={},Qg="hljs-";function Jg(t){const n=Xg.newInstance();return t&&l(t),{highlight:o,highlightAuto:r,listLanguages:a,register:l,registerAlias:i,registered:s};function o(c,d,u){const p=u||Na,m=typeof p.prefix=="string"?p.prefix:Qg;if(!n.getLanguage(c))throw new Error("Unknown language: `"+c+"` is not registered");n.configure({__emitter:eb,classPrefix:m});const f=n.highlight(d,{ignoreIllegals:!0,language:c});if(f.errorRaised)throw new Error("Could not highlight with `Highlight.js`",{cause:f.errorRaised});const v=f._emitter.root,b=v.data;return b.language=f.language,b.relevance=f.relevance,v}function r(c,d){const p=(d||Na).subset||a();let m=-1,f=0,v;for(;++m<p.length;){const b=p[m];if(!n.getLanguage(b))continue;const _=o(b,c,d);_.data&&_.data.relevance!==void 0&&_.data.relevance>f&&(f=_.data.relevance,v=_)}return v||{type:"root",children:[],data:{language:void 0,relevance:f}}}function a(){return n.listLanguages()}function l(c,d){if(typeof c=="string")n.registerLanguage(c,d);else{let u;for(u in c)Object.hasOwn(c,u)&&n.registerLanguage(u,c[u])}}function i(c,d){if(typeof c=="string")n.registerAliases(typeof d=="string"?d:[...d],{languageName:c});else{let u;for(u in c)if(Object.hasOwn(c,u)){const p=c[u];n.registerAliases(typeof p=="string"?p:[...p],{languageName:u})}}}function s(c){return!!n.getLanguage(c)}}class eb{constructor(n){this.options=n,this.root={type:"root",children:[],data:{language:void 0,relevance:0}},this.stack=[this.root]}addText(n){if(n==="")return;const o=this.stack[this.stack.length-1],r=o.children[o.children.length-1];r&&r.type==="text"?r.value+=n:o.children.push({type:"text",value:n})}startScope(n){this.openNode(String(n))}endScope(){this.closeNode()}__addSublanguage(n,o){const r=this.stack[this.stack.length-1],a=n.root.children;o?r.children.push({type:"element",tagName:"span",properties:{className:[o]},children:a}):r.children.push(...a)}openNode(n){const o=this,r=n.split(".").map(function(i,s){return s?i+"_".repeat(s):o.options.classPrefix+i}),a=this.stack[this.stack.length-1],l={type:"element",tagName:"span",properties:{className:r},children:[]};a.children.push(l),this.stack.push(l)}closeNode(){this.stack.pop()}finalize(){}toHTML(){return""}}const tb=t=>({name:"Mermaid",aliases:["mermaid"],case_insensitive:!0,contains:[t.COMMENT(/%%(?!\{)/,/$/),{className:"meta",begin:/%%\{/,end:/\}%%/,contains:[{className:"attr",begin:/[A-Za-z][A-Za-z0-9_-]*(?=\s*:)/},{className:"string",begin:/:\s*/,end:/(?=(,\s*[A-Za-z]|$))/,excludeBegin:!0}]},{className:"meta",begin:/^---$/,end:/^---$/,contains:[{className:"attr",begin:/\b[A-Za-z][A-Za-z0-9_-]*(?=\s*:)/},{className:"string",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{className:"keyword",begin:/(^|\s)(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|journey|pie|gantt|requirement|sankey|timeline|quadrant|gitGraph|mindmap|xychart|block|packet|kanban|architecture|radar|treemap|C4Context)(?:\s+(?:LR|TB|RL|BT))?\b/},{className:"built_in",begin:/^(?:\s*)(participant|loop|end|Note right of|note|class|title|section|dateFormat|x-axis|y-axis|bar|line)\b/},{className:"symbol",begin:/(<<?-+>?|--+>|==+>|->|-\.-|==|->>|-->>|<\|--|--\|>|<\|>|:>|o--o|x--x|\*--|o\{--|\}o--)/,relevance:20},{className:"literal",begin:/\b[A-Za-z0-9_]+\s*-[->]+[A-Za-z0-9_]+\s*:/,end:/$/,contains:[{className:"string",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{className:"regexp",variants:[{begin:/\[[^\]]+\]/},{begin:/\([^)]+\)/},{begin:/\(\([^)]+\)\)/},{begin:/\{[^}]+\}/},{begin:/>[^<]+</},{begin:/\[\[[^\]]+\]\]/}]},{className:"string",begin:/note\s+(?:left|right|top|bottom)\s+of\s+[A-Za-z0-9_]+/i},{className:"string",variants:[{begin:/'.*?'/},{begin:/".*?"/}]},{className:"number",begin:/\b\d+([:.]\d+)?\b/}]});var Fe=[];for(var Ko=0;Ko<256;++Ko)Fe.push((Ko+256).toString(16).slice(1));function nb(t,n=0){return(Fe[t[n+0]]+Fe[t[n+1]]+Fe[t[n+2]]+Fe[t[n+3]]+"-"+Fe[t[n+4]]+Fe[t[n+5]]+"-"+Fe[t[n+6]]+Fe[t[n+7]]+"-"+Fe[t[n+8]]+Fe[t[n+9]]+"-"+Fe[t[n+10]]+Fe[t[n+11]]+Fe[t[n+12]]+Fe[t[n+13]]+Fe[t[n+14]]+Fe[t[n+15]]).toLowerCase()}var Zn,ob=new Uint8Array(16);function rb(){if(!Zn&&(Zn=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Zn))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Zn(ob)}var ab=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Sa={randomUUID:ab};function ib(t,n,o){if(Sa.randomUUID&&!t)return Sa.randomUUID();t=t||{};var r=t.random||(t.rng||rb)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,nb(r)}const lb=()=>ib(),sb={class:"code-block-toolbar"},cb={class:"wrap"},ub={class:"language readonly"},db={class:"wrap"},pb=["srcdoc"],fb={key:0,class:"preview"},mb={key:0,class:"error"},gb=["innerHTML"],bb=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t,{commonDownload:o}=mo(),{tr:r}=Z(),{darkMode:a}=tn(),{isEditable:l}=oe(),i=e.ref("content_copy"),s=e.ref(!1),c=e.ref(""),d=e.ref(""),u=e.ref(""),p=e.ref("splitVertical"),m=e.ref("default");Vo.registerLayoutLoaders(ns);const f={layout:"elk",elk:{},flowchart:{curve:"bumpY"}},v=e.computed({get(){return n.node.attrs.language},set(S){n.updateAttributes({language:S})}}),b=e.computed(()=>{var S;return((S=n.node.content.content[0])==null?void 0:S.text)||""}),_=e.computed({get(){return n.node.attrs.wrap},set(S){n.updateAttributes({wrap:S})}}),h=e.computed(()=>["html","svg"].includes(v.value)),w=e.computed(()=>_.value?"text_select_move_down":"format_text_wrap"),y=e.computed(()=>v.value==="mermaid"),g=e.computed(()=>v.value==="mermaid"?l.value?p.value:"preview":"");function C(S){v.value=S}function E(){const S=n.node.content.content[0].text;os.copyToClipboard(S).then(()=>{i.value="done",setTimeout(()=>{i.value="content_copy"},2e3)})}function R(S="code"){switch(S){case"svg":A();break;default:D();break}}function D(){const S=v.value;let H=S;const T=Qn.find(ge=>ge.value===S);T&&(H=T.ext.at(0));const X=`${S}-${Date.now()}.${H}`,ie=n.node.content.content[0].text;o("code",X,ie)}function A(){if(!d.value)return;const S=`mermaid-${Date.now()}.svg`,H=d.value;o("svg",S,H)}function P(){const S=n.node.content.content[0].text;c.value=j(S),s.value=!0}function j(S){return`
|
|
201
|
+
`],wV={key:0,class:"o-ai-menu tiptap-toolbar"},xV={key:0,class:"o-scroll"},CV={class:"view-main"},SV={key:1,class:"view-output"},EV={class:"action-container"},MV={class:"actions"},TV={key:0,class:"o-scroll"},NV=["innerHTML"],AV={class:"ai-io-panel"},OV={class:"o-flex o-item-center actions"},vC=c.defineComponent({__name:"OAiMenu",props:{editor:{type:Jt,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(n,{emit:e}){const t=n,o=e,{md:r,aiOption:i,createStreamingChatCompletion:s}=Ym(),{languageName:l,tr:a}=de(),u=c.ref(),d=c.ref(!1),f=c.ref(""),p=c.ref(""),h=c.ref("main"),m=c.ref(""),g=c.ref(!1),y=c.ref(!1),b=c.computed(()=>({role:"system",content:Xm.writing.replace("[LANGUAGE]",l.value)})),v=c.ref([{role:"system",content:"You are an assistant. Please answer in [LANGUAGE]."}]),w=c.computed(()=>T1.filter(R=>R.value.indexOf(f.value)>=0));function k(){const{from:R,to:I}=t.editor.state.selection;return t.editor.state.doc.textBetween(R,I,"")}function x(){setTimeout(()=>{d.value=!0},0)}function C(R,I){switch(I&&(d.value=!0),m.value=R.options.prompt.replaceAll("[CONTENT]",k()),R.value){case"translate":m.value=m.value.replace("[LANGUAGE]",I.value);break;case"changeTone":m.value=m.value.replace("[TONE]",I.value);break}return f.value=a(R.label),N(),!0}function S(){var R;O(),(R=u.value)==null||R.focus()}function M(){const R=Gp(t.editor,p.value);let I=0;for(const L of R.content){const B=_n.fromJSON(t.editor.schema,L);I+=B.nodeSize}t.editor.chain().focus().deleteSelection().insertContent(R.content).setTextSelection({from:t.editor.state.selection.from,to:t.editor.state.selection.from+I+1}).run(),O(),d.value=!1,setTimeout(()=>{o("confirm")},0)}function N(){h.value="output",g.value=!0,y.value?$():A()}async function A(){let R="";v.value.push({role:"user",content:m.value}),v.value[0].role==="system"&&(v.value.shift(),v.value.unshift(b.value));try{const I=await s(v.value,L=>{R+=L,v.value=[...v.value.slice(0,-1),{role:"assistant",content:R}],p.value=r.render(R)})}catch(I){v.value.pop(),console.error(I),ug.error(a("ai.error"))}g.value=!1}async function $(){let R="";for(const I of bC)await new Promise(L=>setTimeout(L,500)),R+=I,p.value=r.render(R);g.value=!1}function O(){h.value="main",p.value="",f.value=""}return c.onMounted(()=>{setTimeout(()=>{var R;(R=u.value)==null||R.focus(),d.value=!0},300)}),(R,I)=>n.editor?(c.openBlock(),c.createElementBlock("section",wV,[c.createVNode(c.unref(Eo),{modelValue:d.value,"onUpdate:modelValue":I[1]||(I[1]=L=>d.value=L),placement:"bottom-start","tippy-class":"ai-menu-popover","content-class":""},{"popover-content":c.withCtx(()=>[h.value==="main"?(c.openBlock(),c.createElementBlock("div",xV,[c.createElementVNode("section",CV,[c.createVNode(c.unref(Cd),{items:w.value,onSelect:C,"use-keyboard":d.value},null,8,["items","use-keyboard"])])])):c.createCommentVNode("",!0),h.value==="output"?(c.openBlock(),c.createElementBlock("section",SV,[c.createElementVNode("div",EV,[c.createElementVNode("div",null,[c.createVNode(c.unref(X),{name:"auto_awesome",class:"o-tips"})]),c.createElementVNode("div",MV,[c.createVNode(c.unref(Jn),{icon:"arrow_back","icon-class":"rotate-90",tooltip:"Confirm",loading:g.value,onClick:M},null,8,["loading"]),g.value?c.createCommentVNode("",!0):(c.openBlock(),c.createBlock(c.unref(Jn),{key:0,icon:"close",tooltip:"Cancel",onClick:S}))])]),p.value?(c.openBlock(),c.createElementBlock("div",TV,[c.createElementVNode("div",{class:"tiptap output",innerHTML:p.value},null,8,NV)])):c.createCommentVNode("",!0)])):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createElementVNode("section",AV,[c.createVNode(c.unref(Zn),{ref_key:"inputRef",ref:u,class:"caption-input",modelValue:f.value,"onUpdate:modelValue":I[0]||(I[0]=L=>f.value=L),type:"text",placeholder:c.unref(a)("ai.askAi"),autofocus:"",onFocus:x},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"auto_awesome",class:"o-tips"})]),suffix:c.withCtx(()=>[c.createElementVNode("div",OV,[c.createVNode(c.unref(Jn),{icon:"keyboard_return",tooltip:"Submit"})])]),_:1},8,["modelValue","placeholder"])])]),_:1},8,["modelValue"])])):c.createCommentVNode("",!0)}}),$V={key:0,class:"o-inline-math-menu tiptap-toolbar"},kC=c.defineComponent({__name:"OInlineMathMenu",props:{editor:{type:Jt,required:!0},menuClass:{type:String,default:""}},emits:["confirm"],setup(n,{emit:e}){const t=n,o=e,{run:r}=ke(),i=c.ref(null),s=c.ref(""),l=c.ref(null);c.computed(()=>{const f=Ko.getState(t.editor.state);return!!(f!=null&&f.active)});function a(){if(s.value="",l.value=null,t.editor.isActive("inlineMath")){const{state:f}=t.editor,{selection:p,schema:h}=f;if(p instanceof Q){const m=p.node;l.value=p.from,m.type.name==="inlineMath"&&(s.value=m.attrs.latex)}}setTimeout(()=>{var f;(f=i.value)==null||f.focus()},300)}function u(){console.log("latex",s.value,l.value),l.value?s.value?r(t.editor,"inlineMathUpdate",{latex:s.value}):r(t.editor,"inlineMathDelete",{pos:l.value}):s.value&&r(t.editor,"inlineMathInsert",{latex:s.value}),setTimeout(()=>{o("confirm")},0)}const d=()=>{t.editor.view.dispatch(t.editor.state.tr.setMeta(Ko,{type:"hide"}))};return c.onMounted(()=>{a(),t.editor.on("focus",d)}),c.onUnmounted(()=>{t.editor.off("focus",d)}),(f,p)=>n.editor?(c.openBlock(),c.createElementBlock("section",$V,[c.createVNode(c.unref(Zn),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":p[0]||(p[0]=h=>s.value=h),type:"text",autofocus:"",clearable:"",onKeydown:c.withKeys(c.withModifiers(u,["prevent"]),["enter"])},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"function",class:"o-tips"})]),suffix:c.withCtx(()=>[s.value?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"keyboard_return",class:"clear o-tips",onClick:u})):c.createCommentVNode("",!0)]),_:1},8,["modelValue","onKeydown"])])):c.createCommentVNode("",!0)}}),BV={key:0,class:"spinner"},Jn=c.defineComponent({__name:"OCommonBtn",props:{icon:{type:String,default:""},color:{type:String,default:""},background:{type:String,default:""},tooltip:{type:String,default:""},placement:{type:String,default:"top"},disabled:{type:Boolean,default:!1},loading:{type:Boolean,default:!1},contentClass:{type:[String,Object],default:""},contentStyle:{type:[String,Object],default:""},iconClass:{type:[String,Object],default:""}},emits:["click"],setup(n,{emit:e}){const t=n,o=e;function r(i){t.loading||o("click",i)}return(i,s)=>(c.openBlock(),c.createBlock(c.unref(zn),{placement:n.placement},{trigger:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["o-menubar-btn o-command-btn o-btn",n.contentClass]),style:c.normalizeStyle(n.contentStyle),onClick:c.withModifiers(r,["stop"])},[n.loading?(c.openBlock(),c.createElementBlock("div",BV)):(c.openBlock(),c.createBlock(c.unref(X),{key:1,name:n.icon,color:n.color,class:c.normalizeClass(n.iconClass)},null,8,["name","color","class"])),c.renderSlot(i.$slots,"default")],6)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(n.tooltip),1)]),_:3},8,["placement"]))}}),RV=c.defineComponent({__name:"OAiBtn",props:{name:{type:String,default:""},editor:{type:Object}},setup(n){const{tr:e}=de();return(t,o)=>(c.openBlock(),c.createBlock(Jn,{"content-class":"o-ai-btn",icon:"auto_awesome",color:c.unref(pe).purple,tooltip:c.unref(e)("ai.askAi")},null,8,["color","tooltip"]))}}),_V={class:"o-align-group"},DV=c.defineComponent({__name:"OAlignGroup",props:{editor:{type:Jt}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.computed(()=>[{label:t("editor.left"),value:"left",icon:"format_align_left"},{label:t("editor.center"),value:"center",icon:"format_align_center"},{label:t("editor.right"),value:"right",icon:"format_align_right"}]);function i(s){o(e.editor,"textAlign",{textAlign:s.value})}return(s,l)=>(c.openBlock(),c.createElementBlock("div",_V,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(a,u)=>{var d;return c.openBlock(),c.createBlock(Ae,{key:u,icon:a.icon,tooltip:a.label,"content-class":{"is-active":(d=n.editor)==null?void 0:d.isActive({textAlign:a.value})},onClick:f=>i(a)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),IV={class:"o-background-color-dropdown o-button-group"},LV=c.defineComponent({__name:"OBackgroundColorDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(null),i=c.ref("#ffec3d");function s(){l(i.value)}function l(a){r.value.setShow(!1),i.value=a,o(e.editor,"backgroundColor",{color:a})}return(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(zn),null,{trigger:c.withCtx(()=>[c.createElementVNode("div",IV,[c.createVNode(c.unref(He),{icon:"background_color",class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),c.createVNode(c.unref(He),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.highlightColor")),1)]),_:1})]),default:c.withCtx(()=>{var d;return[c.createVNode(c.unref(ki),{"default-color":"","default-label":c.unref(t)("editor.noColor"),"active-color":(d=n.editor)==null?void 0:d.getAttributes("textStyle").backgroundColor,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),PV={class:"o-highlight-dropdown o-button-group"},VV=c.defineComponent({__name:"OHighlightDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(null),i=c.ref("#ffec3d");function s(){l(i.value)}function l(a){r.value.setShow(!1),i.value=a,o(e.editor,"highlight",{color:a})}return(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(zn),null,{trigger:c.withCtx(()=>[c.createElementVNode("div",PV,[c.createVNode(c.unref(He),{icon:"ink_highlighter",class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),c.createVNode(c.unref(He),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.highlightColor")),1)]),_:1})]),default:c.withCtx(()=>{var d;return[c.createVNode(c.unref(ki),{"default-color":"","default-label":c.unref(t)("editor.noColor"),"active-color":(d=n.editor)==null?void 0:d.getAttributes("highlight").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),zV=c.defineComponent({__name:"ODetailsBtn",props:{editor:{type:Object}},setup(n){const e=n,{run:t}=ke(),{tr:o}=de();function r(){const{state:i}=e.editor,{selection:s}=i,{$from:l}=s,u=l.node().type.name;t(e.editor,"details",{type:u})}return(i,s)=>{var l;return c.openBlock(),c.createBlock(Ae,{class:"o-details-btn",icon:"toggle_list",tooltip:c.unref(o)("editor.toggleList"),"content-class":{"is-active":(l=n.editor)==null?void 0:l.isActive("details")},onClick:r},null,8,["tooltip","content-class"])}}}),FV=c.defineComponent({__name:"OEmojiBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(null);function i(s){var l;(l=r.value)==null||l.setShow(!1),o(e.editor,"content",{content:s.emoji})}return(s,l)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","tippy-class":"o-emoji-popover",placement:"bottom",trigger:"click",arrow:""},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"emoji_emotions","content-class":"o-emoji-btn",tooltip:c.unref(t)("editor.emoji")},null,8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Sd),{items:c.unref(Tl.emojiGroups),onSelect:i,"enable-search":""},null,8,["items"])]),_:1},512))}}),HV=c.defineComponent({__name:"OFontFamilyDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(null),i=c.computed(()=>[{label:t("editor.default"),value:"system-ui"},{label:"Arial",value:"Arial",separator:!0},{label:"Arial Black",value:"Arial Black"},{label:"Georgia",value:"Georgia"},{label:"Impact",value:"Impact"},{label:"Helvetica",value:"Helvetica"},{label:"Roboto",value:"Roboto"},{label:"Tahoma",value:"Tahoma"},{label:"Times New Roman",value:"Times New Roman"},{label:"Verdana",value:"Verdana"},{label:"Courier New",value:"Courier New",separator:!0},{label:"Monaco",value:"Monaco"},{label:"Monospace",value:"monospace"}]);function s(l){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,"fontFamily",{fontFamily:l})}return(l,a)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"format_font","content-class":"o-font-family-dropdown dropdown",tooltip:c.unref(t)("editor.fontFamily")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>{var f;return c.openBlock(),c.createElementBlock(c.Fragment,{key:d},[u.separator?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive("textStyle",{fontFamily:u.value})}),onClick:p=>s(u.value)},{suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive("textStyle",{fontFamily:u.value})?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createElementVNode("span",{style:c.normalizeStyle(`font-family: ${u.value}`)},c.toDisplayString(u.label),5)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),jV={class:"o-fore-color-dropdown o-button-group"},UV=c.defineComponent({__name:"OColorDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(null),i=c.ref("#ff4d4f");function s(){l(i.value)}function l(a){var u;(u=r.value)==null||u.setShow(!1),i.value=a,o(e.editor,"color",{color:a})}return(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(zn),null,{trigger:c.withCtx(()=>[c.createElementVNode("div",jV,[c.createVNode(c.unref(He),{icon:"format_color_text",class:"o-command-btn label",onClick:c.withModifiers(s,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("div",{class:"indicator",style:c.normalizeStyle(`background: ${i.value}`)},null,4)]),_:1}),c.createVNode(c.unref(He),{icon:"arrow_drop_down",class:"o-command-btn"})])]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.textColor")),1)]),_:1})]),default:c.withCtx(()=>{var d;return[c.createVNode(c.unref(ki),{"default-color":"","default-label":c.unref(t)("editor.defaultColor"),"active-color":(d=n.editor)==null?void 0:d.getAttributes("textStyle").color,onSelect:l},null,8,["default-label","active-color"])]}),_:1},512))}}),WV=c.defineComponent({__name:"OHeadingDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(null),i=c.computed(()=>[{label:t("editor.paragraph"),value:"paragraph",valueAlt:"",icon:"title"},{label:t("editor.heading1"),value:"heading",valueAlt:1,icon:"format_h1",separator:!0},{label:t("editor.heading2"),value:"heading",valueAlt:2,icon:"format_h2"},{label:t("editor.heading3"),value:"heading",valueAlt:3,icon:"format_h3"},{label:t("editor.heading4"),value:"heading",valueAlt:4,icon:"format_h4"},{label:t("editor.heading5"),value:"heading",valueAlt:5,icon:"format_h5"}]);function s(a){var u,d;return a.value==="heading"?(u=e.editor)==null?void 0:u.isActive(a.value,{level:a.valueAlt}):(d=e.editor)==null?void 0:d.isActive(a.value)}function l(a){var u;(u=r.value)==null||u.setShow(!1),o(e.editor,a.value,{level:a.valueAlt})}return(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"format_header_pound","content-class":"o-heading-dropdown dropdown",tooltip:c.unref(t)("editor.heading")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(d,f)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:f},[d.separator?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:c.normalizeClass({"is-active":s(d)}),onClick:p=>l(d)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:d.icon},null,8,["name"])]),suffix:c.withCtx(()=>[s(d)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),qV=c.defineComponent({__name:"OInlineMathEditBtn",props:{editor:{type:Jt,required:!0}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(),i=c.ref(!1),s=c.ref(""),l=c.ref(null);function a(){if(e.editor.isActive("inlineMath")){const{state:p}=e.editor,{selection:h,schema:m}=p;if(h instanceof Q){const g=h.node;l.value=h.from,g.type.name==="inlineMath"&&(s.value=g.attrs.latex)}}}function u(){var p;(p=r.value)==null||p.setShow(!1)}function d(p){var h;console.log("confirm",p),p?o(e.editor,"inlineMathUpdate",{latex:p,pos:l.value}):o(e.editor,"inlineMathDelete",{pos:l.value}),(h=r.value)==null||h.setShow(!1)}function f(){window.open("https://katex.org/docs/supported.html","target")}return(p,h)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[h[0]||(h[0]=m=>i.value=m),a]},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"edit",tooltip:c.unref(t)("label.edit")},null,8,["tooltip"])]),default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(Ed),{key:0,title:c.unref(t)("label.edit"),val:s.value,icon:"function",onCancel:u,onConfirm:d},{"header-right":c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"help",tooltip:c.unref(t)("label.help"),onClick:f},null,8,["tooltip"])]),_:1},8,["title","val"])):c.createCommentVNode("",!0)]),_:1},8,["show"]))}}),KV={class:"o-list-dropdown o-button-group"},JV=c.defineComponent({__name:"OListDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(null),i=c.ref();function s(){o(e.editor,i.value.value)}function l(u){r.value.setShow(!1),i.value=u,o(e.editor,u.value)}const a=c.computed(()=>[{label:t("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:t("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:t("editor.todoList"),value:"taskList",icon:"check_box"}]);return c.onMounted(()=>{i.value=a.value[0]}),(u,d)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(zn),null,{trigger:c.withCtx(()=>{var f;return[c.createElementVNode("div",KV,[c.createVNode(c.unref(He),{icon:(f=i.value)==null?void 0:f.icon,class:"o-command-btn",onClick:c.withModifiers(s,["stop"])},null,8,["icon"]),c.createVNode(c.unref(He),{icon:"arrow_drop_down",class:"o-command-btn"})])]}),default:c.withCtx(()=>{var f;return[c.createTextVNode(" "+c.toDisplayString((f=i.value)==null?void 0:f.label),1)]}),_:1})]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(a.value,(f,p)=>{var h;return c.openBlock(),c.createBlock(c.unref(Ut),{key:p,class:c.normalizeClass({"is-active":(h=n.editor)==null?void 0:h.isActive(f.value)}),onClick:m=>l(f)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:f.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var m;return[(m=n.editor)!=null&&m.isActive(f.value)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(f.label)+" ",1)]),_:2},1032,["class","onClick"])}),128))]),_:1})]),_:1},512))}}),GV={class:"o-list-group"},XV=c.defineComponent({__name:"OListGroup",props:{editor:{type:Jt,required:!0}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.computed(()=>[{label:t("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:t("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:t("editor.todoList"),value:"taskList",icon:"check_box"}]);function i(s){o(e.editor,s.value)}return(s,l)=>(c.openBlock(),c.createElementBlock("div",GV,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(r.value,(a,u)=>{var d;return c.openBlock(),c.createBlock(Ae,{key:u,icon:a.icon,tooltip:a.label,"content-class":{"is-active":(d=n.editor)==null?void 0:d.isActive(a.value)},onClick:f=>i(a)},null,8,["icon","tooltip","content-class","onClick"])}),128))]))}}),YV=c.defineComponent({__name:"OLinkEditBtn",props:{editor:{type:Jt,required:!0}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(),i=c.ref(!1),s=c.ref(""),l=c.ref(!0);function a(){var p;s.value="",l.value=!0;const f=(p=e.editor)==null?void 0:p.getAttributes("link");f!=null&&f.href&&(s.value=f.href,l.value=f.target==="_blank")}function u(){var f;(f=r.value)==null||f.setShow(!1)}function d(f){var p;f?o(e.editor,"linkSet",{href:f,target:l.value?"_blank":""}):o(e.editor,"linkUnset"),(p=r.value)==null||p.setShow(!1)}return(f,p)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:"",show:i.value,"onUpdate:show":[p[1]||(p[1]=h=>i.value=h),a]},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"edit",tooltip:c.unref(t)("link.edit")},null,8,["tooltip"])]),default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(Ed),{key:0,title:c.unref(t)("link.edit"),val:s.value,icon:"link",onCancel:u,onConfirm:d},{"header-right":c.withCtx(()=>[c.createVNode(c.unref(dg),{modelValue:l.value,"onUpdate:modelValue":p[0]||(p[0]=h=>l.value=h),label:c.unref(t)("link.openInNewTab")},null,8,["modelValue","label"])]),_:1},8,["title","val"])):c.createCommentVNode("",!0)]),_:1},8,["show"]))}}),QV=c.defineComponent({__name:"OLinkOpenBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de();function o(){var i;const r=(i=e.editor)==null?void 0:i.getAttributes("link");r!=null&&r.href&&window.open(r.href,"target")}return(r,i)=>(c.openBlock(),c.createBlock(Ae,{icon:"open_in_new",tooltip:c.unref(t)("link.open"),"content-class":"o-link-open-btn",onClick:o},null,8,["tooltip"]))}}),ZV={class:"o-command-btn"},ez={class:"o-more-bubble"},tz=c.defineComponent({__name:"OMoreBubble",props:{editor:{type:Jt,required:!0}},setup(n){const e=c.ref();return(t,o)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:e,offset:[4,10],class:"o-simple-command-btn","content-class":"o-more-bubble-popover",placement:"top-end",size:"medium",trigger:"mouseenter"},{trigger:c.withCtx(()=>[c.createElementVNode("div",ZV,[c.createVNode(c.unref(X),{name:"more_horiz"})])]),default:c.withCtx(()=>[c.createElementVNode("section",ez,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(I1),(r,i)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:i},[r==="separator"?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0,vertical:""})):typeof r=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(Od)(r)),{key:1,name:r,editor:n.editor},null,8,["name","editor"])):c.createCommentVNode("",!0)],64))),128))])]),_:1},512))}}),nz=c.defineComponent({__name:"OStyleDropdown",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(null),i=c.computed(()=>[{label:t("editor.paragraph"),value:"paragraph",icon:"title"},{label:t("editor.heading1"),value:"heading",icon:"format_h1",options:{level:1}},{label:t("editor.heading2"),value:"heading",icon:"format_h2",options:{level:2}},{label:t("editor.heading3"),value:"heading",icon:"format_h3",options:{level:3}},{label:t("editor.todoList"),value:"taskList",icon:"check_box"},{label:t("editor.unorderedList"),value:"bulletList",icon:"format_list_bulleted"},{label:t("editor.orderedList"),value:"orderedList",icon:"format_list_numbered"},{label:t("editor.blockquote"),value:"blockquote",icon:"format_quote_open"},{label:t("editor.removeFormat"),value:"clearFormat",icon:"format_clear",separator:!0}]);function s(a){var u;return(u=e.editor)==null?void 0:u.isActive(a.value,a.options)}function l(a){r.value.setShow(!1),o(e.editor,a.value,a.options)}return(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click"},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"format_paint","content-class":"o-style-dropdown o-command-btn dropdown",tooltip:c.unref(t)("label.styles")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(d,f)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:f},[d.separator?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:c.normalizeClass({"is-active":s(d)}),onClick:p=>l(d)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:d.icon},null,8,["name"])]),suffix:c.withCtx(()=>[s(d)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(d.label)+" ",1)]),_:2},1032,["class","onClick"])],64))),128))]),_:1})]),_:1},512))}}),oz=c.defineComponent({__name:"OTableBtn",props:{editor:{type:Object}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(null);function i(s){var l;(l=r.value)==null||l.setShow(!1),o(e.editor,"tableInsert",s)}return(s,l)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",placement:"bottom",trigger:"click",arrow:""},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"window","content-class":"o-table-btn",tooltip:c.unref(t)("table.insert")},null,8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(K1),{onSelect:i})]),_:1},512))}}),rz={class:"o-table-group"},iz=c.defineComponent({__name:"OTableGroup",props:{editor:{type:Jt,required:!0}},setup(n){const{tr:e}=de(),{run:t}=ke();return(o,r)=>{var i,s;return c.openBlock(),c.createElementBlock("section",rz,[(i=n.editor)!=null&&i.can().mergeCells()?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,icon:"cell_merge",tooltip:c.unref(e)("table.merge"),onClick:r[0]||(r[0]=l=>c.unref(t)(n.editor,"tableMergeCells"))},null,8,["tooltip"])):c.createCommentVNode("",!0),(s=n.editor)!=null&&s.can().splitCell()?(c.openBlock(),c.createBlock(c.unref(Ae),{key:1,icon:"splitscreen_left",tooltip:c.unref(e)("table.split"),onClick:r[1]||(r[1]=l=>c.unref(t)(n.editor,"tableSplitCell"))},null,8,["tooltip"])):c.createCommentVNode("",!0),c.createVNode(c.unref(J1),{editor:n.editor},null,8,["editor"])])}}}),sz=c.defineComponent({__name:"OTextColorDropdown",props:{editor:{type:Jt}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(null),i=c.ref(""),s=c.ref("");function l(a){a.name==="color"?(i.value=a.value,localStorage.setItem("yiitap.text-color.fore",a.value)):a.name==="backColor"&&(s.value=a.value,localStorage.setItem("yiitap.text-color.back",a.value)),r.value.setShow(!1),o(e.editor,a.name,{color:a.value})}return c.onMounted(()=>{i.value=localStorage.getItem("yiitap.text-color.fore")||"",s.value=localStorage.getItem("yiitap.text-color.back")||""}),(a,u)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn",size:"medium",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"format_text","content-class":"o-text-color-dropdown dropdown",tooltip:c.unref(t)("editor.textColor")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>{var d;return[c.createVNode(c.unref(og),{"fore-color":i.value,"back-color":s.value,"default-label":c.unref(t)("editor.defaultColor"),"active-color":(d=n.editor)==null?void 0:d.getAttributes("textStyle").color,onSelect:l},null,8,["fore-color","back-color","default-label","active-color"])]}),_:1},512))}}),lz=c.defineComponent({__name:"OTextFormatDropdown",props:{editor:{type:Jt}},setup(n){const e=n,{tr:t}=de(),{run:o}=ke(),r=c.ref(),i=c.computed(()=>[{label:t("editor.strikethrough"),value:"strike",icon:"format_strikethrough"},{label:t("editor.underline"),value:"underline",icon:"format_underlined"},{label:t("editor.code"),value:"code",icon:"code",separator:!0},{label:t("editor.subscript"),value:"subscript",icon:"subscript",separator:!0},{label:t("editor.superscript"),value:"superscript",icon:"superscript"}]);function s(l){var a;(a=r.value)==null||a.setShow(!1),o(e.editor,l)}return(l,a)=>(c.openBlock(),c.createBlock(c.unref($e),{ref_key:"popover",ref:r,class:"o-simple-command-btn","content-class":"dropdown",trigger:"click","show-arrow":!1},{trigger:c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"title","content-class":"o-text-format-dropdown dropdown",tooltip:c.unref(t)("editor.textFormat")},{default:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"arrow_drop_down",class:"arrow"})]),_:1},8,["tooltip"])]),default:c.withCtx(()=>[c.createVNode(c.unref(ln),{hoverable:"",clickable:""},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(i.value,(u,d)=>{var f;return c.openBlock(),c.createElementBlock(c.Fragment,{key:d},[u.separator?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ut),{class:c.normalizeClass({"is-active":(f=n.editor)==null?void 0:f.isActive(u.value)}),onClick:p=>s(u.value)},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:u.icon},null,8,["name"])]),suffix:c.withCtx(()=>{var p;return[(p=n.editor)!=null&&p.isActive(u.value)?(c.openBlock(),c.createBlock(c.unref(X),{key:0,name:"done",small:""})):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(u.label)+" ",1)]),_:2},1032,["class","onClick"])],64)}),128))]),_:1})]),_:1},512))}}),az={ai:RV,"align-dropdown":Qm,"align-group":DV,"background-color":LV,color:UV,details:zV,"font-family":HV,heading:WV,highlight:VV,"inline-math-edit":qV,"list-dropdown":JV,"list-group":XV,link:Zm,"link-edit":YV,"link-open":QV,emoji:FV,more:tz,"style-dropdown":nz,table:oz,"table-group":iz,"text-color-dropdown":sz,"text-format-dropdown":lz},Od=n=>az[n]||aI,cz={key:0,class:"o-main-menu"},uz={class:"left"},dz={class:"right"},wC=c.defineComponent({__name:"OMainMenu",props:{editor:{type:Object},menu:{type:Array,default:function(){return[]}}},setup(n){const e=n,t=c.computed(()=>{var r;let o=e.menu;return(r=e.editor)!=null&&r.isActive("table")&&(o=O1),o.length>0?o:A1});return(o,r)=>n.editor?(c.openBlock(),c.createElementBlock("section",cz,[c.createElementVNode("section",uz,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.value,(i,s)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:s},[i==="separator"?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0,vertical:""})):typeof i=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(Od)(i)),{key:1,name:i,editor:n.editor},null,8,["name","editor"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i),{key:2,editor:n.editor},null,8,["editor"]))],64))),128)),c.renderSlot(o.$slots,"left")]),c.createElementVNode("section",dz,[c.renderSlot(o.$slots,"right")])])):c.createCommentVNode("",!0)}});let Qp,Zp;if(typeof WeakMap<"u"){let n=new WeakMap;Qp=e=>n.get(e),Zp=(e,t)=>(n.set(e,t),t)}else{const n=[];let t=0;Qp=o=>{for(let r=0;r<n.length;r+=2)if(n[r]==o)return n[r+1]},Zp=(o,r)=>(t==10&&(t=0),n[t++]=o,n[t++]=r)}var st=class{constructor(n,e,t,o){this.width=n,this.height=e,this.map=t,this.problems=o}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const o=e%this.width,r=e/this.width|0;let i=o+1,s=r+1;for(let l=1;i<this.width&&this.map[e+l]==t;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:o,top:r,right:i,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:o,right:r,top:i,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?o==0:r==this.width)?null:this.map[i*this.width+(t<0?o-1:r)]:(t<0?i==0:s==this.height)?null:this.map[o+this.width*(t<0?i-1:s)]}rectBetween(n,e){const{left:t,right:o,top:r,bottom:i}=this.findCell(n),{left:s,right:l,top:a,bottom:u}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(r,a),right:Math.max(o,l),bottom:Math.max(i,u)}}cellsInRect(n){const e=[],t={};for(let o=n.top;o<n.bottom;o++)for(let r=n.left;r<n.right;r++){const i=o*this.width+r,s=this.map[i];t[s]||(t[s]=!0,!(r==n.left&&r&&this.map[i-1]==s||o==n.top&&o&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let o=0,r=0;;o++){const i=r+t.child(o).nodeSize;if(o==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<r;)s++;return s==l?i-1:this.map[s]}r=i}}static get(n){return Qp(n)||Zp(n,fz(n))}};function fz(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=pz(n),t=n.childCount,o=[];let r=0,i=null;const s=[];for(let u=0,d=e*t;u<d;u++)o[u]=0;for(let u=0,d=0;u<t;u++){const f=n.child(u);d++;for(let m=0;;m++){for(;r<o.length&&o[r]!=0;)r++;if(m==f.childCount)break;const g=f.child(m),{colspan:y,rowspan:b,colwidth:v}=g.attrs;for(let w=0;w<b;w++){if(w+u>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:b-w});break}const k=r+w*e;for(let x=0;x<y;x++){o[k+x]==0?o[k+x]=d:(i||(i=[])).push({type:"collision",row:u,pos:d,n:y-x});const C=v&&v[x];if(C){const S=(k+x)%e*2,M=s[S];M==null||M!=C&&s[S+1]==1?(s[S]=C,s[S+1]=1):M==C&&s[S+1]++}}}r+=y,d+=g.nodeSize}const p=(u+1)*e;let h=0;for(;r<p;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:u,n:h}),d++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new st(e,t,o,i);let a=!1;for(let u=0;!a&&u<s.length;u+=2)s[u]!=null&&s[u+1]<t&&(a=!0);return a&&hz(l,s,n),l}function pz(n){let e=-1,t=!1;for(let o=0;o<n.childCount;o++){const r=n.child(o);let i=0;if(t)for(let s=0;s<o;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const u=l.child(a);s+u.attrs.rowspan>o&&(i+=u.attrs.colspan)}}for(let s=0;s<r.childCount;s++){const l=r.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function hz(n,e,t){n.problems||(n.problems=[]);const o={};for(let r=0;r<n.map.length;r++){const i=n.map[r];if(o[i])continue;o[i]=!0;const s=t.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=s.attrs;for(let u=0;u<a.colspan;u++){const d=e[(r+u)%n.width*2];d!=null&&(!a.colwidth||a.colwidth[u]!=d)&&((l||(l=mz(a)))[u]=d)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function mz(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function Wt(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const o=n.nodes[t],r=o.spec.tableRole;r&&(e[r]=o)}}return e}const br=new ce("selectingCells");function xi(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function gz(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function no(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function $d(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=xi(e.$head)||yz(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function yz(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function eh(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function bz(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function fg(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function xC(n,e,t){const o=n.node(-1),r=st.get(o),i=n.start(-1),s=r.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function Ci(n,e,t=1){const o={...n,colspan:n.colspan-t};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,t),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function CC(n,e,t=1){const o={...n,colspan:n.colspan+t};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<t;r++)o.colwidth.splice(e,0,0)}return o}function vz(n,e,t){const o=Wt(e.type.schema).header_cell;for(let r=0;r<n.height;r++)if(e.nodeAt(n.map[t+r*n.width]).type!=o)return!1;return!0}var ze=class Fo extends se{constructor(e,t=e){const o=e.node(-1),r=st.get(o),i=e.start(-1),s=r.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=r.cellsInRect(s).filter(d=>d!=t.pos-i);a.unshift(t.pos-i);const u=a.map(d=>{const f=o.nodeAt(d);if(!f)throw new RangeError(`No cell with offset ${d} found`);const p=i+d+1;return new Hw(l.resolve(p),l.resolve(p+f.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=t}map(e,t){const o=e.resolve(t.map(this.$anchorCell.pos)),r=e.resolve(t.map(this.$headCell.pos));if(eh(o)&&eh(r)&&fg(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?Fo.rowSelection(o,r):i&&this.isColSelection()?Fo.colSelection(o,r):new Fo(o,r)}return q.between(o,r)}content(){const e=this.$anchorCell.node(-1),t=st.get(e),o=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},s=[];for(let a=r.top;a<r.bottom;a++){const u=[];for(let d=a*t.width+r.left,f=r.left;f<r.right;f++,d++){const p=t.map[d];if(i[p])continue;i[p]=!0;const h=t.findCell(p);let m=e.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const g=r.left-h.left,y=h.right-r.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=Ci(b,0,g)),y>0&&(b=Ci(b,b.colspan-y,y)),h.left<r.left){if(m=m.type.createAndFill(b),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(h.top<r.top||h.bottom>r.bottom){const b={...m.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}u.push(m)}s.push(e.child(a).copy(D.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new H(D.from(l),1,1)}replace(e,t=H.empty){const o=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){const{$from:l,$to:a}=r[s],u=e.mapping.slice(o);e.replace(u.map(l.pos),u.map(a.pos),s?H.empty:t)}const i=se.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new H(D.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),o=st.get(t),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let s=0;s<i.length;s++)e(t.nodeAt(i[s]),r+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const o=e.node(-1),r=st.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+r.map[s.left])),l.bottom<r.height&&(t=a.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(i+r.map[l.left])),s.bottom<r.height&&(e=a.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))),new Fo(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=st.get(e),o=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-o),i=t.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;const s=r+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof Fo&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const o=e.node(-1),r=st.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(t=a.resolve(i+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(e=a.resolve(i+r.map[r.width*(s.top+1)-1]))),new Fo(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Fo(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){return new Fo(e.resolve(t),e.resolve(o))}getBookmark(){return new kz(this.$anchorCell.pos,this.$headCell.pos)}};ze.prototype.visible=!1;se.jsonID("cell",ze);var kz=class SC{constructor(e,t){this.anchor=e,this.head=t}map(e){return new SC(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),o=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&o.index()<o.parent.childCount&&fg(t,o)?new ze(t,o):se.near(o,1)}};function wz(n){if(!(n.selection instanceof ze))return null;const e=[];return n.selection.forEachCell((t,o)=>{e.push(Ve.node(o,o+t.nodeSize,{class:"selectedCell"}))}),Se.create(n.doc,e)}function xz({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,o=e.pos,r=n.depth;for(;r>=0&&!(n.after(r+1)<n.end(r));r--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,o--);return t==o&&/row|table/.test(n.node(r).type.spec.tableRole)}function Cz({$from:n,$to:e}){let t,o;for(let r=n.depth;r>0;r--){const i=n.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let r=e.depth;r>0;r--){const i=e.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return t!==o&&e.parentOffset===0}function Sz(n,e,t){const o=(e||n).selection,r=(e||n).doc;let i,s;if(o instanceof Q&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=ze.create(r,o.from);else if(s=="row"){const l=r.resolve(o.from+1);i=ze.rowSelection(l,l)}else if(!t){const l=st.get(o.node),a=o.from+1,u=a+l.map[l.width*l.height-1];i=ze.create(r,a+1,u)}}else o instanceof q&&xz(o)?i=q.create(r,o.from):o instanceof q&&Cz(o)&&(i=q.create(r,o.$from.start(),o.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}const Ez=new ce("fix-tables");function EC(n,e,t,o){const r=n.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){const a=e.child(s);for(let u=l,d=Math.min(r,s+3);u<d;u++)if(n.child(u)==a){l=u+1,t+=a.nodeSize;continue e}o(a,t),l<r&&n.child(l).sameMarkup(a)?EC(n.child(l),a,t+1,o):a.nodesBetween(0,a.content.size,o,t+1),t+=a.nodeSize}}function MC(n,e){let t;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(t=Mz(n,r,i,t))};return e?e.doc!=n.doc&&EC(e.doc,n.doc,0,o):n.doc.descendants(o),t}function Mz(n,e,t,o){const r=st.get(e);if(!r.problems)return o;o||(o=n.tr);const i=[];for(let a=0;a<r.height;a++)i.push(0);for(let a=0;a<r.problems.length;a++){const u=r.problems[a];if(u.type=="collision"){const d=e.nodeAt(u.pos);if(!d)continue;const f=d.attrs;for(let p=0;p<f.rowspan;p++)i[u.row+p]+=u.n;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,Ci(f,f.colspan-u.n,u.n))}else if(u.type=="missing")i[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,{...d.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const d=o.mapping.map(t);o.delete(d,d+e.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,u=t+1;a<r.height;a++){const d=e.child(a),f=u+d.nodeSize,p=i[a];if(p>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<p;y++){const b=Wt(n.schema)[h].createAndFill();b&&m.push(b)}const g=(a==0||s==a-1)&&l==a?u+1:f-1;o.insert(o.mapping.map(g),m)}u=f}return o.setMeta(Ez,{fixTables:!0})}function Oo(n){const e=n.selection,t=$d(n),o=t.node(-1),r=t.start(-1),i=st.get(o);return{...e instanceof ze?i.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):i.findCell(t.pos-r),tableStart:r,map:i,table:o}}function TC(n,{map:e,tableStart:t,table:o},r){let i=r>0?-1:0;vz(e,o,r+i)&&(i=r==0||r==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+r;if(r>0&&r<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],u=o.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,CC(u.attrs,r-e.colCount(a))),s+=u.attrs.rowspan-1}else{const a=i==null?Wt(o.type.schema).cell:o.nodeAt(e.map[l+i]).type,u=e.positionAt(s,r,o);n.insert(n.mapping.map(t+u),a.createAndFill())}}return n}function Tz(n,e){if(!no(n))return!1;if(e){const t=Oo(n);e(TC(n.tr,t,t.left))}return!0}function Nz(n,e){if(!no(n))return!1;if(e){const t=Oo(n);e(TC(n.tr,t,t.right))}return!0}function Az(n,{map:e,table:t,tableStart:o},r){const i=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+r,a=e.map[l],u=t.nodeAt(a),d=u.attrs;if(r>0&&e.map[l-1]==a||r<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(i).map(o+a),null,Ci(d,r-e.colCount(a)));else{const f=n.mapping.slice(i).map(o+a);n.delete(f,f+u.nodeSize)}s+=d.rowspan}}function Oz(n,e){if(!no(n))return!1;if(e){const t=Oo(n),o=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let r=t.right-1;Az(o,t,r),r!=t.left;r--){const i=t.tableStart?o.doc.nodeAt(t.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=st.get(i)}e(o)}return!0}function $z(n,e,t){var o;const r=Wt(e.type.schema).header_cell;for(let i=0;i<n.width;i++)if(((o=e.nodeAt(n.map[i+t*n.width]))===null||o===void 0?void 0:o.type)!=r)return!1;return!0}function NC(n,{map:e,tableStart:t,table:o},r){let i=t;for(let u=0;u<r;u++)i+=o.child(u).nodeSize;const s=[];let l=r>0?-1:0;$z(e,o,r+l)&&(l=r==0||r==e.height?null:0);for(let u=0,d=e.width*r;u<e.width;u++,d++)if(r>0&&r<e.height&&e.map[d]==e.map[d-e.width]){const f=e.map[d],p=o.nodeAt(f).attrs;n.setNodeMarkup(t+f,null,{...p,rowspan:p.rowspan+1}),u+=p.colspan-1}else{var a;const f=l==null?Wt(o.type.schema).cell:(a=o.nodeAt(e.map[d+l*e.width]))===null||a===void 0?void 0:a.type,p=f==null?void 0:f.createAndFill();p&&s.push(p)}return n.insert(i,Wt(o.type.schema).row.create(null,s)),n}function Bz(n,e){if(!no(n))return!1;if(e){const t=Oo(n);e(NC(n.tr,t,t.top))}return!0}function Rz(n,e){if(!no(n))return!1;if(e){const t=Oo(n);e(NC(n.tr,t,t.bottom))}return!0}function _z(n,{map:e,table:t,tableStart:o},r){let i=0;for(let u=0;u<r;u++)i+=t.child(u).nodeSize;const s=i+t.child(r).nodeSize,l=n.mapping.maps.length;n.delete(i+o,s+o);const a=new Set;for(let u=0,d=r*e.width;u<e.width;u++,d++){const f=e.map[d];if(!a.has(f)){if(a.add(f),r>0&&f==e.map[d-e.width]){const p=t.nodeAt(f).attrs;n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p,rowspan:p.rowspan-1}),u+=p.colspan-1}else if(r<e.height&&f==e.map[d+e.width]){const p=t.nodeAt(f),h=p.attrs,m=p.type.create({...h,rowspan:p.attrs.rowspan-1},p.content),g=e.positionAt(r+1,u,t);n.insert(n.mapping.slice(l).map(o+g),m),u+=h.colspan-1}}}}function Dz(n,e){if(!no(n))return!1;if(e){const t=Oo(n),o=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let r=t.bottom-1;_z(o,t,r),r!=t.top;r--){const i=t.tableStart?o.doc.nodeAt(t.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=st.get(t.table)}e(o)}return!0}function pv(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function Iz({width:n,height:e,map:t},o){let r=o.top*n+o.left,i=r,s=(o.bottom-1)*n+o.left,l=r+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&t[i]==t[i-1]||o.right<n&&t[l]==t[l+1])return!0;i+=n,l+=n}for(let a=o.left;a<o.right;a++){if(o.top>0&&t[r]==t[r-n]||o.bottom<e&&t[s]==t[s+n])return!0;r++,s++}return!1}function hv(n,e){const t=n.selection;if(!(t instanceof ze)||t.$anchorCell.pos==t.$headCell.pos)return!1;const o=Oo(n),{map:r}=o;if(Iz(r,o))return!1;if(e){const i=n.tr,s={};let l=D.empty,a,u;for(let d=o.top;d<o.bottom;d++)for(let f=o.left;f<o.right;f++){const p=r.map[d*r.width+f],h=o.table.nodeAt(p);if(!(s[p]||!h))if(s[p]=!0,a==null)a=p,u=h;else{pv(h)||(l=l.append(h.content));const m=i.mapping.map(p+o.tableStart);i.delete(m,m+h.nodeSize)}}if(a==null||u==null)return!0;if(i.setNodeMarkup(a+o.tableStart,null,{...CC(u.attrs,u.attrs.colspan,o.right-o.left-u.attrs.colspan),rowspan:o.bottom-o.top}),l.size>0){const d=a+1+u.content.size,f=pv(u)?a+1:d;i.replaceWith(f+o.tableStart,d+o.tableStart,l)}i.setSelection(new ze(i.doc.resolve(a+o.tableStart))),e(i)}return!0}function mv(n,e){const t=Wt(n.schema);return Lz(({node:o})=>t[o.type.spec.tableRole])(n,e)}function Lz(n){return(e,t)=>{const o=e.selection;let r,i;if(o instanceof ze){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;r=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{var s;if(r=gz(o.$from),!r)return!1;i=(s=xi(o.$from))===null||s===void 0?void 0:s.pos}if(r==null||i==null||r.attrs.colspan==1&&r.attrs.rowspan==1)return!1;if(t){let l=r.attrs;const a=[],u=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const d=Oo(e),f=e.tr;for(let h=0;h<d.right-d.left;h++)a.push(u?{...l,colwidth:u&&u[h]?[u[h]]:null}:l);let p;for(let h=d.top;h<d.bottom;h++){let m=d.map.positionAt(h,d.left,d.table);h==d.top&&(m+=r.nodeSize);for(let g=d.left,y=0;g<d.right;g++,y++)g==d.left&&h==d.top||f.insert(p=f.mapping.map(m+d.tableStart,1),n({node:r,row:h,col:g}).createAndFill(a[y]))}f.setNodeMarkup(i,n({node:r,row:d.top,col:d.left}),a[0]),o instanceof ze&&f.setSelection(new ze(f.doc.resolve(o.$anchorCell.pos),p?f.doc.resolve(p):void 0)),t(f)}return!0}}function Pz(n,e){return function(t,o){if(!no(t))return!1;const r=$d(t);if(r.nodeAfter.attrs[n]===e)return!1;if(o){const i=t.tr;t.selection instanceof ze?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[n]:e}),o(i)}return!0}}function Vz(n){return function(e,t){if(!no(e))return!1;if(t){const o=Wt(e.schema),r=Oo(e),i=e.tr,s=r.map.cellsInRect(n=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:n=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=s.map(a=>r.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==o.header_cell&&i.setNodeMarkup(r.tableStart+s[a],o.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<s.length;a++)i.setNodeMarkup(r.tableStart+s[a],o.header_cell,l[a].attrs);t(i)}return!0}}function gv(n,e,t){const o=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let r=0;r<o.length;r++){const i=e.table.nodeAt(o[r]);if(i&&i.type!==t.header_cell)return!1}return!0}function Kl(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?Vz(n):function(t,o){if(!no(t))return!1;if(o){const r=Wt(t.schema),i=Oo(t),s=t.tr,l=gv("row",i,r),a=gv("column",i,r),u=(n==="column"?l:n==="row"&&a)?1:0,d=n=="column"?{left:0,top:u,right:1,bottom:i.map.height}:n=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=n=="column"?a?r.cell:r.header_cell:n=="row"?l?r.cell:r.header_cell:r.cell;i.map.cellsInRect(d).forEach(p=>{const h=p+i.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,f,m.attrs)}),o(s)}return!0}}Kl("row",{useDeprecatedLogic:!0});Kl("column",{useDeprecatedLogic:!0});const zz=Kl("cell",{useDeprecatedLogic:!0});function Fz(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let o=n.index(-1)-1,r=n.before();o>=0;o--){const i=n.node(-1).child(o),s=i.lastChild;if(s)return r-1-s.nodeSize;r-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let o=n.indexAfter(-1),r=n.after();o<t.childCount;o++){const i=t.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function yv(n){return function(e,t){if(!no(e))return!1;const o=Fz($d(e),n);if(o==null)return!1;if(t){const r=e.doc.resolve(o);t(e.tr.setSelection(q.between(r,bz(r))).scrollIntoView())}return!0}}function Hz(n,e){const t=n.selection.$anchor;for(let o=t.depth;o>0;o--)if(t.node(o).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(o),t.after(o)).scrollIntoView()),!0;return!1}function Wa(n,e){const t=n.selection;if(!(t instanceof ze))return!1;if(e){const o=n.tr,r=Wt(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(r)||o.replace(o.mapping.map(s+1),o.mapping.map(s+i.nodeSize-1),new H(r,0,0))}),o.docChanged&&e(o)}return!0}function jz(n){if(n.size===0)return null;let{content:e,openStart:t,openEnd:o}=n;for(;e.childCount==1&&(t>0&&o>0||e.child(0).type.spec.tableRole=="table");)t--,o--,e=e.child(0).content;const r=e.child(0),i=r.type.spec.tableRole,s=r.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let u=e.child(a).content;const d=a?0:Math.max(0,t-1),f=a<e.childCount-1?0:Math.max(0,o-1);(d||f)&&(u=th(Wt(s).row,new H(u,d,f)).content),l.push(u)}else if(i=="cell"||i=="header_cell")l.push(t||o?th(Wt(s).row,new H(e,t,o)).content:e);else return null;return Uz(s,l)}function Uz(n,e){const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(let s=i.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=i.child(s).attrs;for(let u=r;u<r+l;u++)t[u]=(t[u]||0)+a}}let o=0;for(let r=0;r<t.length;r++)o=Math.max(o,t[r]);for(let r=0;r<t.length;r++)if(r>=e.length&&e.push(D.empty),t[r]<o){const i=Wt(n).cell.createAndFill(),s=[];for(let l=t[r];l<o;l++)s.push(i);e[r]=e[r].append(D.from(s))}return{height:e.length,width:o,rows:e}}function th(n,e){const t=n.createAndFill();return new Gh(t).replace(0,t.content.size,e).doc}function Wz({width:n,height:e,rows:t},o,r){if(n!=o){const i=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],u=[];for(let d=i[l]||0,f=0;d<o;f++){let p=a.child(f%a.childCount);d+p.attrs.colspan>o&&(p=p.type.createChecked(Ci(p.attrs,p.attrs.colspan,d+p.attrs.colspan-o),p.content)),u.push(p),d+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+p.attrs.colspan}s.push(D.from(u))}t=s,n=o}if(e!=r){const i=[];for(let s=0,l=0;s<r;s++,l++){const a=[],u=t[l%e];for(let d=0;d<u.childCount;d++){let f=u.child(d);s+f.attrs.rowspan>r&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,r-f.attrs.rowspan)},f.content)),a.push(f)}i.push(D.from(a))}t=i,e=r}return{width:n,height:e,rows:t}}function qz(n,e,t,o,r,i,s){const l=n.doc.type.schema,a=Wt(l);let u,d;if(r>e.width)for(let f=0,p=0;f<e.height;f++){const h=t.child(f);p+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==a.cell?g=u||(u=a.cell.createAndFill()):g=d||(d=a.header_cell.createAndFill());for(let y=e.width;y<r;y++)m.push(g);n.insert(n.mapping.slice(s).map(p-1+o),m)}if(i>e.height){const f=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,r);m++){const y=m>=e.width?!1:t.nodeAt(e.map[g+m]).type==a.header_cell;f.push(y?d||(d=a.header_cell.createAndFill()):u||(u=a.cell.createAndFill()))}const p=a.row.create(null,D.from(f)),h=[];for(let m=e.height;m<i;m++)h.push(p);n.insert(n.mapping.slice(s).map(o+t.nodeSize-2),h)}return!!(u||d)}function bv(n,e,t,o,r,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let u=r;u<i;u++){const d=s*e.width+u,f=e.map[d];if(e.map[d-e.width]==f){a=!0;const p=t.nodeAt(f),{top:h,left:m}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p.attrs,rowspan:s-h}),n.insert(n.mapping.slice(l).map(e.positionAt(s,m,t)),p.type.createAndFill({...p.attrs,rowspan:h+p.attrs.rowspan-s})),u+=p.attrs.colspan-1}}return a}function vv(n,e,t,o,r,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let u=r;u<i;u++){const d=u*e.width+s,f=e.map[d];if(e.map[d-1]==f){a=!0;const p=t.nodeAt(f),h=e.colCount(f),m=n.mapping.slice(l).map(f+o);n.setNodeMarkup(m,null,Ci(p.attrs,s-h,p.attrs.colspan-(s-h))),n.insert(m+p.nodeSize,p.type.createAndFill(Ci(p.attrs,0,s-h))),u+=p.attrs.rowspan-1}}return a}function kv(n,e,t,o,r){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let s=st.get(i);const{top:l,left:a}=o,u=a+r.width,d=l+r.height,f=n.tr;let p=0;function h(){if(i=t?f.doc.nodeAt(t-1):f.doc,!i)throw new Error("No table found");s=st.get(i),p=f.mapping.maps.length}qz(f,s,i,t,u,d,p)&&h(),bv(f,s,i,t,a,u,l,p)&&h(),bv(f,s,i,t,a,u,d,p)&&h(),vv(f,s,i,t,l,d,a,p)&&h(),vv(f,s,i,t,l,d,u,p)&&h();for(let m=l;m<d;m++){const g=s.positionAt(m,a,i),y=s.positionAt(m,u,i);f.replace(f.mapping.slice(p).map(g+t),f.mapping.slice(p).map(y+t),new H(r.rows[m-l],0,0))}h(),f.setSelection(new ze(f.doc.resolve(t+s.positionAt(l,a,i)),f.doc.resolve(t+s.positionAt(d-1,u-1,i)))),e(f)}const Kz=dm({ArrowLeft:qa("horiz",-1),ArrowRight:qa("horiz",1),ArrowUp:qa("vert",-1),ArrowDown:qa("vert",1),"Shift-ArrowLeft":Ka("horiz",-1),"Shift-ArrowRight":Ka("horiz",1),"Shift-ArrowUp":Ka("vert",-1),"Shift-ArrowDown":Ka("vert",1),Backspace:Wa,"Mod-Backspace":Wa,Delete:Wa,"Mod-Delete":Wa});function yc(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function qa(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;if(i instanceof ze)return yc(t,o,se.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const s=AC(r,n,e);if(s==null)return!1;if(n=="horiz")return yc(t,o,se.near(t.doc.resolve(i.head+e),e));{const l=t.doc.resolve(s),a=xC(l,n,e);let u;return a?u=se.near(a,1):e<0?u=se.near(t.doc.resolve(l.before(-1)),-1):u=se.near(t.doc.resolve(l.after(-1)),1),yc(t,o,u)}}}function Ka(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;let s;if(i instanceof ze)s=i;else{const a=AC(r,n,e);if(a==null)return!1;s=new ze(t.doc.resolve(a))}const l=xC(s.$headCell,n,e);return l?yc(t,o,new ze(s.$anchorCell,l)):!1}}function Jz(n,e){const t=n.state.doc,o=xi(t.resolve(e));return o?(n.dispatch(n.state.tr.setSelection(new ze(o))),!0):!1}function Gz(n,e,t){if(!no(n.state))return!1;let o=jz(t);const r=n.state.selection;if(r instanceof ze){o||(o={width:1,height:1,rows:[D.from(th(Wt(n.state.schema).cell,t))]});const i=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),l=st.get(i).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return o=Wz(o,l.right-l.left,l.bottom-l.top),kv(n.state,n.dispatch,s,l,o),!0}else if(o){const i=$d(n.state),s=i.start(-1);return kv(n.state,n.dispatch,s,st.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function Xz(n,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;const o=wv(n,e.target);let r;if(e.shiftKey&&n.state.selection instanceof ze)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(r=xi(n.state.selection.$anchor))!=null&&((t=Lf(n,e))===null||t===void 0?void 0:t.pos)!=r.pos)i(r,e),e.preventDefault();else if(!o)return;function i(a,u){let d=Lf(n,u);const f=br.getState(n.state)==null;if(!d||!fg(a,d))if(f)d=a;else return;const p=new ze(a,d);if(f||!n.state.selection.eq(p)){const h=n.state.tr.setSelection(p);f&&h.setMeta(br,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),br.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(br,-1))}function l(a){const u=a,d=br.getState(n.state);let f;if(d!=null)f=n.state.doc.resolve(d);else if(wv(n,u.target)!=o&&(f=Lf(n,e),!f))return s();f&&i(f,u)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function AC(n,e,t){if(!(n.state.selection instanceof q))return null;const{$head:o}=n.state.selection;for(let r=o.depth-1;r>=0;r--){const i=o.node(r);if((t<0?o.index(r):o.indexAfter(r))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=o.before(r),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?s:null}}return null}function wv(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function Lf(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});if(!t)return null;let{inside:o,pos:r}=t;return o>=0&&xi(n.state.doc.resolve(o))||xi(n.state.doc.resolve(r))}var Yz=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),nh(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!=this.node.type?!1:(this.node=e,nh(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return e.type=="attributes"&&(e.target==this.table||this.colgroup.contains(e.target))}};function nh(n,e,t,o,r,i){let s=0,l=!0,a=e.firstChild;const u=n.firstChild;if(u){for(let f=0,p=0;f<u.childCount;f++){const{colspan:h,colwidth:m}=u.child(f).attrs;for(let g=0;g<h;g++,p++){const y=r==p?i:m&&m[g],b=y?y+"px":"";if(s+=y||o,y||(l=!1),a)a.style.width!=b&&(a.style.width=b),a=a.nextSibling;else{const v=document.createElement("col");v.style.width=b,e.appendChild(v)}}}for(;a;){var d;const f=a.nextSibling;(d=a.parentNode)===null||d===void 0||d.removeChild(a),a=f}l?(t.style.width=s+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=s+"px")}}const kn=new ce("tableColumnResizing");function Qz({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:o=Yz,lastColumnResizable:r=!0}={}){const i=new ue({key:kn,state:{init(s,l){var a;const u=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,d=Wt(l.schema).table.name;return o&&u&&(u[d]=(f,p)=>new o(f,t,p)),new Zz(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=kn.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{e2(s,l,n,r)},mouseleave:s=>{t2(s)},mousedown:(s,l)=>{n2(s,l,e,t)}},decorations:s=>{const l=kn.getState(s);if(l&&l.activeHandle>-1)return l2(s,l.activeHandle)},nodeViews:{}}});return i}var Zz=class bc{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,o=e.getMeta(kn);if(o&&o.setHandle!=null)return new bc(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new bc(t.activeHandle,o.setDragging);if(t.activeHandle>-1&&e.docChanged){let r=e.mapping.map(t.activeHandle,-1);return eh(e.doc.resolve(r))||(r=-1),new bc(r,t.dragging)}return t}};function e2(n,e,t,o){if(!n.editable)return;const r=kn.getState(n.state);if(r&&!r.dragging){const i=r2(e.target);let s=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=xv(n,e,"left",t):a-e.clientX<=t&&(s=xv(n,e,"right",t))}if(s!=r.activeHandle){if(!o&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),u=st.get(a),d=l.start(-1);if(u.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==u.width-1)return}OC(n,s)}}}function t2(n){if(!n.editable)return;const e=kn.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&OC(n,-1)}function n2(n,e,t,o){var r;if(!n.editable)return!1;const i=(r=n.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,s=kn.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=o2(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(kn,{setDragging:{startX:e.clientX,startWidth:a}}));function u(f){i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",d);const p=kn.getState(n.state);p!=null&&p.dragging&&(i2(n,p.activeHandle,Cv(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(kn,{setDragging:null})))}function d(f){if(!f.which)return u(f);const p=kn.getState(n.state);if(p&&p.dragging){const h=Cv(p.dragging,f,t);Sv(n,p.activeHandle,h,o)}}return Sv(n,s.activeHandle,a,o),i.addEventListener("mouseup",u),i.addEventListener("mousemove",d),e.preventDefault(),!0}function o2(n,e,{colspan:t,colwidth:o}){const r=o&&o[o.length-1];if(r)return r;const i=n.domAtPos(e);let s=i.node.childNodes[i.offset].offsetWidth,l=t;if(o)for(let a=0;a<t;a++)o[a]&&(s-=o[a],l--);return s/l}function r2(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function xv(n,e,t,o){const r=t=="right"?-o:o,i=n.posAtCoords({left:e.clientX+r,top:e.clientY});if(!i)return-1;const{pos:s}=i,l=xi(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=st.get(l.node(-1)),u=l.start(-1),d=a.map.indexOf(l.pos-u);return d%a.width==0?-1:u+a.map[d-1]}function Cv(n,e,t){const o=e.clientX-n.startX;return Math.max(t,n.startWidth+o)}function OC(n,e){n.dispatch(n.state.tr.setMeta(kn,{setHandle:e}))}function i2(n,e,t){const o=n.state.doc.resolve(e),r=o.node(-1),i=st.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let u=0;u<i.height;u++){const d=u*i.width+l;if(u&&i.map[d]==i.map[d-i.width])continue;const f=i.map[d],p=r.nodeAt(f).attrs,h=p.colspan==1?0:l-i.colCount(f);if(p.colwidth&&p.colwidth[h]==t)continue;const m=p.colwidth?p.colwidth.slice():s2(p.colspan);m[h]=t,a.setNodeMarkup(s+f,null,{...p,colwidth:m})}a.docChanged&&n.dispatch(a)}function Sv(n,e,t,o){const r=n.state.doc.resolve(e),i=r.node(-1),s=r.start(-1),l=st.get(i).colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;let a=n.domAtPos(r.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&nh(i,a.firstChild,a,o,l,t)}function s2(n){return Array(n).fill(0)}function l2(n,e){const t=[],o=n.doc.resolve(e),r=o.node(-1);if(!r)return Se.empty;const i=st.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let u=0;u<i.height;u++){const d=l+u*i.width;if((l==i.width-1||i.map[d]!=i.map[d+1])&&(u==0||i.map[d]!=i.map[d-i.width])){var a;const f=i.map[d],p=s+f+r.nodeAt(f).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=kn.getState(n))===null||a===void 0)&&a.dragging&&t.push(Ve.node(s+f,s+f+r.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),t.push(Ve.widget(p,h))}}return Se.create(n.doc,t)}function a2({allowTableNodeSelection:n=!1}={}){return new ue({key:br,state:{init(){return null},apply(e,t){const o=e.getMeta(br);if(o!=null)return o==-1?null:o;if(t==null||!e.docChanged)return t;const{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:wz,handleDOMEvents:{mousedown:Xz},createSelectionBetween(e){return br.getState(e.state)!=null?e.state.selection:null},handleTripleClick:Jz,handleKeyDown:Kz,handlePaste:Gz},appendTransaction(e,t,o){return Sz(o,MC(o,t),n)}})}function c2(n,e){const t=Math.min(n.top,e.top),o=Math.max(n.bottom,e.bottom),r=Math.min(n.left,e.left),s=Math.max(n.right,e.right)-r,l=o-t,a=r,u=t;return new DOMRect(a,u,s,l)}var u2=class{constructor({editor:n,element:e,view:t,updateDelay:o=250,resizeDelay:r=60,shouldShow:i,appendTo:s,getReferencedVirtualElement:l,options:a}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:"absolute",placement:"top",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:d,state:f,from:p,to:h})=>{const{doc:m,selection:g}=f,{empty:y}=g,b=!m.textBetween(p,h).length&&ud(f.selection),v=this.element.contains(document.activeElement);return!(!(d.hasFocus()||v)||y||b||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:d})=>{var f;if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}d!=null&&d.relatedTarget&&((f=this.element.parentNode)!=null&&f.contains(d.relatedTarget))||(d==null?void 0:d.relatedTarget)!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(d,f)=>{const p=!(f!=null&&f.selection.eq(d.state.selection)),h=!(f!=null&&f.doc.eq(d.state.doc));!p&&!h||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(d,p,h,f)},this.updateDelay))},this.updateHandler=(d,f,p,h)=>{const{composing:m}=d;if(m||!f&&!p)return;if(!this.getShouldShow(h)){this.hide();return}this.updatePosition(),this.show()},this.transactionHandler=({transaction:d})=>{d.getMeta("bubbleMenu")==="updatePosition"&&this.updatePosition()};var u;this.editor=n,this.element=e,this.view=t,this.updateDelay=o,this.resizeDelay=r,this.appendTo=s,this.scrollTarget=(u=a==null?void 0:a.scrollTarget)!=null?u:window,this.getReferencedVirtualElement=l,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,i&&(this.shouldShow=i),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(Nu(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(Tu(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(Mu(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(uC(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(aC(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(lC(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(cC(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(dC(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}get virtualElement(){var n;const{selection:e}=this.editor.state,t=(n=this.getReferencedVirtualElement)==null?void 0:n.call(this);if(t)return t;const o=ox(this.view,e.from,e.to);let r={getBoundingClientRect:()=>o,getClientRects:()=>[o]};if(e instanceof Q){let i=this.view.nodeDOM(e.from);const s=i.dataset.nodeViewWrapper?i:i.querySelector("[data-node-view-wrapper]");s&&(i=s),i&&(r={getBoundingClientRect:()=>i.getBoundingClientRect(),getClientRects:()=>[i.getBoundingClientRect()]})}if(e instanceof ze){const{$anchorCell:i,$headCell:s}=e,l=i?i.pos:s.pos,a=s?s.pos:i.pos,u=this.view.nodeDOM(l),d=this.view.nodeDOM(a);if(!u||!d)return;const f=u===d?u.getBoundingClientRect():c2(u.getBoundingClientRect(),d.getBoundingClientRect());r={getBoundingClientRect:()=>f,getClientRects:()=>[f]}}return r}updatePosition(){const n=this.virtualElement;n&&ql(n,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:o})=>{this.element.style.width="max-content",this.element.style.position=o,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const{state:t}=n,o=t.selection.from!==t.selection.to;if(this.updateDelay>0&&o){this.handleDebouncedUpdate(n,e);return}const r=!(e!=null&&e.selection.eq(n.state.selection)),i=!(e!=null&&e.doc.eq(n.state.doc));this.updateHandler(n,r,i,e)}getShouldShow(n){var e;const{state:t}=this.view,{selection:o}=t,{ranges:r}=o,i=Math.min(...r.map(a=>a.$from.pos)),s=Math.max(...r.map(a=>a.$to.pos));return((e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:n,from:i,to:s}))||!1}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener("dragstart",this.dragstartHandler),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},d2=n=>new ue({key:typeof n.pluginKey=="string"?new ce(n.pluginKey):n.pluginKey,view:e=>new u2({view:e,...n})}),f2=c.defineComponent({name:"BubbleMenu",inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:"bubbleMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(n,{slots:e,attrs:t}){const o=c.ref(null);return c.onMounted(()=>{const{editor:r,options:i,pluginKey:s,resizeDelay:l,appendTo:a,shouldShow:u,getReferencedVirtualElement:d,updateDelay:f}=n,p=o.value;p&&(p.style.visibility="hidden",p.style.position="absolute",p.remove(),c.nextTick(()=>{r.registerPlugin(d2({editor:r,element:p,options:i,pluginKey:s,resizeDelay:l,appendTo:a,shouldShow:u,getReferencedVirtualElement:d,updateDelay:f}))}))}),c.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=n;i.unregisterPlugin(r)}),()=>{var r;return c.h("div",{ref:o,...t},(r=e.default)==null?void 0:r.call(e))}}}),p2=class{constructor({editor:n,element:e,view:t,updateDelay:o=250,resizeDelay:r=60,options:i,appendTo:s,shouldShow:l}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:u,state:d})=>{const{selection:f}=d,{$anchor:p,empty:h}=f,m=p.depth===1,g=p.parent.isTextblock&&!p.parent.type.spec.code&&!p.parent.textContent&&p.parent.childCount===0&&!this.getTextContent(p.parent);return!(!u.hasFocus()||!h||!m||!g||!this.editor.isEditable)},this.floatingUIOptions={strategy:"absolute",placement:"right",offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(u,d,f,p)=>{const{composing:h}=u;if(h||!d&&!f)return;if(!this.getShouldShow(p)){this.hide();return}this.updatePosition(),this.show()},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:u})=>{var d;if(this.preventHide){this.preventHide=!1;return}u!=null&&u.relatedTarget&&((d=this.element.parentNode)!=null&&d.contains(u.relatedTarget))||(u==null?void 0:u.relatedTarget)!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:u})=>{u.getMeta("floatingMenu")==="updatePosition"&&this.updatePosition()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)};var a;this.editor=n,this.element=e,this.view=t,this.updateDelay=o,this.resizeDelay=r,this.appendTo=s,this.scrollTarget=(a=i==null?void 0:i.scrollTarget)!=null?a:window,this.floatingUIOptions={...this.floatingUIOptions,...i},this.element.tabIndex=0,l&&(this.shouldShow=l),this.element.addEventListener("mousedown",this.mousedownHandler,{capture:!0}),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.editor.on("transaction",this.transactionHandler),window.addEventListener("resize",this.resizeHandler),this.scrollTarget.addEventListener("scroll",this.resizeHandler),this.update(t,t.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(n){return Y0(n,{textSerializers:vm(this.editor.schema)})}get middlewares(){const n=[];return this.floatingUIOptions.flip&&n.push(Nu(typeof this.floatingUIOptions.flip!="boolean"?this.floatingUIOptions.flip:void 0)),this.floatingUIOptions.shift&&n.push(Tu(typeof this.floatingUIOptions.shift!="boolean"?this.floatingUIOptions.shift:void 0)),this.floatingUIOptions.offset&&n.push(Mu(typeof this.floatingUIOptions.offset!="boolean"?this.floatingUIOptions.offset:void 0)),this.floatingUIOptions.arrow&&n.push(uC(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&n.push(aC(typeof this.floatingUIOptions.size!="boolean"?this.floatingUIOptions.size:void 0)),this.floatingUIOptions.autoPlacement&&n.push(lC(typeof this.floatingUIOptions.autoPlacement!="boolean"?this.floatingUIOptions.autoPlacement:void 0)),this.floatingUIOptions.hide&&n.push(cC(typeof this.floatingUIOptions.hide!="boolean"?this.floatingUIOptions.hide:void 0)),this.floatingUIOptions.inline&&n.push(dC(typeof this.floatingUIOptions.inline!="boolean"?this.floatingUIOptions.inline:void 0)),n}getShouldShow(n){var e;const{state:t}=this.view,{selection:o}=t,{ranges:r}=o,i=Math.min(...r.map(a=>a.$from.pos)),s=Math.max(...r.map(a=>a.$to.pos));return(e=this.shouldShow)==null?void 0:e.call(this,{editor:this.editor,view:this.view,state:t,oldState:n,from:i,to:s})}updatePosition(){const{selection:n}=this.editor.state,e=ox(this.view,n.from,n.to);ql({getBoundingClientRect:()=>e,getClientRects:()=>[e]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:o,y:r,strategy:i})=>{this.element.style.width="max-content",this.element.style.position=i,this.element.style.left=`${o}px`,this.element.style.top=`${r}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(n,e){const t=!(e!=null&&e.selection.eq(n.state.selection)),o=!(e!=null&&e.doc.eq(n.state.doc));this.updateHandler(n,t,o,e)}show(){var n;if(this.isVisible)return;this.element.style.visibility="visible",this.element.style.opacity="1";const e=typeof this.appendTo=="function"?this.appendTo():this.appendTo;(n=e??this.view.dom.parentElement)==null||n.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0}hide(){this.isVisible&&(this.element.style.visibility="hidden",this.element.style.opacity="0",this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener("mousedown",this.mousedownHandler,{capture:!0}),window.removeEventListener("resize",this.resizeHandler),this.scrollTarget.removeEventListener("scroll",this.resizeHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.editor.off("transaction",this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},h2=n=>new ue({key:typeof n.pluginKey=="string"?new ce(n.pluginKey):n.pluginKey,view:e=>new p2({view:e,...n})}),m2=c.defineComponent({name:"FloatingMenu",inheritAttrs:!1,props:{pluginKey:{type:null,default:"floatingMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(n,{slots:e,attrs:t}){const o=c.ref(null);return c.onMounted(()=>{const{pluginKey:r,editor:i,updateDelay:s,resizeDelay:l,options:a,appendTo:u,shouldShow:d}=n,f=o.value;f&&(f.style.visibility="hidden",f.style.position="absolute",f.remove(),i.registerPlugin(h2({pluginKey:r,editor:i,element:f,updateDelay:s,resizeDelay:l,options:a,appendTo:u,shouldShow:d})))}),c.onBeforeUnmount(()=>{const{pluginKey:r,editor:i}=n;i.unregisterPlugin(r)}),()=>{var r;return c.h("div",{ref:o,...t},(r=e.default)==null?void 0:r.call(e))}}});const g2={key:0},y2=c.defineComponent({__name:"OBubbleMenu",props:{editor:{type:Jt},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(n){const e=n,{tr:t}=de(),{theme:o}=Bi(),r=c.ref(!1),i=c.ref(!1),s=c.ref(!1),l=c.ref(!1),a=c.ref({offset:10,placement:"bottom-start",onShow:()=>{r.value=!1,i.value=!1,s.value=!1},onHide:()=>{s.value=!1}});function u(){r.value=!0}function d(w){w==="ai"&&(i.value=!0)}function f(){s.value=!0}function p(w){const{schema:k}=e.editor,x=k.marks.link;if(!x||!w)return!1;const{$from:C,$to:S}=w;return!!Rs(C,x)}function h({editor:w,element:k,view:x,state:C,oldState:S,from:M,to:N}){var z;const{doc:A,selection:$}=C,{empty:O}=$,R=!A.textBetween(M,N).length&&ud(C.selection);if(l.value=e.editor.isActive("inlineMath"),v.value||e.editor.isActive("inlineMath"))return!0;if(!x.hasFocus()||O||s.value||R&&w.isActive("link")&&!w.isActive("image"))return!1;const I=["image"],L=["image","toc","video","model-viewer"],B=$.node,W=(z=B==null?void 0:B.type)==null?void 0:z.name;return!(w.isActive("codeBlock")||L.indexOf(W)>=0||W&&!I.includes(W))}const m=c.computed(()=>{if(e.editor){const{state:w}=e.editor,{tr:k}=w,{selection:x}=k;return p(x)}else return!1}),g=c.computed(()=>{var w,k;return!r.value&&!((w=e.editor)!=null&&w.isActive("image"))&&(m.value||((k=e.editor)==null?void 0:k.isActive("inlineMath")))}),y=c.computed(()=>v.value||l.value),b=c.computed(()=>{var k,x,C;let w=e.menu;return r.value||((k=e.editor)!=null&&k.isActive("image")?w=m.value?D1:_1:(x=e.editor)!=null&&x.isActive("table")?w=L1:m.value?w=R1:(C=e.editor)!=null&&C.isActive("inlineMath")&&(w=B1)),w.length>0?w:$1}),v=c.computed(()=>{const w=Ko.getState(e.editor.state);return!!(w!=null&&w.active)});return c.onMounted(()=>{r.value=!1}),(w,k)=>n.editor?(c.openBlock(),c.createElementBlock("section",g2,[c.createVNode(c.unref(f2),{editor:n.editor,"should-show":h,options:a.value},{default:c.withCtx(()=>[i.value?(c.openBlock(),c.createBlock(c.unref(vC),{key:0,editor:n.editor,onConfirm:f},null,8,["editor"])):y.value?(c.openBlock(),c.createBlock(c.unref(kC),{key:1,editor:n.editor},null,8,["editor"])):(c.openBlock(),c.createElementBlock("section",{key:2,class:c.normalizeClass(["tiptap-toolbar",n.menuClass])},[g.value?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createVNode(c.unref(Ae),{icon:"arrow_back",tooltip:c.unref(t)("link.back"),onClick:u},null,8,["tooltip"]),c.createVNode(c.unref(Lt),{vertical:""})],64)):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(b.value,(x,C)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:C},[x==="separator"?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0,vertical:""})):typeof x=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(Od)(x)),{key:1,name:x,editor:n.editor,onClick:S=>d(x)},null,8,["name","editor","onClick"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(x),{key:2,editor:n.editor},null,8,["editor"]))],64))),128))],2))]),_:1},8,["editor","options"])])):c.createCommentVNode("",!0)}}),b2={key:0},v2=c.defineComponent({__name:"OFloatingMenu",props:{editor:{type:xx},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(n){const e=n,t=c.ref(!1),o=c.ref({placement:"right",offset:168});function r(){t.value=!0}function i(d){const{schema:f}=e.editor,p=f.marks.link;if(!p||!d)return!1;const{$from:h,$to:m}=d;return!!Rs(h,p)}const s=c.computed(()=>{if(e.editor){const{state:d}=e.editor,{tr:f}=d,{selection:p}=f;return i(p)}else return!1}),l=c.computed(()=>!t.value&&s.value),a=c.computed(()=>{const d=e.menu;return d.length>0?d:P1}),u=c.computed(()=>{const d=Ko.getState(e.editor.state);return!!(d!=null&&d.active)});return(d,f)=>n.editor&&!u.value?(c.openBlock(),c.createElementBlock("section",b2,[c.createVNode(c.unref(m2),{editor:n.editor,options:o.value},{default:c.withCtx(()=>[c.createElementVNode("section",{class:c.normalizeClass(["tiptap-toolbar",n.menuClass])},[l.value?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,icon:"arrow_back",onClick:r})):c.createCommentVNode("",!0),(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(a.value,(p,h)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:h},[p==="separator"?(c.openBlock(),c.createBlock(c.unref(Lt),{key:0,vertical:""})):typeof p=="string"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(c.unref(Od)(p)),{key:1,name:p,editor:n.editor},null,8,["name","editor"])):(c.openBlock(),c.createBlock(c.resolveDynamicComponent(p),{key:2,editor:n.editor},null,8,["editor"]))],64))),128))],2)]),_:1},8,["editor","options"])])):c.createCommentVNode("",!0)}});function pg(n,e){const t=e==null?void 0:e.posAtCoords(n);if(!t)return;let o=vc(t.pos,e);if(o!==e.dom){for(;o&&o.parentNode&&o.parentNode!==e.dom;)o=o.parentNode;if(o)return o}}function vc(n,e){return e.nodeDOM(n)||e.domAtPos(n).node}function hg(n,e){const t=pg(n,e);if(t&&t.nodeType===1){const o=e.docView,r=o.nearestDesc(t,!0);return!r||r===o?null:r.posBefore}return null}function k2(n,e){let t,o;const r=e.resolve(n.from).node().type.spec.group==="blockContent",i=e.resolve(n.to).node().type.spec.group==="blockContent",s=Math.min(n.$anchor.depth,n.$head.depth);if(r&&i){const l=n.$from.start(s-1),a=n.$to.end(s-1);t=e.resolve(l-1).pos,o=e.resolve(a+1).pos}else t=n.from,o=n.to;return{from:t,to:o}}function w2(n,e){const t=hg(n,e.view);return typeof t=="number"&&t>=0?{node:e.state.doc.nodeAt(t),pos:t}:{node:null,pos:t}}const Au=new ce("sideMenu");class x2{constructor(){Je(this,"hovered",!1);Je(this,"coords",{left:0,top:0});Je(this,"className","")}init(e){return this}apply({tr:e,oldState:t,newState:o}){return e.docChanged?this:this}setHover(e,t,o=""){this.hovered=e,this.coords=t,this.className=o}}class C2{constructor({editor:e,element:t,view:o,tippyOptions:r={},updateDelay:i=250}){Je(this,"editor");Je(this,"element");Je(this,"view");Je(this,"preventHide",!1);Je(this,"tippy");Je(this,"tippyOptions");Je(this,"updateDelay");Je(this,"updateDebounceTimer");Je(this,"mousedownHandler",()=>{this.preventHide=!0});Je(this,"onDragStart",e=>{this.hide()});Je(this,"blurHandler",({event:e})=>{var t;e!=null&&e.relatedTarget&&((t=this.element.parentNode)!=null&&t.contains(e.relatedTarget))||this.hide()});Je(this,"tippyBlurHandler",e=>{this.blurHandler({event:e})});Je(this,"handleDebouncedUpdate",(e,t)=>{const o=!(t!=null&&t.selection.eq(e.state.selection)),r=!(t!=null&&t.doc.eq(e.state.doc));!o&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,o,r,t)},this.updateDelay))});Je(this,"updateHandler",(e,t,o,r)=>{var u,d;const{state:i,composing:s}=e,{coords:l}=Au.getState(i),a=pg(l,e);hg(l,e),a&&(this.createTooltip(),(d=this.tippy)==null||d.setProps({getReferenceClientRect:((u=this.tippyOptions)==null?void 0:u.getReferenceClientRect)||(()=>a.getBoundingClientRect())}),this.show())});this.editor=e,this.element=t,this.view=o,this.updateDelay=i,this.view.dom.addEventListener("dragstart",this.onDragStart),this.tippyOptions=r,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:e}=this.editor.options,t=e instanceof Element?e:"mount"in e?e.mount:null,o=!!(t!=null&&t.parentElement);this.tippy||!o||(this.tippy=No(t,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"left",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(e,t){const{state:o}=e,r=!(t!=null&&t.selection.eq(e.state.selection)),i=!(t!=null&&t.doc.eq(e.state.doc));this.updateHandler(e,r,i,t)}show(){var e;(e=this.tippy)==null||e.show()}hide(){var e;(e=this.tippy)==null||e.hide()}destroy(){var e,t;(e=this.tippy)!=null&&e.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(t=this.tippy)==null||t.destroy(),this.view.dom.removeEventListener("dragstart",this.onDragStart)}}const S2=(n,e)=>{if(!n.dataTransfer)return;const t=e.view,o=t.dom.getBoundingClientRect(),r={left:o.left+o.width/2,top:n.clientY},i=hg(r,t);if(i===null)return;const s=t.state.selection,l=t.state.doc;k2(s,l),t.dispatch(t.state.tr.setSelection(Q.create(t.state.doc,i))),M2(t,i);const a=t.state.selection.content(),{dom:u,text:d}=t.serializeForClipboard(a);n.dataTransfer.clearData(),n.dataTransfer.setData("text/html",u.innerHTML),n.dataTransfer.setData("text/plain",d),n.dataTransfer.effectAllowed="move",n.dataTransfer.setDragImage(si,0,0),t.dragging={slice:a,move:!0}},E2=(n,e)=>{$C()};let si;function M2(n,e,t=e){const o=n.domAtPos(e).node.cloneNode(!0),r=n.domAtPos(e).node,i=(f,p)=>Array.prototype.indexOf.call(f.children,p),s=f=>{let p=f,h=p.parentElement;for(;h;){if(h===n.dom)return p;p=h,h=p.parentElement}return p};let l=-1,a=-1;e===t?(l=i(r,s(vc(e,n))),a=l):(l=i(r,s(vc(e+1,n))),a=i(r,s(vc(t-1,n))));for(let f=r.childElementCount-1;f>=0;f--)(f>l||f<a)&&o.removeChild(o.children[f]);$C(),si=o;const d=n.dom.className.split(" ").filter(f=>f!=="ProseMirror"&&f!=="yiitap-root"&&f!=="yiitap-editor").join(" ");si.className+=" yiitap-dragging-preview "+d,document.body.appendChild(si)}function $C(){si!==void 0&&(document.body.removeChild(si),si=void 0)}class T2{constructor(e){Je(this,"options");Je(this,"plugin");Je(this,"sideMenuView");const t=new x2;this.options=e,this.plugin=new ue({key:Au,props:{handleDOMEvents:{mouseover(o,r){const i={left:r.clientX,top:r.clientY},s=pg(i,o),l=(s==null?void 0:s.className)||"",a=t.className;l.indexOf("o-table-wrapper-view")>=0&&a.indexOf("o-table-wrapper-view")>=0||(t.setHover(!0,i,l),o.dispatch(o.state.tr.setMeta(Au,t)))}}},state:{init(o,r){return t.init(r)},apply(o,r,i,s){return t.apply({tr:o,oldState:i,newState:s})}},view:o=>(this.sideMenuView=new C2({view:o,...e}),this.sideMenuView)})}dragstart(e){S2(e,this.options.editor)}dragend(e){E2(e,this.options.editor)}}const N2=c.defineComponent({name:"SideMenu",props:{pluginKey:{type:[String,Object],default:"sideMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})}},setup(n,{expose:e,slots:t}){const o=c.ref(null),r=c.ref(),i=l=>{var a;(a=r.value)==null||a.dragstart(l)},s=l=>{var a;(a=r.value)==null||a.dragend(l)};return c.onMounted(()=>{const{pluginKey:l,editor:a,updateDelay:u,tippyOptions:d}=n;r.value=new T2({updateDelay:u,editor:a,element:o.value,pluginKey:l,tippyOptions:d}),a.registerPlugin(r.value.plugin)}),c.onBeforeUnmount(()=>{const{pluginKey:l,editor:a}=n;a.unregisterPlugin(l)}),e({...n,dragstart:i,dragend:s}),()=>{var l;return c.h("div",{ref:o},(l=t.default)==null?void 0:l.call(t))}}}),A2={key:0,class:"o-side-menu"},O2={class:"container"},$2=c.defineComponent({__name:"OSideMenu",props:{editor:{type:Jt,required:!0},menuClass:{type:String,default:""},add:{type:String,default:"menu"},title:{type:Boolean,default:!1}},setup(n){const e=n,t=c.ref(null),o=c.ref(null),r=c.ref(0),i=c.computed(()=>({arrow:!1,duration:100,placement:"left"})),s=c.computed(()=>({editor:e.editor,node:o.value,decorations:[],selected:!1,extension:{},getPos:()=>r.value,pos:r.value,updateAttributes:a,deleteNode:l,view:{},innerDecorations:[],HTMLAttributes:{},add:e.add}));function l(){var m,g;const p=r.value,h=p+((m=o.value)==null?void 0:m.nodeSize);(g=e.editor)==null||g.commands.deleteRange({from:p,to:h})}function a(p){var h;(h=e.editor)==null||h.commands.command(({tr:m})=>{var g;return m.setNodeMarkup(r.value,void 0,{...(g=o.value)==null?void 0:g.attrs,...p}),!0})}function u({editor:p,transaction:h}){let m={left:0,top:0};const g=Au.getState(e.editor.view.state);if(g){m=g.coords;const y=w2(m,p);y.node&&(e.title&&y.pos===0?o.value=null:(!e.title||y.pos>0)&&(o.value=y.node,r.value=y.pos))}}function d(p){var h;(h=t.value)==null||h.dragstart(p)}function f(p){var h;(h=t.value)==null||h.dragend(p)}return c.onMounted(()=>{var p;(p=e.editor)==null||p.on("transaction",u)}),(p,h)=>n.editor?(c.openBlock(),c.createElementBlock("section",A2,[c.createVNode(c.unref(N2),{ref_key:"menu",ref:t,class:c.normalizeClass(["side-menu",n.menuClass]),editor:n.editor,"tippy-options":i.value},{default:c.withCtx(()=>[c.createElementVNode("section",O2,[o.value?(c.openBlock(),c.createBlock(c.unref(fC),c.normalizeProps(c.mergeProps({key:0},s.value)),null,16)):c.createCommentVNode("",!0),o.value?(c.openBlock(),c.createBlock(c.unref(pC),c.mergeProps({key:1},s.value,{onDragstart:d,onDragend:f}),null,16)):c.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):c.createCommentVNode("",!0)}});var Ou=(n,e)=>e.view.domAtPos(n).node.offsetParent!==null,B2=(n,e,t)=>{for(let o=n.depth;o>0;o-=1){const r=n.node(o),i=e(r),s=Ou(n.start(o),t);if(i&&s)return{pos:o>0?n.before(o):0,start:n.start(o),depth:o,node:r}}},Ev=(n,e)=>{const{state:t,view:o,extensionManager:r}=n,{schema:i,selection:s}=t,{empty:l,$anchor:a}=s,u=!!r.extensions.find(b=>b.name==="gapCursor");if(!l||a.parent.type!==i.nodes.detailsSummary||!u||e==="right"&&a.parentOffset!==a.parent.nodeSize-2)return!1;const d=$i(b=>b.type===i.nodes.details)(s);if(!d)return!1;const f=Ar(d.node,b=>b.type===i.nodes.detailsContent);if(!f.length||Ou(d.start+f[0].pos+1,n))return!1;const h=t.doc.resolve(d.pos+d.node.nodeSize),m=et.findFrom(h,1,!1);if(!m)return!1;const{tr:g}=t,y=new et(m);return g.setSelection(y),g.scrollIntoView(),o.dispatch(g),!0},BC=Ie.create({name:"details",content:"detailsSummary detailsContent",group:"block",defining:!0,isolating:!0,allowGapCursor:!1,addOptions(){return{persist:!1,openClassName:"is-open",HTMLAttributes:{}}},addAttributes(){return this.options.persist?{open:{default:!1,parseHTML:n=>n.hasAttribute("open"),renderHTML:({open:n})=>n?{open:""}:{}}}:[]},parseHTML(){return[{tag:"details"}]},renderHTML({HTMLAttributes:n}){return["details",he(this.options.HTMLAttributes,n),0]},...gd({nodeName:"details",content:"block"}),addNodeView(){return({editor:n,getPos:e,node:t,HTMLAttributes:o})=>{const r=document.createElement("div"),i=he(this.options.HTMLAttributes,o,{"data-type":this.name});Object.entries(i).forEach(([u,d])=>r.setAttribute(u,d));const s=document.createElement("button");s.type="button",r.append(s);const l=document.createElement("div");r.append(l);const a=u=>{if(u!==void 0)if(u){if(r.classList.contains(this.options.openClassName))return;r.classList.add(this.options.openClassName)}else{if(!r.classList.contains(this.options.openClassName))return;r.classList.remove(this.options.openClassName)}else r.classList.toggle(this.options.openClassName);const d=new Event("toggleDetailsContent"),f=l.querySelector(':scope > div[data-type="detailsContent"]');f==null||f.dispatchEvent(d)};return t.attrs.open&&setTimeout(()=>a()),s.addEventListener("click",()=>{if(a(),!this.options.persist){n.commands.focus(void 0,{scrollIntoView:!1});return}if(n.isEditable&&typeof e=="function"){const{from:u,to:d}=n.state.selection;n.chain().command(({tr:f})=>{const p=e();if(!p)return!1;const h=f.doc.nodeAt(p);return(h==null?void 0:h.type)!==this.type?!1:(f.setNodeMarkup(p,void 0,{open:!h.attrs.open}),!0)}).setTextSelection({from:u,to:d}).focus(void 0,{scrollIntoView:!1}).run()}}),{dom:r,contentDOM:l,ignoreMutation(u){return u.type==="selection"?!1:!r.contains(u.target)||r===u.target},update:u=>u.type!==this.type?!1:(u.attrs.open!==void 0&&a(u.attrs.open),!0)}}},addCommands(){return{setDetails:()=>({state:n,chain:e})=>{var t;const{schema:o,selection:r}=n,{$from:i,$to:s}=r,l=i.blockRange(s);if(!l)return!1;const a=n.doc.slice(l.start,l.end);if(!o.nodes.detailsContent.contentMatch.matchFragment(a.content))return!1;const d=((t=a.toJSON())==null?void 0:t.content)||[];return e().insertContentAt({from:l.start,to:l.end},{type:this.name,content:[{type:"detailsSummary"},{type:"detailsContent",content:d}]}).setTextSelection(l.start+2).run()},unsetDetails:()=>({state:n,chain:e})=>{const{selection:t,schema:o}=n,r=$i(b=>b.type===this.type)(t);if(!r)return!1;const i=Ar(r.node,b=>b.type===o.nodes.detailsSummary),s=Ar(r.node,b=>b.type===o.nodes.detailsContent);if(!i.length||!s.length)return!1;const l=i[0],a=s[0],u=r.pos,d=n.doc.resolve(u),f=u+r.node.nodeSize,p={from:u,to:f},h=a.node.content.toJSON()||[],m=d.parent.type.contentMatch.defaultType,y=[m==null?void 0:m.create(null,l.node.content).toJSON(),...h];return e().insertContentAt(p,y).setTextSelection(u+1).run()}}},addKeyboardShortcuts(){return{Backspace:()=>{const{schema:n,selection:e}=this.editor.state,{empty:t,$anchor:o}=e;return!t||o.parent.type!==n.nodes.detailsSummary?!1:o.parentOffset!==0?this.editor.commands.command(({tr:r})=>{const i=o.pos-1,s=o.pos;return r.delete(i,s),!0}):this.editor.commands.unsetDetails()},Enter:({editor:n})=>{const{state:e,view:t}=n,{schema:o,selection:r}=e,{$head:i}=r;if(i.parent.type!==o.nodes.detailsSummary)return!1;const s=Ou(i.after()+1,n),l=s?e.doc.nodeAt(i.after()):i.node(-2);if(!l)return!1;const a=s?0:i.indexAfter(-1),u=mm(l.contentMatchAt(a));if(!u||!l.canReplaceWith(a,a,u))return!1;const d=u.createAndFill();if(!d)return!1;const f=s?i.after()+1:i.after(-1),p=e.tr.replaceWith(f,f,d),h=p.doc.resolve(f),m=se.near(h,1);return p.setSelection(m),p.scrollIntoView(),t.dispatch(p),!0},ArrowRight:({editor:n})=>Ev(n,"right"),ArrowDown:({editor:n})=>Ev(n,"down")}},addProseMirrorPlugins(){return[new ue({key:new ce("detailsSelection"),appendTransaction:(n,e,t)=>{const{editor:o,type:r}=this;if(o.view.composing||!n.some(b=>b.selectionSet)||!e.selection.empty||!t.selection.empty||!Z0(t,r.name))return;const{$from:a}=t.selection;if(Ou(a.pos,o))return;const d=B2(a,b=>b.type===r,o);if(!d)return;const f=Ar(d.node,b=>b.type===t.schema.nodes.detailsSummary);if(!f.length)return;const p=f[0],m=(e.selection.from<t.selection.from?"forward":"backward")==="forward"?d.start+p.pos:d.pos+p.pos+p.node.nodeSize,g=q.create(t.doc,m);return t.tr.setSelection(g)}})]}}),RC=Ie.create({name:"detailsContent",content:"block+",defining:!0,selectable:!1,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:`div[data-type="${this.name}"]`}]},renderHTML({HTMLAttributes:n}){return["div",he(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},addNodeView(){return({HTMLAttributes:n})=>{const e=document.createElement("div"),t=he(this.options.HTMLAttributes,n,{"data-type":this.name,hidden:"hidden"});return Object.entries(t).forEach(([o,r])=>e.setAttribute(o,r)),e.addEventListener("toggleDetailsContent",()=>{e.toggleAttribute("hidden")}),{dom:e,contentDOM:e,ignoreMutation(o){return o.type==="selection"?!1:!e.contains(o.target)||e===o.target},update:o=>o.type===this.type}}},addKeyboardShortcuts(){return{Enter:({editor:n})=>{const{state:e,view:t}=n,{selection:o}=e,{$from:r,empty:i}=o,s=$i($=>$.type===this.type)(o);if(!i||!s||!s.node.childCount)return!1;const l=r.index(s.depth),{childCount:a}=s.node;if(!(a===l+1))return!1;const d=s.node.type.contentMatch.defaultType,f=d==null?void 0:d.createAndFill();if(!f)return!1;const p=e.doc.resolve(s.pos+1),h=a-1,m=s.node.child(h),g=p.posAtIndex(h,s.depth);if(!m.eq(f))return!1;const b=r.node(-3);if(!b)return!1;const v=r.indexAfter(-3),w=mm(b.contentMatchAt(v));if(!w||!b.canReplaceWith(v,v,w))return!1;const k=w.createAndFill();if(!k)return!1;const{tr:x}=e,C=r.after(-2);x.replaceWith(C,C,k);const S=x.doc.resolve(C),M=se.near(S,1);x.setSelection(M);const N=g,A=g+m.nodeSize;return x.delete(N,A),x.scrollIntoView(),t.dispatch(x),!0}}},...gd({nodeName:"detailsContent"})}),_C=Ie.create({name:"detailsSummary",content:"text*",defining:!0,selectable:!1,isolating:!0,addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"summary"}]},renderHTML({HTMLAttributes:n}){return["summary",he(this.options.HTMLAttributes,n),0]},...gd({nodeName:"detailsSummary",content:"inline"})}),Bd=Ie.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{var e,t;const o=n.getAttribute("colwidth"),r=o?o.split(",").map(i=>parseInt(i,10)):null;if(!r){const i=(e=n.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),s=Array.from(((t=n.parentElement)==null?void 0:t.children)||[]).indexOf(n);if(s&&s>-1&&i&&i[s]){const l=i[s].getAttribute("width");return l?[parseInt(l,10)]:null}}return r}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",he(this.options.HTMLAttributes,n),0]}}),Rd=Ie.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(o=>parseInt(o,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",he(this.options.HTMLAttributes,n),0]}}),$u=Ie.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",he(this.options.HTMLAttributes,n),0]}});function oh(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function Mv(n,e,t,o,r,i){var s;let l=0,a=!0,u=e.firstChild;const d=n.firstChild;if(d!==null)for(let p=0,h=0;p<d.childCount;p+=1){const{colspan:m,colwidth:g}=d.child(p).attrs;for(let y=0;y<m;y+=1,h+=1){const b=r===h?i:g&&g[y],v=b?`${b}px`:"";if(l+=b||o,b||(a=!1),u){if(u.style.width!==v){const[w,k]=oh(o,b);u.style.setProperty(w,k)}u=u.nextSibling}else{const w=document.createElement("col"),[k,x]=oh(o,b);w.style.setProperty(k,x),e.appendChild(w)}}}for(;u;){const p=u.nextSibling;(s=u.parentNode)==null||s.removeChild(u),u=p}const f=n.attrs.style&&typeof n.attrs.style=="string"&&/\bwidth\s*:/i.test(n.attrs.style);a&&!f?(t.style.width=`${l}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${l}px`)}var R2=class{constructor(n,e){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),n.attrs.style&&(this.table.style.cssText=n.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Mv(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!==this.node.type?!1:(this.node=n,Mv(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){const e=n.target,t=this.dom.contains(e),o=this.contentDOM.contains(e);return!!(t&&!o&&(n.type==="attributes"||n.type==="childList"||n.type==="characterData"))}};function _2(n,e,t,o){let r=0,i=!0;const s=[],l=n.firstChild;if(!l)return{};for(let f=0,p=0;f<l.childCount;f+=1){const{colspan:h,colwidth:m}=l.child(f).attrs;for(let g=0;g<h;g+=1,p+=1){const y=t===p?o:m&&m[g];r+=y||e,y||(i=!1);const[b,v]=oh(e,y);s.push(["col",{style:`${b}: ${v}`}])}}const a=i?`${r}px`:"",u=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:u}}function Tv(n,e){return n.createAndFill()}function D2(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const o=n.nodes[t];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),n.cached.tableNodeTypes=e,e}function DC(n,e,t,o,r){const i=D2(n),s=[],l=[];for(let u=0;u<t;u+=1){const d=Tv(i.cell);if(d&&l.push(d),o){const f=Tv(i.header_cell);f&&s.push(f)}}const a=[];for(let u=0;u<e;u+=1)a.push(i.row.createChecked(null,o&&u===0?s:l));return i.table.createChecked(null,a)}function I2(n){return n instanceof ze}var Ja=({editor:n})=>{const{selection:e}=n.state;if(!I2(e))return!1;let t=0;const o=gm(e.ranges[0].$from,i=>i.type.name==="table");return o==null||o.node.descendants(i=>{if(i.type.name==="table")return!1;["tableCell","tableHeader"].includes(i.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},L2="";function P2(n){return(n||"").replace(/\s+/g," ").trim()}function V2(n,e,t={}){var o;const r=(o=t.cellLineSeparator)!=null?o:L2;if(!n||!n.content||n.content.length===0)return"";const i=[];n.content.forEach(m=>{const g=[];m.content&&m.content.forEach(y=>{let b="";y.content&&Array.isArray(y.content)&&y.content.length>1?b=y.content.map(x=>e.renderChildren(x)).join(r):b=y.content?e.renderChildren(y.content):"";const v=P2(b),w=y.type==="tableHeader";g.push({text:v,isHeader:w})}),i.push(g)});const s=i.reduce((m,g)=>Math.max(m,g.length),0);if(s===0)return"";const l=new Array(s).fill(0);i.forEach(m=>{var g;for(let y=0;y<s;y+=1){const v=(((g=m[y])==null?void 0:g.text)||"").length;v>l[y]&&(l[y]=v),l[y]<3&&(l[y]=3)}});const a=(m,g)=>m+" ".repeat(Math.max(0,g-m.length)),u=i[0],d=u.some(m=>m.isHeader);let f=`
|
|
202
|
+
`;const p=new Array(s).fill(0).map((m,g)=>d&&u[g]&&u[g].text||"");return f+=`| ${p.map((m,g)=>a(m,l[g])).join(" | ")} |
|
|
203
|
+
`,f+=`| ${l.map(m=>"-".repeat(Math.max(3,m))).join(" | ")} |
|
|
204
|
+
`,(d?i.slice(1):i).forEach(m=>{f+=`| ${new Array(s).fill(0).map((g,y)=>a(m[y]&&m[y].text||"",l[y])).join(" | ")} |
|
|
205
|
+
`}),f}var z2=V2,_d=Ie.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:R2,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:o,tableMinWidth:r}=_2(n,this.options.cellMinWidth),i=e.style;function s(){return i||(o?`width: ${o}`:`min-width: ${r}`)}const l=["table",he(this.options.HTMLAttributes,e,{style:s()}),t,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(n,e)=>{const t=[];if(n.header){const o=[];n.header.forEach(r=>{o.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(r.tokens)}]))}),t.push(e.createNode("tableRow",{},o))}return n.rows&&n.rows.forEach(o=>{const r=[];o.forEach(i=>{r.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),t.push(e.createNode("tableRow",{},r))}),e.createNode("table",void 0,t)},renderMarkdown:(n,e)=>z2(n,e),addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:o,dispatch:r,editor:i})=>{const s=DC(i.schema,n,e,t);if(r){const l=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(q.near(o.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>Tz(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>Nz(n,e),deleteColumn:()=>({state:n,dispatch:e})=>Oz(n,e),addRowBefore:()=>({state:n,dispatch:e})=>Bz(n,e),addRowAfter:()=>({state:n,dispatch:e})=>Rz(n,e),deleteRow:()=>({state:n,dispatch:e})=>Dz(n,e),deleteTable:()=>({state:n,dispatch:e})=>Hz(n,e),mergeCells:()=>({state:n,dispatch:e})=>hv(n,e),splitCell:()=>({state:n,dispatch:e})=>mv(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>Kl("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>Kl("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>zz(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>hv(n,e)?!0:mv(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:o})=>Pz(n,e)(t,o),goToNextCell:()=>({state:n,dispatch:e})=>yv(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>yv(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&MC(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const o=ze.create(e.doc,n.anchorCell,n.headCell);e.setSelection(o)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Ja,"Mod-Backspace":Ja,Delete:Ja,"Mod-Delete":Ja}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Qz({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],a2({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:_e(re(n,"tableRole",e))}}});ve.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(_d.configure(this.options.table)),this.options.tableCell!==!1&&n.push(Bd.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(Rd.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push($u.configure(this.options.tableRow)),n}});var F2=20,IC=(n,e=0)=>{const t=[];return!n.children.length||e>F2||Array.from(n.children).forEach(o=>{o.tagName==="SPAN"?t.push(o):o.children.length&&t.push(...IC(o,e+1))}),t},H2=n=>{if(!n.children.length)return;const e=IC(n);e&&e.forEach(t=>{var o,r;const i=t.getAttribute("style"),s=(r=(o=t.parentElement)==null?void 0:o.closest("span"))==null?void 0:r.getAttribute("style");t.setAttribute("style",`${s};${i}`)})},mg=eo.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:n=>n.hasAttribute("style")?(this.options.mergeNestedSpanStyles&&H2(n),{}):!1}]},renderHTML({HTMLAttributes:n}){return["span",he(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleTextStyle:n=>({commands:e})=>e.toggleMark(this.name,n),removeEmptyTextStyle:()=>({tr:n})=>{const{selection:e}=n;return n.doc.nodesBetween(e.from,e.to,(t,o)=>{if(t.isTextblock)return!0;t.marks.filter(r=>r.type===this.type).some(r=>Object.values(r.attrs).some(i=>!!i))||n.removeMark(o,o+t.nodeSize,this.type)}),!0}}}}),gg=ve.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const o=t.split(";").map(r=>r.trim()).filter(Boolean);for(let r=o.length-1;r>=0;r-=1){const i=o[r].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="background-color")return l.replace(/['"]+/g,"")}}}return(e=n.style.backgroundColor)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.backgroundColor?{style:`background-color: ${n.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:n=>({chain:e})=>e().setMark("textStyle",{backgroundColor:n}).run(),unsetBackgroundColor:()=>({chain:n})=>n().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),yg=ve.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:n=>{var e;const t=n.getAttribute("style");if(t){const o=t.split(";").map(r=>r.trim()).filter(Boolean);for(let r=o.length-1;r>=0;r-=1){const i=o[r].split(":");if(i.length>=2){const s=i[0].trim().toLowerCase(),l=i.slice(1).join(":").trim();if(s==="color")return l.replace(/['"]+/g,"")}}}return(e=n.style.color)==null?void 0:e.replace(/['"]+/g,"")},renderHTML:n=>n.color?{style:`color: ${n.color}`}:{}}}}]},addCommands(){return{setColor:n=>({chain:e})=>e().setMark("textStyle",{color:n}).run(),unsetColor:()=>({chain:n})=>n().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),bg=ve.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:n=>n.style.fontFamily,renderHTML:n=>n.fontFamily?{style:`font-family: ${n.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:n=>({chain:e})=>e().setMark("textStyle",{fontFamily:n}).run(),unsetFontFamily:()=>({chain:n})=>n().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),j2=ve.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:n=>n.style.fontSize,renderHTML:n=>n.fontSize?{style:`font-size: ${n.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:n=>({chain:e})=>e().setMark("textStyle",{fontSize:n}).run(),unsetFontSize:()=>({chain:n})=>n().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),U2=ve.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:n=>n.style.lineHeight,renderHTML:n=>n.lineHeight?{style:`line-height: ${n.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:n=>({chain:e})=>e().setMark("textStyle",{lineHeight:n}).run(),unsetLineHeight:()=>({chain:n})=>n().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}});ve.create({name:"textStyleKit",addExtensions(){const n=[];return this.options.backgroundColor!==!1&&n.push(gg.configure(this.options.backgroundColor)),this.options.color!==!1&&n.push(yg.configure(this.options.color)),this.options.fontFamily!==!1&&n.push(bg.configure(this.options.fontFamily)),this.options.fontSize!==!1&&n.push(j2.configure(this.options.fontSize)),this.options.lineHeight!==!1&&n.push(U2.configure(this.options.lineHeight)),this.options.textStyle!==!1&&n.push(mg.configure(this.options.textStyle)),n}});const Si=Math.floor,W2=Math.abs,Or=(n,e)=>n<e?n:e,Es=(n,e)=>n>e?n:e,q2=n=>n!==0?n<0:1/n<0,K2=64,Jl=128,J2=1<<29,Nv=63,wl=127,G2=2147483647,Av=Number.MAX_SAFE_INTEGER,Ov=Number.MIN_SAFE_INTEGER,X2=Number.isInteger||(n=>typeof n=="number"&&isFinite(n)&&Si(n)===n),Y2=()=>new Set,vg=(n,e)=>{for(let t=0;t<n.length;t++)if(!e(n[t],t,n))return!1;return!0},LC=(n,e)=>{for(let t=0;t<n.length;t++)if(e(n[t],t,n))return!0;return!1},Q2=(n,e)=>{const t=new Array(n);for(let o=0;o<n;o++)t[o]=e(o,t);return t},Dd=Array.isArray,PC=String.fromCharCode,Z2=n=>n.toLowerCase(),eF=/^\s*/g,tF=n=>n.replace(eF,""),nF=/([A-Z])/g,$v=(n,e)=>tF(n.replace(nF,t=>`${e}${Z2(t)}`)),oF=n=>{const e=unescape(encodeURIComponent(n)),t=e.length,o=new Uint8Array(t);for(let r=0;r<t;r++)o[r]=e.codePointAt(r);return o},Gl=typeof TextEncoder<"u"?new TextEncoder:null,rF=n=>Gl.encode(n),iF=Gl?rF:oF;let Pf=typeof TextDecoder>"u"?null:new TextDecoder("utf-8",{fatal:!0,ignoreBOM:!0});Pf&&Pf.decode(new Uint8Array).length===1&&(Pf=null);const sF=(n,e)=>Q2(e,()=>n).join("");class lF{constructor(){this.cpos=0,this.cbuf=new Uint8Array(100),this.bufs=[]}}const aF=()=>new lF,cF=n=>{const e=aF();return n(e),dF(e)},uF=n=>{let e=n.cpos;for(let t=0;t<n.bufs.length;t++)e+=n.bufs[t].length;return e},dF=n=>{const e=new Uint8Array(uF(n));let t=0;for(let o=0;o<n.bufs.length;o++){const r=n.bufs[o];e.set(r,t),t+=r.length}return e.set(new Uint8Array(n.cbuf.buffer,0,n.cpos),t),e},fF=(n,e)=>{const t=n.cbuf.length;t-n.cpos<e&&(n.bufs.push(new Uint8Array(n.cbuf.buffer,0,n.cpos)),n.cbuf=new Uint8Array(Es(t,e)*2),n.cpos=0)},Bt=(n,e)=>{const t=n.cbuf.length;n.cpos===t&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(t*2),n.cpos=0),n.cbuf[n.cpos++]=e},Xl=(n,e)=>{for(;e>wl;)Bt(n,Jl|wl&e),e=Si(e/128);Bt(n,wl&e)},pF=(n,e)=>{const t=q2(e);for(t&&(e=-e),Bt(n,(e>Nv?Jl:0)|(t?K2:0)|Nv&e),e=Si(e/64);e>0;)Bt(n,(e>wl?Jl:0)|wl&e),e=Si(e/128)},rh=new Uint8Array(3e4),hF=rh.length/3,mF=(n,e)=>{if(e.length<hF){const t=Gl.encodeInto(e,rh).written||0;Xl(n,t);for(let o=0;o<t;o++)Bt(n,rh[o])}else VC(n,iF(e))},gF=(n,e)=>{const t=unescape(encodeURIComponent(e)),o=t.length;Xl(n,o);for(let r=0;r<o;r++)Bt(n,t.codePointAt(r))},Bv=Gl&&Gl.encodeInto?mF:gF,yF=(n,e)=>{const t=n.cbuf.length,o=n.cpos,r=Or(t-o,e.length),i=e.length-r;n.cbuf.set(e.subarray(0,r),o),n.cpos+=r,i>0&&(n.bufs.push(n.cbuf),n.cbuf=new Uint8Array(Es(t*2,i)),n.cbuf.set(e.subarray(r)),n.cpos=i)},VC=(n,e)=>{Xl(n,e.byteLength),yF(n,e)},kg=(n,e)=>{fF(n,e);const t=new DataView(n.cbuf.buffer,n.cpos,e);return n.cpos+=e,t},bF=(n,e)=>kg(n,4).setFloat32(0,e,!1),vF=(n,e)=>kg(n,8).setFloat64(0,e,!1),kF=(n,e)=>kg(n,8).setBigInt64(0,e,!1),Rv=new DataView(new ArrayBuffer(4)),wF=n=>(Rv.setFloat32(0,n),Rv.getFloat32(0)===n),ih=(n,e)=>{switch(typeof e){case"string":Bt(n,119),Bv(n,e);break;case"number":X2(e)&&W2(e)<=G2?(Bt(n,125),pF(n,e)):wF(e)?(Bt(n,124),bF(n,e)):(Bt(n,123),vF(n,e));break;case"bigint":Bt(n,122),kF(n,e);break;case"object":if(e===null)Bt(n,126);else if(Dd(e)){Bt(n,117),Xl(n,e.length);for(let t=0;t<e.length;t++)ih(n,e[t])}else if(e instanceof Uint8Array)Bt(n,116),VC(n,e);else{Bt(n,118);const t=Object.keys(e);Xl(n,t.length);for(let o=0;o<t.length;o++){const r=t[o];Bv(n,r),ih(n,e[r])}}break;case"boolean":Bt(n,e?120:121);break;default:Bt(n,127)}},Id=n=>new Error(n),zC=()=>{throw Id("Method unimplemented")},va=()=>{throw Id("Unexpected case")},kc=()=>new Map,FC=(n,e,t)=>{let o=n.get(e);return o===void 0&&n.set(e,o=t()),o},Yl=Symbol("Equality"),xF=(n,e)=>{var t;return n===e||!!((t=n==null?void 0:n[Yl])!=null&&t.call(n,e))||!1},CF=n=>typeof n=="object",HC=Object.keys,_v=n=>HC(n).length,ka=(n,e)=>{for(const t in n)if(!e(n[t],t))return!1;return!0},jC=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),wc=(n,e)=>{if(n===e)return!0;if(n==null||e==null||n.constructor!==e.constructor&&(n.constructor||Object)!==(e.constructor||Object))return!1;if(n[Yl]!=null)return n[Yl](e);switch(n.constructor){case ArrayBuffer:n=new Uint8Array(n),e=new Uint8Array(e);case Uint8Array:{if(n.byteLength!==e.byteLength)return!1;for(let t=0;t<n.length;t++)if(n[t]!==e[t])return!1;break}case Set:{if(n.size!==e.size)return!1;for(const t of n)if(!e.has(t))return!1;break}case Map:{if(n.size!==e.size)return!1;for(const t of n.keys())if(!e.has(t)||!wc(n.get(t),e.get(t)))return!1;break}case void 0:case Object:if(_v(n)!==_v(e))return!1;for(const t in n)if(!jC(n,t)||!wc(n[t],e[t]))return!1;break;case Array:if(n.length!==e.length)return!1;for(let t=0;t<n.length;t++)if(!wc(n[t],e[t]))return!1;break;default:return!1}return!0},SF=(n,e)=>e.includes(n),EF=()=>{let n=!0;return(e,t)=>{if(n){n=!1;try{e()}finally{n=!0}}else t!==void 0&&t()}},MF=/[\uD800-\uDBFF]/,TF=/[\uDC00-\uDFFF]/,NF=(n,e)=>{let t=0,o=0;for(;t<n.length&&t<e.length&&n[t]===e[t];)t++;for(t>0&&MF.test(n[t-1])&&t--;o+t<n.length&&o+t<e.length&&n[n.length-o-1]===e[e.length-o-1];)o++;return o>0&&TF.test(n[n.length-o])&&o--,{index:t,remove:n.length-t-o,insert:e.slice(t,e.length-o)}},AF=NF,OF=Math.random,$F=n=>n[Si(OF()*n.length)],Dv=n=>n===void 0?null:n;class BF{constructor(){this.map=new Map}setItem(e,t){this.map.set(e,t)}getItem(e){return this.map.get(e)}}let UC=new BF,RF=!0;try{typeof localStorage<"u"&&localStorage&&(UC=localStorage,RF=!1)}catch{}const _F=UC,Ms=typeof process<"u"&&process.release&&/node|io\.js/.test(process.release.name)&&Object.prototype.toString.call(typeof process<"u"?process:0)==="[object process]",WC=typeof window<"u"&&typeof document<"u"&&!Ms;let uo;const DF=()=>{if(uo===void 0)if(Ms){uo=kc();const n=process.argv;let e=null;for(let t=0;t<n.length;t++){const o=n[t];o[0]==="-"?(e!==null&&uo.set(e,""),e=o):e!==null&&(uo.set(e,o),e=null)}e!==null&&uo.set(e,"")}else typeof location=="object"?(uo=kc(),(location.search||"?").slice(1).split("&").forEach(n=>{if(n.length!==0){const[e,t]=n.split("=");uo.set(`--${$v(e,"-")}`,t),uo.set(`-${$v(e,"-")}`,t)}})):uo=kc();return uo},sh=n=>DF().has(n),lh=n=>Dv(Ms?process.env[n.toUpperCase().replaceAll("-","_")]:_F.getItem(n)),qC=n=>sh("--"+n)||lh(n)!==null,IF=qC("production"),LF=Ms&&SF(process.env.FORCE_COLOR,["true","1","2"]);LF||!sh("--no-colors")&&!qC("no-color")&&(!Ms||process.stdout.isTTY)&&(!Ms||sh("--color")||lh("COLORTERM")!==null||(lh("TERM")||"").includes("color"));const PF=n=>{let e="";for(let t=0;t<n.byteLength;t++)e+=PC(n[t]);return btoa(e)},VF=n=>Buffer.from(n.buffer,n.byteOffset,n.byteLength).toString("base64"),zF=WC?PF:VF,FF=n=>cF(e=>ih(e,n)),Iv=n=>n.next()>=.5,Vf=(n,e,t)=>Si(n.next()*(t+1-e)+e),KC=(n,e,t)=>Si(n.next()*(t+1-e)+e),wg=(n,e,t)=>KC(n,e,t),HF=n=>PC(wg(n,97,122)),jF=(n,e=0,t=20)=>{const o=wg(n,e,t);let r="";for(let i=0;i<o;i++)r+=HF(n);return r},zf=(n,e)=>e[wg(n,0,e.length-1)],UF=Symbol("0schema");class WF{constructor(){this._rerrs=[]}extend(e,t,o,r=null){this._rerrs.push({path:e,expected:t,has:o,message:r})}toString(){const e=[];for(let t=this._rerrs.length-1;t>0;t--){const o=this._rerrs[t];e.push(sF(" ",(this._rerrs.length-t)*2)+`${o.path!=null?`[${o.path}] `:""}${o.has} doesn't match ${o.expected}. ${o.message}`)}return e.join(`
|
|
206
|
+
`)}}const ah=(n,e)=>n===e?!0:n==null||e==null||n.constructor!==e.constructor?!1:n[Yl]?xF(n,e):Dd(n)?vg(n,t=>LC(e,o=>ah(t,o))):CF(n)?ka(n,(t,o)=>ah(t,e[o])):!1;class Gt{extends(e){let[t,o]=[this.shape,e.shape];return this.constructor._dilutes&&([o,t]=[t,o]),ah(t,o)}equals(e){return this.constructor===e.constructor&&wc(this.shape,e.shape)}[UF](){return!0}[Yl](e){return this.equals(e)}validate(e){return this.check(e)}check(e,t){zC()}get nullable(){return Is(this,Fd)}get optional(){return new XC(this)}cast(e){return Lv(e,this),e}expect(e){return Lv(e,this),e}}Je(Gt,"_dilutes",!1);class xg extends Gt{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t=void 0){const o=(e==null?void 0:e.constructor)===this.shape&&(this._c==null||this._c(e));return!o&&(t==null||t.extend(null,this.shape.name,e==null?void 0:e.constructor.name,(e==null?void 0:e.constructor)!==this.shape?"Constructor match failed":"Check failed")),o}}const mt=(n,e=null)=>new xg(n,e);mt(xg);class Cg extends Gt{constructor(e){super(),this.shape=e}check(e,t){const o=this.shape(e);return!o&&(t==null||t.extend(null,"custom prop",e==null?void 0:e.constructor.name,"failed to check custom prop")),o}}const Mt=n=>new Cg(n);mt(Cg);class Ld extends Gt{constructor(e){super(),this.shape=e}check(e,t){const o=this.shape.some(r=>r===e);return!o&&(t==null||t.extend(null,this.shape.join(" | "),e.toString())),o}}const Pd=(...n)=>new Ld(n),JC=mt(Ld),qF=RegExp.escape||(n=>n.replace(/[().|&,$^[\]]/g,e=>"\\"+e)),GC=n=>{if(Ts.check(n))return[qF(n)];if(JC.check(n))return n.shape.map(e=>e+"");if(iS.check(n))return["[+-]?\\d+.?\\d*"];if(sS.check(n))return[".*"];if(Ru.check(n))return n.shape.map(GC).flat(1);va()};class KF extends Gt{constructor(e){super(),this.shape=e,this._r=new RegExp("^"+e.map(GC).map(t=>`(${t.join("|")})`).join("")+"$")}check(e,t){const o=this._r.exec(e)!=null;return!o&&(t==null||t.extend(null,this._r.toString(),e.toString(),"String doesn't match string template.")),o}}mt(KF);const JF=Symbol("optional");class XC extends Gt{constructor(e){super(),this.shape=e}check(e,t){const o=e===void 0||this.shape.check(e);return!o&&(t==null||t.extend(null,"undefined (optional)","()")),o}get[JF](){return!0}}const GF=mt(XC);class XF extends Gt{check(e,t){return t==null||t.extend(null,"never",typeof e),!1}}mt(XF);const ed=class ed extends Gt{constructor(e,t=!1){super(),this.shape=e,this._isPartial=t}get partial(){return new ed(this.shape,!0)}check(e,t){return e==null?(t==null||t.extend(null,"object","null"),!1):ka(this.shape,(o,r)=>{const i=this._isPartial&&!jC(e,r)||o.check(e[r],t);return!i&&(t==null||t.extend(r.toString(),o.toString(),typeof e[r],"Object property does not match")),i})}};Je(ed,"_dilutes",!0);let Bu=ed;const YF=n=>new Bu(n),QF=mt(Bu),ZF=Mt(n=>n!=null&&(n.constructor===Object||n.constructor==null));class YC extends Gt{constructor(e,t){super(),this.shape={keys:e,values:t}}check(e,t){return e!=null&&ka(e,(o,r)=>{const i=this.shape.keys.check(r,t);return!i&&(t==null||t.extend(r+"","Record",typeof e,i?"Key doesn't match schema":"Value doesn't match value")),i&&this.shape.values.check(o,t)})}}const QC=(n,e)=>new YC(n,e),eH=mt(YC);class ZC extends Gt{constructor(e){super(),this.shape=e}check(e,t){return e!=null&&ka(this.shape,(o,r)=>{const i=o.check(e[r],t);return!i&&(t==null||t.extend(r.toString(),"Tuple",typeof o)),i})}}const tH=(...n)=>new ZC(n);mt(ZC);class eS extends Gt{constructor(e){super(),this.shape=e.length===1?e[0]:new Vd(e)}check(e,t){const o=Dd(e)&&vg(e,r=>this.shape.check(r));return!o&&(t==null||t.extend(null,"Array","")),o}}const tS=(...n)=>new eS(n),nH=mt(eS),oH=Mt(n=>Dd(n));class nS extends Gt{constructor(e,t){super(),this.shape=e,this._c=t}check(e,t){const o=e instanceof this.shape&&(this._c==null||this._c(e));return!o&&(t==null||t.extend(null,this.shape.name,e==null?void 0:e.constructor.name)),o}}const rH=(n,e=null)=>new nS(n,e);mt(nS);const iH=rH(Gt);class sH extends Gt{constructor(e){super(),this.len=e.length-1,this.args=tH(...e.slice(-1)),this.res=e[this.len]}check(e,t){const o=e.constructor===Function&&e.length<=this.len;return!o&&(t==null||t.extend(null,"function",typeof e)),o}}const lH=mt(sH),aH=Mt(n=>typeof n=="function");class cH extends Gt{constructor(e){super(),this.shape=e}check(e,t){const o=vg(this.shape,r=>r.check(e,t));return!o&&(t==null||t.extend(null,"Intersectinon",typeof e)),o}}mt(cH,n=>n.shape.length>0);class Vd extends Gt{constructor(e){super(),this.shape=e}check(e,t){const o=LC(this.shape,r=>r.check(e,t));return t==null||t.extend(null,"Union",typeof e),o}}Je(Vd,"_dilutes",!0);const Is=(...n)=>n.findIndex(e=>Ru.check(e))>=0?Is(...n.map(e=>Ql(e)).map(e=>Ru.check(e)?e.shape:[e]).flat(1)):n.length===1?n[0]:new Vd(n),Ru=mt(Vd),oS=()=>!0,_u=Mt(oS),uH=mt(Cg,n=>n.shape===oS),Sg=Mt(n=>typeof n=="bigint"),dH=Mt(n=>n===Sg),rS=Mt(n=>typeof n=="symbol");Mt(n=>n===rS);const ls=Mt(n=>typeof n=="number"),iS=Mt(n=>n===ls),Ts=Mt(n=>typeof n=="string"),sS=Mt(n=>n===Ts),zd=Mt(n=>typeof n=="boolean"),fH=Mt(n=>n===zd),lS=Pd(void 0);mt(Ld,n=>n.shape.length===1&&n.shape[0]===void 0);Pd(void 0);const Fd=Pd(null),pH=mt(Ld,n=>n.shape.length===1&&n.shape[0]===null);mt(Uint8Array);mt(xg,n=>n.shape===Uint8Array);const hH=Is(ls,Ts,Fd,lS,Sg,zd,rS);(()=>{const n=tS(_u),e=QC(Ts,_u),t=Is(ls,Ts,Fd,zd,n,e);return n.shape=t,e.shape.values=t,t})();const Ql=n=>{if(iH.check(n))return n;if(ZF.check(n)){const e={};for(const t in n)e[t]=Ql(n[t]);return YF(e)}else{if(oH.check(n))return Is(...n.map(Ql));if(hH.check(n))return Pd(n);if(aH.check(n))return mt(n)}va()},Lv=IF?()=>{}:(n,e)=>{const t=new WF;if(!e.check(n,t))throw Id(`Expected value to be of type ${e.constructor.name}.
|
|
207
|
+
${t.toString()}`)};class mH{constructor(e){this.patterns=[],this.$state=e}if(e,t){return this.patterns.push({if:Ql(e),h:t}),this}else(e){return this.if(_u,e)}done(){return(e,t)=>{for(let o=0;o<this.patterns.length;o++){const r=this.patterns[o];if(r.if.check(e))return r.h(e,t)}throw Id("Unhandled pattern")}}}const gH=n=>new mH(n),aS=gH(_u).if(iS,(n,e)=>Vf(e,Ov,Av)).if(sS,(n,e)=>jF(e)).if(fH,(n,e)=>Iv(e)).if(dH,(n,e)=>BigInt(Vf(e,Ov,Av))).if(Ru,(n,e)=>Fi(e,zf(e,n.shape))).if(QF,(n,e)=>{const t={};for(const o in n.shape){let r=n.shape[o];if(GF.check(r)){if(Iv(e))continue;r=r.shape}t[o]=aS(r,e)}return t}).if(nH,(n,e)=>{const t=[],o=KC(e,0,42);for(let r=0;r<o;r++)t.push(Fi(e,n.shape));return t}).if(JC,(n,e)=>zf(e,n.shape)).if(pH,(n,e)=>null).if(lH,(n,e)=>{const t=Fi(e,n.res);return()=>t}).if(uH,(n,e)=>Fi(e,zf(e,[ls,Ts,Fd,lS,Sg,zd,tS(ls),QC(Is("a","b","c"),ls)]))).if(eH,(n,e)=>{const t={},o=Vf(e,0,3);for(let r=0;r<o;r++){const i=Fi(e,n.shape.keys),s=Fi(e,n.shape.values);t[i]=s}return t}).done(),Fi=(n,e)=>aS(Ql(e),n),wa=typeof document<"u"?document:{};Mt(n=>n.nodeType===kH);typeof DOMParser<"u"&&new DOMParser;Mt(n=>n.nodeType===yH);Mt(n=>n.nodeType===bH);const yH=wa.ELEMENT_NODE,bH=wa.TEXT_NODE,vH=wa.DOCUMENT_NODE,kH=wa.DOCUMENT_FRAGMENT_NODE;Mt(n=>n.nodeType===vH);const wH=n=>class{constructor(t){this._=t}destroy(){n(this._)}},xH=wH(clearTimeout),Eg=(n,e)=>new xH(setTimeout(e,n)),ko=(n,e)=>n>>>e|n<<32-e,CH=n=>ko(n,2)^ko(n,13)^ko(n,22),SH=n=>ko(n,6)^ko(n,11)^ko(n,25),EH=n=>ko(n,7)^ko(n,18)^n>>>3,MH=n=>ko(n,17)^ko(n,19)^n>>>10,TH=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),NH=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);class AH{constructor(){const e=new ArrayBuffer(320);this._H=new Uint32Array(e,0,8),this._H.set(NH),this._W=new Uint32Array(e,64,64)}_updateHash(){const e=this._H,t=this._W;for(let f=16;f<64;f++)t[f]=MH(t[f-2])+t[f-7]+EH(t[f-15])+t[f-16];let o=e[0],r=e[1],i=e[2],s=e[3],l=e[4],a=e[5],u=e[6],d=e[7];for(let f=0,p,h;f<64;f++)p=d+SH(l)+(l&a^~l&u)+TH[f]+t[f]>>>0,h=CH(o)+(o&r^o&i^r&i)>>>0,d=u,u=a,a=l,l=s+p>>>0,s=i,i=r,r=o,o=p+h>>>0;e[0]+=o,e[1]+=r,e[2]+=i,e[3]+=s,e[4]+=l,e[5]+=a,e[6]+=u,e[7]+=d}digest(e){let t=0;for(;t+56<=e.length;){let s=0;for(;s<16&&t+3<e.length;s++)this._W[s]=e[t++]<<24|e[t++]<<16|e[t++]<<8|e[t++];if(t%64!==0){for(this._W.fill(0,s,16);t<e.length;)this._W[s]|=e[t]<<(3-t%4)*8,t++;this._W[s]|=Jl<<(3-t%4)*8}this._updateHash()}const o=t%64!==0;this._W.fill(0,0,16);let r=0;for(;t<e.length;r++)for(let s=3;s>=0&&t<e.length;s--)this._W[r]|=e[t++]<<s*8;o||(this._W[r-(t%4===0?0:1)]|=Jl<<(3-t%4)*8),this._W[14]=e.byteLength/J2,this._W[15]=e.byteLength*8,this._updateHash();const i=new Uint8Array(32);for(let s=0;s<this._H.length;s++)for(let l=0;l<4;l++)i[s*4+l]=this._H[s]>>>(3-l)*8;return i}}const OH=n=>new AH().digest(n),Ge=new ce("y-sync"),Xo=new ce("y-undo"),Ga=new ce("yjs-cursor"),$H=n=>{for(let t=6;t<n.length;t++)n[t%6]=n[t%6]^n[t];return n.slice(0,6)},BH=n=>zF($H(OH(FF(n)))),Du=(n,e)=>e===void 0?!n.deleted:e.sv.has(n.id.client)&&e.sv.get(n.id.client)>n.id.clock&&!oe.isDeleted(e.ds,n.id),RH=[{light:"#ecd44433",dark:"#ecd444"}],_H=(n,e,t)=>{if(!n.has(t)){if(n.size<e.length){const o=Y2();n.forEach(r=>o.add(r)),e=e.filter(r=>!o.has(r))}n.set(t,$F(e))}return n.get(t)},DH=(n,{colors:e=RH,colorMapping:t=new Map,permanentUserData:o=null,onFirstRender:r=()=>{},mapping:i}={})=>{let s=!1;const l=new PH(n,i),a=new ue({props:{editable:u=>{const d=Ge.getState(u);return d.snapshot==null&&d.prevSnapshot==null}},key:Ge,state:{init:(u,d)=>({type:n,doc:n.doc,binding:l,snapshot:null,prevSnapshot:null,isChangeOrigin:!1,isUndoRedoOperation:!1,addToHistory:!0,colors:e,colorMapping:t,permanentUserData:o}),apply:(u,d)=>{const f=u.getMeta(Ge);if(f!==void 0){d=Object.assign({},d);for(const p in f)d[p]=f[p]}return d.addToHistory=u.getMeta("addToHistory")!==!1,d.isChangeOrigin=f!==void 0&&!!f.isChangeOrigin,d.isUndoRedoOperation=f!==void 0&&!!f.isChangeOrigin&&!!f.isUndoRedoOperation,l.prosemirrorView!==null&&f!==void 0&&(f.snapshot!=null||f.prevSnapshot!=null)&&Eg(0,()=>{l.prosemirrorView!=null&&(f.restore==null?l._renderSnapshot(f.snapshot,f.prevSnapshot,d):(l._renderSnapshot(f.snapshot,f.snapshot,d),delete d.restore,delete d.snapshot,delete d.prevSnapshot,l.mux(()=>{l._prosemirrorChanged(l.prosemirrorView.state.doc)})))}),d}},view:u=>(l.initView(u),i==null&&l._forceRerender(),r(),{update:()=>{const d=a.getState(u.state);if(d.snapshot==null&&d.prevSnapshot==null&&(s||u.state.doc.content.findDiffStart(u.state.doc.type.createAndFill().content)!==null)){if(s=!0,d.addToHistory===!1&&!d.isChangeOrigin){const f=Xo.getState(u.state),p=f&&f.undoManager;p&&p.stopCapturing()}l.mux(()=>{d.doc.transact(f=>{f.meta.set("addToHistory",d.addToHistory),l._prosemirrorChanged(u.state.doc)},Ge)})}},destroy:()=>{l.destroy()}})});return a},IH=(n,e,t)=>{if(e!==null&&e.anchor!==null&&e.head!==null)if(e.type==="all")n.setSelection(new on(n.doc));else if(e.type==="node"){const o=li(t.doc,t.type,e.anchor,t.mapping);n.setSelection(LH(n,o))}else{const o=li(t.doc,t.type,e.anchor,t.mapping),r=li(t.doc,t.type,e.head,t.mapping);o!==null&&r!==null&&n.setSelection(q.between(n.doc.resolve(o),n.doc.resolve(r)))}},LH=(n,e)=>{const t=n.doc.resolve(e);return t.nodeAfter?Q.create(n.doc,e):q.near(t)},ch=(n,e)=>({type:e.selection.jsonID,anchor:ea(e.selection.anchor,n.type,n.mapping),head:ea(e.selection.head,n.type,n.mapping)});class PH{constructor(e,t=new Map){this.type=e,this.prosemirrorView=null,this.mux=EF(),this.mapping=t,this.isOMark=new Map,this._observeFunction=this._typeChanged.bind(this),this.doc=e.doc,this.beforeTransactionSelection=null,this.beforeAllTransactions=()=>{this.beforeTransactionSelection===null&&this.prosemirrorView!=null&&(this.beforeTransactionSelection=ch(this,this.prosemirrorView.state))},this.afterAllTransactions=()=>{this.beforeTransactionSelection=null},this._domSelectionInView=null}get _tr(){return this.prosemirrorView.state.tr.setMeta("addToHistory",!1)}_isLocalCursorInView(){return this.prosemirrorView.hasFocus()?(WC&&this._domSelectionInView===null&&(Eg(0,()=>{this._domSelectionInView=null}),this._domSelectionInView=this._isDomSelectionInView()),this._domSelectionInView):!1}_isDomSelectionInView(){const e=this.prosemirrorView._root.getSelection();if(e==null||e.anchorNode==null)return!1;const t=this.prosemirrorView._root.createRange();t.setStart(e.anchorNode,e.anchorOffset),t.setEnd(e.focusNode,e.focusOffset),t.getClientRects().length===0&&t.startContainer&&t.collapsed&&t.selectNodeContents(t.startContainer);const r=t.getBoundingClientRect(),i=wa.documentElement;return r.bottom>=0&&r.right>=0&&r.left<=(window.innerWidth||i.clientWidth||0)&&r.top<=(window.innerHeight||i.clientHeight||0)}renderSnapshot(e,t){t||(t=oe.createSnapshot(oe.createDeleteSet(),new Map)),this.prosemirrorView.dispatch(this._tr.setMeta(Ge,{snapshot:e,prevSnapshot:t}))}unrenderSnapshot(){this.mapping.clear(),this.mux(()=>{const e=this.type.toArray().map(o=>xc(o,this.prosemirrorView.state.schema,this)).filter(o=>o!==null),t=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new H(D.from(e),0,0));t.setMeta(Ge,{snapshot:null,prevSnapshot:null}),this.prosemirrorView.dispatch(t)})}_forceRerender(){this.mapping.clear(),this.mux(()=>{const e=this.beforeTransactionSelection!==null?null:this.prosemirrorView.state.selection,t=this.type.toArray().map(r=>xc(r,this.prosemirrorView.state.schema,this)).filter(r=>r!==null),o=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new H(D.from(t),0,0));if(e){const r=Or(Es(e.anchor,0),o.doc.content.size),i=Or(Es(e.head,0),o.doc.content.size);o.setSelection(q.create(o.doc,r,i))}this.prosemirrorView.dispatch(o.setMeta(Ge,{isChangeOrigin:!0,binding:this}))})}_renderSnapshot(e,t,o){let r=this.doc,i=this.type;if(e||(e=oe.snapshot(this.doc)),e instanceof Uint8Array||t instanceof Uint8Array)if((!(e instanceof Uint8Array)||!(t instanceof Uint8Array))&&va(),r=new oe.Doc({gc:!1}),oe.applyUpdateV2(r,t),t=oe.snapshot(r),oe.applyUpdateV2(r,e),e=oe.snapshot(r),i._item===null){const s=Array.from(this.doc.share.keys()).find(l=>this.doc.share.get(l)===this.type);i=r.getXmlFragment(s)}else{const s=r.store.clients.get(i._item.id.client)??[],l=oe.findIndexSS(s,i._item.id.clock);i=s[l].content.type}this.mapping.clear(),this.mux(()=>{r.transact(s=>{const l=o.permanentUserData;l&&l.dss.forEach(f=>{oe.iterateDeletedStructs(s,f,p=>{})});const a=(f,p)=>{const h=f==="added"?l.getUserByClientId(p.client):l.getUserByDeletedId(p);return{user:h,type:f,color:_H(o.colorMapping,o.colors,h)}},u=oe.typeListToArraySnapshot(i,new oe.Snapshot(t.ds,e.sv)).map(f=>!f._item.deleted||Du(f._item,e)||Du(f._item,t)?xc(f,this.prosemirrorView.state.schema,{mapping:new Map,isOMark:new Map},e,t,a):null).filter(f=>f!==null),d=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new H(D.from(u),0,0));this.prosemirrorView.dispatch(d.setMeta(Ge,{isChangeOrigin:!0}))},Ge)})}_typeChanged(e,t){if(this.prosemirrorView==null)return;const o=Ge.getState(this.prosemirrorView.state);if(e.length===0||o.snapshot!=null||o.prevSnapshot!=null){this.renderSnapshot(o.snapshot,o.prevSnapshot);return}this.mux(()=>{const r=(l,a)=>this.mapping.delete(a);oe.iterateDeletedStructs(t,t.deleteSet,l=>{if(l.constructor===oe.Item){const a=l.content.type;a&&this.mapping.delete(a)}}),t.changed.forEach(r),t.changedParentTypes.forEach(r);const i=this.type.toArray().map(l=>cS(l,this.prosemirrorView.state.schema,this)).filter(l=>l!==null);let s=this._tr.replace(0,this.prosemirrorView.state.doc.content.size,new H(D.from(i),0,0));IH(s,this.beforeTransactionSelection,this),s=s.setMeta(Ge,{isChangeOrigin:!0,isUndoRedoOperation:t.origin instanceof oe.UndoManager}),this.beforeTransactionSelection!==null&&this._isLocalCursorInView()&&s.scrollIntoView(),this.prosemirrorView.dispatch(s)})}_prosemirrorChanged(e){this.doc.transact(()=>{dh(this.doc,this.type,e,this),this.beforeTransactionSelection=ch(this,this.prosemirrorView.state)},Ge)}initView(e){this.prosemirrorView!=null&&this.destroy(),this.prosemirrorView=e,this.doc.on("beforeAllTransactions",this.beforeAllTransactions),this.doc.on("afterAllTransactions",this.afterAllTransactions),this.type.observeDeep(this._observeFunction)}destroy(){this.prosemirrorView!=null&&(this.prosemirrorView=null,this.type.unobserveDeep(this._observeFunction),this.doc.off("beforeAllTransactions",this.beforeAllTransactions),this.doc.off("afterAllTransactions",this.afterAllTransactions))}}const cS=(n,e,t,o,r,i)=>{const s=t.mapping.get(n);if(s===void 0){if(n instanceof oe.XmlElement)return xc(n,e,t,o,r,i);throw zC()}return s},xc=(n,e,t,o,r,i)=>{const s=[],l=a=>{var u,d;if(a instanceof oe.XmlElement){const f=cS(a,e,t,o,r,i);f!==null&&s.push(f)}else{const f=(d=(u=a._item.right)==null?void 0:u.content)==null?void 0:d.type;f instanceof oe.Text&&!f._item.deleted&&f._item.id.client===f.doc.clientID&&(a.applyDelta([{retain:a.length},...f.toDelta()]),f.doc.transact(h=>{f._item.delete(h)}));const p=VH(a,e,t,o,r,i);p!==null&&p.forEach(h=>{h!==null&&s.push(h)})}};o===void 0||r===void 0?n.toArray().forEach(l):oe.typeListToArraySnapshot(n,new oe.Snapshot(r.ds,o.sv)).forEach(l);try{const a=n.getAttributes(o);o!==void 0&&(Du(n._item,o)?Du(n._item,r)||(a.ychange=i?i("added",n._item.id):{type:"added"}):a.ychange=i?i("removed",n._item.id):{type:"removed"});const u=e.node(n.nodeName,a,s);return t.mapping.set(n,u),u}catch{return n.doc.transact(u=>{n._item.delete(u)},Ge),t.mapping.delete(n),null}},VH=(n,e,t,o,r,i)=>{const s=[],l=n.toDelta(o,r,i);try{for(let a=0;a<l.length;a++){const u=l[a];s.push(e.text(u.insert,WH(u.attributes,e)))}}catch{return n.doc.transact(u=>{n._item.delete(u)},Ge),null}return s},zH=(n,e)=>{const t=new oe.XmlText,o=n.map(r=>({insert:r.text,attributes:dS(r.marks,e)}));return t.applyDelta(o),e.mapping.set(t,n),t},FH=(n,e)=>{const t=new oe.XmlElement(n.type.name);for(const o in n.attrs){const r=n.attrs[o];r!==null&&o!=="ychange"&&t.setAttribute(o,r)}return t.insert(0,Hd(n).map(o=>uh(o,e))),e.mapping.set(t,n),t},uh=(n,e)=>n instanceof Array?zH(n,e):FH(n,e),Pv=n=>typeof n=="object"&&n!==null,Mg=(n,e)=>{const t=Object.keys(n).filter(r=>n[r]!==null);let o=t.length===Object.keys(e).filter(r=>e[r]!==null).length;for(let r=0;r<t.length&&o;r++){const i=t[r],s=n[i],l=e[i];o=i==="ychange"||s===l||Pv(s)&&Pv(l)&&Mg(s,l)}return o},Hd=n=>{const e=n.content.content,t=[];for(let o=0;o<e.length;o++){const r=e[o];if(r.isText){const i=[];for(let s=e[o];o<e.length&&s.isText;s=e[++o])i.push(s);o--,t.push(i)}else t.push(r)}return t},uS=(n,e)=>{const t=n.toDelta();return t.length===e.length&&t.every((o,r)=>o.insert===e[r].text&&HC(o.attributes||{}).length===e[r].marks.length&&ka(o.attributes,(i,s)=>{var d;const l=Tg(s),a=e[r].marks;return a.find(f=>f.type.name===l)?Mg(i,(d=a.find(f=>f.type.name===l))==null?void 0:d.attrs):!1}))},Zl=(n,e)=>{if(n instanceof oe.XmlElement&&!(e instanceof Array)&&fh(n,e)){const t=Hd(e);return n._length===t.length&&Mg(n.getAttributes(),e.attrs)&&n.toArray().every((o,r)=>Zl(o,t[r]))}return n instanceof oe.XmlText&&e instanceof Array&&uS(n,e)},Iu=(n,e)=>n===e||n instanceof Array&&e instanceof Array&&n.length===e.length&&n.every((t,o)=>e[o]===t),Vv=(n,e,t)=>{const o=n.toArray(),r=Hd(e),i=r.length,s=o.length,l=Or(s,i);let a=0,u=0,d=!1;for(;a<l;a++){const f=o[a],p=r[a];if(Iu(t.mapping.get(f),p))d=!0;else if(!Zl(f,p))break}for(;a+u<l;u++){const f=o[s-u-1],p=r[i-u-1];if(Iu(t.mapping.get(f),p))d=!0;else if(!Zl(f,p))break}return{equalityFactor:a+u,foundMappedChild:d}},HH=n=>{let e="",t=n._start;const o={};for(;t!==null;)t.deleted||(t.countable&&t.content instanceof oe.ContentString?e+=t.content.str:t.content instanceof oe.ContentFormat&&(o[t.content.key]=null)),t=t.right;return{str:e,nAttrs:o}},jH=(n,e,t)=>{t.mapping.set(n,e);const{nAttrs:o,str:r}=HH(n),i=e.map(u=>({insert:u.text,attributes:Object.assign({},o,dS(u.marks,t))})),{insert:s,remove:l,index:a}=AF(r,i.map(u=>u.insert).join(""));n.delete(a,l),n.insert(a,s),n.applyDelta(i.map(u=>({retain:u.insert.length,attributes:u.attributes})))},UH=/(.*)(--[a-zA-Z0-9+/=]{8})$/,Tg=n=>{var e;return((e=UH.exec(n))==null?void 0:e[1])??n},WH=(n,e)=>{const t=[];for(const o in n)t.push(e.mark(Tg(o),n[o]));return t},dS=(n,e)=>{const t={};return n.forEach(o=>{if(o.type.name!=="ychange"){const r=FC(e.isOMark,o.type,()=>!o.type.excludes(o.type));t[r?`${o.type.name}--${BH(o.toJSON())}`:o.type.name]=o.attrs}}),t},dh=(n,e,t,o)=>{if(e instanceof oe.XmlElement&&e.nodeName!==t.type.name)throw new Error("node name mismatch!");if(o.mapping.set(e,t),e instanceof oe.XmlElement){const f=e.getAttributes(),p=t.attrs;for(const h in p)p[h]!==null?f[h]!==p[h]&&h!=="ychange"&&e.setAttribute(h,p[h]):e.removeAttribute(h);for(const h in f)p[h]===void 0&&e.removeAttribute(h)}const r=Hd(t),i=r.length,s=e.toArray(),l=s.length,a=Or(i,l);let u=0,d=0;for(;u<a;u++){const f=s[u],p=r[u];if(!Iu(o.mapping.get(f),p))if(Zl(f,p))o.mapping.set(f,p);else break}for(;d+u+1<a;d++){const f=s[l-d-1],p=r[i-d-1];if(!Iu(o.mapping.get(f),p))if(Zl(f,p))o.mapping.set(f,p);else break}n.transact(()=>{for(;l-u-d>0&&i-u-d>0;){const p=s[u],h=r[u],m=s[l-d-1],g=r[i-d-1];if(p instanceof oe.XmlText&&h instanceof Array)uS(p,h)||jH(p,h,o),u+=1;else{let y=p instanceof oe.XmlElement&&fh(p,h),b=m instanceof oe.XmlElement&&fh(m,g);if(y&&b){const v=Vv(p,h,o),w=Vv(m,g,o);v.foundMappedChild&&!w.foundMappedChild?b=!1:!v.foundMappedChild&&w.foundMappedChild||v.equalityFactor<w.equalityFactor?y=!1:b=!1}y?(dh(n,p,h,o),u+=1):b?(dh(n,m,g,o),d+=1):(o.mapping.delete(e.get(u)),e.delete(u,1),e.insert(u,[uh(h,o)]),u+=1)}}const f=l-u-d;if(l===1&&i===0&&s[0]instanceof oe.XmlText?(o.mapping.delete(s[0]),s[0].delete(0,s[0].length)):f>0&&(e.slice(u,u+f).forEach(p=>o.mapping.delete(p)),e.delete(u,f)),u+d<i){const p=[];for(let h=u;h<i-d;h++)p.push(uh(r[h],o));e.insert(u,p)}},Ge)},fh=(n,e)=>!(e instanceof Array)&&n.nodeName===e.type.name;let xl=null;const qH=()=>{const n=xl;xl=null,n.forEach((e,t)=>{const o=t.state.tr,r=Ge.getState(t.state);r&&r.binding&&!r.binding.isDestroyed&&(e.forEach((i,s)=>{o.setMeta(s,i)}),t.dispatch(o))})},KH=(n,e,t)=>{xl||(xl=new Map,Eg(0,qH)),FC(xl,n,kc).set(e,t)},ea=(n,e,t)=>{if(n===0)return oe.createRelativePositionFromTypeIndex(e,0,-1);let o=e._first===null?null:e._first.content.type;for(;o!==null&&e!==o;){if(o instanceof oe.XmlText){if(o._length>=n)return oe.createRelativePositionFromTypeIndex(o,n,-1);if(n-=o._length,o._item!==null&&o._item.next!==null)o=o._item.next.content.type;else{do o=o._item===null?null:o._item.parent,n--;while(o!==e&&o!==null&&o._item!==null&&o._item.next===null);o!==null&&o!==e&&(o=o._item===null?null:o._item.next.content.type)}}else{const r=(t.get(o)||{nodeSize:0}).nodeSize;if(o._first!==null&&n<r)o=o._first.content.type,n--;else{if(n===1&&o._length===0&&r>1)return new oe.RelativePosition(o._item===null?null:o._item.id,o._item===null?oe.findRootTypeKey(o):null,null);if(n-=r,o._item!==null&&o._item.next!==null)o=o._item.next.content.type;else{if(n===0)return o=o._item===null?o:o._item.parent,new oe.RelativePosition(o._item===null?null:o._item.id,o._item===null?oe.findRootTypeKey(o):null,null);do o=o._item.parent,n--;while(o!==e&&o._item.next===null);o!==e&&(o=o._item.next.content.type)}}}if(o===null)throw va();if(n===0&&o.constructor!==oe.XmlText&&o!==e)return JH(o._item.parent,o._item)}return oe.createRelativePositionFromTypeIndex(e,e._length,-1)},JH=(n,e)=>{let t=null,o=null;return n._item===null?o=oe.findRootTypeKey(n):t=oe.createID(n._item.id.client,n._item.id.clock),new oe.RelativePosition(t,o,e.id)},li=(n,e,t,o)=>{const r=oe.createAbsolutePositionFromRelativePosition(t,n);if(r===null||r.type!==e&&!oe.isParentOf(e,r.type._item))return null;let i=r.type,s=0;if(i.constructor===oe.XmlText)s=r.index;else if(i._item===null||!i._item.deleted){let l=i._first,a=0;for(;a<i._length&&a<r.index&&l!==null;){if(!l.deleted){const u=l.content.type;a++,u instanceof oe.XmlText?s+=u._length:s+=o.get(u).nodeSize}l=l.right}s+=1}for(;i!==e&&i._item!==null;){const l=i._item.parent;if(l._item===null||!l._item.deleted){s+=1;let a=l._first;for(;a!==null;){const u=a.content.type;if(u===i)break;a.deleted||(u instanceof oe.XmlText?s+=u._length:s+=o.get(u).nodeSize),a=a.right}}i=l}return s-1};function GH(n){const e=n.toArray(),t=o=>{let r;if(o instanceof oe.XmlText)r=o.toDelta().map(s=>{const l={type:"text",text:s.insert};return s.attributes&&(l.marks=Object.keys(s.attributes).map(a=>{const u=s.attributes[a],f={type:Tg(a)};return Object.keys(u)&&(f.attrs=u),f})),l});else if(o instanceof oe.XmlElement){r={type:o.nodeName};const i=o.getAttributes();Object.keys(i).length&&(r.attrs=i);const s=o.toArray();s.length&&(r.content=s.map(t).flat())}else va();return r};return{type:"doc",content:e.map(t)}}const XH=(n,e,t)=>n!==e,YH=n=>{const e=document.createElement("span");e.classList.add("ProseMirror-yjs-cursor"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");t.setAttribute("style",`background-color: ${n.color}`),t.insertBefore(document.createTextNode(n.name),null);const o=document.createTextNode(""),r=document.createTextNode("");return e.insertBefore(o,null),e.insertBefore(t,null),e.insertBefore(r,null),e},fS=n=>({style:`background-color: ${n.color}70`,class:"ProseMirror-yjs-selection"}),QH=/^#[0-9a-fA-F]{6}$/,zv=(n,e,t,o,r)=>{const i=Ge.getState(n),s=i.doc,l=[];return i.snapshot!=null||i.prevSnapshot!=null||i.binding.mapping.size===0?Se.create(n.doc,[]):(e.getStates().forEach((a,u)=>{if(t(s.clientID,u,a)&&a.cursor!=null){const d=a.user||{};d.color==null?d.color="#ffa500":QH.test(d.color)||console.warn("A user uses an unsupported color format",d),d.name==null&&(d.name=`User: ${u}`);let f=li(s,i.type,oe.createRelativePositionFromJSON(a.cursor.anchor),i.binding.mapping),p=li(s,i.type,oe.createRelativePositionFromJSON(a.cursor.head),i.binding.mapping);if(f!==null&&p!==null){const h=Es(n.doc.content.size-1,0);f=Or(f,h),p=Or(p,h),l.push(Ve.widget(p,()=>o(d,u),{key:u+"",side:10}));const m=Or(f,p),g=Es(f,p);l.push(Ve.inline(m,g,r(d,u),{inclusiveEnd:!0,inclusiveStart:!1}))}}}),Se.create(n.doc,l))},ZH=(n,{awarenessStateFilter:e=XH,cursorBuilder:t=YH,selectionBuilder:o=fS,getSelection:r=s=>s.selection}={},i="cursor")=>new ue({key:Ga,state:{init(s,l){return zv(l,n,e,t,o)},apply(s,l,a,u){const d=Ge.getState(u),f=s.getMeta(Ga);return d&&d.isChangeOrigin||f&&f.awarenessUpdated?zv(u,n,e,t,o):l.map(s.mapping,s.doc)}},props:{decorations:s=>Ga.getState(s)},view:s=>{const l=()=>{s.docView&&KH(s,Ga,{awarenessUpdated:!0})},a=()=>{const u=Ge.getState(s.state),d=n.getLocalState()||{};if(s.hasFocus()){const f=r(s.state),p=ea(f.anchor,u.type,u.binding.mapping),h=ea(f.head,u.type,u.binding.mapping);(d.cursor==null||!oe.compareRelativePositions(oe.createRelativePositionFromJSON(d.cursor.anchor),p)||!oe.compareRelativePositions(oe.createRelativePositionFromJSON(d.cursor.head),h))&&n.setLocalStateField(i,{anchor:p,head:h})}else d.cursor!=null&&li(u.doc,u.type,oe.createRelativePositionFromJSON(d.cursor.anchor),u.binding.mapping)!==null&&n.setLocalStateField(i,null)};return n.on("change",l),s.dom.addEventListener("focusin",a),s.dom.addEventListener("focusout",a),{update:a,destroy:()=>{s.dom.removeEventListener("focusin",a),s.dom.removeEventListener("focusout",a),n.off("change",l),n.setLocalStateField(i,null)}}}}),ej=n=>{const e=Xo.getState(n).undoManager;if(e!=null)return e.undo(),!0},tj=n=>{const e=Xo.getState(n).undoManager;if(e!=null)return e.redo(),!0},nj=new Set(["paragraph"]),oj=(n,e)=>!(n instanceof Zi.Item)||!(n.content instanceof Zi.ContentType)||!(n.content.type instanceof Zi.Text||n.content.type instanceof Zi.XmlElement&&e.has(n.content.type.nodeName))||n.content.type._length===0,rj=({protectedNodes:n=nj,trackedOrigins:e=[],undoManager:t=null}={})=>new ue({key:Xo,state:{init:(o,r)=>{const i=Ge.getState(r),s=t||new Zi.UndoManager(i.type,{trackedOrigins:new Set([Ge].concat(e)),deleteFilter:l=>oj(l,n),captureTransaction:l=>l.meta.get("addToHistory")!==!1});return{undoManager:s,prevSel:null,hasUndoOps:s.undoStack.length>0,hasRedoOps:s.redoStack.length>0}},apply:(o,r,i,s)=>{const l=Ge.getState(s).binding,a=r.undoManager,u=a.undoStack.length>0,d=a.redoStack.length>0;return l?{undoManager:a,prevSel:ch(l,i),hasUndoOps:u,hasRedoOps:d}:u!==r.hasUndoOps||d!==r.hasRedoOps?Object.assign({},r,{hasUndoOps:a.undoStack.length>0,hasRedoOps:a.redoStack.length>0}):r}},view:o=>{const r=Ge.getState(o.state),i=Xo.getState(o.state).undoManager;return i.on("stack-item-added",({stackItem:s})=>{const l=r.binding;l&&s.meta.set(l,Xo.getState(o.state).prevSel)}),i.on("stack-item-popped",({stackItem:s})=>{const l=r.binding;l&&(l.beforeTransactionSelection=s.meta.get(l)||l.beforeTransactionSelection)}),{destroy:()=>{i.destroy()}}}});function ij(n){return!!n.getMeta(Ge)}function sj(n,e){const t=Ge.getState(n);return li(t.doc,t.type,e,t.binding.mapping)||0}function pS(n,e){const t=Ge.getState(n);return ea(e,t.type,t.binding.mapping)}var Cc=class hS extends xm{constructor(e,t){super(e),this.yRelativePosition=t}static fromJSON(e){return new hS(e.position,e.yRelativePosition)}toJSON(){return{position:this.position,yRelativePosition:this.yRelativePosition}}};function lj(n,e){const t=pS(e,n);return new Cc(n,t)}function aj(n,e,t){const o=n instanceof Cc?n.yRelativePosition:null;if(ij(e)&&o){const s=sj(t,o);return{position:new Cc(s,o),mapResult:null}}const r=nx(n,e),i=r.position.position;return{position:new Cc(i,o??pS(t,i)),mapResult:r.mapResult}}var cj=ve.create({name:"collaboration",priority:1e3,addOptions(){return{document:null,field:"default",fragment:null,provider:null}},addStorage(){return{isDisabled:!1}},onCreate(){this.editor.extensionManager.extensions.find(n=>n.name==="undoRedo")&&console.warn('[tiptap warn]: "@tiptap/extension-collaboration" comes with its own history support and is not compatible with "@tiptap/extension-undo-redo".')},onBeforeCreate(){this.editor.utils.getUpdatedPosition=(n,e)=>aj(n,e,this.editor.state),this.editor.utils.createMappablePosition=n=>lj(n,this.editor.state)},addCommands(){return{undo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),Xo.getState(e).undoManager.undoStack.length===0?!1:t?ej(e):!0),redo:()=>({tr:n,state:e,dispatch:t})=>(n.setMeta("preventDispatch",!0),Xo.getState(e).undoManager.redoStack.length===0?!1:t?tj(e):!0)}},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Mod-y":()=>this.editor.commands.redo(),"Shift-Mod-z":()=>this.editor.commands.redo()}},addProseMirrorPlugins(){var n;const e=this.options.fragment?this.options.fragment:this.options.document.getXmlFragment(this.options.field),t=rj(this.options.yUndoOptions),o=t.spec.view;t.spec.view=s=>{const{undoManager:l}=Xo.getState(s.state);l.restore&&(l.restore(),l.restore=()=>{});const a=o?o(s):void 0;return{destroy:()=>{const u=l.trackedOrigins.has(l),d=l._observers;l.restore=()=>{u&&l.trackedOrigins.add(l),l.doc.on("afterTransaction",l.afterTransactionHandler),l._observers=d},a!=null&&a.destroy&&a.destroy()}}};const r={...this.options.ySyncOptions,onFirstRender:this.options.onFirstRender},i=DH(e,r);return this.editor.options.enableContentCheck&&((n=e.doc)==null||n.on("beforeTransaction",()=>{try{const s=GH(e);if(s.content.length===0)return;this.editor.schema.nodeFromJSON(s).check()}catch(s){return this.editor.emit("contentError",{error:s,editor:this.editor,disableCollaboration:()=>{var l;(l=e.doc)==null||l.destroy(),this.storage.isDisabled=!0}}),!1}})),[i,t,this.editor.options.enableContentCheck&&new ue({key:new ce("filterInvalidContent"),filterTransaction:()=>{var s;return this.storage.isDisabled!==!1&&((s=e.doc)==null||s.destroy()),!0}})].filter(Boolean)}}),mS=cj,Fv=n=>Array.from(n.entries()).map(([e,t])=>({clientId:e,...t.user})),Hv=()=>null,uj=ve.create({name:"collaborationCaret",priority:999,addOptions(){return{provider:null,user:{name:null,color:null},render:n=>{const e=document.createElement("span");e.classList.add("collaboration-carets__caret"),e.setAttribute("style",`border-color: ${n.color}`);const t=document.createElement("div");return t.classList.add("collaboration-carets__label"),t.setAttribute("style",`background-color: ${n.color}`),t.insertBefore(document.createTextNode(n.name),null),e.insertBefore(t,null),e},selectionRender:fS,onUpdate:Hv}},onCreate(){if(this.options.onUpdate!==Hv&&console.warn('[tiptap warn]: DEPRECATED: The "onUpdate" option is deprecated. Please use `editor.storage.collaborationCaret.users` instead. Read more: https://tiptap.dev/api/extensions/collaboration-caret'),!this.options.provider)throw new Error('The "provider" option is required for the CollaborationCaret extension')},addStorage(){return{users:[]}},addCommands(){return{updateUser:n=>()=>(this.options.provider.awareness.setLocalStateField("user",n),!0),user:n=>({editor:e})=>(console.warn('[tiptap warn]: DEPRECATED: The "user" command is deprecated. Please use "updateUser" instead. Read more: https://tiptap.dev/api/extensions/collaboration-caret'),e.commands.updateUser(n))}},addProseMirrorPlugins(){return[ZH((this.options.provider.awareness.setLocalStateField("user",this.options.user),this.storage.users=Fv(this.options.provider.awareness.states),this.options.provider.awareness.on("update",()=>{this.storage.users=Fv(this.options.provider.awareness.states)}),this.options.provider.awareness),{cursorBuilder:this.options.render,selectionBuilder:this.options.selectionRender})]}}),gS=uj,dj=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,fj=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,pj=eo.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:n=>n.getAttribute("data-color")||n.style.backgroundColor,renderHTML:n=>n.color?{"data-color":n.color,style:`background-color: ${n.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:n}){return["mark",he(this.options.HTMLAttributes,n),0]},renderMarkdown:(n,e)=>`==${e.renderChildren(n)}==`,parseMarkdown:(n,e)=>e.applyMark("highlight",e.parseInline(n.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:n=>n.indexOf("=="),tokenize(n,e,t){const r=/^(==)([^=]+)(==)/.exec(n);if(r){const i=r[2].trim(),s=t.inlineTokens(i);return{type:"highlight",raw:r[0],text:i,tokens:s}}}},addCommands(){return{setHighlight:n=>({commands:e})=>e.setMark(this.name,n),toggleHighlight:n=>({commands:e})=>e.toggleMark(this.name,n),unsetHighlight:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[bi({find:dj,type:this.type})]},addPasteRules(){return[_r({find:fj,type:this.type})]}}),yS=pj,hj=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,mj=Ie.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",he(this.options.HTMLAttributes,n)]},parseMarkdown:(n,e)=>e.createNode("image",{src:n.href,title:n.title,alt:n.text}),renderMarkdown:n=>{var e,t,o,r,i,s;const l=(t=(e=n.attrs)==null?void 0:e.src)!=null?t:"",a=(r=(o=n.attrs)==null?void 0:o.alt)!=null?r:"",u=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"";return u?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:n,minWidth:e,minHeight:t,alwaysPreserveAspectRatio:o}=this.options.resize;return({node:r,getPos:i,HTMLAttributes:s,editor:l})=>{const a=document.createElement("img");Object.entries(s).forEach(([f,p])=>{if(p!=null)switch(f){case"width":case"height":break;default:a.setAttribute(f,p);break}}),a.src=s.src;const u=new bx({element:a,editor:l,node:r,getPos:i,onResize:(f,p)=>{a.style.width=`${f}px`,a.style.height=`${p}px`},onCommit:(f,p)=>{const h=i();h!==void 0&&this.editor.chain().setNodeSelection(h).updateAttributes(this.name,{width:f,height:p}).run()},onUpdate:(f,p,h)=>f.type===r.type,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:o===!0}}),d=u.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",a.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},u}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[md({find:hj,type:this.type,getAttributes:n=>{const[,,e,t,o]=n;return{src:t,alt:e,title:o}}})]}}),bS=mj;function gj(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=n,a=o&&!r,u=vx(t),d=new RegExp(`\\s${u}$`),f=s?"^":"",p=r?"":u,h=a?new RegExp(`${f}${u}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${f}(?:^)?${u}[^\\s${p}]*`,"gm"),m=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!m)return null;const g=l.pos-m.length,y=Array.from(m.matchAll(h)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const b=y.input.slice(Math.max(0,y.index-1),y.index),v=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(b);if(i!==null&&!v)return null;const w=g+y.index;let k=w+y[0].length;return a&&d.test(m.slice(k-1,k+1))&&(y[0]+=" ",k+=1),w<l.pos&&k>=l.pos?{range:{from:w,to:k},query:y[0].slice(t.length),text:y[0]}:null}var yj=new ce("suggestion");function bj({pluginKey:n=yj,editor:e,char:t="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:u="",decorationEmptyClass:d="is-empty",command:f=()=>null,items:p=()=>[],render:h=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=gj,shouldShow:y}){let b;const v=h==null?void 0:h(),w=()=>{const S=e.state.selection.$anchor.pos,M=e.view.coordsAtPos(S),{top:N,right:A,bottom:$,left:O}=M;try{return new DOMRect(O,N,A-O,$-N)}catch{return null}},k=(S,M)=>M?()=>{const N=n.getState(e.state),A=N==null?void 0:N.decorationId,$=S.dom.querySelector(`[data-decoration-id="${A}"]`);return($==null?void 0:$.getBoundingClientRect())||null}:w;function x(S,M){var N;try{const $=n.getState(S.state),O=$!=null&&$.decorationId?S.dom.querySelector(`[data-decoration-id="${$.decorationId}"]`):null,R={editor:e,range:($==null?void 0:$.range)||{from:0,to:0},query:($==null?void 0:$.query)||null,text:($==null?void 0:$.text)||null,items:[],command:I=>f({editor:e,range:($==null?void 0:$.range)||{from:0,to:0},props:I}),decorationNode:O,clientRect:k(S,O)};(N=v==null?void 0:v.onExit)==null||N.call(v,R)}catch{}const A=S.state.tr.setMeta(M,{exit:!0});S.dispatch(A)}const C=new ue({key:n,view(){return{update:async(S,M)=>{var N,A,$,O,R,I,L;const B=(N=this.key)==null?void 0:N.getState(M),W=(A=this.key)==null?void 0:A.getState(S.state),z=B.active&&W.active&&B.range.from!==W.range.from,U=!B.active&&W.active,me=B.active&&!W.active,Ee=!U&&!me&&B.query!==W.query,Re=U||z&&Ee,Ue=Ee||z,Fe=me||z&&Ee;if(!Re&&!Ue&&!Fe)return;const Te=Fe&&!Re?B:W,te=S.dom.querySelector(`[data-decoration-id="${Te.decorationId}"]`);b={editor:e,range:Te.range,query:Te.query,text:Te.text,items:[],command:we=>f({editor:e,range:Te.range,props:we}),decorationNode:te,clientRect:k(S,te)},Re&&(($=v==null?void 0:v.onBeforeStart)==null||$.call(v,b)),Ue&&((O=v==null?void 0:v.onBeforeUpdate)==null||O.call(v,b)),(Ue||Re)&&(b.items=await p({editor:e,query:Te.query})),Fe&&((R=v==null?void 0:v.onExit)==null||R.call(v,b)),Ue&&((I=v==null?void 0:v.onUpdate)==null||I.call(v,b)),Re&&((L=v==null?void 0:v.onStart)==null||L.call(v,b))},destroy:()=>{var S;b&&((S=v==null?void 0:v.onExit)==null||S.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,M,N,A){const{isEditable:$}=e,{composing:O}=e.view,{selection:R}=S,{empty:I,from:L}=R,B={...M},W=S.getMeta(n);if(W&&W.exit)return B.active=!1,B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null,B;if(B.composing=O,$&&(I||e.view.composing)){(L<M.range.from||L>M.range.to)&&!O&&!M.composing&&(B.active=!1);const z=g({char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:R.$from}),U=`id_${Math.floor(Math.random()*4294967295)}`;z&&m({editor:e,state:A,range:z.range,isActive:M.active})&&(!y||y({editor:e,range:z.range,query:z.query,text:z.text,transaction:S}))?(B.active=!0,B.decorationId=M.decorationId?M.decorationId:U,B.range=z.range,B.query=z.query,B.text=z.text):B.active=!1}else B.active=!1;return B.active||(B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null),B}},props:{handleKeyDown(S,M){var N,A,$,O;const{active:R,range:I}=C.getState(S.state);if(!R)return!1;if(M.key==="Escape"||M.key==="Esc"){const B=C.getState(S.state),W=(N=b==null?void 0:b.decorationNode)!=null?N:null,z=W??(B!=null&&B.decorationId?S.dom.querySelector(`[data-decoration-id="${B.decorationId}"]`):null);if(((A=v==null?void 0:v.onKeyDown)==null?void 0:A.call(v,{view:S,event:M,range:B.range}))||!1)return!0;const me={editor:e,range:B.range,query:B.query,text:B.text,items:[],command:Ee=>f({editor:e,range:B.range,props:Ee}),decorationNode:z,clientRect:z?()=>z.getBoundingClientRect()||null:null};return($=v==null?void 0:v.onExit)==null||$.call(v,me),x(S,n),!0}return((O=v==null?void 0:v.onKeyDown)==null?void 0:O.call(v,{view:S,event:M,range:I}))||!1},decorations(S){const{active:M,range:N,decorationId:A,query:$}=C.getState(S);if(!M)return null;const O=!($!=null&&$.length),R=[a];return O&&R.push(d),Se.create(S.doc,[Ve.inline(N.from,N.to,{nodeName:l,class:R.join(" "),"data-decoration-id":A,"data-decoration-content":u})])}}});return C}function vj({editor:n,overrideSuggestionOptions:e,extensionName:t,char:o="@"}){const r=new ce;return{editor:n,char:o,pluginKey:r,command:({editor:i,range:s,props:l})=>{var a,u,d;const f=i.view.state.selection.$to.nodeAfter;((a=f==null?void 0:f.text)==null?void 0:a.startsWith(" "))&&(s.to+=1),i.chain().focus().insertContentAt(s,[{type:t,attrs:{...l,mentionSuggestionChar:o}},{type:"text",text:" "}]).run(),(d=(u=i.view.dom.ownerDocument.defaultView)==null?void 0:u.getSelection())==null||d.collapseToEnd()},allow:({state:i,range:s})=>{const l=i.doc.resolve(s.from),a=i.schema.nodes[t];return!!l.parent.type.contentMatch.matchType(a)},...e}}function vS(n){return(n.options.suggestions.length?n.options.suggestions:[n.options.suggestion]).map(e=>vj({editor:n.editor,overrideSuggestionOptions:e,extensionName:n.name,char:e.char}))}function jv(n,e){const t=vS(n),o=t.find(r=>r.char===e);return o||(t.length?t[0]:null)}var kj=Ie.create({name:"mention",priority:101,addOptions(){return{HTMLAttributes:{},renderText({node:n,suggestion:e}){var t,o;return`${(t=e==null?void 0:e.char)!=null?t:"@"}${(o=n.attrs.label)!=null?o:n.attrs.id}`},deleteTriggerWithBackspace:!1,renderHTML({options:n,node:e,suggestion:t}){var o,r;return["span",he(this.HTMLAttributes,n.HTMLAttributes),`${(o=t==null?void 0:t.char)!=null?o:"@"}${(r=e.attrs.label)!=null?r:e.attrs.id}`]},suggestions:[],suggestion:{}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}},mentionSuggestionChar:{default:"@",parseHTML:n=>n.getAttribute("data-mention-suggestion-char"),renderHTML:n=>({"data-mention-suggestion-char":n.mentionSuggestionChar})}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){const t=jv(this,n.attrs.mentionSuggestionChar);if(this.options.renderLabel!==void 0)return console.warn("renderLabel is deprecated use renderText and renderHTML instead"),["span",he({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n,suggestion:t})];const o={...this.options};o.HTMLAttributes=he({"data-type":this.name},this.options.HTMLAttributes,e);const r=this.options.renderHTML({options:o,node:n,suggestion:t});return typeof r=="string"?["span",he({"data-type":this.name},this.options.HTMLAttributes,e),r]:r},...kx({nodeName:"mention",name:"@",selfClosing:!0,allowedAttributes:["id","label",{name:"mentionSuggestionChar",skipIfDefault:"@"}],parseAttributes:n=>{const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,s]=o,l=i??s;e[r==="char"?"mentionSuggestionChar":r]=l,o=t.exec(n)}return e},serializeAttributes:n=>Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e==="mentionSuggestionChar"?"char":e}="${t}"`).join(" ")}),renderText({node:n}){const e={options:this.options,node:n,suggestion:jv(this,n.attrs.mentionSuggestionChar)};return this.options.renderLabel!==void 0?(console.warn("renderLabel is deprecated use renderText and renderHTML instead"),this.options.renderLabel(e)):this.options.renderText(e)},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:o}=e,{empty:r,anchor:i}=o;if(!r)return!1;let s=new _n,l=0;return e.doc.nodesBetween(i-1,i,(a,u)=>{if(a.type.name===this.name)return t=!0,s=a,l=u,!1}),t&&n.insertText(this.options.deleteTriggerWithBackspace?"":s.attrs.mentionSuggestionChar,l,l+s.nodeSize),t})}},addProseMirrorPlugins(){return vS(this).map(bj)}}),wj=kj,xj=eo.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(n){return n!=="sub"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sub",he(this.options.HTMLAttributes,n),0]},addCommands(){return{setSubscript:()=>({commands:n})=>n.setMark(this.name),toggleSubscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSubscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),kS=xj,Cj=eo.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(n){return n!=="super"?!1:null}}]},renderHTML({HTMLAttributes:n}){return["sup",he(this.options.HTMLAttributes,n),0]},addCommands(){return{setSuperscript:()=>({commands:n})=>n.setMark(this.name),toggleSuperscript:()=>({commands:n})=>n.toggleMark(this.name),unsetSuperscript:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),wS=Cj,Sj=ve.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>{const e=n.style.textAlign;return this.options.alignments.includes(e)?e:this.options.defaultAlignment},renderHTML:n=>n.textAlign?{style:`text-align: ${n.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.map(t=>e.updateAttributes(t,{textAlign:n})).some(t=>t):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.map(e=>n.resetAttributes(e,"textAlign")).some(e=>e),toggleTextAlign:n=>({editor:e,commands:t})=>this.options.alignments.includes(n)?e.isActive({textAlign:n})?t.unsetTextAlign():t.setTextAlign(n):!1}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),xS=Sj,Ej=n=>at({find:/--$/,replace:n??"—"}),Mj=n=>at({find:/\.\.\.$/,replace:n??"…"}),Tj=n=>at({find:/(?:^|[\s{[(<'"\u2018\u201C])(")$/,replace:n??"“"}),Nj=n=>at({find:/"$/,replace:n??"”"}),Aj=n=>at({find:/(?:^|[\s{[(<'"\u2018\u201C])(')$/,replace:n??"‘"}),Oj=n=>at({find:/'$/,replace:n??"’"}),$j=n=>at({find:/<-$/,replace:n??"←"}),Bj=n=>at({find:/->$/,replace:n??"→"}),Rj=n=>at({find:/\(c\)$/,replace:n??"©"}),_j=n=>at({find:/\(tm\)$/,replace:n??"™"}),Dj=n=>at({find:/\(sm\)$/,replace:n??"℠"}),Ij=n=>at({find:/\(r\)$/,replace:n??"®"}),Lj=n=>at({find:/(?:^|\s)(1\/2)\s$/,replace:n??"½"}),Pj=n=>at({find:/\+\/-$/,replace:n??"±"}),Vj=n=>at({find:/!=$/,replace:n??"≠"}),zj=n=>at({find:/<<$/,replace:n??"«"}),Fj=n=>at({find:/>>$/,replace:n??"»"}),Hj=n=>at({find:/\d+\s?([*x])\s?\d+$/,replace:n??"×"}),jj=n=>at({find:/\^2$/,replace:n??"²"}),Uj=n=>at({find:/\^3$/,replace:n??"³"}),Wj=n=>at({find:/(?:^|\s)(1\/4)\s$/,replace:n??"¼"}),qj=n=>at({find:/(?:^|\s)(3\/4)\s$/,replace:n??"¾"}),Kj=ve.create({name:"typography",addOptions(){return{closeDoubleQuote:"”",closeSingleQuote:"’",copyright:"©",ellipsis:"…",emDash:"—",laquo:"«",leftArrow:"←",multiplication:"×",notEqual:"≠",oneHalf:"½",oneQuarter:"¼",openDoubleQuote:"“",openSingleQuote:"‘",plusMinus:"±",raquo:"»",registeredTrademark:"®",rightArrow:"→",servicemark:"℠",superscriptThree:"³",superscriptTwo:"²",threeQuarters:"¾",trademark:"™"}},addInputRules(){const n=[];return this.options.emDash!==!1&&n.push(Ej(this.options.emDash)),this.options.ellipsis!==!1&&n.push(Mj(this.options.ellipsis)),this.options.openDoubleQuote!==!1&&n.push(Tj(this.options.openDoubleQuote)),this.options.closeDoubleQuote!==!1&&n.push(Nj(this.options.closeDoubleQuote)),this.options.openSingleQuote!==!1&&n.push(Aj(this.options.openSingleQuote)),this.options.closeSingleQuote!==!1&&n.push(Oj(this.options.closeSingleQuote)),this.options.leftArrow!==!1&&n.push($j(this.options.leftArrow)),this.options.rightArrow!==!1&&n.push(Bj(this.options.rightArrow)),this.options.copyright!==!1&&n.push(Rj(this.options.copyright)),this.options.trademark!==!1&&n.push(_j(this.options.trademark)),this.options.servicemark!==!1&&n.push(Dj(this.options.servicemark)),this.options.registeredTrademark!==!1&&n.push(Ij(this.options.registeredTrademark)),this.options.oneHalf!==!1&&n.push(Lj(this.options.oneHalf)),this.options.plusMinus!==!1&&n.push(Pj(this.options.plusMinus)),this.options.notEqual!==!1&&n.push(Vj(this.options.notEqual)),this.options.laquo!==!1&&n.push(zj(this.options.laquo)),this.options.raquo!==!1&&n.push(Fj(this.options.raquo)),this.options.multiplication!==!1&&n.push(Hj(this.options.multiplication)),this.options.superscriptTwo!==!1&&n.push(jj(this.options.superscriptTwo)),this.options.superscriptThree!==!1&&n.push(Uj(this.options.superscriptThree)),this.options.oneQuarter!==!1&&n.push(Wj(this.options.oneQuarter)),this.options.threeQuarters!==!1&&n.push(qj(this.options.threeQuarters)),n}}),CS=Kj,At=[];for(var Ff=0;Ff<256;++Ff)At.push((Ff+256).toString(16).slice(1));function Jj(n,e=0){return(At[n[e+0]]+At[n[e+1]]+At[n[e+2]]+At[n[e+3]]+"-"+At[n[e+4]]+At[n[e+5]]+"-"+At[n[e+6]]+At[n[e+7]]+"-"+At[n[e+8]]+At[n[e+9]]+"-"+At[n[e+10]]+At[n[e+11]]+At[n[e+12]]+At[n[e+13]]+At[n[e+14]]+At[n[e+15]]).toLowerCase()}var Xa,Gj=new Uint8Array(16);function Xj(){if(!Xa&&(Xa=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Xa))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Xa(Gj)}var Yj=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Uv={randomUUID:Yj};function SS(n,e,t){if(Uv.randomUUID&&!n)return Uv.randomUUID();n=n||{};var o=n.random||(n.rng||Xj)();return o[6]=o[6]&15|64,o[8]=o[8]&63|128,Jj(o)}function Qj(n){const e=new Set,t=new Set;return n.forEach(o=>{e.has(o)?t.add(o):e.add(o)}),Array.from(t)}var Zj=ve.create({name:"uniqueID",priority:1e4,addOptions(){return{attributeName:"id",types:[],generateID:()=>SS(),filterTransaction:null,updateDocument:!0}},addGlobalAttributes(){return[{types:this.options.types,attributes:{[this.options.attributeName]:{default:null,parseHTML:n=>n.getAttribute(`data-${this.options.attributeName}`),renderHTML:n=>n[this.options.attributeName]?{[`data-${this.options.attributeName}`]:n[this.options.attributeName]}:{}}}}]},onCreate(){var n;if(!this.options.updateDocument)return;const e=this.editor.extensionManager.extensions.find(l=>l.name==="collaboration"),t=this.editor.extensionManager.extensions.find(l=>l.name==="collaborationCaret"),r=[e,t].filter(Boolean).find(l=>{var a;return(a=l==null?void 0:l.options)==null?void 0:a.provider}),i=(n=r==null?void 0:r.options)==null?void 0:n.provider,s=()=>{const{view:l,state:a}=this.editor,{tr:u,doc:d}=a,{types:f,attributeName:p,generateID:h}=this.options;Ar(d,g=>f.includes(g.type.name)&&g.attrs[p]===null).forEach(({node:g,pos:y})=>{u.setNodeMarkup(y,void 0,{...g.attrs,[p]:h({node:g,pos:y})})}),u.setMeta("addToHistory",!1),l.dispatch(u),i&&i.off("synced",s)};if(r){if(!i)return s();i.on("synced",s)}else return s()},addProseMirrorPlugins(){if(!this.options.updateDocument)return[];let n=null,e=!1;return[new ue({key:new ce("uniqueID"),appendTransaction:(t,o,r)=>{const i=t.some(g=>g.docChanged)&&!o.doc.eq(r.doc),s=this.options.filterTransaction&&t.some(g=>{var y,b;return!((b=(y=this.options).filterTransaction)!=null&&b.call(y,g))});if(t.find(g=>g.getMeta("y-sync$"))||!i||s)return;const{tr:a}=r,{types:u,attributeName:d,generateID:f}=this.options,p=hm(o.doc,t),{mapping:h}=p;if(km(p).forEach(({newRange:g})=>{const y=U0(r.doc,g,v=>u.includes(v.type.name)),b=y.map(({node:v})=>v.attrs[d]).filter(v=>v!==null);y.forEach(({node:v,pos:w},k)=>{var x;const C=(x=a.doc.nodeAt(w))==null?void 0:x.attrs[d];if(C===null){a.setNodeMarkup(w,void 0,{...v.attrs,[d]:f({node:v,pos:w})});return}const S=y[k+1];if(S&&v.content.size===0){const $=a.doc.nodeAt(S.pos);if($!=null&&$.attrs[d]&&$.attrs[d]!==C)return;a.setNodeMarkup(S.pos,void 0,{...S.node.attrs,[d]:C}),b[k+1]=C;const O=f({node:v,pos:w});return a.setNodeMarkup(w,void 0,{...v.attrs,[d]:O}),b[k]=O,a}const M=Qj(b),{deleted:N}=h.invert().mapResult(w);N&&M.includes(C)&&a.setNodeMarkup(w,void 0,{...v.attrs,[d]:f({node:v,pos:w})})})}),!!a.steps.length)return a.setStoredMarks(r.tr.storedMarks),a.setMeta("__uniqueIDTransaction",!0),a},view(t){const o=r=>{var i;n=(i=t.dom.parentElement)!=null&&i.contains(r.target)?t.dom.parentElement:null};return window.addEventListener("dragstart",o),{destroy(){window.removeEventListener("dragstart",o)}}},props:{handleDOMEvents:{drop:(t,o)=>{var r,i;return(n!==t.dom.parentElement||((r=o.dataTransfer)==null?void 0:r.effectAllowed)==="copyMove"||((i=o.dataTransfer)==null?void 0:i.effectAllowed)==="copy")&&(n=null,e=!0),!1},paste:()=>(e=!0,!1)},transformPasted:t=>{if(!e)return t;const{types:o,attributeName:r}=this.options,i=s=>{const l=[];return s.forEach(a=>{if(a.isText){l.push(a);return}if(!o.includes(a.type.name)){l.push(a.copy(i(a.content)));return}const u=a.type.create({...a.attrs,[r]:null},i(a.content),a.marks);l.push(u)}),D.from(l)};return e=!1,new H(i(t.content),t.openStart,t.openEnd)}}})]}}),ES=Zj;/**
|
|
208
|
+
* Copyright 2026 Yiitap
|
|
209
|
+
* @license MIT
|
|
210
|
+
**/const Wv=n=>{const e=/(#[0-9a-f]{3,6})\b/gi,t=[];return n.descendants((o,r)=>{o.text&&Array.from(o.text.matchAll(e)).forEach(i=>{const s=i[0],l=i.index||0,a=r+l,u=a+s.length,d=Ve.inline(a,u,{class:"color",style:`--color: ${s}`});t.push(d)})}),Se.create(n,t)},MS=ve.create({name:"colorHighlighter",addProseMirrorPlugins(){return[new ue({key:new ce("colorHighlighter"),state:{init(n,{doc:e}){return Wv(e)},apply(n,e){return n.docChanged?Wv(n.doc):e}},props:{decorations(n){return this.getState(n)}}})]}});/**
|
|
211
|
+
* Copyright 2026 Yiitap
|
|
212
|
+
* @license MIT
|
|
213
|
+
**/const e3=ve.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new ue({key:new ce("focus"),props:{decorations:({doc:n,selection:e})=>{const{isEditable:t,isFocused:o}=this.editor,{anchor:r}=e,i=[];if(!t||!o)return Se.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((a,u)=>{if(!a.isText){if(!(r>=u&&r<=u+a.nodeSize-1))return!1;s+=1}});let l=0;return n.descendants((a,u)=>{if(a.isText||!(r>=u&&r<=u+a.nodeSize-1))return!1;if(l+=1,this.options.mode==="deepest"&&s-l>0||this.options.mode==="shallowest"&&l>1)return this.options.mode==="deepest";i.push(Ve.node(u,u+a.nodeSize,{class:this.options.className}))}),Se.create(n,i)}}})]}});/**
|
|
214
|
+
* Copyright 2026 Yiitap
|
|
215
|
+
* @license MIT
|
|
216
|
+
**/const Hf=new ce("inlinePlaceholderPlugin"),TS=ve.create({name:"inlinePlaceholder",addOptions(){return{onShow:n=>{},onHide:()=>{}}},addProseMirrorPlugins(){return[new ue({key:Hf,state:{init:()=>({active:null}),apply:(n,e)=>{const t=n.getMeta(Hf);return t&&console.log("apply",t),(t==null?void 0:t.type)==="show"?{active:t.payload}:(t==null?void 0:t.type)==="hide"?{active:null}:e}},props:{decorations:n=>{var o;const e=(o=Hf.getState(n))==null?void 0:o.active;if(!e)return null;const t=Ve.widget(e.pos,()=>{const r=document.createElement("span");return r.className="inline-placeholder bg-gray-100 border border-gray-300 text-gray-500 px-1 rounded cursor-text",r.textContent=e.label||"Type...",r.addEventListener("click",()=>{this.options.onShow(e)}),r});return Se.create(n.doc,[t])}},view:()=>({destroy:this.options.onHide})})]}});/**
|
|
217
|
+
* Copyright 2026 Yiitap
|
|
218
|
+
* @license MIT
|
|
219
|
+
**/const qs="selection-decoration",Ya={BLUR:"blur",FOCUS:"focus"},NS=ve.create({name:qs,addProseMirrorPlugins(){return[new ue({key:new ce(qs),state:{init(n){return Se.empty},apply:(n,e)=>{const{selection:t,doc:o}=n,r=n.getMeta(qs),i=t&&t.from!==t.to;if(!i||(r==null?void 0:r.action)===Ya.FOCUS)return Se.empty;if(i&&(r==null?void 0:r.action)===Ya.BLUR){const s=Ve.inline(t.from,t.to,{class:"selection-decoration-blur"});return Se.create(o,[s])}return e}},props:{decorations(n){return this.getState(n)},handleDOMEvents:{blur:n=>{const{tr:e}=n.state,t=e.setMeta(qs,{from:e.selection.from,to:e.selection.to,action:Ya.BLUR});n.dispatch(t)},focus:n=>{const{tr:e}=n.state,t=e.setMeta(qs,{from:e.selection.from,to:e.selection.to,action:Ya.FOCUS});n.dispatch(t)}}}})]}});/**
|
|
220
|
+
* Copyright 2026 Yiitap
|
|
221
|
+
* @license MIT
|
|
222
|
+
**/const t3=n=>n?n.split(/\r?\n/).filter(e=>e.trim().length>0).length>1:!1,n3=(n,e=.2)=>{if(!n||n.trim().length<2)return!1;const t=n.split(/\r?\n/).filter(a=>a.trim().length>0);if(t.length===0)return!1;if(/```[\s\S]*?```/.test(n)||/\$\$[\s\S]+?\$\$/.test(n))return console.log("Markdown: With code or math block"),!0;const o=[/^#{1,6}\s/,/^[-*+]\s+/,/^\d+\.\s+/,/^>\s+/,/^```/,/`[^`]+`/,/\*\*[^*]+\*\*/,/_[^_]+_/,/\[([^\]]+)\]\([^)]+\)/,/!\[([^\]]*)\]\([^)]+\)/,/^(\|?[\s-:|]+\|[\s-:|]+)$/,/\$\$[\s\S]+?\$\$/,/\$[^$]+\$/,/\\\([^)]+\\\)/,/\\\[[\s\S]+?\\\]/,/^\|.*?\|.*?\|/,/^:::\s*\w+/,/<[a-z][\s\S]*?>/i,/^[ \t]*[-*_]{3,}[ \t]*$/];let r=0,i=!1;for(const a of t){const u=a.trim();if(u.startsWith("```")){i=!i,r++;continue}if(i){r++;continue}o.some(d=>d.test(u))&&r++}const s=r/t.length,l=(n.match(/[*_`#>[\]]/g)||[]).length/n.length;return console.log("isMarkdown: ",s,l),s>=e||l>.05},qv=(n,e)=>{var r;const t=[],o=Array.isArray(n)?n:[n];for(const i of o)try{const s=(r=e.markdown)==null?void 0:r.serialize(i);s?t.push(s.trim()):console.warn("Failed to serialize: ",i)}catch(s){console.error("Failed to serialize.",s)}return t.join(`
|
|
223
|
+
|
|
224
|
+
`)},AS=["Mathematics","starterKit"],Kv=(n,e)=>{const t=Array.isArray(n)?{type:"doc",content:n}:n,o=e.extensionManager.extensions.filter(r=>!AS.includes(r.name));return K$(t,o)},o3=(n,e)=>{const t=e.extensionManager.extensions,o=[...AS,"doc"],r=t.filter(i=>!o.includes(i.name));return r.push(Bp),G0(n,r)},OS=ve.create({name:"shortcut",addOptions(){return{copy:{enabled:!0,keys:["Mod-c"]},duplicate:{enabled:!0,keys:["Mod-d"]},delete:{enabled:!0,keys:["Mod-x"]},markdown:{enabled:!0},selectableNodes:["aiBlock","blockquote","callout","codeBlock","heading","listItem","paragraph","tableCell","tableHeader","taskItem"]}},addCommands(){return{copySelected:()=>({tr:n,state:e,dispatch:t})=>this.editor.commands.deleteSelected({delete:!1}),duplicateSelected:()=>({tr:n,state:e,dispatch:t})=>{const{selection:o}=e,{$from:r,$to:i}=o;if(o instanceof Q){const d=o.node,f=o.to,p=d.type.create(d.attrs,d.content,d.marks);if(t){const h=e.tr.insert(f,p);t(h.scrollIntoView()),setTimeout(()=>{this.editor.commands.setNodeSelection(f)},100)}return!0}if(!o.empty){const{from:d,to:f}=o,p=e.doc.slice(d,f),h=f;if(t){let m=e.tr.insert(h,p.content);const g=p.content.size;m=m.setSelection(q.create(m.doc,h,h+g)),t(m.scrollIntoView())}return!0}const s=r.depth,l=r.before(s),a=r.node(s);if(!a)return!1;const u=a.type.create(a.attrs,a.content,a.marks);if(t){const d=l+a.nodeSize;let f=e.tr.insert(d,u);const p=d+a.nodeSize-1;f=f.setSelection(q.create(f.doc,p)),t(f.scrollIntoView())}return!0},deleteSelected:(n={delete:!0})=>({tr:e,state:t,dispatch:o})=>{var h,m;const{selection:r}=t,{$from:i,from:s,to:l}=r;if(s!==l){try{const g=t.doc.slice(s,l).content.toJSON(),y=Kv(g,this.editor),b={"text/html":new Blob([y],{type:"text/html"})};if((h=this.options.markdown)!=null&&h.enabled){const w=qv(g,this.editor)||"";b["text/plain"]=new Blob([w],{type:"text/plain"})}const v=new ClipboardItem(b);navigator.clipboard.write([v])}catch(g){console.error("Clipboard write failed.",g)}return n.delete&&o&&(e.deleteRange(s,l),o(e.scrollIntoView())),!0}let a=i.depth,u=a;for(;a>0;a--)if(i.node(a).isBlock){u=a;break}const d=i.node(u);if(!d)return!1;const f=i.before(u),p=f+d.nodeSize;try{const g=d.toJSON(),y=Kv(g,this.editor),b={"text/html":new Blob([y],{type:"text/html"})};if((m=this.options.markdown)!=null&&m.enabled){const w=qv(g,this.editor)||"";b["text/plain"]=new Blob([w],{type:"text/plain"})}const v=new ClipboardItem(b);navigator.clipboard.write([v])}catch(g){console.error("Clipboard write failed.",g)}return n.delete&&o&&(e.delete(f,p),o(e.scrollIntoView())),!0}}},addKeyboardShortcuts(){var e,t,o;const n={};if((e=this.options.copy)!=null&&e.enabled){const r=this.options.copy.keys??["Mod-c"];for(const i of r)n[i]=({editor:s})=>s.commands.copySelected()}if((t=this.options.duplicate)!=null&&t.enabled){const r=this.options.duplicate.keys??["Mod-d"];for(const i of r)n[i]=({editor:s})=>s.commands.duplicateSelected()}if((o=this.options.delete)!=null&&o.enabled){const r=this.options.delete.keys??["Mod-x"];for(const i of r)n[i]=({editor:s})=>s.commands.deleteSelected()}return n["Mod-a"]=({editor:r})=>{const{state:i,view:s}=r,{selection:l,tr:a}=i,{$from:u}=l,d=u.node(-1);let f=-1,p=-1;if(this.options.selectableNodes.includes(d==null?void 0:d.type.name))f=u.start(-1)+1,p=u.end(-1)-1;else if((d==null?void 0:d.type.name)==="doc"){let h=u.depth,m=null,g=0;for(;h>0;){const y=u.node(h);if(y.isBlock){m=y,g=u.before(h);break}h--}this.options.selectableNodes.includes(m==null?void 0:m.type.name)&&(f=g+1,p=g+(m==null?void 0:m.nodeSize)-1)}if(f>-1&&p>-1){const{from:h,to:m}=l;if(h!==f||m!==p){const g=q.create(a.doc,f,p);return a.setSelection(g),s.dispatch(a),!0}}return!1},n},addProseMirrorPlugins(){return[new ue({props:{handlePaste:(n,e,t)=>{var u,d,f;const o=e.clipboardData;if(!o)return!1;const r=o.getData("text/html"),i=o.getData("text/plain");if(!r&&!i)return!1;const{state:s}=n,{selection:l}=s,{$from:a}=l;if(a.parent.type.name==="codeBlock"){console.log("Inside codeBlock",i);const p=s.tr.insertText(i,l.from,l.to);return n.dispatch(p.scrollIntoView()),!0}if(r)try{let p=!0;const h=/<html[\s\S]*>/i.test(r);let m;if(h){let y=o3(r,this.editor).content;y.length===1&&y[0].type==="paragraph"&&(p=!1,y=y[0].content),m=D.fromJSON(n.state.schema,y)}else{if(t3(i))return!1;{const y=s.tr.insertText(i,l.to);return n.dispatch(y.scrollIntoView()),!0}}const g=new H(m,0,0);if(p){const y=a.end(),b=n.state.tr.insert(y,m);n.dispatch(b.scrollIntoView())}else{const y=n.state.tr.replaceSelection(g);n.dispatch(y.scrollIntoView())}return!0}catch(p){console.error("Parse html failed.",p)}if((u=this.options.markdown)!=null&&u.enabled&&n3(i))try{const p=(f=((d=this.editor.markdown)==null?void 0:d.parse(i))||{})==null?void 0:f.content,h=D.fromJSON(n.state.schema,p),m=new H(h,0,0),g=n.state.tr.replaceSelection(m);return n.dispatch(g.scrollIntoView()),!0}catch(p){console.error("Parse Markdown failed.",p)}return!1}}})]}});/**
|
|
225
|
+
* Copyright 2026 Yiitap
|
|
226
|
+
* @license MIT
|
|
227
|
+
**/function Jv(n,e,t,o,r,i){let s=0,l=!0,a=e.firstChild;const u=n.firstChild;for(let d=0,f=0;d<u.childCount;d+=1){const{colspan:p,colwidth:h}=u.child(d).attrs;for(let m=0;m<p;m+=1,f+=1){const g=r===f?i:h&&h[m],y=g?`${g}px`:"";if(s+=g||o,g||(l=!1),a)a.style.width!==y&&(a.style.width=y),a=a.nextSibling;else{const b=document.createElement("col");b.className=`col-${f}`,e.appendChild(b).style.width=y}}}for(;a;){const d=a.nextSibling;a.parentNode.removeChild(a),a=d}l?(t.style.width=`${s}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${s}px`)}let r3=class{constructor(e,t,o){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Jv(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type!==this.node.type?!1:(this.node=e,Jv(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){return e.type==="attributes"&&(e.target===this.table||this.colgroup.contains(e.target))}};const $S=_d.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),HTMLAttributes:{},resizable:!0,handleWidth:5,cellMinWidth:25,View:r3,lastColumnResizable:!0,allowTableNodeSelection:!1}},addCommands(){var n;return{...(n=this.parent)==null?void 0:n.call(this),insertTable:e=>({editor:t,commands:o,tr:r,dispatch:i})=>{const{rows:s=3,cols:l=3,withHeaderRow:a=!0}=e||{},u=DC(t.schema,s,l,a);if(i){const d=r.selection.anchor+1;o.insertContent({type:"table-wrapper",content:[u.toJSON()]}),r.scrollIntoView().setSelection(q.near(r.doc.resolve(d)))}return!0},deleteTable:()=>({state:e,dispatch:t})=>{const o=e.selection.$anchor;for(let r=o.depth;r>0;r--)if(o.node(r).type.name==="table-wrapper")return t&&t(e.tr.delete(o.before(r),o.after(r)).scrollIntoView()),!0;return!1},selectRow:e=>({tr:t,dispatch:o})=>{if(o){const r=t.doc.resolve(e),i=ze.rowSelection(r);t.setSelection(i)}return!0},selectColumn:e=>({tr:t,dispatch:o})=>{if(o){const r=t.doc.resolve(e),i=ze.colSelection(r);t.setSelection(i)}return!0}}},parseMarkdown:(n,e)=>{const t=[];if(n.header){const r=[];n.header.forEach(i=>{r.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),t.push(e.createNode("tableRow",{},r))}n.rows&&n.rows.forEach(r=>{const i=[];r.forEach(s=>{i.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(s.tokens)}]))}),t.push(e.createNode("tableRow",{},i))});const o=e.createNode("table",void 0,t);return e.createNode("table-wrapper",void 0,[o])}});/**
|
|
228
|
+
* Copyright 2026 Yiitap
|
|
229
|
+
* @license MIT
|
|
230
|
+
**/function $t(n){this.content=n}$t.prototype={constructor:$t,find:function(n){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===n)return e;return-1},get:function(n){var e=this.find(n);return e==-1?void 0:this.content[e+1]},update:function(n,e,t){var o=t&&t!=n?this.remove(t):this,r=o.find(n),i=o.content.slice();return r==-1?i.push(t||n,e):(i[r+1]=e,t&&(i[r]=t)),new $t(i)},remove:function(n){var e=this.find(n);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new $t(t)},addToStart:function(n,e){return new $t([n,e].concat(this.remove(n).content))},addToEnd:function(n,e){var t=this.remove(n).content.slice();return t.push(n,e),new $t(t)},addBefore:function(n,e,t){var o=this.remove(e),r=o.content.slice(),i=o.find(n);return r.splice(i==-1?r.length:i,0,e,t),new $t(r)},forEach:function(n){for(var e=0;e<this.content.length;e+=2)n(this.content[e],this.content[e+1])},prepend:function(n){return n=$t.from(n),n.size?new $t(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=$t.from(n),n.size?new $t(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var e=this;n=$t.from(n);for(var t=0;t<n.content.length;t+=2)e=e.remove(n.content[t]);return e},toObject:function(){var n={};return this.forEach(function(e,t){n[e]=t}),n},get size(){return this.content.length>>1}};$t.from=function(n){if(n instanceof $t)return n;var e=[];if(n)for(var t in n)e.push(t,n[t]);return new $t(e)};function BS(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(o),i=e.child(o);if(r==i){t+=r.nodeSize;continue}if(!r.sameMarkup(i))return t;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)t++;return t}if(r.content.size||i.content.size){let s=BS(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function RS(n,e,t,o){for(let r=n.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:t,b:o};let s=n.child(--r),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,o-=a;continue}if(!s.sameMarkup(l))return{a:t,b:o};if(s.isText&&s.text!=l.text){let u=0,d=Math.min(s.text.length,l.text.length);for(;u<d&&s.text[s.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let u=RS(s.content,l.content,t-1,o-1);if(u)return u}t-=a,o-=a}}let J=class Zt{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,r=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],u=l+a.nodeSize;if(u>e&&o(a,r+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),o,r+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,r){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(o)&&(r[r.length-1]=t.withText(t.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new Zt(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),o.push(l),r+=l.nodeSize),s=a}return new Zt(o,r)}cutByIndex(e,t){return e==t?Zt.empty:e==0&&t==this.content.length?this:new Zt(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-o.nodeSize;return r[e]=t,new Zt(r,i)}addToStart(e){return new Zt([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new Zt(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,o=0;t<this.content.length;t++){let r=this.content[t];e(r,o,t),o+=r.nodeSize}}findDiffStart(e,t=0){return BS(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return RS(this,e,t,o)}findIndex(e){if(e==0)return Qa(0,e);if(e==this.size)return Qa(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,o=0;;t++){let r=this.child(t),i=o+r.nodeSize;if(i>=e)return i==e?Qa(t+1,i):Qa(t,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return Zt.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new Zt(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return Zt.empty;let t,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new Zt(t||e,o)}static from(e){if(!e)return Zt.empty;if(e instanceof Zt)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new Zt([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};J.empty=new J([],0);const jf={index:0,offset:0};function Qa(n,e){return jf.index=n,jf.offset=e,jf}function Lu(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let o=0;o<n.length;o++)if(!Lu(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!Lu(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}let tt=class ph{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),o=!0),t&&t.push(i)}}return t||(t=e.slice()),o||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Lu(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=o.create(t.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return ph.none;if(e instanceof ph)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}};tt.none=[];let Pu=class extends Error{},le=class Ji{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=DS(this.content,e+this.openStart,t);return o&&new Ji(o,this.openStart,this.openEnd)}removeBetween(e,t){return new Ji(_S(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Ji.empty;let o=t.openStart||0,r=t.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Ji(J.fromJSON(e,t.content),o,r)}static maxOpen(e,t=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new Ji(e,o,r)}};le.empty=new le(J.empty,0,0);function _S(n,e,t){let{index:o,offset:r}=n.findIndex(e),i=n.maybeChild(o),{index:s,offset:l}=n.findIndex(t);if(r==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(_S(i.content,e-r-1,t-r-1)))}function DS(n,e,t,o){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=DS(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function i3(n,e,t){if(t.openStart>n.depth)throw new Pu("Inserted content deeper than insertion position");if(n.depth-t.openStart!=e.depth-t.openEnd)throw new Pu("Inconsistent open depths");return IS(n,e,t,0)}function IS(n,e,t,o){let r=n.index(o),i=n.node(o);if(r==e.index(o)&&o<n.depth-t.openStart){let s=IS(n,e,t,o+1);return i.copy(i.content.replaceChild(r,s))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&n.depth==o&&e.depth==o){let s=n.parent,l=s.content;return ci(s,l.cut(0,n.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:s,end:l}=s3(t,n);return ci(i,PS(n,s,l,e,o))}else return ci(i,Vu(n,e,o))}function LS(n,e){if(!e.type.compatibleContent(n.type))throw new Pu("Cannot join "+e.type.name+" onto "+n.type.name)}function hh(n,e,t){let o=n.node(t);return LS(o,e.node(t)),o}function ai(n,e){let t=e.length-1;t>=0&&n.isText&&n.sameMarkup(e[t])?e[t]=n.withText(e[t].text+n.text):e.push(n)}function Cl(n,e,t,o){let r=(e||n).node(t),i=0,s=e?e.index(t):r.childCount;n&&(i=n.index(t),n.depth>t?i++:n.textOffset&&(ai(n.nodeAfter,o),i++));for(let l=i;l<s;l++)ai(r.child(l),o);e&&e.depth==t&&e.textOffset&&ai(e.nodeBefore,o)}function ci(n,e){return n.type.checkContent(e),n.copy(e)}function PS(n,e,t,o,r){let i=n.depth>r&&hh(n,e,r+1),s=o.depth>r&&hh(t,o,r+1),l=[];return Cl(null,n,r,l),i&&s&&e.index(r)==t.index(r)?(LS(i,s),ai(ci(i,PS(n,e,t,o,r+1)),l)):(i&&ai(ci(i,Vu(n,e,r+1)),l),Cl(e,t,r,l),s&&ai(ci(s,Vu(t,o,r+1)),l)),Cl(o,null,r,l),new J(l)}function Vu(n,e,t){let o=[];if(Cl(null,n,t,o),n.depth>t){let r=hh(n,e,t+1);ai(ci(r,Vu(n,e,t+1)),o)}return Cl(e,null,t,o),new J(o)}function s3(n,e){let t=e.depth-n.openStart,o=e.node(t).copy(n.content);for(let r=t-1;r>=0;r--)o=e.node(r).copy(J.from(o));return{start:o.resolveNoCache(n.openStart+t),end:o.resolveNoCache(o.content.size-n.openEnd-t)}}let Gv=class mh{constructor(e,t,o){this.pos=e,this.path=t,this.parentOffset=o,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let o=this.pos-this.path[this.path.length-1],r=e.child(t);return o?e.child(t).cut(o):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let o=this.path[t*3],r=t==0?0:this.path[t*3-1]+1;for(let i=0;i<e;i++)r+=o.child(i).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return tt.none;if(this.textOffset)return e.child(t).marks;let o=e.maybeChild(t-1),r=e.maybeChild(t);if(!o){let l=o;o=r,r=l}let i=o.marks;for(var s=0;s<i.length;s++)i[s].type.spec.inclusive===!1&&(!r||!i[s].isInSet(r.marks))&&(i=i[s--].removeFromSet(i));return i}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let o=t.marks,r=e.parent.maybeChild(e.index());for(var i=0;i<o.length;i++)o[i].type.spec.inclusive===!1&&(!r||!o[i].isInSet(r.marks))&&(o=o[i--].removeFromSet(o));return o}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let o=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);o>=0;o--)if(e.pos<=this.end(o)&&(!t||t(this.node(o))))return new zu(this,e,o);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let o=[],r=0,i=t;for(let s=e;;){let{index:l,offset:a}=s.content.findIndex(i),u=i-a;if(o.push(s,l,r+a),!u||(s=s.child(l),s.isText))break;i=u-1,r+=a+1}return new mh(t,o,i)}static resolveCached(e,t){let o=Xv.get(e);if(o)for(let i=0;i<o.elts.length;i++){let s=o.elts[i];if(s.pos==t)return s}else Xv.set(e,o=new l3);let r=o.elts[o.i]=mh.resolve(e,t);return o.i=(o.i+1)%a3,r}},l3=class{constructor(){this.elts=[],this.i=0}};const a3=12,Xv=new WeakMap;let zu=class{constructor(e,t,o){this.$from=e,this.$to=t,this.depth=o}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}};const c3=Object.create(null);let ui=class gh{constructor(e,t,o,r=tt.none){this.type=e,this.attrs=t,this.marks=r,this.content=o||J.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,o,r=0){this.content.nodesBetween(e,t,o,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,o,r){return this.content.textBetween(e,t,o,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,o){return this.type==e&&Lu(this.attrs,t||e.defaultAttrs||c3)&&tt.sameSet(this.marks,o||tt.none)}copy(e=null){return e==this.content?this:new gh(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new gh(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,o=!1){if(e==t)return le.empty;let r=this.resolve(e),i=this.resolve(t),s=o?0:r.sharedDepth(t),l=r.start(s),a=r.node(s).content.cut(r.pos-l,i.pos-l);return new le(a,r.depth-s,i.depth-s)}replace(e,t,o){return i3(this.resolve(e),this.resolve(t),o)}nodeAt(e){for(let t=this;;){let{index:o,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(o),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:o}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:o}}childBefore(e){if(e==0)return{node:null,index:0,offset:0};let{index:t,offset:o}=this.content.findIndex(e);if(o<e)return{node:this.content.child(t),index:t,offset:o};let r=this.content.child(t-1);return{node:r,index:t-1,offset:o-r.nodeSize}}resolve(e){return Gv.resolveCached(this,e)}resolveNoCache(e){return Gv.resolve(this,e)}rangeHasMark(e,t,o){let r=!1;return t>e&&this.nodesBetween(e,t,i=>(o.isInSet(i.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),VS(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,o=J.empty,r=0,i=o.childCount){let s=this.contentMatchAt(e).matchFragment(o,r,i),l=s&&s.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=r;a<i;a++)if(!this.type.allowsMarks(o.child(a).marks))return!1;return!0}canReplaceWith(e,t,o,r){if(r&&!this.type.allowsMarks(r))return!1;let i=this.contentMatchAt(e).matchType(o),s=i&&i.matchFragment(this.content,t);return s?s.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=tt.none;for(let t=0;t<this.marks.length;t++){let o=this.marks[t];o.type.checkAttrs(o.attrs),e=o.addToSet(e)}if(!tt.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let o;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");o=t.marks.map(e.markFromJSON)}if(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,o)}let r=J.fromJSON(e,t.content),i=e.nodeType(t.type).create(t.attrs,r,o);return i.type.checkAttrs(i.attrs),i}};ui.prototype.text=void 0;let u3=class yh extends ui{constructor(e,t,o,r){if(super(e,t,null,r),!o)throw new RangeError("Empty text nodes are not allowed");this.text=o}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):VS(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new yh(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new yh(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}};function VS(n,e){for(let t=n.length-1;t>=0;t--)e=n[t].type.name+"("+e+")";return e}let ta=class zS{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let o=new d3(e,t);if(o.next==null)return zS.empty;let r=FS(o);o.next&&o.err("Unexpected trailing text");let i=b3(y3(r));return v3(i,o),i}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,o=e.childCount){let r=this;for(let i=t;r&&i<o;i++)r=r.matchType(e.child(i).type);return r}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let o=0;o<e.next.length;o++)if(this.next[t].type==e.next[o].type)return!0;return!1}fillBefore(e,t=!1,o=0){let r=[this];function i(s,l){let a=s.matchFragment(e,o);if(a&&(!t||a.validEnd))return J.from(l.map(u=>u.createAndFill()));for(let u=0;u<s.next.length;u++){let{type:d,next:f}=s.next[u];if(!(d.isText||d.hasRequiredAttrs())&&r.indexOf(f)==-1){r.push(f);let p=i(f,l.concat(d));if(p)return p}}return null}return i(this,[])}findWrapping(e){for(let o=0;o<this.wrapCache.length;o+=2)if(this.wrapCache[o]==e)return this.wrapCache[o+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),o=[{match:this,type:null,via:null}];for(;o.length;){let r=o.shift(),i=r.match;if(i.matchType(e)){let s=[];for(let l=r;l.type;l=l.via)s.push(l.type);return s.reverse()}for(let s=0;s<i.next.length;s++){let{type:l,next:a}=i.next[s];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!r.type||a.validEnd)&&(o.push({match:l.contentMatch,type:l,via:r}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(o){e.push(o);for(let r=0;r<o.next.length;r++)e.indexOf(o.next[r].next)==-1&&t(o.next[r].next)}return t(this),e.map((o,r)=>{let i=r+(o.validEnd?"*":" ")+" ";for(let s=0;s<o.next.length;s++)i+=(s?", ":"")+o.next[s].type.name+"->"+e.indexOf(o.next[s].next);return i}).join(`
|
|
231
|
+
`)}};ta.empty=new ta(!0);let d3=class{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}};function FS(n){let e=[];do e.push(f3(n));while(n.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function f3(n){let e=[];do e.push(p3(n));while(n.next&&n.next!=")"&&n.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function p3(n){let e=g3(n);for(;;)if(n.eat("+"))e={type:"plus",expr:e};else if(n.eat("*"))e={type:"star",expr:e};else if(n.eat("?"))e={type:"opt",expr:e};else if(n.eat("{"))e=h3(n,e);else break;return e}function Yv(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let e=Number(n.next);return n.pos++,e}function h3(n,e){let t=Yv(n),o=t;return n.eat(",")&&(n.next!="}"?o=Yv(n):o=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:t,max:o,expr:e}}function m3(n,e){let t=n.nodeTypes,o=t[e];if(o)return[o];let r=[];for(let i in t){let s=t[i];s.isInGroup(e)&&r.push(s)}return r.length==0&&n.err("No node type or group '"+e+"' found"),r}function g3(n){if(n.eat("(")){let e=FS(n);return n.eat(")")||n.err("Missing closing paren"),e}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let e=m3(n,n.next).map(t=>(n.inline==null?n.inline=t.isInline:n.inline!=t.isInline&&n.err("Mixing inline and block content"),{type:"name",value:t}));return n.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function y3(n){let e=[[]];return r(i(n,0),t()),e;function t(){return e.push([])-1}function o(s,l,a){let u={term:a,to:l};return e[s].push(u),u}function r(s,l){s.forEach(a=>a.to=l)}function i(s,l){if(s.type=="choice")return s.exprs.reduce((a,u)=>a.concat(i(u,l)),[]);if(s.type=="seq")for(let a=0;;a++){let u=i(s.exprs[a],l);if(a==s.exprs.length-1)return u;r(u,l=t())}else if(s.type=="star"){let a=t();return o(l,a),r(i(s.expr,a),a),[o(a)]}else if(s.type=="plus"){let a=t();return r(i(s.expr,l),a),r(i(s.expr,a),a),[o(a)]}else{if(s.type=="opt")return[o(l)].concat(i(s.expr,l));if(s.type=="range"){let a=l;for(let u=0;u<s.min;u++){let d=t();r(i(s.expr,a),d),a=d}if(s.max==-1)r(i(s.expr,a),a);else for(let u=s.min;u<s.max;u++){let d=t();o(a,d),r(i(s.expr,a),d),a=d}return[o(a)]}else{if(s.type=="name")return[o(l,void 0,s.value)];throw new Error("Unknown expr type")}}}}function HS(n,e){return e-n}function Qv(n,e){let t=[];return o(e),t.sort(HS);function o(r){let i=n[r];if(i.length==1&&!i[0].term)return o(i[0].to);t.push(r);for(let s=0;s<i.length;s++){let{term:l,to:a}=i[s];!l&&t.indexOf(a)==-1&&o(a)}}}function b3(n){let e=Object.create(null);return t(Qv(n,0));function t(o){let r=[];o.forEach(s=>{n[s].forEach(({term:l,to:a})=>{if(!l)return;let u;for(let d=0;d<r.length;d++)r[d][0]==l&&(u=r[d][1]);Qv(n,a).forEach(d=>{u||r.push([l,u=[]]),u.indexOf(d)==-1&&u.push(d)})})});let i=e[o.join(",")]=new ta(o.indexOf(n.length-1)>-1);for(let s=0;s<r.length;s++){let l=r[s][1].sort(HS);i.next.push({type:r[s][0],next:e[l.join(",")]||t(l)})}return i}}function v3(n,e){for(let t=0,o=[n];t<o.length;t++){let r=o[t],i=!r.validEnd,s=[];for(let l=0;l<r.next.length;l++){let{type:a,next:u}=r.next[l];s.push(a.name),i&&!(a.isText||a.hasRequiredAttrs())&&(i=!1),o.indexOf(u)==-1&&o.push(u)}i&&e.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function jS(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function US(n,e){let t=Object.create(null);for(let o in n){let r=e&&e[o];if(r===void 0){let i=n[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=r}return t}function WS(n,e,t,o){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let i=n[r];i.validate&&i.validate(e[r])}}function qS(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new w3(n,o,e[o]);return t}let Zv=class KS{constructor(e,t,o){this.name=e,this.schema=t,this.spec=o,this.markSet=null,this.groups=o.group?o.group.split(" "):[],this.attrs=qS(e,o.attrs),this.defaultAttrs=jS(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(o.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ta.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:US(this.attrs,e)}create(e=null,t,o){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new ui(this,this.computeAttrs(e),J.from(t),tt.setFrom(o))}createChecked(e=null,t,o){return t=J.from(t),this.checkContent(t),new ui(this,this.computeAttrs(e),t,tt.setFrom(o))}createAndFill(e=null,t,o){if(e=this.computeAttrs(e),t=J.from(t),t.size){let s=this.contentMatch.fillBefore(t);if(!s)return null;t=s.append(t)}let r=this.contentMatch.matchFragment(t),i=r&&r.fillBefore(J.empty,!0);return i?new ui(this,e,t.append(i),tt.setFrom(o)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let o=0;o<e.childCount;o++)if(!this.allowsMarks(e.child(o).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){WS(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let o=0;o<e.length;o++)this.allowsMarkType(e[o].type)?t&&t.push(e[o]):t||(t=e.slice(0,o));return t?t.length?t:tt.none:e}static compile(e,t){let o=Object.create(null);e.forEach((i,s)=>o[i]=new KS(i,t,s));let r=t.spec.topNode||"doc";if(!o[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!o.text)throw new RangeError("Every schema needs a 'text' type");for(let i in o.text.attrs)throw new RangeError("The text node type should not have attributes");return o}};function k3(n,e,t){let o=t.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${i}`)}}let w3=class{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?k3(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}},JS=class GS{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=qS(e,r.attrs),this.excluded=null;let i=jS(this.attrs);this.instance=i?new tt(this,i):null}create(e=null){return!e&&this.instance?this.instance:new tt(this,US(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new GS(i,r++,t,s)),o}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){WS(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}},x3=class{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let r in e)t[r]=e[r];t.nodes=$t.from(e.nodes),t.marks=$t.from(e.marks||{}),this.nodes=Zv.compile(this.spec.nodes,this),this.marks=JS.compile(this.spec.marks,this);let o=Object.create(null);for(let r in this.nodes){if(r in this.marks)throw new RangeError(r+" can not be both a node and a mark");let i=this.nodes[r],s=i.spec.content||"",l=i.spec.marks;if(i.contentMatch=o[s]||(o[s]=ta.parse(s,this.nodes)),i.inlineContent=i.contentMatch.inlineContent,i.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!i.isInline||!i.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=i}i.markSet=l=="_"?null:l?ek(this,l.split(" ")):l==""||!i.inlineContent?[]:null}for(let r in this.marks){let i=this.marks[r],s=i.spec.excludes;i.excluded=s==null?[i]:s==""?[]:ek(this,s.split(" "))}this.nodeFromJSON=r=>ui.fromJSON(this,r),this.markFromJSON=r=>tt.fromJSON(this,r),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,o,r){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Zv){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,o,r)}text(e,t){let o=this.nodes.text;return new u3(o,o.defaultAttrs,e,tt.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}};function ek(n,e){let t=[];for(let o=0;o<e.length;o++){let r=e[o],i=n.marks[r],s=i;if(i)t.push(i);else for(let l in n.marks){let a=n.marks[l];(r=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(r)>-1)&&t.push(s=a)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return t}function C3(n){return n.tag!=null}function S3(n){return n.style!=null}let Uf=class bh{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(C3(r))this.tags.push(r);else if(S3(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let o=new nk(this,t,!1);return o.addAll(e,tt.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new nk(this,t,!0);return o.addAll(e,tt.none,t.from,t.to),le.maxOpen(o.finish())}matchTag(e,t,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(T3(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=ok(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=ok(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new bh(e,bh.schemaRules(e)))}};const XS={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},E3={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},YS={ol:!0,ul:!0},na=1,vh=2,Sl=4;function tk(n,e,t){return e!=null?(e?na:0)|(e==="full"?vh:0):n&&n.whitespace=="pre"?na|vh:t&~Sl}class Za{constructor(e,t,o,r,i,s){this.type=e,this.attrs=t,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=tt.none,this.match=i||(s&Sl?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(J.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&na)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let t=J.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(J.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!XS.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}let nk=class{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,s=tk(null,t.preserveWhitespace,0)|(o?Sl:0);r?i=new Za(r.type,r.attrs,tt.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new Za(null,null,tt.none,!0,null,s):i=new Za(e.schema.topNodeType,null,tt.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let o=e.nodeValue,r=this.top,i=r.options&vh?"full":this.localPreserveWS||(r.options&na)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
|
|
232
|
+
`);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),t,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;YS.hasOwnProperty(s)&&this.parser.normalizeLists&&M3(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(a?a.ignore:E3.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let u,d=this.needsBlock;if(XS.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
233
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(u=>!a.clearMark(u)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,o,r){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let a=this.enter(s,t.attrs||null,o,t.preserveWhitespace);a&&(i=!0,o=a)}else{let a=this.parser.schema.marks[t.mark];o=o.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,o,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,o),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],u=a.findWrapping(e);if(u&&(!r||r.length>u.length+l)&&(r=u,i=a,!u.length))break;if(a.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)t=this.enterInner(r[s],null,t,!1);return t}insertNode(e,t,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=tt.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):rk(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,o,r){let i=this.findPlace(e.create(t),o,!1);return i&&(i=this.enterInner(e,t,o,!0,r)),i}enterInner(e,t,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=tk(e,i,s.options);s.options&Sl&&s.content.length==0&&(l|=Sl);let a=tt.none;return o=o.filter(u=>(s.type?s.type.allowsMarkType(u.type):rk(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new Za(e,t,a,r,null,l)),this.open++,o}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=na)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let o=this.nodes[t].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,o){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,a)=>{for(;l>=0;l--){let u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}};function M3(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&YS.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function T3(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function ok(n){let e={};for(let t in n)e[t]=n[t];return e}function rk(n,e){let t=e.schema.nodes;for(let o in t){let r=t[o];if(!r.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:d}=l.edge(a);if(u==e||i.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}const QS=65535,ZS=Math.pow(2,16);function N3(n,e){return n+e*ZS}function ik(n){return n&QS}function A3(n){return(n-(n&QS))/ZS}const eE=1,tE=2,Sc=4,nE=8;let kh=class{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&nE)>0}get deletedBefore(){return(this.delInfo&(eE|Sc))>0}get deletedAfter(){return(this.delInfo&(tE|Sc))>0}get deletedAcross(){return(this.delInfo&Sc)>0}},Ei=class Gi{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&Gi.empty)return Gi.empty}recover(e){let t=0,o=ik(e);if(!this.inverted)for(let r=0;r<o;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+t+A3(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[l+i],d=this.ranges[l+s],f=a+u;if(e<=f){let p=u?e==a?-1:e==f?1:t:t,h=a+r+(p<0?0:d);if(o)return h;let m=e==(t<0?a:f)?null:N3(l/3,e-a),g=e==a?tE:e==f?eE:Sc;return(t<0?e!=a:e!=f)&&(g|=nE),new kh(h,g,m)}r+=d-u}return o?e+r:new kh(e+r,0,null)}touches(e,t){let o=0,r=ik(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let u=this.ranges[l+i],d=a+u;if(e<=d&&l==r*3)return!0;o+=this.ranges[l+s]-u}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[r+t],d=this.ranges[r+o];e(l,l+u,a,a+d),i+=d-u}}invert(){return new Gi(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?Gi.empty:new Gi(e<0?[0,-e,0]:[0,0,e])}};Ei.empty=new Ei([]);let O3=class wh{constructor(e,t,o=0,r=e?e.length:0){this.mirror=t,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new wh(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,o=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?o+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,o=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?o-r-1:void 0)}}invert(){let e=new wh;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new kh(e,r,null)}};const Wf=Object.create(null);let Xt=class{getMap(){return Ei.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=Wf[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Wf)throw new RangeError("Duplicate use of step JSON ID "+e);return Wf[e]=t,t.prototype.jsonID=e,t}},nn=class Zs{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new Zs(e,null)}static fail(e){return new Zs(null,e)}static fromReplace(e,t,o,r){try{return Zs.ok(e.replace(t,o,r))}catch(i){if(i instanceof Pu)return Zs.fail(i.message);throw i}}};function Ng(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(Ng(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return J.fromArray(o)}let Ag=class el extends Xt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new le(Ng(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),t.openStart,t.openEnd);return nn.fromReplace(e,this.from,this.to,i)}invert(){return new Ls(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new el(t.pos,o.pos,this.mark)}merge(e){return e instanceof el&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new el(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new el(t.from,t.to,e.markFromJSON(t.mark))}};Xt.jsonID("addMark",Ag);let Ls=class tl extends Xt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new le(Ng(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return nn.fromReplace(e,this.from,this.to,o)}invert(){return new Ag(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new tl(t.pos,o.pos,this.mark)}merge(e){return e instanceof tl&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new tl(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new tl(t.from,t.to,e.markFromJSON(t.mark))}};Xt.jsonID("removeMark",Ls);let Og=class nl extends Xt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return nn.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return nn.fromReplace(e,this.pos,this.pos+1,new le(J.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(o))return new nl(this.pos,t.marks[r]);return new nl(this.pos,this.mark)}}return new Fu(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new nl(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new nl(t.pos,e.markFromJSON(t.mark))}};Xt.jsonID("addNodeMark",Og);let Fu=class xh extends Xt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return nn.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return nn.fromReplace(e,this.pos,this.pos+1,new le(J.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Og(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new xh(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new xh(t.pos,e.markFromJSON(t.mark))}};Xt.jsonID("removeNodeMark",Fu);class wt extends Xt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&Ch(e,this.from,this.to)?nn.fail("Structure replace would overwrite content"):nn.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new Ei([this.from,this.to-this.from,this.slice.size])}invert(e){return new wt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new wt(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof wt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?le.empty:new le(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new wt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?le.empty:new le(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new wt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new wt(t.from,t.to,le.fromJSON(e,t.slice),!!t.structure)}}Xt.jsonID("replace",wt);let pn=class Ec extends Xt{constructor(e,t,o,r,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Ch(e,this.from,this.gapFrom)||Ch(e,this.gapTo,this.to)))return nn.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return nn.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?nn.fromReplace(e,this.from,this.to,o):nn.fail("Content does not fit in gap")}getMap(){return new Ei([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Ec(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||r<t.pos||i>o.pos?null:new Ec(t.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Ec(t.from,t.to,t.gapFrom,t.gapTo,le.fromJSON(e,t.slice),t.insert,!!t.structure)}};Xt.jsonID("replaceAround",pn);function Ch(n,e,t){let o=n.resolve(e),r=t-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function $3(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!o.isInSet(f)&&d.type.allowsMarkType(o.type)){let p=Math.max(u,e),h=Math.min(u+a.nodeSize,t),m=o.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[g])?s.to=h:r.push(s=new Ls(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new Ag(p,h,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function B3(n,e,t,o){let r=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(o instanceof JS){let u=s.marks,d;for(;d=o.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let u=Math.min(l+s.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=u,p.step=i):r.push({style:f,from:Math.max(l,e),to:u,step:i})}}}),r.forEach(s=>n.step(new Ls(s.from,s.to,s.style)))}function $g(n,e,t,o=t.contentMatch,r=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let u=i.child(a),d=l+u.nodeSize,f=o.matchType(u.type);if(!f)s.push(new wt(l,d,le.empty));else{o=f;for(let p=0;p<u.marks.length;p++)t.allowsMarkType(u.marks[p].type)||n.step(new Ls(l,d,u.marks[p]));if(r&&u.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(u.text);)m||(m=new le(J.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),s.push(new wt(l+p.index,l+p.index+p[0].length,m))}}l=d}if(!o.validEnd){let a=o.fillBefore(J.empty,!0);n.replace(l,l,new le(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function R3(n,e,t){return(e==0||n.canReplace(e,n.childCount))&&(t==n.childCount||n.canReplace(0,t))}function Ps(n){let e=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let t=n.depth,o=0,r=0;;--t){let i=n.$from.node(t),s=n.$from.index(t)+o,l=n.$to.indexAfter(t)-r;if(t<n.depth&&i.canReplace(s,l,e))return t;if(t==0||i.type.spec.isolating||!R3(i,s,l))break;s&&(o=1),l<i.childCount&&(r=1)}return null}function _3(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),a=s,u=l,d=J.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,d=J.from(o.node(m).copy(d)),f++):a--;let p=J.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=J.from(r.node(m).copy(p)),h++):u++;n.step(new pn(a,u,s,l,new le(d.append(p),f,h),d.size-f,!0))}function Bg(n,e,t=null,o=n){let r=D3(n,e),i=r&&I3(o,e);return i?r.map(sk).concat({type:e,attrs:t}).concat(i.map(sk)):null}function sk(n){return{type:n,attrs:null}}function D3(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.contentMatchAt(o).findWrapping(e);if(!i)return null;let s=i.length?i[0]:e;return t.canReplaceWith(o,r,s)?i:null}function I3(n,e){let{parent:t,startIndex:o,endIndex:r}=n,i=t.child(o),s=e.contentMatch.findWrapping(i.type);if(!s)return null;let l=(s.length?s[s.length-1]:e).contentMatch;for(let a=o;l&&a<r;a++)l=l.matchType(t.child(a).type);return!l||!l.validEnd?null:s}function L3(n,e,t){let o=J.empty;for(let s=t.length-1;s>=0;s--){if(o.size){let l=t[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=J.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new pn(r,i,r,i,new le(o,0,0),t.length,!0))}function P3(n,e,t,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,a)&&V3(n.doc,n.mapping.slice(i).map(l),o)){let u=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&rE(n,s,l,i),$g(n,n.mapping.slice(i).map(l,1),o,void 0,u===null);let d=n.mapping.slice(i),f=d.map(l,1),p=d.map(l+s.nodeSize,1);return n.step(new pn(f,p,f+1,p-1,new le(J.from(o.create(a,null,s.marks)),0,0),1,!0)),u===!0&&oE(n,s,l,i),!1}})}function oE(n,e,t,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let a=n.mapping.slice(o).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function rE(n,e,t,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=n.mapping.slice(o).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
|
|
234
|
+
`))}})}function V3(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function z3(n,e,t,o,r){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new pn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new le(J.from(s),0,0),1,!0))}function Yo(n,e,t=1,o){let r=n.resolve(e),i=r.depth-t,s=o&&o[o.length-1]||r.parent;if(i<0||r.parent.type.spec.isolating||!r.parent.canReplace(r.index(),r.parent.childCount)||!s.type.validContent(r.parent.content.cutByIndex(r.index(),r.parent.childCount)))return!1;for(let u=r.depth-1,d=t-2;u>i;u--,d--){let f=r.node(u),p=r.index(u);if(f.type.spec.isolating)return!1;let h=f.content.cutByIndex(p,f.childCount),m=o&&o[d+1];m&&(h=h.replaceChild(0,m.type.create(m.attrs)));let g=o&&o[d]||f;if(!f.canReplace(p+1,f.childCount)||!g.type.validContent(h))return!1}let l=r.indexAfter(i),a=o&&o[0];return r.node(i).canReplaceWith(l,l,a?a.type:r.node(i+1).type)}function F3(n,e,t=1,o){let r=n.doc.resolve(e),i=J.empty,s=J.empty;for(let l=r.depth,a=r.depth-t,u=t-1;l>a;l--,u--){i=J.from(r.node(l).copy(i));let d=o&&o[u];s=J.from(d?d.type.create(d.attrs,s):r.node(l).copy(s))}n.step(new wt(e,e,new le(i.append(s),t,t),!0))}function Hr(n,e){let t=n.resolve(e),o=t.index();return iE(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(o,o+1)}function H3(n,e){e.content.size||n.type.compatibleContent(e.type);let t=n.contentMatchAt(n.childCount),{linebreakReplacement:o}=n.type.schema;for(let r=0;r<e.childCount;r++){let i=e.child(r),s=i.type==o?n.type.schema.nodes.text:i.type;if(t=t.matchType(s),!t||!n.type.allowsMarks(i.marks))return!1}return t.validEnd}function iE(n,e){return!!(n&&e&&!n.isLeaf&&H3(n,e))}function jd(n,e,t=-1){let o=n.resolve(e);for(let r=o.depth;;r--){let i,s,l=o.index(r);if(r==o.depth?(i=o.nodeBefore,s=o.nodeAfter):t>0?(i=o.node(r+1),l++,s=o.node(r).maybeChild(l)):(i=o.node(r).maybeChild(l-1),s=o.node(r+1)),i&&!i.isTextblock&&iE(i,s)&&o.node(r).canReplace(l,l+1))return e;if(r==0)break;e=t<0?o.before(r):o.after(r)}}function j3(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(r&&s.inlineContent){let d=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);d&&!f?o=!1:!d&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let d=n.doc.resolve(e+t);rE(n,d.node(),d.before(),l)}s.inlineContent&&$g(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),u=a.map(e-t);if(n.step(new wt(u,a.map(e+t,-1),le.empty,!0)),o===!0){let d=n.doc.resolve(u);oE(n,d.node(),d.before(),n.steps.length)}return n}function U3(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,t))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,t))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function Ud(n,e,t=e,o=le.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return sE(r,i,o)?new wt(e,t,o):new W3(r,i,o).fit()}function sE(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}let W3=class{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=J.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=J.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new le(i,s,l);return e>-1?new pn(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new wt(o.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}t=i.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=qf(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],d,f=null;if(t==1&&(s?u.matchType(s.type)||(f=u.fillBefore(J.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(d=u.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=qf(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new le(e,t+1,Math.max(o,r.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=qf(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new le(ol(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new le(ol(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=o?o.content:s.content,a=s.openStart-e,u=0,d=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)d.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;u<l.childCount;){let g=l.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||a==0||g.content.size)&&(f=y,d.push(lE(g.mark(p.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?h:-1)))}let m=u==l.childCount;m||(h=-1),this.placed=rl(this.placed,t,J.from(d)),this.frontier[t].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?le.empty:new le(ol(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new le(ol(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!Kf(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=Kf(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=Kf(e,l,u,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=rl(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,t=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=rl(this.placed,this.depth,J.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(J.empty,!0);e.childCount&&(this.placed=rl(this.placed,this.frontier.length,e))}};function ol(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(ol(n.firstChild.content,e-1,t)))}function rl(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(rl(n.lastChild.content,e-1,t)))}function qf(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function lE(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,lE(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(J.empty,!0)))),n.copy(o)}function Kf(n,e,t,o,r){let i=n.node(e),s=r?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!q3(t,i.content,s)?l:null}function q3(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function K3(n){return n.spec.defining||n.spec.definingForContent}function J3(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(sE(r,i,o))return n.step(new wt(e,t,o));let s=cE(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let a=s.indexOf(l),u=[],d=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(u.push(m),h==o.openStart)break;p=m.content}for(let p=d-1;p>=0;p--){let h=u[p],m=K3(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))d=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+d+1)%(o.openStart+1),m=u[h];if(m)for(let g=0;g<s.length;g++){let y=s[(g+a)%s.length],b=!0;y<0&&(b=!1,y=-y);let v=r.node(y-1),w=r.index(y-1);if(v.canReplaceWith(w,w,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new le(aE(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=s.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),t=i.after(h))}}function aE(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(aE(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(J.empty,!0))}return n}function G3(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=U3(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new le(J.from(o),0,0))}function X3(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=cE(o,r);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),r.end(l));if(l>0&&(a||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return n.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&t>o.end(s)&&r.end(s)-t!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return n.delete(o.before(s),t);n.delete(e,t)}function cE(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let r=o;r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&t.push(r)}return t}let uE=class Mc extends Xt{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return nn.fail("No node at attribute step's position");let o=Object.create(null);for(let i in t.attrs)o[i]=t.attrs[i];o[this.attr]=this.value;let r=t.type.create(o,null,t.marks);return nn.fromReplace(e,this.pos,this.pos+1,new le(J.from(r),0,t.isLeaf?0:1))}getMap(){return Ei.empty}invert(e){return new Mc(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Mc(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new Mc(t.pos,t.attr,t.value)}};Xt.jsonID("attr",uE);let dE=class Sh extends Xt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return nn.ok(o)}getMap(){return Ei.empty}invert(e){return new Sh(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new Sh(t.attr,t.value)}};Xt.jsonID("docAttr",dE);let Ns=class extends Error{};Ns=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};Ns.prototype=Object.create(Error.prototype);Ns.prototype.constructor=Ns;Ns.prototype.name="TransformError";let Y3=class{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new O3}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new Ns(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let o=0;o<this.mapping.maps.length;o++){let r=this.mapping.maps[o];o&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((i,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,o=le.empty){let r=Ud(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new le(J.from(o),0,0))}delete(e,t){return this.replace(e,t,le.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return J3(this,e,t,o),this}replaceRangeWith(e,t,o){return G3(this,e,t,o),this}deleteRange(e,t){return X3(this,e,t),this}lift(e,t){return _3(this,e,t),this}join(e,t=1){return j3(this,e,t),this}wrap(e,t){return L3(this,e,t),this}setBlockType(e,t=e,o,r=null){return P3(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return z3(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new uE(e,t,o)),this}setDocAttribute(e,t){return this.step(new dE(e,t)),this}addNodeMark(e,t){return this.step(new Og(e,t)),this}removeNodeMark(e,t){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t instanceof tt)t.isInSet(o.marks)&&this.step(new Fu(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new Fu(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,o){return F3(this,e,t,o),this}addMark(e,t,o){return $3(this,e,t,o),this}removeMark(e,t,o){return B3(this,e,t,o),this}clearIncompatible(e,t,o){return $g(this,e,t,o),this}};const Jf=Object.create(null);let it=class{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new Q3(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=le.empty){let o=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:u}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(u.pos),l?le.empty:t),l==0&&ck(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],a=e.mapping.slice(o),u=a.map(s.pos),d=a.map(l.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),ck(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new Zo(e):Xi(e.node(0),e.parent,e.pos,e.index(),t,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=t<0?Xi(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):Xi(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new di(e.node(0))}static atStart(e){return Xi(e,e,0,0,1)||new di(e)}static atEnd(e){return Xi(e,e,e.content.size,e.childCount,-1)||new di(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=Jf[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in Jf)throw new RangeError("Duplicate use of selection JSON ID "+e);return Jf[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Zo.between(this.$anchor,this.$head).getBookmark()}};it.prototype.visible=!0;let Q3=class{constructor(e,t){this.$from=e,this.$to=t}},lk=!1;function ak(n){!lk&&!n.parent.inlineContent&&(lk=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}let Zo=class il extends it{constructor(e,t=e){ak(e),ak(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return it.near(o);let r=e.resolve(t.map(this.anchor));return new il(r.parent.inlineContent?r:o,o)}replace(e,t=le.empty){if(super.replace(e,t),t==le.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof il&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new fE(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new il(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let r=e.resolve(t);return new this(r,o==t?r:e.resolve(o))}static between(e,t,o){let r=e.pos-t.pos;if((!o||r)&&(o=r>=0?1:-1),!t.parent.inlineContent){let i=it.findFrom(t,o,!0)||it.findFrom(t,-o,!0);if(i)t=i.$head;else return it.near(t,o)}return e.parent.inlineContent||(r==0?e=t:(e=(it.findFrom(e,-o,!0)||it.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new il(e,t)}};it.jsonID("text",Zo);let fE=class pE{constructor(e,t){this.anchor=e,this.head=t}map(e){return new pE(e.map(this.anchor),e.map(this.head))}resolve(e){return Zo.between(e.resolve(this.anchor),e.resolve(this.head))}};class ot extends it{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return o?it.near(i):new ot(i)}content(){return new le(J.from(this.node),0,0)}eq(e){return e instanceof ot&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Z3(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new ot(e.resolve(t.anchor))}static create(e,t){return new ot(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}ot.prototype.visible=!1;it.jsonID("node",ot);let Z3=class hE{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new fE(o,o):new hE(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&ot.isSelectable(o)?new ot(t):it.near(t)}},di=class Tc extends it{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=le.empty){if(t==le.empty){e.delete(0,e.doc.content.size);let o=it.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new Tc(e)}map(e){return new Tc(e)}eq(e){return e instanceof Tc}getBookmark(){return eU}};it.jsonID("all",di);const eU={map(){return this},resolve(n){return new di(n)}};function Xi(n,e,t,o,r,i=!1){if(e.inlineContent)return Zo.create(n,t);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&ot.isSelectable(l))return ot.create(n,t-(r<0?l.nodeSize:0))}else{let a=Xi(n,l,t+r,r<0?l.childCount:0,r,i);if(a)return a}t+=l.nodeSize*r}return null}function ck(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof wt||r instanceof pn))return;let i=n.mapping.maps[o],s;i.forEach((l,a,u,d)=>{s==null&&(s=d)}),n.setSelection(it.near(n.doc.resolve(s),t))}function uk(n,e){return!e||!n?n:n.bind(e)}let ec=class{constructor(e,t,o){this.name=e,this.init=uk(t.init,o),this.apply=uk(t.apply,o)}};new ec("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ec("selection",{init(n,e){return n.selection||it.atStart(e.doc)},apply(n){return n.selection}}),new ec("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new ec("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});const Rg=(n,e)=>n.selection.empty?!1:(e&&e(n.tr.deleteSelection().scrollIntoView()),!0);function mE(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("backward",n):t.parentOffset>0)?null:t}const gE=(n,e,t)=>{let o=mE(n,t);if(!o)return!1;let r=_g(o);if(!r){let s=o.blockRange(),l=s&&Ps(s);return l==null?!1:(e&&e(n.tr.lift(s,l).scrollIntoView()),!0)}let i=r.nodeBefore;if(EE(n,r,e,-1))return!0;if(o.parent.content.size==0&&(As(i,"end")||ot.isSelectable(i)))for(let s=o.depth;;s--){let l=Ud(n.doc,o.before(s),o.after(s),le.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=n.tr.step(l);a.setSelection(As(i,"end")?it.findFrom(a.doc.resolve(a.mapping.map(r.pos,-1)),-1):ot.create(a.doc,r.pos-i.nodeSize)),e(a.scrollIntoView())}return!0}if(s==1||o.node(s-1).childCount>1)break}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos-i.nodeSize,r.pos).scrollIntoView()),!0):!1},tU=(n,e,t)=>{let o=mE(n,t);if(!o)return!1;let r=_g(o);return r?yE(n,r,e):!1},nU=(n,e,t)=>{let o=vE(n,t);if(!o)return!1;let r=Dg(o);return r?yE(n,r,e):!1};function yE(n,e,t){let o=e.nodeBefore,r=o,i=e.pos-1;for(;!r.isTextblock;i--){if(r.type.spec.isolating)return!1;let d=r.lastChild;if(!d)return!1;r=d}let s=e.nodeAfter,l=s,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let d=l.firstChild;if(!d)return!1;l=d}let u=Ud(n.doc,i,a,le.empty);if(!u||u.from!=i||u instanceof wt&&u.slice.size>=a-i)return!1;if(t){let d=n.tr.step(u);d.setSelection(Zo.create(d.doc,i)),t(d.scrollIntoView())}return!0}function As(n,e,t=!1){for(let o=n;o;o=e=="start"?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(t&&o.childCount!=1)return!1}return!1}const bE=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("backward",n):o.parentOffset>0)return!1;i=_g(o)}let s=i&&i.nodeBefore;return!s||!ot.isSelectable(s)?!1:(e&&e(n.tr.setSelection(ot.create(n.doc,i.pos-s.nodeSize)).scrollIntoView()),!0)};function _g(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){if(n.index(e)>0)return n.doc.resolve(n.before(e+1));if(n.node(e).type.spec.isolating)break}return null}function vE(n,e){let{$cursor:t}=n.selection;return!t||(e?!e.endOfTextblock("forward",n):t.parentOffset<t.parent.content.size)?null:t}const kE=(n,e,t)=>{let o=vE(n,t);if(!o)return!1;let r=Dg(o);if(!r)return!1;let i=r.nodeAfter;if(EE(n,r,e,1))return!0;if(o.parent.content.size==0&&(As(i,"start")||ot.isSelectable(i))){let s=Ud(n.doc,o.before(),o.after(),le.empty);if(s&&s.slice.size<s.to-s.from){if(e){let l=n.tr.step(s);l.setSelection(As(i,"start")?it.findFrom(l.doc.resolve(l.mapping.map(r.pos)),1):ot.create(l.doc,l.mapping.map(r.pos))),e(l.scrollIntoView())}return!0}}return i.isAtom&&r.depth==o.depth-1?(e&&e(n.tr.delete(r.pos,r.pos+i.nodeSize).scrollIntoView()),!0):!1},wE=(n,e,t)=>{let{$head:o,empty:r}=n.selection,i=o;if(!r)return!1;if(o.parent.isTextblock){if(t?!t.endOfTextblock("forward",n):o.parentOffset<o.parent.content.size)return!1;i=Dg(o)}let s=i&&i.nodeAfter;return!s||!ot.isSelectable(s)?!1:(e&&e(n.tr.setSelection(ot.create(n.doc,i.pos)).scrollIntoView()),!0)};function Dg(n){if(!n.parent.type.spec.isolating)for(let e=n.depth-1;e>=0;e--){let t=n.node(e);if(n.index(e)+1<t.childCount)return n.doc.resolve(n.after(e+1));if(t.type.spec.isolating)break}return null}const oU=(n,e)=>{let t=n.selection,o=t instanceof ot,r;if(o){if(t.node.isTextblock||!Hr(n.doc,t.from))return!1;r=t.from}else if(r=jd(n.doc,t.from,-1),r==null)return!1;if(e){let i=n.tr.join(r);o&&i.setSelection(ot.create(i.doc,r-n.doc.resolve(r).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0},rU=(n,e)=>{let t=n.selection,o;if(t instanceof ot){if(t.node.isTextblock||!Hr(n.doc,t.to))return!1;o=t.to}else if(o=jd(n.doc,t.to,1),o==null)return!1;return e&&e(n.tr.join(o).scrollIntoView()),!0},iU=(n,e)=>{let{$from:t,$to:o}=n.selection,r=t.blockRange(o),i=r&&Ps(r);return i==null?!1:(e&&e(n.tr.lift(r,i).scrollIntoView()),!0)},xE=(n,e)=>{let{$head:t,$anchor:o}=n.selection;return!t.parent.type.spec.code||!t.sameParent(o)?!1:(e&&e(n.tr.insertText(`
|
|
235
|
+
`).scrollIntoView()),!0)};function Ig(n){for(let e=0;e<n.edgeCount;e++){let{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const sU=(n,e)=>{let{$head:t,$anchor:o}=n.selection;if(!t.parent.type.spec.code||!t.sameParent(o))return!1;let r=t.node(-1),i=t.indexAfter(-1),s=Ig(r.contentMatchAt(i));if(!s||!r.canReplaceWith(i,i,s))return!1;if(e){let l=t.after(),a=n.tr.replaceWith(l,l,s.createAndFill());a.setSelection(it.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},CE=(n,e)=>{let t=n.selection,{$from:o,$to:r}=t;if(t instanceof di||o.parent.inlineContent||r.parent.inlineContent)return!1;let i=Ig(r.parent.contentMatchAt(r.indexAfter()));if(!i||!i.isTextblock)return!1;if(e){let s=(!o.parentOffset&&r.index()<r.parent.childCount?o:r).pos,l=n.tr.insert(s,i.createAndFill());l.setSelection(Zo.create(l.doc,s+1)),e(l.scrollIntoView())}return!0},SE=(n,e)=>{let{$cursor:t}=n.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let i=t.before();if(Yo(n.doc,i))return e&&e(n.tr.split(i).scrollIntoView()),!0}let o=t.blockRange(),r=o&&Ps(o);return r==null?!1:(e&&e(n.tr.lift(o,r).scrollIntoView()),!0)};function lU(n){return(e,t)=>{let{$from:o,$to:r}=e.selection;if(e.selection instanceof ot&&e.selection.node.isBlock)return!o.parentOffset||!Yo(e.doc,o.pos)?!1:(t&&t(e.tr.split(o.pos).scrollIntoView()),!0);if(!o.depth)return!1;let i=[],s,l,a=!1,u=!1;for(let h=o.depth;;h--)if(o.node(h).isBlock){a=o.end(h)==o.pos+(o.depth-h),u=o.start(h)==o.pos-(o.depth-h),l=Ig(o.node(h-1).contentMatchAt(o.indexAfter(h-1))),i.unshift(a&&l?{type:l}:null),s=h;break}else{if(h==1)return!1;i.unshift(null)}let d=e.tr;(e.selection instanceof Zo||e.selection instanceof di)&&d.deleteSelection();let f=d.mapping.map(o.pos),p=Yo(d.doc,f,i.length,i);if(p||(i[0]=l?{type:l}:null,p=Yo(d.doc,f,i.length,i)),!p)return!1;if(d.split(f,i.length,i),!a&&u&&o.node(s).type!=l){let h=d.mapping.map(o.before(s)),m=d.doc.resolve(h);l&&o.node(s-1).canReplaceWith(m.index(),m.index()+1,l)&&d.setNodeMarkup(d.mapping.map(o.before(s)),l)}return t&&t(d.scrollIntoView()),!0}}const aU=lU(),cU=(n,e)=>{let{$from:t,to:o}=n.selection,r,i=t.sharedDepth(o);return i==0?!1:(r=t.before(i),e&&e(n.tr.setSelection(ot.create(n.doc,r))),!0)};function uU(n,e,t){let o=e.nodeBefore,r=e.nodeAfter,i=e.index();return!o||!r||!o.type.compatibleContent(r.type)?!1:!o.content.size&&e.parent.canReplace(i-1,i)?(t&&t(n.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(i,i+1)||!(r.isTextblock||Hr(n.doc,e.pos))?!1:(t&&t(n.tr.join(e.pos).scrollIntoView()),!0)}function EE(n,e,t,o){let r=e.nodeBefore,i=e.nodeAfter,s,l,a=r.type.spec.isolating||i.type.spec.isolating;if(!a&&uU(n,e,t))return!0;let u=!a&&e.parent.canReplace(e.index(),e.index()+1);if(u&&(s=(l=r.contentMatchAt(r.childCount)).findWrapping(i.type))&&l.matchType(s[0]||i.type).validEnd){if(t){let h=e.pos+i.nodeSize,m=J.empty;for(let b=s.length-1;b>=0;b--)m=J.from(s[b].create(null,m));m=J.from(r.copy(m));let g=n.tr.step(new pn(e.pos-1,h,e.pos,h,new le(m,1,0),s.length,!0)),y=g.doc.resolve(h+2*s.length);y.nodeAfter&&y.nodeAfter.type==r.type&&Hr(g.doc,y.pos)&&g.join(y.pos),t(g.scrollIntoView())}return!0}let d=i.type.spec.isolating||o>0&&a?null:it.findFrom(e,1),f=d&&d.$from.blockRange(d.$to),p=f&&Ps(f);if(p!=null&&p>=e.depth)return t&&t(n.tr.lift(f,p).scrollIntoView()),!0;if(u&&As(i,"start",!0)&&As(r,"end")){let h=r,m=[];for(;m.push(h),!h.isTextblock;)h=h.lastChild;let g=i,y=1;for(;!g.isTextblock;g=g.firstChild)y++;if(h.canReplace(h.childCount,h.childCount,g.content)){if(t){let b=J.empty;for(let w=m.length-1;w>=0;w--)b=J.from(m[w].copy(b));let v=n.tr.step(new pn(e.pos-m.length,e.pos+i.nodeSize,e.pos+y,e.pos+i.nodeSize-y,new le(b,m.length,0),0,!0));t(v.scrollIntoView())}return!0}}return!1}function ME(n){return function(e,t){let o=e.selection,r=n<0?o.$from:o.$to,i=r.depth;for(;r.node(i).isInline;){if(!i)return!1;i--}return r.node(i).isTextblock?(t&&t(e.tr.setSelection(Zo.create(e.doc,n<0?r.start(i):r.end(i)))),!0):!1}}const dU=ME(-1),fU=ME(1);function pU(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i),l=s&&Bg(s,n,e);return l?(o&&o(t.tr.wrap(s,l).scrollIntoView()),!0):!1}}function dk(n,e=null){return function(t,o){let r=!1;for(let i=0;i<t.selection.ranges.length&&!r;i++){let{$from:{pos:s},$to:{pos:l}}=t.selection.ranges[i];t.doc.nodesBetween(s,l,(a,u)=>{if(r)return!1;if(!(!a.isTextblock||a.hasMarkup(n,e)))if(a.type==n)r=!0;else{let d=t.doc.resolve(u),f=d.index();r=d.parent.canReplaceWith(f,f+1,n)}})}if(!r)return!1;if(o){let i=t.tr;for(let s=0;s<t.selection.ranges.length;s++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[s];i.setBlockType(l,a,n,e)}o(i.scrollIntoView())}return!0}}function Lg(...n){return function(e,t,o){for(let r=0;r<n.length;r++)if(n[r](e,t,o))return!0;return!1}}Lg(Rg,gE,bE);Lg(Rg,kE,wE);Lg(xE,CE,SE,aU);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function hU(n,e=null){return function(t,o){let{$from:r,$to:i}=t.selection,s=r.blockRange(i);if(!s)return!1;let l=o?t.tr:null;return mU(l,s,n,e)?(o&&o(l.scrollIntoView()),!0):!1}}function mU(n,e,t,o=null){let r=!1,i=e,s=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=s.resolve(e.start-2);i=new zu(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new zu(e.$from,s.resolve(e.$to.end(e.depth)),e.depth)),r=!0}let l=Bg(i,t,o,e);return l?(n&&gU(n,e,l,r,t),!0):!1}function gU(n,e,t,o,r){let i=J.empty;for(let d=t.length-1;d>=0;d--)i=J.from(t[d].type.create(t[d].attrs,i));n.step(new pn(e.start-(o?2:0),e.end,e.start,e.end,new le(i,0,0),t.length,!0));let s=0;for(let d=0;d<t.length;d++)t[d].type==r&&(s=d+1);let l=t.length-s,a=e.start+t.length-(o?2:0),u=e.parent;for(let d=e.startIndex,f=e.endIndex,p=!0;d<f;d++,p=!1)!p&&Yo(n.doc,a,l)&&(n.split(a,l),a+=2*l),a+=u.child(d).nodeSize;return n}function yU(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,s=>s.childCount>0&&s.firstChild.type==n);return i?t?o.node(i.depth-1).type==n?bU(e,t,n,i):vU(e,t,i):!0:!1}}function bU(n,e,t,o){let r=n.tr,i=o.end,s=o.$to.end(o.depth);i<s&&(r.step(new pn(i-1,s,i,s,new le(J.from(t.create(null,o.parent.copy())),1,0),1,!0)),o=new zu(r.doc.resolve(o.$from.pos),r.doc.resolve(s),o.depth));const l=Ps(o);if(l==null)return!1;r.lift(o,l);let a=r.doc.resolve(r.mapping.map(i,-1)-1);return Hr(r.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&r.join(a.pos),e(r.scrollIntoView()),!0}function vU(n,e,t){let o=n.tr,r=t.parent;for(let h=t.end,m=t.endIndex-1,g=t.startIndex;m>g;m--)h-=r.child(m).nodeSize,o.delete(h-1,h+1);let i=o.doc.resolve(t.start),s=i.nodeAfter;if(o.mapping.map(t.end)!=t.start+i.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==r.childCount,u=i.node(-1),d=i.index(-1);if(!u.canReplace(d+(l?0:1),d+1,s.content.append(a?J.empty:J.from(r))))return!1;let f=i.pos,p=f+s.nodeSize;return o.step(new pn(f-(l?1:0),p+(a?1:0),f+1,p-1,new le((l?J.empty:J.from(r.copy(J.empty))).append(a?J.empty:J.from(r.copy(J.empty))),l?0:1,a?0:1),l?0:1)),e(o.scrollIntoView()),!0}function kU(n){return function(e,t){let{$from:o,$to:r}=e.selection,i=o.blockRange(r,u=>u.childCount>0&&u.firstChild.type==n);if(!i)return!1;let s=i.startIndex;if(s==0)return!1;let l=i.parent,a=l.child(s-1);if(a.type!=n)return!1;if(t){let u=a.lastChild&&a.lastChild.type==l.type,d=J.from(u?n.create():null),f=new le(J.from(n.create(null,J.from(l.type.create(null,d)))),u?3:1,0),p=i.start,h=i.end;t(e.tr.step(new pn(p-(u?3:1),h,p,h,f,1,!0)).scrollIntoView())}return!0}}var wU=Object.defineProperty,Pg=(n,e)=>{for(var t in e)wU(n,t,{get:e[t],enumerable:!0})};function TE(n){const{state:e,transaction:t}=n;let{selection:o}=t,{doc:r}=t,{storedMarks:i}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return i},get selection(){return o},get doc(){return r},get tr(){return o=t.selection,r=t.doc,i=t.storedMarks,t}}}var xU=class{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(){const{rawCommands:e,editor:t,state:o}=this,{view:r}=t,{tr:i}=o,s=this.buildProps(i);return Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...u)=>{const d=a(...u)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&r.dispatch(i),d}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,l=[],a=!!e,u=e||i.tr,d=()=>(!a&&t&&!u.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(u),l.every(p=>p===!0)),f={...Object.fromEntries(Object.entries(o).map(([p,h])=>[p,(...m)=>{const g=this.buildProps(u,t),y=h(...m)(g);return l.push(y),f}])),run:d};return f}createCan(e){const{rawCommands:t,state:o}=this,r=!1,i=e||o.tr,s=this.buildProps(i,r);return{...Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...u)=>a(...u)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,r)}}buildProps(e,t=!0){const{rawCommands:o,editor:r,state:i}=this,{view:s}=r,l={tr:e,editor:r,view:s,state:TE({state:i,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(o).map(([a,u])=>[a,(...d)=>u(...d)(l)]))}};return l}},NE={};Pg(NE,{blur:()=>CU,clearContent:()=>SU,clearNodes:()=>EU,command:()=>MU,createParagraphNear:()=>TU,cut:()=>NU,deleteCurrentNode:()=>AU,deleteNode:()=>OU,deleteRange:()=>$U,deleteSelection:()=>BU,enter:()=>RU,exitCode:()=>_U,extendMarkRange:()=>IU,first:()=>LU,focus:()=>zU,forEach:()=>FU,insertContent:()=>HU,insertContentAt:()=>WU,joinBackward:()=>JU,joinDown:()=>KU,joinForward:()=>GU,joinItemBackward:()=>XU,joinItemForward:()=>YU,joinTextblockBackward:()=>QU,joinTextblockForward:()=>ZU,joinUp:()=>qU,keyboardShortcut:()=>tW,lift:()=>nW,liftEmptyBlock:()=>oW,liftListItem:()=>rW,newlineInCode:()=>iW,resetAttributes:()=>sW,scrollIntoView:()=>lW,selectAll:()=>aW,selectNodeBackward:()=>cW,selectNodeForward:()=>uW,selectParentNode:()=>dW,selectTextblockEnd:()=>fW,selectTextblockStart:()=>pW,setContent:()=>mW,setMark:()=>BW,setMeta:()=>RW,setNode:()=>_W,setNodeSelection:()=>DW,setTextDirection:()=>IW,setTextSelection:()=>LW,sinkListItem:()=>PW,splitBlock:()=>VW,splitListItem:()=>zW,toggleList:()=>FW,toggleMark:()=>HW,toggleNode:()=>jW,toggleWrap:()=>UW,undoInputRule:()=>WW,unsetAllMarks:()=>qW,unsetMark:()=>KW,unsetTextDirection:()=>JW,updateAttributes:()=>GW,wrapIn:()=>XW,wrapInList:()=>YW});var CU=()=>({editor:n,view:e})=>(requestAnimationFrame(()=>{var t;n.isDestroyed||(e.dom.blur(),(t=window==null?void 0:window.getSelection())==null||t.removeAllRanges())}),!0),SU=(n=!0)=>({commands:e})=>e.setContent("",{emitUpdate:n}),EU=()=>({state:n,tr:e,dispatch:t})=>{const{selection:o}=e,{ranges:r}=o;return t&&r.forEach(({$from:i,$to:s})=>{n.doc.nodesBetween(i.pos,s.pos,(l,a)=>{if(l.type.isText)return;const{doc:u,mapping:d}=e,f=u.resolve(d.map(a)),p=u.resolve(d.map(a+l.nodeSize)),h=f.blockRange(p);if(!h)return;const m=Ps(h);if(l.type.isTextblock){const{defaultType:g}=f.parent.contentMatchAt(f.index());e.setNodeMarkup(h.start,g)}(m||m===0)&&e.lift(h,m)})}),!0},MU=n=>e=>n(e),TU=()=>({state:n,dispatch:e})=>CE(n,e),NU=(n,e)=>({editor:t,tr:o})=>{const{state:r}=t,i=r.doc.slice(n.from,n.to);o.deleteRange(n.from,n.to);const s=o.mapping.map(e);return o.insert(s,i.content),o.setSelection(new q(o.doc.resolve(Math.max(s-1,0)))),!0},AU=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,o=t.$anchor.node();if(o.content.size>0)return!1;const r=n.selection.$anchor;for(let i=r.depth;i>0;i-=1)if(r.node(i).type===o.type){if(e){const s=r.before(i),l=r.after(i);n.delete(s,l).scrollIntoView()}return!0}return!1};function Et(n,e){if(typeof n=="string"){if(!e.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return e.nodes[n]}return n}var OU=n=>({tr:e,state:t,dispatch:o})=>{const r=Et(n,t.schema),i=e.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===r){if(o){const l=i.before(s),a=i.after(s);e.delete(l,a).scrollIntoView()}return!0}return!1},$U=n=>({tr:e,dispatch:t})=>{const{from:o,to:r}=n;return t&&e.delete(o,r),!0},BU=()=>({state:n,dispatch:e})=>Rg(n,e),RU=()=>({commands:n})=>n.keyboardShortcut("Enter"),_U=()=>({state:n,dispatch:e})=>sU(n,e);function DU(n){return Object.prototype.toString.call(n)==="[object RegExp]"}function Hu(n,e,t={strict:!0}){const o=Object.keys(e);return o.length?o.every(r=>t.strict?e[r]===n[r]:DU(e[r])?e[r].test(n[r]):e[r]===n[r]):!0}function AE(n,e,t={}){return n.find(o=>o.type===e&&Hu(Object.fromEntries(Object.keys(t).map(r=>[r,o.attrs[r]])),t))}function fk(n,e,t={}){return!!AE(n,e,t)}function OE(n,e,t){var o;if(!n||!e)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(u=>u.type===e))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(u=>u.type===e)||(t=t||((o=r.node.marks[0])==null?void 0:o.attrs),!AE([...r.node.marks],e,t)))return;let i=r.index,s=n.start()+r.offset,l=i+1,a=s+r.node.nodeSize;for(;i>0&&fk([...n.parent.child(i-1).marks],e,t);)i-=1,s-=n.parent.child(i).nodeSize;for(;l<n.parent.childCount&&fk([...n.parent.child(l).marks],e,t);)a+=n.parent.child(l).nodeSize,l+=1;return{from:s,to:a}}function jr(n,e){if(typeof n=="string"){if(!e.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return e.marks[n]}return n}var IU=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const i=jr(n,o.schema),{doc:s,selection:l}=t,{$from:a,from:u,to:d}=l;if(r){const f=OE(a,i,e);if(f&&f.from<=u&&f.to>=d){const p=q.create(s,f.from,f.to);t.setSelection(p)}}return!0},LU=n=>e=>{const t=typeof n=="function"?n(e):n;for(let o=0;o<t.length;o+=1)if(t[o](e))return!0;return!1};function $E(n){return n instanceof q}function Zr(n=0,e=0,t=0){return Math.min(Math.max(n,e),t)}function PU(n,e=null){if(!e)return null;const t=se.atStart(n),o=se.atEnd(n);if(e==="start"||e===!0)return t;if(e==="end")return o;const r=t.from,i=o.to;return e==="all"?q.create(n,Zr(0,r,i),Zr(n.content.size,r,i)):q.create(n,Zr(e,r,i),Zr(e,r,i))}function pk(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function ju(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function VU(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var zU=(n=null,e={})=>({editor:t,view:o,tr:r,dispatch:i})=>{e={scrollIntoView:!0,...e};const s=()=>{(ju()||pk())&&o.dom.focus(),VU()&&!ju()&&!pk()&&o.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(o.focus(),e!=null&&e.scrollIntoView&&t.commands.scrollIntoView())})};if(o.hasFocus()&&n===null||n===!1)return!0;if(i&&n===null&&!$E(t.state.selection))return s(),!0;const l=PU(r.doc,n)||t.state.selection,a=t.state.selection.eq(l);return i&&(a||r.setSelection(l),a&&r.storedMarks&&r.setStoredMarks(r.storedMarks),s()),!0},FU=(n,e)=>t=>n.every((o,r)=>e(o,{...t,index:r})),HU=(n,e)=>({tr:t,commands:o})=>o.insertContentAt({from:t.selection.from,to:t.selection.to},n,e),BE=n=>{const e=n.childNodes;for(let t=e.length-1;t>=0;t-=1){const o=e[t];o.nodeType===3&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?n.removeChild(o):o.nodeType===1&&BE(o)}return n};function tc(n){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${n}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return BE(t)}function oa(n,e,t){if(n instanceof ui||n instanceof J)return n;t={slice:!0,parseOptions:{},...t};const o=typeof n=="object"&&n!==null,r=typeof n=="string";if(o)try{if(Array.isArray(n)&&n.length>0)return J.fromArray(n.map(s=>e.nodeFromJSON(s)));const i=e.nodeFromJSON(n);return t.errorOnInvalidContent&&i.check(),i}catch(i){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:i});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",i),oa("",e,t)}if(r){if(t.errorOnInvalidContent){let s=!1,l="";const a=new x3({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:u=>(s=!0,l=typeof u=="string"?u:u.outerHTML,null)}]}})});if(t.slice?Uf.fromSchema(a).parseSlice(tc(n),t.parseOptions):Uf.fromSchema(a).parse(tc(n),t.parseOptions),t.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const i=Uf.fromSchema(e);return t.slice?i.parseSlice(tc(n),t.parseOptions).content:i.parse(tc(n),t.parseOptions)}return oa("",e,t)}function jU(n,e,t){const o=n.steps.length-1;if(o<e)return;const r=n.steps[o];if(!(r instanceof wt||r instanceof pn))return;const i=n.mapping.maps[o];let s=0;i.forEach((l,a,u,d)=>{s===0&&(s=d)}),n.setSelection(se.near(n.doc.resolve(s),t))}var UU=n=>!("type"in n),WU=(n,e,t)=>({tr:o,dispatch:r,editor:i})=>{var s;if(r){t={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const a=g=>{i.emit("contentError",{editor:i,error:g,disableCollaboration:()=>{"collaboration"in i.storage&&typeof i.storage.collaboration=="object"&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},u={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{oa(e,i.schema,{parseOptions:u,errorOnInvalidContent:!0})}catch(g){a(g)}try{l=oa(e,i.schema,{parseOptions:u,errorOnInvalidContent:(s=t.errorOnInvalidContent)!=null?s:i.options.enableContentCheck})}catch(g){return a(g),!1}let{from:d,to:f}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},p=!0,h=!0;if((UU(l)?l:[l]).forEach(g=>{g.check(),p=p?g.isText&&g.marks.length===0:!1,h=h?g.isBlock:!1}),d===f&&h){const{parent:g}=o.doc.resolve(d);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(d-=1,f+=1)}let m;if(p){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof J){let g="";e.forEach(y=>{y.text&&(g+=y.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;o.insertText(m,d,f)}else{m=l;const g=o.doc.resolve(d),y=g.node(),b=g.parentOffset===0,v=y.isText||y.isTextblock,w=y.content.size>0;b&&v&&w&&(d=Math.max(0,d-1)),o.replaceWith(d,f,m)}t.updateSelection&&jU(o,o.steps.length-1,-1),t.applyInputRules&&o.setMeta("applyInputRules",{from:d,text:m}),t.applyPasteRules&&o.setMeta("applyPasteRules",{from:d,text:m})}return!0},qU=()=>({state:n,dispatch:e})=>oU(n,e),KU=()=>({state:n,dispatch:e})=>rU(n,e),JU=()=>({state:n,dispatch:e})=>gE(n,e),GU=()=>({state:n,dispatch:e})=>kE(n,e),XU=()=>({state:n,dispatch:e,tr:t})=>{try{const o=jd(n.doc,n.selection.$from.pos,-1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},YU=()=>({state:n,dispatch:e,tr:t})=>{try{const o=jd(n.doc,n.selection.$from.pos,1);return o==null?!1:(t.join(o,2),e&&e(t),!0)}catch{return!1}},QU=()=>({state:n,dispatch:e})=>tU(n,e),ZU=()=>({state:n,dispatch:e})=>nU(n,e);function RE(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function eW(n){const e=n.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))ju()||RE()?s=!0:r=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return o&&(t=`Alt-${t}`),r&&(t=`Ctrl-${t}`),s&&(t=`Meta-${t}`),i&&(t=`Shift-${t}`),t}var tW=n=>({editor:e,view:t,tr:o,dispatch:r})=>{const i=eW(n).split(/-(?!$)/),s=i.find(u=>!["Alt","Ctrl","Meta","Shift"].includes(u)),l=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",u=>u(t,l))});return a==null||a.steps.forEach(u=>{const d=u.map(o.mapping);d&&r&&o.maybeStep(d)}),!0};function Os(n,e,t={}){const{from:o,to:r,empty:i}=n.selection,s=e?Et(e,n.schema):null,l=[];n.doc.nodesBetween(o,r,(d,f)=>{if(d.isText)return;const p=Math.max(o,f),h=Math.min(r,f+d.nodeSize);l.push({node:d,from:p,to:h})});const a=r-o,u=l.filter(d=>s?s.name===d.node.type.name:!0).filter(d=>Hu(d.node.attrs,t,{strict:!1}));return i?!!u.length:u.reduce((d,f)=>d+f.to-f.from,0)>=a}var nW=(n,e={})=>({state:t,dispatch:o})=>{const r=Et(n,t.schema);return Os(t,r,e)?iU(t,o):!1},oW=()=>({state:n,dispatch:e})=>SE(n,e),rW=n=>({state:e,dispatch:t})=>{const o=Et(n,e.schema);return yU(o)(e,t)},iW=()=>({state:n,dispatch:e})=>xE(n,e);function _E(n,e){return e.nodes[n]?"node":e.marks[n]?"mark":null}function hk(n,e){const t=typeof e=="string"?[e]:e;return Object.keys(n).reduce((o,r)=>(t.includes(r)||(o[r]=n[r]),o),{})}var sW=(n,e)=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=_E(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=Et(n,o.schema)),l==="mark"&&(s=jr(n,o.schema));let a=!1;return t.selection.ranges.forEach(u=>{o.doc.nodesBetween(u.$from.pos,u.$to.pos,(d,f)=>{i&&i===d.type&&(a=!0,r&&t.setNodeMarkup(f,void 0,hk(d.attrs,e))),s&&d.marks.length&&d.marks.forEach(p=>{s===p.type&&(a=!0,r&&t.addMark(f,f+d.nodeSize,s.create(hk(p.attrs,e))))})})}),a},lW=()=>({tr:n,dispatch:e})=>(e&&n.scrollIntoView(),!0),aW=()=>({tr:n,dispatch:e})=>{if(e){const t=new on(n.doc);n.setSelection(t)}return!0},cW=()=>({state:n,dispatch:e})=>bE(n,e),uW=()=>({state:n,dispatch:e})=>wE(n,e),dW=()=>({state:n,dispatch:e})=>cU(n,e),fW=()=>({state:n,dispatch:e})=>fU(n,e),pW=()=>({state:n,dispatch:e})=>dU(n,e);function hW(n,e,t={},o={}){return oa(n,e,{slice:!1,parseOptions:t,errorOnInvalidContent:o.errorOnInvalidContent})}var mW=(n,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:o={}}={})=>({editor:r,tr:i,dispatch:s,commands:l})=>{const{doc:a}=i;if(o.preserveWhitespace!=="full"){const u=hW(n,r.schema,o,{errorOnInvalidContent:e??r.options.enableContentCheck});return s&&i.replaceWith(0,a.content.size,u).setMeta("preventUpdate",!t),!0}return s&&i.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},n,{parseOptions:o,errorOnInvalidContent:e??r.options.enableContentCheck})};function gW(n,e){const t=jr(e,n.schema),{from:o,to:r,empty:i}=n.selection,s=[];i?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(o,r,a=>{s.push(...a.marks)});const l=s.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function yW(n,e){const t=new Y3(n);return e.forEach(o=>{o.steps.forEach(r=>{t.step(r)})}),t}function bW(n){for(let e=0;e<n.edgeCount;e+=1){const{type:t}=n.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function vW(n,e){for(let t=n.depth;t>0;t-=1){const o=n.node(t);if(e(o))return{pos:t>0?n.before(t):0,start:n.start(t),depth:t,node:o}}}function Wd(n){return e=>vW(e.$from,n)}function ra(n,e,t){return n.config[e]===void 0&&n.parent?ra(n.parent,e,t):typeof n.config[e]=="function"?n.config[e].bind({...t,parent:n.parent?ra(n.parent,e,t):null}):n.config[e]}function kW(n){return typeof n=="function"}function Uu(n,e=void 0,...t){return kW(n)?e?n.bind(e)(...t):n(...t):n}function DE(n){const e=n.filter(r=>r.type==="extension"),t=n.filter(r=>r.type==="node"),o=n.filter(r=>r.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:o}}function Mi(...n){return n.filter(e=>!!e).reduce((e,t)=>{const o={...e};return Object.entries(t).forEach(([r,i])=>{if(!o[r]){o[r]=i;return}if(r==="class"){const s=i?String(i).split(" "):[],l=o[r]?o[r].split(" "):[],a=s.filter(u=>!l.includes(u));o[r]=[...l,...a].join(" ")}else if(r==="style"){const s=i?i.split(";").map(u=>u.trim()).filter(Boolean):[],l=o[r]?o[r].split(";").map(u=>u.trim()).filter(Boolean):[],a=new Map;l.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());a.set(d,f)}),s.forEach(u=>{const[d,f]=u.split(":").map(p=>p.trim());a.set(d,f)}),o[r]=Array.from(a.entries()).map(([u,d])=>`${u}: ${d}`).join("; ")}else o[r]=i}),o},{})}function wW(n,e){return e.filter(t=>t.type===n.type.name).filter(t=>t.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(n.attrs)||{}:{[t.name]:n.attrs[t.name]}).reduce((t,o)=>Mi(t,o),{})}function xW(n,e,t){const{from:o,to:r}=e,{blockSeparator:i=`
|
|
236
|
+
|
|
237
|
+
`,textSerializers:s={}}=t||{};let l="";return n.nodesBetween(o,r,(a,u,d,f)=>{var p;a.isBlock&&u>o&&(l+=i);const h=s==null?void 0:s[a.type.name];if(h)return d&&(l+=h({node:a,pos:u,parent:d,index:f,range:e})),!1;a.isText&&(l+=(p=a==null?void 0:a.text)==null?void 0:p.slice(Math.max(o,u)-u,r-u))}),l}function CW(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function SW(n,e=JSON.stringify){const t={};return n.filter(o=>{const r=e(o);return Object.prototype.hasOwnProperty.call(t,r)?!1:t[r]=!0})}function EW(n){const e=SW(n);return e.length===1?e:e.filter((t,o)=>!e.filter((r,i)=>i!==o).some(r=>t.oldRange.from>=r.oldRange.from&&t.oldRange.to<=r.oldRange.to&&t.newRange.from>=r.newRange.from&&t.newRange.to<=r.newRange.to))}function MW(n){const{mapping:e,steps:t}=n,o=[];return e.maps.forEach((r,i)=>{const s=[];if(r.ranges.length)r.forEach((l,a)=>{s.push({from:l,to:a})});else{const{from:l,to:a}=t[i];if(l===void 0||a===void 0)return;s.push({from:l,to:a})}s.forEach(({from:l,to:a})=>{const u=e.slice(i).map(l,-1),d=e.slice(i).map(a),f=e.invert().map(u,-1),p=e.invert().map(d);o.push({oldRange:{from:f,to:p},newRange:{from:u,to:d}})})}),EW(o)}var TW=(n,e,t,o=20)=>{const r=n.doc.resolve(t);let i=o,s=null;for(;i>0&&s===null;){const l=r.node(i);(l==null?void 0:l.type.name)===e?s=l:i-=1}return[s,i]};function Nc(n,e,t){return Object.fromEntries(Object.entries(t).filter(([o])=>{const r=n.find(i=>i.type===e&&i.name===o);return r?r.attribute.keepOnSplit:!1}))}function NW(n,e,t={}){const{empty:o,ranges:r}=n.selection,i=e?jr(e,n.schema):null;if(o)return!!(n.storedMarks||n.selection.$from.marks()).filter(d=>i?i.name===d.type.name:!0).find(d=>Hu(d.attrs,t,{strict:!1}));let s=0;const l=[];if(r.forEach(({$from:d,$to:f})=>{const p=d.pos,h=f.pos;n.doc.nodesBetween(p,h,(m,g)=>{if(!m.isText&&!m.marks.length)return;const y=Math.max(p,g),b=Math.min(h,g+m.nodeSize),v=b-y;s+=v,l.push(...m.marks.map(w=>({mark:w,from:y,to:b})))})}),s===0)return!1;const a=l.filter(d=>i?i.name===d.mark.type.name:!0).filter(d=>Hu(d.mark.attrs,t,{strict:!1})).reduce((d,f)=>d+f.to-f.from,0),u=l.filter(d=>i?d.mark.type!==i&&d.mark.type.excludes(i):!0).reduce((d,f)=>d+f.to-f.from,0);return(a>0?a+u:a)>=s}var AW=(n,e)=>{const{$from:t,$to:o,$anchor:r}=n.selection;if(e){const i=Wd(l=>l.type.name===e)(n.selection);if(!i)return!1;const s=n.doc.resolve(i.pos+1);return r.pos+1===s.end()}return!(o.parentOffset<o.parent.nodeSize-2||t.pos!==o.pos)},OW=n=>{const{$from:e,$to:t}=n.selection;return!(e.parentOffset>0||e.pos!==t.pos)};function mk(n,e){const{nodeExtensions:t}=DE(e),o=t.find(s=>s.name===n);if(!o)return!1;const r={name:o.name,options:o.options,storage:o.storage},i=Uu(ra(o,"group",r));return typeof i!="string"?!1:i.split(" ").includes("list")}function IE(n,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var o;if(t){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((o=n.text)!=null?o:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(e){let r=!0;return n.content.forEach(i=>{r!==!1&&(IE(i,{ignoreWhitespace:t,checkChildren:e})||(r=!1))}),r}return!1}function $W(n,e,t){var o;const{selection:r}=e;let i=null;if($E(r)&&(i=r.$cursor),i){const l=(o=n.storedMarks)!=null?o:i.marks();return i.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(a=>a.type.excludes(t)))}const{ranges:s}=r;return s.some(({$from:l,$to:a})=>{let u=l.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(t):!1;return n.doc.nodesBetween(l.pos,a.pos,(d,f,p)=>{if(u)return!1;if(d.isInline){const h=!p||p.type.allowsMarkType(t),m=!!t.isInSet(d.marks)||!d.marks.some(g=>g.type.excludes(t));u=h&&m}return!u}),u})}var BW=(n,e={})=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=t,{empty:s,ranges:l}=i,a=jr(n,o.schema);if(r)if(s){const u=gW(o,a);t.addStoredMark(a.create({...u,...e}))}else l.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;o.doc.nodesBetween(d,f,(p,h)=>{const m=Math.max(h,d),g=Math.min(h+p.nodeSize,f);p.marks.find(y=>y.type===a)?p.marks.forEach(y=>{a===y.type&&t.addMark(m,g,a.create({...y.attrs,...e}))}):t.addMark(m,g,a.create(e))})});return $W(o,t,a)},RW=(n,e)=>({tr:t})=>(t.setMeta(n,e),!0),_W=(n,e={})=>({state:t,dispatch:o,chain:r})=>{const i=Et(n,t.schema);let s;return t.selection.$anchor.sameParent(t.selection.$head)&&(s=t.selection.$anchor.parent.attrs),i.isTextblock?r().command(({commands:l})=>dk(i,{...s,...e})(t)?!0:l.clearNodes()).command(({state:l})=>dk(i,{...s,...e})(l,o)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},DW=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,r=Zr(n,0,o.content.size),i=Q.create(o,r);e.setSelection(i)}return!0},IW=(n,e)=>({tr:t,state:o,dispatch:r})=>{const{selection:i}=o;let s,l;return typeof e=="number"?(s=e,l=e):e&&"from"in e&&"to"in e?(s=e.from,l=e.to):(s=i.from,l=i.to),r&&t.doc.nodesBetween(s,l,(a,u)=>{a.isText||t.setNodeMarkup(u,void 0,{...a.attrs,dir:n})}),!0},LW=n=>({tr:e,dispatch:t})=>{if(t){const{doc:o}=e,{from:r,to:i}=typeof n=="number"?{from:n,to:n}:n,s=q.atStart(o).from,l=q.atEnd(o).to,a=Zr(r,s,l),u=Zr(i,s,l),d=q.create(o,a,u);e.setSelection(d)}return!0},PW=n=>({state:e,dispatch:t})=>{const o=Et(n,e.schema);return kU(o)(e,t)};function gk(n,e){const t=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(t){const o=t.filter(r=>e==null?void 0:e.includes(r.type.name));n.tr.ensureMarks(o)}}var VW=({keepMarks:n=!0}={})=>({tr:e,state:t,dispatch:o,editor:r})=>{const{selection:i,doc:s}=e,{$from:l,$to:a}=i,u=r.extensionManager.attributes,d=Nc(u,l.node().type.name,l.node().attrs);if(i instanceof Q&&i.node.isBlock)return!l.parentOffset||!Yo(s,l.pos)?!1:(o&&(n&&gk(t,r.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const f=a.parentOffset===a.parent.content.size,p=l.depth===0?void 0:bW(l.node(-1).contentMatchAt(l.indexAfter(-1)));let h=f&&p?[{type:p,attrs:d}]:void 0,m=Yo(e.doc,e.mapping.map(l.pos),1,h);if(!h&&!m&&Yo(e.doc,e.mapping.map(l.pos),1,p?[{type:p}]:void 0)&&(m=!0,h=p?[{type:p,attrs:d}]:void 0),o){if(m&&(i instanceof q&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,h),p&&!f&&!l.parentOffset&&l.parent.type!==p)){const g=e.mapping.map(l.before()),y=e.doc.resolve(g);l.node(-1).canReplaceWith(y.index(),y.index()+1,p)&&e.setNodeMarkup(e.mapping.map(l.before()),p)}n&&gk(t,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},zW=(n,e={})=>({tr:t,state:o,dispatch:r,editor:i})=>{var s;const l=Et(n,o.schema),{$from:a,$to:u}=o.selection,d=o.selection.node;if(d&&d.isBlock||a.depth<2||!a.sameParent(u))return!1;const f=a.node(-1);if(f.type!==l)return!1;const p=i.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(r){let b=J.empty;const v=a.index(-1)?1:a.index(-2)?2:3;for(let M=a.depth-v;M>=a.depth-3;M-=1)b=J.from(a.node(M).copy(b));const w=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,k={...Nc(p,a.node().type.name,a.node().attrs),...e},x=((s=l.contentMatch.defaultType)==null?void 0:s.createAndFill(k))||void 0;b=b.append(J.from(l.createAndFill(null,x)||void 0));const C=a.before(a.depth-(v-1));t.replace(C,a.after(-w),new le(b,4-v,0));let S=-1;t.doc.nodesBetween(C,t.doc.content.size,(M,N)=>{if(S>-1)return!1;M.isTextblock&&M.content.size===0&&(S=N+1)}),S>-1&&t.setSelection(q.near(t.doc.resolve(S))),t.scrollIntoView()}return!0}const h=u.pos===a.end()?f.contentMatchAt(0).defaultType:null,m={...Nc(p,f.type.name,f.attrs),...e},g={...Nc(p,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,u.pos);const y=h?[{type:l,attrs:m},{type:h,attrs:g}]:[{type:l,attrs:m}];if(!Yo(t.doc,a.pos,2))return!1;if(r){const{selection:b,storedMarks:v}=o,{splittableMarks:w}=i.extensionManager,k=v||b.$to.parentOffset&&b.$from.marks();if(t.split(a.pos,2,y).scrollIntoView(),!k||!r)return!0;const x=k.filter(C=>w.includes(C.type.name));t.ensureMarks(x)}return!0},Gf=(n,e)=>{const t=Wd(i=>i.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===(r==null?void 0:r.type)&&Hr(n.doc,t.pos)&&n.join(t.pos),!0},Xf=(n,e)=>{const t=Wd(i=>i.type===e)(n.selection);if(!t)return!0;const o=n.doc.resolve(t.start).after(t.depth);if(o===void 0)return!0;const r=n.doc.nodeAt(o);return t.node.type===(r==null?void 0:r.type)&&Hr(n.doc,o)&&n.join(o),!0},FW=(n,e,t,o={})=>({editor:r,tr:i,state:s,dispatch:l,chain:a,commands:u,can:d})=>{const{extensions:f,splittableMarks:p}=r.extensionManager,h=Et(n,s.schema),m=Et(e,s.schema),{selection:g,storedMarks:y}=s,{$from:b,$to:v}=g,w=b.blockRange(v),k=y||g.$to.parentOffset&&g.$from.marks();if(!w)return!1;const x=Wd(C=>mk(C.type.name,f))(g);if(w.depth>=1&&x&&w.depth-x.depth<=1){if(x.node.type===h)return u.liftListItem(m);if(mk(x.node.type.name,f)&&h.validContent(x.node.content)&&l)return a().command(()=>(i.setNodeMarkup(x.pos,h),!0)).command(()=>Gf(i,h)).command(()=>Xf(i,h)).run()}return!t||!k||!l?a().command(()=>d().wrapInList(h,o)?!0:u.clearNodes()).wrapInList(h,o).command(()=>Gf(i,h)).command(()=>Xf(i,h)).run():a().command(()=>{const C=d().wrapInList(h,o),S=k.filter(M=>p.includes(M.type.name));return i.ensureMarks(S),C?!0:u.clearNodes()}).wrapInList(h,o).command(()=>Gf(i,h)).command(()=>Xf(i,h)).run()},HW=(n,e={},t={})=>({state:o,commands:r})=>{const{extendEmptyMarkRange:i=!1}=t,s=jr(n,o.schema);return NW(o,s,e)?r.unsetMark(s,{extendEmptyMarkRange:i}):r.setMark(s,e)},jW=(n,e,t={})=>({state:o,commands:r})=>{const i=Et(n,o.schema),s=Et(e,o.schema),l=Os(o,i,t);let a;return o.selection.$anchor.sameParent(o.selection.$head)&&(a=o.selection.$anchor.parent.attrs),l?r.setNode(s,a):r.setNode(i,{...a,...t})},UW=(n,e={})=>({state:t,commands:o})=>{const r=Et(n,t.schema);return Os(t,r,e)?o.lift(r):o.wrapIn(r,e)},WW=()=>({state:n,dispatch:e})=>{const t=n.plugins;for(let o=0;o<t.length;o+=1){const r=t[o];let i;if(r.spec.isInputRules&&(i=r.getState(n))){if(e){const s=n.tr,l=i.transform;for(let a=l.steps.length-1;a>=0;a-=1)s.step(l.steps[a].invert(l.docs[a]));if(i.text){const a=s.doc.resolve(i.from).marks();s.replaceWith(i.from,i.to,n.schema.text(i.text,a))}else s.delete(i.from,i.to)}return!0}}return!1},qW=()=>({tr:n,dispatch:e})=>{const{selection:t}=n,{empty:o,ranges:r}=t;return o||e&&r.forEach(i=>{n.removeMark(i.$from.pos,i.$to.pos)}),!0},KW=(n,e={})=>({tr:t,state:o,dispatch:r})=>{var i;const{extendEmptyMarkRange:s=!1}=e,{selection:l}=t,a=jr(n,o.schema),{$from:u,empty:d,ranges:f}=l;if(!r)return!0;if(d&&s){let{from:p,to:h}=l;const m=(i=u.marks().find(y=>y.type===a))==null?void 0:i.attrs,g=OE(u,a,m);g&&(p=g.from,h=g.to),t.removeMark(p,h,a)}else f.forEach(p=>{t.removeMark(p.$from.pos,p.$to.pos,a)});return t.removeStoredMark(a),!0},JW=n=>({tr:e,state:t,dispatch:o})=>{const{selection:r}=t;let i,s;return typeof n=="number"?(i=n,s=n):n&&"from"in n&&"to"in n?(i=n.from,s=n.to):(i=r.from,s=r.to),o&&e.doc.nodesBetween(i,s,(l,a)=>{if(l.isText)return;const u={...l.attrs};delete u.dir,e.setNodeMarkup(a,void 0,u)}),!0},GW=(n,e={})=>({tr:t,state:o,dispatch:r})=>{let i=null,s=null;const l=_E(typeof n=="string"?n:n.name,o.schema);if(!l)return!1;l==="node"&&(i=Et(n,o.schema)),l==="mark"&&(s=jr(n,o.schema));let a=!1;return t.selection.ranges.forEach(u=>{const d=u.$from.pos,f=u.$to.pos;let p,h,m,g;t.selection.empty?o.doc.nodesBetween(d,f,(y,b)=>{i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,f),p=b,h=y)}):o.doc.nodesBetween(d,f,(y,b)=>{b<d&&i&&i===y.type&&(a=!0,m=Math.max(b,d),g=Math.min(b+y.nodeSize,f),p=b,h=y),b>=d&&b<=f&&(i&&i===y.type&&(a=!0,r&&t.setNodeMarkup(b,void 0,{...y.attrs,...e})),s&&y.marks.length&&y.marks.forEach(v=>{if(s===v.type&&(a=!0,r)){const w=Math.max(b,d),k=Math.min(b+y.nodeSize,f);t.addMark(w,k,s.create({...v.attrs,...e}))}}))}),h&&(p!==void 0&&r&&t.setNodeMarkup(p,void 0,{...h.attrs,...e}),s&&h.marks.length&&h.marks.forEach(y=>{s===y.type&&r&&t.addMark(m,g,s.create({...y.attrs,...e}))}))}),a},XW=(n,e={})=>({state:t,dispatch:o})=>{const r=Et(n,t.schema);return pU(r,e)(t,o)},YW=(n,e={})=>({state:t,dispatch:o})=>{const r=Et(n,t.schema);return hU(r,e)(t,o)},QW=class{constructor(n){var e;this.find=n.find,this.handler=n.handler,this.undoable=(e=n.undoable)!=null?e:!0}};function ZW(n){return Object.prototype.toString.call(n).slice(8,-1)}function nc(n){return ZW(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function LE(n,e){const t={...n};return nc(n)&&nc(e)&&Object.keys(e).forEach(o=>{nc(e[o])&&nc(n[o])?t[o]=LE(n[o],e[o]):t[o]=e[o]}),t}var PE=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{...Uu(ra(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...Uu(ra(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>LE(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const 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}},e5={};Pg(e5,{ClipboardTextSerializer:()=>t5,Commands:()=>n5,Delete:()=>o5,Drop:()=>r5,Editable:()=>i5,FocusEvents:()=>s5,Keymap:()=>l5,Paste:()=>a5,Tabindex:()=>c5,TextDirection:()=>u5,focusEventsPluginKey:()=>zE});var Hn=class VE extends PE{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new VE(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},t5=Hn.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new ue({key:new ce("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:n}=this,{state:e,schema:t}=n,{doc:o,selection:r}=e,{ranges:i}=r,s=Math.min(...i.map(u=>u.$from.pos)),l=Math.max(...i.map(u=>u.$to.pos)),a=CW(t);return xW(o,{from:s,to:l},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:a})}}})]}}),n5=Hn.create({name:"commands",addCommands(){return{...NE}}}),o5=Hn.create({name:"delete",onUpdate({transaction:n,appendedTransactions:e}){var t,o,r;const i=()=>{var s,l,a,u;if((u=(a=(l=(s=this.editor.options.coreExtensionOptions)==null?void 0:s.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,n))!=null?u:n.getMeta("y-sync$"))return;const d=yW(n.before,[n,...e]);MW(d).forEach(p=>{d.mapping.mapResult(p.oldRange.from).deletedAfter&&d.mapping.mapResult(p.oldRange.to).deletedBefore&&d.before.nodesBetween(p.oldRange.from,p.oldRange.to,(h,m)=>{const g=m+h.nodeSize-2,y=p.oldRange.from<=m&&g<=p.oldRange.to;this.editor.emit("delete",{type:"node",node:h,from:m,to:g,newFrom:d.mapping.map(m),newTo:d.mapping.map(g),deletedRange:p.oldRange,newRange:p.newRange,partial:!y,editor:this.editor,transaction:n,combinedTransform:d})})});const f=d.mapping;d.steps.forEach((p,h)=>{var m,g;if(p instanceof Ls){const y=f.slice(h).map(p.from,-1),b=f.slice(h).map(p.to),v=f.invert().map(y,-1),w=f.invert().map(b),k=(m=d.doc.nodeAt(y-1))==null?void 0:m.marks.some(C=>C.eq(p.mark)),x=(g=d.doc.nodeAt(b))==null?void 0:g.marks.some(C=>C.eq(p.mark));this.editor.emit("delete",{type:"mark",mark:p.mark,from:p.from,to:p.to,deletedRange:{from:v,to:w},newRange:{from:y,to:b},partial:!!(x||k),editor:this.editor,transaction:n,combinedTransform:d})}})};(r=(o=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:o.async)==null||r?setTimeout(i,0):i()}}),r5=Hn.create({name:"drop",addProseMirrorPlugins(){return[new ue({key:new ce("tiptapDrop"),props:{handleDrop:(n,e,t,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:o})}}})]}}),i5=Hn.create({name:"editable",addProseMirrorPlugins(){return[new ue({key:new ce("editable"),props:{editable:()=>this.editor.options.editable}})]}}),zE=new ce("focusEvents"),s5=Hn.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:n}=this;return[new ue({key:zE,props:{handleDOMEvents:{focus:(e,t)=>{n.isFocused=!0;const o=n.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,t)=>{n.isFocused=!1;const o=n.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),l5=Hn.create({name:"keymap",addKeyboardShortcuts(){const n=()=>this.editor.commands.first(({commands:i})=>[()=>i.undoInputRule(),()=>i.command(({tr:s})=>{const{selection:l,doc:a}=s,{empty:u,$anchor:d}=l,{pos:f,parent:p}=d,h=d.parent.isTextblock&&f>0?s.doc.resolve(f-1):d,m=h.parent.type.spec.isolating,g=d.pos-d.parentOffset,y=m&&h.parent.childCount===1?g===d.pos:se.atStart(a).from===f;return!u||!p.type.isTextblock||p.textContent.length||!y||y&&d.parent.type.name==="paragraph"?!1:i.clearNodes()}),()=>i.deleteSelection(),()=>i.joinBackward(),()=>i.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:i})=>[()=>i.deleteSelection(),()=>i.deleteCurrentNode(),()=>i.joinForward(),()=>i.selectNodeForward()]),t={Enter:()=>this.editor.commands.first(({commands:i})=>[()=>i.newlineInCode(),()=>i.createParagraphNear(),()=>i.liftEmptyBlock(),()=>i.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},o={...t},r={...t,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return ju()||RE()?r:o},addProseMirrorPlugins(){return[new ue({key:new ce("clearDocument"),appendTransaction:(n,e,t)=>{if(n.some(h=>h.getMeta("composition")))return;const o=n.some(h=>h.docChanged)&&!e.doc.eq(t.doc),r=n.some(h=>h.getMeta("preventClearDocument"));if(!o||r)return;const{empty:i,from:s,to:l}=e.selection,a=se.atStart(e.doc).from,u=se.atEnd(e.doc).to;if(i||!(s===a&&l===u)||!IE(t.doc))return;const d=t.tr,f=TE({state:t,transaction:d}),{commands:p}=new xU({editor:this.editor,state:f});if(p.clearNodes(),!!d.steps.length)return d}})]}}),a5=Hn.create({name:"paste",addProseMirrorPlugins(){return[new ue({key:new ce("tiptapPaste"),props:{handlePaste:(n,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),c5=Hn.create({name:"tabindex",addProseMirrorPlugins(){return[new ue({key:new ce("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),u5=Hn.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:n}=DE(this.extensions);return[{types:n.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const 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 ue({key:new ce("textDirection"),props:{attributes:()=>{const n=this.options.direction;return n?{dir:n}:{}}}})]}});function ia(n){return new QW({find:n.find,handler:({state:e,range:t,match:o,chain:r})=>{const i=Uu(n.getAttributes,void 0,o)||{},s=e.tr.delete(t.from,t.to),l=s.doc.resolve(t.from).blockRange(),a=l&&Bg(l,n.type,i);if(!a)return null;if(s.wrap(l,a),n.keepMarks&&n.editor){const{selection:d,storedMarks:f}=e,{splittableMarks:p}=n.editor.extensionManager,h=f||d.$to.parentOffset&&d.$from.marks();if(h){const m=h.filter(g=>p.includes(g.type.name));s.ensureMarks(m)}}if(n.keepAttributes){const d=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";r().updateAttributes(d,i).run()}const u=s.doc.resolve(t.from-1).nodeBefore;u&&u.type===n.type&&Hr(s.doc,t.from-1)&&(!n.joinPredicate||n.joinPredicate(o,u))&&s.join(t.from-1)},undoable:n.undoable})}var d5={};Pg(d5,{createAtomBlockMarkdownSpec:()=>f5,createBlockMarkdownSpec:()=>p5,createInlineMarkdownSpec:()=>g5,parseAttributes:()=>Vg,parseIndentedBlocks:()=>Eh,renderNestedMarkdownContent:()=>Fg,serializeAttributes:()=>zg});function Vg(n){if(!(n!=null&&n.trim()))return{};const e={},t=[],o=n.replace(/["']([^"']*)["']/g,a=>(t.push(a),`__QUOTED_${t.length-1}__`)),r=o.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(r){const a=r.map(u=>u.trim().slice(1));e.class=a.join(" ")}const i=o.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(e.id=i[1]);const s=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(o.matchAll(s)).forEach(([,a,u])=>{var d;const f=parseInt(((d=u.match(/__QUOTED_(\d+)__/))==null?void 0:d[1])||"0",10),p=t[f];p&&(e[a]=p.slice(1,-1))});const l=o.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return l&&l.split(/\s+/).filter(Boolean).forEach(a=>{a.match(/^[a-zA-Z][\w-]*$/)&&(e[a]=!0)}),e}function zg(n){if(!n||Object.keys(n).length===0)return"";const e=[];return n.class&&String(n.class).split(/\s+/).filter(Boolean).forEach(t=>e.push(`.${t}`)),n.id&&e.push(`#${n.id}`),Object.entries(n).forEach(([t,o])=>{t==="class"||t==="id"||(o===!0?e.push(t):o!==!1&&o!=null&&e.push(`${t}="${String(o)}"`))}),e.join(" ")}function f5(n){const{nodeName:e,name:t,parseAttributes:o=Vg,serializeAttributes:r=zg,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:l}=n,a=t||e,u=d=>{if(!l)return d;const f={};return l.forEach(p=>{p in d&&(f[p]=d[p])}),f};return{parseMarkdown:(d,f)=>{const p={...i,...d.attributes};return f.createNode(e,p,[])},markdownTokenizer:{name:e,level:"block",start(d){var f;const p=new RegExp(`^:::${a}(?:\\s|$)`,"m"),h=(f=d.match(p))==null?void 0:f.index;return h!==void 0?h:-1},tokenize(d,f,p){const h=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),m=d.match(h);if(!m)return;const g=m[1]||"",y=o(g);if(!s.find(b=>!(b in y)))return{type:e,raw:m[0],attributes:y}}},renderMarkdown:d=>{const f=u(d.attrs||{}),p=r(f),h=p?` {${p}}`:"";return`:::${a}${h} :::`}}}function p5(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=Vg,serializeAttributes:i=zg,defaultAttributes:s={},content:l="block",allowedAttributes:a}=n,u=t||e,d=f=>{if(!a)return f;const p={};return a.forEach(h=>{h in f&&(p[h]=f[h])}),p};return{parseMarkdown:(f,p)=>{let h;if(o){const g=o(f);h=typeof g=="string"?[{type:"text",text:g}]:g}else l==="block"?h=p.parseChildren(f.tokens||[]):h=p.parseInline(f.tokens||[]);const m={...s,...f.attributes};return p.createNode(e,m,h)},markdownTokenizer:{name:e,level:"block",start(f){var p;const h=new RegExp(`^:::${u}`,"m"),m=(p=f.match(h))==null?void 0:p.index;return m!==void 0?m:-1},tokenize(f,p,h){var m;const g=new RegExp(`^:::${u}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),y=f.match(g);if(!y)return;const[b,v=""]=y,w=r(v);let k=1;const x=b.length;let C="";const S=/^:::([\w-]*)(\s.*)?/gm,M=f.slice(x);for(S.lastIndex=0;;){const N=S.exec(M);if(N===null)break;const A=N.index,$=N[1];if(!((m=N[2])!=null&&m.endsWith(":::"))){if($)k+=1;else if(k-=1,k===0){const O=M.slice(0,A);C=O.trim();const R=f.slice(0,x+A+N[0].length);let I=[];if(C)if(l==="block")for(I=h.blockTokens(O),I.forEach(L=>{L.text&&(!L.tokens||L.tokens.length===0)&&(L.tokens=h.inlineTokens(L.text))});I.length>0;){const L=I[I.length-1];if(L.type==="paragraph"&&(!L.text||L.text.trim()===""))I.pop();else break}else I=h.inlineTokens(C);return{type:e,raw:R,attributes:w,content:C,tokens:I}}}}}},renderMarkdown:(f,p)=>{const h=d(f.attrs||{}),m=i(h),g=m?` {${m}}`:"",y=p.renderChildren(f.content||[],`
|
|
238
|
+
|
|
239
|
+
`);return`:::${u}${g}
|
|
240
|
+
|
|
241
|
+
${y}
|
|
242
|
+
|
|
243
|
+
:::`}}}function h5(n){if(!n.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let o=t.exec(n);for(;o!==null;){const[,r,i,s]=o;e[r]=i||s,o=t.exec(n)}return e}function m5(n){return Object.entries(n).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function g5(n){const{nodeName:e,name:t,getContent:o,parseAttributes:r=h5,serializeAttributes:i=m5,defaultAttributes:s={},selfClosing:l=!1,allowedAttributes:a}=n,u=t||e,d=p=>{if(!a)return p;const h={};return a.forEach(m=>{const g=typeof m=="string"?m:m.name,y=typeof m=="string"?void 0:m.skipIfDefault;if(g in p){const b=p[g];if(y!==void 0&&b===y)return;h[g]=b}}),h},f=u.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(p,h)=>{const m={...s,...p.attributes};if(l)return h.createNode(e,m);const g=o?o(p):p.content||"";return g?h.createNode(e,m,[h.createTextNode(g)]):h.createNode(e,m,[])},markdownTokenizer:{name:e,level:"inline",start(p){const h=l?new RegExp(`\\[${f}\\s*[^\\]]*\\]`):new RegExp(`\\[${f}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${f}\\]`),m=p.match(h),g=m==null?void 0:m.index;return g!==void 0?g:-1},tokenize(p,h,m){const g=l?new RegExp(`^\\[${f}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${f}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${f}\\]`),y=p.match(g);if(!y)return;let b="",v="";if(l){const[,k]=y;v=k}else{const[,k,x]=y;v=k,b=x||""}const w=r(v.trim());return{type:e,raw:y[0],content:b.trim(),attributes:w}}},renderMarkdown:p=>{let h="";o?h=o(p):p.content&&p.content.length>0&&(h=p.content.filter(b=>b.type==="text").map(b=>b.text).join(""));const m=d(p.attrs||{}),g=i(m),y=g?` ${g}`:"";return l?`[${u}${y}]`:`[${u}${y}]${h}[/${u}]`}}}function Eh(n,e,t){var o,r,i,s;const l=n.split(`
|
|
244
|
+
`),a=[];let u="",d=0;const f=e.baseIndentSize||2;for(;d<l.length;){const p=l[d],h=p.match(e.itemPattern);if(!h){if(a.length>0)break;if(p.trim()===""){d+=1,u=`${u}${p}
|
|
245
|
+
`;continue}else return}const m=e.extractItemData(h),{indentLevel:g,mainContent:y}=m;u=`${u}${p}
|
|
246
|
+
`;const b=[y];for(d+=1;d<l.length;){const x=l[d];if(x.trim()===""){const C=l.slice(d+1).findIndex(S=>S.trim()!=="");if(C===-1)break;if((((r=(o=l[d+1+C].match(/^(\s*)/))==null?void 0:o[1])==null?void 0:r.length)||0)>g){b.push(x),u=`${u}${x}
|
|
247
|
+
`,d+=1;continue}else break}if((((s=(i=x.match(/^(\s*)/))==null?void 0:i[1])==null?void 0:s.length)||0)>g)b.push(x),u=`${u}${x}
|
|
248
|
+
`,d+=1;else break}let v;const w=b.slice(1);if(w.length>0){const x=w.map(C=>C.slice(g+f)).join(`
|
|
249
|
+
`);x.trim()&&(e.customNestedParser?v=e.customNestedParser(x):v=t.blockTokens(x))}const k=e.createToken(m,v);a.push(k)}if(a.length!==0)return{items:a,raw:u}}function Fg(n,e,t,o){if(!n||!Array.isArray(n.content))return"";const r=typeof t=="function"?t(o):t,[i,...s]=n.content,l=e.renderChildren([i]),a=[`${r}${l}`];return s&&s.length>0&&s.forEach(u=>{const d=e.renderChildren([u]);if(d){const f=d.split(`
|
|
250
|
+
`).map(p=>p?e.indent(p):"").join(`
|
|
251
|
+
`);a.push(f)}}),a.join(`
|
|
252
|
+
`)}var xa=class FE extends PE{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new FE(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},y5=Object.defineProperty,b5=(n,e)=>{for(var t in e)y5(n,t,{get:e[t],enumerable:!0})},v5="listItem",yk="textStyle",bk=/^\s*([-+*])\s$/,k5=xa.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",Mi(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>n.type!=="list"||n.ordered?[]:{type:"bulletList",content:n.items?e.parseChildren(n.items):[]},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
253
|
+
`):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(v5,this.editor.getAttributes(yk)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=ia({find:bk,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=ia({find:bk,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(yk),editor:this.editor})),[n]}}),w5=xa.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",Mi(this.options.HTMLAttributes,n),0]},markdownTokenName:"list_item",parseMarkdown:(n,e)=>{if(n.type!=="list_item")return[];let t=[];if(n.tokens&&n.tokens.length>0)if(n.tokens.some(o=>o.type==="paragraph"))t=e.parseChildren(n.tokens);else{const o=n.tokens[0];if(o&&o.type==="text"&&o.tokens&&o.tokens.length>0){if(t=[{type:"paragraph",content:e.parseInline(o.tokens)}],n.tokens.length>1){const r=n.tokens.slice(1),i=e.parseChildren(r);t.push(...i)}}else t=e.parseChildren(n.tokens)}return t.length===0&&(t=[{type:"paragraph",content:[]}]),{type:"listItem",content:t}},renderMarkdown:(n,e,t)=>Fg(n,e,o=>o.parentType==="bulletList"?"- ":o.parentType==="orderedList"?`${o.index+1}. `:"- ",t),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),x5={};b5(x5,{findListItemPos:()=>Ca,getNextListDepth:()=>Hg,handleBackspace:()=>Mh,handleDelete:()=>Th,hasListBefore:()=>HE,hasListItemAfter:()=>C5,hasListItemBefore:()=>jE,listItemHasSubList:()=>UE,nextListIsDeeper:()=>WE,nextListIsHigher:()=>qE});var Ca=(n,e)=>{const{$from:t}=e.selection,o=Et(n,e.schema);let r=null,i=t.depth,s=t.pos,l=null;for(;i>0&&l===null;)r=t.node(i),r.type===o?l=i:(i-=1,s-=1);return l===null?null:{$pos:e.doc.resolve(s),depth:l}},Hg=(n,e)=>{const t=Ca(n,e);if(!t)return!1;const[,o]=TW(e,n,t.$pos.pos+4);return o},HE=(n,e,t)=>{const{$anchor:o}=n.selection,r=Math.max(0,o.pos-2),i=n.doc.resolve(r).node();return!(!i||!t.includes(i.type.name))},jE=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-2);return!(r.index()===0||((t=r.nodeBefore)==null?void 0:t.type.name)!==n)},UE=(n,e,t)=>{if(!t)return!1;const o=Et(n,e.schema);let r=!1;return t.descendants(i=>{i.type===o&&(r=!0)}),r},Mh=(n,e,t)=>{if(n.commands.undoInputRule())return!0;if(n.state.selection.from!==n.state.selection.to)return!1;if(!Os(n.state,e)&&HE(n.state,e,t)){const{$anchor:s}=n.state.selection,l=n.state.doc.resolve(s.before()-1),a=[];l.node().descendants((f,p)=>{f.type.name===e&&a.push({node:f,pos:p})});const u=a.at(-1);if(!u)return!1;const d=n.state.doc.resolve(l.start()+u.pos+1);return n.chain().cut({from:s.start()-1,to:s.end()+1},d.end()).joinForward().run()}if(!Os(n.state,e)||!OW(n.state))return!1;const o=Ca(e,n.state);if(!o)return!1;const r=n.state.doc.resolve(o.$pos.pos-2).node(o.depth),i=UE(e,n.state,r);return jE(e,n.state)&&!i?n.commands.joinItemBackward():n.chain().liftListItem(e).run()},WE=(n,e)=>{const t=Hg(n,e),o=Ca(n,e);return!o||!t?!1:t>o.depth},qE=(n,e)=>{const t=Hg(n,e),o=Ca(n,e);return!o||!t?!1:t<o.depth},Th=(n,e)=>{if(!Os(n.state,e)||!AW(n.state,e))return!1;const{selection:t}=n.state,{$from:o,$to:r}=t;return!t.empty&&o.sameParent(r)?!1:WE(e,n.state)?n.chain().focus(n.state.selection.from+4).lift(e).joinBackward().run():qE(e,n.state)?n.chain().joinForward().joinBackward().run():n.commands.joinItemForward()},C5=(n,e)=>{var t;const{$anchor:o}=e.selection,r=e.doc.resolve(o.pos-o.parentOffset-2);return!(r.index()===r.parent.childCount-1||((t=r.nodeAfter)==null?void 0:t.type.name)!==n)},S5=Hn.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Th(n,t)&&(e=!0)}),e},"Mod-Delete":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t})=>{n.state.schema.nodes[t]!==void 0&&Th(n,t)&&(e=!0)}),e},Backspace:({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Mh(n,t,o)&&(e=!0)}),e},"Mod-Backspace":({editor:n})=>{let e=!1;return this.options.listTypes.forEach(({itemName:t,wrapperNames:o})=>{n.state.schema.nodes[t]!==void 0&&Mh(n,t,o)&&(e=!0)}),e}}}}),vk=/^(\s*)(\d+)\.\s+(.*)$/,E5=/^\s/;function M5(n){const e=[];let t=0,o=0;for(;t<n.length;){const r=n[t],i=r.match(vk);if(!i)break;const[,s,l,a]=i,u=s.length;let d=a,f=t+1;const p=[r];for(;f<n.length;){const h=n[f];if(h.match(vk))break;if(h.trim()==="")p.push(h),d+=`
|
|
254
|
+
`,f+=1;else if(h.match(E5))p.push(h),d+=`
|
|
255
|
+
${h.slice(u+2)}`,f+=1;else break}e.push({indent:u,number:parseInt(l,10),content:d.trim(),raw:p.join(`
|
|
256
|
+
`)}),o=f,t=f}return[e,o]}function KE(n,e,t){var o;const r=[];let i=0;for(;i<n.length;){const s=n[i];if(s.indent===e){const l=s.content.split(`
|
|
257
|
+
`),a=((o=l[0])==null?void 0:o.trim())||"",u=[];a&&u.push({type:"paragraph",raw:a,tokens:t.inlineTokens(a)});const d=l.slice(1).join(`
|
|
258
|
+
`).trim();if(d){const h=t.blockTokens(d);u.push(...h)}let f=i+1;const p=[];for(;f<n.length&&n[f].indent>e;)p.push(n[f]),f+=1;if(p.length>0){const h=Math.min(...p.map(g=>g.indent)),m=KE(p,h,t);u.push({type:"list",ordered:!0,start:p[0].number,items:m,raw:p.map(g=>g.raw).join(`
|
|
259
|
+
`)})}r.push({type:"list_item",raw:s.raw,tokens:u}),i=f}else i+=1}return r}function T5(n,e){return n.map(t=>{if(t.type!=="list_item")return e.parseChildren([t])[0];const o=[];return t.tokens&&t.tokens.length>0&&t.tokens.forEach(r=>{if(r.type==="paragraph"||r.type==="list"||r.type==="blockquote"||r.type==="code")o.push(...e.parseChildren([r]));else if(r.type==="text"&&r.tokens){const i=e.parseChildren([r]);o.push({type:"paragraph",content:i})}else{const i=e.parseChildren([r]);i.length>0&&o.push(...i)}}),{type:"listItem",content:o}})}var N5="listItem",kk="textStyle",wk=/^(\d+)\.\s$/,A5=xa.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:null,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",Mi(this.options.HTMLAttributes,t),0]:["ol",Mi(this.options.HTMLAttributes,n),0]},markdownTokenName:"list",parseMarkdown:(n,e)=>{if(n.type!=="list"||!n.ordered)return[];const t=n.start||1,o=n.items?T5(n.items,e):[];return t!==1?{type:"orderedList",attrs:{start:t},content:o}:{type:"orderedList",content:o}},renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
260
|
+
`):"",markdownTokenizer:{name:"orderedList",level:"block",start:n=>{const e=n.match(/^(\s*)(\d+)\.\s+/),t=e==null?void 0:e.index;return t!==void 0?t:-1},tokenize:(n,e,t)=>{var o;const r=n.split(`
|
|
261
|
+
`),[i,s]=M5(r);if(i.length===0)return;const l=KE(i,0,t);return l.length===0?void 0:{type:"list",ordered:!0,start:((o=i[0])==null?void 0:o.number)||1,items:l,raw:r.slice(0,s).join(`
|
|
262
|
+
`)}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(N5,this.editor.getAttributes(kk)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=ia({find:wk,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=ia({find:wk,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(kk)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),O5=/^\s*(\[([( |x])?\])\s$/,JE=xa.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:n=>{const e=n.getAttribute("data-checked");return e===""||e==="true"},renderHTML:n=>({"data-checked":n.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:n,HTMLAttributes:e}){return["li",Mi(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:n.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(n,e)=>{const t=[];if(n.tokens&&n.tokens.length>0?t.push(e.createNode("paragraph",{},e.parseInline(n.tokens))):n.text?t.push(e.createNode("paragraph",{},[e.createNode("text",{text:n.text})])):t.push(e.createNode("paragraph",{},[])),n.nestedTokens&&n.nestedTokens.length>0){const o=e.parseChildren(n.nestedTokens);t.push(...o)}return e.createNode("taskItem",{checked:n.checked||!1},t)},renderMarkdown:(n,e)=>{var t;const o=`- [${(t=n.attrs)!=null&&t.checked?"x":" "}] `;return Fg(n,e,o)},addKeyboardShortcuts(){const n={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...n,Tab:()=>this.editor.commands.sinkListItem(this.name)}:n},addNodeView(){return({node:n,HTMLAttributes:e,getPos:t,editor:o})=>{const r=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),l=document.createElement("input"),a=document.createElement("div"),u=f=>{var p,h;l.ariaLabel=((h=(p=this.options.a11y)==null?void 0:p.checkboxLabel)==null?void 0:h.call(p,f,l.checked))||`Task item checkbox for ${f.textContent||"empty task item"}`};u(n),i.contentEditable="false",l.type="checkbox",l.addEventListener("mousedown",f=>f.preventDefault()),l.addEventListener("change",f=>{if(!o.isEditable&&!this.options.onReadOnlyChecked){l.checked=!l.checked;return}const{checked:p}=f.target;o.isEditable&&typeof t=="function"&&o.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:h})=>{const m=t();if(typeof m!="number")return!1;const g=h.doc.nodeAt(m);return h.setNodeMarkup(m,void 0,{...g==null?void 0:g.attrs,checked:p}),!0}).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(n,p)||(l.checked=!l.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([f,p])=>{r.setAttribute(f,p)}),r.dataset.checked=n.attrs.checked,l.checked=n.attrs.checked,i.append(l,s),r.append(i,a),Object.entries(e).forEach(([f,p])=>{r.setAttribute(f,p)});let d=new Set(Object.keys(e));return{dom:r,contentDOM:a,update:f=>{if(f.type!==this.type)return!1;r.dataset.checked=f.attrs.checked,l.checked=f.attrs.checked,u(f);const p=o.extensionManager.attributes,h=wW(f,p),m=new Set(Object.keys(h)),g=this.options.HTMLAttributes;return d.forEach(y=>{m.has(y)||(y in g?r.setAttribute(y,g[y]):r.removeAttribute(y))}),Object.entries(h).forEach(([y,b])=>{b==null?y in g?r.setAttribute(y,g[y]):r.removeAttribute(y):r.setAttribute(y,b)}),d=m,!0}}}},addInputRules(){return[ia({find:O5,type:this.type,getAttributes:n=>({checked:n[n.length-1]==="x"})})]}}),$5=xa.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:n}){return["ul",Mi(this.options.HTMLAttributes,n,{"data-type":this.name}),0]},parseMarkdown:(n,e)=>e.createNode("taskList",{},e.parseChildren(n.items||[])),renderMarkdown:(n,e)=>n.content?e.renderChildren(n.content,`
|
|
263
|
+
`):"",markdownTokenizer:{name:"taskList",level:"block",start(n){var e;const t=(e=n.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))==null?void 0:e.index;return t!==void 0?t:-1},tokenize(n,e,t){const o=i=>{const s=Eh(i,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:l=>({indentLevel:l[1].length,mainContent:l[4],checked:l[3].toLowerCase()==="x"}),createToken:(l,a)=>({type:"taskItem",raw:"",mainContent:l.mainContent,indentLevel:l.indentLevel,checked:l.checked,text:l.mainContent,tokens:t.inlineTokens(l.mainContent),nestedTokens:a}),customNestedParser:o},t);return s?[{type:"taskList",raw:s.raw,items:s.items}]:t.blockTokens(i)},r=Eh(n,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:i=>({indentLevel:i[1].length,mainContent:i[4],checked:i[3].toLowerCase()==="x"}),createToken:(i,s)=>({type:"taskItem",raw:"",mainContent:i.mainContent,indentLevel:i.indentLevel,checked:i.checked,text:i.mainContent,tokens:t.inlineTokens(i.mainContent),nestedTokens:s}),customNestedParser:o},t);if(r)return{type:"taskList",raw:r.raw,items:r.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:n})=>n.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});Hn.create({name:"listKit",addExtensions(){const n=[];return this.options.bulletList!==!1&&n.push(k5.configure(this.options.bulletList)),this.options.listItem!==!1&&n.push(w5.configure(this.options.listItem)),this.options.listKeymap!==!1&&n.push(S5.configure(this.options.listKeymap)),this.options.orderedList!==!1&&n.push(A5.configure(this.options.orderedList)),this.options.taskItem!==!1&&n.push(JE.configure(this.options.taskItem)),this.options.taskList!==!1&&n.push($5.configure(this.options.taskList)),n}});var B5=JE;const GE=B5.extend({content:"paragraph block* taskList?",addKeyboardShortcuts(){return{Tab:()=>this.editor.can().sinkListItem(this.type)?this.editor.commands.sinkListItem(this.type):!1,"Shift-Tab":()=>this.editor.can().liftListItem(this.type)?this.editor.commands.liftListItem(this.type):!1,Enter:()=>{const{$from:n}=this.editor.state.selection;return n.parent.textContent.length===0?this.editor.can().liftListItem(this.type)?this.editor.commands.liftListItem(this.type):!1:this.editor.can().splitListItem(this.type)?this.editor.commands.splitListItem(this.type):!1}}}});/**
|
|
264
|
+
* Copyright 2026 Yiitap
|
|
265
|
+
* @license MIT
|
|
266
|
+
**/function R5(n){var e;const{char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:l}=n,a=o&&!r,u=vx(t),d=new RegExp(`\\s${u}$`),f=s?"^":"",p=r?"":u,h=a?new RegExp(`${f}${u}.*?(?=\\s${p}|$)`,"gm"):new RegExp(`${f}(?:^)?${u}[^\\s${p}]*`,"gm"),m=((e=l.nodeBefore)==null?void 0:e.isText)&&l.nodeBefore.text;if(!m)return null;const g=l.pos-m.length,y=Array.from(m.matchAll(h)).pop();if(!y||y.input===void 0||y.index===void 0)return null;const b=y.input.slice(Math.max(0,y.index-1),y.index),v=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(b);if(i!==null&&!v)return null;const w=g+y.index;let k=w+y[0].length;return a&&d.test(m.slice(k-1,k+1))&&(y[0]+=" ",k+=1),w<l.pos&&k>=l.pos?{range:{from:w,to:k},query:y[0].slice(t.length),text:y[0]}:null}var _5=new ce("suggestion");function D5({pluginKey:n=_5,editor:e,char:t="@",allowSpaces:o=!1,allowToIncludeChar:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:l="span",decorationClass:a="suggestion",decorationContent:u="",decorationEmptyClass:d="is-empty",command:f=()=>null,items:p=()=>[],render:h=()=>({}),allow:m=()=>!0,findSuggestionMatch:g=R5,shouldShow:y}){let b;const v=h==null?void 0:h(),w=()=>{const S=e.state.selection.$anchor.pos,M=e.view.coordsAtPos(S),{top:N,right:A,bottom:$,left:O}=M;try{return new DOMRect(O,N,A-O,$-N)}catch{return null}},k=(S,M)=>M?()=>{const N=n.getState(e.state),A=N==null?void 0:N.decorationId,$=S.dom.querySelector(`[data-decoration-id="${A}"]`);return($==null?void 0:$.getBoundingClientRect())||null}:w;function x(S,M){var N;try{const $=n.getState(S.state),O=$!=null&&$.decorationId?S.dom.querySelector(`[data-decoration-id="${$.decorationId}"]`):null,R={editor:e,range:($==null?void 0:$.range)||{from:0,to:0},query:($==null?void 0:$.query)||null,text:($==null?void 0:$.text)||null,items:[],command:I=>f({editor:e,range:($==null?void 0:$.range)||{from:0,to:0},props:I}),decorationNode:O,clientRect:k(S,O)};(N=v==null?void 0:v.onExit)==null||N.call(v,R)}catch{}const A=S.state.tr.setMeta(M,{exit:!0});S.dispatch(A)}const C=new ue({key:n,view(){return{update:async(S,M)=>{var N,A,$,O,R,I,L;const B=(N=this.key)==null?void 0:N.getState(M),W=(A=this.key)==null?void 0:A.getState(S.state),z=B.active&&W.active&&B.range.from!==W.range.from,U=!B.active&&W.active,me=B.active&&!W.active,Ee=!U&&!me&&B.query!==W.query,Re=U||z&&Ee,Ue=Ee||z,Fe=me||z&&Ee;if(!Re&&!Ue&&!Fe)return;const Te=Fe&&!Re?B:W,te=S.dom.querySelector(`[data-decoration-id="${Te.decorationId}"]`);b={editor:e,range:Te.range,query:Te.query,text:Te.text,items:[],command:we=>f({editor:e,range:Te.range,props:we}),decorationNode:te,clientRect:k(S,te)},Re&&(($=v==null?void 0:v.onBeforeStart)==null||$.call(v,b)),Ue&&((O=v==null?void 0:v.onBeforeUpdate)==null||O.call(v,b)),(Ue||Re)&&(b.items=await p({editor:e,query:Te.query})),Fe&&((R=v==null?void 0:v.onExit)==null||R.call(v,b)),Ue&&((I=v==null?void 0:v.onUpdate)==null||I.call(v,b)),Re&&((L=v==null?void 0:v.onStart)==null||L.call(v,b))},destroy:()=>{var S;b&&((S=v==null?void 0:v.onExit)==null||S.call(v,b))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(S,M,N,A){const{isEditable:$}=e,{composing:O}=e.view,{selection:R}=S,{empty:I,from:L}=R,B={...M},W=S.getMeta(n);if(W&&W.exit)return B.active=!1,B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null,B;if(B.composing=O,$&&(I||e.view.composing)){(L<M.range.from||L>M.range.to)&&!O&&!M.composing&&(B.active=!1);const z=g({char:t,allowSpaces:o,allowToIncludeChar:r,allowedPrefixes:i,startOfLine:s,$position:R.$from}),U=`id_${Math.floor(Math.random()*4294967295)}`;z&&m({editor:e,state:A,range:z.range,isActive:M.active})&&(!y||y({editor:e,range:z.range,query:z.query,text:z.text,transaction:S}))?(B.active=!0,B.decorationId=M.decorationId?M.decorationId:U,B.range=z.range,B.query=z.query,B.text=z.text):B.active=!1}else B.active=!1;return B.active||(B.decorationId=null,B.range={from:0,to:0},B.query=null,B.text=null),B}},props:{handleKeyDown(S,M){var N,A,$,O;const{active:R,range:I}=C.getState(S.state);if(!R)return!1;if(M.key==="Escape"||M.key==="Esc"){const L=C.getState(S.state),B=(N=b==null?void 0:b.decorationNode)!=null?N:null,W=B??(L!=null&&L.decorationId?S.dom.querySelector(`[data-decoration-id="${L.decorationId}"]`):null);if((A=v==null?void 0:v.onKeyDown)!=null&&A.call(v,{view:S,event:M,range:L.range}))return!0;const z={editor:e,range:L.range,query:L.query,text:L.text,items:[],command:U=>f({editor:e,range:L.range,props:U}),decorationNode:W,clientRect:W?()=>W.getBoundingClientRect()||null:null};return($=v==null?void 0:v.onExit)==null||$.call(v,z),x(S,n),!0}return((O=v==null?void 0:v.onKeyDown)==null?void 0:O.call(v,{view:S,event:M,range:I}))||!1},decorations(S){const{active:M,range:N,decorationId:A,query:$}=C.getState(S);if(!M)return null;const O=!($!=null&&$.length),R=[a];return O&&R.push(d),Se.create(S.doc,[Ve.inline(N.from,N.to,{nodeName:l,class:R.join(" "),"data-decoration-id":A,"data-decoration-content":u})])}}});return C}var qd=D5;const I5=ve.create({name:"char-command",addOptions(){return{pluginKey:"char-command",suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[qd({pluginKey:new ce(this.options.pluginKey),editor:this.editor,...this.options.suggestion})]}}),XE=ve.create({name:"colon-command",addOptions(){return{suggestion:{char:":",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[qd({pluginKey:new ce("colon-command"),editor:this.editor,...this.options.suggestion})]}}),YE=ve.create({name:"slash-command",addOptions(){return{suggestion:{char:"/",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[qd({pluginKey:new ce("slash-command"),editor:this.editor,...this.options.suggestion})]}}),QE=ve.create({name:"slash-zh-command",addOptions(){return{suggestion:{char:"、",command:({editor:n,range:e,props:t})=>{t.command({editor:n,range:e})}}}},addProseMirrorPlugins(){return[qd({pluginKey:new ce("slash-zh-command"),editor:this.editor,...this.options.suggestion})]}}),L5={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:n,tr:e}=de(),{run:t}=ke();return{locale:n,tr:e,run:t}},data(){return{view:"main"}},components:{OEmojiSelect:Sd},methods:{onSelect(n){this.editor.commands.deleteRange(this.range),this.editor.commands.insertContent(n.emoji),this.editor.chain().focus()},onKeyDown({event:n}){return!1}}},jg=(n,e)=>{const t=n.__vccOpts||n;for(const[o,r]of e)t[o]=r;return t},P5={class:"o-colon-view"};function V5(n,e,t,o,r,i){const s=c.resolveComponent("o-emoji-select");return c.openBlock(),c.createElementBlock("section",P5,[c.createVNode(s,{items:t.items,onSelect:i.onSelect},null,8,["items","onSelect"])])}const z5=jg(L5,[["render",V5]]),ZE={items:({query:n})=>Tl.filterEmojiGroups(n),render:()=>{let n,e;return{onStart:t=>{n=new yd(z5,{props:t,editor:t.editor}),t.clientRect&&(e=No("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow(o){o.popper.classList.add("emoji-tippy")}}))},onUpdate(t){n.updateProps(t),e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var o;return t.event.key==="Escape"?(e[0].hide(),n.destroy(),!0):(o=n.ref)==null?void 0:o.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},F5={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Jt},range:{type:Object}},setup(){const{locale:n,tr:e}=de(),{onCommand:t,run:o}=ke();return{locale:n,tr:e,onCommand:t,run:o}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:Lt,OIcon:X,OList:ln,OListItem:Ut},watch:{items(){this.selectedIndex=0}},methods:{onClick(n){switch(n.value){default:this.runCommand(n);break}return!0},runCommand(n){const e=this.editor.chain().focus().deleteRange(this.range),t=this.editor.commands;["blockMath","codeBlock","content","details","diagram","emoji","inlineMath","taskList"].includes(n.value)?(t.deleteRange(this.range),this.run(this.editor,n.value,n.options)):this.onCommand(t,e,n.value,n.options)},onKeyDown({event:n}){return n.key==="ArrowUp"?(this.upHandler(),!0):n.key==="ArrowDown"?(this.downHandler(),!0):n.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(n){const e=this.items[n];e&&this.onClick(e)},setEmoji(n){this.onClick({value:"content",options:{content:n}})}},computed:{basicBlocks(){return _s.slice(1)}},mounted(){this.selectedIndex=0}},H5={key:0,class:"view-main"},j5={class:"group o-tips"},U5={class:"o-tips"},W5={key:1,class:"item"},q5={key:1,class:"view-emoji"},K5={key:2,class:"view-emoji"};function J5(n,e,t,o,r,i){const s=c.resolveComponent("o-divider"),l=c.resolveComponent("o-icon"),a=c.resolveComponent("o-list-item"),u=c.resolveComponent("o-list");return c.openBlock(),c.createElementBlock("section",{class:c.normalizeClass(["o-slash-view o-shadow-3 o-menu o-scroll",`view-${r.view}`])},[r.view==="main"?(c.openBlock(),c.createElementBlock("section",H5,[c.createVNode(u,{hoverable:"",clickable:""},{default:c.withCtx(()=>[t.items.length?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(t.items,(d,f)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:f},[d.group?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[f>0?(c.openBlock(),c.createBlock(s,{key:0})):c.createCommentVNode("",!0),c.createElementVNode("div",j5,c.toDisplayString(o.tr(d.group)),1)],64)):c.createCommentVNode("",!0),c.createVNode(a,{class:c.normalizeClass(["item",{"is-active":f===r.selectedIndex}]),clickable:"",onClick:p=>i.onClick(d)},{prefix:c.withCtx(()=>[c.createVNode(l,{name:d.icon,color:d.color},null,8,["name","color"])]),suffix:c.withCtx(()=>[c.createElementVNode("span",U5,c.toDisplayString(d.tips),1)]),default:c.withCtx(()=>[c.createTextVNode(" "+c.toDisplayString(o.tr(d.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(c.openBlock(),c.createElementBlock("div",W5,"No result"))]),_:1})])):r.view==="emoji"?(c.openBlock(),c.createElementBlock("section",q5)):r.view==="ai"?(c.openBlock(),c.createElementBlock("section",K5)):c.createCommentVNode("",!0)],2)}const G5=jg(F5,[["render",J5]]),Nh={items:({query:n})=>kd.filter(e=>{var t;return e.value.toLowerCase().includes(n.toLowerCase())||((t=e.keywords)==null?void 0:t.toLowerCase().includes(n.toLowerCase()))}),render:()=>{let n,e;return{onStart:t=>{n=new yd(G5,{props:t,editor:t.editor}),t.clientRect&&(e=No("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow:o=>{o.popper.classList.add("slash-tippy")}}))},onUpdate(t){n.updateProps(t),e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var o;return t.event.key==="Escape"?(e[0].hide(),n.destroy(),!0):(o=n.ref)==null?void 0:o.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},X5={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:n}){return n.key==="ArrowUp"?(this.upHandler(),!0):n.key==="ArrowDown"?(this.downHandler(),!0):n.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(n){const e=this.items[n];e&&this.command({name:e.name})}}},Y5={class:"dropdown-menu"},Q5=["onClick"],Z5=["src"];function e4(n,e,t,o,r,i){return c.openBlock(),c.createElementBlock("div",Y5,[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(t.items,(s,l)=>(c.openBlock(),c.createElementBlock("button",{class:c.normalizeClass({"is-selected":l===r.selectedIndex}),key:l,onClick:a=>i.selectItem(l)},[s.fallbackImage?(c.openBlock(),c.createElementBlock("img",{key:0,src:s.fallbackImage,align:"middle"},null,8,Z5)):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(s.emoji),1)],64)),c.createTextVNode(" :"+c.toDisplayString(s.name)+": ",1)],10,Q5))),128))])}const t4=jg(X5,[["render",e4]]),n4={items:({editor:n,query:e})=>n.storage.emoji.emojis.filter(({shortcodes:t,tags:o})=>t.find(r=>r.startsWith(e.toLowerCase()))||o.find(r=>r.startsWith(e.toLowerCase()))).slice(0,10),render:()=>{let n;function e(t){if(!n||!n.element)return;ql({getBoundingClientRect(){return t}},n.element,{placement:"bottom-start"}).then(r=>{Object.assign(n.element.style,{left:`${r.x}px`,top:`${r.y}px`,position:r.strategy==="fixed"?"fixed":"absolute"})})}return{onStart:t=>{n=new yd(t4,{props:t,editor:t.editor}),document.body.appendChild(n.element),e(t.clientRect())},onUpdate(t){n.updateProps(t),e(t.clientRect())},onKeyDown(t){var o;return t.event.key==="Escape"?(document.body.removeChild(n.element),n.destroy(),!0):(o=n.ref)==null?void 0:o.onKeyDown(t)},onExit(){document.body.contains(n.element)&&document.body.removeChild(n.element),n.destroy()}}}};/**
|
|
267
|
+
* Copyright 2026 Yiitap
|
|
268
|
+
* @license MIT
|
|
269
|
+
**/const o4=Ie.create({name:"aiBlock",group:"block",content:"block+",draggable:!0,addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{provider:{default:""},prompt:{default:""},time:{default:0}}},parseHTML(){return[{tag:'div[data-type="aiBlock"]'}]},renderMarkdown:(n,e)=>{if(!n.content)return"";const t=[];return n.content.forEach(o=>{const r=e.renderChildren(o);t.push(r)}),t.join(`
|
|
270
|
+
`)},renderHTML({HTMLAttributes:n}){return["div",he(n,{"data-type":"aiBlock"}),0]},addCommands(){return{setAiBlock:()=>({commands:n})=>n.wrapIn(this.name),toggleAiBlock:()=>({commands:n})=>n.toggleWrap(this.name),unsetAiBlock:()=>({commands:n})=>n.lift(this.name),updateAiBlock:(n,e)=>({editor:t,tr:o,dispatch:r})=>{const i=o.doc.nodeAt(n);if(!i||i.type.name!==this.name)return console.error("Invalid node type."),!1;try{const s=_n.fromJSON(t.schema,e),l=i.copy(s.content);return o.replaceWith(n,n+i.nodeSize,l),r==null?void 0:r(o)}catch(s){return console.error("Invalid content structure:",s),!1}}}}}),r4={class:"o-scroll"},i4={class:"view-main"},s4={class:"block-container"},l4={class:"block-content"},a4={key:0,class:"edit-prompt"},c4={key:1},u4={"data-tippy-role":"tooltip"},d4={class:"label"},f4={class:"block-container"},p4={class:"block-content"},h4=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n,{md:t,aiOption:o,createStreamingChatCompletion:r}=Ym(),{languageName:i,tr:s}=de(),{isFocused:l,bind:a,unbind:u,checkFocus:d}=V1(),{theme:f}=Bi(),{isEditable:p}=ke(),{getPos:h}=e,m=c.ref(null),g=c.ref(""),y=c.ref(!1),b=c.ref({}),v=c.ref(!1),w=c.ref(!1),k=c.ref(""),x=c.ref(null),C=c.ref(!1),S=c.ref(!1),M=c.computed(()=>({role:"system",content:Xm.writing.replace("[LANGUAGE]",i.value)})),N=c.ref([M.value]),A=c.computed(()=>!e.node.textContent),$=c.computed(()=>N1),O=c.computed({get(){return e.node.attrs.provider},set(te){e.updateAttributes({provider:te})}}),R=c.computed({get(){return e.node.attrs.prompt},set(te){e.updateAttributes({prompt:te})}}),I=c.computed({get(){return e.node.attrs.time},set(te){e.updateAttributes({time:te})}});function L(){g.value=R.value,A.value&&!R.value&&setTimeout(()=>{var te;(te=m.value)==null||te.focus()},0)}function B(){setTimeout(()=>{},0)}function W(){k.value="edit",setTimeout(()=>{var te;(te=x.value)==null||te.focus()},0)}function z(){O.value=o.value.provider,R.value=g.value,I.value=Date.now(),C.value=!0,k.value&&(k.value=""),S.value?me():U()}async function U(){const te=h();let we="";N.value.push({role:"user",content:R.value}),N.value[0].role==="system"&&(N.value.shift(),N.value.unshift(M.value));try{const Ne=await r(N.value,gt=>{we+=gt,N.value=[...N.value.slice(0,-1),{role:"assistant",content:we}];const yt=Gp(e.editor,t.render(we));Ee(te,yt)})}catch(Ne){N.value.pop(),console.error(Ne),ug.error(s("ai.error"))}C.value=!1}async function me(){const te=h();let we="";try{for(const Ne of bC){await new Promise(yt=>setTimeout(yt,500)),we+=Ne;const gt=Gp(e.editor,t.render(we));Ee(te,gt)}}catch(Ne){console.error(Ne)}C.value=!1}function Ee(te,we){var gt;const Ne=e.node.toJSON();Ne.content=we.content,(gt=e.editor)==null||gt.commands.updateAiBlock(te,Ne),e.editor.commands.setNodeSelection(te),e.editor.view.focus(),Re()}function Re(){const we=e.node.content.lastChild;if(we&&we.attrs["data-id"]){const Ne=we.attrs["data-id"],gt=document.querySelector(`[data-id="${Ne}"]`);gt&>.scrollIntoView({behavior:"smooth",block:"center"})}}function Ue(te){y.value=!1,te.value}function Fe(te,we){we?g.value=s(we.label):g.value=s(te.label),v.value=!1}function Te(te){y.value=!0,b.value=te}return c.watch(()=>e.node.content,te=>{d()}),c.watch(A,te=>{te&&(w.value=!1)}),c.watch(l,te=>{te&&!A.value&&setTimeout(()=>{g.value=R.value,k.value="",w.value=te},100)}),c.onMounted(()=>{L(),a(e)}),c.onBeforeUnmount(()=>{u()}),(te,we)=>(c.openBlock(),c.createBlock(c.unref(Mn),c.mergeProps(e,{class:["o-ai-block-view",{"is-empty":A.value,"has-focus":c.unref(l)}],onContextmenu:c.withModifiers(Te,["prevent"])}),{default:c.withCtx(()=>[A.value?(c.openBlock(),c.createBlock(c.unref(Eo),{key:0,modelValue:v.value,"onUpdate:modelValue":we[1]||(we[1]=Ne=>v.value=Ne),placement:"bottom-start","tippy-class":"ai-block-popover",offset:[0,14]},{"popover-content":c.withCtx(()=>[c.createElementVNode("section",r4,[c.createElementVNode("section",i4,[c.createVNode(c.unref(Cd),{items:$.value,onSelect:Fe,"use-keyboard":v.value},null,8,["items","use-keyboard"])])])]),default:c.withCtx(()=>[c.createElementVNode("div",s4,[c.createElementVNode("div",l4,[c.createVNode(c.unref(Zn),{ref_key:"inputRef",ref:m,modelValue:g.value,"onUpdate:modelValue":we[0]||(we[0]=Ne=>g.value=Ne),placeholder:c.unref(s)("ai.tellAi"),type:"text",autofocus:"",clearable:"",onFocus:B},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"auto_awesome"})]),suffix:c.withCtx(()=>[c.createVNode(c.unref(Jn),{icon:"arrow_back","icon-class":"rotate-90",tooltip:c.unref(s)("label.generate"),loading:C.value,onClick:z},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])])]),_:1},8,["modelValue"])):c.createCommentVNode("",!0),c.withDirectives(c.createVNode(c.unref(Eo),{modelValue:w.value,"onUpdate:modelValue":we[4]||(we[4]=Ne=>w.value=Ne),placement:"top-end","tippy-class":"ai-block-update-popover",offset:[0,18]},{"popover-content":c.withCtx(()=>[k.value==="edit"?(c.openBlock(),c.createElementBlock("section",a4,[c.createVNode(c.unref(Zn),{ref_key:"updateInputRef",ref:x,modelValue:g.value,"onUpdate:modelValue":we[2]||(we[2]=Ne=>g.value=Ne),placeholder:c.unref(s)("ai.tellAi"),type:"text",autofocus:"",clearable:""},{prefix:c.withCtx(()=>[c.createVNode(c.unref(X),{name:"auto_awesome"})]),suffix:c.withCtx(()=>[c.createVNode(c.unref(Jn),{icon:"arrow_back","icon-class":"rotate-90",tooltip:c.unref(s)("label.generate"),loading:C.value,onClick:z},null,8,["tooltip","loading"])]),_:1},8,["modelValue","placeholder"])])):(c.openBlock(),c.createElementBlock("section",c4,[c.createVNode(c.unref(hC),null,{default:c.withCtx(()=>[c.createElementVNode("div",u4,[c.createVNode(c.unref(He),{icon:"auto_awesome",onClick:W},{default:c.withCtx(()=>[c.createElementVNode("span",d4,c.toDisplayString(c.unref(s)("label.generatedBy"))+" "+c.toDisplayString(c.unref(Gm)(O.value,"name")||"AI"),1)]),_:1})]),c.createVNode(c.unref(Jn),{icon:"autorenew",tooltip:c.unref(s)("label.update"),loading:C.value,onClick:z},null,8,["tooltip","loading"])]),_:1})]))]),default:c.withCtx(()=>[c.createElementVNode("div",f4,[c.createElementVNode("div",p4,[c.createVNode(c.unref(to))]),c.unref(p)?(c.openBlock(),c.createBlock(c.unref(ya),{key:0,modelValue:y.value,"onUpdate:modelValue":we[3]||(we[3]=Ne=>y.value=Ne),event:b.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Fr),c.mergeProps(e,{onAction:Ue}),null,16)]),_:1},8,["modelValue","event"])):c.createCommentVNode("",!0)])]),_:1},8,["modelValue"]),[[c.vShow,!A.value]])]),_:1},16,["class"]))}}),eM=o4.extend({addNodeView(){return hn(h4)}}),m4={class:"header o-tips"},g4={style:{display:"flex"}},y4=["innerHTML"],b4=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n,{tr:t}=de(),{isEditable:o}=ke(),r=c.ref(!1),i=c.ref(null),s=c.computed({get(){return e.node.attrs.latex},set(d){e.updateAttributes({latex:d||""})}}),l=c.computed(()=>qT.renderToString(s.value,{throwOnError:!1}));function a(d){r.value=d,d&&setTimeout(()=>{var f;(f=i.value)==null||f.focus()},100)}function u(){window.open("https://katex.org/docs/supported.html","target")}return c.onMounted(()=>{a(!s.value)}),(d,f)=>(c.openBlock(),c.createBlock(c.unref(Mn),c.mergeProps(e,{class:["o-block-math-view",{init:!s.value}],as:"div",onClick:f[3]||(f[3]=p=>a(!0))}),{default:c.withCtx(()=>[c.createVNode(c.unref(Eo),{modelValue:r.value,"onUpdate:modelValue":f[2]||(f[2]=p=>r.value=p),"content-class":"o-block-math-editor",placement:s.value==="init"?"bottom":"top",readonly:!c.unref(o),"show-arrow":""},{"popover-content":c.withCtx(()=>[c.createElementVNode("header",m4,[c.createElementVNode("div",g4,[c.createVNode(c.unref(X),{name:"functions"}),c.createTextVNode(" "+c.toDisplayString(c.unref(t)("editor.blockMath")),1)]),c.createElementVNode("div",null,[c.createVNode(c.unref(nt),{icon:"help",tooltip:c.unref(t)("label.help"),onClick:u},null,8,["tooltip"])])]),c.createVNode(c.unref(yC),{ref_key:"input",ref:i,modelValue:s.value,"onUpdate:modelValue":f[0]||(f[0]=p=>s.value=p),placeholder:"Input block math ...",autofocus:"",clearable:""},null,8,["modelValue"])]),default:c.withCtx(()=>[s.value?(c.openBlock(),c.createElementBlock("div",{key:1,class:"block-math-container",onClick:f[1]||(f[1]=p=>a(!0))},[c.createElementVNode("div",{class:"katex-container",innerHTML:l.value},null,8,y4)])):(c.openBlock(),c.createBlock(c.unref(xd),{key:0,class:"o-tips",icon:"functions",placeholder:"Add a TeX equation"}))]),_:1},8,["modelValue","placement","readonly"])]),_:1},16,["class"]))}}),tM=Nl.BlockMath.extend({addCommands(){return{insertBlockMath:(n={})=>({tr:e,dispatch:t,state:o})=>{const r=o.schema.nodes.blockMath.create({latex:n.latex??""});return t&&(e.replaceSelectionWith(r),e.scrollIntoView()),!0}}},addNodeView(){return hn(b4)}}),v4=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n;return(t,o)=>(c.openBlock(),c.createBlock(c.unref(Mn),c.mergeProps(e,{class:"o-blockquote-view"}),{default:c.withCtx(()=>[c.createElementVNode("blockquote",null,[c.createVNode(c.unref(to))])]),_:1},16))}}),nM=GB.extend({draggable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),triggerCharacters:[">"]}},addInputRules(){const{triggerCharacters:n}=this.options,e=n.map(o=>o.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),t=new RegExp(`^[${e}]\\s$`);return[new Vr({find:t,handler:({state:o,range:r})=>{const{tr:i,schema:s}=o,{$from:l}=i.selection,a=l.before(l.depth),u=l.after(l.depth);i.delete(r.from,r.to);const d=s.nodes.blockquote.create(null,s.nodes.paragraph.create());i.replaceRangeWith(a,u,d);const f=q.near(i.doc.resolve(a+2));i.setSelection(f)}})]},addNodeView(){return hn(v4)}});/**
|
|
271
|
+
* Copyright 2026 Yiitap
|
|
272
|
+
* @license MIT
|
|
273
|
+
**/const k4=Ie.create({name:"callout",group:"block",content:"block+",draggable:!0,addOptions(){return{HTMLAttributes:{},triggerCharacters:["?","?"]}},addAttributes(){return{icon:{default:"🌾"},borderColor:{default:"#dddddd"},borderColorDark:{default:"#333333"},backColor:{default:"#eeeeee"},backColorDark:{default:"rgba(101, 117, 133, 0.16)"}}},addInputRules(){const{triggerCharacters:n}=this.options,e=n.map(o=>o.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),t=new RegExp(`^[${e}]\\s$`);return[new Vr({find:t,handler:({state:o,range:r})=>{const{tr:i,schema:s}=o,{$from:l}=i.selection,a=l.before(l.depth),u=l.after(l.depth);i.delete(r.from,r.to);const d=s.nodes.callout.create(null,s.nodes.paragraph.create());i.replaceRangeWith(a,u,d);const f=q.near(i.doc.resolve(a+2));i.setSelection(f)}})]},parseHTML(){return[{tag:'div[data-type="callout"]'}]},renderHTML({HTMLAttributes:n}){return["div",he(n,{"data-type":"callout"}),0]},markdownTokenName:"callout",parseMarkdown:(n,e)=>{const t=n.info.replace("info","").trim()||"🌾",o=e.parseChildren(n.tokens??[]);return console.log("callout parseMarkdown",n.info),console.log("callout parseMarkdown",n,o,t),e.createNode("callout",{icon:t},o)},renderMarkdown:(n,e)=>{var i;if(!n.content)return"";const t=`::: info ${((i=n.attrs)==null?void 0:i.icon)||"🌾"}`,o=":::",r=[];return n.content.forEach(s=>{const l=e.renderChildren(s);r.push(l)}),t+`
|
|
274
|
+
`+r.join(`
|
|
275
|
+
|
|
276
|
+
`)+`
|
|
277
|
+
`+o},markdownTokenizer:{name:"callout",level:"block",start:n=>{var e;return((e=n.match(/^:::/))==null?void 0:e.index)??-1},tokenize(n,e,t){const o=/^:::([^\n]+)\n([\s\S]*?)\n:::\s*(?:\n|$)/.exec(n);if(!o)return;const[,r,i]=o;console.log("markdownTokenizer",n,o,r,i);const s=t.blockTokens(i);return{type:"callout",raw:o[0],info:r,tokens:s}}},addCommands(){return{setCallout:()=>({commands:n})=>n.wrapIn(this.name),toggleCallout:()=>({commands:n})=>n.toggleWrap(this.name),unsetCallout:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-c":()=>this.editor.commands.toggleCallout()}}}),w4={class:"callout-container"},x4={class:"callout-icon"},C4={class:"callout-content"},S4=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n,{theme:t}=Bi(),{isEditable:o}=ke(),r=c.ref(!1),i=c.ref(!1),s=c.ref({}),l=c.ref(null),a=c.computed(()=>{const{selection:k}=e.editor.view.state,x=k.from,C=e.getPos(),S=C+e.node.nodeSize;return x>=C&&x<=S}),u=c.computed({get(){return e.node.attrs.backColor},set(k){e.updateAttributes({backColor:k})}}),d=c.computed({get(){return e.node.attrs.backColorDark},set(k){e.updateAttributes({backColorDark:k})}}),f=c.computed({get(){return e.node.attrs.borderColor},set(k){e.updateAttributes({borderColor:k})}}),p=c.computed({get(){return e.node.attrs.borderColorDark},set(k){e.updateAttributes({borderColorDark:k})}}),h=c.computed(()=>t.value==="dark"?d.value:u.value),m=c.computed(()=>t.value==="dark"?p.value:f.value);function g(k){e.updateAttributes({icon:k})}function y(k){switch(r.value=!1,k.value){case"palette":v(!0);break}}function b(k){r.value=!0,s.value=k}function v(k){i.value=k}function w(k,x){var C;switch(k){case"backColor":u.value=x;break;case"foreColor":f.value=x;break;case"icon":g(x.emoji),(C=l.value)==null||C.setShow(!1);break}}return c.watch(a,k=>{v(k)}),(k,x)=>(c.openBlock(),c.createBlock(c.unref(Mn),c.mergeProps(e,{class:"o-callout-view",style:`--callout-border-color: ${m.value}; --callout-back-color: ${h.value}`,onContextmenu:c.withModifiers(b,["prevent"])}),{default:c.withCtx(()=>[c.createElementVNode("div",w4,[c.createVNode(c.unref($e),{ref_key:"iconPopover",ref:l,placement:"bottom-start",trigger:"click",offset:[0,0],disable:!c.unref(o)},{trigger:c.withCtx(()=>[c.createElementVNode("div",x4,c.toDisplayString(k.node.attrs.icon),1)]),default:c.withCtx(()=>[c.createVNode(c.unref(Sd),{items:c.unref(Tl.emojiGroups),onSelect:x[0]||(x[0]=C=>w("icon",C)),"enable-search":""},null,8,["items"])]),_:1},8,["disable"]),c.createElementVNode("div",C4,[c.createVNode(c.unref(to))]),c.unref(o)?(c.openBlock(),c.createBlock(c.unref(ya),{key:0,modelValue:r.value,"onUpdate:modelValue":x[1]||(x[1]=C=>r.value=C),event:s.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Fr),c.mergeProps(e,{onAction:y}),null,16)]),_:1},8,["modelValue","event"])):c.createCommentVNode("",!0)])]),_:1},16,["style"]))}}),oM=k4.extend({addNodeView(){return hn(S4)}});function E4(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Yf,xk;function M4(){if(xk)return Yf;xk=1;function n(E){return E instanceof Map?E.clear=E.delete=E.set=function(){throw new Error("map is read-only")}:E instanceof Set&&(E.add=E.clear=E.delete=function(){throw new Error("set is read-only")}),Object.freeze(E),Object.getOwnPropertyNames(E).forEach(_=>{const j=E[_],ge=typeof j;(ge==="object"||ge==="function")&&!Object.isFrozen(j)&&n(j)}),E}class e{constructor(_){_.data===void 0&&(_.data={}),this.data=_.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function t(E){return E.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function o(E,..._){const j=Object.create(null);for(const ge in E)j[ge]=E[ge];return _.forEach(function(ge){for(const Qe in ge)j[Qe]=ge[Qe]}),j}const r="</span>",i=E=>!!E.scope,s=(E,{prefix:_})=>{if(E.startsWith("language:"))return E.replace("language:","language-");if(E.includes(".")){const j=E.split(".");return[`${_}${j.shift()}`,...j.map((ge,Qe)=>`${ge}${"_".repeat(Qe+1)}`)].join(" ")}return`${_}${E}`};class l{constructor(_,j){this.buffer="",this.classPrefix=j.classPrefix,_.walk(this)}addText(_){this.buffer+=t(_)}openNode(_){if(!i(_))return;const j=s(_.scope,{prefix:this.classPrefix});this.span(j)}closeNode(_){i(_)&&(this.buffer+=r)}value(){return this.buffer}span(_){this.buffer+=`<span class="${_}">`}}const a=(E={})=>{const _={children:[]};return Object.assign(_,E),_};class u{constructor(){this.rootNode=a(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(_){this.top.children.push(_)}openNode(_){const j=a({scope:_});this.add(j),this.stack.push(j)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(_){return this.constructor._walk(_,this.rootNode)}static _walk(_,j){return typeof j=="string"?_.addText(j):j.children&&(_.openNode(j),j.children.forEach(ge=>this._walk(_,ge)),_.closeNode(j)),_}static _collapse(_){typeof _!="string"&&_.children&&(_.children.every(j=>typeof j=="string")?_.children=[_.children.join("")]:_.children.forEach(j=>{u._collapse(j)}))}}class d extends u{constructor(_){super(),this.options=_}addText(_){_!==""&&this.add(_)}startScope(_){this.openNode(_)}endScope(){this.closeNode()}__addSublanguage(_,j){const ge=_.root;j&&(ge.scope=`language:${j}`),this.add(ge)}toHTML(){return new l(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function f(E){return E?typeof E=="string"?E:E.source:null}function p(E){return g("(?=",E,")")}function h(E){return g("(?:",E,")*")}function m(E){return g("(?:",E,")?")}function g(...E){return E.map(j=>f(j)).join("")}function y(E){const _=E[E.length-1];return typeof _=="object"&&_.constructor===Object?(E.splice(E.length-1,1),_):{}}function b(...E){return"("+(y(E).capture?"":"?:")+E.map(ge=>f(ge)).join("|")+")"}function v(E){return new RegExp(E.toString()+"|").exec("").length-1}function w(E,_){const j=E&&E.exec(_);return j&&j.index===0}const k=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function x(E,{joinWith:_}){let j=0;return E.map(ge=>{j+=1;const Qe=j;let We=f(ge),ne="";for(;We.length>0;){const Y=k.exec(We);if(!Y){ne+=We;break}ne+=We.substring(0,Y.index),We=We.substring(Y.index+Y[0].length),Y[0][0]==="\\"&&Y[1]?ne+="\\"+String(Number(Y[1])+Qe):(ne+=Y[0],Y[0]==="("&&j++)}return ne}).map(ge=>`(${ge})`).join(_)}const C=/\b\B/,S="[a-zA-Z]\\w*",M="[a-zA-Z_]\\w*",N="\\b\\d+(\\.\\d+)?",A="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",$="\\b(0b[01]+)",O="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",R=(E={})=>{const _=/^#![ ]*\//;return E.binary&&(E.begin=g(_,/.*\b/,E.binary,/\b.*/)),o({scope:"meta",begin:_,end:/$/,relevance:0,"on:begin":(j,ge)=>{j.index!==0&&ge.ignoreMatch()}},E)},I={begin:"\\\\[\\s\\S]",relevance:0},L={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[I]},B={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[I]},W={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},z=function(E,_,j={}){const ge=o({scope:"comment",begin:E,end:_,contains:[]},j);ge.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const Qe=b("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return ge.contains.push({begin:g(/[ ]+/,"(",Qe,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),ge},U=z("//","$"),me=z("/\\*","\\*/"),Ee=z("#","$"),Re={scope:"number",begin:N,relevance:0},Ue={scope:"number",begin:A,relevance:0},Fe={scope:"number",begin:$,relevance:0},Te={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[I,{begin:/\[/,end:/\]/,relevance:0,contains:[I]}]},te={scope:"title",begin:S,relevance:0},we={scope:"title",begin:M,relevance:0},Ne={begin:"\\.\\s*"+M,relevance:0};var yt=Object.freeze({__proto__:null,APOS_STRING_MODE:L,BACKSLASH_ESCAPE:I,BINARY_NUMBER_MODE:Fe,BINARY_NUMBER_RE:$,COMMENT:z,C_BLOCK_COMMENT_MODE:me,C_LINE_COMMENT_MODE:U,C_NUMBER_MODE:Ue,C_NUMBER_RE:A,END_SAME_AS_BEGIN:function(E){return Object.assign(E,{"on:begin":(_,j)=>{j.data._beginMatch=_[1]},"on:end":(_,j)=>{j.data._beginMatch!==_[1]&&j.ignoreMatch()}})},HASH_COMMENT_MODE:Ee,IDENT_RE:S,MATCH_NOTHING_RE:C,METHOD_GUARD:Ne,NUMBER_MODE:Re,NUMBER_RE:N,PHRASAL_WORDS_MODE:W,QUOTE_STRING_MODE:B,REGEXP_MODE:Te,RE_STARTERS_RE:O,SHEBANG:R,TITLE_MODE:te,UNDERSCORE_IDENT_RE:M,UNDERSCORE_TITLE_MODE:we});function io(E,_){E.input[E.index-1]==="."&&_.ignoreMatch()}function or(E,_){E.className!==void 0&&(E.scope=E.className,delete E.className)}function Bo(E,_){_&&E.beginKeywords&&(E.begin="\\b("+E.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",E.__beforeBegin=io,E.keywords=E.keywords||E.beginKeywords,delete E.beginKeywords,E.relevance===void 0&&(E.relevance=0))}function Ro(E,_){Array.isArray(E.illegal)&&(E.illegal=b(...E.illegal))}function rr(E,_){if(E.match){if(E.begin||E.end)throw new Error("begin & end are not supported with match");E.begin=E.match,delete E.match}}function Tn(E,_){E.relevance===void 0&&(E.relevance=1)}const _o=(E,_)=>{if(!E.beforeMatch)return;if(E.starts)throw new Error("beforeMatch cannot be used with starts");const j=Object.assign({},E);Object.keys(E).forEach(ge=>{delete E[ge]}),E.keywords=j.keywords,E.begin=g(j.beforeMatch,p(j.begin)),E.starts={relevance:0,contains:[Object.assign(j,{endsParent:!0})]},E.relevance=0,delete j.beforeMatch},ir=["of","and","for","in","not","or","if","then","parent","list","value"],sr="keyword";function Pt(E,_,j=sr){const ge=Object.create(null);return typeof E=="string"?Qe(j,E.split(" ")):Array.isArray(E)?Qe(j,E):Object.keys(E).forEach(function(We){Object.assign(ge,Pt(E[We],_,We))}),ge;function Qe(We,ne){_&&(ne=ne.map(Y=>Y.toLowerCase())),ne.forEach(function(Y){const ye=Y.split("|");ge[ye[0]]=[We,mn(ye[0],ye[1])]})}}function mn(E,_){return _?Number(_):so(E)?0:1}function so(E){return ir.includes(E.toLowerCase())}const gn={},Qt=E=>{console.error(E)},Do=(E,..._)=>{console.log(`WARN: ${E}`,..._)},Vt=(E,_)=>{gn[`${E}/${_}`]||(console.log(`Deprecated as of ${E}. ${_}`),gn[`${E}/${_}`]=!0)},jn=new Error;function lo(E,_,{key:j}){let ge=0;const Qe=E[j],We={},ne={};for(let Y=1;Y<=_.length;Y++)ne[Y+ge]=Qe[Y],We[Y+ge]=!0,ge+=v(_[Y-1]);E[j]=ne,E[j]._emit=We,E[j]._multi=!0}function Vs(E){if(Array.isArray(E.begin)){if(E.skip||E.excludeBegin||E.returnBegin)throw Qt("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),jn;if(typeof E.beginScope!="object"||E.beginScope===null)throw Qt("beginScope must be object"),jn;lo(E,E.begin,{key:"beginScope"}),E.begin=x(E.begin,{joinWith:""})}}function zs(E){if(Array.isArray(E.end)){if(E.skip||E.excludeEnd||E.returnEnd)throw Qt("skip, excludeEnd, returnEnd not compatible with endScope: {}"),jn;if(typeof E.endScope!="object"||E.endScope===null)throw Qt("endScope must be object"),jn;lo(E,E.end,{key:"endScope"}),E.end=x(E.end,{joinWith:""})}}function Di(E){E.scope&&typeof E.scope=="object"&&E.scope!==null&&(E.beginScope=E.scope,delete E.scope)}function Ii(E){Di(E),typeof E.beginScope=="string"&&(E.beginScope={_wrap:E.beginScope}),typeof E.endScope=="string"&&(E.endScope={_wrap:E.endScope}),Vs(E),zs(E)}function Li(E){function _(ne,Y){return new RegExp(f(ne),"m"+(E.case_insensitive?"i":"")+(E.unicodeRegex?"u":"")+(Y?"g":""))}class j{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(Y,ye){ye.position=this.position++,this.matchIndexes[this.matchAt]=ye,this.regexes.push([ye,Y]),this.matchAt+=v(Y)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const Y=this.regexes.map(ye=>ye[1]);this.matcherRe=_(x(Y,{joinWith:"|"}),!0),this.lastIndex=0}exec(Y){this.matcherRe.lastIndex=this.lastIndex;const ye=this.matcherRe.exec(Y);if(!ye)return null;const vt=ye.findIndex((Hs,Qd)=>Qd>0&&Hs!==void 0),ut=this.matchIndexes[vt];return ye.splice(0,vt),Object.assign(ye,ut)}}class ge{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(Y){if(this.multiRegexes[Y])return this.multiRegexes[Y];const ye=new j;return this.rules.slice(Y).forEach(([vt,ut])=>ye.addRule(vt,ut)),ye.compile(),this.multiRegexes[Y]=ye,ye}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(Y,ye){this.rules.push([Y,ye]),ye.type==="begin"&&this.count++}exec(Y){const ye=this.getMatcher(this.regexIndex);ye.lastIndex=this.lastIndex;let vt=ye.exec(Y);if(this.resumingScanAtSamePosition()&&!(vt&&vt.index===this.lastIndex)){const ut=this.getMatcher(0);ut.lastIndex=this.lastIndex+1,vt=ut.exec(Y)}return vt&&(this.regexIndex+=vt.position+1,this.regexIndex===this.count&&this.considerAll()),vt}}function Qe(ne){const Y=new ge;return ne.contains.forEach(ye=>Y.addRule(ye.begin,{rule:ye,type:"begin"})),ne.terminatorEnd&&Y.addRule(ne.terminatorEnd,{type:"end"}),ne.illegal&&Y.addRule(ne.illegal,{type:"illegal"}),Y}function We(ne,Y){const ye=ne;if(ne.isCompiled)return ye;[or,rr,Ii,_o].forEach(ut=>ut(ne,Y)),E.compilerExtensions.forEach(ut=>ut(ne,Y)),ne.__beforeBegin=null,[Bo,Ro,Tn].forEach(ut=>ut(ne,Y)),ne.isCompiled=!0;let vt=null;return typeof ne.keywords=="object"&&ne.keywords.$pattern&&(ne.keywords=Object.assign({},ne.keywords),vt=ne.keywords.$pattern,delete ne.keywords.$pattern),vt=vt||/\w+/,ne.keywords&&(ne.keywords=Pt(ne.keywords,E.case_insensitive)),ye.keywordPatternRe=_(vt,!0),Y&&(ne.begin||(ne.begin=/\B|\b/),ye.beginRe=_(ye.begin),!ne.end&&!ne.endsWithParent&&(ne.end=/\B|\b/),ne.end&&(ye.endRe=_(ye.end)),ye.terminatorEnd=f(ye.end)||"",ne.endsWithParent&&Y.terminatorEnd&&(ye.terminatorEnd+=(ne.end?"|":"")+Y.terminatorEnd)),ne.illegal&&(ye.illegalRe=_(ne.illegal)),ne.contains||(ne.contains=[]),ne.contains=[].concat(...ne.contains.map(function(ut){return P(ut==="self"?ne:ut)})),ne.contains.forEach(function(ut){We(ut,ye)}),ne.starts&&We(ne.starts,Y),ye.matcher=Qe(ye),ye}if(E.compilerExtensions||(E.compilerExtensions=[]),E.contains&&E.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return E.classNameAliases=o(E.classNameAliases||{}),We(E)}function T(E){return E?E.endsWithParent||T(E.starts):!1}function P(E){return E.variants&&!E.cachedVariants&&(E.cachedVariants=E.variants.map(function(_){return o(E,{variants:null},_)})),E.cachedVariants?E.cachedVariants:T(E)?o(E,{starts:E.starts?o(E.starts):null}):Object.isFrozen(E)?o(E):E}var ee="11.11.1";class be extends Error{constructor(_,j){super(_),this.name="HTMLInjectionError",this.html=j}}const fe=t,ct=o,Tt=Symbol("nomatch"),lr=7,Fs=function(E){const _=Object.create(null),j=Object.create(null),ge=[];let Qe=!0;const We="Could not find the language '{}', did you forget to load/include a language module?",ne={disableAutodetect:!0,name:"Plain text",contains:[]};let Y={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:d};function ye(F){return Y.noHighlightRe.test(F)}function vt(F){let ae=F.className+" ";ae+=F.parentNode?F.parentNode.className:"";const Oe=Y.languageDetectRe.exec(ae);if(Oe){const qe=ar(Oe[1]);return qe||(Do(We.replace("{}",Oe[1])),Do("Falling back to no-highlight mode for this block.",F)),qe?Oe[1]:"no-highlight"}return ae.split(/\s+/).find(qe=>ye(qe)||ar(qe))}function ut(F,ae,Oe){let qe="",bt="";typeof ae=="object"?(qe=F,Oe=ae.ignoreIllegals,bt=ae.language):(Vt("10.7.0","highlight(lang, code, ...args) has been deprecated."),Vt("10.7.0",`Please use highlight(code, options) instead.
|
|
278
|
+
https://github.com/highlightjs/highlight.js/issues/2277`),bt=F,qe=ae),Oe===void 0&&(Oe=!0);const Un={code:qe,language:bt};Ta("before:highlight",Un);const cr=Un.result?Un.result:Hs(Un.language,Un.code,Oe);return cr.code=Un.code,Ta("after:highlight",cr),cr}function Hs(F,ae,Oe,qe){const bt=Object.create(null);function Un(K,ie){return K.keywords[ie]}function cr(){if(!xe.keywords){Nt.addText(Ke);return}let K=0;xe.keywordPatternRe.lastIndex=0;let ie=xe.keywordPatternRe.exec(Ke),Me="";for(;ie;){Me+=Ke.substring(K,ie.index);const Pe=co.case_insensitive?ie[0].toLowerCase():ie[0],zt=Un(xe,Pe);if(zt){const[Io,VT]=zt;if(Nt.addText(Me),Me="",bt[Pe]=(bt[Pe]||0)+1,bt[Pe]<=lr&&(Oa+=VT),Io.startsWith("_"))Me+=ie[0];else{const zT=co.classNameAliases[Io]||Io;ao(ie[0],zT)}}else Me+=ie[0];K=xe.keywordPatternRe.lastIndex,ie=xe.keywordPatternRe.exec(Ke)}Me+=Ke.substring(K),Nt.addText(Me)}function Na(){if(Ke==="")return;let K=null;if(typeof xe.subLanguage=="string"){if(!_[xe.subLanguage]){Nt.addText(Ke);return}K=Hs(xe.subLanguage,Ke,!0,fy[xe.subLanguage]),fy[xe.subLanguage]=K._top}else K=Zd(Ke,xe.subLanguage.length?xe.subLanguage:null);xe.relevance>0&&(Oa+=K.relevance),Nt.__addSublanguage(K._emitter,K.language)}function yn(){xe.subLanguage!=null?Na():cr(),Ke=""}function ao(K,ie){K!==""&&(Nt.startScope(ie),Nt.addText(K),Nt.endScope())}function ay(K,ie){let Me=1;const Pe=ie.length-1;for(;Me<=Pe;){if(!K._emit[Me]){Me++;continue}const zt=co.classNameAliases[K[Me]]||K[Me],Io=ie[Me];zt?ao(Io,zt):(Ke=Io,cr(),Ke=""),Me++}}function cy(K,ie){return K.scope&&typeof K.scope=="string"&&Nt.openNode(co.classNameAliases[K.scope]||K.scope),K.beginScope&&(K.beginScope._wrap?(ao(Ke,co.classNameAliases[K.beginScope._wrap]||K.beginScope._wrap),Ke=""):K.beginScope._multi&&(ay(K.beginScope,ie),Ke="")),xe=Object.create(K,{parent:{value:xe}}),xe}function uy(K,ie,Me){let Pe=w(K.endRe,Me);if(Pe){if(K["on:end"]){const zt=new e(K);K["on:end"](ie,zt),zt.isMatchIgnored&&(Pe=!1)}if(Pe){for(;K.endsParent&&K.parent;)K=K.parent;return K}}if(K.endsWithParent)return uy(K.parent,ie,Me)}function _T(K){return xe.matcher.regexIndex===0?(Ke+=K[0],1):(of=!0,0)}function DT(K){const ie=K[0],Me=K.rule,Pe=new e(Me),zt=[Me.__beforeBegin,Me["on:begin"]];for(const Io of zt)if(Io&&(Io(K,Pe),Pe.isMatchIgnored))return _T(ie);return Me.skip?Ke+=ie:(Me.excludeBegin&&(Ke+=ie),yn(),!Me.returnBegin&&!Me.excludeBegin&&(Ke=ie)),cy(Me,K),Me.returnBegin?0:ie.length}function IT(K){const ie=K[0],Me=ae.substring(K.index),Pe=uy(xe,K,Me);if(!Pe)return Tt;const zt=xe;xe.endScope&&xe.endScope._wrap?(yn(),ao(ie,xe.endScope._wrap)):xe.endScope&&xe.endScope._multi?(yn(),ay(xe.endScope,K)):zt.skip?Ke+=ie:(zt.returnEnd||zt.excludeEnd||(Ke+=ie),yn(),zt.excludeEnd&&(Ke=ie));do xe.scope&&Nt.closeNode(),!xe.skip&&!xe.subLanguage&&(Oa+=xe.relevance),xe=xe.parent;while(xe!==Pe.parent);return Pe.starts&&cy(Pe.starts,K),zt.returnEnd?0:ie.length}function LT(){const K=[];for(let ie=xe;ie!==co;ie=ie.parent)ie.scope&&K.unshift(ie.scope);K.forEach(ie=>Nt.openNode(ie))}let Aa={};function dy(K,ie){const Me=ie&&ie[0];if(Ke+=K,Me==null)return yn(),0;if(Aa.type==="begin"&&ie.type==="end"&&Aa.index===ie.index&&Me===""){if(Ke+=ae.slice(ie.index,ie.index+1),!Qe){const Pe=new Error(`0 width match regex (${F})`);throw Pe.languageName=F,Pe.badRule=Aa.rule,Pe}return 1}if(Aa=ie,ie.type==="begin")return DT(ie);if(ie.type==="illegal"&&!Oe){const Pe=new Error('Illegal lexeme "'+Me+'" for mode "'+(xe.scope||"<unnamed>")+'"');throw Pe.mode=xe,Pe}else if(ie.type==="end"){const Pe=IT(ie);if(Pe!==Tt)return Pe}if(ie.type==="illegal"&&Me==="")return Ke+=`
|
|
279
|
+
`,1;if(nf>1e5&&nf>ie.index*3)throw new Error("potential infinite loop, way more iterations than matches");return Ke+=Me,Me.length}const co=ar(F);if(!co)throw Qt(We.replace("{}",F)),new Error('Unknown language: "'+F+'"');const PT=Li(co);let tf="",xe=qe||PT;const fy={},Nt=new Y.__emitter(Y);LT();let Ke="",Oa=0,Wr=0,nf=0,of=!1;try{if(co.__emitTokens)co.__emitTokens(ae,Nt);else{for(xe.matcher.considerAll();;){nf++,of?of=!1:xe.matcher.considerAll(),xe.matcher.lastIndex=Wr;const K=xe.matcher.exec(ae);if(!K)break;const ie=ae.substring(Wr,K.index),Me=dy(ie,K);Wr=K.index+Me}dy(ae.substring(Wr))}return Nt.finalize(),tf=Nt.toHTML(),{language:F,value:tf,relevance:Oa,illegal:!1,_emitter:Nt,_top:xe}}catch(K){if(K.message&&K.message.includes("Illegal"))return{language:F,value:fe(ae),illegal:!0,relevance:0,_illegalBy:{message:K.message,index:Wr,context:ae.slice(Wr-100,Wr+100),mode:K.mode,resultSoFar:tf},_emitter:Nt};if(Qe)return{language:F,value:fe(ae),illegal:!1,relevance:0,errorRaised:K,_emitter:Nt,_top:xe};throw K}}function Qd(F){const ae={value:fe(F),illegal:!1,relevance:0,_top:ne,_emitter:new Y.__emitter(Y)};return ae._emitter.addText(F),ae}function Zd(F,ae){ae=ae||Y.languages||Object.keys(_);const Oe=Qd(F),qe=ae.filter(ar).filter(ly).map(yn=>Hs(yn,F,!1));qe.unshift(Oe);const bt=qe.sort((yn,ao)=>{if(yn.relevance!==ao.relevance)return ao.relevance-yn.relevance;if(yn.language&&ao.language){if(ar(yn.language).supersetOf===ao.language)return 1;if(ar(ao.language).supersetOf===yn.language)return-1}return 0}),[Un,cr]=bt,Na=Un;return Na.secondBest=cr,Na}function CT(F,ae,Oe){const qe=ae&&j[ae]||Oe;F.classList.add("hljs"),F.classList.add(`language-${qe}`)}function ef(F){let ae=null;const Oe=vt(F);if(ye(Oe))return;if(Ta("before:highlightElement",{el:F,language:Oe}),F.dataset.highlighted){console.log("Element previously highlighted. To highlight again, first unset `dataset.highlighted`.",F);return}if(F.children.length>0&&(Y.ignoreUnescapedHTML||(console.warn("One of your code blocks includes unescaped HTML. This is a potentially serious security risk."),console.warn("https://github.com/highlightjs/highlight.js/wiki/security"),console.warn("The element with unescaped HTML:"),console.warn(F)),Y.throwUnescapedHTML))throw new be("One of your code blocks includes unescaped HTML.",F.innerHTML);ae=F;const qe=ae.textContent,bt=Oe?ut(qe,{language:Oe,ignoreIllegals:!0}):Zd(qe);F.innerHTML=bt.value,F.dataset.highlighted="yes",CT(F,Oe,bt.language),F.result={language:bt.language,re:bt.relevance,relevance:bt.relevance},bt.secondBest&&(F.secondBest={language:bt.secondBest.language,relevance:bt.secondBest.relevance}),Ta("after:highlightElement",{el:F,result:bt,text:qe})}function ST(F){Y=ct(Y,F)}const ET=()=>{Ma(),Vt("10.6.0","initHighlighting() deprecated. Use highlightAll() now.")};function MT(){Ma(),Vt("10.6.0","initHighlightingOnLoad() deprecated. Use highlightAll() now.")}let iy=!1;function Ma(){function F(){Ma()}if(document.readyState==="loading"){iy||window.addEventListener("DOMContentLoaded",F,!1),iy=!0;return}document.querySelectorAll(Y.cssSelector).forEach(ef)}function TT(F,ae){let Oe=null;try{Oe=ae(E)}catch(qe){if(Qt("Language definition for '{}' could not be registered.".replace("{}",F)),Qe)Qt(qe);else throw qe;Oe=ne}Oe.name||(Oe.name=F),_[F]=Oe,Oe.rawDefinition=ae.bind(null,E),Oe.aliases&&sy(Oe.aliases,{languageName:F})}function NT(F){delete _[F];for(const ae of Object.keys(j))j[ae]===F&&delete j[ae]}function AT(){return Object.keys(_)}function ar(F){return F=(F||"").toLowerCase(),_[F]||_[j[F]]}function sy(F,{languageName:ae}){typeof F=="string"&&(F=[F]),F.forEach(Oe=>{j[Oe.toLowerCase()]=ae})}function ly(F){const ae=ar(F);return ae&&!ae.disableAutodetect}function OT(F){F["before:highlightBlock"]&&!F["before:highlightElement"]&&(F["before:highlightElement"]=ae=>{F["before:highlightBlock"](Object.assign({block:ae.el},ae))}),F["after:highlightBlock"]&&!F["after:highlightElement"]&&(F["after:highlightElement"]=ae=>{F["after:highlightBlock"](Object.assign({block:ae.el},ae))})}function $T(F){OT(F),ge.push(F)}function BT(F){const ae=ge.indexOf(F);ae!==-1&&ge.splice(ae,1)}function Ta(F,ae){const Oe=F;ge.forEach(function(qe){qe[Oe]&&qe[Oe](ae)})}function RT(F){return Vt("10.7.0","highlightBlock will be removed entirely in v12.0"),Vt("10.7.0","Please use highlightElement now."),ef(F)}Object.assign(E,{highlight:ut,highlightAuto:Zd,highlightAll:Ma,highlightElement:ef,highlightBlock:RT,configure:ST,initHighlighting:ET,initHighlightingOnLoad:MT,registerLanguage:TT,unregisterLanguage:NT,listLanguages:AT,getLanguage:ar,registerAliases:sy,autoDetection:ly,inherit:ct,addPlugin:$T,removePlugin:BT}),E.debugMode=function(){Qe=!1},E.safeMode=function(){Qe=!0},E.versionString=ee,E.regex={concat:g,lookahead:p,either:b,optional:m,anyNumberOfTimes:h};for(const F in yt)typeof yt[F]=="object"&&n(yt[F]);return Object.assign(E,yt),E},an=Fs({});return an.newInstance=()=>Fs({}),Yf=an,an.HighlightJS=an,an.default=an,Yf}var T4=M4();const N4=E4(T4);function rM(n,e=[]){return n.flatMap(t=>{const o=[...e,...t.properties?t.properties.className:[]];return t.children?rM(t.children,o):{text:t.value,classes:o}})}function Ck(n){return n.value||n.children||[]}function A4(n){return!!N4.getLanguage(n)}function Sk({doc:n,name:e,lowlight:t,defaultLanguage:o}){const r=[];return Ar(n,i=>i.type.name===e).forEach(i=>{var s;let l=i.pos+1;const a=i.node.attrs.language||o,u=t.listLanguages(),d=a&&(u.includes(a)||A4(a)||(s=t.registered)!=null&&s.call(t,a))?Ck(t.highlight(a,i.node.textContent)):Ck(t.highlightAuto(i.node.textContent));rM(d).forEach(f=>{const p=l+f.text.length;if(f.classes.length){const h=Ve.inline(l,p,{class:f.classes.join(" ")});r.push(h)}l=p})}),Se.create(n,r)}function O4(n){return typeof n=="function"}function $4({name:n,lowlight:e,defaultLanguage:t}){if(!["highlight","highlightAuto","listLanguages"].every(r=>O4(e[r])))throw Error("You should provide an instance of lowlight to use the code-block-lowlight extension");const o=new ue({key:new ce("lowlight"),state:{init:(r,{doc:i})=>Sk({doc:i,name:n,lowlight:e,defaultLanguage:t}),apply:(r,i,s,l)=>{const a=s.selection.$head.parent.type.name,u=l.selection.$head.parent.type.name,d=Ar(s.doc,p=>p.type.name===n),f=Ar(l.doc,p=>p.type.name===n);return r.docChanged&&([a,u].includes(n)||f.length!==d.length||r.steps.some(p=>p.from!==void 0&&p.to!==void 0&&d.some(h=>h.pos>=p.from&&h.pos+h.node.nodeSize<=p.to)))?Sk({doc:r.doc,name:n,lowlight:e,defaultLanguage:t}):i.map(r.mapping,r.doc)}},props:{decorations(r){return o.getState(r)}}});return o}var B4=sR.extend({addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),lowlight:{},languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],$4({name:this.name,lowlight:this.options.lowlight,defaultLanguage:this.options.defaultLanguage})]}}),R4=B4;const _4=n=>({name:"Mermaid",aliases:["mermaid"],case_insensitive:!0,contains:[n.COMMENT(/%%(?!\{)/,/$/),{className:"meta",begin:/%%\{/,end:/\}%%/,contains:[{className:"attr",begin:/[A-Za-z][A-Za-z0-9_-]*(?=\s*:)/},{className:"string",begin:/:\s*/,end:/(?=(,\s*[A-Za-z]|$))/,excludeBegin:!0}]},{className:"meta",begin:/^---$/,end:/^---$/,contains:[{className:"attr",begin:/\b[A-Za-z][A-Za-z0-9_-]*(?=\s*:)/},{className:"string",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{className:"keyword",begin:/(^|\s)(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|journey|pie|gantt|requirement|sankey|timeline|quadrant|gitGraph|mindmap|xychart|block|packet|kanban|architecture|radar|treemap|C4Context)(?:\s+(?:LR|TB|RL|BT))?\b/},{className:"built_in",begin:/^(?:\s*)(participant|loop|end|Note right of|note|class|title|section|dateFormat|x-axis|y-axis|bar|line)\b/},{className:"symbol",begin:/(<<?-+>?|--+>|==+>|->|-\.-|==|->>|-->>|<\|--|--\|>|<\|>|:>|o--o|x--x|\*--|o\{--|\}o--)/,relevance:20},{className:"literal",begin:/\b[A-Za-z0-9_]+\s*-[->]+[A-Za-z0-9_]+\s*:/,end:/$/,contains:[{className:"string",begin:/:\s*/,end:/$/,excludeBegin:!0}]},{className:"regexp",variants:[{begin:/\[[^\]]+\]/},{begin:/\([^)]+\)/},{begin:/\(\([^)]+\)\)/},{begin:/\{[^}]+\}/},{begin:/>[^<]+</},{begin:/\[\[[^\]]+\]\]/}]},{className:"string",begin:/note\s+(?:left|right|top|bottom)\s+of\s+[A-Za-z0-9_]+/i},{className:"string",variants:[{begin:/'.*?'/},{begin:/".*?"/}]},{className:"number",begin:/\b\d+([:.]\d+)?\b/}]});/**
|
|
280
|
+
* Copyright 2026 Yiitap
|
|
281
|
+
* @license MIT
|
|
282
|
+
**/function D4(n){const e=document.createElement("textarea");e.value=n,e.contentEditable="true",e.style.position="fixed",document.body.appendChild(e),e.focus(),e.select();const t=document.execCommand("copy");return e.remove(),t}function I4(n){return navigator.clipboard!==void 0?navigator.clipboard.writeText(n):new Promise((e,t)=>{const o=D4(n);o?e(!0):t(o)})}const L4=()=>SS(),P4={class:"code-block-toolbar"},V4={class:"wrap"},z4={class:"language readonly"},F4={class:"wrap"},H4=["srcdoc"],j4={key:1,ref:"mermaidMount",class:"tiptap ProseMirror mermaid-split-horizontal"},U4={key:0,class:"preview"},W4={key:0,class:"error"},q4=["innerHTML"],K4=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n,{commonDownload:t}=wd(),{tr:o}=de(),{darkMode:r}=Bi(),{isEditable:i}=ke(),s=c.ref("content_copy"),l=c.ref({show:!1,fullscreen:!1}),a=c.ref(""),u=c.ref(""),d=c.ref(""),f=c.ref(""),p=c.ref("splitVertical"),h=c.ref(""),m=c.ref("default");rf.registerLayoutLoaders(KT);const g={layout:"elk",elk:{},flowchart:{curve:"bumpY"}},y=c.computed({get(){return e.node.attrs.language},set(U){e.updateAttributes({language:U})}}),b=c.computed(()=>{var U;return((U=e.node.content.content[0])==null?void 0:U.text)||""}),v=c.computed({get(){return e.node.attrs.wrap},set(U){e.updateAttributes({wrap:U})}}),w=c.computed(()=>["html","svg"].includes(y.value)),k=c.computed(()=>v.value?"text_select_move_down":"format_text_wrap"),x=c.computed(()=>y.value==="mermaid"),C=c.computed(()=>y.value==="mermaid"?i.value?p.value:"preview":"");function S(U){y.value=U}function M(){const U=e.node.content.content[0].text;I4(U).then(()=>{s.value="done",setTimeout(()=>{s.value="content_copy"},2e3)})}function N(U="code"){switch(U){case"svg":$();break;default:A();break}}function A(){const U=y.value;let me=U;const Ee=Qs.find(Fe=>Fe.value===U);Ee&&(me=Ee.ext.at(0));const Re=`${U}-${Date.now()}.${me}`,Ue=e.node.content.content[0].text;t("code",Re,Ue)}function $(){if(!d.value)return;const U=`mermaid-${Date.now()}.svg`,me=d.value;t("svg",U,me)}function O(){const U=e.node.content.content[0].text;u.value=I(U),a.value="run",l.value={show:!0,fullscreen:!1}}function R(){a.value==="mermaid"&&(p.value=h.value)}function I(U){return`
|
|
64
283
|
<style>
|
|
65
284
|
body { margin: 0 !important; padding: 0; }
|
|
66
285
|
</style>
|
|
67
|
-
${
|
|
68
|
-
`}function O(){_.value=!_.value}function M(){switch(v.value){case"mermaid":U();break}}function L(){Vo.initialize({...f,theme:a.value?"dark":m.value}),M()}async function U(){try{u.value="";const S=`mermaid-${lb()}`,{svg:H}=await Vo.render(S,b.value);d.value=H}catch(S){console.error(S),u.value=S.message}}return e.watch(b,S=>{M()}),e.watch(v,S=>{M()}),e.watch(a,S=>{L()}),e.onMounted(()=>{var H;const S=n.editor.extensionManager.extensions.find(T=>T.name==="codeBlock");m.value=((H=S==null?void 0:S.options)==null?void 0:H.diagramTheme)||"default",L()}),(S,H)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:["o-code-block-view",`language-${v.value} ${g.value}`]}),{default:e.withCtx(()=>[e.createElementVNode("div",sb,[e.createElementVNode("div",cb,[e.createElementVNode("div",ub,e.toDisplayString(v.value),1),e.createVNode(e.unref(Qa),{language:v.value,class:"editable",onSelect:C},null,8,["language"])]),e.createElementVNode("div",db,[g.value?(e.openBlock(),e.createBlock(e.unref(La),{key:0,modelValue:p.value,"onUpdate:modelValue":H[0]||(H[0]=T=>p.value=T),class:"editable"},null,8,["modelValue"])):e.createCommentVNode("",!0),e.createVNode(e.unref(me),{icon:w.value,"icon-class":{"rotate-270":_.value},tooltip:"Wrap",class:"editable",onClick:O},null,8,["icon","icon-class"]),y.value?(e.openBlock(),e.createBlock(e.unref(Da),{key:1,onDownload:R})):(e.openBlock(),e.createBlock(e.unref(me),{key:2,icon:"download",tooltip:e.unref(r)("label.download"),onClick:R},null,8,["tooltip"])),h.value?(e.openBlock(),e.createBlock(e.unref(me),{key:3,icon:"play_circle",tooltip:"Run",onClick:P})):e.createCommentVNode("",!0),e.createVNode(e.unref(me),{icon:i.value,tooltip:e.unref(r)("label.copy"),onClick:E},null,8,["icon","tooltip"])])]),e.createVNode(e.unref(Vi),{show:s.value,"onUpdate:show":H[1]||(H[1]=T=>s.value=T)},{title:e.withCtx(()=>[...H[2]||(H[2]=[e.createTextVNode("Run",-1)])]),default:e.withCtx(()=>[e.createElementVNode("iframe",{sandbox:"allow-same-origin allow-scripts",srcdoc:c.value},null,8,pb)]),_:1},8,["show"]),e.createElementVNode("pre",null,[e.createVNode(e.unref(G.NodeViewContent),{as:"code",class:e.normalizeClass({wrap:_.value})},null,8,["class"])]),y.value?(e.openBlock(),e.createElementBlock("section",fb,[u.value?(e.openBlock(),e.createElementBlock("div",mb,e.toDisplayString(u.value),1)):(e.openBlock(),e.createElementBlock("div",{key:1,class:"mermaid-svg",innerHTML:d.value},null,8,gb))])):e.createCommentVNode("",!0)]),_:1},16,["class"]))}}),ll=Jg(Wg);ll.register("mermaid",tb);const vb=ts.extend({draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),diagramTheme:"default"}},addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),wrap:{default:!0,rendered:!1}}},addNodeView(){return G.VueNodeViewRenderer(bb)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",diagramTheme:"neutral",lowlight:ll}),hb=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t,o=e.ref(!!n.node.attrs.open);function r(){const a=!o.value;o.value=a,n.updateAttributes({open:a})}return(a,l)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:"o-details-view"}),{default:e.withCtx(()=>[e.createElementVNode("div",{class:e.normalizeClass(["details",{"is-open":o.value}])},[e.createElementVNode("button",{type:"button",onClick:r},[e.createVNode(e.unref($),{name:"details_arrow"})]),e.createVNode(e.unref(G.NodeViewContent))],2)]),_:1},16))}}),_b=Wo.Details.extend({draggable:!0,addOptions(){var t;return{...(t=this.parent)==null?void 0:t.call(this),triggerCharacters:[">"]}},addInputRules(){const{triggerCharacters:t}=this.options,n=t.map(r=>r.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),o=new RegExp(`^[${n}]\\s$`);return[new Ae.InputRule({find:o,handler:({state:r,range:a})=>{const{tr:l,schema:i}=r,{$from:s}=l.selection,c=s.before(s.depth),d=s.after(s.depth);l.delete(a.from,a.to);const u=i.nodes.details.create(null,[i.nodes.detailsSummary.create(null),i.nodes.detailsContent.create(null,i.nodes.paragraph.create())]);l.replaceRangeWith(c,d,u);const p=Ct.TextSelection.near(l.doc.resolve(c+2));return l.setSelection(p),l}})]},addNodeView(){return G.VueNodeViewRenderer(hb)}}),kb=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t,o=e.computed(()=>n.node.attrs.level);return(r,a)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:["o-heading-view",`h${o.value}`],style:`text-align: ${r.node.attrs.textAlign}`}),{default:e.withCtx(()=>[e.createVNode(e.unref(G.NodeViewContent))]),_:1},16,["class","style"]))}}),yb=rs.extend({draggable:!0,addNodeView(){return G.VueNodeViewRenderer(kb)}}),wb={class:"horizontal"},Eb=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t;return(o,r)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:"o-horizontal-view"}),{default:e.withCtx(()=>[e.createElementVNode("div",wb,[e.createVNode(e.unref(G.NodeViewContent),{as:"div",class:"divider"})])]),_:1},16))}}),Cb=as.extend({draggable:!0,addNodeView(){return G.VueNodeViewRenderer(Eb)}}),xb={key:1,class:"image-panel"},Nb={key:1,class:"resize-overlay"},Sb={class:"resize-guide"},Tb={class:"size-display"},Ob={key:1},Ab=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t,{tr:o}=Z(),{downloadImage:r}=mo(),{isEditable:a,getEditorImages:l}=oe(),i=e.ref(!1),s=e.ref(!1),c=e.ref({}),d=e.ref(null),u=e.ref(!1),p=e.ref(!1),m=e.ref(0),f=e.ref([]),v=e.ref(),b=e.ref(null),_=e.ref(null),h=e.ref(null),w=e.ref(!1),y=e.ref(""),g=e.ref(0),C=e.ref(0),E=e.ref(0),R=e.ref(0),D=e.ref(n.node.attrs.width||0),A=e.ref(n.node.attrs.height||0),P=e.ref(0),j=e.ref(0),O=e.ref(0),M=e.ref(1200),L=e.ref(0),U=e.ref(0),S=e.ref(800),H=e.ref(400),T=e.ref(!1),X=e.computed(()=>n.node.attrs),ie=e.computed({get(){return n.node.attrs.src},set(ne){n.updateAttributes({src:ne})}}),ge=e.computed({get(){return n.node.attrs.title},set(ne){n.updateAttributes({title:ne})}});function be(){u.value=!0,setTimeout(()=>{var ne;(ne=d.value)==null||ne.focus()},0)}function Be(){r(n.node.attrs.src)}function $e(){f.value=l(n.editor),m.value=f.value.findIndex(ne=>ne.pos===n.getPos())||0,p.value=!0}function Re(){u.value=!1}function Y(){ie.value==="init"&&Ne(!0)}function le(ne){switch(i.value=!1,ne.value){case"replace":Ne(!0);break}}function ce(ne){ie.value=ne,Ne(!1)}function Ne(ne){s.value=ne}const Me=e.computed(()=>({width:`${D.value}px`,maxWidth:`${M.value}px`,height:`${P.value}px`,maxHeight:T.value?`${L.value}px`:"auto",cursor:w.value?rt():"default"}));function rt(){switch(y.value){case"left":return"ew-resize";case"right":return"ew-resize";case"center":return"ew-resize";default:return"default"}}function ht(){var ne,re,ze;if(h.value){j.value=h.value.naturalWidth,O.value=h.value.naturalHeight,S.value=((re=(ne=v.value)==null?void 0:ne.$el)==null?void 0:re.parentElement.getBoundingClientRect().width)??0,M.value=((ze=document.querySelector(".layout"))==null?void 0:ze.getBoundingClientRect().width)??1200;const Ce=j.value/O.value;S.value=Math.min(S.value,800),H.value=S.value/Ce,(!D.value||!A.value)&&(T.value=j.value>S.value,T.value?(D.value=S.value,A.value=S.value/j.value*O.value):(D.value=j.value,A.value=O.value),ue()),P.value=A.value,U.value=A.value,L.value=A.value}}function Xe(ne,re){w.value=!0,y.value=re,E.value=ne.clientX,R.value=ne.clientY,g.value=D.value,C.value=A.value,document.addEventListener("mousemove",ut),document.addEventListener("mouseup",dt)}function ut(ne){if(!w.value)return;const re=ne.clientX-E.value,ze=ne.clientY-R.value,Ce=j.value/O.value;let Se=g.value,_t=U.value;switch(y.value){case"left":Se=g.value-re;break;case"right":Se=g.value+re;break;case"bottom":_t=U.value+ze;break}const at=Se/Ce;D.value=Math.round(Se),A.value=Math.round(at),T.value=Se>S.value,T.value?(P.value=_t,L.value=A.value):P.value=A.value}function dt(){w.value=!1,y.value="",document.removeEventListener("mousemove",ut),document.removeEventListener("mouseup",dt),U.value=P.value,ue()}function ue(){n.updateAttributes({width:D.value,height:A.value})}return e.watch(()=>n.node.attrs.height,ne=>{ne&&(A.value=ne)}),e.onMounted(()=>{Ne(ie.value==="init"),X.value.width&&(D.value=X.value.width),X.value.height&&(A.value=X.value.height)}),e.onUnmounted(()=>{document.removeEventListener("mousemove",()=>{}),document.removeEventListener("mouseup",()=>{})}),(ne,re)=>{var ze;return e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps({ref_key:"imageView",ref:v},n,{class:["o-image-view",{max:T.value,"with-caption":X.value.alt,"with-ratio":X.value.ratio,readonly:!((ze=ne.editor)!=null&&ze.isEditable),init:ie.value==="init"}],size:X.value.size,as:"div",onClick:Y}),{default:e.withCtx(()=>[e.createVNode(e.unref(St),{modelValue:s.value,"onUpdate:modelValue":re[4]||(re[4]=Ce=>s.value=Ce),placement:ie.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(pr),{val:ie.value==="init"?"":ie.value,type:"image",onInput:ce},null,8,["val"])]),default:e.withCtx(()=>{var Ce;return[ie.value==="init"?(e.openBlock(),e.createBlock(e.unref(uo),{key:0,icon:"image",placeholder:"Add an image"})):(e.openBlock(),e.createElementBlock("div",xb,[e.createVNode(e.unref(ur),e.mergeProps(n,{trigger:"mouseenter",onAction:le}),{default:e.withCtx(()=>[e.unref(a)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(me),{icon:"subtitles",tooltip:e.unref(o)("image.caption"),onClick:e.withModifiers(be,["stop"])},null,8,["tooltip"]),e.createVNode(e.unref(ir),{editor:ne.editor},null,8,["editor"]),e.createVNode(e.unref(ar),{editor:ne.editor,placement:"bottom-end",trigger:"mouseenter"},null,8,["editor"])],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(me),{icon:"download",tooltip:e.unref(o)("label.download"),onClick:Be},null,8,["tooltip"]),e.createVNode(e.unref(me),{icon:"zoom_in",tooltip:e.unref(o)("image.zoom"),onClick:$e},null,8,["tooltip"])]),_:1},16),e.createElementVNode("div",{ref_key:"imageContainer",ref:b,class:"image-container",style:e.normalizeStyle(Me.value)},[e.createElementVNode("div",{ref_key:"imageWrapper",ref:_,class:"image-wrapper"},[e.createElementVNode("img",e.mergeProps({ref_key:"imageElement",ref:h},X.value,{draggable:"true","data-drag-handle":"",onLoad:ht}),null,16)],512),e.unref(a)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createElementVNode("div",{class:"block-resizer left",onMousedown:re[0]||(re[0]=e.withModifiers(Se=>Xe(Se,"left"),["stop","prevent"]))},[...re[7]||(re[7]=[e.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),e.createElementVNode("div",{class:"block-resizer right",onMousedown:re[1]||(re[1]=e.withModifiers(Se=>Xe(Se,"right"),["stop","prevent"]))},[...re[8]||(re[8]=[e.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),T.value?(e.openBlock(),e.createElementBlock("div",{key:0,class:"block-resizer bottom",onMousedown:re[2]||(re[2]=e.withModifiers(Se=>Xe(Se,"bottom"),["stop","prevent"]))},[...re[9]||(re[9]=[e.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32)):e.createCommentVNode("",!0),w.value?(e.openBlock(),e.createElementBlock("div",Nb,[e.createElementVNode("div",Sb,[e.createElementVNode("div",Tb,e.toDisplayString(D.value)+" × "+e.toDisplayString(P.value),1)])])):e.createCommentVNode("",!0)],64)):e.createCommentVNode("",!0)],4),e.createElementVNode("div",{class:"caption",onClick:be},[(Ce=ne.editor)!=null&&Ce.isEditable&&u.value?(e.openBlock(),e.createBlock(e.unref(vt),{key:0,ref_key:"captionInput",ref:d,class:"caption-input",modelValue:ge.value,"onUpdate:modelValue":re[3]||(re[3]=Se=>ge.value=Se),type:"text",placeholder:"Input caption",autosize:"",onBlur:Re},null,8,["modelValue"])):(e.openBlock(),e.createElementBlock("span",Ob,e.toDisplayString(ge.value),1))])]))]}),_:1},8,["modelValue","placement"]),e.createVNode(e.unref(Mn),{modelValue:i.value,"onUpdate:modelValue":re[5]||(re[5]=Ce=>i.value=Ce),event:c.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ut),e.mergeProps(n,{onAction:le}),null,16)]),_:1},8,["modelValue","event"]),e.createVNode(e.unref($i),{show:p.value,"onUpdate:show":re[6]||(re[6]=Ce=>p.value=Ce),images:f.value,current:m.value},{title:e.withCtx(()=>[...re[10]||(re[10]=[e.createTextVNode("Run",-1)])]),_:1},8,["show","images","current"])]),_:1},16,["class","size"])}}}),Bb=is.extend({addNodeView(){return G.VueNodeViewRenderer(Ab)}}).configure({inline:!0});function Mb(t){return new Ct.Plugin({key:new Ct.PluginKey("handleClickSelectLink"),props:{handleClick:(n,o,r)=>{const{schema:a,doc:l,tr:i}=n.state,s=Ae.getMarkRange(l.resolve(o),a.marks.link);if(!s)return!1;const c=l.resolve(s.from),d=l.resolve(s.to),u=i.setSelection(new Ct.TextSelection(c,d));return n.dispatch(u),!0}}})}const Rb=Oa.extend({addProseMirrorPlugins(){var t;return[...((t=this.parent)==null?void 0:t.call(this))||[],Mb({type:this.type})]}}).configure({openOnClick:!1}),Ib=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t;return(o,r)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:"o-paragraph-view"}),{default:e.withCtx(()=>[e.createVNode(e.unref(G.NodeViewContent),{as:"p",style:e.normalizeStyle(`text-align: ${o.node.attrs.textAlign}`)},null,8,["style"])]),_:1},16))}}),Db=ls.extend({draggable:!1,addNodeView(){return G.VueNodeViewRenderer(Ib,{stopEvent:()=>!1})}}),Lb={class:"add"},Vb=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t,{tr:o}=Z(),{isEditable:r,run:a}=oe(),l=e.ref(!1);function i(){l.value=!0}function s(){c("tableSelectRow",{pos:n.getPos()})}function c(d,u={}){d==="tableDeleteRow"&&(l.value=!1),setTimeout(()=>{a(n.editor,d,u)},0)}return(d,u)=>(e.openBlock(),e.createBlock(e.unref(G.NodeViewWrapper),e.mergeProps({class:"o-table-cell-view",as:"td"},d.node.attrs,{style:{background:d.node.attrs.background}}),{default:e.withCtx(()=>[e.unref(r)?(e.openBlock(),e.createBlock(e.unref(St),{key:0,modelValue:l.value,"onUpdate:modelValue":u[2]||(u[2]=p=>l.value=p),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"select_all",placement:"left",tooltip:e.unref(o)("table.selectRow"),onClick:s},null,8,["tooltip"]),e.createVNode(e.unref(Te),{icon:"delete",placement:"left",tooltip:e.unref(o)("table.removeRow"),onClick:u[1]||(u[1]=p=>c("tableDeleteRow"))},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createElementVNode("section",{class:e.normalizeClass(["row-handler",{active:l.value}]),onClick:i},[e.createElementVNode("div",Lb,[u[3]||(u[3]=e.createElementVNode("div",{class:"indicator"},[e.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[e.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),e.createVNode(e.unref(mt),{icon:"add_circle",color:e.unref(J).blue,tooltip:e.unref(o)("table.addRow"),placement:"left",onClick:u[0]||(u[0]=e.withModifiers(p=>c("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])):e.createCommentVNode("",!0),e.createVNode(e.unref(G.NodeViewContent))]),_:1},16,["style"]))}}),$b=Wt.TableCell.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return G.VueNodeViewRenderer(Vb,{stopEvent:()=>!1})}}),Pb={class:"add"},Fb={class:"add"},Ub=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t,{tr:o}=Z(),{isEditable:r,run:a}=oe(),l=e.ref(!1),i=e.ref(!1);function s(){setTimeout(()=>{l.value=!0},0)}function c(){i.value=!0}function d(){l.value=!1,p("tableSelectColumn",{pos:n.getPos()})}function u(){p("tableSelectRow",{pos:n.getPos()})}function p(m,f={}){m==="tableDeleteRow"?i.value=!1:m==="tableDeleteColumn"&&(l.value=!1),setTimeout(()=>{a(n.editor,m,f)},0)}return(m,f)=>(e.openBlock(),e.createBlock(e.unref(G.NodeViewWrapper),e.mergeProps({class:"o-table-header-view",as:"th"},m.node.attrs,{style:{background:m.node.attrs.background}}),{default:e.withCtx(()=>[e.unref(r)?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(St),{modelValue:l.value,"onUpdate:modelValue":f[2]||(f[2]=v=>l.value=v),placement:"top","tippy-class":"o-column-popover",offset:[0,20],"hide-click-outside":""},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"select_all",tooltip:e.unref(o)("table.selectColumn"),onClick:d},null,8,["tooltip"]),e.createVNode(e.unref(Te),{icon:"delete",tooltip:e.unref(o)("table.removeColumn"),onClick:f[1]||(f[1]=v=>p("tableDeleteColumn"))},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createElementVNode("section",{class:e.normalizeClass(["col-handler",{active:l.value}]),onClick:s},[e.createElementVNode("div",Pb,[f[6]||(f[6]=e.createElementVNode("div",{class:"indicator"},[e.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[e.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),e.createVNode(e.unref(mt),{icon:"add_circle",color:e.unref(J).blue,tooltip:e.unref(o)("table.addColumn"),onClick:f[0]||(f[0]=e.withModifiers(v=>p("tableAddColumn"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"]),e.createVNode(e.unref(St),{modelValue:i.value,"onUpdate:modelValue":f[5]||(f[5]=v=>i.value=v),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(Te),{icon:"select_all",placement:"left",tooltip:e.unref(o)("table.selectRow"),onClick:u},null,8,["tooltip"]),e.createVNode(e.unref(Te),{icon:"delete",placement:"left",tooltip:e.unref(o)("table.removeRow"),onClick:f[4]||(f[4]=v=>p("tableDeleteRow"))},null,8,["tooltip"])]),default:e.withCtx(()=>[e.createElementVNode("section",{class:e.normalizeClass(["row-handler",{active:i.value}]),onClick:c},[e.createElementVNode("div",Fb,[f[7]||(f[7]=e.createElementVNode("div",{class:"indicator"},[e.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[e.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),e.createVNode(e.unref(mt),{icon:"add_circle",color:e.unref(J).blue,tooltip:e.unref(o)("table.addRow"),placement:"left",onClick:f[3]||(f[3]=e.withModifiers(v=>p("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])],64)):e.createCommentVNode("",!0),e.createVNode(e.unref(G.NodeViewContent))]),_:1},16,["style"]))}}),zb=Wt.TableHeader.extend({addAttributes(){var t;return{...(t=this.parent)==null?void 0:t.call(this),background:{default:""}}},addNodeView(){return G.VueNodeViewRenderer(Ub,{stopEvent:()=>!1})}}),Hb=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t,o=e.inject("sideNode",{value:!1}),r=e.ref(!1),a=e.computed(()=>{const{selection:i}=n.editor.view.state,s=i.from,c=n.getPos(),d=c+n.node.nodeSize;return s>=c&&s<=d});function l(i){r.value=i}return e.watch(a,i=>{console.log("isFocused",n.node.attrs),l(i)}),(i,s)=>(e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:["o-table-wrapper-view",{"side-node-enabled":e.unref(o)}]}),{default:e.withCtx(()=>[e.createVNode(e.unref(G.NodeViewContent),{as:"table"})]),_:1},16,["class"]))}}),qb=ss.TableWrapper.extend({addNodeView(){return G.VueNodeViewRenderer(Hb,{stopEvent:()=>!1})}}),Gb={key:1,class:"video-container"},Kb={key:1},Wb=e.defineComponent({__name:"view",props:G.nodeViewProps,setup(t){const n=t,{isEditable:o}=oe(),r=e.ref(!1),a=e.ref({}),l=e.ref(null),i=e.ref(!1),s=e.ref(!1),c=e.computed({get(){return n.node.attrs.caption},set(h){n.updateAttributes({caption:h})}}),d=e.computed({get(){return n.node.attrs.src},set(h){n.updateAttributes({src:h})}});function u(h){switch(r.value=!1,h.value){case"replace":_(!0);break}}function p(){i.value=!0,setTimeout(()=>{var h;(h=l.value)==null||h.focus()},0)}function m(){i.value=!1}function f(){d.value==="init"&&_(!0)}function v(h){r.value=!0,a.value=h}function b(h){d.value=h,_(!1)}function _(h){s.value=h}return e.onMounted(()=>{_(d.value==="init")}),(h,w)=>{var y;return e.openBlock(),e.createBlock(e.unref(ot),e.mergeProps(n,{class:["o-video-view",{readonly:!((y=h.editor)!=null&&y.isEditable),init:d.value==="init"}],as:"div",onContextmenu:e.withModifiers(v,["prevent"]),onClick:f}),{default:e.withCtx(()=>[e.createVNode(e.unref(St),{modelValue:s.value,"onUpdate:modelValue":w[1]||(w[1]=g=>s.value=g),placement:d.value==="init"?"bottom":"top"},{"popover-content":e.withCtx(()=>[e.createVNode(e.unref(pr),{val:d.value==="init"?"":d.value,type:"video",onInput:b},null,8,["val"])]),default:e.withCtx(()=>{var g;return[d.value==="init"?(e.openBlock(),e.createBlock(e.unref(uo),{key:0,icon:"videocam",placeholder:"Add a video"})):(e.openBlock(),e.createElementBlock("div",Gb,[w[3]||(w[3]=e.createElementVNode("div",{class:"video-cover"},null,-1)),e.unref(o)?(e.openBlock(),e.createBlock(e.unref(ur),e.mergeProps({key:0},n,{onAction:u}),{default:e.withCtx(()=>[e.createVNode(e.unref(me),{icon:"subtitles",tooltip:"image.caption",onClick:p})]),_:1},16)):e.createCommentVNode("",!0),e.createElementVNode("video",e.mergeProps(h.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[e.createElementVNode("source",e.normalizeProps(e.guardReactiveProps(h.node.attrs)),null,16)],16),e.createElementVNode("div",{class:"caption",onClick:p},[(g=h.editor)!=null&&g.isEditable&&i.value?(e.openBlock(),e.createBlock(e.unref(vt),{key:0,ref_key:"captionInput",ref:l,class:"caption-input",modelValue:c.value,"onUpdate:modelValue":w[0]||(w[0]=C=>c.value=C),type:"text",placeholder:"Input caption",autosize:"",onBlur:m},null,8,["modelValue"])):(e.openBlock(),e.createElementBlock("span",Kb,e.toDisplayString(c.value),1))])]))]}),_:1},8,["modelValue","placement"]),e.createVNode(e.unref(Mn),{modelValue:r.value,"onUpdate:modelValue":w[2]||(w[2]=g=>r.value=g),event:a.value},{default:e.withCtx(()=>[e.createVNode(e.unref(Ut),e.mergeProps(n,{onAction:u}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),jb=cs.Video.extend({addNodeView(){return G.VueNodeViewRenderer(Wb)}}),Yb=["Highlight","BackgroundColor","Color","Focus","FontFamily","Subscript","Superscript","Table","TaskItem","TaskList","TextAlign","TextStyle","Typography","UniqueID","OHorizontalRule","OSelectionDecoration"],Zb=["Highlight","BackgroundColor","BlockMath","Bold","BulletList","Color","Code","CodeBlockLowlight","Emoji","Focus","FontFamily","HorizontalRule","Image","InlineMath","Italic","Link","ListItem","Markdown","Mention","OrderedList","Strike","Subscript","Superscript","Table","TaskItem","TaskList","TextAlign","TextStyle","Typography","Underline","UniqueID"],Xb=["OAiBlock","OBlockMath","OBlockquote","OCallout","OCharCommand","OCodeBlock","OColon","OColorHighlighter","ODetails","OFocus","OHeading","OHorizontalRule","OImage","OInlinePlaceholder","OLink","OParagraph","OSelectionDecoration","OShortcut","OSlash","OSlashZh","OTableWrapper","OTaskItem","OVideo"],Qb=[...Zb,...Xb],Jb={key:0},ev=e.defineComponent({__name:"OBubbleMenu",props:{editor:{type:Ae.Editor},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(t){const n=t,{tr:o}=Z(),{theme:r}=tn(),a=e.ref(!1),l=e.ref(!1),i=e.ref(!1),s=e.ref(!1),c=e.ref({offset:10,placement:"bottom-start",onShow:()=>{a.value=!1,l.value=!1,i.value=!1},onHide:()=>{i.value=!1}});function d(){a.value=!0}function u(y){y==="ai"&&(l.value=!0)}function p(){i.value=!0}function m(y){const{schema:g}=n.editor,C=g.marks.link;if(!C||!y)return!1;const{$from:E,$to:R}=y;return!!Ae.getMarkRange(E,C)}function f({editor:y,element:g,view:C,state:E,oldState:R,from:D,to:A}){var T;const{doc:P,selection:j}=E,{empty:O}=j,M=!P.textBetween(D,A).length&&Ae.isTextSelection(E.selection);if(s.value=n.editor.isActive("inlineMath"),w.value||n.editor.isActive("inlineMath"))return!0;if(!C.hasFocus()||O||i.value||M&&y.isActive("link")&&!y.isActive("image"))return!1;const L=["image"],U=["image","toc","video","model-viewer"],S=j.node,H=(T=S==null?void 0:S.type)==null?void 0:T.name;return!(y.isActive("codeBlock")||U.indexOf(H)>=0||H&&!L.includes(H))}const v=e.computed(()=>{if(n.editor){const{state:y}=n.editor,{tr:g}=y,{selection:C}=g;return m(C)}else return!1}),b=e.computed(()=>{var y,g;return!a.value&&!((y=n.editor)!=null&&y.isActive("image"))&&(v.value||((g=n.editor)==null?void 0:g.isActive("inlineMath")))}),_=e.computed(()=>w.value||s.value),h=e.computed(()=>{var g,C,E;let y=n.menu;return a.value||((g=n.editor)!=null&&g.isActive("image")?y=v.value?Wa:Ka:(C=n.editor)!=null&&C.isActive("table")?y=Ya:v.value?y=Ga:(E=n.editor)!=null&&E.isActive("inlineMath")&&(y=qa)),y.length>0?y:Ha}),w=e.computed(()=>{const y=cn.InlinePlaceholderKey.getState(n.editor.state);return!!(y!=null&&y.active)});return e.onMounted(()=>{a.value=!1}),(y,g)=>t.editor?(e.openBlock(),e.createElementBlock("section",Jb,[e.createVNode(e.unref(Aa.BubbleMenu),{editor:t.editor,"should-show":f,options:c.value},{default:e.withCtx(()=>[l.value?(e.openBlock(),e.createBlock(e.unref(zi),{key:0,editor:t.editor,onConfirm:p},null,8,["editor"])):_.value?(e.openBlock(),e.createBlock(e.unref(Hi),{key:1,editor:t.editor},null,8,["editor"])):(e.openBlock(),e.createElementBlock("section",{key:2,class:e.normalizeClass(["tiptap-toolbar",t.menuClass])},[b.value?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[e.createVNode(e.unref(me),{icon:"arrow_back",tooltip:e.unref(o)("link.back"),onClick:d},null,8,["tooltip"]),e.createVNode(e.unref(Ue),{vertical:""})],64)):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(h.value,(C,E)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:E},[C==="separator"?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0,vertical:""})):typeof C=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Co)(C)),{key:1,name:C,editor:t.editor,onClick:R=>u(C)},null,8,["name","editor","onClick"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(C),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))],2))]),_:1},8,["editor","options"])])):e.createCommentVNode("",!0)}}),tv={key:0},nv=e.defineComponent({__name:"OFloatingMenu",props:{editor:{type:G.Editor},menu:{type:Array,default:function(){return[]}},tableToolbar:{type:Array,default:function(){return[]}},menuClass:{type:String,default:""}},setup(t){const n=t,o=e.ref(!1),r=e.ref({placement:"right",offset:168});function a(){o.value=!0}function l(u){const{schema:p}=n.editor,m=p.marks.link;if(!m||!u)return!1;const{$from:f,$to:v}=u;return!!Ae.getMarkRange(f,m)}const i=e.computed(()=>{if(n.editor){const{state:u}=n.editor,{tr:p}=u,{selection:m}=p;return l(m)}else return!1}),s=e.computed(()=>!o.value&&i.value),c=e.computed(()=>{let u=n.menu;return u.length>0?u:Za}),d=e.computed(()=>{const u=cn.InlinePlaceholderKey.getState(n.editor.state);return!!(u!=null&&u.active)});return(u,p)=>t.editor&&!d.value?(e.openBlock(),e.createElementBlock("section",tv,[e.createVNode(e.unref(Aa.FloatingMenu),{editor:t.editor,options:r.value},{default:e.withCtx(()=>[e.createElementVNode("section",{class:e.normalizeClass(["tiptap-toolbar",t.menuClass])},[s.value?(e.openBlock(),e.createBlock(e.unref(me),{key:0,icon:"arrow_back",onClick:a})):e.createCommentVNode("",!0),(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(c.value,(m,f)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:f},[m==="separator"?(e.openBlock(),e.createBlock(e.unref(Ue),{key:0,vertical:""})):typeof m=="string"?(e.openBlock(),e.createBlock(e.resolveDynamicComponent(e.unref(Co)(m)),{key:1,name:m,editor:t.editor},null,8,["name","editor"])):(e.openBlock(),e.createBlock(e.resolveDynamicComponent(m),{key:2,editor:t.editor},null,8,["editor"]))],64))),128))],2)]),_:1},8,["editor","options"])])):e.createCommentVNode("",!0)}});function Tr(t,n){const o=n==null?void 0:n.posAtCoords(t);if(!o)return;let r=eo(o.pos,n);if(r!==n.dom){for(;r&&r.parentNode&&r.parentNode!==n.dom;)r=r.parentNode;if(r)return r}}function eo(t,n){return n.nodeDOM(t)||n.domAtPos(t).node}function Or(t,n){const o=Tr(t,n);if(o&&o.nodeType===1){const r=n.docView,a=r.nearestDesc(o,!0);return!a||a===r?null:a.posBefore}return null}function ov(t,n){let o,r;const a=n.resolve(t.from).node().type.spec.group==="blockContent",l=n.resolve(t.to).node().type.spec.group==="blockContent",i=Math.min(t.$anchor.depth,t.$head.depth);if(a&&l){const s=t.$from.start(i-1),c=t.$to.end(i-1);o=n.resolve(s-1).pos,r=n.resolve(c+1).pos}else o=t.from,r=t.to;return{from:o,to:r}}function rv(t,n){const o=Or(t,n.view);return o&&o>=0?{node:n.state.doc.nodeAt(o),pos:o}:{node:null,pos:o}}const co=new Ct.PluginKey("sideMenu");class av{constructor(){Oe(this,"hovered",!1);Oe(this,"coords",{left:0,top:0});Oe(this,"className","")}init(n){return this}apply({tr:n,oldState:o,newState:r}){return n.docChanged?this:this}setHover(n,o,r=""){this.hovered=n,this.coords=o,this.className=r}}class iv{constructor({editor:n,element:o,view:r,tippyOptions:a={},updateDelay:l=250}){Oe(this,"editor");Oe(this,"element");Oe(this,"view");Oe(this,"preventHide",!1);Oe(this,"tippy");Oe(this,"tippyOptions");Oe(this,"updateDelay");Oe(this,"updateDebounceTimer");Oe(this,"mousedownHandler",()=>{this.preventHide=!0});Oe(this,"onDragStart",n=>{this.hide()});Oe(this,"blurHandler",({event:n})=>{var o;n!=null&&n.relatedTarget&&((o=this.element.parentNode)!=null&&o.contains(n.relatedTarget))||this.hide()});Oe(this,"tippyBlurHandler",n=>{this.blurHandler({event:n})});Oe(this,"handleDebouncedUpdate",(n,o)=>{const r=!(o!=null&&o.selection.eq(n.state.selection)),a=!(o!=null&&o.doc.eq(n.state.doc));!r&&!a||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(n,r,a,o)},this.updateDelay))});Oe(this,"updateHandler",(n,o,r,a)=>{var u,p;const{state:l,composing:i}=n,{coords:s}=co.getState(l),c=Tr(s,n),d=Or(s,n);!c||d<=0||(this.createTooltip(),(p=this.tippy)==null||p.setProps({getReferenceClientRect:((u=this.tippyOptions)==null?void 0:u.getReferenceClientRect)||(()=>c.getBoundingClientRect())}),this.show())});this.editor=n,this.element=o,this.view=r,this.updateDelay=l,this.view.dom.addEventListener("dragstart",this.onDragStart),this.tippyOptions=a,this.element.remove(),this.element.style.visibility="visible"}createTooltip(){const{element:n}=this.editor.options,o=n instanceof Element?n:"mount"in n?n.mount:null,r=!!(o!=null&&o.parentElement);this.tippy||!r||(this.tippy=At(o,{duration:0,getReferenceClientRect:null,content:this.element,interactive:!0,trigger:"manual",placement:"left",hideOnClick:"toggle",...this.tippyOptions}),this.tippy.popper.firstChild&&this.tippy.popper.firstChild.addEventListener("blur",this.tippyBlurHandler))}update(n,o){const{state:r}=n,a=!(o!=null&&o.selection.eq(n.state.selection)),l=!(o!=null&&o.doc.eq(n.state.doc));this.updateHandler(n,a,l,o)}show(){var n;(n=this.tippy)==null||n.show()}hide(){var n;(n=this.tippy)==null||n.hide()}destroy(){var n,o;(n=this.tippy)!=null&&n.popper.firstChild&&this.tippy.popper.firstChild.removeEventListener("blur",this.tippyBlurHandler),(o=this.tippy)==null||o.destroy(),this.view.dom.removeEventListener("dragstart",this.onDragStart)}}const lv=(t,n)=>{if(!t.dataTransfer)return;const o=n.view,r=o.dom.getBoundingClientRect(),a={left:r.left+r.width/2,top:t.clientY},l=Or(a,o);if(l===null)return;const i=o.state.selection,s=o.state.doc;ov(i,s),o.dispatch(o.state.tr.setSelection(Ct.NodeSelection.create(o.state.doc,l))),cv(o,l);const c=o.state.selection.content(),{dom:d,text:u}=o.serializeForClipboard(c);t.dataTransfer.clearData(),t.dataTransfer.setData("text/html",d.innerHTML),t.dataTransfer.setData("text/plain",u),t.dataTransfer.effectAllowed="move",t.dataTransfer.setDragImage(Zt,0,0),o.dragging={slice:c,move:!0}},sv=(t,n)=>{sl()};let Zt;function cv(t,n,o=n){const r=t.domAtPos(n).node.cloneNode(!0),a=t.domAtPos(n).node,l=(p,m)=>Array.prototype.indexOf.call(p.children,m),i=p=>{let m=p,f=m.parentElement;for(;f;){if(f===t.dom)return m;m=f,f=m.parentElement}return m};let s=-1,c=-1;n===o?(s=l(a,i(eo(n,t))),c=s):(s=l(a,i(eo(n+1,t))),c=l(a,i(eo(o-1,t))));for(let p=a.childElementCount-1;p>=0;p--)(p>s||p<c)&&r.removeChild(r.children[p]);sl(),Zt=r;const u=t.dom.className.split(" ").filter(p=>p!=="ProseMirror"&&p!=="yiitap-root"&&p!=="yiitap-editor").join(" ");Zt.className+=" yiitap-dragging-preview "+u,document.body.appendChild(Zt)}function sl(){Zt!==void 0&&(document.body.removeChild(Zt),Zt=void 0)}class uv{constructor(n){Oe(this,"options");Oe(this,"plugin");Oe(this,"sideMenuView");const o=new av;this.options=n,this.plugin=new Ct.Plugin({key:co,props:{handleDOMEvents:{mouseover(r,a){const l={left:a.clientX,top:a.clientY},i=Tr(l,r),s=(i==null?void 0:i.className)||"",c=o.className;s.indexOf("o-table-wrapper-view")>=0&&c.indexOf("o-table-wrapper-view")>=0||(o.setHover(!0,l,s),r.dispatch(r.state.tr.setMeta(co,o)))}}},state:{init(r,a){return o.init(a)},apply(r,a,l,i){return o.apply({tr:r,oldState:l,newState:i})}},view:r=>(this.sideMenuView=new iv({view:r,...n}),this.sideMenuView)})}dragstart(n){lv(n,this.options.editor)}dragend(n){sv(n,this.options.editor)}}const dv=e.defineComponent({name:"SideMenu",props:{pluginKey:{type:[String,Object],default:"sideMenu"},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},tippyOptions:{type:Object,default:()=>({})}},setup(t,{expose:n,slots:o}){const r=e.ref(null),a=e.ref(),l=s=>{var c;(c=a.value)==null||c.dragstart(s)},i=s=>{var c;(c=a.value)==null||c.dragend(s)};return e.onMounted(()=>{const{pluginKey:s,editor:c,updateDelay:d,tippyOptions:u}=t;a.value=new uv({updateDelay:d,editor:c,element:r.value,pluginKey:s,tippyOptions:u}),c.registerPlugin(a.value.plugin)}),e.onBeforeUnmount(()=>{const{pluginKey:s,editor:c}=t;c.unregisterPlugin(s)}),n({...t,dragstart:l,dragend:i}),()=>{var s;return e.h("div",{ref:r},(s=o.default)==null?void 0:s.call(o))}}}),pv={key:0,class:"o-side-menu"},fv={class:"container"},mv=e.defineComponent({__name:"OSideMenu",props:{editor:{type:Ae.Editor,required:!0},menuClass:{type:String,default:""},add:{type:String,default:"menu"}},setup(t){const n=t,o=e.ref(null),r=e.ref(null),a=e.ref(0),l=e.computed(()=>({arrow:!1,duration:100,placement:"left"})),i=e.computed(()=>({editor:n.editor,node:r.value,decorations:[],selected:!1,extension:{},getPos:()=>a.value,pos:a.value,updateAttributes:c,deleteNode:s,view:{},innerDecorations:[],HTMLAttributes:{},add:n.add}));function s(){var v,b;const m=a.value,f=m+((v=r.value)==null?void 0:v.nodeSize);(b=n.editor)==null||b.commands.deleteRange({from:m,to:f})}function c(m){var f;(f=n.editor)==null||f.commands.command(({tr:v})=>{var b;return v.setNodeMarkup(a.value,void 0,{...(b=r.value)==null?void 0:b.attrs,...m}),!0})}function d({editor:m,transaction:f}){let v={left:0,top:0};const b=co.getState(n.editor.view.state);if(b){v=b.coords;const _=rv(v,m);_.node&&_.pos>0&&(r.value=_.node,a.value=_.pos)}}function u(m){var f;(f=o.value)==null||f.dragstart(m)}function p(m){var f;(f=o.value)==null||f.dragend(m)}return e.onMounted(()=>{var m;(m=n.editor)==null||m.on("transaction",d)}),(m,f)=>t.editor?(e.openBlock(),e.createElementBlock("section",pv,[e.createVNode(e.unref(dv),{ref_key:"menu",ref:o,class:e.normalizeClass(["side-menu",t.menuClass]),editor:t.editor,"tippy-options":l.value},{default:e.withCtx(()=>[e.createElementVNode("section",fv,[r.value?(e.openBlock(),e.createBlock(e.unref(Ii),e.normalizeProps(e.mergeProps({key:0},i.value)),null,16)):e.createCommentVNode("",!0),r.value?(e.openBlock(),e.createBlock(e.unref(Di),e.mergeProps({key:1},i.value,{onDragstart:u,onDragend:p}),null,16)):e.createCommentVNode("",!0)])]),_:1},8,["class","editor","tippy-options"])])):e.createCommentVNode("",!0)}}),gv={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object},range:{type:Object}},setup(){const{locale:t,tr:n}=Z(),{run:o}=oe();return{locale:t,tr:n,run:o}},data(){return{view:"main"}},components:{OEmojiSelect:go},methods:{onSelect(t){this.editor.commands.deleteRange(this.range),this.editor.commands.insertContent(t.emoji),this.editor.chain().focus()},onKeyDown({event:t}){return!1}}},Ar=(t,n)=>{const o=t.__vccOpts||t;for(const[r,a]of n)o[r]=a;return o},bv={class:"o-colon-view"};function vv(t,n,o,r,a,l){const i=e.resolveComponent("o-emoji-select");return e.openBlock(),e.createElementBlock("section",bv,[e.createVNode(i,{items:o.items,onSelect:l.onSelect},null,8,["items","onSelect"])])}const hv=Ar(gv,[["render",vv]]),_v={items:({query:t})=>Nn.filterEmojiGroups(t),render:()=>{let t,n;return{onStart:o=>{t=new G.VueRenderer(hv,{props:o,editor:o.editor}),o.clientRect&&(n=At("body",{getReferenceClientRect:o.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow(r){r.popper.classList.add("emoji-tippy")}}))},onUpdate(o){t.updateProps(o),n[0].setProps({getReferenceClientRect:o.clientRect})},onKeyDown(o){var r;return o.event.key==="Escape"?(n[0].hide(),t.destroy(),!0):(r=t.ref)==null?void 0:r.onKeyDown(o)},onExit(){n[0].destroy(),t.destroy()}}}},kv={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Ae.Editor},range:{type:Object}},setup(){const{locale:t,tr:n}=Z(),{onCommand:o,run:r}=oe();return{locale:t,tr:n,onCommand:o,run:r}},data(){return{view:"main",selectedIndex:0}},components:{ODivider:Ue,OIcon:$,OList:We,OListItem:qe},watch:{items(){this.selectedIndex=0}},methods:{onClick(t){switch(t.value){default:this.runCommand(t);break}return!0},runCommand(t){const n=this.editor.chain().focus().deleteRange(this.range),o=this.editor.commands;["blockMath","codeBlock","content","details","diagram","emoji","inlineMath","taskList"].includes(t.value)?(o.deleteRange(this.range),this.run(this.editor,t.value,t.options)):this.onCommand(o,n,t.value,t.options)},onKeyDown({event:t}){return t.key==="ArrowUp"?(this.upHandler(),!0):t.key==="ArrowDown"?(this.downHandler(),!0):t.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(t){const n=this.items[t];n&&this.onClick(n)},setEmoji(t){this.onClick({value:"content",options:{content:t}})}},computed:{basicBlocks(){return vn.slice(1)}},mounted(){this.selectedIndex=0}},yv={key:0,class:"view-main"},wv={class:"group o-tips"},Ev={class:"o-tips"},Cv={key:1,class:"item"},xv={key:1,class:"view-emoji"},Nv={key:2,class:"view-emoji"};function Sv(t,n,o,r,a,l){const i=e.resolveComponent("o-divider"),s=e.resolveComponent("o-icon"),c=e.resolveComponent("o-list-item"),d=e.resolveComponent("o-list");return e.openBlock(),e.createElementBlock("section",{class:e.normalizeClass(["o-slash-view o-shadow-3 o-menu o-scroll",`view-${a.view}`])},[a.view==="main"?(e.openBlock(),e.createElementBlock("section",yv,[e.createVNode(d,{hoverable:"",clickable:""},{default:e.withCtx(()=>[o.items.length?(e.openBlock(!0),e.createElementBlock(e.Fragment,{key:0},e.renderList(o.items,(u,p)=>(e.openBlock(),e.createElementBlock(e.Fragment,{key:p},[u.group?(e.openBlock(),e.createElementBlock(e.Fragment,{key:0},[p>0?(e.openBlock(),e.createBlock(i,{key:0})):e.createCommentVNode("",!0),e.createElementVNode("div",wv,e.toDisplayString(r.tr(u.group)),1)],64)):e.createCommentVNode("",!0),e.createVNode(c,{class:e.normalizeClass(["item",{"is-active":p===a.selectedIndex}]),clickable:"",onClick:m=>l.onClick(u)},{prefix:e.withCtx(()=>[e.createVNode(s,{name:u.icon,color:u.color},null,8,["name","color"])]),suffix:e.withCtx(()=>[e.createElementVNode("span",Ev,e.toDisplayString(u.tips),1)]),default:e.withCtx(()=>[e.createTextVNode(" "+e.toDisplayString(r.tr(u.label)),1)]),_:2},1032,["class","onClick"])],64))),128)):(e.openBlock(),e.createElementBlock("div",Cv,"No result"))]),_:1})])):a.view==="emoji"?(e.openBlock(),e.createElementBlock("section",xv)):a.view==="ai"?(e.openBlock(),e.createElementBlock("section",Nv)):e.createCommentVNode("",!0)],2)}const Tv=Ar(kv,[["render",Sv]]),Ta={items:({query:t})=>fo.filter(n=>{var o;return n.value.toLowerCase().includes(t.toLowerCase())||((o=n.keywords)==null?void 0:o.toLowerCase().includes(t.toLowerCase()))}),render:()=>{let t,n;return{onStart:o=>{t=new G.VueRenderer(Tv,{props:o,editor:o.editor}),o.clientRect&&(n=At("body",{getReferenceClientRect:o.clientRect,appendTo:()=>document.body,content:t.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",arrow:!1,onShow:r=>{r.popper.classList.add("slash-tippy")}}))},onUpdate(o){t.updateProps(o),n[0].setProps({getReferenceClientRect:o.clientRect})},onKeyDown(o){var r;return o.event.key==="Escape"?(n[0].hide(),t.destroy(),!0):(r=t.ref)==null?void 0:r.onKeyDown(o)},onExit(){n[0].destroy(),t.destroy()}}}},Ov={props:{items:{type:Array,required:!0},command:{type:Function,required:!0},editor:{type:Object,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:t}){return t.key==="ArrowUp"?(this.upHandler(),!0):t.key==="ArrowDown"?(this.downHandler(),!0):t.key==="Enter"?(this.enterHandler(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(t){const n=this.items[t];n&&this.command({name:n.name})}}},Av={class:"dropdown-menu"},Bv=["onClick"],Mv=["src"];function Rv(t,n,o,r,a,l){return e.openBlock(),e.createElementBlock("div",Av,[(e.openBlock(!0),e.createElementBlock(e.Fragment,null,e.renderList(o.items,(i,s)=>(e.openBlock(),e.createElementBlock("button",{class:e.normalizeClass({"is-selected":s===a.selectedIndex}),key:s,onClick:c=>l.selectItem(s)},[i.fallbackImage?(e.openBlock(),e.createElementBlock("img",{key:0,src:i.fallbackImage,align:"absmiddle"},null,8,Mv)):(e.openBlock(),e.createElementBlock(e.Fragment,{key:1},[e.createTextVNode(e.toDisplayString(i.emoji),1)],64)),e.createTextVNode(" :"+e.toDisplayString(i.name)+": ",1)],10,Bv))),128))])}const Iv=Ar(Ov,[["render",Rv]]),Dv={items:({editor:t,query:n})=>t.storage.emoji.emojis.filter(({shortcodes:o,tags:r})=>o.find(a=>a.startsWith(n.toLowerCase()))||r.find(a=>a.startsWith(n.toLowerCase()))).slice(0,10),render:()=>{let t;function n(o){if(!t||!t.element)return;rr({getBoundingClientRect(){return o}},t.element,{placement:"bottom-start"}).then(a=>{Object.assign(t.element.style,{left:`${a.x}px`,top:`${a.y}px`,position:a.strategy==="fixed"?"fixed":"absolute"})})}return{onStart:o=>{t=new G.VueRenderer(Iv,{props:o,editor:o.editor}),document.body.appendChild(t.element),n(o.clientRect())},onUpdate(o){t.updateProps(o),n(o.clientRect())},onKeyDown(o){var r;return o.event.key==="Escape"?(document.body.removeChild(t.element),t.destroy(),!0):(r=t.ref)==null?void 0:r.onKeyDown(o)},onExit(){document.body.contains(t.element)&&document.body.removeChild(t.element),t.destroy()}}}},Lv={BackgroundColor:Un.BackgroundColor.configure({types:["textStyle"]}),BlockMath:jo.BlockMath,Color:Un.Color,Emoji:Fr.configure({emojis:Fr.gitHubEmojis,enableEmoticons:!0,suggestion:Dv}),Focus:Rl.Focus,FontFamily:Un.FontFamily,Highlight:Ll.configure({multicolor:!0}),Image:Vl,InlineMath:jo.InlineMath,Link:Oa,Markdown:Dl.Markdown.configure({indentation:{style:"space",size:2},markedOptions:{gfm:!0,breaks:!0,pedantic:!1}}),Subscript:$l,Superscript:Pl,TaskItem:jl,TaskList:Il.TaskList.configure({itemTypeName:"taskItem"}),TextAlign:Fl.configure({types:["heading","paragraph"]}),TextStyle:Un.TextStyle,Underline:zl,Typography:Ul,OAiBlock:mm,OBlockMath:_m,OColon:Lo.ColonCommand.configure({suggestion:_v}),OSlash:Lo.SlashCommand.configure({suggestion:Ta}),OSlashZh:Lo.SlashZhCommand.configure({suggestion:Ta}),OBlockquote:ym.configure({triggerCharacters:['"',"“","”"]}),OCallout:Nm,OCodeBlock:vb,OColorHighlighter:ql,OHeading:yb,OHorizontalRule:Cb,OImage:Bb,OInlinePlaceholder:Gl,OLink:Rb.configure({openOnClick:!1}),OParagraph:Db,OSelectionDecoration:Kl,UniqueID:Hl.configure({attributeName:"id",types:["blockquote","codeBlock","callout","heading","image","paragraph","table-wrapper","video"]}),OVideo:jb};class Vv{constructor(n){return Lv[n]}}const $v=[_b.configure({persist:!0,HTMLAttributes:{class:"details"}}),Wo.DetailsContent,Wo.DetailsSummary],Pv=[qb,Wl.configure({resizable:!0}),Wt.TableRow,zb,$b];Wt.Table.configure({resizable:!0}),Wt.TableRow,Wt.TableHeader,Wt.TableCell;const Fv=["data-theme"],cl=e.defineComponent({name:"YiiEditor",__name:"YiiEditor",props:{content:{type:[String,Object],default:""},title:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},autofocus:{type:[String,Number,Boolean],default:!1},locale:{type:String,default:"en"},darkMode:{type:Boolean,default:!1},showMainMenu:{type:Boolean,default:!1},showBubbleMenu:{type:Boolean,default:!1},showFloatingMenu:{type:Boolean,default:!1},sideMenu:{type:Object,default:()=>({show:!0,add:"menu"})},showSideNode:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},mainMenu:{type:Array,default:()=>[]},tableMenu:{type:Array,default:()=>[]},bubbleMenu:{type:Array,default:()=>[]},floatingMenu:{type:Array,default:()=>[]},pageView:{type:String,default:"page",validator:t=>["page","full"].includes(t)},aiOption:{type:Object,default:()=>{}},collab:{type:Object,default:()=>({enabled:!1,collaboration:null,collaborationCaret:null})}},emits:["create","transaction","update"],setup(t,{expose:n,emit:o}){const r=t,a=o,{tr:l}=Z(),i=e.ref(!1),s=e.ref(!0),c=e.ref("en"),d=e.ref(!1),u=e.ref(),p=e.ref(!1);e.provide("darkMode",i),e.provide("isEditable",s),e.provide("locale",c),e.provide("sideNode",d),e.provide("aiOption",u);const m=e.computed(()=>w()),f=G.useEditor({editable:r.editable,content:r.content,autofocus:r.autofocus,extensions:m.value,onCreate:()=>{p.value=!0,a("create",f.value)},onUpdate:({editor:y})=>{p.value&&a("update",{editor:y})},onTransaction:({editor:y,transaction:g})=>{a("transaction",{editor:y,transaction:g})}}),v=e.computed(()=>({editor:f.value,menu:r.mainMenu})),b=e.computed(()=>({editor:f.value,menu:r.bubbleMenu})),_=e.computed(()=>({editor:f.value,menu:r.floatingMenu})),h=e.computed(()=>({editor:f.value,add:r.sideMenu.add,menu:[]}));function w(){const y=[];r.title?y.push(Pr.extend({content:"heading block*"})):y.push(Pr),y.push(cn.configure({placeholder:({editor:C,node:E,pos:R})=>{if(E.type.name==="heading"){const D=E.attrs.level;return R>0?`H${D}`:l("label.untitled")}else return E.type.name==="paragraph"?l("label.typeForCommands"):""}})),y.push(Al.configure({dropcursor:{width:5,color:"skyblue",class:"yiitap-dropcursor"},codeBlock:!1,document:!1,horizontalRule:!1,link:!1,blockquote:r.extensions.includes("OBlockquote")?!1:{},heading:r.extensions.includes("OHeading")?!1:{levels:[1,2,3,4,5]},paragraph:r.extensions.includes("OParagraph")?!1:{},trailingNode:r.title?{node:"paragraph",notAfter:["paragraph","heading"]}:{notAfter:[]},undoRedo:r.collab.enabled?!1:{depth:100,newGroupDelay:500}}));const g=Yb.concat(r.extensions);for(const C of g)if(typeof C=="string"){if(!Qb.includes(C))continue;switch(C){case"ODetails":y.push(...$v);break;case"Table":y.push(...Pv);break;default:try{const E=new Vv(C);y.push(E)}catch(E){console.error(E.message)}break}}else y.push(C);return r.collab.enabled&&y.push(Bl.configure(r.collab.collaboration),Ml.configure(r.collab.collaborationCaret)),g.includes("OShortcut")&&(g.includes("Markdown")?y.push(Ur.configure({markdown:{enabled:!0}})):y.push(Ur)),y}return e.watch(()=>r.darkMode,y=>{i.value=y}),e.watch(()=>r.locale,y=>{c.value=y}),e.watch(()=>r.aiOption,y=>{u.value=y},{deep:!0}),e.watch(()=>r.editable,y=>{var g;(g=f.value)==null||g.setEditable(y),s.value=y}),e.onBeforeMount(()=>{s.value=r.editable,u.value=r.aiOption,i.value=r.darkMode,c.value=r.locale,d.value=!r.sideMenu.show&&r.showSideNode}),n({editor:f,darkMode:i,locale:c}),(y,g)=>{var C,E,R;return e.openBlock(),e.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":i.value?"dark":""},[t.showMainMenu?(e.openBlock(),e.createBlock(Fi,e.mergeProps({key:0},v.value,{class:"desktop-only"}),{left:e.withCtx(()=>[e.renderSlot(y.$slots,"toolbar-left")]),right:e.withCtx(()=>[e.renderSlot(y.$slots,"toolbar-right")]),_:3},16)):e.createCommentVNode("",!0),(C=e.unref(f))!=null&&C.isEditable&&t.showBubbleMenu?(e.openBlock(),e.createBlock(ev,e.normalizeProps(e.mergeProps({key:1},b.value)),null,16)):e.createCommentVNode("",!0),(E=e.unref(f))!=null&&E.isEditable&&t.showFloatingMenu?(e.openBlock(),e.createBlock(nv,e.normalizeProps(e.mergeProps({key:2},_.value)),null,16)):e.createCommentVNode("",!0),(R=e.unref(f))!=null&&R.isEditable&&t.sideMenu.show?(e.openBlock(),e.createBlock(mv,e.normalizeProps(e.mergeProps({key:3},h.value)),null,16)):e.createCommentVNode("",!0),e.createVNode(e.unref(G.EditorContent),{class:e.normalizeClass(["editor-content",`${t.pageView}-view`]),editor:e.unref(f)},null,8,["class","editor"])],8,Fv)}}}),Uv={installed:!1,spellcheck:!0,install(t){this.installed=!0,t.component("YiiEditor",cl)}};exports.AddNode=Ii;exports.AdvancedBlocks=Va;exports.AiBlocks=Pa;exports.AiProviders=Fa;exports.AskAiBlocks=$a;exports.BasicBlocks=vn;exports.BlockMenus=Xn;exports.Blocks=fo;exports.Color=J;exports.ColorList=Ns;exports.CommonBlocks=dn;exports.DefaultBubble=Ha;exports.DefaultEmbedServices=Ms;exports.DefaultFloating=Za;exports.DefaultMenu=Ua;exports.DragNode=Di;exports.ImageBubble=Ka;exports.ImageLinkBubble=Wa;exports.InlineMathBubble=qa;exports.LinkBubble=Ga;exports.MoreBubble=ja;exports.OAiMenu=zi;exports.OAlignDropdown=ar;exports.OBlockList=po;exports.OBlockListItem=Yo;exports.OBlockMenu=Ut;exports.OBlockPlaceholder=uo;exports.OBlockPopover=St;exports.OBlockToolbar=ur;exports.OBtn=ke;exports.OBtnGroup=Li;exports.OCalloutColorBoard=dr;exports.OCalloutColorDropdown=Hs;exports.OCheckbox=Nr;exports.OCodeBlockDownloadDropdown=Da;exports.OCodeBlockViewDropdown=La;exports.OColorBoard=Xt;exports.OCommandBtn=Te;exports.OCommonBtn=mt;exports.OContextMenu=Mn;exports.ODialog=Vi;exports.ODivider=Ue;exports.ODocToc=nc;exports.OEmojiSelect=go;exports.OFloatingToast=rp;exports.OIcon=$;exports.OImageViewer=$i;exports.OInlineMathMenu=Hi;exports.OInput=vt;exports.OLanguageDropdown=Qa;exports.OLinkBtn=ir;exports.OList=We;exports.OListItem=qe;exports.OMainMenu=Fi;exports.OMediaInput=pr;exports.OMenubarBtn=me;exports.OMetaInput=bo;exports.ONodeView=ot;exports.OPopover=fe;exports.OTableCellBackground=yi;exports.OTableGrid=ki;exports.OTextColorBoard=yr;exports.OTextarea=Pi;exports.OToast=xr;exports.OTooltip=ct;exports.Prompts=sr;exports.StyleBlocks=un;exports.TableBubble=Ya;exports.TableFloating=Bs;exports.TableMenu=za;exports.TableWrapperBubble=As;exports.YiiEditor=cl;exports.YiiEditorPlugin=Uv;exports.getProviderProp=lr;exports.useAi=cr;exports.useCommon=mo;exports.useI18n=Z;exports.useNodeView=Xa;exports.useTheme=tn;exports.useTiptap=oe;
|
|
286
|
+
${U}
|
|
287
|
+
`}function L(){v.value=!v.value}function B(){switch(y.value){case"mermaid":z();break}}function W(){rf.initialize({...g,theme:r.value?"dark":m.value}),B()}async function z(){try{f.value="";const U=`mermaid-${L4()}`,{svg:me}=await rf.render(U,b.value);d.value=me}catch(U){console.error(U),f.value=U.message}}return c.watch(b,U=>{B()}),c.watch(y,U=>{B()}),c.watch(r,U=>{W()}),c.watch(C,(U,me)=>{U==="splitHorizontal"&&(h.value=me,a.value="mermaid")}),c.onMounted(()=>{var me;const U=e.editor.extensionManager.extensions.find(Ee=>Ee.name==="codeBlock");m.value=((me=U==null?void 0:U.options)==null?void 0:me.diagramTheme)||"default",W()}),(U,me)=>(c.openBlock(),c.createBlock(c.unref(Mn),c.mergeProps(e,{class:["o-code-block-view",`language-${y.value} ${C.value}`]}),{default:c.withCtx(()=>[c.createElementVNode("div",P4,[c.createElementVNode("div",V4,[c.createElementVNode("div",z4,c.toDisplayString(y.value),1),c.createVNode(c.unref(q1),{language:y.value,class:"editable",onSelect:S},null,8,["language"])]),c.createElementVNode("div",F4,[C.value?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[C.value==="splitHorizontal"?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,icon:"close",tooltip:c.unref(o)("label.close"),class:"editable",onClick:R},null,8,["tooltip"])):(c.openBlock(),c.createBlock(c.unref(W1),{key:1,modelValue:p.value,"onUpdate:modelValue":me[0]||(me[0]=Ee=>p.value=Ee),class:"editable"},null,8,["modelValue"]))],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(Ae),{icon:k.value,"icon-class":{"rotate-270":v.value},tooltip:"Wrap",class:"editable",onClick:L},null,8,["icon","icon-class"]),x.value?(c.openBlock(),c.createBlock(c.unref(U1),{key:1,onDownload:N})):(c.openBlock(),c.createBlock(c.unref(Ae),{key:2,icon:"download",tooltip:c.unref(o)("label.download"),onClick:N},null,8,["tooltip"])),w.value?(c.openBlock(),c.createBlock(c.unref(Ae),{key:3,icon:"play_circle",tooltip:"Run",onClick:O})):c.createCommentVNode("",!0),c.createVNode(c.unref(Ae),{icon:s.value,tooltip:c.unref(o)("label.copy"),onClick:M},null,8,["icon","tooltip"])])]),c.createVNode(c.unref(mC),c.mergeProps({show:l.value.show,"onUpdate:show":me[1]||(me[1]=Ee=>l.value.show=Ee)},l.value,{onClose:R}),{title:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(a.value),1)]),default:c.withCtx(()=>[a.value==="run"?(c.openBlock(),c.createElementBlock("iframe",{key:0,sandbox:"allow-same-origin allow-scripts",srcdoc:u.value},null,8,H4)):a.value==="mermaid"?(c.openBlock(),c.createElementBlock("div",j4,null,512)):c.createCommentVNode("",!0)]),_:1},16,["show"]),c.createElementVNode("pre",null,[c.createVNode(c.unref(to),{as:"code",class:c.normalizeClass({wrap:v.value})},null,8,["class"])]),x.value?(c.openBlock(),c.createElementBlock("section",U4,[f.value?(c.openBlock(),c.createElementBlock("div",W4,c.toDisplayString(f.value),1)):(c.openBlock(),c.createElementBlock("div",{key:1,class:"mermaid-svg",innerHTML:d.value},null,8,q4))])):c.createCommentVNode("",!0)]),_:1},16,["class"]))}}),iM=py.createLowlight(py.common);iM.register("mermaid",_4);const sM=R4.extend({draggable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),diagramTheme:"default"}},addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),wrap:{default:!0,rendered:!1}}},addNodeView(){return hn(K4)}}).configure({languageClassPrefix:"language-",defaultLanguage:"bash",diagramTheme:"neutral",lowlight:iM}),J4=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n,t=c.ref(!!e.node.attrs.open);function o(){const r=!t.value;t.value=r,e.updateAttributes({open:r})}return(r,i)=>(c.openBlock(),c.createBlock(c.unref(Mn),c.mergeProps(e,{class:"o-details-view"}),{default:c.withCtx(()=>[c.createElementVNode("div",{class:c.normalizeClass(["details",{"is-open":t.value}])},[c.createElementVNode("button",{type:"button",onClick:o},[c.createVNode(c.unref(X),{name:"details_arrow"})]),c.createVNode(c.unref(to))],2)]),_:1},16))}}),lM=BC.extend({draggable:!0,addOptions(){var n;return{...(n=this.parent)==null?void 0:n.call(this),triggerCharacters:[">"]}},addInputRules(){const{triggerCharacters:n}=this.options,e=n.map(o=>o.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")).join(""),t=new RegExp(`^[${e}]\\s$`);return[new Vr({find:t,handler:({state:o,range:r})=>{const{tr:i,schema:s}=o,{$from:l}=i.selection,a=l.before(l.depth),u=l.after(l.depth);i.delete(r.from,r.to);const d=s.nodes.details.create(null,[s.nodes.detailsSummary.create(null),s.nodes.detailsContent.create(null,s.nodes.paragraph.create())]);i.replaceRangeWith(a,u,d);const f=q.near(i.doc.resolve(a+2));return i.setSelection(f),i}})]},addNodeView(){return hn(J4)}}),G4=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n,t=c.computed(()=>e.node.attrs.level);return(o,r)=>(c.openBlock(),c.createBlock(c.unref(Mn),c.mergeProps(e,{class:["o-heading-view",`h${t.value}`],style:`text-align: ${o.node.attrs.textAlign}`}),{default:c.withCtx(()=>[c.createVNode(c.unref(to))]),_:1},16,["class","style"]))}}),aM=aR.extend({draggable:!0,addNodeView(){return hn(G4)}}),X4={class:"horizontal"},Y4=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n;return(t,o)=>(c.openBlock(),c.createBlock(c.unref(Mn),c.mergeProps(e,{class:"o-horizontal-view"}),{default:c.withCtx(()=>[c.createElementVNode("div",X4,[c.createVNode(c.unref(to),{as:"div",class:"divider"})])]),_:1},16))}}),cM=cR.extend({draggable:!0,addNodeView(){return hn(Y4)}});/**
|
|
288
|
+
* Copyright 2026 Yiitap
|
|
289
|
+
* @license MIT
|
|
290
|
+
**/var Q4=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,Z4=Ie.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:n}){return["img",he(this.options.HTMLAttributes,n)]},parseMarkdown:(n,e)=>e.createNode("image",{src:n.href,title:n.title,alt:n.text}),renderMarkdown:n=>{var e,t,o,r,i,s;const l=(t=(e=n.attrs)==null?void 0:e.src)!=null?t:"",a=(r=(o=n.attrs)==null?void 0:o.alt)!=null?r:"",u=(s=(i=n.attrs)==null?void 0:i.title)!=null?s:"";return u?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||typeof document>"u")return null;const{directions:n,minWidth:e,minHeight:t,alwaysPreserveAspectRatio:o}=this.options.resize;return({node:r,getPos:i,HTMLAttributes:s,editor:l})=>{const a=document.createElement("img");Object.entries(s).forEach(([f,p])=>{if(p!=null)switch(f){case"width":case"height":break;default:a.setAttribute(f,p);break}}),a.src=s.src;const u=new bx({element:a,editor:l,node:r,getPos:i,onResize:(f,p)=>{a.style.width=`${f}px`,a.style.height=`${p}px`},onCommit:(f,p)=>{const h=i();h!==void 0&&this.editor.chain().setNodeSelection(h).updateAttributes(this.name,{width:f,height:p}).run()},onUpdate:(f,p,h)=>f.type===r.type,options:{directions:n,min:{width:e,height:t},preserveAspectRatio:o===!0}}),d=u.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",a.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},u}},addCommands(){return{setImage:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[md({find:Q4,type:this.type,getAttributes:n=>{const[,,e,t,o]=n;return{src:t,alt:e,title:o}}})]}}),e8=Z4;const t8=e8.extend({draggable:!0,addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),containerHeight:{default:0,rendered:!0},positionY:{default:0,rendered:!0},isDraggable:{default:!0,renderHTML:e=>({})}}},renderHTML({node:n,HTMLAttributes:e}){return e.containerHeight=n.attrs.containerHeight,e.positionY=n.attrs.positionY,["img",he(this.options.HTMLAttributes,e)]}}),n8={key:1,class:"image-panel"},o8={class:"label"},r8={key:1,class:"resize-overlay"},i8={class:"resize-guide"},s8={class:"size-display"},l8={key:1},a8=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n,{tr:t}=de(),{downloadImage:o}=wd(),{isEditable:r,getEditorImages:i}=ke(),s=c.ref(!1),l=c.ref(!1),a=c.ref({}),u=c.ref(null),d=c.ref(!1),f=c.ref(!1),p=c.ref(0),h=c.ref([]),m=c.ref(),g=c.ref(null),y=c.ref(null),b=c.ref(null),v=c.ref(!1),w=c.ref(""),k=c.ref(0),x=c.ref(0),C=c.ref(0),S=c.ref(0),M=c.ref(e.node.attrs.width||0),N=c.ref(e.node.attrs.height||0),A=c.ref(0),$=c.ref(0),O=c.ref(0),R=c.ref(1200),I=c.ref(0),L=c.ref(0),B=c.ref(800),W=c.ref(400),z=c.ref(!1),U=c.ref(!0),me=c.ref(!1),Ee=c.ref(e.node.attrs.positionY||0),Re=c.ref(0),Ue=c.ref(0),Fe=c.ref(!1),Te=c.computed(()=>e.node.attrs),te=c.computed({get(){return e.node.attrs.src},set(T){e.updateAttributes({src:T})}}),we=c.computed({get(){return e.node.attrs.title},set(T){e.updateAttributes({title:T})}});function Ne(){d.value=!0,setTimeout(()=>{var T;(T=u.value)==null||T.focus()},0)}function gt(){o(e.node.attrs.src)}function yt(){h.value=i(e.editor),p.value=h.value.findIndex(T=>T.pos===e.getPos())||0,f.value=!0}function io(){d.value=!1}function or(){te.value==="init"&&Tn(!0)}function Bo(T){s.value=!0,a.value=T}function Ro(T){switch(s.value=!1,T.value){case"replace":Tn(!0);break}}function rr(T){te.value=T,Tn(!1)}function Tn(T){l.value=T}const _o=c.computed(()=>({width:`${M.value}px`,maxWidth:`${R.value}px`,height:`${A.value}px`,maxHeight:z.value?`${I.value}px`:"auto",cursor:v.value?ir():"default"}));function ir(){switch(w.value){case"left":return"ew-resize";case"right":return"ew-resize";case"bottom":return"ew-resize";default:return"default"}}function sr(){var T,P,ee;if(b.value){$.value=b.value.naturalWidth,O.value=b.value.naturalHeight,B.value=((P=(T=m.value)==null?void 0:T.$el)==null?void 0:P.parentElement.getBoundingClientRect().width)??0,R.value=((ee=document.querySelector(".layout"))==null?void 0:ee.getBoundingClientRect().width)??1200;const be=$.value/O.value;B.value=Math.min(B.value,800),W.value=B.value/be,!M.value||!N.value?(z.value=$.value>B.value,z.value?(M.value=B.value,N.value=B.value/$.value*O.value):(M.value=$.value,N.value=O.value),gn()):z.value=M.value>B.value,L.value>0?A.value=L.value:(A.value=N.value,L.value=N.value),I.value=N.value,lo()}}function Pt(T,P){v.value=!0,w.value=P,C.value=T.clientX,S.value=T.clientY,k.value=M.value,x.value=N.value,document.addEventListener("mousemove",mn),document.addEventListener("mouseup",so)}function mn(T){if(!v.value)return;const P=T.clientX-C.value,ee=T.clientY-S.value,be=$.value/O.value;let fe=k.value,ct=L.value;switch(w.value){case"left":fe=k.value-P;break;case"right":fe=k.value+P;break;case"bottom":ct=L.value+ee;break}const Tt=fe/be;M.value=Math.round(fe),N.value=Math.round(Tt),z.value=fe>B.value,z.value?(A.value=ct,I.value=N.value):(A.value=N.value,Vs())}function so(){v.value=!1,w.value="",document.removeEventListener("mousemove",mn),document.removeEventListener("mouseup",so),L.value=A.value,gn()}function gn(){e.updateAttributes({width:M.value,height:N.value,containerHeight:L.value})}const Qt=c.computed(()=>!N.value||!A.value?0:Math.min(0,A.value-N.value)),Do=c.computed(()=>({transform:`translateY(${Ee.value}px)`,cursor:Vt.value?"grab":"default",transition:me.value?"none":"transform 0.2s ease"})),Vt=c.computed(()=>U.value&&z.value&&A.value<N.value);function jn(){U.value=!U.value}function lo(){z.value&&A.value<N.value?Fe.value=!0:Fe.value=!1}function Vs(){Ee.value!==0&&(Ee.value=0,Li())}function zs(T){!Vt.value||!Fe.value||v.value||T.target.closest(".block-resizer")||(T.preventDefault(),T.stopPropagation(),me.value=!0,Re.value=T.clientY,Ue.value=Ee.value,document.addEventListener("mousemove",Di),document.addEventListener("mouseup",Ii),document.body.style.userSelect="none",document.body.style.cursor="grabbing")}function Di(T){if(!me.value)return;const P=T.clientY-Re.value;let ee=Ue.value+P;ee=Math.max(Qt.value,Math.min(0,ee)),Ee.value=ee}function Ii(){me.value=!1,document.removeEventListener("mousemove",Di),document.removeEventListener("mouseup",Ii),document.body.style.userSelect="",document.body.style.cursor="",Li()}function Li(){e.updateAttributes({positionY:Ee.value})}return c.watch(()=>e.node.attrs.height,T=>{T&&(N.value=T)}),c.watch(()=>e.node.attrs.containerHeight,T=>{T&&(L.value=T,A.value=T,lo())}),c.watch(()=>e.node.attrs.positionY,T=>{T!==void 0&&(Ee.value=T)}),c.onMounted(()=>{Tn(te.value==="init"),Te.value.width&&(M.value=Te.value.width),Te.value.height&&(N.value=Te.value.height),Te.value.containerHeight&&(L.value=Te.value.containerHeight)}),c.onUnmounted(()=>{document.removeEventListener("mousemove",()=>{}),document.removeEventListener("mouseup",()=>{})}),(T,P)=>{var ee;return c.openBlock(),c.createBlock(c.unref(Mn),c.mergeProps({ref_key:"imageView",ref:m},e,{class:["o-image-view",{max:z.value,"with-caption":Te.value.alt,readonly:!((ee=T.editor)!=null&&ee.isEditable),init:te.value==="init"}],as:"div",onContextmenu:c.withModifiers(Bo,["prevent"]),onClick:or}),{default:c.withCtx(()=>[c.createVNode(c.unref(Eo),{modelValue:l.value,"onUpdate:modelValue":P[4]||(P[4]=be=>l.value=be),placement:te.value==="init"?"bottom":"top","show-arrow":""},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(ng),{val:te.value==="init"?"":te.value,type:"image",onInput:rr},null,8,["val"])]),default:c.withCtx(()=>{var be;return[te.value==="init"?(c.openBlock(),c.createBlock(c.unref(xd),{key:0,icon:"image",placeholder:"Add an image"})):(c.openBlock(),c.createElementBlock("div",n8,[c.createVNode(c.unref(eg),c.mergeProps(e,{onAction:Ro}),{default:c.withCtx(()=>[c.unref(r)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[Fe.value?(c.openBlock(),c.createBlock(c.unref(Ae),{key:0,icon:Vt.value?"arrow_expand":"close","icon-class":Vt.value?"rotate-315":"","content-class":"with-label",tooltip:c.unref(t)("image.repositionTips"),onClick:c.withModifiers(jn,["stop"])},{default:c.withCtx(()=>[c.createElementVNode("span",o8,c.toDisplayString(c.unref(t)("image.reposition")),1)]),_:1},8,["icon","icon-class","tooltip"])):c.createCommentVNode("",!0),c.createVNode(c.unref(Ae),{icon:"subtitles",tooltip:c.unref(t)("image.caption"),onClick:c.withModifiers(Ne,["stop"])},null,8,["tooltip"]),c.createVNode(c.unref(Zm),{editor:T.editor},null,8,["editor"]),c.createVNode(c.unref(Qm),{editor:T.editor,placement:"bottom-end"},null,8,["editor"])],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(Ae),{icon:"download",tooltip:c.unref(t)("label.download"),onClick:gt},null,8,["tooltip"]),c.createVNode(c.unref(Ae),{icon:"zoom_in",tooltip:c.unref(t)("image.zoom"),onClick:yt},null,8,["tooltip"])]),_:1},16),c.createElementVNode("div",{ref_key:"imageContainer",ref:g,class:"image-container",style:c.normalizeStyle(_o.value),onMousedown:zs},[c.createElementVNode("div",{ref_key:"imageWrapper",ref:y,class:"image-wrapper",style:c.normalizeStyle(Do.value)},[c.createElementVNode("img",c.mergeProps({ref_key:"imageElement",ref:b},Te.value,{draggable:"true","data-drag-handle":"",onLoad:sr}),null,16)],4),c.unref(r)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createElementVNode("div",{class:"block-resizer left",onMousedown:P[0]||(P[0]=c.withModifiers(fe=>Pt(fe,"left"),["stop","prevent"]))},[...P[7]||(P[7]=[c.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),c.createElementVNode("div",{class:"block-resizer right",onMousedown:P[1]||(P[1]=c.withModifiers(fe=>Pt(fe,"right"),["stop","prevent"]))},[...P[8]||(P[8]=[c.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32),z.value?(c.openBlock(),c.createElementBlock("div",{key:0,class:"block-resizer bottom",onMousedown:P[2]||(P[2]=c.withModifiers(fe=>Pt(fe,"bottom"),["stop","prevent"]))},[...P[9]||(P[9]=[c.createElementVNode("div",{class:"block-resizer-indicator"},null,-1)])],32)):c.createCommentVNode("",!0),v.value?(c.openBlock(),c.createElementBlock("div",r8,[c.createElementVNode("div",i8,[c.createElementVNode("div",s8,c.toDisplayString(M.value)+" × "+c.toDisplayString(A.value),1)])])):c.createCommentVNode("",!0)],64)):c.createCommentVNode("",!0)],36),c.createElementVNode("div",{class:"caption",onClick:Ne},[(be=T.editor)!=null&&be.isEditable&&d.value?(c.openBlock(),c.createBlock(c.unref(Zn),{key:0,ref_key:"captionInput",ref:u,class:"caption-input",modelValue:we.value,"onUpdate:modelValue":P[3]||(P[3]=fe=>we.value=fe),type:"text",placeholder:"Input caption",autosize:"",onBlur:io},null,8,["modelValue"])):(c.openBlock(),c.createElementBlock("span",l8,c.toDisplayString(we.value),1))])]))]}),_:1},8,["modelValue","placement"]),c.createVNode(c.unref(ya),{modelValue:s.value,"onUpdate:modelValue":P[5]||(P[5]=be=>s.value=be),event:a.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Fr),c.mergeProps(e,{onAction:Ro}),null,16)]),_:1},8,["modelValue","event"]),c.createVNode(c.unref(gC),{show:f.value,"onUpdate:show":P[6]||(P[6]=be=>f.value=be),images:h.value,current:p.value},{title:c.withCtx(()=>[...P[10]||(P[10]=[c.createTextVNode("Run",-1)])]),_:1},8,["show","images","current"])]),_:1},16,["class"])}}}),uM=t8.extend({addNodeView(){return hn(a8)}}).configure({inline:!0});function c8(n){return new ue({key:new ce("handleClickSelectLink"),props:{handleClick:(e,t,o)=>{const{schema:r,doc:i,tr:s}=e.state,l=Rs(i.resolve(t),r.marks.link);if(!l)return!1;const a=i.resolve(l.from),u=i.resolve(l.to),d=s.setSelection(new q(a,u));return e.dispatch(d),!0}}})}const dM=Lm.extend({addProseMirrorPlugins(){var n;return[...((n=this.parent)==null?void 0:n.call(this))||[],c8({type:this.type})]}}).configure({openOnClick:!1}),u8=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n;return(t,o)=>(c.openBlock(),c.createBlock(c.unref(Mn),c.mergeProps(e,{class:"o-paragraph-view"}),{default:c.withCtx(()=>[c.createVNode(c.unref(to),{as:"p",style:c.normalizeStyle(`text-align: ${t.node.attrs.textAlign}`)},null,8,["style"])]),_:1},16))}}),fM=GR.extend({draggable:!1,addNodeView(){return hn(u8,{stopEvent:()=>!1})}}),d8={class:"add"},f8=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n,{tr:t}=de(),{isEditable:o,run:r}=ke(),i=c.ref(!1);function s(){i.value=!0}function l(){a("tableSelectRow",{pos:e.getPos()})}function a(u,d={}){u==="tableDeleteRow"&&(i.value=!1),setTimeout(()=>{r(e.editor,u,d)},0)}return(u,d)=>(c.openBlock(),c.createBlock(c.unref(Tm),c.mergeProps({class:"o-table-cell-view",as:"td"},u.node.attrs,{style:{background:u.node.attrs.background}}),{default:c.withCtx(()=>[c.unref(o)?(c.openBlock(),c.createBlock(c.unref(Eo),{key:0,modelValue:i.value,"onUpdate:modelValue":d[2]||(d[2]=f=>i.value=f),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"select_all",placement:"left",tooltip:c.unref(t)("table.selectRow"),onClick:l},null,8,["tooltip"]),c.createVNode(c.unref(nt),{icon:"delete",placement:"left",tooltip:c.unref(t)("table.removeRow"),onClick:d[1]||(d[1]=f=>a("tableDeleteRow"))},null,8,["tooltip"])]),default:c.withCtx(()=>[c.createElementVNode("section",{class:c.normalizeClass(["row-handler",{active:i.value}]),onClick:s},[c.createElementVNode("div",d8,[d[3]||(d[3]=c.createElementVNode("div",{class:"indicator"},[c.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[c.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),c.createVNode(c.unref(Jn),{icon:"add_circle",color:c.unref(pe).blue,tooltip:c.unref(t)("table.addRow"),placement:"left",onClick:d[0]||(d[0]=c.withModifiers(f=>a("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])):c.createCommentVNode("",!0),c.createVNode(c.unref(to))]),_:1},16,["style"]))}}),pM=Bd.extend({addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),background:{default:""}}},addNodeView(){return hn(f8,{stopEvent:()=>!1})}}),p8={class:"add"},h8={class:"add"},m8=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n,{tr:t}=de(),{isEditable:o,run:r}=ke(),i=c.ref(!1),s=c.ref(!1);function l(){setTimeout(()=>{i.value=!0},0)}function a(){s.value=!0}function u(){i.value=!1,f("tableSelectColumn",{pos:e.getPos()})}function d(){f("tableSelectRow",{pos:e.getPos()})}function f(p,h={}){p==="tableDeleteRow"?s.value=!1:p==="tableDeleteColumn"&&(i.value=!1),setTimeout(()=>{r(e.editor,p,h)},0)}return(p,h)=>(c.openBlock(),c.createBlock(c.unref(Tm),c.mergeProps({class:"o-table-header-view",as:"th"},p.node.attrs,{style:{background:p.node.attrs.background}}),{default:c.withCtx(()=>[c.unref(o)?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createVNode(c.unref(Eo),{modelValue:i.value,"onUpdate:modelValue":h[2]||(h[2]=m=>i.value=m),placement:"top","tippy-class":"o-column-popover",offset:[0,20],"hide-click-outside":""},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"select_all",tooltip:c.unref(t)("table.selectColumn"),onClick:u},null,8,["tooltip"]),c.createVNode(c.unref(nt),{icon:"delete",tooltip:c.unref(t)("table.removeColumn"),onClick:h[1]||(h[1]=m=>f("tableDeleteColumn"))},null,8,["tooltip"])]),default:c.withCtx(()=>[c.createElementVNode("section",{class:c.normalizeClass(["col-handler",{active:i.value}]),onClick:l},[c.createElementVNode("div",p8,[h[6]||(h[6]=c.createElementVNode("div",{class:"indicator"},[c.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[c.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),c.createVNode(c.unref(Jn),{icon:"add_circle",color:c.unref(pe).blue,tooltip:c.unref(t)("table.addColumn"),onClick:h[0]||(h[0]=c.withModifiers(m=>f("tableAddColumn"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"]),c.createVNode(c.unref(Eo),{modelValue:s.value,"onUpdate:modelValue":h[5]||(h[5]=m=>s.value=m),placement:"left-start","tippy-class":"o-row-popover",offset:[-6,26],"hide-click-outside":""},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(nt),{icon:"select_all",placement:"left",tooltip:c.unref(t)("table.selectRow"),onClick:d},null,8,["tooltip"]),c.createVNode(c.unref(nt),{icon:"delete",placement:"left",tooltip:c.unref(t)("table.removeRow"),onClick:h[4]||(h[4]=m=>f("tableDeleteRow"))},null,8,["tooltip"])]),default:c.withCtx(()=>[c.createElementVNode("section",{class:c.normalizeClass(["row-handler",{active:s.value}]),onClick:a},[c.createElementVNode("div",h8,[h[7]||(h[7]=c.createElementVNode("div",{class:"indicator"},[c.createElementVNode("svg",{width:"3",height:"3",viewBox:"0 0 3 3",fill:"none"},[c.createElementVNode("circle",{cx:"1.5",cy:"1.5",r:"1.5",fill:"#BBBFC4"})])],-1)),c.createVNode(c.unref(Jn),{icon:"add_circle",color:c.unref(pe).blue,tooltip:c.unref(t)("table.addRow"),placement:"left",onClick:h[3]||(h[3]=c.withModifiers(m=>f("tableAddRow"),["stop"]))},null,8,["color","tooltip"])])],2)]),_:1},8,["modelValue"])],64)):c.createCommentVNode("",!0),c.createVNode(c.unref(to))]),_:1},16,["style"]))}}),hM=Rd.extend({addAttributes(){var n;return{...(n=this.parent)==null?void 0:n.call(this),background:{default:""}}},addNodeView(){return hn(m8,{stopEvent:()=>!1})}});/**
|
|
291
|
+
* Copyright 2026 Yiitap
|
|
292
|
+
* @license MIT
|
|
293
|
+
**/function mM(n,e,t){for(let o=0;;o++){if(o==n.childCount||o==e.childCount)return n.childCount==e.childCount?null:t;let r=n.child(o),i=e.child(o);if(r==i){t+=r.nodeSize;continue}if(!r.sameMarkup(i))return t;if(r.isText&&r.text!=i.text){for(let s=0;r.text[s]==i.text[s];s++)t++;return t}if(r.content.size||i.content.size){let s=mM(r.content,i.content,t+1);if(s!=null)return s}t+=r.nodeSize}}function gM(n,e,t,o){for(let r=n.childCount,i=e.childCount;;){if(r==0||i==0)return r==i?null:{a:t,b:o};let s=n.child(--r),l=e.child(--i),a=s.nodeSize;if(s==l){t-=a,o-=a;continue}if(!s.sameMarkup(l))return{a:t,b:o};if(s.isText&&s.text!=l.text){let u=0,d=Math.min(s.text.length,l.text.length);for(;u<d&&s.text[s.text.length-u-1]==l.text[l.text.length-u-1];)u++,t--,o--;return{a:t,b:o}}if(s.content.size||l.content.size){let u=gM(s.content,l.content,t-1,o-1);if(u)return u}t-=a,o-=a}}class G{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let o=0;o<e.length;o++)this.size+=e[o].nodeSize}nodesBetween(e,t,o,r=0,i){for(let s=0,l=0;l<t;s++){let a=this.content[s],u=l+a.nodeSize;if(u>e&&o(a,r+l,i||null,s)!==!1&&a.content.size){let d=l+1;a.nodesBetween(Math.max(0,e-d),Math.min(a.content.size,t-d),o,r+d)}l=u}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,o,r){let i="",s=!0;return this.nodesBetween(e,t,(l,a)=>{let u=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?r?typeof r=="function"?r(l):r:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&u||l.isTextblock)&&o&&(s?s=!1:i+=o),i+=u},0),i}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,o=e.firstChild,r=this.content.slice(),i=0;for(t.isText&&t.sameMarkup(o)&&(r[r.length-1]=t.withText(t.text+o.text),i=1);i<e.content.length;i++)r.push(e.content[i]);return new G(r,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let o=[],r=0;if(t>e)for(let i=0,s=0;s<t;i++){let l=this.content[i],a=s+l.nodeSize;a>e&&((s<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-s),Math.min(l.text.length,t-s)):l=l.cut(Math.max(0,e-s-1),Math.min(l.content.size,t-s-1))),o.push(l),r+=l.nodeSize),s=a}return new G(o,r)}cutByIndex(e,t){return e==t?G.empty:e==0&&t==this.content.length?this:new G(this.content.slice(e,t))}replaceChild(e,t){let o=this.content[e];if(o==t)return this;let r=this.content.slice(),i=this.size+t.nodeSize-o.nodeSize;return r[e]=t,new G(r,i)}addToStart(e){return new G([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new G(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,o=0;t<this.content.length;t++){let r=this.content[t];e(r,o,t),o+=r.nodeSize}}findDiffStart(e,t=0){return mM(this,e,t)}findDiffEnd(e,t=this.size,o=e.size){return gM(this,e,t,o)}findIndex(e){if(e==0)return oc(0,e);if(e==this.size)return oc(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,o=0;;t++){let r=this.child(t),i=o+r.nodeSize;if(i>=e)return i==e?oc(t+1,i):oc(t,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return G.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new G(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return G.empty;let t,o=0;for(let r=0;r<e.length;r++){let i=e[r];o+=i.nodeSize,r&&i.isText&&e[r-1].sameMarkup(i)?(t||(t=e.slice(0,r)),t[t.length-1]=i.withText(t[t.length-1].text+i.text)):t&&t.push(i)}return new G(t||e,o)}static from(e){if(!e)return G.empty;if(e instanceof G)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new G([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}G.empty=new G([],0);const Qf={index:0,offset:0};function oc(n,e){return Qf.index=n,Qf.offset=e,Qf}function Ah(n,e){if(n===e)return!0;if(!(n&&typeof n=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(n);if(Array.isArray(e)!=t)return!1;if(t){if(n.length!=e.length)return!1;for(let o=0;o<n.length;o++)if(!Ah(n[o],e[o]))return!1}else{for(let o in n)if(!(o in e)||!Ah(n[o],e[o]))return!1;for(let o in e)if(!(o in n))return!1}return!0}class tn{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,o=!1;for(let r=0;r<e.length;r++){let i=e[r];if(this.eq(i))return e;if(this.type.excludes(i.type))t||(t=e.slice(0,r));else{if(i.type.excludes(this.type))return e;!o&&i.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),o=!0),t&&t.push(i)}}return t||(t=e.slice()),o||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&Ah(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let o=e.marks[t.type];if(!o)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=o.create(t.attrs);return o.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let o=0;o<e.length;o++)if(!e[o].eq(t[o]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&e.length==0)return tn.none;if(e instanceof tn)return[e];let t=e.slice();return t.sort((o,r)=>o.type.rank-r.type.rank),t}}tn.none=[];class g8 extends Error{}class Z{constructor(e,t,o){this.content=e,this.openStart=t,this.openEnd=o}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let o=bM(this.content,e+this.openStart,t);return o&&new Z(o,this.openStart,this.openEnd)}removeBetween(e,t){return new Z(yM(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return Z.empty;let o=t.openStart||0,r=t.openEnd||0;if(typeof o!="number"||typeof r!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new Z(G.fromJSON(e,t.content),o,r)}static maxOpen(e,t=!0){let o=0,r=0;for(let i=e.firstChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.firstChild)o++;for(let i=e.lastChild;i&&!i.isLeaf&&(t||!i.type.spec.isolating);i=i.lastChild)r++;return new Z(e,o,r)}}Z.empty=new Z(G.empty,0,0);function yM(n,e,t){let{index:o,offset:r}=n.findIndex(e),i=n.maybeChild(o),{index:s,offset:l}=n.findIndex(t);if(r==e||i.isText){if(l!=t&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,e).append(n.cut(t))}if(o!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(o,i.copy(yM(i.content,e-r-1,t-r-1)))}function bM(n,e,t,o){let{index:r,offset:i}=n.findIndex(e),s=n.maybeChild(r);if(i==e||s.isText)return o&&!o.canReplace(r,r,t)?null:n.cut(0,e).append(t).append(n.cut(e));let l=bM(s.content,e-i-1,t,s);return l&&n.replaceChild(r,s.copy(l))}function y8(n){let e=Object.create(null);for(let t in n){let o=n[t];if(!o.hasDefault)return null;e[t]=o.default}return e}function b8(n,e){let t=Object.create(null);for(let o in n){let r=e&&e[o];if(r===void 0){let i=n[o];if(i.hasDefault)r=i.default;else throw new RangeError("No value supplied for attribute "+o)}t[o]=r}return t}function v8(n,e,t,o){for(let r in e)if(!(r in n))throw new RangeError(`Unsupported attribute ${r} for ${t} of type ${r}`);for(let r in n){let i=n[r];i.validate&&i.validate(e[r])}}function k8(n,e){let t=Object.create(null);if(e)for(let o in e)t[o]=new x8(n,o,e[o]);return t}function w8(n,e,t){let o=t.split("|");return r=>{let i=r===null?"null":typeof r;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${n}, got ${i}`)}}class x8{constructor(e,t,o){this.hasDefault=Object.prototype.hasOwnProperty.call(o,"default"),this.default=o.default,this.validate=typeof o.validate=="string"?w8(e,t,o.validate):o.validate}get isRequired(){return!this.hasDefault}}class Ug{constructor(e,t,o,r){this.name=e,this.rank=t,this.schema=o,this.spec=r,this.attrs=k8(e,r.attrs),this.excluded=null;let i=y8(this.attrs);this.instance=i?new tn(this,i):null}create(e=null){return!e&&this.instance?this.instance:new tn(this,b8(this.attrs,e))}static compile(e,t){let o=Object.create(null),r=0;return e.forEach((i,s)=>o[i]=new Ug(i,r++,t,s)),o}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){v8(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}function C8(n){return n.tag!=null}function S8(n){return n.style!=null}class Wu{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let o=this.matchedStyles=[];t.forEach(r=>{if(C8(r))this.tags.push(r);else if(S8(r)){let i=/[^=]*/.exec(r.style)[0];o.indexOf(i)<0&&o.push(i),this.styles.push(r)}}),this.normalizeLists=!this.tags.some(r=>{if(!/^(ul|ol)\b/.test(r.tag)||!r.node)return!1;let i=e.nodes[r.node];return i.contentMatch.matchType(i)})}parse(e,t={}){let o=new Mk(this,t,!1);return o.addAll(e,tn.none,t.from,t.to),o.finish()}parseSlice(e,t={}){let o=new Mk(this,t,!0);return o.addAll(e,tn.none,t.from,t.to),Z.maxOpen(o.finish())}matchTag(e,t,o){for(let r=o?this.tags.indexOf(o)+1:0;r<this.tags.length;r++){let i=this.tags[r];if(T8(e,i.tag)&&(i.namespace===void 0||e.namespaceURI==i.namespace)&&(!i.context||t.matchesContext(i.context))){if(i.getAttrs){let s=i.getAttrs(e);if(s===!1)continue;i.attrs=s||void 0}return i}}}matchStyle(e,t,o,r){for(let i=r?this.styles.indexOf(r)+1:0;i<this.styles.length;i++){let s=this.styles[i],l=s.style;if(!(l.indexOf(e)!=0||s.context&&!o.matchesContext(s.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(s.getAttrs){let a=s.getAttrs(t);if(a===!1)continue;s.attrs=a||void 0}return s}}}static schemaRules(e){let t=[];function o(r){let i=r.priority==null?50:r.priority,s=0;for(;s<t.length;s++){let l=t[s];if((l.priority==null?50:l.priority)<i)break}t.splice(s,0,r)}for(let r in e.marks){let i=e.marks[r].spec.parseDOM;i&&i.forEach(s=>{o(s=Tk(s)),s.mark||s.ignore||s.clearMark||(s.mark=r)})}for(let r in e.nodes){let i=e.nodes[r].spec.parseDOM;i&&i.forEach(s=>{o(s=Tk(s)),s.node||s.ignore||s.mark||(s.node=r)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Wu(e,Wu.schemaRules(e)))}}const vM={address:!0,article:!0,aside:!0,blockquote:!0,canvas:!0,dd:!0,div:!0,dl:!0,fieldset:!0,figcaption:!0,figure:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,li:!0,noscript:!0,ol:!0,output:!0,p:!0,pre:!0,section:!0,table:!0,tfoot:!0,ul:!0},E8={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},kM={ol:!0,ul:!0},sa=1,Oh=2,El=4;function Ek(n,e,t){return e!=null?(e?sa:0)|(e==="full"?Oh:0):n&&n.whitespace=="pre"?sa|Oh:t&~El}class rc{constructor(e,t,o,r,i,s){this.type=e,this.attrs=t,this.marks=o,this.solid=r,this.options=s,this.content=[],this.activeMarks=tn.none,this.match=i||(s&El?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(G.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let o=this.type.contentMatch,r;return(r=o.findWrapping(e.type))?(this.match=o,r):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&sa)){let o=this.content[this.content.length-1],r;if(o&&o.isText&&(r=/[ \t\r\n\u000c]+$/.exec(o.text))){let i=o;o.text.length==r[0].length?this.content.pop():this.content[this.content.length-1]=i.withText(i.text.slice(0,i.text.length-r[0].length))}}let t=G.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(G.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!vM.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Mk{constructor(e,t,o){this.parser=e,this.options=t,this.isOpen=o,this.open=0,this.localPreserveWS=!1;let r=t.topNode,i,s=Ek(null,t.preserveWhitespace,0)|(o?El:0);r?i=new rc(r.type,r.attrs,tn.none,!0,t.topMatch||r.type.contentMatch,s):o?i=new rc(null,null,tn.none,!0,null,s):i=new rc(e.schema.topNodeType,null,tn.none,!0,null,s),this.nodes=[i],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let o=e.nodeValue,r=this.top,i=r.options&Oh?"full":this.localPreserveWS||(r.options&sa)>0,{schema:s}=this.parser;if(i==="full"||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(o)){if(i)if(i==="full")o=o.replace(/\r\n?/g,`
|
|
294
|
+
`);else if(s.linebreakReplacement&&/[\r\n]/.test(o)&&this.top.findWrapping(s.linebreakReplacement.create())){let l=o.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(s.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(s.text(l[a]),t,!/\S/.test(l[a]));o=""}else o=o.replace(/\r?\n|\r/g," ");else if(o=o.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(o)&&this.open==this.nodes.length-1){let l=r.content[r.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(o=o.slice(1))}o&&this.insertNode(s.text(o),t,!/\S/.test(o)),this.findInText(e)}else this.findInside(e)}addElement(e,t,o){let r=this.localPreserveWS,i=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let s=e.nodeName.toLowerCase(),l;kM.hasOwnProperty(s)&&this.parser.normalizeLists&&M8(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,o));e:if(a?a.ignore:E8.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let u,d=this.needsBlock;if(vM.hasOwnProperty(s))i.content.length&&i.content[0].isInline&&this.open&&(this.open--,i=this.top),u=!0,i.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let f=a&&a.skip?t:this.readStyles(e,t);f&&this.addAll(e,f),u&&this.sync(i),this.needsBlock=d}else{let u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,a.consuming===!1?l:void 0)}this.localPreserveWS=r}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
|
|
295
|
+
`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let o=e.style;if(o&&o.length)for(let r=0;r<this.parser.matchedStyles.length;r++){let i=this.parser.matchedStyles[r],s=o.getPropertyValue(i);if(s)for(let l=void 0;;){let a=this.parser.matchStyle(i,s,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(u=>!a.clearMark(u)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,o,r){let i,s;if(t.node)if(s=this.parser.schema.nodes[t.node],s.isLeaf)this.insertNode(s.create(t.attrs),o,e.nodeName=="BR")||this.leafFallback(e,o);else{let a=this.enter(s,t.attrs||null,o,t.preserveWhitespace);a&&(i=!0,o=a)}else{let a=this.parser.schema.marks[t.mark];o=o.concat(a.create(t.attrs))}let l=this.top;if(s&&s.isLeaf)this.findInside(e);else if(r)this.addElement(e,o,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,o,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,o),this.findAround(e,a,!1)}i&&this.sync(l)&&this.open--}addAll(e,t,o,r){let i=o||0;for(let s=o?e.childNodes[o]:e.firstChild,l=r==null?null:e.childNodes[r];s!=l;s=s.nextSibling,++i)this.findAtPoint(e,i),this.addDOM(s,t);this.findAtPoint(e,i)}findPlace(e,t,o){let r,i;for(let s=this.open,l=0;s>=0;s--){let a=this.nodes[s],u=a.findWrapping(e);if(u&&(!r||r.length>u.length+l)&&(r=u,i=a,!u.length))break;if(a.solid){if(o)break;l+=2}}if(!r)return null;this.sync(i);for(let s=0;s<r.length;s++)t=this.enterInner(r[s],null,t,!1);return t}insertNode(e,t,o){if(e.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(t=this.enterInner(i,null,t))}let r=this.findPlace(e,t,o);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(e.type));let s=tn.none;for(let l of r.concat(e.marks))(i.type?i.type.allowsMarkType(l.type):Nk(l.type,e.type))&&(s=l.addToSet(s));return i.content.push(e.mark(s)),!0}return!1}enter(e,t,o,r){let i=this.findPlace(e.create(t),o,!1);return i&&(i=this.enterInner(e,t,o,!0,r)),i}enterInner(e,t,o,r=!1,i){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(e);let l=Ek(e,i,s.options);s.options&El&&s.content.length==0&&(l|=El);let a=tn.none;return o=o.filter(u=>(s.type?s.type.allowsMarkType(u.type):Nk(u.type,e))?(a=u.addToSet(a),!1):!0),this.nodes.push(new rc(e,t,a,r,null,l)),this.open++,o}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!!(this.isOpen||this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=sa)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let o=this.nodes[t].content;for(let r=o.length-1;r>=0;r--)e+=o[r].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let o=0;o<this.find.length;o++)this.find[o].node==e&&this.find[o].offset==t&&(this.find[o].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,o){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)this.find[r].pos==null&&e.nodeType==1&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(o?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),o=this.options.context,r=!this.isOpen&&(!o||o.parent.type==this.nodes[0].type),i=-(o?o.depth+1:0)+(r?0:1),s=(l,a)=>{for(;l>=0;l--){let u=t[l];if(u==""){if(l==t.length-1||l==0)continue;for(;a>=i;a--)if(s(l-1,a))return!0;return!1}else{let d=a>0||a==0&&r?this.nodes[a].type:o&&a>=i?o.node(a-i).type:null;if(!d||d.name!=u&&!d.isInGroup(u))return!1;a--}}return!0};return s(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(o&&o.isTextblock&&o.defaultAttrs)return o}for(let t in this.parser.schema.nodes){let o=this.parser.schema.nodes[t];if(o.isTextblock&&o.defaultAttrs)return o}}}function M8(n){for(let e=n.firstChild,t=null;e;e=e.nextSibling){let o=e.nodeType==1?e.nodeName.toLowerCase():null;o&&kM.hasOwnProperty(o)&&t?(t.appendChild(e),e=t):o=="li"?t=e:o&&(t=null)}}function T8(n,e){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,e)}function Tk(n){let e={};for(let t in n)e[t]=n[t];return e}function Nk(n,e){let t=e.schema.nodes;for(let o in t){let r=t[o];if(!r.allowsMarkType(n))continue;let i=[],s=l=>{i.push(l);for(let a=0;a<l.edgeCount;a++){let{type:u,next:d}=l.edge(a);if(u==e||i.indexOf(d)<0&&s(d))return!0}};if(s(r.contentMatch))return!0}}class Kd{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},o){o||(o=Zf(t).createDocumentFragment());let r=o,i=[];return e.forEach(s=>{if(i.length||s.marks.length){let l=0,a=0;for(;l<i.length&&a<s.marks.length;){let u=s.marks[a];if(!this.marks[u.type.name]){a++;continue}if(!u.eq(i[l][0])||u.type.spec.spanning===!1)break;l++,a++}for(;l<i.length;)r=i.pop()[1];for(;a<s.marks.length;){let u=s.marks[a++],d=this.serializeMark(u,s.isInline,t);d&&(i.push([u,r]),r.appendChild(d.dom),r=d.contentDOM||d.dom)}}r.appendChild(this.serializeNodeInner(s,t))}),o}serializeNodeInner(e,t){let{dom:o,contentDOM:r}=Ac(Zf(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return o}serializeNode(e,t={}){let o=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let i=this.serializeMark(e.marks[r],e.isInline,t);i&&((i.contentDOM||i.dom).appendChild(o),o=i.dom)}return o}serializeMark(e,t,o={}){let r=this.marks[e.type.name];return r&&Ac(Zf(o),r(e,t),null,e.attrs)}static renderSpec(e,t,o=null,r){return Ac(e,t,o,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new Kd(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=Ak(e.nodes);return t.text||(t.text=o=>o.text),t}static marksFromSchema(e){return Ak(e.marks)}}function Ak(n){let e={};for(let t in n){let o=n[t].spec.toDOM;o&&(e[t]=o)}return e}function Zf(n){return n.document||window.document}const Ok=new WeakMap;function N8(n){let e=Ok.get(n);return e===void 0&&Ok.set(n,e=A8(n)),e}function A8(n){let e=null;function t(o){if(o&&typeof o=="object")if(Array.isArray(o))if(typeof o[0]=="string")e||(e=[]),e.push(o);else for(let r=0;r<o.length;r++)t(o[r]);else for(let r in o)t(o[r])}return t(n),e}function Ac(n,e,t,o){if(typeof e=="string")return{dom:n.createTextNode(e)};if(e.nodeType!=null)return{dom:e};if(e.dom&&e.dom.nodeType!=null)return e;let r=e[0],i;if(typeof r!="string")throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=N8(o))&&i.indexOf(e)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=r.indexOf(" ");s>0&&(t=r.slice(0,s),r=r.slice(s+1));let l,a=t?n.createElementNS(t,r):n.createElement(r),u=e[1],d=1;if(u&&typeof u=="object"&&u.nodeType==null&&!Array.isArray(u)){d=2;for(let f in u)if(u[f]!=null){let p=f.indexOf(" ");p>0?a.setAttributeNS(f.slice(0,p),f.slice(p+1),u[f]):f=="style"&&a.style?a.style.cssText=u[f]:a.setAttribute(f,u[f])}}for(let f=d;f<e.length;f++){let p=e[f];if(p===0){if(f<e.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:a,contentDOM:a}}else{let{dom:h,contentDOM:m}=Ac(n,p,t,o);if(a.appendChild(h),m){if(l)throw new RangeError("Multiple content holes");l=m}}}return{dom:a,contentDOM:l}}const wM=65535,xM=Math.pow(2,16);function O8(n,e){return n+e*xM}function $k(n){return n&wM}function $8(n){return(n-(n&wM))/xM}const CM=1,SM=2,Oc=4,EM=8;class $h{constructor(e,t,o){this.pos=e,this.delInfo=t,this.recover=o}get deleted(){return(this.delInfo&EM)>0}get deletedBefore(){return(this.delInfo&(CM|Oc))>0}get deletedAfter(){return(this.delInfo&(SM|Oc))>0}get deletedAcross(){return(this.delInfo&Oc)>0}}class wn{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&wn.empty)return wn.empty}recover(e){let t=0,o=$k(e);if(!this.inverted)for(let r=0;r<o;r++)t+=this.ranges[r*3+2]-this.ranges[r*3+1];return this.ranges[o*3]+t+$8(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,o){let r=0,i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?r:0);if(a>e)break;let u=this.ranges[l+i],d=this.ranges[l+s],f=a+u;if(e<=f){let p=u?e==a?-1:e==f?1:t:t,h=a+r+(p<0?0:d);if(o)return h;let m=e==(t<0?a:f)?null:O8(l/3,e-a),g=e==a?SM:e==f?CM:Oc;return(t<0?e!=a:e!=f)&&(g|=EM),new $h(h,g,m)}r+=d-u}return o?e+r:new $h(e+r,0,null)}touches(e,t){let o=0,r=$k(t),i=this.inverted?2:1,s=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?o:0);if(a>e)break;let u=this.ranges[l+i],d=a+u;if(e<=d&&l==r*3)return!0;o+=this.ranges[l+s]-u}return!1}forEach(e){let t=this.inverted?2:1,o=this.inverted?1:2;for(let r=0,i=0;r<this.ranges.length;r+=3){let s=this.ranges[r],l=s-(this.inverted?i:0),a=s+(this.inverted?0:i),u=this.ranges[r+t],d=this.ranges[r+o];e(l,l+u,a,a+d),i+=d-u}}invert(){return new wn(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?wn.empty:new wn(e<0?[0,-e,0]:[0,0,e])}}wn.empty=new wn([]);class qu{constructor(e,t,o=0,r=e?e.length:0){this.mirror=t,this.from=o,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new qu(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,o=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],r!=null&&r<t?o+r:void 0)}}getMirror(e){if(this.mirror){for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,o=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),r!=null&&r>t?o-r-1:void 0)}}invert(){let e=new qu;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let o=this.from;o<this.to;o++)e=this._maps[o].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,o){let r=0;for(let i=this.from;i<this.to;i++){let s=this._maps[i],l=s.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(i);if(a!=null&&a>i&&a<this.to){i=a,e=this._maps[a].recover(l.recover);continue}}r|=l.delInfo,e=l.pos}return o?e:new $h(e,r,null)}}const ep=Object.create(null);class Yt{getMap(){return wn.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let o=ep[t.stepType];if(!o)throw new RangeError(`No step type ${t.stepType} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in ep)throw new RangeError("Duplicate use of step JSON ID "+e);return ep[e]=t,t.prototype.jsonID=e,t}}class pt{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new pt(e,null)}static fail(e){return new pt(null,e)}static fromReplace(e,t,o,r){try{return pt.ok(e.replace(t,o,r))}catch(i){if(i instanceof g8)return pt.fail(i.message);throw i}}}function Wg(n,e,t){let o=[];for(let r=0;r<n.childCount;r++){let i=n.child(r);i.content.size&&(i=i.copy(Wg(i.content,e,i))),i.isInline&&(i=e(i,t,r)),o.push(i)}return G.fromArray(o)}class Cr extends Yt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=e.resolve(this.from),r=o.node(o.sharedDepth(this.to)),i=new Z(Wg(t.content,(s,l)=>!s.isAtom||!l.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),r),t.openStart,t.openEnd);return pt.fromReplace(e,this.from,this.to,i)}invert(){return new yo(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new Cr(t.pos,o.pos,this.mark)}merge(e){return e instanceof Cr&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Cr(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Cr(t.from,t.to,e.markFromJSON(t.mark))}}Yt.jsonID("addMark",Cr);class yo extends Yt{constructor(e,t,o){super(),this.from=e,this.to=t,this.mark=o}apply(e){let t=e.slice(this.from,this.to),o=new Z(Wg(t.content,r=>r.mark(this.mark.removeFromSet(r.marks)),e),t.openStart,t.openEnd);return pt.fromReplace(e,this.from,this.to,o)}invert(){return new Cr(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deleted&&o.deleted||t.pos>=o.pos?null:new yo(t.pos,o.pos,this.mark)}merge(e){return e instanceof yo&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new yo(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new yo(t.from,t.to,e.markFromJSON(t.mark))}}Yt.jsonID("removeMark",yo);class Sr extends Yt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return pt.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return pt.fromReplace(e,this.pos,this.pos+1,new Z(G.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let o=this.mark.addToSet(t.marks);if(o.length==t.marks.length){for(let r=0;r<t.marks.length;r++)if(!t.marks[r].isInSet(o))return new Sr(this.pos,t.marks[r]);return new Sr(this.pos,this.mark)}}return new Ti(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Sr(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Sr(t.pos,e.markFromJSON(t.mark))}}Yt.jsonID("addNodeMark",Sr);class Ti extends Yt{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return pt.fail("No node at mark step's position");let o=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return pt.fromReplace(e,this.pos,this.pos+1,new Z(G.from(o),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new Sr(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ti(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Ti(t.pos,e.markFromJSON(t.mark))}}Yt.jsonID("removeNodeMark",Ti);class jt extends Yt{constructor(e,t,o,r=!1){super(),this.from=e,this.to=t,this.slice=o,this.structure=r}apply(e){return this.structure&&Bh(e,this.from,this.to)?pt.fail("Structure replace would overwrite content"):pt.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new wn([this.from,this.to-this.from,this.slice.size])}invert(e){return new jt(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1);return t.deletedAcross&&o.deletedAcross?null:new jt(t.pos,Math.max(t.pos,o.pos),this.slice,this.structure)}merge(e){if(!(e instanceof jt)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?Z.empty:new Z(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new jt(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?Z.empty:new Z(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new jt(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new jt(t.from,t.to,Z.fromJSON(e,t.slice),!!t.structure)}}Yt.jsonID("replace",jt);class Gn extends Yt{constructor(e,t,o,r,i,s,l=!1){super(),this.from=e,this.to=t,this.gapFrom=o,this.gapTo=r,this.slice=i,this.insert=s,this.structure=l}apply(e){if(this.structure&&(Bh(e,this.from,this.gapFrom)||Bh(e,this.gapTo,this.to)))return pt.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return pt.fail("Gap is not a flat range");let o=this.slice.insertAt(this.insert,t.content);return o?pt.fromReplace(e,this.from,this.to,o):pt.fail("Content does not fit in gap")}getMap(){return new wn([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Gn(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),o=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?o.pos:e.map(this.gapTo,1);return t.deletedAcross&&o.deletedAcross||r<t.pos||i>o.pos?null:new Gn(t.pos,o.pos,r,i,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Gn(t.from,t.to,t.gapFrom,t.gapTo,Z.fromJSON(e,t.slice),t.insert,!!t.structure)}}Yt.jsonID("replaceAround",Gn);function Bh(n,e,t){let o=n.resolve(e),r=t-e,i=o.depth;for(;r>0&&i>0&&o.indexAfter(i)==o.node(i).childCount;)i--,r--;if(r>0){let s=o.node(i).maybeChild(o.indexAfter(i));for(;r>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,r--}}return!1}function B8(n,e,t,o){let r=[],i=[],s,l;n.doc.nodesBetween(e,t,(a,u,d)=>{if(!a.isInline)return;let f=a.marks;if(!o.isInSet(f)&&d.type.allowsMarkType(o.type)){let p=Math.max(u,e),h=Math.min(u+a.nodeSize,t),m=o.addToSet(f);for(let g=0;g<f.length;g++)f[g].isInSet(m)||(s&&s.to==p&&s.mark.eq(f[g])?s.to=h:r.push(s=new yo(p,h,f[g])));l&&l.to==p?l.to=h:i.push(l=new Cr(p,h,o))}}),r.forEach(a=>n.step(a)),i.forEach(a=>n.step(a))}function R8(n,e,t,o){let r=[],i=0;n.doc.nodesBetween(e,t,(s,l)=>{if(!s.isInline)return;i++;let a=null;if(o instanceof Ug){let u=s.marks,d;for(;d=o.isInSet(u);)(a||(a=[])).push(d),u=d.removeFromSet(u)}else o?o.isInSet(s.marks)&&(a=[o]):a=s.marks;if(a&&a.length){let u=Math.min(l+s.nodeSize,t);for(let d=0;d<a.length;d++){let f=a[d],p;for(let h=0;h<r.length;h++){let m=r[h];m.step==i-1&&f.eq(r[h].style)&&(p=m)}p?(p.to=u,p.step=i):r.push({style:f,from:Math.max(l,e),to:u,step:i})}}}),r.forEach(s=>n.step(new yo(s.from,s.to,s.style)))}function qg(n,e,t,o=t.contentMatch,r=!0){let i=n.doc.nodeAt(e),s=[],l=e+1;for(let a=0;a<i.childCount;a++){let u=i.child(a),d=l+u.nodeSize,f=o.matchType(u.type);if(!f)s.push(new jt(l,d,Z.empty));else{o=f;for(let p=0;p<u.marks.length;p++)t.allowsMarkType(u.marks[p].type)||n.step(new yo(l,d,u.marks[p]));if(r&&u.isText&&t.whitespace!="pre"){let p,h=/\r?\n|\r/g,m;for(;p=h.exec(u.text);)m||(m=new Z(G.from(t.schema.text(" ",t.allowedMarks(u.marks))),0,0)),s.push(new jt(l+p.index,l+p.index+p[0].length,m))}}l=d}if(!o.validEnd){let a=o.fillBefore(G.empty,!0);n.replace(l,l,new Z(a,0,0))}for(let a=s.length-1;a>=0;a--)n.step(s[a])}function _8(n,e,t){let{$from:o,$to:r,depth:i}=e,s=o.before(i+1),l=r.after(i+1),a=s,u=l,d=G.empty,f=0;for(let m=i,g=!1;m>t;m--)g||o.index(m)>0?(g=!0,d=G.from(o.node(m).copy(d)),f++):a--;let p=G.empty,h=0;for(let m=i,g=!1;m>t;m--)g||r.after(m+1)<r.end(m)?(g=!0,p=G.from(r.node(m).copy(p)),h++):u++;n.step(new Gn(a,u,s,l,new Z(d.append(p),f,h),d.size-f,!0))}function D8(n,e,t){let o=G.empty;for(let s=t.length-1;s>=0;s--){if(o.size){let l=t[s].type.contentMatch.matchFragment(o);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}o=G.from(t[s].type.create(t[s].attrs,o))}let r=e.start,i=e.end;n.step(new Gn(r,i,r,i,new Z(o,0,0),t.length,!0))}function I8(n,e,t,o,r){if(!o.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=n.steps.length;n.doc.nodesBetween(e,t,(s,l)=>{let a=typeof r=="function"?r(s):r;if(s.isTextblock&&!s.hasMarkup(o,a)&&L8(n.doc,n.mapping.slice(i).map(l),o)){let u=null;if(o.schema.linebreakReplacement){let h=o.whitespace=="pre",m=!!o.contentMatch.matchType(o.schema.linebreakReplacement);h&&!m?u=!1:!h&&m&&(u=!0)}u===!1&&TM(n,s,l,i),qg(n,n.mapping.slice(i).map(l,1),o,void 0,u===null);let d=n.mapping.slice(i),f=d.map(l,1),p=d.map(l+s.nodeSize,1);return n.step(new Gn(f,p,f+1,p-1,new Z(G.from(o.create(a,null,s.marks)),0,0),1,!0)),u===!0&&MM(n,s,l,i),!1}})}function MM(n,e,t,o){e.forEach((r,i)=>{if(r.isText){let s,l=/\r?\n|\r/g;for(;s=l.exec(r.text);){let a=n.mapping.slice(o).map(t+1+i+s.index);n.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function TM(n,e,t,o){e.forEach((r,i)=>{if(r.type==r.type.schema.linebreakReplacement){let s=n.mapping.slice(o).map(t+1+i);n.replaceWith(s,s+1,e.type.schema.text(`
|
|
296
|
+
`))}})}function L8(n,e,t){let o=n.resolve(e),r=o.index();return o.parent.canReplaceWith(r,r+1,t)}function P8(n,e,t,o,r){let i=n.doc.nodeAt(e);if(!i)throw new RangeError("No node at given position");t||(t=i.type);let s=t.create(o,null,r||i.marks);if(i.isLeaf)return n.replaceWith(e,e+i.nodeSize,s);if(!t.validContent(i.content))throw new RangeError("Invalid content for node type "+t.name);n.step(new Gn(e,e+i.nodeSize,e+1,e+i.nodeSize-1,new Z(G.from(s),0,0),1,!0))}function V8(n,e,t=1,o){let r=n.doc.resolve(e),i=G.empty,s=G.empty;for(let l=r.depth,a=r.depth-t,u=t-1;l>a;l--,u--){i=G.from(r.node(l).copy(i));let d=o&&o[u];s=G.from(d?d.type.create(d.attrs,s):r.node(l).copy(s))}n.step(new jt(e,e,new Z(i.append(s),t,t),!0))}function z8(n,e,t){let o=null,{linebreakReplacement:r}=n.doc.type.schema,i=n.doc.resolve(e-t),s=i.node().type;if(r&&s.inlineContent){let d=s.whitespace=="pre",f=!!s.contentMatch.matchType(r);d&&!f?o=!1:!d&&f&&(o=!0)}let l=n.steps.length;if(o===!1){let d=n.doc.resolve(e+t);TM(n,d.node(),d.before(),l)}s.inlineContent&&qg(n,e+t-1,s,i.node().contentMatchAt(i.index()),o==null);let a=n.mapping.slice(l),u=a.map(e-t);if(n.step(new jt(u,a.map(e+t,-1),Z.empty,!0)),o===!0){let d=n.doc.resolve(u);MM(n,d.node(),d.before(),n.steps.length)}return n}function F8(n,e,t){let o=n.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),t))return e;if(o.parentOffset==0)for(let r=o.depth-1;r>=0;r--){let i=o.index(r);if(o.node(r).canReplaceWith(i,i,t))return o.before(r+1);if(i>0)return null}if(o.parentOffset==o.parent.content.size)for(let r=o.depth-1;r>=0;r--){let i=o.indexAfter(r);if(o.node(r).canReplaceWith(i,i,t))return o.after(r+1);if(i<o.node(r).childCount)return null}return null}function H8(n,e,t){let o=n.resolve(e);if(!t.content.size)return e;let r=t.content;for(let i=0;i<t.openStart;i++)r=r.firstChild.content;for(let i=1;i<=(t.openStart==0&&t.size?2:1);i++)for(let s=o.depth;s>=0;s--){let l=s==o.depth?0:o.pos<=(o.start(s+1)+o.end(s+1))/2?-1:1,a=o.index(s)+(l>0?1:0),u=o.node(s),d=!1;if(i==1)d=u.canReplace(a,a,r);else{let f=u.contentMatchAt(a).findWrapping(r.firstChild.type);d=f&&u.canReplaceWith(a,a,f[0])}if(d)return l==0?o.pos:l<0?o.before(s+1):o.after(s+1)}return null}function j8(n,e,t=e,o=Z.empty){if(e==t&&!o.size)return null;let r=n.resolve(e),i=n.resolve(t);return NM(r,i,o)?new jt(e,t,o):new U8(r,i,o).fit()}function NM(n,e,t){return!t.openStart&&!t.openEnd&&n.start()==e.start()&&n.parent.canReplace(n.index(),e.index(),t.content)}class U8{constructor(e,t,o){this.$from=e,this.$to=t,this.unplaced=o,this.frontier=[],this.placed=G.empty;for(let r=0;r<=e.depth;r++){let i=e.node(r);this.frontier.push({type:i.type,match:i.contentMatchAt(e.indexAfter(r))})}for(let r=e.depth;r>0;r--)this.placed=G.from(e.node(r).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let u=this.findFittable();u?this.placeNodes(u):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,o=this.$from,r=this.close(e<0?this.$to:o.doc.resolve(e));if(!r)return null;let i=this.placed,s=o.depth,l=r.depth;for(;s&&l&&i.childCount==1;)i=i.firstChild.content,s--,l--;let a=new Z(i,s,l);return e>-1?new Gn(o.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||o.pos!=this.$to.pos?new jt(o.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,o=0,r=this.unplaced.openEnd;o<e;o++){let i=t.firstChild;if(t.childCount>1&&(r=0),i.type.spec.isolating&&r<=o){e=o;break}t=i.content}for(let t=1;t<=2;t++)for(let o=t==1?e:this.unplaced.openStart;o>=0;o--){let r,i=null;o?(i=tp(this.unplaced.content,o-1).firstChild,r=i.content):r=this.unplaced.content;let s=r.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:u}=this.frontier[l],d,f=null;if(t==1&&(s?u.matchType(s.type)||(f=u.fillBefore(G.from(s),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:o,frontierDepth:l,parent:i,inject:f};if(t==2&&s&&(d=u.findWrapping(s.type)))return{sliceDepth:o,frontierDepth:l,parent:i,wrap:d};if(i&&u.matchType(i.type))break}}}openMore(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=tp(e,t);return!r.childCount||r.firstChild.isLeaf?!1:(this.unplaced=new Z(e,t+1,Math.max(o,r.size+t>=e.size-o?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:o}=this.unplaced,r=tp(e,t);if(r.childCount<=1&&t>0){let i=e.size-t<=t+r.size;this.unplaced=new Z(sl(e,t-1,1),t-1,i?t-1:o)}else this.unplaced=new Z(sl(e,t,1),t,o)}placeNodes({sliceDepth:e,frontierDepth:t,parent:o,inject:r,wrap:i}){for(;this.depth>t;)this.closeFrontierNode();if(i)for(let g=0;g<i.length;g++)this.openFrontierNode(i[g]);let s=this.unplaced,l=o?o.content:s.content,a=s.openStart-e,u=0,d=[],{match:f,type:p}=this.frontier[t];if(r){for(let g=0;g<r.childCount;g++)d.push(r.child(g));f=f.matchFragment(r)}let h=l.size+e-(s.content.size-s.openEnd);for(;u<l.childCount;){let g=l.child(u),y=f.matchType(g.type);if(!y)break;u++,(u>1||a==0||g.content.size)&&(f=y,d.push(AM(g.mark(p.allowedMarks(g.marks)),u==1?a:0,u==l.childCount?h:-1)))}let m=u==l.childCount;m||(h=-1),this.placed=ll(this.placed,t,G.from(d)),this.frontier[t].match=f,m&&h<0&&o&&o.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let g=0,y=l;g<h;g++){let b=y.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),y=b.content}this.unplaced=m?e==0?Z.empty:new Z(sl(s.content,e-1,1),e-1,h<0?s.openEnd:e-1):new Z(sl(s.content,e,u),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!np(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:o}=this.$to,r=this.$to.after(o);for(;o>1&&r==this.$to.end(--o);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:o,type:r}=this.frontier[t],i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=np(e,t,r,o,i);if(s){for(let l=t-1;l>=0;l--){let{match:a,type:u}=this.frontier[l],d=np(e,l,u,a,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=ll(this.placed,t.depth,t.fit)),e=t.move;for(let o=t.depth+1;o<=e.depth;o++){let r=e.node(o),i=r.type.contentMatch.fillBefore(r.content,!0,e.index(o));this.openFrontierNode(r.type,r.attrs,i)}return e}openFrontierNode(e,t=null,o){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=ll(this.placed,this.depth,G.from(e.create(t,o))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(G.empty,!0);e.childCount&&(this.placed=ll(this.placed,this.frontier.length,e))}}function sl(n,e,t){return e==0?n.cutByIndex(t,n.childCount):n.replaceChild(0,n.firstChild.copy(sl(n.firstChild.content,e-1,t)))}function ll(n,e,t){return e==0?n.append(t):n.replaceChild(n.childCount-1,n.lastChild.copy(ll(n.lastChild.content,e-1,t)))}function tp(n,e){for(let t=0;t<e;t++)n=n.firstChild.content;return n}function AM(n,e,t){if(e<=0)return n;let o=n.content;return e>1&&(o=o.replaceChild(0,AM(o.firstChild,e-1,o.childCount==1?t-1:0))),e>0&&(o=n.type.contentMatch.fillBefore(o).append(o),t<=0&&(o=o.append(n.type.contentMatch.matchFragment(o).fillBefore(G.empty,!0)))),n.copy(o)}function np(n,e,t,o,r){let i=n.node(e),s=r?n.indexAfter(e):n.index(e);if(s==i.childCount&&!t.compatibleContent(i.type))return null;let l=o.fillBefore(i.content,!0,s);return l&&!W8(t,i.content,s)?l:null}function W8(n,e,t){for(let o=t;o<e.childCount;o++)if(!n.allowsMarks(e.child(o).marks))return!0;return!1}function q8(n){return n.spec.defining||n.spec.definingForContent}function K8(n,e,t,o){if(!o.size)return n.deleteRange(e,t);let r=n.doc.resolve(e),i=n.doc.resolve(t);if(NM(r,i,o))return n.step(new jt(e,t,o));let s=$M(r,i);s[s.length-1]==0&&s.pop();let l=-(r.depth+1);s.unshift(l);for(let p=r.depth,h=r.pos-1;p>0;p--,h--){let m=r.node(p).type.spec;if(m.defining||m.definingAsContext||m.isolating)break;s.indexOf(p)>-1?l=p:r.before(p)==h&&s.splice(1,0,-p)}let a=s.indexOf(l),u=[],d=o.openStart;for(let p=o.content,h=0;;h++){let m=p.firstChild;if(u.push(m),h==o.openStart)break;p=m.content}for(let p=d-1;p>=0;p--){let h=u[p],m=q8(h.type);if(m&&!h.sameMarkup(r.node(Math.abs(l)-1)))d=p;else if(m||!h.type.isTextblock)break}for(let p=o.openStart;p>=0;p--){let h=(p+d+1)%(o.openStart+1),m=u[h];if(m)for(let g=0;g<s.length;g++){let y=s[(g+a)%s.length],b=!0;y<0&&(b=!1,y=-y);let v=r.node(y-1),w=r.index(y-1);if(v.canReplaceWith(w,w,m.type,m.marks))return n.replace(r.before(y),b?i.after(y):t,new Z(OM(o.content,0,o.openStart,h),h,o.openEnd))}}let f=n.steps.length;for(let p=s.length-1;p>=0&&(n.replace(e,t,o),!(n.steps.length>f));p--){let h=s[p];h<0||(e=r.before(h),t=i.after(h))}}function OM(n,e,t,o,r){if(e<t){let i=n.firstChild;n=n.replaceChild(0,i.copy(OM(i.content,e+1,t,o,i)))}if(e>o){let i=r.contentMatchAt(0),s=i.fillBefore(n).append(n);n=s.append(i.matchFragment(s).fillBefore(G.empty,!0))}return n}function J8(n,e,t,o){if(!o.isInline&&e==t&&n.doc.resolve(e).parent.content.size){let r=F8(n.doc,e,o.type);r!=null&&(e=t=r)}n.replaceRange(e,t,new Z(G.from(o),0,0))}function G8(n,e,t){let o=n.doc.resolve(e),r=n.doc.resolve(t),i=$M(o,r);for(let s=0;s<i.length;s++){let l=i[s],a=s==i.length-1;if(a&&l==0||o.node(l).type.contentMatch.validEnd)return n.delete(o.start(l),r.end(l));if(l>0&&(a||o.node(l-1).canReplace(o.index(l-1),r.indexAfter(l-1))))return n.delete(o.before(l),r.after(l))}for(let s=1;s<=o.depth&&s<=r.depth;s++)if(e-o.start(s)==o.depth-s&&t>o.end(s)&&r.end(s)-t!=r.depth-s&&o.start(s-1)==r.start(s-1)&&o.node(s-1).canReplace(o.index(s-1),r.index(s-1)))return n.delete(o.before(s),t);n.delete(e,t)}function $M(n,e){let t=[],o=Math.min(n.depth,e.depth);for(let r=o;r>=0;r--){let i=n.start(r);if(i<n.pos-(n.depth-r)||e.end(r)>e.pos+(e.depth-r)||n.node(r).type.spec.isolating||e.node(r).type.spec.isolating)break;(i==e.start(r)||r==n.depth&&r==e.depth&&n.parent.inlineContent&&e.parent.inlineContent&&r&&e.start(r-1)==i-1)&&t.push(r)}return t}class as extends Yt{constructor(e,t,o){super(),this.pos=e,this.attr=t,this.value=o}apply(e){let t=e.nodeAt(this.pos);if(!t)return pt.fail("No node at attribute step's position");let o=Object.create(null);for(let i in t.attrs)o[i]=t.attrs[i];o[this.attr]=this.value;let r=t.type.create(o,null,t.marks);return pt.fromReplace(e,this.pos,this.pos+1,new Z(G.from(r),0,t.isLeaf?0:1))}getMap(){return wn.empty}invert(e){return new as(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new as(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new as(t.pos,t.attr,t.value)}}Yt.jsonID("attr",as);class la extends Yt{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let r in e.attrs)t[r]=e.attrs[r];t[this.attr]=this.value;let o=e.type.create(t,e.content,e.marks);return pt.ok(o)}getMap(){return wn.empty}invert(e){return new la(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new la(t.attr,t.value)}}Yt.jsonID("docAttr",la);let $s=class extends Error{};$s=function n(e){let t=Error.call(this,e);return t.__proto__=n.prototype,t};$s.prototype=Object.create(Error.prototype);$s.prototype.constructor=$s;$s.prototype.name="TransformError";class X8{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new qu}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new $s(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let o=0;o<this.mapping.maps.length;o++){let r=this.mapping.maps[o];o&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((i,s,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,o=Z.empty){let r=j8(this.doc,e,t,o);return r&&this.step(r),this}replaceWith(e,t,o){return this.replace(e,t,new Z(G.from(o),0,0))}delete(e,t){return this.replace(e,t,Z.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,o){return K8(this,e,t,o),this}replaceRangeWith(e,t,o){return J8(this,e,t,o),this}deleteRange(e,t){return G8(this,e,t),this}lift(e,t){return _8(this,e,t),this}join(e,t=1){return z8(this,e,t),this}wrap(e,t){return D8(this,e,t),this}setBlockType(e,t=e,o,r=null){return I8(this,e,t,o,r),this}setNodeMarkup(e,t,o=null,r){return P8(this,e,t,o,r),this}setNodeAttribute(e,t,o){return this.step(new as(e,t,o)),this}setDocAttribute(e,t){return this.step(new la(e,t)),this}addNodeMark(e,t){return this.step(new Sr(e,t)),this}removeNodeMark(e,t){let o=this.doc.nodeAt(e);if(!o)throw new RangeError("No node at position "+e);if(t instanceof tn)t.isInSet(o.marks)&&this.step(new Ti(e,t));else{let r=o.marks,i,s=[];for(;i=t.isInSet(r);)s.push(new Ti(e,i)),r=i.removeFromSet(r);for(let l=s.length-1;l>=0;l--)this.step(s[l])}return this}split(e,t=1,o){return V8(this,e,t,o),this}addMark(e,t,o){return B8(this,e,t,o),this}removeMark(e,t,o){return R8(this,e,t,o),this}clearIncompatible(e,t,o){return qg(this,e,t,o),this}}const op=Object.create(null);class De{constructor(e,t,o){this.$anchor=e,this.$head=t,this.ranges=o||[new BM(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=Z.empty){let o=t.content.lastChild,r=null;for(let l=0;l<t.openEnd;l++)r=o,o=o.lastChild;let i=e.steps.length,s=this.ranges;for(let l=0;l<s.length;l++){let{$from:a,$to:u}=s[l],d=e.mapping.slice(i);e.replaceRange(d.map(a.pos),d.map(u.pos),l?Z.empty:t),l==0&&_k(e,i,(o?o.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let o=e.steps.length,r=this.ranges;for(let i=0;i<r.length;i++){let{$from:s,$to:l}=r[i],a=e.mapping.slice(o),u=a.map(s.pos),d=a.map(l.pos);i?e.deleteRange(u,d):(e.replaceRangeWith(u,d,t),_k(e,o,t.isInline?-1:1))}}static findFrom(e,t,o=!1){let r=e.parent.inlineContent?new Le(e):Yi(e.node(0),e.parent,e.pos,e.index(),t,o);if(r)return r;for(let i=e.depth-1;i>=0;i--){let s=t<0?Yi(e.node(0),e.node(i),e.before(i+1),e.index(i),t,o):Yi(e.node(0),e.node(i),e.after(i+1),e.index(i)+1,t,o);if(s)return s}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new wo(e.node(0))}static atStart(e){return Yi(e,e,0,0,1)||new wo(e)}static atEnd(e){return Yi(e,e,e.content.size,e.childCount,-1)||new wo(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let o=op[t.type];if(!o)throw new RangeError(`No selection type ${t.type} defined`);return o.fromJSON(e,t)}static jsonID(e,t){if(e in op)throw new RangeError("Duplicate use of selection JSON ID "+e);return op[e]=t,t.prototype.jsonID=e,t}getBookmark(){return Le.between(this.$anchor,this.$head).getBookmark()}}De.prototype.visible=!0;class BM{constructor(e,t){this.$from=e,this.$to=t}}let Bk=!1;function Rk(n){!Bk&&!n.parent.inlineContent&&(Bk=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}class Le extends De{constructor(e,t=e){Rk(e),Rk(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let o=e.resolve(t.map(this.head));if(!o.parent.inlineContent)return De.near(o);let r=e.resolve(t.map(this.anchor));return new Le(r.parent.inlineContent?r:o,o)}replace(e,t=Z.empty){if(super.replace(e,t),t==Z.empty){let o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}eq(e){return e instanceof Le&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new Jd(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new Le(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){let r=e.resolve(t);return new this(r,o==t?r:e.resolve(o))}static between(e,t,o){let r=e.pos-t.pos;if((!o||r)&&(o=r>=0?1:-1),!t.parent.inlineContent){let i=De.findFrom(t,o,!0)||De.findFrom(t,-o,!0);if(i)t=i.$head;else return De.near(t,o)}return e.parent.inlineContent||(r==0?e=t:(e=(De.findFrom(e,-o,!0)||De.findFrom(e,o,!0)).$anchor,e.pos<t.pos!=r<0&&(e=t))),new Le(e,t)}}De.jsonID("text",Le);class Jd{constructor(e,t){this.anchor=e,this.head=t}map(e){return new Jd(e.map(this.anchor),e.map(this.head))}resolve(e){return Le.between(e.resolve(this.anchor),e.resolve(this.head))}}class Be extends De{constructor(e){let t=e.nodeAfter,o=e.node(0).resolve(e.pos+t.nodeSize);super(e,o),this.node=t}map(e,t){let{deleted:o,pos:r}=t.mapResult(this.anchor),i=e.resolve(r);return o?De.near(i):new Be(i)}content(){return new Z(G.from(this.node),0,0)}eq(e){return e instanceof Be&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new Kg(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new Be(e.resolve(t.anchor))}static create(e,t){return new Be(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}Be.prototype.visible=!1;De.jsonID("node",Be);class Kg{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:o}=e.mapResult(this.anchor);return t?new Jd(o,o):new Kg(o)}resolve(e){let t=e.resolve(this.anchor),o=t.nodeAfter;return o&&Be.isSelectable(o)?new Be(t):De.near(t)}}class wo extends De{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=Z.empty){if(t==Z.empty){e.delete(0,e.doc.content.size);let o=De.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new wo(e)}map(e){return new wo(e)}eq(e){return e instanceof wo}getBookmark(){return Y8}}De.jsonID("all",wo);const Y8={map(){return this},resolve(n){return new wo(n)}};function Yi(n,e,t,o,r,i=!1){if(e.inlineContent)return Le.create(n,t);for(let s=o-(r>0?0:1);r>0?s<e.childCount:s>=0;s+=r){let l=e.child(s);if(l.isAtom){if(!i&&Be.isSelectable(l))return Be.create(n,t-(r<0?l.nodeSize:0))}else{let a=Yi(n,l,t+r,r<0?l.childCount:0,r,i);if(a)return a}t+=l.nodeSize*r}return null}function _k(n,e,t){let o=n.steps.length-1;if(o<e)return;let r=n.steps[o];if(!(r instanceof jt||r instanceof Gn))return;let i=n.mapping.maps[o],s;i.forEach((l,a,u,d)=>{s==null&&(s=d)}),n.setSelection(De.near(n.doc.resolve(s),t))}function Dk(n,e){return!e||!n?n:n.bind(e)}class ic{constructor(e,t,o){this.name=e,this.init=Dk(t.init,o),this.apply=Dk(t.apply,o)}}new ic("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new ic("selection",{init(n,e){return n.selection||De.atStart(e.doc)},apply(n){return n.selection}}),new ic("storedMarks",{init(n){return n.storedMarks||null},apply(n,e,t,o){return o.selection.$cursor?n.storedMarks:null}}),new ic("scrollToSelection",{init(){return 0},apply(n,e){return n.scrolledIntoView?e+1:e}});function RM(n,e,t){for(let o in n){let r=n[o];r instanceof Function?r=r.bind(e):o=="handleDOMEvents"&&(r=RM(r,e,{})),t[o]=r}return t}class _M{constructor(e){this.spec=e,this.props={},e.props&&RM(e.props,this,this.props),this.key=e.key?e.key.key:DM("plugin")}getState(e){return e[this.key]}}const rp=Object.create(null);function DM(n){return n in rp?n+"$"+ ++rp[n]:(rp[n]=0,n+"$")}class Jg{constructor(e="key"){this.key=DM(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Ri=function(n){for(var e=0;;e++)if(n=n.previousSibling,!n)return e},IM=function(n,e,t,o){return t&&(Ik(n,e,t,o,-1)||Ik(n,e,t,o,1))},Q8=/^(img|br|input|textarea|hr)$/i;function Ik(n,e,t,o,r){for(var i;;){if(n==t&&e==o)return!0;if(e==(r<0?0:Ku(n))){let s=n.parentNode;if(!s||s.nodeType!=1||Gg(n)||Q8.test(n.nodeName)||n.contentEditable=="false")return!1;e=Ri(n)+(r<0?0:1),n=s}else if(n.nodeType==1){let s=n.childNodes[e+(r<0?-1:0)];if(s.nodeType==1&&s.contentEditable=="false")if(!((i=s.pmViewDesc)===null||i===void 0)&&i.ignoreForSelection)e+=r;else return!1;else n=s,e=r<0?Ku(n):0}else return!1}}function Ku(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Z8(n,e,t){for(let o=e==0,r=e==Ku(n);o||r;){if(n==t)return!0;let i=Ri(n);if(n=n.parentNode,!n)return!1;o=o&&i==0,r=r&&i==Ku(n)}}function Gg(n){let e;for(let t=n;t&&!(e=t.pmViewDesc);t=t.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==n||e.contentDOM==n)}const LM=function(n){return n.focusNode&&IM(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function PM(n,e){let t=document.createEvent("Event");return t.initEvent("keydown",!0,!0),t.keyCode=n,t.key=t.code=e,t}const To=typeof navigator<"u"?navigator:null,Lk=typeof document<"u"?document:null,Ur=To&&To.userAgent||"",Rh=/Edge\/(\d+)/.exec(Ur),VM=/MSIE \d/.exec(Ur),_h=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Ur),Sa=!!(VM||_h||Rh),zM=VM?document.documentMode:_h?+_h[1]:Rh?+Rh[1]:0,Gd=!Sa&&/gecko\/(\d+)/i.test(Ur);Gd&&+(/Firefox\/(\d+)/.exec(Ur)||[0,0])[1];const Dh=!Sa&&/Chrome\/(\d+)/.exec(Ur),nr=!!Dh,FM=Dh?+Dh[1]:0,_i=!Sa&&!!To&&/Apple Computer/.test(To.vendor),Xg=_i&&(/Mobile\/\w+/.test(Ur)||!!To&&To.maxTouchPoints>2),$n=Xg||(To?/Mac/.test(To.platform):!1),HM=To?/Win/.test(To.platform):!1,Ea=/Android \d/.test(Ur),Yg=!!Lk&&"webkitFontSmoothing"in Lk.documentElement.style,eq=Yg?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function tq(n,e=null){let t=n.domSelectionRange(),o=n.state.doc;if(!t.focusNode)return null;let r=n.docView.nearestDesc(t.focusNode),i=r&&r.size==0,s=n.docView.posFromDOM(t.focusNode,t.focusOffset,1);if(s<0)return null;let l=o.resolve(s),a,u;if(LM(t)){for(a=s;r&&!r.node;)r=r.parent;let f=r.node;if(r&&f.isAtom&&Be.isSelectable(f)&&r.parent&&!(f.isInline&&Z8(t.focusNode,t.focusOffset,r.dom))){let p=r.posBefore;u=new Be(s==p?l:o.resolve(p))}}else{if(t instanceof n.dom.ownerDocument.defaultView.Selection&&t.rangeCount>1){let f=s,p=s;for(let h=0;h<t.rangeCount;h++){let m=t.getRangeAt(h);f=Math.min(f,n.docView.posFromDOM(m.startContainer,m.startOffset,1)),p=Math.max(p,n.docView.posFromDOM(m.endContainer,m.endOffset,-1))}if(f<0)return null;[a,s]=p==n.state.selection.anchor?[p,f]:[f,p],l=o.resolve(s)}else a=n.docView.posFromDOM(t.anchorNode,t.anchorOffset,1);if(a<0)return null}let d=o.resolve(a);if(!u){let f=e=="pointer"||n.state.selection.head<l.pos&&!i?1:-1;u=UM(n,d,l,f)}return u}function jM(n){return n.editable?n.hasFocus():iq(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function Qg(n,e=!1){let t=n.state.selection;if(rq(n,t),!!jM(n)){if(!e&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&nr){let o=n.domSelectionRange(),r=n.domObserver.currentSelection;if(o.anchorNode&&r.anchorNode&&IM(o.anchorNode,o.anchorOffset,r.anchorNode,r.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)oq(n);else{let{anchor:o,head:r}=t,i,s;Pk&&!(t instanceof Le)&&(t.$from.parent.inlineContent||(i=Vk(n,t.from)),!t.empty&&!t.$from.parent.inlineContent&&(s=Vk(n,t.to))),n.docView.setSelection(o,r,n,e),Pk&&(i&&zk(i),s&&zk(s)),t.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&nq(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}const Pk=_i||nr&&FM<63;function Vk(n,e){let{node:t,offset:o}=n.docView.domFromPos(e,0),r=o<t.childNodes.length?t.childNodes[o]:null,i=o?t.childNodes[o-1]:null;if(_i&&r&&r.contentEditable=="false")return ip(r);if((!r||r.contentEditable=="false")&&(!i||i.contentEditable=="false")){if(r)return ip(r);if(i)return ip(i)}}function ip(n){return n.contentEditable="true",_i&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function zk(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function nq(n){let e=n.dom.ownerDocument;e.removeEventListener("selectionchange",n.input.hideSelectionGuard);let t=n.domSelectionRange(),o=t.anchorNode,r=t.anchorOffset;e.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(t.anchorNode!=o||t.anchorOffset!=r)&&(e.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!jM(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function oq(n){let e=n.domSelection();if(!e)return;let t=n.cursorWrapper.dom,o=t.nodeName=="IMG";o?e.collapse(t.parentNode,Ri(t)+1):e.collapse(t,0),!o&&!n.state.selection.visible&&Sa&&zM<=11&&(t.disabled=!0,t.disabled=!1)}function rq(n,e){if(e instanceof Be){let t=n.docView.descAt(e.from);t!=n.lastSelectedViewDesc&&(Fk(n),t&&t.selectNode(),n.lastSelectedViewDesc=t)}else Fk(n)}function Fk(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function UM(n,e,t,o){return n.someProp("createSelectionBetween",r=>r(n,e,t))||Le.between(e,t,o)}function iq(n){let e=n.domSelectionRange();if(!e.anchorNode)return!1;try{return n.dom.contains(e.anchorNode.nodeType==3?e.anchorNode.parentNode:e.anchorNode)&&(n.editable||n.dom.contains(e.focusNode.nodeType==3?e.focusNode.parentNode:e.focusNode))}catch{return!1}}function Ih(n,e){let{$anchor:t,$head:o}=n.selection,r=e>0?t.max(o):t.min(o),i=r.parent.inlineContent?r.depth?n.doc.resolve(e>0?r.after():r.before()):null:r;return i&&De.findFrom(i,e)}function mr(n,e){return n.dispatch(n.state.tr.setSelection(e).scrollIntoView()),!0}function Hk(n,e,t){let o=n.state.selection;if(o instanceof Le)if(t.indexOf("s")>-1){let{$head:r}=o,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!i||i.isText||!i.isLeaf)return!1;let s=n.state.doc.resolve(r.pos+i.nodeSize*(e<0?-1:1));return mr(n,new Le(o.$anchor,s))}else if(o.empty){if(n.endOfTextblock(e>0?"forward":"backward")){let r=Ih(n.state,e);return r&&r instanceof Be?mr(n,r):!1}else if(!($n&&t.indexOf("m")>-1)){let r=o.$head,i=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter,s;if(!i||i.isText)return!1;let l=e<0?r.pos-i.nodeSize:r.pos;return i.isAtom||(s=n.docView.descAt(l))&&!s.contentDOM?Be.isSelectable(i)?mr(n,new Be(e<0?n.state.doc.resolve(r.pos-i.nodeSize):r)):Yg?mr(n,new Le(n.state.doc.resolve(e<0?l:l+i.nodeSize))):!1:!1}}else return!1;else{if(o instanceof Be&&o.node.isInline)return mr(n,new Le(e>0?o.$to:o.$from));{let r=Ih(n.state,e);return r?mr(n,r):!1}}}function Ju(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Ml(n,e){let t=n.pmViewDesc;return t&&t.size==0&&(e<0||n.nextSibling||n.nodeName!="BR")}function Hi(n,e){return e<0?sq(n):lq(n)}function sq(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r,i,s=!1;for(Gd&&t.nodeType==1&&o<Ju(t)&&Ml(t.childNodes[o],-1)&&(s=!0);;)if(o>0){if(t.nodeType!=1)break;{let l=t.childNodes[o-1];if(Ml(l,-1))r=t,i=--o;else if(l.nodeType==3)t=l,o=t.nodeValue.length;else break}}else{if(WM(t))break;{let l=t.previousSibling;for(;l&&Ml(l,-1);)r=t.parentNode,i=Ri(l),l=l.previousSibling;if(l)t=l,o=Ju(t);else{if(t=t.parentNode,t==n.dom)break;o=0}}}s?Lh(n,t,o):r&&Lh(n,r,i)}function lq(n){let e=n.domSelectionRange(),t=e.focusNode,o=e.focusOffset;if(!t)return;let r=Ju(t),i,s;for(;;)if(o<r){if(t.nodeType!=1)break;let l=t.childNodes[o];if(Ml(l,1))i=t,s=++o;else break}else{if(WM(t))break;{let l=t.nextSibling;for(;l&&Ml(l,1);)i=l.parentNode,s=Ri(l)+1,l=l.nextSibling;if(l)t=l,o=0,r=Ju(t);else{if(t=t.parentNode,t==n.dom)break;o=r=0}}}i&&Lh(n,i,s)}function WM(n){let e=n.pmViewDesc;return e&&e.node&&e.node.isBlock}function aq(n,e){for(;n&&e==n.childNodes.length&&!Gg(n);)e=Ri(n)+1,n=n.parentNode;for(;n&&e<n.childNodes.length;){let t=n.childNodes[e];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=0}}function cq(n,e){for(;n&&!e&&!Gg(n);)e=Ri(n),n=n.parentNode;for(;n&&e;){let t=n.childNodes[e-1];if(t.nodeType==3)return t;if(t.nodeType==1&&t.contentEditable=="false")break;n=t,e=n.childNodes.length}}function Lh(n,e,t){if(e.nodeType!=3){let i,s;(s=aq(e,t))?(e=s,t=0):(i=cq(e,t))&&(e=i,t=i.nodeValue.length)}let o=n.domSelection();if(!o)return;if(LM(o)){let i=document.createRange();i.setEnd(e,t),i.setStart(e,t),o.removeAllRanges(),o.addRange(i)}else o.extend&&o.extend(e,t);n.domObserver.setCurSelection();let{state:r}=n;setTimeout(()=>{n.state==r&&Qg(n)},50)}function jk(n,e){let t=n.state.doc.resolve(e);if(!(nr||HM)&&t.parent.inlineContent){let o=n.coordsAtPos(e);if(e>t.start()){let r=n.coordsAtPos(e-1),i=(r.top+r.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(r.left-o.left)>1)return r.left<o.left?"ltr":"rtl"}if(e<t.end()){let r=n.coordsAtPos(e+1),i=(r.top+r.bottom)/2;if(i>o.top&&i<o.bottom&&Math.abs(r.left-o.left)>1)return r.left>o.left?"ltr":"rtl"}}return getComputedStyle(n.dom).direction=="rtl"?"rtl":"ltr"}function Uk(n,e,t){let o=n.state.selection;if(o instanceof Le&&!o.empty||t.indexOf("s")>-1||$n&&t.indexOf("m")>-1)return!1;let{$from:r,$to:i}=o;if(!r.parent.inlineContent||n.endOfTextblock(e<0?"up":"down")){let s=Ih(n.state,e);if(s&&s instanceof Be)return mr(n,s)}if(!r.parent.inlineContent){let s=e<0?r:i,l=o instanceof wo?De.near(s,e):De.findFrom(s,e);return l?mr(n,l):!1}return!1}function Wk(n,e){if(!(n.state.selection instanceof Le))return!0;let{$head:t,$anchor:o,empty:r}=n.state.selection;if(!t.sameParent(o))return!0;if(!r)return!1;if(n.endOfTextblock(e>0?"forward":"backward"))return!0;let i=!t.textOffset&&(e<0?t.nodeBefore:t.nodeAfter);if(i&&!i.isText){let s=n.state.tr;return e<0?s.delete(t.pos-i.nodeSize,t.pos):s.delete(t.pos,t.pos+i.nodeSize),n.dispatch(s),!0}return!1}function qk(n,e,t){n.domObserver.stop(),e.contentEditable=t,n.domObserver.start()}function uq(n){if(!_i||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(e&&e.nodeType==1&&t==0&&e.firstChild&&e.firstChild.contentEditable=="false"){let o=e.firstChild;qk(n,o,"true"),setTimeout(()=>qk(n,o,"false"),20)}return!1}function dq(n){let e="";return n.ctrlKey&&(e+="c"),n.metaKey&&(e+="m"),n.altKey&&(e+="a"),n.shiftKey&&(e+="s"),e}function fq(n,e){let t=e.keyCode,o=dq(e);if(t==8||$n&&t==72&&o=="c")return Wk(n,-1)||Hi(n,-1);if(t==46&&!e.shiftKey||$n&&t==68&&o=="c")return Wk(n,1)||Hi(n,1);if(t==13||t==27)return!0;if(t==37||$n&&t==66&&o=="c"){let r=t==37?jk(n,n.state.selection.from)=="ltr"?-1:1:-1;return Hk(n,r,o)||Hi(n,r)}else if(t==39||$n&&t==70&&o=="c"){let r=t==39?jk(n,n.state.selection.from)=="ltr"?1:-1:1;return Hk(n,r,o)||Hi(n,r)}else{if(t==38||$n&&t==80&&o=="c")return Uk(n,-1,o)||Hi(n,-1);if(t==40||$n&&t==78&&o=="c")return uq(n)||Uk(n,1,o)||Hi(n,1);if(o==($n?"m":"c")&&(t==66||t==73||t==89||t==90))return!0}return!1}function qM(n,e){n.someProp("transformCopied",h=>{e=h(e,n)});let t=[],{content:o,openStart:r,openEnd:i}=e;for(;r>1&&i>1&&o.childCount==1&&o.firstChild.childCount==1;){r--,i--;let h=o.firstChild;t.push(h.type.name,h.attrs!=h.type.defaultAttrs?h.attrs:null),o=h.content}let s=n.someProp("clipboardSerializer")||Kd.fromSchema(n.state.schema),l=QM(),a=l.createElement("div");a.appendChild(s.serializeFragment(o,{document:l}));let u=a.firstChild,d,f=0;for(;u&&u.nodeType==1&&(d=YM[u.nodeName.toLowerCase()]);){for(let h=d.length-1;h>=0;h--){let m=l.createElement(d[h]);for(;a.firstChild;)m.appendChild(a.firstChild);a.appendChild(m),f++}u=a.firstChild}u&&u.nodeType==1&&u.setAttribute("data-pm-slice",`${r} ${i}${f?` -${f}`:""} ${JSON.stringify(t)}`);let p=n.someProp("clipboardTextSerializer",h=>h(e,n))||e.content.textBetween(0,e.content.size,`
|
|
297
|
+
|
|
298
|
+
`);return{dom:a,text:p,slice:e}}function KM(n,e,t,o,r){let i=r.parent.type.spec.code,s,l;if(!t&&!e)return null;let a=!!e&&(o||i||!t);if(a){if(n.someProp("transformPastedText",p=>{e=p(e,i||o,n)}),i)return l=new Z(G.from(n.state.schema.text(e.replace(/\r\n?/g,`
|
|
299
|
+
`))),0,0),n.someProp("transformPasted",p=>{l=p(l,n,!0)}),l;let f=n.someProp("clipboardTextParser",p=>p(e,r,o,n));if(f)l=f;else{let p=r.marks(),{schema:h}=n.state,m=Kd.fromSchema(h);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach(g=>{let y=s.appendChild(document.createElement("p"));g&&y.appendChild(m.serializeNode(h.text(g,p)))})}}else n.someProp("transformPastedHTML",f=>{t=f(t,n)}),s=gq(t),Yg&&yq(s);let u=s&&s.querySelector("[data-pm-slice]"),d=u&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(u.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let f=+d[3];f>0;f--){let p=s.firstChild;for(;p&&p.nodeType!=1;)p=p.nextSibling;if(!p)break;s=p}if(l||(l=(n.someProp("clipboardParser")||n.someProp("domParser")||Wu.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(a||d),context:r,ruleFromNode(f){return f.nodeName=="BR"&&!f.nextSibling&&f.parentNode&&!pq.test(f.parentNode.nodeName)?{ignore:!0}:null}})),d)l=bq(Kk(l,+d[1],+d[2]),d[4]);else if(l=Z.maxOpen(hq(l.content,r),!0),l.openStart||l.openEnd){let f=0,p=0;for(let h=l.content.firstChild;f<l.openStart&&!h.type.spec.isolating;f++,h=h.firstChild);for(let h=l.content.lastChild;p<l.openEnd&&!h.type.spec.isolating;p++,h=h.lastChild);l=Kk(l,f,p)}return n.someProp("transformPasted",f=>{l=f(l,n,a)}),l}const pq=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function hq(n,e){if(n.childCount<2)return n;for(let t=e.depth;t>=0;t--){let o=e.node(t).contentMatchAt(e.index(t)),r,i=[];if(n.forEach(s=>{if(!i)return;let l=o.findWrapping(s.type),a;if(!l)return i=null;if(a=i.length&&r.length&&GM(l,r,s,i[i.length-1],0))i[i.length-1]=a;else{i.length&&(i[i.length-1]=XM(i[i.length-1],r.length));let u=JM(s,l);i.push(u),o=o.matchType(u.type),r=l}}),i)return G.from(i)}return n}function JM(n,e,t=0){for(let o=e.length-1;o>=t;o--)n=e[o].create(null,G.from(n));return n}function GM(n,e,t,o,r){if(r<n.length&&r<e.length&&n[r]==e[r]){let i=GM(n,e,t,o.lastChild,r+1);if(i)return o.copy(o.content.replaceChild(o.childCount-1,i));if(o.contentMatchAt(o.childCount).matchType(r==n.length-1?t.type:n[r+1]))return o.copy(o.content.append(G.from(JM(t,n,r+1))))}}function XM(n,e){if(e==0)return n;let t=n.content.replaceChild(n.childCount-1,XM(n.lastChild,e-1)),o=n.contentMatchAt(n.childCount).fillBefore(G.empty,!0);return n.copy(t.append(o))}function Ph(n,e,t,o,r,i){let s=e<0?n.firstChild:n.lastChild,l=s.content;return n.childCount>1&&(i=0),r<o-1&&(l=Ph(l,e,t,o,r+1,i)),r>=t&&(l=e<0?s.contentMatchAt(0).fillBefore(l,i<=r).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(G.empty,!0))),n.replaceChild(e<0?0:n.childCount-1,s.copy(l))}function Kk(n,e,t){return e<n.openStart&&(n=new Z(Ph(n.content,-1,e,n.openStart,0,n.openEnd),e,n.openEnd)),t<n.openEnd&&(n=new Z(Ph(n.content,1,t,n.openEnd,0,0),n.openStart,t)),n}const YM={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let Jk=null;function QM(){return Jk||(Jk=document.implementation.createHTMLDocument("title"))}let sp=null;function mq(n){let e=window.trustedTypes;return e?(sp||(sp=e.defaultPolicy||e.createPolicy("ProseMirrorClipboard",{createHTML:t=>t})),sp.createHTML(n)):n}function gq(n){let e=/^(\s*<meta [^>]*>)*/.exec(n);e&&(n=n.slice(e[0].length));let t=QM().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(n),r;if((r=o&&YM[o[1].toLowerCase()])&&(n=r.map(i=>"<"+i+">").join("")+n+r.map(i=>"</"+i+">").reverse().join("")),t.innerHTML=mq(n),r)for(let i=0;i<r.length;i++)t=t.querySelector(r[i])||t;return t}function yq(n){let e=n.querySelectorAll(nr?"span:not([class]):not([style])":"span.Apple-converted-space");for(let t=0;t<e.length;t++){let o=e[t];o.childNodes.length==1&&o.textContent==" "&&o.parentNode&&o.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),o)}}function bq(n,e){if(!n.size)return n;let t=n.content.firstChild.type.schema,o;try{o=JSON.parse(e)}catch{return n}let{content:r,openStart:i,openEnd:s}=n;for(let l=o.length-2;l>=0;l-=2){let a=t.nodes[o[l]];if(!a||a.hasRequiredAttrs())break;r=G.from(a.create(o[l+1],r)),i++,s++}return new Z(r,i,s)}const oo={},En={};function Er(n,e){n.input.lastSelectionOrigin=e,n.input.lastSelectionTime=Date.now()}En.keydown=(n,e)=>{let t=e;if(n.input.shiftKey=t.keyCode==16||t.shiftKey,!eT(n,t)&&(n.input.lastKeyCode=t.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Ea&&nr&&t.keyCode==13)))if(t.keyCode!=229&&n.domObserver.forceFlush(),Xg&&t.keyCode==13&&!t.ctrlKey&&!t.altKey&&!t.metaKey){let o=Date.now();n.input.lastIOSEnter=o,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==o&&(n.someProp("handleKeyDown",r=>r(n,PM(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",o=>o(n,t))||fq(n,t)?t.preventDefault():Er(n,"key")};En.keyup=(n,e)=>{e.keyCode==16&&(n.input.shiftKey=!1)};En.keypress=(n,e)=>{let t=e;if(eT(n,t)||!t.charCode||t.ctrlKey&&!t.altKey||$n&&t.metaKey)return;if(n.someProp("handleKeyPress",r=>r(n,t))){t.preventDefault();return}let o=n.state.selection;if(!(o instanceof Le)||!o.$from.sameParent(o.$to)){let r=String.fromCharCode(t.charCode),i=()=>n.state.tr.insertText(r).scrollIntoView();!/[\r\n]/.test(r)&&!n.someProp("handleTextInput",s=>s(n,o.$from.pos,o.$to.pos,r,i))&&n.dispatch(i()),t.preventDefault()}};function Xd(n){return{left:n.clientX,top:n.clientY}}function vq(n,e){let t=e.x-n.clientX,o=e.y-n.clientY;return t*t+o*o<100}function Zg(n,e,t,o,r){if(o==-1)return!1;let i=n.state.doc.resolve(o);for(let s=i.depth+1;s>0;s--)if(n.someProp(e,l=>s>i.depth?l(n,t,i.nodeAfter,i.before(s),r,!0):l(n,t,i.node(s),i.before(s),r,!1)))return!0;return!1}function cs(n,e,t){if(n.focused||n.focus(),n.state.selection.eq(e))return;let o=n.state.tr.setSelection(e);o.setMeta("pointer",!0),n.dispatch(o)}function kq(n,e){if(e==-1)return!1;let t=n.state.doc.resolve(e),o=t.nodeAfter;return o&&o.isAtom&&Be.isSelectable(o)?(cs(n,new Be(t)),!0):!1}function wq(n,e){if(e==-1)return!1;let t=n.state.selection,o,r;t instanceof Be&&(o=t.node);let i=n.state.doc.resolve(e);for(let s=i.depth+1;s>0;s--){let l=s>i.depth?i.nodeAfter:i.node(s);if(Be.isSelectable(l)){o&&t.$from.depth>0&&s>=t.$from.depth&&i.before(t.$from.depth+1)==t.$from.pos?r=i.before(t.$from.depth):r=i.before(s);break}}return r!=null?(cs(n,Be.create(n.state.doc,r)),!0):!1}function xq(n,e,t,o,r){return Zg(n,"handleClickOn",e,t,o)||n.someProp("handleClick",i=>i(n,e,o))||(r?wq(n,t):kq(n,t))}function Cq(n,e,t,o){return Zg(n,"handleDoubleClickOn",e,t,o)||n.someProp("handleDoubleClick",r=>r(n,e,o))}function Sq(n,e,t,o){return Zg(n,"handleTripleClickOn",e,t,o)||n.someProp("handleTripleClick",r=>r(n,e,o))||Eq(n,t,o)}function Eq(n,e,t){if(t.button!=0)return!1;let o=n.state.doc;if(e==-1)return o.inlineContent?(cs(n,Le.create(o,0,o.content.size)),!0):!1;let r=o.resolve(e);for(let i=r.depth+1;i>0;i--){let s=i>r.depth?r.nodeAfter:r.node(i),l=r.before(i);if(s.inlineContent)cs(n,Le.create(o,l+1,l+1+s.content.size));else if(Be.isSelectable(s))cs(n,Be.create(o,l));else continue;return!0}}function ey(n){return Gu(n)}const ZM=$n?"metaKey":"ctrlKey";oo.mousedown=(n,e)=>{let t=e;n.input.shiftKey=t.shiftKey;let o=ey(n),r=Date.now(),i="singleClick";r-n.input.lastClick.time<500&&vq(t,n.input.lastClick)&&!t[ZM]&&n.input.lastClick.button==t.button&&(n.input.lastClick.type=="singleClick"?i="doubleClick":n.input.lastClick.type=="doubleClick"&&(i="tripleClick")),n.input.lastClick={time:r,x:t.clientX,y:t.clientY,type:i,button:t.button};let s=n.posAtCoords(Xd(t));s&&(i=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new Mq(n,s,t,!!o)):(i=="doubleClick"?Cq:Sq)(n,s.pos,s.inside,t)?t.preventDefault():Er(n,"pointer"))};class Mq{constructor(e,t,o,r){this.view=e,this.pos=t,this.event=o,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!o[ZM],this.allowDefault=o.shiftKey;let i,s;if(t.inside>-1)i=e.state.doc.nodeAt(t.inside),s=t.inside;else{let d=e.state.doc.resolve(t.pos);i=d.parent,s=d.depth?d.before():0}const l=r?null:o.target,a=l?e.docView.nearestDesc(l,!0):null;this.target=a&&a.nodeDOM.nodeType==1?a.nodeDOM:null;let{selection:u}=e.state;(o.button==0&&i.type.spec.draggable&&i.type.spec.selectable!==!1||u instanceof Be&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&Gd&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),Er(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>Qg(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Xd(e))),this.updateAllowDefault(e),this.allowDefault||!t?Er(this.view,"pointer"):xq(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():e.button==0&&(this.flushed||_i&&this.mightDrag&&!this.mightDrag.node.isAtom||nr&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(cs(this.view,De.near(this.view.state.doc.resolve(t.pos))),e.preventDefault()):Er(this.view,"pointer")}move(e){this.updateAllowDefault(e),Er(this.view,"pointer"),e.buttons==0&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}oo.touchstart=n=>{n.input.lastTouch=Date.now(),ey(n),Er(n,"pointer")};oo.touchmove=n=>{n.input.lastTouch=Date.now(),Er(n,"pointer")};oo.contextmenu=n=>ey(n);function eT(n,e){return n.composing?!0:_i&&Math.abs(e.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}const Tq=Ea?5e3:-1;En.compositionstart=En.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:e}=n,t=e.selection.$to;if(e.selection instanceof Le&&(e.storedMarks||!t.textOffset&&t.parentOffset&&t.nodeBefore.marks.some(o=>o.type.spec.inclusive===!1)||nr&&HM&&Nq(n)))n.markCursor=n.state.storedMarks||t.marks(),Gu(n,!0),n.markCursor=null;else if(Gu(n,!e.selection.empty),Gd&&e.selection.empty&&t.parentOffset&&!t.textOffset&&t.nodeBefore.marks.length){let o=n.domSelectionRange();for(let r=o.focusNode,i=o.focusOffset;r&&r.nodeType==1&&i!=0;){let s=i<0?r.lastChild:r.childNodes[i-1];if(!s)break;if(s.nodeType==3){let l=n.domSelection();l&&l.collapse(s,s.nodeValue.length);break}else r=s,i=-1}}n.input.composing=!0}tT(n,Tq)};function Nq(n){let{focusNode:e,focusOffset:t}=n.domSelectionRange();if(!e||e.nodeType!=1||t>=e.childNodes.length)return!1;let o=e.childNodes[t];return o.nodeType==1&&o.contentEditable=="false"}En.compositionend=(n,e)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=e.timeStamp,n.input.compositionPendingChanges=n.domObserver.pendingRecords().length?n.input.compositionID:0,n.input.compositionNode=null,n.input.badSafariComposition?n.domObserver.forceFlush():n.input.compositionPendingChanges&&Promise.resolve().then(()=>n.domObserver.flush()),n.input.compositionID++,tT(n,20))};function tT(n,e){clearTimeout(n.input.composingTimeout),e>-1&&(n.input.composingTimeout=setTimeout(()=>Gu(n),e))}function Aq(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Oq());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Oq(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Gu(n,e=!1){if(!(Ea&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Aq(n),e||n.docView&&n.docView.dirty){let t=tq(n),o=n.state.selection;return t&&!t.eq(o)?n.dispatch(n.state.tr.setSelection(t)):(n.markCursor||e)&&!o.$from.node(o.$from.sharedDepth(o.to)).inlineContent?n.dispatch(n.state.tr.deleteSelection()):n.updateState(n.state),!0}return!1}}function $q(n,e){if(!n.dom.parentNode)return;let t=n.dom.parentNode.appendChild(document.createElement("div"));t.appendChild(e),t.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),r=document.createRange();r.selectNodeContents(e),n.dom.blur(),o.removeAllRanges(),o.addRange(r),setTimeout(()=>{t.parentNode&&t.parentNode.removeChild(t),n.focus()},50)}const aa=Sa&&zM<15||Xg&&eq<604;oo.copy=En.cut=(n,e)=>{let t=e,o=n.state.selection,r=t.type=="cut";if(o.empty)return;let i=aa?null:t.clipboardData,s=o.content(),{dom:l,text:a}=qM(n,s);i?(t.preventDefault(),i.clearData(),i.setData("text/html",l.innerHTML),i.setData("text/plain",a)):$q(n,l),r&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function Bq(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function Rq(n,e){if(!n.dom.parentNode)return;let t=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,o=n.dom.parentNode.appendChild(document.createElement(t?"textarea":"div"));t||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let r=n.input.shiftKey&&n.input.lastKeyCode!=45;setTimeout(()=>{n.focus(),o.parentNode&&o.parentNode.removeChild(o),t?Vh(n,o.value,null,r,e):Vh(n,o.textContent,o.innerHTML,r,e)},50)}function Vh(n,e,t,o,r){let i=KM(n,e,t,o,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,i||Z.empty)))return!0;if(!i)return!1;let s=Bq(i),l=s?n.state.tr.replaceSelectionWith(s,o):n.state.tr.replaceSelection(i);return n.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function nT(n){let e=n.getData("text/plain")||n.getData("Text");if(e)return e;let t=n.getData("text/uri-list");return t?t.replace(/\r?\n/g," "):""}En.paste=(n,e)=>{let t=e;if(n.composing&&!Ea)return;let o=aa?null:t.clipboardData,r=n.input.shiftKey&&n.input.lastKeyCode!=45;o&&Vh(n,nT(o),o.getData("text/html"),r,t)?t.preventDefault():Rq(n,t)};class _q{constructor(e,t,o){this.slice=e,this.move=t,this.node=o}}const Dq=$n?"altKey":"ctrlKey";function oT(n,e){return n.someProp("dragCopies",o=>!o(e))??!e[Dq]}oo.dragstart=(n,e)=>{let t=e,o=n.input.mouseDown;if(o&&o.done(),!t.dataTransfer)return;let r=n.state.selection,i=r.empty?null:n.posAtCoords(Xd(t)),s;if(!(i&&i.pos>=r.from&&i.pos<=(r instanceof Be?r.to-1:r.to))){if(o&&o.mightDrag)s=Be.create(n.state.doc,o.mightDrag.pos);else if(t.target&&t.target.nodeType==1){let f=n.docView.nearestDesc(t.target,!0);f&&f.node.type.spec.draggable&&f!=n.docView&&(s=Be.create(n.state.doc,f.posBefore))}}let l=(s||n.state.selection).content(),{dom:a,text:u,slice:d}=qM(n,l);(!t.dataTransfer.files.length||!nr||FM>120)&&t.dataTransfer.clearData(),t.dataTransfer.setData(aa?"Text":"text/html",a.innerHTML),t.dataTransfer.effectAllowed="copyMove",aa||t.dataTransfer.setData("text/plain",u),n.dragging=new _q(d,oT(n,t),s)};oo.dragend=n=>{let e=n.dragging;window.setTimeout(()=>{n.dragging==e&&(n.dragging=null)},50)};En.dragover=En.dragenter=(n,e)=>e.preventDefault();En.drop=(n,e)=>{try{Iq(n,e,n.dragging)}finally{n.dragging=null}};function Iq(n,e,t){if(!e.dataTransfer)return;let o=n.posAtCoords(Xd(e));if(!o)return;let r=n.state.doc.resolve(o.pos),i=t&&t.slice;i?n.someProp("transformPasted",h=>{i=h(i,n,!1)}):i=KM(n,nT(e.dataTransfer),aa?null:e.dataTransfer.getData("text/html"),!1,r);let s=!!(t&&oT(n,e));if(n.someProp("handleDrop",h=>h(n,e,i||Z.empty,s))){e.preventDefault();return}if(!i)return;e.preventDefault();let l=i?H8(n.state.doc,r.pos,i):r.pos;l==null&&(l=r.pos);let a=n.state.tr;if(s){let{node:h}=t;h?h.replace(a):a.deleteSelection()}let u=a.mapping.map(l),d=i.openStart==0&&i.openEnd==0&&i.content.childCount==1,f=a.doc;if(d?a.replaceRangeWith(u,u,i.content.firstChild):a.replaceRange(u,u,i),a.doc.eq(f))return;let p=a.doc.resolve(u);if(d&&Be.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))a.setSelection(new Be(p));else{let h=a.mapping.map(l);a.mapping.maps[a.mapping.maps.length-1].forEach((m,g,y,b)=>h=b),a.setSelection(UM(n,p,a.doc.resolve(h)))}n.focus(),n.dispatch(a.setMeta("uiEvent","drop"))}oo.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&Qg(n)},20))};oo.blur=(n,e)=>{let t=e;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),t.relatedTarget&&n.dom.contains(t.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};oo.beforeinput=(n,e)=>{if(nr&&Ea&&e.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:t}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=t||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",r=>r(n,PM(8,"Backspace")))))return;let{$cursor:o}=n.state.selection;o&&o.pos>0&&n.dispatch(n.state.tr.delete(o.pos-1,o.pos).scrollIntoView())},50)}};for(let n in En)oo[n]=En[n];function ca(n,e){if(n==e)return!0;for(let t in n)if(n[t]!==e[t])return!1;for(let t in e)if(!(t in n))return!1;return!0}class Xu{constructor(e,t){this.toDOM=e,this.spec=t||fi,this.side=this.spec.side||0}map(e,t,o,r){let{pos:i,deleted:s}=e.mapResult(t.from+r,this.side<0?-1:1);return s?null:new Rn(i-o,i-o,this)}valid(){return!0}eq(e){return this==e||e instanceof Xu&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&ca(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class $r{constructor(e,t){this.attrs=e,this.spec=t||fi}map(e,t,o,r){let i=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-o,s=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-o;return i>=s?null:new Rn(i,s,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof $r&&ca(this.attrs,e.attrs)&&ca(this.spec,e.spec)}static is(e){return e.type instanceof $r}destroy(){}}class ty{constructor(e,t){this.attrs=e,this.spec=t||fi}map(e,t,o,r){let i=e.mapResult(t.from+r,1);if(i.deleted)return null;let s=e.mapResult(t.to+r,-1);return s.deleted||s.pos<=i.pos?null:new Rn(i.pos-o,s.pos-o,this)}valid(e,t){let{index:o,offset:r}=e.content.findIndex(t.from),i;return r==t.from&&!(i=e.child(o)).isText&&r+i.nodeSize==t.to}eq(e){return this==e||e instanceof ty&&ca(this.attrs,e.attrs)&&ca(this.spec,e.spec)}destroy(){}}class Rn{constructor(e,t,o){this.from=e,this.to=t,this.type=o}copy(e,t){return new Rn(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,o){return this.type.map(e,this,t,o)}static widget(e,t,o){return new Rn(e,e,new Xu(t,o))}static inline(e,t,o,r){return new Rn(e,t,new $r(o,r))}static node(e,t,o,r){return new Rn(e,t,new ty(o,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof $r}get widget(){return this.type instanceof Xu}}const Qi=[],fi={};class dt{constructor(e,t){this.local=e.length?e:Qi,this.children=t.length?t:Qi}static create(e,t){return t.length?Yu(t,e,0,fi):en}find(e,t,o){let r=[];return this.findInner(e??0,t??1e9,r,0,o),r}findInner(e,t,o,r,i){for(let s=0;s<this.local.length;s++){let l=this.local[s];l.from<=t&&l.to>=e&&(!i||i(l.spec))&&o.push(l.copy(l.from+r,l.to+r))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<t&&this.children[s+1]>e){let l=this.children[s]+1;this.children[s+2].findInner(e-l,t-l,o,r+l,i)}}map(e,t,o){return this==en||e.maps.length==0?this:this.mapInner(e,t,0,0,o||fi)}mapInner(e,t,o,r,i){let s;for(let l=0;l<this.local.length;l++){let a=this.local[l].map(e,o,r);a&&a.type.valid(t,a)?(s||(s=[])).push(a):i.onRemove&&i.onRemove(this.local[l].spec)}return this.children.length?Lq(this.children,s||[],e,t,o,r,i):s?new dt(s.sort(pi),Qi):en}add(e,t){return t.length?this==en?dt.create(e,t):this.addInner(e,t,0):this}addInner(e,t,o){let r,i=0;e.forEach((l,a)=>{let u=a+o,d;if(d=iT(t,l,u)){for(r||(r=this.children.slice());i<r.length&&r[i]<a;)i+=3;r[i]==a?r[i+2]=r[i+2].addInner(l,d,u+1):r.splice(i,0,a,a+l.nodeSize,Yu(d,l,u+1,fi)),i+=3}});let s=rT(i?sT(t):t,-o);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||s.splice(l--,1);return new dt(s.length?this.local.concat(s).sort(pi):this.local,r||this.children)}remove(e){return e.length==0||this==en?this:this.removeInner(e,0)}removeInner(e,t){let o=this.children,r=this.local;for(let i=0;i<o.length;i+=3){let s,l=o[i]+t,a=o[i+1]+t;for(let d=0,f;d<e.length;d++)(f=e[d])&&f.from>l&&f.to<a&&(e[d]=null,(s||(s=[])).push(f));if(!s)continue;o==this.children&&(o=this.children.slice());let u=o[i+2].removeInner(s,l+1);u!=en?o[i+2]=u:(o.splice(i,3),i-=3)}if(r.length){for(let i=0,s;i<e.length;i++)if(s=e[i])for(let l=0;l<r.length;l++)r[l].eq(s,t)&&(r==this.local&&(r=this.local.slice()),r.splice(l--,1))}return o==this.children&&r==this.local?this:r.length||o.length?new dt(r,o):en}forChild(e,t){if(this==en)return this;if(t.isLeaf)return dt.empty;let o,r;for(let l=0;l<this.children.length;l+=3)if(this.children[l]>=e){this.children[l]==e&&(o=this.children[l+2]);break}let i=e+1,s=i+t.content.size;for(let l=0;l<this.local.length;l++){let a=this.local[l];if(a.from<s&&a.to>i&&a.type instanceof $r){let u=Math.max(i,a.from)-i,d=Math.min(s,a.to)-i;u<d&&(r||(r=[])).push(a.copy(u,d))}}if(r){let l=new dt(r.sort(pi),Qi);return o?new Gr([l,o]):l}return o||en}eq(e){if(this==e)return!0;if(!(e instanceof dt)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return ny(this.localsInner(e))}localsInner(e){if(this==en)return Qi;if(e.inlineContent||!this.local.some($r.is))return this.local;let t=[];for(let o=0;o<this.local.length;o++)this.local[o].type instanceof $r||t.push(this.local[o]);return t}forEachSet(e){e(this)}}dt.empty=new dt([],[]);dt.removeOverlap=ny;const en=dt.empty;class Gr{constructor(e){this.members=e}map(e,t){const o=this.members.map(r=>r.map(e,t,fi));return Gr.from(o)}forChild(e,t){if(t.isLeaf)return dt.empty;let o=[];for(let r=0;r<this.members.length;r++){let i=this.members[r].forChild(e,t);i!=en&&(i instanceof Gr?o=o.concat(i.members):o.push(i))}return Gr.from(o)}eq(e){if(!(e instanceof Gr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,o=!0;for(let r=0;r<this.members.length;r++){let i=this.members[r].localsInner(e);if(i.length)if(!t)t=i;else{o&&(t=t.slice(),o=!1);for(let s=0;s<i.length;s++)t.push(i[s])}}return t?ny(o?t:t.sort(pi)):Qi}static from(e){switch(e.length){case 0:return en;case 1:return e[0];default:return new Gr(e.every(t=>t instanceof dt)?e:e.reduce((t,o)=>t.concat(o instanceof dt?o:o.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function Lq(n,e,t,o,r,i,s){let l=n.slice();for(let u=0,d=i;u<t.maps.length;u++){let f=0;t.maps[u].forEach((p,h,m,g)=>{let y=g-m-(h-p);for(let b=0;b<l.length;b+=3){let v=l[b+1];if(v<0||p>v+d-f)continue;let w=l[b]+d-f;h>=w?l[b+1]=p<=w?-2:-1:p>=d&&y&&(l[b]+=y,l[b+1]+=y)}f+=y}),d=t.maps[u].map(d,-1)}let a=!1;for(let u=0;u<l.length;u+=3)if(l[u+1]<0){if(l[u+1]==-2){a=!0,l[u+1]=-1;continue}let d=t.map(n[u]+i),f=d-r;if(f<0||f>=o.content.size){a=!0;continue}let p=t.map(n[u+1]+i,-1),h=p-r,{index:m,offset:g}=o.content.findIndex(f),y=o.maybeChild(m);if(y&&g==f&&g+y.nodeSize==h){let b=l[u+2].mapInner(t,y,d+1,n[u]+i+1,s);b!=en?(l[u]=f,l[u+1]=h,l[u+2]=b):(l[u+1]=-2,a=!0)}else a=!0}if(a){let u=Pq(l,n,e,t,r,i,s),d=Yu(u,o,0,s);e=d.local;for(let f=0;f<l.length;f+=3)l[f+1]<0&&(l.splice(f,3),f-=3);for(let f=0,p=0;f<d.children.length;f+=3){let h=d.children[f];for(;p<l.length&&l[p]<h;)p+=3;l.splice(p,0,d.children[f],d.children[f+1],d.children[f+2])}}return new dt(e.sort(pi),l)}function rT(n,e){if(!e||!n.length)return n;let t=[];for(let o=0;o<n.length;o++){let r=n[o];t.push(new Rn(r.from+e,r.to+e,r.type))}return t}function Pq(n,e,t,o,r,i,s){function l(a,u){for(let d=0;d<a.local.length;d++){let f=a.local[d].map(o,r,u);f?t.push(f):s.onRemove&&s.onRemove(a.local[d].spec)}for(let d=0;d<a.children.length;d+=3)l(a.children[d+2],a.children[d]+u+1)}for(let a=0;a<n.length;a+=3)n[a+1]==-1&&l(n[a+2],e[a]+i+1);return t}function iT(n,e,t){if(e.isLeaf)return null;let o=t+e.nodeSize,r=null;for(let i=0,s;i<n.length;i++)(s=n[i])&&s.from>t&&s.to<o&&((r||(r=[])).push(s),n[i]=null);return r}function sT(n){let e=[];for(let t=0;t<n.length;t++)n[t]!=null&&e.push(n[t]);return e}function Yu(n,e,t,o){let r=[],i=!1;e.forEach((l,a)=>{let u=iT(n,l,a+t);if(u){i=!0;let d=Yu(u,l,t+a+1,o);d!=en&&r.push(a,a+l.nodeSize,d)}});let s=rT(i?sT(n):n,-t).sort(pi);for(let l=0;l<s.length;l++)s[l].type.valid(e,s[l])||(o.onRemove&&o.onRemove(s[l].spec),s.splice(l--,1));return s.length||r.length?new dt(s,r):en}function pi(n,e){return n.from-e.from||n.to-e.to}function ny(n){let e=n;for(let t=0;t<e.length-1;t++){let o=e[t];if(o.from!=o.to)for(let r=t+1;r<e.length;r++){let i=e[r];if(i.from==o.from){i.to!=o.to&&(e==n&&(e=n.slice()),e[r]=i.copy(i.from,o.to),Gk(e,r+1,i.copy(o.to,i.to)));continue}else{i.from<o.to&&(e==n&&(e=n.slice()),e[t]=o.copy(o.from,i.from),Gk(e,r,o.copy(i.from,o.to)));break}}}return e}function Gk(n,e,t){for(;e<n.length&&pi(t,n[e])>0;)e++;n.splice(e,0,t)}var Ir={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},Qu={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Vq=typeof navigator<"u"&&/Mac/.test(navigator.platform),zq=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(var Dt=0;Dt<10;Dt++)Ir[48+Dt]=Ir[96+Dt]=String(Dt);for(var Dt=1;Dt<=24;Dt++)Ir[Dt+111]="F"+Dt;for(var Dt=65;Dt<=90;Dt++)Ir[Dt]=String.fromCharCode(Dt+32),Qu[Dt]=String.fromCharCode(Dt);for(var lp in Ir)Qu.hasOwnProperty(lp)||(Qu[lp]=Ir[lp]);function Fq(n){var e=Vq&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||zq&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",t=!e&&n.key||(n.shiftKey?Qu:Ir)[n.keyCode]||n.key||"Unidentified";return t=="Esc"&&(t="Escape"),t=="Del"&&(t="Delete"),t=="Left"&&(t="ArrowLeft"),t=="Up"&&(t="ArrowUp"),t=="Right"&&(t="ArrowRight"),t=="Down"&&(t="ArrowDown"),t}const Hq=typeof navigator<"u"&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),jq=typeof navigator<"u"&&/Win/.test(navigator.platform);function Uq(n){let e=n.split(/-(?!$)/),t=e[e.length-1];t=="Space"&&(t=" ");let o,r,i,s;for(let l=0;l<e.length-1;l++){let a=e[l];if(/^(cmd|meta|m)$/i.test(a))s=!0;else if(/^a(lt)?$/i.test(a))o=!0;else if(/^(c|ctrl|control)$/i.test(a))r=!0;else if(/^s(hift)?$/i.test(a))i=!0;else if(/^mod$/i.test(a))Hq?s=!0:r=!0;else throw new Error("Unrecognized modifier name: "+a)}return o&&(t="Alt-"+t),r&&(t="Ctrl-"+t),s&&(t="Meta-"+t),i&&(t="Shift-"+t),t}function Wq(n){let e=Object.create(null);for(let t in n)e[Uq(t)]=n[t];return e}function ap(n,e,t=!0){return e.altKey&&(n="Alt-"+n),e.ctrlKey&&(n="Ctrl-"+n),e.metaKey&&(n="Meta-"+n),t&&e.shiftKey&&(n="Shift-"+n),n}function qq(n){let e=Wq(n);return function(t,o){let r=Fq(o),i,s=e[ap(r,o)];if(s&&s(t.state,t.dispatch,t))return!0;if(r.length==1&&r!=" "){if(o.shiftKey){let l=e[ap(r,o,!1)];if(l&&l(t.state,t.dispatch,t))return!0}if((o.altKey||o.metaKey||o.ctrlKey)&&!(jq&&o.ctrlKey&&o.altKey)&&(i=Ir[o.keyCode])&&i!=r){let l=e[ap(i,o)];if(l&&l(t.state,t.dispatch,t))return!0}}return!1}}let zh,Fh;if(typeof WeakMap<"u"){let n=new WeakMap;zh=e=>n.get(e),Fh=(e,t)=>(n.set(e,t),t)}else{const n=[];let e=0;zh=t=>{for(let o=0;o<n.length;o+=2)if(n[o]==t)return n[o+1]},Fh=(t,o)=>(e==10&&(e=0),n[e++]=t,n[e++]=o)}var lt=class{constructor(n,e,t,o){this.width=n,this.height=e,this.map=t,this.problems=o}findCell(n){for(let e=0;e<this.map.length;e++){const t=this.map[e];if(t!=n)continue;const o=e%this.width,r=e/this.width|0;let i=o+1,s=r+1;for(let l=1;i<this.width&&this.map[e+l]==t;l++)i++;for(let l=1;s<this.height&&this.map[e+this.width*l]==t;l++)s++;return{left:o,top:r,right:i,bottom:s}}throw new RangeError(`No cell with offset ${n} found`)}colCount(n){for(let e=0;e<this.map.length;e++)if(this.map[e]==n)return e%this.width;throw new RangeError(`No cell with offset ${n} found`)}nextCell(n,e,t){const{left:o,right:r,top:i,bottom:s}=this.findCell(n);return e=="horiz"?(t<0?o==0:r==this.width)?null:this.map[i*this.width+(t<0?o-1:r)]:(t<0?i==0:s==this.height)?null:this.map[o+this.width*(t<0?i-1:s)]}rectBetween(n,e){const{left:t,right:o,top:r,bottom:i}=this.findCell(n),{left:s,right:l,top:a,bottom:u}=this.findCell(e);return{left:Math.min(t,s),top:Math.min(r,a),right:Math.max(o,l),bottom:Math.max(i,u)}}cellsInRect(n){const e=[],t={};for(let o=n.top;o<n.bottom;o++)for(let r=n.left;r<n.right;r++){const i=o*this.width+r,s=this.map[i];t[s]||(t[s]=!0,!(r==n.left&&r&&this.map[i-1]==s||o==n.top&&o&&this.map[i-this.width]==s)&&e.push(s))}return e}positionAt(n,e,t){for(let o=0,r=0;;o++){const i=r+t.child(o).nodeSize;if(o==n){let s=e+n*this.width;const l=(n+1)*this.width;for(;s<l&&this.map[s]<r;)s++;return s==l?i-1:this.map[s]}r=i}}static get(n){return zh(n)||Fh(n,Kq(n))}};function Kq(n){if(n.type.spec.tableRole!="table")throw new RangeError("Not a table node: "+n.type.name);const e=Jq(n),t=n.childCount,o=[];let r=0,i=null;const s=[];for(let u=0,d=e*t;u<d;u++)o[u]=0;for(let u=0,d=0;u<t;u++){const f=n.child(u);d++;for(let m=0;;m++){for(;r<o.length&&o[r]!=0;)r++;if(m==f.childCount)break;const g=f.child(m),{colspan:y,rowspan:b,colwidth:v}=g.attrs;for(let w=0;w<b;w++){if(w+u>=t){(i||(i=[])).push({type:"overlong_rowspan",pos:d,n:b-w});break}const k=r+w*e;for(let x=0;x<y;x++){o[k+x]==0?o[k+x]=d:(i||(i=[])).push({type:"collision",row:u,pos:d,n:y-x});const C=v&&v[x];if(C){const S=(k+x)%e*2,M=s[S];M==null||M!=C&&s[S+1]==1?(s[S]=C,s[S+1]=1):M==C&&s[S+1]++}}}r+=y,d+=g.nodeSize}const p=(u+1)*e;let h=0;for(;r<p;)o[r++]==0&&h++;h&&(i||(i=[])).push({type:"missing",row:u,n:h}),d++}(e===0||t===0)&&(i||(i=[])).push({type:"zero_sized"});const l=new lt(e,t,o,i);let a=!1;for(let u=0;!a&&u<s.length;u+=2)s[u]!=null&&s[u+1]<t&&(a=!0);return a&&Gq(l,s,n),l}function Jq(n){let e=-1,t=!1;for(let o=0;o<n.childCount;o++){const r=n.child(o);let i=0;if(t)for(let s=0;s<o;s++){const l=n.child(s);for(let a=0;a<l.childCount;a++){const u=l.child(a);s+u.attrs.rowspan>o&&(i+=u.attrs.colspan)}}for(let s=0;s<r.childCount;s++){const l=r.child(s);i+=l.attrs.colspan,l.attrs.rowspan>1&&(t=!0)}e==-1?e=i:e!=i&&(e=Math.max(e,i))}return e}function Gq(n,e,t){n.problems||(n.problems=[]);const o={};for(let r=0;r<n.map.length;r++){const i=n.map[r];if(o[i])continue;o[i]=!0;const s=t.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let l=null;const a=s.attrs;for(let u=0;u<a.colspan;u++){const d=e[(r+u)%n.width*2];d!=null&&(!a.colwidth||a.colwidth[u]!=d)&&((l||(l=Xq(a)))[u]=d)}l&&n.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:l})}}function Xq(n){if(n.colwidth)return n.colwidth.slice();const e=[];for(let t=0;t<n.colspan;t++)e.push(0);return e}function qt(n){let e=n.cached.tableNodeTypes;if(!e){e=n.cached.tableNodeTypes={};for(const t in n.nodes){const o=n.nodes[t],r=o.spec.tableRole;r&&(e[r]=o)}}return e}const vr=new Jg("selectingCells");function Ni(n){for(let e=n.depth-1;e>0;e--)if(n.node(e).type.spec.tableRole=="row")return n.node(0).resolve(n.before(e+1));return null}function Yq(n){for(let e=n.depth;e>0;e--){const t=n.node(e).type.spec.tableRole;if(t==="cell"||t==="header_cell")return n.node(e)}return null}function ro(n){const e=n.selection.$head;for(let t=e.depth;t>0;t--)if(e.node(t).type.spec.tableRole=="row")return!0;return!1}function Yd(n){const e=n.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&e.node.type.spec.tableRole=="cell")return e.$anchor;const t=Ni(e.$head)||Qq(e.$head);if(t)return t;throw new RangeError(`No cell found around position ${e.head}`)}function Qq(n){for(let e=n.nodeAfter,t=n.pos;e;e=e.firstChild,t++){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t)}for(let e=n.nodeBefore,t=n.pos;e;e=e.lastChild,t--){const o=e.type.spec.tableRole;if(o=="cell"||o=="header_cell")return n.doc.resolve(t-e.nodeSize)}}function Hh(n){return n.parent.type.spec.tableRole=="row"&&!!n.nodeAfter}function Zq(n){return n.node(0).resolve(n.pos+n.nodeAfter.nodeSize)}function oy(n,e){return n.depth==e.depth&&n.pos>=e.start(-1)&&n.pos<=e.end(-1)}function lT(n,e,t){const o=n.node(-1),r=lt.get(o),i=n.start(-1),s=r.nextCell(n.pos-i,e,t);return s==null?null:n.node(0).resolve(i+s)}function Ai(n,e,t=1){const o={...n,colspan:n.colspan-t};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,t),o.colwidth.some(r=>r>0)||(o.colwidth=null)),o}function aT(n,e,t=1){const o={...n,colspan:n.colspan+t};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let r=0;r<t;r++)o.colwidth.splice(e,0,0)}return o}function e6(n,e,t){const o=qt(e.type.schema).header_cell;for(let r=0;r<n.height;r++)if(e.nodeAt(n.map[t+r*n.width]).type!=o)return!1;return!0}var Xe=class Ho extends De{constructor(e,t=e){const o=e.node(-1),r=lt.get(o),i=e.start(-1),s=r.rectBetween(e.pos-i,t.pos-i),l=e.node(0),a=r.cellsInRect(s).filter(d=>d!=t.pos-i);a.unshift(t.pos-i);const u=a.map(d=>{const f=o.nodeAt(d);if(!f)throw new RangeError(`No cell with offset ${d} found`);const p=i+d+1;return new BM(l.resolve(p),l.resolve(p+f.content.size))});super(u[0].$from,u[0].$to,u),this.$anchorCell=e,this.$headCell=t}map(e,t){const o=e.resolve(t.map(this.$anchorCell.pos)),r=e.resolve(t.map(this.$headCell.pos));if(Hh(o)&&Hh(r)&&oy(o,r)){const i=this.$anchorCell.node(-1)!=o.node(-1);return i&&this.isRowSelection()?Ho.rowSelection(o,r):i&&this.isColSelection()?Ho.colSelection(o,r):new Ho(o,r)}return Le.between(o,r)}content(){const e=this.$anchorCell.node(-1),t=lt.get(e),o=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-o,this.$headCell.pos-o),i={},s=[];for(let a=r.top;a<r.bottom;a++){const u=[];for(let d=a*t.width+r.left,f=r.left;f<r.right;f++,d++){const p=t.map[d];if(i[p])continue;i[p]=!0;const h=t.findCell(p);let m=e.nodeAt(p);if(!m)throw new RangeError(`No cell with offset ${p} found`);const g=r.left-h.left,y=h.right-r.right;if(g>0||y>0){let b=m.attrs;if(g>0&&(b=Ai(b,0,g)),y>0&&(b=Ai(b,b.colspan-y,y)),h.left<r.left){if(m=m.type.createAndFill(b),!m)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(b)}`)}else m=m.type.create(b,m.content)}if(h.top<r.top||h.bottom>r.bottom){const b={...m.attrs,rowspan:Math.min(h.bottom,r.bottom)-Math.max(h.top,r.top)};h.top<r.top?m=m.type.createAndFill(b):m=m.type.create(b,m.content)}u.push(m)}s.push(e.child(a).copy(G.from(u)))}const l=this.isColSelection()&&this.isRowSelection()?e:s;return new Z(G.from(l),1,1)}replace(e,t=Z.empty){const o=e.steps.length,r=this.ranges;for(let s=0;s<r.length;s++){const{$from:l,$to:a}=r[s],u=e.mapping.slice(o);e.replace(u.map(l.pos),u.map(a.pos),s?Z.empty:t)}const i=De.findFrom(e.doc.resolve(e.mapping.slice(o).map(this.to)),-1);i&&e.setSelection(i)}replaceWith(e,t){this.replace(e,new Z(G.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),o=lt.get(t),r=this.$anchorCell.start(-1),i=o.cellsInRect(o.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let s=0;s<i.length;s++)e(t.nodeAt(i[s]),r+i[s])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const o=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(o,r)==this.$headCell.node(-1).childCount}static colSelection(e,t=e){const o=e.node(-1),r=lt.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(t.pos-i),a=e.node(0);return s.top<=l.top?(s.top>0&&(e=a.resolve(i+r.map[s.left])),l.bottom<r.height&&(t=a.resolve(i+r.map[r.width*(r.height-1)+l.right-1]))):(l.top>0&&(t=a.resolve(i+r.map[l.left])),s.bottom<r.height&&(e=a.resolve(i+r.map[r.width*(r.height-1)+s.right-1]))),new Ho(e,t)}isRowSelection(){const e=this.$anchorCell.node(-1),t=lt.get(e),o=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-o),i=t.colCount(this.$headCell.pos-o);if(Math.min(r,i)>0)return!1;const s=r+this.$anchorCell.nodeAfter.attrs.colspan,l=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(s,l)==t.width}eq(e){return e instanceof Ho&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,t=e){const o=e.node(-1),r=lt.get(o),i=e.start(-1),s=r.findCell(e.pos-i),l=r.findCell(t.pos-i),a=e.node(0);return s.left<=l.left?(s.left>0&&(e=a.resolve(i+r.map[s.top*r.width])),l.right<r.width&&(t=a.resolve(i+r.map[r.width*(l.top+1)-1]))):(l.left>0&&(t=a.resolve(i+r.map[l.top*r.width])),s.right<r.width&&(e=a.resolve(i+r.map[r.width*(s.top+1)-1]))),new Ho(e,t)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(e,t){return new Ho(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,o=t){return new Ho(e.resolve(t),e.resolve(o))}getBookmark(){return new t6(this.$anchorCell.pos,this.$headCell.pos)}};Xe.prototype.visible=!1;De.jsonID("cell",Xe);var t6=class cT{constructor(e,t){this.anchor=e,this.head=t}map(e){return new cT(e.map(this.anchor),e.map(this.head))}resolve(e){const t=e.resolve(this.anchor),o=e.resolve(this.head);return t.parent.type.spec.tableRole=="row"&&o.parent.type.spec.tableRole=="row"&&t.index()<t.parent.childCount&&o.index()<o.parent.childCount&&oy(t,o)?new Xe(t,o):De.near(o,1)}};function n6(n){if(!(n.selection instanceof Xe))return null;const e=[];return n.selection.forEachCell((t,o)=>{e.push(Rn.node(o,o+t.nodeSize,{class:"selectedCell"}))}),dt.create(n.doc,e)}function o6({$from:n,$to:e}){if(n.pos==e.pos||n.pos<e.pos-6)return!1;let t=n.pos,o=e.pos,r=n.depth;for(;r>=0&&!(n.after(r+1)<n.end(r));r--,t++);for(let i=e.depth;i>=0&&!(e.before(i+1)>e.start(i));i--,o--);return t==o&&/row|table/.test(n.node(r).type.spec.tableRole)}function r6({$from:n,$to:e}){let t,o;for(let r=n.depth;r>0;r--){const i=n.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){t=i;break}}for(let r=e.depth;r>0;r--){const i=e.node(r);if(i.type.spec.tableRole==="cell"||i.type.spec.tableRole==="header_cell"){o=i;break}}return t!==o&&e.parentOffset===0}function i6(n,e,t){const o=(e||n).selection,r=(e||n).doc;let i,s;if(o instanceof Be&&(s=o.node.type.spec.tableRole)){if(s=="cell"||s=="header_cell")i=Xe.create(r,o.from);else if(s=="row"){const l=r.resolve(o.from+1);i=Xe.rowSelection(l,l)}else if(!t){const l=lt.get(o.node),a=o.from+1,u=a+l.map[l.width*l.height-1];i=Xe.create(r,a+1,u)}}else o instanceof Le&&o6(o)?i=Le.create(r,o.from):o instanceof Le&&r6(o)&&(i=Le.create(r,o.$from.start(),o.$from.end()));return i&&(e||(e=n.tr)).setSelection(i),e}const s6=new Jg("fix-tables");function uT(n,e,t,o){const r=n.childCount,i=e.childCount;e:for(let s=0,l=0;s<i;s++){const a=e.child(s);for(let u=l,d=Math.min(r,s+3);u<d;u++)if(n.child(u)==a){l=u+1,t+=a.nodeSize;continue e}o(a,t),l<r&&n.child(l).sameMarkup(a)?uT(n.child(l),a,t+1,o):a.nodesBetween(0,a.content.size,o,t+1),t+=a.nodeSize}}function dT(n,e){let t;const o=(r,i)=>{r.type.spec.tableRole=="table"&&(t=l6(n,r,i,t))};return e?e.doc!=n.doc&&uT(e.doc,n.doc,0,o):n.doc.descendants(o),t}function l6(n,e,t,o){const r=lt.get(e);if(!r.problems)return o;o||(o=n.tr);const i=[];for(let a=0;a<r.height;a++)i.push(0);for(let a=0;a<r.problems.length;a++){const u=r.problems[a];if(u.type=="collision"){const d=e.nodeAt(u.pos);if(!d)continue;const f=d.attrs;for(let p=0;p<f.rowspan;p++)i[u.row+p]+=u.n;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,Ai(f,f.colspan-u.n,u.n))}else if(u.type=="missing")i[u.row]+=u.n;else if(u.type=="overlong_rowspan"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,{...d.attrs,rowspan:d.attrs.rowspan-u.n})}else if(u.type=="colwidth mismatch"){const d=e.nodeAt(u.pos);if(!d)continue;o.setNodeMarkup(o.mapping.map(t+1+u.pos),null,{...d.attrs,colwidth:u.colwidth})}else if(u.type=="zero_sized"){const d=o.mapping.map(t);o.delete(d,d+e.nodeSize)}}let s,l;for(let a=0;a<i.length;a++)i[a]&&(s==null&&(s=a),l=a);for(let a=0,u=t+1;a<r.height;a++){const d=e.child(a),f=u+d.nodeSize,p=i[a];if(p>0){let h="cell";d.firstChild&&(h=d.firstChild.type.spec.tableRole);const m=[];for(let y=0;y<p;y++){const b=qt(n.schema)[h].createAndFill();b&&m.push(b)}const g=(a==0||s==a-1)&&l==a?u+1:f-1;o.insert(o.mapping.map(g),m)}u=f}return o.setMeta(s6,{fixTables:!0})}function $o(n){const e=n.selection,t=Yd(n),o=t.node(-1),r=t.start(-1),i=lt.get(o);return{...e instanceof Xe?i.rectBetween(e.$anchorCell.pos-r,e.$headCell.pos-r):i.findCell(t.pos-r),tableStart:r,map:i,table:o}}function fT(n,{map:e,tableStart:t,table:o},r){let i=r>0?-1:0;e6(e,o,r+i)&&(i=r==0||r==e.width?null:0);for(let s=0;s<e.height;s++){const l=s*e.width+r;if(r>0&&r<e.width&&e.map[l-1]==e.map[l]){const a=e.map[l],u=o.nodeAt(a);n.setNodeMarkup(n.mapping.map(t+a),null,aT(u.attrs,r-e.colCount(a))),s+=u.attrs.rowspan-1}else{const a=i==null?qt(o.type.schema).cell:o.nodeAt(e.map[l+i]).type,u=e.positionAt(s,r,o);n.insert(n.mapping.map(t+u),a.createAndFill())}}return n}function a6(n,e){if(!ro(n))return!1;if(e){const t=$o(n);e(fT(n.tr,t,t.left))}return!0}function c6(n,e){if(!ro(n))return!1;if(e){const t=$o(n);e(fT(n.tr,t,t.right))}return!0}function u6(n,{map:e,table:t,tableStart:o},r){const i=n.mapping.maps.length;for(let s=0;s<e.height;){const l=s*e.width+r,a=e.map[l],u=t.nodeAt(a),d=u.attrs;if(r>0&&e.map[l-1]==a||r<e.width-1&&e.map[l+1]==a)n.setNodeMarkup(n.mapping.slice(i).map(o+a),null,Ai(d,r-e.colCount(a)));else{const f=n.mapping.slice(i).map(o+a);n.delete(f,f+u.nodeSize)}s+=d.rowspan}}function d6(n,e){if(!ro(n))return!1;if(e){const t=$o(n),o=n.tr;if(t.left==0&&t.right==t.map.width)return!1;for(let r=t.right-1;u6(o,t,r),r!=t.left;r--){const i=t.tableStart?o.doc.nodeAt(t.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=lt.get(i)}e(o)}return!0}function f6(n,e,t){var o;const r=qt(e.type.schema).header_cell;for(let i=0;i<n.width;i++)if(((o=e.nodeAt(n.map[i+t*n.width]))===null||o===void 0?void 0:o.type)!=r)return!1;return!0}function pT(n,{map:e,tableStart:t,table:o},r){let i=t;for(let u=0;u<r;u++)i+=o.child(u).nodeSize;const s=[];let l=r>0?-1:0;f6(e,o,r+l)&&(l=r==0||r==e.height?null:0);for(let u=0,d=e.width*r;u<e.width;u++,d++)if(r>0&&r<e.height&&e.map[d]==e.map[d-e.width]){const f=e.map[d],p=o.nodeAt(f).attrs;n.setNodeMarkup(t+f,null,{...p,rowspan:p.rowspan+1}),u+=p.colspan-1}else{var a;const f=l==null?qt(o.type.schema).cell:(a=o.nodeAt(e.map[d+l*e.width]))===null||a===void 0?void 0:a.type,p=f==null?void 0:f.createAndFill();p&&s.push(p)}return n.insert(i,qt(o.type.schema).row.create(null,s)),n}function p6(n,e){if(!ro(n))return!1;if(e){const t=$o(n);e(pT(n.tr,t,t.top))}return!0}function h6(n,e){if(!ro(n))return!1;if(e){const t=$o(n);e(pT(n.tr,t,t.bottom))}return!0}function m6(n,{map:e,table:t,tableStart:o},r){let i=0;for(let u=0;u<r;u++)i+=t.child(u).nodeSize;const s=i+t.child(r).nodeSize,l=n.mapping.maps.length;n.delete(i+o,s+o);const a=new Set;for(let u=0,d=r*e.width;u<e.width;u++,d++){const f=e.map[d];if(!a.has(f)){if(a.add(f),r>0&&f==e.map[d-e.width]){const p=t.nodeAt(f).attrs;n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p,rowspan:p.rowspan-1}),u+=p.colspan-1}else if(r<e.height&&f==e.map[d+e.width]){const p=t.nodeAt(f),h=p.attrs,m=p.type.create({...h,rowspan:p.attrs.rowspan-1},p.content),g=e.positionAt(r+1,u,t);n.insert(n.mapping.slice(l).map(o+g),m),u+=h.colspan-1}}}}function g6(n,e){if(!ro(n))return!1;if(e){const t=$o(n),o=n.tr;if(t.top==0&&t.bottom==t.map.height)return!1;for(let r=t.bottom-1;m6(o,t,r),r!=t.top;r--){const i=t.tableStart?o.doc.nodeAt(t.tableStart-1):o.doc;if(!i)throw new RangeError("No table found");t.table=i,t.map=lt.get(t.table)}e(o)}return!0}function Xk(n){const e=n.content;return e.childCount==1&&e.child(0).isTextblock&&e.child(0).childCount==0}function y6({width:n,height:e,map:t},o){let r=o.top*n+o.left,i=r,s=(o.bottom-1)*n+o.left,l=r+(o.right-o.left-1);for(let a=o.top;a<o.bottom;a++){if(o.left>0&&t[i]==t[i-1]||o.right<n&&t[l]==t[l+1])return!0;i+=n,l+=n}for(let a=o.left;a<o.right;a++){if(o.top>0&&t[r]==t[r-n]||o.bottom<e&&t[s]==t[s+n])return!0;r++,s++}return!1}function Yk(n,e){const t=n.selection;if(!(t instanceof Xe)||t.$anchorCell.pos==t.$headCell.pos)return!1;const o=$o(n),{map:r}=o;if(y6(r,o))return!1;if(e){const i=n.tr,s={};let l=G.empty,a,u;for(let d=o.top;d<o.bottom;d++)for(let f=o.left;f<o.right;f++){const p=r.map[d*r.width+f],h=o.table.nodeAt(p);if(!(s[p]||!h))if(s[p]=!0,a==null)a=p,u=h;else{Xk(h)||(l=l.append(h.content));const m=i.mapping.map(p+o.tableStart);i.delete(m,m+h.nodeSize)}}if(a==null||u==null)return!0;if(i.setNodeMarkup(a+o.tableStart,null,{...aT(u.attrs,u.attrs.colspan,o.right-o.left-u.attrs.colspan),rowspan:o.bottom-o.top}),l.size>0){const d=a+1+u.content.size,f=Xk(u)?a+1:d;i.replaceWith(f+o.tableStart,d+o.tableStart,l)}i.setSelection(new Xe(i.doc.resolve(a+o.tableStart))),e(i)}return!0}function Qk(n,e){const t=qt(n.schema);return b6(({node:o})=>t[o.type.spec.tableRole])(n,e)}function b6(n){return(e,t)=>{const o=e.selection;let r,i;if(o instanceof Xe){if(o.$anchorCell.pos!=o.$headCell.pos)return!1;r=o.$anchorCell.nodeAfter,i=o.$anchorCell.pos}else{var s;if(r=Yq(o.$from),!r)return!1;i=(s=Ni(o.$from))===null||s===void 0?void 0:s.pos}if(r==null||i==null||r.attrs.colspan==1&&r.attrs.rowspan==1)return!1;if(t){let l=r.attrs;const a=[],u=l.colwidth;l.rowspan>1&&(l={...l,rowspan:1}),l.colspan>1&&(l={...l,colspan:1});const d=$o(e),f=e.tr;for(let h=0;h<d.right-d.left;h++)a.push(u?{...l,colwidth:u&&u[h]?[u[h]]:null}:l);let p;for(let h=d.top;h<d.bottom;h++){let m=d.map.positionAt(h,d.left,d.table);h==d.top&&(m+=r.nodeSize);for(let g=d.left,y=0;g<d.right;g++,y++)g==d.left&&h==d.top||f.insert(p=f.mapping.map(m+d.tableStart,1),n({node:r,row:h,col:g}).createAndFill(a[y]))}f.setNodeMarkup(i,n({node:r,row:d.top,col:d.left}),a[0]),o instanceof Xe&&f.setSelection(new Xe(f.doc.resolve(o.$anchorCell.pos),p?f.doc.resolve(p):void 0)),t(f)}return!0}}function v6(n,e){return function(t,o){if(!ro(t))return!1;const r=Yd(t);if(r.nodeAfter.attrs[n]===e)return!1;if(o){const i=t.tr;t.selection instanceof Xe?t.selection.forEachCell((s,l)=>{s.attrs[n]!==e&&i.setNodeMarkup(l,null,{...s.attrs,[n]:e})}):i.setNodeMarkup(r.pos,null,{...r.nodeAfter.attrs,[n]:e}),o(i)}return!0}}function k6(n){return function(e,t){if(!ro(e))return!1;if(t){const o=qt(e.schema),r=$o(e),i=e.tr,s=r.map.cellsInRect(n=="column"?{left:r.left,top:0,right:r.right,bottom:r.map.height}:n=="row"?{left:0,top:r.top,right:r.map.width,bottom:r.bottom}:r),l=s.map(a=>r.table.nodeAt(a));for(let a=0;a<s.length;a++)l[a].type==o.header_cell&&i.setNodeMarkup(r.tableStart+s[a],o.cell,l[a].attrs);if(i.steps.length===0)for(let a=0;a<s.length;a++)i.setNodeMarkup(r.tableStart+s[a],o.header_cell,l[a].attrs);t(i)}return!0}}function Zk(n,e,t){const o=e.map.cellsInRect({left:0,top:0,right:n=="row"?e.map.width:1,bottom:n=="column"?e.map.height:1});for(let r=0;r<o.length;r++){const i=e.table.nodeAt(o[r]);if(i&&i.type!==t.header_cell)return!1}return!0}function ua(n,e){return e=e||{useDeprecatedLogic:!1},e.useDeprecatedLogic?k6(n):function(t,o){if(!ro(t))return!1;if(o){const r=qt(t.schema),i=$o(t),s=t.tr,l=Zk("row",i,r),a=Zk("column",i,r),u=(n==="column"?l:n==="row"&&a)?1:0,d=n=="column"?{left:0,top:u,right:1,bottom:i.map.height}:n=="row"?{left:u,top:0,right:i.map.width,bottom:1}:i,f=n=="column"?a?r.cell:r.header_cell:n=="row"?l?r.cell:r.header_cell:r.cell;i.map.cellsInRect(d).forEach(p=>{const h=p+i.tableStart,m=s.doc.nodeAt(h);m&&s.setNodeMarkup(h,f,m.attrs)}),o(s)}return!0}}ua("row",{useDeprecatedLogic:!0});ua("column",{useDeprecatedLogic:!0});const w6=ua("cell",{useDeprecatedLogic:!0});function x6(n,e){if(e<0){const t=n.nodeBefore;if(t)return n.pos-t.nodeSize;for(let o=n.index(-1)-1,r=n.before();o>=0;o--){const i=n.node(-1).child(o),s=i.lastChild;if(s)return r-1-s.nodeSize;r-=i.nodeSize}}else{if(n.index()<n.parent.childCount-1)return n.pos+n.nodeAfter.nodeSize;const t=n.node(-1);for(let o=n.indexAfter(-1),r=n.after();o<t.childCount;o++){const i=t.child(o);if(i.childCount)return r+1;r+=i.nodeSize}}return null}function ew(n){return function(e,t){if(!ro(e))return!1;const o=x6(Yd(e),n);if(o==null)return!1;if(t){const r=e.doc.resolve(o);t(e.tr.setSelection(Le.between(r,Zq(r))).scrollIntoView())}return!0}}function C6(n,e){const t=n.selection.$anchor;for(let o=t.depth;o>0;o--)if(t.node(o).type.spec.tableRole=="table")return e&&e(n.tr.delete(t.before(o),t.after(o)).scrollIntoView()),!0;return!1}function sc(n,e){const t=n.selection;if(!(t instanceof Xe))return!1;if(e){const o=n.tr,r=qt(n.schema).cell.createAndFill().content;t.forEachCell((i,s)=>{i.content.eq(r)||o.replace(o.mapping.map(s+1),o.mapping.map(s+i.nodeSize-1),new Z(r,0,0))}),o.docChanged&&e(o)}return!0}function S6(n){if(n.size===0)return null;let{content:e,openStart:t,openEnd:o}=n;for(;e.childCount==1&&(t>0&&o>0||e.child(0).type.spec.tableRole=="table");)t--,o--,e=e.child(0).content;const r=e.child(0),i=r.type.spec.tableRole,s=r.type.schema,l=[];if(i=="row")for(let a=0;a<e.childCount;a++){let u=e.child(a).content;const d=a?0:Math.max(0,t-1),f=a<e.childCount-1?0:Math.max(0,o-1);(d||f)&&(u=jh(qt(s).row,new Z(u,d,f)).content),l.push(u)}else if(i=="cell"||i=="header_cell")l.push(t||o?jh(qt(s).row,new Z(e,t,o)).content:e);else return null;return E6(s,l)}function E6(n,e){const t=[];for(let r=0;r<e.length;r++){const i=e[r];for(let s=i.childCount-1;s>=0;s--){const{rowspan:l,colspan:a}=i.child(s).attrs;for(let u=r;u<r+l;u++)t[u]=(t[u]||0)+a}}let o=0;for(let r=0;r<t.length;r++)o=Math.max(o,t[r]);for(let r=0;r<t.length;r++)if(r>=e.length&&e.push(G.empty),t[r]<o){const i=qt(n).cell.createAndFill(),s=[];for(let l=t[r];l<o;l++)s.push(i);e[r]=e[r].append(G.from(s))}return{height:e.length,width:o,rows:e}}function jh(n,e){const t=n.createAndFill();return new X8(t).replace(0,t.content.size,e).doc}function M6({width:n,height:e,rows:t},o,r){if(n!=o){const i=[],s=[];for(let l=0;l<t.length;l++){const a=t[l],u=[];for(let d=i[l]||0,f=0;d<o;f++){let p=a.child(f%a.childCount);d+p.attrs.colspan>o&&(p=p.type.createChecked(Ai(p.attrs,p.attrs.colspan,d+p.attrs.colspan-o),p.content)),u.push(p),d+=p.attrs.colspan;for(let h=1;h<p.attrs.rowspan;h++)i[l+h]=(i[l+h]||0)+p.attrs.colspan}s.push(G.from(u))}t=s,n=o}if(e!=r){const i=[];for(let s=0,l=0;s<r;s++,l++){const a=[],u=t[l%e];for(let d=0;d<u.childCount;d++){let f=u.child(d);s+f.attrs.rowspan>r&&(f=f.type.create({...f.attrs,rowspan:Math.max(1,r-f.attrs.rowspan)},f.content)),a.push(f)}i.push(G.from(a))}t=i,e=r}return{width:n,height:e,rows:t}}function T6(n,e,t,o,r,i,s){const l=n.doc.type.schema,a=qt(l);let u,d;if(r>e.width)for(let f=0,p=0;f<e.height;f++){const h=t.child(f);p+=h.nodeSize;const m=[];let g;h.lastChild==null||h.lastChild.type==a.cell?g=u||(u=a.cell.createAndFill()):g=d||(d=a.header_cell.createAndFill());for(let y=e.width;y<r;y++)m.push(g);n.insert(n.mapping.slice(s).map(p-1+o),m)}if(i>e.height){const f=[];for(let m=0,g=(e.height-1)*e.width;m<Math.max(e.width,r);m++){const y=m>=e.width?!1:t.nodeAt(e.map[g+m]).type==a.header_cell;f.push(y?d||(d=a.header_cell.createAndFill()):u||(u=a.cell.createAndFill()))}const p=a.row.create(null,G.from(f)),h=[];for(let m=e.height;m<i;m++)h.push(p);n.insert(n.mapping.slice(s).map(o+t.nodeSize-2),h)}return!!(u||d)}function tw(n,e,t,o,r,i,s,l){if(s==0||s==e.height)return!1;let a=!1;for(let u=r;u<i;u++){const d=s*e.width+u,f=e.map[d];if(e.map[d-e.width]==f){a=!0;const p=t.nodeAt(f),{top:h,left:m}=e.findCell(f);n.setNodeMarkup(n.mapping.slice(l).map(f+o),null,{...p.attrs,rowspan:s-h}),n.insert(n.mapping.slice(l).map(e.positionAt(s,m,t)),p.type.createAndFill({...p.attrs,rowspan:h+p.attrs.rowspan-s})),u+=p.attrs.colspan-1}}return a}function nw(n,e,t,o,r,i,s,l){if(s==0||s==e.width)return!1;let a=!1;for(let u=r;u<i;u++){const d=u*e.width+s,f=e.map[d];if(e.map[d-1]==f){a=!0;const p=t.nodeAt(f),h=e.colCount(f),m=n.mapping.slice(l).map(f+o);n.setNodeMarkup(m,null,Ai(p.attrs,s-h,p.attrs.colspan-(s-h))),n.insert(m+p.nodeSize,p.type.createAndFill(Ai(p.attrs,0,s-h))),u+=p.attrs.rowspan-1}}return a}function ow(n,e,t,o,r){let i=t?n.doc.nodeAt(t-1):n.doc;if(!i)throw new Error("No table found");let s=lt.get(i);const{top:l,left:a}=o,u=a+r.width,d=l+r.height,f=n.tr;let p=0;function h(){if(i=t?f.doc.nodeAt(t-1):f.doc,!i)throw new Error("No table found");s=lt.get(i),p=f.mapping.maps.length}T6(f,s,i,t,u,d,p)&&h(),tw(f,s,i,t,a,u,l,p)&&h(),tw(f,s,i,t,a,u,d,p)&&h(),nw(f,s,i,t,l,d,a,p)&&h(),nw(f,s,i,t,l,d,u,p)&&h();for(let m=l;m<d;m++){const g=s.positionAt(m,a,i),y=s.positionAt(m,u,i);f.replace(f.mapping.slice(p).map(g+t),f.mapping.slice(p).map(y+t),new Z(r.rows[m-l],0,0))}h(),f.setSelection(new Xe(f.doc.resolve(t+s.positionAt(l,a,i)),f.doc.resolve(t+s.positionAt(d-1,u-1,i)))),e(f)}const N6=qq({ArrowLeft:lc("horiz",-1),ArrowRight:lc("horiz",1),ArrowUp:lc("vert",-1),ArrowDown:lc("vert",1),"Shift-ArrowLeft":ac("horiz",-1),"Shift-ArrowRight":ac("horiz",1),"Shift-ArrowUp":ac("vert",-1),"Shift-ArrowDown":ac("vert",1),Backspace:sc,"Mod-Backspace":sc,Delete:sc,"Mod-Delete":sc});function $c(n,e,t){return t.eq(n.selection)?!1:(e&&e(n.tr.setSelection(t).scrollIntoView()),!0)}function lc(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;if(i instanceof Xe)return $c(t,o,De.near(i.$headCell,e));if(n!="horiz"&&!i.empty)return!1;const s=hT(r,n,e);if(s==null)return!1;if(n=="horiz")return $c(t,o,De.near(t.doc.resolve(i.head+e),e));{const l=t.doc.resolve(s),a=lT(l,n,e);let u;return a?u=De.near(a,1):e<0?u=De.near(t.doc.resolve(l.before(-1)),-1):u=De.near(t.doc.resolve(l.after(-1)),1),$c(t,o,u)}}}function ac(n,e){return(t,o,r)=>{if(!r)return!1;const i=t.selection;let s;if(i instanceof Xe)s=i;else{const a=hT(r,n,e);if(a==null)return!1;s=new Xe(t.doc.resolve(a))}const l=lT(s.$headCell,n,e);return l?$c(t,o,new Xe(s.$anchorCell,l)):!1}}function A6(n,e){const t=n.state.doc,o=Ni(t.resolve(e));return o?(n.dispatch(n.state.tr.setSelection(new Xe(o))),!0):!1}function O6(n,e,t){if(!ro(n.state))return!1;let o=S6(t);const r=n.state.selection;if(r instanceof Xe){o||(o={width:1,height:1,rows:[G.from(jh(qt(n.state.schema).cell,t))]});const i=r.$anchorCell.node(-1),s=r.$anchorCell.start(-1),l=lt.get(i).rectBetween(r.$anchorCell.pos-s,r.$headCell.pos-s);return o=M6(o,l.right-l.left,l.bottom-l.top),ow(n.state,n.dispatch,s,l,o),!0}else if(o){const i=Yd(n.state),s=i.start(-1);return ow(n.state,n.dispatch,s,lt.get(i.node(-1)).findCell(i.pos-s),o),!0}else return!1}function $6(n,e){var t;if(e.button!=0||e.ctrlKey||e.metaKey)return;const o=rw(n,e.target);let r;if(e.shiftKey&&n.state.selection instanceof Xe)i(n.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&(r=Ni(n.state.selection.$anchor))!=null&&((t=cp(n,e))===null||t===void 0?void 0:t.pos)!=r.pos)i(r,e),e.preventDefault();else if(!o)return;function i(a,u){let d=cp(n,u);const f=vr.getState(n.state)==null;if(!d||!oy(a,d))if(f)d=a;else return;const p=new Xe(a,d);if(f||!n.state.selection.eq(p)){const h=n.state.tr.setSelection(p);f&&h.setMeta(vr,a.pos),n.dispatch(h)}}function s(){n.root.removeEventListener("mouseup",s),n.root.removeEventListener("dragstart",s),n.root.removeEventListener("mousemove",l),vr.getState(n.state)!=null&&n.dispatch(n.state.tr.setMeta(vr,-1))}function l(a){const u=a,d=vr.getState(n.state);let f;if(d!=null)f=n.state.doc.resolve(d);else if(rw(n,u.target)!=o&&(f=cp(n,e),!f))return s();f&&i(f,u)}n.root.addEventListener("mouseup",s),n.root.addEventListener("dragstart",s),n.root.addEventListener("mousemove",l)}function hT(n,e,t){if(!(n.state.selection instanceof Le))return null;const{$head:o}=n.state.selection;for(let r=o.depth-1;r>=0;r--){const i=o.node(r);if((t<0?o.index(r):o.indexAfter(r))!=(t<0?0:i.childCount))return null;if(i.type.spec.tableRole=="cell"||i.type.spec.tableRole=="header_cell"){const s=o.before(r),l=e=="vert"?t>0?"down":"up":t>0?"right":"left";return n.endOfTextblock(l)?s:null}}return null}function rw(n,e){for(;e&&e!=n.dom;e=e.parentNode)if(e.nodeName=="TD"||e.nodeName=="TH")return e;return null}function cp(n,e){const t=n.posAtCoords({left:e.clientX,top:e.clientY});if(!t)return null;let{inside:o,pos:r}=t;return o>=0&&Ni(n.state.doc.resolve(o))||Ni(n.state.doc.resolve(r))}var B6=class{constructor(n,e){this.node=n,this.defaultCellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${e}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Uh(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!=this.node.type?!1:(this.node=n,Uh(n,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(n){return n.type=="attributes"&&(n.target==this.table||this.colgroup.contains(n.target))}};function Uh(n,e,t,o,r,i){let s=0,l=!0,a=e.firstChild;const u=n.firstChild;if(u){for(let f=0,p=0;f<u.childCount;f++){const{colspan:h,colwidth:m}=u.child(f).attrs;for(let g=0;g<h;g++,p++){const y=r==p?i:m&&m[g],b=y?y+"px":"";if(s+=y||o,y||(l=!1),a)a.style.width!=b&&(a.style.width=b),a=a.nextSibling;else{const v=document.createElement("col");v.style.width=b,e.appendChild(v)}}}for(;a;){var d;const f=a.nextSibling;(d=a.parentNode)===null||d===void 0||d.removeChild(a),a=f}l?(t.style.width=s+"px",t.style.minWidth=""):(t.style.width="",t.style.minWidth=s+"px")}}const xn=new Jg("tableColumnResizing");function R6({handleWidth:n=5,cellMinWidth:e=25,defaultCellMinWidth:t=100,View:o=B6,lastColumnResizable:r=!0}={}){const i=new _M({key:xn,state:{init(s,l){var a;const u=(a=i.spec)===null||a===void 0||(a=a.props)===null||a===void 0?void 0:a.nodeViews,d=qt(l.schema).table.name;return o&&u&&(u[d]=(f,p)=>new o(f,t,p)),new _6(-1,!1)},apply(s,l){return l.apply(s)}},props:{attributes:s=>{const l=xn.getState(s);return l&&l.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(s,l)=>{D6(s,l,n,r)},mouseleave:s=>{I6(s)},mousedown:(s,l)=>{L6(s,l,e,t)}},decorations:s=>{const l=xn.getState(s);if(l&&l.activeHandle>-1)return H6(s,l.activeHandle)},nodeViews:{}}});return i}var _6=class Bc{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(e){const t=this,o=e.getMeta(xn);if(o&&o.setHandle!=null)return new Bc(o.setHandle,!1);if(o&&o.setDragging!==void 0)return new Bc(t.activeHandle,o.setDragging);if(t.activeHandle>-1&&e.docChanged){let r=e.mapping.map(t.activeHandle,-1);return Hh(e.doc.resolve(r))||(r=-1),new Bc(r,t.dragging)}return t}};function D6(n,e,t,o){if(!n.editable)return;const r=xn.getState(n.state);if(r&&!r.dragging){const i=V6(e.target);let s=-1;if(i){const{left:l,right:a}=i.getBoundingClientRect();e.clientX-l<=t?s=iw(n,e,"left",t):a-e.clientX<=t&&(s=iw(n,e,"right",t))}if(s!=r.activeHandle){if(!o&&s!==-1){const l=n.state.doc.resolve(s),a=l.node(-1),u=lt.get(a),d=l.start(-1);if(u.colCount(l.pos-d)+l.nodeAfter.attrs.colspan-1==u.width-1)return}mT(n,s)}}}function I6(n){if(!n.editable)return;const e=xn.getState(n.state);e&&e.activeHandle>-1&&!e.dragging&&mT(n,-1)}function L6(n,e,t,o){var r;if(!n.editable)return!1;const i=(r=n.dom.ownerDocument.defaultView)!==null&&r!==void 0?r:window,s=xn.getState(n.state);if(!s||s.activeHandle==-1||s.dragging)return!1;const l=n.state.doc.nodeAt(s.activeHandle),a=P6(n,s.activeHandle,l.attrs);n.dispatch(n.state.tr.setMeta(xn,{setDragging:{startX:e.clientX,startWidth:a}}));function u(f){i.removeEventListener("mouseup",u),i.removeEventListener("mousemove",d);const p=xn.getState(n.state);p!=null&&p.dragging&&(z6(n,p.activeHandle,sw(p.dragging,f,t)),n.dispatch(n.state.tr.setMeta(xn,{setDragging:null})))}function d(f){if(!f.which)return u(f);const p=xn.getState(n.state);if(p&&p.dragging){const h=sw(p.dragging,f,t);lw(n,p.activeHandle,h,o)}}return lw(n,s.activeHandle,a,o),i.addEventListener("mouseup",u),i.addEventListener("mousemove",d),e.preventDefault(),!0}function P6(n,e,{colspan:t,colwidth:o}){const r=o&&o[o.length-1];if(r)return r;const i=n.domAtPos(e);let s=i.node.childNodes[i.offset].offsetWidth,l=t;if(o)for(let a=0;a<t;a++)o[a]&&(s-=o[a],l--);return s/l}function V6(n){for(;n&&n.nodeName!="TD"&&n.nodeName!="TH";)n=n.classList&&n.classList.contains("ProseMirror")?null:n.parentNode;return n}function iw(n,e,t,o){const r=t=="right"?-o:o,i=n.posAtCoords({left:e.clientX+r,top:e.clientY});if(!i)return-1;const{pos:s}=i,l=Ni(n.state.doc.resolve(s));if(!l)return-1;if(t=="right")return l.pos;const a=lt.get(l.node(-1)),u=l.start(-1),d=a.map.indexOf(l.pos-u);return d%a.width==0?-1:u+a.map[d-1]}function sw(n,e,t){const o=e.clientX-n.startX;return Math.max(t,n.startWidth+o)}function mT(n,e){n.dispatch(n.state.tr.setMeta(xn,{setHandle:e}))}function z6(n,e,t){const o=n.state.doc.resolve(e),r=o.node(-1),i=lt.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1,a=n.state.tr;for(let u=0;u<i.height;u++){const d=u*i.width+l;if(u&&i.map[d]==i.map[d-i.width])continue;const f=i.map[d],p=r.nodeAt(f).attrs,h=p.colspan==1?0:l-i.colCount(f);if(p.colwidth&&p.colwidth[h]==t)continue;const m=p.colwidth?p.colwidth.slice():F6(p.colspan);m[h]=t,a.setNodeMarkup(s+f,null,{...p,colwidth:m})}a.docChanged&&n.dispatch(a)}function lw(n,e,t,o){const r=n.state.doc.resolve(e),i=r.node(-1),s=r.start(-1),l=lt.get(i).colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;let a=n.domAtPos(r.start(-1)).node;for(;a&&a.nodeName!="TABLE";)a=a.parentNode;a&&Uh(i,a.firstChild,a,o,l,t)}function F6(n){return Array(n).fill(0)}function H6(n,e){const t=[],o=n.doc.resolve(e),r=o.node(-1);if(!r)return dt.empty;const i=lt.get(r),s=o.start(-1),l=i.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let u=0;u<i.height;u++){const d=l+u*i.width;if((l==i.width-1||i.map[d]!=i.map[d+1])&&(u==0||i.map[d]!=i.map[d-i.width])){var a;const f=i.map[d],p=s+f+r.nodeAt(f).nodeSize-1,h=document.createElement("div");h.className="column-resize-handle",!((a=xn.getState(n))===null||a===void 0)&&a.dragging&&t.push(Rn.node(s+f,s+f+r.nodeAt(f).nodeSize,{class:"column-resize-dragging"})),t.push(Rn.widget(p,h))}}return dt.create(n.doc,t)}function j6({allowTableNodeSelection:n=!1}={}){return new _M({key:vr,state:{init(){return null},apply(e,t){const o=e.getMeta(vr);if(o!=null)return o==-1?null:o;if(t==null||!e.docChanged)return t;const{deleted:r,pos:i}=e.mapping.mapResult(t);return r?null:i}},props:{decorations:n6,handleDOMEvents:{mousedown:$6},createSelectionBetween(e){return vr.getState(e.state)!=null?e.state.selection:null},handleTripleClick:A6,handleKeyDown:N6,handlePaste:O6},appendTransaction(e,t,o){return i6(o,dT(o,t),n)}})}var U6=Ie.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{var e,t;const o=n.getAttribute("colwidth"),r=o?o.split(",").map(i=>parseInt(i,10)):null;if(!r){const i=(e=n.closest("table"))==null?void 0:e.querySelectorAll("colgroup > col"),s=Array.from(((t=n.parentElement)==null?void 0:t.children)||[]).indexOf(n);if(s&&s>-1&&i&&i[s]){const l=i[s].getAttribute("width");return l?[parseInt(l,10)]:null}}return r}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:n}){return["td",he(this.options.HTMLAttributes,n),0]}}),W6=Ie.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:n=>{const e=n.getAttribute("colwidth");return e?e.split(",").map(t=>parseInt(t,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:n}){return["th",he(this.options.HTMLAttributes,n),0]}}),q6=Ie.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:n}){return["tr",he(this.options.HTMLAttributes,n),0]}});function Wh(n,e){return e?["width",`${Math.max(e,n)}px`]:["min-width",`${n}px`]}function aw(n,e,t,o,r,i){var s;let l=0,a=!0,u=e.firstChild;const d=n.firstChild;if(d!==null)for(let p=0,h=0;p<d.childCount;p+=1){const{colspan:m,colwidth:g}=d.child(p).attrs;for(let y=0;y<m;y+=1,h+=1){const b=r===h?i:g&&g[y],v=b?`${b}px`:"";if(l+=b||o,b||(a=!1),u){if(u.style.width!==v){const[w,k]=Wh(o,b);u.style.setProperty(w,k)}u=u.nextSibling}else{const w=document.createElement("col"),[k,x]=Wh(o,b);w.style.setProperty(k,x),e.appendChild(w)}}}for(;u;){const p=u.nextSibling;(s=u.parentNode)==null||s.removeChild(u),u=p}const f=n.attrs.style&&typeof n.attrs.style=="string"&&/\bwidth\s*:/i.test(n.attrs.style);a&&!f?(t.style.width=`${l}px`,t.style.minWidth=""):(t.style.width="",t.style.minWidth=`${l}px`)}var K6=class{constructor(n,e){this.node=n,this.cellMinWidth=e,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),n.attrs.style&&(this.table.style.cssText=n.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),aw(n,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(n){return n.type!==this.node.type?!1:(this.node=n,aw(n,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(n){const e=n.target,t=this.dom.contains(e),o=this.contentDOM.contains(e);return!!(t&&!o&&(n.type==="attributes"||n.type==="childList"||n.type==="characterData"))}};function J6(n,e,t,o){let r=0,i=!0;const s=[],l=n.firstChild;if(!l)return{};for(let d=0,f=0;d<l.childCount;d+=1){const{colspan:p,colwidth:h}=l.child(d).attrs;for(let m=0;m<p;m+=1,f+=1){const g=t===f?o:h&&h[m];r+=g||e,g||(i=!1);const[y,b]=Wh(e,g);s.push(["col",{style:`${y}: ${b}`}])}}const a=i?`${r}px`:"",u=i?"":`${r}px`;return{colgroup:["colgroup",{},...s],tableWidth:a,tableMinWidth:u}}function cw(n,e){return n.createAndFill()}function G6(n){if(n.cached.tableNodeTypes)return n.cached.tableNodeTypes;const e={};return Object.keys(n.nodes).forEach(t=>{const o=n.nodes[t];o.spec.tableRole&&(e[o.spec.tableRole]=o)}),n.cached.tableNodeTypes=e,e}function X6(n,e,t,o,r){const i=G6(n),s=[],l=[];for(let u=0;u<t;u+=1){const d=cw(i.cell);if(d&&l.push(d),o){const f=cw(i.header_cell);f&&s.push(f)}}const a=[];for(let u=0;u<e;u+=1)a.push(i.row.createChecked(null,o&&u===0?s:l));return i.table.createChecked(null,a)}function Y6(n){return n instanceof Xe}var cc=({editor:n})=>{const{selection:e}=n.state;if(!Y6(e))return!1;let t=0;const o=gm(e.ranges[0].$from,r=>r.type.name==="table");return o==null||o.node.descendants(r=>{if(r.type.name==="table")return!1;["tableCell","tableHeader"].includes(r.type.name)&&(t+=1)}),t===e.ranges.length?(n.commands.deleteTable(),!0):!1},Q6="";function Z6(n){return(n||"").replace(/\s+/g," ").trim()}function gT(n,e,t={}){var o;const r=(o=t.cellLineSeparator)!=null?o:Q6;if(!n||!n.content||n.content.length===0)return"";const i=[];n.content.forEach(h=>{const m=[];h.content&&h.content.forEach(g=>{let y="";g.content&&Array.isArray(g.content)&&g.content.length>1?y=g.content.map(w=>e.renderChildren(w)).join(r):y=g.content?e.renderChildren(g.content):"";const b=Z6(y),v=g.type==="tableHeader";m.push({text:b,isHeader:v})}),i.push(m)});const s=i.reduce((h,m)=>Math.max(h,m.length),0);if(s===0)return"";const l=new Array(s).fill(0);i.forEach(h=>{var m;for(let g=0;g<s;g+=1){const y=(((m=h[g])==null?void 0:m.text)||"").length;y>l[g]&&(l[g]=y),l[g]<3&&(l[g]=3)}});const a=(h,m)=>h+" ".repeat(Math.max(0,m-h.length)),u=i[0],d=u.some(h=>h.isHeader);let f=`
|
|
300
|
+
`;const p=new Array(s).fill(0).map((h,m)=>d&&u[m]&&u[m].text||"");return f+=`| ${p.map((h,m)=>a(h,l[m])).join(" | ")} |
|
|
301
|
+
`,f+=`| ${l.map(h=>"-".repeat(Math.max(3,h))).join(" | ")} |
|
|
302
|
+
`,(d?i.slice(1):i).forEach(h=>{f+=`| ${new Array(s).fill(0).map((m,g)=>a(h[g]&&h[g].text||"",l[g])).join(" | ")} |
|
|
303
|
+
`}),f}var eK=gT,tK=Ie.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:K6,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:n,HTMLAttributes:e}){const{colgroup:t,tableWidth:o,tableMinWidth:r}=J6(n,this.options.cellMinWidth),i=e.style;function s(){return i||(o?`width: ${o}`:`min-width: ${r}`)}const l=["table",he(this.options.HTMLAttributes,e,{style:s()}),t,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},l]:l},parseMarkdown:(n,e)=>{const t=[];if(n.header){const o=[];n.header.forEach(r=>{o.push(e.createNode("tableHeader",{},[{type:"paragraph",content:e.parseInline(r.tokens)}]))}),t.push(e.createNode("tableRow",{},o))}return n.rows&&n.rows.forEach(o=>{const r=[];o.forEach(i=>{r.push(e.createNode("tableCell",{},[{type:"paragraph",content:e.parseInline(i.tokens)}]))}),t.push(e.createNode("tableRow",{},r))}),e.createNode("table",void 0,t)},renderMarkdown:(n,e)=>eK(n,e),addCommands(){return{insertTable:({rows:n=3,cols:e=3,withHeaderRow:t=!0}={})=>({tr:o,dispatch:r,editor:i})=>{const s=X6(i.schema,n,e,t);if(r){const l=o.selection.from+1;o.replaceSelectionWith(s).scrollIntoView().setSelection(Le.near(o.doc.resolve(l)))}return!0},addColumnBefore:()=>({state:n,dispatch:e})=>a6(n,e),addColumnAfter:()=>({state:n,dispatch:e})=>c6(n,e),deleteColumn:()=>({state:n,dispatch:e})=>d6(n,e),addRowBefore:()=>({state:n,dispatch:e})=>p6(n,e),addRowAfter:()=>({state:n,dispatch:e})=>h6(n,e),deleteRow:()=>({state:n,dispatch:e})=>g6(n,e),deleteTable:()=>({state:n,dispatch:e})=>C6(n,e),mergeCells:()=>({state:n,dispatch:e})=>Yk(n,e),splitCell:()=>({state:n,dispatch:e})=>Qk(n,e),toggleHeaderColumn:()=>({state:n,dispatch:e})=>ua("column")(n,e),toggleHeaderRow:()=>({state:n,dispatch:e})=>ua("row")(n,e),toggleHeaderCell:()=>({state:n,dispatch:e})=>w6(n,e),mergeOrSplit:()=>({state:n,dispatch:e})=>Yk(n,e)?!0:Qk(n,e),setCellAttribute:(n,e)=>({state:t,dispatch:o})=>v6(n,e)(t,o),goToNextCell:()=>({state:n,dispatch:e})=>ew(1)(n,e),goToPreviousCell:()=>({state:n,dispatch:e})=>ew(-1)(n,e),fixTables:()=>({state:n,dispatch:e})=>(e&&dT(n),!0),setCellSelection:n=>({tr:e,dispatch:t})=>{if(t){const o=Xe.create(e.doc,n.anchorCell,n.headCell);e.setSelection(o)}return!0}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.goToNextCell()?!0:this.editor.can().addRowAfter()?this.editor.chain().addRowAfter().goToNextCell().run():!1,"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:cc,"Mod-Backspace":cc,Delete:cc,"Mod-Delete":cc}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[R6({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],j6({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(n){const e={name:n.name,options:n.options,storage:n.storage};return{tableRole:_e(re(n,"tableRole",e))}}});ve.create({name:"tableKit",addExtensions(){const n=[];return this.options.table!==!1&&n.push(tK.configure(this.options.table)),this.options.tableCell!==!1&&n.push(U6.configure(this.options.tableCell)),this.options.tableHeader!==!1&&n.push(W6.configure(this.options.tableHeader)),this.options.tableRow!==!1&&n.push(q6.configure(this.options.tableRow)),n}});const nK=Ie.create({name:"table-wrapper",group:"block",content:"table",draggable:!0,parseHTML(){return[{tag:"table-wrapper"}]},renderHTML({HTMLAttributes:n}){return["table-wrapper",he(n),0]},renderMarkdown:(n,e)=>n.content&&n.content.length?gT(n.content[0],e):""}),oK=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n,t=c.inject("sideNode",{value:!1}),o=c.ref(!1),r=c.computed(()=>{const{selection:s}=e.editor.view.state,l=s.from,a=e.getPos(),u=a+e.node.nodeSize;return l>=a&&l<=u});function i(s){o.value=s}return c.watch(r,s=>{console.log("isFocused",e.node.attrs),i(s)}),(s,l)=>(c.openBlock(),c.createBlock(c.unref(Mn),c.mergeProps(e,{class:["o-table-wrapper-view",{"side-node-enabled":c.unref(t)}]}),{default:c.withCtx(()=>[c.createVNode(c.unref(to),{as:"table"})]),_:1},16,["class"]))}}),yT=nK.extend({addNodeView(){return hn(oK,{stopEvent:()=>!1})}});/**
|
|
304
|
+
* Copyright 2026 Yiitap
|
|
305
|
+
* @license MIT
|
|
306
|
+
**/const rK=/(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,iK=Ie.create({name:"video",draggable:!0,addOptions(){return{inline:!1,HTMLAttributes:{}}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},addAttributes(){return{caption:{default:"",rendered:!1},src:{default:null,parseHTML:n=>{var e;return((e=n.firstElementChild)==null?void 0:e.src)??""}}}},parseHTML(){return[{tag:"video"}]},renderHTML({node:n,HTMLAttributes:e}){return["video",{caption:n.attrs.caption},["source",he(this.options.HTMLAttributes,e)]]},parseMarkdown:(n,e)=>{if(n.type==="html_block"||n.type==="html_inline"){const t=n.content,o=t.match(/<video\b([^>]*)>/i);if(!o)return{};const r=o[1],i=t.match(/<source\s+src="([^"]+)"/i),s=r.match(/caption="([^"]*)"/i);if(i)return e.createNode("video",{src:i[1],caption:s?s[1]:""})}return{}},renderMarkdown:n=>{var t,o;const e=((t=n.attrs)==null?void 0:t.src)??"";return`<video caption="${((o=n.attrs)==null?void 0:o.caption)??""}" controls>
|
|
307
|
+
<source src="${e}">
|
|
308
|
+
</video>`},addCommands(){return{setVideo:n=>({commands:e})=>e.insertContent({type:this.name,attrs:n})}},addInputRules(){return[md({find:rK,type:this.type,getAttributes:n=>{const[e]=n;return{src:e}}})]}}),sK={key:1,class:"video-container"},lK={key:1},aK=c.defineComponent({__name:"view",props:Ye,setup(n){const e=n,{tr:t}=de(),{isEditable:o}=ke(),r=c.ref(!1),i=c.ref({}),s=c.ref(null),l=c.ref(!1),a=c.ref(!1),u=c.computed({get(){return e.node.attrs.caption},set(v){e.updateAttributes({caption:v})}}),d=c.computed({get(){return e.node.attrs.src},set(v){e.updateAttributes({src:v})}});function f(v){switch(r.value=!1,v.value){case"replace":b(!0);break}}function p(){l.value=!0,setTimeout(()=>{var v;(v=s.value)==null||v.focus()},0)}function h(){l.value=!1}function m(){d.value==="init"&&b(!0)}function g(v){r.value=!0,i.value=v}function y(v){d.value=v,b(!1)}function b(v){a.value=v}return c.onMounted(()=>{b(d.value==="init")}),(v,w)=>{var k;return c.openBlock(),c.createBlock(c.unref(Mn),c.mergeProps(e,{class:["o-video-view",{readonly:!((k=v.editor)!=null&&k.isEditable),init:d.value==="init"}],as:"div",onContextmenu:c.withModifiers(g,["prevent"]),onClick:m}),{default:c.withCtx(()=>[c.createVNode(c.unref(Eo),{modelValue:a.value,"onUpdate:modelValue":w[1]||(w[1]=x=>a.value=x),placement:d.value==="init"?"bottom":"top"},{"popover-content":c.withCtx(()=>[c.createVNode(c.unref(ng),{val:d.value==="init"?"":d.value,type:"video",onInput:y},null,8,["val"])]),default:c.withCtx(()=>{var x;return[d.value==="init"?(c.openBlock(),c.createBlock(c.unref(xd),{key:0,icon:"videocam",placeholder:"Add a video"})):(c.openBlock(),c.createElementBlock("div",sK,[w[3]||(w[3]=c.createElementVNode("div",{class:"video-cover"},null,-1)),c.unref(o)?(c.openBlock(),c.createBlock(c.unref(eg),c.mergeProps({key:0},e,{onAction:f}),{default:c.withCtx(()=>[c.createVNode(c.unref(Ae),{icon:"subtitles",tooltip:c.unref(t)("image.caption"),onClick:p},null,8,["tooltip"])]),_:1},16)):c.createCommentVNode("",!0),c.createElementVNode("video",c.mergeProps(v.node.attrs,{draggable:"true","data-drag-handle":"",controls:""}),[c.createElementVNode("source",c.normalizeProps(c.guardReactiveProps(v.node.attrs)),null,16)],16),c.createElementVNode("div",{class:"caption",onClick:p},[(x=v.editor)!=null&&x.isEditable&&l.value?(c.openBlock(),c.createBlock(c.unref(Zn),{key:0,ref_key:"captionInput",ref:s,class:"caption-input",modelValue:u.value,"onUpdate:modelValue":w[0]||(w[0]=C=>u.value=C),type:"text",placeholder:"Input caption",autosize:"",onBlur:h},null,8,["modelValue"])):(c.openBlock(),c.createElementBlock("span",lK,c.toDisplayString(u.value),1))])]))]}),_:1},8,["modelValue","placement"]),c.createVNode(c.unref(ya),{modelValue:r.value,"onUpdate:modelValue":w[2]||(w[2]=x=>r.value=x),event:i.value},{default:c.withCtx(()=>[c.createVNode(c.unref(Fr),c.mergeProps(e,{onAction:f}),null,16)]),_:1},8,["modelValue","event"])]),_:1},16,["class"])}}}),bT=iK.extend({addNodeView(){return hn(aK)}}),vT=["BackgroundColor","Color","Focus","FontFamily","Highlight","Subscript","Superscript","TaskItem","TaskList","TextAlign","TextStyle","Typography","UniqueID","OBlockquote","OCallout","OCodeBlock","OHeading","OHorizontalRule","OLink","OParagraph","OSelectionDecoration","OSlash","OSlashZh","OTable"],kT={BackgroundColor:n=>gg.configure({types:["textStyle"],...n}),BlockMath:n=>Nl.BlockMath.configure(n),Collaboration:n=>mS.configure(n),CollaborationCaret:n=>gS.configure(n),Color:n=>yg.configure(n),Focus:n=>o1.configure(n),FontFamily:n=>bg.configure(n),Highlight:n=>yS.configure({multicolor:!0,...n}),Image:n=>bS.configure(n),InlineMath:n=>Nl.InlineMath.configure(n),Link:n=>Lm.configure(n),Markdown:n=>uw.Markdown.configure({indentation:{style:"space",size:2},markedOptions:{gfm:!0,breaks:!0,pedantic:!1},...n}),Subscript:n=>kS.configure(n),Superscript:n=>wS.configure(n),TaskItem:n=>GE.configure(n),TaskList:n=>Vm.configure({itemTypeName:"taskItem",...n}),TextAlign:n=>xS.configure({types:["heading","paragraph"],...n}),TextStyle:n=>mg.configure(n),Typography:n=>CS.configure(n),Underline:n=>Yx.configure(n),UniqueID:n=>ES.configure({attributeName:"id",types:["blockquote","codeBlock","callout","heading","image","paragraph","table-wrapper","video"],...n}),OAiBlock:n=>eM.configure(n),OBlockMath:n=>tM.configure(n),OColon:n=>XE.configure({suggestion:ZE,...n}),OSlash:n=>YE.configure({suggestion:Nh,...n}),OSlashZh:n=>QE.configure({suggestion:Nh,...n}),OBlockquote:n=>nM.configure({triggerCharacters:['"',"“","”"],...n}),OCallout:n=>oM.configure(n),OCodeBlock:n=>sM.configure(n),OColorHighlighter:n=>MS.configure(n),OHeading:n=>aM.configure(n),OHorizontalRule:n=>cM.configure(n),OImage:n=>uM.configure(n),OInlinePlaceholder:n=>TS.configure(n),OLink:n=>dM.configure({openOnClick:!1,...n}),OParagraph:n=>fM.configure(n),OSelectionDecoration:n=>NS.configure(n),OShortcut:n=>OS.configure(n),OVideo:n=>bT.configure(n),Table:n=>[_d.configure({resizable:!0,...n}),$u,Rd,Bd],ODetails:n=>[lM.configure({persist:!0,HTMLAttributes:{class:"details"},...n}),RC,_C],OTable:n=>[yT,$S.configure({resizable:!0,...n}),$u,hM,pM]},wT=n=>typeof n=="object"&&n!==null&&(n.type==="extension"||n.type==="node"||n.type==="mark"),Zu=n=>{const{name:e,configure:t}=n,o=kT[e];return o?o(t):(console.warn(`[YiiEditor] Extension factory for "${String(e)}" not found.`),null)},ry=n=>n.flatMap(e=>Array.isArray(e)?ry(e):wT(e)?e:typeof e=="string"?Zu({name:e})??[]:typeof e=="object"&&e!==null&&"name"in e?Zu(e)??[]:[]),cK={configure(n={}){return vT.flatMap(e=>{const t=n[e];return t===!1?[]:Zu({name:e,configure:typeof t=="object"?t:void 0})??[]})}},uK=["data-theme"],xT=c.defineComponent({name:"YiiEditor",__name:"YiiEditor",props:{content:{type:[String,Object],default:""},title:{type:Boolean,default:!1},editable:{type:Boolean,default:!0},autofocus:{type:[String,Number,Boolean],default:!1},locale:{type:String,default:"en"},darkMode:{type:Boolean,default:!1},showMainMenu:{type:Boolean,default:!1},showBubbleMenu:{type:Boolean,default:!1},showFloatingMenu:{type:Boolean,default:!1},sideMenu:{type:Object,default:()=>({show:!0,add:"menu"})},showSideNode:{type:Boolean,default:!1},extensions:{type:Array,default:()=>[]},mainMenu:{type:Array,default:()=>[]},tableMenu:{type:Array,default:()=>[]},bubbleMenu:{type:Array,default:()=>[]},floatingMenu:{type:Array,default:()=>[]},pageView:{type:String,default:"page",validator:n=>["page","full"].includes(n)},aiOption:{type:Object,default:()=>{}},collab:{type:Object,default:()=>({enabled:!1})}},emits:["create","transaction","update"],setup(n,{expose:e,emit:t}){const o=n,r=t,{tr:i}=de(),s=c.ref(!1),l=c.ref(!0),a=c.ref("en"),u=c.ref(!1),d=c.ref(),f=c.ref(!1);c.provide("darkMode",s),c.provide("isEditable",l),c.provide("locale",a),c.provide("sideNode",u),c.provide("aiOption",d);const p=c.computed(()=>v()),h=qB({editable:o.editable,content:o.content,autofocus:o.autofocus,extensions:p.value,onCreate:()=>{f.value=!0,r("create",h.value)},onUpdate:({editor:w})=>{f.value&&r("update",{editor:w})},onTransaction:({editor:w,transaction:k})=>{r("transaction",{editor:w,transaction:k})}}),m=c.computed(()=>({editor:h.value,menu:o.mainMenu})),g=c.computed(()=>({editor:h.value,menu:o.bubbleMenu})),y=c.computed(()=>({editor:h.value,menu:o.floatingMenu})),b=c.computed(()=>({editor:h.value,add:o.sideMenu.add,title:o.title,menu:[]}));function v(){const w=[];o.title?w.push(Bp.extend({content:"heading block*"})):w.push(Bp),w.push(z1.configure({placeholder:({editor:x,node:C,pos:S})=>{if(C.type.name==="heading"){const M=C.attrs.level;return S>0?`H${M}`:i("label.untitled")}else return C.type.name==="paragraph"?i("label.typeForCommands"):""}})),w.push(C_.configure({dropcursor:{width:5,color:"skyblue",class:"yiitap-dropcursor"},codeBlock:!1,document:!1,horizontalRule:!1,link:!1,blockquote:!1,heading:!1,paragraph:!1,trailingNode:o.title?{node:"paragraph",notAfter:["paragraph","heading"]}:{notAfter:[]},undoRedo:o.collab.enabled?!1:{depth:100,newGroupDelay:500}}));const k=ry(o.extensions);return w.push(...k),w}return c.watch(()=>o.darkMode,w=>{s.value=w}),c.watch(()=>o.locale,w=>{a.value=w}),c.watch(()=>o.aiOption,w=>{d.value=w},{deep:!0}),c.watch(()=>o.editable,w=>{var k;(k=h.value)==null||k.setEditable(w),l.value=w}),c.onBeforeMount(()=>{l.value=o.editable,d.value=o.aiOption,s.value=o.darkMode,a.value=o.locale,u.value=!o.sideMenu.show&&o.showSideNode}),e({editor:h,darkMode:s,locale:a}),(w,k)=>{var x,C,S;return c.openBlock(),c.createElementBlock("main",{class:"yiitap yiitap-editor","data-theme":s.value?"dark":""},[n.showMainMenu?(c.openBlock(),c.createBlock(wC,c.mergeProps({key:0},m.value,{class:"desktop-only"}),{left:c.withCtx(()=>[c.renderSlot(w.$slots,"toolbar-left")]),right:c.withCtx(()=>[c.renderSlot(w.$slots,"toolbar-right")]),_:3},16)):c.createCommentVNode("",!0),(x=c.unref(h))!=null&&x.isEditable&&n.showBubbleMenu?(c.openBlock(),c.createBlock(y2,c.normalizeProps(c.mergeProps({key:1},g.value)),null,16)):c.createCommentVNode("",!0),(C=c.unref(h))!=null&&C.isEditable&&n.showFloatingMenu?(c.openBlock(),c.createBlock(v2,c.normalizeProps(c.mergeProps({key:2},y.value)),null,16)):c.createCommentVNode("",!0),(S=c.unref(h))!=null&&S.isEditable&&n.sideMenu.show?(c.openBlock(),c.createBlock($2,c.normalizeProps(c.mergeProps({key:3},b.value)),null,16)):c.createCommentVNode("",!0),c.createVNode(c.unref(WB),{class:c.normalizeClass(["editor-content",`${n.pageView}-view`]),editor:c.unref(h)},null,8,["class","editor"])],8,uK)}}}),dK={installed:!1,spellcheck:!0,install(n){this.installed=!0,n.component("YiiEditor",xT)}};Object.defineProperty(exports,"BlockMath",{enumerable:!0,get:()=>Nl.BlockMath});Object.defineProperty(exports,"InlineMath",{enumerable:!0,get:()=>Nl.InlineMath});Object.defineProperty(exports,"Markdown",{enumerable:!0,get:()=>uw.Markdown});exports.AddNode=fC;exports.AdvancedBlocks=M1;exports.AiBlocks=N1;exports.AiProviders=E1;exports.AskAiBlocks=T1;exports.BackgroundColor=gg;exports.BasicBlocks=_s;exports.BlockMenus=gc;exports.Blocks=kd;exports.BrandColor=pe;exports.Collaboration=mS;exports.CollaborationCaret=gS;exports.ColonSuggestion=ZE;exports.Color=yg;exports.CommonBlocks=ws;exports.DefaultBubble=$1;exports.DefaultEmbedServices=iI;exports.DefaultExtensionNames=vT;exports.DefaultFloating=P1;exports.DefaultMenu=A1;exports.Details=BC;exports.DetailsContent=RC;exports.DetailsSummary=_C;exports.DragNode=pC;exports.EmojiSuggestion=n4;exports.Focus=o1;exports.FontFamily=bg;exports.Highlight=yS;exports.Image=bS;exports.ImageBubble=_1;exports.ImageLinkBubble=D1;exports.InlineMathBubble=B1;exports.Link=Lm;exports.LinkBubble=R1;exports.Mention=wj;exports.MoreBubble=I1;exports.OAiBlock=eM;exports.OAiMenu=vC;exports.OAlignDropdown=Qm;exports.OBlockList=Cd;exports.OBlockListItem=Jp;exports.OBlockMath=tM;exports.OBlockMenu=Fr;exports.OBlockPlaceholder=xd;exports.OBlockPopover=Eo;exports.OBlockToolbar=eg;exports.OBlockquote=nM;exports.OBtn=He;exports.OBtnGroup=hC;exports.OCallout=oM;exports.OCalloutColorBoard=tg;exports.OCalloutColorDropdown=AI;exports.OCharCommand=I5;exports.OCheckbox=dg;exports.OCodeBlock=sM;exports.OCodeBlockDownloadDropdown=U1;exports.OCodeBlockViewDropdown=W1;exports.OColonCommand=XE;exports.OColorBoard=ki;exports.OColorHighlighter=MS;exports.OCommandBtn=nt;exports.OCommonBtn=Jn;exports.OContextMenu=ya;exports.ODetails=lM;exports.ODialog=mC;exports.ODivider=Lt;exports.ODocToc=FI;exports.OEmojiSelect=Sd;exports.OFloatingToast=mP;exports.OFocus=e3;exports.OHeading=aM;exports.OHorizontalRule=cM;exports.OIcon=X;exports.OImage=uM;exports.OImageViewer=gC;exports.OInlineMathMenu=kC;exports.OInlinePlaceholder=TS;exports.OInput=Zn;exports.OLanguageDropdown=q1;exports.OLink=dM;exports.OLinkBtn=Zm;exports.OList=ln;exports.OListItem=Ut;exports.OMainMenu=wC;exports.OMediaInput=ng;exports.OMenubarBtn=Ae;exports.OMetaInput=Ed;exports.ONodeView=Mn;exports.OParagraph=fM;exports.OPlaceholder=z1;exports.OPopover=$e;exports.OSelectionDecoration=NS;exports.OShortcut=OS;exports.OSlashCommand=YE;exports.OSlashZhCommand=QE;exports.OStarterKit=cK;exports.OTable=$S;exports.OTableCell=pM;exports.OTableCellBackground=J1;exports.OTableGrid=K1;exports.OTableHeader=hM;exports.OTableWrapper=yT;exports.OTaskItem=GE;exports.OTextColorBoard=og;exports.OTextarea=yC;exports.OToast=ug;exports.OTooltip=zn;exports.OVideo=bT;exports.Prompts=Xm;exports.SlashSuggestion=Nh;exports.StyleBlocks=ks;exports.Subscript=kS;exports.Superscript=wS;exports.Table=_d;exports.TableBubble=L1;exports.TableCell=Bd;exports.TableFloating=rI;exports.TableHeader=Rd;exports.TableMenu=O1;exports.TableRow=$u;exports.TableWrapperBubble=oI;exports.TaskItem=Jx;exports.TaskList=Vm;exports.TextAlign=xS;exports.TextStyle=mg;exports.Typography=CS;exports.Underline=Yx;exports.UniqueID=ES;exports.YiiEditor=xT;exports.YiiEditorPlugin=dK;exports.createExtension=Zu;exports.createExtensionList=ry;exports.extensionRegistry=kT;exports.getProviderProp=Gm;exports.isExtensionInstance=wT;exports.useAi=Ym;exports.useCommon=wd;exports.useI18n=de;exports.useNodeView=V1;exports.useTheme=Bi;exports.useTiptap=ke;
|
|
69
309
|
//# sourceMappingURL=index.cjs.map
|