From f2d5c13dcc5be965fa06defef8af9bb9284db38b Mon Sep 17 00:00:00 2001 From: splincode Date: Wed, 2 Oct 2024 08:27:14 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20taiga-fa?= =?UTF-8?q?mily/editor@3d504a1e56f6ee509969386c35ff1894137891e9=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 6474.dca7fa6558df628e.js | 1 - 6474.fa109904ecbb38f0.js | 1 + anchors/index.html | 4 ++-- appearance/index.html | 4 ++-- checkbox/index.html | 4 ++-- custom-tool/color-picker/index.html | 4 ++-- custom-tool/paste-emoji/index.html | 4 ++-- custom-tool/paste-image/index.html | 4 ++-- embed/html5/index.html | 4 ++-- embed/iframe/index.html | 4 ++-- embed/pdf/index.html | 4 ++-- embed/youtube/index.html | 4 ++-- focus/index.html | 4 ++-- font/index.html | 4 ++-- groups/index.html | 4 ++-- highlight/code/index.html | 4 ++-- highlight/text/index.html | 4 ++-- images/preview/index.html | 4 ++-- images/resizable/index.html | 4 ++-- images/upload/index.html | 4 ++-- index.html | 4 ++-- index.original.html | 2 +- mention/index.html | 4 ++-- processing/cleanup-html/index.html | 4 ++-- processing/legacy-html/index.html | 4 ++-- processing/markdown-extension/index.html | 6 +++--- processing/markdown/index.html | 4 ++-- runtime.d8d6ec8f92780119.js => runtime.2fbc34c32cdc3a8a.js | 2 +- starter-kit/index.html | 4 ++-- toolbar/bottom/index.html | 4 ++-- toolbar/floating/index.html | 4 ++-- toolbar/shared/index.html | 4 ++-- upload-files/index.html | 4 ++-- 33 files changed, 62 insertions(+), 62 deletions(-) delete mode 100644 6474.dca7fa6558df628e.js create mode 100644 6474.fa109904ecbb38f0.js rename runtime.d8d6ec8f92780119.js => runtime.2fbc34c32cdc3a8a.js (99%) diff --git a/6474.dca7fa6558df628e.js b/6474.dca7fa6558df628e.js deleted file mode 100644 index 247fbd856..000000000 --- a/6474.dca7fa6558df628e.js +++ /dev/null @@ -1 +0,0 @@ -(self.webpackChunkeditor_demo=self.webpackChunkeditor_demo||[]).push([[6474],{6474:(t,e,n)=>{n.r(e),n.d(e,{AbstractTuiEditor:()=>y,AbstractTuiEditorResizable:()=>Jn,EDITOR_BLANK_COLOR:()=>i,INITIALIZATION_TIPTAP_CONTAINER:()=>F,LAZY_EDITOR_EXTENSIONS:()=>v,LAZY_TIPTAP_EDITOR:()=>j,TIPTAP_EDITOR:()=>H,TUI_ATTACH_FILES_LOADER:()=>E,TUI_ATTACH_FILES_OPTIONS:()=>O,TUI_DEFAULT_HTML5_MEDIA_ATTRIBUTES:()=>c,TUI_DEFAULT_LINK_OPTIONS:()=>m,TUI_EDITOR_CODE_OPTIONS:()=>$,TUI_EDITOR_COLOR_SELECTOR_MODE_NAMES:()=>I,TUI_EDITOR_DEFAULT_EDITOR_COLORS:()=>o,TUI_EDITOR_DEFAULT_EXTENSIONS:()=>Ks,TUI_EDITOR_DEFAULT_OPTIONS:()=>C,TUI_EDITOR_DEFAULT_TOOLS:()=>s,TUI_EDITOR_EXTENSIONS:()=>k,TUI_EDITOR_FONT_OPTIONS:()=>L,TUI_EDITOR_GROUP_DEFAULT_OPTIONS:()=>Js,TUI_EDITOR_LINK_HASH_PREFIX:()=>d,TUI_EDITOR_LINK_HTTPS_PREFIX:()=>h,TUI_EDITOR_LINK_HTTP_PREFIX:()=>u,TUI_EDITOR_LINK_OSI_PROTOCOL_DIVIDER:()=>f,TUI_EDITOR_LINK_SIMPLE_PROTOCOL_DIVIDER:()=>p,TUI_EDITOR_LINK_TEXTS:()=>R,TUI_EDITOR_OPTIONS:()=>x,TUI_EDITOR_PROVIDERS:()=>Tn,TUI_EDITOR_RESIZE_EVENT:()=>a,TUI_EDITOR_SANITIZER:()=>M,TUI_EDITOR_TABLE_COMMANDS:()=>D,TUI_EDITOR_TOOLBAR_TEXTS:()=>N,TUI_EDITOR_VALUE_TRANSFORMER:()=>T,TUI_IFRAME_EDITOR_OPTIONS:()=>Qs,TUI_IMAGE_EDITOR_OPTIONS:()=>oa,TUI_IMAGE_LOADER:()=>B,TableCellBackground:()=>Us,TuiAlignContent:()=>Gt,TuiAudio:()=>Ml,TuiBackgroundColor:()=>io,TuiCode:()=>Ut,TuiComponentRenderer:()=>Xn,TuiCustomEnter:()=>cr,TuiDetails:()=>Kt,TuiDetailsContent:()=>lo,TuiDetailsExtension:()=>ao,TuiDetailsRemove:()=>Yt,TuiEditLink:()=>xt,TuiEditor:()=>Vn,TuiEditorDropdownToolbar:()=>Nt,TuiEditorGroupTool:()=>ce,TuiEditorImagePreview:()=>q,TuiEditorMarkdownParser:()=>ml,TuiEditorPortal:()=>On,TuiEditorPortalHost:()=>En,TuiEditorPortalService:()=>Mn,TuiEditorResizable:()=>oo,TuiEditorSocket:()=>zt,TuiEditorTool:()=>r,TuiFileLink:()=>uo,TuiFilterAnchorsPipe:()=>ct,TuiFontColor:()=>ho,TuiFontSize:()=>te,TuiFontSizeExtension:()=>po,TuiFontStyle:()=>le,TuiHighlightColor:()=>pe,TuiHorizontalRule:()=>dr,TuiIframeEditor:()=>ta,TuiImageEditor:()=>ua,TuiImageOptionsPosition:()=>ia,TuiJumpAnchor:()=>go,TuiLink:()=>lr,TuiListConfigs:()=>be,TuiMarkdown:()=>xl,TuiMarkdownClipboard:()=>Ca,TuiMarkdownSerializer:()=>wl,TuiMarkdownSerializerState:()=>vl,TuiMarkdownTightLists:()=>Cl,TuiMention:()=>El,TuiNodeView:()=>Kn,TuiNodeViewNg:()=>Un,TuiShortUrlPipe:()=>dt,TuiSource:()=>Tl,TuiStarterKit:()=>Dr,TuiSummary:()=>co,TuiTabExtension:()=>mo,TuiTable:()=>Ws,TuiTableCell:()=>Xs,TuiTableCellColor:()=>ve,TuiTableCommands:()=>Re,TuiTableCreate:()=>Ee,TuiTableMergeCells:()=>Ae,TuiTableRowColumnManager:()=>$e,TuiTextColor:()=>ze,TuiTiptapEditor:()=>at,TuiTiptapEditorService:()=>st,TuiToolbar:()=>bn,TuiToolbarNavigationManager:()=>Be,TuiVideo:()=>Ol,TuiYoutube:()=>Rl,setup:()=>ba,tuiChildNodes:()=>Za,tuiCreateGroupExtension:()=>Ys,tuiCreateIframeEditorExtension:()=>ea,tuiCreateImageEditorExtension:()=>ga,tuiDefaultFontOptionsHandler:()=>l,tuiDeleteNode:()=>so,tuiEditLinkParseUrl:()=>pt,tuiEditorOptionsProvider:()=>S,tuiElementFromString:()=>ya,tuiEscapeHTML:()=>wa,tuiExtractElement:()=>ka,tuiGetMarkRange:()=>et,tuiGetMarkdownSpec:()=>fl,tuiGetNestedNodes:()=>Sl,tuiGetSelectedContent:()=>ro,tuiGetSelectionState:()=>yn,tuiIsEmptyParagraph:()=>rt,tuiIsOrderedOrBulletList:()=>fo,tuiIsSafeLinkRange:()=>kn,tuiIsSelectionIn:()=>$l,tuiLegacyEditorConverter:()=>Bl,tuiMarkdownItTaskList:()=>sl,tuiParseNodeAttributes:()=>bo,tuiParseStyle:()=>Z,tuiShiftDelim:()=>kl,tuiToGradient:()=>Hl,tuiTrimInline:()=>yl,tuiUnwrapElement:()=>va});const o=new Map([["color-black-100","#909090"],["color-black-200","#666666"],["color-black-300","#333333"],["color-blue-100","#1771e6"],["color-blue-200","#1464cc"],["color-blue-300","#0953b3"],["color-gray-100","#f5f5f6"],["color-gray-200","#e7e8ea"],["color-gray-300","#cbcfd3"],["color-gray-400","#959ba4"],["color-gray-500","#79818c"],["color-gray-600","#616871"],["color-green-100","#39b54a"],["color-green-200","#2ca53a"],["color-green-300","#168a21"],["color-light-blue-100","#ecf1f7"],["color-light-blue-200","#e4ebf3"],["color-light-blue-300","#dde4ed"],["color-red-100","#e01f19"],["color-red-200","#d3120e"],["color-red-300","#c40b08"],["color-yellow-100","#FFDD2C"],["color-yellow-200","#FCC521"],["color-yellow-300","#FAB618"],["transparent","transparent"]]),i="rgb(51, 51, 51)",r={Align:"justify",Anchor:"anchor",Attach:"attach",Bold:"bold",Clear:"clear",Code:"code",Color:"foreColor",Details:"details",Group:"group",HR:"insertHorizontalRule",Hilite:"hiliteColor",Img:"image",Italic:"italic",Link:"link",List:"list",MergeCells:"mergeCells",Quote:"quote",RowsColumnsManaging:"rowsColumnsManaging",Size:"fontSize",SplitCells:"splitCells",Strikethrough:"strikeThrough",Sub:"subscript",Sup:"superscript",Table:"insertTable",CellColor:"cellColor",Tex:"tex",Underline:"underline",Undo:"undo"},s=new Set([r.Align,r.Anchor,r.Bold,r.CellColor,r.Clear,r.Code,r.Color,r.Details,r.Hilite,r.HR,r.Img,r.Italic,r.Link,r.List,r.Quote,r.Size,r.Strikethrough,r.Sub,r.Sup,r.Table,r.Underline,r.Undo]),a="tui_editor_resize";function l(t){return[{px:13,name:t.small},{px:15,name:t.normal},{px:17,name:t.large},{px:24,family:"var(--tui-font-heading)",name:t.subtitle,headingLevel:2,weight:"bold"},{px:30,family:"var(--tui-font-heading)",name:t.title,headingLevel:1,weight:"bold"}]}const c=["id","class","src","style","controls","loop","muted","preload","autoplay","width","height","controlsList"],d="#",u="http://",h="https://",p=":",f="://",m={protocol:h};var g=n(6104),b=n(2978);let y=(()=>{var t;class e{constructor(){this.stateChange$=new g.B,this.valueChange$=new g.B}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵdir=b.FsC({type:t}),e})();const k=new b.nKC("[TUI_EDITOR_EXTENSIONS]"),v=new b.nKC("[LAZY_EDITOR_EXTENSIONS]");var w=n(4314);const C={translate:"no",spellcheck:!1,exampleText:"",enableDefaultStyles:!0,tools:s,colors:o,blankColor:i,linkOptions:m,fontOptions:l,floatingToolbar:!1,icons:{undo:"@tui.undo",redo:"@tui.redo",quote:"@tui.quote",link:"@tui.link",anchor:"@tui.anchor",attach:"@tui.paperclip",sub:"@tui.subscript",sup:"@tui.superscript",tex:"@tui.whole-word",image:"@tui.image",hr:"@tui.minus",clear:"@tui.remove-formatting",groupAdd:"@tui.plus",groupRemove:"@tui.circle-minus",detailsAdd:"@tui.copy-plus",detailsRemove:"@tui.square-minus",popupLinkSave:"@tui.save",popupLinkRemove:"@tui.x",popupPreviewLinkEdit:"@tui.pencil",popupPreviewLinkClear:"@tui.x",paint:"@tui.paint-bucket",hash:"@tui.hash",externalLink:"@tui.external-link",textAlignPreview:"@tui.align-left",textAlignLeft:"@tui.align-left",textAlignCenter:"@tui.align-center",textAlignRight:"@tui.align-right",textAlignJustify:"@tui.align-justify",textColor:"@tui.baseline",textHilite:"@tui.paint-roller",listPreview:"@tui.list",listUnOrdered:"@tui.list",listOrdered:"@tui.list-ordered",taskList:"@tui.check-check",indent:"@tui.indent-increase",outdent:"@tui.indent-decrease",fontSize:"@tui.a-large-small",insertTable:"@tui.table",tableCellMerge:"@tui.table-cells-merge",tableCellSplit:"@tui.table-rows-split",addRowTable:"@tui.between-horizontal-start",code:"@tui.code",fontStylePreview:"@tui.type-outline",fontStyleBold:"@tui.bold",fontStyleItalic:"@tui.italic",fontStyleUnderline:"@tui.underline",fontStyleStrike:"@tui.strikethrough",colorSelectorDropdownChevron:"@tui.chevron-down",colorSelectorDropdownCheck:"@tui.check",imageExtension:{settings:"@tui.settings",alignJustify:"@tui.align-justify",alignCenter:"@tui.align-center",alignLeft:"@tui.align-left",alignRight:"@tui.align-right"}}},x=(0,w.gc)(C);function S(t){return(0,w.eC)(x,t,C)}const M=(0,w.ET)((()=>null)),T=new b.nKC("[TUI_EDITOR_VALUE_TRANSFORMER]"),O=new b.nKC("[TUI_ATTACH_FILES_OPTIONS]",{factory:()=>({accept:"*/*",multiple:!0})}),E=new b.nKC("[TUI_ATTACH_FILES_LOADER]");var A=n(5478);const I=new b.nKC("[TUI_EDITOR_COLOR_SELECTOR_MODE_NAMES]",{factory:()=>["Solid color","Gradient"]}),N=new b.nKC("[TUI_EDITOR_TOOLBAR_TEXTS]",{factory:(0,A.Y6)("toolbarTools")}),D=new b.nKC("[TUI_EDITOR_TABLE_COMMANDS]",{factory:(0,A.Y6)("editorTableCommands")}),R=new b.nKC("[TUI_EDITOR_LINK_TEXTS]",{factory:(0,A.Y6)("editorEditLink")}),$=new b.nKC("[TUI_EDITOR_CODE_OPTIONS]",{factory:(0,A.Y6)("editorCodeOptions")}),L=new b.nKC("[TUI_EDITOR_FONT_OPTIONS]",{factory:(0,A.Y6)("editorFontOptions")});var z=n(8481),P=n(3527);const B=new b.nKC("[TUI_IMAGE_LOADER]",{factory:()=>t=>{const e=new FileReader;return e.readAsDataURL(t),(0,z.xM)(e,"load").pipe((0,P.T)((()=>String(e.result))))}});var _=n(9090);const H=new b.nKC("[TIPTAP_EDITOR]"),j=new b.nKC("[LAZY_TIPTAP_EDITOR]",{factory:()=>{const t=new _.m(1);return Promise.resolve().then(n.bind(n,6426)).then((({Editor:e})=>t.next(e))).catch((()=>t.complete())),t}}),F=new b.nKC("[INITIALIZATION_TIPTAP_CONTAINER]");var G=n(6610),V=n(7222),W=n(3241),X=n(4822),U=n(715),K=n(4135),J=n(7355),Y=n(599);let q=(()=>{var t;class e{constructor(){this.imagePreview=new b.bkB}click(t){t instanceof HTMLImageElement&&this.imagePreview.emit(t)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵdir=b.FsC({type:t,selectors:[["tui-editor-socket","imagePreview",""]],hostAttrs:[1,"_preview-image"],hostBindings:function(t,e){1&t&&b.bIt("click",(function(t){return e.click(t.target)}))},outputs:{imagePreview:"imagePreview"},standalone:!0}),e})();var Q=n(7212);function Z(t){return t.split(";").reduce(((t,e)=>{const[n,o]=e.split(":")??[];return n&&o&&(t[n.trim()]=o.trim()),t}),{})}function tt(t,e,n={}){return t.find((({attrs:t,type:o})=>o===e&&function(t,e){const n=Object.keys(e);return!n.length||!!n.filter((n=>e[n]===t[n])).length}(t,n)))||null}function et(t,e,n={}){if(!t||!e)return null;const{node:o,offset:i}=t.parent.childAfter(t.parentOffset);if(!o)return null;const r=tt(o.marks,e,n);if(!r)return null;let s=t.index(),a=t.start()+i,l=s+1,c=a+o.nodeSize;for(tt(o.marks,e,n);s>0&&r.isInSet(t.parent.child(s-1).marks);)s-=1,a-=t.parent.child(s).nodeSize;for(;l{var t;class e extends y{constructor(){super(),this.editorRef=(0,b.WQX)(H),this.editorRef.subscribe((t=>{if(!t)return;this.editor=t;const e=()=>{const e=t.getHTML(),n=rt(t.getJSON().content)?"":e;this.valueChange$.next(n),this.stateChange$.next()};t.on("transaction",e.bind(this)),t.on("update",e.bind(this))}))}get isFocused(){return this.editor?.isFocused??!1}get html(){return this.editor?.getHTML()??""}get editable(){return this.editor?.isEditable??!1}set editable(t){this.editor?.setEditable(t,!1)}get state(){return this.editor?.state??null}getOriginTiptapEditor(){return this.editor??null}undoDisabled(){return!this.editor?.can().undo()}redoDisabled(){return!this.editor?.can().redo()}getFontColor(){return this.editor?.getAttributes("textStyle").fontColor||i}getFontSize(){return parseInt(this.editor?.getAttributes("textStyle").fontSize,10)}setFontSize(t){this.editor?.chain().setMark("textStyle",{fontSize:(0,w.Pp)(t)}).run()}getBackgroundColor(){return this.editor?.getAttributes("textStyle").backgroundColor||"transparent"}getCellColor(){return this.editor?.getAttributes("tableCell").background||this.editor?.getAttributes("tableHeader").background||""}getGroupColor(){if(this.editor?.isActive("group")){const t=Z(this.editor.getAttributes("group")?.style??"");return t["background-color"]??t.background??""}return""}onAlign(t){this.editor?.chain().focus().setTextAlign(t).run()}setImage(t){this.editor?.chain().focus().command((({commands:e,state:n})=>{const o=e.setEditableImage??e.setImage;if(o){const i=n.selection.anchor;return o({src:t}),e.setTextSelection(i),!0}return!1})).run()}undo(){this.editor?.chain().undo().run()}redo(){this.editor?.chain().redo().run()}setHorizontalRule(){this.editor?.chain().focus().setHorizontalRule().run()}removeFormat(){this.editor?.commands.unsetAllMarks(),this.editor?.commands.clearNodes()}setFontColor(t){this.editor?.chain().focus().setFontColor(t).run()}setBackgroundColor(t){this.editor?.chain().focus().setBackgroundColor(t).run()}toggleUnderline(){this.editor?.chain().focus().toggleUnderline().run()}toggleStrike(){this.editor?.chain().focus().toggleStrike().run()}toggleOrderedList(){this.editor?.chain().focus().toggleOrderedList().run()}toggleUnorderedList(){this.editor?.chain().focus().toggleBulletList().run()}togglePre(){this.editor?.chain().focus().toggleCodeBlock().run()}toggleTaskList(){this.editor?.commands.toggleTaskList()}sinkListItem(){const t=this.editor?.isActive("taskList")?"taskItem":"listItem";this.editor?.chain().focus().sinkListItem(t).run()}liftListItem(){const t=this.editor?.isActive("taskList")?"taskItem":"listItem";this.editor?.chain().focus().liftListItem(t).run()}isActive(t){return this.editor?.isActive(t)??!1}isActive$(t){return this.stateChange$.pipe((0,ot.Z)(null),(0,P.T)((()=>this.isActive(t))),(0,it.F)())}toggleBold(){this.editor?.chain().focus().toggleBold().run()}toggleCode(){this.editor?.chain().focus().toggleCode().run()}toggleItalic(){this.editor?.chain().focus().toggleItalic().run()}toggleBlockquote(){this.editor?.chain().focus().toggleBlockquote().run()}toggleSubscript(){this.editor?.chain().focus().toggleSubscript().run()}toggleSuperscript(){this.editor?.chain().focus().toggleSuperscript().run()}toggleCodeBlock(){this.editor?.chain().focus().toggleCodeBlock().run()}insertTable(t,e){this.editor?.chain().focus().insertTable({cols:t,rows:e}).run()}addColumnAfter(){this.editor?.chain().focus().addColumnAfter().run()}addColumnBefore(){this.editor?.chain().focus().addColumnBefore().run()}addRowAfter(){this.editor?.chain().focus().addRowAfter().run()}addRowBefore(){this.editor?.chain().focus().addRowBefore().run()}deleteColumn(){this.editor?.chain().focus().deleteColumn().run()}deleteRow(){this.editor?.chain().focus().deleteRow().run()}mergeCells(){this.editor?.chain().focus().mergeCells().run()}splitCell(){this.editor?.chain().focus().splitCell().run()}canMergeCells(){return this.editor?.can().mergeCells()??!1}canSplitCells(){return this.editor?.can().splitCell()??!1}setHeading(t){this.editor?.chain().focus().setHeading({level:t}).run()}setParagraph(t){this.editor?.chain().focus().setParagraph().run(),t&&this.editor?.chain().setMark("textStyle",t).run()}setHardBreak(){this.editor?.chain().setHardBreak().run()}setTextSelection(t){this.editor?.commands.setTextSelection(t)}toggleLink(t){this.editor?.chain().focus().toggleLink({href:t}).run()}setLink(t){this.editor?.chain().focus().setLink({href:t}).run()}unsetLink(){this.editor?.chain().focus().unsetLink().run()}focus(){this.editor?.chain().focus().run()}setValue(t){t===this.html||""===t&&"

"===this.html||(this.editor?.commands.setContent(t),this.editor?.view.updateState(nt.$t.create({schema:this.editor.state.schema,doc:this.editor.state.doc,selection:this.editor.state.selection,storedMarks:this.editor.state.storedMarks,plugins:this.editor.state.plugins})))}destroy(){this.editor?.destroy()}setCellColor(t){this.editor?.chain().focus().setCellBackground(t).run()}selectClosest(){const t=this.editor?.state.selection.anchor,e=et(this.editor?.state.doc.resolve(t??0),this.editor?.schema.marks.link);e&&this.editor?.chain().setTextSelection(e).run()}enter(){this.editor?.commands.enter()}setDetails(){this.editor?.commands.setDetails()}removeDetails(){this.editor?.commands.removeDetails()}setGroup(){this.editor?.commands.setGroup()}removeGroup(){this.editor?.commands.removeGroup()}setGroupHilite(t){this.editor?.commands.setGroupHilite(t)}setAnchor(t){this.editor?.commands.setAnchor(t.replace("#",""))}removeAnchor(){this.editor?.commands.removeAnchor()}setFileLink(t){this.editor?.commands.setFileLink(t)}setYoutubeVideo(t){this.editor?.commands.setYoutubeVideo(t)}setIframe(t){this.editor?.commands.setIframe(t)}removeEmptyTextStyle(){this.editor?.commands.removeEmptyTextStyle()}toggleMark(t,e,n){this.editor?.commands.toggleMark(t,e,n)}getHTML(){return this.getOriginTiptapEditor()?.getHTML()??""}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵprov=b.jDH({token:t,factory:t.ɵfac}),e})(),at=(()=>{var t;class e{constructor(){this.el=(0,b.WQX)(b.aKT),this.renderer=(0,b.WQX)(b.sFG),this.editor=(0,b.WQX)(st),this.editorContainer=(0,b.WQX)(F),this.valueChange=this.editor.valueChange$,this.stateChange=this.editor.stateChange$,(0,b.WQX)(H).pipe((0,Q.pQ)()).subscribe((()=>this.renderer.appendChild(this.el.nativeElement,this.editorContainer)))}set value(t){this.editor.setValue(t)}set editable(t){this.editor.editable=t}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵdir=b.FsC({type:t,selectors:[["","tuiTiptapEditor",""]],inputs:{value:"value",editable:"editable"},outputs:{valueChange:"valueChange",stateChange:"stateChange"},standalone:!0}),e})();var lt=n(5993);let ct=(()=>{var t;class e{transform(t,e,n){return"#"===e?t.filter((t=>t!==n)):t}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵpipe=b.EJ8({name:"tuiFilterAnchors",type:t,pure:!0,standalone:!0}),e})(),dt=(()=>{var t;class e{transform(t){return t.length<60?t:`${t.slice(0,Math.max(0,40))}...${t.slice(t.length-10)}`}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵpipe=b.EJ8({name:"tuiShortUrl",type:t,pure:!0,standalone:!0}),e})();function ut(t=""){const e=t.indexOf(f)??-1,[n,o]=e>-1?[t.slice(0,e+f.length),t.slice(e+f.length,t.length)]:["",t],i=[n,o].filter(Boolean);return o?.includes("://")&&i.length>1?ut(o):i}function ht(t=""){const[e,n]=t.split(/:/).slice(-2).filter(Boolean);return t.includes("/")&&t.lastIndexOf(":")>t.indexOf("/")||t.includes("?")&&t.lastIndexOf(":")>t.indexOf("?")||!e||!n||(0,w.U_)(t)?[]:[`${e}:`,n]}function pt(t=""){if(t.startsWith(d))return{prefix:d,path:t.slice(1)};const[e="",n=""]=t.includes(f)?ut(t):ht(t);if(n.includes(p)){const[t,e]=ht(n);if(t&&e)return{prefix:t,path:e}}return t.startsWith("/")&&!t.startsWith("//")?{prefix:t.slice(0,1),path:t.slice(1)}:t.startsWith("./")?{prefix:t.slice(0,2),path:t.slice(2)}:{prefix:e,path:""===e?t:n}}function ft(t,e){1&t&&(b.qex(0),b.EFF(1,"Edit anchor"),b.bVm())}function mt(t,e){1&t&&(b.j41(0,"span"),b.EFF(1,"Link to anchor"),b.k0s())}function gt(t,e){1&t&&(b.j41(0,"span"),b.EFF(1,"URL"),b.k0s())}function bt(t,e){if(1&t&&(b.DNE(0,mt,2,0,"span",1),b.DNE(1,gt,2,0,"ng-template",null,12,b.C5r)),2&t){const t=b.sdS(2),e=b.XpG(2);b.Y8G("ngIf",e.prefixIsHashMode)("ngIfElse",t)}}function yt(t,e){if(1&t&&(b.qex(0),b.EFF(1),b.bVm()),2&t){const t=e.ngIf,n=b.XpG(2);b.R7$(1),b.SpI(" ",n.prefixIsHashMode?t.anchorExample:t.urlExample," ")}}function kt(t,e){if(1&t){const t=b.RV6();b.qex(0),b.j41(1,"label",4)(2,"div",5),b.DNE(3,ft,2,0,"ng-container",1),b.DNE(4,bt,3,2,"ng-template",null,6,b.C5r),b.k0s(),b.j41(6,"div",7)(7,"div",8),b.EFF(8),b.k0s(),b.j41(9,"tui-input-inline",9),b.bIt("input",(function(e){b.eBV(t);const n=b.XpG();let o;return b.Njj(n.onChange(null==(o=e.target)?null:o.value))}))("keydown.backspace",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onBackspace())}))("keydown.prevent.enter",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onSave())})),b.DNE(10,yt,2,1,"ng-container",3),b.nI1(11,"async"),b.j41(12,"input",10),b.bIt("ngModelChange",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(n.url=e)})),b.k0s()()()(),b.j41(13,"button",11),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onClear())})),b.k0s(),b.j41(14,"button",11),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onSave())})),b.k0s(),b.bVm()}if(2&t){const t=b.sdS(5),e=b.XpG();b.R7$(3),b.Y8G("ngIf",e.anchorMode)("ngIfElse",t),b.R7$(5),b.JRh(e.prefix),b.R7$(1),b.AVh("t-input_filled",e.hasUrl),b.R7$(1),b.Y8G("ngIf",b.bMT(11,9,e.texts$)),b.R7$(2),b.Y8G("ngModel",e.url),b.R7$(1),b.Y8G("iconStart",e.options.icons.popupLinkRemove),b.R7$(1),b.Y8G("iconStart",e.options.icons.popupLinkSave)}}function vt(t,e){if(1&t){const t=b.RV6();b.j41(0,"a",13),b.EFF(1),b.nI1(2,"tuiShortUrl"),b.k0s(),b.j41(3,"button",14),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onEdit())})),b.k0s(),b.j41(4,"button",15),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onRemove())})),b.k0s()}if(2&t){const t=b.XpG();b.Y8G("href",t.href,b.B4B)("iconStart",t.prefixIsHashMode?t.options.icons.hash:t.options.icons.externalLink),b.R7$(1),b.SpI(" ",b.bMT(2,5,t.url)," "),b.R7$(2),b.Y8G("iconStart",t.options.icons.popupPreviewLinkEdit),b.R7$(1),b.Y8G("iconStart",t.options.icons.popupPreviewLinkClear)}}function wt(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",19),b.bIt("click",(function(){const e=b.eBV(t).$implicit,n=b.XpG(2);return b.Njj(n.setAnchor(e))})),b.EFF(1),b.k0s()}if(2&t){const t=e.$implicit;b.R7$(1),b.SpI(" #",t," ")}}function Ct(t,e){if(1&t&&(b.qex(0),b.nrm(1,"hr",16),b.j41(2,"tui-scrollbar")(3,"div",17),b.DNE(4,wt,2,1,"button",18),b.nI1(5,"tuiFilterAnchors"),b.k0s()(),b.bVm()),2&t){const t=b.XpG();b.R7$(4),b.Y8G("ngForOf",b.brH(5,1,t.anchorIds,t.prefix,t.url))}}let xt=(()=>{var t;class e{constructor(){this.doc=(0,b.WQX)(W.Qc)?.document??null,this.isOnlyAnchorMode=this.detectAnchorMode(),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.options=(0,b.WQX)(x),this.url=this.getHrefOrAnchorId(),this.edit=!this.url,this.prefix=this.makeDefaultPrefix(),this.anchorIds=this.getAllAnchorsIds(),this.texts$=(0,b.WQX)(R),this.inputEditor=null,this.addLink=new b.bkB,this.removeLink=new b.bkB}set anchorMode(t){this.isOnlyAnchorMode=t,this.prefix=t?d:this.makeDefaultPrefix()}get anchorMode(){return this.isOnlyAnchorMode}get editor(){return this.injectionEditor??this.inputEditor}get defaultProtocol(){return this.options.linkOptions?.protocol??h}get prefixIsHashMode(){return this.prefix===d}get hasUrl(){return!!this.url}get href(){return`${this.prefix}${this.url}`}get showAnchorsList(){return!this.anchorMode&&this.edit&&this.anchorIds.length>0}onSelectionChange(){this.isViewMode&&(this.url=this.getHrefOrAnchorId(),this.anchorMode=this.detectAnchorMode())}onMouseDown(t){(0,X.ru)(t.target)&&!t.target.matches("a, button, input")&&t.preventDefault()}setAnchor(t){this.url=t,this.changePrefix(!0)}changePrefix(t){this.prefix=t?d:this.defaultProtocol}onSave(){this.url?this.addLink.emit(this.href):this.removeLink.emit()}onBackspace(){this.url||(this.prefix=this.isOnlyAnchorMode?d:this.defaultProtocol)}onEdit(){this.edit=!0}onRemove(){this.removeLink.emit()}onChange(t){this.url=this.removePrefix(t)}onClear(){this.url=""}get isViewMode(){return!this.edit}makeDefaultPrefix(){const t=this.getAnchorElement(),e=pt(t?.getAttribute("href")??"").prefix||this.defaultProtocol;return t&&(!t.getAttribute("href")&&t.getAttribute("id")||t.getAttribute("href")?.startsWith(d))?d:e}detectAnchorMode(){const t=this.getAnchorElement();return!t?.href&&!!t?.getAttribute("id")}getFocusedParentElement(){return this.doc?.getSelection?.()?.focusNode?.parentElement||null}getAnchorElement(){const t=this.getFocusedParentElement();return t?.closest("a")??t?.querySelector("img")?.closest("a")??null}getHrefOrAnchorId(){const t=this.getAnchorElement();return t?this.removePrefix(t.getAttribute("href")??t.getAttribute("id")??""):this.url}removePrefix(t){const e=t.startsWith(d)||this.prefix===d||t.startsWith("/")||t.startsWith("./")||t.startsWith("http")||t.startsWith("://")?t:`${this.prefix??""}${t}`,{prefix:n,path:o}=pt(e),i=this.isOnlyAnchorMode||n===d||""===n&&this.prefix===d;return this.prefix=i?d:""===n?this.defaultProtocol:n,o}getAllAnchorsIds(){const t=Array.from(this.editor?.getOriginTiptapEditor()?.view.dom.querySelectorAll('[data-type="jump-anchor"]')??[]);return Array.from(t).map((t=>t.getAttribute("id")??"")).filter(Boolean)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-edit-link"]],hostBindings:function(t,e){1&t&&b.bIt("selectionchange",(function(){return e.onSelectionChange()}),!1,b.EBC)("mousedown",(function(t){return e.onMouseDown(t)}))},inputs:{inputEditor:["editor","inputEditor"],anchorMode:"anchorMode"},outputs:{addLink:"addLink",removeLink:"removeLink"},standalone:!0,features:[b.aNF],decls:5,vars:3,consts:[[1,"t-edit-link"],[4,"ngIf","ngIfElse"],["view",""],[4,"ngIf"],[1,"t-label"],[1,"t-label-properties"],["fullOptions",""],[1,"t-url"],[1,"t-prefix"],["tuiAutoFocus","",1,"t-input",3,"input","keydown.backspace","keydown.prevent.enter"],[3,"ngModel","ngModelChange"],["appearance","icon","size","s","title","Insert link","tuiIconButton","","type","button",1,"t-button",3,"iconStart","click"],["urlTitle",""],["target","_blank","tuiLink","",1,"t-link",3,"href","iconStart"],["appearance","icon","size","s","title","Change link","tuiIconButton","","type","button",1,"t-button","t-edit-button",3,"iconStart","click"],["appearance","icon","automation-id","toolbar__popup-link-clear-button","size","s","title","Remove link","tuiIconButton","","type","button",1,"t-button",3,"iconStart","click"],[1,"t-hr"],[1,"t-anchor-list"],["type","button","class","t-anchor",3,"click",4,"ngFor","ngForOf"],["type","button",1,"t-anchor",3,"click"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0),b.DNE(1,kt,15,11,"ng-container",1),b.DNE(2,vt,5,7,"ng-template",null,2,b.C5r),b.k0s(),b.DNE(4,Ct,6,5,"ng-container",3)),2&t){const t=b.sdS(3);b.R7$(1),b.Y8G("ngIf",e.edit)("ngIfElse",t),b.R7$(3),b.Y8G("ngIf",e.showAnchorsList)}},dependencies:[G.Jj,V.YN,V.me,V.BC,V.vS,G.Sq,G.bT,U.s8,K.p,ct,lt.A,J.Jc,Y.N0,dt],styles:["[_nghost-%COMP%]{display:block;min-inline-size:18.75rem}.t-edit-link[_ngcontent-%COMP%]{display:flex;min-block-size:4rem;align-items:center;padding-right:.75rem}.t-label[_ngcontent-%COMP%]{font:var(--tui-font-text-s);block-size:var(--tui-height-l);box-sizing:border-box;padding:.4375rem 1rem;min-inline-size:12.5rem;max-inline-size:25rem;inline-size:100%}.t-label-properties[_ngcontent-%COMP%]{display:flex;align-items:center;max-inline-size:8.375rem;justify-content:space-between}.t-property_inactive[_ngcontent-%COMP%]{opacity:.5}.t-url[_ngcontent-%COMP%]{display:flex;font:var(--tui-font-text-m);color:var(--tui-text-secondary)}.t-input[_ngcontent-%COMP%]{flex:1}.t-input_filled[_ngcontent-%COMP%]{color:var(--tui-text-primary)}.t-button[_ngcontent-%COMP%]{inline-size:2rem;block-size:2rem;margin:0 .25rem;transition:background .2s}.t-edit-button[_ngcontent-%COMP%]{margin-left:auto}.t-link[_ngcontent-%COMP%]{margin:0 1rem;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.t-cleaner[_ngcontent-%COMP%]{transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;color:var(--tui-text-secondary);cursor:pointer;margin-left:auto}.t-cleaner[_ngcontent-%COMP%]:hover{color:var(--tui-background-accent-opposite-pressed)}.t-cleaner_hidden[_ngcontent-%COMP%]{visibility:hidden}.t-anchor-list[_ngcontent-%COMP%]{display:flex;max-block-size:12.5rem;flex-direction:column}.t-anchor[_ngcontent-%COMP%]{-webkit-appearance:none;appearance:none;border:0;background:none;font-size:inherit;line-height:inherit;text-decoration:none;min-block-size:2.75rem;padding:.375rem .5rem;margin:.125rem .5rem;border-radius:var(--tui-radius-m);text-align:start}.t-anchor[_ngcontent-%COMP%]:hover{background:var(--tui-background-base-alt);cursor:pointer}"],changeDetection:0}),e})();var St=n(811),Mt=n(9141),Tt=n(4514),Ot=n(656),Et=n(4914),At=n(5981),It=n(199);let Nt=(()=>{var t;class e extends Tt.Xu{constructor(){super((t=>this.stream$.subscribe(t))),this.previousTagPosition=null,this.range=(0,b.WQX)(St.lN),this.doc=(0,b.WQX)(W.Qc)?.document??null,this.selection$=(0,b.WQX)(Ot.xA),this.el=(0,b.WQX)(b.aKT),this.vcr=(0,b.WQX)(b.c1b),this.handler$=new At.t(Mt.z9),this.stream$=(0,It.z)([this.handler$,this.selection$.pipe((0,P.T)((()=>this.getRange())),(0,it.F)(((t,e)=>t.startOffset===e.startOffset&&t.endOffset===e.endOffset)))]).pipe((0,P.T)((([t,e])=>{const n=this.el.nativeElement.contains(e.commonAncestorContainer)||e.commonAncestorContainer.parentElement?.closest("tui-dropdown");return this.range=n&&(0,X.ww)(e.commonAncestorContainer)||"P"===e.commonAncestorContainer?.nodeName?e:this.range,n&&t(this.range)}))),this.position="selection",this.type="dropdown"}set tuiToolbarDropdown(t){(0,w.YB)(t)||this.handler$.next(t)}getClientRect(){switch(this.position){case"tag":{const{commonAncestorContainer:t}=this.range,e=(0,X.ru)(t)?t:t.parentNode;return e?.parentElement?.closest("tui-dropdown")?this.previousTagPosition??Mt.Lo:(this.previousTagPosition=e&&(0,X.ru)(e)?this.doc?.querySelector(".ProseMirror-selectednode")?.getBoundingClientRect()||e.getBoundingClientRect():Mt.Lo,this.previousTagPosition)}case"word":return(0,Et.kJ)(this.range).getBoundingClientRect();default:{const t=this.range.getBoundingClientRect();return 0===t.x&&0===t.y&&0===t.width&&0===t.height?(this.el.nativeElement.querySelector("p")??this.el.nativeElement).getBoundingClientRect():t}}}ngOnDestroy(){this.ghost&&this.vcr.element.nativeElement.removeChild(this.ghost)}getRange(){const t=this.doc?.getSelection();return(t?.rangeCount&&t.getRangeAt(0)||this.range)?.cloneRange()}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵdir=b.FsC({type:t,selectors:[["","tuiToolbarDropdown",""]],inputs:{position:["tuiToolbarDropdownPosition","position"],tuiToolbarDropdown:"tuiToolbarDropdown"},standalone:!0,features:[b.Jv_([(0,Tt.Np)(t),(0,Tt.yq)(t)]),b.Vt3]}),e})();var Dt=n(4926),Rt=n(8395),$t=n(5950),Lt=n(6098);let zt=(()=>{var t;class e{constructor(){this.editor=(0,b.WQX)(at,{optional:!0}),this.customSanitizer=(0,b.WQX)(M,{optional:!0}),this.sanitizer=(0,b.WQX)(Lt.up),this.document=(0,b.WQX)(G.qQ),this.options=(0,b.WQX)(x),this.html=(0,b.vPA)(null)}set content(t){if(!t)return;const e=this.customSanitizer?.sanitize(b.WPN.HTML,t)??this.sanitizer.bypassSecurityTrustHtml(t??"");this.html.set(e)}click(t){if(this.editor||!(0,X.ru)(t.target))return;const e=t.target?.closest("a")?.getAttribute("href")??"";e.startsWith("#")&&(this.document.location.hash=e.replace("#",""),t.preventDefault())}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-editor-socket"]],hostVars:3,hostBindings:function(t,e){1&t&&b.bIt("click",(function(t){return e.click(t)})),2&t&&(b.Mr5("innerHTML",e.html(),b.npT),b.AVh("tui-editor-socket",e.options.enableDefaultStyles))},inputs:{content:"content"},standalone:!0,features:[b.aNF],decls:0,vars:0,template:function(t,e){},styles:['.tui-editor-socket{display:block;margin:0;color:var(--tui-text-primary);font:var(--tui-font-text-m)}.tui-editor-socket:after{content:"";display:table;clear:both}.tui-editor-socket[tuiTiptapEditor]{overflow:hidden}.tui-editor-socket .ProseMirror{min-block-size:100%;padding:.2rem 1rem;outline:none;white-space:pre-wrap}.tui-editor-socket .resize-cursor{cursor:ew-resize;cursor:col-resize}.tui-editor-socket .ProseMirror-gapcursor{margin-top:.83rem}.tui-editor-socket .ProseMirror .ProseMirror-gapcursor:first-child{margin-top:0}.tui-editor-socket br+br.ProseMirror-trailingBreak{display:none}.tui-editor-socket img.ProseMirror-separator+.ProseMirror-trailingBreak,.tui-editor-socket img.ProseMirror-separator{display:none!important}.tui-editor-socket h1,.tui-editor-socket h2,.tui-editor-socket h3,.tui-editor-socket h4,.tui-editor-socket h5,.tui-editor-socket h6{word-break:break-word;line-height:normal}.tui-editor-socket h1:first-child,.tui-editor-socket h2:first-child,.tui-editor-socket p:last-child{margin-bottom:0}.tui-editor-socket p:last-child,.tui-editor-socket pre:last-child{margin-bottom:0}.tui-editor-socket p:empty:after{content:" ";white-space:pre}.tui-editor-socket p:first-child{margin-top:0;min-inline-size:.0625rem}.tui-editor-socket p{margin:1rem 0}.tui-editor-socket p>span{line-height:initial}.tui-editor-socket blockquote{margin:1.25rem 0 1.25rem 1.5rem;padding-left:1.0625rem;border-left:.0625rem solid var(--tui-border-normal)}.tui-editor-socket hr{border:none;border-top:.0625rem solid var(--tui-background-neutral-1-hover);margin:1rem 0}.tui-editor-socket mark{background:unset;color:inherit}.tui-editor-socket font[face="Courier New"]{display:inline-block;padding:.25rem .5rem;border-radius:.25rem;background-color:#ecf1f7;word-break:break-word}.tui-editor-socket a:not([data-type=jump-anchor]){color:var(--tui-text-action);text-decoration:none;outline:none}.tui-editor-socket a:not([data-type=jump-anchor]):hover{color:var(--tui-text-action-hover);text-decoration:underline}.tui-editor-socket a:not([data-type=jump-anchor]):active{color:var(--tui-background-accent-1-pressed)}.tui-editor-socket .ProseMirror a[data-type=jump-anchor]{text-decoration:underline;text-decoration-color:var(--tui-text-action)}.tui-editor-socket .ProseMirror a[data-type=jump-anchor]:before{content:"#"}.tui-editor-socket .ProseMirror a[data-type=jump-anchor]:hover{color:var(--tui-text-action)}.tui-editor-socket .ProseMirror a:hover img[contenteditable=false]{cursor:pointer;outline:.25rem solid var(--tui-text-action)}.tui-editor-socket ul:not([data-type]),.tui-editor-socket ol:not([data-type]){list-style-type:none;margin:1rem 1rem 1rem 1.5rem;padding:0}.tui-editor-socket ul:not([data-type]) li,.tui-editor-socket ol:not([data-type]) li{margin:.75rem 0}.tui-editor-socket ul:not([data-type]) li>p,.tui-editor-socket ol:not([data-type]) li>p{display:inline;margin:0 auto;word-break:break-word}.tui-editor-socket ul:not([data-type]) li:before,.tui-editor-socket ol:not([data-type]) li:before{unicode-bidi:isolate;font-variant-numeric:tabular-nums;text-transform:none;text-indent:0;text-align:start;text-align-last:start}.tui-editor-socket ul:not([data-type]) li>p{display:block}.tui-editor-socket ul:not([data-type])>li:before{content:"";display:inline-block;inline-size:.5rem;block-size:.5rem;border-radius:100%;margin:.5rem .875rem .0625rem -1.375rem;background-color:var(--tui-background-accent-1);vertical-align:top;box-sizing:border-box;float:inline-start}.tui-editor-socket li ul:not([data-type])>li:before{background:none;border:.125rem solid var(--tui-background-accent-1)}.tui-editor-socket li ul:not([data-type])>li>ul:not([data-type])>li:before{background:var(--tui-background-accent-1);border-radius:0;inline-size:.375rem;block-size:.375rem}.tui-editor-socket ol:not([data-type]){counter-reset:item}.tui-editor-socket ol:not([data-type])>li:before{content:counters(item,".") ".";display:block;counter-increment:item;margin:0 .75rem 0 -1.5rem;color:var(--tui-border-hover);vertical-align:top;float:inline-start;white-space:nowrap}.tui-editor-socket [data-type=details-content] ol{counter-reset:details-item}.tui-editor-socket [data-type=details-content] ol:not([data-type])>li:before{content:counters(details-item,".") ".";counter-increment:details-item}.tui-editor-socket [data-type=details-content] ol [data-type=details-content] ol{counter-reset:details-item2}.tui-editor-socket [data-type=details-content] ol:not([data-type])>li [data-type=details-content] ol:not([data-type])>li:before{content:counters(details-item2,".") ".";counter-increment:details-item2}.tui-editor-socket ul[data-type] li[data-checked]{display:flex;gap:.5rem}.tui-editor-socket ul[data-type] li[data-checked]>div{inline-size:100%}.tui-editor-socket ul[data-type] li[data-checked]>label>input[type=checkbox]{position:relative;inline-size:var(--t-size, 1rem);block-size:var(--t-size, 1rem);border-radius:var(--tui-radius-xs, .25rem);transition-property:color,background,opacity,box-shadow,border;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;-webkit-appearance:none;appearance:none;outline:.125rem solid transparent;outline-offset:-.125rem;margin-top:.25rem;cursor:pointer}.tui-editor-socket ul[data-type] li[data-checked]>label>input[type=checkbox]:before{content:"";position:absolute;top:0;left:0;inline-size:100%;block-size:100%;background:currentColor;-webkit-mask:url(\'data:image/svg+xml,\') center / 100%;mask:url(\'data:image/svg+xml,\') center / 100%;transform:scale(0);transition:transform var(--tui-duration) ease-in-out,mask 0s var(--tui-duration) ease-in-out,-webkit-mask 0s var(--tui-duration) ease-in-out}.tui-editor-socket ul[data-type] li>label>input[type=checkbox]:checked{background:var(--tui-background-accent-1, #526ed3);color:var(--tui-text-primary-on-accent-1, #fff)}.tui-editor-socket ul[data-type] li>label>input[type=checkbox]:checked:before{-webkit-mask-image:url(\'data:image/svg+xml,\');mask-image:url(\'data:image/svg+xml,\');transform:scale(1)}.tui-editor-socket ul[data-type] li>label>input[type=checkbox]{box-shadow:inset 0 0 0 .0625rem var(--tui-border-normal);color:var(--tui-text-primary)}.tui-editor-socket._preview-image img{cursor:pointer}.tui-editor-socket .ProseMirror video,.tui-editor-socket .ProseMirror audio{pointer-events:none}.tui-editor-socket img.ProseMirror-selectednode{outline:.25rem solid var(--tui-background-accent-1-hover)}.tui-editor-socket[tuiTiptapEditor] tui-image-editor:hover{outline:.0625rem dashed var(--tui-background-accent-1-hover)}.tui-editor-socket .t-editor-placeholder:not(tr):not(th):not(td):not(ul):not(ol):not(li):first-child:before{content:attr(data-placeholder);position:absolute;float:inline-start;color:var(--tui-border-hover);pointer-events:none}.tui-editor-socket table{border-collapse:collapse;table-layout:fixed;inline-size:100%;margin:0;overflow:hidden}.tui-editor-socket table .tableWrapper,.tui-editor-socket .tableWrapper,.tui-editor-socket .tui-table-wrapper{overflow-x:auto}.tui-editor-socket table td{position:relative;min-inline-size:1em;block-size:2rem;padding:.1875rem .3125rem;vertical-align:top;box-sizing:border-box;word-break:break-word}.tui-editor-socket table th{position:relative;min-inline-size:1em;block-size:2rem;padding:.1875rem .3125rem;vertical-align:top;box-sizing:border-box;word-break:break-word;font-weight:700;text-align:start;background-color:var(--tui-background-base-alt);min-block-size:2rem}.tui-editor-socket table td,.tui-editor-socket table th{border:.125rem solid #e9e9e7}[tuiTheme=dark] .tui-editor-socket table td,[tuiTheme=dark] .tui-editor-socket table th{border:.125rem solid #2f2f2f}.tui-editor-socket table .column-resize-handle{position:absolute;right:-.125rem;top:0;bottom:-.125rem;inline-size:.25rem;background-color:#adf;pointer-events:none}.tui-editor-socket table td>*{margin-top:0;margin-bottom:0}.tui-editor-socket table th>*{margin-top:0;margin-bottom:0}.tui-editor-socket .selectedCell{outline:.0625rem solid #83b4d7}.tui-editor-socket .selectedCell:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:var(--tui-service-selected-text);pointer-events:none}.tui-editor-socket summary{display:flex;align-items:center;min-block-size:3.5rem;inline-size:100%;box-sizing:border-box;border-radius:var(--tui-radius-l);pointer-events:none;outline:none;word-break:break-word;padding:0 4.6875rem 0 1.25rem}.tui-editor-socket summary:focus-visible{outline:.125rem solid var(--tui-text-action)}.tui-editor-socket summary p{min-inline-size:.0625rem;margin:0}.tui-editor-socket summary::-webkit-details-marker{display:none}.tui-editor-socket details[open] summary{border-radius:var(--tui-radius-l) var(--tui-radius-l) 0 0}.tui-editor-socket .t-details-arrow{position:absolute;top:1.5rem;right:1.25rem;block-size:.575rem;inline-size:.575rem;border:.0625rem solid var(--tui-text-secondary);border-width:0 .125rem .125rem 0;transform:rotate(45deg);transition:var(--tui-duration, .3s);-webkit-appearance:none;appearance:none;box-sizing:border-box;padding:0;background:none;cursor:pointer;outline:none}.tui-editor-socket .t-details-arrow:hover{border-color:var(--tui-text-primary)}.tui-editor-socket .t-details-delete{position:absolute;top:1.4rem;right:2.7rem;block-size:1.125rem;inline-size:1.25rem;-webkit-appearance:none;appearance:none;box-sizing:border-box;padding:0;background:none;cursor:pointer;outline:none;border:none}.tui-editor-socket .t-details-delete:hover:after{color:var(--tui-text-primary)}.tui-editor-socket .t-details-delete:after{content:"\\d7";display:inline-block;font:inherit;font-size:2rem;color:var(--tui-text-secondary);block-size:100%;inline-size:100%;line-height:.8rem}.tui-editor-socket details{inline-size:100%;border:.0625rem solid var(--tui-border-normal);border-radius:var(--tui-radius-l)}.tui-editor-socket div[data-type=details-content]{padding:1.25rem;min-block-size:3rem;border:.0625rem solid var(--tui-border-normal);border-width:.0625rem 0 0}.tui-editor-socket div[data-type=details-content] h1:first-child,.tui-editor-socket div[data-type=details-content] h2:first-child,.tui-editor-socket div[data-type=details-content] pre:first-child,.tui-editor-socket div[data-type=details-content] ul:first-child,.tui-editor-socket div[data-type=details-content] ol:first-child,.tui-editor-socket div[data-type=details-content] ol li:first-child,.tui-editor-socket div[data-type=details-content] ul li:first-child{margin-top:0}.tui-editor-socket .t-details-wrapper{position:relative;display:flex}.tui-editor-socket .t-details-wrapper_rendered .t-details-arrow{pointer-events:none}.tui-editor-socket .t-details-wrapper_rendered summary{transition:transform var(--tui-duration, .3s);cursor:pointer;pointer-events:auto}.tui-editor-socket .t-details-wrapper_rendered summary:hover{background:var(--tui-background-base-alt)}.tui-editor-socket details[open]+.t-details-arrow{top:1.75rem;transform:rotate(225deg)}.tui-editor-socket pre{white-space:pre-wrap;word-break:break-word;border-radius:.25rem;margin:1rem 0;padding:.75rem 1rem;font-family:Courier,monospace;color:var(--tui-text-secondary);background:var(--tui-background-base-alt)}.tui-editor-socket .tui-group-node{display:flex;flex-direction:row}.tui-editor-socket .tui-group-node:hover>.tui-group-pointer{pointer-events:auto;opacity:1}.tui-editor-socket .tui-group-pointer{opacity:0;min-block-size:.8125rem;max-block-size:.8125rem;min-inline-size:.8125rem;max-inline-size:.8125rem;margin:.3125rem .3125rem 0 0;cursor:grab;background-image:url(\'data:image/svg+xml;charset=UTF-8,\');background-repeat:no-repeat;background-size:contain;background-position:center}.tui-editor-socket [data-mode=onDark] .tui-group-pointer{background-image:url(\'data:image/svg+xml;charset=UTF-8,\')}.t-hidden-editor{display:none;visibility:hidden;opacity:0;block-size:0;inline-size:100%;margin:0;padding:0}\n'],encapsulation:2,changeDetection:0}),e})();var Pt=n(7434),Bt=n(7920),_t=n(756),Ht=n(9707),jt=n(9131);function Ft(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",3)(1,"button",4),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(null==e.editor?null:e.editor.onAlign("left"))})),b.nI1(2,"async"),b.k0s(),b.j41(3,"button",4),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(null==e.editor?null:e.editor.onAlign("center"))})),b.nI1(4,"async"),b.k0s(),b.j41(5,"button",4),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(null==e.editor?null:e.editor.onAlign("right"))})),b.nI1(6,"async"),b.k0s(),b.j41(7,"button",4),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(null==e.editor?null:e.editor.onAlign("justify"))})),b.nI1(8,"async"),b.k0s()()}if(2&t){const t=b.XpG();let e,n,o,i;b.R7$(1),b.Y8G("iconStart",t.options.icons.textAlignLeft)("tuiHint",null==(e=b.bMT(2,8,t.texts$))?null:e.justifyLeft),b.R7$(2),b.Y8G("iconStart",t.options.icons.textAlignCenter)("tuiHint",null==(n=b.bMT(4,10,t.texts$))?null:n.justifyCenter),b.R7$(2),b.Y8G("iconStart",t.options.icons.textAlignRight)("tuiHint",null==(o=b.bMT(6,12,t.texts$))?null:o.justifyRight),b.R7$(2),b.Y8G("iconStart",t.options.icons.textAlignJustify)("tuiHint",null==(i=b.bMT(8,14,t.texts$))?null:i.justifyFull)}}let Gt=(()=>{var t;class e{constructor(){this.localEditor=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.alignState$=null}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}initStream(){this.alignState$=(0,It.z)([this.editor?.isActive$({textAlign:"left"})??(0,_t.of)(!1),this.editor?.isActive$({textAlign:"right"})??(0,_t.of)(!1),this.editor?.isActive$({textAlign:"center"})??(0,_t.of)(!1),this.editor?.isActive$({textAlign:"justify"})??(0,_t.of)(!1)]).pipe((0,P.T)((([t,e,n,o])=>({left:t,right:e,center:n,justify:o}))))}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-align-content"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:5,vars:6,consts:[[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__align-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["alignDropdown",""],[1,"t-dropdown"],["appearance","icon","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"iconStart","tuiHint","click"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0),b.nrm(1,"button",1),b.nI1(2,"async"),b.DNE(3,Ft,9,16,"ng-template",null,2,b.C5r),b.k0s()),2&t){const t=b.sdS(4);let n;b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(1),b.Y8G("iconStart",e.options.icons.textAlignPreview)("tuiHint",null==(n=b.bMT(2,4,e.texts$))?null:n.justify)}},dependencies:[G.Jj,K.p,Ht.pU,Ht.iE,jt.XZ,jt.$$],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})();var Vt=n(5180);function Wt(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",5),b.bIt("click",(function(){const e=b.eBV(t).index,n=b.XpG(2);return b.Njj(n.onCode(!!e))})),b.EFF(1),b.k0s()}if(2&t){const t=e.$implicit;b.R7$(1),b.SpI(" ",t," ")}}function Xt(t,e){if(1&t&&(b.j41(0,"tui-data-list"),b.DNE(1,Wt,2,1,"button",4),b.nI1(2,"async"),b.k0s()),2&t){const t=b.XpG();b.R7$(1),b.Y8G("ngForOf",b.bMT(2,1,t.codeOptionsTexts$))}}let Ut=(()=>{var t;class e{constructor(){this.localEditor=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.codeOptionsTexts$=(0,b.WQX)($),this.hintText$=this.texts$.pipe((0,P.T)((t=>t.code))),this.insideCode$=null}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}onCode(t){this.editor?.[t?"toggleCodeBlock":"toggleCode"]()}get editor(){return this.injectionEditor??this.localEditor}initStream(){this.insideCode$=(0,It.z)({code:this.editor?.isActive$("code")??(0,_t.of)(!1),codeBlock:this.editor?.isActive$("codeBlock")??(0,_t.of)(!1)}).pipe((0,P.T)((({code:t,codeBlock:e})=>t||e)))}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-code"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:6,vars:6,consts:[[3,"tuiDropdown","tuiDropdownOpen"],["codes",""],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["codesDropdown",""],["tuiOption","","type","button",3,"click",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0,1),b.nrm(2,"button",2),b.nI1(3,"async"),b.DNE(4,Xt,3,3,"ng-template",null,3,b.C5r),b.k0s()),2&t){const t=b.sdS(5);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(2),b.Y8G("iconStart",e.options.icons.code)("tuiHint",b.bMT(3,4,e.hintText$))}},dependencies:[G.Jj,G.Sq,K.p,Vt.uE,Vt.aO,Ht.pU,Ht.iE,jt.XZ,jt.$$],encapsulation:2,changeDetection:0}),e})(),Kt=(()=>{var t;class e{constructor(){this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.options=(0,b.WQX)(x),this.inputEditor=null}get editor(){return this.injectionEditor??this.inputEditor}setDetails(){this.editor?.setDetails()}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-details"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:2,vars:4,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint","click"]],template:function(t,e){if(1&t&&(b.j41(0,"button",0),b.bIt("click",(function(){return e.setDetails()})),b.nI1(1,"async"),b.k0s()),2&t){let t;b.Y8G("iconStart",e.options.icons.detailsAdd)("tuiHint",null==(t=b.bMT(1,2,e.texts$))?null:t.setDetails)}},dependencies:[G.Jj,K.p,jt.XZ,jt.$$],encapsulation:2,changeDetection:0}),e})();function Jt(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",1),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.removeDetails())})),b.nI1(1,"async"),b.k0s()}if(2&t){const t=e.ngIf,n=b.XpG();b.Y8G("disabled",!!b.bMT(1,3,n.disabled$))("iconStart",n.options.icons.detailsRemove)("tuiHint",t.removeDetails)}}let Yt=(()=>{var t;class e{constructor(){this.localEditor=null,this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.options=(0,b.WQX)(x),this.disabled$=null}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}removeDetails(){this.editor?.removeDetails()}get editor(){return this.injectionEditor??this.localEditor}initStream(){this.disabled$=this.editor?.isActive$("details").pipe((0,P.T)((t=>!t)))??null}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-details-remove"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:2,vars:3,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click"]],template:function(t,e){1&t&&(b.DNE(0,Jt,2,5,"button",0),b.nI1(1,"async")),2&t&&b.Y8G("ngIf",b.bMT(1,1,e.texts$))},dependencies:[G.Jj,G.bT,K.p,jt.XZ,jt.$$],encapsulation:2,changeDetection:0}),e})();const qt=function(){return{}};function Qt(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",5),b.bIt("click",(function(){const e=b.eBV(t).$implicit,n=b.XpG(2);return b.Njj(n.setFontOption(e))})),b.nI1(1,"lowercase"),b.EFF(2),b.k0s()}if(2&t){const t=e.$implicit;b.xc7("font-family",t.family)("font-size",t.px,"px")("font-weight",t.weight),b.Y8G("ngClass",(null==t?null:t.ngClass)||b.lJ4(12,qt))("ngStyle",(null==t?null:t.ngStyle)||b.lJ4(13,qt)),b.BMQ("automation-id","tui_font__"+b.bMT(1,10,t.name||"")),b.R7$(2),b.SpI(" ",t.name," ")}}function Zt(t,e){if(1&t&&(b.j41(0,"tui-data-list"),b.DNE(1,Qt,3,14,"button",4),b.nI1(2,"async"),b.k0s()),2&t){const t=b.XpG();b.R7$(1),b.Y8G("ngForOf",b.bMT(2,1,t.fontsOptions$))}}let te=(()=>{var t;class e{constructor(){this.fontOptionsTexts$=(0,b.WQX)(L),this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.fontsOptions$=this.fontOptionsTexts$.pipe((0,P.T)((t=>this.options.fontOptions(t)))),this.fontText$=this.texts$.pipe((0,P.T)((t=>t.font))),this.inputEditor=null}get editor(){return this.injectionEditor??this.inputEditor}setFontOption({headingLevel:t,px:e}){const n=this.editor?.getFontColor()??i;this.clearPreviousTextStyles(),t?this.editor?.setHeading(t):this.editor?.setParagraph({fontSize:(0,w.Pp)(e??0)}),n!==i&&this.editor?.setFontColor(n)}clearPreviousTextStyles(){this.editor?.removeEmptyTextStyle(),this.editor?.toggleMark("textStyle")}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-font-size"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:6,vars:6,consts:[[3,"tuiDropdown","tuiDropdownOpen"],["fonts",""],["appearance","icon","automation-id","toolbar__font-size-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["fontsDropdown",""],["tuiOption","","type","button",3,"ngClass","ngStyle","fontFamily","fontSize","fontWeight","click",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"ngClass","ngStyle","click"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0,1),b.nrm(2,"button",2),b.nI1(3,"async"),b.DNE(4,Zt,3,3,"ng-template",null,3,b.C5r),b.k0s()),2&t){const t=b.sdS(5);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(2),b.Y8G("iconStart",e.options.icons.fontSize)("tuiHint",b.bMT(3,4,e.fontText$))}},dependencies:[G.Jj,G.GH,G.YU,G.Sq,G.B3,K.p,Vt.uE,Vt.aO,Ht.pU,Ht.iE,jt.XZ,jt.$$],encapsulation:2,changeDetection:0}),e})();function ee(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",8),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(4);return b.Njj(null==e.editor?null:e.editor.toggleBold())})),b.k0s()}if(2&t){const t=b.XpG(3).ngIf,e=b.XpG();b.Y8G("iconStart",e.options.icons.fontStyleBold)("tuiHint",t.bold)}}function ne(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",8),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(4);return b.Njj(null==e.editor?null:e.editor.toggleItalic())})),b.k0s()}if(2&t){const t=b.XpG(3).ngIf,e=b.XpG();b.Y8G("iconStart",e.options.icons.fontStyleItalic)("tuiHint",t.italic)}}function oe(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",8),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(4);return b.Njj(null==e.editor?null:e.editor.toggleUnderline())})),b.k0s()}if(2&t){const t=b.XpG(3).ngIf,e=b.XpG();b.Y8G("iconStart",e.options.icons.fontStyleUnderline)("tuiHint",t.underline)}}function ie(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",8),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(4);return b.Njj(null==e.editor?null:e.editor.toggleStrike())})),b.k0s()}if(2&t){const t=b.XpG(3).ngIf,e=b.XpG();b.Y8G("iconStart",e.options.icons.fontStyleStrike)("tuiHint",t.strikeThrough)}}function re(t,e){if(1&t&&(b.j41(0,"div",6),b.DNE(1,ee,1,2,"button",7),b.DNE(2,ne,1,2,"button",7),b.DNE(3,oe,1,2,"button",7),b.DNE(4,ie,1,2,"button",7),b.k0s()),2&t){const t=b.XpG(3);b.R7$(1),b.Y8G("ngIf",t.isEnabled(t.editorTool.Bold)),b.R7$(1),b.Y8G("ngIf",t.isEnabled(t.editorTool.Italic)),b.R7$(1),b.Y8G("ngIf",t.isEnabled(t.editorTool.Underline)),b.R7$(1),b.Y8G("ngIf",t.isEnabled(t.editorTool.Strikethrough))}}function se(t,e){if(1&t&&(b.j41(0,"div",2,3),b.nrm(2,"button",4),b.DNE(3,re,5,4,"ng-template",null,5,b.C5r),b.k0s()),2&t){const t=b.sdS(4),e=b.XpG().ngIf,n=b.XpG();b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(2),b.Y8G("iconStart",n.options.icons.fontStylePreview)("tuiHint",e.fontStyle)}}function ae(t,e){if(1&t&&(b.qex(0),b.DNE(1,se,5,4,"div",1),b.nI1(2,"async"),b.bVm()),2&t){const t=b.XpG();b.R7$(1),b.Y8G("ngIf",b.bMT(2,1,t.fontStyleState$))}}let le=(()=>{var t;class e{constructor(){this.toolsSet=new Set(s),this.localEditor=null,this.editorTool=r,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.fontStyleState$=null}set inputEditor(t){this.localEditor=t,this.initStream()}set enabledTools(t){this.toolsSet=new Set(t)}get editor(){return this.injectionEditor??this.localEditor}ngOnInit(){this.initStream()}isEnabled(t){return this.toolsSet.has(t)}initStream(){this.fontStyleState$=(0,It.z)([this.editor?.isActive$("bold")??(0,_t.of)(!1),this.editor?.isActive$("italic")??(0,_t.of)(!1),this.editor?.isActive$("underline")??(0,_t.of)(!1),this.editor?.isActive$("strike")??(0,_t.of)(!1)]).pipe((0,P.T)((([t,e,n,o])=>({bold:t,italic:e,underline:n,strike:o}))))}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-font-style"]],inputs:{inputEditor:["editor","inputEditor"],enabledTools:"enabledTools"},standalone:!0,features:[b.aNF],decls:2,vars:3,consts:[[4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen",4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen"],["format",""],["appearance","icon","automation-id","toolbar__font-style-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["formatDropdown",""],[1,"t-dropdown"],["appearance","icon","size","s","tuiIconButton","","type","button","class","t-option t-option_margin",3,"iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"iconStart","tuiHint","click"]],template:function(t,e){1&t&&(b.DNE(0,ae,3,3,"ng-container",0),b.nI1(1,"async")),2&t&&b.Y8G("ngIf",b.bMT(1,1,e.texts$))},dependencies:[G.Jj,G.bT,K.p,Ht.pU,Ht.iE,jt.XZ,jt.$$],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})(),ce=(()=>{var t;class e{constructor(){this.localEditor=null,this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.options=(0,b.WQX)(x),this.insertGroupText$=this.texts$.pipe((0,P.T)((t=>t.insertGroup))),this.removeGroupText$=this.texts$.pipe((0,P.T)((t=>t.removeGroup))),this.disabled$=null}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}addGroup(){this.editor?.setGroup()}removeGroup(){this.editor?.removeGroup()}get editor(){return this.injectionEditor??this.localEditor}initStream(){this.disabled$=this.editor?.isActive$("group").pipe((0,P.T)((t=>!t)))??null}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-editor-group-tool"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:5,vars:11,consts:[["appearance","icon","automation-id","toolbar__group-add-button","size","s","tuiHintDescribe","","tuiIconButton","","type","button",3,"iconStart","tuiHint","click"],["appearance","icon","automation-id","toolbar__group-remove-button","size","s","tuiHintDescribe","","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click"]],template:function(t,e){1&t&&(b.j41(0,"button",0),b.bIt("click",(function(){return e.addGroup()})),b.nI1(1,"async"),b.k0s(),b.j41(2,"button",1),b.bIt("click",(function(){return e.removeGroup()})),b.nI1(3,"async"),b.nI1(4,"async"),b.k0s()),2&t&&(b.Y8G("iconStart",e.options.icons.groupAdd)("tuiHint",b.bMT(1,5,e.insertGroupText$)),b.R7$(2),b.Y8G("disabled",!!b.bMT(3,7,e.disabled$))("iconStart",e.options.icons.groupRemove)("tuiHint",b.bMT(4,9,e.removeGroupText$)))},dependencies:[G.Jj,K.p,jt.XZ,jt.$$],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})();var de=n(184);function ue(t,e){if(1&t&&(b.j41(0,"div",4),b.nI1(1,"async"),b.k0s()),2&t){const t=b.XpG();b.xc7("background",b.bMT(1,2,t.backgroundColor$))}}function he(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-palette",5),b.bIt("selectedColor",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(null==n.editor?null:n.editor.setBackgroundColor(e))})),b.k0s()}if(2&t){const t=b.XpG();b.Y8G("colors",t.colors)}}let pe=(()=>{var t;class e{constructor(){this.localEditor=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.backgroundColor$=null,this.backColorText$=this.texts$.pipe((0,P.T)((t=>t.backColor))),this.colors=this.options.colors}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}isBlankColor(t){return t===this.options.blankColor}get editor(){return this.injectionEditor??this.localEditor}get icons(){return this.options.icons}initStream(){this.backgroundColor$=this.editor?.stateChange$.pipe((0,P.T)((()=>this.editor?.getBackgroundColor()??this.options.blankColor??!1)),(0,it.F)())??null}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-highlight-color"]],inputs:{colors:"colors",inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:7,vars:9,consts:[[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__hilite-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",1,"t-tool",3,"iconStart","tuiHint"],["class","t-plate",3,"background",4,"ngIf"],["hiliteDropdown",""],[1,"t-plate"],[1,"t-color-picker",3,"colors","selectedColor"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0),b.nrm(1,"button",1),b.nI1(2,"async"),b.DNE(3,ue,2,4,"div",2),b.nI1(4,"async"),b.DNE(5,he,1,1,"ng-template",null,3,b.C5r),b.k0s()),2&t){const t=b.sdS(6);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(1),b.Y8G("iconStart",e.icons.textHilite)("tuiHint",b.bMT(2,5,e.backColorText$)),b.R7$(2),b.Y8G("ngIf",!e.isBlankColor(b.bMT(4,7,e.backgroundColor$)||""))}},dependencies:[G.Jj,G.bT,K.p,Ht.pU,Ht.iE,jt.XZ,jt.$$,de.Mz,de.DU],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})();function fe(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",5)(1,"button",6),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(null==e.editor?null:e.editor.toggleUnorderedList())})),b.k0s(),b.j41(2,"button",7),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(null==e.editor?null:e.editor.toggleOrderedList())})),b.k0s(),b.j41(3,"button",8),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(null==e.editor?null:e.editor.toggleTaskList())})),b.k0s(),b.j41(4,"button",9),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.sinkListItem())})),b.k0s(),b.j41(5,"button",10),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.liftListItem())})),b.k0s()()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.R7$(1),b.Y8G("iconStart",e.options.icons.listUnOrdered)("tuiHint",t.unorderedList),b.R7$(1),b.Y8G("iconStart",e.options.icons.listOrdered)("tuiHint",t.orderedList),b.R7$(1),b.Y8G("iconStart",e.options.icons.taskList),b.R7$(1),b.Y8G("iconStart",e.options.icons.indent)("tuiHint",t.indent),b.R7$(1),b.Y8G("iconStart",e.options.icons.outdent)("tuiHint",t.outdent)}}function me(t,e){if(1&t&&(b.j41(0,"div",2),b.nrm(1,"button",3),b.DNE(2,fe,6,9,"ng-template",null,4,b.C5r),b.k0s()),2&t){const t=b.sdS(3),e=b.XpG().ngIf,n=b.XpG();b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(1),b.Y8G("iconStart",n.options.icons.listPreview)("tuiHint",e.list)}}function ge(t,e){if(1&t&&(b.qex(0),b.DNE(1,me,4,4,"div",1),b.nI1(2,"async"),b.bVm()),2&t){const t=b.XpG();b.R7$(1),b.Y8G("ngIf",b.bMT(2,1,t.listState$))}}let be=(()=>{var t;class e{constructor(){this.localEditor=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.listState$=null}set inputEditor(t){this.localEditor=t,this.initStream()}get editor(){return this.injectionEditor??this.localEditor}sinkListItem(){this.editor?.sinkListItem()}liftListItem(){this.editor?.liftListItem()}initStream(){this.listState$=(0,It.z)([this.editor?.isActive$("orderedList")??(0,_t.of)(!1),this.editor?.isActive$("bulletList")??(0,_t.of)(!1),this.editor?.isActive$("taskList")??(0,_t.of)(!1)]).pipe((0,P.T)((([t,e,n])=>({ordered:t,unordered:e,tasked:n}))))}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-list-configs"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:2,vars:3,consts:[[4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen",4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__ordering-list-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["listDropdown",""],[1,"t-dropdown","t-dropdown-list"],["appearance","icon","automation-id","toolbar__un-ordered-list-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"iconStart","tuiHint","click"],["appearance","icon","automation-id","toolbar__ordered-list-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"iconStart","tuiHint","click"],["appearance","icon","automation-id","toolbar__task-list-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"iconStart","click"],["appearance","icon","automation-id","toolbar_indent-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"iconStart","tuiHint","click"],["appearance","icon","automation-id","toolbar_outdent-button","size","s","tuiIconButton","","type","button",1,"t-option",3,"iconStart","tuiHint","click"]],template:function(t,e){1&t&&(b.DNE(0,ge,3,3,"ng-container",0),b.nI1(1,"async")),2&t&&b.Y8G("ngIf",b.bMT(1,1,e.texts$))},dependencies:[G.Jj,G.bT,K.p,Ht.pU,Ht.iE,jt.XZ,jt.$$],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})();function ye(t,e){if(1&t&&(b.j41(0,"div",3),b.nI1(1,"async"),b.k0s()),2&t){const t=b.XpG();b.xc7("background",b.bMT(1,2,t.color$))}}function ke(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-palette",4),b.bIt("selectedColor",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(n.setCellColor(e))})),b.k0s()}if(2&t){const t=b.XpG();b.Y8G("colors",t.colors)}}let ve=(()=>{var t;class e{constructor(){this.localEditor=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.colorText$=null,this.isActive$=null,this.color$=null,this.colors=this.options.colors}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}get icons(){return this.options.icons}isBlankColor(t){return t===this.options.blankColor}setCellColor(t){this.editor?.isActive("group")?this.editor.setGroupHilite(t):this.editor?.isActive("table")&&this.editor.setCellColor(t)}initStream(){this.colorText$=this.texts$.pipe((0,P.T)((t=>this.editor?.isActive("group")&&t.hiliteGroup||this.editor?.isActive("table")&&t.cellColor||""))),this.isActive$=(0,It.z)([this.editor?.isActive$("table")??(0,_t.of)(!1),this.editor?.isActive$("group")??(0,_t.of)(!1)]).pipe((0,P.T)((([t,e])=>t||e))),this.color$=this.editor?.stateChange$.pipe((0,P.T)((()=>this.editor?.getCellColor()??this.editor?.getGroupColor()??this.options.blankColor)),(0,it.F)())??null}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-table-cell-color"]],inputs:{colors:"colors",inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:7,vars:13,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiDropdown","tuiDropdownMaxHeight","tuiDropdownOpen","tuiHint"],["class","t-plate t-plate_paint",3,"background",4,"ngIf"],["cellColorDropdown",""],[1,"t-plate","t-plate_paint"],[1,"t-color-picker",3,"colors","selectedColor"]],template:function(t,e){if(1&t&&(b.nrm(0,"button",0),b.nI1(1,"async"),b.nI1(2,"async"),b.DNE(3,ye,2,4,"div",1),b.nI1(4,"async"),b.DNE(5,ke,1,1,"ng-template",null,2,b.C5r)),2&t){const t=b.sdS(6);b.Y8G("disabled",!b.bMT(1,7,e.isActive$))("iconStart",e.icons.paint)("tuiDropdown",t)("tuiDropdownMaxHeight",999)("tuiDropdownOpen",!1)("tuiHint",b.bMT(2,9,e.colorText$)),b.R7$(3),b.Y8G("ngIf",!e.isBlankColor(b.bMT(4,11,e.color$)||""))}},dependencies:[G.Jj,G.bT,K.p,Ht.HY,Ht.pU,Ht.iE,jt.XZ,jt.$$,de.Mz,de.DU],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})();var we=n(712);class Ce{constructor(t){this.$implicit=t}}let xe=(()=>{var t;class e{constructor(){this.viewContainer=(0,b.WQX)(b.c1b),this.templateRef=(0,b.WQX)(b.C4Q)}set tuiRepeatTimesOf(t){const e=Math.floor((0,we.wN)(t,0,65536)),{length:n}=this.viewContainer;t{var t;class e{constructor(){this.win=(0,b.WQX)(W.jf),this.tableSize={rows:1,cols:1},this.selectSize=new b.bkB}get columnsNumber(){return Math.min(Math.max(3,this.tableSize.cols+1),15)}get rowsNumber(){return Math.min(Math.max(3,this.tableSize.rows+1),15)}tableSelectHovered(t,e){return t70&&(this.tableSize={rows:t,cols:e})}select(){this.selectSize.emit(this.tableSize)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-table-size-selector"]],outputs:{selectSize:"selectSize"},standalone:!0,features:[b.aNF],decls:3,vars:3,consts:[["class","t-column",4,"tuiRepeatTimes","tuiRepeatTimesOf"],[1,"t-description"],[1,"t-column"],["class","t-cell",3,"t-cell_hovered","click","mouseenter",4,"tuiRepeatTimes","tuiRepeatTimesOf"],[1,"t-cell",3,"click","mouseenter"]],template:function(t,e){1&t&&(b.DNE(0,Me,2,1,"div",0),b.j41(1,"div",1),b.EFF(2),b.k0s()),2&t&&(b.Y8G("tuiRepeatTimesOf",e.columnsNumber),b.R7$(2),b.Lme("",e.tableSize.cols,"×",e.tableSize.rows,""))},dependencies:[xe],styles:["[_nghost-%COMP%]{display:block;padding:.75rem}.t-cell[_ngcontent-%COMP%]{display:inline-block;background-color:var(--tui-background-base);inline-size:1.25rem;block-size:1.25rem;border-radius:.25rem;margin:.125rem;border:.0625rem solid var(--tui-border-normal);cursor:pointer}.t-cell_hovered[_ngcontent-%COMP%]{background-color:var(--tui-background-base-alt)}.t-column[_ngcontent-%COMP%]{white-space:nowrap}.t-description[_ngcontent-%COMP%]{text-align:center}"],changeDetection:0}),e})();function Oe(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-table-size-selector",4),b.bIt("selectSize",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(n.addTable(e))})),b.k0s()}}let Ee=(()=>{var t;class e{constructor(){this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.insertTableText$=this.texts$.pipe((0,P.T)((t=>t.insertTable))),this.inputEditor=null}get editor(){return this.injectionEditor??this.inputEditor}addTable({rows:t,cols:e}){this.editor?.enter();const n=this.editor?.state?.selection.anchor;this.editor?.enter(),this.editor?.enter(),this.editor?.setTextSelection(n??0),this.editor?.insertTable(t,e)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-table-create"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:6,vars:6,consts:[["tuiDropdownAlign","left","tuiDropdownDirection","bottom",3,"tuiDropdown","tuiDropdownOpen"],["table",""],["appearance","icon","automation-id","toolbar__insert-table-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["tableDropdown",""],[3,"selectSize"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0,1),b.nrm(2,"button",2),b.nI1(3,"async"),b.k0s(),b.DNE(4,Oe,1,0,"ng-template",null,3,b.C5r)),2&t){const t=b.sdS(5);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(2),b.Y8G("iconStart",e.options.icons.insertTable)("tuiHint",b.bMT(3,4,e.insertTableText$))}},dependencies:[G.Jj,K.p,Ht.HY,Ht.pU,Ht.iE,jt.XZ,jt.$$,Te],encapsulation:2,changeDetection:0}),e})(),Ae=(()=>{var t;class e{constructor(){this.localEditor=null,this.destroyRef=(0,b.WQX)(b.abz),this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.canMergeCells=(0,b.vPA)(!1),this.canSplitCells=(0,b.vPA)(!1)}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}mergeCells(){this.editor?.mergeCells()}splitCell(){this.editor?.splitCell()}get editor(){return this.injectionEditor??this.localEditor}initStream(){this.editor?.stateChange$.pipe((0,P.T)((()=>this.editor?.canMergeCells()??!1)),(0,it.F)(),(0,Q.pQ)(this.destroyRef)).subscribe((t=>this.canMergeCells.set(t))),this.editor?.stateChange$.pipe((0,P.T)((()=>this.editor?.canSplitCells()??!1)),(0,it.F)(),(0,Q.pQ)(this.destroyRef)).subscribe((t=>this.canSplitCells.set(t)))}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-table-merge-cells"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:3,vars:7,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click"]],template:function(t,e){if(1&t&&(b.j41(0,"button",0),b.bIt("click",(function(){return e.canMergeCells()?e.mergeCells():e.splitCell()})),b.nI1(1,"async"),b.nI1(2,"async"),b.k0s()),2&t){let t;b.Y8G("disabled",!e.canMergeCells()&&!e.canSplitCells())("iconStart",e.canMergeCells()?e.options.icons.tableCellMerge:e.options.icons.tableCellSplit)("tuiHint",e.canMergeCells()?null==(t=b.bMT(1,3,e.texts$))?null:t.mergeCells:null==(t=b.bMT(2,5,e.texts$))?null:t.splitCells)}},dependencies:[G.Jj,K.p,jt.XZ,jt.$$],encapsulation:2,changeDetection:0}),e})();function Ie(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",5),b.bIt("click",(function(){const e=b.eBV(t).index,n=b.XpG().index,o=b.XpG(2);return b.Njj(o.onTableOption(2*n+e))})),b.EFF(1),b.k0s()}if(2&t){const t=e.$implicit;b.R7$(1),b.SpI(" ",t," ")}}function Ne(t,e){if(1&t&&(b.j41(0,"tui-opt-group"),b.DNE(1,Ie,2,1,"button",4),b.k0s()),2&t){const t=e.$implicit;b.R7$(1),b.Y8G("ngForOf",t)}}function De(t,e){if(1&t&&(b.j41(0,"tui-data-list"),b.DNE(1,Ne,2,1,"tui-opt-group",3),b.nI1(2,"async"),b.k0s()),2&t){const t=b.XpG();b.R7$(1),b.Y8G("ngForOf",b.bMT(2,1,t.tableCommandTexts$))}}const Re={InsertColumnBefore:0,InsertColumnAfter:1,InsertRowBefore:2,InsertRowAfter:3,DeleteColumn:4,DeleteRow:5};let $e=(()=>{var t;class e{constructor(){this.localEditor=null,this.commandsRegistry=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.tableCommandTexts$=(0,b.WQX)(D),this.isActive$=null,this.rowsColumnsManagingText$=this.texts$.pipe((0,P.T)((t=>t.rowsColumnsManaging)))}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}onTableOption(t){this.commandsRegistry?.[t]?.()}initStream(){this.commandsRegistry={[Re.InsertColumnAfter]:()=>this.editor?.addColumnAfter(),[Re.InsertColumnBefore]:()=>this.editor?.addColumnBefore(),[Re.InsertRowAfter]:()=>this.editor?.addRowAfter(),[Re.InsertRowBefore]:()=>this.editor?.addRowBefore(),[Re.DeleteColumn]:()=>this.editor?.deleteColumn(),[Re.DeleteRow]:()=>this.editor?.deleteRow()},this.isActive$=this.editor?.isActive$("table")??null}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-table-row-column-manager"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:6,vars:9,consts:[[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint"],["tableOptionsDropdown",""],[4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0),b.nrm(1,"button",1),b.nI1(2,"async"),b.nI1(3,"async"),b.k0s(),b.DNE(4,De,3,3,"ng-template",null,2,b.C5r)),2&t){const t=b.sdS(5);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(1),b.Y8G("disabled",!b.bMT(2,5,e.isActive$))("iconStart",e.options.icons.addRowTable)("tuiHint",b.bMT(3,7,e.rowsColumnsManagingText$))}},dependencies:[G.Jj,G.Sq,K.p,Vt.uE,Vt.aO,Vt.Ji,Ht.pU,Ht.iE,jt.XZ,jt.$$],encapsulation:2,changeDetection:0}),e})();function Le(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-palette",3),b.bIt("selectedColor",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(null==n.editor?null:n.editor.setFontColor(e))})),b.k0s()}if(2&t){const t=b.XpG();b.Y8G("colors",t.colors)}}let ze=(()=>{var t;class e{constructor(){this.localEditor=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.foreColorText$=this.texts$.pipe((0,P.T)((t=>t.foreColor))),this.fontColor$=null,this.colors=this.options.colors}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}initStream(){this.fontColor$=this.editor?.stateChange$.pipe((0,P.T)((()=>this.editor?.getFontColor()??this.options.blankColor)),(0,it.F)())??null}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-text-color"]],inputs:{colors:"colors",inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:6,vars:10,consts:[[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__color-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["colorDropdown",""],[1,"t-color-picker",3,"colors","selectedColor"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0)(1,"button",1),b.nI1(2,"async"),b.nI1(3,"async"),b.k0s(),b.DNE(4,Le,1,1,"ng-template",null,2,b.C5r),b.k0s()),2&t){const t=b.sdS(5);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(1),b.xc7("color",b.bMT(2,6,e.fontColor$)),b.Y8G("iconStart",e.options.icons.textColor)("tuiHint",b.bMT(3,8,e.foreColorText$))}},dependencies:[G.Jj,K.p,Ht.pU,Ht.iE,jt.XZ,jt.$$,de.Mz,de.DU],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})();var Pe=n(8486);let Be=(()=>{var t;class e{constructor(){this.el=(0,b.WQX)(b.aKT).nativeElement}findFirstFocusableTool(t=!1){const e=t?this.toolsContainers.slice().reverse():this.toolsContainers;for(const t of e){const e=(0,Pt.PQ)(t)?t:(0,Pt.km)({initial:t,root:t,keyboard:!1});if(e)return e}return null}onHorizontalNavigation(t){const{toolsContainers:e}=this,n=e.findIndex(Pt.Ij),o=e[(0,we.wN)(n+(t?-1:1),0,e.length-1)],i=t?this.findPreviousTool(o):this.findNextTool(o);i&&i.focus()}get toolsContainers(){return Array.from(this.el.querySelectorAll("[tuiItem]"))}findPreviousTool(t){return!t||(0,Pt.PQ)(t)?t??null:(0,Pt.km)({initial:t,root:t,keyboard:!1})||(0,Pt.km)({initial:t,root:this.el,previous:!0,keyboard:!1})}findNextTool(t){return!t||(0,Pt.PQ)(t)?t??null:(0,Pt.km)({initial:t,root:this.el,keyboard:!1})}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵdir=b.FsC({type:t,selectors:[["","tuiToolbarNavigationManager",""]],hostBindings:function(t,e){1&t&&b.bIt("keydown.arrowRight.prevent",(function(){return e.onHorizontalNavigation(!1)}))("keydown.arrowLeft.prevent",(function(){return e.onHorizontalNavigation(!0)}))},standalone:!0}),e})();const _e=["dropdown"];function He(t,e){if(1&t){const t=b.RV6();b.qex(0),b.nrm(1,"button",2),b.j41(2,"div",3),b.bIt("focus",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onTopFocus())})),b.k0s(),b.j41(3,"div",3),b.bIt("focus",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onBottomFocus())})),b.k0s(),b.bVm()}if(2&t){const t=b.XpG();b.R7$(2),b.Y8G("tabIndex",t.focusable?0:-1),b.R7$(1),b.Y8G("tabIndex",t.focusable?0:-1)}}function je(t,e){1&t&&b.eu8(0)}function Fe(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",6)(1,"button",7),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(2);return b.Njj(e.undo())})),b.k0s(),b.j41(2,"button",8),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(2);return b.Njj(e.redo())})),b.k0s()()}if(2&t){const t=b.XpG().ngIf,e=b.XpG();b.R7$(1),b.Y8G("disabled",e.undoDisabled)("iconStart",e.icons.undo)("tuiHint",t.undo),b.R7$(1),b.Y8G("disabled",e.redoDisabled)("iconStart",e.icons.redo)("tuiHint",t.redo)}}function Ge(t,e){if(1&t&&(b.j41(0,"div",6),b.nrm(1,"tui-font-size",9),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("editor",t.editor)}}function Ve(t,e){if(1&t&&b.nrm(0,"tui-font-style",15),2&t){const t=b.XpG(3);b.Y8G("editor",t.editor)("enabledTools",t.toolsSet)}}function We(t,e){if(1&t&&b.nrm(0,"tui-align-content",9),2&t){const t=b.XpG(3);b.Y8G("editor",t.editor)}}function Xe(t,e){if(1&t&&b.nrm(0,"tui-list-configs",9),2&t){const t=b.XpG(3);b.Y8G("editor",t.editor)}}function Ue(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",16),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.toggleQuote())})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("disabled",e.unorderedList||e.orderedList)("iconStart",e.icons.quote)("tuiHint",t.quote)}}function Ke(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",17),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.onLink())})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("disabled",e.a||e.jumpAnchor)("iconStart",e.icons.link)("tuiHint",t.link)}}function Je(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",18),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.onLink("#"))})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("disabled",e.a||e.jumpAnchor)("iconStart",e.icons.anchor)("tuiHint",t.insertAnchor)}}function Ye(t,e){if(1&t){const t=b.RV6();b.qex(0),b.j41(1,"button",19),b.bIt("click",(function(){b.eBV(t);const e=b.sdS(3);return b.Njj(e.click())})),b.k0s(),b.j41(2,"input",20,21),b.bIt("change",(function(){b.eBV(t);const e=b.sdS(3),n=b.XpG(3);return b.Njj(n.onAttach(e))})),b.k0s(),b.bVm()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.R7$(1),b.Y8G("iconStart",e.icons.attach)("tuiHint",t.attach),b.R7$(1),b.Y8G("accept",e.attachOptions.accept)("multiple",e.attachOptions.multiple)("tabIndex",-1)}}function qe(t,e){if(1&t&&(b.j41(0,"div",6),b.DNE(1,Ve,1,2,"tui-font-style",10),b.DNE(2,We,1,1,"tui-align-content",11),b.DNE(3,Xe,1,1,"tui-list-configs",11),b.DNE(4,Ue,1,3,"button",12),b.DNE(5,Ke,1,3,"button",13),b.DNE(6,Je,1,3,"button",14),b.DNE(7,Ye,4,5,"ng-container",0),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("ngIf",t.formatEnabled),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Align)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.List)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Quote)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Link)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Anchor)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Attach))}}function Qe(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",19),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.toggleSubscript())})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("iconStart",e.icons.sub)("tuiHint",t.subscript)}}function Ze(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",19),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.toggleSuperscript())})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("iconStart",e.icons.sup)("tuiHint",t.superscript)}}function tn(t,e){if(1&t&&(b.j41(0,"div",6),b.DNE(1,Qe,1,2,"button",22),b.DNE(2,Ze,1,2,"button",22),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Sub)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Sup))}}function en(t,e){if(1&t&&b.nrm(0,"tui-text-color",24),2&t){const t=b.XpG(3);b.Y8G("colors",t.colors)("editor",t.editor)}}function nn(t,e){if(1&t&&b.nrm(0,"tui-highlight-color",24),2&t){const t=b.XpG(3);b.Y8G("colors",t.colors)("editor",t.editor)}}function on(t,e){if(1&t&&(b.j41(0,"div",6),b.DNE(1,en,1,2,"tui-text-color",23),b.DNE(2,nn,1,2,"tui-highlight-color",23),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Color)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Hilite))}}function rn(t,e){if(1&t&&b.nrm(0,"tui-code",9),2&t){const t=b.XpG(3);b.Y8G("editor",t.editor)}}function sn(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",27),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.onTeX())})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("iconStart",e.icons.tex)("tuiHint",t.tex)}}function an(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",28)(1,"button",29),b.bIt("click",(function(){b.eBV(t);const e=b.sdS(3);return b.Njj(e.click())})),b.k0s(),b.j41(2,"input",30,31),b.bIt("change",(function(){b.eBV(t);const e=b.sdS(3),n=b.XpG(3);return b.Njj(n.onImage(e))})),b.k0s()()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.R7$(1),b.Y8G("iconStart",e.icons.image)("tuiHint",t.image),b.R7$(1),b.Y8G("tabIndex",-1)}}function ln(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",19),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.insertHorizontalRule())})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("iconStart",e.icons.hr)("tuiHint",t.insertHorizontalRule)}}function cn(t,e){if(1&t&&(b.j41(0,"div",6),b.DNE(1,rn,1,1,"tui-code",11),b.DNE(2,sn,1,2,"button",25),b.DNE(3,an,4,3,"div",26),b.DNE(4,ln,1,2,"button",22),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Code)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Tex)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Img)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.HR))}}function dn(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",6)(1,"button",19),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(2);return b.Njj(e.removeFormat())})),b.k0s()()}if(2&t){const t=b.XpG().ngIf,e=b.XpG();b.R7$(1),b.Y8G("iconStart",e.icons.clear)("tuiHint",t.clear)}}function un(t,e){if(1&t&&(b.j41(0,"div",6),b.nrm(1,"tui-details",32)(2,"tui-details-remove",32),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("editor",t.editor),b.R7$(1),b.Y8G("editor",t.editor)}}function hn(t,e){if(1&t&&(b.j41(0,"div",6),b.nrm(1,"tui-editor-group-tool",32),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("editor",t.editor)}}function pn(t,e){if(1&t&&(b.j41(0,"div",6),b.nrm(1,"tui-table-create",32)(2,"tui-table-row-column-manager",32)(3,"tui-table-merge-cells",32),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("editor",t.editor),b.R7$(1),b.Y8G("editor",t.editor),b.R7$(1),b.Y8G("editor",t.editor)}}function fn(t,e){if(1&t&&(b.j41(0,"div",6),b.nrm(1,"tui-table-cell-color",24),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("colors",t.colors)("editor",t.editor)}}function mn(t,e){if(1&t&&(b.j41(0,"fieldset",4),b.DNE(1,Fe,3,6,"div",5),b.DNE(2,Ge,2,1,"div",5),b.DNE(3,qe,8,7,"div",5),b.DNE(4,tn,3,2,"div",5),b.DNE(5,on,3,2,"div",5),b.DNE(6,cn,5,4,"div",5),b.DNE(7,dn,2,2,"div",5),b.DNE(8,un,3,2,"div",5),b.DNE(9,hn,2,1,"div",5),b.DNE(10,pn,4,3,"div",5),b.DNE(11,fn,2,2,"div",5),b.j41(12,"div",6),b.SdG(13),b.k0s()()),2&t){const t=b.XpG();b.Y8G("disabled",t.disabled),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Undo)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Size)),b.R7$(1),b.Y8G("ngIf",t.firstBigBlockEnabled),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Sub)||t.enabled(t.editorTool.Sup)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Color)||t.enabled(t.editorTool.Hilite)),b.R7$(1),b.Y8G("ngIf",t.secondBigBlockEnabled),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Clear)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Details)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Group)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Table)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.CellColor))}}const gn=["*"];let bn=(()=>{var t;class e{constructor(){this.dropdowns=Mt.xQ,this.filesLoader=(0,b.WQX)(E,{optional:!0}),this.destroyRef=(0,b.WQX)(b.abz),this.imageLoader=(0,b.WQX)(B),this.options=(0,b.WQX)(x),this.editorTool=r,this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.attachOptions=(0,b.WQX)(O),this.texts$=(0,b.WQX)(N),this.toolsSet=new Set(s),this.inputEditor=null,this.colors=this.options.colors,this.disabled=!1,this.linkAdded=new b.bkB,this.texClicked=new b.bkB,this.fileAttached=new b.bkB,this.el=(0,b.WQX)(b.aKT,{optional:!0})?.nativeElement??null}set tools(t){this.toolsSet=new Set(t)}get editor(){return this.injectionEditor??this.inputEditor}get icons(){return this.options.icons}get focused(){return(0,Pt.Ij)(this.el)||!!this.dropdowns.find((({nativeElement:t})=>(0,Pt.Ij)(t)))}get focusable(){return!this.focused&&!this.disabled}get unorderedList(){return this.editor?.isActive("bulletList")??!1}get orderedList(){return this.editor?.isActive("orderedList")??!1}get blockquote(){return this.editor?.isActive("blockquote")??!1}get a(){return this.editor?.isActive("link")??!1}get jumpAnchor(){return this.editor?.isActive("jumpAnchor")??!1}get undoDisabled(){return this.editor?.undoDisabled()??!1}get redoDisabled(){return this.editor?.redoDisabled()??!1}get subscript(){return this.editor?.isActive("subscript")??!1}get superscript(){return this.editor?.isActive("superscript")??!1}get formatEnabled(){return this.enabled(r.Bold)||this.enabled(r.Italic)||this.enabled(r.Underline)||this.enabled(r.Strikethrough)}get firstBigBlockEnabled(){return this.formatEnabled||this.enabled(r.Align)||this.enabled(r.List)||this.enabled(r.Quote)||this.enabled(r.Link)||this.enabled(r.Anchor)||this.enabled(r.Attach)}get secondBigBlockEnabled(){return this.enabled(r.Code)||this.enabled(r.Tex)||this.enabled(r.Img)||this.enabled(r.HR)}onMouseDown(t,e){e.closest("button")||(t.preventDefault(),this.editor?.focus())}onBottomFocus(){this.focusLast()}onTopFocus(){this.focusFirst()}onImage(t){const e=t.files?.[0];t.value="",e&&this.imageLoader(e).pipe((0,Pe.s)(1),(0,Q.pQ)(this.destroyRef)).subscribe((t=>this.addImage(t)))}onAttach(t){const e=Array.from(t.files||[]);t.value="",e&&this.filesLoader?.(e).pipe((0,Pe.s)(1),(0,Q.pQ)(this.destroyRef)).subscribe((t=>this.fileAttached.emit(t)))}onTeX(){this.texClicked.emit()}onLink(t){this.editor?.toggleLink(t??"")}enabled(t){return this.toolsSet.has(t)}undo(){this.editor?.undo()}redo(){this.editor?.redo()}insertHorizontalRule(){this.editor?.setHorizontalRule()}removeFormat(){this.editor?.removeFormat()}toggleOrderedList(){this.editor?.toggleOrderedList()}toggleQuote(){this.editor?.toggleBlockquote()}toggleSubscript(){this.editor?.toggleSubscript()}toggleSuperscript(){this.editor?.toggleSuperscript()}addImage(t){this.editor?.setImage(t)}focusFirst(){const t=this.navigationManager?.findFirstFocusableTool();t&&t.focus()}focusLast(){const t=this.navigationManager?.findFirstFocusableTool(!0);t&&t.focus()}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-toolbar"]],viewQuery:function(t,e){if(1&t&&(b.GBs(Be,5),b.GBs(_e,5,b.aKT)),2&t){let t;b.mGM(t=b.lsd())&&(e.navigationManager=t.first),b.mGM(t=b.lsd())&&(e.dropdowns=t)}},hostAttrs:["role","toolbar"],hostVars:2,hostBindings:function(t,e){1&t&&b.bIt("mousedown",(function(t){return e.onMouseDown(t,t.target)})),2&t&&b.AVh("_disabled",e.disabled)},inputs:{inputEditor:["editor","inputEditor"],colors:"colors",disabled:"disabled",tools:"tools"},outputs:{linkAdded:"linkAdded",texClicked:"texClicked",fileAttached:"fileAttached"},standalone:!0,features:[b.aNF],ngContentSelectors:gn,decls:5,vars:7,consts:[[4,"ngIf"],["tuiToolbarNavigationManager","","class","t-tools-wrapper",3,"disabled",4,"ngIf"],["type","button",1,"t-prevent-parent-label-behavior"],[3,"tabIndex","focus"],["tuiToolbarNavigationManager","",1,"t-tools-wrapper",3,"disabled"],["class","t-block",4,"ngIf"],[1,"t-block"],["appearance","icon","automation-id","toolbar__undo-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"disabled","iconStart","tuiHint","click"],["appearance","icon","automation-id","toolbar__redo-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"disabled","iconStart","tuiHint","click"],["tuiItem","",1,"t-tool","t-wrapper",3,"editor"],["tuiItem","","class","t-tool t-wrapper",3,"editor","enabledTools",4,"ngIf"],["tuiItem","","class","t-tool t-wrapper",3,"editor",4,"ngIf"],["appearance","icon","automation-id","toolbar__quote-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button","class","t-tool t-tool_margin",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","automation-id","toolbar__link-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button","class","t-tool",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["tuiItem","",1,"t-tool","t-wrapper",3,"editor","enabledTools"],["appearance","icon","automation-id","toolbar__quote-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"disabled","iconStart","tuiHint","click"],["appearance","icon","automation-id","toolbar__link-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",1,"t-tool",3,"disabled","iconStart","tuiHint","click"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"iconStart","tuiHint","click"],["type","file",1,"t-file-upload",3,"accept","multiple","tabIndex","change"],["fileUpload",""],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button","class","t-tool t-tool_margin",3,"iconStart","tuiHint","click",4,"ngIf"],["tuiItem","","class","t-tool t-wrapper",3,"colors","editor",4,"ngIf"],["tuiItem","",1,"t-tool","t-wrapper",3,"colors","editor"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button","class","t-tool",3,"iconStart","tuiHint","click",4,"ngIf"],["tuiItem","","class","t-wrapper",4,"ngIf"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool",3,"iconStart","tuiHint","click"],["tuiItem","",1,"t-wrapper"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",1,"t-tool",3,"iconStart","tuiHint","click"],["accept","image/*","type","file",1,"t-image",3,"tabIndex","change"],["image",""],["tuiItem","",1,"t-tool","t-tool_margin",3,"editor"]],template:function(t,e){1&t&&(b.NAR(),b.DNE(0,He,4,2,"ng-container",0),b.DNE(1,je,1,0,"ng-container",0),b.nI1(2,"async"),b.DNE(3,mn,14,12,"fieldset",1),b.nI1(4,"async")),2&t&&(b.Y8G("ngIf",!e.disabled),b.R7$(1),b.Y8G("ngIf",b.bMT(2,3,null==e.editor?null:e.editor.stateChange$)),b.R7$(2),b.Y8G("ngIf",b.bMT(4,5,e.texts$)))},dependencies:[G.Jj,G.bT,Gt,K.p,Ut,Kt,Yt,ce,te,le,pe,jt.XZ,jt.$$,Bt.K,be,ve,Ee,Ae,$e,ze,Be],styles:['[_nghost-%COMP%]{position:relative;display:block;isolation:isolate}._disabled[_nghost-%COMP%]{pointer-events:none}tui-editor[_nghost-%COMP%] -no-combinator[_nghost-%COMP%] .t-tools-wrapper[_ngcontent-%COMP%]:has(.t-block:not(:empty)), tui-editor [_nghost-%COMP%] .t-tools-wrapper[_ngcontent-%COMP%]:has(.t-block:not(:empty)){border:none;outline:.0625rem solid var(--tui-border-normal)}.t-tools-wrapper[_ngcontent-%COMP%]{scrollbar-width:none;-ms-overflow-style:none;display:flex;overflow:auto;flex-wrap:wrap;padding:0;margin:0;border:0}.t-tools-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar, .t-tools-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{display:none}.t-tools-wrapper[_ngcontent-%COMP%]:has(.t-block:not(:empty)){padding:.25rem .75rem;border:.0625rem solid var(--tui-border-normal)}.t-tools-wrapper._disabled[_ngcontent-%COMP%]{pointer-events:none;opacity:var(--tui-disabled-opacity)}.t-block[_ngcontent-%COMP%]{display:flex;padding:.25rem 0}.t-block[_ngcontent-%COMP%]:empty{display:none}.t-block[_ngcontent-%COMP%]:not(:last-child):after{content:"";display:block;margin:0 .25rem;inline-size:.0625rem;background:var(--tui-background-neutral-1-pressed)}.t-tool[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}button.t-tool[_ngcontent-%COMP%]:hover, .t-tool[_ngcontent-%COMP%] button:hover{background:var(--tui-background-neutral-1-hover)}.t-tool_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-wrapper[_ngcontent-%COMP%]{position:relative;margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-font[_ngcontent-%COMP%]{padding:.3em 0;outline:none;inline-size:100%;pointer-events:none}.t-image[_ngcontent-%COMP%]{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;font-size:0;opacity:0;cursor:pointer}.t-image[_ngcontent-%COMP%]::-webkit-file-upload-button{display:none}.t-file-upload[_ngcontent-%COMP%]{display:none}.t-color-picker[_ngcontent-%COMP%] tui-hosted-dropdown, .t-color-picker[_ngcontent-%COMP%] tui-color-picker, .t-color-picker[_ngcontent-%COMP%] tui-color-edit{display:none}.t-prevent-parent-label-behavior[_ngcontent-%COMP%]{display:none}'],changeDetection:0}),e})();function yn(t){if(!t?.state?.selection)return{before:"",after:""};const{$from:e,$to:n}=t.state.selection;let o=e.nodeBefore?.textContent;return o=(o?.slice(((o?.lastIndexOf(" ")||o?.lastIndexOf("\n"))??0)+1)??"").trim(),{before:o,after:n.nodeAfter?.textContent.trim()??""}}function kn(t){const e=t.endContainer.nodeValue?.length??0;return t.endOffset-t.startOffset>0||t.endOffset-t.startOffset==0&&1===e||0!==t.startOffset&&e>1&&t.endOffset!==e}var vn=n(8283),wn=n(2489),Cn=n(8129),xn=n(1472),Sn=n(6661);let Mn=(()=>{var t;class e extends Dt.Ak{}return(t=e).ɵfac=function(){let e;return function(n){return(e||(e=b.xGo(t)))(n||t)}}(),t.ɵprov=b.jDH({token:t,factory:t.ɵfac}),e})();const Tn=[{provide:v,deps:[k],useFactory:t=>{const e=new _.m(1);return Promise.all(t).then((t=>e.next(t))).catch((()=>e.next([]))),e}},{provide:F,deps:[b.sFG],useFactory:t=>t.createElement("div")},{provide:H,deps:[F,v,j,W.Qc],useFactory:(t,e,n,o)=>(0,It.z)([n,e]).pipe((0,Pe.s)(1),(0,P.T)((([e,n])=>{try{return globalThis.document||(globalThis.document=o.document),new e({element:t,extensions:n})}catch{return null}})),(0,Sn.t)({bufferSize:1,refCount:!0}))},st,Mn];let On=(()=>{var t;class e extends Tt.cf{constructor(){super(...arguments),this.el=(0,b.WQX)(b.aKT).nativeElement,this.type="viewport"}getClientRect(){return this.el.getBoundingClientRect()}}return(t=e).ɵfac=function(){let e;return function(n){return(e||(e=b.xGo(t)))(n||t)}}(),t.ɵdir=b.FsC({type:t,selectors:[["","tuiEditorPortal",""]],standalone:!0,features:[b.Jv_([{provide:Ht.Hg,useExisting:Mn},(0,Ot.HY)(t)]),b.Vt3]}),e})(),En=(()=>{var t;class e extends Dt.mi{}return(t=e).ɵfac=function(){let e;return function(n){return(e||(e=b.xGo(t)))(n||t)}}(),t.ɵcmp=b.VBU({type:t,selectors:[["tui-editor-portal-host"]],standalone:!0,features:[b.Jv_([{provide:Dt.Ak,useExisting:Ht.Hg},{provide:Dt.mi,useExisting:t}]),b.Vt3,b.aNF],decls:2,vars:0,consts:[["viewContainer",""]],template:function(t,e){1&t&&b.eu8(0,null,0)},styles:["[_nghost-%COMP%]{position:absolute;top:0;left:0;display:block;block-size:100%;inline-size:100%;pointer-events:none}"],changeDetection:0}),e})();var An=n(6242);const In=["tuiDropdown"];function Nn(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-toolbar",8),b.bIt("fileAttached",(function(e){b.eBV(t);const n=b.XpG(2);return b.Njj(n.fileAttached.emit(e))})),b.SdG(1,1),b.k0s()}if(2&t){const t=b.XpG(2);b.Y8G("disabled",!t.interactive())("tools",t.tools)}}function Dn(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",9),b.bIt("mousedown",(function(e){b.eBV(t);const n=b.XpG(2);return b.Njj(n.focus(e))})),b.EFF(1),b.k0s()}if(2&t){const t=b.XpG(2);b.R7$(1),b.SpI(" ",t.exampleText," ")}}function Rn(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-scrollbar",13),b.bIt("mousedown",(function(e){b.eBV(t);const n=b.XpG(3);return b.Njj(n.focus(e))})),b.eu8(1,14),b.k0s()}if(2&t){b.XpG();const t=b.sdS(4);b.R7$(1),b.Y8G("ngTemplateOutlet",t)}}function $n(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-scrollbar",15),b.bIt("keydown",(function(e){b.eBV(t);const n=b.XpG(3);return b.Njj(n.focus(e))}))("mousedown",(function(e){b.eBV(t);const n=b.XpG(3);return b.Njj(n.focus(e))})),b.eu8(1,14),b.nrm(2,"tui-editor-portal-host"),b.k0s()}if(2&t){b.XpG();const t=b.sdS(4);b.R7$(1),b.Y8G("ngTemplateOutlet",t)}}function Ln(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-toolbar",8),b.bIt("fileAttached",(function(e){b.eBV(t);const n=b.XpG(5);return b.Njj(n.fileAttached.emit(e))})),b.SdG(1,2),b.k0s()}if(2&t){const t=b.XpG(5);b.Y8G("disabled",!t.interactive())("tools",t.tools)}}function zn(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-edit-link",21,22),b.bIt("addLink",(function(e){b.eBV(t);const n=b.sdS(1),o=b.XpG(5);return n.anchorMode?o.addAnchor(e):o.addLink(e),b.Njj(o.closeDropdown())}))("removeLink",(function(){b.eBV(t);const e=b.sdS(1),n=b.XpG(5);return e.anchorMode?n.removeAnchor():n.removeLink(),b.Njj(n.closeDropdown())})),b.k0s()}}function Pn(t,e){1&t&&(b.qex(0),b.SdG(1,3),b.bVm())}function Bn(t,e){if(1&t&&(b.j41(0,"div"),b.DNE(1,Ln,2,2,"tui-toolbar",4),b.DNE(2,zn,2,0,"tui-edit-link",20),b.DNE(3,Pn,2,0,"ng-container",7),b.k0s()),2&t){const t=b.XpG(3).ngIf,e=b.XpG();b.AVh("t-floating",e.floatingToolbar),b.R7$(1),b.Y8G("ngIf",t&&e.floatingToolbar),b.R7$(1),b.Y8G("ngIf",e.isLinkSelected),b.R7$(1),b.Y8G("ngIf",e.isMentionMode)}}function _n(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",16,17)(2,"div",18),b.bIt("valueChange",(function(e){b.eBV(t);const n=b.XpG(3);return b.Njj(n.onModelChange(e))})),b.k0s()(),b.DNE(3,Bn,4,5,"ng-template",null,19,b.C5r)}if(2&t){const t=b.sdS(4),e=b.XpG(3);b.Y8G("tuiDropdown",t)("tuiToolbarDropdown",e.dropdownSelectionHandler)("tuiToolbarDropdownPosition",e.floatingToolbar?"selection":"tag"),b.R7$(2),b.Y8G("editable",e.interactive())("value",e.firstInitialValue)}}function Hn(t,e){if(1&t&&(b.qex(0),b.DNE(1,Rn,2,1,"tui-scrollbar",10),b.DNE(2,$n,3,1,"tui-scrollbar",11),b.DNE(3,_n,5,5,"ng-template",null,12,b.C5r),b.bVm()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("ngIf",t.floatingToolbar),b.R7$(1),b.Y8G("ngIf",!t.floatingToolbar)}}function jn(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",2)(1,"div",3),b.DNE(2,Nn,2,2,"tui-toolbar",4),b.j41(3,"div",5),b.bIt("mousedown",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(n.focus(e))})),b.SdG(4),b.k0s(),b.DNE(5,Dn,2,1,"div",6),b.k0s(),b.DNE(6,Hn,5,2,"ng-container",7),b.k0s()}if(2&t){const t=e.ngIf,n=b.XpG();b.R7$(2),b.Y8G("ngIf",t&&!n.floatingToolbar),b.R7$(3),b.Y8G("ngIf",n.hasExampleText),b.R7$(1),b.Y8G("ngIf",t)}}const Fn=["*",[["tools"]],[["tools"]],[["mention"]]],Gn=["*","tools","tools","mention"];let Vn=(()=>{var t;class e extends Dt.OH{constructor(){super(...arguments),this.contentProcessor=(0,b.WQX)(T,{optional:!0}),this.doc=(0,b.WQX)(W.Qc)?.document??null,this.zone=(0,b.WQX)(b.SKi),this.destroy$=(0,b.WQX)(b.abz),this.options=(0,b.WQX)(x),this.editorLoaded$=(0,b.WQX)(H),this.sub=this.editorLoaded$.pipe((0,vn.c)(0),(0,Q.pQ)()).subscribe((()=>{this.hasMentionPlugin=!!this.editorService.getOriginTiptapEditor()?.extensionManager.extensions.find((t=>"mention"===t.name)),this.patchContentEditableElement(),this.listenResizeEvents()})),this.firstInitialValue="",this.exampleText=this.options.exampleText,this.floatingToolbar=this.options.floatingToolbar,this.tools=this.options.tools,this.fileAttached=new b.bkB,this.focusIn=new b.bkB,this.focusOut=new b.bkB,this.hasMentionPlugin=!1,this.hovered=(0,Q.ot)((0,wn.h)((0,Cn.R)((0,X.qW)(),"mouseenter").pipe((0,P.T)(Mt.z9)),(0,Cn.R)((0,X.qW)(),"mouseleave").pipe((0,P.T)(Mt.s_))).pipe((0,z.Eb)(this.cdr))),this.focused=(0,Rt.RM)(!1),this.m=(0,Rt.UP)(this.mode),this.s=(0,Rt.KC)((0,b.EWP)((()=>this.disabled()?"disabled":this.hovered()?"hover":null))),this.editorService=(0,b.WQX)(st),this.openDropdownWhen=t=>this.currentFocusedNodeIsTextAnchor(t)||this.currentFocusedNodeIsImageAnchor||this.isMentionMode}set readOnlyMode(t){this.readOnly.set(t)}get editor(){return this.editorService.getOriginTiptapEditor()?this.editorService:null}get nativeFocusableElement(){return this.el?.nativeElement?.querySelector("[contenteditable].ProseMirror")||null}get selectionState(){return yn(this.editor)}get mentionSuggestions(){const t=this.selectionState.before;return t?.startsWith("@")&&t.length>1&&t?.replace("@","")||""}get isMentionMode(){return this.hasMentionPlugin&&this.selectionState.before?.startsWith("@")}writeValue(t){const e=this.contentProcessor?.fromControlValue(t)??t;super.writeValue(e),this.firstInitialValue!==e&&(this.firstInitialValue=e??""),this.focused()||this.doc?.getSelection?.()?.removeAllRanges()}ngOnDestroy(){this.editor?.destroy()}get dropdownSelectionHandler(){return!this.focused()||this.readOnly()?Mt.s_:this.floatingToolbar?()=>""!==this.value().trim():this.openDropdownWhen}get hasExampleText(){return!!this.exampleText&&!this.value()&&!this.readOnly()}get isLinkSelected(){const t=this.doc?.getSelection()?.focusNode,e=t?.parentNode;return"a"===e?.nodeName.toLowerCase()||"a"===e?.parentNode?.nodeName.toLowerCase()||"a"===t?.nodeName.toLowerCase()||!!t?.parentElement?.closest("a")||!!t?.parentElement?.closest("tui-edit-link")||!!t?.parentElement?.closest("tui-dropdown")}onModelChange(t){const e=this.contentProcessor?.toControlValue(t)??t;e!==this.control.value&&this.onChange(e??"")}onActiveZone(t){this.focused.set(t),t?this.focusIn.emit():this.focusOut.emit()}addAnchor(t){this.editor?.setAnchor(t)}removeAnchor(){this.editor?.removeAnchor()}closeDropdown(){this.tuiDropdown?.toggle(!1)}addLink(t){this.editor?.selectClosest(),this.editor?.setLink(t)}removeLink(){this.editor?.unsetLink()}focus(t){this.nativeFocusableElement?.contains(t.target)||this.toolbar?.el?.contains(t.target)||(t.preventDefault(),this.nativeFocusableElement?.focus())}get focusNode(){return this.doc?.getSelection?.()?.focusNode??null}get currentFocusedNodeIsImageAnchor(){const t=this.focusNode?.childNodes[0]?.nodeName;return"A"===this.focusNode?.nodeName&&t&&["IMG","TUI-IMAGE-EDITOR"].includes(t)||!1}currentFocusedNodeIsTextAnchor(t){return"A"===this.focusNode?.nodeName||!!this.focusNode?.parentElement?.closest("tui-edit-link")||!!t.startContainer.parentElement?.closest("a")&&kn(t)}patchContentEditableElement(){this.nativeFocusableElement?.setAttribute("translate",this.options.translate),this.nativeFocusableElement?.setAttribute("spellcheck",String(this.options.spellcheck))}listenResizeEvents(){this.el?.nativeElement&&(0,Cn.R)(this.el.nativeElement,a).pipe((0,xn.c)(0),(0,z.rB)(this.zone),(0,Q.pQ)(this.destroy$)).subscribe((()=>this.editorService.valueChange$.next(this.editorService.getHTML())))}}return(t=e).ɵfac=function(){let e;return function(n){return(e||(e=b.xGo(t)))(n||t)}}(),t.ɵcmp=b.VBU({type:t,selectors:[["tui-editor"]],viewQuery:function(t,e){if(1&t&&(b.GBs(at,5,b.aKT),b.GBs(In,5),b.GBs(bn,5)),2&t){let t;b.mGM(t=b.lsd())&&(e.el=t.first),b.mGM(t=b.lsd())&&(e.tuiDropdown=t.first),b.mGM(t=b.lsd())&&(e.toolbar=t.first)}},hostAttrs:["ngSkipHydration","true"],hostBindings:function(t,e){1&t&&b.bIt("tuiActiveZoneChange",(function(t){return e.onActiveZone(t)}))("click",(function(t){return e.focus(t)}))},inputs:{exampleText:"exampleText",floatingToolbar:"floatingToolbar",tools:"tools",readOnlyMode:["readOnly","readOnlyMode"]},outputs:{fileAttached:"fileAttached",focusIn:"focusIn",focusOut:"focusOut"},standalone:!0,features:[b.Jv_([Tn,{provide:Rt.to,useValue:{appearance:"textfield"}},(0,U.fl)({delay:$t.mI,query:"[contenteditable].ProseMirror, input:not(.t-image, .t-file-upload), textarea, select"})]),b.Vt3,b.aNF,b.nM4([{directive:Rt.bC,inputs:["tuiAppearance","appearance"]},{directive:An.N,outputs:["tuiActiveZoneChange","tuiActiveZoneChange"]}])],ngContentSelectors:Gn,decls:3,vars:4,consts:[["class","t-wrapper",4,"ngIf"],[1,"t-hidden-editor",3,"content"],[1,"t-wrapper"],[1,"t-toolbar-wrapper"],[3,"disabled","tools","fileAttached",4,"ngIf"],[1,"t-editor-placeholder",3,"mousedown"],["class","t-editor-example-text",3,"mousedown",4,"ngIf"],[4,"ngIf"],[3,"disabled","tools","fileAttached"],[1,"t-editor-example-text",3,"mousedown"],["class","t-scrollbar",3,"mousedown",4,"ngIf"],["tuiEditorPortal","","class","t-scrollbar",3,"keydown","mousedown",4,"ngIf"],["editor",""],[1,"t-scrollbar",3,"mousedown"],[3,"ngTemplateOutlet"],["tuiEditorPortal","",1,"t-scrollbar",3,"keydown","mousedown"],["tuiDropdownLimitWidth","auto",3,"tuiDropdown","tuiToolbarDropdown","tuiToolbarDropdownPosition"],["tuiDropdown","tuiDropdown"],["tuiTiptapEditor","",1,"tui-editor-socket",3,"editable","value","valueChange"],["dropdown",""],[3,"addLink","removeLink",4,"ngIf"],[3,"addLink","removeLink"],["link",""]],template:function(t,e){1&t&&(b.NAR(Fn),b.DNE(0,jn,7,3,"div",0),b.nI1(1,"async"),b.nrm(2,"tui-editor-socket",1)),2&t&&(b.Y8G("ngIf",b.bMT(1,2,e.editorLoaded$)),b.R7$(2),b.Y8G("content",e.value()))},dependencies:[G.Jj,G.bT,G.T3,Ht.HY,Ht.pU,xt,Nt,On,En,zt,Y.N0,at,bn],styles:['[_nghost-%COMP%]{position:relative;display:block;isolation:isolate;font:var(--tui-font-text-m);border-radius:var(--tui-radius-m);max-block-size:inherit;min-block-size:10rem;box-sizing:border-box;overflow:auto}[_nghost-%COMP%]:after{content:"";display:table;clear:both}.t-wrapper[_ngcontent-%COMP%]{display:flex;block-size:100%;max-block-size:inherit;min-block-size:inherit;cursor:text;overflow:clip;flex-direction:column;border-radius:inherit}.t-editor-placeholder[_ngcontent-%COMP%]{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;font:var(--tui-font-text-s);color:var(--tui-text-secondary);pointer-events:none;will-change:transform;transform:translateY(-.25rem);inline-size:95%;font-size:.9375rem}.t-editor-placeholder_raised[_ngcontent-%COMP%]{transform:translateY(-.4375rem)}.t-editor-placeholder[_ngcontent-%COMP%]:not(:empty){margin:1rem 1rem -.625rem;min-block-size:1.625rem}.t-editor-placeholder[_ngcontent-%COMP%]:empty{margin-bottom:1rem}.t-editor-example-text[_ngcontent-%COMP%]{position:absolute;left:1rem;margin-top:.1875rem;color:var(--tui-text-secondary);letter-spacing:normal;text-transform:none}.t-scrollbar[_ngcontent-%COMP%]{display:flex;padding-bottom:.75rem;box-sizing:border-box;flex:1}.t-floating[_ngcontent-%COMP%], .t-floating[_ngcontent-%COMP%] .t-tools-wrapper{max-inline-size:var(--tui-floating-toolbar-max-width, 31.25rem);flex-wrap:nowrap}'],changeDetection:0}),e})();var Wn=n(6426);class Xn{constructor(t,e,n){const o=e.get(b.o8S),i=e.get(b.OM3).resolveComponentFactory(t);this.componentRef=i.create(e,[]),this.updateProps(n),o.attachView(this.componentRef.hostView)}get el(){return this.componentRef.injector.get(b.aKT)}get dom(){return this.el.nativeElement}updateProps(t){Object.entries(t).forEach((([t,e])=>{this.instance[t]=e}))}detectChanges(){this.componentRef.changeDetectorRef.detectChanges()}destroy(){this.componentRef.destroy()}get instance(){return this.componentRef.instance}}class Un{}class Kn extends Wn.NodeView{constructor(t,e,n){super(t,e,n),this.contentDOMElement=null}get dom(){return this.renderer.dom}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}mount(){const t=this.options.injector,e=t.get(G.qQ),n={editor:this.editor,node:this.node,decorations:this.decorations,selected:!1,extension:this.extension,getPos:()=>this.getPos(),updateAttributes:(t={})=>this.updateAttributes(t),deleteNode:()=>this.deleteNode(),view:this.view,innerDecorations:this.innerDecorations,HTMLAttributes:this.HTMLAttributes};this.editor.on("selectionUpdate",this.handleSelectionUpdate.bind(this)),this.renderer=new Xn(this.component,t,n),this.extension.config.draggable&&(this.renderer.el.nativeElement.ondragstart=t=>{this.onDragStart(t)});const o=this.node.isInline?"span":"div";this.contentDOMElement=this.node.isLeaf?null:e.createElement(o),this.contentDOMElement&&(this.contentDOMElement.style.whiteSpace="inherit",this.renderer.detectChanges()),this.appendContendDom()}update(t,e){return this.options.update?this.options.update(t,e):t.type===this.node.type&&(t===this.node&&this.decorations===e||(this.node=t,this.decorations=e,this.renderer.updateProps({node:t,decorations:e}),this.appendContendDom()),!0)}handleSelectionUpdate(){const{from:t,to:e}=this.editor.state.selection;t<=this.getPos()&&e>=this.getPos()+this.node.nodeSize?this.selectNode():this.deselectNode()}selectNode(){this.renderer.updateProps({selected:!0})}deselectNode(){this.renderer.updateProps({selected:!1})}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate.bind(this)),this.contentDOMElement=null}appendContendDom(){const t=this.dom.querySelector("[data-node-view-content]");this.contentDOMElement&&t&&!t.contains(this.contentDOMElement)&&t.appendChild(this.contentDOMElement)}}let Jn=(()=>{var t;class e extends Un{constructor(){super(...arguments),this.currentHeight=0,this.currentWidth=0}get node(){return this.localNode}set node(t){this.localNode=t,this.changeDetector.markForCheck()}get attrs(){return this.node?.attrs||{src:""}}get width(){return(this.currentWidth||this.attrs.width)??null}get height(){return(this.currentHeight||this.attrs.height)??null}}return(t=e).ɵfac=function(){let e;return function(n){return(e||(e=b.xGo(t)))(n||t)}}(),t.ɵdir=b.FsC({type:t,features:[b.Vt3]}),e})();var Yn=n(6625);const qn=["container"],Qn=function(){return[0,1]};function Zn(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",5),b.bIt("tuiSizeChange",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(n.sizeChange.emit(e))})),b.k0s()}2&t&&b.Y8G("tuiResizer",b.lJ4(1,Qn))}const to=function(t){return[t,0]},eo=function(){return[1,0]},no=["*"];let oo=(()=>{var t;class e{constructor(){this.autoHeight=!1,this.width=null,this.height=null,this.sizeChange=new b.bkB}get hostWidth(){return(0,w.sZ)(this.width)?(0,w.Pp)(this.width):this.width}get hostHeight(){return this.autoHeight?null:(0,w.sZ)(this.height)?(0,w.Pp)(this.height):this.height}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-editor-resizable"]],viewQuery:function(t,e){if(1&t&&b.GBs(qn,7),2&t){let t;b.mGM(t=b.lsd())&&(e.container=t.first)}},hostVars:4,hostBindings:function(t,e){2&t&&b.xc7("width",e.hostWidth)("height",e.hostHeight)},inputs:{autoHeight:"autoHeight",width:"width",height:"height"},outputs:{sizeChange:"sizeChange"},standalone:!0,features:[b.aNF],ngContentSelectors:no,decls:6,vars:8,consts:[["tuiResizable","",1,"t-resizable"],["container",""],[1,"t-handle","t-handle-left-side",3,"tuiResizer","tuiSizeChange"],["class","t-handle t-handle-bottom-side",3,"tuiResizer","tuiSizeChange",4,"ngIf"],[1,"t-handle","t-handle-right-side",3,"tuiResizer","tuiSizeChange"],[1,"t-handle","t-handle-bottom-side",3,"tuiResizer","tuiSizeChange"]],template:function(t,e){1&t&&(b.NAR(),b.j41(0,"div",0,1),b.SdG(2),b.j41(3,"div",2),b.bIt("tuiSizeChange",(function(t){return e.sizeChange.emit(t)})),b.k0s(),b.DNE(4,Zn,1,2,"div",3),b.j41(5,"div",4),b.bIt("tuiSizeChange",(function(t){return e.sizeChange.emit(t)})),b.k0s()()),2&t&&(b.AVh("t-resizable-auto-height",e.autoHeight),b.R7$(3),b.Y8G("tuiResizer",b.eq3(5,to,-1)),b.R7$(1),b.Y8G("ngIf",!e.autoHeight),b.R7$(1),b.Y8G("tuiResizer",b.lJ4(7,eo)))},dependencies:[G.bT,Yn.K,Yn.z],styles:['[_nghost-%COMP%]{position:relative;display:inline-block;box-sizing:border-box}[_nghost-%COMP%] .t-resizable[_ngcontent-%COMP%]{box-sizing:border-box}[_nghost-%COMP%] .t-resizable-auto-height[_ngcontent-%COMP%]{block-size:auto!important}[_nghost-%COMP%] iframe[_ngcontent-%COMP%]{display:inline;pointer-events:none}[_nghost-%COMP%]:hover .t-handle[_ngcontent-%COMP%]:after{opacity:1}.t-handle[_ngcontent-%COMP%]{position:absolute;top:0;display:flex;inline-size:.75rem;cursor:col-resize;justify-content:center;align-items:center;block-size:100%}.t-handle[_ngcontent-%COMP%]:after{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:"";inline-size:50%;block-size:33%;box-sizing:border-box;border-radius:var(--tui-radius-m);background:var(--tui-background-accent-opposite-hover);border:.0625rem solid var(--tui-background-neutral-1-hover);opacity:0}.t-handle-left-side[_ngcontent-%COMP%]{left:0}.t-handle-bottom-side[_ngcontent-%COMP%]{top:unset;bottom:.3125rem;block-size:.95rem;inline-size:100%}.t-handle-right-side[_ngcontent-%COMP%]{right:0}'],changeDetection:0}),e})();const io=Wn.Extension.create({name:"backgroundColor",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,renderHTML:({backgroundColor:t})=>t?{style:`background-color: ${t}`}:{},parseHTML:({style:t})=>t.backgroundColor.replaceAll(/['"]+/g,""),keepOnSplit:!1}}}]},addCommands:()=>({setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).run()})});function ro(t,e){const n=e??t.selection.$head.parent.textContent,o=t.doc.cut(t.selection.from,t.selection.to);return o.content.size?(0,Wn.getHTMLFromFragment)(o.content,t.schema):n}function so(t,e,n){const o=t.selection.$anchor;for(let i=o.depth;i>0;i--)if(o.node(i).type.name===n)return e&&e(t.tr.delete(o.before(i),o.after(i)).scrollIntoView()),!0;return!1}const ao=Wn.Node.create({name:"details",addOptions:()=>({HTMLAttributes:{}}),addAttributes:()=>({opened:{default:!0,keepOnSplit:!1,parseHTML:t=>"true"===t.getAttribute("data-opened"),renderHTML:t=>({"data-opened":t.opened})}}),content:"summary detailsContent",group:"block",draggable:!0,allowGapCursor:!0,isolating:!0,parseHTML:()=>[{tag:"details"}],renderHTML({HTMLAttributes:t}){return["div",{class:"t-details-wrapper t-details-wrapper_rendered"},["details",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t),0],["button",{class:"t-details-arrow"}]]},addNodeView(){return({node:t,getPos:e})=>{if(globalThis.document){const n=document.createElement("div"),o=document.createElement("details"),i=document.createElement("button"),r=document.createElement("button");n.className="t-details-wrapper",i.className="t-details-arrow",i.type="button",r.className="t-details-delete",r.type="button",o.open=t.attrs.opened;const s=n=>{const i=e?.()??0;o.open=!o.open,t.attrs.opened=o.open,n.target?.dispatchEvent(new CustomEvent(a,{bubbles:!0})),this.editor.chain().focus().setTextSelection(i).run()};return i.addEventListener("click",s),r.addEventListener("click",(t=>{i.removeEventListener("click",s);const n=e?.()??0;this.editor.chain().focus().setTextSelection(e?.()).run();const o=this.editor.state.selection.$anchor.nodeAfter,r=n+(o?.nodeSize??0);this.editor.isActive("summary")?this.editor.commands.deleteNode(this.type):this.editor.commands.deleteRange({from:n,to:r}),t.preventDefault()}),{capture:!0,once:!0}),n.append(o,i,r),{dom:n,contentDOM:o}}}},addCommands(){return{setDetails:()=>({commands:t,editor:e,state:n})=>{let o="";const i=this.editor.state.selection.$anchor.pos;return globalThis.document&&(o=(document.defaultView?.window.getSelection()?.toString().trim().length??0)>0?ro(n):"",setTimeout((()=>e.chain().focus().setTextSelection(i).run()))),t.insertContent(`

${o}

`)},removeDetails:()=>({editor:t,state:e,dispatch:n})=>(so(e,n,this.name),t.commands.focus("end"))}}}),lo=Wn.Node.create({name:"detailsContent",content:"block+",group:"block",allowGapCursor:!0,parseHTML:()=>[{tag:'div[data-type="details-content"]'}],renderHTML({HTMLAttributes:t}){return["div",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t,{"data-type":"details-content"}),0]}}),co=Wn.Node.create({name:"summary",addOptions:()=>({HTMLAttributes:{}}),content:"paragraph",group:"block",parseHTML:()=>[{tag:"summary"}],renderHTML({HTMLAttributes:t}){return["summary",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t),0]}}),uo=Wn.Extension.create({name:"fileLink",addCommands:()=>({setFileLink:t=>({state:e,chain:n})=>{const{selection:o}=e,i=' ';return(Math.abs(o.to-o.from)>0?n().toggleMark("link",{href:t.link},{extendEmptyMarkRange:!0}).setTextSelection(o.to).insertContent(i):n().insertContent(`${t.name}${i}`)).setTextSelection(o.to).run()}})}),ho=Wn.Extension.create({name:"fontColor",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontColor:{default:null,renderHTML:({fontColor:t})=>t?{style:`color: ${t}`}:{},parseHTML:({style:t})=>t.color.replaceAll(/['"]+/g,""),keepOnSplit:!1}}}]},addCommands:()=>({setFontColor:t=>({chain:e})=>e().setMark("textStyle",{fontColor:t}).run(),unsetFontColor:()=>({chain:t})=>t().setMark("textStyle",{fontColor:null}).run()})}),po=Wn.Extension.create({name:"fontSize",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:({style:t})=>t.fontSize,renderHTML:({fontSize:t})=>t?{style:`font-size: ${t}`}:{}}}}]},addCommands:()=>({setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()})});function fo(t){return t.isActive("bulletList")||t.isActive("orderedList")}const mo=Wn.Extension.create({name:"indent",priority:50,addKeyboardShortcuts(){return{Tab:()=>!fo(this.editor)&&this.editor.commands.insertContent("\t")}}}),go=Wn.Mark.create({name:"jumpAnchor",priority:1e3,keepOnSplit:!1,addAttributes:()=>({id:{default:null,parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}),parseHTML:()=>[{tag:'a[data-type="jump-anchor"]'}],renderHTML:({HTMLAttributes:t})=>["a",(0,Wn.mergeAttributes)({"data-type":"jump-anchor"},t),0],addCommands(){return{setAnchor:t=>({chain:e})=>e().extendMarkRange("jumpAnchor").setMark("jumpAnchor",{id:t}).run(),removeAnchor:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).run()}}});function bo(t){return t.reduce(((t,e)=>(t[e]={parseHTML:t=>t?.getAttribute(`${e}`)},t)),{})}const yo=(t,e)=>{for(const n in e)t[n]=e[n];return t},ko="numeric",vo="ascii",wo="alpha",Co="asciinumeric",xo="alphanumeric",So="domain",Mo="emoji",To="scheme",Oo="slashscheme",Eo="whitespace";function Ao(t,e){return t in e||(e[t]=[]),e[t]}function Io(t,e,n){e[ko]&&(e[Co]=!0,e[xo]=!0),e[vo]&&(e[Co]=!0,e[wo]=!0),e[Co]&&(e[xo]=!0),e[wo]&&(e[xo]=!0),e[xo]&&(e[So]=!0),e[Mo]&&(e[So]=!0);for(const o in e){const e=Ao(o,n);e.indexOf(t)<0&&e.push(t)}}function No(t){void 0===t&&(t=null),this.j={},this.jr=[],this.jd=null,this.t=t}No.groups={},No.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let n=0;n=0&&(n[o]=!0);return n}(s.t,o),n);Io(r,t,o)}else n&&Io(r,n,o);s.t=r}return i.j[t]=s,s}};const Do=(t,e,n,o,i)=>t.ta(e,n,o,i),Ro=(t,e,n,o,i)=>t.tr(e,n,o,i),$o=(t,e,n,o,i)=>t.ts(e,n,o,i),Lo=(t,e,n,o,i)=>t.tt(e,n,o,i),zo="WORD",Po="UWORD",Bo="LOCALHOST",_o="TLD",Ho="UTLD",jo="SCHEME",Fo="SLASH_SCHEME",Go="NUM",Vo="NL",Wo="OPENBRACE",Xo="CLOSEBRACE",Uo="OPENBRACKET",Ko="CLOSEBRACKET",Jo="OPENPAREN",Yo="CLOSEPAREN",qo="OPENANGLEBRACKET",Qo="CLOSEANGLEBRACKET",Zo="FULLWIDTHLEFTPAREN",ti="FULLWIDTHRIGHTPAREN",ei="LEFTCORNERBRACKET",ni="RIGHTCORNERBRACKET",oi="LEFTWHITECORNERBRACKET",ii="RIGHTWHITECORNERBRACKET",ri="FULLWIDTHLESSTHAN",si="FULLWIDTHGREATERTHAN",ai="AMPERSAND",li="APOSTROPHE",ci="ASTERISK",di="AT",ui="BACKSLASH",hi="BACKTICK",pi="CARET",fi="COLON",mi="COMMA",gi="DOLLAR",bi="DOT",yi="EQUALS",ki="EXCLAMATION",vi="HYPHEN",wi="PERCENT",Ci="PIPE",xi="PLUS",Si="POUND",Mi="QUERY",Ti="QUOTE",Oi="SEMI",Ei="SLASH",Ai="TILDE",Ii="UNDERSCORE",Ni="EMOJI",Di="SYM";var Ri=Object.freeze({__proto__:null,WORD:zo,UWORD:Po,LOCALHOST:Bo,TLD:_o,UTLD:Ho,SCHEME:jo,SLASH_SCHEME:Fo,NUM:Go,WS:"WS",NL:Vo,OPENBRACE:Wo,CLOSEBRACE:Xo,OPENBRACKET:Uo,CLOSEBRACKET:Ko,OPENPAREN:Jo,CLOSEPAREN:Yo,OPENANGLEBRACKET:qo,CLOSEANGLEBRACKET:Qo,FULLWIDTHLEFTPAREN:Zo,FULLWIDTHRIGHTPAREN:ti,LEFTCORNERBRACKET:ei,RIGHTCORNERBRACKET:ni,LEFTWHITECORNERBRACKET:oi,RIGHTWHITECORNERBRACKET:ii,FULLWIDTHLESSTHAN:ri,FULLWIDTHGREATERTHAN:si,AMPERSAND:ai,APOSTROPHE:li,ASTERISK:ci,AT:di,BACKSLASH:ui,BACKTICK:hi,CARET:pi,COLON:fi,COMMA:mi,DOLLAR:gi,DOT:bi,EQUALS:yi,EXCLAMATION:ki,HYPHEN:vi,PERCENT:wi,PIPE:Ci,PLUS:xi,POUND:Si,QUERY:Mi,QUOTE:Ti,SEMI:Oi,SLASH:Ei,TILDE:Ai,UNDERSCORE:Ii,EMOJI:Ni,SYM:Di});const $i=/[a-z]/,Li=/\p{L}/u,zi=/\p{Emoji}/u,Pi=/\d/,Bi=/\s/;let _i=null,Hi=null;function ji(t,e,n,o,i){let r;const s=e.length;for(let n=0;n=0;)i++;if(i>0){e.push(n.join(""));for(let e=parseInt(t.substring(o,o+i),10);e>0;e--)n.pop();o+=i}else n.push(t[o]),o++}return e}const Gi={defaultProtocol:"http",events:null,format:Wi,formatHref:Wi,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Vi(t,e){void 0===e&&(e=null);let n=yo({},Gi);t&&(n=yo(n,t instanceof Vi?t.o:t));const o=n.ignoreTags,i=[];for(let t=0;tt,check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const o=null!=e;let i=this.o[t];return i?("object"==typeof i?(i=n.t in i?i[n.t]:Gi[t],"function"==typeof i&&o&&(i=i(e,n))):"function"==typeof i&&o&&(i=i(e,n.t,n)),i):i},getObj(t,e,n){let o=this.o[t];return"function"==typeof o&&null!=e&&(o=o(e,n.t,n)),o},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}},Xi.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),o=t.get("format",e,this);return n&&o.length>n?o.substring(0,n)+"…":o},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t){return void 0===t&&(t=Gi.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),o=t.get("formatHref",n,this),i=t.get("tagName",n,e),r=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),d=t.getObj("attributes",n,e),u=t.getObj("events",n,e);return s.href=o,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),d&&yo(s,d),{tagName:i,attributes:s,content:r,eventListeners:u}}};const Ki=Ui("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ji=Ui("text"),Yi=Ui("nl"),qi=Ui("url",{isLink:!0,toHref(t){return void 0===t&&(t=Gi.defaultProtocol),this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Bo&&t[1].t===fi}}),Qi=t=>new No(t);function Zi(t,e,n){const o=n[0].s,i=n[n.length-1].e;return new t(e.slice(o,i),n)}const tr="undefined"!=typeof console&&console&&console.warn||(()=>{}),er={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function nr(t,e){if(void 0===e&&(e=!1),er.initialized&&tr(`linkifyjs: already initialized - will not register custom scheme "${t}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');er.customSchemes.push([t,e])}function or(t){return er.initialized||function(){er.scanner=function(t){void 0===t&&(t=[]);const e={};No.groups=e;const n=new No;null==_i&&(_i=Fi("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Hi&&(Hi=Fi("ελ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")),Lo(n,"'",li),Lo(n,"{",Wo),Lo(n,"}",Xo),Lo(n,"[",Uo),Lo(n,"]",Ko),Lo(n,"(",Jo),Lo(n,")",Yo),Lo(n,"<",qo),Lo(n,">",Qo),Lo(n,"(",Zo),Lo(n,")",ti),Lo(n,"「",ei),Lo(n,"」",ni),Lo(n,"『",oi),Lo(n,"』",ii),Lo(n,"<",ri),Lo(n,">",si),Lo(n,"&",ai),Lo(n,"*",ci),Lo(n,"@",di),Lo(n,"`",hi),Lo(n,"^",pi),Lo(n,":",fi),Lo(n,",",mi),Lo(n,"$",gi),Lo(n,".",bi),Lo(n,"=",yi),Lo(n,"!",ki),Lo(n,"-",vi),Lo(n,"%",wi),Lo(n,"|",Ci),Lo(n,"+",xi),Lo(n,"#",Si),Lo(n,"?",Mi),Lo(n,'"',Ti),Lo(n,"/",Ei),Lo(n,";",Oi),Lo(n,"~",Ai),Lo(n,"_",Ii),Lo(n,"\\",ui);const o=Ro(n,Pi,Go,{[ko]:!0});Ro(o,Pi,o);const i=Ro(n,$i,zo,{[vo]:!0});Ro(i,$i,i);const r=Ro(n,Li,Po,{[wo]:!0});Ro(r,$i),Ro(r,Li,r);const s=Ro(n,Bi,"WS",{[Eo]:!0});Lo(n,"\n",Vo,{[Eo]:!0}),Lo(s,"\n"),Ro(s,Bi,s);const a=Ro(n,zi,Ni,{[Mo]:!0});Ro(a,zi,a),Lo(a,"️",a);const l=Lo(a,"‍");Ro(l,zi,a);const c=[[$i,i]],d=[[$i,null],[Li,r]];for(let t=0;t<_i.length;t++)ji(n,_i[t],_o,zo,c);for(let t=0;tt[0]>e[0]?1:-1));for(let e=0;e=0?i[So]=!0:$i.test(o)?Pi.test(o)?i[Co]=!0:i[vo]=!0:i[ko]=!0,$o(n,o,o,i)}return $o(n,"localhost",Bo,{ascii:!0}),n.jd=new No(Di),{start:n,tokens:yo({groups:e},Ri)}}(er.customSchemes);for(let t=0;t=0&&h++,i++,d++;if(h<0)i-=d,i0&&(r.push(Zi(Ji,e,s)),s=[]),i-=h,d-=h;const t=u.t,o=n.slice(i-d,i);r.push(Zi(t,e,o))}}return s.length>0&&r.push(Zi(Ji,e,s)),r}(er.parser.start,t,function(t,e){const n=function(t){const e=[],n=t.length;let o=0;for(;o56319||o+1===n||(i=t.charCodeAt(o+1))<56320||i>57343?t[o]:t.slice(o,o+2);e.push(s),o+=s.length}return e}(e.replace(/[A-Z]/g,(t=>t.toLowerCase()))),o=n.length,i=[];let r=0,s=0;for(;s=0&&(u+=n[s].length,h++),c+=n[s].length,r+=n[s].length,s++;r-=u,s-=h,c-=u,i.push({t:d.t,v:e.slice(r-c,r),s:r-c,e:r})}return i}(er.scanner.start,t))}function ir(t,e,n){if(void 0===e&&(e=null),void 0===n&&(n=null),e&&"object"==typeof e){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const o=new Vi(n),i=or(t),r=[];for(let t=0;t{const e="string"==typeof t?t:t.scheme;e&&n.push(e)})),!t||t.replace(rr,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}const ar=Wn.Mark.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.protocols.forEach((t=>{"string"!=typeof t?nr(t.scheme,t.optionalSlashes):nr(t)}))},onDestroy(){No.groups={},er.scanner=null,er.parser=null,er.tokenQueue=[],er.pluginQueue=[],er.customSchemes=[],er.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:t=>!!t}),addAttributes(){return{href:{default:null,parseHTML:t=>t.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:t=>{const e=t.getAttribute("href");return!(!e||!sr(e,this.options.protocols))&&null}}]},renderHTML({HTMLAttributes:t}){return sr(t.href,this.options.protocols)?["a",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t),0]:["a",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>e().setMark(this.name,t).setMeta("preventAutolink",!0).run(),toggleLink:t=>({chain:e})=>e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[(0,Wn.markPasteRule)({find:t=>{const e=[];if(t){const{validate:n}=this.options,o=ir(t).filter((t=>t.isLink&&n(t.value)));o.length&&o.forEach((t=>e.push({text:t.value,data:{href:t.href},index:t.start})))}return e},type:this.type,getAttributes:t=>{var e;return{href:null===(e=t.data)||void 0===e?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[];return this.options.autolink&&t.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:this.options.validate},new nt.k_({key:new nt.hs("autolink"),appendTransaction:(t,n,o)=>{const i=t.some((t=>t.docChanged))&&!n.doc.eq(o.doc),r=t.some((t=>t.getMeta("preventAutolink")));if(!i||r)return;const{tr:s}=o,a=(0,Wn.combineTransactionSteps)(n.doc,[...t]);return(0,Wn.getChangedRanges)(a).forEach((({newRange:t})=>{const n=(0,Wn.findChildrenInRange)(o.doc,t,(t=>t.isTextblock));let i,r;if(n.length>1?(i=n[0],r=o.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0," ")):n.length&&o.doc.textBetween(t.from,t.to," "," ").endsWith(" ")&&(i=n[0],r=o.doc.textBetween(i.pos,t.to,void 0," ")),i&&r){const t=r.split(" ").filter((t=>""!==t));if(t.length<=0)return!1;const n=t[t.length-1],l=i.pos+r.lastIndexOf(n);if(!n)return!1;const c=or(n).map((t=>t.toObject(e.defaultProtocol)));if(!(1===(a=c).length?a[0].isLink:3===a.length&&a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;c.filter((t=>t.isLink)).map((t=>({...t,from:l+t.start+1,to:l+t.end+1}))).filter((t=>!o.schema.marks.code||!o.doc.rangeHasMark(t.from,t.to,o.schema.marks.code))).filter((t=>e.validate(t.value))).forEach((t=>{(0,Wn.getMarksBetween)(t.from,t.to,o.doc).some((t=>t.mark.type===e.type))||s.addMark(t.from,t.to,e.type.create({href:t.href}))}))}var a})),s.steps.length?s:void 0}}))),!0===this.options.openOnClick&&t.push(function(t){return new nt.k_({key:new nt.hs("handleClickLink"),props:{handleClick:(e,n,o)=>{var i,r;if(0!==o.button)return!1;if(!e.editable)return!1;let s=o.target;const a=[];for(;"DIV"!==s.nodeName;)a.push(s),s=s.parentNode;if(!a.find((t=>"A"===t.nodeName)))return!1;const l=(0,Wn.getAttributes)(e.state,t.type.name),c=o.target,d=null!==(i=null==c?void 0:c.href)&&void 0!==i?i:l.href,u=null!==(r=null==c?void 0:c.target)&&void 0!==r?r:l.target;return!(!c||!d||(window.open(d,u),0))}}})}({type:this.type})),this.options.linkOnPaste&&t.push(function(t){return new nt.k_({key:new nt.hs("handlePasteLink"),props:{handlePaste:(e,n,o)=>{const{state:i}=e,{selection:r}=i,{empty:s}=r;if(s)return!1;let a="";o.content.forEach((t=>{a+=t.textContent}));const l=ir(a,{defaultProtocol:t.defaultProtocol}).find((t=>t.isLink&&t.value===a));return!(!a||!l||(t.editor.commands.setMark(t.type,{href:l.href}),0))}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t;var e}}),lr=ar.extend({addAttributes(){return{...this.parent?.(),...bo(["download"])}},addCommands(){return{...this.parent?.(),toggleLink:t=>({chain:e,state:n})=>{{const{selection:o,doc:i,schema:r}=n,s=i.cut(o.to,o.to+1),a=" "===(0,Wn.getHTMLFromFragment)(s.content,r).replaceAll(/<\/?[^>]+(>|$)/g,""),l=e().toggleMark(this.name,t,{extendEmptyMarkRange:!0});return(a?l.setTextSelection(o.to-1):l.setTextSelection(o.to).insertContent(' ').setTextSelection(o.to-1)).run()}}}},addPasteRules(){return[(0,Wn.markPasteRule)({find:t=>ir(t).filter((t=>this.options.validate?.(t.value)??!0)).filter((t=>t.isLink)).map((t=>({text:t.value,index:t.start,data:t}))),type:this.type,getAttributes:t=>({href:t.data?.href})})]}}).configure({openOnClick:!1}),cr=Wn.Extension.create({name:"customEnter",addKeyboardShortcuts(){return{Enter:({editor:t})=>t.isActive("summary")?(t.commands.selectNodeForward(),t?.commands.focus((t?.state.selection.anchor??0)+1),globalThis.document&&t.view.nodeDOM(t.state.selection.anchor)?.parentElement?.closest("details")?.querySelector('[data-type="details-content"]')?.prepend(document.createElement("p")),!1):this.editor.chain().createParagraphNear().run()}}}),dr=n(3161).d.extend({addCommands(){return{setHorizontalRule:()=>({chain:t,state:e,editor:n})=>{const{selection:o}=e,{$from:i,$to:r}=o,s=t();return!n.isActive("summary")&&(0===i.parentOffset?(s.insertContentAt({from:Math.max(i.pos-1,0),to:r.pos},"

"),s.insertContentAt({from:Math.max(i.pos-1,0),to:r.pos},{type:this.name})):(0,Wn.isNodeSelection)(o)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command((({tr:t,dispatch:e})=>{if(e){const{$to:e}=t.selection,n=e.end();if(e.nodeAfter)e.nodeAfter.isTextblock?t.setSelection(nt.U3.create(t.doc,e.pos+1)):e.nodeAfter.isBlock?t.setSelection(nt.nh.create(t.doc,e.pos)):t.setSelection(nt.U3.create(t.doc,e.pos));else{const o=e.parent.type.contentMatch.defaultType?.create();o&&(t.insert(n,o),t.setSelection(nt.U3.create(t.doc,n+1)))}t.scrollIntoView()}return!0})).run())}}}});var ur=n(7477),hr=n(7417),pr=n(7371),fr=n(9319),mr=n(6927),gr=n(9515),br=n(1985),yr=n(9221),kr=n(7481),vr=n(1988),wr=n(9322),Cr=n(2100),xr=n(6542),Sr=n(3808),Mr=n(7308),Tr=n(5261),Or=n(9534);const Er=/^\s*(\[([( |x])?\])\s$/,Ar=Wn.Node.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return""===e||"true"===e},renderHTML:t=>({"data-checked":t.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:o})=>{const i=document.createElement("li"),r=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return r.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",(t=>t.preventDefault())),a.addEventListener("change",(e=>{if(!o.isEditable&&!this.options.onReadOnlyChecked)return void(a.checked=!a.checked);const{checked:i}=e.target;o.isEditable&&"function"==typeof n&&o.chain().focus(void 0,{scrollIntoView:!1}).command((({tr:t})=>{const e=n();if("number"!=typeof e)return!1;const o=t.doc.nodeAt(e);return t.setNodeMarkup(e,void 0,{...null==o?void 0:o.attrs,checked:i}),!0})).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,i)||(a.checked=!a.checked))})),Object.entries(this.options.HTMLAttributes).forEach((([t,e])=>{i.setAttribute(t,e)})),i.dataset.checked=t.attrs.checked,t.attrs.checked&&a.setAttribute("checked","checked"),r.append(a,s),i.append(r,l),Object.entries(e).forEach((([t,e])=>{i.setAttribute(t,e)})),{dom:i,contentDOM:l,update:t=>t.type===this.type&&(i.dataset.checked=t.attrs.checked,t.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[(0,Wn.wrappingInputRule)({find:Er,type:this.type,getAttributes:t=>({checked:"x"===t[t.length-1]})})]}}),Ir=Wn.Node.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});var Nr=n(8777);const Dr=Wn.Extension.create({name:"starterKit",addExtensions(){const t=[],e=this.options;return!1!==e?.blockquote&&t.push(ur.Cv.configure(e?.blockquote)),!1!==e?.bold&&t.push(hr.yN.configure(e?.bold)),!1!==e?.bulletList&&t.push(pr.Rg.configure(e?.bulletList)),!1!==e?.code&&t.push(fr.Cy.configure(e?.code)),!1!==e?.codeBlock&&t.push(mr.NG.configure(e?.codeBlock)),!1!==e?.document&&t.push(gr.y.configure(e?.document)),!1!==e?.dropcursor&&t.push(br.Q.configure(e?.dropcursor)),!1!==e?.gapcursor&&t.push(yr.v.configure({allowGapCursor:!0,...e?.gapcursor??{}})),!1!==e?.hardBreak&&t.push(kr.B.configure(e?.hardBreak)),!1!==e?.heading&&t.push(vr.Heading.configure({levels:[1,2,3,4,5,6],...e?.heading}).extend({addKeyboardShortcuts(){return this.options.levels.reduce(((t,e)=>({...t||{},[`Mod-Alt-${e}`]:()=>this?.editor.commands.toggleHeading({level:e})})),{})}})),!1!==e?.history&&t.push(wr.B.configure({depth:100,newGroupDelay:500,...e?.history})),!1!==e?.horizontalRule&&t.push(dr.configure(e?.horizontalRule)),!1!==e?.italic&&t.push(Cr.J2.configure(e?.italic)),!1!==e?.listItem&&t.push(xr.c.configure(e?.listItem)),!1!==e?.taskList&&t.push(Ir.configure(e?.taskList)),!1!==e?.taskItem&&t.push(Ar.configure({nested:!0,...e?.taskItem})),!1!==e?.orderedList&&t.push(Sr._J.configure(e?.orderedList)),!1!==e?.paragraph&&t.push(Mr.f.configure(e?.paragraph)),!1!==e?.strike&&t.push(Or.n.configure(e?.strike)),!1!==e?.text&&t.push(Nr.E.configure(e?.text)),!1!==e?.placeholder&&t.push(Tr.Placeholder.configure({emptyNodeClass:"t-editor-placeholder",includeChildren:!0,showOnlyCurrent:!0,showOnlyWhenEditable:!0,placeholder:"",...e?.placeholder??{}})),!1!==e?.enter&&t.push(cr),t}});var Rr,$r,Lr=n(9939),zr=n(7887),Pr=n(4103),Br=n(4238);if("undefined"!=typeof WeakMap){let t=new WeakMap;Rr=e=>t.get(e),$r=(e,n)=>(t.set(e,n),n)}else{const t=[],e=10;let n=0;Rr=e=>{for(let n=0;n(n==e&&(n=0),t[n++]=o,t[n++]=i)}var _r=class{constructor(t,e,n,o){this.width=t,this.height=e,this.map=n,this.problems=o}findCell(t){for(let e=0;eo&&(r+=i.attrs.colspan)}}for(let t=0;t1&&(n=!0)}-1==e?e=r:e!=r&&(e=Math.max(e,r))}return e}(t),n=t.childCount,o=[];let i=0,r=null;const s=[];for(let t=0,i=e*n;t=n){(r||(r=[])).push({type:"overlong_rowspan",pos:l,n:h-t});break}const c=i+t*e;for(let t=0;t0;e--)if("row"==t.node(e).type.spec.tableRole)return t.node(0).resolve(t.before(e+1));return null}function Vr(t){const e=t.selection.$head;for(let t=e.depth;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return!0;return!1}function Wr(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&"cell"==e.node.type.spec.tableRole)return e.$anchor;const n=Gr(e.$head)||function(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const o=e.type.spec.tableRole;if("cell"==o||"header_cell"==o)return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const o=e.type.spec.tableRole;if("cell"==o||"header_cell"==o)return t.doc.resolve(n-e.nodeSize)}}(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Xr(t){return"row"==t.parent.type.spec.tableRole&&!!t.nodeAfter}function Ur(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Kr(t,e,n){const o=t.node(-1),i=_r.get(o),r=t.start(-1),s=i.nextCell(t.pos-r,e,n);return null==s?null:t.node(0).resolve(r+s)}function Jr(t,e,n=1){const o={...t,colspan:t.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,n),o.colwidth.some((t=>t>0))||(o.colwidth=null)),o}function Yr(t,e,n=1){const o={...t,colspan:t.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let t=0;tt!=e.pos-i));a.unshift(e.pos-i);const l=a.map((t=>{const e=n.nodeAt(t);if(!e)throw RangeError(`No cell with offset ${t} found`);const o=i+t+1;return new nt.yn(s.resolve(o),s.resolve(o+e.content.size))}));super(l[0].$from,l[0].$to,l),this.$anchorCell=t,this.$headCell=e}map(e,n){const o=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Xr(o)&&Xr(i)&&Ur(o,i)){const e=this.$anchorCell.node(-1)!=o.node(-1);return e&&this.isRowSelection()?t.rowSelection(o,i):e&&this.isColSelection()?t.colSelection(o,i):new t(o,i)}return nt.U3.between(o,i)}content(){const t=this.$anchorCell.node(-1),e=_r.get(t),n=this.$anchorCell.start(-1),o=e.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},r=[];for(let n=o.top;n0||d>0){let t=l.attrs;if(c>0&&(t=Jr(t,0,c)),d>0&&(t=Jr(t,t.colspan-d,d)),a.lefto.bottom){const t={...l.attrs,rowspan:Math.min(a.bottom,o.bottom)-Math.max(a.top,o.top)};l=a.top0)return!1;const n=t+this.$anchorCell.nodeAfter.attrs.rowspan,o=e+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const o=e.node(-1),i=_r.get(o),r=e.start(-1),s=i.findCell(e.pos-r),a=i.findCell(n.pos-r),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(r+i.map[s.left])),a.bottom0&&(n=l.resolve(r+i.map[a.left])),s.bottom0)return!1;const r=o+this.$anchorCell.nodeAfter.attrs.colspan,s=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(r,s)==e.width}eq(e){return e instanceof t&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const o=e.node(-1),i=_r.get(o),r=e.start(-1),s=i.findCell(e.pos-r),a=i.findCell(n.pos-r),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(r+i.map[s.top*i.width])),a.right0&&(n=l.resolve(r+i.map[a.top*i.width])),s.right{e.push(zr.NZ.node(n,n+t.nodeSize,{class:"selectedCell"}))})),zr.zF.create(t.doc,e)}var ts=new nt.hs("fix-tables");function es(t,e,n,o){const i=t.childCount,r=e.childCount;t:for(let s=0,a=0;s{"table"==e.type.spec.tableRole&&(n=function(t,e,n,o){const i=_r.get(e);if(!i.problems)return o;o||(o=t.tr);const r=[];for(let t=0;t0){let e="cell";n.firstChild&&(e=n.firstChild.type.spec.tableRole);const r=[];for(let n=0;n0?-1:0;(function(t,e,n){const o=jr(e.type.schema).header_cell;for(let i=0;i0&&i0&&e.map[a-1]==l||i0?-1:0;(function(t,e,n){var o;const i=jr(e.type.schema).header_cell;for(let r=0;r0&&i0&&c==e.map[s-e.width]){const e=n.nodeAt(c).attrs;t.setNodeMarkup(t.mapping.slice(a).map(c+o),null,{...e,rowspan:e.rowspan-1}),r+=e.colspan-1}else if(i0&&n[r]==n[r-1]||o.right0&&n[i]==n[i-t]||o.bottomn[t.type.spec.tableRole],(t,e)=>{var n;const i=t.selection;let r,s;if(i instanceof qr){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;r=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(r=function(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if("cell"===n||"header_cell"===n)return t.node(e)}return null}(i.$from),!r)return!1;s=null==(n=Gr(i.$from))?void 0:n.pos}if(null==r||null==s)return!1;if(1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(e){let n=r.attrs;const a=[],l=n.colwidth;n.rowspan>1&&(n={...n,rowspan:1}),n.colspan>1&&(n={...n,colspan:1});const c=os(t),d=t.tr;for(let t=0;ti.table.nodeAt(t)));for(let t=0;t{const e=t+i.tableStart,n=r.doc.nodeAt(e);n&&r.setNodeMarkup(e,d,n.attrs)})),n(r)}return!0}}hs("row",{useDeprecatedLogic:!0}),hs("column",{useDeprecatedLogic:!0});var ps=hs("cell",{useDeprecatedLogic:!0});function fs(t){return function(e,n){if(!Vr(e))return!1;const o=function(t,e){if(e<0){const e=t.nodeBefore;if(e)return t.pos-e.nodeSize;for(let e=t.index(-1)-1,n=t.before();e>=0;e--){const o=t.node(-1).child(e),i=o.lastChild;if(i)return n-1-i.nodeSize;n-=o.nodeSize}}else{if(t.index(){t.content.eq(i)||o.replace(o.mapping.map(e+1),o.mapping.map(e+t.nodeSize-1),new Lr.Ji(i,0,0))})),o.docChanged&&e(o)}return!0}function gs(t,e){const n=t.createAndFill();return new Br.dL(n).replace(0,n.content.size,e).doc}function bs(t,e,n,o,i,r,s,a){if(0==s||s==e.height)return!1;let l=!1;for(let c=i;ce.width)for(let r=0,d=0;re.height){const d=[];for(let t=0,o=(e.height-1)*e.width;t=e.width)&&n.nodeAt(e.map[o+t]).type==a.header_cell;d.push(i?c||(c=a.header_cell.createAndFill()):l||(l=a.cell.createAndFill()))}const u=a.row.create(null,Lr.FK.from(d)),h=[];for(let t=e.height;t{if(!i)return!1;const r=n.selection;if(r instanceof qr)return ws(n,o,nt.LN.near(r.$headCell,e));if("horiz"!=t&&!r.empty)return!1;const s=Os(i,t,e);if(null==s)return!1;if("horiz"==t)return ws(n,o,nt.LN.near(n.doc.resolve(r.head+e),e));{const i=n.doc.resolve(s),r=Kr(i,t,e);let a;return a=r?nt.LN.near(r,1):e<0?nt.LN.near(n.doc.resolve(i.before(-1)),-1):nt.LN.near(n.doc.resolve(i.after(-1)),1),ws(n,o,a)}}}function xs(t,e){return(n,o,i)=>{if(!i)return!1;const r=n.selection;let s;if(r instanceof qr)s=r;else{const o=Os(i,t,e);if(null==o)return!1;s=new qr(n.doc.resolve(o))}const a=Kr(s.$headCell,t,e);return!!a&&ws(n,o,new qr(s.$anchorCell,a))}}function Ss(t,e){const n=Gr(t.state.doc.resolve(e));return!!n&&(t.dispatch(t.state.tr.setSelection(new qr(n))),!0)}function Ms(t,e,n){if(!Vr(t.state))return!1;let o=function(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:o}=t;for(;1==e.childCount&&(n>0&&o>0||"table"==e.child(0).type.spec.tableRole);)n--,o--,e=e.child(0).content;const i=e.child(0),r=i.type.spec.tableRole,s=i.type.schema,a=[];if("row"==r)for(let t=0;t=0;e--){const{rowspan:i,colspan:r}=o.child(e).attrs;for(let e=t;e=e.length&&e.push(Lr.FK.empty),n[i]o&&(a=a.type.createChecked(Jr(a.attrs,a.attrs.colspan,n+a.attrs.colspan-o),a.content)),s.push(a),n+=a.attrs.colspan;for(let n=1;ni&&(e=e.type.create({...e.attrs,rowspan:Math.max(1,i-e.attrs.rowspan)},e.content)),s.push(e)}t.push(Lr.FK.from(s))}n=t,e=i}return{width:t,height:e,rows:n}}(o,s.right-s.left,s.bottom-s.top),ks(t.state,t.dispatch,r,s,o),!0}if(o){const e=Wr(t.state),n=e.start(-1);return ks(t.state,t.dispatch,n,_r.get(e.node(-1)).findCell(e.pos-n),o),!0}return!1}function Ts(t,e){var n;if(e.ctrlKey||e.metaKey)return;const o=Es(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof qr)r(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&null!=(i=Gr(t.state.selection.$anchor))&&(null==(n=As(t,e))?void 0:n.pos)!=i.pos)r(i,e),e.preventDefault();else if(!o)return;function r(e,n){let o=As(t,n);const i=null==Fr.getState(t.state);if(!o||!Ur(e,o)){if(!i)return;o=e}const r=new qr(e,o);if(i||!t.state.selection.eq(r)){const n=t.state.tr.setSelection(r);i&&n.setMeta(Fr,e.pos),t.dispatch(n)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),null!=Fr.getState(t.state)&&t.dispatch(t.state.tr.setMeta(Fr,-1))}function a(n){const i=n,a=Fr.getState(t.state);let l;if(null!=a)l=t.state.doc.resolve(a);else if(Es(t,i.target)!=o&&(l=As(t,e),!l))return s();l&&r(l,i)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function Os(t,e,n){if(!(t.state.selection instanceof nt.U3))return null;const{$head:o}=t.state.selection;for(let i=o.depth-1;i>=0;i--){const r=o.node(i);if((n<0?o.index(i):o.indexAfter(i))!=(n<0?0:r.childCount))return null;if("cell"==r.type.spec.tableRole||"header_cell"==r.type.spec.tableRole){const r=o.before(i),s="vert"==e?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(s)?r:null}}return null}function Es(t,e){for(;e&&e!=t.dom;e=e.parentNode)if("TD"==e.nodeName||"TH"==e.nodeName)return e;return null}function As(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Gr(t.state.doc.resolve(n.pos)):null}var Is=class{constructor(t,e){this.node=t,this.cellMinWidth=e,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")),Ns(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type==this.node.type&&(this.node=t,Ns(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){return"attributes"==t.type&&(t.target==this.table||this.colgroup.contains(t.target))}};function Ns(t,e,n,o,i,r){var s;let a=0,l=!0,c=e.firstChild;const d=t.firstChild;if(d){for(let t=0,n=0;tnew n(t,e,o)),new $s(-1,!1)},apply:(t,e)=>e.apply(t)},props:{attributes:t=>{const e=Ds.getState(t);return e&&e.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(e,n)=>{!function(t,e,n,o,i){const r=Ds.getState(t.state);if(r&&!r.dragging){const o=function(t){for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}(e.target);let s=-1;if(o){const{left:i,right:r}=o.getBoundingClientRect();e.clientX-i<=n?s=Ls(t,e,"left",n):r-e.clientX<=n&&(s=Ls(t,e,"right",n))}if(s!=r.activeHandle){if(!i&&-1!==s){const e=t.state.doc.resolve(s),n=e.node(-1),o=_r.get(n),i=e.start(-1);if(o.colCount(e.pos-i)+e.nodeAfter.attrs.colspan-1==o.width-1)return}Ps(t,s)}}}(e,n,t,0,o)},mouseleave:t=>{!function(t){const e=Ds.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Ps(t,-1)}(t)},mousedown:(t,n)=>{!function(t,e,n){var o;const i=null!=(o=t.dom.ownerDocument.defaultView)?o:window,r=Ds.getState(t.state);if(!r||-1==r.activeHandle||r.dragging)return!1;const s=t.state.doc.nodeAt(r.activeHandle),a=function(t,e,{colspan:n,colwidth:o}){const i=o&&o[o.length-1];if(i)return i;const r=t.domAtPos(e);let s=r.node.childNodes[r.offset].offsetWidth,a=n;if(o)for(let t=0;t{const e=Ds.getState(t);if(e&&e.activeHandle>-1)return function(t,e){const n=[],o=t.doc.resolve(e),i=o.node(-1);if(!i)return zr.zF.empty;const r=_r.get(i),s=o.start(-1),a=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let t=0;t-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return Xr(e.doc.resolve(o))||(o=-1),new t(o,n.dragging)}return n}};function Ls(t,e,n,o){const i="right"==n?-o:o,r=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!r)return-1;const{pos:s}=r,a=Gr(t.state.doc.resolve(s));if(!a)return-1;if("right"==n)return a.pos;const l=_r.get(a.node(-1)),c=a.start(-1),d=l.map.indexOf(a.pos-c);return d%l.width==0?-1:c+l.map[d-1]}function zs(t,e,n){const o=e.clientX-t.startX;return Math.max(n,t.startWidth+o)}function Ps(t,e){t.dispatch(t.state.tr.setMeta(Ds,{setHandle:e}))}function Bs({allowTableNodeSelection:t=!1}={}){return new nt.k_({key:Fr,state:{init:()=>null,apply(t,e){const n=t.getMeta(Fr);if(null!=n)return-1==n?null:n;if(null==e||!t.docChanged)return e;const{deleted:o,pos:i}=t.mapping.mapResult(e);return o?null:i}},props:{decorations:Zr,handleDOMEvents:{mousedown:Ts},createSelectionBetween:t=>null!=Fr.getState(t.state)?t.state.selection:null,handleTripleClick:Ss,handleKeyDown:vs,handlePaste:Ms},appendTransaction:(e,n,o)=>function(t,e,n){const o=(e||t).selection,i=(e||t).doc;let r,s;if(o instanceof nt.nh&&(s=o.node.type.spec.tableRole)){if("cell"==s||"header_cell"==s)r=qr.create(i,o.from);else if("row"==s){const t=i.resolve(o.from+1);r=qr.rowSelection(t,t)}else if(!n){const t=_r.get(o.node),e=o.from+1,n=e+t.map[t.width*t.height-1];r=qr.create(i,e+1,n)}}else o instanceof nt.U3&&function({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(i+1)=0&&!(e.before(t+1)>e.start(t));t--,o--);return n==o&&/row|table/.test(t.node(i).type.spec.tableRole)}(o)?r=nt.U3.create(i,o.from):o instanceof nt.U3&&function({$from:t,$to:e}){let n,o;for(let e=t.depth;e>0;e--){const o=t.node(e);if("cell"===o.type.spec.tableRole||"header_cell"===o.type.spec.tableRole){n=o;break}}for(let t=e.depth;t>0;t--){const n=e.node(t);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){o=n;break}}return n!==o&&0===e.parentOffset}(o)&&(r=nt.U3.create(i,o.$from.start(),o.$from.end()));return r&&(e||(e=t.tr)).setSelection(r),e}(o,ns(o,n),t)})}function _s(t,e,n,o,i,r){let s=0,a=!0,l=e.firstChild;const c=t.firstChild;for(let t=0,n=0;t{const{selection:e}=t.state;if(!(e instanceof qr))return!1;let n=0;const o=(0,Wn.findParentNodeClosestToPos)(e.ranges[0].$from,(t=>"table"===t.type.name));return null==o||o.node.descendants((t=>{if("table"===t.type.name)return!1;["tableCell","tableHeader"].includes(t.type.name)&&(n+=1)})),n===e.ranges.length&&(t.commands.deleteTable(),!0)},Vs=Wn.Node.create({name:"table",addOptions:()=>({HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:Hs,lastColumnResizable:!0,allowTableNodeSelection:!1}),content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML:()=>[{tag:"table"}],renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:o,tableMinWidth:i}=js(t,this.options.cellMinWidth);return["table",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,e,{style:o?`width: ${o}`:`min-width: ${i}`}),n,["tbody",0]]},addCommands:()=>({insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:o,dispatch:i,editor:r})=>{const s=function(t,e,n,o,i){const r=function(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach((n=>{const o=t.nodes[n];o.spec.tableRole&&(e[o.spec.tableRole]=o)})),t.cached.tableNodeTypes=e,e}(t),s=[],a=[];for(let t=0;t({state:t,dispatch:e})=>function(t,e){if(!Vr(t))return!1;if(e){const n=os(t);e(is(t.tr,n,n.left))}return!0}(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>function(t,e){if(!Vr(t))return!1;if(e){const n=os(t);e(is(t.tr,n,n.right))}return!0}(t,e),deleteColumn:()=>({state:t,dispatch:e})=>function(t,e){if(!Vr(t))return!1;if(e){const n=os(t),o=t.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let t=n.right-1;rs(o,n,t),t!=n.left;t--){const t=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!t)throw RangeError("No table found");n.table=t,n.map=_r.get(t)}e(o)}return!0}(t,e),addRowBefore:()=>({state:t,dispatch:e})=>function(t,e){if(!Vr(t))return!1;if(e){const n=os(t);e(ss(t.tr,n,n.top))}return!0}(t,e),addRowAfter:()=>({state:t,dispatch:e})=>function(t,e){if(!Vr(t))return!1;if(e){const n=os(t);e(ss(t.tr,n,n.bottom))}return!0}(t,e),deleteRow:()=>({state:t,dispatch:e})=>function(t,e){if(!Vr(t))return!1;if(e){const n=os(t),o=t.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let t=n.bottom-1;as(o,n,t),t!=n.top;t--){const t=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!t)throw RangeError("No table found");n.table=t,n.map=_r.get(n.table)}e(o)}return!0}(t,e),deleteTable:()=>({state:t,dispatch:e})=>function(t,e){const n=t.selection.$anchor;for(let o=n.depth;o>0;o--)if("table"==n.node(o).type.spec.tableRole)return e&&e(t.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}(t,e),mergeCells:()=>({state:t,dispatch:e})=>cs(t,e),splitCell:()=>({state:t,dispatch:e})=>ds(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>hs("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>hs("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>ps(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>!!cs(t,e)||ds(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:o})=>function(t,e){return function(n,o){if(!Vr(n))return!1;const i=Wr(n);if(i.nodeAfter.attrs[t]===e)return!1;if(o){const r=n.tr;n.selection instanceof qr?n.selection.forEachCell(((n,o)=>{n.attrs[t]!==e&&r.setNodeMarkup(o,null,{...n.attrs,[t]:e})})):r.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),o(r)}return!0}}(t,e)(n,o),goToNextCell:()=>({state:t,dispatch:e})=>fs(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>fs(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&ns(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const n=qr.create(e.doc,t.anchorCell,t.headCell);e.setSelection(n)}return!0}}),addKeyboardShortcuts(){return{Tab:()=>!!this.editor.commands.goToNextCell()||!!this.editor.can().addRowAfter()&&this.editor.chain().addRowAfter().goToNextCell().run(),"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Gs,"Mod-Backspace":Gs,Delete:Gs,"Mod-Delete":Gs}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Rs({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Bs({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:(0,Wn.callOrReturn)((0,Wn.getExtensionField)(t,"tableRole",e))}}}),Ws=Vs.extend({renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:o,tableMinWidth:i}=js(t,this.options.cellMinWidth);return["div",{class:"tui-table-wrapper"},["table",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,e,{style:o?`width: ${o}`:`min-width: ${i}`}),n,["tbody",0]]]}}).configure({resizable:!0,lastColumnResizable:!1,allowTableNodeSelection:!0}).extend(),Xs=n(3017).default.extend({renderHTML({HTMLAttributes:t}){const e=(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t);return e.colwidth&&(e.style=`width: ${e.colwidth}px; ${e.style}`),["td",e,0]}}),Us=Wn.Extension.create({addGlobalAttributes:()=>[{types:["tableCell","tableHeader"],attributes:{background:{default:null,renderHTML:({background:t})=>t?{style:`background: ${t}`}:null,parseHTML:({style:t})=>t.background,keepOnSplit:!1}}}],addCommands:()=>({setCellBackground:t=>({chain:e})=>e().updateAttributes("tableCell",{background:t}).updateAttributes("tableHeader",{background:t}).run(),unsetCellBackground:()=>({chain:t})=>t().updateAttributes("tableCell",{background:null}).updateAttributes("tableHeader",{background:null}).run()})}),Ks=[Dr.configure({heading:{levels:[1,2,3,4,5,6]}}),n.e(2077).then(n.bind(n,2077)).then((({TextAlign:t})=>t.configure({types:["heading","paragraph"]}))),Promise.resolve().then(n.bind(n,5377)).then((({TextStyle:t})=>t)),n.e(7010).then(n.bind(n,7010)).then((({Underline:t})=>t)),n.e(1949).then(n.bind(n,1949)).then((({Subscript:t})=>t)),n.e(5450).then(n.bind(n,5450)).then((({Superscript:t})=>t)),ho,lr,go,uo,io,Ws.configure({resizable:!0}),Xs,n.e(7793).then(n.bind(n,7793)).then((({TableRow:t})=>t)),n.e(7370).then(n.bind(n,7370)).then((({TableHeader:t})=>t)),mo,Us,lo,ao,co,po],Js={groupNodeClass:"tui-group-node",groupPointerNodeClass:"tui-group-pointer",nested:!0,draggable:!0,createOnEnter:!1},Ys=(t={})=>{const{draggable:e,nested:n,groupNodeClass:o,groupPointerNodeClass:i,createOnEnter:r}={...Js,...t};return Wn.Node.create({name:"group",draggable:e,group:"block",content:n?"block+":"block",addAttributes:()=>({style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>t.style?{style:t.style}:{}}}),parseHTML:()=>[{tag:'div[data-type="group"]'}],renderHTML:({HTMLAttributes:t})=>["div",(0,Wn.mergeAttributes)(t,{"data-type":"group"}),0],addNodeView:()=>({HTMLAttributes:t,node:n})=>{if(globalThis.document){const r=document.createElement("div"),s=document.createElement("div");if(r.classList.add(o),s.setAttribute("data-type","group"),t.style&&(n.attrs.style=t.style,s.setAttribute("style",t.style)),e){const t=document.createElement("div");t.classList.add(i),t.innerHTML="",t.contentEditable="false",r.append(t,s)}else r.append(s);return{dom:r,contentDOM:s}}return null},addCommands(){return{setGroup:()=>({commands:t,state:e})=>{this.editor.chain().focus().run();const n=ro(e,""),o=`
${n.trim().startsWith("

")?n:`

${n}

`}
`;return t.insertContent(o)},setGroupHilite:t=>({editor:e})=>{let n=e.state.selection.$anchor;for(let o=n.depth;o>0;o--){n=e.state.selection.$anchor;const i=n.node(o);if(i.type.name===this.name){setTimeout((()=>e.commands.updateAttributes(i.type,{style:`background: ${t}`})));break}}return!0},removeGroup:()=>({state:t,dispatch:e})=>so(t,e,this.name)}},addKeyboardShortcuts(){return r?{Enter:this.editor.commands.setGroup}:{}}})};var qs=n(7270);const Qs=new b.nKC("[TUI_IFRAME_EDITOR_OPTIONS]",{factory:()=>({minWidth:100,maxWidth:1/0,minHeight:100,maxHeight:1/0})});var Zs;class ta extends Jn{constructor(){super(...arguments),this.sanitizer=(0,b.WQX)(Lt.up),this.el=(0,b.WQX)(b.aKT),this.options=(0,b.WQX)(Qs),this.changeDetector=(0,b.WQX)(b.gRc)}updateSize([t,e]){this.currentWidth=Math.max(this.options.minWidth,Math.min(this.options.maxWidth,t)),this.currentHeight=Math.max(this.options.minHeight,Math.min(this.options.maxHeight,e)),this.attrs.width=this.currentWidth,this.attrs.height=this.currentHeight,this.el.nativeElement.dispatchEvent(new CustomEvent(a,{bubbles:!0}))}get src(){return this.sanitizer.bypassSecurityTrustResourceUrl(this.attrs.src??"")}}(Zs=ta).ɵfac=function(){let t;return function(e){return(t||(t=b.xGo(Zs)))(e||Zs)}}(),Zs.ɵcmp=b.VBU({type:Zs,selectors:[["tui-iframe-editor"]],standalone:!0,features:[b.Vt3,b.aNF],decls:2,vars:13,consts:[[3,"height","width","sizeChange"],["alt","",3,"height","src","width"]],template:function(t,e){1&t&&(b.j41(0,"tui-editor-resizable",0),b.bIt("sizeChange",(function(t){return e.updateSize(t)})),b.nrm(1,"iframe",1),b.k0s()),2&t&&(b.Y8G("height",e.height)("width",e.width),b.R7$(1),b.xc7("max-height",e.options.maxHeight)("max-width",e.options.maxWidth)("min-height",e.options.minHeight)("min-width",e.options.minWidth),b.Y8G("height",e.height)("src",e.src,b.f$h)("width",e.width))},dependencies:[oo],styles:["iframe[_ngcontent-%COMP%]{display:inline;pointer-events:none}"],changeDetection:0}),(0,qs.Cg)([w.PE],ta.prototype,"src",null);const ea=({injector:t})=>Wn.Node.create({name:"iframe",group:"block",atom:!0,draggable:!1,parseHTML:()=>[{tag:"iframe"}],addAttributes(){return{src:{default:null,keepOnSplit:!1,parseHTML:t=>t.getAttribute("src")},frameborder:{default:0,keepOnSplit:!1,parseHTML:t=>t.getAttribute("frameborder")},width:{default:"100%",keepOnSplit:!1,parseHTML:t=>t.getAttribute("width")},height:{default:null,keepOnSplit:!1,parseHTML:t=>t.getAttribute("height")},allowfullscreen:{keepOnSplit:!1,default:this.options.allowFullscreen,parseHTML:t=>t.getAttribute("allowfullscreen")}}},renderHTML:({HTMLAttributes:t})=>["iframe",(0,Wn.mergeAttributes)(t,{"data-type":"iframe-editor"})],addNodeView:()=>e=>new Kn(ta,e,{injector:t,...e}),addCommands(){return{setIframe:t=>({commands:e,state:n})=>{const o=n.selection.anchor;return e.enter(),e.setTextSelection(o),e.insertContent({type:this.name,attrs:t}),e.setTextSelection(n.selection.anchor),!0}}}});var na=n(3229);const oa=new b.nKC("[TUI_IMAGE_EDITOR_OPTIONS]",{factory:()=>({minWidth:null,maxWidth:1/0})});let ia=(()=>{var t;class e extends Tt.dg{constructor(){super(...arguments),this.el=(0,b.WQX)(b.aKT),this.type="dropdown"}getPosition({width:t,height:e}){const{right:n,top:o}=this.el.nativeElement.getBoundingClientRect();return[o+e+5,n-t/2]}}return(t=e).ɵfac=function(){let e;return function(n){return(e||(e=b.xGo(t)))(n||t)}}(),t.ɵdir=b.FsC({type:t,selectors:[["","tuiImageOptionsPosition",""]],standalone:!0,features:[b.Jv_([(0,Tt.nR)(t)]),b.Vt3]}),e})();var ra,sa;class aa{constructor(){this.options=(0,b.WQX)(x),this.style=null,this.updateAlignStyles=new b.bkB}isAlignCenter(t){return t?.replace(/\s/g,"")?.includes("justify-content:center")??!1}isAlignJustify(t){return null==t||""===t}isAlignLeft(t){return t?.replace(/\s/g,"")?.includes("float:left")??!1}isAlignRight(t){return t?.replace(/\s/g,"")?.includes("float:right")??!1}alignLeft(){this.updateAlignStyles.emit("float: left")}alignCenter(){this.updateAlignStyles.emit("display: flex; justify-content: center; margin-left: auto; margin-right: auto;")}alignJustify(){this.updateAlignStyles.emit(null)}alignRight(){this.updateAlignStyles.emit("float: right")}}(ra=aa).ɵfac=function(t){return new(t||ra)},ra.ɵcmp=b.VBU({type:ra,selectors:[["tui-image-align"]],inputs:{style:"style"},outputs:{updateAlignStyles:"updateAlignStyles"},standalone:!0,features:[b.aNF],decls:5,vars:8,consts:[[1,"t-align-list"],["size","s","tuiIconButton","","type","button",3,"appearance","iconStart","click.capture"]],template:function(t,e){1&t&&(b.j41(0,"div",0)(1,"button",1),b.bIt("click.capture",(function(){return e.alignJustify()})),b.k0s(),b.j41(2,"button",1),b.bIt("click.capture",(function(){return e.alignLeft()})),b.k0s(),b.j41(3,"button",1),b.bIt("click.capture",(function(){return e.alignCenter()})),b.k0s(),b.j41(4,"button",1),b.bIt("click.capture",(function(){return e.alignRight()})),b.k0s()()),2&t&&(b.R7$(1),b.Y8G("appearance",e.isAlignJustify(e.style)?"outline":"flat")("iconStart",e.options.icons.imageExtension.alignJustify),b.R7$(1),b.Y8G("appearance",e.isAlignLeft(e.style)?"outline":"flat")("iconStart",e.options.icons.imageExtension.alignLeft),b.R7$(1),b.Y8G("appearance",e.isAlignCenter(e.style)?"outline":"flat")("iconStart",e.options.icons.imageExtension.alignCenter),b.R7$(1),b.Y8G("appearance",e.isAlignRight(e.style)?"outline":"flat")("iconStart",e.options.icons.imageExtension.alignRight))},dependencies:[K.p],styles:[".t-align-list[_ngcontent-%COMP%]{display:flex;gap:.3125rem;padding:.125rem}"],changeDetection:0}),(0,qs.Cg)([w.PE],aa.prototype,"isAlignCenter",null),(0,qs.Cg)([w.PE],aa.prototype,"isAlignJustify",null),(0,qs.Cg)([w.PE],aa.prototype,"isAlignLeft",null),(0,qs.Cg)([w.PE],aa.prototype,"isAlignRight",null);const la=["resizable"],ca=["dropdown"];function da(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-image-align",7),b.bIt("updateAlignStyles",(function(e){b.eBV(t);const n=b.XpG();return n.align(e),b.Njj(n.open=!1)})),b.k0s()}if(2&t){const t=b.XpG();b.Aen(t.style)}}class ua extends Jn{constructor(){super(...arguments),this.sanitizer=(0,b.WQX)(Lt.up),this.el=(0,b.WQX)(b.aKT),this.win=(0,b.WQX)(W.Qc),this.destroyRef=(0,b.WQX)(b.abz),this.style=null,this.contenteditable=!1,this.focused=!1,this.open=!1,this.options=(0,b.WQX)(x),this.imageOptions=(0,b.WQX)(oa),this.changeDetector=(0,b.WQX)(b.gRc)}get height(){return null}get minWidth(){return this.imageOptions.minWidth??0}get maxWidth(){return this.imageOptions.maxWidth??0}ngOnInit(){this.style=this.attrs.style}ngAfterViewInit(){this.minWidth>0&&this.updateMinWidth()}updateSize([t]){this.currentWidth=Math.max(this.minWidth,Math.min(this.maxWidth,t)),this.attrs.width=this.currentWidth,this.notifyUpdate()}get dragHandle(){return this.attrs.draggable??null}get alt(){return this.attrs.alt??""}get title(){return this.attrs.title??""}getBypassedSrc(t){return this.sanitizer.bypassSecurityTrustResourceUrl(t)}currentTargetIsFocused(t){this.focused=this.el.nativeElement.contains(t),this.focused?this.selectFakeText():(this.open=!1,this.dropdown?.toggle(!1))}openDropdown(t){this.open=!0,this.dropdown?.toggle(!0),t.stopImmediatePropagation()}align(t){this.style=t,this.attrs.style=t,this.notifyUpdate()}selectFakeText(){if(this.win.document){const t=this.win.document.createRange();this.el.nativeElement.querySelector("p")?.focus(),t.selectNode(this.el.nativeElement),this.win.getSelection()?.removeAllRanges(),this.win.getSelection()?.addRange(t)}}updateMinWidth(){(0,na.O)(100).pipe((0,Q.pQ)(this.destroyRef)).subscribe((()=>{const t=this.resizable?.container?.nativeElement.querySelector("img")?.naturalWidth??this.resizable?.width??this.attrs.width??0;this.minWidth>parseInt(t,10)&&this.updateSize([this.minWidth])}))}notifyUpdate(){this.el.nativeElement.dispatchEvent(new CustomEvent(a,{bubbles:!0}))}}(sa=ua).ɵfac=function(){let t;return function(e){return(t||(t=b.xGo(sa)))(e||sa)}}(),sa.ɵcmp=b.VBU({type:sa,selectors:[["tui-image-editor"]],viewQuery:function(t,e){if(1&t&&(b.GBs(la,7),b.GBs(ca,7)),2&t){let t;b.mGM(t=b.lsd())&&(e.resizable=t.first),b.mGM(t=b.lsd())&&(e.dropdown=t.first)}},hostVars:4,hostBindings:function(t,e){1&t&&b.bIt("click.silent",(function(t){return e.currentTargetIsFocused(t.target)}),!1,b.EBC),2&t&&(b.BMQ("data-drag-handle",e.dragHandle)("contenteditable",e.contenteditable),b.Aen(e.style))},standalone:!0,features:[b.Vt3,b.aNF],decls:8,vars:17,consts:[["tuiImageOptionsPosition","",1,"t-hosted",3,"tuiDropdown","tuiDropdownOpen"],["dropdown","tuiDropdown"],["appearance","","size","s","tuiIconButton","","type","button",1,"t-image-options",3,"iconStart","click.capture.prevent"],[3,"autoHeight","width","sizeChange"],["resizable",""],["contenteditable","false","decoding","async","loading","lazy",3,"alt","src","title"],["imgOptions",""],[3,"updateAlignStyles"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0,1)(2,"button",2),b.bIt("click.capture.prevent",(function(t){return e.openDropdown(t)})),b.k0s(),b.j41(3,"tui-editor-resizable",3,4),b.bIt("sizeChange",(function(t){return e.updateSize(t)})),b.nrm(5,"img",5),b.k0s()(),b.DNE(6,da,1,2,"ng-template",null,6,b.C5r)),2&t){const t=b.sdS(7);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",e.open),b.R7$(2),b.AVh("_open",e.open),b.Y8G("iconStart",e.options.icons.imageExtension.settings),b.R7$(1),b.Y8G("autoHeight",!0)("width",e.width),b.R7$(2),b.xc7("max-width",e.maxWidth,"px")("min-width",e.minWidth,"px"),b.AVh("ProseMirror-selectednode",e.focused),b.Y8G("alt",e.alt)("src",e.getBypassedSrc(e.attrs.src),b.B4B)("title",e.title),b.BMQ("width",e.width)}},dependencies:[K.p,Ht.pU,Ht.iE,oo,aa,ia],styles:["[_nghost-%COMP%]{display:inline-block}[data-drag-handle][_nghost-%COMP%]{cursor:move}[_nghost-%COMP%]:hover .t-image-options[_ngcontent-%COMP%]{opacity:1}img[_ngcontent-%COMP%]{pointer-events:none}.t-hosted[_ngcontent-%COMP%]{position:relative}.t-image-options[_ngcontent-%COMP%]{position:absolute;top:.625rem;right:.625rem;z-index:1;background:var(--tui-background-base)}.t-image-options[_ngcontent-%COMP%]:not(._open){transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:0}.t-align-list[_ngcontent-%COMP%]{display:flex;gap:.3125rem;padding:.125rem}"],changeDetection:0}),(0,qs.Cg)([w.PE],ua.prototype,"getBypassedSrc",null);const ha=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,pa=Wn.Node.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{}}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[(0,Wn.nodeInputRule)({find:ha,type:this.type,getAttributes:t=>{const[,,e,n,o]=t;return{src:n,alt:e,title:o}}})]}});var fa=n(7049);function ma(t){return(e,n)=>{const o=n instanceof DragEvent?n.dataTransfer:n.clipboardData,i=Array.from(o?.files??[]).filter((t=>/image/i.test(t.type)));i.length&&n.preventDefault();const r=t.get(B);i.forEach((t=>{r(t).pipe((0,Pe.s)(1),(0,fa.v)((()=>!e.isDestroyed))).subscribe((t=>{const n=e.state.schema.nodes.image?.create({src:t}),o=n?e.state.tr.replaceSelectionWith(n):null;setTimeout?.((()=>{!e.isDestroyed&&o&&e.dispatch(o)}))}))}))}}function ga({injector:t,draggable:e}){const n=!(0,w.Aj)(e)||e;return pa.extend({name:"image",group:"inline",inline:!0,priority:0,selectable:!0,draggable:n,parseHTML:()=>[{tag:"img"}],addAttributes:()=>({src:{default:"",keepOnSplit:!1},width:{default:null,keepOnSplit:!1},alt:{default:"",keepOnSplit:!1},style:{default:"",keepOnSplit:!1},title:{default:"",keepOnSplit:!1},draggable:{default:n?"":null,keepOnSplit:!1}}),renderHTML:({HTMLAttributes:t})=>["img",(0,Wn.mergeAttributes)(t)],addNodeView:()=>e=>new Kn(ua,e,{injector:t,...e}),addCommands(){return{setEditableImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addProseMirrorPlugins:()=>[new nt.k_({props:{handleDOMEvents:{paste:ma(t),drop:ma(t)}}})]})}const ba=ga;function ya(t){return(new window.DOMParser).parseFromString(`${t}`,"text/html").body}function ka(t){const e=t.parentElement,n=e?.cloneNode();for(;e?.firstChild&&e.firstChild!==t;)n?.appendChild(e.firstChild);(n?.childNodes?.length??0)>0&&n&&e?.parentElement?.insertBefore(n,e),e?.parentElement?.insertBefore(t,e),0===e?.childNodes.length&&e.remove()}function va(t){const e=t.parentNode;for(;t?.firstChild;)e?.insertBefore(t.firstChild,t);e?.removeChild(t)}function wa(t){return t?.replace(/",">")??""}const Ca=Wn.Extension.create({name:"markdownClipboard",addOptions:()=>({transformPastedText:!1,transformCopiedText:!1}),addProseMirrorPlugins(){return[new nt.k_({key:new nt.hs("markdownClipboard"),props:{clipboardTextParser:(t,e,n)=>{if(n||!this.options.transformPastedText)return null;const o=this.editor.storage.markdown.parser.parse(t,{inline:!0});return Lr.S4.fromSchema(this.editor.schema).parseSlice(ya(o),{preserveWhitespace:!0,context:e})},clipboardTextSerializer:t=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(t.content):null}})]}});var xa=n(9802);const Sa=new Lr.Sj({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:()=>["p",0]},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["div",["hr"]]},heading:{attrs:{level:{default:1}},content:"(text | image)*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM:t=>["h"+t.attrs.level,0]},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({params:t.getAttribute("data-params")||""})}],toDOM:t=>["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs:t=>({order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")})}],toDOM:t=>["ol",{start:1==t.attrs.order?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:t=>({tight:t.hasAttribute("data-tight")})}],toDOM:t=>["ul",{"data-tight":t.attrs.tight?"true":null},0]},list_item:{content:"block+",defining:!0,parseDOM:[{tag:"li"}],toDOM:()=>["li",0]},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs:t=>({src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")})}],toDOM:t=>["img",t.attrs]},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:t=>"em"==t.type.name}],toDOM:()=>["em"]},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!=t.style.fontWeight&&null},{style:"font-weight=400",clearMark:t=>"strong"==t.type.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM:()=>["strong"]},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:t=>({href:t.getAttribute("href"),title:t.getAttribute("title")})}],toDOM:t=>["a",t.attrs]},code:{parseDOM:[{tag:"code"}],toDOM:()=>["code"]}}});class Ma{constructor(t,e){this.schema=t,this.tokenHandlers=e,this.stack=[{type:t.topNodeType,attrs:null,content:[],marks:Lr.CU.none}]}top(){return this.stack[this.stack.length-1]}push(t){this.stack.length&&this.top().content.push(t)}addText(t){if(!t)return;let e,n=this.top(),o=n.content,i=o[o.length-1],r=this.schema.text(t,n.marks);i&&(e=function(t,e){if(t.isText&&e.isText&&Lr.CU.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}(i,r))?o[o.length-1]=e:o.push(r)}openMark(t){let e=this.top();e.marks=t.addToSet(e.marks)}closeMark(t){let e=this.top();e.marks=t.removeFromSet(e.marks)}parseTokens(t){for(let e=0;e{t.openNode(e,Ta(i,n,o,r)),t.addText(Ea(n.content)),t.closeNode()}:(n[o+"_open"]=(t,n,o,r)=>t.openNode(e,Ta(i,n,o,r)),n[o+"_close"]=t=>t.closeNode())}else if(i.node){let e=t.nodeType(i.node);n[o]=(t,n,o,r)=>t.addNode(e,Ta(i,n,o,r))}else if(i.mark){let e=t.marks[i.mark];Oa(i,o)?n[o]=(t,n,o,r)=>{t.openMark(e.create(Ta(i,n,o,r))),t.addText(Ea(n.content)),t.closeMark(e)}:(n[o+"_open"]=(t,n,o,r)=>t.openMark(e.create(Ta(i,n,o,r))),n[o+"_close"]=t=>t.closeMark(e))}else{if(!i.ignore)throw new RangeError("Unrecognized parsing spec "+JSON.stringify(i));Oa(i,o)?n[o]=Aa:(n[o+"_open"]=Aa,n[o+"_close"]=Aa)}}return n.text=(t,e)=>t.addText(e.content),n.inline=(t,e)=>t.parseTokens(e.children),n.softbreak=n.softbreak||(t=>t.addText(" ")),n}(t,n)}parse(t,e={}){let n,o=new Ma(this.schema,this.tokenHandlers);o.parseTokens(this.tokenizer.parse(t,e));do{n=o.closeNode()}while(o.stack.length);return n||this.schema.topNodeType.createAndFill()}}(Sa,(0,xa.A)("commonmark",{html:!1}),{blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},list_item:{block:"list_item"},bullet_list:{block:"bullet_list",getAttrs:(t,e,n)=>({tight:Ia(e,n)})},ordered_list:{block:"ordered_list",getAttrs:(t,e,n)=>({order:+t.attrGet("start")||1,tight:Ia(e,n)})},heading:{block:"heading",getAttrs:t=>({level:+t.tag.slice(1)})},code_block:{block:"code_block",noCloseToken:!0},fence:{block:"code_block",getAttrs:t=>({params:t.info||""}),noCloseToken:!0},hr:{node:"horizontal_rule"},image:{node:"image",getAttrs:t=>({src:t.attrGet("src"),title:t.attrGet("title")||null,alt:t.children[0]&&t.children[0].content||null})},hardbreak:{node:"hard_break"},em:{mark:"em"},strong:{mark:"strong"},link:{mark:"link",getAttrs:t=>({href:t.attrGet("href"),title:t.attrGet("title")||null})},code_inline:{mark:"code",noCloseToken:!0}});const Na={open:"",close:"",mixable:!0},Da=new class{constructor(t,e,n={}){this.nodes=t,this.marks=e,this.options=n}serialize(t,e={}){e=Object.assign({},this.options,e);let n=new $a(this.nodes,this.marks,e);return n.renderContent(t),n.out}}({blockquote(t,e){t.wrapBlock("> ",null,e,(()=>t.renderContent(e)))},code_block(t,e){const n=e.textContent.match(/`{3,}/gm),o=n?n.sort().slice(-1)[0]+"`":"```";t.write(o+(e.attrs.params||"")+"\n"),t.text(e.textContent,!1),t.write("\n"),t.write(o),t.closeBlock(e)},heading(t,e){t.write(t.repeat("#",e.attrs.level)+" "),t.renderInline(e,!1),t.closeBlock(e)},horizontal_rule(t,e){t.write(e.attrs.markup||"---"),t.closeBlock(e)},bullet_list(t,e){t.renderList(e," ",(()=>(e.attrs.bullet||"*")+" "))},ordered_list(t,e){let n=e.attrs.order||1,o=String(n+e.childCount-1).length,i=t.repeat(" ",o+2);t.renderList(e,i,(e=>{let i=String(n+e);return t.repeat(" ",o-i.length)+i+". "}))},list_item(t,e){t.renderContent(e)},paragraph(t,e){t.renderInline(e),t.closeBlock(e)},image(t,e){t.write("!["+t.esc(e.attrs.alt||"")+"]("+e.attrs.src.replace(/[\(\)]/g,"\\$&")+(e.attrs.title?' "'+e.attrs.title.replace(/"/g,'\\"')+'"':"")+")")},hard_break(t,e,n,o){for(let i=o+1;i(t.inAutolink=function(t,e,n){if(t.attrs.title||!/^\w+:/.test(t.attrs.href))return!1;let o=e.child(n);return!(!o.isText||o.text!=t.attrs.href||o.marks[o.marks.length-1]!=t||n!=e.childCount-1&&t.isInSet(e.child(n+1).marks))}(e,n,o),t.inAutolink?"<":"["),close(t,e,n,o){let{inAutolink:i}=t;return t.inAutolink=void 0,i?">":"]("+e.attrs.href.replace(/[\(\)"]/g,"\\$&")+(e.attrs.title?` "${e.attrs.title.replace(/"/g,'\\"')}"`:"")+")"},mixable:!0},code:{open:(t,e,n,o)=>Ra(n.child(o),-1),close:(t,e,n,o)=>Ra(n.child(o-1),1),escape:!1}});function Ra(t,e){let n,o=/`+/g,i=0;if(t.isText)for(;n=o.exec(t.text);)i=Math.max(i,n[0].length);let r=i>0&&e>0?" `":"`";for(let t=0;t0&&e<0&&(r+=" "),r}class $a{constructor(t,e,n){this.nodes=t,this.marks=e,this.options=n,this.delim="",this.out="",this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,void 0===this.options.tightLists&&(this.options.tightLists=!1),void 0===this.options.hardBreakNodeName&&(this.options.hardBreakNodeName="hard_break")}flushClose(t=2){if(this.closed){if(this.atBlank()||(this.out+="\n"),t>1){let e=this.delim,n=/\s+$/.exec(e);n&&(e=e.slice(0,e.length-n[0].length));for(let n=1;nthis.render(e,t,o)))}renderInline(t,e=!0){this.atBlockStart=e;let n=[],o="",i=(e,i,r)=>{let s=e?e.marks:[];e&&e.type.name===this.options.hardBreakNodeName&&(s=s.filter((e=>{if(r+1==t.childCount)return!1;let n=t.child(r+1);return e.isInSet(n.marks)&&(!n.isText||/\S/.test(n.text))})));let a=o;if(o="",e&&e.isText&&s.some((t=>{let e=this.getMark(t.type.name);return e&&e.expelEnclosingWhitespace&&!t.isInSet(n)}))){let[t,o,i]=/^(\s*)(.*)$/m.exec(e.text);o&&(a+=o,(e=i?e.withText(i):null)||(s=n))}if(e&&e.isText&&s.some((e=>{let n=this.getMark(e.type.name);return n&&n.expelEnclosingWhitespace&&(r==t.childCount-1||!e.isInSet(t.child(r+1).marks))}))){let[t,i,r]=/^(.*?)(\s*)$/m.exec(e.text);r&&(o=r,(e=i?e.withText(i):null)||(s=n))}let l=s.length?s[s.length-1]:null,c=l&&!1===this.getMark(l.type.name).escape,d=s.length-(c?1:0);t:for(let t=0;to?s=s.slice(0,o).concat(e).concat(s.slice(o,t)).concat(s.slice(t+1,d)):o>t&&(s=s.slice(0,t).concat(s.slice(t+1,o)).concat(e).concat(s.slice(o,d)));continue t}}}let u=0;for(;u0&&(this.atBlockStart=!1)};t.forEach(i),i(null,0,t.childCount),this.atBlockStart=!1}renderList(t,e,n){this.closed&&this.closed.type==t.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let o=void 0!==t.attrs.tight?t.attrs.tight:this.options.tightLists,i=this.inTightList;this.inTightList=o,t.forEach(((i,r,s)=>{s&&o&&this.flushClose(1),this.wrapBlock(e,n(s),t,(()=>this.render(i,t,s)))})),this.inTightList=i}esc(t,e=!1){return t=t.replace(/[`*\\~\[\]_]/g,((e,n)=>"_"==e&&n>0&&n+1])/,"\\$&").replace(/^(\s*)(#{1,6})(\s|$)/,"$1\\$2$3").replace(/^(\s*\d+)\.\s/,"$1\\. ")),this.options.escapeExtraCharacters&&(t=t.replace(this.options.escapeExtraCharacters,"\\$&")),t}quote(t){let e=-1==t.indexOf('"')?'""':-1==t.indexOf("'")?"''":"()";return e[0]+t+e[1]}repeat(t,e){let n="";for(let o=0;o({markdown:{serialize:Da.marks.strong,parse:{}}})}),za=Wn.Mark.create({name:"code"}).extend({addStorage:()=>({markdown:{serialize:Da.marks.code,parse:{}}})});function Pa(t){const e=t.type.schema,n=e.text(" ",[t]),o=(0,Wn.getHTMLFromFragment)(Lr.FK.from(n),e),i=/^(<.*?>) (<\/.*?>)$/.exec(o);return i?[i[1]??"",i[2]??""]:null}const Ba=Wn.Mark.create({name:"markdownHTMLMark",addStorage:()=>({markdown:{serialize:{open(t,e){return this.editor?.storage.markdown.options.html?Pa(e)?.[0]??"":(console.warn(`Tiptap Markdown: "${e.type.name}" mark is only available in html mode`),"")},close(t,e){return this.editor?.storage.markdown.options.html?Pa(e)?.[1]??"":""}},parse:{}}})}),_a=Wn.Mark.create({name:"italic"}).extend({addStorage:()=>({markdown:{serialize:Da.marks.em,parse:{}}})}),Ha=Wn.Mark.create({name:"link"}).extend({addStorage:()=>({markdown:{serialize:Da.marks.link,parse:{}}})}),ja=Wn.Mark.create({name:"strike"}).extend({addStorage:()=>({markdown:{serialize:{open:"~~",close:"~~",expelEnclosingWhitespace:!0},parse:{}}})}),Fa=Wn.Node.create({name:"blockquote"}).extend({addStorage:()=>({markdown:{serialize:Da.nodes.blockquote,parse:{}}})}),Ga=Wn.Node.create({name:"bulletList"}).extend({addStorage:()=>({markdown:{serialize(t,e){return t.renderList(e," ",(()=>`${this.editor?.storage.markdown.options.bulletListMarker||"-"} `))},parse:{}}})}),Va=Wn.Node.create({name:"codeBlock"}).extend({addStorage:()=>({markdown:{serialize(t,e){t.write(`\`\`\`${e.attrs.language||""}\n`),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},parse:{setup(t){t.set({langPrefix:this.options?.languageClassPrefix??"language-"})},updateDOM(t){t.innerHTML=t.innerHTML.replaceAll("\n","")}}}})}),Wa=Wn.Node.create({name:"markdownHTMLNode",addStorage:()=>({markdown:{serialize(t,e,n){this.editor.storage.markdown.options.html?t.write(function(t,e){const n=t.type.schema,o=(0,Wn.getHTMLFromFragment)(Lr.FK.from(t),n);return t.isBlock&&(e instanceof Lr.FK||e.type.name===n.topNodeType.name)?function(t){const e=ya(t).firstElementChild;return e&&(e.innerHTML=e.innerHTML.trim()?`\n${e.innerHTML}\n`:"\n"),e?.outerHTML??""}(o):o}(e,n)):(console.warn(`Tiptap Markdown: "${e.type.name}" node is only available in html mode`),t.write(`[${e.type.name}]`)),e.isBlock&&t.closeBlock(e)},parse:{}}})}),Xa=Wn.Node.create({name:"hardBreak"}).extend({addStorage:()=>({markdown:{serialize(t,e,n,o){for(let i=o+1;i({markdown:{serialize:Da.nodes.heading,parse:{}}})}),Ka=Wn.Node.create({name:"horizontalRule"}).extend({addStorage:()=>({markdown:{serialize:Da.nodes.horizontal_rule,parse:{}}})}),Ja=Wn.Node.create({name:"image"}).extend({addStorage:()=>({markdown:{serialize:Da.nodes.image,parse:{}}})}),Ya=Wn.Node.create({name:"listItem"}).extend({addStorage:()=>({markdown:{serialize:Da.nodes.list_item,parse:{}}})}),qa=Wn.Node.create({name:"orderedList"}).extend({addStorage:()=>({markdown:{serialize(t,e,n,o){const i=e.attrs.start||1,r=String(i+e.childCount-1).length,s=t.repeat(" ",r+2),a=function(t,e,n){let o=0;for(;n-o>0&&e.child(n-o-1).type.name===t.type.name;o++);return o}(e,n,o),l=a%2?") ":". ";t.renderList(e,s,(e=>{const n=String(i+e);return t.repeat(" ",r-n.length)+n+l}))},parse:{}}})}),Qa=Wn.Node.create({name:"paragraph"}).extend({addStorage:()=>({markdown:{serialize:Da.nodes.paragraph,parse:{}}})});function Za(t){return t?.content?.content??[]}const tl=Wn.Node.create({name:"table"}).extend({addStorage:()=>({markdown:{serialize(t,e,n){!function(t){const e=Za(t),n=e[0],o=e.slice(1);return!Za(n).some((t=>"tableHeader"!==t.type.name||el(t)||t.childCount>1))&&!o.some((t=>Za(t).some((t=>"tableHeader"===t.type.name||el(t)||t.childCount>1))))}(e)?Wa.storage.markdown.serialize.call(this,t,e,n):(t.inTable=!0,e.forEach(((e,n,o)=>{if(t.write("| "),e.forEach(((e,n,o)=>{o&&t.write(" | ");const i=e.firstChild;i?.textContent.trim()&&t.renderInline(i)})),t.write(" |"),t.ensureNewLine(),!o){const n=Array.from({length:e.childCount}).map((()=>"---")).join(" | ");t.write(`| ${n} |`),t.ensureNewLine()}})),t.closeBlock(e),t.inTable=!1)},parse:{}}})});function el(t){return t.attrs.colspan>1||t.attrs.rowspan>1}const nl=Wn.Node.create({name:"taskItem"}).extend({addStorage:()=>({markdown:{serialize(t,e){const n=e.attrs.checked?"[x]":"[ ]";t.write(`${n} `),t.renderContent(e)},parse:{updateDOM(t){Array.from(t.querySelectorAll(".task-list-item")).forEach((t=>{const e=t.querySelector("input");t.setAttribute("data-type","taskItem"),e&&(t.setAttribute("data-checked",e.checked.toString()),e.remove())}))}}}})});let ol=!0,il=!1,rl=!1;function sl(t,e){e&&(ol=!e.enabled,il=!!e.label,rl=!!e.labelAfter),t.core.ruler.after("inline","github-task-lists",(t=>{const e=t.tokens;for(let n=2;n=0;o--)if(t[o]?.level===n)return o;return-1}function cl(t,e){return(t[e]&&"inline"===t[e].type&&t[e-1]&&"paragraph_open"===t[e-1].type&&t[e-2]&&"list_item_open"===t[e-2].type&&function(t){return t.content.startsWith("[ ] ")||t.content.startsWith("[x] ")||t.content.startsWith("[X] ")}(t[e]))??!1}function dl(t,e){if(t.children?.unshift(function(t,e){const n=new e("html_inline","",0),o=ol?' disabled="" ':"";return t?.content.startsWith("[ ] ")?n.content=``:(t?.content.startsWith("[x] ")||t?.content.startsWith("[X] "))&&(n.content=``),n}(t,e)),t.children?.[1]&&(t.children[1].content=t.children[1].content.slice(3)),t.content&&(t.content=t.content.slice(3)),il)if(rl){t.children?.pop();const n=`task-item-${Math.ceil(1e7*Math.random()-1e3)}`;t.children?.[0]&&(t.children[0].content=`${t.children[0].content.slice(0,-1)} id="${n}">`),t.children?.push(function(t,e,n){const o=new n("html_inline","",0);return o.content=``,o.attrs=[{for:e}],o}(t.content,n,e))}else t.children?.unshift(function(t){const e=new t("html_inline","",0);return e.content="",e}(e))}const ul=Wn.Node.create({name:"taskList"}).extend({addStorage:()=>({markdown:{serialize:Ga.storage.markdown.serialize,parse:{setup(t){t.use(sl)},updateDOM(t){Array.from(t.querySelectorAll(".contains-task-list")).forEach((t=>{t.setAttribute("data-type","taskList")}))}}}})}),hl=Wn.Node.create({name:"text"}).extend({addStorage:()=>({markdown:{serialize(t,e){t.text(wa(e.text))},parse:{}}})}),pl=[Fa,Ga,Va,Xa,Ua,Ka,Wa,Ja,Ya,qa,Qa,tl,nl,ul,hl,La,za,Ba,_a,Ha,ja];function fl(t){const e=t.storage?.markdown,n=pl.find((e=>e.name===t.name))?.storage.markdown;return e||n?{...n,...e}:null}class ml{constructor(t,{html:e,linkify:n,breaks:o}){this.editor=t,this.md=this.withPatchedRenderer((0,xa.A)({html:e,linkify:n,breaks:o}))}parse(t,{inline:e}={}){if("string"==typeof t){this.editor.extensionManager.extensions.forEach((t=>fl(t)?.parse?.setup?.call({editor:this.editor,options:t.options},this.md)));const n=ya(this.md.render(t));return this.editor.extensionManager.extensions.forEach((t=>fl(t)?.parse?.updateDOM?.call({editor:this.editor,options:t.options},n))),this.normalizeDOM(n,{inline:e,content:t}),n.innerHTML}return t}normalizeDOM(t,{inline:e,content:n}){return this.normalizeBlocks(t),t.querySelectorAll("*").forEach((t=>{t.nextSibling?.nodeType!==Node.TEXT_NODE||t.closest("pre")||(t.nextSibling.textContent=t.nextSibling.textContent?.replace(/^\n/,"")??"")})),e&&this.normalizeInline(t,n),t}normalizeBlocks(t){const e=Object.values(this.editor.schema.nodes).filter((t=>t.isBlock)),n=e.map((t=>t.spec.parseDOM?.map((t=>t.tag)))).flat().filter(Boolean).join(",");n&&Array.from(t.querySelectorAll(n)).forEach((t=>{t.parentElement?.matches("p")&&ka(t)}))}normalizeInline(t,e){if(t.firstElementChild?.matches("p")){const n=t.firstElementChild,{nextElementSibling:o,innerHTML:i}=n,r=/^\s+/.exec(e)?.[0]??"",s=o?"":/\s+$/.exec(e)?.[0]??"";if(/^\n\n/.exec(e))return void(n.innerHTML=`${i}${s}`);va(n),t.innerHTML=`${r}${t.innerHTML}${s}`}}withPatchedRenderer(t){const e=t=>(...e)=>{const n=t?.(...e);return"\n"===n?n:n?.endsWith("\n")?n.slice(0,-1):n??""};return t.renderer.rules.hardbreak=e(t.renderer.rules.hardbreak),t.renderer.rules.softbreak=e(t.renderer.rules.softbreak),t.renderer.rules.fence=e(t.renderer.rules.fence),t.renderer.rules.code_block=e(t.renderer.rules.code_block),t.renderer.renderToken=e(t.renderer.renderToken.bind(t.renderer)),t}}const gl=(0,xa.A)();function bl(t,e){return gl.inline.State.prototype.scanDelims.call({src:t,posMax:t.length}),new gl.inline.State(t,null,null,[]).scanDelims(e,!0)}function yl(t,e,n,o){let i={text:t,from:n,to:o};return i=function(t,e,n,o){let i=n,r=t;for(;in&&!bl(r,i).can_close;)r=kl(r,e,i,-1),i--;return{text:r,from:n,to:i}}(i.text,e,i.from,i.to),i.to-i.from[t,this.serializeNode(Wa)]))),...Object.fromEntries(this.editor.extensionManager.extensions.filter((t=>"node"===t.type&&this.serializeNode(t))).map((t=>[t.name,this.serializeNode(t)]))??[])}}get marks(){return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map((t=>[t,this.serializeMark(Ba)]))),...Object.fromEntries(this.editor.extensionManager.extensions.filter((t=>"mark"===t.type&&this.serializeMark(t))).map((t=>[t.name,this.serializeMark(t)]))??[])}}serialize(t){const e=new vl(this.nodes,this.marks,{hardBreakNodeName:Xa.name});return e.renderContent(t),e.out}serializeNode(t){return fl(t)?.serialize?.bind({editor:this.editor,options:t.options})}serializeMark(t){const e=fl(t)?.serialize;return e?{...e,open:"function"==typeof e.open?e.open.bind({editor:this.editor,options:t.options}):e.open,close:"function"==typeof e.close?e.close.bind({editor:this.editor,options:t.options}):e.close}:null}}const Cl=Wn.Extension.create({name:"markdownTightLists",addOptions:()=>({tight:!0,tightClass:"tight",listTypes:["bulletList","orderedList"]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:t=>"true"===t.getAttribute("data-tight")||!t.querySelector("p"),renderHTML:t=>({class:t.tight?this.options.tightClass:null,"data-tight":t.tight?"true":null})}}}]},addCommands(){return{toggleTight:(t=null)=>({editor:e,commands:n})=>this.options.listTypes.some((o=>{if(!e.isActive(o))return!1;const i=e.getAttributes(o);return n.updateAttributes(o,{tight:t??!i?.tight})}))}}}),xl=Wn.Extension.create({name:"markdown",priority:50,addOptions:()=>({html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}),addCommands(){const t=Wn.extensions?.Commands?.config?.addCommands?.();return{setContent:(e,n,o)=>i=>t?.setContent?.(i.editor.storage.markdown.parser.parse(e),n,o)(i),insertContentAt:(e,n,o)=>i=>t?.insertContentAt?.(e,i.editor.storage.markdown.parser.parse(n,{inline:!0}),o)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new ml(this.editor,this.options),serializer:new wl(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage:()=>({}),addExtensions(){return[Cl.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),Ca.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}});function Sl(t){const e=[];return t.content.forEach((t=>{t instanceof Lr.bP&&e.push([t.type.name,t.attrs])})),e}const Ml=Wn.Node.create({name:"audio",group:"block",content:"source+",addAttributes:()=>bo(c),parseHTML:()=>[{tag:"audio"}],renderHTML:({node:t,HTMLAttributes:e})=>["audio",e,...Sl(t)]}),Tl=Wn.Node.create({name:"source",addAttributes:()=>bo(["src","type","width","height","media","sizes","srcset"]),parseHTML:()=>[{tag:"source"}],renderHTML:({HTMLAttributes:t})=>["source",(0,Wn.mergeAttributes)(t)]}),Ol=Wn.Node.create({name:"video",group:"block",content:"source+",addAttributes:()=>bo(c),parseHTML:()=>[{tag:"video"}],renderHTML:({node:t,HTMLAttributes:e})=>["video",e,...Sl(t)]}),El=Wn.Node.create({name:"mention",group:"inline",inline:!0,selectable:!0,atom:!0,addOptions:()=>({HTMLAttributes:{},renderHTML({node:t}){return["span",this.HTMLAttributes,`@${t.attrs.label??t.attrs.id}`.replaceAll(/@+/g,"@")]}}),addAttributes(){return{id:{default:null,keepOnSplit:!0,parseHTML:t=>t.innerText,renderHTML:()=>({"data-type":this.name})},class:{default:null,keepOnSplit:!0}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=this.options.renderHTML({options:this.options,node:t});return"string"==typeof n?["span",(0,Wn.mergeAttributes)({"data-type":this.name},this.options.HTMLAttributes,e),n]:["span",(0,Wn.mergeAttributes)({"data-type":this.name},this.options.HTMLAttributes,e),n?.[2]]}}),Al=/^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?!channel\/)(?!@)(.+)?$/,Il=/^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/g,Nl=t=>t.match(Al),Dl=t=>t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",Rl=Wn.Node.create({name:"youtube",addOptions:()=>({addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},start:{default:0},width:{default:this.options.width},height:{default:this.options.height}}},parseHTML:()=>[{tag:"div[data-youtube-video] iframe"}],addCommands(){return{setYoutubeVideo:t=>({commands:e})=>!!Nl(t.src)&&e.insertContent({type:this.name,attrs:t})}},addPasteRules(){return this.options.addPasteHandler?[(0,Wn.nodePasteRule)({find:Il,type:this.type,getAttributes:t=>({src:t.input})})]:[]},renderHTML({HTMLAttributes:t}){const e=(t=>{const{url:e,allowFullscreen:n,autoplay:o,ccLanguage:i,ccLoadPolicy:r,controls:s,disableKBcontrols:a,enableIFrameApi:l,endTime:c,interfaceLanguage:d,ivLoadPolicy:u,loop:h,modestBranding:p,nocookie:f,origin:m,playlist:g,progressBarColor:b,startAt:y}=t;if(!Nl(e))return null;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){const t=e.split("/").pop();return t?`${Dl(f)}${t}`:null}const k=/(?:v=|shorts\/)([-\w]+)/gm.exec(e);if(!k||!k[1])return null;let v=`${Dl(f)}${k[1]}`;const w=[];return!1===n&&w.push("fs=0"),o&&w.push("autoplay=1"),i&&w.push(`cc_lang_pref=${i}`),r&&w.push("cc_load_policy=1"),s||w.push("controls=0"),a&&w.push("disablekb=1"),l&&w.push("enablejsapi=1"),c&&w.push(`end=${c}`),d&&w.push(`hl=${d}`),u&&w.push(`iv_load_policy=${u}`),h&&w.push("loop=1"),p&&w.push("modestbranding=1"),m&&w.push(`origin=${m}`),g&&w.push(`playlist=${g}`),y&&w.push(`start=${y}`),b&&w.push(`color=${b}`),w.length&&(v+=`?${w.join("&")}`),v})({url:t.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:t.start||0});return t.src=e,["div",{"data-youtube-video":""},["iframe",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor},t)]]}}).extend({}).configure({autoplay:!1,ccLanguage:"en",interfaceLanguage:"en",allowFullscreen:!0,disableKBcontrols:!0});function $l({anchorNode:t,focusNode:e},n){return!!t&&!!e&&(0,X.Gv)(t,n)&&(0,X.Gv)(e,n)}function Ll(t){Array.from(t.children).forEach((t=>{if(t.children.length&&Ll(t),"FONT"===t.tagName)if(t.hasAttribute("size"))switch(t.getAttribute("size")){case"6":zl("h1",t);break;case"5":zl("h2",t);break;case"4":Pl("17px",t);break;case"3":Pl("15px",t);break;case"2":Pl("13px",t)}else t.hasAttribute("color")&&function(t){if(globalThis.document){const e=document.createElement("span");e.setAttribute("style",`color: ${t.getAttribute("color")}`),e.innerHTML=t.innerHTML,t.parentElement?.replaceChild(e,t)}}(t)}))}function zl(t,e){if(globalThis.document){const n=document.createElement(t);if(n.innerHTML=e.innerHTML,"P"===e.parentElement?.tagName){const t=e.parentElement?.parentElement?.insertBefore(n,e.parentElement);e.parentElement?.removeChild(e),t?.nextSibling&&!t?.nextSibling?.textContent?.trim()&&t.nextSibling?.parentElement?.removeChild(t.nextSibling)}else e.parentElement?.replaceChild(n,e)}}function Pl(t,e){if(globalThis.document){const n=document.createElement("p"),o=document.createElement("span");o.setAttribute("style",`font-size: ${t}`),o.innerHTML=e.innerHTML,n.append(o),e.parentElement?.replaceChild("P"===e.parentElement.tagName?o:n,e)}}function Bl(t){const e=(new DOMParser).parseFromString(t,"text/html");return Ll(e.body),e.body.innerHTML}var _l=n(5908);function Hl({stops:t,side:e}){return`linear-gradient(${e}, ${t.map((({color:t,position:e})=>`rgba(${(0,_l.xr)(t).join(", ")}) ${e}`)).join(", ")})`}},5993:(t,e,n)=>{n.d(e,{A:()=>f});var o=n(6610),i=n(2978),r=n(7222),s=n(4612),a=n(8481),l=n(4822),c=n(8001);function d(t,e){1&t&&(i.j41(0,"span",3),i.SdG(1,1),i.k0s())}function u(t,e){if(1&t&&(i.qex(0),i.nrm(1,"span",1),i.DNE(2,d,2,0,"span",2),i.bVm()),2&t){const t=e.tuiLet,n=i.XpG();i.R7$(1),i.xc7("text-indent",n.indent,"px"),i.Y8G("textContent",t),i.R7$(1),i.Y8G("ngIf",!t)}}const h=[[["input"]],"*"],p=["input","*"];let f=(()=>{var t;class e{constructor(){this.value$=(0,c.v)((()=>(0,a.lD)(this.control))),this.indent=-1}onScroll(t){(0,l.ru)(t)&&(0,l.r_)(t)&&(this.indent=-t.scrollLeft-1)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=i.VBU({type:t,selectors:[["tui-input-inline"]],contentQueries:function(t,e,n){if(1&t&&i.wni(n,r.vO,5),2&t){let t;i.mGM(t=i.lsd())&&(e.control=t.first)}},hostBindings:function(t,e){1&t&&i.bIt("scroll.capture",(function(t){return e.onScroll(t.target)}))},standalone:!0,features:[i.aNF],ngContentSelectors:p,decls:3,vars:3,consts:[[4,"tuiLet"],[1,"t-before",3,"textContent"],["automation-id","tui-input-inline__placeholder","class","t-placeholder",4,"ngIf"],["automation-id","tui-input-inline__placeholder",1,"t-placeholder"]],template:function(t,e){1&t&&(i.NAR(h),i.DNE(0,u,3,4,"ng-container",0),i.nI1(1,"async"),i.SdG(2)),2&t&&i.Y8G("tuiLet",i.bMT(1,1,e.value$))},dependencies:[o.Jj,o.bT,s.c],styles:["tui-input-inline{position:relative;display:inline-block;overflow:hidden;white-space:nowrap;box-sizing:border-box}tui-input-inline ::spelling-error{color:transparent}tui-input-inline>.t-before{display:block;padding-right:.02em;margin-left:1px;white-space:pre}tui-input-inline>.t-placeholder{display:inline-block;min-inline-size:1px}tui-input-inline>input{position:absolute;top:0;left:0;background-color:transparent;padding:inherit;font:inherit;-webkit-text-fill-color:transparent;box-sizing:border-box;inline-size:100%;block-size:100%;border-width:0;text-align:inherit;letter-spacing:inherit;text-indent:inherit;text-transform:inherit;outline:none}\n"],encapsulation:2,changeDetection:0}),e})()},184:(t,e,n)=>{n.d(e,{uq:()=>At,DD:()=>Dt,DU:()=>Et,Mz:()=>Nt});var o=n(2978),i=n(5908),r=n(6610),s=n(7222),a=n(4557),l=n(5014),c=n(4225),d=n(9081),u=n(5266),h=n(9707),p=n(5180),f=n(4135),m=n(7270),g=n(6098),b=n(712),y=n(4314),k=n(7212),v=n(8481),w=n(4822),C=n(9406),x=n(2831),S=n(3527),M=n(6340),T=n(965),O=n(7442),E=n(9131),A=n(6194),I=n(4712),N=n(3241),D=n(811),R=n(3308),$=n(6661),L=n(6111),z=n(8621);let P=(()=>{var t;class e{constructor(){this.cache=new Map}request(t){const e=this.cache.get(t);if(e)return e;const n=function(t,e={}){const{selector:n}=e,o=(0,m.Tt)(e,["selector"]);return new C.c((e=>{const i=new AbortController,{signal:r}=i;let s=!0;const{signal:a}=o;if(a)if(a.aborted)i.abort();else{const t=()=>{r.aborted||i.abort()};a.addEventListener("abort",t),e.add((()=>a.removeEventListener("abort",t)))}const l=Object.assign(Object.assign({},o),{signal:r}),c=t=>{s=!1,e.error(t)};return fetch(t,l).then((t=>{n?(0,z.Tg)(n(t)).subscribe((0,L._)(e,void 0,(()=>{s=!1,e.complete()}),c)):(s=!1,e.next(t),e.complete())})).catch(c),()=>{s&&i.abort()}}))}(t).pipe((0,x.n)(function(){var e=(0,R.A)((function*(e){if(e.ok)return e.text();throw new Error(`Failed to load ${t} (${e.statusText})`)}));return function(t){return e.apply(this,arguments)}}()),(0,$.t)({bufferSize:1,refCount:!1}));return this.cache.set(t,n),n}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵprov=o.jDH({token:t,factory:t.ɵfac,providedIn:"root"}),e})();var B=n(1623),_=n(453),H=n(5981),j=n(9656),F=n(9090),G=n(756),V=n(4526);function W(t,e=function(){return Math.floor(Math.random()*Date.now())}()){if((0,y.YB)(t)){const n=function(t){const e=(t.match(/url\(("?)('*)#(.*?)('*)\)/g)??[]).map((t=>t.slice(4,t.length-1).replaceAll(/['"#]+/g,"")));return Array.from(new Set(e))}(t);return n.reduce(((t,n)=>{const o=`id_${e}_${n}`;return t.replaceAll(`"${n}"`,`"${o}"`).replaceAll(`'${n}'`,`'${o}'`).replaceAll(`url('#${n}')`,`url('#${o}')`).replaceAll(`url("#${n}")`,`url("#${o}")`).replaceAll(`url(#${n})`,`url(#${o})`)}),t)}return t}const X={tuiIconAttach:"tuiIconPaperclip",tuiIconAttention:"tuiIconAlertCircle",tuiIconBackCircle:"tuiIconArrowLeftCircle",tuiIconCall:"tuiIconPhone",tuiIconCallIn:"tuiIconPhoneIncoming",tuiIconCallOut:"tuiIconPhoneOutgoing",tuiIconCallTransfer:"tuiIconPhoneForwarded",tuiIconCancel:"tuiIconXCircle",tuiIconCancelCircle:"tuiIconSlash",tuiIconCard:"tuiIconCreditCard",tuiIconCards:"tuiIconCreditCard",tuiIconChartBar:"tuiIconBarChart",tuiIconChart:"tuiIconBarChart",tuiIconCheckList:"tuiIconClipboard",tuiIconCloseCircle:"tuiIconXCircle",tuiIconCollapse:"tuiIconMinimize",tuiIconComment:"tuiIconMessageSquare",tuiIconCommentFw:"tuiIconMessageForward",tuiIconCompany:"tuiIconBriefcase",tuiIconDefaultDoc:"tuiIconFile",tuiIconDesktop:"tuiIconMonitor",tuiIconDesktopOff:"tuiIconMonitorOff",tuiIconDislike:"tuiIconThumbsDown",tuiIconDone:"tuiIconCheckCircle",tuiIconDraft:"tuiIconEdit2",tuiIconEyeOpen:"tuiIconEye",tuiIconEyeClosed:"tuiIconEyeOff",tuiIconExpand:"tuiIconMaximize",tuiIconExternal:"tuiIconExternalLink",tuiIconFrame:"tuiIconLayout",tuiIconGeo:"tuiIconMapPin",tuiIconHeartFilled:"tuiIconHeart",tuiIconHide:"tuiIconEyeOff",tuiIconImg:"tuiIconImage",tuiIconInfoCircle:"tuiIconInfo",tuiIconLike:"tuiIconThumbsUp",tuiIconLockOpen:"tuiIconUnlock",tuiIconMobile:"tuiIconSmartphone",tuiIconMoreHor:"tuiIconMoreHorizontal",tuiIconMoreVer:"tuiIconMoreVertical",tuiIconMoreVert:"tuiIconMoreVertical",tuiIconPicture:"tuiIconImage",tuiIconPin:"tuiIconMapPin",tuiIconPrint:"tuiIconPrinter",tuiIconRefresh:"tuiIconRefreshCw",tuiIconRemove:"tuiIconX",tuiIconShow:"tuiIconEye",tuiIconSound:"tuiIconVolume",tuiIconSoundOff:"tuiIconVolumeX",tuiIconStarFilled:"tuiIconStar",tuiIconStop:"tuiIconSquare",tuiIconStructure:"tuiIconLayoutGrid",tuiIconTime:"tuiIconClock",tuiIconTooltip:"tuiIconHelpCircle",tuiIconViewList:"tuiIconList",tuiIconWifiOn:"tuiIconWifi"};let U=(()=>{var t;class e{constructor(){this.tuiSanitizer=(0,o.WQX)(B.rf,{optional:!0}),this.sanitizer=(0,o.WQX)(g.up),this.originals={},this.items$=new H.t(new Map),this.define((0,o.WQX)(B.l2))}define(t){const{value:e}=this.items$;Object.keys(t).forEach((n=>{this.defineIcon(n,t[n]??"",e)})),this.items$.next(e)}getOriginal(t){return this.originals[t]||null}defineIcon(t,e,n){if(n.has(t))return;const o=this.parseSrc(t,e);o&&(n.set(t,o),this.originals={...this.originals,[t]:e})}parseSrc(t,e){return this.sanitize((0,_.$6)(e,t))}sanitize(t){return this.sanitizer.bypassSecurityTrustHtml((this.tuiSanitizer?this.tuiSanitizer.sanitize(o.WPN.HTML,t):this.sanitizer.sanitize(o.WPN.HTML,t))||"")}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵprov=o.jDH({token:t,factory:t.ɵfac,providedIn:"root"}),e})();const K="assets/taiga-ui/icons",J={iconsPlace:K,path:(0,_.yu)(K),srcProcessor:j.D,contentProcessor:W,deprecated:t=>{const e=t.replace("Large","").replace("Outline",""),n=X[e];return n?`${e}/(Large|Outline) is deprecated, use ${n}/(Large|Outline) instead`:""}},Y=(0,y.ET)((()=>({iconsPlace:K,path:(0,_.yu)(K),deprecated:J.deprecated,srcProcessor:j.D,contentProcessor:W}))),q=(0,y.gc)();let Q=(()=>{var t;class e{constructor(){this.icon="",this.doc=(0,o.WQX)(r.qQ),this.win=(0,o.WQX)(N.Qc),this.options=(0,o.WQX)(Y),this.tuiSanitizer=(0,o.WQX)(B.rf,{optional:!0}),this.svgService=(0,o.WQX)(U),this.staticRequestService=(0,o.WQX)(P),this.sanitizer=(0,o.WQX)(g.up),this.el=(0,w.qW)(),this.baseHref=(0,o.WQX)(D.t2),this.src$=new F.m(1),this.srcInterceptors=(0,o.WQX)(q,{optional:!0}),this.innerHTML$=this.src$.pipe((0,x.n)((()=>(0,y.YB)(this.icon)?this.isExternal?this.getExternalIcon(this.icon):(0,G.of)(this.getSafeHtml(this.icon)):(0,G.of)(this.icon))),(0,T.Z)(""))}set src(t){this.options.deprecated(String(t)),this.icon=(this.srcInterceptors??[]).reduce(((t,e)=>e(t,this.options)),this.options.srcProcessor(t||"")),this.src$.next()}get src(){return this.icon}get use(){return(0,y.YB)(this.icon)?this.icon.includes(".svg#")?this.icon:this.resolveName(this.icon,this.options.path):""}get isInnerHTML(){return!(0,y.YB)(this.icon)||this.isSrc||this.isExternal||this.isName&&this.isShadowDOM}onError(t="External icon is missing on the given URL"){const{icon:e}=this,n=new CustomEvent("tui-icon-error",{bubbles:!0,detail:{message:t,icon:e}});this.el.dispatchEvent(n)}get isShadowDOM(){return(0,w.dd)(this.el)!==this.doc}get isUse(){return this.use.replace(_.sf,"").includes(".svg#")}get isExternal(){return this.isUrl||this.isCrossDomain||!this.isSrc&&!this.svgService.getOriginal(String(this.icon))}get isUrl(){return(0,y.YB)(this.icon)&&this.icon.replace(_.sf,"").endsWith(".svg")}get isSrc(){return(0,y.YB)(this.icon)&&(0,_.cJ)(this.icon)}get isName(){return!this.isUrl&&!this.isUse&&!this.isSrc}get isCrossDomain(){const{use:t,isUse:e,win:n}=this;return e&&t.startsWith("http")&&!!n.origin&&!t.startsWith(n.origin)}resolveName(t,e){return e(t,this.baseHref)}getSafeHtml(t){return this.isSrc?this.sanitize(t):this.process(t)}process(t){const e=this.svgService.getOriginal(t);return this.isName&&!e&&t&&this.onError("Attempted to use undefined named icon"),this.sanitize(e||"")}sanitize(t){return t=this.options.contentProcessor(t),this.tuiSanitizer&&(0,y.YB)(t)?this.sanitizer.bypassSecurityTrustHtml(this.tuiSanitizer.sanitize(o.WPN.HTML,t)||""):t}getExternalIcon(t){const e=t.includes(".svg")?t:this.use;return this.staticRequestService.request(e).pipe((0,V.W)((()=>(this.onError("Failed to load external SVG"),(0,G.of)("")))),(0,S.T)((t=>this.sanitize(t.replace("{var t;class e{constructor(){this.color=[0,0,0,1],this.colorChange=new o.bkB,this.hexMask={mask:new RegExp("^[A-F\\d]{0,6}$","gi")},this.modes=["HEX","RGB"],this.mode=this.modes[0]}get isHex(){return this.mode===this.modes[0]}get hex(){return(0,i.G7)(this.color[0],this.color[1],this.color[2]).replace("#","")}get opacity(){return Math.round(100*this.color[3])}onHexChange(t){if(6!==t.length)return;const e=(0,i.uB)(t);this.updateColor([e[0],e[1],e[2],this.color[3]])}onRgbChange(...t){this.updateColor(t)}updateColor(t){this.color=t,this.colorChange.emit(t)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-color-edit"]],hostAttrs:["ngSkipHydration","true"],inputs:{color:"color"},outputs:{colorChange:"colorChange"},decls:6,vars:16,consts:[["tuiDropdownAlign","left","tuiDropdownLimitWidth","min","tuiTextfieldSize","m",1,"t-select",3,"ngModelOptions","tuiTextfieldLabelOutside","ngModel","ngModelChange"],["size","s",4,"tuiDataList"],["tuiTextfieldSize","m",3,"maskito","tuiTextfieldLabelOutside","value","valueChange",4,"ngIf","ngIfElse"],["rgb",""],["tuiTextfieldPostfix","%","tuiTextfieldSize","m",1,"t-opacity",3,"max","min","ngModel","ngModelOptions","tuiTextfieldLabelOutside","ngModelChange"],["size","s"],["tuiOption","","type","button",3,"value",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"value"],["tuiTextfieldSize","m",3,"maskito","tuiTextfieldLabelOutside","value","valueChange"],["tuiTextfieldSize","m",1,"t-rgb",3,"max","min","ngModel","ngModelOptions","tuiTextfieldLabelOutside","ngModelChange"]],template:function(t,e){if(1&t&&(o.j41(0,"tui-select",0),o.bIt("ngModelChange",(function(t){return e.mode=t})),o.DNE(1,tt,2,1,"tui-data-list",1),o.k0s(),o.DNE(2,et,1,3,"tui-primitive-textfield",2),o.DNE(3,ot,3,18,"ng-template",null,3,o.C5r),o.j41(5,"tui-input-number",4),o.bIt("ngModelChange",(function(t){return e.onRgbChange(e.color[0],e.color[1],e.color[2],t/100)})),o.k0s()),2&t){const t=o.sdS(4);o.xc7("flex","0 0 auto"),o.Y8G("ngModelOptions",o.lJ4(14,nt))("tuiTextfieldLabelOutside",!0)("ngModel",e.mode),o.R7$(2),o.Y8G("ngIf",e.isHex)("ngIfElse",t),o.R7$(3),o.xc7("flex","0 0 auto"),o.Y8G("max",100)("min",0)("ngModel",e.opacity)("ngModelOptions",o.lJ4(15,nt))("tuiTextfieldLabelOutside",!0)}},dependencies:[r.Sq,r.bT,s.BC,s.vS,a.u,l.eD,l.gt,c.kf,c.G6,c.Om,d.Zc,d.xh,u.ET,u.ww,h.HY,p.uE,p.WX,p.aO],styles:["[_nghost-%COMP%]{display:flex}.t-select[_ngcontent-%COMP%]{inline-size:5.875rem}.t-opacity[_ngcontent-%COMP%]{inline-size:4.275rem}.t-rgb[_ngcontent-%COMP%], .t-opacity[_ngcontent-%COMP%]{text-align:center}"],changeDetection:0}),e})(),mt=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD,s.YN,l.Rp,c.CN,d.O9,u.pg,h.Vh,p.uE,p.aO]}),e})(),gt=(()=>{var t;class e extends C.c{constructor(){super((t=>this.point$.subscribe(t))),this.el=(0,w.qW)(),this.doc=(0,o.WQX)(r.qQ),this.point$=(0,v.xM)(this.el,"mousedown").pipe((0,v.QA)(),(0,x.n)((t=>{const e=(0,v.xM)(this.doc,"mousemove").pipe((0,S.T)((({clientX:t,clientY:e})=>(0,w.V_)(t,e,this.el))),(0,M.Q)((0,v.xM)(this.doc,"mouseup")));return t.target===this.el?e.pipe((0,T.Z)((0,w.V_)(t.clientX,t.clientY,this.el))):e})),(0,k.pQ)())}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵprov=o.jDH({token:t,factory:t.ɵfac}),e})(),bt=(()=>{var t;class e{constructor(){this.$=(0,o.WQX)(gt).pipe((0,k.pQ)()).subscribe((t=>{this.value=t,this.valueChange.emit([t[0],t[1]])})),this.value=[0,0],this.valueChange=new o.bkB}get left(){return 100*this.value[0]}get top(){return 100*this.value[1]}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-flat-picker"]],hostAttrs:["ngSkipHydration","true"],inputs:{value:"value"},outputs:{valueChange:"valueChange"},features:[o.Jv_([gt])],decls:1,vars:4,consts:[[1,"t-circle"]],template:function(t,e){1&t&&o.nrm(0,"div",0),2&t&&o.xc7("left",e.left,"%")("top",e.top,"%")},styles:["[_nghost-%COMP%]{position:relative;display:block}.t-circle[_ngcontent-%COMP%]{position:absolute;inline-size:1rem;block-size:1rem;border-radius:100%;margin:-.5rem 0 0 -.5rem;box-shadow:inset 0 0 0 1px var(--tui-base-01),0 0 0 1px var(--tui-base-03)}"],changeDetection:0}),e})(),yt=(()=>{var t;class e{constructor(){this.$=(0,o.WQX)(gt).pipe((0,k.pQ)()).subscribe((([t])=>{this.value=t,this.valueChange.emit(t)})),this.value=0,this.valueChange=new o.bkB}get left(){return 100*this.value}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-linear-picker"]],hostAttrs:["ngSkipHydration","true"],inputs:{value:"value"},outputs:{valueChange:"valueChange"},features:[o.Jv_([gt])],decls:1,vars:2,consts:[[1,"t-circle"]],template:function(t,e){1&t&&o.nrm(0,"div",0),2&t&&o.xc7("left",e.left,"%")},styles:["[_nghost-%COMP%]{position:relative;display:block;block-size:1rem;box-sizing:border-box}.t-circle[_ngcontent-%COMP%]{position:absolute;inline-size:1rem;block-size:1rem;border-radius:100%;margin:0 -.5rem;box-shadow:inset 0 0 0 2px var(--tui-base-01),0 0 0 1px var(--tui-base-03)}"],changeDetection:0}),e})(),kt=(()=>{var t;class e{constructor(){this.sanitizer=(0,o.WQX)(g.up),this.point=[0,1],this.hue=0,this.opacity=1,this.colorChange=new o.bkB}set color(t){if(this.currentColor.every(((e,n)=>e===t[n]))&&t[3]===this.opacity)return;const[e,n,o]=(0,i.qv)(t[0],t[1],t[2]);this.opacity=t[3],this.hue=e/360,this.point=[n,1-o/255]}get currentColor(){return this.getCurrentColor(this.hue,this.point)}get base(){return`rgb(${(0,i.Mk)(360*this.hue,1,255)})`}get gradient(){return this.sanitizer.bypassSecurityTrustStyle(`linear-gradient(to right, rgba(${this.currentColor.join(",")}, 0), rgb(${this.currentColor.join(",")}))`)}onPointChange(t){this.point=t,this.updateColor()}onHueChange(t){this.hue=t,this.updateColor()}onOpacityChange(t){this.opacity=(0,b.zM)(t,2),this.updateColor()}getCurrentColor(t,e){return(0,i.Mk)(360*t,e[0],255*(1-e[1]))}updateColor(){this.colorChange.emit([...this.currentColor,this.opacity])}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-color-picker"]],hostAttrs:["ngSkipHydration","true"],inputs:{color:"color"},outputs:{colorChange:"colorChange"},decls:5,vars:7,consts:[[1,"t-flat",3,"value","valueChange"],[1,"t-wrapper","t-wrapper_hue"],[1,"t-hue",3,"value","valueChange"],[1,"t-wrapper","t-wrapper_opacity"],[1,"t-opacity",3,"value","valueChange"]],template:function(t,e){1&t&&(o.j41(0,"tui-flat-picker",0),o.bIt("valueChange",(function(t){return e.onPointChange(t)})),o.k0s(),o.j41(1,"div",1)(2,"tui-linear-picker",2),o.bIt("valueChange",(function(t){return e.onHueChange(t)})),o.k0s()(),o.j41(3,"div",3)(4,"tui-linear-picker",4),o.bIt("valueChange",(function(t){return e.onOpacityChange(t)})),o.k0s()()),2&t&&(o.xc7("background-color",e.base),o.Y8G("value",e.point),o.R7$(2),o.Y8G("value",e.hue),o.R7$(1),o.xc7("background",e.gradient),o.R7$(1),o.Y8G("value",e.opacity))},dependencies:[bt,yt],styles:['[_nghost-%COMP%]{position:relative;display:block;isolation:isolate}.t-flat[_ngcontent-%COMP%]{block-size:14rem;background:linear-gradient(#0000,#000),linear-gradient(to right,#fff,#fff0);margin-bottom:.25rem;overflow:hidden}.t-wrapper[_ngcontent-%COMP%]{position:relative;margin:1rem 1.25rem;border-radius:.5rem}.t-wrapper[_ngcontent-%COMP%]:after{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";box-shadow:inset 0 0 0 1px #00000014;pointer-events:none;border-radius:inherit}.t-wrapper_hue[_ngcontent-%COMP%]{background:red}.t-wrapper_opacity[_ngcontent-%COMP%]:before{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";z-index:-1;background-image:linear-gradient(45deg,var(--tui-base-03) 25%,transparent 25%,transparent 75%,var(--tui-base-03) 75%,var(--tui-base-03)),linear-gradient(45deg,var(--tui-base-03) 25%,transparent 25%,transparent 75%,var(--tui-base-03) 75%,var(--tui-base-03));background-size:.375rem .375rem;background-position:0 0,.1875rem .1875rem;border-radius:inherit}.t-hue[_ngcontent-%COMP%]{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);border-radius:inherit;margin:0 .5rem}.t-opacity[_ngcontent-%COMP%]{border-radius:inherit;margin:0 .5rem}'],changeDetection:0}),(0,m.Cg)([y.PE],e.prototype,"getCurrentColor",null),e})(),vt=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD]}),e})(),wt=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD]}),e})(),Ct=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD,vt,wt]}),e})();const xt=(0,y.gc)(["Solid color","Gradient"]),St=(new Map([["color-black-100","#909090"],["color-black-200","#666666"],["color-black-300","#333333"],["color-blue-100","#1771e6"],["color-blue-200","#1464cc"],["color-blue-300","#0953b3"],["color-gray-100","#f5f5f6"],["color-gray-200","#e7e8ea"],["color-gray-300","#cbcfd3"],["color-gray-400","#959ba4"],["color-gray-500","#79818c"],["color-gray-600","#616871"],["color-green-100","#39b54a"],["color-green-200","#2ca53a"],["color-green-300","#168a21"],["color-light-blue-100","#ecf1f7"],["color-light-blue-200","#e4ebf3"],["color-light-blue-300","#dde4ed"],["color-red-100","#e01f19"],["color-red-200","#d3120e"],["color-red-300","#c40b08"],["color-yellow-100","#FFDD2C"],["color-yellow-200","#FCC521"],["color-yellow-300","#FAB618"],["transparent","transparent"]]),0),Mt={selectorMode:!0,mode:St,color:[0,0,0,1],colors:new Map,gradient:{icons:{"to top right":"@tui.move-up-right","to right":"@tui.move-right","to bottom right":"@tui.move-down-right","to bottom":"@tui.move-down","to bottom left":"@tui.move-down-left","to left":"@tui.move-left","to top left":"@tui.move-up-left","to top":"@tui.move-up"},steps:[[0,[0,0,0,1]],[1,[255,255,255,1]]],stop:0,direction:"to bottom",emptyStop:[0,0,0,0],buttons:["to top right","to right","to bottom right","to bottom","to bottom left","to left","to top left","to top"]}},Tt=(0,y.gc)(Mt);let Ot=(()=>{var t;class e{constructor(){this.$=(0,o.WQX)(gt).pipe((0,k.pQ)()).subscribe((([t])=>this.onPicker(t))),this.value=[0,1],this.valueChange=new o.bkB,this.indexChange=new o.bkB,this.index=NaN}onMouseUp(){this.index=NaN}onMouseDown(t){this.updateIndex(t)}onClick(t){this.value.length>2&&this.updateValue(this.value.filter(((e,n)=>n!==t)))}onPicker(t){Number.isNaN(this.index)&&(this.updateIndex(this.value.length),this.value=[...this.value,0]),this.value.some(((e,n)=>e===t&&n!==this.index))||this.updateValue(this.value.map(((e,n)=>n===this.index?t:e)))}updateIndex(t){this.index=t,this.indexChange.emit(t)}updateValue(t){this.value=t,this.valueChange.emit(t)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-linear-multi-picker"]],hostAttrs:["ngSkipHydration","true"],hostBindings:function(t,e){1&t&&o.bIt("mouseup",(function(){return e.onMouseUp()}),!1,o.EBC)},inputs:{value:"value"},outputs:{valueChange:"valueChange",indexChange:"indexChange"},features:[o.Jv_([gt])],decls:1,vars:1,consts:[["class","t-circle",3,"left","dblclick","mousedown",4,"ngFor","ngForOf"],[1,"t-circle",3,"dblclick","mousedown"]],template:function(t,e){1&t&&o.DNE(0,it,1,2,"div",0),2&t&&o.Y8G("ngForOf",e.value)},dependencies:[r.Sq],styles:["[_nghost-%COMP%]{position:relative;display:block;block-size:1rem;box-sizing:border-box}.t-circle[_ngcontent-%COMP%]{position:absolute;inline-size:1rem;block-size:1rem;border-radius:100%;margin:0 -.5rem;box-shadow:inset 0 0 0 2px var(--tui-base-01),0 0 0 1px var(--tui-base-03)}"],changeDetection:0}),e})(),Et=(()=>{var t;class e{constructor(){this.colors=new Map,this.selectedColor=new o.bkB,this.originalOrder=(t,e)=>0}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-palette"]],hostAttrs:["ngSkipHydration","true"],inputs:{colors:"colors"},outputs:{selectedColor:"selectedColor"},decls:2,vars:4,consts:[["type","button","class","t-button",3,"id","background","tuiHint","tuiHintDescribe","click",4,"ngFor","ngForOf"],["type","button",1,"t-button",3,"id","tuiHint","tuiHintDescribe","click"]],template:function(t,e){1&t&&(o.DNE(0,rt,1,5,"button",0),o.nI1(1,"keyvalue")),2&t&&o.Y8G("ngForOf",o.i5U(1,1,e.colors,e.originalOrder))},dependencies:[r.Sq,E.XZ,E.$$,r.lG],styles:["[_nghost-%COMP%]{display:flex;flex-wrap:wrap;padding:.875rem}.t-button[_ngcontent-%COMP%]{-webkit-appearance:none;appearance:none;padding:0;background:none;font-size:inherit;line-height:inherit;inline-size:1.5625rem;block-size:1.5625rem;box-sizing:border-box;margin:.375rem;border-radius:var(--tui-radius-m);border:1px solid rgba(0,0,0,.08)}"],changeDetection:0}),e})(),At=(()=>{var t;class e{constructor(){this.selectorOptions=(0,o.WQX)(Tt),this.stops=new Map(this.selectorOptions.gradient.steps),this.currentStop=this.selectorOptions.gradient.stop,this.direction=this.selectorOptions.gradient.direction,this.sanitizer=(0,o.WQX)(g.up),this.open=!1,this.colors=this.selectorOptions.colors,this.colorChange=new o.bkB,this.color=this.selectorOptions.color,this.modes=(0,o.WQX)(xt),this.currentMode=this.modes[this.selectorOptions.mode],this.buttons=this.selectorOptions.gradient.buttons}set colorSetter(t){t.startsWith("linear-gradient")?this.parseGradient(t):this.parseColor(t)}get selectorMode(){return this.selectorOptions.selectorMode}get palette(){return this.filterPalette(this.colors,this.isGradient)}get stopsKeys(){return this.getStopsKeys(this.stops)}get currentColor(){return this.isGradient?this.getStop(this.currentStop):this.color}get gradient(){return this.sanitizer.bypassSecurityTrustStyle(this.getGradient("to right"))}get isGradient(){return this.currentMode===this.modes[1]}getIcon(t){return this.selectorOptions.gradient.icons[t]}isModeActive(t){return this.currentMode===t}isDirectionActive(t){return this.direction===t}onPalettePick(t){this.updateColor(t)}onDirectionChange(t){this.direction=t,this.updateColor(this.getGradient(t))}onModeSelect(t){this.currentMode=t,this.open=!1,this.updateColor(t===this.modes[St]?`rgba(${this.color.join(", ")})`:this.getGradient(this.direction))}onIndexChange(t){this.currentStop=this.stopsKeys[t]??0}onColorChange(t){this.isGradient?(this.stops.set(this.currentStop,t),this.updateColor(this.getGradient(this.direction))):this.updateColor(`rgba(${t.join(", ")})`)}onStopsChange(t){const e=this.stopsKeys.find((e=>!t.includes(e))),n=t.find((t=>!this.stopsKeys.includes(t)));void 0===e&&void 0!==n&&this.addStop(n),void 0!==e&&void 0===n&&this.removeStop(e),void 0!==e&&void 0!==n&&this.replaceStop(e,n),this.updateColor(this.getGradient(this.direction))}getStopsKeys(t){return Array.from(t.keys())}filterPalette(t,e){const n=new Map(t);return n.forEach(((t,o)=>{(t.startsWith("linear-gradient")&&!e||!t.startsWith("linear-gradient")&&e)&&n.delete(o)})),n}updateColor(t){this.colorChange.emit(t)}getGradient(t){return`linear-gradient(${t}, ${[...this.stopsKeys].sort(y._J).map((t=>`rgba(${this.getStop(t).join(", ")}) ${100*t}%`)).join(", ")})`}getStop(t){return this.stops.get(t)||this.selectorOptions.gradient.emptyStop}addStop(t){const e=this.stopsKeys.reduce(((e,n)=>Math.abs(n-t)o===t?[e,n]:[o,this.getStop(o)])))}parseGradient(t){if(t===this.getGradient(this.direction))return;const e=(0,i.q0)((0,i.L4)(t));this.direction=e.side,this.currentStop=this.selectorOptions.gradient.stop,this.stops=new Map(e.stops.length?e.stops.map((({color:t,position:e})=>[parseFloat(e)/100,(0,i.xr)(t)])):this.selectorOptions.gradient.steps)}parseColor(t){this.currentStop=this.selectorOptions.gradient.stop,this.color=(0,i.xr)(t)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-color-selector"]],hostAttrs:["ngSkipHydration","true"],inputs:{colors:"colors",colorSetter:["color","colorSetter"]},outputs:{colorChange:"colorChange"},decls:5,vars:5,consts:[[4,"ngIf"],[3,"color","colorChange"],["tuiGroup","","class","t-edit",3,"color","colorChange",4,"ngIf"],["class","t-palette",3,"colors","selectedColor",4,"ngIf"],[1,"t-select",3,"tuiDropdown","tuiDropdownOpen","tuiDropdownOpenChange"],["appearance","","size","s","tuiButton","","tuiChevron","","type","button"],["menu",""],[1,"t-hr"],["role","menu","size","s",1,"t-menu"],["role","menuitemradio","tuiOption","","type","button",3,"click","keydown.enter.prevent","keydown.space.prevent",4,"ngFor","ngForOf"],["role","menuitemradio","tuiOption","","type","button",3,"click","keydown.enter.prevent","keydown.space.prevent"],["icon","@tui.check","class","t-checkmark",4,"ngIf"],["icon","@tui.check",1,"t-checkmark"],[1,"t-wrapper"],[1,"t-gradient",3,"value","indexChange","valueChange"],[1,"t-buttons"],["appearance","","size","xs","tuiHintDescribe","","tuiIconButton","","type","button","class","t-direction",3,"t-direction_active","iconStart","tuiHint","click",4,"ngFor","ngForOf"],["appearance","","size","xs","tuiHintDescribe","","tuiIconButton","","type","button",1,"t-direction",3,"iconStart","tuiHint","click"],["tuiGroup","",1,"t-edit",3,"color","colorChange"],[1,"t-palette",3,"colors","selectedColor"]],template:function(t,e){1&t&&(o.DNE(0,ct,7,3,"ng-container",0),o.DNE(1,ut,5,4,"ng-container",0),o.j41(2,"tui-color-picker",1),o.bIt("colorChange",(function(t){return e.onColorChange(t)})),o.k0s(),o.DNE(3,ht,1,1,"tui-color-edit",2),o.DNE(4,pt,1,1,"tui-palette",3)),2&t&&(o.Y8G("ngIf",e.selectorMode),o.R7$(1),o.Y8G("ngIf",e.isGradient),o.R7$(1),o.Y8G("color",e.currentColor),o.R7$(1),o.Y8G("ngIf",!e.isGradient),o.R7$(1),o.Y8G("ngIf",e.palette.size))},dependencies:[r.Sq,r.bT,f.p,kt,Ot,ft,h.pU,h.iE,p.uE,p.aO,O.w7,Et,E.XZ,E.$$,A.k,I.q],styles:['[_nghost-%COMP%]{position:relative;display:block;isolation:isolate;inline-size:22.6rem}.t-wrapper[_ngcontent-%COMP%]{position:relative;margin:1.25rem;border-radius:.5rem}.t-wrapper[_ngcontent-%COMP%]:after{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";box-shadow:inset 0 0 0 1px #00000014;pointer-events:none;border-radius:inherit}.t-wrapper[_ngcontent-%COMP%]:before{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";z-index:-1;background-image:linear-gradient(45deg,var(--tui-base-03) 25%,transparent 25%,transparent 75%,var(--tui-base-03) 75%,var(--tui-base-03)),linear-gradient(45deg,var(--tui-base-03) 25%,transparent 25%,transparent 75%,var(--tui-base-03) 75%,var(--tui-base-03));background-size:.375rem .375rem;background-position:0 0,.1875rem .1875rem;border-radius:inherit}.t-hr[_ngcontent-%COMP%]{block-size:1px;margin:0 0 0 -1px;border:none;background:var(--tui-base-03)}.t-gradient[_ngcontent-%COMP%]{margin:0 .5rem;border-radius:inherit}.t-select[_ngcontent-%COMP%]{margin:.75rem .5rem 0}.t-arrow[_ngcontent-%COMP%]{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-arrow_rotated[_ngcontent-%COMP%]{transform:rotate(180deg)}.t-menu[_ngcontent-%COMP%]{inline-size:11.25rem}.t-checkmark[_ngcontent-%COMP%]{margin-left:auto;inline-size:1rem;block-size:1rem}.t-buttons[_ngcontent-%COMP%]{display:flex;padding:0 .75rem 1.25rem;justify-content:space-between}.t-direction[_ngcontent-%COMP%]{color:var(--tui-text-02);margin:0 .375rem}.t-direction[_ngcontent-%COMP%]:hover, .t-direction_active[_ngcontent-%COMP%]{color:var(--tui-text-01);background:var(--tui-secondary-hover)}.t-edit[_ngcontent-%COMP%]{margin:1.25rem}.t-palette[_ngcontent-%COMP%]{box-sizing:border-box;box-shadow:inset 0 1px var(--tui-base-03)}'],changeDetection:0}),(0,m.Cg)([y.PE],e.prototype,"getStopsKeys",null),(0,m.Cg)([y.PE],e.prototype,"filterPalette",null),e})(),It=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD]}),e})(),Nt=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD,E.pp]}),e})(),Dt=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD,Q,Ct,It,mt,Nt,I.q,E.pp,p.uE,p.aO]}),e})()},6426:(t,e,n)=>{n.r(e),n.d(e,{CommandManager:()=>L,Editor:()=>Me,Extension:()=>ft,InputRule:()=>tt,Mark:()=>st,Node:()=>Ne,NodePos:()=>xe,NodeView:()=>De,PasteRule:()=>lt,Tracker:()=>Be,callOrReturn:()=>V,combineTransactionSteps:()=>Pt,createChainableState:()=>$,createDocument:()=>Lt,createNodeFromContent:()=>At,createStyleTag:()=>Se,defaultBlockAt:()=>Bt,deleteProps:()=>$t,elementFromString:()=>Et,escapeForRegEx:()=>$e,extensions:()=>Ce,findChildren:()=>_t,findChildrenInRange:()=>Ht,findDuplicates:()=>ht,findParentNode:()=>Ft,findParentNodeClosestToPos:()=>jt,fromString:()=>X,generateHTML:()=>Wt,generateJSON:()=>Xt,generateText:()=>Kt,getAttributes:()=>Yt,getAttributesFromExtensions:()=>_,getChangedRanges:()=>Qt,getDebugJSON:()=>Zt,getExtensionField:()=>P,getHTMLFromFragment:()=>Gt,getMarkAttributes:()=>zt,getMarkRange:()=>wt,getMarkType:()=>Ct,getMarksBetween:()=>te,getNodeAtPosition:()=>ee,getNodeAttributes:()=>Jt,getNodeType:()=>H,getRenderedAttributes:()=>F,getSchema:()=>Vt,getSchemaByResolvedExtensions:()=>J,getSchemaTypeByName:()=>Y,getSchemaTypeNameByName:()=>Rt,getSplittedAttributes:()=>ne,getText:()=>Ut,getTextBetween:()=>mt,getTextContentFromNodes:()=>Q,getTextSerializersFromSchema:()=>gt,injectExtensionAttributesToParseRule:()=>U,inputRulesPlugin:()=>ot,isActive:()=>ie,isAtEndOfNode:()=>re,isAtStartOfNode:()=>se,isEmptyObject:()=>W,isExtensionRulesEnabled:()=>q,isFunction:()=>G,isList:()=>ae,isMacOS:()=>Nt,isMarkActive:()=>oe,isNodeActive:()=>Dt,isNodeEmpty:()=>le,isNodeSelection:()=>ce,isNumber:()=>at,isPlainObject:()=>it,isRegExp:()=>Z,isString:()=>Le,isTextSelection:()=>xt,isiOS:()=>Tt,markInputRule:()=>Te,markPasteRule:()=>Re,mergeAttributes:()=>j,mergeDeep:()=>rt,minMax:()=>St,nodeInputRule:()=>Oe,nodePasteRule:()=>ze,objectIncludes:()=>yt,pasteRulesPlugin:()=>ut,posToDOMRect:()=>de,removeDuplicates:()=>qt,resolveFocusPosition:()=>Mt,selectionToInsertionEnd:()=>It,splitExtensions:()=>B,textInputRule:()=>Ae,textPasteRule:()=>Pe,textblockTypeInputRule:()=>Ee,wrappingInputRule:()=>Ie});var o=n(3829),i=n(7887),r=n(4103),s=n(9939),a=n(4238);const l=(t,e)=>!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function c(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const d=(t,e,n)=>{let i=c(t,n);if(!i)return!1;let r=f(i);if(!r){let n=i.blockRange(),o=n&&(0,a.jP)(n);return null!=o&&(e&&e(t.tr.lift(n,o).scrollIntoView()),!0)}let l=r.nodeBefore;if(S(t,r,e,-1))return!0;if(0==i.parent.content.size&&(h(l,"end")||o.nh.isSelectable(l)))for(let n=i.depth;;n--){let c=(0,a.$L)(t.doc,i.before(n),i.after(n),s.Ji.empty);if(c&&c.slice.size1)break}return!(!l.isAtom||r.depth!=i.depth-1||(e&&e(t.tr.delete(r.pos-l.nodeSize,r.pos).scrollIntoView()),0))};function u(t,e,n){let i=e.nodeBefore,r=e.pos-1;for(;!i.isTextblock;r--){if(i.type.spec.isolating)return!1;let t=i.lastChild;if(!t)return!1;i=t}let l=e.nodeAfter,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let t=l.firstChild;if(!t)return!1;l=t}let d=(0,a.$L)(t.doc,r,c,s.Ji.empty);if(!d||d.from!=r||d instanceof a.Ln&&d.slice.size>=c-r)return!1;if(n){let e=t.tr.step(d);e.setSelection(o.U3.create(e.doc,r)),n(e.scrollIntoView())}return!0}function h(t,e,n=!1){for(let o=t;o;o="start"==e?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&1!=o.childCount)return!1}return!1}const p=(t,e,n)=>{let{$head:i,empty:r}=t.selection,s=i;if(!r)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):i.parentOffset>0)return!1;s=f(i)}let a=s&&s.nodeBefore;return!(!a||!o.nh.isSelectable(a)||(e&&e(t.tr.setSelection(o.nh.create(t.doc,s.pos-a.nodeSize)).scrollIntoView()),0))};function f(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function m(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let i=m(t,n);if(!i)return!1;let r=y(i);if(!r)return!1;let l=r.nodeAfter;if(S(t,r,e,1))return!0;if(0==i.parent.content.size&&(h(l,"start")||o.nh.isSelectable(l))){let n=(0,a.$L)(t.doc,i.before(),i.after(),s.Ji.empty);if(n&&n.slice.size{let{$head:i,empty:r}=t.selection,s=i;if(!r)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):i.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let{$head:n,$anchor:o}=t.selection;return!(!n.parent.type.spec.code||!n.sameParent(o)||(e&&e(t.tr.insertText("\n").scrollIntoView()),0))};function v(t){for(let e=0;e{let{$head:n,$anchor:i}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(i))return!1;let r=n.node(-1),s=n.indexAfter(-1),a=v(r.contentMatchAt(s));if(!a||!r.canReplaceWith(s,s,a))return!1;if(e){let i=n.after(),r=t.tr.replaceWith(i,i,a.createAndFill());r.setSelection(o.LN.near(r.doc.resolve(i),1)),e(r.scrollIntoView())}return!0},C=(t,e)=>{let n=t.selection,{$from:i,$to:r}=n;if(n instanceof o.i5||i.parent.inlineContent||r.parent.inlineContent)return!1;let s=v(r.parent.contentMatchAt(r.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let n=(!i.parentOffset&&r.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if((0,a.zy)(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let o=n.blockRange(),i=o&&(0,a.jP)(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)};function S(t,e,n,i){let r,l,c=e.nodeBefore,d=e.nodeAfter,u=c.type.spec.isolating||d.type.spec.isolating;if(!u&&function(t,e,n){let o=e.nodeBefore,i=e.nodeAfter,r=e.index();return!(!(o&&i&&o.type.compatibleContent(i.type))||(!o.content.size&&e.parent.canReplace(r-1,r)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),0):!e.parent.canReplace(r,r+1)||!i.isTextblock&&!(0,a.n9)(t.doc,e.pos)||(n&&n(t.tr.clearIncompatible(e.pos,o.type,o.contentMatchAt(o.childCount)).join(e.pos).scrollIntoView()),0)))}(t,e,n))return!0;let p=!u&&e.parent.canReplace(e.index(),e.index()+1);if(p&&(r=(l=c.contentMatchAt(c.childCount)).findWrapping(d.type))&&l.matchType(r[0]||d.type).validEnd){if(n){let o=e.pos+d.nodeSize,i=s.FK.empty;for(let t=r.length-1;t>=0;t--)i=s.FK.from(r[t].create(null,i));i=s.FK.from(c.copy(i));let l=t.tr.step(new a.Wg(e.pos-1,o,e.pos,o,new s.Ji(i,1,0),r.length,!0)),u=o+2*r.length;(0,a.n9)(l.doc,u)&&l.join(u),n(l.scrollIntoView())}return!0}let f=d.type.spec.isolating||i>0&&u?null:o.LN.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&(0,a.jP)(m);if(null!=g&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(p&&h(d,"start",!0)&&h(c,"end")){let o=c,i=[];for(;i.push(o),!o.isTextblock;)o=o.lastChild;let r=d,l=1;for(;!r.isTextblock;r=r.firstChild)l++;if(o.canReplace(o.childCount,o.childCount,r.content)){if(n){let o=s.FK.empty;for(let t=i.length-1;t>=0;t--)o=s.FK.from(i[t].copy(o));n(t.tr.step(new a.Wg(e.pos-i.length,e.pos+d.nodeSize,e.pos+l,e.pos+d.nodeSize-l,new s.Ji(o,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function M(t){return function(e,n){let i=e.selection,r=t<0?i.$from:i.$to,s=r.depth;for(;r.node(s).isInline;){if(!s)return!1;s--}return!!r.node(s).isTextblock&&(n&&n(e.tr.setSelection(o.U3.create(e.doc,t<0?r.start(s):r.end(s)))),!0)}}const T=M(-1),O=M(1);function E(t,e=null){return function(n,o){let i=!1;for(let o=0;o{if(i)return!1;if(o.isTextblock&&!o.hasMarkup(t,e))if(o.type==t)i=!0;else{let e=n.doc.resolve(r),o=e.index();i=e.parent.canReplaceWith(o,o+1,t)}}))}if(!i)return!1;if(o){let i=n.tr;for(let o=0;o{let{$from:n,$to:i}=t.selection;if(t.selection instanceof o.nh&&t.selection.node.isBlock)return!(!n.parentOffset||!(0,a.zy)(t.doc,n.pos)||(e&&e(t.tr.split(n.pos).scrollIntoView()),0));if(!n.parent.isBlock)return!1;if(e){let r=i.parentOffset==i.parent.content.size,s=t.tr;(t.selection instanceof o.U3||t.selection instanceof o.i5)&&s.deleteSelection();let l=0==n.depth?null:v(n.node(-1).contentMatchAt(n.indexAfter(-1))),c=r&&l?[{type:l}]:void 0,d=(0,a.zy)(s.doc,s.mapping.map(n.pos),1,c);if(c||d||!(0,a.zy)(s.doc,s.mapping.map(n.pos),1,l?[{type:l}]:void 0)||(l&&(c=[{type:l}]),d=!0),d&&(s.split(s.mapping.map(n.pos),1,c),!r&&!n.parentOffset&&n.parent.type!=l)){let t=s.mapping.map(n.before()),e=s.doc.resolve(t);l&&n.node(-1).canReplaceWith(e.index(),e.index()+1,l)&&s.setNodeMarkup(s.mapping.map(n.before()),l)}e(s.scrollIntoView())}return!0})),"Mod-Enter":w,Backspace:I,"Mod-Backspace":I,"Shift-Backspace":I,Delete:N,"Mod-Delete":N,"Mod-a":(t,e)=>(e&&e(t.tr.setSelection(new o.i5(t.doc))),!0)},R={"Ctrl-h":D.Backspace,"Alt-Backspace":D["Mod-Backspace"],"Ctrl-d":D.Delete,"Ctrl-Alt-Backspace":D["Mod-Delete"],"Alt-Delete":D["Mod-Delete"],"Alt-d":D["Mod-Delete"],"Ctrl-a":T,"Ctrl-e":O};for(let t in D)R[t]=D[t];function $(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:i}=n,{storedMarks:r}=n;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 r},get selection(){return o},get doc(){return i},get tr(){return o=n.selection,i=n.doc,r=n.storedMarks,n}}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();class L{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:o}=e,{tr:i}=n,r=this.buildProps(i);return Object.fromEntries(Object.entries(t).map((([t,e])=>[t,(...t)=>{const n=e(...t)(r);return i.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(i),n}])))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:o,state:i}=this,{view:r}=o,s=[],a=!!t,l=t||i.tr,c={...Object.fromEntries(Object.entries(n).map((([t,n])=>[t,(...t)=>{const o=this.buildProps(l,e),i=n(...t)(o);return s.push(i),c}]))),run:()=>(a||!e||l.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(l),s.every((t=>!0===t)))};return c}createCan(t){const{rawCommands:e,state:n}=this,o=!1,i=t||n.tr,r=this.buildProps(i,o);return{...Object.fromEntries(Object.entries(e).map((([t,e])=>[t,(...t)=>e(...t)({...r,dispatch:void 0})]))),chain:()=>this.createChain(i,o)}}buildProps(t,e=!0){const{rawCommands:n,editor:o,state:i}=this,{view:r}=o,s={tr:t,editor:o,view:r,state:$({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map((([t,e])=>[t,(...t)=>e(...t)(s)])))}};return s}}class z{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach((t=>t.apply(this,e))),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter((t=>t!==e)):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}}function P(t,e,n){return void 0===t.config[e]&&t.parent?P(t.parent,e,n):"function"==typeof t.config[e]?t.config[e].bind({...n,parent:t.parent?P(t.parent,e,n):null}):t.config[e]}function B(t){return{baseExtensions:t.filter((t=>"extension"===t.type)),nodeExtensions:t.filter((t=>"node"===t.type)),markExtensions:t.filter((t=>"mark"===t.type))}}function _(t){const e=[],{nodeExtensions:n,markExtensions:o}=B(t),i=[...n,...o],r={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach((t=>{const n=P(t,"addGlobalAttributes",{name:t.name,options:t.options,storage:t.storage,extensions:i});n&&n().forEach((t=>{t.types.forEach((n=>{Object.entries(t.attributes).forEach((([t,o])=>{e.push({type:n,name:t,attribute:{...r,...o}})}))}))}))})),i.forEach((t=>{const n={name:t.name,options:t.options,storage:t.storage},o=P(t,"addAttributes",n);if(!o)return;const i=o();Object.entries(i).forEach((([n,o])=>{const i={...r,...o};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&void 0===(null==i?void 0:i.default)&&delete i.default,e.push({type:t.name,name:n,attribute:i})}))})),e}function H(t,e){if("string"==typeof t){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function j(...t){return t.filter((t=>!!t)).reduce(((t,e)=>{const n={...t};return Object.entries(e).forEach((([t,e])=>{if(n[t])if("class"===t){const o=e?e.split(" "):[],i=n[t]?n[t].split(" "):[],r=o.filter((t=>!i.includes(t)));n[t]=[...i,...r].join(" ")}else if("style"===t){const o=e?e.split(";").map((t=>t.trim())).filter(Boolean):[],i=n[t]?n[t].split(";").map((t=>t.trim())).filter(Boolean):[],r=new Map;i.forEach((t=>{const[e,n]=t.split(":").map((t=>t.trim()));r.set(e,n)})),o.forEach((t=>{const[e,n]=t.split(":").map((t=>t.trim()));r.set(e,n)})),n[t]=Array.from(r.entries()).map((([t,e])=>`${t}: ${e}`)).join("; ")}else n[t]=e;else n[t]=e})),n}),{})}function F(t,e){return e.filter((e=>e.type===t.type.name)).filter((t=>t.attribute.rendered)).map((e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]})).reduce(((t,e)=>j(t,e)),{})}function G(t){return"function"==typeof t}function V(t,e=void 0,...n){return G(t)?e?t.bind(e)(...n):t(...n):t}function W(t={}){return 0===Object.keys(t).length&&t.constructor===Object}function X(t){return"string"!=typeof t?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):"true"===t||"false"!==t&&t}function U(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(!1===o)return!1;const i=e.reduce(((t,e)=>{const o=e.attribute.parseHTML?e.attribute.parseHTML(n):X(n.getAttribute(e.name));return null==o?t:{...t,[e.name]:o}}),{});return{...o,...i}}}}function K(t){return Object.fromEntries(Object.entries(t).filter((([t,e])=>("attrs"!==t||!W(e))&&null!=e)))}function J(t,e){var n;const o=_(t),{nodeExtensions:i,markExtensions:r}=B(t),a=null===(n=i.find((t=>P(t,"topNode"))))||void 0===n?void 0:n.name,l=Object.fromEntries(i.map((n=>{const i=o.filter((t=>t.type===n.name)),r={name:n.name,options:n.options,storage:n.storage,editor:e},s=K({...t.reduce(((t,e)=>{const o=P(e,"extendNodeSchema",r);return{...t,...o?o(n):{}}}),{}),content:V(P(n,"content",r)),marks:V(P(n,"marks",r)),group:V(P(n,"group",r)),inline:V(P(n,"inline",r)),atom:V(P(n,"atom",r)),selectable:V(P(n,"selectable",r)),draggable:V(P(n,"draggable",r)),code:V(P(n,"code",r)),whitespace:V(P(n,"whitespace",r)),defining:V(P(n,"defining",r)),isolating:V(P(n,"isolating",r)),attrs:Object.fromEntries(i.map((t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]})))}),a=V(P(n,"parseHTML",r));a&&(s.parseDOM=a.map((t=>U(t,i))));const l=P(n,"renderHTML",r);l&&(s.toDOM=t=>l({node:t,HTMLAttributes:F(t,i)}));const c=P(n,"renderText",r);return c&&(s.toText=c),[n.name,s]}))),c=Object.fromEntries(r.map((n=>{const i=o.filter((t=>t.type===n.name)),r={name:n.name,options:n.options,storage:n.storage,editor:e},s=K({...t.reduce(((t,e)=>{const o=P(e,"extendMarkSchema",r);return{...t,...o?o(n):{}}}),{}),inclusive:V(P(n,"inclusive",r)),excludes:V(P(n,"excludes",r)),group:V(P(n,"group",r)),spanning:V(P(n,"spanning",r)),code:V(P(n,"code",r)),attrs:Object.fromEntries(i.map((t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]})))}),a=V(P(n,"parseHTML",r));a&&(s.parseDOM=a.map((t=>U(t,i))));const l=P(n,"renderHTML",r);return l&&(s.toDOM=t=>l({mark:t,HTMLAttributes:F(t,i)})),[n.name,s]})));return new s.Sj({topNode:a,nodes:l,marks:c})}function Y(t,e){return e.nodes[t]||e.marks[t]||null}function q(t,e){return Array.isArray(e)?e.some((e=>("string"==typeof e?e:e.name)===t.name)):e}const Q=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,((t,e,i,r)=>{var s,a;const l=(null===(a=(s=t.type.spec).toText)||void 0===a?void 0:a.call(s,{node:t,pos:e,parent:i,index:r}))||t.textContent||"%leaf%";n+=t.isAtom&&!t.isText?l:l.slice(0,Math.max(0,o-e))})),n};function Z(t){return"[object RegExp]"===Object.prototype.toString.call(t)}class tt{constructor(t){this.find=t.find,this.handler=t.handler}}const et=(t,e)=>{if(Z(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o};function nt(t){var e;const{editor:n,from:o,to:i,text:r,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(o);if(c.parent.type.spec.code||(null===(e=c.nodeBefore||c.nodeAfter)||void 0===e?void 0:e.marks.find((t=>t.type.spec.code))))return!1;let d=!1;const u=Q(c)+r;return s.forEach((t=>{if(d)return;const e=et(u,t.find);if(!e)return;const s=l.state.tr,c=$({state:l.state,transaction:s}),h={from:o-(e[0].length-r.length),to:i},{commands:p,chain:f,can:m}=new L({editor:n,state:c});null!==t.handler({state:c,range:h,match:e,commands:p,chain:f,can:m})&&s.steps.length&&(s.setMeta(a,{transform:s,from:o,to:i,text:r}),l.dispatch(s),d=!0)})),d}function ot(t){const{editor:e,rules:n}=t,i=new o.k_({state:{init:()=>null,apply(t,o){const r=t.getMeta(i);if(r)return r;const s=t.getMeta("applyInputRules");return!!s&&setTimeout((()=>{const{from:t,text:o}=s,r=t+o.length;nt({editor:e,from:t,to:r,text:o,rules:n,plugin:i})})),t.selectionSet||t.docChanged?null:o}},props:{handleTextInput:(t,o,r,s)=>nt({editor:e,from:o,to:r,text:s,rules:n,plugin:i}),handleDOMEvents:{compositionend:t=>(setTimeout((()=>{const{$cursor:o}=t.state.selection;o&&nt({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:i})})),!1)},handleKeyDown(t,o){if("Enter"!==o.key)return!1;const{$cursor:r}=t.state.selection;return!!r&&nt({editor:e,from:r.pos,to:r.pos,text:"\n",rules:n,plugin:i})}},isInputRules:!0});return i}function it(t){return"Object"===function(t){return Object.prototype.toString.call(t).slice(8,-1)}(t)&&t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function rt(t,e){const n={...t};return it(t)&&it(e)&&Object.keys(e).forEach((o=>{it(e[o])&&it(t[o])?n[o]=rt(t[o],e[o]):n[o]=e[o]})),n}class st{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=V(P(this,"addOptions",{name:this.name}))),this.storage=V(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new st(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>rt(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new st(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=V(P(e,"addOptions",{name:e.name})),e.storage=V(P(e,"addStorage",{name:e.name,options:e.options})),e}static handleExit({editor:t,mark:e}){const{tr:n}=t.state,o=t.state.selection.$from;if(o.pos===o.end()){const i=o.marks();if(!i.find((t=>(null==t?void 0:t.type.name)===e.name)))return!1;const r=i.find((t=>(null==t?void 0:t.type.name)===e.name));return r&&n.removeStoredMark(r),n.insertText(" ",o.pos),t.view.dispatch(n),!0}return!1}}function at(t){return"number"==typeof t}class lt{constructor(t){this.find=t.find,this.handler=t.handler}}const ct=(t,e,n)=>{if(Z(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map((e=>{const n=[e.text];return n.index=e.index,n.input=t,n.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(e.replaceWith)),n})):[]},dt=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(e=n.clipboardData)||void 0===e||e.setData("text/html",t),n};function ut(t){const{editor:e,rules:n}=t;let i=null,r=!1,s=!1,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l="undefined"!=typeof DragEvent?new DragEvent("drop"):null;const c=({state:t,from:n,to:o,rule:i,pasteEvt:r})=>{const s=t.tr,c=$({state:t,transaction:s}),d=function(t){const{editor:e,state:n,from:o,to:i,rule:r,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:d}=new L({editor:e,state:n}),u=[];return n.doc.nodesBetween(o,i,((t,e)=>{if(!t.isTextblock||t.type.spec.code)return;const h=Math.max(o,e),p=Math.min(i,e+t.content.size),f=t.textBetween(h-e,p-e,void 0,"");ct(f,r.find,s).forEach((t=>{if(void 0===t.index)return;const e=h+t.index+1,o=e+t[0].length,i={from:n.tr.mapping.map(e),to:n.tr.mapping.map(o)},p=r.handler({state:n,range:i,match:t,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});u.push(p)}))})),u.every((t=>null!==t))}({editor:e,state:c,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:r,dropEvent:l});if(d&&s.steps.length)return l="undefined"!=typeof DragEvent?new DragEvent("drop"):null,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,s};return n.map((t=>new o.k_({view(t){const e=e=>{var n;i=(null===(n=t.dom.parentElement)||void 0===n?void 0:n.contains(e.target))?t.dom.parentElement:null};return window.addEventListener("dragstart",e),{destroy(){window.removeEventListener("dragstart",e)}}},props:{handleDOMEvents:{drop:(t,e)=>(s=i===t.dom.parentElement,l=e,!1),paste:(t,e)=>{var n;const o=null===(n=e.clipboardData)||void 0===n?void 0:n.getData("text/html");return a=e,r=!!(null==o?void 0:o.includes("data-pm-slice")),!1}}},appendTransaction:(e,n,o)=>{const i=e[0],l="paste"===i.getMeta("uiEvent")&&!r,d="drop"===i.getMeta("uiEvent")&&!s,u=i.getMeta("applyPasteRules"),h=!!u;if(!l&&!d&&!h)return;if(h){const{from:e,text:n}=u,i=e+n.length,r=dt(n);return c({rule:t,state:o,from:e,to:{b:i},pasteEvt:r})}const p=n.doc.content.findDiffStart(o.doc.content),f=n.doc.content.findDiffEnd(o.doc.content);return at(p)&&f&&p!==f.b?c({rule:t,state:o,from:p,to:f,pasteEvt:a}):void 0}})))}function ht(t){const e=t.filter(((e,n)=>t.indexOf(e)!==n));return Array.from(new Set(e))}class pt{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=pt.resolve(t),this.schema=J(this.extensions,e),this.setupExtensions()}static resolve(t){const e=pt.sort(pt.flatten(t)),n=ht(e.map((t=>t.name)));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((t=>`'${t}'`)).join(", ")}]. This can lead to issues.`),e}static flatten(t){return t.map((t=>{const e=P(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...this.flatten(e())]:t})).flat(10)}static sort(t){return t.sort(((t,e)=>{const n=P(t,"priority")||100,o=P(e,"priority")||100;return n>o?-1:n{const n=P(e,"addCommands",{name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Y(e.name,this.schema)});return n?{...t,...n()}:t}),{})}get plugins(){const{editor:t}=this,e=pt.sort([...this.extensions].reverse()),n=[],o=[],i=e.map((e=>{const i={name:e.name,options:e.options,storage:e.storage,editor:t,type:Y(e.name,this.schema)},s=[],a=P(e,"addKeyboardShortcuts",i);let l={};if("mark"===e.type&&P(e,"exitable",i)&&(l.ArrowRight=()=>st.handleExit({editor:t,mark:e})),a){const e=Object.fromEntries(Object.entries(a()).map((([e,n])=>[e,()=>n({editor:t})])));l={...l,...e}}const c=(0,r.w)(l);s.push(c);const d=P(e,"addInputRules",i);q(e,t.options.enableInputRules)&&d&&n.push(...d());const u=P(e,"addPasteRules",i);q(e,t.options.enablePasteRules)&&u&&o.push(...u());const h=P(e,"addProseMirrorPlugins",i);if(h){const t=h();s.push(...t)}return s})).flat();return[ot({editor:t,rules:n}),...ut({editor:t,rules:o}),...i]}get attributes(){return _(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=B(this.extensions);return Object.fromEntries(e.filter((t=>!!P(t,"addNodeView"))).map((e=>{const n=this.attributes.filter((t=>t.type===e.name)),o={name:e.name,options:e.options,storage:e.storage,editor:t,type:H(e.name,this.schema)},i=P(e,"addNodeView",o);return i?[e.name,(o,r,s,a,l)=>{const c=F(o,n);return i()({node:o,view:r,getPos:s,decorations:a,innerDecorations:l,editor:t,extension:e,HTMLAttributes:c})}]:[]})))}setupExtensions(){this.extensions.forEach((t=>{var e;this.editor.extensionStorage[t.name]=t.storage;const n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Y(t.name,this.schema)};"mark"===t.type&&(null===(e=V(P(t,"keepOnSplit",n)))||void 0===e||e)&&this.splittableMarks.push(t.name);const o=P(t,"onBeforeCreate",n),i=P(t,"onCreate",n),r=P(t,"onUpdate",n),s=P(t,"onSelectionUpdate",n),a=P(t,"onTransaction",n),l=P(t,"onFocus",n),c=P(t,"onBlur",n),d=P(t,"onDestroy",n);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),r&&this.editor.on("update",r),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)}))}}class ft{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=V(P(this,"addOptions",{name:this.name}))),this.storage=V(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new ft(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>rt(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new ft({...this.config,...t});return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=V(P(e,"addOptions",{name:e.name})),e.storage=V(P(e,"addStorage",{name:e.name,options:e.options})),e}}function mt(t,e,n){const{from:o,to:i}=e,{blockSeparator:r="\n\n",textSerializers:s={}}=n||{};let a="";return t.nodesBetween(o,i,((t,n,l,c)=>{var d;t.isBlock&&n>o&&(a+=r);const u=null==s?void 0:s[t.type.name];if(u)return l&&(a+=u({node:t,pos:n,parent:l,index:c,range:e})),!1;t.isText&&(a+=null===(d=null==t?void 0:t.text)||void 0===d?void 0:d.slice(Math.max(o,n)-n,i-n))})),a}function gt(t){return Object.fromEntries(Object.entries(t.nodes).filter((([,t])=>t.spec.toText)).map((([t,e])=>[t,e.spec.toText])))}const bt=ft.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new o.k_({key:new o.hs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:i}=e,{ranges:r}=i,s=Math.min(...r.map((t=>t.$from.pos))),a=Math.max(...r.map((t=>t.$to.pos))),l=gt(n);return mt(o,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}});function yt(t,e,n={strict:!0}){const o=Object.keys(e);return!o.length||o.every((o=>n.strict?e[o]===t[o]:Z(e[o])?e[o].test(t[o]):e[o]===t[o]))}function kt(t,e,n={}){return t.find((t=>t.type===e&&yt(t.attrs,n)))}function vt(t,e,n={}){return!!kt(t,e,n)}function wt(t,e,n={}){if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if(t.parentOffset===o.offset&&0!==o.offset&&(o=t.parent.childBefore(t.parentOffset)),!o.node)return;const i=kt([...o.node.marks],e,n);if(!i)return;let r=o.index,s=t.start()+o.offset,a=r+1,l=s+o.node.nodeSize;for(kt([...o.node.marks],e,n);r>0&&i.isInSet(t.parent.child(r-1).marks);)r-=1,s-=t.parent.child(r).nodeSize;for(;a{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];3===o.nodeType&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):1===o.nodeType&&Ot(o)}return t};function Et(t){const e=`${t}`,n=(new window.DOMParser).parseFromString(e,"text/html").body;return Ot(n)}function At(t,e,n){n={slice:!0,parseOptions:{},...n};const o="string"==typeof t;if("object"==typeof t&&null!==t)try{if(Array.isArray(t)&&t.length>0)return s.FK.fromArray(t.map((t=>e.nodeFromJSON(t))));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),At("",e,n)}if(o){if(n.errorOnInvalidContent){let o=!1,i="";const r=new s.Sj({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:t=>(o=!0,i="string"==typeof t?t:t.outerHTML,null)}]}})});if(n.slice?s.S4.fromSchema(r).parseSlice(Et(t),n.parseOptions):s.S4.fromSchema(r).parse(Et(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const o=s.S4.fromSchema(e);return n.slice?o.parseSlice(Et(t),n.parseOptions).content:o.parse(Et(t),n.parseOptions)}return At("",e,n)}function It(t,e,n){const i=t.steps.length-1;if(i{0===l&&(l=o)})),t.setSelection(o.LN.near(t.doc.resolve(l),n))}function Nt(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function Dt(t,e,n={}){const{from:o,to:i,empty:r}=t.selection,s=e?H(e,t.schema):null,a=[];t.doc.nodesBetween(o,i,((t,e)=>{if(t.isText)return;const n=Math.max(o,e),r=Math.min(i,e+t.nodeSize);a.push({node:t,from:n,to:r})}));const l=i-o,c=a.filter((t=>!s||s.name===t.node.type.name)).filter((t=>yt(t.node.attrs,n,{strict:!1})));return r?!!c.length:c.reduce(((t,e)=>t+e.to-e.from),0)>=l}function Rt(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function $t(t,e){const n="string"==typeof e?[e]:e;return Object.keys(t).reduce(((e,o)=>(n.includes(o)||(e[o]=t[o]),e)),{})}function Lt(t,e,n={},o={}){return At(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}function zt(t,e){const n=Ct(e,t.schema),{from:o,to:i,empty:r}=t.selection,s=[];r?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,i,(t=>{s.push(...t.marks)}));const a=s.find((t=>t.type.name===n.name));return a?{...a.attrs}:{}}function Pt(t,e){const n=new a.dL(t);return e.forEach((t=>{t.steps.forEach((t=>{n.step(t)}))})),n}function Bt(t){for(let e=0;e{e(t)&&n.push({node:t,pos:o})})),n}function Ht(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,((t,e)=>{n(t)&&o.push({node:t,pos:e})})),o}function jt(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function Ft(t){return e=>jt(e.$from,t)}function Gt(t,e){const n=s.ZF.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function Vt(t,e){return J(pt.resolve(t),e)}function Wt(t,e){const n=Vt(e);return Gt(s.bP.fromJSON(n,t).content,n)}function Xt(t,e){const n=Vt(e),o=Et(t);return s.S4.fromSchema(n).parse(o).toJSON()}function Ut(t,e){return mt(t,{from:0,to:t.content.size},e)}function Kt(t,e,n){const{blockSeparator:o="\n\n",textSerializers:i={}}=n||{},r=Vt(e);return Ut(s.bP.fromJSON(r,t),{blockSeparator:o,textSerializers:{...gt(r),...i}})}function Jt(t,e){const n=H(e,t.schema),{from:o,to:i}=t.selection,r=[];t.doc.nodesBetween(o,i,(t=>{r.push(t)}));const s=r.reverse().find((t=>t.type.name===n.name));return s?{...s.attrs}:{}}function Yt(t,e){const n=Rt("string"==typeof e?e:e.name,t.schema);return"node"===n?Jt(t,e):"mark"===n?zt(t,e):{}}function qt(t,e=JSON.stringify){const n={};return t.filter((t=>{const o=e(t);return!Object.prototype.hasOwnProperty.call(n,o)&&(n[o]=!0)}))}function Qt(t){const{mapping:e,steps:n}=t,o=[];return e.maps.forEach(((t,i)=>{const r=[];if(t.ranges.length)t.forEach(((t,e)=>{r.push({from:t,to:e})}));else{const{from:t,to:e}=n[i];if(void 0===t||void 0===e)return;r.push({from:t,to:e})}r.forEach((({from:t,to:n})=>{const r=e.slice(i).map(t,-1),s=e.slice(i).map(n),a=e.invert().map(r,-1),l=e.invert().map(s);o.push({oldRange:{from:a,to:l},newRange:{from:r,to:s}})}))})),function(t){const e=qt(t);return 1===e.length?e:e.filter(((t,n)=>!e.filter(((t,e)=>e!==n)).some((e=>t.oldRange.from>=e.oldRange.from&&t.oldRange.to<=e.oldRange.to&&t.newRange.from>=e.newRange.from&&t.newRange.to<=e.newRange.to))))}(o)}function Zt(t,e=0){const n=t.type===t.type.schema.topNodeType?0:1,o=e,i=o+t.nodeSize,r=t.marks.map((t=>{const e={type:t.type.name};return Object.keys(t.attrs).length&&(e.attrs={...t.attrs}),e})),s={...t.attrs},a={type:t.type.name,from:o,to:i};return Object.keys(s).length&&(a.attrs=s),r.length&&(a.marks=r),t.content.childCount&&(a.content=[],t.forEach(((t,o)=>{var i;null===(i=a.content)||void 0===i||i.push(Zt(t,e+o+n))}))),t.text&&(a.text=t.text),a}function te(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach((e=>{const i=wt(n.resolve(t),e.type);i&&o.push({mark:e,...i})})):n.nodesBetween(t,e,((t,e)=>{t&&void 0!==(null==t?void 0:t.nodeSize)&&o.push(...t.marks.map((n=>({from:e,to:e+t.nodeSize,mark:n}))))})),o}const ee=(t,e,n,o=20)=>{const i=t.doc.resolve(n);let r=o,s=null;for(;r>0&&null===s;){const t=i.node(r);(null==t?void 0:t.type.name)===e?s=t:r-=1}return[s,r]};function ne(t,e,n){return Object.fromEntries(Object.entries(n).filter((([n])=>{const o=t.find((t=>t.type===e&&t.name===n));return!!o&&o.attribute.keepOnSplit})))}function oe(t,e,n={}){const{empty:o,ranges:i}=t.selection,r=e?Ct(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter((t=>!r||r.name===t.type.name)).find((t=>yt(t.attrs,n,{strict:!1})));let s=0;const a=[];if(i.forEach((({$from:e,$to:n})=>{const o=e.pos,i=n.pos;t.doc.nodesBetween(o,i,((t,e)=>{if(!t.isText&&!t.marks.length)return;const n=Math.max(o,e),r=Math.min(i,e+t.nodeSize);s+=r-n,a.push(...t.marks.map((t=>({mark:t,from:n,to:r}))))}))})),0===s)return!1;const l=a.filter((t=>!r||r.name===t.mark.type.name)).filter((t=>yt(t.mark.attrs,n,{strict:!1}))).reduce(((t,e)=>t+e.to-e.from),0),c=a.filter((t=>!r||t.mark.type!==r&&t.mark.type.excludes(r))).reduce(((t,e)=>t+e.to-e.from),0);return(l>0?l+c:l)>=s}function ie(t,e,n={}){if(!e)return Dt(t,null,n)||oe(t,null,n);const o=Rt(e,t.schema);return"node"===o?Dt(t,e,n):"mark"===o&&oe(t,e,n)}const re=(t,e)=>{const{$from:n,$to:o,$anchor:i}=t.selection;if(e){const n=Ft((t=>t.type.name===e))(t.selection);if(!n)return!1;const o=t.doc.resolve(n.pos+1);return i.pos+1===o.end()}return!(o.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function ae(t,e){const{nodeExtensions:n}=B(e),o=n.find((e=>e.name===t));if(!o)return!1;const i=V(P(o,"group",{name:o.name,options:o.options,storage:o.storage}));return"string"==typeof i&&i.split(" ").includes("list")}function le(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if("hardBreak"===t.type.name)return!0;if(t.isText)return/^\s*$/m.test(null!==(o=t.text)&&void 0!==o?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(0===t.content.childCount)return!0;if(e){let o=!0;return t.content.forEach((t=>{!1!==o&&(le(t,{ignoreWhitespace:n,checkChildren:e})||(o=!1))})),o}return!1}function ce(t){return t instanceof o.nh}function de(t,e,n){const o=t.state.doc.content.size,i=St(e,0,o),r=St(n,0,o),s=t.coordsAtPos(i),a=t.coordsAtPos(r,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),d=Math.min(s.left,a.left),u=Math.max(s.right,a.right),h={top:l,bottom:c,left:d,right:u,width:u-d,height:c-l,x:d,y:l};return{...h,toJSON:()=>h}}function ue(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter((t=>null==e?void 0:e.includes(t.type.name)));t.tr.ensureMarks(o)}}const he=(t,e)=>{const n=Ft((t=>t.type===e))(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===o)return!0;const i=t.doc.nodeAt(o);return n.node.type!==(null==i?void 0:i.type)||!(0,a.n9)(t.doc,n.pos)||(t.join(n.pos),!0)},pe=(t,e)=>{const n=Ft((t=>t.type===e))(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(void 0===o)return!0;const i=t.doc.nodeAt(o);return n.node.type!==(null==i?void 0:i.type)||!(0,a.n9)(t.doc,o)||(t.join(o),!0)};var fe=Object.freeze({__proto__:null,blur:()=>({editor:t,view:e})=>(requestAnimationFrame((()=>{var n;t.isDestroyed||(e.dom.blur(),null===(n=null===window||void 0===window?void 0:window.getSelection())||void 0===n||n.removeAllRanges())})),!0),clearContent:(t=!1)=>({commands:e})=>e.setContent("",t),clearNodes:()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:i}=o;return!n||(i.forEach((({$from:n,$to:o})=>{t.doc.nodesBetween(n.pos,o.pos,((t,n)=>{if(t.type.isText)return;const{doc:o,mapping:i}=e,r=o.resolve(i.map(n)),s=o.resolve(i.map(n+t.nodeSize)),l=r.blockRange(s);if(!l)return;const c=(0,a.jP)(l);if(t.type.isTextblock){const{defaultType:t}=r.parent.contentMatchAt(r.index());e.setNodeMarkup(l.start,t)}(c||0===c)&&e.lift(l,c)}))})),!0)},command:t=>e=>t(e),createParagraphNear:()=>({state:t,dispatch:e})=>C(t,e),cut:(t,e)=>({editor:n,tr:i})=>{const{state:r}=n,s=r.doc.slice(t.from,t.to);i.deleteRange(t.from,t.to);const a=i.mapping.map(e);return i.insert(a,s.content),i.setSelection(new o.U3(i.doc.resolve(a-1))),!0},deleteCurrentNode:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const i=t.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===o.type){if(e){const e=i.before(n),o=i.after(n);t.delete(e,o).scrollIntoView()}return!0}return!1},deleteNode:t=>({tr:e,state:n,dispatch:o})=>{const i=H(t,n.schema),r=e.selection.$anchor;for(let t=r.depth;t>0;t-=1)if(r.node(t).type===i){if(o){const n=r.before(t),o=r.after(t);e.delete(n,o).scrollIntoView()}return!0}return!1},deleteRange:t=>({tr:e,dispatch:n})=>{const{from:o,to:i}=t;return n&&e.delete(o,i),!0},deleteSelection:()=>({state:t,dispatch:e})=>l(t,e),enter:()=>({commands:t})=>t.keyboardShortcut("Enter"),exitCode:()=>({state:t,dispatch:e})=>w(t,e),extendMarkRange:(t,e={})=>({tr:n,state:i,dispatch:r})=>{const s=Ct(t,i.schema),{doc:a,selection:l}=n,{$from:c,from:d,to:u}=l;if(r){const t=wt(c,s,e);if(t&&t.from<=d&&t.to>=u){const e=o.U3.create(a,t.from,t.to);n.setSelection(e)}}return!0},first:t=>e=>{const n="function"==typeof t?t(e):t;for(let t=0;t({editor:n,view:o,tr:i,dispatch:r})=>{e={scrollIntoView:!0,...e};const s=()=>{Tt()&&o.dom.focus(),requestAnimationFrame((()=>{n.isDestroyed||(o.focus(),(null==e?void 0:e.scrollIntoView)&&n.commands.scrollIntoView())}))};if(o.hasFocus()&&null===t||!1===t)return!0;if(r&&null===t&&!xt(n.state.selection))return s(),!0;const a=Mt(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return r&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},forEach:(t,e)=>n=>t.every(((t,o)=>e(t,{...n,index:o}))),insertContent:(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),insertContentAt:(t,e,n)=>({tr:o,dispatch:i,editor:r})=>{var s;if(i){let i;n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};try{i=At(e,r.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:null!==(s=n.errorOnInvalidContent)&&void 0!==s?s:r.options.enableContentCheck})}catch(t){return r.emit("contentError",{editor:r,error:t,disableCollaboration:()=>{console.error("[tiptap error]: Unable to disable collaboration at this point in time")}}),!1}let a,{from:l,to:c}="number"==typeof t?{from:t,to:t}:{from:t.from,to:t.to},d=!0,u=!0;if(("type"in i?[i]:i).forEach((t=>{t.check(),d=!!d&&t.isText&&0===t.marks.length,u=!!u&&t.isBlock})),l===c&&u){const{parent:t}=o.doc.resolve(l);t.isTextblock&&!t.type.spec.code&&!t.childCount&&(l-=1,c+=1)}d?(a=Array.isArray(e)?e.map((t=>t.text||"")).join(""):"object"==typeof e&&e&&e.text?e.text:e,o.insertText(a,l,c)):(a=i,o.replaceWith(l,c,a)),n.updateSelection&&It(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:l,text:a}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:l,text:a})}return!0},joinBackward:()=>({state:t,dispatch:e})=>d(t,e),joinDown:()=>({state:t,dispatch:e})=>((t,e)=>{let n,i=t.selection;if(i instanceof o.nh){if(i.node.isTextblock||!(0,a.n9)(t.doc,i.to))return!1;n=i.to}else if(n=(0,a.N0)(t.doc,i.to,1),null==n)return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0})(t,e),joinForward:()=>({state:t,dispatch:e})=>g(t,e),joinItemBackward:()=>({state:t,dispatch:e,tr:n})=>{try{const o=(0,a.N0)(t.doc,t.selection.$from.pos,-1);return null!=o&&(n.join(o,2),e&&e(n),!0)}catch(t){return!1}},joinItemForward:()=>({state:t,dispatch:e,tr:n})=>{try{const o=(0,a.N0)(t.doc,t.selection.$from.pos,1);return null!=o&&(n.join(o,2),e&&e(n),!0)}catch(t){return!1}},joinTextblockBackward:()=>({state:t,dispatch:e})=>((t,e)=>{let n=c(t,void 0);if(!n)return!1;let o=f(n);return!!o&&u(t,o,e)})(t,e),joinTextblockForward:()=>({state:t,dispatch:e})=>((t,e)=>{let n=m(t,void 0);if(!n)return!1;let o=y(n);return!!o&&u(t,o,e)})(t,e),joinUp:()=>({state:t,dispatch:e})=>((t,e)=>{let n,i=t.selection,r=i instanceof o.nh;if(r){if(i.node.isTextblock||!(0,a.n9)(t.doc,i.from))return!1;n=i.from}else if(n=(0,a.N0)(t.doc,i.from,-1),null==n)return!1;if(e){let i=t.tr.join(n);r&&i.setSelection(o.nh.create(i.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0})(t,e),keyboardShortcut:t=>({editor:e,view:n,tr:o,dispatch:i})=>{const r=function(t){const e=t.split(/-(?!$)/);let n,o,i,r,s=e[e.length-1];"Space"===s&&(s=" ");for(let t=0;t!["Alt","Ctrl","Meta","Shift"].includes(t))),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:r.includes("Alt"),ctrlKey:r.includes("Ctrl"),metaKey:r.includes("Meta"),shiftKey:r.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction((()=>{n.someProp("handleKeyDown",(t=>t(n,a)))}));return null==l||l.steps.forEach((t=>{const e=t.map(o.mapping);e&&i&&o.maybeStep(e)})),!0},lift:(t,e={})=>({state:n,dispatch:o})=>!!Dt(n,H(t,n.schema),e)&&((t,e)=>{let{$from:n,$to:o}=t.selection,i=n.blockRange(o),r=i&&(0,a.jP)(i);return null!=r&&(e&&e(t.tr.lift(i,r).scrollIntoView()),!0)})(n,o),liftEmptyBlock:()=>({state:t,dispatch:e})=>x(t,e),liftListItem:t=>({state:e,dispatch:n})=>{return(o=H(t,e.schema),function(t,e){let{$from:n,$to:i}=t.selection,r=n.blockRange(i,(t=>t.childCount>0&&t.firstChild.type==o));return!!r&&(!e||(n.node(r.depth-1).type==o?function(t,e,n,o){let i=t.tr,r=o.end,l=o.$to.end(o.depth);rr;e--)t-=i.child(e).nodeSize,o.delete(t-1,t+1);let r=o.doc.resolve(n.start),l=r.nodeAfter;if(o.mapping.map(n.end)!=n.start+r.nodeAfter.nodeSize)return!1;let c=0==n.startIndex,d=n.endIndex==i.childCount,u=r.node(-1),h=r.index(-1);if(!u.canReplace(h+(c?0:1),h+1,l.content.append(d?s.FK.empty:s.FK.from(i))))return!1;let p=r.pos,f=p+l.nodeSize;return o.step(new a.Wg(p-(c?1:0),f+(d?1:0),p+1,f-1,new s.Ji((c?s.FK.empty:s.FK.from(i.copy(s.FK.empty))).append(d?s.FK.empty:s.FK.from(i.copy(s.FK.empty))),c?0:1,d?0:1),c?0:1)),e(o.scrollIntoView()),!0}(t,e,r)))})(e,n);var o},newlineInCode:()=>({state:t,dispatch:e})=>k(t,e),resetAttributes:(t,e)=>({tr:n,state:o,dispatch:i})=>{let r=null,s=null;const a=Rt("string"==typeof t?t:t.name,o.schema);return!!a&&("node"===a&&(r=H(t,o.schema)),"mark"===a&&(s=Ct(t,o.schema)),i&&n.selection.ranges.forEach((t=>{o.doc.nodesBetween(t.$from.pos,t.$to.pos,((t,o)=>{r&&r===t.type&&n.setNodeMarkup(o,void 0,$t(t.attrs,e)),s&&t.marks.length&&t.marks.forEach((i=>{s===i.type&&n.addMark(o,o+t.nodeSize,s.create($t(i.attrs,e)))}))}))})),!0)},scrollIntoView:()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),selectAll:()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),selectNodeBackward:()=>({state:t,dispatch:e})=>p(t,e),selectNodeForward:()=>({state:t,dispatch:e})=>b(t,e),selectParentNode:()=>({state:t,dispatch:e})=>((t,e)=>{let n,{$from:i,to:r}=t.selection,s=i.sharedDepth(r);return 0!=s&&(n=i.before(s),e&&e(t.tr.setSelection(o.nh.create(t.doc,n))),!0)})(t,e),selectTextblockEnd:()=>({state:t,dispatch:e})=>O(t,e),selectTextblockStart:()=>({state:t,dispatch:e})=>T(t,e),setContent:(t,e=!1,n={},o={})=>({editor:i,tr:r,dispatch:s,commands:a})=>{var l,c;const{doc:d}=r;if("full"!==n.preserveWhitespace){const a=Lt(t,i.schema,n,{errorOnInvalidContent:null!==(l=o.errorOnInvalidContent)&&void 0!==l?l:i.options.enableContentCheck});return s&&r.replaceWith(0,d.content.size,a).setMeta("preventUpdate",!e),!0}return s&&r.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:d.content.size},t,{parseOptions:n,errorOnInvalidContent:null!==(c=o.errorOnInvalidContent)&&void 0!==c?c:i.options.enableContentCheck})},setMark:(t,e={})=>({tr:n,state:o,dispatch:i})=>{const{selection:r}=n,{empty:s,ranges:a}=r,l=Ct(t,o.schema);if(i)if(s){const t=zt(o,l);n.addStoredMark(l.create({...t,...e}))}else a.forEach((t=>{const i=t.$from.pos,r=t.$to.pos;o.doc.nodesBetween(i,r,((t,o)=>{const s=Math.max(o,i),a=Math.min(o+t.nodeSize,r);t.marks.find((t=>t.type===l))?t.marks.forEach((t=>{l===t.type&&n.addMark(s,a,l.create({...t.attrs,...e}))})):n.addMark(s,a,l.create(e))}))}));return function(t,e,n){var o;const{selection:i}=e;let r=null;if(xt(i)&&(r=i.$cursor),r){const e=null!==(o=t.storedMarks)&&void 0!==o?o:r.marks();return!!n.isInSet(e)||!e.some((t=>t.type.excludes(n)))}const{ranges:s}=i;return s.some((({$from:e,$to:o})=>{let i=0===e.depth&&t.doc.inlineContent&&t.doc.type.allowsMarkType(n);return t.doc.nodesBetween(e.pos,o.pos,((t,e,o)=>{if(i)return!1;if(t.isInline){const e=!o||o.type.allowsMarkType(n),r=!!n.isInSet(t.marks)||!t.marks.some((t=>t.type.excludes(n)));i=e&&r}return!i})),i}))}(o,n,l)},setMeta:(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),setNode:(t,e={})=>({state:n,dispatch:o,chain:i})=>{const r=H(t,n.schema);return r.isTextblock?i().command((({commands:t})=>!!E(r,e)(n)||t.clearNodes())).command((({state:t})=>E(r,e)(t,o))).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,i=St(t,0,n.content.size),r=o.nh.create(n,i);e.setSelection(r)}return!0},setTextSelection:t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,{from:i,to:r}="number"==typeof t?{from:t,to:t}:t,s=o.U3.atStart(n).from,a=o.U3.atEnd(n).to,l=St(i,s,a),c=St(r,s,a),d=o.U3.create(n,l,c);e.setSelection(d)}return!0},sinkListItem:t=>({state:e,dispatch:n})=>{const o=H(t,e.schema);return(i=o,function(t,e){let{$from:n,$to:o}=t.selection,r=n.blockRange(o,(t=>t.childCount>0&&t.firstChild.type==i));if(!r)return!1;let l=r.startIndex;if(0==l)return!1;let c=r.parent,d=c.child(l-1);if(d.type!=i)return!1;if(e){let n=d.lastChild&&d.lastChild.type==c.type,o=s.FK.from(n?i.create():null),l=new s.Ji(s.FK.from(i.create(null,s.FK.from(c.type.create(null,o)))),n?3:1,0),u=r.start,h=r.end;e(t.tr.step(new a.Wg(u-(n?3:1),h,u,h,l,1,!0)).scrollIntoView())}return!0})(e,n);var i},splitBlock:({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:i,editor:r})=>{const{selection:s,doc:l}=e,{$from:c,$to:d}=s,u=ne(r.extensionManager.attributes,c.node().type.name,c.node().attrs);if(s instanceof o.nh&&s.node.isBlock)return!(!c.parentOffset||!(0,a.zy)(l,c.pos)||(i&&(t&&ue(n,r.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),0));if(!c.parent.isBlock)return!1;const h=d.parentOffset===d.parent.content.size,p=0===c.depth?void 0:Bt(c.node(-1).contentMatchAt(c.indexAfter(-1)));let f=h&&p?[{type:p,attrs:u}]:void 0,m=(0,a.zy)(e.doc,e.mapping.map(c.pos),1,f);if(f||m||!(0,a.zy)(e.doc,e.mapping.map(c.pos),1,p?[{type:p}]:void 0)||(m=!0,f=p?[{type:p,attrs:u}]:void 0),i){if(m&&(s instanceof o.U3&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,f),p&&!h&&!c.parentOffset&&c.parent.type!==p)){const t=e.mapping.map(c.before()),n=e.doc.resolve(t);c.node(-1).canReplaceWith(n.index(),n.index()+1,p)&&e.setNodeMarkup(e.mapping.map(c.before()),p)}t&&ue(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},splitListItem:(t,e={})=>({tr:n,state:i,dispatch:r,editor:l})=>{var c;const d=H(t,i.schema),{$from:u,$to:h}=i.selection,p=i.selection.node;if(p&&p.isBlock||u.depth<2||!u.sameParent(h))return!1;const f=u.node(-1);if(f.type!==d)return!1;const m=l.extensionManager.attributes;if(0===u.parent.content.size&&u.node(-1).childCount===u.indexAfter(-1)){if(2===u.depth||u.node(-3).type!==d||u.index(-2)!==u.node(-2).childCount-1)return!1;if(r){let t=s.FK.empty;const i=u.index(-1)?1:u.index(-2)?2:3;for(let e=u.depth-i;e>=u.depth-3;e-=1)t=s.FK.from(u.node(e).copy(t));const r=u.indexAfter(-1){if(p>-1)return!1;t.isTextblock&&0===t.content.size&&(p=e+1)})),p>-1&&n.setSelection(o.U3.near(n.doc.resolve(p))),n.scrollIntoView()}return!0}const g=h.pos===u.end()?f.contentMatchAt(0).defaultType:null,b={...ne(m,f.type.name,f.attrs),...e},y={...ne(m,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const k=g?[{type:d,attrs:b},{type:g,attrs:y}]:[{type:d,attrs:b}];if(!(0,a.zy)(n.doc,u.pos,2))return!1;if(r){const{selection:t,storedMarks:e}=i,{splittableMarks:o}=l.extensionManager,s=e||t.$to.parentOffset&&t.$from.marks();if(n.split(u.pos,2,k).scrollIntoView(),!s||!r)return!0;const a=s.filter((t=>o.includes(t.type.name)));n.ensureMarks(a)}return!0},toggleList:(t,e,n,o={})=>({editor:i,tr:r,state:s,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=i.extensionManager,p=H(t,s.schema),f=H(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:y}=m,k=b.blockRange(y),v=g||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const w=Ft((t=>ae(t.type.name,u)))(m);if(k.depth>=1&&w&&k.depth-w.depth<=1){if(w.node.type===p)return c.liftListItem(f);if(ae(w.node.type.name,u)&&p.validContent(w.node.content)&&a)return l().command((()=>(r.setNodeMarkup(w.pos,p),!0))).command((()=>he(r,p))).command((()=>pe(r,p))).run()}return n&&v&&a?l().command((()=>{const t=d().wrapInList(p,o),e=v.filter((t=>h.includes(t.type.name)));return r.ensureMarks(e),!!t||c.clearNodes()})).wrapInList(p,o).command((()=>he(r,p))).command((()=>pe(r,p))).run():l().command((()=>!!d().wrapInList(p,o)||c.clearNodes())).wrapInList(p,o).command((()=>he(r,p))).command((()=>pe(r,p))).run()},toggleMark:(t,e={},n={})=>({state:o,commands:i})=>{const{extendEmptyMarkRange:r=!1}=n,s=Ct(t,o.schema);return oe(o,s,e)?i.unsetMark(s,{extendEmptyMarkRange:r}):i.setMark(s,e)},toggleNode:(t,e,n={})=>({state:o,commands:i})=>{const r=H(t,o.schema),s=H(e,o.schema),a=Dt(o,r,n);let l;return o.selection.$anchor.sameParent(o.selection.$head)&&(l=o.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(r,{...l,...n})},toggleWrap:(t,e={})=>({state:n,commands:o})=>{const i=H(t,n.schema);return Dt(n,i,e)?o.lift(i):o.wrapIn(i,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o=0;t-=1)e.step(n.steps[t].invert(n.docs[t]));if(r.text){const n=e.doc.resolve(r.from).marks();e.replaceWith(r.from,r.to,t.schema.text(r.text,n))}else e.delete(r.from,r.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:i}=n;return o||e&&i.forEach((e=>{t.removeMark(e.$from.pos,e.$to.pos)})),!0},unsetMark:(t,e={})=>({tr:n,state:o,dispatch:i})=>{var r;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Ct(t,o.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&s){let{from:t,to:e}=a;const o=null===(r=c.marks().find((t=>t.type===l)))||void 0===r?void 0:r.attrs,i=wt(c,l,o);i&&(t=i.from,e=i.to),n.removeMark(t,e,l)}else u.forEach((t=>{n.removeMark(t.$from.pos,t.$to.pos,l)}));return n.removeStoredMark(l),!0},updateAttributes:(t,e={})=>({tr:n,state:o,dispatch:i})=>{let r=null,s=null;const a=Rt("string"==typeof t?t:t.name,o.schema);return!!a&&("node"===a&&(r=H(t,o.schema)),"mark"===a&&(s=Ct(t,o.schema)),i&&n.selection.ranges.forEach((t=>{const i=t.$from.pos,a=t.$to.pos;o.doc.nodesBetween(i,a,((t,o)=>{r&&r===t.type&&n.setNodeMarkup(o,void 0,{...t.attrs,...e}),s&&t.marks.length&&t.marks.forEach((r=>{if(s===r.type){const l=Math.max(o,i),c=Math.min(o+t.nodeSize,a);n.addMark(l,c,s.create({...r.attrs,...e}))}}))}))})),!0)},wrapIn:(t,e={})=>({state:n,dispatch:o})=>function(t,e=null){return function(n,o){let{$from:i,$to:r}=n.selection,s=i.blockRange(r),l=s&&(0,a.oM)(s,t,e);return!!l&&(o&&o(n.tr.wrap(s,l).scrollIntoView()),!0)}}(H(t,n.schema),e)(n,o),wrapInList:(t,e={})=>({state:n,dispatch:o})=>function(t,e=null){return function(n,o){let{$from:i,$to:r}=n.selection,l=i.blockRange(r),c=!1,d=l;if(!l)return!1;if(l.depth>=2&&i.node(l.depth-1).type.compatibleContent(t)&&0==l.startIndex){if(0==i.index(l.depth-1))return!1;let t=n.doc.resolve(l.start-2);d=new s.u$(t,t,l.depth),l.endIndex=0;t--)r=s.FK.from(n[t].type.create(n[t].attrs,r));t.step(new a.Wg(e.start-(o?2:0),e.end,e.start,e.end,new s.Ji(r,0,0),n.length,!0));let l=0;for(let t=0;t({...fe})}),ge=ft.create({name:"drop",addProseMirrorPlugins(){return[new o.k_({key:new o.hs("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),be=ft.create({name:"editable",addProseMirrorPlugins(){return[new o.k_({key:new o.hs("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ye=ft.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new o.k_({key:new o.hs("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const o=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,n)=>{t.isFocused=!1;const o=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),ke=ft.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first((({commands:t})=>[()=>t.undoInputRule(),()=>t.command((({tr:e})=>{const{selection:n,doc:i}=e,{empty:r,$anchor:s}=n,{pos:a,parent:l}=s,c=s.parent.isTextblock&&a>0?e.doc.resolve(a-1):s,d=c.parent.type.spec.isolating,u=s.pos-s.parentOffset,h=d&&1===c.parent.childCount?u===s.pos:o.LN.atStart(i).from===a;return!(!r||!l.type.isTextblock||l.textContent.length||!h||h&&"paragraph"===s.parent.type.name)&&t.clearNodes()})),()=>t.deleteSelection(),()=>t.joinBackward(),()=>t.selectNodeBackward()])),e=()=>this.editor.commands.first((({commands:t})=>[()=>t.deleteSelection(),()=>t.deleteCurrentNode(),()=>t.joinForward(),()=>t.selectNodeForward()])),n={Enter:()=>this.editor.commands.first((({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()])),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},r={...n,"Ctrl-h":t,"Alt-Backspace":t,"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 Tt()||Nt()?r:i},addProseMirrorPlugins(){return[new o.k_({key:new o.hs("clearDocument"),appendTransaction:(t,e,n)=>{const i=t.some((t=>t.docChanged))&&!e.doc.eq(n.doc),r=t.some((t=>t.getMeta("preventClearDocument")));if(!i||r)return;const{empty:s,from:a,to:l}=e.selection,c=o.LN.atStart(e.doc).from,d=o.LN.atEnd(e.doc).to;if(s||a!==c||l!==d)return;if(!le(n.doc))return;const u=n.tr,h=$({state:n,transaction:u}),{commands:p}=new L({editor:this.editor,state:h});return p.clearNodes(),u.steps.length?u:void 0}})]}}),ve=ft.create({name:"paste",addProseMirrorPlugins(){return[new o.k_({key:new o.hs("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),we=ft.create({name:"tabindex",addProseMirrorPlugins(){return[new o.k_({key:new o.hs("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var Ce=Object.freeze({__proto__:null,ClipboardTextSerializer:bt,Commands:me,Drop:ge,Editable:be,FocusEvents:ye,Keymap:ke,Paste:ve,Tabindex:we});class xe{get name(){return this.node.type.name}constructor(t,e,n=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=t,this.editor=e,this.currentNode=o}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return null!==(t=this.actualDepth)&&void 0!==t?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let e=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);e=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:e,to:n},t)}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(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),e=this.resolvedPos.doc.resolve(t);return new xe(e,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new xe(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new xe(t,this.editor)}get children(){const t=[];return this.node.content.forEach(((e,n)=>{const o=e.isBlock&&!e.isTextblock,i=this.pos+n+1,r=this.resolvedPos.doc.resolve(i);if(!o&&r.depth<=this.depth)return;const s=new xe(r,this.editor,o,o?e:null);o&&(s.actualDepth=this.depth+1),t.push(new xe(r,this.editor,o,o?e:null))})),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,e={}){let n=null,o=this.parent;for(;o&&!n;){if(o.node.type.name===t)if(Object.keys(e).length>0){const t=o.node.attrs,n=Object.keys(e);for(let o=0;o{n&&o.length>0||(r.node.type.name===t&&i.every((t=>e[t]===r.node.attrs[t]))&&o.push(r),n&&o.length>0||(o=o.concat(r.querySelectorAll(t,e,n))))})),o}setAttribute(t){const e=this.editor.state.selection;this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name,t).setTextSelection(e.from).run()}}function Se(t,e,n){const o=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(null!==o)return o;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style"+(n?`-${n}`:""),""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}class Me extends z{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),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:t,slice:e,moved:n})=>this.options.onDrop(t,e,n))),this.on("paste",(({event:t,slice:e})=>this.options.onPaste(t,e))),window.setTimeout((()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)}),0)}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&&document&&(this.css=Se('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}',this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){const n=G(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],o=this.state.reconfigure({plugins:n});return this.view.updateState(o),o}unregisterPlugin(t){if(this.isDestroyed)return;const e="string"==typeof t?`${t}$`:t.key,n=this.state.reconfigure({plugins:this.state.plugins.filter((t=>!t.key.startsWith(e)))});return this.view.updateState(n),n}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[be,bt.configure({blockSeparator:null===(e=null===(t=this.options.coreExtensionOptions)||void 0===t?void 0:t.clipboardTextSerializer)||void 0===e?void 0:e.blockSeparator}),me,ye,ke,we,ge,ve].filter((t=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[t.name])):[],...this.options.extensions].filter((t=>["extension","node","mark"].includes(null==t?void 0:t.type)));this.extensionManager=new pt(n,this)}createCommandManager(){this.commandManager=new L({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let t;try{t=Lt(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message)))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{this.options.extensions=this.options.extensions.filter((t=>"collaboration"!==t.name)),this.createExtensionManager()}}),t=Lt(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const e=Mt(t,this.options.autofocus);this.view=new i.Lz(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:o.$t.create({doc:t,selection:e||void 0})});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void t.steps.forEach((t=>{var e;return null===(e=this.capturedTransaction)||void 0===e?void 0:e.step(t)})):void(this.capturedTransaction=t);const e=this.state.apply(t),n=!this.state.selection.eq(e.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=t.getMeta("focus"),i=t.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:t}),i&&this.emit("blur",{editor:this,event:i.event,transaction:t}),t.docChanged&&!t.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return Yt(this.state,t)}isActive(t,e){const n="string"==typeof t?t:null,o="string"==typeof t?e:t;return ie(this.state,n,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Gt(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e="\n\n",textSerializers:n={}}=t||{};return Ut(this.state.doc,{blockSeparator:e,textSerializers:{...gt(this.schema),...n}})}get isEmpty(){return le(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(null===(t=this.view)||void 0===t?void 0:t.docView)}$node(t,e){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new xe(e,this)}get $doc(){return this.$pos(0)}}function Te(t){return new tt({find:t.find,handler:({state:e,range:n,match:o})=>{const i=V(t.getAttributes,void 0,o);if(!1===i||null===i)return null;const{tr:r}=e,s=o[o.length-1],a=o[0];if(s){const o=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(te(n.from,n.to,e.doc).filter((e=>e.mark.type.excluded.find((n=>n===t.type&&n!==e.mark.type)))).filter((t=>t.to>l)).length)return null;cn.from&&r.delete(n.from+o,l);const d=n.from+o+s.length;r.addMark(n.from+o,d,t.type.create(i||{})),r.removeStoredMark(t.type)}}})}function Oe(t){return new tt({find:t.find,handler:({state:e,range:n,match:o})=>{const i=V(t.getAttributes,void 0,o)||{},{tr:r}=e,s=n.from;let a=n.to;const l=t.type.create(i);if(o[1]){let t=s+o[0].lastIndexOf(o[1]);t>a?t=a:a=t+o[1].length;const e=o[0][o[0].length-1];r.insertText(e,s+o[0].length-1),r.replaceWith(t,a,l)}else if(o[0]){const e=t.type.isInline?s:s-1;r.insert(e,t.type.create(i)).delete(r.mapping.map(s),r.mapping.map(a))}r.scrollIntoView()}})}function Ee(t){return new tt({find:t.find,handler:({state:e,range:n,match:o})=>{const i=e.doc.resolve(n.from),r=V(t.getAttributes,void 0,o)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,r)}})}function Ae(t){return new tt({find:t.find,handler:({state:e,range:n,match:o})=>{let i=t.replace,r=n.from;const s=n.to;if(o[1]){const t=o[0].lastIndexOf(o[1]);i+=o[0].slice(t+o[1].length),r+=t;const e=r-s;e>0&&(i=o[0].slice(t-e,t)+i,r=s)}e.tr.insertText(i,r,s)}})}function Ie(t){return new tt({find:t.find,handler:({state:e,range:n,match:o,chain:i})=>{const r=V(t.getAttributes,void 0,o)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),c=l&&(0,a.oM)(l,t.type,r);if(!c)return null;if(s.wrap(l,c),t.keepMarks&&t.editor){const{selection:n,storedMarks:o}=e,{splittableMarks:i}=t.editor.extensionManager,r=o||n.$to.parentOffset&&n.$from.marks();if(r){const t=r.filter((t=>i.includes(t.type.name)));s.ensureMarks(t)}}if(t.keepAttributes){const e="bulletList"===t.type.name||"orderedList"===t.type.name?"listItem":"taskList";i().updateAttributes(e,r).run()}const d=s.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&(0,a.n9)(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,d))&&s.join(n.from-1)}})}class Ne{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=V(P(this,"addOptions",{name:this.name}))),this.storage=V(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Ne(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>rt(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new Ne(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=V(P(e,"addOptions",{name:e.name})),e.storage=V(P(e,"addStorage",{name:e.name,options:e.options})),e}}class De{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},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(t){var e,n,i,r,s,a,l;const{view:c}=this.editor,d=t.target,u=3===d.nodeType?null===(e=d.parentElement)||void 0===e?void 0:e.closest("[data-drag-handle]"):d.closest("[data-drag-handle]");if(!this.dom||(null===(n=this.contentDOM)||void 0===n?void 0:n.contains(d))||!u)return;let h=0,p=0;if(this.dom!==u){const e=this.dom.getBoundingClientRect(),n=u.getBoundingClientRect(),o=null!==(i=t.offsetX)&&void 0!==i?i:null===(r=t.nativeEvent)||void 0===r?void 0:r.offsetX,l=null!==(s=t.offsetY)&&void 0!==s?s:null===(a=t.nativeEvent)||void 0===a?void 0:a.offsetY;h=n.x-e.x+o,p=n.y-e.y+l}null===(l=t.dataTransfer)||void 0===l||l.setDragImage(this.dom,h,p);const f=this.getPos();if("number"!=typeof f)return;const m=o.nh.create(c.state.doc,f),g=c.state.tr.setSelection(m);c.dispatch(g)}stopEvent(t){var e;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:t});const n=t.target;if(!this.dom.contains(n)||(null===(e=this.contentDOM)||void 0===e?void 0:e.contains(n)))return!1;const i=t.type.startsWith("drag"),r="drop"===t.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!r&&!i)return!0;const{isEditable:s}=this.editor,{isDragging:a}=this,l=!!this.node.type.spec.draggable,c=o.nh.isSelectable(this.node),d="copy"===t.type,u="paste"===t.type,h="cut"===t.type,p="mousedown"===t.type;if(!l&&c&&i&&t.preventDefault(),l&&i&&!a)return t.preventDefault(),!1;if(l&&s&&!a&&p){const t=n.closest("[data-drag-handle]");t&&(this.dom===t||this.dom.contains(t))&&(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||r||d||u||h||p&&c)}ignoreMutation(t){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:t}):!(!this.node.isLeaf&&!this.node.isAtom&&("selection"===t.type||this.dom.contains(t.target)&&"childList"===t.type&&(Tt()||"Android"===navigator.platform||/android/i.test(navigator.userAgent))&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every((t=>t.isContentEditable))||(this.contentDOM!==t.target||"attributes"!==t.type)&&this.contentDOM.contains(t.target))))}updateAttributes(t){this.editor.commands.command((({tr:e})=>{const n=this.getPos();return"number"==typeof n&&(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)}))}deleteNode(){const t=this.getPos();if("number"!=typeof t)return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}}function Re(t){return new lt({find:t.find,handler:({state:e,range:n,match:o,pasteEvent:i})=>{const r=V(t.getAttributes,void 0,o,i);if(!1===r||null===r)return null;const{tr:s}=e,a=o[o.length-1],l=o[0];let c=n.to;if(a){const o=l.search(/\S/),i=n.from+l.indexOf(a),d=i+a.length;if(te(n.from,n.to,e.doc).filter((e=>e.mark.type.excluded.find((n=>n===t.type&&n!==e.mark.type)))).filter((t=>t.to>i)).length)return null;dn.from&&s.delete(n.from+o,i),c=n.from+o+a.length,s.addMark(n.from+o,c,t.type.create(r||{})),s.removeStoredMark(t.type)}}})}function $e(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function Le(t){return"string"==typeof t}function ze(t){return new lt({find:t.find,handler({match:e,chain:n,range:o,pasteEvent:i}){const r=V(t.getAttributes,void 0,e,i),s=V(t.getContent,void 0,r);if(!1===r||null===r)return null;const a={type:t.type.name,attrs:r};s&&(a.content=s),e.input&&n().deleteRange(o).insertContentAt(o.from,a)}})}function Pe(t){return new lt({find:t.find,handler:({state:e,range:n,match:o})=>{let i=t.replace,r=n.from;const s=n.to;if(o[1]){const t=o[0].lastIndexOf(o[1]);i+=o[0].slice(t+o[1].length),r+=t;const e=r-s;e>0&&(i=o[0].slice(t-e,t)+i,r=s)}e.tr.insertText(i,r,s)}})}class Be{constructor(t){this.transaction=t,this.currentStep=this.transaction.steps.length}map(t){let e=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce(((t,n)=>{const o=n.getMap().mapResult(t);return o.deleted&&(e=!0),o.pos}),t),deleted:e}}}},7477:(t,e,n)=>{n.d(e,{Cv:()=>r});var o=n(6426);const i=/^\s*>\s$/,r=o.Node.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:t}){return["blockquote",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[(0,o.wrappingInputRule)({find:i,type:this.type})]}})},7417:(t,e,n)=>{n.d(e,{yN:()=>l});var o=n(6426);const i=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,r=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,s=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,a=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,l=o.Mark.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!==t.style.fontWeight&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],renderHTML({HTMLAttributes:t}){return["strong",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[(0,o.markInputRule)({find:i,type:this.type}),(0,o.markInputRule)({find:s,type:this.type})]},addPasteRules(){return[(0,o.markPasteRule)({find:r,type:this.type}),(0,o.markPasteRule)({find:a,type:this.type})]}})},7371:(t,e,n)=>{n.d(e,{Rg:()=>a});var o=n(6426),i=n(6542),r=n(5377);const s=/^\s*([-+*])\s$/,a=o.Node.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:t}){return["ul",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(i.c.name,this.editor.getAttributes(r.TextStyle.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=(0,o.wrappingInputRule)({find:s,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=(0,o.wrappingInputRule)({find:s,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(r.TextStyle.name),editor:this.editor})),[t]}})},6927:(t,e,n)=>{n.d(e,{NG:()=>a});var o=n(6426),i=n(3829);const r=/^```([a-z]+)?[\s\n]$/,s=/^~~~([a-z]+)?[\s\n]$/,a=o.Node.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;return[...(null===(e=t.firstElementChild)||void 0===e?void 0:e.classList)||[]].filter((t=>t.startsWith(n))).map((t=>t.replace(n,"")))[0]||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:t,HTMLAttributes:e}){return["pre",(0,o.mergeAttributes)(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=1===e.pos;return!(!t||e.parent.type.name!==this.name)&&!(!n&&e.parent.textContent.length)&&this.editor.commands.clearNodes()},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type)return!1;const r=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith("\n\n");return!(!r||!s)&&t.chain().command((({tr:t})=>(t.delete(o.pos-2,o.pos),!0))).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:o}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;if(r.parentOffset!==r.parent.nodeSize-2)return!1;const a=r.after();return void 0!==a&&(o.nodeAt(a)?t.commands.command((({tr:t})=>(t.setSelection(i.LN.near(o.resolve(a))),!0))):t.commands.exitCode())}}},addInputRules(){return[(0,o.textblockTypeInputRule)({find:r,type:this.type,getAttributes:t=>({language:t[1]})}),(0,o.textblockTypeInputRule)({find:s,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new i.k_({key:new i.hs("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),o=e.clipboardData.getData("vscode-editor-data"),r=o?JSON.parse(o):void 0,s=null==r?void 0:r.mode;if(!n||!s)return!1;const{tr:a,schema:l}=t.state,c=l.text(n.replace(/\r\n?/g,"\n"));return a.replaceSelectionWith(this.type.create({language:s},c)),a.selection.$from.parent.type!==this.type&&a.setSelection(i.U3.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),t.dispatch(a),!0}}})]}})},9319:(t,e,n)=>{n.d(e,{Cy:()=>s});var o=n(6426);const i=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,r=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,s=o.Mark.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:t}){return["code",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[(0,o.markInputRule)({find:i,type:this.type})]},addPasteRules(){return[(0,o.markPasteRule)({find:r,type:this.type})]}})},9515:(t,e,n)=>{n.d(e,{y:()=>o});const o=n(6426).Node.create({name:"doc",topNode:!0,content:"block+"})},1985:(t,e,n)=>{n.d(e,{Q:()=>l});var o=n(6426),i=n(3829),r=n(4238);function s(t={}){return new i.k_({view:e=>new a(e,t)})}class a{constructor(t,e){var n;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=e.width)&&void 0!==n?n:1,this.color=!1===e.color?void 0:e.color||"black",this.class=e.class,this.handlers=["dragover","dragend","drop","dragleave"].map((e=>{let n=t=>{this[e](t)};return t.dom.addEventListener(e,n),{name:e,handler:n}}))}destroy(){this.handlers.forEach((({name:t,handler:e})=>this.editorView.dom.removeEventListener(t,e)))}update(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t,e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent;if(n){let n=e.nodeBefore,o=e.nodeAfter;if(n||o){let e=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(e){let i=e.getBoundingClientRect(),r=n?i.bottom:i.top;n&&o&&(r=(r+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:i.left,right:i.right,top:r-this.width/2,bottom:r+this.width/2}}}}if(!t){let e=this.editorView.coordsAtPos(this.cursorPos);t={left:e.left-this.width/2,right:e.left+this.width/2,top:e.top,bottom:e.bottom}}let o,i,r=this.editorView.dom.offsetParent;if(this.element||(this.element=r.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!r||r==document.body&&"static"==getComputedStyle(r).position)o=-pageXOffset,i=-pageYOffset;else{let t=r.getBoundingClientRect();o=t.left-r.scrollLeft,i=t.top-r.scrollTop}this.element.style.left=t.left-o+"px",this.element.style.top=t.top-i+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),t)}dragover(t){if(!this.editorView.editable)return;let e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),n=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside),o=n&&n.type.spec.disableDropCursor,i="function"==typeof o?o(this.editorView,e,t):o;if(e&&!i){let t=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=(0,r.Um)(this.editorView.state.doc,t,this.editorView.dragging.slice);null!=e&&(t=e)}this.setCursor(t),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}const l=o.Extension.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[s(this.options)]}})},9221:(t,e,n)=>{n.d(e,{v:()=>m});var o=n(6426),i=n(4103),r=n(3829),s=n(9939),a=n(7887);class l extends r.LN{constructor(t){super(t,t)}map(t,e){let n=t.resolve(e.map(this.head));return l.valid(n)?new l(n):r.LN.near(n)}content(){return s.Ji.empty}eq(t){return t instanceof l&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new l(t.resolve(e.pos))}getBookmark(){return new c(this.anchor)}static valid(t){let e=t.parent;if(e.isTextblock||!function(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),o=t.node(e);if(0!=n)for(let t=o.child(n-1);;t=t.lastChild){if(0==t.childCount&&!t.inlineContent||t.isAtom||t.type.spec.isolating)return!0;if(t.inlineContent)return!1}else if(o.type.spec.isolating)return!0}return!0}(t)||!function(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),o=t.node(e);if(n!=o.childCount)for(let t=o.child(n);;t=t.firstChild){if(0==t.childCount&&!t.inlineContent||t.isAtom||t.type.spec.isolating)return!0;if(t.inlineContent)return!1}else if(o.type.spec.isolating)return!0}return!0}(t))return!1;let n=e.type.spec.allowGapCursor;if(null!=n)return n;let o=e.contentMatchAt(t.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(t,e,n=!1){t:for(;;){if(!n&&l.valid(t))return t;let o=t.pos,i=null;for(let n=t.depth;;n--){let r=t.node(n);if(e>0?t.indexAfter(n)0){i=r.child(e>0?t.indexAfter(n):t.index(n)-1);break}if(0==n)return null;o+=e;let s=t.doc.resolve(o);if(l.valid(s))return s}for(;;){let s=e>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!r.nh.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*e),n=!1;continue t}break}i=s,o+=e;let a=t.doc.resolve(o);if(l.valid(a))return a}return null}}}l.prototype.visible=!1,l.findFrom=l.findGapCursorFrom,r.LN.jsonID("gapcursor",l);class c{constructor(t){this.pos=t}map(t){return new c(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return l.valid(e)?new l(e):r.LN.near(e)}}const d=(0,i.K)({ArrowLeft:u("horiz",-1),ArrowRight:u("horiz",1),ArrowUp:u("vert",-1),ArrowDown:u("vert",1)});function u(t,e){const n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,o,i){let s=t.selection,a=e>0?s.$to:s.$from,c=s.empty;if(s instanceof r.U3){if(!i.endOfTextblock(n)||0==a.depth)return!1;c=!1,a=t.doc.resolve(e>0?a.after():a.before())}let d=l.findGapCursorFrom(a,e,c);return!!d&&(o&&o(t.tr.setSelection(new l(d))),!0)}}function h(t,e,n){if(!t||!t.editable)return!1;let o=t.state.doc.resolve(e);if(!l.valid(o))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&r.nh.isSelectable(t.state.doc.nodeAt(i.inside))||(t.dispatch(t.state.tr.setSelection(new l(o))),0))}function p(t,e){if("insertCompositionText"!=e.inputType||!(t.state.selection instanceof l))return!1;let{$from:n}=t.state.selection,o=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!o)return!1;let i=s.FK.empty;for(let t=o.length-1;t>=0;t--)i=s.FK.from(o[t].createAndFill(null,i));let a=t.state.tr.replace(n.pos,n.pos,new s.Ji(i,0,0));return a.setSelection(r.U3.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function f(t){if(!(t.selection instanceof l))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",a.zF.create(t.doc,[a.NZ.widget(t.selection.head,e,{key:"gapcursor"})])}const m=o.Extension.create({name:"gapCursor",addProseMirrorPlugins:()=>[new r.k_({props:{decorations:f,createSelectionBetween:(t,e,n)=>e.pos==n.pos&&l.valid(n)?new l(n):null,handleClick:h,handleKeyDown:d,handleDOMEvents:{beforeinput:p}}})],extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:null!==(e=(0,o.callOrReturn)((0,o.getExtensionField)(t,"allowGapCursor",n)))&&void 0!==e?e:null}}})},7481:(t,e,n)=>{n.d(e,{B:()=>i});var o=n(6426);const i=o.Node.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:t}){return["br",(0,o.mergeAttributes)(this.options.HTMLAttributes,t)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:o})=>t.first([()=>t.exitCode(),()=>t.command((()=>{const{selection:t,storedMarks:i}=n;if(t.$from.parent.type.spec.isolating)return!1;const{keepMarks:r}=this.options,{splittableMarks:s}=o.extensionManager,a=i||t.$to.parentOffset&&t.$from.marks();return e().insertContent({type:this.name}).command((({tr:t,dispatch:e})=>{if(e&&a&&r){const e=a.filter((t=>s.includes(t.type.name)));t.ensureMarks(e)}return!0})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}})},1988:(t,e,n)=>{n.r(e),n.d(e,{Heading:()=>i,default:()=>i});var o=n(6426);const i=o.Node.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((t=>({tag:`h${t}`,attrs:{level:t}})))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,(0,o.mergeAttributes)(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.setNode(this.name,t),toggleHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return this.options.levels.reduce(((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})})),{})},addInputRules(){return this.options.levels.map((t=>(0,o.textblockTypeInputRule)({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}})))}})},9322:(t,e,n)=>{n.d(e,{B:()=>T});var o=n(6426),i=200,r=function(){};r.prototype.append=function(t){return t.length?(t=r.from(t),!this.length&&t||t.length=e?r.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},r.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},r.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},r.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var o=[];return this.forEach((function(e,n){return o.push(t(e,n))}),e,n),o},r.from=function(t){return t instanceof r?t:t&&t.length?new s(t):r.empty};var s=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,o){for(var i=e;i=n;i--)if(!1===t(this.values[i],o+i))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=i)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=i)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(r);r.empty=new s([]);var a=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return ti&&!1===this.right.forEachInner(t,Math.max(e-i,0),Math.min(this.length,n)-i,o+i))&&void 0},e.prototype.forEachInvertedInner=function(t,e,n,o){var i=this.left.length;return!(e>i&&!1===this.right.forEachInvertedInner(t,e-i,Math.max(n,i)-i,o+i))&&!(n=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(r);const l=r;var c=n(4238),d=n(3829);class u{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(0==this.eventCount)return null;let n,o,i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}e&&(n=this.remapping(i,this.items.length),o=n.maps.length);let r,s,a=t.tr,l=[],c=[];return this.items.forEach(((t,e)=>{if(!t.step)return n||(n=this.remapping(i,e+1),o=n.maps.length),o--,void c.push(t);if(n){c.push(new h(t.map));let e,i=t.step.map(n.slice(o));i&&a.maybeStep(i).doc&&(e=a.mapping.maps[a.mapping.maps.length-1],l.push(new h(e,void 0,void 0,l.length+c.length))),o--,e&&n.appendMap(e,o)}else a.maybeStep(t.step);return t.selection?(r=n?t.selection.map(n.slice(o)):t.selection,s=new u(this.items.slice(0,i).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:a,selection:r}}addTransform(t,e,n,o){let i=[],r=this.eventCount,s=this.items,a=!o&&s.length?s.get(s.length-1):null;for(let n=0;nf&&(s=function(t,e){let n;return t.forEach(((t,o)=>{if(t.selection&&0==e--)return n=o,!1})),t.slice(n)}(s,l),r-=l),new u(s.append(i),r)}remapping(t,e){let n=new c.X9;return this.items.forEach(((e,o)=>{let i=null!=e.mirrorOffset&&o-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:void 0;n.appendMap(e.map,i)}),t,e),n}addMaps(t){return 0==this.eventCount?this:new u(this.items.append(t.map((t=>new h(t)))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let n=[],o=Math.max(0,this.items.length-e),i=t.mapping,r=t.steps.length,s=this.eventCount;this.items.forEach((t=>{t.selection&&s--}),o);let a=e;this.items.forEach((e=>{let o=i.getMirror(--a);if(null==o)return;r=Math.min(r,o);let l=i.maps[o];if(e.step){let r=t.steps[o].invert(t.docs[o]),c=e.selection&&e.selection.map(i.slice(a+1,o));c&&s++,n.push(new h(l,r,c))}else n.push(new h(l))}),o);let l=[];for(let t=e;t500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let t=0;return this.items.forEach((e=>{e.step||t++})),t}compress(t=this.items.length){let e=this.remapping(0,t),n=e.maps.length,o=[],i=0;return this.items.forEach(((r,s)=>{if(s>=t)o.push(r),r.selection&&i++;else if(r.step){let t=r.step.map(e.slice(n)),s=t&&t.getMap();if(n--,s&&e.appendMap(s,n),t){let a=r.selection&&r.selection.map(e.slice(n));a&&i++;let l,c=new h(s.invert(),t,a),d=o.length-1;(l=o.length&&o[d].merge(c))?o[d]=l:o.push(c)}}else r.map&&n--}),this.items.length,0),new u(l.from(o.reverse()),i)}}u.empty=new u(l.empty,0);class h{constructor(t,e,n,o){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=o}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new h(e.getMap().invert(),e,this.selection)}}}class p{constructor(t,e,n,o,i){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=o,this.prevComposition=i}}const f=20;function m(t){let e=[];for(let n=t.length-1;n>=0&&0==e.length;n--)t[n].forEach(((t,n,o,i)=>e.push(o,i)));return e}function g(t,e){if(!t)return null;let n=[];for(let o=0;onew p(u.empty,u.empty,null,0,-1),apply:(e,n,o)=>function(t,e,n,o){let i,r=n.getMeta(v);if(r)return r.historyState;n.getMeta(w)&&(t=new p(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(v))return s.getMeta(v).redo?new p(t.done.addTransform(n,void 0,o,k(e)),t.undone,m(n.mapping.maps),t.prevTime,t.prevComposition):new p(t.done,t.undone.addTransform(n,void 0,o,k(e)),null,t.prevTime,t.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new p(t.done.rebased(n,i),t.undone.rebased(n,i),g(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new p(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),g(t.prevRanges,n.mapping),t.prevTime,t.prevComposition);{let i=n.getMeta("composition"),r=0==t.prevTime||!s&&t.prevComposition!=i&&(t.prevTime<(n.time||0)-o.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach(((t,o)=>{for(let i=0;i=e[i]&&(n=!0)})),n}(n,t.prevRanges)),a=s?g(t.prevRanges,n.mapping):m(n.mapping.maps);return new p(t.done.addTransform(n,r?e.selection.getBookmark():void 0,o,k(e)),u.empty,a,n.time,null==i?t.prevComposition:i)}}(n,o,e,t)},config:t,props:{handleDOMEvents:{beforeinput(t,e){let n=e.inputType,o="historyUndo"==n?S:"historyRedo"==n?M:null;return!!o&&(e.preventDefault(),o(t.state,t.dispatch))}}}})}function x(t,e){return(n,o)=>{let i=v.getState(n);if(!i||0==(t?i.undone:i.done).eventCount)return!1;if(o){let r=function(t,e,n){let o=k(e),i=v.get(e).spec.config,r=(n?t.undone:t.done).popEvent(e,o);if(!r)return null;let s=r.selection.resolve(r.transform.doc),a=(n?t.done:t.undone).addTransform(r.transform,e.selection.getBookmark(),i,o),l=new p(n?a:r.remaining,n?r.remaining:a,null,0,-1);return r.transform.setSelection(s).setMeta(v,{redo:n,historyState:l})}(i,n,t);r&&o(e?r.scrollIntoView():r)}return!0}}const S=x(!1,!0),M=x(!0,!0);x(!1,!1),x(!0,!1);const T=o.Extension.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:t,dispatch:e})=>S(t,e),redo:()=>({state:t,dispatch:e})=>M(t,e)}),addProseMirrorPlugins(){return[C(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()}}})},3161:(t,e,n)=>{n.d(e,{d:()=>r});var o=n(6426),i=n(3829);const r=o.Node.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:t}){return["hr",(0,o.mergeAttributes)(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:r,$to:s}=n,a=t();return 0===r.parentOffset?a.insertContentAt({from:Math.max(r.pos-1,0),to:s.pos},{type:this.name}):(0,o.isNodeSelection)(n)?a.insertContentAt(s.pos,{type:this.name}):a.insertContent({type:this.name}),a.command((({tr:t,dispatch:e})=>{var n;if(e){const{$to:e}=t.selection,o=e.end();if(e.nodeAfter)e.nodeAfter.isTextblock?t.setSelection(i.U3.create(t.doc,e.pos+1)):e.nodeAfter.isBlock?t.setSelection(i.nh.create(t.doc,e.pos)):t.setSelection(i.U3.create(t.doc,e.pos));else{const r=null===(n=e.parent.type.contentMatch.defaultType)||void 0===n?void 0:n.create();r&&(t.insert(o,r),t.setSelection(i.U3.create(t.doc,o+1)))}t.scrollIntoView()}return!0})).run()}}},addInputRules(){return[(0,o.nodeInputRule)({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}})},2100:(t,e,n)=>{n.d(e,{J2:()=>l});var o=n(6426);const i=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,r=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,s=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,a=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,l=o.Mark.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"em"},{tag:"i",getAttrs:t=>"normal"!==t.style.fontStyle&&null},{style:"font-style=italic"}],renderHTML({HTMLAttributes:t}){return["em",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[(0,o.markInputRule)({find:i,type:this.type}),(0,o.markInputRule)({find:s,type:this.type})]},addPasteRules(){return[(0,o.markPasteRule)({find:r,type:this.type}),(0,o.markPasteRule)({find:a,type:this.type})]}})},6542:(t,e,n)=>{n.d(e,{c:()=>i});var o=n(6426);const i=o.Node.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:t}){return["li",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}})},3808:(t,e,n)=>{n.d(e,{_J:()=>a});var o=n(6426),i=n(6542),r=n(5377);const s=/^(\d+)\.\s$/,a=o.Node.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return 1===e?["ol",(0,o.mergeAttributes)(this.options.HTMLAttributes,n),0]:["ol",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(i.c.name,this.editor.getAttributes(r.TextStyle.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=(0,o.wrappingInputRule)({find:s,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=(0,o.wrappingInputRule)({find:s,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(r.TextStyle.name)}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1],editor:this.editor})),[t]}})},7308:(t,e,n)=>{n.d(e,{f:()=>i});var o=n(6426);const i=o.Node.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:t}){return["p",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}})},5261:(t,e,n)=>{n.r(e),n.d(e,{Placeholder:()=>s,default:()=>s});var o=n(6426),i=n(3829),r=n(7887);const s=o.Extension.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[new i.k_({key:new i.hs("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=e,s=[];if(!n)return null;const a=this.editor.isEmpty;return t.descendants(((t,e)=>{const n=i>=e&&i<=e+t.nodeSize,l=!t.isLeaf&&(0,o.isNodeEmpty)(t);if((n||!this.options.showOnlyCurrent)&&l){const o=[this.options.emptyNodeClass];a&&o.push(this.options.emptyEditorClass);const i=r.NZ.node(e,e+t.nodeSize,{class:o.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:e,hasAnchor:n}):this.options.placeholder});s.push(i)}return this.options.includeChildren})),r.zF.create(t,s)}}})]}})},9534:(t,e,n)=>{n.d(e,{n:()=>s});var o=n(6426);const i=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,r=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,s=o.Mark.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>!!t.includes("line-through")&&{}}],renderHTML({HTMLAttributes:t}){return["s",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[(0,o.markInputRule)({find:i,type:this.type})]},addPasteRules(){return[(0,o.markPasteRule)({find:r,type:this.type})]}})},3017:(t,e,n)=>{n.r(e),n.d(e,{TableCell:()=>i,default:()=>i});var o=n(6426);const i=o.Node.create({name:"tableCell",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}),tableRole:"cell",isolating:!0,parseHTML:()=>[{tag:"td"}],renderHTML({HTMLAttributes:t}){return["td",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]}})},5377:(t,e,n)=>{n.r(e),n.d(e,{TextStyle:()=>i,default:()=>i});var o=n(6426);const i=o.Mark.create({name:"textStyle",priority:101,addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"span",getAttrs:t=>!!t.hasAttribute("style")&&{}}],renderHTML({HTMLAttributes:t}){return["span",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=(0,o.getMarkAttributes)(t,this.type);return!!Object.entries(n).some((([,t])=>!!t))||e.unsetMark(this.name)}}}})},8777:(t,e,n)=>{n.d(e,{E:()=>o});const o=n(6426).Node.create({name:"text",group:"inline"})},4103:(t,e,n)=>{n.d(e,{K:()=>f,w:()=>p});for(var o={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:"'"},i={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},r="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),s="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),a=0;a<10;a++)o[48+a]=o[96+a]=String(a);for(a=1;a<=24;a++)o[a+111]="F"+a;for(a=65;a<=90;a++)o[a]=String.fromCharCode(a+32),i[a]=String.fromCharCode(a);for(var l in o)i.hasOwnProperty(l)||(i[l]=o[l]);var c=n(3829);const d="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function u(t){let e,n,o,i,r=t.split(/-(?!$)/),s=r[r.length-1];"Space"==s&&(s=" ");for(let t=0;t127)&&(a=o[n.keyCode])&&a!=l){let o=e[h(a,n)];if(o&&o(t.state,t.dispatch,t))return!0}}return!1}}},9939:(t,e,n)=>{function o(t){this.content=t}n.d(e,{S4:()=>Q,ZF:()=>lt,FK:()=>a,CU:()=>u,sX:()=>J,bP:()=>N,u$:()=>A,vI:()=>h,Sj:()=>Y,Ji:()=>p}),o.prototype={constructor:o,find:function(t){for(var e=0;e>1}},o.from=function(t){if(t instanceof o)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new o(e)};const i=o;function r(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(o),s=e.child(o);if(i!=s){if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let t=0;i.text[t]==s.text[t];t++)n++;return n}if(i.content.size||s.content.size){let t=r(i.content,s.content,n+1);if(null!=t)return t}n+=i.nodeSize}else n+=i.nodeSize}}function s(t,e,n,o){for(let i=t.childCount,r=e.childCount;;){if(0==i||0==r)return i==r?null:{a:n,b:o};let a=t.child(--i),l=e.child(--r),c=a.nodeSize;if(a!=l){if(!a.sameMarkup(l))return{a:n,b:o};if(a.isText&&a.text!=l.text){let t=0,e=Math.min(a.text.length,l.text.length);for(;tt&&!1!==n(a,o+s,i||null,r)&&a.content.size){let i=s+1;a.nodesBetween(Math.max(0,t-i),Math.min(a.content.size,e-i),n,o+i)}s=l}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,n,o){let i="",r=!0;return this.nodesBetween(t,e,((s,a)=>{let l=s.isText?s.text.slice(Math.max(t,a)-a,e-a):s.isLeaf?o?"function"==typeof o?o(s):o:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(r?r=!1:i+=n),i+=l}),0),i}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,n=t.firstChild,o=this.content.slice(),i=0;for(e.isText&&e.sameMarkup(n)&&(o[o.length-1]=e.withText(e.text+n.text),i=1);it)for(let i=0,r=0;rt&&((re)&&(s=s.isText?s.cut(Math.max(0,t-r),Math.min(s.text.length,e-r)):s.cut(Math.max(0,t-r-1),Math.min(s.content.size,e-r-1))),n.push(s),o+=s.nodeSize),r=a}return new a(n,o)}cutByIndex(t,e){return t==e?a.empty:0==t&&e==this.content.length?this:new a(this.content.slice(t,e))}replaceChild(t,e){let n=this.content[t];if(n==e)return this;let o=this.content.slice(),i=this.size+e.nodeSize-n.nodeSize;return o[t]=e,new a(o,i)}addToStart(t){return new a([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new a(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;ethis.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,o=0;;n++){let i=o+this.child(n).nodeSize;if(i>=t)return i==t||e>0?c(n+1,i):c(n,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((t=>t.toJSON())):null}static fromJSON(t,e){if(!e)return a.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new a(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return a.empty;let e,n=0;for(let o=0;o{class t{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,n=!1;for(let o=0;othis.type.rank&&(e||(e=t.slice(0,o)),e.push(this),n=!0),e&&e.push(i)}}return e||(e=t.slice()),n||e.push(this),e}removeFromSet(t){for(let e=0;et.type.rank-e.type.rank)),n}}return t.none=[],t})();class h extends Error{}class p{constructor(t,e,n){this.content=t,this.openStart=e,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let n=m(this.content,t+this.openStart,e);return n&&new p(n,this.openStart,this.openEnd)}removeBetween(t,e){return new p(f(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return p.empty;let n=e.openStart||0,o=e.openEnd||0;if("number"!=typeof n||"number"!=typeof o)throw new RangeError("Invalid input for Slice.fromJSON");return new p(a.fromJSON(t,e.content),n,o)}static maxOpen(t,e=!0){let n=0,o=0;for(let o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(let n=t.lastChild;n&&!n.isLeaf&&(e||!n.type.spec.isolating);n=n.lastChild)o++;return new p(t,n,o)}}function f(t,e,n){let{index:o,offset:i}=t.findIndex(e),r=t.maybeChild(o),{index:s,offset:a}=t.findIndex(n);if(i==e||r.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(o,r.copy(f(r.content,e-i-1,n-i-1)))}function m(t,e,n,o){let{index:i,offset:r}=t.findIndex(e),s=t.maybeChild(i);if(r==e||s.isText)return o&&!o.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=m(s.content,e-r-1,n);return a&&t.replaceChild(i,s.copy(a))}function g(t,e,n){if(n.openStart>t.depth)throw new h("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new h("Inconsistent open depths");return b(t,e,n,0)}function b(t,e,n,o){let i=t.index(o),r=t.node(o);if(i==e.index(o)&&o=0;t--)o=e.node(t).copy(a.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}(n,t);return C(r,x(t,i,s,e,o))}{let o=t.parent,i=o.content;return C(o,i.cut(0,t.parentOffset).append(n.content).append(i.cut(e.parentOffset)))}}return C(r,S(t,e,o))}function y(t,e){if(!e.type.compatibleContent(t.type))throw new h("Cannot join "+e.type.name+" onto "+t.type.name)}function k(t,e,n){let o=t.node(n);return y(o,e.node(n)),o}function v(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function w(t,e,n,o){let i=(e||t).node(n),r=0,s=e?e.index(n):i.childCount;t&&(r=t.index(n),t.depth>n?r++:t.textOffset&&(v(t.nodeAfter,o),r++));for(let t=r;ti&&k(t,e,i+1),s=o.depth>i&&k(n,o,i+1),l=[];return w(null,t,i,l),r&&s&&e.index(i)==n.index(i)?(y(r,s),v(C(r,x(t,e,n,o,i+1)),l)):(r&&v(C(r,S(t,e,i+1)),l),w(e,n,i,l),s&&v(C(s,S(n,o,i+1)),l)),w(o,null,i,l),new a(l)}function S(t,e,n){let o=[];return w(null,t,n,o),t.depth>n&&v(C(k(t,e,n+1),S(t,e,n+1)),o),w(e,null,n,o),new a(o)}p.empty=new p(a.empty,0,0);class M{constructor(t,e,n){this.pos=t,this.path=e,this.parentOffset=n,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],o=t.child(e);return n?t.child(e).cut(n):o}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let n=this.path[3*e],o=0==e?0:this.path[3*e-1]+1;for(let e=0;e0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new A(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let n=[],o=0,i=e;for(let e=t;;){let{index:t,offset:r}=e.content.findIndex(i),s=i-r;if(n.push(e,t,o+r),!s)break;if(e=e.child(t),e.isText)break;i=s-1,o+=r+1}return new M(e,n,i)}static resolveCached(t,e){let n=E.get(t);if(n)for(let t=0;tt&&this.nodesBetween(t,e,(t=>(n.isInSet(t.marks)&&(o=!0),!o))),o}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),R(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,n=a.empty,o=0,i=n.childCount){let r=this.contentMatchAt(t).matchFragment(n,o,i),s=r&&r.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(let t=o;tt.type.name))}`);this.content.forEach((t=>t.check()))}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((t=>t.toJSON()))),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let n;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}let o=a.fromJSON(t,e.content),i=t.nodeType(e.type).create(e.attrs,o,n);return i.type.checkAttrs(i.attrs),i}}N.prototype.text=void 0;class D extends N{constructor(t,e,n,o){if(super(t,e,null,o),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):R(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new D(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new D(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function R(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ${constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let n=new L(t,e);if(null==n.next)return $.empty;let o=z(n);n.next&&n.err("Unexpected trailing text");let i=function(t){let e=Object.create(null);return function n(o){let i=[];o.forEach((e=>{t[e].forEach((({term:e,to:n})=>{if(!e)return;let o;for(let t=0;t{o||i.push([e,o=[]]),-1==o.indexOf(t)&&o.push(t)}))}))}));let r=e[o.join(",")]=new $(o.indexOf(t.length-1)>-1);for(let t=0;te.concat(t(n,r))),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return o(r,s),i(t(e.expr,s),s),[o(s)]}if("plus"==e.type){let s=n();return i(t(e.expr,r),s),i(t(e.expr,s),s),[o(s)]}if("opt"==e.type)return[o(r)].concat(t(e.expr,r));if("range"==e.type){let s=r;for(let o=0;ot.to=e))}}(o));return function(t,e){for(let n=0,o=[t];nt.createAndFill())));for(let t=0;t=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(n){t.push(n);for(let o=0;o{let o=n+(e.validEnd?"*":" ")+" ";for(let n=0;n"+t.indexOf(e.next[n].next);return o})).join("\n")}}$.empty=new $(!0);class L{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function z(t){let e=[];do{e.push(P(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function P(t){let e=[];do{e.push(B(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function B(t){let e=function(t){if(t.eat("(")){let e=z(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let i=[];for(let t in n){let o=n[t];o.groups.indexOf(e)>-1&&i.push(o)}return 0==i.length&&t.err("No node type or group '"+e+"' found"),i}(t,t.next).map((e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e})));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=H(t,e)}return e}function _(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function H(t,e){let n=_(t),o=n;return t.eat(",")&&(o="}"!=t.next?_(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function j(t,e){return e-t}function F(t,e){let n=[];return function e(o){let i=t[o];if(1==i.length&&!i[0].term)return e(i[0].to);n.push(o);for(let t=0;t-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;en[t]=new U(t,e,o)));let o=e.spec.topNode||"doc";if(!n[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let t in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class K{constructor(t,e,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(t,e,n){let o=n.split("|");return n=>{let i=null===n?"null":typeof n;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${i}`)}}(t,e,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class J{constructor(t,e,n,o){this.name=t,this.rank=e,this.schema=n,this.spec=o,this.attrs=X(t,o.attrs),this.excluded=null;let i=G(this.attrs);this.instance=i?new u(this,i):null}create(t=null){return!t&&this.instance?this.instance:new u(this,V(this.attrs,t))}static compile(t,e){let n=Object.create(null),o=0;return t.forEach(((t,i)=>n[t]=new J(t,o++,e,i))),n}removeFromSet(t){for(var e=0;e-1}}class Y{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let e=this.spec={};for(let n in t)e[n]=t[n];e.nodes=i.from(t.nodes),e.marks=i.from(t.marks||{}),this.nodes=U.compile(this.spec.nodes,this),this.marks=J.compile(this.spec.marks,this);let n=Object.create(null);for(let t in this.nodes){if(t in this.marks)throw new RangeError(t+" can not be both a node and a mark");let e=this.nodes[t],o=e.spec.content||"",i=e.spec.marks;if(e.contentMatch=n[o]||(n[o]=$.parse(o,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==i?null:i?q(this,i.split(" ")):""!=i&&e.inlineContent?null:[]}for(let t in this.marks){let e=this.marks[t],n=e.spec.excludes;e.excluded=null==n?[e]:""==n?[]:q(this,n.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,n,o){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof U))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,o)}text(t,e){let n=this.nodes.text;return new D(n,n.defaultAttrs,t,u.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeFromJSON(t){return N.fromJSON(this,t)}markFromJSON(t){return u.fromJSON(this,t)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function q(t,e){let n=[];for(let o=0;o-1)&&n.push(s=o)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}class Q{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let n=this.matchedStyles=[];e.forEach((t=>{if(function(t){return null!=t.tag}(t))this.tags.push(t);else if(function(t){return null!=t.style}(t)){let e=/[^=]*/.exec(t.style)[0];n.indexOf(e)<0&&n.push(e),this.styles.push(t)}})),this.normalizeLists=!this.tags.some((e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let n=t.nodes[e.node];return n.contentMatch.matchType(n)}))}parse(t,e={}){let n=new it(this,e,!1);return n.addAll(t,u.none,e.from,e.to),n.finish()}parseSlice(t,e={}){let n=new it(this,e,!0);return n.addAll(t,u.none,e.from,e.to),p.maxOpen(n.finish())}matchTag(t,e,n){for(let o=n?this.tags.indexOf(n)+1:0;ot.length&&(61!=r.charCodeAt(t.length)||r.slice(t.length+1)!=e))){if(o.getAttrs){let t=o.getAttrs(e);if(!1===t)continue;o.attrs=t||void 0}return o}}}static schemaRules(t){let e=[];function n(t){let n=null==t.priority?50:t.priority,o=0;for(;o{n(t=st(t)),t.mark||t.ignore||t.clearMark||(t.mark=e)}))}for(let e in t.nodes){let o=t.nodes[e].spec.parseDOM;o&&o.forEach((t=>{n(t=st(t)),t.node||t.ignore||t.mark||(t.node=e)}))}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Q(t,Q.schemaRules(t)))}}const Z={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},tt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},et={ol:!0,ul:!0};function nt(t,e,n){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&n}class ot{constructor(t,e,n,o,i,r){this.type=t,this.attrs=e,this.marks=n,this.solid=o,this.options=r,this.content=[],this.activeMarks=u.none,this.match=i||(4&r?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(a.from(t));if(!e){let e,n=this.type.contentMatch;return(e=n.findWrapping(t.type))?(this.match=n,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let e=a.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(a.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!Z.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class it{constructor(t,e,n){this.parser=t,this.options=e,this.isOpen=n,this.open=0;let o,i=e.topNode,r=nt(null,e.preserveWhitespace,0)|(n?4:0);o=i?new ot(i.type,i.attrs,u.none,!0,e.topMatch||i.type.contentMatch,r):new ot(n?null:t.schema.topNodeType,null,u.none,!0,null,r),this.nodes=[o],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,e){3==t.nodeType?this.addTextNode(t,e):1==t.nodeType&&this.addElement(t,e)}addTextNode(t,e){let n=t.nodeValue,o=this.top;if(2&o.options||o.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(1&o.options)n=2&o.options?n.replace(/\r\n?/g,"\n"):n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let e=o.content[o.content.length-1],i=t.previousSibling;(!e||i&&"BR"==i.nodeName||e.isText&&/[ \t\r\n\u000c]$/.test(e.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),e),this.findInText(t)}else this.findInside(t)}addElement(t,e,n){let o,i=t.nodeName.toLowerCase();et.hasOwnProperty(i)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&et.hasOwnProperty(t)&&n?(n.appendChild(e),e=n):"li"==t?n=e:t&&(n=null)}}(t);let r=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(o=this.parser.matchTag(t,this,n));if(r?r.ignore:tt.hasOwnProperty(i))this.findInside(t),this.ignoreFallback(t,e);else if(!r||r.skip||r.closeParent){r&&r.closeParent?this.open=Math.max(0,this.open-1):r&&r.skip.nodeType&&(t=r.skip);let n,o=this.top,s=this.needsBlock;if(Z.hasOwnProperty(i))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t,e);let a=r&&r.skip?e:this.readStyles(t,e);a&&this.addAll(t,a),n&&this.sync(o),this.needsBlock=s}else{let n=this.readStyles(t,e);n&&this.addElementByRule(t,r,n,!1===r.consuming?o:void 0)}}leafFallback(t,e){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"),e)}ignoreFallback(t,e){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),e)}readStyles(t,e){let n=t.style;if(n&&n.length)for(let t=0;t!n.clearMark(t))):e.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;t=n}}return e}addElementByRule(t,e,n,o){let i,r;if(e.node)if(r=this.parser.schema.nodes[e.node],r.isLeaf)this.insertNode(r.create(e.attrs),n)||this.leafFallback(t,n);else{let t=this.enter(r,e.attrs||null,n,e.preserveWhitespace);t&&(i=!0,n=t)}else{let t=this.parser.schema.marks[e.mark];n=n.concat(t.create(e.attrs))}let s=this.top;if(r&&r.isLeaf)this.findInside(t);else if(o)this.addElement(t,n,o);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((t=>this.insertNode(t,n)));else{let o=t;"string"==typeof e.contentElement?o=t.querySelector(e.contentElement):"function"==typeof e.contentElement?o=e.contentElement(t):e.contentElement&&(o=e.contentElement),this.findAround(t,o,!0),this.addAll(o,n)}i&&this.sync(s)&&this.open--}addAll(t,e,n,o){let i=n||0;for(let r=n?t.childNodes[n]:t.firstChild,s=null==o?null:t.childNodes[o];r!=s;r=r.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(r,e);this.findAtPoint(t,i)}findPlace(t,e){let n,o;for(let e=this.open;e>=0;e--){let i=this.nodes[e],r=i.findWrapping(t);if(r&&(!n||n.length>r.length)&&(n=r,o=i,!r.length))break;if(i.solid)break}if(!n)return null;this.sync(o);for(let t=0;t!(r.type?r.type.allowsMarkType(e.type):at(e.type,t))||(a=e.addToSet(a),!1))),this.nodes.push(new ot(t,e,a,o,null,s)),this.open++,n}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));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(t){for(let e=this.open;e>=0;e--)if(this.nodes[e]==t)return this.open=e,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let n=this.nodes[e].content;for(let e=n.length-1;e>=0;e--)t+=n[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let n=0;n-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),n=this.options.context,o=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),i=-(n?n.depth+1:0)+(o?0:1),r=(t,s)=>{for(;t>=0;t--){let a=e[t];if(""==a){if(t==e.length-1||0==t)continue;for(;s>=i;s--)if(r(t-1,s))return!0;return!1}{let t=s>0||0==s&&o?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!t||t.name!=a&&-1==t.groups.indexOf(a))return!1;s--}}return!0};return r(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function rt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function st(t){let e={};for(let n in t)e[n]=t[n];return e}function at(t,e){let n=e.schema.nodes;for(let o in n){let i=n[o];if(!i.allowsMarkType(t))continue;let r=[],s=t=>{r.push(t);for(let n=0;n{if(i.length||t.marks.length){let n=0,r=0;for(;n=0;o--){let i=this.serializeMark(t.marks[o],t.isInline,e);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(t,e,n={}){let o=this.marks[t.type.name];return o&&ht(dt(n),o(t,e),null,t.attrs)}static renderSpec(t,e,n=null,o){return ht(t,e,n,o)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new lt(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=ct(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return ct(t.marks)}}function ct(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function dt(t){return t.document||window.document}const ut=new WeakMap;function ht(t,e,n,o){if("string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;let i,r=e[0];if("string"!=typeof r)throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=function(t){let e=ut.get(t);return void 0===e&&ut.set(t,e=function(t){let e=null;return function t(n){if(n&&"object"==typeof n)if(Array.isArray(n))if("string"==typeof n[0])e||(e=[]),e.push(n);else for(let e=0;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,a=r.indexOf(" ");a>0&&(n=r.slice(0,a),r=r.slice(a+1));let l=n?t.createElementNS(n,r):t.createElement(r),c=e[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let t in c)if(null!=c[t]){let e=t.indexOf(" ");e>0?l.setAttributeNS(t.slice(0,e),t.slice(e+1),c[t]):l.setAttribute(t,c[t])}}for(let i=d;id)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:e,contentDOM:i}=ht(t,r,n,o);if(l.appendChild(e),i){if(s)throw new RangeError("Multiple content holes");s=i}}}return{dom:l,contentDOM:s}}},3829:(t,e,n)=>{n.d(e,{$t:()=>x,LN:()=>s,U3:()=>d,hs:()=>E,i5:()=>f,k_:()=>M,nh:()=>h,yn:()=>a});var o=n(9939),i=n(4238);const r=Object.create(null);class s{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new a(t.min(e),t.max(e))]}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 t=this.ranges;for(let e=0;e=0;o--){let i=e<0?g(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):g(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new f(t.node(0))}static atStart(t){return g(t,t,0,0,1)||new f(t)}static atEnd(t){return g(t,t,t.content.size,t.childCount,-1)||new f(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=r[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in r)throw new RangeError("Duplicate use of selection JSON ID "+t);return r[t]=e,e.prototype.jsonID=t,e}getBookmark(){return d.between(this.$anchor,this.$head).getBookmark()}}s.prototype.visible=!0;class a{constructor(t,e){this.$from=t,this.$to=e}}let l=!1;function c(t){l||t.parent.inlineContent||(l=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class d extends s{constructor(t,e=t){c(t),c(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let n=t.resolve(e.map(this.head));if(!n.parent.inlineContent)return s.near(n);let o=t.resolve(e.map(this.anchor));return new d(o.parent.inlineContent?o:n,n)}replace(t,e=o.Ji.empty){if(super.replace(t,e),e==o.Ji.empty){let e=this.$from.marksAcross(this.$to);e&&t.ensureMarks(e)}}eq(t){return t instanceof d&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new u(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if("number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new d(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,n=e){let o=t.resolve(e);return new this(o,n==e?o:t.resolve(n))}static between(t,e,n){let o=t.pos-e.pos;if(n&&!o||(n=o>=0?1:-1),!e.parent.inlineContent){let t=s.findFrom(e,n,!0)||s.findFrom(e,-n,!0);if(!t)return s.near(e,n);e=t.$head}return t.parent.inlineContent||(0==o||(t=(s.findFrom(t,-n,!0)||s.findFrom(t,n,!0)).$anchor).posnew f(t)};function g(t,e,n,o,i,r=!1){if(e.inlineContent)return d.create(t,n);for(let s=o-(i>0?0:1);i>0?s=0;s+=i){let o=e.child(s);if(o.isAtom){if(!r&&h.isSelectable(o))return h.create(t,n-(i<0?o.nodeSize:0))}else{let e=g(t,o,n+i,i<0?o.childCount:0,i,r);if(e)return e}n+=o.nodeSize*i}return null}function b(t,e,n){let o=t.steps.length-1;if(o{null==r&&(r=o)})),t.setSelection(s.near(t.doc.resolve(r),n)))}class y extends i.dL{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(t){return this.storedMarks=t,this.updated|=2,this}ensureMarks(t){return o.CU.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(t,e){super.addStep(t,e),this.updated=-3&this.updated,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let n=this.selection;return e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||o.CU.none))),n.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,n){let o=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(o.text(t),!0):this.deleteSelection();{if(null==n&&(n=e),n=null==n?e:n,!t)return this.deleteRange(e,n);let i=this.storedMarks;if(!i){let t=this.doc.resolve(e);i=n==e?t.marks():t.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,o.text(t,i)),this.selection.empty||this.setSelection(s.near(this.selection.$to)),this}}setMeta(t,e){return this.meta["string"==typeof t?t:t.key]=e,this}getMeta(t){return this.meta["string"==typeof t?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function k(t,e){return e&&t?t.bind(e):t}class v{constructor(t,e,n){this.name=t,this.init=k(e.init,n),this.apply=k(e.apply,n)}}const w=[new v("doc",{init:t=>t.doc||t.schema.topNodeType.createAndFill(),apply:t=>t.doc}),new v("selection",{init:(t,e)=>t.selection||s.atStart(e.doc),apply:t=>t.selection}),new v("storedMarks",{init:t=>t.storedMarks||null,apply:(t,e,n,o)=>o.selection.$cursor?t.storedMarks:null}),new v("scrollToSelection",{init:()=>0,apply:(t,e)=>t.scrolledIntoView?e+1:e})];class C{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=w.slice(),e&&e.forEach((t=>{if(this.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");this.plugins.push(t),this.pluginsByKey[t.key]=t,t.spec.state&&this.fields.push(new v(t.key,t.spec.state,t))}))}}class x{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let n=0;nt.toJSON()))),t&&"object"==typeof t)for(let n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=t[n],i=o.spec.state;i&&i.toJSON&&(e[n]=i.toJSON.call(o,this[o.key]))}return e}static fromJSON(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new C(t.schema,t.plugins),r=new x(i);return i.fields.forEach((i=>{if("doc"==i.name)r.doc=o.bP.fromJSON(t.schema,e.doc);else if("selection"==i.name)r.selection=s.fromJSON(r.doc,e.selection);else if("storedMarks"==i.name)e.storedMarks&&(r.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],a=s.spec.state;if(s.key==i.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(e,o))return void(r[i.name]=a.fromJSON.call(s,t,e[o],r))}r[i.name]=i.init(t,r)}})),r}}function S(t,e,n){for(let o in t){let i=t[o];i instanceof Function?i=i.bind(e):"handleDOMEvents"==o&&(i=S(i,e,{})),n[o]=i}return n}class M{constructor(t){this.spec=t,this.props={},t.props&&S(t.props,this,this.props),this.key=t.key?t.key.key:O("plugin")}getState(t){return t[this.key]}}const T=Object.create(null);function O(t){return t in T?t+"$"+ ++T[t]:(T[t]=0,t+"$")}class E{constructor(t="key"){this.key=O(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}},4238:(t,e,n)=>{n.d(e,{$L:()=>I,Ln:()=>b,N0:()=>E,Um:()=>A,Wg:()=>y,X9:()=>l,dL:()=>G,jP:()=>C,n9:()=>T,oM:()=>x,zy:()=>M});var o=n(9939);const i=Math.pow(2,16);function r(t){return 65535&t}class s{constructor(t,e,n){this.pos=t,this.delInfo=e,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class a{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&a.empty)return a.empty}recover(t){let e=0,n=r(t);if(!this.inverted)for(let t=0;tt)break;let d=this.ranges[l+r],u=this.ranges[l+a],h=c+d;if(t<=h){let r=c+o+((d?t==c?-1:t==h?1:e:e)<0?0:u);if(n)return r;let a=t==c?2:t==h?1:4;return(e<0?t!=c:t!=h)&&(a|=8),new s(r,a,t==(e<0?c:h)?null:l/3+(t-c)*i)}o+=u-d}return n?t+o:new s(t+o,0,null)}touches(t,e){let n=0,o=r(e),i=this.inverted?2:1,s=this.inverted?1:2;for(let e=0;et)break;let a=this.ranges[e+i];if(t<=r+a&&e==3*o)return!0;n+=this.ranges[e+s]-a}return!1}forEach(t){let e=this.inverted?2:1,n=this.inverted?1:2;for(let o=0,i=0;o=0;e--){let o=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=o&&o>e?n-o-1:void 0)}}invert(){let t=new l;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let n=this.from;nn&&et.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t),i),e.openStart,e.openEnd);return u.fromReplace(t,this.from,this.to,r)}invert(){return new f(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new p(e.pos,n.pos,this.mark)}merge(t){return t instanceof p&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new p(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new p(e.from,e.to,t.markFromJSON(e.mark))}}d.jsonID("addMark",p);class f extends d{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=new o.Ji(h(e.content,(t=>t.mark(this.mark.removeFromSet(t.marks))),t),e.openStart,e.openEnd);return u.fromReplace(t,this.from,this.to,n)}invert(){return new p(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new f(e.pos,n.pos,this.mark)}merge(t){return t instanceof f&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new f(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new f(e.from,e.to,t.markFromJSON(e.mark))}}d.jsonID("removeMark",f);class m extends d{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return u.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return u.fromReplace(t,this.pos,this.pos+1,new o.Ji(o.FK.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let n=0;nn.pos?null:new y(e.pos,n.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to||"number"!=typeof e.gapFrom||"number"!=typeof e.gapTo||"number"!=typeof e.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new y(e.from,e.to,e.gapFrom,e.gapTo,o.Ji.fromJSON(t,e.slice),e.insert,!!e.structure)}}function k(t,e,n){let o=t.resolve(e),i=n-e,r=o.depth;for(;i>0&&r>0&&o.indexAfter(r)==o.node(r).childCount;)r--,i--;if(i>0){let t=o.node(r).maybeChild(o.indexAfter(r));for(;i>0;){if(!t||t.isLeaf)return!0;t=t.firstChild,i--}}return!1}function v(t,e,n,i=n.contentMatch,r=!0){let s=t.doc.nodeAt(e),a=[],l=e+1;for(let e=0;e=0;e--)t.step(a[e])}function w(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function C(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let o=t.$from.node(n),i=t.$from.index(n),r=t.$to.indexAfter(n);if(nr;t--,e--){let n=i.node(t),r=i.index(t);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(r,n.childCount),a=o&&o[e+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=o&&o[e]||n;if(!n.canReplace(r+1,n.childCount)||!l.type.validContent(s))return!1}let a=i.indexAfter(r),l=o&&o[0];return i.node(r).canReplaceWith(a,a,l?l.type:i.node(r+1).type)}function T(t,e){let n=t.resolve(e),o=n.index();return O(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function O(t,e){return!(!t||!e||t.isLeaf||!t.canAppend(e))}function E(t,e,n=-1){let o=t.resolve(e);for(let t=o.depth;;t--){let i,r,s=o.index(t);if(t==o.depth?(i=o.nodeBefore,r=o.nodeAfter):n>0?(i=o.node(t+1),s++,r=o.node(t).maybeChild(s)):(i=o.node(t).maybeChild(s-1),r=o.node(t+1)),i&&!i.isTextblock&&O(i,r)&&o.node(t).canReplace(s,s+1))return e;if(0==t)break;e=n<0?o.before(t):o.after(t)}}function A(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let t=0;t=0;e--){let n=e==o.depth?0:o.pos<=(o.start(e+1)+o.end(e+1))/2?-1:1,r=o.index(e)+(n>0?1:0),s=o.node(e),a=!1;if(1==t)a=s.canReplace(r,r,i);else{let t=s.contentMatchAt(r).findWrapping(i.firstChild.type);a=t&&s.canReplaceWith(r,r,t[0])}if(a)return 0==n?o.pos:n<0?o.before(e+1):o.after(e+1)}return null}function I(t,e,n=e,i=o.Ji.empty){if(e==n&&!i.size)return null;let r=t.resolve(e),s=t.resolve(n);return N(r,s,i)?new b(e,n,i):new D(r,s,i).fit()}function N(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}d.jsonID("replaceAround",y);class D{constructor(t,e,n){this.$from=t,this.$to=e,this.unplaced=n,this.frontier=[],this.placed=o.FK.empty;for(let e=0;e<=t.depth;e++){let n=t.node(e);this.frontier.push({type:n.type,match:n.contentMatchAt(t.indexAfter(e))})}for(let e=t.depth;e>0;e--)this.placed=o.FK.from(t.node(e).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(t<0?this.$to:n.doc.resolve(t));if(!i)return null;let r=this.placed,s=n.depth,a=i.depth;for(;s&&a&&1==r.childCount;)r=r.firstChild.content,s--,a--;let l=new o.Ji(r,s,a);return t>-1?new y(n.pos,t,this.$to.pos,this.$to.end(),l,e):l.size||n.pos!=this.$to.pos?new b(n.pos,i.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,n=0,o=this.unplaced.openEnd;n1&&(o=0),i.type.spec.isolating&&o<=n){t=n;break}e=i.content}for(let e=1;e<=2;e++)for(let n=1==e?t:this.unplaced.openStart;n>=0;n--){let t,i=null;n?(i=L(this.unplaced.content,n-1).firstChild,t=i.content):t=this.unplaced.content;let r=t.firstChild;for(let t=this.depth;t>=0;t--){let s,{type:a,match:l}=this.frontier[t],c=null;if(1==e&&(r?l.matchType(r.type)||(c=l.fillBefore(o.FK.from(r),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:n,frontierDepth:t,parent:i,inject:c};if(2==e&&r&&(s=l.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:t,parent:i,wrap:s};if(i&&l.matchType(i.type))break}}}openMore(){let{content:t,openStart:e,openEnd:n}=this.unplaced,i=L(t,e);return!(!i.childCount||i.firstChild.isLeaf||(this.unplaced=new o.Ji(t,e+1,Math.max(n,i.size+e>=t.size-n?e+1:0)),0))}dropNode(){let{content:t,openStart:e,openEnd:n}=this.unplaced,i=L(t,e);if(i.childCount<=1&&e>0){let r=t.size-e<=e+i.size;this.unplaced=new o.Ji(R(t,e-1,1),e-1,r?e-1:n)}else this.unplaced=new o.Ji(R(t,e,1),e,n)}placeNodes({sliceDepth:t,frontierDepth:e,parent:n,inject:i,wrap:r}){for(;this.depth>e;)this.closeFrontierNode();if(r)for(let t=0;t1||0==l||t.content.size)&&(u=e,d.push(z(t.mark(h.allowedMarks(t.marks)),1==c?l:0,c==a.childCount?p:-1)))}let f=c==a.childCount;f||(p=-1),this.placed=$(this.placed,e,o.FK.from(d)),this.frontier[e].match=u,f&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let t=0,e=a;t1&&o==this.$to.end(--n);)++o;return o}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:n,type:o}=this.frontier[e],i=e=0;n--){let{match:e,type:o}=this.frontier[n],i=P(t,n,o,e,!0);if(!i||i.childCount)continue t}return{depth:e,fit:r,move:i?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=$(this.placed,e.depth,e.fit)),t=e.move;for(let n=e.depth+1;n<=t.depth;n++){let e=t.node(n),o=e.type.contentMatch.fillBefore(e.content,!0,t.index(n));this.openFrontierNode(e.type,e.attrs,o)}return t}openFrontierNode(t,e=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=$(this.placed,this.depth,o.FK.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(o.FK.empty,!0);t.childCount&&(this.placed=$(this.placed,this.frontier.length,t))}}function R(t,e,n){return 0==e?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(R(t.firstChild.content,e-1,n)))}function $(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy($(t.lastChild.content,e-1,n)))}function L(t,e){for(let n=0;n1&&(i=i.replaceChild(0,z(i.firstChild,e-1,1==i.childCount?n-1:0))),e>0&&(i=t.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(o.FK.empty,!0)))),t.copy(i)}function P(t,e,n,o,i){let r=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==r.childCount&&!n.compatibleContent(r.type))return null;let a=o.fillBefore(r.content,!0,s);return a&&!function(t,e,n){for(let o=n;oi){let e=r.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(o.FK.empty,!0))}return t}function _(t,e){let n=[];for(let o=Math.min(t.depth,e.depth);o>=0;o--){let i=t.start(o);if(ie.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}class H extends d{constructor(t,e,n){super(),this.pos=t,this.attr=e,this.value=n}apply(t){let e=t.nodeAt(this.pos);if(!e)return u.fail("No node at attribute step's position");let n=Object.create(null);for(let t in e.attrs)n[t]=e.attrs[t];n[this.attr]=this.value;let i=e.type.create(n,null,e.marks);return u.fromReplace(t,this.pos,this.pos+1,new o.Ji(o.FK.from(i),0,e.isLeaf?0:1))}getMap(){return a.empty}invert(t){return new H(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new H(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if("number"!=typeof e.pos||"string"!=typeof e.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new H(e.pos,e.attr,e.value)}}d.jsonID("attr",H);class j extends d{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let n in t.attrs)e[n]=t.attrs[n];e[this.attr]=this.value;let n=t.type.create(e,t.content,t.marks);return u.ok(n)}getMap(){return a.empty}invert(t){return new j(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if("string"!=typeof e.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new j(e.attr,e.value)}}d.jsonID("docAttr",j);let F=class extends Error{};F=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},(F.prototype=Object.create(Error.prototype)).constructor=F,F.prototype.name="TransformError";class G{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new l}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new F(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,n=o.Ji.empty){let i=I(this.doc,t,e,n);return i&&this.step(i),this}replaceWith(t,e,n){return this.replace(t,e,new o.Ji(o.FK.from(n),0,0))}delete(t,e){return this.replace(t,e,o.Ji.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,n){return function(t,e,n,i){if(!i.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),s=t.doc.resolve(n);if(N(r,s,i))return t.step(new b(e,n,i));let a=_(r,t.doc.resolve(n));0==a[a.length-1]&&a.pop();let l=-(r.depth+1);a.unshift(l);for(let t=r.depth,e=r.pos-1;t>0;t--,e--){let n=r.node(t).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;a.indexOf(t)>-1?l=t:r.before(t)==e&&a.splice(1,0,-t)}let c=a.indexOf(l),d=[],u=i.openStart;for(let t=i.content,e=0;;e++){let n=t.firstChild;if(d.push(n),e==i.openStart)break;t=n.content}for(let t=u-1;t>=0;t--){let e=d[t],n=(h=e.type).spec.defining||h.spec.definingForContent;if(n&&!e.sameMarkup(r.node(Math.abs(l)-1)))u=t;else if(n||!e.type.isTextblock)break}var h;for(let e=i.openStart;e>=0;e--){let l=(e+u+1)%(i.openStart+1),h=d[l];if(h)for(let e=0;e=0&&(t.replace(e,n,i),!(t.steps.length>p));o--){let t=a[o];t<0||(e=r.before(t),n=s.after(t))}}(this,t,e,n),this}replaceRangeWith(t,e,n){return function(t,e,n,i){if(!i.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=function(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(0==o.parentOffset)for(let t=o.depth-1;t>=0;t--){let e=o.index(t);if(o.node(t).canReplaceWith(e,e,n))return o.before(t+1);if(e>0)return null}if(o.parentOffset==o.parent.content.size)for(let t=o.depth-1;t>=0;t--){let e=o.indexAfter(t);if(o.node(t).canReplaceWith(e,e,n))return o.after(t+1);if(e0&&(s||o.node(n-1).canReplace(o.index(n-1),i.indexAfter(n-1))))return t.delete(o.before(n),i.after(n))}for(let r=1;r<=o.depth&&r<=i.depth;r++)if(e-o.start(r)==o.depth-r&&n>o.end(r)&&i.end(r)-n!=i.depth-r)return t.delete(o.before(r),n);t.delete(e,n)}(this,t,e),this}lift(t,e){return function(t,e,n){let{$from:i,$to:r,depth:s}=e,a=i.before(s+1),l=r.after(s+1),c=a,d=l,u=o.FK.empty,h=0;for(let t=s,e=!1;t>n;t--)e||i.index(t)>0?(e=!0,u=o.FK.from(i.node(t).copy(u)),h++):c--;let p=o.FK.empty,f=0;for(let t=s,e=!1;t>n;t--)e||r.after(t+1)=0;t--){if(i.size){let e=n[t].type.contentMatch.matchFragment(i);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=o.FK.from(n[t].type.create(n[t].attrs,i))}let r=e.start,s=e.end;t.step(new y(r,s,r,s,new o.Ji(i,0,0),n.length,!0))}(this,t,e),this}setBlockType(t,e=t,n,i=null){return function(t,e,n,i,r){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,((e,n)=>{let a="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(i,a)&&function(t,e,n){let o=t.resolve(e),i=o.index();return o.parent.canReplaceWith(i,i+1,n)}(t.doc,t.mapping.slice(s).map(n),i)){let r=null;if(i.schema.linebreakReplacement){let t="pre"==i.whitespace,e=!!i.contentMatch.matchType(i.schema.linebreakReplacement);t&&!e?r=!1:!t&&e&&(r=!0)}!1===r&&function(t,e,n,o){e.forEach(((i,r)=>{if(i.type==i.type.schema.linebreakReplacement){let i=t.mapping.slice(o).map(n+1+r);t.replaceWith(i,i+1,e.type.schema.text("\n"))}}))}(t,e,n,s),v(t,t.mapping.slice(s).map(n,1),i,void 0,null===r);let l=t.mapping.slice(s),c=l.map(n,1),d=l.map(n+e.nodeSize,1);return t.step(new y(c,d,c+1,d-1,new o.Ji(o.FK.from(i.create(a,null,e.marks)),0,0),1,!0)),!0===r&&function(t,e,n,o){e.forEach(((i,r)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let i=t.mapping.slice(o).map(n+1+r+s.index);t.replaceWith(i,i+1,e.type.schema.linebreakReplacement.create())}}}))}(t,e,n,s),!1}}))}(this,t,e,n,i),this}setNodeMarkup(t,e,n=null,i){return function(t,e,n,i,r){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let a=n.create(i,null,r||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,a);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new y(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new o.Ji(o.FK.from(a),0,0),1,!0))}(this,t,e,n,i),this}setNodeAttribute(t,e,n){return this.step(new H(t,e,n)),this}setDocAttribute(t,e){return this.step(new j(t,e)),this}addNodeMark(t,e){return this.step(new m(t,e)),this}removeNodeMark(t,e){if(!(e instanceof o.CU)){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(!(e=e.isInSet(n.marks)))return this}return this.step(new g(t,e)),this}split(t,e=1,n){return function(t,e,n=1,i){let r=t.doc.resolve(e),s=o.FK.empty,a=o.FK.empty;for(let t=r.depth,e=r.depth-n,l=n-1;t>e;t--,l--){s=o.FK.from(r.node(t).copy(s));let e=i&&i[l];a=o.FK.from(e?e.type.create(e.attrs,a):r.node(t).copy(a))}t.step(new b(e,e,new o.Ji(s.append(a),n,n),!0))}(this,t,e,n),this}addMark(t,e,n){return function(t,e,n,o){let i,r,s=[],a=[];t.doc.nodesBetween(e,n,((t,l,c)=>{if(!t.isInline)return;let d=t.marks;if(!o.isInSet(d)&&c.type.allowsMarkType(o.type)){let c=Math.max(l,e),u=Math.min(l+t.nodeSize,n),h=o.addToSet(d);for(let t=0;tt.step(e))),a.forEach((e=>t.step(e)))}(this,t,e,n),this}removeMark(t,e,n){return function(t,e,n,i){let r=[],s=0;t.doc.nodesBetween(e,n,((t,a)=>{if(!t.isInline)return;s++;let l=null;if(i instanceof o.sX){let e,n=t.marks;for(;e=i.isInSet(n);)(l||(l=[])).push(e),n=e.removeFromSet(n)}else i?i.isInSet(t.marks)&&(l=[i]):l=t.marks;if(l&&l.length){let o=Math.min(a+t.nodeSize,n);for(let t=0;tt.step(new f(e.from,e.to,e.style))))}(this,t,e,n),this}clearIncompatible(t,e,n){return v(this,t,e,n),this}}},7887:(t,e,n)=>{n.d(e,{Lz:()=>dn,NZ:()=>ze,zF:()=>_e});var o=n(3829),i=n(9939),r=n(4238);const s=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},a=function(t){let e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e};let l=null;const c=function(t,e,n){let o=l||(l=document.createRange());return o.setEnd(t,null==n?t.nodeValue.length:n),o.setStart(t,e||0),o},d=function(t,e,n,o){return n&&(h(t,e,n,o,-1)||h(t,e,n,o,1))},u=/^(img|br|input|textarea|hr)$/i;function h(t,e,n,o,i){for(;;){if(t==n&&e==o)return!0;if(e==(i<0?0:p(t))){let n=t.parentNode;if(!n||1!=n.nodeType||f(t)||u.test(t.nodeName)||"false"==t.contentEditable)return!1;e=s(t)+(i<0?0:1),t=n}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(i<0?-1:0)]).contentEditable)return!1;e=i<0?p(t):0}}}function p(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function f(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const m=function(t){return t.focusNode&&d(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function g(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const b="undefined"!=typeof navigator?navigator:null,y="undefined"!=typeof document?document:null,k=b&&b.userAgent||"",v=/Edge\/(\d+)/.exec(k),w=/MSIE \d/.exec(k),C=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(k),x=!!(w||C||v),S=w?document.documentMode:C?+C[1]:v?+v[1]:0,M=!x&&/gecko\/(\d+)/i.test(k);M&&(/Firefox\/(\d+)/.exec(k)||[0,0])[1];const T=!x&&/Chrome\/(\d+)/.exec(k),O=!!T,E=T?+T[1]:0,A=!x&&!!b&&/Apple Computer/.test(b.vendor),I=A&&(/Mobile\/\w+/.test(k)||!!b&&b.maxTouchPoints>2),N=I||!!b&&/Mac/.test(b.platform),D=!!b&&/Win/.test(b.platform),R=/Android \d/.test(k),$=!!y&&"webkitFontSmoothing"in y.documentElement.style,L=$?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function z(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function P(t,e){return"number"==typeof t?t:t[e]}function B(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function _(t,e,n){let o=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,r=t.dom.ownerDocument;for(let s=n||t.dom;s;s=a(s)){if(1!=s.nodeType)continue;let t=s,n=t==r.body,a=n?z(r):B(t),l=0,c=0;if(e.topa.bottom-P(o,"bottom")&&(c=e.bottom-e.top>a.bottom-a.top?e.top+P(i,"top")-a.top:e.bottom-a.bottom+P(i,"bottom")),e.lefta.right-P(o,"right")&&(l=e.right-a.right+P(i,"right")),l||c)if(n)r.defaultView.scrollBy(l,c);else{let n=t.scrollLeft,o=t.scrollTop;c&&(t.scrollTop+=c),l&&(t.scrollLeft+=l);let i=t.scrollLeft-n,r=t.scrollTop-o;e={left:e.left-i,top:e.top-r,right:e.right-i,bottom:e.bottom-r}}if(n||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function H(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=a(o));return e}function j(t,e){for(let n=0;n=d){l=Math.max(p.bottom,l),d=Math.min(p.top,d);let t=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!i&&p.left<=e.left&&p.right>=e.left&&(i=u,r={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(a=h+1)}}return!n&&i&&(n=i,o=r,s=0),n&&3==n.nodeType?function(t,e){let n=t.nodeValue.length,o=document.createRange();for(let i=0;i=(n.left+n.right)/2?1:0)}}return{node:t,offset:0}}(n,o):!n||s&&1==n.nodeType?{node:t,offset:a}:G(n,o)}function V(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function W(t,e,n){let o=t.childNodes.length;if(o&&n.tope.top&&i++}let o;$&&i&&1==n.nodeType&&1==(o=n.childNodes[i-1]).nodeType&&"false"==o.contentEditable&&o.getBoundingClientRect().top>=e.top&&i--,n==t.dom&&i==n.childNodes.length-1&&1==n.lastChild.nodeType&&e.top>n.lastChild.getBoundingClientRect().bottom?s=t.state.doc.content.size:0!=i&&1==n.nodeType&&"BR"==n.childNodes[i-1].nodeName||(s=function(t,e,n,o){let i=-1;for(let n=e,r=!1;n!=t.dom;){let e=t.docView.nearestDesc(n,!0);if(!e)return null;if(1==e.dom.nodeType&&(e.node.isBlock&&e.parent||!e.contentDOM)){let t=e.dom.getBoundingClientRect();if(e.node.isBlock&&e.parent&&(!r&&t.left>o.left||t.top>o.top?i=e.posBefore:(!r&&t.right-1?i:t.docView.posFromDOM(e,n,-1)}(t,n,i,e))}null==s&&(s=function(t,e,n){let{node:o,offset:i}=G(e,n),r=-1;if(1==o.nodeType&&!o.firstChild){let t=o.getBoundingClientRect();r=t.left!=t.right&&n.left>(t.left+t.right)/2?1:-1}return t.docView.posFromDOM(o,i,r)}(t,l,e));let c=t.docView.nearestDesc(l,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function U(t){return t.top=0&&i==o.nodeValue.length?(t--,r=1):n<0?t--:e++,q(K(c(o,t,e),r),r<0)}{let t=K(c(o,i,i),n);if(M&&i&&/\s/.test(o.nodeValue[i-1])&&i=0)}if(null==r&&i&&(n<0||i==p(o))){let t=o.childNodes[i-1],e=3==t.nodeType?c(t,p(t)-(s?0:1)):1!=t.nodeType||"BR"==t.nodeName&&t.nextSibling?null:t;if(e)return q(K(e,1),!1)}if(null==r&&i=0)}function q(t,e){if(0==t.width)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Q(t,e){if(0==t.height)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Z(t,e,n){let o=t.state,i=t.root.activeElement;o!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),i!=t.dom&&i&&i.focus()}}const tt=/[\u0590-\u08ac]/;let et=null,nt=null,ot=!1;class it{constructor(t,e,n,o){this.parent=t,this.children=e,this.dom=n,this.contentDOM=o,this.dirty=0,n.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,n){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;es(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(let e=t;;e=e.parentNode){if(e==this.dom){o=!1;break}if(e.previousSibling)break}if(null==o&&e==t.childNodes.length)for(let e=t;;e=e.parentNode){if(e==this.dom){o=!0;break}if(e.nextSibling)break}}return(null==o?n>0:o)?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let n=!0,o=t;o;o=o.parentNode){let i,r=this.getDesc(o);if(r&&(!e||r.node)){if(!n||!(i=r.nodeDOM)||(1==i.nodeType?i.contains(1==t.nodeType?t:t.parentNode):i==t))return r;n=!1}}}getDesc(t){let e=t.pmViewDesc;for(let t=e;t;t=t.parent)if(t==this)return e}posFromDOM(t,e,n){for(let o=t;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(t,e,n)}return-1}descAt(t){for(let e=0,n=0;et||i instanceof ut){o=t-e;break}e=r}if(o)return this.children[n].domFromPos(o-this.children[n].border,e);for(let t;n&&!(t=this.children[n-1]).size&&t instanceof rt&&t.side>=0;n--);if(e<=0){let t,o=!0;for(;t=n?this.children[n-1]:null,t&&t.dom.parentNode!=this.contentDOM;n--,o=!1);return t&&e&&o&&!t.border&&!t.domAtom?t.domFromPos(t.size,e):{node:this.contentDOM,offset:t?s(t.dom)+1:0}}{let t,o=!0;for(;t=n=i&&e<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(t,e,i);t=r;for(let e=a;e>0;e--){let n=this.children[e-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){o=s(n.dom)+1;break}t-=n.size}-1==o&&(o=0)}if(o>-1&&(l>e||a==this.children.length-1)){e=l;for(let t=a+1;ta&&re){let t=a;a=l,l=t}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(t){return!this.contentDOM&&"selection"!=t.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let n=0,o=0;o=n:tn){let o=n+i.border,s=r-i.border;if(t>=o&&e<=s)return this.dirty=t==n||e==r?2:1,void(t!=o||e!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(t-o,e-o):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=r}this.dirty=2}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let n=1==t?2:1;e.dirtyi?i.parent?i.parent.posBeforeChild(i):void 0:o))),!e.type.spec.raw){if(1!=r.nodeType){let t=document.createElement("span");t.appendChild(r),r=t}r.contentEditable="false",r.classList.add("ProseMirror-widget")}super(t,[],r,null),this.widget=e,this.widget=e,i=this}matchesWidget(t){return 0==this.dirty&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return!!e&&e(t)}ignoreMutation(t){return"selection"!=t.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class st extends it{constructor(t,e,n,o){super(t,[],e,null),this.textDOM=n,this.text=o}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue}}class at extends it{constructor(t,e,n,o){super(t,[],n,o),this.mark=e}static create(t,e,n,o){let r=o.nodeViews[e.type.name],s=r&&r(e,o,n);return s&&s.dom||(s=i.ZF.renderSpec(document,e.type.spec.toDOM(e,n),null,e.attrs)),new at(t,e,s.dom,s.contentDOM||s.dom)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return 3!=this.dirty&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),0!=this.dirty){let t=this.parent;for(;!t.node;)t=t.parent;t.dirty0&&(i=St(i,0,t,n));for(let t=0;ta?a.parent?a.parent.posBeforeChild(a):void 0:s),n,o),d=c&&c.dom,u=c&&c.contentDOM;if(e.isText)if(d){if(3!=d.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else d=document.createTextNode(e.text);else if(!d){let t=i.ZF.renderSpec(document,e.type.spec.toDOM(e),null,e.attrs);({dom:d,contentDOM:u}=t)}u||e.isText||"BR"==d.nodeName||(d.hasAttribute("contenteditable")||(d.contentEditable="false"),e.type.spec.draggable&&(d.draggable=!0));let h=d;return d=kt(d,n,e),c?a=new ht(t,e,n,o,d,u||null,h,c,r,s+1):e.isText?new dt(t,e,n,o,d,h,r):new lt(t,e,n,o,d,u||null,h,r,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}t.contentElement||(t.getContent=()=>i.FK.empty)}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(t,e,n){return 0==this.dirty&&t.eq(this.node)&&vt(e,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let n=this.node.inlineContent,o=e,r=t.composing?this.localCompositionInfo(t,e):null,s=r&&r.pos>-1?r:null,a=r&&r.pos<0,l=new Ct(this,s&&s.node,t);!function(t,e,n,o){let i=e.locals(t),r=0;if(0==i.length){for(let n=0;nr;)a.push(i[s++]);let f=r+h.nodeSize;if(h.isText){let t=f;s!t.inline)):a.slice(),e.forChild(r,h),p),r=f}}(this.node,this.innerDeco,((e,r,s)=>{e.spec.marks?l.syncToMarks(e.spec.marks,n,t):e.type.side>=0&&!s&&l.syncToMarks(r==this.node.childCount?i.CU.none:this.node.child(r).marks,n,t),l.placeWidget(e,t,o)}),((e,i,s,c)=>{let d;l.syncToMarks(e.marks,n,t),l.findNodeMatch(e,i,s,c)||a&&t.state.selection.from>o&&t.state.selection.to-1&&l.updateNodeAt(e,i,s,d,t)||l.updateNextNode(e,i,s,t,c,o)||l.addNode(e,i,s,t,o),o+=e.nodeSize})),l.syncToMarks([],n,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(s&&this.protectLocalComposition(t,s),pt(this.contentDOM,this.children,t),I&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))}localCompositionInfo(t,e){let{from:n,to:i}=t.state.selection;if(!(t.state.selection instanceof o.U3)||ne+this.node.content.size)return null;let r=t.input.compositionNode;if(!r||!this.dom.contains(r.parentNode))return null;if(this.node.inlineContent){let t=r.nodeValue,o=function(t,e,n,o){for(let i=0,r=0;i=n){if(r>=o&&l.slice(o-e.length-a,o-a)==e)return o-e.length;let t=a=0&&t+e.length+a>=n)return a+t;if(n==o&&l.length>=o+e.length-a&&l.slice(o-a,o-a+e.length)==e)return o}}return-1}(this.node.content,t,n-e,i-e);return o<0?null:{node:r,pos:o,text:t}}return{node:r,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:n,text:o}){if(this.getDesc(e))return;let i=e;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 r=new st(this,i,e,o);t.input.compositionNodes.push(r),this.children=St(this.children,n,n+o.length,t,r)}update(t,e,n,o){return!(3==this.dirty||!t.sameMarkup(this.node)||(this.updateInner(t,e,n,o),0))}updateInner(t,e,n,o){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=0}updateOuterDeco(t){if(vt(t,this.outerDeco))return;let e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=bt(this.dom,this.nodeDOM,gt(this.outerDeco,this.node,e),gt(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ct(t,e,n,o,i){kt(o,e,t);let r=new lt(void 0,t,e,n,o,o,o,i,0);return r.contentDOM&&r.updateChildren(i,0),r}class dt extends lt{constructor(t,e,n,o,i,r,s){super(t,e,n,o,i,null,r,s,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,n,o){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node)||(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=t,this.dirty=0,0))}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,n){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,n)}ignoreMutation(t){return"characterData"!=t.type&&"selection"!=t.type}slice(t,e,n){let o=this.node.cut(t,e),i=document.createTextNode(o.text);return new dt(this.parent,o,this.outerDeco,this.innerDeco,i,i,n)}markDirty(t,e){super.markDirty(t,e),this.dom==this.nodeDOM||0!=t&&e!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(t){return this.node.text==t}}class ut extends it{parseRule(){return{ignore:!0}}matchesHack(t){return 0==this.dirty&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class ht extends lt{constructor(t,e,n,o,i,r,s,a,l,c){super(t,e,n,o,i,r,s,l,c),this.spec=a}update(t,e,n,o){if(3==this.dirty)return!1;if(this.spec.update){let i=this.spec.update(t,e,n);return i&&this.updateInner(t,e,n,o),i}return!(!this.contentDOM&&!t.isLeaf)&&super.update(t,e,n,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,n,o){this.spec.setSelection?this.spec.setSelection(t,e,n):super.setSelection(t,e,n,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function pt(t,e,n){let o=t.firstChild,i=!1;for(let r=0;r0;){let a;for(;;)if(o){let t=n.children[o-1];if(!(t instanceof at)){a=t,o--;break}n=t,o=t.children.length}else{if(n==e)break t;o=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,r.set(a,i),s.push(a)}}return{index:i,matched:r,matches:s.reverse()}}(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let n=t;n>1,r=Math.min(i,t.length);for(;o-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let o=at.create(this.top,t[i],e,n);this.top.children.splice(this.index,0,o),this.top=o,this.changed=!0}this.index=0,i++}}findNodeMatch(t,e,n,o){let i,r=-1;if(o>=this.preMatch.index&&(i=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&i.matchesNode(t,e,n))r=this.top.children.indexOf(i,this.index);else for(let o=this.index,i=Math.min(this.top.children.length,o+5);o=n||d<=e?r.push(l):(cn&&r.push(l.slice(n-c,l.size,o)))}return r}function Mt(t,e=null){let n=t.domSelectionRange(),i=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),a=r&&0==r.size,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c,d,u=i.resolve(l);if(m(n)){for(c=l;r&&!r.node;)r=r.parent;let t=r.node;if(r&&t.isAtom&&o.nh.isSelectable(t)&&r.parent&&(!t.isInline||!function(t,e,n){for(let o=0==e,i=e==p(t);o||i;){if(t==n)return!0;let e=s(t);if(!(t=t.parentNode))return!1;o=o&&0==e,i=i&&e==p(t)}}(n.focusNode,n.focusOffset,r.dom))){let t=r.posBefore;d=new o.nh(l==t?u:i.resolve(t))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let e=l,o=l;for(let i=0;i{n.anchorNode==o&&n.anchorOffset==i||(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout((()=>{Tt(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Et=A||O&&E<63;function At(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),i=oo(t,e,n)))||o.U3.between(e,n,i)}function Lt(t){return!(t.editable&&!t.hasFocus())&&zt(t)}function zt(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Pt(t,e){let{$anchor:n,$head:i}=t.selection,r=e>0?n.max(i):n.min(i),s=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return s&&o.LN.findFrom(s,e)}function Bt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function _t(t,e,n){let i=t.state.selection;if(!(i instanceof o.U3)){if(i instanceof o.nh&&i.node.isInline)return Bt(t,new o.U3(e>0?i.$to:i.$from));{let n=Pt(t.state,e);return!!n&&Bt(t,n)}}if(n.indexOf("s")>-1){let{$head:n}=i,r=n.textOffset?null:e<0?n.nodeBefore:n.nodeAfter;if(!r||r.isText||!r.isLeaf)return!1;let s=t.state.doc.resolve(n.pos+r.nodeSize*(e<0?-1:1));return Bt(t,new o.U3(i.$anchor,s))}if(!i.empty)return!1;if(t.endOfTextblock(e>0?"forward":"backward")){let n=Pt(t.state,e);return!!(n&&n instanceof o.nh)&&Bt(t,n)}if(!(N&&n.indexOf("m")>-1)){let n,r=i.$head,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!s||s.isText)return!1;let a=e<0?r.pos-s.nodeSize:r.pos;return!!(s.isAtom||(n=t.docView.descAt(a))&&!n.contentDOM)&&(o.nh.isSelectable(s)?Bt(t,new o.nh(e<0?t.state.doc.resolve(r.pos-s.nodeSize):r)):!!$&&Bt(t,new o.U3(t.state.doc.resolve(e<0?a:a+s.nodeSize))))}}function Ht(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function jt(t,e){let n=t.pmViewDesc;return n&&0==n.size&&(e<0||t.nextSibling||"BR"!=t.nodeName)}function Ft(t,e){return e<0?function(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let i,r,a=!1;for(M&&1==n.nodeType&&o0){if(1!=n.nodeType)break;{let t=n.childNodes[o-1];if(jt(t,-1))i=n,r=--o;else{if(3!=t.nodeType)break;n=t,o=n.nodeValue.length}}}else{if(Gt(n))break;{let e=n.previousSibling;for(;e&&jt(e,-1);)i=n.parentNode,r=s(e),e=e.previousSibling;if(e)n=e,o=Ht(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}a?Vt(t,n,o):i&&Vt(t,i,r)}(t):function(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let i,r,a=Ht(n);for(;;)if(o{t.state==i&&Ot(t)}),50)}function Wt(t,e){let n=t.state.doc.resolve(e);if(!O&&!D&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let n=t.coordsAtPos(e-1),i=(n.top+n.bottom)/2;if(i>o.top&&i1)return n.lefto.top&&i1)return n.left>o.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(t.dom).direction?"rtl":"ltr"}function Xt(t,e,n){let i=t.state.selection;if(i instanceof o.U3&&!i.empty||n.indexOf("s")>-1)return!1;if(N&&n.indexOf("m")>-1)return!1;let{$from:r,$to:s}=i;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let n=Pt(t.state,e);if(n&&n instanceof o.nh)return Bt(t,n)}if(!r.parent.inlineContent){let n=e<0?r:s,a=i instanceof o.i5?o.LN.near(n,e):o.LN.findFrom(n,e);return!!a&&Bt(t,a)}return!1}function Ut(t,e){if(!(t.state.selection instanceof o.U3))return!0;let{$head:n,$anchor:i,empty:r}=t.state.selection;if(!n.sameParent(i))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Kt(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Jt(t,e){t.someProp("transformCopied",(n=>{e=n(e,t)}));let n=[],{content:o,openStart:r,openEnd:s}=e;for(;r>1&&s>1&&1==o.childCount&&1==o.firstChild.childCount;){r--,s--;let t=o.firstChild;n.push(t.type.name,t.attrs!=t.type.defaultAttrs?t.attrs:null),o=t.content}let a=t.someProp("clipboardSerializer")||i.ZF.fromSchema(t.state.schema),l=re(),c=l.createElement("div");c.appendChild(a.serializeFragment(o,{document:l}));let d,u=c.firstChild,h=0;for(;u&&1==u.nodeType&&(d=oe[u.nodeName.toLowerCase()]);){for(let t=d.length-1;t>=0;t--){let e=l.createElement(d[t]);for(;c.firstChild;)e.appendChild(c.firstChild);c.appendChild(e),h++}u=c.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",`${r} ${s}${h?` -${h}`:""} ${JSON.stringify(n)}`),{dom:c,text:t.someProp("clipboardTextSerializer",(n=>n(e,t)))||e.content.textBetween(0,e.content.size,"\n\n"),slice:e}}function Yt(t,e,n,o,r){let s,a,l=r.parent.type.spec.code;if(!n&&!e)return null;let c=e&&(o||l||!n);if(c){if(t.someProp("transformPastedText",(n=>{e=n(e,l||o,t)})),l)return e?new i.Ji(i.FK.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0):i.Ji.empty;let n=t.someProp("clipboardTextParser",(n=>n(e,r,o,t)));if(n)a=n;else{let n=r.marks(),{schema:o}=t.state,a=i.ZF.fromSchema(o);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach((t=>{let e=s.appendChild(document.createElement("p"));t&&e.appendChild(a.serializeNode(o.text(t,n)))}))}}else t.someProp("transformPastedHTML",(e=>{n=e(n,t)})),s=function(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n,o=re().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(t);if((n=i&&oe[i[1].toLowerCase()])&&(t=n.map((t=>"<"+t+">")).join("")+t+n.map((t=>"")).reverse().join("")),o.innerHTML=function(t){let e=window.trustedTypes;return e?e.createPolicy("detachedDocument",{createHTML:t=>t}).createHTML(t):t}(t),n)for(let t=0;t0;t--){let t=s.firstChild;for(;t&&1!=t.nodeType;)t=t.nextSibling;if(!t)break;s=t}if(!a){let e=t.someProp("clipboardParser")||t.someProp("domParser")||i.S4.fromSchema(t.state.schema);a=e.parseSlice(s,{preserveWhitespace:!(!c&&!u),context:r,ruleFromNode:t=>"BR"!=t.nodeName||t.nextSibling||!t.parentNode||qt.test(t.parentNode.nodeName)?null:{ignore:!0}})}if(u)a=function(t,e){if(!t.size)return t;let n,o=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}let{content:r,openStart:s,openEnd:a}=t;for(let t=n.length-2;t>=0;t-=2){let e=o.nodes[n[t]];if(!e||e.hasRequiredAttrs())break;r=i.FK.from(e.create(n[t+1],r)),s++,a++}return new i.Ji(r,s,a)}(ne(a,+u[1],+u[2]),u[4]);else if(a=i.Ji.maxOpen(function(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o,r=e.node(n).contentMatchAt(e.index(n)),s=[];if(t.forEach((t=>{if(!s)return;let e,n=r.findWrapping(t.type);if(!n)return s=null;if(e=s.length&&o.length&&Zt(n,o,t,s[s.length-1],0))s[s.length-1]=e;else{s.length&&(s[s.length-1]=te(s[s.length-1],o.length));let e=Qt(t,n);s.push(e),r=r.matchType(e.type),o=n}})),s)return i.FK.from(s)}return t}(a.content,r),!0),a.openStart||a.openEnd){let t=0,e=0;for(let e=a.content.firstChild;t{a=e(a,t)})),a}const qt=/^(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 Qt(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,i.FK.from(t));return t}function Zt(t,e,n,o,r){if(r1&&(s=0),r=n&&(l=e<0?a.contentMatchAt(0).fillBefore(l,s<=r).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(i.FK.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(l))}function ne(t,e,n){return e{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=e=>he(t,e))}))}function he(t,e){return t.someProp("handleDOMEvents",(n=>{let o=n[e.type];return!!o&&(o(t,e)||e.defaultPrevented)}))}function pe(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function fe(t){return{left:t.clientX,top:t.clientY}}function me(t,e,n,o,i){if(-1==o)return!1;let r=t.state.doc.resolve(o);for(let o=r.depth+1;o>0;o--)if(t.someProp(e,(e=>o>r.depth?e(t,n,r.nodeAfter,r.before(o),i,!0):e(t,n,r.node(o),r.before(o),i,!1))))return!0;return!1}function ge(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);"pointer"==n&&o.setMeta("pointer",!0),t.dispatch(o)}function be(t,e,n,o){return me(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",(n=>n(t,e,o)))}function ye(t,e,n,i){return me(t,"handleTripleClickOn",e,n,i)||t.someProp("handleTripleClick",(n=>n(t,e,i)))||function(t,e,n){if(0!=n.button)return!1;let i=t.state.doc;if(-1==e)return!!i.inlineContent&&(ge(t,o.U3.create(i,0,i.content.size),"pointer"),!0);let r=i.resolve(e);for(let e=r.depth+1;e>0;e--){let n=e>r.depth?r.nodeAfter:r.node(e),s=r.before(e);if(n.inlineContent)ge(t,o.U3.create(i,s+1,s+1+n.content.size),"pointer");else{if(!o.nh.isSelectable(n))continue;ge(t,o.nh.create(i,s),"pointer")}return!0}}(t,n,i)}function ke(t){return Te(t)}ae.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=16==n.keyCode||n.shiftKey,!Ce(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!R||!O||13!=n.keyCode))if(t.domObserver.selectionChanged(t.domSelectionRange())?t.domObserver.flush():229!=n.keyCode&&t.domObserver.forceFlush(),!I||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)t.someProp("handleKeyDown",(e=>e(t,n)))||function(t,e){let n=e.keyCode,o=function(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);if(8==n||N&&72==n&&"c"==o)return Ut(t,-1)||Ft(t,-1);if(46==n&&!e.shiftKey||N&&68==n&&"c"==o)return Ut(t,1)||Ft(t,1);if(13==n||27==n)return!0;if(37==n||N&&66==n&&"c"==o){let e=37==n?"ltr"==Wt(t,t.state.selection.from)?-1:1:-1;return _t(t,e,o)||Ft(t,e)}if(39==n||N&&70==n&&"c"==o){let e=39==n?"ltr"==Wt(t,t.state.selection.from)?1:-1:1;return _t(t,e,o)||Ft(t,e)}return 38==n||N&&80==n&&"c"==o?Xt(t,-1,o)||Ft(t,-1):40==n||N&&78==n&&"c"==o?function(t){if(!A||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&1==e.nodeType&&0==n&&e.firstChild&&"false"==e.firstChild.contentEditable){let n=e.firstChild;Kt(t,n,"true"),setTimeout((()=>Kt(t,n,"false")),20)}return!1}(t)||Xt(t,1,o)||Ft(t,1):o==(N?"m":"c")&&(66==n||73==n||89==n||90==n)}(t,n)?n.preventDefault():de(t,"key");else{let e=Date.now();t.input.lastIOSEnter=e,t.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{t.input.lastIOSEnter==e&&(t.someProp("handleKeyDown",(e=>e(t,g(13,"Enter")))),t.input.lastIOSEnter=0)}),200)}},ae.keyup=(t,e)=>{16==e.keyCode&&(t.input.shiftKey=!1)},ae.keypress=(t,e)=>{let n=e;if(Ce(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||N&&n.metaKey)return;if(t.someProp("handleKeyPress",(e=>e(t,n))))return void n.preventDefault();let i=t.state.selection;if(!(i instanceof o.U3&&i.$from.sameParent(i.$to))){let e=String.fromCharCode(n.charCode);/[\r\n]/.test(e)||t.someProp("handleTextInput",(n=>n(t,i.$from.pos,i.$to.pos,e)))||t.dispatch(t.state.tr.insertText(e).scrollIntoView()),n.preventDefault()}};const ve=N?"metaKey":"ctrlKey";se.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=ke(t),i=Date.now(),r="singleClick";i-t.input.lastClick.time<500&&function(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}(n,t.input.lastClick)&&!n[ve]&&("singleClick"==t.input.lastClick.type?r="doubleClick":"doubleClick"==t.input.lastClick.type&&(r="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:r};let s=t.posAtCoords(fe(n));s&&("singleClick"==r?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new we(t,s,n,!!o)):("doubleClick"==r?be:ye)(t,s.pos,s.inside,n)?n.preventDefault():de(t,"pointer"))};class we{constructor(t,e,n,i){let r,s;if(this.view=t,this.pos=e,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!n[ve],this.allowDefault=n.shiftKey,e.inside>-1)r=t.state.doc.nodeAt(e.inside),s=e.inside;else{let n=t.state.doc.resolve(e.pos);r=n.parent,s=n.depth?n.before():0}const a=i?null:n.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l&&1==l.dom.nodeType?l.dom:null;let{selection:c}=t.state;(0==n.button&&r.type.spec.draggable&&!1!==r.type.spec.selectable||c instanceof o.nh&&c.from<=s&&c.to>s)&&(this.mightDrag={node:r,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!M||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()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),de(t,"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((()=>Ot(this.view))),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(fe(t))),this.updateAllowDefault(t),this.allowDefault||!e?de(this.view,"pointer"):function(t,e,n,i,r){return me(t,"handleClickOn",e,n,i)||t.someProp("handleClick",(n=>n(t,e,i)))||(r?function(t,e){if(-1==e)return!1;let n,i,r=t.state.selection;r instanceof o.nh&&(n=r.node);let s=t.state.doc.resolve(e);for(let t=s.depth+1;t>0;t--){let e=t>s.depth?s.nodeAfter:s.node(t);if(o.nh.isSelectable(e)){i=n&&r.$from.depth>0&&t>=r.$from.depth&&s.before(r.$from.depth+1)==r.$from.pos?s.before(r.$from.depth):s.before(t);break}}return null!=i&&(ge(t,o.nh.create(t.state.doc,i),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;let n=t.state.doc.resolve(e),i=n.nodeAfter;return!!(i&&i.isAtom&&o.nh.isSelectable(i))&&(ge(t,new o.nh(n),"pointer"),!0)}(t,n))}(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||A&&this.mightDrag&&!this.mightDrag.node.isAtom||O&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(ge(this.view,o.LN.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):de(this.view,"pointer")}move(t){this.updateAllowDefault(t),de(this.view,"pointer"),0==t.buttons&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}function Ce(t,e){return!!t.composing||!!(A&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500)&&(t.input.compositionEndedAt=-2e8,!0)}se.touchstart=t=>{t.input.lastTouch=Date.now(),ke(t),de(t,"pointer")},se.touchmove=t=>{t.input.lastTouch=Date.now(),de(t,"pointer")},se.contextmenu=t=>ke(t);const xe=R?5e3:-1;function Se(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout((()=>Te(t)),e))}function Me(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=function(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Te(t,e=!1){if(!(R&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Me(t),e||t.docView&&t.docView.dirty){let n=Mt(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):!t.markCursor&&!e||t.state.selection.empty?t.updateState(t.state):t.dispatch(t.state.tr.deleteSelection()),!0}return!1}}ae.compositionstart=ae.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof o.U3&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((t=>!1===t.type.spec.inclusive))))t.markCursor=t.state.storedMarks||n.marks(),Te(t,!0),t.markCursor=null;else if(Te(t,!e.selection.empty),M&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let e=t.domSelectionRange();for(let n=e.focusNode,o=e.focusOffset;n&&1==n.nodeType&&0!=o;){let e=o<0?n.lastChild:n.childNodes[o-1];if(!e)break;if(3==e.nodeType){let n=t.domSelection();n&&n.collapse(e,e.nodeValue.length);break}n=e,o=-1}}t.input.composing=!0}Se(t,xe)},ae.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then((()=>t.domObserver.flush())),t.input.compositionID++,Se(t,20))};const Oe=x&&S<15||I&&L<604;function Ee(t,e,n,o,r){let s=Yt(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",(e=>e(t,r,s||i.Ji.empty))))return!0;if(!s)return!1;let a=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(s),l=a?t.state.tr.replaceSelectionWith(a,o):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ae(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}se.copy=ae.cut=(t,e)=>{let n=e,o=t.state.selection,i="cut"==n.type;if(o.empty)return;let r=Oe?null:n.clipboardData,s=o.content(),{dom:a,text:l}=Jt(t,s);r?(n.preventDefault(),r.clearData(),r.setData("text/html",a.innerHTML),r.setData("text/plain",l)):function(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(i),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},ae.paste=(t,e)=>{let n=e;if(t.composing&&!R)return;let o=Oe?null:n.clipboardData,i=t.input.shiftKey&&45!=t.input.lastKeyCode;o&&Ee(t,Ae(o),o.getData("text/html"),i,n)?n.preventDefault():function(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let i=t.input.shiftKey&&45!=t.input.lastKeyCode;setTimeout((()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?Ee(t,o.value,null,i,e):Ee(t,o.textContent,o.innerHTML,i,e)}),50)}(t,n)};class Ie{constructor(t,e,n){this.slice=t,this.move=e,this.node=n}}const Ne=N?"altKey":"ctrlKey";se.dragstart=(t,e)=>{let n=e,i=t.input.mouseDown;if(i&&i.done(),!n.dataTransfer)return;let r,s=t.state.selection,a=s.empty?null:t.posAtCoords(fe(n));if(a&&a.pos>=s.from&&a.pos<=(s instanceof o.nh?s.to-1:s.to));else if(i&&i.mightDrag)r=o.nh.create(t.state.doc,i.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let e=t.docView.nearestDesc(n.target,!0);e&&e.node.type.spec.draggable&&e!=t.docView&&(r=o.nh.create(t.state.doc,e.posBefore))}let l=(r||t.state.selection).content(),{dom:c,text:d,slice:u}=Jt(t,l);(!n.dataTransfer.files.length||!O||E>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Oe?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Oe||n.dataTransfer.setData("text/plain",d),t.dragging=new Ie(u,!n[Ne],r)},se.dragend=t=>{let e=t.dragging;window.setTimeout((()=>{t.dragging==e&&(t.dragging=null)}),50)},ae.dragover=ae.dragenter=(t,e)=>e.preventDefault(),ae.drop=(t,e)=>{let n=e,s=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let a=t.posAtCoords(fe(n));if(!a)return;let l=t.state.doc.resolve(a.pos),c=s&&s.slice;c?t.someProp("transformPasted",(e=>{c=e(c,t)})):c=Yt(t,Ae(n.dataTransfer),Oe?null:n.dataTransfer.getData("text/html"),!1,l);let d=!(!s||n[Ne]);if(t.someProp("handleDrop",(e=>e(t,n,c||i.Ji.empty,d))))return void n.preventDefault();if(!c)return;n.preventDefault();let u=c?(0,r.Um)(t.state.doc,l.pos,c):l.pos;null==u&&(u=l.pos);let h=t.state.tr;if(d){let{node:t}=s;t?t.replace(h):h.deleteSelection()}let p=h.mapping.map(u),f=0==c.openStart&&0==c.openEnd&&1==c.content.childCount,m=h.doc;if(f?h.replaceRangeWith(p,p,c.content.firstChild):h.replaceRange(p,p,c),h.doc.eq(m))return;let g=h.doc.resolve(p);if(f&&o.nh.isSelectable(c.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(c.content.firstChild))h.setSelection(new o.nh(g));else{let e=h.mapping.map(u);h.mapping.maps[h.mapping.maps.length-1].forEach(((t,n,o,i)=>e=i)),h.setSelection($t(t,g,h.doc.resolve(e)))}t.focus(),t.dispatch(h.setMeta("uiEvent","drop"))},se.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Ot(t)}),20))},se.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},se.beforeinput=(t,e)=>{if(O&&R&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();let{domChangeCount:e}=t.input;setTimeout((()=>{if(t.input.domChangeCount!=e)return;if(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",(e=>e(t,g(8,"Backspace")))))return;let{$cursor:n}=t.state.selection;n&&n.pos>0&&t.dispatch(t.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let t in ae)se[t]=ae[t];function De(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Re{constructor(t,e){this.toDOM=t,this.spec=e||Be,this.side=this.spec.side||0}map(t,e,n,o){let{pos:i,deleted:r}=t.mapResult(e.from+o,this.side<0?-1:1);return r?null:new ze(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof Re&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&De(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class $e{constructor(t,e){this.attrs=t,this.spec=e||Be}map(t,e,n,o){let i=t.map(e.from+o,this.spec.inclusiveStart?-1:1)-n,r=t.map(e.to+o,this.spec.inclusiveEnd?1:-1)-n;return i>=r?null:new ze(i,r,this)}valid(t,e){return e.from=t&&(!i||i(s.spec))&&n.push(s.copy(s.from+o,s.to+o))}for(let r=0;rt){let s=this.children[r]+1;this.children[r+2].findInner(t-s,e-s,n,o+s,i)}}map(t,e,n){return this==He||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Be)}mapInner(t,e,n,o,i){let r;for(let s=0;s{let s=r-i-(n-t);for(let i=0;ir+e-o)continue;let l=a[i]+e-o;n>=l?a[i+1]=t<=l?-2:-1:t>=e&&s&&(a[i]+=s,a[i+1]+=s)}o+=s})),e=n.maps[t].map(e,-1)}let l=!1;for(let e=0;e=o.content.size){l=!0;continue}let u=n.map(t[e+1]+r,-1)-i,{index:h,offset:p}=o.content.findIndex(d),f=o.maybeChild(h);if(f&&p==d&&p+f.nodeSize==u){let o=a[e+2].mapInner(n,f,c+1,t[e]+r+1,s);o!=He?(a[e]=d,a[e+1]=u,a[e+2]=o):(a[e+1]=-2,l=!0)}else l=!0}if(l){let l=function(t,e,n,o,i,r,s){function a(t,e){for(let r=0;r{let s,a=r+n;if(s=Ge(e,t,a)){for(o||(o=this.children.slice());ir&&e.to=t){this.children[e]==t&&(n=this.children[e+2]);break}let i=t+1,r=i+e.content.size;for(let t=0;ti&&e.type instanceof $e){let t=Math.max(i,e.from)-i,n=Math.min(r,e.to)-i;tn.map(t,e,Be)));return je.from(n)}forChild(t,e){if(e.isLeaf)return _e.empty;let n=[];for(let o=0;ot instanceof _e))?t:t.reduce(((t,e)=>t.concat(e instanceof _e?e:e.members)),[]))}}forEachSet(t){for(let e=0;en&&e.to{let a=Ge(t,e,s+n);if(a){r=!0;let t=We(a,e,n+s+1,o);t!=He&&i.push(s,s+e.nodeSize,t)}}));let s=Fe(r?Ve(t):t,-n).sort(Xe);for(let t=0;t0;)e++;t.splice(e,0,n)}function Je(t){let e=[];return t.someProp("decorations",(n=>{let o=n(t.state);o&&o!=He&&e.push(o)})),t.cursorWrapper&&e.push(_e.create(t.state.doc,[t.cursorWrapper.deco])),je.from(e)}const Ye={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},qe=x&&S<=11;class Qe{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class Ze{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Qe,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((t=>{for(let e=0;e"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():this.flush()})),qe&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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,Ye)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;ethis.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(Lt(this.view)){if(this.suppressingSelectionUpdates)return Ot(this.view);if(x&&S<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&d(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e,n=new Set;for(let e=t.focusNode;e;e=a(e))n.add(e);for(let o=t.anchorNode;o;o=a(o))if(n.has(o)){e=o;break}let o=e&&this.view.docView.nearestDesc(e);return o&&o.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}selectionChanged(t){return!this.suppressingSelectionUpdates&&!this.currentSelection.eq(t)&&Lt(this.view)&&!this.ignoreSelectionChange(t)}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();e.length&&(this.queue=[]);let n=t.domSelectionRange(),i=this.selectionChanged(n),r=-1,s=-1,a=!1,l=[];if(t.editable)for(let t=0;t"BR"==t.nodeName));if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let o of e){let e=o.parentNode;!e||"LI"!=e.nodeName||n&&on(t,n)==e||o.remove()}}}let c=null;r<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)-1||i)&&(r>-1&&(t.docView.markDirty(r,s),function(t){if(!tn.has(t)&&(tn.set(t,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace))){if(t.requiresGeckoHackNode=M,en)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."),en=!0}}(t)),this.handleDOMChange(r,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(n)||Ot(t),this.currentSelection.set(n))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(let n=0;ne.content.size?null:$t(t,e.resolve(n.anchor),e.resolve(n.head))}function ln(t,e,n){let o=t.depth,i=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,i++,e=!1;if(n){let e=t.node(o).maybeChild(t.indexAfter(o));for(;e&&!e.isLeaf;)e=e.firstChild,i++}return i}function cn(t){if(2!=t.length)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class dn{constructor(t,e){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 ce,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(mn),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=pn(this),hn(this),this.nodeViews=fn(this),this.docView=ct(this.state.doc,un(this),Je(this),this.dom,this),this.domObserver=new Ze(this,((t,e,n,r)=>function(t,e,n,r,s){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let e=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,n=Mt(t,e);if(n&&!t.state.selection.eq(n)){if(O&&R&&13===t.input.lastKeyCode&&Date.now()-100e(t,g(13,"Enter")))))return;let o=t.state.tr.setSelection(n);"pointer"==e?o.setMeta("pointer",!0):"key"==e&&o.scrollIntoView(),a&&o.setMeta("composition",a),t.dispatch(o)}return}let l=t.state.doc.resolve(e),c=l.sharedDepth(n);e=l.before(c+1),n=t.state.doc.resolve(n).after(c+1);let d,u,h=t.state.selection,p=function(t,e,n){let o,{node:r,fromOffset:s,toOffset:a,from:l,to:c}=t.docView.parseRange(e,n),d=t.domSelectionRange(),u=d.anchorNode;if(u&&t.dom.contains(1==u.nodeType?u:u.parentNode)&&(o=[{node:u,offset:d.anchorOffset}],m(d)||o.push({node:d.focusNode,offset:d.focusOffset})),O&&8===t.input.lastKeyCode)for(let t=a;t>s;t--){let e=r.childNodes[t-1],n=e.pmViewDesc;if("BR"==e.nodeName&&!n){a=t;break}if(!n||n.size)break}let h=t.state.doc,p=t.someProp("domParser")||i.S4.fromSchema(t.state.schema),f=h.resolve(l),g=null,b=p.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:a,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:o,ruleFromNode:rn,context:f});if(o&&null!=o[0].pos){let t=o[0].pos,e=o[1]&&o[1].pos;null==e&&(e=t),g={anchor:t+l,head:e+l}}return{doc:b,sel:g,from:l,to:c}}(t,e,n),f=t.state.doc,b=f.slice(p.from,p.to);8===t.input.lastKeyCode&&Date.now()-100=s?r-o:0;r-=t,r&&r=a?r-o:0;r-=e,r&&rDate.now()-225||R)&&s.some((t=>1==t.nodeType&&!sn.test(t.nodeName)))&&(!y||y.endA>=y.endB)&&t.someProp("handleKeyDown",(e=>e(t,g(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(!y){if(!(r&&h instanceof o.U3&&!h.empty&&h.$head.sameParent(h.$anchor))||t.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){let e=an(t,t.state.doc,p.sel);if(e&&!e.eq(t.state.selection)){let n=t.state.tr.setSelection(e);a&&n.setMeta("composition",a),t.dispatch(n)}}return}y={start:h.from,endA:h.to,endB:h.to}}t.state.selection.fromt.state.selection.from&&y.start<=t.state.selection.from+2&&t.state.selection.from>=p.from?y.start=t.state.selection.from:y.endA=t.state.selection.to-2&&t.state.selection.to<=p.to&&(y.endB+=t.state.selection.to-y.endA,y.endA=t.state.selection.to)),x&&S<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>p.from&&"  "==p.doc.textBetween(y.start-p.from-1,y.start-p.from+1)&&(y.start--,y.endA--,y.endB--);let k,v=p.doc.resolveNoCache(y.start-p.from),w=p.doc.resolveNoCache(y.endB-p.from),C=f.resolve(y.start),M=v.sameParent(w)&&v.parent.inlineContent&&C.end()>=y.endA;if((I&&t.input.lastIOSEnter>Date.now()-225&&(!M||s.some((t=>"DIV"==t.nodeName||"P"==t.nodeName)))||!M&&v.pose(t,g(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(t.state.selection.anchor>y.start&&function(t,e,n,o,i){if(n-e<=i.pos-o.pos||ln(o,!0,!1)n||ln(s,!0,!1)e(t,g(8,"Backspace")))))return void(R&&O&&t.domObserver.suppressSelectionUpdates());O&&R&&y.endB==y.start&&(t.input.lastAndroidDelete=Date.now()),R&&!M&&v.start()!=w.start()&&0==w.parentOffset&&v.depth==w.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==y.endA&&(y.endB-=2,w=p.doc.resolveNoCache(y.endB-p.from),setTimeout((()=>{t.someProp("handleKeyDown",(function(e){return e(t,g(13,"Enter"))}))}),20));let T,E,A,N=y.start,D=y.endA;if(M)if(v.pos==w.pos)x&&S<=11&&0==v.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((()=>Ot(t)),20)),T=t.state.tr.delete(N,D),E=f.resolve(y.start).marksAcross(f.resolve(y.endA));else if(y.endA==y.endB&&(A=function(t,e){let n,o,r,s=t.firstChild.marks,a=e.firstChild.marks,l=s,c=a;for(let t=0;tt.mark(o.addToSet(t.marks));else{if(0!=l.length||1!=c.length)return null;o=c[0],n="remove",r=t=>t.mark(o.removeFromSet(t.marks))}let d=[];for(let t=0;tn(t,N,D,e))))return;T=t.state.tr.insertText(e,N,D)}if(T||(T=t.state.tr.replace(N,D,p.doc.slice(y.start-p.from,y.endB-p.from))),p.sel){let e=an(t,T.doc,p.sel);e&&!(O&&R&&t.composing&&e.empty&&(y.start!=y.endB||t.input.lastAndroidDelete{!pe(t,e)||he(t,e)||!t.editable&&e.type in ae||n(t,e)},le[e]?{passive:!0}:void 0)}A&&t.dom.addEventListener("input",(()=>null)),ue(t)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&ue(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(mn),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let t in this._props)e[t]=this._props[t];e.state=this.state;for(let n in t)e[n]=t[n];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var n;let o=this.state,i=!1,r=!1;t.storedMarks&&this.composing&&(Me(this),r=!0),this.state=t;let a=o.plugins!=t.plugins||this._props.plugins!=e.plugins;if(a||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let t=fn(this);(function(t,e){let n=0,o=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let t in e)o++;return n!=o})(t,this.nodeViews)&&(this.nodeViews=t,i=!0)}(a||e.handleDOMEvents!=this._props.handleDOMEvents)&&ue(this),this.editable=pn(this),hn(this);let l=Je(this),c=un(this),u=o.plugins==t.plugins||o.doc.eq(t.doc)?t.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",h=i||!this.docView.matchesNode(t.doc,c,l);!h&&t.selection.eq(o.selection)||(r=!0);let m="preserve"==u&&r&&null==this.dom.style.overflowAnchor&&function(t){let e,n,o=t.dom.getBoundingClientRect(),i=Math.max(0,o.top);for(let r=(o.left+o.right)/2,s=i+1;s=i-20){e=o,n=a.top;break}}return{refDOM:e,refTop:n,stack:H(t.dom)}}(this);if(r){this.domObserver.stop();let e=h&&(x||O)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&function(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}(o.selection,t.selection);if(h){let n=O?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=function(t,e){for(;;){if(3==t.nodeType&&e)return t;if(1==t.nodeType&&e>0){if("false"==t.contentEditable)return null;e=p(t=t.childNodes[e-1])}else{if(!t.parentNode||f(t))return null;e=s(t),t=t.parentNode}}}(e.focusNode,e.focusOffset),o=function(t,e){for(;;){if(3==t.nodeType&&et(this))));else if(this.state.selection instanceof o.nh){let e=this.docView.domAfterPos(this.state.selection.from);1==e.nodeType&&_(this,e.getBoundingClientRect(),t)}else _(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let e=0;e0&&this.state.doc.nodeAt(t))==n.node&&(i=t)}this.dragging=new Ie(t.slice,t.move,i<0?void 0:o.nh.create(this.state.doc,i))}someProp(t,e){let n,o=this._props&&this._props[t];if(null!=o&&(n=e?e(o):o))return n;for(let o=0;ot.ownerDocument.getSelection()),this._root=t;return t||document}updateRoot(){this._root=null}posAtCoords(t){return X(this,t)}coordsAtPos(t,e=1){return Y(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,n=-1){let o=this.docView.posFromDOM(t,e,n);if(null==o)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(t,e){return function(t,e,n){return et==e&&nt==n?ot:(et=e,nt=n,ot="up"==n||"down"==n?function(t,e,n){let o=e.selection,i="up"==n?o.$from:o.$to;return Z(t,e,(()=>{let{node:e}=t.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=t.docView.nearestDesc(e,!0);if(!n)break;if(n.node.isBlock){e=n.contentDOM||n.dom;break}e=n.dom.parentNode}let o=Y(t,i.pos,1);for(let t=e.firstChild;t;t=t.nextSibling){let e;if(1==t.nodeType)e=t.getClientRects();else{if(3!=t.nodeType)continue;e=c(t,0,t.nodeValue.length).getClientRects()}for(let t=0;ti.top+1&&("up"==n?o.top-i.top>2*(i.bottom-o.top):i.bottom-o.bottom>2*(o.bottom-i.top)))return!1}}return!0}))}(t,e,n):function(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let i=o.parentOffset,r=!i,s=i==o.parent.content.size,a=t.domSelection();return a?tt.test(o.parent.textContent)&&a.modify?Z(t,e,(()=>{let{focusNode:e,focusOffset:i,anchorNode:r,anchorOffset:s}=t.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:d,focusOffset:u}=t.domSelectionRange(),h=d&&!c.contains(1==d.nodeType?d:d.parentNode)||e==d&&i==u;try{a.collapse(r,s),e&&(e!=r||i!=s)&&a.extend&&a.extend(e,i)}catch(t){}return null!=l&&(a.caretBidiLevel=l),h})):"left"==n||"backward"==n?r:s:o.pos==o.start()||o.pos==o.end()}(t,e,n))}(this,e||this.state,t)}pasteHTML(t,e){return Ee(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return Ee(this,t,null,!0,e||new ClipboardEvent("paste"))}destroy(){this.docView&&(function(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Je(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,l=null)}get isDestroyed(){return null==this.docView}dispatchEvent(t){return function(t,e){he(t,e)||!se[e.type]||!t.editable&&e.type in ae||se[e.type](t,e)}(this,t)}dispatch(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){let t=this.domSelection();return t?A&&11===this.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){let n=e.getComposedRanges(t.root)[0];if(n)return nn(t,n)}let n;function o(t){t.preventDefault(),t.stopImmediatePropagation(),n=t.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?nn(t,n):null}(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function un(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(t.state)),n)for(let t in n)"class"==t?e.class+=" "+n[t]:"style"==t?e.style=(e.style?e.style+";":"")+n[t]:e[t]||"contenteditable"==t||"nodeName"==t||(e[t]=String(n[t]))})),e.translate||(e.translate="no"),[ze.node(0,t.state.doc.content.size,e)]}function hn(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ze.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function pn(t){return!t.someProp("editable",(e=>!1===e(t.state)))}function fn(t){let e=Object.create(null);function n(t){for(let n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function mn(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}}}]); \ No newline at end of file diff --git a/6474.fa109904ecbb38f0.js b/6474.fa109904ecbb38f0.js new file mode 100644 index 000000000..9367a0a69 --- /dev/null +++ b/6474.fa109904ecbb38f0.js @@ -0,0 +1 @@ +(self.webpackChunkeditor_demo=self.webpackChunkeditor_demo||[]).push([[6474],{6474:(t,e,n)=>{n.r(e),n.d(e,{AbstractTuiEditor:()=>y,AbstractTuiEditorResizable:()=>Jn,EDITOR_BLANK_COLOR:()=>i,INITIALIZATION_TIPTAP_CONTAINER:()=>F,LAZY_EDITOR_EXTENSIONS:()=>v,LAZY_TIPTAP_EDITOR:()=>j,TIPTAP_EDITOR:()=>H,TUI_ATTACH_FILES_LOADER:()=>E,TUI_ATTACH_FILES_OPTIONS:()=>O,TUI_DEFAULT_HTML5_MEDIA_ATTRIBUTES:()=>c,TUI_DEFAULT_LINK_OPTIONS:()=>m,TUI_EDITOR_CODE_OPTIONS:()=>$,TUI_EDITOR_COLOR_SELECTOR_MODE_NAMES:()=>I,TUI_EDITOR_DEFAULT_EDITOR_COLORS:()=>o,TUI_EDITOR_DEFAULT_EXTENSIONS:()=>Ks,TUI_EDITOR_DEFAULT_OPTIONS:()=>C,TUI_EDITOR_DEFAULT_TOOLS:()=>s,TUI_EDITOR_EXTENSIONS:()=>k,TUI_EDITOR_FONT_OPTIONS:()=>L,TUI_EDITOR_GROUP_DEFAULT_OPTIONS:()=>Js,TUI_EDITOR_LINK_HASH_PREFIX:()=>d,TUI_EDITOR_LINK_HTTPS_PREFIX:()=>h,TUI_EDITOR_LINK_HTTP_PREFIX:()=>u,TUI_EDITOR_LINK_OSI_PROTOCOL_DIVIDER:()=>f,TUI_EDITOR_LINK_SIMPLE_PROTOCOL_DIVIDER:()=>p,TUI_EDITOR_LINK_TEXTS:()=>R,TUI_EDITOR_OPTIONS:()=>x,TUI_EDITOR_PROVIDERS:()=>Tn,TUI_EDITOR_RESIZE_EVENT:()=>a,TUI_EDITOR_SANITIZER:()=>M,TUI_EDITOR_TABLE_COMMANDS:()=>D,TUI_EDITOR_TOOLBAR_TEXTS:()=>N,TUI_EDITOR_VALUE_TRANSFORMER:()=>T,TUI_IFRAME_EDITOR_OPTIONS:()=>Qs,TUI_IMAGE_EDITOR_OPTIONS:()=>oa,TUI_IMAGE_LOADER:()=>B,TableCellBackground:()=>Us,TuiAlignContent:()=>Gt,TuiAudio:()=>Ml,TuiBackgroundColor:()=>io,TuiCode:()=>Ut,TuiComponentRenderer:()=>Xn,TuiCustomEnter:()=>cr,TuiDetails:()=>Kt,TuiDetailsContent:()=>lo,TuiDetailsExtension:()=>ao,TuiDetailsRemove:()=>Yt,TuiEditLink:()=>xt,TuiEditor:()=>Vn,TuiEditorDropdownToolbar:()=>Nt,TuiEditorGroupTool:()=>ce,TuiEditorImagePreview:()=>q,TuiEditorMarkdownParser:()=>ml,TuiEditorPortal:()=>On,TuiEditorPortalHost:()=>En,TuiEditorPortalService:()=>Mn,TuiEditorResizable:()=>oo,TuiEditorSocket:()=>zt,TuiEditorTool:()=>r,TuiFileLink:()=>uo,TuiFilterAnchorsPipe:()=>ct,TuiFontColor:()=>ho,TuiFontSize:()=>te,TuiFontSizeExtension:()=>po,TuiFontStyle:()=>le,TuiHighlightColor:()=>pe,TuiHorizontalRule:()=>dr,TuiIframeEditor:()=>ta,TuiImageEditor:()=>ua,TuiImageOptionsPosition:()=>ia,TuiJumpAnchor:()=>go,TuiLink:()=>lr,TuiListConfigs:()=>be,TuiMarkdown:()=>xl,TuiMarkdownClipboard:()=>Ca,TuiMarkdownSerializer:()=>wl,TuiMarkdownSerializerState:()=>vl,TuiMarkdownTightLists:()=>Cl,TuiMention:()=>El,TuiNodeView:()=>Kn,TuiNodeViewNg:()=>Un,TuiShortUrlPipe:()=>dt,TuiSource:()=>Tl,TuiStarterKit:()=>Dr,TuiSummary:()=>co,TuiTabExtension:()=>mo,TuiTable:()=>Ws,TuiTableCell:()=>Xs,TuiTableCellColor:()=>ve,TuiTableCommands:()=>Re,TuiTableCreate:()=>Ee,TuiTableMergeCells:()=>Ae,TuiTableRowColumnManager:()=>$e,TuiTextColor:()=>ze,TuiTiptapEditor:()=>at,TuiTiptapEditorService:()=>st,TuiToolbar:()=>bn,TuiToolbarNavigationManager:()=>Be,TuiVideo:()=>Ol,TuiYoutube:()=>Rl,setup:()=>ba,tuiChildNodes:()=>Za,tuiCreateGroupExtension:()=>Ys,tuiCreateIframeEditorExtension:()=>ea,tuiCreateImageEditorExtension:()=>ga,tuiDefaultFontOptionsHandler:()=>l,tuiDeleteNode:()=>so,tuiEditLinkParseUrl:()=>pt,tuiEditorOptionsProvider:()=>S,tuiElementFromString:()=>ya,tuiEscapeHTML:()=>wa,tuiExtractElement:()=>ka,tuiGetMarkRange:()=>et,tuiGetMarkdownSpec:()=>fl,tuiGetNestedNodes:()=>Sl,tuiGetSelectedContent:()=>ro,tuiGetSelectionState:()=>yn,tuiIsEmptyParagraph:()=>rt,tuiIsListActive:()=>fo,tuiIsSafeLinkRange:()=>kn,tuiIsSelectionIn:()=>$l,tuiLegacyEditorConverter:()=>Bl,tuiMarkdownItTaskList:()=>sl,tuiParseNodeAttributes:()=>bo,tuiParseStyle:()=>Z,tuiShiftDelim:()=>kl,tuiToGradient:()=>Hl,tuiTrimInline:()=>yl,tuiUnwrapElement:()=>va});const o=new Map([["color-black-100","#909090"],["color-black-200","#666666"],["color-black-300","#333333"],["color-blue-100","#1771e6"],["color-blue-200","#1464cc"],["color-blue-300","#0953b3"],["color-gray-100","#f5f5f6"],["color-gray-200","#e7e8ea"],["color-gray-300","#cbcfd3"],["color-gray-400","#959ba4"],["color-gray-500","#79818c"],["color-gray-600","#616871"],["color-green-100","#39b54a"],["color-green-200","#2ca53a"],["color-green-300","#168a21"],["color-light-blue-100","#ecf1f7"],["color-light-blue-200","#e4ebf3"],["color-light-blue-300","#dde4ed"],["color-red-100","#e01f19"],["color-red-200","#d3120e"],["color-red-300","#c40b08"],["color-yellow-100","#FFDD2C"],["color-yellow-200","#FCC521"],["color-yellow-300","#FAB618"],["transparent","transparent"]]),i="rgb(51, 51, 51)",r={Align:"justify",Anchor:"anchor",Attach:"attach",Bold:"bold",Clear:"clear",Code:"code",Color:"foreColor",Details:"details",Group:"group",HR:"insertHorizontalRule",Hilite:"hiliteColor",Img:"image",Italic:"italic",Link:"link",List:"list",MergeCells:"mergeCells",Quote:"quote",RowsColumnsManaging:"rowsColumnsManaging",Size:"fontSize",SplitCells:"splitCells",Strikethrough:"strikeThrough",Sub:"subscript",Sup:"superscript",Table:"insertTable",CellColor:"cellColor",Tex:"tex",Underline:"underline",Undo:"undo"},s=new Set([r.Align,r.Anchor,r.Bold,r.CellColor,r.Clear,r.Code,r.Color,r.Details,r.Hilite,r.HR,r.Img,r.Italic,r.Link,r.List,r.Quote,r.Size,r.Strikethrough,r.Sub,r.Sup,r.Table,r.Underline,r.Undo]),a="tui_editor_resize";function l(t){return[{px:13,name:t.small},{px:15,name:t.normal},{px:17,name:t.large},{px:24,family:"var(--tui-font-heading)",name:t.subtitle,headingLevel:2,weight:"bold"},{px:30,family:"var(--tui-font-heading)",name:t.title,headingLevel:1,weight:"bold"}]}const c=["id","class","src","style","controls","loop","muted","preload","autoplay","width","height","controlsList"],d="#",u="http://",h="https://",p=":",f="://",m={protocol:h};var g=n(6104),b=n(2978);let y=(()=>{var t;class e{constructor(){this.stateChange$=new g.B,this.valueChange$=new g.B}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵdir=b.FsC({type:t}),e})();const k=new b.nKC("[TUI_EDITOR_EXTENSIONS]"),v=new b.nKC("[LAZY_EDITOR_EXTENSIONS]");var w=n(4314);const C={translate:"no",spellcheck:!1,exampleText:"",enableDefaultStyles:!0,tools:s,colors:o,blankColor:i,linkOptions:m,fontOptions:l,floatingToolbar:!1,icons:{undo:"@tui.undo",redo:"@tui.redo",quote:"@tui.quote",link:"@tui.link",anchor:"@tui.anchor",attach:"@tui.paperclip",sub:"@tui.subscript",sup:"@tui.superscript",tex:"@tui.whole-word",image:"@tui.image",hr:"@tui.minus",clear:"@tui.remove-formatting",groupAdd:"@tui.plus",groupRemove:"@tui.circle-minus",detailsAdd:"@tui.copy-plus",detailsRemove:"@tui.square-minus",popupLinkSave:"@tui.save",popupLinkRemove:"@tui.x",popupPreviewLinkEdit:"@tui.pencil",popupPreviewLinkClear:"@tui.x",paint:"@tui.paint-bucket",hash:"@tui.hash",externalLink:"@tui.external-link",textAlignPreview:"@tui.align-left",textAlignLeft:"@tui.align-left",textAlignCenter:"@tui.align-center",textAlignRight:"@tui.align-right",textAlignJustify:"@tui.align-justify",textColor:"@tui.baseline",textHilite:"@tui.paint-roller",listPreview:"@tui.list",listUnOrdered:"@tui.list",listOrdered:"@tui.list-ordered",taskList:"@tui.check-check",indent:"@tui.indent-increase",outdent:"@tui.indent-decrease",fontSize:"@tui.a-large-small",insertTable:"@tui.table",tableCellMerge:"@tui.table-cells-merge",tableCellSplit:"@tui.table-rows-split",addRowTable:"@tui.between-horizontal-start",code:"@tui.code",fontStylePreview:"@tui.type-outline",fontStyleBold:"@tui.bold",fontStyleItalic:"@tui.italic",fontStyleUnderline:"@tui.underline",fontStyleStrike:"@tui.strikethrough",colorSelectorDropdownChevron:"@tui.chevron-down",colorSelectorDropdownCheck:"@tui.check",imageExtension:{settings:"@tui.settings",alignJustify:"@tui.align-justify",alignCenter:"@tui.align-center",alignLeft:"@tui.align-left",alignRight:"@tui.align-right"}}},x=(0,w.gc)(C);function S(t){return(0,w.eC)(x,t,C)}const M=(0,w.ET)((()=>null)),T=new b.nKC("[TUI_EDITOR_VALUE_TRANSFORMER]"),O=new b.nKC("[TUI_ATTACH_FILES_OPTIONS]",{factory:()=>({accept:"*/*",multiple:!0})}),E=new b.nKC("[TUI_ATTACH_FILES_LOADER]");var A=n(5478);const I=new b.nKC("[TUI_EDITOR_COLOR_SELECTOR_MODE_NAMES]",{factory:()=>["Solid color","Gradient"]}),N=new b.nKC("[TUI_EDITOR_TOOLBAR_TEXTS]",{factory:(0,A.Y6)("toolbarTools")}),D=new b.nKC("[TUI_EDITOR_TABLE_COMMANDS]",{factory:(0,A.Y6)("editorTableCommands")}),R=new b.nKC("[TUI_EDITOR_LINK_TEXTS]",{factory:(0,A.Y6)("editorEditLink")}),$=new b.nKC("[TUI_EDITOR_CODE_OPTIONS]",{factory:(0,A.Y6)("editorCodeOptions")}),L=new b.nKC("[TUI_EDITOR_FONT_OPTIONS]",{factory:(0,A.Y6)("editorFontOptions")});var z=n(8481),P=n(3527);const B=new b.nKC("[TUI_IMAGE_LOADER]",{factory:()=>t=>{const e=new FileReader;return e.readAsDataURL(t),(0,z.xM)(e,"load").pipe((0,P.T)((()=>String(e.result))))}});var _=n(9090);const H=new b.nKC("[TIPTAP_EDITOR]"),j=new b.nKC("[LAZY_TIPTAP_EDITOR]",{factory:()=>{const t=new _.m(1);return Promise.resolve().then(n.bind(n,6426)).then((({Editor:e})=>t.next(e))).catch((()=>t.complete())),t}}),F=new b.nKC("[INITIALIZATION_TIPTAP_CONTAINER]");var G=n(6610),V=n(7222),W=n(3241),X=n(4822),U=n(715),K=n(4135),J=n(7355),Y=n(599);let q=(()=>{var t;class e{constructor(){this.imagePreview=new b.bkB}click(t){t instanceof HTMLImageElement&&this.imagePreview.emit(t)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵdir=b.FsC({type:t,selectors:[["tui-editor-socket","imagePreview",""]],hostAttrs:[1,"_preview-image"],hostBindings:function(t,e){1&t&&b.bIt("click",(function(t){return e.click(t.target)}))},outputs:{imagePreview:"imagePreview"},standalone:!0}),e})();var Q=n(7212);function Z(t){return t.split(";").reduce(((t,e)=>{const[n,o]=e.split(":")??[];return n&&o&&(t[n.trim()]=o.trim()),t}),{})}function tt(t,e,n={}){return t.find((({attrs:t,type:o})=>o===e&&function(t,e){const n=Object.keys(e);return!n.length||!!n.filter((n=>e[n]===t[n])).length}(t,n)))||null}function et(t,e,n={}){if(!t||!e)return null;const{node:o,offset:i}=t.parent.childAfter(t.parentOffset);if(!o)return null;const r=tt(o.marks,e,n);if(!r)return null;let s=t.index(),a=t.start()+i,l=s+1,c=a+o.nodeSize;for(tt(o.marks,e,n);s>0&&r.isInSet(t.parent.child(s-1).marks);)s-=1,a-=t.parent.child(s).nodeSize;for(;l{var t;class e extends y{constructor(){super(),this.editorRef=(0,b.WQX)(H),this.editorRef.subscribe((t=>{if(!t)return;this.editor=t;const e=()=>{const e=t.getHTML(),n=rt(t.getJSON().content)?"":e;this.valueChange$.next(n),this.stateChange$.next()};t.on("transaction",e.bind(this)),t.on("update",e.bind(this))}))}get isFocused(){return this.editor?.isFocused??!1}get html(){return this.editor?.getHTML()??""}get editable(){return this.editor?.isEditable??!1}set editable(t){this.editor?.setEditable(t,!1)}get state(){return this.editor?.state??null}getOriginTiptapEditor(){return this.editor??null}undoDisabled(){return!this.editor?.can().undo()}redoDisabled(){return!this.editor?.can().redo()}getFontColor(){return this.editor?.getAttributes("textStyle").fontColor||i}getFontSize(){return parseInt(this.editor?.getAttributes("textStyle").fontSize,10)}setFontSize(t){this.editor?.chain().setMark("textStyle",{fontSize:(0,w.Pp)(t)}).run()}getBackgroundColor(){return this.editor?.getAttributes("textStyle").backgroundColor||"transparent"}getCellColor(){return this.editor?.getAttributes("tableCell").background||this.editor?.getAttributes("tableHeader").background||""}getGroupColor(){if(this.editor?.isActive("group")){const t=Z(this.editor.getAttributes("group")?.style??"");return t["background-color"]??t.background??""}return""}onAlign(t){this.editor?.chain().focus().setTextAlign(t).run()}setImage(t){this.editor?.chain().focus().command((({commands:e,state:n})=>{const o=e.setEditableImage??e.setImage;if(o){const i=n.selection.anchor;return o({src:t}),e.setTextSelection(i),!0}return!1})).run()}undo(){this.editor?.chain().undo().run()}redo(){this.editor?.chain().redo().run()}setHorizontalRule(){this.editor?.chain().focus().setHorizontalRule().run()}removeFormat(){this.editor?.commands.unsetAllMarks(),this.editor?.commands.clearNodes()}setFontColor(t){this.editor?.chain().focus().setFontColor(t).run()}setBackgroundColor(t){this.editor?.chain().focus().setBackgroundColor(t).run()}toggleUnderline(){this.editor?.chain().focus().toggleUnderline().run()}toggleStrike(){this.editor?.chain().focus().toggleStrike().run()}toggleOrderedList(){this.editor?.chain().focus().toggleOrderedList().run()}toggleUnorderedList(){this.editor?.chain().focus().toggleBulletList().run()}togglePre(){this.editor?.chain().focus().toggleCodeBlock().run()}toggleTaskList(){this.editor?.commands.toggleTaskList()}sinkListItem(){const t=this.editor?.isActive("taskList")?"taskItem":"listItem";this.editor?.chain().focus().sinkListItem(t).run()}liftListItem(){const t=this.editor?.isActive("taskList")?"taskItem":"listItem";this.editor?.chain().focus().liftListItem(t).run()}isActive(t){return this.editor?.isActive(t)??!1}isActive$(t){return this.stateChange$.pipe((0,ot.Z)(null),(0,P.T)((()=>this.isActive(t))),(0,it.F)())}toggleBold(){this.editor?.chain().focus().toggleBold().run()}toggleCode(){this.editor?.chain().focus().toggleCode().run()}toggleItalic(){this.editor?.chain().focus().toggleItalic().run()}toggleBlockquote(){this.editor?.chain().focus().toggleBlockquote().run()}toggleSubscript(){this.editor?.chain().focus().toggleSubscript().run()}toggleSuperscript(){this.editor?.chain().focus().toggleSuperscript().run()}toggleCodeBlock(){this.editor?.chain().focus().toggleCodeBlock().run()}insertTable(t,e){this.editor?.chain().focus().insertTable({cols:t,rows:e}).run()}addColumnAfter(){this.editor?.chain().focus().addColumnAfter().run()}addColumnBefore(){this.editor?.chain().focus().addColumnBefore().run()}addRowAfter(){this.editor?.chain().focus().addRowAfter().run()}addRowBefore(){this.editor?.chain().focus().addRowBefore().run()}deleteColumn(){this.editor?.chain().focus().deleteColumn().run()}deleteRow(){this.editor?.chain().focus().deleteRow().run()}mergeCells(){this.editor?.chain().focus().mergeCells().run()}splitCell(){this.editor?.chain().focus().splitCell().run()}canMergeCells(){return this.editor?.can().mergeCells()??!1}canSplitCells(){return this.editor?.can().splitCell()??!1}setHeading(t){this.editor?.chain().focus().setHeading({level:t}).run()}setParagraph(t){this.editor?.chain().focus().setParagraph().run(),t&&this.editor?.chain().setMark("textStyle",t).run()}setHardBreak(){this.editor?.chain().setHardBreak().run()}setTextSelection(t){this.editor?.commands.setTextSelection(t)}toggleLink(t){this.editor?.chain().focus().toggleLink({href:t}).run()}setLink(t){this.editor?.chain().focus().setLink({href:t}).run()}unsetLink(){this.editor?.chain().focus().unsetLink().run()}focus(){this.editor?.chain().focus().run()}setValue(t){t===this.html||""===t&&"

"===this.html||(this.editor?.commands.setContent(t),this.editor?.view.updateState(nt.$t.create({schema:this.editor.state.schema,doc:this.editor.state.doc,selection:this.editor.state.selection,storedMarks:this.editor.state.storedMarks,plugins:this.editor.state.plugins})))}destroy(){this.editor?.destroy()}setCellColor(t){this.editor?.chain().focus().setCellBackground(t).run()}selectClosest(){const t=this.editor?.state.selection.anchor,e=et(this.editor?.state.doc.resolve(t??0),this.editor?.schema.marks.link);e&&this.editor?.chain().setTextSelection(e).run()}enter(){this.editor?.commands.enter()}setDetails(){this.editor?.commands.setDetails()}removeDetails(){this.editor?.commands.removeDetails()}setGroup(){this.editor?.commands.setGroup()}removeGroup(){this.editor?.commands.removeGroup()}setGroupHilite(t){this.editor?.commands.setGroupHilite(t)}setAnchor(t){this.editor?.commands.setAnchor(t.replace("#",""))}removeAnchor(){this.editor?.commands.removeAnchor()}setFileLink(t){this.editor?.commands.setFileLink(t)}setYoutubeVideo(t){this.editor?.commands.setYoutubeVideo(t)}setIframe(t){this.editor?.commands.setIframe(t)}removeEmptyTextStyle(){this.editor?.commands.removeEmptyTextStyle()}toggleMark(t,e,n){this.editor?.commands.toggleMark(t,e,n)}getHTML(){return this.getOriginTiptapEditor()?.getHTML()??""}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵprov=b.jDH({token:t,factory:t.ɵfac}),e})(),at=(()=>{var t;class e{constructor(){this.el=(0,b.WQX)(b.aKT),this.renderer=(0,b.WQX)(b.sFG),this.editor=(0,b.WQX)(st),this.editorContainer=(0,b.WQX)(F),this.valueChange=this.editor.valueChange$,this.stateChange=this.editor.stateChange$,(0,b.WQX)(H).pipe((0,Q.pQ)()).subscribe((()=>this.renderer.appendChild(this.el.nativeElement,this.editorContainer)))}set value(t){this.editor.setValue(t)}set editable(t){this.editor.editable=t}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵdir=b.FsC({type:t,selectors:[["","tuiTiptapEditor",""]],inputs:{value:"value",editable:"editable"},outputs:{valueChange:"valueChange",stateChange:"stateChange"},standalone:!0}),e})();var lt=n(5993);let ct=(()=>{var t;class e{transform(t,e,n){return"#"===e?t.filter((t=>t!==n)):t}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵpipe=b.EJ8({name:"tuiFilterAnchors",type:t,pure:!0,standalone:!0}),e})(),dt=(()=>{var t;class e{transform(t){return t.length<60?t:`${t.slice(0,Math.max(0,40))}...${t.slice(t.length-10)}`}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵpipe=b.EJ8({name:"tuiShortUrl",type:t,pure:!0,standalone:!0}),e})();function ut(t=""){const e=t.indexOf(f)??-1,[n,o]=e>-1?[t.slice(0,e+f.length),t.slice(e+f.length,t.length)]:["",t],i=[n,o].filter(Boolean);return o?.includes("://")&&i.length>1?ut(o):i}function ht(t=""){const[e,n]=t.split(/:/).slice(-2).filter(Boolean);return t.includes("/")&&t.lastIndexOf(":")>t.indexOf("/")||t.includes("?")&&t.lastIndexOf(":")>t.indexOf("?")||!e||!n||(0,w.U_)(t)?[]:[`${e}:`,n]}function pt(t=""){if(t.startsWith(d))return{prefix:d,path:t.slice(1)};const[e="",n=""]=t.includes(f)?ut(t):ht(t);if(n.includes(p)){const[t,e]=ht(n);if(t&&e)return{prefix:t,path:e}}return t.startsWith("/")&&!t.startsWith("//")?{prefix:t.slice(0,1),path:t.slice(1)}:t.startsWith("./")?{prefix:t.slice(0,2),path:t.slice(2)}:{prefix:e,path:""===e?t:n}}function ft(t,e){1&t&&(b.qex(0),b.EFF(1,"Edit anchor"),b.bVm())}function mt(t,e){1&t&&(b.j41(0,"span"),b.EFF(1,"Link to anchor"),b.k0s())}function gt(t,e){1&t&&(b.j41(0,"span"),b.EFF(1,"URL"),b.k0s())}function bt(t,e){if(1&t&&(b.DNE(0,mt,2,0,"span",1),b.DNE(1,gt,2,0,"ng-template",null,12,b.C5r)),2&t){const t=b.sdS(2),e=b.XpG(2);b.Y8G("ngIf",e.prefixIsHashMode)("ngIfElse",t)}}function yt(t,e){if(1&t&&(b.qex(0),b.EFF(1),b.bVm()),2&t){const t=e.ngIf,n=b.XpG(2);b.R7$(1),b.SpI(" ",n.prefixIsHashMode?t.anchorExample:t.urlExample," ")}}function kt(t,e){if(1&t){const t=b.RV6();b.qex(0),b.j41(1,"label",4)(2,"div",5),b.DNE(3,ft,2,0,"ng-container",1),b.DNE(4,bt,3,2,"ng-template",null,6,b.C5r),b.k0s(),b.j41(6,"div",7)(7,"div",8),b.EFF(8),b.k0s(),b.j41(9,"tui-input-inline",9),b.bIt("input",(function(e){b.eBV(t);const n=b.XpG();let o;return b.Njj(n.onChange(null==(o=e.target)?null:o.value))}))("keydown.backspace",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onBackspace())}))("keydown.prevent.enter",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onSave())})),b.DNE(10,yt,2,1,"ng-container",3),b.nI1(11,"async"),b.j41(12,"input",10),b.bIt("ngModelChange",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(n.url=e)})),b.k0s()()()(),b.j41(13,"button",11),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onClear())})),b.k0s(),b.j41(14,"button",11),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onSave())})),b.k0s(),b.bVm()}if(2&t){const t=b.sdS(5),e=b.XpG();b.R7$(3),b.Y8G("ngIf",e.anchorMode)("ngIfElse",t),b.R7$(5),b.JRh(e.prefix),b.R7$(1),b.AVh("t-input_filled",e.hasUrl),b.R7$(1),b.Y8G("ngIf",b.bMT(11,9,e.texts$)),b.R7$(2),b.Y8G("ngModel",e.url),b.R7$(1),b.Y8G("iconStart",e.options.icons.popupLinkRemove),b.R7$(1),b.Y8G("iconStart",e.options.icons.popupLinkSave)}}function vt(t,e){if(1&t){const t=b.RV6();b.j41(0,"a",13),b.EFF(1),b.nI1(2,"tuiShortUrl"),b.k0s(),b.j41(3,"button",14),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onEdit())})),b.k0s(),b.j41(4,"button",15),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onRemove())})),b.k0s()}if(2&t){const t=b.XpG();b.Y8G("href",t.href,b.B4B)("iconStart",t.prefixIsHashMode?t.options.icons.hash:t.options.icons.externalLink),b.R7$(1),b.SpI(" ",b.bMT(2,5,t.url)," "),b.R7$(2),b.Y8G("iconStart",t.options.icons.popupPreviewLinkEdit),b.R7$(1),b.Y8G("iconStart",t.options.icons.popupPreviewLinkClear)}}function wt(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",19),b.bIt("click",(function(){const e=b.eBV(t).$implicit,n=b.XpG(2);return b.Njj(n.setAnchor(e))})),b.EFF(1),b.k0s()}if(2&t){const t=e.$implicit;b.R7$(1),b.SpI(" #",t," ")}}function Ct(t,e){if(1&t&&(b.qex(0),b.nrm(1,"hr",16),b.j41(2,"tui-scrollbar")(3,"div",17),b.DNE(4,wt,2,1,"button",18),b.nI1(5,"tuiFilterAnchors"),b.k0s()(),b.bVm()),2&t){const t=b.XpG();b.R7$(4),b.Y8G("ngForOf",b.brH(5,1,t.anchorIds,t.prefix,t.url))}}let xt=(()=>{var t;class e{constructor(){this.doc=(0,b.WQX)(W.Qc)?.document??null,this.isOnlyAnchorMode=this.detectAnchorMode(),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.options=(0,b.WQX)(x),this.url=this.getHrefOrAnchorId(),this.edit=!this.url,this.prefix=this.makeDefaultPrefix(),this.anchorIds=this.getAllAnchorsIds(),this.texts$=(0,b.WQX)(R),this.inputEditor=null,this.addLink=new b.bkB,this.removeLink=new b.bkB}set anchorMode(t){this.isOnlyAnchorMode=t,this.prefix=t?d:this.makeDefaultPrefix()}get anchorMode(){return this.isOnlyAnchorMode}get editor(){return this.injectionEditor??this.inputEditor}get defaultProtocol(){return this.options.linkOptions?.protocol??h}get prefixIsHashMode(){return this.prefix===d}get hasUrl(){return!!this.url}get href(){return`${this.prefix}${this.url}`}get showAnchorsList(){return!this.anchorMode&&this.edit&&this.anchorIds.length>0}onSelectionChange(){this.isViewMode&&(this.url=this.getHrefOrAnchorId(),this.anchorMode=this.detectAnchorMode())}onMouseDown(t){(0,X.ru)(t.target)&&!t.target.matches("a, button, input")&&t.preventDefault()}setAnchor(t){this.url=t,this.changePrefix(!0)}changePrefix(t){this.prefix=t?d:this.defaultProtocol}onSave(){this.url?this.addLink.emit(this.href):this.removeLink.emit()}onBackspace(){this.url||(this.prefix=this.isOnlyAnchorMode?d:this.defaultProtocol)}onEdit(){this.edit=!0}onRemove(){this.removeLink.emit()}onChange(t){this.url=this.removePrefix(t)}onClear(){this.url=""}get isViewMode(){return!this.edit}makeDefaultPrefix(){const t=this.getAnchorElement(),e=pt(t?.getAttribute("href")??"").prefix||this.defaultProtocol;return t&&(!t.getAttribute("href")&&t.getAttribute("id")||t.getAttribute("href")?.startsWith(d))?d:e}detectAnchorMode(){const t=this.getAnchorElement();return!t?.href&&!!t?.getAttribute("id")}getFocusedParentElement(){return this.doc?.getSelection?.()?.focusNode?.parentElement||null}getAnchorElement(){const t=this.getFocusedParentElement();return t?.closest("a")??t?.querySelector("img")?.closest("a")??null}getHrefOrAnchorId(){const t=this.getAnchorElement();return t?this.removePrefix(t.getAttribute("href")??t.getAttribute("id")??""):this.url}removePrefix(t){const e=t.startsWith(d)||this.prefix===d||t.startsWith("/")||t.startsWith("./")||t.startsWith("http")||t.startsWith("://")?t:`${this.prefix??""}${t}`,{prefix:n,path:o}=pt(e),i=this.isOnlyAnchorMode||n===d||""===n&&this.prefix===d;return this.prefix=i?d:""===n?this.defaultProtocol:n,o}getAllAnchorsIds(){const t=Array.from(this.editor?.getOriginTiptapEditor()?.view.dom.querySelectorAll('[data-type="jump-anchor"]')??[]);return Array.from(t).map((t=>t.getAttribute("id")??"")).filter(Boolean)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-edit-link"]],hostBindings:function(t,e){1&t&&b.bIt("selectionchange",(function(){return e.onSelectionChange()}),!1,b.EBC)("mousedown",(function(t){return e.onMouseDown(t)}))},inputs:{inputEditor:["editor","inputEditor"],anchorMode:"anchorMode"},outputs:{addLink:"addLink",removeLink:"removeLink"},standalone:!0,features:[b.aNF],decls:5,vars:3,consts:[[1,"t-edit-link"],[4,"ngIf","ngIfElse"],["view",""],[4,"ngIf"],[1,"t-label"],[1,"t-label-properties"],["fullOptions",""],[1,"t-url"],[1,"t-prefix"],["tuiAutoFocus","",1,"t-input",3,"input","keydown.backspace","keydown.prevent.enter"],[3,"ngModel","ngModelChange"],["appearance","icon","size","s","title","Insert link","tuiIconButton","","type","button",1,"t-button",3,"iconStart","click"],["urlTitle",""],["target","_blank","tuiLink","",1,"t-link",3,"href","iconStart"],["appearance","icon","size","s","title","Change link","tuiIconButton","","type","button",1,"t-button","t-edit-button",3,"iconStart","click"],["appearance","icon","automation-id","toolbar__popup-link-clear-button","size","s","title","Remove link","tuiIconButton","","type","button",1,"t-button",3,"iconStart","click"],[1,"t-hr"],[1,"t-anchor-list"],["type","button","class","t-anchor",3,"click",4,"ngFor","ngForOf"],["type","button",1,"t-anchor",3,"click"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0),b.DNE(1,kt,15,11,"ng-container",1),b.DNE(2,vt,5,7,"ng-template",null,2,b.C5r),b.k0s(),b.DNE(4,Ct,6,5,"ng-container",3)),2&t){const t=b.sdS(3);b.R7$(1),b.Y8G("ngIf",e.edit)("ngIfElse",t),b.R7$(3),b.Y8G("ngIf",e.showAnchorsList)}},dependencies:[G.Jj,V.YN,V.me,V.BC,V.vS,G.Sq,G.bT,U.s8,K.p,ct,lt.A,J.Jc,Y.N0,dt],styles:["[_nghost-%COMP%]{display:block;min-inline-size:18.75rem}.t-edit-link[_ngcontent-%COMP%]{display:flex;min-block-size:4rem;align-items:center;padding-right:.75rem}.t-label[_ngcontent-%COMP%]{font:var(--tui-font-text-s);block-size:var(--tui-height-l);box-sizing:border-box;padding:.4375rem 1rem;min-inline-size:12.5rem;max-inline-size:25rem;inline-size:100%}.t-label-properties[_ngcontent-%COMP%]{display:flex;align-items:center;max-inline-size:8.375rem;justify-content:space-between}.t-property_inactive[_ngcontent-%COMP%]{opacity:.5}.t-url[_ngcontent-%COMP%]{display:flex;font:var(--tui-font-text-m);color:var(--tui-text-secondary)}.t-input[_ngcontent-%COMP%]{flex:1}.t-input_filled[_ngcontent-%COMP%]{color:var(--tui-text-primary)}.t-button[_ngcontent-%COMP%]{inline-size:2rem;block-size:2rem;margin:0 .25rem;transition:background .2s}.t-edit-button[_ngcontent-%COMP%]{margin-left:auto}.t-link[_ngcontent-%COMP%]{margin:0 1rem;text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.t-cleaner[_ngcontent-%COMP%]{transition-property:color;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;color:var(--tui-text-secondary);cursor:pointer;margin-left:auto}.t-cleaner[_ngcontent-%COMP%]:hover{color:var(--tui-background-accent-opposite-pressed)}.t-cleaner_hidden[_ngcontent-%COMP%]{visibility:hidden}.t-anchor-list[_ngcontent-%COMP%]{display:flex;max-block-size:12.5rem;flex-direction:column}.t-anchor[_ngcontent-%COMP%]{-webkit-appearance:none;appearance:none;border:0;background:none;font-size:inherit;line-height:inherit;text-decoration:none;min-block-size:2.75rem;padding:.375rem .5rem;margin:.125rem .5rem;border-radius:var(--tui-radius-m);text-align:start}.t-anchor[_ngcontent-%COMP%]:hover{background:var(--tui-background-base-alt);cursor:pointer}"],changeDetection:0}),e})();var St=n(811),Mt=n(9141),Tt=n(4514),Ot=n(656),Et=n(4914),At=n(5981),It=n(199);let Nt=(()=>{var t;class e extends Tt.Xu{constructor(){super((t=>this.stream$.subscribe(t))),this.previousTagPosition=null,this.range=(0,b.WQX)(St.lN),this.doc=(0,b.WQX)(W.Qc)?.document??null,this.selection$=(0,b.WQX)(Ot.xA),this.el=(0,b.WQX)(b.aKT),this.vcr=(0,b.WQX)(b.c1b),this.handler$=new At.t(Mt.z9),this.stream$=(0,It.z)([this.handler$,this.selection$.pipe((0,P.T)((()=>this.getRange())),(0,it.F)(((t,e)=>t.startOffset===e.startOffset&&t.endOffset===e.endOffset)))]).pipe((0,P.T)((([t,e])=>{const n=this.el.nativeElement.contains(e.commonAncestorContainer)||e.commonAncestorContainer.parentElement?.closest("tui-dropdown");return this.range=n&&(0,X.ww)(e.commonAncestorContainer)||"P"===e.commonAncestorContainer?.nodeName?e:this.range,n&&t(this.range)}))),this.position="selection",this.type="dropdown"}set tuiToolbarDropdown(t){(0,w.YB)(t)||this.handler$.next(t)}getClientRect(){switch(this.position){case"tag":{const{commonAncestorContainer:t}=this.range,e=(0,X.ru)(t)?t:t.parentNode;return e?.parentElement?.closest("tui-dropdown")?this.previousTagPosition??Mt.Lo:(this.previousTagPosition=e&&(0,X.ru)(e)?this.doc?.querySelector(".ProseMirror-selectednode")?.getBoundingClientRect()||e.getBoundingClientRect():Mt.Lo,this.previousTagPosition)}case"word":return(0,Et.kJ)(this.range).getBoundingClientRect();default:{const t=this.range.getBoundingClientRect();return 0===t.x&&0===t.y&&0===t.width&&0===t.height?(this.el.nativeElement.querySelector("p")??this.el.nativeElement).getBoundingClientRect():t}}}ngOnDestroy(){this.ghost&&this.vcr.element.nativeElement.removeChild(this.ghost)}getRange(){const t=this.doc?.getSelection();return(t?.rangeCount&&t.getRangeAt(0)||this.range)?.cloneRange()}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵdir=b.FsC({type:t,selectors:[["","tuiToolbarDropdown",""]],inputs:{position:["tuiToolbarDropdownPosition","position"],tuiToolbarDropdown:"tuiToolbarDropdown"},standalone:!0,features:[b.Jv_([(0,Tt.Np)(t),(0,Tt.yq)(t)]),b.Vt3]}),e})();var Dt=n(4926),Rt=n(8395),$t=n(5950),Lt=n(6098);let zt=(()=>{var t;class e{constructor(){this.editor=(0,b.WQX)(at,{optional:!0}),this.customSanitizer=(0,b.WQX)(M,{optional:!0}),this.sanitizer=(0,b.WQX)(Lt.up),this.document=(0,b.WQX)(G.qQ),this.options=(0,b.WQX)(x),this.html=(0,b.vPA)(null)}set content(t){if(!t)return;const e=this.customSanitizer?.sanitize(b.WPN.HTML,t)??this.sanitizer.bypassSecurityTrustHtml(t??"");this.html.set(e)}click(t){if(this.editor||!(0,X.ru)(t.target))return;const e=t.target?.closest("a")?.getAttribute("href")??"";e.startsWith("#")&&(this.document.location.hash=e.replace("#",""),t.preventDefault())}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-editor-socket"]],hostVars:3,hostBindings:function(t,e){1&t&&b.bIt("click",(function(t){return e.click(t)})),2&t&&(b.Mr5("innerHTML",e.html(),b.npT),b.AVh("tui-editor-socket",e.options.enableDefaultStyles))},inputs:{content:"content"},standalone:!0,features:[b.aNF],decls:0,vars:0,template:function(t,e){},styles:['.tui-editor-socket{display:block;margin:0;color:var(--tui-text-primary);font:var(--tui-font-text-m)}.tui-editor-socket:after{content:"";display:table;clear:both}.tui-editor-socket[tuiTiptapEditor]{overflow:hidden}.tui-editor-socket .ProseMirror{min-block-size:100%;padding:.2rem 1rem;outline:none;white-space:pre-wrap}.tui-editor-socket .resize-cursor{cursor:ew-resize;cursor:col-resize}.tui-editor-socket .ProseMirror-gapcursor{margin-top:.83rem}.tui-editor-socket .ProseMirror .ProseMirror-gapcursor:first-child{margin-top:0}.tui-editor-socket br+br.ProseMirror-trailingBreak{display:none}.tui-editor-socket img.ProseMirror-separator+.ProseMirror-trailingBreak,.tui-editor-socket img.ProseMirror-separator{display:none!important}.tui-editor-socket h1,.tui-editor-socket h2,.tui-editor-socket h3,.tui-editor-socket h4,.tui-editor-socket h5,.tui-editor-socket h6{word-break:break-word;line-height:normal}.tui-editor-socket h1:first-child,.tui-editor-socket h2:first-child,.tui-editor-socket p:last-child{margin-bottom:0}.tui-editor-socket p:last-child,.tui-editor-socket pre:last-child{margin-bottom:0}.tui-editor-socket p:empty:after{content:" ";white-space:pre}.tui-editor-socket p:first-child{margin-top:0;min-inline-size:.0625rem}.tui-editor-socket p{margin:1rem 0}.tui-editor-socket p>span{line-height:initial}.tui-editor-socket blockquote{margin:1.25rem 0 1.25rem 1.5rem;padding-left:1.0625rem;border-left:.0625rem solid var(--tui-border-normal)}.tui-editor-socket hr{border:none;border-top:.0625rem solid var(--tui-background-neutral-1-hover);margin:1rem 0}.tui-editor-socket mark{background:unset;color:inherit}.tui-editor-socket font[face="Courier New"]{display:inline-block;padding:.25rem .5rem;border-radius:.25rem;background-color:#ecf1f7;word-break:break-word}.tui-editor-socket a:not([data-type=jump-anchor]){color:var(--tui-text-action);text-decoration:none;outline:none}.tui-editor-socket a:not([data-type=jump-anchor]):hover{color:var(--tui-text-action-hover);text-decoration:underline}.tui-editor-socket a:not([data-type=jump-anchor]):active{color:var(--tui-background-accent-1-pressed)}.tui-editor-socket .ProseMirror a[data-type=jump-anchor]{text-decoration:underline;text-decoration-color:var(--tui-text-action)}.tui-editor-socket .ProseMirror a[data-type=jump-anchor]:before{content:"#"}.tui-editor-socket .ProseMirror a[data-type=jump-anchor]:hover{color:var(--tui-text-action)}.tui-editor-socket .ProseMirror a:hover img[contenteditable=false]{cursor:pointer;outline:.25rem solid var(--tui-text-action)}.tui-editor-socket ul:not([data-type]),.tui-editor-socket ol:not([data-type]){list-style-type:none;margin:1rem 1rem 1rem 1.5rem;padding:0}.tui-editor-socket ul:not([data-type]) li,.tui-editor-socket ol:not([data-type]) li{margin:.75rem 0}.tui-editor-socket ul:not([data-type]) li>p,.tui-editor-socket ol:not([data-type]) li>p{display:inline;margin:0 auto;word-break:break-word}.tui-editor-socket ul:not([data-type]) li:before,.tui-editor-socket ol:not([data-type]) li:before{unicode-bidi:isolate;font-variant-numeric:tabular-nums;text-transform:none;text-indent:0;text-align:start;text-align-last:start}.tui-editor-socket ul:not([data-type]) li>p{display:block}.tui-editor-socket ul:not([data-type])>li:before{content:"";display:inline-block;inline-size:.5rem;block-size:.5rem;border-radius:100%;margin:.5rem .875rem .0625rem -1.375rem;background-color:var(--tui-background-accent-1);vertical-align:top;box-sizing:border-box;float:inline-start}.tui-editor-socket li ul:not([data-type])>li:before{background:none;border:.125rem solid var(--tui-background-accent-1)}.tui-editor-socket li ul:not([data-type])>li>ul:not([data-type])>li:before{background:var(--tui-background-accent-1);border-radius:0;inline-size:.375rem;block-size:.375rem}.tui-editor-socket ol:not([data-type]){counter-reset:item}.tui-editor-socket ol:not([data-type])>li:before{content:counters(item,".") ".";display:block;counter-increment:item;margin:0 .75rem 0 -1.5rem;color:var(--tui-border-hover);vertical-align:top;float:inline-start;white-space:nowrap}.tui-editor-socket [data-type=details-content] ol{counter-reset:details-item}.tui-editor-socket [data-type=details-content] ol:not([data-type])>li:before{content:counters(details-item,".") ".";counter-increment:details-item}.tui-editor-socket [data-type=details-content] ol [data-type=details-content] ol{counter-reset:details-item2}.tui-editor-socket [data-type=details-content] ol:not([data-type])>li [data-type=details-content] ol:not([data-type])>li:before{content:counters(details-item2,".") ".";counter-increment:details-item2}.tui-editor-socket ul[data-type] li[data-checked]{display:flex;gap:.5rem}.tui-editor-socket ul[data-type] li[data-checked]>div{inline-size:100%}.tui-editor-socket ul[data-type] li[data-checked]>label>input[type=checkbox]{position:relative;inline-size:var(--t-size, 1rem);block-size:var(--t-size, 1rem);border-radius:var(--tui-radius-xs, .25rem);transition-property:color,background,opacity,box-shadow,border;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;-webkit-appearance:none;appearance:none;outline:.125rem solid transparent;outline-offset:-.125rem;margin-top:.25rem;cursor:pointer}.tui-editor-socket ul[data-type] li[data-checked]>label>input[type=checkbox]:before{content:"";position:absolute;top:0;left:0;inline-size:100%;block-size:100%;background:currentColor;-webkit-mask:url(\'data:image/svg+xml,\') center / 100%;mask:url(\'data:image/svg+xml,\') center / 100%;transform:scale(0);transition:transform var(--tui-duration) ease-in-out,mask 0s var(--tui-duration) ease-in-out,-webkit-mask 0s var(--tui-duration) ease-in-out}.tui-editor-socket ul[data-type] li>label>input[type=checkbox]:checked{background:var(--tui-background-accent-1, #526ed3);color:var(--tui-text-primary-on-accent-1, #fff)}.tui-editor-socket ul[data-type] li>label>input[type=checkbox]:checked:before{-webkit-mask-image:url(\'data:image/svg+xml,\');mask-image:url(\'data:image/svg+xml,\');transform:scale(1)}.tui-editor-socket ul[data-type] li>label>input[type=checkbox]{box-shadow:inset 0 0 0 .0625rem var(--tui-border-normal);color:var(--tui-text-primary)}.tui-editor-socket._preview-image img{cursor:pointer}.tui-editor-socket .ProseMirror video,.tui-editor-socket .ProseMirror audio{pointer-events:none}.tui-editor-socket img.ProseMirror-selectednode{outline:.25rem solid var(--tui-background-accent-1-hover)}.tui-editor-socket[tuiTiptapEditor] tui-image-editor:hover{outline:.0625rem dashed var(--tui-background-accent-1-hover)}.tui-editor-socket .t-editor-placeholder:not(tr):not(th):not(td):not(ul):not(ol):not(li):first-child:before{content:attr(data-placeholder);position:absolute;float:inline-start;color:var(--tui-border-hover);pointer-events:none}.tui-editor-socket table{border-collapse:collapse;table-layout:fixed;inline-size:100%;margin:0;overflow:hidden}.tui-editor-socket table .tableWrapper,.tui-editor-socket .tableWrapper,.tui-editor-socket .tui-table-wrapper{overflow-x:auto}.tui-editor-socket table td{position:relative;min-inline-size:1em;block-size:2rem;padding:.1875rem .3125rem;vertical-align:top;box-sizing:border-box;word-break:break-word}.tui-editor-socket table th{position:relative;min-inline-size:1em;block-size:2rem;padding:.1875rem .3125rem;vertical-align:top;box-sizing:border-box;word-break:break-word;font-weight:700;text-align:start;background-color:var(--tui-background-base-alt);min-block-size:2rem}.tui-editor-socket table td,.tui-editor-socket table th{border:.125rem solid #e9e9e7}[tuiTheme=dark] .tui-editor-socket table td,[tuiTheme=dark] .tui-editor-socket table th{border:.125rem solid #2f2f2f}.tui-editor-socket table .column-resize-handle{position:absolute;right:-.125rem;top:0;bottom:-.125rem;inline-size:.25rem;background-color:#adf;pointer-events:none}.tui-editor-socket table td>*{margin-top:0;margin-bottom:0}.tui-editor-socket table th>*{margin-top:0;margin-bottom:0}.tui-editor-socket .selectedCell{outline:.0625rem solid #83b4d7}.tui-editor-socket .selectedCell:after{content:"";position:absolute;top:0;left:0;right:0;bottom:0;background:var(--tui-service-selected-text);pointer-events:none}.tui-editor-socket summary{display:flex;align-items:center;min-block-size:3.5rem;inline-size:100%;box-sizing:border-box;border-radius:var(--tui-radius-l);pointer-events:none;outline:none;word-break:break-word;padding:0 4.6875rem 0 1.25rem}.tui-editor-socket summary:focus-visible{outline:.125rem solid var(--tui-text-action)}.tui-editor-socket summary p{min-inline-size:.0625rem;margin:0}.tui-editor-socket summary::-webkit-details-marker{display:none}.tui-editor-socket details[open] summary{border-radius:var(--tui-radius-l) var(--tui-radius-l) 0 0}.tui-editor-socket .t-details-arrow{position:absolute;top:1.5rem;right:1.25rem;block-size:.575rem;inline-size:.575rem;border:.0625rem solid var(--tui-text-secondary);border-width:0 .125rem .125rem 0;transform:rotate(45deg);transition:var(--tui-duration, .3s);-webkit-appearance:none;appearance:none;box-sizing:border-box;padding:0;background:none;cursor:pointer;outline:none}.tui-editor-socket .t-details-arrow:hover{border-color:var(--tui-text-primary)}.tui-editor-socket .t-details-delete{position:absolute;top:1.4rem;right:2.7rem;block-size:1.125rem;inline-size:1.25rem;-webkit-appearance:none;appearance:none;box-sizing:border-box;padding:0;background:none;cursor:pointer;outline:none;border:none}.tui-editor-socket .t-details-delete:hover:after{color:var(--tui-text-primary)}.tui-editor-socket .t-details-delete:after{content:"\\d7";display:inline-block;font:inherit;font-size:2rem;color:var(--tui-text-secondary);block-size:100%;inline-size:100%;line-height:.8rem}.tui-editor-socket details{inline-size:100%;border:.0625rem solid var(--tui-border-normal);border-radius:var(--tui-radius-l)}.tui-editor-socket div[data-type=details-content]{padding:1.25rem;min-block-size:3rem;border:.0625rem solid var(--tui-border-normal);border-width:.0625rem 0 0}.tui-editor-socket div[data-type=details-content] h1:first-child,.tui-editor-socket div[data-type=details-content] h2:first-child,.tui-editor-socket div[data-type=details-content] pre:first-child,.tui-editor-socket div[data-type=details-content] ul:first-child,.tui-editor-socket div[data-type=details-content] ol:first-child,.tui-editor-socket div[data-type=details-content] ol li:first-child,.tui-editor-socket div[data-type=details-content] ul li:first-child{margin-top:0}.tui-editor-socket .t-details-wrapper{position:relative;display:flex}.tui-editor-socket .t-details-wrapper_rendered .t-details-arrow{pointer-events:none}.tui-editor-socket .t-details-wrapper_rendered summary{transition:transform var(--tui-duration, .3s);cursor:pointer;pointer-events:auto}.tui-editor-socket .t-details-wrapper_rendered summary:hover{background:var(--tui-background-base-alt)}.tui-editor-socket details[open]+.t-details-arrow{top:1.75rem;transform:rotate(225deg)}.tui-editor-socket pre{white-space:pre-wrap;word-break:break-word;border-radius:.25rem;margin:1rem 0;padding:.75rem 1rem;font-family:Courier,monospace;color:var(--tui-text-secondary);background:var(--tui-background-base-alt)}.tui-editor-socket .tui-group-node{display:flex;flex-direction:row}.tui-editor-socket .tui-group-node:hover>.tui-group-pointer{pointer-events:auto;opacity:1}.tui-editor-socket .tui-group-pointer{opacity:0;min-block-size:.8125rem;max-block-size:.8125rem;min-inline-size:.8125rem;max-inline-size:.8125rem;margin:.3125rem .3125rem 0 0;cursor:grab;background-image:url(\'data:image/svg+xml;charset=UTF-8,\');background-repeat:no-repeat;background-size:contain;background-position:center}.tui-editor-socket [data-mode=onDark] .tui-group-pointer{background-image:url(\'data:image/svg+xml;charset=UTF-8,\')}.t-hidden-editor{display:none;visibility:hidden;opacity:0;block-size:0;inline-size:100%;margin:0;padding:0}\n'],encapsulation:2,changeDetection:0}),e})();var Pt=n(7434),Bt=n(7920),_t=n(756),Ht=n(9707),jt=n(9131);function Ft(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",3)(1,"button",4),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(null==e.editor?null:e.editor.onAlign("left"))})),b.nI1(2,"async"),b.k0s(),b.j41(3,"button",4),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(null==e.editor?null:e.editor.onAlign("center"))})),b.nI1(4,"async"),b.k0s(),b.j41(5,"button",4),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(null==e.editor?null:e.editor.onAlign("right"))})),b.nI1(6,"async"),b.k0s(),b.j41(7,"button",4),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(null==e.editor?null:e.editor.onAlign("justify"))})),b.nI1(8,"async"),b.k0s()()}if(2&t){const t=b.XpG();let e,n,o,i;b.R7$(1),b.Y8G("iconStart",t.options.icons.textAlignLeft)("tuiHint",null==(e=b.bMT(2,8,t.texts$))?null:e.justifyLeft),b.R7$(2),b.Y8G("iconStart",t.options.icons.textAlignCenter)("tuiHint",null==(n=b.bMT(4,10,t.texts$))?null:n.justifyCenter),b.R7$(2),b.Y8G("iconStart",t.options.icons.textAlignRight)("tuiHint",null==(o=b.bMT(6,12,t.texts$))?null:o.justifyRight),b.R7$(2),b.Y8G("iconStart",t.options.icons.textAlignJustify)("tuiHint",null==(i=b.bMT(8,14,t.texts$))?null:i.justifyFull)}}let Gt=(()=>{var t;class e{constructor(){this.localEditor=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.alignState$=null}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}initStream(){this.alignState$=(0,It.z)([this.editor?.isActive$({textAlign:"left"})??(0,_t.of)(!1),this.editor?.isActive$({textAlign:"right"})??(0,_t.of)(!1),this.editor?.isActive$({textAlign:"center"})??(0,_t.of)(!1),this.editor?.isActive$({textAlign:"justify"})??(0,_t.of)(!1)]).pipe((0,P.T)((([t,e,n,o])=>({left:t,right:e,center:n,justify:o}))))}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-align-content"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:5,vars:6,consts:[[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__align-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["alignDropdown",""],[1,"t-dropdown"],["appearance","icon","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"iconStart","tuiHint","click"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0),b.nrm(1,"button",1),b.nI1(2,"async"),b.DNE(3,Ft,9,16,"ng-template",null,2,b.C5r),b.k0s()),2&t){const t=b.sdS(4);let n;b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(1),b.Y8G("iconStart",e.options.icons.textAlignPreview)("tuiHint",null==(n=b.bMT(2,4,e.texts$))?null:n.justify)}},dependencies:[G.Jj,K.p,Ht.pU,Ht.iE,jt.XZ,jt.$$],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})();var Vt=n(5180);function Wt(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",5),b.bIt("click",(function(){const e=b.eBV(t).index,n=b.XpG(2);return b.Njj(n.onCode(!!e))})),b.EFF(1),b.k0s()}if(2&t){const t=e.$implicit;b.R7$(1),b.SpI(" ",t," ")}}function Xt(t,e){if(1&t&&(b.j41(0,"tui-data-list"),b.DNE(1,Wt,2,1,"button",4),b.nI1(2,"async"),b.k0s()),2&t){const t=b.XpG();b.R7$(1),b.Y8G("ngForOf",b.bMT(2,1,t.codeOptionsTexts$))}}let Ut=(()=>{var t;class e{constructor(){this.localEditor=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.codeOptionsTexts$=(0,b.WQX)($),this.hintText$=this.texts$.pipe((0,P.T)((t=>t.code))),this.insideCode$=null}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}onCode(t){this.editor?.[t?"toggleCodeBlock":"toggleCode"]()}get editor(){return this.injectionEditor??this.localEditor}initStream(){this.insideCode$=(0,It.z)({code:this.editor?.isActive$("code")??(0,_t.of)(!1),codeBlock:this.editor?.isActive$("codeBlock")??(0,_t.of)(!1)}).pipe((0,P.T)((({code:t,codeBlock:e})=>t||e)))}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-code"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:6,vars:6,consts:[[3,"tuiDropdown","tuiDropdownOpen"],["codes",""],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["codesDropdown",""],["tuiOption","","type","button",3,"click",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0,1),b.nrm(2,"button",2),b.nI1(3,"async"),b.DNE(4,Xt,3,3,"ng-template",null,3,b.C5r),b.k0s()),2&t){const t=b.sdS(5);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(2),b.Y8G("iconStart",e.options.icons.code)("tuiHint",b.bMT(3,4,e.hintText$))}},dependencies:[G.Jj,G.Sq,K.p,Vt.uE,Vt.aO,Ht.pU,Ht.iE,jt.XZ,jt.$$],encapsulation:2,changeDetection:0}),e})(),Kt=(()=>{var t;class e{constructor(){this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.options=(0,b.WQX)(x),this.inputEditor=null}get editor(){return this.injectionEditor??this.inputEditor}setDetails(){this.editor?.setDetails()}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-details"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:2,vars:4,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint","click"]],template:function(t,e){if(1&t&&(b.j41(0,"button",0),b.bIt("click",(function(){return e.setDetails()})),b.nI1(1,"async"),b.k0s()),2&t){let t;b.Y8G("iconStart",e.options.icons.detailsAdd)("tuiHint",null==(t=b.bMT(1,2,e.texts$))?null:t.setDetails)}},dependencies:[G.Jj,K.p,jt.XZ,jt.$$],encapsulation:2,changeDetection:0}),e})();function Jt(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",1),b.bIt("click",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.removeDetails())})),b.nI1(1,"async"),b.k0s()}if(2&t){const t=e.ngIf,n=b.XpG();b.Y8G("disabled",!!b.bMT(1,3,n.disabled$))("iconStart",n.options.icons.detailsRemove)("tuiHint",t.removeDetails)}}let Yt=(()=>{var t;class e{constructor(){this.localEditor=null,this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.options=(0,b.WQX)(x),this.disabled$=null}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}removeDetails(){this.editor?.removeDetails()}get editor(){return this.injectionEditor??this.localEditor}initStream(){this.disabled$=this.editor?.isActive$("details").pipe((0,P.T)((t=>!t)))??null}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-details-remove"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:2,vars:3,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click"]],template:function(t,e){1&t&&(b.DNE(0,Jt,2,5,"button",0),b.nI1(1,"async")),2&t&&b.Y8G("ngIf",b.bMT(1,1,e.texts$))},dependencies:[G.Jj,G.bT,K.p,jt.XZ,jt.$$],encapsulation:2,changeDetection:0}),e})();const qt=function(){return{}};function Qt(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",5),b.bIt("click",(function(){const e=b.eBV(t).$implicit,n=b.XpG(2);return b.Njj(n.setFontOption(e))})),b.nI1(1,"lowercase"),b.EFF(2),b.k0s()}if(2&t){const t=e.$implicit;b.xc7("font-family",t.family)("font-size",t.px,"px")("font-weight",t.weight),b.Y8G("ngClass",(null==t?null:t.ngClass)||b.lJ4(12,qt))("ngStyle",(null==t?null:t.ngStyle)||b.lJ4(13,qt)),b.BMQ("automation-id","tui_font__"+b.bMT(1,10,t.name||"")),b.R7$(2),b.SpI(" ",t.name," ")}}function Zt(t,e){if(1&t&&(b.j41(0,"tui-data-list"),b.DNE(1,Qt,3,14,"button",4),b.nI1(2,"async"),b.k0s()),2&t){const t=b.XpG();b.R7$(1),b.Y8G("ngForOf",b.bMT(2,1,t.fontsOptions$))}}let te=(()=>{var t;class e{constructor(){this.fontOptionsTexts$=(0,b.WQX)(L),this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.fontsOptions$=this.fontOptionsTexts$.pipe((0,P.T)((t=>this.options.fontOptions(t)))),this.fontText$=this.texts$.pipe((0,P.T)((t=>t.font))),this.inputEditor=null}get editor(){return this.injectionEditor??this.inputEditor}setFontOption({headingLevel:t,px:e}){const n=this.editor?.getFontColor()??i;this.clearPreviousTextStyles(),t?this.editor?.setHeading(t):this.editor?.setParagraph({fontSize:(0,w.Pp)(e??0)}),n!==i&&this.editor?.setFontColor(n)}clearPreviousTextStyles(){this.editor?.removeEmptyTextStyle(),this.editor?.toggleMark("textStyle")}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-font-size"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:6,vars:6,consts:[[3,"tuiDropdown","tuiDropdownOpen"],["fonts",""],["appearance","icon","automation-id","toolbar__font-size-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["fontsDropdown",""],["tuiOption","","type","button",3,"ngClass","ngStyle","fontFamily","fontSize","fontWeight","click",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"ngClass","ngStyle","click"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0,1),b.nrm(2,"button",2),b.nI1(3,"async"),b.DNE(4,Zt,3,3,"ng-template",null,3,b.C5r),b.k0s()),2&t){const t=b.sdS(5);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(2),b.Y8G("iconStart",e.options.icons.fontSize)("tuiHint",b.bMT(3,4,e.fontText$))}},dependencies:[G.Jj,G.GH,G.YU,G.Sq,G.B3,K.p,Vt.uE,Vt.aO,Ht.pU,Ht.iE,jt.XZ,jt.$$],encapsulation:2,changeDetection:0}),e})();function ee(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",8),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(4);return b.Njj(null==e.editor?null:e.editor.toggleBold())})),b.k0s()}if(2&t){const t=b.XpG(3).ngIf,e=b.XpG();b.Y8G("iconStart",e.options.icons.fontStyleBold)("tuiHint",t.bold)}}function ne(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",8),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(4);return b.Njj(null==e.editor?null:e.editor.toggleItalic())})),b.k0s()}if(2&t){const t=b.XpG(3).ngIf,e=b.XpG();b.Y8G("iconStart",e.options.icons.fontStyleItalic)("tuiHint",t.italic)}}function oe(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",8),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(4);return b.Njj(null==e.editor?null:e.editor.toggleUnderline())})),b.k0s()}if(2&t){const t=b.XpG(3).ngIf,e=b.XpG();b.Y8G("iconStart",e.options.icons.fontStyleUnderline)("tuiHint",t.underline)}}function ie(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",8),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(4);return b.Njj(null==e.editor?null:e.editor.toggleStrike())})),b.k0s()}if(2&t){const t=b.XpG(3).ngIf,e=b.XpG();b.Y8G("iconStart",e.options.icons.fontStyleStrike)("tuiHint",t.strikeThrough)}}function re(t,e){if(1&t&&(b.j41(0,"div",6),b.DNE(1,ee,1,2,"button",7),b.DNE(2,ne,1,2,"button",7),b.DNE(3,oe,1,2,"button",7),b.DNE(4,ie,1,2,"button",7),b.k0s()),2&t){const t=b.XpG(3);b.R7$(1),b.Y8G("ngIf",t.isEnabled(t.editorTool.Bold)),b.R7$(1),b.Y8G("ngIf",t.isEnabled(t.editorTool.Italic)),b.R7$(1),b.Y8G("ngIf",t.isEnabled(t.editorTool.Underline)),b.R7$(1),b.Y8G("ngIf",t.isEnabled(t.editorTool.Strikethrough))}}function se(t,e){if(1&t&&(b.j41(0,"div",2,3),b.nrm(2,"button",4),b.DNE(3,re,5,4,"ng-template",null,5,b.C5r),b.k0s()),2&t){const t=b.sdS(4),e=b.XpG().ngIf,n=b.XpG();b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(2),b.Y8G("iconStart",n.options.icons.fontStylePreview)("tuiHint",e.fontStyle)}}function ae(t,e){if(1&t&&(b.qex(0),b.DNE(1,se,5,4,"div",1),b.nI1(2,"async"),b.bVm()),2&t){const t=b.XpG();b.R7$(1),b.Y8G("ngIf",b.bMT(2,1,t.fontStyleState$))}}let le=(()=>{var t;class e{constructor(){this.toolsSet=new Set(s),this.localEditor=null,this.editorTool=r,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.fontStyleState$=null}set inputEditor(t){this.localEditor=t,this.initStream()}set enabledTools(t){this.toolsSet=new Set(t)}get editor(){return this.injectionEditor??this.localEditor}ngOnInit(){this.initStream()}isEnabled(t){return this.toolsSet.has(t)}initStream(){this.fontStyleState$=(0,It.z)([this.editor?.isActive$("bold")??(0,_t.of)(!1),this.editor?.isActive$("italic")??(0,_t.of)(!1),this.editor?.isActive$("underline")??(0,_t.of)(!1),this.editor?.isActive$("strike")??(0,_t.of)(!1)]).pipe((0,P.T)((([t,e,n,o])=>({bold:t,italic:e,underline:n,strike:o}))))}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-font-style"]],inputs:{inputEditor:["editor","inputEditor"],enabledTools:"enabledTools"},standalone:!0,features:[b.aNF],decls:2,vars:3,consts:[[4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen",4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen"],["format",""],["appearance","icon","automation-id","toolbar__font-style-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["formatDropdown",""],[1,"t-dropdown"],["appearance","icon","size","s","tuiIconButton","","type","button","class","t-option t-option_margin",3,"iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"iconStart","tuiHint","click"]],template:function(t,e){1&t&&(b.DNE(0,ae,3,3,"ng-container",0),b.nI1(1,"async")),2&t&&b.Y8G("ngIf",b.bMT(1,1,e.texts$))},dependencies:[G.Jj,G.bT,K.p,Ht.pU,Ht.iE,jt.XZ,jt.$$],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})(),ce=(()=>{var t;class e{constructor(){this.localEditor=null,this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.options=(0,b.WQX)(x),this.insertGroupText$=this.texts$.pipe((0,P.T)((t=>t.insertGroup))),this.removeGroupText$=this.texts$.pipe((0,P.T)((t=>t.removeGroup))),this.disabled$=null}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}addGroup(){this.editor?.setGroup()}removeGroup(){this.editor?.removeGroup()}get editor(){return this.injectionEditor??this.localEditor}initStream(){this.disabled$=this.editor?.isActive$("group").pipe((0,P.T)((t=>!t)))??null}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-editor-group-tool"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:5,vars:11,consts:[["appearance","icon","automation-id","toolbar__group-add-button","size","s","tuiHintDescribe","","tuiIconButton","","type","button",3,"iconStart","tuiHint","click"],["appearance","icon","automation-id","toolbar__group-remove-button","size","s","tuiHintDescribe","","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click"]],template:function(t,e){1&t&&(b.j41(0,"button",0),b.bIt("click",(function(){return e.addGroup()})),b.nI1(1,"async"),b.k0s(),b.j41(2,"button",1),b.bIt("click",(function(){return e.removeGroup()})),b.nI1(3,"async"),b.nI1(4,"async"),b.k0s()),2&t&&(b.Y8G("iconStart",e.options.icons.groupAdd)("tuiHint",b.bMT(1,5,e.insertGroupText$)),b.R7$(2),b.Y8G("disabled",!!b.bMT(3,7,e.disabled$))("iconStart",e.options.icons.groupRemove)("tuiHint",b.bMT(4,9,e.removeGroupText$)))},dependencies:[G.Jj,K.p,jt.XZ,jt.$$],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})();var de=n(184);function ue(t,e){if(1&t&&(b.j41(0,"div",4),b.nI1(1,"async"),b.k0s()),2&t){const t=b.XpG();b.xc7("background",b.bMT(1,2,t.backgroundColor$))}}function he(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-palette",5),b.bIt("selectedColor",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(null==n.editor?null:n.editor.setBackgroundColor(e))})),b.k0s()}if(2&t){const t=b.XpG();b.Y8G("colors",t.colors)}}let pe=(()=>{var t;class e{constructor(){this.localEditor=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.backgroundColor$=null,this.backColorText$=this.texts$.pipe((0,P.T)((t=>t.backColor))),this.colors=this.options.colors}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}isBlankColor(t){return t===this.options.blankColor}get editor(){return this.injectionEditor??this.localEditor}get icons(){return this.options.icons}initStream(){this.backgroundColor$=this.editor?.stateChange$.pipe((0,P.T)((()=>this.editor?.getBackgroundColor()??this.options.blankColor??!1)),(0,it.F)())??null}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-highlight-color"]],inputs:{colors:"colors",inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:7,vars:9,consts:[[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__hilite-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",1,"t-tool",3,"iconStart","tuiHint"],["class","t-plate",3,"background",4,"ngIf"],["hiliteDropdown",""],[1,"t-plate"],[1,"t-color-picker",3,"colors","selectedColor"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0),b.nrm(1,"button",1),b.nI1(2,"async"),b.DNE(3,ue,2,4,"div",2),b.nI1(4,"async"),b.DNE(5,he,1,1,"ng-template",null,3,b.C5r),b.k0s()),2&t){const t=b.sdS(6);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(1),b.Y8G("iconStart",e.icons.textHilite)("tuiHint",b.bMT(2,5,e.backColorText$)),b.R7$(2),b.Y8G("ngIf",!e.isBlankColor(b.bMT(4,7,e.backgroundColor$)||""))}},dependencies:[G.Jj,G.bT,K.p,Ht.pU,Ht.iE,jt.XZ,jt.$$,de.Mz,de.DU],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})();function fe(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",5)(1,"button",6),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(null==e.editor?null:e.editor.toggleUnorderedList())})),b.k0s(),b.j41(2,"button",7),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(null==e.editor?null:e.editor.toggleOrderedList())})),b.k0s(),b.j41(3,"button",8),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(null==e.editor?null:e.editor.toggleTaskList())})),b.k0s(),b.j41(4,"button",9),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.sinkListItem())})),b.k0s(),b.j41(5,"button",10),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.liftListItem())})),b.k0s()()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.R7$(1),b.Y8G("iconStart",e.options.icons.listUnOrdered)("tuiHint",t.unorderedList),b.R7$(1),b.Y8G("iconStart",e.options.icons.listOrdered)("tuiHint",t.orderedList),b.R7$(1),b.Y8G("iconStart",e.options.icons.taskList),b.R7$(1),b.Y8G("iconStart",e.options.icons.indent)("tuiHint",t.indent),b.R7$(1),b.Y8G("iconStart",e.options.icons.outdent)("tuiHint",t.outdent)}}function me(t,e){if(1&t&&(b.j41(0,"div",2),b.nrm(1,"button",3),b.DNE(2,fe,6,9,"ng-template",null,4,b.C5r),b.k0s()),2&t){const t=b.sdS(3),e=b.XpG().ngIf,n=b.XpG();b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(1),b.Y8G("iconStart",n.options.icons.listPreview)("tuiHint",e.list)}}function ge(t,e){if(1&t&&(b.qex(0),b.DNE(1,me,4,4,"div",1),b.nI1(2,"async"),b.bVm()),2&t){const t=b.XpG();b.R7$(1),b.Y8G("ngIf",b.bMT(2,1,t.listState$))}}let be=(()=>{var t;class e{constructor(){this.localEditor=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.listState$=null}set inputEditor(t){this.localEditor=t,this.initStream()}get editor(){return this.injectionEditor??this.localEditor}sinkListItem(){this.editor?.sinkListItem()}liftListItem(){this.editor?.liftListItem()}initStream(){this.listState$=(0,It.z)([this.editor?.isActive$("orderedList")??(0,_t.of)(!1),this.editor?.isActive$("bulletList")??(0,_t.of)(!1),this.editor?.isActive$("taskList")??(0,_t.of)(!1)]).pipe((0,P.T)((([t,e,n])=>({ordered:t,unordered:e,tasked:n}))))}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-list-configs"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:2,vars:3,consts:[[4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen",4,"ngIf"],[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__ordering-list-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["listDropdown",""],[1,"t-dropdown","t-dropdown-list"],["appearance","icon","automation-id","toolbar__un-ordered-list-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"iconStart","tuiHint","click"],["appearance","icon","automation-id","toolbar__ordered-list-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"iconStart","tuiHint","click"],["appearance","icon","automation-id","toolbar__task-list-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"iconStart","click"],["appearance","icon","automation-id","toolbar_indent-button","size","s","tuiIconButton","","type","button",1,"t-option","t-option_margin",3,"iconStart","tuiHint","click"],["appearance","icon","automation-id","toolbar_outdent-button","size","s","tuiIconButton","","type","button",1,"t-option",3,"iconStart","tuiHint","click"]],template:function(t,e){1&t&&(b.DNE(0,ge,3,3,"ng-container",0),b.nI1(1,"async")),2&t&&b.Y8G("ngIf",b.bMT(1,1,e.texts$))},dependencies:[G.Jj,G.bT,K.p,Ht.pU,Ht.iE,jt.XZ,jt.$$],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})();function ye(t,e){if(1&t&&(b.j41(0,"div",3),b.nI1(1,"async"),b.k0s()),2&t){const t=b.XpG();b.xc7("background",b.bMT(1,2,t.color$))}}function ke(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-palette",4),b.bIt("selectedColor",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(n.setCellColor(e))})),b.k0s()}if(2&t){const t=b.XpG();b.Y8G("colors",t.colors)}}let ve=(()=>{var t;class e{constructor(){this.localEditor=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.colorText$=null,this.isActive$=null,this.color$=null,this.colors=this.options.colors}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}get icons(){return this.options.icons}isBlankColor(t){return t===this.options.blankColor}setCellColor(t){this.editor?.isActive("group")?this.editor.setGroupHilite(t):this.editor?.isActive("table")&&this.editor.setCellColor(t)}initStream(){this.colorText$=this.texts$.pipe((0,P.T)((t=>this.editor?.isActive("group")&&t.hiliteGroup||this.editor?.isActive("table")&&t.cellColor||""))),this.isActive$=(0,It.z)([this.editor?.isActive$("table")??(0,_t.of)(!1),this.editor?.isActive$("group")??(0,_t.of)(!1)]).pipe((0,P.T)((([t,e])=>t||e))),this.color$=this.editor?.stateChange$.pipe((0,P.T)((()=>this.editor?.getCellColor()??this.editor?.getGroupColor()??this.options.blankColor)),(0,it.F)())??null}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-table-cell-color"]],inputs:{colors:"colors",inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:7,vars:13,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiDropdown","tuiDropdownMaxHeight","tuiDropdownOpen","tuiHint"],["class","t-plate t-plate_paint",3,"background",4,"ngIf"],["cellColorDropdown",""],[1,"t-plate","t-plate_paint"],[1,"t-color-picker",3,"colors","selectedColor"]],template:function(t,e){if(1&t&&(b.nrm(0,"button",0),b.nI1(1,"async"),b.nI1(2,"async"),b.DNE(3,ye,2,4,"div",1),b.nI1(4,"async"),b.DNE(5,ke,1,1,"ng-template",null,2,b.C5r)),2&t){const t=b.sdS(6);b.Y8G("disabled",!b.bMT(1,7,e.isActive$))("iconStart",e.icons.paint)("tuiDropdown",t)("tuiDropdownMaxHeight",999)("tuiDropdownOpen",!1)("tuiHint",b.bMT(2,9,e.colorText$)),b.R7$(3),b.Y8G("ngIf",!e.isBlankColor(b.bMT(4,11,e.color$)||""))}},dependencies:[G.Jj,G.bT,K.p,Ht.HY,Ht.pU,Ht.iE,jt.XZ,jt.$$,de.Mz,de.DU],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})();var we=n(712);class Ce{constructor(t){this.$implicit=t}}let xe=(()=>{var t;class e{constructor(){this.viewContainer=(0,b.WQX)(b.c1b),this.templateRef=(0,b.WQX)(b.C4Q)}set tuiRepeatTimesOf(t){const e=Math.floor((0,we.wN)(t,0,65536)),{length:n}=this.viewContainer;t{var t;class e{constructor(){this.win=(0,b.WQX)(W.jf),this.tableSize={rows:1,cols:1},this.selectSize=new b.bkB}get columnsNumber(){return Math.min(Math.max(3,this.tableSize.cols+1),15)}get rowsNumber(){return Math.min(Math.max(3,this.tableSize.rows+1),15)}tableSelectHovered(t,e){return t70&&(this.tableSize={rows:t,cols:e})}select(){this.selectSize.emit(this.tableSize)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-table-size-selector"]],outputs:{selectSize:"selectSize"},standalone:!0,features:[b.aNF],decls:3,vars:3,consts:[["class","t-column",4,"tuiRepeatTimes","tuiRepeatTimesOf"],[1,"t-description"],[1,"t-column"],["class","t-cell",3,"t-cell_hovered","click","mouseenter",4,"tuiRepeatTimes","tuiRepeatTimesOf"],[1,"t-cell",3,"click","mouseenter"]],template:function(t,e){1&t&&(b.DNE(0,Me,2,1,"div",0),b.j41(1,"div",1),b.EFF(2),b.k0s()),2&t&&(b.Y8G("tuiRepeatTimesOf",e.columnsNumber),b.R7$(2),b.Lme("",e.tableSize.cols,"×",e.tableSize.rows,""))},dependencies:[xe],styles:["[_nghost-%COMP%]{display:block;padding:.75rem}.t-cell[_ngcontent-%COMP%]{display:inline-block;background-color:var(--tui-background-base);inline-size:1.25rem;block-size:1.25rem;border-radius:.25rem;margin:.125rem;border:.0625rem solid var(--tui-border-normal);cursor:pointer}.t-cell_hovered[_ngcontent-%COMP%]{background-color:var(--tui-background-base-alt)}.t-column[_ngcontent-%COMP%]{white-space:nowrap}.t-description[_ngcontent-%COMP%]{text-align:center}"],changeDetection:0}),e})();function Oe(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-table-size-selector",4),b.bIt("selectSize",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(n.addTable(e))})),b.k0s()}}let Ee=(()=>{var t;class e{constructor(){this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.insertTableText$=this.texts$.pipe((0,P.T)((t=>t.insertTable))),this.inputEditor=null}get editor(){return this.injectionEditor??this.inputEditor}addTable({rows:t,cols:e}){this.editor?.enter();const n=this.editor?.state?.selection.anchor;this.editor?.enter(),this.editor?.enter(),this.editor?.setTextSelection(n??0),this.editor?.insertTable(t,e)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-table-create"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:6,vars:6,consts:[["tuiDropdownAlign","left","tuiDropdownDirection","bottom",3,"tuiDropdown","tuiDropdownOpen"],["table",""],["appearance","icon","automation-id","toolbar__insert-table-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["tableDropdown",""],[3,"selectSize"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0,1),b.nrm(2,"button",2),b.nI1(3,"async"),b.k0s(),b.DNE(4,Oe,1,0,"ng-template",null,3,b.C5r)),2&t){const t=b.sdS(5);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(2),b.Y8G("iconStart",e.options.icons.insertTable)("tuiHint",b.bMT(3,4,e.insertTableText$))}},dependencies:[G.Jj,K.p,Ht.HY,Ht.pU,Ht.iE,jt.XZ,jt.$$,Te],encapsulation:2,changeDetection:0}),e})(),Ae=(()=>{var t;class e{constructor(){this.localEditor=null,this.destroyRef=(0,b.WQX)(b.abz),this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.canMergeCells=(0,b.vPA)(!1),this.canSplitCells=(0,b.vPA)(!1)}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}mergeCells(){this.editor?.mergeCells()}splitCell(){this.editor?.splitCell()}get editor(){return this.injectionEditor??this.localEditor}initStream(){this.editor?.stateChange$.pipe((0,P.T)((()=>this.editor?.canMergeCells()??!1)),(0,it.F)(),(0,Q.pQ)(this.destroyRef)).subscribe((t=>this.canMergeCells.set(t))),this.editor?.stateChange$.pipe((0,P.T)((()=>this.editor?.canSplitCells()??!1)),(0,it.F)(),(0,Q.pQ)(this.destroyRef)).subscribe((t=>this.canSplitCells.set(t)))}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-table-merge-cells"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:3,vars:7,consts:[["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click"]],template:function(t,e){if(1&t&&(b.j41(0,"button",0),b.bIt("click",(function(){return e.canMergeCells()?e.mergeCells():e.splitCell()})),b.nI1(1,"async"),b.nI1(2,"async"),b.k0s()),2&t){let t;b.Y8G("disabled",!e.canMergeCells()&&!e.canSplitCells())("iconStart",e.canMergeCells()?e.options.icons.tableCellMerge:e.options.icons.tableCellSplit)("tuiHint",e.canMergeCells()?null==(t=b.bMT(1,3,e.texts$))?null:t.mergeCells:null==(t=b.bMT(2,5,e.texts$))?null:t.splitCells)}},dependencies:[G.Jj,K.p,jt.XZ,jt.$$],encapsulation:2,changeDetection:0}),e})();function Ie(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",5),b.bIt("click",(function(){const e=b.eBV(t).index,n=b.XpG().index,o=b.XpG(2);return b.Njj(o.onTableOption(2*n+e))})),b.EFF(1),b.k0s()}if(2&t){const t=e.$implicit;b.R7$(1),b.SpI(" ",t," ")}}function Ne(t,e){if(1&t&&(b.j41(0,"tui-opt-group"),b.DNE(1,Ie,2,1,"button",4),b.k0s()),2&t){const t=e.$implicit;b.R7$(1),b.Y8G("ngForOf",t)}}function De(t,e){if(1&t&&(b.j41(0,"tui-data-list"),b.DNE(1,Ne,2,1,"tui-opt-group",3),b.nI1(2,"async"),b.k0s()),2&t){const t=b.XpG();b.R7$(1),b.Y8G("ngForOf",b.bMT(2,1,t.tableCommandTexts$))}}const Re={InsertColumnBefore:0,InsertColumnAfter:1,InsertRowBefore:2,InsertRowAfter:3,DeleteColumn:4,DeleteRow:5};let $e=(()=>{var t;class e{constructor(){this.localEditor=null,this.commandsRegistry=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.tableCommandTexts$=(0,b.WQX)(D),this.isActive$=null,this.rowsColumnsManagingText$=this.texts$.pipe((0,P.T)((t=>t.rowsColumnsManaging)))}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}onTableOption(t){this.commandsRegistry?.[t]?.()}initStream(){this.commandsRegistry={[Re.InsertColumnAfter]:()=>this.editor?.addColumnAfter(),[Re.InsertColumnBefore]:()=>this.editor?.addColumnBefore(),[Re.InsertRowAfter]:()=>this.editor?.addRowAfter(),[Re.InsertRowBefore]:()=>this.editor?.addRowBefore(),[Re.DeleteColumn]:()=>this.editor?.deleteColumn(),[Re.DeleteRow]:()=>this.editor?.deleteRow()},this.isActive$=this.editor?.isActive$("table")??null}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-table-row-column-manager"]],inputs:{inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:6,vars:9,consts:[[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint"],["tableOptionsDropdown",""],[4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"click"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0),b.nrm(1,"button",1),b.nI1(2,"async"),b.nI1(3,"async"),b.k0s(),b.DNE(4,De,3,3,"ng-template",null,2,b.C5r)),2&t){const t=b.sdS(5);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(1),b.Y8G("disabled",!b.bMT(2,5,e.isActive$))("iconStart",e.options.icons.addRowTable)("tuiHint",b.bMT(3,7,e.rowsColumnsManagingText$))}},dependencies:[G.Jj,G.Sq,K.p,Vt.uE,Vt.aO,Vt.Ji,Ht.pU,Ht.iE,jt.XZ,jt.$$],encapsulation:2,changeDetection:0}),e})();function Le(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-palette",3),b.bIt("selectedColor",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(null==n.editor?null:n.editor.setFontColor(e))})),b.k0s()}if(2&t){const t=b.XpG();b.Y8G("colors",t.colors)}}let ze=(()=>{var t;class e{constructor(){this.localEditor=null,this.options=(0,b.WQX)(x),this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.texts$=(0,b.WQX)(N),this.foreColorText$=this.texts$.pipe((0,P.T)((t=>t.foreColor))),this.fontColor$=null,this.colors=this.options.colors}set inputEditor(t){this.localEditor=t,this.initStream()}ngOnInit(){this.initStream()}get editor(){return this.injectionEditor??this.localEditor}initStream(){this.fontColor$=this.editor?.stateChange$.pipe((0,P.T)((()=>this.editor?.getFontColor()??this.options.blankColor)),(0,it.F)())??null}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-text-color"]],inputs:{colors:"colors",inputEditor:["editor","inputEditor"]},standalone:!0,features:[b.aNF],decls:6,vars:10,consts:[[3,"tuiDropdown","tuiDropdownOpen"],["appearance","icon","automation-id","toolbar__color-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"iconStart","tuiHint"],["colorDropdown",""],[1,"t-color-picker",3,"colors","selectedColor"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0)(1,"button",1),b.nI1(2,"async"),b.nI1(3,"async"),b.k0s(),b.DNE(4,Le,1,1,"ng-template",null,2,b.C5r),b.k0s()),2&t){const t=b.sdS(5);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",!1),b.R7$(1),b.xc7("color",b.bMT(2,6,e.fontColor$)),b.Y8G("iconStart",e.options.icons.textColor)("tuiHint",b.bMT(3,8,e.foreColorText$))}},dependencies:[G.Jj,K.p,Ht.pU,Ht.iE,jt.XZ,jt.$$,de.Mz,de.DU],styles:[".t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-option[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-option[_ngcontent-%COMP%]:hover{background:var(--tui-background-neutral-1-hover)}.t-option_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-color-picker[_ngcontent-%COMP%]{box-sizing:border-box;max-inline-size:22.6rem}"],changeDetection:0}),e})();var Pe=n(8486);let Be=(()=>{var t;class e{constructor(){this.el=(0,b.WQX)(b.aKT).nativeElement}findFirstFocusableTool(t=!1){const e=t?this.toolsContainers.slice().reverse():this.toolsContainers;for(const t of e){const e=(0,Pt.PQ)(t)?t:(0,Pt.km)({initial:t,root:t,keyboard:!1});if(e)return e}return null}onHorizontalNavigation(t){const{toolsContainers:e}=this,n=e.findIndex(Pt.Ij),o=e[(0,we.wN)(n+(t?-1:1),0,e.length-1)],i=t?this.findPreviousTool(o):this.findNextTool(o);i&&i.focus()}get toolsContainers(){return Array.from(this.el.querySelectorAll("[tuiItem]"))}findPreviousTool(t){return!t||(0,Pt.PQ)(t)?t??null:(0,Pt.km)({initial:t,root:t,keyboard:!1})||(0,Pt.km)({initial:t,root:this.el,previous:!0,keyboard:!1})}findNextTool(t){return!t||(0,Pt.PQ)(t)?t??null:(0,Pt.km)({initial:t,root:this.el,keyboard:!1})}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵdir=b.FsC({type:t,selectors:[["","tuiToolbarNavigationManager",""]],hostBindings:function(t,e){1&t&&b.bIt("keydown.arrowRight.prevent",(function(){return e.onHorizontalNavigation(!1)}))("keydown.arrowLeft.prevent",(function(){return e.onHorizontalNavigation(!0)}))},standalone:!0}),e})();const _e=["dropdown"];function He(t,e){if(1&t){const t=b.RV6();b.qex(0),b.nrm(1,"button",2),b.j41(2,"div",3),b.bIt("focus",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onTopFocus())})),b.k0s(),b.j41(3,"div",3),b.bIt("focus",(function(){b.eBV(t);const e=b.XpG();return b.Njj(e.onBottomFocus())})),b.k0s(),b.bVm()}if(2&t){const t=b.XpG();b.R7$(2),b.Y8G("tabIndex",t.focusable?0:-1),b.R7$(1),b.Y8G("tabIndex",t.focusable?0:-1)}}function je(t,e){1&t&&b.eu8(0)}function Fe(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",6)(1,"button",7),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(2);return b.Njj(e.undo())})),b.k0s(),b.j41(2,"button",8),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(2);return b.Njj(e.redo())})),b.k0s()()}if(2&t){const t=b.XpG().ngIf,e=b.XpG();b.R7$(1),b.Y8G("disabled",e.undoDisabled)("iconStart",e.icons.undo)("tuiHint",t.undo),b.R7$(1),b.Y8G("disabled",e.redoDisabled)("iconStart",e.icons.redo)("tuiHint",t.redo)}}function Ge(t,e){if(1&t&&(b.j41(0,"div",6),b.nrm(1,"tui-font-size",9),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("editor",t.editor)}}function Ve(t,e){if(1&t&&b.nrm(0,"tui-font-style",15),2&t){const t=b.XpG(3);b.Y8G("editor",t.editor)("enabledTools",t.toolsSet)}}function We(t,e){if(1&t&&b.nrm(0,"tui-align-content",9),2&t){const t=b.XpG(3);b.Y8G("editor",t.editor)}}function Xe(t,e){if(1&t&&b.nrm(0,"tui-list-configs",9),2&t){const t=b.XpG(3);b.Y8G("editor",t.editor)}}function Ue(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",16),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.toggleQuote())})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("disabled",e.unorderedList||e.orderedList)("iconStart",e.icons.quote)("tuiHint",t.quote)}}function Ke(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",17),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.onLink())})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("disabled",e.a||e.jumpAnchor)("iconStart",e.icons.link)("tuiHint",t.link)}}function Je(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",18),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.onLink("#"))})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("disabled",e.a||e.jumpAnchor)("iconStart",e.icons.anchor)("tuiHint",t.insertAnchor)}}function Ye(t,e){if(1&t){const t=b.RV6();b.qex(0),b.j41(1,"button",19),b.bIt("click",(function(){b.eBV(t);const e=b.sdS(3);return b.Njj(e.click())})),b.k0s(),b.j41(2,"input",20,21),b.bIt("change",(function(){b.eBV(t);const e=b.sdS(3),n=b.XpG(3);return b.Njj(n.onAttach(e))})),b.k0s(),b.bVm()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.R7$(1),b.Y8G("iconStart",e.icons.attach)("tuiHint",t.attach),b.R7$(1),b.Y8G("accept",e.attachOptions.accept)("multiple",e.attachOptions.multiple)("tabIndex",-1)}}function qe(t,e){if(1&t&&(b.j41(0,"div",6),b.DNE(1,Ve,1,2,"tui-font-style",10),b.DNE(2,We,1,1,"tui-align-content",11),b.DNE(3,Xe,1,1,"tui-list-configs",11),b.DNE(4,Ue,1,3,"button",12),b.DNE(5,Ke,1,3,"button",13),b.DNE(6,Je,1,3,"button",14),b.DNE(7,Ye,4,5,"ng-container",0),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("ngIf",t.formatEnabled),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Align)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.List)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Quote)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Link)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Anchor)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Attach))}}function Qe(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",19),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.toggleSubscript())})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("iconStart",e.icons.sub)("tuiHint",t.subscript)}}function Ze(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",19),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.toggleSuperscript())})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("iconStart",e.icons.sup)("tuiHint",t.superscript)}}function tn(t,e){if(1&t&&(b.j41(0,"div",6),b.DNE(1,Qe,1,2,"button",22),b.DNE(2,Ze,1,2,"button",22),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Sub)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Sup))}}function en(t,e){if(1&t&&b.nrm(0,"tui-text-color",24),2&t){const t=b.XpG(3);b.Y8G("colors",t.colors)("editor",t.editor)}}function nn(t,e){if(1&t&&b.nrm(0,"tui-highlight-color",24),2&t){const t=b.XpG(3);b.Y8G("colors",t.colors)("editor",t.editor)}}function on(t,e){if(1&t&&(b.j41(0,"div",6),b.DNE(1,en,1,2,"tui-text-color",23),b.DNE(2,nn,1,2,"tui-highlight-color",23),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Color)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Hilite))}}function rn(t,e){if(1&t&&b.nrm(0,"tui-code",9),2&t){const t=b.XpG(3);b.Y8G("editor",t.editor)}}function sn(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",27),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.onTeX())})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("iconStart",e.icons.tex)("tuiHint",t.tex)}}function an(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",28)(1,"button",29),b.bIt("click",(function(){b.eBV(t);const e=b.sdS(3);return b.Njj(e.click())})),b.k0s(),b.j41(2,"input",30,31),b.bIt("change",(function(){b.eBV(t);const e=b.sdS(3),n=b.XpG(3);return b.Njj(n.onImage(e))})),b.k0s()()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.R7$(1),b.Y8G("iconStart",e.icons.image)("tuiHint",t.image),b.R7$(1),b.Y8G("tabIndex",-1)}}function ln(t,e){if(1&t){const t=b.RV6();b.j41(0,"button",19),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(3);return b.Njj(e.insertHorizontalRule())})),b.k0s()}if(2&t){const t=b.XpG(2).ngIf,e=b.XpG();b.Y8G("iconStart",e.icons.hr)("tuiHint",t.insertHorizontalRule)}}function cn(t,e){if(1&t&&(b.j41(0,"div",6),b.DNE(1,rn,1,1,"tui-code",11),b.DNE(2,sn,1,2,"button",25),b.DNE(3,an,4,3,"div",26),b.DNE(4,ln,1,2,"button",22),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Code)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Tex)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Img)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.HR))}}function dn(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",6)(1,"button",19),b.bIt("click",(function(){b.eBV(t);const e=b.XpG(2);return b.Njj(e.removeFormat())})),b.k0s()()}if(2&t){const t=b.XpG().ngIf,e=b.XpG();b.R7$(1),b.Y8G("iconStart",e.icons.clear)("tuiHint",t.clear)}}function un(t,e){if(1&t&&(b.j41(0,"div",6),b.nrm(1,"tui-details",32)(2,"tui-details-remove",32),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("editor",t.editor),b.R7$(1),b.Y8G("editor",t.editor)}}function hn(t,e){if(1&t&&(b.j41(0,"div",6),b.nrm(1,"tui-editor-group-tool",32),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("editor",t.editor)}}function pn(t,e){if(1&t&&(b.j41(0,"div",6),b.nrm(1,"tui-table-create",32)(2,"tui-table-row-column-manager",32)(3,"tui-table-merge-cells",32),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("editor",t.editor),b.R7$(1),b.Y8G("editor",t.editor),b.R7$(1),b.Y8G("editor",t.editor)}}function fn(t,e){if(1&t&&(b.j41(0,"div",6),b.nrm(1,"tui-table-cell-color",24),b.k0s()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("colors",t.colors)("editor",t.editor)}}function mn(t,e){if(1&t&&(b.j41(0,"fieldset",4),b.DNE(1,Fe,3,6,"div",5),b.DNE(2,Ge,2,1,"div",5),b.DNE(3,qe,8,7,"div",5),b.DNE(4,tn,3,2,"div",5),b.DNE(5,on,3,2,"div",5),b.DNE(6,cn,5,4,"div",5),b.DNE(7,dn,2,2,"div",5),b.DNE(8,un,3,2,"div",5),b.DNE(9,hn,2,1,"div",5),b.DNE(10,pn,4,3,"div",5),b.DNE(11,fn,2,2,"div",5),b.j41(12,"div",6),b.SdG(13),b.k0s()()),2&t){const t=b.XpG();b.Y8G("disabled",t.disabled),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Undo)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Size)),b.R7$(1),b.Y8G("ngIf",t.firstBigBlockEnabled),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Sub)||t.enabled(t.editorTool.Sup)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Color)||t.enabled(t.editorTool.Hilite)),b.R7$(1),b.Y8G("ngIf",t.secondBigBlockEnabled),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Clear)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Details)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Group)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.Table)),b.R7$(1),b.Y8G("ngIf",t.enabled(t.editorTool.CellColor))}}const gn=["*"];let bn=(()=>{var t;class e{constructor(){this.dropdowns=Mt.xQ,this.filesLoader=(0,b.WQX)(E,{optional:!0}),this.destroyRef=(0,b.WQX)(b.abz),this.imageLoader=(0,b.WQX)(B),this.options=(0,b.WQX)(x),this.editorTool=r,this.injectionEditor=(0,b.WQX)(st,{optional:!0}),this.attachOptions=(0,b.WQX)(O),this.texts$=(0,b.WQX)(N),this.toolsSet=new Set(s),this.inputEditor=null,this.colors=this.options.colors,this.disabled=!1,this.linkAdded=new b.bkB,this.texClicked=new b.bkB,this.fileAttached=new b.bkB,this.el=(0,b.WQX)(b.aKT,{optional:!0})?.nativeElement??null}set tools(t){this.toolsSet=new Set(t)}get editor(){return this.injectionEditor??this.inputEditor}get icons(){return this.options.icons}get focused(){return(0,Pt.Ij)(this.el)||!!this.dropdowns.find((({nativeElement:t})=>(0,Pt.Ij)(t)))}get focusable(){return!this.focused&&!this.disabled}get unorderedList(){return this.editor?.isActive("bulletList")??!1}get orderedList(){return this.editor?.isActive("orderedList")??!1}get blockquote(){return this.editor?.isActive("blockquote")??!1}get a(){return this.editor?.isActive("link")??!1}get jumpAnchor(){return this.editor?.isActive("jumpAnchor")??!1}get undoDisabled(){return this.editor?.undoDisabled()??!1}get redoDisabled(){return this.editor?.redoDisabled()??!1}get subscript(){return this.editor?.isActive("subscript")??!1}get superscript(){return this.editor?.isActive("superscript")??!1}get formatEnabled(){return this.enabled(r.Bold)||this.enabled(r.Italic)||this.enabled(r.Underline)||this.enabled(r.Strikethrough)}get firstBigBlockEnabled(){return this.formatEnabled||this.enabled(r.Align)||this.enabled(r.List)||this.enabled(r.Quote)||this.enabled(r.Link)||this.enabled(r.Anchor)||this.enabled(r.Attach)}get secondBigBlockEnabled(){return this.enabled(r.Code)||this.enabled(r.Tex)||this.enabled(r.Img)||this.enabled(r.HR)}onMouseDown(t,e){e.closest("button")||(t.preventDefault(),this.editor?.focus())}onBottomFocus(){this.focusLast()}onTopFocus(){this.focusFirst()}onImage(t){const e=t.files?.[0];t.value="",e&&this.imageLoader(e).pipe((0,Pe.s)(1),(0,Q.pQ)(this.destroyRef)).subscribe((t=>this.addImage(t)))}onAttach(t){const e=Array.from(t.files||[]);t.value="",e&&this.filesLoader?.(e).pipe((0,Pe.s)(1),(0,Q.pQ)(this.destroyRef)).subscribe((t=>this.fileAttached.emit(t)))}onTeX(){this.texClicked.emit()}onLink(t){this.editor?.toggleLink(t??"")}enabled(t){return this.toolsSet.has(t)}undo(){this.editor?.undo()}redo(){this.editor?.redo()}insertHorizontalRule(){this.editor?.setHorizontalRule()}removeFormat(){this.editor?.removeFormat()}toggleOrderedList(){this.editor?.toggleOrderedList()}toggleQuote(){this.editor?.toggleBlockquote()}toggleSubscript(){this.editor?.toggleSubscript()}toggleSuperscript(){this.editor?.toggleSuperscript()}addImage(t){this.editor?.setImage(t)}focusFirst(){const t=this.navigationManager?.findFirstFocusableTool();t&&t.focus()}focusLast(){const t=this.navigationManager?.findFirstFocusableTool(!0);t&&t.focus()}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-toolbar"]],viewQuery:function(t,e){if(1&t&&(b.GBs(Be,5),b.GBs(_e,5,b.aKT)),2&t){let t;b.mGM(t=b.lsd())&&(e.navigationManager=t.first),b.mGM(t=b.lsd())&&(e.dropdowns=t)}},hostAttrs:["role","toolbar"],hostVars:2,hostBindings:function(t,e){1&t&&b.bIt("mousedown",(function(t){return e.onMouseDown(t,t.target)})),2&t&&b.AVh("_disabled",e.disabled)},inputs:{inputEditor:["editor","inputEditor"],colors:"colors",disabled:"disabled",tools:"tools"},outputs:{linkAdded:"linkAdded",texClicked:"texClicked",fileAttached:"fileAttached"},standalone:!0,features:[b.aNF],ngContentSelectors:gn,decls:5,vars:7,consts:[[4,"ngIf"],["tuiToolbarNavigationManager","","class","t-tools-wrapper",3,"disabled",4,"ngIf"],["type","button",1,"t-prevent-parent-label-behavior"],[3,"tabIndex","focus"],["tuiToolbarNavigationManager","",1,"t-tools-wrapper",3,"disabled"],["class","t-block",4,"ngIf"],[1,"t-block"],["appearance","icon","automation-id","toolbar__undo-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"disabled","iconStart","tuiHint","click"],["appearance","icon","automation-id","toolbar__redo-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"disabled","iconStart","tuiHint","click"],["tuiItem","",1,"t-tool","t-wrapper",3,"editor"],["tuiItem","","class","t-tool t-wrapper",3,"editor","enabledTools",4,"ngIf"],["tuiItem","","class","t-tool t-wrapper",3,"editor",4,"ngIf"],["appearance","icon","automation-id","toolbar__quote-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button","class","t-tool t-tool_margin",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","automation-id","toolbar__link-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button","class","t-tool",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click",4,"ngIf"],["tuiItem","",1,"t-tool","t-wrapper",3,"editor","enabledTools"],["appearance","icon","automation-id","toolbar__quote-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"disabled","iconStart","tuiHint","click"],["appearance","icon","automation-id","toolbar__link-button","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",1,"t-tool",3,"disabled","iconStart","tuiHint","click"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",3,"disabled","iconStart","tuiHint","click"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool","t-tool_margin",3,"iconStart","tuiHint","click"],["type","file",1,"t-file-upload",3,"accept","multiple","tabIndex","change"],["fileUpload",""],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button","class","t-tool t-tool_margin",3,"iconStart","tuiHint","click",4,"ngIf"],["tuiItem","","class","t-tool t-wrapper",3,"colors","editor",4,"ngIf"],["tuiItem","",1,"t-tool","t-wrapper",3,"colors","editor"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button","class","t-tool",3,"iconStart","tuiHint","click",4,"ngIf"],["tuiItem","","class","t-wrapper",4,"ngIf"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","tuiItem","","type","button",1,"t-tool",3,"iconStart","tuiHint","click"],["tuiItem","",1,"t-wrapper"],["appearance","icon","size","s","tuiHintDescribe","","tuiHintDirection","top-left","tuiIconButton","","type","button",1,"t-tool",3,"iconStart","tuiHint","click"],["accept","image/*","type","file",1,"t-image",3,"tabIndex","change"],["image",""],["tuiItem","",1,"t-tool","t-tool_margin",3,"editor"]],template:function(t,e){1&t&&(b.NAR(),b.DNE(0,He,4,2,"ng-container",0),b.DNE(1,je,1,0,"ng-container",0),b.nI1(2,"async"),b.DNE(3,mn,14,12,"fieldset",1),b.nI1(4,"async")),2&t&&(b.Y8G("ngIf",!e.disabled),b.R7$(1),b.Y8G("ngIf",b.bMT(2,3,null==e.editor?null:e.editor.stateChange$)),b.R7$(2),b.Y8G("ngIf",b.bMT(4,5,e.texts$)))},dependencies:[G.Jj,G.bT,Gt,K.p,Ut,Kt,Yt,ce,te,le,pe,jt.XZ,jt.$$,Bt.K,be,ve,Ee,Ae,$e,ze,Be],styles:['[_nghost-%COMP%]{position:relative;display:block;isolation:isolate}._disabled[_nghost-%COMP%]{pointer-events:none}tui-editor[_nghost-%COMP%] -no-combinator[_nghost-%COMP%] .t-tools-wrapper[_ngcontent-%COMP%]:has(.t-block:not(:empty)), tui-editor [_nghost-%COMP%] .t-tools-wrapper[_ngcontent-%COMP%]:has(.t-block:not(:empty)){border:none;outline:.0625rem solid var(--tui-border-normal)}.t-tools-wrapper[_ngcontent-%COMP%]{scrollbar-width:none;-ms-overflow-style:none;display:flex;overflow:auto;flex-wrap:wrap;padding:0;margin:0;border:0}.t-tools-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar, .t-tools-wrapper[_ngcontent-%COMP%]::-webkit-scrollbar-thumb{display:none}.t-tools-wrapper[_ngcontent-%COMP%]:has(.t-block:not(:empty)){padding:.25rem .75rem;border:.0625rem solid var(--tui-border-normal)}.t-tools-wrapper._disabled[_ngcontent-%COMP%]{pointer-events:none;opacity:var(--tui-disabled-opacity)}.t-block[_ngcontent-%COMP%]{display:flex;padding:.25rem 0}.t-block[_ngcontent-%COMP%]:empty{display:none}.t-block[_ngcontent-%COMP%]:not(:last-child):after{content:"";display:block;margin:0 .25rem;inline-size:.0625rem;background:var(--tui-background-neutral-1-pressed)}.t-tool[_ngcontent-%COMP%]{transition-property:background;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}button.t-tool[_ngcontent-%COMP%]:hover, .t-tool[_ngcontent-%COMP%] button:hover{background:var(--tui-background-neutral-1-hover)}.t-tool_margin[_ngcontent-%COMP%]{margin:0 .25rem}.t-dropdown[_ngcontent-%COMP%]{padding:.75rem}.t-wrapper[_ngcontent-%COMP%]{position:relative;margin:0 .25rem}.t-plate[_ngcontent-%COMP%]{position:absolute;top:1.9rem;left:.25rem;inline-size:1.5rem;block-size:.25rem;pointer-events:none}.t-plate_paint[_ngcontent-%COMP%]{left:.375rem;inline-size:1.25rem}.t-font[_ngcontent-%COMP%]{padding:.3em 0;outline:none;inline-size:100%;pointer-events:none}.t-image[_ngcontent-%COMP%]{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;font-size:0;opacity:0;cursor:pointer}.t-image[_ngcontent-%COMP%]::-webkit-file-upload-button{display:none}.t-file-upload[_ngcontent-%COMP%]{display:none}.t-color-picker[_ngcontent-%COMP%] tui-hosted-dropdown, .t-color-picker[_ngcontent-%COMP%] tui-color-picker, .t-color-picker[_ngcontent-%COMP%] tui-color-edit{display:none}.t-prevent-parent-label-behavior[_ngcontent-%COMP%]{display:none}'],changeDetection:0}),e})();function yn(t){if(!t?.state?.selection)return{before:"",after:""};const{$from:e,$to:n}=t.state.selection;let o=e.nodeBefore?.textContent;return o=(o?.slice(((o?.lastIndexOf(" ")||o?.lastIndexOf("\n"))??0)+1)??"").trim(),{before:o,after:n.nodeAfter?.textContent.trim()??""}}function kn(t){const e=t.endContainer.nodeValue?.length??0;return t.endOffset-t.startOffset>0||t.endOffset-t.startOffset==0&&1===e||0!==t.startOffset&&e>1&&t.endOffset!==e}var vn=n(8283),wn=n(2489),Cn=n(8129),xn=n(1472),Sn=n(6661);let Mn=(()=>{var t;class e extends Dt.Ak{}return(t=e).ɵfac=function(){let e;return function(n){return(e||(e=b.xGo(t)))(n||t)}}(),t.ɵprov=b.jDH({token:t,factory:t.ɵfac}),e})();const Tn=[{provide:v,deps:[k],useFactory:t=>{const e=new _.m(1);return Promise.all(t).then((t=>e.next(t))).catch((()=>e.next([]))),e}},{provide:F,deps:[b.sFG],useFactory:t=>t.createElement("div")},{provide:H,deps:[F,v,j,W.Qc],useFactory:(t,e,n,o)=>(0,It.z)([n,e]).pipe((0,Pe.s)(1),(0,P.T)((([e,n])=>{try{return globalThis.document||(globalThis.document=o.document),new e({element:t,extensions:n})}catch{return null}})),(0,Sn.t)({bufferSize:1,refCount:!0}))},st,Mn];let On=(()=>{var t;class e extends Tt.cf{constructor(){super(...arguments),this.el=(0,b.WQX)(b.aKT).nativeElement,this.type="viewport"}getClientRect(){return this.el.getBoundingClientRect()}}return(t=e).ɵfac=function(){let e;return function(n){return(e||(e=b.xGo(t)))(n||t)}}(),t.ɵdir=b.FsC({type:t,selectors:[["","tuiEditorPortal",""]],standalone:!0,features:[b.Jv_([{provide:Ht.Hg,useExisting:Mn},(0,Ot.HY)(t)]),b.Vt3]}),e})(),En=(()=>{var t;class e extends Dt.mi{}return(t=e).ɵfac=function(){let e;return function(n){return(e||(e=b.xGo(t)))(n||t)}}(),t.ɵcmp=b.VBU({type:t,selectors:[["tui-editor-portal-host"]],standalone:!0,features:[b.Jv_([{provide:Dt.Ak,useExisting:Ht.Hg},{provide:Dt.mi,useExisting:t}]),b.Vt3,b.aNF],decls:2,vars:0,consts:[["viewContainer",""]],template:function(t,e){1&t&&b.eu8(0,null,0)},styles:["[_nghost-%COMP%]{position:absolute;top:0;left:0;display:block;block-size:100%;inline-size:100%;pointer-events:none}"],changeDetection:0}),e})();var An=n(6242);const In=["tuiDropdown"];function Nn(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-toolbar",8),b.bIt("fileAttached",(function(e){b.eBV(t);const n=b.XpG(2);return b.Njj(n.fileAttached.emit(e))})),b.SdG(1,1),b.k0s()}if(2&t){const t=b.XpG(2);b.Y8G("disabled",!t.interactive())("tools",t.tools)}}function Dn(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",9),b.bIt("mousedown",(function(e){b.eBV(t);const n=b.XpG(2);return b.Njj(n.focus(e))})),b.EFF(1),b.k0s()}if(2&t){const t=b.XpG(2);b.R7$(1),b.SpI(" ",t.exampleText," ")}}function Rn(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-scrollbar",13),b.bIt("mousedown",(function(e){b.eBV(t);const n=b.XpG(3);return b.Njj(n.focus(e))})),b.eu8(1,14),b.k0s()}if(2&t){b.XpG();const t=b.sdS(4);b.R7$(1),b.Y8G("ngTemplateOutlet",t)}}function $n(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-scrollbar",15),b.bIt("keydown",(function(e){b.eBV(t);const n=b.XpG(3);return b.Njj(n.focus(e))}))("mousedown",(function(e){b.eBV(t);const n=b.XpG(3);return b.Njj(n.focus(e))})),b.eu8(1,14),b.nrm(2,"tui-editor-portal-host"),b.k0s()}if(2&t){b.XpG();const t=b.sdS(4);b.R7$(1),b.Y8G("ngTemplateOutlet",t)}}function Ln(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-toolbar",8),b.bIt("fileAttached",(function(e){b.eBV(t);const n=b.XpG(5);return b.Njj(n.fileAttached.emit(e))})),b.SdG(1,2),b.k0s()}if(2&t){const t=b.XpG(5);b.Y8G("disabled",!t.interactive())("tools",t.tools)}}function zn(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-edit-link",21,22),b.bIt("addLink",(function(e){b.eBV(t);const n=b.sdS(1),o=b.XpG(5);return n.anchorMode?o.addAnchor(e):o.addLink(e),b.Njj(o.closeDropdown())}))("removeLink",(function(){b.eBV(t);const e=b.sdS(1),n=b.XpG(5);return e.anchorMode?n.removeAnchor():n.removeLink(),b.Njj(n.closeDropdown())})),b.k0s()}}function Pn(t,e){1&t&&(b.qex(0),b.SdG(1,3),b.bVm())}function Bn(t,e){if(1&t&&(b.j41(0,"div"),b.DNE(1,Ln,2,2,"tui-toolbar",4),b.DNE(2,zn,2,0,"tui-edit-link",20),b.DNE(3,Pn,2,0,"ng-container",7),b.k0s()),2&t){const t=b.XpG(3).ngIf,e=b.XpG();b.AVh("t-floating",e.floatingToolbar),b.R7$(1),b.Y8G("ngIf",t&&e.floatingToolbar),b.R7$(1),b.Y8G("ngIf",e.isLinkSelected),b.R7$(1),b.Y8G("ngIf",e.isMentionMode)}}function _n(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",16,17)(2,"div",18),b.bIt("valueChange",(function(e){b.eBV(t);const n=b.XpG(3);return b.Njj(n.onModelChange(e))})),b.k0s()(),b.DNE(3,Bn,4,5,"ng-template",null,19,b.C5r)}if(2&t){const t=b.sdS(4),e=b.XpG(3);b.Y8G("tuiDropdown",t)("tuiToolbarDropdown",e.dropdownSelectionHandler)("tuiToolbarDropdownPosition",e.floatingToolbar?"selection":"tag"),b.R7$(2),b.Y8G("editable",e.interactive())("value",e.firstInitialValue)}}function Hn(t,e){if(1&t&&(b.qex(0),b.DNE(1,Rn,2,1,"tui-scrollbar",10),b.DNE(2,$n,3,1,"tui-scrollbar",11),b.DNE(3,_n,5,5,"ng-template",null,12,b.C5r),b.bVm()),2&t){const t=b.XpG(2);b.R7$(1),b.Y8G("ngIf",t.floatingToolbar),b.R7$(1),b.Y8G("ngIf",!t.floatingToolbar)}}function jn(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",2)(1,"div",3),b.DNE(2,Nn,2,2,"tui-toolbar",4),b.j41(3,"div",5),b.bIt("mousedown",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(n.focus(e))})),b.SdG(4),b.k0s(),b.DNE(5,Dn,2,1,"div",6),b.k0s(),b.DNE(6,Hn,5,2,"ng-container",7),b.k0s()}if(2&t){const t=e.ngIf,n=b.XpG();b.R7$(2),b.Y8G("ngIf",t&&!n.floatingToolbar),b.R7$(3),b.Y8G("ngIf",n.hasExampleText),b.R7$(1),b.Y8G("ngIf",t)}}const Fn=["*",[["tools"]],[["tools"]],[["mention"]]],Gn=["*","tools","tools","mention"];let Vn=(()=>{var t;class e extends Dt.OH{constructor(){super(...arguments),this.contentProcessor=(0,b.WQX)(T,{optional:!0}),this.doc=(0,b.WQX)(W.Qc)?.document??null,this.zone=(0,b.WQX)(b.SKi),this.destroy$=(0,b.WQX)(b.abz),this.options=(0,b.WQX)(x),this.editorLoaded$=(0,b.WQX)(H),this.sub=this.editorLoaded$.pipe((0,vn.c)(0),(0,Q.pQ)()).subscribe((()=>{this.hasMentionPlugin=!!this.editorService.getOriginTiptapEditor()?.extensionManager.extensions.find((t=>"mention"===t.name)),this.patchContentEditableElement(),this.listenResizeEvents()})),this.firstInitialValue="",this.exampleText=this.options.exampleText,this.floatingToolbar=this.options.floatingToolbar,this.tools=this.options.tools,this.fileAttached=new b.bkB,this.focusIn=new b.bkB,this.focusOut=new b.bkB,this.hasMentionPlugin=!1,this.hovered=(0,Q.ot)((0,wn.h)((0,Cn.R)((0,X.qW)(),"mouseenter").pipe((0,P.T)(Mt.z9)),(0,Cn.R)((0,X.qW)(),"mouseleave").pipe((0,P.T)(Mt.s_))).pipe((0,z.Eb)(this.cdr))),this.focused=(0,Rt.RM)(!1),this.m=(0,Rt.UP)(this.mode),this.s=(0,Rt.KC)((0,b.EWP)((()=>this.disabled()?"disabled":this.hovered()?"hover":null))),this.editorService=(0,b.WQX)(st),this.openDropdownWhen=t=>this.currentFocusedNodeIsTextAnchor(t)||this.currentFocusedNodeIsImageAnchor||this.isMentionMode}set readOnlyMode(t){this.readOnly.set(t)}get editor(){return this.editorService.getOriginTiptapEditor()?this.editorService:null}get nativeFocusableElement(){return this.el?.nativeElement?.querySelector("[contenteditable].ProseMirror")||null}get selectionState(){return yn(this.editor)}get mentionSuggestions(){const t=this.selectionState.before;return t?.startsWith("@")&&t.length>1&&t?.replace("@","")||""}get isMentionMode(){return this.hasMentionPlugin&&this.selectionState.before?.startsWith("@")}writeValue(t){const e=this.contentProcessor?.fromControlValue(t)??t;super.writeValue(e),this.firstInitialValue!==e&&(this.firstInitialValue=e??""),this.focused()||this.doc?.getSelection?.()?.removeAllRanges()}ngOnDestroy(){this.editor?.destroy()}get dropdownSelectionHandler(){return!this.focused()||this.readOnly()?Mt.s_:this.floatingToolbar?()=>""!==this.value().trim():this.openDropdownWhen}get hasExampleText(){return!!this.exampleText&&!this.value()&&!this.readOnly()}get isLinkSelected(){const t=this.doc?.getSelection()?.focusNode,e=t?.parentNode;return"a"===e?.nodeName.toLowerCase()||"a"===e?.parentNode?.nodeName.toLowerCase()||"a"===t?.nodeName.toLowerCase()||!!t?.parentElement?.closest("a")||!!t?.parentElement?.closest("tui-edit-link")||!!t?.parentElement?.closest("tui-dropdown")}onModelChange(t){const e=this.contentProcessor?.toControlValue(t)??t;e!==this.control.value&&this.onChange(e??"")}onActiveZone(t){this.focused.set(t),t?this.focusIn.emit():this.focusOut.emit()}addAnchor(t){this.editor?.setAnchor(t)}removeAnchor(){this.editor?.removeAnchor()}closeDropdown(){this.tuiDropdown?.toggle(!1)}addLink(t){this.editor?.selectClosest(),this.editor?.setLink(t)}removeLink(){this.editor?.unsetLink()}focus(t){this.nativeFocusableElement?.contains(t.target)||this.toolbar?.el?.contains(t.target)||(t.preventDefault(),this.nativeFocusableElement?.focus())}get focusNode(){return this.doc?.getSelection?.()?.focusNode??null}get currentFocusedNodeIsImageAnchor(){const t=this.focusNode?.childNodes[0]?.nodeName;return"A"===this.focusNode?.nodeName&&t&&["IMG","TUI-IMAGE-EDITOR"].includes(t)||!1}currentFocusedNodeIsTextAnchor(t){return"A"===this.focusNode?.nodeName||!!this.focusNode?.parentElement?.closest("tui-edit-link")||!!t.startContainer.parentElement?.closest("a")&&kn(t)}patchContentEditableElement(){this.nativeFocusableElement?.setAttribute("translate",this.options.translate),this.nativeFocusableElement?.setAttribute("spellcheck",String(this.options.spellcheck))}listenResizeEvents(){this.el?.nativeElement&&(0,Cn.R)(this.el.nativeElement,a).pipe((0,xn.c)(0),(0,z.rB)(this.zone),(0,Q.pQ)(this.destroy$)).subscribe((()=>this.editorService.valueChange$.next(this.editorService.getHTML())))}}return(t=e).ɵfac=function(){let e;return function(n){return(e||(e=b.xGo(t)))(n||t)}}(),t.ɵcmp=b.VBU({type:t,selectors:[["tui-editor"]],viewQuery:function(t,e){if(1&t&&(b.GBs(at,5,b.aKT),b.GBs(In,5),b.GBs(bn,5)),2&t){let t;b.mGM(t=b.lsd())&&(e.el=t.first),b.mGM(t=b.lsd())&&(e.tuiDropdown=t.first),b.mGM(t=b.lsd())&&(e.toolbar=t.first)}},hostAttrs:["ngSkipHydration","true"],hostBindings:function(t,e){1&t&&b.bIt("tuiActiveZoneChange",(function(t){return e.onActiveZone(t)}))("click",(function(t){return e.focus(t)}))},inputs:{exampleText:"exampleText",floatingToolbar:"floatingToolbar",tools:"tools",readOnlyMode:["readOnly","readOnlyMode"]},outputs:{fileAttached:"fileAttached",focusIn:"focusIn",focusOut:"focusOut"},standalone:!0,features:[b.Jv_([Tn,{provide:Rt.to,useValue:{appearance:"textfield"}},(0,U.fl)({delay:$t.mI,query:"[contenteditable].ProseMirror, input:not(.t-image, .t-file-upload), textarea, select"})]),b.Vt3,b.aNF,b.nM4([{directive:Rt.bC,inputs:["tuiAppearance","appearance"]},{directive:An.N,outputs:["tuiActiveZoneChange","tuiActiveZoneChange"]}])],ngContentSelectors:Gn,decls:3,vars:4,consts:[["class","t-wrapper",4,"ngIf"],[1,"t-hidden-editor",3,"content"],[1,"t-wrapper"],[1,"t-toolbar-wrapper"],[3,"disabled","tools","fileAttached",4,"ngIf"],[1,"t-editor-placeholder",3,"mousedown"],["class","t-editor-example-text",3,"mousedown",4,"ngIf"],[4,"ngIf"],[3,"disabled","tools","fileAttached"],[1,"t-editor-example-text",3,"mousedown"],["class","t-scrollbar",3,"mousedown",4,"ngIf"],["tuiEditorPortal","","class","t-scrollbar",3,"keydown","mousedown",4,"ngIf"],["editor",""],[1,"t-scrollbar",3,"mousedown"],[3,"ngTemplateOutlet"],["tuiEditorPortal","",1,"t-scrollbar",3,"keydown","mousedown"],["tuiDropdownLimitWidth","auto",3,"tuiDropdown","tuiToolbarDropdown","tuiToolbarDropdownPosition"],["tuiDropdown","tuiDropdown"],["tuiTiptapEditor","",1,"tui-editor-socket",3,"editable","value","valueChange"],["dropdown",""],[3,"addLink","removeLink",4,"ngIf"],[3,"addLink","removeLink"],["link",""]],template:function(t,e){1&t&&(b.NAR(Fn),b.DNE(0,jn,7,3,"div",0),b.nI1(1,"async"),b.nrm(2,"tui-editor-socket",1)),2&t&&(b.Y8G("ngIf",b.bMT(1,2,e.editorLoaded$)),b.R7$(2),b.Y8G("content",e.value()))},dependencies:[G.Jj,G.bT,G.T3,Ht.HY,Ht.pU,xt,Nt,On,En,zt,Y.N0,at,bn],styles:['[_nghost-%COMP%]{position:relative;display:block;isolation:isolate;font:var(--tui-font-text-m);border-radius:var(--tui-radius-m);max-block-size:inherit;min-block-size:10rem;box-sizing:border-box;overflow:auto}[_nghost-%COMP%]:after{content:"";display:table;clear:both}.t-wrapper[_ngcontent-%COMP%]{display:flex;block-size:100%;max-block-size:inherit;min-block-size:inherit;cursor:text;overflow:clip;flex-direction:column;border-radius:inherit}.t-editor-placeholder[_ngcontent-%COMP%]{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;font:var(--tui-font-text-s);color:var(--tui-text-secondary);pointer-events:none;will-change:transform;transform:translateY(-.25rem);inline-size:95%;font-size:.9375rem}.t-editor-placeholder_raised[_ngcontent-%COMP%]{transform:translateY(-.4375rem)}.t-editor-placeholder[_ngcontent-%COMP%]:not(:empty){margin:1rem 1rem -.625rem;min-block-size:1.625rem}.t-editor-placeholder[_ngcontent-%COMP%]:empty{margin-bottom:1rem}.t-editor-example-text[_ngcontent-%COMP%]{position:absolute;left:1rem;margin-top:.1875rem;color:var(--tui-text-secondary);letter-spacing:normal;text-transform:none}.t-scrollbar[_ngcontent-%COMP%]{display:flex;padding-bottom:.75rem;box-sizing:border-box;flex:1}.t-floating[_ngcontent-%COMP%], .t-floating[_ngcontent-%COMP%] .t-tools-wrapper{max-inline-size:var(--tui-floating-toolbar-max-width, 31.25rem);flex-wrap:nowrap}'],changeDetection:0}),e})();var Wn=n(6426);class Xn{constructor(t,e,n){const o=e.get(b.o8S),i=e.get(b.OM3).resolveComponentFactory(t);this.componentRef=i.create(e,[]),this.updateProps(n),o.attachView(this.componentRef.hostView)}get el(){return this.componentRef.injector.get(b.aKT)}get dom(){return this.el.nativeElement}updateProps(t){Object.entries(t).forEach((([t,e])=>{this.instance[t]=e}))}detectChanges(){this.componentRef.changeDetectorRef.detectChanges()}destroy(){this.componentRef.destroy()}get instance(){return this.componentRef.instance}}class Un{}class Kn extends Wn.NodeView{constructor(t,e,n){super(t,e,n),this.contentDOMElement=null}get dom(){return this.renderer.dom}get contentDOM(){return this.node.isLeaf?null:this.contentDOMElement}mount(){const t=this.options.injector,e=t.get(G.qQ),n={editor:this.editor,node:this.node,decorations:this.decorations,selected:!1,extension:this.extension,getPos:()=>this.getPos(),updateAttributes:(t={})=>this.updateAttributes(t),deleteNode:()=>this.deleteNode(),view:this.view,innerDecorations:this.innerDecorations,HTMLAttributes:this.HTMLAttributes};this.editor.on("selectionUpdate",this.handleSelectionUpdate.bind(this)),this.renderer=new Xn(this.component,t,n),this.extension.config.draggable&&(this.renderer.el.nativeElement.ondragstart=t=>{this.onDragStart(t)});const o=this.node.isInline?"span":"div";this.contentDOMElement=this.node.isLeaf?null:e.createElement(o),this.contentDOMElement&&(this.contentDOMElement.style.whiteSpace="inherit",this.renderer.detectChanges()),this.appendContendDom()}update(t,e){return this.options.update?this.options.update(t,e):t.type===this.node.type&&(t===this.node&&this.decorations===e||(this.node=t,this.decorations=e,this.renderer.updateProps({node:t,decorations:e}),this.appendContendDom()),!0)}handleSelectionUpdate(){const{from:t,to:e}=this.editor.state.selection;t<=this.getPos()&&e>=this.getPos()+this.node.nodeSize?this.selectNode():this.deselectNode()}selectNode(){this.renderer.updateProps({selected:!0})}deselectNode(){this.renderer.updateProps({selected:!1})}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate.bind(this)),this.contentDOMElement=null}appendContendDom(){const t=this.dom.querySelector("[data-node-view-content]");this.contentDOMElement&&t&&!t.contains(this.contentDOMElement)&&t.appendChild(this.contentDOMElement)}}let Jn=(()=>{var t;class e extends Un{constructor(){super(...arguments),this.currentHeight=0,this.currentWidth=0}get node(){return this.localNode}set node(t){this.localNode=t,this.changeDetector.markForCheck()}get attrs(){return this.node?.attrs||{src:""}}get width(){return(this.currentWidth||this.attrs.width)??null}get height(){return(this.currentHeight||this.attrs.height)??null}}return(t=e).ɵfac=function(){let e;return function(n){return(e||(e=b.xGo(t)))(n||t)}}(),t.ɵdir=b.FsC({type:t,features:[b.Vt3]}),e})();var Yn=n(6625);const qn=["container"],Qn=function(){return[0,1]};function Zn(t,e){if(1&t){const t=b.RV6();b.j41(0,"div",5),b.bIt("tuiSizeChange",(function(e){b.eBV(t);const n=b.XpG();return b.Njj(n.sizeChange.emit(e))})),b.k0s()}2&t&&b.Y8G("tuiResizer",b.lJ4(1,Qn))}const to=function(t){return[t,0]},eo=function(){return[1,0]},no=["*"];let oo=(()=>{var t;class e{constructor(){this.autoHeight=!1,this.width=null,this.height=null,this.sizeChange=new b.bkB}get hostWidth(){return(0,w.sZ)(this.width)?(0,w.Pp)(this.width):this.width}get hostHeight(){return this.autoHeight?null:(0,w.sZ)(this.height)?(0,w.Pp)(this.height):this.height}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=b.VBU({type:t,selectors:[["tui-editor-resizable"]],viewQuery:function(t,e){if(1&t&&b.GBs(qn,7),2&t){let t;b.mGM(t=b.lsd())&&(e.container=t.first)}},hostVars:4,hostBindings:function(t,e){2&t&&b.xc7("width",e.hostWidth)("height",e.hostHeight)},inputs:{autoHeight:"autoHeight",width:"width",height:"height"},outputs:{sizeChange:"sizeChange"},standalone:!0,features:[b.aNF],ngContentSelectors:no,decls:6,vars:8,consts:[["tuiResizable","",1,"t-resizable"],["container",""],[1,"t-handle","t-handle-left-side",3,"tuiResizer","tuiSizeChange"],["class","t-handle t-handle-bottom-side",3,"tuiResizer","tuiSizeChange",4,"ngIf"],[1,"t-handle","t-handle-right-side",3,"tuiResizer","tuiSizeChange"],[1,"t-handle","t-handle-bottom-side",3,"tuiResizer","tuiSizeChange"]],template:function(t,e){1&t&&(b.NAR(),b.j41(0,"div",0,1),b.SdG(2),b.j41(3,"div",2),b.bIt("tuiSizeChange",(function(t){return e.sizeChange.emit(t)})),b.k0s(),b.DNE(4,Zn,1,2,"div",3),b.j41(5,"div",4),b.bIt("tuiSizeChange",(function(t){return e.sizeChange.emit(t)})),b.k0s()()),2&t&&(b.AVh("t-resizable-auto-height",e.autoHeight),b.R7$(3),b.Y8G("tuiResizer",b.eq3(5,to,-1)),b.R7$(1),b.Y8G("ngIf",!e.autoHeight),b.R7$(1),b.Y8G("tuiResizer",b.lJ4(7,eo)))},dependencies:[G.bT,Yn.K,Yn.z],styles:['[_nghost-%COMP%]{position:relative;display:inline-block;box-sizing:border-box}[_nghost-%COMP%] .t-resizable[_ngcontent-%COMP%]{box-sizing:border-box}[_nghost-%COMP%] .t-resizable-auto-height[_ngcontent-%COMP%]{block-size:auto!important}[_nghost-%COMP%] iframe[_ngcontent-%COMP%]{display:inline;pointer-events:none}[_nghost-%COMP%]:hover .t-handle[_ngcontent-%COMP%]:after{opacity:1}.t-handle[_ngcontent-%COMP%]{position:absolute;top:0;display:flex;inline-size:.75rem;cursor:col-resize;justify-content:center;align-items:center;block-size:100%}.t-handle[_ngcontent-%COMP%]:after{transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;content:"";inline-size:50%;block-size:33%;box-sizing:border-box;border-radius:var(--tui-radius-m);background:var(--tui-background-accent-opposite-hover);border:.0625rem solid var(--tui-background-neutral-1-hover);opacity:0}.t-handle-left-side[_ngcontent-%COMP%]{left:0}.t-handle-bottom-side[_ngcontent-%COMP%]{top:unset;bottom:.3125rem;block-size:.95rem;inline-size:100%}.t-handle-right-side[_ngcontent-%COMP%]{right:0}'],changeDetection:0}),e})();const io=Wn.Extension.create({name:"backgroundColor",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,renderHTML:({backgroundColor:t})=>t?{style:`background-color: ${t}`}:{},parseHTML:({style:t})=>t.backgroundColor.replaceAll(/['"]+/g,""),keepOnSplit:!1}}}]},addCommands:()=>({setBackgroundColor:t=>({chain:e})=>e().setMark("textStyle",{backgroundColor:t}).run(),unsetBackgroundColor:()=>({chain:t})=>t().setMark("textStyle",{backgroundColor:null}).run()})});function ro(t,e){const n=e??t.selection.$head.parent.textContent,o=t.doc.cut(t.selection.from,t.selection.to);return o.content.size?(0,Wn.getHTMLFromFragment)(o.content,t.schema):n}function so(t,e,n){const o=t.selection.$anchor;for(let i=o.depth;i>0;i--)if(o.node(i).type.name===n)return e&&e(t.tr.delete(o.before(i),o.after(i)).scrollIntoView()),!0;return!1}const ao=Wn.Node.create({name:"details",addOptions:()=>({HTMLAttributes:{}}),addAttributes:()=>({opened:{default:!0,keepOnSplit:!1,parseHTML:t=>"true"===t.getAttribute("data-opened"),renderHTML:t=>({"data-opened":t.opened})}}),content:"summary detailsContent",group:"block",draggable:!0,allowGapCursor:!0,isolating:!0,parseHTML:()=>[{tag:"details"}],renderHTML({HTMLAttributes:t}){return["div",{class:"t-details-wrapper t-details-wrapper_rendered"},["details",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t),0],["button",{class:"t-details-arrow"}]]},addNodeView(){return({node:t,getPos:e})=>{if(globalThis.document){const n=document.createElement("div"),o=document.createElement("details"),i=document.createElement("button"),r=document.createElement("button");n.className="t-details-wrapper",i.className="t-details-arrow",i.type="button",r.className="t-details-delete",r.type="button",o.open=t.attrs.opened;const s=n=>{const i=e?.()??0;o.open=!o.open,t.attrs.opened=o.open,n.target?.dispatchEvent(new CustomEvent(a,{bubbles:!0})),this.editor.chain().focus().setTextSelection(i).run()};return i.addEventListener("click",s),r.addEventListener("click",(t=>{i.removeEventListener("click",s);const n=e?.()??0;this.editor.chain().focus().setTextSelection(e?.()).run();const o=this.editor.state.selection.$anchor.nodeAfter,r=n+(o?.nodeSize??0);this.editor.isActive("summary")?this.editor.commands.deleteNode(this.type):this.editor.commands.deleteRange({from:n,to:r}),t.preventDefault()}),{capture:!0,once:!0}),n.append(o,i,r),{dom:n,contentDOM:o}}}},addCommands(){return{setDetails:()=>({commands:t,editor:e,state:n})=>{let o="";const i=this.editor.state.selection.$anchor.pos;return globalThis.document&&(o=(document.defaultView?.window.getSelection()?.toString().trim().length??0)>0?ro(n):"",setTimeout((()=>e.chain().focus().setTextSelection(i).run()))),t.insertContent(`

${o}

`)},removeDetails:()=>({editor:t,state:e,dispatch:n})=>(so(e,n,this.name),t.commands.focus("end"))}}}),lo=Wn.Node.create({name:"detailsContent",content:"block+",group:"block",allowGapCursor:!0,parseHTML:()=>[{tag:'div[data-type="details-content"]'}],renderHTML({HTMLAttributes:t}){return["div",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t,{"data-type":"details-content"}),0]}}),co=Wn.Node.create({name:"summary",addOptions:()=>({HTMLAttributes:{}}),content:"paragraph",group:"block",parseHTML:()=>[{tag:"summary"}],renderHTML({HTMLAttributes:t}){return["summary",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t),0]}}),uo=Wn.Extension.create({name:"fileLink",addCommands:()=>({setFileLink:t=>({state:e,chain:n})=>{const{selection:o}=e,i=' ';return(Math.abs(o.to-o.from)>0?n().toggleMark("link",{href:t.link},{extendEmptyMarkRange:!0}).setTextSelection(o.to).insertContent(i):n().insertContent(`${t.name}${i}`)).setTextSelection(o.to).run()}})}),ho=Wn.Extension.create({name:"fontColor",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontColor:{default:null,renderHTML:({fontColor:t})=>t?{style:`color: ${t}`}:{},parseHTML:({style:t})=>t.color.replaceAll(/['"]+/g,""),keepOnSplit:!1}}}]},addCommands:()=>({setFontColor:t=>({chain:e})=>e().setMark("textStyle",{fontColor:t}).run(),unsetFontColor:()=>({chain:t})=>t().setMark("textStyle",{fontColor:null}).run()})}),po=Wn.Extension.create({name:"fontSize",addOptions:()=>({types:["textStyle"]}),addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:({style:t})=>t.fontSize,renderHTML:({fontSize:t})=>t?{style:`font-size: ${t}`}:{}}}}]},addCommands:()=>({setFontSize:t=>({chain:e})=>e().setMark("textStyle",{fontSize:t}).run(),unsetFontSize:()=>({chain:t})=>t().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()})});function fo(t){return t.isActive("bulletList")||t.isActive("orderedList")||t.isActive("taskList")}const mo=Wn.Extension.create({name:"indent",addKeyboardShortcuts(){return{Tab:()=>!fo(this.editor)&&this.editor.commands.insertContent("\t")}}}),go=Wn.Mark.create({name:"jumpAnchor",priority:1e3,keepOnSplit:!1,addAttributes:()=>({id:{default:null,parseHTML:t=>t.getAttribute("id"),renderHTML:t=>t.id?{id:t.id}:{}}}),parseHTML:()=>[{tag:'a[data-type="jump-anchor"]'}],renderHTML:({HTMLAttributes:t})=>["a",(0,Wn.mergeAttributes)({"data-type":"jump-anchor"},t),0],addCommands(){return{setAnchor:t=>({chain:e})=>e().extendMarkRange("jumpAnchor").setMark("jumpAnchor",{id:t}).run(),removeAnchor:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).run()}}});function bo(t){return t.reduce(((t,e)=>(t[e]={parseHTML:t=>t?.getAttribute(`${e}`)},t)),{})}const yo=(t,e)=>{for(const n in e)t[n]=e[n];return t},ko="numeric",vo="ascii",wo="alpha",Co="asciinumeric",xo="alphanumeric",So="domain",Mo="emoji",To="scheme",Oo="slashscheme",Eo="whitespace";function Ao(t,e){return t in e||(e[t]=[]),e[t]}function Io(t,e,n){e[ko]&&(e[Co]=!0,e[xo]=!0),e[vo]&&(e[Co]=!0,e[wo]=!0),e[Co]&&(e[xo]=!0),e[wo]&&(e[xo]=!0),e[xo]&&(e[So]=!0),e[Mo]&&(e[So]=!0);for(const o in e){const e=Ao(o,n);e.indexOf(t)<0&&e.push(t)}}function No(t){void 0===t&&(t=null),this.j={},this.jr=[],this.jd=null,this.t=t}No.groups={},No.prototype={accepts(){return!!this.t},go(t){const e=this,n=e.j[t];if(n)return n;for(let n=0;n=0&&(n[o]=!0);return n}(s.t,o),n);Io(r,t,o)}else n&&Io(r,n,o);s.t=r}return i.j[t]=s,s}};const Do=(t,e,n,o,i)=>t.ta(e,n,o,i),Ro=(t,e,n,o,i)=>t.tr(e,n,o,i),$o=(t,e,n,o,i)=>t.ts(e,n,o,i),Lo=(t,e,n,o,i)=>t.tt(e,n,o,i),zo="WORD",Po="UWORD",Bo="LOCALHOST",_o="TLD",Ho="UTLD",jo="SCHEME",Fo="SLASH_SCHEME",Go="NUM",Vo="NL",Wo="OPENBRACE",Xo="CLOSEBRACE",Uo="OPENBRACKET",Ko="CLOSEBRACKET",Jo="OPENPAREN",Yo="CLOSEPAREN",qo="OPENANGLEBRACKET",Qo="CLOSEANGLEBRACKET",Zo="FULLWIDTHLEFTPAREN",ti="FULLWIDTHRIGHTPAREN",ei="LEFTCORNERBRACKET",ni="RIGHTCORNERBRACKET",oi="LEFTWHITECORNERBRACKET",ii="RIGHTWHITECORNERBRACKET",ri="FULLWIDTHLESSTHAN",si="FULLWIDTHGREATERTHAN",ai="AMPERSAND",li="APOSTROPHE",ci="ASTERISK",di="AT",ui="BACKSLASH",hi="BACKTICK",pi="CARET",fi="COLON",mi="COMMA",gi="DOLLAR",bi="DOT",yi="EQUALS",ki="EXCLAMATION",vi="HYPHEN",wi="PERCENT",Ci="PIPE",xi="PLUS",Si="POUND",Mi="QUERY",Ti="QUOTE",Oi="SEMI",Ei="SLASH",Ai="TILDE",Ii="UNDERSCORE",Ni="EMOJI",Di="SYM";var Ri=Object.freeze({__proto__:null,WORD:zo,UWORD:Po,LOCALHOST:Bo,TLD:_o,UTLD:Ho,SCHEME:jo,SLASH_SCHEME:Fo,NUM:Go,WS:"WS",NL:Vo,OPENBRACE:Wo,CLOSEBRACE:Xo,OPENBRACKET:Uo,CLOSEBRACKET:Ko,OPENPAREN:Jo,CLOSEPAREN:Yo,OPENANGLEBRACKET:qo,CLOSEANGLEBRACKET:Qo,FULLWIDTHLEFTPAREN:Zo,FULLWIDTHRIGHTPAREN:ti,LEFTCORNERBRACKET:ei,RIGHTCORNERBRACKET:ni,LEFTWHITECORNERBRACKET:oi,RIGHTWHITECORNERBRACKET:ii,FULLWIDTHLESSTHAN:ri,FULLWIDTHGREATERTHAN:si,AMPERSAND:ai,APOSTROPHE:li,ASTERISK:ci,AT:di,BACKSLASH:ui,BACKTICK:hi,CARET:pi,COLON:fi,COMMA:mi,DOLLAR:gi,DOT:bi,EQUALS:yi,EXCLAMATION:ki,HYPHEN:vi,PERCENT:wi,PIPE:Ci,PLUS:xi,POUND:Si,QUERY:Mi,QUOTE:Ti,SEMI:Oi,SLASH:Ei,TILDE:Ai,UNDERSCORE:Ii,EMOJI:Ni,SYM:Di});const $i=/[a-z]/,Li=/\p{L}/u,zi=/\p{Emoji}/u,Pi=/\d/,Bi=/\s/;let _i=null,Hi=null;function ji(t,e,n,o,i){let r;const s=e.length;for(let n=0;n=0;)i++;if(i>0){e.push(n.join(""));for(let e=parseInt(t.substring(o,o+i),10);e>0;e--)n.pop();o+=i}else n.push(t[o]),o++}return e}const Gi={defaultProtocol:"http",events:null,format:Wi,formatHref:Wi,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Vi(t,e){void 0===e&&(e=null);let n=yo({},Gi);t&&(n=yo(n,t instanceof Vi?t.o:t));const o=n.ignoreTags,i=[];for(let t=0;tt,check(t){return this.get("validate",t.toString(),t)},get(t,e,n){const o=null!=e;let i=this.o[t];return i?("object"==typeof i?(i=n.t in i?i[n.t]:Gi[t],"function"==typeof i&&o&&(i=i(e,n))):"function"==typeof i&&o&&(i=i(e,n.t,n)),i):i},getObj(t,e,n){let o=this.o[t];return"function"==typeof o&&null!=e&&(o=o(e,n.t,n)),o},render(t){const e=t.render(this);return(this.get("render",null,t)||this.defaultRender)(e,t.t,t)}},Xi.prototype={isLink:!1,toString(){return this.v},toHref(t){return this.toString()},toFormattedString(t){const e=this.toString(),n=t.get("truncate",e,this),o=t.get("format",e,this);return n&&o.length>n?o.substring(0,n)+"…":o},toFormattedHref(t){return t.get("formatHref",this.toHref(t.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(t){return void 0===t&&(t=Gi.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(t),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(t){return{type:this.t,value:this.toFormattedString(t),isLink:this.isLink,href:this.toFormattedHref(t),start:this.startIndex(),end:this.endIndex()}},validate(t){return t.get("validate",this.toString(),this)},render(t){const e=this,n=this.toHref(t.get("defaultProtocol")),o=t.get("formatHref",n,this),i=t.get("tagName",n,e),r=this.toFormattedString(t),s={},a=t.get("className",n,e),l=t.get("target",n,e),c=t.get("rel",n,e),d=t.getObj("attributes",n,e),u=t.getObj("events",n,e);return s.href=o,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),d&&yo(s,d),{tagName:i,attributes:s,content:r,eventListeners:u}}};const Ki=Ui("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Ji=Ui("text"),Yi=Ui("nl"),qi=Ui("url",{isLink:!0,toHref(t){return void 0===t&&(t=Gi.defaultProtocol),this.hasProtocol()?this.v:`${t}://${this.v}`},hasProtocol(){const t=this.tk;return t.length>=2&&t[0].t!==Bo&&t[1].t===fi}}),Qi=t=>new No(t);function Zi(t,e,n){const o=n[0].s,i=n[n.length-1].e;return new t(e.slice(o,i),n)}const tr="undefined"!=typeof console&&console&&console.warn||(()=>{}),er={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function nr(t,e){if(void 0===e&&(e=!1),er.initialized&&tr(`linkifyjs: already initialized - will not register custom scheme "${t}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(t))throw new Error('linkifyjs: incorrect scheme format.\n1. Must only contain digits, lowercase ASCII letters or "-"\n2. Cannot start or end with "-"\n3. "-" cannot repeat');er.customSchemes.push([t,e])}function or(t){return er.initialized||function(){er.scanner=function(t){void 0===t&&(t=[]);const e={};No.groups=e;const n=new No;null==_i&&(_i=Fi("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Hi&&(Hi=Fi("ελ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")),Lo(n,"'",li),Lo(n,"{",Wo),Lo(n,"}",Xo),Lo(n,"[",Uo),Lo(n,"]",Ko),Lo(n,"(",Jo),Lo(n,")",Yo),Lo(n,"<",qo),Lo(n,">",Qo),Lo(n,"(",Zo),Lo(n,")",ti),Lo(n,"「",ei),Lo(n,"」",ni),Lo(n,"『",oi),Lo(n,"』",ii),Lo(n,"<",ri),Lo(n,">",si),Lo(n,"&",ai),Lo(n,"*",ci),Lo(n,"@",di),Lo(n,"`",hi),Lo(n,"^",pi),Lo(n,":",fi),Lo(n,",",mi),Lo(n,"$",gi),Lo(n,".",bi),Lo(n,"=",yi),Lo(n,"!",ki),Lo(n,"-",vi),Lo(n,"%",wi),Lo(n,"|",Ci),Lo(n,"+",xi),Lo(n,"#",Si),Lo(n,"?",Mi),Lo(n,'"',Ti),Lo(n,"/",Ei),Lo(n,";",Oi),Lo(n,"~",Ai),Lo(n,"_",Ii),Lo(n,"\\",ui);const o=Ro(n,Pi,Go,{[ko]:!0});Ro(o,Pi,o);const i=Ro(n,$i,zo,{[vo]:!0});Ro(i,$i,i);const r=Ro(n,Li,Po,{[wo]:!0});Ro(r,$i),Ro(r,Li,r);const s=Ro(n,Bi,"WS",{[Eo]:!0});Lo(n,"\n",Vo,{[Eo]:!0}),Lo(s,"\n"),Ro(s,Bi,s);const a=Ro(n,zi,Ni,{[Mo]:!0});Ro(a,zi,a),Lo(a,"️",a);const l=Lo(a,"‍");Ro(l,zi,a);const c=[[$i,i]],d=[[$i,null],[Li,r]];for(let t=0;t<_i.length;t++)ji(n,_i[t],_o,zo,c);for(let t=0;tt[0]>e[0]?1:-1));for(let e=0;e=0?i[So]=!0:$i.test(o)?Pi.test(o)?i[Co]=!0:i[vo]=!0:i[ko]=!0,$o(n,o,o,i)}return $o(n,"localhost",Bo,{ascii:!0}),n.jd=new No(Di),{start:n,tokens:yo({groups:e},Ri)}}(er.customSchemes);for(let t=0;t=0&&h++,i++,d++;if(h<0)i-=d,i0&&(r.push(Zi(Ji,e,s)),s=[]),i-=h,d-=h;const t=u.t,o=n.slice(i-d,i);r.push(Zi(t,e,o))}}return s.length>0&&r.push(Zi(Ji,e,s)),r}(er.parser.start,t,function(t,e){const n=function(t){const e=[],n=t.length;let o=0;for(;o56319||o+1===n||(i=t.charCodeAt(o+1))<56320||i>57343?t[o]:t.slice(o,o+2);e.push(s),o+=s.length}return e}(e.replace(/[A-Z]/g,(t=>t.toLowerCase()))),o=n.length,i=[];let r=0,s=0;for(;s=0&&(u+=n[s].length,h++),c+=n[s].length,r+=n[s].length,s++;r-=u,s-=h,c-=u,i.push({t:d.t,v:e.slice(r-c,r),s:r-c,e:r})}return i}(er.scanner.start,t))}function ir(t,e,n){if(void 0===e&&(e=null),void 0===n&&(n=null),e&&"object"==typeof e){if(n)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);n=e,e=null}const o=new Vi(n),i=or(t),r=[];for(let t=0;t{const e="string"==typeof t?t:t.scheme;e&&n.push(e)})),!t||t.replace(rr,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}const ar=Wn.Mark.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.protocols.forEach((t=>{"string"!=typeof t?nr(t.scheme,t.optionalSlashes):nr(t)}))},onDestroy(){No.groups={},er.scanner=null,er.parser=null,er.tokenQueue=[],er.pluginQueue=[],er.customSchemes=[],er.initialized=!1},inclusive(){return this.options.autolink},addOptions:()=>({openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:t=>!!t}),addAttributes(){return{href:{default:null,parseHTML:t=>t.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:t=>{const e=t.getAttribute("href");return!(!e||!sr(e,this.options.protocols))&&null}}]},renderHTML({HTMLAttributes:t}){return sr(t.href,this.options.protocols)?["a",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t),0]:["a",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,{...t,href:""}),0]},addCommands(){return{setLink:t=>({chain:e})=>e().setMark(this.name,t).setMeta("preventAutolink",!0).run(),toggleLink:t=>({chain:e})=>e().toggleMark(this.name,t,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:t})=>t().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[(0,Wn.markPasteRule)({find:t=>{const e=[];if(t){const{validate:n}=this.options,o=ir(t).filter((t=>t.isLink&&n(t.value)));o.length&&o.forEach((t=>e.push({text:t.value,data:{href:t.href},index:t.start})))}return e},type:this.type,getAttributes:t=>{var e;return{href:null===(e=t.data)||void 0===e?void 0:e.href}}})]},addProseMirrorPlugins(){const t=[];return this.options.autolink&&t.push((e={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:this.options.validate},new nt.k_({key:new nt.hs("autolink"),appendTransaction:(t,n,o)=>{const i=t.some((t=>t.docChanged))&&!n.doc.eq(o.doc),r=t.some((t=>t.getMeta("preventAutolink")));if(!i||r)return;const{tr:s}=o,a=(0,Wn.combineTransactionSteps)(n.doc,[...t]);return(0,Wn.getChangedRanges)(a).forEach((({newRange:t})=>{const n=(0,Wn.findChildrenInRange)(o.doc,t,(t=>t.isTextblock));let i,r;if(n.length>1?(i=n[0],r=o.doc.textBetween(i.pos,i.pos+i.node.nodeSize,void 0," ")):n.length&&o.doc.textBetween(t.from,t.to," "," ").endsWith(" ")&&(i=n[0],r=o.doc.textBetween(i.pos,t.to,void 0," ")),i&&r){const t=r.split(" ").filter((t=>""!==t));if(t.length<=0)return!1;const n=t[t.length-1],l=i.pos+r.lastIndexOf(n);if(!n)return!1;const c=or(n).map((t=>t.toObject(e.defaultProtocol)));if(!(1===(a=c).length?a[0].isLink:3===a.length&&a[1].isLink&&["()","[]"].includes(a[0].value+a[2].value)))return!1;c.filter((t=>t.isLink)).map((t=>({...t,from:l+t.start+1,to:l+t.end+1}))).filter((t=>!o.schema.marks.code||!o.doc.rangeHasMark(t.from,t.to,o.schema.marks.code))).filter((t=>e.validate(t.value))).forEach((t=>{(0,Wn.getMarksBetween)(t.from,t.to,o.doc).some((t=>t.mark.type===e.type))||s.addMark(t.from,t.to,e.type.create({href:t.href}))}))}var a})),s.steps.length?s:void 0}}))),!0===this.options.openOnClick&&t.push(function(t){return new nt.k_({key:new nt.hs("handleClickLink"),props:{handleClick:(e,n,o)=>{var i,r;if(0!==o.button)return!1;if(!e.editable)return!1;let s=o.target;const a=[];for(;"DIV"!==s.nodeName;)a.push(s),s=s.parentNode;if(!a.find((t=>"A"===t.nodeName)))return!1;const l=(0,Wn.getAttributes)(e.state,t.type.name),c=o.target,d=null!==(i=null==c?void 0:c.href)&&void 0!==i?i:l.href,u=null!==(r=null==c?void 0:c.target)&&void 0!==r?r:l.target;return!(!c||!d||(window.open(d,u),0))}}})}({type:this.type})),this.options.linkOnPaste&&t.push(function(t){return new nt.k_({key:new nt.hs("handlePasteLink"),props:{handlePaste:(e,n,o)=>{const{state:i}=e,{selection:r}=i,{empty:s}=r;if(s)return!1;let a="";o.content.forEach((t=>{a+=t.textContent}));const l=ir(a,{defaultProtocol:t.defaultProtocol}).find((t=>t.isLink&&t.value===a));return!(!a||!l||(t.editor.commands.setMark(t.type,{href:l.href}),0))}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),t;var e}}),lr=ar.extend({addAttributes(){return{...this.parent?.(),...bo(["download"])}},addCommands(){return{...this.parent?.(),toggleLink:t=>({chain:e,state:n})=>{{const{selection:o,doc:i,schema:r}=n,s=i.cut(o.to,o.to+1),a=" "===(0,Wn.getHTMLFromFragment)(s.content,r).replaceAll(/<\/?[^>]+(>|$)/g,""),l=e().toggleMark(this.name,t,{extendEmptyMarkRange:!0});return(a?l.setTextSelection(o.to-1):l.setTextSelection(o.to).insertContent(' ').setTextSelection(o.to-1)).run()}}}},addPasteRules(){return[(0,Wn.markPasteRule)({find:t=>ir(t).filter((t=>this.options.validate?.(t.value)??!0)).filter((t=>t.isLink)).map((t=>({text:t.value,index:t.start,data:t}))),type:this.type,getAttributes:t=>({href:t.data?.href})})]}}).configure({openOnClick:!1}),cr=Wn.Extension.create({name:"customEnter",addKeyboardShortcuts(){return{Enter:({editor:t})=>t.isActive("summary")?(t.commands.selectNodeForward(),t?.commands.focus((t?.state.selection.anchor??0)+1),globalThis.document&&t.view.nodeDOM(t.state.selection.anchor)?.parentElement?.closest("details")?.querySelector('[data-type="details-content"]')?.prepend(document.createElement("p")),!1):this.editor.chain().createParagraphNear().run()}}}),dr=n(3161).d.extend({addCommands(){return{setHorizontalRule:()=>({chain:t,state:e,editor:n})=>{const{selection:o}=e,{$from:i,$to:r}=o,s=t();return!n.isActive("summary")&&(0===i.parentOffset?(s.insertContentAt({from:Math.max(i.pos-1,0),to:r.pos},"

"),s.insertContentAt({from:Math.max(i.pos-1,0),to:r.pos},{type:this.name})):(0,Wn.isNodeSelection)(o)?s.insertContentAt(r.pos,{type:this.name}):s.insertContent({type:this.name}),s.command((({tr:t,dispatch:e})=>{if(e){const{$to:e}=t.selection,n=e.end();if(e.nodeAfter)e.nodeAfter.isTextblock?t.setSelection(nt.U3.create(t.doc,e.pos+1)):e.nodeAfter.isBlock?t.setSelection(nt.nh.create(t.doc,e.pos)):t.setSelection(nt.U3.create(t.doc,e.pos));else{const o=e.parent.type.contentMatch.defaultType?.create();o&&(t.insert(n,o),t.setSelection(nt.U3.create(t.doc,n+1)))}t.scrollIntoView()}return!0})).run())}}}});var ur=n(7477),hr=n(7417),pr=n(7371),fr=n(9319),mr=n(6927),gr=n(9515),br=n(1985),yr=n(9221),kr=n(7481),vr=n(1988),wr=n(9322),Cr=n(2100),xr=n(6542),Sr=n(3808),Mr=n(7308),Tr=n(5261),Or=n(9534);const Er=/^\s*(\[([( |x])?\])\s$/,Ar=Wn.Node.create({name:"taskItem",addOptions:()=>({nested:!1,HTMLAttributes:{},taskListTypeName:"taskList"}),content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes:()=>({checked:{default:!1,keepOnSplit:!1,parseHTML:t=>{const e=t.getAttribute("data-checked");return""===e||"true"===e},renderHTML:t=>({"data-checked":t.checked})}}),parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:t,HTMLAttributes:e}){return["li",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,e,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:t.attrs.checked?"checked":null}],["span"]],["div",0]]},addKeyboardShortcuts(){const t={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...t,Tab:()=>this.editor.commands.sinkListItem(this.name)}:t},addNodeView(){return({node:t,HTMLAttributes:e,getPos:n,editor:o})=>{const i=document.createElement("li"),r=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div");return r.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",(t=>t.preventDefault())),a.addEventListener("change",(e=>{if(!o.isEditable&&!this.options.onReadOnlyChecked)return void(a.checked=!a.checked);const{checked:i}=e.target;o.isEditable&&"function"==typeof n&&o.chain().focus(void 0,{scrollIntoView:!1}).command((({tr:t})=>{const e=n();if("number"!=typeof e)return!1;const o=t.doc.nodeAt(e);return t.setNodeMarkup(e,void 0,{...null==o?void 0:o.attrs,checked:i}),!0})).run(),!o.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(t,i)||(a.checked=!a.checked))})),Object.entries(this.options.HTMLAttributes).forEach((([t,e])=>{i.setAttribute(t,e)})),i.dataset.checked=t.attrs.checked,t.attrs.checked&&a.setAttribute("checked","checked"),r.append(a,s),i.append(r,l),Object.entries(e).forEach((([t,e])=>{i.setAttribute(t,e)})),{dom:i,contentDOM:l,update:t=>t.type===this.type&&(i.dataset.checked=t.attrs.checked,t.attrs.checked?a.setAttribute("checked","checked"):a.removeAttribute("checked"),!0)}}},addInputRules(){return[(0,Wn.wrappingInputRule)({find:Er,type:this.type,getAttributes:t=>({checked:"x"===t[t.length-1]})})]}}),Ir=Wn.Node.create({name:"taskList",addOptions:()=>({itemTypeName:"taskItem",HTMLAttributes:{}}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:t}){return["ul",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t,{"data-type":this.name}),0]},addCommands(){return{toggleTaskList:()=>({commands:t})=>t.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}});var Nr=n(8777);const Dr=Wn.Extension.create({name:"starterKit",addExtensions(){const t=[],e=this.options;return!1!==e?.blockquote&&t.push(ur.Cv.configure(e?.blockquote)),!1!==e?.bold&&t.push(hr.yN.configure(e?.bold)),!1!==e?.bulletList&&t.push(pr.Rg.configure(e?.bulletList)),!1!==e?.code&&t.push(fr.Cy.configure(e?.code)),!1!==e?.codeBlock&&t.push(mr.NG.configure(e?.codeBlock)),!1!==e?.document&&t.push(gr.y.configure(e?.document)),!1!==e?.dropcursor&&t.push(br.Q.configure(e?.dropcursor)),!1!==e?.gapcursor&&t.push(yr.v.configure({allowGapCursor:!0,...e?.gapcursor??{}})),!1!==e?.hardBreak&&t.push(kr.B.configure(e?.hardBreak)),!1!==e?.heading&&t.push(vr.Heading.configure({levels:[1,2,3,4,5,6],...e?.heading}).extend({addKeyboardShortcuts(){return this.options.levels.reduce(((t,e)=>({...t||{},[`Mod-Alt-${e}`]:()=>this?.editor.commands.toggleHeading({level:e})})),{})}})),!1!==e?.history&&t.push(wr.B.configure({depth:100,newGroupDelay:500,...e?.history})),!1!==e?.horizontalRule&&t.push(dr.configure(e?.horizontalRule)),!1!==e?.italic&&t.push(Cr.J2.configure(e?.italic)),!1!==e?.listItem&&t.push(xr.c.configure(e?.listItem)),!1!==e?.taskList&&t.push(Ir.configure(e?.taskList)),!1!==e?.taskItem&&t.push(Ar.configure({nested:!0,...e?.taskItem})),!1!==e?.orderedList&&t.push(Sr._J.configure(e?.orderedList)),!1!==e?.paragraph&&t.push(Mr.f.configure(e?.paragraph)),!1!==e?.strike&&t.push(Or.n.configure(e?.strike)),!1!==e?.text&&t.push(Nr.E.configure(e?.text)),!1!==e?.placeholder&&t.push(Tr.Placeholder.configure({emptyNodeClass:"t-editor-placeholder",includeChildren:!0,showOnlyCurrent:!0,showOnlyWhenEditable:!0,placeholder:"",...e?.placeholder??{}})),!1!==e?.enter&&t.push(cr),t}});var Rr,$r,Lr=n(9939),zr=n(7887),Pr=n(4103),Br=n(4238);if("undefined"!=typeof WeakMap){let t=new WeakMap;Rr=e=>t.get(e),$r=(e,n)=>(t.set(e,n),n)}else{const t=[],e=10;let n=0;Rr=e=>{for(let n=0;n(n==e&&(n=0),t[n++]=o,t[n++]=i)}var _r=class{constructor(t,e,n,o){this.width=t,this.height=e,this.map=n,this.problems=o}findCell(t){for(let e=0;eo&&(r+=i.attrs.colspan)}}for(let t=0;t1&&(n=!0)}-1==e?e=r:e!=r&&(e=Math.max(e,r))}return e}(t),n=t.childCount,o=[];let i=0,r=null;const s=[];for(let t=0,i=e*n;t=n){(r||(r=[])).push({type:"overlong_rowspan",pos:l,n:h-t});break}const c=i+t*e;for(let t=0;t0;e--)if("row"==t.node(e).type.spec.tableRole)return t.node(0).resolve(t.before(e+1));return null}function Vr(t){const e=t.selection.$head;for(let t=e.depth;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return!0;return!1}function Wr(t){const e=t.selection;if("$anchorCell"in e&&e.$anchorCell)return e.$anchorCell.pos>e.$headCell.pos?e.$anchorCell:e.$headCell;if("node"in e&&e.node&&"cell"==e.node.type.spec.tableRole)return e.$anchor;const n=Gr(e.$head)||function(t){for(let e=t.nodeAfter,n=t.pos;e;e=e.firstChild,n++){const o=e.type.spec.tableRole;if("cell"==o||"header_cell"==o)return t.doc.resolve(n)}for(let e=t.nodeBefore,n=t.pos;e;e=e.lastChild,n--){const o=e.type.spec.tableRole;if("cell"==o||"header_cell"==o)return t.doc.resolve(n-e.nodeSize)}}(e.$head);if(n)return n;throw new RangeError(`No cell found around position ${e.head}`)}function Xr(t){return"row"==t.parent.type.spec.tableRole&&!!t.nodeAfter}function Ur(t,e){return t.depth==e.depth&&t.pos>=e.start(-1)&&t.pos<=e.end(-1)}function Kr(t,e,n){const o=t.node(-1),i=_r.get(o),r=t.start(-1),s=i.nextCell(t.pos-r,e,n);return null==s?null:t.node(0).resolve(r+s)}function Jr(t,e,n=1){const o={...t,colspan:t.colspan-n};return o.colwidth&&(o.colwidth=o.colwidth.slice(),o.colwidth.splice(e,n),o.colwidth.some((t=>t>0))||(o.colwidth=null)),o}function Yr(t,e,n=1){const o={...t,colspan:t.colspan+n};if(o.colwidth){o.colwidth=o.colwidth.slice();for(let t=0;tt!=e.pos-i));a.unshift(e.pos-i);const l=a.map((t=>{const e=n.nodeAt(t);if(!e)throw RangeError(`No cell with offset ${t} found`);const o=i+t+1;return new nt.yn(s.resolve(o),s.resolve(o+e.content.size))}));super(l[0].$from,l[0].$to,l),this.$anchorCell=t,this.$headCell=e}map(e,n){const o=e.resolve(n.map(this.$anchorCell.pos)),i=e.resolve(n.map(this.$headCell.pos));if(Xr(o)&&Xr(i)&&Ur(o,i)){const e=this.$anchorCell.node(-1)!=o.node(-1);return e&&this.isRowSelection()?t.rowSelection(o,i):e&&this.isColSelection()?t.colSelection(o,i):new t(o,i)}return nt.U3.between(o,i)}content(){const t=this.$anchorCell.node(-1),e=_r.get(t),n=this.$anchorCell.start(-1),o=e.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),i={},r=[];for(let n=o.top;n0||d>0){let t=l.attrs;if(c>0&&(t=Jr(t,0,c)),d>0&&(t=Jr(t,t.colspan-d,d)),a.lefto.bottom){const t={...l.attrs,rowspan:Math.min(a.bottom,o.bottom)-Math.max(a.top,o.top)};l=a.top0)return!1;const n=t+this.$anchorCell.nodeAfter.attrs.rowspan,o=e+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,o)==this.$headCell.node(-1).childCount}static colSelection(e,n=e){const o=e.node(-1),i=_r.get(o),r=e.start(-1),s=i.findCell(e.pos-r),a=i.findCell(n.pos-r),l=e.node(0);return s.top<=a.top?(s.top>0&&(e=l.resolve(r+i.map[s.left])),a.bottom0&&(n=l.resolve(r+i.map[a.left])),s.bottom0)return!1;const r=o+this.$anchorCell.nodeAfter.attrs.colspan,s=i+this.$headCell.nodeAfter.attrs.colspan;return Math.max(r,s)==e.width}eq(e){return e instanceof t&&e.$anchorCell.pos==this.$anchorCell.pos&&e.$headCell.pos==this.$headCell.pos}static rowSelection(e,n=e){const o=e.node(-1),i=_r.get(o),r=e.start(-1),s=i.findCell(e.pos-r),a=i.findCell(n.pos-r),l=e.node(0);return s.left<=a.left?(s.left>0&&(e=l.resolve(r+i.map[s.top*i.width])),a.right0&&(n=l.resolve(r+i.map[a.top*i.width])),s.right{e.push(zr.NZ.node(n,n+t.nodeSize,{class:"selectedCell"}))})),zr.zF.create(t.doc,e)}var ts=new nt.hs("fix-tables");function es(t,e,n,o){const i=t.childCount,r=e.childCount;t:for(let s=0,a=0;s{"table"==e.type.spec.tableRole&&(n=function(t,e,n,o){const i=_r.get(e);if(!i.problems)return o;o||(o=t.tr);const r=[];for(let t=0;t0){let e="cell";n.firstChild&&(e=n.firstChild.type.spec.tableRole);const r=[];for(let n=0;n0?-1:0;(function(t,e,n){const o=jr(e.type.schema).header_cell;for(let i=0;i0&&i0&&e.map[a-1]==l||i0?-1:0;(function(t,e,n){var o;const i=jr(e.type.schema).header_cell;for(let r=0;r0&&i0&&c==e.map[s-e.width]){const e=n.nodeAt(c).attrs;t.setNodeMarkup(t.mapping.slice(a).map(c+o),null,{...e,rowspan:e.rowspan-1}),r+=e.colspan-1}else if(i0&&n[r]==n[r-1]||o.right0&&n[i]==n[i-t]||o.bottomn[t.type.spec.tableRole],(t,e)=>{var n;const i=t.selection;let r,s;if(i instanceof qr){if(i.$anchorCell.pos!=i.$headCell.pos)return!1;r=i.$anchorCell.nodeAfter,s=i.$anchorCell.pos}else{if(r=function(t){for(let e=t.depth;e>0;e--){const n=t.node(e).type.spec.tableRole;if("cell"===n||"header_cell"===n)return t.node(e)}return null}(i.$from),!r)return!1;s=null==(n=Gr(i.$from))?void 0:n.pos}if(null==r||null==s)return!1;if(1==r.attrs.colspan&&1==r.attrs.rowspan)return!1;if(e){let n=r.attrs;const a=[],l=n.colwidth;n.rowspan>1&&(n={...n,rowspan:1}),n.colspan>1&&(n={...n,colspan:1});const c=os(t),d=t.tr;for(let t=0;ti.table.nodeAt(t)));for(let t=0;t{const e=t+i.tableStart,n=r.doc.nodeAt(e);n&&r.setNodeMarkup(e,d,n.attrs)})),n(r)}return!0}}hs("row",{useDeprecatedLogic:!0}),hs("column",{useDeprecatedLogic:!0});var ps=hs("cell",{useDeprecatedLogic:!0});function fs(t){return function(e,n){if(!Vr(e))return!1;const o=function(t,e){if(e<0){const e=t.nodeBefore;if(e)return t.pos-e.nodeSize;for(let e=t.index(-1)-1,n=t.before();e>=0;e--){const o=t.node(-1).child(e),i=o.lastChild;if(i)return n-1-i.nodeSize;n-=o.nodeSize}}else{if(t.index(){t.content.eq(i)||o.replace(o.mapping.map(e+1),o.mapping.map(e+t.nodeSize-1),new Lr.Ji(i,0,0))})),o.docChanged&&e(o)}return!0}function gs(t,e){const n=t.createAndFill();return new Br.dL(n).replace(0,n.content.size,e).doc}function bs(t,e,n,o,i,r,s,a){if(0==s||s==e.height)return!1;let l=!1;for(let c=i;ce.width)for(let r=0,d=0;re.height){const d=[];for(let t=0,o=(e.height-1)*e.width;t=e.width)&&n.nodeAt(e.map[o+t]).type==a.header_cell;d.push(i?c||(c=a.header_cell.createAndFill()):l||(l=a.cell.createAndFill()))}const u=a.row.create(null,Lr.FK.from(d)),h=[];for(let t=e.height;t{if(!i)return!1;const r=n.selection;if(r instanceof qr)return ws(n,o,nt.LN.near(r.$headCell,e));if("horiz"!=t&&!r.empty)return!1;const s=Os(i,t,e);if(null==s)return!1;if("horiz"==t)return ws(n,o,nt.LN.near(n.doc.resolve(r.head+e),e));{const i=n.doc.resolve(s),r=Kr(i,t,e);let a;return a=r?nt.LN.near(r,1):e<0?nt.LN.near(n.doc.resolve(i.before(-1)),-1):nt.LN.near(n.doc.resolve(i.after(-1)),1),ws(n,o,a)}}}function xs(t,e){return(n,o,i)=>{if(!i)return!1;const r=n.selection;let s;if(r instanceof qr)s=r;else{const o=Os(i,t,e);if(null==o)return!1;s=new qr(n.doc.resolve(o))}const a=Kr(s.$headCell,t,e);return!!a&&ws(n,o,new qr(s.$anchorCell,a))}}function Ss(t,e){const n=Gr(t.state.doc.resolve(e));return!!n&&(t.dispatch(t.state.tr.setSelection(new qr(n))),!0)}function Ms(t,e,n){if(!Vr(t.state))return!1;let o=function(t){if(!t.size)return null;let{content:e,openStart:n,openEnd:o}=t;for(;1==e.childCount&&(n>0&&o>0||"table"==e.child(0).type.spec.tableRole);)n--,o--,e=e.child(0).content;const i=e.child(0),r=i.type.spec.tableRole,s=i.type.schema,a=[];if("row"==r)for(let t=0;t=0;e--){const{rowspan:i,colspan:r}=o.child(e).attrs;for(let e=t;e=e.length&&e.push(Lr.FK.empty),n[i]o&&(a=a.type.createChecked(Jr(a.attrs,a.attrs.colspan,n+a.attrs.colspan-o),a.content)),s.push(a),n+=a.attrs.colspan;for(let n=1;ni&&(e=e.type.create({...e.attrs,rowspan:Math.max(1,i-e.attrs.rowspan)},e.content)),s.push(e)}t.push(Lr.FK.from(s))}n=t,e=i}return{width:t,height:e,rows:n}}(o,s.right-s.left,s.bottom-s.top),ks(t.state,t.dispatch,r,s,o),!0}if(o){const e=Wr(t.state),n=e.start(-1);return ks(t.state,t.dispatch,n,_r.get(e.node(-1)).findCell(e.pos-n),o),!0}return!1}function Ts(t,e){var n;if(e.ctrlKey||e.metaKey)return;const o=Es(t,e.target);let i;if(e.shiftKey&&t.state.selection instanceof qr)r(t.state.selection.$anchorCell,e),e.preventDefault();else if(e.shiftKey&&o&&null!=(i=Gr(t.state.selection.$anchor))&&(null==(n=As(t,e))?void 0:n.pos)!=i.pos)r(i,e),e.preventDefault();else if(!o)return;function r(e,n){let o=As(t,n);const i=null==Fr.getState(t.state);if(!o||!Ur(e,o)){if(!i)return;o=e}const r=new qr(e,o);if(i||!t.state.selection.eq(r)){const n=t.state.tr.setSelection(r);i&&n.setMeta(Fr,e.pos),t.dispatch(n)}}function s(){t.root.removeEventListener("mouseup",s),t.root.removeEventListener("dragstart",s),t.root.removeEventListener("mousemove",a),null!=Fr.getState(t.state)&&t.dispatch(t.state.tr.setMeta(Fr,-1))}function a(n){const i=n,a=Fr.getState(t.state);let l;if(null!=a)l=t.state.doc.resolve(a);else if(Es(t,i.target)!=o&&(l=As(t,e),!l))return s();l&&r(l,i)}t.root.addEventListener("mouseup",s),t.root.addEventListener("dragstart",s),t.root.addEventListener("mousemove",a)}function Os(t,e,n){if(!(t.state.selection instanceof nt.U3))return null;const{$head:o}=t.state.selection;for(let i=o.depth-1;i>=0;i--){const r=o.node(i);if((n<0?o.index(i):o.indexAfter(i))!=(n<0?0:r.childCount))return null;if("cell"==r.type.spec.tableRole||"header_cell"==r.type.spec.tableRole){const r=o.before(i),s="vert"==e?n>0?"down":"up":n>0?"right":"left";return t.endOfTextblock(s)?r:null}}return null}function Es(t,e){for(;e&&e!=t.dom;e=e.parentNode)if("TD"==e.nodeName||"TH"==e.nodeName)return e;return null}function As(t,e){const n=t.posAtCoords({left:e.clientX,top:e.clientY});return n&&n?Gr(t.state.doc.resolve(n.pos)):null}var Is=class{constructor(t,e){this.node=t,this.cellMinWidth=e,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")),Ns(t,this.colgroup,this.table,e),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(t){return t.type==this.node.type&&(this.node=t,Ns(t,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(t){return"attributes"==t.type&&(t.target==this.table||this.colgroup.contains(t.target))}};function Ns(t,e,n,o,i,r){var s;let a=0,l=!0,c=e.firstChild;const d=t.firstChild;if(d){for(let t=0,n=0;tnew n(t,e,o)),new $s(-1,!1)},apply:(t,e)=>e.apply(t)},props:{attributes:t=>{const e=Ds.getState(t);return e&&e.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(e,n)=>{!function(t,e,n,o,i){const r=Ds.getState(t.state);if(r&&!r.dragging){const o=function(t){for(;t&&"TD"!=t.nodeName&&"TH"!=t.nodeName;)t=t.classList&&t.classList.contains("ProseMirror")?null:t.parentNode;return t}(e.target);let s=-1;if(o){const{left:i,right:r}=o.getBoundingClientRect();e.clientX-i<=n?s=Ls(t,e,"left",n):r-e.clientX<=n&&(s=Ls(t,e,"right",n))}if(s!=r.activeHandle){if(!i&&-1!==s){const e=t.state.doc.resolve(s),n=e.node(-1),o=_r.get(n),i=e.start(-1);if(o.colCount(e.pos-i)+e.nodeAfter.attrs.colspan-1==o.width-1)return}Ps(t,s)}}}(e,n,t,0,o)},mouseleave:t=>{!function(t){const e=Ds.getState(t.state);e&&e.activeHandle>-1&&!e.dragging&&Ps(t,-1)}(t)},mousedown:(t,n)=>{!function(t,e,n){var o;const i=null!=(o=t.dom.ownerDocument.defaultView)?o:window,r=Ds.getState(t.state);if(!r||-1==r.activeHandle||r.dragging)return!1;const s=t.state.doc.nodeAt(r.activeHandle),a=function(t,e,{colspan:n,colwidth:o}){const i=o&&o[o.length-1];if(i)return i;const r=t.domAtPos(e);let s=r.node.childNodes[r.offset].offsetWidth,a=n;if(o)for(let t=0;t{const e=Ds.getState(t);if(e&&e.activeHandle>-1)return function(t,e){const n=[],o=t.doc.resolve(e),i=o.node(-1);if(!i)return zr.zF.empty;const r=_r.get(i),s=o.start(-1),a=r.colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;for(let t=0;t-1&&e.docChanged){let o=e.mapping.map(n.activeHandle,-1);return Xr(e.doc.resolve(o))||(o=-1),new t(o,n.dragging)}return n}};function Ls(t,e,n,o){const i="right"==n?-o:o,r=t.posAtCoords({left:e.clientX+i,top:e.clientY});if(!r)return-1;const{pos:s}=r,a=Gr(t.state.doc.resolve(s));if(!a)return-1;if("right"==n)return a.pos;const l=_r.get(a.node(-1)),c=a.start(-1),d=l.map.indexOf(a.pos-c);return d%l.width==0?-1:c+l.map[d-1]}function zs(t,e,n){const o=e.clientX-t.startX;return Math.max(n,t.startWidth+o)}function Ps(t,e){t.dispatch(t.state.tr.setMeta(Ds,{setHandle:e}))}function Bs({allowTableNodeSelection:t=!1}={}){return new nt.k_({key:Fr,state:{init:()=>null,apply(t,e){const n=t.getMeta(Fr);if(null!=n)return-1==n?null:n;if(null==e||!t.docChanged)return e;const{deleted:o,pos:i}=t.mapping.mapResult(e);return o?null:i}},props:{decorations:Zr,handleDOMEvents:{mousedown:Ts},createSelectionBetween:t=>null!=Fr.getState(t.state)?t.state.selection:null,handleTripleClick:Ss,handleKeyDown:vs,handlePaste:Ms},appendTransaction:(e,n,o)=>function(t,e,n){const o=(e||t).selection,i=(e||t).doc;let r,s;if(o instanceof nt.nh&&(s=o.node.type.spec.tableRole)){if("cell"==s||"header_cell"==s)r=qr.create(i,o.from);else if("row"==s){const t=i.resolve(o.from+1);r=qr.rowSelection(t,t)}else if(!n){const t=_r.get(o.node),e=o.from+1,n=e+t.map[t.width*t.height-1];r=qr.create(i,e+1,n)}}else o instanceof nt.U3&&function({$from:t,$to:e}){if(t.pos==e.pos||t.pos=0&&!(t.after(i+1)=0&&!(e.before(t+1)>e.start(t));t--,o--);return n==o&&/row|table/.test(t.node(i).type.spec.tableRole)}(o)?r=nt.U3.create(i,o.from):o instanceof nt.U3&&function({$from:t,$to:e}){let n,o;for(let e=t.depth;e>0;e--){const o=t.node(e);if("cell"===o.type.spec.tableRole||"header_cell"===o.type.spec.tableRole){n=o;break}}for(let t=e.depth;t>0;t--){const n=e.node(t);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){o=n;break}}return n!==o&&0===e.parentOffset}(o)&&(r=nt.U3.create(i,o.$from.start(),o.$from.end()));return r&&(e||(e=t.tr)).setSelection(r),e}(o,ns(o,n),t)})}function _s(t,e,n,o,i,r){let s=0,a=!0,l=e.firstChild;const c=t.firstChild;for(let t=0,n=0;t{const{selection:e}=t.state;if(!(e instanceof qr))return!1;let n=0;const o=(0,Wn.findParentNodeClosestToPos)(e.ranges[0].$from,(t=>"table"===t.type.name));return null==o||o.node.descendants((t=>{if("table"===t.type.name)return!1;["tableCell","tableHeader"].includes(t.type.name)&&(n+=1)})),n===e.ranges.length&&(t.commands.deleteTable(),!0)},Vs=Wn.Node.create({name:"table",addOptions:()=>({HTMLAttributes:{},resizable:!1,handleWidth:5,cellMinWidth:25,View:Hs,lastColumnResizable:!0,allowTableNodeSelection:!1}),content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML:()=>[{tag:"table"}],renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:o,tableMinWidth:i}=js(t,this.options.cellMinWidth);return["table",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,e,{style:o?`width: ${o}`:`min-width: ${i}`}),n,["tbody",0]]},addCommands:()=>({insertTable:({rows:t=3,cols:e=3,withHeaderRow:n=!0}={})=>({tr:o,dispatch:i,editor:r})=>{const s=function(t,e,n,o,i){const r=function(t){if(t.cached.tableNodeTypes)return t.cached.tableNodeTypes;const e={};return Object.keys(t.nodes).forEach((n=>{const o=t.nodes[n];o.spec.tableRole&&(e[o.spec.tableRole]=o)})),t.cached.tableNodeTypes=e,e}(t),s=[],a=[];for(let t=0;t({state:t,dispatch:e})=>function(t,e){if(!Vr(t))return!1;if(e){const n=os(t);e(is(t.tr,n,n.left))}return!0}(t,e),addColumnAfter:()=>({state:t,dispatch:e})=>function(t,e){if(!Vr(t))return!1;if(e){const n=os(t);e(is(t.tr,n,n.right))}return!0}(t,e),deleteColumn:()=>({state:t,dispatch:e})=>function(t,e){if(!Vr(t))return!1;if(e){const n=os(t),o=t.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let t=n.right-1;rs(o,n,t),t!=n.left;t--){const t=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!t)throw RangeError("No table found");n.table=t,n.map=_r.get(t)}e(o)}return!0}(t,e),addRowBefore:()=>({state:t,dispatch:e})=>function(t,e){if(!Vr(t))return!1;if(e){const n=os(t);e(ss(t.tr,n,n.top))}return!0}(t,e),addRowAfter:()=>({state:t,dispatch:e})=>function(t,e){if(!Vr(t))return!1;if(e){const n=os(t);e(ss(t.tr,n,n.bottom))}return!0}(t,e),deleteRow:()=>({state:t,dispatch:e})=>function(t,e){if(!Vr(t))return!1;if(e){const n=os(t),o=t.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let t=n.bottom-1;as(o,n,t),t!=n.top;t--){const t=n.tableStart?o.doc.nodeAt(n.tableStart-1):o.doc;if(!t)throw RangeError("No table found");n.table=t,n.map=_r.get(n.table)}e(o)}return!0}(t,e),deleteTable:()=>({state:t,dispatch:e})=>function(t,e){const n=t.selection.$anchor;for(let o=n.depth;o>0;o--)if("table"==n.node(o).type.spec.tableRole)return e&&e(t.tr.delete(n.before(o),n.after(o)).scrollIntoView()),!0;return!1}(t,e),mergeCells:()=>({state:t,dispatch:e})=>cs(t,e),splitCell:()=>({state:t,dispatch:e})=>ds(t,e),toggleHeaderColumn:()=>({state:t,dispatch:e})=>hs("column")(t,e),toggleHeaderRow:()=>({state:t,dispatch:e})=>hs("row")(t,e),toggleHeaderCell:()=>({state:t,dispatch:e})=>ps(t,e),mergeOrSplit:()=>({state:t,dispatch:e})=>!!cs(t,e)||ds(t,e),setCellAttribute:(t,e)=>({state:n,dispatch:o})=>function(t,e){return function(n,o){if(!Vr(n))return!1;const i=Wr(n);if(i.nodeAfter.attrs[t]===e)return!1;if(o){const r=n.tr;n.selection instanceof qr?n.selection.forEachCell(((n,o)=>{n.attrs[t]!==e&&r.setNodeMarkup(o,null,{...n.attrs,[t]:e})})):r.setNodeMarkup(i.pos,null,{...i.nodeAfter.attrs,[t]:e}),o(r)}return!0}}(t,e)(n,o),goToNextCell:()=>({state:t,dispatch:e})=>fs(1)(t,e),goToPreviousCell:()=>({state:t,dispatch:e})=>fs(-1)(t,e),fixTables:()=>({state:t,dispatch:e})=>(e&&ns(t),!0),setCellSelection:t=>({tr:e,dispatch:n})=>{if(n){const n=qr.create(e.doc,t.anchorCell,t.headCell);e.setSelection(n)}return!0}}),addKeyboardShortcuts(){return{Tab:()=>!!this.editor.commands.goToNextCell()||!!this.editor.can().addRowAfter()&&this.editor.chain().addRowAfter().goToNextCell().run(),"Shift-Tab":()=>this.editor.commands.goToPreviousCell(),Backspace:Gs,"Mod-Backspace":Gs,Delete:Gs,"Mod-Delete":Gs}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Rs({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],Bs({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(t){const e={name:t.name,options:t.options,storage:t.storage};return{tableRole:(0,Wn.callOrReturn)((0,Wn.getExtensionField)(t,"tableRole",e))}}}),Ws=Vs.extend({renderHTML({node:t,HTMLAttributes:e}){const{colgroup:n,tableWidth:o,tableMinWidth:i}=js(t,this.options.cellMinWidth);return["div",{class:"tui-table-wrapper"},["table",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,e,{style:o?`width: ${o}`:`min-width: ${i}`}),n,["tbody",0]]]}}).configure({resizable:!0,lastColumnResizable:!1,allowTableNodeSelection:!0}).extend(),Xs=n(3017).default.extend({renderHTML({HTMLAttributes:t}){const e=(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t);return e.colwidth&&(e.style=`width: ${e.colwidth}px; ${e.style}`),["td",e,0]}}),Us=Wn.Extension.create({addGlobalAttributes:()=>[{types:["tableCell","tableHeader"],attributes:{background:{default:null,renderHTML:({background:t})=>t?{style:`background: ${t}`}:null,parseHTML:({style:t})=>t.background,keepOnSplit:!1}}}],addCommands:()=>({setCellBackground:t=>({chain:e})=>e().updateAttributes("tableCell",{background:t}).updateAttributes("tableHeader",{background:t}).run(),unsetCellBackground:()=>({chain:t})=>t().updateAttributes("tableCell",{background:null}).updateAttributes("tableHeader",{background:null}).run()})}),Ks=[Dr.configure({heading:{levels:[1,2,3,4,5,6]}}),n.e(2077).then(n.bind(n,2077)).then((({TextAlign:t})=>t.configure({types:["heading","paragraph"]}))),Promise.resolve().then(n.bind(n,5377)).then((({TextStyle:t})=>t)),n.e(7010).then(n.bind(n,7010)).then((({Underline:t})=>t)),n.e(1949).then(n.bind(n,1949)).then((({Subscript:t})=>t)),n.e(5450).then(n.bind(n,5450)).then((({Superscript:t})=>t)),ho,lr,go,uo,io,Ws.configure({resizable:!0}),Xs,n.e(7793).then(n.bind(n,7793)).then((({TableRow:t})=>t)),n.e(7370).then(n.bind(n,7370)).then((({TableHeader:t})=>t)),mo,Us,lo,ao,co,po],Js={groupNodeClass:"tui-group-node",groupPointerNodeClass:"tui-group-pointer",nested:!0,draggable:!0,createOnEnter:!1},Ys=(t={})=>{const{draggable:e,nested:n,groupNodeClass:o,groupPointerNodeClass:i,createOnEnter:r}={...Js,...t};return Wn.Node.create({name:"group",draggable:e,group:"block",content:n?"block+":"block",addAttributes:()=>({style:{default:null,parseHTML:t=>t.getAttribute("style"),renderHTML:t=>t.style?{style:t.style}:{}}}),parseHTML:()=>[{tag:'div[data-type="group"]'}],renderHTML:({HTMLAttributes:t})=>["div",(0,Wn.mergeAttributes)(t,{"data-type":"group"}),0],addNodeView:()=>({HTMLAttributes:t,node:n})=>{if(globalThis.document){const r=document.createElement("div"),s=document.createElement("div");if(r.classList.add(o),s.setAttribute("data-type","group"),t.style&&(n.attrs.style=t.style,s.setAttribute("style",t.style)),e){const t=document.createElement("div");t.classList.add(i),t.innerHTML="",t.contentEditable="false",r.append(t,s)}else r.append(s);return{dom:r,contentDOM:s}}return null},addCommands(){return{setGroup:()=>({commands:t,state:e})=>{this.editor.chain().focus().run();const n=ro(e,""),o=`
${n.trim().startsWith("

")?n:`

${n}

`}
`;return t.insertContent(o)},setGroupHilite:t=>({editor:e})=>{let n=e.state.selection.$anchor;for(let o=n.depth;o>0;o--){n=e.state.selection.$anchor;const i=n.node(o);if(i.type.name===this.name){setTimeout((()=>e.commands.updateAttributes(i.type,{style:`background: ${t}`})));break}}return!0},removeGroup:()=>({state:t,dispatch:e})=>so(t,e,this.name)}},addKeyboardShortcuts(){return r?{Enter:this.editor.commands.setGroup}:{}}})};var qs=n(7270);const Qs=new b.nKC("[TUI_IFRAME_EDITOR_OPTIONS]",{factory:()=>({minWidth:100,maxWidth:1/0,minHeight:100,maxHeight:1/0})});var Zs;class ta extends Jn{constructor(){super(...arguments),this.sanitizer=(0,b.WQX)(Lt.up),this.el=(0,b.WQX)(b.aKT),this.options=(0,b.WQX)(Qs),this.changeDetector=(0,b.WQX)(b.gRc)}updateSize([t,e]){this.currentWidth=Math.max(this.options.minWidth,Math.min(this.options.maxWidth,t)),this.currentHeight=Math.max(this.options.minHeight,Math.min(this.options.maxHeight,e)),this.attrs.width=this.currentWidth,this.attrs.height=this.currentHeight,this.el.nativeElement.dispatchEvent(new CustomEvent(a,{bubbles:!0}))}get src(){return this.sanitizer.bypassSecurityTrustResourceUrl(this.attrs.src??"")}}(Zs=ta).ɵfac=function(){let t;return function(e){return(t||(t=b.xGo(Zs)))(e||Zs)}}(),Zs.ɵcmp=b.VBU({type:Zs,selectors:[["tui-iframe-editor"]],standalone:!0,features:[b.Vt3,b.aNF],decls:2,vars:13,consts:[[3,"height","width","sizeChange"],["alt","",3,"height","src","width"]],template:function(t,e){1&t&&(b.j41(0,"tui-editor-resizable",0),b.bIt("sizeChange",(function(t){return e.updateSize(t)})),b.nrm(1,"iframe",1),b.k0s()),2&t&&(b.Y8G("height",e.height)("width",e.width),b.R7$(1),b.xc7("max-height",e.options.maxHeight)("max-width",e.options.maxWidth)("min-height",e.options.minHeight)("min-width",e.options.minWidth),b.Y8G("height",e.height)("src",e.src,b.f$h)("width",e.width))},dependencies:[oo],styles:["iframe[_ngcontent-%COMP%]{display:inline;pointer-events:none}"],changeDetection:0}),(0,qs.Cg)([w.PE],ta.prototype,"src",null);const ea=({injector:t})=>Wn.Node.create({name:"iframe",group:"block",atom:!0,draggable:!1,parseHTML:()=>[{tag:"iframe"}],addAttributes(){return{src:{default:null,keepOnSplit:!1,parseHTML:t=>t.getAttribute("src")},frameborder:{default:0,keepOnSplit:!1,parseHTML:t=>t.getAttribute("frameborder")},width:{default:"100%",keepOnSplit:!1,parseHTML:t=>t.getAttribute("width")},height:{default:null,keepOnSplit:!1,parseHTML:t=>t.getAttribute("height")},allowfullscreen:{keepOnSplit:!1,default:this.options.allowFullscreen,parseHTML:t=>t.getAttribute("allowfullscreen")}}},renderHTML:({HTMLAttributes:t})=>["iframe",(0,Wn.mergeAttributes)(t,{"data-type":"iframe-editor"})],addNodeView:()=>e=>new Kn(ta,e,{injector:t,...e}),addCommands(){return{setIframe:t=>({commands:e,state:n})=>{const o=n.selection.anchor;return e.enter(),e.setTextSelection(o),e.insertContent({type:this.name,attrs:t}),e.setTextSelection(n.selection.anchor),!0}}}});var na=n(3229);const oa=new b.nKC("[TUI_IMAGE_EDITOR_OPTIONS]",{factory:()=>({minWidth:null,maxWidth:1/0})});let ia=(()=>{var t;class e extends Tt.dg{constructor(){super(...arguments),this.el=(0,b.WQX)(b.aKT),this.type="dropdown"}getPosition({width:t,height:e}){const{right:n,top:o}=this.el.nativeElement.getBoundingClientRect();return[o+e+5,n-t/2]}}return(t=e).ɵfac=function(){let e;return function(n){return(e||(e=b.xGo(t)))(n||t)}}(),t.ɵdir=b.FsC({type:t,selectors:[["","tuiImageOptionsPosition",""]],standalone:!0,features:[b.Jv_([(0,Tt.nR)(t)]),b.Vt3]}),e})();var ra,sa;class aa{constructor(){this.options=(0,b.WQX)(x),this.style=null,this.updateAlignStyles=new b.bkB}isAlignCenter(t){return t?.replace(/\s/g,"")?.includes("justify-content:center")??!1}isAlignJustify(t){return null==t||""===t}isAlignLeft(t){return t?.replace(/\s/g,"")?.includes("float:left")??!1}isAlignRight(t){return t?.replace(/\s/g,"")?.includes("float:right")??!1}alignLeft(){this.updateAlignStyles.emit("float: left")}alignCenter(){this.updateAlignStyles.emit("display: flex; justify-content: center; margin-left: auto; margin-right: auto;")}alignJustify(){this.updateAlignStyles.emit(null)}alignRight(){this.updateAlignStyles.emit("float: right")}}(ra=aa).ɵfac=function(t){return new(t||ra)},ra.ɵcmp=b.VBU({type:ra,selectors:[["tui-image-align"]],inputs:{style:"style"},outputs:{updateAlignStyles:"updateAlignStyles"},standalone:!0,features:[b.aNF],decls:5,vars:8,consts:[[1,"t-align-list"],["size","s","tuiIconButton","","type","button",3,"appearance","iconStart","click.capture"]],template:function(t,e){1&t&&(b.j41(0,"div",0)(1,"button",1),b.bIt("click.capture",(function(){return e.alignJustify()})),b.k0s(),b.j41(2,"button",1),b.bIt("click.capture",(function(){return e.alignLeft()})),b.k0s(),b.j41(3,"button",1),b.bIt("click.capture",(function(){return e.alignCenter()})),b.k0s(),b.j41(4,"button",1),b.bIt("click.capture",(function(){return e.alignRight()})),b.k0s()()),2&t&&(b.R7$(1),b.Y8G("appearance",e.isAlignJustify(e.style)?"outline":"flat")("iconStart",e.options.icons.imageExtension.alignJustify),b.R7$(1),b.Y8G("appearance",e.isAlignLeft(e.style)?"outline":"flat")("iconStart",e.options.icons.imageExtension.alignLeft),b.R7$(1),b.Y8G("appearance",e.isAlignCenter(e.style)?"outline":"flat")("iconStart",e.options.icons.imageExtension.alignCenter),b.R7$(1),b.Y8G("appearance",e.isAlignRight(e.style)?"outline":"flat")("iconStart",e.options.icons.imageExtension.alignRight))},dependencies:[K.p],styles:[".t-align-list[_ngcontent-%COMP%]{display:flex;gap:.3125rem;padding:.125rem}"],changeDetection:0}),(0,qs.Cg)([w.PE],aa.prototype,"isAlignCenter",null),(0,qs.Cg)([w.PE],aa.prototype,"isAlignJustify",null),(0,qs.Cg)([w.PE],aa.prototype,"isAlignLeft",null),(0,qs.Cg)([w.PE],aa.prototype,"isAlignRight",null);const la=["resizable"],ca=["dropdown"];function da(t,e){if(1&t){const t=b.RV6();b.j41(0,"tui-image-align",7),b.bIt("updateAlignStyles",(function(e){b.eBV(t);const n=b.XpG();return n.align(e),b.Njj(n.open=!1)})),b.k0s()}if(2&t){const t=b.XpG();b.Aen(t.style)}}class ua extends Jn{constructor(){super(...arguments),this.sanitizer=(0,b.WQX)(Lt.up),this.el=(0,b.WQX)(b.aKT),this.win=(0,b.WQX)(W.Qc),this.destroyRef=(0,b.WQX)(b.abz),this.style=null,this.contenteditable=!1,this.focused=!1,this.open=!1,this.options=(0,b.WQX)(x),this.imageOptions=(0,b.WQX)(oa),this.changeDetector=(0,b.WQX)(b.gRc)}get height(){return null}get minWidth(){return this.imageOptions.minWidth??0}get maxWidth(){return this.imageOptions.maxWidth??0}ngOnInit(){this.style=this.attrs.style}ngAfterViewInit(){this.minWidth>0&&this.updateMinWidth()}updateSize([t]){this.currentWidth=Math.max(this.minWidth,Math.min(this.maxWidth,t)),this.attrs.width=this.currentWidth,this.notifyUpdate()}get dragHandle(){return this.attrs.draggable??null}get alt(){return this.attrs.alt??""}get title(){return this.attrs.title??""}getBypassedSrc(t){return this.sanitizer.bypassSecurityTrustResourceUrl(t)}currentTargetIsFocused(t){this.focused=this.el.nativeElement.contains(t),this.focused?this.selectFakeText():(this.open=!1,this.dropdown?.toggle(!1))}openDropdown(t){this.open=!0,this.dropdown?.toggle(!0),t.stopImmediatePropagation()}align(t){this.style=t,this.attrs.style=t,this.notifyUpdate()}selectFakeText(){if(this.win.document){const t=this.win.document.createRange();this.el.nativeElement.querySelector("p")?.focus(),t.selectNode(this.el.nativeElement),this.win.getSelection()?.removeAllRanges(),this.win.getSelection()?.addRange(t)}}updateMinWidth(){(0,na.O)(100).pipe((0,Q.pQ)(this.destroyRef)).subscribe((()=>{const t=this.resizable?.container?.nativeElement.querySelector("img")?.naturalWidth??this.resizable?.width??this.attrs.width??0;this.minWidth>parseInt(t,10)&&this.updateSize([this.minWidth])}))}notifyUpdate(){this.el.nativeElement.dispatchEvent(new CustomEvent(a,{bubbles:!0}))}}(sa=ua).ɵfac=function(){let t;return function(e){return(t||(t=b.xGo(sa)))(e||sa)}}(),sa.ɵcmp=b.VBU({type:sa,selectors:[["tui-image-editor"]],viewQuery:function(t,e){if(1&t&&(b.GBs(la,7),b.GBs(ca,7)),2&t){let t;b.mGM(t=b.lsd())&&(e.resizable=t.first),b.mGM(t=b.lsd())&&(e.dropdown=t.first)}},hostVars:4,hostBindings:function(t,e){1&t&&b.bIt("click.silent",(function(t){return e.currentTargetIsFocused(t.target)}),!1,b.EBC),2&t&&(b.BMQ("data-drag-handle",e.dragHandle)("contenteditable",e.contenteditable),b.Aen(e.style))},standalone:!0,features:[b.Vt3,b.aNF],decls:8,vars:17,consts:[["tuiImageOptionsPosition","",1,"t-hosted",3,"tuiDropdown","tuiDropdownOpen"],["dropdown","tuiDropdown"],["appearance","","size","s","tuiIconButton","","type","button",1,"t-image-options",3,"iconStart","click.capture.prevent"],[3,"autoHeight","width","sizeChange"],["resizable",""],["contenteditable","false","decoding","async","loading","lazy",3,"alt","src","title"],["imgOptions",""],[3,"updateAlignStyles"]],template:function(t,e){if(1&t&&(b.j41(0,"div",0,1)(2,"button",2),b.bIt("click.capture.prevent",(function(t){return e.openDropdown(t)})),b.k0s(),b.j41(3,"tui-editor-resizable",3,4),b.bIt("sizeChange",(function(t){return e.updateSize(t)})),b.nrm(5,"img",5),b.k0s()(),b.DNE(6,da,1,2,"ng-template",null,6,b.C5r)),2&t){const t=b.sdS(7);b.Y8G("tuiDropdown",t)("tuiDropdownOpen",e.open),b.R7$(2),b.AVh("_open",e.open),b.Y8G("iconStart",e.options.icons.imageExtension.settings),b.R7$(1),b.Y8G("autoHeight",!0)("width",e.width),b.R7$(2),b.xc7("max-width",e.maxWidth,"px")("min-width",e.minWidth,"px"),b.AVh("ProseMirror-selectednode",e.focused),b.Y8G("alt",e.alt)("src",e.getBypassedSrc(e.attrs.src),b.B4B)("title",e.title),b.BMQ("width",e.width)}},dependencies:[K.p,Ht.pU,Ht.iE,oo,aa,ia],styles:["[_nghost-%COMP%]{display:inline-block}[data-drag-handle][_nghost-%COMP%]{cursor:move}[_nghost-%COMP%]:hover .t-image-options[_ngcontent-%COMP%]{opacity:1}img[_ngcontent-%COMP%]{pointer-events:none}.t-hosted[_ngcontent-%COMP%]{position:relative}.t-image-options[_ngcontent-%COMP%]{position:absolute;top:.625rem;right:.625rem;z-index:1;background:var(--tui-background-base)}.t-image-options[_ngcontent-%COMP%]:not(._open){transition-property:opacity;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out;opacity:0}.t-align-list[_ngcontent-%COMP%]{display:flex;gap:.3125rem;padding:.125rem}"],changeDetection:0}),(0,qs.Cg)([w.PE],ua.prototype,"getBypassedSrc",null);const ha=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,pa=Wn.Node.create({name:"image",addOptions:()=>({inline:!1,allowBase64:!1,HTMLAttributes:{}}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes:()=>({src:{default:null},alt:{default:null},title:{default:null}}),parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:t}){return["img",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,t)]},addCommands(){return{setImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addInputRules(){return[(0,Wn.nodeInputRule)({find:ha,type:this.type,getAttributes:t=>{const[,,e,n,o]=t;return{src:n,alt:e,title:o}}})]}});var fa=n(7049);function ma(t){return(e,n)=>{const o=n instanceof DragEvent?n.dataTransfer:n.clipboardData,i=Array.from(o?.files??[]).filter((t=>/image/i.test(t.type)));i.length&&n.preventDefault();const r=t.get(B);i.forEach((t=>{r(t).pipe((0,Pe.s)(1),(0,fa.v)((()=>!e.isDestroyed))).subscribe((t=>{const n=e.state.schema.nodes.image?.create({src:t}),o=n?e.state.tr.replaceSelectionWith(n):null;setTimeout?.((()=>{!e.isDestroyed&&o&&e.dispatch(o)}))}))}))}}function ga({injector:t,draggable:e}){const n=!(0,w.Aj)(e)||e;return pa.extend({name:"image",group:"inline",inline:!0,priority:0,selectable:!0,draggable:n,parseHTML:()=>[{tag:"img"}],addAttributes:()=>({src:{default:"",keepOnSplit:!1},width:{default:null,keepOnSplit:!1},alt:{default:"",keepOnSplit:!1},style:{default:"",keepOnSplit:!1},title:{default:"",keepOnSplit:!1},draggable:{default:n?"":null,keepOnSplit:!1}}),renderHTML:({HTMLAttributes:t})=>["img",(0,Wn.mergeAttributes)(t)],addNodeView:()=>e=>new Kn(ua,e,{injector:t,...e}),addCommands(){return{setEditableImage:t=>({commands:e})=>e.insertContent({type:this.name,attrs:t})}},addProseMirrorPlugins:()=>[new nt.k_({props:{handleDOMEvents:{paste:ma(t),drop:ma(t)}}})]})}const ba=ga;function ya(t){return(new window.DOMParser).parseFromString(`${t}`,"text/html").body}function ka(t){const e=t.parentElement,n=e?.cloneNode();for(;e?.firstChild&&e.firstChild!==t;)n?.appendChild(e.firstChild);(n?.childNodes?.length??0)>0&&n&&e?.parentElement?.insertBefore(n,e),e?.parentElement?.insertBefore(t,e),0===e?.childNodes.length&&e.remove()}function va(t){const e=t.parentNode;for(;t?.firstChild;)e?.insertBefore(t.firstChild,t);e?.removeChild(t)}function wa(t){return t?.replace(/",">")??""}const Ca=Wn.Extension.create({name:"markdownClipboard",addOptions:()=>({transformPastedText:!1,transformCopiedText:!1}),addProseMirrorPlugins(){return[new nt.k_({key:new nt.hs("markdownClipboard"),props:{clipboardTextParser:(t,e,n)=>{if(n||!this.options.transformPastedText)return null;const o=this.editor.storage.markdown.parser.parse(t,{inline:!0});return Lr.S4.fromSchema(this.editor.schema).parseSlice(ya(o),{preserveWhitespace:!0,context:e})},clipboardTextSerializer:t=>this.options.transformCopiedText?this.editor.storage.markdown.serializer.serialize(t.content):null}})]}});var xa=n(9802);const Sa=new Lr.Sj({nodes:{doc:{content:"block+"},paragraph:{content:"inline*",group:"block",parseDOM:[{tag:"p"}],toDOM:()=>["p",0]},blockquote:{content:"block+",group:"block",parseDOM:[{tag:"blockquote"}],toDOM:()=>["blockquote",0]},horizontal_rule:{group:"block",parseDOM:[{tag:"hr"}],toDOM:()=>["div",["hr"]]},heading:{attrs:{level:{default:1}},content:"(text | image)*",group:"block",defining:!0,parseDOM:[{tag:"h1",attrs:{level:1}},{tag:"h2",attrs:{level:2}},{tag:"h3",attrs:{level:3}},{tag:"h4",attrs:{level:4}},{tag:"h5",attrs:{level:5}},{tag:"h6",attrs:{level:6}}],toDOM:t=>["h"+t.attrs.level,0]},code_block:{content:"text*",group:"block",code:!0,defining:!0,marks:"",attrs:{params:{default:""}},parseDOM:[{tag:"pre",preserveWhitespace:"full",getAttrs:t=>({params:t.getAttribute("data-params")||""})}],toDOM:t=>["pre",t.attrs.params?{"data-params":t.attrs.params}:{},["code",0]]},ordered_list:{content:"list_item+",group:"block",attrs:{order:{default:1},tight:{default:!1}},parseDOM:[{tag:"ol",getAttrs:t=>({order:t.hasAttribute("start")?+t.getAttribute("start"):1,tight:t.hasAttribute("data-tight")})}],toDOM:t=>["ol",{start:1==t.attrs.order?null:t.attrs.order,"data-tight":t.attrs.tight?"true":null},0]},bullet_list:{content:"list_item+",group:"block",attrs:{tight:{default:!1}},parseDOM:[{tag:"ul",getAttrs:t=>({tight:t.hasAttribute("data-tight")})}],toDOM:t=>["ul",{"data-tight":t.attrs.tight?"true":null},0]},list_item:{content:"block+",defining:!0,parseDOM:[{tag:"li"}],toDOM:()=>["li",0]},text:{group:"inline"},image:{inline:!0,attrs:{src:{},alt:{default:null},title:{default:null}},group:"inline",draggable:!0,parseDOM:[{tag:"img[src]",getAttrs:t=>({src:t.getAttribute("src"),title:t.getAttribute("title"),alt:t.getAttribute("alt")})}],toDOM:t=>["img",t.attrs]},hard_break:{inline:!0,group:"inline",selectable:!1,parseDOM:[{tag:"br"}],toDOM:()=>["br"]}},marks:{em:{parseDOM:[{tag:"i"},{tag:"em"},{style:"font-style=italic"},{style:"font-style=normal",clearMark:t=>"em"==t.type.name}],toDOM:()=>["em"]},strong:{parseDOM:[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!=t.style.fontWeight&&null},{style:"font-weight=400",clearMark:t=>"strong"==t.type.name},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],toDOM:()=>["strong"]},link:{attrs:{href:{},title:{default:null}},inclusive:!1,parseDOM:[{tag:"a[href]",getAttrs:t=>({href:t.getAttribute("href"),title:t.getAttribute("title")})}],toDOM:t=>["a",t.attrs]},code:{parseDOM:[{tag:"code"}],toDOM:()=>["code"]}}});class Ma{constructor(t,e){this.schema=t,this.tokenHandlers=e,this.stack=[{type:t.topNodeType,attrs:null,content:[],marks:Lr.CU.none}]}top(){return this.stack[this.stack.length-1]}push(t){this.stack.length&&this.top().content.push(t)}addText(t){if(!t)return;let e,n=this.top(),o=n.content,i=o[o.length-1],r=this.schema.text(t,n.marks);i&&(e=function(t,e){if(t.isText&&e.isText&&Lr.CU.sameSet(t.marks,e.marks))return t.withText(t.text+e.text)}(i,r))?o[o.length-1]=e:o.push(r)}openMark(t){let e=this.top();e.marks=t.addToSet(e.marks)}closeMark(t){let e=this.top();e.marks=t.removeFromSet(e.marks)}parseTokens(t){for(let e=0;e{t.openNode(e,Ta(i,n,o,r)),t.addText(Ea(n.content)),t.closeNode()}:(n[o+"_open"]=(t,n,o,r)=>t.openNode(e,Ta(i,n,o,r)),n[o+"_close"]=t=>t.closeNode())}else if(i.node){let e=t.nodeType(i.node);n[o]=(t,n,o,r)=>t.addNode(e,Ta(i,n,o,r))}else if(i.mark){let e=t.marks[i.mark];Oa(i,o)?n[o]=(t,n,o,r)=>{t.openMark(e.create(Ta(i,n,o,r))),t.addText(Ea(n.content)),t.closeMark(e)}:(n[o+"_open"]=(t,n,o,r)=>t.openMark(e.create(Ta(i,n,o,r))),n[o+"_close"]=t=>t.closeMark(e))}else{if(!i.ignore)throw new RangeError("Unrecognized parsing spec "+JSON.stringify(i));Oa(i,o)?n[o]=Aa:(n[o+"_open"]=Aa,n[o+"_close"]=Aa)}}return n.text=(t,e)=>t.addText(e.content),n.inline=(t,e)=>t.parseTokens(e.children),n.softbreak=n.softbreak||(t=>t.addText(" ")),n}(t,n)}parse(t,e={}){let n,o=new Ma(this.schema,this.tokenHandlers);o.parseTokens(this.tokenizer.parse(t,e));do{n=o.closeNode()}while(o.stack.length);return n||this.schema.topNodeType.createAndFill()}}(Sa,(0,xa.A)("commonmark",{html:!1}),{blockquote:{block:"blockquote"},paragraph:{block:"paragraph"},list_item:{block:"list_item"},bullet_list:{block:"bullet_list",getAttrs:(t,e,n)=>({tight:Ia(e,n)})},ordered_list:{block:"ordered_list",getAttrs:(t,e,n)=>({order:+t.attrGet("start")||1,tight:Ia(e,n)})},heading:{block:"heading",getAttrs:t=>({level:+t.tag.slice(1)})},code_block:{block:"code_block",noCloseToken:!0},fence:{block:"code_block",getAttrs:t=>({params:t.info||""}),noCloseToken:!0},hr:{node:"horizontal_rule"},image:{node:"image",getAttrs:t=>({src:t.attrGet("src"),title:t.attrGet("title")||null,alt:t.children[0]&&t.children[0].content||null})},hardbreak:{node:"hard_break"},em:{mark:"em"},strong:{mark:"strong"},link:{mark:"link",getAttrs:t=>({href:t.attrGet("href"),title:t.attrGet("title")||null})},code_inline:{mark:"code",noCloseToken:!0}});const Na={open:"",close:"",mixable:!0},Da=new class{constructor(t,e,n={}){this.nodes=t,this.marks=e,this.options=n}serialize(t,e={}){e=Object.assign({},this.options,e);let n=new $a(this.nodes,this.marks,e);return n.renderContent(t),n.out}}({blockquote(t,e){t.wrapBlock("> ",null,e,(()=>t.renderContent(e)))},code_block(t,e){const n=e.textContent.match(/`{3,}/gm),o=n?n.sort().slice(-1)[0]+"`":"```";t.write(o+(e.attrs.params||"")+"\n"),t.text(e.textContent,!1),t.write("\n"),t.write(o),t.closeBlock(e)},heading(t,e){t.write(t.repeat("#",e.attrs.level)+" "),t.renderInline(e,!1),t.closeBlock(e)},horizontal_rule(t,e){t.write(e.attrs.markup||"---"),t.closeBlock(e)},bullet_list(t,e){t.renderList(e," ",(()=>(e.attrs.bullet||"*")+" "))},ordered_list(t,e){let n=e.attrs.order||1,o=String(n+e.childCount-1).length,i=t.repeat(" ",o+2);t.renderList(e,i,(e=>{let i=String(n+e);return t.repeat(" ",o-i.length)+i+". "}))},list_item(t,e){t.renderContent(e)},paragraph(t,e){t.renderInline(e),t.closeBlock(e)},image(t,e){t.write("!["+t.esc(e.attrs.alt||"")+"]("+e.attrs.src.replace(/[\(\)]/g,"\\$&")+(e.attrs.title?' "'+e.attrs.title.replace(/"/g,'\\"')+'"':"")+")")},hard_break(t,e,n,o){for(let i=o+1;i(t.inAutolink=function(t,e,n){if(t.attrs.title||!/^\w+:/.test(t.attrs.href))return!1;let o=e.child(n);return!(!o.isText||o.text!=t.attrs.href||o.marks[o.marks.length-1]!=t||n!=e.childCount-1&&t.isInSet(e.child(n+1).marks))}(e,n,o),t.inAutolink?"<":"["),close(t,e,n,o){let{inAutolink:i}=t;return t.inAutolink=void 0,i?">":"]("+e.attrs.href.replace(/[\(\)"]/g,"\\$&")+(e.attrs.title?` "${e.attrs.title.replace(/"/g,'\\"')}"`:"")+")"},mixable:!0},code:{open:(t,e,n,o)=>Ra(n.child(o),-1),close:(t,e,n,o)=>Ra(n.child(o-1),1),escape:!1}});function Ra(t,e){let n,o=/`+/g,i=0;if(t.isText)for(;n=o.exec(t.text);)i=Math.max(i,n[0].length);let r=i>0&&e>0?" `":"`";for(let t=0;t0&&e<0&&(r+=" "),r}class $a{constructor(t,e,n){this.nodes=t,this.marks=e,this.options=n,this.delim="",this.out="",this.closed=null,this.inAutolink=void 0,this.atBlockStart=!1,this.inTightList=!1,void 0===this.options.tightLists&&(this.options.tightLists=!1),void 0===this.options.hardBreakNodeName&&(this.options.hardBreakNodeName="hard_break")}flushClose(t=2){if(this.closed){if(this.atBlank()||(this.out+="\n"),t>1){let e=this.delim,n=/\s+$/.exec(e);n&&(e=e.slice(0,e.length-n[0].length));for(let n=1;nthis.render(e,t,o)))}renderInline(t,e=!0){this.atBlockStart=e;let n=[],o="",i=(e,i,r)=>{let s=e?e.marks:[];e&&e.type.name===this.options.hardBreakNodeName&&(s=s.filter((e=>{if(r+1==t.childCount)return!1;let n=t.child(r+1);return e.isInSet(n.marks)&&(!n.isText||/\S/.test(n.text))})));let a=o;if(o="",e&&e.isText&&s.some((t=>{let e=this.getMark(t.type.name);return e&&e.expelEnclosingWhitespace&&!t.isInSet(n)}))){let[t,o,i]=/^(\s*)(.*)$/m.exec(e.text);o&&(a+=o,(e=i?e.withText(i):null)||(s=n))}if(e&&e.isText&&s.some((e=>{let n=this.getMark(e.type.name);return n&&n.expelEnclosingWhitespace&&(r==t.childCount-1||!e.isInSet(t.child(r+1).marks))}))){let[t,i,r]=/^(.*?)(\s*)$/m.exec(e.text);r&&(o=r,(e=i?e.withText(i):null)||(s=n))}let l=s.length?s[s.length-1]:null,c=l&&!1===this.getMark(l.type.name).escape,d=s.length-(c?1:0);t:for(let t=0;to?s=s.slice(0,o).concat(e).concat(s.slice(o,t)).concat(s.slice(t+1,d)):o>t&&(s=s.slice(0,t).concat(s.slice(t+1,o)).concat(e).concat(s.slice(o,d)));continue t}}}let u=0;for(;u0&&(this.atBlockStart=!1)};t.forEach(i),i(null,0,t.childCount),this.atBlockStart=!1}renderList(t,e,n){this.closed&&this.closed.type==t.type?this.flushClose(3):this.inTightList&&this.flushClose(1);let o=void 0!==t.attrs.tight?t.attrs.tight:this.options.tightLists,i=this.inTightList;this.inTightList=o,t.forEach(((i,r,s)=>{s&&o&&this.flushClose(1),this.wrapBlock(e,n(s),t,(()=>this.render(i,t,s)))})),this.inTightList=i}esc(t,e=!1){return t=t.replace(/[`*\\~\[\]_]/g,((e,n)=>"_"==e&&n>0&&n+1])/,"\\$&").replace(/^(\s*)(#{1,6})(\s|$)/,"$1\\$2$3").replace(/^(\s*\d+)\.\s/,"$1\\. ")),this.options.escapeExtraCharacters&&(t=t.replace(this.options.escapeExtraCharacters,"\\$&")),t}quote(t){let e=-1==t.indexOf('"')?'""':-1==t.indexOf("'")?"''":"()";return e[0]+t+e[1]}repeat(t,e){let n="";for(let o=0;o({markdown:{serialize:Da.marks.strong,parse:{}}})}),za=Wn.Mark.create({name:"code"}).extend({addStorage:()=>({markdown:{serialize:Da.marks.code,parse:{}}})});function Pa(t){const e=t.type.schema,n=e.text(" ",[t]),o=(0,Wn.getHTMLFromFragment)(Lr.FK.from(n),e),i=/^(<.*?>) (<\/.*?>)$/.exec(o);return i?[i[1]??"",i[2]??""]:null}const Ba=Wn.Mark.create({name:"markdownHTMLMark",addStorage:()=>({markdown:{serialize:{open(t,e){return this.editor?.storage.markdown.options.html?Pa(e)?.[0]??"":(console.warn(`Tiptap Markdown: "${e.type.name}" mark is only available in html mode`),"")},close(t,e){return this.editor?.storage.markdown.options.html?Pa(e)?.[1]??"":""}},parse:{}}})}),_a=Wn.Mark.create({name:"italic"}).extend({addStorage:()=>({markdown:{serialize:Da.marks.em,parse:{}}})}),Ha=Wn.Mark.create({name:"link"}).extend({addStorage:()=>({markdown:{serialize:Da.marks.link,parse:{}}})}),ja=Wn.Mark.create({name:"strike"}).extend({addStorage:()=>({markdown:{serialize:{open:"~~",close:"~~",expelEnclosingWhitespace:!0},parse:{}}})}),Fa=Wn.Node.create({name:"blockquote"}).extend({addStorage:()=>({markdown:{serialize:Da.nodes.blockquote,parse:{}}})}),Ga=Wn.Node.create({name:"bulletList"}).extend({addStorage:()=>({markdown:{serialize(t,e){return t.renderList(e," ",(()=>`${this.editor?.storage.markdown.options.bulletListMarker||"-"} `))},parse:{}}})}),Va=Wn.Node.create({name:"codeBlock"}).extend({addStorage:()=>({markdown:{serialize(t,e){t.write(`\`\`\`${e.attrs.language||""}\n`),t.text(e.textContent,!1),t.ensureNewLine(),t.write("```"),t.closeBlock(e)},parse:{setup(t){t.set({langPrefix:this.options?.languageClassPrefix??"language-"})},updateDOM(t){t.innerHTML=t.innerHTML.replaceAll("\n","")}}}})}),Wa=Wn.Node.create({name:"markdownHTMLNode",addStorage:()=>({markdown:{serialize(t,e,n){this.editor.storage.markdown.options.html?t.write(function(t,e){const n=t.type.schema,o=(0,Wn.getHTMLFromFragment)(Lr.FK.from(t),n);return t.isBlock&&(e instanceof Lr.FK||e.type.name===n.topNodeType.name)?function(t){const e=ya(t).firstElementChild;return e&&(e.innerHTML=e.innerHTML.trim()?`\n${e.innerHTML}\n`:"\n"),e?.outerHTML??""}(o):o}(e,n)):(console.warn(`Tiptap Markdown: "${e.type.name}" node is only available in html mode`),t.write(`[${e.type.name}]`)),e.isBlock&&t.closeBlock(e)},parse:{}}})}),Xa=Wn.Node.create({name:"hardBreak"}).extend({addStorage:()=>({markdown:{serialize(t,e,n,o){for(let i=o+1;i({markdown:{serialize:Da.nodes.heading,parse:{}}})}),Ka=Wn.Node.create({name:"horizontalRule"}).extend({addStorage:()=>({markdown:{serialize:Da.nodes.horizontal_rule,parse:{}}})}),Ja=Wn.Node.create({name:"image"}).extend({addStorage:()=>({markdown:{serialize:Da.nodes.image,parse:{}}})}),Ya=Wn.Node.create({name:"listItem"}).extend({addStorage:()=>({markdown:{serialize:Da.nodes.list_item,parse:{}}})}),qa=Wn.Node.create({name:"orderedList"}).extend({addStorage:()=>({markdown:{serialize(t,e,n,o){const i=e.attrs.start||1,r=String(i+e.childCount-1).length,s=t.repeat(" ",r+2),a=function(t,e,n){let o=0;for(;n-o>0&&e.child(n-o-1).type.name===t.type.name;o++);return o}(e,n,o),l=a%2?") ":". ";t.renderList(e,s,(e=>{const n=String(i+e);return t.repeat(" ",r-n.length)+n+l}))},parse:{}}})}),Qa=Wn.Node.create({name:"paragraph"}).extend({addStorage:()=>({markdown:{serialize:Da.nodes.paragraph,parse:{}}})});function Za(t){return t?.content?.content??[]}const tl=Wn.Node.create({name:"table"}).extend({addStorage:()=>({markdown:{serialize(t,e,n){!function(t){const e=Za(t),n=e[0],o=e.slice(1);return!Za(n).some((t=>"tableHeader"!==t.type.name||el(t)||t.childCount>1))&&!o.some((t=>Za(t).some((t=>"tableHeader"===t.type.name||el(t)||t.childCount>1))))}(e)?Wa.storage.markdown.serialize.call(this,t,e,n):(t.inTable=!0,e.forEach(((e,n,o)=>{if(t.write("| "),e.forEach(((e,n,o)=>{o&&t.write(" | ");const i=e.firstChild;i?.textContent.trim()&&t.renderInline(i)})),t.write(" |"),t.ensureNewLine(),!o){const n=Array.from({length:e.childCount}).map((()=>"---")).join(" | ");t.write(`| ${n} |`),t.ensureNewLine()}})),t.closeBlock(e),t.inTable=!1)},parse:{}}})});function el(t){return t.attrs.colspan>1||t.attrs.rowspan>1}const nl=Wn.Node.create({name:"taskItem"}).extend({addStorage:()=>({markdown:{serialize(t,e){const n=e.attrs.checked?"[x]":"[ ]";t.write(`${n} `),t.renderContent(e)},parse:{updateDOM(t){Array.from(t.querySelectorAll(".task-list-item")).forEach((t=>{const e=t.querySelector("input");t.setAttribute("data-type","taskItem"),e&&(t.setAttribute("data-checked",e.checked.toString()),e.remove())}))}}}})});let ol=!0,il=!1,rl=!1;function sl(t,e){e&&(ol=!e.enabled,il=!!e.label,rl=!!e.labelAfter),t.core.ruler.after("inline","github-task-lists",(t=>{const e=t.tokens;for(let n=2;n=0;o--)if(t[o]?.level===n)return o;return-1}function cl(t,e){return(t[e]&&"inline"===t[e].type&&t[e-1]&&"paragraph_open"===t[e-1].type&&t[e-2]&&"list_item_open"===t[e-2].type&&function(t){return t.content.startsWith("[ ] ")||t.content.startsWith("[x] ")||t.content.startsWith("[X] ")}(t[e]))??!1}function dl(t,e){if(t.children?.unshift(function(t,e){const n=new e("html_inline","",0),o=ol?' disabled="" ':"";return t?.content.startsWith("[ ] ")?n.content=``:(t?.content.startsWith("[x] ")||t?.content.startsWith("[X] "))&&(n.content=``),n}(t,e)),t.children?.[1]&&(t.children[1].content=t.children[1].content.slice(3)),t.content&&(t.content=t.content.slice(3)),il)if(rl){t.children?.pop();const n=`task-item-${Math.ceil(1e7*Math.random()-1e3)}`;t.children?.[0]&&(t.children[0].content=`${t.children[0].content.slice(0,-1)} id="${n}">`),t.children?.push(function(t,e,n){const o=new n("html_inline","",0);return o.content=``,o.attrs=[{for:e}],o}(t.content,n,e))}else t.children?.unshift(function(t){const e=new t("html_inline","",0);return e.content="",e}(e))}const ul=Wn.Node.create({name:"taskList"}).extend({addStorage:()=>({markdown:{serialize:Ga.storage.markdown.serialize,parse:{setup(t){t.use(sl)},updateDOM(t){Array.from(t.querySelectorAll(".contains-task-list")).forEach((t=>{t.setAttribute("data-type","taskList")}))}}}})}),hl=Wn.Node.create({name:"text"}).extend({addStorage:()=>({markdown:{serialize(t,e){t.text(wa(e.text))},parse:{}}})}),pl=[Fa,Ga,Va,Xa,Ua,Ka,Wa,Ja,Ya,qa,Qa,tl,nl,ul,hl,La,za,Ba,_a,Ha,ja];function fl(t){const e=t.storage?.markdown,n=pl.find((e=>e.name===t.name))?.storage.markdown;return e||n?{...n,...e}:null}class ml{constructor(t,{html:e,linkify:n,breaks:o}){this.editor=t,this.md=this.withPatchedRenderer((0,xa.A)({html:e,linkify:n,breaks:o}))}parse(t,{inline:e}={}){if("string"==typeof t){this.editor.extensionManager.extensions.forEach((t=>fl(t)?.parse?.setup?.call({editor:this.editor,options:t.options},this.md)));const n=ya(this.md.render(t));return this.editor.extensionManager.extensions.forEach((t=>fl(t)?.parse?.updateDOM?.call({editor:this.editor,options:t.options},n))),this.normalizeDOM(n,{inline:e,content:t}),n.innerHTML}return t}normalizeDOM(t,{inline:e,content:n}){return this.normalizeBlocks(t),t.querySelectorAll("*").forEach((t=>{t.nextSibling?.nodeType!==Node.TEXT_NODE||t.closest("pre")||(t.nextSibling.textContent=t.nextSibling.textContent?.replace(/^\n/,"")??"")})),e&&this.normalizeInline(t,n),t}normalizeBlocks(t){const e=Object.values(this.editor.schema.nodes).filter((t=>t.isBlock)),n=e.map((t=>t.spec.parseDOM?.map((t=>t.tag)))).flat().filter(Boolean).join(",");n&&Array.from(t.querySelectorAll(n)).forEach((t=>{t.parentElement?.matches("p")&&ka(t)}))}normalizeInline(t,e){if(t.firstElementChild?.matches("p")){const n=t.firstElementChild,{nextElementSibling:o,innerHTML:i}=n,r=/^\s+/.exec(e)?.[0]??"",s=o?"":/\s+$/.exec(e)?.[0]??"";if(/^\n\n/.exec(e))return void(n.innerHTML=`${i}${s}`);va(n),t.innerHTML=`${r}${t.innerHTML}${s}`}}withPatchedRenderer(t){const e=t=>(...e)=>{const n=t?.(...e);return"\n"===n?n:n?.endsWith("\n")?n.slice(0,-1):n??""};return t.renderer.rules.hardbreak=e(t.renderer.rules.hardbreak),t.renderer.rules.softbreak=e(t.renderer.rules.softbreak),t.renderer.rules.fence=e(t.renderer.rules.fence),t.renderer.rules.code_block=e(t.renderer.rules.code_block),t.renderer.renderToken=e(t.renderer.renderToken.bind(t.renderer)),t}}const gl=(0,xa.A)();function bl(t,e){return gl.inline.State.prototype.scanDelims.call({src:t,posMax:t.length}),new gl.inline.State(t,null,null,[]).scanDelims(e,!0)}function yl(t,e,n,o){let i={text:t,from:n,to:o};return i=function(t,e,n,o){let i=n,r=t;for(;in&&!bl(r,i).can_close;)r=kl(r,e,i,-1),i--;return{text:r,from:n,to:i}}(i.text,e,i.from,i.to),i.to-i.from[t,this.serializeNode(Wa)]))),...Object.fromEntries(this.editor.extensionManager.extensions.filter((t=>"node"===t.type&&this.serializeNode(t))).map((t=>[t.name,this.serializeNode(t)]))??[])}}get marks(){return{...Object.fromEntries(Object.keys(this.editor.schema.marks).map((t=>[t,this.serializeMark(Ba)]))),...Object.fromEntries(this.editor.extensionManager.extensions.filter((t=>"mark"===t.type&&this.serializeMark(t))).map((t=>[t.name,this.serializeMark(t)]))??[])}}serialize(t){const e=new vl(this.nodes,this.marks,{hardBreakNodeName:Xa.name});return e.renderContent(t),e.out}serializeNode(t){return fl(t)?.serialize?.bind({editor:this.editor,options:t.options})}serializeMark(t){const e=fl(t)?.serialize;return e?{...e,open:"function"==typeof e.open?e.open.bind({editor:this.editor,options:t.options}):e.open,close:"function"==typeof e.close?e.close.bind({editor:this.editor,options:t.options}):e.close}:null}}const Cl=Wn.Extension.create({name:"markdownTightLists",addOptions:()=>({tight:!0,tightClass:"tight",listTypes:["bulletList","orderedList"]}),addGlobalAttributes(){return[{types:this.options.listTypes,attributes:{tight:{default:this.options.tight,parseHTML:t=>"true"===t.getAttribute("data-tight")||!t.querySelector("p"),renderHTML:t=>({class:t.tight?this.options.tightClass:null,"data-tight":t.tight?"true":null})}}}]},addCommands(){return{toggleTight:(t=null)=>({editor:e,commands:n})=>this.options.listTypes.some((o=>{if(!e.isActive(o))return!1;const i=e.getAttributes(o);return n.updateAttributes(o,{tight:t??!i?.tight})}))}}}),xl=Wn.Extension.create({name:"markdown",priority:50,addOptions:()=>({html:!0,tightLists:!0,tightListClass:"tight",bulletListMarker:"-",linkify:!1,breaks:!1,transformPastedText:!1,transformCopiedText:!1}),addCommands(){const t=Wn.extensions?.Commands?.config?.addCommands?.();return{setContent:(e,n,o)=>i=>t?.setContent?.(i.editor.storage.markdown.parser.parse(e),n,o)(i),insertContentAt:(e,n,o)=>i=>t?.insertContentAt?.(e,i.editor.storage.markdown.parser.parse(n,{inline:!0}),o)(i)}},onBeforeCreate(){this.editor.storage.markdown={options:{...this.options},parser:new ml(this.editor,this.options),serializer:new wl(this.editor),getMarkdown:()=>this.editor.storage.markdown.serializer.serialize(this.editor.state.doc)},this.editor.options.initialContent=this.editor.options.content,this.editor.options.content=this.editor.storage.markdown.parser.parse(this.editor.options.content)},onCreate(){this.editor.options.content=this.editor.options.initialContent,delete this.editor.options.initialContent},addStorage:()=>({}),addExtensions(){return[Cl.configure({tight:this.options.tightLists,tightClass:this.options.tightListClass}),Ca.configure({transformPastedText:this.options.transformPastedText,transformCopiedText:this.options.transformCopiedText})]}});function Sl(t){const e=[];return t.content.forEach((t=>{t instanceof Lr.bP&&e.push([t.type.name,t.attrs])})),e}const Ml=Wn.Node.create({name:"audio",group:"block",content:"source+",addAttributes:()=>bo(c),parseHTML:()=>[{tag:"audio"}],renderHTML:({node:t,HTMLAttributes:e})=>["audio",e,...Sl(t)]}),Tl=Wn.Node.create({name:"source",addAttributes:()=>bo(["src","type","width","height","media","sizes","srcset"]),parseHTML:()=>[{tag:"source"}],renderHTML:({HTMLAttributes:t})=>["source",(0,Wn.mergeAttributes)(t)]}),Ol=Wn.Node.create({name:"video",group:"block",content:"source+",addAttributes:()=>bo(c),parseHTML:()=>[{tag:"video"}],renderHTML:({node:t,HTMLAttributes:e})=>["video",e,...Sl(t)]}),El=Wn.Node.create({name:"mention",group:"inline",inline:!0,selectable:!0,atom:!0,addOptions:()=>({HTMLAttributes:{},renderHTML({node:t}){return["span",this.HTMLAttributes,`@${t.attrs.label??t.attrs.id}`.replaceAll(/@+/g,"@")]}}),addAttributes(){return{id:{default:null,keepOnSplit:!0,parseHTML:t=>t.innerText,renderHTML:()=>({"data-type":this.name})},class:{default:null,keepOnSplit:!0}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:t,HTMLAttributes:e}){const n=this.options.renderHTML({options:this.options,node:t});return"string"==typeof n?["span",(0,Wn.mergeAttributes)({"data-type":this.name},this.options.HTMLAttributes,e),n]:["span",(0,Wn.mergeAttributes)({"data-type":this.name},this.options.HTMLAttributes,e),n?.[2]]}}),Al=/^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?!channel\/)(?!@)(.+)?$/,Il=/^(https?:\/\/)?(www\.|music\.)?(youtube\.com|youtu\.be)\/(?!channel\/)(?!@)(.+)?$/g,Nl=t=>t.match(Al),Dl=t=>t?"https://www.youtube-nocookie.com/embed/":"https://www.youtube.com/embed/",Rl=Wn.Node.create({name:"youtube",addOptions:()=>({addPasteHandler:!0,allowFullscreen:!0,autoplay:!1,ccLanguage:void 0,ccLoadPolicy:void 0,controls:!0,disableKBcontrols:!1,enableIFrameApi:!1,endTime:0,height:480,interfaceLanguage:void 0,ivLoadPolicy:0,loop:!1,modestBranding:!1,HTMLAttributes:{},inline:!1,nocookie:!1,origin:"",playlist:"",progressBarColor:void 0,width:640}),inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},start:{default:0},width:{default:this.options.width},height:{default:this.options.height}}},parseHTML:()=>[{tag:"div[data-youtube-video] iframe"}],addCommands(){return{setYoutubeVideo:t=>({commands:e})=>!!Nl(t.src)&&e.insertContent({type:this.name,attrs:t})}},addPasteRules(){return this.options.addPasteHandler?[(0,Wn.nodePasteRule)({find:Il,type:this.type,getAttributes:t=>({src:t.input})})]:[]},renderHTML({HTMLAttributes:t}){const e=(t=>{const{url:e,allowFullscreen:n,autoplay:o,ccLanguage:i,ccLoadPolicy:r,controls:s,disableKBcontrols:a,enableIFrameApi:l,endTime:c,interfaceLanguage:d,ivLoadPolicy:u,loop:h,modestBranding:p,nocookie:f,origin:m,playlist:g,progressBarColor:b,startAt:y}=t;if(!Nl(e))return null;if(e.includes("/embed/"))return e;if(e.includes("youtu.be")){const t=e.split("/").pop();return t?`${Dl(f)}${t}`:null}const k=/(?:v=|shorts\/)([-\w]+)/gm.exec(e);if(!k||!k[1])return null;let v=`${Dl(f)}${k[1]}`;const w=[];return!1===n&&w.push("fs=0"),o&&w.push("autoplay=1"),i&&w.push(`cc_lang_pref=${i}`),r&&w.push("cc_load_policy=1"),s||w.push("controls=0"),a&&w.push("disablekb=1"),l&&w.push("enablejsapi=1"),c&&w.push(`end=${c}`),d&&w.push(`hl=${d}`),u&&w.push(`iv_load_policy=${u}`),h&&w.push("loop=1"),p&&w.push("modestbranding=1"),m&&w.push(`origin=${m}`),g&&w.push(`playlist=${g}`),y&&w.push(`start=${y}`),b&&w.push(`color=${b}`),w.length&&(v+=`?${w.join("&")}`),v})({url:t.src,allowFullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,controls:this.options.controls,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,nocookie:this.options.nocookie,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor,startAt:t.start||0});return t.src=e,["div",{"data-youtube-video":""},["iframe",(0,Wn.mergeAttributes)(this.options.HTMLAttributes,{width:this.options.width,height:this.options.height,allowfullscreen:this.options.allowFullscreen,autoplay:this.options.autoplay,ccLanguage:this.options.ccLanguage,ccLoadPolicy:this.options.ccLoadPolicy,disableKBcontrols:this.options.disableKBcontrols,enableIFrameApi:this.options.enableIFrameApi,endTime:this.options.endTime,interfaceLanguage:this.options.interfaceLanguage,ivLoadPolicy:this.options.ivLoadPolicy,loop:this.options.loop,modestBranding:this.options.modestBranding,origin:this.options.origin,playlist:this.options.playlist,progressBarColor:this.options.progressBarColor},t)]]}}).extend({}).configure({autoplay:!1,ccLanguage:"en",interfaceLanguage:"en",allowFullscreen:!0,disableKBcontrols:!0});function $l({anchorNode:t,focusNode:e},n){return!!t&&!!e&&(0,X.Gv)(t,n)&&(0,X.Gv)(e,n)}function Ll(t){Array.from(t.children).forEach((t=>{if(t.children.length&&Ll(t),"FONT"===t.tagName)if(t.hasAttribute("size"))switch(t.getAttribute("size")){case"6":zl("h1",t);break;case"5":zl("h2",t);break;case"4":Pl("17px",t);break;case"3":Pl("15px",t);break;case"2":Pl("13px",t)}else t.hasAttribute("color")&&function(t){if(globalThis.document){const e=document.createElement("span");e.setAttribute("style",`color: ${t.getAttribute("color")}`),e.innerHTML=t.innerHTML,t.parentElement?.replaceChild(e,t)}}(t)}))}function zl(t,e){if(globalThis.document){const n=document.createElement(t);if(n.innerHTML=e.innerHTML,"P"===e.parentElement?.tagName){const t=e.parentElement?.parentElement?.insertBefore(n,e.parentElement);e.parentElement?.removeChild(e),t?.nextSibling&&!t?.nextSibling?.textContent?.trim()&&t.nextSibling?.parentElement?.removeChild(t.nextSibling)}else e.parentElement?.replaceChild(n,e)}}function Pl(t,e){if(globalThis.document){const n=document.createElement("p"),o=document.createElement("span");o.setAttribute("style",`font-size: ${t}`),o.innerHTML=e.innerHTML,n.append(o),e.parentElement?.replaceChild("P"===e.parentElement.tagName?o:n,e)}}function Bl(t){const e=(new DOMParser).parseFromString(t,"text/html");return Ll(e.body),e.body.innerHTML}var _l=n(5908);function Hl({stops:t,side:e}){return`linear-gradient(${e}, ${t.map((({color:t,position:e})=>`rgba(${(0,_l.xr)(t).join(", ")}) ${e}`)).join(", ")})`}},5993:(t,e,n)=>{n.d(e,{A:()=>f});var o=n(6610),i=n(2978),r=n(7222),s=n(4612),a=n(8481),l=n(4822),c=n(8001);function d(t,e){1&t&&(i.j41(0,"span",3),i.SdG(1,1),i.k0s())}function u(t,e){if(1&t&&(i.qex(0),i.nrm(1,"span",1),i.DNE(2,d,2,0,"span",2),i.bVm()),2&t){const t=e.tuiLet,n=i.XpG();i.R7$(1),i.xc7("text-indent",n.indent,"px"),i.Y8G("textContent",t),i.R7$(1),i.Y8G("ngIf",!t)}}const h=[[["input"]],"*"],p=["input","*"];let f=(()=>{var t;class e{constructor(){this.value$=(0,c.v)((()=>(0,a.lD)(this.control))),this.indent=-1}onScroll(t){(0,l.ru)(t)&&(0,l.r_)(t)&&(this.indent=-t.scrollLeft-1)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=i.VBU({type:t,selectors:[["tui-input-inline"]],contentQueries:function(t,e,n){if(1&t&&i.wni(n,r.vO,5),2&t){let t;i.mGM(t=i.lsd())&&(e.control=t.first)}},hostBindings:function(t,e){1&t&&i.bIt("scroll.capture",(function(t){return e.onScroll(t.target)}))},standalone:!0,features:[i.aNF],ngContentSelectors:p,decls:3,vars:3,consts:[[4,"tuiLet"],[1,"t-before",3,"textContent"],["automation-id","tui-input-inline__placeholder","class","t-placeholder",4,"ngIf"],["automation-id","tui-input-inline__placeholder",1,"t-placeholder"]],template:function(t,e){1&t&&(i.NAR(h),i.DNE(0,u,3,4,"ng-container",0),i.nI1(1,"async"),i.SdG(2)),2&t&&i.Y8G("tuiLet",i.bMT(1,1,e.value$))},dependencies:[o.Jj,o.bT,s.c],styles:["tui-input-inline{position:relative;display:inline-block;overflow:hidden;white-space:nowrap;box-sizing:border-box}tui-input-inline ::spelling-error{color:transparent}tui-input-inline>.t-before{display:block;padding-right:.02em;margin-left:1px;white-space:pre}tui-input-inline>.t-placeholder{display:inline-block;min-inline-size:1px}tui-input-inline>input{position:absolute;top:0;left:0;background-color:transparent;padding:inherit;font:inherit;-webkit-text-fill-color:transparent;box-sizing:border-box;inline-size:100%;block-size:100%;border-width:0;text-align:inherit;letter-spacing:inherit;text-indent:inherit;text-transform:inherit;outline:none}\n"],encapsulation:2,changeDetection:0}),e})()},184:(t,e,n)=>{n.d(e,{uq:()=>At,DD:()=>Dt,DU:()=>Et,Mz:()=>Nt});var o=n(2978),i=n(5908),r=n(6610),s=n(7222),a=n(4557),l=n(5014),c=n(4225),d=n(9081),u=n(5266),h=n(9707),p=n(5180),f=n(4135),m=n(7270),g=n(6098),b=n(712),y=n(4314),k=n(7212),v=n(8481),w=n(4822),C=n(9406),x=n(2831),S=n(3527),M=n(6340),T=n(965),O=n(7442),E=n(9131),A=n(6194),I=n(4712),N=n(3241),D=n(811),R=n(3308),$=n(6661),L=n(6111),z=n(8621);let P=(()=>{var t;class e{constructor(){this.cache=new Map}request(t){const e=this.cache.get(t);if(e)return e;const n=function(t,e={}){const{selector:n}=e,o=(0,m.Tt)(e,["selector"]);return new C.c((e=>{const i=new AbortController,{signal:r}=i;let s=!0;const{signal:a}=o;if(a)if(a.aborted)i.abort();else{const t=()=>{r.aborted||i.abort()};a.addEventListener("abort",t),e.add((()=>a.removeEventListener("abort",t)))}const l=Object.assign(Object.assign({},o),{signal:r}),c=t=>{s=!1,e.error(t)};return fetch(t,l).then((t=>{n?(0,z.Tg)(n(t)).subscribe((0,L._)(e,void 0,(()=>{s=!1,e.complete()}),c)):(s=!1,e.next(t),e.complete())})).catch(c),()=>{s&&i.abort()}}))}(t).pipe((0,x.n)(function(){var e=(0,R.A)((function*(e){if(e.ok)return e.text();throw new Error(`Failed to load ${t} (${e.statusText})`)}));return function(t){return e.apply(this,arguments)}}()),(0,$.t)({bufferSize:1,refCount:!1}));return this.cache.set(t,n),n}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵprov=o.jDH({token:t,factory:t.ɵfac,providedIn:"root"}),e})();var B=n(1623),_=n(453),H=n(5981),j=n(9656),F=n(9090),G=n(756),V=n(4526);function W(t,e=function(){return Math.floor(Math.random()*Date.now())}()){if((0,y.YB)(t)){const n=function(t){const e=(t.match(/url\(("?)('*)#(.*?)('*)\)/g)??[]).map((t=>t.slice(4,t.length-1).replaceAll(/['"#]+/g,"")));return Array.from(new Set(e))}(t);return n.reduce(((t,n)=>{const o=`id_${e}_${n}`;return t.replaceAll(`"${n}"`,`"${o}"`).replaceAll(`'${n}'`,`'${o}'`).replaceAll(`url('#${n}')`,`url('#${o}')`).replaceAll(`url("#${n}")`,`url("#${o}")`).replaceAll(`url(#${n})`,`url(#${o})`)}),t)}return t}const X={tuiIconAttach:"tuiIconPaperclip",tuiIconAttention:"tuiIconAlertCircle",tuiIconBackCircle:"tuiIconArrowLeftCircle",tuiIconCall:"tuiIconPhone",tuiIconCallIn:"tuiIconPhoneIncoming",tuiIconCallOut:"tuiIconPhoneOutgoing",tuiIconCallTransfer:"tuiIconPhoneForwarded",tuiIconCancel:"tuiIconXCircle",tuiIconCancelCircle:"tuiIconSlash",tuiIconCard:"tuiIconCreditCard",tuiIconCards:"tuiIconCreditCard",tuiIconChartBar:"tuiIconBarChart",tuiIconChart:"tuiIconBarChart",tuiIconCheckList:"tuiIconClipboard",tuiIconCloseCircle:"tuiIconXCircle",tuiIconCollapse:"tuiIconMinimize",tuiIconComment:"tuiIconMessageSquare",tuiIconCommentFw:"tuiIconMessageForward",tuiIconCompany:"tuiIconBriefcase",tuiIconDefaultDoc:"tuiIconFile",tuiIconDesktop:"tuiIconMonitor",tuiIconDesktopOff:"tuiIconMonitorOff",tuiIconDislike:"tuiIconThumbsDown",tuiIconDone:"tuiIconCheckCircle",tuiIconDraft:"tuiIconEdit2",tuiIconEyeOpen:"tuiIconEye",tuiIconEyeClosed:"tuiIconEyeOff",tuiIconExpand:"tuiIconMaximize",tuiIconExternal:"tuiIconExternalLink",tuiIconFrame:"tuiIconLayout",tuiIconGeo:"tuiIconMapPin",tuiIconHeartFilled:"tuiIconHeart",tuiIconHide:"tuiIconEyeOff",tuiIconImg:"tuiIconImage",tuiIconInfoCircle:"tuiIconInfo",tuiIconLike:"tuiIconThumbsUp",tuiIconLockOpen:"tuiIconUnlock",tuiIconMobile:"tuiIconSmartphone",tuiIconMoreHor:"tuiIconMoreHorizontal",tuiIconMoreVer:"tuiIconMoreVertical",tuiIconMoreVert:"tuiIconMoreVertical",tuiIconPicture:"tuiIconImage",tuiIconPin:"tuiIconMapPin",tuiIconPrint:"tuiIconPrinter",tuiIconRefresh:"tuiIconRefreshCw",tuiIconRemove:"tuiIconX",tuiIconShow:"tuiIconEye",tuiIconSound:"tuiIconVolume",tuiIconSoundOff:"tuiIconVolumeX",tuiIconStarFilled:"tuiIconStar",tuiIconStop:"tuiIconSquare",tuiIconStructure:"tuiIconLayoutGrid",tuiIconTime:"tuiIconClock",tuiIconTooltip:"tuiIconHelpCircle",tuiIconViewList:"tuiIconList",tuiIconWifiOn:"tuiIconWifi"};let U=(()=>{var t;class e{constructor(){this.tuiSanitizer=(0,o.WQX)(B.rf,{optional:!0}),this.sanitizer=(0,o.WQX)(g.up),this.originals={},this.items$=new H.t(new Map),this.define((0,o.WQX)(B.l2))}define(t){const{value:e}=this.items$;Object.keys(t).forEach((n=>{this.defineIcon(n,t[n]??"",e)})),this.items$.next(e)}getOriginal(t){return this.originals[t]||null}defineIcon(t,e,n){if(n.has(t))return;const o=this.parseSrc(t,e);o&&(n.set(t,o),this.originals={...this.originals,[t]:e})}parseSrc(t,e){return this.sanitize((0,_.$6)(e,t))}sanitize(t){return this.sanitizer.bypassSecurityTrustHtml((this.tuiSanitizer?this.tuiSanitizer.sanitize(o.WPN.HTML,t):this.sanitizer.sanitize(o.WPN.HTML,t))||"")}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵprov=o.jDH({token:t,factory:t.ɵfac,providedIn:"root"}),e})();const K="assets/taiga-ui/icons",J={iconsPlace:K,path:(0,_.yu)(K),srcProcessor:j.D,contentProcessor:W,deprecated:t=>{const e=t.replace("Large","").replace("Outline",""),n=X[e];return n?`${e}/(Large|Outline) is deprecated, use ${n}/(Large|Outline) instead`:""}},Y=(0,y.ET)((()=>({iconsPlace:K,path:(0,_.yu)(K),deprecated:J.deprecated,srcProcessor:j.D,contentProcessor:W}))),q=(0,y.gc)();let Q=(()=>{var t;class e{constructor(){this.icon="",this.doc=(0,o.WQX)(r.qQ),this.win=(0,o.WQX)(N.Qc),this.options=(0,o.WQX)(Y),this.tuiSanitizer=(0,o.WQX)(B.rf,{optional:!0}),this.svgService=(0,o.WQX)(U),this.staticRequestService=(0,o.WQX)(P),this.sanitizer=(0,o.WQX)(g.up),this.el=(0,w.qW)(),this.baseHref=(0,o.WQX)(D.t2),this.src$=new F.m(1),this.srcInterceptors=(0,o.WQX)(q,{optional:!0}),this.innerHTML$=this.src$.pipe((0,x.n)((()=>(0,y.YB)(this.icon)?this.isExternal?this.getExternalIcon(this.icon):(0,G.of)(this.getSafeHtml(this.icon)):(0,G.of)(this.icon))),(0,T.Z)(""))}set src(t){this.options.deprecated(String(t)),this.icon=(this.srcInterceptors??[]).reduce(((t,e)=>e(t,this.options)),this.options.srcProcessor(t||"")),this.src$.next()}get src(){return this.icon}get use(){return(0,y.YB)(this.icon)?this.icon.includes(".svg#")?this.icon:this.resolveName(this.icon,this.options.path):""}get isInnerHTML(){return!(0,y.YB)(this.icon)||this.isSrc||this.isExternal||this.isName&&this.isShadowDOM}onError(t="External icon is missing on the given URL"){const{icon:e}=this,n=new CustomEvent("tui-icon-error",{bubbles:!0,detail:{message:t,icon:e}});this.el.dispatchEvent(n)}get isShadowDOM(){return(0,w.dd)(this.el)!==this.doc}get isUse(){return this.use.replace(_.sf,"").includes(".svg#")}get isExternal(){return this.isUrl||this.isCrossDomain||!this.isSrc&&!this.svgService.getOriginal(String(this.icon))}get isUrl(){return(0,y.YB)(this.icon)&&this.icon.replace(_.sf,"").endsWith(".svg")}get isSrc(){return(0,y.YB)(this.icon)&&(0,_.cJ)(this.icon)}get isName(){return!this.isUrl&&!this.isUse&&!this.isSrc}get isCrossDomain(){const{use:t,isUse:e,win:n}=this;return e&&t.startsWith("http")&&!!n.origin&&!t.startsWith(n.origin)}resolveName(t,e){return e(t,this.baseHref)}getSafeHtml(t){return this.isSrc?this.sanitize(t):this.process(t)}process(t){const e=this.svgService.getOriginal(t);return this.isName&&!e&&t&&this.onError("Attempted to use undefined named icon"),this.sanitize(e||"")}sanitize(t){return t=this.options.contentProcessor(t),this.tuiSanitizer&&(0,y.YB)(t)?this.sanitizer.bypassSecurityTrustHtml(this.tuiSanitizer.sanitize(o.WPN.HTML,t)||""):t}getExternalIcon(t){const e=t.includes(".svg")?t:this.use;return this.staticRequestService.request(e).pipe((0,V.W)((()=>(this.onError("Failed to load external SVG"),(0,G.of)("")))),(0,S.T)((t=>this.sanitize(t.replace("{var t;class e{constructor(){this.color=[0,0,0,1],this.colorChange=new o.bkB,this.hexMask={mask:new RegExp("^[A-F\\d]{0,6}$","gi")},this.modes=["HEX","RGB"],this.mode=this.modes[0]}get isHex(){return this.mode===this.modes[0]}get hex(){return(0,i.G7)(this.color[0],this.color[1],this.color[2]).replace("#","")}get opacity(){return Math.round(100*this.color[3])}onHexChange(t){if(6!==t.length)return;const e=(0,i.uB)(t);this.updateColor([e[0],e[1],e[2],this.color[3]])}onRgbChange(...t){this.updateColor(t)}updateColor(t){this.color=t,this.colorChange.emit(t)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-color-edit"]],hostAttrs:["ngSkipHydration","true"],inputs:{color:"color"},outputs:{colorChange:"colorChange"},decls:6,vars:16,consts:[["tuiDropdownAlign","left","tuiDropdownLimitWidth","min","tuiTextfieldSize","m",1,"t-select",3,"ngModelOptions","tuiTextfieldLabelOutside","ngModel","ngModelChange"],["size","s",4,"tuiDataList"],["tuiTextfieldSize","m",3,"maskito","tuiTextfieldLabelOutside","value","valueChange",4,"ngIf","ngIfElse"],["rgb",""],["tuiTextfieldPostfix","%","tuiTextfieldSize","m",1,"t-opacity",3,"max","min","ngModel","ngModelOptions","tuiTextfieldLabelOutside","ngModelChange"],["size","s"],["tuiOption","","type","button",3,"value",4,"ngFor","ngForOf"],["tuiOption","","type","button",3,"value"],["tuiTextfieldSize","m",3,"maskito","tuiTextfieldLabelOutside","value","valueChange"],["tuiTextfieldSize","m",1,"t-rgb",3,"max","min","ngModel","ngModelOptions","tuiTextfieldLabelOutside","ngModelChange"]],template:function(t,e){if(1&t&&(o.j41(0,"tui-select",0),o.bIt("ngModelChange",(function(t){return e.mode=t})),o.DNE(1,tt,2,1,"tui-data-list",1),o.k0s(),o.DNE(2,et,1,3,"tui-primitive-textfield",2),o.DNE(3,ot,3,18,"ng-template",null,3,o.C5r),o.j41(5,"tui-input-number",4),o.bIt("ngModelChange",(function(t){return e.onRgbChange(e.color[0],e.color[1],e.color[2],t/100)})),o.k0s()),2&t){const t=o.sdS(4);o.xc7("flex","0 0 auto"),o.Y8G("ngModelOptions",o.lJ4(14,nt))("tuiTextfieldLabelOutside",!0)("ngModel",e.mode),o.R7$(2),o.Y8G("ngIf",e.isHex)("ngIfElse",t),o.R7$(3),o.xc7("flex","0 0 auto"),o.Y8G("max",100)("min",0)("ngModel",e.opacity)("ngModelOptions",o.lJ4(15,nt))("tuiTextfieldLabelOutside",!0)}},dependencies:[r.Sq,r.bT,s.BC,s.vS,a.u,l.eD,l.gt,c.kf,c.G6,c.Om,d.Zc,d.xh,u.ET,u.ww,h.HY,p.uE,p.WX,p.aO],styles:["[_nghost-%COMP%]{display:flex}.t-select[_ngcontent-%COMP%]{inline-size:5.875rem}.t-opacity[_ngcontent-%COMP%]{inline-size:4.275rem}.t-rgb[_ngcontent-%COMP%], .t-opacity[_ngcontent-%COMP%]{text-align:center}"],changeDetection:0}),e})(),mt=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD,s.YN,l.Rp,c.CN,d.O9,u.pg,h.Vh,p.uE,p.aO]}),e})(),gt=(()=>{var t;class e extends C.c{constructor(){super((t=>this.point$.subscribe(t))),this.el=(0,w.qW)(),this.doc=(0,o.WQX)(r.qQ),this.point$=(0,v.xM)(this.el,"mousedown").pipe((0,v.QA)(),(0,x.n)((t=>{const e=(0,v.xM)(this.doc,"mousemove").pipe((0,S.T)((({clientX:t,clientY:e})=>(0,w.V_)(t,e,this.el))),(0,M.Q)((0,v.xM)(this.doc,"mouseup")));return t.target===this.el?e.pipe((0,T.Z)((0,w.V_)(t.clientX,t.clientY,this.el))):e})),(0,k.pQ)())}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵprov=o.jDH({token:t,factory:t.ɵfac}),e})(),bt=(()=>{var t;class e{constructor(){this.$=(0,o.WQX)(gt).pipe((0,k.pQ)()).subscribe((t=>{this.value=t,this.valueChange.emit([t[0],t[1]])})),this.value=[0,0],this.valueChange=new o.bkB}get left(){return 100*this.value[0]}get top(){return 100*this.value[1]}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-flat-picker"]],hostAttrs:["ngSkipHydration","true"],inputs:{value:"value"},outputs:{valueChange:"valueChange"},features:[o.Jv_([gt])],decls:1,vars:4,consts:[[1,"t-circle"]],template:function(t,e){1&t&&o.nrm(0,"div",0),2&t&&o.xc7("left",e.left,"%")("top",e.top,"%")},styles:["[_nghost-%COMP%]{position:relative;display:block}.t-circle[_ngcontent-%COMP%]{position:absolute;inline-size:1rem;block-size:1rem;border-radius:100%;margin:-.5rem 0 0 -.5rem;box-shadow:inset 0 0 0 1px var(--tui-base-01),0 0 0 1px var(--tui-base-03)}"],changeDetection:0}),e})(),yt=(()=>{var t;class e{constructor(){this.$=(0,o.WQX)(gt).pipe((0,k.pQ)()).subscribe((([t])=>{this.value=t,this.valueChange.emit(t)})),this.value=0,this.valueChange=new o.bkB}get left(){return 100*this.value}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-linear-picker"]],hostAttrs:["ngSkipHydration","true"],inputs:{value:"value"},outputs:{valueChange:"valueChange"},features:[o.Jv_([gt])],decls:1,vars:2,consts:[[1,"t-circle"]],template:function(t,e){1&t&&o.nrm(0,"div",0),2&t&&o.xc7("left",e.left,"%")},styles:["[_nghost-%COMP%]{position:relative;display:block;block-size:1rem;box-sizing:border-box}.t-circle[_ngcontent-%COMP%]{position:absolute;inline-size:1rem;block-size:1rem;border-radius:100%;margin:0 -.5rem;box-shadow:inset 0 0 0 2px var(--tui-base-01),0 0 0 1px var(--tui-base-03)}"],changeDetection:0}),e})(),kt=(()=>{var t;class e{constructor(){this.sanitizer=(0,o.WQX)(g.up),this.point=[0,1],this.hue=0,this.opacity=1,this.colorChange=new o.bkB}set color(t){if(this.currentColor.every(((e,n)=>e===t[n]))&&t[3]===this.opacity)return;const[e,n,o]=(0,i.qv)(t[0],t[1],t[2]);this.opacity=t[3],this.hue=e/360,this.point=[n,1-o/255]}get currentColor(){return this.getCurrentColor(this.hue,this.point)}get base(){return`rgb(${(0,i.Mk)(360*this.hue,1,255)})`}get gradient(){return this.sanitizer.bypassSecurityTrustStyle(`linear-gradient(to right, rgba(${this.currentColor.join(",")}, 0), rgb(${this.currentColor.join(",")}))`)}onPointChange(t){this.point=t,this.updateColor()}onHueChange(t){this.hue=t,this.updateColor()}onOpacityChange(t){this.opacity=(0,b.zM)(t,2),this.updateColor()}getCurrentColor(t,e){return(0,i.Mk)(360*t,e[0],255*(1-e[1]))}updateColor(){this.colorChange.emit([...this.currentColor,this.opacity])}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-color-picker"]],hostAttrs:["ngSkipHydration","true"],inputs:{color:"color"},outputs:{colorChange:"colorChange"},decls:5,vars:7,consts:[[1,"t-flat",3,"value","valueChange"],[1,"t-wrapper","t-wrapper_hue"],[1,"t-hue",3,"value","valueChange"],[1,"t-wrapper","t-wrapper_opacity"],[1,"t-opacity",3,"value","valueChange"]],template:function(t,e){1&t&&(o.j41(0,"tui-flat-picker",0),o.bIt("valueChange",(function(t){return e.onPointChange(t)})),o.k0s(),o.j41(1,"div",1)(2,"tui-linear-picker",2),o.bIt("valueChange",(function(t){return e.onHueChange(t)})),o.k0s()(),o.j41(3,"div",3)(4,"tui-linear-picker",4),o.bIt("valueChange",(function(t){return e.onOpacityChange(t)})),o.k0s()()),2&t&&(o.xc7("background-color",e.base),o.Y8G("value",e.point),o.R7$(2),o.Y8G("value",e.hue),o.R7$(1),o.xc7("background",e.gradient),o.R7$(1),o.Y8G("value",e.opacity))},dependencies:[bt,yt],styles:['[_nghost-%COMP%]{position:relative;display:block;isolation:isolate}.t-flat[_ngcontent-%COMP%]{block-size:14rem;background:linear-gradient(#0000,#000),linear-gradient(to right,#fff,#fff0);margin-bottom:.25rem;overflow:hidden}.t-wrapper[_ngcontent-%COMP%]{position:relative;margin:1rem 1.25rem;border-radius:.5rem}.t-wrapper[_ngcontent-%COMP%]:after{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";box-shadow:inset 0 0 0 1px #00000014;pointer-events:none;border-radius:inherit}.t-wrapper_hue[_ngcontent-%COMP%]{background:red}.t-wrapper_opacity[_ngcontent-%COMP%]:before{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";z-index:-1;background-image:linear-gradient(45deg,var(--tui-base-03) 25%,transparent 25%,transparent 75%,var(--tui-base-03) 75%,var(--tui-base-03)),linear-gradient(45deg,var(--tui-base-03) 25%,transparent 25%,transparent 75%,var(--tui-base-03) 75%,var(--tui-base-03));background-size:.375rem .375rem;background-position:0 0,.1875rem .1875rem;border-radius:inherit}.t-hue[_ngcontent-%COMP%]{background:linear-gradient(to right,red,#ff0,#0f0,#0ff,#00f,#f0f,red);border-radius:inherit;margin:0 .5rem}.t-opacity[_ngcontent-%COMP%]{border-radius:inherit;margin:0 .5rem}'],changeDetection:0}),(0,m.Cg)([y.PE],e.prototype,"getCurrentColor",null),e})(),vt=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD]}),e})(),wt=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD]}),e})(),Ct=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD,vt,wt]}),e})();const xt=(0,y.gc)(["Solid color","Gradient"]),St=(new Map([["color-black-100","#909090"],["color-black-200","#666666"],["color-black-300","#333333"],["color-blue-100","#1771e6"],["color-blue-200","#1464cc"],["color-blue-300","#0953b3"],["color-gray-100","#f5f5f6"],["color-gray-200","#e7e8ea"],["color-gray-300","#cbcfd3"],["color-gray-400","#959ba4"],["color-gray-500","#79818c"],["color-gray-600","#616871"],["color-green-100","#39b54a"],["color-green-200","#2ca53a"],["color-green-300","#168a21"],["color-light-blue-100","#ecf1f7"],["color-light-blue-200","#e4ebf3"],["color-light-blue-300","#dde4ed"],["color-red-100","#e01f19"],["color-red-200","#d3120e"],["color-red-300","#c40b08"],["color-yellow-100","#FFDD2C"],["color-yellow-200","#FCC521"],["color-yellow-300","#FAB618"],["transparent","transparent"]]),0),Mt={selectorMode:!0,mode:St,color:[0,0,0,1],colors:new Map,gradient:{icons:{"to top right":"@tui.move-up-right","to right":"@tui.move-right","to bottom right":"@tui.move-down-right","to bottom":"@tui.move-down","to bottom left":"@tui.move-down-left","to left":"@tui.move-left","to top left":"@tui.move-up-left","to top":"@tui.move-up"},steps:[[0,[0,0,0,1]],[1,[255,255,255,1]]],stop:0,direction:"to bottom",emptyStop:[0,0,0,0],buttons:["to top right","to right","to bottom right","to bottom","to bottom left","to left","to top left","to top"]}},Tt=(0,y.gc)(Mt);let Ot=(()=>{var t;class e{constructor(){this.$=(0,o.WQX)(gt).pipe((0,k.pQ)()).subscribe((([t])=>this.onPicker(t))),this.value=[0,1],this.valueChange=new o.bkB,this.indexChange=new o.bkB,this.index=NaN}onMouseUp(){this.index=NaN}onMouseDown(t){this.updateIndex(t)}onClick(t){this.value.length>2&&this.updateValue(this.value.filter(((e,n)=>n!==t)))}onPicker(t){Number.isNaN(this.index)&&(this.updateIndex(this.value.length),this.value=[...this.value,0]),this.value.some(((e,n)=>e===t&&n!==this.index))||this.updateValue(this.value.map(((e,n)=>n===this.index?t:e)))}updateIndex(t){this.index=t,this.indexChange.emit(t)}updateValue(t){this.value=t,this.valueChange.emit(t)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-linear-multi-picker"]],hostAttrs:["ngSkipHydration","true"],hostBindings:function(t,e){1&t&&o.bIt("mouseup",(function(){return e.onMouseUp()}),!1,o.EBC)},inputs:{value:"value"},outputs:{valueChange:"valueChange",indexChange:"indexChange"},features:[o.Jv_([gt])],decls:1,vars:1,consts:[["class","t-circle",3,"left","dblclick","mousedown",4,"ngFor","ngForOf"],[1,"t-circle",3,"dblclick","mousedown"]],template:function(t,e){1&t&&o.DNE(0,it,1,2,"div",0),2&t&&o.Y8G("ngForOf",e.value)},dependencies:[r.Sq],styles:["[_nghost-%COMP%]{position:relative;display:block;block-size:1rem;box-sizing:border-box}.t-circle[_ngcontent-%COMP%]{position:absolute;inline-size:1rem;block-size:1rem;border-radius:100%;margin:0 -.5rem;box-shadow:inset 0 0 0 2px var(--tui-base-01),0 0 0 1px var(--tui-base-03)}"],changeDetection:0}),e})(),Et=(()=>{var t;class e{constructor(){this.colors=new Map,this.selectedColor=new o.bkB,this.originalOrder=(t,e)=>0}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-palette"]],hostAttrs:["ngSkipHydration","true"],inputs:{colors:"colors"},outputs:{selectedColor:"selectedColor"},decls:2,vars:4,consts:[["type","button","class","t-button",3,"id","background","tuiHint","tuiHintDescribe","click",4,"ngFor","ngForOf"],["type","button",1,"t-button",3,"id","tuiHint","tuiHintDescribe","click"]],template:function(t,e){1&t&&(o.DNE(0,rt,1,5,"button",0),o.nI1(1,"keyvalue")),2&t&&o.Y8G("ngForOf",o.i5U(1,1,e.colors,e.originalOrder))},dependencies:[r.Sq,E.XZ,E.$$,r.lG],styles:["[_nghost-%COMP%]{display:flex;flex-wrap:wrap;padding:.875rem}.t-button[_ngcontent-%COMP%]{-webkit-appearance:none;appearance:none;padding:0;background:none;font-size:inherit;line-height:inherit;inline-size:1.5625rem;block-size:1.5625rem;box-sizing:border-box;margin:.375rem;border-radius:var(--tui-radius-m);border:1px solid rgba(0,0,0,.08)}"],changeDetection:0}),e})(),At=(()=>{var t;class e{constructor(){this.selectorOptions=(0,o.WQX)(Tt),this.stops=new Map(this.selectorOptions.gradient.steps),this.currentStop=this.selectorOptions.gradient.stop,this.direction=this.selectorOptions.gradient.direction,this.sanitizer=(0,o.WQX)(g.up),this.open=!1,this.colors=this.selectorOptions.colors,this.colorChange=new o.bkB,this.color=this.selectorOptions.color,this.modes=(0,o.WQX)(xt),this.currentMode=this.modes[this.selectorOptions.mode],this.buttons=this.selectorOptions.gradient.buttons}set colorSetter(t){t.startsWith("linear-gradient")?this.parseGradient(t):this.parseColor(t)}get selectorMode(){return this.selectorOptions.selectorMode}get palette(){return this.filterPalette(this.colors,this.isGradient)}get stopsKeys(){return this.getStopsKeys(this.stops)}get currentColor(){return this.isGradient?this.getStop(this.currentStop):this.color}get gradient(){return this.sanitizer.bypassSecurityTrustStyle(this.getGradient("to right"))}get isGradient(){return this.currentMode===this.modes[1]}getIcon(t){return this.selectorOptions.gradient.icons[t]}isModeActive(t){return this.currentMode===t}isDirectionActive(t){return this.direction===t}onPalettePick(t){this.updateColor(t)}onDirectionChange(t){this.direction=t,this.updateColor(this.getGradient(t))}onModeSelect(t){this.currentMode=t,this.open=!1,this.updateColor(t===this.modes[St]?`rgba(${this.color.join(", ")})`:this.getGradient(this.direction))}onIndexChange(t){this.currentStop=this.stopsKeys[t]??0}onColorChange(t){this.isGradient?(this.stops.set(this.currentStop,t),this.updateColor(this.getGradient(this.direction))):this.updateColor(`rgba(${t.join(", ")})`)}onStopsChange(t){const e=this.stopsKeys.find((e=>!t.includes(e))),n=t.find((t=>!this.stopsKeys.includes(t)));void 0===e&&void 0!==n&&this.addStop(n),void 0!==e&&void 0===n&&this.removeStop(e),void 0!==e&&void 0!==n&&this.replaceStop(e,n),this.updateColor(this.getGradient(this.direction))}getStopsKeys(t){return Array.from(t.keys())}filterPalette(t,e){const n=new Map(t);return n.forEach(((t,o)=>{(t.startsWith("linear-gradient")&&!e||!t.startsWith("linear-gradient")&&e)&&n.delete(o)})),n}updateColor(t){this.colorChange.emit(t)}getGradient(t){return`linear-gradient(${t}, ${[...this.stopsKeys].sort(y._J).map((t=>`rgba(${this.getStop(t).join(", ")}) ${100*t}%`)).join(", ")})`}getStop(t){return this.stops.get(t)||this.selectorOptions.gradient.emptyStop}addStop(t){const e=this.stopsKeys.reduce(((e,n)=>Math.abs(n-t)o===t?[e,n]:[o,this.getStop(o)])))}parseGradient(t){if(t===this.getGradient(this.direction))return;const e=(0,i.q0)((0,i.L4)(t));this.direction=e.side,this.currentStop=this.selectorOptions.gradient.stop,this.stops=new Map(e.stops.length?e.stops.map((({color:t,position:e})=>[parseFloat(e)/100,(0,i.xr)(t)])):this.selectorOptions.gradient.steps)}parseColor(t){this.currentStop=this.selectorOptions.gradient.stop,this.color=(0,i.xr)(t)}}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵcmp=o.VBU({type:t,selectors:[["tui-color-selector"]],hostAttrs:["ngSkipHydration","true"],inputs:{colors:"colors",colorSetter:["color","colorSetter"]},outputs:{colorChange:"colorChange"},decls:5,vars:5,consts:[[4,"ngIf"],[3,"color","colorChange"],["tuiGroup","","class","t-edit",3,"color","colorChange",4,"ngIf"],["class","t-palette",3,"colors","selectedColor",4,"ngIf"],[1,"t-select",3,"tuiDropdown","tuiDropdownOpen","tuiDropdownOpenChange"],["appearance","","size","s","tuiButton","","tuiChevron","","type","button"],["menu",""],[1,"t-hr"],["role","menu","size","s",1,"t-menu"],["role","menuitemradio","tuiOption","","type","button",3,"click","keydown.enter.prevent","keydown.space.prevent",4,"ngFor","ngForOf"],["role","menuitemradio","tuiOption","","type","button",3,"click","keydown.enter.prevent","keydown.space.prevent"],["icon","@tui.check","class","t-checkmark",4,"ngIf"],["icon","@tui.check",1,"t-checkmark"],[1,"t-wrapper"],[1,"t-gradient",3,"value","indexChange","valueChange"],[1,"t-buttons"],["appearance","","size","xs","tuiHintDescribe","","tuiIconButton","","type","button","class","t-direction",3,"t-direction_active","iconStart","tuiHint","click",4,"ngFor","ngForOf"],["appearance","","size","xs","tuiHintDescribe","","tuiIconButton","","type","button",1,"t-direction",3,"iconStart","tuiHint","click"],["tuiGroup","",1,"t-edit",3,"color","colorChange"],[1,"t-palette",3,"colors","selectedColor"]],template:function(t,e){1&t&&(o.DNE(0,ct,7,3,"ng-container",0),o.DNE(1,ut,5,4,"ng-container",0),o.j41(2,"tui-color-picker",1),o.bIt("colorChange",(function(t){return e.onColorChange(t)})),o.k0s(),o.DNE(3,ht,1,1,"tui-color-edit",2),o.DNE(4,pt,1,1,"tui-palette",3)),2&t&&(o.Y8G("ngIf",e.selectorMode),o.R7$(1),o.Y8G("ngIf",e.isGradient),o.R7$(1),o.Y8G("color",e.currentColor),o.R7$(1),o.Y8G("ngIf",!e.isGradient),o.R7$(1),o.Y8G("ngIf",e.palette.size))},dependencies:[r.Sq,r.bT,f.p,kt,Ot,ft,h.pU,h.iE,p.uE,p.aO,O.w7,Et,E.XZ,E.$$,A.k,I.q],styles:['[_nghost-%COMP%]{position:relative;display:block;isolation:isolate;inline-size:22.6rem}.t-wrapper[_ngcontent-%COMP%]{position:relative;margin:1.25rem;border-radius:.5rem}.t-wrapper[_ngcontent-%COMP%]:after{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";box-shadow:inset 0 0 0 1px #00000014;pointer-events:none;border-radius:inherit}.t-wrapper[_ngcontent-%COMP%]:before{position:absolute;top:0;left:0;inline-size:100%;block-size:100%;content:"";z-index:-1;background-image:linear-gradient(45deg,var(--tui-base-03) 25%,transparent 25%,transparent 75%,var(--tui-base-03) 75%,var(--tui-base-03)),linear-gradient(45deg,var(--tui-base-03) 25%,transparent 25%,transparent 75%,var(--tui-base-03) 75%,var(--tui-base-03));background-size:.375rem .375rem;background-position:0 0,.1875rem .1875rem;border-radius:inherit}.t-hr[_ngcontent-%COMP%]{block-size:1px;margin:0 0 0 -1px;border:none;background:var(--tui-base-03)}.t-gradient[_ngcontent-%COMP%]{margin:0 .5rem;border-radius:inherit}.t-select[_ngcontent-%COMP%]{margin:.75rem .5rem 0}.t-arrow[_ngcontent-%COMP%]{transition-property:transform;transition-duration:var(--tui-duration, .3s);transition-timing-function:ease-in-out}.t-arrow_rotated[_ngcontent-%COMP%]{transform:rotate(180deg)}.t-menu[_ngcontent-%COMP%]{inline-size:11.25rem}.t-checkmark[_ngcontent-%COMP%]{margin-left:auto;inline-size:1rem;block-size:1rem}.t-buttons[_ngcontent-%COMP%]{display:flex;padding:0 .75rem 1.25rem;justify-content:space-between}.t-direction[_ngcontent-%COMP%]{color:var(--tui-text-02);margin:0 .375rem}.t-direction[_ngcontent-%COMP%]:hover, .t-direction_active[_ngcontent-%COMP%]{color:var(--tui-text-01);background:var(--tui-secondary-hover)}.t-edit[_ngcontent-%COMP%]{margin:1.25rem}.t-palette[_ngcontent-%COMP%]{box-sizing:border-box;box-shadow:inset 0 1px var(--tui-base-03)}'],changeDetection:0}),(0,m.Cg)([y.PE],e.prototype,"getStopsKeys",null),(0,m.Cg)([y.PE],e.prototype,"filterPalette",null),e})(),It=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD]}),e})(),Nt=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD,E.pp]}),e})(),Dt=(()=>{var t;class e{}return(t=e).ɵfac=function(e){return new(e||t)},t.ɵmod=o.$C({type:t}),t.ɵinj=o.G2t({imports:[r.MD,Q,Ct,It,mt,Nt,I.q,E.pp,p.uE,p.aO]}),e})()},6426:(t,e,n)=>{n.r(e),n.d(e,{CommandManager:()=>L,Editor:()=>Me,Extension:()=>ft,InputRule:()=>tt,Mark:()=>st,Node:()=>Ne,NodePos:()=>xe,NodeView:()=>De,PasteRule:()=>lt,Tracker:()=>Be,callOrReturn:()=>V,combineTransactionSteps:()=>Pt,createChainableState:()=>$,createDocument:()=>Lt,createNodeFromContent:()=>At,createStyleTag:()=>Se,defaultBlockAt:()=>Bt,deleteProps:()=>$t,elementFromString:()=>Et,escapeForRegEx:()=>$e,extensions:()=>Ce,findChildren:()=>_t,findChildrenInRange:()=>Ht,findDuplicates:()=>ht,findParentNode:()=>Ft,findParentNodeClosestToPos:()=>jt,fromString:()=>X,generateHTML:()=>Wt,generateJSON:()=>Xt,generateText:()=>Kt,getAttributes:()=>Yt,getAttributesFromExtensions:()=>_,getChangedRanges:()=>Qt,getDebugJSON:()=>Zt,getExtensionField:()=>P,getHTMLFromFragment:()=>Gt,getMarkAttributes:()=>zt,getMarkRange:()=>wt,getMarkType:()=>Ct,getMarksBetween:()=>te,getNodeAtPosition:()=>ee,getNodeAttributes:()=>Jt,getNodeType:()=>H,getRenderedAttributes:()=>F,getSchema:()=>Vt,getSchemaByResolvedExtensions:()=>J,getSchemaTypeByName:()=>Y,getSchemaTypeNameByName:()=>Rt,getSplittedAttributes:()=>ne,getText:()=>Ut,getTextBetween:()=>mt,getTextContentFromNodes:()=>Q,getTextSerializersFromSchema:()=>gt,injectExtensionAttributesToParseRule:()=>U,inputRulesPlugin:()=>ot,isActive:()=>ie,isAtEndOfNode:()=>re,isAtStartOfNode:()=>se,isEmptyObject:()=>W,isExtensionRulesEnabled:()=>q,isFunction:()=>G,isList:()=>ae,isMacOS:()=>Nt,isMarkActive:()=>oe,isNodeActive:()=>Dt,isNodeEmpty:()=>le,isNodeSelection:()=>ce,isNumber:()=>at,isPlainObject:()=>it,isRegExp:()=>Z,isString:()=>Le,isTextSelection:()=>xt,isiOS:()=>Tt,markInputRule:()=>Te,markPasteRule:()=>Re,mergeAttributes:()=>j,mergeDeep:()=>rt,minMax:()=>St,nodeInputRule:()=>Oe,nodePasteRule:()=>ze,objectIncludes:()=>yt,pasteRulesPlugin:()=>ut,posToDOMRect:()=>de,removeDuplicates:()=>qt,resolveFocusPosition:()=>Mt,selectionToInsertionEnd:()=>It,splitExtensions:()=>B,textInputRule:()=>Ae,textPasteRule:()=>Pe,textblockTypeInputRule:()=>Ee,wrappingInputRule:()=>Ie});var o=n(3829),i=n(7887),r=n(4103),s=n(9939),a=n(4238);const l=(t,e)=>!t.selection.empty&&(e&&e(t.tr.deleteSelection().scrollIntoView()),!0);function c(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("backward",t):n.parentOffset>0)?null:n}const d=(t,e,n)=>{let i=c(t,n);if(!i)return!1;let r=f(i);if(!r){let n=i.blockRange(),o=n&&(0,a.jP)(n);return null!=o&&(e&&e(t.tr.lift(n,o).scrollIntoView()),!0)}let l=r.nodeBefore;if(S(t,r,e,-1))return!0;if(0==i.parent.content.size&&(h(l,"end")||o.nh.isSelectable(l)))for(let n=i.depth;;n--){let c=(0,a.$L)(t.doc,i.before(n),i.after(n),s.Ji.empty);if(c&&c.slice.size1)break}return!(!l.isAtom||r.depth!=i.depth-1||(e&&e(t.tr.delete(r.pos-l.nodeSize,r.pos).scrollIntoView()),0))};function u(t,e,n){let i=e.nodeBefore,r=e.pos-1;for(;!i.isTextblock;r--){if(i.type.spec.isolating)return!1;let t=i.lastChild;if(!t)return!1;i=t}let l=e.nodeAfter,c=e.pos+1;for(;!l.isTextblock;c++){if(l.type.spec.isolating)return!1;let t=l.firstChild;if(!t)return!1;l=t}let d=(0,a.$L)(t.doc,r,c,s.Ji.empty);if(!d||d.from!=r||d instanceof a.Ln&&d.slice.size>=c-r)return!1;if(n){let e=t.tr.step(d);e.setSelection(o.U3.create(e.doc,r)),n(e.scrollIntoView())}return!0}function h(t,e,n=!1){for(let o=t;o;o="start"==e?o.firstChild:o.lastChild){if(o.isTextblock)return!0;if(n&&1!=o.childCount)return!1}return!1}const p=(t,e,n)=>{let{$head:i,empty:r}=t.selection,s=i;if(!r)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("backward",t):i.parentOffset>0)return!1;s=f(i)}let a=s&&s.nodeBefore;return!(!a||!o.nh.isSelectable(a)||(e&&e(t.tr.setSelection(o.nh.create(t.doc,s.pos-a.nodeSize)).scrollIntoView()),0))};function f(t){if(!t.parent.type.spec.isolating)for(let e=t.depth-1;e>=0;e--){if(t.index(e)>0)return t.doc.resolve(t.before(e+1));if(t.node(e).type.spec.isolating)break}return null}function m(t,e){let{$cursor:n}=t.selection;return!n||(e?!e.endOfTextblock("forward",t):n.parentOffset{let i=m(t,n);if(!i)return!1;let r=y(i);if(!r)return!1;let l=r.nodeAfter;if(S(t,r,e,1))return!0;if(0==i.parent.content.size&&(h(l,"start")||o.nh.isSelectable(l))){let n=(0,a.$L)(t.doc,i.before(),i.after(),s.Ji.empty);if(n&&n.slice.size{let{$head:i,empty:r}=t.selection,s=i;if(!r)return!1;if(i.parent.isTextblock){if(n?!n.endOfTextblock("forward",t):i.parentOffset=0;e--){let n=t.node(e);if(t.index(e)+1{let{$head:n,$anchor:o}=t.selection;return!(!n.parent.type.spec.code||!n.sameParent(o)||(e&&e(t.tr.insertText("\n").scrollIntoView()),0))};function v(t){for(let e=0;e{let{$head:n,$anchor:i}=t.selection;if(!n.parent.type.spec.code||!n.sameParent(i))return!1;let r=n.node(-1),s=n.indexAfter(-1),a=v(r.contentMatchAt(s));if(!a||!r.canReplaceWith(s,s,a))return!1;if(e){let i=n.after(),r=t.tr.replaceWith(i,i,a.createAndFill());r.setSelection(o.LN.near(r.doc.resolve(i),1)),e(r.scrollIntoView())}return!0},C=(t,e)=>{let n=t.selection,{$from:i,$to:r}=n;if(n instanceof o.i5||i.parent.inlineContent||r.parent.inlineContent)return!1;let s=v(r.parent.contentMatchAt(r.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let n=(!i.parentOffset&&r.index(){let{$cursor:n}=t.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let o=n.before();if((0,a.zy)(t.doc,o))return e&&e(t.tr.split(o).scrollIntoView()),!0}let o=n.blockRange(),i=o&&(0,a.jP)(o);return null!=i&&(e&&e(t.tr.lift(o,i).scrollIntoView()),!0)};function S(t,e,n,i){let r,l,c=e.nodeBefore,d=e.nodeAfter,u=c.type.spec.isolating||d.type.spec.isolating;if(!u&&function(t,e,n){let o=e.nodeBefore,i=e.nodeAfter,r=e.index();return!(!(o&&i&&o.type.compatibleContent(i.type))||(!o.content.size&&e.parent.canReplace(r-1,r)?(n&&n(t.tr.delete(e.pos-o.nodeSize,e.pos).scrollIntoView()),0):!e.parent.canReplace(r,r+1)||!i.isTextblock&&!(0,a.n9)(t.doc,e.pos)||(n&&n(t.tr.clearIncompatible(e.pos,o.type,o.contentMatchAt(o.childCount)).join(e.pos).scrollIntoView()),0)))}(t,e,n))return!0;let p=!u&&e.parent.canReplace(e.index(),e.index()+1);if(p&&(r=(l=c.contentMatchAt(c.childCount)).findWrapping(d.type))&&l.matchType(r[0]||d.type).validEnd){if(n){let o=e.pos+d.nodeSize,i=s.FK.empty;for(let t=r.length-1;t>=0;t--)i=s.FK.from(r[t].create(null,i));i=s.FK.from(c.copy(i));let l=t.tr.step(new a.Wg(e.pos-1,o,e.pos,o,new s.Ji(i,1,0),r.length,!0)),u=o+2*r.length;(0,a.n9)(l.doc,u)&&l.join(u),n(l.scrollIntoView())}return!0}let f=d.type.spec.isolating||i>0&&u?null:o.LN.findFrom(e,1),m=f&&f.$from.blockRange(f.$to),g=m&&(0,a.jP)(m);if(null!=g&&g>=e.depth)return n&&n(t.tr.lift(m,g).scrollIntoView()),!0;if(p&&h(d,"start",!0)&&h(c,"end")){let o=c,i=[];for(;i.push(o),!o.isTextblock;)o=o.lastChild;let r=d,l=1;for(;!r.isTextblock;r=r.firstChild)l++;if(o.canReplace(o.childCount,o.childCount,r.content)){if(n){let o=s.FK.empty;for(let t=i.length-1;t>=0;t--)o=s.FK.from(i[t].copy(o));n(t.tr.step(new a.Wg(e.pos-i.length,e.pos+d.nodeSize,e.pos+l,e.pos+d.nodeSize-l,new s.Ji(o,i.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function M(t){return function(e,n){let i=e.selection,r=t<0?i.$from:i.$to,s=r.depth;for(;r.node(s).isInline;){if(!s)return!1;s--}return!!r.node(s).isTextblock&&(n&&n(e.tr.setSelection(o.U3.create(e.doc,t<0?r.start(s):r.end(s)))),!0)}}const T=M(-1),O=M(1);function E(t,e=null){return function(n,o){let i=!1;for(let o=0;o{if(i)return!1;if(o.isTextblock&&!o.hasMarkup(t,e))if(o.type==t)i=!0;else{let e=n.doc.resolve(r),o=e.index();i=e.parent.canReplaceWith(o,o+1,t)}}))}if(!i)return!1;if(o){let i=n.tr;for(let o=0;o{let{$from:n,$to:i}=t.selection;if(t.selection instanceof o.nh&&t.selection.node.isBlock)return!(!n.parentOffset||!(0,a.zy)(t.doc,n.pos)||(e&&e(t.tr.split(n.pos).scrollIntoView()),0));if(!n.parent.isBlock)return!1;if(e){let r=i.parentOffset==i.parent.content.size,s=t.tr;(t.selection instanceof o.U3||t.selection instanceof o.i5)&&s.deleteSelection();let l=0==n.depth?null:v(n.node(-1).contentMatchAt(n.indexAfter(-1))),c=r&&l?[{type:l}]:void 0,d=(0,a.zy)(s.doc,s.mapping.map(n.pos),1,c);if(c||d||!(0,a.zy)(s.doc,s.mapping.map(n.pos),1,l?[{type:l}]:void 0)||(l&&(c=[{type:l}]),d=!0),d&&(s.split(s.mapping.map(n.pos),1,c),!r&&!n.parentOffset&&n.parent.type!=l)){let t=s.mapping.map(n.before()),e=s.doc.resolve(t);l&&n.node(-1).canReplaceWith(e.index(),e.index()+1,l)&&s.setNodeMarkup(s.mapping.map(n.before()),l)}e(s.scrollIntoView())}return!0})),"Mod-Enter":w,Backspace:I,"Mod-Backspace":I,"Shift-Backspace":I,Delete:N,"Mod-Delete":N,"Mod-a":(t,e)=>(e&&e(t.tr.setSelection(new o.i5(t.doc))),!0)},R={"Ctrl-h":D.Backspace,"Alt-Backspace":D["Mod-Backspace"],"Ctrl-d":D.Delete,"Ctrl-Alt-Backspace":D["Mod-Delete"],"Alt-Delete":D["Mod-Delete"],"Alt-d":D["Mod-Delete"],"Ctrl-a":T,"Ctrl-e":O};for(let t in D)R[t]=D[t];function $(t){const{state:e,transaction:n}=t;let{selection:o}=n,{doc:i}=n,{storedMarks:r}=n;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 r},get selection(){return o},get doc(){return i},get tr(){return o=n.selection,i=n.doc,r=n.storedMarks,n}}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();class L{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:o}=e,{tr:i}=n,r=this.buildProps(i);return Object.fromEntries(Object.entries(t).map((([t,e])=>[t,(...t)=>{const n=e(...t)(r);return i.getMeta("preventDispatch")||this.hasCustomState||o.dispatch(i),n}])))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:o,state:i}=this,{view:r}=o,s=[],a=!!t,l=t||i.tr,c={...Object.fromEntries(Object.entries(n).map((([t,n])=>[t,(...t)=>{const o=this.buildProps(l,e),i=n(...t)(o);return s.push(i),c}]))),run:()=>(a||!e||l.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(l),s.every((t=>!0===t)))};return c}createCan(t){const{rawCommands:e,state:n}=this,o=!1,i=t||n.tr,r=this.buildProps(i,o);return{...Object.fromEntries(Object.entries(e).map((([t,e])=>[t,(...t)=>e(...t)({...r,dispatch:void 0})]))),chain:()=>this.createChain(i,o)}}buildProps(t,e=!0){const{rawCommands:n,editor:o,state:i}=this,{view:r}=o,s={tr:t,editor:o,view:r,state:$({state:i,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map((([t,e])=>[t,(...t)=>e(...t)(s)])))}};return s}}class z{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){const n=this.callbacks[t];return n&&n.forEach((t=>t.apply(this,e))),this}off(t,e){const n=this.callbacks[t];return n&&(e?this.callbacks[t]=n.filter((t=>t!==e)):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}}function P(t,e,n){return void 0===t.config[e]&&t.parent?P(t.parent,e,n):"function"==typeof t.config[e]?t.config[e].bind({...n,parent:t.parent?P(t.parent,e,n):null}):t.config[e]}function B(t){return{baseExtensions:t.filter((t=>"extension"===t.type)),nodeExtensions:t.filter((t=>"node"===t.type)),markExtensions:t.filter((t=>"mark"===t.type))}}function _(t){const e=[],{nodeExtensions:n,markExtensions:o}=B(t),i=[...n,...o],r={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return t.forEach((t=>{const n=P(t,"addGlobalAttributes",{name:t.name,options:t.options,storage:t.storage,extensions:i});n&&n().forEach((t=>{t.types.forEach((n=>{Object.entries(t.attributes).forEach((([t,o])=>{e.push({type:n,name:t,attribute:{...r,...o}})}))}))}))})),i.forEach((t=>{const n={name:t.name,options:t.options,storage:t.storage},o=P(t,"addAttributes",n);if(!o)return;const i=o();Object.entries(i).forEach((([n,o])=>{const i={...r,...o};"function"==typeof(null==i?void 0:i.default)&&(i.default=i.default()),(null==i?void 0:i.isRequired)&&void 0===(null==i?void 0:i.default)&&delete i.default,e.push({type:t.name,name:n,attribute:i})}))})),e}function H(t,e){if("string"==typeof t){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);return e.nodes[t]}return t}function j(...t){return t.filter((t=>!!t)).reduce(((t,e)=>{const n={...t};return Object.entries(e).forEach((([t,e])=>{if(n[t])if("class"===t){const o=e?e.split(" "):[],i=n[t]?n[t].split(" "):[],r=o.filter((t=>!i.includes(t)));n[t]=[...i,...r].join(" ")}else if("style"===t){const o=e?e.split(";").map((t=>t.trim())).filter(Boolean):[],i=n[t]?n[t].split(";").map((t=>t.trim())).filter(Boolean):[],r=new Map;i.forEach((t=>{const[e,n]=t.split(":").map((t=>t.trim()));r.set(e,n)})),o.forEach((t=>{const[e,n]=t.split(":").map((t=>t.trim()));r.set(e,n)})),n[t]=Array.from(r.entries()).map((([t,e])=>`${t}: ${e}`)).join("; ")}else n[t]=e;else n[t]=e})),n}),{})}function F(t,e){return e.filter((e=>e.type===t.type.name)).filter((t=>t.attribute.rendered)).map((e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]})).reduce(((t,e)=>j(t,e)),{})}function G(t){return"function"==typeof t}function V(t,e=void 0,...n){return G(t)?e?t.bind(e)(...n):t(...n):t}function W(t={}){return 0===Object.keys(t).length&&t.constructor===Object}function X(t){return"string"!=typeof t?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):"true"===t||"false"!==t&&t}function U(t,e){return"style"in t?t:{...t,getAttrs:n=>{const o=t.getAttrs?t.getAttrs(n):t.attrs;if(!1===o)return!1;const i=e.reduce(((t,e)=>{const o=e.attribute.parseHTML?e.attribute.parseHTML(n):X(n.getAttribute(e.name));return null==o?t:{...t,[e.name]:o}}),{});return{...o,...i}}}}function K(t){return Object.fromEntries(Object.entries(t).filter((([t,e])=>("attrs"!==t||!W(e))&&null!=e)))}function J(t,e){var n;const o=_(t),{nodeExtensions:i,markExtensions:r}=B(t),a=null===(n=i.find((t=>P(t,"topNode"))))||void 0===n?void 0:n.name,l=Object.fromEntries(i.map((n=>{const i=o.filter((t=>t.type===n.name)),r={name:n.name,options:n.options,storage:n.storage,editor:e},s=K({...t.reduce(((t,e)=>{const o=P(e,"extendNodeSchema",r);return{...t,...o?o(n):{}}}),{}),content:V(P(n,"content",r)),marks:V(P(n,"marks",r)),group:V(P(n,"group",r)),inline:V(P(n,"inline",r)),atom:V(P(n,"atom",r)),selectable:V(P(n,"selectable",r)),draggable:V(P(n,"draggable",r)),code:V(P(n,"code",r)),whitespace:V(P(n,"whitespace",r)),defining:V(P(n,"defining",r)),isolating:V(P(n,"isolating",r)),attrs:Object.fromEntries(i.map((t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]})))}),a=V(P(n,"parseHTML",r));a&&(s.parseDOM=a.map((t=>U(t,i))));const l=P(n,"renderHTML",r);l&&(s.toDOM=t=>l({node:t,HTMLAttributes:F(t,i)}));const c=P(n,"renderText",r);return c&&(s.toText=c),[n.name,s]}))),c=Object.fromEntries(r.map((n=>{const i=o.filter((t=>t.type===n.name)),r={name:n.name,options:n.options,storage:n.storage,editor:e},s=K({...t.reduce(((t,e)=>{const o=P(e,"extendMarkSchema",r);return{...t,...o?o(n):{}}}),{}),inclusive:V(P(n,"inclusive",r)),excludes:V(P(n,"excludes",r)),group:V(P(n,"group",r)),spanning:V(P(n,"spanning",r)),code:V(P(n,"code",r)),attrs:Object.fromEntries(i.map((t=>{var e;return[t.name,{default:null===(e=null==t?void 0:t.attribute)||void 0===e?void 0:e.default}]})))}),a=V(P(n,"parseHTML",r));a&&(s.parseDOM=a.map((t=>U(t,i))));const l=P(n,"renderHTML",r);return l&&(s.toDOM=t=>l({mark:t,HTMLAttributes:F(t,i)})),[n.name,s]})));return new s.Sj({topNode:a,nodes:l,marks:c})}function Y(t,e){return e.nodes[t]||e.marks[t]||null}function q(t,e){return Array.isArray(e)?e.some((e=>("string"==typeof e?e:e.name)===t.name)):e}const Q=(t,e=500)=>{let n="";const o=t.parentOffset;return t.parent.nodesBetween(Math.max(0,o-e),o,((t,e,i,r)=>{var s,a;const l=(null===(a=(s=t.type.spec).toText)||void 0===a?void 0:a.call(s,{node:t,pos:e,parent:i,index:r}))||t.textContent||"%leaf%";n+=t.isAtom&&!t.isText?l:l.slice(0,Math.max(0,o-e))})),n};function Z(t){return"[object RegExp]"===Object.prototype.toString.call(t)}class tt{constructor(t){this.find=t.find,this.handler=t.handler}}const et=(t,e)=>{if(Z(e))return e.exec(t);const n=e(t);if(!n)return null;const o=[n.text];return o.index=n.index,o.input=t,o.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),o.push(n.replaceWith)),o};function nt(t){var e;const{editor:n,from:o,to:i,text:r,rules:s,plugin:a}=t,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(o);if(c.parent.type.spec.code||(null===(e=c.nodeBefore||c.nodeAfter)||void 0===e?void 0:e.marks.find((t=>t.type.spec.code))))return!1;let d=!1;const u=Q(c)+r;return s.forEach((t=>{if(d)return;const e=et(u,t.find);if(!e)return;const s=l.state.tr,c=$({state:l.state,transaction:s}),h={from:o-(e[0].length-r.length),to:i},{commands:p,chain:f,can:m}=new L({editor:n,state:c});null!==t.handler({state:c,range:h,match:e,commands:p,chain:f,can:m})&&s.steps.length&&(s.setMeta(a,{transform:s,from:o,to:i,text:r}),l.dispatch(s),d=!0)})),d}function ot(t){const{editor:e,rules:n}=t,i=new o.k_({state:{init:()=>null,apply(t,o){const r=t.getMeta(i);if(r)return r;const s=t.getMeta("applyInputRules");return!!s&&setTimeout((()=>{const{from:t,text:o}=s,r=t+o.length;nt({editor:e,from:t,to:r,text:o,rules:n,plugin:i})})),t.selectionSet||t.docChanged?null:o}},props:{handleTextInput:(t,o,r,s)=>nt({editor:e,from:o,to:r,text:s,rules:n,plugin:i}),handleDOMEvents:{compositionend:t=>(setTimeout((()=>{const{$cursor:o}=t.state.selection;o&&nt({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:i})})),!1)},handleKeyDown(t,o){if("Enter"!==o.key)return!1;const{$cursor:r}=t.state.selection;return!!r&&nt({editor:e,from:r.pos,to:r.pos,text:"\n",rules:n,plugin:i})}},isInputRules:!0});return i}function it(t){return"Object"===function(t){return Object.prototype.toString.call(t).slice(8,-1)}(t)&&t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype}function rt(t,e){const n={...t};return it(t)&&it(e)&&Object.keys(e).forEach((o=>{it(e[o])&&it(t[o])?n[o]=rt(t[o],e[o]):n[o]=e[o]})),n}class st{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=V(P(this,"addOptions",{name:this.name}))),this.storage=V(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new st(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>rt(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new st(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=V(P(e,"addOptions",{name:e.name})),e.storage=V(P(e,"addStorage",{name:e.name,options:e.options})),e}static handleExit({editor:t,mark:e}){const{tr:n}=t.state,o=t.state.selection.$from;if(o.pos===o.end()){const i=o.marks();if(!i.find((t=>(null==t?void 0:t.type.name)===e.name)))return!1;const r=i.find((t=>(null==t?void 0:t.type.name)===e.name));return r&&n.removeStoredMark(r),n.insertText(" ",o.pos),t.view.dispatch(n),!0}return!1}}function at(t){return"number"==typeof t}class lt{constructor(t){this.find=t.find,this.handler=t.handler}}const ct=(t,e,n)=>{if(Z(e))return[...t.matchAll(e)];const o=e(t,n);return o?o.map((e=>{const n=[e.text];return n.index=e.index,n.input=t,n.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(e.replaceWith)),n})):[]},dt=t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null===(e=n.clipboardData)||void 0===e||e.setData("text/html",t),n};function ut(t){const{editor:e,rules:n}=t;let i=null,r=!1,s=!1,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l="undefined"!=typeof DragEvent?new DragEvent("drop"):null;const c=({state:t,from:n,to:o,rule:i,pasteEvt:r})=>{const s=t.tr,c=$({state:t,transaction:s}),d=function(t){const{editor:e,state:n,from:o,to:i,rule:r,pasteEvent:s,dropEvent:a}=t,{commands:l,chain:c,can:d}=new L({editor:e,state:n}),u=[];return n.doc.nodesBetween(o,i,((t,e)=>{if(!t.isTextblock||t.type.spec.code)return;const h=Math.max(o,e),p=Math.min(i,e+t.content.size),f=t.textBetween(h-e,p-e,void 0,"");ct(f,r.find,s).forEach((t=>{if(void 0===t.index)return;const e=h+t.index+1,o=e+t[0].length,i={from:n.tr.mapping.map(e),to:n.tr.mapping.map(o)},p=r.handler({state:n,range:i,match:t,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});u.push(p)}))})),u.every((t=>null!==t))}({editor:e,state:c,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:r,dropEvent:l});if(d&&s.steps.length)return l="undefined"!=typeof DragEvent?new DragEvent("drop"):null,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,s};return n.map((t=>new o.k_({view(t){const e=e=>{var n;i=(null===(n=t.dom.parentElement)||void 0===n?void 0:n.contains(e.target))?t.dom.parentElement:null};return window.addEventListener("dragstart",e),{destroy(){window.removeEventListener("dragstart",e)}}},props:{handleDOMEvents:{drop:(t,e)=>(s=i===t.dom.parentElement,l=e,!1),paste:(t,e)=>{var n;const o=null===(n=e.clipboardData)||void 0===n?void 0:n.getData("text/html");return a=e,r=!!(null==o?void 0:o.includes("data-pm-slice")),!1}}},appendTransaction:(e,n,o)=>{const i=e[0],l="paste"===i.getMeta("uiEvent")&&!r,d="drop"===i.getMeta("uiEvent")&&!s,u=i.getMeta("applyPasteRules"),h=!!u;if(!l&&!d&&!h)return;if(h){const{from:e,text:n}=u,i=e+n.length,r=dt(n);return c({rule:t,state:o,from:e,to:{b:i},pasteEvt:r})}const p=n.doc.content.findDiffStart(o.doc.content),f=n.doc.content.findDiffEnd(o.doc.content);return at(p)&&f&&p!==f.b?c({rule:t,state:o,from:p,to:f,pasteEvt:a}):void 0}})))}function ht(t){const e=t.filter(((e,n)=>t.indexOf(e)!==n));return Array.from(new Set(e))}class pt{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=pt.resolve(t),this.schema=J(this.extensions,e),this.setupExtensions()}static resolve(t){const e=pt.sort(pt.flatten(t)),n=ht(e.map((t=>t.name)));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map((t=>`'${t}'`)).join(", ")}]. This can lead to issues.`),e}static flatten(t){return t.map((t=>{const e=P(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...this.flatten(e())]:t})).flat(10)}static sort(t){return t.sort(((t,e)=>{const n=P(t,"priority")||100,o=P(e,"priority")||100;return n>o?-1:n{const n=P(e,"addCommands",{name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:Y(e.name,this.schema)});return n?{...t,...n()}:t}),{})}get plugins(){const{editor:t}=this,e=pt.sort([...this.extensions].reverse()),n=[],o=[],i=e.map((e=>{const i={name:e.name,options:e.options,storage:e.storage,editor:t,type:Y(e.name,this.schema)},s=[],a=P(e,"addKeyboardShortcuts",i);let l={};if("mark"===e.type&&P(e,"exitable",i)&&(l.ArrowRight=()=>st.handleExit({editor:t,mark:e})),a){const e=Object.fromEntries(Object.entries(a()).map((([e,n])=>[e,()=>n({editor:t})])));l={...l,...e}}const c=(0,r.w)(l);s.push(c);const d=P(e,"addInputRules",i);q(e,t.options.enableInputRules)&&d&&n.push(...d());const u=P(e,"addPasteRules",i);q(e,t.options.enablePasteRules)&&u&&o.push(...u());const h=P(e,"addProseMirrorPlugins",i);if(h){const t=h();s.push(...t)}return s})).flat();return[ot({editor:t,rules:n}),...ut({editor:t,rules:o}),...i]}get attributes(){return _(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=B(this.extensions);return Object.fromEntries(e.filter((t=>!!P(t,"addNodeView"))).map((e=>{const n=this.attributes.filter((t=>t.type===e.name)),o={name:e.name,options:e.options,storage:e.storage,editor:t,type:H(e.name,this.schema)},i=P(e,"addNodeView",o);return i?[e.name,(o,r,s,a,l)=>{const c=F(o,n);return i()({node:o,view:r,getPos:s,decorations:a,innerDecorations:l,editor:t,extension:e,HTMLAttributes:c})}]:[]})))}setupExtensions(){this.extensions.forEach((t=>{var e;this.editor.extensionStorage[t.name]=t.storage;const n={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:Y(t.name,this.schema)};"mark"===t.type&&(null===(e=V(P(t,"keepOnSplit",n)))||void 0===e||e)&&this.splittableMarks.push(t.name);const o=P(t,"onBeforeCreate",n),i=P(t,"onCreate",n),r=P(t,"onUpdate",n),s=P(t,"onSelectionUpdate",n),a=P(t,"onTransaction",n),l=P(t,"onFocus",n),c=P(t,"onBlur",n),d=P(t,"onDestroy",n);o&&this.editor.on("beforeCreate",o),i&&this.editor.on("create",i),r&&this.editor.on("update",r),s&&this.editor.on("selectionUpdate",s),a&&this.editor.on("transaction",a),l&&this.editor.on("focus",l),c&&this.editor.on("blur",c),d&&this.editor.on("destroy",d)}))}}class ft{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=V(P(this,"addOptions",{name:this.name}))),this.storage=V(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new ft(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>rt(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new ft({...this.config,...t});return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=V(P(e,"addOptions",{name:e.name})),e.storage=V(P(e,"addStorage",{name:e.name,options:e.options})),e}}function mt(t,e,n){const{from:o,to:i}=e,{blockSeparator:r="\n\n",textSerializers:s={}}=n||{};let a="";return t.nodesBetween(o,i,((t,n,l,c)=>{var d;t.isBlock&&n>o&&(a+=r);const u=null==s?void 0:s[t.type.name];if(u)return l&&(a+=u({node:t,pos:n,parent:l,index:c,range:e})),!1;t.isText&&(a+=null===(d=null==t?void 0:t.text)||void 0===d?void 0:d.slice(Math.max(o,n)-n,i-n))})),a}function gt(t){return Object.fromEntries(Object.entries(t.nodes).filter((([,t])=>t.spec.toText)).map((([t,e])=>[t,e.spec.toText])))}const bt=ft.create({name:"clipboardTextSerializer",addOptions:()=>({blockSeparator:void 0}),addProseMirrorPlugins(){return[new o.k_({key:new o.hs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:o,selection:i}=e,{ranges:r}=i,s=Math.min(...r.map((t=>t.$from.pos))),a=Math.max(...r.map((t=>t.$to.pos))),l=gt(n);return mt(o,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}});function yt(t,e,n={strict:!0}){const o=Object.keys(e);return!o.length||o.every((o=>n.strict?e[o]===t[o]:Z(e[o])?e[o].test(t[o]):e[o]===t[o]))}function kt(t,e,n={}){return t.find((t=>t.type===e&&yt(t.attrs,n)))}function vt(t,e,n={}){return!!kt(t,e,n)}function wt(t,e,n={}){if(!t||!e)return;let o=t.parent.childAfter(t.parentOffset);if(t.parentOffset===o.offset&&0!==o.offset&&(o=t.parent.childBefore(t.parentOffset)),!o.node)return;const i=kt([...o.node.marks],e,n);if(!i)return;let r=o.index,s=t.start()+o.offset,a=r+1,l=s+o.node.nodeSize;for(kt([...o.node.marks],e,n);r>0&&i.isInSet(t.parent.child(r-1).marks);)r-=1,s-=t.parent.child(r).nodeSize;for(;a{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const o=e[n];3===o.nodeType&&o.nodeValue&&/^(\n\s\s|\n)$/.test(o.nodeValue)?t.removeChild(o):1===o.nodeType&&Ot(o)}return t};function Et(t){const e=`${t}`,n=(new window.DOMParser).parseFromString(e,"text/html").body;return Ot(n)}function At(t,e,n){n={slice:!0,parseOptions:{},...n};const o="string"==typeof t;if("object"==typeof t&&null!==t)try{if(Array.isArray(t)&&t.length>0)return s.FK.fromArray(t.map((t=>e.nodeFromJSON(t))));const o=e.nodeFromJSON(t);return n.errorOnInvalidContent&&o.check(),o}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),At("",e,n)}if(o){if(n.errorOnInvalidContent){let o=!1,i="";const r=new s.Sj({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:t=>(o=!0,i="string"==typeof t?t:t.outerHTML,null)}]}})});if(n.slice?s.S4.fromSchema(r).parseSlice(Et(t),n.parseOptions):s.S4.fromSchema(r).parse(Et(t),n.parseOptions),n.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${i}`)})}const o=s.S4.fromSchema(e);return n.slice?o.parseSlice(Et(t),n.parseOptions).content:o.parse(Et(t),n.parseOptions)}return At("",e,n)}function It(t,e,n){const i=t.steps.length-1;if(i{0===l&&(l=o)})),t.setSelection(o.LN.near(t.doc.resolve(l),n))}function Nt(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}function Dt(t,e,n={}){const{from:o,to:i,empty:r}=t.selection,s=e?H(e,t.schema):null,a=[];t.doc.nodesBetween(o,i,((t,e)=>{if(t.isText)return;const n=Math.max(o,e),r=Math.min(i,e+t.nodeSize);a.push({node:t,from:n,to:r})}));const l=i-o,c=a.filter((t=>!s||s.name===t.node.type.name)).filter((t=>yt(t.node.attrs,n,{strict:!1})));return r?!!c.length:c.reduce(((t,e)=>t+e.to-e.from),0)>=l}function Rt(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function $t(t,e){const n="string"==typeof e?[e]:e;return Object.keys(t).reduce(((e,o)=>(n.includes(o)||(e[o]=t[o]),e)),{})}function Lt(t,e,n={},o={}){return At(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:o.errorOnInvalidContent})}function zt(t,e){const n=Ct(e,t.schema),{from:o,to:i,empty:r}=t.selection,s=[];r?(t.storedMarks&&s.push(...t.storedMarks),s.push(...t.selection.$head.marks())):t.doc.nodesBetween(o,i,(t=>{s.push(...t.marks)}));const a=s.find((t=>t.type.name===n.name));return a?{...a.attrs}:{}}function Pt(t,e){const n=new a.dL(t);return e.forEach((t=>{t.steps.forEach((t=>{n.step(t)}))})),n}function Bt(t){for(let e=0;e{e(t)&&n.push({node:t,pos:o})})),n}function Ht(t,e,n){const o=[];return t.nodesBetween(e.from,e.to,((t,e)=>{n(t)&&o.push({node:t,pos:e})})),o}function jt(t,e){for(let n=t.depth;n>0;n-=1){const o=t.node(n);if(e(o))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:o}}}function Ft(t){return e=>jt(e.$from,t)}function Gt(t,e){const n=s.ZF.fromSchema(e).serializeFragment(t),o=document.implementation.createHTMLDocument().createElement("div");return o.appendChild(n),o.innerHTML}function Vt(t,e){return J(pt.resolve(t),e)}function Wt(t,e){const n=Vt(e);return Gt(s.bP.fromJSON(n,t).content,n)}function Xt(t,e){const n=Vt(e),o=Et(t);return s.S4.fromSchema(n).parse(o).toJSON()}function Ut(t,e){return mt(t,{from:0,to:t.content.size},e)}function Kt(t,e,n){const{blockSeparator:o="\n\n",textSerializers:i={}}=n||{},r=Vt(e);return Ut(s.bP.fromJSON(r,t),{blockSeparator:o,textSerializers:{...gt(r),...i}})}function Jt(t,e){const n=H(e,t.schema),{from:o,to:i}=t.selection,r=[];t.doc.nodesBetween(o,i,(t=>{r.push(t)}));const s=r.reverse().find((t=>t.type.name===n.name));return s?{...s.attrs}:{}}function Yt(t,e){const n=Rt("string"==typeof e?e:e.name,t.schema);return"node"===n?Jt(t,e):"mark"===n?zt(t,e):{}}function qt(t,e=JSON.stringify){const n={};return t.filter((t=>{const o=e(t);return!Object.prototype.hasOwnProperty.call(n,o)&&(n[o]=!0)}))}function Qt(t){const{mapping:e,steps:n}=t,o=[];return e.maps.forEach(((t,i)=>{const r=[];if(t.ranges.length)t.forEach(((t,e)=>{r.push({from:t,to:e})}));else{const{from:t,to:e}=n[i];if(void 0===t||void 0===e)return;r.push({from:t,to:e})}r.forEach((({from:t,to:n})=>{const r=e.slice(i).map(t,-1),s=e.slice(i).map(n),a=e.invert().map(r,-1),l=e.invert().map(s);o.push({oldRange:{from:a,to:l},newRange:{from:r,to:s}})}))})),function(t){const e=qt(t);return 1===e.length?e:e.filter(((t,n)=>!e.filter(((t,e)=>e!==n)).some((e=>t.oldRange.from>=e.oldRange.from&&t.oldRange.to<=e.oldRange.to&&t.newRange.from>=e.newRange.from&&t.newRange.to<=e.newRange.to))))}(o)}function Zt(t,e=0){const n=t.type===t.type.schema.topNodeType?0:1,o=e,i=o+t.nodeSize,r=t.marks.map((t=>{const e={type:t.type.name};return Object.keys(t.attrs).length&&(e.attrs={...t.attrs}),e})),s={...t.attrs},a={type:t.type.name,from:o,to:i};return Object.keys(s).length&&(a.attrs=s),r.length&&(a.marks=r),t.content.childCount&&(a.content=[],t.forEach(((t,o)=>{var i;null===(i=a.content)||void 0===i||i.push(Zt(t,e+o+n))}))),t.text&&(a.text=t.text),a}function te(t,e,n){const o=[];return t===e?n.resolve(t).marks().forEach((e=>{const i=wt(n.resolve(t),e.type);i&&o.push({mark:e,...i})})):n.nodesBetween(t,e,((t,e)=>{t&&void 0!==(null==t?void 0:t.nodeSize)&&o.push(...t.marks.map((n=>({from:e,to:e+t.nodeSize,mark:n}))))})),o}const ee=(t,e,n,o=20)=>{const i=t.doc.resolve(n);let r=o,s=null;for(;r>0&&null===s;){const t=i.node(r);(null==t?void 0:t.type.name)===e?s=t:r-=1}return[s,r]};function ne(t,e,n){return Object.fromEntries(Object.entries(n).filter((([n])=>{const o=t.find((t=>t.type===e&&t.name===n));return!!o&&o.attribute.keepOnSplit})))}function oe(t,e,n={}){const{empty:o,ranges:i}=t.selection,r=e?Ct(e,t.schema):null;if(o)return!!(t.storedMarks||t.selection.$from.marks()).filter((t=>!r||r.name===t.type.name)).find((t=>yt(t.attrs,n,{strict:!1})));let s=0;const a=[];if(i.forEach((({$from:e,$to:n})=>{const o=e.pos,i=n.pos;t.doc.nodesBetween(o,i,((t,e)=>{if(!t.isText&&!t.marks.length)return;const n=Math.max(o,e),r=Math.min(i,e+t.nodeSize);s+=r-n,a.push(...t.marks.map((t=>({mark:t,from:n,to:r}))))}))})),0===s)return!1;const l=a.filter((t=>!r||r.name===t.mark.type.name)).filter((t=>yt(t.mark.attrs,n,{strict:!1}))).reduce(((t,e)=>t+e.to-e.from),0),c=a.filter((t=>!r||t.mark.type!==r&&t.mark.type.excludes(r))).reduce(((t,e)=>t+e.to-e.from),0);return(l>0?l+c:l)>=s}function ie(t,e,n={}){if(!e)return Dt(t,null,n)||oe(t,null,n);const o=Rt(e,t.schema);return"node"===o?Dt(t,e,n):"mark"===o&&oe(t,e,n)}const re=(t,e)=>{const{$from:n,$to:o,$anchor:i}=t.selection;if(e){const n=Ft((t=>t.type.name===e))(t.selection);if(!n)return!1;const o=t.doc.resolve(n.pos+1);return i.pos+1===o.end()}return!(o.parentOffset{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function ae(t,e){const{nodeExtensions:n}=B(e),o=n.find((e=>e.name===t));if(!o)return!1;const i=V(P(o,"group",{name:o.name,options:o.options,storage:o.storage}));return"string"==typeof i&&i.split(" ").includes("list")}function le(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var o;if(n){if("hardBreak"===t.type.name)return!0;if(t.isText)return/^\s*$/m.test(null!==(o=t.text)&&void 0!==o?o:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(0===t.content.childCount)return!0;if(e){let o=!0;return t.content.forEach((t=>{!1!==o&&(le(t,{ignoreWhitespace:n,checkChildren:e})||(o=!1))})),o}return!1}function ce(t){return t instanceof o.nh}function de(t,e,n){const o=t.state.doc.content.size,i=St(e,0,o),r=St(n,0,o),s=t.coordsAtPos(i),a=t.coordsAtPos(r,-1),l=Math.min(s.top,a.top),c=Math.max(s.bottom,a.bottom),d=Math.min(s.left,a.left),u=Math.max(s.right,a.right),h={top:l,bottom:c,left:d,right:u,width:u-d,height:c-l,x:d,y:l};return{...h,toJSON:()=>h}}function ue(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const o=n.filter((t=>null==e?void 0:e.includes(t.type.name)));t.tr.ensureMarks(o)}}const he=(t,e)=>{const n=Ft((t=>t.type===e))(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===o)return!0;const i=t.doc.nodeAt(o);return n.node.type!==(null==i?void 0:i.type)||!(0,a.n9)(t.doc,n.pos)||(t.join(n.pos),!0)},pe=(t,e)=>{const n=Ft((t=>t.type===e))(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(void 0===o)return!0;const i=t.doc.nodeAt(o);return n.node.type!==(null==i?void 0:i.type)||!(0,a.n9)(t.doc,o)||(t.join(o),!0)};var fe=Object.freeze({__proto__:null,blur:()=>({editor:t,view:e})=>(requestAnimationFrame((()=>{var n;t.isDestroyed||(e.dom.blur(),null===(n=null===window||void 0===window?void 0:window.getSelection())||void 0===n||n.removeAllRanges())})),!0),clearContent:(t=!1)=>({commands:e})=>e.setContent("",t),clearNodes:()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:i}=o;return!n||(i.forEach((({$from:n,$to:o})=>{t.doc.nodesBetween(n.pos,o.pos,((t,n)=>{if(t.type.isText)return;const{doc:o,mapping:i}=e,r=o.resolve(i.map(n)),s=o.resolve(i.map(n+t.nodeSize)),l=r.blockRange(s);if(!l)return;const c=(0,a.jP)(l);if(t.type.isTextblock){const{defaultType:t}=r.parent.contentMatchAt(r.index());e.setNodeMarkup(l.start,t)}(c||0===c)&&e.lift(l,c)}))})),!0)},command:t=>e=>t(e),createParagraphNear:()=>({state:t,dispatch:e})=>C(t,e),cut:(t,e)=>({editor:n,tr:i})=>{const{state:r}=n,s=r.doc.slice(t.from,t.to);i.deleteRange(t.from,t.to);const a=i.mapping.map(e);return i.insert(a,s.content),i.setSelection(new o.U3(i.doc.resolve(a-1))),!0},deleteCurrentNode:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,o=n.$anchor.node();if(o.content.size>0)return!1;const i=t.selection.$anchor;for(let n=i.depth;n>0;n-=1)if(i.node(n).type===o.type){if(e){const e=i.before(n),o=i.after(n);t.delete(e,o).scrollIntoView()}return!0}return!1},deleteNode:t=>({tr:e,state:n,dispatch:o})=>{const i=H(t,n.schema),r=e.selection.$anchor;for(let t=r.depth;t>0;t-=1)if(r.node(t).type===i){if(o){const n=r.before(t),o=r.after(t);e.delete(n,o).scrollIntoView()}return!0}return!1},deleteRange:t=>({tr:e,dispatch:n})=>{const{from:o,to:i}=t;return n&&e.delete(o,i),!0},deleteSelection:()=>({state:t,dispatch:e})=>l(t,e),enter:()=>({commands:t})=>t.keyboardShortcut("Enter"),exitCode:()=>({state:t,dispatch:e})=>w(t,e),extendMarkRange:(t,e={})=>({tr:n,state:i,dispatch:r})=>{const s=Ct(t,i.schema),{doc:a,selection:l}=n,{$from:c,from:d,to:u}=l;if(r){const t=wt(c,s,e);if(t&&t.from<=d&&t.to>=u){const e=o.U3.create(a,t.from,t.to);n.setSelection(e)}}return!0},first:t=>e=>{const n="function"==typeof t?t(e):t;for(let t=0;t({editor:n,view:o,tr:i,dispatch:r})=>{e={scrollIntoView:!0,...e};const s=()=>{Tt()&&o.dom.focus(),requestAnimationFrame((()=>{n.isDestroyed||(o.focus(),(null==e?void 0:e.scrollIntoView)&&n.commands.scrollIntoView())}))};if(o.hasFocus()&&null===t||!1===t)return!0;if(r&&null===t&&!xt(n.state.selection))return s(),!0;const a=Mt(i.doc,t)||n.state.selection,l=n.state.selection.eq(a);return r&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},forEach:(t,e)=>n=>t.every(((t,o)=>e(t,{...n,index:o}))),insertContent:(t,e)=>({tr:n,commands:o})=>o.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),insertContentAt:(t,e,n)=>({tr:o,dispatch:i,editor:r})=>{var s;if(i){let i;n={parseOptions:{},updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n};try{i=At(e,r.schema,{parseOptions:{preserveWhitespace:"full",...n.parseOptions},errorOnInvalidContent:null!==(s=n.errorOnInvalidContent)&&void 0!==s?s:r.options.enableContentCheck})}catch(t){return r.emit("contentError",{editor:r,error:t,disableCollaboration:()=>{console.error("[tiptap error]: Unable to disable collaboration at this point in time")}}),!1}let a,{from:l,to:c}="number"==typeof t?{from:t,to:t}:{from:t.from,to:t.to},d=!0,u=!0;if(("type"in i?[i]:i).forEach((t=>{t.check(),d=!!d&&t.isText&&0===t.marks.length,u=!!u&&t.isBlock})),l===c&&u){const{parent:t}=o.doc.resolve(l);t.isTextblock&&!t.type.spec.code&&!t.childCount&&(l-=1,c+=1)}d?(a=Array.isArray(e)?e.map((t=>t.text||"")).join(""):"object"==typeof e&&e&&e.text?e.text:e,o.insertText(a,l,c)):(a=i,o.replaceWith(l,c,a)),n.updateSelection&&It(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:l,text:a}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:l,text:a})}return!0},joinBackward:()=>({state:t,dispatch:e})=>d(t,e),joinDown:()=>({state:t,dispatch:e})=>((t,e)=>{let n,i=t.selection;if(i instanceof o.nh){if(i.node.isTextblock||!(0,a.n9)(t.doc,i.to))return!1;n=i.to}else if(n=(0,a.N0)(t.doc,i.to,1),null==n)return!1;return e&&e(t.tr.join(n).scrollIntoView()),!0})(t,e),joinForward:()=>({state:t,dispatch:e})=>g(t,e),joinItemBackward:()=>({state:t,dispatch:e,tr:n})=>{try{const o=(0,a.N0)(t.doc,t.selection.$from.pos,-1);return null!=o&&(n.join(o,2),e&&e(n),!0)}catch(t){return!1}},joinItemForward:()=>({state:t,dispatch:e,tr:n})=>{try{const o=(0,a.N0)(t.doc,t.selection.$from.pos,1);return null!=o&&(n.join(o,2),e&&e(n),!0)}catch(t){return!1}},joinTextblockBackward:()=>({state:t,dispatch:e})=>((t,e)=>{let n=c(t,void 0);if(!n)return!1;let o=f(n);return!!o&&u(t,o,e)})(t,e),joinTextblockForward:()=>({state:t,dispatch:e})=>((t,e)=>{let n=m(t,void 0);if(!n)return!1;let o=y(n);return!!o&&u(t,o,e)})(t,e),joinUp:()=>({state:t,dispatch:e})=>((t,e)=>{let n,i=t.selection,r=i instanceof o.nh;if(r){if(i.node.isTextblock||!(0,a.n9)(t.doc,i.from))return!1;n=i.from}else if(n=(0,a.N0)(t.doc,i.from,-1),null==n)return!1;if(e){let i=t.tr.join(n);r&&i.setSelection(o.nh.create(i.doc,n-t.doc.resolve(n).nodeBefore.nodeSize)),e(i.scrollIntoView())}return!0})(t,e),keyboardShortcut:t=>({editor:e,view:n,tr:o,dispatch:i})=>{const r=function(t){const e=t.split(/-(?!$)/);let n,o,i,r,s=e[e.length-1];"Space"===s&&(s=" ");for(let t=0;t!["Alt","Ctrl","Meta","Shift"].includes(t))),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:r.includes("Alt"),ctrlKey:r.includes("Ctrl"),metaKey:r.includes("Meta"),shiftKey:r.includes("Shift"),bubbles:!0,cancelable:!0}),l=e.captureTransaction((()=>{n.someProp("handleKeyDown",(t=>t(n,a)))}));return null==l||l.steps.forEach((t=>{const e=t.map(o.mapping);e&&i&&o.maybeStep(e)})),!0},lift:(t,e={})=>({state:n,dispatch:o})=>!!Dt(n,H(t,n.schema),e)&&((t,e)=>{let{$from:n,$to:o}=t.selection,i=n.blockRange(o),r=i&&(0,a.jP)(i);return null!=r&&(e&&e(t.tr.lift(i,r).scrollIntoView()),!0)})(n,o),liftEmptyBlock:()=>({state:t,dispatch:e})=>x(t,e),liftListItem:t=>({state:e,dispatch:n})=>{return(o=H(t,e.schema),function(t,e){let{$from:n,$to:i}=t.selection,r=n.blockRange(i,(t=>t.childCount>0&&t.firstChild.type==o));return!!r&&(!e||(n.node(r.depth-1).type==o?function(t,e,n,o){let i=t.tr,r=o.end,l=o.$to.end(o.depth);rr;e--)t-=i.child(e).nodeSize,o.delete(t-1,t+1);let r=o.doc.resolve(n.start),l=r.nodeAfter;if(o.mapping.map(n.end)!=n.start+r.nodeAfter.nodeSize)return!1;let c=0==n.startIndex,d=n.endIndex==i.childCount,u=r.node(-1),h=r.index(-1);if(!u.canReplace(h+(c?0:1),h+1,l.content.append(d?s.FK.empty:s.FK.from(i))))return!1;let p=r.pos,f=p+l.nodeSize;return o.step(new a.Wg(p-(c?1:0),f+(d?1:0),p+1,f-1,new s.Ji((c?s.FK.empty:s.FK.from(i.copy(s.FK.empty))).append(d?s.FK.empty:s.FK.from(i.copy(s.FK.empty))),c?0:1,d?0:1),c?0:1)),e(o.scrollIntoView()),!0}(t,e,r)))})(e,n);var o},newlineInCode:()=>({state:t,dispatch:e})=>k(t,e),resetAttributes:(t,e)=>({tr:n,state:o,dispatch:i})=>{let r=null,s=null;const a=Rt("string"==typeof t?t:t.name,o.schema);return!!a&&("node"===a&&(r=H(t,o.schema)),"mark"===a&&(s=Ct(t,o.schema)),i&&n.selection.ranges.forEach((t=>{o.doc.nodesBetween(t.$from.pos,t.$to.pos,((t,o)=>{r&&r===t.type&&n.setNodeMarkup(o,void 0,$t(t.attrs,e)),s&&t.marks.length&&t.marks.forEach((i=>{s===i.type&&n.addMark(o,o+t.nodeSize,s.create($t(i.attrs,e)))}))}))})),!0)},scrollIntoView:()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),selectAll:()=>({tr:t,commands:e})=>e.setTextSelection({from:0,to:t.doc.content.size}),selectNodeBackward:()=>({state:t,dispatch:e})=>p(t,e),selectNodeForward:()=>({state:t,dispatch:e})=>b(t,e),selectParentNode:()=>({state:t,dispatch:e})=>((t,e)=>{let n,{$from:i,to:r}=t.selection,s=i.sharedDepth(r);return 0!=s&&(n=i.before(s),e&&e(t.tr.setSelection(o.nh.create(t.doc,n))),!0)})(t,e),selectTextblockEnd:()=>({state:t,dispatch:e})=>O(t,e),selectTextblockStart:()=>({state:t,dispatch:e})=>T(t,e),setContent:(t,e=!1,n={},o={})=>({editor:i,tr:r,dispatch:s,commands:a})=>{var l,c;const{doc:d}=r;if("full"!==n.preserveWhitespace){const a=Lt(t,i.schema,n,{errorOnInvalidContent:null!==(l=o.errorOnInvalidContent)&&void 0!==l?l:i.options.enableContentCheck});return s&&r.replaceWith(0,d.content.size,a).setMeta("preventUpdate",!e),!0}return s&&r.setMeta("preventUpdate",!e),a.insertContentAt({from:0,to:d.content.size},t,{parseOptions:n,errorOnInvalidContent:null!==(c=o.errorOnInvalidContent)&&void 0!==c?c:i.options.enableContentCheck})},setMark:(t,e={})=>({tr:n,state:o,dispatch:i})=>{const{selection:r}=n,{empty:s,ranges:a}=r,l=Ct(t,o.schema);if(i)if(s){const t=zt(o,l);n.addStoredMark(l.create({...t,...e}))}else a.forEach((t=>{const i=t.$from.pos,r=t.$to.pos;o.doc.nodesBetween(i,r,((t,o)=>{const s=Math.max(o,i),a=Math.min(o+t.nodeSize,r);t.marks.find((t=>t.type===l))?t.marks.forEach((t=>{l===t.type&&n.addMark(s,a,l.create({...t.attrs,...e}))})):n.addMark(s,a,l.create(e))}))}));return function(t,e,n){var o;const{selection:i}=e;let r=null;if(xt(i)&&(r=i.$cursor),r){const e=null!==(o=t.storedMarks)&&void 0!==o?o:r.marks();return!!n.isInSet(e)||!e.some((t=>t.type.excludes(n)))}const{ranges:s}=i;return s.some((({$from:e,$to:o})=>{let i=0===e.depth&&t.doc.inlineContent&&t.doc.type.allowsMarkType(n);return t.doc.nodesBetween(e.pos,o.pos,((t,e,o)=>{if(i)return!1;if(t.isInline){const e=!o||o.type.allowsMarkType(n),r=!!n.isInSet(t.marks)||!t.marks.some((t=>t.type.excludes(n)));i=e&&r}return!i})),i}))}(o,n,l)},setMeta:(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),setNode:(t,e={})=>({state:n,dispatch:o,chain:i})=>{const r=H(t,n.schema);return r.isTextblock?i().command((({commands:t})=>!!E(r,e)(n)||t.clearNodes())).command((({state:t})=>E(r,e)(t,o))).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},setNodeSelection:t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,i=St(t,0,n.content.size),r=o.nh.create(n,i);e.setSelection(r)}return!0},setTextSelection:t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,{from:i,to:r}="number"==typeof t?{from:t,to:t}:t,s=o.U3.atStart(n).from,a=o.U3.atEnd(n).to,l=St(i,s,a),c=St(r,s,a),d=o.U3.create(n,l,c);e.setSelection(d)}return!0},sinkListItem:t=>({state:e,dispatch:n})=>{const o=H(t,e.schema);return(i=o,function(t,e){let{$from:n,$to:o}=t.selection,r=n.blockRange(o,(t=>t.childCount>0&&t.firstChild.type==i));if(!r)return!1;let l=r.startIndex;if(0==l)return!1;let c=r.parent,d=c.child(l-1);if(d.type!=i)return!1;if(e){let n=d.lastChild&&d.lastChild.type==c.type,o=s.FK.from(n?i.create():null),l=new s.Ji(s.FK.from(i.create(null,s.FK.from(c.type.create(null,o)))),n?3:1,0),u=r.start,h=r.end;e(t.tr.step(new a.Wg(u-(n?3:1),h,u,h,l,1,!0)).scrollIntoView())}return!0})(e,n);var i},splitBlock:({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:i,editor:r})=>{const{selection:s,doc:l}=e,{$from:c,$to:d}=s,u=ne(r.extensionManager.attributes,c.node().type.name,c.node().attrs);if(s instanceof o.nh&&s.node.isBlock)return!(!c.parentOffset||!(0,a.zy)(l,c.pos)||(i&&(t&&ue(n,r.extensionManager.splittableMarks),e.split(c.pos).scrollIntoView()),0));if(!c.parent.isBlock)return!1;const h=d.parentOffset===d.parent.content.size,p=0===c.depth?void 0:Bt(c.node(-1).contentMatchAt(c.indexAfter(-1)));let f=h&&p?[{type:p,attrs:u}]:void 0,m=(0,a.zy)(e.doc,e.mapping.map(c.pos),1,f);if(f||m||!(0,a.zy)(e.doc,e.mapping.map(c.pos),1,p?[{type:p}]:void 0)||(m=!0,f=p?[{type:p,attrs:u}]:void 0),i){if(m&&(s instanceof o.U3&&e.deleteSelection(),e.split(e.mapping.map(c.pos),1,f),p&&!h&&!c.parentOffset&&c.parent.type!==p)){const t=e.mapping.map(c.before()),n=e.doc.resolve(t);c.node(-1).canReplaceWith(n.index(),n.index()+1,p)&&e.setNodeMarkup(e.mapping.map(c.before()),p)}t&&ue(n,r.extensionManager.splittableMarks),e.scrollIntoView()}return m},splitListItem:(t,e={})=>({tr:n,state:i,dispatch:r,editor:l})=>{var c;const d=H(t,i.schema),{$from:u,$to:h}=i.selection,p=i.selection.node;if(p&&p.isBlock||u.depth<2||!u.sameParent(h))return!1;const f=u.node(-1);if(f.type!==d)return!1;const m=l.extensionManager.attributes;if(0===u.parent.content.size&&u.node(-1).childCount===u.indexAfter(-1)){if(2===u.depth||u.node(-3).type!==d||u.index(-2)!==u.node(-2).childCount-1)return!1;if(r){let t=s.FK.empty;const i=u.index(-1)?1:u.index(-2)?2:3;for(let e=u.depth-i;e>=u.depth-3;e-=1)t=s.FK.from(u.node(e).copy(t));const r=u.indexAfter(-1){if(p>-1)return!1;t.isTextblock&&0===t.content.size&&(p=e+1)})),p>-1&&n.setSelection(o.U3.near(n.doc.resolve(p))),n.scrollIntoView()}return!0}const g=h.pos===u.end()?f.contentMatchAt(0).defaultType:null,b={...ne(m,f.type.name,f.attrs),...e},y={...ne(m,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,h.pos);const k=g?[{type:d,attrs:b},{type:g,attrs:y}]:[{type:d,attrs:b}];if(!(0,a.zy)(n.doc,u.pos,2))return!1;if(r){const{selection:t,storedMarks:e}=i,{splittableMarks:o}=l.extensionManager,s=e||t.$to.parentOffset&&t.$from.marks();if(n.split(u.pos,2,k).scrollIntoView(),!s||!r)return!0;const a=s.filter((t=>o.includes(t.type.name)));n.ensureMarks(a)}return!0},toggleList:(t,e,n,o={})=>({editor:i,tr:r,state:s,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=i.extensionManager,p=H(t,s.schema),f=H(e,s.schema),{selection:m,storedMarks:g}=s,{$from:b,$to:y}=m,k=b.blockRange(y),v=g||m.$to.parentOffset&&m.$from.marks();if(!k)return!1;const w=Ft((t=>ae(t.type.name,u)))(m);if(k.depth>=1&&w&&k.depth-w.depth<=1){if(w.node.type===p)return c.liftListItem(f);if(ae(w.node.type.name,u)&&p.validContent(w.node.content)&&a)return l().command((()=>(r.setNodeMarkup(w.pos,p),!0))).command((()=>he(r,p))).command((()=>pe(r,p))).run()}return n&&v&&a?l().command((()=>{const t=d().wrapInList(p,o),e=v.filter((t=>h.includes(t.type.name)));return r.ensureMarks(e),!!t||c.clearNodes()})).wrapInList(p,o).command((()=>he(r,p))).command((()=>pe(r,p))).run():l().command((()=>!!d().wrapInList(p,o)||c.clearNodes())).wrapInList(p,o).command((()=>he(r,p))).command((()=>pe(r,p))).run()},toggleMark:(t,e={},n={})=>({state:o,commands:i})=>{const{extendEmptyMarkRange:r=!1}=n,s=Ct(t,o.schema);return oe(o,s,e)?i.unsetMark(s,{extendEmptyMarkRange:r}):i.setMark(s,e)},toggleNode:(t,e,n={})=>({state:o,commands:i})=>{const r=H(t,o.schema),s=H(e,o.schema),a=Dt(o,r,n);let l;return o.selection.$anchor.sameParent(o.selection.$head)&&(l=o.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(r,{...l,...n})},toggleWrap:(t,e={})=>({state:n,commands:o})=>{const i=H(t,n.schema);return Dt(n,i,e)?o.lift(i):o.wrapIn(i,e)},undoInputRule:()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let o=0;o=0;t-=1)e.step(n.steps[t].invert(n.docs[t]));if(r.text){const n=e.doc.resolve(r.from).marks();e.replaceWith(r.from,r.to,t.schema.text(r.text,n))}else e.delete(r.from,r.to)}return!0}}return!1},unsetAllMarks:()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:o,ranges:i}=n;return o||e&&i.forEach((e=>{t.removeMark(e.$from.pos,e.$to.pos)})),!0},unsetMark:(t,e={})=>({tr:n,state:o,dispatch:i})=>{var r;const{extendEmptyMarkRange:s=!1}=e,{selection:a}=n,l=Ct(t,o.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&s){let{from:t,to:e}=a;const o=null===(r=c.marks().find((t=>t.type===l)))||void 0===r?void 0:r.attrs,i=wt(c,l,o);i&&(t=i.from,e=i.to),n.removeMark(t,e,l)}else u.forEach((t=>{n.removeMark(t.$from.pos,t.$to.pos,l)}));return n.removeStoredMark(l),!0},updateAttributes:(t,e={})=>({tr:n,state:o,dispatch:i})=>{let r=null,s=null;const a=Rt("string"==typeof t?t:t.name,o.schema);return!!a&&("node"===a&&(r=H(t,o.schema)),"mark"===a&&(s=Ct(t,o.schema)),i&&n.selection.ranges.forEach((t=>{const i=t.$from.pos,a=t.$to.pos;o.doc.nodesBetween(i,a,((t,o)=>{r&&r===t.type&&n.setNodeMarkup(o,void 0,{...t.attrs,...e}),s&&t.marks.length&&t.marks.forEach((r=>{if(s===r.type){const l=Math.max(o,i),c=Math.min(o+t.nodeSize,a);n.addMark(l,c,s.create({...r.attrs,...e}))}}))}))})),!0)},wrapIn:(t,e={})=>({state:n,dispatch:o})=>function(t,e=null){return function(n,o){let{$from:i,$to:r}=n.selection,s=i.blockRange(r),l=s&&(0,a.oM)(s,t,e);return!!l&&(o&&o(n.tr.wrap(s,l).scrollIntoView()),!0)}}(H(t,n.schema),e)(n,o),wrapInList:(t,e={})=>({state:n,dispatch:o})=>function(t,e=null){return function(n,o){let{$from:i,$to:r}=n.selection,l=i.blockRange(r),c=!1,d=l;if(!l)return!1;if(l.depth>=2&&i.node(l.depth-1).type.compatibleContent(t)&&0==l.startIndex){if(0==i.index(l.depth-1))return!1;let t=n.doc.resolve(l.start-2);d=new s.u$(t,t,l.depth),l.endIndex=0;t--)r=s.FK.from(n[t].type.create(n[t].attrs,r));t.step(new a.Wg(e.start-(o?2:0),e.end,e.start,e.end,new s.Ji(r,0,0),n.length,!0));let l=0;for(let t=0;t({...fe})}),ge=ft.create({name:"drop",addProseMirrorPlugins(){return[new o.k_({key:new o.hs("tiptapDrop"),props:{handleDrop:(t,e,n,o)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:o})}}})]}}),be=ft.create({name:"editable",addProseMirrorPlugins(){return[new o.k_({key:new o.hs("editable"),props:{editable:()=>this.editor.options.editable}})]}}),ye=ft.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new o.k_({key:new o.hs("focusEvents"),props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const o=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1},blur:(e,n)=>{t.isFocused=!1;const o=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(o),!1}}}})]}}),ke=ft.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first((({commands:t})=>[()=>t.undoInputRule(),()=>t.command((({tr:e})=>{const{selection:n,doc:i}=e,{empty:r,$anchor:s}=n,{pos:a,parent:l}=s,c=s.parent.isTextblock&&a>0?e.doc.resolve(a-1):s,d=c.parent.type.spec.isolating,u=s.pos-s.parentOffset,h=d&&1===c.parent.childCount?u===s.pos:o.LN.atStart(i).from===a;return!(!r||!l.type.isTextblock||l.textContent.length||!h||h&&"paragraph"===s.parent.type.name)&&t.clearNodes()})),()=>t.deleteSelection(),()=>t.joinBackward(),()=>t.selectNodeBackward()])),e=()=>this.editor.commands.first((({commands:t})=>[()=>t.deleteSelection(),()=>t.deleteCurrentNode(),()=>t.joinForward(),()=>t.selectNodeForward()])),n={Enter:()=>this.editor.commands.first((({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()])),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},r={...n,"Ctrl-h":t,"Alt-Backspace":t,"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 Tt()||Nt()?r:i},addProseMirrorPlugins(){return[new o.k_({key:new o.hs("clearDocument"),appendTransaction:(t,e,n)=>{const i=t.some((t=>t.docChanged))&&!e.doc.eq(n.doc),r=t.some((t=>t.getMeta("preventClearDocument")));if(!i||r)return;const{empty:s,from:a,to:l}=e.selection,c=o.LN.atStart(e.doc).from,d=o.LN.atEnd(e.doc).to;if(s||a!==c||l!==d)return;if(!le(n.doc))return;const u=n.tr,h=$({state:n,transaction:u}),{commands:p}=new L({editor:this.editor,state:h});return p.clearNodes(),u.steps.length?u:void 0}})]}}),ve=ft.create({name:"paste",addProseMirrorPlugins(){return[new o.k_({key:new o.hs("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),we=ft.create({name:"tabindex",addProseMirrorPlugins(){return[new o.k_({key:new o.hs("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var Ce=Object.freeze({__proto__:null,ClipboardTextSerializer:bt,Commands:me,Drop:ge,Editable:be,FocusEvents:ye,Keymap:ke,Paste:ve,Tabindex:we});class xe{get name(){return this.node.type.name}constructor(t,e,n=!1,o=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=t,this.editor=e,this.currentNode=o}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return null!==(t=this.actualDepth)&&void 0!==t?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let e=this.from,n=this.to;if(this.isBlock){if(0===this.content.size)return void console.error(`You can’t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);e=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:e,to:n},t)}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(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),e=this.resolvedPos.doc.resolve(t);return new xe(e,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new xe(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new xe(t,this.editor)}get children(){const t=[];return this.node.content.forEach(((e,n)=>{const o=e.isBlock&&!e.isTextblock,i=this.pos+n+1,r=this.resolvedPos.doc.resolve(i);if(!o&&r.depth<=this.depth)return;const s=new xe(r,this.editor,o,o?e:null);o&&(s.actualDepth=this.depth+1),t.push(new xe(r,this.editor,o,o?e:null))})),t}get firstChild(){return this.children[0]||null}get lastChild(){const t=this.children;return t[t.length-1]||null}closest(t,e={}){let n=null,o=this.parent;for(;o&&!n;){if(o.node.type.name===t)if(Object.keys(e).length>0){const t=o.node.attrs,n=Object.keys(e);for(let o=0;o{n&&o.length>0||(r.node.type.name===t&&i.every((t=>e[t]===r.node.attrs[t]))&&o.push(r),n&&o.length>0||(o=o.concat(r.querySelectorAll(t,e,n))))})),o}setAttribute(t){const e=this.editor.state.selection;this.editor.chain().setTextSelection(this.from).updateAttributes(this.node.type.name,t).setTextSelection(e.from).run()}}function Se(t,e,n){const o=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(null!==o)return o;const i=document.createElement("style");return e&&i.setAttribute("nonce",e),i.setAttribute("data-tiptap-style"+(n?`-${n}`:""),""),i.innerHTML=t,document.getElementsByTagName("head")[0].appendChild(i),i}class Me extends z{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:t})=>{throw t},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),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:t,slice:e,moved:n})=>this.options.onDrop(t,e,n))),this.on("paste",(({event:t,slice:e})=>this.options.onPaste(t,e))),window.setTimeout((()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)}),0)}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&&document&&(this.css=Se('.ProseMirror {\n position: relative;\n}\n\n.ProseMirror {\n word-wrap: break-word;\n white-space: pre-wrap;\n white-space: break-spaces;\n -webkit-font-variant-ligatures: none;\n font-variant-ligatures: none;\n font-feature-settings: "liga" 0; /* the above doesn\'t seem to work in Edge */\n}\n\n.ProseMirror [contenteditable="false"] {\n white-space: normal;\n}\n\n.ProseMirror [contenteditable="false"] [contenteditable="true"] {\n white-space: pre-wrap;\n}\n\n.ProseMirror pre {\n white-space: pre-wrap;\n}\n\nimg.ProseMirror-separator {\n display: inline !important;\n border: none !important;\n margin: 0 !important;\n width: 0 !important;\n height: 0 !important;\n}\n\n.ProseMirror-gapcursor {\n display: none;\n pointer-events: none;\n position: absolute;\n margin: 0;\n}\n\n.ProseMirror-gapcursor:after {\n content: "";\n display: block;\n position: absolute;\n top: -2px;\n width: 20px;\n border-top: 1px solid black;\n animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;\n}\n\n@keyframes ProseMirror-cursor-blink {\n to {\n visibility: hidden;\n }\n}\n\n.ProseMirror-hideselection *::selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection *::-moz-selection {\n background: transparent;\n}\n\n.ProseMirror-hideselection * {\n caret-color: transparent;\n}\n\n.ProseMirror-focused .ProseMirror-gapcursor {\n display: block;\n}\n\n.tippy-box[data-animation=fade][data-state=hidden] {\n opacity: 0\n}',this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},this.view&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){const n=G(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],o=this.state.reconfigure({plugins:n});return this.view.updateState(o),o}unregisterPlugin(t){if(this.isDestroyed)return;const e="string"==typeof t?`${t}$`:t.key,n=this.state.reconfigure({plugins:this.state.plugins.filter((t=>!t.key.startsWith(e)))});return this.view.updateState(n),n}createExtensionManager(){var t,e;const n=[...this.options.enableCoreExtensions?[be,bt.configure({blockSeparator:null===(e=null===(t=this.options.coreExtensionOptions)||void 0===t?void 0:t.clipboardTextSerializer)||void 0===e?void 0:e.blockSeparator}),me,ye,ke,we,ge,ve].filter((t=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[t.name])):[],...this.options.extensions].filter((t=>["extension","node","mark"].includes(null==t?void 0:t.type)));this.extensionManager=new pt(n,this)}createCommandManager(){this.commandManager=new L({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let t;try{t=Lt(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(e){if(!(e instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(e.message)))throw e;this.emit("contentError",{editor:this,error:e,disableCollaboration:()=>{this.options.extensions=this.options.extensions.filter((t=>"collaboration"!==t.name)),this.createExtensionManager()}}),t=Lt(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}const e=Mt(t,this.options.autofocus);this.view=new i.Lz(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:o.$t.create({doc:t,selection:e||void 0})});const n=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(n),this.createNodeViews(),this.prependClass(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;const e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void t.steps.forEach((t=>{var e;return null===(e=this.capturedTransaction)||void 0===e?void 0:e.step(t)})):void(this.capturedTransaction=t);const e=this.state.apply(t),n=!this.state.selection.eq(e.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),n&&this.emit("selectionUpdate",{editor:this,transaction:t});const o=t.getMeta("focus"),i=t.getMeta("blur");o&&this.emit("focus",{editor:this,event:o.event,transaction:t}),i&&this.emit("blur",{editor:this,event:i.event,transaction:t}),t.docChanged&&!t.getMeta("preventUpdate")&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return Yt(this.state,t)}isActive(t,e){const n="string"==typeof t?t:null,o="string"==typeof t?e:t;return ie(this.state,n,o)}getJSON(){return this.state.doc.toJSON()}getHTML(){return Gt(this.state.doc.content,this.schema)}getText(t){const{blockSeparator:e="\n\n",textSerializers:n={}}=t||{};return Ut(this.state.doc,{blockSeparator:e,textSerializers:{...gt(this.schema),...n}})}get isEmpty(){return le(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){const t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(null===(t=this.view)||void 0===t?void 0:t.docView)}$node(t,e){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelector(t,e))||null}$nodes(t,e){var n;return(null===(n=this.$doc)||void 0===n?void 0:n.querySelectorAll(t,e))||null}$pos(t){const e=this.state.doc.resolve(t);return new xe(e,this)}get $doc(){return this.$pos(0)}}function Te(t){return new tt({find:t.find,handler:({state:e,range:n,match:o})=>{const i=V(t.getAttributes,void 0,o);if(!1===i||null===i)return null;const{tr:r}=e,s=o[o.length-1],a=o[0];if(s){const o=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(te(n.from,n.to,e.doc).filter((e=>e.mark.type.excluded.find((n=>n===t.type&&n!==e.mark.type)))).filter((t=>t.to>l)).length)return null;cn.from&&r.delete(n.from+o,l);const d=n.from+o+s.length;r.addMark(n.from+o,d,t.type.create(i||{})),r.removeStoredMark(t.type)}}})}function Oe(t){return new tt({find:t.find,handler:({state:e,range:n,match:o})=>{const i=V(t.getAttributes,void 0,o)||{},{tr:r}=e,s=n.from;let a=n.to;const l=t.type.create(i);if(o[1]){let t=s+o[0].lastIndexOf(o[1]);t>a?t=a:a=t+o[1].length;const e=o[0][o[0].length-1];r.insertText(e,s+o[0].length-1),r.replaceWith(t,a,l)}else if(o[0]){const e=t.type.isInline?s:s-1;r.insert(e,t.type.create(i)).delete(r.mapping.map(s),r.mapping.map(a))}r.scrollIntoView()}})}function Ee(t){return new tt({find:t.find,handler:({state:e,range:n,match:o})=>{const i=e.doc.resolve(n.from),r=V(t.getAttributes,void 0,o)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,r)}})}function Ae(t){return new tt({find:t.find,handler:({state:e,range:n,match:o})=>{let i=t.replace,r=n.from;const s=n.to;if(o[1]){const t=o[0].lastIndexOf(o[1]);i+=o[0].slice(t+o[1].length),r+=t;const e=r-s;e>0&&(i=o[0].slice(t-e,t)+i,r=s)}e.tr.insertText(i,r,s)}})}function Ie(t){return new tt({find:t.find,handler:({state:e,range:n,match:o,chain:i})=>{const r=V(t.getAttributes,void 0,o)||{},s=e.tr.delete(n.from,n.to),l=s.doc.resolve(n.from).blockRange(),c=l&&(0,a.oM)(l,t.type,r);if(!c)return null;if(s.wrap(l,c),t.keepMarks&&t.editor){const{selection:n,storedMarks:o}=e,{splittableMarks:i}=t.editor.extensionManager,r=o||n.$to.parentOffset&&n.$from.marks();if(r){const t=r.filter((t=>i.includes(t.type.name)));s.ensureMarks(t)}}if(t.keepAttributes){const e="bulletList"===t.type.name||"orderedList"===t.type.name?"listItem":"taskList";i().updateAttributes(e,r).run()}const d=s.doc.resolve(n.from-1).nodeBefore;d&&d.type===t.type&&(0,a.n9)(s.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,d))&&s.join(n.from-1)}})}class Ne{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=V(P(this,"addOptions",{name:this.name}))),this.storage=V(P(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new Ne(t)}configure(t={}){const e=this.extend({...this.config,addOptions:()=>rt(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new Ne(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=V(P(e,"addOptions",{name:e.name})),e.storage=V(P(e,"addStorage",{name:e.name,options:e.options})),e}}class De{constructor(t,e,n){this.isDragging=!1,this.component=t,this.editor=e.editor,this.options={stopEvent:null,ignoreMutation:null,...n},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(t){var e,n,i,r,s,a,l;const{view:c}=this.editor,d=t.target,u=3===d.nodeType?null===(e=d.parentElement)||void 0===e?void 0:e.closest("[data-drag-handle]"):d.closest("[data-drag-handle]");if(!this.dom||(null===(n=this.contentDOM)||void 0===n?void 0:n.contains(d))||!u)return;let h=0,p=0;if(this.dom!==u){const e=this.dom.getBoundingClientRect(),n=u.getBoundingClientRect(),o=null!==(i=t.offsetX)&&void 0!==i?i:null===(r=t.nativeEvent)||void 0===r?void 0:r.offsetX,l=null!==(s=t.offsetY)&&void 0!==s?s:null===(a=t.nativeEvent)||void 0===a?void 0:a.offsetY;h=n.x-e.x+o,p=n.y-e.y+l}null===(l=t.dataTransfer)||void 0===l||l.setDragImage(this.dom,h,p);const f=this.getPos();if("number"!=typeof f)return;const m=o.nh.create(c.state.doc,f),g=c.state.tr.setSelection(m);c.dispatch(g)}stopEvent(t){var e;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:t});const n=t.target;if(!this.dom.contains(n)||(null===(e=this.contentDOM)||void 0===e?void 0:e.contains(n)))return!1;const i=t.type.startsWith("drag"),r="drop"===t.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!r&&!i)return!0;const{isEditable:s}=this.editor,{isDragging:a}=this,l=!!this.node.type.spec.draggable,c=o.nh.isSelectable(this.node),d="copy"===t.type,u="paste"===t.type,h="cut"===t.type,p="mousedown"===t.type;if(!l&&c&&i&&t.preventDefault(),l&&i&&!a)return t.preventDefault(),!1;if(l&&s&&!a&&p){const t=n.closest("[data-drag-handle]");t&&(this.dom===t||this.dom.contains(t))&&(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||r||d||u||h||p&&c)}ignoreMutation(t){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:t}):!(!this.node.isLeaf&&!this.node.isAtom&&("selection"===t.type||this.dom.contains(t.target)&&"childList"===t.type&&(Tt()||"Android"===navigator.platform||/android/i.test(navigator.userAgent))&&this.editor.isFocused&&[...Array.from(t.addedNodes),...Array.from(t.removedNodes)].every((t=>t.isContentEditable))||(this.contentDOM!==t.target||"attributes"!==t.type)&&this.contentDOM.contains(t.target))))}updateAttributes(t){this.editor.commands.command((({tr:e})=>{const n=this.getPos();return"number"==typeof n&&(e.setNodeMarkup(n,void 0,{...this.node.attrs,...t}),!0)}))}deleteNode(){const t=this.getPos();if("number"!=typeof t)return;const e=t+this.node.nodeSize;this.editor.commands.deleteRange({from:t,to:e})}}function Re(t){return new lt({find:t.find,handler:({state:e,range:n,match:o,pasteEvent:i})=>{const r=V(t.getAttributes,void 0,o,i);if(!1===r||null===r)return null;const{tr:s}=e,a=o[o.length-1],l=o[0];let c=n.to;if(a){const o=l.search(/\S/),i=n.from+l.indexOf(a),d=i+a.length;if(te(n.from,n.to,e.doc).filter((e=>e.mark.type.excluded.find((n=>n===t.type&&n!==e.mark.type)))).filter((t=>t.to>i)).length)return null;dn.from&&s.delete(n.from+o,i),c=n.from+o+a.length,s.addMark(n.from+o,c,t.type.create(r||{})),s.removeStoredMark(t.type)}}})}function $e(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function Le(t){return"string"==typeof t}function ze(t){return new lt({find:t.find,handler({match:e,chain:n,range:o,pasteEvent:i}){const r=V(t.getAttributes,void 0,e,i),s=V(t.getContent,void 0,r);if(!1===r||null===r)return null;const a={type:t.type.name,attrs:r};s&&(a.content=s),e.input&&n().deleteRange(o).insertContentAt(o.from,a)}})}function Pe(t){return new lt({find:t.find,handler:({state:e,range:n,match:o})=>{let i=t.replace,r=n.from;const s=n.to;if(o[1]){const t=o[0].lastIndexOf(o[1]);i+=o[0].slice(t+o[1].length),r+=t;const e=r-s;e>0&&(i=o[0].slice(t-e,t)+i,r=s)}e.tr.insertText(i,r,s)}})}class Be{constructor(t){this.transaction=t,this.currentStep=this.transaction.steps.length}map(t){let e=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce(((t,n)=>{const o=n.getMap().mapResult(t);return o.deleted&&(e=!0),o.pos}),t),deleted:e}}}},7477:(t,e,n)=>{n.d(e,{Cv:()=>r});var o=n(6426);const i=/^\s*>\s$/,r=o.Node.create({name:"blockquote",addOptions:()=>({HTMLAttributes:{}}),content:"block+",group:"block",defining:!0,parseHTML:()=>[{tag:"blockquote"}],renderHTML({HTMLAttributes:t}){return["blockquote",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{setBlockquote:()=>({commands:t})=>t.wrapIn(this.name),toggleBlockquote:()=>({commands:t})=>t.toggleWrap(this.name),unsetBlockquote:()=>({commands:t})=>t.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[(0,o.wrappingInputRule)({find:i,type:this.type})]}})},7417:(t,e,n)=>{n.d(e,{yN:()=>l});var o=n(6426);const i=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,r=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,s=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,a=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,l=o.Mark.create({name:"bold",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"strong"},{tag:"b",getAttrs:t=>"normal"!==t.style.fontWeight&&null},{style:"font-weight",getAttrs:t=>/^(bold(er)?|[5-9]\d{2,})$/.test(t)&&null}],renderHTML({HTMLAttributes:t}){return["strong",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{setBold:()=>({commands:t})=>t.setMark(this.name),toggleBold:()=>({commands:t})=>t.toggleMark(this.name),unsetBold:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[(0,o.markInputRule)({find:i,type:this.type}),(0,o.markInputRule)({find:s,type:this.type})]},addPasteRules(){return[(0,o.markPasteRule)({find:r,type:this.type}),(0,o.markPasteRule)({find:a,type:this.type})]}})},7371:(t,e,n)=>{n.d(e,{Rg:()=>a});var o=n(6426),i=n(6542),r=n(5377);const s=/^\s*([-+*])\s$/,a=o.Node.create({name:"bulletList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML:()=>[{tag:"ul"}],renderHTML({HTMLAttributes:t}){return["ul",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleBulletList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(i.c.name,this.editor.getAttributes(r.TextStyle.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let t=(0,o.wrappingInputRule)({find:s,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(t=(0,o.wrappingInputRule)({find:s,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(r.TextStyle.name),editor:this.editor})),[t]}})},6927:(t,e,n)=>{n.d(e,{NG:()=>a});var o=n(6426),i=n(3829);const r=/^```([a-z]+)?[\s\n]$/,s=/^~~~([a-z]+)?[\s\n]$/,a=o.Node.create({name:"codeBlock",addOptions:()=>({languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}),content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:t=>{var e;const{languageClassPrefix:n}=this.options;return[...(null===(e=t.firstElementChild)||void 0===e?void 0:e.classList)||[]].filter((t=>t.startsWith(n))).map((t=>t.replace(n,"")))[0]||null},rendered:!1}}},parseHTML:()=>[{tag:"pre",preserveWhitespace:"full"}],renderHTML({node:t,HTMLAttributes:e}){return["pre",(0,o.mergeAttributes)(this.options.HTMLAttributes,e),["code",{class:t.attrs.language?this.options.languageClassPrefix+t.attrs.language:null},0]]},addCommands(){return{setCodeBlock:t=>({commands:e})=>e.setNode(this.name,t),toggleCodeBlock:t=>({commands:e})=>e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:t,$anchor:e}=this.editor.state.selection,n=1===e.pos;return!(!t||e.parent.type.name!==this.name)&&!(!n&&e.parent.textContent.length)&&this.editor.commands.clearNodes()},Enter:({editor:t})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:e}=t,{selection:n}=e,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type)return!1;const r=o.parentOffset===o.parent.nodeSize-2,s=o.parent.textContent.endsWith("\n\n");return!(!r||!s)&&t.chain().command((({tr:t})=>(t.delete(o.pos-2,o.pos),!0))).exitCode().run()},ArrowDown:({editor:t})=>{if(!this.options.exitOnArrowDown)return!1;const{state:e}=t,{selection:n,doc:o}=e,{$from:r,empty:s}=n;if(!s||r.parent.type!==this.type)return!1;if(r.parentOffset!==r.parent.nodeSize-2)return!1;const a=r.after();return void 0!==a&&(o.nodeAt(a)?t.commands.command((({tr:t})=>(t.setSelection(i.LN.near(o.resolve(a))),!0))):t.commands.exitCode())}}},addInputRules(){return[(0,o.textblockTypeInputRule)({find:r,type:this.type,getAttributes:t=>({language:t[1]})}),(0,o.textblockTypeInputRule)({find:s,type:this.type,getAttributes:t=>({language:t[1]})})]},addProseMirrorPlugins(){return[new i.k_({key:new i.hs("codeBlockVSCodeHandler"),props:{handlePaste:(t,e)=>{if(!e.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=e.clipboardData.getData("text/plain"),o=e.clipboardData.getData("vscode-editor-data"),r=o?JSON.parse(o):void 0,s=null==r?void 0:r.mode;if(!n||!s)return!1;const{tr:a,schema:l}=t.state,c=l.text(n.replace(/\r\n?/g,"\n"));return a.replaceSelectionWith(this.type.create({language:s},c)),a.selection.$from.parent.type!==this.type&&a.setSelection(i.U3.near(a.doc.resolve(Math.max(0,a.selection.from-2)))),a.setMeta("paste",!0),t.dispatch(a),!0}}})]}})},9319:(t,e,n)=>{n.d(e,{Cy:()=>s});var o=n(6426);const i=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,r=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,s=o.Mark.create({name:"code",addOptions:()=>({HTMLAttributes:{}}),excludes:"_",code:!0,exitable:!0,parseHTML:()=>[{tag:"code"}],renderHTML({HTMLAttributes:t}){return["code",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{setCode:()=>({commands:t})=>t.setMark(this.name),toggleCode:()=>({commands:t})=>t.toggleMark(this.name),unsetCode:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[(0,o.markInputRule)({find:i,type:this.type})]},addPasteRules(){return[(0,o.markPasteRule)({find:r,type:this.type})]}})},9515:(t,e,n)=>{n.d(e,{y:()=>o});const o=n(6426).Node.create({name:"doc",topNode:!0,content:"block+"})},1985:(t,e,n)=>{n.d(e,{Q:()=>l});var o=n(6426),i=n(3829),r=n(4238);function s(t={}){return new i.k_({view:e=>new a(e,t)})}class a{constructor(t,e){var n;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=e.width)&&void 0!==n?n:1,this.color=!1===e.color?void 0:e.color||"black",this.class=e.class,this.handlers=["dragover","dragend","drop","dragleave"].map((e=>{let n=t=>{this[e](t)};return t.dom.addEventListener(e,n),{name:e,handler:n}}))}destroy(){this.handlers.forEach((({name:t,handler:e})=>this.editorView.dom.removeEventListener(t,e)))}update(t,e){null!=this.cursorPos&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,null==t?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t,e=this.editorView.state.doc.resolve(this.cursorPos),n=!e.parent.inlineContent;if(n){let n=e.nodeBefore,o=e.nodeAfter;if(n||o){let e=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(e){let i=e.getBoundingClientRect(),r=n?i.bottom:i.top;n&&o&&(r=(r+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),t={left:i.left,right:i.right,top:r-this.width/2,bottom:r+this.width/2}}}}if(!t){let e=this.editorView.coordsAtPos(this.cursorPos);t={left:e.left-this.width/2,right:e.left+this.width/2,top:e.top,bottom:e.bottom}}let o,i,r=this.editorView.dom.offsetParent;if(this.element||(this.element=r.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",n),this.element.classList.toggle("prosemirror-dropcursor-inline",!n),!r||r==document.body&&"static"==getComputedStyle(r).position)o=-pageXOffset,i=-pageYOffset;else{let t=r.getBoundingClientRect();o=t.left-r.scrollLeft,i=t.top-r.scrollTop}this.element.style.left=t.left-o+"px",this.element.style.top=t.top-i+"px",this.element.style.width=t.right-t.left+"px",this.element.style.height=t.bottom-t.top+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout((()=>this.setCursor(null)),t)}dragover(t){if(!this.editorView.editable)return;let e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),n=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside),o=n&&n.type.spec.disableDropCursor,i="function"==typeof o?o(this.editorView,e,t):o;if(e&&!i){let t=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let e=(0,r.Um)(this.editorView.state.doc,t,this.editorView.dragging.slice);null!=e&&(t=e)}this.setCursor(t),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){t.target!=this.editorView.dom&&this.editorView.dom.contains(t.relatedTarget)||this.setCursor(null)}}const l=o.Extension.create({name:"dropCursor",addOptions:()=>({color:"currentColor",width:1,class:void 0}),addProseMirrorPlugins(){return[s(this.options)]}})},9221:(t,e,n)=>{n.d(e,{v:()=>m});var o=n(6426),i=n(4103),r=n(3829),s=n(9939),a=n(7887);class l extends r.LN{constructor(t){super(t,t)}map(t,e){let n=t.resolve(e.map(this.head));return l.valid(n)?new l(n):r.LN.near(n)}content(){return s.Ji.empty}eq(t){return t instanceof l&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,e){if("number"!=typeof e.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new l(t.resolve(e.pos))}getBookmark(){return new c(this.anchor)}static valid(t){let e=t.parent;if(e.isTextblock||!function(t){for(let e=t.depth;e>=0;e--){let n=t.index(e),o=t.node(e);if(0!=n)for(let t=o.child(n-1);;t=t.lastChild){if(0==t.childCount&&!t.inlineContent||t.isAtom||t.type.spec.isolating)return!0;if(t.inlineContent)return!1}else if(o.type.spec.isolating)return!0}return!0}(t)||!function(t){for(let e=t.depth;e>=0;e--){let n=t.indexAfter(e),o=t.node(e);if(n!=o.childCount)for(let t=o.child(n);;t=t.firstChild){if(0==t.childCount&&!t.inlineContent||t.isAtom||t.type.spec.isolating)return!0;if(t.inlineContent)return!1}else if(o.type.spec.isolating)return!0}return!0}(t))return!1;let n=e.type.spec.allowGapCursor;if(null!=n)return n;let o=e.contentMatchAt(t.index()).defaultType;return o&&o.isTextblock}static findGapCursorFrom(t,e,n=!1){t:for(;;){if(!n&&l.valid(t))return t;let o=t.pos,i=null;for(let n=t.depth;;n--){let r=t.node(n);if(e>0?t.indexAfter(n)0){i=r.child(e>0?t.indexAfter(n):t.index(n)-1);break}if(0==n)return null;o+=e;let s=t.doc.resolve(o);if(l.valid(s))return s}for(;;){let s=e>0?i.firstChild:i.lastChild;if(!s){if(i.isAtom&&!i.isText&&!r.nh.isSelectable(i)){t=t.doc.resolve(o+i.nodeSize*e),n=!1;continue t}break}i=s,o+=e;let a=t.doc.resolve(o);if(l.valid(a))return a}return null}}}l.prototype.visible=!1,l.findFrom=l.findGapCursorFrom,r.LN.jsonID("gapcursor",l);class c{constructor(t){this.pos=t}map(t){return new c(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return l.valid(e)?new l(e):r.LN.near(e)}}const d=(0,i.K)({ArrowLeft:u("horiz",-1),ArrowRight:u("horiz",1),ArrowUp:u("vert",-1),ArrowDown:u("vert",1)});function u(t,e){const n="vert"==t?e>0?"down":"up":e>0?"right":"left";return function(t,o,i){let s=t.selection,a=e>0?s.$to:s.$from,c=s.empty;if(s instanceof r.U3){if(!i.endOfTextblock(n)||0==a.depth)return!1;c=!1,a=t.doc.resolve(e>0?a.after():a.before())}let d=l.findGapCursorFrom(a,e,c);return!!d&&(o&&o(t.tr.setSelection(new l(d))),!0)}}function h(t,e,n){if(!t||!t.editable)return!1;let o=t.state.doc.resolve(e);if(!l.valid(o))return!1;let i=t.posAtCoords({left:n.clientX,top:n.clientY});return!(i&&i.inside>-1&&r.nh.isSelectable(t.state.doc.nodeAt(i.inside))||(t.dispatch(t.state.tr.setSelection(new l(o))),0))}function p(t,e){if("insertCompositionText"!=e.inputType||!(t.state.selection instanceof l))return!1;let{$from:n}=t.state.selection,o=n.parent.contentMatchAt(n.index()).findWrapping(t.state.schema.nodes.text);if(!o)return!1;let i=s.FK.empty;for(let t=o.length-1;t>=0;t--)i=s.FK.from(o[t].createAndFill(null,i));let a=t.state.tr.replace(n.pos,n.pos,new s.Ji(i,0,0));return a.setSelection(r.U3.near(a.doc.resolve(n.pos+1))),t.dispatch(a),!1}function f(t){if(!(t.selection instanceof l))return null;let e=document.createElement("div");return e.className="ProseMirror-gapcursor",a.zF.create(t.doc,[a.NZ.widget(t.selection.head,e,{key:"gapcursor"})])}const m=o.Extension.create({name:"gapCursor",addProseMirrorPlugins:()=>[new r.k_({props:{decorations:f,createSelectionBetween:(t,e,n)=>e.pos==n.pos&&l.valid(n)?new l(n):null,handleClick:h,handleKeyDown:d,handleDOMEvents:{beforeinput:p}}})],extendNodeSchema(t){var e;const n={name:t.name,options:t.options,storage:t.storage};return{allowGapCursor:null!==(e=(0,o.callOrReturn)((0,o.getExtensionField)(t,"allowGapCursor",n)))&&void 0!==e?e:null}}})},7481:(t,e,n)=>{n.d(e,{B:()=>i});var o=n(6426);const i=o.Node.create({name:"hardBreak",addOptions:()=>({keepMarks:!0,HTMLAttributes:{}}),inline:!0,group:"inline",selectable:!1,parseHTML:()=>[{tag:"br"}],renderHTML({HTMLAttributes:t}){return["br",(0,o.mergeAttributes)(this.options.HTMLAttributes,t)]},renderText:()=>"\n",addCommands(){return{setHardBreak:()=>({commands:t,chain:e,state:n,editor:o})=>t.first([()=>t.exitCode(),()=>t.command((()=>{const{selection:t,storedMarks:i}=n;if(t.$from.parent.type.spec.isolating)return!1;const{keepMarks:r}=this.options,{splittableMarks:s}=o.extensionManager,a=i||t.$to.parentOffset&&t.$from.marks();return e().insertContent({type:this.name}).command((({tr:t,dispatch:e})=>{if(e&&a&&r){const e=a.filter((t=>s.includes(t.type.name)));t.ensureMarks(e)}return!0})).run()}))])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}})},1988:(t,e,n)=>{n.r(e),n.d(e,{Heading:()=>i,default:()=>i});var o=n(6426);const i=o.Node.create({name:"heading",addOptions:()=>({levels:[1,2,3,4,5,6],HTMLAttributes:{}}),content:"inline*",group:"block",defining:!0,addAttributes:()=>({level:{default:1,rendered:!1}}),parseHTML(){return this.options.levels.map((t=>({tag:`h${t}`,attrs:{level:t}})))},renderHTML({node:t,HTMLAttributes:e}){return[`h${this.options.levels.includes(t.attrs.level)?t.attrs.level:this.options.levels[0]}`,(0,o.mergeAttributes)(this.options.HTMLAttributes,e),0]},addCommands(){return{setHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.setNode(this.name,t),toggleHeading:t=>({commands:e})=>!!this.options.levels.includes(t.level)&&e.toggleNode(this.name,"paragraph",t)}},addKeyboardShortcuts(){return this.options.levels.reduce(((t,e)=>({...t,[`Mod-Alt-${e}`]:()=>this.editor.commands.toggleHeading({level:e})})),{})},addInputRules(){return this.options.levels.map((t=>(0,o.textblockTypeInputRule)({find:new RegExp(`^(#{1,${t}})\\s$`),type:this.type,getAttributes:{level:t}})))}})},9322:(t,e,n)=>{n.d(e,{B:()=>T});var o=n(6426),i=200,r=function(){};r.prototype.append=function(t){return t.length?(t=r.from(t),!this.length&&t||t.length=e?r.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))},r.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)},r.prototype.forEach=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length),e<=n?this.forEachInner(t,e,n,0):this.forEachInvertedInner(t,e,n,0)},r.prototype.map=function(t,e,n){void 0===e&&(e=0),void 0===n&&(n=this.length);var o=[];return this.forEach((function(e,n){return o.push(t(e,n))}),e,n),o},r.from=function(t){return t instanceof r?t:t&&t.length?new s(t):r.empty};var s=function(t){function e(e){t.call(this),this.values=e}t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e;var n={length:{configurable:!0},depth:{configurable:!0}};return e.prototype.flatten=function(){return this.values},e.prototype.sliceInner=function(t,n){return 0==t&&n==this.length?this:new e(this.values.slice(t,n))},e.prototype.getInner=function(t){return this.values[t]},e.prototype.forEachInner=function(t,e,n,o){for(var i=e;i=n;i--)if(!1===t(this.values[i],o+i))return!1},e.prototype.leafAppend=function(t){if(this.length+t.length<=i)return new e(this.values.concat(t.flatten()))},e.prototype.leafPrepend=function(t){if(this.length+t.length<=i)return new e(t.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(e.prototype,n),e}(r);r.empty=new s([]);var a=function(t){function e(e,n){t.call(this),this.left=e,this.right=n,this.length=e.length+n.length,this.depth=Math.max(e.depth,n.depth)+1}return t&&(e.__proto__=t),e.prototype=Object.create(t&&t.prototype),e.prototype.constructor=e,e.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},e.prototype.getInner=function(t){return ti&&!1===this.right.forEachInner(t,Math.max(e-i,0),Math.min(this.length,n)-i,o+i))&&void 0},e.prototype.forEachInvertedInner=function(t,e,n,o){var i=this.left.length;return!(e>i&&!1===this.right.forEachInvertedInner(t,e-i,Math.max(n,i)-i,o+i))&&!(n=n?this.right.slice(t-n,e-n):this.left.slice(t,n).append(this.right.slice(0,e-n))},e.prototype.leafAppend=function(t){var n=this.right.leafAppend(t);if(n)return new e(this.left,n)},e.prototype.leafPrepend=function(t){var n=this.left.leafPrepend(t);if(n)return new e(n,this.right)},e.prototype.appendInner=function(t){return this.left.depth>=Math.max(this.right.depth,t.depth)+1?new e(this.left,new e(this.right,t)):new e(this,t)},e}(r);const l=r;var c=n(4238),d=n(3829);class u{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(0==this.eventCount)return null;let n,o,i=this.items.length;for(;;i--)if(this.items.get(i-1).selection){--i;break}e&&(n=this.remapping(i,this.items.length),o=n.maps.length);let r,s,a=t.tr,l=[],c=[];return this.items.forEach(((t,e)=>{if(!t.step)return n||(n=this.remapping(i,e+1),o=n.maps.length),o--,void c.push(t);if(n){c.push(new h(t.map));let e,i=t.step.map(n.slice(o));i&&a.maybeStep(i).doc&&(e=a.mapping.maps[a.mapping.maps.length-1],l.push(new h(e,void 0,void 0,l.length+c.length))),o--,e&&n.appendMap(e,o)}else a.maybeStep(t.step);return t.selection?(r=n?t.selection.map(n.slice(o)):t.selection,s=new u(this.items.slice(0,i).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0}),this.items.length,0),{remaining:s,transform:a,selection:r}}addTransform(t,e,n,o){let i=[],r=this.eventCount,s=this.items,a=!o&&s.length?s.get(s.length-1):null;for(let n=0;nf&&(s=function(t,e){let n;return t.forEach(((t,o)=>{if(t.selection&&0==e--)return n=o,!1})),t.slice(n)}(s,l),r-=l),new u(s.append(i),r)}remapping(t,e){let n=new c.X9;return this.items.forEach(((e,o)=>{let i=null!=e.mirrorOffset&&o-e.mirrorOffset>=t?n.maps.length-e.mirrorOffset:void 0;n.appendMap(e.map,i)}),t,e),n}addMaps(t){return 0==this.eventCount?this:new u(this.items.append(t.map((t=>new h(t)))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let n=[],o=Math.max(0,this.items.length-e),i=t.mapping,r=t.steps.length,s=this.eventCount;this.items.forEach((t=>{t.selection&&s--}),o);let a=e;this.items.forEach((e=>{let o=i.getMirror(--a);if(null==o)return;r=Math.min(r,o);let l=i.maps[o];if(e.step){let r=t.steps[o].invert(t.docs[o]),c=e.selection&&e.selection.map(i.slice(a+1,o));c&&s++,n.push(new h(l,r,c))}else n.push(new h(l))}),o);let l=[];for(let t=e;t500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let t=0;return this.items.forEach((e=>{e.step||t++})),t}compress(t=this.items.length){let e=this.remapping(0,t),n=e.maps.length,o=[],i=0;return this.items.forEach(((r,s)=>{if(s>=t)o.push(r),r.selection&&i++;else if(r.step){let t=r.step.map(e.slice(n)),s=t&&t.getMap();if(n--,s&&e.appendMap(s,n),t){let a=r.selection&&r.selection.map(e.slice(n));a&&i++;let l,c=new h(s.invert(),t,a),d=o.length-1;(l=o.length&&o[d].merge(c))?o[d]=l:o.push(c)}}else r.map&&n--}),this.items.length,0),new u(l.from(o.reverse()),i)}}u.empty=new u(l.empty,0);class h{constructor(t,e,n,o){this.map=t,this.step=e,this.selection=n,this.mirrorOffset=o}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new h(e.getMap().invert(),e,this.selection)}}}class p{constructor(t,e,n,o,i){this.done=t,this.undone=e,this.prevRanges=n,this.prevTime=o,this.prevComposition=i}}const f=20;function m(t){let e=[];for(let n=t.length-1;n>=0&&0==e.length;n--)t[n].forEach(((t,n,o,i)=>e.push(o,i)));return e}function g(t,e){if(!t)return null;let n=[];for(let o=0;onew p(u.empty,u.empty,null,0,-1),apply:(e,n,o)=>function(t,e,n,o){let i,r=n.getMeta(v);if(r)return r.historyState;n.getMeta(w)&&(t=new p(t.done,t.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return t;if(s&&s.getMeta(v))return s.getMeta(v).redo?new p(t.done.addTransform(n,void 0,o,k(e)),t.undone,m(n.mapping.maps),t.prevTime,t.prevComposition):new p(t.done,t.undone.addTransform(n,void 0,o,k(e)),null,t.prevTime,t.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(i=n.getMeta("rebased"))?new p(t.done.rebased(n,i),t.undone.rebased(n,i),g(t.prevRanges,n.mapping),t.prevTime,t.prevComposition):new p(t.done.addMaps(n.mapping.maps),t.undone.addMaps(n.mapping.maps),g(t.prevRanges,n.mapping),t.prevTime,t.prevComposition);{let i=n.getMeta("composition"),r=0==t.prevTime||!s&&t.prevComposition!=i&&(t.prevTime<(n.time||0)-o.newGroupDelay||!function(t,e){if(!e)return!1;if(!t.docChanged)return!0;let n=!1;return t.mapping.maps[0].forEach(((t,o)=>{for(let i=0;i=e[i]&&(n=!0)})),n}(n,t.prevRanges)),a=s?g(t.prevRanges,n.mapping):m(n.mapping.maps);return new p(t.done.addTransform(n,r?e.selection.getBookmark():void 0,o,k(e)),u.empty,a,n.time,null==i?t.prevComposition:i)}}(n,o,e,t)},config:t,props:{handleDOMEvents:{beforeinput(t,e){let n=e.inputType,o="historyUndo"==n?S:"historyRedo"==n?M:null;return!!o&&(e.preventDefault(),o(t.state,t.dispatch))}}}})}function x(t,e){return(n,o)=>{let i=v.getState(n);if(!i||0==(t?i.undone:i.done).eventCount)return!1;if(o){let r=function(t,e,n){let o=k(e),i=v.get(e).spec.config,r=(n?t.undone:t.done).popEvent(e,o);if(!r)return null;let s=r.selection.resolve(r.transform.doc),a=(n?t.done:t.undone).addTransform(r.transform,e.selection.getBookmark(),i,o),l=new p(n?a:r.remaining,n?r.remaining:a,null,0,-1);return r.transform.setSelection(s).setMeta(v,{redo:n,historyState:l})}(i,n,t);r&&o(e?r.scrollIntoView():r)}return!0}}const S=x(!1,!0),M=x(!0,!0);x(!1,!1),x(!0,!1);const T=o.Extension.create({name:"history",addOptions:()=>({depth:100,newGroupDelay:500}),addCommands:()=>({undo:()=>({state:t,dispatch:e})=>S(t,e),redo:()=>({state:t,dispatch:e})=>M(t,e)}),addProseMirrorPlugins(){return[C(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()}}})},3161:(t,e,n)=>{n.d(e,{d:()=>r});var o=n(6426),i=n(3829);const r=o.Node.create({name:"horizontalRule",addOptions:()=>({HTMLAttributes:{}}),group:"block",parseHTML:()=>[{tag:"hr"}],renderHTML({HTMLAttributes:t}){return["hr",(0,o.mergeAttributes)(this.options.HTMLAttributes,t)]},addCommands(){return{setHorizontalRule:()=>({chain:t,state:e})=>{const{selection:n}=e,{$from:r,$to:s}=n,a=t();return 0===r.parentOffset?a.insertContentAt({from:Math.max(r.pos-1,0),to:s.pos},{type:this.name}):(0,o.isNodeSelection)(n)?a.insertContentAt(s.pos,{type:this.name}):a.insertContent({type:this.name}),a.command((({tr:t,dispatch:e})=>{var n;if(e){const{$to:e}=t.selection,o=e.end();if(e.nodeAfter)e.nodeAfter.isTextblock?t.setSelection(i.U3.create(t.doc,e.pos+1)):e.nodeAfter.isBlock?t.setSelection(i.nh.create(t.doc,e.pos)):t.setSelection(i.U3.create(t.doc,e.pos));else{const r=null===(n=e.parent.type.contentMatch.defaultType)||void 0===n?void 0:n.create();r&&(t.insert(o,r),t.setSelection(i.U3.create(t.doc,o+1)))}t.scrollIntoView()}return!0})).run()}}},addInputRules(){return[(0,o.nodeInputRule)({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}})},2100:(t,e,n)=>{n.d(e,{J2:()=>l});var o=n(6426);const i=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,r=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,s=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,a=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,l=o.Mark.create({name:"italic",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"em"},{tag:"i",getAttrs:t=>"normal"!==t.style.fontStyle&&null},{style:"font-style=italic"}],renderHTML({HTMLAttributes:t}){return["em",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{setItalic:()=>({commands:t})=>t.setMark(this.name),toggleItalic:()=>({commands:t})=>t.toggleMark(this.name),unsetItalic:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[(0,o.markInputRule)({find:i,type:this.type}),(0,o.markInputRule)({find:s,type:this.type})]},addPasteRules(){return[(0,o.markPasteRule)({find:r,type:this.type}),(0,o.markPasteRule)({find:a,type:this.type})]}})},6542:(t,e,n)=>{n.d(e,{c:()=>i});var o=n(6426);const i=o.Node.create({name:"listItem",addOptions:()=>({HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}),content:"paragraph block*",defining:!0,parseHTML:()=>[{tag:"li"}],renderHTML({HTMLAttributes:t}){return["li",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}})},3808:(t,e,n)=>{n.d(e,{_J:()=>a});var o=n(6426),i=n(6542),r=n(5377);const s=/^(\d+)\.\s$/,a=o.Node.create({name:"orderedList",addOptions:()=>({itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}),group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes:()=>({start:{default:1,parseHTML:t=>t.hasAttribute("start")?parseInt(t.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:t=>t.getAttribute("type")}}),parseHTML:()=>[{tag:"ol"}],renderHTML({HTMLAttributes:t}){const{start:e,...n}=t;return 1===e?["ol",(0,o.mergeAttributes)(this.options.HTMLAttributes,n),0]:["ol",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{toggleOrderedList:()=>({commands:t,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(i.c.name,this.editor.getAttributes(r.TextStyle.name)).run():t.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let t=(0,o.wrappingInputRule)({find:s,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(t=(0,o.wrappingInputRule)({find:s,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(r.TextStyle.name)}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1],editor:this.editor})),[t]}})},7308:(t,e,n)=>{n.d(e,{f:()=>i});var o=n(6426);const i=o.Node.create({name:"paragraph",priority:1e3,addOptions:()=>({HTMLAttributes:{}}),group:"block",content:"inline*",parseHTML:()=>[{tag:"p"}],renderHTML({HTMLAttributes:t}){return["p",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{setParagraph:()=>({commands:t})=>t.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}})},5261:(t,e,n)=>{n.r(e),n.d(e,{Placeholder:()=>s,default:()=>s});var o=n(6426),i=n(3829),r=n(7887);const s=o.Extension.create({name:"placeholder",addOptions:()=>({emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}),addProseMirrorPlugins(){return[new i.k_({key:new i.hs("placeholder"),props:{decorations:({doc:t,selection:e})=>{const n=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:i}=e,s=[];if(!n)return null;const a=this.editor.isEmpty;return t.descendants(((t,e)=>{const n=i>=e&&i<=e+t.nodeSize,l=!t.isLeaf&&(0,o.isNodeEmpty)(t);if((n||!this.options.showOnlyCurrent)&&l){const o=[this.options.emptyNodeClass];a&&o.push(this.options.emptyEditorClass);const i=r.NZ.node(e,e+t.nodeSize,{class:o.join(" "),"data-placeholder":"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:e,hasAnchor:n}):this.options.placeholder});s.push(i)}return this.options.includeChildren})),r.zF.create(t,s)}}})]}})},9534:(t,e,n)=>{n.d(e,{n:()=>s});var o=n(6426);const i=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,r=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,s=o.Mark.create({name:"strike",addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:t=>!!t.includes("line-through")&&{}}],renderHTML({HTMLAttributes:t}){return["s",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{setStrike:()=>({commands:t})=>t.setMark(this.name),toggleStrike:()=>({commands:t})=>t.toggleMark(this.name),unsetStrike:()=>({commands:t})=>t.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[(0,o.markInputRule)({find:i,type:this.type})]},addPasteRules(){return[(0,o.markPasteRule)({find:r,type:this.type})]}})},3017:(t,e,n)=>{n.r(e),n.d(e,{TableCell:()=>i,default:()=>i});var o=n(6426);const i=o.Node.create({name:"tableCell",addOptions:()=>({HTMLAttributes:{}}),content:"block+",addAttributes:()=>({colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:t=>{const e=t.getAttribute("colwidth");return e?[parseInt(e,10)]:null}}}),tableRole:"cell",isolating:!0,parseHTML:()=>[{tag:"td"}],renderHTML({HTMLAttributes:t}){return["td",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]}})},5377:(t,e,n)=>{n.r(e),n.d(e,{TextStyle:()=>i,default:()=>i});var o=n(6426);const i=o.Mark.create({name:"textStyle",priority:101,addOptions:()=>({HTMLAttributes:{}}),parseHTML:()=>[{tag:"span",getAttrs:t=>!!t.hasAttribute("style")&&{}}],renderHTML({HTMLAttributes:t}){return["span",(0,o.mergeAttributes)(this.options.HTMLAttributes,t),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:t,commands:e})=>{const n=(0,o.getMarkAttributes)(t,this.type);return!!Object.entries(n).some((([,t])=>!!t))||e.unsetMark(this.name)}}}})},8777:(t,e,n)=>{n.d(e,{E:()=>o});const o=n(6426).Node.create({name:"text",group:"inline"})},4103:(t,e,n)=>{n.d(e,{K:()=>f,w:()=>p});for(var o={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:"'"},i={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},r="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),s="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),a=0;a<10;a++)o[48+a]=o[96+a]=String(a);for(a=1;a<=24;a++)o[a+111]="F"+a;for(a=65;a<=90;a++)o[a]=String.fromCharCode(a+32),i[a]=String.fromCharCode(a);for(var l in o)i.hasOwnProperty(l)||(i[l]=o[l]);var c=n(3829);const d="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform);function u(t){let e,n,o,i,r=t.split(/-(?!$)/),s=r[r.length-1];"Space"==s&&(s=" ");for(let t=0;t127)&&(a=o[n.keyCode])&&a!=l){let o=e[h(a,n)];if(o&&o(t.state,t.dispatch,t))return!0}}return!1}}},9939:(t,e,n)=>{function o(t){this.content=t}n.d(e,{S4:()=>Q,ZF:()=>lt,FK:()=>a,CU:()=>u,sX:()=>J,bP:()=>N,u$:()=>A,vI:()=>h,Sj:()=>Y,Ji:()=>p}),o.prototype={constructor:o,find:function(t){for(var e=0;e>1}},o.from=function(t){if(t instanceof o)return t;var e=[];if(t)for(var n in t)e.push(n,t[n]);return new o(e)};const i=o;function r(t,e,n){for(let o=0;;o++){if(o==t.childCount||o==e.childCount)return t.childCount==e.childCount?null:n;let i=t.child(o),s=e.child(o);if(i!=s){if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let t=0;i.text[t]==s.text[t];t++)n++;return n}if(i.content.size||s.content.size){let t=r(i.content,s.content,n+1);if(null!=t)return t}n+=i.nodeSize}else n+=i.nodeSize}}function s(t,e,n,o){for(let i=t.childCount,r=e.childCount;;){if(0==i||0==r)return i==r?null:{a:n,b:o};let a=t.child(--i),l=e.child(--r),c=a.nodeSize;if(a!=l){if(!a.sameMarkup(l))return{a:n,b:o};if(a.isText&&a.text!=l.text){let t=0,e=Math.min(a.text.length,l.text.length);for(;tt&&!1!==n(a,o+s,i||null,r)&&a.content.size){let i=s+1;a.nodesBetween(Math.max(0,t-i),Math.min(a.content.size,e-i),n,o+i)}s=l}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,n,o){let i="",r=!0;return this.nodesBetween(t,e,((s,a)=>{let l=s.isText?s.text.slice(Math.max(t,a)-a,e-a):s.isLeaf?o?"function"==typeof o?o(s):o:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(r?r=!1:i+=n),i+=l}),0),i}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,n=t.firstChild,o=this.content.slice(),i=0;for(e.isText&&e.sameMarkup(n)&&(o[o.length-1]=e.withText(e.text+n.text),i=1);it)for(let i=0,r=0;rt&&((re)&&(s=s.isText?s.cut(Math.max(0,t-r),Math.min(s.text.length,e-r)):s.cut(Math.max(0,t-r-1),Math.min(s.content.size,e-r-1))),n.push(s),o+=s.nodeSize),r=a}return new a(n,o)}cutByIndex(t,e){return t==e?a.empty:0==t&&e==this.content.length?this:new a(this.content.slice(t,e))}replaceChild(t,e){let n=this.content[t];if(n==e)return this;let o=this.content.slice(),i=this.size+e.nodeSize-n.nodeSize;return o[t]=e,new a(o,i)}addToStart(t){return new a([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new a(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;ethis.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let n=0,o=0;;n++){let i=o+this.child(n).nodeSize;if(i>=t)return i==t||e>0?c(n+1,i):c(n,o);o=i}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map((t=>t.toJSON())):null}static fromJSON(t,e){if(!e)return a.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new a(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return a.empty;let e,n=0;for(let o=0;o{class t{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,n=!1;for(let o=0;othis.type.rank&&(e||(e=t.slice(0,o)),e.push(this),n=!0),e&&e.push(i)}}return e||(e=t.slice()),n||e.push(this),e}removeFromSet(t){for(let e=0;et.type.rank-e.type.rank)),n}}return t.none=[],t})();class h extends Error{}class p{constructor(t,e,n){this.content=t,this.openStart=e,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let n=m(this.content,t+this.openStart,e);return n&&new p(n,this.openStart,this.openEnd)}removeBetween(t,e){return new p(f(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return p.empty;let n=e.openStart||0,o=e.openEnd||0;if("number"!=typeof n||"number"!=typeof o)throw new RangeError("Invalid input for Slice.fromJSON");return new p(a.fromJSON(t,e.content),n,o)}static maxOpen(t,e=!0){let n=0,o=0;for(let o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)n++;for(let n=t.lastChild;n&&!n.isLeaf&&(e||!n.type.spec.isolating);n=n.lastChild)o++;return new p(t,n,o)}}function f(t,e,n){let{index:o,offset:i}=t.findIndex(e),r=t.maybeChild(o),{index:s,offset:a}=t.findIndex(n);if(i==e||r.isText){if(a!=n&&!t.child(s).isText)throw new RangeError("Removing non-flat range");return t.cut(0,e).append(t.cut(n))}if(o!=s)throw new RangeError("Removing non-flat range");return t.replaceChild(o,r.copy(f(r.content,e-i-1,n-i-1)))}function m(t,e,n,o){let{index:i,offset:r}=t.findIndex(e),s=t.maybeChild(i);if(r==e||s.isText)return o&&!o.canReplace(i,i,n)?null:t.cut(0,e).append(n).append(t.cut(e));let a=m(s.content,e-r-1,n);return a&&t.replaceChild(i,s.copy(a))}function g(t,e,n){if(n.openStart>t.depth)throw new h("Inserted content deeper than insertion position");if(t.depth-n.openStart!=e.depth-n.openEnd)throw new h("Inconsistent open depths");return b(t,e,n,0)}function b(t,e,n,o){let i=t.index(o),r=t.node(o);if(i==e.index(o)&&o=0;t--)o=e.node(t).copy(a.from(o));return{start:o.resolveNoCache(t.openStart+n),end:o.resolveNoCache(o.content.size-t.openEnd-n)}}(n,t);return C(r,x(t,i,s,e,o))}{let o=t.parent,i=o.content;return C(o,i.cut(0,t.parentOffset).append(n.content).append(i.cut(e.parentOffset)))}}return C(r,S(t,e,o))}function y(t,e){if(!e.type.compatibleContent(t.type))throw new h("Cannot join "+e.type.name+" onto "+t.type.name)}function k(t,e,n){let o=t.node(n);return y(o,e.node(n)),o}function v(t,e){let n=e.length-1;n>=0&&t.isText&&t.sameMarkup(e[n])?e[n]=t.withText(e[n].text+t.text):e.push(t)}function w(t,e,n,o){let i=(e||t).node(n),r=0,s=e?e.index(n):i.childCount;t&&(r=t.index(n),t.depth>n?r++:t.textOffset&&(v(t.nodeAfter,o),r++));for(let t=r;ti&&k(t,e,i+1),s=o.depth>i&&k(n,o,i+1),l=[];return w(null,t,i,l),r&&s&&e.index(i)==n.index(i)?(y(r,s),v(C(r,x(t,e,n,o,i+1)),l)):(r&&v(C(r,S(t,e,i+1)),l),w(e,n,i,l),s&&v(C(s,S(n,o,i+1)),l)),w(o,null,i,l),new a(l)}function S(t,e,n){let o=[];return w(null,t,n,o),t.depth>n&&v(C(k(t,e,n+1),S(t,e,n+1)),o),w(e,null,n,o),new a(o)}p.empty=new p(a.empty,0,0);class M{constructor(t,e,n){this.pos=t,this.path=e,this.parentOffset=n,this.depth=e.length/3-1}resolveDepth(t){return null==t?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[3*this.resolveDepth(t)]}index(t){return this.path[3*this.resolveDepth(t)+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t!=this.depth||this.textOffset?1:0)}start(t){return 0==(t=this.resolveDepth(t))?0:this.path[3*t-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]}after(t){if(!(t=this.resolveDepth(t)))throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[3*t-1]+this.path[3*t].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let n=this.pos-this.path[this.path.length-1],o=t.child(e);return n?t.child(e).cut(n):o}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):0==t?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let n=this.path[3*e],o=0==e?0:this.path[3*e-1]+1;for(let e=0;e0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos=0;n--)if(t.pos<=this.end(n)&&(!e||e(this.node(n))))return new A(this,t,n);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let n=[],o=0,i=e;for(let e=t;;){let{index:t,offset:r}=e.content.findIndex(i),s=i-r;if(n.push(e,t,o+r),!s)break;if(e=e.child(t),e.isText)break;i=s-1,o+=r+1}return new M(e,n,i)}static resolveCached(t,e){let n=E.get(t);if(n)for(let t=0;tt&&this.nodesBetween(t,e,(t=>(n.isInSet(t.marks)&&(o=!0),!o))),o}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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),R(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,n=a.empty,o=0,i=n.childCount){let r=this.contentMatchAt(t).matchFragment(n,o,i),s=r&&r.matchFragment(this.content,e);if(!s||!s.validEnd)return!1;for(let t=o;tt.type.name))}`);this.content.forEach((t=>t.check()))}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map((t=>t.toJSON()))),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let n;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=e.marks.map(t.markFromJSON)}if("text"==e.type){if("string"!=typeof e.text)throw new RangeError("Invalid text node in JSON");return t.text(e.text,n)}let o=a.fromJSON(t,e.content),i=t.nodeType(e.type).create(e.attrs,o,n);return i.type.checkAttrs(i.attrs),i}}N.prototype.text=void 0;class D extends N{constructor(t,e,n,o){if(super(t,e,null,o),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):R(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new D(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new D(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return 0==t&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}}function R(t,e){for(let n=t.length-1;n>=0;n--)e=t[n].type.name+"("+e+")";return e}class ${constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let n=new L(t,e);if(null==n.next)return $.empty;let o=z(n);n.next&&n.err("Unexpected trailing text");let i=function(t){let e=Object.create(null);return function n(o){let i=[];o.forEach((e=>{t[e].forEach((({term:e,to:n})=>{if(!e)return;let o;for(let t=0;t{o||i.push([e,o=[]]),-1==o.indexOf(t)&&o.push(t)}))}))}));let r=e[o.join(",")]=new $(o.indexOf(t.length-1)>-1);for(let t=0;te.concat(t(n,r))),[]);if("seq"!=e.type){if("star"==e.type){let s=n();return o(r,s),i(t(e.expr,s),s),[o(s)]}if("plus"==e.type){let s=n();return i(t(e.expr,r),s),i(t(e.expr,s),s),[o(s)]}if("opt"==e.type)return[o(r)].concat(t(e.expr,r));if("range"==e.type){let s=r;for(let o=0;ot.to=e))}}(o));return function(t,e){for(let n=0,o=[t];nt.createAndFill())));for(let t=0;t=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];return function e(n){t.push(n);for(let o=0;o{let o=n+(e.validEnd?"*":" ")+" ";for(let n=0;n"+t.indexOf(e.next[n].next);return o})).join("\n")}}$.empty=new $(!0);class L{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.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(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}}function z(t){let e=[];do{e.push(P(t))}while(t.eat("|"));return 1==e.length?e[0]:{type:"choice",exprs:e}}function P(t){let e=[];do{e.push(B(t))}while(t.next&&")"!=t.next&&"|"!=t.next);return 1==e.length?e[0]:{type:"seq",exprs:e}}function B(t){let e=function(t){if(t.eat("(")){let e=z(t);return t.eat(")")||t.err("Missing closing paren"),e}if(!/\W/.test(t.next)){let e=function(t,e){let n=t.nodeTypes,o=n[e];if(o)return[o];let i=[];for(let t in n){let o=n[t];o.groups.indexOf(e)>-1&&i.push(o)}return 0==i.length&&t.err("No node type or group '"+e+"' found"),i}(t,t.next).map((e=>(null==t.inline?t.inline=e.isInline:t.inline!=e.isInline&&t.err("Mixing inline and block content"),{type:"name",value:e})));return t.pos++,1==e.length?e[0]:{type:"choice",exprs:e}}t.err("Unexpected token '"+t.next+"'")}(t);for(;;)if(t.eat("+"))e={type:"plus",expr:e};else if(t.eat("*"))e={type:"star",expr:e};else if(t.eat("?"))e={type:"opt",expr:e};else{if(!t.eat("{"))break;e=H(t,e)}return e}function _(t){/\D/.test(t.next)&&t.err("Expected number, got '"+t.next+"'");let e=Number(t.next);return t.pos++,e}function H(t,e){let n=_(t),o=n;return t.eat(",")&&(o="}"!=t.next?_(t):-1),t.eat("}")||t.err("Unclosed braced range"),{type:"range",min:n,max:o,expr:e}}function j(t,e){return e-t}function F(t,e){let n=[];return function e(o){let i=t[o];if(1==i.length&&!i[0].term)return e(i[0].to);n.push(o);for(let t=0;t-1}allowsMarks(t){if(null==this.markSet)return!0;for(let e=0;en[t]=new U(t,e,o)));let o=e.spec.topNode||"doc";if(!n[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let t in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class K{constructor(t,e,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(t,e,n){let o=n.split("|");return n=>{let i=null===n?"null":typeof n;if(o.indexOf(i)<0)throw new RangeError(`Expected value of type ${o} for attribute ${e} on type ${t}, got ${i}`)}}(t,e,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class J{constructor(t,e,n,o){this.name=t,this.rank=e,this.schema=n,this.spec=o,this.attrs=X(t,o.attrs),this.excluded=null;let i=G(this.attrs);this.instance=i?new u(this,i):null}create(t=null){return!t&&this.instance?this.instance:new u(this,V(this.attrs,t))}static compile(t,e){let n=Object.create(null),o=0;return t.forEach(((t,i)=>n[t]=new J(t,o++,e,i))),n}removeFromSet(t){for(var e=0;e-1}}class Y{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let e=this.spec={};for(let n in t)e[n]=t[n];e.nodes=i.from(t.nodes),e.marks=i.from(t.marks||{}),this.nodes=U.compile(this.spec.nodes,this),this.marks=J.compile(this.spec.marks,this);let n=Object.create(null);for(let t in this.nodes){if(t in this.marks)throw new RangeError(t+" can not be both a node and a mark");let e=this.nodes[t],o=e.spec.content||"",i=e.spec.marks;if(e.contentMatch=n[o]||(n[o]=$.parse(o,this.nodes)),e.inlineContent=e.contentMatch.inlineContent,e.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!e.isInline||!e.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=e}e.markSet="_"==i?null:i?q(this,i.split(" ")):""!=i&&e.inlineContent?null:[]}for(let t in this.marks){let e=this.marks[t],n=e.spec.excludes;e.excluded=null==n?[e]:""==n?[]:q(this,n.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,n,o){if("string"==typeof t)t=this.nodeType(t);else{if(!(t instanceof U))throw new RangeError("Invalid node type: "+t);if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}return t.createChecked(e,n,o)}text(t,e){let n=this.nodes.text;return new D(n,n.defaultAttrs,t,u.setFrom(e))}mark(t,e){return"string"==typeof t&&(t=this.marks[t]),t.create(e)}nodeFromJSON(t){return N.fromJSON(this,t)}markFromJSON(t){return u.fromJSON(this,t)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}}function q(t,e){let n=[];for(let o=0;o-1)&&n.push(s=o)}if(!s)throw new SyntaxError("Unknown mark type: '"+e[o]+"'")}return n}class Q{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let n=this.matchedStyles=[];e.forEach((t=>{if(function(t){return null!=t.tag}(t))this.tags.push(t);else if(function(t){return null!=t.style}(t)){let e=/[^=]*/.exec(t.style)[0];n.indexOf(e)<0&&n.push(e),this.styles.push(t)}})),this.normalizeLists=!this.tags.some((e=>{if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;let n=t.nodes[e.node];return n.contentMatch.matchType(n)}))}parse(t,e={}){let n=new it(this,e,!1);return n.addAll(t,u.none,e.from,e.to),n.finish()}parseSlice(t,e={}){let n=new it(this,e,!0);return n.addAll(t,u.none,e.from,e.to),p.maxOpen(n.finish())}matchTag(t,e,n){for(let o=n?this.tags.indexOf(n)+1:0;ot.length&&(61!=r.charCodeAt(t.length)||r.slice(t.length+1)!=e))){if(o.getAttrs){let t=o.getAttrs(e);if(!1===t)continue;o.attrs=t||void 0}return o}}}static schemaRules(t){let e=[];function n(t){let n=null==t.priority?50:t.priority,o=0;for(;o{n(t=st(t)),t.mark||t.ignore||t.clearMark||(t.mark=e)}))}for(let e in t.nodes){let o=t.nodes[e].spec.parseDOM;o&&o.forEach((t=>{n(t=st(t)),t.node||t.ignore||t.mark||(t.node=e)}))}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new Q(t,Q.schemaRules(t)))}}const Z={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},tt={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},et={ol:!0,ul:!0};function nt(t,e,n){return null!=e?(e?1:0)|("full"===e?2:0):t&&"pre"==t.whitespace?3:-5&n}class ot{constructor(t,e,n,o,i,r){this.type=t,this.attrs=e,this.marks=n,this.solid=o,this.options=r,this.content=[],this.activeMarks=u.none,this.match=i||(4&r?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(a.from(t));if(!e){let e,n=this.type.contentMatch;return(e=n.findWrapping(t.type))?(this.match=n,e):null}this.match=this.type.contentMatch.matchFragment(e)}return this.match.findWrapping(t.type)}finish(t){if(!(1&this.options)){let t,e=this.content[this.content.length-1];if(e&&e.isText&&(t=/[ \t\r\n\u000c]+$/.exec(e.text))){let n=e;e.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-t[0].length))}}let e=a.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(a.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!Z.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}}class it{constructor(t,e,n){this.parser=t,this.options=e,this.isOpen=n,this.open=0;let o,i=e.topNode,r=nt(null,e.preserveWhitespace,0)|(n?4:0);o=i?new ot(i.type,i.attrs,u.none,!0,e.topMatch||i.type.contentMatch,r):new ot(n?null:t.schema.topNodeType,null,u.none,!0,null,r),this.nodes=[o],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,e){3==t.nodeType?this.addTextNode(t,e):1==t.nodeType&&this.addElement(t,e)}addTextNode(t,e){let n=t.nodeValue,o=this.top;if(2&o.options||o.inlineContext(t)||/[^ \t\r\n\u000c]/.test(n)){if(1&o.options)n=2&o.options?n.replace(/\r\n?/g,"\n"):n.replace(/\r?\n|\r/g," ");else if(n=n.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(n)&&this.open==this.nodes.length-1){let e=o.content[o.content.length-1],i=t.previousSibling;(!e||i&&"BR"==i.nodeName||e.isText&&/[ \t\r\n\u000c]$/.test(e.text))&&(n=n.slice(1))}n&&this.insertNode(this.parser.schema.text(n),e),this.findInText(t)}else this.findInside(t)}addElement(t,e,n){let o,i=t.nodeName.toLowerCase();et.hasOwnProperty(i)&&this.parser.normalizeLists&&function(t){for(let e=t.firstChild,n=null;e;e=e.nextSibling){let t=1==e.nodeType?e.nodeName.toLowerCase():null;t&&et.hasOwnProperty(t)&&n?(n.appendChild(e),e=n):"li"==t?n=e:t&&(n=null)}}(t);let r=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(o=this.parser.matchTag(t,this,n));if(r?r.ignore:tt.hasOwnProperty(i))this.findInside(t),this.ignoreFallback(t,e);else if(!r||r.skip||r.closeParent){r&&r.closeParent?this.open=Math.max(0,this.open-1):r&&r.skip.nodeType&&(t=r.skip);let n,o=this.top,s=this.needsBlock;if(Z.hasOwnProperty(i))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!t.firstChild)return void this.leafFallback(t,e);let a=r&&r.skip?e:this.readStyles(t,e);a&&this.addAll(t,a),n&&this.sync(o),this.needsBlock=s}else{let n=this.readStyles(t,e);n&&this.addElementByRule(t,r,n,!1===r.consuming?o:void 0)}}leafFallback(t,e){"BR"==t.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode("\n"),e)}ignoreFallback(t,e){"BR"!=t.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),e)}readStyles(t,e){let n=t.style;if(n&&n.length)for(let t=0;t!n.clearMark(t))):e.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;t=n}}return e}addElementByRule(t,e,n,o){let i,r;if(e.node)if(r=this.parser.schema.nodes[e.node],r.isLeaf)this.insertNode(r.create(e.attrs),n)||this.leafFallback(t,n);else{let t=this.enter(r,e.attrs||null,n,e.preserveWhitespace);t&&(i=!0,n=t)}else{let t=this.parser.schema.marks[e.mark];n=n.concat(t.create(e.attrs))}let s=this.top;if(r&&r.isLeaf)this.findInside(t);else if(o)this.addElement(t,n,o);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach((t=>this.insertNode(t,n)));else{let o=t;"string"==typeof e.contentElement?o=t.querySelector(e.contentElement):"function"==typeof e.contentElement?o=e.contentElement(t):e.contentElement&&(o=e.contentElement),this.findAround(t,o,!0),this.addAll(o,n)}i&&this.sync(s)&&this.open--}addAll(t,e,n,o){let i=n||0;for(let r=n?t.childNodes[n]:t.firstChild,s=null==o?null:t.childNodes[o];r!=s;r=r.nextSibling,++i)this.findAtPoint(t,i),this.addDOM(r,e);this.findAtPoint(t,i)}findPlace(t,e){let n,o;for(let e=this.open;e>=0;e--){let i=this.nodes[e],r=i.findWrapping(t);if(r&&(!n||n.length>r.length)&&(n=r,o=i,!r.length))break;if(i.solid)break}if(!n)return null;this.sync(o);for(let t=0;t!(r.type?r.type.allowsMarkType(e.type):at(e.type,t))||(a=e.addToSet(a),!1))),this.nodes.push(new ot(t,e,a,o,null,s)),this.open++,n}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));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(t){for(let e=this.open;e>=0;e--)if(this.nodes[e]==t)return this.open=e,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let n=this.nodes[e].content;for(let e=n.length-1;e>=0;e--)t+=n[e].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let n=0;n-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),n=this.options.context,o=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),i=-(n?n.depth+1:0)+(o?0:1),r=(t,s)=>{for(;t>=0;t--){let a=e[t];if(""==a){if(t==e.length-1||0==t)continue;for(;s>=i;s--)if(r(t-1,s))return!0;return!1}{let t=s>0||0==s&&o?this.nodes[s].type:n&&s>=i?n.node(s-i).type:null;if(!t||t.name!=a&&-1==t.groups.indexOf(a))return!1;s--}}return!0};return r(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let n=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let t in this.parser.schema.nodes){let e=this.parser.schema.nodes[t];if(e.isTextblock&&e.defaultAttrs)return e}}}function rt(t,e){return(t.matches||t.msMatchesSelector||t.webkitMatchesSelector||t.mozMatchesSelector).call(t,e)}function st(t){let e={};for(let n in t)e[n]=t[n];return e}function at(t,e){let n=e.schema.nodes;for(let o in n){let i=n[o];if(!i.allowsMarkType(t))continue;let r=[],s=t=>{r.push(t);for(let n=0;n{if(i.length||t.marks.length){let n=0,r=0;for(;n=0;o--){let i=this.serializeMark(t.marks[o],t.isInline,e);i&&((i.contentDOM||i.dom).appendChild(n),n=i.dom)}return n}serializeMark(t,e,n={}){let o=this.marks[t.type.name];return o&&ht(dt(n),o(t,e),null,t.attrs)}static renderSpec(t,e,n=null,o){return ht(t,e,n,o)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new lt(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=ct(t.nodes);return e.text||(e.text=t=>t.text),e}static marksFromSchema(t){return ct(t.marks)}}function ct(t){let e={};for(let n in t){let o=t[n].spec.toDOM;o&&(e[n]=o)}return e}function dt(t){return t.document||window.document}const ut=new WeakMap;function ht(t,e,n,o){if("string"==typeof e)return{dom:t.createTextNode(e)};if(null!=e.nodeType)return{dom:e};if(e.dom&&null!=e.dom.nodeType)return e;let i,r=e[0];if("string"!=typeof r)throw new RangeError("Invalid array passed to renderSpec");if(o&&(i=function(t){let e=ut.get(t);return void 0===e&&ut.set(t,e=function(t){let e=null;return function t(n){if(n&&"object"==typeof n)if(Array.isArray(n))if("string"==typeof n[0])e||(e=[]),e.push(n);else for(let e=0;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,a=r.indexOf(" ");a>0&&(n=r.slice(0,a),r=r.slice(a+1));let l=n?t.createElementNS(n,r):t.createElement(r),c=e[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let t in c)if(null!=c[t]){let e=t.indexOf(" ");e>0?l.setAttributeNS(t.slice(0,e),t.slice(e+1),c[t]):l.setAttribute(t,c[t])}}for(let i=d;id)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:e,contentDOM:i}=ht(t,r,n,o);if(l.appendChild(e),i){if(s)throw new RangeError("Multiple content holes");s=i}}}return{dom:l,contentDOM:s}}},3829:(t,e,n)=>{n.d(e,{$t:()=>x,LN:()=>s,U3:()=>d,hs:()=>E,i5:()=>f,k_:()=>M,nh:()=>h,yn:()=>a});var o=n(9939),i=n(4238);const r=Object.create(null);class s{constructor(t,e,n){this.$anchor=t,this.$head=e,this.ranges=n||[new a(t.min(e),t.max(e))]}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 t=this.ranges;for(let e=0;e=0;o--){let i=e<0?g(t.node(0),t.node(o),t.before(o+1),t.index(o),e,n):g(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,n);if(i)return i}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new f(t.node(0))}static atStart(t){return g(t,t,0,0,1)||new f(t)}static atEnd(t){return g(t,t,t.content.size,t.childCount,-1)||new f(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=r[e.type];if(!n)throw new RangeError(`No selection type ${e.type} defined`);return n.fromJSON(t,e)}static jsonID(t,e){if(t in r)throw new RangeError("Duplicate use of selection JSON ID "+t);return r[t]=e,e.prototype.jsonID=t,e}getBookmark(){return d.between(this.$anchor,this.$head).getBookmark()}}s.prototype.visible=!0;class a{constructor(t,e){this.$from=t,this.$to=e}}let l=!1;function c(t){l||t.parent.inlineContent||(l=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+t.parent.type.name+")"))}class d extends s{constructor(t,e=t){c(t),c(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let n=t.resolve(e.map(this.head));if(!n.parent.inlineContent)return s.near(n);let o=t.resolve(e.map(this.anchor));return new d(o.parent.inlineContent?o:n,n)}replace(t,e=o.Ji.empty){if(super.replace(t,e),e==o.Ji.empty){let e=this.$from.marksAcross(this.$to);e&&t.ensureMarks(e)}}eq(t){return t instanceof d&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new u(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if("number"!=typeof e.anchor||"number"!=typeof e.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new d(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,n=e){let o=t.resolve(e);return new this(o,n==e?o:t.resolve(n))}static between(t,e,n){let o=t.pos-e.pos;if(n&&!o||(n=o>=0?1:-1),!e.parent.inlineContent){let t=s.findFrom(e,n,!0)||s.findFrom(e,-n,!0);if(!t)return s.near(e,n);e=t.$head}return t.parent.inlineContent||(0==o||(t=(s.findFrom(t,-n,!0)||s.findFrom(t,n,!0)).$anchor).posnew f(t)};function g(t,e,n,o,i,r=!1){if(e.inlineContent)return d.create(t,n);for(let s=o-(i>0?0:1);i>0?s=0;s+=i){let o=e.child(s);if(o.isAtom){if(!r&&h.isSelectable(o))return h.create(t,n-(i<0?o.nodeSize:0))}else{let e=g(t,o,n+i,i<0?o.childCount:0,i,r);if(e)return e}n+=o.nodeSize*i}return null}function b(t,e,n){let o=t.steps.length-1;if(o{null==r&&(r=o)})),t.setSelection(s.near(t.doc.resolve(r),n)))}class y extends i.dL{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor0}setStoredMarks(t){return this.storedMarks=t,this.updated|=2,this}ensureMarks(t){return o.CU.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(2&this.updated)>0}addStep(t,e){super.addStep(t,e),this.updated=-3&this.updated,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let n=this.selection;return e&&(t=t.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||o.CU.none))),n.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,n){let o=this.doc.type.schema;if(null==e)return t?this.replaceSelectionWith(o.text(t),!0):this.deleteSelection();{if(null==n&&(n=e),n=null==n?e:n,!t)return this.deleteRange(e,n);let i=this.storedMarks;if(!i){let t=this.doc.resolve(e);i=n==e?t.marks():t.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(e,n,o.text(t,i)),this.selection.empty||this.setSelection(s.near(this.selection.$to)),this}}setMeta(t,e){return this.meta["string"==typeof t?t:t.key]=e,this}getMeta(t){return this.meta["string"==typeof t?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=4,this}get scrolledIntoView(){return(4&this.updated)>0}}function k(t,e){return e&&t?t.bind(e):t}class v{constructor(t,e,n){this.name=t,this.init=k(e.init,n),this.apply=k(e.apply,n)}}const w=[new v("doc",{init:t=>t.doc||t.schema.topNodeType.createAndFill(),apply:t=>t.doc}),new v("selection",{init:(t,e)=>t.selection||s.atStart(e.doc),apply:t=>t.selection}),new v("storedMarks",{init:t=>t.storedMarks||null,apply:(t,e,n,o)=>o.selection.$cursor?t.storedMarks:null}),new v("scrollToSelection",{init:()=>0,apply:(t,e)=>t.scrolledIntoView?e+1:e})];class C{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=w.slice(),e&&e.forEach((t=>{if(this.pluginsByKey[t.key])throw new RangeError("Adding different instances of a keyed plugin ("+t.key+")");this.plugins.push(t),this.pluginsByKey[t.key]=t,t.spec.state&&this.fields.push(new v(t.key,t.spec.state,t))}))}}class x{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let n=0;nt.toJSON()))),t&&"object"==typeof t)for(let n in t){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");let o=t[n],i=o.spec.state;i&&i.toJSON&&(e[n]=i.toJSON.call(o,this[o.key]))}return e}static fromJSON(t,e,n){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new C(t.schema,t.plugins),r=new x(i);return i.fields.forEach((i=>{if("doc"==i.name)r.doc=o.bP.fromJSON(t.schema,e.doc);else if("selection"==i.name)r.selection=s.fromJSON(r.doc,e.selection);else if("storedMarks"==i.name)e.storedMarks&&(r.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(n)for(let o in n){let s=n[o],a=s.spec.state;if(s.key==i.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(e,o))return void(r[i.name]=a.fromJSON.call(s,t,e[o],r))}r[i.name]=i.init(t,r)}})),r}}function S(t,e,n){for(let o in t){let i=t[o];i instanceof Function?i=i.bind(e):"handleDOMEvents"==o&&(i=S(i,e,{})),n[o]=i}return n}class M{constructor(t){this.spec=t,this.props={},t.props&&S(t.props,this,this.props),this.key=t.key?t.key.key:O("plugin")}getState(t){return t[this.key]}}const T=Object.create(null);function O(t){return t in T?t+"$"+ ++T[t]:(T[t]=0,t+"$")}class E{constructor(t="key"){this.key=O(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}}},4238:(t,e,n)=>{n.d(e,{$L:()=>I,Ln:()=>b,N0:()=>E,Um:()=>A,Wg:()=>y,X9:()=>l,dL:()=>G,jP:()=>C,n9:()=>T,oM:()=>x,zy:()=>M});var o=n(9939);const i=Math.pow(2,16);function r(t){return 65535&t}class s{constructor(t,e,n){this.pos=t,this.delInfo=e,this.recover=n}get deleted(){return(8&this.delInfo)>0}get deletedBefore(){return(5&this.delInfo)>0}get deletedAfter(){return(6&this.delInfo)>0}get deletedAcross(){return(4&this.delInfo)>0}}class a{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&a.empty)return a.empty}recover(t){let e=0,n=r(t);if(!this.inverted)for(let t=0;tt)break;let d=this.ranges[l+r],u=this.ranges[l+a],h=c+d;if(t<=h){let r=c+o+((d?t==c?-1:t==h?1:e:e)<0?0:u);if(n)return r;let a=t==c?2:t==h?1:4;return(e<0?t!=c:t!=h)&&(a|=8),new s(r,a,t==(e<0?c:h)?null:l/3+(t-c)*i)}o+=u-d}return n?t+o:new s(t+o,0,null)}touches(t,e){let n=0,o=r(e),i=this.inverted?2:1,s=this.inverted?1:2;for(let e=0;et)break;let a=this.ranges[e+i];if(t<=r+a&&e==3*o)return!0;n+=this.ranges[e+s]-a}return!1}forEach(t){let e=this.inverted?2:1,n=this.inverted?1:2;for(let o=0,i=0;o=0;e--){let o=t.getMirror(e);this.appendMap(t.maps[e].invert(),null!=o&&o>e?n-o-1:void 0)}}invert(){let t=new l;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let n=this.from;nn&&et.isAtom&&e.type.allowsMarkType(this.mark.type)?t.mark(this.mark.addToSet(t.marks)):t),i),e.openStart,e.openEnd);return u.fromReplace(t,this.from,this.to,r)}invert(){return new f(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new p(e.pos,n.pos,this.mark)}merge(t){return t instanceof p&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new p(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new p(e.from,e.to,t.markFromJSON(e.mark))}}d.jsonID("addMark",p);class f extends d{constructor(t,e,n){super(),this.from=t,this.to=e,this.mark=n}apply(t){let e=t.slice(this.from,this.to),n=new o.Ji(h(e.content,(t=>t.mark(this.mark.removeFromSet(t.marks))),t),e.openStart,e.openEnd);return u.fromReplace(t,this.from,this.to,n)}invert(){return new p(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),n=t.mapResult(this.to,-1);return e.deleted&&n.deleted||e.pos>=n.pos?null:new f(e.pos,n.pos,this.mark)}merge(t){return t instanceof f&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new f(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new f(e.from,e.to,t.markFromJSON(e.mark))}}d.jsonID("removeMark",f);class m extends d{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return u.fail("No node at mark step's position");let n=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return u.fromReplace(t,this.pos,this.pos+1,new o.Ji(o.FK.from(n),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let t=this.mark.addToSet(e.marks);if(t.length==e.marks.length){for(let n=0;nn.pos?null:new y(e.pos,n.pos,o,i,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if("number"!=typeof e.from||"number"!=typeof e.to||"number"!=typeof e.gapFrom||"number"!=typeof e.gapTo||"number"!=typeof e.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new y(e.from,e.to,e.gapFrom,e.gapTo,o.Ji.fromJSON(t,e.slice),e.insert,!!e.structure)}}function k(t,e,n){let o=t.resolve(e),i=n-e,r=o.depth;for(;i>0&&r>0&&o.indexAfter(r)==o.node(r).childCount;)r--,i--;if(i>0){let t=o.node(r).maybeChild(o.indexAfter(r));for(;i>0;){if(!t||t.isLeaf)return!0;t=t.firstChild,i--}}return!1}function v(t,e,n,i=n.contentMatch,r=!0){let s=t.doc.nodeAt(e),a=[],l=e+1;for(let e=0;e=0;e--)t.step(a[e])}function w(t,e,n){return(0==e||t.canReplace(e,t.childCount))&&(n==t.childCount||t.canReplace(0,n))}function C(t){let e=t.parent.content.cutByIndex(t.startIndex,t.endIndex);for(let n=t.depth;;--n){let o=t.$from.node(n),i=t.$from.index(n),r=t.$to.indexAfter(n);if(nr;t--,e--){let n=i.node(t),r=i.index(t);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(r,n.childCount),a=o&&o[e+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=o&&o[e]||n;if(!n.canReplace(r+1,n.childCount)||!l.type.validContent(s))return!1}let a=i.indexAfter(r),l=o&&o[0];return i.node(r).canReplaceWith(a,a,l?l.type:i.node(r+1).type)}function T(t,e){let n=t.resolve(e),o=n.index();return O(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(o,o+1)}function O(t,e){return!(!t||!e||t.isLeaf||!t.canAppend(e))}function E(t,e,n=-1){let o=t.resolve(e);for(let t=o.depth;;t--){let i,r,s=o.index(t);if(t==o.depth?(i=o.nodeBefore,r=o.nodeAfter):n>0?(i=o.node(t+1),s++,r=o.node(t).maybeChild(s)):(i=o.node(t).maybeChild(s-1),r=o.node(t+1)),i&&!i.isTextblock&&O(i,r)&&o.node(t).canReplace(s,s+1))return e;if(0==t)break;e=n<0?o.before(t):o.after(t)}}function A(t,e,n){let o=t.resolve(e);if(!n.content.size)return e;let i=n.content;for(let t=0;t=0;e--){let n=e==o.depth?0:o.pos<=(o.start(e+1)+o.end(e+1))/2?-1:1,r=o.index(e)+(n>0?1:0),s=o.node(e),a=!1;if(1==t)a=s.canReplace(r,r,i);else{let t=s.contentMatchAt(r).findWrapping(i.firstChild.type);a=t&&s.canReplaceWith(r,r,t[0])}if(a)return 0==n?o.pos:n<0?o.before(e+1):o.after(e+1)}return null}function I(t,e,n=e,i=o.Ji.empty){if(e==n&&!i.size)return null;let r=t.resolve(e),s=t.resolve(n);return N(r,s,i)?new b(e,n,i):new D(r,s,i).fit()}function N(t,e,n){return!n.openStart&&!n.openEnd&&t.start()==e.start()&&t.parent.canReplace(t.index(),e.index(),n.content)}d.jsonID("replaceAround",y);class D{constructor(t,e,n){this.$from=t,this.$to=e,this.unplaced=n,this.frontier=[],this.placed=o.FK.empty;for(let e=0;e<=t.depth;e++){let n=t.node(e);this.frontier.push({type:n.type,match:n.contentMatchAt(t.indexAfter(e))})}for(let e=t.depth;e>0;e--)this.placed=o.FK.from(t.node(e).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let t=this.findFittable();t?this.placeNodes(t):this.openMore()||this.dropNode()}let t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(t<0?this.$to:n.doc.resolve(t));if(!i)return null;let r=this.placed,s=n.depth,a=i.depth;for(;s&&a&&1==r.childCount;)r=r.firstChild.content,s--,a--;let l=new o.Ji(r,s,a);return t>-1?new y(n.pos,t,this.$to.pos,this.$to.end(),l,e):l.size||n.pos!=this.$to.pos?new b(n.pos,i.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,n=0,o=this.unplaced.openEnd;n1&&(o=0),i.type.spec.isolating&&o<=n){t=n;break}e=i.content}for(let e=1;e<=2;e++)for(let n=1==e?t:this.unplaced.openStart;n>=0;n--){let t,i=null;n?(i=L(this.unplaced.content,n-1).firstChild,t=i.content):t=this.unplaced.content;let r=t.firstChild;for(let t=this.depth;t>=0;t--){let s,{type:a,match:l}=this.frontier[t],c=null;if(1==e&&(r?l.matchType(r.type)||(c=l.fillBefore(o.FK.from(r),!1)):i&&a.compatibleContent(i.type)))return{sliceDepth:n,frontierDepth:t,parent:i,inject:c};if(2==e&&r&&(s=l.findWrapping(r.type)))return{sliceDepth:n,frontierDepth:t,parent:i,wrap:s};if(i&&l.matchType(i.type))break}}}openMore(){let{content:t,openStart:e,openEnd:n}=this.unplaced,i=L(t,e);return!(!i.childCount||i.firstChild.isLeaf||(this.unplaced=new o.Ji(t,e+1,Math.max(n,i.size+e>=t.size-n?e+1:0)),0))}dropNode(){let{content:t,openStart:e,openEnd:n}=this.unplaced,i=L(t,e);if(i.childCount<=1&&e>0){let r=t.size-e<=e+i.size;this.unplaced=new o.Ji(R(t,e-1,1),e-1,r?e-1:n)}else this.unplaced=new o.Ji(R(t,e,1),e,n)}placeNodes({sliceDepth:t,frontierDepth:e,parent:n,inject:i,wrap:r}){for(;this.depth>e;)this.closeFrontierNode();if(r)for(let t=0;t1||0==l||t.content.size)&&(u=e,d.push(z(t.mark(h.allowedMarks(t.marks)),1==c?l:0,c==a.childCount?p:-1)))}let f=c==a.childCount;f||(p=-1),this.placed=$(this.placed,e,o.FK.from(d)),this.frontier[e].match=u,f&&p<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let t=0,e=a;t1&&o==this.$to.end(--n);)++o;return o}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:n,type:o}=this.frontier[e],i=e=0;n--){let{match:e,type:o}=this.frontier[n],i=P(t,n,o,e,!0);if(!i||i.childCount)continue t}return{depth:e,fit:r,move:i?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=$(this.placed,e.depth,e.fit)),t=e.move;for(let n=e.depth+1;n<=t.depth;n++){let e=t.node(n),o=e.type.contentMatch.fillBefore(e.content,!0,t.index(n));this.openFrontierNode(e.type,e.attrs,o)}return t}openFrontierNode(t,e=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=$(this.placed,this.depth,o.FK.from(t.create(e,n))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(o.FK.empty,!0);t.childCount&&(this.placed=$(this.placed,this.frontier.length,t))}}function R(t,e,n){return 0==e?t.cutByIndex(n,t.childCount):t.replaceChild(0,t.firstChild.copy(R(t.firstChild.content,e-1,n)))}function $(t,e,n){return 0==e?t.append(n):t.replaceChild(t.childCount-1,t.lastChild.copy($(t.lastChild.content,e-1,n)))}function L(t,e){for(let n=0;n1&&(i=i.replaceChild(0,z(i.firstChild,e-1,1==i.childCount?n-1:0))),e>0&&(i=t.type.contentMatch.fillBefore(i).append(i),n<=0&&(i=i.append(t.type.contentMatch.matchFragment(i).fillBefore(o.FK.empty,!0)))),t.copy(i)}function P(t,e,n,o,i){let r=t.node(e),s=i?t.indexAfter(e):t.index(e);if(s==r.childCount&&!n.compatibleContent(r.type))return null;let a=o.fillBefore(r.content,!0,s);return a&&!function(t,e,n){for(let o=n;oi){let e=r.contentMatchAt(0),n=e.fillBefore(t).append(t);t=n.append(e.matchFragment(n).fillBefore(o.FK.empty,!0))}return t}function _(t,e){let n=[];for(let o=Math.min(t.depth,e.depth);o>=0;o--){let i=t.start(o);if(ie.pos+(e.depth-o)||t.node(o).type.spec.isolating||e.node(o).type.spec.isolating)break;(i==e.start(o)||o==t.depth&&o==e.depth&&t.parent.inlineContent&&e.parent.inlineContent&&o&&e.start(o-1)==i-1)&&n.push(o)}return n}class H extends d{constructor(t,e,n){super(),this.pos=t,this.attr=e,this.value=n}apply(t){let e=t.nodeAt(this.pos);if(!e)return u.fail("No node at attribute step's position");let n=Object.create(null);for(let t in e.attrs)n[t]=e.attrs[t];n[this.attr]=this.value;let i=e.type.create(n,null,e.marks);return u.fromReplace(t,this.pos,this.pos+1,new o.Ji(o.FK.from(i),0,e.isLeaf?0:1))}getMap(){return a.empty}invert(t){return new H(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new H(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if("number"!=typeof e.pos||"string"!=typeof e.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new H(e.pos,e.attr,e.value)}}d.jsonID("attr",H);class j extends d{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let n in t.attrs)e[n]=t.attrs[n];e[this.attr]=this.value;let n=t.type.create(e,t.content,t.marks);return u.ok(n)}getMap(){return a.empty}invert(t){return new j(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if("string"!=typeof e.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new j(e.attr,e.value)}}d.jsonID("docAttr",j);let F=class extends Error{};F=function t(e){let n=Error.call(this,e);return n.__proto__=t.prototype,n},(F.prototype=Object.create(Error.prototype)).constructor=F,F.prototype.name="TransformError";class G{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new l}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new F(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,n=o.Ji.empty){let i=I(this.doc,t,e,n);return i&&this.step(i),this}replaceWith(t,e,n){return this.replace(t,e,new o.Ji(o.FK.from(n),0,0))}delete(t,e){return this.replace(t,e,o.Ji.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,n){return function(t,e,n,i){if(!i.size)return t.deleteRange(e,n);let r=t.doc.resolve(e),s=t.doc.resolve(n);if(N(r,s,i))return t.step(new b(e,n,i));let a=_(r,t.doc.resolve(n));0==a[a.length-1]&&a.pop();let l=-(r.depth+1);a.unshift(l);for(let t=r.depth,e=r.pos-1;t>0;t--,e--){let n=r.node(t).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;a.indexOf(t)>-1?l=t:r.before(t)==e&&a.splice(1,0,-t)}let c=a.indexOf(l),d=[],u=i.openStart;for(let t=i.content,e=0;;e++){let n=t.firstChild;if(d.push(n),e==i.openStart)break;t=n.content}for(let t=u-1;t>=0;t--){let e=d[t],n=(h=e.type).spec.defining||h.spec.definingForContent;if(n&&!e.sameMarkup(r.node(Math.abs(l)-1)))u=t;else if(n||!e.type.isTextblock)break}var h;for(let e=i.openStart;e>=0;e--){let l=(e+u+1)%(i.openStart+1),h=d[l];if(h)for(let e=0;e=0&&(t.replace(e,n,i),!(t.steps.length>p));o--){let t=a[o];t<0||(e=r.before(t),n=s.after(t))}}(this,t,e,n),this}replaceRangeWith(t,e,n){return function(t,e,n,i){if(!i.isInline&&e==n&&t.doc.resolve(e).parent.content.size){let o=function(t,e,n){let o=t.resolve(e);if(o.parent.canReplaceWith(o.index(),o.index(),n))return e;if(0==o.parentOffset)for(let t=o.depth-1;t>=0;t--){let e=o.index(t);if(o.node(t).canReplaceWith(e,e,n))return o.before(t+1);if(e>0)return null}if(o.parentOffset==o.parent.content.size)for(let t=o.depth-1;t>=0;t--){let e=o.indexAfter(t);if(o.node(t).canReplaceWith(e,e,n))return o.after(t+1);if(e0&&(s||o.node(n-1).canReplace(o.index(n-1),i.indexAfter(n-1))))return t.delete(o.before(n),i.after(n))}for(let r=1;r<=o.depth&&r<=i.depth;r++)if(e-o.start(r)==o.depth-r&&n>o.end(r)&&i.end(r)-n!=i.depth-r)return t.delete(o.before(r),n);t.delete(e,n)}(this,t,e),this}lift(t,e){return function(t,e,n){let{$from:i,$to:r,depth:s}=e,a=i.before(s+1),l=r.after(s+1),c=a,d=l,u=o.FK.empty,h=0;for(let t=s,e=!1;t>n;t--)e||i.index(t)>0?(e=!0,u=o.FK.from(i.node(t).copy(u)),h++):c--;let p=o.FK.empty,f=0;for(let t=s,e=!1;t>n;t--)e||r.after(t+1)=0;t--){if(i.size){let e=n[t].type.contentMatch.matchFragment(i);if(!e||!e.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}i=o.FK.from(n[t].type.create(n[t].attrs,i))}let r=e.start,s=e.end;t.step(new y(r,s,r,s,new o.Ji(i,0,0),n.length,!0))}(this,t,e),this}setBlockType(t,e=t,n,i=null){return function(t,e,n,i,r){if(!i.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=t.steps.length;t.doc.nodesBetween(e,n,((e,n)=>{let a="function"==typeof r?r(e):r;if(e.isTextblock&&!e.hasMarkup(i,a)&&function(t,e,n){let o=t.resolve(e),i=o.index();return o.parent.canReplaceWith(i,i+1,n)}(t.doc,t.mapping.slice(s).map(n),i)){let r=null;if(i.schema.linebreakReplacement){let t="pre"==i.whitespace,e=!!i.contentMatch.matchType(i.schema.linebreakReplacement);t&&!e?r=!1:!t&&e&&(r=!0)}!1===r&&function(t,e,n,o){e.forEach(((i,r)=>{if(i.type==i.type.schema.linebreakReplacement){let i=t.mapping.slice(o).map(n+1+r);t.replaceWith(i,i+1,e.type.schema.text("\n"))}}))}(t,e,n,s),v(t,t.mapping.slice(s).map(n,1),i,void 0,null===r);let l=t.mapping.slice(s),c=l.map(n,1),d=l.map(n+e.nodeSize,1);return t.step(new y(c,d,c+1,d-1,new o.Ji(o.FK.from(i.create(a,null,e.marks)),0,0),1,!0)),!0===r&&function(t,e,n,o){e.forEach(((i,r)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let i=t.mapping.slice(o).map(n+1+r+s.index);t.replaceWith(i,i+1,e.type.schema.linebreakReplacement.create())}}}))}(t,e,n,s),!1}}))}(this,t,e,n,i),this}setNodeMarkup(t,e,n=null,i){return function(t,e,n,i,r){let s=t.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");n||(n=s.type);let a=n.create(i,null,r||s.marks);if(s.isLeaf)return t.replaceWith(e,e+s.nodeSize,a);if(!n.validContent(s.content))throw new RangeError("Invalid content for node type "+n.name);t.step(new y(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new o.Ji(o.FK.from(a),0,0),1,!0))}(this,t,e,n,i),this}setNodeAttribute(t,e,n){return this.step(new H(t,e,n)),this}setDocAttribute(t,e){return this.step(new j(t,e)),this}addNodeMark(t,e){return this.step(new m(t,e)),this}removeNodeMark(t,e){if(!(e instanceof o.CU)){let n=this.doc.nodeAt(t);if(!n)throw new RangeError("No node at position "+t);if(!(e=e.isInSet(n.marks)))return this}return this.step(new g(t,e)),this}split(t,e=1,n){return function(t,e,n=1,i){let r=t.doc.resolve(e),s=o.FK.empty,a=o.FK.empty;for(let t=r.depth,e=r.depth-n,l=n-1;t>e;t--,l--){s=o.FK.from(r.node(t).copy(s));let e=i&&i[l];a=o.FK.from(e?e.type.create(e.attrs,a):r.node(t).copy(a))}t.step(new b(e,e,new o.Ji(s.append(a),n,n),!0))}(this,t,e,n),this}addMark(t,e,n){return function(t,e,n,o){let i,r,s=[],a=[];t.doc.nodesBetween(e,n,((t,l,c)=>{if(!t.isInline)return;let d=t.marks;if(!o.isInSet(d)&&c.type.allowsMarkType(o.type)){let c=Math.max(l,e),u=Math.min(l+t.nodeSize,n),h=o.addToSet(d);for(let t=0;tt.step(e))),a.forEach((e=>t.step(e)))}(this,t,e,n),this}removeMark(t,e,n){return function(t,e,n,i){let r=[],s=0;t.doc.nodesBetween(e,n,((t,a)=>{if(!t.isInline)return;s++;let l=null;if(i instanceof o.sX){let e,n=t.marks;for(;e=i.isInSet(n);)(l||(l=[])).push(e),n=e.removeFromSet(n)}else i?i.isInSet(t.marks)&&(l=[i]):l=t.marks;if(l&&l.length){let o=Math.min(a+t.nodeSize,n);for(let t=0;tt.step(new f(e.from,e.to,e.style))))}(this,t,e,n),this}clearIncompatible(t,e,n){return v(this,t,e,n),this}}},7887:(t,e,n)=>{n.d(e,{Lz:()=>dn,NZ:()=>ze,zF:()=>_e});var o=n(3829),i=n(9939),r=n(4238);const s=function(t){for(var e=0;;e++)if(!(t=t.previousSibling))return e},a=function(t){let e=t.assignedSlot||t.parentNode;return e&&11==e.nodeType?e.host:e};let l=null;const c=function(t,e,n){let o=l||(l=document.createRange());return o.setEnd(t,null==n?t.nodeValue.length:n),o.setStart(t,e||0),o},d=function(t,e,n,o){return n&&(h(t,e,n,o,-1)||h(t,e,n,o,1))},u=/^(img|br|input|textarea|hr)$/i;function h(t,e,n,o,i){for(;;){if(t==n&&e==o)return!0;if(e==(i<0?0:p(t))){let n=t.parentNode;if(!n||1!=n.nodeType||f(t)||u.test(t.nodeName)||"false"==t.contentEditable)return!1;e=s(t)+(i<0?0:1),t=n}else{if(1!=t.nodeType)return!1;if("false"==(t=t.childNodes[e+(i<0?-1:0)]).contentEditable)return!1;e=i<0?p(t):0}}}function p(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function f(t){let e;for(let n=t;n&&!(e=n.pmViewDesc);n=n.parentNode);return e&&e.node&&e.node.isBlock&&(e.dom==t||e.contentDOM==t)}const m=function(t){return t.focusNode&&d(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset)};function g(t,e){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=t,n.key=n.code=e,n}const b="undefined"!=typeof navigator?navigator:null,y="undefined"!=typeof document?document:null,k=b&&b.userAgent||"",v=/Edge\/(\d+)/.exec(k),w=/MSIE \d/.exec(k),C=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(k),x=!!(w||C||v),S=w?document.documentMode:C?+C[1]:v?+v[1]:0,M=!x&&/gecko\/(\d+)/i.test(k);M&&(/Firefox\/(\d+)/.exec(k)||[0,0])[1];const T=!x&&/Chrome\/(\d+)/.exec(k),O=!!T,E=T?+T[1]:0,A=!x&&!!b&&/Apple Computer/.test(b.vendor),I=A&&(/Mobile\/\w+/.test(k)||!!b&&b.maxTouchPoints>2),N=I||!!b&&/Mac/.test(b.platform),D=!!b&&/Win/.test(b.platform),R=/Android \d/.test(k),$=!!y&&"webkitFontSmoothing"in y.documentElement.style,L=$?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function z(t){let e=t.defaultView&&t.defaultView.visualViewport;return e?{left:0,right:e.width,top:0,bottom:e.height}:{left:0,right:t.documentElement.clientWidth,top:0,bottom:t.documentElement.clientHeight}}function P(t,e){return"number"==typeof t?t:t[e]}function B(t){let e=t.getBoundingClientRect(),n=e.width/t.offsetWidth||1,o=e.height/t.offsetHeight||1;return{left:e.left,right:e.left+t.clientWidth*n,top:e.top,bottom:e.top+t.clientHeight*o}}function _(t,e,n){let o=t.someProp("scrollThreshold")||0,i=t.someProp("scrollMargin")||5,r=t.dom.ownerDocument;for(let s=n||t.dom;s;s=a(s)){if(1!=s.nodeType)continue;let t=s,n=t==r.body,a=n?z(r):B(t),l=0,c=0;if(e.topa.bottom-P(o,"bottom")&&(c=e.bottom-e.top>a.bottom-a.top?e.top+P(i,"top")-a.top:e.bottom-a.bottom+P(i,"bottom")),e.lefta.right-P(o,"right")&&(l=e.right-a.right+P(i,"right")),l||c)if(n)r.defaultView.scrollBy(l,c);else{let n=t.scrollLeft,o=t.scrollTop;c&&(t.scrollTop+=c),l&&(t.scrollLeft+=l);let i=t.scrollLeft-n,r=t.scrollTop-o;e={left:e.left-i,top:e.top-r,right:e.right-i,bottom:e.bottom-r}}if(n||/^(fixed|sticky)$/.test(getComputedStyle(s).position))break}}function H(t){let e=[],n=t.ownerDocument;for(let o=t;o&&(e.push({dom:o,top:o.scrollTop,left:o.scrollLeft}),t!=n);o=a(o));return e}function j(t,e){for(let n=0;n=d){l=Math.max(p.bottom,l),d=Math.min(p.top,d);let t=p.left>e.left?p.left-e.left:p.right=(p.left+p.right)/2?1:0));continue}}else p.top>e.top&&!i&&p.left<=e.left&&p.right>=e.left&&(i=u,r={left:Math.max(p.left,Math.min(p.right,e.left)),top:p.top});!n&&(e.left>=p.right&&e.top>=p.top||e.left>=p.left&&e.top>=p.bottom)&&(a=h+1)}}return!n&&i&&(n=i,o=r,s=0),n&&3==n.nodeType?function(t,e){let n=t.nodeValue.length,o=document.createRange();for(let i=0;i=(n.left+n.right)/2?1:0)}}return{node:t,offset:0}}(n,o):!n||s&&1==n.nodeType?{node:t,offset:a}:G(n,o)}function V(t,e){return t.left>=e.left-1&&t.left<=e.right+1&&t.top>=e.top-1&&t.top<=e.bottom+1}function W(t,e,n){let o=t.childNodes.length;if(o&&n.tope.top&&i++}let o;$&&i&&1==n.nodeType&&1==(o=n.childNodes[i-1]).nodeType&&"false"==o.contentEditable&&o.getBoundingClientRect().top>=e.top&&i--,n==t.dom&&i==n.childNodes.length-1&&1==n.lastChild.nodeType&&e.top>n.lastChild.getBoundingClientRect().bottom?s=t.state.doc.content.size:0!=i&&1==n.nodeType&&"BR"==n.childNodes[i-1].nodeName||(s=function(t,e,n,o){let i=-1;for(let n=e,r=!1;n!=t.dom;){let e=t.docView.nearestDesc(n,!0);if(!e)return null;if(1==e.dom.nodeType&&(e.node.isBlock&&e.parent||!e.contentDOM)){let t=e.dom.getBoundingClientRect();if(e.node.isBlock&&e.parent&&(!r&&t.left>o.left||t.top>o.top?i=e.posBefore:(!r&&t.right-1?i:t.docView.posFromDOM(e,n,-1)}(t,n,i,e))}null==s&&(s=function(t,e,n){let{node:o,offset:i}=G(e,n),r=-1;if(1==o.nodeType&&!o.firstChild){let t=o.getBoundingClientRect();r=t.left!=t.right&&n.left>(t.left+t.right)/2?1:-1}return t.docView.posFromDOM(o,i,r)}(t,l,e));let c=t.docView.nearestDesc(l,!0);return{pos:s,inside:c?c.posAtStart-c.border:-1}}function U(t){return t.top=0&&i==o.nodeValue.length?(t--,r=1):n<0?t--:e++,q(K(c(o,t,e),r),r<0)}{let t=K(c(o,i,i),n);if(M&&i&&/\s/.test(o.nodeValue[i-1])&&i=0)}if(null==r&&i&&(n<0||i==p(o))){let t=o.childNodes[i-1],e=3==t.nodeType?c(t,p(t)-(s?0:1)):1!=t.nodeType||"BR"==t.nodeName&&t.nextSibling?null:t;if(e)return q(K(e,1),!1)}if(null==r&&i=0)}function q(t,e){if(0==t.width)return t;let n=e?t.left:t.right;return{top:t.top,bottom:t.bottom,left:n,right:n}}function Q(t,e){if(0==t.height)return t;let n=e?t.top:t.bottom;return{top:n,bottom:n,left:t.left,right:t.right}}function Z(t,e,n){let o=t.state,i=t.root.activeElement;o!=e&&t.updateState(e),i!=t.dom&&t.focus();try{return n()}finally{o!=e&&t.updateState(o),i!=t.dom&&i&&i.focus()}}const tt=/[\u0590-\u08ac]/;let et=null,nt=null,ot=!1;class it{constructor(t,e,n,o){this.parent=t,this.children=e,this.dom=n,this.contentDOM=o,this.dirty=0,n.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,n){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;es(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))o=2&t.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==e)for(let e=t;;e=e.parentNode){if(e==this.dom){o=!1;break}if(e.previousSibling)break}if(null==o&&e==t.childNodes.length)for(let e=t;;e=e.parentNode){if(e==this.dom){o=!0;break}if(e.nextSibling)break}}return(null==o?n>0:o)?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let n=!0,o=t;o;o=o.parentNode){let i,r=this.getDesc(o);if(r&&(!e||r.node)){if(!n||!(i=r.nodeDOM)||(1==i.nodeType?i.contains(1==t.nodeType?t:t.parentNode):i==t))return r;n=!1}}}getDesc(t){let e=t.pmViewDesc;for(let t=e;t;t=t.parent)if(t==this)return e}posFromDOM(t,e,n){for(let o=t;o;o=o.parentNode){let i=this.getDesc(o);if(i)return i.localPosFromDOM(t,e,n)}return-1}descAt(t){for(let e=0,n=0;et||i instanceof ut){o=t-e;break}e=r}if(o)return this.children[n].domFromPos(o-this.children[n].border,e);for(let t;n&&!(t=this.children[n-1]).size&&t instanceof rt&&t.side>=0;n--);if(e<=0){let t,o=!0;for(;t=n?this.children[n-1]:null,t&&t.dom.parentNode!=this.contentDOM;n--,o=!1);return t&&e&&o&&!t.border&&!t.domAtom?t.domFromPos(t.size,e):{node:this.contentDOM,offset:t?s(t.dom)+1:0}}{let t,o=!0;for(;t=n=i&&e<=l-n.border&&n.node&&n.contentDOM&&this.contentDOM.contains(n.contentDOM))return n.parseRange(t,e,i);t=r;for(let e=a;e>0;e--){let n=this.children[e-1];if(n.size&&n.dom.parentNode==this.contentDOM&&!n.emptyChildAt(1)){o=s(n.dom)+1;break}t-=n.size}-1==o&&(o=0)}if(o>-1&&(l>e||a==this.children.length-1)){e=l;for(let t=a+1;ta&&re){let t=a;a=l,l=t}let n=document.createRange();n.setEnd(l.node,l.offset),n.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(n)}}ignoreMutation(t){return!this.contentDOM&&"selection"!=t.type}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let n=0,o=0;o=n:tn){let o=n+i.border,s=r-i.border;if(t>=o&&e<=s)return this.dirty=t==n||e==r?2:1,void(t!=o||e!=s||!i.contentLost&&i.dom.parentNode==this.contentDOM?i.markDirty(t-o,e-o):i.dirty=3);i.dirty=i.dom!=i.contentDOM||i.dom.parentNode!=this.contentDOM||i.children.length?3:2}n=r}this.dirty=2}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let n=1==t?2:1;e.dirtyi?i.parent?i.parent.posBeforeChild(i):void 0:o))),!e.type.spec.raw){if(1!=r.nodeType){let t=document.createElement("span");t.appendChild(r),r=t}r.contentEditable="false",r.classList.add("ProseMirror-widget")}super(t,[],r,null),this.widget=e,this.widget=e,i=this}matchesWidget(t){return 0==this.dirty&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return!!e&&e(t)}ignoreMutation(t){return"selection"!=t.type||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}}class st extends it{constructor(t,e,n,o){super(t,[],e,null),this.textDOM=n,this.text=o}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return"characterData"===t.type&&t.target.nodeValue==t.oldValue}}class at extends it{constructor(t,e,n,o){super(t,[],n,o),this.mark=e}static create(t,e,n,o){let r=o.nodeViews[e.type.name],s=r&&r(e,o,n);return s&&s.dom||(s=i.ZF.renderSpec(document,e.type.spec.toDOM(e,n),null,e.attrs)),new at(t,e,s.dom,s.contentDOM||s.dom)}parseRule(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}matchesMark(t){return 3!=this.dirty&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),0!=this.dirty){let t=this.parent;for(;!t.node;)t=t.parent;t.dirty0&&(i=St(i,0,t,n));for(let t=0;ta?a.parent?a.parent.posBeforeChild(a):void 0:s),n,o),d=c&&c.dom,u=c&&c.contentDOM;if(e.isText)if(d){if(3!=d.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else d=document.createTextNode(e.text);else if(!d){let t=i.ZF.renderSpec(document,e.type.spec.toDOM(e),null,e.attrs);({dom:d,contentDOM:u}=t)}u||e.isText||"BR"==d.nodeName||(d.hasAttribute("contenteditable")||(d.contentEditable="false"),e.type.spec.draggable&&(d.draggable=!0));let h=d;return d=kt(d,n,e),c?a=new ht(t,e,n,o,d,u||null,h,c,r,s+1):e.isText?new dt(t,e,n,o,d,h,r):new lt(t,e,n,o,d,u||null,h,r,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if("pre"==this.node.type.whitespace&&(t.preserveWhitespace="full"),this.contentDOM)if(this.contentLost){for(let e=this.children.length-1;e>=0;e--){let n=this.children[e];if(this.dom.contains(n.dom.parentNode)){t.contentElement=n.dom.parentNode;break}}t.contentElement||(t.getContent=()=>i.FK.empty)}else t.contentElement=this.contentDOM;else t.getContent=()=>this.node.content;return t}matchesNode(t,e,n){return 0==this.dirty&&t.eq(this.node)&&vt(e,this.outerDeco)&&n.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let n=this.node.inlineContent,o=e,r=t.composing?this.localCompositionInfo(t,e):null,s=r&&r.pos>-1?r:null,a=r&&r.pos<0,l=new Ct(this,s&&s.node,t);!function(t,e,n,o){let i=e.locals(t),r=0;if(0==i.length){for(let n=0;nr;)a.push(i[s++]);let f=r+h.nodeSize;if(h.isText){let t=f;s!t.inline)):a.slice(),e.forChild(r,h),p),r=f}}(this.node,this.innerDeco,((e,r,s)=>{e.spec.marks?l.syncToMarks(e.spec.marks,n,t):e.type.side>=0&&!s&&l.syncToMarks(r==this.node.childCount?i.CU.none:this.node.child(r).marks,n,t),l.placeWidget(e,t,o)}),((e,i,s,c)=>{let d;l.syncToMarks(e.marks,n,t),l.findNodeMatch(e,i,s,c)||a&&t.state.selection.from>o&&t.state.selection.to-1&&l.updateNodeAt(e,i,s,d,t)||l.updateNextNode(e,i,s,t,c,o)||l.addNode(e,i,s,t,o),o+=e.nodeSize})),l.syncToMarks([],n,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(s&&this.protectLocalComposition(t,s),pt(this.contentDOM,this.children,t),I&&function(t){if("UL"==t.nodeName||"OL"==t.nodeName){let e=t.style.cssText;t.style.cssText=e+"; list-style: square !important",window.getComputedStyle(t).listStyle,t.style.cssText=e}}(this.dom))}localCompositionInfo(t,e){let{from:n,to:i}=t.state.selection;if(!(t.state.selection instanceof o.U3)||ne+this.node.content.size)return null;let r=t.input.compositionNode;if(!r||!this.dom.contains(r.parentNode))return null;if(this.node.inlineContent){let t=r.nodeValue,o=function(t,e,n,o){for(let i=0,r=0;i=n){if(r>=o&&l.slice(o-e.length-a,o-a)==e)return o-e.length;let t=a=0&&t+e.length+a>=n)return a+t;if(n==o&&l.length>=o+e.length-a&&l.slice(o-a,o-a+e.length)==e)return o}}return-1}(this.node.content,t,n-e,i-e);return o<0?null:{node:r,pos:o,text:t}}return{node:r,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:n,text:o}){if(this.getDesc(e))return;let i=e;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 r=new st(this,i,e,o);t.input.compositionNodes.push(r),this.children=St(this.children,n,n+o.length,t,r)}update(t,e,n,o){return!(3==this.dirty||!t.sameMarkup(this.node)||(this.updateInner(t,e,n,o),0))}updateInner(t,e,n,o){this.updateOuterDeco(e),this.node=t,this.innerDeco=n,this.contentDOM&&this.updateChildren(o,this.posAtStart),this.dirty=0}updateOuterDeco(t){if(vt(t,this.outerDeco))return;let e=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=bt(this.dom,this.nodeDOM,gt(this.outerDeco,this.node,e),gt(t,this.node,e)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){1==this.nodeDOM.nodeType&&this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.dom.draggable=!0)}deselectNode(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.dom.removeAttribute("draggable"))}get domAtom(){return this.node.isAtom}}function ct(t,e,n,o,i){kt(o,e,t);let r=new lt(void 0,t,e,n,o,o,o,i,0);return r.contentDOM&&r.updateChildren(i,0),r}class dt extends lt{constructor(t,e,n,o,i,r,s){super(t,e,n,o,i,null,r,s,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,n,o){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!t.sameMarkup(this.node)||(this.updateOuterDeco(e),0==this.dirty&&t.text==this.node.text||t.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=t.text,o.trackWrites==this.nodeDOM&&(o.trackWrites=null)),this.node=t,this.dirty=0,0))}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,n){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,n)}ignoreMutation(t){return"characterData"!=t.type&&"selection"!=t.type}slice(t,e,n){let o=this.node.cut(t,e),i=document.createTextNode(o.text);return new dt(this.parent,o,this.outerDeco,this.innerDeco,i,i,n)}markDirty(t,e){super.markDirty(t,e),this.dom==this.nodeDOM||0!=t&&e!=this.nodeDOM.nodeValue.length||(this.dirty=3)}get domAtom(){return!1}isText(t){return this.node.text==t}}class ut extends it{parseRule(){return{ignore:!0}}matchesHack(t){return 0==this.dirty&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return"IMG"==this.dom.nodeName}}class ht extends lt{constructor(t,e,n,o,i,r,s,a,l,c){super(t,e,n,o,i,r,s,l,c),this.spec=a}update(t,e,n,o){if(3==this.dirty)return!1;if(this.spec.update){let i=this.spec.update(t,e,n);return i&&this.updateInner(t,e,n,o),i}return!(!this.contentDOM&&!t.isLeaf)&&super.update(t,e,n,o)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,n,o){this.spec.setSelection?this.spec.setSelection(t,e,n):super.setSelection(t,e,n,o)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return!!this.spec.stopEvent&&this.spec.stopEvent(t)}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}}function pt(t,e,n){let o=t.firstChild,i=!1;for(let r=0;r0;){let a;for(;;)if(o){let t=n.children[o-1];if(!(t instanceof at)){a=t,o--;break}n=t,o=t.children.length}else{if(n==e)break t;o=n.parent.children.indexOf(n),n=n.parent}let l=a.node;if(l){if(l!=t.child(i-1))break;--i,r.set(a,i),s.push(a)}}return{index:i,matched:r,matches:s.reverse()}}(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let n=t;n>1,r=Math.min(i,t.length);for(;o-1)o>this.index&&(this.changed=!0,this.destroyBetween(this.index,o)),this.top=this.top.children[this.index];else{let o=at.create(this.top,t[i],e,n);this.top.children.splice(this.index,0,o),this.top=o,this.changed=!0}this.index=0,i++}}findNodeMatch(t,e,n,o){let i,r=-1;if(o>=this.preMatch.index&&(i=this.preMatch.matches[o-this.preMatch.index]).parent==this.top&&i.matchesNode(t,e,n))r=this.top.children.indexOf(i,this.index);else for(let o=this.index,i=Math.min(this.top.children.length,o+5);o=n||d<=e?r.push(l):(cn&&r.push(l.slice(n-c,l.size,o)))}return r}function Mt(t,e=null){let n=t.domSelectionRange(),i=t.state.doc;if(!n.focusNode)return null;let r=t.docView.nearestDesc(n.focusNode),a=r&&0==r.size,l=t.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(l<0)return null;let c,d,u=i.resolve(l);if(m(n)){for(c=l;r&&!r.node;)r=r.parent;let t=r.node;if(r&&t.isAtom&&o.nh.isSelectable(t)&&r.parent&&(!t.isInline||!function(t,e,n){for(let o=0==e,i=e==p(t);o||i;){if(t==n)return!0;let e=s(t);if(!(t=t.parentNode))return!1;o=o&&0==e,i=i&&e==p(t)}}(n.focusNode,n.focusOffset,r.dom))){let t=r.posBefore;d=new o.nh(l==t?u:i.resolve(t))}}else{if(n instanceof t.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let e=l,o=l;for(let i=0;i{n.anchorNode==o&&n.anchorOffset==i||(e.removeEventListener("selectionchange",t.input.hideSelectionGuard),setTimeout((()=>{Tt(t)&&!t.state.selection.visible||t.dom.classList.remove("ProseMirror-hideselection")}),20))})}(t))}t.domObserver.setCurSelection(),t.domObserver.connectSelection()}}const Et=A||O&&E<63;function At(t,e){let{node:n,offset:o}=t.docView.domFromPos(e,0),i=oo(t,e,n)))||o.U3.between(e,n,i)}function Lt(t){return!(t.editable&&!t.hasFocus())&&zt(t)}function zt(t){let e=t.domSelectionRange();if(!e.anchorNode)return!1;try{return t.dom.contains(3==e.anchorNode.nodeType?e.anchorNode.parentNode:e.anchorNode)&&(t.editable||t.dom.contains(3==e.focusNode.nodeType?e.focusNode.parentNode:e.focusNode))}catch(t){return!1}}function Pt(t,e){let{$anchor:n,$head:i}=t.selection,r=e>0?n.max(i):n.min(i),s=r.parent.inlineContent?r.depth?t.doc.resolve(e>0?r.after():r.before()):null:r;return s&&o.LN.findFrom(s,e)}function Bt(t,e){return t.dispatch(t.state.tr.setSelection(e).scrollIntoView()),!0}function _t(t,e,n){let i=t.state.selection;if(!(i instanceof o.U3)){if(i instanceof o.nh&&i.node.isInline)return Bt(t,new o.U3(e>0?i.$to:i.$from));{let n=Pt(t.state,e);return!!n&&Bt(t,n)}}if(n.indexOf("s")>-1){let{$head:n}=i,r=n.textOffset?null:e<0?n.nodeBefore:n.nodeAfter;if(!r||r.isText||!r.isLeaf)return!1;let s=t.state.doc.resolve(n.pos+r.nodeSize*(e<0?-1:1));return Bt(t,new o.U3(i.$anchor,s))}if(!i.empty)return!1;if(t.endOfTextblock(e>0?"forward":"backward")){let n=Pt(t.state,e);return!!(n&&n instanceof o.nh)&&Bt(t,n)}if(!(N&&n.indexOf("m")>-1)){let n,r=i.$head,s=r.textOffset?null:e<0?r.nodeBefore:r.nodeAfter;if(!s||s.isText)return!1;let a=e<0?r.pos-s.nodeSize:r.pos;return!!(s.isAtom||(n=t.docView.descAt(a))&&!n.contentDOM)&&(o.nh.isSelectable(s)?Bt(t,new o.nh(e<0?t.state.doc.resolve(r.pos-s.nodeSize):r)):!!$&&Bt(t,new o.U3(t.state.doc.resolve(e<0?a:a+s.nodeSize))))}}function Ht(t){return 3==t.nodeType?t.nodeValue.length:t.childNodes.length}function jt(t,e){let n=t.pmViewDesc;return n&&0==n.size&&(e<0||t.nextSibling||"BR"!=t.nodeName)}function Ft(t,e){return e<0?function(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let i,r,a=!1;for(M&&1==n.nodeType&&o0){if(1!=n.nodeType)break;{let t=n.childNodes[o-1];if(jt(t,-1))i=n,r=--o;else{if(3!=t.nodeType)break;n=t,o=n.nodeValue.length}}}else{if(Gt(n))break;{let e=n.previousSibling;for(;e&&jt(e,-1);)i=n.parentNode,r=s(e),e=e.previousSibling;if(e)n=e,o=Ht(n);else{if(n=n.parentNode,n==t.dom)break;o=0}}}a?Vt(t,n,o):i&&Vt(t,i,r)}(t):function(t){let e=t.domSelectionRange(),n=e.focusNode,o=e.focusOffset;if(!n)return;let i,r,a=Ht(n);for(;;)if(o{t.state==i&&Ot(t)}),50)}function Wt(t,e){let n=t.state.doc.resolve(e);if(!O&&!D&&n.parent.inlineContent){let o=t.coordsAtPos(e);if(e>n.start()){let n=t.coordsAtPos(e-1),i=(n.top+n.bottom)/2;if(i>o.top&&i1)return n.lefto.top&&i1)return n.left>o.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(t.dom).direction?"rtl":"ltr"}function Xt(t,e,n){let i=t.state.selection;if(i instanceof o.U3&&!i.empty||n.indexOf("s")>-1)return!1;if(N&&n.indexOf("m")>-1)return!1;let{$from:r,$to:s}=i;if(!r.parent.inlineContent||t.endOfTextblock(e<0?"up":"down")){let n=Pt(t.state,e);if(n&&n instanceof o.nh)return Bt(t,n)}if(!r.parent.inlineContent){let n=e<0?r:s,a=i instanceof o.i5?o.LN.near(n,e):o.LN.findFrom(n,e);return!!a&&Bt(t,a)}return!1}function Ut(t,e){if(!(t.state.selection instanceof o.U3))return!0;let{$head:n,$anchor:i,empty:r}=t.state.selection;if(!n.sameParent(i))return!0;if(!r)return!1;if(t.endOfTextblock(e>0?"forward":"backward"))return!0;let s=!n.textOffset&&(e<0?n.nodeBefore:n.nodeAfter);if(s&&!s.isText){let o=t.state.tr;return e<0?o.delete(n.pos-s.nodeSize,n.pos):o.delete(n.pos,n.pos+s.nodeSize),t.dispatch(o),!0}return!1}function Kt(t,e,n){t.domObserver.stop(),e.contentEditable=n,t.domObserver.start()}function Jt(t,e){t.someProp("transformCopied",(n=>{e=n(e,t)}));let n=[],{content:o,openStart:r,openEnd:s}=e;for(;r>1&&s>1&&1==o.childCount&&1==o.firstChild.childCount;){r--,s--;let t=o.firstChild;n.push(t.type.name,t.attrs!=t.type.defaultAttrs?t.attrs:null),o=t.content}let a=t.someProp("clipboardSerializer")||i.ZF.fromSchema(t.state.schema),l=re(),c=l.createElement("div");c.appendChild(a.serializeFragment(o,{document:l}));let d,u=c.firstChild,h=0;for(;u&&1==u.nodeType&&(d=oe[u.nodeName.toLowerCase()]);){for(let t=d.length-1;t>=0;t--){let e=l.createElement(d[t]);for(;c.firstChild;)e.appendChild(c.firstChild);c.appendChild(e),h++}u=c.firstChild}return u&&1==u.nodeType&&u.setAttribute("data-pm-slice",`${r} ${s}${h?` -${h}`:""} ${JSON.stringify(n)}`),{dom:c,text:t.someProp("clipboardTextSerializer",(n=>n(e,t)))||e.content.textBetween(0,e.content.size,"\n\n"),slice:e}}function Yt(t,e,n,o,r){let s,a,l=r.parent.type.spec.code;if(!n&&!e)return null;let c=e&&(o||l||!n);if(c){if(t.someProp("transformPastedText",(n=>{e=n(e,l||o,t)})),l)return e?new i.Ji(i.FK.from(t.state.schema.text(e.replace(/\r\n?/g,"\n"))),0,0):i.Ji.empty;let n=t.someProp("clipboardTextParser",(n=>n(e,r,o,t)));if(n)a=n;else{let n=r.marks(),{schema:o}=t.state,a=i.ZF.fromSchema(o);s=document.createElement("div"),e.split(/(?:\r\n?|\n)+/).forEach((t=>{let e=s.appendChild(document.createElement("p"));t&&e.appendChild(a.serializeNode(o.text(t,n)))}))}}else t.someProp("transformPastedHTML",(e=>{n=e(n,t)})),s=function(t){let e=/^(\s*]*>)*/.exec(t);e&&(t=t.slice(e[0].length));let n,o=re().createElement("div"),i=/<([a-z][^>\s]+)/i.exec(t);if((n=i&&oe[i[1].toLowerCase()])&&(t=n.map((t=>"<"+t+">")).join("")+t+n.map((t=>"")).reverse().join("")),o.innerHTML=function(t){let e=window.trustedTypes;return e?e.createPolicy("detachedDocument",{createHTML:t=>t}).createHTML(t):t}(t),n)for(let t=0;t0;t--){let t=s.firstChild;for(;t&&1!=t.nodeType;)t=t.nextSibling;if(!t)break;s=t}if(!a){let e=t.someProp("clipboardParser")||t.someProp("domParser")||i.S4.fromSchema(t.state.schema);a=e.parseSlice(s,{preserveWhitespace:!(!c&&!u),context:r,ruleFromNode:t=>"BR"!=t.nodeName||t.nextSibling||!t.parentNode||qt.test(t.parentNode.nodeName)?null:{ignore:!0}})}if(u)a=function(t,e){if(!t.size)return t;let n,o=t.content.firstChild.type.schema;try{n=JSON.parse(e)}catch(e){return t}let{content:r,openStart:s,openEnd:a}=t;for(let t=n.length-2;t>=0;t-=2){let e=o.nodes[n[t]];if(!e||e.hasRequiredAttrs())break;r=i.FK.from(e.create(n[t+1],r)),s++,a++}return new i.Ji(r,s,a)}(ne(a,+u[1],+u[2]),u[4]);else if(a=i.Ji.maxOpen(function(t,e){if(t.childCount<2)return t;for(let n=e.depth;n>=0;n--){let o,r=e.node(n).contentMatchAt(e.index(n)),s=[];if(t.forEach((t=>{if(!s)return;let e,n=r.findWrapping(t.type);if(!n)return s=null;if(e=s.length&&o.length&&Zt(n,o,t,s[s.length-1],0))s[s.length-1]=e;else{s.length&&(s[s.length-1]=te(s[s.length-1],o.length));let e=Qt(t,n);s.push(e),r=r.matchType(e.type),o=n}})),s)return i.FK.from(s)}return t}(a.content,r),!0),a.openStart||a.openEnd){let t=0,e=0;for(let e=a.content.firstChild;t{a=e(a,t)})),a}const qt=/^(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 Qt(t,e,n=0){for(let o=e.length-1;o>=n;o--)t=e[o].create(null,i.FK.from(t));return t}function Zt(t,e,n,o,r){if(r1&&(s=0),r=n&&(l=e<0?a.contentMatchAt(0).fillBefore(l,s<=r).append(l):l.append(a.contentMatchAt(a.childCount).fillBefore(i.FK.empty,!0))),t.replaceChild(e<0?0:t.childCount-1,a.copy(l))}function ne(t,e,n){return e{for(let n in e)t.input.eventHandlers[n]||t.dom.addEventListener(n,t.input.eventHandlers[n]=e=>he(t,e))}))}function he(t,e){return t.someProp("handleDOMEvents",(n=>{let o=n[e.type];return!!o&&(o(t,e)||e.defaultPrevented)}))}function pe(t,e){if(!e.bubbles)return!0;if(e.defaultPrevented)return!1;for(let n=e.target;n!=t.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(e))return!1;return!0}function fe(t){return{left:t.clientX,top:t.clientY}}function me(t,e,n,o,i){if(-1==o)return!1;let r=t.state.doc.resolve(o);for(let o=r.depth+1;o>0;o--)if(t.someProp(e,(e=>o>r.depth?e(t,n,r.nodeAfter,r.before(o),i,!0):e(t,n,r.node(o),r.before(o),i,!1))))return!0;return!1}function ge(t,e,n){if(t.focused||t.focus(),t.state.selection.eq(e))return;let o=t.state.tr.setSelection(e);"pointer"==n&&o.setMeta("pointer",!0),t.dispatch(o)}function be(t,e,n,o){return me(t,"handleDoubleClickOn",e,n,o)||t.someProp("handleDoubleClick",(n=>n(t,e,o)))}function ye(t,e,n,i){return me(t,"handleTripleClickOn",e,n,i)||t.someProp("handleTripleClick",(n=>n(t,e,i)))||function(t,e,n){if(0!=n.button)return!1;let i=t.state.doc;if(-1==e)return!!i.inlineContent&&(ge(t,o.U3.create(i,0,i.content.size),"pointer"),!0);let r=i.resolve(e);for(let e=r.depth+1;e>0;e--){let n=e>r.depth?r.nodeAfter:r.node(e),s=r.before(e);if(n.inlineContent)ge(t,o.U3.create(i,s+1,s+1+n.content.size),"pointer");else{if(!o.nh.isSelectable(n))continue;ge(t,o.nh.create(i,s),"pointer")}return!0}}(t,n,i)}function ke(t){return Te(t)}ae.keydown=(t,e)=>{let n=e;if(t.input.shiftKey=16==n.keyCode||n.shiftKey,!Ce(t,n)&&(t.input.lastKeyCode=n.keyCode,t.input.lastKeyCodeTime=Date.now(),!R||!O||13!=n.keyCode))if(t.domObserver.selectionChanged(t.domSelectionRange())?t.domObserver.flush():229!=n.keyCode&&t.domObserver.forceFlush(),!I||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)t.someProp("handleKeyDown",(e=>e(t,n)))||function(t,e){let n=e.keyCode,o=function(t){let e="";return t.ctrlKey&&(e+="c"),t.metaKey&&(e+="m"),t.altKey&&(e+="a"),t.shiftKey&&(e+="s"),e}(e);if(8==n||N&&72==n&&"c"==o)return Ut(t,-1)||Ft(t,-1);if(46==n&&!e.shiftKey||N&&68==n&&"c"==o)return Ut(t,1)||Ft(t,1);if(13==n||27==n)return!0;if(37==n||N&&66==n&&"c"==o){let e=37==n?"ltr"==Wt(t,t.state.selection.from)?-1:1:-1;return _t(t,e,o)||Ft(t,e)}if(39==n||N&&70==n&&"c"==o){let e=39==n?"ltr"==Wt(t,t.state.selection.from)?1:-1:1;return _t(t,e,o)||Ft(t,e)}return 38==n||N&&80==n&&"c"==o?Xt(t,-1,o)||Ft(t,-1):40==n||N&&78==n&&"c"==o?function(t){if(!A||t.state.selection.$head.parentOffset>0)return!1;let{focusNode:e,focusOffset:n}=t.domSelectionRange();if(e&&1==e.nodeType&&0==n&&e.firstChild&&"false"==e.firstChild.contentEditable){let n=e.firstChild;Kt(t,n,"true"),setTimeout((()=>Kt(t,n,"false")),20)}return!1}(t)||Xt(t,1,o)||Ft(t,1):o==(N?"m":"c")&&(66==n||73==n||89==n||90==n)}(t,n)?n.preventDefault():de(t,"key");else{let e=Date.now();t.input.lastIOSEnter=e,t.input.lastIOSEnterFallbackTimeout=setTimeout((()=>{t.input.lastIOSEnter==e&&(t.someProp("handleKeyDown",(e=>e(t,g(13,"Enter")))),t.input.lastIOSEnter=0)}),200)}},ae.keyup=(t,e)=>{16==e.keyCode&&(t.input.shiftKey=!1)},ae.keypress=(t,e)=>{let n=e;if(Ce(t,n)||!n.charCode||n.ctrlKey&&!n.altKey||N&&n.metaKey)return;if(t.someProp("handleKeyPress",(e=>e(t,n))))return void n.preventDefault();let i=t.state.selection;if(!(i instanceof o.U3&&i.$from.sameParent(i.$to))){let e=String.fromCharCode(n.charCode);/[\r\n]/.test(e)||t.someProp("handleTextInput",(n=>n(t,i.$from.pos,i.$to.pos,e)))||t.dispatch(t.state.tr.insertText(e).scrollIntoView()),n.preventDefault()}};const ve=N?"metaKey":"ctrlKey";se.mousedown=(t,e)=>{let n=e;t.input.shiftKey=n.shiftKey;let o=ke(t),i=Date.now(),r="singleClick";i-t.input.lastClick.time<500&&function(t,e){let n=e.x-t.clientX,o=e.y-t.clientY;return n*n+o*o<100}(n,t.input.lastClick)&&!n[ve]&&("singleClick"==t.input.lastClick.type?r="doubleClick":"doubleClick"==t.input.lastClick.type&&(r="tripleClick")),t.input.lastClick={time:i,x:n.clientX,y:n.clientY,type:r};let s=t.posAtCoords(fe(n));s&&("singleClick"==r?(t.input.mouseDown&&t.input.mouseDown.done(),t.input.mouseDown=new we(t,s,n,!!o)):("doubleClick"==r?be:ye)(t,s.pos,s.inside,n)?n.preventDefault():de(t,"pointer"))};class we{constructor(t,e,n,i){let r,s;if(this.view=t,this.pos=e,this.event=n,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!n[ve],this.allowDefault=n.shiftKey,e.inside>-1)r=t.state.doc.nodeAt(e.inside),s=e.inside;else{let n=t.state.doc.resolve(e.pos);r=n.parent,s=n.depth?n.before():0}const a=i?null:n.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l&&1==l.dom.nodeType?l.dom:null;let{selection:c}=t.state;(0==n.button&&r.type.spec.draggable&&!1!==r.type.spec.selectable||c instanceof o.nh&&c.from<=s&&c.to>s)&&(this.mightDrag={node:r,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!M||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()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),de(t,"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((()=>Ot(this.view))),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(fe(t))),this.updateAllowDefault(t),this.allowDefault||!e?de(this.view,"pointer"):function(t,e,n,i,r){return me(t,"handleClickOn",e,n,i)||t.someProp("handleClick",(n=>n(t,e,i)))||(r?function(t,e){if(-1==e)return!1;let n,i,r=t.state.selection;r instanceof o.nh&&(n=r.node);let s=t.state.doc.resolve(e);for(let t=s.depth+1;t>0;t--){let e=t>s.depth?s.nodeAfter:s.node(t);if(o.nh.isSelectable(e)){i=n&&r.$from.depth>0&&t>=r.$from.depth&&s.before(r.$from.depth+1)==r.$from.pos?s.before(r.$from.depth):s.before(t);break}}return null!=i&&(ge(t,o.nh.create(t.state.doc,i),"pointer"),!0)}(t,n):function(t,e){if(-1==e)return!1;let n=t.state.doc.resolve(e),i=n.nodeAfter;return!!(i&&i.isAtom&&o.nh.isSelectable(i))&&(ge(t,new o.nh(n),"pointer"),!0)}(t,n))}(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():0==t.button&&(this.flushed||A&&this.mightDrag&&!this.mightDrag.node.isAtom||O&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(ge(this.view,o.LN.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):de(this.view,"pointer")}move(t){this.updateAllowDefault(t),de(this.view,"pointer"),0==t.buttons&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}}function Ce(t,e){return!!t.composing||!!(A&&Math.abs(e.timeStamp-t.input.compositionEndedAt)<500)&&(t.input.compositionEndedAt=-2e8,!0)}se.touchstart=t=>{t.input.lastTouch=Date.now(),ke(t),de(t,"pointer")},se.touchmove=t=>{t.input.lastTouch=Date.now(),de(t,"pointer")},se.contextmenu=t=>ke(t);const xe=R?5e3:-1;function Se(t,e){clearTimeout(t.input.composingTimeout),e>-1&&(t.input.composingTimeout=setTimeout((()=>Te(t)),e))}function Me(t){for(t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=function(){let t=document.createEvent("Event");return t.initEvent("event",!0,!0),t.timeStamp}());t.input.compositionNodes.length>0;)t.input.compositionNodes.pop().markParentsDirty()}function Te(t,e=!1){if(!(R&&t.domObserver.flushingSoon>=0)){if(t.domObserver.forceFlush(),Me(t),e||t.docView&&t.docView.dirty){let n=Mt(t);return n&&!n.eq(t.state.selection)?t.dispatch(t.state.tr.setSelection(n)):!t.markCursor&&!e||t.state.selection.empty?t.updateState(t.state):t.dispatch(t.state.tr.deleteSelection()),!0}return!1}}ae.compositionstart=ae.compositionupdate=t=>{if(!t.composing){t.domObserver.flush();let{state:e}=t,n=e.selection.$to;if(e.selection instanceof o.U3&&(e.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some((t=>!1===t.type.spec.inclusive))))t.markCursor=t.state.storedMarks||n.marks(),Te(t,!0),t.markCursor=null;else if(Te(t,!e.selection.empty),M&&e.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let e=t.domSelectionRange();for(let n=e.focusNode,o=e.focusOffset;n&&1==n.nodeType&&0!=o;){let e=o<0?n.lastChild:n.childNodes[o-1];if(!e)break;if(3==e.nodeType){let n=t.domSelection();n&&n.collapse(e,e.nodeValue.length);break}n=e,o=-1}}t.input.composing=!0}Se(t,xe)},ae.compositionend=(t,e)=>{t.composing&&(t.input.composing=!1,t.input.compositionEndedAt=e.timeStamp,t.input.compositionPendingChanges=t.domObserver.pendingRecords().length?t.input.compositionID:0,t.input.compositionNode=null,t.input.compositionPendingChanges&&Promise.resolve().then((()=>t.domObserver.flush())),t.input.compositionID++,Se(t,20))};const Oe=x&&S<15||I&&L<604;function Ee(t,e,n,o,r){let s=Yt(t,e,n,o,t.state.selection.$from);if(t.someProp("handlePaste",(e=>e(t,r,s||i.Ji.empty))))return!0;if(!s)return!1;let a=function(t){return 0==t.openStart&&0==t.openEnd&&1==t.content.childCount?t.content.firstChild:null}(s),l=a?t.state.tr.replaceSelectionWith(a,o):t.state.tr.replaceSelection(s);return t.dispatch(l.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Ae(t){let e=t.getData("text/plain")||t.getData("Text");if(e)return e;let n=t.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}se.copy=ae.cut=(t,e)=>{let n=e,o=t.state.selection,i="cut"==n.type;if(o.empty)return;let r=Oe?null:n.clipboardData,s=o.content(),{dom:a,text:l}=Jt(t,s);r?(n.preventDefault(),r.clearData(),r.setData("text/html",a.innerHTML),r.setData("text/plain",l)):function(t,e){if(!t.dom.parentNode)return;let n=t.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(e),n.style.cssText="position: fixed; left: -10000px; top: 10px";let o=getSelection(),i=document.createRange();i.selectNodeContents(e),t.dom.blur(),o.removeAllRanges(),o.addRange(i),setTimeout((()=>{n.parentNode&&n.parentNode.removeChild(n),t.focus()}),50)}(t,a),i&&t.dispatch(t.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},ae.paste=(t,e)=>{let n=e;if(t.composing&&!R)return;let o=Oe?null:n.clipboardData,i=t.input.shiftKey&&45!=t.input.lastKeyCode;o&&Ee(t,Ae(o),o.getData("text/html"),i,n)?n.preventDefault():function(t,e){if(!t.dom.parentNode)return;let n=t.input.shiftKey||t.state.selection.$from.parent.type.spec.code,o=t.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(o.contentEditable="true"),o.style.cssText="position: fixed; left: -10000px; top: 10px",o.focus();let i=t.input.shiftKey&&45!=t.input.lastKeyCode;setTimeout((()=>{t.focus(),o.parentNode&&o.parentNode.removeChild(o),n?Ee(t,o.value,null,i,e):Ee(t,o.textContent,o.innerHTML,i,e)}),50)}(t,n)};class Ie{constructor(t,e,n){this.slice=t,this.move=e,this.node=n}}const Ne=N?"altKey":"ctrlKey";se.dragstart=(t,e)=>{let n=e,i=t.input.mouseDown;if(i&&i.done(),!n.dataTransfer)return;let r,s=t.state.selection,a=s.empty?null:t.posAtCoords(fe(n));if(a&&a.pos>=s.from&&a.pos<=(s instanceof o.nh?s.to-1:s.to));else if(i&&i.mightDrag)r=o.nh.create(t.state.doc,i.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let e=t.docView.nearestDesc(n.target,!0);e&&e.node.type.spec.draggable&&e!=t.docView&&(r=o.nh.create(t.state.doc,e.posBefore))}let l=(r||t.state.selection).content(),{dom:c,text:d,slice:u}=Jt(t,l);(!n.dataTransfer.files.length||!O||E>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Oe?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",Oe||n.dataTransfer.setData("text/plain",d),t.dragging=new Ie(u,!n[Ne],r)},se.dragend=t=>{let e=t.dragging;window.setTimeout((()=>{t.dragging==e&&(t.dragging=null)}),50)},ae.dragover=ae.dragenter=(t,e)=>e.preventDefault(),ae.drop=(t,e)=>{let n=e,s=t.dragging;if(t.dragging=null,!n.dataTransfer)return;let a=t.posAtCoords(fe(n));if(!a)return;let l=t.state.doc.resolve(a.pos),c=s&&s.slice;c?t.someProp("transformPasted",(e=>{c=e(c,t)})):c=Yt(t,Ae(n.dataTransfer),Oe?null:n.dataTransfer.getData("text/html"),!1,l);let d=!(!s||n[Ne]);if(t.someProp("handleDrop",(e=>e(t,n,c||i.Ji.empty,d))))return void n.preventDefault();if(!c)return;n.preventDefault();let u=c?(0,r.Um)(t.state.doc,l.pos,c):l.pos;null==u&&(u=l.pos);let h=t.state.tr;if(d){let{node:t}=s;t?t.replace(h):h.deleteSelection()}let p=h.mapping.map(u),f=0==c.openStart&&0==c.openEnd&&1==c.content.childCount,m=h.doc;if(f?h.replaceRangeWith(p,p,c.content.firstChild):h.replaceRange(p,p,c),h.doc.eq(m))return;let g=h.doc.resolve(p);if(f&&o.nh.isSelectable(c.content.firstChild)&&g.nodeAfter&&g.nodeAfter.sameMarkup(c.content.firstChild))h.setSelection(new o.nh(g));else{let e=h.mapping.map(u);h.mapping.maps[h.mapping.maps.length-1].forEach(((t,n,o,i)=>e=i)),h.setSelection($t(t,g,h.doc.resolve(e)))}t.focus(),t.dispatch(h.setMeta("uiEvent","drop"))},se.focus=t=>{t.input.lastFocus=Date.now(),t.focused||(t.domObserver.stop(),t.dom.classList.add("ProseMirror-focused"),t.domObserver.start(),t.focused=!0,setTimeout((()=>{t.docView&&t.hasFocus()&&!t.domObserver.currentSelection.eq(t.domSelectionRange())&&Ot(t)}),20))},se.blur=(t,e)=>{let n=e;t.focused&&(t.domObserver.stop(),t.dom.classList.remove("ProseMirror-focused"),t.domObserver.start(),n.relatedTarget&&t.dom.contains(n.relatedTarget)&&t.domObserver.currentSelection.clear(),t.focused=!1)},se.beforeinput=(t,e)=>{if(O&&R&&"deleteContentBackward"==e.inputType){t.domObserver.flushSoon();let{domChangeCount:e}=t.input;setTimeout((()=>{if(t.input.domChangeCount!=e)return;if(t.dom.blur(),t.focus(),t.someProp("handleKeyDown",(e=>e(t,g(8,"Backspace")))))return;let{$cursor:n}=t.state.selection;n&&n.pos>0&&t.dispatch(t.state.tr.delete(n.pos-1,n.pos).scrollIntoView())}),50)}};for(let t in ae)se[t]=ae[t];function De(t,e){if(t==e)return!0;for(let n in t)if(t[n]!==e[n])return!1;for(let n in e)if(!(n in t))return!1;return!0}class Re{constructor(t,e){this.toDOM=t,this.spec=e||Be,this.side=this.spec.side||0}map(t,e,n,o){let{pos:i,deleted:r}=t.mapResult(e.from+o,this.side<0?-1:1);return r?null:new ze(i-n,i-n,this)}valid(){return!0}eq(t){return this==t||t instanceof Re&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&De(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}}class $e{constructor(t,e){this.attrs=t,this.spec=e||Be}map(t,e,n,o){let i=t.map(e.from+o,this.spec.inclusiveStart?-1:1)-n,r=t.map(e.to+o,this.spec.inclusiveEnd?1:-1)-n;return i>=r?null:new ze(i,r,this)}valid(t,e){return e.from=t&&(!i||i(s.spec))&&n.push(s.copy(s.from+o,s.to+o))}for(let r=0;rt){let s=this.children[r]+1;this.children[r+2].findInner(t-s,e-s,n,o+s,i)}}map(t,e,n){return this==He||0==t.maps.length?this:this.mapInner(t,e,0,0,n||Be)}mapInner(t,e,n,o,i){let r;for(let s=0;s{let s=r-i-(n-t);for(let i=0;ir+e-o)continue;let l=a[i]+e-o;n>=l?a[i+1]=t<=l?-2:-1:t>=e&&s&&(a[i]+=s,a[i+1]+=s)}o+=s})),e=n.maps[t].map(e,-1)}let l=!1;for(let e=0;e=o.content.size){l=!0;continue}let u=n.map(t[e+1]+r,-1)-i,{index:h,offset:p}=o.content.findIndex(d),f=o.maybeChild(h);if(f&&p==d&&p+f.nodeSize==u){let o=a[e+2].mapInner(n,f,c+1,t[e]+r+1,s);o!=He?(a[e]=d,a[e+1]=u,a[e+2]=o):(a[e+1]=-2,l=!0)}else l=!0}if(l){let l=function(t,e,n,o,i,r,s){function a(t,e){for(let r=0;r{let s,a=r+n;if(s=Ge(e,t,a)){for(o||(o=this.children.slice());ir&&e.to=t){this.children[e]==t&&(n=this.children[e+2]);break}let i=t+1,r=i+e.content.size;for(let t=0;ti&&e.type instanceof $e){let t=Math.max(i,e.from)-i,n=Math.min(r,e.to)-i;tn.map(t,e,Be)));return je.from(n)}forChild(t,e){if(e.isLeaf)return _e.empty;let n=[];for(let o=0;ot instanceof _e))?t:t.reduce(((t,e)=>t.concat(e instanceof _e?e:e.members)),[]))}}forEachSet(t){for(let e=0;en&&e.to{let a=Ge(t,e,s+n);if(a){r=!0;let t=We(a,e,n+s+1,o);t!=He&&i.push(s,s+e.nodeSize,t)}}));let s=Fe(r?Ve(t):t,-n).sort(Xe);for(let t=0;t0;)e++;t.splice(e,0,n)}function Je(t){let e=[];return t.someProp("decorations",(n=>{let o=n(t.state);o&&o!=He&&e.push(o)})),t.cursorWrapper&&e.push(_e.create(t.state.doc,[t.cursorWrapper.deco])),je.from(e)}const Ye={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},qe=x&&S<=11;class Qe{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}}class Ze{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Qe,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver((t=>{for(let e=0;e"childList"==t.type&&t.removedNodes.length||"characterData"==t.type&&t.oldValue.length>t.target.nodeValue.length))?this.flushSoon():this.flush()})),qe&&(this.onCharData=t=>{this.queue.push({target:t.target,type:"characterData",oldValue:t.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,Ye)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;ethis.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(Lt(this.view)){if(this.suppressingSelectionUpdates)return Ot(this.view);if(x&&S<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&d(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e,n=new Set;for(let e=t.focusNode;e;e=a(e))n.add(e);for(let o=t.anchorNode;o;o=a(o))if(n.has(o)){e=o;break}let o=e&&this.view.docView.nearestDesc(e);return o&&o.ignoreMutation({type:"selection",target:3==e.nodeType?e.parentNode:e})?(this.setCurSelection(),!0):void 0}pendingRecords(){if(this.observer)for(let t of this.observer.takeRecords())this.queue.push(t);return this.queue}selectionChanged(t){return!this.suppressingSelectionUpdates&&!this.currentSelection.eq(t)&&Lt(this.view)&&!this.ignoreSelectionChange(t)}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.pendingRecords();e.length&&(this.queue=[]);let n=t.domSelectionRange(),i=this.selectionChanged(n),r=-1,s=-1,a=!1,l=[];if(t.editable)for(let t=0;t"BR"==t.nodeName));if(2==e.length){let[t,n]=e;t.parentNode&&t.parentNode.parentNode==n.parentNode?n.remove():t.remove()}else{let{focusNode:n}=this.currentSelection;for(let o of e){let e=o.parentNode;!e||"LI"!=e.nodeName||n&&on(t,n)==e||o.remove()}}}let c=null;r<0&&i&&t.input.lastFocus>Date.now()-200&&Math.max(t.input.lastTouch,t.input.lastClick.time)-1||i)&&(r>-1&&(t.docView.markDirty(r,s),function(t){if(!tn.has(t)&&(tn.set(t,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(t.dom).whiteSpace))){if(t.requiresGeckoHackNode=M,en)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."),en=!0}}(t)),this.handleDOMChange(r,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(n)||Ot(t),this.currentSelection.set(n))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let n=this.view.docView.nearestDesc(t.target);if("attributes"==t.type&&(n==this.view.docView||"contenteditable"==t.attributeName||"style"==t.attributeName&&!t.oldValue&&!t.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(t))return null;if("childList"==t.type){for(let n=0;ne.content.size?null:$t(t,e.resolve(n.anchor),e.resolve(n.head))}function ln(t,e,n){let o=t.depth,i=e?t.end():t.pos;for(;o>0&&(e||t.indexAfter(o)==t.node(o).childCount);)o--,i++,e=!1;if(n){let e=t.node(o).maybeChild(t.indexAfter(o));for(;e&&!e.isLeaf;)e=e.firstChild,i++}return i}function cn(t){if(2!=t.length)return!1;let e=t.charCodeAt(0),n=t.charCodeAt(1);return e>=56320&&e<=57343&&n>=55296&&n<=56319}class dn{constructor(t,e){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 ce,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(mn),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):"function"==typeof t?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=pn(this),hn(this),this.nodeViews=fn(this),this.docView=ct(this.state.doc,un(this),Je(this),this.dom,this),this.domObserver=new Ze(this,((t,e,n,r)=>function(t,e,n,r,s){let a=t.input.compositionPendingChanges||(t.composing?t.input.compositionID:0);if(t.input.compositionPendingChanges=0,e<0){let e=t.input.lastSelectionTime>Date.now()-50?t.input.lastSelectionOrigin:null,n=Mt(t,e);if(n&&!t.state.selection.eq(n)){if(O&&R&&13===t.input.lastKeyCode&&Date.now()-100e(t,g(13,"Enter")))))return;let o=t.state.tr.setSelection(n);"pointer"==e?o.setMeta("pointer",!0):"key"==e&&o.scrollIntoView(),a&&o.setMeta("composition",a),t.dispatch(o)}return}let l=t.state.doc.resolve(e),c=l.sharedDepth(n);e=l.before(c+1),n=t.state.doc.resolve(n).after(c+1);let d,u,h=t.state.selection,p=function(t,e,n){let o,{node:r,fromOffset:s,toOffset:a,from:l,to:c}=t.docView.parseRange(e,n),d=t.domSelectionRange(),u=d.anchorNode;if(u&&t.dom.contains(1==u.nodeType?u:u.parentNode)&&(o=[{node:u,offset:d.anchorOffset}],m(d)||o.push({node:d.focusNode,offset:d.focusOffset})),O&&8===t.input.lastKeyCode)for(let t=a;t>s;t--){let e=r.childNodes[t-1],n=e.pmViewDesc;if("BR"==e.nodeName&&!n){a=t;break}if(!n||n.size)break}let h=t.state.doc,p=t.someProp("domParser")||i.S4.fromSchema(t.state.schema),f=h.resolve(l),g=null,b=p.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:s,to:a,preserveWhitespace:"pre"!=f.parent.type.whitespace||"full",findPositions:o,ruleFromNode:rn,context:f});if(o&&null!=o[0].pos){let t=o[0].pos,e=o[1]&&o[1].pos;null==e&&(e=t),g={anchor:t+l,head:e+l}}return{doc:b,sel:g,from:l,to:c}}(t,e,n),f=t.state.doc,b=f.slice(p.from,p.to);8===t.input.lastKeyCode&&Date.now()-100=s?r-o:0;r-=t,r&&r=a?r-o:0;r-=e,r&&rDate.now()-225||R)&&s.some((t=>1==t.nodeType&&!sn.test(t.nodeName)))&&(!y||y.endA>=y.endB)&&t.someProp("handleKeyDown",(e=>e(t,g(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(!y){if(!(r&&h instanceof o.U3&&!h.empty&&h.$head.sameParent(h.$anchor))||t.composing||p.sel&&p.sel.anchor!=p.sel.head){if(p.sel){let e=an(t,t.state.doc,p.sel);if(e&&!e.eq(t.state.selection)){let n=t.state.tr.setSelection(e);a&&n.setMeta("composition",a),t.dispatch(n)}}return}y={start:h.from,endA:h.to,endB:h.to}}t.state.selection.fromt.state.selection.from&&y.start<=t.state.selection.from+2&&t.state.selection.from>=p.from?y.start=t.state.selection.from:y.endA=t.state.selection.to-2&&t.state.selection.to<=p.to&&(y.endB+=t.state.selection.to-y.endA,y.endA=t.state.selection.to)),x&&S<=11&&y.endB==y.start+1&&y.endA==y.start&&y.start>p.from&&"  "==p.doc.textBetween(y.start-p.from-1,y.start-p.from+1)&&(y.start--,y.endA--,y.endB--);let k,v=p.doc.resolveNoCache(y.start-p.from),w=p.doc.resolveNoCache(y.endB-p.from),C=f.resolve(y.start),M=v.sameParent(w)&&v.parent.inlineContent&&C.end()>=y.endA;if((I&&t.input.lastIOSEnter>Date.now()-225&&(!M||s.some((t=>"DIV"==t.nodeName||"P"==t.nodeName)))||!M&&v.pose(t,g(13,"Enter")))))return void(t.input.lastIOSEnter=0);if(t.state.selection.anchor>y.start&&function(t,e,n,o,i){if(n-e<=i.pos-o.pos||ln(o,!0,!1)n||ln(s,!0,!1)e(t,g(8,"Backspace")))))return void(R&&O&&t.domObserver.suppressSelectionUpdates());O&&R&&y.endB==y.start&&(t.input.lastAndroidDelete=Date.now()),R&&!M&&v.start()!=w.start()&&0==w.parentOffset&&v.depth==w.depth&&p.sel&&p.sel.anchor==p.sel.head&&p.sel.head==y.endA&&(y.endB-=2,w=p.doc.resolveNoCache(y.endB-p.from),setTimeout((()=>{t.someProp("handleKeyDown",(function(e){return e(t,g(13,"Enter"))}))}),20));let T,E,A,N=y.start,D=y.endA;if(M)if(v.pos==w.pos)x&&S<=11&&0==v.parentOffset&&(t.domObserver.suppressSelectionUpdates(),setTimeout((()=>Ot(t)),20)),T=t.state.tr.delete(N,D),E=f.resolve(y.start).marksAcross(f.resolve(y.endA));else if(y.endA==y.endB&&(A=function(t,e){let n,o,r,s=t.firstChild.marks,a=e.firstChild.marks,l=s,c=a;for(let t=0;tt.mark(o.addToSet(t.marks));else{if(0!=l.length||1!=c.length)return null;o=c[0],n="remove",r=t=>t.mark(o.removeFromSet(t.marks))}let d=[];for(let t=0;tn(t,N,D,e))))return;T=t.state.tr.insertText(e,N,D)}if(T||(T=t.state.tr.replace(N,D,p.doc.slice(y.start-p.from,y.endB-p.from))),p.sel){let e=an(t,T.doc,p.sel);e&&!(O&&R&&t.composing&&e.empty&&(y.start!=y.endB||t.input.lastAndroidDelete{!pe(t,e)||he(t,e)||!t.editable&&e.type in ae||n(t,e)},le[e]?{passive:!0}:void 0)}A&&t.dom.addEventListener("input",(()=>null)),ue(t)}(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&ue(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(mn),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let t in this._props)e[t]=this._props[t];e.state=this.state;for(let n in t)e[n]=t[n];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){var n;let o=this.state,i=!1,r=!1;t.storedMarks&&this.composing&&(Me(this),r=!0),this.state=t;let a=o.plugins!=t.plugins||this._props.plugins!=e.plugins;if(a||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let t=fn(this);(function(t,e){let n=0,o=0;for(let o in t){if(t[o]!=e[o])return!0;n++}for(let t in e)o++;return n!=o})(t,this.nodeViews)&&(this.nodeViews=t,i=!0)}(a||e.handleDOMEvents!=this._props.handleDOMEvents)&&ue(this),this.editable=pn(this),hn(this);let l=Je(this),c=un(this),u=o.plugins==t.plugins||o.doc.eq(t.doc)?t.scrollToSelection>o.scrollToSelection?"to selection":"preserve":"reset",h=i||!this.docView.matchesNode(t.doc,c,l);!h&&t.selection.eq(o.selection)||(r=!0);let m="preserve"==u&&r&&null==this.dom.style.overflowAnchor&&function(t){let e,n,o=t.dom.getBoundingClientRect(),i=Math.max(0,o.top);for(let r=(o.left+o.right)/2,s=i+1;s=i-20){e=o,n=a.top;break}}return{refDOM:e,refTop:n,stack:H(t.dom)}}(this);if(r){this.domObserver.stop();let e=h&&(x||O)&&!this.composing&&!o.selection.empty&&!t.selection.empty&&function(t,e){let n=Math.min(t.$anchor.sharedDepth(t.head),e.$anchor.sharedDepth(e.head));return t.$anchor.start(n)!=e.$anchor.start(n)}(o.selection,t.selection);if(h){let n=O?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(t){let e=t.domSelectionRange();if(!e.focusNode)return null;let n=function(t,e){for(;;){if(3==t.nodeType&&e)return t;if(1==t.nodeType&&e>0){if("false"==t.contentEditable)return null;e=p(t=t.childNodes[e-1])}else{if(!t.parentNode||f(t))return null;e=s(t),t=t.parentNode}}}(e.focusNode,e.focusOffset),o=function(t,e){for(;;){if(3==t.nodeType&&et(this))));else if(this.state.selection instanceof o.nh){let e=this.docView.domAfterPos(this.state.selection.from);1==e.nodeType&&_(this,e.getBoundingClientRect(),t)}else _(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(t&&t.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(let e=0;e0&&this.state.doc.nodeAt(t))==n.node&&(i=t)}this.dragging=new Ie(t.slice,t.move,i<0?void 0:o.nh.create(this.state.doc,i))}someProp(t,e){let n,o=this._props&&this._props[t];if(null!=o&&(n=e?e(o):o))return n;for(let o=0;ot.ownerDocument.getSelection()),this._root=t;return t||document}updateRoot(){this._root=null}posAtCoords(t){return X(this,t)}coordsAtPos(t,e=1){return Y(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,n=-1){let o=this.docView.posFromDOM(t,e,n);if(null==o)throw new RangeError("DOM position not inside the editor");return o}endOfTextblock(t,e){return function(t,e,n){return et==e&&nt==n?ot:(et=e,nt=n,ot="up"==n||"down"==n?function(t,e,n){let o=e.selection,i="up"==n?o.$from:o.$to;return Z(t,e,(()=>{let{node:e}=t.docView.domFromPos(i.pos,"up"==n?-1:1);for(;;){let n=t.docView.nearestDesc(e,!0);if(!n)break;if(n.node.isBlock){e=n.contentDOM||n.dom;break}e=n.dom.parentNode}let o=Y(t,i.pos,1);for(let t=e.firstChild;t;t=t.nextSibling){let e;if(1==t.nodeType)e=t.getClientRects();else{if(3!=t.nodeType)continue;e=c(t,0,t.nodeValue.length).getClientRects()}for(let t=0;ti.top+1&&("up"==n?o.top-i.top>2*(i.bottom-o.top):i.bottom-o.bottom>2*(o.bottom-i.top)))return!1}}return!0}))}(t,e,n):function(t,e,n){let{$head:o}=e.selection;if(!o.parent.isTextblock)return!1;let i=o.parentOffset,r=!i,s=i==o.parent.content.size,a=t.domSelection();return a?tt.test(o.parent.textContent)&&a.modify?Z(t,e,(()=>{let{focusNode:e,focusOffset:i,anchorNode:r,anchorOffset:s}=t.domSelectionRange(),l=a.caretBidiLevel;a.modify("move",n,"character");let c=o.depth?t.docView.domAfterPos(o.before()):t.dom,{focusNode:d,focusOffset:u}=t.domSelectionRange(),h=d&&!c.contains(1==d.nodeType?d:d.parentNode)||e==d&&i==u;try{a.collapse(r,s),e&&(e!=r||i!=s)&&a.extend&&a.extend(e,i)}catch(t){}return null!=l&&(a.caretBidiLevel=l),h})):"left"==n||"backward"==n?r:s:o.pos==o.start()||o.pos==o.end()}(t,e,n))}(this,e||this.state,t)}pasteHTML(t,e){return Ee(this,"",t,!1,e||new ClipboardEvent("paste"))}pasteText(t,e){return Ee(this,t,null,!0,e||new ClipboardEvent("paste"))}destroy(){this.docView&&(function(t){t.domObserver.stop();for(let e in t.input.eventHandlers)t.dom.removeEventListener(e,t.input.eventHandlers[e]);clearTimeout(t.input.composingTimeout),clearTimeout(t.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],Je(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,l=null)}get isDestroyed(){return null==this.docView}dispatchEvent(t){return function(t,e){he(t,e)||!se[e.type]||!t.editable&&e.type in ae||se[e.type](t,e)}(this,t)}dispatch(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){let t=this.domSelection();return t?A&&11===this.root.nodeType&&function(t){let e=t.activeElement;for(;e&&e.shadowRoot;)e=e.shadowRoot.activeElement;return e}(this.dom.ownerDocument)==this.dom&&function(t,e){if(e.getComposedRanges){let n=e.getComposedRanges(t.root)[0];if(n)return nn(t,n)}let n;function o(t){t.preventDefault(),t.stopImmediatePropagation(),n=t.getTargetRanges()[0]}return t.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),t.dom.removeEventListener("beforeinput",o,!0),n?nn(t,n):null}(this,t)||t:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}domSelection(){return this.root.getSelection()}}function un(t){let e=Object.create(null);return e.class="ProseMirror",e.contenteditable=String(t.editable),t.someProp("attributes",(n=>{if("function"==typeof n&&(n=n(t.state)),n)for(let t in n)"class"==t?e.class+=" "+n[t]:"style"==t?e.style=(e.style?e.style+";":"")+n[t]:e[t]||"contenteditable"==t||"nodeName"==t||(e[t]=String(n[t]))})),e.translate||(e.translate="no"),[ze.node(0,t.state.doc.content.size,e)]}function hn(t){if(t.markCursor){let e=document.createElement("img");e.className="ProseMirror-separator",e.setAttribute("mark-placeholder","true"),e.setAttribute("alt",""),t.cursorWrapper={dom:e,deco:ze.widget(t.state.selection.from,e,{raw:!0,marks:t.markCursor})}}else t.cursorWrapper=null}function pn(t){return!t.someProp("editable",(e=>!1===e(t.state)))}function fn(t){let e=Object.create(null);function n(t){for(let n in t)Object.prototype.hasOwnProperty.call(e,n)||(e[n]=t[n])}return t.someProp("nodeViews",n),t.someProp("markViews",n),e}function mn(t){if(t.spec.state||t.spec.filterTransaction||t.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}}}]); \ No newline at end of file diff --git a/anchors/index.html b/anchors/index.html index 0ae7b472f..1fe5232ee 100644 --- a/anchors/index.html +++ b/anchors/index.html @@ -30,7 +30,7 @@ -
/

Editor

Anchors

#

The anchor element defines a hyperlink, which is used to link to part of section

War and Peace (Russian: Война и мир, romanizedVoyna i mir; pre-reform Russian: Война и миръ; [vɐjˈna i ˈmʲir]) is a literary work by the Russian author Leo Tolstoy that mixes fictional narrative with chapters on history and philosophy. It was first published serially, then published in its entirety in 1869. It is regarded as Tolstoy's finest literary achievement and remains an internationally praised classic of world literature.[1][2][3]

The novel chronicles the French invasion of Russia and the impact of the Napoleonic era on Tsarist society through the stories of five Russian aristocratic families. Portions of an earlier version, titled The Year 1805,[4] were serialized in The Russian Messenger from 1865 to 1867 before the novel was published in its entirety in 1869.[5]

Tolstoy said that the best Russian literature does not conform to standards and hence hesitated to classify War and Peace, saying it is "not a novel, even less is it a poem, and still less a historical chronicle". Large sections, especially the later chapters, are philosophical discussions rather than narrative.[6] He regarded Anna Karenina as his first true novel.

References:

  1. Moser, Charles. 1992. Encyclopedia of Russian Literature. Cambridge University Press, pp. 298–300.

  2. Thirlwell, Adam "A masterpiece in miniature". The Guardian (London, UK) October 8, 2005

  3. Briggs, Anthony. 2005. "Introduction" to War and Peace. Penguin Classics.

  4. Pevear, Richard (2008). "Introduction". War and Peace. Trans. Pevear; Volokhonsky, Larissa. New York: Vintage Books. pp. VIII–IX. ISBN 978-1-4000-7998-8.

  5. Knowles, A. V. Leo Tolstoy, Routledge 1997.

  6. "Introduction?". War and Peace. Wordsworth Editions. 1993. ISBN 978-1-85326-062-9. Retrieved 2009-03-24.

HTML:

War and Peace (Russian: Война и мир, romanizedVoyna i mir; pre-reform Russian: Война и миръ; [vɐjˈna i ˈmʲir]) is a literary work by the Russian author Leo Tolstoy that mixes fictional narrative with chapters on history and philosophy. It was first published serially, then published in its entirety in 1869. It is regarded as Tolstoy's finest literary achievement and remains an internationally praised classic of world literature.[1][2][3]

The novel chronicles the French invasion of Russia and the impact of the Napoleonic era on Tsarist society through the stories of five Russian aristocratic families. Portions of an earlier version, titled The Year 1805,[4] were serialized in The Russian Messenger from 1865 to 1867 before the novel was published in its entirety in 1869.[5]

Tolstoy said that the best Russian literature does not conform to standards and hence hesitated to classify War and Peace, saying it is "not a novel, even less is it a poem, and still less a historical chronicle". Large sections, especially the later chapters, are philosophical discussions rather than narrative.[6] He regarded Anna Karenina as his first true novel.

References:

  1. Moser, Charles. 1992. Encyclopedia of Russian Literature. Cambridge University Press, pp. 298–300.

  2. Thirlwell, Adam "A masterpiece in miniature". The Guardian (London, UK) October 8, 2005

  3. Briggs, Anthony. 2005. "Introduction" to War and Peace. Penguin Classics.

  4. Pevear, Richard (2008). "Introduction". War and Peace. Trans. Pevear; Volokhonsky, Larissa. New York: Vintage Books. pp. VIII–IX. ISBN 978-1-4000-7998-8.

  5. Knowles, A. V. Leo Tolstoy, Routledge 1997.

  6. "Introduction?". War and Peace. Wordsworth Editions. 1993. ISBN 978-1-85326-062-9. Retrieved 2009-03-24.

Text:

<p><strong><em>War and Peace</em></strong> (<a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Russian_language">Russian</a>: Война и мир, <a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Romanization_of_Russian">romanized</a>:&nbsp;<em>Voyna i mir</em>; <a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Reforms_of_Russian_orthography">pre-reform Russian</a>: <strong>Война и миръ</strong>; <a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Help:IPA/Russian">[vɐjˈna i ˈmʲir]</a>) is a literary work by the Russian author <a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Leo_Tolstoy">Leo Tolstoy</a> that mixes fictional narrative with chapters on history and philosophy. It was first published serially, then published in its entirety in 1869. It is regarded as Tolstoy's finest literary achievement and remains an internationally praised classic of <a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/World_literature">world literature</a>.<a target="_blank" rel="noopener noreferrer nofollow" href="#moser">[1]</a><a target="_blank" rel="noopener noreferrer nofollow" href="#thirlwell">[2]</a><a target="_blank" rel="noopener noreferrer nofollow" href="#briggs">[3]</a></p><p>The novel chronicles the <a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/French_invasion_of_Russia">French invasion of Russia</a> and the impact of the <a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Napoleonic_era">Napoleonic era</a> on <a target="_blank" rel="noopener noreferrer nofollow" class="my-custom-class mw-redirect" href="https://en.wikipedia.org/wiki/Tsarist">Tsarist</a> society through the stories of five Russian <a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Aristocracy_(class)">aristocratic</a> families. Portions of an earlier version, titled <em>The Year 1805</em>,<a target="_blank" rel="noopener noreferrer nofollow" href="#introduction">[4] </a>were serialized in <a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/The_Russian_Messenger"><em>The Russian Messenger</em></a> from 1865 to 1867 before the novel was published in its entirety in 1869.<a target="_blank" rel="noopener noreferrer nofollow" href="#knowles">[5]</a></p><p>Tolstoy said that the best <a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Russian_literature">Russian literature</a> does not conform to standards and hence hesitated to classify <em>War and Peace</em>, saying it is "not a novel, even less is it a poem, and still less a historical chronicle". Large sections, especially the later chapters, are philosophical discussions rather than narrative.<a target="_blank" rel="noopener noreferrer nofollow" href="#war">[6]</a> He regarded <a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Anna_Karenina"><em>Anna Karenina</em></a> as his first true novel.</p><p></p><img src="./assets/images/piece-and-war.jpg" width="732" alt="" title="" /><p></p><p><strong>References</strong>:</p><ol><li><p><a data-type="jump-anchor" id="moser">Moser</a>, Charles. 1992. <em>Encyclopedia of Russian Literature</em>. Cambridge University Press, pp. 298–300.</p></li><li><p><a data-type="jump-anchor" id="thirlwell">Thirlwell</a>, Adam <a target="_blank" rel="noopener noreferrer nofollow" class="external text" href="https://www.theguardian.com/books/2005/oct/08/classics.leonikolaevichtolstoy">"A masterpiece in miniature"</a>. <em>The Guardian</em> (London, UK) October 8, 2005</p></li><li><p><a data-type="jump-anchor" id="briggs">Briggs</a>, Anthony. 2005. "Introduction" to <em>War and Peace</em>. Penguin Classics.</p><p></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Richard_Pevear_and_Larissa_Volokhonsky">Pevear, Richard</a> (2008). "<a data-type="jump-anchor" id="introduction">Introduction</a>". <a target="_blank" rel="noopener noreferrer nofollow" class="external text" href="https://archive.org/details/warpeace00tols_1"><em>War and Peace</em></a>. Trans. Pevear; <a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Richard_Pevear_and_Larissa_Volokhonsky">Volokhonsky, Larissa</a>. New York: Vintage Books. pp.&nbsp;VIII–IX. <a target="_blank" rel="noopener noreferrer nofollow" class="mw-redirect" href="https://en.wikipedia.org/wiki/ISBN_(identifier)">ISBN</a>&nbsp;<a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Special:BookSources/978-1-4000-7998-8">978-1-4000-7998-8</a>.</p><p></p></li><li><p><a data-type="jump-anchor" id="knowles">Knowles</a>, A. V. <em>Leo Tolstoy</em>, Routledge 1997.</p><p></p></li><li><p><a target="_blank" rel="noopener noreferrer nofollow" class="external text" href="https://books.google.com/books?id=c4HEAN-ti1MC&amp;pg=PR10">"Introduction?"</a>. <a data-type="jump-anchor" id="war"><em>War and Peace</em></a>. Wordsworth Editions. 1993. <a target="_blank" rel="noopener noreferrer nofollow" class="mw-redirect" href="https://en.wikipedia.org/wiki/ISBN_(identifier)">ISBN</a>&nbsp;<a target="_blank" rel="noopener noreferrer nofollow" href="https://en.wikipedia.org/wiki/Special:BookSources/978-1-85326-062-9">978-1-85326-062-9</a>. Retrieved 2009-03-24.</p></li></ol>