PageSourceSearch

https://www.groupebarriere.com/_nuxt/CMbfi7gw.js

js groupebarriere.com collected 2026-09-24 19:33:48 UTC 139,061 bytes, 27 lines download raw bytes

1import{d as _t,o as Ee,h as jt,s as Xn,c as xt,F as er,an as tr,u as nr,e as Ie,I as Wt,x as rr,a6 as ir,aO as sr,aZ as or,a as wt,b as lr,n as ar,y as cr,f as fr}from"./hCax0N09.js";(function(){try{var r=typeof window<"u"?window:typeof global<"u"?global:typeof globalThis<"u"?globalThis:typeof self<"u"?self:{};r.SENTRY_RELEASE={id:"c03a07569fe3dc5554dac0168074f48cb7dfa87c"},r._sentryModuleMetadata=r._sentryModuleMetadata||{},r._sentryModuleMetadata[new r.Error().stack]=(function(t){for(var n=1;n<arguments.length;n++){var i=arguments[n];if(i!=null)for(var s in i)i.hasOwnProperty(s)&&(t[s]=i[s])}return t})({},r._sentryModuleMetadata[new r.Error().stack],{"_sentryBundlerPluginAppKey:abae217d-7186-45d0-bf80-8ee1d83e48c0":!0});var e=new r.Error().stack;e&&(r._sentryDebugIds=r._sentryDebugIds||{},r._sentryDebugIds[e]="72262513-2d24-450b-a5d5-64f770948122",r._sentryDebugIdIdentifier="sentry-dbid-72262513-2d24-450b-a5d5-64f770948122")}catch{}})();const ur=_t({__name:"Node",props:{node:{type:[Object,Array],required:!0}},setup(r){return(e,t)=>{const n=Vt;return Array.isArray(r.node)?(Ee(!0),jt(er,{key:0},Xn(r.node,(i,s)=>(Ee(),xt(n,{key:s,node:i},null,8,["node"]))),128)):(Ee(),xt(tr(r.node),{key:1}))}}}),Vt=Object.assign(ur,{__name:"GlbRichTextNode"}),hr=(r,e=200)=>{const t=rr(!1),{t:n}=nr(),i=()=>{t.value=!t.value};return{richtext:Ie(()=>{const o=Wt(r);if(!o?.content)return o;const l=JSON.parse(JSON.stringify(o));let a=0,c=!1;if(l.content=l.content.map(f=>{if(f.type!=="paragraph"||!f.content)return f;const u=f.content.map(d=>d.text||"").join(""),h=e-a;return a+=u.length,u.length<=h||(c=!0,t.value)?f:h<0?{...f,attrs:{...f.attrs,class:"is-hidden"}}:{...f,content:[{type:"text",text:u.slice(0,h)},{type:"text",text:"..."},{type:"text",text:u.slice(h),marks:[{type:"styled",attrs:{class:"is-hidden"}}]}]}}),c){const f=l.content.findLast(u=>u.type==="paragraph"&&u.content&&!u.attrs?.class?.includes("is-hidden"));f&&(f.content=[...f.content,{type:"text",text:" "},{type:"button",attrs:{onClick:()=>i(),class:"GlbRichText__toggle"},content:[{type:"text",text:t.value?n("common.seeLess"):n("common.seeMore")}]}])}return l})}};function z(r){this.content=r}z.prototype={constructor:z,find:function(r){for(var e=0;e<this.content.length;e+=2)if(this.content[e]===r)return e;return-1},get:function(r){var e=this.find(r);return e==-1?void 0:this.content[e+1]},update:function(r,e,t){var n=t&&t!=r?this.remove(t):this,i=n.find(r),s=n.content.slice();return i==-1?s.push(t||r,e):(s[i+1]=e,t&&(s[i]=t)),new z(s)},remove:function(r){var e=this.find(r);if(e==-1)return this;var t=this.content.slice();return t.splice(e,2),new z(t)},addToStart:function(r,e){return new z([r,e].concat(this.remove(r).content))},addToEnd:function(r,e){var t=this.remove(r).content.slice();return t.push(r,e),new z(t)},addBefore:function(r,e,t){var n=this.remove(e),i=n.content.slice(),s=n.find(r);return i.splice(s==-1?i.length:s,0,e,t),new z(i)},forEach:function(r){for(var e=0;e<this.content.length;e+=2)r(this.content[e],this.content[e+1])},prepend:function(r){return r=z.from(r),r.size?new z(r.content.concat(this.subtract(r).content)):this},append:function(r){return r=z.from(r),r.size?new z(this.subtract(r).content.concat(r.content)):this},subtract:function(r){var e=this;r=z.from(r);for(var t=0;t<r.content.length;t+=2)e=e.remove(r.content[t]);return e},toObject:function(){var r={};return this.forEach(function(e,t){r[e]=t}),r},get size(){return this.content.length>>1}};z.from=function(r){if(r instanceof z)return r;var e=[];if(r)for(var t in r)e.push(t,r[t]);return new z(e)};function qt(r,e,t){for(let n=0;;n++){if(n==r.childCount||n==e.childCount)return r.childCount==e.childCount?null:t;let i=r.child(n),s=e.child(n);if(i==s){t+=i.nodeSize;continue}if(!i.sameMarkup(s))return t;if(i.isText&&i.text!=s.text){let o=i.text,l=s.text,a=0;for(;o[a]==l[a];a++)t++;
vendor: 4,415 bytes, line 1
1return a&&a<o.length&&a<l.length&&Kt(o.charCodeAt(a-1))&&Ht(o.charCodeAt(a))&&t--,t}if(i.content.size||s.content.size){let o=qt(i.content,s.content,t+1);if(o!=null)return o}t+=i.nodeSize}}function Ut(r,e,t,n){for(let i=r.childCount,s=e.childCount;;){if(i==0||s==0)return i==s?null:{a:t,b:n};let o=r.child(--i),l=e.child(--s),a=o.nodeSize;if(o==l){t-=a,n-=a;continue}if(!o.sameMarkup(l))return{a:t,b:n};if(o.isText&&o.text!=l.text){let c=o.text,f=l.text,u=c.length,h=f.length;for(;u>0&&h>0&&c[u-1]==f[h-1];)u--,h--,t--,n--;return u&&h&&u<c.length&&Kt(c.charCodeAt(u-1))&&Ht(c.charCodeAt(u))&&(t++,n++),{a:t,b:n}}if(o.content.size||l.content.size){let c=Ut(o.content,l.content,t-1,n-1);if(c)return c}t-=a,n-=a}}function Ht(r){return r>=56320&&r<57344}function Kt(r){return r>=55296&&r<56320}class y{constructor(e,t){if(this.content=e,this.size=t||0,t==null)for(let n=0;n<e.length;n++)this.size+=e[n].nodeSize}nodesBetween(e,t,n,i=0,s){for(let o=0,l=0;l<t;o++){let a=this.content[o],c=l+a.nodeSize;if(c>e&&n(a,i+l,s||null,o)!==!1&&a.content.size){let f=l+1;a.nodesBetween(Math.max(0,e-f),Math.min(a.content.size,t-f),n,i+f)}l=c}}descendants(e){this.nodesBetween(0,this.size,e)}textBetween(e,t,n,i){let s="",o=!0;return this.nodesBetween(e,t,(l,a)=>{let c=l.isText?l.text.slice(Math.max(e,a)-a,t-a):l.isLeaf?i?typeof i=="function"?i(l):i:l.type.spec.leafText?l.type.spec.leafText(l):"":"";l.isBlock&&(l.isLeaf&&c||l.isTextblock)&&n&&(o?o=!1:s+=n),s+=c},0),s}append(e){if(!e.size)return this;if(!this.size)return e;let t=this.lastChild,n=e.firstChild,i=this.content.slice(),s=0;for(t.isText&&t.sameMarkup(n)&&(i[i.length-1]=t.withText(t.text+n.text),s=1);s<e.content.length;s++)i.push(e.content[s]);return new y(i,this.size+e.size)}cut(e,t=this.size){if(e==0&&t==this.size)return this;let n=[],i=0;if(t>e)for(let s=0,o=0;o<t;s++){let l=this.content[s],a=o+l.nodeSize;a>e&&((o<e||a>t)&&(l.isText?l=l.cut(Math.max(0,e-o),Math.min(l.text.length,t-o)):l=l.cut(Math.max(0,e-o-1),Math.min(l.content.size,t-o-1))),n.push(l),i+=l.nodeSize),o=a}return new y(n,i)}cutByIndex(e,t){return e==t?y.empty:e==0&&t==this.content.length?this:new y(this.content.slice(e,t))}replaceChild(e,t){let n=this.content[e];if(n==t)return this;let i=this.content.slice(),s=this.size+t.nodeSize-n.nodeSize;return i[e]=t,new y(i,s)}addToStart(e){return new y([e].concat(this.content),this.size+e.nodeSize)}addToEnd(e){return new y(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 i=this.content[t];e(i,n,t),n+=i.nodeSize}}findDiffStart(e,t=0){return qt(this,e,t)}findDiffEnd(e,t=this.size,n=e.size){return Ut(this,e,t,n)}findIndex(e){if(e==0)return ve(0,e);if(e==this.size)return ve(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 i=this.child(t),s=n+i.nodeSize;if(s>=e)return s==e?ve(t+1,s):ve(t,n);n=s}}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 y.empty;if(!Array.isArray(t))throw new RangeError("Invalid input for Fragment.fromJSON");return y.fromArray(t.map(e.nodeFromJSON))}static fromArray(e){if(!e.length)return y.empty;let t,n=0;for(let i=0;i<e.length;i++){let s=e[i];n+=s.nodeSize,i&&s.isText&&e[i-1].sameMarkup(s)?(t||(t=e.slice(0,i)),t[t.length-1]=s.withText(t[t.length-1].text+s.text)):t&&t.push(s)}return new y(t||e,n)}static from(e){if(!e)return y.empty;if(e instanceof y)return e;if(Array.isArray(e))return this.fromArray(e);if(e.attrs)return new y([e],e.nodeSize);throw new RangeError("Can not convert "+e+" to a Fragment"+(e.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}}y.empty=new y([],0);const Ve={index:0,offset:0};function ve(r,e){return Ve.index=r,Ve.offset=e,Ve}function Ne(r,e){if(r===e)return!0;
vendor: 26,111 bytes, lines 1-2
1if(!(r&&typeof r=="object")||!(e&&typeof e=="object"))return!1;let t=Array.isArray(r);if(Array.isArray(e)!=t)return!1;if(t){if(r.length!=e.length)return!1;for(let n=0;n<r.length;n++)if(!Ne(r[n],e[n]))return!1}else{for(let n in r)if(!(n in e)||!Ne(r[n],e[n]))return!1;for(let n in e)if(!(n in r))return!1}return!0}let T=class Xe{constructor(e,t){this.type=e,this.attrs=t}addToSet(e){let t,n=!1;for(let i=0;i<e.length;i++){let s=e[i];if(this.eq(s))return e;if(this.type.excludes(s.type))t||(t=e.slice(0,i));else{if(s.type.excludes(this.type))return e;!n&&s.type.rank>this.type.rank&&(t||(t=e.slice(0,i)),t.push(this),n=!0),t&&t.push(s)}}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&&Ne(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 i=n.create(t.attrs);return n.checkAttrs(i.attrs),i}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)&&e.length==0)return Xe.none;if(e instanceof Xe)return[e];let t=e.slice();return t.sort((n,i)=>n.type.rank-i.type.rank),t}};T.none=[];class Re extends Error{}class w{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=Zt(this.content,e+this.openStart,t,this.openStart+1,this.openEnd+1);return n&&new w(n,this.openStart,this.openEnd)}removeBetween(e,t){return new w(Gt(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 w.empty;let n=t.openStart||0,i=t.openEnd||0;if(typeof n!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new w(y.fromJSON(e,t.content),n,i)}static maxOpen(e,t=!0){let n=0,i=0;for(let s=e.firstChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.firstChild)n++;for(let s=e.lastChild;s&&!s.isLeaf&&(t||!s.type.spec.isolating);s=s.lastChild)i++;return new w(e,n,i)}}w.empty=new w(y.empty,0,0);function Gt(r,e,t){let{index:n,offset:i}=r.findIndex(e),s=r.maybeChild(n),{index:o,offset:l}=r.findIndex(t);if(i==e||s.isText){if(l!=t&&!r.child(o).isText)throw new RangeError("Removing non-flat range");return r.cut(0,e).append(r.cut(t))}if(n!=o)throw new RangeError("Removing non-flat range");return r.replaceChild(n,s.copy(Gt(s.content,e-i-1,t-i-1)))}function Zt(r,e,t,n,i,s){let{index:o,offset:l}=r.findIndex(e),a=r.maybeChild(o);if(l==e||a.isText)return s&&n<=0&&i<=0&&!s.canReplace(o,o,t)?null:r.cut(0,e).append(t).append(r.cut(e));let c=Zt(a.content,e-l-1,t,o==0?n-1:0,o==r.childCount-1?i-1:0,a);return c&&r.replaceChild(o,a.copy(c))}function dr(r,e,t){if(t.openStart>r.depth)throw new Re("Inserted content deeper than insertion position");if(r.depth-t.openStart!=e.depth-t.openEnd)throw new Re("Inconsistent open depths");return Qt(r,e,t,0)}function Qt(r,e,t,n){let i=r.index(n),s=r.node(n);if(i==e.index(n)&&n<r.depth-t.openStart){let o=Qt(r,e,t,n+1);return s.copy(s.content.replaceChild(i,o))}else if(t.content.size)if(!t.openStart&&!t.openEnd&&r.depth==n&&e.depth==n){let o=r.parent,l=o.content;return te(o,l.cut(0,r.parentOffset).append(t.content).append(l.cut(e.parentOffset)))}else{let{start:o,end:l}=pr(t,r);return te(s,Xt(r,o,l,e,n))}else return te(s,Oe(r,e,n))}function Yt(r,e){if(!e.type.compatibleContent(r.type))throw new Re("Cannot join "+e.type.name+" onto "+r.type.name)}function et(r,e,t){let n=r.node(t);return Yt(n,e.node(t)),n}function ee(r,e){let t=e.length-1;t>=0&&r.isText&&r.sameMarkup(e[t])?e[t]=r.withText(e[t].text+r.text):e.push(r)}function pe(r,e,t,n){let i=(e||r).node(t),s=0,o=e?e.index(t):i.childCount;r&&(s=r.index(t),r.depth>t?s++:r.textOffset&&(ee(r.nodeAfter,n),s++));for(let l=s;l<o;l++)ee(i.child(l),n);e&&e.depth==t&&e.textOffset&&ee(e.nodeBefore,n)}function te(r,e){return r.type.checkContent(e),r.copy(e)}function Xt(r,e,t,n,i){let s=r.depth>i&&et(r,e,i+1),o=n.depth>i&&et(t,n,i+1),l=[];return pe(null,r,i,l),s&&o&&e.index(i)==t.index(i)?(Yt(s,o),ee(te(s,Xt(r,e,t,n,i+1)),l)):(s&&ee(te(s,Oe(r,e,i+1)),l),pe(e,t,i,l),o&&ee(te(o,Oe(t,n,i+1)),l)),pe(n,null,i,l),new y(l)}function Oe(r,e,t){let n=[];if(pe(null,r,t,n),r.depth>t){let i=et(r,e,t+1);ee(te(i,Oe(r,e,t+1)),n)}return pe(e,null,t,n),new y(n)}function pr(r,e){let t=e.depth-r.openStart,i=e.node(t).copy(r.content);for(let s=t-1;s>=0;s--)i=e.node(s).copy(y.from(i));return{start:i.resolveNoCache(r.openStart+t),end:i.resolveNoCache(i.content.size-r.openEnd-t)}}class ge{constructor(e,t,n){this.pos=e,this.path=t,this.parentOffset=n,this.depth=t.length/3-1}resolveDepth(e){return e==null?this.depth:e<0?this.depth+e:e}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(e){return this.path[this.resolveDepth(e)*3]}index(e){return this.path[this.resolveDepth(e)*3+1]}indexAfter(e){return e=this.resolveDepth(e),this.index(e)+(e==this.depth&&!this.textOffset?0:1)}start(e){return e=this.resolveDepth(e),e==0?0:this.path[e*3-1]+1}end(e){return e=this.resolveDepth(e),this.start(e)+this.node(e).content.size}before(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position before the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]}after(e){if(e=this.resolveDepth(e),!e)throw new RangeError("There is no position after the top-level node");return e==this.depth+1?this.pos:this.path[e*3-1]+this.path[e*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let e=this.parent,t=this.index(this.depth);if(t==e.childCount)return null;let n=this.pos-this.path[this.path.length-1],i=e.child(t);return n?e.child(t).cut(n):i}get nodeBefore(){let e=this.index(this.depth),t=this.pos-this.path[this.path.length-1];return t?this.parent.child(e).cut(0,t):e==0?null:this.parent.child(e-1)}posAtIndex(e,t){t=this.resolveDepth(t);let n=this.path[t*3],i=t==0?0:this.path[t*3-1]+1;for(let s=0;s<e;s++)i+=n.child(s).nodeSize;return i}marks(){let e=this.parent,t=this.index();if(e.content.size==0)return T.none;if(this.textOffset)return e.child(t).marks;let n=e.maybeChild(t-1),i=e.maybeChild(t);if(!n){let l=n;n=i,i=l}let s=n.marks;for(var o=0;o<s.length;o++)s[o].type.spec.inclusive===!1&&(!i||!s[o].isInSet(i.marks))&&(s=s[o--].removeFromSet(s));return s}marksAcross(e){let t=this.parent.maybeChild(this.index());if(!t||!t.isInline)return null;let n=t.marks,i=e.parent.maybeChild(e.index());for(var s=0;s<n.length;s++)n[s].type.spec.inclusive===!1&&(!i||!n[s].isInSet(i.marks))&&(n=n[s--].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 ze(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=[],i=0,s=t;for(let o=e;;){let{index:l,offset:a}=o.content.findIndex(s),c=s-a;if(n.push(o,l,i+a),!c||(o=o.child(l),o.isText))break;s=c-1,i+=a+1}return new ge(t,n,s)}static resolveCached(e,t){let n=kt.get(e);if(n)for(let s=0;s<n.elts.length;s++){let o=n.elts[s];if(o.pos==t)return o}else kt.set(e,n=new mr);let i=n.elts[n.i]=ge.resolve(e,t);return n.i=(n.i+1)%gr,i}}class mr{constructor(){this.elts=[],this.i=0}}const gr=12,kt=new WeakMap;class ze{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 yr=Object.create(null);class q{constructor(e,t,n,i=T.none){this.type=e,this.attrs=t,this.marks=i,this.content=n||y.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,i=0){this.content.nodesBetween(e,t,n,i,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,i){return this.content.textBetween(e,t,n,i)}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&&Ne(this.attrs,t||e.defaultAttrs||yr)&&T.sameSet(this.marks,n||T.none)}copy(e=null){return e==this.content?this:new q(this.type,this.attrs,e,this.marks)}mark(e){return e==this.marks?this:new q(this.type,this.attrs,this.content,e)}cut(e,t=this.content.size){return e==0&&t==this.content.size?this:this.copy(this.content.cut(e,t))}slice(e,t=this.content.size,n=!1){if(e==t)return w.empty;let i=this.resolve(e),s=this.resolve(t),o=n?0:i.sharedDepth(t),l=i.start(o),c=i.node(o).content.cut(i.pos-l,s.pos-l);return new w(c,i.depth-o,s.depth-o)}replace(e,t,n){return dr(this.resolve(e),this.resolve(t),n)}nodeAt(e){for(let t=this;;){let{index:n,offset:i}=t.content.findIndex(e);if(t=t.maybeChild(n),!t)return null;if(i==e||t.isText)return t;e-=i+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(e==0)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 i=this.content.child(t-1);return{node:i,index:t-1,offset:n-i.nodeSize}}resolve(e){return ge.resolveCached(this,e)}resolveNoCache(e){return ge.resolve(this,e)}rangeHasMark(e,t,n){let i=!1;return t>e&&this.nodesBetween(e,t,s=>(n.isInSet(s.marks)&&(i=!0),!i)),i}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()+")"),en(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=y.empty,i=0,s=n.childCount){let o=this.contentMatchAt(e).matchFragment(n,i,s),l=o&&o.matchFragment(this.content,t);if(!l||!l.validEnd)return!1;for(let a=i;a<s;a++)if(!this.type.allowsMarks(n.child(a).marks))return!1;return!0}canReplaceWith(e,t,n,i){if(i&&!this.type.allowsMarks(i))return!1;let s=this.contentMatchAt(e).matchType(n),o=s&&s.matchFragment(this.content,t);return o?o.validEnd:!1}canAppend(e){return e.content.size?this.canReplace(this.childCount,this.childCount,e.content):this.type.compatibleContent(e.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let e=T.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(!T.sameSet(e,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(t=>t.type.name)}`);this.content.forEach(t=>t.check())}toJSON(){let e={type:this.type.name};for(let t in this.attrs){e.attrs=this.attrs;break}return this.content.size&&(e.content=this.content.toJSON()),this.marks.length&&(e.marks=this.marks.map(t=>t.toJSON())),e}static fromJSON(e,t){if(!t)throw new RangeError("Invalid input for Node.fromJSON");let 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(t.type=="text"){if(typeof t.text!="string")throw new RangeError("Invalid text node in JSON");return e.text(t.text,n)}let i=y.fromJSON(e,t.content),s=e.nodeType(t.type).create(t.attrs,i,n);return s.type.checkAttrs(s.attrs),s}}q.prototype.text=void 0;class Be extends q{constructor(e,t,n,i){if(super(e,t,null,i),!n)throw new RangeError("Empty text nodes are not allowed");this.text=n}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):en(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 Be(this.type,this.attrs,this.text,e)}withText(e){return e==this.text?this:new Be(this.type,this.attrs,e,this.marks)}cut(e=0,t=this.text.length){return e==0&&t==this.text.length?this:this.withText(this.text.slice(e,t))}eq(e){return this.sameMarkup(e)&&this.text==e.text}toJSON(){let e=super.toJSON();return e.text=this.text,e}}function en(r,e){for(let t=r.length-1;t>=0;t--)e=r[t].type.name+"("+e+")";return e}class ne{constructor(e){this.validEnd=e,this.next=[],this.wrapCache=[]}static parse(e,t){let n=new xr(e,t);if(n.next==null)return ne.empty;let i=tn(n);n.next&&n.err("Unexpected trailing text");let s=Mr(Cr(i));return Er(s,n),s}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 i=this;for(let s=t;i&&s<n;s++)i=i.matchType(e.child(s).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let e=0;e<this.next.length;e++){let{type:t}=this.next[e];if(!(t.isText||t.hasRequiredAttrs()))return t}return null}compatible(e){for(let t=0;t<this.next.length;t++)for(let 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 i=[this];function s(o,l){let a=o.matchFragment(e,n);if(a&&(!t||a.validEnd))return y.from(l.map(c=>c.createAndFill()));for(let c=0;c<o.next.length;c++){let{type:f,next:u}=o.next[c];if(!(f.isText||f.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=s(u,l.concat(f));if(h)return h}}return null}return s(this,[])}findWrapping(e){for(let n=0;n<this.wrapCache.length;n+=2)if(this.wrapCache[n]==e)return this.wrapCache[n+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 i=n.shift(),s=i.match;if(s.matchType(e)){let o=[];for(let l=i;l.type;l=l.via)o.push(l.type);return o.reverse()}for(let o=0;o<s.next.length;o++){let{type:l,next:a}=s.next[o];!l.isLeaf&&!l.hasRequiredAttrs()&&!(l.name in t)&&(!i.type||a.validEnd)&&(n.push({match:l.contentMatch,type:l,via:i}),t[l.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(e){if(e>=this.next.length)throw new RangeError(`There's no ${e}th edge in this content match`);return this.next[e]}toString(){let e=[];function t(n){e.push(n);for(let i=0;i<n.next.length;i++)e.indexOf(n.next[i].next)==-1&&t(n.next[i].next)}return t(this),e.map((n,i)=>{let s=i+(n.validEnd?"*":" ")+" ";for(let o=0;o<n.next.length;o++)s+=(o?", ":"")+n.next[o].type.name+"->"+e.indexOf(n.next[o].next);return s}).join(`
2`)}}ne.empty=new ne(!0);class xr{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 tn(r){let e=[];do e.push(wr(r));while(r.eat("|"));return e.length==1?e[0]:{type:"choice",exprs:e}}function wr(r){let e=[];do e.push(kr(r));while(r.next&&r.next!=")"&&r.next!="|");return e.length==1?e[0]:{type:"seq",exprs:e}}function kr(r){let e=Sr(r);for(;;)if(r.eat("+"))e={type:"plus",expr:e};else if(r.eat("*"))e={type:"star",expr:e};else if(r.eat("?"))e={type:"opt",expr:e};else if(r.eat("{"))e=vr(r,e);else break;return e}function vt(r){/\D/.test(r.next)&&r.err("Expected number, got '"+r.next+"'");let e=Number(r.next);return r.pos++,e}function vr(r,e){let t=vt(r),n=t;return r.eat(",")&&(r.next!="}"?n=vt(r):n=-1),r.eat("}")||r.err("Unclosed braced range"),{type:"range",min:t,max:n,expr:e}}function br(r,e){let t=r.nodeTypes,n=t[e];if(n)return[n];let i=[];for(let s in t){let o=t[s];o.isInGroup(e)&&i.push(o)}return i.length==0&&r.err("No node type or group '"+e+"' found"),i}function Sr(r){if(r.eat("(")){let e=tn(r);return r.eat(")")||r.err("Missing closing paren"),e}else if(/\W/.test(r.next))r.err("Unexpected token '"+r.next+"'");else{let e=br(r,r.next).map(t=>(r.inline==null?r.inline=t.isInline:r.inline!=t.isInline&&r.err("Mixing inline and block content"),{type:"name",value:t}));return r.pos++,e.length==1?e[0]:{type:"choice",exprs:e}}}function Cr(r){let e=[[]];return i(s(r,0),t()),e;function t(){return e.push([])-1}function n(o,l,a){let c={term:a,to:l};return e[o].push(c),c}function i(o,l){o.forEach(a=>a.to=l)}function s(o,l){if(o.type=="choice")return o.exprs.reduce((a,c)=>a.concat(s(c,l)),[]);if(o.type=="seq")for(let a=0;;a++){let c=s(o.exprs[a],l);if(a==o.exprs.length-1)return c;i(c,l=t())}else if(o.type=="star"){let a=t();return n(l,a),i(s(o.expr,a),a),[n(a)]}else if(o.type=="plus"){let a=t();return i(s(o.expr,l),a),i(s(o.expr,a),a),[n(a)]}else{if(o.type=="opt")return[n(l)].concat(s(o.expr,l));if(o.type=="range"){let a=l;for(let c=0;c<o.min;c++){let f=t();i(s(o.expr,a),f),a=f}if(o.max==-1)i(s(o.expr,a),a);else for(let c=o.min;c<o.max;c++){let f=t();n(a,f),i(s(o.expr,a),f),a=f}return[n(a)]}else{if(o.type=="name")return[n(l,void 0,o.value)];throw new Error("Unknown expr type")}}}}function nn(r,e){return e-r}function bt(r,e){let t=[];return n(e),t.sort(nn);function n(i){let s=r[i];if(s.length==1&&!s[0].term)return n(s[0].to);t.push(i);for(let o=0;o<s.length;o++){let{term:l,to:a}=s[o];!l&&t.indexOf(a)==-1&&n(a)}}}function Mr(r){let e=Object.create(null);return t(bt(r,0));function t(n){let i=[];n.forEach(o=>{r[o].forEach(({term:l,to:a})=>{if(!l)return;let c;for(let f=0;f<i.length;f++)i[f][0]==l&&(c=i[f][1]);bt(r,a).forEach(f=>{c||i.push([l,c=[]]),c.indexOf(f)==-1&&c.push(f)})})});let s=e[n.join(",")]=new ne(n.indexOf(r.length-1)>-1);for(let o=0;o<i.length;o++){let l=i[o][1].sort(nn);s.next.push({type:i[o][0],next:e[l.join(",")]||t(l)})}return s}}function Er(r,e){for(let t=0,n=[r];t<n.length;t++){let i=n[t],s=!i.validEnd,o=[];for(let l=0;l<i.next.length;l++){let{type:a,next:c}=i.next[l];o.push(a.name),s&&!(a.isText||a.hasRequiredAttrs())&&(s=!1),n.indexOf(c)==-1&&n.push(c)}s&&e.err("Only non-generatable nodes ("+o.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function rn(r){let e=Object.create(null);for(let t in r){let n=r[t];if(!n.hasDefault)return null;e[t]=n.default}return e}function sn(r,e){let t=Object.create(null);for(let n in r){let i=e&&e[n];if(i===void 0){let s=r[n];if(s.hasDefault)i=s.default;else throw new RangeError("No value supplied for attribute "+n)}t[n]=i}return t}function on(r,e,t,n){for(let i in e)if(!(i in r))throw new RangeError(`Unsupported attribute ${i} for ${t} of type ${n}`);for(let i in r)r[i].validate&&r[i].validate(e[i])}function ln(r,e){let t=Object.create(null);if(e)for(let n in e)t[n]=new Ar(r,n,e[n]);return t}class Fe{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=ln(e,n.attrs),this.defaultAttrs=rn(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(n.inline||e=="text"),this.isText=e=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==ne.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:sn(this.attrs,e)}create(e=null,t,n){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new q(this,this.computeAttrs(e),y.from(t),T.setFrom(n))}createChecked(e=null,t,n){return t=y.from(t),this.checkContent(t),new q(this,this.computeAttrs(e),t,T.setFrom(n))}createAndFill(e=null,t,n){if(e=this.computeAttrs(e),t=y.from(t),t.size){let o=this.contentMatch.fillBefore(t);if(!o)return null;t=o.append(t)}let i=this.contentMatch.matchFragment(t),s=i&&i.fillBefore(y.empty,!0);return s?new q(this,e,t.append(s),T.setFrom(n)):null}validContent(e){let t=this.contentMatch.matchFragment(e);if(!t||!t.validEnd)return!1;for(let n=0;n<e.childCount;n++)if(!this.allowsMarks(e.child(n).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){on(this.attrs,e,"node",this.name)}allowsMarkType(e){return this.markSet==null||this.markSet.indexOf(e)>-1}allowsMarks(e){if(this.markSet==null)return!0;for(let t=0;t<e.length;t++)if(!this.allowsMarkType(e[t].type))return!1;return!0}allowedMarks(e){if(this.markSet==null)return e;let t;for(let 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:T.none:e}static compile(e,t){let n=Object.create(null);e.forEach((s,o)=>n[s]=new Fe(s,t,o));let i=t.spec.topNode||"doc";if(!n[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!n.text)throw new RangeError("Every schema needs a 'text' type");for(let s in n.text.attrs)throw new RangeError("The text node type should not have attributes");return n}}function Tr(r,e,t){let n=t.split("|");return i=>{let s=i===null?"null":typeof i;if(n.indexOf(s)<0)throw new RangeError(`Expected value of type ${n} for attribute ${e} on type ${r}, got ${s}`)}}class Ar{constructor(e,t,n){this.hasDefault=Object.prototype.hasOwnProperty.call(n,"default"),this.default=n.default,this.validate=typeof n.validate=="string"?Tr(e,t,n.validate):n.validate}get isRequired(){return!this.hasDefault}}class Le{constructor(e,t,n,i){this.name=e,this.rank=t,this.schema=n,this.spec=i,this.attrs=ln(e,i.attrs),this.excluded=null;let s=rn(this.attrs);this.instance=s?new T(this,s):null}create(e=null){return!e&&this.instance?this.instance:new T(this,sn(this.attrs,e))}static compile(e,t){let n=Object.create(null),i=0;return e.forEach((s,o)=>n[s]=new Le(s,i++,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){on(this.attrs,e,"mark",this.name)}excludes(e){return this.excluded.indexOf(e)>-1}}class Ir{constructor(e){this.linebreakReplacement=null,this.cached=Object.create(null);let t=this.spec={};for(let i in e)t[i]=e[i];t.nodes=z.from(e.nodes),t.marks=z.from(e.marks||{}),this.nodes=Fe.compile(this.spec.nodes,this),this.marks=Le.compile(this.spec.marks,this);let n=Object.create(null);for(let i in this.nodes){if(i in this.marks)throw new RangeError(i+" can not be both a node and a mark");let s=this.nodes[i],o=s.spec.content||"",l=s.spec.marks;if(s.contentMatch=n[o]||(n[o]=ne.parse(o,this.nodes)),s.inlineContent=s.contentMatch.inlineContent,s.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!s.isInline||!s.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=s}s.markSet=l=="_"?null:l?St(this,l.split(" ")):l==""||!s.inlineContent?[]:null}for(let i in this.marks){let s=this.marks[i],o=s.spec.excludes;s.excluded=o==null?[s]:o==""?[]:St(this,o.split(" "))}this.nodeFromJSON=i=>q.fromJSON(this,i),this.markFromJSON=i=>T.fromJSON(this,i),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(e,t=null,n,i){if(typeof e=="string")e=this.nodeType(e);else if(e instanceof Fe){if(e.schema!=this)throw new RangeError("Node type from different schema used ("+e.name+")")}else throw new RangeError("Invalid node type: "+e);return e.createChecked(t,n,i)}text(e,t){let n=this.nodes.text;return new Be(n,n.defaultAttrs,e,T.setFrom(t))}mark(e,t){return typeof e=="string"&&(e=this.marks[e]),e.create(t)}nodeType(e){let t=this.nodes[e];if(!t)throw new RangeError("Unknown node type: "+e);return t}}function St(r,e){let t=[];for(let n=0;n<e.length;n++){let i=e[n],s=r.marks[i],o=s;if(s)t.push(s);else for(let l in r.marks){let a=r.marks[l];(i=="_"||a.spec.group&&a.spec.group.split(" ").indexOf(i)>-1)&&t.push(o=a)}if(!o)throw new SyntaxError("Unknown mark type: '"+e[n]+"'")}return t}function Nr(r){return r.tag!=null}function Rr(r){return r.style!=null}class oe{constructor(e,t){this.schema=e,this.rules=t,this.tags=[],this.styles=[];let n=this.matchedStyles=[];t.forEach(i=>
vendor: 10,338 bytes, lines 2-4
2{if(Nr(i))this.tags.push(i);else if(Rr(i)){let s=/[^=]*/.exec(i.style)[0];n.indexOf(s)<0&&n.push(s),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let s=e.nodes[i.node];return s.contentMatch.matchType(s)})}parse(e,t={}){let n=new Mt(this,t,!1);return n.addAll(e,T.none,t.from,t.to),n.finish()}parseSlice(e,t={}){let n=new Mt(this,t,!0);return n.addAll(e,T.none,t.from,t.to),w.maxOpen(n.finish())}matchTag(e,t,n){for(let i=n?this.tags.indexOf(n)+1:0;i<this.tags.length;i++){let s=this.tags[i];if(Br(e,s.tag)&&(s.namespace===void 0||e.namespaceURI==s.namespace)&&(!s.context||t.matchesContext(s.context))){if(s.getAttrs){let o=s.getAttrs(e);if(o===!1)continue;s.attrs=o||void 0}return s}}}matchStyle(e,t,n,i){for(let s=i?this.styles.indexOf(i)+1:0;s<this.styles.length;s++){let o=this.styles[s],l=o.style;if(!(l.indexOf(e)!=0||o.context&&!n.matchesContext(o.context)||l.length>e.length&&(l.charCodeAt(e.length)!=61||l.slice(e.length+1)!=t))){if(o.getAttrs){let a=o.getAttrs(t);if(a===!1)continue;o.attrs=a||void 0}return o}}}static schemaRules(e){let t=[];function n(i){let s=i.priority==null?50:i.priority,o=0;for(;o<t.length;o++){let l=t[o];if((l.priority==null?50:l.priority)<s)break}t.splice(o,0,i)}for(let i in e.marks){let s=e.marks[i].spec.parseDOM;s&&s.forEach(o=>{n(o=Et(o)),o.mark||o.ignore||o.clearMark||(o.mark=i)})}for(let i in e.nodes){let s=e.nodes[i].spec.parseDOM;s&&s.forEach(o=>{n(o=Et(o)),o.node||o.ignore||o.mark||(o.node=i)})}return t}static fromSchema(e){return e.cached.domParser||(e.cached.domParser=new oe(e,oe.schemaRules(e)))}}const an={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},Or={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},cn={ol:!0,ul:!0},ye=1,tt=2,me=4;function Ct(r,e,t){return e!=null?(e?ye:0)|(e==="full"?tt:0):r&&r.whitespace=="pre"?ye|tt:t&~me}class be{constructor(e,t,n,i,s,o){this.type=e,this.attrs=t,this.marks=n,this.solid=i,this.options=o,this.content=[],this.activeMarks=T.none,this.match=s||(o&me?null:e.contentMatch)}findWrapping(e){if(!this.match){if(!this.type)return[];let t=this.type.contentMatch.fillBefore(y.from(e));if(t)this.match=this.type.contentMatch.matchFragment(t);else{let n=this.type.contentMatch,i;return(i=n.findWrapping(e.type))?(this.match=n,i):null}}return this.match.findWrapping(e.type)}finish(e){if(!(this.options&ye)){let n=this.content[this.content.length-1],i;if(n&&n.isText&&(i=/[ \t\r\n\u000c]+$/.exec(n.text))){let s=n;n.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=s.withText(s.text.slice(0,s.text.length-i[0].length))}}let t=y.from(this.content);return!e&&this.match&&(t=t.append(this.match.fillBefore(y.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&&!an.hasOwnProperty(e.parentNode.nodeName.toLowerCase())}}class Mt{constructor(e,t,n){this.parser=e,this.options=t,this.isOpen=n,this.open=0,this.localPreserveWS=!1;let i=t.topNode,s,o=Ct(null,t.preserveWhitespace,0)|(n?me:0);i?s=new be(i.type,i.attrs,T.none,!0,t.topMatch||i.type.contentMatch,o):n?s=new be(null,null,T.none,!0,null,o):s=new be(e.schema.topNodeType,null,T.none,!0,null,o),this.nodes=[s],this.find=t.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(e,t){e.nodeType==3?this.addTextNode(e,t):e.nodeType==1&&this.addElement(e,t)}addTextNode(e,t){let n=e.nodeValue,i=this.top,s=i.options&tt?"full":this.localPreserveWS||(i.options&ye)>0,{schema:o}=this.parser;if(s==="full"||i.inlineContext(e)||/[^ \t\r\n\u000c]/.test(n)){if(s)if(s==="full")n=n.replace(/\r\n?/g,`
3`);else if(o.linebreakReplacement&&/[\r\n]/.test(n)&&this.top.findWrapping(o.linebreakReplacement.create())){let l=n.split(/\r?\n|\r/);for(let a=0;a<l.length;a++)a&&this.insertNode(o.linebreakReplacement.create(),t,!0),l[a]&&this.insertNode(o.text(l[a]),t,!/\S/.test(l[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){let l=i.content[i.content.length-1],a=e.previousSibling;(!l||a&&a.nodeName=="BR"||l.isText&&/[ \t\r\n\u000c]$/.test(l.text))&&(n=n.slice(1))}n&&this.insertNode(o.text(n),t,!/\S/.test(n)),this.findInText(e)}else this.findInside(e)}addElement(e,t,n){let i=this.localPreserveWS,s=this.top;(e.tagName=="PRE"||/pre/.test(e.style&&e.style.whiteSpace))&&(this.localPreserveWS=!0);let o=e.nodeName.toLowerCase(),l;cn.hasOwnProperty(o)&&this.parser.normalizeLists&&zr(e);let a=this.options.ruleFromNode&&this.options.ruleFromNode(e)||(l=this.parser.matchTag(e,this,n));e:if(a?a.ignore:Or.hasOwnProperty(o))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 c,f=this.needsBlock;if(an.hasOwnProperty(o))s.content.length&&s.content[0].isInline&&this.open&&(this.open--,s=this.top),c=!0,s.type||(this.needsBlock=!0);else if(!e.firstChild){this.leafFallback(e,t);break e}let u=a&&a.skip?t:this.readStyles(e,t);u&&this.addAll(e,u),c&&this.sync(s),this.needsBlock=f}else{let c=this.readStyles(e,t);c&&this.addElementByRule(e,a,c,a.consuming===!1?l:void 0)}this.localPreserveWS=i}leafFallback(e,t){e.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(e.ownerDocument.createTextNode(`
4`),t)}ignoreFallback(e,t){e.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),t,!0)}readStyles(e,t){let n=e.style;if(n&&n.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let s=this.parser.matchedStyles[i],o=n.getPropertyValue(s);if(o)for(let l=void 0;;){let a=this.parser.matchStyle(s,o,this,l);if(!a)break;if(a.ignore)return null;if(a.clearMark?t=t.filter(c=>!a.clearMark(c)):t=t.concat(this.parser.schema.marks[a.mark].create(a.attrs)),a.consuming===!1)l=a;else break}}return t}addElementByRule(e,t,n,i){let s,o;if(t.node)if(o=this.parser.schema.nodes[t.node],o.isLeaf)this.insertNode(o.create(t.attrs),n,e.nodeName=="BR")||this.leafFallback(e,n);else{let a=this.enter(o,t.attrs||null,n,t.preserveWhitespace);a&&(s=!0,n=a)}else{let a=this.parser.schema.marks[t.mark];n=n.concat(a.create(t.attrs))}let l=this.top;if(o&&o.isLeaf)this.findInside(e);else if(i)this.addElement(e,n,i);else if(t.getContent)this.findInside(e),t.getContent(e,this.parser.schema).forEach(a=>this.insertNode(a,n,!1));else{let a=e;typeof t.contentElement=="string"?a=e.querySelector(t.contentElement):typeof t.contentElement=="function"?a=t.contentElement(e):t.contentElement&&(a=t.contentElement),this.findAround(e,a,!0),this.addAll(a,n),this.findAround(e,a,!1)}s&&this.sync(l)&&this.open--}addAll(e,t,n,i){let s=n||0;for(let o=n?e.childNodes[n]:e.firstChild,l=i==null?null:e.childNodes[i];o!=l;o=o.nextSibling,++s)this.findAtPoint(e,s),this.addDOM(o,t);this.findAtPoint(e,s)}findPlace(e,t,n){let i,s;for(let o=this.open,l=0;o>=0;o--){let a=this.nodes[o],c=a.findWrapping(e);if(c&&(!i||i.length>c.length+l)&&(i=c,s=a,!c.length))break;if(a.solid){if(n)break;l+=2}}if(!i)return null;this.sync(s);for(let o=0;o<i.length;o++)t=this.enterInner(i[o],null,t,!1);return t}insertNode(e,t,n){if(e.isInline&&this.needsBlock&&!this.top.type){let s=this.textblockFromContext();s&&(t=this.enterInner(s,null,t))}let i=this.findPlace(e,t,n);if(i){this.closeExtra();let s=this.top;s.match&&(s.match=s.match.matchType(e.type));let o=T.none;for(let l of i.concat(e.marks))(s.type?s.type.allowsMarkType(l.type):Tt(l.type,e.type))&&(o=l.addToSet(o));return s.content.push(e.mark(o)),!0}return!1}enter(e,t,n,i){let s=this.findPlace(e.create(t),n,!1);return s&&(s=this.enterInner(e,t,n,!0,i)),s}enterInner(e,t,n,i=!1,s){this.closeExtra();let o=this.top;o.match=o.match&&o.match.matchType(e);let l=Ct(e,s,o.options);o.options&me&&o.content.length==0&&(l|=me);let a=T.none;return n=n.filter(c=>(o.type?o.type.allowsMarkType(c.type):Tt(c.type,e))?(a=c.addToSet(a),!1):!0),this.nodes.push(new be(e,t,a,i,null,l)),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|=ye)}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 i=n.length-1;i>=0;i--)e+=n[i].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++)this.find[t].pos==null&&e.nodeType==1&&e.contains(this.find[t].node)&&(this.find[t].pos=this.currentPos)}findAround(e,t,n){if(e!=t&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&e.nodeType==1&&e.contains(this.find[i].node)&&t.compareDocumentPosition(this.find[i].node)&(n?2:4)&&(this.find[i].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,i=!this.isOpen&&(!n||n.parent.type==this.nodes[0].type),s=-(n?n.depth+1:0)+(i?0:1),o=(l,a)=>{for(;l>=0;l--){let c=t[l];if(c==""){if(l==t.length-1||l==0)continue;for(;a>=s;a--)if(o(l-1,a))return!0;return!1}else{let f=a>0||a==0&&i?this.nodes[a].type:n&&a>=s?n.node(a-s).type:null;if(!f||f.name!=c&&!f.isInGroup(c))return!1;a--}}return!0};return o(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 t in this.parser.schema.nodes){let n=this.parser.schema.nodes[t];
vendor: 5,722 bytes, line 4
4if(n.isTextblock&&n.defaultAttrs)return n}}}function zr(r){for(let e=r.firstChild,t=null;e;e=e.nextSibling){let n=e.nodeType==1?e.nodeName.toLowerCase():null;n&&cn.hasOwnProperty(n)&&t?(t.appendChild(e),e=t):n=="li"?t=e:n&&(t=null)}}function Br(r,e){return(r.matches||r.msMatchesSelector||r.webkitMatchesSelector||r.mozMatchesSelector).call(r,e)}function Et(r){let e={};for(let t in r)e[t]=r[t];return e}function Tt(r,e){let t=e.schema.nodes;for(let n in t){let i=t[n];if(!i.allowsMarkType(r))continue;let s=[],o=l=>{s.push(l);for(let a=0;a<l.edgeCount;a++){let{type:c,next:f}=l.edge(a);if(c==e||s.indexOf(f)<0&&o(f))return!0}};if(o(i.contentMatch))return!0}}const fn=65535,un=Math.pow(2,16);function Fr(r,e){return r+e*un}function At(r){return r&fn}function Pr(r){return(r-(r&fn))/un}const hn=1,dn=2,Te=4,pn=8;class nt{constructor(e,t,n){this.pos=e,this.delInfo=t,this.recover=n}get deleted(){return(this.delInfo&pn)>0}get deletedBefore(){return(this.delInfo&(hn|Te))>0}get deletedAfter(){return(this.delInfo&(dn|Te))>0}get deletedAcross(){return(this.delInfo&Te)>0}}class L{constructor(e,t=!1){if(this.ranges=e,this.inverted=t,!e.length&&L.empty)return L.empty}recover(e){let t=0,n=At(e);if(!this.inverted)for(let i=0;i<n;i++)t+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[n*3]+t+Pr(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 i=0,s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?i:0);if(a>e)break;let c=this.ranges[l+s],f=this.ranges[l+o],u=a+c;if(e<=u){let h=c?e==a?-1:e==u?1:t:t,d=a+i+(h<0?0:f);if(n)return d;let p=e==(t<0?a:u)?null:Fr(l/3,e-a),m=e==a?dn:e==u?hn:Te;return(t<0?e!=a:e!=u)&&(m|=pn),new nt(d,m,p)}i+=f-c}return n?e+i:new nt(e+i,0,null)}touches(e,t){let n=0,i=At(t),s=this.inverted?2:1,o=this.inverted?1:2;for(let l=0;l<this.ranges.length;l+=3){let a=this.ranges[l]-(this.inverted?n:0);if(a>e)break;let c=this.ranges[l+s],f=a+c;if(e<=f&&l==i*3)return!0;n+=this.ranges[l+o]-c}return!1}forEach(e){let t=this.inverted?2:1,n=this.inverted?1:2;for(let i=0,s=0;i<this.ranges.length;i+=3){let o=this.ranges[i],l=o-(this.inverted?s:0),a=o+(this.inverted?0:s),c=this.ranges[i+t],f=this.ranges[i+n];e(l,l+c,a,a+f),s+=f-c}}invert(){return new L(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(e){return e==0?L.empty:new L(e<0?[0,-e,0]:[0,0,e])}}L.empty=new L([]);class Pe{constructor(e,t,n=0,i=e?e.length:0){this.mirror=t,this.from=n,this.to=i,this._maps=e||[],this.ownData=!(e||t)}get maps(){return this._maps}slice(e=0,t=this.maps.length){return new Pe(this._maps,this.mirror,e,t)}appendMap(e,t){this.ownData||(this._maps=this._maps.slice(),this.mirror=this.mirror&&this.mirror.slice(),this.ownData=!0),this.to=this._maps.push(e),t!=null&&this.setMirror(this._maps.length-1,t)}appendMapping(e){for(let t=0,n=this._maps.length;t<e._maps.length;t++){let i=e.getMirror(t);this.appendMap(e._maps[t],i!=null&&i<t?n+i: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 i=e.getMirror(t);this.appendMap(e._maps[t].invert(),i!=null&&i>t?n-i-1:void 0)}}invert(){let e=new Pe;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 i=0;for(let s=this.from;s<this.to;s++){let o=this._maps[s],l=o.mapResult(e,t);if(l.recover!=null){let a=this.getMirror(s);if(a!=null&&a>s&&a<this.to){s=a,e=this._maps[a].recover(l.recover);continue}}i|=l.delInfo,e=l.pos}return n?e:new nt(e,i,null)}}const qe=Object.create(null);class F{getMap(){return L.empty}merge(e){return null}static fromJSON(e,t){if(!t||!t.stepType)throw new RangeError("Invalid input for Step.fromJSON");let n=qe[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 qe)throw new RangeError("Duplicate use of step JSON ID "+e);return qe[e]=t,t.prototype.jsonID=e,t}}class I{constructor(e,t){this.doc=e,this.failed=t}static ok(e){return new I(e,null)}static fail(e){return new I(null,e)}static fromReplace(e,t,n,i){try{return I.ok(e.replace(t,n,i))}catch(s){if(s instanceof Re)return I.fail(s.message);throw s}}}function st(r,e,t){let n=[];for(let i=0;i<r.childCount;i++){let s=r.child(i);s.content.size&&(s=s.copy(st(s.content,e,s))),s.isInline&&(s=e(s,t,i)),n.push(s)}return y.fromArray(n)}class K extends F{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),i=n.node(n.sharedDepth(this.to)),s=new w(st(t.content,(o,l)=>!o.isAtom||!l.type.allowsMarkType(this.mark.type)?o:o.mark(this.mark.addToSet(o.marks)),i),t.openStart,t.openEnd);return I.fromReplace(e,this.from,this.to,s)}invert(){return new j(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 K(t.pos,n.pos,this.mark)}merge(e){return e instanceof K&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new K(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new K(t.from,t.to,e.markFromJSON(t.mark))}}F.jsonID("addMark",K);
vendor: 6,557 bytes, line 4
4class j extends F{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 w(st(t.content,i=>i.mark(this.mark.removeFromSet(i.marks)),e),t.openStart,t.openEnd);return I.fromReplace(e,this.from,this.to,n)}invert(){return new K(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 j(t.pos,n.pos,this.mark)}merge(e){return e instanceof j&&e.mark.eq(this.mark)&&this.from<=e.to&&this.to>=e.from?new j(Math.min(this.from,e.from),Math.max(this.to,e.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new j(t.from,t.to,e.markFromJSON(t.mark))}}F.jsonID("removeMark",j);class G extends F{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return I.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.addToSet(t.marks));return I.fromReplace(e,this.pos,this.pos+1,new w(y.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);if(t){let n=this.mark.addToSet(t.marks);if(n.length==t.marks.length){for(let i=0;i<t.marks.length;i++)if(!t.marks[i].isInSet(n))return new G(this.pos,t.marks[i]);return new G(this.pos,this.mark)}}return new re(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new G(t.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new G(t.pos,e.markFromJSON(t.mark))}}F.jsonID("addNodeMark",G);class re extends F{constructor(e,t){super(),this.pos=e,this.mark=t}apply(e){let t=e.nodeAt(this.pos);if(!t)return I.fail("No node at mark step's position");let n=t.type.create(t.attrs,null,this.mark.removeFromSet(t.marks));return I.fromReplace(e,this.pos,this.pos+1,new w(y.from(n),0,t.isLeaf?0:1))}invert(e){let t=e.nodeAt(this.pos);return!t||!this.mark.isInSet(t.marks)?this:new G(this.pos,this.mark)}map(e){let t=e.mapResult(this.pos,1);return t.deletedAfter?null:new re(t.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(e,t){if(typeof t.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new re(t.pos,e.markFromJSON(t.mark))}}F.jsonID("removeNodeMark",re);class A extends F{constructor(e,t,n,i=!1){super(),this.from=e,this.to=t,this.slice=n,this.structure=i}apply(e){return this.structure&&rt(e,this.from,this.to)?I.fail("Structure replace would overwrite content"):I.fromReplace(e,this.from,this.to,this.slice)}getMap(){return new L([this.from,this.to-this.from,this.slice.size])}invert(e){return new A(this.from,this.from+this.slice.size,e.slice(this.from,this.to))}map(e){let t=e.mapResult(this.to,-1),n=this.from==this.to&&A.MAP_BIAS<0?t:e.mapResult(this.from,1);return n.deletedAcross&&t.deletedAcross?null:new A(n.pos,Math.max(n.pos,t.pos),this.slice,this.structure)}merge(e){if(!(e instanceof A)||e.structure||this.structure)return null;if(this.from+this.slice.size==e.from&&!this.slice.openEnd&&!e.slice.openStart){let t=this.slice.size+e.slice.size==0?w.empty:new w(this.slice.content.append(e.slice.content),this.slice.openStart,e.slice.openEnd);return new A(this.from,this.to+(e.to-e.from),t,this.structure)}else if(e.to==this.from&&!this.slice.openStart&&!e.slice.openEnd){let t=this.slice.size+e.slice.size==0?w.empty:new w(e.slice.content.append(this.slice.content),e.slice.openStart,this.slice.openEnd);return new A(e.from,this.to,t,this.structure)}else return null}toJSON(){let e={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new A(t.from,t.to,w.fromJSON(e,t.slice),!!t.structure)}}A.MAP_BIAS=1;F.jsonID("replace",A);class N extends F{constructor(e,t,n,i,s,o,l=!1){super(),this.from=e,this.to=t,this.gapFrom=n,this.gapTo=i,this.slice=s,this.insert=o,this.structure=l}apply(e){if(this.structure&&(rt(e,this.from,this.gapFrom)||rt(e,this.gapTo,this.to)))return I.fail("Structure gap-replace would overwrite content");let t=e.slice(this.gapFrom,this.gapTo);if(t.openStart||t.openEnd)return I.fail("Gap is not a flat range");let n=this.slice.insertAt(this.insert,t.content);return n?I.fromReplace(e,this.from,this.to,n):I.fail("Content does not fit in gap")}getMap(){return new L([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 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)}map(e){let t=e.mapResult(this.from,1),n=e.mapResult(this.to,-1),i=this.from==this.gapFrom?t.pos:e.map(this.gapFrom,-1),s=this.to==this.gapTo?n.pos:e.map(this.gapTo,1);return t.deletedAcross&&n.deletedAcross||i<t.pos||s>n.pos?null:new N(t.pos,n.pos,i,s,this.slice,this.insert,this.structure)}toJSON(){let e={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(e.slice=this.slice.toJSON()),this.structure&&(e.structure=!0),e}static fromJSON(e,t){if(typeof t.from!="number"||typeof t.to!="number"||typeof t.gapFrom!="number"||typeof t.gapTo!="number"||typeof t.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new N(t.from,t.to,t.gapFrom,t.gapTo,w.fromJSON(e,t.slice),t.insert,!!t.structure)}}F.jsonID("replaceAround",N);function rt(r,e,t){let n=r.resolve(e),i=t-e,s=n.depth;for(;i>0&&s>0&&n.indexAfter(s)==n.node(s).childCount;)s--,i--;if(i>0){let o=n.node(s).maybeChild(n.indexAfter(s));for(;i>0;){if(!o||o.isLeaf)return!0;o=o.firstChild,i--}}return!1}function $r(r,e,t,n){let i=[],s=[],o,l;r.doc.nodesBetween(e,t,(a,c,f)=>{if(!a.isInline)return;let u=a.marks;if(!n.isInSet(u)&&f.type.allowsMarkType(n.type)){let h=Math.max(c,e),d=Math.min(c+a.nodeSize,t),p=n.addToSet(u);for(let m=0;m<u.length;m++)u[m].isInSet(p)||(o&&o.to==h&&o.mark.eq(u[m])?o.to=d:i.push(o=new j(h,d,u[m])));l&&l.to==h?l.to=d:s.push(l=new K(h,d,n))}}
vendor: 11,842 bytes, lines 4-5
4),i.forEach(a=>r.step(a)),s.forEach(a=>r.step(a))}function Dr(r,e,t,n){let i=[],s=0;r.doc.nodesBetween(e,t,(o,l)=>{if(!o.isInline)return;s++;let a=null;if(n instanceof Le){let c=o.marks,f;for(;f=n.isInSet(c);)(a||(a=[])).push(f),c=f.removeFromSet(c)}else n?n.isInSet(o.marks)&&(a=[n]):a=o.marks;if(a&&a.length){let c=Math.min(l+o.nodeSize,t);for(let f=0;f<a.length;f++){let u=a[f],h;for(let d=0;d<i.length;d++){let p=i[d];p.step==s-1&&u.eq(i[d].style)&&(h=p)}h?(h.to=c,h.step=s):i.push({style:u,from:Math.max(l,e),to:c,step:s})}}}),i.forEach(o=>r.step(new j(o.from,o.to,o.style)))}function ot(r,e,t,n=t.contentMatch,i=!0){let s=r.doc.nodeAt(e),o=[],l=e+1;for(let a=0;a<s.childCount;a++){let c=s.child(a),f=l+c.nodeSize,u=n.matchType(c.type);if(!u)o.push(new A(l,f,w.empty));else{n=u;for(let h=0;h<c.marks.length;h++)t.allowsMarkType(c.marks[h].type)||r.step(new j(l,f,c.marks[h]));if(i&&c.isText&&t.whitespace!="pre"){let h,d=/\r?\n|\r/g,p;for(;h=d.exec(c.text);)p||(p=new w(y.from(t.schema.text(" ",t.allowedMarks(c.marks))),0,0)),o.push(new A(l+h.index,l+h.index+h[0].length,p))}}l=f}if(!n.validEnd){let a=n.fillBefore(y.empty,!0);r.replace(l,l,new w(a,0,0))}for(let a=o.length-1;a>=0;a--)r.step(o[a])}function Lr(r,e,t){return(e==0||r.canReplace(e,r.childCount))&&(t==r.childCount||r.canReplace(0,t))}function fe(r){let t=r.parent.content.cutByIndex(r.startIndex,r.endIndex);for(let n=r.depth,i=0,s=0;;--n){let o=r.$from.node(n),l=r.$from.index(n)+i,a=r.$to.indexAfter(n)-s;if(n<r.depth&&o.canReplace(l,a,t))return n;if(n==0||o.type.spec.isolating||!Lr(o,l,a))break;l&&(i=1),a<o.childCount&&(s=1)}return null}function Jr(r,e,t){let{$from:n,$to:i,depth:s}=e,o=n.before(s+1),l=i.after(s+1),a=o,c=l,f=y.empty,u=0;for(let p=s,m=!1;p>t;p--)m||n.index(p)>0?(m=!0,f=y.from(n.node(p).copy(f)),u++):a--;let h=y.empty,d=0;for(let p=s,m=!1;p>t;p--)m||i.after(p+1)<i.end(p)?(m=!0,h=y.from(i.node(p).copy(h)),d++):c++;r.step(new N(a,c,o,l,new w(f.append(h),u,d),f.size-u,!0))}function mn(r,e,t=null,n=r){let i=_r(r,e),s=i&&jr(n,e);return s?i.map(It).concat({type:e,attrs:t}).concat(s.map(It)):null}function It(r){return{type:r,attrs:null}}function _r(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.contentMatchAt(n).findWrapping(e);if(!s)return null;let o=s.length?s[0]:e;return t.canReplaceWith(n,i,o)?s:null}function jr(r,e){let{parent:t,startIndex:n,endIndex:i}=r,s=t.child(n),o=e.contentMatch.findWrapping(s.type);if(!o)return null;let a=(o.length?o[o.length-1]:e).contentMatch;for(let c=n;a&&c<i;c++)a=a.matchType(t.child(c).type);return!a||!a.validEnd?null:o}function Wr(r,e,t){let n=y.empty;for(let o=t.length-1;o>=0;o--){if(n.size){let l=t[o].type.contentMatch.matchFragment(n);if(!l||!l.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}n=y.from(t[o].type.create(t[o].attrs,n))}let i=e.start,s=e.end;r.step(new N(i,s,i,s,new w(n,0,0),t.length,!0))}function Vr(r,e,t,n,i){if(!n.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let s=r.steps.length;r.doc.nodesBetween(e,t,(o,l)=>{let a=typeof i=="function"?i(o):i;if(o.isTextblock&&!o.hasMarkup(n,a)&&qr(r.doc,r.mapping.slice(s).map(l),n)){let c=null;if(n.schema.linebreakReplacement){let d=n.whitespace=="pre",p=!!n.contentMatch.matchType(n.schema.linebreakReplacement);d&&!p?c=!1:!d&&p&&(c=!0)}c===!1&&yn(r,o,l,s),ot(r,r.mapping.slice(s).map(l,1),n,void 0,c===null);let f=r.mapping.slice(s),u=f.map(l,1),h=f.map(l+o.nodeSize,1);return r.step(new N(u,h,u+1,h-1,new w(y.from(n.create(a,null,o.marks)),0,0),1,!0)),c===!0&&gn(r,o,l,s),!1}})}function gn(r,e,t,n){e.forEach((i,s)=>{if(i.isText){let o,l=/\r?\n|\r/g;for(;o=l.exec(i.text);){let a=r.mapping.slice(n).map(t+1+s+o.index);r.replaceWith(a,a+1,e.type.schema.linebreakReplacement.create())}}})}function yn(r,e,t,n){e.forEach((i,s)=>{if(i.type==i.type.schema.linebreakReplacement){let o=r.mapping.slice(n).map(t+1+s);r.replaceWith(o,o+1,e.type.schema.text(`
5`))}})}function qr(r,e,t){let n=r.resolve(e),i=n.index();return n.parent.canReplaceWith(i,i+1,t)}function Ur(r,e,t,n,i){let s=r.doc.nodeAt(e);if(!s)throw new RangeError("No node at given position");t||(t=s.type);let o=t.create(n,null,i||s.marks);if(s.isLeaf)return r.replaceWith(e,e+s.nodeSize,o);if(!t.validContent(s.content))throw new RangeError("Invalid content for node type "+t.name);r.step(new N(e,e+s.nodeSize,e+1,e+s.nodeSize-1,new w(y.from(o),0,0),1,!0))}function H(r,e,t=1,n){let i=r.resolve(e),s=i.depth-t,o=n&&n[n.length-1]||i.parent;if(s<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!o.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,f=t-2;c>s;c--,f--){let u=i.node(c),h=i.index(c);if(u.type.spec.isolating)return!1;let d=u.content.cutByIndex(h,u.childCount),p=n&&n[f+1];p&&(d=d.replaceChild(0,p.type.create(p.attrs)));let m=n&&n[f]||u;if(!u.canReplace(h+1,u.childCount)||!m.type.validContent(d))return!1}let l=i.indexAfter(s),a=n&&n[0];return i.node(s).canReplaceWith(l,l,a?a.type:i.node(s+1).type)}function Hr(r,e,t=1,n){let i=r.doc.resolve(e),s=y.empty,o=y.empty;for(let l=i.depth,a=i.depth-t,c=t-1;l>a;l--,c--){s=y.from(i.node(l).copy(s));let f=n&&n[c];o=y.from(f?f.type.create(f.attrs,o):i.node(l).copy(o))}r.step(new A(e,e,new w(s.append(o),t,t),!0))}function ie(r,e){let t=r.resolve(e),n=t.index();return xn(t.nodeBefore,t.nodeAfter)&&t.parent.canReplace(n,n+1)}function Kr(r,e){e.content.size||r.type.compatibleContent(e.type);let t=r.contentMatchAt(r.childCount),{linebreakReplacement:n}=r.type.schema;for(let i=0;i<e.childCount;i++){let s=e.child(i),o=s.type==n?r.type.schema.nodes.text:s.type;if(t=t.matchType(o),!t||!r.type.allowsMarks(s.marks))return!1}return t.validEnd}function xn(r,e){return!!(r&&e&&!r.isLeaf&&Kr(r,e))}function Je(r,e,t=-1){let n=r.resolve(e);for(let i=n.depth;;i--){let s,o,l=n.index(i);if(i==n.depth?(s=n.nodeBefore,o=n.nodeAfter):t>0?(s=n.node(i+1),l++,o=n.node(i).maybeChild(l)):(s=n.node(i).maybeChild(l-1),o=n.node(i+1)),s&&!s.isTextblock&&xn(s,o)&&n.node(i).canReplace(l,l+1))return e;if(i==0)break;e=t<0?n.before(i):n.after(i)}}function Gr(r,e,t){let n=null,{linebreakReplacement:i}=r.doc.type.schema,s=r.doc.resolve(e-t),o=s.node().type;if(i&&o.inlineContent){let f=o.whitespace=="pre",u=!!o.contentMatch.matchType(i);f&&!u?n=!1:!f&&u&&(n=!0)}let l=r.steps.length;if(n===!1){let f=r.doc.resolve(e+t);yn(r,f.node(),f.before(),l)}o.inlineContent&&ot(r,e+t-1,o,s.node().contentMatchAt(s.index()),n==null);let a=r.mapping.slice(l),c=a.map(e-t);if(r.step(new A(c,a.map(e+t,-1),w.empty,!0)),n===!0){let f=r.doc.resolve(c);gn(r,f.node(),f.before(),r.steps.length)}return r}function Zr(r,e,t){let n=r.resolve(e);if(n.parent.canReplaceWith(n.index(),n.index(),t))return e;if(n.parentOffset==0)for(let i=n.depth-1;i>=0;i--){let s=n.index(i);if(n.node(i).canReplaceWith(s,s,t))return n.before(i+1);if(s>0)return null}if(n.parentOffset==n.parent.content.size)for(let i=n.depth-1;i>=0;i--){let s=n.indexAfter(i);if(n.node(i).canReplaceWith(s,s,t))return n.after(i+1);if(s<n.node(i).childCount)return null}return null}function _e(r,e,t=e,n=w.empty){if(e==t&&!n.size)return null;let i=r.resolve(e),s=r.resolve(t);return wn(i,s,n)?new A(e,t,n):new Qr(i,s,n).fit()}function wn(r,e,t){return!t.openStart&&!t.openEnd&&r.start()==e.start()&&r.parent.canReplace(r.index(),e.index(),t.content)}class Qr{constructor(e,t,n){this.$from=e,this.$to=t,this.unplaced=n,this.frontier=[],this.placed=y.empty;for(let i=0;i<=e.depth;i++){let s=e.node(i);this.frontier.push({type:s.type,match:s.contentMatchAt(e.indexAfter(i))})}for(let i=e.depth;i>0;i--)this.placed=y.from(e.node(i).copy(this.placed))}get depth(){return this.frontier.length-1}fit(){for(;this.unplaced.size;){let c=this.findFittable();c?this.placeNodes(c):this.openMore()||this.dropNode()}let e=this.mustMoveInline(),t=this.placed.size-this.depth-this.$from.depth,n=this.$from,i=this.close(e<0?this.$to:n.doc.resolve(e));if(!i)return null;let s=this.placed,o=n.depth,l=i.depth;for(;o&&l&&s.childCount==1;)s=s.firstChild.content,o--,l--;let a=new w(s,o,l);return e>-1?new N(n.pos,e,this.$to.pos,this.$to.end(),a,t):a.size||n.pos!=this.$to.pos?new A(n.pos,i.pos,a):null}findFittable(){let e=this.unplaced.openStart;for(let t=this.unplaced.content,n=0,i=this.unplaced.openEnd;n<e;n++){let s=t.firstChild;if(t.childCount>1&&(i=0),s.type.spec.isolating&&i<=n){e=n;break}t=s.content}for(let t=1;t<=2;t++)for(let n=t==1?e:this.unplaced.openStart;n>=0;n--){let i,s=null;n?(s=Ue(this.unplaced.content,n-1).firstChild,i=s.content):i=this.unplaced.content;let o=i.firstChild;for(let l=this.depth;l>=0;l--){let{type:a,match:c}=this.frontier[l],f,u=null;if(t==1&&(o?c.matchType(o.type)||(u=c.fillBefore(y.from(o),!1)):s&&a.compatibleContent(s.type)))return{sliceDepth:n,frontierDepth:l,parent:s,inject:u};if(t==2&&o&&(f=c.findWrapping(o.type)))return{sliceDepth:n,frontierDepth:l,parent:s,wrap:f};if(s&&c.matchType(s.type))break}}}openMore(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=Ue(e,t);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new w(e,t+1,Math.max(n,i.size+t>=e.size-n?t+1:0)),!0)}dropNode(){let{content:e,openStart:t,openEnd:n}=this.unplaced,i=Ue(e,t);if(i.childCount<=1&&t>0){let s=e.size-t<=t+i.size;this.unplaced=new w(he(e,t-1,1),t-1,s?t-1:n)}else this.unplaced=new w(he(e,t,1),t,n)}placeNodes({sliceDepth:e,frontierDepth:t,parent:n,inject:i,wrap:s}){for(;this.depth>t;)this.closeFrontierNode();if(s)for(let m=0;m<s.length;m++)this.openFrontierNode(s[m]);let o=this.unplaced,l=n?n.content:o.content,a=o.openStart-e,c=0,f=[],{match:u,type:h}=this.frontier[t];if(i){for(let m=0;m<i.childCount;m++)f.push(i.child(m));u=u.matchFragment(i)}let d=l.size+e-(o.content.size-o.openEnd);for(;c<l.childCount;){let m=l.child(c),g=u.matchType(m.type);if(!g)break;c++,(c>1||a==0||m.content.size)&&(u=g,f.push(kn(m.mark(h.allowedMarks(m.marks)),c==1?a:0,c==l.childCount?d:-1)))}let p=c==l.childCount;p||(d=-1),this.placed=de(this.placed,t,y.from(f)),this.frontier[t].match=u,p&&d<0&&n&&n.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let m=0,g=l;m<d;m++){let x=g.lastChild;this.frontier.push({type:x.type,match:x.contentMatchAt(x.childCount)}),g=x.content}this.unplaced=p?e==0?w.empty:new w(he(o.content,e-1,1),e-1,d<0?o.openEnd:e-1):new w(he(o.content,e,c),o.openStart,o.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let e=this.frontier[this.depth],t;if(!e.type.isTextblock||!He(this.$to,this.$to.depth,e.type,e.match,!1)||this.$to.depth==this.depth&&(t=this.findCloseLevel(this.$to))&&t.depth==this.depth)return-1;let{depth:n}=this.$to,i=this.$to.after(n);for(;n>1&&i==this.$to.end(--n);)++i;return i}findCloseLevel(e){e:for(let t=Math.min(this.depth,e.depth);t>=0;t--){let{match:n,type:i}=this.frontier[t],s=t<e.depth&&e.end(t+1)==e.pos+(e.depth-(t+1)),o=He(e,t,i,n,s);if(o){for(let l=t-1;l>=0;l--){let{match:a,type:c}=this.frontier[l],f=He(e,l,c,a,!0);if(!f||f.childCount)continue e}return{depth:t,fit:o,move:s?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=de(this.placed,t.depth,t.fit)),e=t.move;for(let n=t.depth+1;n<=e.depth;n++){let i=e.node(n),s=i.type.contentMatch.fillBefore(i.content,!0,e.index(n));this.openFrontierNode(i.type,i.attrs,s)}return e}openFrontierNode(e,t=null,n){let i=this.frontier[this.depth];i.match=i.match.matchType(e),this.placed=de(this.placed,this.depth,y.from(e.create(t,n))),this.frontier.push({type:e,match:e.contentMatch})}closeFrontierNode(){let t=this.frontier.pop().match.fillBefore(y.empty,!0);t.childCount&&(this.placed=de(this.placed,this.frontier.length,t))}}function he(r,e,t){return e==0?r.cutByIndex(t,r.childCount):r.replaceChild(0,r.f
vendor: 8,553 bytes, line 5
5irstChild.copy(he(r.firstChild.content,e-1,t)))}function de(r,e,t){return e==0?r.append(t):r.replaceChild(r.childCount-1,r.lastChild.copy(de(r.lastChild.content,e-1,t)))}function Ue(r,e){for(let t=0;t<e;t++)r=r.firstChild.content;return r}function kn(r,e,t){if(e<=0)return r;let n=r.content;return e>1&&(n=n.replaceChild(0,kn(n.firstChild,e-1,n.childCount==1?t-1:0))),e>0&&(n=r.type.contentMatch.fillBefore(n).append(n),t<=0&&(n=n.append(r.type.contentMatch.matchFragment(n).fillBefore(y.empty,!0)))),r.copy(n)}function He(r,e,t,n,i){let s=r.node(e),o=i?r.indexAfter(e):r.index(e);if(o==s.childCount&&!t.compatibleContent(s.type))return null;let l=n.fillBefore(s.content,!0,o);return l&&!Yr(t,s.content,o)?l:null}function Yr(r,e,t){for(let n=t;n<e.childCount;n++)if(!r.allowsMarks(e.child(n).marks))return!0;return!1}function Xr(r){return r.spec.defining||r.spec.definingForContent}function ei(r,e,t,n){if(!n.size)return r.deleteRange(e,t);let i=r.doc.resolve(e),s=r.doc.resolve(t);if(wn(i,s,n))return r.step(new A(e,t,n));let o=bn(i,s);o[o.length-1]==0&&o.pop();let l=-(i.depth+1);o.unshift(l);for(let h=i.depth,d=i.pos-1;h>0;h--,d--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;o.indexOf(h)>-1?l=h:i.before(h)==d&&o.splice(1,0,-h)}let a=o.indexOf(l),c=[],f=n.openStart;for(let h=n.content,d=0;;d++){let p=h.firstChild;if(c.push(p),d==n.openStart)break;h=p.content}for(let h=f-1;h>=0;h--){let d=c[h],p=Xr(d.type);if(p&&!d.sameMarkup(i.node(Math.abs(l)-1)))f=h;else if(p||!d.type.isTextblock)break}for(let h=n.openStart;h>=0;h--){let d=(h+f+1)%(n.openStart+1),p=c[d];if(p)for(let m=0;m<o.length;m++){let g=o[(m+a)%o.length],x=!0;g<0&&(x=!1,g=-g);let k=i.node(g-1),v=i.index(g-1);if(k.canReplaceWith(v,v,p.type,p.marks))return r.replace(i.before(g),x?s.after(g):t,new w(vn(n.content,0,n.openStart,d),d,n.openEnd))}}let u=r.steps.length;for(let h=o.length-1;h>=0&&(r.replace(e,t,n),!(r.steps.length>u));h--){let d=o[h];d<0||(e=i.before(d),t=s.after(d))}}function vn(r,e,t,n,i){if(e<t){let s=r.firstChild;r=r.replaceChild(0,s.copy(vn(s.content,e+1,t,n,s)))}if(e>n){let s=i.contentMatchAt(0),o=s.fillBefore(r).append(r);r=o.append(s.matchFragment(o).fillBefore(y.empty,!0))}return r}function ti(r,e,t,n){if(!n.isInline&&e==t&&r.doc.resolve(e).parent.content.size){let i=Zr(r.doc,e,n.type);i!=null&&(e=t=i)}r.replaceRange(e,t,new w(y.from(n),0,0))}function ni(r,e,t){let n=r.doc.resolve(e),i=r.doc.resolve(t);if(n.parent.isTextblock&&i.parent.isTextblock&&n.start()!=i.start()&&n.parentOffset==0&&i.parentOffset==0){let o=n.sharedDepth(t),l=!1;for(let a=n.depth;a>o;a--)n.node(a).type.spec.isolating&&(l=!0);for(let a=i.depth;a>o;a--)i.node(a).type.spec.isolating&&(l=!0);if(!l){for(let a=n.depth;a>0&&e==n.start(a);a--)e=n.before(a);for(let a=i.depth;a>0&&t==i.start(a);a--)t=i.before(a);n=r.doc.resolve(e),i=r.doc.resolve(t)}}let s=bn(n,i);for(let o=0;o<s.length;o++){let l=s[o],a=o==s.length-1;if(a&&l==0||n.node(l).type.contentMatch.validEnd)return r.delete(n.start(l),i.end(l));if(l>0&&(a||n.node(l-1).canReplace(n.index(l-1),i.indexAfter(l-1))))return r.delete(n.before(l),i.after(l))}for(let o=1;o<=n.depth&&o<=i.depth;o++)if(e-n.start(o)==n.depth-o&&t>n.end(o)&&i.end(o)-t!=i.depth-o&&n.start(o-1)==i.start(o-1)&&n.node(o-1).canReplace(n.index(o-1),i.index(o-1)))return r.delete(n.before(o),t);r.delete(e,t)}function bn(r,e){let t=[],n=Math.min(r.depth,e.depth);for(let i=n;i>=0;i--){let s=r.start(i);if(s<r.pos-(r.depth-i)||e.end(i)>e.pos+(e.depth-i)||r.node(i).type.spec.isolating||e.node(i).type.spec.isolating)break;(s==e.start(i)||i==r.depth&&i==e.depth&&r.parent.inlineContent&&e.parent.inlineContent&&i&&e.start(i-1)==s-1)&&t.push(i)}return t}class le extends F{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 I.fail("No node at attribute step's position");let n=Object.create(null);for(let s in t.attrs)n[s]=t.attrs[s];n[this.attr]=this.value;let i=t.type.create(n,null,t.marks);return I.fromReplace(e,this.pos,this.pos+1,new w(y.from(i),0,t.isLeaf?0:1))}getMap(){return L.empty}invert(e){return new le(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 le(t.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.pos!="number"||typeof t.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new le(t.pos,t.attr,t.value)}}F.jsonID("attr",le);class xe extends F{constructor(e,t){super(),this.attr=e,this.value=t}apply(e){let t=Object.create(null);for(let i in e.attrs)t[i]=e.attrs[i];t[this.attr]=this.value;let n=e.type.create(t,e.content,e.marks);return I.ok(n)}getMap(){return L.empty}invert(e){return new xe(this.attr,e.attrs[this.attr])}map(e){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(e,t){if(typeof t.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new xe(t.attr,t.value)}}F.jsonID("docAttr",xe);let ae=class extends Error{};ae=function r(e){let t=Error.call(this,e);return t.__proto__=r.prototype,t};ae.prototype=Object.create(Error.prototype);ae.prototype.constructor=ae;ae.prototype.name="TransformError";class ri{constructor(e){this.doc=e,this.steps=[],this.docs=[],this.mapping=new Pe}get before(){return this.docs.length?this.docs[0]:this.doc}step(e){let t=this.maybeStep(e);if(t.failed)throw new ae(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 i=this.mapping.maps[n];n&&(e=i.map(e,1),t=i.map(t,-1)),i.forEach((s,o,l,a)=>{e=Math.min(e,l),t=Math.max(t,a)})}return e==1e9?null:{from:e,to:t}}addStep(e,t){this.docs.push(this.doc),this.steps.push(e),this.mapping.appendMap(e.getMap()),this.doc=t}replace(e,t=e,n=w.empty){let i=_e(this.doc,e,t,n);return i&&this.step(i),this}replaceWith(e,t,n){return this.replace(e,t,new w(y.from(n),0,0))}delete(e,t){return this.replace(e,t,w.empty)}insert(e,t){return this.replaceWith(e,e,t)}replaceRange(e,t,n){return ei(this,e,t,n),this}replaceRangeWith(e,t,n){return ti(this,e,t,n),this}deleteRange(e,t){return ni(this,e,t),this}lift(e,t){return Jr(this,e,t),this}join(e,t=1){return Gr(this,e,t),this}wrap(e,t){return Wr(this,e,t),this}setBlockType(e,t=e,n,i=null){return Vr(this,e,t,n,i),this}setNodeMarkup(e,t,n=null,i){return Ur(this,e,t,n,i),this}setNodeAttribute(e,t,n){return this.step(new le(e,t,n)),this}setDocAttribute(e,t){return this.step(new xe(e,t)),this}addNodeMark(e,t){return this.step(new G(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 T)t.isInSet(n.marks)&&this.step(new re(e,t));else{let i=n.marks,s,o=[];for(;s=t.isInSet(i);)o.push(new re(e,s)),i=s.removeFromSet(i);for(let l=o.length-1;l>=0;l--)this.step(o[l])}return this}split(e,t=1,n){return Hr(this,e,t,n),this}addMark(e,t,n){return $r(this,e,t,n),this}removeMark(e,t,n){return Dr(this,e,t,n),this}clearIncompatible(e,t,n){return ot(this,e,t,n),this}}const Ke=Object.create(null);class b{constructor(e,t,n){this.$anchor=e,this.$head=t,this.ranges=n||[new ii(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=w.empty){let n=t.content.lastChild,i=null;for(let l=0;l<t.openEnd;l++)i=n,n=n.lastChild;let s=e.steps.length,o=this.ranges;for(let l=0;l<o.length;l++){let{$from:a,$to:c}=o[l],f=e.mapping.slice(s);e.replaceRange(f.map(a.pos),f.map(c.pos),l?w.empty:t),l==0&&Ot(e,s,(n?n.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(e,t){let n=e.steps.length,i=this.ranges;for(let s=0;s<i.length;s++){let{$from:o,$to:l}=i[s],a=e.mapping.slice(n),c=a.map(o.pos),f=a.map(l.pos);s?e.deleteRange(c,f):(e.replaceRangeWith(c,f,t),Ot(e,n,t.isInline?-1:1))}}static findFrom(e,t,n=!1){let i=e.parent.inlineContent?new E(e):se(e.node(0),e.parent,e.pos,e.index(),t,n);if(i)return i;for(let s=e.depth-1;s>=0;s--){let o=t<0?se(e.node(0),e.node(s),e.before(s+1),e.index(s),t,n):se(e.node(0),e.node(s),e.after(s+1),e.index(s)+1,t,n);if(o)return o}return null}
vendor: 8,524 bytes, line 5
5static near(e,t=1){return this.findFrom(e,t)||this.findFrom(e,-t)||new J(e.node(0))}static atStart(e){return se(e,e,0,0,1)||new J(e)}static atEnd(e){return se(e,e,e.content.size,e.childCount,-1)||new J(e)}static fromJSON(e,t){if(!t||!t.type)throw new RangeError("Invalid input for Selection.fromJSON");let n=Ke[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 Ke)throw new RangeError("Duplicate use of selection JSON ID "+e);return Ke[e]=t,t.prototype.jsonID=e,t}getBookmark(){return E.between(this.$anchor,this.$head).getBookmark()}}b.prototype.visible=!0;class ii{constructor(e,t){this.$from=e,this.$to=t}}let Nt=!1;function Rt(r){!Nt&&!r.parent.inlineContent&&(Nt=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+r.parent.type.name+")"))}class E extends b{constructor(e,t=e){Rt(e),Rt(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 b.near(n);let i=e.resolve(t.map(this.anchor));return new E(i.parent.inlineContent?i:n,n)}replace(e,t=w.empty){if(super.replace(e,t),t==w.empty){let n=this.$from.marksAcross(this.$to);n&&e.ensureMarks(n)}}eq(e){return e instanceof E&&e.anchor==this.anchor&&e.head==this.head}getBookmark(){return new je(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(e,t){if(typeof t.anchor!="number"||typeof t.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new E(e.resolve(t.anchor),e.resolve(t.head))}static create(e,t,n=t){let i=e.resolve(t);return new this(i,n==t?i:e.resolve(n))}static between(e,t,n){let i=e.pos-t.pos;if((!n||i)&&(n=i>=0?1:-1),!t.parent.inlineContent){let s=b.findFrom(t,n,!0)||b.findFrom(t,-n,!0);if(s)t=s.$head;else return b.near(t,n)}return e.parent.inlineContent||(i==0?e=t:(e=(b.findFrom(e,-n,!0)||b.findFrom(e,n,!0)).$anchor,e.pos<t.pos!=i<0&&(e=t))),new E(e,t)}}b.jsonID("text",E);class je{constructor(e,t){this.anchor=e,this.head=t}map(e){return new je(e.map(this.anchor),e.map(this.head))}resolve(e){return E.between(e.resolve(this.anchor),e.resolve(this.head))}}class C extends b{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:i}=t.mapResult(this.anchor),s=e.resolve(i);return n?b.near(s):new C(s)}content(){return new w(y.from(this.node),0,0)}eq(e){return e instanceof C&&e.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new lt(this.anchor)}static fromJSON(e,t){if(typeof t.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new C(e.resolve(t.anchor))}static create(e,t){return new C(e.resolve(t))}static isSelectable(e){return!e.isText&&e.type.spec.selectable!==!1}}C.prototype.visible=!1;b.jsonID("node",C);class lt{constructor(e){this.anchor=e}map(e){let{deleted:t,pos:n}=e.mapResult(this.anchor);return t?new je(n,n):new lt(n)}resolve(e){let t=e.resolve(this.anchor),n=t.nodeAfter;return n&&C.isSelectable(n)?new C(t):b.near(t)}}class J extends b{constructor(e){super(e.resolve(0),e.resolve(e.content.size))}replace(e,t=w.empty){if(t==w.empty){e.delete(0,e.doc.content.size);let n=b.atStart(e.doc);n.eq(e.selection)||e.setSelection(n)}else super.replace(e,t)}toJSON(){return{type:"all"}}static fromJSON(e){return new J(e)}map(e){return new J(e)}eq(e){return e instanceof J}getBookmark(){return si}}b.jsonID("all",J);const si={map(){return this},resolve(r){return new J(r)}};function se(r,e,t,n,i,s=!1){if(e.inlineContent)return E.create(r,t);for(let o=n-(i>0?0:1);i>0?o<e.childCount:o>=0;o+=i){let l=e.child(o);if(l.isAtom){if(!s&&C.isSelectable(l))return C.create(r,t-(i<0?l.nodeSize:0))}else{let a=se(r,l,t+i,i<0?l.childCount:0,i,s);if(a)return a}t+=l.nodeSize*i}return null}function Ot(r,e,t){let n=r.steps.length-1;if(n<e)return;let i=r.steps[n];if(!(i instanceof A||i instanceof N))return;let s=r.mapping.maps[n],o;s.forEach((l,a,c,f)=>{o==null&&(o=f)}),r.setSelection(b.near(r.doc.resolve(o),t))}function zt(r,e){return!e||!r?r:r.bind(e)}class Se{constructor(e,t,n){this.name=e,this.init=zt(t.init,n),this.apply=zt(t.apply,n)}}new Se("doc",{init(r){return r.doc||r.schema.topNodeType.createAndFill()},apply(r){return r.doc}}),new Se("selection",{init(r,e){return r.selection||b.atStart(e.doc)},apply(r){return r.selection}}),new Se("storedMarks",{init(r){return r.storedMarks||null},apply(r,e,t,n){return n.selection.$cursor?r.storedMarks:null}}),new Se("scrollToSelection",{init(){return 0},apply(r,e){return r.scrolledIntoView?e+1:e}});function Sn(r,e,t){for(let n in r){let i=r[n];i instanceof Function?i=i.bind(e):n=="handleDOMEvents"&&(i=Sn(i,e,{})),t[n]=i}return t}class Z{constructor(e){this.spec=e,this.props={},e.props&&Sn(e.props,this,this.props),this.key=e.key?e.key.key:Cn("plugin")}getState(e){return e[this.key]}}const Ge=Object.create(null);function Cn(r){return r in Ge?r+"$"+ ++Ge[r]:(Ge[r]=0,r+"$")}class Q{constructor(e="key"){this.key=Cn(e)}get(e){return e.config.pluginsByKey[this.key]}getState(e){return e[this.key]}}const Mn=(r,e)=>r.selection.empty?!1:(e&&e(r.tr.deleteSelection().scrollIntoView()),!0);function En(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("backward",r):t.parentOffset>0)?null:t}const Tn=(r,e,t)=>{let n=En(r,t);if(!n)return!1;let i=at(n);if(!i){let o=n.blockRange(),l=o&&fe(o);return l==null?!1:(e&&e(r.tr.lift(o,l).scrollIntoView()),!0)}let s=i.nodeBefore;if(Pn(r,i,e,-1))return!0;if(n.parent.content.size==0&&(ce(s,"end")||C.isSelectable(s)))for(let o=n.depth;;o--){let l=_e(r.doc,n.before(o),n.after(o),w.empty);if(l&&l.slice.size<l.to-l.from){if(e){let a=r.tr.step(l);a.setSelection(ce(s,"end")?b.findFrom(a.doc.resolve(a.mapping.map(i.pos,-1)),-1):C.create(a.doc,i.pos-s.nodeSize)),e(a.scrollIntoView())}return!0}if(o==1||n.node(o-1).childCount>1)break}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos-s.nodeSize,i.pos).scrollIntoView()),!0):!1},oi=(r,e,t)=>{let n=En(r,t);if(!n)return!1;let i=at(n);return i?An(r,i,e):!1},li=(r,e,t)=>{let n=Nn(r,t);if(!n)return!1;let i=ct(n);return i?An(r,i,e):!1};function An(r,e,t){let n=e.nodeBefore,i=n,s=e.pos-1;for(;!i.isTextblock;s--){if(i.type.spec.isolating)return!1;let f=i.lastChild;if(!f)return!1;i=f}let o=e.nodeAfter,l=o,a=e.pos+1;for(;!l.isTextblock;a++){if(l.type.spec.isolating)return!1;let f=l.firstChild;if(!f)return!1;l=f}let c=_e(r.doc,s,a,w.empty);if(!c||c.from!=s||c instanceof A&&c.slice.size>=a-s)return!1;if(t){let f=r.tr.step(c);f.setSelection(E.create(f.doc,s)),t(f.scrollIntoView())}return!0}function ce(r,e,t=!1){for(let n=r;n;n=e=="start"?n.firstChild:n.lastChild){if(n.isTextblock)return!0;if(t&&n.childCount!=1)return!1}return!1}const In=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("backward",r):n.parentOffset>0)return!1;s=at(n)}let o=s&&s.nodeBefore;return!o||!C.isSelectable(o)?!1:(e&&e(r.tr.setSelection(C.create(r.doc,s.pos-o.nodeSize)).scrollIntoView()),!0)};function at(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){if(r.index(e)>0)return r.doc.resolve(r.before(e+1));if(r.node(e).type.spec.isolating)break}return null}function Nn(r,e){let{$cursor:t}=r.selection;return!t||(e?!e.endOfTextblock("forward",r):t.parentOffset<t.parent.content.size)?null:t}const Rn=(r,e,t)=>{let n=Nn(r,t);if(!n)return!1;let i=ct(n);if(!i)return!1;let s=i.nodeAfter;if(Pn(r,i,e,1))return!0;if(n.parent.content.size==0&&(ce(s,"start")||C.isSelectable(s))){let o=_e(r.doc,n.before(),n.after(),w.empty);if(o&&o.slice.size<o.to-o.from){if(e){let l=r.tr.step(o);l.setSelection(ce(s,"start")?b.findFrom(l.doc.resolve(l.mapping.map(i.pos)),1):C.create(l.doc,l.mapping.map(i.pos))),e(l.scrollIntoView())}return!0}}return s.isAtom&&i.depth==n.depth-1?(e&&e(r.tr.delete(i.pos,i.pos+s.nodeSize).scrollIntoView()),!0):!1},On=(r,e,t)=>{let{$head:n,empty:i}=r.selection,s=n;if(!i)return!1;if(n.parent.isTextblock){if(t?!t.endOfTextblock("forward",r):n.parentOffset<n.parent.content.size)return!1;s=ct(n)}let o=s&&s.nodeAfter;return!o||!C.isSelectable(o)?!1:(e&&e(r.tr.setSelection(C.create(r.doc,s.pos)).scrollIntoView()),!0)};function ct(r){if(!r.parent.type.spec.isolating)for(let e=r.depth-1;e>=0;e--){let t=r.node(e);if(r.index(e)+1<t.childCount)return r.doc.resolve(r.after(e+1));if(t.type.spec.isolating)break}return null}const ai=(r,e)=>{let t=r.selection,n=t instanceof C,i;
vendor: 4,190 bytes, lines 5-6
5if(n){if(t.node.isTextblock||!ie(r.doc,t.from))return!1;i=t.from}else if(i=Je(r.doc,t.from,-1),i==null)return!1;if(e){let s=r.tr.join(i);n&&s.setSelection(C.create(s.doc,i-r.doc.resolve(i).nodeBefore.nodeSize)),e(s.scrollIntoView())}return!0},ci=(r,e)=>{let t=r.selection,n;if(t instanceof C){if(t.node.isTextblock||!ie(r.doc,t.to))return!1;n=t.to}else if(n=Je(r.doc,t.to,1),n==null)return!1;return e&&e(r.tr.join(n).scrollIntoView()),!0},fi=(r,e)=>{let{$from:t,$to:n}=r.selection,i=t.blockRange(n),s=i&&fe(i);return s==null?!1:(e&&e(r.tr.lift(i,s).scrollIntoView()),!0)},zn=(r,e)=>{let{$head:t,$anchor:n}=r.selection;return!t.parent.type.spec.code||!t.sameParent(n)?!1:(e&&e(r.tr.insertText(`
6`).scrollIntoView()),!0)};function ft(r){for(let e=0;e<r.edgeCount;e++){let{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}const ui=(r,e)=>{let{$head:t,$anchor:n}=r.selection;if(!t.parent.type.spec.code||!t.sameParent(n))return!1;let i=t.node(-1),s=t.indexAfter(-1),o=ft(i.contentMatchAt(s));if(!o||!i.canReplaceWith(s,s,o))return!1;if(e){let l=t.after(),a=r.tr.replaceWith(l,l,o.createAndFill());a.setSelection(b.near(a.doc.resolve(l),1)),e(a.scrollIntoView())}return!0},Bn=(r,e)=>{let t=r.selection,{$from:n,$to:i}=t;if(t instanceof J||n.parent.inlineContent||i.parent.inlineContent)return!1;let s=ft(i.parent.contentMatchAt(i.indexAfter()));if(!s||!s.isTextblock)return!1;if(e){let o=(!n.parentOffset&&i.index()<i.parent.childCount?n:i).pos,l=r.tr.insert(o,s.createAndFill());l.setSelection(E.create(l.doc,o+1)),e(l.scrollIntoView())}return!0},Fn=(r,e)=>{let{$cursor:t}=r.selection;if(!t||t.parent.content.size)return!1;if(t.depth>1&&t.after()!=t.end(-1)){let s=t.before();if(H(r.doc,s))return e&&e(r.tr.split(s).scrollIntoView()),!0}let n=t.blockRange(),i=n&&fe(n);return i==null?!1:(e&&e(r.tr.lift(n,i).scrollIntoView()),!0)};function hi(r){return(e,t)=>{let{$from:n,$to:i}=e.selection;if(e.selection instanceof C&&e.selection.node.isBlock)return!n.parentOffset||!H(e.doc,n.pos)?!1:(t&&t(e.tr.split(n.pos).scrollIntoView()),!0);if(!n.depth)return!1;let s=[],o,l,a=!1,c=!1;for(let d=n.depth;;d--)if(n.node(d).isBlock){a=n.end(d)==n.pos+(n.depth-d),c=n.start(d)==n.pos-(n.depth-d),l=ft(n.node(d-1).contentMatchAt(n.indexAfter(d-1))),s.unshift(a&&l?{type:l}:null),o=d;break}else{if(d==1)return!1;s.unshift(null)}let f=e.tr;(e.selection instanceof E||e.selection instanceof J)&&f.deleteSelection();let u=f.mapping.map(n.pos),h=H(f.doc,u,s.length,s);if(h||(s[0]=l?{type:l}:null,h=H(f.doc,u,s.length,s)),!h)return!1;if(f.split(u,s.length,s),!a&&c&&n.node(o).type!=l){let d=f.mapping.map(n.before(o)),p=f.doc.resolve(d);l&&n.node(o-1).canReplaceWith(p.index(),p.index()+1,l)&&f.setNodeMarkup(f.mapping.map(n.before(o)),l)}return t&&t(f.scrollIntoView()),!0}}const di=hi(),pi=(r,e)=>{let{$from:t,to:n}=r.selection,i,s=t.sharedDepth(n);return s==0?!1:(i=t.before(s),e&&e(r.tr.setSelection(C.create(r.doc,i))),!0)};function mi(r,e,t){let n=e.nodeBefore,i=e.nodeAfter,s=e.index();return!n||!i||!n.type.compatibleContent(i.type)?!1:!n.content.size&&e.parent.canReplace(s-1,s)?(t&&t(r.tr.delete(e.pos-n.nodeSize,e.pos).scrollIntoView()),!0):!e.parent.canReplace(s,s+1)||!(i.isTextblock||ie(r.doc,e.pos))?!1:(t&&t(r.tr.join(e.pos).scrollIntoView()),!0)}function Pn(r,e,t,n){let i=e.nodeBefore,s=e.nodeAfter,o,l,a=i.type.spec.isolating||s.type.spec.isolating;if(!a&&mi(r,e,t))return!0;let c=!a&&e.parent.canReplace(e.index(),e.index()+1);if(c&&(o=(l=i.contentMatchAt(i.childCount)).findWrapping(s.type))&&l.matchType(o[0]||s.type).validEnd){if(t){let d=e.pos+s.nodeSize,p=y.empty;for(let x=o.length-1;x>=0;x--)p=y.from(o[x].create(null,p));p=y.from(i.copy(p));let m=r.tr.step(new N(e.pos-1,d,e.pos,d,new w(p,1,0),o.length,!0)),g=m.doc.resolve(d+2*o.length);g.nodeAfter&&g.nodeAfter.type==i.type&&ie(m.doc,g.pos)&&m.join(g.pos),t(m.scrollIntoView())}return!0}let f=s.type.spec.isolating||n>0&&a?null:b.findFrom(e,1),u=f&&f.$from.blockRange(f.$to),h=u&&fe(u);if(h!=null&&h>=e.depth)return t&&t(r.tr.lift(u,h).scrollIntoView()),!0;if(c&&ce(s,"start",!0)&&ce(i,"end")){let d=i,p=[];for(;p.push(d),!d.isTextblock;)d=d.lastChild;let m=s,g=1;for(;!m.isTextblock;m=m.firstChild)g++;
vendor: 8,601 bytes, line 6
6if(d.canReplace(d.childCount,d.childCount,m.content)){if(t){let x=y.empty;for(let v=p.length-1;v>=0;v--)x=y.from(p[v].copy(x));let k=r.tr.step(new N(e.pos-p.length,e.pos+s.nodeSize,e.pos+g,e.pos+s.nodeSize-g,new w(x,p.length,0),0,!0));t(k.scrollIntoView())}return!0}}return!1}function $n(r){return function(e,t){let n=e.selection,i=r<0?n.$from:n.$to,s=i.depth;for(;i.node(s).isInline;){if(!s)return!1;s--}return i.node(s).isTextblock?(t&&t(e.tr.setSelection(E.create(e.doc,r<0?i.start(s):i.end(s)))),!0):!1}}const gi=$n(-1),yi=$n(1);function xi(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s),l=o&&mn(o,r,e);return l?(n&&n(t.tr.wrap(o,l).scrollIntoView()),!0):!1}}function Bt(r,e=null){return function(t,n){let i=!1;for(let s=0;s<t.selection.ranges.length&&!i;s++){let{$from:{pos:o},$to:{pos:l}}=t.selection.ranges[s];t.doc.nodesBetween(o,l,(a,c)=>{if(i)return!1;if(!(!a.isTextblock||a.hasMarkup(r,e)))if(a.type==r)i=!0;else{let f=t.doc.resolve(c),u=f.index();i=f.parent.canReplaceWith(u,u+1,r)}})}if(!i)return!1;if(n){let s=t.tr;for(let o=0;o<t.selection.ranges.length;o++){let{$from:{pos:l},$to:{pos:a}}=t.selection.ranges[o];s.setBlockType(l,a,r,e)}n(s.scrollIntoView())}return!0}}function ut(...r){return function(e,t,n){for(let i=0;i<r.length;i++)if(r[i](e,t,n))return!0;return!1}}ut(Mn,Tn,In);ut(Mn,Rn,On);ut(zn,Bn,Fn,di);typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform&&os.platform()=="darwin";function wi(r,e=null){return function(t,n){let{$from:i,$to:s}=t.selection,o=i.blockRange(s);if(!o)return!1;let l=n?t.tr:null;return ki(l,o,r,e)?(n&&n(l.scrollIntoView()),!0):!1}}function ki(r,e,t,n=null){let i=!1,s=e,o=e.$from.doc;if(e.depth>=2&&e.$from.node(e.depth-1).type.compatibleContent(t)&&e.startIndex==0){if(e.$from.index(e.depth-1)==0)return!1;let a=o.resolve(e.start-2);s=new ze(a,a,e.depth),e.endIndex<e.parent.childCount&&(e=new ze(e.$from,o.resolve(e.$to.end(e.depth)),e.depth)),i=!0}let l=mn(s,t,n,e);return l?(r&&vi(r,e,l,i,t),!0):!1}function vi(r,e,t,n,i){let s=y.empty;for(let f=t.length-1;f>=0;f--)s=y.from(t[f].type.create(t[f].attrs,s));r.step(new N(e.start-(n?2:0),e.end,e.start,e.end,new w(s,0,0),t.length,!0));let o=0;for(let f=0;f<t.length;f++)t[f].type==i&&(o=f+1);let l=t.length-o,a=e.start+t.length-(n?2:0),c=e.parent;for(let f=e.startIndex,u=e.endIndex,h=!0;f<u;f++,h=!1)!h&&H(r.doc,a,l)&&(r.split(a,l),a+=2*l),a+=c.child(f).nodeSize;return r}function bi(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,o=>o.childCount>0&&o.firstChild.type==r);return s?t?n.node(s.depth-1).type==r?Si(e,t,r,s):Ci(e,t,s):!0:!1}}function Si(r,e,t,n){let i=r.tr,s=n.end,o=n.$to.end(n.depth);s<o&&(i.step(new N(s-1,o,s,o,new w(y.from(t.create(null,n.parent.copy())),1,0),1,!0)),n=new ze(i.doc.resolve(n.$from.pos),i.doc.resolve(o),n.depth));const l=fe(n);if(l==null)return!1;i.lift(n,l);let a=i.doc.resolve(i.mapping.map(s,-1)-1);return ie(i.doc,a.pos)&&a.nodeBefore.type==a.nodeAfter.type&&i.join(a.pos),e(i.scrollIntoView()),!0}function Ci(r,e,t){let n=r.tr,i=t.parent;for(let d=t.end,p=t.endIndex-1,m=t.startIndex;p>m;p--)d-=i.child(p).nodeSize,n.delete(d-1,d+1);let s=n.doc.resolve(t.start),o=s.nodeAfter;if(n.mapping.map(t.end)!=t.start+s.nodeAfter.nodeSize)return!1;let l=t.startIndex==0,a=t.endIndex==i.childCount,c=s.node(-1),f=s.index(-1);if(!c.canReplace(f+(l?0:1),f+1,o.content.append(a?y.empty:y.from(i))))return!1;let u=s.pos,h=u+o.nodeSize;return n.step(new N(u-(l?1:0),h+(a?1:0),u+1,h-1,new w((l?y.empty:y.from(i.copy(y.empty))).append(a?y.empty:y.from(i.copy(y.empty))),l?0:1,a?0:1),l?0:1)),e(n.scrollIntoView()),!0}function Mi(r){return function(e,t){let{$from:n,$to:i}=e.selection,s=n.blockRange(i,c=>c.childCount>0&&c.firstChild.type==r);if(!s)return!1;let o=s.startIndex;if(o==0)return!1;let l=s.parent,a=l.child(o-1);if(a.type!=r)return!1;if(t){let c=a.lastChild&&a.lastChild.type==l.type,f=y.from(c?r.create():null),u=new w(y.from(r.create(null,y.from(l.type.create(null,f)))),c?3:1,0),h=s.start,d=s.end;t(e.tr.step(new N(h-(c?3:1),d,h,d,u,1,!0)).scrollIntoView())}return!0}}var Ei=Object.defineProperty,ht=(r,e)=>{for(var t in e)Ei(r,t,{get:e[t],enumerable:!0})};function Dn(r){const{state:e,transaction:t}=r;let{selection:n}=t,{doc:i}=t,{storedMarks:s}=t;return{...e,apply:e.apply.bind(e),applyTransaction:e.applyTransaction.bind(e),plugins:e.plugins,schema:e.schema,reconfigure:e.reconfigure.bind(e),toJSON:e.toJSON.bind(e),get storedMarks(){return s},get selection(){return n},get doc(){return i},get tr(){return n=t.selection,i=t.doc,s=t.storedMarks,t}}}var Ti=class{constructor(r){this.editor=r.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=r.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){const{rawCommands:r,editor:e,state:t}=this,{view:n}=e,{tr:i}=t,s=this.buildProps(i);return Object.fromEntries(Object.entries(r).map(([o,l])=>[o,(...c)=>{const f=l(...c)(s);return!i.getMeta("preventDispatch")&&!this.hasCustomState&&n.dispatch(i),f}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(r,e=!0){const{rawCommands:t,editor:n,state:i}=this,{view:s}=n,o=[],l=!!r,a=r||i.tr,c=()=>(!l&&e&&!a.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(a),o.every(u=>u===!0)),f={...Object.fromEntries(Object.entries(t).map(([u,h])=>[u,(...p)=>{const m=this.buildProps(a,e),g=h(...p)(m);return o.push(g),f}])),run:c};return f}createCan(r){const{rawCommands:e,state:t}=this,n=!1,i=r||t.tr,s=this.buildProps(i,n);return{...Object.fromEntries(Object.entries(e).map(([l,a])=>[l,(...c)=>a(...c)({...s,dispatch:void 0})])),chain:()=>this.createChain(i,n)}}buildProps(r,e=!0){const{rawCommands:t,editor:n,state:i}=this,{view:s}=n,o={tr:r,editor:n,view:s,state:Dn({state:i,transaction:r}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(r,e),can:()=>this.createCan(r),get commands(){return Object.fromEntries(Object.entries(t).map(([l,a])=>[l,(...c)=>a(...c)(o)]))}};return o}},Ln={};ht(Ln,{blur:()=>Ai,clearContent:()=>Ii,clearNodes:()=>Ni,command:()=>Ri,createParagraphNear:()=>Oi,cut:()=>zi,deleteCurrentNode:()=>Bi,deleteNode:()=>Fi,deleteRange:()=>Pi,deleteSelection:()=>Li,enter:()=>Ji,exitCode:()=>_i,extendMarkRange:()=>Wi,first:()=>Vi,focus:()=>Hi,forEach:()=>Ki,insertContent:()=>Gi,insertContentAt:()=>Yi,joinBackward:()=>ts,joinDown:()=>es,joinForward:()=>ns,joinItemBackward:()=>rs,joinItemForward:()=>is,joinTextblockBackward:()=>ss,joinTextblockForward:()=>ls,joinUp:()=>Xi,keyboardShortcut:()=>cs,lift:()=>fs,liftEmptyBlock:()=>us,liftListItem:()=>hs,newlineInCode:()=>ds,resetAttributes:()=>ps,scrollIntoView:()=>ms,selectAll:()=>gs,selectNodeBackward:()=>ys,selectNodeForward:()=>xs,selectParentNode:()=>ws,selectTextblockEnd:()=>ks,selectTextblockStart:()=>vs,setContent:()=>Ss,setMark:()=>Ps,setMeta:()=>$s,setNode:()=>Ds,setNodeSelection:()=>Ls,setTextDirection:()=>Js,setTextSelection:()=>_s,sinkListItem:()=>js,splitBlock:()=>Ws,splitListItem:()=>Vs,toggleList:()=>Us,toggleMark:()=>Hs,toggleNode:()=>Ks,toggleWrap:()=>Gs,undoInputRule:()=>Zs,unsetAllMarks:()=>Qs,unsetMark:()=>Ys,unsetTextDirection:()=>Xs,updateAttributes:()=>eo,wrapIn:()=>to,wrapInList:()=>no});var Ai=()=>({editor:r,view:e})=>(requestAnimationFrame(()=>{var t;r.isDestroyed||(e.dom.blur(),(t=window?.getSelection())==null||t.removeAllRanges())}),!0),Ii=(r=!0)=>({commands:e})=>e.setContent("",{emitUpdate:r}),Ni=()=>({state:r,tr:e,dispatch:t})=>{const{selection:n}=e,{ranges:i}=n;return t&&i.forEach(({$from:s,$to:o})=>{r.doc.nodesBetween(s.pos,o.pos,(l,a)=>{if(l.type.isText)return;const{doc:c,mapping:f}=e,u=c.resolve(f.map(a)),h=c.resolve(f.map(a+l.nodeSize)),d=u.blockRange(h);if(!d)return;const p=fe(d);if(l.type.isTextblock){const{defaultType:m}=u.parent.contentMatchAt(u.index());e.setNodeMarkup(d.start,m)}(p||p===0)&&e.lift(d,p)})}),!0},Ri=r=>e=>r(e),Oi=()=>({state:r,dispatch:e})=>Bn(r,e),zi=(r,e)=>({editor:t,tr:n})=>{const{state:i}=t,s=i.doc.slice(r.from,r.to);n.deleteRange(r.from,r.to);const o=n.mapping.map(e);return n.insert(o,s.content),n.setSelection(new E(n.doc.resolve(Math.max(o-1,0)))),!0},Bi=()=>({tr:r,dispatch:e})=>{const{selection:t}=r,n=t.$anchor.node();if(n.content.size>0)return!1;const i=r.selection.$anchor;for(let s=i.depth;s>0;s-=1)if(i.node(s).type===n.type){if(e){const l=i.before(s),a=i.after(s);r.delete(l,a).scrollIntoView()}return!0}return!1};function B(r,e){if(typeof r=="string"){if(!e.nodes[r])throw Error(`There is no node type named '${r}'. Maybe you forgot to add the extension?`);
6return e.nodes[r]}return r}var Fi=r=>({tr:e,state:t,dispatch:n})=>{const i=B(r,t.schema),s=e.selection.$anchor;for(let o=s.depth;o>0;o-=1)if(s.node(o).type===i){if(n){const a=s.before(o),c=s.after(o);e.delete(a,c).scrollIntoView()}return!0}return!1},Pi=r=>({tr:e,dispatch:t})=>{const{from:n,to:i}=r;return t&&e.delete(n,i),!0},$i=r=>r.content?/^text(\*|\+)/.test(r.content):!1,Ft=(r,e,t)=>{if(!r.parent.isInline||t==="left"&&r.pos>r.start()||t==="right"&&r.pos<r.end())return r.pos;const n=e.nodes[r.parent.type.name].spec;return $i(n)?t==="left"?r.start()-1:r.end()+1:r.pos},Di=(r,e,t)=>{const n=Ft(r,t,"left"),i=Ft(e,t,"right");return{from:n,to:i}},Li=()=>({state:r,dispatch:e})=>{const{$from:t,$to:n}=r.selection;if(r.selection.empty)return!1;const{from:i,to:s}=Di(t,n,r.schema);return e&&(r.tr.deleteRange(i,s).scrollIntoView(),e(r.tr)),!0},Ji=()=>({commands:r})=>r.keyboardShortcut("Enter"),_i=()=>({state:r,dispatch:e})=>ui(r,e);function ji(r){return Object.prototype.toString.call(r)==="[object RegExp]"}function $e(r,e,t={strict:!0}){const n=Object.keys(e);return n.length?n.every(i=>t.strict?e[i]===r[i]:ji(e[i])?e[i].test(r[i]):e[i]===r[i]):!0}function Jn(r,e,t={}){return r.find(n=>n.type===e&&$e(Object.fromEntries(Object.keys(t).map(i=>[i,n.attrs[i]])),t))}function Pt(r,e,t={}){return!!Jn(r,e,t)}function _n(r,e,t){if(!r||!e)return;let n=r.parent.childAfter(r.parentOffset);if((!n.node||!n.node.marks.some(c=>c.type===e))&&(n=r.parent.childBefore(r.parentOffset)),!n.node||!n.node.marks.some(c=>c.type===e))return;if(!t){const c=n.node.marks.find(f=>f.type===e);c&&(t=c.attrs)}if(!Jn([...n.node.marks],e,t))return;let s=n.index,o=r.start()+n.offset,l=s+1,a=o+n.node.nodeSize;for(;s>0&&Pt([...r.parent.child(s-1).marks],e,t);)s-=1,o-=r.parent.child(s).nodeSize;for(;l<r.parent.childCount&&Pt([...r.parent.child(l).marks],e,t);)a+=r.parent.child(l).nodeSize,l+=1;return{from:o,to:a}}function Y(r,e){if(typeof r=="string"){if(!e.marks[r])throw Error(`There is no mark type named '${r}'. Maybe you forgot to add the extension?`);return e.marks[r]}return r}var Wi=(r,e)=>({tr:t,state:n,dispatch:i})=>{const s=Y(r,n.schema),{doc:o,selection:l}=t,{$from:a,from:c,to:f}=l;if(i){const u=_n(a,s,e);if(u&&u.from<=c&&u.to>=f){const h=E.create(o,u.from,u.to);t.setSelection(h)}}return!0},Vi=r=>e=>{const t=typeof r=="function"?r(e):r;for(let n=0;n<t.length;n+=1)if(t[n](e))return!0;return!1};function jn(r){return r instanceof E}function X(r=0,e=0,t=0){return Math.min(Math.max(r,e),t)}function qi(r,e=null){if(!e)return null;const t=b.atStart(r),n=b.atEnd(r);if(e==="start"||e===!0)return t;if(e==="end")return n;const i=t.from,s=n.to;return e==="all"?E.create(r,X(0,i,s),X(r.content.size,i,s)):E.create(r,X(e,i,s),X(e,i,s))}function $t(){return navigator.platform==="Android"||/android/i.test(navigator.userAgent)}function De(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}function Ui(){return typeof navigator<"u"?/^((?!chrome|android).)*safari/i.test(navigator.userAgent):!1}var Hi=(r=null,e={})=>({editor:t,view:n,tr:i,dispatch:s})=>{e={scrollIntoView:!0,...e};const o=()=>{(De()||$t())&&n.dom.focus(),Ui()&&!De()&&!$t()&&n.dom.focus({preventScroll:!0}),requestAnimationFrame(()=>{t.isDestroyed||(n.focus(),e?.scrollIntoView&&t.commands.scrollIntoView())})};try{if(n.hasFocus()&&r===null||r===!1)return!0}catch{return!1}if(s&&r===null&&!jn(t.state.selection))return o(),!0;const l=qi(i.doc,r)||t.state.selection,a=t.state.selection.eq(l);return s&&(a||i.setSelection(l),a&&i.storedMarks&&i.setStoredMarks(i.storedMarks),o()),!0},Ki=(r,e)=>t=>r.every((n,i)=>e(n,{...t,index:i})),Gi=(r,e)=>({tr:t,commands:n})=>n.insertContentAt({from:t.selection.from,to:t.selection.to},r,e),Wn=r=>{const e=r.childNodes;for(let t=e.length-1;t>=0;t-=1){const n=e[t];n.nodeType===3&&n.nodeValue&&/^(\n\s\s|\n)$/.test(n.nodeValue)?r.removeChild(n):n.nodeType===1&&Wn(n)}return r};function Ce(r){if(typeof window>"u")throw new Error("[tiptap error]: there is no window object available, so this function cannot be used");const e=`<body>${r}</body>`,t=new window.DOMParser().parseFromString(e,"text/html").body;return Wn(t)}function we(r,e,t){if(r instanceof q||r instanceof y)return r;t={slice:!0,parseOptions:{},...t};const n=typeof r=="object"&&r!==null,i=typeof r=="string";if(n)try{if(Array.isArray(r)&&r.length>0)return y.fromArray(r.map(l=>e.nodeFromJSON(l)));const o=e.nodeFromJSON(r);return t.errorOnInvalidContent&&o.check(),o}catch(s){if(t.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:s});return console.warn("[tiptap warn]: Invalid content.","Passed value:",r,"Error:",s),we("",e,t)}if(i){if(t.errorOnInvalidContent){let o=!1,l="";const a=new Ir({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:c=>(o=!0,l=typeof c=="string"?c:c.outerHTML,null)}]}})});if(t.slice?oe.fromSchema(a).parseSlice(Ce(r),t.parseOptions):oe.fromSchema(a).parse(Ce(r),t.parseOptions),t.errorOnInvalidContent&&o)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${l}`)})}const s=oe.fromSchema(e);return t.slice?s.parseSlice(Ce(r),t.parseOptions).content:s.parse(Ce(r),t.parseOptions)}return we("",e,t)}function Zi(r,e,t){const n=r.steps.length-1;if(n<e)return;const i=r.steps[n];if(!(i instanceof A||i instanceof N))return;const s=r.mapping.maps[n];let o=0;
vendor: 15,289 bytes, lines 6-8
6s.forEach((l,a,c,f)=>{o===0&&(o=f)}),r.setSelection(b.near(r.doc.resolve(o),t))}var Qi=r=>!("type"in r),Yi=(r,e,t)=>({tr:n,dispatch:i,editor:s})=>{var o;if(i){t={parseOptions:s.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...t};let l;const a=g=>{s.emit("contentError",{editor:s,error:g,disableCollaboration:()=>{"collaboration"in s.storage&&typeof s.storage.collaboration=="object"&&s.storage.collaboration&&(s.storage.collaboration.isDisabled=!0)}})},c={preserveWhitespace:"full",...t.parseOptions};if(!t.errorOnInvalidContent&&!s.options.enableContentCheck&&s.options.emitContentError)try{we(e,s.schema,{parseOptions:c,errorOnInvalidContent:!0})}catch(g){a(g)}try{l=we(e,s.schema,{parseOptions:c,errorOnInvalidContent:(o=t.errorOnInvalidContent)!=null?o:s.options.enableContentCheck})}catch(g){return a(g),!1}let{from:f,to:u}=typeof r=="number"?{from:r,to:r}:{from:r.from,to:r.to},h=!0,d=!0;if((Qi(l)?l:[l]).forEach(g=>{g.check(),h=h?g.isText&&g.marks.length===0:!1,d=d?g.isBlock:!1}),f===u&&d){const{parent:g}=n.doc.resolve(f);g.isTextblock&&!g.type.spec.code&&!g.childCount&&(f-=1,u+=1)}let m;if(h){if(Array.isArray(e))m=e.map(g=>g.text||"").join("");else if(e instanceof y){let g="";e.forEach(x=>{x.text&&(g+=x.text)}),m=g}else typeof e=="object"&&e&&e.text?m=e.text:m=e;n.insertText(m,f,u)}else{m=l;const g=n.doc.resolve(f),x=g.node(),k=g.parentOffset===0,v=x.isText||x.isTextblock,M=x.content.size>0;k&&v&&M&&d&&(f=Math.max(0,f-1)),n.replaceWith(f,u,m)}t.updateSelection&&Zi(n,n.steps.length-1,-1),t.applyInputRules&&n.setMeta("applyInputRules",{from:f,text:m}),t.applyPasteRules&&n.setMeta("applyPasteRules",{from:f,text:m})}return!0},Xi=()=>({state:r,dispatch:e})=>ai(r,e),es=()=>({state:r,dispatch:e})=>ci(r,e),ts=()=>({state:r,dispatch:e})=>Tn(r,e),ns=()=>({state:r,dispatch:e})=>Rn(r,e),rs=()=>({state:r,dispatch:e,tr:t})=>{try{const n=Je(r.doc,r.selection.$from.pos,-1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},is=()=>({state:r,dispatch:e,tr:t})=>{try{const n=Je(r.doc,r.selection.$from.pos,1);return n==null?!1:(t.join(n,2),e&&e(t),!0)}catch{return!1}},ss=()=>({state:r,dispatch:e})=>oi(r,e),ls=()=>({state:r,dispatch:e})=>li(r,e);function Vn(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function as(r){const e=r.split(/-(?!$)/);let t=e[e.length-1];t==="Space"&&(t=" ");let n,i,s,o;for(let l=0;l<e.length-1;l+=1){const a=e[l];if(/^(cmd|meta|m)$/i.test(a))o=!0;else if(/^a(lt)?$/i.test(a))n=!0;else if(/^(c|ctrl|control)$/i.test(a))i=!0;else if(/^s(hift)?$/i.test(a))s=!0;else if(/^mod$/i.test(a))De()||Vn()?o=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${a}`)}return n&&(t=`Alt-${t}`),i&&(t=`Ctrl-${t}`),o&&(t=`Meta-${t}`),s&&(t=`Shift-${t}`),t}var cs=r=>({editor:e,view:t,tr:n,dispatch:i})=>{const s=as(r).split(/-(?!$)/),o=s.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),l=new KeyboardEvent("keydown",{key:o==="Space"?" ":o,altKey:s.includes("Alt"),ctrlKey:s.includes("Ctrl"),metaKey:s.includes("Meta"),shiftKey:s.includes("Shift"),bubbles:!0,cancelable:!0}),a=e.captureTransaction(()=>{t.someProp("handleKeyDown",c=>c(t,l))});return a?.steps.forEach(c=>{const f=c.map(n.mapping);f&&i&&n.maybeStep(f)}),!0};function dt(r,e,t={}){const{from:n,to:i,empty:s}=r.selection,o=e?B(e,r.schema):null,l=[];r.doc.nodesBetween(n,i,(u,h)=>{if(u.isText)return;const d=Math.max(n,h),p=Math.min(i,h+u.nodeSize);l.push({node:u,from:d,to:p})});const a=i-n,c=l.filter(u=>o?o.name===u.node.type.name:!0).filter(u=>$e(u.node.attrs,t,{strict:!1}));return s?!!c.length:c.reduce((u,h)=>u+h.to-h.from,0)>=a}var fs=(r,e={})=>({state:t,dispatch:n})=>{const i=B(r,t.schema);return dt(t,i,e)?fi(t,n):!1},us=()=>({state:r,dispatch:e})=>Fn(r,e),hs=r=>({state:e,dispatch:t})=>{const n=B(r,e.schema);return bi(n)(e,t)},ds=()=>({state:r,dispatch:e})=>zn(r,e);function qn(r,e){return e.nodes[r]?"node":e.marks[r]?"mark":null}function Dt(r,e){const t=typeof e=="string"?[e]:e;return Object.keys(r).reduce((n,i)=>(t.includes(i)||(n[i]=r[i]),n),{})}var ps=(r,e)=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const l=qn(typeof r=="string"?r:r.name,n.schema);if(!l)return!1;l==="node"&&(s=B(r,n.schema)),l==="mark"&&(o=Y(r,n.schema));let a=!1;return t.selection.ranges.forEach(c=>{n.doc.nodesBetween(c.$from.pos,c.$to.pos,(f,u)=>{s&&s===f.type&&(a=!0,i&&t.setNodeMarkup(u,void 0,Dt(f.attrs,e))),o&&f.marks.length&&f.marks.forEach(h=>{o===h.type&&(a=!0,i&&t.addMark(u,u+f.nodeSize,o.create(Dt(h.attrs,e))))})})}),a},ms=()=>({tr:r,dispatch:e})=>(e&&r.scrollIntoView(),!0),gs=()=>({tr:r,dispatch:e})=>{if(e){const t=new J(r.doc);r.setSelection(t)}return!0},ys=()=>({state:r,dispatch:e})=>In(r,e),xs=()=>({state:r,dispatch:e})=>On(r,e),ws=()=>({state:r,dispatch:e})=>pi(r,e),ks=()=>({state:r,dispatch:e})=>yi(r,e),vs=()=>({state:r,dispatch:e})=>gi(r,e);function bs(r,e,t={},n={}){return we(r,e,{slice:!1,parseOptions:t,errorOnInvalidContent:n.errorOnInvalidContent})}var Ss=(r,{errorOnInvalidContent:e,emitUpdate:t=!0,parseOptions:n={}}={})=>({editor:i,tr:s,dispatch:o,commands:l})=>{const{doc:a}=s;if(n.preserveWhitespace!=="full"){const c=bs(r,i.schema,n,{errorOnInvalidContent:e??i.options.enableContentCheck});return o&&s.replaceWith(0,a.content.size,c).setMeta("preventUpdate",!t),!0}return o&&s.setMeta("preventUpdate",!t),l.insertContentAt({from:0,to:a.content.size},r,{parseOptions:n,errorOnInvalidContent:e??i.options.enableContentCheck})};function Cs(r,e){const t=Y(e,r.schema),{from:n,to:i,empty:s}=r.selection,o=[];s?(r.storedMarks&&o.push(...r.storedMarks),o.push(...r.selection.$head.marks())):r.doc.nodesBetween(n,i,a=>{o.push(...a.marks)});const l=o.find(a=>a.type.name===t.name);return l?{...l.attrs}:{}}function Ms(r,e){const t=new ri(r);return e.forEach(n=>{n.steps.forEach(i=>{t.step(i)})}),t}function Es(r){for(let e=0;e<r.edgeCount;e+=1){const{type:t}=r.edge(e);if(t.isTextblock&&!t.hasRequiredAttrs())return t}return null}function Ts(r,e){for(let t=r.depth;t>0;t-=1){const n=r.node(t);if(e(n))return{pos:t>0?r.before(t):0,start:r.start(t),depth:t,node:n}}}function pt(r){return e=>Ts(e.$from,r)}function ke(r,e,t){return r.config[e]===void 0&&r.parent?ke(r.parent,e,t):typeof r.config[e]=="function"?r.config[e].bind({...t,parent:r.parent?ke(r.parent,e,t):null}):r.config[e]}function As(r){return typeof r=="function"}function it(r,e=void 0,...t){return As(r)?e?r.bind(e)(...t):r(...t):r}function Un(r){const e=r.filter(i=>i.type==="extension"),t=r.filter(i=>i.type==="node"),n=r.filter(i=>i.type==="mark");return{baseExtensions:e,nodeExtensions:t,markExtensions:n}}function Is(r,e,t){const{from:n,to:i}=e,{blockSeparator:s=`
7
8`,textSerializers:o={}}=t||{};let l="";return r.nodesBetween(n,i,(a,c,f,u)=>{var h;a.isBlock&&c>n&&(l+=s);const d=o?.[a.type.name];if(d)return f&&(l+=d({node:a,pos:c,parent:f,index:u,range:e})),!1;a.isText&&(l+=(h=a?.text)==null?void 0:h.slice(Math.max(n,c)-c,i-c))}),l}function Ns(r){return Object.fromEntries(Object.entries(r.nodes).filter(([,e])=>e.spec.toText).map(([e,t])=>[e,t.spec.toText]))}function Rs(r,e=JSON.stringify){const t={};return r.filter(n=>{const i=e(n);return Object.prototype.hasOwnProperty.call(t,i)?!1:t[i]=!0})}function Os(r){const e=Rs(r);return e.length===1?e:e.filter((t,n)=>!e.filter((s,o)=>o!==n).some(s=>t.oldRange.from>=s.oldRange.from&&t.oldRange.to<=s.oldRange.to&&t.newRange.from>=s.newRange.from&&t.newRange.to<=s.newRange.to))}function zs(r){const{mapping:e,steps:t}=r,n=[];return e.maps.forEach((i,s)=>{const o=[];if(i.ranges.length)i.forEach((l,a)=>{o.push({from:l,to:a})});else{const{from:l,to:a}=t[s];if(l===void 0||a===void 0)return;o.push({from:l,to:a})}o.forEach(({from:l,to:a})=>{const c=e.slice(s).map(l,-1),f=e.slice(s).map(a),u=e.invert().map(c,-1),h=e.invert().map(f);n.push({oldRange:{from:u,to:h},newRange:{from:c,to:f}})})}),Os(n)}function Ae(r,e,t){return Object.fromEntries(Object.entries(t).filter(([n])=>{const i=r.find(s=>s.type===e&&s.name===n);return i?i.attribute.keepOnSplit:!1}))}function Bs(r,e,t={}){const{empty:n,ranges:i}=r.selection,s=e?Y(e,r.schema):null;if(n)return!!(r.storedMarks||r.selection.$from.marks()).filter(u=>s?s.name===u.type.name:!0).find(u=>$e(u.attrs,t,{strict:!1}));let o=0;const l=[];if(i.forEach(({$from:u,$to:h})=>{const d=u.pos,p=h.pos;r.doc.nodesBetween(d,p,(m,g)=>{if(s&&m.inlineContent&&!m.type.allowsMarkType(s))return!1;if(!m.isText&&!m.marks.length)return;const x=Math.max(d,g),k=Math.min(p,g+m.nodeSize),v=k-x;o+=v,l.push(...m.marks.map(M=>({mark:M,from:x,to:k})))})}),o===0)return!1;const a=l.filter(u=>s?s.name===u.mark.type.name:!0).filter(u=>$e(u.mark.attrs,t,{strict:!1})).reduce((u,h)=>u+h.to-h.from,0),c=l.filter(u=>s?u.mark.type!==s&&u.mark.type.excludes(s):!0).reduce((u,h)=>u+h.to-h.from,0);return(a>0?a+c:a)>=o}function Ze(r,e){const{nodeExtensions:t}=Un(e),n=t.find(o=>o.name===r);if(!n)return!1;const i={name:n.name,options:n.options,storage:n.storage},s=it(ke(n,"group",i));return typeof s!="string"?!1:s.split(" ").includes("list")}function Hn(r,{checkChildren:e=!0,ignoreWhitespace:t=!1}={}){var n;if(t){if(r.type.name==="hardBreak")return!0;if(r.isText)return!/\S/.test((n=r.text)!=null?n:"")}if(r.isText)return!r.text;if(r.isAtom||r.isLeaf)return!1;if(r.content.childCount===0)return!0;if(e){let i=!0;return r.content.forEach(s=>{i!==!1&&(Hn(s,{ignoreWhitespace:t,checkChildren:e})||(i=!1))}),i}return!1}function Fs(r,e,t){var n;const{selection:i}=e;let s=null;if(jn(i)&&(s=i.$cursor),s){const l=(n=r.storedMarks)!=null?n:s.marks();return s.parent.type.allowsMarkType(t)&&(!!t.isInSet(l)||!l.some(c=>c.type.excludes(t)))}const{ranges:o}=i;return o.some(({$from:l,$to:a})=>{let c=l.depth===0?r.doc.inlineContent&&r.doc.type.allowsMarkType(t):!1;return r.doc.nodesBetween(l.pos,a.pos,(f,u,h)=>{if(c)return!1;if(f.isInline){const d=!h||h.type.allowsMarkType(t),p=!!t.isInSet(f.marks)||!f.marks.some(m=>m.type.excludes(t));c=d&&p}return!c}),c})}var Ps=(r,e={})=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=t,{empty:o,ranges:l}=s,a=Y(r,n.schema);if(i)if(o){const c=Cs(n,a);t.addStoredMark(a.create({...c,...e}))}else l.forEach(c=>{const f=c.$from.pos,u=c.$to.pos;n.doc.nodesBetween(f,u,(h,d)=>{const p=Math.max(d,f),m=Math.min(d+h.nodeSize,u);h.marks.find(x=>x.type===a)?h.marks.forEach(x=>{a===x.type&&t.addMark(p,m,a.create({...x.attrs,...e}))}):t.addMark(p,m,a.create(e))})});return Fs(n,t,a)},$s=(r,e)=>({tr:t})=>(t.setMeta(r,e),!0),Ds=(r,e={})=>({state:t,dispatch:n,chain:i})=>{const s=B(r,t.schema);let o;return t.selection.$anchor.sameParent(t.selection.$head)&&(o=t.selection.$anchor.parent.attrs),s.isTextblock?i().command(({commands:l})=>Bt(s,{...o,...e})(t)?!0:l.clearNodes()).command(({state:l})=>Bt(s,{...o,...e})(l,n)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},Ls=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,i=X(r,0,n.content.size),s=C.create(n,i);e.setSelection(s)}return!0},Js=(r,e)=>({tr:t,state:n,dispatch:i})=>{const{selection:s}=n;let o,l;return typeof e=="number"?(o=e,l=e):e&&"from"in e&&"to"in e?(o=e.from,l=e.to):(o=s.from,l=s.to),i&&t.doc.nodesBetween(o,l,(a,c)=>{a.isText||t.setNodeMarkup(c,void 0,{...a.attrs,dir:r})}),!0},_s=r=>({tr:e,dispatch:t})=>{if(t){const{doc:n}=e,{from:i,to:s}=typeof r=="number"?{from:r,to:r}:r,o=E.atStart(n).from,l=E.atEnd(n).to,a=X(i,o,l),c=X(s,o,l),f=E.create(n,a,c);e.setSelection(f)}return!0},js=r=>({state:e,dispatch:t})=>{const n=B(r,e.schema);return Mi(n)(e,t)};function Lt(r,e){const t=r.storedMarks||r.selection.$to.parentOffset&&r.selection.$from.marks();if(t){const n=t.filter(i=>e?.includes(i.type.name));r.tr.ensureMarks(n)}}var Ws=({keepMarks:r=!0}={})=>({tr:e,state:t,dispatch:n,editor:i})=>{const{selection:s,doc:o}=e,{$from:l,$to:a}=s,c=i.extensionManager.attributes,f=Ae(c,l.node().type.name,l.node().attrs);if(s instanceof C&&s.node.isBlock)return!l.parentOffset||!H(o,l.pos)?!1:(n&&(r&&Lt(t,i.extensionManager.splittableMarks),e.split(l.pos).scrollIntoView()),!0);if(!l.parent.isBlock)return!1;const u=a.parentOffset===a.parent.content.size,h=l.depth===0?void 0:Es(l.node(-1).contentMatchAt(l.indexAfter(-1)));let d=u&&h?[{type:h,attrs:f}]:void 0,p=H(e.doc,e.mapping.map(l.pos),1,d);if(!d&&!p&&H(e.doc,e.mapping.map(l.pos),1,h?[{type:h}]:void 0)&&(p=!0,d=h?[{type:h,attrs:f}]:void 0),n){if(p&&(s instanceof E&&e.deleteSelection(),e.split(e.mapping.map(l.pos),1,d),h&&!u&&!l.parentOffset&&l.parent.type!==h)){const m=e.mapping.map(l.before()),g=e.doc.resolve(m);l.node(-1).canReplaceWith(g.index(),g.index()+1,h)&&e.setNodeMarkup(e.mapping.map(l.before()),h)}r&&Lt(t,i.extensionManager.splittableMarks),e.scrollIntoView()}return p},Vs=(r,e={})=>({tr:t,state:n,dispatch:i,editor:s})=>{var o;const l=B(r,n.schema),{$from:a,$to:c}=n.selection,f=n.selection.node;if(f&&f.isBlock||a.depth<2||!a.sameParent(c))return!1;const u=a.node(-1);if(u.type!==l)return!1;const h=s.extensionManager.attributes;if(a.parent.content.size===0&&a.node(-1).childCount===a.indexAfter(-1)){if(a.depth===2||a.node(-3).type!==l||a.index(-2)!==a.node(-2).childCount-1)return!1;if(i){let x=y.empty;const k=a.index(-1)?1:a.index(-2)?2:3;for(let P=a.depth-k;P>=a.depth-3;P-=1)x=y.from(a.node(P).copy(x));const v=a.indexAfter(-1)<a.node(-2).childCount?1:a.indexAfter(-2)<a.node(-3).childCount?2:3,M={...Ae(h,a.node().type.name,a.node().attrs),...e},S=((o=l.contentMatch.defaultType)==null?void 0:o.createAndFill(M))||void 0;x=x.append(y.from(l.createAndFill(null,S)||void 0));const R=a.before(a.depth-(k-1));t.replace(R,a.after(-v),new w(x,4-k,0));let O=-1;t.doc.nodesBetween(R,t.doc.content.size,(P,_)=>{if(O>-1)return!1;P.isTextblock&&P.content.size===0&&(O=_+1)}),O>-1&&t.setSelection(E.near(t.doc.resolve(O))),t.scrollIntoView()}return!0}const d=c.pos===a.end()?u.contentMatchAt(0).defaultType:null,p={...Ae(h,u.type.name,u.attrs),...e},m={...Ae(h,a.node().type.name,a.node().attrs),...e};t.delete(a.pos,c.pos);const g=d?[{type:l,attrs:p},{type:d,attrs:m}]:[{type:l,attrs:p}];if(!H(t.doc,a.pos,2))return!1;if(i){const{selection:x,storedMarks:k}=n,{splittableMarks:v}=s.extensionManager,M=k||x.$to.parentOffset&&x.$from.marks();if(t.split(a.pos,2,g).scrollIntoView(),!M||!i)return!0;const S=M.filter(R=>v.includes(R.type.name));t.ensureMarks(S)}return!0},Qe=(r,e)=>{const t=pt(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(Math.max(0,t.pos-1)).before(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===i?.type&&ie(r.doc,t.pos)&&r.join(t.pos),!0},Ye=(r,e)=>{const t=pt(o=>o.type===e)(r.selection);if(!t)return!0;const n=r.doc.resolve(t.start).after(t.depth);if(n===void 0)return!0;const i=r.doc.nodeAt(n);return t.node.type===i?.type&&ie(r.doc,n)&&r.join(n),!0};function qs(r){const e=r.doc,t=e.firstChild;if(!t)return null;const n=e.resolve(1),i=e.resolve(t.nodeSize-1);return E.between(n,i)}var Us=(r,e,t,n={})=>({editor:i,tr:s,state:o,dispatch:l,chain:a,commands:c,can:f})=>{const{extensions:u,splittableMarks:h}=i.extensionManager,d=B(r,o.schema),p=B(e,o.schema),{selection:m,storedMarks:g}=o,{$from:x,$to:k}=m,v=x.blockRange(k),M=g||m.$to.parentOffset&&m.$from.marks();if(!v)return!1;const S=pt(V=>Ze(V.type.name,u))(m),R=m.from===0&&m.to===o.doc.content.size,O=o.doc.content.content,P=O.length===1?O[0]:null,_=R&&P&&Ze(P.type.name,u)?{node:P,pos:0}:null,W=S??_,We=!!S&&v.depth>=1&&v.depth-S.depth<=1,ue=!!_;
8if((We||ue)&&W){if(W.node.type===d)return R&&ue?a().command(({tr:V,dispatch:D})=>{const $=qs(V);return $?(V.setSelection($),D&&D(V),!0):!1}).liftListItem(p).run():c.liftListItem(p);if(Ze(W.node.type.name,u)&&d.validContent(W.node.content))return a().command(()=>(s.setNodeMarkup(W.pos,d),!0)).command(()=>Qe(s,d)).command(()=>Ye(s,d)).run()}return!t||!M||!l?a().command(()=>f().wrapInList(d,n)?!0:c.clearNodes()).wrapInList(d,n).command(()=>Qe(s,d)).command(()=>Ye(s,d)).run():a().command(()=>{const V=f().wrapInList(d,n),D=M.filter($=>h.includes($.type.name));return s.ensureMarks(D),V?!0:c.clearNodes()}).wrapInList(d,n).command(()=>Qe(s,d)).command(()=>Ye(s,d)).run()},Hs=(r,e={},t={})=>({state:n,commands:i})=>{const{extendEmptyMarkRange:s=!1}=t,o=Y(r,n.schema);return Bs(n,o,e)?i.unsetMark(o,{extendEmptyMarkRange:s}):i.setMark(o,e)},Ks=(r,e,t={})=>({state:n,commands:i})=>{const s=B(r,n.schema),o=B(e,n.schema),l=dt(n,s,t);let a;return n.selection.$anchor.sameParent(n.selection.$head)&&(a=n.selection.$anchor.parent.attrs),l?i.setNode(o,a):i.setNode(s,{...a,...t})},Gs=(r,e={})=>({state:t,commands:n})=>{const i=B(r,t.schema);return dt(t,i,e)?n.lift(i):n.wrapIn(i,e)},Zs=()=>({state:r,dispatch:e})=>{const t=r.plugins;for(let n=0;n<t.length;n+=1){const i=t[n];let s;if(i.spec.isInputRules&&(s=i.getState(r))){if(e){const o=r.tr,l=s.transform;for(let a=l.steps.length-1;a>=0;a-=1)o.step(l.steps[a].invert(l.docs[a]));if(s.text){const a=o.doc.resolve(s.from).marks();o.replaceWith(s.from,s.to,r.schema.text(s.text,a))}else o.delete(s.from,s.to)}return!0}}return!1},Qs=(r={})=>({tr:e,dispatch:t,editor:n})=>{const{ignoreClearable:i=!1}=r,{selection:s}=e,{empty:o,ranges:l}=s;if(o)return!0;const{nonClearableMarks:a}=n.extensionManager;if(t){const c=Object.values(n.schema.marks).filter(f=>i||!a.includes(f.name));l.forEach(f=>{for(const u of c)e.removeMark(f.$from.pos,f.$to.pos,u)})}return!0},Ys=(r,e={})=>({tr:t,state:n,dispatch:i})=>{var s;const{extendEmptyMarkRange:o=!1}=e,{selection:l}=t,a=Y(r,n.schema),{$from:c,empty:f,ranges:u}=l;if(!i)return!0;if(f&&o){let{from:h,to:d}=l;const p=(s=c.marks().find(g=>g.type===a))==null?void 0:s.attrs,m=_n(c,a,p);m&&(h=m.from,d=m.to),t.removeMark(h,d,a)}else u.forEach(h=>{t.removeMark(h.$from.pos,h.$to.pos,a)});return t.removeStoredMark(a),!0},Xs=r=>({tr:e,state:t,dispatch:n})=>{const{selection:i}=t;let s,o;return typeof r=="number"?(s=r,o=r):r&&"from"in r&&"to"in r?(s=r.from,o=r.to):(s=i.from,o=i.to),n&&e.doc.nodesBetween(s,o,(l,a)=>{if(l.isText)return;const c={...l.attrs};delete c.dir,e.setNodeMarkup(a,void 0,c)}),!0},eo=(r,e={})=>({tr:t,state:n,dispatch:i})=>{let s=null,o=null;const l=qn(typeof r=="string"?r:r.name,n.schema);if(!l)return!1;l==="node"&&(s=B(r,n.schema)),l==="mark"&&(o=Y(r,n.schema));let a=!1;return t.selection.ranges.forEach(c=>{const f=c.$from.pos,u=c.$to.pos;let h,d,p,m;t.selection.empty?n.doc.nodesBetween(f,u,(g,x)=>{s&&s===g.type&&(a=!0,p=Math.max(x,f),m=Math.min(x+g.nodeSize,u),h=x,d=g)}):n.doc.nodesBetween(f,u,(g,x)=>{x<f&&s&&s===g.type&&(a=!0,p=Math.max(x,f),m=Math.min(x+g.nodeSize,u),h=x,d=g),x>=f&&x<=u&&(s&&s===g.type&&(a=!0,i&&t.setNodeMarkup(x,void 0,{...g.attrs,...e})),o&&g.marks.length&&g.marks.forEach(k=>{if(o===k.type&&(a=!0,i)){const v=Math.max(x,f),M=Math.min(x+g.nodeSize,u);t.addMark(v,M,o.create({...k.attrs,...e}))}}))}),d&&(h!==void 0&&i&&t.setNodeMarkup(h,void 0,{...d.attrs,...e}),o&&d.marks.length&&d.marks.forEach(g=>{o===g.type&&i&&t.addMark(p,m,o.create({...g.attrs,...e}))}))}),a},to=(r,e={})=>({state:t,dispatch:n})=>{const i=B(r,t.schema);return xi(i,e)(t,n)},no=(r,e={})=>({state:t,dispatch:n})=>{const i=B(r,t.schema);return wi(i,e)(t,n)};function ro(r){return Object.prototype.toString.call(r).slice(8,-1)}function Me(r){return ro(r)!=="Object"?!1:r.constructor===Object&&Object.getPrototypeOf(r)===Object.prototype}function Kn(r,e){const t={...r};return Me(r)&&Me(e)&&Object.keys(e).forEach(n=>{Me(e[n])&&Me(r[n])?t[n]=Kn(r[n],e[n]):t[n]=e[n]}),t}var mt=class{constructor(r={}){this.type="extendable",this.parent=null,this.child=null,this.name="",this.config={name:this.name},this.config={...this.config,...r},this.name=this.config.name}get options(){return{...it(ke(this,"addOptions",{name:this.name}))}}get storage(){return{...it(ke(this,"addStorage",{name:this.name,options:this.options}))}}configure(r={}){const e=this.extend({...this.config,addOptions:()=>Kn(this.options,r)});return e.name=this.name,e.parent=this.parent,this.child=null,e}extend(r={}){const e=new this.constructor({...this.config,...r});return e.parent=this,this.child=e,e.name="name"in r?r.name:e.parent.name,e}},Jt=class Gn extends mt{constructor(){super(...arguments),this.type="mark"}static create(e={}){const t=typeof e=="function"?e():e;return new Gn(t)}static handleExit({editor:e,mark:t}){const{tr:n}=e.state,i=e.state.selection.$from;if(i.pos===i.end()){const o=i.marks();if(!!!o.find(c=>
vendor: 5,073 bytes, lines 8-10
8c?.type.name===t.name))return!1;const a=o.find(c=>c?.type.name===t.name);return a&&n.removeStoredMark(a),n.insertText(" ",i.pos),e.view.dispatch(n),!0}return!1}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},io={};ht(io,{ClipboardTextSerializer:()=>so,Commands:()=>oo,Delete:()=>lo,Drop:()=>ao,Editable:()=>co,FocusEvents:()=>fo,Keymap:()=>uo,Paste:()=>ho,Tabindex:()=>po,TextDirection:()=>mo,focusEventsPluginKey:()=>Qn});var U=class Zn extends mt{constructor(){super(...arguments),this.type="extension"}static create(e={}){const t=typeof e=="function"?e():e;return new Zn(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}},so=U.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new Z({key:new Q("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{const{editor:r}=this,{state:e,schema:t}=r,{doc:n,selection:i}=e,s=Ns(t),{blockSeparator:o}=this.options,l={...o!==void 0?{blockSeparator:o}:{},textSerializers:s};return[...i.ranges].sort((c,f)=>c.$from.pos-f.$from.pos).map(({$from:c,$to:f})=>Is(n,{from:c.pos,to:f.pos},l)).join(o??`
9
10`)}}})]}}),oo=U.create({name:"commands",addCommands(){return{...Ln}}}),lo=U.create({name:"delete",onUpdate({transaction:r,appendedTransactions:e}){var t,n,i;const s=()=>{var o,l,a,c;if((c=(a=(l=(o=this.editor.options.coreExtensionOptions)==null?void 0:o.delete)==null?void 0:l.filterTransaction)==null?void 0:a.call(l,r))!=null?c:r.getMeta("y-sync$"))return;const f=Ms(r.before,[r,...e]);zs(f).forEach(d=>{f.mapping.mapResult(d.oldRange.from).deletedAfter&&f.mapping.mapResult(d.oldRange.to).deletedBefore&&f.before.nodesBetween(d.oldRange.from,d.oldRange.to,(p,m)=>{const g=m+p.nodeSize-2,x=d.oldRange.from<=m&&g<=d.oldRange.to;this.editor.emit("delete",{type:"node",node:p,from:m,to:g,newFrom:f.mapping.map(m),newTo:f.mapping.map(g),deletedRange:d.oldRange,newRange:d.newRange,partial:!x,editor:this.editor,transaction:r,combinedTransform:f})})});const h=f.mapping;f.steps.forEach((d,p)=>{var m,g;if(d instanceof j){const x=h.slice(p).map(d.from,-1),k=h.slice(p).map(d.to),v=h.invert().map(x,-1),M=h.invert().map(k),S=x>0?(m=f.doc.nodeAt(x-1))==null?void 0:m.marks.some(O=>O.eq(d.mark)):!1,R=(g=f.doc.nodeAt(k))==null?void 0:g.marks.some(O=>O.eq(d.mark));this.editor.emit("delete",{type:"mark",mark:d.mark,from:d.from,to:d.to,deletedRange:{from:v,to:M},newRange:{from:x,to:k},partial:!!(R||S),editor:this.editor,transaction:r,combinedTransform:f})}})};(i=(n=(t=this.editor.options.coreExtensionOptions)==null?void 0:t.delete)==null?void 0:n.async)==null||i?setTimeout(s,0):s()}}),ao=U.create({name:"drop",addProseMirrorPlugins(){return[new Z({key:new Q("tiptapDrop"),props:{handleDrop:(r,e,t,n)=>{this.editor.emit("drop",{editor:this.editor,event:e,slice:t,moved:n})}}})]}}),co=U.create({name:"editable",addProseMirrorPlugins(){return[new Z({key:new Q("editable"),props:{editable:()=>this.editor.options.editable}})]}}),Qn=new Q("focusEvents"),fo=U.create({name:"focusEvents",addProseMirrorPlugins(){const{editor:r}=this;return[new Z({key:Qn,props:{handleDOMEvents:{focus:(e,t)=>{r.isFocused=!0;const n=r.state.tr.setMeta("focus",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1},blur:(e,t)=>{r.isFocused=!1;const n=r.state.tr.setMeta("blur",{event:t}).setMeta("addToHistory",!1);return e.dispatch(n),!1}}}})]}}),uo=U.create({name:"keymap",addKeyboardShortcuts(){const r=()=>this.editor.commands.first(({commands:o})=>[()=>o.undoInputRule(),()=>o.command(({tr:l})=>{const{selection:a,doc:c}=l,{empty:f,$anchor:u}=a,{pos:h,parent:d}=u,p=u.parent.isTextblock&&h>0?l.doc.resolve(h-1):u,m=p.parent.type.spec.isolating,g=u.pos-u.parentOffset,x=m&&p.parent.childCount===1?g===u.pos:b.atStart(c).from===h;return!f||!d.type.isTextblock||d.textContent.length||!x||x&&u.parent.type.name==="paragraph"?!1:o.clearNodes()}),()=>o.deleteSelection(),()=>o.joinBackward(),()=>o.selectNodeBackward()]),e=()=>this.editor.commands.first(({commands:o})=>[()=>o.deleteSelection(),()=>o.deleteCurrentNode(),()=>o.joinForward(),()=>o.selectNodeForward()]),n={Enter:()=>this.editor.commands.first(({commands:o})=>[()=>o.newlineInCode(),()=>o.createParagraphNear(),()=>o.liftEmptyBlock(),()=>o.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:r,"Mod-Backspace":r,"Shift-Backspace":r,Delete:e,"Mod-Delete":e,"Mod-a":()=>this.editor.commands.selectAll()},i={...n},s={...n,"Ctrl-h":r,"Alt-Backspace":r,"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 De()||Vn()?s:i},addProseMirrorPlugins(){return[new Z({key:new Q("clearDocument"),appendTransaction:(r,e,t)=>{if(r.some(m=>m.getMeta("composition")))return;const n=r.some(m=>m.docChanged)&&!e.doc.eq(t.doc),i=r.some(m=>m.getMeta("preventClearDocument"));if(!n||i)return;const{empty:s,from:o,to:l}=e.selection,a=b.atStart(e.doc).from,c=b.atEnd(e.doc).to;
10if(s||!(o===a&&l===c)||!Hn(t.doc))return;const h=t.tr,d=Dn({state:t,transaction:h}),{commands:p}=new Ti({editor:this.editor,state:d});if(p.clearNodes(),!!h.steps.length)return h}})]}}),ho=U.create({name:"paste",addProseMirrorPlugins(){return[new Z({key:new Q("tiptapPaste"),props:{handlePaste:(r,e,t)=>{this.editor.emit("paste",{editor:this.editor,event:e,slice:t})}}})]}}),po=U.create({name:"tabindex",addOptions(){return{value:void 0}},addProseMirrorPlugins(){return[new Z({key:new Q("tabindex"),props:{attributes:()=>{var r;return!this.editor.isEditable&&this.options.value===void 0?{}:{tabindex:(r=this.options.value)!=null?r:"0"}}}})]}}),mo=U.create({name:"textDirection",addOptions(){return{direction:void 0}},addGlobalAttributes(){if(!this.options.direction)return[];const{nodeExtensions:r}=Un(this.extensions);return[{types:r.filter(e=>e.name!=="text").map(e=>e.name),attributes:{dir:{default:this.options.direction,parseHTML:e=>{const t=e.getAttribute("dir");return t&&(t==="ltr"||t==="rtl"||t==="auto")?t:this.options.direction},renderHTML:e=>e.dir?{dir:e.dir}:{}}}}]},addProseMirrorPlugins(){return[new Z({key:new Q("textDirection"),props:{attributes:()=>{const r=this.options.direction;return r?{dir:r}:{}}}})]}}),go={};ht(go,{createAtomBlockMarkdownSpec:()=>yo,createBlockMarkdownSpec:()=>xo,createInlineMarkdownSpec:()=>vo,parseAttributes:()=>gt,parseIndentedBlocks:()=>bo,renderNestedMarkdownContent:()=>So,serializeAttributes:()=>yt});function gt(r){if(!r?.trim())return{};const e={},t=[],n=r.replace(/["']([^"']*)["']/g,c=>(t.push(c),`__QUOTED_${t.length-1}__`)),i=n.match(/(?:^|\s)\.([a-zA-Z][\w-]*)/g);if(i){const c=i.map(f=>f.trim().slice(1));e.class=c.join(" ")}const s=n.match(/(?:^|\s)#([a-zA-Z][\w-]*)/);s&&(e.id=s[1]);const o=/([a-zA-Z][\w-]*)\s*=\s*(__QUOTED_\d+__)/g;Array.from(n.matchAll(o)).forEach(([,c,f])=>{var u;const h=parseInt(((u=f.match(/__QUOTED_(\d+)__/))==null?void 0:u[1])||"0",10),d=t[h];d&&(e[c]=d.slice(1,-1))});const a=n.replace(/(?:^|\s)\.([a-zA-Z][\w-]*)/g,"").replace(/(?:^|\s)#([a-zA-Z][\w-]*)/g,"").replace(/([a-zA-Z][\w-]*)\s*=\s*__QUOTED_\d+__/g,"").trim();return a&&a.split(/\s+/).filter(Boolean).forEach(f=>
vendor: 4,986 bytes, lines 10-21
10{f.match(/^[a-zA-Z][\w-]*$/)&&(e[f]=!0)}),e}function yt(r){if(!r||Object.keys(r).length===0)return"";const e=[];return r.class&&String(r.class).split(/\s+/).filter(Boolean).forEach(n=>e.push(`.${n}`)),r.id&&e.push(`#${r.id}`),Object.entries(r).forEach(([t,n])=>{t==="class"||t==="id"||(n===!0?e.push(t):n!==!1&&n!=null&&e.push(`${t}="${String(n)}"`))}),e.join(" ")}function yo(r){const{nodeName:e,name:t,parseAttributes:n=gt,serializeAttributes:i=yt,defaultAttributes:s={},requiredAttributes:o=[],allowedAttributes:l}=r,a=t||e,c=f=>{if(!l)return f;const u={};return l.forEach(h=>{h in f&&(u[h]=f[h])}),u};return{parseMarkdown:(f,u)=>{const h={...s,...f.attributes};return u.createNode(e,h,[])},markdownTokenizer:{name:e,level:"block",start(f){var u;const h=new RegExp(`^:::${a}(?:\\s|$)`,"m"),d=(u=f.match(h))==null?void 0:u.index;return d!==void 0?d:-1},tokenize(f,u,h){const d=new RegExp(`^:::${a}(?:\\s+\\{([^}]*)\\})?\\s*:::(?:\\n|$)`),p=f.match(d);if(!p)return;const m=p[1]||"",g=n(m);if(!o.find(k=>!(k in g)))return{type:e,raw:p[0],attributes:g}}},renderMarkdown:f=>{const u=c(f.attrs||{}),h=i(u),d=h?` {${h}}`:"";return`:::${a}${d} :::`}}}function xo(r){const{nodeName:e,name:t,getContent:n,parseAttributes:i=gt,serializeAttributes:s=yt,defaultAttributes:o={},content:l="block",allowedAttributes:a}=r,c=t||e,f=u=>{if(!a)return u;const h={};return a.forEach(d=>{d in u&&(h[d]=u[d])}),h};return{parseMarkdown:(u,h)=>{let d;if(n){const m=n(u);d=typeof m=="string"?[{type:"text",text:m}]:m}else l==="block"?d=h.parseChildren(u.tokens||[]):d=h.parseInline(u.tokens||[]);const p={...o,...u.attributes};return h.createNode(e,p,d)},markdownTokenizer:{name:e,level:"block",start(u){var h;const d=new RegExp(`^:::${c}`,"m"),p=(h=u.match(d))==null?void 0:h.index;return p!==void 0?p:-1},tokenize(u,h,d){var p;const m=new RegExp(`^:::${c}(?:\\s+\\{([^}]*)\\})?\\s*\\n`),g=u.match(m);if(!g)return;const[x,k=""]=g,v=i(k);let M=1;const S=x.length;let R="";const O=/^:::([\w-]*)(\s.*)?/gm,P=u.slice(S);for(O.lastIndex=0;;){const _=O.exec(P);if(_===null)break;const W=_.index,We=_[1];if(!((p=_[2])!=null&&p.endsWith(":::"))){if(We)M+=1;else if(M-=1,M===0){const ue=P.slice(0,W);R=ue.trim();const V=u.slice(0,S+W+_[0].length);let D=[];if(R)if(l==="block")for(D=d.blockTokens(ue),D.forEach($=>{$.text&&(!$.tokens||$.tokens.length===0)&&($.tokens=d.inlineTokens($.text))});D.length>0;){const $=D[D.length-1];if($.type==="paragraph"&&(!$.text||$.text.trim()===""))D.pop();else break}else D=d.inlineTokens(R);return{type:e,raw:V,attributes:v,content:R,tokens:D}}}}}},renderMarkdown:(u,h)=>{const d=f(u.attrs||{}),p=s(d),m=p?` {${p}}`:"",g=h.renderChildren(u.content||[],`
11
12`);return`:::${c}${m}
13
14${g}
15
16:::`}}}function wo(r){if(!r.trim())return{};const e={},t=/(\w+)=(?:"([^"]*)"|'([^']*)')/g;let n=t.exec(r);for(;n!==null;){const[,i,s,o]=n;e[i]=s||o,n=t.exec(r)}return e}function ko(r){return Object.entries(r).filter(([,e])=>e!=null).map(([e,t])=>`${e}="${t}"`).join(" ")}function vo(r){const{nodeName:e,name:t,getContent:n,parseAttributes:i=wo,serializeAttributes:s=ko,defaultAttributes:o={},selfClosing:l=!1,allowedAttributes:a}=r,c=t||e,f=h=>{if(!a)return h;const d={};return a.forEach(p=>{const m=typeof p=="string"?p:p.name,g=typeof p=="string"?void 0:p.skipIfDefault;if(m in h){const x=h[m];if(g!==void 0&&x===g)return;d[m]=x}}),d},u=c.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{parseMarkdown:(h,d)=>{const p={...o,...h.attributes};if(l)return d.createNode(e,p);const m=n?n(h):h.content||"";return m?d.createNode(e,p,[d.createTextNode(m)]):d.createNode(e,p,[])},markdownTokenizer:{name:e,level:"inline",start(h){const d=l?new RegExp(`\\[${u}\\s*[^\\]]*\\]`):new RegExp(`\\[${u}\\s*[^\\]]*\\][\\s\\S]*?\\[\\/${u}\\]`),p=h.match(d),m=p?.index;return m!==void 0?m:-1},tokenize(h,d,p){const m=l?new RegExp(`^\\[${u}\\s*([^\\]]*)\\]`):new RegExp(`^\\[${u}\\s*([^\\]]*)\\]([\\s\\S]*?)\\[\\/${u}\\]`),g=h.match(m);if(!g)return;let x="",k="";if(l){const[,M]=g;k=M}else{const[,M,S]=g;k=M,x=S||""}const v=i(k.trim());return{type:e,raw:g[0],content:x.trim(),attributes:v}}},renderMarkdown:h=>{let d="";n?d=n(h):h.content&&h.content.length>0&&(d=h.content.filter(x=>x.type==="text").map(x=>x.text).join(""));const p=f(h.attrs||{}),m=s(p),g=m?` ${m}`:"";return l?`[${c}${g}]`:`[${c}${g}]${d}[/${c}]`}}}function bo(r,e,t){var n,i,s,o;const l=r.split(`
17`),a=[];let c="",f=0;const u=e.baseIndentSize||2;for(;f<l.length;){const h=l[f],d=h.match(e.itemPattern);if(!d){if(a.length>0)break;if(h.trim()===""){f+=1,c=`${c}${h}
18`;continue}else return}const p=e.extractItemData(d),{indentLevel:m,mainContent:g}=p;c=`${c}${h}
19`;const x=[g];for(f+=1;f<l.length;){const S=l[f];if(S.trim()===""){const O=l.slice(f+1).findIndex(W=>W.trim()!=="");if(O===-1)break;if((((i=(n=l[f+1+O].match(/^(\s*)/))==null?void 0:n[1])==null?void 0:i.length)||0)>m){x.push(S),c=`${c}${S}
20`,f+=1;continue}else break}if((((o=(s=S.match(/^(\s*)/))==null?void 0:s[1])==null?void 0:o.length)||0)>m)x.push(S),c=`${c}${S}
21`,f+=1;else break}let k;
21const v=x.slice(1);if(v.length>0){const S=v.map(R=>R.slice(m+u)).join(`
22`);S.trim()&&(e.customNestedParser?k=e.customNestedParser(S):k=t.blockTokens(S))}const M=e.createToken(p,k);a.push(M)}if(a.length!==0)return{items:a,raw:c}}function So(r,e,t,n){if(!r||!Array.isArray(r.content))return"";const i=typeof t=="function"?t(n):t,[s,...o]=r.content,l=e.renderChildren([s]);let a=`${i}${l}`;return o&&o.length>0&&o.forEach((c,f)=>{var u,h;const d=(h=(u=e.renderChild)==null?void 0:u.call(e,c,f+1))!=null?h:e.renderChildren([c]);if(d!=null){const p=d.split(`
23`).map(m=>m?e.indent(m):e.indent("")).join(`
24`);a+=c.type==="paragraph"?`
25
26${p}`:`
27${p}`}}),a}var Co=class Yn extends mt{constructor(){super(...arguments),this.type="node"}static create(e={}){const t=typeof e=="function"?e():e;return new Yn(t)}configure(e){return super.configure(e)}extend(e){const t=typeof e=="function"?e():e;return super.extend(t)}};function Mo(r){const{removeRootFolderOfUrl:e}=ir(),t=Co.create({name:"button",group:"block",content:"inline*",renderHTML({HTMLAttributes:o}){return["button",{...o},0]}}),n=Jt.create({name:"link",renderHTML({HTMLAttributes:o}){const l={...o},{linktype:a="url"}=l;return a==="story"&&(l.href=e(sr(l.href))),a==="email"&&(l.href=`mailto:${l.href}`),l.anchor&&(l.href=`${l.href}#${l.anchor}`,delete l.anchor),["a",l,0]}}),i=Jt.create({name:"styled",renderHTML({HTMLAttributes:o}){const l={...o};return l.class?.includes("lang-en")&&(l.lang="en",l["xml:lang"]="en"),["span",l,0]}}),{render:s}=or({keyedResolvers:!0,tiptapExtensions:{button:t,link:n,styled:i}});return Ie(()=>{const o=Wt(r);if(o)return s(o)})}const Eo=_t({__name:"Index",props:{content:{},resetMargin:{type:Boolean},expandable:{type:Boolean},paragraphMaxLength:{default:294}},setup(r){const e=r,t=new Set(["blok","image","horizontal_rule","emoji"]),n=a=>t.has(a.type)?!0:a.type==="text"?a.text?.trim().length>0:a.content?.some(n)??!1,i=Ie(()=>{const a=e.content;return!!a&&typeof a=="object"&&Array.isArray(a.content)&&a.content.some(n)}),{richtext:s}=hr(()=>e.content,e.paragraphMaxLength),o=Ie(()=>e.expandable?s.value:e.content),l=Mo(o);return(a,c)=>{const f=Vt;return wt(i)?(Ee(),jt("div",{key:0,class:ar(["RichText",{"RichText--reset-margin":r.resetMargin}])},[lr(f,{node:wt(l)},null,8,["node"])],2)):cr("",!0)}}}),Ao=Object.assign(fr(Eo,[["__scopeId","data-v-0ff626a8"]]),{__name:"GlbRichText"});export{Ao as _};

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.