@zhijiancloud/bpm 1.0.36 → 1.0.38
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bpmAppointment.umd.js +1 -1
- package/dist/bpmArea.umd.js +1 -1
- package/dist/bpmAreaElevation.umd.js +1 -1
- package/dist/bpmAudit.umd.js +1 -1
- package/dist/bpmAudit.umd.js.LICENSE.txt +2 -2
- package/dist/bpmDateTime.umd.js +1 -1
- package/dist/bpmExternalFormLink.umd.js +1 -1
- package/dist/bpmField.umd.js +6 -6
- package/dist/bpmField.umd.js.LICENSE.txt +2 -2
- package/dist/bpmFieldsFilter.umd.js +3 -3
- package/dist/bpmFormField.umd.js +6 -6
- package/dist/bpmFormField.umd.js.LICENSE.txt +2 -2
- package/dist/bpmMapLocation.umd.js +1 -1
- package/dist/bpmMulFile.umd.js +1 -1
- package/dist/bpmMulFile.umd.js.LICENSE.txt +2 -2
- package/dist/bpmMulImage.umd.js +1 -1
- package/dist/bpmMulImage.umd.js.LICENSE.txt +2 -2
- package/dist/bpmNumber.umd.js +1 -1
- package/dist/bpmOverTime.umd.js +1 -1
- package/dist/bpmQuote.umd.js +1 -0
- package/dist/bpmRating.umd.js +1 -1
- package/dist/bpmRichText.umd.js +1 -1
- package/dist/bpmSelect.umd.js +1 -1
- package/dist/bpmSelectCheckItem.umd.js +1 -1
- package/dist/bpmSelectEntranceForm.umd.js +3 -3
- package/dist/bpmSelectFromField.umd.js +1 -1
- package/dist/bpmSelectFromForm.umd.js +1 -1
- package/dist/bpmSelectFromId.umd.js +1 -1
- package/dist/bpmSelectFromMulForm.umd.js +1 -1
- package/dist/bpmSelectHouseOwner.umd.js +1 -1
- package/dist/bpmSelectIssue.umd.js +1 -1
- package/dist/bpmSelectUser.umd.js +1 -1
- package/dist/bpmSignature.umd.js +1 -1
- package/dist/bpmSignature.umd.js.LICENSE.txt +2 -2
- package/dist/bpmSpliter.umd.js +1 -1
- package/dist/bpmSubForm.umd.js +1 -1
- package/dist/bpmSubFormField.umd.js +6 -6
- package/dist/bpmSubFormField.umd.js.LICENSE.txt +2 -2
- package/dist/bpmText.umd.js +1 -1
- package/dist/bpmTime.umd.js +1 -1
- package/dist/bpmVideo.umd.js +1 -1
- package/dist/css/bpmRichText.css +1 -1
- package/dist/css/index.css +1 -1
- package/dist/demo.umd.js +1 -1
- package/dist/demo2.umd.js +1 -1
- package/dist/index.umd.js +6 -6
- package/dist/index.umd.js.LICENSE.txt +2 -2
- package/package.json +21 -2
- package/dist/06c52960c6d2c0312a3e.woff +0 -1
- package/dist/0db1520f47986b6c755a.svg +0 -1
- package/dist/141.umd.js +0 -1
- package/dist/1e59d2330b4c6deb84b340635ed36249.ttf +0 -0
- package/dist/204.umd.js +0 -1
- package/dist/20fd1704ea223900efa9fd4e869efb08.woff2 +0 -0
- package/dist/3c5f86a14ac61c80f6af.eot +0 -1
- package/dist/4a2487b5cc6987c4f1de.woff2 +0 -1
- package/dist/4c6f1cd9993ba8a53b8e.ttf +0 -1
- package/dist/557.umd.js +0 -2
- package/dist/557.umd.js.LICENSE.txt +0 -283
- package/dist/559.umd.js +0 -1
- package/dist/584.umd.js +0 -1
- package/dist/7a065a1c0cb2d586cecb.woff +0 -1
- package/dist/7d6ec71e2466a9fd777f.woff2 +0 -1
- package/dist/8b43027f47b20503057dfbbaa9401fef.eot +0 -0
- package/dist/997.umd.js +0 -1
- package/dist/b907ea149e281e9b894a.svg +0 -1
- package/dist/bpmVideo.umd.js.LICENSE.txt +0 -283
- package/dist/c1e38fd9e0e74ba58f7a2b77ef29fdd3.svg +0 -2671
- package/dist/d4cbe6fb154cf9e9036c.ttf +0 -1
- package/dist/e5c0c62d732823225aaa.eot +0 -1
- package/dist/f691f37e57f04c152e2315ab7dbad881.woff +0 -0
package/dist/bpmRichText.umd.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("element-tiptap")):"function"==typeof define&&define.amd?define(["element-tiptap"],e):"object"==typeof exports?exports.bpm2=e(require("element-tiptap")):t.bpm2=e(t["element-tiptap"])}(self,(function(t){return function(){var e={540:function(t){"use strict";t.exports=function(t){var e=document.createElement("style");return t.setAttributes(e,t.attributes),t.insert(e,t.options),e}},1113:function(t){"use strict";t.exports=function(t,e){if(e.styleSheet)e.styleSheet.cssText=t;else{for(;e.firstChild;)e.removeChild(e.firstChild);e.appendChild(document.createTextNode(t))}}},1601:function(t){"use strict";t.exports=function(t){return t[1]}},2419:function(t,e,o){"use strict";var i=o(1601),r=o.n(i),n=o(6314),a=o.n(n)()(r());a.push([t.id,'@charset "UTF-8";.el-tiptap-editor{border-radius:8px;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;max-height:100%;position:relative;width:100%}.el-tiptap-editor,.el-tiptap-editor *{-webkit-box-sizing:border-box;box-sizing:border-box}.el-tiptap-editor .border-top-radius{border-top-left-radius:8px;border-top-right-radius:8px}.el-tiptap-editor .border-bottom-radius{border-bottom-left-radius:8px;border-bottom-right-radius:8px}.el-tiptap-editor__codemirror{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;font-size:16px;line-height:24px;overflow:scroll}.el-tiptap-editor__codemirror .CodeMirror{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;height:auto}.el-tiptap-editor--fullscreen{border-radius:0!important;bottom:0!important;height:100%!important;left:0!important;margin:0!important;position:fixed!important;right:0!important;top:0!important;width:100%!important;z-index:500}.el-tiptap-editor--fullscreen .el-tiptap-editor__content,.el-tiptap-editor--fullscreen .el-tiptap-editor__footer,.el-tiptap-editor--fullscreen .el-tiptap-editor__menu-bar{border-radius:0!important}.el-tiptap-editor>.el-tiptap-editor__content{background-color:#fff;border:1px solid #ebeef5;border-bottom:0;border-top:0;color:#000;-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1;padding:30px 20px}.el-tiptap-editor__menu-bar{background-color:#fff;border:1px solid #ebeef5;border-bottom:0;display:-webkit-box;display:-ms-flexbox;display:flex;-ms-flex-negative:0;flex-shrink:0;-ms-flex-wrap:wrap;flex-wrap:wrap;padding:5px;position:relative}.el-tiptap-editor__menu-bar:before{bottom:0;background-color:#ebeef5;content:"";height:1px;left:0;margin:0 10px;right:0;position:absolute}.el-tiptap-editor__menu-bubble{background-color:#fff;border-radius:8px;-webkit-box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12);box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12);display:-webkit-box;display:-ms-flexbox;display:flex;padding:5px;opacity:0;position:absolute;-webkit-transform:translateX(-50%);transform:translateX(-50%);-webkit-transition:opacity .3s ease-in-out;transition:opacity .3s ease-in-out;visibility:hidden;z-index:50}.el-tiptap-editor__menu-bubble--active{opacity:1;visibility:visible}.el-tiptap-editor__content{font-family:sans-serif;line-height:1.7;overflow-x:auto;text-align:left}.el-tiptap-editor__content,.el-tiptap-editor__content>*{-webkit-box-sizing:border-box;box-sizing:border-box}.el-tiptap-editor__content p{margin-bottom:0;margin-top:0;outline:0}.el-tiptap-editor__content h1,.el-tiptap-editor__content h2,.el-tiptap-editor__content h3,.el-tiptap-editor__content h4,.el-tiptap-editor__content h5{margin-top:20px;margin-bottom:20px}.el-tiptap-editor__content h1:first-child,.el-tiptap-editor__content h2:first-child,.el-tiptap-editor__content h3:first-child,.el-tiptap-editor__content h4:first-child,.el-tiptap-editor__content h5:first-child{margin-top:0}.el-tiptap-editor__content h1:last-child,.el-tiptap-editor__content h2:last-child,.el-tiptap-editor__content h3:last-child,.el-tiptap-editor__content h4:last-child,.el-tiptap-editor__content h5:last-child{margin-bottom:0}.el-tiptap-editor__content ol,.el-tiptap-editor__content ul{counter-reset:none;list-style-type:none;margin-bottom:0;margin-left:24px;margin-top:0;padding-bottom:5px;padding-left:0;padding-top:5px}.el-tiptap-editor__content li>p{margin:0}.el-tiptap-editor__content li>p:first-child:before{content:counter(el-tiptap-counter) ".";display:inline-block;left:-5px;line-height:1;margin-left:-24px;position:relative;text-align:right;top:0;width:24px}.el-tiptap-editor__content ul li>p:first-child:before{content:"•";text-align:center}.el-tiptap-editor__content ol{counter-reset:el-tiptap-counter}.el-tiptap-editor__content ol li>p:first-child:before{counter-increment:el-tiptap-counter}.el-tiptap-editor__content a{color:#409eff;cursor:pointer}.el-tiptap-editor__content blockquote{border-left:5px solid #edf2fc;border-radius:2px;color:#606266;margin:10px 0;padding-left:1em}.el-tiptap-editor__content code{background-color:#d9ecff;border-radius:4px;color:#409eff;display:inline-block;font-size:14px;font-weight:700;padding:0 8px}.el-tiptap-editor__content pre{background-color:#303133;color:#d9ecff;font-size:16px;overflow-x:auto;padding:14px 20px;margin:10px 0;border-radius:5px}.el-tiptap-editor__content pre code{background-color:transparent;border-radius:0;color:inherit;display:block;font-family:"Menlo,Monaco,Consolas,Courier,monospace";font-size:inherit;font-weight:400;padding:0}.el-tiptap-editor__content img{display:inline-block;float:none;margin:12px 0;max-width:100%}.el-tiptap-editor__content img[data-display=inline]{margin-left:12px;margin-right:12px}.el-tiptap-editor__content img[data-display=block]{display:block}.el-tiptap-editor__content img[data-display=left]{float:left;margin-left:0;margin-right:12px}.el-tiptap-editor__content img[data-display=right]{float:right;margin-left:12px;margin-right:0}.el-tiptap-editor__content .image-view{display:inline-block;float:none;line-height:0;margin:12px 0;max-width:100%;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;vertical-align:baseline}.el-tiptap-editor__content .image-view--inline{margin-left:12px;margin-right:12px}.el-tiptap-editor__content .image-view--block{display:block}.el-tiptap-editor__content .image-view--left{float:left;margin-left:0;margin-right:12px}.el-tiptap-editor__content .image-view--right{float:right;margin-left:12px;margin-right:0}.el-tiptap-editor__content .image-view__body{clear:both;display:inline-block;max-width:100%;outline-color:transparent;outline-style:solid;outline-width:2px;-webkit-transition:all .2s ease-in;transition:all .2s ease-in;position:relative}.el-tiptap-editor__content .image-view__body:hover{outline-color:#ffc83d}.el-tiptap-editor__content .image-view__body--focused:hover,.el-tiptap-editor__content .image-view__body--resizing:hover{outline-color:transparent}.el-tiptap-editor__content .image-view__body__placeholder{height:100%;left:0;position:absolute;top:0;width:100%;z-index:-1}.el-tiptap-editor__content .image-view__body__image{cursor:pointer;margin:0}.el-tiptap-editor__content .image-resizer{border:1px solid #409eff;height:100%;left:0;position:absolute;top:0;width:100%;z-index:1}.el-tiptap-editor__content .image-resizer__handler{background-color:#409eff;border:1px solid #fff;border-radius:2px;-webkit-box-sizing:border-box;box-sizing:border-box;display:block;height:12px;position:absolute;width:12px;z-index:2}.el-tiptap-editor__content .image-resizer__handler--tl{cursor:nw-resize;left:-6px;top:-6px}.el-tiptap-editor__content .image-resizer__handler--tr{cursor:ne-resize;right:-6px;top:-6px}.el-tiptap-editor__content .image-resizer__handler--bl{bottom:-6px;cursor:sw-resize;left:-6px}.el-tiptap-editor__content .image-resizer__handler--br{bottom:-6px;cursor:se-resize;right:-6px}.el-tiptap-editor__content ul[data-type=todo_list]{margin-left:5px}.el-tiptap-editor__content ul[data-type=todo_list] .todo-item{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:start;-ms-flex-pack:start;justify-content:flex-start;margin-bottom:0}.el-tiptap-editor__content ul[data-type=todo_list] .todo-item[data-text-align=right]{-webkit-box-pack:end!important;-ms-flex-pack:end!important;justify-content:flex-end!important}.el-tiptap-editor__content ul[data-type=todo_list] .todo-item[data-text-align=center]{-webkit-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.el-tiptap-editor__content ul[data-type=todo_list] .todo-item[data-text-align=justify]{text-align:space-between!important}.el-tiptap-editor__content ul[data-type=todo_list] .todo-item .todo-content{padding-left:10px}.el-tiptap-editor__content ul[data-type=todo_list] .todo-item .todo-content>p{font-size:16px}.el-tiptap-editor__content ul[data-type=todo_list] .todo-item .todo-content>p:last-of-type{margin-bottom:0}.el-tiptap-editor__content ul[data-type=todo_list] .todo-item--done>.todo-checkbox{color:#409eff}.el-tiptap-editor__content ul[data-type=todo_list] .todo-item--done>.todo-content>p{color:#409eff;text-decoration:line-through}.el-tiptap-editor__content hr{margin-top:20px;margin-bottom:20px}.el-tiptap-editor__content [data-indent="1"]{margin-left:30px!important}.el-tiptap-editor__content [data-indent="2"]{margin-left:60px!important}.el-tiptap-editor__content [data-indent="3"]{margin-left:90px!important}.el-tiptap-editor__content [data-indent="4"]{margin-left:120px!important}.el-tiptap-editor__content [data-indent="5"]{margin-left:150px!important}.el-tiptap-editor__content [data-indent="6"]{margin-left:180px!important}.el-tiptap-editor__content [data-indent="7"]{margin-left:210px!important}.el-tiptap-editor__content .tableWrapper{margin:1em 0;overflow-x:auto}.el-tiptap-editor__content table{border-collapse:collapse;table-layout:fixed;width:100%;margin:0;overflow:hidden}.el-tiptap-editor__content td,.el-tiptap-editor__content th{border:2px solid #ebeef5;-webkit-box-sizing:border-box;box-sizing:border-box;min-width:1em;padding:3px 5px;position:relative;vertical-align:top}.el-tiptap-editor__content td.selectedCell,.el-tiptap-editor__content th.selectedCell{background-color:#ecf5ff}.el-tiptap-editor__content th{font-weight:500;text-align:left}.el-tiptap-editor__content .column-resize-handle{background-color:#b3d8ff;bottom:0;pointer-events:none;position:absolute;right:-2px;top:0;width:4px;z-index:20}.el-tiptap-editor__content .iframe{height:0;padding-bottom:56.25%;position:relative;width:100%}.el-tiptap-editor__content .iframe__embed{border:0;height:100%;left:0;position:absolute;top:0;width:100%}.el-tiptap-editor__content .resize-cursor{cursor:ew-resize;cursor:col-resize}.el-tiptap-editor__footer{-webkit-box-align:center;-ms-flex-align:center;align-items:center;background-color:#fff;border:1px solid #ebeef5;display:-webkit-box;display:-ms-flexbox;display:flex;font-family:sans-serif;font-size:14px;-webkit-box-pack:end;-ms-flex-pack:end;justify-content:flex-end;padding:10px}.el-tiptap-editor .ProseMirror{outline:0}.el-tiptap-editor__placeholder.el-tiptap-editor--empty:first-child:before,.el-tiptap-editor__with-title-placeholder:first-child:before,.el-tiptap-editor__with-title-placeholder:nth-child(2):before{color:#c0c4cc;content:attr(data-empty-text);float:left;height:0;pointer-events:none}.el-tiptap-editor__characters{color:#939599}.el-tiptap-editor__command-button{border:1px solid transparent;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border-radius:50%;color:#303133;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:40px;margin:2px;outline:0;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;width:40px}.el-tiptap-editor__command-button:hover{background-color:#e4e9f2}.el-tiptap-editor__command-button--active{background-color:#ecf5ff;color:#409eff}.el-tiptap-editor__command-button--readonly{cursor:default;opacity:.3;pointer-events:none}.el-tiptap-editor__command-button--readonly:hover{background-color:transparent}.el-tiptap-dropdown-menu .el-tiptap-dropdown-menu__item{color:#303133;line-height:1.5;padding-top:5px;padding-bottom:5px}.el-tiptap-dropdown-menu .el-tiptap-dropdown-menu__item [data-item-type=heading]{margin-bottom:0;margin-top:0}.el-tiptap-dropdown-menu .el-tiptap-dropdown-menu__item--active{background-color:#ecf5ff;color:#409eff}.el-tiptap-popper.el-popper{min-width:0}.el-tiptap-popper__menu__item{color:#303133;cursor:pointer;padding:8px 0}.el-tiptap-popper__menu__item--active,.el-tiptap-popper__menu__item:hover{color:#409eff}.el-tiptap-popper__menu__item--disabled{cursor:default;opacity:.2}.el-tiptap-popper__menu__item--disabled:hover{color:inherit}.el-tiptap-popper__menu__item__separator{border-top:1px solid #dcdfe6;height:0;margin:5px 0;width:100%}.el-tiptap-upload{display:-webkit-box;display:-ms-flexbox;display:flex}.el-tiptap-upload .el-upload,.el-tiptap-upload .el-upload-dragger{-webkit-box-flex:1;-ms-flex-positive:1;flex-grow:1}.el-tiptap-upload .el-upload-dragger{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;height:300px;width:100%}.el-tiptap-upload .el-upload-dragger .el-tiptap-upload__icon{font-size:50px;margin-bottom:10px}.el-tiptap-upload .el-upload-dragger:hover .el-tiptap-upload__icon{color:#409eff}.color-set{display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-ms-flex-wrap:wrap;flex-wrap:wrap;width:240px}.color-set .color{border-radius:50%;-webkit-box-shadow:rgba(0,0,0,.2) 0 3px 3px -2px,rgba(0,0,0,.14) 0 3px 4px 0,rgba(0,0,0,.12) 0 1px 8px 0;box-shadow:0 3px 3px -2px rgba(0,0,0,.2),0 3px 4px 0 rgba(0,0,0,.14),0 1px 8px 0 rgba(0,0,0,.12);color:#fff;height:30px;-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;width:30px}.color-set .color,.color-set .color__wrapper{-webkit-box-sizing:border-box;box-sizing:border-box}.color-set .color__wrapper{-webkit-box-align:center;-ms-flex-align:center;align-items:center;cursor:pointer;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-flex:0;-ms-flex:0 0 12.5%;flex:0 0 12.5%;-webkit-box-pack:center;-ms-flex-pack:center;justify-content:center;padding:5px}.color-set .color--selected,.color-set .color:hover{border:2px solid #fff;-webkit-transform:scale(1.3);transform:scale(1.3)}.color-set .color--remove{position:relative}.color-set .color--remove:hover:before{-webkit-transform:rotate(-45deg);transform:rotate(-45deg)}.color-set .color--remove:hover:after{-webkit-transform:rotate(45deg);transform:rotate(45deg)}.color-set .color--remove:after,.color-set .color--remove:before{background-color:#f56c6c;bottom:0;content:"";left:50%;position:absolute;margin:2px 0;top:0;-webkit-transform:translateX(-50%);transform:translateX(-50%);-webkit-transition:all .2s ease-in-out;transition:all .2s ease-in-out;width:2px}.color-hex{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between;margin-top:10px}.color-hex .color-hex__button{margin-left:10px;padding-left:15px;padding-right:15px}.table-grid-size-editor__body{-webkit-box-orient:vertical;-webkit-box-direction:normal;-ms-flex-direction:column;flex-direction:column;-ms-flex-wrap:wrap;flex-wrap:wrap;-webkit-box-pack:justify;-ms-flex-pack:justify;justify-content:space-between}.table-grid-size-editor__body,.table-grid-size-editor__row{display:-webkit-box;display:-ms-flexbox;display:flex}.table-grid-size-editor__cell{background-color:#fff;padding:5px}.table-grid-size-editor__cell__inner{border:1px solid #dcdfe6;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:2px;height:16px;padding:4px;width:16px}.table-grid-size-editor__cell--selected .table-grid-size-editor__cell__inner{background-color:#ecf5ff;border-color:#409eff}.table-grid-size-editor__footer{margin-top:5px;text-align:center}.el-tiptap-edit-image-dialog .el-form-item:last-child{margin-bottom:0}.el-tiptap-edit-image-dialog input[type=number]::-webkit-inner-spin-button,.el-tiptap-edit-image-dialog input[type=number]::-webkit-outer-spin-button{-webkit-appearance:none}.el-tiptap-edit-link-dialog .el-form-item:last-child{margin-bottom:0}.el-popper.el-tiptap-image-popper{background-color:#fff;border-radius:8px;-webkit-box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12);box-shadow:0 3px 5px -1px rgba(0,0,0,.2),0 6px 10px 0 rgba(0,0,0,.14),0 1px 18px 0 rgba(0,0,0,.12);min-width:0;padding:5px}.el-popper.el-tiptap-image-popper .image-bubble-menu{-webkit-box-align:center;-ms-flex-align:center;align-items:center;display:-webkit-box;display:-ms-flexbox;display:flex;-webkit-box-orient:horizontal;-webkit-box-direction:normal;-ms-flex-direction:row;flex-direction:row}.link-bubble-menu{display:-webkit-box;display:-ms-flexbox;display:flex}.fa-icon{display:inline-block;fill:currentColor;overflow:visible}.fa-icon>g{-webkit-transform-origin:50% 50%;transform-origin:50% 50%}.fa-flip-horizontal{-webkit-transform:scaleX(-1);transform:scaleX(-1)}.fa-flip-vertical{-webkit-transform:scaleY(-1);transform:scaleY(-1)}.fa-flip-both{-webkit-transform:scale(-1);transform:scale(-1)}.fa-spin>g{-webkit-animation:fa-spin 1s linear 0s infinite;animation:fa-spin 1s linear 0s infinite}.fa-pulse>g{-webkit-animation:fa-spin 1s steps(8) infinite;animation:fa-spin 1s steps(8) infinite}.fa-inverse{color:#fff}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0);transform:rotate(0)}to{-webkit-transform:rotate(1turn);transform:rotate(1turn)}}',""]),e.A=a},3533:function(e){"use strict";e.exports=t},4486:function(t,e,o){"use strict";function i(t,e,o,i,r,n,a,l){var p,d="function"==typeof t?t.options:t;if(e&&(d.render=e,d.staticRenderFns=o,d._compiled=!0),i&&(d.functional=!0),n&&(d._scopeId="data-v-"+n),a?(p=function(t){(t=t||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(t=__VUE_SSR_CONTEXT__),r&&r.call(this,t),t&&t._registeredComponents&&t._registeredComponents.add(a)},d._ssrRegister=p):r&&(p=l?function(){r.call(this,(d.functional?this.parent:this).$root.$options.shadowRoot)}:r),p)if(d.functional){d._injectStyles=p;var s=d.render;d.render=function(t,e){return p.call(e),s(t,e)}}else{var c=d.beforeCreate;d.beforeCreate=c?[].concat(c,p):[p]}return{exports:t,options:d}}o.d(e,{A:function(){return i}})},5056:function(t,e,o){"use strict";t.exports=function(t){var e=o.nc;e&&t.setAttribute("nonce",e)}},5072:function(t){"use strict";var e=[];function o(t){for(var o=-1,i=0;i<e.length;i++)if(e[i].identifier===t){o=i;break}return o}function i(t,i){for(var n={},a=[],l=0;l<t.length;l++){var p=t[l],d=i.base?p[0]+i.base:p[0],s=n[d]||0,c="".concat(d," ").concat(s);n[d]=s+1;var f=o(c),b={css:p[1],media:p[2],sourceMap:p[3],supports:p[4],layer:p[5]};if(-1!==f)e[f].references++,e[f].updater(b);else{var x=r(b,i);i.byIndex=l,e.splice(l,0,{identifier:c,updater:x,references:1})}a.push(c)}return a}function r(t,e){var o=e.domAPI(e);return o.update(t),function(e){if(e){if(e.css===t.css&&e.media===t.media&&e.sourceMap===t.sourceMap&&e.supports===t.supports&&e.layer===t.layer)return;o.update(t=e)}else o.remove()}}t.exports=function(t,r){var n=i(t=t||[],r=r||{});return function(t){t=t||[];for(var a=0;a<n.length;a++){var l=o(n[a]);e[l].references--}for(var p=i(t,r),d=0;d<n.length;d++){var s=o(n[d]);0===e[s].references&&(e[s].updater(),e.splice(s,1))}n=p}}},5554:function(t){t.exports=function(){return this.Vue}()},6314:function(t){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var o="",i=void 0!==e[5];return e[4]&&(o+="@supports (".concat(e[4],") {")),e[2]&&(o+="@media ".concat(e[2]," {")),i&&(o+="@layer".concat(e[5].length>0?" ".concat(e[5]):""," {")),o+=t(e),i&&(o+="}"),e[2]&&(o+="}"),e[4]&&(o+="}"),o})).join("")},e.i=function(t,o,i,r,n){"string"==typeof t&&(t=[[null,t,void 0]]);var a={};if(i)for(var l=0;l<this.length;l++){var p=this[l][0];null!=p&&(a[p]=!0)}for(var d=0;d<t.length;d++){var s=[].concat(t[d]);i&&a[s[0]]||(void 0!==n&&(void 0===s[5]||(s[1]="@layer".concat(s[5].length>0?" ".concat(s[5]):""," {").concat(s[1],"}")),s[5]=n),o&&(s[2]?(s[1]="@media ".concat(s[2]," {").concat(s[1],"}"),s[2]=o):s[2]=o),r&&(s[4]?(s[1]="@supports (".concat(s[4],") {").concat(s[1],"}"),s[4]=r):s[4]="".concat(r)),e.push(s))}},e}},7659:function(t){"use strict";var e={};t.exports=function(t,o){var i=function(t){if(void 0===e[t]){var o=document.querySelector(t);if(window.HTMLIFrameElement&&o instanceof window.HTMLIFrameElement)try{o=o.contentDocument.head}catch(t){o=null}e[t]=o}return e[t]}(t);if(!i)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");i.appendChild(o)}},7825:function(t){"use strict";t.exports=function(t){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var e=t.insertStyleElement(t);return{update:function(o){!function(t,e,o){var i="";o.supports&&(i+="@supports (".concat(o.supports,") {")),o.media&&(i+="@media ".concat(o.media," {"));var r=void 0!==o.layer;r&&(i+="@layer".concat(o.layer.length>0?" ".concat(o.layer):""," {")),i+=o.css,r&&(i+="}"),o.media&&(i+="}"),o.supports&&(i+="}");var n=o.sourceMap;n&&"undefined"!=typeof btoa&&(i+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(n))))," */")),e.styleTagTransform(i,t,e.options)}(e,t,o)},remove:function(){!function(t){if(null===t.parentNode)return!1;t.parentNode.removeChild(t)}(e)}}}}},o={};function i(t){var r=o[t];if(void 0!==r)return r.exports;var n=o[t]={id:t,exports:{}};return e[t](n,n.exports,i),n.exports}i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,{a:e}),e},i.d=function(t,e){for(var o in e)i.o(e,o)&&!i.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:e[o]})},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.nc=void 0;var r={};return function(){"use strict";i.r(r),i.d(r,{default:function(){return v}});var t=function(){var t=this,e=t.$createElement,o=t._self._c||e;return o("div",{staticClass:"bpm-rich-text"},["table"==t.uiType?o("i",{staticClass:"el-icon-notebook-2",class:{active:t.curVal},on:{click:function(e){e.stopPropagation(),t.dialogVisible=!0}}}):o("el-tiptap",{attrs:{extensions:t.extensions,showMenubar:!t.readonly,readonly:t.readonly,placeholder:t.fieldConf.name},on:{onBlur:t.handleChange},model:{value:t.curVal,callback:function(e){t.curVal=e},expression:"curVal"}}),t._v(" "),"table"==t.uiType&&t.dialogVisible?o("el-dialog",{attrs:{title:t.fieldConf.name,visible:t.dialogVisible,width:"50%","before-close":t.handleClose},on:{"update:visible":function(e){t.dialogVisible=e}}},[o("el-tiptap",{attrs:{extensions:t.extensions,showMenubar:!t.readonly,readonly:t.readonly,placeholder:t.fieldConf.name},on:{onBlur:t.handleChange},model:{value:t.curVal,callback:function(e){t.curVal=e},expression:"curVal"}})],1):t._e()],1)};t._withStripped=!0;var e=i(5554),o=i.n(e),n=i(3533),a=i(5072),l=i.n(a),p=i(7825),d=i.n(p),s=i(7659),c=i.n(s),f=i(5056),b=i.n(f),x=i(540),u=i.n(x),m=i(1113),_=i.n(m),g=i(2419),h={};h.styleTagTransform=_(),h.setAttributes=b(),h.insert=c().bind(null,"head"),h.domAPI=d(),h.insertStyleElement=u(),l()(g.A,h),g.A&&g.A.locals&&g.A.locals,o().use(n.ElementTiptapPlugin,{lang:"en",spellcheck:!0});var w={name:"BpmRichText",components:{"el-tiptap":n.ElementTiptap},props:{value:String,fieldConf:Object,mode:String,uiType:String},data(){return{curVal:"",extensions:[new n.Doc,new n.Text,new n.Paragraph,new n.Heading({level:5}),new n.Bold,new n.Underline({bubble:!0,menubar:!1}),new n.Italic,new n.Strike({bubble:!0,menubar:!1}),new n.Link,new n.Blockquote,new n.Table,new n.TableHeader,new n.TableCell,new n.TableRow,new n.ListItem,new n.BulletList,new n.OrderedList,new n.TodoList,new n.TodoItem,new n.TextAlign,new n.Indent,new n.LineHeight,new n.TextColor,new n.TextHighlight,new n.FontType,new n.FontSize,new n.SelectAll,new n.FormatClear,new n.History,new n.Fullscreen],dialogVisible:!1}},computed:{readonly(){return"view"===this.mode}},watch:{value:{handler(t){this.curVal=t},immediate:!0}},methods:{handleClose(){this.dialogVisible=!1},handleChange(t){console.log(t),console.log("this.curVal: ",this.curVal),this.$emit("input",this.curVal),this.$emit("change",this.curVal)}},mounted(){}},y=(0,i(4486).A)(w,t,[],!1,null,null,null);y.options.__file="components/lib/bpmRichText/src/main.vue";var k=y.exports;k.install=function(t){t.component(k.name,k)};var v=k}(),r}()}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t(require("axios"),require("lodash"),require("qs")):"function"==typeof define&&define.amd?define(["axios","lodash","qs"],t):"object"==typeof exports?exports.bpm2=t(require("axios"),require("lodash"),require("qs")):e.bpm2=t(e.axios,e.lodash,e.qs)}(self,function(e,t,n){return function(){var r={9795:function(e,t,n){"use strict";n.d(t,{zC:function(){return a}});var r=n(6773),o=n.n(r),i=n(5360),s=n.n(i);function a(e,t={}){o().isFunction(e)&&(e=e(t));let n=o().get(e.match(/\?([^#]+)/),"1");if(n){let r=s().parse(n);r=function(...e){return o().assignIn({},...e)}(r,t),e=o().replace(e,n,s().stringify(r))}else e=e+"?"+s().stringify(t);return e}},6198:function(e,t,n){"use strict";var r=n(1601),o=n.n(r),i=n(6314);n.n(i)()(o()).push([e.id,".toolbar[data-v-efca8e58] {\n display: flex;\n flex-wrap: wrap;\n align-items: center;\n padding: 8px;\n border-bottom: 1px solid #e0e0e0;\n background-color: #fff;\n gap: 4px;\n}\n.upload-container[data-v-efca8e58] {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n border: 1px dashed #d9d9d9;\n border-radius: 6px;\n cursor: pointer;\n position: relative;\n overflow: hidden;\n padding: 20px;\n transition: border-color 0.3s;\n}\n.upload-container[data-v-efca8e58]:hover {\n border-color: #409EFF;\n}\n.toolbar-group[data-v-efca8e58] {\n display: flex;\n align-items: center;\n gap: 2px;\n}\n.toolbar-separator[data-v-efca8e58] {\n width: 1px;\n height: 20px;\n background-color: #e0e0e0;\n margin: 0 8px;\n}\n.toolbar-btn[data-v-efca8e58] {\n display: flex;\n align-items: center;\n justify-content: center;\n width: 28px;\n height: 28px;\n border: none;\n background: transparent;\n border-radius: 4px;\n cursor: pointer;\n color: #333;\n font-size: 14px;\n transition: background-color 0.2s;\n}\n.toolbar-btn[data-v-efca8e58]:hover {\n background-color: #f0f0f0;\n}\n.toolbar-btn.is-active[data-v-efca8e58] {\n background-color: #e8f0fe;\n color: #1a73e8;\n}\n.toolbar-btn[data-v-efca8e58]:disabled {\n opacity: 0.5;\n cursor: not-allowed;\n}\n.dropdown-wrapper[data-v-efca8e58] {\n position: relative;\n}\n.dropdown-trigger[data-v-efca8e58] {\n width: auto;\n padding: 0 8px;\n gap: 4px;\n}\n.dropdown-menu[data-v-efca8e58] {\n position: absolute;\n top: 100%;\n left: 0;\n background-color: #fff;\n border: 1px solid #e0e0e0;\n border-radius: 4px;\n box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);\n z-index: 1000;\n min-width: 150px;\n padding: 4px 0;\n}\n.color-picker-menu[data-v-efca8e58] {\n width: 210px;\n padding: 10px;\n}\n.color-grid[data-v-efca8e58] {\n display: grid;\n grid-template-columns: repeat(5, 1fr);\n gap: 5px;\n margin-bottom: 10px;\n}\n.color-item[data-v-efca8e58] {\n width: 30px;\n height: 30px;\n border-radius: 50%;\n cursor: pointer;\n border: 1px solid #ddd;\n transition: transform 0.1s;\n}\n.color-item[data-v-efca8e58]:hover {\n transform: scale(1.1);\n border-color: #999;\n}\n.color-item.is-selected[data-v-efca8e58] {\n border: 2px solid #409EFF;\n}\n.remove-color[data-v-efca8e58] {\n display: flex;\n align-items: center;\n justify-content: center;\n background-color: #f5f5f5;\n color: #666;\n font-size: 14px;\n}\n.hex-input-wrapper[data-v-efca8e58] {\n display: flex;\n gap: 5px;\n}\n.hex-input-wrapper input[data-v-efca8e58] {\n flex: 1;\n padding: 4px 8px;\n border: 1px solid #dcdfe6;\n border-radius: 4px;\n font-size: 12px;\n outline: none;\n}\n.hex-input-wrapper input[data-v-efca8e58]:focus {\n border-color: #409EFF;\n}\n.hex-input-wrapper button[data-v-efca8e58] {\n padding: 4px 10px;\n background-color: #fff;\n border: 1px solid #dcdfe6;\n border-radius: 4px;\n cursor: pointer;\n font-size: 12px;\n}\n.hex-input-wrapper button[data-v-efca8e58]:hover {\n color: #409EFF;\n border-color: #c6e2ff;\n background-color: #ecf5ff;\n}\n.dropdown-item[data-v-efca8e58] {\n padding: 6px 12px;\n cursor: pointer;\n font-size: 14px;\n}\n.dropdown-item[data-v-efca8e58]:hover {\n background-color: #f5f5f5;\n}\n.dropdown-item.is-active[data-v-efca8e58] {\n color: #1a73e8;\n background-color: #e8f0fe;\n}\n",""])},5762:function(e,t,n){"use strict";var r=n(1601),o=n.n(r),i=n(6314),s=n.n(i)()(o());s.push([e.id,"\n.image-resizer[data-v-f5376670] {\n display: inline-block;\n line-height: 0;\n}\n.image-wrapper[data-v-f5376670] {\n position: relative;\n display: inline-block;\n line-height: 0;\n max-width: 100%;\n}\n.image-wrapper img[data-v-f5376670] {\n display: block;\n max-width: 100%;\n}\n.resize-handle[data-v-f5376670] {\n position: absolute;\n right: -6px;\n bottom: -6px;\n width: 12px;\n height: 12px;\n background-color: #409EFF;\n border: 1px solid #fff;\n cursor: nwse-resize;\n border-radius: 50%;\n z-index: 10;\n display: none;\n}\n.image-wrapper:hover .resize-handle[data-v-f5376670] {\n display: block;\n}\n",""]),t.A=s},6314:function(e){"use strict";e.exports=function(e){var t=[];return t.toString=function(){return this.map(function(t){var n="",r=void 0!==t[5];return t[4]&&(n+="@supports (".concat(t[4],") {")),t[2]&&(n+="@media ".concat(t[2]," {")),r&&(n+="@layer".concat(t[5].length>0?" ".concat(t[5]):""," {")),n+=e(t),r&&(n+="}"),t[2]&&(n+="}"),t[4]&&(n+="}"),n}).join("")},t.i=function(e,n,r,o,i){"string"==typeof e&&(e=[[null,e,void 0]]);var s={};if(r)for(var a=0;a<this.length;a++){var l=this[a][0];null!=l&&(s[l]=!0)}for(var c=0;c<e.length;c++){var d=[].concat(e[c]);r&&s[d[0]]||(void 0!==i&&(void 0===d[5]||(d[1]="@layer".concat(d[5].length>0?" ".concat(d[5]):""," {").concat(d[1],"}")),d[5]=i),n&&(d[2]?(d[1]="@media ".concat(d[2]," {").concat(d[1],"}"),d[2]=n):d[2]=n),o&&(d[4]?(d[1]="@supports (".concat(d[4],") {").concat(d[1],"}"),d[4]=o):d[4]="".concat(o)),t.push(d))}},t}},1601:function(e){"use strict";e.exports=function(e){return e[1]}},5072:function(e){"use strict";var t=[];function n(e){for(var n=-1,r=0;r<t.length;r++)if(t[r].identifier===e){n=r;break}return n}function r(e,r){for(var i={},s=[],a=0;a<e.length;a++){var l=e[a],c=r.base?l[0]+r.base:l[0],d=i[c]||0,u="".concat(c," ").concat(d);i[c]=d+1;var h=n(u),p={css:l[1],media:l[2],sourceMap:l[3],supports:l[4],layer:l[5]};if(-1!==h)t[h].references++,t[h].updater(p);else{var f=o(p,r);r.byIndex=a,t.splice(a,0,{identifier:u,updater:f,references:1})}s.push(u)}return s}function o(e,t){var n=t.domAPI(t);return n.update(e),function(t){if(t){if(t.css===e.css&&t.media===e.media&&t.sourceMap===e.sourceMap&&t.supports===e.supports&&t.layer===e.layer)return;n.update(e=t)}else n.remove()}}e.exports=function(e,o){var i=r(e=e||[],o=o||{});return function(e){e=e||[];for(var s=0;s<i.length;s++){var a=n(i[s]);t[a].references--}for(var l=r(e,o),c=0;c<i.length;c++){var d=n(i[c]);0===t[d].references&&(t[d].updater(),t.splice(d,1))}i=l}}},7659:function(e){"use strict";var t={};e.exports=function(e,n){var r=function(e){if(void 0===t[e]){var n=document.querySelector(e);if(window.HTMLIFrameElement&&n instanceof window.HTMLIFrameElement)try{n=n.contentDocument.head}catch(e){n=null}t[e]=n}return t[e]}(e);if(!r)throw new Error("Couldn't find a style target. This probably means that the value for the 'insert' parameter is invalid.");r.appendChild(n)}},540:function(e){"use strict";e.exports=function(e){var t=document.createElement("style");return e.setAttributes(t,e.attributes),e.insert(t,e.options),t}},5056:function(e,t,n){"use strict";e.exports=function(e){var t=n.nc;t&&e.setAttribute("nonce",t)}},7825:function(e){"use strict";e.exports=function(e){if("undefined"==typeof document)return{update:function(){},remove:function(){}};var t=e.insertStyleElement(e);return{update:function(n){!function(e,t,n){var r="";n.supports&&(r+="@supports (".concat(n.supports,") {")),n.media&&(r+="@media ".concat(n.media," {"));var o=void 0!==n.layer;o&&(r+="@layer".concat(n.layer.length>0?" ".concat(n.layer):""," {")),r+=n.css,o&&(r+="}"),n.media&&(r+="}"),n.supports&&(r+="}");var i=n.sourceMap;i&&"undefined"!=typeof btoa&&(r+="\n/*# sourceMappingURL=data:application/json;base64,".concat(btoa(unescape(encodeURIComponent(JSON.stringify(i))))," */")),t.styleTagTransform(r,e,t.options)}(t,e,n)},remove:function(){!function(e){if(null===e.parentNode)return!1;e.parentNode.removeChild(e)}(t)}}}},1113:function(e){"use strict";e.exports=function(e,t){if(t.styleSheet)t.styleSheet.cssText=e;else{for(;t.firstChild;)t.removeChild(t.firstChild);t.appendChild(document.createTextNode(e))}}},4486:function(e,t,n){"use strict";function r(e,t,n,r,o,i,s,a){var l,c="function"==typeof e?e.options:e;if(t&&(c.render=t,c.staticRenderFns=n,c._compiled=!0),r&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),s?(l=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),o&&o.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(s)},c._ssrRegister=l):o&&(l=a?function(){o.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:o),l)if(c.functional){c._injectStyles=l;var d=c.render;c.render=function(e,t){return l.call(t),d(e,t)}}else{var u=c.beforeCreate;c.beforeCreate=u?[].concat(u,l):[l]}return{exports:e,options:c}}n.d(t,{A:function(){return r}})},2028:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNonPositive=t.isNonNegative=t.isPositive=t.isNegative=t.instanceOfProp=t.oneOfTypesProp=t.oneOfObjectKeysProp=t.oneOfProp=t.functionProp=t.objectProp=t.arrayProp=t.anyProp=t.vueComponentProp=t.symbolProp=t.integerProp=t.numberProp=t.booleanProp=t.stringProp=void 0;var r=n(6039);Object.defineProperty(t,"stringProp",{enumerable:!0,get:function(){return r.stringProp}});var o=n(8516);Object.defineProperty(t,"booleanProp",{enumerable:!0,get:function(){return o.booleanProp}});var i=n(8215);Object.defineProperty(t,"numberProp",{enumerable:!0,get:function(){return i.numberProp}});var s=n(3022);Object.defineProperty(t,"integerProp",{enumerable:!0,get:function(){return s.integerProp}});var a=n(8218);Object.defineProperty(t,"symbolProp",{enumerable:!0,get:function(){return a.symbolProp}});var l=n(8385);Object.defineProperty(t,"vueComponentProp",{enumerable:!0,get:function(){return l.vueComponentProp}});var c=n(7798);Object.defineProperty(t,"anyProp",{enumerable:!0,get:function(){return c.anyProp}});var d=n(7601);Object.defineProperty(t,"arrayProp",{enumerable:!0,get:function(){return d.arrayProp}});var u=n(9485);Object.defineProperty(t,"objectProp",{enumerable:!0,get:function(){return u.objectProp}});var h=n(554);Object.defineProperty(t,"functionProp",{enumerable:!0,get:function(){return h.functionProp}});var p=n(3677);Object.defineProperty(t,"oneOfProp",{enumerable:!0,get:function(){return p.oneOfProp}});var f=n(810);Object.defineProperty(t,"oneOfObjectKeysProp",{enumerable:!0,get:function(){return f.oneOfObjectKeysProp}});var m=n(5032);Object.defineProperty(t,"oneOfTypesProp",{enumerable:!0,get:function(){return m.oneOfTypesProp}});var g=n(2512);Object.defineProperty(t,"instanceOfProp",{enumerable:!0,get:function(){return g.instanceOfProp}});var v=n(915);Object.defineProperty(t,"isNegative",{enumerable:!0,get:function(){return v.isNegative}});var y=n(1611);Object.defineProperty(t,"isPositive",{enumerable:!0,get:function(){return y.isPositive}});var b=n(6);Object.defineProperty(t,"isNonNegative",{enumerable:!0,get:function(){return b.isNonNegative}});var k=n(8226);Object.defineProperty(t,"isNonPositive",{enumerable:!0,get:function(){return k.isNonPositive}})},7798:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.anyProp=void 0;const r=n(5726);t.anyProp=e=>(0,r.propOptionsGenerator)(void 0,e)},7601:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.arrayProp=void 0;const r=n(5726);t.arrayProp=e=>(0,r.propOptionsGenerator)(Array,e)},8516:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.booleanProp=void 0;const r=n(5726);t.booleanProp=e=>(0,r.propOptionsGenerator)(Boolean,e)},554:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.functionProp=void 0;const r=n(8214);t.functionProp=e=>({optional:{type:Function,required:!1,default:void 0,validator:(0,r.vuePropValidator)(e)},nullable:{type:Function,required:!1,default:null,validator:(0,r.vuePropValidator)(e)},required:{type:Function,required:!0,validator:(0,r.vuePropValidator)(e)}})},2512:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.instanceOfProp=void 0;const r=n(5726),o=n(8214);t.instanceOfProp=(e,t)=>(0,r.propOptionsGenerator)(e,t,(0,o.isInstanceOf)(e))},3022:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.integerProp=void 0;const r=n(5726),o=n(8214);t.integerProp=e=>(0,r.propOptionsGenerator)(Number,e,o.isInteger)},8215:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.numberProp=void 0;const r=n(5726);t.numberProp=e=>(0,r.propOptionsGenerator)(Number,e)},9485:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.objectProp=void 0;const r=n(5726);t.objectProp=e=>(0,r.propOptionsGenerator)(Object,e)},3677:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.oneOfProp=void 0;const r=n(5726),o=n(8214);t.oneOfProp=(e,t)=>(0,r.propOptionsGenerator)((e=>{const t=[...new Set(e.flatMap(e=>{var t;return null==e?[]:null!==(t=e.constructor)&&void 0!==t?t:[]}))];if(0!==t.length)return 1===t.length?t[0]:t})(e),t,(0,o.isOneOf)(e))},810:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.oneOfObjectKeysProp=void 0;const r=n(3677);t.oneOfObjectKeysProp=(e,t)=>(0,r.oneOfProp)(Object.keys(e),t)},5032:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.oneOfTypesProp=void 0;const r=n(5726);t.oneOfTypesProp=(e,t)=>(0,r.propOptionsGenerator)(e,t)},6039:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.stringProp=void 0;const r=n(5726);t.stringProp=e=>(0,r.propOptionsGenerator)(String,e)},8218:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.symbolProp=void 0;const r=n(5726),o=n(8214);t.symbolProp=e=>(0,r.propOptionsGenerator)(void 0,e,o.isSymbol)},8385:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.vueComponentProp=void 0;const r=n(5726);t.vueComponentProp=e=>(0,r.propOptionsGenerator)([Object,String],e)},5726:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.propOptionsGenerator=void 0;const r=n(8214);t.propOptionsGenerator=(e,t,...n)=>({optional:{type:e,required:!1,default:void 0,validator:(0,r.vuePropValidator)(t,...n)},nullable:{type:e,required:!1,default:null,validator:(0,r.vuePropValidator)(t,...n)},withDefault:o=>({type:e,required:!1,default:o,validator:(0,r.vuePropValidator)(t,...n)}),required:{type:e,required:!0,validator:(0,r.vuePropValidator)(t,...n)}})},8214:function(e,t,n){"use strict";var r=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.isSymbol=t.isOneOf=t.isInteger=t.isInstanceOf=t.vuePropValidator=void 0;const o=r(n(5554));t.vuePropValidator=function(e,...t){const n=e?[...t,e]:t;if(0!==n.length)return e=>{for(const t of n){const n=t(e);if(n)return"object"==typeof o.default&&"util"in o.default?o.default.util.warn(`${n} (received: '${String(e)}')`):console.warn(`${n} (received: '${String(e)}')`),!1}return!0}};var i=n(6842);Object.defineProperty(t,"isInstanceOf",{enumerable:!0,get:function(){return i.isInstanceOf}});var s=n(5720);Object.defineProperty(t,"isInteger",{enumerable:!0,get:function(){return s.isInteger}});var a=n(9179);Object.defineProperty(t,"isOneOf",{enumerable:!0,get:function(){return a.isOneOf}});var l=n(7968);Object.defineProperty(t,"isSymbol",{enumerable:!0,get:function(){return l.isSymbol}})},6842:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInstanceOf=void 0,t.isInstanceOf=e=>t=>{if(!(t instanceof e))return`value should be an instance of ${e.name}`}},5720:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isInteger=void 0,t.isInteger=e=>{if("number"!=typeof e||!Number.isInteger(e))return"value should be an integer"}},915:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNegative=void 0,t.isNegative=e=>{if("number"!=typeof e||e>=0||Number.isNaN(e))return"value should be a negative number"}},6:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNonNegative=void 0,t.isNonNegative=e=>{if("number"!=typeof e||e<0||Number.isNaN(e))return"value should be a non-negative number"}},8226:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isNonPositive=void 0,t.isNonPositive=e=>{if("number"!=typeof e||e>0||Number.isNaN(e))return"value should be a non-positive number"}},9179:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isOneOf=void 0,t.isOneOf=e=>t=>{if(!e.includes(t))return`value should be one of "${e.join('", "')}"`}},1611:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isPositive=void 0,t.isPositive=e=>{if("number"!=typeof e||e<=0||Number.isNaN(e))return"value should be a positive number"}},7968:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.isSymbol=void 0,t.isSymbol=e=>{if("symbol"!=typeof e)return"value should be a symbol"}},5554:function(e){e.exports=function(){return this.Vue}()},2742:function(t){"use strict";t.exports=e},6773:function(e){"use strict";e.exports=t},5360:function(e){"use strict";e.exports=n},9248:function(e,t,n){"use strict";var r,o=Object.defineProperty,i=Object.getOwnPropertyDescriptor,s=Object.getOwnPropertyNames,a=Object.prototype.hasOwnProperty,l=(e,t)=>{for(var n in t)o(e,n,{get:t[n],enumerable:!0})},c={};function d(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}l(c,{CommandManager:()=>u,Editor:()=>Pr,Extendable:()=>Qn,Extension:()=>ur,Fragment:()=>jr,InputRule:()=>Kn,MappablePosition:()=>Qt,Mark:()=>Zn,MarkView:()=>so,Node:()=>ao,NodePos:()=>Rr,NodeView:()=>co,PasteRule:()=>rr,ResizableNodeView:()=>_r,ResizableNodeview:()=>Vr,Tracker:()=>fo,callOrReturn:()=>ct,canInsertNode:()=>qr,combineTransactionSteps:()=>Xe,commands:()=>h,createAtomBlockMarkdownSpec:()=>Qr,createBlockMarkdownSpec:()=>Zr,createChainableState:()=>d,createDocument:()=>Ke,createElement:()=>Br,createInlineMarkdownSpec:()=>no,createMappablePosition:()=>en,createNodeFromContent:()=>te,createStyleTag:()=>Dr,defaultBlockAt:()=>Ye,deleteProps:()=>Re,elementFromString:()=>ee,escapeForRegEx:()=>Kr,extensions:()=>cr,findChildren:()=>Qe,findChildrenInRange:()=>Ze,findDuplicates:()=>wt,findParentNode:()=>tt,findParentNodeClosestToPos:()=>et,flattenExtensions:()=>rt,fromString:()=>gt,generateHTML:()=>Mt,generateJSON:()=>At,generateText:()=>Dt,getAttributes:()=>$t,getAttributesFromExtensions:()=>ht,getChangedRanges:()=>zt,getDebugJSON:()=>Lt,getExtensionField:()=>nt,getHTMLFromFragment:()=>st,getMarkAttributes:()=>Ue,getMarkRange:()=>z,getMarkType:()=>L,getMarksBetween:()=>Ft,getNodeAtPosition:()=>Ht,getNodeAttributes:()=>Pt,getNodeType:()=>S,getRenderedAttributes:()=>mt,getSchema:()=>Ct,getSchemaByResolvedExtensions:()=>kt,getSchemaTypeByName:()=>jt,getSchemaTypeNameByName:()=>Ne,getSplittedAttributes:()=>Bt,getText:()=>Nt,getTextBetween:()=>Et,getTextContentFromNodes:()=>_t,getTextSerializersFromSchema:()=>Rt,getUpdatedPosition:()=>Zt,h:()=>Br,injectExtensionAttributesToParseRule:()=>vt,inputRulesPlugin:()=>Gn,isActive:()=>Wt,isAndroid:()=>q,isAtEndOfNode:()=>qt,isAtStartOfNode:()=>Kt,isEmptyObject:()=>dt,isExtensionRulesEnabled:()=>Jt,isFirefox:()=>Jr,isFunction:()=>lt,isList:()=>Ut,isMacOS:()=>be,isMarkActive:()=>Vt,isNodeActive:()=>xe,isNodeEmpty:()=>Gt,isNodeSelection:()=>Yt,isNumber:()=>nr,isPlainObject:()=>Xn,isRegExp:()=>D,isSafari:()=>J,isString:()=>Ur,isTextSelection:()=>B,isiOS:()=>K,markInputRule:()=>$r,markPasteRule:()=>uo,markdown:()=>Gr,mergeAttributes:()=>ft,mergeDeep:()=>Yn,minMax:()=>V,nodeInputRule:()=>Ir,nodePasteRule:()=>ho,objectIncludes:()=>P,parseAttributes:()=>Xr,parseIndentedBlocks:()=>ro,pasteRulesPlugin:()=>ar,posToDOMRect:()=>tn,removeDuplicates:()=>It,renderNestedMarkdownContent:()=>oo,resolveExtensions:()=>St,resolveFocusPosition:()=>W,rewriteUnknownContent:()=>rn,selectionToInsertionEnd:()=>oe,serializeAttributes:()=>Yr,sortExtensions:()=>xt,splitExtensions:()=>ut,textInputRule:()=>Lr,textPasteRule:()=>po,textblockTypeInputRule:()=>zr,updateMarkViewAttributes:()=>io,wrappingInputRule:()=>Hr}),e.exports=(r=c,((e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let n of s(t))a.call(e,n)||void 0===n||o(e,n,{get:()=>t[n],enumerable:!(r=i(t,n))||r.enumerable});return e})(o({},"__esModule",{value:!0}),r));var u=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{const n=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!e,l=e||o.tr,c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{const r=this.buildProps(l,t),o=n(...e)(r);return s.push(o),c}])),run:()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every(e=>!0===e))};return c}createCan(e){const{rawCommands:t,state:n}=this,r=!1,o=e||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:e,editor:r,view:i,state:d({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},h={};l(h,{blur:()=>p,clearContent:()=>f,clearNodes:()=>g,command:()=>v,createParagraphNear:()=>b,cut:()=>w,deleteCurrentNode:()=>x,deleteNode:()=>C,deleteRange:()=>M,deleteSelection:()=>A,enter:()=>O,exitCode:()=>N,extendMarkRange:()=>F,first:()=>H,focus:()=>U,forEach:()=>G,insertContent:()=>X,insertContentAt:()=>ie,joinBackward:()=>ce,joinDown:()=>le,joinForward:()=>de,joinItemBackward:()=>he,joinItemForward:()=>fe,joinTextblockBackward:()=>ge,joinTextblockForward:()=>ye,joinUp:()=>ae,keyboardShortcut:()=>ke,lift:()=>Se,liftEmptyBlock:()=>Me,liftListItem:()=>Ae,newlineInCode:()=>Ee,resetAttributes:()=>De,scrollIntoView:()=>Pe,selectAll:()=>Ie,selectNodeBackward:()=>Le,selectNodeForward:()=>He,selectParentNode:()=>Be,selectTextblockEnd:()=>Ve,selectTextblockStart:()=>qe,setContent:()=>Je,setMark:()=>on,setMeta:()=>sn,setNode:()=>ln,setNodeSelection:()=>dn,setTextDirection:()=>un,setTextSelection:()=>pn,sinkListItem:()=>mn,splitBlock:()=>bn,splitListItem:()=>Sn,toggleList:()=>An,toggleMark:()=>On,toggleNode:()=>En,toggleWrap:()=>Nn,undoInputRule:()=>Rn,unsetAllMarks:()=>Dn,unsetMark:()=>Pn,unsetTextDirection:()=>$n,updateAttributes:()=>In,wrapIn:()=>Ln,wrapInList:()=>Hn});var p=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),f=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),m=n(6401),g=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return!n||(o.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;const{doc:r,mapping:o}=t,i=r.resolve(o.map(n)),s=r.resolve(o.map(n+e.nodeSize)),a=i.blockRange(s);if(!a)return;const l=(0,m.liftTarget)(a);if(e.type.isTextblock){const{defaultType:e}=i.parent.contentMatchAt(i.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},v=e=>t=>e(t),y=n(4007),b=()=>({state:e,dispatch:t})=>(0,y.createParagraphNear)(e,t),k=n(9162),w=(e,t)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const s=r.mapping.map(t);return r.insert(s,i.content),r.setSelection(new k.TextSelection(r.doc.resolve(Math.max(s-1,0)))),!0},x=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let n=o.depth;n>0;n-=1)if(o.node(n).type===r.type){if(t){const t=o.before(n),r=o.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function S(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var C=e=>({tr:t,state:n,dispatch:r})=>{const o=S(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1)if(i.node(e).type===o){if(r){const n=i.before(e),r=i.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},M=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},T=n(4007),A=()=>({state:e,dispatch:t})=>(0,T.deleteSelection)(e,t),O=()=>({commands:e})=>e.keyboardShortcut("Enter"),E=n(4007),N=()=>({state:e,dispatch:t})=>(0,E.exitCode)(e,t),R=n(9162);function D(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function P(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:D(t[r])?t[r].test(e[r]):t[r]===e[r])}function $(e,t,n={}){return e.find(e=>e.type===t&&P(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function I(e,t,n={}){return!!$(e,t,n)}function z(e,t,n){var r;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if(o.node&&o.node.marks.some(e=>e.type===t)||(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(e=>e.type===t))return;if(n=n||(null==(r=o.node.marks[0])?void 0:r.attrs),!$([...o.node.marks],t,n))return;let i=o.index,s=e.start()+o.offset,a=i+1,l=s+o.node.nodeSize;for(;i>0&&I([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&I([...e.parent.child(a).marks],t,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function L(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var F=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=L(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a;if(o){const e=z(l,i,t);if(e&&e.from<=c&&e.to>=d){const t=R.TextSelection.create(s,e.from,e.to);n.setSelection(t)}}return!0},H=e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1},j=n(9162);function B(e){return e instanceof j.TextSelection}var _=n(9162);function V(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function W(e,t=null){if(!t)return null;const n=_.Selection.atStart(e),r=_.Selection.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?_.TextSelection.create(e,V(0,o,i),V(e.content.size,o,i)):_.TextSelection.create(e,V(t,o,i),V(t,o,i))}function q(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function K(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function J(){return"undefined"!=typeof navigator&&/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}var U=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{(K()||q())&&r.dom.focus(),!J()||K()||q()||r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(i&&null===e&&!B(n.state.selection))return s(),!0;const a=W(o.doc,e)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},G=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),X=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Y=n(2386),Q=n(2386),Z=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&Z(r)}return e};function ee(e){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=(new window.DOMParser).parseFromString(t,"text/html").body;return Z(n)}function te(e,t,n){if(e instanceof Q.Node||e instanceof Q.Fragment)return e;n={slice:!0,parseOptions:{},...n};const r="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return Q.Fragment.fromArray(e.map(e=>t.nodeFromJSON(e)));const r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),te("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new Q.Schema({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,o="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?Q.DOMParser.fromSchema(i).parseSlice(ee(e),n.parseOptions):Q.DOMParser.fromSchema(i).parse(ee(e),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=Q.DOMParser.fromSchema(t);return n.slice?r.parseSlice(ee(e),n.parseOptions).content:r.parse(ee(e),n.parseOptions)}return te("",t,n)}var ne=n(9162),re=n(6401);function oe(e,t,n){const r=e.steps.length-1;if(r<t)return;const o=e.steps[r];if(!(o instanceof re.ReplaceStep||o instanceof re.ReplaceAroundStep))return;const i=e.mapping.maps[r];let s=0;i.forEach((e,t,n,r)=>{0===s&&(s=r)}),e.setSelection(ne.Selection.near(e.doc.resolve(s),n))}var ie=(e,t,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){let o;const a=e=>{i.emit("contentError",{editor:i,error:e,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},l={preserveWhitespace:"full",...(n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n}).parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{te(t,i.schema,{parseOptions:l,errorOnInvalidContent:!0})}catch(e){a(e)}try{o=te(t,i.schema,{parseOptions:l,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:i.options.enableContentCheck})}catch(e){return a(e),!1}let c,{from:d,to:u}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},h=!0,p=!0;if(("type"in o?[o]:o).forEach(e=>{e.check(),h=!!h&&e.isText&&0===e.marks.length,p=!!p&&e.isBlock}),d===u&&p){const{parent:e}=r.doc.resolve(d);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(d-=1,u+=1)}if(h){if(Array.isArray(t))c=t.map(e=>e.text||"").join("");else if(t instanceof Y.Fragment){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),c=e}else c="object"==typeof t&&t&&t.text?t.text:t;r.insertText(c,d,u)}else{c=o;const e=r.doc.resolve(d),t=e.node(),n=0===e.parentOffset,i=t.isText||t.isTextblock,s=t.content.size>0;n&&i&&s&&(d=Math.max(0,d-1)),r.replaceWith(d,u,c)}n.updateSelection&&oe(r,r.steps.length-1,-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:d,text:c}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:d,text:c})}return!0},se=n(4007),ae=()=>({state:e,dispatch:t})=>(0,se.joinUp)(e,t),le=()=>({state:e,dispatch:t})=>(0,se.joinDown)(e,t),ce=()=>({state:e,dispatch:t})=>(0,se.joinBackward)(e,t),de=()=>({state:e,dispatch:t})=>(0,se.joinForward)(e,t),ue=n(6401),he=()=>({state:e,dispatch:t,tr:n})=>{try{const r=(0,ue.joinPoint)(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},pe=n(6401),fe=()=>({state:e,dispatch:t,tr:n})=>{try{const r=(0,pe.joinPoint)(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},me=n(4007),ge=()=>({state:e,dispatch:t})=>(0,me.joinTextblockBackward)(e,t),ve=n(4007),ye=()=>({state:e,dispatch:t})=>(0,ve.joinTextblockForward)(e,t);function be(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var ke=e=>({editor:t,view:n,tr:r,dispatch:o})=>{const i=function(e){const t=e.split(/-(?!$)/);let n,r,o,i,s=t[t.length-1];"Space"===s&&(s=" ");for(let e=0;e<t.length-1;e+=1){const s=t[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))n=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else if(/^s(hift)?$/i.test(s))o=!0;else{if(!/^mod$/i.test(s))throw new Error(`Unrecognized modifier name: ${s}`);K()||be()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(e).split(/-(?!$)/),s=i.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{const t=e.map(r.mapping);t&&o&&r.maybeStep(t)}),!0},we=n(4007);function xe(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?S(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,(e,t)=>{if(e.isText)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);a.push({node:e,from:n,to:i})});const l=o-r,c=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>P(e.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=l}var Se=(e,t={})=>({state:n,dispatch:r})=>!!xe(n,S(e,n.schema),t)&&(0,we.lift)(n,r),Ce=n(4007),Me=()=>({state:e,dispatch:t})=>(0,Ce.liftEmptyBlock)(e,t),Te=n(5423),Ae=e=>({state:t,dispatch:n})=>{const r=S(e,t.schema);return(0,Te.liftListItem)(r)(t,n)},Oe=n(4007),Ee=()=>({state:e,dispatch:t})=>(0,Oe.newlineInCode)(e,t);function Ne(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function Re(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var De=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Ne("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=S(e,r.schema)),"mark"===a&&(s=L(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,Re(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(i=>{s===i.type&&(l=!0,o&&n.addMark(r,r+e.nodeSize,s.create(Re(i.attrs,t))))})})}),l},Pe=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),$e=n(9162),Ie=()=>({tr:e,dispatch:t})=>{if(t){const t=new $e.AllSelection(e.doc);e.setSelection(t)}return!0},ze=n(4007),Le=()=>({state:e,dispatch:t})=>(0,ze.selectNodeBackward)(e,t),Fe=n(4007),He=()=>({state:e,dispatch:t})=>(0,Fe.selectNodeForward)(e,t),je=n(4007),Be=()=>({state:e,dispatch:t})=>(0,je.selectParentNode)(e,t),_e=n(4007),Ve=()=>({state:e,dispatch:t})=>(0,_e.selectTextblockEnd)(e,t),We=n(4007),qe=()=>({state:e,dispatch:t})=>(0,We.selectTextblockStart)(e,t);function Ke(e,t,n={},r={}){return te(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var Je=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:l}=i;if("full"!==r.preserveWhitespace){const a=Ke(e,o.schema,r,{errorOnInvalidContent:null!=t?t:o.options.enableContentCheck});return s&&i.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:o.options.enableContentCheck})};function Ue(e,t){const n=L(t,e.schema),{from:r,to:o,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,e=>{s.push(...e.marks)});const a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}var Ge=n(6401);function Xe(e,t){const n=new Ge.Transform(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function Ye(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Qe(e,t){const n=[];return e.descendants((e,r)=>{t(e)&&n.push({node:e,pos:r})}),n}function Ze(e,t,n){const r=[];return e.nodesBetween(t.from,t.to,(e,t)=>{n(e)&&r.push({node:e,pos:t})}),r}function et(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function tt(e){return t=>et(t.$from,e)}function nt(e,t,n){return void 0===e.config[t]&&e.parent?nt(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?nt(e.parent,t,n):null}):e.config[t]}function rt(e){return e.map(e=>{const t=nt(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...rt(t())]:e}).flat(10)}var ot=n(2386),it=n(2386);function st(e,t){const n=it.DOMSerializer.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}var at=n(2386);function lt(e){return"function"==typeof e}function ct(e,t=void 0,...n){return lt(e)?t?e.bind(t)(...n):e(...n):e}function dt(e={}){return 0===Object.keys(e).length&&e.constructor===Object}function ut(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function ht(e){const t=[],{nodeExtensions:n,markExtensions:r}=ut(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...s,...a];return e.forEach(e=>{const n=nt(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?s:"marks"===e.types?a:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})})})})}),o.forEach(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=nt(e,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach(([n,r])=>{const o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&void 0===(null==o?void 0:o.default)&&delete o.default,t.push({type:e.name,name:n,attribute:o})})}),t}function pt(e){const t=[],n=function(e){const t=[];let n="",r=!1,o=!1,i=0;const s=e.length;for(let a=0;a<s;a+=1){const s=e[a];if("'"!==s||o)if('"'!==s||r){if(!r&&!o){if("("===s){i+=1,n+=s;continue}if(")"===s&&i>0){i-=1,n+=s;continue}if(";"===s&&0===i){t.push(n),n="";continue}}n+=s}else o=!o,n+=s;else r=!r,n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){const r=n[e],o=r.indexOf(":");if(-1===o)continue;const i=r.slice(0,o).trim(),s=r.slice(o+1).trim();i&&s&&t.push([i,s])}return t}function ft(...e){return e.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([e,t])=>{if(n[e])if("class"===e){const r=t?String(t).split(" "):[],o=n[e]?n[e].split(" "):[],i=r.filter(e=>!o.includes(e));n[e]=[...o,...i].join(" ")}else if("style"===e){const r=new Map([...pt(n[e]),...pt(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t;else n[e]=t}),n},{})}function mt(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>ft(e,t),{})}function gt(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}function vt(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;const o=t.reduce((e,t)=>{const r=t.attribute.parseHTML?t.attribute.parseHTML(n):gt(n.getAttribute(t.name));return null==r?e:{...e,[t.name]:r}},{});return{...r,...o}}}}function yt(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>("attrs"!==e||!dt(t))&&null!=t))}function bt(e){var t,n;const r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),void 0!==(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)&&(r.validate=e.attribute.validate),[e.name,r]}function kt(e,t){var n;const r=ht(e),{nodeExtensions:o,markExtensions:i}=ut(e),s=null==(n=o.find(e=>nt(e,"topNode")))?void 0:n.name,a=Object.fromEntries(o.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=yt({...e.reduce((e,t)=>{const r=nt(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:ct(nt(n,"content",i)),marks:ct(nt(n,"marks",i)),group:ct(nt(n,"group",i)),inline:ct(nt(n,"inline",i)),atom:ct(nt(n,"atom",i)),selectable:ct(nt(n,"selectable",i)),draggable:ct(nt(n,"draggable",i)),code:ct(nt(n,"code",i)),whitespace:ct(nt(n,"whitespace",i)),linebreakReplacement:ct(nt(n,"linebreakReplacement",i)),defining:ct(nt(n,"defining",i)),isolating:ct(nt(n,"isolating",i)),attrs:Object.fromEntries(o.map(bt))}),a=ct(nt(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>vt(e,o)));const l=nt(n,"renderHTML",i);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:mt(e,o)}));const c=nt(n,"renderText",i);return c&&(s.toText=c),[n.name,s]})),l=Object.fromEntries(i.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=yt({...e.reduce((e,t)=>{const r=nt(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:ct(nt(n,"inclusive",i)),excludes:ct(nt(n,"excludes",i)),group:ct(nt(n,"group",i)),spanning:ct(nt(n,"spanning",i)),code:ct(nt(n,"code",i)),attrs:Object.fromEntries(o.map(bt))}),a=ct(nt(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>vt(e,o)));const l=nt(n,"renderHTML",i);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:mt(e,o)})),[n.name,s]}));return new at.Schema({topNode:s,nodes:a,marks:l})}function wt(e){const t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}function xt(e){return e.sort((e,t)=>{const n=nt(e,"priority")||100,r=nt(t,"priority")||100;return n>r?-1:n<r?1:0})}function St(e){const t=xt(rt(e)),n=wt(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),t}function Ct(e,t){return kt(St(e),t)}function Mt(e,t){const n=Ct(t);return st(ot.Node.fromJSON(n,e).content,n)}var Tt=n(2386);function At(e,t){const n=Ct(t),r=ee(e);return Tt.DOMParser.fromSchema(n).parse(r).toJSON()}var Ot=n(2386);function Et(e,t,n){const{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let a="";return e.nodesBetween(r,o,(e,n,l,c)=>{var d;e.isBlock&&n>r&&(a+=i);const u=null==s?void 0:s[e.type.name];if(u)return l&&(a+=u({node:e,pos:n,parent:l,index:c,range:t})),!1;e.isText&&(a+=null==(d=null==e?void 0:e.text)?void 0:d.slice(Math.max(r,n)-n,o-n))}),a}function Nt(e,t){return Et(e,{from:0,to:e.content.size},t)}function Rt(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Dt(e,t,n){const{blockSeparator:r="\n\n",textSerializers:o={}}=n||{},i=Ct(t);return Nt(Ot.Node.fromJSON(i,e),{blockSeparator:r,textSerializers:{...Rt(i),...o}})}function Pt(e,t){const n=S(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,e=>{i.push(e)});const s=i.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}function $t(e,t){const n=Ne("string"==typeof t?t:t.name,e.schema);return"node"===n?Pt(e,t):"mark"===n?Ue(e,t):{}}function It(e,t=JSON.stringify){const n={};return e.filter(e=>{const r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}function zt(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,o)=>{const i=[];if(e.ranges.length)e.forEach((e,t)=>{i.push({from:e,to:t})});else{const{from:e,to:t}=n[o];if(void 0===e||void 0===t)return;i.push({from:e,to:t})}i.forEach(({from:e,to:n})=>{const i=t.slice(o).map(e,-1),s=t.slice(o).map(n),a=t.invert().map(i,-1),l=t.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:i,to:s}})})}),function(e){const t=It(e);return 1===t.length?t:t.filter((e,n)=>!t.filter((e,t)=>t!==n).some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to))}(r)}function Lt(e,t=0){const n=e.type===e.type.schema.topNodeType?0:1,r=t,o=r+e.nodeSize,i=e.marks.map(e=>{const t={type:e.type.name};return Object.keys(e.attrs).length&&(t.attrs={...e.attrs}),t}),s={...e.attrs},a={type:e.type.name,from:r,to:o};return Object.keys(s).length&&(a.attrs=s),i.length&&(a.marks=i),e.content.childCount&&(a.content=[],e.forEach((e,r)=>{var o;null==(o=a.content)||o.push(Lt(e,t+r+n))})),e.text&&(a.text=e.text),a}function Ft(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(t=>{const o=z(n.resolve(e),t.type);o&&r.push({mark:t,...o})}):n.nodesBetween(e,t,(e,t)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}var Ht=(e,t,n,r=20)=>{const o=e.doc.resolve(n);let i=r,s=null;for(;i>0&&null===s;){const e=o.node(i);(null==e?void 0:e.type.name)===t?s=e:i-=1}return[s,i]};function jt(e,t){return t.nodes[e]||t.marks[e]||null}function Bt(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}var _t=(e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,o,i)=>{var s,a;const l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n};function Vt(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?L(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>P(e.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:t,$to:n})=>{const r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,(e,t)=>{if(i&&e.inlineContent&&!e.type.allowsMarkType(i))return!1;if(!e.isText&&!e.marks.length)return;const n=Math.max(r,t),l=Math.min(o,t+e.nodeSize);s+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===s)return!1;const l=a.filter(e=>!i||i.name===e.mark.type.name).filter(e=>P(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=a.filter(e=>!i||e.mark.type!==i&&e.mark.type.excludes(i)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+c:l)>=s}function Wt(e,t,n={}){if(!t)return xe(e,null,n)||Vt(e,null,n);const r=Ne(t,e.schema);return"node"===r?xe(e,t,n):"mark"===r&&Vt(e,t,n)}var qt=(e,t)=>{const{$from:n,$to:r,$anchor:o}=e.selection;if(t){const n=tt(e=>e.type.name===t)(e.selection);if(!n)return!1;const r=e.doc.resolve(n.pos+1);return o.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},Kt=e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)};function Jt(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function Ut(e,t){const{nodeExtensions:n}=ut(t),r=n.find(t=>t.name===e);if(!r)return!1;const o=ct(nt(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Gt(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(Gt(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}var Xt=n(9162);function Yt(e){return e instanceof Xt.NodeSelection}var Qt=class e{constructor(e){this.position=e}static fromJSON(t){return new e(t.position)}toJSON(){return{position:this.position}}};function Zt(e,t){const n=t.mapping.mapResult(e.position);return{position:new Qt(n.pos),mapResult:n}}function en(e){return new Qt(e)}function tn(e,t,n){const r=e.state.doc.content.size,o=V(t,0,r),i=V(n,0,r),s=e.coordsAtPos(o),a=e.coordsAtPos(i,-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 nn({json:e,validMarks:t,validNodes:n,options:r,rewrittenContent:o=[]}){return e.marks&&Array.isArray(e.marks)&&(e.marks=e.marks.filter(e=>{const n="string"==typeof e?e:e.type;return!!t.has(n)||(o.push({original:JSON.parse(JSON.stringify(e)),unsupported:n}),!1)})),e.content&&Array.isArray(e.content)&&(e.content=e.content.map(e=>nn({json:e,validMarks:t,validNodes:n,options:r,rewrittenContent:o}).json).filter(e=>null!=e)),e.type&&!n.has(e.type)?(o.push({original:JSON.parse(JSON.stringify(e)),unsupported:e.type}),e.content&&Array.isArray(e.content)&&!1!==(null==r?void 0:r.fallbackToParagraph)?(e.type="paragraph",{json:e,rewrittenContent:o}):{json:null,rewrittenContent:o}):{json:e,rewrittenContent:o}}function rn(e,t,n){return nn({json:e,validNodes:new Set(Object.keys(t.nodes)),validMarks:new Set(Object.keys(t.marks)),options:n})}var on=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=L(e,r.schema);if(o)if(s){const e=Ue(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{const o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,(e,r)=>{const s=Math.max(r,o),a=Math.min(r+e.nodeSize,i);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})});return function(e,t,n){var r;const{selection:o}=t;let i=null;if(B(o)&&(i=o.$cursor),i){const t=null!=(r=e.storedMarks)?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:t,$to:r})=>{let o=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(o)return!1;if(e.isInline){const t=!r||r.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));o=t&&i}return!o}),o})}(r,n,l)},sn=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),an=n(4007),ln=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=S(e,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:e})=>!!(0,an.setBlockType)(i,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>(0,an.setBlockType)(i,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},cn=n(9162),dn=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=V(e,0,n.content.size),o=cn.NodeSelection.create(n,r);t.setSelection(o)}return!0},un=(e,t)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,a;return"number"==typeof t?(s=t,a=t):t&&"from"in t&&"to"in t?(s=t.from,a=t.to):(s=i.from,a=i.to),o&&n.doc.nodesBetween(s,a,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},hn=n(9162),pn=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=hn.TextSelection.atStart(n).from,s=hn.TextSelection.atEnd(n).to,a=V(r,i,s),l=V(o,i,s),c=hn.TextSelection.create(n,a,l);t.setSelection(c)}return!0},fn=n(5423),mn=e=>({state:t,dispatch:n})=>{const r=S(e,t.schema);return(0,fn.sinkListItem)(r)(t,n)},gn=n(9162),vn=n(6401);function yn(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var bn=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,c=Bt(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof gn.NodeSelection&&i.node.isBlock)return!(!a.parentOffset||!(0,vn.canSplit)(s,a.pos)||(r&&(e&&yn(n,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),0));if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,u=0===a.depth?void 0:Ye(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&u?[{type:u,attrs:c}]:void 0,p=(0,vn.canSplit)(t.doc,t.mapping.map(a.pos),1,h);if(h||p||!(0,vn.canSplit)(t.doc,t.mapping.map(a.pos),1,u?[{type:u}]:void 0)||(p=!0,h=u?[{type:u,attrs:c}]:void 0),r){if(p&&(i instanceof gn.TextSelection&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,h),u&&!d&&!a.parentOffset&&a.parent.type!==u)){const e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,u)&&t.setNodeMarkup(t.mapping.map(a.before()),u)}e&&yn(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return p},kn=n(2386),wn=n(9162),xn=n(6401),Sn=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const a=S(e,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;const u=l.node(-1);if(u.type!==a)return!1;const h=i.extensionManager.attributes;if(0===l.parent.content.size&&l.node(-1).childCount===l.indexAfter(-1)){if(2===l.depth||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(o){let e=kn.Fragment.empty;const r=l.index(-1)?1:l.index(-2)?2:3;for(let t=l.depth-r;t>=l.depth-3;t-=1)e=kn.Fragment.from(l.node(t).copy(e));const o=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,i={...Bt(h,l.node().type.name,l.node().attrs),...t},c=(null==(s=a.contentMatch.defaultType)?void 0:s.createAndFill(i))||void 0;e=e.append(kn.Fragment.from(a.createAndFill(null,c)||void 0));const d=l.before(l.depth-(r-1));n.replace(d,l.after(-o),new kn.Slice(e,4-r,0));let u=-1;n.doc.nodesBetween(d,n.doc.content.size,(e,t)=>{if(u>-1)return!1;e.isTextblock&&0===e.content.size&&(u=t+1)}),u>-1&&n.setSelection(wn.TextSelection.near(n.doc.resolve(u))),n.scrollIntoView()}return!0}const p=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,f={...Bt(h,u.type.name,u.attrs),...t},m={...Bt(h,l.node().type.name,l.node().attrs),...t};n.delete(l.pos,c.pos);const g=p?[{type:a,attrs:f},{type:p,attrs:m}]:[{type:a,attrs:f}];if(!(0,xn.canSplit)(n.doc,l.pos,2))return!1;if(o){const{selection:e,storedMarks:t}=r,{splittableMarks:s}=i.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(l.pos,2,g).scrollIntoView(),!a||!o)return!0;const c=a.filter(e=>s.includes(e.type.name));n.ensureMarks(c)}return!0},Cn=n(6401),Mn=(e,t)=>{const n=tt(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!(0,Cn.canJoin)(e.doc,n.pos)||(e.join(n.pos),!0)},Tn=(e,t)=>{const n=tt(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!(0,Cn.canJoin)(e.doc,r)||(e.join(r),!0)},An=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=o.extensionManager,p=S(e,s.schema),f=S(t,s.schema),{selection:m,storedMarks:g}=s,{$from:v,$to:y}=m,b=v.blockRange(y),k=g||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;const w=tt(e=>Ut(e.type.name,u))(m);if(b.depth>=1&&w&&b.depth-w.depth<=1){if(w.node.type===p)return c.liftListItem(f);if(Ut(w.node.type.name,u)&&p.validContent(w.node.content)&&a)return l().command(()=>(i.setNodeMarkup(w.pos,p),!0)).command(()=>Mn(i,p)).command(()=>Tn(i,p)).run()}return n&&k&&a?l().command(()=>{const e=d().wrapInList(p,r),t=k.filter(e=>h.includes(e.type.name));return i.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>Mn(i,p)).command(()=>Tn(i,p)).run():l().command(()=>!!d().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>Mn(i,p)).command(()=>Tn(i,p)).run()},On=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=L(e,r.schema);return Vt(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},En=(e,t,n={})=>({state:r,commands:o})=>{const i=S(e,r.schema),s=S(t,r.schema),a=xe(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},Nn=(e,t={})=>({state:n,commands:r})=>{const o=S(e,n.schema);return xe(n,o,t)?r.lift(o):r.wrapIn(o,t)},Rn=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){const t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){const n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},Dn=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},Pn=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=L(e,r.schema),{$from:c,empty:d,ranges:u}=a;if(!o)return!0;if(d&&s){let{from:e,to:t}=a;const r=null==(i=c.marks().find(e=>e.type===l))?void 0:i.attrs,o=z(c,l,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,l)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},$n=e=>({tr:t,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return"number"==typeof e?(i=e,s=e):e&&"from"in e&&"to"in e?(i=e.from,s=e.to):(i=o.from,s=o.to),r&&t.doc.nodesBetween(i,s,(e,n)=>{if(e.isText)return;const r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},In=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=Ne("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=S(e,r.schema)),"mark"===a&&(s=L(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{const a=e.$from.pos,c=e.$to.pos;let d,u,h,p;n.selection.empty?r.doc.nodesBetween(a,c,(e,t)=>{i&&i===e.type&&(l=!0,h=Math.max(t,a),p=Math.min(t+e.nodeSize,c),d=t,u=e)}):r.doc.nodesBetween(a,c,(e,r)=>{r<a&&i&&i===e.type&&(l=!0,h=Math.max(r,a),p=Math.min(r+e.nodeSize,c),d=r,u=e),r>=a&&r<=c&&(i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(i=>{if(s===i.type&&(l=!0,o)){const o=Math.max(r,a),l=Math.min(r+e.nodeSize,c);n.addMark(o,l,s.create({...i.attrs,...t}))}}))}),u&&(void 0!==d&&o&&n.setNodeMarkup(d,void 0,{...u.attrs,...t}),s&&u.marks.length&&u.marks.forEach(e=>{s===e.type&&o&&n.addMark(h,p,s.create({...e.attrs,...t}))}))}),l},zn=n(4007),Ln=(e,t={})=>({state:n,dispatch:r})=>{const o=S(e,n.schema);return(0,zn.wrapIn)(o,t)(n,r)},Fn=n(5423),Hn=(e,t={})=>({state:n,dispatch:r})=>{const o=S(e,n.schema);return(0,Fn.wrapInList)(o,t)(n,r)},jn=n(9162),Bn=n(990),_n=class{constructor(){this.callbacks={}}on(e,t){return this.callbacks[e]||(this.callbacks[e]=[]),this.callbacks[e].push(t),this}emit(e,...t){const n=this.callbacks[e];return n&&n.forEach(e=>e.apply(this,t)),this}off(e,t){const n=this.callbacks[e];return n&&(t?this.callbacks[e]=n.filter(e=>e!==t):delete this.callbacks[e]),this}once(e,t){const n=(...r)=>{this.off(e,n),t.apply(this,r)};return this.on(e,n)}removeAllListeners(){this.callbacks={}}},Vn=n(7048),Wn=n(2386),qn=n(9162),Kn=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}},Jn=(e,t)=>{if(D(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r};function Un(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let h=!1;const p=_t(c)+i;return s.forEach(e=>{if(h)return;const t=Jn(p,e.find);if(!t)return;const s=l.state.tr,c=d({state:l.state,transaction:s}),f={from:r-(t[0].length-i.length),to:o},{commands:m,chain:g,can:v}=new u({editor:n,state:c});null!==e.handler({state:c,range:f,match:t,commands:m,chain:g,can:v})&&s.steps.length&&(e.undoable&&s.setMeta(a,{transform:s,from:r,to:o,text:i}),l.dispatch(s),h=!0)}),h}function Gn(e){const{editor:t,rules:n}=e,r=new qn.Plugin({state:{init(){return null},apply(e,o,i){const s=e.getMeta(r);if(s)return s;const a=e.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{text:e}=a;"string"==typeof e||(e=st(Wn.Fragment.from(e),i.schema));const{from:o}=a,s=o+e.length;Un({editor:t,from:o,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput(e,o,i,s){return Un({editor:t,from:o,to:i,text:s,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:o}=e.state.selection;o&&Un({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,o){if("Enter"!==o.key)return!1;const{$cursor:i}=e.state.selection;return!!i&&Un({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}function Xn(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function Yn(e,t){const n={...e};return Xn(e)&&Xn(t)&&Object.keys(t).forEach(r=>{Xn(t[r])&&Xn(e[r])?n[r]=Yn(e[r],t[r]):n[r]=t[r]}),n}var Qn=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...ct(nt(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...ct(nt(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>Yn(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},Zn=class e extends Qn{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!o.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;const i=o.find(e=>(null==e?void 0:e.type.name)===t.name);return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},er=n(2386),tr=n(9162);function nr(e){return"number"==typeof e}var rr=class{constructor(e){this.find=e.find,this.handler=e.handler}},or=(e,t,n)=>{if(D(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(t=>{const n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]},ir=null,sr=e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n};function ar(e){const{editor:t,rules:n}=e;let r,o=null,i=!1,s=!1,a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const l=({state:e,from:n,to:o,rule:i,pasteEvt:s})=>{const l=e.tr,c=d({state:e,transaction:l}),h=function(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:d}=new u({editor:t,state:n}),h=[];return n.doc.nodesBetween(r,o,(e,t)=>{var u,p,f,m,g;if((null==(p=null==(u=e.type)?void 0:u.spec)?void 0:p.code)||!(e.isText||e.isTextblock||e.isInline))return;const v=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,y=Math.max(r,t),b=Math.min(o,t+v);if(y>=b)return;const k=e.isText?e.text||"":e.textBetween(y-t,b-t,void 0,"");or(k,i.find,s).forEach(e=>{if(void 0===e.index)return;const t=y+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},u=i.handler({state:n,range:o,match:e,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});h.push(u)})}),h.every(e=>null!==e)}({editor:t,state:c,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:s,dropEvent:r});if(h&&l.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return a="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,l}};return n.map(e=>new tr.Plugin({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(ir=t)},r=()=>{ir&&(ir=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(s=o===e.dom.parentElement,r=t,!s){const e=ir;(null==e?void 0:e.isEditable)&&setTimeout(()=>{const t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;const r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return a=t,i=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{const o=t[0],c="paste"===o.getMeta("uiEvent")&&!i,d="drop"===o.getMeta("uiEvent")&&!s,u=o.getMeta("applyPasteRules"),h=!!u;if(!c&&!d&&!h)return;if(h){let{text:t}=u;"string"==typeof t||(t=st(er.Fragment.from(t),r.schema));const{from:n}=u,o=n+t.length,i=sr(t);return l({rule:e,state:r,from:n,to:{b:o},pasteEvt:i})}const p=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);return nr(p)&&f&&p!==f.b?l({rule:e,state:r,from:p,to:f,pasteEvt:a}):void 0}}))}var lr=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=St(e),this.schema=kt(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=nt(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:jt(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this;return xt([...this.extensions].reverse()).flatMap(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:jt(t.name,this.schema)},r=[],o=nt(t,"addKeyboardShortcuts",n);let i={};if("mark"===t.type&&nt(t,"exitable",n)&&(i.ArrowRight=()=>Zn.handleExit({editor:e,mark:t})),o){const t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));i={...i,...t}}const s=(0,Vn.keymap)(i);r.push(s);const a=nt(t,"addInputRules",n);if(Jt(t,e.options.enableInputRules)&&a){const t=a();if(t&&t.length){const n=Gn({editor:e,rules:t}),o=Array.isArray(n)?n:[n];r.push(...o)}}const l=nt(t,"addPasteRules",n);if(Jt(t,e.options.enablePasteRules)&&l){const t=l();if(t&&t.length){const n=ar({editor:e,rules:t});r.push(...n)}}const c=nt(t,"addProseMirrorPlugins",n);if(c){const e=c();r.push(...e)}return r})}get attributes(){return ht(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=ut(this.extensions);return Object.fromEntries(t.filter(e=>!!nt(e,"addNodeView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:S(t.name,this.schema)},o=nt(t,"addNodeView",r);if(!o)return[];const i=o();return i?[t.name,(r,o,s,a,l)=>{const c=mt(r,n);return i({node:r,view:o,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}dispatchTransaction(e){const{editor:t}=this;return xt([...this.extensions].reverse()).reduceRight((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:jt(n.name,this.schema)},o=nt(n,"dispatchTransaction",r);return o?t=>{o.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){const{editor:t}=this;return xt([...this.extensions]).reduce((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:jt(n.name,this.schema)},o=nt(n,"transformPastedHTML",r);return o?(t,n)=>{const i=e(t,n);return o.call(r,i)}:e},e||(e=>e))}get markViews(){const{editor:e}=this,{markExtensions:t}=ut(this.extensions);return Object.fromEntries(t.filter(e=>!!nt(e,"addMarkView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:L(t.name,this.schema)},o=nt(t,"addMarkView",r);return o?[t.name,(r,i,s)=>{const a=mt(r,n);return o()({mark:r,view:i,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{io(r,e,t)}})}]:[]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:jt(e.name,this.schema)};"mark"===e.type&&(null==(t=ct(nt(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);const r=nt(e,"onBeforeCreate",n),o=nt(e,"onCreate",n),i=nt(e,"onUpdate",n),s=nt(e,"onSelectionUpdate",n),a=nt(e,"onTransaction",n),l=nt(e,"onFocus",n),c=nt(e,"onBlur",n),d=nt(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),i&&this.editor.on("update",i),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)})}};lr.resolve=St,lr.sort=xt,lr.flatten=rt;var cr={};l(cr,{ClipboardTextSerializer:()=>hr,Commands:()=>pr,Delete:()=>mr,Drop:()=>vr,Editable:()=>br,FocusEvents:()=>xr,Keymap:()=>Cr,Paste:()=>Tr,Tabindex:()=>Or,TextDirection:()=>Nr,focusEventsPluginKey:()=>wr});var dr=n(9162),ur=class e extends Qn{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},hr=ur.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new dr.Plugin({key:new dr.PluginKey("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o,s=Math.min(...i.map(e=>e.$from.pos)),a=Math.max(...i.map(e=>e.$to.pos)),l=Rt(n);return Et(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),pr=ur.create({name:"commands",addCommands(){return{...h}}}),fr=n(6401),mr=ur.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,o;const i=()=>{var n,r,o,i;if(null!=(i=null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:o.call(r,e))?i:e.getMeta("y-sync$"))return;const s=Xe(e.before,[e,...t]);zt(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{const o=r+n.nodeSize-2,i=t.oldRange.from<=r&&o<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:s.mapping.map(r),newTo:s.mapping.map(o),deletedRange:t.oldRange,newRange:t.newRange,partial:!i,editor:this.editor,transaction:e,combinedTransform:s})})});const a=s.mapping;s.steps.forEach((t,n)=>{var r,o;if(t instanceof fr.RemoveMarkStep){const i=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),c=a.invert().map(i,-1),d=a.invert().map(l),u=null==(r=s.doc.nodeAt(i-1))?void 0:r.marks.some(e=>e.eq(t.mark)),h=null==(o=s.doc.nodeAt(l))?void 0:o.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:d},newRange:{from:i,to:l},partial:Boolean(h||u),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||o?setTimeout(i,0):i()}}),gr=n(9162),vr=ur.create({name:"drop",addProseMirrorPlugins(){return[new gr.Plugin({key:new gr.PluginKey("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),yr=n(9162),br=ur.create({name:"editable",addProseMirrorPlugins(){return[new yr.Plugin({key:new yr.PluginKey("editable"),props:{editable:()=>this.editor.options.editable}})]}}),kr=n(9162),wr=new kr.PluginKey("focusEvents"),xr=ur.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new kr.Plugin({key:wr,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Sr=n(9162),Cr=ur.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{const{selection:n,doc:r}=t,{empty:o,$anchor:i}=n,{pos:s,parent:a}=i,l=i.parent.isTextblock&&s>0?t.doc.resolve(s-1):i,c=l.parent.type.spec.isolating,d=i.pos-i.parentOffset,u=c&&1===l.parent.childCount?d===i.pos:Sr.Selection.atStart(r).from===s;return!(!o||!a.type.isTextblock||a.textContent.length||!u||u&&"paragraph"===i.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return K()||be()?o:r},addProseMirrorPlugins(){return[new Sr.Plugin({key:new Sr.PluginKey("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;const r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),o=e.some(e=>e.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:a}=t.selection,l=Sr.Selection.atStart(t.doc).from,c=Sr.Selection.atEnd(t.doc).to;if(i||s!==l||a!==c)return;if(!Gt(n.doc))return;const h=n.tr,p=d({state:n,transaction:h}),{commands:f}=new u({editor:this.editor,state:p});return f.clearNodes(),h.steps.length?h:void 0}})]}}),Mr=n(9162),Tr=ur.create({name:"paste",addProseMirrorPlugins(){return[new Mr.Plugin({key:new Mr.PluginKey("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),Ar=n(9162),Or=ur.create({name:"tabindex",addProseMirrorPlugins(){return[new Ar.Plugin({key:new Ar.PluginKey("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Er=n(9162),Nr=ur.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=ut(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return!t||"ltr"!==t&&"rtl"!==t&&"auto"!==t?this.options.direction:t},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Er.Plugin({key:new Er.PluginKey("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}}),Rr=class e{constructor(e,t,n=!1,r=null){this.currentNode=null,this.actualDepth=null,this.isBlock=n,this.resolvedPos=e,this.editor=t,this.currentNode=r}get name(){return this.node.type.name}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var e;return null!=(e=this.actualDepth)?e:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(e){let t=this.from,n=this.to;if(this.isBlock){if(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}`);t=this.from+1,n=this.to-1}this.editor.commands.insertContentAt({from:t,to:n},e)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(0===this.depth)return null;const t=this.resolvedPos.start(this.resolvedPos.depth-1),n=this.resolvedPos.doc.resolve(t);return new e(n,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new e(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new e(t,this.editor)}get children(){const t=[];return this.node.content.forEach((n,r)=>{const o=n.isBlock&&!n.isTextblock,i=n.isAtom&&!n.isText,s=n.isInline,a=this.pos+r+(i?0:1);if(a<0||a>this.resolvedPos.doc.nodeSize-2)return;const l=this.resolvedPos.doc.resolve(a);if(!o&&!s&&l.depth<=this.depth)return;const c=new e(l,this.editor,o,o||s?n:null);o&&(c.actualDepth=this.depth+1),t.push(c)}),t}get firstChild(){return this.children[0]||null}get lastChild(){const e=this.children;return e[e.length-1]||null}closest(e,t={}){let n=null,r=this.parent;for(;r&&!n;){if(r.node.type.name===e)if(Object.keys(t).length>0){const e=r.node.attrs,n=Object.keys(t);for(let r=0;r<n.length;r+=1){const o=n[r];if(e[o]!==t[o])break}}else n=r;r=r.parent}return n}querySelector(e,t={}){return this.querySelectorAll(e,t,!0)[0]||null}querySelectorAll(e,t={},n=!1){let r=[];if(!this.children||0===this.children.length)return r;const o=Object.keys(t);return this.children.forEach(i=>{n&&r.length>0||(i.node.type.name===e&&o.every(e=>t[e]===i.node.attrs[e])&&r.push(i),n&&r.length>0||(r=r.concat(i.querySelectorAll(e,t,n))))}),r}setAttribute(e){const{tr:t}=this.editor.state;t.setNodeMarkup(this.from,void 0,{...this.node.attrs,...e}),this.editor.view.dispatch(t)}};function Dr(e,t,n){const r=document.querySelector(`style[data-tiptap-style${n?`-${n}`:""}]`);if(null!==r)return r;const o=document.createElement("style");return t&&o.setAttribute("nonce",t),o.setAttribute("data-tiptap-style"+(n?`-${n}`:""),""),o.innerHTML=e,document.getElementsByTagName("head")[0].appendChild(o),o}var Pr=class extends _n{constructor(e={}){super(),this.css=null,this.className="tiptap",this.editorView=null,this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.instanceId=Math.random().toString(36).slice(2,9),this.options={element:"undefined"!=typeof document?document.createElement("div"):null,content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,textDirection:void 0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,emitContentError:!1,onBeforeCreate:()=>null,onCreate:()=>null,onMount:()=>null,onUnmount:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null,onDelete:()=>null,enableExtensionDispatchTransaction:!0},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.utils={getUpdatedPosition:Zt,createMappablePosition:en},this.setOptions(e),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("mount",this.options.onMount),this.on("unmount",this.options.onUnmount),this.on("contentError",this.options.onContentError),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:t,moved:n})=>this.options.onDrop(e,t,n)),this.on("paste",({event:e,slice:t})=>this.options.onPaste(e,t)),this.on("delete",this.options.onDelete);const t=this.createDoc(),n=W(t,this.options.autofocus);this.editorState=jn.EditorState.create({doc:t,schema:this.schema,selection:n||void 0}),this.options.element&&this.mount(this.options.element)}mount(e){if("undefined"==typeof document)throw new Error("[tiptap error]: The editor cannot be mounted because there is no 'document' defined in this environment.");this.createView(e),this.emit("mount",{editor:this}),this.css&&!document.head.contains(this.css)&&document.head.appendChild(this.css),window.setTimeout(()=>{this.isDestroyed||(!1!==this.options.autofocus&&null!==this.options.autofocus&&this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}unmount(){if(this.editorView){const e=this.editorView.dom;(null==e?void 0:e.editor)&&delete e.editor,this.editorView.destroy()}if(this.editorView=null,this.isInitialized=!1,this.css&&!document.querySelectorAll(`.${this.className}`).length)try{"function"==typeof this.css.remove?this.css.remove():this.css.parentNode&&this.css.parentNode.removeChild(this.css)}catch(e){console.warn("Failed to remove CSS element:",e)}this.css=null,this.emit("unmount",{editor:this})}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&"undefined"!=typeof document&&(this.css=Dr('.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}',this.options.injectNonce))}setOptions(e={}){this.options={...this.options,...e},this.editorView&&this.state&&!this.isDestroyed&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(e,t=!0){this.setOptions({editable:e}),t&&this.emit("update",{editor:this,transaction:this.state.tr,appendedTransactions:[]})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get view(){return this.editorView?this.editorView:new Proxy({state:this.editorState,updateState:e=>{this.editorState=e},dispatch:e=>{this.dispatchTransaction(e)},composing:!1,dragging:null,editable:!0,isDestroyed:!1},{get:(e,t)=>{if(this.editorView)return this.editorView[t];if("state"===t)return this.editorState;if(t in e)return Reflect.get(e,t);throw new Error(`[tiptap error]: The editor view is not available. Cannot access view['${t}']. The editor may not be mounted yet.`)}})}get state(){return this.editorView&&(this.editorState=this.view.state),this.editorState}registerPlugin(e,t){const n=lt(t)?t(e,[...this.state.plugins]):[...this.state.plugins,e],r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}unregisterPlugin(e){if(this.isDestroyed)return;const t=this.state.plugins;let n=t;if([].concat(e).forEach(e=>{const t="string"==typeof e?`${e}$`:e.key;n=n.filter(e=>!e.key.startsWith(t))}),t.length===n.length)return;const r=this.state.reconfigure({plugins:n});return this.view.updateState(r),r}createExtensionManager(){var e,t;const n=[...this.options.enableCoreExtensions?[br,hr.configure({blockSeparator:null==(t=null==(e=this.options.coreExtensionOptions)?void 0:e.clipboardTextSerializer)?void 0:t.blockSeparator}),pr,xr,Cr,Or,vr,Tr,mr,Nr.configure({direction:this.options.textDirection})].filter(e=>"object"!=typeof this.options.enableCoreExtensions||!1!==this.options.enableCoreExtensions[e.name]):[],...this.options.extensions].filter(e=>["extension","node","mark"].includes(null==e?void 0:e.type));this.extensionManager=new lr(n,this)}createCommandManager(){this.commandManager=new u({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createDoc(){let e;try{e=Ke(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(t){if(!(t instanceof Error&&["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(t.message)))throw t;this.emit("contentError",{editor:this,error:t,disableCollaboration:()=>{"collaboration"in this.storage&&"object"==typeof this.storage.collaboration&&this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(e=>"collaboration"!==e.name),this.createExtensionManager()}}),e=Ke(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}return e}createView(e){const{editorProps:t,enableExtensionDispatchTransaction:n}=this.options,r=t.dispatchTransaction||this.dispatchTransaction.bind(this),o=n?this.extensionManager.dispatchTransaction(r):r,i=t.transformPastedHTML,s=this.extensionManager.transformPastedHTML(i);this.editorView=new Bn.EditorView(e,{...t,attributes:{role:"textbox",...null==t?void 0:t.attributes},dispatchTransaction:o,transformPastedHTML:s,state:this.editorState,markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews});const a=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(a),this.prependClass(),this.injectCSS(),this.view.dom.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({markViews:this.extensionManager.markViews,nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`${this.className} ${this.view.dom.className}`}captureTransaction(e){this.isCapturingTransaction=!0,e(),this.isCapturingTransaction=!1;const t=this.capturedTransaction;return this.capturedTransaction=null,t}dispatchTransaction(e){if(this.view.isDestroyed)return;if(this.isCapturingTransaction)return this.capturedTransaction?void e.steps.forEach(e=>{var t;return null==(t=this.capturedTransaction)?void 0:t.step(e)}):void(this.capturedTransaction=e);const{state:t,transactions:n}=this.state.applyTransaction(e),r=!this.state.selection.eq(t.selection),o=n.includes(e),i=this.state;if(this.emit("beforeTransaction",{editor:this,transaction:e,nextState:t}),!o)return;this.view.updateState(t),this.emit("transaction",{editor:this,transaction:e,appendedTransactions:n.slice(1)}),r&&this.emit("selectionUpdate",{editor:this,transaction:e});const s=n.findLast(e=>e.getMeta("focus")||e.getMeta("blur")),a=null==s?void 0:s.getMeta("focus"),l=null==s?void 0:s.getMeta("blur");a&&this.emit("focus",{editor:this,event:a.event,transaction:s}),l&&this.emit("blur",{editor:this,event:l.event,transaction:s}),e.getMeta("preventUpdate")||!n.some(e=>e.docChanged)||i.doc.eq(t.doc)||this.emit("update",{editor:this,transaction:e,appendedTransactions:n.slice(1)})}getAttributes(e){return $t(this.state,e)}isActive(e,t){const n="string"==typeof e?e:null,r="string"==typeof e?t:e;return Wt(this.state,n,r)}getJSON(){return this.state.doc.toJSON()}getHTML(){return st(this.state.doc.content,this.schema)}getText(e){const{blockSeparator:t="\n\n",textSerializers:n={}}=e||{};return Nt(this.state.doc,{blockSeparator:t,textSerializers:{...Rt(this.schema),...n}})}get isEmpty(){return Gt(this.state.doc)}destroy(){this.emit("destroy"),this.unmount(),this.removeAllListeners()}get isDestroyed(){var e,t;return null==(t=null==(e=this.editorView)?void 0:e.isDestroyed)||t}$node(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelector(e,t))||null}$nodes(e,t){var n;return(null==(n=this.$doc)?void 0:n.querySelectorAll(e,t))||null}$pos(e){const t=this.state.doc.resolve(e);return new Rr(t,this)}get $doc(){return this.$pos(0)}};function $r(e){return new Kn({find:e.find,handler:({state:t,range:n,match:r})=>{const o=ct(e.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=t,s=r[r.length-1],a=r[0];if(s){const r=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(Ft(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>l).length)return null;c<n.to&&i.delete(c,n.to),l>n.from&&i.delete(n.from+r,l);const d=n.from+r+s.length;i.addMark(n.from+r,d,e.type.create(o||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function Ir(e){return new Kn({find:e.find,handler:({state:t,range:n,match:r})=>{const o=ct(e.getAttributes,void 0,r)||{},{tr:i}=t,s=n.from;let a=n.to;const l=e.type.create(o);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;const t=r[0][r[0].length-1];i.insertText(t,s+r[0].length-1),i.replaceWith(e,a,l)}else if(r[0]){const t=e.type.isInline?s:s-1;i.insert(t,e.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()},undoable:e.undoable})}function zr(e){return new Kn({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=ct(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)},undoable:e.undoable})}function Lr(e){return new Kn({find:e.find,handler:({state:t,range:n,match:r})=>{let o=e.replace,i=n.from;const s=n.to;if(r[1]){const e=r[0].lastIndexOf(r[1]);o+=r[0].slice(e+r[1].length),i+=e;const t=i-s;t>0&&(o=r[0].slice(e-t,e)+o,i=s)}t.tr.insertText(o,i,s)},undoable:e.undoable})}var Fr=n(6401);function Hr(e){return new Kn({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{const i=ct(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&(0,Fr.findWrapping)(a,e.type,i);if(!l)return null;if(s.wrap(a,l),e.keepMarks&&e.editor){const{selection:n,storedMarks:r}=t,{splittableMarks:o}=e.editor.extensionManager,i=r||n.$to.parentOffset&&n.$from.marks();if(i){const e=i.filter(e=>o.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){const t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";o().updateAttributes(t,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&(0,Fr.canJoin)(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)},undoable:e.undoable})}function jr(e){return e.children}var Br=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);const{children:n,...r}=null!=t?t:{};if("svg"===e)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},_r=class{constructor(e){var t,n,r,o,i,s;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;const t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;const t=e.touches[0];if(!t)return;const n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;const e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,(null==(t=e.options)?void 0:t.min)&&(this.minSize={...this.minSize,...e.options.min}),(null==(n=e.options)?void 0:n.max)&&(this.maxSize=e.options.max),(null==(r=null==e?void 0:e.options)?void 0:r.directions)&&(this.directions=e.options.directions),(null==(o=e.options)?void 0:o.preserveAspectRatio)&&(this.preserveAspectRatio=e.options.preserveAspectRatio),(null==(i=e.options)?void 0:i.className)&&(this.classNames={container:e.options.className.container||"",wrapper:e.options.className.wrapper||"",handle:e.options.className.handle||"",resizing:e.options.className.resizing||""}),(null==(s=e.options)?void 0:s.createCustomHandle)&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var e;return null!=(e=this.contentElement)?e:null}handleEditorUpdate(){const e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,n))}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const e=document.createElement("div");return e.dataset.resizeContainer="",e.dataset.node=this.node.type.name,e.style.display="flex",this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){const e=document.createElement("div");return e.style.position="relative",e.style.display="block",e.dataset.resizeWrapper="",this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){const t=document.createElement("div");return t.dataset.resizeHandle=e,t.style.position="absolute",this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){const n=t.includes("top"),r=t.includes("bottom"),o=t.includes("left"),i=t.includes("right");n&&(e.style.top="0"),r&&(e.style.bottom="0"),o&&(e.style.left="0"),i&&(e.style.right="0"),"top"!==t&&"bottom"!==t||(e.style.left="0",e.style.right="0"),"left"!==t&&"right"!==t||(e.style.top="0",e.style.bottom="0")}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener("mousedown",t=>this.handleResizeStart(t,e)),t.addEventListener("touchstart",t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){const e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,"touches"in e?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:o}=this.calculateNewDimensions(this.activeHandle,e,t),i=this.applyConstraints(r,o,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,o=this.startHeight;const i=e.includes("right"),s=e.includes("left"),a=e.includes("bottom"),l=e.includes("top");return i?r=this.startWidth+t:s&&(r=this.startWidth-t),a?o=this.startHeight+n:l&&(o=this.startHeight-n),"right"!==e&&"left"!==e||(r=this.startWidth+(i?t:-t)),"top"!==e&&"bottom"!==e||(o=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,o,e):{width:r,height:o}}applyConstraints(e,t,n){var r,o,i,s;if(!n){let n=Math.max(this.minSize.width,e),i=Math.max(this.minSize.height,t);return(null==(r=this.maxSize)?void 0:r.width)&&(n=Math.min(this.maxSize.width,n)),(null==(o=this.maxSize)?void 0:o.height)&&(i=Math.min(this.maxSize.height,i)),{width:n,height:i}}let a=e,l=t;return a<this.minSize.width&&(a=this.minSize.width,l=a/this.aspectRatio),l<this.minSize.height&&(l=this.minSize.height,a=l*this.aspectRatio),(null==(i=this.maxSize)?void 0:i.width)&&a>this.maxSize.width&&(a=this.maxSize.width,l=a/this.aspectRatio),(null==(s=this.maxSize)?void 0:s.height)&&l>this.maxSize.height&&(l=this.maxSize.height,a=l*this.aspectRatio),{width:a,height:l}}applyAspectRatio(e,t,n){const r="top"===n||"bottom"===n;return"left"===n||"right"===n?{width:e,height:e/this.aspectRatio}:r?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}},Vr=_r,Wr=n(9162);function qr(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof Wr.NodeSelection){const e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let o=r.depth;for(;o>=0;){const e=r.index(o);if(r.node(o).contentMatchAt(e).matchType(t))return!0;o-=1}return!1}function Kr(e){return e.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function Jr(){return"undefined"!=typeof navigator&&/Firefox/.test(navigator.userAgent)}function Ur(e){return"string"==typeof e}var Gr={};function Xr(e){if(!(null==e?void 0:e.trim()))return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const e=o.map(e=>e.trim().slice(1));t.class=e.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(t.id=i[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var o;const i=parseInt((null==(o=r.match(/__QUOTED_(\d+)__/))?void 0:o[1])||"0",10),s=n[i];s&&(t[e]=s.slice(1,-1))});const s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return s&&s.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function Yr(e){if(!e||0===Object.keys(e).length)return"";const t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function Qr(e){const{nodeName:t,name:n,parseAttributes:r=Xr,serializeAttributes:o=Yr,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:a}=e,l=n||t;return{parseMarkdown:(e,n)=>{const r={...i,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,o){const i=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=e.match(i);if(!a)return;const c=a[1]||"",d=r(c);return s.find(e=>!(e in d))?void 0:{type:t,raw:a[0],attributes:d}}},renderMarkdown:e=>{const t=(e=>{if(!a)return e;const t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),n=o(t);return`:::${l}${n?` {${n}}`:""} :::`}}}function Zr(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=Xr,serializeAttributes:i=Yr,defaultAttributes:s={},content:a="block",allowedAttributes:l}=e,c=n||t;return{parseMarkdown:(e,n)=>{let o;if(r){const t=r(e);o="string"==typeof t?[{type:"text",text:t}]:t}else o="block"===a?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);const i={...s,...e.attributes};return n.createNode(t,i,o)},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${c}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var i;const s=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(s);if(!l)return;const[d,u=""]=l,h=o(u);let p=1;const f=d.length;let m="";const g=/^:::([\w-]*)(\s.*)?/gm,v=e.slice(f);for(g.lastIndex=0;;){const n=g.exec(v);if(null===n)break;const o=n.index,s=n[1];if(!(null==(i=n[2])?void 0:i.endsWith(":::")))if(s)p+=1;else if(p-=1,0===p){const i=v.slice(0,o);m=i.trim();const s=e.slice(0,f+o+n[0].length);let l=[];if(m)if("block"===a)for(l=r.blockTokens(i),l.forEach(e=>{!e.text||e.tokens&&0!==e.tokens.length||(e.tokens=r.inlineTokens(e.text))});l.length>0;){const e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=r.inlineTokens(m);return{type:t,raw:s,attributes:h,content:m,tokens:l}}}}},renderMarkdown:(e,t)=>{const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),r=i(n),o=r?` {${r}}`:"",s=t.renderChildren(e.content||[],"\n\n");return`:::${c}${o}\n\n${s}\n\n:::`}}}function eo(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;null!==r;){const[,o,i,s]=r;t[o]=i||s,r=n.exec(e)}return t}function to(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function no(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=eo,serializeAttributes:i=to,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=e,c=n||t,d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{const o={...s,...e.attributes};if(a)return n.createNode(t,o);const i=r?r(e):e.content||"";return i?n.createNode(t,o,[n.createTextNode(i)]):n.createNode(t,o,[])},markdownTokenizer:{name:t,level:"inline",start(e){const t=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){const i=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),s=e.match(i);if(!s)return;let l="",c="";if(a){const[,e]=s;c=e}else{const[,e,t]=s;c=e,l=t||""}const u=o(c.trim());return{type:t,raw:s[0],content:l.trim(),attributes:u}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{const r="string"==typeof n?n:n.name,o="string"==typeof n?void 0:n.skipIfDefault;if(r in e){const n=e[r];if(void 0!==o&&n===o)return;t[r]=n}}),t})(e.attrs||{}),o=i(n),s=o?` ${o}`:"";return a?`[${c}${s}]`:`[${c}${s}]${t}[/${c}]`}}}function ro(e,t,n){var r,o,i,s;const a=e.split("\n"),l=[];let c="",d=0;const u=t.baseIndentSize||2;for(;d<a.length;){const e=a[d],h=e.match(t.itemPattern);if(!h){if(l.length>0)break;if(""===e.trim()){d+=1,c=`${c}${e}\n`;continue}return}const p=t.extractItemData(h),{indentLevel:f,mainContent:m}=p;c=`${c}${e}\n`;const g=[m];for(d+=1;d<a.length;){const e=a[d];if(""===e.trim()){const t=a.slice(d+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(o=null==(r=a[d+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:o.length)||0)>f){g.push(e),c=`${c}${e}\n`,d+=1;continue}break}if(!(((null==(s=null==(i=e.match(/^(\s*)/))?void 0:i[1])?void 0:s.length)||0)>f))break;g.push(e),c=`${c}${e}\n`,d+=1}let v;const y=g.slice(1);if(y.length>0){const e=y.map(e=>e.slice(f+u)).join("\n");e.trim()&&(v=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}const b=t.createToken(p,v);l.push(b)}if(0!==l.length)return{items:l,raw:c}}function oo(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const o="function"==typeof n?n(r):n,[i,...s]=e.content,a=[`${o}${t.renderChildren([i])}`];return s&&s.length>0&&s.forEach(e=>{const n=t.renderChildren([e]);if(n){const e=n.split("\n").map(e=>e?t.indent(e):"").join("\n");a.push(e)}}),a.join("\n")}function io(e,t,n={}){const{state:r}=t,{doc:o,tr:i}=r,s=e;o.descendants((t,r)=>{const o=i.mapping.map(r),a=i.mapping.map(r)+t.nodeSize;let l=null;if(t.marks.forEach(e=>{if(e!==s)return!1;l=e}),!l)return;let c=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(c=!0)}),c){const t=e.type.create({...e.attrs,...n});i.removeMark(o,a,e.type),i.addMark(o,a,t)}}),i.docChanged&&t.view.dispatch(i)}l(Gr,{createAtomBlockMarkdownSpec:()=>Qr,createBlockMarkdownSpec:()=>Zr,createInlineMarkdownSpec:()=>no,parseAttributes:()=>Xr,parseIndentedBlocks:()=>ro,renderNestedMarkdownContent:()=>oo,serializeAttributes:()=>Yr});var so=class{constructor(e,t,n){this.component=e,this.editor=t.editor,this.options={...n},this.mark=t.mark,this.HTMLAttributes=t.HTMLAttributes}get dom(){return this.editor.view.dom}get contentDOM(){return null}updateAttributes(e,t){io(t||this.mark,this.editor,e)}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):"selection"!==e.type&&(!(this.dom.contains(e.target)&&"childList"===e.type&&(K()||q())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target))))}},ao=class e extends Qn{constructor(){super(...arguments),this.type="node"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},lo=n(9162),co=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,n,r,o,i,s,a;const{view:l}=this.editor,c=e.target,d=3===c.nodeType?null==(t=c.parentElement)?void 0:t.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(null==(n=this.contentDOM)?void 0:n.contains(c))||!d)return;let u=0,h=0;if(this.dom!==d){const t=this.dom.getBoundingClientRect(),n=d.getBoundingClientRect(),a=null!=(o=e.offsetX)?o:null==(r=e.nativeEvent)?void 0:r.offsetX,l=null!=(s=e.offsetY)?s:null==(i=e.nativeEvent)?void 0:i.offsetY;u=n.x-t.x+a,h=n.y-t.y+l}const p=this.dom.cloneNode(!0);try{const e=this.dom.getBoundingClientRect();p.style.width=`${Math.round(e.width)}px`,p.style.height=`${Math.round(e.height)}px`,p.style.boxSizing="border-box",p.style.pointerEvents="none"}catch{}let f=null;try{f=document.createElement("div"),f.style.position="absolute",f.style.top="-9999px",f.style.left="-9999px",f.style.pointerEvents="none",f.appendChild(p),document.body.appendChild(f),null==(a=e.dataTransfer)||a.setDragImage(p,u,h)}finally{f&&setTimeout(()=>{try{null==f||f.remove()}catch{}},0)}const m=this.getPos();if("number"!=typeof m)return;const g=lo.NodeSelection.create(l.state.doc,m),v=l.state.tr.setSelection(g);l.dispatch(v)}stopEvent(e){var t;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:e});const n=e.target;if(!this.dom.contains(n)||(null==(t=this.contentDOM)?void 0:t.contains(n)))return!1;const r=e.type.startsWith("drag"),o="drop"===e.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o&&!r)return!0;const{isEditable:i}=this.editor,{isDragging:s}=this,a=!!this.node.type.spec.draggable,l=lo.NodeSelection.isSelectable(this.node),c="copy"===e.type,d="paste"===e.type,u="cut"===e.type,h="mousedown"===e.type;if(!a&&l&&r&&e.target===this.dom&&e.preventDefault(),a&&r&&!s&&e.target===this.dom)return e.preventDefault(),!1;if(a&&i&&!s&&h){const e=n.closest("[data-drag-handle]");e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(s||o||c||d||u||h&&l)}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!(!this.node.isLeaf&&!this.node.isAtom)||"selection"!==e.type&&(!(this.dom.contains(e.target)&&"childList"===e.type&&(K()||q())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target))))}updateAttributes(e){this.editor.commands.command(({tr:t})=>{const n=this.getPos();return"number"==typeof n&&(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if("number"!=typeof e)return;const t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function uo(e){return new rr({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=ct(e.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=t,a=r[r.length-1],l=r[0];let c=n.to;if(a){const r=l.search(/\S/),o=n.from+l.indexOf(a),d=o+a.length;if(Ft(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>o).length)return null;d<n.to&&s.delete(d,n.to),o>n.from&&s.delete(n.from+r,o),c=n.from+r+a.length,s.addMark(n.from+r,c,e.type.create(i||{})),s.removeStoredMark(e.type)}}})}function ho(e){return new rr({find:e.find,handler({match:t,chain:n,range:r,pasteEvent:o}){const i=ct(e.getAttributes,void 0,t,o),s=ct(e.getContent,void 0,i);if(!1===i||null===i)return null;const a={type:e.type.name,attrs:i};s&&(a.content=s),t.input&&n().deleteRange(r).insertContentAt(r.from,a)}})}function po(e){return new rr({find:e.find,handler:({state:t,range:n,match:r})=>{let o=e.replace,i=n.from;const s=n.to;if(r[1]){const e=r[0].lastIndexOf(r[1]);o+=r[0].slice(e+r[1].length),i+=e;const t=i-s;t>0&&(o=r[0].slice(e-t,e)+o,i=s)}t.tr.insertText(o,i,s)}})}var fo=class{constructor(e){this.transaction=e,this.currentStep=this.transaction.steps.length}map(e){let t=!1;return{position:this.transaction.steps.slice(this.currentStep).reduce((e,n)=>{const r=n.getMap().mapResult(e);return r.deleted&&(t=!0),r.pos},e),deleted:t}}}},4007:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(7449);r=o,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{t.hasOwnProperty(e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},7048:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(8136);r=o,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{t.hasOwnProperty(e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},2386:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(7712);r=o,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{t.hasOwnProperty(e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},5423:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(4243);r=o,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{t.hasOwnProperty(e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},9162:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(7820);r=o,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{t.hasOwnProperty(e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},6401:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(6553);r=o,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{t.hasOwnProperty(e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},990:function(e,t,n){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r,o=n(9454);r=o,Object.keys(r).filter(e=>"default"!==e&&"__esModule"!==e).forEach(e=>{t.hasOwnProperty(e)||Object.defineProperty(t,e,{enumerable:!0,configurable:!0,get:()=>r[e]})})},9842:function(e,t,n){"use strict";var r,o=Object.create,i=Object.defineProperty,s=Object.getOwnPropertyDescriptor,a=Object.getOwnPropertyNames,l=Object.getPrototypeOf,c=Object.prototype.hasOwnProperty,d=(e,t,n,r)=>{if(t&&"object"==typeof t||"function"==typeof t)for(let o of a(t))c.call(e,o)||o===n||i(e,o,{get:()=>t[o],enumerable:!(r=s(t,o))||r.enumerable});return e},u={};((e,t)=>{for(var n in t)i(e,n,{get:t[n],enumerable:!0})})(u,{Editor:()=>p,EditorContent:()=>f,NodeViewContent:()=>m,NodeViewWrapper:()=>g,VueNodeViewRenderer:()=>C,VueRenderer:()=>w,nodeViewProps:()=>x}),e.exports=(r=u,d(i({},"__esModule",{value:!0}),r));var h=n(9248),p=class extends h.Editor{constructor(){super(...arguments),this.contentComponent=null}},f={name:"EditorContent",props:{editor:{default:null,type:Object}},watch:{editor:{immediate:!0,handler(e){e&&e.options.element&&this.$nextTick(()=>{var t;const n=this.$el;n&&(null==(t=e.view.dom)?void 0:t.parentNode)&&(n.append(...e.view.dom.parentNode.childNodes),e.contentComponent=this,e.setOptions({element:n}),e.createNodeViews())})}}},render(e){return e("div")},beforeDestroy(){var e;const{editor:t}=this;if(!t)return;if(t.isDestroyed||t.view.setProps({nodeViews:{}}),t.contentComponent=null,!(null==(e=t.view.dom)?void 0:e.parentNode))return;const n=document.createElement("div");n.append(...t.view.dom.parentNode.childNodes),t.setOptions({element:n})}},m={props:{as:{type:String,default:"div"}},render(e){return e(this.as,{style:{whiteSpace:"pre-wrap"},attrs:{"data-node-view-content":""}})}},g={props:{as:{type:String,default:"div"}},inject:["onDragStart","decorationClasses"],render(e){return e(this.as,{class:this.decorationClasses.value,style:{whiteSpace:"normal"},attrs:{"data-node-view-wrapper":""},on:{dragstart:this.onDragStart}},this.$slots.default)}},v=n(9248),y=n(2028),b=((e,t,n)=>(n=null!=e?o(l(e)):{},d(i(n,"default",{value:e,enumerable:!0}),e)))(n(5554)),k=b.default,w=class{constructor(e,t){const n="function"==typeof e?e:k.extend(e);this.ref=new n(t).$mount()}get element(){return this.ref.$el}updateProps(e={}){var t,n,r;if(!this.ref.$props)return;const o=null!=(r=null==(n=null==(t=this.ref.$props.editor)?void 0:t.contentComponent)?void 0:n.$options._base)?r:k,i=o.config.silent;o.config.silent=!0,Object.entries(e).forEach(([e,t])=>{this.ref.$props[e]=t}),o.config.silent=i}destroy(){this.ref.$destroy()}},x={editor:(0,y.objectProp)().required,node:(0,y.objectProp)().required,decorations:(0,y.objectProp)().required,selected:(0,y.booleanProp)().required,extension:(0,y.objectProp)().required,getPos:(0,y.functionProp)().required,updateAttributes:(0,y.functionProp)().required,deleteNode:(0,y.functionProp)().required},S=class extends v.NodeView{mount(){var e,t;const n={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode()},r=this.onDragStart.bind(this);this.decorationClasses=k.observable({value:this.getDecorationClasses()});const o=(null!=(t=null==(e=this.editor.contentComponent)?void 0:e.$options._base)?t:k).extend(this.component).extend({props:Object.keys(n),provide:()=>({onDragStart:r,decorationClasses:this.decorationClasses})});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new w(o,{parent:this.editor.contentComponent,propsData:n})}get dom(){if(!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,n=this.getPos();if("number"==typeof n)if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.ref.$props.selected)return;this.selectNode()}else{if(!this.renderer.ref.$props.selected)return;this.deselectNode()}}update(e,t,n){const r=e=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(e)};if("function"==typeof this.options.update){const o=this.node,i=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:o,oldDecorations:i,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n})})}return e.type===this.node.type&&(e===this.node&&this.decorations===t&&this.innerDecorations===n||(this.node=e,this.decorations=t,this.innerDecorations=n,r({node:e,decorations:t,innerDecorations:n})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.flatMap(e=>e.type.attrs.class).join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}};function C(e,t){return n=>n.editor.contentComponent?new S(e,n,t):{}}((e,t,n)=>{d(e,t,"default"),n&&d(n,t,"default")})(u,n(9248),e.exports)},3717:function(e){"use strict";function t(e){this.content=e}t.prototype={constructor:t,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,n,r){var o=r&&r!=e?this.remove(r):this,i=o.find(e),s=o.content.slice();return-1==i?s.push(r||e,n):(s[i+1]=n,r&&(s[i]=r)),new t(s)},remove:function(e){var n=this.find(e);if(-1==n)return this;var r=this.content.slice();return r.splice(n,2),new t(r)},addToStart:function(e,n){return new t([e,n].concat(this.remove(e).content))},addToEnd:function(e,n){var r=this.remove(e).content.slice();return r.push(e,n),new t(r)},addBefore:function(e,n,r){var o=this.remove(n),i=o.content.slice(),s=o.find(e);return i.splice(-1==s?i.length:s,0,n,r),new t(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=t.from(e)).size?new t(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=t.from(e)).size?new t(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var n=this;e=t.from(e);for(var r=0;r<e.content.length;r+=2)n=n.remove(e.content[r]);return n},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},t.from=function(e){if(e instanceof t)return e;var n=[];if(e)for(var r in e)n.push(r,e[r]);return new t(n)},e.exports=t},7449:function(e,t,n){"use strict";var r=n(6553),o=n(7712),i=n(7820),s=function(e,t){return!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0)};function a(e,t){var n=e.selection.$cursor;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}var l=function(e,t,n){var s=a(e,n);if(!s)return!1;var l=h(s);if(!l){var c=s.blockRange(),u=c&&r.liftTarget(c);return null!=u&&(t&&t(e.tr.lift(c,u).scrollIntoView()),!0)}var p=l.nodeBefore;if(M(e,l,t,-1))return!0;if(0==s.parent.content.size&&(d(p,"end")||i.NodeSelection.isSelectable(p)))for(var f=s.depth;;f--){var m=r.replaceStep(e.doc,s.before(f),s.after(f),o.Slice.empty);if(m&&m.slice.size<m.to-m.from){if(t){var g=e.tr.step(m);g.setSelection(d(p,"end")?i.Selection.findFrom(g.doc.resolve(g.mapping.map(l.pos,-1)),-1):i.NodeSelection.create(g.doc,l.pos-p.nodeSize)),t(g.scrollIntoView())}return!0}if(1==f||s.node(f-1).childCount>1)break}return!(!p.isAtom||l.depth!=s.depth-1||(t&&t(e.tr.delete(l.pos-p.nodeSize,l.pos).scrollIntoView()),0))};function c(e,t,n){for(var s=t.nodeBefore,a=t.pos-1;!s.isTextblock;a--){if(s.type.spec.isolating)return!1;var l=s.lastChild;if(!l)return!1;s=l}for(var c=t.nodeAfter,d=t.pos+1;!c.isTextblock;d++){if(c.type.spec.isolating)return!1;var u=c.firstChild;if(!u)return!1;c=u}var h=r.replaceStep(e.doc,a,d,o.Slice.empty);if(!h||h.from!=a||h instanceof r.ReplaceStep&&h.slice.size>=d-a)return!1;if(n){var p=e.tr.step(h);p.setSelection(i.TextSelection.create(p.doc,a)),n(p.scrollIntoView())}return!0}function d(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}var u=function(e,t,n){var r=e.selection,o=r.$head,s=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):o.parentOffset>0)return!1;s=h(o)}var a=s&&s.nodeBefore;return!(!a||!i.NodeSelection.isSelectable(a)||(t&&t(e.tr.setSelection(i.NodeSelection.create(e.doc,s.pos-a.nodeSize)).scrollIntoView()),0))};function h(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function p(e,t){var n=e.selection.$cursor;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}var f=function(e,t,n){var s=p(e,n);if(!s)return!1;var a=g(s);if(!a)return!1;var l=a.nodeAfter;if(M(e,a,t,1))return!0;if(0==s.parent.content.size&&(d(l,"start")||i.NodeSelection.isSelectable(l))){var c=r.replaceStep(e.doc,s.before(),s.after(),o.Slice.empty);if(c&&c.slice.size<c.to-c.from){if(t){var u=e.tr.step(c);u.setSelection(d(l,"start")?i.Selection.findFrom(u.doc.resolve(u.mapping.map(a.pos)),1):i.NodeSelection.create(u.doc,u.mapping.map(a.pos))),t(u.scrollIntoView())}return!0}}return!(!l.isAtom||a.depth!=s.depth-1||(t&&t(e.tr.delete(a.pos,a.pos+l.nodeSize).scrollIntoView()),0))},m=function(e,t,n){var r=e.selection,o=r.$head,s=o;if(!r.empty)return!1;if(o.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):o.parentOffset<o.parent.content.size)return!1;s=g(o)}var a=s&&s.nodeAfter;return!(!a||!i.NodeSelection.isSelectable(a)||(t&&t(e.tr.setSelection(i.NodeSelection.create(e.doc,s.pos)).scrollIntoView()),0))};function g(e){if(!e.parent.type.spec.isolating)for(var t=e.depth-1;t>=0;t--){var n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}var v=function(e,t){var n=e.selection,r=n.$head,o=n.$anchor;return!(!r.parent.type.spec.code||!r.sameParent(o)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))};function y(e){for(var t=0;t<e.edgeCount;t++){var n=e.edge(t).type;if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}var b=function(e,t){var n=e.selection,r=n.$head,o=n.$anchor;if(!r.parent.type.spec.code||!r.sameParent(o))return!1;var s=r.node(-1),a=r.indexAfter(-1),l=y(s.contentMatchAt(a));if(!l||!s.canReplaceWith(a,a,l))return!1;if(t){var c=r.after(),d=e.tr.replaceWith(c,c,l.createAndFill());d.setSelection(i.Selection.near(d.doc.resolve(c),1)),t(d.scrollIntoView())}return!0},k=function(e,t){var n=e.selection,r=n.$from,o=n.$to;if(n instanceof i.AllSelection||r.parent.inlineContent||o.parent.inlineContent)return!1;var s=y(o.parent.contentMatchAt(o.indexAfter()));if(!s||!s.isTextblock)return!1;if(t){var a=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,l=e.tr.insert(a,s.createAndFill());l.setSelection(i.TextSelection.create(l.doc,a+1)),t(l.scrollIntoView())}return!0},w=function(e,t){var n=e.selection.$cursor;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){var o=n.before();if(r.canSplit(e.doc,o))return t&&t(e.tr.split(o).scrollIntoView()),!0}var i=n.blockRange(),s=i&&r.liftTarget(i);return null!=s&&(t&&t(e.tr.lift(i,s).scrollIntoView()),!0)};function x(e){return function(t,n){var o=t.selection,s=o.$from,a=o.$to;if(t.selection instanceof i.NodeSelection&&t.selection.node.isBlock)return!(!s.parentOffset||!r.canSplit(t.doc,s.pos)||(n&&n(t.tr.split(s.pos).scrollIntoView()),0));if(!s.depth)return!1;for(var l,c,d=[],u=!1,h=!1,p=s.depth;;p--){if(s.node(p).isBlock){u=s.end(p)==s.pos+(s.depth-p),h=s.start(p)==s.pos-(s.depth-p),c=y(s.node(p-1).contentMatchAt(s.indexAfter(p-1)));var f=e&&e(a.parent,u,s);d.unshift(f||(u&&c?{type:c}:null)),l=p;break}if(1==p)return!1;d.unshift(null)}var m=t.tr;(t.selection instanceof i.TextSelection||t.selection instanceof i.AllSelection)&&m.deleteSelection();var g=m.mapping.map(s.pos),v=r.canSplit(m.doc,g,d.length,d);if(v||(d[0]=c?{type:c}:null,v=r.canSplit(m.doc,g,d.length,d)),!v)return!1;if(m.split(g,d.length,d),!u&&h&&s.node(l).type!=c){var b=m.mapping.map(s.before(l)),k=m.doc.resolve(b);c&&s.node(l-1).canReplaceWith(k.index(),k.index()+1,c)&&m.setNodeMarkup(m.mapping.map(s.before(l)),c)}return n&&n(m.scrollIntoView()),!0}}var S=x(),C=function(e,t){return t&&t(e.tr.setSelection(new i.AllSelection(e.doc))),!0};function M(e,t,n,s){var a,l,c=t.nodeBefore,u=t.nodeAfter,h=c.type.spec.isolating||u.type.spec.isolating;if(!h&&function(e,t,n){var o=t.nodeBefore,i=t.nodeAfter,s=t.index();return!(!(o&&i&&o.type.compatibleContent(i.type))||(!o.content.size&&t.parent.canReplace(s-1,s)?(n&&n(e.tr.delete(t.pos-o.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(s,s+1)||!i.isTextblock&&!r.canJoin(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;var p=!h&&t.parent.canReplace(t.index(),t.index()+1);if(p&&(a=(l=c.contentMatchAt(c.childCount)).findWrapping(u.type))&&l.matchType(a[0]||u.type).validEnd){if(n){for(var f=t.pos+u.nodeSize,m=o.Fragment.empty,g=a.length-1;g>=0;g--)m=o.Fragment.from(a[g].create(null,m));m=o.Fragment.from(c.copy(m));var v=e.tr.step(new r.ReplaceAroundStep(t.pos-1,f,t.pos,f,new o.Slice(m,1,0),a.length,!0)),y=v.doc.resolve(f+2*a.length);y.nodeAfter&&y.nodeAfter.type==c.type&&r.canJoin(v.doc,y.pos)&&v.join(y.pos),n(v.scrollIntoView())}return!0}var b=u.type.spec.isolating||s>0&&h?null:i.Selection.findFrom(t,1),k=b&&b.$from.blockRange(b.$to),w=k&&r.liftTarget(k);if(null!=w&&w>=t.depth)return n&&n(e.tr.lift(k,w).scrollIntoView()),!0;if(p&&d(u,"start",!0)&&d(c,"end")){for(var x=c,S=[];S.push(x),!x.isTextblock;)x=x.lastChild;for(var C=u,M=1;!C.isTextblock;C=C.firstChild)M++;if(x.canReplace(x.childCount,x.childCount,C.content)){if(n){for(var T=o.Fragment.empty,A=S.length-1;A>=0;A--)T=o.Fragment.from(S[A].copy(T));n(e.tr.step(new r.ReplaceAroundStep(t.pos-S.length,t.pos+u.nodeSize,t.pos+M,t.pos+u.nodeSize-M,new o.Slice(T,S.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function T(e){return function(t,n){for(var r=t.selection,o=e<0?r.$from:r.$to,s=o.depth;o.node(s).isInline;){if(!s)return!1;s--}return!!o.node(s).isTextblock&&(n&&n(t.tr.setSelection(i.TextSelection.create(t.doc,e<0?o.start(s):o.end(s)))),!0)}}var A=T(-1),O=T(1);function E(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return function(e,n,r){for(var o=0;o<t.length;o++)if(t[o](e,n,r))return!0;return!1}}var N=E(s,l,u),R=E(s,f,m),D={Enter:E(v,k,w,S),"Mod-Enter":b,Backspace:N,"Mod-Backspace":N,"Shift-Backspace":N,Delete:R,"Mod-Delete":R,"Mod-a":C},P={"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":A,"Ctrl-e":O};for(var $ in D)P[$]=D[$];var I=("undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&"darwin"==os.platform())?P:D;t.autoJoin=function(e,t){var n=Array.isArray(t)?function(e){return t.indexOf(e.type.name)>-1}:t;return function(t,o,i){return e(t,o&&function(e,t){return function(n){if(!n.isGeneric)return e(n);for(var o=[],i=0;i<n.mapping.maps.length;i++){for(var s=n.mapping.maps[i],a=0;a<o.length;a++)o[a]=s.map(o[a]);s.forEach(function(e,t,n,r){return o.push(n,r)})}for(var l=[],c=0;c<o.length;c+=2)for(var d=o[c],u=o[c+1],h=n.doc.resolve(d),p=h.sharedDepth(u),f=h.node(p),m=h.indexAfter(p),g=h.after(p+1);g<=u;++m){var v=f.maybeChild(m);if(!v)break;if(m&&-1==l.indexOf(g)){var y=f.child(m-1);y.type==v.type&&t(y,v)&&l.push(g)}g+=v.nodeSize}l.sort(function(e,t){return e-t});for(var b=l.length-1;b>=0;b--)r.canJoin(n.doc,l[b])&&n.join(l[b]);e(n)}}(o,n),i)}},t.baseKeymap=I,t.chainCommands=E,t.createParagraphNear=k,t.deleteSelection=s,t.exitCode=b,t.joinBackward=l,t.joinDown=function(e,t){var n,o=e.selection;if(o instanceof i.NodeSelection){if(o.node.isTextblock||!r.canJoin(e.doc,o.to))return!1;n=o.to}else if(null==(n=r.joinPoint(e.doc,o.to,1)))return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0},t.joinForward=f,t.joinTextblockBackward=function(e,t,n){var r=a(e,n);if(!r)return!1;var o=h(r);return!!o&&c(e,o,t)},t.joinTextblockForward=function(e,t,n){var r=p(e,n);if(!r)return!1;var o=g(r);return!!o&&c(e,o,t)},t.joinUp=function(e,t){var n,o=e.selection,s=o instanceof i.NodeSelection;if(s){if(o.node.isTextblock||!r.canJoin(e.doc,o.from))return!1;n=o.from}else if(null==(n=r.joinPoint(e.doc,o.from,-1)))return!1;if(t){var a=e.tr.join(n);s&&a.setSelection(i.NodeSelection.create(a.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(a.scrollIntoView())}return!0},t.lift=function(e,t){var n=e.selection,o=n.$from,i=n.$to,s=o.blockRange(i),a=s&&r.liftTarget(s);return null!=a&&(t&&t(e.tr.lift(s,a).scrollIntoView()),!0)},t.liftEmptyBlock=w,t.macBaseKeymap=P,t.newlineInCode=v,t.pcBaseKeymap=D,t.selectAll=C,t.selectNodeBackward=u,t.selectNodeForward=m,t.selectParentNode=function(e,t){var n,r=e.selection,o=r.$from,s=r.to,a=o.sharedDepth(s);return 0!=a&&(n=o.before(a),t&&t(e.tr.setSelection(i.NodeSelection.create(e.doc,n))),!0)},t.selectTextblockEnd=O,t.selectTextblockStart=A,t.setBlockType=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,r){for(var o=!1,i=0;i<n.selection.ranges.length&&!o;i++){var s=n.selection.ranges[i],a=s.$from.pos,l=s.$to.pos;n.doc.nodesBetween(a,l,function(r,i){if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{var s=n.doc.resolve(i),a=s.index();o=s.parent.canReplaceWith(a,a+1,e)}})}if(!o)return!1;if(r){for(var c=n.tr,d=0;d<n.selection.ranges.length;d++){var u=n.selection.ranges[d],h=u.$from.pos,p=u.$to.pos;c.setBlockType(h,p,e,t)}r(c.scrollIntoView())}return!0}},t.splitBlock=S,t.splitBlockAs=x,t.splitBlockKeepMarks=function(e,t){return S(e,t&&function(n){var r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();r&&n.ensureMarks(r),t(n)})},t.toggleMark=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=!1!==(n&&n.removeWhenPresent),o=!1!==(n&&n.enterInlineAtoms),s=!(n&&n.includeWhitespace);return function(n,a){var l=n.selection,c=l.empty,d=l.$cursor,u=l.ranges;if(c&&!d||!function(e,t,n,r){for(var o,i=function(){var o=t[s],i=o.$from,a=o.$to,l=0==i.depth&&e.inlineContent&&e.type.allowsMarkType(n);if(e.nodesBetween(i.pos,a.pos,function(e,t){if(l||!r&&e.isAtom&&e.isInline&&t>=i.pos&&t+e.nodeSize<=a.pos)return!1;l=e.inlineContent&&e.type.allowsMarkType(n)}),l)return{v:!0}},s=0;s<t.length;s++)if(o=i())return o.v;return!1}(n.doc,u,e,o))return!1;if(a)if(d)e.isInSet(n.storedMarks||d.marks())?a(n.tr.removeStoredMark(e)):a(n.tr.addStoredMark(e.create(t)));else{var h,p=n.tr;o||(u=function(e){for(var t=[],n=function(){var n=e[r],o=n.$from,s=n.$to;o.doc.nodesBetween(o.pos,s.pos,function(e,n){if(e.isAtom&&e.content.size&&e.isInline&&n>=o.pos&&n+e.nodeSize<=s.pos)return n+1>o.pos&&t.push(new i.SelectionRange(o,o.doc.resolve(n+1))),o=o.doc.resolve(n+1+e.content.size),!1}),o.pos<s.pos&&t.push(new i.SelectionRange(o,s))},r=0;r<e.length;r++)n();return t}(u)),h=r?!u.some(function(t){return n.doc.rangeHasMark(t.$from.pos,t.$to.pos,e)}):!u.every(function(t){var n=!1;return p.doc.nodesBetween(t.$from.pos,t.$to.pos,function(r,o,i){if(n)return!1;n=!e.isInSet(r.marks)&&!!i&&i.type.allowsMarkType(e)&&!(r.isText&&/^\s*$/.test(r.textBetween(Math.max(0,t.$from.pos-o),Math.min(r.nodeSize,t.$to.pos-o))))}),!n});for(var f=0;f<u.length;f++){var m=u[f],g=m.$from,v=m.$to;if(h){var y=g.pos,b=v.pos,k=g.nodeAfter,w=v.nodeBefore,x=s&&k&&k.isText?/^\s*/.exec(k.text)[0].length:0,S=s&&w&&w.isText?/\s*$/.exec(w.text)[0].length:0;y+x<b&&(y+=x,b-=S),p.addMark(y,b,e.create(t))}else p.removeMark(g.pos,v.pos,e)}a(p.scrollIntoView())}return!0}},t.wrapIn=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,o){var i=n.selection,s=i.$from,a=i.$to,l=s.blockRange(a),c=l&&r.findWrapping(l,e,t);return!!c&&(o&&o(n.tr.wrap(l,c).scrollIntoView()),!0)}}},8136:function(e,t,n){"use strict";var r=n(6237),o=n(7820),i="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),s="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function a(e){var t,n,r,o,s=e.split(/-(?!$)/),a=s[s.length-1];"Space"==a&&(a=" ");for(var l=0;l<s.length-1;l++){var c=s[l];if(/^(cmd|meta|m)$/i.test(c))o=!0;else if(/^a(lt)?$/i.test(c))t=!0;else if(/^(c|ctrl|control)$/i.test(c))n=!0;else if(/^s(hift)?$/i.test(c))r=!0;else{if(!/^mod$/i.test(c))throw new Error("Unrecognized modifier name: "+c);i?o=!0:n=!0}}return t&&(a="Alt-"+a),n&&(a="Ctrl-"+a),o&&(a="Meta-"+a),r&&(a="Shift-"+a),a}function l(e,t){var n=!(arguments.length>2&&void 0!==arguments[2])||arguments[2];return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function c(e){var t=function(e){var t=Object.create(null);for(var n in e)t[a(n)]=e[n];return t}(e);return function(e,n){var o,i=r.keyName(n),a=t[l(i,n)];if(a&&a(e.state,e.dispatch,e))return!0;if(1==i.length&&" "!=i){if(n.shiftKey){var c=t[l(i,n,!1)];if(c&&c(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(s&&n.ctrlKey&&n.altKey)&&(o=r.base[n.keyCode])&&o!=i){var d=t[l(o,n)];if(d&&d(e.state,e.dispatch,e))return!0}}return!1}}t.keydownHandler=c,t.keymap=function(e){return new o.Plugin({props:{handleKeyDown:c(e)}})}},7712:function(e,t,n){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function o(){return o="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=u(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},o.apply(this,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&d(e,t)}function s(e){var t=c();return function(){var n,r=u(e);if(t){var o=u(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===h(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function a(e){var t="function"==typeof Map?new Map:void 0;return a=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return l(e,arguments,u(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),d(n,e)},a(e)}function l(e,t,n){return l=c()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&d(o,n.prototype),o},l.apply(null,arguments)}function c(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function d(e,t){return d=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},d(e,t)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function h(e){return h="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},h(e)}function p(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function f(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,g(r.key),r)}}function m(e,t,n){return t&&f(e.prototype,t),n&&f(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function g(e){var t=function(e){if("object"!==h(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==h(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===h(t)?t:String(t)}var v=n(3717);function y(e,t,n){for(var r=0;;r++){if(r==e.childCount||r==t.childCount)return e.childCount==t.childCount?null:n;var o=e.child(r),i=t.child(r);if(o!=i){if(!o.sameMarkup(i))return n;if(o.isText&&o.text!=i.text){for(var s=0;o.text[s]==i.text[s];s++)n++;return n}if(o.content.size||i.content.size){var a=y(o.content,i.content,n+1);if(null!=a)return a}n+=o.nodeSize}else n+=o.nodeSize}}function b(e,t,n,r){for(var o=e.childCount,i=t.childCount;;){if(0==o||0==i)return o==i?null:{a:n,b:r};var s=e.child(--o),a=t.child(--i),l=s.nodeSize;if(s!=a){if(!s.sameMarkup(a))return{a:n,b:r};if(s.isText&&s.text!=a.text){for(var c=0,d=Math.min(s.text.length,a.text.length);c<d&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,n--,r--;return{a:n,b:r}}if(s.content.size||a.content.size){var u=b(s.content,a.content,n-1,r-1);if(u)return u}n-=l,r-=l}else n-=l,r-=l}}var k=function(){function e(t,n){if(p(this,e),this.content=t,this.size=n||0,null==n)for(var r=0;r<t.length;r++)this.size+=t[r].nodeSize}return m(e,[{key:"nodesBetween",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4?arguments[4]:void 0,i=0,s=0;s<t;i++){var a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){var c=s+1;a.nodesBetween(Math.max(0,e-c),Math.min(a.content.size,t-c),n,r+c)}s=l}}},{key:"descendants",value:function(e){this.nodesBetween(0,this.size,e)}},{key:"textBetween",value:function(e,t,n,r){var o="",i=!0;return this.nodesBetween(e,t,function(s,a){var l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=l},0),o}},{key:"append",value:function(t){if(!t.size)return this;if(!this.size)return t;var n=this.lastChild,r=t.firstChild,o=this.content.slice(),i=0;for(n.isText&&n.sameMarkup(r)&&(o[o.length-1]=n.withText(n.text+r.text),i=1);i<t.content.length;i++)o.push(t.content[i]);return new e(o,this.size+t.size)}},{key:"cut",value:function(t){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size;if(0==t&&n==this.size)return this;var r=[],o=0;if(n>t)for(var i=0,s=0;s<n;i++){var a=this.content[i],l=s+a.nodeSize;l>t&&((s<t||l>n)&&(a=a.isText?a.cut(Math.max(0,t-s),Math.min(a.text.length,n-s)):a.cut(Math.max(0,t-s-1),Math.min(a.content.size,n-s-1))),r.push(a),o+=a.nodeSize),s=l}return new e(r,o)}},{key:"cutByIndex",value:function(t,n){return t==n?e.empty:0==t&&n==this.content.length?this:new e(this.content.slice(t,n))}},{key:"replaceChild",value:function(t,n){var r=this.content[t];if(r==n)return this;var o=this.content.slice(),i=this.size+n.nodeSize-r.nodeSize;return o[t]=n,new e(o,i)}},{key:"addToStart",value:function(t){return new e([t].concat(this.content),this.size+t.nodeSize)}},{key:"addToEnd",value:function(t){return new e(this.content.concat(t),this.size+t.nodeSize)}},{key:"eq",value:function(e){if(this.content.length!=e.content.length)return!1;for(var t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}},{key:"firstChild",get:function(){return this.content.length?this.content[0]:null}},{key:"lastChild",get:function(){return this.content.length?this.content[this.content.length-1]:null}},{key:"childCount",get:function(){return this.content.length}},{key:"child",value:function(e){var t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}},{key:"maybeChild",value:function(e){return this.content[e]||null}},{key:"forEach",value:function(e){for(var t=0,n=0;t<this.content.length;t++){var r=this.content[t];e(r,n,t),n+=r.nodeSize}}},{key:"findDiffStart",value:function(e){return y(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:0)}},{key:"findDiffEnd",value:function(e){return b(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.size,arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.size)}},{key:"findIndex",value:function(e){if(0==e)return x(0,e);if(e==this.size)return x(this.content.length,e);if(e>this.size||e<0)throw new RangeError("Position ".concat(e," outside of fragment (").concat(this,")"));for(var t=0,n=0;;t++){var r=n+this.child(t).nodeSize;if(r>=e)return r==e?x(t+1,r):x(t,n);n=r}}},{key:"toString",value:function(){return"<"+this.toStringInner()+">"}},{key:"toStringInner",value:function(){return this.content.join(", ")}},{key:"toJSON",value:function(){return this.content.length?this.content.map(function(e){return e.toJSON()}):null}}],[{key:"fromJSON",value:function(t,n){if(!n)return e.empty;if(!Array.isArray(n))throw new RangeError("Invalid input for Fragment.fromJSON");return new e(n.map(t.nodeFromJSON))}},{key:"fromArray",value:function(t){if(!t.length)return e.empty;for(var n,r=0,o=0;o<t.length;o++){var i=t[o];r+=i.nodeSize,o&&i.isText&&t[o-1].sameMarkup(i)?(n||(n=t.slice(0,o)),n[n.length-1]=i.withText(n[n.length-1].text+i.text)):n&&n.push(i)}return new e(n||t,r)}},{key:"from",value:function(t){if(!t)return e.empty;if(t instanceof e)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new e([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}]),e}();k.empty=new k([],0);var w={index:0,offset:0};function x(e,t){return w.index=e,w.offset=t,w}function S(e,t){if(e===t)return!0;if(!e||"object"!=h(e)||!t||"object"!=h(t))return!1;var n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(var r=0;r<e.length;r++)if(!S(e[r],t[r]))return!1}else{for(var o in e)if(!(o in t)||!S(e[o],t[o]))return!1;for(var i in t)if(!(i in e))return!1}return!0}var C=function(){function e(t,n){p(this,e),this.type=t,this.attrs=n}return m(e,[{key:"addToSet",value:function(e){for(var t,n=!1,r=0;r<e.length;r++){var o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}},{key:"removeFromSet",value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}},{key:"isInSet",value:function(e){for(var t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}},{key:"eq",value:function(e){return this==e||this.type==e.type&&S(this.attrs,e.attrs)}},{key:"toJSON",value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return e}}],[{key:"fromJSON",value:function(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");var n=e.marks[t.type];if(!n)throw new RangeError("There is no mark type ".concat(t.type," in this schema"));var r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}},{key:"sameSet",value:function(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}},{key:"setFrom",value:function(t){if(!t||Array.isArray(t)&&0==t.length)return e.none;if(t instanceof e)return[t];var n=t.slice();return n.sort(function(e,t){return e.type.rank-t.type.rank}),n}}]),e}();C.none=[];var M=function(e){i(n,e);var t=s(n);function n(){return p(this,n),t.apply(this,arguments)}return m(n)}(a(Error)),T=function(){function e(t,n,r){p(this,e),this.content=t,this.openStart=n,this.openEnd=r}return m(e,[{key:"size",get:function(){return this.content.size-this.openStart-this.openEnd}},{key:"insertAt",value:function(t,n){var r=O(this.content,t+this.openStart,n);return r&&new e(r,this.openStart,this.openEnd)}},{key:"removeBetween",value:function(t,n){return new e(A(this.content,t+this.openStart,n+this.openStart),this.openStart,this.openEnd)}},{key:"eq",value:function(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}},{key:"toString",value:function(){return this.content+"("+this.openStart+","+this.openEnd+")"}},{key:"toJSON",value:function(){if(!this.content.size)return null;var e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}}],[{key:"fromJSON",value:function(t,n){if(!n)return e.empty;var r=n.openStart||0,o=n.openEnd||0;if("number"!=typeof r||"number"!=typeof o)throw new RangeError("Invalid input for Slice.fromJSON");return new e(k.fromJSON(t,n.content),r,o)}},{key:"maxOpen",value:function(t){for(var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=0,o=0,i=t.firstChild;i&&!i.isLeaf&&(n||!i.type.spec.isolating);i=i.firstChild)r++;for(var s=t.lastChild;s&&!s.isLeaf&&(n||!s.type.spec.isolating);s=s.lastChild)o++;return new e(t,r,o)}}]),e}();function A(e,t,n){var r=e.findIndex(t),o=r.index,i=r.offset,s=e.maybeChild(o),a=e.findIndex(n),l=a.index,c=a.offset;if(i==t||s.isText){if(c!=n&&!e.child(l).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(o!=l)throw new RangeError("Removing non-flat range");return e.replaceChild(o,s.copy(A(s.content,t-i-1,n-i-1)))}function O(e,t,n,r){var o=e.findIndex(t),i=o.index,s=o.offset,a=e.maybeChild(i);if(s==t||a.isText)return r&&!r.canReplace(i,i,n)?null:e.cut(0,t).append(n).append(e.cut(t));var l=O(a.content,t-s-1,n,a);return l&&e.replaceChild(i,a.copy(l))}function E(e,t,n){if(n.openStart>e.depth)throw new M("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new M("Inconsistent open depths");return N(e,t,n,0)}function N(e,t,n,r){var o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){var s=N(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){var a=function(e,t){for(var n=t.depth-e.openStart,r=t.node(n).copy(e.content),o=n-1;o>=0;o--)r=t.node(o).copy(k.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return I(i,z(e,a.start,a.end,t,r))}var l=e.parent,c=l.content;return I(l,c.cut(0,e.parentOffset).append(n.content).append(c.cut(t.parentOffset)))}return I(i,L(e,t,r))}function R(e,t){if(!t.type.compatibleContent(e.type))throw new M("Cannot join "+t.type.name+" onto "+e.type.name)}function D(e,t,n){var r=e.node(n);return R(r,t.node(n)),r}function P(e,t){var n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function $(e,t,n,r){var o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(P(e.nodeAfter,r),i++));for(var a=i;a<s;a++)P(o.child(a),r);t&&t.depth==n&&t.textOffset&&P(t.nodeBefore,r)}function I(e,t){return e.type.checkContent(t),e.copy(t)}function z(e,t,n,r,o){var i=e.depth>o&&D(e,t,o+1),s=r.depth>o&&D(n,r,o+1),a=[];return $(null,e,o,a),i&&s&&t.index(o)==n.index(o)?(R(i,s),P(I(i,z(e,t,n,r,o+1)),a)):(i&&P(I(i,L(e,t,o+1)),a),$(t,n,o,a),s&&P(I(s,L(n,r,o+1)),a)),$(r,null,o,a),new k(a)}function L(e,t,n){var r=[];return $(null,e,n,r),e.depth>n&&P(I(D(e,t,n+1),L(e,t,n+1)),r),$(t,null,n,r),new k(r)}T.empty=new T(k.empty,0,0);var F=function(){function e(t,n,r){p(this,e),this.pos=t,this.path=n,this.parentOffset=r,this.depth=n.length/3-1}return m(e,[{key:"resolveDepth",value:function(e){return null==e?this.depth:e<0?this.depth+e:e}},{key:"parent",get:function(){return this.node(this.depth)}},{key:"doc",get:function(){return this.node(0)}},{key:"node",value:function(e){return this.path[3*this.resolveDepth(e)]}},{key:"index",value:function(e){return this.path[3*this.resolveDepth(e)+1]}},{key:"indexAfter",value:function(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}},{key:"start",value:function(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}},{key:"end",value:function(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}},{key:"before",value:function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}},{key:"after",value:function(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}},{key:"textOffset",get:function(){return this.pos-this.path[this.path.length-1]}},{key:"nodeAfter",get:function(){var e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;var n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}},{key:"nodeBefore",get:function(){var e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}},{key:"posAtIndex",value:function(e,t){t=this.resolveDepth(t);for(var n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1,o=0;o<e;o++)r+=n.child(o).nodeSize;return r}},{key:"marks",value:function(){var e=this.parent,t=this.index();if(0==e.content.size)return C.none;if(this.textOffset)return e.child(t).marks;var n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){var o=n;n=r,r=o}for(var i=n.marks,s=0;s<i.length;s++)!1!==i[s].type.spec.inclusive||r&&i[s].isInSet(r.marks)||(i=i[s--].removeFromSet(i));return i}},{key:"marksAcross",value:function(e){var t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;for(var n=t.marks,r=e.parent.maybeChild(e.index()),o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}},{key:"sharedDepth",value:function(e){for(var t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}},{key:"blockRange",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:this,t=arguments.length>1?arguments[1]:void 0;if(e.pos<this.pos)return e.blockRange(this);for(var n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new _(this,e,n);return null}},{key:"sameParent",value:function(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}},{key:"max",value:function(e){return e.pos>this.pos?e:this}},{key:"min",value:function(e){return e.pos<this.pos?e:this}},{key:"toString",value:function(){for(var e="",t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}}],[{key:"resolve",value:function(t,n){if(!(n>=0&&n<=t.content.size))throw new RangeError("Position "+n+" out of range");for(var r=[],o=0,i=n,s=t;;){var a=s.content.findIndex(i),l=a.index,c=a.offset,d=i-c;if(r.push(s,l,o+c),!d)break;if((s=s.child(l)).isText)break;i=d-1,o+=c+1}return new e(n,r,i)}},{key:"resolveCached",value:function(t,n){var r=B.get(t);if(r)for(var o=0;o<r.elts.length;o++){var i=r.elts[o];if(i.pos==n)return i}else B.set(t,r=new H);var s=r.elts[r.i]=e.resolve(t,n);return r.i=(r.i+1)%j,s}}]),e}(),H=m(function e(){p(this,e),this.elts=[],this.i=0}),j=12,B=new WeakMap,_=function(){function e(t,n,r){p(this,e),this.$from=t,this.$to=n,this.depth=r}return m(e,[{key:"start",get:function(){return this.$from.before(this.depth+1)}},{key:"end",get:function(){return this.$to.after(this.depth+1)}},{key:"parent",get:function(){return this.$from.node(this.depth)}},{key:"startIndex",get:function(){return this.$from.index(this.depth)}},{key:"endIndex",get:function(){return this.$to.indexAfter(this.depth)}}]),e}(),V=Object.create(null),W=function(){function e(t,n,r){var o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:C.none;p(this,e),this.type=t,this.attrs=n,this.marks=o,this.content=r||k.empty}return m(e,[{key:"children",get:function(){return this.content.content}},{key:"nodeSize",get:function(){return this.isLeaf?1:2+this.content.size}},{key:"childCount",get:function(){return this.content.childCount}},{key:"child",value:function(e){return this.content.child(e)}},{key:"maybeChild",value:function(e){return this.content.maybeChild(e)}},{key:"forEach",value:function(e){this.content.forEach(e)}},{key:"nodesBetween",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0;this.content.nodesBetween(e,t,n,r,this)}},{key:"descendants",value:function(e){this.nodesBetween(0,this.content.size,e)}},{key:"textContent",get:function(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}},{key:"textBetween",value:function(e,t,n,r){return this.content.textBetween(e,t,n,r)}},{key:"firstChild",get:function(){return this.content.firstChild}},{key:"lastChild",get:function(){return this.content.lastChild}},{key:"eq",value:function(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}},{key:"sameMarkup",value:function(e){return this.hasMarkup(e.type,e.attrs,e.marks)}},{key:"hasMarkup",value:function(e,t,n){return this.type==e&&S(this.attrs,t||e.defaultAttrs||V)&&C.sameSet(this.marks,n||C.none)}},{key:"copy",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return t==this.content?this:new e(this.type,this.attrs,t,this.marks)}},{key:"mark",value:function(t){return t==this.marks?this:new e(this.type,this.attrs,this.content,t)}},{key:"cut",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size;return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}},{key:"slice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.content.size,n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(e==t)return T.empty;var r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new T(a,r.depth-i,o.depth-i)}},{key:"replace",value:function(e,t,n){return E(this.resolve(e),this.resolve(t),n)}},{key:"nodeAt",value:function(e){for(var t=this;;){var n=t.content.findIndex(e),r=n.index,o=n.offset;if(!(t=t.maybeChild(r)))return null;if(o==e||t.isText)return t;e-=o+1}}},{key:"childAfter",value:function(e){var t=this.content.findIndex(e),n=t.index,r=t.offset;return{node:this.content.maybeChild(n),index:n,offset:r}}},{key:"childBefore",value:function(e){if(0==e)return{node:null,index:0,offset:0};var t=this.content.findIndex(e),n=t.index,r=t.offset;if(r<e)return{node:this.content.child(n),index:n,offset:r};var o=this.content.child(n-1);return{node:o,index:n-1,offset:r-o.nodeSize}}},{key:"resolve",value:function(e){return F.resolveCached(this,e)}},{key:"resolveNoCache",value:function(e){return F.resolve(this,e)}},{key:"rangeHasMark",value:function(e,t,n){var r=!1;return t>e&&this.nodesBetween(e,t,function(e){return n.isInSet(e.marks)&&(r=!0),!r}),r}},{key:"isBlock",get:function(){return this.type.isBlock}},{key:"isTextblock",get:function(){return this.type.isTextblock}},{key:"inlineContent",get:function(){return this.type.inlineContent}},{key:"isInline",get:function(){return this.type.isInline}},{key:"isText",get:function(){return this.type.isText}},{key:"isLeaf",get:function(){return this.type.isLeaf}},{key:"isAtom",get:function(){return this.type.isAtom}},{key:"toString",value:function(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);var e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),K(this.marks,e)}},{key:"contentMatchAt",value:function(e){var t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}},{key:"canReplace",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:k.empty,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:0,o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:n.childCount,i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(var a=r;a<o;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}},{key:"canReplaceWith",value:function(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;var o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}},{key:"canAppend",value:function(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}},{key:"check",value:function(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);for(var e=C.none,t=0;t<this.marks.length;t++){var n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!C.sameSet(e,this.marks))throw new RangeError("Invalid collection of marks for node ".concat(this.type.name,": ").concat(this.marks.map(function(e){return e.type.name})));this.content.forEach(function(e){return e.check()})}},{key:"toJSON",value:function(){var e={type:this.type.name};for(var t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(function(e){return e.toJSON()})),e}}],[{key:"fromJSON",value:function(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");var n=void 0;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}var r=k.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}]),e}();W.prototype.text=void 0;var q=function(e){i(n,e);var t=s(n);function n(e,r,o,i){var s;if(p(this,n),s=t.call(this,e,r,null,i),!o)throw new RangeError("Empty text nodes are not allowed");return s.text=o,s}return m(n,[{key:"toString",value:function(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):K(this.marks,JSON.stringify(this.text))}},{key:"textContent",get:function(){return this.text}},{key:"textBetween",value:function(e,t){return this.text.slice(e,t)}},{key:"nodeSize",get:function(){return this.text.length}},{key:"mark",value:function(e){return e==this.marks?this:new n(this.type,this.attrs,this.text,e)}},{key:"withText",value:function(e){return e==this.text?this:new n(this.type,this.attrs,e,this.marks)}},{key:"cut",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.text.length;return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}},{key:"eq",value:function(e){return this.sameMarkup(e)&&this.text==e.text}},{key:"toJSON",value:function(){var e=o(u(n.prototype),"toJSON",this).call(this);return e.text=this.text,e}}]),n}(W);function K(e,t){for(var n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}var J=function(){function e(t){p(this,e),this.validEnd=t,this.next=[],this.wrapCache=[]}return m(e,[{key:"matchType",value:function(e){for(var t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}},{key:"matchFragment",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:e.childCount,r=this,o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}},{key:"inlineContent",get:function(){return 0!=this.next.length&&this.next[0].type.isInline}},{key:"defaultType",get:function(){for(var e=0;e<this.next.length;e++){var t=this.next[e].type;if(!t.isText&&!t.hasRequiredAttrs())return t}return null}},{key:"compatible",value:function(e){for(var t=0;t<this.next.length;t++)for(var n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}},{key:"fillBefore",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=[this];return function o(i,s){var a=i.matchFragment(e,n);if(a&&(!t||a.validEnd))return k.from(s.map(function(e){return e.createAndFill()}));for(var l=0;l<i.next.length;l++){var c=i.next[l],d=c.type,u=c.next;if(!d.isText&&!d.hasRequiredAttrs()&&-1==r.indexOf(u)){r.push(u);var h=o(u,s.concat(d));if(h)return h}}return null}(this,[])}},{key:"findWrapping",value:function(e){for(var t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];var n=this.computeWrapping(e);return this.wrapCache.push(e,n),n}},{key:"computeWrapping",value:function(e){for(var t=Object.create(null),n=[{match:this,type:null,via:null}];n.length;){var r=n.shift(),o=r.match;if(o.matchType(e)){for(var i=[],s=r;s.type;s=s.via)i.push(s.type);return i.reverse()}for(var a=0;a<o.next.length;a++){var l=o.next[a],c=l.type,d=l.next;c.isLeaf||c.hasRequiredAttrs()||c.name in t||r.type&&!d.validEnd||(n.push({match:c.contentMatch,type:c,via:r}),t[c.name]=!0)}}return null}},{key:"edgeCount",get:function(){return this.next.length}},{key:"edge",value:function(e){if(e>=this.next.length)throw new RangeError("There's no ".concat(e,"th edge in this content match"));return this.next[e]}},{key:"toString",value:function(){var e=[];return function t(n){e.push(n);for(var r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map(function(t,n){for(var r=n+(t.validEnd?"*":" ")+" ",o=0;o<t.next.length;o++)r+=(o?", ":"")+t.next[o].type.name+"->"+e.indexOf(t.next[o].next);return r}).join("\n")}}],[{key:"parse",value:function(t,n){var r=new U(t,n);if(null==r.next)return e.empty;var o=G(r);r.next&&r.err("Unexpected trailing text");var i=ne(function(e){var t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce(function(t,n){return t.concat(e(n,i))},[]);if("seq"!=t.type){if("star"==t.type){var s=n();return r(i,s),o(e(t.expr,s),s),[r(s)]}if("plus"==t.type){var a=n();return o(e(t.expr,i),a),o(e(t.expr,a),a),[r(a)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){for(var l=i,c=0;c<t.min;c++){var d=n();o(e(t.expr,l),d),l=d}if(-1==t.max)o(e(t.expr,l),l);else for(var u=t.min;u<t.max;u++){var h=n();r(l,h),o(e(t.expr,l),h),l=h}return[r(l)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(var p=0;;p++){var f=e(t.exprs[p],i);if(p==t.exprs.length-1)return f;o(f,i=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){var o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach(function(e){return e.to=t})}}(o));return function(e,t){for(var n=0,r=[e];n<r.length;n++){for(var o=r[n],i=!o.validEnd,s=[],a=0;a<o.next.length;a++){var l=o.next[a],c=l.type,d=l.next;s.push(c.name),!i||c.isText||c.hasRequiredAttrs()||(i=!1),-1==r.indexOf(d)&&r.push(d)}i&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(i,r),i}}]),e}();J.empty=new J(!0);var U=function(){function e(t,n){p(this,e),this.string=t,this.nodeTypes=n,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()}return m(e,[{key:"next",get:function(){return this.tokens[this.pos]}},{key:"eat",value:function(e){return this.next==e&&(this.pos++||!0)}},{key:"err",value:function(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}]),e}();function G(e){var t=[];do{t.push(X(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function X(e){var t=[];do{t.push(Y(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function Y(e){for(var t=function(e){if(e.eat("(")){var t=G(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){var n=function(e,t){var n=e.nodeTypes,r=n[t];if(r)return[r];var o=[];for(var i in n){var s=n[i];s.isInGroup(t)&&o.push(s)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o}(e,e.next).map(function(t){return null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}});return e.pos++,1==n.length?n[0]:{type:"choice",exprs:n}}e.err("Unexpected token '"+e.next+"'")}(e);;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=Z(e,t)}return t}function Q(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");var t=Number(e.next);return e.pos++,t}function Z(e,t){var n=Q(e),r=n;return e.eat(",")&&(r="}"!=e.next?Q(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function ee(e,t){return t-e}function te(e,t){var n=[];return function t(r){var o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(var i=0;i<o.length;i++){var s=o[i],a=s.term,l=s.to;a||-1!=n.indexOf(l)||t(l)}}(t),n.sort(ee)}function ne(e){var t=Object.create(null);return function n(r){var o=[];r.forEach(function(t){e[t].forEach(function(t){var n=t.term,r=t.to;if(n){for(var i,s=0;s<o.length;s++)o[s][0]==n&&(i=o[s][1]);te(e,r).forEach(function(e){i||o.push([n,i=[]]),-1==i.indexOf(e)&&i.push(e)})}})});for(var i=t[r.join(",")]=new J(r.indexOf(e.length-1)>-1),s=0;s<o.length;s++){var a=o[s][1].sort(ee);i.next.push({type:o[s][0],next:t[a.join(",")]||n(a)})}return i}(te(e,0))}function re(e){var t=Object.create(null);for(var n in e){var r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function oe(e,t){var n=Object.create(null);for(var r in e){var o=t&&t[r];if(void 0===o){var i=e[r];if(!i.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=i.default}n[r]=o}return n}function ie(e,t,n,r){for(var o in t)if(!(o in e))throw new RangeError("Unsupported attribute ".concat(o," for ").concat(n," of type ").concat(o));for(var i in e){var s=e[i];s.validate&&s.validate(t[i])}}function se(e,t){var n=Object.create(null);if(t)for(var r in t)n[r]=new le(e,r,t[r]);return n}var ae=function(){function e(t,n,r){p(this,e),this.name=t,this.schema=n,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=se(t,r.attrs),this.defaultAttrs=re(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||"text"==t),this.isText="text"==t}return m(e,[{key:"isInline",get:function(){return!this.isBlock}},{key:"isTextblock",get:function(){return this.isBlock&&this.inlineContent}},{key:"isLeaf",get:function(){return this.contentMatch==J.empty}},{key:"isAtom",get:function(){return this.isLeaf||!!this.spec.atom}},{key:"isInGroup",value:function(e){return this.groups.indexOf(e)>-1}},{key:"whitespace",get:function(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}},{key:"hasRequiredAttrs",value:function(){for(var e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}},{key:"compatibleContent",value:function(e){return this==e||this.contentMatch.compatible(e.contentMatch)}},{key:"computeAttrs",value:function(e){return!e&&this.defaultAttrs?this.defaultAttrs:oe(this.attrs,e)}},{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new W(this,this.computeAttrs(e),k.from(t),C.setFrom(n))}},{key:"createChecked",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;return t=k.from(t),this.checkContent(t),new W(this,this.computeAttrs(e),t,C.setFrom(n))}},{key:"createAndFill",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,t=arguments.length>1?arguments[1]:void 0,n=arguments.length>2?arguments[2]:void 0;if(e=this.computeAttrs(e),(t=k.from(t)).size){var r=this.contentMatch.fillBefore(t);if(!r)return null;t=r.append(t)}var o=this.contentMatch.matchFragment(t),i=o&&o.fillBefore(k.empty,!0);return i?new W(this,e,t.append(i),C.setFrom(n)):null}},{key:"validContent",value:function(e){var t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(var n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).marks))return!1;return!0}},{key:"checkContent",value:function(e){if(!this.validContent(e))throw new RangeError("Invalid content for node ".concat(this.name,": ").concat(e.toString().slice(0,50)))}},{key:"checkAttrs",value:function(e){ie(this.attrs,e,"node",this.name)}},{key:"allowsMarkType",value:function(e){return null==this.markSet||this.markSet.indexOf(e)>-1}},{key:"allowsMarks",value:function(e){if(null==this.markSet)return!0;for(var t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}},{key:"allowedMarks",value:function(e){if(null==this.markSet)return e;for(var t,n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:C.none:e}}],[{key:"compile",value:function(t,n){var r=Object.create(null);t.forEach(function(t,o){return r[t]=new e(t,n,o)});var o=n.spec.topNode||"doc";if(!r[o])throw new RangeError("Schema is missing its top node type ('"+o+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(var i in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}}]),e}(),le=function(){function e(t,n,r){p(this,e),this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate="string"==typeof r.validate?function(e,t,n){var r=n.split("|");return function(n){var o=null===n?"null":h(n);if(r.indexOf(o)<0)throw new RangeError("Expected value of type ".concat(r," for attribute ").concat(t," on type ").concat(e,", got ").concat(o))}}(t,n,r.validate):r.validate}return m(e,[{key:"isRequired",get:function(){return!this.hasDefault}}]),e}(),ce=function(){function e(t,n,r,o){p(this,e),this.name=t,this.rank=n,this.schema=r,this.spec=o,this.attrs=se(t,o.attrs),this.excluded=null;var i=re(this.attrs);this.instance=i?new C(this,i):null}return m(e,[{key:"create",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!e&&this.instance?this.instance:new C(this,oe(this.attrs,e))}},{key:"removeFromSet",value:function(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}},{key:"isInSet",value:function(e){for(var t=0;t<e.length;t++)if(e[t].type==this)return e[t]}},{key:"checkAttrs",value:function(e){ie(this.attrs,e,"mark",this.name)}},{key:"excludes",value:function(e){return this.excluded.indexOf(e)>-1}}],[{key:"compile",value:function(t,n){var r=Object.create(null),o=0;return t.forEach(function(t,i){return r[t]=new e(t,o++,n,i)}),r}}]),e}(),de=function(){function e(t){var n=this;p(this,e),this.linebreakReplacement=null,this.cached=Object.create(null);var r=this.spec={};for(var o in t)r[o]=t[o];r.nodes=v.from(t.nodes),r.marks=v.from(t.marks||{}),this.nodes=ae.compile(this.spec.nodes,this),this.marks=ce.compile(this.spec.marks,this);var i=Object.create(null);for(var s in this.nodes){if(s in this.marks)throw new RangeError(s+" can not be both a node and a mark");var a=this.nodes[s],l=a.spec.content||"",c=a.spec.marks;if(a.contentMatch=i[l]||(i[l]=J.parse(l,this.nodes)),a.inlineContent=a.contentMatch.inlineContent,a.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!a.isInline||!a.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=a}a.markSet="_"==c?null:c?ue(this,c.split(" ")):""!=c&&a.inlineContent?null:[]}for(var d in this.marks){var u=this.marks[d],h=u.spec.excludes;u.excluded=null==h?[u]:""==h?[]:ue(this,h.split(" "))}this.nodeFromJSON=function(e){return W.fromJSON(n,e)},this.markFromJSON=function(e){return C.fromJSON(n,e)},this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}return m(e,[{key:"node",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0;if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof ae))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}},{key:"text",value:function(e,t){var n=this.nodes.text;return new q(n,n.defaultAttrs,e,C.setFrom(t))}},{key:"mark",value:function(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}},{key:"nodeType",value:function(e){var t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}]),e}();function ue(e,t){for(var n=[],r=0;r<t.length;r++){var o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(var a in e.marks){var l=e.marks[a];("_"==o||l.spec.group&&l.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}var he=function(){function e(t,n){var r=this;p(this,e),this.schema=t,this.rules=n,this.tags=[],this.styles=[];var o=this.matchedStyles=[];n.forEach(function(e){if(function(e){return null!=e.tag}(e))r.tags.push(e);else if(function(e){return null!=e.style}(e)){var t=/[^=]*/.exec(e.style)[0];o.indexOf(t)<0&&o.push(t),r.styles.push(e)}}),this.normalizeLists=!this.tags.some(function(e){if(!/^(ul|ol)\b/.test(e.tag)||!e.node)return!1;var n=t.nodes[e.node];return n.contentMatch.matchType(n)})}return m(e,[{key:"parse",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new ye(this,t,!1);return n.addAll(e,C.none,t.from,t.to),n.finish()}},{key:"parseSlice",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=new ye(this,t,!0);return n.addAll(e,C.none,t.from,t.to),T.maxOpen(n.finish())}},{key:"matchTag",value:function(e,t,n){for(var r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){var o=this.tags[r];if(be(e,o.tag)&&(void 0===o.namespace||e.namespaceURI==o.namespace)&&(!o.context||t.matchesContext(o.context))){if(o.getAttrs){var i=o.getAttrs(e);if(!1===i)continue;o.attrs=i||void 0}return o}}}},{key:"matchStyle",value:function(e,t,n,r){for(var o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){var i=this.styles[o],s=i.style;if(!(0!=s.indexOf(e)||i.context&&!n.matchesContext(i.context)||s.length>e.length&&(61!=s.charCodeAt(e.length)||s.slice(e.length+1)!=t))){if(i.getAttrs){var a=i.getAttrs(t);if(!1===a)continue;i.attrs=a||void 0}return i}}}}],[{key:"schemaRules",value:function(e){var t=[];function n(e){for(var n=null==e.priority?50:e.priority,r=0;r<t.length;r++){var o=t[r];if((null==o.priority?50:o.priority)<n)break}t.splice(r,0,e)}var r=function(t){var r=e.marks[t].spec.parseDOM;r&&r.forEach(function(e){n(e=ke(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})};for(var o in e.marks)r(o);var i=function(t){var r=e.nodes[t].spec.parseDOM;r&&r.forEach(function(e){n(e=ke(e)),e.node||e.ignore||e.mark||(e.node=t)})};for(var s in e.nodes)i(s);return t}},{key:"fromSchema",value:function(t){return t.cached.domParser||(t.cached.domParser=new e(t,e.schemaRules(t)))}}]),e}(),pe={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},fe={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},me={ol:!0,ul:!0};function ge(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}var ve=function(){function e(t,n,r,o,i,s){p(this,e),this.type=t,this.attrs=n,this.marks=r,this.solid=o,this.options=s,this.content=[],this.activeMarks=C.none,this.match=i||(4&s?null:t.contentMatch)}return m(e,[{key:"findWrapping",value:function(e){if(!this.match){if(!this.type)return[];var t=this.type.contentMatch.fillBefore(k.from(e));if(!t){var n,r=this.type.contentMatch;return(n=r.findWrapping(e.type))?(this.match=r,n):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}},{key:"finish",value:function(e){if(!(1&this.options)){var t,n=this.content[this.content.length-1];if(n&&n.isText&&(t=/[ \t\r\n\u000c]+$/.exec(n.text))){var r=n;n.text.length==t[0].length?this.content.pop():this.content[this.content.length-1]=r.withText(r.text.slice(0,r.text.length-t[0].length))}}var o=k.from(this.content);return!e&&this.match&&(o=o.append(this.match.fillBefore(k.empty,!0))),this.type?this.type.create(this.attrs,o,this.marks):o}},{key:"inlineContext",value:function(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!pe.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}]),e}(),ye=function(){function e(t,n,r){p(this,e),this.parser=t,this.options=n,this.isOpen=r,this.open=0,this.localPreserveWS=!1;var o,i=n.topNode,s=ge(null,n.preserveWhitespace,0)|(r?4:0);o=i?new ve(i.type,i.attrs,C.none,!0,n.topMatch||i.type.contentMatch,s):new ve(r?null:t.schema.topNodeType,null,C.none,!0,null,s),this.nodes=[o],this.find=n.findPositions,this.needsBlock=!1}return m(e,[{key:"top",get:function(){return this.nodes[this.open]}},{key:"addDOM",value:function(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}},{key:"addTextNode",value:function(e,t){var n=e.nodeValue,r=this.top,o=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,i=this.parser.schema;if("full"===o||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)if("full"===o)n=n.replace(/\r\n?/g,"\n");else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){for(var s=n.split(/\r?\n|\r/),a=0;a<s.length;a++)a&&this.insertNode(i.linebreakReplacement.create(),t,!0),s[a]&&this.insertNode(i.text(s[a]),t,!/\S/.test(s[a]));n=""}else 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){var l=r.content[r.content.length-1],c=e.previousSibling;(!l||c&&"BR"==c.nodeName||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}},{key:"addElement",value:function(e,t,n){var r=this.localPreserveWS,o=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);var i,s=e.nodeName.toLowerCase();me.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(var t=e.firstChild,n=null;t;t=t.nextSibling){var r=1==t.nodeType?t.nodeName.toLowerCase():null;r&&me.hasOwnProperty(r)&&n?(n.appendChild(t),t=n):"li"==r?n=t:r&&(n=null)}}(e);var a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(a?a.ignore:fe.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);var l,c=this.needsBlock;if(pe.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),l=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}var d=a&&a.skip?t:this.readStyles(e,t);d&&this.addAll(e,d),l&&this.sync(o),this.needsBlock=c}else{var u=this.readStyles(e,t);u&&this.addElementByRule(e,a,u,!1===a.consuming?i:void 0)}this.localPreserveWS=r}},{key:"leafFallback",value:function(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}},{key:"ignoreFallback",value:function(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}},{key:"readStyles",value:function(e,t){var n=this,r=e.style;if(r&&r.length)for(var o=0;o<this.parser.matchedStyles.length;o++){var i=this.parser.matchedStyles[o],s=r.getPropertyValue(i);if(s)for(var a,l=function(e){var r=n.parser.matchStyle(i,s,n,e);return r?r.ignore?{v:null}:(t=r.clearMark?t.filter(function(e){return!r.clearMark(e)}):t.concat(n.parser.schema.marks[r.mark].create(r.attrs)),!1!==r.consuming?(c=e,0):void(c=e=r)):(c=e,0)},c=void 0;0!==(a=l(c));)if(a)return a.v}return t}},{key:"addElementByRule",value:function(e,t,n,r){var o,i,s=this;if(t.node)if((i=this.parser.schema.nodes[t.node]).isLeaf)this.insertNode(i.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{var a=this.enter(i,t.attrs||null,n,t.preserveWhitespace);a&&(o=!0,n=a)}else{var l=this.parser.schema.marks[t.mark];n=n.concat(l.create(t.attrs))}var c=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(function(e){return s.insertNode(e,n,!1)});else{var d=e;"string"==typeof t.contentElement?d=e.querySelector(t.contentElement):"function"==typeof t.contentElement?d=t.contentElement(e):t.contentElement&&(d=t.contentElement),this.findAround(e,d,!0),this.addAll(d,n),this.findAround(e,d,!1)}o&&this.sync(c)&&this.open--}},{key:"addAll",value:function(e,t,n,r){for(var o=n||0,i=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}},{key:"findPlace",value:function(e,t,n){for(var r,o,i=this.open,s=0;i>=0;i--){var a=this.nodes[i],l=a.findWrapping(e);if(l&&(!r||r.length>l.length+s)&&(r=l,o=a,!l.length))break;if(a.solid){if(n)break;s+=2}}if(!r)return null;this.sync(o);for(var c=0;c<r.length;c++)t=this.enterInner(r[c],null,t,!1);return t}},{key:"insertNode",value:function(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){var o=this.textblockFromContext();o&&(t=this.enterInner(o,null,t))}var i=this.findPlace(e,t,n);if(i){this.closeExtra();var s=this.top;s.match&&(s.match=s.match.matchType(e.type));var a,l=C.none,c=function(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=function(e,t){if(e){if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?r(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var o=0,i=function(){};return{s:i,n:function(){return o>=e.length?{done:!0}:{done:!1,value:e[o++]}},e:function(e){throw e},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw s}}}}(i.concat(e.marks));try{for(c.s();!(a=c.n()).done;){var d=a.value;(s.type?s.type.allowsMarkType(d.type):we(d.type,e.type))&&(l=d.addToSet(l))}}catch(e){c.e(e)}finally{c.f()}return s.content.push(e.mark(l)),!0}return!1}},{key:"enter",value:function(e,t,n,r){var o=this.findPlace(e.create(t),n,!1);return o&&(o=this.enterInner(e,t,n,!0,r)),o}},{key:"enterInner",value:function(e,t,n){var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=arguments.length>4?arguments[4]:void 0;this.closeExtra();var i=this.top;i.match=i.match&&i.match.matchType(e);var s=ge(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);var a=C.none;return n=n.filter(function(t){return!(i.type?i.type.allowsMarkType(t.type):we(t.type,e))||(a=t.addToSet(a),!1)}),this.nodes.push(new ve(e,t,a,r,null,s)),this.open++,n}},{key:"closeExtra",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}},{key:"finish",value:function(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}},{key:"sync",value:function(e){for(var t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}},{key:"currentPos",get:function(){this.closeExtra();for(var e=0,t=this.open;t>=0;t--){for(var n=this.nodes[t].content,r=n.length-1;r>=0;r--)e+=n[r].nodeSize;t&&e++}return e}},{key:"findAtPoint",value:function(e,t){if(this.find)for(var n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}},{key:"findInside",value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}},{key:"findAround",value:function(e,t,n){if(e!=t&&this.find)for(var r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}},{key:"findInText",value:function(e){if(this.find)for(var t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}},{key:"matchesContext",value:function(e){var t=this;if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);var n=e.split("/"),r=this.options.context,o=!(this.isOpen||r&&r.parent.type!=this.nodes[0].type),i=-(r?r.depth+1:0)+(o?0:1);return function e(s,a){for(;s>=0;s--){var l=n[s];if(""==l){if(s==n.length-1||0==s)continue;for(;a>=i;a--)if(e(s-1,a))return!0;return!1}var c=a>0||0==a&&o?t.nodes[a].type:r&&a>=i?r.node(a-i).type:null;if(!c||c.name!=l&&!c.isInGroup(l))return!1;a--}return!0}(n.length-1,this.open)}},{key:"textblockFromContext",value:function(){var e=this.options.context;if(e)for(var t=e.depth;t>=0;t--){var n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(var r in this.parser.schema.nodes){var o=this.parser.schema.nodes[r];if(o.isTextblock&&o.defaultAttrs)return o}}}]),e}();function be(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function ke(e){var t={};for(var n in e)t[n]=e[n];return t}function we(e,t){var n,r=t.schema.nodes,o=function(){var n=r[i];if(!n.allowsMarkType(e))return 0;var o=[];return function e(n){o.push(n);for(var r=0;r<n.edgeCount;r++){var i=n.edge(r),s=i.type,a=i.next;if(s==t)return!0;if(o.indexOf(a)<0&&e(a))return!0}}(n.contentMatch)?{v:!0}:void 0};for(var i in r)if(0!==(n=o())&&n)return n.v}var xe=function(){function e(t,n){p(this,e),this.nodes=t,this.marks=n}return m(e,[{key:"serializeFragment",value:function(e){var t=this,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=arguments.length>2?arguments[2]:void 0;r||(r=Ce(n).createDocumentFragment());var o=r,i=[];return e.forEach(function(e){if(i.length||e.marks.length){for(var r=0,s=0;r<i.length&&s<e.marks.length;){var a=e.marks[s];if(t.marks[a.type.name]){if(!a.eq(i[r][0])||!1===a.type.spec.spanning)break;r++,s++}else s++}for(;r<i.length;)o=i.pop()[1];for(;s<e.marks.length;){var l=e.marks[s++],c=t.serializeMark(l,e.isInline,n);c&&(i.push([l,o]),o.appendChild(c.dom),o=c.contentDOM||c.dom)}}o.appendChild(t.serializeNodeInner(e,n))}),r}},{key:"serializeNodeInner",value:function(e,t){var n=Te(Ce(t),this.nodes[e.type.name](e),null,e.attrs),r=n.dom,o=n.contentDOM;if(o){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,o)}return r}},{key:"serializeNode",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=this.serializeNodeInner(e,t),r=e.marks.length-1;r>=0;r--){var o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}},{key:"serializeMark",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},r=this.marks[e.type.name];return r&&Te(Ce(n),r(e,t),null,e.attrs)}}],[{key:"renderSpec",value:function(e,t){return Te(e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0)}},{key:"fromSchema",value:function(t){return t.cached.domSerializer||(t.cached.domSerializer=new e(this.nodesFromSchema(t),this.marksFromSchema(t)))}},{key:"nodesFromSchema",value:function(e){var t=Se(e.nodes);return t.text||(t.text=function(e){return e.text}),t}},{key:"marksFromSchema",value:function(e){return Se(e.marks)}}]),e}();function Se(e){var t={};for(var n in e){var r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function Ce(e){return e.document||window.document}var Me=new WeakMap;function Te(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;var o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=function(e){var t=Me.get(e);return void 0===t&&Me.set(e,t=function(e){var t=null;return function e(n){if(n&&"object"==h(n))if(Array.isArray(n))if("string"==typeof n[0])t||(t=[]),t.push(n);else for(var r=0;r<n.length;r++)e(n[r]);else for(var o in n)e(n[o])}(e),t}(e)),t}(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");var s,a=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));var l=n?e.createElementNS(n,i):e.createElement(i),c=t[1],d=1;if(c&&"object"==h(c)&&null==c.nodeType&&!Array.isArray(c))for(var u in d=2,c)if(null!=c[u]){var p=u.indexOf(" ");p>0?l.setAttributeNS(u.slice(0,p),u.slice(p+1),c[u]):"style"==u&&l.style?l.style.cssText=c[u]:l.setAttribute(u,c[u])}for(var f=d;f<t.length;f++){var m=t[f];if(0===m){if(f<t.length-1||f>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}var g=Te(e,m,n,r),v=g.dom,y=g.contentDOM;if(l.appendChild(v),y){if(s)throw new RangeError("Multiple content holes");s=y}}return{dom:l,contentDOM:s}}t.ContentMatch=J,t.DOMParser=he,t.DOMSerializer=xe,t.Fragment=k,t.Mark=C,t.MarkType=ce,t.Node=W,t.NodeRange=_,t.NodeType=ae,t.ReplaceError=M,t.ResolvedPos=F,t.Schema=de,t.Slice=T},4243:function(e,t,n){"use strict";var r=n(6553),o=n(7712),i=n(7820),s=["ol",0],a=["ul",0],l=["li",0],c={attrs:{order:{default:1,validate:"number"}},parseDOM:[{tag:"ol",getAttrs:function(e){return{order:e.hasAttribute("start")?+e.getAttribute("start"):1}}}],toDOM:function(e){return 1==e.attrs.order?s:["ol",{start:e.attrs.order},0]}},d={parseDOM:[{tag:"ul"}],toDOM:function(){return a}},u={parseDOM:[{tag:"li"}],toDOM:function(){return l},defining:!0};function h(e,t){var n={};for(var r in e)n[r]=e[r];for(var o in t)n[o]=t[o];return n}function p(e,t,n){var i=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null,s=!1,a=t,l=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;var c=l.resolve(t.start-2);a=new o.NodeRange(c,c,t.depth),t.endIndex<t.parent.childCount&&(t=new o.NodeRange(t.$from,l.resolve(t.$to.end(t.depth)),t.depth)),s=!0}var d=r.findWrapping(a,n,i,t);return!!d&&(e&&function(e,t,n,i,s){for(var a=o.Fragment.empty,l=n.length-1;l>=0;l--)a=o.Fragment.from(n[l].type.create(n[l].attrs,a));e.step(new r.ReplaceAroundStep(t.start-(i?2:0),t.end,t.start,t.end,new o.Slice(a,0,0),n.length,!0));for(var c=0,d=0;d<n.length;d++)n[d].type==s&&(c=d+1);for(var u=n.length-c,h=t.start+n.length-(i?2:0),p=t.parent,f=t.startIndex,m=t.endIndex,g=!0;f<m;f++,g=!1)!g&&r.canSplit(e.doc,h,u)&&(e.split(h,u),h+=2*u),h+=p.child(f).nodeSize}(e,t,d,s,n),!0)}function f(e,t){return function(n,s){var a=n.selection,l=a.$from,c=a.$to,d=a.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;var u=l.node(-1);if(u.type!=e)return!1;if(0==l.parent.content.size&&l.node(-1).childCount==l.indexAfter(-1)){if(3==l.depth||l.node(-3).type!=e||l.index(-2)!=l.node(-2).childCount-1)return!1;if(s){for(var h=o.Fragment.empty,p=l.index(-1)?1:l.index(-2)?2:3,f=l.depth-p;f>=l.depth-3;f--)h=o.Fragment.from(l.node(f).copy(h));var m=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3;h=h.append(o.Fragment.from(e.createAndFill()));var g=l.before(l.depth-(p-1)),v=n.tr.replace(g,l.after(-m),new o.Slice(h,4-p,0)),y=-1;v.doc.nodesBetween(g,v.doc.content.size,function(e,t){if(y>-1)return!1;e.isTextblock&&0==e.content.size&&(y=t+1)}),y>-1&&v.setSelection(i.Selection.near(v.doc.resolve(y))),s(v.scrollIntoView())}return!0}var b=c.pos==l.end()?u.contentMatchAt(0).defaultType:null,k=n.tr.delete(l.pos,c.pos),w=b?[t?{type:e,attrs:t}:null,{type:b}]:void 0;return!!r.canSplit(k.doc,l.pos,2,w)&&(s&&s(k.split(l.pos,2,w).scrollIntoView()),!0)}}t.addListNodes=function(e,t,n){return e.append({ordered_list:h(c,{content:"list_item+",group:n}),bullet_list:h(d,{content:"list_item+",group:n}),list_item:h(u,{content:t})})},t.bulletList=d,t.liftListItem=function(e){return function(t,n){var i=t.selection,s=i.$from,a=i.$to,l=s.blockRange(a,function(t){return t.childCount>0&&t.firstChild.type==e});return!!l&&(!n||(s.node(l.depth-1).type==e?function(e,t,n,i){var s=e.tr,a=i.end,l=i.$to.end(i.depth);a<l&&(s.step(new r.ReplaceAroundStep(a-1,l,a,l,new o.Slice(o.Fragment.from(n.create(null,i.parent.copy())),1,0),1,!0)),i=new o.NodeRange(s.doc.resolve(i.$from.pos),s.doc.resolve(l),i.depth));var c=r.liftTarget(i);if(null==c)return!1;s.lift(i,c);var d=s.doc.resolve(s.mapping.map(a,-1)-1);return r.canJoin(s.doc,d.pos)&&d.nodeBefore.type==d.nodeAfter.type&&s.join(d.pos),t(s.scrollIntoView()),!0}(t,n,e,l):function(e,t,n){for(var i=e.tr,s=n.parent,a=n.end,l=n.endIndex-1,c=n.startIndex;l>c;l--)a-=s.child(l).nodeSize,i.delete(a-1,a+1);var d=i.doc.resolve(n.start),u=d.nodeAfter;if(i.mapping.map(n.end)!=n.start+d.nodeAfter.nodeSize)return!1;var h=0==n.startIndex,p=n.endIndex==s.childCount,f=d.node(-1),m=d.index(-1);if(!f.canReplace(m+(h?0:1),m+1,u.content.append(p?o.Fragment.empty:o.Fragment.from(s))))return!1;var g=d.pos,v=g+u.nodeSize;return i.step(new r.ReplaceAroundStep(g-(h?1:0),v+(p?1:0),g+1,v-1,new o.Slice((h?o.Fragment.empty:o.Fragment.from(s.copy(o.Fragment.empty))).append(p?o.Fragment.empty:o.Fragment.from(s.copy(o.Fragment.empty))),h?0:1,p?0:1),h?0:1)),t(i.scrollIntoView()),!0}(t,n,l)))}},t.listItem=u,t.orderedList=c,t.sinkListItem=function(e){return function(t,n){var i=t.selection,s=i.$from,a=i.$to,l=s.blockRange(a,function(t){return t.childCount>0&&t.firstChild.type==e});if(!l)return!1;var c=l.startIndex;if(0==c)return!1;var d=l.parent,u=d.child(c-1);if(u.type!=e)return!1;if(n){var h=u.lastChild&&u.lastChild.type==d.type,p=o.Fragment.from(h?e.create():null),f=new o.Slice(o.Fragment.from(e.create(null,o.Fragment.from(d.type.create(null,p)))),h?3:1,0),m=l.start,g=l.end;n(t.tr.step(new r.ReplaceAroundStep(m-(h?3:1),g,m,g,f,1,!0)).scrollIntoView())}return!0}},t.splitListItem=f,t.splitListItemKeepMarks=function(e,t){var n=f(e,t);return function(e,t){return n(e,t&&function(n){var r=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();r&&n.ensureMarks(r),t(n)})}},t.wrapInList=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return function(n,r){var o=n.selection,i=o.$from,s=o.$to,a=i.blockRange(s);if(!a)return!1;var l=r?n.tr:null;return!!p(l,a,e,t)&&(r&&r(l.scrollIntoView()),!0)}},t.wrapRangeInList=p},7820:function(e,t,n){"use strict";function r(){return r="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=a(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},r.apply(this,arguments)}function o(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&i(e,t)}function i(e,t){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},i(e,t)}function s(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=a(e);if(t){var o=a(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===l(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function a(e){return a=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},a(e)}function l(e){return l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l(e)}function c(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function d(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,h(r.key),r)}}function u(e,t,n){return t&&d(e.prototype,t),n&&d(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function h(e){var t=function(e){if("object"!==l(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==l(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===l(t)?t:String(t)}var p=n(7712),f=n(6553),m=Object.create(null),g=function(){function e(t,n,r){c(this,e),this.$anchor=t,this.$head=n,this.ranges=r||[new v(t.min(n),t.max(n))]}return u(e,[{key:"anchor",get:function(){return this.$anchor.pos}},{key:"head",get:function(){return this.$head.pos}},{key:"from",get:function(){return this.$from.pos}},{key:"to",get:function(){return this.$to.pos}},{key:"$from",get:function(){return this.ranges[0].$from}},{key:"$to",get:function(){return this.ranges[0].$to}},{key:"empty",get:function(){for(var e=this.ranges,t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}},{key:"content",value:function(){return this.$from.doc.slice(this.from,this.to,!0)}},{key:"replace",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p.Slice.empty,n=t.content.lastChild,r=null,o=0;o<t.openEnd;o++)r=n,n=n.lastChild;for(var i=e.steps.length,s=this.ranges,a=0;a<s.length;a++){var l=s[a],c=l.$from,d=l.$to,u=e.mapping.slice(i);e.replaceRange(u.map(c.pos),u.map(d.pos),a?p.Slice.empty:t),0==a&&A(e,i,(n?n.isInline:r&&r.isTextblock)?-1:1)}}},{key:"replaceWith",value:function(e,t){for(var n=e.steps.length,r=this.ranges,o=0;o<r.length;o++){var i=r[o],s=i.$from,a=i.$to,l=e.mapping.slice(n),c=l.map(s.pos),d=l.map(a.pos);o?e.deleteRange(c,d):(e.replaceRangeWith(c,d,t),A(e,n,t.isInline?-1:1))}}},{key:"getBookmark",value:function(){return k.between(this.$anchor,this.$head).getBookmark()}}],[{key:"findFrom",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]&&arguments[2],r=e.parent.inlineContent?new k(e):T(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(var o=e.depth-1;o>=0;o--){var i=t<0?T(e.node(0),e.node(o),e.before(o+1),e.index(o),t,n):T(e.node(0),e.node(o),e.after(o+1),e.index(o)+1,t,n);if(i)return i}return null}},{key:"near",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this.findFrom(e,t)||this.findFrom(e,-t)||new C(e.node(0))}},{key:"atStart",value:function(e){return T(e,e,0,0,1)||new C(e)}},{key:"atEnd",value:function(e){return T(e,e,e.content.size,e.childCount,-1)||new C(e)}},{key:"fromJSON",value:function(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");var n=m[t.type];if(!n)throw new RangeError("No selection type ".concat(t.type," defined"));return n.fromJSON(e,t)}},{key:"jsonID",value:function(e,t){if(e in m)throw new RangeError("Duplicate use of selection JSON ID "+e);return m[e]=t,t.prototype.jsonID=e,t}}]),e}();g.prototype.visible=!0;var v=u(function e(t,n){c(this,e),this.$from=t,this.$to=n}),y=!1;function b(e){y||e.parent.inlineContent||(y=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}var k=function(e){o(n,e);var t=s(n);function n(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e;return c(this,n),b(e),b(r),t.call(this,e,r)}return u(n,[{key:"$cursor",get:function(){return this.$anchor.pos==this.$head.pos?this.$head:null}},{key:"map",value:function(e,t){var r=e.resolve(t.map(this.head));if(!r.parent.inlineContent)return g.near(r);var o=e.resolve(t.map(this.anchor));return new n(o.parent.inlineContent?o:r,r)}},{key:"replace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p.Slice.empty;if(r(a(n.prototype),"replace",this).call(this,e,t),t==p.Slice.empty){var o=this.$from.marksAcross(this.$to);o&&e.ensureMarks(o)}}},{key:"eq",value:function(e){return e instanceof n&&e.anchor==this.anchor&&e.head==this.head}},{key:"getBookmark",value:function(){return new w(this.anchor,this.head)}},{key:"toJSON",value:function(){return{type:"text",anchor:this.anchor,head:this.head}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(e.resolve(t.anchor),e.resolve(t.head))}},{key:"create",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}},{key:"between",value:function(e,t,r){var o=e.pos-t.pos;if(r&&!o||(r=o>=0?1:-1),!t.parent.inlineContent){var i=g.findFrom(t,r,!0)||g.findFrom(t,-r,!0);if(!i)return g.near(t,r);t=i.$head}return e.parent.inlineContent||(0==o||(e=(g.findFrom(e,-r,!0)||g.findFrom(e,r,!0)).$anchor).pos<t.pos!=o<0)&&(e=t),new n(e,t)}}]),n}(g);g.jsonID("text",k);var w=function(){function e(t,n){c(this,e),this.anchor=t,this.head=n}return u(e,[{key:"map",value:function(t){return new e(t.map(this.anchor),t.map(this.head))}},{key:"resolve",value:function(e){return k.between(e.resolve(this.anchor),e.resolve(this.head))}}]),e}(),x=function(e){o(n,e);var t=s(n);function n(e){var r;c(this,n);var o=e.nodeAfter,i=e.node(0).resolve(e.pos+o.nodeSize);return(r=t.call(this,e,i)).node=o,r}return u(n,[{key:"map",value:function(e,t){var r=t.mapResult(this.anchor),o=r.deleted,i=r.pos,s=e.resolve(i);return o?g.near(s):new n(s)}},{key:"content",value:function(){return new p.Slice(p.Fragment.from(this.node),0,0)}},{key:"eq",value:function(e){return e instanceof n&&e.anchor==this.anchor}},{key:"toJSON",value:function(){return{type:"node",anchor:this.anchor}}},{key:"getBookmark",value:function(){return new S(this.anchor)}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new n(e.resolve(t.anchor))}},{key:"create",value:function(e,t){return new n(e.resolve(t))}},{key:"isSelectable",value:function(e){return!e.isText&&!1!==e.type.spec.selectable}}]),n}(g);x.prototype.visible=!1,g.jsonID("node",x);var S=function(){function e(t){c(this,e),this.anchor=t}return u(e,[{key:"map",value:function(t){var n=t.mapResult(this.anchor),r=n.deleted,o=n.pos;return r?new w(o,o):new e(o)}},{key:"resolve",value:function(e){var t=e.resolve(this.anchor),n=t.nodeAfter;return n&&x.isSelectable(n)?new x(t):g.near(t)}}]),e}(),C=function(e){o(n,e);var t=s(n);function n(e){return c(this,n),t.call(this,e.resolve(0),e.resolve(e.content.size))}return u(n,[{key:"replace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:p.Slice.empty;if(t==p.Slice.empty){e.delete(0,e.doc.content.size);var o=g.atStart(e.doc);o.eq(e.selection)||e.setSelection(o)}else r(a(n.prototype),"replace",this).call(this,e,t)}},{key:"toJSON",value:function(){return{type:"all"}}},{key:"map",value:function(e){return new n(e)}},{key:"eq",value:function(e){return e instanceof n}},{key:"getBookmark",value:function(){return M}}],[{key:"fromJSON",value:function(e){return new n(e)}}]),n}(g);g.jsonID("all",C);var M={map:function(){return this},resolve:function(e){return new C(e)}};function T(e,t,n,r,o){var i=arguments.length>5&&void 0!==arguments[5]&&arguments[5];if(t.inlineContent)return k.create(e,n);for(var s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){var a=t.child(s);if(a.isAtom){if(!i&&x.isSelectable(a))return x.create(e,n-(o<0?a.nodeSize:0))}else{var l=T(e,a,n+o,o<0?a.childCount:0,o,i);if(l)return l}n+=a.nodeSize*o}return null}function A(e,t,n){var r=e.steps.length-1;if(!(r<t)){var o,i=e.steps[r];(i instanceof f.ReplaceStep||i instanceof f.ReplaceAroundStep)&&(e.mapping.maps[r].forEach(function(e,t,n,r){null==o&&(o=r)}),e.setSelection(g.near(e.doc.resolve(o),n)))}}var O=function(e){o(n,e);var t=s(n);function n(e){var r;return c(this,n),(r=t.call(this,e.doc)).curSelectionFor=0,r.updated=0,r.meta=Object.create(null),r.time=Date.now(),r.curSelection=e.selection,r.storedMarks=e.storedMarks,r}return u(n,[{key:"selection",get:function(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}},{key:"setSelection",value:function(e){if(e.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=e,this.curSelectionFor=this.steps.length,this.updated=-3&this.updated|1,this.storedMarks=null,this}},{key:"selectionSet",get:function(){return(1&this.updated)>0}},{key:"setStoredMarks",value:function(e){return this.storedMarks=e,this.updated|=2,this}},{key:"ensureMarks",value:function(e){return p.Mark.sameSet(this.storedMarks||this.selection.$from.marks(),e)||this.setStoredMarks(e),this}},{key:"addStoredMark",value:function(e){return this.ensureMarks(e.addToSet(this.storedMarks||this.selection.$head.marks()))}},{key:"removeStoredMark",value:function(e){return this.ensureMarks(e.removeFromSet(this.storedMarks||this.selection.$head.marks()))}},{key:"storedMarksSet",get:function(){return(2&this.updated)>0}},{key:"addStep",value:function(e,t){r(a(n.prototype),"addStep",this).call(this,e,t),this.updated=-3&this.updated,this.storedMarks=null}},{key:"setTime",value:function(e){return this.time=e,this}},{key:"replaceSelection",value:function(e){return this.selection.replace(this,e),this}},{key:"replaceSelectionWith",value:function(e){var t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=this.selection;return t&&(e=e.mark(this.storedMarks||(n.empty?n.$from.marks():n.$from.marksAcross(n.$to)||p.Mark.none))),n.replaceWith(this,e),this}},{key:"deleteSelection",value:function(){return this.selection.replace(this),this}},{key:"insertText",value:function(e,t,n){var r=this.doc.type.schema;if(null==t)return e?this.replaceSelectionWith(r.text(e),!0):this.deleteSelection();if(null==n&&(n=t),!e)return this.deleteRange(t,n);var o=this.storedMarks;if(!o){var i=this.doc.resolve(t);o=n==t?i.marks():i.marksAcross(this.doc.resolve(n))}return this.replaceRangeWith(t,n,r.text(e,o)),this.selection.empty||this.selection.to!=t+e.length||this.setSelection(g.near(this.selection.$to)),this}},{key:"setMeta",value:function(e,t){return this.meta["string"==typeof e?e:e.key]=t,this}},{key:"getMeta",value:function(e){return this.meta["string"==typeof e?e:e.key]}},{key:"isGeneric",get:function(){for(var e in this.meta)return!1;return!0}},{key:"scrollIntoView",value:function(){return this.updated|=4,this}},{key:"scrolledIntoView",get:function(){return(4&this.updated)>0}}]),n}(f.Transform);function E(e,t){return t&&e?e.bind(t):e}var N=u(function e(t,n,r){c(this,e),this.name=t,this.init=E(n.init,r),this.apply=E(n.apply,r)}),R=[new N("doc",{init:function(e){return e.doc||e.schema.topNodeType.createAndFill()},apply:function(e){return e.doc}}),new N("selection",{init:function(e,t){return e.selection||g.atStart(t.doc)},apply:function(e){return e.selection}}),new N("storedMarks",{init:function(e){return e.storedMarks||null},apply:function(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new N("scrollToSelection",{init:function(){return 0},apply:function(e,t){return e.scrolledIntoView?t+1:t}})],D=u(function e(t,n){var r=this;c(this,e),this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=R.slice(),n&&n.forEach(function(e){if(r.pluginsByKey[e.key])throw new RangeError("Adding different instances of a keyed plugin ("+e.key+")");r.plugins.push(e),r.pluginsByKey[e.key]=e,e.spec.state&&r.fields.push(new N(e.key,e.spec.state,e))})}),P=function(){function e(t){c(this,e),this.config=t}return u(e,[{key:"schema",get:function(){return this.config.schema}},{key:"plugins",get:function(){return this.config.plugins}},{key:"apply",value:function(e){return this.applyTransaction(e).state}},{key:"filterTransaction",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:-1,n=0;n<this.config.plugins.length;n++)if(n!=t){var r=this.config.plugins[n];if(r.spec.filterTransaction&&!r.spec.filterTransaction.call(r,e,this))return!1}return!0}},{key:"applyTransaction",value:function(e){if(!this.filterTransaction(e))return{state:this,transactions:[]};for(var t=[e],n=this.applyInner(e),r=null;;){for(var o=!1,i=0;i<this.config.plugins.length;i++){var s=this.config.plugins[i];if(s.spec.appendTransaction){var a=r?r[i].n:0,l=r?r[i].state:this,c=a<t.length&&s.spec.appendTransaction.call(s,a?t.slice(a):t,l,n);if(c&&n.filterTransaction(c,i)){if(c.setMeta("appendedTransaction",e),!r){r=[];for(var d=0;d<this.config.plugins.length;d++)r.push(d<i?{state:n,n:t.length}:{state:this,n:0})}t.push(c),n=n.applyInner(c),o=!0}r&&(r[i]={state:n,n:t.length})}}if(!o)return{state:n,transactions:t}}}},{key:"applyInner",value:function(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");for(var n=new e(this.config),r=this.config.fields,o=0;o<r.length;o++){var i=r[o];n[i.name]=i.apply(t,this[i.name],this,n)}return n}},{key:"tr",get:function(){return new O(this)}},{key:"reconfigure",value:function(t){for(var n=new D(this.schema,t.plugins),r=n.fields,o=new e(n),i=0;i<r.length;i++){var s=r[i].name;o[s]=this.hasOwnProperty(s)?this[s]:r[i].init(t,o)}return o}},{key:"toJSON",value:function(e){var t={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(t.storedMarks=this.storedMarks.map(function(e){return e.toJSON()})),e&&"object"==l(e))for(var n in e){if("doc"==n||"selection"==n)throw new RangeError("The JSON fields `doc` and `selection` are reserved");var r=e[n],o=r.spec.state;o&&o.toJSON&&(t[n]=o.toJSON.call(r,this[r.key]))}return t}}],[{key:"create",value:function(t){for(var n=new D(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new e(n),o=0;o<n.fields.length;o++)r[n.fields[o].name]=n.fields[o].init(t,r);return r}},{key:"fromJSON",value:function(t,n,r){if(!n)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");var o=new D(t.schema,t.plugins),i=new e(o);return o.fields.forEach(function(e){if("doc"==e.name)i.doc=p.Node.fromJSON(t.schema,n.doc);else if("selection"==e.name)i.selection=g.fromJSON(i.doc,n.selection);else if("storedMarks"==e.name)n.storedMarks&&(i.storedMarks=n.storedMarks.map(t.schema.markFromJSON));else{if(r)for(var o in r){var s=r[o],a=s.spec.state;if(s.key==e.name&&a&&a.fromJSON&&Object.prototype.hasOwnProperty.call(n,o))return void(i[e.name]=a.fromJSON.call(s,t,n[o],i))}i[e.name]=e.init(t,i)}}),i}}]),e}();function $(e,t,n){for(var r in e){var o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=$(o,t,{})),n[r]=o}return n}var I=function(){function e(t){c(this,e),this.spec=t,this.props={},t.props&&$(t.props,this,this.props),this.key=t.key?t.key.key:L("plugin")}return u(e,[{key:"getState",value:function(e){return e[this.key]}}]),e}(),z=Object.create(null);function L(e){return e in z?e+"$"+ ++z[e]:(z[e]=0,e+"$")}var F=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"key";c(this,e),this.key=L(t)}return u(e,[{key:"get",value:function(e){return e.config.pluginsByKey[this.key]}},{key:"getState",value:function(e){return e[this.key]}}]),e}();t.AllSelection=C,t.EditorState=P,t.NodeSelection=x,t.Plugin=I,t.PluginKey=F,t.Selection=g,t.SelectionRange=v,t.TextSelection=k,t.Transaction=O},6553:function(e,t,n){"use strict";function r(e){var t="function"==typeof Map?new Map:void 0;return r=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,n)}function n(){return o(e,arguments,c(this).constructor)}return n.prototype=Object.create(e.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),s(n,e)},r(e)}function o(e,t,n){return o=l()?Reflect.construct.bind():function(e,t,n){var r=[null];r.push.apply(r,t);var o=new(Function.bind.apply(e,r));return n&&s(o,n.prototype),o},o.apply(null,arguments)}function i(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&s(e,t)}function s(e,t){return s=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},s(e,t)}function a(e){var t=l();return function(){var n,r=c(e);if(t){var o=c(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===d(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return function(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}(e)}(this,n)}}function l(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}function c(e){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},c(e)}function d(e){return d="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},d(e)}function u(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function h(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,f(r.key),r)}}function p(e,t,n){return t&&h(e.prototype,t),n&&h(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function f(e){var t=function(e){if("object"!==d(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==d(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===d(t)?t:String(t)}var m=n(7712),g=Math.pow(2,16);function v(e,t){return e+t*g}function y(e){return 65535&e}var b=function(){function e(t,n,r){u(this,e),this.pos=t,this.delInfo=n,this.recover=r}return p(e,[{key:"deleted",get:function(){return(8&this.delInfo)>0}},{key:"deletedBefore",get:function(){return(5&this.delInfo)>0}},{key:"deletedAfter",get:function(){return(6&this.delInfo)>0}},{key:"deletedAcross",get:function(){return(4&this.delInfo)>0}}]),e}(),k=function(){function e(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(u(this,e),this.ranges=t,this.inverted=n,!t.length&&e.empty)return e.empty}return p(e,[{key:"recover",value:function(e){var t=0,n=y(e);if(!this.inverted)for(var r=0;r<n;r++)t+=this.ranges[3*r+2]-this.ranges[3*r+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/g}(e)}},{key:"mapResult",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!1)}},{key:"map",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!0)}},{key:"_map",value:function(e,t,n){for(var r=0,o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;var l=this.ranges[s+o],c=this.ranges[s+i],d=a+l;if(e<=d){var u=a+r+((l?e==a?-1:e==d?1:t:t)<0?0:c);if(n)return u;var h=e==(t<0?a:d)?null:v(s/3,e-a),p=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(p|=8),new b(u,p,h)}r+=c-l}return n?e+r:new b(e+r,0,null)}},{key:"touches",value:function(e,t){for(var n=0,r=y(t),o=this.inverted?2:1,i=this.inverted?1:2,s=0;s<this.ranges.length;s+=3){var a=this.ranges[s]-(this.inverted?n:0);if(a>e)break;var l=this.ranges[s+o];if(e<=a+l&&s==3*r)return!0;n+=this.ranges[s+i]-l}return!1}},{key:"forEach",value:function(e){for(var t=this.inverted?2:1,n=this.inverted?1:2,r=0,o=0;r<this.ranges.length;r+=3){var i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}}},{key:"invert",value:function(){return new e(this.ranges,!this.inverted)}},{key:"toString",value:function(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}}],[{key:"offset",value:function(t){return 0==t?e.empty:new e(t<0?[0,-t,0]:[0,0,t])}}]),e}();k.empty=new k([]);var w=function(){function e(t,n){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,o=arguments.length>3&&void 0!==arguments[3]?arguments[3]:t?t.length:0;u(this,e),this.mirror=n,this.from=r,this.to=o,this._maps=t||[],this.ownData=!(t||n)}return p(e,[{key:"maps",get:function(){return this._maps}},{key:"slice",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.maps.length;return new e(this._maps,this.mirror,t,n)}},{key:"appendMap",value:function(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}},{key:"appendMapping",value:function(e){for(var t=0,n=this._maps.length;t<e._maps.length;t++){var r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}},{key:"getMirror",value:function(e){if(this.mirror)for(var t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}},{key:"setMirror",value:function(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}},{key:"appendMappingInverted",value:function(e){for(var t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){var r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}},{key:"invert",value:function(){var t=new e;return t.appendMappingInverted(this),t}},{key:"map",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;if(this.mirror)return this._map(e,t,!0);for(var n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}},{key:"mapResult",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;return this._map(e,t,!1)}},{key:"_map",value:function(e,t,n){for(var r=0,o=this.from;o<this.to;o++){var i=this._maps[o].mapResult(e,t);if(null!=i.recover){var s=this.getMirror(o);if(null!=s&&s>o&&s<this.to){o=s,e=this._maps[s].recover(i.recover);continue}}r|=i.delInfo,e=i.pos}return n?e:new b(e,r,null)}}]),e}(),x=Object.create(null),S=function(){function e(){u(this,e)}return p(e,[{key:"getMap",value:function(){return k.empty}},{key:"merge",value:function(e){return null}}],[{key:"fromJSON",value:function(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");var n=x[t.stepType];if(!n)throw new RangeError("No step type ".concat(t.stepType," defined"));return n.fromJSON(e,t)}},{key:"jsonID",value:function(e,t){if(e in x)throw new RangeError("Duplicate use of step JSON ID "+e);return x[e]=t,t.prototype.jsonID=e,t}}]),e}(),C=function(){function e(t,n){u(this,e),this.doc=t,this.failed=n}return p(e,null,[{key:"ok",value:function(t){return new e(t,null)}},{key:"fail",value:function(t){return new e(null,t)}},{key:"fromReplace",value:function(t,n,r,o){try{return e.ok(t.replace(n,r,o))}catch(t){if(t instanceof m.ReplaceError)return e.fail(t.message);throw t}}}]),e}();function M(e,t,n){for(var r=[],o=0;o<e.childCount;o++){var i=e.child(o);i.content.size&&(i=i.copy(M(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return m.Fragment.fromArray(r)}var T=function(e){i(n,e);var t=a(n);function n(e,r,o){var i;return u(this,n),(i=t.call(this)).from=e,i.to=r,i.mark=o,i}return p(n,[{key:"apply",value:function(e){var t=this,n=e.slice(this.from,this.to),r=e.resolve(this.from),o=r.node(r.sharedDepth(this.to)),i=new m.Slice(M(n.content,function(e,n){return e.isAtom&&n.type.allowsMarkType(t.mark.type)?e.mark(t.mark.addToSet(e.marks)):e},o),n.openStart,n.openEnd);return C.fromReplace(e,this.from,this.to,i)}},{key:"invert",value:function(){return new A(this.from,this.to,this.mark)}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}},{key:"merge",value:function(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:"toJSON",value:function(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}}]),n}(S);S.jsonID("addMark",T);var A=function(e){i(n,e);var t=a(n);function n(e,r,o){var i;return u(this,n),(i=t.call(this)).from=e,i.to=r,i.mark=o,i}return p(n,[{key:"apply",value:function(e){var t=this,n=e.slice(this.from,this.to),r=new m.Slice(M(n.content,function(e){return e.mark(t.mark.removeFromSet(e.marks))},e),n.openStart,n.openEnd);return C.fromReplace(e,this.from,this.to,r)}},{key:"invert",value:function(){return new T(this.from,this.to,this.mark)}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deleted&&r.deleted||t.pos>=r.pos?null:new n(t.pos,r.pos,this.mark)}},{key:"merge",value:function(e){return e instanceof n&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new n(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}},{key:"toJSON",value:function(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new n(t.from,t.to,e.markFromJSON(t.mark))}}]),n}(S);S.jsonID("removeMark",A);var O=function(e){i(n,e);var t=a(n);function n(e,r){var o;return u(this,n),(o=t.call(this)).pos=e,o.mark=r,o}return p(n,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return C.fail("No node at mark step's position");var n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return C.fromReplace(e,this.pos,this.pos+1,new m.Slice(m.Fragment.from(n),0,t.isLeaf?0:1))}},{key:"invert",value:function(e){var t=e.nodeAt(this.pos);if(t){var r=this.mark.addToSet(t.marks);if(r.length==t.marks.length){for(var o=0;o<t.marks.length;o++)if(!t.marks[o].isInSet(r))return new n(this.pos,t.marks[o]);return new n(this.pos,this.mark)}}return new E(this.pos,this.mark)}},{key:"map",value:function(e){var t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}},{key:"toJSON",value:function(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new n(t.pos,e.markFromJSON(t.mark))}}]),n}(S);S.jsonID("addNodeMark",O);var E=function(e){i(n,e);var t=a(n);function n(e,r){var o;return u(this,n),(o=t.call(this)).pos=e,o.mark=r,o}return p(n,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return C.fail("No node at mark step's position");var n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return C.fromReplace(e,this.pos,this.pos+1,new m.Slice(m.Fragment.from(n),0,t.isLeaf?0:1))}},{key:"invert",value:function(e){var t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new O(this.pos,this.mark):this}},{key:"map",value:function(e){var t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.mark)}},{key:"toJSON",value:function(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new n(t.pos,e.markFromJSON(t.mark))}}]),n}(S);S.jsonID("removeNodeMark",E);var N=function(e){i(n,e);var t=a(n);function n(e,r,o){var i,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];return u(this,n),(i=t.call(this)).from=e,i.to=r,i.slice=o,i.structure=s,i}return p(n,[{key:"apply",value:function(e){return this.structure&&D(e,this.from,this.to)?C.fail("Structure replace would overwrite content"):C.fromReplace(e,this.from,this.to,this.slice)}},{key:"getMap",value:function(){return new k([this.from,this.to-this.from,this.slice.size])}},{key:"invert",value:function(e){return new n(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1);return t.deletedAcross&&r.deletedAcross?null:new n(t.pos,Math.max(t.pos,r.pos),this.slice,this.structure)}},{key:"merge",value:function(e){if(!(e instanceof n)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;var t=this.slice.size+e.slice.size==0?m.Slice.empty:new m.Slice(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new n(e.from,this.to,t,this.structure)}var r=this.slice.size+e.slice.size==0?m.Slice.empty:new m.Slice(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new n(this.from,this.to+(e.to-e.from),r,this.structure)}},{key:"toJSON",value:function(){var e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new n(t.from,t.to,m.Slice.fromJSON(e,t.slice),!!t.structure)}}]),n}(S);S.jsonID("replace",N);var R=function(e){i(n,e);var t=a(n);function n(e,r,o,i,s,a){var l,c=arguments.length>6&&void 0!==arguments[6]&&arguments[6];return u(this,n),(l=t.call(this)).from=e,l.to=r,l.gapFrom=o,l.gapTo=i,l.slice=s,l.insert=a,l.structure=c,l}return p(n,[{key:"apply",value:function(e){if(this.structure&&(D(e,this.from,this.gapFrom)||D(e,this.gapTo,this.to)))return C.fail("Structure gap-replace would overwrite content");var t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return C.fail("Gap is not a flat range");var n=this.slice.insertAt(this.insert,t.content);return n?C.fromReplace(e,this.from,this.to,n):C.fail("Content does not fit in gap")}},{key:"getMap",value:function(){return new k([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}},{key:"invert",value:function(e){var t=this.gapTo-this.gapFrom;return new n(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}},{key:"map",value:function(e){var t=e.mapResult(this.from,1),r=e.mapResult(this.to,-1),o=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),i=this.to==this.gapTo?r.pos:e.map(this.gapTo,1);return t.deletedAcross&&r.deletedAcross||o<t.pos||i>r.pos?null:new n(t.pos,r.pos,o,i,this.slice,this.insert,this.structure)}},{key:"toJSON",value:function(){var e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new n(t.from,t.to,t.gapFrom,t.gapTo,m.Slice.fromJSON(e,t.slice),t.insert,!!t.structure)}}]),n}(S);function D(e,t,n){for(var r=e.resolve(t),o=n-t,i=r.depth;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0)for(var s=r.node(i).maybeChild(r.indexAfter(i));o>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,o--}return!1}function P(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.contentMatch,o=!(arguments.length>4&&void 0!==arguments[4])||arguments[4],i=e.doc.nodeAt(t),s=[],a=t+1,l=0;l<i.childCount;l++){var c=i.child(l),d=a+c.nodeSize,u=r.matchType(c.type);if(u){r=u;for(var h=0;h<c.marks.length;h++)n.allowsMarkType(c.marks[h].type)||e.step(new A(a,d,c.marks[h]));if(o&&c.isText&&"pre"!=n.whitespace)for(var p=void 0,f=/\r?\n|\r/g,g=void 0;p=f.exec(c.text);)g||(g=new m.Slice(m.Fragment.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new N(a+p.index,a+p.index+p[0].length,g))}else s.push(new N(a,d,m.Slice.empty));a=d}if(!r.validEnd){var v=r.fillBefore(m.Fragment.empty,!0);e.replace(a,a,new m.Slice(v,0,0))}for(var y=s.length-1;y>=0;y--)e.step(s[y])}function $(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function I(e){return{type:e,attrs:null}}function z(e,t,n,r){t.forEach(function(o,i){if(o.isText)for(var s,a=/\r?\n|\r/g;s=a.exec(o.text);){var l=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}})}function L(e,t,n,r){t.forEach(function(o,i){if(o.type==o.type.schema.linebreakReplacement){var s=e.mapping.slice(r).map(n+1+i);e.replaceWith(s,s+1,t.type.schema.text("\n"))}})}function F(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);for(var n=e.contentMatchAt(e.childCount),r=e.type.schema.linebreakReplacement,o=0;o<t.childCount;o++){var i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(!(n=n.matchType(s)))return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(e,t))}function H(e,t,n){var r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(var o=r.depth-1;o>=0;o--){var i=r.index(o);if(r.node(o).canReplaceWith(i,i,n))return r.before(o+1);if(i>0)return null}if(r.parentOffset==r.parent.content.size)for(var s=r.depth-1;s>=0;s--){var a=r.indexAfter(s);if(r.node(s).canReplaceWith(a,a,n))return r.after(s+1);if(a<r.node(s).childCount)return null}return null}function j(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:t,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:m.Slice.empty;if(t==n&&!r.size)return null;var o=e.resolve(t),i=e.resolve(n);return B(o,i,r)?new N(t,n,r):new _(o,i,r).fit()}function B(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}S.jsonID("replaceAround",R);var _=function(){function e(t,n,r){u(this,e),this.$from=t,this.$to=n,this.unplaced=r,this.frontier=[],this.placed=m.Fragment.empty;for(var o=0;o<=t.depth;o++){var i=t.node(o);this.frontier.push({type:i.type,match:i.contentMatchAt(t.indexAfter(o))})}for(var s=t.depth;s>0;s--)this.placed=m.Fragment.from(t.node(s).copy(this.placed))}return p(e,[{key:"depth",get:function(){return this.frontier.length-1}},{key:"fit",value:function(){for(;this.unplaced.size;){var e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}var t=this.mustMoveInline(),n=this.placed.size-this.depth-this.$from.depth,r=this.$from,o=this.close(t<0?this.$to:r.doc.resolve(t));if(!o)return null;for(var i=this.placed,s=r.depth,a=o.depth;s&&a&&1==i.childCount;)i=i.firstChild.content,s--,a--;var l=new m.Slice(i,s,a);return t>-1?new R(r.pos,t,this.$to.pos,this.$to.end(),l,n):l.size||r.pos!=this.$to.pos?new N(r.pos,o.pos,l):null}},{key:"findFittable",value:function(){for(var e=this.unplaced.openStart,t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){var o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(var i=1;i<=2;i++)for(var s=1==i?e:this.unplaced.openStart;s>=0;s--)for(var a=null,l=(s?(a=q(this.unplaced.content,s-1).firstChild).content:this.unplaced.content).firstChild,c=this.depth;c>=0;c--){var d=this.frontier[c],u=d.type,h=d.match,p=void 0,f=null;if(1==i&&(l?h.matchType(l.type)||(f=h.fillBefore(m.Fragment.from(l),!1)):a&&u.compatibleContent(a.type)))return{sliceDepth:s,frontierDepth:c,parent:a,inject:f};if(2==i&&l&&(p=h.findWrapping(l.type)))return{sliceDepth:s,frontierDepth:c,parent:a,wrap:p};if(a&&h.matchType(a.type))break}}},{key:"openMore",value:function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,o=q(t,n);return!(!o.childCount||o.firstChild.isLeaf||(this.unplaced=new m.Slice(t,n+1,Math.max(r,o.size+n>=t.size-r?n+1:0)),0))}},{key:"dropNode",value:function(){var e=this.unplaced,t=e.content,n=e.openStart,r=e.openEnd,o=q(t,n);if(o.childCount<=1&&n>0){var i=t.size-n<=n+o.size;this.unplaced=new m.Slice(V(t,n-1,1),n-1,i?n-1:r)}else this.unplaced=new m.Slice(V(t,n,1),n,r)}},{key:"placeNodes",value:function(e){for(var t=e.sliceDepth,n=e.frontierDepth,r=e.parent,o=e.inject,i=e.wrap;this.depth>n;)this.closeFrontierNode();if(i)for(var s=0;s<i.length;s++)this.openFrontierNode(i[s]);var a=this.unplaced,l=r?r.content:a.content,c=a.openStart-t,d=0,u=[],h=this.frontier[n],p=h.match,f=h.type;if(o){for(var g=0;g<o.childCount;g++)u.push(o.child(g));p=p.matchFragment(o)}for(var v=l.size+t-(a.content.size-a.openEnd);d<l.childCount;){var y=l.child(d),b=p.matchType(y.type);if(!b)break;(++d>1||0==c||y.content.size)&&(p=b,u.push(K(y.mark(f.allowedMarks(y.marks)),1==d?c:0,d==l.childCount?v:-1)))}var k=d==l.childCount;k||(v=-1),this.placed=W(this.placed,n,m.Fragment.from(u)),this.frontier[n].match=p,k&&v<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(var w=0,x=l;w<v;w++){var S=x.lastChild;this.frontier.push({type:S.type,match:S.contentMatchAt(S.childCount)}),x=S.content}this.unplaced=k?0==t?m.Slice.empty:new m.Slice(V(a.content,t-1,1),t-1,v<0?a.openEnd:t-1):new m.Slice(V(a.content,t,d),a.openStart,a.openEnd)}},{key:"mustMoveInline",value:function(){if(!this.$to.parent.isTextblock)return-1;var e,t=this.frontier[this.depth];if(!t.type.isTextblock||!J(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;for(var n=this.$to.depth,r=this.$to.after(n);n>1&&r==this.$to.end(--n);)++r;return r}},{key:"findCloseLevel",value:function(e){e:for(var t=Math.min(this.depth,e.depth);t>=0;t--){var n=this.frontier[t],r=n.match,o=n.type,i=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),s=J(e,t,o,r,i);if(s){for(var a=t-1;a>=0;a--){var l=this.frontier[a],c=l.match,d=J(e,a,l.type,c,!0);if(!d||d.childCount)continue e}return{depth:t,fit:s,move:i?e.doc.resolve(e.after(t+1)):e}}}}},{key:"close",value:function(e){var t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=W(this.placed,t.depth,t.fit)),e=t.move;for(var n=t.depth+1;n<=e.depth;n++){var r=e.node(n),o=r.type.contentMatch.fillBefore(r.content,!0,e.index(n));this.openFrontierNode(r.type,r.attrs,o)}return e}},{key:"openFrontierNode",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=arguments.length>2?arguments[2]:void 0,r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=W(this.placed,this.depth,m.Fragment.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}},{key:"closeFrontierNode",value:function(){var e=this.frontier.pop().match.fillBefore(m.Fragment.empty,!0);e.childCount&&(this.placed=W(this.placed,this.frontier.length,e))}}]),e}();function V(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(V(e.firstChild.content,t-1,n)))}function W(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(W(e.lastChild.content,t-1,n)))}function q(e,t){for(var n=0;n<t;n++)e=e.firstChild.content;return e}function K(e,t,n){if(t<=0)return e;var r=e.content;return t>1&&(r=r.replaceChild(0,K(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(m.Fragment.empty,!0)))),e.copy(r)}function J(e,t,n,r,o){var i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;var a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(var r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function U(e){return e.spec.defining||e.spec.definingForContent}function G(e,t,n,r,o){if(t<n){var i=e.firstChild;e=e.replaceChild(0,i.copy(G(i.content,t+1,n,r,i)))}if(t>r){var s=o.contentMatchAt(0),a=s.fillBefore(e).append(e);e=a.append(s.matchFragment(a).fillBefore(m.Fragment.empty,!0))}return e}function X(e,t){for(var n=[],r=Math.min(e.depth,t.depth);r>=0;r--){var o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}var Y=function(e){i(n,e);var t=a(n);function n(e,r,o){var i;return u(this,n),(i=t.call(this)).pos=e,i.attr=r,i.value=o,i}return p(n,[{key:"apply",value:function(e){var t=e.nodeAt(this.pos);if(!t)return C.fail("No node at attribute step's position");var n=Object.create(null);for(var r in t.attrs)n[r]=t.attrs[r];n[this.attr]=this.value;var o=t.type.create(n,null,t.marks);return C.fromReplace(e,this.pos,this.pos+1,new m.Slice(m.Fragment.from(o),0,t.isLeaf?0:1))}},{key:"getMap",value:function(){return k.empty}},{key:"invert",value:function(e){return new n(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}},{key:"map",value:function(e){var t=e.mapResult(this.pos,1);return t.deletedAfter?null:new n(t.pos,this.attr,this.value)}},{key:"toJSON",value:function(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new n(t.pos,t.attr,t.value)}}]),n}(S);S.jsonID("attr",Y);var Q=function(e){i(n,e);var t=a(n);function n(e,r){var o;return u(this,n),(o=t.call(this)).attr=e,o.value=r,o}return p(n,[{key:"apply",value:function(e){var t=Object.create(null);for(var n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;var r=e.type.create(t,e.content,e.marks);return C.ok(r)}},{key:"getMap",value:function(){return k.empty}},{key:"invert",value:function(e){return new n(this.attr,e.attrs[this.attr])}},{key:"map",value:function(e){return this}},{key:"toJSON",value:function(){return{stepType:"docAttr",attr:this.attr,value:this.value}}}],[{key:"fromJSON",value:function(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new n(t.attr,t.value)}}]),n}(S);S.jsonID("docAttr",Q),t.TransformError=function(e){i(n,e);var t=a(n);function n(){return u(this,n),t.apply(this,arguments)}return p(n)}(r(Error)),t.TransformError=function e(t){var n=Error.call(this,t);return n.__proto__=e.prototype,n},t.TransformError.prototype=Object.create(Error.prototype),t.TransformError.prototype.constructor=t.TransformError,t.TransformError.prototype.name="TransformError";var Z=function(){function e(t){u(this,e),this.doc=t,this.steps=[],this.docs=[],this.mapping=new w}return p(e,[{key:"before",get:function(){return this.docs.length?this.docs[0]:this.doc}},{key:"step",value:function(e){var n=this.maybeStep(e);if(n.failed)throw new t.TransformError(n.failed);return this}},{key:"maybeStep",value:function(e){var t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}},{key:"docChanged",get:function(){return this.steps.length>0}},{key:"changedRange",value:function(){for(var e=1e9,t=-1e9,n=0;n<this.mapping.maps.length;n++){var r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach(function(n,r,o,i){e=Math.min(e,o),t=Math.max(t,i)})}return 1e9==e?null:{from:e,to:t}}},{key:"addStep",value:function(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}},{key:"replace",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:m.Slice.empty,r=j(this.doc,e,t,n);return r&&this.step(r),this}},{key:"replaceWith",value:function(e,t,n){return this.replace(e,t,new m.Slice(m.Fragment.from(n),0,0))}},{key:"delete",value:function(e,t){return this.replace(e,t,m.Slice.empty)}},{key:"insert",value:function(e,t){return this.replaceWith(e,e,t)}},{key:"replaceRange",value:function(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);var o=e.doc.resolve(t),i=e.doc.resolve(n);if(B(o,i,r))return e.step(new N(t,n,r));var s=X(o,i);0==s[s.length-1]&&s.pop();var a=-(o.depth+1);s.unshift(a);for(var l=o.depth,c=o.pos-1;l>0;l--,c--){var d=o.node(l).type.spec;if(d.defining||d.definingAsContext||d.isolating)break;s.indexOf(l)>-1?a=l:o.before(l)==c&&s.splice(1,0,-l)}for(var u=s.indexOf(a),h=[],p=r.openStart,f=r.content,g=0;;g++){var v=f.firstChild;if(h.push(v),g==r.openStart)break;f=v.content}for(var y=p-1;y>=0;y--){var b=h[y],k=U(b.type);if(k&&!b.sameMarkup(o.node(Math.abs(a)-1)))p=y;else if(k||!b.type.isTextblock)break}for(var w=r.openStart;w>=0;w--){var x=(w+p+1)%(r.openStart+1),S=h[x];if(S)for(var C=0;C<s.length;C++){var M=s[(C+u)%s.length],T=!0;M<0&&(T=!1,M=-M);var A=o.node(M-1),O=o.index(M-1);if(A.canReplaceWith(O,O,S.type,S.marks))return e.replace(o.before(M),T?i.after(M):n,new m.Slice(G(r.content,0,r.openStart,x),x,r.openEnd))}}for(var E=e.steps.length,R=s.length-1;R>=0&&(e.replace(t,n,r),!(e.steps.length>E));R--){var D=s[R];D<0||(t=o.before(D),n=i.after(D))}}(this,e,t,n),this}},{key:"replaceRangeWith",value:function(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){var o=H(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new m.Slice(m.Fragment.from(r),0,0))}(this,e,t,n),this}},{key:"deleteRange",value:function(e,t){return function(e,t,n){for(var r=e.doc.resolve(t),o=e.doc.resolve(n),i=X(r,o),s=0;s<i.length;s++){var a=i[s],l=s==i.length-1;if(l&&0==a||r.node(a).type.contentMatch.validEnd)return e.delete(r.start(a),o.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),o.indexAfter(a-1))))return e.delete(r.before(a),o.after(a))}for(var c=1;c<=r.depth&&c<=o.depth;c++)if(t-r.start(c)==r.depth-c&&n>r.end(c)&&o.end(c)-n!=o.depth-c&&r.start(c-1)==o.start(c-1)&&r.node(c-1).canReplace(r.index(c-1),o.index(c-1)))return e.delete(r.before(c),n);e.delete(t,n)}(this,e,t),this}},{key:"lift",value:function(e,t){return function(e,t,n){for(var r=t.$from,o=t.$to,i=t.depth,s=r.before(i+1),a=o.after(i+1),l=s,c=a,d=m.Fragment.empty,u=0,h=i,p=!1;h>n;h--)p||r.index(h)>0?(p=!0,d=m.Fragment.from(r.node(h).copy(d)),u++):l--;for(var f=m.Fragment.empty,g=0,v=i,y=!1;v>n;v--)y||o.after(v+1)<o.end(v)?(y=!0,f=m.Fragment.from(o.node(v).copy(f)),g++):c++;e.step(new R(l,c,s,a,new m.Slice(d.append(f),u,g),d.size-u,!0))}(this,e,t),this}},{key:"join",value:function(e){return function(e,t,n){var r=null,o=e.doc.type.schema.linebreakReplacement,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){var a="pre"==s.whitespace,l=!!s.contentMatch.matchType(o);a&&!l?r=!1:!a&&l&&(r=!0)}var c=e.steps.length;if(!1===r){var d=e.doc.resolve(t+n);L(e,d.node(),d.before(),c)}s.inlineContent&&P(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==r);var u=e.mapping.slice(c),h=u.map(t-n);if(e.step(new N(h,u.map(t+n,-1),m.Slice.empty,!0)),!0===r){var p=e.doc.resolve(h);z(e,p.node(),p.before(),e.steps.length)}}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1),this}},{key:"wrap",value:function(e,t){return function(e,t,n){for(var r=m.Fragment.empty,o=n.length-1;o>=0;o--){if(r.size){var i=n[o].type.contentMatch.matchFragment(r);if(!i||!i.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=m.Fragment.from(n[o].type.create(n[o].attrs,r))}var s=t.start,a=t.end;e.step(new R(s,a,s,a,new m.Slice(r,0,0),n.length,!0))}(this,e,t),this}},{key:"setBlockType",value:function(e){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");var i=e.steps.length;e.doc.nodesBetween(t,n,function(t,n){var s="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,s)&&function(e,t,n){var r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){var a=null;if(r.schema.linebreakReplacement){var l="pre"==r.whitespace,c=!!r.contentMatch.matchType(r.schema.linebreakReplacement);l&&!c?a=!1:!l&&c&&(a=!0)}!1===a&&L(e,t,n,i),P(e,e.mapping.slice(i).map(n,1),r,void 0,null===a);var d=e.mapping.slice(i),u=d.map(n,1),h=d.map(n+t.nodeSize,1);return e.step(new R(u,h,u+1,h-1,new m.Slice(m.Fragment.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===a&&z(e,t,n,i),!1}})}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:e,arguments.length>2?arguments[2]:void 0,arguments.length>3&&void 0!==arguments[3]?arguments[3]:null),this}},{key:"setNodeMarkup",value:function(e,t){return function(e,t,n,r,o){var i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);var s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new R(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new m.Slice(m.Fragment.from(s),0,0),1,!0))}(this,e,t,arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,arguments.length>3?arguments[3]:void 0),this}},{key:"setNodeAttribute",value:function(e,t,n){return this.step(new Y(e,t,n)),this}},{key:"setDocAttribute",value:function(e,t){return this.step(new Q(e,t)),this}},{key:"addNodeMark",value:function(e,t){return this.step(new O(e,t)),this}},{key:"removeNodeMark",value:function(e,t){var n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof m.Mark)t.isInSet(n.marks)&&this.step(new E(e,t));else{for(var r,o=n.marks,i=[];r=t.isInSet(o);)i.push(new E(e,r)),o=r.removeFromSet(o);for(var s=i.length-1;s>=0;s--)this.step(i[s])}return this}},{key:"split",value:function(e){return function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,o=e.doc.resolve(t),i=m.Fragment.empty,s=m.Fragment.empty,a=o.depth,l=o.depth-n,c=n-1;a>l;a--,c--){i=m.Fragment.from(o.node(a).copy(i));var d=r&&r[c];s=m.Fragment.from(d?d.type.create(d.attrs,s):o.node(a).copy(s))}e.step(new N(t,t,new m.Slice(i.append(s),n,n),!0))}(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,arguments.length>2?arguments[2]:void 0),this}},{key:"addMark",value:function(e,t,n){return function(e,t,n,r){var o,i,s=[],a=[];e.doc.nodesBetween(t,n,function(e,l,c){if(e.isInline){var d=e.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){for(var u=Math.max(l,t),h=Math.min(l+e.nodeSize,n),p=r.addToSet(d),f=0;f<d.length;f++)d[f].isInSet(p)||(o&&o.to==u&&o.mark.eq(d[f])?o.to=h:s.push(o=new A(u,h,d[f])));i&&i.to==u?i.to=h:a.push(i=new T(u,h,r))}}}),s.forEach(function(t){return e.step(t)}),a.forEach(function(t){return e.step(t)})}(this,e,t,n),this}},{key:"removeMark",value:function(e,t,n){return function(e,t,n,r){var o=[],i=0;e.doc.nodesBetween(t,n,function(e,s){if(e.isInline){i++;var a=null;if(r instanceof m.MarkType)for(var l,c=e.marks;l=r.isInSet(c);)(a||(a=[])).push(l),c=l.removeFromSet(c);else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length)for(var d=Math.min(s+e.nodeSize,n),u=0;u<a.length;u++){for(var h=a[u],p=void 0,f=0;f<o.length;f++){var g=o[f];g.step==i-1&&h.eq(o[f].style)&&(p=g)}p?(p.to=d,p.step=i):o.push({style:h,from:Math.max(s,t),to:d,step:i})}}}),o.forEach(function(t){return e.step(new A(t.from,t.to,t.style))})}(this,e,t,n),this}},{key:"clearIncompatible",value:function(e,t,n){return P(this,e,t,n),this}}]),e}();t.AddMarkStep=T,t.AddNodeMarkStep=O,t.AttrStep=Y,t.DocAttrStep=Q,t.MapResult=b,t.Mapping=w,t.RemoveMarkStep=A,t.RemoveNodeMarkStep=E,t.ReplaceAroundStep=R,t.ReplaceStep=N,t.Step=S,t.StepMap=k,t.StepResult=C,t.Transform=Z,t.canJoin=function(e,t){var n=e.resolve(t),r=n.index();return F(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)},t.canSplit=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:1,r=arguments.length>3?arguments[3]:void 0,o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(var a=o.depth-1,l=n-2;a>i;a--,l--){var c=o.node(a),d=o.index(a);if(c.type.spec.isolating)return!1;var u=c.content.cutByIndex(d,c.childCount),h=r&&r[l+1];h&&(u=u.replaceChild(0,h.type.create(h.attrs)));var p=r&&r[l]||c;if(!c.canReplace(d+1,c.childCount)||!p.type.validContent(u))return!1}var f=o.indexAfter(i),m=r&&r[0];return o.node(i).canReplaceWith(f,f,m?m.type:o.node(i+1).type)},t.dropPoint=function(e,t,n){var r=e.resolve(t);if(!n.content.size)return t;for(var o=n.content,i=0;i<n.openStart;i++)o=o.firstChild.content;for(var s=1;s<=(0==n.openStart&&n.size?2:1);s++)for(var a=r.depth;a>=0;a--){var l=a==r.depth?0:r.pos<=(r.start(a+1)+r.end(a+1))/2?-1:1,c=r.index(a)+(l>0?1:0),d=r.node(a),u=!1;if(1==s)u=d.canReplace(c,c,o);else{var h=d.contentMatchAt(c).findWrapping(o.firstChild.type);u=h&&d.canReplaceWith(c,c,h[0])}if(u)return 0==l?r.pos:l<0?r.before(a+1):r.after(a+1)}return null},t.findWrapping=function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,r=arguments.length>3&&void 0!==arguments[3]?arguments[3]:e,o=function(e,t){var n=e.parent,r=e.startIndex,o=e.endIndex,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;var s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){var n=e.parent,r=e.startIndex,o=e.endIndex,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;for(var a=(s.length?s[s.length-1]:t).contentMatch,l=r;a&&l<o;l++)a=a.matchType(n.child(l).type);return a&&a.validEnd?s:null}(r,t);return i?o.map(I).concat({type:t,attrs:n}).concat(i.map(I)):null},t.insertPoint=H,t.joinPoint=function(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=e.resolve(t),o=r.depth;;o--){var i=void 0,s=void 0,a=r.index(o);if(o==r.depth?(i=r.nodeBefore,s=r.nodeAfter):n>0?(i=r.node(o+1),a++,s=r.node(o).maybeChild(a)):(i=r.node(o).maybeChild(a-1),s=r.node(o+1)),i&&!i.isTextblock&&F(i,s)&&r.node(o).canReplace(a,a+1))return t;if(0==o)break;t=n<0?r.before(o):r.after(o)}},t.liftTarget=function(e){for(var t=e.parent.content.cutByIndex(e.startIndex,e.endIndex),n=e.depth,r=0,o=0;;--n){var i=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-o;if(n<e.depth&&i.canReplace(s,a,t))return n;if(0==n||i.type.spec.isolating||!$(i,s,a))break;s&&(r=1),a<i.childCount&&(o=1)}return null},t.replaceStep=j},9454:function(e,t,n){"use strict";function r(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=null==e?null:"undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=n){var r,o,i,s,a=[],l=!0,c=!1;try{if(i=(n=n.call(e)).next,0===t){if(Object(n)!==n)return;l=!1}else for(;!(l=(r=i.call(n)).done)&&(a.push(r.value),a.length!==t);l=!0);}catch(e){c=!0,o=e}finally{try{if(!l&&null!=n.return&&(s=n.return(),Object(s)!==s))return}finally{if(c)throw o}}return a}}(e,t)||i(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function o(e,t){var n="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!n){if(Array.isArray(e)||(n=i(e))||t&&e&&"number"==typeof e.length){n&&(e=n);var r=0,o=function(){};return{s:o,n:function(){return r>=e.length?{done:!0}:{done:!1,value:e[r++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,l=!1;return{s:function(){n=n.call(e)},n:function(){var e=n.next();return a=e.done,e},e:function(e){l=!0,s=e},f:function(){try{a||null==n.return||n.return()}finally{if(l)throw s}}}}function i(e,t){if(e){if("string"==typeof e)return s(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?s(e,t):void 0}}function s(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,r=new Array(t);n<t;n++)r[n]=e[n];return r}function a(){return a="undefined"!=typeof Reflect&&Reflect.get?Reflect.get.bind():function(e,t,n){var r=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=h(e)););return e}(e,t);if(r){var o=Object.getOwnPropertyDescriptor(r,t);return o.get?o.get.call(arguments.length<3?e:n):o.value}},a.apply(this,arguments)}function l(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Super expression must either be null or a function");e.prototype=Object.create(t&&t.prototype,{constructor:{value:e,writable:!0,configurable:!0}}),Object.defineProperty(e,"prototype",{writable:!1}),t&&c(e,t)}function c(e,t){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},c(e,t)}function d(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=h(e);if(t){var o=h(this).constructor;n=Reflect.construct(r,arguments,o)}else n=r.apply(this,arguments);return function(e,t){if(t&&("object"===p(t)||"function"==typeof t))return t;if(void 0!==t)throw new TypeError("Derived constructors may only return object or undefined");return u(e)}(this,n)}}function u(e){if(void 0===e)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return e}function h(e){return h=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},h(e)}function p(e){return p="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},p(e)}function f(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function m(e,t){for(var n=0;n<t.length;n++){var r=t[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(e,v(r.key),r)}}function g(e,t,n){return t&&m(e.prototype,t),n&&m(e,n),Object.defineProperty(e,"prototype",{writable:!1}),e}function v(e){var t=function(e){if("object"!==p(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var n=t.call(e,"string");if("object"!==p(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"===p(t)?t:String(t)}var y=n(7820),b=n(7712),k=n(6553),w=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t},x=function(e){var t=e.assignedSlot||e.parentNode;return t&&11==t.nodeType?t.host:t},S=null,C=function(e,t,n){var r=S||(S=document.createRange());return r.setEnd(e,null==n?e.nodeValue.length:n),r.setStart(e,t||0),r},M=function(e,t,n,r){return n&&(A(e,t,n,r,-1)||A(e,t,n,r,1))},T=/^(img|br|input|textarea|hr)$/i;function A(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:O(e))){var s=e.parentNode;if(!s||1!=s.nodeType||E(e)||T.test(e.nodeName)||"false"==e.contentEditable)return!1;t=w(e)+(o<0?0:1),e=s}else{if(1!=e.nodeType)return!1;var a=e.childNodes[t+(o<0?-1:0)];if(1==a.nodeType&&"false"==a.contentEditable){if(!(null===(i=a.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;t+=o}else e=a,t=o<0?O(e):0}}}function O(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function E(e){for(var t,n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}var N=function(e){return e.focusNode&&M(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function R(e,t){var n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}var D="undefined"!=typeof navigator?navigator:null,P="undefined"!=typeof document?document:null,$=D&&D.userAgent||"",I=/Edge\/(\d+)/.exec($),z=/MSIE \d/.exec($),L=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec($),F=!!(z||L||I),H=z?document.documentMode:L?+L[1]:I?+I[1]:0,j=!F&&/gecko\/(\d+)/i.test($);j&&(/Firefox\/(\d+)/.exec($)||[0,0])[1];var B=!F&&/Chrome\/(\d+)/.exec($),_=!!B,V=B?+B[1]:0,W=!F&&!!D&&/Apple Computer/.test(D.vendor),q=W&&(/Mobile\/\w+/.test($)||!!D&&D.maxTouchPoints>2),K=q||!!D&&/Mac/.test(D.platform),J=!!D&&/Win/.test(D.platform),U=/Android \d/.test($),G=!!P&&"webkitFontSmoothing"in P.documentElement.style,X=G?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function Y(e){var t=e.defaultView&&e.defaultView.visualViewport;return t?{left:0,right:t.width,top:0,bottom:t.height}:{left:0,right:e.documentElement.clientWidth,top:0,bottom:e.documentElement.clientHeight}}function Q(e,t){return"number"==typeof e?e:e[t]}function Z(e){var t=e.getBoundingClientRect(),n=t.width/e.offsetWidth||1,r=t.height/e.offsetHeight||1;return{left:t.left,right:t.left+e.clientWidth*n,top:t.top,bottom:t.top+e.clientHeight*r}}function ee(e,t,n){for(var r=e.someProp("scrollThreshold")||0,o=e.someProp("scrollMargin")||5,i=e.dom.ownerDocument,s=n||e.dom;s;)if(1==s.nodeType){var a=s,l=a==i.body,c=l?Y(i):Z(a),d=0,u=0;if(t.top<c.top+Q(r,"top")?u=-(c.top-t.top+Q(o,"top")):t.bottom>c.bottom-Q(r,"bottom")&&(u=t.bottom-t.top>c.bottom-c.top?t.top+Q(o,"top")-c.top:t.bottom-c.bottom+Q(o,"bottom")),t.left<c.left+Q(r,"left")?d=-(c.left-t.left+Q(o,"left")):t.right>c.right-Q(r,"right")&&(d=t.right-c.right+Q(o,"right")),d||u)if(l)i.defaultView.scrollBy(d,u);else{var h=a.scrollLeft,p=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);var f=a.scrollLeft-h,m=a.scrollTop-p;t={left:t.left-f,top:t.top-m,right:t.right-f,bottom:t.bottom-m}}var g=l?"fixed":getComputedStyle(s).position;if(/^(fixed|sticky)$/.test(g))break;s="absolute"==g?s.offsetParent:x(s)}else s=x(s)}function te(e){for(var t=[],n=e.ownerDocument,r=e;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),e!=n);r=x(r));return t}function ne(e,t){for(var n=0;n<e.length;n++){var r=e[n],o=r.dom,i=r.top,s=r.left;o.scrollTop!=i+t&&(o.scrollTop=i+t),o.scrollLeft!=s&&(o.scrollLeft=s)}}var re=null;function oe(e,t){for(var n,r,o,i,s=2e8,a=0,l=t.top,c=t.top,d=e.firstChild,u=0;d;d=d.nextSibling,u++){var h=void 0;if(1==d.nodeType)h=d.getClientRects();else{if(3!=d.nodeType)continue;h=C(d).getClientRects()}for(var p=0;p<h.length;p++){var f=h[p];if(f.top<=l&&f.bottom>=c){l=Math.max(f.bottom,l),c=Math.min(f.top,c);var m=f.left>t.left?f.left-t.left:f.right<t.left?t.left-f.right:0;if(m<s){n=d,s=m,r=m&&3==n.nodeType?{left:f.right<t.left?f.right:f.left,top:t.top}:t,1==d.nodeType&&m&&(a=u+(t.left>=(f.left+f.right)/2?1:0));continue}}else f.top>t.top&&!o&&f.left<=t.left&&f.right>=t.left&&(o=d,i={left:Math.max(f.left,Math.min(f.right,t.left)),top:f.top});!n&&(t.left>=f.right&&t.top>=f.top||t.left>=f.left&&t.top>=f.bottom)&&(a=u+1)}}return!n&&o&&(n=o,r=i,s=0),n&&3==n.nodeType?function(e,t){for(var n,r=e.nodeValue.length,o=document.createRange(),i=0;i<r;i++){o.setEnd(e,i+1),o.setStart(e,i);var s=ce(o,1);if(s.top!=s.bottom&&ie(t,s)){n={node:e,offset:i+(t.left>=(s.left+s.right)/2?1:0)};break}}return o.detach(),n||{node:e,offset:0}}(n,r):!n||s&&1==n.nodeType?{node:e,offset:a}:oe(n,r)}function ie(e,t){return e.left>=t.left-1&&e.left<=t.right+1&&e.top>=t.top-1&&e.top<=t.bottom+1}function se(e,t,n){var r=e.childNodes.length;if(r&&n.top<n.bottom)for(var o=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-n.top)/(n.bottom-n.top))-2)),i=o;;){var s=e.childNodes[i];if(1==s.nodeType)for(var a=s.getClientRects(),l=0;l<a.length;l++){var c=a[l];if(ie(t,c))return se(s,t,c)}if((i=(i+1)%r)==o)break}return e}function ae(e,t){var n,r=e.dom.ownerDocument,o=0,i=function(e,t,n){if(e.caretPositionFromPoint)try{var r=e.caretPositionFromPoint(t,n);if(r)return{node:r.offsetNode,offset:Math.min(O(r.offsetNode),r.offset)}}catch(e){}if(e.caretRangeFromPoint){var o=e.caretRangeFromPoint(t,n);if(o)return{node:o.startContainer,offset:Math.min(O(o.startContainer),o.startOffset)}}}(r,t.left,t.top);i&&(n=i.node,o=i.offset);var s,a=(e.root.elementFromPoint?e.root:r).elementFromPoint(t.left,t.top);if(!a||!e.dom.contains(1!=a.nodeType?a.parentNode:a)){var l=e.dom.getBoundingClientRect();if(!ie(t,l))return null;if(!(a=se(e.dom,t,l)))return null}if(W)for(var c=a;n&&c;c=x(c))c.draggable&&(n=void 0);if(a=function(e,t){var n=e.parentNode;return n&&/^li$/i.test(n.nodeName)&&t.left<e.getBoundingClientRect().left?n:e}(a,t),n){if(j&&1==n.nodeType&&(o=Math.min(o,n.childNodes.length))<n.childNodes.length){var d,u=n.childNodes[o];"IMG"==u.nodeName&&(d=u.getBoundingClientRect()).right<=t.left&&d.bottom>t.top&&o++}var h;G&&o&&1==n.nodeType&&1==(h=n.childNodes[o-1]).nodeType&&"false"==h.contentEditable&&h.getBoundingClientRect().top>=t.top&&o--,n==e.dom&&o==n.childNodes.length-1&&1==n.lastChild.nodeType&&t.top>n.lastChild.getBoundingClientRect().bottom?s=e.state.doc.content.size:0!=o&&1==n.nodeType&&"BR"==n.childNodes[o-1].nodeName||(s=function(e,t,n,r){for(var o=-1,i=t,s=!1;i!=e.dom;){var a=e.docView.nearestDesc(i,!0),l=void 0;if(!a)return null;if(1==a.dom.nodeType&&(a.node.isBlock&&a.parent||!a.contentDOM)&&((l=a.dom.getBoundingClientRect()).width||l.height)&&(a.node.isBlock&&a.parent&&!/^T(R|BODY|HEAD|FOOT)$/.test(a.dom.nodeName)&&(!s&&l.left>r.left||l.top>r.top?o=a.posBefore:(!s&&l.right<r.left||l.bottom<r.top)&&(o=a.posAfter),s=!0),!a.contentDOM&&o<0&&!a.node.isText))return(a.node.isBlock?r.top<(l.top+l.bottom)/2:r.left<(l.left+l.right)/2)?a.posBefore:a.posAfter;i=a.dom.parentNode}return o>-1?o:e.docView.posFromDOM(t,n,-1)}(e,n,o,t))}null==s&&(s=function(e,t,n){var r=oe(t,n),o=r.node,i=r.offset,s=-1;if(1==o.nodeType&&!o.firstChild){var a=o.getBoundingClientRect();s=a.left!=a.right&&n.left>(a.left+a.right)/2?1:-1}return e.docView.posFromDOM(o,i,s)}(e,a,t));var p=e.docView.nearestDesc(a,!0);return{pos:s,inside:p?p.posAtStart-p.border:-1}}function le(e){return e.top<e.bottom||e.left<e.right}function ce(e,t){var n=e.getClientRects();if(n.length){var r=n[t<0?0:n.length-1];if(le(r))return r}return Array.prototype.find.call(n,le)||e.getBoundingClientRect()}var de=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function ue(e,t,n){var r=e.docView.domFromPos(t,n<0?-1:1),o=r.node,i=r.offset,s=r.atom,a=G||j;if(3==o.nodeType){if(!a||!de.test(o.nodeValue)&&(n<0?i:i!=o.nodeValue.length)){var l=i,c=i,d=n<0?1:-1;return n<0&&!i?(c++,d=-1):n>=0&&i==o.nodeValue.length?(l--,d=1):n<0?l--:c++,he(ce(C(o,l,c),d),d<0)}var u=ce(C(o,i,i),n);if(j&&i&&/\s/.test(o.nodeValue[i-1])&&i<o.nodeValue.length){var h=ce(C(o,i-1,i-1),-1);if(h.top==u.top){var p=ce(C(o,i,i+1),-1);if(p.top!=u.top)return he(p,p.left<h.left)}}return u}if(!e.state.doc.resolve(t-(s||0)).parent.inlineContent){if(null==s&&i&&(n<0||i==O(o))){var f=o.childNodes[i-1];if(1==f.nodeType)return pe(f.getBoundingClientRect(),!1)}if(null==s&&i<O(o)){var m=o.childNodes[i];if(1==m.nodeType)return pe(m.getBoundingClientRect(),!0)}return pe(o.getBoundingClientRect(),n>=0)}if(null==s&&i&&(n<0||i==O(o))){var g=o.childNodes[i-1],v=3==g.nodeType?C(g,O(g)-(a?0:1)):1!=g.nodeType||"BR"==g.nodeName&&g.nextSibling?null:g;if(v)return he(ce(v,1),!1)}if(null==s&&i<O(o)){for(var y=o.childNodes[i];y.pmViewDesc&&y.pmViewDesc.ignoreForCoords;)y=y.nextSibling;var b=y?3==y.nodeType?C(y,0,a?0:1):1==y.nodeType?y:null:null;if(b)return he(ce(b,-1),!0)}return he(ce(3==o.nodeType?C(o):o,-n),n>=0)}function he(e,t){if(0==e.width)return e;var n=t?e.left:e.right;return{top:e.top,bottom:e.bottom,left:n,right:n}}function pe(e,t){if(0==e.height)return e;var n=t?e.top:e.bottom;return{top:n,bottom:n,left:e.left,right:e.right}}function fe(e,t,n){var r=e.state,o=e.root.activeElement;r!=t&&e.updateState(t),o!=e.dom&&e.focus();try{return n()}finally{r!=t&&e.updateState(r),o!=e.dom&&o&&o.focus()}}var me=/[\u0590-\u08ac]/,ge=null,ve=null,ye=!1;var be=function(){function e(t,n,r,o){f(this,e),this.parent=t,this.children=n,this.dom=r,this.contentDOM=o,this.dirty=0,r.pmViewDesc=this}return g(e,[{key:"matchesWidget",value:function(e){return!1}},{key:"matchesMark",value:function(e){return!1}},{key:"matchesNode",value:function(e,t,n){return!1}},{key:"matchesHack",value:function(e){return!1}},{key:"parseRule",value:function(){return null}},{key:"stopEvent",value:function(e){return!1}},{key:"size",get:function(){for(var e=0,t=0;t<this.children.length;t++)e+=this.children[t].size;return e}},{key:"border",get:function(){return 0}},{key:"destroy",value:function(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(var e=0;e<this.children.length;e++)this.children[e].destroy()}},{key:"posBeforeChild",value:function(e){for(var t=0,n=this.posAtStart;;t++){var r=this.children[t];if(r==e)return n;n+=r.size}}},{key:"posBefore",get:function(){return this.parent.posBeforeChild(this)}},{key:"posAtStart",get:function(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}},{key:"posAfter",get:function(){return this.posBefore+this.size}},{key:"posAtEnd",get:function(){return this.posAtStart+this.size-2*this.border}},{key:"localPosFromDOM",value:function(e,t,n){if(this.contentDOM&&this.contentDOM.contains(1==e.nodeType?e:e.parentNode)){if(n<0){var r,o;if(e==this.contentDOM)r=e.childNodes[t-1];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;r=e.previousSibling}for(;r&&(!(o=r.pmViewDesc)||o.parent!=this);)r=r.previousSibling;return r?this.posBeforeChild(o)+o.size:this.posAtStart}var i,s;if(e==this.contentDOM)i=e.childNodes[t];else{for(;e.parentNode!=this.contentDOM;)e=e.parentNode;i=e.nextSibling}for(;i&&(!(s=i.pmViewDesc)||s.parent!=this);)i=i.nextSibling;return i?this.posBeforeChild(s):this.posAtEnd}var a;if(e==this.dom&&this.contentDOM)a=t>w(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))a=2&e.compareDocumentPosition(this.contentDOM);else if(this.dom.firstChild){if(0==t)for(var l=e;;l=l.parentNode){if(l==this.dom){a=!1;break}if(l.previousSibling)break}if(null==a&&t==e.childNodes.length)for(var c=e;;c=c.parentNode){if(c==this.dom){a=!0;break}if(c.nextSibling)break}}return(null==a?n>0:a)?this.posAtEnd:this.posAtStart}},{key:"nearestDesc",value:function(e){for(var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=!0,r=e;r;r=r.parentNode){var o=this.getDesc(r),i=void 0;if(o&&(!t||o.node)){if(!n||!(i=o.nodeDOM)||(1==i.nodeType?i.contains(1==e.nodeType?e:e.parentNode):i==e))return o;n=!1}}}},{key:"getDesc",value:function(e){for(var t=e.pmViewDesc,n=t;n;n=n.parent)if(n==this)return t}},{key:"posFromDOM",value:function(e,t,n){for(var r=e;r;r=r.parentNode){var o=this.getDesc(r);if(o)return o.localPosFromDOM(e,t,n)}return-1}},{key:"descAt",value:function(e){for(var t=0,n=0;t<this.children.length;t++){var r=this.children[t],o=n+r.size;if(n==e&&o!=n){for(;!r.border&&r.children.length;)for(var i=0;i<r.children.length;i++){var s=r.children[i];if(s.size){r=s;break}}return r}if(e<o)return r.descAt(e-n-r.border);n=o}}},{key:"domFromPos",value:function(e,t){if(!this.contentDOM)return{node:this.dom,offset:0,atom:e+1};for(var n,r=0,o=0,i=0;r<this.children.length;r++){var s=this.children[r],a=i+s.size;if(a>e||s instanceof Te){o=e-i;break}i=a}if(o)return this.children[r].domFromPos(o-this.children[r].border,t);for(;r&&!(n=this.children[r-1]).size&&n instanceof ke&&n.side>=0;r--);if(t<=0){for(var l,c=!0;(l=r?this.children[r-1]:null)&&l.dom.parentNode!=this.contentDOM;r--,c=!1);return l&&t&&c&&!l.border&&!l.domAtom?l.domFromPos(l.size,t):{node:this.contentDOM,offset:l?w(l.dom)+1:0}}for(var d,u=!0;(d=r<this.children.length?this.children[r]:null)&&d.dom.parentNode!=this.contentDOM;r++,u=!1);return d&&u&&!d.border&&!d.domAtom?d.domFromPos(0,t):{node:this.contentDOM,offset:d?w(d.dom):this.contentDOM.childNodes.length}}},{key:"parseRange",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(0==this.children.length)return{node:this.contentDOM,from:e,to:t,fromOffset:0,toOffset:this.contentDOM.childNodes.length};for(var r=-1,o=-1,i=n,s=0;;s++){var a=this.children[s],l=i+a.size;if(-1==r&&e<=l){var c=i+a.border;if(e>=c&&t<=l-a.border&&a.node&&a.contentDOM&&this.contentDOM.contains(a.contentDOM))return a.parseRange(e,t,c);e=i;for(var d=s;d>0;d--){var u=this.children[d-1];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(1)){r=w(u.dom)+1;break}e-=u.size}-1==r&&(r=0)}if(r>-1&&(l>t||s==this.children.length-1)){t=l;for(var h=s+1;h<this.children.length;h++){var p=this.children[h];if(p.size&&p.dom.parentNode==this.contentDOM&&!p.emptyChildAt(-1)){o=w(p.dom);break}t+=p.size}-1==o&&(o=this.contentDOM.childNodes.length);break}i=l}return{node:this.contentDOM,from:e,to:t,fromOffset:r,toOffset:o}}},{key:"emptyChildAt",value:function(e){if(this.border||!this.contentDOM||!this.children.length)return!1;var t=this.children[e<0?0:this.children.length-1];return 0==t.size||t.emptyChildAt(e)}},{key:"domAfterPos",value:function(e){var t=this.domFromPos(e,0),n=t.node,r=t.offset;if(1!=n.nodeType||r==n.childNodes.length)throw new RangeError("No node after pos "+e);return n.childNodes[r]}},{key:"setSelection",value:function(e,t,n){for(var r=arguments.length>3&&void 0!==arguments[3]&&arguments[3],o=Math.min(e,t),i=Math.max(e,t),s=0,a=0;s<this.children.length;s++){var l=this.children[s],c=a+l.size;if(o>a&&i<c)return l.setSelection(e-a-l.border,t-a-l.border,n,r);a=c}var d=this.domFromPos(e,e?-1:1),u=t==e?d:this.domFromPos(t,t?-1:1),h=n.root.getSelection(),p=n.domSelectionRange(),f=!1;if((j||W)&&e==t){var m=d,g=m.node,v=m.offset;if(3==g.nodeType){if((f=!(!v||"\n"!=g.nodeValue[v-1]))&&v==g.nodeValue.length)for(var y,b=g;b;b=b.parentNode){if(y=b.nextSibling){"BR"==y.nodeName&&(d=u={node:y.parentNode,offset:w(y)+1});break}var k=b.pmViewDesc;if(k&&k.node&&k.node.isBlock)break}}else{var x=g.childNodes[v-1];f=x&&("BR"==x.nodeName||"false"==x.contentEditable)}}if(j&&p.focusNode&&p.focusNode!=u.node&&1==p.focusNode.nodeType){var S=p.focusNode.childNodes[p.focusOffset];S&&"false"==S.contentEditable&&(r=!0)}if(r||f&&W||!M(d.node,d.offset,p.anchorNode,p.anchorOffset)||!M(u.node,u.offset,p.focusNode,p.focusOffset)){var C=!1;if((h.extend||e==t)&&(!f||!j)){h.collapse(d.node,d.offset);try{e!=t&&h.extend(u.node,u.offset),C=!0}catch(e){}}if(!C){if(e>t){var T=d;d=u,u=T}var A=document.createRange();A.setEnd(u.node,u.offset),A.setStart(d.node,d.offset),h.removeAllRanges(),h.addRange(A)}}}},{key:"ignoreMutation",value:function(e){return!this.contentDOM&&"selection"!=e.type}},{key:"contentLost",get:function(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}},{key:"markDirty",value:function(e,t){for(var n=0,r=0;r<this.children.length;r++){var o=this.children[r],i=n+o.size;if(n==i?e<=i&&t>=n:e<i&&t>n){var s=n+o.border,a=i-o.border;if(e>=s&&t<=a)return this.dirty=e==n||t==i?2:1,void(e!=s||t!=a||!o.contentLost&&o.dom.parentNode==this.contentDOM?o.markDirty(e-s,t-s):o.dirty=3);o.dirty=o.dom!=o.contentDOM||o.dom.parentNode!=this.contentDOM||o.children.length?3:2}n=i}this.dirty=2}},{key:"markParentsDirty",value:function(){for(var e=1,t=this.parent;t;t=t.parent,e++){var n=1==e?2:1;t.dirty<n&&(t.dirty=n)}}},{key:"domAtom",get:function(){return!1}},{key:"ignoreForCoords",get:function(){return!1}},{key:"ignoreForSelection",get:function(){return!1}},{key:"isText",value:function(e){return!1}}]),e}(),ke=function(e){l(n,e);var t=d(n);function n(e,r,o,i){var s;f(this,n);var a,l=r.type.toDOM;if("function"==typeof l&&(l=l(o,function(){return a?a.parent?a.parent.posBeforeChild(a):void 0:i})),!r.type.spec.raw){if(1!=l.nodeType){var c=document.createElement("span");c.appendChild(l),l=c}l.contentEditable="false",l.classList.add("ProseMirror-widget")}return(s=t.call(this,e,[],l,null)).widget=r,s.widget=r,a=u(s),s}return g(n,[{key:"matchesWidget",value:function(e){return 0==this.dirty&&e.type.eq(this.widget.type)}},{key:"parseRule",value:function(){return{ignore:!0}}},{key:"stopEvent",value:function(e){var t=this.widget.spec.stopEvent;return!!t&&t(e)}},{key:"ignoreMutation",value:function(e){return"selection"!=e.type||this.widget.spec.ignoreSelection}},{key:"destroy",value:function(){this.widget.type.destroy(this.dom),a(h(n.prototype),"destroy",this).call(this)}},{key:"domAtom",get:function(){return!0}},{key:"ignoreForSelection",get:function(){return!!this.widget.type.spec.relaxedSide}},{key:"side",get:function(){return this.widget.type.side}}]),n}(be),we=function(e){l(n,e);var t=d(n);function n(e,r,o,i){var s;return f(this,n),(s=t.call(this,e,[],r,null)).textDOM=o,s.text=i,s}return g(n,[{key:"size",get:function(){return this.text.length}},{key:"localPosFromDOM",value:function(e,t){return e!=this.textDOM?this.posAtStart+(t?this.size:0):this.posAtStart+t}},{key:"domFromPos",value:function(e){return{node:this.textDOM,offset:e}}},{key:"ignoreMutation",value:function(e){return"characterData"===e.type&&e.target.nodeValue==e.oldValue}}]),n}(be),xe=function(e){l(n,e);var t=d(n);function n(e,r,o,i,s){var a;return f(this,n),(a=t.call(this,e,[],o,i)).mark=r,a.spec=s,a}return g(n,[{key:"parseRule",value:function(){return 3&this.dirty||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM}}},{key:"matchesMark",value:function(e){return 3!=this.dirty&&this.mark.eq(e)}},{key:"markDirty",value:function(e,t){if(a(h(n.prototype),"markDirty",this).call(this,e,t),0!=this.dirty){for(var r=this.parent;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=0}}},{key:"slice",value:function(e,t,r){var o=n.create(this.parent,this.mark,!0,r),i=this.children,s=this.size;t<s&&(i=He(i,t,s,r)),e>0&&(i=He(i,0,e,r));for(var a=0;a<i.length;a++)i[a].parent=o;return o.children=i,o}},{key:"ignoreMutation",value:function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):a(h(n.prototype),"ignoreMutation",this).call(this,e)}},{key:"destroy",value:function(){this.spec.destroy&&this.spec.destroy(),a(h(n.prototype),"destroy",this).call(this)}}],[{key:"create",value:function(e,t,r,o){var i=o.nodeViews[t.type.name],s=i&&i(t,o,r);return s&&s.dom||(s=b.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t,r),null,t.attrs)),new n(e,t,s.dom,s.contentDOM||s.dom,s)}}]),n}(be),Se=function(e){l(n,e);var t=d(n);function n(e,r,o,i,s,a,l,c,d){var u;return f(this,n),(u=t.call(this,e,[],s,a)).node=r,u.outerDeco=o,u.innerDeco=i,u.nodeDOM=l,u}return g(n,[{key:"parseRule",value:function(){var e=this;if(this.node.type.spec.reparseInView)return null;var 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(var n=this.children.length-1;n>=0;n--){var r=this.children[n];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=function(){return b.Fragment.empty})}else t.contentElement=this.contentDOM;else t.getContent=function(){return e.node.content};return t}},{key:"matchesNode",value:function(e,t,n){return 0==this.dirty&&e.eq(this.node)&&Ie(t,this.outerDeco)&&n.eq(this.innerDeco)}},{key:"size",get:function(){return this.node.nodeSize}},{key:"border",get:function(){return this.node.isLeaf?0:1}},{key:"updateChildren",value:function(e,t){var n=this,r=this.node.inlineContent,o=t,i=e.composing?this.localCompositionInfo(e,t):null,s=i&&i.pos>-1?i:null,a=i&&i.pos<0,l=new Le(this,s&&s.node,e);!function(e,t,n,r){var o=t.locals(e),i=0;if(0!=o.length)for(var s=0,a=[],l=null,c=0;;){for(var d=void 0,u=void 0;s<o.length&&o[s].to==i;){var h=o[s++];h.widget&&(d?(u||(u=[d])).push(h):d=h)}if(d)if(u){u.sort(Fe);for(var p=0;p<u.length;p++)n(u[p],c,!!l)}else n(d,c,!!l);var f=void 0,m=void 0;if(l)m=-1,f=l,l=null;else{if(!(c<e.childCount))break;m=c,f=e.child(c++)}for(var g=0;g<a.length;g++)a[g].to<=i&&a.splice(g--,1);for(;s<o.length&&o[s].from<=i&&o[s].to>i;)a.push(o[s++]);var v=i+f.nodeSize;if(f.isText){var y=v;s<o.length&&o[s].from<y&&(y=o[s].from);for(var b=0;b<a.length;b++)a[b].to<y&&(y=a[b].to);y<v&&(l=f.cut(y-i),f=f.cut(0,y-i),v=y,m=-1)}else for(;s<o.length&&o[s].to<v;)s++;r(f,f.isInline&&!f.isLeaf?a.filter(function(e){return!e.inline}):a.slice(),t.forChild(i,f),m),i=v}else for(var k=0;k<e.childCount;k++){var w=e.child(k);r(w,o,t.forChild(i,w),k),i+=w.nodeSize}}(this.node,this.innerDeco,function(t,i,s){t.spec.marks?l.syncToMarks(t.spec.marks,r,e,i):t.type.side>=0&&!s&&l.syncToMarks(i==n.node.childCount?b.Mark.none:n.node.child(i).marks,r,e,i),l.placeWidget(t,e,o)},function(t,n,s,c){var d;l.syncToMarks(t.marks,r,e,c),l.findNodeMatch(t,n,s,c)||a&&e.state.selection.from>o&&e.state.selection.to<o+t.nodeSize&&(d=l.findIndexWithChild(i.node))>-1&&l.updateNodeAt(t,n,s,d,e)||l.updateNextNode(t,n,s,e,c,o)||l.addNode(t,n,s,e,o),o+=t.nodeSize}),l.syncToMarks([],r,e,0),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||2==this.dirty)&&(s&&this.protectLocalComposition(e,s),Oe(this.contentDOM,this.children,e),q&&function(e){if("UL"==e.nodeName||"OL"==e.nodeName){var t=e.style.cssText;e.style.cssText=t+"; list-style: square !important",window.getComputedStyle(e).listStyle,e.style.cssText=t}}(this.dom))}},{key:"localCompositionInfo",value:function(e,t){var n=e.state.selection,r=n.from,o=n.to;if(!(e.state.selection instanceof y.TextSelection)||r<t||o>t+this.node.content.size)return null;var i=e.input.compositionNode;if(!i||!this.dom.contains(i.parentNode))return null;if(this.node.inlineContent){var s=i.nodeValue,a=function(e,t,n,r){for(var o=0,i=0;o<e.childCount&&i<=r;){var s=e.child(o++),a=i;if(i+=s.nodeSize,s.isText){for(var l=s.text;o<e.childCount;){var c=e.child(o++);if(i+=c.nodeSize,!c.isText)break;l+=c.text}if(i>=n){if(i>=r&&l.slice(r-t.length-a,r-a)==t)return r-t.length;var d=a<r?l.lastIndexOf(t,r-a-1):-1;if(d>=0&&d+t.length+a>=n)return a+d;if(n==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}}return-1}(this.node.content,s,r-t,o-t);return a<0?null:{node:i,pos:a,text:s}}return{node:i,pos:-1,text:""}}},{key:"protectLocalComposition",value:function(e,t){var n=t.node,r=t.pos,o=t.text;if(!this.getDesc(n)){for(var i=n;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)}var s=new we(this,i,n,o);e.input.compositionNodes.push(s),this.children=He(this.children,r,r+o.length,e,s)}}},{key:"update",value:function(e,t,n,r){return!(3==this.dirty||!e.sameMarkup(this.node)||(this.updateInner(e,t,n,r),0))}},{key:"updateInner",value:function(e,t,n,r){this.updateOuterDeco(t),this.node=e,this.innerDeco=n,this.contentDOM&&this.updateChildren(r,this.posAtStart),this.dirty=0}},{key:"updateOuterDeco",value:function(e){if(!Ie(e,this.outerDeco)){var t=1!=this.nodeDOM.nodeType,n=this.dom;this.dom=De(this.dom,this.nodeDOM,Re(this.outerDeco,this.node,t),Re(e,this.node,t)),this.dom!=n&&(n.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=e}}},{key:"selectNode",value:function(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.add("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||(this.nodeDOM.draggable=!0))}},{key:"deselectNode",value:function(){1==this.nodeDOM.nodeType&&(this.nodeDOM.classList.remove("ProseMirror-selectednode"),!this.contentDOM&&this.node.type.spec.draggable||this.nodeDOM.removeAttribute("draggable"))}},{key:"domAtom",get:function(){return this.node.isAtom}}],[{key:"create",value:function(e,t,r,o,i,s){var a,l=i.nodeViews[t.type.name],c=l&&l(t,i,function(){return a?a.parent?a.parent.posBeforeChild(a):void 0:s},r,o),d=c&&c.dom,u=c&&c.contentDOM;if(t.isText)if(d){if(3!=d.nodeType)throw new RangeError("Text must be rendered as a DOM text node")}else d=document.createTextNode(t.text);else if(!d){var h=b.DOMSerializer.renderSpec(document,t.type.spec.toDOM(t),null,t.attrs);d=h.dom,u=h.contentDOM}u||t.isText||"BR"==d.nodeName||(d.hasAttribute("contenteditable")||(d.contentEditable="false"),t.type.spec.draggable&&(d.draggable=!0));var p=d;return d=$e(d,r,t),c?a=new Ae(e,t,r,o,d,u||null,p,c,i,s+1):t.isText?new Me(e,t,r,o,d,p,i):new n(e,t,r,o,d,u||null,p,i,s+1)}}]),n}(be);function Ce(e,t,n,r,o){$e(r,t,e);var i=new Se(void 0,e,t,n,r,r,r,o,0);return i.contentDOM&&i.updateChildren(o,0),i}var Me=function(e){l(n,e);var t=d(n);function n(e,r,o,i,s,a,l){return f(this,n),t.call(this,e,r,o,i,s,null,a,l,0)}return g(n,[{key:"parseRule",value:function(){for(var e=this.nodeDOM.parentNode;e&&e!=this.dom&&!e.pmIsDeco;)e=e.parentNode;return{skip:e||!0}}},{key:"update",value:function(e,t,n,r){return!(3==this.dirty||0!=this.dirty&&!this.inParent()||!e.sameMarkup(this.node)||(this.updateOuterDeco(t),0==this.dirty&&e.text==this.node.text||e.text==this.nodeDOM.nodeValue||(this.nodeDOM.nodeValue=e.text,r.trackWrites==this.nodeDOM&&(r.trackWrites=null)),this.node=e,this.dirty=0,0))}},{key:"inParent",value:function(){for(var e=this.parent.contentDOM,t=this.nodeDOM;t;t=t.parentNode)if(t==e)return!0;return!1}},{key:"domFromPos",value:function(e){return{node:this.nodeDOM,offset:e}}},{key:"localPosFromDOM",value:function(e,t,r){return e==this.nodeDOM?this.posAtStart+Math.min(t,this.node.text.length):a(h(n.prototype),"localPosFromDOM",this).call(this,e,t,r)}},{key:"ignoreMutation",value:function(e){return"characterData"!=e.type&&"selection"!=e.type}},{key:"slice",value:function(e,t,r){var o=this.node.cut(e,t),i=document.createTextNode(o.text);return new n(this.parent,o,this.outerDeco,this.innerDeco,i,i,r)}},{key:"markDirty",value:function(e,t){a(h(n.prototype),"markDirty",this).call(this,e,t),this.dom==this.nodeDOM||0!=e&&t!=this.nodeDOM.nodeValue.length||(this.dirty=3)}},{key:"domAtom",get:function(){return!1}},{key:"isText",value:function(e){return this.node.text==e}}]),n}(Se),Te=function(e){l(n,e);var t=d(n);function n(){return f(this,n),t.apply(this,arguments)}return g(n,[{key:"parseRule",value:function(){return{ignore:!0}}},{key:"matchesHack",value:function(e){return 0==this.dirty&&this.dom.nodeName==e}},{key:"domAtom",get:function(){return!0}},{key:"ignoreForCoords",get:function(){return"IMG"==this.dom.nodeName}}]),n}(be),Ae=function(e){l(n,e);var t=d(n);function n(e,r,o,i,s,a,l,c,d,u){var h;return f(this,n),(h=t.call(this,e,r,o,i,s,a,l,d,u)).spec=c,h}return g(n,[{key:"update",value:function(e,t,r,o){if(3==this.dirty)return!1;if(this.spec.update&&(this.node.type==e.type||this.spec.multiType)){var i=this.spec.update(e,t,r);return i&&this.updateInner(e,t,r,o),i}return!(!this.contentDOM&&!e.isLeaf)&&a(h(n.prototype),"update",this).call(this,e,t,r,o)}},{key:"selectNode",value:function(){this.spec.selectNode?this.spec.selectNode():a(h(n.prototype),"selectNode",this).call(this)}},{key:"deselectNode",value:function(){this.spec.deselectNode?this.spec.deselectNode():a(h(n.prototype),"deselectNode",this).call(this)}},{key:"setSelection",value:function(e,t,r,o){this.spec.setSelection?this.spec.setSelection(e,t,r.root):a(h(n.prototype),"setSelection",this).call(this,e,t,r,o)}},{key:"destroy",value:function(){this.spec.destroy&&this.spec.destroy(),a(h(n.prototype),"destroy",this).call(this)}},{key:"stopEvent",value:function(e){return!!this.spec.stopEvent&&this.spec.stopEvent(e)}},{key:"ignoreMutation",value:function(e){return this.spec.ignoreMutation?this.spec.ignoreMutation(e):a(h(n.prototype),"ignoreMutation",this).call(this,e)}}]),n}(Se);function Oe(e,t,n){for(var r=e.firstChild,o=!1,i=0;i<t.length;i++){var s=t[i],a=s.dom;if(a.parentNode==e){for(;a!=r;)r=ze(r),o=!0;r=r.nextSibling}else o=!0,e.insertBefore(a,r);if(s instanceof xe){var l=r?r.previousSibling:e.lastChild;Oe(s.contentDOM,s.children,n),r=l?l.nextSibling:e.firstChild}}for(;r;)r=ze(r),o=!0;o&&n.trackWrites==e&&(n.trackWrites=null)}var Ee=function(e){e&&(this.nodeName=e)};Ee.prototype=Object.create(null);var Ne=[new Ee];function Re(e,t,n){if(0==e.length)return Ne;for(var r=n?Ne[0]:new Ee,o=[r],i=0;i<e.length;i++){var s=e[i].type.attrs;if(s)for(var a in s.nodeName&&o.push(r=new Ee(s.nodeName)),s){var l=s[a];null!=l&&(n&&1==o.length&&o.push(r=new Ee(t.isInline?"span":"div")),"class"==a?r.class=(r.class?r.class+" ":"")+l:"style"==a?r.style=(r.style?r.style+";":"")+l:"nodeName"!=a&&(r[a]=l))}}return o}function De(e,t,n,r){if(n==Ne&&r==Ne)return t;for(var o=t,i=0;i<r.length;i++){var s=r[i],a=n[i];if(i){var l=void 0;a&&a.nodeName==s.nodeName&&o!=e&&(l=o.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||((l=document.createElement(s.nodeName)).pmIsDeco=!0,l.appendChild(o),a=Ne[0]),o=l}Pe(o,a||Ne[0],s)}return o}function Pe(e,t,n){for(var r in t)"class"==r||"style"==r||"nodeName"==r||r in n||e.removeAttribute(r);for(var o in n)"class"!=o&&"style"!=o&&"nodeName"!=o&&n[o]!=t[o]&&e.setAttribute(o,n[o]);if(t.class!=n.class){for(var i=t.class?t.class.split(" ").filter(Boolean):[],s=n.class?n.class.split(" ").filter(Boolean):[],a=0;a<i.length;a++)-1==s.indexOf(i[a])&&e.classList.remove(i[a]);for(var l=0;l<s.length;l++)-1==i.indexOf(s[l])&&e.classList.add(s[l]);0==e.classList.length&&e.removeAttribute("class")}if(t.style!=n.style){if(t.style)for(var c,d=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g;c=d.exec(t.style);)e.style.removeProperty(c[1]);n.style&&(e.style.cssText+=n.style)}}function $e(e,t,n){return De(e,e,Ne,Re(t,n,1!=e.nodeType))}function Ie(e,t){if(e.length!=t.length)return!1;for(var n=0;n<e.length;n++)if(!e[n].type.eq(t[n].type))return!1;return!0}function ze(e){var t=e.nextSibling;return e.parentNode.removeChild(e),t}var Le=function(){function e(t,n,r){f(this,e),this.lock=n,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=function(e,t){var n=t,r=n.children.length,o=e.childCount,i=new Map,s=[];e:for(;o>0;){for(var a=void 0;;)if(r){var l=n.children[r-1];if(!(l instanceof xe)){a=l,r--;break}n=l,r=l.children.length}else{if(n==t)break e;r=n.parent.children.indexOf(n),n=n.parent}var c=a.node;if(c){if(c!=e.child(o-1))break;--o,i.set(a,o),s.push(a)}}return{index:o,matched:i,matches:s.reverse()}}(t.node.content,t)}return g(e,[{key:"destroyBetween",value:function(e,t){if(e!=t){for(var n=e;n<t;n++)this.top.children[n].destroy();this.top.children.splice(e,t-e),this.changed=!0}}},{key:"destroyRest",value:function(){this.destroyBetween(this.index,this.top.children.length)}},{key:"syncToMarks",value:function(e,t,n,r){for(var o=0,i=this.stack.length>>1,s=Math.min(i,e.length);o<s&&(o==i-1?this.top:this.stack[o+1<<1]).matchesMark(e[o])&&!1!==e[o].type.spec.spanning;)o++;for(;o<i;)this.destroyRest(),this.top.dirty=0,this.index=this.stack.pop(),this.top=this.stack.pop(),i--;for(;i<e.length;){this.stack.push(this.top,this.index+1);var a=-1,l=this.top.children.length;r<this.preMatch.index&&(l=Math.min(this.index+3,l));for(var c=this.index;c<l;c++){var d=this.top.children[c];if(d.matchesMark(e[i])&&!this.isLocked(d.dom)){a=c;break}}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{var u=xe.create(this.top,e[i],t,n);this.top.children.splice(this.index,0,u),this.top=u,this.changed=!0}this.index=0,i++}}},{key:"findNodeMatch",value:function(e,t,n,r){var o,i=-1;if(r>=this.preMatch.index&&(o=this.preMatch.matches[r-this.preMatch.index]).parent==this.top&&o.matchesNode(e,t,n))i=this.top.children.indexOf(o,this.index);else for(var s=this.index,a=Math.min(this.top.children.length,s+5);s<a;s++){var l=this.top.children[s];if(l.matchesNode(e,t,n)&&!this.preMatch.matched.has(l)){i=s;break}}return!(i<0||(this.destroyBetween(this.index,i),this.index++,0))}},{key:"updateNodeAt",value:function(e,t,n,r,o){var i=this.top.children[r];return 3==i.dirty&&i.dom==i.contentDOM&&(i.dirty=2),!!i.update(e,t,n,o)&&(this.destroyBetween(this.index,r),this.index++,!0)}},{key:"findIndexWithChild",value:function(e){for(;;){var t=e.parentNode;if(!t)return-1;if(t==this.top.contentDOM){var n=e.pmViewDesc;if(n)for(var r=this.index;r<this.top.children.length;r++)if(this.top.children[r]==n)return r;return-1}e=t}}},{key:"updateNextNode",value:function(e,t,n,r,o,i){for(var s=this.index;s<this.top.children.length;s++){var a=this.top.children[s];if(a instanceof Se){var l=this.preMatch.matched.get(a);if(null!=l&&l!=o)return!1;var c=a.dom,d=void 0,u=this.isLocked(c)&&!(e.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==e.text&&3!=a.dirty&&Ie(t,a.outerDeco));if(!u&&a.update(e,t,n,r))return this.destroyBetween(this.index,s),a.dom!=c&&(this.changed=!0),this.index++,!0;if(!u&&(d=this.recreateWrapper(a,e,t,n,r,i)))return this.destroyBetween(this.index,s),this.top.children[this.index]=d,d.contentDOM&&(d.dirty=2,d.updateChildren(r,i+1),d.dirty=0),this.changed=!0,this.index++,!0;break}}return!1}},{key:"recreateWrapper",value:function(e,t,n,r,i,s){if(e.dirty||t.isAtom||!e.children.length||!e.node.content.eq(t.content)||!Ie(n,e.outerDeco)||!r.eq(e.innerDeco))return null;var a=Se.create(this.top,t,n,r,i,s);if(a.contentDOM){a.children=e.children,e.children=[];var l,c=o(a.children);try{for(c.s();!(l=c.n()).done;)l.value.parent=a}catch(e){c.e(e)}finally{c.f()}}return e.destroy(),a}},{key:"addNode",value:function(e,t,n,r,o){var i=Se.create(this.top,e,t,n,r,o);i.contentDOM&&i.updateChildren(r,o+1),this.top.children.splice(this.index++,0,i),this.changed=!0}},{key:"placeWidget",value:function(e,t,n){var r=this.index<this.top.children.length?this.top.children[this.index]:null;if(!r||!r.matchesWidget(e)||e!=r.widget&&r.widget.type.toDOM.parentNode){var o=new ke(this.top,e,t,n);this.top.children.splice(this.index++,0,o),this.changed=!0}else this.index++}},{key:"addTextblockHacks",value:function(){for(var e=this.top.children[this.index-1],t=this.top;e instanceof xe;)e=(t=e).children[t.children.length-1];(!e||!(e instanceof Me)||/\n$/.test(e.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(e.node.text))&&((W||_)&&e&&"false"==e.dom.contentEditable&&this.addHackNode("IMG",t),this.addHackNode("BR",this.top))}},{key:"addHackNode",value:function(e,t){if(t==this.top&&this.index<t.children.length&&t.children[this.index].matchesHack(e))this.index++;else{var n=document.createElement(e);"IMG"==e&&(n.className="ProseMirror-separator",n.alt=""),"BR"==e&&(n.className="ProseMirror-trailingBreak");var r=new Te(this.top,[],n,null);t!=this.top?t.children.push(r):t.children.splice(this.index++,0,r),this.changed=!0}}},{key:"isLocked",value:function(e){return this.lock&&(e==this.lock||1==e.nodeType&&e.contains(this.lock.parentNode))}}]),e}();function Fe(e,t){return e.type.side-t.type.side}function He(e,t,n,r,o){for(var i=[],s=0,a=0;s<e.length;s++){var l=e[s],c=a,d=a+=l.size;c>=n||d<=t?i.push(l):(c<t&&i.push(l.slice(0,t-c,r)),o&&(i.push(o),o=void 0),d>n&&i.push(l.slice(n-c,l.size,r)))}return i}function je(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=e.domSelectionRange(),o=e.state.doc;if(!n.focusNode)return null;var i=e.docView.nearestDesc(n.focusNode),s=i&&0==i.size,a=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(a<0)return null;var l,c,d=o.resolve(a);if(N(n)){for(l=a;i&&!i.node;)i=i.parent;var u=i.node;if(i&&u.isAtom&&y.NodeSelection.isSelectable(u)&&i.parent&&(!u.isInline||!function(e,t,n){for(var r=0==t,o=t==O(e);r||o;){if(e==n)return!0;var i=w(e);if(!(e=e.parentNode))return!1;r=r&&0==i,o=o&&i==O(e)}}(n.focusNode,n.focusOffset,i.dom))){var h=i.posBefore;c=new y.NodeSelection(a==h?d:o.resolve(h))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){for(var p=a,f=a,m=0;m<n.rangeCount;m++){var g=n.getRangeAt(m);p=Math.min(p,e.docView.posFromDOM(g.startContainer,g.startOffset,1)),f=Math.max(f,e.docView.posFromDOM(g.endContainer,g.endOffset,-1))}if(p<0)return null;var v=r(f==e.state.selection.anchor?[f,p]:[p,f],2);l=v[0],a=v[1],d=o.resolve(a)}else l=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(l<0)return null}var b=o.resolve(l);return c||(c=Ge(e,b,d,"pointer"==t||e.state.selection.head<d.pos&&!s?1:-1)),c}function Be(e){return e.editable?e.hasFocus():Ye(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function _e(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=e.state.selection;if(Je(e,n),Be(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&_){var r=e.domSelectionRange(),o=e.domObserver.currentSelection;if(r.anchorNode&&o.anchorNode&&M(r.anchorNode,r.anchorOffset,o.anchorNode,o.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){var t=e.domSelection();if(t){var n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,w(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&F&&H<=11&&(n.disabled=!0,n.disabled=!1)}}(e);else{var i,s,a=n.anchor,l=n.head;!Ve||n instanceof y.TextSelection||(n.$from.parent.inlineContent||(i=We(e,n.from)),n.empty||n.$from.parent.inlineContent||(s=We(e,n.to))),e.docView.setSelection(a,l,e,t),Ve&&(i&&Ke(i),s&&Ke(s)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){var t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);var n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=function(){n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(function(){Be(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}var Ve=W||_&&V<63;function We(e,t){var n=e.docView.domFromPos(t,0),r=n.node,o=n.offset,i=o<r.childNodes.length?r.childNodes[o]:null,s=o?r.childNodes[o-1]:null;if(W&&i&&"false"==i.contentEditable)return qe(i);if(!(i&&"false"!=i.contentEditable||s&&"false"!=s.contentEditable)){if(i)return qe(i);if(s)return qe(s)}}function qe(e){return e.contentEditable="true",W&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Ke(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function Je(e,t){if(t instanceof y.NodeSelection){var n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(Ue(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else Ue(e)}function Ue(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function Ge(e,t,n,r){return e.someProp("createSelectionBetween",function(r){return r(e,t,n)})||y.TextSelection.between(t,n,r)}function Xe(e){return!(e.editable&&!e.hasFocus())&&Ye(e)}function Ye(e){var t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Qe(e,t){var n=e.selection,r=n.$anchor,o=n.$head,i=t>0?r.max(o):r.min(o),s=i.parent.inlineContent?i.depth?e.doc.resolve(t>0?i.after():i.before()):null:i;return s&&y.Selection.findFrom(s,t)}function Ze(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function et(e,t,n){var r=e.state.selection;if(!(r instanceof y.TextSelection)){if(r instanceof y.NodeSelection&&r.node.isInline)return Ze(e,new y.TextSelection(t>0?r.$to:r.$from));var o=Qe(e.state,t);return!!o&&Ze(e,o)}if(n.indexOf("s")>-1){var i=r.$head,s=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter;if(!s||s.isText||!s.isLeaf)return!1;var a=e.state.doc.resolve(i.pos+s.nodeSize*(t<0?-1:1));return Ze(e,new y.TextSelection(r.$anchor,a))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){var l=Qe(e.state,t);return!!(l&&l instanceof y.NodeSelection)&&Ze(e,l)}if(!(K&&n.indexOf("m")>-1)){var c,d=r.$head,u=d.textOffset?null:t<0?d.nodeBefore:d.nodeAfter;if(!u||u.isText)return!1;var h=t<0?d.pos-u.nodeSize:d.pos;return!!(u.isAtom||(c=e.docView.descAt(h))&&!c.contentDOM)&&(y.NodeSelection.isSelectable(u)?Ze(e,new y.NodeSelection(t<0?e.state.doc.resolve(d.pos-u.nodeSize):d)):!!G&&Ze(e,new y.TextSelection(e.state.doc.resolve(t<0?h:h+u.nodeSize))))}}function tt(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function nt(e,t){var n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function rt(e,t){return t<0?function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n){var o,i,s=!1;for(j&&1==n.nodeType&&r<tt(n)&&nt(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;var a=n.childNodes[r-1];if(nt(a,-1))o=n,i=--r;else{if(3!=a.nodeType)break;r=(n=a).nodeValue.length}}else{if(ot(n))break;for(var l=n.previousSibling;l&&nt(l,-1);)o=n.parentNode,i=w(l),l=l.previousSibling;if(l)r=tt(n=l);else{if((n=n.parentNode)==e.dom)break;r=0}}s?it(e,n,r):o&&it(e,o,i)}}(e):function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n){for(var o,i,s=tt(n);;)if(r<s){if(1!=n.nodeType)break;if(!nt(n.childNodes[r],1))break;o=n,i=++r}else{if(ot(n))break;for(var a=n.nextSibling;a&&nt(a,1);)o=a.parentNode,i=w(a)+1,a=a.nextSibling;if(a)r=0,s=tt(n=a);else{if((n=n.parentNode)==e.dom)break;r=s=0}}o&&it(e,o,i)}}(e)}function ot(e){var t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function it(e,t,n){var r,o;3!=t.nodeType&&((o=function(e,t){for(;e&&t==e.childNodes.length&&!E(e);)t=w(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){var n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=o,n=0):(r=function(e,t){for(;e&&!t&&!E(e);)t=w(e),e=e.parentNode;for(;e&&t;){var n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=r,n=r.nodeValue.length));var i=e.domSelection();if(i){if(N(i)){var s=document.createRange();s.setEnd(t,n),s.setStart(t,n),i.removeAllRanges(),i.addRange(s)}else i.extend&&i.extend(t,n);e.domObserver.setCurSelection();var a=e.state;setTimeout(function(){e.state==a&&_e(e)},50)}}function st(e,t){var n=e.state.doc.resolve(t);if(!_&&!J&&n.parent.inlineContent){var r=e.coordsAtPos(t);if(t>n.start()){var o=e.coordsAtPos(t-1),i=(o.top+o.bottom)/2;if(i>r.top&&i<r.bottom&&Math.abs(o.left-r.left)>1)return o.left<r.left?"ltr":"rtl"}if(t<n.end()){var s=e.coordsAtPos(t+1),a=(s.top+s.bottom)/2;if(a>r.top&&a<r.bottom&&Math.abs(s.left-r.left)>1)return s.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function at(e,t,n){var r=e.state.selection;if(r instanceof y.TextSelection&&!r.empty||n.indexOf("s")>-1)return!1;if(K&&n.indexOf("m")>-1)return!1;var o=r.$from,i=r.$to;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){var s=Qe(e.state,t);if(s&&s instanceof y.NodeSelection)return Ze(e,s)}if(!o.parent.inlineContent){var a=t<0?o:i,l=r instanceof y.AllSelection?y.Selection.near(a,t):y.Selection.findFrom(a,t);return!!l&&Ze(e,l)}return!1}function lt(e,t){if(!(e.state.selection instanceof y.TextSelection))return!0;var n=e.state.selection,r=n.$head,o=n.$anchor,i=n.empty;if(!r.sameParent(o))return!0;if(!i)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;var s=!r.textOffset&&(t<0?r.nodeBefore:r.nodeAfter);if(s&&!s.isText){var a=e.state.tr;return t<0?a.delete(r.pos-s.nodeSize,r.pos):a.delete(r.pos,r.pos+s.nodeSize),e.dispatch(a),!0}return!1}function ct(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function dt(e,t){e.someProp("transformCopied",function(n){t=n(t,e)});for(var n=[],r=t,o=r.content,i=r.openStart,s=r.openEnd;i>1&&s>1&&1==o.childCount&&1==o.firstChild.childCount;){i--,s--;var a=o.firstChild;n.push(a.type.name,a.attrs!=a.type.defaultAttrs?a.attrs:null),o=a.content}var l=e.someProp("clipboardSerializer")||b.DOMSerializer.fromSchema(e.state.schema),c=kt(),d=c.createElement("div");d.appendChild(l.serializeFragment(o,{document:c}));for(var u,h=d.firstChild,p=0;h&&1==h.nodeType&&(u=yt[h.nodeName.toLowerCase()]);){for(var f=u.length-1;f>=0;f--){for(var m=c.createElement(u[f]);d.firstChild;)m.appendChild(d.firstChild);d.appendChild(m),p++}h=d.firstChild}return h&&1==h.nodeType&&h.setAttribute("data-pm-slice","".concat(i," ").concat(s).concat(p?" -".concat(p):""," ").concat(JSON.stringify(n))),{dom:d,text:e.someProp("clipboardTextSerializer",function(n){return n(t,e)})||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function ut(e,t,n,r,o){var i,s,a=o.parent.type.spec.code;if(!n&&!t)return null;var l=!!t&&(r||a||!n);if(l){if(e.someProp("transformPastedText",function(n){t=n(t,a||r,e)}),a)return s=new b.Slice(b.Fragment.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",function(t){s=t(s,e,!0)}),s;var c=e.someProp("clipboardTextParser",function(n){return n(t,o,r,e)});if(c)s=c;else{var d=o.marks(),u=e.state.schema,h=b.DOMSerializer.fromSchema(u);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(function(e){var t=i.appendChild(document.createElement("p"));e&&t.appendChild(h.serializeNode(u.text(e,d)))})}}else e.someProp("transformPastedHTML",function(t){n=t(n,e)}),i=function(e){var t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));var n,r=kt().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&&yt[o[1].toLowerCase()])&&(e=n.map(function(e){return"<"+e+">"}).join("")+e+n.map(function(e){return"</"+e+">"}).reverse().join("")),r.innerHTML=function(e){var t=window.trustedTypes;return t?(wt||(wt=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:function(e){return e}})),wt.createHTML(e)):e}(e),n)for(var i=0;i<n.length;i++)r=r.querySelector(n[i])||r;return r}(n),G&&function(e){for(var t=e.querySelectorAll(_?"span:not([class]):not([style])":"span.Apple-converted-space"),n=0;n<t.length;n++){var r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);var p=i&&i.querySelector("[data-pm-slice]"),f=p&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(p.getAttribute("data-pm-slice")||"");if(f&&f[3])for(var m=+f[3];m>0;m--){for(var g=i.firstChild;g&&1!=g.nodeType;)g=g.nextSibling;if(!g)break;i=g}if(!s){var v=e.someProp("clipboardParser")||e.someProp("domParser")||b.DOMParser.fromSchema(e.state.schema);s=v.parseSlice(i,{preserveWhitespace:!(!l&&!f),context:o,ruleFromNode:function(e){return"BR"!=e.nodeName||e.nextSibling||!e.parentNode||ht.test(e.parentNode.nodeName)?null:{ignore:!0}}})}if(f)s=function(e,t){if(!e.size)return e;var n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}for(var o=e.content,i=e.openStart,s=e.openEnd,a=n.length-2;a>=0;a-=2){var l=r.nodes[n[a]];if(!l||l.hasRequiredAttrs())break;o=b.Fragment.from(l.create(n[a+1],o)),i++,s++}return new b.Slice(o,i,s)}(vt(s,+f[1],+f[2]),f[4]);else if(s=b.Slice.maxOpen(function(e,t){if(e.childCount<2)return e;for(var n,r=function(){var n,r=t.node(o).contentMatchAt(t.index(o)),i=[];if(e.forEach(function(e){if(i){var t,o=r.findWrapping(e.type);if(!o)return i=null;if(t=i.length&&n.length&&ft(o,n,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=mt(i[i.length-1],n.length));var s=pt(e,o);i.push(s),r=r.matchType(s.type),n=o}}}),i)return{v:b.Fragment.from(i)}},o=t.depth;o>=0;o--)if(n=r())return n.v;return e}(s.content,o),!0),s.openStart||s.openEnd){for(var y=0,k=0,w=s.content.firstChild;y<s.openStart&&!w.type.spec.isolating;y++,w=w.firstChild);for(var x=s.content.lastChild;k<s.openEnd&&!x.type.spec.isolating;k++,x=x.lastChild);s=vt(s,y,k)}return e.someProp("transformPasted",function(t){s=t(s,e,l)}),s}var ht=/^(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 pt(e,t){for(var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=t.length-1;r>=n;r--)e=t[r].create(null,b.Fragment.from(e));return e}function ft(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){var i=ft(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(b.Fragment.from(pt(n,e,o+1))))}}function mt(e,t){if(0==t)return e;var n=e.content.replaceChild(e.childCount-1,mt(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(b.Fragment.empty,!0);return e.copy(n.append(r))}function gt(e,t,n,r,o,i){var s=t<0?e.firstChild:e.lastChild,a=s.content;return e.childCount>1&&(i=0),o<r-1&&(a=gt(a,t,n,r,o+1,i)),o>=n&&(a=t<0?s.contentMatchAt(0).fillBefore(a,i<=o).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(b.Fragment.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(a))}function vt(e,t,n){return t<e.openStart&&(e=new b.Slice(gt(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new b.Slice(gt(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}var yt={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},bt=null;function kt(){return bt||(bt=document.implementation.createHTMLDocument("title"))}var wt=null,xt={},St={},Ct={touchstart:!0,touchmove:!0},Mt=g(function e(){f(this,e),this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:"",button:0},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastChromeDelete=0,this.composing=!1,this.compositionNode=null,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.compositionID=1,this.badSafariComposition=!1,this.compositionPendingChanges=0,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null});function Tt(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function At(e){e.someProp("handleDOMEvents",function(t){for(var n in t)e.input.eventHandlers[n]||e.dom.addEventListener(n,e.input.eventHandlers[n]=function(t){return Ot(e,t)})})}function Ot(e,t){return e.someProp("handleDOMEvents",function(n){var r=n[t.type];return!!r&&(r(e,t)||t.defaultPrevented)})}function Et(e){return{left:e.clientX,top:e.clientY}}function Nt(e,t,n,r,o){if(-1==r)return!1;for(var i,s=e.state.doc.resolve(r),a=function(r){if(e.someProp(t,function(t){return r>s.depth?t(e,n,s.nodeAfter,s.before(r),o,!0):t(e,n,s.node(r),s.before(r),o,!1)}))return{v:!0}},l=s.depth+1;l>0;l--)if(i=a(l))return i.v;return!1}function Rt(e,t,n){if(e.focused||e.focus(),!e.state.selection.eq(t)){var r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}}function Dt(e,t,n,r){return Nt(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",function(n){return n(e,t,r)})}function Pt(e,t,n,r){return Nt(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",function(n){return n(e,t,r)})||function(e,t,n){if(0!=n.button)return!1;var r=e.state.doc;if(-1==t)return!!r.inlineContent&&(Rt(e,y.TextSelection.create(r,0,r.content.size),"pointer"),!0);for(var o=r.resolve(t),i=o.depth+1;i>0;i--){var s=i>o.depth?o.nodeAfter:o.node(i),a=o.before(i);if(s.inlineContent)Rt(e,y.TextSelection.create(r,a+1,a+1+s.content.size),"pointer");else{if(!y.NodeSelection.isSelectable(s))continue;Rt(e,y.NodeSelection.create(r,a),"pointer")}return!0}}(e,n,r)}function $t(e){return Bt(e)}St.keydown=function(e,t){var n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!Lt(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!U||!_||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!q||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",function(t){return t(e,n)})||function(e,t){var n=t.keyCode,r=function(e){var t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||K&&72==n&&"c"==r)return lt(e,-1)||rt(e,-1);if(46==n&&!t.shiftKey||K&&68==n&&"c"==r)return lt(e,1)||rt(e,1);if(13==n||27==n)return!0;if(37==n||K&&66==n&&"c"==r){var o=37==n?"ltr"==st(e,e.state.selection.from)?-1:1:-1;return et(e,o,r)||rt(e,o)}if(39==n||K&&70==n&&"c"==r){var i=39==n?"ltr"==st(e,e.state.selection.from)?1:-1:1;return et(e,i,r)||rt(e,i)}return 38==n||K&&80==n&&"c"==r?at(e,-1,r)||rt(e,-1):40==n||K&&78==n&&"c"==r?function(e){if(!W||e.state.selection.$head.parentOffset>0)return!1;var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(n&&1==n.nodeType&&0==r&&n.firstChild&&"false"==n.firstChild.contentEditable){var o=n.firstChild;ct(e,o,"true"),setTimeout(function(){return ct(e,o,"false")},20)}return!1}(e)||at(e,1,r)||rt(e,1):r==(K?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():Tt(e,"key");else{var r=Date.now();e.input.lastIOSEnter=r,e.input.lastIOSEnterFallbackTimeout=setTimeout(function(){e.input.lastIOSEnter==r&&(e.someProp("handleKeyDown",function(t){return t(e,R(13,"Enter"))}),e.input.lastIOSEnter=0)},200)}},St.keyup=function(e,t){16==t.keyCode&&(e.input.shiftKey=!1)},St.keypress=function(e,t){var n=t;if(!(Lt(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||K&&n.metaKey))if(e.someProp("handleKeyPress",function(t){return t(e,n)}))n.preventDefault();else{var r=e.state.selection;if(!(r instanceof y.TextSelection&&r.$from.sameParent(r.$to))){var o=String.fromCharCode(n.charCode),i=function(){return e.state.tr.insertText(o).scrollIntoView()};/[\r\n]/.test(o)||e.someProp("handleTextInput",function(t){return t(e,r.$from.pos,r.$to.pos,o,i)})||e.dispatch(i()),n.preventDefault()}}};var It=K?"metaKey":"ctrlKey";xt.mousedown=function(e,t){var n=t;e.input.shiftKey=n.shiftKey;var r=$t(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){var n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[It]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};var s=e.posAtCoords(Et(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new zt(e,s,n,!!r)):("doubleClick"==i?Dt:Pt)(e,s.pos,s.inside,n)?n.preventDefault():Tt(e,"pointer"))};var zt=function(){function e(t,n,r,o){var i,s,a=this;if(f(this,e),this.view=t,this.pos=n,this.event=r,this.flushed=o,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[It],this.allowDefault=r.shiftKey,n.inside>-1)i=t.state.doc.nodeAt(n.inside),s=n.inside;else{var l=t.state.doc.resolve(n.pos);i=l.parent,s=l.depth?l.before():0}var c=o?null:r.target,d=c?t.docView.nearestDesc(c,!0):null;this.target=d&&1==d.nodeDOM.nodeType?d.nodeDOM:null;var u=t.state.selection;(0==r.button&&i.type.spec.draggable&&!1!==i.type.spec.selectable||u instanceof y.NodeSelection&&u.from<=s&&u.to>s)&&(this.mightDrag={node:i,pos:s,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!j||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(function(){a.view.input.mouseDown==a&&a.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)),Tt(t,"pointer")}return g(e,[{key:"done",value:function(){var e=this;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(function(){return _e(e.view)}),this.view.input.mouseDown=null}},{key:"up",value:function(e){if(this.done(),this.view.dom.contains(e.target)){var t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(Et(e))),this.updateAllowDefault(e),this.allowDefault||!t?Tt(this.view,"pointer"):function(e,t,n,r,o){return Nt(e,"handleClickOn",t,n,r)||e.someProp("handleClick",function(n){return n(e,t,r)})||(o?function(e,t){if(-1==t)return!1;var n,r,o=e.state.selection;o instanceof y.NodeSelection&&(n=o.node);for(var i=e.state.doc.resolve(t),s=i.depth+1;s>0;s--){var a=s>i.depth?i.nodeAfter:i.node(s);if(y.NodeSelection.isSelectable(a)){r=n&&o.$from.depth>0&&s>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(s);break}}return null!=r&&(Rt(e,y.NodeSelection.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;var n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&y.NodeSelection.isSelectable(r))&&(Rt(e,new y.NodeSelection(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||W&&this.mightDrag&&!this.mightDrag.node.isAtom||_&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(Rt(this.view,y.Selection.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):Tt(this.view,"pointer")}}},{key:"move",value:function(e){this.updateAllowDefault(e),Tt(this.view,"pointer"),0==e.buttons&&this.done()}},{key:"updateAllowDefault",value:function(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}]),e}();function Lt(e,t){return!!e.composing||!!(W&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}xt.touchstart=function(e){e.input.lastTouch=Date.now(),$t(e),Tt(e,"pointer")},xt.touchmove=function(e){e.input.lastTouch=Date.now(),Tt(e,"pointer")},xt.contextmenu=function(e){return $t(e)};var Ft=U?5e3:-1;function Ht(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(function(){return Bt(e)},t))}function jt(e){var t;for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=((t=document.createEvent("Event")).initEvent("event",!0,!0),t.timeStamp));e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Bt(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!(U&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),jt(e),t||e.docView&&e.docView.dirty){var n=je(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}St.compositionstart=St.compositionupdate=function(e){if(!e.composing){e.domObserver.flush();var t=e.state,n=t.selection.$to;if(t.selection instanceof y.TextSelection&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(function(e){return!1===e.type.spec.inclusive})||_&&J&&function(e){var t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n||1!=n.nodeType||r>=n.childNodes.length)return!1;var o=n.childNodes[r];return 1==o.nodeType&&"false"==o.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),Bt(e,!0),e.markCursor=null;else if(Bt(e,!t.selection.empty),j&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length)for(var r=e.domSelectionRange(),o=r.focusNode,i=r.focusOffset;o&&1==o.nodeType&&0!=i;){var s=i<0?o.lastChild:o.childNodes[i-1];if(!s)break;if(3==s.nodeType){var a=e.domSelection();a&&a.collapse(s,s.nodeValue.length);break}o=s,i=-1}e.input.composing=!0}Ht(e,Ft)},St.compositionend=function(e,t){e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(function(){return e.domObserver.flush()}),e.input.compositionID++,Ht(e,20))};var _t=F&&H<15||q&&X<604;function Vt(e,t,n,r,o){var i=ut(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",function(t){return t(e,o,i||b.Slice.empty)}))return!0;if(!i)return!1;var s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Wt(e){var t=e.getData("text/plain")||e.getData("Text");if(t)return t;var n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}xt.copy=St.cut=function(e,t){var n=t,r=e.state.selection,o="cut"==n.type;if(!r.empty){var i=_t?null:n.clipboardData,s=dt(e,r.content()),a=s.dom,l=s.text;i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(e.dom.parentNode){var n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";var r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(function(){n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))}},St.paste=function(e,t){var n=t;if(!e.composing||U){var r=_t?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&Vt(e,Wt(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(e.dom.parentNode){var n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();var o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(function(){e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Vt(e,r.value,null,o,t):Vt(e,r.textContent,r.innerHTML,o,t)},50)}}(e,n)}};var qt=g(function e(t,n,r){f(this,e),this.slice=t,this.move=n,this.node=r}),Kt=K?"altKey":"ctrlKey";function Jt(e,t){var n=e.someProp("dragCopies",function(e){return!e(t)});return null!=n?n:!t[Kt]}for(var Ut in xt.dragstart=function(e,t){var n=t,r=e.input.mouseDown;if(r&&r.done(),n.dataTransfer){var o,i=e.state.selection,s=i.empty?null:e.posAtCoords(Et(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof y.NodeSelection?i.to-1:i.to));else if(r&&r.mightDrag)o=y.NodeSelection.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){var a=e.docView.nearestDesc(n.target,!0);a&&a.node.type.spec.draggable&&a!=e.docView&&(o=y.NodeSelection.create(e.state.doc,a.posBefore))}var l=dt(e,(o||e.state.selection).content()),c=l.dom,d=l.text,u=l.slice;(!n.dataTransfer.files.length||!_||V>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(_t?"Text":"text/html",c.innerHTML),n.dataTransfer.effectAllowed="copyMove",_t||n.dataTransfer.setData("text/plain",d),e.dragging=new qt(u,Jt(e,n),o)}},xt.dragend=function(e){var t=e.dragging;window.setTimeout(function(){e.dragging==t&&(e.dragging=null)},50)},St.dragover=St.dragenter=function(e,t){return t.preventDefault()},St.drop=function(e,t){try{!function(e,t,n){if(t.dataTransfer){var r=e.posAtCoords(Et(t));if(r){var o=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",function(t){i=t(i,e,!1)}):i=ut(e,Wt(t.dataTransfer),_t?null:t.dataTransfer.getData("text/html"),!1,o);var s=!(!n||!Jt(e,t));if(e.someProp("handleDrop",function(n){return n(e,t,i||b.Slice.empty,s)}))t.preventDefault();else if(i){t.preventDefault();var a=i?k.dropPoint(e.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);var l=e.state.tr;if(s){var c=n.node;c?c.replace(l):l.deleteSelection()}var d=l.mapping.map(a),u=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,h=l.doc;if(u?l.replaceRangeWith(d,d,i.content.firstChild):l.replaceRange(d,d,i),!l.doc.eq(h)){var p=l.doc.resolve(d);if(u&&y.NodeSelection.isSelectable(i.content.firstChild)&&p.nodeAfter&&p.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new y.NodeSelection(p));else{var f=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach(function(e,t,n,r){return f=r}),l.setSelection(Ge(e,p,l.doc.resolve(f)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}}}}}(e,t,e.dragging)}finally{e.dragging=null}},xt.focus=function(e){e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(function(){e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&_e(e)},20))},xt.blur=function(e,t){var n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},xt.beforeinput=function(e,t){if(_&&U&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();var n=e.input.domChangeCount;setTimeout(function(){if(e.input.domChangeCount==n&&(e.dom.blur(),e.focus(),!e.someProp("handleKeyDown",function(t){return t(e,R(8,"Backspace"))}))){var t=e.state.selection.$cursor;t&&t.pos>0&&e.dispatch(e.state.tr.delete(t.pos-1,t.pos).scrollIntoView())}},50)}},St)xt[Ut]=St[Ut];function Gt(e,t){if(e==t)return!0;for(var n in e)if(e[n]!==t[n])return!1;for(var r in t)if(!(r in e))return!1;return!0}var Xt=function(){function e(t,n){f(this,e),this.toDOM=t,this.spec=n||tn,this.side=this.spec.side||0}return g(e,[{key:"map",value:function(e,t,n,r){var o=e.mapResult(t.from+r,this.side<0?-1:1),i=o.pos;return o.deleted?null:new Zt(i-n,i-n,this)}},{key:"valid",value:function(){return!0}},{key:"eq",value:function(t){return this==t||t instanceof e&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Gt(this.spec,t.spec))}},{key:"destroy",value:function(e){this.spec.destroy&&this.spec.destroy(e)}}]),e}(),Yt=function(){function e(t,n){f(this,e),this.attrs=t,this.spec=n||tn}return g(e,[{key:"map",value:function(e,t,n,r){var o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new Zt(o,i,this)}},{key:"valid",value:function(e,t){return t.from<t.to}},{key:"eq",value:function(t){return this==t||t instanceof e&&Gt(this.attrs,t.attrs)&&Gt(this.spec,t.spec)}},{key:"destroy",value:function(){}}],[{key:"is",value:function(t){return t.type instanceof e}}]),e}(),Qt=function(){function e(t,n){f(this,e),this.attrs=t,this.spec=n||tn}return g(e,[{key:"map",value:function(e,t,n,r){var o=e.mapResult(t.from+r,1);if(o.deleted)return null;var i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new Zt(o.pos-n,i.pos-n,this)}},{key:"valid",value:function(e,t){var n,r=e.content.findIndex(t.from),o=r.index,i=r.offset;return i==t.from&&!(n=e.child(o)).isText&&i+n.nodeSize==t.to}},{key:"eq",value:function(t){return this==t||t instanceof e&&Gt(this.attrs,t.attrs)&&Gt(this.spec,t.spec)}},{key:"destroy",value:function(){}}]),e}(),Zt=function(){function e(t,n,r){f(this,e),this.from=t,this.to=n,this.type=r}return g(e,[{key:"copy",value:function(t,n){return new e(t,n,this.type)}},{key:"eq",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}},{key:"map",value:function(e,t,n){return this.type.map(e,this,t,n)}},{key:"spec",get:function(){return this.type.spec}},{key:"inline",get:function(){return this.type instanceof Yt}},{key:"widget",get:function(){return this.type instanceof Xt}}],[{key:"widget",value:function(t,n,r){return new e(t,t,new Xt(n,r))}},{key:"inline",value:function(t,n,r,o){return new e(t,n,new Yt(r,o))}},{key:"node",value:function(t,n,r,o){return new e(t,n,new Qt(r,o))}}]),e}(),en=[],tn={},nn=function(){function e(t,n){f(this,e),this.local=t.length?t:en,this.children=n.length?n:en}return g(e,[{key:"find",value:function(e,t,n){var r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}},{key:"findInner",value:function(e,t,n,r,o){for(var i=0;i<this.local.length;i++){var s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(var a=0;a<this.children.length;a+=3)if(this.children[a]<t&&this.children[a+1]>e){var l=this.children[a]+1;this.children[a+2].findInner(e-l,t-l,n,r+l,o)}}},{key:"map",value:function(e,t,n){return this==rn||0==e.maps.length?this:this.mapInner(e,t,0,0,n||tn)}},{key:"mapInner",value:function(t,n,r,o,i){for(var s,a=0;a<this.local.length;a++){var l=this.local[a].map(t,r,o);l&&l.type.valid(n,l)?(s||(s=[])).push(l):i.onRemove&&i.onRemove(this.local[a].spec)}return this.children.length?sn(this.children,s||[],t,n,r,o,i):s?new e(s.sort(un),en):rn}},{key:"add",value:function(t,n){return n.length?this==rn?e.create(t,n):this.addInner(t,n,0):this}},{key:"addInner",value:function(t,n,r){var o,i=this,s=0;t.forEach(function(e,t){var a,l=t+r;if(a=ln(n,e,l)){for(o||(o=i.children.slice());s<o.length&&o[s]<t;)s+=3;o[s]==t?o[s+2]=o[s+2].addInner(e,a,l+1):o.splice(s,0,t,t+e.nodeSize,dn(a,e,l+1,tn)),s+=3}});for(var a=an(s?cn(n):n,-r),l=0;l<a.length;l++)a[l].type.valid(t,a[l])||a.splice(l--,1);return new e(a.length?this.local.concat(a).sort(un):this.local,o||this.children)}},{key:"remove",value:function(e){return 0==e.length||this==rn?this:this.removeInner(e,0)}},{key:"removeInner",value:function(t,n){for(var r=this.children,o=this.local,i=0;i<r.length;i+=3){for(var s,a=void 0,l=r[i]+n,c=r[i+1]+n,d=0;d<t.length;d++)(s=t[d])&&s.from>l&&s.to<c&&(t[d]=null,(a||(a=[])).push(s));if(a){r==this.children&&(r=this.children.slice());var u=r[i+2].removeInner(a,l+1);u!=rn?r[i+2]=u:(r.splice(i,3),i-=3)}}if(o.length)for(var h,p=0;p<t.length;p++)if(h=t[p])for(var f=0;f<o.length;f++)o[f].eq(h,n)&&(o==this.local&&(o=this.local.slice()),o.splice(f--,1));return r==this.children&&o==this.local?this:o.length||r.length?new e(o,r):rn}},{key:"forChild",value:function(t,n){if(this==rn)return this;if(n.isLeaf)return e.empty;for(var r,o,i=0;i<this.children.length;i+=3)if(this.children[i]>=t){this.children[i]==t&&(r=this.children[i+2]);break}for(var s=t+1,a=s+n.content.size,l=0;l<this.local.length;l++){var c=this.local[l];if(c.from<a&&c.to>s&&c.type instanceof Yt){var d=Math.max(s,c.from)-s,u=Math.min(a,c.to)-s;d<u&&(o||(o=[])).push(c.copy(d,u))}}if(o){var h=new e(o.sort(un),en);return r?new on([h,r]):h}return r||rn}},{key:"eq",value:function(t){if(this==t)return!0;if(!(t instanceof e)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(var n=0;n<this.local.length;n++)if(!this.local[n].eq(t.local[n]))return!1;for(var r=0;r<this.children.length;r+=3)if(this.children[r]!=t.children[r]||this.children[r+1]!=t.children[r+1]||!this.children[r+2].eq(t.children[r+2]))return!1;return!0}},{key:"locals",value:function(e){return hn(this.localsInner(e))}},{key:"localsInner",value:function(e){if(this==rn)return en;if(e.inlineContent||!this.local.some(Yt.is))return this.local;for(var t=[],n=0;n<this.local.length;n++)this.local[n].type instanceof Yt||t.push(this.local[n]);return t}},{key:"forEachSet",value:function(e){e(this)}}],[{key:"create",value:function(e,t){return t.length?dn(t,e,0,tn):rn}}]),e}();nn.empty=new nn([],[]),nn.removeOverlap=hn;var rn=nn.empty,on=function(){function e(t){f(this,e),this.members=t}return g(e,[{key:"map",value:function(t,n){var r=this.members.map(function(e){return e.map(t,n,tn)});return e.from(r)}},{key:"forChild",value:function(t,n){if(n.isLeaf)return nn.empty;for(var r=[],o=0;o<this.members.length;o++){var i=this.members[o].forChild(t,n);i!=rn&&(i instanceof e?r=r.concat(i.members):r.push(i))}return e.from(r)}},{key:"eq",value:function(t){if(!(t instanceof e)||t.members.length!=this.members.length)return!1;for(var n=0;n<this.members.length;n++)if(!this.members[n].eq(t.members[n]))return!1;return!0}},{key:"locals",value:function(e){for(var t,n=!0,r=0;r<this.members.length;r++){var o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(var i=0;i<o.length;i++)t.push(o[i])}else t=o}return t?hn(n?t:t.sort(un)):en}},{key:"forEachSet",value:function(e){for(var t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}],[{key:"from",value:function(t){switch(t.length){case 0:return rn;case 1:return t[0];default:return new e(t.every(function(e){return e instanceof nn})?t:t.reduce(function(e,t){return e.concat(t instanceof nn?t:t.members)},[]))}}}]),e}();function sn(e,t,n,r,o,i,s){for(var a=e.slice(),l=function(e){var t=0;n.maps[c].forEach(function(n,r,o,i){for(var s=i-o-(r-n),l=0;l<a.length;l+=3){var c=a[l+1];if(!(c<0||n>c+e-t)){var d=a[l]+e-t;r>=d?a[l+1]=n<=d?-2:-1:n>=e&&s&&(a[l]+=s,a[l+1]+=s)}}t+=s}),e=n.maps[c].map(e,-1),d=e},c=0,d=i;c<n.maps.length;c++)l(d);for(var u=!1,h=0;h<a.length;h+=3)if(a[h+1]<0){if(-2==a[h+1]){u=!0,a[h+1]=-1;continue}var p=n.map(e[h]+i),f=p-o;if(f<0||f>=r.content.size){u=!0;continue}var m=n.map(e[h+1]+i,-1)-o,g=r.content.findIndex(f),v=g.index,y=g.offset,b=r.maybeChild(v);if(b&&y==f&&y+b.nodeSize==m){var k=a[h+2].mapInner(n,b,p+1,e[h]+i+1,s);k!=rn?(a[h]=f,a[h+1]=m,a[h+2]=k):(a[h+1]=-2,u=!0)}else u=!0}if(u){var w=function(e,t,n,r,o,i,s){function a(e,t){for(var i=0;i<e.local.length;i++){var l=e.local[i].map(r,o,t);l?n.push(l):s.onRemove&&s.onRemove(e.local[i].spec)}for(var c=0;c<e.children.length;c+=3)a(e.children[c+2],e.children[c]+t+1)}for(var l=0;l<e.length;l+=3)-1==e[l+1]&&a(e[l+2],t[l]+i+1);return n}(a,e,t,n,o,i,s),x=dn(w,r,0,s);t=x.local;for(var S=0;S<a.length;S+=3)a[S+1]<0&&(a.splice(S,3),S-=3);for(var C=0,M=0;C<x.children.length;C+=3){for(var T=x.children[C];M<a.length&&a[M]<T;)M+=3;a.splice(M,0,x.children[C],x.children[C+1],x.children[C+2])}}return new nn(t.sort(un),a)}function an(e,t){if(!t||!e.length)return e;for(var n=[],r=0;r<e.length;r++){var o=e[r];n.push(new Zt(o.from+t,o.to+t,o.type))}return n}function ln(e,t,n){if(t.isLeaf)return null;for(var r,o=n+t.nodeSize,i=null,s=0;s<e.length;s++)(r=e[s])&&r.from>n&&r.to<o&&((i||(i=[])).push(r),e[s]=null);return i}function cn(e){for(var t=[],n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function dn(e,t,n,r){var o=[],i=!1;t.forEach(function(t,s){var a=ln(e,t,s+n);if(a){i=!0;var l=dn(a,t,n+s+1,r);l!=rn&&o.push(s,s+t.nodeSize,l)}});for(var s=an(i?cn(e):e,-n).sort(un),a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||o.length?new nn(s,o):rn}function un(e,t){return e.from-t.from||e.to-t.to}function hn(e){for(var t=e,n=0;n<t.length-1;n++){var r=t[n];if(r.from!=r.to)for(var o=n+1;o<t.length;o++){var i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),pn(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),pn(t,o+1,i.copy(r.to,i.to)))}}return t}function pn(e,t,n){for(;t<e.length&&un(n,e[t])>0;)t++;e.splice(t,0,n)}function fn(e){var t=[];return e.someProp("decorations",function(n){var r=n(e.state);r&&r!=rn&&t.push(r)}),e.cursorWrapper&&t.push(nn.create(e.state.doc,[e.cursorWrapper.deco])),on.from(t)}var mn={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},gn=F&&H<=11,vn=function(){function e(){f(this,e),this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}return g(e,[{key:"set",value:function(e){this.anchorNode=e.anchorNode,this.anchorOffset=e.anchorOffset,this.focusNode=e.focusNode,this.focusOffset=e.focusOffset}},{key:"clear",value:function(){this.anchorNode=this.focusNode=null}},{key:"eq",value:function(e){return e.anchorNode==this.anchorNode&&e.anchorOffset==this.anchorOffset&&e.focusNode==this.focusNode&&e.focusOffset==this.focusOffset}}]),e}(),yn=function(){function e(t,n){var r=this;f(this,e),this.view=t,this.handleDOMChange=n,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new vn,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.lastChangedTextNode=null,this.observer=window.MutationObserver&&new window.MutationObserver(function(e){for(var n=0;n<e.length;n++)r.queue.push(e[n]);F&&H<=11&&e.some(function(e){return"childList"==e.type&&e.removedNodes.length||"characterData"==e.type&&e.oldValue.length>e.target.nodeValue.length})?r.flushSoon():W&&t.composing&&e.some(function(e){return"childList"==e.type&&"TR"==e.target.nodeName})?(t.input.badSafariComposition=!0,r.flushSoon()):r.flush()}),gn&&(this.onCharData=function(e){r.queue.push({target:e.target,type:"characterData",oldValue:e.prevValue}),r.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}return g(e,[{key:"flushSoon",value:function(){var e=this;this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(function(){e.flushingSoon=-1,e.flush()},20))}},{key:"forceFlush",value:function(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}},{key:"start",value:function(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,mn)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}},{key:"stop",value:function(){var e=this;if(this.observer){var t=this.observer.takeRecords();if(t.length){for(var n=0;n<t.length;n++)this.queue.push(t[n]);window.setTimeout(function(){return e.flush()},20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}},{key:"connectSelection",value:function(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}},{key:"disconnectSelection",value:function(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}},{key:"suppressSelectionUpdates",value:function(){var e=this;this.suppressingSelectionUpdates=!0,setTimeout(function(){return e.suppressingSelectionUpdates=!1},50)}},{key:"onSelectionChange",value:function(){if(Xe(this.view)){if(this.suppressingSelectionUpdates)return _e(this.view);if(F&&H<=11&&!this.view.state.selection.empty){var e=this.view.domSelectionRange();if(e.focusNode&&M(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset))return this.flushSoon()}this.flush()}}},{key:"setCurSelection",value:function(){this.currentSelection.set(this.view.domSelectionRange())}},{key:"ignoreSelectionChange",value:function(e){if(!e.focusNode)return!0;for(var t,n=new Set,r=e.focusNode;r;r=x(r))n.add(r);for(var o=e.anchorNode;o;o=x(o))if(n.has(o)){t=o;break}var i=t&&this.view.docView.nearestDesc(t);return i&&i.ignoreMutation({type:"selection",target:3==t.nodeType?t.parentNode:t})?(this.setCurSelection(),!0):void 0}},{key:"pendingRecords",value:function(){if(this.observer){var e,t=o(this.observer.takeRecords());try{for(t.s();!(e=t.n()).done;){var n=e.value;this.queue.push(n)}}catch(e){t.e(e)}finally{t.f()}}return this.queue}},{key:"flush",value:function(){var e=this.view;if(e.docView&&!(this.flushingSoon>-1)){var t=this.pendingRecords();t.length&&(this.queue=[]);var n=e.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(n)&&Xe(e)&&!this.ignoreSelectionChange(n),s=-1,a=-1,l=!1,c=[];if(e.editable)for(var d=0;d<t.length;d++){var u=this.registerMutation(t[d],c);u&&(s=s<0?u.from:Math.min(u.from,s),a=a<0?u.to:Math.max(u.to,a),u.typeOver&&(l=!0))}if(!c.some(function(e){return"BR"==e.nodeName})||8!=e.input.lastKeyCode&&46!=e.input.lastKeyCode){if(j&&c.length){var h=c.filter(function(e){return"BR"==e.nodeName});if(2==h.length){var p=r(h,2),f=p[0],m=p[1];f.parentNode&&f.parentNode.parentNode==m.parentNode?m.remove():f.remove()}else{var g,v=this.currentSelection.focusNode,b=o(h);try{for(b.s();!(g=b.n()).done;){var k=g.value,w=k.parentNode;!w||"LI"!=w.nodeName||v&&xn(e,v)==w||k.remove()}}catch(e){b.e(e)}finally{b.f()}}}}else{var x,S=o(c);try{for(S.s();!(x=S.n()).done;){var C=x.value;if("BR"==C.nodeName&&C.parentNode){var M=C.nextSibling;M&&1==M.nodeType&&"false"==M.contentEditable&&C.parentNode.removeChild(C)}}}catch(e){S.e(e)}finally{S.f()}}var T=null;s<0&&i&&e.input.lastFocus>Date.now()-200&&Math.max(e.input.lastTouch,e.input.lastClick.time)<Date.now()-300&&N(n)&&(T=je(e))&&T.eq(y.Selection.near(e.state.doc.resolve(0),1))?(e.input.lastFocus=0,_e(e),this.currentSelection.set(n),e.scrollToSelection()):(s>-1||i)&&(s>-1&&(e.docView.markDirty(s,a),function(e){if(!bn.has(e)&&(bn.set(e,null),-1!==["normal","nowrap","pre-line"].indexOf(getComputedStyle(e.dom).whiteSpace))){if(e.requiresGeckoHackNode=j,kn)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."),kn=!0}}(e)),e.input.badSafariComposition&&(e.input.badSafariComposition=!1,function(e,t){var n,r,i=e.domSelectionRange(),s=i.focusNode,a=i.focusOffset,l=o(t);try{for(l.s();!(r=l.n()).done;){var c=r.value;if("TR"==(null===(n=c.parentNode)||void 0===n?void 0:n.nodeName)){for(var d=c.nextSibling;d&&"TD"!=d.nodeName&&"TH"!=d.nodeName;)d=d.nextSibling;if(d){for(var u=d;;){var h=u.firstChild;if(!h||1!=h.nodeType||"false"==h.contentEditable||/^(BR|IMG)$/.test(h.nodeName))break;u=h}u.insertBefore(c,u.firstChild),s==c&&e.domSelection().collapse(c,a)}else c.parentNode.removeChild(c)}}}catch(e){l.e(e)}finally{l.f()}}(e,c)),this.handleDOMChange(s,a,l,c),e.docView&&e.docView.dirty?e.updateState(e.state):this.currentSelection.eq(n)||_e(e),this.currentSelection.set(n))}}},{key:"registerMutation",value:function(e,t){if(t.indexOf(e.target)>-1)return null;var n=this.view.docView.nearestDesc(e.target);if("attributes"==e.type&&(n==this.view.docView||"contenteditable"==e.attributeName||"style"==e.attributeName&&!e.oldValue&&!e.target.getAttribute("style")))return null;if(!n||n.ignoreMutation(e))return null;if("childList"==e.type){for(var r=0;r<e.addedNodes.length;r++){var o=e.addedNodes[r];t.push(o),3==o.nodeType&&(this.lastChangedTextNode=o)}if(n.contentDOM&&n.contentDOM!=n.dom&&!n.contentDOM.contains(e.target))return{from:n.posBefore,to:n.posAfter};var i=e.previousSibling,s=e.nextSibling;if(F&&H<=11&&e.addedNodes.length)for(var a=0;a<e.addedNodes.length;a++){var l=e.addedNodes[a],c=l.previousSibling,d=l.nextSibling;(!c||Array.prototype.indexOf.call(e.addedNodes,c)<0)&&(i=c),(!d||Array.prototype.indexOf.call(e.addedNodes,d)<0)&&(s=d)}var u=i&&i.parentNode==e.target?w(i)+1:0,h=n.localPosFromDOM(e.target,u,-1),p=s&&s.parentNode==e.target?w(s):e.target.childNodes.length;return{from:h,to:n.localPosFromDOM(e.target,p,1)}}return"attributes"==e.type?{from:n.posAtStart-n.border,to:n.posAtEnd+n.border}:(this.lastChangedTextNode=e.target,{from:n.posAtStart,to:n.posAtEnd,typeOver:e.target.nodeValue==e.oldValue})}}]),e}(),bn=new WeakMap,kn=!1;function wn(e,t){var n=t.startContainer,r=t.startOffset,o=t.endContainer,i=t.endOffset,s=e.domAtPos(e.state.selection.anchor);if(M(s.node,s.offset,o,i)){var a=[o,i,n,r];n=a[0],r=a[1],o=a[2],i=a[3]}return{anchorNode:n,anchorOffset:r,focusNode:o,focusOffset:i}}function xn(e,t){for(var n=t.parentNode;n&&n!=e.dom;n=n.parentNode){var r=e.docView.nearestDesc(n,!0);if(r&&r.node.isBlock)return n}return null}function Sn(e){var t=e.pmViewDesc;if(t)return t.parseRule();if("BR"==e.nodeName&&e.parentNode){if(W&&/^(ul|ol)$/i.test(e.parentNode.nodeName)){var n=document.createElement("div");return n.appendChild(document.createElement("li")),{skip:n}}if(e.parentNode.lastChild==e||W&&/^(tr|table)$/i.test(e.parentNode.nodeName))return{ignore:!0}}else if("IMG"==e.nodeName&&e.getAttribute("mark-placeholder"))return{ignore:!0};return null}var Cn=/^(a|abbr|acronym|b|bd[io]|big|br|button|cite|code|data(list)?|del|dfn|em|i|img|ins|kbd|label|map|mark|meter|output|q|ruby|s|samp|small|span|strong|su[bp]|time|u|tt|var)$/i;function Mn(e,t,n){return Math.max(n.anchor,n.head)>t.content.size?null:Ge(e,t.resolve(n.anchor),t.resolve(n.head))}function Tn(e,t,n){for(var r=e.depth,o=t?e.end():e.pos;r>0&&(t||e.indexAfter(r)==e.node(r).childCount);)r--,o++,t=!1;if(n)for(var i=e.node(r).maybeChild(e.indexAfter(r));i&&!i.isLeaf;)i=i.firstChild,o++;return o}function An(e){if(2!=e.length)return!1;var t=e.charCodeAt(0),n=e.charCodeAt(1);return t>=56320&&t<=57343&&n>=55296&&n<=56319}var On=ut,En=Bt,Nn=function(){function e(t,n){var r=this;f(this,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 Mt,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=n,this.state=n.state,this.directPlugins=n.plugins||[],this.directPlugins.forEach(In),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),Dn(this),this.nodeViews=$n(this),this.docView=Ce(this.state.doc,Rn(this),fn(this),this.dom,this),this.domObserver=new yn(this,function(e,t,n,o){return function(e,t,n,r,o){var i=e.input.compositionPendingChanges||(e.composing?e.input.compositionID:0);if(e.input.compositionPendingChanges=0,t<0){var s=e.input.lastSelectionTime>Date.now()-50?e.input.lastSelectionOrigin:null,a=je(e,s);if(a&&!e.state.selection.eq(a)){if(_&&U&&13===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime&&e.someProp("handleKeyDown",function(t){return t(e,R(13,"Enter"))}))return;var l=e.state.tr.setSelection(a);"pointer"==s?l.setMeta("pointer",!0):"key"==s&&l.scrollIntoView(),i&&l.setMeta("composition",i),e.dispatch(l)}}else{var c=e.state.doc.resolve(t),d=c.sharedDepth(n);t=c.before(d+1),n=e.state.doc.resolve(n).after(d+1);var u,h,p=e.state.selection,f=function(e,t,n){var r,o=e.docView.parseRange(t,n),i=o.node,s=o.fromOffset,a=o.toOffset,l=o.from,c=o.to,d=e.domSelectionRange(),u=d.anchorNode;if(u&&e.dom.contains(1==u.nodeType?u:u.parentNode)&&(r=[{node:u,offset:d.anchorOffset}],N(d)||r.push({node:d.focusNode,offset:d.focusOffset})),_&&8===e.input.lastKeyCode)for(var h=a;h>s;h--){var p=i.childNodes[h-1],f=p.pmViewDesc;if("BR"==p.nodeName&&!f){a=h;break}if(!f||f.size)break}var m=e.state.doc,g=e.someProp("domParser")||b.DOMParser.fromSchema(e.state.schema),v=m.resolve(l),y=null,k=g.parse(i,{topNode:v.parent,topMatch:v.parent.contentMatchAt(v.index()),topOpen:!0,from:s,to:a,preserveWhitespace:"pre"!=v.parent.type.whitespace||"full",findPositions:r,ruleFromNode:Sn,context:v});if(r&&null!=r[0].pos){var w=r[0].pos,x=r[1]&&r[1].pos;null==x&&(x=w),y={anchor:w+l,head:x+l}}return{doc:k,sel:y,from:l,to:c}}(e,t,n),m=e.state.doc,g=m.slice(f.from,f.to);8===e.input.lastKeyCode&&Date.now()-100<e.input.lastKeyCodeTime?(u=e.state.selection.to,h="end"):(u=e.state.selection.from,h="start"),e.input.lastKeyCode=null;var v=function(e,t,n,r,o){var i=e.findDiffStart(t,n);if(null==i)return null;var s=e.findDiffEnd(t,n+e.size,n+t.size),a=s.a,l=s.b;if("end"==o&&(r-=a+Math.max(0,i-Math.min(a,l))-i),a<i&&e.size<t.size){var c=r<=i&&r>=a?i-r:0;(i-=c)&&i<t.size&&An(t.textBetween(i-1,i+1))&&(i+=c?1:-1),l=i+(l-a),a=i}else if(l<i){var d=r<=i&&r>=l?i-r:0;(i-=d)&&i<e.size&&An(e.textBetween(i-1,i+1))&&(i+=d?1:-1),a=i+(a-l),l=i}return{start:i,endA:a,endB:l}}(g.content,f.doc.content,f.from,u,h);if(v&&e.input.domChangeCount++,(q&&e.input.lastIOSEnter>Date.now()-225||U)&&o.some(function(e){return 1==e.nodeType&&!Cn.test(e.nodeName)})&&(!v||v.endA>=v.endB)&&e.someProp("handleKeyDown",function(t){return t(e,R(13,"Enter"))}))e.input.lastIOSEnter=0;else{if(!v){if(!(r&&p instanceof y.TextSelection&&!p.empty&&p.$head.sameParent(p.$anchor))||e.composing||f.sel&&f.sel.anchor!=f.sel.head){if(f.sel){var k=Mn(e,e.state.doc,f.sel);if(k&&!k.eq(e.state.selection)){var w=e.state.tr.setSelection(k);i&&w.setMeta("composition",i),e.dispatch(w)}}return}v={start:p.from,endA:p.to,endB:p.to}}e.state.selection.from<e.state.selection.to&&v.start==v.endB&&e.state.selection instanceof y.TextSelection&&(v.start>e.state.selection.from&&v.start<=e.state.selection.from+2&&e.state.selection.from>=f.from?v.start=e.state.selection.from:v.endA<e.state.selection.to&&v.endA>=e.state.selection.to-2&&e.state.selection.to<=f.to&&(v.endB+=e.state.selection.to-v.endA,v.endA=e.state.selection.to)),F&&H<=11&&v.endB==v.start+1&&v.endA==v.start&&v.start>f.from&&" "==f.doc.textBetween(v.start-f.from-1,v.start-f.from+1)&&(v.start--,v.endA--,v.endB--);var x=f.doc.resolveNoCache(v.start-f.from),S=f.doc.resolveNoCache(v.endB-f.from),C=m.resolve(v.start),M=x.sameParent(S)&&x.parent.inlineContent&&C.end()>=v.endA;if((q&&e.input.lastIOSEnter>Date.now()-225&&(!M||o.some(function(e){return"DIV"==e.nodeName||"P"==e.nodeName}))||!M&&x.pos<f.doc.content.size&&(!x.sameParent(S)||!x.parent.inlineContent)&&x.pos<S.pos&&!/\S/.test(f.doc.textBetween(x.pos,S.pos,"","")))&&e.someProp("handleKeyDown",function(t){return t(e,R(13,"Enter"))}))e.input.lastIOSEnter=0;else if(e.state.selection.anchor>v.start&&function(e,t,n,r,o){if(n-t<=o.pos-r.pos||Tn(r,!0,!1)<o.pos)return!1;var i=e.resolve(t);if(!r.parent.isTextblock){var s=i.nodeAfter;return null!=s&&n==t+s.nodeSize}if(i.parentOffset<i.parent.content.size||!i.parent.isTextblock)return!1;var a=e.resolve(Tn(i,!0,!0));return!(!a.parent.isTextblock||a.pos>n||Tn(a,!0,!1)<n)&&r.parent.content.cut(r.parentOffset).eq(a.parent.content)}(m,v.start,v.endA,x,S)&&e.someProp("handleKeyDown",function(t){return t(e,R(8,"Backspace"))}))U&&_&&e.domObserver.suppressSelectionUpdates();else{_&&v.endB==v.start&&(e.input.lastChromeDelete=Date.now()),U&&!M&&x.start()!=S.start()&&0==S.parentOffset&&x.depth==S.depth&&f.sel&&f.sel.anchor==f.sel.head&&f.sel.head==v.endA&&(v.endB-=2,S=f.doc.resolveNoCache(v.endB-f.from),setTimeout(function(){e.someProp("handleKeyDown",function(t){return t(e,R(13,"Enter"))})},20));var T,A=v.start,O=v.endA,E=function(t){var n=t||e.state.tr.replace(A,O,f.doc.slice(v.start-f.from,v.endB-f.from));if(f.sel){var r=Mn(e,n.doc,f.sel);r&&!(_&&e.composing&&r.empty&&(v.start!=v.endB||e.input.lastChromeDelete<Date.now()-100)&&(r.head==A||r.head==n.mapping.map(O)-1)||F&&r.empty&&r.head==A)&&n.setSelection(r)}return i&&n.setMeta("composition",i),n.scrollIntoView()};if(M)if(x.pos==S.pos){F&&H<=11&&0==x.parentOffset&&(e.domObserver.suppressSelectionUpdates(),setTimeout(function(){return _e(e)},20));var D=E(e.state.tr.delete(A,O)),P=m.resolve(v.start).marksAcross(m.resolve(v.endA));P&&D.ensureMarks(P),e.dispatch(D)}else if(v.endA==v.endB&&(T=function(e,t){for(var n,r,o,i=e.firstChild.marks,s=t.firstChild.marks,a=i,l=s,c=0;c<s.length;c++)a=s[c].removeFromSet(a);for(var d=0;d<i.length;d++)l=i[d].removeFromSet(l);if(1==a.length&&0==l.length)r=a[0],n="add",o=function(e){return e.mark(r.addToSet(e.marks))};else{if(0!=a.length||1!=l.length)return null;r=l[0],n="remove",o=function(e){return e.mark(r.removeFromSet(e.marks))}}for(var u=[],h=0;h<t.childCount;h++)u.push(o(t.child(h)));if(b.Fragment.from(u).eq(e))return{mark:r,type:n}}(x.parent.content.cut(x.parentOffset,S.parentOffset),C.parent.content.cut(C.parentOffset,v.endA-C.start())))){var $=E(e.state.tr);"add"==T.type?$.addMark(A,O,T.mark):$.removeMark(A,O,T.mark),e.dispatch($)}else if(x.parent.child(x.index()).isText&&x.index()==S.index()-(S.textOffset?0:1)){var I=x.parent.textBetween(x.parentOffset,S.parentOffset),z=function(){return E(e.state.tr.insertText(I,A,O))};e.someProp("handleTextInput",function(t){return t(e,A,O,I,z)})||e.dispatch(z())}else e.dispatch(E());else e.dispatch(E())}}}}(r,e,t,n,o)}),this.domObserver.start(),function(e){var t=function(){var t=xt[n];e.dom.addEventListener(n,e.input.eventHandlers[n]=function(n){!function(e,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(var n=t.target;n!=e.dom;n=n.parentNode)if(!n||11==n.nodeType||n.pmViewDesc&&n.pmViewDesc.stopEvent(t))return!1;return!0}(e,n)||Ot(e,n)||!e.editable&&n.type in St||t(e,n)},Ct[n]?{passive:!0}:void 0)};for(var n in xt)t();W&&e.dom.addEventListener("input",function(){return null}),At(e)}(this),this.updatePluginViews()}return g(e,[{key:"composing",get:function(){return this.input.composing}},{key:"props",get:function(){if(this._props.state!=this.state){var e=this._props;for(var t in this._props={},e)this._props[t]=e[t];this._props.state=this.state}return this._props}},{key:"update",value:function(e){e.handleDOMEvents!=this._props.handleDOMEvents&&At(this);var t=this._props;this._props=e,e.plugins&&(e.plugins.forEach(In),this.directPlugins=e.plugins),this.updateStateInner(e.state,t)}},{key:"setProps",value:function(e){var t={};for(var n in this._props)t[n]=this._props[n];for(var r in t.state=this.state,e)t[r]=e[r];this.update(t)}},{key:"updateState",value:function(e){this.updateStateInner(e,this._props)}},{key:"updateStateInner",value:function(e,t){var n,r=this.state,o=!1,i=!1;e.storedMarks&&this.composing&&(jt(this),i=!0),this.state=e;var s=r.plugins!=e.plugins||this._props.plugins!=t.plugins;if(s||this._props.plugins!=t.plugins||this._props.nodeViews!=t.nodeViews){var a=$n(this);(function(e,t){var n=0,r=0;for(var o in e){if(e[o]!=t[o])return!0;n++}for(var i in t)r++;return n!=r})(a,this.nodeViews)&&(this.nodeViews=a,o=!0)}(s||t.handleDOMEvents!=this._props.handleDOMEvents)&&At(this),this.editable=Pn(this),Dn(this);var l=fn(this),c=Rn(this),d=r.plugins==e.plugins||r.doc.eq(e.doc)?e.scrollToSelection>r.scrollToSelection?"to selection":"preserve":"reset",u=o||!this.docView.matchesNode(e.doc,c,l);!u&&e.selection.eq(r.selection)||(i=!0);var h,p,f,m,g,v,y,b,k,x,S="preserve"==d&&i&&null==this.dom.style.overflowAnchor&&function(e){for(var t,n,r=e.dom.getBoundingClientRect(),o=Math.max(0,r.top),i=(r.left+r.right)/2,s=o+1;s<Math.min(innerHeight,r.bottom);s+=5){var a=e.root.elementFromPoint(i,s);if(a&&a!=e.dom&&e.dom.contains(a)){var l=a.getBoundingClientRect();if(l.top>=o-20){t=a,n=l.top;break}}}return{refDOM:t,refTop:n,stack:te(e.dom)}}(this);if(i){this.domObserver.stop();var C=u&&(F||_)&&!this.composing&&!r.selection.empty&&!e.selection.empty&&(m=r.selection,g=e.selection,v=Math.min(m.$anchor.sharedDepth(m.head),g.$anchor.sharedDepth(g.head)),m.$anchor.start(v)!=g.$anchor.start(v));if(u){var T=_?this.trackWrites=this.domSelectionRange().focusNode:null;this.composing&&(this.input.compositionNode=function(e){var t=e.domSelectionRange();if(!t.focusNode)return null;var n=function(e,t){for(;;){if(3==e.nodeType&&t)return e;if(1==e.nodeType&&t>0){if("false"==e.contentEditable)return null;t=O(e=e.childNodes[t-1])}else{if(!e.parentNode||E(e))return null;t=w(e),e=e.parentNode}}}(t.focusNode,t.focusOffset),r=function(e,t){for(;;){if(3==e.nodeType&&t<e.nodeValue.length)return e;if(1==e.nodeType&&t<e.childNodes.length){if("false"==e.contentEditable)return null;e=e.childNodes[t],t=0}else{if(!e.parentNode||E(e))return null;t=w(e)+1,e=e.parentNode}}}(t.focusNode,t.focusOffset);if(n&&r&&n!=r){var o=r.pmViewDesc,i=e.domObserver.lastChangedTextNode;if(n==i||r==i)return i;if(!o||!o.isText(r.nodeValue))return r;if(e.input.compositionNode==r){var s=n.pmViewDesc;if(s&&s.isText(n.nodeValue))return r}}return n||r}(this)),!o&&this.docView.update(e.doc,c,l,this)||(this.docView.updateOuterDeco(c),this.docView.destroy(),this.docView=Ce(e.doc,c,l,this.dom,this)),!T||this.trackWrites&&this.dom.contains(this.trackWrites)||(C=!0)}C||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&(h=this,p=h.docView.domFromPos(h.state.selection.anchor,0),f=h.domSelectionRange(),M(p.node,p.offset,f.anchorNode,f.anchorOffset)))?_e(this,C):(Je(this,e.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),(null===(n=this.dragging)||void 0===n?void 0:n.node)&&!r.doc.eq(e.doc)&&this.updateDraggedNode(this.dragging,r),"reset"==d?this.dom.scrollTop=0:"to selection"==d?this.scrollToSelection():S&&(b=(y=S).refDOM,k=y.refTop,ne(y.stack,0==(x=b?b.getBoundingClientRect().top:0)?0:x-k))}},{key:"scrollToSelection",value:function(){var e=this,t=this.domSelectionRange().focusNode;if(t&&this.dom.contains(1==t.nodeType?t:t.parentNode))if(this.someProp("handleScrollToSelection",function(t){return t(e)}));else if(this.state.selection instanceof y.NodeSelection){var n=this.docView.domAfterPos(this.state.selection.from);1==n.nodeType&&ee(this,n.getBoundingClientRect(),t)}else ee(this,this.coordsAtPos(this.state.selection.head,1),t)}},{key:"destroyPluginViews",value:function(){for(var e;e=this.pluginViews.pop();)e.destroy&&e.destroy()}},{key:"updatePluginViews",value:function(e){if(e&&e.plugins==this.state.plugins&&this.directPlugins==this.prevDirectPlugins)for(var t=0;t<this.pluginViews.length;t++){var n=this.pluginViews[t];n.update&&n.update(this,e)}else{this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(var r=0;r<this.directPlugins.length;r++){var o=this.directPlugins[r];o.spec.view&&this.pluginViews.push(o.spec.view(this))}for(var i=0;i<this.state.plugins.length;i++){var s=this.state.plugins[i];s.spec.view&&this.pluginViews.push(s.spec.view(this))}}}},{key:"updateDraggedNode",value:function(e,t){var n=e.node,r=-1;if(this.state.doc.nodeAt(n.from)==n.node)r=n.from;else{var o=n.from+(this.state.doc.content.size-t.doc.content.size);(o>0&&this.state.doc.nodeAt(o))==n.node&&(r=o)}this.dragging=new qt(e.slice,e.move,r<0?void 0:y.NodeSelection.create(this.state.doc,r))}},{key:"someProp",value:function(e,t){var n,r=this._props&&this._props[e];if(null!=r&&(n=t?t(r):r))return n;for(var o=0;o<this.directPlugins.length;o++){var i=this.directPlugins[o].props[e];if(null!=i&&(n=t?t(i):i))return n}var s=this.state.plugins;if(s)for(var a=0;a<s.length;a++){var l=s[a].props[e];if(null!=l&&(n=t?t(l):l))return n}}},{key:"hasFocus",value:function(){if(F){var e=this.root.activeElement;if(e==this.dom)return!0;if(!e||!this.dom.contains(e))return!1;for(;e&&this.dom!=e&&this.dom.contains(e);){if("false"==e.contentEditable)return!1;e=e.parentElement}return!0}return this.root.activeElement==this.dom}},{key:"focus",value:function(){this.domObserver.stop(),this.editable&&function(e){if(e.setActive)return e.setActive();if(re)return e.focus(re);var t=te(e);e.focus(null==re?{get preventScroll(){return re={preventScroll:!0},!0}}:void 0),re||(re=!1,ne(t,0))}(this.dom),_e(this),this.domObserver.start()}},{key:"root",get:function(){var e=this,t=this._root;if(null==t)for(var n,r=function(t){if(9==t.nodeType||11==t.nodeType&&t.host)return t.getSelection||(Object.getPrototypeOf(t).getSelection=function(){return t.ownerDocument.getSelection()}),{v:e._root=t}},o=this.dom.parentNode;o;o=o.parentNode)if(n=r(o))return n.v;return t||document}},{key:"updateRoot",value:function(){this._root=null}},{key:"posAtCoords",value:function(e){return ae(this,e)}},{key:"coordsAtPos",value:function(e){return ue(this,e,arguments.length>1&&void 0!==arguments[1]?arguments[1]:1)}},{key:"domAtPos",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0;return this.docView.domFromPos(e,t)}},{key:"nodeDOM",value:function(e){var t=this.docView.descAt(e);return t?t.nodeDOM:null}},{key:"posAtDOM",value:function(e,t){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:-1,r=this.docView.posFromDOM(e,t,n);if(null==r)throw new RangeError("DOM position not inside the editor");return r}},{key:"endOfTextblock",value:function(e,t){return function(e,t,n){return ge==t&&ve==n?ye:(ge=t,ve=n,ye="up"==n||"down"==n?function(e,t,n){var r=t.selection,o="up"==n?r.$from:r.$to;return fe(e,t,function(){for(var t=e.docView.domFromPos(o.pos,"up"==n?-1:1).node;;){var r=e.docView.nearestDesc(t,!0);if(!r)break;if(r.node.isBlock){t=r.contentDOM||r.dom;break}t=r.dom.parentNode}for(var i=ue(e,o.pos,1),s=t.firstChild;s;s=s.nextSibling){var a=void 0;if(1==s.nodeType)a=s.getClientRects();else{if(3!=s.nodeType)continue;a=C(s,0,s.nodeValue.length).getClientRects()}for(var l=0;l<a.length;l++){var c=a[l];if(c.bottom>c.top+1&&("up"==n?i.top-c.top>2*(c.bottom-i.top):c.bottom-i.bottom>2*(i.bottom-c.top)))return!1}}return!0})}(e,t,n):function(e,t,n){var r=t.selection.$head;if(!r.parent.isTextblock)return!1;var o=r.parentOffset,i=!o,s=o==r.parent.content.size,a=e.domSelection();return a?me.test(r.parent.textContent)&&a.modify?fe(e,t,function(){var t=e.domSelectionRange(),o=t.focusNode,i=t.focusOffset,s=t.anchorNode,l=t.anchorOffset,c=a.caretBidiLevel;a.modify("move",n,"character");var d=r.depth?e.docView.domAfterPos(r.before()):e.dom,u=e.domSelectionRange(),h=u.focusNode,p=u.focusOffset,f=h&&!d.contains(1==h.nodeType?h:h.parentNode)||o==h&&i==p;try{a.collapse(s,l),o&&(o!=s||i!=l)&&a.extend&&a.extend(o,i)}catch(e){}return null!=c&&(a.caretBidiLevel=c),f}):"left"==n||"backward"==n?i:s:r.pos==r.start()||r.pos==r.end()}(e,t,n))}(this,t||this.state,e)}},{key:"pasteHTML",value:function(e,t){return Vt(this,"",e,!1,t||new ClipboardEvent("paste"))}},{key:"pasteText",value:function(e,t){return Vt(this,e,null,!0,t||new ClipboardEvent("paste"))}},{key:"serializeForClipboard",value:function(e){return dt(this,e)}},{key:"destroy",value:function(){this.docView&&(function(e){for(var t in e.domObserver.stop(),e.input.eventHandlers)e.dom.removeEventListener(t,e.input.eventHandlers[t]);clearTimeout(e.input.composingTimeout),clearTimeout(e.input.lastIOSEnterFallbackTimeout)}(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],fn(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null,S=null)}},{key:"isDestroyed",get:function(){return null==this.docView}},{key:"dispatchEvent",value:function(e){return function(e,t){Ot(e,t)||!xt[t.type]||!e.editable&&t.type in St||xt[t.type](e,t)}(this,e)}},{key:"domSelectionRange",value:function(){var e=this.domSelection();return e?W&&11===this.root.nodeType&&function(e){for(var t=e.activeElement;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}(this.dom.ownerDocument)==this.dom&&function(e,t){if(t.getComposedRanges){var n=t.getComposedRanges(e.root)[0];if(n)return wn(e,n)}var r;function o(e){e.preventDefault(),e.stopImmediatePropagation(),r=e.getTargetRanges()[0]}return e.dom.addEventListener("beforeinput",o,!0),document.execCommand("indent"),e.dom.removeEventListener("beforeinput",o,!0),r?wn(e,r):null}(this,e)||e:{focusNode:null,focusOffset:0,anchorNode:null,anchorOffset:0}}},{key:"domSelection",value:function(){return this.root.getSelection()}}]),e}();function Rn(e){var t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(e.editable),e.someProp("attributes",function(n){if("function"==typeof n&&(n=n(e.state)),n)for(var r in n)"class"==r?t.class+=" "+n[r]:"style"==r?t.style=(t.style?t.style+";":"")+n[r]:t[r]||"contenteditable"==r||"nodeName"==r||(t[r]=String(n[r]))}),t.translate||(t.translate="no"),[Zt.node(0,e.state.doc.content.size,t)]}function Dn(e){if(e.markCursor){var t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),e.cursorWrapper={dom:t,deco:Zt.widget(e.state.selection.from,t,{raw:!0,marks:e.markCursor})}}else e.cursorWrapper=null}function Pn(e){return!e.someProp("editable",function(t){return!1===t(e.state)})}function $n(e){var t=Object.create(null);function n(e){for(var n in e)Object.prototype.hasOwnProperty.call(t,n)||(t[n]=e[n])}return e.someProp("nodeViews",n),e.someProp("markViews",n),t}function In(e){if(e.spec.state||e.spec.filterTransaction||e.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}Nn.prototype.dispatch=function(e){var t=this._props.dispatchTransaction;t?t.call(this,e):this.updateState(this.state.apply(e))},t.Decoration=Zt,t.DecorationSet=nn,t.EditorView=Nn,t.__endComposition=En,t.__parseFromClipboard=On},6237:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});for(var n={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:"'"},r={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},o="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),i="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),s=0;s<10;s++)n[48+s]=n[96+s]=String(s);for(s=1;s<=24;s++)n[s+111]="F"+s;for(s=65;s<=90;s++)n[s]=String.fromCharCode(s+32),r[s]=String.fromCharCode(s);for(var a in n)r.hasOwnProperty(a)||(r[a]=n[a]);t.base=n,t.keyName=function(e){var t=!(o&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||i&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?r:n)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t},t.shift=r}},o={};function i(e){var t=o[e];if(void 0!==t)return t.exports;var n=o[e]={id:e,exports:{}};return r[e].call(n.exports,n,n.exports,i),n.exports}i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,{a:t}),t},i.d=function(e,t){for(var n in t)i.o(t,n)&&!i.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},i.nc=void 0;var s={};return function(){"use strict";i.r(s),i.d(s,{configureBulletSymbols:function(){return Xh},default:function(){return dp},getBulletSymbolMap:function(){return Yh}});var e=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("div",{staticClass:"bpm-rich-text"},["table"==e.uiType?n("i",{staticClass:"el-icon-notebook-2",class:{active:e.curVal},on:{click:function(t){return t.stopPropagation(),e.openDialog.apply(null,arguments)}}}):n("div",{ref:"editorContainer",staticClass:"tiptap-editor-container",class:{"is-readonly":e.readonly,"is-fullscreen":e.isFullscreen}},[e.editor&&!e.readonly?n("toolbar",{attrs:{editor:e.editor,uploader:e.handleImageUpload,"is-fullscreen":e.isFullscreen,"is-html-mode":e.isHtmlMode},on:{"toggle-html-mode":e.handleHtmlToggle,"toggle-fullscreen":e.toggleFullscreen}}):e._e(),e._v(" "),n("editor-content",{directives:[{name:"show",rawName:"v-show",value:!e.isHtmlMode,expression:"!isHtmlMode"}],staticClass:"editor-content",attrs:{editor:e.editor}}),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.isHtmlMode,expression:"isHtmlMode"}],staticClass:"editor-content"},[n("textarea",{staticClass:"html-source-textarea",attrs:{spellcheck:"false"},domProps:{value:e.rawHtml},on:{input:e.onRawHtmlInput}})]),e._v(" "),e.editor?n("div",{staticClass:"editor-char-count"},[e._v(e._s(e.$z("字数","c.characters"))+":"+e._s(e.textLength))]):e._e()],1),e._v(" "),"table"==e.uiType?n("el-dialog",{attrs:{title:e.fieldConf.name,visible:e.dialogVisible,width:"50%","before-close":e.handleClose,"append-to-body":""},on:{"update:visible":function(t){e.dialogVisible=t},opened:e.initEditor,closed:e.destroyEditor}},[n("div",{ref:"editorContainerDialog",staticClass:"tiptap-editor-container",class:{"is-readonly":e.readonly,"is-fullscreen":e.isFullscreen}},[e.editor&&!e.readonly?n("toolbar",{attrs:{editor:e.editor,uploader:e.handleImageUpload,"is-fullscreen":e.isFullscreen,"is-html-mode":e.isHtmlMode},on:{"toggle-html-mode":e.handleHtmlToggle,"toggle-fullscreen":e.toggleFullscreen}}):e._e(),e._v(" "),n("editor-content",{directives:[{name:"show",rawName:"v-show",value:!e.isHtmlMode,expression:"!isHtmlMode"}],staticClass:"editor-content",attrs:{editor:e.editor}}),e._v(" "),n("div",{directives:[{name:"show",rawName:"v-show",value:e.isHtmlMode,expression:"isHtmlMode"}],staticClass:"editor-content"},[n("textarea",{staticClass:"html-source-textarea",attrs:{spellcheck:"false"},domProps:{value:e.rawHtml},on:{input:e.onRawHtmlInput}})]),e._v(" "),e.editor?n("div",{staticClass:"editor-char-count"},[e._v(e._s(e.$z("字数","c.characters"))+":"+e._s(e.textLength))]):e._e()],1)]):e._e()],1)};function t(e){this.content=e}e._withStripped=!0,t.prototype={constructor:t,find:function(e){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===e)return t;return-1},get:function(e){var t=this.find(e);return-1==t?void 0:this.content[t+1]},update:function(e,n,r){var o=r&&r!=e?this.remove(r):this,i=o.find(e),s=o.content.slice();return-1==i?s.push(r||e,n):(s[i+1]=n,r&&(s[i]=r)),new t(s)},remove:function(e){var n=this.find(e);if(-1==n)return this;var r=this.content.slice();return r.splice(n,2),new t(r)},addToStart:function(e,n){return new t([e,n].concat(this.remove(e).content))},addToEnd:function(e,n){var r=this.remove(e).content.slice();return r.push(e,n),new t(r)},addBefore:function(e,n,r){var o=this.remove(n),i=o.content.slice(),s=o.find(e);return i.splice(-1==s?i.length:s,0,n,r),new t(i)},forEach:function(e){for(var t=0;t<this.content.length;t+=2)e(this.content[t],this.content[t+1])},prepend:function(e){return(e=t.from(e)).size?new t(e.content.concat(this.subtract(e).content)):this},append:function(e){return(e=t.from(e)).size?new t(this.subtract(e).content.concat(e.content)):this},subtract:function(e){var n=this;e=t.from(e);for(var r=0;r<e.content.length;r+=2)n=n.remove(e.content[r]);return n},toObject:function(){var e={};return this.forEach(function(t,n){e[t]=n}),e},get size(){return this.content.length>>1}},t.from=function(e){if(e instanceof t)return e;var n=[];if(e)for(var r in e)n.push(r,e[r]);return new t(n)};var n=t;function r(e,t,n){for(let o=0;;o++){if(o==e.childCount||o==t.childCount)return e.childCount==t.childCount?null:n;let i=e.child(o),s=t.child(o);if(i!=s){if(!i.sameMarkup(s))return n;if(i.isText&&i.text!=s.text){for(let e=0;i.text[e]==s.text[e];e++)n++;return n}if(i.content.size||s.content.size){let e=r(i.content,s.content,n+1);if(null!=e)return e}n+=i.nodeSize}else n+=i.nodeSize}}function o(e,t,n,r){for(let i=e.childCount,s=t.childCount;;){if(0==i||0==s)return i==s?null:{a:n,b:r};let a=e.child(--i),l=t.child(--s),c=a.nodeSize;if(a!=l){if(!a.sameMarkup(l))return{a:n,b:r};if(a.isText&&a.text!=l.text){let e=0,t=Math.min(a.text.length,l.text.length);for(;e<t&&a.text[a.text.length-e-1]==l.text[l.text.length-e-1];)e++,n--,r--;return{a:n,b:r}}if(a.content.size||l.content.size){let e=o(a.content,l.content,n-1,r-1);if(e)return e}n-=c,r-=c}else n-=c,r-=c}}class a{constructor(e,t){if(this.content=e,this.size=t||0,null==t)for(let t=0;t<e.length;t++)this.size+=e[t].nodeSize}nodesBetween(e,t,n,r=0,o){for(let i=0,s=0;s<t;i++){let a=this.content[i],l=s+a.nodeSize;if(l>e&&!1!==n(a,r+s,o||null,i)&&a.content.size){let o=s+1;a.nodesBetween(Math.max(0,e-o),Math.min(a.content.size,t-o),n,r+o)}s=l}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,r){let o="",i=!0;return this.nodesBetween(e,t,(s,a)=>{let l=s.isText?s.text.slice(Math.max(e,a)-a,t-a):s.isLeaf?r?"function"==typeof r?r(s):r:s.type.spec.leafText?s.type.spec.leafText(s):"":"";s.isBlock&&(s.isLeaf&&l||s.isTextblock)&&n&&(i?i=!1:o+=n),o+=l},0),o}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,r=this.content.slice(),o=0;for(t.isText&&t.sameMarkup(n)&&(r[r.length-1]=t.withText(t.text+n.text),o=1);o<e.content.length;o++)r.push(e.content[o]);return new a(r,this.size+e.size)}cut(e,t=this.size){if(0==e&&t==this.size)return this;let n=[],r=0;if(t>e)for(let o=0,i=0;i<t;o++){let s=this.content[o],a=i+s.nodeSize;a>e&&((i<e||a>t)&&(s=s.isText?s.cut(Math.max(0,e-i),Math.min(s.text.length,t-i)):s.cut(Math.max(0,e-i-1),Math.min(s.content.size,t-i-1))),n.push(s),r+=s.nodeSize),i=a}return new a(n,r)}cutByIndex(e,t){return e==t?a.empty:0==e&&t==this.content.length?this:new a(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let r=this.content.slice(),o=this.size+t.nodeSize-n.nodeSize;return r[e]=t,new a(r,o)}addToStart(e){return new a([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new a(this.content.concat(e),this.size+e.nodeSize)}eq(e){if(this.content.length!=e.content.length)return!1;for(let t=0;t<this.content.length;t++)if(!this.content[t].eq(e.content[t]))return!1;return!0}get firstChild(){return this.content.length?this.content[0]:null}get lastChild(){return this.content.length?this.content[this.content.length-1]:null}get childCount(){return this.content.length}child(e){let t=this.content[e];if(!t)throw new RangeError("Index "+e+" out of range for "+this);return t}maybeChild(e){return this.content[e]||null}forEach(e){for(let t=0,n=0;t<this.content.length;t++){let r=this.content[t];e(r,n,t),n+=r.nodeSize}}findDiffStart(e,t=0){return r(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return o(this,e,t,n)}findIndex(e){if(0==e)return c(0,e);if(e==this.size)return c(this.content.length,e);if(e>this.size||e<0)throw new RangeError(`Position ${e} outside of fragment (${this})`);for(let t=0,n=0;;t++){let r=n+this.child(t).nodeSize;if(r>=e)return r==e?c(t+1,r):c(t,n);n=r}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(e=>e.toJSON()):null}static fromJSON(e,t){if(!t)return a.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return new a(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return a.empty;let t,n=0;for(let r=0;r<e.length;r++){let o=e[r];n+=o.nodeSize,r&&o.isText&&e[r-1].sameMarkup(o)?(t||(t=e.slice(0,r)),t[t.length-1]=o.withText(t[t.length-1].text+o.text)):t&&t.push(o)}return new a(t||e,n)}static from(e){if(!e)return a.empty;if(e instanceof a)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new a([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}a.empty=new a([],0);const l={index:0,offset:0};function c(e,t){return l.index=e,l.offset=t,l}function d(e,t){if(e===t)return!0;if(!e||"object"!=typeof e||!t||"object"!=typeof t)return!1;let n=Array.isArray(e);if(Array.isArray(t)!=n)return!1;if(n){if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!d(e[n],t[n]))return!1}else{for(let n in e)if(!(n in t)||!d(e[n],t[n]))return!1;for(let n in t)if(!(n in e))return!1}return!0}class u{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let r=0;r<e.length;r++){let o=e[r];if(this.eq(o))return e;if(this.type.excludes(o.type))t||(t=e.slice(0,r));else{if(o.type.excludes(this.type))return e;!n&&o.type.rank>this.type.rank&&(t||(t=e.slice(0,r)),t.push(this),n=!0),t&&t.push(o)}}return t||(t=e.slice()),n||t.push(this),t}removeFromSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return e.slice(0,t).concat(e.slice(t+1));return e}isInSet(e){for(let t=0;t<e.length;t++)if(this.eq(e[t]))return!0;return!1}eq(e){return this==e||this.type==e.type&&d(this.attrs,e.attrs)}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Mark.fromJSON");let n=e.marks[t.type];if(!n)throw new RangeError(`There is no mark type ${t.type} in this schema`);let r=n.create(t.attrs);return n.checkAttrs(r.attrs),r}static sameSet(e,t){if(e==t)return!0;if(e.length!=t.length)return!1;for(let n=0;n<e.length;n++)if(!e[n].eq(t[n]))return!1;return!0}static setFrom(e){if(!e||Array.isArray(e)&&0==e.length)return u.none;if(e instanceof u)return[e];let t=e.slice();return t.sort((e,t)=>e.type.rank-t.type.rank),t}}u.none=[];class h extends Error{}class p{constructor(e,t,n){this.content=e,this.openStart=t,this.openEnd=n}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(e,t){let n=m(this.content,e+this.openStart,t);return n&&new p(n,this.openStart,this.openEnd)}removeBetween(e,t){return new p(f(this.content,e+this.openStart,t+this.openStart),this.openStart,this.openEnd)}eq(e){return this.content.eq(e.content)&&this.openStart==e.openStart&&this.openEnd==e.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let e={content:this.content.toJSON()};return this.openStart>0&&(e.openStart=this.openStart),this.openEnd>0&&(e.openEnd=this.openEnd),e}static fromJSON(e,t){if(!t)return p.empty;let n=t.openStart||0,r=t.openEnd||0;if("number"!=typeof n||"number"!=typeof r)throw new RangeError("Invalid input for Slice.fromJSON");return new p(a.fromJSON(e,t.content),n,r)}static maxOpen(e,t=!0){let n=0,r=0;for(let r=e.firstChild;r&&!r.isLeaf&&(t||!r.type.spec.isolating);r=r.firstChild)n++;for(let n=e.lastChild;n&&!n.isLeaf&&(t||!n.type.spec.isolating);n=n.lastChild)r++;return new p(e,n,r)}}function f(e,t,n){let{index:r,offset:o}=e.findIndex(t),i=e.maybeChild(r),{index:s,offset:a}=e.findIndex(n);if(o==t||i.isText){if(a!=n&&!e.child(s).isText)throw new RangeError("Removing non-flat range");return e.cut(0,t).append(e.cut(n))}if(r!=s)throw new RangeError("Removing non-flat range");return e.replaceChild(r,i.copy(f(i.content,t-o-1,n-o-1)))}function m(e,t,n,r){let{index:o,offset:i}=e.findIndex(t),s=e.maybeChild(o);if(i==t||s.isText)return r&&!r.canReplace(o,o,n)?null:e.cut(0,t).append(n).append(e.cut(t));let a=m(s.content,t-i-1,n,s);return a&&e.replaceChild(o,s.copy(a))}function g(e,t,n){if(n.openStart>e.depth)throw new h("Inserted content deeper than insertion position");if(e.depth-n.openStart!=t.depth-n.openEnd)throw new h("Inconsistent open depths");return v(e,t,n,0)}function v(e,t,n,r){let o=e.index(r),i=e.node(r);if(o==t.index(r)&&r<e.depth-n.openStart){let s=v(e,t,n,r+1);return i.copy(i.content.replaceChild(o,s))}if(n.content.size){if(n.openStart||n.openEnd||e.depth!=r||t.depth!=r){let{start:o,end:s}=function(e,t){let n=t.depth-e.openStart,r=t.node(n).copy(e.content);for(let e=n-1;e>=0;e--)r=t.node(e).copy(a.from(r));return{start:r.resolveNoCache(e.openStart+n),end:r.resolveNoCache(r.content.size-e.openEnd-n)}}(n,e);return x(i,S(e,o,s,t,r))}{let r=e.parent,o=r.content;return x(r,o.cut(0,e.parentOffset).append(n.content).append(o.cut(t.parentOffset)))}}return x(i,C(e,t,r))}function y(e,t){if(!t.type.compatibleContent(e.type))throw new h("Cannot join "+t.type.name+" onto "+e.type.name)}function b(e,t,n){let r=e.node(n);return y(r,t.node(n)),r}function k(e,t){let n=t.length-1;n>=0&&e.isText&&e.sameMarkup(t[n])?t[n]=e.withText(t[n].text+e.text):t.push(e)}function w(e,t,n,r){let o=(t||e).node(n),i=0,s=t?t.index(n):o.childCount;e&&(i=e.index(n),e.depth>n?i++:e.textOffset&&(k(e.nodeAfter,r),i++));for(let e=i;e<s;e++)k(o.child(e),r);t&&t.depth==n&&t.textOffset&&k(t.nodeBefore,r)}function x(e,t){return e.type.checkContent(t),e.copy(t)}function S(e,t,n,r,o){let i=e.depth>o&&b(e,t,o+1),s=r.depth>o&&b(n,r,o+1),l=[];return w(null,e,o,l),i&&s&&t.index(o)==n.index(o)?(y(i,s),k(x(i,S(e,t,n,r,o+1)),l)):(i&&k(x(i,C(e,t,o+1)),l),w(t,n,o,l),s&&k(x(s,C(n,r,o+1)),l)),w(r,null,o,l),new a(l)}function C(e,t,n){let r=[];return w(null,e,n,r),e.depth>n&&k(x(b(e,t,n+1),C(e,t,n+1)),r),w(t,null,n,r),new a(r)}p.empty=new p(a.empty,0,0);class M{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return null==e?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[3*this.resolveDepth(e)]}index(e){return this.path[3*this.resolveDepth(e)+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e!=this.depth||this.textOffset?1:0)}start(e){return 0==(e=this.resolveDepth(e))?0:this.path[3*e-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]}after(e){if(!(e=this.resolveDepth(e)))throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[3*e-1]+this.path[3*e].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],r=e.child(t);return n?e.child(t).cut(n):r}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):0==e?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[3*t],r=0==t?0:this.path[3*t-1]+1;for(let t=0;t<e;t++)r+=n.child(t).nodeSize;return r}marks(){let e=this.parent,t=this.index();if(0==e.content.size)return u.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),r=e.maybeChild(t);if(!n){let e=n;n=r,r=e}let o=n.marks;for(var i=0;i<o.length;i++)!1!==o[i].type.spec.inclusive||r&&o[i].isInSet(r.marks)||(o=o[i--].removeFromSet(o));return o}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,r=e.parent.maybeChild(e.index());for(var o=0;o<n.length;o++)!1!==n[o].type.spec.inclusive||r&&n[o].isInSet(r.marks)||(n=n[o--].removeFromSet(n));return n}sharedDepth(e){for(let t=this.depth;t>0;t--)if(this.start(t)<=e&&this.end(t)>=e)return t;return 0}blockRange(e=this,t){if(e.pos<this.pos)return e.blockRange(this);for(let n=this.depth-(this.parent.inlineContent||this.pos==e.pos?1:0);n>=0;n--)if(e.pos<=this.end(n)&&(!t||t(this.node(n))))return new E(this,e,n);return null}sameParent(e){return this.pos-this.parentOffset==e.pos-e.parentOffset}max(e){return e.pos>this.pos?e:this}min(e){return e.pos<this.pos?e:this}toString(){let e="";for(let t=1;t<=this.depth;t++)e+=(e?"/":"")+this.node(t).type.name+"_"+this.index(t-1);return e+":"+this.parentOffset}static resolve(e,t){if(!(t>=0&&t<=e.content.size))throw new RangeError("Position "+t+" out of range");let n=[],r=0,o=t;for(let t=e;;){let{index:e,offset:i}=t.content.findIndex(o),s=o-i;if(n.push(t,e,r+i),!s)break;if(t=t.child(e),t.isText)break;o=s-1,r+=i+1}return new M(t,n,o)}static resolveCached(e,t){let n=O.get(e);if(n)for(let e=0;e<n.elts.length;e++){let r=n.elts[e];if(r.pos==t)return r}else O.set(e,n=new T);let r=n.elts[n.i]=M.resolve(e,t);return n.i=(n.i+1)%A,r}}class T{constructor(){this.elts=[],this.i=0}}const A=12,O=new WeakMap;class E{constructor(e,t,n){this.$from=e,this.$to=t,this.depth=n}get start(){return this.$from.before(this.depth+1)}get end(){return this.$to.after(this.depth+1)}get parent(){return this.$from.node(this.depth)}get startIndex(){return this.$from.index(this.depth)}get endIndex(){return this.$to.indexAfter(this.depth)}}const N=Object.create(null);class R{constructor(e,t,n,r=u.none){this.type=e,this.attrs=t,this.marks=r,this.content=n||a.empty}get children(){return this.content.content}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(e){return this.content.child(e)}maybeChild(e){return this.content.maybeChild(e)}forEach(e){this.content.forEach(e)}nodesBetween(e,t,n,r=0){this.content.nodesBetween(e,t,n,r,this)}descendants(e){this.nodesBetween(0,this.content.size,e)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(e,t,n,r){return this.content.textBetween(e,t,n,r)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(e){return this==e||this.sameMarkup(e)&&this.content.eq(e.content)}sameMarkup(e){return this.hasMarkup(e.type,e.attrs,e.marks)}hasMarkup(e,t,n){return this.type==e&&d(this.attrs,t||e.defaultAttrs||N)&&u.sameSet(this.marks,n||u.none)}copy(e=null){return e==this.content?this:new R(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new R(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return 0==e&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return p.empty;let r=this.resolve(e),o=this.resolve(t),i=n?0:r.sharedDepth(t),s=r.start(i),a=r.node(i).content.cut(r.pos-s,o.pos-s);return new p(a,r.depth-i,o.depth-i)}replace(e,t,n){return g(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:r}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(r==e||t.isText)return t;e-=r+1}}childAfter(e){let{index:t,offset:n}=this.content.findIndex(e);return{node:this.content.maybeChild(t),index:t,offset:n}}childBefore(e){if(0==e)return{node:null,index:0,offset:0};let{index:t,offset:n}=this.content.findIndex(e);if(n<e)return{node:this.content.child(t),index:t,offset:n};let r=this.content.child(t-1);return{node:r,index:t-1,offset:n-r.nodeSize}}resolve(e){return M.resolveCached(this,e)}resolveNoCache(e){return M.resolve(this,e)}rangeHasMark(e,t,n){let r=!1;return t>e&&this.nodesBetween(e,t,e=>(n.isInSet(e.marks)&&(r=!0),!r)),r}get isBlock(){return this.type.isBlock}get isTextblock(){return this.type.isTextblock}get inlineContent(){return this.type.inlineContent}get isInline(){return this.type.isInline}get isText(){return this.type.isText}get isLeaf(){return this.type.isLeaf}get isAtom(){return this.type.isAtom}toString(){if(this.type.spec.toDebugString)return this.type.spec.toDebugString(this);let e=this.type.name;return this.content.size&&(e+="("+this.content.toStringInner()+")"),P(this.marks,e)}contentMatchAt(e){let t=this.type.contentMatch.matchFragment(this.content,0,e);if(!t)throw new Error("Called contentMatchAt on a node with invalid content");return t}canReplace(e,t,n=a.empty,r=0,o=n.childCount){let i=this.contentMatchAt(e).matchFragment(n,r,o),s=i&&i.matchFragment(this.content,t);if(!s||!s.validEnd)return!1;for(let e=r;e<o;e++)if(!this.type.allowsMarks(n.child(e).marks))return!1;return!0}canReplaceWith(e,t,n,r){if(r&&!this.type.allowsMarks(r))return!1;let o=this.contentMatchAt(e).matchType(n),i=o&&o.matchFragment(this.content,t);return!!i&&i.validEnd}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=u.none;for(let t=0;t<this.marks.length;t++){let n=this.marks[t];n.type.checkAttrs(n.attrs),e=n.addToSet(e)}if(!u.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(e=>e.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let n;if(t.marks){if(!Array.isArray(t.marks))throw new RangeError("Invalid mark data for Node.fromJSON");n=t.marks.map(e.markFromJSON)}if("text"==t.type){if("string"!=typeof t.text)throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let r=a.fromJSON(e,t.content),o=e.nodeType(t.type).create(t.attrs,r,n);return o.type.checkAttrs(o.attrs),o}}R.prototype.text=void 0;class D extends R{constructor(e,t,n,r){if(super(e,t,null,r),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):P(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(e,t){return this.text.slice(e,t)}get nodeSize(){return this.text.length}mark(e){return e==this.marks?this:new D(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new D(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return 0==e&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function P(e,t){for(let n=e.length-1;n>=0;n--)t=e[n].type.name+"("+t+")";return t}class ${constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new I(e,t);if(null==n.next)return $.empty;let r=z(n);n.next&&n.err("Unexpected trailing text");let o=function(e){let t=Object.create(null);return function n(r){let o=[];r.forEach(t=>{e[t].forEach(({term:t,to:n})=>{if(!t)return;let r;for(let e=0;e<o.length;e++)o[e][0]==t&&(r=o[e][1]);_(e,n).forEach(e=>{r||o.push([t,r=[]]),-1==r.indexOf(e)&&r.push(e)})})});let i=t[r.join(",")]=new $(r.indexOf(e.length-1)>-1);for(let e=0;e<o.length;e++){let r=o[e][1].sort(B);i.next.push({type:o[e][0],next:t[r.join(",")]||n(r)})}return i}(_(e,0))}(function(e){let t=[[]];return o(function e(t,i){if("choice"==t.type)return t.exprs.reduce((t,n)=>t.concat(e(n,i)),[]);if("seq"!=t.type){if("star"==t.type){let s=n();return r(i,s),o(e(t.expr,s),s),[r(s)]}if("plus"==t.type){let s=n();return o(e(t.expr,i),s),o(e(t.expr,s),s),[r(s)]}if("opt"==t.type)return[r(i)].concat(e(t.expr,i));if("range"==t.type){let s=i;for(let r=0;r<t.min;r++){let r=n();o(e(t.expr,s),r),s=r}if(-1==t.max)o(e(t.expr,s),s);else for(let i=t.min;i<t.max;i++){let i=n();r(s,i),o(e(t.expr,s),i),s=i}return[r(s)]}if("name"==t.type)return[r(i,void 0,t.value)];throw new Error("Unknown expr type")}for(let r=0;;r++){let s=e(t.exprs[r],i);if(r==t.exprs.length-1)return s;o(s,i=n())}}(e,0),n()),t;function n(){return t.push([])-1}function r(e,n,r){let o={term:r,to:n};return t[e].push(o),o}function o(e,t){e.forEach(e=>e.to=t)}}(r));return function(e,t){for(let n=0,r=[e];n<r.length;n++){let e=r[n],o=!e.validEnd,i=[];for(let t=0;t<e.next.length;t++){let{type:n,next:s}=e.next[t];i.push(n.name),!o||n.isText||n.hasRequiredAttrs()||(o=!1),-1==r.indexOf(s)&&r.push(s)}o&&t.err("Only non-generatable nodes ("+i.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}(o,n),o}matchType(e){for(let t=0;t<this.next.length;t++)if(this.next[t].type==e)return this.next[t].next;return null}matchFragment(e,t=0,n=e.childCount){let r=this;for(let o=t;r&&o<n;o++)r=r.matchType(e.child(o).type);return r}get inlineContent(){return 0!=this.next.length&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!t.isText&&!t.hasRequiredAttrs())return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let n=0;n<e.next.length;n++)if(this.next[t].type==e.next[n].type)return!0;return!1}fillBefore(e,t=!1,n=0){let r=[this];return function o(i,s){let l=i.matchFragment(e,n);if(l&&(!t||l.validEnd))return a.from(s.map(e=>e.createAndFill()));for(let e=0;e<i.next.length;e++){let{type:t,next:n}=i.next[e];if(!t.isText&&!t.hasRequiredAttrs()&&-1==r.indexOf(n)){r.push(n);let e=o(n,s.concat(t));if(e)return e}}return null}(this,[])}findWrapping(e){for(let t=0;t<this.wrapCache.length;t+=2)if(this.wrapCache[t]==e)return this.wrapCache[t+1];let t=this.computeWrapping(e);return this.wrapCache.push(e,t),t}computeWrapping(e){let t=Object.create(null),n=[{match:this,type:null,via:null}];for(;n.length;){let r=n.shift(),o=r.match;if(o.matchType(e)){let e=[];for(let t=r;t.type;t=t.via)e.push(t.type);return e.reverse()}for(let e=0;e<o.next.length;e++){let{type:i,next:s}=o.next[e];i.isLeaf||i.hasRequiredAttrs()||i.name in t||r.type&&!s.validEnd||(n.push({match:i.contentMatch,type:i,via:r}),t[i.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];return function t(n){e.push(n);for(let r=0;r<n.next.length;r++)-1==e.indexOf(n.next[r].next)&&t(n.next[r].next)}(this),e.map((t,n)=>{let r=n+(t.validEnd?"*":" ")+" ";for(let n=0;n<t.next.length;n++)r+=(n?", ":"")+t.next[n].type.name+"->"+e.indexOf(t.next[n].next);return r}).join("\n")}}$.empty=new $(!0);class I{constructor(e,t){this.string=e,this.nodeTypes=t,this.inline=null,this.pos=0,this.tokens=e.split(/\s*(?=\b|\W|$)/),""==this.tokens[this.tokens.length-1]&&this.tokens.pop(),""==this.tokens[0]&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(e){return this.next==e&&(this.pos++||!0)}err(e){throw new SyntaxError(e+" (in content expression '"+this.string+"')")}}function z(e){let t=[];do{t.push(L(e))}while(e.eat("|"));return 1==t.length?t[0]:{type:"choice",exprs:t}}function L(e){let t=[];do{t.push(F(e))}while(e.next&&")"!=e.next&&"|"!=e.next);return 1==t.length?t[0]:{type:"seq",exprs:t}}function F(e){let t=function(e){if(e.eat("(")){let t=z(e);return e.eat(")")||e.err("Missing closing paren"),t}if(!/\W/.test(e.next)){let t=function(e,t){let n=e.nodeTypes,r=n[t];if(r)return[r];let o=[];for(let e in n){let r=n[e];r.isInGroup(t)&&o.push(r)}return 0==o.length&&e.err("No node type or group '"+t+"' found"),o}(e,e.next).map(t=>(null==e.inline?e.inline=t.isInline:e.inline!=t.isInline&&e.err("Mixing inline and block content"),{type:"name",value:t}));return e.pos++,1==t.length?t[0]:{type:"choice",exprs:t}}e.err("Unexpected token '"+e.next+"'")}(e);for(;;)if(e.eat("+"))t={type:"plus",expr:t};else if(e.eat("*"))t={type:"star",expr:t};else if(e.eat("?"))t={type:"opt",expr:t};else{if(!e.eat("{"))break;t=j(e,t)}return t}function H(e){/\D/.test(e.next)&&e.err("Expected number, got '"+e.next+"'");let t=Number(e.next);return e.pos++,t}function j(e,t){let n=H(e),r=n;return e.eat(",")&&(r="}"!=e.next?H(e):-1),e.eat("}")||e.err("Unclosed braced range"),{type:"range",min:n,max:r,expr:t}}function B(e,t){return t-e}function _(e,t){let n=[];return function t(r){let o=e[r];if(1==o.length&&!o[0].term)return t(o[0].to);n.push(r);for(let e=0;e<o.length;e++){let{term:r,to:i}=o[e];r||-1!=n.indexOf(i)||t(i)}}(t),n.sort(B)}function V(e){let t=Object.create(null);for(let n in e){let r=e[n];if(!r.hasDefault)return null;t[n]=r.default}return t}function W(e,t){let n=Object.create(null);for(let r in e){let o=t&&t[r];if(void 0===o){let t=e[r];if(!t.hasDefault)throw new RangeError("No value supplied for attribute "+r);o=t.default}n[r]=o}return n}function q(e,t,n,r){for(let r in t)if(!(r in e))throw new RangeError(`Unsupported attribute ${r} for ${n} of type ${r}`);for(let n in e){let r=e[n];r.validate&&r.validate(t[n])}}function K(e,t){let n=Object.create(null);if(t)for(let r in t)n[r]=new U(e,r,t[r]);return n}class J{constructor(e,t,n){this.name=e,this.schema=t,this.spec=n,this.markSet=null,this.groups=n.group?n.group.split(" "):[],this.attrs=K(e,n.attrs),this.defaultAttrs=V(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||"text"==e),this.isText="text"==e}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==$.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(e){return this.groups.indexOf(e)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let e in this.attrs)if(this.attrs[e].isRequired)return!0;return!1}compatibleContent(e){return this==e||this.contentMatch.compatible(e.contentMatch)}computeAttrs(e){return!e&&this.defaultAttrs?this.defaultAttrs:W(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new R(this,this.computeAttrs(e),a.from(t),u.setFrom(n))}createChecked(e=null,t,n){return t=a.from(t),this.checkContent(t),new R(this,this.computeAttrs(e),t,u.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),(t=a.from(t)).size){let e=this.contentMatch.fillBefore(t);if(!e)return null;t=e.append(t)}let r=this.contentMatch.matchFragment(t),o=r&&r.fillBefore(a.empty,!0);return o?new R(this,e,t.append(o),u.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let t=0;t<e.childCount;t++)if(!this.allowsMarks(e.child(t).marks))return!1;return!0}checkContent(e){if(!this.validContent(e))throw new RangeError(`Invalid content for node ${this.name}: ${e.toString().slice(0,50)}`)}checkAttrs(e){q(this.attrs,e,"node",this.name)}allowsMarkType(e){return null==this.markSet||this.markSet.indexOf(e)>-1}allowsMarks(e){if(null==this.markSet)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(null==this.markSet)return e;let t;for(let n=0;n<e.length;n++)this.allowsMarkType(e[n].type)?t&&t.push(e[n]):t||(t=e.slice(0,n));return t?t.length?t:u.none:e}static compile(e,t){let n=Object.create(null);e.forEach((e,r)=>n[e]=new J(e,t,r));let r=t.spec.topNode||"doc";if(!n[r])throw new RangeError("Schema is missing its top node type ('"+r+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let e in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}class U{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate="string"==typeof n.validate?function(e,t,n){let r=n.split("|");return n=>{let o=null===n?"null":typeof n;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${e}, got ${o}`)}}(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class G{constructor(e,t,n,r){this.name=e,this.rank=t,this.schema=n,this.spec=r,this.attrs=K(e,r.attrs),this.excluded=null;let o=V(this.attrs);this.instance=o?new u(this,o):null}create(e=null){return!e&&this.instance?this.instance:new u(this,W(this.attrs,e))}static compile(e,t){let n=Object.create(null),r=0;return e.forEach((e,o)=>n[e]=new G(e,r++,t,o)),n}removeFromSet(e){for(var t=0;t<e.length;t++)e[t].type==this&&(e=e.slice(0,t).concat(e.slice(t+1)),t--);return e}isInSet(e){for(let t=0;t<e.length;t++)if(e[t].type==this)return e[t]}checkAttrs(e){q(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class X{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let n in e)t[n]=e[n];t.nodes=n.from(e.nodes),t.marks=n.from(e.marks||{}),this.nodes=J.compile(this.spec.nodes,this),this.marks=G.compile(this.spec.marks,this);let r=Object.create(null);for(let e in this.nodes){if(e in this.marks)throw new RangeError(e+" can not be both a node and a mark");let t=this.nodes[e],n=t.spec.content||"",o=t.spec.marks;if(t.contentMatch=r[n]||(r[n]=$.parse(n,this.nodes)),t.inlineContent=t.contentMatch.inlineContent,t.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!t.isInline||!t.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=t}t.markSet="_"==o?null:o?Y(this,o.split(" ")):""!=o&&t.inlineContent?null:[]}for(let e in this.marks){let t=this.marks[e],n=t.spec.excludes;t.excluded=null==n?[t]:""==n?[]:Y(this,n.split(" "))}this.nodeFromJSON=e=>R.fromJSON(this,e),this.markFromJSON=e=>u.fromJSON(this,e),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,r){if("string"==typeof e)e=this.nodeType(e);else{if(!(e instanceof J))throw new RangeError("Invalid node type: "+e);if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}return e.createChecked(t,n,r)}text(e,t){let n=this.nodes.text;return new D(n,n.defaultAttrs,e,u.setFrom(t))}mark(e,t){return"string"==typeof e&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function Y(e,t){let n=[];for(let r=0;r<t.length;r++){let o=t[r],i=e.marks[o],s=i;if(i)n.push(i);else for(let t in e.marks){let r=e.marks[t];("_"==o||r.spec.group&&r.spec.group.split(" ").indexOf(o)>-1)&&n.push(s=r)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return n}class Q{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(e=>{if(function(e){return null!=e.tag}(e))this.tags.push(e);else if(function(e){return null!=e.style}(e)){let t=/[^=]*/.exec(e.style)[0];n.indexOf(t)<0&&n.push(t),this.styles.push(e)}}),this.normalizeLists=!this.tags.some(t=>{if(!/^(ul|ol)\b/.test(t.tag)||!t.node)return!1;let n=e.nodes[t.node];return n.contentMatch.matchType(n)})}parse(e,t={}){let n=new oe(this,t,!1);return n.addAll(e,u.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new oe(this,t,!0);return n.addAll(e,u.none,t.from,t.to),p.maxOpen(n.finish())}matchTag(e,t,n){for(let r=n?this.tags.indexOf(n)+1:0;r<this.tags.length;r++){let n=this.tags[r];if(ie(e,n.tag)&&(void 0===n.namespace||e.namespaceURI==n.namespace)&&(!n.context||t.matchesContext(n.context))){if(n.getAttrs){let t=n.getAttrs(e);if(!1===t)continue;n.attrs=t||void 0}return n}}}matchStyle(e,t,n,r){for(let o=r?this.styles.indexOf(r)+1:0;o<this.styles.length;o++){let r=this.styles[o],i=r.style;if(!(0!=i.indexOf(e)||r.context&&!n.matchesContext(r.context)||i.length>e.length&&(61!=i.charCodeAt(e.length)||i.slice(e.length+1)!=t))){if(r.getAttrs){let e=r.getAttrs(t);if(!1===e)continue;r.attrs=e||void 0}return r}}}static schemaRules(e){let t=[];function n(e){let n=null==e.priority?50:e.priority,r=0;for(;r<t.length;r++){let e=t[r];if((null==e.priority?50:e.priority)<n)break}t.splice(r,0,e)}for(let t in e.marks){let r=e.marks[t].spec.parseDOM;r&&r.forEach(e=>{n(e=se(e)),e.mark||e.ignore||e.clearMark||(e.mark=t)})}for(let t in e.nodes){let r=e.nodes[t].spec.parseDOM;r&&r.forEach(e=>{n(e=se(e)),e.node||e.ignore||e.mark||(e.node=t)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new Q(e,Q.schemaRules(e)))}}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},ee={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},te={ol:!0,ul:!0};function ne(e,t,n){return null!=t?(t?1:0)|("full"===t?2:0):e&&"pre"==e.whitespace?3:-5&n}class re{constructor(e,t,n,r,o,i){this.type=e,this.attrs=t,this.marks=n,this.solid=r,this.options=i,this.content=[],this.activeMarks=u.none,this.match=o||(4&i?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(a.from(e));if(!t){let t,n=this.type.contentMatch;return(t=n.findWrapping(e.type))?(this.match=n,t):null}this.match=this.type.contentMatch.matchFragment(t)}return this.match.findWrapping(e.type)}finish(e){if(!(1&this.options)){let e,t=this.content[this.content.length-1];if(t&&t.isText&&(e=/[ \t\r\n\u000c]+$/.exec(t.text))){let n=t;t.text.length==e[0].length?this.content.pop():this.content[this.content.length-1]=n.withText(n.text.slice(0,n.text.length-e[0].length))}}let t=a.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(a.empty,!0))),this.type?this.type.create(this.attrs,t,this.marks):t}inlineContext(e){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:e.parentNode&&!Z.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class oe{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let r,o=t.topNode,i=ne(null,t.preserveWhitespace,0)|(n?4:0);r=o?new re(o.type,o.attrs,u.none,!0,t.topMatch||o.type.contentMatch,i):new re(n?null:e.schema.topNodeType,null,u.none,!0,null,i),this.nodes=[r],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){3==e.nodeType?this.addTextNode(e,t):1==e.nodeType&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,r=this.top,o=2&r.options?"full":this.localPreserveWS||(1&r.options)>0,{schema:i}=this.parser;if("full"===o||r.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(o)if("full"===o)n=n.replace(/\r\n?/g,"\n");else if(i.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(i.linebreakReplacement.create())){let e=n.split(/\r?\n|\r/);for(let n=0;n<e.length;n++)n&&this.insertNode(i.linebreakReplacement.create(),t,!0),e[n]&&this.insertNode(i.text(e[n]),t,!/\S/.test(e[n]));n=""}else 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 t=r.content[r.content.length-1],o=e.previousSibling;(!t||o&&"BR"==o.nodeName||t.isText&&/[ \t\r\n\u000c]$/.test(t.text))&&(n=n.slice(1))}n&&this.insertNode(i.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let r=this.localPreserveWS,o=this.top;("PRE"==e.tagName||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let i,s=e.nodeName.toLowerCase();te.hasOwnProperty(s)&&this.parser.normalizeLists&&function(e){for(let t=e.firstChild,n=null;t;t=t.nextSibling){let e=1==t.nodeType?t.nodeName.toLowerCase():null;e&&te.hasOwnProperty(e)&&n?(n.appendChild(t),t=n):"li"==e?n=t:e&&(n=null)}}(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(i=this.parser.matchTag(e,this,n));e:if(a?a.ignore:ee.hasOwnProperty(s))this.findInside(e),this.ignoreFallback(e,t);else if(!a||a.skip||a.closeParent){a&&a.closeParent?this.open=Math.max(0,this.open-1):a&&a.skip.nodeType&&(e=a.skip);let n,r=this.needsBlock;if(Z.hasOwnProperty(s))o.content.length&&o.content[0].isInline&&this.open&&(this.open--,o=this.top),n=!0,o.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let i=a&&a.skip?t:this.readStyles(e,t);i&&this.addAll(e,i),n&&this.sync(o),this.needsBlock=r}else{let n=this.readStyles(e,t);n&&this.addElementByRule(e,a,n,!1===a.consuming?i:void 0)}this.localPreserveWS=r}leafFallback(e,t){"BR"==e.nodeName&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode("\n"),t)}ignoreFallback(e,t){"BR"!=e.nodeName||this.top.type&&this.top.type.inlineContent||this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let e=0;e<this.parser.matchedStyles.length;e++){let r=this.parser.matchedStyles[e],o=n.getPropertyValue(r);if(o)for(let e;;){let n=this.parser.matchStyle(r,o,this,e);if(!n)break;if(n.ignore)return null;if(t=n.clearMark?t.filter(e=>!n.clearMark(e)):t.concat(this.parser.schema.marks[n.mark].create(n.attrs)),!1!==n.consuming)break;e=n}}return t}addElementByRule(e,t,n,r){let o,i;if(t.node)if(i=this.parser.schema.nodes[t.node],i.isLeaf)this.insertNode(i.create(t.attrs),n,"BR"==e.nodeName)||this.leafFallback(e,n);else{let e=this.enter(i,t.attrs||null,n,t.preserveWhitespace);e&&(o=!0,n=e)}else{let e=this.parser.schema.marks[t.mark];n=n.concat(e.create(t.attrs))}let s=this.top;if(i&&i.isLeaf)this.findInside(e);else if(r)this.addElement(e,n,r);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(e=>this.insertNode(e,n,!1));else{let r=e;"string"==typeof t.contentElement?r=e.querySelector(t.contentElement):"function"==typeof t.contentElement?r=t.contentElement(e):t.contentElement&&(r=t.contentElement),this.findAround(e,r,!0),this.addAll(r,n),this.findAround(e,r,!1)}o&&this.sync(s)&&this.open--}addAll(e,t,n,r){let o=n||0;for(let i=n?e.childNodes[n]:e.firstChild,s=null==r?null:e.childNodes[r];i!=s;i=i.nextSibling,++o)this.findAtPoint(e,o),this.addDOM(i,t);this.findAtPoint(e,o)}findPlace(e,t,n){let r,o;for(let t=this.open,i=0;t>=0;t--){let s=this.nodes[t],a=s.findWrapping(e);if(a&&(!r||r.length>a.length+i)&&(r=a,o=s,!a.length))break;if(s.solid){if(n)break;i+=2}}if(!r)return null;this.sync(o);for(let e=0;e<r.length;e++)t=this.enterInner(r[e],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let e=this.textblockFromContext();e&&(t=this.enterInner(e,null,t))}let r=this.findPlace(e,t,n);if(r){this.closeExtra();let t=this.top;t.match&&(t.match=t.match.matchType(e.type));let n=u.none;for(let o of r.concat(e.marks))(t.type?t.type.allowsMarkType(o.type):ae(o.type,e.type))&&(n=o.addToSet(n));return t.content.push(e.mark(n)),!0}return!1}enter(e,t,n,r){let o=this.findPlace(e.create(t),n,!1);return o&&(o=this.enterInner(e,t,n,!0,r)),o}enterInner(e,t,n,r=!1,o){this.closeExtra();let i=this.top;i.match=i.match&&i.match.matchType(e);let s=ne(e,o,i.options);4&i.options&&0==i.content.length&&(s|=4);let a=u.none;return n=n.filter(t=>!(i.type?i.type.allowsMarkType(t.type):ae(t.type,e))||(a=t.addToSet(a),!1)),this.nodes.push(new re(e,t,a,r,null,s)),this.open++,n}closeExtra(e=!1){let t=this.nodes.length-1;if(t>this.open){for(;t>this.open;t--)this.nodes[t-1].content.push(this.nodes[t].finish(e));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(!(!this.isOpen&&!this.options.topOpen))}sync(e){for(let t=this.open;t>=0;t--){if(this.nodes[t]==e)return this.open=t,!0;this.localPreserveWS&&(this.nodes[t].options|=1)}return!1}get currentPos(){this.closeExtra();let e=0;for(let t=this.open;t>=0;t--){let n=this.nodes[t].content;for(let t=n.length-1;t>=0;t--)e+=n[t].nodeSize;t&&e++}return e}findAtPoint(e,t){if(this.find)for(let n=0;n<this.find.length;n++)this.find[n].node==e&&this.find[n].offset==t&&(this.find[n].pos=this.currentPos)}findInside(e){if(this.find)for(let t=0;t<this.find.length;t++)null==this.find[t].pos&&1==e.nodeType&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let r=0;r<this.find.length;r++)null==this.find[r].pos&&1==e.nodeType&&e.contains(this.find[r].node)&&t.compareDocumentPosition(this.find[r].node)&(n?2:4)&&(this.find[r].pos=this.currentPos)}findInText(e){if(this.find)for(let t=0;t<this.find.length;t++)this.find[t].node==e&&(this.find[t].pos=this.currentPos-(e.nodeValue.length-this.find[t].offset))}matchesContext(e){if(e.indexOf("|")>-1)return e.split(/\s*\|\s*/).some(this.matchesContext,this);let t=e.split("/"),n=this.options.context,r=!(this.isOpen||n&&n.parent.type!=this.nodes[0].type),o=-(n?n.depth+1:0)+(r?0:1),i=(e,s)=>{for(;e>=0;e--){let a=t[e];if(""==a){if(e==t.length-1||0==e)continue;for(;s>=o;s--)if(i(e-1,s))return!0;return!1}{let e=s>0||0==s&&r?this.nodes[s].type:n&&s>=o?n.node(s-o).type:null;if(!e||e.name!=a&&!e.isInGroup(a))return!1;s--}}return!0};return i(t.length-1,this.open)}textblockFromContext(){let e=this.options.context;if(e)for(let t=e.depth;t>=0;t--){let n=e.node(t).contentMatchAt(e.indexAfter(t)).defaultType;if(n&&n.isTextblock&&n.defaultAttrs)return n}for(let e in this.parser.schema.nodes){let t=this.parser.schema.nodes[e];if(t.isTextblock&&t.defaultAttrs)return t}}}function ie(e,t){return(e.matches||e.msMatchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector).call(e,t)}function se(e){let t={};for(let n in e)t[n]=e[n];return t}function ae(e,t){let n=t.schema.nodes;for(let r in n){let o=n[r];if(!o.allowsMarkType(e))continue;let i=[],s=e=>{i.push(e);for(let n=0;n<e.edgeCount;n++){let{type:r,next:o}=e.edge(n);if(r==t)return!0;if(i.indexOf(o)<0&&s(o))return!0}};if(s(o.contentMatch))return!0}}class le{constructor(e,t){this.nodes=e,this.marks=t}serializeFragment(e,t={},n){n||(n=de(t).createDocumentFragment());let r=n,o=[];return e.forEach(e=>{if(o.length||e.marks.length){let n=0,i=0;for(;n<o.length&&i<e.marks.length;){let t=e.marks[i];if(this.marks[t.type.name]){if(!t.eq(o[n][0])||!1===t.type.spec.spanning)break;n++,i++}else i++}for(;n<o.length;)r=o.pop()[1];for(;i<e.marks.length;){let n=e.marks[i++],s=this.serializeMark(n,e.isInline,t);s&&(o.push([n,r]),r.appendChild(s.dom),r=s.contentDOM||s.dom)}}r.appendChild(this.serializeNodeInner(e,t))}),n}serializeNodeInner(e,t){let{dom:n,contentDOM:r}=he(de(t),this.nodes[e.type.name](e),null,e.attrs);if(r){if(e.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(e.content,t,r)}return n}serializeNode(e,t={}){let n=this.serializeNodeInner(e,t);for(let r=e.marks.length-1;r>=0;r--){let o=this.serializeMark(e.marks[r],e.isInline,t);o&&((o.contentDOM||o.dom).appendChild(n),n=o.dom)}return n}serializeMark(e,t,n={}){let r=this.marks[e.type.name];return r&&he(de(n),r(e,t),null,e.attrs)}static renderSpec(e,t,n=null,r){return he(e,t,n,r)}static fromSchema(e){return e.cached.domSerializer||(e.cached.domSerializer=new le(this.nodesFromSchema(e),this.marksFromSchema(e)))}static nodesFromSchema(e){let t=ce(e.nodes);return t.text||(t.text=e=>e.text),t}static marksFromSchema(e){return ce(e.marks)}}function ce(e){let t={};for(let n in e){let r=e[n].spec.toDOM;r&&(t[n]=r)}return t}function de(e){return e.document||window.document}const ue=new WeakMap;function he(e,t,n,r){if("string"==typeof t)return{dom:e.createTextNode(t)};if(null!=t.nodeType)return{dom:t};if(t.dom&&null!=t.dom.nodeType)return t;let o,i=t[0];if("string"!=typeof i)throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=function(e){let t=ue.get(e);return void 0===t&&ue.set(e,t=function(e){let t=null;return function e(n){if(n&&"object"==typeof n)if(Array.isArray(n))if("string"==typeof n[0])t||(t=[]),t.push(n);else for(let t=0;t<n.length;t++)e(n[t]);else for(let t in n)e(n[t])}(e),t}(e)),t}(r))&&o.indexOf(t)>-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=i.indexOf(" ");a>0&&(n=i.slice(0,a),i=i.slice(a+1));let l=n?e.createElementNS(n,i):e.createElement(i),c=t[1],d=1;if(c&&"object"==typeof c&&null==c.nodeType&&!Array.isArray(c)){d=2;for(let e in c)if(null!=c[e]){let t=e.indexOf(" ");t>0?l.setAttributeNS(e.slice(0,t),e.slice(t+1),c[e]):"style"==e&&l.style?l.style.cssText=c[e]:l.setAttribute(e,c[e])}}for(let o=d;o<t.length;o++){let i=t[o];if(0===i){if(o<t.length-1||o>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}{let{dom:t,contentDOM:o}=he(e,i,n,r);if(l.appendChild(t),o){if(s)throw new RangeError("Multiple content holes");s=o}}}return{dom:l,contentDOM:s}}const pe=Math.pow(2,16);function fe(e,t){return e+t*pe}function me(e){return 65535&e}class ge{constructor(e,t,n){this.pos=e,this.delInfo=t,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 ve{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&ve.empty)return ve.empty}recover(e){let t=0,n=me(e);if(!this.inverted)for(let e=0;e<n;e++)t+=this.ranges[3*e+2]-this.ranges[3*e+1];return this.ranges[3*n]+t+function(e){return(e-(65535&e))/pe}(e)}mapResult(e,t=1){return this._map(e,t,!1)}map(e,t=1){return this._map(e,t,!0)}_map(e,t,n){let r=0,o=this.inverted?2:1,i=this.inverted?1:2;for(let s=0;s<this.ranges.length;s+=3){let a=this.ranges[s]-(this.inverted?r:0);if(a>e)break;let l=this.ranges[s+o],c=this.ranges[s+i],d=a+l;if(e<=d){let o=a+r+((l?e==a?-1:e==d?1:t:t)<0?0:c);if(n)return o;let i=e==(t<0?a:d)?null:fe(s/3,e-a),u=e==a?2:e==d?1:4;return(t<0?e!=a:e!=d)&&(u|=8),new ge(o,u,i)}r+=c-l}return n?e+r:new ge(e+r,0,null)}touches(e,t){let n=0,r=me(t),o=this.inverted?2:1,i=this.inverted?1:2;for(let t=0;t<this.ranges.length;t+=3){let s=this.ranges[t]-(this.inverted?n:0);if(s>e)break;let a=this.ranges[t+o];if(e<=s+a&&t==3*r)return!0;n+=this.ranges[t+i]-a}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let r=0,o=0;r<this.ranges.length;r+=3){let i=this.ranges[r],s=i-(this.inverted?o:0),a=i+(this.inverted?0:o),l=this.ranges[r+t],c=this.ranges[r+n];e(s,s+l,a,a+c),o+=c-l}}invert(){return new ve(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return 0==e?ve.empty:new ve(e<0?[0,-e,0]:[0,0,e])}}ve.empty=new ve([]);class ye{constructor(e,t,n=0,r=(e?e.length:0)){this.mirror=t,this.from=n,this.to=r,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new ye(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),null!=t&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let r=e.getMirror(t);this.appendMap(e._maps[t],null!=r&&r<t?n+r:void 0)}}getMirror(e){if(this.mirror)for(let t=0;t<this.mirror.length;t++)if(this.mirror[t]==e)return this.mirror[t+(t%2?-1:1)]}setMirror(e,t){this.mirror||(this.mirror=[]),this.mirror.push(e,t)}appendMappingInverted(e){for(let t=e.maps.length-1,n=this._maps.length+e._maps.length;t>=0;t--){let r=e.getMirror(t);this.appendMap(e._maps[t].invert(),null!=r&&r>t?n-r-1:void 0)}}invert(){let e=new ye;return e.appendMappingInverted(this),e}map(e,t=1){if(this.mirror)return this._map(e,t,!0);for(let n=this.from;n<this.to;n++)e=this._maps[n].map(e,t);return e}mapResult(e,t=1){return this._map(e,t,!1)}_map(e,t,n){let r=0;for(let n=this.from;n<this.to;n++){let o=this._maps[n].mapResult(e,t);if(null!=o.recover){let t=this.getMirror(n);if(null!=t&&t>n&&t<this.to){n=t,e=this._maps[t].recover(o.recover);continue}}r|=o.delInfo,e=o.pos}return n?e:new ge(e,r,null)}}const be=Object.create(null);class ke{getMap(){return ve.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=be[t.stepType];if(!n)throw new RangeError(`No step type ${t.stepType} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in be)throw new RangeError("Duplicate use of step JSON ID "+e);return be[e]=t,t.prototype.jsonID=e,t}}class we{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new we(e,null)}static fail(e){return new we(null,e)}static fromReplace(e,t,n,r){try{return we.ok(e.replace(t,n,r))}catch(e){if(e instanceof h)return we.fail(e.message);throw e}}}function xe(e,t,n){let r=[];for(let o=0;o<e.childCount;o++){let i=e.child(o);i.content.size&&(i=i.copy(xe(i.content,t,i))),i.isInline&&(i=t(i,n,o)),r.push(i)}return a.fromArray(r)}class Se extends ke{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=e.resolve(this.from),r=n.node(n.sharedDepth(this.to)),o=new p(xe(t.content,(e,t)=>e.isAtom&&t.type.allowsMarkType(this.mark.type)?e.mark(this.mark.addToSet(e.marks)):e,r),t.openStart,t.openEnd);return we.fromReplace(e,this.from,this.to,o)}invert(){return new Ce(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Se(t.pos,n.pos,this.mark)}merge(e){return e instanceof Se&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Se(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new Se(t.from,t.to,e.markFromJSON(t.mark))}}ke.jsonID("addMark",Se);class Ce extends ke{constructor(e,t,n){super(),this.from=e,this.to=t,this.mark=n}apply(e){let t=e.slice(this.from,this.to),n=new p(xe(t.content,e=>e.mark(this.mark.removeFromSet(e.marks)),e),t.openStart,t.openEnd);return we.fromReplace(e,this.from,this.to,n)}invert(){return new Se(this.from,this.to,this.mark)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deleted&&n.deleted||t.pos>=n.pos?null:new Ce(t.pos,n.pos,this.mark)}merge(e){return e instanceof Ce&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new Ce(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new Ce(t.from,t.to,e.markFromJSON(t.mark))}}ke.jsonID("removeMark",Ce);class Me extends ke{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return we.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return we.fromReplace(e,this.pos,this.pos+1,new p(a.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let e=this.mark.addToSet(t.marks);if(e.length==t.marks.length){for(let n=0;n<t.marks.length;n++)if(!t.marks[n].isInSet(e))return new Me(this.pos,t.marks[n]);return new Me(this.pos,this.mark)}}return new Te(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Me(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new Me(t.pos,e.markFromJSON(t.mark))}}ke.jsonID("addNodeMark",Me);class Te extends ke{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return we.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return we.fromReplace(e,this.pos,this.pos+1,new p(a.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return t&&this.mark.isInSet(t.marks)?new Me(this.pos,this.mark):this}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Te(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new Te(t.pos,e.markFromJSON(t.mark))}}ke.jsonID("removeNodeMark",Te);class Ae extends ke{constructor(e,t,n,r=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=r}apply(e){return this.structure&&Ee(e,this.from,this.to)?we.fail("Structure replace would overwrite content"):we.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new ve([this.from,this.to-this.from,this.slice.size])}invert(e){return new Ae(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1);return t.deletedAcross&&n.deletedAcross?null:new Ae(t.pos,Math.max(t.pos,n.pos),this.slice,this.structure)}merge(e){if(!(e instanceof Ae)||e.structure||this.structure)return null;if(this.from+this.slice.size!=e.from||this.slice.openEnd||e.slice.openStart){if(e.to!=this.from||this.slice.openStart||e.slice.openEnd)return null;{let t=this.slice.size+e.slice.size==0?p.empty:new p(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new Ae(e.from,this.to,t,this.structure)}}{let t=this.slice.size+e.slice.size==0?p.empty:new p(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new Ae(this.from,this.to+(e.to-e.from),t,this.structure)}}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to)throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new Ae(t.from,t.to,p.fromJSON(e,t.slice),!!t.structure)}}ke.jsonID("replace",Ae);class Oe extends ke{constructor(e,t,n,r,o,i,s=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=r,this.slice=o,this.insert=i,this.structure=s}apply(e){if(this.structure&&(Ee(e,this.from,this.gapFrom)||Ee(e,this.gapTo,this.to)))return we.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return we.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?we.fromReplace(e,this.from,this.to,n):we.fail("Content does not fit in gap")}getMap(){return new ve([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(e){let t=this.gapTo-this.gapFrom;return new Oe(this.from,this.from+this.slice.size+t,this.from+this.insert,this.from+this.insert+t,e.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),r=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),o=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||r<t.pos||o>n.pos?null:new Oe(t.pos,n.pos,r,o,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if("number"!=typeof t.from||"number"!=typeof t.to||"number"!=typeof t.gapFrom||"number"!=typeof t.gapTo||"number"!=typeof t.insert)throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new Oe(t.from,t.to,t.gapFrom,t.gapTo,p.fromJSON(e,t.slice),t.insert,!!t.structure)}}function Ee(e,t,n){let r=e.resolve(t),o=n-t,i=r.depth;for(;o>0&&i>0&&r.indexAfter(i)==r.node(i).childCount;)i--,o--;if(o>0){let e=r.node(i).maybeChild(r.indexAfter(i));for(;o>0;){if(!e||e.isLeaf)return!0;e=e.firstChild,o--}}return!1}function Ne(e,t,n,r=n.contentMatch,o=!0){let i=e.doc.nodeAt(t),s=[],l=t+1;for(let t=0;t<i.childCount;t++){let c=i.child(t),d=l+c.nodeSize,u=r.matchType(c.type);if(u){r=u;for(let t=0;t<c.marks.length;t++)n.allowsMarkType(c.marks[t].type)||e.step(new Ce(l,d,c.marks[t]));if(o&&c.isText&&"pre"!=n.whitespace){let e,t,r=/\r?\n|\r/g;for(;e=r.exec(c.text);)t||(t=new p(a.from(n.schema.text(" ",n.allowedMarks(c.marks))),0,0)),s.push(new Ae(l+e.index,l+e.index+e[0].length,t))}}else s.push(new Ae(l,d,p.empty));l=d}if(!r.validEnd){let t=r.fillBefore(a.empty,!0);e.replace(l,l,new p(t,0,0))}for(let t=s.length-1;t>=0;t--)e.step(s[t])}function Re(e,t,n){return(0==t||e.canReplace(t,e.childCount))&&(n==e.childCount||e.canReplace(0,n))}function De(e){let t=e.parent.content.cutByIndex(e.startIndex,e.endIndex);for(let n=e.depth,r=0,o=0;;--n){let i=e.$from.node(n),s=e.$from.index(n)+r,a=e.$to.indexAfter(n)-o;if(n<e.depth&&i.canReplace(s,a,t))return n;if(0==n||i.type.spec.isolating||!Re(i,s,a))break;s&&(r=1),a<i.childCount&&(o=1)}return null}function Pe(e,t,n=null,r=e){let o=function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.contentMatchAt(r).findWrapping(t);if(!i)return null;let s=i.length?i[0]:t;return n.canReplaceWith(r,o,s)?i:null}(e,t),i=o&&function(e,t){let{parent:n,startIndex:r,endIndex:o}=e,i=n.child(r),s=t.contentMatch.findWrapping(i.type);if(!s)return null;let a=(s.length?s[s.length-1]:t).contentMatch;for(let e=r;a&&e<o;e++)a=a.matchType(n.child(e).type);return a&&a.validEnd?s:null}(r,t);return i?o.map($e).concat({type:t,attrs:n}).concat(i.map($e)):null}function $e(e){return{type:e,attrs:null}}function Ie(e,t,n,r){t.forEach((o,i)=>{if(o.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(o.text);){let o=e.mapping.slice(r).map(n+1+i+s.index);e.replaceWith(o,o+1,t.type.schema.linebreakReplacement.create())}}})}function ze(e,t,n,r){t.forEach((o,i)=>{if(o.type==o.type.schema.linebreakReplacement){let o=e.mapping.slice(r).map(n+1+i);e.replaceWith(o,o+1,t.type.schema.text("\n"))}})}function Le(e,t,n=1,r){let o=e.resolve(t),i=o.depth-n,s=r&&r[r.length-1]||o.parent;if(i<0||o.parent.type.spec.isolating||!o.parent.canReplace(o.index(),o.parent.childCount)||!s.type.validContent(o.parent.content.cutByIndex(o.index(),o.parent.childCount)))return!1;for(let e=o.depth-1,t=n-2;e>i;e--,t--){let n=o.node(e),i=o.index(e);if(n.type.spec.isolating)return!1;let s=n.content.cutByIndex(i,n.childCount),a=r&&r[t+1];a&&(s=s.replaceChild(0,a.type.create(a.attrs)));let l=r&&r[t]||n;if(!n.canReplace(i+1,n.childCount)||!l.type.validContent(s))return!1}let a=o.indexAfter(i),l=r&&r[0];return o.node(i).canReplaceWith(a,a,l?l.type:o.node(i+1).type)}function Fe(e,t){let n=e.resolve(t),r=n.index();return He(n.nodeBefore,n.nodeAfter)&&n.parent.canReplace(r,r+1)}function He(e,t){return!(!e||!t||e.isLeaf||!function(e,t){t.content.size||e.type.compatibleContent(t.type);let n=e.contentMatchAt(e.childCount),{linebreakReplacement:r}=e.type.schema;for(let o=0;o<t.childCount;o++){let i=t.child(o),s=i.type==r?e.type.schema.nodes.text:i.type;if(n=n.matchType(s),!n)return!1;if(!e.type.allowsMarks(i.marks))return!1}return n.validEnd}(e,t))}function je(e,t,n=-1){let r=e.resolve(t);for(let e=r.depth;;e--){let o,i,s=r.index(e);if(e==r.depth?(o=r.nodeBefore,i=r.nodeAfter):n>0?(o=r.node(e+1),s++,i=r.node(e).maybeChild(s)):(o=r.node(e).maybeChild(s-1),i=r.node(e+1)),o&&!o.isTextblock&&He(o,i)&&r.node(e).canReplace(s,s+1))return t;if(0==e)break;t=n<0?r.before(e):r.after(e)}}function Be(e,t,n){let r=e.resolve(t);if(!n.content.size)return t;let o=n.content;for(let e=0;e<n.openStart;e++)o=o.firstChild.content;for(let e=1;e<=(0==n.openStart&&n.size?2:1);e++)for(let t=r.depth;t>=0;t--){let n=t==r.depth?0:r.pos<=(r.start(t+1)+r.end(t+1))/2?-1:1,i=r.index(t)+(n>0?1:0),s=r.node(t),a=!1;if(1==e)a=s.canReplace(i,i,o);else{let e=s.contentMatchAt(i).findWrapping(o.firstChild.type);a=e&&s.canReplaceWith(i,i,e[0])}if(a)return 0==n?r.pos:n<0?r.before(t+1):r.after(t+1)}return null}function _e(e,t,n=t,r=p.empty){if(t==n&&!r.size)return null;let o=e.resolve(t),i=e.resolve(n);return Ve(o,i,r)?new Ae(t,n,r):new We(o,i,r).fit()}function Ve(e,t,n){return!n.openStart&&!n.openEnd&&e.start()==t.start()&&e.parent.canReplace(e.index(),t.index(),n.content)}ke.jsonID("replaceAround",Oe);class We{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=a.empty;for(let t=0;t<=e.depth;t++){let n=e.node(t);this.frontier.push({type:n.type,match:n.contentMatchAt(e.indexAfter(t))})}for(let t=e.depth;t>0;t--)this.placed=a.from(e.node(t).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let e=this.findFittable();e?this.placeNodes(e):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,r=this.close(e<0?this.$to:n.doc.resolve(e));if(!r)return null;let o=this.placed,i=n.depth,s=r.depth;for(;i&&s&&1==o.childCount;)o=o.firstChild.content,i--,s--;let a=new p(o,i,s);return e>-1?new Oe(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new Ae(n.pos,r.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,r=this.unplaced.openEnd;n<e;n++){let o=t.firstChild;if(t.childCount>1&&(r=0),o.type.spec.isolating&&r<=n){e=n;break}t=o.content}for(let t=1;t<=2;t++)for(let n=1==t?e:this.unplaced.openStart;n>=0;n--){let e,r=null;n?(r=Je(this.unplaced.content,n-1).firstChild,e=r.content):e=this.unplaced.content;let o=e.firstChild;for(let e=this.depth;e>=0;e--){let i,{type:s,match:l}=this.frontier[e],c=null;if(1==t&&(o?l.matchType(o.type)||(c=l.fillBefore(a.from(o),!1)):r&&s.compatibleContent(r.type)))return{sliceDepth:n,frontierDepth:e,parent:r,inject:c};if(2==t&&o&&(i=l.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:e,parent:r,wrap:i};if(r&&l.matchType(r.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Je(e,t);return!(!r.childCount||r.firstChild.isLeaf||(this.unplaced=new p(e,t+1,Math.max(n,r.size+t>=e.size-n?t+1:0)),0))}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,r=Je(e,t);if(r.childCount<=1&&t>0){let o=e.size-t<=t+r.size;this.unplaced=new p(qe(e,t-1,1),t-1,o?t-1:n)}else this.unplaced=new p(qe(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:r,wrap:o}){for(;this.depth>t;)this.closeFrontierNode();if(o)for(let e=0;e<o.length;e++)this.openFrontierNode(o[e]);let i=this.unplaced,s=n?n.content:i.content,l=i.openStart-e,c=0,d=[],{match:u,type:h}=this.frontier[t];if(r){for(let e=0;e<r.childCount;e++)d.push(r.child(e));u=u.matchFragment(r)}let f=s.size+e-(i.content.size-i.openEnd);for(;c<s.childCount;){let e=s.child(c),t=u.matchType(e.type);if(!t)break;c++,(c>1||0==l||e.content.size)&&(u=t,d.push(Ue(e.mark(h.allowedMarks(e.marks)),1==c?l:0,c==s.childCount?f:-1)))}let m=c==s.childCount;m||(f=-1),this.placed=Ke(this.placed,t,a.from(d)),this.frontier[t].match=u,m&&f<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let e=0,t=s;e<f;e++){let e=t.lastChild;this.frontier.push({type:e.type,match:e.contentMatchAt(e.childCount)}),t=e.content}this.unplaced=m?0==e?p.empty:new p(qe(i.content,e-1,1),e-1,f<0?i.openEnd:e-1):new p(qe(i.content,e,c),i.openStart,i.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e,t=this.frontier[this.depth];if(!t.type.isTextblock||!Ge(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:n}=this.$to,r=this.$to.after(n);for(;n>1&&r==this.$to.end(--n);)++r;return r}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:r}=this.frontier[t],o=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),i=Ge(e,t,r,n,o);if(i){for(let n=t-1;n>=0;n--){let{match:t,type:r}=this.frontier[n],o=Ge(e,n,r,t,!0);if(!o||o.childCount)continue e}return{depth:t,fit:i,move:o?e.doc.resolve(e.after(t+1)):e}}}}close(e){let t=this.findCloseLevel(e);if(!t)return null;for(;this.depth>t.depth;)this.closeFrontierNode();t.fit.childCount&&(this.placed=Ke(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let t=e.node(n),r=t.type.contentMatch.fillBefore(t.content,!0,e.index(n));this.openFrontierNode(t.type,t.attrs,r)}return e}openFrontierNode(e,t=null,n){let r=this.frontier[this.depth];r.match=r.match.matchType(e),this.placed=Ke(this.placed,this.depth,a.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(a.empty,!0);e.childCount&&(this.placed=Ke(this.placed,this.frontier.length,e))}}function qe(e,t,n){return 0==t?e.cutByIndex(n,e.childCount):e.replaceChild(0,e.firstChild.copy(qe(e.firstChild.content,t-1,n)))}function Ke(e,t,n){return 0==t?e.append(n):e.replaceChild(e.childCount-1,e.lastChild.copy(Ke(e.lastChild.content,t-1,n)))}function Je(e,t){for(let n=0;n<t;n++)e=e.firstChild.content;return e}function Ue(e,t,n){if(t<=0)return e;let r=e.content;return t>1&&(r=r.replaceChild(0,Ue(r.firstChild,t-1,1==r.childCount?n-1:0))),t>0&&(r=e.type.contentMatch.fillBefore(r).append(r),n<=0&&(r=r.append(e.type.contentMatch.matchFragment(r).fillBefore(a.empty,!0)))),e.copy(r)}function Ge(e,t,n,r,o){let i=e.node(t),s=o?e.indexAfter(t):e.index(t);if(s==i.childCount&&!n.compatibleContent(i.type))return null;let a=r.fillBefore(i.content,!0,s);return a&&!function(e,t,n){for(let r=n;r<t.childCount;r++)if(!e.allowsMarks(t.child(r).marks))return!0;return!1}(n,i.content,s)?a:null}function Xe(e){return e.spec.defining||e.spec.definingForContent}function Ye(e,t,n,r,o){if(t<n){let o=e.firstChild;e=e.replaceChild(0,o.copy(Ye(o.content,t+1,n,r,o)))}if(t>r){let t=o.contentMatchAt(0),n=t.fillBefore(e).append(e);e=n.append(t.matchFragment(n).fillBefore(a.empty,!0))}return e}function Qe(e,t){let n=[];for(let r=Math.min(e.depth,t.depth);r>=0;r--){let o=e.start(r);if(o<e.pos-(e.depth-r)||t.end(r)>t.pos+(t.depth-r)||e.node(r).type.spec.isolating||t.node(r).type.spec.isolating)break;(o==t.start(r)||r==e.depth&&r==t.depth&&e.parent.inlineContent&&t.parent.inlineContent&&r&&t.start(r-1)==o-1)&&n.push(r)}return n}class Ze extends ke{constructor(e,t,n){super(),this.pos=e,this.attr=t,this.value=n}apply(e){let t=e.nodeAt(this.pos);if(!t)return we.fail("No node at attribute step's position");let n=Object.create(null);for(let e in t.attrs)n[e]=t.attrs[e];n[this.attr]=this.value;let r=t.type.create(n,null,t.marks);return we.fromReplace(e,this.pos,this.pos+1,new p(a.from(r),0,t.isLeaf?0:1))}getMap(){return ve.empty}invert(e){return new Ze(this.pos,this.attr,e.nodeAt(this.pos).attrs[this.attr])}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new Ze(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if("number"!=typeof t.pos||"string"!=typeof t.attr)throw new RangeError("Invalid input for AttrStep.fromJSON");return new Ze(t.pos,t.attr,t.value)}}ke.jsonID("attr",Ze);class et extends ke{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let n in e.attrs)t[n]=e.attrs[n];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return we.ok(n)}getMap(){return ve.empty}invert(e){return new et(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if("string"!=typeof t.attr)throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new et(t.attr,t.value)}}ke.jsonID("docAttr",et);let tt=class extends Error{};tt=function e(t){let n=Error.call(this,t);return n.__proto__=e.prototype,n},(tt.prototype=Object.create(Error.prototype)).constructor=tt,tt.prototype.name="TransformError";class nt{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new ye}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new tt(t.failed);return this}maybeStep(e){let t=e.apply(this.doc);return t.failed||this.addStep(e,t.doc),t}get docChanged(){return this.steps.length>0}changedRange(){let e=1e9,t=-1e9;for(let n=0;n<this.mapping.maps.length;n++){let r=this.mapping.maps[n];n&&(e=r.map(e,1),t=r.map(t,-1)),r.forEach((n,r,o,i)=>{e=Math.min(e,o),t=Math.max(t,i)})}return 1e9==e?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=p.empty){let r=_e(this.doc,e,t,n);return r&&this.step(r),this}replaceWith(e,t,n){return this.replace(e,t,new p(a.from(n),0,0))}delete(e,t){return this.replace(e,t,p.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return function(e,t,n,r){if(!r.size)return e.deleteRange(t,n);let o=e.doc.resolve(t),i=e.doc.resolve(n);if(Ve(o,i,r))return e.step(new Ae(t,n,r));let s=Qe(o,i);0==s[s.length-1]&&s.pop();let a=-(o.depth+1);s.unshift(a);for(let e=o.depth,t=o.pos-1;e>0;e--,t--){let n=o.node(e).type.spec;if(n.defining||n.definingAsContext||n.isolating)break;s.indexOf(e)>-1?a=e:o.before(e)==t&&s.splice(1,0,-e)}let l=s.indexOf(a),c=[],d=r.openStart;for(let e=r.content,t=0;;t++){let n=e.firstChild;if(c.push(n),t==r.openStart)break;e=n.content}for(let e=d-1;e>=0;e--){let t=c[e],n=Xe(t.type);if(n&&!t.sameMarkup(o.node(Math.abs(a)-1)))d=e;else if(n||!t.type.isTextblock)break}for(let t=r.openStart;t>=0;t--){let a=(t+d+1)%(r.openStart+1),u=c[a];if(u)for(let t=0;t<s.length;t++){let c=s[(t+l)%s.length],d=!0;c<0&&(d=!1,c=-c);let h=o.node(c-1),f=o.index(c-1);if(h.canReplaceWith(f,f,u.type,u.marks))return e.replace(o.before(c),d?i.after(c):n,new p(Ye(r.content,0,r.openStart,a),a,r.openEnd))}}let u=e.steps.length;for(let a=s.length-1;a>=0&&(e.replace(t,n,r),!(e.steps.length>u));a--){let e=s[a];e<0||(t=o.before(e),n=i.after(e))}}(this,e,t,n),this}replaceRangeWith(e,t,n){return function(e,t,n,r){if(!r.isInline&&t==n&&e.doc.resolve(t).parent.content.size){let o=function(e,t,n){let r=e.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),n))return t;if(0==r.parentOffset)for(let e=r.depth-1;e>=0;e--){let t=r.index(e);if(r.node(e).canReplaceWith(t,t,n))return r.before(e+1);if(t>0)return null}if(r.parentOffset==r.parent.content.size)for(let e=r.depth-1;e>=0;e--){let t=r.indexAfter(e);if(r.node(e).canReplaceWith(t,t,n))return r.after(e+1);if(t<r.node(e).childCount)return null}return null}(e.doc,t,r.type);null!=o&&(t=n=o)}e.replaceRange(t,n,new p(a.from(r),0,0))}(this,e,t,n),this}deleteRange(e,t){return function(e,t,n){let r=e.doc.resolve(t),o=e.doc.resolve(n),i=Qe(r,o);for(let t=0;t<i.length;t++){let n=i[t],s=t==i.length-1;if(s&&0==n||r.node(n).type.contentMatch.validEnd)return e.delete(r.start(n),o.end(n));if(n>0&&(s||r.node(n-1).canReplace(r.index(n-1),o.indexAfter(n-1))))return e.delete(r.before(n),o.after(n))}for(let i=1;i<=r.depth&&i<=o.depth;i++)if(t-r.start(i)==r.depth-i&&n>r.end(i)&&o.end(i)-n!=o.depth-i&&r.start(i-1)==o.start(i-1)&&r.node(i-1).canReplace(r.index(i-1),o.index(i-1)))return e.delete(r.before(i),n);e.delete(t,n)}(this,e,t),this}lift(e,t){return function(e,t,n){let{$from:r,$to:o,depth:i}=t,s=r.before(i+1),l=o.after(i+1),c=s,d=l,u=a.empty,h=0;for(let e=i,t=!1;e>n;e--)t||r.index(e)>0?(t=!0,u=a.from(r.node(e).copy(u)),h++):c--;let f=a.empty,m=0;for(let e=i,t=!1;e>n;e--)t||o.after(e+1)<o.end(e)?(t=!0,f=a.from(o.node(e).copy(f)),m++):d++;e.step(new Oe(c,d,s,l,new p(u.append(f),h,m),u.size-h,!0))}(this,e,t),this}join(e,t=1){return function(e,t,n){let r=null,{linebreakReplacement:o}=e.doc.type.schema,i=e.doc.resolve(t-n),s=i.node().type;if(o&&s.inlineContent){let e="pre"==s.whitespace,t=!!s.contentMatch.matchType(o);e&&!t?r=!1:!e&&t&&(r=!0)}let a=e.steps.length;if(!1===r){let r=e.doc.resolve(t+n);ze(e,r.node(),r.before(),a)}s.inlineContent&&Ne(e,t+n-1,s,i.node().contentMatchAt(i.index()),null==r);let l=e.mapping.slice(a),c=l.map(t-n);if(e.step(new Ae(c,l.map(t+n,-1),p.empty,!0)),!0===r){let t=e.doc.resolve(c);Ie(e,t.node(),t.before(),e.steps.length)}}(this,e,t),this}wrap(e,t){return function(e,t,n){let r=a.empty;for(let e=n.length-1;e>=0;e--){if(r.size){let t=n[e].type.contentMatch.matchFragment(r);if(!t||!t.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=a.from(n[e].type.create(n[e].attrs,r))}let o=t.start,i=t.end;e.step(new Oe(o,i,o,i,new p(r,0,0),n.length,!0))}(this,e,t),this}setBlockType(e,t=e,n,r=null){return function(e,t,n,r,o){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let i=e.steps.length;e.doc.nodesBetween(t,n,(t,n)=>{let s="function"==typeof o?o(t):o;if(t.isTextblock&&!t.hasMarkup(r,s)&&function(e,t,n){let r=e.resolve(t),o=r.index();return r.parent.canReplaceWith(o,o+1,n)}(e.doc,e.mapping.slice(i).map(n),r)){let o=null;if(r.schema.linebreakReplacement){let e="pre"==r.whitespace,t=!!r.contentMatch.matchType(r.schema.linebreakReplacement);e&&!t?o=!1:!e&&t&&(o=!0)}!1===o&&ze(e,t,n,i),Ne(e,e.mapping.slice(i).map(n,1),r,void 0,null===o);let l=e.mapping.slice(i),c=l.map(n,1),d=l.map(n+t.nodeSize,1);return e.step(new Oe(c,d,c+1,d-1,new p(a.from(r.create(s,null,t.marks)),0,0),1,!0)),!0===o&&Ie(e,t,n,i),!1}})}(this,e,t,n,r),this}setNodeMarkup(e,t,n=null,r){return function(e,t,n,r,o){let i=e.doc.nodeAt(t);if(!i)throw new RangeError("No node at given position");n||(n=i.type);let s=n.create(r,null,o||i.marks);if(i.isLeaf)return e.replaceWith(t,t+i.nodeSize,s);if(!n.validContent(i.content))throw new RangeError("Invalid content for node type "+n.name);e.step(new Oe(t,t+i.nodeSize,t+1,t+i.nodeSize-1,new p(a.from(s),0,0),1,!0))}(this,e,t,n,r),this}setNodeAttribute(e,t,n){return this.step(new Ze(e,t,n)),this}setDocAttribute(e,t){return this.step(new et(e,t)),this}addNodeMark(e,t){return this.step(new Me(e,t)),this}removeNodeMark(e,t){let n=this.doc.nodeAt(e);if(!n)throw new RangeError("No node at position "+e);if(t instanceof u)t.isInSet(n.marks)&&this.step(new Te(e,t));else{let r,o=n.marks,i=[];for(;r=t.isInSet(o);)i.push(new Te(e,r)),o=r.removeFromSet(o);for(let e=i.length-1;e>=0;e--)this.step(i[e])}return this}split(e,t=1,n){return function(e,t,n=1,r){let o=e.doc.resolve(t),i=a.empty,s=a.empty;for(let e=o.depth,t=o.depth-n,l=n-1;e>t;e--,l--){i=a.from(o.node(e).copy(i));let t=r&&r[l];s=a.from(t?t.type.create(t.attrs,s):o.node(e).copy(s))}e.step(new Ae(t,t,new p(i.append(s),n,n),!0))}(this,e,t,n),this}addMark(e,t,n){return function(e,t,n,r){let o,i,s=[],a=[];e.doc.nodesBetween(t,n,(e,l,c)=>{if(!e.isInline)return;let d=e.marks;if(!r.isInSet(d)&&c.type.allowsMarkType(r.type)){let c=Math.max(l,t),u=Math.min(l+e.nodeSize,n),h=r.addToSet(d);for(let e=0;e<d.length;e++)d[e].isInSet(h)||(o&&o.to==c&&o.mark.eq(d[e])?o.to=u:s.push(o=new Ce(c,u,d[e])));i&&i.to==c?i.to=u:a.push(i=new Se(c,u,r))}}),s.forEach(t=>e.step(t)),a.forEach(t=>e.step(t))}(this,e,t,n),this}removeMark(e,t,n){return function(e,t,n,r){let o=[],i=0;e.doc.nodesBetween(t,n,(e,s)=>{if(!e.isInline)return;i++;let a=null;if(r instanceof G){let t,n=e.marks;for(;t=r.isInSet(n);)(a||(a=[])).push(t),n=t.removeFromSet(n)}else r?r.isInSet(e.marks)&&(a=[r]):a=e.marks;if(a&&a.length){let r=Math.min(s+e.nodeSize,n);for(let e=0;e<a.length;e++){let n,l=a[e];for(let e=0;e<o.length;e++){let t=o[e];t.step==i-1&&l.eq(o[e].style)&&(n=t)}n?(n.to=r,n.step=i):o.push({style:l,from:Math.max(s,t),to:r,step:i})}}}),o.forEach(t=>e.step(new Ce(t.from,t.to,t.style)))}(this,e,t,n),this}clearIncompatible(e,t,n){return Ne(this,e,t,n),this}}const rt=Object.create(null);class ot{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new it(e.min(t),e.max(t))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let e=this.ranges;for(let t=0;t<e.length;t++)if(e[t].$from.pos!=e[t].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(e,t=p.empty){let n=t.content.lastChild,r=null;for(let e=0;e<t.openEnd;e++)r=n,n=n.lastChild;let o=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:a,$to:l}=i[s],c=e.mapping.slice(o);e.replaceRange(c.map(a.pos),c.map(l.pos),s?p.empty:t),0==s&&mt(e,o,(n?n.isInline:r&&r.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){let{$from:i,$to:s}=r[o],a=e.mapping.slice(n),l=a.map(i.pos),c=a.map(s.pos);o?e.deleteRange(l,c):(e.replaceRangeWith(l,c,t),mt(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let r=e.parent.inlineContent?new lt(e):ft(e.node(0),e.parent,e.pos,e.index(),t,n);if(r)return r;for(let r=e.depth-1;r>=0;r--){let o=t<0?ft(e.node(0),e.node(r),e.before(r+1),e.index(r),t,n):ft(e.node(0),e.node(r),e.after(r+1),e.index(r)+1,t,n);if(o)return o}return null}static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new ht(e.node(0))}static atStart(e){return ft(e,e,0,0,1)||new ht(e)}static atEnd(e){return ft(e,e,e.content.size,e.childCount,-1)||new ht(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=rt[t.type];if(!n)throw new RangeError(`No selection type ${t.type} defined`);return n.fromJSON(e,t)}static jsonID(e,t){if(e in rt)throw new RangeError("Duplicate use of selection JSON ID "+e);return rt[e]=t,t.prototype.jsonID=e,t}getBookmark(){return lt.between(this.$anchor,this.$head).getBookmark()}}ot.prototype.visible=!0;class it{constructor(e,t){this.$from=e,this.$to=t}}let st=!1;function at(e){st||e.parent.inlineContent||(st=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+e.parent.type.name+")"))}class lt extends ot{constructor(e,t=e){at(e),at(t),super(e,t)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(e,t){let n=e.resolve(t.map(this.head));if(!n.parent.inlineContent)return ot.near(n);let r=e.resolve(t.map(this.anchor));return new lt(r.parent.inlineContent?r:n,n)}replace(e,t=p.empty){if(super.replace(e,t),t==p.empty){let t=this.$from.marksAcross(this.$to);t&&e.ensureMarks(t)}}eq(e){return e instanceof lt&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new ct(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if("number"!=typeof t.anchor||"number"!=typeof t.head)throw new RangeError("Invalid input for TextSelection.fromJSON");return new lt(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let r=e.resolve(t);return new this(r,n==t?r:e.resolve(n))}static between(e,t,n){let r=e.pos-t.pos;if(n&&!r||(n=r>=0?1:-1),!t.parent.inlineContent){let e=ot.findFrom(t,n,!0)||ot.findFrom(t,-n,!0);if(!e)return ot.near(t,n);t=e.$head}return e.parent.inlineContent||(0==r||(e=(ot.findFrom(e,-n,!0)||ot.findFrom(e,n,!0)).$anchor).pos<t.pos!=r<0)&&(e=t),new lt(e,t)}}ot.jsonID("text",lt);class ct{constructor(e,t){this.anchor=e,this.head=t}map(e){return new ct(e.map(this.anchor),e.map(this.head))}resolve(e){return lt.between(e.resolve(this.anchor),e.resolve(this.head))}}class dt extends ot{constructor(e){let t=e.nodeAfter,n=e.node(0).resolve(e.pos+t.nodeSize);super(e,n),this.node=t}map(e,t){let{deleted:n,pos:r}=t.mapResult(this.anchor),o=e.resolve(r);return n?ot.near(o):new dt(o)}content(){return new p(a.from(this.node),0,0)}eq(e){return e instanceof dt&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ut(this.anchor)}static fromJSON(e,t){if("number"!=typeof t.anchor)throw new RangeError("Invalid input for NodeSelection.fromJSON");return new dt(e.resolve(t.anchor))}static create(e,t){return new dt(e.resolve(t))}static isSelectable(e){return!e.isText&&!1!==e.type.spec.selectable}}dt.prototype.visible=!1,ot.jsonID("node",dt);class ut{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new ct(n,n):new ut(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&dt.isSelectable(n)?new dt(t):ot.near(t)}}class ht extends ot{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=p.empty){if(t==p.empty){e.delete(0,e.doc.content.size);let t=ot.atStart(e.doc);t.eq(e.selection)||e.setSelection(t)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new ht(e)}map(e){return new ht(e)}eq(e){return e instanceof ht}getBookmark(){return pt}}ot.jsonID("all",ht);const pt={map(){return this},resolve(e){return new ht(e)}};function ft(e,t,n,r,o,i=!1){if(t.inlineContent)return lt.create(e,n);for(let s=r-(o>0?0:1);o>0?s<t.childCount:s>=0;s+=o){let r=t.child(s);if(r.isAtom){if(!i&&dt.isSelectable(r))return dt.create(e,n-(o<0?r.nodeSize:0))}else{let t=ft(e,r,n+o,o<0?r.childCount:0,o,i);if(t)return t}n+=r.nodeSize*o}return null}function mt(e,t,n){let r=e.steps.length-1;if(r<t)return;let o,i=e.steps[r];(i instanceof Ae||i instanceof Oe)&&(e.mapping.maps[r].forEach((e,t,n,r)=>{null==o&&(o=r)}),e.setSelection(ot.near(e.doc.resolve(o),n)))}function gt(e,t){return t&&e?e.bind(t):e}class vt{constructor(e,t,n){this.name=e,this.init=gt(t.init,n),this.apply=gt(t.apply,n)}}function yt(e,t,n){for(let r in e){let o=e[r];o instanceof Function?o=o.bind(t):"handleDOMEvents"==r&&(o=yt(o,t,{})),n[r]=o}return n}new vt("doc",{init(e){return e.doc||e.schema.topNodeType.createAndFill()},apply(e){return e.doc}}),new vt("selection",{init(e,t){return e.selection||ot.atStart(t.doc)},apply(e){return e.selection}}),new vt("storedMarks",{init(e){return e.storedMarks||null},apply(e,t,n,r){return r.selection.$cursor?e.storedMarks:null}}),new vt("scrollToSelection",{init(){return 0},apply(e,t){return e.scrolledIntoView?t+1:t}});class bt{constructor(e){this.spec=e,this.props={},e.props&&yt(e.props,this,this.props),this.key=e.key?e.key.key:wt("plugin")}getState(e){return e[this.key]}}const kt=Object.create(null);function wt(e){return e in kt?e+"$"+ ++kt[e]:(kt[e]=0,e+"$")}class xt{constructor(e="key"){this.key=wt(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const St=(e,t)=>!e.selection.empty&&(t&&t(e.tr.deleteSelection().scrollIntoView()),!0);function Ct(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("backward",e):n.parentOffset>0)?null:n}const Mt=(e,t,n)=>{let r=Ct(e,n);if(!r)return!1;let o=Et(r);if(!o){let n=r.blockRange(),o=n&&De(n);return null!=o&&(t&&t(e.tr.lift(n,o).scrollIntoView()),!0)}let i=o.nodeBefore;if(jt(e,o,t,-1))return!0;if(0==r.parent.content.size&&(At(i,"end")||dt.isSelectable(i)))for(let n=r.depth;;n--){let s=_e(e.doc,r.before(n),r.after(n),p.empty);if(s&&s.slice.size<s.to-s.from){if(t){let n=e.tr.step(s);n.setSelection(At(i,"end")?ot.findFrom(n.doc.resolve(n.mapping.map(o.pos,-1)),-1):dt.create(n.doc,o.pos-i.nodeSize)),t(n.scrollIntoView())}return!0}if(1==n||r.node(n-1).childCount>1)break}return!(!i.isAtom||o.depth!=r.depth-1||(t&&t(e.tr.delete(o.pos-i.nodeSize,o.pos).scrollIntoView()),0))};function Tt(e,t,n){let r=t.nodeBefore,o=t.pos-1;for(;!r.isTextblock;o--){if(r.type.spec.isolating)return!1;let e=r.lastChild;if(!e)return!1;r=e}let i=t.nodeAfter,s=t.pos+1;for(;!i.isTextblock;s++){if(i.type.spec.isolating)return!1;let e=i.firstChild;if(!e)return!1;i=e}let a=_e(e.doc,o,s,p.empty);if(!a||a.from!=o||a instanceof Ae&&a.slice.size>=s-o)return!1;if(n){let t=e.tr.step(a);t.setSelection(lt.create(t.doc,o)),n(t.scrollIntoView())}return!0}function At(e,t,n=!1){for(let r=e;r;r="start"==t?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(n&&1!=r.childCount)return!1}return!1}const Ot=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("backward",e):r.parentOffset>0)return!1;i=Et(r)}let s=i&&i.nodeBefore;return!(!s||!dt.isSelectable(s)||(t&&t(e.tr.setSelection(dt.create(e.doc,i.pos-s.nodeSize)).scrollIntoView()),0))};function Et(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){if(e.index(t)>0)return e.doc.resolve(e.before(t+1));if(e.node(t).type.spec.isolating)break}return null}function Nt(e,t){let{$cursor:n}=e.selection;return!n||(t?!t.endOfTextblock("forward",e):n.parentOffset<n.parent.content.size)?null:n}const Rt=(e,t,n)=>{let r=Nt(e,n);if(!r)return!1;let o=Pt(r);if(!o)return!1;let i=o.nodeAfter;if(jt(e,o,t,1))return!0;if(0==r.parent.content.size&&(At(i,"start")||dt.isSelectable(i))){let n=_e(e.doc,r.before(),r.after(),p.empty);if(n&&n.slice.size<n.to-n.from){if(t){let r=e.tr.step(n);r.setSelection(At(i,"start")?ot.findFrom(r.doc.resolve(r.mapping.map(o.pos)),1):dt.create(r.doc,r.mapping.map(o.pos))),t(r.scrollIntoView())}return!0}}return!(!i.isAtom||o.depth!=r.depth-1||(t&&t(e.tr.delete(o.pos,o.pos+i.nodeSize).scrollIntoView()),0))},Dt=(e,t,n)=>{let{$head:r,empty:o}=e.selection,i=r;if(!o)return!1;if(r.parent.isTextblock){if(n?!n.endOfTextblock("forward",e):r.parentOffset<r.parent.content.size)return!1;i=Pt(r)}let s=i&&i.nodeAfter;return!(!s||!dt.isSelectable(s)||(t&&t(e.tr.setSelection(dt.create(e.doc,i.pos)).scrollIntoView()),0))};function Pt(e){if(!e.parent.type.spec.isolating)for(let t=e.depth-1;t>=0;t--){let n=e.node(t);if(e.index(t)+1<n.childCount)return e.doc.resolve(e.after(t+1));if(n.type.spec.isolating)break}return null}const $t=(e,t)=>{let{$head:n,$anchor:r}=e.selection;return!(!n.parent.type.spec.code||!n.sameParent(r)||(t&&t(e.tr.insertText("\n").scrollIntoView()),0))};function It(e){for(let t=0;t<e.edgeCount;t++){let{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}const zt=(e,t)=>{let{$head:n,$anchor:r}=e.selection;if(!n.parent.type.spec.code||!n.sameParent(r))return!1;let o=n.node(-1),i=n.indexAfter(-1),s=It(o.contentMatchAt(i));if(!s||!o.canReplaceWith(i,i,s))return!1;if(t){let r=n.after(),o=e.tr.replaceWith(r,r,s.createAndFill());o.setSelection(ot.near(o.doc.resolve(r),1)),t(o.scrollIntoView())}return!0},Lt=(e,t)=>{let n=e.selection,{$from:r,$to:o}=n;if(n instanceof ht||r.parent.inlineContent||o.parent.inlineContent)return!1;let i=It(o.parent.contentMatchAt(o.indexAfter()));if(!i||!i.isTextblock)return!1;if(t){let n=(!r.parentOffset&&o.index()<o.parent.childCount?r:o).pos,s=e.tr.insert(n,i.createAndFill());s.setSelection(lt.create(s.doc,n+1)),t(s.scrollIntoView())}return!0},Ft=(e,t)=>{let{$cursor:n}=e.selection;if(!n||n.parent.content.size)return!1;if(n.depth>1&&n.after()!=n.end(-1)){let r=n.before();if(Le(e.doc,r))return t&&t(e.tr.split(r).scrollIntoView()),!0}let r=n.blockRange(),o=r&&De(r);return null!=o&&(t&&t(e.tr.lift(r,o).scrollIntoView()),!0)};var Ht;function jt(e,t,n,r){let o,i,s=t.nodeBefore,l=t.nodeAfter,c=s.type.spec.isolating||l.type.spec.isolating;if(!c&&function(e,t,n){let r=t.nodeBefore,o=t.nodeAfter,i=t.index();return!(!(r&&o&&r.type.compatibleContent(o.type))||(!r.content.size&&t.parent.canReplace(i-1,i)?(n&&n(e.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),0):!t.parent.canReplace(i,i+1)||!o.isTextblock&&!Fe(e.doc,t.pos)||(n&&n(e.tr.join(t.pos).scrollIntoView()),0)))}(e,t,n))return!0;let d=!c&&t.parent.canReplace(t.index(),t.index()+1);if(d&&(o=(i=s.contentMatchAt(s.childCount)).findWrapping(l.type))&&i.matchType(o[0]||l.type).validEnd){if(n){let r=t.pos+l.nodeSize,i=a.empty;for(let e=o.length-1;e>=0;e--)i=a.from(o[e].create(null,i));i=a.from(s.copy(i));let c=e.tr.step(new Oe(t.pos-1,r,t.pos,r,new p(i,1,0),o.length,!0)),d=c.doc.resolve(r+2*o.length);d.nodeAfter&&d.nodeAfter.type==s.type&&Fe(c.doc,d.pos)&&c.join(d.pos),n(c.scrollIntoView())}return!0}let u=l.type.spec.isolating||r>0&&c?null:ot.findFrom(t,1),h=u&&u.$from.blockRange(u.$to),f=h&&De(h);if(null!=f&&f>=t.depth)return n&&n(e.tr.lift(h,f).scrollIntoView()),!0;if(d&&At(l,"start",!0)&&At(s,"end")){let r=s,o=[];for(;o.push(r),!r.isTextblock;)r=r.lastChild;let i=l,c=1;for(;!i.isTextblock;i=i.firstChild)c++;if(r.canReplace(r.childCount,r.childCount,i.content)){if(n){let r=a.empty;for(let e=o.length-1;e>=0;e--)r=a.from(o[e].copy(r));n(e.tr.step(new Oe(t.pos-o.length,t.pos+l.nodeSize,t.pos+c,t.pos+l.nodeSize-c,new p(r,o.length,0),0,!0)).scrollIntoView())}return!0}}return!1}function Bt(e){return function(t,n){let r=t.selection,o=e<0?r.$from:r.$to,i=o.depth;for(;o.node(i).isInline;){if(!i)return!1;i--}return!!o.node(i).isTextblock&&(n&&n(t.tr.setSelection(lt.create(t.doc,e<0?o.start(i):o.end(i)))),!0)}}const _t=Bt(-1),Vt=Bt(1);function Wt(e,t=null){return function(n,r){let o=!1;for(let r=0;r<n.selection.ranges.length&&!o;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];n.doc.nodesBetween(i,s,(r,i)=>{if(o)return!1;if(r.isTextblock&&!r.hasMarkup(e,t))if(r.type==e)o=!0;else{let t=n.doc.resolve(i),r=t.index();o=t.parent.canReplaceWith(r,r+1,e)}})}if(!o)return!1;if(r){let o=n.tr;for(let r=0;r<n.selection.ranges.length;r++){let{$from:{pos:i},$to:{pos:s}}=n.selection.ranges[r];o.setBlockType(i,s,e,t)}r(o.scrollIntoView())}return!0}}function qt(...e){return function(t,n,r){for(let o=0;o<e.length;o++)if(e[o](t,n,r))return!0;return!1}}let Kt=qt(St,Mt,Ot),Jt=qt(St,Rt,Dt);const Ut={Enter:qt($t,Lt,Ft,(e,t)=>{let{$from:n,$to:r}=e.selection;if(e.selection instanceof dt&&e.selection.node.isBlock)return!(!n.parentOffset||!Le(e.doc,n.pos)||(t&&t(e.tr.split(n.pos).scrollIntoView()),0));if(!n.depth)return!1;let o,i,s=[],a=!1,l=!1;for(let e=n.depth;;e--){if(n.node(e).isBlock){a=n.end(e)==n.pos+(n.depth-e),l=n.start(e)==n.pos-(n.depth-e),i=It(n.node(e-1).contentMatchAt(n.indexAfter(e-1)));let t=Ht;s.unshift(t||(a&&i?{type:i}:null)),o=e;break}if(1==e)return!1;s.unshift(null)}let c=e.tr;(e.selection instanceof lt||e.selection instanceof ht)&&c.deleteSelection();let d=c.mapping.map(n.pos),u=Le(c.doc,d,s.length,s);if(u||(s[0]=i?{type:i}:null,u=Le(c.doc,d,s.length,s)),!u)return!1;if(c.split(d,s.length,s),!a&&l&&n.node(o).type!=i){let e=c.mapping.map(n.before(o)),t=c.doc.resolve(e);i&&n.node(o-1).canReplaceWith(t.index(),t.index()+1,i)&&c.setNodeMarkup(c.mapping.map(n.before(o)),i)}return t&&t(c.scrollIntoView()),!0}),"Mod-Enter":zt,Backspace:Kt,"Mod-Backspace":Kt,"Shift-Backspace":Kt,Delete:Jt,"Mod-Delete":Jt,"Mod-a":(e,t)=>(t&&t(e.tr.setSelection(new ht(e.doc))),!0)},Gt={"Ctrl-h":Ut.Backspace,"Alt-Backspace":Ut["Mod-Backspace"],"Ctrl-d":Ut.Delete,"Ctrl-Alt-Backspace":Ut["Mod-Delete"],"Alt-Delete":Ut["Mod-Delete"],"Alt-d":Ut["Mod-Delete"],"Ctrl-a":_t,"Ctrl-e":Vt};for(let e in Ut)Gt[e]=Ut[e];function Xt(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,t=>t.childCount>0&&t.firstChild.type==e);return!!i&&(!n||(r.node(i.depth-1).type==e?function(e,t,n,r){let o=e.tr,i=r.end,s=r.$to.end(r.depth);i<s&&(o.step(new Oe(i-1,s,i,s,new p(a.from(n.create(null,r.parent.copy())),1,0),1,!0)),r=new E(o.doc.resolve(r.$from.pos),o.doc.resolve(s),r.depth));const l=De(r);if(null==l)return!1;o.lift(r,l);let c=o.doc.resolve(o.mapping.map(i,-1)-1);return Fe(o.doc,c.pos)&&c.nodeBefore.type==c.nodeAfter.type&&o.join(c.pos),t(o.scrollIntoView()),!0}(t,n,e,i):function(e,t,n){let r=e.tr,o=n.parent;for(let e=n.end,t=n.endIndex-1,i=n.startIndex;t>i;t--)e-=o.child(t).nodeSize,r.delete(e-1,e+1);let i=r.doc.resolve(n.start),s=i.nodeAfter;if(r.mapping.map(n.end)!=n.start+i.nodeAfter.nodeSize)return!1;let l=0==n.startIndex,c=n.endIndex==o.childCount,d=i.node(-1),u=i.index(-1);if(!d.canReplace(u+(l?0:1),u+1,s.content.append(c?a.empty:a.from(o))))return!1;let h=i.pos,f=h+s.nodeSize;return r.step(new Oe(h-(l?1:0),f+(c?1:0),h+1,f-1,new p((l?a.empty:a.from(o.copy(a.empty))).append(c?a.empty:a.from(o.copy(a.empty))),l?0:1,c?0:1),l?0:1)),t(r.scrollIntoView()),!0}(t,n,i)))}}function Yt(e){return function(t,n){let{$from:r,$to:o}=t.selection,i=r.blockRange(o,t=>t.childCount>0&&t.firstChild.type==e);if(!i)return!1;let s=i.startIndex;if(0==s)return!1;let l=i.parent,c=l.child(s-1);if(c.type!=e)return!1;if(n){let r=c.lastChild&&c.lastChild.type==l.type,o=a.from(r?e.create():null),s=new p(a.from(e.create(null,a.from(l.type.create(null,o)))),r?3:1,0),d=i.start,u=i.end;n(t.tr.step(new Oe(d-(r?3:1),u,d,u,s,1,!0)).scrollIntoView())}return!0}}"undefined"!=typeof navigator?/Mac|iP(hone|[oa]d)/.test(navigator.platform):"undefined"!=typeof os&&os.platform&&os.platform();const Qt=function(e){for(var t=0;;t++)if(!(e=e.previousSibling))return t};const Zt=function(e,t,n,r){return n&&(tn(e,t,n,r,-1)||tn(e,t,n,r,1))},en=/^(img|br|input|textarea|hr)$/i;function tn(e,t,n,r,o){for(var i;;){if(e==n&&t==r)return!0;if(t==(o<0?0:nn(e))){let n=e.parentNode;if(!n||1!=n.nodeType||rn(e)||en.test(e.nodeName)||"false"==e.contentEditable)return!1;t=Qt(e)+(o<0?0:1),e=n}else{if(1!=e.nodeType)return!1;{let n=e.childNodes[t+(o<0?-1:0)];if(1==n.nodeType&&"false"==n.contentEditable){if(!(null===(i=n.pmViewDesc)||void 0===i?void 0:i.ignoreForSelection))return!1;t+=o}else e=n,t=o<0?nn(e):0}}}}function nn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function rn(e){let t;for(let n=e;n&&!(t=n.pmViewDesc);n=n.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==e||t.contentDOM==e)}const on=function(e){return e.focusNode&&Zt(e.focusNode,e.focusOffset,e.anchorNode,e.anchorOffset)};function sn(e,t){let n=document.createEvent("Event");return n.initEvent("keydown",!0,!0),n.keyCode=e,n.key=n.code=t,n}const an="undefined"!=typeof navigator?navigator:null,ln="undefined"!=typeof document?document:null,cn=an&&an.userAgent||"",dn=/Edge\/(\d+)/.exec(cn),un=/MSIE \d/.exec(cn),hn=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(cn),pn=!!(un||hn||dn),fn=un?document.documentMode:hn?+hn[1]:dn?+dn[1]:0,mn=!pn&&/gecko\/(\d+)/i.test(cn);mn&&(/Firefox\/(\d+)/.exec(cn)||[0,0])[1];const gn=!pn&&/Chrome\/(\d+)/.exec(cn),vn=!!gn,yn=gn?+gn[1]:0,bn=!pn&&!!an&&/Apple Computer/.test(an.vendor),kn=bn&&(/Mobile\/\w+/.test(cn)||!!an&&an.maxTouchPoints>2),wn=kn||!!an&&/Mac/.test(an.platform),xn=!!an&&/Win/.test(an.platform),Sn=/Android \d/.test(cn),Cn=!!ln&&"webkitFontSmoothing"in ln.documentElement.style,Mn=Cn?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;const Tn=function(e){e&&(this.nodeName=e)};Tn.prototype=Object.create(null);new Tn;function An(e,t=null){let n=e.domSelectionRange(),r=e.state.doc;if(!n.focusNode)return null;let o=e.docView.nearestDesc(n.focusNode),i=o&&0==o.size,s=e.docView.posFromDOM(n.focusNode,n.focusOffset,1);if(s<0)return null;let a,l,c=r.resolve(s);if(on(n)){for(a=s;o&&!o.node;)o=o.parent;let e=o.node;if(o&&e.isAtom&&dt.isSelectable(e)&&o.parent&&(!e.isInline||!function(e,t,n){for(let r=0==t,o=t==nn(e);r||o;){if(e==n)return!0;let t=Qt(e);if(!(e=e.parentNode))return!1;r=r&&0==t,o=o&&t==nn(e)}}(n.focusNode,n.focusOffset,o.dom))){let e=o.posBefore;l=new dt(s==e?c:r.resolve(e))}}else{if(n instanceof e.dom.ownerDocument.defaultView.Selection&&n.rangeCount>1){let t=s,o=s;for(let r=0;r<n.rangeCount;r++){let i=n.getRangeAt(r);t=Math.min(t,e.docView.posFromDOM(i.startContainer,i.startOffset,1)),o=Math.max(o,e.docView.posFromDOM(i.endContainer,i.endOffset,-1))}if(t<0)return null;[a,s]=o==e.state.selection.anchor?[o,t]:[t,o],c=r.resolve(s)}else a=e.docView.posFromDOM(n.anchorNode,n.anchorOffset,1);if(a<0)return null}let d=r.resolve(a);return l||(l=zn(e,d,c,"pointer"==t||e.state.selection.head<c.pos&&!i?1:-1)),l}function On(e){return e.editable?e.hasFocus():Ln(e)&&document.activeElement&&document.activeElement.contains(e.dom)}function En(e,t=!1){let n=e.state.selection;if($n(e,n),On(e)){if(!t&&e.input.mouseDown&&e.input.mouseDown.allowDefault&&vn){let t=e.domSelectionRange(),n=e.domObserver.currentSelection;if(t.anchorNode&&n.anchorNode&&Zt(t.anchorNode,t.anchorOffset,n.anchorNode,n.anchorOffset))return e.input.mouseDown.delayedSelectionSync=!0,void e.domObserver.setCurSelection()}if(e.domObserver.disconnectSelection(),e.cursorWrapper)!function(e){let t=e.domSelection();if(!t)return;let n=e.cursorWrapper.dom,r="IMG"==n.nodeName;r?t.collapse(n.parentNode,Qt(n)+1):t.collapse(n,0),!r&&!e.state.selection.visible&&pn&&fn<=11&&(n.disabled=!0,n.disabled=!1)}(e);else{let r,o,{anchor:i,head:s}=n;!Nn||n instanceof lt||(n.$from.parent.inlineContent||(r=Rn(e,n.from)),n.empty||n.$from.parent.inlineContent||(o=Rn(e,n.to))),e.docView.setSelection(i,s,e,t),Nn&&(r&&Pn(r),o&&Pn(o)),n.visible?e.dom.classList.remove("ProseMirror-hideselection"):(e.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&function(e){let t=e.dom.ownerDocument;t.removeEventListener("selectionchange",e.input.hideSelectionGuard);let n=e.domSelectionRange(),r=n.anchorNode,o=n.anchorOffset;t.addEventListener("selectionchange",e.input.hideSelectionGuard=()=>{n.anchorNode==r&&n.anchorOffset==o||(t.removeEventListener("selectionchange",e.input.hideSelectionGuard),setTimeout(()=>{On(e)&&!e.state.selection.visible||e.dom.classList.remove("ProseMirror-hideselection")},20))})}(e))}e.domObserver.setCurSelection(),e.domObserver.connectSelection()}}const Nn=bn||vn&&yn<63;function Rn(e,t){let{node:n,offset:r}=e.docView.domFromPos(t,0),o=r<n.childNodes.length?n.childNodes[r]:null,i=r?n.childNodes[r-1]:null;if(bn&&o&&"false"==o.contentEditable)return Dn(o);if(!(o&&"false"!=o.contentEditable||i&&"false"!=i.contentEditable)){if(o)return Dn(o);if(i)return Dn(i)}}function Dn(e){return e.contentEditable="true",bn&&e.draggable&&(e.draggable=!1,e.wasDraggable=!0),e}function Pn(e){e.contentEditable="false",e.wasDraggable&&(e.draggable=!0,e.wasDraggable=null)}function $n(e,t){if(t instanceof dt){let n=e.docView.descAt(t.from);n!=e.lastSelectedViewDesc&&(In(e),n&&n.selectNode(),e.lastSelectedViewDesc=n)}else In(e)}function In(e){e.lastSelectedViewDesc&&(e.lastSelectedViewDesc.parent&&e.lastSelectedViewDesc.deselectNode(),e.lastSelectedViewDesc=void 0)}function zn(e,t,n,r){return e.someProp("createSelectionBetween",r=>r(e,t,n))||lt.between(t,n,r)}function Ln(e){let t=e.domSelectionRange();if(!t.anchorNode)return!1;try{return e.dom.contains(3==t.anchorNode.nodeType?t.anchorNode.parentNode:t.anchorNode)&&(e.editable||e.dom.contains(3==t.focusNode.nodeType?t.focusNode.parentNode:t.focusNode))}catch(e){return!1}}function Fn(e,t){let{$anchor:n,$head:r}=e.selection,o=t>0?n.max(r):n.min(r),i=o.parent.inlineContent?o.depth?e.doc.resolve(t>0?o.after():o.before()):null:o;return i&&ot.findFrom(i,t)}function Hn(e,t){return e.dispatch(e.state.tr.setSelection(t).scrollIntoView()),!0}function jn(e,t,n){let r=e.state.selection;if(!(r instanceof lt)){if(r instanceof dt&&r.node.isInline)return Hn(e,new lt(t>0?r.$to:r.$from));{let n=Fn(e.state,t);return!!n&&Hn(e,n)}}if(n.indexOf("s")>-1){let{$head:n}=r,o=n.textOffset?null:t<0?n.nodeBefore:n.nodeAfter;if(!o||o.isText||!o.isLeaf)return!1;let i=e.state.doc.resolve(n.pos+o.nodeSize*(t<0?-1:1));return Hn(e,new lt(r.$anchor,i))}if(!r.empty)return!1;if(e.endOfTextblock(t>0?"forward":"backward")){let n=Fn(e.state,t);return!!(n&&n instanceof dt)&&Hn(e,n)}if(!(wn&&n.indexOf("m")>-1)){let n,o=r.$head,i=o.textOffset?null:t<0?o.nodeBefore:o.nodeAfter;if(!i||i.isText)return!1;let s=t<0?o.pos-i.nodeSize:o.pos;return!!(i.isAtom||(n=e.docView.descAt(s))&&!n.contentDOM)&&(dt.isSelectable(i)?Hn(e,new dt(t<0?e.state.doc.resolve(o.pos-i.nodeSize):o)):!!Cn&&Hn(e,new lt(e.state.doc.resolve(t<0?s:s+i.nodeSize))))}}function Bn(e){return 3==e.nodeType?e.nodeValue.length:e.childNodes.length}function _n(e,t){let n=e.pmViewDesc;return n&&0==n.size&&(t<0||e.nextSibling||"BR"!=e.nodeName)}function Vn(e,t){return t<0?function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=!1;for(mn&&1==n.nodeType&&r<Bn(n)&&_n(n.childNodes[r],-1)&&(s=!0);;)if(r>0){if(1!=n.nodeType)break;{let e=n.childNodes[r-1];if(_n(e,-1))o=n,i=--r;else{if(3!=e.nodeType)break;n=e,r=n.nodeValue.length}}}else{if(Wn(n))break;{let t=n.previousSibling;for(;t&&_n(t,-1);)o=n.parentNode,i=Qt(t),t=t.previousSibling;if(t)n=t,r=Bn(n);else{if(n=n.parentNode,n==e.dom)break;r=0}}}s?qn(e,n,r):o&&qn(e,o,i)}(e):function(e){let t=e.domSelectionRange(),n=t.focusNode,r=t.focusOffset;if(!n)return;let o,i,s=Bn(n);for(;;)if(r<s){if(1!=n.nodeType)break;if(!_n(n.childNodes[r],1))break;o=n,i=++r}else{if(Wn(n))break;{let t=n.nextSibling;for(;t&&_n(t,1);)o=t.parentNode,i=Qt(t)+1,t=t.nextSibling;if(t)n=t,r=0,s=Bn(n);else{if(n=n.parentNode,n==e.dom)break;r=s=0}}}o&&qn(e,o,i)}(e)}function Wn(e){let t=e.pmViewDesc;return t&&t.node&&t.node.isBlock}function qn(e,t,n){if(3!=t.nodeType){let e,r;(r=function(e,t){for(;e&&t==e.childNodes.length&&!rn(e);)t=Qt(e)+1,e=e.parentNode;for(;e&&t<e.childNodes.length;){let n=e.childNodes[t];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;e=n,t=0}}(t,n))?(t=r,n=0):(e=function(e,t){for(;e&&!t&&!rn(e);)t=Qt(e),e=e.parentNode;for(;e&&t;){let n=e.childNodes[t-1];if(3==n.nodeType)return n;if(1==n.nodeType&&"false"==n.contentEditable)break;t=(e=n).childNodes.length}}(t,n))&&(t=e,n=e.nodeValue.length)}let r=e.domSelection();if(!r)return;if(on(r)){let e=document.createRange();e.setEnd(t,n),e.setStart(t,n),r.removeAllRanges(),r.addRange(e)}else r.extend&&r.extend(t,n);e.domObserver.setCurSelection();let{state:o}=e;setTimeout(()=>{e.state==o&&En(e)},50)}function Kn(e,t){let n=e.state.doc.resolve(t);if(!vn&&!xn&&n.parent.inlineContent){let r=e.coordsAtPos(t);if(t>n.start()){let n=e.coordsAtPos(t-1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left<r.left?"ltr":"rtl"}if(t<n.end()){let n=e.coordsAtPos(t+1),o=(n.top+n.bottom)/2;if(o>r.top&&o<r.bottom&&Math.abs(n.left-r.left)>1)return n.left>r.left?"ltr":"rtl"}}return"rtl"==getComputedStyle(e.dom).direction?"rtl":"ltr"}function Jn(e,t,n){let r=e.state.selection;if(r instanceof lt&&!r.empty||n.indexOf("s")>-1)return!1;if(wn&&n.indexOf("m")>-1)return!1;let{$from:o,$to:i}=r;if(!o.parent.inlineContent||e.endOfTextblock(t<0?"up":"down")){let n=Fn(e.state,t);if(n&&n instanceof dt)return Hn(e,n)}if(!o.parent.inlineContent){let n=t<0?o:i,s=r instanceof ht?ot.near(n,t):ot.findFrom(n,t);return!!s&&Hn(e,s)}return!1}function Un(e,t){if(!(e.state.selection instanceof lt))return!0;let{$head:n,$anchor:r,empty:o}=e.state.selection;if(!n.sameParent(r))return!0;if(!o)return!1;if(e.endOfTextblock(t>0?"forward":"backward"))return!0;let i=!n.textOffset&&(t<0?n.nodeBefore:n.nodeAfter);if(i&&!i.isText){let r=e.state.tr;return t<0?r.delete(n.pos-i.nodeSize,n.pos):r.delete(n.pos,n.pos+i.nodeSize),e.dispatch(r),!0}return!1}function Gn(e,t,n){e.domObserver.stop(),t.contentEditable=n,e.domObserver.start()}function Xn(e,t){e.someProp("transformCopied",n=>{t=n(t,e)});let n=[],{content:r,openStart:o,openEnd:i}=t;for(;o>1&&i>1&&1==r.childCount&&1==r.firstChild.childCount;){o--,i--;let e=r.firstChild;n.push(e.type.name,e.attrs!=e.type.defaultAttrs?e.attrs:null),r=e.content}let s=e.someProp("clipboardSerializer")||le.fromSchema(e.state.schema),a=sr(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c,d=l.firstChild,u=0;for(;d&&1==d.nodeType&&(c=or[d.nodeName.toLowerCase()]);){for(let e=c.length-1;e>=0;e--){let t=a.createElement(c[e]);for(;l.firstChild;)t.appendChild(l.firstChild);l.appendChild(t),u++}d=l.firstChild}return d&&1==d.nodeType&&d.setAttribute("data-pm-slice",`${o} ${i}${u?` -${u}`:""} ${JSON.stringify(n)}`),{dom:l,text:e.someProp("clipboardTextSerializer",n=>n(t,e))||t.content.textBetween(0,t.content.size,"\n\n"),slice:t}}function Yn(e,t,n,r,o){let i,s,l=o.parent.type.spec.code;if(!n&&!t)return null;let c=!!t&&(r||l||!n);if(c){if(e.someProp("transformPastedText",n=>{t=n(t,l||r,e)}),l)return s=new p(a.from(e.state.schema.text(t.replace(/\r\n?/g,"\n"))),0,0),e.someProp("transformPasted",t=>{s=t(s,e,!0)}),s;let n=e.someProp("clipboardTextParser",n=>n(t,o,r,e));if(n)s=n;else{let n=o.marks(),{schema:r}=e.state,s=le.fromSchema(r);i=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(e=>{let t=i.appendChild(document.createElement("p"));e&&t.appendChild(s.serializeNode(r.text(e,n)))})}}else e.someProp("transformPastedHTML",t=>{n=t(n,e)}),i=function(e){let t=/^(\s*<meta [^>]*>)*/.exec(e);t&&(e=e.slice(t[0].length));let n,r=sr().createElement("div"),o=/<([a-z][^>\s]+)/i.exec(e);if((n=o&&or[o[1].toLowerCase()])&&(e=n.map(e=>"<"+e+">").join("")+e+n.map(e=>"</"+e+">").reverse().join("")),r.innerHTML=function(e){let t=window.trustedTypes;return t?(ar||(ar=t.defaultPolicy||t.createPolicy("ProseMirrorClipboard",{createHTML:e=>e})),ar.createHTML(e)):e}(e),n)for(let e=0;e<n.length;e++)r=r.querySelector(n[e])||r;return r}(n),Cn&&function(e){let t=e.querySelectorAll(vn?"span:not([class]):not([style])":"span.Apple-converted-space");for(let n=0;n<t.length;n++){let r=t[n];1==r.childNodes.length&&" "==r.textContent&&r.parentNode&&r.parentNode.replaceChild(e.ownerDocument.createTextNode(" "),r)}}(i);let d=i&&i.querySelector("[data-pm-slice]"),u=d&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(d.getAttribute("data-pm-slice")||"");if(u&&u[3])for(let e=+u[3];e>0;e--){let e=i.firstChild;for(;e&&1!=e.nodeType;)e=e.nextSibling;if(!e)break;i=e}if(!s){let t=e.someProp("clipboardParser")||e.someProp("domParser")||Q.fromSchema(e.state.schema);s=t.parseSlice(i,{preserveWhitespace:!(!c&&!u),context:o,ruleFromNode(e){return"BR"!=e.nodeName||e.nextSibling||!e.parentNode||Qn.test(e.parentNode.nodeName)?null:{ignore:!0}}})}if(u)s=function(e,t){if(!e.size)return e;let n,r=e.content.firstChild.type.schema;try{n=JSON.parse(t)}catch(t){return e}let{content:o,openStart:i,openEnd:s}=e;for(let e=n.length-2;e>=0;e-=2){let t=r.nodes[n[e]];if(!t||t.hasRequiredAttrs())break;o=a.from(t.create(n[e+1],o)),i++,s++}return new p(o,i,s)}(rr(s,+u[1],+u[2]),u[4]);else if(s=p.maxOpen(function(e,t){if(e.childCount<2)return e;for(let n=t.depth;n>=0;n--){let r,o=t.node(n).contentMatchAt(t.index(n)),i=[];if(e.forEach(e=>{if(!i)return;let t,n=o.findWrapping(e.type);if(!n)return i=null;if(t=i.length&&r.length&&er(n,r,e,i[i.length-1],0))i[i.length-1]=t;else{i.length&&(i[i.length-1]=tr(i[i.length-1],r.length));let t=Zn(e,n);i.push(t),o=o.matchType(t.type),r=n}}),i)return a.from(i)}return e}(s.content,o),!0),s.openStart||s.openEnd){let e=0,t=0;for(let t=s.content.firstChild;e<s.openStart&&!t.type.spec.isolating;e++,t=t.firstChild);for(let e=s.content.lastChild;t<s.openEnd&&!e.type.spec.isolating;t++,e=e.lastChild);s=rr(s,e,t)}return e.someProp("transformPasted",t=>{s=t(s,e,c)}),s}const Qn=/^(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 Zn(e,t,n=0){for(let r=t.length-1;r>=n;r--)e=t[r].create(null,a.from(e));return e}function er(e,t,n,r,o){if(o<e.length&&o<t.length&&e[o]==t[o]){let i=er(e,t,n,r.lastChild,o+1);if(i)return r.copy(r.content.replaceChild(r.childCount-1,i));if(r.contentMatchAt(r.childCount).matchType(o==e.length-1?n.type:e[o+1]))return r.copy(r.content.append(a.from(Zn(n,e,o+1))))}}function tr(e,t){if(0==t)return e;let n=e.content.replaceChild(e.childCount-1,tr(e.lastChild,t-1)),r=e.contentMatchAt(e.childCount).fillBefore(a.empty,!0);return e.copy(n.append(r))}function nr(e,t,n,r,o,i){let s=t<0?e.firstChild:e.lastChild,l=s.content;return e.childCount>1&&(i=0),o<r-1&&(l=nr(l,t,n,r,o+1,i)),o>=n&&(l=t<0?s.contentMatchAt(0).fillBefore(l,i<=o).append(l):l.append(s.contentMatchAt(s.childCount).fillBefore(a.empty,!0))),e.replaceChild(t<0?0:e.childCount-1,s.copy(l))}function rr(e,t,n){return t<e.openStart&&(e=new p(nr(e.content,-1,t,e.openStart,0,e.openEnd),t,e.openEnd)),n<e.openEnd&&(e=new p(nr(e.content,1,n,e.openEnd,0,0),e.openStart,n)),e}const or={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]};let ir=null;function sr(){return ir||(ir=document.implementation.createHTMLDocument("title"))}let ar=null;const lr={},cr={};function dr(e,t){e.input.lastSelectionOrigin=t,e.input.lastSelectionTime=Date.now()}function ur(e){return{left:e.clientX,top:e.clientY}}function hr(e,t,n,r,o){if(-1==r)return!1;let i=e.state.doc.resolve(r);for(let r=i.depth+1;r>0;r--)if(e.someProp(t,t=>r>i.depth?t(e,n,i.nodeAfter,i.before(r),o,!0):t(e,n,i.node(r),i.before(r),o,!1)))return!0;return!1}function pr(e,t,n){if(e.focused||e.focus(),e.state.selection.eq(t))return;let r=e.state.tr.setSelection(t);"pointer"==n&&r.setMeta("pointer",!0),e.dispatch(r)}function fr(e,t,n,r){return hr(e,"handleDoubleClickOn",t,n,r)||e.someProp("handleDoubleClick",n=>n(e,t,r))}function mr(e,t,n,r){return hr(e,"handleTripleClickOn",t,n,r)||e.someProp("handleTripleClick",n=>n(e,t,r))||function(e,t,n){if(0!=n.button)return!1;let r=e.state.doc;if(-1==t)return!!r.inlineContent&&(pr(e,lt.create(r,0,r.content.size),"pointer"),!0);let o=r.resolve(t);for(let t=o.depth+1;t>0;t--){let n=t>o.depth?o.nodeAfter:o.node(t),i=o.before(t);if(n.inlineContent)pr(e,lt.create(r,i+1,i+1+n.content.size),"pointer");else{if(!dt.isSelectable(n))continue;pr(e,dt.create(r,i),"pointer")}return!0}}(e,n,r)}function gr(e){return Sr(e)}cr.keydown=(e,t)=>{let n=t;if(e.input.shiftKey=16==n.keyCode||n.shiftKey,!br(e,n)&&(e.input.lastKeyCode=n.keyCode,e.input.lastKeyCodeTime=Date.now(),!Sn||!vn||13!=n.keyCode))if(229!=n.keyCode&&e.domObserver.forceFlush(),!kn||13!=n.keyCode||n.ctrlKey||n.altKey||n.metaKey)e.someProp("handleKeyDown",t=>t(e,n))||function(e,t){let n=t.keyCode,r=function(e){let t="";return e.ctrlKey&&(t+="c"),e.metaKey&&(t+="m"),e.altKey&&(t+="a"),e.shiftKey&&(t+="s"),t}(t);if(8==n||wn&&72==n&&"c"==r)return Un(e,-1)||Vn(e,-1);if(46==n&&!t.shiftKey||wn&&68==n&&"c"==r)return Un(e,1)||Vn(e,1);if(13==n||27==n)return!0;if(37==n||wn&&66==n&&"c"==r){let t=37==n?"ltr"==Kn(e,e.state.selection.from)?-1:1:-1;return jn(e,t,r)||Vn(e,t)}if(39==n||wn&&70==n&&"c"==r){let t=39==n?"ltr"==Kn(e,e.state.selection.from)?1:-1:1;return jn(e,t,r)||Vn(e,t)}return 38==n||wn&&80==n&&"c"==r?Jn(e,-1,r)||Vn(e,-1):40==n||wn&&78==n&&"c"==r?function(e){if(!bn||e.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(t&&1==t.nodeType&&0==n&&t.firstChild&&"false"==t.firstChild.contentEditable){let n=t.firstChild;Gn(e,n,"true"),setTimeout(()=>Gn(e,n,"false"),20)}return!1}(e)||Jn(e,1,r)||Vn(e,1):r==(wn?"m":"c")&&(66==n||73==n||89==n||90==n)}(e,n)?n.preventDefault():dr(e,"key");else{let t=Date.now();e.input.lastIOSEnter=t,e.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{e.input.lastIOSEnter==t&&(e.someProp("handleKeyDown",t=>t(e,sn(13,"Enter"))),e.input.lastIOSEnter=0)},200)}},cr.keyup=(e,t)=>{16==t.keyCode&&(e.input.shiftKey=!1)},cr.keypress=(e,t)=>{let n=t;if(br(e,n)||!n.charCode||n.ctrlKey&&!n.altKey||wn&&n.metaKey)return;if(e.someProp("handleKeyPress",t=>t(e,n)))return void n.preventDefault();let r=e.state.selection;if(!(r instanceof lt&&r.$from.sameParent(r.$to))){let t=String.fromCharCode(n.charCode),o=()=>e.state.tr.insertText(t).scrollIntoView();/[\r\n]/.test(t)||e.someProp("handleTextInput",n=>n(e,r.$from.pos,r.$to.pos,t,o))||e.dispatch(o()),n.preventDefault()}};const vr=wn?"metaKey":"ctrlKey";lr.mousedown=(e,t)=>{let n=t;e.input.shiftKey=n.shiftKey;let r=gr(e),o=Date.now(),i="singleClick";o-e.input.lastClick.time<500&&function(e,t){let n=t.x-e.clientX,r=t.y-e.clientY;return n*n+r*r<100}(n,e.input.lastClick)&&!n[vr]&&e.input.lastClick.button==n.button&&("singleClick"==e.input.lastClick.type?i="doubleClick":"doubleClick"==e.input.lastClick.type&&(i="tripleClick")),e.input.lastClick={time:o,x:n.clientX,y:n.clientY,type:i,button:n.button};let s=e.posAtCoords(ur(n));s&&("singleClick"==i?(e.input.mouseDown&&e.input.mouseDown.done(),e.input.mouseDown=new yr(e,s,n,!!r)):("doubleClick"==i?fr:mr)(e,s.pos,s.inside,n)?n.preventDefault():dr(e,"pointer"))};class yr{constructor(e,t,n,r){let o,i;if(this.view=e,this.pos=t,this.event=n,this.flushed=r,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=e.state.doc,this.selectNode=!!n[vr],this.allowDefault=n.shiftKey,t.inside>-1)o=e.state.doc.nodeAt(t.inside),i=t.inside;else{let n=e.state.doc.resolve(t.pos);o=n.parent,i=n.depth?n.before():0}const s=r?null:n.target,a=s?e.docView.nearestDesc(s,!0):null;this.target=a&&1==a.nodeDOM.nodeType?a.nodeDOM:null;let{selection:l}=e.state;(0==n.button&&o.type.spec.draggable&&!1!==o.type.spec.selectable||l instanceof dt&&l.from<=i&&l.to>i)&&(this.mightDrag={node:o,pos:i,addAttr:!(!this.target||this.target.draggable),setUneditable:!(!this.target||!mn||this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),e.root.addEventListener("mouseup",this.up=this.up.bind(this)),e.root.addEventListener("mousemove",this.move=this.move.bind(this)),dr(e,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>En(this.view)),this.view.input.mouseDown=null}up(e){if(this.done(),!this.view.dom.contains(e.target))return;let t=this.pos;this.view.state.doc!=this.startDoc&&(t=this.view.posAtCoords(ur(e))),this.updateAllowDefault(e),this.allowDefault||!t?dr(this.view,"pointer"):function(e,t,n,r,o){return hr(e,"handleClickOn",t,n,r)||e.someProp("handleClick",n=>n(e,t,r))||(o?function(e,t){if(-1==t)return!1;let n,r,o=e.state.selection;o instanceof dt&&(n=o.node);let i=e.state.doc.resolve(t);for(let e=i.depth+1;e>0;e--){let t=e>i.depth?i.nodeAfter:i.node(e);if(dt.isSelectable(t)){r=n&&o.$from.depth>0&&e>=o.$from.depth&&i.before(o.$from.depth+1)==o.$from.pos?i.before(o.$from.depth):i.before(e);break}}return null!=r&&(pr(e,dt.create(e.state.doc,r),"pointer"),!0)}(e,n):function(e,t){if(-1==t)return!1;let n=e.state.doc.resolve(t),r=n.nodeAfter;return!!(r&&r.isAtom&&dt.isSelectable(r))&&(pr(e,new dt(n),"pointer"),!0)}(e,n))}(this.view,t.pos,t.inside,e,this.selectNode)?e.preventDefault():0==e.button&&(this.flushed||bn&&this.mightDrag&&!this.mightDrag.node.isAtom||vn&&!this.view.state.selection.visible&&Math.min(Math.abs(t.pos-this.view.state.selection.from),Math.abs(t.pos-this.view.state.selection.to))<=2)?(pr(this.view,ot.near(this.view.state.doc.resolve(t.pos)),"pointer"),e.preventDefault()):dr(this.view,"pointer")}move(e){this.updateAllowDefault(e),dr(this.view,"pointer"),0==e.buttons&&this.done()}updateAllowDefault(e){!this.allowDefault&&(Math.abs(this.event.x-e.clientX)>4||Math.abs(this.event.y-e.clientY)>4)&&(this.allowDefault=!0)}}function br(e,t){return!!e.composing||!!(bn&&Math.abs(t.timeStamp-e.input.compositionEndedAt)<500)&&(e.input.compositionEndedAt=-2e8,!0)}lr.touchstart=e=>{e.input.lastTouch=Date.now(),gr(e),dr(e,"pointer")},lr.touchmove=e=>{e.input.lastTouch=Date.now(),dr(e,"pointer")},lr.contextmenu=e=>gr(e);const kr=Sn?5e3:-1;function wr(e,t){clearTimeout(e.input.composingTimeout),t>-1&&(e.input.composingTimeout=setTimeout(()=>Sr(e),t))}function xr(e){for(e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=function(){let e=document.createEvent("Event");return e.initEvent("event",!0,!0),e.timeStamp}());e.input.compositionNodes.length>0;)e.input.compositionNodes.pop().markParentsDirty()}function Sr(e,t=!1){if(!(Sn&&e.domObserver.flushingSoon>=0)){if(e.domObserver.forceFlush(),xr(e),t||e.docView&&e.docView.dirty){let n=An(e),r=e.state.selection;return n&&!n.eq(r)?e.dispatch(e.state.tr.setSelection(n)):!e.markCursor&&!t||r.$from.node(r.$from.sharedDepth(r.to)).inlineContent?e.updateState(e.state):e.dispatch(e.state.tr.deleteSelection()),!0}return!1}}cr.compositionstart=cr.compositionupdate=e=>{if(!e.composing){e.domObserver.flush();let{state:t}=e,n=t.selection.$to;if(t.selection instanceof lt&&(t.storedMarks||!n.textOffset&&n.parentOffset&&n.nodeBefore.marks.some(e=>!1===e.type.spec.inclusive)||vn&&xn&&function(e){let{focusNode:t,focusOffset:n}=e.domSelectionRange();if(!t||1!=t.nodeType||n>=t.childNodes.length)return!1;let r=t.childNodes[n];return 1==r.nodeType&&"false"==r.contentEditable}(e)))e.markCursor=e.state.storedMarks||n.marks(),Sr(e,!0),e.markCursor=null;else if(Sr(e,!t.selection.empty),mn&&t.selection.empty&&n.parentOffset&&!n.textOffset&&n.nodeBefore.marks.length){let t=e.domSelectionRange();for(let n=t.focusNode,r=t.focusOffset;n&&1==n.nodeType&&0!=r;){let t=r<0?n.lastChild:n.childNodes[r-1];if(!t)break;if(3==t.nodeType){let n=e.domSelection();n&&n.collapse(t,t.nodeValue.length);break}n=t,r=-1}}e.input.composing=!0}wr(e,kr)},cr.compositionend=(e,t)=>{e.composing&&(e.input.composing=!1,e.input.compositionEndedAt=t.timeStamp,e.input.compositionPendingChanges=e.domObserver.pendingRecords().length?e.input.compositionID:0,e.input.compositionNode=null,e.input.badSafariComposition?e.domObserver.forceFlush():e.input.compositionPendingChanges&&Promise.resolve().then(()=>e.domObserver.flush()),e.input.compositionID++,wr(e,20))};const Cr=pn&&fn<15||kn&&Mn<604;function Mr(e,t,n,r,o){let i=Yn(e,t,n,r,e.state.selection.$from);if(e.someProp("handlePaste",t=>t(e,o,i||p.empty)))return!0;if(!i)return!1;let s=function(e){return 0==e.openStart&&0==e.openEnd&&1==e.content.childCount?e.content.firstChild:null}(i),a=s?e.state.tr.replaceSelectionWith(s,r):e.state.tr.replaceSelection(i);return e.dispatch(a.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}function Tr(e){let t=e.getData("text/plain")||e.getData("Text");if(t)return t;let n=e.getData("text/uri-list");return n?n.replace(/\r?\n/g," "):""}lr.copy=cr.cut=(e,t)=>{let n=t,r=e.state.selection,o="cut"==n.type;if(r.empty)return;let i=Cr?null:n.clipboardData,s=r.content(),{dom:a,text:l}=Xn(e,s);i?(n.preventDefault(),i.clearData(),i.setData("text/html",a.innerHTML),i.setData("text/plain",l)):function(e,t){if(!e.dom.parentNode)return;let n=e.dom.parentNode.appendChild(document.createElement("div"));n.appendChild(t),n.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),o=document.createRange();o.selectNodeContents(t),e.dom.blur(),r.removeAllRanges(),r.addRange(o),setTimeout(()=>{n.parentNode&&n.parentNode.removeChild(n),e.focus()},50)}(e,a),o&&e.dispatch(e.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))},cr.paste=(e,t)=>{let n=t;if(e.composing&&!Sn)return;let r=Cr?null:n.clipboardData,o=e.input.shiftKey&&45!=e.input.lastKeyCode;r&&Mr(e,Tr(r),r.getData("text/html"),o,n)?n.preventDefault():function(e,t){if(!e.dom.parentNode)return;let n=e.input.shiftKey||e.state.selection.$from.parent.type.spec.code,r=e.dom.parentNode.appendChild(document.createElement(n?"textarea":"div"));n||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus();let o=e.input.shiftKey&&45!=e.input.lastKeyCode;setTimeout(()=>{e.focus(),r.parentNode&&r.parentNode.removeChild(r),n?Mr(e,r.value,null,o,t):Mr(e,r.textContent,r.innerHTML,o,t)},50)}(e,n)};class Ar{constructor(e,t,n){this.slice=e,this.move=t,this.node=n}}const Or=wn?"altKey":"ctrlKey";function Er(e,t){let n=e.someProp("dragCopies",e=>!e(t));return null!=n?n:!t[Or]}lr.dragstart=(e,t)=>{let n=t,r=e.input.mouseDown;if(r&&r.done(),!n.dataTransfer)return;let o,i=e.state.selection,s=i.empty?null:e.posAtCoords(ur(n));if(s&&s.pos>=i.from&&s.pos<=(i instanceof dt?i.to-1:i.to));else if(r&&r.mightDrag)o=dt.create(e.state.doc,r.mightDrag.pos);else if(n.target&&1==n.target.nodeType){let t=e.docView.nearestDesc(n.target,!0);t&&t.node.type.spec.draggable&&t!=e.docView&&(o=dt.create(e.state.doc,t.posBefore))}let a=(o||e.state.selection).content(),{dom:l,text:c,slice:d}=Xn(e,a);(!n.dataTransfer.files.length||!vn||yn>120)&&n.dataTransfer.clearData(),n.dataTransfer.setData(Cr?"Text":"text/html",l.innerHTML),n.dataTransfer.effectAllowed="copyMove",Cr||n.dataTransfer.setData("text/plain",c),e.dragging=new Ar(d,Er(e,n),o)},lr.dragend=e=>{let t=e.dragging;window.setTimeout(()=>{e.dragging==t&&(e.dragging=null)},50)},cr.dragover=cr.dragenter=(e,t)=>t.preventDefault(),cr.drop=(e,t)=>{try{!function(e,t,n){if(!t.dataTransfer)return;let r=e.posAtCoords(ur(t));if(!r)return;let o=e.state.doc.resolve(r.pos),i=n&&n.slice;i?e.someProp("transformPasted",t=>{i=t(i,e,!1)}):i=Yn(e,Tr(t.dataTransfer),Cr?null:t.dataTransfer.getData("text/html"),!1,o);let s=!(!n||!Er(e,t));if(e.someProp("handleDrop",n=>n(e,t,i||p.empty,s)))return void t.preventDefault();if(!i)return;t.preventDefault();let a=i?Be(e.state.doc,o.pos,i):o.pos;null==a&&(a=o.pos);let l=e.state.tr;if(s){let{node:e}=n;e?e.replace(l):l.deleteSelection()}let c=l.mapping.map(a),d=0==i.openStart&&0==i.openEnd&&1==i.content.childCount,u=l.doc;if(d?l.replaceRangeWith(c,c,i.content.firstChild):l.replaceRange(c,c,i),l.doc.eq(u))return;let h=l.doc.resolve(c);if(d&&dt.isSelectable(i.content.firstChild)&&h.nodeAfter&&h.nodeAfter.sameMarkup(i.content.firstChild))l.setSelection(new dt(h));else{let t=l.mapping.map(a);l.mapping.maps[l.mapping.maps.length-1].forEach((e,n,r,o)=>t=o),l.setSelection(zn(e,h,l.doc.resolve(t)))}e.focus(),e.dispatch(l.setMeta("uiEvent","drop"))}(e,t,e.dragging)}finally{e.dragging=null}},lr.focus=e=>{e.input.lastFocus=Date.now(),e.focused||(e.domObserver.stop(),e.dom.classList.add("ProseMirror-focused"),e.domObserver.start(),e.focused=!0,setTimeout(()=>{e.docView&&e.hasFocus()&&!e.domObserver.currentSelection.eq(e.domSelectionRange())&&En(e)},20))},lr.blur=(e,t)=>{let n=t;e.focused&&(e.domObserver.stop(),e.dom.classList.remove("ProseMirror-focused"),e.domObserver.start(),n.relatedTarget&&e.dom.contains(n.relatedTarget)&&e.domObserver.currentSelection.clear(),e.focused=!1)},lr.beforeinput=(e,t)=>{if(vn&&Sn&&"deleteContentBackward"==t.inputType){e.domObserver.flushSoon();let{domChangeCount:t}=e.input;setTimeout(()=>{if(e.input.domChangeCount!=t)return;if(e.dom.blur(),e.focus(),e.someProp("handleKeyDown",t=>t(e,sn(8,"Backspace"))))return;let{$cursor:n}=e.state.selection;n&&n.pos>0&&e.dispatch(e.state.tr.delete(n.pos-1,n.pos).scrollIntoView())},50)}};for(let e in cr)lr[e]=cr[e];function Nr(e,t){if(e==t)return!0;for(let n in e)if(e[n]!==t[n])return!1;for(let n in t)if(!(n in e))return!1;return!0}class Rr{constructor(e,t){this.toDOM=e,this.spec=t||zr,this.side=this.spec.side||0}map(e,t,n,r){let{pos:o,deleted:i}=e.mapResult(t.from+r,this.side<0?-1:1);return i?null:new $r(o-n,o-n,this)}valid(){return!0}eq(e){return this==e||e instanceof Rr&&(this.spec.key&&this.spec.key==e.spec.key||this.toDOM==e.toDOM&&Nr(this.spec,e.spec))}destroy(e){this.spec.destroy&&this.spec.destroy(e)}}class Dr{constructor(e,t){this.attrs=e,this.spec=t||zr}map(e,t,n,r){let o=e.map(t.from+r,this.spec.inclusiveStart?-1:1)-n,i=e.map(t.to+r,this.spec.inclusiveEnd?1:-1)-n;return o>=i?null:new $r(o,i,this)}valid(e,t){return t.from<t.to}eq(e){return this==e||e instanceof Dr&&Nr(this.attrs,e.attrs)&&Nr(this.spec,e.spec)}static is(e){return e.type instanceof Dr}destroy(){}}class Pr{constructor(e,t){this.attrs=e,this.spec=t||zr}map(e,t,n,r){let o=e.mapResult(t.from+r,1);if(o.deleted)return null;let i=e.mapResult(t.to+r,-1);return i.deleted||i.pos<=o.pos?null:new $r(o.pos-n,i.pos-n,this)}valid(e,t){let n,{index:r,offset:o}=e.content.findIndex(t.from);return o==t.from&&!(n=e.child(r)).isText&&o+n.nodeSize==t.to}eq(e){return this==e||e instanceof Pr&&Nr(this.attrs,e.attrs)&&Nr(this.spec,e.spec)}destroy(){}}class $r{constructor(e,t,n){this.from=e,this.to=t,this.type=n}copy(e,t){return new $r(e,t,this.type)}eq(e,t=0){return this.type.eq(e.type)&&this.from+t==e.from&&this.to+t==e.to}map(e,t,n){return this.type.map(e,this,t,n)}static widget(e,t,n){return new $r(e,e,new Rr(t,n))}static inline(e,t,n,r){return new $r(e,t,new Dr(n,r))}static node(e,t,n,r){return new $r(e,t,new Pr(n,r))}get spec(){return this.type.spec}get inline(){return this.type instanceof Dr}get widget(){return this.type instanceof Rr}}const Ir=[],zr={};class Lr{constructor(e,t){this.local=e.length?e:Ir,this.children=t.length?t:Ir}static create(e,t){return t.length?Vr(t,e,0,zr):Fr}find(e,t,n){let r=[];return this.findInner(null==e?0:e,null==t?1e9:t,r,0,n),r}findInner(e,t,n,r,o){for(let i=0;i<this.local.length;i++){let s=this.local[i];s.from<=t&&s.to>=e&&(!o||o(s.spec))&&n.push(s.copy(s.from+r,s.to+r))}for(let i=0;i<this.children.length;i+=3)if(this.children[i]<t&&this.children[i+1]>e){let s=this.children[i]+1;this.children[i+2].findInner(e-s,t-s,n,r+s,o)}}map(e,t,n){return this==Fr||0==e.maps.length?this:this.mapInner(e,t,0,0,n||zr)}mapInner(e,t,n,r,o){let i;for(let s=0;s<this.local.length;s++){let a=this.local[s].map(e,n,r);a&&a.type.valid(t,a)?(i||(i=[])).push(a):o.onRemove&&o.onRemove(this.local[s].spec)}return this.children.length?function(e,t,n,r,o,i,s){let a=e.slice();for(let e=0,t=i;e<n.maps.length;e++){let r=0;n.maps[e].forEach((e,n,o,i)=>{let s=i-o-(n-e);for(let o=0;o<a.length;o+=3){let i=a[o+1];if(i<0||e>i+t-r)continue;let l=a[o]+t-r;n>=l?a[o+1]=e<=l?-2:-1:e>=t&&s&&(a[o]+=s,a[o+1]+=s)}r+=s}),t=n.maps[e].map(t,-1)}let l=!1;for(let t=0;t<a.length;t+=3)if(a[t+1]<0){if(-2==a[t+1]){l=!0,a[t+1]=-1;continue}let c=n.map(e[t]+i),d=c-o;if(d<0||d>=r.content.size){l=!0;continue}let u=n.map(e[t+1]+i,-1)-o,{index:h,offset:p}=r.content.findIndex(d),f=r.maybeChild(h);if(f&&p==d&&p+f.nodeSize==u){let r=a[t+2].mapInner(n,f,c+1,e[t]+i+1,s);r!=Fr?(a[t]=d,a[t+1]=u,a[t+2]=r):(a[t+1]=-2,l=!0)}else l=!0}if(l){let l=function(e,t,n,r,o,i,s){function a(e,t){for(let i=0;i<e.local.length;i++){let a=e.local[i].map(r,o,t);a?n.push(a):s.onRemove&&s.onRemove(e.local[i].spec)}for(let n=0;n<e.children.length;n+=3)a(e.children[n+2],e.children[n]+t+1)}for(let n=0;n<e.length;n+=3)-1==e[n+1]&&a(e[n+2],t[n]+i+1);return n}(a,e,t,n,o,i,s),c=Vr(l,r,0,s);t=c.local;for(let e=0;e<a.length;e+=3)a[e+1]<0&&(a.splice(e,3),e-=3);for(let e=0,t=0;e<c.children.length;e+=3){let n=c.children[e];for(;t<a.length&&a[t]<n;)t+=3;a.splice(t,0,c.children[e],c.children[e+1],c.children[e+2])}}return new Lr(t.sort(Wr),a)}(this.children,i||[],e,t,n,r,o):i?new Lr(i.sort(Wr),Ir):Fr}add(e,t){return t.length?this==Fr?Lr.create(e,t):this.addInner(e,t,0):this}addInner(e,t,n){let r,o=0;e.forEach((e,i)=>{let s,a=i+n;if(s=Br(t,e,a)){for(r||(r=this.children.slice());o<r.length&&r[o]<i;)o+=3;r[o]==i?r[o+2]=r[o+2].addInner(e,s,a+1):r.splice(o,0,i,i+e.nodeSize,Vr(s,e,a+1,zr)),o+=3}});let i=jr(o?_r(t):t,-n);for(let t=0;t<i.length;t++)i[t].type.valid(e,i[t])||i.splice(t--,1);return new Lr(i.length?this.local.concat(i).sort(Wr):this.local,r||this.children)}remove(e){return 0==e.length||this==Fr?this:this.removeInner(e,0)}removeInner(e,t){let n=this.children,r=this.local;for(let r=0;r<n.length;r+=3){let o,i=n[r]+t,s=n[r+1]+t;for(let t,n=0;n<e.length;n++)(t=e[n])&&t.from>i&&t.to<s&&(e[n]=null,(o||(o=[])).push(t));if(!o)continue;n==this.children&&(n=this.children.slice());let a=n[r+2].removeInner(o,i+1);a!=Fr?n[r+2]=a:(n.splice(r,3),r-=3)}if(r.length)for(let n,o=0;o<e.length;o++)if(n=e[o])for(let e=0;e<r.length;e++)r[e].eq(n,t)&&(r==this.local&&(r=this.local.slice()),r.splice(e--,1));return n==this.children&&r==this.local?this:r.length||n.length?new Lr(r,n):Fr}forChild(e,t){if(this==Fr)return this;if(t.isLeaf)return Lr.empty;let n,r;for(let t=0;t<this.children.length;t+=3)if(this.children[t]>=e){this.children[t]==e&&(n=this.children[t+2]);break}let o=e+1,i=o+t.content.size;for(let e=0;e<this.local.length;e++){let t=this.local[e];if(t.from<i&&t.to>o&&t.type instanceof Dr){let e=Math.max(o,t.from)-o,n=Math.min(i,t.to)-o;e<n&&(r||(r=[])).push(t.copy(e,n))}}if(r){let e=new Lr(r.sort(Wr),Ir);return n?new Hr([e,n]):e}return n||Fr}eq(e){if(this==e)return!0;if(!(e instanceof Lr)||this.local.length!=e.local.length||this.children.length!=e.children.length)return!1;for(let t=0;t<this.local.length;t++)if(!this.local[t].eq(e.local[t]))return!1;for(let t=0;t<this.children.length;t+=3)if(this.children[t]!=e.children[t]||this.children[t+1]!=e.children[t+1]||!this.children[t+2].eq(e.children[t+2]))return!1;return!0}locals(e){return qr(this.localsInner(e))}localsInner(e){if(this==Fr)return Ir;if(e.inlineContent||!this.local.some(Dr.is))return this.local;let t=[];for(let e=0;e<this.local.length;e++)this.local[e].type instanceof Dr||t.push(this.local[e]);return t}forEachSet(e){e(this)}}Lr.empty=new Lr([],[]),Lr.removeOverlap=qr;const Fr=Lr.empty;class Hr{constructor(e){this.members=e}map(e,t){const n=this.members.map(n=>n.map(e,t,zr));return Hr.from(n)}forChild(e,t){if(t.isLeaf)return Lr.empty;let n=[];for(let r=0;r<this.members.length;r++){let o=this.members[r].forChild(e,t);o!=Fr&&(o instanceof Hr?n=n.concat(o.members):n.push(o))}return Hr.from(n)}eq(e){if(!(e instanceof Hr)||e.members.length!=this.members.length)return!1;for(let t=0;t<this.members.length;t++)if(!this.members[t].eq(e.members[t]))return!1;return!0}locals(e){let t,n=!0;for(let r=0;r<this.members.length;r++){let o=this.members[r].localsInner(e);if(o.length)if(t){n&&(t=t.slice(),n=!1);for(let e=0;e<o.length;e++)t.push(o[e])}else t=o}return t?qr(n?t:t.sort(Wr)):Ir}static from(e){switch(e.length){case 0:return Fr;case 1:return e[0];default:return new Hr(e.every(e=>e instanceof Lr)?e:e.reduce((e,t)=>e.concat(t instanceof Lr?t:t.members),[]))}}forEachSet(e){for(let t=0;t<this.members.length;t++)this.members[t].forEachSet(e)}}function jr(e,t){if(!t||!e.length)return e;let n=[];for(let r=0;r<e.length;r++){let o=e[r];n.push(new $r(o.from+t,o.to+t,o.type))}return n}function Br(e,t,n){if(t.isLeaf)return null;let r=n+t.nodeSize,o=null;for(let t,i=0;i<e.length;i++)(t=e[i])&&t.from>n&&t.to<r&&((o||(o=[])).push(t),e[i]=null);return o}function _r(e){let t=[];for(let n=0;n<e.length;n++)null!=e[n]&&t.push(e[n]);return t}function Vr(e,t,n,r){let o=[],i=!1;t.forEach((t,s)=>{let a=Br(e,t,s+n);if(a){i=!0;let e=Vr(a,t,n+s+1,r);e!=Fr&&o.push(s,s+t.nodeSize,e)}});let s=jr(i?_r(e):e,-n).sort(Wr);for(let e=0;e<s.length;e++)s[e].type.valid(t,s[e])||(r.onRemove&&r.onRemove(s[e].spec),s.splice(e--,1));return s.length||o.length?new Lr(s,o):Fr}function Wr(e,t){return e.from-t.from||e.to-t.to}function qr(e){let t=e;for(let n=0;n<t.length-1;n++){let r=t[n];if(r.from!=r.to)for(let o=n+1;o<t.length;o++){let i=t[o];if(i.from!=r.from){i.from<r.to&&(t==e&&(t=e.slice()),t[n]=r.copy(r.from,i.from),Kr(t,o,r.copy(i.from,r.to)));break}i.to!=r.to&&(t==e&&(t=e.slice()),t[o]=i.copy(i.from,r.to),Kr(t,o+1,i.copy(r.to,i.to)))}}return t}function Kr(e,t,n){for(;t<e.length&&Wr(n,e[t])>0;)t++;e.splice(t,0,n)}new WeakMap;for(var Jr={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:"'"},Ur={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},Gr="undefined"!=typeof navigator&&/Mac/.test(navigator.platform),Xr="undefined"!=typeof navigator&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent),Yr=0;Yr<10;Yr++)Jr[48+Yr]=Jr[96+Yr]=String(Yr);for(Yr=1;Yr<=24;Yr++)Jr[Yr+111]="F"+Yr;for(Yr=65;Yr<=90;Yr++)Jr[Yr]=String.fromCharCode(Yr+32),Ur[Yr]=String.fromCharCode(Yr);for(var Qr in Jr)Ur.hasOwnProperty(Qr)||(Ur[Qr]=Jr[Qr]);const Zr="undefined"!=typeof navigator&&/Mac|iP(hone|[oa]d)/.test(navigator.platform),eo="undefined"!=typeof navigator&&/Win/.test(navigator.platform);function to(e){let t,n,r,o,i=e.split(/-(?!$)/),s=i[i.length-1];"Space"==s&&(s=" ");for(let e=0;e<i.length-1;e++){let s=i[e];if(/^(cmd|meta|m)$/i.test(s))o=!0;else if(/^a(lt)?$/i.test(s))t=!0;else if(/^(c|ctrl|control)$/i.test(s))n=!0;else if(/^s(hift)?$/i.test(s))r=!0;else{if(!/^mod$/i.test(s))throw new Error("Unrecognized modifier name: "+s);Zr?o=!0:n=!0}}return t&&(s="Alt-"+s),n&&(s="Ctrl-"+s),o&&(s="Meta-"+s),r&&(s="Shift-"+s),s}function no(e,t,n=!0){return t.altKey&&(e="Alt-"+e),t.ctrlKey&&(e="Ctrl-"+e),t.metaKey&&(e="Meta-"+e),n&&t.shiftKey&&(e="Shift-"+e),e}function ro(e){let t=function(e){let t=Object.create(null);for(let n in e)t[to(n)]=e[n];return t}(e);return function(e,n){let r,o=function(e){var t=!(Gr&&e.metaKey&&e.shiftKey&&!e.ctrlKey&&!e.altKey||Xr&&e.shiftKey&&e.key&&1==e.key.length||"Unidentified"==e.key)&&e.key||(e.shiftKey?Ur:Jr)[e.keyCode]||e.key||"Unidentified";return"Esc"==t&&(t="Escape"),"Del"==t&&(t="Delete"),"Left"==t&&(t="ArrowLeft"),"Up"==t&&(t="ArrowUp"),"Right"==t&&(t="ArrowRight"),"Down"==t&&(t="ArrowDown"),t}(n),i=t[no(o,n)];if(i&&i(e.state,e.dispatch,e))return!0;if(1==o.length&&" "!=o){if(n.shiftKey){let r=t[no(o,n,!1)];if(r&&r(e.state,e.dispatch,e))return!0}if((n.altKey||n.metaKey||n.ctrlKey)&&!(eo&&n.ctrlKey&&n.altKey)&&(r=Jr[n.keyCode])&&r!=o){let o=t[no(r,n)];if(o&&o(e.state,e.dispatch,e))return!0}}return!1}}var oo=Object.defineProperty,io=(e,t)=>{for(var n in t)oo(e,n,{get:t[n],enumerable:!0})};function so(e){const{state:t,transaction:n}=e;let{selection:r}=n,{doc:o}=n,{storedMarks:i}=n;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return i},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,i=n.storedMarks,n}}}var ao=class{constructor(e){this.editor=e.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=e.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:e,editor:t,state:n}=this,{view:r}=t,{tr:o}=n,i=this.buildProps(o);return Object.fromEntries(Object.entries(e).map(([e,t])=>[e,(...e)=>{const n=t(...e)(i);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s=[],a=!!e,l=e||o.tr,c={...Object.fromEntries(Object.entries(n).map(([e,n])=>[e,(...e)=>{const r=this.buildProps(l,t),o=n(...e)(r);return s.push(o),c}])),run:()=>(a||!t||l.getMeta("preventDispatch")||this.hasCustomState||i.dispatch(l),s.every(e=>!0===e))};return c}createCan(e){const{rawCommands:t,state:n}=this,r=!1,o=e||n.tr,i=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(t).map(([e,t])=>[e,(...e)=>t(...e)({...i,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(e,t=!0){const{rawCommands:n,editor:r,state:o}=this,{view:i}=r,s={tr:e,editor:r,view:i,state:so({state:o,transaction:e}),dispatch:t?()=>{}:void 0,chain:()=>this.createChain(e,t),can:()=>this.createCan(e),get commands(){return Object.fromEntries(Object.entries(n).map(([e,t])=>[e,(...e)=>t(...e)(s)]))}};return s}},lo={};io(lo,{blur:()=>co,clearContent:()=>uo,clearNodes:()=>ho,command:()=>po,createParagraphNear:()=>fo,cut:()=>mo,deleteCurrentNode:()=>go,deleteNode:()=>yo,deleteRange:()=>bo,deleteSelection:()=>ko,enter:()=>wo,exitCode:()=>xo,extendMarkRange:()=>Eo,first:()=>No,focus:()=>Io,forEach:()=>zo,insertContent:()=>Lo,insertContentAt:()=>Bo,joinBackward:()=>Wo,joinDown:()=>Vo,joinForward:()=>qo,joinItemBackward:()=>Ko,joinItemForward:()=>Jo,joinTextblockBackward:()=>Uo,joinTextblockForward:()=>Go,joinUp:()=>_o,keyboardShortcut:()=>Yo,lift:()=>Zo,liftEmptyBlock:()=>ei,liftListItem:()=>ti,newlineInCode:()=>ni,resetAttributes:()=>ii,scrollIntoView:()=>si,selectAll:()=>ai,selectNodeBackward:()=>li,selectNodeForward:()=>ci,selectParentNode:()=>di,selectTextblockEnd:()=>ui,selectTextblockStart:()=>hi,setContent:()=>pi,setMark:()=>ji,setMeta:()=>Bi,setNode:()=>_i,setNodeSelection:()=>Vi,setTextDirection:()=>Wi,setTextSelection:()=>qi,sinkListItem:()=>Ki,splitBlock:()=>Ui,splitListItem:()=>Gi,toggleList:()=>Qi,toggleMark:()=>Zi,toggleNode:()=>es,toggleWrap:()=>ts,undoInputRule:()=>ns,unsetAllMarks:()=>rs,unsetMark:()=>is,unsetTextDirection:()=>ss,updateAttributes:()=>as,wrapIn:()=>ls,wrapInList:()=>cs});var co=()=>({editor:e,view:t})=>(requestAnimationFrame(()=>{var n;e.isDestroyed||(t.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),uo=(e=!0)=>({commands:t})=>t.setContent("",{emitUpdate:e}),ho=()=>({state:e,tr:t,dispatch:n})=>{const{selection:r}=t,{ranges:o}=r;return!n||(o.forEach(({$from:n,$to:r})=>{e.doc.nodesBetween(n.pos,r.pos,(e,n)=>{if(e.type.isText)return;const{doc:r,mapping:o}=t,i=r.resolve(o.map(n)),s=r.resolve(o.map(n+e.nodeSize)),a=i.blockRange(s);if(!a)return;const l=De(a);if(e.type.isTextblock){const{defaultType:e}=i.parent.contentMatchAt(i.index());t.setNodeMarkup(a.start,e)}(l||0===l)&&t.lift(a,l)})}),!0)},po=e=>t=>e(t),fo=()=>({state:e,dispatch:t})=>Lt(e,t),mo=(e,t)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(e.from,e.to);r.deleteRange(e.from,e.to);const s=r.mapping.map(t);return r.insert(s,i.content),r.setSelection(new lt(r.doc.resolve(Math.max(s-1,0)))),!0},go=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,r=n.$anchor.node();if(r.content.size>0)return!1;const o=e.selection.$anchor;for(let n=o.depth;n>0;n-=1)if(o.node(n).type===r.type){if(t){const t=o.before(n),r=o.after(n);e.delete(t,r).scrollIntoView()}return!0}return!1};function vo(e,t){if("string"==typeof e){if(!t.nodes[e])throw Error(`There is no node type named '${e}'. Maybe you forgot to add the extension?`);return t.nodes[e]}return e}var yo=e=>({tr:t,state:n,dispatch:r})=>{const o=vo(e,n.schema),i=t.selection.$anchor;for(let e=i.depth;e>0;e-=1)if(i.node(e).type===o){if(r){const n=i.before(e),r=i.after(e);t.delete(n,r).scrollIntoView()}return!0}return!1},bo=e=>({tr:t,dispatch:n})=>{const{from:r,to:o}=e;return n&&t.delete(r,o),!0},ko=()=>({state:e,dispatch:t})=>St(e,t),wo=()=>({commands:e})=>e.keyboardShortcut("Enter"),xo=()=>({state:e,dispatch:t})=>zt(e,t);function So(e){return"[object RegExp]"===Object.prototype.toString.call(e)}function Co(e,t,n={strict:!0}){const r=Object.keys(t);return!r.length||r.every(r=>n.strict?t[r]===e[r]:So(t[r])?t[r].test(e[r]):t[r]===e[r])}function Mo(e,t,n={}){return e.find(e=>e.type===t&&Co(Object.fromEntries(Object.keys(n).map(t=>[t,e.attrs[t]])),n))}function To(e,t,n={}){return!!Mo(e,t,n)}function Ao(e,t,n){var r;if(!e||!t)return;let o=e.parent.childAfter(e.parentOffset);if(o.node&&o.node.marks.some(e=>e.type===t)||(o=e.parent.childBefore(e.parentOffset)),!o.node||!o.node.marks.some(e=>e.type===t))return;if(n=n||(null==(r=o.node.marks[0])?void 0:r.attrs),!Mo([...o.node.marks],t,n))return;let i=o.index,s=e.start()+o.offset,a=i+1,l=s+o.node.nodeSize;for(;i>0&&To([...e.parent.child(i-1).marks],t,n);)i-=1,s-=e.parent.child(i).nodeSize;for(;a<e.parent.childCount&&To([...e.parent.child(a).marks],t,n);)l+=e.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function Oo(e,t){if("string"==typeof e){if(!t.marks[e])throw Error(`There is no mark type named '${e}'. Maybe you forgot to add the extension?`);return t.marks[e]}return e}var Eo=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const i=Oo(e,r.schema),{doc:s,selection:a}=n,{$from:l,from:c,to:d}=a;if(o){const e=Ao(l,i,t);if(e&&e.from<=c&&e.to>=d){const t=lt.create(s,e.from,e.to);n.setSelection(t)}}return!0},No=e=>t=>{const n="function"==typeof e?e(t):e;for(let e=0;e<n.length;e+=1)if(n[e](t))return!0;return!1};function Ro(e){return e instanceof lt}function Do(e=0,t=0,n=0){return Math.min(Math.max(e,t),n)}function Po(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function $o(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var Io=(e=null,t={})=>({editor:n,view:r,tr:o,dispatch:i})=>{t={scrollIntoView:!0,...t};const s=()=>{($o()||Po())&&r.dom.focus(),"undefined"==typeof navigator||!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||$o()||Po()||r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),(null==t?void 0:t.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===e||!1===e)return!0}catch{return!1}if(i&&null===e&&!Ro(n.state.selection))return s(),!0;const a=function(e,t=null){if(!t)return null;const n=ot.atStart(e),r=ot.atEnd(e);if("start"===t||!0===t)return n;if("end"===t)return r;const o=n.from,i=r.to;return"all"===t?lt.create(e,Do(0,o,i),Do(e.content.size,o,i)):lt.create(e,Do(t,o,i),Do(t,o,i))}(o.doc,e)||n.state.selection,l=n.state.selection.eq(a);return i&&(l||o.setSelection(a),l&&o.storedMarks&&o.setStoredMarks(o.storedMarks),s()),!0},zo=(e,t)=>n=>e.every((e,r)=>t(e,{...n,index:r})),Lo=(e,t)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},e,t),Fo=e=>{const t=e.childNodes;for(let n=t.length-1;n>=0;n-=1){const r=t[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?e.removeChild(r):1===r.nodeType&&Fo(r)}return e};function Ho(e){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const t=`<body>${e}</body>`,n=(new window.DOMParser).parseFromString(t,"text/html").body;return Fo(n)}function jo(e,t,n){if(e instanceof R||e instanceof a)return e;n={slice:!0,parseOptions:{},...n};const r="string"==typeof e;if("object"==typeof e&&null!==e)try{if(Array.isArray(e)&&e.length>0)return a.fromArray(e.map(e=>t.nodeFromJSON(e)));const r=t.nodeFromJSON(e);return n.errorOnInvalidContent&&r.check(),r}catch(r){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:r});return console.warn("[tiptap warn]: Invalid content.","Passed value:",e,"Error:",r),jo("",t,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const i=new X({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:e=>(r=!0,o="string"==typeof e?e:e.outerHTML,null)}]}})});if(n.slice?Q.fromSchema(i).parseSlice(Ho(e),n.parseOptions):Q.fromSchema(i).parse(Ho(e),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=Q.fromSchema(t);return n.slice?r.parseSlice(Ho(e),n.parseOptions).content:r.parse(Ho(e),n.parseOptions)}return jo("",t,n)}var Bo=(e,t,n)=>({tr:r,dispatch:o,editor:i})=>{var s;if(o){let o;const l=e=>{i.emit("contentError",{editor:i,error:e,disableCollaboration:()=>{"collaboration"in i.storage&&"object"==typeof i.storage.collaboration&&i.storage.collaboration&&(i.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...(n={parseOptions:i.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n}).parseOptions};if(!n.errorOnInvalidContent&&!i.options.enableContentCheck&&i.options.emitContentError)try{jo(t,i.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(e){l(e)}try{o=jo(t,i.schema,{parseOptions:c,errorOnInvalidContent:null!=(s=n.errorOnInvalidContent)?s:i.options.enableContentCheck})}catch(e){return l(e),!1}let d,{from:u,to:h}="number"==typeof e?{from:e,to:e}:{from:e.from,to:e.to},p=!0,f=!0;if(("type"in o?[o]:o).forEach(e=>{e.check(),p=!!p&&e.isText&&0===e.marks.length,f=!!f&&e.isBlock}),u===h&&f){const{parent:e}=r.doc.resolve(u);e.isTextblock&&!e.type.spec.code&&!e.childCount&&(u-=1,h+=1)}if(p){if(Array.isArray(t))d=t.map(e=>e.text||"").join("");else if(t instanceof a){let e="";t.forEach(t=>{t.text&&(e+=t.text)}),d=e}else d="object"==typeof t&&t&&t.text?t.text:t;r.insertText(d,u,h)}else{d=o;const e=r.doc.resolve(u),t=e.node(),n=0===e.parentOffset,i=t.isText||t.isTextblock,s=t.content.size>0;n&&i&&s&&(u=Math.max(0,u-1)),r.replaceWith(u,h,d)}n.updateSelection&&function(e,t){const n=e.steps.length-1;if(n<t)return;const r=e.steps[n];if(!(r instanceof Ae||r instanceof Oe))return;const o=e.mapping.maps[n];let i=0;o.forEach((e,t,n,r)=>{0===i&&(i=r)}),e.setSelection(ot.near(e.doc.resolve(i),-1))}(r,r.steps.length-1),n.applyInputRules&&r.setMeta("applyInputRules",{from:u,text:d}),n.applyPasteRules&&r.setMeta("applyPasteRules",{from:u,text:d})}return!0},_o=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection,o=r instanceof dt;if(o){if(r.node.isTextblock||!Fe(e.doc,r.from))return!1;n=r.from}else if(n=je(e.doc,r.from,-1),null==n)return!1;if(t){let r=e.tr.join(n);o&&r.setSelection(dt.create(r.doc,n-e.doc.resolve(n).nodeBefore.nodeSize)),t(r.scrollIntoView())}return!0})(e,t),Vo=()=>({state:e,dispatch:t})=>((e,t)=>{let n,r=e.selection;if(r instanceof dt){if(r.node.isTextblock||!Fe(e.doc,r.to))return!1;n=r.to}else if(n=je(e.doc,r.to,1),null==n)return!1;return t&&t(e.tr.join(n).scrollIntoView()),!0})(e,t),Wo=()=>({state:e,dispatch:t})=>Mt(e,t),qo=()=>({state:e,dispatch:t})=>Rt(e,t),Ko=()=>({state:e,dispatch:t,tr:n})=>{try{const r=je(e.doc,e.selection.$from.pos,-1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},Jo=()=>({state:e,dispatch:t,tr:n})=>{try{const r=je(e.doc,e.selection.$from.pos,1);return null!=r&&(n.join(r,2),t&&t(n),!0)}catch{return!1}},Uo=()=>({state:e,dispatch:t})=>((e,t)=>{let n=Ct(e,void 0);if(!n)return!1;let r=Et(n);return!!r&&Tt(e,r,t)})(e,t),Go=()=>({state:e,dispatch:t})=>((e,t)=>{let n=Nt(e,void 0);if(!n)return!1;let r=Pt(n);return!!r&&Tt(e,r,t)})(e,t);function Xo(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var Yo=e=>({editor:t,view:n,tr:r,dispatch:o})=>{const i=function(e){const t=e.split(/-(?!$)/);let n,r,o,i,s=t[t.length-1];"Space"===s&&(s=" ");for(let e=0;e<t.length-1;e+=1){const s=t[e];if(/^(cmd|meta|m)$/i.test(s))i=!0;else if(/^a(lt)?$/i.test(s))n=!0;else if(/^(c|ctrl|control)$/i.test(s))r=!0;else if(/^s(hift)?$/i.test(s))o=!0;else{if(!/^mod$/i.test(s))throw new Error(`Unrecognized modifier name: ${s}`);$o()||Xo()?i=!0:r=!0}}return n&&(s=`Alt-${s}`),r&&(s=`Ctrl-${s}`),i&&(s=`Meta-${s}`),o&&(s=`Shift-${s}`),s}(e).split(/-(?!$)/),s=i.find(e=>!["Alt","Ctrl","Meta","Shift"].includes(e)),a=new KeyboardEvent("keydown",{key:"Space"===s?" ":s,altKey:i.includes("Alt"),ctrlKey:i.includes("Ctrl"),metaKey:i.includes("Meta"),shiftKey:i.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{n.someProp("handleKeyDown",e=>e(n,a))});return null==l||l.steps.forEach(e=>{const t=e.map(r.mapping);t&&o&&r.maybeStep(t)}),!0};function Qo(e,t,n={}){const{from:r,to:o,empty:i}=e.selection,s=t?vo(t,e.schema):null,a=[];e.doc.nodesBetween(r,o,(e,t)=>{if(e.isText)return;const n=Math.max(r,t),i=Math.min(o,t+e.nodeSize);a.push({node:e,from:n,to:i})});const l=o-r,c=a.filter(e=>!s||s.name===e.node.type.name).filter(e=>Co(e.node.attrs,n,{strict:!1}));return i?!!c.length:c.reduce((e,t)=>e+t.to-t.from,0)>=l}var Zo=(e,t={})=>({state:n,dispatch:r})=>!!Qo(n,vo(e,n.schema),t)&&((e,t)=>{let{$from:n,$to:r}=e.selection,o=n.blockRange(r),i=o&&De(o);return null!=i&&(t&&t(e.tr.lift(o,i).scrollIntoView()),!0)})(n,r),ei=()=>({state:e,dispatch:t})=>Ft(e,t),ti=e=>({state:t,dispatch:n})=>Xt(vo(e,t.schema))(t,n),ni=()=>({state:e,dispatch:t})=>$t(e,t);function ri(e,t){return t.nodes[e]?"node":t.marks[e]?"mark":null}function oi(e,t){const n="string"==typeof t?[t]:t;return Object.keys(e).reduce((t,r)=>(n.includes(r)||(t[r]=e[r]),t),{})}var ii=(e,t)=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=ri("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=vo(e,r.schema)),"mark"===a&&(s=Oo(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{r.doc.nodesBetween(e.$from.pos,e.$to.pos,(e,r)=>{i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,oi(e.attrs,t))),s&&e.marks.length&&e.marks.forEach(i=>{s===i.type&&(l=!0,o&&n.addMark(r,r+e.nodeSize,s.create(oi(i.attrs,t))))})})}),l},si=()=>({tr:e,dispatch:t})=>(t&&e.scrollIntoView(),!0),ai=()=>({tr:e,dispatch:t})=>{if(t){const t=new ht(e.doc);e.setSelection(t)}return!0},li=()=>({state:e,dispatch:t})=>Ot(e,t),ci=()=>({state:e,dispatch:t})=>Dt(e,t),di=()=>({state:e,dispatch:t})=>((e,t)=>{let n,{$from:r,to:o}=e.selection,i=r.sharedDepth(o);return 0!=i&&(n=r.before(i),t&&t(e.tr.setSelection(dt.create(e.doc,n))),!0)})(e,t),ui=()=>({state:e,dispatch:t})=>Vt(e,t),hi=()=>({state:e,dispatch:t})=>_t(e,t);var pi=(e,{errorOnInvalidContent:t,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:i,dispatch:s,commands:a})=>{const{doc:l}=i;if("full"!==r.preserveWhitespace){const a=function(e,t,n={},r={}){return jo(e,t,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}(e,o.schema,r,{errorOnInvalidContent:null!=t?t:o.options.enableContentCheck});return s&&i.replaceWith(0,l.content.size,a).setMeta("preventUpdate",!n),!0}return s&&i.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:l.content.size},e,{parseOptions:r,errorOnInvalidContent:null!=t?t:o.options.enableContentCheck})};function fi(e,t){const n=Oo(t,e.schema),{from:r,to:o,empty:i}=e.selection,s=[];i?(e.storedMarks&&s.push(...e.storedMarks),s.push(...e.selection.$head.marks())):e.doc.nodesBetween(r,o,e=>{s.push(...e.marks)});const a=s.find(e=>e.type.name===n.name);return a?{...a.attrs}:{}}function mi(e,t){const n=new nt(e);return t.forEach(e=>{e.steps.forEach(e=>{n.step(e)})}),n}function gi(e,t){for(let n=e.depth;n>0;n-=1){const r=e.node(n);if(t(r))return{pos:n>0?e.before(n):0,start:e.start(n),depth:n,node:r}}}function vi(e){return t=>gi(t.$from,e)}function yi(e,t,n){return void 0===e.config[t]&&e.parent?yi(e.parent,t,n):"function"==typeof e.config[t]?e.config[t].bind({...n,parent:e.parent?yi(e.parent,t,n):null}):e.config[t]}function bi(e){return e.map(e=>{const t=yi(e,"addExtensions",{name:e.name,options:e.options,storage:e.storage});return t?[e,...bi(t())]:e}).flat(10)}function ki(e,t){const n=le.fromSchema(t).serializeFragment(e),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function wi(e,t=void 0,...n){return function(e){return"function"==typeof e}(e)?t?e.bind(t)(...n):e(...n):e}function xi(e){return{baseExtensions:e.filter(e=>"extension"===e.type),nodeExtensions:e.filter(e=>"node"===e.type),markExtensions:e.filter(e=>"mark"===e.type)}}function Si(e){const t=[],{nodeExtensions:n,markExtensions:r}=xi(e),o=[...n,...r],i={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},s=n.filter(e=>"text"!==e.name).map(e=>e.name),a=r.map(e=>e.name),l=[...s,...a];return e.forEach(e=>{const n=yi(e,"addGlobalAttributes",{name:e.name,options:e.options,storage:e.storage,extensions:o});n&&n().forEach(e=>{let n;n=Array.isArray(e.types)?e.types:"*"===e.types?l:"nodes"===e.types?s:"marks"===e.types?a:[],n.forEach(n=>{Object.entries(e.attributes).forEach(([e,r])=>{t.push({type:n,name:e,attribute:{...i,...r}})})})})}),o.forEach(e=>{const n={name:e.name,options:e.options,storage:e.storage},r=yi(e,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach(([n,r])=>{const o={...i,...r};"function"==typeof(null==o?void 0:o.default)&&(o.default=o.default()),(null==o?void 0:o.isRequired)&&void 0===(null==o?void 0:o.default)&&delete o.default,t.push({type:e.name,name:n,attribute:o})})}),t}function Ci(e){const t=[],n=function(e){const t=[];let n="",r=!1,o=!1,i=0;const s=e.length;for(let a=0;a<s;a+=1){const s=e[a];if("'"!==s||o)if('"'!==s||r){if(!r&&!o){if("("===s){i+=1,n+=s;continue}if(")"===s&&i>0){i-=1,n+=s;continue}if(";"===s&&0===i){t.push(n),n="";continue}}n+=s}else o=!o,n+=s;else r=!r,n+=s}return n&&t.push(n),t}(e||""),r=n.length;for(let e=0;e<r;e+=1){const r=n[e],o=r.indexOf(":");if(-1===o)continue;const i=r.slice(0,o).trim(),s=r.slice(o+1).trim();i&&s&&t.push([i,s])}return t}function Mi(...e){return e.filter(e=>!!e).reduce((e,t)=>{const n={...e};return Object.entries(t).forEach(([e,t])=>{if(n[e])if("class"===e){const r=t?String(t).split(" "):[],o=n[e]?n[e].split(" "):[],i=r.filter(e=>!o.includes(e));n[e]=[...o,...i].join(" ")}else if("style"===e){const r=new Map([...Ci(n[e]),...Ci(t)]);n[e]=Array.from(r.entries()).map(([e,t])=>`${e}: ${t}`).join("; ")}else n[e]=t;else n[e]=t}),n},{})}function Ti(e,t){return t.filter(t=>t.type===e.type.name).filter(e=>e.attribute.rendered).map(t=>t.attribute.renderHTML?t.attribute.renderHTML(e.attrs)||{}:{[t.name]:e.attrs[t.name]}).reduce((e,t)=>Mi(e,t),{})}function Ai(e,t){return"style"in e?e:{...e,getAttrs:n=>{const r=e.getAttrs?e.getAttrs(n):e.attrs;if(!1===r)return!1;const o=t.reduce((e,t)=>{const r=t.attribute.parseHTML?t.attribute.parseHTML(n):function(e){return"string"!=typeof e?e:e.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(e):"true"===e||"false"!==e&&e}(n.getAttribute(t.name));return null==r?e:{...e,[t.name]:r}},{});return{...r,...o}}}}function Oi(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>("attrs"!==e||!function(e={}){return 0===Object.keys(e).length&&e.constructor===Object}(t))&&null!=t))}function Ei(e){var t,n;const r={};return!(null==(t=null==e?void 0:e.attribute)?void 0:t.isRequired)&&"default"in((null==e?void 0:e.attribute)||{})&&(r.default=e.attribute.default),void 0!==(null==(n=null==e?void 0:e.attribute)?void 0:n.validate)&&(r.validate=e.attribute.validate),[e.name,r]}function Ni(e){return e.sort((e,t)=>{const n=yi(e,"priority")||100,r=yi(t,"priority")||100;return n>r?-1:n<r?1:0})}function Ri(e){const t=Ni(bi(e)),n=function(e){const t=e.filter((t,n)=>e.indexOf(t)!==n);return Array.from(new Set(t))}(t.map(e=>e.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(e=>`'${e}'`).join(", ")}]. This can lead to issues.`),t}function Di(e){const{mapping:t,steps:n}=e,r=[];return t.maps.forEach((e,o)=>{const i=[];if(e.ranges.length)e.forEach((e,t)=>{i.push({from:e,to:t})});else{const{from:e,to:t}=n[o];if(void 0===e||void 0===t)return;i.push({from:e,to:t})}i.forEach(({from:e,to:n})=>{const i=t.slice(o).map(e,-1),s=t.slice(o).map(n),a=t.invert().map(i,-1),l=t.invert().map(s);r.push({oldRange:{from:a,to:l},newRange:{from:i,to:s}})})}),function(e){const t=function(e,t=JSON.stringify){const n={};return e.filter(e=>{const r=t(e);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(e);return 1===t.length?t:t.filter((e,n)=>{const r=t.filter((e,t)=>t!==n);return!r.some(t=>e.oldRange.from>=t.oldRange.from&&e.oldRange.to<=t.oldRange.to&&e.newRange.from>=t.newRange.from&&e.newRange.to<=t.newRange.to)})}(r)}function Pi(e,t,n){const r=[];return e===t?n.resolve(e).marks().forEach(t=>{const o=Ao(n.resolve(e),t.type);o&&r.push({mark:t,...o})}):n.nodesBetween(e,t,(e,t)=>{e&&void 0!==(null==e?void 0:e.nodeSize)&&r.push(...e.marks.map(n=>({from:t,to:t+e.nodeSize,mark:n})))}),r}function $i(e,t){return t.nodes[e]||t.marks[e]||null}function Ii(e,t,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const r=e.find(e=>e.type===t&&e.name===n);return!!r&&r.attribute.keepOnSplit}))}function zi(e,t){return Array.isArray(t)?t.some(t=>("string"==typeof t?t:t.name)===e.name):t}function Li(e,t){const{nodeExtensions:n}=xi(t),r=n.find(t=>t.name===e);if(!r)return!1;const o=wi(yi(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function Fi(e,{checkChildren:t=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===e.type.name)return!0;if(e.isText)return/^\s*$/m.test(null!=(r=e.text)?r:"")}if(e.isText)return!e.text;if(e.isAtom||e.isLeaf)return!1;if(0===e.content.childCount)return!0;if(t){let r=!0;return e.content.forEach(e=>{!1!==r&&(Fi(e,{ignoreWhitespace:n,checkChildren:t})||(r=!1))}),r}return!1}function Hi(e){return e instanceof dt}var ji=(e,t={})=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=n,{empty:s,ranges:a}=i,l=Oo(e,r.schema);if(o)if(s){const e=fi(r,l);n.addStoredMark(l.create({...e,...t}))}else a.forEach(e=>{const o=e.$from.pos,i=e.$to.pos;r.doc.nodesBetween(o,i,(e,r)=>{const s=Math.max(r,o),a=Math.min(r+e.nodeSize,i);e.marks.find(e=>e.type===l)?e.marks.forEach(e=>{l===e.type&&n.addMark(s,a,l.create({...e.attrs,...t}))}):n.addMark(s,a,l.create(t))})});return function(e,t,n){var r;const{selection:o}=t;let i=null;if(Ro(o)&&(i=o.$cursor),i){const t=null!=(r=e.storedMarks)?r:i.marks();return i.parent.type.allowsMarkType(n)&&(!!n.isInSet(t)||!t.some(e=>e.type.excludes(n)))}const{ranges:s}=o;return s.some(({$from:t,$to:r})=>{let o=0===t.depth&&e.doc.inlineContent&&e.doc.type.allowsMarkType(n);return e.doc.nodesBetween(t.pos,r.pos,(e,t,r)=>{if(o)return!1;if(e.isInline){const t=!r||r.type.allowsMarkType(n),i=!!n.isInSet(e.marks)||!e.marks.some(e=>e.type.excludes(n));o=t&&i}return!o}),o})}(r,n,l)},Bi=(e,t)=>({tr:n})=>(n.setMeta(e,t),!0),_i=(e,t={})=>({state:n,dispatch:r,chain:o})=>{const i=vo(e,n.schema);let s;return n.selection.$anchor.sameParent(n.selection.$head)&&(s=n.selection.$anchor.parent.attrs),i.isTextblock?o().command(({commands:e})=>!!Wt(i,{...s,...t})(n)||e.clearNodes()).command(({state:e})=>Wt(i,{...s,...t})(e,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Vi=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,r=Do(e,0,n.content.size),o=dt.create(n,r);t.setSelection(o)}return!0},Wi=(e,t)=>({tr:n,state:r,dispatch:o})=>{const{selection:i}=r;let s,a;return"number"==typeof t?(s=t,a=t):t&&"from"in t&&"to"in t?(s=t.from,a=t.to):(s=i.from,a=i.to),o&&n.doc.nodesBetween(s,a,(t,r)=>{t.isText||n.setNodeMarkup(r,void 0,{...t.attrs,dir:e})}),!0},qi=e=>({tr:t,dispatch:n})=>{if(n){const{doc:n}=t,{from:r,to:o}="number"==typeof e?{from:e,to:e}:e,i=lt.atStart(n).from,s=lt.atEnd(n).to,a=Do(r,i,s),l=Do(o,i,s),c=lt.create(n,a,l);t.setSelection(c)}return!0},Ki=e=>({state:t,dispatch:n})=>Yt(vo(e,t.schema))(t,n);function Ji(e,t){const n=e.storedMarks||e.selection.$to.parentOffset&&e.selection.$from.marks();if(n){const r=n.filter(e=>null==t?void 0:t.includes(e.type.name));e.tr.ensureMarks(r)}}var Ui=({keepMarks:e=!0}={})=>({tr:t,state:n,dispatch:r,editor:o})=>{const{selection:i,doc:s}=t,{$from:a,$to:l}=i,c=Ii(o.extensionManager.attributes,a.node().type.name,a.node().attrs);if(i instanceof dt&&i.node.isBlock)return!(!a.parentOffset||!Le(s,a.pos)||(r&&(e&&Ji(n,o.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),0));if(!a.parent.isBlock)return!1;const d=l.parentOffset===l.parent.content.size,u=0===a.depth?void 0:function(e){for(let t=0;t<e.edgeCount;t+=1){const{type:n}=e.edge(t);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}(a.node(-1).contentMatchAt(a.indexAfter(-1)));let h=d&&u?[{type:u,attrs:c}]:void 0,p=Le(t.doc,t.mapping.map(a.pos),1,h);if(h||p||!Le(t.doc,t.mapping.map(a.pos),1,u?[{type:u}]:void 0)||(p=!0,h=u?[{type:u,attrs:c}]:void 0),r){if(p&&(i instanceof lt&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,h),u&&!d&&!a.parentOffset&&a.parent.type!==u)){const e=t.mapping.map(a.before()),n=t.doc.resolve(e);a.node(-1).canReplaceWith(n.index(),n.index()+1,u)&&t.setNodeMarkup(t.mapping.map(a.before()),u)}e&&Ji(n,o.extensionManager.splittableMarks),t.scrollIntoView()}return p},Gi=(e,t={})=>({tr:n,state:r,dispatch:o,editor:i})=>{var s;const l=vo(e,r.schema),{$from:c,$to:d}=r.selection,u=r.selection.node;if(u&&u.isBlock||c.depth<2||!c.sameParent(d))return!1;const h=c.node(-1);if(h.type!==l)return!1;const f=i.extensionManager.attributes;if(0===c.parent.content.size&&c.node(-1).childCount===c.indexAfter(-1)){if(2===c.depth||c.node(-3).type!==l||c.index(-2)!==c.node(-2).childCount-1)return!1;if(o){let e=a.empty;const r=c.index(-1)?1:c.index(-2)?2:3;for(let t=c.depth-r;t>=c.depth-3;t-=1)e=a.from(c.node(t).copy(e));const o=c.indexAfter(-1)<c.node(-2).childCount?1:c.indexAfter(-2)<c.node(-3).childCount?2:3,i={...Ii(f,c.node().type.name,c.node().attrs),...t},d=(null==(s=l.contentMatch.defaultType)?void 0:s.createAndFill(i))||void 0;e=e.append(a.from(l.createAndFill(null,d)||void 0));const u=c.before(c.depth-(r-1));n.replace(u,c.after(-o),new p(e,4-r,0));let h=-1;n.doc.nodesBetween(u,n.doc.content.size,(e,t)=>{if(h>-1)return!1;e.isTextblock&&0===e.content.size&&(h=t+1)}),h>-1&&n.setSelection(lt.near(n.doc.resolve(h))),n.scrollIntoView()}return!0}const m=d.pos===c.end()?h.contentMatchAt(0).defaultType:null,g={...Ii(f,h.type.name,h.attrs),...t},v={...Ii(f,c.node().type.name,c.node().attrs),...t};n.delete(c.pos,d.pos);const y=m?[{type:l,attrs:g},{type:m,attrs:v}]:[{type:l,attrs:g}];if(!Le(n.doc,c.pos,2))return!1;if(o){const{selection:e,storedMarks:t}=r,{splittableMarks:s}=i.extensionManager,a=t||e.$to.parentOffset&&e.$from.marks();if(n.split(c.pos,2,y).scrollIntoView(),!a||!o)return!0;const l=a.filter(e=>s.includes(e.type.name));n.ensureMarks(l)}return!0},Xi=(e,t)=>{const n=vi(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Fe(e.doc,n.pos)||(e.join(n.pos),!0)},Yi=(e,t)=>{const n=vi(e=>e.type===t)(e.selection);if(!n)return!0;const r=e.doc.resolve(n.start).after(n.depth);if(void 0===r)return!0;const o=e.doc.nodeAt(r);return n.node.type!==(null==o?void 0:o.type)||!Fe(e.doc,r)||(e.join(r),!0)},Qi=(e,t,n,r={})=>({editor:o,tr:i,state:s,dispatch:a,chain:l,commands:c,can:d})=>{const{extensions:u,splittableMarks:h}=o.extensionManager,p=vo(e,s.schema),f=vo(t,s.schema),{selection:m,storedMarks:g}=s,{$from:v,$to:y}=m,b=v.blockRange(y),k=g||m.$to.parentOffset&&m.$from.marks();if(!b)return!1;const w=vi(e=>Li(e.type.name,u))(m);if(b.depth>=1&&w&&b.depth-w.depth<=1){if(w.node.type===p)return c.liftListItem(f);if(Li(w.node.type.name,u)&&p.validContent(w.node.content)&&a)return l().command(()=>(i.setNodeMarkup(w.pos,p),!0)).command(()=>Xi(i,p)).command(()=>Yi(i,p)).run()}return n&&k&&a?l().command(()=>{const e=d().wrapInList(p,r),t=k.filter(e=>h.includes(e.type.name));return i.ensureMarks(t),!!e||c.clearNodes()}).wrapInList(p,r).command(()=>Xi(i,p)).command(()=>Yi(i,p)).run():l().command(()=>!!d().wrapInList(p,r)||c.clearNodes()).wrapInList(p,r).command(()=>Xi(i,p)).command(()=>Yi(i,p)).run()},Zi=(e,t={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:i=!1}=n,s=Oo(e,r.schema);return function(e,t,n={}){const{empty:r,ranges:o}=e.selection,i=t?Oo(t,e.schema):null;if(r)return!!(e.storedMarks||e.selection.$from.marks()).filter(e=>!i||i.name===e.type.name).find(e=>Co(e.attrs,n,{strict:!1}));let s=0;const a=[];if(o.forEach(({$from:t,$to:n})=>{const r=t.pos,o=n.pos;e.doc.nodesBetween(r,o,(e,t)=>{if(i&&e.inlineContent&&!e.type.allowsMarkType(i))return!1;if(!e.isText&&!e.marks.length)return;const n=Math.max(r,t),l=Math.min(o,t+e.nodeSize);s+=l-n,a.push(...e.marks.map(e=>({mark:e,from:n,to:l})))})}),0===s)return!1;const l=a.filter(e=>!i||i.name===e.mark.type.name).filter(e=>Co(e.mark.attrs,n,{strict:!1})).reduce((e,t)=>e+t.to-t.from,0),c=a.filter(e=>!i||e.mark.type!==i&&e.mark.type.excludes(i)).reduce((e,t)=>e+t.to-t.from,0);return(l>0?l+c:l)>=s}(r,s,t)?o.unsetMark(s,{extendEmptyMarkRange:i}):o.setMark(s,t)},es=(e,t,n={})=>({state:r,commands:o})=>{const i=vo(e,r.schema),s=vo(t,r.schema),a=Qo(r,i,n);let l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?o.setNode(s,l):o.setNode(i,{...l,...n})},ts=(e,t={})=>({state:n,commands:r})=>{const o=vo(e,n.schema);return Qo(n,o,t)?r.lift(o):r.wrapIn(o,t)},ns=()=>({state:e,dispatch:t})=>{const n=e.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let i;if(o.spec.isInputRules&&(i=o.getState(e))){if(t){const t=e.tr,n=i.transform;for(let e=n.steps.length-1;e>=0;e-=1)t.step(n.steps[e].invert(n.docs[e]));if(i.text){const n=t.doc.resolve(i.from).marks();t.replaceWith(i.from,i.to,e.schema.text(i.text,n))}else t.delete(i.from,i.to)}return!0}}return!1},rs=()=>({tr:e,dispatch:t})=>{const{selection:n}=e,{empty:r,ranges:o}=n;return r||t&&o.forEach(t=>{e.removeMark(t.$from.pos,t.$to.pos)}),!0},is=(e,t={})=>({tr:n,state:r,dispatch:o})=>{var i;const{extendEmptyMarkRange:s=!1}=t,{selection:a}=n,l=Oo(e,r.schema),{$from:c,empty:d,ranges:u}=a;if(!o)return!0;if(d&&s){let{from:e,to:t}=a;const r=null==(i=c.marks().find(e=>e.type===l))?void 0:i.attrs,o=Ao(c,l,r);o&&(e=o.from,t=o.to),n.removeMark(e,t,l)}else u.forEach(e=>{n.removeMark(e.$from.pos,e.$to.pos,l)});return n.removeStoredMark(l),!0},ss=e=>({tr:t,state:n,dispatch:r})=>{const{selection:o}=n;let i,s;return"number"==typeof e?(i=e,s=e):e&&"from"in e&&"to"in e?(i=e.from,s=e.to):(i=o.from,s=o.to),r&&t.doc.nodesBetween(i,s,(e,n)=>{if(e.isText)return;const r={...e.attrs};delete r.dir,t.setNodeMarkup(n,void 0,r)}),!0},as=(e,t={})=>({tr:n,state:r,dispatch:o})=>{let i=null,s=null;const a=ri("string"==typeof e?e:e.name,r.schema);if(!a)return!1;"node"===a&&(i=vo(e,r.schema)),"mark"===a&&(s=Oo(e,r.schema));let l=!1;return n.selection.ranges.forEach(e=>{const a=e.$from.pos,c=e.$to.pos;let d,u,h,p;n.selection.empty?r.doc.nodesBetween(a,c,(e,t)=>{i&&i===e.type&&(l=!0,h=Math.max(t,a),p=Math.min(t+e.nodeSize,c),d=t,u=e)}):r.doc.nodesBetween(a,c,(e,r)=>{r<a&&i&&i===e.type&&(l=!0,h=Math.max(r,a),p=Math.min(r+e.nodeSize,c),d=r,u=e),r>=a&&r<=c&&(i&&i===e.type&&(l=!0,o&&n.setNodeMarkup(r,void 0,{...e.attrs,...t})),s&&e.marks.length&&e.marks.forEach(i=>{if(s===i.type&&(l=!0,o)){const o=Math.max(r,a),l=Math.min(r+e.nodeSize,c);n.addMark(o,l,s.create({...i.attrs,...t}))}}))}),u&&(void 0!==d&&o&&n.setNodeMarkup(d,void 0,{...u.attrs,...t}),s&&u.marks.length&&u.marks.forEach(e=>{s===e.type&&o&&n.addMark(h,p,s.create({...e.attrs,...t}))}))}),l},ls=(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i),a=s&&Pe(s,e,t);return!!a&&(r&&r(n.tr.wrap(s,a).scrollIntoView()),!0)}}(vo(e,n.schema),t)(n,r),cs=(e,t={})=>({state:n,dispatch:r})=>function(e,t=null){return function(n,r){let{$from:o,$to:i}=n.selection,s=o.blockRange(i);if(!s)return!1;let l=r?n.tr:null;return!!function(e,t,n,r=null){let o=!1,i=t,s=t.$from.doc;if(t.depth>=2&&t.$from.node(t.depth-1).type.compatibleContent(n)&&0==t.startIndex){if(0==t.$from.index(t.depth-1))return!1;let e=s.resolve(t.start-2);i=new E(e,e,t.depth),t.endIndex<t.parent.childCount&&(t=new E(t.$from,s.resolve(t.$to.end(t.depth)),t.depth)),o=!0}let l=Pe(i,n,r,t);return!!l&&(e&&function(e,t,n,r,o){let i=a.empty;for(let e=n.length-1;e>=0;e--)i=a.from(n[e].type.create(n[e].attrs,i));e.step(new Oe(t.start-(r?2:0),t.end,t.start,t.end,new p(i,0,0),n.length,!0));let s=0;for(let e=0;e<n.length;e++)n[e].type==o&&(s=e+1);let l=n.length-s,c=t.start+n.length-(r?2:0),d=t.parent;for(let n=t.startIndex,r=t.endIndex,o=!0;n<r;n++,o=!1)!o&&Le(e.doc,c,l)&&(e.split(c,l),c+=2*l),c+=d.child(n).nodeSize}(e,t,l,o,n),!0)}(l,s,e,t)&&(r&&r(l.scrollIntoView()),!0)}}(vo(e,n.schema),t)(n,r),ds=class{constructor(e){var t;this.find=e.find,this.handler=e.handler,this.undoable=null==(t=e.undoable)||t}};function us(e){var t;const{editor:n,from:r,to:o,text:i,rules:s,plugin:a}=e,{view:l}=n;if(l.composing)return!1;const c=l.state.doc.resolve(r);if(c.parent.type.spec.code||(null==(t=c.nodeBefore||c.nodeAfter)?void 0:t.marks.find(e=>e.type.spec.code)))return!1;let d=!1;const u=((e,t=500)=>{let n="";const r=e.parentOffset;return e.parent.nodesBetween(Math.max(0,r-t),r,(e,t,o,i)=>{var s,a;const l=(null==(a=(s=e.type.spec).toText)?void 0:a.call(s,{node:e,pos:t,parent:o,index:i}))||e.textContent||"%leaf%";n+=e.isAtom&&!e.isText?l:l.slice(0,Math.max(0,r-t))}),n})(c)+i;return s.forEach(e=>{if(d)return;const t=((e,t)=>{if(So(t))return t.exec(e);const n=t(e);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=e,r.data=n.data,n.replaceWith&&(n.text.includes(n.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(n.replaceWith)),r})(u,e.find);if(!t)return;const s=l.state.tr,c=so({state:l.state,transaction:s}),h={from:r-(t[0].length-i.length),to:o},{commands:p,chain:f,can:m}=new ao({editor:n,state:c});null!==e.handler({state:c,range:h,match:t,commands:p,chain:f,can:m})&&s.steps.length&&(e.undoable&&s.setMeta(a,{transform:s,from:r,to:o,text:i}),l.dispatch(s),d=!0)}),d}function hs(e){return"Object"===function(e){return Object.prototype.toString.call(e).slice(8,-1)}(e)&&e.constructor===Object&&Object.getPrototypeOf(e)===Object.prototype}function ps(e,t){const n={...e};return hs(e)&&hs(t)&&Object.keys(t).forEach(r=>{hs(t[r])&&hs(e[r])?n[r]=ps(e[r],t[r]):n[r]=t[r]}),n}var fs=class{constructor(e={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...e},this.name=this.config.name}get options(){return{...wi(yi(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...wi(yi(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(e={}){const t=this.extend({...this.config,addOptions:()=>ps(this.options,e)});return t.name=this.name,t.parent=this.parent,t}extend(e={}){const t=new this.constructor({...this.config,...e});return t.parent=this,this.child=t,t.name="name"in e?e.name:t.parent.name,t}},ms=class e extends fs{constructor(){super(...arguments),this.type="mark"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,r=e.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!o.find(e=>(null==e?void 0:e.type.name)===t.name))return!1;const i=o.find(e=>(null==e?void 0:e.type.name)===t.name);return i&&n.removeStoredMark(i),n.insertText(" ",r.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},gs=class{constructor(e){this.find=e.find,this.handler=e.handler}};var vs=null;function ys(e){const{editor:t,rules:n}=e;let r,o=null,i=!1,s=!1,l="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const c=({state:e,from:n,to:o,rule:i,pasteEvt:s})=>{const a=e.tr,c=so({state:e,transaction:a});if(function(e){const{editor:t,state:n,from:r,to:o,rule:i,pasteEvent:s,dropEvent:a}=e,{commands:l,chain:c,can:d}=new ao({editor:t,state:n}),u=[];return n.doc.nodesBetween(r,o,(e,t)=>{var h,p,f,m,g;if((null==(p=null==(h=e.type)?void 0:h.spec)?void 0:p.code)||!(e.isText||e.isTextblock||e.isInline))return;const v=null!=(g=null!=(m=null==(f=e.content)?void 0:f.size)?m:e.nodeSize)?g:0,y=Math.max(r,t),b=Math.min(o,t+v);if(y>=b)return;const k=((e,t,n)=>{if(So(t))return[...e.matchAll(t)];const r=t(e,n);return r?r.map(t=>{const n=[t.text];return n.index=t.index,n.input=e,n.data=t.data,t.replaceWith&&(t.text.includes(t.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(t.replaceWith)),n}):[]})(e.isText?e.text||"":e.textBetween(y-t,b-t,void 0,""),i.find,s);k.forEach(e=>{if(void 0===e.index)return;const t=y+e.index+1,r=t+e[0].length,o={from:n.tr.mapping.map(t),to:n.tr.mapping.map(r)},h=i.handler({state:n,range:o,match:e,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});u.push(h)})}),u.every(e=>null!==e)}({editor:t,state:c,from:Math.max(n-1,0),to:o.b-1,rule:i,pasteEvent:s,dropEvent:r})&&a.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return l="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return n.map(e=>new bt({view(e){const n=n=>{var r;o=(null==(r=e.dom.parentElement)?void 0:r.contains(n.target))?e.dom.parentElement:null,o&&(vs=t)},r=()=>{vs&&(vs=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(e,t)=>{if(s=o===e.dom.parentElement,r=t,!s){const e=vs;(null==e?void 0:e.isEditable)&&setTimeout(()=>{const t=e.state.selection;t&&e.commands.deleteRange({from:t.from,to:t.to})},10)}return!1},paste:(e,t)=>{var n;const r=null==(n=t.clipboardData)?void 0:n.getData("text/html");return l=t,i=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(t,n,r)=>{const o=t[0],d="paste"===o.getMeta("uiEvent")&&!i,u="drop"===o.getMeta("uiEvent")&&!s,h=o.getMeta("applyPasteRules"),p=!!h;if(!d&&!u&&!p)return;if(p){let{text:t}=h;"string"==typeof t||(t=ki(a.from(t),r.schema));const{from:n}=h,o=n+t.length,i=(e=>{var t;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(t=n.clipboardData)||t.setData("text/html",e),n})(t);return c({rule:e,state:r,from:n,to:{b:o},pasteEvt:i})}const f=n.doc.content.findDiffStart(r.doc.content),m=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof f&&m&&f!==m.b?c({rule:e,state:r,from:f,to:m,pasteEvt:l}):void 0}}))}var bs=class{constructor(e,t){this.splittableMarks=[],this.editor=t,this.baseExtensions=e,this.extensions=Ri(e),this.schema=function(e,t){var n;const r=Si(e),{nodeExtensions:o,markExtensions:i}=xi(e),s=null==(n=o.find(e=>yi(e,"topNode")))?void 0:n.name,a=Object.fromEntries(o.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=Oi({...e.reduce((e,t)=>{const r=yi(t,"extendNodeSchema",i);return{...e,...r?r(n):{}}},{}),content:wi(yi(n,"content",i)),marks:wi(yi(n,"marks",i)),group:wi(yi(n,"group",i)),inline:wi(yi(n,"inline",i)),atom:wi(yi(n,"atom",i)),selectable:wi(yi(n,"selectable",i)),draggable:wi(yi(n,"draggable",i)),code:wi(yi(n,"code",i)),whitespace:wi(yi(n,"whitespace",i)),linebreakReplacement:wi(yi(n,"linebreakReplacement",i)),defining:wi(yi(n,"defining",i)),isolating:wi(yi(n,"isolating",i)),attrs:Object.fromEntries(o.map(Ei))}),a=wi(yi(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>Ai(e,o)));const l=yi(n,"renderHTML",i);l&&(s.toDOM=e=>l({node:e,HTMLAttributes:Ti(e,o)}));const c=yi(n,"renderText",i);return c&&(s.toText=c),[n.name,s]})),l=Object.fromEntries(i.map(n=>{const o=r.filter(e=>e.type===n.name),i={name:n.name,options:n.options,storage:n.storage,editor:t},s=Oi({...e.reduce((e,t)=>{const r=yi(t,"extendMarkSchema",i);return{...e,...r?r(n):{}}},{}),inclusive:wi(yi(n,"inclusive",i)),excludes:wi(yi(n,"excludes",i)),group:wi(yi(n,"group",i)),spanning:wi(yi(n,"spanning",i)),code:wi(yi(n,"code",i)),attrs:Object.fromEntries(o.map(Ei))}),a=wi(yi(n,"parseHTML",i));a&&(s.parseDOM=a.map(e=>Ai(e,o)));const l=yi(n,"renderHTML",i);return l&&(s.toDOM=e=>l({mark:e,HTMLAttributes:Ti(e,o)})),[n.name,s]}));return new X({topNode:s,nodes:a,marks:l})}(this.extensions,t),this.setupExtensions()}get commands(){return this.extensions.reduce((e,t)=>{const n=yi(t,"addCommands",{name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:$i(t.name,this.schema)});return n?{...e,...n()}:e},{})}get plugins(){const{editor:e}=this,t=Ni([...this.extensions].reverse()).flatMap(t=>{const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:$i(t.name,this.schema)},r=[],o=yi(t,"addKeyboardShortcuts",n);let i={};if("mark"===t.type&&yi(t,"exitable",n)&&(i.ArrowRight=()=>ms.handleExit({editor:e,mark:t})),o){const t=Object.fromEntries(Object.entries(o()).map(([t,n])=>[t,()=>n({editor:e})]));i={...i,...t}}const s=new bt({props:{handleKeyDown:ro(i)}});r.push(s);const l=yi(t,"addInputRules",n);if(zi(t,e.options.enableInputRules)&&l){const t=l();if(t&&t.length){const n=function(e){const{editor:t,rules:n}=e,r=new bt({state:{init(){return null},apply(e,o,i){const s=e.getMeta(r);if(s)return s;const l=e.getMeta("applyInputRules");return!!l&&setTimeout(()=>{let{text:e}=l;"string"==typeof e||(e=ki(a.from(e),i.schema));const{from:o}=l,s=o+e.length;us({editor:t,from:o,to:s,text:e,rules:n,plugin:r})}),e.selectionSet||e.docChanged?null:o}},props:{handleTextInput(e,o,i,s){return us({editor:t,from:o,to:i,text:s,rules:n,plugin:r})},handleDOMEvents:{compositionend:e=>(setTimeout(()=>{const{$cursor:o}=e.state.selection;o&&us({editor:t,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(e,o){if("Enter"!==o.key)return!1;const{$cursor:i}=e.state.selection;return!!i&&us({editor:t,from:i.pos,to:i.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:e,rules:t}),o=Array.isArray(n)?n:[n];r.push(...o)}}const c=yi(t,"addPasteRules",n);if(zi(t,e.options.enablePasteRules)&&c){const t=c();if(t&&t.length){const n=ys({editor:e,rules:t});r.push(...n)}}const d=yi(t,"addProseMirrorPlugins",n);if(d){const e=d();r.push(...e)}return r});return t}get attributes(){return Si(this.extensions)}get nodeViews(){const{editor:e}=this,{nodeExtensions:t}=xi(this.extensions);return Object.fromEntries(t.filter(e=>!!yi(e,"addNodeView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:vo(t.name,this.schema)},o=yi(t,"addNodeView",r);if(!o)return[];const i=o();return i?[t.name,(r,o,s,a,l)=>{const c=Ti(r,n);return i({node:r,view:o,getPos:s,decorations:a,innerDecorations:l,editor:e,extension:t,HTMLAttributes:c})}]:[]}))}dispatchTransaction(e){const{editor:t}=this;return Ni([...this.extensions].reverse()).reduceRight((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:$i(n.name,this.schema)},o=yi(n,"dispatchTransaction",r);return o?t=>{o.call(r,{transaction:t,next:e})}:e},e)}transformPastedHTML(e){const{editor:t}=this;return Ni([...this.extensions]).reduce((e,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:t,type:$i(n.name,this.schema)},o=yi(n,"transformPastedHTML",r);return o?(t,n)=>{const i=e(t,n);return o.call(r,i)}:e},e||(e=>e))}get markViews(){const{editor:e}=this,{markExtensions:t}=xi(this.extensions);return Object.fromEntries(t.filter(e=>!!yi(e,"addMarkView")).map(t=>{const n=this.attributes.filter(e=>e.type===t.name),r={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:e,type:Oo(t.name,this.schema)},o=yi(t,"addMarkView",r);return o?[t.name,(r,i,s)=>{const a=Ti(r,n);return o()({mark:r,view:i,inline:s,editor:e,extension:t,HTMLAttributes:a,updateAttributes:t=>{!function(e,t,n={}){const{state:r}=t,{doc:o,tr:i}=r,s=e;o.descendants((t,r)=>{const o=i.mapping.map(r),a=i.mapping.map(r)+t.nodeSize;let l=null;if(t.marks.forEach(e=>{if(e!==s)return!1;l=e}),!l)return;let c=!1;if(Object.keys(n).forEach(e=>{n[e]!==l.attrs[e]&&(c=!0)}),c){const t=e.type.create({...e.attrs,...n});i.removeMark(o,a,e.type),i.addMark(o,a,t)}}),i.docChanged&&t.view.dispatch(i)}(r,e,t)}})}]:[]}))}setupExtensions(){const e=this.extensions;this.editor.extensionStorage=Object.fromEntries(e.map(e=>[e.name,e.storage])),e.forEach(e=>{var t;const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:$i(e.name,this.schema)};"mark"===e.type&&(null==(t=wi(yi(e,"keepOnSplit",n)))||t)&&this.splittableMarks.push(e.name);const r=yi(e,"onBeforeCreate",n),o=yi(e,"onCreate",n),i=yi(e,"onUpdate",n),s=yi(e,"onSelectionUpdate",n),a=yi(e,"onTransaction",n),l=yi(e,"onFocus",n),c=yi(e,"onBlur",n),d=yi(e,"onDestroy",n);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),i&&this.editor.on("update",i),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)})}};bs.resolve=Ri,bs.sort=Ni,bs.flatten=bi,io({},{ClipboardTextSerializer:()=>ws,Commands:()=>xs,Delete:()=>Ss,Drop:()=>Cs,Editable:()=>Ms,FocusEvents:()=>As,Keymap:()=>Os,Paste:()=>Es,Tabindex:()=>Ns,TextDirection:()=>Rs,focusEventsPluginKey:()=>Ts});var ks=class e extends fs{constructor(){super(...arguments),this.type="extension"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},ws=ks.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new bt({key:new xt("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:e}=this,{state:t,schema:n}=e,{doc:r,selection:o}=t,{ranges:i}=o,s=Math.min(...i.map(e=>e.$from.pos)),a=Math.max(...i.map(e=>e.$to.pos)),l=function(e){return Object.fromEntries(Object.entries(e.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}(n);return function(e,t,n){const{from:r,to:o}=t,{blockSeparator:i="\n\n",textSerializers:s={}}=n||{};let a="";return e.nodesBetween(r,o,(e,n,l,c)=>{var d;e.isBlock&&n>r&&(a+=i);const u=null==s?void 0:s[e.type.name];if(u)return l&&(a+=u({node:e,pos:n,parent:l,index:c,range:t})),!1;e.isText&&(a+=null==(d=null==e?void 0:e.text)?void 0:d.slice(Math.max(r,n)-n,o-n))}),a}(r,{from:s,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),xs=ks.create({name:"commands",addCommands(){return{...lo}}}),Ss=ks.create({name:"delete",onUpdate({transaction:e,appendedTransactions:t}){var n,r,o;const i=()=>{var n,r,o,i;if(null!=(i=null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.filterTransaction)?void 0:o.call(r,e))?i:e.getMeta("y-sync$"))return;const s=mi(e.before,[e,...t]);Di(s).forEach(t=>{s.mapping.mapResult(t.oldRange.from).deletedAfter&&s.mapping.mapResult(t.oldRange.to).deletedBefore&&s.before.nodesBetween(t.oldRange.from,t.oldRange.to,(n,r)=>{const o=r+n.nodeSize-2,i=t.oldRange.from<=r&&o<=t.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:s.mapping.map(r),newTo:s.mapping.map(o),deletedRange:t.oldRange,newRange:t.newRange,partial:!i,editor:this.editor,transaction:e,combinedTransform:s})})});const a=s.mapping;s.steps.forEach((t,n)=>{var r,o;if(t instanceof Ce){const i=a.slice(n).map(t.from,-1),l=a.slice(n).map(t.to),c=a.invert().map(i,-1),d=a.invert().map(l),u=null==(r=s.doc.nodeAt(i-1))?void 0:r.marks.some(e=>e.eq(t.mark)),h=null==(o=s.doc.nodeAt(l))?void 0:o.marks.some(e=>e.eq(t.mark));this.editor.emit("delete",{type:"mark",mark:t.mark,from:t.from,to:t.to,deletedRange:{from:c,to:d},newRange:{from:i,to:l},partial:Boolean(h||u),editor:this.editor,transaction:e,combinedTransform:s})}})};null==(o=null==(r=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:r.async)||o?setTimeout(i,0):i()}}),Cs=ks.create({name:"drop",addProseMirrorPlugins(){return[new bt({key:new xt("tiptapDrop"),props:{handleDrop:(e,t,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:n,moved:r})}}})]}}),Ms=ks.create({name:"editable",addProseMirrorPlugins(){return[new bt({key:new xt("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ts=new xt("focusEvents"),As=ks.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:e}=this;return[new bt({key:Ts,props:{handleDOMEvents:{focus:(t,n)=>{e.isFocused=!0;const r=e.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,n)=>{e.isFocused=!1;const r=e.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),Os=ks.create({name:"keymap",addKeyboardShortcuts(){const e=()=>this.editor.commands.first(({commands:e})=>[()=>e.undoInputRule(),()=>e.command(({tr:t})=>{const{selection:n,doc:r}=t,{empty:o,$anchor:i}=n,{pos:s,parent:a}=i,l=i.parent.isTextblock&&s>0?t.doc.resolve(s-1):i,c=l.parent.type.spec.isolating,d=i.pos-i.parentOffset,u=c&&1===l.parent.childCount?d===i.pos:ot.atStart(r).from===s;return!(!o||!a.type.isTextblock||a.textContent.length||!u||u&&"paragraph"===i.parent.type.name)&&e.clearNodes()}),()=>e.deleteSelection(),()=>e.joinBackward(),()=>e.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:e})=>[()=>e.deleteSelection(),()=>e.deleteCurrentNode(),()=>e.joinForward(),()=>e.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:e,"Mod-Backspace":e,"Shift-Backspace":e,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":e,"Alt-Backspace":e,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return $o()||Xo()?o:r},addProseMirrorPlugins(){return[new bt({key:new xt("clearDocument"),appendTransaction:(e,t,n)=>{if(e.some(e=>e.getMeta("composition")))return;const r=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),o=e.some(e=>e.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:s,to:a}=t.selection,l=ot.atStart(t.doc).from,c=ot.atEnd(t.doc).to;if(i||s!==l||a!==c)return;if(!Fi(n.doc))return;const d=n.tr,u=so({state:n,transaction:d}),{commands:h}=new ao({editor:this.editor,state:u});return h.clearNodes(),d.steps.length?d:void 0}})]}}),Es=ks.create({name:"paste",addProseMirrorPlugins(){return[new bt({key:new xt("tiptapPaste"),props:{handlePaste:(e,t,n)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:n})}}})]}}),Ns=ks.create({name:"tabindex",addProseMirrorPlugins(){return[new bt({key:new xt("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Rs=ks.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:e}=xi(this.extensions);return[{types:e.filter(e=>"text"!==e.name).map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return!t||"ltr"!==t&&"rtl"!==t&&"auto"!==t?this.options.direction:t},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new bt({key:new xt("textDirection"),props:{attributes:()=>{const e=this.options.direction;return e?{dir:e}:{}}}})]}});function Ds(e){return new ds({find:e.find,handler:({state:t,range:n,match:r})=>{const o=wi(e.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:i}=t,s=r[r.length-1],a=r[0];if(s){const r=a.search(/\S/),l=n.from+a.indexOf(s),c=l+s.length;if(Pi(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>l).length)return null;c<n.to&&i.delete(c,n.to),l>n.from&&i.delete(n.from+r,l);const d=n.from+r+s.length;i.addMark(n.from+r,d,e.type.create(o||{})),i.removeStoredMark(e.type)}},undoable:e.undoable})}function Ps(e){return new ds({find:e.find,handler:({state:t,range:n,match:r})=>{const o=wi(e.getAttributes,void 0,r)||{},{tr:i}=t,s=n.from;let a=n.to;const l=e.type.create(o);if(r[1]){let e=s+r[0].lastIndexOf(r[1]);e>a?e=a:a=e+r[1].length;const t=r[0][r[0].length-1];i.insertText(t,s+r[0].length-1),i.replaceWith(e,a,l)}else if(r[0]){const t=e.type.isInline?s:s-1;i.insert(t,e.type.create(o)).delete(i.mapping.map(s),i.mapping.map(a))}i.scrollIntoView()},undoable:e.undoable})}function $s(e){return new ds({find:e.find,handler:({state:t,range:n,match:r})=>{const o=t.doc.resolve(n.from),i=wi(e.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),e.type))return null;t.tr.delete(n.from,n.to).setBlockType(n.from,n.from,e.type,i)},undoable:e.undoable})}function Is(e){return new ds({find:e.find,handler:({state:t,range:n,match:r,chain:o})=>{const i=wi(e.getAttributes,void 0,r)||{},s=t.tr.delete(n.from,n.to),a=s.doc.resolve(n.from).blockRange(),l=a&&Pe(a,e.type,i);if(!l)return null;if(s.wrap(a,l),e.keepMarks&&e.editor){const{selection:n,storedMarks:r}=t,{splittableMarks:o}=e.editor.extensionManager,i=r||n.$to.parentOffset&&n.$from.marks();if(i){const e=i.filter(e=>o.includes(e.type.name));s.ensureMarks(e)}}if(e.keepAttributes){const t="bulletList"===e.type.name||"orderedList"===e.type.name?"listItem":"taskList";o().updateAttributes(t,i).run()}const c=s.doc.resolve(n.from-1).nodeBefore;c&&c.type===e.type&&Fe(s.doc,n.from-1)&&(!e.joinPredicate||e.joinPredicate(r,c))&&s.join(n.from-1)},undoable:e.undoable})}var zs=class{constructor(e){var t,n,r,o,i,s;this.directions=["bottom-left","bottom-right","top-left","top-right"],this.minSize={height:8,width:8},this.preserveAspectRatio=!1,this.classNames={container:"",wrapper:"",handle:"",resizing:""},this.initialWidth=0,this.initialHeight=0,this.aspectRatio=1,this.isResizing=!1,this.activeHandle=null,this.startX=0,this.startY=0,this.startWidth=0,this.startHeight=0,this.isShiftKeyPressed=!1,this.lastEditableState=void 0,this.handleMap=new Map,this.handleMouseMove=e=>{if(!this.isResizing||!this.activeHandle)return;const t=e.clientX-this.startX,n=e.clientY-this.startY;this.handleResize(t,n)},this.handleTouchMove=e=>{if(!this.isResizing||!this.activeHandle)return;const t=e.touches[0];if(!t)return;const n=t.clientX-this.startX,r=t.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>{if(!this.isResizing)return;const e=this.element.offsetWidth,t=this.element.offsetHeight;this.onCommit(e,t),this.isResizing=!1,this.activeHandle=null,this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp)},this.handleKeyDown=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=e=>{"Shift"===e.key&&(this.isShiftKeyPressed=!1)},this.node=e.node,this.editor=e.editor,this.element=e.element,this.contentElement=e.contentElement,this.getPos=e.getPos,this.onResize=e.onResize,this.onCommit=e.onCommit,this.onUpdate=e.onUpdate,(null==(t=e.options)?void 0:t.min)&&(this.minSize={...this.minSize,...e.options.min}),(null==(n=e.options)?void 0:n.max)&&(this.maxSize=e.options.max),(null==(r=null==e?void 0:e.options)?void 0:r.directions)&&(this.directions=e.options.directions),(null==(o=e.options)?void 0:o.preserveAspectRatio)&&(this.preserveAspectRatio=e.options.preserveAspectRatio),(null==(i=e.options)?void 0:i.className)&&(this.classNames={container:e.options.className.container||"",wrapper:e.options.className.wrapper||"",handle:e.options.className.handle||"",resizing:e.options.className.resizing||""}),(null==(s=e.options)?void 0:s.createCustomHandle)&&(this.createCustomHandle=e.options.createCustomHandle),this.wrapper=this.createWrapper(),this.container=this.createContainer(),this.applyInitialSize(),this.attachHandles(),this.editor.on("update",this.handleEditorUpdate.bind(this))}get dom(){return this.container}get contentDOM(){var e;return null!=(e=this.contentElement)?e:null}handleEditorUpdate(){const e=this.editor.isEditable;e!==this.lastEditableState&&(this.lastEditableState=e,e?e&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(e,t,n){return e.type===this.node.type&&(this.node=e,!this.onUpdate||this.onUpdate(e,t,n))}destroy(){this.isResizing&&(this.container.dataset.resizeState="false",this.classNames.resizing&&this.container.classList.remove(this.classNames.resizing),document.removeEventListener("mousemove",this.handleMouseMove),document.removeEventListener("mouseup",this.handleMouseUp),document.removeEventListener("keydown",this.handleKeyDown),document.removeEventListener("keyup",this.handleKeyUp),this.isResizing=!1,this.activeHandle=null),this.editor.off("update",this.handleEditorUpdate.bind(this)),this.container.remove()}createContainer(){const e=document.createElement("div");return e.dataset.resizeContainer="",e.dataset.node=this.node.type.name,e.style.display="flex",this.classNames.container&&(e.className=this.classNames.container),e.appendChild(this.wrapper),e}createWrapper(){const e=document.createElement("div");return e.style.position="relative",e.style.display="block",e.dataset.resizeWrapper="",this.classNames.wrapper&&(e.className=this.classNames.wrapper),e.appendChild(this.element),e}createHandle(e){const t=document.createElement("div");return t.dataset.resizeHandle=e,t.style.position="absolute",this.classNames.handle&&(t.className=this.classNames.handle),t}positionHandle(e,t){const n=t.includes("top"),r=t.includes("bottom"),o=t.includes("left"),i=t.includes("right");n&&(e.style.top="0"),r&&(e.style.bottom="0"),o&&(e.style.left="0"),i&&(e.style.right="0"),"top"!==t&&"bottom"!==t||(e.style.left="0",e.style.right="0"),"left"!==t&&"right"!==t||(e.style.top="0",e.style.bottom="0")}attachHandles(){this.directions.forEach(e=>{let t;t=this.createCustomHandle?this.createCustomHandle(e):this.createHandle(e),t instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${e}") did not return an HTMLElement. Falling back to default handle.`),t=this.createHandle(e)),this.createCustomHandle||this.positionHandle(t,e),t.addEventListener("mousedown",t=>this.handleResizeStart(t,e)),t.addEventListener("touchstart",t=>this.handleResizeStart(t,e)),this.handleMap.set(e,t),this.wrapper.appendChild(t)})}removeHandles(){this.handleMap.forEach(e=>e.remove()),this.handleMap.clear()}applyInitialSize(){const e=this.node.attrs.width,t=this.node.attrs.height;e?(this.element.style.width=`${e}px`,this.initialWidth=e):this.initialWidth=this.element.offsetWidth,t?(this.element.style.height=`${t}px`,this.initialHeight=t):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(e,t){e.preventDefault(),e.stopPropagation(),this.isResizing=!0,this.activeHandle=t,"touches"in e?(this.startX=e.touches[0].clientX,this.startY=e.touches[0].clientY):(this.startX=e.clientX,this.startY=e.clientY),this.startWidth=this.element.offsetWidth,this.startHeight=this.element.offsetHeight,this.startWidth>0&&this.startHeight>0&&(this.aspectRatio=this.startWidth/this.startHeight),this.getPos(),this.container.dataset.resizeState="true",this.classNames.resizing&&this.container.classList.add(this.classNames.resizing),document.addEventListener("mousemove",this.handleMouseMove),document.addEventListener("touchmove",this.handleTouchMove),document.addEventListener("mouseup",this.handleMouseUp),document.addEventListener("keydown",this.handleKeyDown),document.addEventListener("keyup",this.handleKeyUp)}handleResize(e,t){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:o}=this.calculateNewDimensions(this.activeHandle,e,t),i=this.applyConstraints(r,o,n);this.element.style.width=`${i.width}px`,this.element.style.height=`${i.height}px`,this.onResize&&this.onResize(i.width,i.height)}calculateNewDimensions(e,t,n){let r=this.startWidth,o=this.startHeight;const i=e.includes("right"),s=e.includes("left"),a=e.includes("bottom"),l=e.includes("top");return i?r=this.startWidth+t:s&&(r=this.startWidth-t),a?o=this.startHeight+n:l&&(o=this.startHeight-n),"right"!==e&&"left"!==e||(r=this.startWidth+(i?t:-t)),"top"!==e&&"bottom"!==e||(o=this.startHeight+(a?n:-n)),this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,o,e):{width:r,height:o}}applyConstraints(e,t,n){var r,o,i,s;if(!n){let n=Math.max(this.minSize.width,e),i=Math.max(this.minSize.height,t);return(null==(r=this.maxSize)?void 0:r.width)&&(n=Math.min(this.maxSize.width,n)),(null==(o=this.maxSize)?void 0:o.height)&&(i=Math.min(this.maxSize.height,i)),{width:n,height:i}}let a=e,l=t;return a<this.minSize.width&&(a=this.minSize.width,l=a/this.aspectRatio),l<this.minSize.height&&(l=this.minSize.height,a=l*this.aspectRatio),(null==(i=this.maxSize)?void 0:i.width)&&a>this.maxSize.width&&(a=this.maxSize.width,l=a/this.aspectRatio),(null==(s=this.maxSize)?void 0:s.height)&&l>this.maxSize.height&&(l=this.maxSize.height,a=l*this.aspectRatio),{width:a,height:l}}applyAspectRatio(e,t,n){const r="top"===n||"bottom"===n;return"left"===n||"right"===n?{width:e,height:e/this.aspectRatio}:r?{width:t*this.aspectRatio,height:t}:{width:e,height:e/this.aspectRatio}}};function Ls(e){if(!(null==e?void 0:e.trim()))return{};const t={},n=[],r=e.replace(/["']([^"']*)["']/g,e=>(n.push(e),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const e=o.map(e=>e.trim().slice(1));t.class=e.join(" ")}const i=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);i&&(t.id=i[1]),Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,e,r])=>{var o;const i=parseInt((null==(o=r.match(/__QUOTED_(\d+)__/))?void 0:o[1])||"0",10),s=n[i];s&&(t[e]=s.slice(1,-1))});const s=r.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return s&&s.split(/\s+/).filter(Boolean).forEach(e=>{e.match(/^[a-zA-Z][\w-]*$/)&&(t[e]=!0)}),t}function Fs(e){if(!e||0===Object.keys(e).length)return"";const t=[];return e.class&&String(e.class).split(/\s+/).filter(Boolean).forEach(e=>t.push(`.${e}`)),e.id&&t.push(`#${e.id}`),Object.entries(e).forEach(([e,n])=>{"class"!==e&&"id"!==e&&(!0===n?t.push(e):!1!==n&&null!=n&&t.push(`${e}="${String(n)}"`))}),t.join(" ")}function Hs(e){const{nodeName:t,name:n,parseAttributes:r=Ls,serializeAttributes:o=Fs,defaultAttributes:i={},requiredAttributes:s=[],allowedAttributes:a}=e,l=n||t;return{parseMarkdown:(e,n)=>{const r={...i,...e.attributes};return n.createNode(t,r,[])},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${l}(?:\\s|$)`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,o){const i=new RegExp(`^:::${l}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=e.match(i);if(!a)return;const c=a[1]||"",d=r(c);return s.find(e=>!(e in d))?void 0:{type:t,raw:a[0],attributes:d}}},renderMarkdown:e=>{const t=(e=>{if(!a)return e;const t={};return a.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),n=o(t);return`:::${l}${n?` {${n}}`:""} :::`}}}function js(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=Ls,serializeAttributes:i=Fs,defaultAttributes:s={},content:a="block",allowedAttributes:l}=e,c=n||t;return{parseMarkdown:(e,n)=>{let o;if(r){const t=r(e);o="string"==typeof t?[{type:"text",text:t}]:t}else o="block"===a?n.parseChildren(e.tokens||[]):n.parseInline(e.tokens||[]);const i={...s,...e.attributes};return n.createNode(t,i,o)},markdownTokenizer:{name:t,level:"block",start(e){var t;const n=new RegExp(`^:::${c}`,"m"),r=null==(t=e.match(n))?void 0:t.index;return void 0!==r?r:-1},tokenize(e,n,r){var i;const s=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),l=e.match(s);if(!l)return;const[d,u=""]=l,h=o(u);let p=1;const f=d.length;let m="";const g=/^:::([\w-]*)(\s.*)?/gm,v=e.slice(f);for(g.lastIndex=0;;){const n=g.exec(v);if(null===n)break;const o=n.index,s=n[1];if(!(null==(i=n[2])?void 0:i.endsWith(":::")))if(s)p+=1;else if(p-=1,0===p){const i=v.slice(0,o);m=i.trim();const s=e.slice(0,f+o+n[0].length);let l=[];if(m)if("block"===a)for(l=r.blockTokens(i),l.forEach(e=>{!e.text||e.tokens&&0!==e.tokens.length||(e.tokens=r.inlineTokens(e.text))});l.length>0;){const e=l[l.length-1];if("paragraph"!==e.type||e.text&&""!==e.text.trim())break;l.pop()}else l=r.inlineTokens(m);return{type:t,raw:s,attributes:h,content:m,tokens:l}}}}},renderMarkdown:(e,t)=>{const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{n in e&&(t[n]=e[n])}),t})(e.attrs||{}),r=i(n),o=r?` {${r}}`:"",s=t.renderChildren(e.content||[],"\n\n");return`:::${c}${o}\n\n${s}\n\n:::`}}}function Bs(e){if(!e.trim())return{};const t={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(e);for(;null!==r;){const[,o,i,s]=r;t[o]=i||s,r=n.exec(e)}return t}function _s(e){return Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}="${t}"`).join(" ")}function Vs(e){const{nodeName:t,name:n,getContent:r,parseAttributes:o=Bs,serializeAttributes:i=_s,defaultAttributes:s={},selfClosing:a=!1,allowedAttributes:l}=e,c=n||t,d=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(e,n)=>{const o={...s,...e.attributes};if(a)return n.createNode(t,o);const i=r?r(e):e.content||"";return i?n.createNode(t,o,[n.createTextNode(i)]):n.createNode(t,o,[])},markdownTokenizer:{name:t,level:"inline",start(e){const t=a?new RegExp(`\\[${d}\\s*[^\\]]*\\]`):new RegExp(`\\[${d}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${d}\\]`),n=e.match(t),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(e,n,r){const i=a?new RegExp(`^\\[${d}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${d}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${d}\\]`),s=e.match(i);if(!s)return;let l="",c="";if(a){const[,e]=s;c=e}else{const[,e,t]=s;c=e,l=t||""}const u=o(c.trim());return{type:t,raw:s[0],content:l.trim(),attributes:u}}},renderMarkdown:e=>{let t="";r?t=r(e):e.content&&e.content.length>0&&(t=e.content.filter(e=>"text"===e.type).map(e=>e.text).join(""));const n=(e=>{if(!l)return e;const t={};return l.forEach(n=>{const r="string"==typeof n?n:n.name,o="string"==typeof n?void 0:n.skipIfDefault;if(r in e){const n=e[r];if(void 0!==o&&n===o)return;t[r]=n}}),t})(e.attrs||{}),o=i(n),s=o?` ${o}`:"";return a?`[${c}${s}]`:`[${c}${s}]${t}[/${c}]`}}}function Ws(e,t,n){var r,o,i,s;const a=e.split("\n"),l=[];let c="",d=0;const u=t.baseIndentSize||2;for(;d<a.length;){const e=a[d],h=e.match(t.itemPattern);if(!h){if(l.length>0)break;if(""===e.trim()){d+=1,c=`${c}${e}\n`;continue}return}const p=t.extractItemData(h),{indentLevel:f,mainContent:m}=p;c=`${c}${e}\n`;const g=[m];for(d+=1;d<a.length;){const e=a[d];if(""===e.trim()){const t=a.slice(d+1).findIndex(e=>""!==e.trim());if(-1===t)break;if(((null==(o=null==(r=a[d+1+t].match(/^(\s*)/))?void 0:r[1])?void 0:o.length)||0)>f){g.push(e),c=`${c}${e}\n`,d+=1;continue}break}if(!(((null==(s=null==(i=e.match(/^(\s*)/))?void 0:i[1])?void 0:s.length)||0)>f))break;g.push(e),c=`${c}${e}\n`,d+=1}let v;const y=g.slice(1);if(y.length>0){const e=y.map(e=>e.slice(f+u)).join("\n");e.trim()&&(v=t.customNestedParser?t.customNestedParser(e):n.blockTokens(e))}const b=t.createToken(p,v);l.push(b)}if(0!==l.length)return{items:l,raw:c}}function qs(e,t,n,r){if(!e||!Array.isArray(e.content))return"";const o="function"==typeof n?n(r):n,[i,...s]=e.content,a=[`${o}${t.renderChildren([i])}`];return s&&s.length>0&&s.forEach(e=>{const n=t.renderChildren([e]);if(n){const e=n.split("\n").map(e=>e?t.indent(e):"").join("\n");a.push(e)}}),a.join("\n")}io({},{createAtomBlockMarkdownSpec:()=>Hs,createBlockMarkdownSpec:()=>js,createInlineMarkdownSpec:()=>Vs,parseAttributes:()=>Ls,parseIndentedBlocks:()=>Ws,renderNestedMarkdownContent:()=>qs,serializeAttributes:()=>Fs});var Ks=class e extends fs{constructor(){super(...arguments),this.type="node"}static create(t={}){const n="function"==typeof t?t():t;return new e(n)}configure(e){return super.configure(e)}extend(e){const t="function"==typeof e?e():e;return super.extend(t)}},Js=class{constructor(e,t,n){this.isDragging=!1,this.component=e,this.editor=t.editor,this.options={stopEvent:null,ignoreMutation:null,...n},this.extension=t.extension,this.node=t.node,this.decorations=t.decorations,this.innerDecorations=t.innerDecorations,this.view=t.view,this.HTMLAttributes=t.HTMLAttributes,this.getPos=t.getPos,this.mount()}mount(){}get dom(){return this.editor.view.dom}get contentDOM(){return null}onDragStart(e){var t,n,r,o,i,s,a;const{view:l}=this.editor,c=e.target,d=3===c.nodeType?null==(t=c.parentElement)?void 0:t.closest("[data-drag-handle]"):c.closest("[data-drag-handle]");if(!this.dom||(null==(n=this.contentDOM)?void 0:n.contains(c))||!d)return;let u=0,h=0;if(this.dom!==d){const t=this.dom.getBoundingClientRect(),n=d.getBoundingClientRect(),a=null!=(o=e.offsetX)?o:null==(r=e.nativeEvent)?void 0:r.offsetX,l=null!=(s=e.offsetY)?s:null==(i=e.nativeEvent)?void 0:i.offsetY;u=n.x-t.x+a,h=n.y-t.y+l}const p=this.dom.cloneNode(!0);try{const e=this.dom.getBoundingClientRect();p.style.width=`${Math.round(e.width)}px`,p.style.height=`${Math.round(e.height)}px`,p.style.boxSizing="border-box",p.style.pointerEvents="none"}catch{}let f=null;try{f=document.createElement("div"),f.style.position="absolute",f.style.top="-9999px",f.style.left="-9999px",f.style.pointerEvents="none",f.appendChild(p),document.body.appendChild(f),null==(a=e.dataTransfer)||a.setDragImage(p,u,h)}finally{f&&setTimeout(()=>{try{null==f||f.remove()}catch{}},0)}const m=this.getPos();if("number"!=typeof m)return;const g=dt.create(l.state.doc,m),v=l.state.tr.setSelection(g);l.dispatch(v)}stopEvent(e){var t;if(!this.dom)return!1;if("function"==typeof this.options.stopEvent)return this.options.stopEvent({event:e});const n=e.target;if(!this.dom.contains(n)||(null==(t=this.contentDOM)?void 0:t.contains(n)))return!1;const r=e.type.startsWith("drag"),o="drop"===e.type;if((["INPUT","BUTTON","SELECT","TEXTAREA"].includes(n.tagName)||n.isContentEditable)&&!o&&!r)return!0;const{isEditable:i}=this.editor,{isDragging:s}=this,a=!!this.node.type.spec.draggable,l=dt.isSelectable(this.node),c="copy"===e.type,d="paste"===e.type,u="cut"===e.type,h="mousedown"===e.type;if(!a&&l&&r&&e.target===this.dom&&e.preventDefault(),a&&r&&!s&&e.target===this.dom)return e.preventDefault(),!1;if(a&&i&&!s&&h){const e=n.closest("[data-drag-handle]");e&&(this.dom===e||this.dom.contains(e))&&(this.isDragging=!0,document.addEventListener("dragend",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("drop",()=>{this.isDragging=!1},{once:!0}),document.addEventListener("mouseup",()=>{this.isDragging=!1},{once:!0}))}return!(s||o||c||d||u||h&&l)}ignoreMutation(e){return!this.dom||!this.contentDOM||("function"==typeof this.options.ignoreMutation?this.options.ignoreMutation({mutation:e}):!(!this.node.isLeaf&&!this.node.isAtom)||"selection"!==e.type&&(!(this.dom.contains(e.target)&&"childList"===e.type&&($o()||Po())&&this.editor.isFocused&&[...Array.from(e.addedNodes),...Array.from(e.removedNodes)].every(e=>e.isContentEditable))&&(this.contentDOM===e.target&&"attributes"===e.type||!this.contentDOM.contains(e.target))))}updateAttributes(e){this.editor.commands.command(({tr:t})=>{const n=this.getPos();return"number"==typeof n&&(t.setNodeMarkup(n,void 0,{...this.node.attrs,...e}),!0)})}deleteNode(){const e=this.getPos();if("number"!=typeof e)return;const t=e+this.node.nodeSize;this.editor.commands.deleteRange({from:e,to:t})}};function Us(e){return new gs({find:e.find,handler:({state:t,range:n,match:r,pasteEvent:o})=>{const i=wi(e.getAttributes,void 0,r,o);if(!1===i||null===i)return null;const{tr:s}=t,a=r[r.length-1],l=r[0];let c=n.to;if(a){const r=l.search(/\S/),o=n.from+l.indexOf(a),d=o+a.length;if(Pi(n.from,n.to,t.doc).filter(t=>t.mark.type.excluded.find(n=>n===e.type&&n!==t.mark.type)).filter(e=>e.to>o).length)return null;d<n.to&&s.delete(d,n.to),o>n.from&&s.delete(n.from+r,o),c=n.from+r+a.length,s.addMark(n.from+r,c,e.type.create(i||{})),s.removeStoredMark(e.type)}}})}var Gs=(e,t)=>{if("slot"===e)return 0;if(e instanceof Function)return e(t);const{children:n,...r}=null!=t?t:{};if("svg"===e)throw new Error("SVG elements are not supported in the JSX syntax, use the array syntax instead");return[e,r,n]},Xs=/^\s*>\s$/,Ys=Ks.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:e}){return Gs("blockquote",{...Mi(this.options.HTMLAttributes,e),children:Gs("slot",{})})},parseMarkdown:(e,t)=>t.createNode("blockquote",void 0,t.parseChildren(e.tokens||[])),renderMarkdown:(e,t)=>{if(!e.content)return"";const n=[];return e.content.forEach(e=>{const r=t.renderChildren([e]).split("\n").map(e=>""===e.trim()?">":`> ${e}`);n.push(r.join("\n"))}),n.join("\n>\n")},addCommands(){return{setBlockquote:()=>({commands:e})=>e.wrapIn(this.name),toggleBlockquote:()=>({commands:e})=>e.toggleWrap(this.name),unsetBlockquote:()=>({commands:e})=>e.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Is({find:Xs,type:this.type})]}}),Qs=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,Zs=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,ea=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,ta=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,na=ms.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:e=>"normal"!==e.style.fontWeight&&null},{style:"font-weight=400",clearMark:e=>e.type.name===this.name},{style:"font-weight",getAttrs:e=>/^(bold(er)?|[5-9]\d{2,})$/.test(e)&&null}]},renderHTML({HTMLAttributes:e}){return Gs("strong",{...Mi(this.options.HTMLAttributes,e),children:Gs("slot",{})})},markdownTokenName:"strong",parseMarkdown:(e,t)=>t.applyMark("bold",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`**${t.renderChildren(e)}**`,addCommands(){return{setBold:()=>({commands:e})=>e.setMark(this.name),toggleBold:()=>({commands:e})=>e.toggleMark(this.name),unsetBold:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[Ds({find:Qs,type:this.type}),Ds({find:ea,type:this.type})]},addPasteRules(){return[Us({find:Zs,type:this.type}),Us({find:ta,type:this.type})]}}),ra=/(^|[^`])`([^`]+)`(?!`)$/,oa=/(^|[^`])`([^`]+)`(?!`)/g,ia=ms.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:e}){return["code",Mi(this.options.HTMLAttributes,e),0]},markdownTokenName:"codespan",parseMarkdown:(e,t)=>t.applyMark("code",[{type:"text",text:e.text||""}]),renderMarkdown:(e,t)=>e.content?`\`${t.renderChildren(e.content)}\``:"",addCommands(){return{setCode:()=>({commands:e})=>e.setMark(this.name),toggleCode:()=>({commands:e})=>e.toggleMark(this.name),unsetCode:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[Ds({find:ra,type:this.type})]},addPasteRules(){return[Us({find:oa,type:this.type})]}}),sa=/^```([a-z]+)?[\s\n]$/,aa=/^~~~([a-z]+)?[\s\n]$/,la=Ks.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,enableTabIndentation:!1,tabSize:4,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:e=>{var t;const{languageClassPrefix:n}=this.options;if(!n)return null;return[...(null==(t=e.firstElementChild)?void 0:t.classList)||[]].filter(e=>e.startsWith(n)).map(e=>e.replace(n,""))[0]||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:e,HTMLAttributes:t}){return["pre",Mi(this.options.HTMLAttributes,t),["code",{class:e.attrs.language?this.options.languageClassPrefix+e.attrs.language:null},0]]},markdownTokenName:"code",parseMarkdown:(e,t)=>{var n,r;return!1===(null==(n=e.raw)?void 0:n.startsWith("```"))&&!1===(null==(r=e.raw)?void 0:r.startsWith("~~~"))&&"indented"!==e.codeBlockStyle?[]:t.createNode("codeBlock",{language:e.lang||null},e.text?[t.createTextNode(e.text)]:[])},renderMarkdown:(e,t)=>{var n;let r="";const o=(null==(n=e.attrs)?void 0:n.language)||"";return r=e.content?[`\`\`\`${o}`,t.renderChildren(e.content),"```"].join("\n"):`\`\`\`${o}\n\n\`\`\``,r},addCommands(){return{setCodeBlock:e=>({commands:t})=>t.setNode(this.name,e),toggleCodeBlock:e=>({commands:t})=>t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{const{empty:e,$anchor:t}=this.editor.state.selection,n=1===t.pos;return!(!e||t.parent.type.name!==this.name)&&!(!n&&t.parent.textContent.length)&&this.editor.commands.clearNodes()},Tab:({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;if(i.parent.type!==this.type)return!1;const a=" ".repeat(n);return s?e.commands.insertContent(a):e.commands.command(({tr:e})=>{const{from:t,to:n}=o,i=r.doc.textBetween(t,n,"\n","\n").split("\n").map(e=>a+e).join("\n");return e.replaceWith(t,n,r.schema.text(i)),!0})},"Shift-Tab":({editor:e})=>{var t;if(!this.options.enableTabIndentation)return!1;const n=null!=(t=this.options.tabSize)?t:4,{state:r}=e,{selection:o}=r,{$from:i,empty:s}=o;return i.parent.type===this.type&&(s?e.commands.command(({tr:e})=>{var t;const{pos:o}=i,s=i.start(),a=i.end(),l=r.doc.textBetween(s,a,"\n","\n").split("\n");let c=0,d=0;const u=o-s;for(let e=0;e<l.length;e+=1){if(d+l[e].length>=u){c=e;break}d+=l[e].length+1}const h=(null==(t=l[c].match(/^ */))?void 0:t[0])||"",p=Math.min(h.length,n);if(0===p)return!0;let f=s;for(let e=0;e<c;e+=1)f+=l[e].length+1;return e.delete(f,f+p),o-f<=p&&e.setSelection(lt.create(e.doc,f)),!0}):e.commands.command(({tr:e})=>{const{from:t,to:i}=o,s=r.doc.textBetween(t,i,"\n","\n").split("\n").map(e=>{var t;const r=(null==(t=e.match(/^ */))?void 0:t[0])||"",o=Math.min(r.length,n);return e.slice(o)}).join("\n");return e.replaceWith(t,i,r.schema.text(s)),!0}))},Enter:({editor:e})=>{if(!this.options.exitOnTripleEnter)return!1;const{state:t}=e,{selection:n}=t,{$from:r,empty:o}=n;if(!o||r.parent.type!==this.type)return!1;const i=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith("\n\n");return!(!i||!s)&&e.chain().command(({tr:e})=>(e.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:e})=>{if(!this.options.exitOnArrowDown)return!1;const{state:t}=e,{selection:n,doc:r}=t,{$from:o,empty:i}=n;if(!i||o.parent.type!==this.type)return!1;if(o.parentOffset!==o.parent.nodeSize-2)return!1;const s=o.after();return void 0!==s&&(r.nodeAt(s)?e.commands.command(({tr:e})=>(e.setSelection(ot.near(r.resolve(s))),!0)):e.commands.exitCode())}}},addInputRules(){return[$s({find:sa,type:this.type,getAttributes:e=>({language:e[1]})}),$s({find:aa,type:this.type,getAttributes:e=>({language:e[1]})})]},addProseMirrorPlugins(){return[new bt({key:new xt("codeBlockVSCodeHandler"),props:{handlePaste:(e,t)=>{if(!t.clipboardData)return!1;if(this.editor.isActive(this.type.name))return!1;const n=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),o=r?JSON.parse(r):void 0,i=null==o?void 0:o.mode;if(!n||!i)return!1;const{tr:s,schema:a}=e.state,l=a.text(n.replace(/\r\n?/g,"\n"));return s.replaceSelectionWith(this.type.create({language:i},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(lt.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),e.dispatch(s),!0}}})]}}),ca=Ks.create({name:"doc",topNode:!0,content:"block+",renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n\n"):""}),da=Ks.create({name:"hardBreak",markdownTokenName:"br",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,linebreakReplacement:!0,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:e}){return["br",Mi(this.options.HTMLAttributes,e)]},renderText(){return"\n"},renderMarkdown:()=>" \n",parseMarkdown:()=>({type:"hardBreak"}),addCommands(){return{setHardBreak:()=>({commands:e,chain:t,state:n,editor:r})=>e.first([()=>e.exitCode(),()=>e.command(()=>{const{selection:e,storedMarks:o}=n;if(e.$from.parent.type.spec.isolating)return!1;const{keepMarks:i}=this.options,{splittableMarks:s}=r.extensionManager,a=o||e.$to.parentOffset&&e.$from.marks();return t().insertContent({type:this.name}).command(({tr:e,dispatch:t})=>{if(t&&a&&i){const t=a.filter(e=>s.includes(e.type.name));e.ensureMarks(t)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}}),ua=Ks.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(e=>({tag:`h${e}`,attrs:{level:e}}))},renderHTML({node:e,HTMLAttributes:t}){return[`h${this.options.levels.includes(e.attrs.level)?e.attrs.level:this.options.levels[0]}`,Mi(this.options.HTMLAttributes,t),0]},parseMarkdown:(e,t)=>t.createNode("heading",{level:e.depth||1},t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>{var n;const r=(null==(n=e.attrs)?void 0:n.level)?parseInt(e.attrs.level,10):1,o="#".repeat(r);return e.content?`${o} ${t.renderChildren(e.content)}`:""},addCommands(){return{setHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.setNode(this.name,e),toggleHeading:e=>({commands:t})=>!!this.options.levels.includes(e.level)&&t.toggleNode(this.name,"paragraph",e)}},addKeyboardShortcuts(){return this.options.levels.reduce((e,t)=>({...e,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(e=>$s({find:new RegExp(`^(#{${Math.min(...this.options.levels)},${e}})\\s$`),type:this.type,getAttributes:{level:e}}))}}),ha=Ks.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{},nextNodeType:"paragraph"}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:e}){return["hr",Mi(this.options.HTMLAttributes,e)]},markdownTokenName:"hr",parseMarkdown:(e,t)=>t.createNode("horizontalRule"),renderMarkdown:()=>"---",addCommands(){return{setHorizontalRule:()=>({chain:e,state:t})=>{if(!function(e,t){const{selection:n}=e,{$from:r}=n;if(n instanceof dt){const e=r.index();return r.parent.canReplaceWith(e,e+1,t)}let o=r.depth;for(;o>=0;){const e=r.index(o);if(r.node(o).contentMatchAt(e).matchType(t))return!0;o-=1}return!1}(t,t.schema.nodes[this.name]))return!1;const{selection:n}=t,{$to:r}=n,o=e();return Hi(n)?o.insertContentAt(r.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({state:e,tr:t,dispatch:n})=>{if(n){const{$to:n}=t.selection,r=n.end();if(n.nodeAfter)n.nodeAfter.isTextblock?t.setSelection(lt.create(t.doc,n.pos+1)):n.nodeAfter.isBlock?t.setSelection(dt.create(t.doc,n.pos)):t.setSelection(lt.create(t.doc,n.pos));else{const o=e.schema.nodes[this.options.nextNodeType]||n.parent.type.contentMatch.defaultType,i=null==o?void 0:o.create();i&&(t.insert(r,i),t.setSelection(lt.create(t.doc,r+1)))}t.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Ps({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}}),pa=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,fa=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,ma=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,ga=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,va=ms.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:e=>"normal"!==e.style.fontStyle&&null},{style:"font-style=normal",clearMark:e=>e.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:e}){return["em",Mi(this.options.HTMLAttributes,e),0]},addCommands(){return{setItalic:()=>({commands:e})=>e.setMark(this.name),toggleItalic:()=>({commands:e})=>e.toggleMark(this.name),unsetItalic:()=>({commands:e})=>e.unsetMark(this.name)}},markdownTokenName:"em",parseMarkdown:(e,t)=>t.applyMark("italic",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`*${t.renderChildren(e)}*`,addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[Ds({find:pa,type:this.type}),Ds({find:ma,type:this.type})]},addPasteRules(){return[Us({find:fa,type:this.type}),Us({find:ga,type:this.type})]}});const ya="numeric",ba="ascii",ka="alpha",wa="asciinumeric",xa="alphanumeric",Sa="domain",Ca="emoji",Ma="scheme",Ta="slashscheme",Aa="whitespace";function Oa(e,t){return e in t||(t[e]=[]),t[e]}function Ea(e,t,n){t[ya]&&(t[wa]=!0,t[xa]=!0),t[ba]&&(t[wa]=!0,t[ka]=!0),t[wa]&&(t[xa]=!0),t[ka]&&(t[xa]=!0),t[xa]&&(t[Sa]=!0),t[Ca]&&(t[Sa]=!0);for(const r in t){const t=Oa(r,n);t.indexOf(e)<0&&t.push(e)}}function Na(e=null){this.j={},this.jr=[],this.jd=null,this.t=e}Na.groups={},Na.prototype={accepts(){return!!this.t},go(e){const t=this,n=t.j[e];if(n)return n;for(let n=0;n<t.jr.length;n++){const r=t.jr[n][0],o=t.jr[n][1];if(o&&r.test(e))return o}return t.jd},has(e,t=!1){return t?e in this.j:!!this.go(e)},ta(e,t,n,r){for(let o=0;o<e.length;o++)this.tt(e[o],t,n,r)},tr(e,t,n,r){let o;return r=r||Na.groups,t&&t.j?o=t:(o=new Na(t),n&&r&&Ea(t,n,r)),this.jr.push([e,o]),o},ts(e,t,n,r){let o=this;const i=e.length;if(!i)return o;for(let t=0;t<i-1;t++)o=o.tt(e[t]);return o.tt(e[i-1],t,n,r)},tt(e,t,n,r){r=r||Na.groups;const o=this;if(t&&t.j)return o.j[e]=t,t;const i=t;let s,a=o.go(e);if(a?(s=new Na,Object.assign(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new Na,i){if(r)if(s.t&&"string"==typeof s.t){const e=Object.assign(function(e,t){const n={};for(const r in t)t[r].indexOf(e)>=0&&(n[r]=!0);return n}(s.t,r),n);Ea(i,e,r)}else n&&Ea(i,n,r);s.t=i}return o.j[e]=s,s}};const Ra=(e,t,n,r,o)=>e.ta(t,n,r,o),Da=(e,t,n,r,o)=>e.tr(t,n,r,o),Pa=(e,t,n,r,o)=>e.ts(t,n,r,o),$a=(e,t,n,r,o)=>e.tt(t,n,r,o),Ia="WORD",za="UWORD",La="ASCIINUMERICAL",Fa="ALPHANUMERICAL",Ha="LOCALHOST",ja="TLD",Ba="UTLD",_a="SCHEME",Va="SLASH_SCHEME",Wa="NUM",qa="WS",Ka="NL",Ja="OPENBRACE",Ua="CLOSEBRACE",Ga="OPENBRACKET",Xa="CLOSEBRACKET",Ya="OPENPAREN",Qa="CLOSEPAREN",Za="OPENANGLEBRACKET",el="CLOSEANGLEBRACKET",tl="FULLWIDTHLEFTPAREN",nl="FULLWIDTHRIGHTPAREN",rl="LEFTCORNERBRACKET",ol="RIGHTCORNERBRACKET",il="LEFTWHITECORNERBRACKET",sl="RIGHTWHITECORNERBRACKET",al="FULLWIDTHLESSTHAN",ll="FULLWIDTHGREATERTHAN",cl="AMPERSAND",dl="APOSTROPHE",ul="ASTERISK",hl="AT",pl="BACKSLASH",fl="BACKTICK",ml="CARET",gl="COLON",vl="COMMA",yl="DOLLAR",bl="DOT",kl="EQUALS",wl="EXCLAMATION",xl="HYPHEN",Sl="PERCENT",Cl="PIPE",Ml="PLUS",Tl="POUND",Al="QUERY",Ol="QUOTE",El="FULLWIDTHMIDDLEDOT",Nl="SEMI",Rl="SLASH",Dl="TILDE",Pl="UNDERSCORE",$l="EMOJI",Il="SYM";var zl=Object.freeze({__proto__:null,ALPHANUMERICAL:Fa,AMPERSAND:cl,APOSTROPHE:dl,ASCIINUMERICAL:La,ASTERISK:ul,AT:hl,BACKSLASH:pl,BACKTICK:fl,CARET:ml,CLOSEANGLEBRACKET:el,CLOSEBRACE:Ua,CLOSEBRACKET:Xa,CLOSEPAREN:Qa,COLON:gl,COMMA:vl,DOLLAR:yl,DOT:bl,EMOJI:$l,EQUALS:kl,EXCLAMATION:wl,FULLWIDTHGREATERTHAN:ll,FULLWIDTHLEFTPAREN:tl,FULLWIDTHLESSTHAN:al,FULLWIDTHMIDDLEDOT:El,FULLWIDTHRIGHTPAREN:nl,HYPHEN:xl,LEFTCORNERBRACKET:rl,LEFTWHITECORNERBRACKET:il,LOCALHOST:Ha,NL:Ka,NUM:Wa,OPENANGLEBRACKET:Za,OPENBRACE:Ja,OPENBRACKET:Ga,OPENPAREN:Ya,PERCENT:Sl,PIPE:Cl,PLUS:Ml,POUND:Tl,QUERY:Al,QUOTE:Ol,RIGHTCORNERBRACKET:ol,RIGHTWHITECORNERBRACKET:sl,SCHEME:_a,SEMI:Nl,SLASH:Rl,SLASH_SCHEME:Va,SYM:Il,TILDE:Dl,TLD:ja,UNDERSCORE:Pl,UTLD:Ba,UWORD:za,WORD:Ia,WS:qa});const Ll=/[a-z]/,Fl=/\p{L}/u,Hl=/\p{Emoji}/u,jl=/\d/,Bl=/\s/;let _l=null,Vl=null;function Wl(e,t){const n=function(e){const t=[],n=e.length;let r=0;for(;r<n;){let o,i=e.charCodeAt(r),s=i<55296||i>56319||r+1===n||(o=e.charCodeAt(r+1))<56320||o>57343?e[r]:e.slice(r,r+2);t.push(s),r+=s.length}return t}(t.replace(/[A-Z]/g,e=>e.toLowerCase())),r=n.length,o=[];let i=0,s=0;for(;s<r;){let a=e,l=null,c=0,d=null,u=-1,h=-1;for(;s<r&&(l=a.go(n[s]));)a=l,a.accepts()?(u=0,h=0,d=a):u>=0&&(u+=n[s].length,h++),c+=n[s].length,i+=n[s].length,s++;i-=u,s-=h,c-=u,o.push({t:d.t,v:t.slice(i-c,i),s:i-c,e:i})}return o}function ql(e,t,n,r,o){let i;const s=t.length;for(let n=0;n<s-1;n++){const s=t[n];e.j[s]?i=e.j[s]:(i=new Na(r),i.jr=o.slice(),e.j[s]=i),e=i}return i=new Na(n),i.jr=o.slice(),e.j[t[s-1]]=i,i}function Kl(e){const t=[],n=[];let r=0;for(;r<e.length;){let o=0;for(;"0123456789".indexOf(e[r+o])>=0;)o++;if(o>0){t.push(n.join(""));for(let t=parseInt(e.substring(r,r+o),10);t>0;t--)n.pop();r+=o}else n.push(e[r]),r++}return t}const Jl={defaultProtocol:"http",events:null,format:Gl,formatHref:Gl,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function Ul(e,t=null){let n=Object.assign({},Jl);e&&(n=Object.assign(n,e instanceof Ul?e.o:e));const r=n.ignoreTags,o=[];for(let e=0;e<r.length;e++)o.push(r[e].toUpperCase());this.o=n,t&&(this.defaultRender=t),this.ignoreTags=o}function Gl(e){return e}function Xl(e,t){this.t="token",this.v=e,this.tk=t}function Yl(e,t){class n extends Xl{constructor(t,n){super(t,n),this.t=e}}for(const e in t)n.prototype[e]=t[e];return n.t=e,n}Ul.prototype={o:Jl,ignoreTags:[],defaultRender(e){return e},check(e){return this.get("validate",e.toString(),e)},get(e,t,n){const r=null!=t;let o=this.o[e];return o?("object"==typeof o?(o=n.t in o?o[n.t]:Jl[e],"function"==typeof o&&r&&(o=o(t,n))):"function"==typeof o&&r&&(o=o(t,n.t,n)),o):o},getObj(e,t,n){let r=this.o[e];return"function"==typeof r&&null!=t&&(r=r(t,n.t,n)),r},render(e){const t=e.render(this);return(this.get("render",null,e)||this.defaultRender)(t,e.t,e)}},Xl.prototype={isLink:!1,toString(){return this.v},toHref(e){return this.toString()},toFormattedString(e){const t=this.toString(),n=e.get("truncate",t,this),r=e.get("format",t,this);return n&&r.length>n?r.substring(0,n)+"…":r},toFormattedHref(e){return e.get("formatHref",this.toHref(e.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(e=Jl.defaultProtocol){return{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(e),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(e){return{type:this.t,value:this.toFormattedString(e),isLink:this.isLink,href:this.toFormattedHref(e),start:this.startIndex(),end:this.endIndex()}},validate(e){return e.get("validate",this.toString(),this)},render(e){const t=this,n=this.toHref(e.get("defaultProtocol")),r=e.get("formatHref",n,this),o=e.get("tagName",n,t),i=this.toFormattedString(e),s={},a=e.get("className",n,t),l=e.get("target",n,t),c=e.get("rel",n,t),d=e.getObj("attributes",n,t),u=e.getObj("events",n,t);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),d&&Object.assign(s,d),{tagName:o,attributes:s,content:i,eventListeners:u}}};const Ql=Yl("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Zl=Yl("text"),ec=Yl("nl"),tc=Yl("url",{isLink:!0,toHref(e=Jl.defaultProtocol){return this.hasProtocol()?this.v:`${e}://${this.v}`},hasProtocol(){const e=this.tk;return e.length>=2&&e[0].t!==Ha&&e[1].t===gl}}),nc=e=>new Na(e);function rc(e,t,n){const r=n[0].s,o=n[n.length-1].e;return new e(t.slice(r,o),n)}const oc="undefined"!=typeof console&&console&&console.warn||(()=>{}),ic={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function sc(e,t=!1){if(ic.initialized&&oc(`linkifyjs: already initialized - will not register custom scheme "${e}" until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(e))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');ic.customSchemes.push([e,t])}function ac(e){return ic.initialized||function(){ic.scanner=function(e=[]){const t={};Na.groups=t;const n=new Na;null==_l&&(_l=Kl("aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4w0s2x0a2z0ure5ba0by2idu3namex4d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dad1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3nd0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0axi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp3ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5mögensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2")),null==Vl&&(Vl=Kl("ελ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")),$a(n,"'",dl),$a(n,"{",Ja),$a(n,"}",Ua),$a(n,"[",Ga),$a(n,"]",Xa),$a(n,"(",Ya),$a(n,")",Qa),$a(n,"<",Za),$a(n,">",el),$a(n,"(",tl),$a(n,")",nl),$a(n,"「",rl),$a(n,"」",ol),$a(n,"『",il),$a(n,"』",sl),$a(n,"<",al),$a(n,">",ll),$a(n,"&",cl),$a(n,"*",ul),$a(n,"@",hl),$a(n,"`",fl),$a(n,"^",ml),$a(n,":",gl),$a(n,",",vl),$a(n,"$",yl),$a(n,".",bl),$a(n,"=",kl),$a(n,"!",wl),$a(n,"-",xl),$a(n,"%",Sl),$a(n,"|",Cl),$a(n,"+",Ml),$a(n,"#",Tl),$a(n,"?",Al),$a(n,'"',Ol),$a(n,"/",Rl),$a(n,";",Nl),$a(n,"~",Dl),$a(n,"_",Pl),$a(n,"\\",pl),$a(n,"・",El);const r=Da(n,jl,Wa,{[ya]:!0});Da(r,jl,r);const o=Da(r,Ll,La,{[wa]:!0}),i=Da(r,Fl,Fa,{[xa]:!0}),s=Da(n,Ll,Ia,{[ba]:!0});Da(s,jl,o),Da(s,Ll,s),Da(o,jl,o),Da(o,Ll,o);const a=Da(n,Fl,za,{[ka]:!0});Da(a,Ll),Da(a,jl,i),Da(a,Fl,a),Da(i,jl,i),Da(i,Ll),Da(i,Fl,i);const l=$a(n,"\n",Ka,{[Aa]:!0}),c=$a(n,"\r",qa,{[Aa]:!0}),d=Da(n,Bl,qa,{[Aa]:!0});$a(n,"",d),$a(c,"\n",l),$a(c,"",d),Da(c,Bl,d),$a(d,"\r"),$a(d,"\n"),Da(d,Bl,d),$a(d,"",d);const u=Da(n,Hl,$l,{[Ca]:!0});$a(u,"#"),Da(u,Hl,u),$a(u,"️",u);const h=$a(u,"");$a(h,"#"),Da(h,Hl,u);const p=[[Ll,s],[jl,o]],f=[[Ll,null],[Fl,a],[jl,i]];for(let e=0;e<_l.length;e++)ql(n,_l[e],ja,Ia,p);for(let e=0;e<Vl.length;e++)ql(n,Vl[e],Ba,za,f);Ea(ja,{tld:!0,ascii:!0},t),Ea(Ba,{utld:!0,alpha:!0},t),ql(n,"file",_a,Ia,p),ql(n,"mailto",_a,Ia,p),ql(n,"http",Va,Ia,p),ql(n,"https",Va,Ia,p),ql(n,"ftp",Va,Ia,p),ql(n,"ftps",Va,Ia,p),Ea(_a,{scheme:!0,ascii:!0},t),Ea(Va,{slashscheme:!0,ascii:!0},t),e=e.sort((e,t)=>e[0]>t[0]?1:-1);for(let t=0;t<e.length;t++){const r=e[t][0],o=e[t][1]?{[Ma]:!0}:{[Ta]:!0};r.indexOf("-")>=0?o[Sa]=!0:Ll.test(r)?jl.test(r)?o[wa]=!0:o[ba]=!0:o[ya]=!0,Pa(n,r,r,o)}return Pa(n,"localhost",Ha,{ascii:!0}),n.jd=new Na(Il),{start:n,tokens:Object.assign({groups:t},zl)}}(ic.customSchemes);for(let e=0;e<ic.tokenQueue.length;e++)ic.tokenQueue[e][1]({scanner:ic.scanner});ic.parser=function({groups:e}){const t=e.domain.concat([cl,ul,hl,pl,fl,ml,yl,kl,xl,Wa,Sl,Cl,Ml,Tl,Rl,Il,Dl,Pl]),n=[dl,gl,vl,bl,wl,Sl,Al,Ol,Nl,Za,el,Ja,Ua,Xa,Ga,Ya,Qa,tl,nl,rl,ol,il,sl,al,ll],r=[cl,dl,ul,pl,fl,ml,yl,kl,xl,Ja,Ua,Sl,Cl,Ml,Tl,Al,Rl,Il,Dl,Pl],o=nc(),i=$a(o,Dl);Ra(i,r,i),Ra(i,e.domain,i);const s=nc(),a=nc(),l=nc();Ra(o,e.domain,s),Ra(o,e.scheme,a),Ra(o,e.slashscheme,l),Ra(s,r,i),Ra(s,e.domain,s);const c=$a(s,hl);$a(i,hl,c),$a(a,hl,c),$a(l,hl,c);const d=$a(i,bl);Ra(d,r,i),Ra(d,e.domain,i);const u=nc();Ra(c,e.domain,u),Ra(u,e.domain,u);const h=$a(u,bl);Ra(h,e.domain,u);const p=nc(Ql);Ra(h,e.tld,p),Ra(h,e.utld,p),$a(c,Ha,p);const f=$a(u,xl);$a(f,xl,f),Ra(f,e.domain,u),Ra(p,e.domain,u),$a(p,bl,h),$a(p,xl,f);const m=$a(p,gl);Ra(m,e.numeric,Ql);const g=$a(s,xl),v=$a(s,bl);$a(g,xl,g),Ra(g,e.domain,s),Ra(v,r,i),Ra(v,e.domain,s);const y=nc(tc);Ra(v,e.tld,y),Ra(v,e.utld,y),Ra(y,e.domain,s),Ra(y,r,i),$a(y,bl,v),$a(y,xl,g),$a(y,hl,c);const b=$a(y,gl),k=nc(tc);Ra(b,e.numeric,k);const w=nc(tc),x=nc();Ra(w,t,w),Ra(w,n,x),Ra(x,t,w),Ra(x,n,x),$a(y,Rl,w),$a(k,Rl,w);const S=$a(a,gl),C=$a(l,gl),M=$a(C,Rl),T=$a(M,Rl);Ra(a,e.domain,s),$a(a,bl,v),$a(a,xl,g),Ra(l,e.domain,s),$a(l,bl,v),$a(l,xl,g),Ra(S,e.domain,w),$a(S,Rl,w),$a(S,Al,w),Ra(T,e.domain,w),Ra(T,t,w),$a(T,Rl,w);const A=[[Ja,Ua],[Ga,Xa],[Ya,Qa],[Za,el],[tl,nl],[rl,ol],[il,sl],[al,ll]];for(let e=0;e<A.length;e++){const[r,o]=A[e],i=$a(w,r);$a(x,r,i),$a(i,o,w);const s=nc(tc);Ra(i,t,s);const a=nc();Ra(i,n),Ra(s,t,s),Ra(s,n,a),Ra(a,t,s),Ra(a,n,a),$a(s,o,w),$a(a,o,w)}return $a(o,Ha,y),$a(o,Ka,ec),{start:o,tokens:zl}}(ic.scanner.tokens);for(let e=0;e<ic.pluginQueue.length;e++)ic.pluginQueue[e][1]({scanner:ic.scanner,parser:ic.parser});ic.initialized=!0}(),function(e,t,n){let r=n.length,o=0,i=[],s=[];for(;o<r;){let a=e,l=null,c=null,d=0,u=null,h=-1;for(;o<r&&!(l=a.go(n[o].t));)s.push(n[o++]);for(;o<r&&(c=l||a.go(n[o].t));)l=null,a=c,a.accepts()?(h=0,u=a):h>=0&&h++,o++,d++;if(h<0)o-=d,o<r&&(s.push(n[o]),o++);else{s.length>0&&(i.push(rc(Zl,t,s)),s=[]),o-=h,d-=h;const e=u.t,r=n.slice(o-d,o);i.push(rc(e,t,r))}}return s.length>0&&i.push(rc(Zl,t,s)),i}(ic.parser.start,e,Wl(ic.scanner.start,e))}function lc(e,t=null,n=null){if(t&&"object"==typeof t){if(n)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);n=t,t=null}const r=new Ul(n),o=ac(e),i=[];for(let e=0;e<o.length;e++){const n=o[e];!n.isLink||t&&n.t!==t||!r.check(n)||i.push(n.toFormattedObject(r))}return i}ac.scan=Wl;var cc="[\0- -\u2029 ]",dc=new RegExp(cc),uc=new RegExp(`${cc}$`),hc=new RegExp(cc,"g");function pc(e,t){const n=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(e=>{const t="string"==typeof e?e:e.scheme;t&&n.push(t)}),!e||e.replace(hc,"").match(new RegExp(`^(?:(?:${n.join("|")}):|[^a-z]|[a-z0-9+.-]+(?:[^a-z+.-:]|$))`,"i"))}var fc=ms.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.validate&&!this.options.shouldAutoLink&&(this.options.shouldAutoLink=this.options.validate,console.warn("The `validate` option is deprecated. Rename to the `shouldAutoLink` option instead.")),this.options.protocols.forEach(e=>{"string"!=typeof e?sc(e.scheme,e.optionalSlashes):sc(e)})},onDestroy(){Na.groups={},ic.scanner=null,ic.parser=null,ic.tokenQueue=[],ic.pluginQueue=[],ic.customSchemes=[],ic.initialized=!1},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},isAllowedUri:(e,t)=>!!pc(e,t.protocols),validate:e=>!!e,shouldAutoLink:e=>{const t=/^[a-z][a-z0-9+.-]*:\/\//i.test(e),n=/^[a-z][a-z0-9+.-]*:/i.test(e);if(t||n&&!e.includes("@"))return!0;const r=(e.includes("@")?e.split("@").pop():e).split(/[/?#:]/)[0];return!/^\d{1,3}(\.\d{1,3}){3}$/.test(r)&&!!/\./.test(r)}}},addAttributes(){return{href:{default:null,parseHTML(e){return e.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class},title:{default:null}}},parseHTML(){return[{tag:"a[href]",getAttrs:e=>{const t=e.getAttribute("href");return!(!t||!this.options.isAllowedUri(t,{defaultValidate:e=>!!pc(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&null}}]},renderHTML({HTMLAttributes:e}){return this.options.isAllowedUri(e.href,{defaultValidate:e=>!!pc(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})?["a",Mi(this.options.HTMLAttributes,e),0]:["a",Mi(this.options.HTMLAttributes,{...e,href:""}),0]},markdownTokenName:"link",parseMarkdown:(e,t)=>t.applyMark("link",t.parseInline(e.tokens||[]),{href:e.href,title:e.title||null}),renderMarkdown:(e,t)=>{var n,r,o,i;const s=null!=(r=null==(n=e.attrs)?void 0:n.href)?r:"",a=null!=(i=null==(o=e.attrs)?void 0:o.title)?i:"",l=t.renderChildren(e);return a?`[${l}](${s} "${a}")`:`[${l}](${s})`},addCommands(){return{setLink:e=>({chain:t})=>{const{href:n}=e;return!!this.options.isAllowedUri(n,{defaultValidate:e=>!!pc(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol})&&t().setMark(this.name,e).setMeta("preventAutolink",!0).run()},toggleLink:e=>({chain:t})=>{const{href:n}=e||{};return!(n&&!this.options.isAllowedUri(n,{defaultValidate:e=>!!pc(e,this.options.protocols),protocols:this.options.protocols,defaultProtocol:this.options.defaultProtocol}))&&t().toggleMark(this.name,e,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()},unsetLink:()=>({chain:e})=>e().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[Us({find:e=>{const t=[];if(e){const{protocols:n,defaultProtocol:r}=this.options,o=lc(e).filter(e=>e.isLink&&this.options.isAllowedUri(e.value,{defaultValidate:e=>!!pc(e,n),protocols:n,defaultProtocol:r}));o.length&&o.forEach(e=>{this.options.shouldAutoLink(e.value)&&t.push({text:e.value,data:{href:e.href},index:e.start})})}return t},type:this.type,getAttributes:e=>{var t;return{href:null==(t=e.data)?void 0:t.href}}})]},addProseMirrorPlugins(){const e=[],{protocols:t,defaultProtocol:n}=this.options;return this.options.autolink&&e.push((r={type:this.type,defaultProtocol:this.options.defaultProtocol,validate:e=>this.options.isAllowedUri(e,{defaultValidate:e=>!!pc(e,t),protocols:t,defaultProtocol:n}),shouldAutoLink:this.options.shouldAutoLink},new bt({key:new xt("autolink"),appendTransaction:(e,t,n)=>{const o=e.some(e=>e.docChanged)&&!t.doc.eq(n.doc),i=e.some(e=>e.getMeta("preventAutolink"));if(!o||i)return;const{tr:s}=n;return Di(mi(t.doc,[...e])).forEach(({newRange:e})=>{const t=function(e,t){const n=[];return e.nodesBetween(t.from,t.to,(e,t)=>{(e=>e.isTextblock)(e)&&n.push({node:e,pos:t})}),n}(n.doc,e);let o,i;if(t.length>1)o=t[0],i=n.doc.textBetween(o.pos,o.pos+o.node.nodeSize,void 0," ");else if(t.length){const r=n.doc.textBetween(e.from,e.to," "," ");if(!uc.test(r))return;o=t[0],i=n.doc.textBetween(o.pos,e.to,void 0," ")}if(o&&i){const e=i.split(dc).filter(Boolean);if(e.length<=0)return!1;const t=e[e.length-1],l=o.pos+i.lastIndexOf(t);if(!t)return!1;const c=ac(t).map(e=>e.toObject(r.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(e=>e.isLink).map(e=>({...e,from:l+e.start+1,to:l+e.end+1})).filter(e=>!n.schema.marks.code||!n.doc.rangeHasMark(e.from,e.to,n.schema.marks.code)).filter(e=>r.validate(e.value)).filter(e=>r.shouldAutoLink(e.value)).forEach(e=>{Pi(e.from,e.to,n.doc).some(e=>e.mark.type===r.type)||s.addMark(e.from,e.to,r.type.create({href:e.href}))})}var a}),s.steps.length?s:void 0}}))),e.push(function(e){return new bt({key:new xt("handleClickLink"),props:{handleClick:(t,n,r)=>{var o,i;if(0!==r.button)return!1;if(!t.editable)return!1;let s=null;if(r.target instanceof HTMLAnchorElement)s=r.target;else{const t=r.target;if(!t)return!1;const n=e.editor.view.dom;s=t.closest("a"),s&&!n.contains(s)&&(s=null)}if(!s)return!1;let a=!1;if(e.enableClickSelection&&(a=e.editor.commands.extendMarkRange(e.type.name)),e.openOnClick){const n=function(e,t){const n=ri("string"==typeof t?t:t.name,e.schema);return"node"===n?function(e,t){const n=vo(t,e.schema),{from:r,to:o}=e.selection,i=[];e.doc.nodesBetween(r,o,e=>{i.push(e)});const s=i.reverse().find(e=>e.type.name===n.name);return s?{...s.attrs}:{}}(e,t):"mark"===n?fi(e,t):{}}(t.state,e.type.name),r=null!=(o=s.href)?o:n.href,l=null!=(i=s.target)?i:n.target;r&&(window.open(r,l),a=!0)}return a}}})}({type:this.type,editor:this.editor,openOnClick:"whenNotEditable"===this.options.openOnClick||this.options.openOnClick,enableClickSelection:this.options.enableClickSelection})),this.options.linkOnPaste&&e.push(function(e){return new bt({key:new xt("handlePasteLink"),props:{handlePaste:(t,n,r)=>{const{shouldAutoLink:o}=e,{state:i}=t,{selection:s}=i,{empty:a}=s;if(a)return!1;let l="";r.content.forEach(e=>{l+=e.textContent});const c=lc(l,{defaultProtocol:e.defaultProtocol}).find(e=>e.isLink&&e.value===l);return!(!l||!c||void 0!==o&&!o(c.value))&&e.editor.commands.setMark(e.type,{href:c.href})}}})}({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type,shouldAutoLink:this.options.shouldAutoLink})),e;var r}}),mc=fc,gc=Object.defineProperty,vc="textStyle",yc=/^\s*([-+*])\s$/,bc=Ks.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:e}){return["ul",Mi(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>"list"!==e.type||e.ordered?[]:{type:"bulletList",content:e.items?t.parseChildren(e.items):[]},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownOptions:{indentsContent:!0},addCommands(){return{toggleBulletList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(vc)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let e=Is({find:yc,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Is({find:yc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(vc),editor:this.editor})),[e]}}),kc=Ks.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:e}){return["li",Mi(this.options.HTMLAttributes,e),0]},markdownTokenName:"list_item",parseMarkdown:(e,t)=>{if("list_item"!==e.type)return[];let n=[];if(e.tokens&&e.tokens.length>0)if(e.tokens.some(e=>"paragraph"===e.type))n=t.parseChildren(e.tokens);else{const r=e.tokens[0];if(r&&"text"===r.type&&r.tokens&&r.tokens.length>0){if(n=[{type:"paragraph",content:t.parseInline(r.tokens)}],e.tokens.length>1){const r=e.tokens.slice(1),o=t.parseChildren(r);n.push(...o)}}else n=t.parseChildren(e.tokens)}return 0===n.length&&(n=[{type:"paragraph",content:[]}]),{type:"listItem",content:n}},renderMarkdown:(e,t,n)=>qs(e,t,e=>{var t,n;return"bulletList"===e.parentType?"- ":"orderedList"===e.parentType?`${((null==(n=null==(t=e.meta)?void 0:t.parentAttrs)?void 0:n.start)||1)+e.index}. `:"- "},n),addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});((e,t)=>{for(var n in t)gc(e,n,{get:t[n],enumerable:!0})})({},{findListItemPos:()=>wc,getNextListDepth:()=>xc,handleBackspace:()=>Tc,handleDelete:()=>Ec,hasListBefore:()=>Sc,hasListItemAfter:()=>Nc,hasListItemBefore:()=>Cc,listItemHasSubList:()=>Mc,nextListIsDeeper:()=>Ac,nextListIsHigher:()=>Oc});var wc=(e,t)=>{const{$from:n}=t.selection,r=vo(e,t.schema);let o=null,i=n.depth,s=n.pos,a=null;for(;i>0&&null===a;)o=n.node(i),o.type===r?a=i:(i-=1,s-=1);return null===a?null:{$pos:t.doc.resolve(s),depth:a}},xc=(e,t)=>{const n=wc(e,t);if(!n)return!1;const[,r]=((e,t,n,r=20)=>{const o=e.doc.resolve(n);let i=r,s=null;for(;i>0&&null===s;){const e=o.node(i);(null==e?void 0:e.type.name)===t?s=e:i-=1}return[s,i]})(t,e,n.$pos.pos+4);return r},Sc=(e,t,n)=>{const{$anchor:r}=e.selection,o=Math.max(0,r.pos-2),i=e.doc.resolve(o).node();return!(!i||!n.includes(i.type.name))},Cc=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-2);return 0!==o.index()&&(null==(n=o.nodeBefore)?void 0:n.type.name)===e},Mc=(e,t,n)=>{if(!n)return!1;const r=vo(e,t.schema);let o=!1;return n.descendants(e=>{e.type===r&&(o=!0)}),o},Tc=(e,t,n)=>{if(e.commands.undoInputRule())return!0;if(e.state.selection.from!==e.state.selection.to)return!1;if(!Qo(e.state,t)&&Sc(e.state,t,n)){const{$anchor:n}=e.state.selection,r=e.state.doc.resolve(n.before()-1),o=[];r.node().descendants((e,n)=>{e.type.name===t&&o.push({node:e,pos:n})});const i=o.at(-1);if(!i)return!1;const s=e.state.doc.resolve(r.start()+i.pos+1);return e.chain().cut({from:n.start()-1,to:n.end()+1},s.end()).joinForward().run()}if(!Qo(e.state,t))return!1;if(!(e=>{const{$from:t,$to:n}=e.selection;return!(t.parentOffset>0||t.pos!==n.pos)})(e.state))return!1;const r=wc(t,e.state);if(!r)return!1;const o=e.state.doc.resolve(r.$pos.pos-2).node(r.depth),i=Mc(t,e.state,o);return Cc(t,e.state)&&!i?e.commands.joinItemBackward():e.chain().liftListItem(t).run()},Ac=(e,t)=>{const n=xc(e,t),r=wc(e,t);return!(!r||!n)&&n>r.depth},Oc=(e,t)=>{const n=xc(e,t),r=wc(e,t);return!(!r||!n)&&n<r.depth},Ec=(e,t)=>{if(!Qo(e.state,t))return!1;if(!((e,t)=>{const{$from:n,$to:r,$anchor:o}=e.selection;if(t){const n=vi(e=>e.type.name===t)(e.selection);if(!n)return!1;const r=e.doc.resolve(n.pos+1);return o.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)})(e.state,t))return!1;const{selection:n}=e.state,{$from:r,$to:o}=n;return!(!n.empty&&r.sameParent(o))&&(Ac(t,e.state)?e.chain().focus(e.state.selection.from+4).lift(t).joinBackward().run():Oc(t,e.state)?e.chain().joinForward().joinBackward().run():e.commands.joinItemForward())},Nc=(e,t)=>{var n;const{$anchor:r}=t.selection,o=t.doc.resolve(r.pos-r.parentOffset-2);return o.index()!==o.parent.childCount-1&&(null==(n=o.nodeAfter)?void 0:n.type.name)===e},Rc=ks.create({name:"listKeymap",addOptions(){return{listTypes:[{itemName:"listItem",wrapperNames:["bulletList","orderedList"]},{itemName:"taskItem",wrapperNames:["taskList"]}]}},addKeyboardShortcuts(){return{Delete:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Ec(e,n)&&(t=!0)}),t},"Mod-Delete":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n})=>{void 0!==e.state.schema.nodes[n]&&Ec(e,n)&&(t=!0)}),t},Backspace:({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Tc(e,n,r)&&(t=!0)}),t},"Mod-Backspace":({editor:e})=>{let t=!1;return this.options.listTypes.forEach(({itemName:n,wrapperNames:r})=>{void 0!==e.state.schema.nodes[n]&&Tc(e,n,r)&&(t=!0)}),t}}}}),Dc=/^(\s*)(\d+)\.\s+(.*)$/,Pc=/^\s/;function $c(e,t,n){var r;const o=[];let i=0;for(;i<e.length;){const s=e[i];if(s.indent===t){const a=s.content.split("\n"),l=(null==(r=a[0])?void 0:r.trim())||"",c=[];l&&c.push({type:"paragraph",raw:l,tokens:n.inlineTokens(l)});const d=a.slice(1).join("\n").trim();if(d){const e=n.blockTokens(d);c.push(...e)}let u=i+1;const h=[];for(;u<e.length&&e[u].indent>t;)h.push(e[u]),u+=1;if(h.length>0){const e=Math.min(...h.map(e=>e.indent)),t=$c(h,e,n);c.push({type:"list",ordered:!0,start:h[0].number,items:t,raw:h.map(e=>e.raw).join("\n")})}o.push({type:"list_item",raw:s.raw,tokens:c}),i=u}else i+=1}return o}var Ic="textStyle",zc=/^(\d+)\.\s$/,Lc=Ks.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start")||"",10):1},type:{default:null,parseHTML:e=>e.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:e}){const{start:t,...n}=e;return 1===t?["ol",Mi(this.options.HTMLAttributes,n),0]:["ol",Mi(this.options.HTMLAttributes,e),0]},markdownTokenName:"list",parseMarkdown:(e,t)=>{if("list"!==e.type||!e.ordered)return[];const n=e.start||1,r=e.items?function(e,t){return e.map(e=>{if("list_item"!==e.type)return t.parseChildren([e])[0];const n=[];return e.tokens&&e.tokens.length>0&&e.tokens.forEach(e=>{if("paragraph"===e.type||"list"===e.type||"blockquote"===e.type||"code"===e.type)n.push(...t.parseChildren([e]));else if("text"===e.type&&e.tokens){const r=t.parseChildren([e]);n.push({type:"paragraph",content:r})}else{const r=t.parseChildren([e]);r.length>0&&n.push(...r)}}),{type:"listItem",content:n}})}(e.items,t):[];return 1!==n?{type:"orderedList",attrs:{start:n},content:r}:{type:"orderedList",content:r}},renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"orderedList",level:"block",start:e=>{const t=e.match(/^(\s*)(\d+)\.\s+/),n=null==t?void 0:t.index;return void 0!==n?n:-1},tokenize:(e,t,n)=>{var r;const o=e.split("\n"),[i,s]=function(e){const t=[];let n=0,r=0;for(;n<e.length;){const o=e[n],i=o.match(Dc);if(!i)break;const[,s,a,l]=i,c=s.length;let d=l,u=n+1;const h=[o];for(;u<e.length;){const t=e[u];if(t.match(Dc))break;if(""===t.trim())h.push(t),d+="\n",u+=1;else{if(!t.match(Pc))break;h.push(t),d+=`\n${t.slice(c+2)}`,u+=1}}t.push({indent:c,number:parseInt(a,10),content:d.trim(),raw:h.join("\n")}),r=u,n=u}return[t,r]}(o);if(0===i.length)return;const a=$c(i,0,n);return 0!==a.length?{type:"list",ordered:!0,start:(null==(r=i[0])?void 0:r.number)||1,items:a,raw:o.slice(0,s).join("\n")}:void 0}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleOrderedList:()=>({commands:e,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes("listItem",this.editor.getAttributes(Ic)).run():e.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let e=Is({find:zc,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(e=Is({find:zc,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Ic)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[e]}}),Fc=/^\s*(\[([( |x])?\])\s$/,Hc=Ks.create({name:"taskItem",addOptions(){return{nested:!1,HTMLAttributes:{},taskListTypeName:"taskList",a11y:void 0}},content(){return this.options.nested?"paragraph block*":"paragraph+"},defining:!0,addAttributes(){return{checked:{default:!1,keepOnSplit:!1,parseHTML:e=>{const t=e.getAttribute("data-checked");return""===t||"true"===t},renderHTML:e=>({"data-checked":e.checked})}}},parseHTML(){return[{tag:`li[data-type="${this.name}"]`,priority:51}]},renderHTML({node:e,HTMLAttributes:t}){return["li",Mi(this.options.HTMLAttributes,t,{"data-type":this.name}),["label",["input",{type:"checkbox",checked:e.attrs.checked?"checked":null}],["span"]],["div",0]]},parseMarkdown:(e,t)=>{const n=[];if(e.tokens&&e.tokens.length>0?n.push(t.createNode("paragraph",{},t.parseInline(e.tokens))):e.text?n.push(t.createNode("paragraph",{},[t.createNode("text",{text:e.text})])):n.push(t.createNode("paragraph",{},[])),e.nestedTokens&&e.nestedTokens.length>0){const r=t.parseChildren(e.nestedTokens);n.push(...r)}return t.createNode("taskItem",{checked:e.checked||!1},n)},renderMarkdown:(e,t)=>{var n;return qs(e,t,`- [${(null==(n=e.attrs)?void 0:n.checked)?"x":" "}] `)},addKeyboardShortcuts(){const e={Enter:()=>this.editor.commands.splitListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)};return this.options.nested?{...e,Tab:()=>this.editor.commands.sinkListItem(this.name)}:e},addNodeView(){return({node:e,HTMLAttributes:t,getPos:n,editor:r})=>{const o=document.createElement("li"),i=document.createElement("label"),s=document.createElement("span"),a=document.createElement("input"),l=document.createElement("div"),c=e=>{var t,n;a.ariaLabel=(null==(n=null==(t=this.options.a11y)?void 0:t.checkboxLabel)?void 0:n.call(t,e,a.checked))||`Task item checkbox for ${e.textContent||"empty task item"}`};c(e),i.contentEditable="false",a.type="checkbox",a.addEventListener("mousedown",e=>e.preventDefault()),a.addEventListener("change",t=>{if(!r.isEditable&&!this.options.onReadOnlyChecked)return void(a.checked=!a.checked);const{checked:o}=t.target;r.isEditable&&"function"==typeof n&&r.chain().focus(void 0,{scrollIntoView:!1}).command(({tr:e})=>{const t=n();if("number"!=typeof t)return!1;const r=e.doc.nodeAt(t);return e.setNodeMarkup(t,void 0,{...null==r?void 0:r.attrs,checked:o}),!0}).run(),!r.isEditable&&this.options.onReadOnlyChecked&&(this.options.onReadOnlyChecked(e,o)||(a.checked=!a.checked))}),Object.entries(this.options.HTMLAttributes).forEach(([e,t])=>{o.setAttribute(e,t)}),o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,i.append(a,s),o.append(i,l),Object.entries(t).forEach(([e,t])=>{o.setAttribute(e,t)});let d=new Set(Object.keys(t));return{dom:o,contentDOM:l,update:e=>{if(e.type!==this.type)return!1;o.dataset.checked=e.attrs.checked,a.checked=e.attrs.checked,c(e);const t=Ti(e,r.extensionManager.attributes),n=new Set(Object.keys(t)),i=this.options.HTMLAttributes;return d.forEach(e=>{n.has(e)||(e in i?o.setAttribute(e,i[e]):o.removeAttribute(e))}),Object.entries(t).forEach(([e,t])=>{null==t?e in i?o.setAttribute(e,i[e]):o.removeAttribute(e):o.setAttribute(e,t)}),d=n,!0}}}},addInputRules(){return[Is({find:Fc,type:this.type,getAttributes:e=>({checked:"x"===e[e.length-1]})})]}}),jc=Ks.create({name:"taskList",addOptions(){return{itemTypeName:"taskItem",HTMLAttributes:{}}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:`ul[data-type="${this.name}"]`,priority:51}]},renderHTML({HTMLAttributes:e}){return["ul",Mi(this.options.HTMLAttributes,e,{"data-type":this.name}),0]},parseMarkdown:(e,t)=>t.createNode("taskList",{},t.parseChildren(e.items||[])),renderMarkdown:(e,t)=>e.content?t.renderChildren(e.content,"\n"):"",markdownTokenizer:{name:"taskList",level:"block",start(e){var t;const n=null==(t=e.match(/^\s*[-+*]\s+\[([ xX])\]\s+/))?void 0:t.index;return void 0!==n?n:-1},tokenize(e,t,n){const r=e=>{const t=Ws(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);return t?[{type:"taskList",raw:t.raw,items:t.items}]:n.blockTokens(e)},o=Ws(e,{itemPattern:/^(\s*)([-+*])\s+\[([ xX])\]\s+(.*)$/,extractItemData:e=>({indentLevel:e[1].length,mainContent:e[4],checked:"x"===e[3].toLowerCase()}),createToken:(e,t)=>({type:"taskItem",raw:"",mainContent:e.mainContent,indentLevel:e.indentLevel,checked:e.checked,text:e.mainContent,tokens:n.inlineTokens(e.mainContent),nestedTokens:t}),customNestedParser:r},n);if(o)return{type:"taskList",raw:o.raw,items:o.items}}},markdownOptions:{indentsContent:!0},addCommands(){return{toggleTaskList:()=>({commands:e})=>e.toggleList(this.name,this.options.itemTypeName)}},addKeyboardShortcuts(){return{"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),Bc=(ks.create({name:"listKit",addExtensions(){const e=[];return!1!==this.options.bulletList&&e.push(bc.configure(this.options.bulletList)),!1!==this.options.listItem&&e.push(kc.configure(this.options.listItem)),!1!==this.options.listKeymap&&e.push(Rc.configure(this.options.listKeymap)),!1!==this.options.orderedList&&e.push(Lc.configure(this.options.orderedList)),!1!==this.options.taskItem&&e.push(Hc.configure(this.options.taskItem)),!1!==this.options.taskList&&e.push(jc.configure(this.options.taskList)),e}})," "),_c=Ks.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:e}){return["p",Mi(this.options.HTMLAttributes,e),0]},parseMarkdown:(e,t)=>{const n=e.tokens||[];if(1===n.length&&"image"===n[0].type)return t.parseChildren([n[0]]);const r=t.parseInline(n);return 1!==r.length||"text"!==r[0].type||r[0].text!==Bc&&" "!==r[0].text?t.createNode("paragraph",void 0,r):t.createNode("paragraph",void 0,[])},renderMarkdown:(e,t)=>{if(!e)return"";const n=Array.isArray(e.content)?e.content:[];return 0===n.length?Bc:t.renderChildren(n)},addCommands(){return{setParagraph:()=>({commands:e})=>e.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}}),Vc=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Wc=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,qc=ms.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("line-through")&&{}}]},renderHTML({HTMLAttributes:e}){return["s",Mi(this.options.HTMLAttributes,e),0]},markdownTokenName:"del",parseMarkdown:(e,t)=>t.applyMark("strike",t.parseInline(e.tokens||[])),renderMarkdown:(e,t)=>`~~${t.renderChildren(e)}~~`,addCommands(){return{setStrike:()=>({commands:e})=>e.setMark(this.name),toggleStrike:()=>({commands:e})=>e.toggleMark(this.name),unsetStrike:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[Ds({find:Vc,type:this.type})]},addPasteRules(){return[Us({find:Wc,type:this.type})]}}),Kc=Ks.create({name:"text",group:"inline",parseMarkdown:e=>({type:"text",text:e.text||""}),renderMarkdown:e=>e.text||""}),Jc=ms.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:e=>!!e.includes("underline")&&{}}]},renderHTML({HTMLAttributes:e}){return["u",Mi(this.options.HTMLAttributes,e),0]},parseMarkdown(e,t){return t.applyMark(this.name||"underline",t.parseInline(e.tokens||[]))},renderMarkdown(e,t){return`++${t.renderChildren(e)}++`},markdownTokenizer:{name:"underline",level:"inline",start(e){return e.indexOf("++")},tokenize(e,t,n){const r=/^(\+\+)([\s\S]+?)(\+\+)/.exec(e);if(!r)return;const o=r[2].trim();return{type:"underline",raw:r[0],text:o,tokens:n.inlineTokens(o)}}},addCommands(){return{setUnderline:()=>({commands:e})=>e.setMark(this.name),toggleUnderline:()=>({commands:e})=>e.toggleMark(this.name),unsetUnderline:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),Uc=Jc;function Gc(e={}){return new bt({view(t){return new Xc(t,e)}})}class Xc{constructor(e,t){var n;this.editorView=e,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=null!==(n=t.width)&&void 0!==n?n:1,this.color=!1===t.color?void 0:t.color||"black",this.class=t.class,this.handlers=["dragover","dragend","drop","dragleave"].map(t=>{let n=e=>{this[t](e)};return e.dom.addEventListener(t,n),{name:t,handler:n}})}destroy(){this.handlers.forEach(({name:e,handler:t})=>this.editorView.dom.removeEventListener(e,t))}update(e,t){null!=this.cursorPos&&t.doc!=e.state.doc&&(this.cursorPos>e.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(e){e!=this.cursorPos&&(this.cursorPos=e,null==e?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let e,t=this.editorView.state.doc.resolve(this.cursorPos),n=!t.parent.inlineContent,r=this.editorView.dom,o=r.getBoundingClientRect(),i=o.width/r.offsetWidth,s=o.height/r.offsetHeight;if(n){let n=t.nodeBefore,r=t.nodeAfter;if(n||r){let t=this.editorView.nodeDOM(this.cursorPos-(n?n.nodeSize:0));if(t){let o=t.getBoundingClientRect(),i=n?o.bottom:o.top;n&&r&&(i=(i+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2);let a=this.width/2*s;e={left:o.left,right:o.right,top:i-a,bottom:i+a}}}}if(!e){let t=this.editorView.coordsAtPos(this.cursorPos),n=this.width/2*i;e={left:t.left-n,right:t.left+n,top:t.top,bottom:t.bottom}}let a,l,c=this.editorView.dom.offsetParent;if(this.element||(this.element=c.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),!c||c==document.body&&"static"==getComputedStyle(c).position)a=-pageXOffset,l=-pageYOffset;else{let e=c.getBoundingClientRect(),t=e.width/c.offsetWidth,n=e.height/c.offsetHeight;a=e.left-c.scrollLeft*t,l=e.top-c.scrollTop*n}this.element.style.left=(e.left-a)/i+"px",this.element.style.top=(e.top-l)/s+"px",this.element.style.width=(e.right-e.left)/i+"px",this.element.style.height=(e.bottom-e.top)/s+"px"}scheduleRemoval(e){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),e)}dragover(e){if(!this.editorView.editable)return;let t=this.editorView.posAtCoords({left:e.clientX,top:e.clientY}),n=t&&t.inside>=0&&this.editorView.state.doc.nodeAt(t.inside),r=n&&n.type.spec.disableDropCursor,o="function"==typeof r?r(this.editorView,t,e):r;if(t&&!o){let e=t.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let t=Be(this.editorView.state.doc,e,this.editorView.dragging.slice);null!=t&&(e=t)}this.setCursor(e),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(e){this.editorView.dom.contains(e.relatedTarget)||this.setCursor(null)}}class Yc extends ot{constructor(e){super(e,e)}map(e,t){let n=e.resolve(t.map(this.head));return Yc.valid(n)?new Yc(n):ot.near(n)}content(){return p.empty}eq(e){return e instanceof Yc&&e.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(e,t){if("number"!=typeof t.pos)throw new RangeError("Invalid input for GapCursor.fromJSON");return new Yc(e.resolve(t.pos))}getBookmark(){return new Qc(this.anchor)}static valid(e){let t=e.parent;if(t.inlineContent||!function(e){for(let t=e.depth;t>=0;t--){let n=e.index(t),r=e.node(t);if(0!=n)for(let e=r.child(n-1);;e=e.lastChild){if(0==e.childCount&&!e.inlineContent||Zc(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e)||!function(e){for(let t=e.depth;t>=0;t--){let n=e.indexAfter(t),r=e.node(t);if(n!=r.childCount)for(let e=r.child(n);;e=e.firstChild){if(0==e.childCount&&!e.inlineContent||Zc(e.type))return!0;if(e.inlineContent)return!1}else if(r.type.spec.isolating)return!0}return!0}(e))return!1;let n=t.type.spec.allowGapCursor;if(null!=n)return n;let r=t.contentMatchAt(e.index()).defaultType;return r&&r.isTextblock}static findGapCursorFrom(e,t,n=!1){e:for(;;){if(!n&&Yc.valid(e))return e;let r=e.pos,o=null;for(let n=e.depth;;n--){let i=e.node(n);if(t>0?e.indexAfter(n)<i.childCount:e.index(n)>0){o=i.child(t>0?e.indexAfter(n):e.index(n)-1);break}if(0==n)return null;r+=t;let s=e.doc.resolve(r);if(Yc.valid(s))return s}for(;;){let i=t>0?o.firstChild:o.lastChild;if(!i){if(o.isAtom&&!o.isText&&!dt.isSelectable(o)){e=e.doc.resolve(r+o.nodeSize*t),n=!1;continue e}break}o=i,r+=t;let s=e.doc.resolve(r);if(Yc.valid(s))return s}return null}}}Yc.prototype.visible=!1,Yc.findFrom=Yc.findGapCursorFrom,ot.jsonID("gapcursor",Yc);class Qc{constructor(e){this.pos=e}map(e){return new Qc(e.map(this.pos))}resolve(e){let t=e.resolve(this.pos);return Yc.valid(t)?new Yc(t):ot.near(t)}}function Zc(e){return e.isAtom||e.spec.isolating||e.spec.createGapCursor}const ed=ro({ArrowLeft:td("horiz",-1),ArrowRight:td("horiz",1),ArrowUp:td("vert",-1),ArrowDown:td("vert",1)});function td(e,t){const n="vert"==e?t>0?"down":"up":t>0?"right":"left";return function(e,r,o){let i=e.selection,s=t>0?i.$to:i.$from,a=i.empty;if(i instanceof lt){if(!o.endOfTextblock(n)||0==s.depth)return!1;a=!1,s=e.doc.resolve(t>0?s.after():s.before())}let l=Yc.findGapCursorFrom(s,t,a);return!!l&&(r&&r(e.tr.setSelection(new Yc(l))),!0)}}function nd(e,t,n){if(!e||!e.editable)return!1;let r=e.state.doc.resolve(t);if(!Yc.valid(r))return!1;let o=e.posAtCoords({left:n.clientX,top:n.clientY});return!(o&&o.inside>-1&&dt.isSelectable(e.state.doc.nodeAt(o.inside))||(e.dispatch(e.state.tr.setSelection(new Yc(r))),0))}function rd(e,t){if("insertCompositionText"!=t.inputType||!(e.state.selection instanceof Yc))return!1;let{$from:n}=e.state.selection,r=n.parent.contentMatchAt(n.index()).findWrapping(e.state.schema.nodes.text);if(!r)return!1;let o=a.empty;for(let e=r.length-1;e>=0;e--)o=a.from(r[e].createAndFill(null,o));let i=e.state.tr.replace(n.pos,n.pos,new p(o,0,0));return i.setSelection(lt.near(i.doc.resolve(n.pos+1))),e.dispatch(i),!1}function od(e){if(!(e.selection instanceof Yc))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",Lr.create(e.doc,[$r.widget(e.selection.head,t,{key:"gapcursor"})])}var id=200,sd=function(){};sd.prototype.append=function(e){return e.length?(e=sd.from(e),!this.length&&e||e.length<id&&this.leafAppend(e)||this.length<id&&e.leafPrepend(this)||this.appendInner(e)):this},sd.prototype.prepend=function(e){return e.length?sd.from(e).append(this):this},sd.prototype.appendInner=function(e){return new ld(this,e)},sd.prototype.slice=function(e,t){return void 0===e&&(e=0),void 0===t&&(t=this.length),e>=t?sd.empty:this.sliceInner(Math.max(0,e),Math.min(this.length,t))},sd.prototype.get=function(e){if(!(e<0||e>=this.length))return this.getInner(e)},sd.prototype.forEach=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length),t<=n?this.forEachInner(e,t,n,0):this.forEachInvertedInner(e,t,n,0)},sd.prototype.map=function(e,t,n){void 0===t&&(t=0),void 0===n&&(n=this.length);var r=[];return this.forEach(function(t,n){return r.push(e(t,n))},t,n),r},sd.from=function(e){return e instanceof sd?e:e&&e.length?new ad(e):sd.empty};var ad=function(e){function t(t){e.call(this),this.values=t}e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t;var n={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(e,n){return 0==e&&n==this.length?this:new t(this.values.slice(e,n))},t.prototype.getInner=function(e){return this.values[e]},t.prototype.forEachInner=function(e,t,n,r){for(var o=t;o<n;o++)if(!1===e(this.values[o],r+o))return!1},t.prototype.forEachInvertedInner=function(e,t,n,r){for(var o=t-1;o>=n;o--)if(!1===e(this.values[o],r+o))return!1},t.prototype.leafAppend=function(e){if(this.length+e.length<=id)return new t(this.values.concat(e.flatten()))},t.prototype.leafPrepend=function(e){if(this.length+e.length<=id)return new t(e.flatten().concat(this.values))},n.length.get=function(){return this.values.length},n.depth.get=function(){return 0},Object.defineProperties(t.prototype,n),t}(sd);sd.empty=new ad([]);var ld=function(e){function t(t,n){e.call(this),this.left=t,this.right=n,this.length=t.length+n.length,this.depth=Math.max(t.depth,n.depth)+1}return e&&(t.__proto__=e),t.prototype=Object.create(e&&e.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(e){return e<this.left.length?this.left.get(e):this.right.get(e-this.left.length)},t.prototype.forEachInner=function(e,t,n,r){var o=this.left.length;return!(t<o&&!1===this.left.forEachInner(e,t,Math.min(n,o),r))&&!(n>o&&!1===this.right.forEachInner(e,Math.max(t-o,0),Math.min(this.length,n)-o,r+o))&&void 0},t.prototype.forEachInvertedInner=function(e,t,n,r){var o=this.left.length;return!(t>o&&!1===this.right.forEachInvertedInner(e,t-o,Math.max(n,o)-o,r+o))&&!(n<o&&!1===this.left.forEachInvertedInner(e,Math.min(t,o),n,r))&&void 0},t.prototype.sliceInner=function(e,t){if(0==e&&t==this.length)return this;var n=this.left.length;return t<=n?this.left.slice(e,t):e>=n?this.right.slice(e-n,t-n):this.left.slice(e,n).append(this.right.slice(0,t-n))},t.prototype.leafAppend=function(e){var n=this.right.leafAppend(e);if(n)return new t(this.left,n)},t.prototype.leafPrepend=function(e){var n=this.left.leafPrepend(e);if(n)return new t(n,this.right)},t.prototype.appendInner=function(e){return this.left.depth>=Math.max(this.right.depth,e.depth)+1?new t(this.left,new t(this.right,e)):new t(this,e)},t}(sd),cd=sd;class dd{constructor(e,t){this.items=e,this.eventCount=t}popEvent(e,t){if(0==this.eventCount)return null;let n,r,o=this.items.length;for(;;o--)if(this.items.get(o-1).selection){--o;break}t&&(n=this.remapping(o,this.items.length),r=n.maps.length);let i,s,a=e.tr,l=[],c=[];return this.items.forEach((e,t)=>{if(!e.step)return n||(n=this.remapping(o,t+1),r=n.maps.length),r--,void c.push(e);if(n){c.push(new ud(e.map));let t,o=e.step.map(n.slice(r));o&&a.maybeStep(o).doc&&(t=a.mapping.maps[a.mapping.maps.length-1],l.push(new ud(t,void 0,void 0,l.length+c.length))),r--,t&&n.appendMap(t,r)}else a.maybeStep(e.step);return e.selection?(i=n?e.selection.map(n.slice(r)):e.selection,s=new dd(this.items.slice(0,o).append(c.reverse().concat(l)),this.eventCount-1),!1):void 0},this.items.length,0),{remaining:s,transform:a,selection:i}}addTransform(e,t,n,r){let o=[],i=this.eventCount,s=this.items,a=!r&&s.length?s.get(s.length-1):null;for(let n=0;n<e.steps.length;n++){let l,c=e.steps[n].invert(e.docs[n]),d=new ud(e.mapping.maps[n],c,t);(l=a&&a.merge(d))&&(d=l,n?o.pop():s=s.slice(0,s.length-1)),o.push(d),t&&(i++,t=void 0),r||(a=d)}let l=i-n.depth;return l>pd&&(s=function(e,t){let n;return e.forEach((e,r)=>{if(e.selection&&0==t--)return n=r,!1}),e.slice(n)}(s,l),i-=l),new dd(s.append(o),i)}remapping(e,t){let n=new ye;return this.items.forEach((t,r)=>{let o=null!=t.mirrorOffset&&r-t.mirrorOffset>=e?n.maps.length-t.mirrorOffset:void 0;n.appendMap(t.map,o)},e,t),n}addMaps(e){return 0==this.eventCount?this:new dd(this.items.append(e.map(e=>new ud(e))),this.eventCount)}rebased(e,t){if(!this.eventCount)return this;let n=[],r=Math.max(0,this.items.length-t),o=e.mapping,i=e.steps.length,s=this.eventCount;this.items.forEach(e=>{e.selection&&s--},r);let a=t;this.items.forEach(t=>{let r=o.getMirror(--a);if(null==r)return;i=Math.min(i,r);let l=o.maps[r];if(t.step){let i=e.steps[r].invert(e.docs[r]),c=t.selection&&t.selection.map(o.slice(a+1,r));c&&s++,n.push(new ud(l,i,c))}else n.push(new ud(l))},r);let l=[];for(let e=t;e<i;e++)l.push(new ud(o.maps[e]));let c=this.items.slice(0,r).append(l).append(n),d=new dd(c,s);return d.emptyItemCount()>500&&(d=d.compress(this.items.length-n.length)),d}emptyItemCount(){let e=0;return this.items.forEach(t=>{t.step||e++}),e}compress(e=this.items.length){let t=this.remapping(0,e),n=t.maps.length,r=[],o=0;return this.items.forEach((i,s)=>{if(s>=e)r.push(i),i.selection&&o++;else if(i.step){let e=i.step.map(t.slice(n)),s=e&&e.getMap();if(n--,s&&t.appendMap(s,n),e){let a=i.selection&&i.selection.map(t.slice(n));a&&o++;let l,c=new ud(s.invert(),e,a),d=r.length-1;(l=r.length&&r[d].merge(c))?r[d]=l:r.push(c)}}else i.map&&n--},this.items.length,0),new dd(cd.from(r.reverse()),o)}}dd.empty=new dd(cd.empty,0);class ud{constructor(e,t,n,r){this.map=e,this.step=t,this.selection=n,this.mirrorOffset=r}merge(e){if(this.step&&e.step&&!e.selection){let t=e.step.merge(this.step);if(t)return new ud(t.getMap().invert(),t,this.selection)}}}class hd{constructor(e,t,n,r,o){this.done=e,this.undone=t,this.prevRanges=n,this.prevTime=r,this.prevComposition=o}}const pd=20;function fd(e){let t=[];for(let n=e.length-1;n>=0&&0==t.length;n--)e[n].forEach((e,n,r,o)=>t.push(r,o));return t}function md(e,t){if(!e)return null;let n=[];for(let r=0;r<e.length;r+=2){let o=t.map(e[r],1),i=t.map(e[r+1],-1);o<=i&&n.push(o,i)}return n}let gd=!1,vd=null;function yd(e){let t=e.plugins;if(vd!=t){gd=!1,vd=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){gd=!0;break}}return gd}const bd=new xt("history"),kd=new xt("closeHistory");function wd(e={}){return e={depth:e.depth||100,newGroupDelay:e.newGroupDelay||500},new bt({key:bd,state:{init(){return new hd(dd.empty,dd.empty,null,0,-1)},apply(t,n,r){return function(e,t,n,r){let o,i=n.getMeta(bd);if(i)return i.historyState;n.getMeta(kd)&&(e=new hd(e.done,e.undone,null,0,-1));let s=n.getMeta("appendedTransaction");if(0==n.steps.length)return e;if(s&&s.getMeta(bd))return s.getMeta(bd).redo?new hd(e.done.addTransform(n,void 0,r,yd(t)),e.undone,fd(n.mapping.maps),e.prevTime,e.prevComposition):new hd(e.done,e.undone.addTransform(n,void 0,r,yd(t)),null,e.prevTime,e.prevComposition);if(!1===n.getMeta("addToHistory")||s&&!1===s.getMeta("addToHistory"))return(o=n.getMeta("rebased"))?new hd(e.done.rebased(n,o),e.undone.rebased(n,o),md(e.prevRanges,n.mapping),e.prevTime,e.prevComposition):new hd(e.done.addMaps(n.mapping.maps),e.undone.addMaps(n.mapping.maps),md(e.prevRanges,n.mapping),e.prevTime,e.prevComposition);{let o=n.getMeta("composition"),i=0==e.prevTime||!s&&e.prevComposition!=o&&(e.prevTime<(n.time||0)-r.newGroupDelay||!function(e,t){if(!t)return!1;if(!e.docChanged)return!0;let n=!1;return e.mapping.maps[0].forEach((e,r)=>{for(let o=0;o<t.length;o+=2)e<=t[o+1]&&r>=t[o]&&(n=!0)}),n}(n,e.prevRanges)),a=s?md(e.prevRanges,n.mapping):fd(n.mapping.maps);return new hd(e.done.addTransform(n,i?t.selection.getBookmark():void 0,r,yd(t)),dd.empty,a,n.time,null==o?e.prevComposition:o)}}(n,r,t,e)}},config:e,props:{handleDOMEvents:{beforeinput(e,t){let n=t.inputType,r="historyUndo"==n?Sd:"historyRedo"==n?Cd:null;return!(!r||!e.editable)&&(t.preventDefault(),r(e.state,e.dispatch))}}}})}function xd(e,t){return(n,r)=>{let o=bd.getState(n);if(!o||0==(e?o.undone:o.done).eventCount)return!1;if(r){let i=function(e,t,n){let r=yd(t),o=bd.get(t).spec.config,i=(n?e.undone:e.done).popEvent(t,r);if(!i)return null;let s=i.selection.resolve(i.transform.doc),a=(n?e.done:e.undone).addTransform(i.transform,t.selection.getBookmark(),o,r),l=new hd(n?a:i.remaining,n?i.remaining:a,null,0,-1);return i.transform.setSelection(s).setMeta(bd,{redo:n,historyState:l})}(o,n,e);i&&r(t?i.scrollIntoView():i)}return!0}}const Sd=xd(!1,!0),Cd=xd(!0,!0);xd(!1,!1),xd(!0,!1),ks.create({name:"characterCount",addOptions(){return{limit:null,mode:"textSize",textCounter:e=>e.length,wordCounter:e=>e.split(" ").filter(e=>""!==e).length}},addStorage(){return{characters:()=>0,words:()=>0}},onBeforeCreate(){this.storage.characters=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc;if("textSize"===((null==e?void 0:e.mode)||this.options.mode)){const e=t.textBetween(0,t.content.size,void 0," ");return this.options.textCounter(e)}return t.nodeSize},this.storage.words=e=>{const t=(null==e?void 0:e.node)||this.editor.state.doc,n=t.textBetween(0,t.content.size," "," ");return this.options.wordCounter(n)}},addProseMirrorPlugins(){let e=!1;return[new bt({key:new xt("characterCount"),appendTransaction:(t,n,r)=>{if(e)return;const o=this.options.limit;if(null==o||0===o)return void(e=!0);const i=this.storage.characters({node:r.doc});if(i>o){const t=0,n=i-o;console.warn(`[CharacterCount] Initial content exceeded limit of ${o} characters. Content was automatically trimmed.`);const s=r.tr.deleteRange(t,n);return e=!0,s}e=!0},filterTransaction:(e,t)=>{const n=this.options.limit;if(!e.docChanged||0===n||null==n)return!0;const r=this.storage.characters({node:t.doc}),o=this.storage.characters({node:e.doc});if(o<=n)return!0;if(r>n&&o>n&&o<=r)return!0;if(r>n&&o>n&&o>r)return!1;if(!e.getMeta("paste"))return!1;const i=e.selection.$head.pos,s=i-(o-n),a=i;return e.deleteRange(s,a),!(this.storage.characters({node:e.doc})>n)}})]}});var Md=ks.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[Gc(this.options)]}}),Td=(ks.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new bt({key:new xt("focus"),props:{decorations:({doc:e,selection:t})=>{const{isEditable:n,isFocused:r}=this.editor,{anchor:o}=t,i=[];if(!n||!r)return Lr.create(e,[]);let s=0;"deepest"===this.options.mode&&e.descendants((e,t)=>{if(!e.isText)return o>=t&&o<=t+e.nodeSize-1&&void(s+=1)});let a=0;return e.descendants((e,t)=>!e.isText&&(o>=t&&o<=t+e.nodeSize-1&&(a+=1,"deepest"===this.options.mode&&s-a>0||"shallowest"===this.options.mode&&a>1?"deepest"===this.options.mode:void i.push($r.node(t,t+e.nodeSize,{class:this.options.className}))))),Lr.create(e,i)}}})]}}),ks.create({name:"gapCursor",addProseMirrorPlugins(){return[new bt({props:{decorations:od,createSelectionBetween(e,t,n){return t.pos==n.pos&&Yc.valid(n)?new Yc(n):null},handleClick:nd,handleKeyDown:ed,handleDOMEvents:{beforeinput:rd}}})]},extendNodeSchema(e){var t;return{allowGapCursor:null!=(t=wi(yi(e,"allowGapCursor",{name:e.name,options:e.options,storage:e.storage})))?t:null}}})),Ad="placeholder",Od=ks.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",dataAttribute:Ad,placeholder:"Write something …",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){const e=this.options.dataAttribute?`data-${t=this.options.dataAttribute,t.replace(/\s+/g,"-").replace(/[^a-zA-Z0-9-]/g,"").replace(/^[0-9-]+/,"").replace(/^-+/,"").toLowerCase()}`:`data-${Ad}`;var t;return[new bt({key:new xt("placeholder"),props:{decorations:({doc:t,selection:n})=>{const r=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:o}=n,i=[];if(!r)return null;const s=this.editor.isEmpty;return t.descendants((t,n)=>{const r=o>=n&&o<=n+t.nodeSize,a=!t.isLeaf&&Fi(t);if((r||!this.options.showOnlyCurrent)&&a){const o=[this.options.emptyNodeClass];s&&o.push(this.options.emptyEditorClass);const a=$r.node(n,n+t.nodeSize,{class:o.join(" "),[e]:"function"==typeof this.options.placeholder?this.options.placeholder({editor:this.editor,node:t,pos:n,hasAnchor:r}):this.options.placeholder});i.push(a)}return this.options.includeChildren}),Lr.create(t,i)}}})]}});function Ed({types:e,node:t}){return t&&Array.isArray(e)&&e.includes(t.type)||(null==t?void 0:t.type)===e}ks.create({name:"selection",addOptions(){return{className:"selection"}},addProseMirrorPlugins(){const{editor:e,options:t}=this;return[new bt({key:new xt("selection"),props:{decorations(n){return n.selection.empty||e.isFocused||!e.isEditable||Hi(n.selection)||e.view.dragging?null:Lr.create(n.doc,[$r.inline(n.selection.from,n.selection.to,{class:t.className})])}}})]}});var Nd=ks.create({name:"trailingNode",addOptions(){return{node:void 0,notAfter:[]}},addProseMirrorPlugins(){var e;const t=new xt(this.name),n=this.options.node||(null==(e=this.editor.schema.topNodeType.contentMatch.defaultType)?void 0:e.name)||"paragraph",r=Object.entries(this.editor.schema.nodes).map(([,e])=>e).filter(e=>(this.options.notAfter||[]).concat(n).includes(e.name));return[new bt({key:t,appendTransaction:(e,r,o)=>{const{doc:i,tr:s,schema:a}=o,l=t.getState(o),c=i.content.size,d=a.nodes[n];if(l)return s.insert(c,d.create())},state:{init:(e,t)=>!Ed({node:t.tr.doc.lastChild,types:r}),apply:(e,t)=>e.docChanged?e.getMeta("__uniqueIDTransaction")?t:!Ed({node:e.doc.lastChild,types:r}):t}})]}}),Rd=ks.create({name:"undoRedo",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:e,dispatch:t})=>Sd(e,t),redo:()=>({state:e,dispatch:t})=>Cd(e,t)}},addProseMirrorPlugins(){return[wd(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()}}}),Dd=ks.create({name:"starterKit",addExtensions(){var e,t,n,r;const o=[];return!1!==this.options.bold&&o.push(na.configure(this.options.bold)),!1!==this.options.blockquote&&o.push(Ys.configure(this.options.blockquote)),!1!==this.options.bulletList&&o.push(bc.configure(this.options.bulletList)),!1!==this.options.code&&o.push(ia.configure(this.options.code)),!1!==this.options.codeBlock&&o.push(la.configure(this.options.codeBlock)),!1!==this.options.document&&o.push(ca.configure(this.options.document)),!1!==this.options.dropcursor&&o.push(Md.configure(this.options.dropcursor)),!1!==this.options.gapcursor&&o.push(Td.configure(this.options.gapcursor)),!1!==this.options.hardBreak&&o.push(da.configure(this.options.hardBreak)),!1!==this.options.heading&&o.push(ua.configure(this.options.heading)),!1!==this.options.undoRedo&&o.push(Rd.configure(this.options.undoRedo)),!1!==this.options.horizontalRule&&o.push(ha.configure(this.options.horizontalRule)),!1!==this.options.italic&&o.push(va.configure(this.options.italic)),!1!==this.options.listItem&&o.push(kc.configure(this.options.listItem)),!1!==this.options.listKeymap&&o.push(Rc.configure(null==(e=this.options)?void 0:e.listKeymap)),!1!==this.options.link&&o.push(fc.configure(null==(t=this.options)?void 0:t.link)),!1!==this.options.orderedList&&o.push(Lc.configure(this.options.orderedList)),!1!==this.options.paragraph&&o.push(_c.configure(this.options.paragraph)),!1!==this.options.strike&&o.push(qc.configure(this.options.strike)),!1!==this.options.text&&o.push(Kc.configure(this.options.text)),!1!==this.options.underline&&o.push(Jc.configure(null==(n=this.options)?void 0:n.underline)),!1!==this.options.trailingNode&&o.push(Nd.configure(null==(r=this.options)?void 0:r.trailingNode)),o}});let Pd,$d;if("undefined"!=typeof WeakMap){let e=new WeakMap;Pd=t=>e.get(t),$d=(t,n)=>(e.set(t,n),n)}else{const e=[],t=10;let n=0;Pd=t=>{for(let n=0;n<e.length;n+=2)if(e[n]==t)return e[n+1]},$d=(r,o)=>(n==t&&(n=0),e[n++]=r,e[n++]=o)}var Id=class{constructor(e,t,n,r){this.width=e,this.height=t,this.map=n,this.problems=r}findCell(e){for(let t=0;t<this.map.length;t++){const n=this.map[t];if(n!=e)continue;const r=t%this.width,o=t/this.width|0;let i=r+1,s=o+1;for(let e=1;i<this.width&&this.map[t+e]==n;e++)i++;for(let e=1;s<this.height&&this.map[t+this.width*e]==n;e++)s++;return{left:r,top:o,right:i,bottom:s}}throw new RangeError(`No cell with offset ${e} found`)}colCount(e){for(let t=0;t<this.map.length;t++)if(this.map[t]==e)return t%this.width;throw new RangeError(`No cell with offset ${e} found`)}nextCell(e,t,n){const{left:r,right:o,top:i,bottom:s}=this.findCell(e);return"horiz"==t?(n<0?0==r:o==this.width)?null:this.map[i*this.width+(n<0?r-1:o)]:(n<0?0==i:s==this.height)?null:this.map[r+this.width*(n<0?i-1:s)]}rectBetween(e,t){const{left:n,right:r,top:o,bottom:i}=this.findCell(e),{left:s,right:a,top:l,bottom:c}=this.findCell(t);return{left:Math.min(n,s),top:Math.min(o,l),right:Math.max(r,a),bottom:Math.max(i,c)}}cellsInRect(e){const t=[],n={};for(let r=e.top;r<e.bottom;r++)for(let o=e.left;o<e.right;o++){const i=r*this.width+o,s=this.map[i];n[s]||(n[s]=!0,o==e.left&&o&&this.map[i-1]==s||r==e.top&&r&&this.map[i-this.width]==s||t.push(s))}return t}positionAt(e,t,n){for(let r=0,o=0;;r++){const i=o+n.child(r).nodeSize;if(r==e){let n=t+e*this.width;const r=(e+1)*this.width;for(;n<r&&this.map[n]<o;)n++;return n==r?i-1:this.map[n]}o=i}}static get(e){return Pd(e)||$d(e,function(e){if("table"!=e.type.spec.tableRole)throw new RangeError("Not a table node: "+e.type.name);const t=function(e){let t=-1,n=!1;for(let r=0;r<e.childCount;r++){const o=e.child(r);let i=0;if(n)for(let t=0;t<r;t++){const n=e.child(t);for(let e=0;e<n.childCount;e++){const o=n.child(e);t+o.attrs.rowspan>r&&(i+=o.attrs.colspan)}}for(let e=0;e<o.childCount;e++){const t=o.child(e);i+=t.attrs.colspan,t.attrs.rowspan>1&&(n=!0)}-1==t?t=i:t!=i&&(t=Math.max(t,i))}return t}(e),n=e.childCount,r=[];let o=0,i=null;const s=[];for(let e=0,o=t*n;e<o;e++)r[e]=0;for(let a=0,l=0;a<n;a++){const c=e.child(a);l++;for(let e=0;;e++){for(;o<r.length&&0!=r[o];)o++;if(e==c.childCount)break;const d=c.child(e),{colspan:u,rowspan:h,colwidth:p}=d.attrs;for(let e=0;e<h;e++){if(e+a>=n){(i||(i=[])).push({type:"overlong_rowspan",pos:l,n:h-e});break}const c=o+e*t;for(let e=0;e<u;e++){0==r[c+e]?r[c+e]=l:(i||(i=[])).push({type:"collision",row:a,pos:l,n:u-e});const n=p&&p[e];if(n){const r=(c+e)%t*2,o=s[r];null==o||o!=n&&1==s[r+1]?(s[r]=n,s[r+1]=1):o==n&&s[r+1]++}}}o+=u,l+=d.nodeSize}const d=(a+1)*t;let u=0;for(;o<d;)0==r[o++]&&u++;u&&(i||(i=[])).push({type:"missing",row:a,n:u}),l++}0!==t&&0!==n||(i||(i=[])).push({type:"zero_sized"});const a=new Id(t,n,r,i);let l=!1;for(let e=0;!l&&e<s.length;e+=2)null!=s[e]&&s[e+1]<n&&(l=!0);return l&&function(e,t,n){e.problems||(e.problems=[]);const r={};for(let o=0;o<e.map.length;o++){const i=e.map[o];if(r[i])continue;r[i]=!0;const s=n.nodeAt(i);if(!s)throw new RangeError(`No cell with offset ${i} found`);let a=null;const l=s.attrs;for(let n=0;n<l.colspan;n++){const r=t[(o+n)%e.width*2];null==r||l.colwidth&&l.colwidth[n]==r||((a||(a=zd(l)))[n]=r)}a&&e.problems.unshift({type:"colwidth mismatch",pos:i,colwidth:a})}}(a,s,e),a}(e))}};function zd(e){if(e.colwidth)return e.colwidth.slice();const t=[];for(let n=0;n<e.colspan;n++)t.push(0);return t}function Ld(e){let t=e.cached.tableNodeTypes;if(!t){t=e.cached.tableNodeTypes={};for(const n in e.nodes){const r=e.nodes[n],o=r.spec.tableRole;o&&(t[o]=r)}}return t}const Fd=new xt("selectingCells");function Hd(e){for(let t=e.depth-1;t>0;t--)if("row"==e.node(t).type.spec.tableRole)return e.node(0).resolve(e.before(t+1));return null}function jd(e){const t=e.selection.$head;for(let e=t.depth;e>0;e--)if("row"==t.node(e).type.spec.tableRole)return!0;return!1}function Bd(e){const t=e.selection;if("$anchorCell"in t&&t.$anchorCell)return t.$anchorCell.pos>t.$headCell.pos?t.$anchorCell:t.$headCell;if("node"in t&&t.node&&"cell"==t.node.type.spec.tableRole)return t.$anchor;const n=Hd(t.$head)||function(e){for(let t=e.nodeAfter,n=e.pos;t;t=t.firstChild,n++){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n)}for(let t=e.nodeBefore,n=e.pos;t;t=t.lastChild,n--){const r=t.type.spec.tableRole;if("cell"==r||"header_cell"==r)return e.doc.resolve(n-t.nodeSize)}}(t.$head);if(n)return n;throw new RangeError(`No cell found around position ${t.head}`)}function _d(e){return"row"==e.parent.type.spec.tableRole&&!!e.nodeAfter}function Vd(e,t){return e.depth==t.depth&&e.pos>=t.start(-1)&&e.pos<=t.end(-1)}function Wd(e,t,n){const r=e.node(-1),o=Id.get(r),i=e.start(-1),s=o.nextCell(e.pos-i,t,n);return null==s?null:e.node(0).resolve(i+s)}function qd(e,t,n=1){const r={...e,colspan:e.colspan-n};return r.colwidth&&(r.colwidth=r.colwidth.slice(),r.colwidth.splice(t,n),r.colwidth.some(e=>e>0)||(r.colwidth=null)),r}function Kd(e,t,n=1){const r={...e,colspan:e.colspan+n};if(r.colwidth){r.colwidth=r.colwidth.slice();for(let e=0;e<n;e++)r.colwidth.splice(t,0,0)}return r}var Jd=class e extends ot{constructor(e,t=e){const n=e.node(-1),r=Id.get(n),o=e.start(-1),i=r.rectBetween(e.pos-o,t.pos-o),s=e.node(0),a=r.cellsInRect(i).filter(e=>e!=t.pos-o);a.unshift(t.pos-o);const l=a.map(e=>{const t=n.nodeAt(e);if(!t)throw new RangeError(`No cell with offset ${e} found`);const r=o+e+1;return new it(s.resolve(r),s.resolve(r+t.content.size))});super(l[0].$from,l[0].$to,l),this.$anchorCell=e,this.$headCell=t}map(t,n){const r=t.resolve(n.map(this.$anchorCell.pos)),o=t.resolve(n.map(this.$headCell.pos));if(_d(r)&&_d(o)&&Vd(r,o)){const t=this.$anchorCell.node(-1)!=r.node(-1);return t&&this.isRowSelection()?e.rowSelection(r,o):t&&this.isColSelection()?e.colSelection(r,o):new e(r,o)}return lt.between(r,o)}content(){const e=this.$anchorCell.node(-1),t=Id.get(e),n=this.$anchorCell.start(-1),r=t.rectBetween(this.$anchorCell.pos-n,this.$headCell.pos-n),o={},i=[];for(let n=r.top;n<r.bottom;n++){const s=[];for(let i=n*t.width+r.left,a=r.left;a<r.right;a++,i++){const n=t.map[i];if(o[n])continue;o[n]=!0;const a=t.findCell(n);let l=e.nodeAt(n);if(!l)throw new RangeError(`No cell with offset ${n} found`);const c=r.left-a.left,d=a.right-r.right;if(c>0||d>0){let e=l.attrs;if(c>0&&(e=qd(e,0,c)),d>0&&(e=qd(e,e.colspan-d,d)),a.left<r.left){if(l=l.type.createAndFill(e),!l)throw new RangeError(`Could not create cell with attrs ${JSON.stringify(e)}`)}else l=l.type.create(e,l.content)}if(a.top<r.top||a.bottom>r.bottom){const e={...l.attrs,rowspan:Math.min(a.bottom,r.bottom)-Math.max(a.top,r.top)};l=a.top<r.top?l.type.createAndFill(e):l.type.create(e,l.content)}s.push(l)}i.push(e.child(n).copy(a.from(s)))}const s=this.isColSelection()&&this.isRowSelection()?e:i;return new p(a.from(s),1,1)}replace(e,t=p.empty){const n=e.steps.length,r=this.ranges;for(let o=0;o<r.length;o++){const{$from:i,$to:s}=r[o],a=e.mapping.slice(n);e.replace(a.map(i.pos),a.map(s.pos),o?p.empty:t)}const o=ot.findFrom(e.doc.resolve(e.mapping.slice(n).map(this.to)),-1);o&&e.setSelection(o)}replaceWith(e,t){this.replace(e,new p(a.from(t),0,0))}forEachCell(e){const t=this.$anchorCell.node(-1),n=Id.get(t),r=this.$anchorCell.start(-1),o=n.cellsInRect(n.rectBetween(this.$anchorCell.pos-r,this.$headCell.pos-r));for(let n=0;n<o.length;n++)e(t.nodeAt(o[n]),r+o[n])}isColSelection(){const e=this.$anchorCell.index(-1),t=this.$headCell.index(-1);if(Math.min(e,t)>0)return!1;const n=e+this.$anchorCell.nodeAfter.attrs.rowspan,r=t+this.$headCell.nodeAfter.attrs.rowspan;return Math.max(n,r)==this.$headCell.node(-1).childCount}static colSelection(t,n=t){const r=t.node(-1),o=Id.get(r),i=t.start(-1),s=o.findCell(t.pos-i),a=o.findCell(n.pos-i),l=t.node(0);return s.top<=a.top?(s.top>0&&(t=l.resolve(i+o.map[s.left])),a.bottom<o.height&&(n=l.resolve(i+o.map[o.width*(o.height-1)+a.right-1]))):(a.top>0&&(n=l.resolve(i+o.map[a.left])),s.bottom<o.height&&(t=l.resolve(i+o.map[o.width*(o.height-1)+s.right-1]))),new e(t,n)}isRowSelection(){const e=this.$anchorCell.node(-1),t=Id.get(e),n=this.$anchorCell.start(-1),r=t.colCount(this.$anchorCell.pos-n),o=t.colCount(this.$headCell.pos-n);if(Math.min(r,o)>0)return!1;const i=r+this.$anchorCell.nodeAfter.attrs.colspan,s=o+this.$headCell.nodeAfter.attrs.colspan;return Math.max(i,s)==t.width}eq(t){return t instanceof e&&t.$anchorCell.pos==this.$anchorCell.pos&&t.$headCell.pos==this.$headCell.pos}static rowSelection(t,n=t){const r=t.node(-1),o=Id.get(r),i=t.start(-1),s=o.findCell(t.pos-i),a=o.findCell(n.pos-i),l=t.node(0);return s.left<=a.left?(s.left>0&&(t=l.resolve(i+o.map[s.top*o.width])),a.right<o.width&&(n=l.resolve(i+o.map[o.width*(a.top+1)-1]))):(a.left>0&&(n=l.resolve(i+o.map[a.top*o.width])),s.right<o.width&&(t=l.resolve(i+o.map[o.width*(s.top+1)-1]))),new e(t,n)}toJSON(){return{type:"cell",anchor:this.$anchorCell.pos,head:this.$headCell.pos}}static fromJSON(t,n){return new e(t.resolve(n.anchor),t.resolve(n.head))}static create(t,n,r=n){return new e(t.resolve(n),t.resolve(r))}getBookmark(){return new Ud(this.$anchorCell.pos,this.$headCell.pos)}};Jd.prototype.visible=!1,ot.jsonID("cell",Jd);var Ud=class e{constructor(e,t){this.anchor=e,this.head=t}map(t){return new e(t.map(this.anchor),t.map(this.head))}resolve(e){const t=e.resolve(this.anchor),n=e.resolve(this.head);return"row"==t.parent.type.spec.tableRole&&"row"==n.parent.type.spec.tableRole&&t.index()<t.parent.childCount&&n.index()<n.parent.childCount&&Vd(t,n)?new Jd(t,n):ot.near(n,1)}};function Gd(e){if(!(e.selection instanceof Jd))return null;const t=[];return e.selection.forEachCell((e,n)=>{t.push($r.node(n,n+e.nodeSize,{class:"selectedCell"}))}),Lr.create(e.doc,t)}const Xd=new xt("fix-tables");function Yd(e,t,n,r){const o=e.childCount,i=t.childCount;e:for(let s=0,a=0;s<i;s++){const i=t.child(s);for(let t=a,r=Math.min(o,s+3);t<r;t++)if(e.child(t)==i){a=t+1,n+=i.nodeSize;continue e}r(i,n),a<o&&e.child(a).sameMarkup(i)?Yd(e.child(a),i,n+1,r):i.nodesBetween(0,i.content.size,r,n+1),n+=i.nodeSize}}function Qd(e,t){let n;const r=(t,r)=>{"table"==t.type.spec.tableRole&&(n=function(e,t,n,r){const o=Id.get(t);if(!o.problems)return r;r||(r=e.tr);const i=[];for(let e=0;e<o.height;e++)i.push(0);for(let e=0;e<o.problems.length;e++){const s=o.problems[e];if("collision"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;const o=e.attrs;for(let e=0;e<o.rowspan;e++)i[s.row+e]+=s.n;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,qd(o,o.colspan-s.n,s.n))}else if("missing"==s.type)i[s.row]+=s.n;else if("overlong_rowspan"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,rowspan:e.attrs.rowspan-s.n})}else if("colwidth mismatch"==s.type){const e=t.nodeAt(s.pos);if(!e)continue;r.setNodeMarkup(r.mapping.map(n+1+s.pos),null,{...e.attrs,colwidth:s.colwidth})}else if("zero_sized"==s.type){const e=r.mapping.map(n);r.delete(e,e+t.nodeSize)}}let s,a;for(let e=0;e<i.length;e++)i[e]&&(null==s&&(s=e),a=e);for(let l=0,c=n+1;l<o.height;l++){const n=t.child(l),o=c+n.nodeSize,d=i[l];if(d>0){let t="cell";n.firstChild&&(t=n.firstChild.type.spec.tableRole);const i=[];for(let n=0;n<d;n++){const n=Ld(e.schema)[t].createAndFill();n&&i.push(n)}const u=0!=l&&s!=l-1||a!=l?o-1:c+1;r.insert(r.mapping.map(u),i)}c=o}return r.setMeta(Xd,{fixTables:!0})}(e,t,r,n))};return t?t.doc!=e.doc&&Yd(t.doc,e.doc,0,r):e.doc.descendants(r),n}function Zd(e){const t=e.selection,n=Bd(e),r=n.node(-1),o=n.start(-1),i=Id.get(r);return{...t instanceof Jd?i.rectBetween(t.$anchorCell.pos-o,t.$headCell.pos-o):i.findCell(n.pos-o),tableStart:o,map:i,table:r}}function eu(e,{map:t,tableStart:n,table:r},o){let i=o>0?-1:0;(function(e,t,n){const r=Ld(t.type.schema).header_cell;for(let o=0;o<e.height;o++)if(t.nodeAt(e.map[n+o*e.width]).type!=r)return!1;return!0})(t,r,o+i)&&(i=0==o||o==t.width?null:0);for(let s=0;s<t.height;s++){const a=s*t.width+o;if(o>0&&o<t.width&&t.map[a-1]==t.map[a]){const i=t.map[a],l=r.nodeAt(i);e.setNodeMarkup(e.mapping.map(n+i),null,Kd(l.attrs,o-t.colCount(i))),s+=l.attrs.rowspan-1}else{const l=null==i?Ld(r.type.schema).cell:r.nodeAt(t.map[a+i]).type,c=t.positionAt(s,o,r);e.insert(e.mapping.map(n+c),l.createAndFill())}}return e}function tu(e,{map:t,table:n,tableStart:r},o){const i=e.mapping.maps.length;for(let s=0;s<t.height;){const a=s*t.width+o,l=t.map[a],c=n.nodeAt(l),d=c.attrs;if(o>0&&t.map[a-1]==l||o<t.width-1&&t.map[a+1]==l)e.setNodeMarkup(e.mapping.slice(i).map(r+l),null,qd(d,o-t.colCount(l)));else{const t=e.mapping.slice(i).map(r+l);e.delete(t,t+c.nodeSize)}s+=d.rowspan}}function nu(e,{map:t,tableStart:n,table:r},o){let i=n;for(let e=0;e<o;e++)i+=r.child(e).nodeSize;const s=[];let a=o>0?-1:0;(function(e,t,n){var r;const o=Ld(t.type.schema).header_cell;for(let i=0;i<e.width;i++)if((null===(r=t.nodeAt(e.map[i+n*e.width]))||void 0===r?void 0:r.type)!=o)return!1;return!0})(t,r,o+a)&&(a=0==o||o==t.height?null:0);for(let i=0,c=t.width*o;i<t.width;i++,c++)if(o>0&&o<t.height&&t.map[c]==t.map[c-t.width]){const o=t.map[c],s=r.nodeAt(o).attrs;e.setNodeMarkup(n+o,null,{...s,rowspan:s.rowspan+1}),i+=s.colspan-1}else{var l;const e=null==a?Ld(r.type.schema).cell:null===(l=r.nodeAt(t.map[c+a*t.width]))||void 0===l?void 0:l.type,n=null==e?void 0:e.createAndFill();n&&s.push(n)}return e.insert(i,Ld(r.type.schema).row.create(null,s)),e}function ru(e,{map:t,table:n,tableStart:r},o){let i=0;for(let e=0;e<o;e++)i+=n.child(e).nodeSize;const s=i+n.child(o).nodeSize,a=e.mapping.maps.length;e.delete(i+r,s+r);const l=new Set;for(let i=0,s=o*t.width;i<t.width;i++,s++){const c=t.map[s];if(!l.has(c))if(l.add(c),o>0&&c==t.map[s-t.width]){const t=n.nodeAt(c).attrs;e.setNodeMarkup(e.mapping.slice(a).map(c+r),null,{...t,rowspan:t.rowspan-1}),i+=t.colspan-1}else if(o<t.height&&c==t.map[s+t.width]){const s=n.nodeAt(c),l=s.attrs,d=s.type.create({...l,rowspan:s.attrs.rowspan-1},s.content),u=t.positionAt(o+1,i,n);e.insert(e.mapping.slice(a).map(r+u),d),i+=l.colspan-1}}}function ou(e){const t=e.content;return 1==t.childCount&&t.child(0).isTextblock&&0==t.child(0).childCount}function iu(e,t){const n=e.selection;if(!(n instanceof Jd)||n.$anchorCell.pos==n.$headCell.pos)return!1;const r=Zd(e),{map:o}=r;if(function({width:e,height:t,map:n},r){let o=r.top*e+r.left,i=o,s=(r.bottom-1)*e+r.left,a=o+(r.right-r.left-1);for(let t=r.top;t<r.bottom;t++){if(r.left>0&&n[i]==n[i-1]||r.right<e&&n[a]==n[a+1])return!0;i+=e,a+=e}for(let i=r.left;i<r.right;i++){if(r.top>0&&n[o]==n[o-e]||r.bottom<t&&n[s]==n[s+e])return!0;o++,s++}return!1}(o,r))return!1;if(t){const n=e.tr,i={};let s,l,c=a.empty;for(let e=r.top;e<r.bottom;e++)for(let t=r.left;t<r.right;t++){const a=o.map[e*o.width+t],d=r.table.nodeAt(a);if(!i[a]&&d)if(i[a]=!0,null==s)s=a,l=d;else{ou(d)||(c=c.append(d.content));const e=n.mapping.map(a+r.tableStart);n.delete(e,e+d.nodeSize)}}if(null==s||null==l)return!0;if(n.setNodeMarkup(s+r.tableStart,null,{...Kd(l.attrs,l.attrs.colspan,r.right-r.left-l.attrs.colspan),rowspan:r.bottom-r.top}),c.size>0){const e=s+1+l.content.size,t=ou(l)?s+1:e;n.replaceWith(t+r.tableStart,e+r.tableStart,c)}n.setSelection(new Jd(n.doc.resolve(s+r.tableStart))),t(n)}return!0}function su(e,t){const n=Ld(e.schema);return(r=({node:e})=>n[e.type.spec.tableRole],(e,t)=>{const n=e.selection;let o,i;if(n instanceof Jd){if(n.$anchorCell.pos!=n.$headCell.pos)return!1;o=n.$anchorCell.nodeAfter,i=n.$anchorCell.pos}else{var s;if(o=function(e){for(let t=e.depth;t>0;t--){const n=e.node(t).type.spec.tableRole;if("cell"===n||"header_cell"===n)return e.node(t)}return null}(n.$from),!o)return!1;i=null===(s=Hd(n.$from))||void 0===s?void 0:s.pos}if(null==o||null==i)return!1;if(1==o.attrs.colspan&&1==o.attrs.rowspan)return!1;if(t){let s=o.attrs;const a=[],l=s.colwidth;s.rowspan>1&&(s={...s,rowspan:1}),s.colspan>1&&(s={...s,colspan:1});const c=Zd(e),d=e.tr;for(let e=0;e<c.right-c.left;e++)a.push(l?{...s,colwidth:l&&l[e]?[l[e]]:null}:s);let u;for(let e=c.top;e<c.bottom;e++){let t=c.map.positionAt(e,c.left,c.table);e==c.top&&(t+=o.nodeSize);for(let n=c.left,i=0;n<c.right;n++,i++)n==c.left&&e==c.top||d.insert(u=d.mapping.map(t+c.tableStart,1),r({node:o,row:e,col:n}).createAndFill(a[i]))}d.setNodeMarkup(i,r({node:o,row:c.top,col:c.left}),a[0]),n instanceof Jd&&d.setSelection(new Jd(d.doc.resolve(n.$anchorCell.pos),u?d.doc.resolve(u):void 0)),t(d)}return!0})(e,t);var r}function au(e,t,n){const r=t.map.cellsInRect({left:0,top:0,right:"row"==e?t.map.width:1,bottom:"column"==e?t.map.height:1});for(let e=0;e<r.length;e++){const o=t.table.nodeAt(r[e]);if(o&&o.type!==n.header_cell)return!1}return!0}function lu(e,t){return(t=t||{useDeprecatedLogic:!1}).useDeprecatedLogic?function(e){return function(t,n){if(!jd(t))return!1;if(n){const r=Ld(t.schema),o=Zd(t),i=t.tr,s=o.map.cellsInRect("column"==e?{left:o.left,top:0,right:o.right,bottom:o.map.height}:"row"==e?{left:0,top:o.top,right:o.map.width,bottom:o.bottom}:o),a=s.map(e=>o.table.nodeAt(e));for(let e=0;e<s.length;e++)a[e].type==r.header_cell&&i.setNodeMarkup(o.tableStart+s[e],r.cell,a[e].attrs);if(0===i.steps.length)for(let e=0;e<s.length;e++)i.setNodeMarkup(o.tableStart+s[e],r.header_cell,a[e].attrs);n(i)}return!0}}(e):function(t,n){if(!jd(t))return!1;if(n){const r=Ld(t.schema),o=Zd(t),i=t.tr,s=au("row",o,r),a=au("column",o,r),l=("column"===e?s:"row"===e&&a)?1:0,c="column"==e?{left:0,top:l,right:1,bottom:o.map.height}:"row"==e?{left:l,top:0,right:o.map.width,bottom:1}:o,d="column"==e?a?r.cell:r.header_cell:"row"==e?s?r.cell:r.header_cell:r.cell;o.map.cellsInRect(c).forEach(e=>{const t=e+o.tableStart,n=i.doc.nodeAt(t);n&&i.setNodeMarkup(t,d,n.attrs)}),n(i)}return!0}}lu("row",{useDeprecatedLogic:!0}),lu("column",{useDeprecatedLogic:!0});const cu=lu("cell",{useDeprecatedLogic:!0});function du(e){return function(t,n){if(!jd(t))return!1;const r=function(e,t){if(t<0){const t=e.nodeBefore;if(t)return e.pos-t.nodeSize;for(let t=e.index(-1)-1,n=e.before();t>=0;t--){const r=e.node(-1).child(t),o=r.lastChild;if(o)return n-1-o.nodeSize;n-=r.nodeSize}}else{if(e.index()<e.parent.childCount-1)return e.pos+e.nodeAfter.nodeSize;const t=e.node(-1);for(let n=e.indexAfter(-1),r=e.after();n<t.childCount;n++){const e=t.child(n);if(e.childCount)return r+1;r+=e.nodeSize}}return null}(Bd(t),e);if(null==r)return!1;if(n){const e=t.doc.resolve(r);n(t.tr.setSelection(lt.between(e,(o=e,o.node(0).resolve(o.pos+o.nodeAfter.nodeSize)))).scrollIntoView())}var o;return!0}}function uu(e,t){const n=e.selection;if(!(n instanceof Jd))return!1;if(t){const r=e.tr,o=Ld(e.schema).cell.createAndFill().content;n.forEachCell((e,t)=>{e.content.eq(o)||r.replace(r.mapping.map(t+1),r.mapping.map(t+e.nodeSize-1),new p(o,0,0))}),r.docChanged&&t(r)}return!0}function hu(e,t){const n=e.createAndFill();return new nt(n).replace(0,n.content.size,t).doc}function pu(e,t,n,r,o,i,s,a){if(0==s||s==t.height)return!1;let l=!1;for(let c=o;c<i;c++){const o=s*t.width+c,i=t.map[o];if(t.map[o-t.width]==i){l=!0;const o=n.nodeAt(i),{top:d,left:u}=t.findCell(i);e.setNodeMarkup(e.mapping.slice(a).map(i+r),null,{...o.attrs,rowspan:s-d}),e.insert(e.mapping.slice(a).map(t.positionAt(s,u,n)),o.type.createAndFill({...o.attrs,rowspan:d+o.attrs.rowspan-s})),c+=o.attrs.colspan-1}}return l}function fu(e,t,n,r,o,i,s,a){if(0==s||s==t.width)return!1;let l=!1;for(let c=o;c<i;c++){const o=c*t.width+s,i=t.map[o];if(t.map[o-1]==i){l=!0;const o=n.nodeAt(i),d=t.colCount(i),u=e.mapping.slice(a).map(i+r);e.setNodeMarkup(u,null,qd(o.attrs,s-d,o.attrs.colspan-(s-d))),e.insert(u+o.nodeSize,o.type.createAndFill(qd(o.attrs,0,s-d))),c+=o.attrs.rowspan-1}}return l}function mu(e,t,n,r,o){let i=n?e.doc.nodeAt(n-1):e.doc;if(!i)throw new Error("No table found");let s=Id.get(i);const{top:l,left:c}=r,d=c+o.width,u=l+o.height,h=e.tr;let f=0;function m(){if(i=n?h.doc.nodeAt(n-1):h.doc,!i)throw new Error("No table found");s=Id.get(i),f=h.mapping.maps.length}(function(e,t,n,r,o,i,s){const l=Ld(e.doc.type.schema);let c,d;if(o>t.width)for(let i=0,a=0;i<t.height;i++){const u=n.child(i);a+=u.nodeSize;const h=[];let p;p=null==u.lastChild||u.lastChild.type==l.cell?c||(c=l.cell.createAndFill()):d||(d=l.header_cell.createAndFill());for(let e=t.width;e<o;e++)h.push(p);e.insert(e.mapping.slice(s).map(a-1+r),h)}if(i>t.height){const u=[];for(let e=0,r=(t.height-1)*t.width;e<Math.max(t.width,o);e++){const o=!(e>=t.width)&&n.nodeAt(t.map[r+e]).type==l.header_cell;u.push(o?d||(d=l.header_cell.createAndFill()):c||(c=l.cell.createAndFill()))}const h=l.row.create(null,a.from(u)),p=[];for(let e=t.height;e<i;e++)p.push(h);e.insert(e.mapping.slice(s).map(r+n.nodeSize-2),p)}return!(!c&&!d)})(h,s,i,n,d,u,f)&&m(),pu(h,s,i,n,c,d,l,f)&&m(),pu(h,s,i,n,c,d,u,f)&&m(),fu(h,s,i,n,l,u,c,f)&&m(),fu(h,s,i,n,l,u,d,f)&&m();for(let e=l;e<u;e++){const t=s.positionAt(e,c,i),r=s.positionAt(e,d,i);h.replace(h.mapping.slice(f).map(t+n),h.mapping.slice(f).map(r+n),new p(o.rows[e-l],0,0))}m(),h.setSelection(new Jd(h.doc.resolve(n+s.positionAt(l,c,i)),h.doc.resolve(n+s.positionAt(u-1,d-1,i)))),t(h)}const gu=ro({ArrowLeft:yu("horiz",-1),ArrowRight:yu("horiz",1),ArrowUp:yu("vert",-1),ArrowDown:yu("vert",1),"Shift-ArrowLeft":bu("horiz",-1),"Shift-ArrowRight":bu("horiz",1),"Shift-ArrowUp":bu("vert",-1),"Shift-ArrowDown":bu("vert",1),Backspace:uu,"Mod-Backspace":uu,Delete:uu,"Mod-Delete":uu});function vu(e,t,n){return!n.eq(e.selection)&&(t&&t(e.tr.setSelection(n).scrollIntoView()),!0)}function yu(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;if(i instanceof Jd)return vu(n,r,ot.near(i.$headCell,t));if("horiz"!=e&&!i.empty)return!1;const s=Su(o,e,t);if(null==s)return!1;if("horiz"==e)return vu(n,r,ot.near(n.doc.resolve(i.head+t),t));{const o=n.doc.resolve(s),i=Wd(o,e,t);let a;return a=i?ot.near(i,1):t<0?ot.near(n.doc.resolve(o.before(-1)),-1):ot.near(n.doc.resolve(o.after(-1)),1),vu(n,r,a)}}}function bu(e,t){return(n,r,o)=>{if(!o)return!1;const i=n.selection;let s;if(i instanceof Jd)s=i;else{const r=Su(o,e,t);if(null==r)return!1;s=new Jd(n.doc.resolve(r))}const a=Wd(s.$headCell,e,t);return!!a&&vu(n,r,new Jd(s.$anchorCell,a))}}function ku(e,t){const n=Hd(e.state.doc.resolve(t));return!!n&&(e.dispatch(e.state.tr.setSelection(new Jd(n))),!0)}function wu(e,t,n){if(!jd(e.state))return!1;let r=function(e){if(0===e.size)return null;let{content:t,openStart:n,openEnd:r}=e;for(;1==t.childCount&&(n>0&&r>0||"table"==t.child(0).type.spec.tableRole);)n--,r--,t=t.child(0).content;const o=t.child(0),i=o.type.spec.tableRole,s=o.type.schema,l=[];if("row"==i)for(let e=0;e<t.childCount;e++){let o=t.child(e).content;const i=e?0:Math.max(0,n-1),a=e<t.childCount-1?0:Math.max(0,r-1);(i||a)&&(o=hu(Ld(s).row,new p(o,i,a)).content),l.push(o)}else{if("cell"!=i&&"header_cell"!=i)return null;l.push(n||r?hu(Ld(s).row,new p(t,n,r)).content:t)}return function(e,t){const n=[];for(let e=0;e<t.length;e++){const r=t[e];for(let t=r.childCount-1;t>=0;t--){const{rowspan:o,colspan:i}=r.child(t).attrs;for(let t=e;t<e+o;t++)n[t]=(n[t]||0)+i}}let r=0;for(let e=0;e<n.length;e++)r=Math.max(r,n[e]);for(let o=0;o<n.length;o++)if(o>=t.length&&t.push(a.empty),n[o]<r){const i=Ld(e).cell.createAndFill(),s=[];for(let e=n[o];e<r;e++)s.push(i);t[o]=t[o].append(a.from(s))}return{height:t.length,width:r,rows:t}}(s,l)}(n);const o=e.state.selection;if(o instanceof Jd){r||(r={width:1,height:1,rows:[a.from(hu(Ld(e.state.schema).cell,n))]});const t=o.$anchorCell.node(-1),i=o.$anchorCell.start(-1),s=Id.get(t).rectBetween(o.$anchorCell.pos-i,o.$headCell.pos-i);return r=function({width:e,height:t,rows:n},r,o){if(e!=r){const t=[],o=[];for(let e=0;e<n.length;e++){const i=n[e],s=[];for(let n=t[e]||0,o=0;n<r;o++){let a=i.child(o%i.childCount);n+a.attrs.colspan>r&&(a=a.type.createChecked(qd(a.attrs,a.attrs.colspan,n+a.attrs.colspan-r),a.content)),s.push(a),n+=a.attrs.colspan;for(let n=1;n<a.attrs.rowspan;n++)t[e+n]=(t[e+n]||0)+a.attrs.colspan}o.push(a.from(s))}n=o,e=r}if(t!=o){const e=[];for(let r=0,i=0;r<o;r++,i++){const s=[],l=n[i%t];for(let e=0;e<l.childCount;e++){let t=l.child(e);r+t.attrs.rowspan>o&&(t=t.type.create({...t.attrs,rowspan:Math.max(1,o-t.attrs.rowspan)},t.content)),s.push(t)}e.push(a.from(s))}n=e,t=o}return{width:e,height:t,rows:n}}(r,s.right-s.left,s.bottom-s.top),mu(e.state,e.dispatch,i,s,r),!0}if(r){const t=Bd(e.state),n=t.start(-1);return mu(e.state,e.dispatch,n,Id.get(t.node(-1)).findCell(t.pos-n),r),!0}return!1}function xu(e,t){var n;if(0!=t.button)return;if(t.ctrlKey||t.metaKey)return;const r=Cu(e,t.target);let o;if(t.shiftKey&&e.state.selection instanceof Jd)i(e.state.selection.$anchorCell,t),t.preventDefault();else if(t.shiftKey&&r&&null!=(o=Hd(e.state.selection.$anchor))&&(null===(n=Mu(e,t))||void 0===n?void 0:n.pos)!=o.pos)i(o,t),t.preventDefault();else if(!r)return;function i(t,n){let r=Mu(e,n);const o=null==Fd.getState(e.state);if(!r||!Vd(t,r)){if(!o)return;r=t}const i=new Jd(t,r);if(o||!e.state.selection.eq(i)){const n=e.state.tr.setSelection(i);o&&n.setMeta(Fd,t.pos),e.dispatch(n)}}function s(){e.root.removeEventListener("mouseup",s),e.root.removeEventListener("dragstart",s),e.root.removeEventListener("mousemove",a),null!=Fd.getState(e.state)&&e.dispatch(e.state.tr.setMeta(Fd,-1))}function a(n){const o=n,a=Fd.getState(e.state);let l;if(null!=a)l=e.state.doc.resolve(a);else if(Cu(e,o.target)!=r&&(l=Mu(e,t),!l))return s();l&&i(l,o)}e.root.addEventListener("mouseup",s),e.root.addEventListener("dragstart",s),e.root.addEventListener("mousemove",a)}function Su(e,t,n){if(!(e.state.selection instanceof lt))return null;const{$head:r}=e.state.selection;for(let o=r.depth-1;o>=0;o--){const i=r.node(o);if((n<0?r.index(o):r.indexAfter(o))!=(n<0?0:i.childCount))return null;if("cell"==i.type.spec.tableRole||"header_cell"==i.type.spec.tableRole){const i=r.before(o),s="vert"==t?n>0?"down":"up":n>0?"right":"left";return e.endOfTextblock(s)?i:null}}return null}function Cu(e,t){for(;t&&t!=e.dom;t=t.parentNode)if("TD"==t.nodeName||"TH"==t.nodeName)return t;return null}function Mu(e,t){const n=e.posAtCoords({left:t.clientX,top:t.clientY});if(!n)return null;let{inside:r,pos:o}=n;return r>=0&&Hd(e.state.doc.resolve(r))||Hd(e.state.doc.resolve(o))}var Tu=class{constructor(e,t){this.node=e,this.defaultCellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),this.table.style.setProperty("--default-cell-min-width",`${t}px`),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Au(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type==this.node.type&&(this.node=e,Au(e,this.colgroup,this.table,this.defaultCellMinWidth),!0)}ignoreMutation(e){return"attributes"==e.type&&(e.target==this.table||this.colgroup.contains(e.target))}};function Au(e,t,n,r,o,i){let s=0,a=!0,l=t.firstChild;const c=e.firstChild;if(c){for(let e=0,n=0;e<c.childCount;e++){const{colspan:d,colwidth:u}=c.child(e).attrs;for(let e=0;e<d;e++,n++){const c=o==n?i:u&&u[e],d=c?c+"px":"";if(s+=c||r,c||(a=!1),l)l.style.width!=d&&(l.style.width=d),l=l.nextSibling;else{const e=document.createElement("col");e.style.width=d,t.appendChild(e)}}}for(;l;){var d;const e=l.nextSibling;null===(d=l.parentNode)||void 0===d||d.removeChild(l),l=e}a?(n.style.width=s+"px",n.style.minWidth=""):(n.style.width="",n.style.minWidth=s+"px")}}const Ou=new xt("tableColumnResizing");function Eu({handleWidth:e=5,cellMinWidth:t=25,defaultCellMinWidth:n=100,View:r=Tu,lastColumnResizable:o=!0}={}){const i=new bt({key:Ou,state:{init(e,t){var o;const s=null===(o=i.spec)||void 0===o||null===(o=o.props)||void 0===o?void 0:o.nodeViews,a=Ld(t.schema).table.name;return r&&s&&(s[a]=(e,t)=>new r(e,n,t)),new Nu(-1,!1)},apply(e,t){return t.apply(e)}},props:{attributes:e=>{const t=Ou.getState(e);return t&&t.activeHandle>-1?{class:"resize-cursor"}:{}},handleDOMEvents:{mousemove:(t,n)=>{!function(e,t,n,r){if(!e.editable)return;const o=Ou.getState(e.state);if(o&&!o.dragging){const i=function(e){for(;e&&"TD"!=e.nodeName&&"TH"!=e.nodeName;)e=e.classList&&e.classList.contains("ProseMirror")?null:e.parentNode;return e}(t.target);let s=-1;if(i){const{left:r,right:o}=i.getBoundingClientRect();t.clientX-r<=n?s=Ru(e,t,"left",n):o-t.clientX<=n&&(s=Ru(e,t,"right",n))}if(s!=o.activeHandle){if(!r&&-1!==s){const t=e.state.doc.resolve(s),n=t.node(-1),r=Id.get(n),o=t.start(-1);if(r.colCount(t.pos-o)+t.nodeAfter.attrs.colspan-1==r.width-1)return}Pu(e,s)}}}(t,n,e,o)},mouseleave:e=>{!function(e){if(!e.editable)return;const t=Ou.getState(e.state);t&&t.activeHandle>-1&&!t.dragging&&Pu(e,-1)}(e)},mousedown:(e,r)=>{!function(e,t,n,r){var o;if(!e.editable)return!1;const i=null!==(o=e.dom.ownerDocument.defaultView)&&void 0!==o?o:window,s=Ou.getState(e.state);if(!s||-1==s.activeHandle||s.dragging)return!1;const a=e.state.doc.nodeAt(s.activeHandle),l=function(e,t,{colspan:n,colwidth:r}){const o=r&&r[r.length-1];if(o)return o;const i=e.domAtPos(t);let s=i.node.childNodes[i.offset].offsetWidth,a=n;if(r)for(let e=0;e<n;e++)r[e]&&(s-=r[e],a--);return s/a}(e,s.activeHandle,a.attrs);function c(t){i.removeEventListener("mouseup",c),i.removeEventListener("mousemove",d);const r=Ou.getState(e.state);(null==r?void 0:r.dragging)&&(function(e,t,n){const r=e.state.doc.resolve(t),o=r.node(-1),i=Id.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1,l=e.state.tr;for(let e=0;e<i.height;e++){const t=e*i.width+a;if(e&&i.map[t]==i.map[t-i.width])continue;const r=i.map[t],c=o.nodeAt(r).attrs,d=1==c.colspan?0:a-i.colCount(r);if(c.colwidth&&c.colwidth[d]==n)continue;const u=c.colwidth?c.colwidth.slice():Iu(c.colspan);u[d]=n,l.setNodeMarkup(s+r,null,{...c,colwidth:u})}l.docChanged&&e.dispatch(l)}(e,r.activeHandle,Du(r.dragging,t,n)),e.dispatch(e.state.tr.setMeta(Ou,{setDragging:null})))}function d(t){if(!t.which)return c(t);const o=Ou.getState(e.state);if(o&&o.dragging){const i=Du(o.dragging,t,n);$u(e,o.activeHandle,i,r)}}e.dispatch(e.state.tr.setMeta(Ou,{setDragging:{startX:t.clientX,startWidth:l}})),$u(e,s.activeHandle,l,r),i.addEventListener("mouseup",c),i.addEventListener("mousemove",d),t.preventDefault()}(e,r,t,n)}},decorations:e=>{const t=Ou.getState(e);if(t&&t.activeHandle>-1)return function(e,t){const n=[],r=e.doc.resolve(t),o=r.node(-1);if(!o)return Lr.empty;const i=Id.get(o),s=r.start(-1),a=i.colCount(r.pos-s)+r.nodeAfter.attrs.colspan-1;for(let t=0;t<i.height;t++){const r=a+t*i.width;if(!(a!=i.width-1&&i.map[r]==i.map[r+1]||0!=t&&i.map[r]==i.map[r-i.width])){var l;const t=i.map[r],a=s+t+o.nodeAt(t).nodeSize-1,c=document.createElement("div");c.className="column-resize-handle",(null===(l=Ou.getState(e))||void 0===l?void 0:l.dragging)&&n.push($r.node(s+t,s+t+o.nodeAt(t).nodeSize,{class:"column-resize-dragging"})),n.push($r.widget(a,c))}}return Lr.create(e.doc,n)}(e,t.activeHandle)},nodeViews:{}}});return i}var Nu=class e{constructor(e,t){this.activeHandle=e,this.dragging=t}apply(t){const n=this,r=t.getMeta(Ou);if(r&&null!=r.setHandle)return new e(r.setHandle,!1);if(r&&void 0!==r.setDragging)return new e(n.activeHandle,r.setDragging);if(n.activeHandle>-1&&t.docChanged){let r=t.mapping.map(n.activeHandle,-1);return _d(t.doc.resolve(r))||(r=-1),new e(r,n.dragging)}return n}};function Ru(e,t,n,r){const o="right"==n?-r:r,i=e.posAtCoords({left:t.clientX+o,top:t.clientY});if(!i)return-1;const{pos:s}=i,a=Hd(e.state.doc.resolve(s));if(!a)return-1;if("right"==n)return a.pos;const l=Id.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 Du(e,t,n){const r=t.clientX-e.startX;return Math.max(n,e.startWidth+r)}function Pu(e,t){e.dispatch(e.state.tr.setMeta(Ou,{setHandle:t}))}function $u(e,t,n,r){const o=e.state.doc.resolve(t),i=o.node(-1),s=o.start(-1),a=Id.get(i).colCount(o.pos-s)+o.nodeAfter.attrs.colspan-1;let l=e.domAtPos(o.start(-1)).node;for(;l&&"TABLE"!=l.nodeName;)l=l.parentNode;l&&Au(i,l.firstChild,l,r,a,n)}function Iu(e){return Array(e).fill(0)}function zu({allowTableNodeSelection:e=!1}={}){return new bt({key:Fd,state:{init(){return null},apply(e,t){const n=e.getMeta(Fd);if(null!=n)return-1==n?null:n;if(null==t||!e.docChanged)return t;const{deleted:r,pos:o}=e.mapping.mapResult(t);return r?null:o}},props:{decorations:Gd,handleDOMEvents:{mousedown:xu},createSelectionBetween(e){return null!=Fd.getState(e.state)?e.state.selection:null},handleTripleClick:ku,handleKeyDown:gu,handlePaste:wu},appendTransaction(t,n,r){return function(e,t,n){const r=(t||e).selection,o=(t||e).doc;let i,s;if(r instanceof dt&&(s=r.node.type.spec.tableRole)){if("cell"==s||"header_cell"==s)i=Jd.create(o,r.from);else if("row"==s){const e=o.resolve(r.from+1);i=Jd.rowSelection(e,e)}else if(!n){const e=Id.get(r.node),t=r.from+1,n=t+e.map[e.width*e.height-1];i=Jd.create(o,t+1,n)}}else r instanceof lt&&function({$from:e,$to:t}){if(e.pos==t.pos||e.pos<t.pos-6)return!1;let n=e.pos,r=t.pos,o=e.depth;for(;o>=0&&!(e.after(o+1)<e.end(o));o--,n++);for(let e=t.depth;e>=0&&!(t.before(e+1)>t.start(e));e--,r--);return n==r&&/row|table/.test(e.node(o).type.spec.tableRole)}(r)?i=lt.create(o,r.from):r instanceof lt&&function({$from:e,$to:t}){let n,r;for(let t=e.depth;t>0;t--){const r=e.node(t);if("cell"===r.type.spec.tableRole||"header_cell"===r.type.spec.tableRole){n=r;break}}for(let e=t.depth;e>0;e--){const n=t.node(e);if("cell"===n.type.spec.tableRole||"header_cell"===n.type.spec.tableRole){r=n;break}}return n!==r&&0===t.parentOffset}(r)&&(i=lt.create(o,r.$from.start(),r.$from.end()));return i&&(t||(t=e.tr)).setSelection(i),t}(r,Qd(r,n),e)}})}var Lu=Ks.create({name:"tableCell",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{var t,n;const r=e.getAttribute("colwidth"),o=r?r.split(",").map(e=>parseInt(e,10)):null;if(!o){const r=null==(t=e.closest("table"))?void 0:t.querySelectorAll("colgroup > col"),o=Array.from((null==(n=e.parentElement)?void 0:n.children)||[]).indexOf(e);if(o&&o>-1&&r&&r[o]){const e=r[o].getAttribute("width");return e?[parseInt(e,10)]:null}}return o}}}},tableRole:"cell",isolating:!0,parseHTML(){return[{tag:"td"}]},renderHTML({HTMLAttributes:e}){return["td",Mi(this.options.HTMLAttributes,e),0]}}),Fu=Ks.create({name:"tableHeader",addOptions(){return{HTMLAttributes:{}}},content:"block+",addAttributes(){return{colspan:{default:1},rowspan:{default:1},colwidth:{default:null,parseHTML:e=>{const t=e.getAttribute("colwidth");return t?t.split(",").map(e=>parseInt(e,10)):null}}}},tableRole:"header_cell",isolating:!0,parseHTML(){return[{tag:"th"}]},renderHTML({HTMLAttributes:e}){return["th",Mi(this.options.HTMLAttributes,e),0]}}),Hu=Ks.create({name:"tableRow",addOptions(){return{HTMLAttributes:{}}},content:"(tableCell | tableHeader)*",tableRole:"row",parseHTML(){return[{tag:"tr"}]},renderHTML({HTMLAttributes:e}){return["tr",Mi(this.options.HTMLAttributes,e),0]}});function ju(e,t){return t?["width",`${Math.max(t,e)}px`]:["min-width",`${e}px`]}function Bu(e,t,n,r,o,i){var s;let a=0,l=!0,c=t.firstChild;const d=e.firstChild;if(null!==d)for(let e=0,n=0;e<d.childCount;e+=1){const{colspan:s,colwidth:u}=d.child(e).attrs;for(let e=0;e<s;e+=1,n+=1){const s=o===n?i:u&&u[e],d=s?`${s}px`:"";if(a+=s||r,s||(l=!1),c){if(c.style.width!==d){const[e,t]=ju(r,s);c.style.setProperty(e,t)}c=c.nextSibling}else{const e=document.createElement("col"),[n,o]=ju(r,s);e.style.setProperty(n,o),t.appendChild(e)}}}for(;c;){const e=c.nextSibling;null==(s=c.parentNode)||s.removeChild(c),c=e}const u=e.attrs.style&&"string"==typeof e.attrs.style&&/\bwidth\s*:/i.test(e.attrs.style);l&&!u?(n.style.width=`${a}px`,n.style.minWidth=""):(n.style.width="",n.style.minWidth=`${a}px`)}var _u=class{constructor(e,t){this.node=e,this.cellMinWidth=t,this.dom=document.createElement("div"),this.dom.className="tableWrapper",this.table=this.dom.appendChild(document.createElement("table")),e.attrs.style&&(this.table.style.cssText=e.attrs.style),this.colgroup=this.table.appendChild(document.createElement("colgroup")),Bu(e,this.colgroup,this.table,t),this.contentDOM=this.table.appendChild(document.createElement("tbody"))}update(e){return e.type===this.node.type&&(this.node=e,Bu(e,this.colgroup,this.table,this.cellMinWidth),!0)}ignoreMutation(e){const t=e.target,n=this.dom.contains(t),r=this.contentDOM.contains(t);return!(!n||r||"attributes"!==e.type&&"childList"!==e.type&&"characterData"!==e.type)}};function Vu(e,t){return t?e.createChecked(null,t):e.createAndFill()}var Wu=({editor:e})=>{const{selection:t}=e.state;if(!(t instanceof Jd))return!1;let n=0;const r=gi(t.ranges[0].$from,e=>"table"===e.type.name);return null==r||r.node.descendants(e=>{if("table"===e.type.name)return!1;["tableCell","tableHeader"].includes(e.type.name)&&(n+=1)}),n===t.ranges.length&&(e.commands.deleteTable(),!0)},qu=Ks.create({name:"table",addOptions(){return{HTMLAttributes:{},resizable:!1,renderWrapper:!1,handleWidth:5,cellMinWidth:25,View:_u,lastColumnResizable:!0,allowTableNodeSelection:!1}},content:"tableRow+",tableRole:"table",isolating:!0,group:"block",parseHTML(){return[{tag:"table"}]},renderHTML({node:e,HTMLAttributes:t}){const{colgroup:n,tableWidth:r,tableMinWidth:o}=function(e,t){let n=0,r=!0;const o=[],i=e.firstChild;if(!i)return{};for(let e=0,s=0;e<i.childCount;e+=1){const{colspan:a,colwidth:l}=i.child(e).attrs;for(let e=0;e<a;e+=1,s+=1){const i=void 0===s?void 0:l&&l[e];n+=i||t,i||(r=!1);const[a,c]=ju(t,i);o.push(["col",{style:`${a}: ${c}`}])}}const s=r?`${n}px`:"",a=r?"":`${n}px`;return{colgroup:["colgroup",{},...o],tableWidth:s,tableMinWidth:a}}(e,this.options.cellMinWidth),i=t.style,s=["table",Mi(this.options.HTMLAttributes,t,{style:i||(r?`width: ${r}`:`min-width: ${o}`)}),n,["tbody",0]];return this.options.renderWrapper?["div",{class:"tableWrapper"},s]:s},parseMarkdown:(e,t)=>{const n=[];if(e.header){const r=[];e.header.forEach(e=>{r.push(t.createNode("tableHeader",{},[{type:"paragraph",content:t.parseInline(e.tokens)}]))}),n.push(t.createNode("tableRow",{},r))}return e.rows&&e.rows.forEach(e=>{const r=[];e.forEach(e=>{r.push(t.createNode("tableCell",{},[{type:"paragraph",content:t.parseInline(e.tokens)}]))}),n.push(t.createNode("tableRow",{},r))}),t.createNode("table",void 0,n)},renderMarkdown:(e,t)=>function(e,t,n={}){var r;const o=null!=(r=n.cellLineSeparator)?r:"";if(!e||!e.content||0===e.content.length)return"";const i=[];e.content.forEach(e=>{const n=[];e.content&&e.content.forEach(e=>{let r="";r=e.content&&Array.isArray(e.content)&&e.content.length>1?e.content.map(e=>t.renderChildren(e)).join(o):e.content?t.renderChildren(e.content):"";const i=(r||"").replace(/\s+/g," ").trim(),s="tableHeader"===e.type;n.push({text:i,isHeader:s})}),i.push(n)});const s=i.reduce((e,t)=>Math.max(e,t.length),0);if(0===s)return"";const a=new Array(s).fill(0);i.forEach(e=>{var t;for(let n=0;n<s;n+=1){const r=((null==(t=e[n])?void 0:t.text)||"").length;r>a[n]&&(a[n]=r),a[n]<3&&(a[n]=3)}});const l=(e,t)=>e+" ".repeat(Math.max(0,t-e.length)),c=i[0],d=c.some(e=>e.isHeader);let u="\n";const h=new Array(s).fill(0).map((e,t)=>d&&c[t]&&c[t].text||"");return u+=`| ${h.map((e,t)=>l(e,a[t])).join(" | ")} |\n`,u+=`| ${a.map(e=>"-".repeat(Math.max(3,e))).join(" | ")} |\n`,(d?i.slice(1):i).forEach(e=>{u+=`| ${new Array(s).fill(0).map((t,n)=>l(e[n]&&e[n].text||"",a[n])).join(" | ")} |\n`}),u}(e,t),addCommands(){return{insertTable:({rows:e=3,cols:t=3,withHeaderRow:n=!0}={})=>({tr:r,dispatch:o,editor:i})=>{const s=function(e,t,n,r,o){const i=function(e){if(e.cached.tableNodeTypes)return e.cached.tableNodeTypes;const t={};return Object.keys(e.nodes).forEach(n=>{const r=e.nodes[n];r.spec.tableRole&&(t[r.spec.tableRole]=r)}),e.cached.tableNodeTypes=t,t}(e),s=[],a=[];for(let e=0;e<n;e+=1){const e=Vu(i.cell,o);if(e&&a.push(e),r){const e=Vu(i.header_cell,o);e&&s.push(e)}}const l=[];for(let e=0;e<t;e+=1)l.push(i.row.createChecked(null,r&&0===e?s:a));return i.table.createChecked(null,l)}(i.schema,e,t,n);if(o){const e=r.selection.from+1;r.replaceSelectionWith(s).scrollIntoView().setSelection(lt.near(r.doc.resolve(e)))}return!0},addColumnBefore:()=>({state:e,dispatch:t})=>function(e,t){if(!jd(e))return!1;if(t){const n=Zd(e);t(eu(e.tr,n,n.left))}return!0}(e,t),addColumnAfter:()=>({state:e,dispatch:t})=>function(e,t){if(!jd(e))return!1;if(t){const n=Zd(e);t(eu(e.tr,n,n.right))}return!0}(e,t),deleteColumn:()=>({state:e,dispatch:t})=>function(e,t){if(!jd(e))return!1;if(t){const n=Zd(e),r=e.tr;if(0==n.left&&n.right==n.map.width)return!1;for(let e=n.right-1;tu(r,n,e),e!=n.left;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw new RangeError("No table found");n.table=e,n.map=Id.get(e)}t(r)}return!0}(e,t),addRowBefore:()=>({state:e,dispatch:t})=>function(e,t){if(!jd(e))return!1;if(t){const n=Zd(e);t(nu(e.tr,n,n.top))}return!0}(e,t),addRowAfter:()=>({state:e,dispatch:t})=>function(e,t){if(!jd(e))return!1;if(t){const n=Zd(e);t(nu(e.tr,n,n.bottom))}return!0}(e,t),deleteRow:()=>({state:e,dispatch:t})=>function(e,t){if(!jd(e))return!1;if(t){const n=Zd(e),r=e.tr;if(0==n.top&&n.bottom==n.map.height)return!1;for(let e=n.bottom-1;ru(r,n,e),e!=n.top;e--){const e=n.tableStart?r.doc.nodeAt(n.tableStart-1):r.doc;if(!e)throw new RangeError("No table found");n.table=e,n.map=Id.get(n.table)}t(r)}return!0}(e,t),deleteTable:()=>({state:e,dispatch:t})=>function(e,t){const n=e.selection.$anchor;for(let r=n.depth;r>0;r--)if("table"==n.node(r).type.spec.tableRole)return t&&t(e.tr.delete(n.before(r),n.after(r)).scrollIntoView()),!0;return!1}(e,t),mergeCells:()=>({state:e,dispatch:t})=>iu(e,t),splitCell:()=>({state:e,dispatch:t})=>su(e,t),toggleHeaderColumn:()=>({state:e,dispatch:t})=>lu("column")(e,t),toggleHeaderRow:()=>({state:e,dispatch:t})=>lu("row")(e,t),toggleHeaderCell:()=>({state:e,dispatch:t})=>cu(e,t),mergeOrSplit:()=>({state:e,dispatch:t})=>!!iu(e,t)||su(e,t),setCellAttribute:(e,t)=>({state:n,dispatch:r})=>function(e,t){return function(n,r){if(!jd(n))return!1;const o=Bd(n);if(o.nodeAfter.attrs[e]===t)return!1;if(r){const i=n.tr;n.selection instanceof Jd?n.selection.forEachCell((n,r)=>{n.attrs[e]!==t&&i.setNodeMarkup(r,null,{...n.attrs,[e]:t})}):i.setNodeMarkup(o.pos,null,{...o.nodeAfter.attrs,[e]:t}),r(i)}return!0}}(e,t)(n,r),goToNextCell:()=>({state:e,dispatch:t})=>du(1)(e,t),goToPreviousCell:()=>({state:e,dispatch:t})=>du(-1)(e,t),fixTables:()=>({state:e,dispatch:t})=>(t&&Qd(e),!0),setCellSelection:e=>({tr:t,dispatch:n})=>{if(n){const n=Jd.create(t.doc,e.anchorCell,e.headCell);t.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:Wu,"Mod-Backspace":Wu,Delete:Wu,"Mod-Delete":Wu}},addProseMirrorPlugins(){return[...this.options.resizable&&this.editor.isEditable?[Eu({handleWidth:this.options.handleWidth,cellMinWidth:this.options.cellMinWidth,defaultCellMinWidth:this.options.cellMinWidth,View:this.options.View,lastColumnResizable:this.options.lastColumnResizable})]:[],zu({allowTableNodeSelection:this.options.allowTableNodeSelection})]},extendNodeSchema(e){return{tableRole:wi(yi(e,"tableRole",{name:e.name,options:e.options,storage:e.storage}))}}}),Ku=(ks.create({name:"tableKit",addExtensions(){const e=[];return!1!==this.options.table&&e.push(qu.configure(this.options.table)),!1!==this.options.tableCell&&e.push(Lu.configure(this.options.tableCell)),!1!==this.options.tableHeader&&e.push(Fu.configure(this.options.tableHeader)),!1!==this.options.tableRow&&e.push(Hu.configure(this.options.tableRow)),e}}),Hu),Ju=Lu,Uu=Fu,Gu=jc,Xu=Hc,Yu=ks.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:null}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:e=>{const t=e.style.textAlign;return this.options.alignments.includes(t)?t:this.options.defaultAlignment},renderHTML:e=>e.textAlign?{style:`text-align: ${e.textAlign}`}:{}}}}]},addCommands(){return{setTextAlign:e=>({commands:t})=>!!this.options.alignments.includes(e)&&this.options.types.map(n=>t.updateAttributes(n,{textAlign:e})).some(e=>e),unsetTextAlign:()=>({commands:e})=>this.options.types.map(t=>e.resetAttributes(t,"textAlign")).some(e=>e),toggleTextAlign:e=>({editor:t,commands:n})=>!!this.options.alignments.includes(e)&&(t.isActive({textAlign:e})?n.unsetTextAlign():n.setTextAlign(e))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),Qu=ms.create({name:"superscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sup"},{style:"vertical-align",getAttrs(e){return"super"===e&&null}}]},renderHTML({HTMLAttributes:e}){return["sup",Mi(this.options.HTMLAttributes,e),0]},addCommands(){return{setSuperscript:()=>({commands:e})=>e.setMark(this.name),toggleSuperscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSuperscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-.":()=>this.editor.commands.toggleSuperscript()}}}),Zu=ms.create({name:"subscript",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"sub"},{style:"vertical-align",getAttrs(e){return"sub"===e&&null}}]},renderHTML({HTMLAttributes:e}){return["sub",Mi(this.options.HTMLAttributes,e),0]},addCommands(){return{setSubscript:()=>({commands:e})=>e.setMark(this.name),toggleSubscript:()=>({commands:e})=>e.toggleMark(this.name),unsetSubscript:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-,":()=>this.editor.commands.toggleSubscript()}}}),eh=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))$/,th=/(?:^|\s)(==(?!\s+==)((?:[^=]+))==(?!\s+==))/g,nh=ms.create({name:"highlight",addOptions(){return{multicolor:!1,HTMLAttributes:{}}},addAttributes(){return this.options.multicolor?{color:{default:null,parseHTML:e=>e.getAttribute("data-color")||e.style.backgroundColor,renderHTML:e=>e.color?{"data-color":e.color,style:`background-color: ${e.color}; color: inherit`}:{}}}:{}},parseHTML(){return[{tag:"mark"}]},renderHTML({HTMLAttributes:e}){return["mark",Mi(this.options.HTMLAttributes,e),0]},renderMarkdown:(e,t)=>`==${t.renderChildren(e)}==`,parseMarkdown:(e,t)=>t.applyMark("highlight",t.parseInline(e.tokens||[])),markdownTokenizer:{name:"highlight",level:"inline",start:e=>e.indexOf("=="),tokenize(e,t,n){const r=/^(==)([^=]+)(==)/.exec(e);if(r){const e=r[2].trim(),t=n.inlineTokens(e);return{type:"highlight",raw:r[0],text:e,tokens:t}}}},addCommands(){return{setHighlight:e=>({commands:t})=>t.setMark(this.name,e),toggleHighlight:e=>({commands:t})=>t.toggleMark(this.name,e),unsetHighlight:()=>({commands:e})=>e.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-h":()=>this.editor.commands.toggleHighlight()}},addInputRules(){return[Ds({find:eh,type:this.type})]},addPasteRules(){return[Us({find:th,type:this.type})]}}),rh=(e,t=0)=>{const n=[];return!e.children.length||t>20||Array.from(e.children).forEach(e=>{"SPAN"===e.tagName?n.push(e):e.children.length&&n.push(...rh(e,t+1))}),n},oh=ms.create({name:"textStyle",priority:101,addOptions(){return{HTMLAttributes:{},mergeNestedSpanStyles:!0}},parseHTML(){return[{tag:"span",consuming:!1,getAttrs:e=>!!e.hasAttribute("style")&&(this.options.mergeNestedSpanStyles&&(e=>{if(!e.children.length)return;const t=rh(e);t&&t.forEach(e=>{var t,n;const r=e.getAttribute("style"),o=null==(n=null==(t=e.parentElement)?void 0:t.closest("span"))?void 0:n.getAttribute("style");e.setAttribute("style",`${o};${r}`)})})(e),{})}]},renderHTML({HTMLAttributes:e}){return["span",Mi(this.options.HTMLAttributes,e),0]},addCommands(){return{toggleTextStyle:e=>({commands:t})=>t.toggleMark(this.name,e),removeEmptyTextStyle:()=>({tr:e})=>{const{selection:t}=e;return e.doc.nodesBetween(t.from,t.to,(t,n)=>{if(t.isTextblock)return!0;t.marks.filter(e=>e.type===this.type).some(e=>Object.values(e.attrs).some(e=>!!e))||e.removeMark(n,n+t.nodeSize,this.type)}),!0}}}}),ih=ks.create({name:"backgroundColor",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{backgroundColor:{default:null,parseHTML:e=>{var t;const n=e.getAttribute("style");if(n){const e=n.split(";").map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;t-=1){const n=e[t].split(":");if(n.length>=2){const e=n[0].trim().toLowerCase(),t=n.slice(1).join(":").trim();if("background-color"===e)return t.replace(/['"]+/g,"")}}}return null==(t=e.style.backgroundColor)?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.backgroundColor?{style:`background-color: ${e.backgroundColor}`}:{}}}}]},addCommands(){return{setBackgroundColor:e=>({chain:t})=>t().setMark("textStyle",{backgroundColor:e}).run(),unsetBackgroundColor:()=>({chain:e})=>e().setMark("textStyle",{backgroundColor:null}).removeEmptyTextStyle().run()}}}),sh=ks.create({name:"color",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{color:{default:null,parseHTML:e=>{var t;const n=e.getAttribute("style");if(n){const e=n.split(";").map(e=>e.trim()).filter(Boolean);for(let t=e.length-1;t>=0;t-=1){const n=e[t].split(":");if(n.length>=2){const e=n[0].trim().toLowerCase(),t=n.slice(1).join(":").trim();if("color"===e)return t.replace(/['"]+/g,"")}}}return null==(t=e.style.color)?void 0:t.replace(/['"]+/g,"")},renderHTML:e=>e.color?{style:`color: ${e.color}`}:{}}}}]},addCommands(){return{setColor:e=>({chain:t})=>t().setMark("textStyle",{color:e}).run(),unsetColor:()=>({chain:e})=>e().setMark("textStyle",{color:null}).removeEmptyTextStyle().run()}}}),ah=ks.create({name:"fontFamily",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontFamily:{default:null,parseHTML:e=>e.style.fontFamily,renderHTML:e=>e.fontFamily?{style:`font-family: ${e.fontFamily}`}:{}}}}]},addCommands(){return{setFontFamily:e=>({chain:t})=>t().setMark("textStyle",{fontFamily:e}).run(),unsetFontFamily:()=>({chain:e})=>e().setMark("textStyle",{fontFamily:null}).removeEmptyTextStyle().run()}}}),lh=ks.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize,renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}}),ch=ks.create({name:"lineHeight",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:null,parseHTML:e=>e.style.lineHeight,renderHTML:e=>e.lineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({chain:t})=>t().setMark("textStyle",{lineHeight:e}).run(),unsetLineHeight:()=>({chain:e})=>e().setMark("textStyle",{lineHeight:null}).removeEmptyTextStyle().run()}}}),dh=(ks.create({name:"textStyleKit",addExtensions(){const e=[];return!1!==this.options.backgroundColor&&e.push(ih.configure(this.options.backgroundColor)),!1!==this.options.color&&e.push(sh.configure(this.options.color)),!1!==this.options.fontFamily&&e.push(ah.configure(this.options.fontFamily)),!1!==this.options.fontSize&&e.push(lh.configure(this.options.fontSize)),!1!==this.options.lineHeight&&e.push(ch.configure(this.options.lineHeight)),!1!==this.options.textStyle&&e.push(oh.configure(this.options.textStyle)),e}}),ah);const uh=ks.create({name:"indent",addOptions(){return{types:["paragraph","heading","blockquote","listItem"],indentRange:24,minIndent:0,maxIndent:210}},addGlobalAttributes(){return[{types:this.options.types,attributes:{indent:{default:0,parseHTML:e=>{const t=e.style.marginLeft,n=parseInt(t,10);return n&&n>0?n:0},renderHTML:e=>e.indent?{style:`margin-left: ${e.indent}px`}:{}}}}]},addCommands(){return{indent:()=>({tr:e,state:t,dispatch:n})=>{if(t.schema.nodes.listItem&&Yt(t.schema.nodes.listItem)(t,n))return!0;const{selection:r}=t;let o=!1;const{from:i,to:s}=r;return e.doc.nodesBetween(i,s,(t,n)=>{if(this.options.types.includes(t.type.name)){let r=!0;if("listItem"!==t.type.name&&"listItem"===e.doc.resolve(n).parent.type.name&&this.options.types.includes("listItem")&&(r=!1),r){const r=t.attrs.indent||0,i=Math.min(r+this.options.indentRange,this.options.maxIndent);r!==i&&(e.setNodeMarkup(n,void 0,{...t.attrs,indent:i}),o=!0)}}}),!!o&&(n&&n(e),!0)},outdent:()=>({tr:e,state:t,dispatch:n})=>{const{selection:r}=t;let o=!1,i=!1;const{from:s,to:a}=r;return e.doc.nodesBetween(s,a,(t,n)=>{if(this.options.types.includes(t.type.name)){const r=t.attrs.indent||0;if(r>this.options.minIndent){i=!0;let s=!0;if("listItem"!==t.type.name&&"listItem"===e.doc.resolve(n).parent.type.name&&this.options.types.includes("listItem")&&r<=0&&(s=!1),s){const i=Math.max(r-this.options.indentRange,this.options.minIndent);r!==i&&(e.setNodeMarkup(n,void 0,{...t.attrs,indent:i}),o=!0)}}}}),o?(n&&n(e),!0):!(i||!t.schema.nodes.listItem||!Xt(t.schema.nodes.listItem)(t,n))}}},addKeyboardShortcuts(){return{Tab:()=>this.editor.commands.indent(),"Shift-Tab":()=>this.editor.commands.outdent()}}});var hh=uh;const ph=ks.create({name:"lineHeight",addOptions(){return{types:["paragraph","heading","list_item","todo_item"],defaultLineHeight:"normal"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{lineHeight:{default:this.options.defaultLineHeight,parseHTML:e=>e.style.lineHeight||this.options.defaultLineHeight,renderHTML:e=>e.lineHeight&&e.lineHeight!==this.options.defaultLineHeight?{style:`line-height: ${e.lineHeight}`}:{}}}}]},addCommands(){return{setLineHeight:e=>({tr:t,state:n,dispatch:r})=>{const{selection:o}=n,{from:i,to:s}=o;let a=!1;return n.doc.nodesBetween(i,s,(n,o)=>{this.options.types.includes(n.type.name)&&(r?(t.setNodeMarkup(o,void 0,{...n.attrs,lineHeight:e}),a=!0):a=!0)}),a},unsetLineHeight:()=>({commands:e})=>e.setLineHeight(this.options.defaultLineHeight)}}});var fh=ph;const mh=ks.create({name:"fontSize",addOptions(){return{types:["textStyle"]}},addGlobalAttributes(){return[{types:this.options.types,attributes:{fontSize:{default:null,parseHTML:e=>e.style.fontSize.replace(/['"]+/g,""),renderHTML:e=>e.fontSize?{style:`font-size: ${e.fontSize}`}:{}}}}]},addCommands(){return{setFontSize:e=>({chain:t})=>t().setMark("textStyle",{fontSize:e}).run(),unsetFontSize:()=>({chain:e})=>e().setMark("textStyle",{fontSize:null}).removeEmptyTextStyle().run()}}});var gh=/(?:^|\s)(!\[(.+|:?)]\((\S+)(?:(?:\s+)["'](\S+)["'])?\))$/,vh=Ks.create({name:"image",addOptions(){return{inline:!1,allowBase64:!1,HTMLAttributes:{},resize:!1}},inline(){return this.options.inline},group(){return this.options.inline?"inline":"block"},draggable:!0,addAttributes(){return{src:{default:null},alt:{default:null},title:{default:null},width:{default:null},height:{default:null}}},parseHTML(){return[{tag:this.options.allowBase64?"img[src]":'img[src]:not([src^="data:"])'}]},renderHTML({HTMLAttributes:e}){return["img",Mi(this.options.HTMLAttributes,e)]},parseMarkdown:(e,t)=>t.createNode("image",{src:e.href,title:e.title,alt:e.text}),renderMarkdown:e=>{var t,n,r,o,i,s;const a=null!=(n=null==(t=e.attrs)?void 0:t.src)?n:"",l=null!=(o=null==(r=e.attrs)?void 0:r.alt)?o:"",c=null!=(s=null==(i=e.attrs)?void 0:i.title)?s:"";return c?``:``},addNodeView(){if(!this.options.resize||!this.options.resize.enabled||"undefined"==typeof document)return null;const{directions:e,minWidth:t,minHeight:n,alwaysPreserveAspectRatio:r}=this.options.resize;return({node:o,getPos:i,HTMLAttributes:s,editor:a})=>{const l=document.createElement("img");Object.entries(s).forEach(([e,t])=>{if(null!=t)switch(e){case"width":case"height":break;default:l.setAttribute(e,t)}}),l.src=s.src;const c=new zs({element:l,editor:a,node:o,getPos:i,onResize:(e,t)=>{l.style.width=`${e}px`,l.style.height=`${t}px`},onCommit:(e,t)=>{const n=i();void 0!==n&&this.editor.chain().setNodeSelection(n).updateAttributes(this.name,{width:e,height:t}).run()},onUpdate:(e,t,n)=>e.type===o.type,options:{directions:e,min:{width:t,height:n},preserveAspectRatio:!0===r}}),d=c.dom;return d.style.visibility="hidden",d.style.pointerEvents="none",l.onload=()=>{d.style.visibility="",d.style.pointerEvents=""},c}},addCommands(){return{setImage:e=>({commands:t})=>t.insertContent({type:this.name,attrs:e})}},addInputRules(){return[Ps({find:gh,type:this.type,getAttributes:e=>{const[,,t,n,r]=e;return{src:n,alt:t,title:r}}})]}}),yh=i(2028),bh=i(5554),kh=class{constructor(e,t){const n="function"==typeof e?e:bh.extend(e);this.ref=new n(t).$mount()}get element(){return this.ref.$el}updateProps(e={}){var t,n,r;if(!this.ref.$props)return;const o=null!=(r=null==(n=null==(t=this.ref.$props.editor)?void 0:t.contentComponent)?void 0:n.$options._base)?r:bh,i=o.config.silent;o.config.silent=!0,Object.entries(e).forEach(([e,t])=>{this.ref.$props[e]=t}),o.config.silent=i}destroy(){this.ref.$destroy()}},wh=((0,yh.objectProp)().required,(0,yh.objectProp)().required,(0,yh.objectProp)().required,(0,yh.booleanProp)().required,(0,yh.objectProp)().required,(0,yh.functionProp)().required,(0,yh.functionProp)().required,(0,yh.functionProp)().required,class extends Js{mount(){var e,t;const n={editor:this.editor,node:this.node,decorations:this.decorations,innerDecorations:this.innerDecorations,view:this.view,selected:!1,extension:this.extension,HTMLAttributes:this.HTMLAttributes,getPos:()=>this.getPos(),updateAttributes:(e={})=>this.updateAttributes(e),deleteNode:()=>this.deleteNode()},r=this.onDragStart.bind(this);this.decorationClasses=bh.observable({value:this.getDecorationClasses()});const o=(null!=(t=null==(e=this.editor.contentComponent)?void 0:e.$options._base)?t:bh).extend(this.component).extend({props:Object.keys(n),provide:()=>({onDragStart:r,decorationClasses:this.decorationClasses})});this.handleSelectionUpdate=this.handleSelectionUpdate.bind(this),this.editor.on("selectionUpdate",this.handleSelectionUpdate),this.renderer=new kh(o,{parent:this.editor.contentComponent,propsData:n})}get dom(){if(!this.renderer.element.hasAttribute("data-node-view-wrapper"))throw Error("Please use the NodeViewWrapper component for your node view.");return this.renderer.element}get contentDOM(){return this.node.isLeaf?null:this.dom.querySelector("[data-node-view-content]")}handleSelectionUpdate(){const{from:e,to:t}=this.editor.state.selection,n=this.getPos();if("number"==typeof n)if(e<=n&&t>=n+this.node.nodeSize){if(this.renderer.ref.$props.selected)return;this.selectNode()}else{if(!this.renderer.ref.$props.selected)return;this.deselectNode()}}update(e,t,n){const r=e=>{this.decorationClasses.value=this.getDecorationClasses(),this.renderer.updateProps(e)};if("function"==typeof this.options.update){const o=this.node,i=this.decorations,s=this.innerDecorations;return this.node=e,this.decorations=t,this.innerDecorations=n,this.options.update({oldNode:o,oldDecorations:i,newNode:e,newDecorations:t,oldInnerDecorations:s,innerDecorations:n,updateProps:()=>r({node:e,decorations:t,innerDecorations:n})})}return e.type===this.node.type&&(e===this.node&&this.decorations===t&&this.innerDecorations===n||(this.node=e,this.decorations=t,this.innerDecorations=n,r({node:e,decorations:t,innerDecorations:n})),!0)}selectNode(){this.renderer.updateProps({selected:!0}),this.renderer.element.classList.add("ProseMirror-selectednode")}deselectNode(){this.renderer.updateProps({selected:!1}),this.renderer.element.classList.remove("ProseMirror-selectednode")}getDecorationClasses(){return this.decorations.flatMap(e=>e.type.attrs.class).join(" ")}destroy(){this.renderer.destroy(),this.editor.off("selectionUpdate",this.handleSelectionUpdate)}}),xh=function(){var e=this,t=e.$createElement,n=e._self._c||t;return n("node-view-wrapper",{staticClass:"image-resizer",staticStyle:{display:"inline-block",position:"relative"}},[n("div",{staticClass:"image-wrapper",style:{width:e.width}},[n("img",{ref:"img",attrs:{src:e.node.attrs.src,alt:e.node.attrs.alt,title:e.node.attrs.title},on:{click:e.selectImage}}),e._v(" "),e.editor.isEditable?n("div",{staticClass:"resize-handle",on:{mousedown:e.onMouseDown}}):e._e()])])};xh._withStripped=!0;const{NodeViewWrapper:Sh}=i(9842);var Ch={components:{NodeViewWrapper:Sh},props:{node:{type:Object,required:!0},updateAttributes:{type:Function,required:!0},editor:{type:Object,required:!0}},data(){return{resizing:!1,startX:0,startWidth:0}},computed:{width(){return this.node.attrs.width||"auto"}},methods:{selectImage(){},onMouseDown(e){e.preventDefault(),this.resizing=!0,this.startX=e.clientX;const t=window.getComputedStyle(this.$refs.img);this.startWidth=parseInt(t.width,10),document.addEventListener("mousemove",this.onMouseMove),document.addEventListener("mouseup",this.onMouseUp)},onMouseMove(e){if(!this.resizing)return;const t=e.clientX-this.startX,n=Math.max(50,this.startWidth+t);this.$refs.img.style.width=`${n}px`},onMouseUp(e){if(!this.resizing)return;this.resizing=!1,document.removeEventListener("mousemove",this.onMouseMove),document.removeEventListener("mouseup",this.onMouseUp);const t=parseInt(this.$refs.img.style.width,10);this.updateAttributes({width:`${t}px`})}}},Mh=i(5072),Th=i.n(Mh),Ah=i(7825),Oh=i.n(Ah),Eh=i(7659),Nh=i.n(Eh),Rh=i(5056),Dh=i.n(Rh),Ph=i(540),$h=i.n(Ph),Ih=i(1113),zh=i.n(Ih),Lh=i(5762),Fh={};Fh.styleTagTransform=zh(),Fh.setAttributes=Dh(),Fh.insert=Nh().bind(null,"head"),Fh.domAPI=Oh(),Fh.insertStyleElement=$h(),Th()(Lh.A,Fh),Lh.A&&Lh.A.locals&&Lh.A.locals;var Hh=i(4486),jh=(0,Hh.A)(Ch,xh,[],!1,null,"f5376670",null);jh.options.__file="components/lib/bpmRichText/src/ImageResize.vue";var Bh=jh.exports,_h=vh.extend({addAttributes(){return{...this.parent?this.parent():{},width:{default:null,renderHTML:e=>e.width?{width:e.width,style:`width: ${e.width}`}:{}},height:{default:null,renderHTML:e=>e.height?{height:e.height,style:`height: ${e.height}`}:{}}}},addNodeView(){return function(e){return t=>t.editor.contentComponent?new wh(e,t,void 0):{}}(Bh)}}),Vh=bc.extend({addAttributes(){return{listStyleType:{default:"disc",parseHTML:e=>{const t=e.style.listStyleType,n=e.getAttribute("type");if(t)return t;if(n)return{disc:"disc",circle:"circle",square:"square"}[n]||"disc";const r={"list-dash":"dash","list-circle-open":"circle-open","list-square-open":"square-open","list-box":"box"};for(const t of Object.keys(r))if(e.classList.contains(t))return r[t];return"disc"},renderHTML:e=>{const t={dash:"list-dash","circle-open":"list-circle-open","square-open":"list-square-open",box:"list-box"};return t[e.listStyleType]?{class:t[e.listStyleType]}:{style:`list-style-type: ${e.listStyleType}`}}}}}}),Wh=Lc.extend({addAttributes(){return{start:{default:1,parseHTML:e=>e.hasAttribute("start")?parseInt(e.getAttribute("start"),10):1},listStyleType:{default:"decimal",parseHTML:e=>{const t=e.style.listStyleType,n=e.getAttribute("type");return t||(n&&{1:"decimal",a:"lower-alpha",A:"upper-alpha",i:"lower-roman",I:"upper-roman"}[n]||"decimal")},renderHTML:e=>{const t={decimal:"1","lower-alpha":"a","upper-alpha":"A","lower-roman":"i","upper-roman":"I"}[e.listStyleType]||"1";return{start:e.start,type:t,style:`list-style-type: ${e.listStyleType}`}}}}}}),qh=i(2742),Kh=i.n(qh),Jh=i(9795);function Uh(e){if(!e)return"";const t=new Set(["color","background-color","text-align","font-weight","font-style","text-decoration","font-family","font-size","line-height","margin-left","text-indent","list-style-type","border-collapse"]),n=String(e).split(";").map(e=>e.trim()).filter(Boolean),r=[];for(const e of n){const n=e.indexOf(":");if(-1===n)continue;const o=e.slice(0,n).trim().toLowerCase(),i=e.slice(n+1).trim();o.startsWith("mso-")||t.has(o)&&r.push(`${o}: ${i}`)}return r.join("; ")}let Gh=null;function Xh(e=[]){const t=Yh();return(Array.isArray(e)?e:[]).forEach(e=>{const n=t.entries.find(t=>t.token===e.token);if(n){n.cssType=null!=e.cssType?e.cssType:n.cssType,n.className=null!=e.className?e.className:n.className;const t=new Set([...n.symbols||[],...e.symbols||[]]);n.symbols=Array.from(t)}else t.entries.push({token:e.token,cssType:e.cssType||null,className:e.className||null,symbols:e.symbols||[]})}),t.charToToken=new Map,t.entries.forEach(e=>e.symbols.forEach(n=>t.charToToken.set(n,e.token))),Gh=t,Gh}function Yh(){return Gh||(Gh=function(){const e=[{token:"dash",cssType:null,className:"list-dash",symbols:["-","‐","‑","‒","–","—","−","﹣","-"]},{token:"disc",cssType:"disc",className:null,symbols:["•","●","·"]},{token:"circle",cssType:"circle",className:null,symbols:["◦","○","o","°"]},{token:"square",cssType:"square",className:null,symbols:["■","▪","▮",""]},{token:"square-open",cssType:null,className:"list-square-open",symbols:["□","▫","◻"]},{token:"box",cssType:null,className:"list-box",symbols:["☐"]}],t=new Map;return e.forEach(e=>{e.symbols.forEach(n=>t.set(n,e.token))}),{entries:e,charToToken:t}}()),Gh}function Qh(e,t){if(!e)return null;const n=function(e){return e?["-","‐","‑","‒","–","—","−","﹣","-"].includes(e)?"-":["•","●","·"].includes(e)?"•":["◦","○","o","°"].includes(e)?"○":["■","▪","▮",""].includes(e)?"■":["□","▫","◻"].includes(e)?"□":["☐"].includes(e)?"☐":e:e}(e.trim()[0]);return t.charToToken.get(n)||null}function Zh(e,t,n){if(!t)return;const r=n.entries.find(e=>e.token===t);if(r){if(r.cssType){const t=e.getAttribute("style")||"",n=t?`${t}; list-style-type: ${r.cssType}`:`list-style-type: ${r.cssType}`;e.setAttribute("style",n)}r.className&&e.classList.add(r.className)}}var ep=function(){var e=this,t=e.$createElement,n=e._self._c||t;return e.editor?n("div",{staticClass:"toolbar"},[n("div",{staticClass:"toolbar-group"},[n("button",{staticClass:"toolbar-btn",attrs:{type:"button",disabled:!e.editor.can().undo(),title:"Undo"},on:{click:function(t){e.editor.chain().focus().undo().run()}}},[n("i",{staticClass:"fa fa-undo"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",attrs:{type:"button",disabled:!e.editor.can().redo(),title:"Redo"},on:{click:function(t){e.editor.chain().focus().redo().run()}}},[n("i",{staticClass:"fa fa-repeat"})]),e._v(" "),n("button",{staticClass:"toolbar-btn toolbar-html-toggle",attrs:{type:"button",title:e.isHtmlMode?"Visual Editor":"HTML Source"},on:{click:function(t){return e.$emit("toggle-html-mode")}}},[n("i",{staticClass:"fa",class:e.isHtmlMode?"fa-eye":"fa-code"}),e._v(" "),n("span",{staticClass:"toolbar-html-label"},[e._v(e._s(e.isHtmlMode?"Visual":"HTML"))])])]),e._v(" "),n("div",{staticClass:"toolbar-separator"}),e._v(" "),n("div",{staticClass:"toolbar-group"},[n("div",{staticClass:"dropdown-wrapper"},[n("button",{staticClass:"toolbar-btn dropdown-trigger",class:{"is-active":e.editor.isActive("heading")},attrs:{type:"button"},on:{click:e.toggleHeadingMenu}},[e._v("\n "+e._s(e.currentHeading)+" "),n("i",{staticClass:"fa fa-caret-down"})]),e._v(" "),e.showHeadingMenu?n("div",{staticClass:"dropdown-menu",on:{mouseleave:function(t){e.showHeadingMenu=!1}}},[n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("heading",{level:1})},on:{click:function(t){return e.setHeading(1)}}},[e._v("H1 Heading 1")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("heading",{level:2})},on:{click:function(t){return e.setHeading(2)}}},[e._v("H2 Heading 2")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("heading",{level:3})},on:{click:function(t){return e.setHeading(3)}}},[e._v("H3 Heading 3")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("heading",{level:4})},on:{click:function(t){return e.setHeading(4)}}},[e._v("H4 Heading 4")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("paragraph")},on:{click:function(t){return e.setParagraph()}}},[e._v("Paragraph")])]):e._e()]),e._v(" "),n("div",{staticClass:"dropdown-wrapper"},[n("button",{staticClass:"toolbar-btn dropdown-trigger",class:{"is-active":e.editor.getAttributes("textStyle").fontFamily},staticStyle:{"min-width":"100px","justify-content":"space-between"},attrs:{type:"button"},on:{click:e.toggleFontFamilyMenu}},[n("span",{staticStyle:{overflow:"hidden","text-overflow":"ellipsis","white-space":"nowrap","max-width":"80px"}},[e._v(e._s(e.currentFontFamily))]),e._v(" "),n("i",{staticClass:"fa fa-caret-down"})]),e._v(" "),e.showFontFamilyMenu?n("div",{staticClass:"dropdown-menu",staticStyle:{width:"160px","max-height":"300px","overflow-y":"auto"},on:{mouseleave:function(t){e.showFontFamilyMenu=!1}}},[n("div",{staticClass:"dropdown-item",class:{"is-active":!e.editor.getAttributes("textStyle").fontFamily},on:{click:function(t){return e.unsetFontFamily()}}},[e._v("Default")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontFamily:"Arial"})},staticStyle:{"font-family":"Arial"},on:{click:function(t){return e.setFontFamily("Arial")}}},[e._v("Arial")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontFamily:"Arial Black"})},staticStyle:{"font-family":"'Arial Black'"},on:{click:function(t){return e.setFontFamily("Arial Black")}}},[e._v("Arial Black")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontFamily:"Georgia"})},staticStyle:{"font-family":"Georgia"},on:{click:function(t){return e.setFontFamily("Georgia")}}},[e._v("Georgia")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontFamily:"Impact"})},staticStyle:{"font-family":"Impact"},on:{click:function(t){return e.setFontFamily("Impact")}}},[e._v("Impact")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontFamily:"Tahoma"})},staticStyle:{"font-family":"Tahoma"},on:{click:function(t){return e.setFontFamily("Tahoma")}}},[e._v("Tahoma")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontFamily:"Times New Roman"})},staticStyle:{"font-family":"'Times New Roman'"},on:{click:function(t){return e.setFontFamily("Times New Roman")}}},[e._v("Times New Roman")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontFamily:"Verdana"})},staticStyle:{"font-family":"Verdana"},on:{click:function(t){return e.setFontFamily("Verdana")}}},[e._v("Verdana")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontFamily:"Courier New"})},staticStyle:{"font-family":"'Courier New'"},on:{click:function(t){return e.setFontFamily("Courier New")}}},[e._v("Courier New")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontFamily:"Lucida Console"})},staticStyle:{"font-family":"'Lucida Console'"},on:{click:function(t){return e.setFontFamily("Lucida Console")}}},[e._v("Lucida Console")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontFamily:"Monaco"})},staticStyle:{"font-family":"Monaco"},on:{click:function(t){return e.setFontFamily("Monaco")}}},[e._v("Monaco")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontFamily:"monospace"})},staticStyle:{"font-family":"monospace"},on:{click:function(t){return e.setFontFamily("monospace")}}},[e._v("monospace")])]):e._e()]),e._v(" "),n("div",{staticClass:"dropdown-wrapper"},[n("button",{staticClass:"toolbar-btn dropdown-trigger",class:{"is-active":e.editor.getAttributes("textStyle").fontSize},attrs:{type:"button"},on:{click:e.toggleFontSizeMenu}},[e._v("\n "+e._s(e.currentFontSize)+" "),n("i",{staticClass:"fa fa-caret-down"})]),e._v(" "),e.showFontSizeMenu?n("div",{staticClass:"dropdown-menu",on:{mouseleave:function(t){e.showFontSizeMenu=!1}}},[n("div",{staticClass:"dropdown-item",class:{"is-active":!e.editor.getAttributes("textStyle").fontSize},on:{click:function(t){return e.unsetFontSize()}}},[e._v("default")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"8px"})},on:{click:function(t){return e.setFontSize("8px")}}},[e._v("8")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"10px"})},on:{click:function(t){return e.setFontSize("10px")}}},[e._v("10")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"12px"})},on:{click:function(t){return e.setFontSize("12px")}}},[e._v("12")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"14px"})},on:{click:function(t){return e.setFontSize("14px")}}},[e._v("14")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"16px"})},on:{click:function(t){return e.setFontSize("16px")}}},[e._v("16")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"18px"})},on:{click:function(t){return e.setFontSize("18px")}}},[e._v("18")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"20px"})},on:{click:function(t){return e.setFontSize("20px")}}},[e._v("20")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"24px"})},on:{click:function(t){return e.setFontSize("24px")}}},[e._v("24")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"30px"})},on:{click:function(t){return e.setFontSize("30px")}}},[e._v("30")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"36px"})},on:{click:function(t){return e.setFontSize("36px")}}},[e._v("36")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"48px"})},on:{click:function(t){return e.setFontSize("48px")}}},[e._v("48")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"60px"})},on:{click:function(t){return e.setFontSize("60px")}}},[e._v("60")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("textStyle",{fontSize:"72px"})},on:{click:function(t){return e.setFontSize("72px")}}},[e._v("72")])]):e._e()])]),e._v(" "),n("div",{staticClass:"toolbar-separator"}),e._v(" "),n("div",{staticClass:"toolbar-group"},[n("div",{staticClass:"dropdown-wrapper"},[n("button",{staticClass:"toolbar-btn dropdown-trigger",class:{"is-active":e.editor.isActive("bulletList")},attrs:{type:"button",title:"Bullet List"},on:{click:e.toggleBulletListMenu}},[n("i",{staticClass:"fa fa-list-ul"}),e._v(" "),n("i",{staticClass:"fa fa-caret-down"})]),e._v(" "),e.showBulletListMenu?n("div",{staticClass:"dropdown-menu",on:{mouseleave:function(t){e.showBulletListMenu=!1}}},[n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("bulletList",{listStyleType:"disc"})||e.editor.isActive("bulletList")&&!e.editor.getAttributes("bulletList").listStyleType},on:{click:function(t){return e.setBulletList("disc")}}},[n("i",{staticClass:"fa fa-circle"}),e._v(" Disc")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("bulletList",{listStyleType:"circle"})},on:{click:function(t){return e.setBulletList("circle")}}},[n("i",{staticClass:"fa fa-circle-o"}),e._v(" Circle")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("bulletList",{listStyleType:"square"})},on:{click:function(t){return e.setBulletList("square")}}},[n("i",{staticClass:"fa fa-square"}),e._v(" Square")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive("bulletList",{listStyleType:"dash"})},on:{click:function(t){return e.setBulletList("dash")}}},[n("i",{staticClass:"fa fa-minus"}),e._v(" Dash")])]):e._e()]),e._v(" "),n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive("orderedList")},attrs:{type:"button",title:"Ordered List"},on:{click:function(t){e.editor.chain().focus().toggleOrderedList().run()}}},[n("i",{staticClass:"fa fa-list-ol"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive("taskList")},attrs:{type:"button",title:"Task List"},on:{click:function(t){e.editor.chain().focus().toggleTaskList().run()}}},[n("i",{staticClass:"fa fa-check-square-o"})])]),e._v(" "),n("div",{staticClass:"toolbar-separator"}),e._v(" "),n("div",{staticClass:"toolbar-group"},[n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive("blockquote")},attrs:{type:"button",title:"Blockquote"},on:{click:function(t){e.editor.chain().focus().toggleBlockquote().run()}}},[n("i",{staticClass:"fa fa-quote-right"})])]),e._v(" "),n("div",{staticClass:"toolbar-separator"}),e._v(" "),n("div",{staticClass:"toolbar-group"},[n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive("bold")},attrs:{type:"button",title:"Bold"},on:{click:function(t){e.editor.chain().focus().toggleBold().run()}}},[n("i",{staticClass:"fa fa-bold"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive("italic")},attrs:{type:"button",title:"Italic"},on:{click:function(t){e.editor.chain().focus().toggleItalic().run()}}},[n("i",{staticClass:"fa fa-italic"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive("strike")},attrs:{type:"button",title:"Strike"},on:{click:function(t){e.editor.chain().focus().toggleStrike().run()}}},[n("i",{staticClass:"fa fa-strikethrough"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive("code")},attrs:{type:"button",title:"Code"},on:{click:function(t){e.editor.chain().focus().toggleCode().run()}}},[n("i",{staticClass:"fa fa-code"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive("underline")},attrs:{type:"button",title:"Underline"},on:{click:function(t){e.editor.chain().focus().toggleUnderline().run()}}},[n("i",{staticClass:"fa fa-underline"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",attrs:{type:"button",title:"Clear Format"},on:{click:function(t){e.editor.chain().focus().unsetAllMarks().run()}}},[n("i",{staticClass:"fa fa-eraser"})])]),e._v(" "),n("div",{staticClass:"toolbar-separator"}),e._v(" "),n("div",{staticClass:"toolbar-group"},[n("div",{staticClass:"dropdown-wrapper"},[n("el-popover",{attrs:{placement:"bottom",width:"230",trigger:"click"},on:{show:e.initColorMenu},model:{value:e.showColorMenu,callback:function(t){e.showColorMenu=t},expression:"showColorMenu"}},[n("div",{staticClass:"color-picker-menu"},[n("div",{staticClass:"color-grid"},[e._l(e.presetColors,function(t){return n("div",{key:t,staticClass:"color-item",class:{"is-selected":e.editor.getAttributes("textStyle").color===t},style:{backgroundColor:t},on:{click:function(n){return e.setColor(t)}}})}),e._v(" "),n("div",{staticClass:"color-item remove-color",attrs:{title:"Remove Color"},on:{click:e.unsetColor}},[n("i",{staticClass:"fa fa-ban"})])],2),e._v(" "),n("div",{staticClass:"hex-input-wrapper"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.hexColor,expression:"hexColor"}],attrs:{type:"text",placeholder:"#000000"},domProps:{value:e.hexColor},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.applyHexColor.apply(null,arguments)},input:function(t){t.target.composing||(e.hexColor=t.target.value)}}}),e._v(" "),n("button",{attrs:{type:"button"},on:{click:e.applyHexColor}},[e._v("OK")])])]),e._v(" "),n("button",{staticClass:"toolbar-btn dropdown-trigger",class:{"is-active":e.editor.getAttributes("textStyle").color},attrs:{slot:"reference",type:"button"},slot:"reference"},[n("i",{staticClass:"fa fa-font",style:{color:e.editor.getAttributes("textStyle").color||"inherit"}}),e._v(" "),n("i",{staticClass:"fa fa-caret-down"})])])],1),e._v(" "),n("div",{staticClass:"dropdown-wrapper"},[n("el-popover",{attrs:{placement:"bottom",width:"230",trigger:"click"},on:{show:e.initHighlightMenu},model:{value:e.showHighlightMenu,callback:function(t){e.showHighlightMenu=t},expression:"showHighlightMenu"}},[n("div",{staticClass:"color-picker-menu"},[n("div",{staticClass:"color-grid"},[e._l(e.presetColors,function(t){return n("div",{key:t,staticClass:"color-item",class:{"is-selected":e.editor.getAttributes("highlight").color===t},style:{backgroundColor:t},on:{click:function(n){return e.setHighlight(t)}}})}),e._v(" "),n("div",{staticClass:"color-item remove-color",attrs:{title:"Remove Highlight"},on:{click:e.unsetHighlight}},[n("i",{staticClass:"fa fa-ban"})])],2),e._v(" "),n("div",{staticClass:"hex-input-wrapper"},[n("input",{directives:[{name:"model",rawName:"v-model",value:e.hexColor,expression:"hexColor"}],attrs:{type:"text",placeholder:"#000000"},domProps:{value:e.hexColor},on:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.applyHexHighlight.apply(null,arguments)},input:function(t){t.target.composing||(e.hexColor=t.target.value)}}}),e._v(" "),n("button",{attrs:{type:"button"},on:{click:e.applyHexHighlight}},[e._v("OK")])])]),e._v(" "),n("button",{staticClass:"toolbar-btn dropdown-trigger",class:{"is-active":e.editor.isActive("highlight")},attrs:{slot:"reference",type:"button",title:"Highlight Color"},slot:"reference"},[n("i",{staticClass:"fa fa-adjust",style:{backgroundColor:e.editor.getAttributes("highlight").color||"transparent",padding:"0 2px"}}),e._v(" "),n("i",{staticClass:"fa fa-caret-down"})])])],1)]),e._v(" "),n("div",{staticClass:"toolbar-separator"}),e._v(" "),n("div",{staticClass:"toolbar-group"},[n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive("link")},attrs:{type:"button",title:"Link"},on:{click:e.setLink}},[n("i",{staticClass:"fa fa-link"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive("superscript")},attrs:{type:"button",title:"Superscript"},on:{click:function(t){e.editor.chain().focus().toggleSuperscript().run()}}},[n("i",{staticClass:"fa fa-superscript"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive("subscript")},attrs:{type:"button",title:"Subscript"},on:{click:function(t){e.editor.chain().focus().toggleSubscript().run()}}},[n("i",{staticClass:"fa fa-subscript"})])]),e._v(" "),n("div",{staticClass:"toolbar-separator"}),e._v(" "),n("div",{staticClass:"toolbar-group"},[n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive({textAlign:"left"})},attrs:{type:"button",title:"Align Left"},on:{click:function(t){e.editor.chain().focus().setTextAlign("left").run()}}},[n("i",{staticClass:"fa fa-align-left"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive({textAlign:"center"})},attrs:{type:"button",title:"Align Center"},on:{click:function(t){e.editor.chain().focus().setTextAlign("center").run()}}},[n("i",{staticClass:"fa fa-align-center"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive({textAlign:"right"})},attrs:{type:"button",title:"Align Right"},on:{click:function(t){e.editor.chain().focus().setTextAlign("right").run()}}},[n("i",{staticClass:"fa fa-align-right"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",class:{"is-active":e.editor.isActive({textAlign:"justify"})},attrs:{type:"button",title:"Justify"},on:{click:function(t){e.editor.chain().focus().setTextAlign("justify").run()}}},[n("i",{staticClass:"fa fa-align-justify"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",attrs:{type:"button",title:"Indent"},on:{click:function(t){e.editor.chain().focus().indent().run()}}},[n("i",{staticClass:"fa fa-indent"})]),e._v(" "),n("button",{staticClass:"toolbar-btn",attrs:{type:"button",title:"Outdent"},on:{click:function(t){e.editor.chain().focus().outdent().run()}}},[n("i",{staticClass:"fa fa-outdent"})]),e._v(" "),n("div",{staticClass:"dropdown-wrapper"},[n("button",{staticClass:"toolbar-btn dropdown-trigger",class:{"is-active":e.editor.getAttributes("paragraph").lineHeight},attrs:{type:"button"},on:{click:e.toggleLineHeightMenu}},[n("i",{staticClass:"fa fa-text-height"}),e._v(" "),n("i",{staticClass:"fa fa-caret-down"})]),e._v(" "),e.showLineHeightMenu?n("div",{staticClass:"dropdown-menu",on:{mouseleave:function(t){e.showLineHeightMenu=!1}}},[n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive({lineHeight:"100%"})},on:{click:function(t){return e.setLineHeight("100%")}}},[e._v("100%")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive({lineHeight:"115%"})},on:{click:function(t){return e.setLineHeight("115%")}}},[e._v("115%")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive({lineHeight:"150%"})},on:{click:function(t){return e.setLineHeight("150%")}}},[e._v("150%")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive({lineHeight:"200%"})},on:{click:function(t){return e.setLineHeight("200%")}}},[e._v("200%")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive({lineHeight:"250%"})},on:{click:function(t){return e.setLineHeight("250%")}}},[e._v("250%")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-active":e.editor.isActive({lineHeight:"300%"})},on:{click:function(t){return e.setLineHeight("300%")}}},[e._v("300%")])]):e._e()])]),e._v(" "),n("div",{staticClass:"toolbar-separator"}),e._v(" "),n("div",{staticClass:"toolbar-group"},[n("div",{staticClass:"dropdown-wrapper"},[n("button",{staticClass:"toolbar-btn dropdown-trigger",class:{"is-active":e.editor.isActive("table")},attrs:{type:"button",title:"Table Operations"},on:{click:e.toggleTableMenu}},[n("i",{staticClass:"fa fa-table"}),e._v(" "),n("i",{staticClass:"fa fa-caret-down"})]),e._v(" "),e.showTableMenu?n("div",{staticClass:"dropdown-menu",staticStyle:{width:"180px"},on:{mouseleave:function(t){e.showTableMenu=!1}}},[n("div",{staticClass:"dropdown-item",on:{click:e.addTable}},[e._v("Insert Table")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-disabled":!e.editor.can().addColumnBefore()},on:{click:e.addColumnBefore}},[e._v("Add Column Before")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-disabled":!e.editor.can().addColumnAfter()},on:{click:e.addColumnAfter}},[e._v("Add Column After")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-disabled":!e.editor.can().deleteColumn()},on:{click:e.deleteColumn}},[e._v("Delete Column")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-disabled":!e.editor.can().addRowBefore()},on:{click:e.addRowBefore}},[e._v("Add Row Before")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-disabled":!e.editor.can().addRowAfter()},on:{click:e.addRowAfter}},[e._v("Add Row After")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-disabled":!e.editor.can().deleteRow()},on:{click:e.deleteRow}},[e._v("Delete Row")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-disabled":!e.editor.can().mergeCells()},on:{click:e.mergeCells}},[e._v("Merge Cells")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-disabled":!e.editor.can().splitCell()},on:{click:e.splitCell}},[e._v("Split Cell")]),e._v(" "),n("div",{staticClass:"dropdown-item",class:{"is-disabled":!e.editor.can().deleteTable()},on:{click:e.deleteTable}},[e._v("Delete Table")])]):e._e()]),e._v(" "),n("button",{staticClass:"toolbar-btn",attrs:{type:"button",title:"Insert Image"},on:{click:e.showImageDialog}},[n("i",{staticClass:"fa fa-image"})])]),e._v(" "),n("div",{staticClass:"toolbar-separator"}),e._v(" "),n("div",{staticClass:"toolbar-group"},[n("button",{staticClass:"toolbar-btn",attrs:{type:"button",title:e.isFullscreen?"Exit Fullscreen":"Fullscreen"},on:{click:function(t){return e.$emit("toggle-fullscreen")}}},[n("i",{staticClass:"fa",class:e.isFullscreen?"fa-compress":"fa-arrows-alt"})])]),e._v(" "),n("el-dialog",{attrs:{title:"Insert Image",visible:e.imageDialogVisible,width:"500px","append-to-body":"","close-on-click-modal":!1},on:{"update:visible":function(t){e.imageDialogVisible=t}}},[n("el-tabs",{model:{value:e.activeTab,callback:function(t){e.activeTab=t},expression:"activeTab"}},[n("el-tab-pane",{attrs:{label:"Upload",name:"upload"}},[n("div",{staticClass:"upload-container",on:{click:e.triggerFileSelect,drop:function(t){return t.preventDefault(),e.handleDrop.apply(null,arguments)},dragover:function(e){e.preventDefault()}}},[n("i",{staticClass:"el-icon-upload",staticStyle:{"font-size":"48px",color:"#c0c4cc","margin-bottom":"10px"}}),e._v(" "),n("div",{staticClass:"el-upload__text"},[e._v("Drop file here or "),n("em",[e._v("click to upload")])])]),e._v(" "),n("input",{ref:"fileInput",staticStyle:{display:"none"},attrs:{type:"file",accept:"image/*"},on:{change:e.handleFileChange}})]),e._v(" "),n("el-tab-pane",{attrs:{label:"URL",name:"url"}},[n("el-input",{attrs:{placeholder:"https://example.com/image.png"},model:{value:e.imageUrl,callback:function(t){e.imageUrl=t},expression:"imageUrl"}})],1)],1),e._v(" "),n("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[n("el-button",{on:{click:function(t){e.imageDialogVisible=!1}}},[e._v("Cancel")]),e._v(" "),n("el-button",{attrs:{type:"primary"},on:{click:e.confirmImage}},[e._v("Confirm")])],1)],1)],1):e._e()};ep._withStripped=!0;var tp={name:"Toolbar",props:{editor:{type:Object,required:!0},uploader:{type:Function},isFullscreen:{type:Boolean,default:!1},isHtmlMode:{type:Boolean,default:!1}},data(){return{showHeadingMenu:!1,showFontFamilyMenu:!1,showFontSizeMenu:!1,showColorMenu:!1,showHighlightMenu:!1,showLineHeightMenu:!1,showBulletListMenu:!1,showTableMenu:!1,imageDialogVisible:!1,activeTab:"upload",imageUrl:"",hexColor:"",presetColors:["#000000","#212121","#424242","#616161","#757575","#9e9e9e","#bdbdbd","#e0e0e0","#f5f5f5","#ffffff","#d50000","#f44336","#e91e63","#9c27b0","#673ab7","#3f51b5","#2196f3","#03a9f4","#00bcd4","#009688","#4caf50","#8bc34a","#cddc39","#ffeb3b","#ffc107","#ff9800","#ff5722","#795548","#607d8b","#90a4ae"]}},computed:{currentHeading(){return this.editor.isActive("heading",{level:1})?"H1":this.editor.isActive("heading",{level:2})?"H2":this.editor.isActive("heading",{level:3})?"H3":this.editor.isActive("heading",{level:4})?"H4":"Normal"},currentFontFamily(){const e=this.editor.getAttributes("textStyle").fontFamily;return e?e.replace(/['"]/g,""):"Font Family"},currentFontSize(){const e=this.editor.getAttributes("textStyle").fontSize;return e?e.replace("px",""):"default"}},methods:{initColorMenu(){this.hexColor=this.editor.getAttributes("textStyle").color||""},initHighlightMenu(){this.hexColor=this.editor.getAttributes("highlight").color||""},setHighlight(e){this.editor.chain().focus().toggleHighlight({color:e}).run(),this.showHighlightMenu=!1},unsetHighlight(){this.editor.chain().focus().unsetHighlight().run(),this.showHighlightMenu=!1},applyHexHighlight(){/^#([0-9A-F]{3}){1,2}$/i.test(this.hexColor)?this.setHighlight(this.hexColor):""===this.hexColor&&this.unsetHighlight()},toggleHeadingMenu(){this.showHeadingMenu=!this.showHeadingMenu},toggleFontFamilyMenu(){this.showFontFamilyMenu=!this.showFontFamilyMenu},setFontFamily(e){this.editor.chain().focus().setFontFamily(e).run(),this.showFontFamilyMenu=!1},unsetFontFamily(){this.editor.chain().focus().unsetFontFamily().run(),this.showFontFamilyMenu=!1},toggleBulletListMenu(){this.showBulletListMenu=!this.showBulletListMenu},setBulletList(e){this.editor.isActive("bulletList",{listStyleType:e})?this.editor.chain().focus().toggleBulletList().run():(this.editor.isActive("bulletList")||this.editor.chain().focus().toggleBulletList({listStyleType:e}).run(),this.editor.chain().focus().updateAttributes("bulletList",{listStyleType:e}).run()),this.showBulletListMenu=!1},toggleFontSizeMenu(){this.showFontSizeMenu=!this.showFontSizeMenu},toggleLineHeightMenu(){this.showLineHeightMenu=!this.showLineHeightMenu},setLineHeight(e){this.editor.chain().focus().setLineHeight(e).run(),this.showLineHeightMenu=!1},setColor(e){this.editor.chain().focus().setColor(e).run(),this.showColorMenu=!1},unsetColor(){this.editor.chain().focus().unsetColor().run(),this.showColorMenu=!1},applyHexColor(){/^#([0-9A-F]{3}){1,2}$/i.test(this.hexColor)?this.setColor(this.hexColor):""===this.hexColor&&this.unsetColor()},setHeading(e){this.editor.chain().focus().toggleHeading({level:e}).run(),this.showHeadingMenu=!1},setParagraph(){this.editor.chain().focus().setParagraph().run(),this.showHeadingMenu=!1},setFontSize(e){this.editor.chain().focus().setFontSize(e).run(),this.showFontSizeMenu=!1},unsetFontSize(){this.editor.chain().focus().unsetFontSize().run(),this.showFontSizeMenu=!1},setLink(){const e=this.editor.getAttributes("link").href,t=window.prompt("URL",e);null!==t&&(""!==t?this.editor.chain().focus().extendMarkRange("link").setLink({href:t}).run():this.editor.chain().focus().extendMarkRange("link").unsetLink().run())},addTable(){this.editor.chain().focus().insertTable({rows:3,cols:3,withHeaderRow:!0}).run(),this.showTableMenu=!1},toggleTableMenu(){this.showTableMenu=!this.showTableMenu},addColumnBefore(){this.editor.chain().focus().addColumnBefore().run(),this.showTableMenu=!1},addColumnAfter(){this.editor.chain().focus().addColumnAfter().run(),this.showTableMenu=!1},deleteColumn(){this.editor.chain().focus().deleteColumn().run(),this.showTableMenu=!1},addRowBefore(){this.editor.chain().focus().addRowBefore().run(),this.showTableMenu=!1},addRowAfter(){this.editor.chain().focus().addRowAfter().run(),this.showTableMenu=!1},deleteRow(){this.editor.chain().focus().deleteRow().run(),this.showTableMenu=!1},deleteTable(){this.editor.chain().focus().deleteTable().run(),this.showTableMenu=!1},mergeCells(){this.editor.chain().focus().mergeCells().run(),this.showTableMenu=!1},splitCell(){this.editor.chain().focus().splitCell().run(),this.showTableMenu=!1},showImageDialog(){this.imageDialogVisible=!0,this.activeTab="upload",this.imageUrl=""},triggerFileSelect(){this.$refs.fileInput.click()},async handleFileChange(e){const t=e.target.files[0];t&&await this.processFile(t),e.target.value=""},async handleDrop(e){const t=e.dataTransfer.files[0];t&&/image/i.test(t.type)&&await this.processFile(t)},async processFile(e){if(this.uploader){const t=await this.uploader(e);t&&(this.imageUrl=t,this.activeTab="url")}},confirmImage(){this.imageUrl&&(this.editor.chain().focus().setImage({src:this.imageUrl}).run(),this.imageDialogVisible=!1)}}},np=(i(6198),(0,Hh.A)(tp,ep,[],!1,null,"efca8e58",null));np.options.__file="components/lib/bpmRichText/src/Toolbar.vue";var rp=np.exports;const{Editor:op,EditorContent:ip}=i(9842);var sp={name:"BpmRichText",components:{EditorContent:ip,Toolbar:rp},props:{value:{type:String,default:""},fieldConf:{type:Object,default:()=>({name:""})},mode:String,uiType:String,beforeModeChange:{type:Function,default:null}},data(){return{editor:null,curVal:"",textLength:0,dialogVisible:!1,isFullscreen:!1,isHtmlMode:!1,rawHtml:"",rawHtmlDirty:!1,savedSelection:null}},computed:{readonly(){return"view"===this.mode}},watch:{value:{handler(e){this.curVal=e,this.editor&&(this.editor.getHTML()===e||this.editor.commands.setContent(e,!1),this.updateTextLength(),this.isHtmlMode?this.rawHtmlDirty||(this.rawHtml=e):(this.rawHtml=this.editor.getHTML(),this.rawHtmlDirty=!1))},immediate:!0},readonly(e){this.editor&&this.editor.setEditable(!e)}},mounted(){"table"!==this.uiType&&this.initEditor(),document.addEventListener("keydown",this.handleKeydown),document.addEventListener("fullscreenchange",this.onFullscreenChange),document.addEventListener("webkitfullscreenchange",this.onFullscreenChange),document.addEventListener("mozfullscreenchange",this.onFullscreenChange),document.addEventListener("MSFullscreenChange",this.onFullscreenChange)},beforeDestroy(){this.destroyEditor(),document.removeEventListener("keydown",this.handleKeydown),document.removeEventListener("fullscreenchange",this.onFullscreenChange),document.removeEventListener("webkitfullscreenchange",this.onFullscreenChange),document.removeEventListener("mozfullscreenchange",this.onFullscreenChange),document.removeEventListener("MSFullscreenChange",this.onFullscreenChange)},methods:{onRawHtmlInput(e){const t=e&&e.target?e.target.value:"";this.rawHtml=t,this.rawHtmlDirty=!0},async handleHtmlToggle(){this.isHtmlMode?await this.switchToVisual():await this.switchToHtml()},async switchToHtml(){if(!this.editor)return;const e=this.editor.getHTML();if(!await this.runBeforeModeChange("visual","html",e))return;const t=this.editor.state&&this.editor.state.selection?this.editor.state.selection:null;this.savedSelection=t?{from:t.from,to:t.to}:null,this.rawHtml=e,this.rawHtmlDirty=!1,this.isHtmlMode=!0},async switchToVisual(){if(!this.editor)return;const e=this.rawHtmlDirty?this.rawHtml:this.editor.getHTML();if(await this.runBeforeModeChange("html","visual",e)){if(this.rawHtmlDirty){const e=function(e,t={}){const n=(null==e?"":String(e)).replace(/\u0000/g,""),r=new Set(t.allowTags||["p","br","hr","strong","b","em","i","u","s","strike","code","pre","blockquote","span","div","h1","h2","h3","h4","h5","h6","a","ul","ol","li","table","thead","tbody","tfoot","tr","th","td","img"]),o=new Set(t.allowAttrs||["style","class","href","target","rel","src","alt","title","start","type","colspan","rowspan","align","width","height"]),i=new Set(t.forbiddenTags||["script","iframe","object","embed","link","meta","base"]),s=[],a=(new DOMParser).parseFromString(`<div>${n}</div>`,"text/html"),l=a.body&&a.body.firstChild?a.body.firstChild:a.body;if(!l)return{ok:!0,html:n};const c=e=>{const t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}},d=e=>{e&&e.parentNode&&e.parentNode.removeChild(e)},u=e=>{if(!e)return!0;const t=String(e).trim();if(!t)return!0;const n=t.toLowerCase();return!n.startsWith("javascript:")&&!n.startsWith("data:text/html")&&!n.startsWith("vbscript:")},h=e=>{const t=e.getAttribute("src")||"";if(t)return t.toLowerCase().startsWith("file://")?(e.removeAttribute("src"),e.setAttribute("alt","Local image blocked"),void e.setAttribute("data-original-src",t)):void(u(t)||(e.removeAttribute("src"),s.push("img src 包含不安全的协议")))},p=Array.from(l.querySelectorAll("*"));for(const e of p){const t=(e.tagName||"").toLowerCase();if(!t)continue;if(i.has(t)){s.push(`包含禁止标签 <${t}>`),d(e);continue}if(!r.has(t)){c(e);continue}const n=Array.from(e.attributes||[]);for(const r of n){const n=r.name.toLowerCase(),i=r.value;if(n.startsWith("on"))e.removeAttribute(r.name),s.push(`包含事件属性 ${r.name}`);else if(n.startsWith("xmlns"))e.removeAttribute(r.name);else if(!n.startsWith("data-"))if(o.has(n))if("href"!==n&&"src"!==n||u(i)){if("style"===n){const t=Uh(i);t?e.setAttribute("style",t):e.removeAttribute("style")}}else e.removeAttribute(r.name),s.push(`${t} ${n} 包含不安全的协议`);else e.removeAttribute(r.name)}if("a"===t){const t=e.getAttribute("href")||"";t&&t.toLowerCase().startsWith("file://")&&(e.removeAttribute("href"),s.push("a href 不允许 file://"))}"img"===t&&h(e)}const f=l.innerHTML;return s.length?{ok:!1,html:f,error:s[0],errors:s}:{ok:!0,html:f}}(this.rawHtml);if(!e.ok)return void this.notifyModeError(e.error||"HTML 校验失败,请检查标签/属性是否包含危险内容");this.rawHtml=e.html,this.rawHtmlDirty=!1,this.editor.commands.setContent(e.html,!1),this.curVal=e.html,this.$emit("input",e.html),this.$emit("change",e.html)}this.isHtmlMode=!1,this.$nextTick(()=>{this.restoreSelection()})}},async runBeforeModeChange(e,t,n){if("function"!=typeof this.beforeModeChange)return!0;try{const r=this.beforeModeChange({from:e,to:t,html:n});return r&&"function"==typeof r.then?!1!==await r:!1!==r}catch(e){return this.notifyModeError("beforeModeChange 执行失败"),!1}},notifyModeError(e){this.$message&&"function"==typeof this.$message.error?this.$message.error(e):window.alert(e)},restoreSelection(){if(!this.editor||!this.savedSelection)return;const e=this.editor.state&&this.editor.state.doc?this.editor.state.doc.content.size:0;if(!e)return;const t=Math.max(1,Math.min(this.savedSelection.from,e)),n=Math.max(1,Math.min(this.savedSelection.to,e));try{this.editor.commands.setTextSelection(t===n?t:{from:t,to:n})}catch(e){}},updateTextLength(){const e=this.editor&&this.editor.state&&this.editor.state.doc&&this.editor.state.doc.textContent||"";this.textLength=e.length},handleKeydown(e){"F11"===e.key&&(e.preventDefault(),this.toggleFullscreen()),"Escape"===e.key&&this.isFullscreen&&(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||this.toggleFullscreen())},toggleFullscreen(){const e="table"===this.uiType?this.$refs.editorContainerDialog:this.$refs.editorContainer;this.isFullscreen?document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():this.isFullscreen=!1:e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():e.msRequestFullscreen?e.msRequestFullscreen():this.isFullscreen=!0},onFullscreenChange(){this.isFullscreen=!!(document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement)},openDialog(){this.dialogVisible=!0},handleClose(){this.dialogVisible=!1},initEditor(){this.editor&&this.editor.destroy(),this.editor=new op({content:this.curVal,editable:!this.readonly,extensions:[Dd.configure({bulletList:!1,orderedList:!1}),Vh,Wh,Uc,mc,qu.configure({resizable:!0}),Ku,Uu,Ju,Gu,Xu,Yu.configure({types:["heading","paragraph"]}),Od.configure({placeholder:this.fieldConf.name||"Write something..."}),Qu,Zu,nh.extend({addAttributes(){return{color:{default:null,parseHTML:e=>{const t=e.getAttribute("style");if(t){const e=t.match(/background-color:\s*([^;]+)/i);if(e)return e[1].trim()}return e.getAttribute("data-color")},renderHTML:e=>e.color?{style:`background-color: ${e.color};`}:{}}}},inclusive:!1,parseHTML:()=>[{tag:"span",getAttrs:e=>{const t=e.getAttribute("style");return(t&&t.includes("background-color")||!!e.hasAttribute("data-highlighted"))&&{}}}]}).configure({multicolor:!0}),oh.configure({types:["textStyle","highlight"]}),dh,mh,sh,hh,fh,_h.configure({inline:!0,allowBase64:!0}),{name:"customPasteHandler",priority:1e3,addCommands(){return{}},addProseMirrorPlugins(){return[new this.constructor.PM.Plugin({props:{handlePaste:(e,t,n)=>{const r=t.clipboardData||t.originalEvent.clipboardData;return!!r&&(r.getData("text/html"),!1)}}})]}}],editorProps:{handleDrop:(e,t,n,r)=>{if(!r&&t.dataTransfer&&t.dataTransfer.files&&t.dataTransfer.files.length>0){const n=Array.from(t.dataTransfer.files).filter(e=>/image/i.test(e.type));if(n.length>0)return t.preventDefault(),n.forEach(async n=>{const r=await this.handleImageUpload(n);if(r){const{schema:n}=e.state,o=e.posAtCoords({left:t.clientX,top:t.clientY}),i=n.nodes.image.create({src:r}),s=e.state.tr.insert(o.pos,i);e.dispatch(s)}}),!0}return!1},handlePaste:(e,t,n)=>{const r=t.clipboardData||t.originalEvent.clipboardData;if(!r)return!1;if(r.getData("text/html"))return!1;const o=Array.from(r.items).filter(e=>"file"===e.kind&&e.type&&e.type.startsWith("image/")&&!e.type.includes("office")&&!e.type.includes("word")).map(e=>e.getAsFile());return o.length>0&&(t.preventDefault(),o.forEach(async t=>{const n=await this.handleImageUpload(t);if(n){const{schema:t}=e.state,r=t.nodes.image.create({src:n}),o=e.state.tr.replaceSelectionWith(r);e.dispatch(o)}}),!0)},transformPastedHTML:e=>{let t=function(e){if(console.log("transformWordLists_html",e),!e)return e;try{const t=function(e){if(!e)return e;let t=String(e);t=t.replace(/<!--\[if[\s\S]*?<!\[endif\]-->/gi,""),t=t.replace(/<\?xml[\s\S]*?\?>/gi,"");const n=t.match(/<body[^>]*>([\s\S]*?)<\/body>/i);return n&&(t=n[1]),t=t.replace(/<head[\s\S]*?<\/head>/gi,""),t=t.replace(/<html[^>]*>/gi,"").replace(/<\/html>/gi,""),t=t.replace(/\sxmlns(?::[\w-]+)?="[^"]*"/gi,""),t=t.replace(/<meta[^>]*>/gi,""),t=t.replace(/<link[^>]*>/gi,""),t=t.replace(/<xml[^>]*>[\s\S]*?<\/xml>/gi,""),t=t.replace(/<style[^>]*>[\s\S]*?<\/style>/gi,""),t=t.replace(/<\/?o:p[^>]*>/gi,""),t=t.replace(/<w:[\s\S]*?>[\s\S]*?<\/w:[\s\S]*?>/gi,""),t=t.replace(/<m:oMath[\s\S]*?>([\s\S]*?)<\/m:oMath>/gi,(e,t)=>`<span data-math="omml" data-source="${t.replace(/</g,"<").replace(/>/g,">")}">[Math]</span>`),t=t.replace(/<m:oMathPara[\s\S]*?>([\s\S]*?)<\/m:oMathPara>/gi,(e,t)=>`<span data-math="omml" data-source="${t.replace(/</g,"<").replace(/>/g,">")}">[Math]</span>`),t=t.replace(/<v:shape[\s\S]*?<v:imagedata[^>]*src="([^"]+)"[^>]*>[\s\S]*?<\/v:shape>/gi,(e,t)=>/^file:\/\//i.test(t)?`<img alt="Local image blocked" data-original-src="${t.replace(/"/g,""")}" />`:`<img src="${t}" />`),t=t.replace(/<\/?v:[^>]+>/gi,""),t}(e),n=document.createElement("div");n.innerHTML=t,function(e){try{const t=[];e.querySelectorAll("*").forEach(e=>{e.tagName&&e.tagName.includes(":")&&t.push(e);const n=e.getAttribute&&e.getAttribute("style");if(n){const t=Uh(n);t?e.setAttribute("style",t):e.removeAttribute("style")}const r=(e.tagName||"").toLowerCase();if("img"===r){const t=e.getAttribute("src")||"";/^file:\/\//i.test(t)&&(e.removeAttribute("src"),e.setAttribute("alt","Local image blocked"),e.setAttribute("data-original-src",t))}"table"===r&&(e.removeAttribute("summary"),e.removeAttribute("role"))}),t.forEach(e=>e.parentNode&&e.parentNode.removeChild(e))}catch(e){console.warn("postprocessOfficeDOM error:",e)}}(n),function(e){try{e.querySelectorAll('[style*="background-color"]').forEach(e=>{const t=e.getAttribute("style");if(t){const n=t.match(/background-color:\s*([^;]+)/i);if(n){const r=n[1].trim(),o=document.createElement("span");o.setAttribute("data-highlighted","true"),o.style.backgroundColor=r;const i=t.replace(/background-color:\s*[^;]+;?/gi,"").trim();for(i?e.setAttribute("style",i):e.removeAttribute("style");e.firstChild;)o.appendChild(e.firstChild);e.appendChild(o)}}}),e.querySelectorAll('[style*="highlight"]').forEach(e=>{const t=e.getAttribute("style");if(t){const r=t.match(/highlight:\s*([^;]+)/i);if(r){const o=r[1].trim(),i=document.createElement("span");i.setAttribute("data-highlighted","true");const s={yellow:"#ffff00",green:"#00ff00",cyan:"#00ffff",magenta:"#ff00ff",blue:"#0000ff",red:"#ff0000",darkBlue:"#000080",darkCyan:"#008080",darkGreen:"#008000",darkMagenta:"#800080",darkRed:"#800000",darkYellow:"#808000",gray25:"#c0c0c0",gray50:"#808080"}[(n=o).toLowerCase()]||n;s&&(i.style.backgroundColor=s);const a=t.replace(/highlight:\s*[^;]+;?/gi,"").trim();for(a?e.setAttribute("style",a):e.removeAttribute("style");e.firstChild;)i.appendChild(e.firstChild);e.appendChild(i)}}var n})}catch(e){console.warn("Error processing highlights:",e)}}(n);const r=Yh(),o=e=>{if(!e)return"";const t=String(e).replace(/\u00a0/g," ").trim(),n=t.match(/^([0-9]+[\.\)、]|[a-zA-Z][\.\)]|[ivxIVX]+[\.\)]|[‐‑‒–—−﹣-\-]|[•●◦○·o■▪▫□◻☐])/);return n?n[1]:t[0]||""},i=/^([0-9]+[\.\)、]\s*|[a-zA-Z][\.\)]\s*|[ivxIVX]+[\.\)]\s*|[‐‑‒–—−﹣-\-•●◦○·o■▪▫□◻☐]\s*)/,s=e=>{const t=[],n=Array.from(e.childNodes);for(const e of n){if(e&&1===e.nodeType){const n=e.tagName?e.tagName.toLowerCase():"",r=new Set(["div","body","table","tbody","thead","tfoot","tr","td"]),o=(()=>"function"==typeof e.querySelectorAll&&Array.from(e.querySelectorAll("p")).some(e=>!!(e.textContent||"").replace(/\u00a0/g," ").trimStart().match(i)))();if(r.has(n)&&"function"==typeof e.querySelector&&(e.querySelector('span[style*="mso-list:Ignore"], [style*="mso-list:"], .MsoListParagraph')||o)){t.push(...s(e));continue}}t.push(e)}return t},a=s(n),l=[];let c=[],d=null;const u=()=>c.length>0?c[c.length-1]:null;for(let e=0;e<a.length;e++){const t=a[e];let n=!1,s="ul",h=null,p=1,f="",m="",g=0,v="decimal";if(3===t.nodeType){const e=t.nodeValue;if(!e.trim()){l.push(t);continue}const r=e.trimStart(),s=r.match(i);if(!s){c=[],d=null,l.push(t);continue}n=!0,m=o(s[1]),f=r.substring(s[1].length).trimStart()}else{if(1!==t.nodeType){l.push(t);continue}{f=t.innerHTML;const e=t.getAttribute("style")||"",r=t.classList,s=e.includes("mso-list:")||r.contains("MsoListParagraph")||r.contains("15");let a=!1;for(let e of t.childNodes)8===e.nodeType&&e.nodeValue.includes("if !supportLists")&&(a=!0);const l=t.querySelector('span[style*="mso-list:Ignore"]');if(l){n=!0,m=o(l.textContent);const e=t.cloneNode(!0),r=e.querySelector('span[style*="mso-list:Ignore"]');r&&r.remove(),f=e.innerHTML}else{const e=(t.textContent||"").trim().match(i);if(e&&(a||s||e)){n=!0,m=o(e[1]);const t=document.createElement("div");t.innerHTML=f;const r=e=>{if(3===e.nodeType){const t=e.nodeValue.trimStart(),n=t.match(i);return!(!n||o(n[1])!==m||(e.nodeValue=t.substring(n[1].length).trimStart(),0))}if(1===e.nodeType)for(let t of e.childNodes)if(r(t))return!0;return!1};r(t),f=t.innerHTML}}if(n){const t=e.match(/margin-left:\s*([\d\.]+)(pt|px)/i);if(t){const e=parseFloat(t[1]);g="px"===t[2].toLowerCase()?.75*e:e}else{const t=e.match(/text-indent:\s*([\d\.]+)(pt|px)/i);if(t){const e=parseFloat(t[1]);g="px"===t[2].toLowerCase()?.75*e:e}}}}}if(n){if(0===c.length)d=g,p=1;else{null===d&&(d=g);const e=c[c.length-1],t=e.indent;if(g>t+5)p=e.level+1;else if(g>=t-5)p=e.level;else{let e=!1;for(let t=c.length-1;t>=0;t--)if(Math.abs(c[t].indent-g)<=5){p=c[t].level,e=!0;break}e||(p=Math.abs(g-d)<=5||g<d?1:Math.max(1,Math.round((g-d)/18)+1))}}let e=null;if(/^([0-9]+[\.\)、]|[a-zA-Z][\.\)]|[ivxIVX]+[\.\)])/.test(m)){s="ol";const t=m.match(/^(\d+)/);t&&(e=parseInt(t[1],10)),/^[0-9]+[\.\)、]/.test(m)?v="decimal":/^[a-z][\.\)]/.test(m)?v="lower-alpha":/^[A-Z][\.\)]/.test(m)?v="upper-alpha":/^[ivx]+[\.\)]/.test(m)?v="lower-roman":/^[IVX]+[\.\)]/.test(m)&&(v="upper-roman")}else s="ul",h=Qh(m,r);if("ul"===s&&c.length>0){const e=c[c.length-1];Math.abs(e.indent-g)<=5&&"ol"===e.type&&(p=e.level+1)}for(;c.length>0&&c[c.length-1].level>p;)c.pop();let t=u();if(t){if(t.level===p){if(t.type!==s||"ul"===s&&t.styleToken!==h||"ol"===s&&t.ordStyle!==v){c.pop();const n=u(),o=document.createElement(s);if("ol"===s){e&&e>1&&o.setAttribute("start",e);const t="decimal"===v?"1":"lower-alpha"===v?"a":"upper-alpha"===v?"A":"lower-roman"===v?"i":"upper-roman"===v?"I":"1";o.setAttribute("type",t);const n=o.getAttribute("style")||"",r=n?`${n}; list-style-type: ${v}`:`list-style-type: ${v}`;o.setAttribute("style",r)}"ul"===s&&Zh(o,h,r),n&&n.lastLi?n.lastLi.appendChild(o):l.push(o),c.push({type:s,level:p,element:o,lastLi:null,indent:g,styleToken:h,ordStyle:v}),t=c[c.length-1]}}else if(t.level<p){const n=document.createElement(s);if("ol"===s){e&&e>1&&n.setAttribute("start",e);const t="decimal"===v?"1":"lower-alpha"===v?"a":"upper-alpha"===v?"A":"lower-roman"===v?"i":"upper-roman"===v?"I":"1";n.setAttribute("type",t);const r=n.getAttribute("style")||"",o=r?`${r}; list-style-type: ${v}`:`list-style-type: ${v}`;n.setAttribute("style",o)}if("ul"===s&&Zh(n,h,r),t.lastLi)t.lastLi.appendChild(n);else{const e=document.createElement("li");e.style.listStyle="none",t.element.appendChild(e),t.lastLi=e,e.appendChild(n)}c.push({type:s,level:p,element:n,lastLi:null,indent:g,styleToken:h,ordStyle:v}),t=c[c.length-1]}}else{const n=document.createElement(s);if("ol"===s){e&&e>1&&n.setAttribute("start",e);const t="decimal"===v?"1":"lower-alpha"===v?"a":"upper-alpha"===v?"A":"lower-roman"===v?"i":"upper-roman"===v?"I":"1";n.setAttribute("type",t);const r=n.getAttribute("style")||"",o=r?`${r}; list-style-type: ${v}`:`list-style-type: ${v}`;n.setAttribute("style",o)}"ul"===s&&Zh(n,h,r),l.push(n),c.push({type:s,level:p,element:n,lastLi:null,indent:g,styleToken:h,ordStyle:v}),t=c[c.length-1]}const n=document.createElement("li");n.innerHTML=f,t.element.appendChild(n),t.lastLi=n}else c=[],d=null,l.push(t)}return n.innerHTML="",l.forEach(e=>n.appendChild(e)),n.innerHTML}catch(t){return console.error("Error transforming Word lists:",t),e}}(e);const n=document.createElement("div");return n.innerHTML=t,n.querySelectorAll("table").forEach(e=>{const t=e.innerHTML,n=document.createElement("div");n.innerHTML=t,e.parentNode.replaceChild(n,e)}),n.querySelectorAll('span[style*="background-color"]').forEach(e=>{e.hasAttribute("data-highlighted")||e.setAttribute("data-highlighted","true")}),n.querySelectorAll("*").forEach(e=>{const t=e.getAttribute("style");if(t){let n=t.split(";").filter(e=>{const t=e.toLowerCase();return!t.includes("border")&&!t.includes("outline")}).join(";").trim();n?e.setAttribute("style",n):e.removeAttribute("style")}const n=e.className.split(" ").filter(e=>{const t=e.toLowerCase();return!t.includes("border")&&!t.includes("outline")});n.length>0?e.className=n.join(" "):e.removeAttribute("class")}),n.innerHTML}},onUpdate:()=>{this.updateTextLength();const e=this.editor.getHTML();this.curVal=e,this.isHtmlMode||(this.rawHtml=e,this.rawHtmlDirty=!1),this.$emit("input",e),this.$emit("change",e)}}),this.updateTextLength(),this.rawHtml=this.editor.getHTML(),this.rawHtmlDirty=!1},destroyEditor(){this.editor&&(this.editor.destroy(),this.editor=null),this.textLength=0,this.isHtmlMode=!1,this.rawHtml="",this.rawHtmlDirty=!1,this.savedSelection=null},handleChange(e){},async handleImageUpload(e){if(!e)return null;if(e.size<51200)try{return await function(e){return new Promise((t,n)=>{const r=new FileReader;r.readAsDataURL(e),r.onload=()=>t(r.result),r.onerror=e=>n(e)})}(e)}catch(e){console.error("Base64 conversion failed",e)}return await async function(e){if(!e)return null;const t=new FormData;t.append("userfile",e);try{const e=await Kh().post("/platform/v1/papi/app_file/upload/",t,{headers:{"Content-Type":"multipart/form-data"}}),n=e.data&&e.data.data&&e.data.data.file_md5;return n?(0,Jh.zC)("/platform/v1/papi/web_file/image_view/",{file_md5:n}):(console.error("Upload failed: No MD5 returned",e),null)}catch(e){return console.error("Upload error:",e),null}}(e)}}},ap=sp,lp=(0,Hh.A)(ap,e,[],!1,null,null,null);lp.options.__file="components/lib/bpmRichText/src/main.vue";var cp=lp.exports;cp.install=function(e){e.component(cp.name,cp)};var dp=cp}(),s}()});
|