1"use strict";(self.webpackChunkroche_xx=self.webpackChunkroche_xx||[]).push([[229],{987:function(t,e,n){n.d(e,{$m:function(){return Qt},AB:function(){return rn},BQ:function(){return se},CU:function(){return je},Ce:function(){return Qe},Dd:function(){return hn},FF:function(){return Yt},GG:function(){return on},JJ:function(){return tn},J_:function(){return ee},KP:function(){return $t},KV:function(){return It},Nx:function(){return Et},Nz:function(){return nn},OX:function(){return Ge},Pg:function(){return x},QN:function(){return te},T7:function(){return xt},Wp:function(){return wt},YY:function(){return Be},Yj:function(){return dn},Zc:function(){return yn},_n:function(){return Ie},bP:function(){return gn},eL:function(){return St},fV:function(){return Te},fl:function(){return Jt},gk:function(){return At},gu:function(){return Ft},hO:function(){return qt},iI:function(){return Ct},kj:function(){return mn},rU:function(){return rt},tG:function(){return en},xe:function(){return Mt},zU:function(){return Pt}});var r=n(2096),o=n(9587),s=n(643),i=n(6900),a=n(4497),c=(n(1564),n(2584)),d=Object.defineProperty,l=(t,e)=>{for(var n in e)d(t,n,{get:e[n],enumerable:!0})};function u(t){const{state:e,transaction:n}=t;let{selection:r}=n,{doc:o}=n,{storedMarks:s}=n;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return r},get doc(){return o},get tr(){return r=n.selection,o=n.doc,s=n.storedMarks,n}}}var p=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:t,editor:e,state:n}=this,{view:r}=e,{tr:o}=n,s=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([t,e])=>[t,(...t)=>{const n=e(...t)(s);return o.getMeta("preventDispatch")||this.hasCustomState||r.dispatch(o),n}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:s}=r,i=[],a=!!t,c=t||o.tr,d={...Object.fromEntries(Object.entries(n).map(([t,n])=>[t,(...t)=>{const r=this.buildProps(c,e),o=n(...t)(r);return i.push(o),d}])),run:()=>(a||!e||c.getMeta("preventDispatch")||this.hasCustomState||s.dispatch(c),i.every(t=>!0===t))};return d}createCan(t){const{rawCommands:e,state:n}=this,r=!1,o=t||n.tr,s=this.buildProps(o,r);return{...Object.fromEntries(Object.entries(e).map(([t,e])=>[t,(...t)=>e(...t)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,r)}}buildProps(t,e=!0){const{rawCommands:n,editor:r,state:o}=this,{view:s}=r,i={tr:t,editor:r,view:s,state:u({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(n).map(([t,e])=>[t,(...t)=>e(...t)(i)]))}};return i}},h={};l(h,{blur:()=>m,clearContent:()=>f,clearNodes:()=>g,command:()=>y,createParagraphNear:()=>v,cut:()=>k,deleteCurrentNode:()=>b,deleteNode:()=>w,deleteRange:()=>M,deleteSelection:()=>E,enter:()=>S,exitCode:()=>$,extendMarkRange:()=>N,first:()=>j,focus:()=>B,forEach:()=>_,insertContent:()=>U,insertContentAt:()=>V,joinBackward:()=>J,joinDown:()=>q,joinForward:()=>X,joinItemBackward:()=>Z,joinItemForward:()=>G,joinTextblockBackward:()=>Q,joinTextblockForward:()=>tt,joinUp:()=>Y,keyboardShortcut:()=>nt,lift:()=>ot,liftEmptyBlock:()=>st,liftListItem:()=>it,newlineInCode:()=>at,resetAttributes:()=>lt,scrollIntoView:()=>ut,selectAll:()=>pt,selectNodeBackward:()=>ht,selectNodeForward:()=>mt,selectParentNode:()=>ft,selectTextblockEnd:()=>gt,selectTextblockStart:()=>yt,setContent:()=>kt,setMark:()=>ie,setMeta:()=>ae,setNode:()=>ce,setNodeSelection:()=>de,setTextDirection:()=>le,setTextSelection:()=>ue,sinkListItem:()=>pe,splitBlock:()=>me,splitListItem:()=>fe,toggleList:()=>ve,toggleMark:()=>ke,toggleNode:()=>be,toggleWrap:()=>xe,undoInputRule:()=>we,unsetAllMarks:()=>Me,unsetMark:()=>Ee,unsetTextDirection:()=>Se,updateAttributes:()=>$e,wrapIn:()=>Ce,wrapInList:()=>Oe});var m=()=>({editor:t,view:e})=>(requestAnimationFrame(()=>{var n;t.isDestroyed||(e.dom.blur(),null==(n=null==window?void 0:window.getSelection())||n.removeAllRanges())}),!0),f=(t=!0)=>({commands:e})=>e.setContent("",{emitUpdate:t}),g=()=>({state:t,tr:e,dispatch:n})=>{const{selection:o}=e,{ranges:s}=o;return!n||(s.forEach(({$from:n,$to:o})=>{t.doc.nodesBetween(n.pos,o.pos,(t,n)=>{if(t.type.isText)return;const{doc:o,mapping:s}=e,i=o.resolve(s.map(n)),a=o.resolve(s.map(n+t.nodeSize)),c=i.blockRange(a);if(!c)return;const d=(0,r.jP)(c);if(t.type.isTextblock){const{defaultType:t}=i.parent.contentMatchAt(i.index());e.setNodeMarkup(c.start,t)}(d||0===d)&&e.lift(c,d)})}),!0)},y=t=>e=>t(e),v=()=>({state:t,dispatch:e})=>(0,o.Z1)(t,e),k=(t,e)=>({editor:n,tr:r})=>{const{state:o}=n,i=o.doc.slice(t.from,t.to);r.deleteRange(t.from,t.to);const a=r.mapping.map(e);return r.insert(a,i.content),r.setSelection(new s.U3(r.doc.resolve(Math.max(a-1,0)))),!0},b=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,r=n.$anchor.node();if(r.content.size>0)return!1;const o=t.selection.$anchor;for(let s=o.depth;s>0;s-=1){if(o.node(s).type===r.type){if(e){const e=o.before(s),n=o.after(s);t.delete(e,n).scrollIntoView()}return!0}}return!1};function x(t,e){if("string"==typeof t){if(!e.nodes[t])throw Error(`There is no node type named '${t}'. Maybe you forgot to add the extension?`);
1return e.nodes[t]}return t}var w=t=>({tr:e,state:n,dispatch:r})=>{const o=x(t,n.schema),s=e.selection.$anchor;for(let t=s.depth;t>0;t-=1){if(s.node(t).type===o){if(r){const n=s.before(t),r=s.after(t);e.delete(n,r).scrollIntoView()}return!0}}return!1},M=t=>({tr:e,dispatch:n})=>{const{from:r,to:o}=t;return n&&e.delete(r,o),!0},E=()=>({state:t,dispatch:e})=>(0,o.ic)(t,e),S=()=>({commands:t})=>t.keyboardShortcut("Enter"),$=()=>({state:t,dispatch:e})=>(0,o.I$)(t,e);function C(t){return"[object RegExp]"===Object.prototype.toString.call(t)}function O(t,e,n={strict:!0}){const r=Object.keys(e);return!r.length||r.every(r=>n.strict?e[r]===t[r]:C(e[r])?e[r].test(t[r]):e[r]===t[r])}function T(t,e,n={}){return t.find(t=>t.type===e&&O(Object.fromEntries(Object.keys(n).map(e=>[e,t.attrs[e]])),n))}function z(t,e,n={}){return!!T(t,e,n)}function A(t,e,n){if(!t||!e)return;let r=t.parent.childAfter(t.parentOffset);if(r.node&&r.node.marks.some(t=>t.type===e)||(r=t.parent.childBefore(t.parentOffset)),!r.node||!r.node.marks.some(t=>t.type===e))return;if(!n){const t=r.node.marks.find(t=>t.type===e);t&&(n=t.attrs)}if(!T([...r.node.marks],e,n))return;let o=r.index,s=t.start()+r.offset,i=o+1,a=s+r.node.nodeSize;for(;o>0&&z([...t.parent.child(o-1).marks],e,n);)o-=1,s-=t.parent.child(o).nodeSize;for(;i<t.parent.childCount&&z([...t.parent.child(i).marks],e,n);)a+=t.parent.child(i).nodeSize,i+=1;return{from:s,to:a}}function R(t,e){if("string"==typeof t){if(!e.marks[t])throw Error(`There is no mark type named '${t}'. Maybe you forgot to add the extension?`);return e.marks[t]}return t}var N=(t,e)=>({tr:n,state:r,dispatch:o})=>{const i=R(t,r.schema),{doc:a,selection:c}=n,{$from:d,from:l,to:u}=c;if(o){const t=A(d,i,e);if(t&&t.from<=l&&t.to>=u){const e=s.U3.create(a,t.from,t.to);n.setSelection(e)}}return!0},j=t=>e=>{const n="function"==typeof t?t(e):t;for(let t=0;t<n.length;t+=1)if(n[t](e))return!0;return!1};function I(t){return t instanceof s.U3}function P(t=0,e=0,n=0){return Math.min(Math.max(t,e),n)}function L(t,e=null){if(!e)return null;const n=s.LN.atStart(t),r=s.LN.atEnd(t);if("start"===e||!0===e)return n;if("end"===e)return r;const o=n.from,i=r.to;return"all"===e?s.U3.create(t,P(0,o,i),P(t.content.size,o,i)):s.U3.create(t,P(e,o,i),P(e,o,i))}function H(){return"Android"===navigator.platform||/android/i.test(navigator.userAgent)}function D(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var B=(t=null,e={})=>({editor:n,view:r,tr:o,dispatch:s})=>{e={scrollIntoView:!0,...e};const i=()=>{(D()||H())&&r.dom.focus(),"undefined"==typeof navigator||!/^((?!chrome|android).)*safari/i.test(navigator.userAgent)||D()||H()||r.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{n.isDestroyed||(r.focus(),(null==e?void 0:e.scrollIntoView)&&n.commands.scrollIntoView())})};try{if(r.hasFocus()&&null===t||!1===t)return!0}catch{return!1}if(s&&null===t&&!I(n.state.selection))return i(),!0;const a=L(o.doc,t)||n.state.selection,c=n.state.selection.eq(a);return s&&(c||o.setSelection(a),c&&o.storedMarks&&o.setStoredMarks(o.storedMarks),i()),!0},_=(t,e)=>n=>t.every((t,r)=>e(t,{...n,index:r})),U=(t,e)=>({tr:n,commands:r})=>r.insertContentAt({from:n.selection.from,to:n.selection.to},t,e),W=t=>{const e=t.childNodes;for(let n=e.length-1;n>=0;n-=1){const r=e[n];3===r.nodeType&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?t.removeChild(r):1===r.nodeType&&W(r)}return t};function K(t){if("undefined"==typeof window)throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${t}</body>`,n=(new window.DOMParser).parseFromString(e,"text/html").body;return W(n)}function F(t,e,n){if(t instanceof i.bP||t instanceof i.FK)return t;n={slice:!0,parseOptions:{},...n};const r="string"==typeof t;if("object"==typeof t&&null!==t)try{if(Array.isArray(t)&&t.length>0)return i.FK.fromArray(t.map(t=>e.nodeFromJSON(t)));const r=e.nodeFromJSON(t);return n.errorOnInvalidContent&&r.check(),r}catch(o){if(n.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",t,"Error:",o),F("",e,n)}if(r){if(n.errorOnInvalidContent){let r=!1,o="";const s=new i.Sj({topNode:e.spec.topNode,marks:e.spec.marks,nodes:e.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:t=>(r=!0,o="string"==typeof t?t:t.outerHTML,null)}]}})});if(n.slice?i.S4.fromSchema(s).parseSlice(K(t),n.parseOptions):i.S4.fromSchema(s).parse(K(t),n.parseOptions),n.errorOnInvalidContent&&r)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${o}`)})}const r=i.S4.fromSchema(e);return n.slice?r.parseSlice(K(t),n.parseOptions).content:r.parse(K(t),n.parseOptions)}return F("",e,n)}var V=(t,e,n)=>({tr:o,dispatch:a,editor:c})=>{var d;if(a){let a;const u=t=>{c.emit("contentError",{editor:c,error:t,disableCollaboration:()=>{"collaboration"in c.storage&&"object"==typeof c.storage.collaboration&&c.storage.collaboration&&(c.storage.collaboration.isDisabled=!0)}})},p={preserveWhitespace:"full",...(n={parseOptions:c.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...n}).parseOptions};if(!n.errorOnInvalidContent&&!c.options.enableContentCheck&&c.options.emitContentError)try{F(e,c.schema,{parseOptions:p,errorOnInvalidContent:!0})}catch(l){u(l)}try{a=F(e,c.schema,{parseOptions:p,errorOnInvalidContent:null!=(d=n.errorOnInvalidContent)?d:c.options.enableContentCheck})}catch(l){return u(l),!1}let{from:h,to:m}="number"==typeof t?{from:t,to:t}:{from:t.from,to:t.to},f=!0,g=!0;
1if(("type"in a?[a]:a).forEach(t=>{t.check(),f=!!f&&(t.isText&&0===t.marks.length),g=!!g&&t.isBlock}),h===m&&g){const{parent:t}=o.doc.resolve(h);t.isTextblock&&!t.type.spec.code&&!t.childCount&&(h-=1,m+=1)}let y;if(f){if(Array.isArray(e))y=e.map(t=>t.text||"").join("");else if(e instanceof i.FK){let t="";e.forEach(e=>{e.text&&(t+=e.text)}),y=t}else y="object"==typeof e&&e&&e.text?e.text:e;o.insertText(y,h,m)}else{y=a;const t=o.doc.resolve(h),e=t.node(),n=0===t.parentOffset,r=e.isText||e.isTextblock,s=e.content.size>0;n&&r&&s&&g&&(h=Math.max(0,h-1)),o.replaceWith(h,m,y)}n.updateSelection&&function(t,e,n){const o=t.steps.length-1;if(o<e)return;const i=t.steps[o];if(!(i instanceof r.Ln||i instanceof r.Wg))return;const a=t.mapping.maps[o];let c=0;a.forEach((t,e,n,r)=>{0===c&&(c=r)}),t.setSelection(s.LN.near(t.doc.resolve(c),n))}(o,o.steps.length-1,-1),n.applyInputRules&&o.setMeta("applyInputRules",{from:h,text:y}),n.applyPasteRules&&o.setMeta("applyPasteRules",{from:h,text:y})}return!0},Y=()=>({state:t,dispatch:e})=>(0,o.G2)(t,e),q=()=>({state:t,dispatch:e})=>(0,o.bh)(t,e),J=()=>({state:t,dispatch:e})=>(0,o.Qv)(t,e),X=()=>({state:t,dispatch:e})=>(0,o.eT)(t,e),Z=()=>({state:t,dispatch:e,tr:n})=>{try{const o=(0,r.N0)(t.doc,t.selection.$from.pos,-1);return null!=o&&(n.join(o,2),e&&e(n),!0)}catch{return!1}},G=()=>({state:t,dispatch:e,tr:n})=>{try{const o=(0,r.N0)(t.doc,t.selection.$from.pos,1);return null!=o&&(n.join(o,2),e&&e(n),!0)}catch{return!1}},Q=()=>({state:t,dispatch:e})=>(0,o.eB)(t,e),tt=()=>({state:t,dispatch:e})=>(0,o._G)(t,e);function et(){return"undefined"!=typeof navigator&&/Mac/.test(navigator.platform)}var nt=t=>({editor:e,view:n,tr:r,dispatch:o})=>{const s=function(t){const e=t.split(/-(?!$)/);let n,r,o,s,i=e[e.length-1];"Space"===i&&(i=" ");for(let a=0;a<e.length-1;a+=1){const t=e[a];if(/^(cmd|meta|m)$/i.test(t))s=!0;else if(/^a(lt)?$/i.test(t))n=!0;else if(/^(c|ctrl|control)$/i.test(t))r=!0;else if(/^s(hift)?$/i.test(t))o=!0;else{if(!/^mod$/i.test(t))throw new Error(`Unrecognized modifier name: ${t}`);D()||et()?s=!0:r=!0}}return n&&(i=`Alt-${i}`),r&&(i=`Ctrl-${i}`),s&&(i=`Meta-${i}`),o&&(i=`Shift-${i}`),i}(t).split(/-(?!$)/),i=s.find(t=>!["Alt","Ctrl","Meta","Shift"].includes(t)),a=new KeyboardEvent("keydown",{key:"Space"===i?" ":i,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),c=e.captureTransaction(()=>{n.someProp("handleKeyDown",t=>t(n,a))});return null==c||c.steps.forEach(t=>{const e=t.map(r.mapping);e&&o&&r.maybeStep(e)}),!0};function rt(t,e,n={}){const{from:r,to:o,empty:s}=t.selection,i=e?x(e,t.schema):null,a=[];t.doc.nodesBetween(r,o,(t,e)=>{if(t.isText)return;const n=Math.max(r,e),s=Math.min(o,e+t.nodeSize);a.push({node:t,from:n,to:s})});const c=o-r,d=a.filter(t=>!i||i.name===t.node.type.name).filter(t=>O(t.node.attrs,n,{strict:!1}));if(s)return!!d.length;return d.reduce((t,e)=>t+e.to-e.from,0)>=c}var ot=(t,e={})=>({state:n,dispatch:r})=>!!rt(n,x(t,n.schema),e)&&(0,o.yY)(n,r),st=()=>({state:t,dispatch:e})=>(0,o.iz)(t,e),it=t=>({state:e,dispatch:n})=>{const r=x(t,e.schema);return(0,a.T2)(r)(e,n)},at=()=>({state:t,dispatch:e})=>(0,o.pC)(t,e);function ct(t,e){return e.nodes[t]?"node":e.marks[t]?"mark":null}function dt(t,e){const n="string"==typeof e?[e]:e;return Object.keys(t).reduce((e,r)=>(n.includes(r)||(e[r]=t[r]),e),{})}var lt=(t,e)=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const a=ct("string"==typeof t?t:t.name,r.schema);if(!a)return!1;"node"===a&&(s=x(t,r.schema)),"mark"===a&&(i=R(t,r.schema));let c=!1;return n.selection.ranges.forEach(t=>{r.doc.nodesBetween(t.$from.pos,t.$to.pos,(t,r)=>{s&&s===t.type&&(c=!0,o&&n.setNodeMarkup(r,void 0,dt(t.attrs,e))),i&&t.marks.length&&t.marks.forEach(s=>{i===s.type&&(c=!0,o&&n.addMark(r,r+t.nodeSize,i.create(dt(s.attrs,e))))})})}),c},ut=()=>({tr:t,dispatch:e})=>(e&&t.scrollIntoView(),!0),pt=()=>({tr:t,dispatch:e})=>{if(e){const e=new s.i5(t.doc);t.setSelection(e)}return!0},ht=()=>({state:t,dispatch:e})=>(0,o._e)(t,e),mt=()=>({state:t,dispatch:e})=>(0,o.Sd)(t,e),ft=()=>({state:t,dispatch:e})=>(0,o.hy)(t,e),gt=()=>({state:t,dispatch:e})=>(0,o.ec)(t,e),yt=()=>({state:t,dispatch:e})=>(0,o.$f)(t,e);function vt(t,e,n={},r={}){return F(t,e,{slice:!1,parseOptions:n,errorOnInvalidContent:r.errorOnInvalidContent})}var kt=(t,{errorOnInvalidContent:e,emitUpdate:n=!0,parseOptions:r={}}={})=>({editor:o,tr:s,dispatch:i,commands:a})=>{const{doc:c}=s;if("full"!==r.preserveWhitespace){const a=vt(t,o.schema,r,{errorOnInvalidContent:null!=e?e:o.options.enableContentCheck});return i&&s.replaceWith(0,c.content.size,a).setMeta("preventUpdate",!n),!0}return i&&s.setMeta("preventUpdate",!n),a.insertContentAt({from:0,to:c.content.size},t,{parseOptions:r,errorOnInvalidContent:null!=e?e:o.options.enableContentCheck})};function bt(t,e){const n=R(e,t.schema),{from:r,to:o,empty:s}=t.selection,i=[];s?(t.storedMarks&&i.push(...t.storedMarks),i.push(...t.selection.$head.marks())):t.doc.nodesBetween(r,o,t=>{i.push(...t.marks)});const a=i.find(t=>t.type.name===n.name);return a?{...a.attrs}:{}}function xt(t,e){const n=new r.dL(t);return e.forEach(t=>{t.steps.forEach(t=>{n.step(t)})}),n}function wt(t){for(let e=0;e<t.edgeCount;e+=1){const{type:n}=t.edge(e);if(n.isTextblock&&!n.hasRequiredAttrs())return n}return null}function Mt(t,e){const n=[];
1return t.descendants((t,r)=>{e(t)&&n.push({node:t,pos:r})}),n}function Et(t,e,n){const r=[];return t.nodesBetween(e.from,e.to,(t,e)=>{n(t)&&r.push({node:t,pos:e})}),r}function St(t,e){for(let n=t.depth;n>0;n-=1){const r=t.node(n);if(e(r))return{pos:n>0?t.before(n):0,start:t.start(n),depth:n,node:r}}}function $t(t){return e=>St(e.$from,t)}function Ct(t,e,n){if(void 0===t.config[e]&&t.parent)return Ct(t.parent,e,n);if("function"==typeof t.config[e]){return t.config[e].bind({...n,parent:t.parent?Ct(t.parent,e,n):null})}return t.config[e]}function Ot(t){return t.map(t=>{const e=Ct(t,"addExtensions",{name:t.name,options:t.options,storage:t.storage});return e?[t,...Ot(e())]:t}).flat(10)}function Tt(t,e){const n=i.ZF.fromSchema(e).serializeFragment(t),r=document.implementation.createHTMLDocument().createElement("div");return r.appendChild(n),r.innerHTML}function zt(t){return"function"==typeof t}function At(t,e=void 0,...n){return zt(t)?e?t.bind(e)(...n):t(...n):t}function Rt(t){return{baseExtensions:t.filter(t=>"extension"===t.type),nodeExtensions:t.filter(t=>"node"===t.type),markExtensions:t.filter(t=>"mark"===t.type)}}function Nt(t){const e=[],{nodeExtensions:n,markExtensions:r}=Rt(t),o=[...n,...r],s={default:null,validate:void 0,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1},i=n.filter(t=>"text"!==t.name).map(t=>t.name),a=r.map(t=>t.name),c=[...i,...a];return t.forEach(t=>{const n=Ct(t,"addGlobalAttributes",{name:t.name,options:t.options,storage:t.storage,extensions:o});if(!n)return;n().forEach(t=>{let n;n=Array.isArray(t.types)?t.types:"*"===t.types?c:"nodes"===t.types?i:"marks"===t.types?a:[],n.forEach(n=>{Object.entries(t.attributes).forEach(([t,r])=>{e.push({type:n,name:t,attribute:{...s,...r}})})})})}),o.forEach(t=>{const n={name:t.name,options:t.options,storage:t.storage},r=Ct(t,"addAttributes",n);if(!r)return;const o=r();Object.entries(o).forEach(([n,r])=>{const o={...s,...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,e.push({type:t.name,name:n,attribute:o})})}),e}function jt(t){const e=[],n=function(t){const e=[];let n="",r=!1,o=!1,s=0;const i=t.length;for(let a=0;a<i;a+=1){const i=t[a];if("'"!==i||o)if('"'!==i||r){if(!r&&!o){if("("===i){s+=1,n+=i;continue}if(")"===i&&s>0){s-=1,n+=i;continue}if(";"===i&&0===s){e.push(n),n="";continue}}n+=i}else o=!o,n+=i;else r=!r,n+=i}return n&&e.push(n),e}(t||""),r=n.length;for(let o=0;o<r;o+=1){const t=n[o],r=t.indexOf(":");if(-1===r)continue;const s=t.slice(0,r).trim(),i=t.slice(r+1).trim();s&&i&&e.push([s,i])}return e}function It(...t){return t.filter(t=>!!t).reduce((t,e)=>{const n={...t};return Object.entries(e).forEach(([t,e])=>{if(n[t])if("class"===t){const r=e?String(e).split(" "):[],o=n[t]?n[t].split(" "):[],s=r.filter(t=>!o.includes(t));n[t]=[...o,...s].join(" ")}else if("style"===t){const r=new Map([...jt(n[t]),...jt(e)]);n[t]=Array.from(r.entries()).map(([t,e])=>`${t}: ${e}`).join("; ")}else n[t]=e;else n[t]=e}),n},{})}function Pt(t,e){return e.filter(e=>e.type===t.type.name).filter(t=>t.attribute.rendered).map(e=>e.attribute.renderHTML?e.attribute.renderHTML(t.attrs)||{}:{[e.name]:t.attrs[e.name]}).reduce((t,e)=>It(t,e),{})}function Lt(t,e){return"style"in t?t:{...t,getAttrs:n=>{const r=t.getAttrs?t.getAttrs(n):t.attrs;if(!1===r)return!1;const o=e.reduce((t,e)=>{const r=e.attribute.parseHTML?e.attribute.parseHTML(n):function(t){return"string"!=typeof t?t:t.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(t):"true"===t||"false"!==t&&t}(n.getAttribute(e.name));return null==r?t:{...t,[e.name]:r}},{});return{...r,...o}}}}function Ht(t){return Object.fromEntries(Object.entries(t).filter(([t,e])=>("attrs"!==t||!function(t={}){return 0===Object.keys(t).length&&t.constructor===Object}(e))&&null!=e))}function Dt(t){var e,n;const r={};return!(null==(e=null==t?void 0:t.attribute)?void 0:e.isRequired)&&"default"in((null==t?void 0:t.attribute)||{})&&(r.default=t.attribute.default),void 0!==(null==(n=null==t?void 0:t.attribute)?void 0:n.validate)&&(r.validate=t.attribute.validate),[t.name,r]}function Bt(t,e){var n;const r=Nt(t),{nodeExtensions:o,markExtensions:s}=Rt(t),a=null==(n=o.find(t=>Ct(t,"topNode")))?void 0:n.name,c=Object.fromEntries(o.map(n=>{const o=r.filter(t=>t.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:e},i=Ht({...t.reduce((t,e)=>{const r=Ct(e,"extendNodeSchema",s);return{...t,...r?r(n):{}}
1},{}),content:At(Ct(n,"content",s)),marks:At(Ct(n,"marks",s)),group:At(Ct(n,"group",s)),inline:At(Ct(n,"inline",s)),atom:At(Ct(n,"atom",s)),selectable:At(Ct(n,"selectable",s)),draggable:At(Ct(n,"draggable",s)),code:At(Ct(n,"code",s)),whitespace:At(Ct(n,"whitespace",s)),linebreakReplacement:At(Ct(n,"linebreakReplacement",s)),defining:At(Ct(n,"defining",s)),isolating:At(Ct(n,"isolating",s)),attrs:Object.fromEntries(o.map(Dt))}),a=At(Ct(n,"parseHTML",s));a&&(i.parseDOM=a.map(t=>Lt(t,o)));const c=Ct(n,"renderHTML",s);c&&(i.toDOM=t=>c({node:t,HTMLAttributes:Pt(t,o)}));const d=Ct(n,"renderText",s);return d&&(i.toText=d),[n.name,i]})),d=Object.fromEntries(s.map(n=>{const o=r.filter(t=>t.type===n.name),s={name:n.name,options:n.options,storage:n.storage,editor:e},i=Ht({...t.reduce((t,e)=>{const r=Ct(e,"extendMarkSchema",s);return{...t,...r?r(n):{}}},{}),inclusive:At(Ct(n,"inclusive",s)),excludes:At(Ct(n,"excludes",s)),group:At(Ct(n,"group",s)),spanning:At(Ct(n,"spanning",s)),code:At(Ct(n,"code",s)),attrs:Object.fromEntries(o.map(Dt))}),a=At(Ct(n,"parseHTML",s));a&&(i.parseDOM=a.map(t=>Lt(t,o)));const c=Ct(n,"renderHTML",s);return c&&(i.toDOM=t=>c({mark:t,HTMLAttributes:Pt(t,o)})),[n.name,i]}));return new i.Sj({topNode:a,nodes:c,marks:d})}function _t(t){return t.sort((t,e)=>{const n=Ct(t,"priority")||100,r=Ct(e,"priority")||100;return n>r?-1:n<r?1:0})}function Ut(t){const e=_t(Ot(t)),n=function(t){const e=t.filter((e,n)=>t.indexOf(e)!==n);return Array.from(new Set(e))}(e.map(t=>t.name));return n.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${n.map(t=>`'${t}'`).join(", ")}]. This can lead to issues.`),e}function Wt(t,e,n){const{from:r,to:o}=e,{blockSeparator:s="\n\n",textSerializers:i={}}=n||{};let a="";return t.nodesBetween(r,o,(t,n,c,d)=>{var l;t.isBlock&&n>r&&(a+=s);const u=null==i?void 0:i[t.type.name];if(u)return c&&(a+=u({node:t,pos:n,parent:c,index:d,range:e})),!1;t.isText&&(a+=null==(l=null==t?void 0:t.text)?void 0:l.slice(Math.max(r,n)-n,o-n))}),a}function Kt(t){return Object.fromEntries(Object.entries(t.nodes).filter(([,t])=>t.spec.toText).map(([t,e])=>[t,e.spec.toText]))}function Ft(t,e){const n=ct("string"==typeof e?e:e.name,t.schema);return"node"===n?function(t,e){const n=x(e,t.schema),{from:r,to:o}=t.selection,s=[];t.doc.nodesBetween(r,o,t=>{s.push(t)});const i=s.reverse().find(t=>t.type.name===n.name);return i?{...i.attrs}:{}}(t,e):"mark"===n?bt(t,e):{}}function Vt(t){const e=function(t,e=JSON.stringify){const n={};return t.filter(t=>{const r=e(t);return!Object.prototype.hasOwnProperty.call(n,r)&&(n[r]=!0)})}(t);return 1===e.length?e:e.filter((t,n)=>!e.filter((t,e)=>e!==n).some(e=>t.oldRange.from>=e.oldRange.from&&t.oldRange.to<=e.oldRange.to&&t.newRange.from>=e.newRange.from&&t.newRange.to<=e.newRange.to))}function Yt(t){const{mapping:e,steps:n}=t,r=[];return e.maps.forEach((t,o)=>{const s=[];if(t.ranges.length)t.forEach((t,e)=>{s.push({from:t,to:e})});else{const{from:t,to:e}=n[o];if(void 0===t||void 0===e)return;s.push({from:t,to:e})}s.forEach(({from:t,to:n})=>{const s=e.slice(o).map(t,-1),i=e.slice(o).map(n),a=e.invert().map(s,-1),c=e.invert().map(i);r.push({oldRange:{from:a,to:c},newRange:{from:s,to:i}})})}),Vt(r)}function qt(t,e,n){const r=[];return t===e?n.resolve(t).marks().forEach(e=>{const o=A(n.resolve(t),e.type);o&&r.push({mark:e,...o})}):n.nodesBetween(t,e,(t,e)=>{t&&void 0!==(null==t?void 0:t.nodeSize)&&r.push(...t.marks.map(n=>({from:e,to:e+t.nodeSize,mark:n})))}),r}var Jt=(t,e,n,r=20)=>{const o=t.doc.resolve(n);let s=r,i=null;for(;s>0&&null===i;){const t=o.node(s);(null==t?void 0:t.type.name)===e?i=t:s-=1}return[i,s]};function Xt(t,e){return e.nodes[t]||e.marks[t]||null}function Zt(t,e,n){return Object.fromEntries(Object.entries(n).filter(([n])=>{const r=t.find(t=>t.type===e&&t.name===n);return!!r&&r.attribute.keepOnSplit}))}function Gt(t,e,n={}){const{empty:r,ranges:o}=t.selection,s=e?R(e,t.schema):null;if(r)return!!(t.storedMarks||t.selection.$from.marks()).filter(t=>!s||s.name===t.type.name).find(t=>O(t.attrs,n,{strict:!1}));let i=0;const a=[];if(o.forEach(({$from:e,$to:n})=>{const r=e.pos,o=n.pos;t.doc.nodesBetween(r,o,(t,e)=>{if(s&&t.inlineContent&&!t.type.allowsMarkType(s))return!1;if(!t.isText&&!t.marks.length)return;
1const n=Math.max(r,e),c=Math.min(o,e+t.nodeSize);i+=c-n,a.push(...t.marks.map(t=>({mark:t,from:n,to:c})))})}),0===i)return!1;const c=a.filter(t=>!s||s.name===t.mark.type.name).filter(t=>O(t.mark.attrs,n,{strict:!1})).reduce((t,e)=>t+e.to-e.from,0),d=a.filter(t=>!s||t.mark.type!==s&&t.mark.type.excludes(s)).reduce((t,e)=>t+e.to-e.from,0);return(c>0?c+d:c)>=i}function Qt(t,e,n={}){if(!e)return rt(t,null,n)||Gt(t,null,n);const r=ct(e,t.schema);return"node"===r?rt(t,e,n):"mark"===r&&Gt(t,e,n)}var te=(t,e)=>{const{$from:n,$to:r,$anchor:o}=t.selection;if(e){const n=$t(t=>t.type.name===e)(t.selection);if(!n)return!1;const r=t.doc.resolve(n.pos+1);return o.pos+1===r.end()}return!(r.parentOffset<r.parent.nodeSize-2||n.pos!==r.pos)},ee=t=>{const{$from:e,$to:n}=t.selection;return!(e.parentOffset>0||e.pos!==n.pos)};function ne(t,e){return Array.isArray(e)?e.some(e=>("string"==typeof e?e:e.name)===t.name):e}function re(t,e){const{nodeExtensions:n}=Rt(e),r=n.find(e=>e.name===t);if(!r)return!1;const o=At(Ct(r,"group",{name:r.name,options:r.options,storage:r.storage}));return"string"==typeof o&&o.split(" ").includes("list")}function oe(t,{checkChildren:e=!0,ignoreWhitespace:n=!1}={}){var r;if(n){if("hardBreak"===t.type.name)return!0;if(t.isText)return!/\S/.test(null!=(r=t.text)?r:"")}if(t.isText)return!t.text;if(t.isAtom||t.isLeaf)return!1;if(0===t.content.childCount)return!0;if(e){let r=!0;return t.content.forEach(t=>{!1!==r&&(oe(t,{ignoreWhitespace:n,checkChildren:e})||(r=!1))}),r}return!1}function se(t){return t instanceof s.nh}var ie=(t,e={})=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=n,{empty:i,ranges:a}=s,c=R(t,r.schema);if(o)if(i){const t=bt(r,c);n.addStoredMark(c.create({...t,...e}))}else a.forEach(t=>{const o=t.$from.pos,s=t.$to.pos;r.doc.nodesBetween(o,s,(t,r)=>{const i=Math.max(r,o),a=Math.min(r+t.nodeSize,s);t.marks.find(t=>t.type===c)?t.marks.forEach(t=>{c===t.type&&n.addMark(i,a,c.create({...t.attrs,...e}))}):n.addMark(i,a,c.create(e))})});return function(t,e,n){var r;const{selection:o}=e;let s=null;if(I(o)&&(s=o.$cursor),s){const e=null!=(r=t.storedMarks)?r:s.marks();return s.parent.type.allowsMarkType(n)&&(!!n.isInSet(e)||!e.some(t=>t.type.excludes(n)))}const{ranges:i}=o;return i.some(({$from:e,$to:r})=>{let o=0===e.depth&&t.doc.inlineContent&&t.doc.type.allowsMarkType(n);return t.doc.nodesBetween(e.pos,r.pos,(t,e,r)=>{if(o)return!1;if(t.isInline){const e=!r||r.type.allowsMarkType(n),s=!!n.isInSet(t.marks)||!t.marks.some(t=>t.type.excludes(n));o=e&&s}return!o}),o})}(r,n,c)},ae=(t,e)=>({tr:n})=>(n.setMeta(t,e),!0),ce=(t,e={})=>({state:n,dispatch:r,chain:s})=>{const i=x(t,n.schema);let a;return n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),i.isTextblock?s().command(({commands:t})=>!!(0,o.y_)(i,{...a,...e})(n)||t.clearNodes()).command(({state:t})=>(0,o.y_)(i,{...a,...e})(t,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},de=t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,r=P(t,0,n.content.size),o=s.nh.create(n,r);e.setSelection(o)}return!0},le=(t,e)=>({tr:n,state:r,dispatch:o})=>{const{selection:s}=r;let i,a;return"number"==typeof e?(i=e,a=e):e&&"from"in e&&"to"in e?(i=e.from,a=e.to):(i=s.from,a=s.to),o&&n.doc.nodesBetween(i,a,(e,r)=>{e.isText||n.setNodeMarkup(r,void 0,{...e.attrs,dir:t})}),!0},ue=t=>({tr:e,dispatch:n})=>{if(n){const{doc:n}=e,{from:r,to:o}="number"==typeof t?{from:t,to:t}:t,i=s.U3.atStart(n).from,a=s.U3.atEnd(n).to,c=P(r,i,a),d=P(o,i,a),l=s.U3.create(n,c,d);e.setSelection(l)}return!0},pe=t=>({state:e,dispatch:n})=>{const r=x(t,e.schema);return(0,a.$B)(r)(e,n)};function he(t,e){const n=t.storedMarks||t.selection.$to.parentOffset&&t.selection.$from.marks();if(n){const r=n.filter(t=>null==e?void 0:e.includes(t.type.name));t.tr.ensureMarks(r)}}var me=({keepMarks:t=!0}={})=>({tr:e,state:n,dispatch:o,editor:i})=>{const{selection:a,doc:c}=e,{$from:d,$to:l}=a,u=Zt(i.extensionManager.attributes,d.node().type.name,d.node().attrs);if(a instanceof s.nh&&a.node.isBlock)return!(!d.parentOffset||!(0,r.zy)(c,d.pos))&&(o&&(t&&he(n,i.extensionManager.splittableMarks),e.split(d.pos).scrollIntoView()),!0);if(!d.parent.isBlock)return!1;const p=l.parentOffset===l.parent.content.size,h=0===d.depth?void 0:wt(d.node(-1).contentMatchAt(d.indexAfter(-1)));let m=p&&h?[{type:h,attrs:u}]:void 0,f=(0,r.zy)(e.doc,e.mapping.map(d.pos),1,m);if(m||f||!(0,r.zy)(e.doc,e.mapping.map(d.pos),1,h?[{type:h}]:void 0)||(f=!0,m=h?[{type:h,attrs:u}]:void 0),o){if(f&&(a instanceof s.U3&&e.deleteSelection(),e.split(e.mapping.map(d.pos),1,m),h&&!p&&!d.parentOffset&&d.parent.type!==h)){const t=e.mapping.map(d.before()),n=e.doc.resolve(t);d.node(-1).canReplaceWith(n.index(),n.index()+1,h)&&e.setNodeMarkup(e.mapping.map(d.before()),h)}t&&he(n,i.extensionManager.splittableMarks),e.scrollIntoView()}return f},fe=(t,e={})=>({tr:n,state:o,dispatch:a,editor:c})=>{var d;const l=x(t,o.schema),{$from:u,$to:p}=o.selection,h=o.selection.node;
1if(h&&h.isBlock||u.depth<2||!u.sameParent(p))return!1;const m=u.node(-1);if(m.type!==l)return!1;const f=c.extensionManager.attributes;if(0===u.parent.content.size&&u.node(-1).childCount===u.indexAfter(-1)){if(2===u.depth||u.node(-3).type!==l||u.index(-2)!==u.node(-2).childCount-1)return!1;if(a){let t=i.FK.empty;const r=u.index(-1)?1:u.index(-2)?2:3;for(let e=u.depth-r;e>=u.depth-3;e-=1)t=i.FK.from(u.node(e).copy(t));const o=u.indexAfter(-1)<u.node(-2).childCount?1:u.indexAfter(-2)<u.node(-3).childCount?2:3,a={...Zt(f,u.node().type.name,u.node().attrs),...e},c=(null==(d=l.contentMatch.defaultType)?void 0:d.createAndFill(a))||void 0;t=t.append(i.FK.from(l.createAndFill(null,c)||void 0));const p=u.before(u.depth-(r-1));n.replace(p,u.after(-o),new i.Ji(t,4-r,0));let h=-1;n.doc.nodesBetween(p,n.doc.content.size,(t,e)=>{if(h>-1)return!1;t.isTextblock&&0===t.content.size&&(h=e+1)}),h>-1&&n.setSelection(s.U3.near(n.doc.resolve(h))),n.scrollIntoView()}return!0}const g=p.pos===u.end()?m.contentMatchAt(0).defaultType:null,y={...Zt(f,m.type.name,m.attrs),...e},v={...Zt(f,u.node().type.name,u.node().attrs),...e};n.delete(u.pos,p.pos);const k=g?[{type:l,attrs:y},{type:g,attrs:v}]:[{type:l,attrs:y}];if(!(0,r.zy)(n.doc,u.pos,2))return!1;if(a){const{selection:t,storedMarks:e}=o,{splittableMarks:r}=c.extensionManager,s=e||t.$to.parentOffset&&t.$from.marks();if(n.split(u.pos,2,k).scrollIntoView(),!s||!a)return!0;const i=s.filter(t=>r.includes(t.type.name));n.ensureMarks(i)}return!0},ge=(t,e)=>{const n=$t(t=>t.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(Math.max(0,n.pos-1)).before(n.depth);if(void 0===o)return!0;const s=t.doc.nodeAt(o);return n.node.type!==(null==s?void 0:s.type)||!(0,r.n9)(t.doc,n.pos)||(t.join(n.pos),!0)},ye=(t,e)=>{const n=$t(t=>t.type===e)(t.selection);if(!n)return!0;const o=t.doc.resolve(n.start).after(n.depth);if(void 0===o)return!0;const s=t.doc.nodeAt(o);return n.node.type!==(null==s?void 0:s.type)||!(0,r.n9)(t.doc,o)||(t.join(o),!0)};var ve=(t,e,n,r={})=>({editor:o,tr:i,state:a,dispatch:c,chain:d,commands:l,can:u})=>{const{extensions:p,splittableMarks:h}=o.extensionManager,m=x(t,a.schema),f=x(e,a.schema),{selection:g,storedMarks:y}=a,{$from:v,$to:k}=g,b=v.blockRange(k),w=y||g.$to.parentOffset&&g.$from.marks();if(!b)return!1;const M=$t(t=>re(t.type.name,p))(g),E=0===g.from&&g.to===a.doc.content.size,S=a.doc.content.content,$=1===S.length?S[0]:null,C=E&&$&&re($.type.name,p)?{node:$,pos:0,depth:0}:null,O=null!=M?M:C,T=!!C;if((!!M&&b.depth>=1&&b.depth-M.depth<=1||T)&&O){if(O.node.type===m)return E&&T?d().command(({tr:t,dispatch:e})=>{const n=function(t){const e=t.doc,n=e.firstChild;if(!n)return null;const r=e.resolve(1),o=e.resolve(n.nodeSize-1);return s.U3.between(r,o)}(t);return!!n&&(t.setSelection(n),e&&e(t),!0)}).liftListItem(f).run():l.liftListItem(f);if(re(O.node.type.name,p)&&m.validContent(O.node.content))return d().command(()=>(i.setNodeMarkup(O.pos,m),!0)).command(()=>ge(i,m)).command(()=>ye(i,m)).run()}return n&&w&&c?d().command(()=>{const t=u().wrapInList(m,r),e=w.filter(t=>h.includes(t.type.name));return i.ensureMarks(e),!!t||l.clearNodes()}).wrapInList(m,r).command(()=>ge(i,m)).command(()=>ye(i,m)).run():d().command(()=>!!u().wrapInList(m,r)||l.clearNodes()).wrapInList(m,r).command(()=>ge(i,m)).command(()=>ye(i,m)).run()},ke=(t,e={},n={})=>({state:r,commands:o})=>{const{extendEmptyMarkRange:s=!1}=n,i=R(t,r.schema);return Gt(r,i,e)?o.unsetMark(i,{extendEmptyMarkRange:s}):o.setMark(i,e)},be=(t,e,n={})=>({state:r,commands:o})=>{const s=x(t,r.schema),i=x(e,r.schema),a=rt(r,s,n);let c;return r.selection.$anchor.sameParent(r.selection.$head)&&(c=r.selection.$anchor.parent.attrs),a?o.setNode(i,c):o.setNode(s,{...c,...n})},xe=(t,e={})=>({state:n,commands:r})=>{const o=x(t,n.schema);return rt(n,o,e)?r.lift(o):r.wrapIn(o,e)},we=()=>({state:t,dispatch:e})=>{const n=t.plugins;for(let r=0;r<n.length;r+=1){const o=n[r];let s;if(o.spec.isInputRules&&(s=o.getState(t))){if(e){const e=t.tr,n=s.transform;for(let t=n.steps.length-1;t>=0;t-=1)e.step(n.steps[t].invert(n.docs[t]));if(s.text){const n=e.doc.resolve(s.from).marks();e.replaceWith(s.from,s.to,t.schema.text(s.text,n))}else e.delete(s.from,s.to)}return!0}}return!1},Me=()=>({tr:t,dispatch:e})=>{const{selection:n}=t,{empty:r,ranges:o}=n;
1return r||e&&o.forEach(e=>{t.removeMark(e.$from.pos,e.$to.pos)}),!0},Ee=(t,e={})=>({tr:n,state:r,dispatch:o})=>{var s;const{extendEmptyMarkRange:i=!1}=e,{selection:a}=n,c=R(t,r.schema),{$from:d,empty:l,ranges:u}=a;if(!o)return!0;if(l&&i){let{from:t,to:e}=a;const r=null==(s=d.marks().find(t=>t.type===c))?void 0:s.attrs,o=A(d,c,r);o&&(t=o.from,e=o.to),n.removeMark(t,e,c)}else u.forEach(t=>{n.removeMark(t.$from.pos,t.$to.pos,c)});return n.removeStoredMark(c),!0},Se=t=>({tr:e,state:n,dispatch:r})=>{const{selection:o}=n;let s,i;return"number"==typeof t?(s=t,i=t):t&&"from"in t&&"to"in t?(s=t.from,i=t.to):(s=o.from,i=o.to),r&&e.doc.nodesBetween(s,i,(t,n)=>{if(t.isText)return;const r={...t.attrs};delete r.dir,e.setNodeMarkup(n,void 0,r)}),!0},$e=(t,e={})=>({tr:n,state:r,dispatch:o})=>{let s=null,i=null;const a=ct("string"==typeof t?t:t.name,r.schema);if(!a)return!1;"node"===a&&(s=x(t,r.schema)),"mark"===a&&(i=R(t,r.schema));let c=!1;return n.selection.ranges.forEach(t=>{const a=t.$from.pos,d=t.$to.pos;let l,u,p,h;n.selection.empty?r.doc.nodesBetween(a,d,(t,e)=>{s&&s===t.type&&(c=!0,p=Math.max(e,a),h=Math.min(e+t.nodeSize,d),l=e,u=t)}):r.doc.nodesBetween(a,d,(t,r)=>{r<a&&s&&s===t.type&&(c=!0,p=Math.max(r,a),h=Math.min(r+t.nodeSize,d),l=r,u=t),r>=a&&r<=d&&(s&&s===t.type&&(c=!0,o&&n.setNodeMarkup(r,void 0,{...t.attrs,...e})),i&&t.marks.length&&t.marks.forEach(s=>{if(i===s.type&&(c=!0,o)){const o=Math.max(r,a),c=Math.min(r+t.nodeSize,d);n.addMark(o,c,i.create({...s.attrs,...e}))}}))}),u&&(void 0!==l&&o&&n.setNodeMarkup(l,void 0,{...u.attrs,...e}),i&&u.marks.length&&u.marks.forEach(t=>{i===t.type&&o&&n.addMark(p,h,i.create({...t.attrs,...e}))}))}),c},Ce=(t,e={})=>({state:n,dispatch:r})=>{const s=x(t,n.schema);return(0,o.Im)(s,e)(n,r)},Oe=(t,e={})=>({state:n,dispatch:r})=>{const o=x(t,n.schema);return(0,a.Sd)(o,e)(n,r)},Te=class{constructor(t){var e;this.find=t.find,this.handler=t.handler,this.undoable=null==(e=t.undoable)||e}};function ze(t){var e;const{editor:n,from:r,to:o,text:s,rules:i,plugin:a}=t,{view:c}=n;if(c.composing)return!1;const d=c.state.doc.resolve(r);
1if(d.parent.type.spec.code||(null==(e=d.nodeBefore||d.nodeAfter)?void 0:e.marks.find(t=>t.type.spec.code)))return!1;let l=!1;const h=((t,e=500)=>{let n="";const r=t.parentOffset;return t.parent.nodesBetween(Math.max(0,r-e),r,(t,e,o,s)=>{var i,a;const c=(null==(a=(i=t.type.spec).toText)?void 0:a.call(i,{node:t,pos:e,parent:o,index:s}))||t.textContent||"%leaf%";n+=t.isAtom&&!t.isText?c:c.slice(0,Math.max(0,r-e))}),n})(d)+s;return i.forEach(t=>{if(l)return;const e=((t,e)=>{if(C(e))return e.exec(t);const n=e(t);if(!n)return null;const r=[n.text];return r.index=n.index,r.input=t,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})(h,t.find);if(!e)return;const i=c.state.tr,d=u({state:c.state,transaction:i}),m={from:r-(e[0].length-s.length),to:o},{commands:f,chain:g,can:y}=new p({editor:n,state:d});null!==t.handler({state:d,range:m,match:e,commands:f,chain:g,can:y})&&i.steps.length&&(t.undoable&&i.setMeta(a,{transform:i,from:r,to:o,text:s}),c.dispatch(i),l=!0)}),l}function Ae(t){return"Object"===function(t){return Object.prototype.toString.call(t).slice(8,-1)}(t)&&(t.constructor===Object&&Object.getPrototypeOf(t)===Object.prototype)}function Re(t,e){const n={...t};return Ae(t)&&Ae(e)&&Object.keys(e).forEach(r=>{Ae(e[r])&&Ae(t[r])?n[r]=Re(t[r],e[r]):n[r]=e[r]}),n}var Ne=class{constructor(t={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...t},this.name=this.config.name}get options(){return{...At(Ct(this,"addOptions",{name:this.name}))||{}}}get storage(){return{...At(Ct(this,"addStorage",{name:this.name,options:this.options}))||{}}}configure(t={}){const e=this.extend({...this.config,addOptions:()=>Re(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){const e=new this.constructor({...this.config,...t});return e.parent=this,this.child=e,e.name="name"in t?t.name:e.parent.name,e}},je=class t extends Ne{constructor(){super(...arguments),this.type="mark"}static create(e={}){const n="function"==typeof e?e():e;return new t(n)}static handleExit({editor:t,mark:e}){const{tr:n}=t.state,r=t.state.selection.$from;if(r.pos===r.end()){const o=r.marks();if(!!!o.find(t=>(null==t?void 0:t.type.name)===e.name))return!1;const s=o.find(t=>(null==t?void 0:t.type.name)===e.name);return s&&n.removeStoredMark(s),n.insertText(" ",r.pos),t.view.dispatch(n),!0}return!1}configure(t){return super.configure(t)}extend(t){const e="function"==typeof t?t():t;return super.extend(e)}};var Ie=class{constructor(t){this.find=t.find,this.handler=t.handler}};function Pe(t){const{editor:e,state:n,from:r,to:o,rule:s,pasteEvent:i,dropEvent:a}=t,{commands:c,chain:d,can:l}=new p({editor:e,state:n}),u=[];n.doc.nodesBetween(r,o,(t,e)=>{var p,h,m,f,g;if((null==(h=null==(p=t.type)?void 0:p.spec)?void 0:h.code)||!(t.isText||t.isTextblock||t.isInline))return;const y=null!=(g=null!=(f=null==(m=t.content)?void 0:m.size)?f:t.nodeSize)?g:0,v=Math.max(r,e),k=Math.min(o,e+y);if(v>=k)return;((t,e,n)=>{if(C(e))return[...t.matchAll(e)];const r=e(t,n);return r?r.map(e=>{const n=[e.text];return n.index=e.index,n.input=t,n.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),n.push(e.replaceWith)),n}):[]})(t.isText?t.text||"":t.textBetween(v-e,k-e,void 0,""),s.find,i).forEach(t=>{if(void 0===t.index)return;const e=v+t.index+1,r=e+t[0].length,o={from:n.tr.mapping.map(e),to:n.tr.mapping.map(r)},p=s.handler({state:n,range:o,match:t,commands:c,chain:d,can:l,pasteEvent:i,dropEvent:a});u.push(p)})});return u.every(t=>null!==t)}var Le=null;function He(t){const{editor:e,rules:n}=t;let r,o=null,a=!1,c=!1,d="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null;try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}const l=({state:t,from:n,to:o,rule:s,pasteEvt:i})=>{const a=t.tr,c=u({state:t,transaction:a});if(Pe({editor:e,state:c,from:Math.max(n-1,0),to:o.b-1,rule:s,pasteEvent:i,dropEvent:r})&&a.steps.length){try{r="undefined"!=typeof DragEvent?new DragEvent("drop"):null}catch{r=null}return d="undefined"!=typeof ClipboardEvent?new ClipboardEvent("paste"):null,a}};return n.map(t=>new s.k_({view(t){const n=n=>{var r;o=(null==(r=t.dom.parentElement)?void 0:r.contains(n.target))?t.dom.parentElement:null,o&&(Le=e)},r=()=>{Le&&(Le=null)};return window.addEventListener("dragstart",n),window.addEventListener("dragend",r),{destroy(){window.removeEventListener("dragstart",n),window.removeEventListener("dragend",r)}}},props:{handleDOMEvents:{drop:(t,e)=>{if(c=o===t.dom.parentElement,r=e,!c){const t=Le;(null==t?void 0:t.isEditable)&&setTimeout(()=>{const e=t.state.selection;e&&t.commands.deleteRange({from:e.from,to:e.to})},10)}return!1},paste:(t,e)=>{var n;const r=null==(n=e.clipboardData)?void 0:n.getData("text/html");return d=e,a=!!(null==r?void 0:r.includes("data-pm-slice")),!1}}},appendTransaction:(e,n,r)=>{const o=e[0],s="paste"===o.getMeta("uiEvent")&&!a,u="drop"===o.getMeta("uiEvent")&&!c,p=o.getMeta("applyPasteRules"),h=!!p;if(!s&&!u&&!h)return;if(h){let{text:e}=p;"string"==typeof e||(e=Tt(i.FK.from(e),r.schema));const{from:n}=p,o=n+e.length,s=(t=>{var e;const n=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return null==(e=n.clipboardData)||e.setData("text/html",t),n})(e);return l({rule:t,state:r,from:n,to:{b:o},pasteEvt:s})}
1const m=n.doc.content.findDiffStart(r.doc.content),f=n.doc.content.findDiffEnd(r.doc.content);return"number"==typeof m&&f&&m!==f.b?l({rule:t,state:r,from:m,to:f,pasteEvt:d}):void 0}}))}var De=class{constructor(t,e){this.splittableMarks=[],this.editor=e,this.baseExtensions=t,this.extensions=Ut(t),this.schema=Bt(this.extensions,e),this.setupExtensions()}get commands(){return this.extensions.reduce((t,e)=>{const n=Ct(e,"addCommands",{name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:this.editor,type:Xt(e.name,this.schema)});return n?{...t,...n()}:t},{})}get plugins(){const{editor:t}=this;return _t([...this.extensions].reverse()).flatMap(e=>{const n={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:Xt(e.name,this.schema)},r=[],o=Ct(e,"addKeyboardShortcuts",n);let a={};if("mark"===e.type&&Ct(e,"exitable",n)&&(a.ArrowRight=()=>je.handleExit({editor:t,mark:e})),o){const e=Object.fromEntries(Object.entries(o()).map(([e,n])=>[e,()=>n({editor:t})]));a={...a,...e}}const d=(0,c.w)(a);r.push(d);const l=Ct(e,"addInputRules",n);if(ne(e,t.options.enableInputRules)&&l){const e=l();if(e&&e.length){const n=function(t){const{editor:e,rules:n}=t,r=new s.k_({state:{init(){return null},apply(t,o,s){const a=t.getMeta(r);if(a)return a;const c=t.getMeta("applyInputRules");return!!c&&setTimeout(()=>{let{text:t}=c;"string"==typeof t||(t=Tt(i.FK.from(t),s.schema));const{from:o}=c,a=o+t.length;ze({editor:e,from:o,to:a,text:t,rules:n,plugin:r})}),t.selectionSet||t.docChanged?null:o}},props:{handleTextInput(t,o,s,i){return ze({editor:e,from:o,to:s,text:i,rules:n,plugin:r})},handleDOMEvents:{compositionend:t=>(setTimeout(()=>{const{$cursor:o}=t.state.selection;o&&ze({editor:e,from:o.pos,to:o.pos,text:"",rules:n,plugin:r})}),!1)},handleKeyDown(t,o){if("Enter"!==o.key)return!1;const{$cursor:s}=t.state.selection;return!!s&&ze({editor:e,from:s.pos,to:s.pos,text:"\n",rules:n,plugin:r})}},isInputRules:!0});return r}({editor:t,rules:e}),o=Array.isArray(n)?n:[n];r.push(...o)}}const u=Ct(e,"addPasteRules",n);if(ne(e,t.options.enablePasteRules)&&u){const e=u();if(e&&e.length){const n=He({editor:t,rules:e});r.push(...n)}}const p=Ct(e,"addProseMirrorPlugins",n);if(p){const t=p();r.push(...t)}return r})}get attributes(){return Nt(this.extensions)}get nodeViews(){const{editor:t}=this,{nodeExtensions:e}=Rt(this.extensions);return Object.fromEntries(e.filter(t=>!!Ct(t,"addNodeView")).map(e=>{const n=this.attributes.filter(t=>t.type===e.name),r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:x(e.name,this.schema)},o=Ct(e,"addNodeView",r);if(!o)return[];const s=o();if(!s)return[];return[e.name,(r,o,i,a,c)=>{const d=Pt(r,n);return s({node:r,view:o,getPos:i,decorations:a,innerDecorations:c,editor:t,extension:e,HTMLAttributes:d})}]}))}dispatchTransaction(t){const{editor:e}=this;return _t([...this.extensions].reverse()).reduceRight((t,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Xt(n.name,this.schema)},o=Ct(n,"dispatchTransaction",r);return o?e=>{o.call(r,{transaction:e,next:t})}:t},t)}transformPastedHTML(t){const{editor:e}=this;return _t([...this.extensions]).reduce((t,n)=>{const r={name:n.name,options:n.options,storage:this.editor.extensionStorage[n.name],editor:e,type:Xt(n.name,this.schema)},o=Ct(n,"transformPastedHTML",r);return o?(e,n)=>{const s=t(e,n);return o.call(r,s)}:t},t||(t=>t))}get markViews(){const{editor:t}=this,{markExtensions:e}=Rt(this.extensions);return Object.fromEntries(e.filter(t=>!!Ct(t,"addMarkView")).map(e=>{const n=this.attributes.filter(t=>t.type===e.name),r={name:e.name,options:e.options,storage:this.editor.extensionStorage[e.name],editor:t,type:R(e.name,this.schema)},o=Ct(e,"addMarkView",r);if(!o)return[];return[e.name,(r,s,i)=>{const a=Pt(r,n);return o()({mark:r,view:s,inline:i,editor:t,extension:e,HTMLAttributes:a,updateAttributes:e=>{fn(r,t,e)}})}]}))}setupExtensions(){const t=this.extensions;this.editor.extensionStorage=Object.fromEntries(t.map(t=>[t.name,t.storage])),t.forEach(t=>{var e;const n={name:t.name,options:t.options,storage:this.editor.extensionStorage[t.name],editor:this.editor,type:Xt(t.name,this.schema)};if("mark"===t.type){(null==(e=At(Ct(t,"keepOnSplit",n)))||e)&&this.splittableMarks.push(t.name)}const r=Ct(t,"onBeforeCreate",n),o=Ct(t,"onCreate",n),s=Ct(t,"onUpdate",n),i=Ct(t,"onSelectionUpdate",n),a=Ct(t,"onTransaction",n),c=Ct(t,"onFocus",n),d=Ct(t,"onBlur",n),l=Ct(t,"onDestroy",n);r&&this.editor.on("beforeCreate",r),o&&this.editor.on("create",o),s&&this.editor.on("update",s),i&&this.editor.on("selectionUpdate",i),a&&this.editor.on("transaction",a),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),l&&this.editor.on("destroy",l)})}};De.resolve=Ut,De.sort=_t,De.flatten=Ot;l({}
1,{ClipboardTextSerializer:()=>_e,Commands:()=>Ue,Delete:()=>We,Drop:()=>Ke,Editable:()=>Fe,FocusEvents:()=>Ye,Keymap:()=>qe,Paste:()=>Je,Tabindex:()=>Xe,TextDirection:()=>Ze,focusEventsPluginKey:()=>Ve});var Be=class t extends Ne{constructor(){super(...arguments),this.type="extension"}static create(e={}){const n="function"==typeof e?e():e;return new t(n)}configure(t){return super.configure(t)}extend(t){const e="function"==typeof t?t():t;return super.extend(e)}},_e=Be.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new s.k_({key:new s.hs("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:t}=this,{state:e,schema:n}=t,{doc:r,selection:o}=e,{ranges:s}=o,i=Math.min(...s.map(t=>t.$from.pos)),a=Math.max(...s.map(t=>t.$to.pos)),c=Kt(n);return Wt(r,{from:i,to:a},{...void 0!==this.options.blockSeparator?{blockSeparator:this.options.blockSeparator}:{},textSerializers:c})}}})]}}),Ue=Be.create({name:"commands",addCommands(){return{...h}}}),We=Be.create({name:"delete",onUpdate({transaction:t,appendedTransactions:e}){var n,o,s;const i=()=>{var n,o,s,i;if(null!=(i=null==(s=null==(o=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:o.filterTransaction)?void 0:s.call(o,t))?i:t.getMeta("y-sync$"))return;const a=xt(t.before,[t,...e]);Yt(a).forEach(e=>{a.mapping.mapResult(e.oldRange.from).deletedAfter&&a.mapping.mapResult(e.oldRange.to).deletedBefore&&a.before.nodesBetween(e.oldRange.from,e.oldRange.to,(n,r)=>{const o=r+n.nodeSize-2,s=e.oldRange.from<=r&&o<=e.oldRange.to;this.editor.emit("delete",{type:"node",node:n,from:r,to:o,newFrom:a.mapping.map(r),newTo:a.mapping.map(o),deletedRange:e.oldRange,newRange:e.newRange,partial:!s,editor:this.editor,transaction:t,combinedTransform:a})})});const c=a.mapping;a.steps.forEach((e,n)=>{var o,s;if(e instanceof r.Ys){const r=c.slice(n).map(e.from,-1),i=c.slice(n).map(e.to),d=c.invert().map(r,-1),l=c.invert().map(i),u=r>0&&(null==(o=a.doc.nodeAt(r-1))?void 0:o.marks.some(t=>t.eq(e.mark))),p=null==(s=a.doc.nodeAt(i))?void 0:s.marks.some(t=>t.eq(e.mark));this.editor.emit("delete",{type:"mark",mark:e.mark,from:e.from,to:e.to,deletedRange:{from:d,to:l},newRange:{from:r,to:i},partial:Boolean(p||u),editor:this.editor,transaction:t,combinedTransform:a})}})};null==(s=null==(o=null==(n=this.editor.options.coreExtensionOptions)?void 0:n.delete)?void 0:o.async)||s?setTimeout(i,0):i()}}),Ke=Be.create({name:"drop",addProseMirrorPlugins(){return[new s.k_({key:new s.hs("tiptapDrop"),props:{handleDrop:(t,e,n,r)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:n,moved:r})}}})]}}),Fe=Be.create({name:"editable",addProseMirrorPlugins(){return[new s.k_({key:new s.hs("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Ve=new s.hs("focusEvents"),Ye=Be.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:t}=this;return[new s.k_({key:Ve,props:{handleDOMEvents:{focus:(e,n)=>{t.isFocused=!0;const r=t.state.tr.setMeta("focus",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1},blur:(e,n)=>{t.isFocused=!1;const r=t.state.tr.setMeta("blur",{event:n}).setMeta("addToHistory",!1);return e.dispatch(r),!1}}}})]}}),qe=Be.create({name:"keymap",addKeyboardShortcuts(){const t=()=>this.editor.commands.first(({commands:t})=>[()=>t.undoInputRule(),()=>t.command(({tr:e})=>{const{selection:n,doc:r}=e,{empty:o,$anchor:i}=n,{pos:a,parent:c}=i,d=i.parent.isTextblock&&a>0?e.doc.resolve(a-1):i,l=d.parent.type.spec.isolating,u=i.pos-i.parentOffset,p=l&&1===d.parent.childCount?u===i.pos:s.LN.atStart(r).from===a;return!(!o||!c.type.isTextblock||c.textContent.length||!p||p&&"paragraph"===i.parent.type.name)&&t.clearNodes()}),()=>t.deleteSelection(),()=>t.joinBackward(),()=>t.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:t})=>[()=>t.deleteSelection(),()=>t.deleteCurrentNode(),()=>t.joinForward(),()=>t.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:t})=>[()=>t.newlineInCode(),()=>t.createParagraphNear(),()=>t.liftEmptyBlock(),()=>t.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:t,"Mod-Backspace":t,"Shift-Backspace":t,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},r={...n},o={...n,"Ctrl-h":t,"Alt-Backspace":t,"Ctrl-d":e,"Ctrl-Alt-Backspace":e,"Alt-Delete":e,"Alt-d":e,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return D()||et()?o:r},addProseMirrorPlugins(){return[new s.k_({key:new s.hs("clearDocument"),appendTransaction:(t,e,n)=>{if(t.some(t=>t.getMeta("composition")))return;const r=t.some(t=>t.docChanged)&&!e.doc.eq(n.doc),o=t.some(t=>t.getMeta("preventClearDocument"));if(!r||o)return;const{empty:i,from:a,to:c}=e.selection,d=s.LN.atStart(e.doc).from,l=s.LN.atEnd(e.doc).to;
1if(i||!(a===d&&c===l))return;if(!oe(n.doc))return;const h=n.tr,m=u({state:n,transaction:h}),{commands:f}=new p({editor:this.editor,state:m});return f.clearNodes(),h.steps.length?h:void 0}})]}}),Je=Be.create({name:"paste",addProseMirrorPlugins(){return[new s.k_({key:new s.hs("tiptapPaste"),props:{handlePaste:(t,e,n)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:n})}}})]}}),Xe=Be.create({name:"tabindex",addProseMirrorPlugins(){return[new s.k_({key:new s.hs("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}}),Ze=Be.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:t}=Rt(this.extensions);return[{types:t.filter(t=>"text"!==t.name).map(t=>t.name),attributes:{dir:{default:this.options.direction,parseHTML:t=>{const e=t.getAttribute("dir");return!e||"ltr"!==e&&"rtl"!==e&&"auto"!==e?this.options.direction:e},renderHTML:t=>t.dir?{dir:t.dir}:{}}}}]},addProseMirrorPlugins(){return[new s.k_({key:new s.hs("textDirection"),props:{attributes:()=>{const t=this.options.direction;return t?{dir:t}:{}}}})]}});function Ge(t){return new Te({find:t.find,handler:({state:e,range:n,match:r})=>{const o=At(t.getAttributes,void 0,r);if(!1===o||null===o)return null;const{tr:s}=e,i=r[r.length-1],a=r[0];if(i){const r=a.search(/\S/),c=n.from+a.indexOf(i),d=c+i.length;if(qt(n.from,n.to,e.doc).filter(e=>e.mark.type.excluded.find(n=>n===t.type&&n!==e.mark.type)).filter(t=>t.to>c).length)return null;d<n.to&&s.delete(d,n.to),c>n.from&&s.delete(n.from+r,c);const l=n.from+r+i.length;s.addMark(n.from+r,l,t.type.create(o||{})),s.removeStoredMark(t.type)}},undoable:t.undoable})}function Qe(t){return new Te({find:t.find,handler:({state:e,range:n,match:r})=>{const o=At(t.getAttributes,void 0,r)||{},{tr:s}=e,i=n.from;let a=n.to;const c=t.type.create(o);if(r[1]){let t=i+r[0].lastIndexOf(r[1]);t>a?t=a:a=t+r[1].length;const e=r[0][r[0].length-1];s.insertText(e,i+r[0].length-1),s.replaceWith(t,a,c)}else if(r[0]){const e=t.type.isInline?i:i-1;s.insert(e,t.type.create(o)).delete(s.mapping.map(i),s.mapping.map(a))}s.scrollIntoView()},undoable:t.undoable})}function tn(t){return new Te({find:t.find,handler:({state:e,range:n,match:r})=>{const o=e.doc.resolve(n.from),s=At(t.getAttributes,void 0,r)||{};if(!o.node(-1).canReplaceWith(o.index(-1),o.indexAfter(-1),t.type))return null;e.tr.delete(n.from,n.to).setBlockType(n.from,n.from,t.type,s)},undoable:t.undoable})}function en(t){return new Te({find:t.find,handler:({state:e,range:n,match:o,chain:s})=>{const i=At(t.getAttributes,void 0,o)||{},a=e.tr.delete(n.from,n.to),c=a.doc.resolve(n.from).blockRange(),d=c&&(0,r.oM)(c,t.type,i);if(!d)return null;if(a.wrap(c,d),t.keepMarks&&t.editor){const{selection:n,storedMarks:r}=e,{splittableMarks:o}=t.editor.extensionManager,s=r||n.$to.parentOffset&&n.$from.marks();if(s){const t=s.filter(t=>o.includes(t.type.name));a.ensureMarks(t)}}if(t.keepAttributes){const e="bulletList"===t.type.name||"orderedList"===t.type.name?"listItem":"taskList";s().updateAttributes(e,i).run()}const l=a.doc.resolve(n.from-1).nodeBefore;l&&l.type===t.type&&(0,r.n9)(a.doc,n.from-1)&&(!t.joinPredicate||t.joinPredicate(o,l))&&a.join(n.from-1)},undoable:t.undoable})}var nn=class{constructor(t){var e,n,r,o,s,i;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=t=>{if(!this.isResizing||!this.activeHandle)return;const e=t.clientX-this.startX,n=t.clientY-this.startY;this.handleResize(e,n)},this.handleTouchMove=t=>{if(!this.isResizing||!this.activeHandle)return;const e=t.touches[0];if(!e)return;const n=e.clientX-this.startX,r=e.clientY-this.startY;this.handleResize(n,r)},this.handleMouseUp=()=>
1{if(!this.isResizing)return;const t=this.element.offsetWidth,e=this.element.offsetHeight;this.onCommit(t,e),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=t=>{"Shift"===t.key&&(this.isShiftKeyPressed=!0)},this.handleKeyUp=t=>{"Shift"===t.key&&(this.isShiftKeyPressed=!1)},this.node=t.node,this.editor=t.editor,this.element=t.element,this.contentElement=t.contentElement,this.getPos=t.getPos,this.onResize=t.onResize,this.onCommit=t.onCommit,this.onUpdate=t.onUpdate,(null==(e=t.options)?void 0:e.min)&&(this.minSize={...this.minSize,...t.options.min}),(null==(n=t.options)?void 0:n.max)&&(this.maxSize=t.options.max),(null==(r=null==t?void 0:t.options)?void 0:r.directions)&&(this.directions=t.options.directions),(null==(o=t.options)?void 0:o.preserveAspectRatio)&&(this.preserveAspectRatio=t.options.preserveAspectRatio),(null==(s=t.options)?void 0:s.className)&&(this.classNames={container:t.options.className.container||"",wrapper:t.options.className.wrapper||"",handle:t.options.className.handle||"",resizing:t.options.className.resizing||""}),(null==(i=t.options)?void 0:i.createCustomHandle)&&(this.createCustomHandle=t.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 t;return null!=(t=this.contentElement)?t:null}handleEditorUpdate(){const t=this.editor.isEditable;t!==this.lastEditableState&&(this.lastEditableState=t,t?t&&0===this.handleMap.size&&this.attachHandles():this.removeHandles())}update(t,e,n){return t.type===this.node.type&&(this.node=t,!this.onUpdate||this.onUpdate(t,e,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 t=document.createElement("div");return t.dataset.resizeContainer="",t.dataset.node=this.node.type.name,t.style.display=this.node.type.isInline?"inline-flex":"flex",this.classNames.container&&(t.className=this.classNames.container),t.appendChild(this.wrapper),t}createWrapper(){const t=document.createElement("div");return t.style.position="relative",t.style.display="block",t.dataset.resizeWrapper="",this.classNames.wrapper&&(t.className=this.classNames.wrapper),t.appendChild(this.element),t}createHandle(t){const e=document.createElement("div");return e.dataset.resizeHandle=t,e.style.position="absolute",this.classNames.handle&&(e.className=this.classNames.handle),e}positionHandle(t,e){const n=e.includes("top"),r=e.includes("bottom"),o=e.includes("left"),s=e.includes("right");n&&(t.style.top="0"),r&&(t.style.bottom="0"),o&&(t.style.left="0"),s&&(t.style.right="0"),"top"!==e&&"bottom"!==e||(t.style.left="0",t.style.right="0"),"left"!==e&&"right"!==e||(t.style.top="0",t.style.bottom="0")}attachHandles(){this.directions.forEach(t=>{let e;e=this.createCustomHandle?this.createCustomHandle(t):this.createHandle(t),e instanceof HTMLElement||(console.warn(`[ResizableNodeView] createCustomHandle("${t}") did not return an HTMLElement. Falling back to default handle.`),e=this.createHandle(t)),this.createCustomHandle||this.positionHandle(e,t),e.addEventListener("mousedown",e=>this.handleResizeStart(e,t)),e.addEventListener("touchstart",e=>this.handleResizeStart(e,t)),this.handleMap.set(t,e),this.wrapper.appendChild(e)})}
1removeHandles(){this.handleMap.forEach(t=>t.remove()),this.handleMap.clear()}applyInitialSize(){const t=this.node.attrs.width,e=this.node.attrs.height;t?(this.element.style.width=`${t}px`,this.initialWidth=t):this.initialWidth=this.element.offsetWidth,e?(this.element.style.height=`${e}px`,this.initialHeight=e):this.initialHeight=this.element.offsetHeight,this.initialWidth>0&&this.initialHeight>0&&(this.aspectRatio=this.initialWidth/this.initialHeight)}handleResizeStart(t,e){t.preventDefault(),t.stopPropagation(),this.isResizing=!0,this.activeHandle=e,"touches"in t?(this.startX=t.touches[0].clientX,this.startY=t.touches[0].clientY):(this.startX=t.clientX,this.startY=t.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(t,e){if(!this.activeHandle)return;const n=this.preserveAspectRatio||this.isShiftKeyPressed,{width:r,height:o}=this.calculateNewDimensions(this.activeHandle,t,e),s=this.applyConstraints(r,o,n);this.element.style.width=`${s.width}px`,this.element.style.height=`${s.height}px`,this.onResize&&this.onResize(s.width,s.height)}calculateNewDimensions(t,e,n){let r=this.startWidth,o=this.startHeight;const s=t.includes("right"),i=t.includes("left"),a=t.includes("bottom"),c=t.includes("top");s?r=this.startWidth+e:i&&(r=this.startWidth-e),a?o=this.startHeight+n:c&&(o=this.startHeight-n),"right"!==t&&"left"!==t||(r=this.startWidth+(s?e:-e)),"top"!==t&&"bottom"!==t||(o=this.startHeight+(a?n:-n));return this.preserveAspectRatio||this.isShiftKeyPressed?this.applyAspectRatio(r,o,t):{width:r,height:o}}applyConstraints(t,e,n){var r,o,s,i;if(!n){let n=Math.max(this.minSize.width,t),s=Math.max(this.minSize.height,e);return(null==(r=this.maxSize)?void 0:r.width)&&(n=Math.min(this.maxSize.width,n)),(null==(o=this.maxSize)?void 0:o.height)&&(s=Math.min(this.maxSize.height,s)),{width:n,height:s}}let a=t,c=e;return a<this.minSize.width&&(a=this.minSize.width,c=a/this.aspectRatio),c<this.minSize.height&&(c=this.minSize.height,a=c*this.aspectRatio),(null==(s=this.maxSize)?void 0:s.width)&&a>this.maxSize.width&&(a=this.maxSize.width,c=a/this.aspectRatio),(null==(i=this.maxSize)?void 0:i.height)&&c>this.maxSize.height&&(c=this.maxSize.height,a=c*this.aspectRatio),{width:a,height:c}}applyAspectRatio(t,e,n){const r="top"===n||"bottom"===n;return"left"===n||"right"===n?{width:t,height:t/this.aspectRatio}:r?{width:e*this.aspectRatio,height:e}:{width:t,height:t/this.aspectRatio}}};function rn(t,e){const{selection:n}=t,{$from:r}=n;if(n instanceof s.nh){const t=r.index();return r.parent.canReplaceWith(t,t+1,e)}let o=r.depth;for(;o>=0;){const t=r.index(o);if(r.node(o).contentMatchAt(t).matchType(e))return!0;o-=1}return!1}function on(t){return t.replace(/[-/\\^$*+?.()|[\]{}]/g,"\\$&")}function sn(t){if(!(null==t?void 0:t.trim()))return{};const e={},n=[],r=t.replace(/["']([^"']*)["']/g,t=>(n.push(t),`__QUOTED_${n.length-1}__`)),o=r.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(o){const t=o.map(t=>t.trim().slice(1));e.class=t.join(" ")}const s=r.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);Array.from(r.matchAll(/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g)).forEach(([,t,r])=>{var o;const s=parseInt((null==(o=r.match(/__QUOTED_(\d+)__/))?void 0:o[1])||"0",10),i=n[s];i&&(e[t]=i.slice(1,-1))});const i=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();if(i){i.split(/\s+/).filter(Boolean).forEach(t=>
1{t.match(/^[a-zA-Z][\w-]*$/)&&(e[t]=!0)})}return e}function an(t){if(!t||0===Object.keys(t).length)return"";const e=[];if(t.class){String(t.class).split(/\s+/).filter(Boolean).forEach(t=>e.push(`.${t}`))}return t.id&&e.push(`#${t.id}`),Object.entries(t).forEach(([t,n])=>{"class"!==t&&"id"!==t&&(!0===n?e.push(t):!1!==n&&null!=n&&e.push(`${t}="${String(n)}"`))}),e.join(" ")}function cn(t){const{nodeName:e,name:n,parseAttributes:r=sn,serializeAttributes:o=an,defaultAttributes:s={},requiredAttributes:i=[],allowedAttributes:a}=t,c=n||e;return{parseMarkdown:(t,n)=>{const r={...s,...t.attributes};return n.createNode(e,r,[])},markdownTokenizer:{name:e,level:"block",start(t){var e;const n=new RegExp(`^:::${c}(?:\\s|$)`,"m"),r=null==(e=t.match(n))?void 0:e.index;return void 0!==r?r:-1},tokenize(t,n,o){const s=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),a=t.match(s);if(!a)return;const d=a[1]||"",l=r(d);return i.find(t=>!(t in l))?void 0:{type:e,raw:a[0],attributes:l}}},renderMarkdown:t=>{const e=(t=>{if(!a)return t;const e={};return a.forEach(n=>{n in t&&(e[n]=t[n])}),e})(t.attrs||{}),n=o(e);return`:::${c}${n?` {${n}}`:""} :::`}}}function dn(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=sn,serializeAttributes:s=an,defaultAttributes:i={},content:a="block",allowedAttributes:c}=t,d=n||e;return{parseMarkdown:(t,n)=>{let o;if(r){const e=r(t);o="string"==typeof e?[{type:"text",text:e}]:e}else o="block"===a?n.parseChildren(t.tokens||[]):n.parseInline(t.tokens||[]);const s={...i,...t.attributes};return n.createNode(e,s,o)},markdownTokenizer:{name:e,level:"block",start(t){var e;const n=new RegExp(`^:::${d}`,"m"),r=null==(e=t.match(n))?void 0:e.index;return void 0!==r?r:-1},tokenize(t,n,r){var s;const i=new RegExp(`^:::${d}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),c=t.match(i);if(!c)return;const[l,u=""]=c,p=o(u);let h=1;const m=l.length;let f="";const g=/^:::([\w-]*)(\s.*)?/gm,y=t.slice(m);for(g.lastIndex=0;;){const n=g.exec(y);if(null===n)break;const o=n.index,i=n[1];if(!(null==(s=n[2])?void 0:s.endsWith(":::")))if(i)h+=1;else if(h-=1,0===h){const s=y.slice(0,o);f=s.trim();const i=t.slice(0,m+o+n[0].length);let c=[];if(f)if("block"===a)for(c=r.blockTokens(s),c.forEach(t=>{!t.text||t.tokens&&0!==t.tokens.length||(t.tokens=r.inlineTokens(t.text))});c.length>0;){const t=c[c.length-1];if("paragraph"!==t.type||t.text&&""!==t.text.trim())break;c.pop()}else c=r.inlineTokens(f);return{type:e,raw:i,attributes:p,content:f,tokens:c}}}}},renderMarkdown:(t,e)=>{const n=(t=>{if(!c)return t;const e={};return c.forEach(n=>{n in t&&(e[n]=t[n])}),e})(t.attrs||{}),r=s(n),o=r?` {${r}}`:"",i=e.renderChildren(t.content||[],"\n\n");return`:::${d}${o}\n\n${i}\n\n:::`}}}function ln(t){if(!t.trim())return{};const e={},n=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let r=n.exec(t);for(;null!==r;){const[,o,s,i]=r;e[o]=s||i,r=n.exec(t)}return e}function un(t){return Object.entries(t).filter(([,t])=>null!=t).map(([t,e])=>`${t}="${e}"`).join(" ")}function pn(t){const{nodeName:e,name:n,getContent:r,parseAttributes:o=ln,serializeAttributes:s=un,defaultAttributes:i={},selfClosing:a=!1,allowedAttributes:c}=t,d=n||e,l=d.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(t,n)=>{const o={...i,...t.attributes};if(a)return n.createNode(e,o);const s=r?r(t):t.content||"";return s?n.createNode(e,o,[n.createTextNode(s)]):n.createNode(e,o,[])},markdownTokenizer:{name:e,level:"inline",start(t){const e=a?new RegExp(`\\[${l}\\s*[^\\]]*\\]`):new RegExp(`\\[${l}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${l}\\]`),n=t.match(e),r=null==n?void 0:n.index;return void 0!==r?r:-1},tokenize(t,n,r){const s=a?new RegExp(`^\\[${l}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${l}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${l}\\]`),i=t.match(s);if(!i)return;let c="",d="";if(a){const[,t]=i;d=t}else{const[,t,e]=i;d=t,c=e||""}const u=o(d.trim());return{type:e,raw:i[0],content:c.trim(),attributes:u}}},renderMarkdown:t=>{let e="";r?e=r(t):t.content&&t.content.length>0&&(e=t.content.filter(t=>"text"===t.type).map(t=>t.text).join(""));const n=(t=>{if(!c)return t;const e={};return c.forEach(n=>{const r="string"==typeof n?n:n.name,o="string"==typeof n?void 0:n.skipIfDefault;if(r in t){const n=t[r];
1if(void 0!==o&&n===o)return;e[r]=n}}),e})(t.attrs||{}),o=s(n),i=o?` ${o}`:"";return a?`[${d}${i}]`:`[${d}${i}]${e}[/${d}]`}}}function hn(t,e,n){var r,o,s,i;const a=t.split("\n"),c=[];let d="",l=0;const u=e.baseIndentSize||2;for(;l<a.length;){const t=a[l],p=t.match(e.itemPattern);if(!p){if(c.length>0)break;if(""===t.trim()){l+=1,d=`${d}${t}\n`;continue}return}const h=e.extractItemData(p),{indentLevel:m,mainContent:f}=h;d=`${d}${t}\n`;const g=[f];for(l+=1;l<a.length;){const t=a[l];if(""===t.trim()){const e=a.slice(l+1).findIndex(t=>""!==t.trim());if(-1===e)break;if(((null==(o=null==(r=a[l+1+e].match(/^(\s*)/))?void 0:r[1])?void 0:o.length)||0)>m){g.push(t),d=`${d}${t}\n`,l+=1;continue}break}if(!(((null==(i=null==(s=t.match(/^(\s*)/))?void 0:s[1])?void 0:i.length)||0)>m))break;g.push(t),d=`${d}${t}\n`,l+=1}let y;const v=g.slice(1);if(v.length>0){const t=v.map(t=>t.slice(m+u)).join("\n");t.trim()&&(y=e.customNestedParser?e.customNestedParser(t):n.blockTokens(t))}const k=e.createToken(h,y);c.push(k)}if(0!==c.length)return{items:c,raw:d}}function mn(t,e,n,r){if(!t||!Array.isArray(t.content))return"";const o="function"==typeof n?n(r):n,[s,...i]=t.content;let a=`${o}${e.renderChildren([s])}`;return i&&i.length>0&&i.forEach((t,n)=>{var r,o;const s=null!=(o=null==(r=e.renderChild)?void 0:r.call(e,t,n+1))?o:e.renderChildren([t]);if(null!=s){const n=s.split("\n").map(t=>t?e.indent(t):e.indent("")).join("\n");a+="paragraph"===t.type?`\n\n${n}`:`\n${n}`}}),a}l({},{createAtomBlockMarkdownSpec:()=>cn,createBlockMarkdownSpec:()=>dn,createInlineMarkdownSpec:()=>pn,parseAttributes:()=>sn,parseIndentedBlocks:()=>hn,renderNestedMarkdownContent:()=>mn,serializeAttributes:()=>an});function fn(t,e,n={}){const{state:r}=e,{doc:o,tr:s}=r,i=t;o.descendants((e,r)=>{const o=s.mapping.map(r),a=s.mapping.map(r)+e.nodeSize;let c=null;if(e.marks.forEach(t=>{if(t!==i)return!1;c=t}),!c)return;let d=!1;if(Object.keys(n).forEach(t=>{n[t]!==c.attrs[t]&&(d=!0)}),d){const e=t.type.create({...t.attrs,...n});s.removeMark(o,a,t.type),s.addMark(o,a,e)}}),s.docChanged&&e.view.dispatch(s)}var gn=class t extends Ne{constructor(){super(...arguments),this.type="node"}static create(e={}){const n="function"==typeof e?e():e;return new t(n)}configure(t){return super.configure(t)}extend(t){const e="function"==typeof t?t():t;return super.extend(e)}};function yn(t){return new Ie({find:t.find,handler:({state:e,range:n,match:r,pasteEvent:o})=>{const s=At(t.getAttributes,void 0,r,o);if(!1===s||null===s)return null;const{tr:i}=e,a=r[r.length-1],c=r[0];let d=n.to;if(a){const o=c.search(/\S/),l=n.from+c.indexOf(a),u=l+a.length;if(qt(n.from,n.to,e.doc).filter(e=>e.mark.type.excluded.find(n=>n===t.type&&n!==e.mark.type)).filter(t=>t.to>l).length)return null;u<n.to&&i.delete(u,n.to),l>n.from&&i.delete(n.from+o,l),d=n.from+o+a.length,i.addMark(n.from+o,d,t.type.create(s||{}));void 0!==r.index&&void 0!==r.input&&r.index+r[0].length>=r.input.length||i.removeStoredMark(t.type)}}})}}}]); 2//# sourceMappingURL=864083f9-7c66c5ee53500098f367.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.