rhino-editor
Version:
A custom element wrapped rich text editor
1,841 lines • 492 kB
JavaScript
var $c=Object.defineProperty;var qp=(n,t,e)=>t in n?$c(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var Jp=(n,t)=>{for(var e in t)$c(n,e,{get:t[e],enumerable:!0})};var Z=(n,t,e)=>qp(n,typeof t!="symbol"?t+"":t,e);var lr=globalThis,ri=lr.trustedTypes,Ic=ri?ri.createPolicy("lit-html",{createHTML:n=>n}):void 0,Us="$lit$",ue=`lit$${Math.random().toFixed(9).slice(2)}$`,js="?"+ue,Gp=`<${js}>`,We=document,cr=()=>We.createComment(""),dr=n=>n===null||typeof n!="object"&&typeof n!="function",Ks=Array.isArray,Vc=n=>Ks(n)||typeof n?.[Symbol.iterator]=="function",Vs=`[
\f\r]`,ar=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lc=/-->/g,Bc=/>/g,je=RegExp(`>|${Vs}(?:([^\\s"'>=/]+)(${Vs}*=${Vs}*(?:[^
\f\r"'\`<>=]|("|')|))|$)`,"g"),zc=/'/g,Hc=/"/g,Uc=/^(?:script|style|textarea|title)$/i,Ws=n=>(t,...e)=>({_$litType$:n,strings:t,values:e}),T=Ws(1),nt=Ws(2),Ix=Ws(3),Ut=Symbol.for("lit-noChange"),U=Symbol.for("lit-nothing"),Fc=new WeakMap,Ke=We.createTreeWalker(We,129);function jc(n,t){if(!Ks(n)||!n.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ic!==void 0?Ic.createHTML(t):t}var Kc=(n,t)=>{let e=n.length-1,r=[],i,o=t===2?"<svg>":t===3?"<math>":"",s=ar;for(let a=0;a<e;a++){let l=n[a],c,d,u=-1,h=0;for(;h<l.length&&(s.lastIndex=h,d=s.exec(l),d!==null);)h=s.lastIndex,s===ar?d[1]==="!--"?s=Lc:d[1]!==void 0?s=Bc:d[2]!==void 0?(Uc.test(d[2])&&(i=RegExp("</"+d[2],"g")),s=je):d[3]!==void 0&&(s=je):s===je?d[0]===">"?(s=i??ar,u=-1):d[1]===void 0?u=-2:(u=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?je:d[3]==='"'?Hc:zc):s===Hc||s===zc?s=je:s===Lc||s===Bc?s=ar:(s=je,i=void 0);let f=s===je&&n[a+1].startsWith("/>")?" ":"";o+=s===ar?l+Gp:u>=0?(r.push(c),l.slice(0,u)+Us+l.slice(u)+ue+f):l+ue+(u===-2?a:f)}return[jc(n,o+(n[e]||"<?>")+(t===2?"</svg>":t===3?"</math>":"")),r]},ur=class n{constructor({strings:t,_$litType$:e},r){let i;this.parts=[];let o=0,s=0,a=t.length-1,l=this.parts,[c,d]=Kc(t,e);if(this.el=n.createElement(c,r),Ke.currentNode=this.el.content,e===2||e===3){let u=this.el.content.firstChild;u.replaceWith(...u.childNodes)}for(;(i=Ke.nextNode())!==null&&l.length<a;){if(i.nodeType===1){if(i.hasAttributes())for(let u of i.getAttributeNames())if(u.endsWith(Us)){let h=d[s++],f=i.getAttribute(u).split(ue),p=/([.?@])?(.*)/.exec(h);l.push({type:1,index:o,name:p[2],strings:f,ctor:p[1]==="."?oi:p[1]==="?"?si:p[1]==="@"?ai:Je}),i.removeAttribute(u)}else u.startsWith(ue)&&(l.push({type:6,index:o}),i.removeAttribute(u));if(Uc.test(i.tagName)){let u=i.textContent.split(ue),h=u.length-1;if(h>0){i.textContent=ri?ri.emptyScript:"";for(let f=0;f<h;f++)i.append(u[f],cr()),Ke.nextNode(),l.push({type:2,index:++o});i.append(u[h],cr())}}}else if(i.nodeType===8)if(i.data===js)l.push({type:2,index:o});else{let u=-1;for(;(u=i.data.indexOf(ue,u+1))!==-1;)l.push({type:7,index:o}),u+=ue.length-1}o++}}static createElement(t,e){let r=We.createElement("template");return r.innerHTML=t,r}};function qe(n,t,e=n,r){if(t===Ut)return t;let i=r!==void 0?e.o?.[r]:e.l,o=dr(t)?void 0:t._$litDirective$;return i?.constructor!==o&&(i?._$AO?.(!1),o===void 0?i=void 0:(i=new o(n),i._$AT(n,e,r)),r!==void 0?(e.o??(e.o=[]))[r]=i:e.l=i),i!==void 0&&(t=qe(n,i._$AS(n,t.values),i,r)),t}var ii=class{constructor(t,e){this._$AV=[],this._$AN=void 0,this._$AD=t,this._$AM=e}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(t){let{el:{content:e},parts:r}=this._$AD,i=(t?.creationScope??We).importNode(e,!0);Ke.currentNode=i;let o=Ke.nextNode(),s=0,a=0,l=r[0];for(;l!==void 0;){if(s===l.index){let c;l.type===2?c=new En(o,o.nextSibling,this,t):l.type===1?c=new l.ctor(o,l.name,l.strings,this,t):l.type===6&&(c=new li(o,this,t)),this._$AV.push(c),l=r[++a]}s!==l?.index&&(o=Ke.nextNode(),s++)}return Ke.currentNode=We,i}p(t){let e=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(t,r,e),e+=r.strings.length-2):r._$AI(t[e])),e++}},En=class n{get _$AU(){return this._$AM?._$AU??this.v}constructor(t,e,r,i){this.type=2,this._$AH=U,this._$AN=void 0,this._$AA=t,this._$AB=e,this._$AM=r,this.options=i,this.v=i?.isConnected??!0}get parentNode(){let t=this._$AA.parentNode,e=this._$AM;return e!==void 0&&t?.nodeType===11&&(t=e.parentNode),t}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(t,e=this){t=qe(this,t,e),dr(t)?t===U||t==null||t===""?(this._$AH!==U&&this._$AR(),this._$AH=U):t!==this._$AH&&t!==Ut&&this._(t):t._$litType$!==void 0?this.$(t):t.nodeType!==void 0?this.T(t):Vc(t)?this.k(t):this._(t)}O(t){return this._$AA.parentNode.insertBefore(t,this._$AB)}T(t){this._$AH!==t&&(this._$AR(),this._$AH=this.O(t))}_(t){this._$AH!==U&&dr(this._$AH)?this._$AA.nextSibling.data=t:this.T(We.createTextNode(t)),this._$AH=t}$(t){let{values:e,_$litType$:r}=t,i=typeof r=="number"?this._$AC(t):(r.el===void 0&&(r.el=ur.createElement(jc(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(e);else{let o=new ii(i,this),s=o.u(this.options);o.p(e),this.T(s),this._$AH=o}}_$AC(t){let e=Fc.get(t.strings);return e===void 0&&Fc.set(t.strings,e=new ur(t)),e}k(t){Ks(this._$AH)||(this._$AH=[],this._$AR());let e=this._$AH,r,i=0;for(let o of t)i===e.length?e.push(r=new n(this.O(cr()),this.O(cr()),this,this.options)):r=e[i],r._$AI(o),i++;i<e.length&&(this._$AR(r&&r._$AB.nextSibling,i),e.length=i)}_$AR(t=this._$AA.nextSibling,e){for(this._$AP?.(!1,!0,e);t&&t!==this._$AB;){let r=t.nextSibling;t.remove(),t=r}}setConnected(t){this._$AM===void 0&&(this.v=t,this._$AP?.(t))}},Je=class{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(t,e,r,i,o){this.type=1,this._$AH=U,this._$AN=void 0,this.element=t,this.name=e,this._$AM=i,this.options=o,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=U}_$AI(t,e=this,r,i){let o=this.strings,s=!1;if(o===void 0)t=qe(this,t,e,0),s=!dr(t)||t!==this._$AH&&t!==Ut,s&&(this._$AH=t);else{let a=t,l,c;for(t=o[0],l=0;l<o.length-1;l++)c=qe(this,a[r+l],e,l),c===Ut&&(c=this._$AH[l]),s||(s=!dr(c)||c!==this._$AH[l]),c===U?t=U:t!==U&&(t+=(c??"")+o[l+1]),this._$AH[l]=c}s&&!i&&this.j(t)}j(t){t===U?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,t??"")}},oi=class extends Je{constructor(){super(...arguments),this.type=3}j(t){this.element[this.name]=t===U?void 0:t}},si=class extends Je{constructor(){super(...arguments),this.type=4}j(t){this.element.toggleAttribute(this.name,!!t&&t!==U)}},ai=class extends Je{constructor(t,e,r,i,o){super(t,e,r,i,o),this.type=5}_$AI(t,e=this){if((t=qe(this,t,e,0)??U)===Ut)return;let r=this._$AH,i=t===U&&r!==U||t.capture!==r.capture||t.once!==r.once||t.passive!==r.passive,o=t!==U&&(r===U||i);i&&this.element.removeEventListener(this.name,this,r),o&&this.element.addEventListener(this.name,this,t),this._$AH=t}handleEvent(t){typeof this._$AH=="function"?this._$AH.call(this.options?.host??this.element,t):this._$AH.handleEvent(t)}},li=class{constructor(t,e,r){this.element=t,this.type=6,this._$AN=void 0,this._$AM=e,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(t){qe(this,t)}},Wc={M:Us,P:ue,A:js,C:1,L:Kc,R:ii,D:Vc,V:qe,I:En,H:Je,N:si,U:ai,B:oi,F:li},Yp=lr.litHtmlPolyfillSupport;Yp?.(ur,En),(lr.litHtmlVersions??(lr.litHtmlVersions=[])).push("3.2.0");var ci=(n,t,e)=>{let r=e?.renderBefore??t,i=r._$litPart$;if(i===void 0){let o=e?.renderBefore??null;r._$litPart$=i=new En(t.insertBefore(cr(),o),o,void 0,e??{})}return i._$AI(n),i};var{I:zx}=Wc;var qc=n=>n.strings===void 0;var An={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},Ge=n=>(...t)=>({_$litDirective$:n,values:t}),Me=class{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,e,r){this.t=t,this._$AM=e,this.i=r}_$AS(t,e){return this.update(t,e)}update(t,e){return this.render(...e)}};var hr=(n,t)=>{let e=n._$AN;if(e===void 0)return!1;for(let r of e)r._$AO?.(t,!1),hr(r,t);return!0},di=n=>{let t,e;do{if((t=n._$AM)===void 0)break;e=t._$AN,e.delete(n),n=t}while(e?.size===0)},Jc=n=>{for(let t;t=n._$AM;n=t){let e=t._$AN;if(e===void 0)t._$AN=e=new Set;else if(e.has(n))break;e.add(n),Zp(t)}};function Xp(n){this._$AN!==void 0?(di(this),this._$AM=n,Jc(this)):this._$AM=n}function Qp(n,t=!1,e=0){let r=this._$AH,i=this._$AN;if(i!==void 0&&i.size!==0)if(t)if(Array.isArray(r))for(let o=e;o<r.length;o++)hr(r[o],!1),di(r[o]);else r!=null&&(hr(r,!1),di(r));else hr(this,n)}var Zp=n=>{n.type==An.CHILD&&(n._$AP??(n._$AP=Qp),n._$AQ??(n._$AQ=Xp))},ui=class extends Me{constructor(){super(...arguments),this._$AN=void 0}_$AT(t,e,r){super._$AT(t,e,r),Jc(this),this.isConnected=t._$AU}_$AO(t,e=!0){t!==this.isConnected&&(this.isConnected=t,t?this.reconnected?.():this.disconnected?.()),e&&(hr(this,t),di(this))}setValue(t){if(qc(this.t))this.t._$AI(t,this);else{let e=[...this.t._$AH];e[this.i]=t,this.t._$AI(e,this,0)}}disconnected(){}reconnected(){}};var Gc=()=>new Js,Js=class{},qs=new WeakMap,Yc=Ge(class extends ui{render(n){return U}update(n,[t]){let e=t!==this.Y;return e&&this.Y!==void 0&&this.rt(void 0),(e||this.lt!==this.ct)&&(this.Y=t,this.ht=n.options?.host,this.rt(this.ct=n.element)),U}rt(n){if(this.isConnected||(n=void 0),typeof this.Y=="function"){let t=this.ht??globalThis,e=qs.get(t);e===void 0&&(e=new WeakMap,qs.set(t,e)),e.get(this.Y)!==void 0&&this.Y.call(this.ht,void 0),e.set(this.Y,n),n!==void 0&&this.Y.call(this.ht,n)}else this.Y.value=n}get lt(){return typeof this.Y=="function"?qs.get(this.ht??globalThis)?.get(this.Y):this.Y?.value}disconnected(){this.lt===this.ct&&this.rt(void 0)}reconnected(){this.rt(this.ct)}});var hi=globalThis,fi=hi.ShadowRoot&&(hi.ShadyCSS===void 0||hi.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Gs=Symbol(),Xc=new WeakMap,fr=class{constructor(t,e,r){if(this._$cssResult$=!0,r!==Gs)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=e}get styleSheet(){let t=this.o,e=this.t;if(fi&&t===void 0){let r=e!==void 0&&e.length===1;r&&(t=Xc.get(e)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),r&&Xc.set(e,t))}return t}toString(){return this.cssText}},Qc=n=>new fr(typeof n=="string"?n:n+"",void 0,Gs),G=(n,...t)=>{let e=n.length===1?n[0]:t.reduce((r,i,o)=>r+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+n[o+1],n[0]);return new fr(e,n,Gs)},Ys=(n,t)=>{if(fi)n.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let e of t){let r=document.createElement("style"),i=hi.litNonce;i!==void 0&&r.setAttribute("nonce",i),r.textContent=e.cssText,n.appendChild(r)}},pi=fi?n=>n:n=>n instanceof CSSStyleSheet?(t=>{let e="";for(let r of t.cssRules)e+=r.cssText;return Qc(e)})(n):n;var{is:tm,defineProperty:em,getOwnPropertyDescriptor:nm,getOwnPropertyNames:rm,getOwnPropertySymbols:im,getPrototypeOf:om}=Object,Te=globalThis,Zc=Te.trustedTypes,sm=Zc?Zc.emptyScript:"",am=Te.reactiveElementPolyfillSupport,pr=(n,t)=>n,Xs={toAttribute(n,t){switch(t){case Boolean:n=n?sm:null;break;case Object:case Array:n=n==null?n:JSON.stringify(n)}return n},fromAttribute(n,t){let e=n;switch(t){case Boolean:e=n!==null;break;case Number:e=n===null?null:Number(n);break;case Object:case Array:try{e=JSON.parse(n)}catch{e=null}}return e}},ed=(n,t)=>!tm(n,t),td={attribute:!0,type:String,converter:Xs,reflect:!1,hasChanged:ed};Symbol.metadata??(Symbol.metadata=Symbol("metadata")),Te.litPropertyMetadata??(Te.litPropertyMetadata=new WeakMap);var he=class extends HTMLElement{static addInitializer(t){this._$Ei(),(this.l??(this.l=[])).push(t)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(t,e=td){if(e.state&&(e.attribute=!1),this._$Ei(),this.elementProperties.set(t,e),!e.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(t,r,e);i!==void 0&&em(this.prototype,t,i)}}static getPropertyDescriptor(t,e,r){let{get:i,set:o}=nm(this.prototype,t)??{get(){return this[e]},set(s){this[e]=s}};return{get(){return i?.call(this)},set(s){let a=i?.call(this);o.call(this,s),this.requestUpdate(t,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)??td}static _$Ei(){if(this.hasOwnProperty(pr("elementProperties")))return;let t=om(this);t.finalize(),t.l!==void 0&&(this.l=[...t.l]),this.elementProperties=new Map(t.elementProperties)}static finalize(){if(this.hasOwnProperty(pr("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(pr("properties"))){let e=this.properties,r=[...rm(e),...im(e)];for(let i of r)this.createProperty(i,e[i])}let t=this[Symbol.metadata];if(t!==null){let e=litPropertyMetadata.get(t);if(e!==void 0)for(let[r,i]of e)this.elementProperties.set(r,i)}this._$Eh=new Map;for(let[e,r]of this.elementProperties){let i=this._$Eu(e,r);i!==void 0&&this._$Eh.set(i,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(t){let e=[];if(Array.isArray(t)){let r=new Set(t.flat(1/0).reverse());for(let i of r)e.unshift(pi(i))}else t!==void 0&&e.push(pi(t));return e}static _$Eu(t,e){let r=e.attribute;return r===!1?void 0:typeof r=="string"?r:typeof t=="string"?t.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(t=>t(this))}addController(t){(this._$EO??(this._$EO=new Set)).add(t),this.renderRoot!==void 0&&this.isConnected&&t.hostConnected?.()}removeController(t){this._$EO?.delete(t)}_$E_(){let t=new Map,e=this.constructor.elementProperties;for(let r of e.keys())this.hasOwnProperty(r)&&(t.set(r,this[r]),delete this[r]);t.size>0&&(this._$Ep=t)}createRenderRoot(){let t=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return Ys(t,this.constructor.elementStyles),t}connectedCallback(){this.renderRoot??(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),this._$EO?.forEach(t=>t.hostConnected?.())}enableUpdating(t){}disconnectedCallback(){this._$EO?.forEach(t=>t.hostDisconnected?.())}attributeChangedCallback(t,e,r){this._$AK(t,r)}_$EC(t,e){let r=this.constructor.elementProperties.get(t),i=this.constructor._$Eu(t,r);if(i!==void 0&&r.reflect===!0){let o=(r.converter?.toAttribute!==void 0?r.converter:Xs).toAttribute(e,r.type);this._$Em=t,o==null?this.removeAttribute(i):this.setAttribute(i,o),this._$Em=null}}_$AK(t,e){let r=this.constructor,i=r._$Eh.get(t);if(i!==void 0&&this._$Em!==i){let o=r.getPropertyOptions(i),s=typeof o.converter=="function"?{fromAttribute:o.converter}:o.converter?.fromAttribute!==void 0?o.converter:Xs;this._$Em=i,this[i]=s.fromAttribute(e,o.type),this._$Em=null}}requestUpdate(t,e,r){if(t!==void 0){if(r??(r=this.constructor.getPropertyOptions(t)),!(r.hasChanged??ed)(this[t],e))return;this.P(t,e,r)}this.isUpdatePending===!1&&(this._$ES=this._$ET())}P(t,e,r){this._$AL.has(t)||this._$AL.set(t,e),r.reflect===!0&&this._$Em!==t&&(this._$Ej??(this._$Ej=new Set)).add(t)}async _$ET(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??(this.renderRoot=this.createRenderRoot()),this._$Ep){for(let[i,o]of this._$Ep)this[i]=o;this._$Ep=void 0}let r=this.constructor.elementProperties;if(r.size>0)for(let[i,o]of r)o.wrapped!==!0||this._$AL.has(i)||this[i]===void 0||this.P(i,this[i],o)}let t=!1,e=this._$AL;try{t=this.shouldUpdate(e),t?(this.willUpdate(e),this._$EO?.forEach(r=>r.hostUpdate?.()),this.update(e)):this._$EU()}catch(r){throw t=!1,this._$EU(),r}t&&this._$AE(e)}willUpdate(t){}_$AE(t){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$EU(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(t){return!0}update(t){this._$Ej&&(this._$Ej=this._$Ej.forEach(e=>this._$EC(e,this[e]))),this._$EU()}updated(t){}firstUpdated(t){}};he.elementStyles=[],he.shadowRootOptions={mode:"open"},he[pr("elementProperties")]=new Map,he[pr("finalized")]=new Map,am?.({ReactiveElement:he}),(Te.reactiveElementVersions??(Te.reactiveElementVersions=[])).push("2.0.4");var Xt=class extends he{constructor(){super(...arguments),this.renderOptions={host:this},this.o=void 0}createRenderRoot(){var e;let t=super.createRenderRoot();return(e=this.renderOptions).renderBefore??(e.renderBefore=t.firstChild),t}update(t){let e=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this.o=ci(e,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this.o?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this.o?.setConnected(!1)}render(){return Ut}};Xt._$litElement$=!0,Xt.finalized=!0,globalThis.litElementHydrateSupport?.({LitElement:Xt});var lm=globalThis.litElementPolyfillSupport;lm?.({LitElement:Xt});(globalThis.litElementVersions??(globalThis.litElementVersions=[])).push("4.1.0");var cm=G`
:host,
.trix-content {
/* General tokens */
--rhino-focus-ring: 0px 0px 1px 1px var(--rhino-button-active-border-color);
--rhino-border-radius: 4px;
--rhino-danger-border-color: red;
--rhino-danger-background-color: #ffdddd;
/* Editor tokens */
--rhino-text-color: #374151;
--rhino-dark-text-color: white;
--rhino-border-color: #cecece;
--rhino-placeholder-text-color: #cecece;
--rhino-dark-placeholder-text-color: gray;
/* Regular buttons */
--rhino-button-text-color: #889;
--rhino-button-dark-text-color: #eee;
--rhino-button-border-color: #cecece;
/** Disabled Buttons */
--rhino-button-disabled-text-color: #d1d5db;
--rhino-button-disabled-border-color: #d1d5db;
--rhino-button-disabled-background-color: #d1d5db;
/** Active buttons */
--rhino-button-active-border-color: #005a9c;
--rhino-button-active-background-color: rgb(226 239 255);
--rhino-toolbar-text-color: hsl(219, 6%, 43%);
--rhino-toolbar-icon-size: 1em;
--rhino-dialog-border-color: hsl(
var(--rhino-button-focus-background-color-hsl) / 50%
);
/** Focus buttons */
--rhino-button-focus-background-color: hsl(
var(--rhino-button-focus-background-color-hsl)
);
--rhino-button-focus-background-color-hsl: 219 26% 95%;
/**
* Override "--rhino-fake-selection-color" to change the color of .rhino-selection when the editor is not focused.
*/
--rhino-fake-selection-color: rgb(220, 220, 220);
display: block;
color: var(--rhino-text-color);
color: light-dark(var(--rhino-text-color), var(--rhino-dark-text-color));
}
`,mv=G`
/**
* Cursor styles that are useful for providing a more "pleasant" editor experience.
*/
/**
* https://github.com/curvenote/editor/blob/main/packages/prosemirror-codemark/src/codemark.css
*/
@keyframes rhino-blink {
49% {
border-color: unset;
}
50% {
border-color: Canvas;
}
99% {
border-color: Canvas;
}
}
.rhino-editor .no-cursor {
caret-color: transparent;
}
:where(.rhino-editor) .fake-cursor {
margin: 0;
padding: 0;
margin-right: -1px;
border-left-width: 1px;
border-left-style: solid;
animation: rhino-blink 1s;
animation-iteration-count: infinite;
position: relative;
z-index: 1;
}
/** This is for actual "selection" which are highlighting more than 1 character. */
:where(.rhino-editor .ProseMirror):not(:focus-within) .rhino-selection {
background: var(--rhino-fake-selection-color);
}
.ProseMirror-separator {
display: none !important;
}
`,nd=G`
.rhino-toolbar-button {
appearance: none;
-webkit-appearance: none;
border: 1px solid var(--rhino-border-color);
border-radius: var(--rhino-border-radius);
padding: 0.4em;
color: var(--rhino-button-text-color);
color: light-dark(
var(--rhino-button-text-color),
var(--rhino-button-dark-text-color)
);
background: Canvas;
font-size: inherit;
display: inline-grid;
}
.rhino-toolbar-button:is([aria-disabled="true"], :disabled) {
color: var(--rhino-button-disabled-text-color);
border-color: var(--rhino-button-disabled-border-color);
}
.rhino-toolbar-button[aria-disabled="true"]:focus {
border-color: var(--rhino-button-disabled-border-color);
}
.rhino-toolbar-button svg {
min-height: var(--rhino-toolbar-icon-size);
min-width: var(--rhino-toolbar-icon-size);
/* max-height / max-width needs to be set for safari */
max-height: var(--rhino-toolbar-icon-size);
max-width: var(--rhino-toolbar-icon-size);
}
.rhino-toolbar-button:is(:focus, :hover):not(
[aria-disabled="true"],
:disabled
) {
outline: transparent;
border-color: var(--rhino-button-active-border-color);
}
.rhino-toolbar-button:is(:focus):not([aria-disabled="true"], :disabled) {
box-shadow: var(--rhino-focus-ring);
}
/* Only change the background color in certain scenarios */
.rhino-toolbar-button:is(:hover):not(
[aria-disabled="true"],
:disabled,
[aria-pressed="true"],
[part~="toolbar__button--active"]
) {
background-color: var(--rhino-button-focus-background-color);
background-color: light-dark(
var(--rhino-button-focus-background-color),
gray
);
}
.rhino-toolbar-button:is([aria-disabled="true"], :disabled):not(
[part~="toolbar__button--active"]
) {
color: var(--rhino-button-disabled-text-color);
color: light-dark(var(--rhino-button-disabled-text-color), gray);
border-color: var(--rhino-button-disabled-border-color);
}
.rhino-toolbar-button:is(:focus, :hover):is(
[aria-disabled="true"],
:disabled
):not([part~="toolbar__button--active"]) {
outline: transparent;
color: var(--rhino-button-disabled-text-color);
color: light-dark(var(--rhino-button-disabled-text-color), gray);
border-color: var(--rhino-button-disabled-border-color);
box-shadow: 0 0 0 1px var(--rhino-button-disabled-border-color);
box-shadow: 0 0 0 1px
light-dark(var(--rhino-button-disabled-border-color), transparent);
}
`,rd=G`
${cm}
[part~="toolbar"] {
color: var(--rhino-toolbar-text-color);
}
[part~="toolbar"]::part(base) {
border-color: var(--rhino-border-color);
border-bottom-color: transparent;
border-width: 1px;
border-radius: 4px;
border-bottom-right-radius: 0px;
border-bottom-left-radius: 0px;
display: flex;
align-items: center;
overflow: auto;
}
[part~="toolbar"][part~="bubble-menu__toolbar"]::part(base) {
border: 1px solid var(--rhino-border-color);
border-radius: 4px;
padding: 4px;
background: Canvas;
}
[part~="toolbar"]::part(base):is(:focus-visible, :focus-within) {
border-color: var(--rhino-button-active-border-color);
outline: transparent;
}
.rhino-toolbar-button[part~="toolbar__button--active"],
.rhino-toolbar-button[part~="toolbar__button--active"]:is(
:hover,
:focus-within
) {
background-color: var(--rhino-button-active-background-color);
}
slot[name="toolbar"]
:is(
[part~="toolbar__button--link"],
[part~="toolbar__button--increase-indentation"]
) {
margin-inline-end: 1rem;
}
[part~="toolbar__button--attach-files"] {
margin-inline-end: auto;
}
role-anchored-region {
font-size: 0.8em;
--background: transparent;
--border-color: transparent;
}
role-anchored-region::part(popover) {
border: none;
}
.link-dialog__container {
display: flex;
align-items: center;
max-width: 600px;
border: 1px solid gray;
padding: 0.4em;
background: Canvas;
border-radius: 8px;
}
.link-dialog__input {
border: 1px solid var(--rhino-border-color);
border-radius: var(--rhino-border-radius);
padding: 0.4em 0.6em;
flex: 1 1 auto;
}
.link-dialog__input:is(:focus) {
outline: transparent;
border-color: var(--rhino-button-active-border-color);
}
.link-validate:invalid {
outline: transparent;
background-color: var(--rhino-danger-background-color);
border-color: var(--rhino-danger-border-color);
box-shadow: none;
}
.rhino-toolbar-button.link-dialog__button {
padding: 0.4em 0.6em;
border: 1px solid var(--rhino-button-border-color);
border-radius: var(--rhino-border-radius);
}
.link-dialog__buttons {
margin-inline-start: 0.5em;
}
.editor-wrapper {
position: relative;
}
.trix-content {
border: 1px solid var(--rhino-border-color);
border-radius: 0px 0px var(--rhino-border-radius) var(--rhino-border-radius);
margin: 0;
padding: 0.4em 0.6em;
min-height: 200px;
outline: transparent;
white-space: pre-wrap;
}
role-tooltip {
position: fixed;
top: 0;
left: 0;
font-size: 0.75em;
--background: CanvasText;
color: Canvas;
--border-color: CanvasText;
}
role-tooltip::part(popover) {
padding: 0.4em 0.6em;
}
svg,
::slotted(svg) {
height: var(--rhino-toolbar-icon-size);
width: var(--rhino-toolbar-icon-size);
}
`;var Ye=class extends Xt{static define(t,e,r){t==null&&(t=this.baseName),e==null&&(e=this),!this.customElementRegistry.get(t)&&this.customElementRegistry.define(t,dm(e),r)}constructor(){super();try{this.internals=this.attachInternals()}catch(t){console.error(t)}}addCustomState(t){try{this.internals?.states.add(t)}catch{}}deleteCustomState(t){try{this.internals?.states.delete(t)}catch{}}hasCustomState(t){try{return this.internals?.states.has(t)}catch{return!1}}toggleCustomState(t,e){if(e==null){this.hasCustomState(t)?this.deleteCustomState(t):this.addCustomState(t);return}e===!0?this.addCustomState(t):this.deleteCustomState(t)}};Ye.customElementRegistry=window.customElements;function dm(n){return class extends n{}}function ht(n){this.content=n}ht.prototype={constructor:ht,find:function(n){for(var t=0;t<this.content.length;t+=2)if(this.content[t]===n)return t;return-1},get:function(n){var t=this.find(n);return t==-1?void 0:this.content[t+1]},update:function(n,t,e){var r=e&&e!=n?this.remove(e):this,i=r.find(n),o=r.content.slice();return i==-1?o.push(e||n,t):(o[i+1]=t,e&&(o[i]=e)),new ht(o)},remove:function(n){var t=this.find(n);if(t==-1)return this;var e=this.content.slice();return e.splice(t,2),new ht(e)},addToStart:function(n,t){return new ht([n,t].concat(this.remove(n).content))},addToEnd:function(n,t){var e=this.remove(n).content.slice();return e.push(n,t),new ht(e)},addBefore:function(n,t,e){var r=this.remove(t),i=r.content.slice(),o=r.find(n);return i.splice(o==-1?i.length:o,0,t,e),new ht(i)},forEach:function(n){for(var t=0;t<this.content.length;t+=2)n(this.content[t],this.content[t+1])},prepend:function(n){return n=ht.from(n),n.size?new ht(n.content.concat(this.subtract(n).content)):this},append:function(n){return n=ht.from(n),n.size?new ht(this.subtract(n).content.concat(n.content)):this},subtract:function(n){var t=this;n=ht.from(n);for(var e=0;e<n.content.length;e+=2)t=t.remove(n.content[e]);return t},toObject:function(){var n={};return this.forEach(function(t,e){n[t]=e}),n},get size(){return this.content.length>>1}};ht.from=function(n){if(n instanceof ht)return n;var t=[];if(n)for(var e in n)t.push(e,n[e]);return new ht(t)};var Qs=ht;function fd(n,t,e){for(let r=0;;r++){if(r==n.childCount||r==t.childCount)return n.childCount==t.childCount?null:e;let i=n.child(r),o=t.child(r);if(i==o){e+=i.nodeSize;continue}if(!i.sameMarkup(o))return e;if(i.isText&&i.text!=o.text){for(let s=0;i.text[s]==o.text[s];s++)e++;return e}if(i.content.size||o.content.size){let s=fd(i.content,o.content,e+1);if(s!=null)return s}e+=i.nodeSize}}function pd(n,t,e,r){for(let i=n.childCount,o=t.childCount;;){if(i==0||o==0)return i==o?null:{a:e,b:r};let s=n.child(--i),a=t.child(--o),l=s.nodeSize;if(s==a){e-=l,r-=l;continue}if(!s.sameMarkup(a))return{a:e,b:r};if(s.isText&&s.text!=a.text){let c=0,d=Math.min(s.text.length,a.text.length);for(;c<d&&s.text[s.text.length-c-1]==a.text[a.text.length-c-1];)c++,e--,r--;return{a:e,b:r}}if(s.content.size||a.content.size){let c=pd(s.content,a.content,e-1,r-1);if(c)return c}e-=l,r-=l}}var w=class n{constructor(t,e){if(this.content=t,this.size=e||0,e==null)for(let r=0;r<t.length;r++)this.size+=t[r].nodeSize}nodesBetween(t,e,r,i=0,o){for(let s=0,a=0;a<e;s++){let l=this.content[s],c=a+l.nodeSize;if(c>t&&r(l,i+a,o||null,s)!==!1&&l.content.size){let d=a+1;l.nodesBetween(Math.max(0,t-d),Math.min(l.content.size,e-d),r,i+d)}a=c}}descendants(t){this.nodesBetween(0,this.size,t)}textBetween(t,e,r,i){let o="",s=!0;return this.nodesBetween(t,e,(a,l)=>{let c=a.isText?a.text.slice(Math.max(t,l)-l,e-l):a.isLeaf?i?typeof i=="function"?i(a):i:a.type.spec.leafText?a.type.spec.leafText(a):"":"";a.isBlock&&(a.isLeaf&&c||a.isTextblock)&&r&&(s?s=!1:o+=r),o+=c},0),o}append(t){if(!t.size)return this;if(!this.size)return t;let e=this.lastChild,r=t.firstChild,i=this.content.slice(),o=0;for(e.isText&&e.sameMarkup(r)&&(i[i.length-1]=e.withText(e.text+r.text),o=1);o<t.content.length;o++)i.push(t.content[o]);return new n(i,this.size+t.size)}cut(t,e=this.size){if(t==0&&e==this.size)return this;let r=[],i=0;if(e>t)for(let o=0,s=0;s<e;o++){let a=this.content[o],l=s+a.nodeSize;l>t&&((s<t||l>e)&&(a.isText?a=a.cut(Math.max(0,t-s),Math.min(a.text.length,e-s)):a=a.cut(Math.max(0,t-s-1),Math.min(a.content.size,e-s-1))),r.push(a),i+=a.nodeSize),s=l}return new n(r,i)}cutByIndex(t,e){return t==e?n.empty:t==0&&e==this.content.length?this:new n(this.content.slice(t,e))}replaceChild(t,e){let r=this.content[t];if(r==e)return this;let i=this.content.slice(),o=this.size+e.nodeSize-r.nodeSize;return i[t]=e,new n(i,o)}addToStart(t){return new n([t].concat(this.content),this.size+t.nodeSize)}addToEnd(t){return new n(this.content.concat(t),this.size+t.nodeSize)}eq(t){if(this.content.length!=t.content.length)return!1;for(let e=0;e<this.content.length;e++)if(!this.content[e].eq(t.content[e]))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(t){let e=this.content[t];if(!e)throw new RangeError("Index "+t+" out of range for "+this);return e}maybeChild(t){return this.content[t]||null}forEach(t){for(let e=0,r=0;e<this.content.length;e++){let i=this.content[e];t(i,r,e),r+=i.nodeSize}}findDiffStart(t,e=0){return fd(this,t,e)}findDiffEnd(t,e=this.size,r=t.size){return pd(this,t,e,r)}findIndex(t,e=-1){if(t==0)return mi(0,t);if(t==this.size)return mi(this.content.length,t);if(t>this.size||t<0)throw new RangeError(`Position ${t} outside of fragment (${this})`);for(let r=0,i=0;;r++){let o=this.child(r),s=i+o.nodeSize;if(s>=t)return s==t||e>0?mi(r+1,s):mi(r,i);i=s}}toString(){return"<"+this.toStringInner()+">"}toStringInner(){return this.content.join(", ")}toJSON(){return this.content.length?this.content.map(t=>t.toJSON()):null}static fromJSON(t,e){if(!e)return n.empty;if(!Array.isArray(e))throw new RangeError("Invalid input for Fragment.fromJSON");return new n(e.map(t.nodeFromJSON))}static fromArray(t){if(!t.length)return n.empty;let e,r=0;for(let i=0;i<t.length;i++){let o=t[i];r+=o.nodeSize,i&&o.isText&&t[i-1].sameMarkup(o)?(e||(e=t.slice(0,i)),e[e.length-1]=o.withText(e[e.length-1].text+o.text)):e&&e.push(o)}return new n(e||t,r)}static from(t){if(!t)return n.empty;if(t instanceof n)return t;if(Array.isArray(t))return this.fromArray(t);if(t.attrs)return new n([t],t.nodeSize);throw new RangeError("Can not convert "+t+" to a Fragment"+(t.nodesBetween?" (looks like multiple versions of prosemirror-model were loaded)":""))}};w.empty=new w([],0);var Zs={index:0,offset:0};function mi(n,t){return Zs.index=n,Zs.offset=t,Zs}function bi(n,t){if(n===t)return!0;if(!(n&&typeof n=="object")||!(t&&typeof t=="object"))return!1;let e=Array.isArray(n);if(Array.isArray(t)!=e)return!1;if(e){if(n.length!=t.length)return!1;for(let r=0;r<n.length;r++)if(!bi(n[r],t[r]))return!1}else{for(let r in n)if(!(r in t)||!bi(n[r],t[r]))return!1;for(let r in t)if(!(r in n))return!1}return!0}var z=class n{constructor(t,e){this.type=t,this.attrs=e}addToSet(t){let e,r=!1;for(let i=0;i<t.length;i++){let o=t[i];if(this.eq(o))return t;if(this.type.excludes(o.type))e||(e=t.slice(0,i));else{if(o.type.excludes(this.type))return t;!r&&o.type.rank>this.type.rank&&(e||(e=t.slice(0,i)),e.push(this),r=!0),e&&e.push(o)}}return e||(e=t.slice()),r||e.push(this),e}removeFromSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return t.slice(0,e).concat(t.slice(e+1));return t}isInSet(t){for(let e=0;e<t.length;e++)if(this.eq(t[e]))return!0;return!1}eq(t){return this==t||this.type==t.type&&bi(this.attrs,t.attrs)}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Mark.fromJSON");let r=t.marks[e.type];if(!r)throw new RangeError(`There is no mark type ${e.type} in this schema`);let i=r.create(e.attrs);return r.checkAttrs(i.attrs),i}static sameSet(t,e){if(t==e)return!0;if(t.length!=e.length)return!1;for(let r=0;r<t.length;r++)if(!t[r].eq(e[r]))return!1;return!0}static setFrom(t){if(!t||Array.isArray(t)&&t.length==0)return n.none;if(t instanceof n)return[t];let e=t.slice();return e.sort((r,i)=>r.type.rank-i.type.rank),e}};z.none=[];var Ze=class extends Error{},M=class n{constructor(t,e,r){this.content=t,this.openStart=e,this.openEnd=r}get size(){return this.content.size-this.openStart-this.openEnd}insertAt(t,e){let r=gd(this.content,t+this.openStart,e);return r&&new n(r,this.openStart,this.openEnd)}removeBetween(t,e){return new n(md(this.content,t+this.openStart,e+this.openStart),this.openStart,this.openEnd)}eq(t){return this.content.eq(t.content)&&this.openStart==t.openStart&&this.openEnd==t.openEnd}toString(){return this.content+"("+this.openStart+","+this.openEnd+")"}toJSON(){if(!this.content.size)return null;let t={content:this.content.toJSON()};return this.openStart>0&&(t.openStart=this.openStart),this.openEnd>0&&(t.openEnd=this.openEnd),t}static fromJSON(t,e){if(!e)return n.empty;let r=e.openStart||0,i=e.openEnd||0;if(typeof r!="number"||typeof i!="number")throw new RangeError("Invalid input for Slice.fromJSON");return new n(w.fromJSON(t,e.content),r,i)}static maxOpen(t,e=!0){let r=0,i=0;for(let o=t.firstChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.firstChild)r++;for(let o=t.lastChild;o&&!o.isLeaf&&(e||!o.type.spec.isolating);o=o.lastChild)i++;return new n(t,r,i)}};M.empty=new M(w.empty,0,0);function md(n,t,e){let{index:r,offset:i}=n.findIndex(t),o=n.maybeChild(r),{index:s,offset:a}=n.findIndex(e);if(i==t||o.isText){if(a!=e&&!n.child(s).isText)throw new RangeError("Removing non-flat range");return n.cut(0,t).append(n.cut(e))}if(r!=s)throw new RangeError("Removing non-flat range");return n.replaceChild(r,o.copy(md(o.content,t-i-1,e-i-1)))}function gd(n,t,e,r){let{index:i,offset:o}=n.findIndex(t),s=n.maybeChild(i);if(o==t||s.isText)return r&&!r.canReplace(i,i,e)?null:n.cut(0,t).append(e).append(n.cut(t));let a=gd(s.content,t-o-1,e);return a&&n.replaceChild(i,s.copy(a))}function um(n,t,e){if(e.openStart>n.depth)throw new Ze("Inserted content deeper than insertion position");if(n.depth-e.openStart!=t.depth-e.openEnd)throw new Ze("Inconsistent open depths");return bd(n,t,e,0)}function bd(n,t,e,r){let i=n.index(r),o=n.node(r);if(i==t.index(r)&&r<n.depth-e.openStart){let s=bd(n,t,e,r+1);return o.copy(o.content.replaceChild(i,s))}else if(e.content.size)if(!e.openStart&&!e.openEnd&&n.depth==r&&t.depth==r){let s=n.parent,a=s.content;return Qe(s,a.cut(0,n.parentOffset).append(e.content).append(a.cut(t.parentOffset)))}else{let{start:s,end:a}=hm(e,n);return Qe(o,xd(n,s,a,t,r))}else return Qe(o,yi(n,t,r))}function yd(n,t){if(!t.type.compatibleContent(n.type))throw new Ze("Cannot join "+t.type.name+" onto "+n.type.name)}function ea(n,t,e){let r=n.node(e);return yd(r,t.node(e)),r}function Xe(n,t){let e=t.length-1;e>=0&&n.isText&&n.sameMarkup(t[e])?t[e]=n.withText(t[e].text+n.text):t.push(n)}function mr(n,t,e,r){let i=(t||n).node(e),o=0,s=t?t.index(e):i.childCount;n&&(o=n.index(e),n.depth>e?o++:n.textOffset&&(Xe(n.nodeAfter,r),o++));for(let a=o;a<s;a++)Xe(i.child(a),r);t&&t.depth==e&&t.textOffset&&Xe(t.nodeBefore,r)}function Qe(n,t){return n.type.checkContent(t),n.copy(t)}function xd(n,t,e,r,i){let o=n.depth>i&&ea(n,t,i+1),s=r.depth>i&&ea(e,r,i+1),a=[];return mr(null,n,i,a),o&&s&&t.index(i)==e.index(i)?(yd(o,s),Xe(Qe(o,xd(n,t,e,r,i+1)),a)):(o&&Xe(Qe(o,yi(n,t,i+1)),a),mr(t,e,i,a),s&&Xe(Qe(s,yi(e,r,i+1)),a)),mr(r,null,i,a),new w(a)}function yi(n,t,e){let r=[];if(mr(null,n,e,r),n.depth>e){let i=ea(n,t,e+1);Xe(Qe(i,yi(n,t,e+1)),r)}return mr(t,null,e,r),new w(r)}function hm(n,t){let e=t.depth-n.openStart,i=t.node(e).copy(n.content);for(let o=e-1;o>=0;o--)i=t.node(o).copy(w.from(i));return{start:i.resolveNoCache(n.openStart+e),end:i.resolveNoCache(i.content.size-n.openEnd-e)}}var xi=class n{constructor(t,e,r){this.pos=t,this.path=e,this.parentOffset=r,this.depth=e.length/3-1}resolveDepth(t){return t==null?this.depth:t<0?this.depth+t:t}get parent(){return this.node(this.depth)}get doc(){return this.node(0)}node(t){return this.path[this.resolveDepth(t)*3]}index(t){return this.path[this.resolveDepth(t)*3+1]}indexAfter(t){return t=this.resolveDepth(t),this.index(t)+(t==this.depth&&!this.textOffset?0:1)}start(t){return t=this.resolveDepth(t),t==0?0:this.path[t*3-1]+1}end(t){return t=this.resolveDepth(t),this.start(t)+this.node(t).content.size}before(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position before the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]}after(t){if(t=this.resolveDepth(t),!t)throw new RangeError("There is no position after the top-level node");return t==this.depth+1?this.pos:this.path[t*3-1]+this.path[t*3].nodeSize}get textOffset(){return this.pos-this.path[this.path.length-1]}get nodeAfter(){let t=this.parent,e=this.index(this.depth);if(e==t.childCount)return null;let r=this.pos-this.path[this.path.length-1],i=t.child(e);return r?t.child(e).cut(r):i}get nodeBefore(){let t=this.index(this.depth),e=this.pos-this.path[this.path.length-1];return e?this.parent.child(t).cut(0,e):t==0?null:this.parent.child(t-1)}posAtIndex(t,e){e=this.resolveDepth(e);let r=this.path[e*3],i=e==0?0:this.path[e*3-1]+1;for(let o=0;o<t;o++)i+=r.child(o).nodeSize;return i}marks(){let t=this.parent,e=this.index();if(t.content.size==0)return z.none;if(this.textOffset)return t.child(e).marks;let r=t.maybeChild(e-1),i=t.maybeChild(e);if(!r){let a=r;r=i,i=a}let o=r.marks;for(var s=0;s<o.length;s++)o[s].type.spec.inclusive===!1&&(!i||!o[s].isInSet(i.marks))&&(o=o[s--].removeFromSet(o));return o}marksAcross(t){let e=this.parent.maybeChild(this.index());if(!e||!e.isInline)return null;let r=e.marks,i=t.parent.maybeChild(t.index());for(var o=0;o<r.length;o++)r[o].type.spec.inclusive===!1&&(!i||!r[o].isInSet(i.marks))&&(r=r[o--].removeFromSet(r));return r}sharedDepth(t){for(let e=this.depth;e>0;e--)if(this.start(e)<=t&&this.end(e)>=t)return e;return 0}blockRange(t=this,e){if(t.pos<this.pos)return t.blockRange(this);for(let r=this.depth-(this.parent.inlineContent||this.pos==t.pos?1:0);r>=0;r--)if(t.pos<=this.end(r)&&(!e||e(this.node(r))))return new tn(this,t,r);return null}sameParent(t){return this.pos-this.parentOffset==t.pos-t.parentOffset}max(t){return t.pos>this.pos?t:this}min(t){return t.pos<this.pos?t:this}toString(){let t="";for(let e=1;e<=this.depth;e++)t+=(t?"/":"")+this.node(e).type.name+"_"+this.index(e-1);return t+":"+this.parentOffset}static resolve(t,e){if(!(e>=0&&e<=t.content.size))throw new RangeError("Position "+e+" out of range");let r=[],i=0,o=e;for(let s=t;;){let{index:a,offset:l}=s.content.findIndex(o),c=o-l;if(r.push(s,a,i+l),!c||(s=s.child(a),s.isText))break;o=c-1,i+=l+1}return new n(e,r,o)}static resolveCached(t,e){let r=id.get(t);if(r)for(let o=0;o<r.elts.length;o++){let s=r.elts[o];if(s.pos==e)return s}else id.set(t,r=new na);let i=r.elts[r.i]=n.resolve(t,e);return r.i=(r.i+1)%fm,i}},na=class{constructor(){this.elts=[],this.i=0}},fm=12,id=new WeakMap,tn=class{constructor(t,e,r){this.$from=t,this.$to=e,this.depth=r}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)}},pm=Object.create(null),jt=class n{constructor(t,e,r,i=z.none){this.type=t,this.attrs=e,this.marks=i,this.content=r||w.empty}get nodeSize(){return this.isLeaf?1:2+this.content.size}get childCount(){return this.content.childCount}child(t){return this.content.child(t)}maybeChild(t){return this.content.maybeChild(t)}forEach(t){this.content.forEach(t)}nodesBetween(t,e,r,i=0){this.content.nodesBetween(t,e,r,i,this)}descendants(t){this.nodesBetween(0,this.content.size,t)}get textContent(){return this.isLeaf&&this.type.spec.leafText?this.type.spec.leafText(this):this.textBetween(0,this.content.size,"")}textBetween(t,e,r,i){return this.content.textBetween(t,e,r,i)}get firstChild(){return this.content.firstChild}get lastChild(){return this.content.lastChild}eq(t){return this==t||this.sameMarkup(t)&&this.content.eq(t.content)}sameMarkup(t){return this.hasMarkup(t.type,t.attrs,t.marks)}hasMarkup(t,e,r){return this.type==t&&bi(this.attrs,e||t.defaultAttrs||pm)&&z.sameSet(this.marks,r||z.none)}copy(t=null){return t==this.content?this:new n(this.type,this.attrs,t,this.marks)}mark(t){return t==this.marks?this:new n(this.type,this.attrs,this.content,t)}cut(t,e=this.content.size){return t==0&&e==this.content.size?this:this.copy(this.content.cut(t,e))}slice(t,e=this.content.size,r=!1){if(t==e)return M.empty;let i=this.resolve(t),o=this.resolve(e),s=r?0:i.sharedDepth(e),a=i.start(s),c=i.node(s).content.cut(i.pos-a,o.pos-a);return new M(c,i.depth-s,o.depth-s)}replace(t,e,r){return um(this.resolve(t),this.resolve(e),r)}nodeAt(t){for(let e=this;;){let{index:r,offset:i}=e.content.findIndex(t);if(e=e.maybeChild(r),!e)return null;if(i==t||e.isText)return e;t-=i+1}}childAfter(t){let{index:e,offset:r}=this.content.findIndex(t);return{node:this.content.maybeChild(e),index:e,offset:r}}childBefore(t){if(t==0)return{node:null,index:0,offset:0};let{index:e,offset:r}=this.content.findIndex(t);if(r<t)return{node:this.content.child(e),index:e,offset:r};let i=this.content.child(e-1);return{node:i,index:e-1,offset:r-i.nodeSize}}resolve(t){return xi.resolveCached(this,t)}resolveNoCache(t){return xi.resolve(this,t)}rangeHasMark(t,e,r){let i=!1;return e>t&&this.nodesBetween(t,e,o=>(r.isInSet(o.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 t=this.type.name;return this.content.size&&(t+="("+this.content.toStringInner()+")"),vd(this.marks,t)}contentMatchAt(t){let e=this.type.contentMatch.matchFragment(this.content,0,t);if(!e)throw new Error("Called contentMatchAt on a node with invalid content");return e}canReplace(t,e,r=w.empty,i=0,o=r.childCount){let s=this.contentMatchAt(t).matchFragment(r,i,o),a=s&&s.matchFragment(this.content,e);if(!a||!a.validEnd)return!1;for(let l=i;l<o;l++)if(!this.type.allowsMarks(r.child(l).marks))return!1;return!0}canReplaceWith(t,e,r,i){if(i&&!this.type.allowsMarks(i))return!1;let o=this.contentMatchAt(t).matchType(r),s=o&&o.matchFragment(this.content,e);return s?s.validEnd:!1}canAppend(t){return t.content.size?this.canReplace(this.childCount,this.childCount,t.content):this.type.compatibleContent(t.type)}check(){this.type.checkContent(this.content),this.type.checkAttrs(this.attrs);let t=z.none;for(let e=0;e<this.marks.length;e++){let r=this.marks[e];r.type.checkAttrs(r.attrs),t=r.addToSet(t)}if(!z.sameSet(t,this.marks))throw new RangeError(`Invalid collection of marks for node ${this.type.name}: ${this.marks.map(e=>e.type.name)}`);this.content.forEach(e=>e.check())}toJSON(){let t={type:this.type.name};for(let e in this.attrs){t.attrs=this.attrs;break}return this.content.size&&(t.content=this.content.toJSON()),this.marks.length&&(t.marks=this.marks.map(e=>e.toJSON())),t}static fromJSON(t,e){if(!e)throw new RangeError("Invalid input for Node.fromJSON");let r;if(e.marks){if(!Array.isArray(e.marks))throw new RangeError("Invalid mark data for Node.fromJSON");r=e.marks.map(t.markFromJSON)}if(e.type=="text"){if(typeof e.text!="string")throw new RangeError("Invalid text node in JSON");return t.text(e.text,r)}let i=w.fromJSON(t,e.content),o=t.nodeType(e.type).create(e.attrs,i,r);return o.type.checkAttrs(o.attrs),o}};jt.prototype.text=void 0;var ra=class n extends jt{constructor(t,e,r,i){if(super(t,e,null,i),!r)throw new RangeError("Empty text nodes are not allowed");this.text=r}toString(){return this.type.spec.toDebugString?this.type.spec.toDebugString(this):vd(this.marks,JSON.stringify(this.text))}get textContent(){return this.text}textBetween(t,e){return this.text.slice(t,e)}get nodeSize(){return this.text.length}mark(t){return t==this.marks?this:new n(this.type,this.attrs,this.text,t)}withText(t){return t==this.text?this:new n(this.type,this.attrs,t,this.marks)}cut(t=0,e=this.text.length){return t==0&&e==this.text.length?this:this.withText(this.text.slice(t,e))}eq(t){return this.sameMarkup(t)&&this.text==t.text}toJSON(){let t=super.toJSON();return t.text=this.text,t}};function vd(n,t){for(let e=n.length-1;e>=0;e--)t=n[e].type.name+"("+t+")";return t}var en=class n{constructor(t){this.validEnd=t,this.next=[],this.wrapCache=[]}static parse(t,e){let r=new ia(t,e);if(r.next==null)return n.empty;let i=kd(r);r.next&&r.err("Unexpected trailing text");let o=km(vm(i));return Sm(o,r),o}matchType(t){for(let e=0;e<this.next.length;e++)if(this.next[e].type==t)return this.next[e].next;return null}matchFragment(t,e=0,r=t.childCount){let i=this;for(let o=e;i&&o<r;o++)i=i.matchType(t.child(o).type);return i}get inlineContent(){return this.next.length!=0&&this.next[0].type.isInline}get defaultType(){for(let t=0;t<this.next.length;t++){let{type:e}=this.next[t];if(!(e.isText||e.hasRequiredAttrs()))return e}return null}compatible(t){for(let e=0;e<this.next.length;e++)for(let r=0;r<t.next.length;r++)if(this.next[e].type==t.next[r].type)return!0;return!1}fillBefore(t,e=!1,r=0){let i=[this];function o(s,a){let l=s.matchFragment(t,r);if(l&&(!e||l.validEnd))return w.from(a.map(c=>c.createAndFill()));for(let c=0;c<s.next.length;c++){let{type:d,next:u}=s.next[c];if(!(d.isText||d.hasRequiredAttrs())&&i.indexOf(u)==-1){i.push(u);let h=o(u,a.concat(d));if(h)return h}}return null}return o(this,[])}findWrapping(t){for(let r=0;r<this.wrapCache.length;r+=2)if(this.wrapCache[r]==t)return this.wrapCache[r+1];let e=this.computeWrapping(t);return this.wrapCache.push(t,e),e}computeWrapping(t){let e=Object.create(null),r=[{match:this,type:null,via:null}];for(;r.length;){let i=r.shift(),o=i.match;if(o.matchType(t)){let s=[];for(let a=i;a.type;a=a.via)s.push(a.type);return s.reverse()}for(let s=0;s<o.next.length;s++){let{type:a,next:l}=o.next[s];!a.isLeaf&&!a.hasRequiredAttrs()&&!(a.name in e)&&(!i.type||l.validEnd)&&(r.push({match:a.contentMatch,type:a,via:i}),e[a.name]=!0)}}return null}get edgeCount(){return this.next.length}edge(t){if(t>=this.next.length)throw new RangeError(`There's no ${t}th edge in this content match`);return this.next[t]}toString(){let t=[];function e(r){t.push(r);for(let i=0;i<r.next.length;i++)t.indexOf(r.next[i].next)==-1&&e(r.next[i].next)}return e(this),t.map((r,i)=>{let o=i+(r.validEnd?"*":" ")+" ";for(let s=0;s<r.next.length;s++)o+=(s?", ":"")+r.next[s].type.name+"->"+t.indexOf(r.next[s].next);return o}).join(`
`)}};en.empty=new en(!0);var ia=class{constructor(t,e){this.string=t,this.nodeTypes=e,this.inline=null,this.pos=0,this.tokens=t.split(/\s*(?=\b|\W|$)/),this.tokens[this.tokens.length-1]==""&&this.tokens.pop(),this.tokens[0]==""&&this.tokens.shift()}get next(){return this.tokens[this.pos]}eat(t){return this.next==t&&(this.pos++||!0)}err(t){throw new SyntaxError(t+" (in content expression '"+this.string+"')")}};function kd(n){let t=[];do t.push(mm(n));while(n.eat("|"));return t.length==1?t[0]:{type:"choice",exprs:t}}function mm(n){let t=[];do t.push(gm(n));while(n.next&&n.next!=")"&&n.next!="|");return t.length==1?t[0]:{type:"seq",exprs:t}}function gm(n){let t=xm(n);for(;;)if(n.eat("+"))t={type:"plus",expr:t};else if(n.eat("*"))t={type:"star",expr:t};else if(n.eat("?"))t={type:"opt",expr:t};else if(n.eat("{"))t=bm(n,t);else break;return t}function od(n){/\D/.test(n.next)&&n.err("Expected number, got '"+n.next+"'");let t=Number(n.next);return n.pos++,t}function bm(n,t){let e=od(n),r=e;return n.eat(",")&&(n.next!="}"?r=od(n):r=-1),n.eat("}")||n.err("Unclosed braced range"),{type:"range",min:e,max:r,expr:t}}function ym(n,t){let e=n.nodeTypes,r=e[t];if(r)return[r];let i=[];for(let o in e){let s=e[o];s.isInGroup(t)&&i.push(s)}return i.length==0&&n.err("No node type or group '"+t+"' found"),i}function xm(n){if(n.eat("(")){let t=kd(n);return n.eat(")")||n.err("Missing closing paren"),t}else if(/\W/.test(n.next))n.err("Unexpected token '"+n.next+"'");else{let t=ym(n,n.next).map(e=>(n.inline==null?n.inline=e.isInline:n.inline!=e.isInline&&n.err("Mixing inline and block content"),{type:"name",value:e}));return n.pos++,t.length==1?t[0]:{type:"choice",exprs:t}}}function vm(n){let t=[[]];return i(o(n,0),e()),t;function e(){return t.push([])-1}function r(s,a,l){let c={term:l,to:a};return t[s].push(c),c}function i(s,a){s.forEach(l=>l.to=a)}function o(s,a){if(s.type=="choice")return s.exprs.reduce((l,c)=>l.concat(o(c,a)),[]);if(s.type=="seq")for(let l=0;;l++){let c=o(s.exprs[l],a);if(l==s.exprs.length-1)return c;i(c,a=e())}else if(s.type=="star"){let l=e();return r(a,l),i(o(s.expr,l),l),[r(l)]}else if(s.type=="plus"){let l=e();return i(o(s.expr,a),l),i(o(s.expr,l),l),[r(l)]}else{if(s.type=="opt")return[r(a)].concat(o(s.expr,a));if(s.type=="range"){let l=a;for(let c=0;c<s.min;c++){let d=e();i(o(s.expr,l),d),l=d}if(s.max==-1)i(o(s.expr,l),l);else for(let c=s.min;c<s.max;c++){let d=e();r(l,d),i(o(s.expr,l),d),l=d}return[r(l)]}else{if(s.type=="name")return[r(a,void 0,s.value)];throw new Error("Unknown expr type")}}}}function Sd(n,t){return t-n}function sd(n,t){let e=[];return r(t),e.sort(Sd);function r(i){let o=n[i];if(o.length==1&&!o[0].term)return r(o[0].to);e.push(i);for(let s=0;s<o.length;s++){let{term:a,to:l}=o[s];!a&&e.indexOf(l)==-1&&r(l)}}}function km(n){let t=Object.create(null);return e(sd(n,0));function e(r){let i=[];r.forEach(s=>{n[s].forEach(({term:a,to:l})=>{if(!a)return;let c;for(let d=0;d<i.length;d++)i[d][0]==a&&(c=i[d][1]);sd(n,l).forEach(d=>{c||i.push([a,c=[]]),c.indexOf(d)==-1&&c.push(d)})})});let o=t[r.join(",")]=new en(r.indexOf(n.length-1)>-1);for(let s=0;s<i.length;s++){let a=i[s][1].sort(Sd);o.next.push({type:i[s][0],next:t[a.join(",")]||e(a)})}return o}}function Sm(n,t){for(let e=0,r=[n];e<r.length;e++){let i=r[e],o=!i.validEnd,s=[];for(let a=0;a<i.next.length;a++){let{type:l,next:c}=i.next[a];s.push(l.name),o&&!(l.isText||l.hasRequiredAttrs())&&(o=!1),r.indexOf(c)==-1&&r.push(c)}o&&t.err("Only non-generatable nodes ("+s.join(", ")+") in a required position (see https://prosemirror.net/docs/guide/#generatable)")}}function wd(n){let t=Object.create(null);for(let e in n){let r=n[e];if(!r.hasDefault)return null;t[e]=r.default}return t}function Ed(n,t){let e=Object.create(null);for(let r in n){let i=t&&t[r];if(i===void 0){let o=n[r];if(o.hasDefault)i=o.default;else throw new RangeError("No value supplied for attribute "+r)}e[r]=i}return e}function Ad(n,t,e,r){for(let i in t)if(!(i in n))throw new RangeError(`Unsupported attribute ${i} for ${e} of type ${i}`);for(let i in n){let o=n[i];o.validate&&o.validate(t[i])}}function Md(n,t){let e=Object.create(null);if(t)for(let r in t)e[r]=new oa(n,r,t[r]);return e}var vi=class n{constructor(t,e,r){this.name=t,this.schema=e,this.spec=r,this.markSet=null,this.groups=r.group?r.group.split(" "):[],this.attrs=Md(t,r.attrs),this.defaultAttrs=wd(this.attrs),this.contentMatch=null,this.inlineContent=null,this.isBlock=!(r.inline||t=="text"),this.isText=t=="text"}get isInline(){return!this.isBlock}get isTextblock(){return this.isBlock&&this.inlineContent}get isLeaf(){return this.contentMatch==en.empty}get isAtom(){return this.isLeaf||!!this.spec.atom}isInGroup(t){return this.groups.indexOf(t)>-1}get whitespace(){return this.spec.whitespace||(this.spec.code?"pre":"normal")}hasRequiredAttrs(){for(let t in this.attrs)if(this.attrs[t].isRequired)return!0;return!1}compatibleContent(t){return this==t||this.contentMatch.compatible(t.contentMatch)}computeAttrs(t){return!t&&this.defaultAttrs?this.defaultAttrs:Ed(this.attrs,t)}create(t=null,e,r){if(this.isText)throw new Error("NodeType.create can't construct text nodes");return new jt(this,this.computeAttrs(t),w.from(e),z.setFrom(r))}createChecked(t=null,e,r){return e=w.from(e),this.checkContent(e),new jt(this,this.computeAttrs(t),e,z.setFrom(r))}createAndFill(t=null,e,r){if(t=this.computeAttrs(t),e=w.from(e),e.size){let s=this.contentMatch.fillBefore(e);if(!s)return null;e=s.append(e)}let i=this.contentMatch.matchFragment(e),o=i&&i.fillBefore(w.empty,!0);return o?new jt(this,t,e.append(o),z.setFrom(r)):null}validContent(t){let e=this.contentMatch.matchFragment(t);if(!e||!e.validEnd)return!1;for(let r=0;r<t.childCount;r++)if(!this.allowsMarks(t.child(r).marks))return!1;return!0}checkContent(t){if(!this.validContent(t))throw new RangeError(`Invalid content for node ${this.name}: ${t.toString().slice(0,50)}`)}checkAttrs(t){Ad(this.attrs,t,"node",this.name)}allowsMarkType(t){return this.markSet==null||this.markSet.indexOf(t)>-1}allowsMarks(t){if(this.markSet==null)return!0;for(let e=0;e<t.length;e++)if(!this.allowsMarkType(t[e].type))return!1;return!0}allowedMarks(t){if(this.markSet==null)return t;let e;for(let r=0;r<t.length;r++)this.allowsMarkType(t[r].type)?e&&e.push(t[r]):e||(e=t.slice(0,r));return e?e.length?e:z.none:t}static compile(t,e){let r=Object.create(null);t.forEach((o,s)=>r[o]=new n(o,e,s));let i=e.spec.topNode||"doc";if(!r[i])throw new RangeError("Schema is missing its top node type ('"+i+"')");if(!r.text)throw new RangeError("Every schema needs a 'text' type");for(let o in r.text.attrs)throw new RangeError("The text node type should not have attributes");return r}};function wm(n,t,e){let r=e.split("|");return i=>{let o=i===null?"null":typeof i;if(r.indexOf(o)<0)throw new RangeError(`Expected value of type ${r} for attribute ${t} on type ${n}, got ${o}`)}}var oa=class{constructor(t,e,r){this.hasDefault=Object.prototype.hasOwnProperty.call(r,"default"),this.default=r.default,this.validate=typeof r.validate=="string"?wm(t,e,r.validate):r.validate}get isRequired(){return!this.hasDefault}},br=class n{constructor(t,e,r,i){this.name=t,this.rank=e,this.schema=r,this.spec=i,this.attrs=Md(t,i.attrs),this.excluded=null;let o=wd(this.attrs);this.instance=o?new z(this,o):null}create(t=null){return!t&&this.instance?this.instance:new z(this,Ed(this.attrs,t))}static compile(t,e){let r=Object.create(null),i=0;return t.forEach((o,s)=>r[o]=new n(o,i++,e,s)),r}removeFromSet(t){for(var e=0;e<t.length;e++)t[e].type==this&&(t=t.slice(0,e).concat(t.slice(e+1)),e--);return t}isInSet(t){for(let e=0;e<t.length;e++)if(t[e].type==this)return t[e]}checkAttrs(t){Ad(this.attrs,t,"mark",this.name)}excludes(t){return this.excluded.indexOf(t)>-1}},yr=class{constructor(t){this.linebreakReplacement=null,this.cached=Object.create(null);let e=this.spec={};for(let i in t)e[i]=t[i];e.nodes=Qs.from(t.nodes),e.marks=Qs.from(t.marks||{}),this.nodes=vi.compile(this.spec.nodes,this),this.marks=br.compile(this.spec.marks,this);let r=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 o=this.nodes[i],s=o.spec.content||"",a=o.spec.marks;if(o.contentMatch=r[s]||(r[s]=en.parse(s,this.nodes)),o.inlineContent=o.contentMatch.inlineContent,o.spec.linebreakReplacement){if(this.linebreakReplacement)throw new RangeError("Multiple linebreak nodes defined");if(!o.isInline||!o.isLeaf)throw new RangeError("Linebreak replacement nodes must be inline leaf nodes");this.linebreakReplacement=o}o.markSet=a=="_"?null:a?ad(this,a.split(" ")):a==""||!o.inlineContent?[]:null}for(let i in this.marks){let o=this.marks[i],s=o.spec.excludes;o.excluded=s==null?[o]:s==""?[]:ad(this,s.split(" "))}this.nodeFromJSON=this.nodeFromJSON.bind(this),this.markFromJSON=this.markFromJSON.bind(this),this.topNodeType=this.nodes[this.spec.topNode||"doc"],this.cached.wrappings=Object.create(null)}node(t,e=null,r,i){if(typeof t=="string")t=this.nodeType(t);else if(t instanceof vi){if(t.schema!=this)throw new RangeError("Node type from different schema used ("+t.name+")")}else throw new RangeError("Invalid node type: "+t);return t.createChecked(e,r,i)}text(t,e){let r=this.nodes.text;return new ra(r,r.defaultAttrs,t,z.setFrom(e))}mark(t,e){return typeof t=="string"&&(t=this.marks[t]),t.create(e)}nodeFromJSON(t){return jt.fromJSON(this,t)}markFromJSON(t){return z.fromJSON(this,t)}nodeType(t){let e=this.nodes[t];if(!e)throw new RangeError("Unknown node type: "+t);return e}};function ad(n,t){let e=[];for(let r=0;r<t.length;r++){let i=t[r],o=n.marks[i],s=o;if(o)e.push(o);else for(let a in n.marks){let l=n.marks[a];(i=="_"||l.spec.group&&l.spec.group.split(" ").indexOf(i)>-1)&&e.push(s=l)}if(!s)throw new SyntaxError("Unknown mark type: '"+t[r]+"'")}return e}function Em(n){return n.tag!=null}function Am(n){return n.style!=null}var fe=class n{constructor(t,e){this.schema=t,this.rules=e,this.tags=[],this.styles=[];let r=this.matchedStyles=[];e.forEach(i=>{if(Em(i))this.tags.push(i);else if(Am(i)){let o=/[^=]*/.exec(i.style)[0];r.indexOf(o)<0&&r.push(o),this.styles.push(i)}}),this.normalizeLists=!this.tags.some(i=>{if(!/^(ul|ol)\b/.test(i.tag)||!i.node)return!1;let o=t.nodes[i.node];return o.contentMatch.matchType(o)})}parse(t,e={}){let r=new wi(this,e,!1);return r.addAll(t,z.none,e.from,e.to),r.finish()}parseSlice(t,e={}){let r=new wi(this,e,!0);return r.addAll(t,z.none,e.from,e.to),M.maxOpen(r.finish())}matchTag(t,e,r){for(let i=r?this.tags.indexOf(r)+1:0;i<this.tags.length;i++){let o=this.tags[i];if(Cm(t,o.tag)&&(o.namespace===void 0||t.namespaceURI==o.namespace)&&(!o.context||e.matchesContext(o.context))){if(o.getAttrs){let s=o.getAttrs(t);if(s===!1)continue;o.attrs=s||void 0}return o}}}matchStyle(t,e,r,i){for(let o=i?this.styles.indexOf(i)+1:0;o<this.styles.length;o++){let s=this.styles[o],a=s.style;if(!(a.indexOf(t)!=0||s.context&&!r.matchesContext(s.context)||a.length>t.length&&(a.charCodeAt(t.length)!=61||a.slice(t.length+1)!=e))){if(s.getAttrs){let l=s.getAttrs(e);if(l===!1)continue;s.attrs=l||void 0}return s}}}static schemaRules(t){let e=[];function r(i){let o=i.priority==null?50:i.priority,s=0;for(;s<e.length;s++){let a=e[s];if((a.priority==null?50:a.priority)<o)break}e.splice(s,0,i)}for(let i in t.marks){let o=t.marks[i].spec.parseDOM;o&&o.forEach(s=>{r(s=cd(s)),s.mark||s.ignore||s.clearMark||(s.mark=i)})}for(let i in t.nodes){let o=t.nodes[i].spec.parseDOM;o&&o.forEach(s=>{r(s=cd(s)),s.node||s.ignore||s.mark||(s.node=i)})}return e}static fromSchema(t){return t.cached.domParser||(t.cached.domParser=new n(t,n.schemaRules(t)))}},Td={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},Mm={head:!0,noscript:!0,object:!0,script:!0,style:!0,title:!0},Cd={ol:!0,ul:!0},ki=1,Si=2,gr=4;function ld(n,t,e){return t!=null?(t?ki:0)|(t==="full"?Si:0):n&&n.whitespace=="pre"?ki|Si:e&~gr}var Mn=class{constructor(t,e,r,i,o,s){this.type=t,this.attrs=e,this.marks=r,this.solid=i,this.options=s,this.content=[],this.activeMarks=z.none,this.match=o||(s&gr?null:t.contentMatch)}findWrapping(t){if(!this.match){if(!this.type)return[];let e=this.type.contentMatch.fillBefore(w.from(t));if(e)this.match=this.type.contentMatch.matchFragment(e);else{let r=this.type.contentMatch,i;return(i=r.findWrapping(t.type))?(this.match=r,i):null}}return this.match.findWrapping(t.type)}finish(t){if(!(this.options&ki)){let r=this.content[this.content.length-1],i;if(r&&r.isText&&(i=/[ \t\r\n\u000c]+$/.exec(r.text))){let o=r;r.text.length==i[0].length?this.content.pop():this.content[this.content.length-1]=o.withText(o.text.slice(0,o.text.length-i[0].length))}}let e=w.from(this.content);return!t&&this.match&&(e=e.append(this.match.fillBefore(w.empty,!0))),this.type?this.type.create(this.attrs,e,this.marks):e}inlineContext(t){return this.type?this.type.inlineContent:this.content.length?this.content[0].isInline:t.parentNode&&!Td.hasOwnProperty(t.parentNode.nodeName.toLowerCase())}},wi=class{constructor(t,e,r){this.parser=t,this.options=e,this.isOpen=r,this.open=0;let i=e.topNode,o,s=ld(null,e.preserveWhitespace,0)|(r?gr:0);i?o=new Mn(i.type,i.attrs,z.none,!0,e.topMatch||i.type.contentMatch,s):r?o=new Mn(null,null,z.none,!0,null,s):o=new Mn(t.schema.topNodeType,null,z.none,!0,null,s),this.nodes=[o],this.find=e.findPositions,this.needsBlock=!1}get top(){return this.nodes[this.open]}addDOM(t,e){t.nodeType==3?this.addTextNode(t,e):t.nodeType==1&&this.addElement(t,e)}addTextNode(t,e){let r=t.nodeValue,i=this.top;if(i.options&Si||i.inlineContext(t)||/[^ \t\r\n\u000c]/.test(r)){if(i.options&ki)i.options&Si?r=r.replace(/\r\n?/g,`
`):r=r.replace(/\r?\n|\r/g," ");else if(r=r.replace(/[ \t\r\n\u000c]+/g," "),/^[ \t\r\n\u000c]/.test(r)&&this.open==this.nodes.length-1){let o=i.content[i.content.length-1],s=t.previousSibling;(!o||s&&s.nodeName=="BR"||o.isText&&/[ \t\r\n\u000c]$/.test(o.text))&&(r=r.slice(1))}r&&this.insertNode(this.parser.schema.text(r),e),this.findInText(t)}else this.findInside(t)}addElement(t,e,r){let i=t.nodeName.toLowerCase(),o;Cd.hasOwnProperty(i)&&this.parser.normalizeLists&&Tm(t);let s=this.options.ruleFromNode&&this.options.ruleFromNode(t)||(o=this.parser.matchTag(t,this,r));if(s?s.ignore:Mm.hasOwnProperty(i))this.findInside(t),this.ignoreFallback(t,e);else if(!s||s.skip||s.closeParent){s&&s.closeParent?this.open=Math.max(0,this.open-1):s&&s.skip.nodeType&&(t=s.skip);let a,l=this.top,c=this.needsBlock;if(Td.hasOwnProperty(i))l.content.length&&l.content[0].isInline&&this.open&&(this.open--,l=this.top),a=!0,l.type||(this.needsBlock=!0);else if(!t.firstChild){this.leafFallback(t,e);return}let d=s&&s.skip?e:this.readStyles(t,e);d&&this.addAll(t,d),a&&this.sync(l),this.needsBlock=c}else{let a=this.readStyles(t,e);a&&this.addElementByRule(t,s,a,s.consuming===!1?o:void 0)}}leafFallback(t,e){t.nodeName=="BR"&&this.top.type&&this.top.type.inlineContent&&this.addTextNode(t.ownerDocument.createTextNode(`
`),e)}ignoreFallback(t,e){t.nodeName=="BR"&&(!this.top.type||!this.top.type.inlineContent)&&this.findPlace(this.parser.schema.text("-"),e)}readStyles(t,e){let r=t.style;if(r&&r.length)for(let i=0;i<this.parser.matchedStyles.length;i++){let o=this.parser.matchedStyles[i],s=r.getPropertyValue(o);if(s)for(let a=void 0;;){let l=this.parser.matchStyle(o,s,this,a);if(!l)break;if(l.ignore)return null;if(l.clearMark?e=e.filter(c=>!l.clearMark(c)):e=e.concat(this.parser.schema.marks[l.mark].create(l.attrs)),l.consuming===!1)a=l;else break}}return e}addElementByRule(t,e,r,i){let o,s;if(e.node)if(s=this.parser.schema.nodes[e.node],s.isLeaf)this.insertNode(s.create(e.attrs),r)||this.leafFallback(t,r);else{let l=this.enter(s,e.attrs||null,r,e.preserveWhitespace);l&&(o=!0,r=l)}else{let l=this.parser.schema.marks[e.mark];r=r.concat(l.create(e.attrs))}let a=this.top;if(s&&s.isLeaf)this.findInside(t);else if(i)this.addElement(t,r,i);else if(e.getContent)this.findInside(t),e.getContent(t,this.parser.schema).forEach(l=>this.insertNode(l,r));else{let l=t;typeof e.contentElement=="string"?l=t.querySelector(e.contentElement):typeof e.contentElement=="function"?l=e.contentElement(t):e.contentElement&&(l=e.contentElement),this.findAround(t,l,!0),this.addAll(l,r),this.findAround(t,l,!1)}o&&this.sync(a)&&this.open--}addAll(t,e,r,i){let o=r||0;for(let s=r?t.childNodes[r]:t.firstChild,a=i==null?null:t.childNodes[i];s!=a;s=s.nextSibling,++o)this.findAtPoint(t,o),this.addDOM(s,e);this.findAtPoint(t,o)}findPlace(t,e){let r,i;for(let o=this.open;o>=0;o--){let s=this.nodes[o],a=s.findWrapping(t);if(a&&(!r||r.length>a.length)&&(r=a,i=s,!a.length)||s.solid)break}if(!r)return null;this.sync(i);for(let o=0;o<r.length;o++)e=this.enterInner(r[o],null,e,!1);return e}insertNode(t,e){if(t.isInline&&this.needsBlock&&!this.top.type){let i=this.textblockFromContext();i&&(e=this.enterInner(i,null,e))}let r=this.findPlace(t,e);if(r){this.closeExtra();let i=this.top;i.match&&(i.match=i.match.matchType(t.type));let o=z.none;for(let s of r.concat(t.marks))(i.type?i.type.allowsMarkType(s.type):dd(s.type,t.type))&&(o=s.addToSet(o));return i.content.push(t.mark(o)),!0}return!1}enter(t,e,r,i){let o=this.findPlace(t.create(e),r);return o&&(o=this.enterInner(t,e,r,!0,i)),o}enterInner(t,e,r,i=!1,o){this.closeExtra();let s=this.top;s.match=s.match&&s.match.matchType(t);let a=ld(t,o,s.options);s.options&gr&&s.content.length==0&&(a|=gr);let l=z.none;return r=r.filter(c=>(s.type?s.type.allowsMarkType(c.type):dd(c.type,t))?(l=c.addToSet(l),!1):!0),this.nodes.push(new Mn(t,e,l,i,null,a)),this.open++,r}closeExtra(t=!1){let e=this.nodes.length-1;if(e>this.open){for(;e>this.open;e--)this.nodes[e-1].content.push(this.nodes[e].finish(t));this.nodes.length=this.open+1}}finish(){return this.open=0,this.closeExtra(this.isOpen),this.nodes[0].finish(this.isOpen||this.options.topOpen)}sync(t){for(let e=this.open;e>=0;e--)if(this.nodes[e]==t)return this.open=e,!0;return!1}get currentPos(){this.closeExtra();let t=0;for(let e=this.open;e>=0;e--){let r=this.nodes[e].content;for(let i=r.length-1;i>=0;i--)t+=r[i].nodeSize;e&&t++}return t}findAtPoint(t,e){if(this.find)for(let r=0;r<this.find.length;r++)this.find[r].node==t&&this.find[r].offset==e&&(this.find[r].pos=this.currentPos)}findInside(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].pos==null&&t.nodeType==1&&t.contains(this.find[e].node)&&(this.find[e].pos=this.currentPos)}findAround(t,e,r){if(t!=e&&this.find)for(let i=0;i<this.find.length;i++)this.find[i].pos==null&&t.nodeType==1&&t.contains(this.find[i].node)&&e.compareDocumentPosition(this.find[i].node)&(r?2:4)&&(this.find[i].pos=this.currentPos)}findInText(t){if(this.find)for(let e=0;e<this.find.length;e++)this.find[e].node==t&&(this.find[e].pos=this.currentPos-(t.nodeValue.length-this.find[e].offset))}matchesContext(t){if(t.indexOf("|")>-1)return t.split(/\s*\|\s*/).some(this.matchesContext,this);let e=t.split("/"),r=this.options.context,i=!this.isOpen&&(!r||r.parent.type==this.nodes[0].type),o=-(r?r.depth+1:0)+(i?0:1),s=(a,l)=>{for(;a>=0;a--){let c=e[a];if(c==""){if(a==e.length-1||a==0)continue;for(;l>=o;l--)if(s(a-1,l))return!0;return!1}else{let d=l>0||l==0&&i?this.nodes[l].type:r&&l>=o?r.node(l-o).type:null;if(!d||d.name!=c&&!d.isInGroup(c))return!1;l--}}return!0};return s(e.length-1,this.open)}textblockFromContext(){let t=this.options.context;if(t)for(let e=t.depth;e>=0;e--){let r=t.node(e).contentMatchAt(t.indexAfter(e)).defaultType;if(r&&r.isTextblock&&r.defaultAttrs)return r}for(let e in this.parser.schema.nodes){let r=this.parser.schema.nodes[e];if(r.isTextblock&&r.defaultAttrs)return r}}};function Tm(n){for(let t=n.firstChild,e=null;t;t=t.nextSibling){let r=t.nodeType==1?t.nodeName.toLowerCase():null;r&&Cd.hasOwnProperty(r)&&e?(e.appendChild(t),t=e):r=="li"?e=t:r&&(e=null)}}function Cm(n,t){return(n.matches||n.msMatchesSelector||n.webkitMatchesSelector||n.mozMatchesSelector).call(n,t)}function cd(n){let t={};for(let e in n)t[e]=n[e];return t}function dd(n,t){let e=t.schema.nodes;for(let r in e){let i=e[r];if(!i.allowsMarkType(n))continue;let o=[],s=a=>{o.push(a);for(let l=0;l<a.edgeCount;l++){let{type:c,next:d}=a.edge(l);if(c==t||o.indexOf(d)<0&&s(d))return!0}};if(s(i.contentMatch))return!0}}var _t=class n{constructor(t,e){this.nodes=t,this.marks=e}serializeFragment(t,e={},r){r||(r=ta(e).createDocumentFragment());let i=r,o=[];return t.forEach(s=>{if(o.length||s.marks.length){let a=0,l=0;for(;a<o.length&&l<s.marks.length;){let c=s.marks[l];if(!this.marks[c.type.name]){l++;continue}if(!c.eq(o[a][0])||c.type.spec.spanning===!1)break;a++,l++}for(;a<o.length;)i=o.pop()[1];for(;l<s.marks.length;){let c=s.marks[l++],d=this.serializeMark(c,s.isInline,e);d&&(o.push([c,i]),i.appendChild(d.dom),i=d.contentDOM||d.dom)}}i.appendChild(this.serializeNodeInner(s,e))}),r}serializeNodeInner(t,e){let{dom:r,contentDOM:i}=gi(ta(e),this.nodes[t.type.name](t),null,t.attrs);if(i){if(t.isLeaf)throw new RangeError("Content hole not allowed in a leaf node spec");this.serializeFragment(t.content,e,i)}return r}serializeNode(t,e={}){let r=this.serializeNodeInner(t,e);for(let i=t.marks.length-1;i>=0;i--){let o=this.serializeMark(t.marks[i],t.isInline,e);o&&((o.contentDOM||o.dom).appendChild(r),r=o.dom)}return r}serializeMark(t,e,r={}){let i=this.marks[t.type.name];return i&&gi(ta(r),i(t,e),null,t.attrs)}static renderSpec(t,e,r=null,i){return gi(t,e,r,i)}static fromSchema(t){return t.cached.domSerializer||(t.cached.domSerializer=new n(this.nodesFromSchema(t),this.marksFromSchema(t)))}static nodesFromSchema(t){let e=ud(t.nodes);return e.text||(e.text=r=>r.text),e}static marksFromSchema(t){return ud(t.marks)}};function ud(n){let t={};for(let e in n){let r=n[e].spec.toDOM;r&&(t[e]=r)}return t}function ta(n){return n.document||window.document}var hd=new WeakMap;function _m(n){let t=hd.get(n);return t===void 0&&hd.set(n,t=Om(n)),t}function Om(n){let t=null;function e(r){if(r&&typeof r=="object")if(Array.isArray(r))if(typeof r[0]=="string")t||(t=[]),t.push(r);else for(let i=0;i<r.length;i++)e(r[i]);else for(let i in r)e(r[i])}return e(n),t}function gi(n,t,e,r){if(typeof t=="string")return{dom:n.createTextNode(t)};if(t.nodeType!=null)return{dom:t};if(t.dom&&t.dom.nodeType!=null)return t;let i=t[0],o;if(typeof i!="string")throw new RangeError("Invalid array passed to renderSpec");if(r&&(o=_m(r))&&o.indexOf(t)>-1)throw new RangeError("Using an array from an attribute object as a DOM spec. This may be an attempted cross site scripting attack.");let s=i.indexOf(" ");s>0&&(e=i.slice(0,s),i=i.slice(s+1));let a,l=e?n.createElementNS(e,i):n.createElement(i),c=t[1],d=1;if(c&&typeof c=="object"&&c.nodeType==null&&!Array.isArray(c)){d=2;for(let u in c)if(c[u]!=null){let h=u.indexOf(" ");h>0?l.setAttributeNS(u.slice(0,h),u.slice(h+1),c[u]):l.setAttribute(u,c[u])}}for(let u=d;u<t.length;u++){let h=t[u];if(h===0){if(u<t.length-1||u>d)throw new RangeError("Content hole must be the only child of its parent node");return{dom:l,contentDOM:l}}else{let{dom:f,contentDOM:p}=gi(n,h,e,r);if(l.appendChild(f),p){if(a)throw new RangeError("Multiple content holes");a=p}}}return{dom:l,contentDOM:a}}var Nd=65535,Pd=Math.pow(2,16);function Nm(n,t){return n+t*Pd}function _d(n){return n&Nd}function Pm(n){return(n-(n&Nd))/Pd}var Rd=1,Dd=2,Ei=4,$d=8,kr=class{constructor(t,e,r){this.pos=t,this.delInfo=e,this.recover=r}get deleted(){return(this.delInfo&$d)>0}get deletedBefore(){return(this.delInfo&(Rd|Ei))>0}get deletedAfter(){return(this.delInfo&(Dd|Ei))>0}get deletedAcross(){return(this.delInfo&Ei)>0}},pe=class n{constructor(t,e=!1){if(this.ranges=t,this.inverted=e,!t.length&&n.empty)return n.empty}recover(t){let e=0,r=_d(t);if(!this.inverted)for(let i=0;i<r;i++)e+=this.ranges[i*3+2]-this.ranges[i*3+1];return this.ranges[r*3]+e+Pm(t)}mapResult(t,e=1){return this._map(t,e,!1)}map(t,e=1){return this._map(t,e,!0)}_map(t,e,r){let i=0,o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?i:0);if(l>t)break;let c=this.ranges[a+o],d=this.ranges[a+s],u=l+c;if(t<=u){let h=c?t==l?-1:t==u?1:e:e,f=l+i+(h<0?0:d);if(r)return f;let p=t==(e<0?l:u)?null:Nm(a/3,t-l),x=t==l?Dd:t==u?Rd:Ei;return(e<0?t!=l:t!=u)&&(x|=$d),new kr(f,x,p)}i+=d-c}return r?t+i:new kr(t+i,0,null)}touches(t,e){let r=0,i=_d(e),o=this.inverted?2:1,s=this.inverted?1:2;for(let a=0;a<this.ranges.length;a+=3){let l=this.ranges[a]-(this.inverted?r:0);if(l>t)break;let c=this.ranges[a+o],d=l+c;if(t<=d&&a==i*3)return!0;r+=this.ranges[a+s]-c}return!1}forEach(t){let e=this.inverted?2:1,r=this.inverted?1:2;for(let i=0,o=0;i<this.ranges.length;i+=3){let s=this.ranges[i],a=s-(this.inverted?o:0),l=s+(this.inverted?0:o),c=this.ranges[i+e],d=this.ranges[i+r];t(a,a+c,l,l+d),o+=d-c}}invert(){return new n(this.ranges,!this.inverted)}toString(){return(this.inverted?"-":"")+JSON.stringify(this.ranges)}static offset(t){return t==0?n.empty:new n(t<0?[0,-t,0]:[0,0,t])}};pe.empty=new pe([]);var Sr=class n{constructor(t=[],e,r=0,i=t.length){this.maps=t,this.mirror=e,this.from=r,this.to=i}slice(t=0,e=this.maps.length){return new n(this.maps,this.mirror,t,e)}copy(){return new n(this.maps.slice(),this.mirror&&this.mirror.slice(),this.from,this.to)}appendMap(t,e){this.to=this.maps.push(t),e!=null&&this.setMirror(this.maps.length-1,e)}appendMapping(t){for(let e=0,r=this.maps.length;e<t.maps.length;e++){let i=t.getMirror(e);this.appendMap(t.maps[e],i!=null&&i<e?r+i:void 0)}}getMirror(t){if(this.mirror){for(let e=0;e<this.mirror.length;e++)if(this.mirror[e]==t)return this.mirror[e+(e%2?-1:1)]}}setMirror(t,e){this.mirror||(this.mirror=[]),this.mirror.push(t,e)}appendMappingInverted(t){for(let e=t.maps.length-1,r=this.maps.length+t.maps.length;e>=0;e--){let i=t.getMirror(e);this.appendMap(t.maps[e].invert(),i!=null&&i>e?r-i-1:void 0)}}invert(){let t=new n;return t.appendMappingInverted(this),t}map(t,e=1){if(this.mirror)return this._map(t,e,!0);for(let r=this.from;r<this.to;r++)t=this.maps[r].map(t,e);return t}mapResult(t,e=1){return this._map(t,e,!1)}_map(t,e,r){let i=0;for(let o=this.from;o<this.to;o++){let s=this.maps[o],a=s.mapResult(t,e);if(a.recover!=null){let l=this.getMirror(o);if(l!=null&&l>o&&l<this.to){o=l,t=this.maps[l].recover(a.recover);continue}}i|=a.delInfo,t=a.pos}return r?t:new kr(t,i,null)}},sa=Object.create(null),rt=class{getMap(){return pe.empty}merge(t){return null}static fromJSON(t,e){if(!e||!e.stepType)throw new RangeError("Invalid input for Step.fromJSON");let r=sa[e.stepType];if(!r)throw new RangeError(`No step type ${e.stepType} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in sa)throw new RangeError("Duplicate use of step JSON ID "+t);return sa[t]=e,e.prototype.jsonID=t,e}},at=class n{constructor(t,e){this.doc=t,this.failed=e}static ok(t){return new n(t,null)}static fail(t){return new n(null,t)}static fromReplace(t,e,r,i){try{return n.ok(t.replace(e,r,i))}catch(o){if(o instanceof Ze)return n.fail(o.message);throw o}}};function ua(n,t,e){let r=[];for(let i=0;i<n.childCount;i++){let o=n.child(i);o.content.size&&(o=o.copy(ua(o.content,t,o))),o.isInline&&(o=t(o,e,i)),r.push(o)}return w.fromArray(r)}var wr=class n extends rt{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=t.resolve(this.from),i=r.node(r.sharedDepth(this.to)),o=new M(ua(e.content,(s,a)=>!s.isAtom||!a.type.allowsMarkType(this.mark.type)?s:s.mark(this.mark.addToSet(s.marks)),i),e.openStart,e.openEnd);return at.fromReplace(t,this.from,this.to,o)}invert(){return new nn(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new n(e.pos,r.pos,this.mark)}merge(t){return t instanceof n&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new n(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"addMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for AddMarkStep.fromJSON");return new n(e.from,e.to,t.markFromJSON(e.mark))}};rt.jsonID("addMark",wr);var nn=class n extends rt{constructor(t,e,r){super(),this.from=t,this.to=e,this.mark=r}apply(t){let e=t.slice(this.from,this.to),r=new M(ua(e.content,i=>i.mark(this.mark.removeFromSet(i.marks)),t),e.openStart,e.openEnd);return at.fromReplace(t,this.from,this.to,r)}invert(){return new wr(this.from,this.to,this.mark)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deleted&&r.deleted||e.pos>=r.pos?null:new n(e.pos,r.pos,this.mark)}merge(t){return t instanceof n&&t.mark.eq(this.mark)&&this.from<=t.to&&this.to>=t.from?new n(Math.min(this.from,t.from),Math.max(this.to,t.to),this.mark):null}toJSON(){return{stepType:"removeMark",mark:this.mark.toJSON(),from:this.from,to:this.to}}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for RemoveMarkStep.fromJSON");return new n(e.from,e.to,t.markFromJSON(e.mark))}};rt.jsonID("removeMark",nn);var Er=class n extends rt{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return at.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.addToSet(e.marks));return at.fromReplace(t,this.pos,this.pos+1,new M(w.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);if(e){let r=this.mark.addToSet(e.marks);if(r.length==e.marks.length){for(let i=0;i<e.marks.length;i++)if(!e.marks[i].isInSet(r))return new n(this.pos,e.marks[i]);return new n(this.pos,this.mark)}}return new Ar(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new n(e.pos,this.mark)}toJSON(){return{stepType:"addNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for AddNodeMarkStep.fromJSON");return new n(e.pos,t.markFromJSON(e.mark))}};rt.jsonID("addNodeMark",Er);var Ar=class n extends rt{constructor(t,e){super(),this.pos=t,this.mark=e}apply(t){let e=t.nodeAt(this.pos);if(!e)return at.fail("No node at mark step's position");let r=e.type.create(e.attrs,null,this.mark.removeFromSet(e.marks));return at.fromReplace(t,this.pos,this.pos+1,new M(w.from(r),0,e.isLeaf?0:1))}invert(t){let e=t.nodeAt(this.pos);return!e||!this.mark.isInSet(e.marks)?this:new Er(this.pos,this.mark)}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new n(e.pos,this.mark)}toJSON(){return{stepType:"removeNodeMark",pos:this.pos,mark:this.mark.toJSON()}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for RemoveNodeMarkStep.fromJSON");return new n(e.pos,t.markFromJSON(e.mark))}};rt.jsonID("removeNodeMark",Ar);var it=class n extends rt{constructor(t,e,r,i=!1){super(),this.from=t,this.to=e,this.slice=r,this.structure=i}apply(t){return this.structure&&ca(t,this.from,this.to)?at.fail("Structure replace would overwrite content"):at.fromReplace(t,this.from,this.to,this.slice)}getMap(){return new pe([this.from,this.to-this.from,this.slice.size])}invert(t){return new n(this.from,this.from+this.slice.size,t.slice(this.from,this.to))}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1);return e.deletedAcross&&r.deletedAcross?null:new n(e.pos,Math.max(e.pos,r.pos),this.slice)}merge(t){if(!(t instanceof n)||t.structure||this.structure)return null;if(this.from+this.slice.size==t.from&&!this.slice.openEnd&&!t.slice.openStart){let e=this.slice.size+t.slice.size==0?M.empty:new M(this.slice.content.append(t.slice.content),this.slice.openStart,t.slice.openEnd);return new n(this.from,this.to+(t.to-t.from),e,this.structure)}else if(t.to==this.from&&!this.slice.openStart&&!t.slice.openEnd){let e=this.slice.size+t.slice.size==0?M.empty:new M(t.slice.content.append(this.slice.content),t.slice.openStart,this.slice.openEnd);return new n(t.from,this.to,e,this.structure)}else return null}toJSON(){let t={stepType:"replace",from:this.from,to:this.to};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number")throw new RangeError("Invalid input for ReplaceStep.fromJSON");return new n(e.from,e.to,M.fromJSON(t,e.slice),!!e.structure)}};rt.jsonID("replace",it);var W=class n extends rt{constructor(t,e,r,i,o,s,a=!1){super(),this.from=t,this.to=e,this.gapFrom=r,this.gapTo=i,this.slice=o,this.insert=s,this.structure=a}apply(t){if(this.structure&&(ca(t,this.from,this.gapFrom)||ca(t,this.gapTo,this.to)))return at.fail("Structure gap-replace would overwrite content");let e=t.slice(this.gapFrom,this.gapTo);if(e.openStart||e.openEnd)return at.fail("Gap is not a flat range");let r=this.slice.insertAt(this.insert,e.content);return r?at.fromReplace(t,this.from,this.to,r):at.fail("Content does not fit in gap")}getMap(){return new pe([this.from,this.gapFrom-this.from,this.insert,this.gapTo,this.to-this.gapTo,this.slice.size-this.insert])}invert(t){let e=this.gapTo-this.gapFrom;return new n(this.from,this.from+this.slice.size+e,this.from+this.insert,this.from+this.insert+e,t.slice(this.from,this.to).removeBetween(this.gapFrom-this.from,this.gapTo-this.from),this.gapFrom-this.from,this.structure)}map(t){let e=t.mapResult(this.from,1),r=t.mapResult(this.to,-1),i=this.from==this.gapFrom?e.pos:t.map(this.gapFrom,-1),o=this.to==this.gapTo?r.pos:t.map(this.gapTo,1);return e.deletedAcross&&r.deletedAcross||i<e.pos||o>r.pos?null:new n(e.pos,r.pos,i,o,this.slice,this.insert,this.structure)}toJSON(){let t={stepType:"replaceAround",from:this.from,to:this.to,gapFrom:this.gapFrom,gapTo:this.gapTo,insert:this.insert};return this.slice.size&&(t.slice=this.slice.toJSON()),this.structure&&(t.structure=!0),t}static fromJSON(t,e){if(typeof e.from!="number"||typeof e.to!="number"||typeof e.gapFrom!="number"||typeof e.gapTo!="number"||typeof e.insert!="number")throw new RangeError("Invalid input for ReplaceAroundStep.fromJSON");return new n(e.from,e.to,e.gapFrom,e.gapTo,M.fromJSON(t,e.slice),e.insert,!!e.structure)}};rt.jsonID("replaceAround",W);function ca(n,t,e){let r=n.resolve(t),i=e-t,o=r.depth;for(;i>0&&o>0&&r.indexAfter(o)==r.node(o).childCount;)o--,i--;if(i>0){let s=r.node(o).maybeChild(r.indexAfter(o));for(;i>0;){if(!s||s.isLeaf)return!0;s=s.firstChild,i--}}return!1}function Rm(n,t,e,r){let i=[],o=[],s,a;n.doc.nodesBetween(t,e,(l,c,d)=>{if(!l.isInline)return;let u=l.marks;if(!r.isInSet(u)&&d.type.allowsMarkType(r.type)){let h=Math.max(c,t),f=Math.min(c+l.nodeSize,e),p=r.addToSet(u);for(let x=0;x<u.length;x++)u[x].isInSet(p)||(s&&s.to==h&&s.mark.eq(u[x])?s.to=f:i.push(s=new nn(h,f,u[x])));a&&a.to==h?a.to=f:o.push(a=new wr(h,f,r))}}),i.forEach(l=>n.step(l)),o.forEach(l=>n.step(l))}function Dm(n,t,e,r){let i=[],o=0;n.doc.nodesBetween(t,e,(s,a)=>{if(!s.isInline)return;o++;let l=null;if(r instanceof br){let c=s.marks,d;for(;d=r.isInSet(c);)(l||(l=[])).push(d),c=d.removeFromSet(c)}else r?r.isInSet(s.marks)&&(l=[r]):l=s.marks;if(l&&l.length){let c=Math.min(a+s.nodeSize,e);for(let d=0;d<l.length;d++){let u=l[d],h;for(let f=0;f<i.length;f++){let p=i[f];p.step==o-1&&u.eq(i[f].style)&&(h=p)}h?(h.to=c,h.step=o):i.push({style:u,from:Math.max(a,t),to:c,step:o})}}}),i.forEach(s=>n.step(new nn(s.from,s.to,s.style)))}function ha(n,t,e,r=e.contentMatch,i=!0){let o=n.doc.nodeAt(t),s=[],a=t+1;for(let l=0;l<o.childCount;l++){let c=o.child(l),d=a+c.nodeSize,u=r.matchType(c.type);if(!u)s.push(new it(a,d,M.empty));else{r=u;for(let h=0;h<c.marks.length;h++)e.allowsMarkType(c.marks[h].type)||n.step(new nn(a,d,c.marks[h]));if(i&&c.isText&&e.whitespace!="pre"){let h,f=/\r?\n|\r/g,p;for(;h=f.exec(c.text);)p||(p=new M(w.from(e.schema.text(" ",e.allowedMarks(c.marks))),0,0)),s.push(new it(a+h.index,a+h.index+h[0].length,p))}}a=d}if(!r.validEnd){let l=r.fillBefore(w.empty,!0);n.replace(a,a,new M(l,0,0))}for(let l=s.length-1;l>=0;l--)n.step(s[l])}function $m(n,t,e){return(t==0||n.canReplace(t,n.childCount))&&(e==n.childCount||n.canReplace(0,e))}function me(n){let e=n.parent.content.cutByIndex(n.startIndex,n.endIndex);for(let r=n.depth;;--r){let i=n.$from.node(r),o=n.$from.index(r),s=n.$to.indexAfter(r);if(r<n.depth&&i.canReplace(o,s,e))return r;if(r==0||i.type.spec.isolating||!$m(i,o,s))break}return null}function Im(n,t,e){let{$from:r,$to:i,depth:o}=t,s=r.before(o+1),a=i.after(o+1),l=s,c=a,d=w.empty,u=0;for(let p=o,x=!1;p>e;p--)x||r.index(p)>0?(x=!0,d=w.from(r.node(p).copy(d)),u++):l--;let h=w.empty,f=0;for(let p=o,x=!1;p>e;p--)x||i.after(p+1)<i.end(p)?(x=!0,h=w.from(i.node(p).copy(h)),f++):c++;n.step(new W(l,c,s,a,new M(d.append(h),u,f),d.size-u,!0))}function _n(n,t,e=null,r=n){let i=Lm(n,t),o=i&&Bm(r,t);return o?i.map(Od).concat({type:t,attrs:e}).concat(o.map(Od)):null}function Od(n){return{type:n,attrs:null}}function Lm(n,t){let{parent:e,startIndex:r,endIndex:i}=n,o=e.contentMatchAt(r).findWrapping(t);if(!o)return null;let s=o.length?o[0]:t;return e.canReplaceWith(r,i,s)?o:null}function Bm(n,t){let{parent:e,startIndex:r,endIndex:i}=n,o=e.child(r),s=t.contentMatch.findWrapping(o.type);if(!s)return null;let l=(s.length?s[s.length-1]:t).contentMatch;for(let c=r;l&&c<i;c++)l=l.matchType(e.child(c).type);return!l||!l.validEnd?null:s}function zm(n,t,e){let r=w.empty;for(let s=e.length-1;s>=0;s--){if(r.size){let a=e[s].type.contentMatch.matchFragment(r);if(!a||!a.validEnd)throw new RangeError("Wrapper type given to Transform.wrap does not form valid content of its parent wrapper")}r=w.from(e[s].type.create(e[s].attrs,r))}let i=t.start,o=t.end;n.step(new W(i,o,i,o,new M(r,0,0),e.length,!0))}function Hm(n,t,e,r,i){if(!r.isTextblock)throw new RangeError("Type given to setBlockType should be a textblock");let o=n.steps.length;n.doc.nodesBetween(t,e,(s,a)=>{let l=typeof i=="function"?i(s):i;if(s.isTextblock&&!s.hasMarkup(r,l)&&Fm(n.doc,n.mapping.slice(o).map(a),r)){let c=null;if(r.schema.linebreakReplacement){let f=r.whitespace=="pre",p=!!r.contentMatch.matchType(r.schema.linebreakReplacement);f&&!p?c=!1:!f&&p&&(c=!0)}c===!1&&Ld(n,s,a,o),ha(n,n.mapping.slice(o).map(a,1),r,void 0,c===null);let d=n.mapping.slice(o),u=d.map(a,1),h=d.map(a+s.nodeSize,1);return n.step(new W(u,h,u+1,h-1,new M(w.from(r.create(l,null,s.marks)),0,0),1,!0)),c===!0&&Id(n,s,a,o),!1}})}function Id(n,t,e,r){t.forEach((i,o)=>{if(i.isText){let s,a=/\r?\n|\r/g;for(;s=a.exec(i.text);){let l=n.mapping.slice(r).map(e+1+o+s.index);n.replaceWith(l,l+1,t.type.schema.linebreakReplacement.create())}}})}function Ld(n,t,e,r){t.forEach((i,o)=>{if(i.type==i.type.schema.linebreakReplacement){let s=n.mapping.slice(r).map(e+1+o);n.replaceWith(s,s+1,t.type.schema.text(`
`))}})}function Fm(n,t,e){let r=n.resolve(t),i=r.index();return r.parent.canReplaceWith(i,i+1,e)}function Vm(n,t,e,r,i){let o=n.doc.nodeAt(t);if(!o)throw new RangeError("No node at given position");e||(e=o.type);let s=e.create(r,null,i||o.marks);if(o.isLeaf)return n.replaceWith(t,t+o.nodeSize,s);if(!e.validContent(o.content))throw new RangeError("Invalid content for node type "+e.name);n.step(new W(t,t+o.nodeSize,t+1,t+o.nodeSize-1,new M(w.from(s),0,0),1,!0))}function Dt(n,t,e=1,r){let i=n.resolve(t),o=i.depth-e,s=r&&r[r.length-1]||i.parent;if(o<0||i.parent.type.spec.isolating||!i.parent.canReplace(i.index(),i.parent.childCount)||!s.type.validContent(i.parent.content.cutByIndex(i.index(),i.parent.childCount)))return!1;for(let c=i.depth-1,d=e-2;c>o;c--,d--){let u=i.node(c),h=i.index(c);if(u.type.spec.isolating)return!1;let f=u.content.cutByIndex(h,u.childCount),p=r&&r[d+1];p&&(f=f.replaceChild(0,p.type.create(p.attrs)));let x=r&&r[d]||u;if(!u.canReplace(h+1,u.childCount)||!x.type.validContent(f))return!1}let a=i.indexAfter(o),l=r&&r[0];return i.node(o).canReplaceWith(a,a,l?l.type:i.node(o+1).type)}function Um(n,t,e=1,r){let i=n.doc.resolve(t),o=w.empty,s=w.empty;for(let a=i.depth,l=i.depth-e,c=e-1;a>l;a--,c--){o=w.from(i.node(a).copy(o));let d=r&&r[c];s=w.from(d?d.type.create(d.attrs,s):i.node(a).copy(s))}n.step(new it(t,t,new M(o.append(s),e,e),!0))}function Kt(n,t){let e=n.resolve(t),r=e.index();return Bd(e.nodeBefore,e.nodeAfter)&&e.parent.canReplace(r,r+1)}function jm(n,t){t.content.size||n.type.compatibleContent(t.type);let e=n.contentMatchAt(n.childCount),{linebreakReplacement:r}=n.type.schema;for(let i=0;i<t.childCount;i++){let o=t.child(i),s=o.type==r?n.type.schema.nodes.text:o.type;if(e=e.matchType(s),!e||!n.type.allowsMarks(o.marks))return!1}return e.validEnd}function Bd(n,t){return!!(n&&t&&!n.isLeaf&&jm(n,t))}function On(n,t,e=-1){let r=n.resolve(t);for(let i=r.depth;;i--){let o,s,a=r.index(i);if(i==r.depth?(o=r.nodeBefore,s=r.nodeAfter):e>0?(o=r.node(i+1),a++,s=r.node(i).maybeChild(a)):(o=r.node(i).maybeChild(a-1),s=r.node(i+1)),o&&!o.isTextblock&&Bd(o,s)&&r.node(i).canReplace(a,a+1))return t;if(i==0)break;t=e<0?r.before(i):r.after(i)}}function Km(n,t,e){let r=null,{linebreakReplacement:i}=n.doc.type.schema,o=n.doc.resolve(t-e),s=o.node().type;if(i&&s.inlineContent){let d=s.whitespace=="pre",u=!!s.contentMatch.matchType(i);d&&!u?r=!1:!d&&u&&(r=!0)}let a=n.steps.length;if(r===!1){let d=n.doc.resolve(t+e);Ld(n,d.node(),d.before(),a)}s.inlineContent&&ha(n,t+e-1,s,o.node().contentMatchAt(o.index()),r==null);let l=n.mapping.slice(a),c=l.map(t-e);if(n.step(new it(c,l.map(t+e,-1),M.empty,!0)),r===!0){let d=n.doc.resolve(c);Id(n,d.node(),d.before(),n.steps.length)}return n}function Wm(n,t,e){let r=n.resolve(t);if(r.parent.canReplaceWith(r.index(),r.index(),e))return t;if(r.parentOffset==0)for(let i=r.depth-1;i>=0;i--){let o=r.index(i);if(r.node(i).canReplaceWith(o,o,e))return r.before(i+1);if(o>0)return null}if(r.parentOffset==r.parent.content.size)for(let i=r.depth-1;i>=0;i--){let o=r.indexAfter(i);if(r.node(i).canReplaceWith(o,o,e))return r.after(i+1);if(o<r.node(i).childCount)return null}return null}function Ti(n,t,e){let r=n.resolve(t);if(!e.content.size)return t;let i=e.content;for(let o=0;o<e.openStart;o++)i=i.firstChild.content;for(let o=1;o<=(e.openStart==0&&e.size?2:1);o++)for(let s=r.depth;s>=0;s--){let a=s==r.depth?0:r.pos<=(r.start(s+1)+r.end(s+1))/2?-1:1,l=r.index(s)+(a>0?1:0),c=r.node(s),d=!1;if(o==1)d=c.canReplace(l,l,i);else{let u=c.contentMatchAt(l).findWrapping(i.firstChild.type);d=u&&c.canReplaceWith(l,l,u[0])}if(d)return a==0?r.pos:a<0?r.before(s+1):r.after(s+1)}return null}function Mr(n,t,e=t,r=M.empty){if(t==e&&!r.size)return null;let i=n.resolve(t),o=n.resolve(e);return zd(i,o,r)?new it(t,e,r):new da(i,o,r).fit()}function zd(n,t,e){return!e.openStart&&!e.openEnd&&n.start()==t.start()&&n.parent.canReplace(n.index(),t.index(),e.content)}var da=class{constructor(t,e,r){this.$from=t,this.$to=e,this.unplaced=r,this.frontier=[],this.placed=w.empty;for(let i=0;i<=t.depth;i++){let o=t.node(i);this.frontier.push({type:o.type,match:o.contentMatchAt(t.indexAfter(i))})}for(let i=t.depth;i>0;i--)this.placed=w.from(t.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 t=this.mustMoveInline(),e=this.placed.size-this.depth-this.$from.depth,r=this.$from,i=this.close(t<0?this.$to:r.doc.resolve(t));if(!i)return null;let o=this.placed,s=r.depth,a=i.depth;for(;s&&a&&o.childCount==1;)o=o.firstChild.content,s--,a--;let l=new M(o,s,a);return t>-1?new W(r.pos,t,this.$to.pos,this.$to.end(),l,e):l.size||r.pos!=this.$to.pos?new it(r.pos,i.pos,l):null}findFittable(){let t=this.unplaced.openStart;for(let e=this.unplaced.content,r=0,i=this.unplaced.openEnd;r<t;r++){let o=e.firstChild;if(e.childCount>1&&(i=0),o.type.spec.isolating&&i<=r){t=r;break}e=o.content}for(let e=1;e<=2;e++)for(let r=e==1?t:this.unplaced.openStart;r>=0;r--){let i,o=null;r?(o=aa(this.unplaced.content,r-1).firstChild,i=o.content):i=this.unplaced.content;let s=i.firstChild;for(let a=this.depth;a>=0;a--){let{type:l,match:c}=this.frontier[a],d,u=null;if(e==1&&(s?c.matchType(s.type)||(u=c.fillBefore(w.from(s),!1)):o&&l.compatibleContent(o.type)))return{sliceDepth:r,frontierDepth:a,parent:o,inject:u};if(e==2&&s&&(d=c.findWrapping(s.type)))return{sliceDepth:r,frontierDepth:a,parent:o,wrap:d};if(o&&c.matchType(o.type))break}}}openMore(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=aa(t,e);return!i.childCount||i.firstChild.isLeaf?!1:(this.unplaced=new M(t,e+1,Math.max(r,i.size+e>=t.size-r?e+1:0)),!0)}dropNode(){let{content:t,openStart:e,openEnd:r}=this.unplaced,i=aa(t,e);if(i.childCount<=1&&e>0){let o=t.size-e<=e+i.size;this.unplaced=new M(xr(t,e-1,1),e-1,o?e-1:r)}else this.unplaced=new M(xr(t,e,1),e,r)}placeNodes({sliceDepth:t,frontierDepth:e,parent:r,inject:i,wrap:o}){for(;this.depth>e;)this.closeFrontierNode();if(o)for(let x=0;x<o.length;x++)this.openFrontierNode(o[x]);let s=this.unplaced,a=r?r.content:s.content,l=s.openStart-t,c=0,d=[],{match:u,type:h}=this.frontier[e];if(i){for(let x=0;x<i.childCount;x++)d.push(i.child(x));u=u.matchFragment(i)}let f=a.size+t-(s.content.size-s.openEnd);for(;c<a.childCount;){let x=a.child(c),S=u.matchType(x.type);if(!S)break;c++,(c>1||l==0||x.content.size)&&(u=S,d.push(Hd(x.mark(h.allowedMarks(x.marks)),c==1?l:0,c==a.childCount?f:-1)))}let p=c==a.childCount;p||(f=-1),this.placed=vr(this.placed,e,w.from(d)),this.frontier[e].match=u,p&&f<0&&r&&r.type==this.frontier[this.depth].type&&this.frontier.length>1&&this.closeFrontierNode();for(let x=0,S=a;x<f;x++){let b=S.lastChild;this.frontier.push({type:b.type,match:b.contentMatchAt(b.childCount)}),S=b.content}this.unplaced=p?t==0?M.empty:new M(xr(s.content,t-1,1),t-1,f<0?s.openEnd:t-1):new M(xr(s.content,t,c),s.openStart,s.openEnd)}mustMoveInline(){if(!this.$to.parent.isTextblock)return-1;let t=this.frontier[this.depth],e;if(!t.type.isTextblock||!la(this.$to,this.$to.depth,t.type,t.match,!1)||this.$to.depth==this.depth&&(e=this.findCloseLevel(this.$to))&&e.depth==this.depth)return-1;let{depth:r}=this.$to,i=this.$to.after(r);for(;r>1&&i==this.$to.end(--r);)++i;return i}findCloseLevel(t){t:for(let e=Math.min(this.depth,t.depth);e>=0;e--){let{match:r,type:i}=this.frontier[e],o=e<t.depth&&t.end(e+1)==t.pos+(t.depth-(e+1)),s=la(t,e,i,r,o);if(s){for(let a=e-1;a>=0;a--){let{match:l,type:c}=this.frontier[a],d=la(t,a,c,l,!0);if(!d||d.childCount)continue t}return{depth:e,fit:s,move:o?t.doc.resolve(t.after(e+1)):t}}}}close(t){let e=this.findCloseLevel(t);if(!e)return null;for(;this.depth>e.depth;)this.closeFrontierNode();e.fit.childCount&&(this.placed=vr(this.placed,e.depth,e.fit)),t=e.move;for(let r=e.depth+1;r<=t.depth;r++){let i=t.node(r),o=i.type.contentMatch.fillBefore(i.content,!0,t.index(r));this.openFrontierNode(i.type,i.attrs,o)}return t}openFrontierNode(t,e=null,r){let i=this.frontier[this.depth];i.match=i.match.matchType(t),this.placed=vr(this.placed,this.depth,w.from(t.create(e,r))),this.frontier.push({type:t,match:t.contentMatch})}closeFrontierNode(){let e=this.frontier.pop().match.fillBefore(w.empty,!0);e.childCount&&(this.placed=vr(this.placed,this.frontier.length,e))}};function xr(n,t,e){return t==0?n.cutByIndex(e,n.childCount):n.replaceChild(0,n.firstChild.copy(xr(n.firstChild.content,t-1,e)))}function vr(n,t,e){return t==0?n.append(e):n.replaceChild(n.childCount-1,n.lastChild.copy(vr(n.lastChild.content,t-1,e)))}function aa(n,t){for(let e=0;e<t;e++)n=n.firstChild.content;return n}function Hd(n,t,e){if(t<=0)return n;let r=n.content;return t>1&&(r=r.replaceChild(0,Hd(r.firstChild,t-1,r.childCount==1?e-1:0))),t>0&&(r=n.type.contentMatch.fillBefore(r).append(r),e<=0&&(r=r.append(n.type.contentMatch.matchFragment(r).fillBefore(w.empty,!0)))),n.copy(r)}function la(n,t,e,r,i){let o=n.node(t),s=i?n.indexAfter(t):n.index(t);if(s==o.childCount&&!e.compatibleContent(o.type))return null;let a=r.fillBefore(o.content,!0,s);return a&&!qm(e,o.content,s)?a:null}function qm(n,t,e){for(let r=e;r<t.childCount;r++)if(!n.allowsMarks(t.child(r).marks))return!0;return!1}function Jm(n){return n.spec.defining||n.spec.definingForContent}function Gm(n,t,e,r){if(!r.size)return n.deleteRange(t,e);let i=n.doc.resolve(t),o=n.doc.resolve(e);if(zd(i,o,r))return n.step(new it(t,e,r));let s=Vd(i,n.doc.resolve(e));s[s.length-1]==0&&s.pop();let a=-(i.depth+1);s.unshift(a);for(let h=i.depth,f=i.pos-1;h>0;h--,f--){let p=i.node(h).type.spec;if(p.defining||p.definingAsContext||p.isolating)break;s.indexOf(h)>-1?a=h:i.before(h)==f&&s.splice(1,0,-h)}let l=s.indexOf(a),c=[],d=r.openStart;for(let h=r.content,f=0;;f++){let p=h.firstChild;if(c.push(p),f==r.openStart)break;h=p.content}for(let h=d-1;h>=0;h--){let f=c[h],p=Jm(f.type);if(p&&!f.sameMarkup(i.node(Math.abs(a)-1)))d=h;else if(p||!f.type.isTextblock)break}for(let h=r.openStart;h>=0;h--){let f=(h+d+1)%(r.openStart+1),p=c[f];if(p)for(let x=0;x<s.length;x++){let S=s[(x+l)%s.length],b=!0;S<0&&(b=!1,S=-S);let v=i.node(S-1),m=i.index(S-1);if(v.canReplaceWith(m,m,p.type,p.marks))return n.replace(i.before(S),b?o.after(S):e,new M(Fd(r.content,0,r.openStart,f),f,r.openEnd))}}let u=n.steps.length;for(let h=s.length-1;h>=0&&(n.replace(t,e,r),!(n.steps.length>u));h--){let f=s[h];f<0||(t=i.before(f),e=o.after(f))}}function Fd(n,t,e,r,i){if(t<e){let o=n.firstChild;n=n.replaceChild(0,o.copy(Fd(o.content,t+1,e,r,o)))}if(t>r){let o=i.contentMatchAt(0),s=o.fillBefore(n).append(n);n=s.append(o.matchFragment(s).fillBefore(w.empty,!0))}return n}function Ym(n,t,e,r){if(!r.isInline&&t==e&&n.doc.resolve(t).parent.content.size){let i=Wm(n.doc,t,r.type);i!=null&&(t=e=i)}n.replaceRange(t,e,new M(w.from(r),0,0))}function Xm(n,t,e){let r=n.doc.resolve(t),i=n.doc.resolve(e),o=Vd(r,i);for(let s=0;s<o.length;s++){let a=o[s],l=s==o.length-1;if(l&&a==0||r.node(a).type.contentMatch.validEnd)return n.delete(r.start(a),i.end(a));if(a>0&&(l||r.node(a-1).canReplace(r.index(a-1),i.indexAfter(a-1))))return n.delete(r.before(a),i.after(a))}for(let s=1;s<=r.depth&&s<=i.depth;s++)if(t-r.start(s)==r.depth-s&&e>r.end(s)&&i.end(s)-e!=i.depth-s&&r.start(s-1)==i.start(s-1)&&r.node(s-1).canReplace(r.index(s-1),i.index(s-1)))return n.delete(r.before(s),e);n.delete(t,e)}function Vd(n,t){let e=[],r=Math.min(n.depth,t.depth);for(let i=r;i>=0;i--){let o=n.start(i);if(o<n.pos-(n.depth-i)||t.end(i)>t.pos+(t.depth-i)||n.node(i).type.spec.isolating||t.node(i).type.spec.isolating)break;(o==t.start(i)||i==n.depth&&i==t.depth&&n.parent.inlineContent&&t.parent.inlineContent&&i&&t.start(i-1)==o-1)&&e.push(i)}return e}var Ai=class n extends rt{constructor(t,e,r){super(),this.pos=t,this.attr=e,this.value=r}apply(t){let e=t.nodeAt(this.pos);if(!e)return at.fail("No node at attribute step's position");let r=Object.create(null);for(let o in e.attrs)r[o]=e.attrs[o];r[this.attr]=this.value;let i=e.type.create(r,null,e.marks);return at.fromReplace(t,this.pos,this.pos+1,new M(w.from(i),0,e.isLeaf?0:1))}getMap(){return pe.empty}invert(t){return new n(this.pos,this.attr,t.nodeAt(this.pos).attrs[this.attr])}map(t){let e=t.mapResult(this.pos,1);return e.deletedAfter?null:new n(e.pos,this.attr,this.value)}toJSON(){return{stepType:"attr",pos:this.pos,attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.pos!="number"||typeof e.attr!="string")throw new RangeError("Invalid input for AttrStep.fromJSON");return new n(e.pos,e.attr,e.value)}};rt.jsonID("attr",Ai);var Mi=class n extends rt{constructor(t,e){super(),this.attr=t,this.value=e}apply(t){let e=Object.create(null);for(let i in t.attrs)e[i]=t.attrs[i];e[this.attr]=this.value;let r=t.type.create(e,t.content,t.marks);return at.ok(r)}getMap(){return pe.empty}invert(t){return new n(this.attr,t.attrs[this.attr])}map(t){return this}toJSON(){return{stepType:"docAttr",attr:this.attr,value:this.value}}static fromJSON(t,e){if(typeof e.attr!="string")throw new RangeError("Invalid input for DocAttrStep.fromJSON");return new n(e.attr,e.value)}};rt.jsonID("docAttr",Mi);var Tn=class extends Error{};Tn=function n(t){let e=Error.call(this,t);return e.__proto__=n.prototype,e};Tn.prototype=Object.create(Error.prototype);Tn.prototype.constructor=Tn;Tn.prototype.name="TransformError";var Cn=class{constructor(t){this.doc=t,this.steps=[],this.docs=[],this.mapping=new Sr}get before(){return this.docs.length?this.docs[0]:this.doc}step(t){let e=this.maybeStep(t);if(e.failed)throw new Tn(e.failed);return this}maybeStep(t){let e=t.apply(this.doc);return e.failed||this.addStep(t,e.doc),e}get docChanged(){return this.steps.length>0}addStep(t,e){this.docs.push(this.doc),this.steps.push(t),this.mapping.appendMap(t.getMap()),this.doc=e}replace(t,e=t,r=M.empty){let i=Mr(this.doc,t,e,r);return i&&this.step(i),this}replaceWith(t,e,r){return this.replace(t,e,new M(w.from(r),0,0))}delete(t,e){return this.replace(t,e,M.empty)}insert(t,e){return this.replaceWith(t,t,e)}replaceRange(t,e,r){return Gm(this,t,e,r),this}replaceRangeWith(t,e,r){return Ym(this,t,e,r),this}deleteRange(t,e){return Xm(this,t,e),this}lift(t,e){return Im(this,t,e),this}join(t,e=1){return Km(this,t,e),this}wrap(t,e){return zm(this,t,e),this}setBlockType(t,e=t,r,i=null){return Hm(this,t,e,r,i),this}setNodeMarkup(t,e,r=null,i){return Vm(this,t,e,r,i),this}setNodeAttribute(t,e,r){return this.step(new Ai(t,e,r)),this}setDocAttribute(t,e){return this.step(new Mi(t,e)),this}addNodeMark(t,e){return this.step(new Er(t,e)),this}removeNodeMark(t,e){if(!(e instanceof z)){let r=this.doc.nodeAt(t);if(!r)throw new RangeError("No node at position "+t);if(e=e.isInSet(r.marks),!e)return this}return this.step(new Ar(t,e)),this}split(t,e=1,r){return Um(this,t,e,r),this}addMark(t,e,r){return Rm(this,t,e,r),this}removeMark(t,e,r){return Dm(this,t,e,r),this}clearIncompatible(t,e,r){return ha(this,t,e,r),this}};var fa=Object.create(null),P=class{constructor(t,e,r){this.$anchor=t,this.$head=e,this.ranges=r||[new _i(t.min(e),t.max(e))]}get anchor(){return this.$anchor.pos}get head(){return this.$head.pos}get from(){return this.$from.pos}get to(){return this.$to.pos}get $from(){return this.ranges[0].$from}get $to(){return this.ranges[0].$to}get empty(){let t=this.ranges;for(let e=0;e<t.length;e++)if(t[e].$from.pos!=t[e].$to.pos)return!1;return!0}content(){return this.$from.doc.slice(this.from,this.to,!0)}replace(t,e=M.empty){let r=e.content.lastChild,i=null;for(let a=0;a<e.openEnd;a++)i=r,r=r.lastChild;let o=t.steps.length,s=this.ranges;for(let a=0;a<s.length;a++){let{$from:l,$to:c}=s[a],d=t.mapping.slice(o);t.replaceRange(d.map(l.pos),d.map(c.pos),a?M.empty:e),a==0&&Kd(t,o,(r?r.isInline:i&&i.isTextblock)?-1:1)}}replaceWith(t,e){let r=t.steps.length,i=this.ranges;for(let o=0;o<i.length;o++){let{$from:s,$to:a}=i[o],l=t.mapping.slice(r),c=l.map(s.pos),d=l.map(a.pos);o?t.deleteRange(c,d):(t.replaceRangeWith(c,d,e),Kd(t,r,e.isInline?-1:1))}}static findFrom(t,e,r=!1){let i=t.parent.inlineContent?new _(t):Nn(t.node(0),t.parent,t.pos,t.index(),e,r);if(i)return i;for(let o=t.depth-1;o>=0;o--){let s=e<0?Nn(t.node(0),t.node(o),t.before(o+1),t.index(o),e,r):Nn(t.node(0),t.node(o),t.after(o+1),t.index(o)+1,e,r);if(s)return s}return null}static near(t,e=1){return this.findFrom(t,e)||this.findFrom(t,-e)||new Ot(t.node(0))}static atStart(t){return Nn(t,t,0,0,1)||new Ot(t)}static atEnd(t){return Nn(t,t,t.content.size,t.childCount,-1)||new Ot(t)}static fromJSON(t,e){if(!e||!e.type)throw new RangeError("Invalid input for Selection.fromJSON");let r=fa[e.type];if(!r)throw new RangeError(`No selection type ${e.type} defined`);return r.fromJSON(t,e)}static jsonID(t,e){if(t in fa)throw new RangeError("Duplicate use of selection JSON ID "+t);return fa[t]=e,e.prototype.jsonID=t,e}getBookmark(){return _.between(this.$anchor,this.$head).getBookmark()}};P.prototype.visible=!0;var _i=class{constructor(t,e){this.$from=t,this.$to=e}},Ud=!1;function jd(n){!Ud&&!n.parent.inlineContent&&(Ud=!0,console.warn("TextSelection endpoint not pointing into a node with inline content ("+n.parent.type.name+")"))}var _=class n extends P{constructor(t,e=t){jd(t),jd(e),super(t,e)}get $cursor(){return this.$anchor.pos==this.$head.pos?this.$head:null}map(t,e){let r=t.resolve(e.map(this.head));if(!r.parent.inlineContent)return P.near(r);let i=t.resolve(e.map(this.anchor));return new n(i.parent.inlineContent?i:r,r)}replace(t,e=M.empty){if(super.replace(t,e),e==M.empty){let r=this.$from.marksAcross(this.$to);r&&t.ensureMarks(r)}}eq(t){return t instanceof n&&t.anchor==this.anchor&&t.head==this.head}getBookmark(){return new Oi(this.anchor,this.head)}toJSON(){return{type:"text",anchor:this.anchor,head:this.head}}static fromJSON(t,e){if(typeof e.anchor!="number"||typeof e.head!="number")throw new RangeError("Invalid input for TextSelection.fromJSON");return new n(t.resolve(e.anchor),t.resolve(e.head))}static create(t,e,r=e){let i=t.resolve(e);return new this(i,r==e?i:t.resolve(r))}static between(t,e,r){let i=t.pos-e.pos;if((!r||i)&&(r=i>=0?1:-1),!e.parent.inlineContent){let o=P.findFrom(e,r,!0)||P.findFrom(e,-r,!0);if(o)e=o.$head;else return P.near(e,r)}return t.parent.inlineContent||(i==0?t=e:(t=(P.findFrom(t,-r,!0)||P.findFrom(t,r,!0)).$anchor,t.pos<e.pos!=i<0&&(t=e))),new n(t,e)}};P.jsonID("text",_);var Oi=class n{constructor(t,e){this.anchor=t,this.head=e}map(t){return new n(t.map(this.anchor),t.map(this.head))}resolve(t){return _.between(t.resolve(this.anchor),t.resolve(this.head))}},N=class n extends P{constructor(t){let e=t.nodeAfter,r=t.node(0).resolve(t.pos+e.nodeSize);super(t,r),this.node=e}map(t,e){let{deleted:r,pos:i}=e.mapResult(this.anchor),o=t.resolve(i);return r?P.near(o):new n(o)}content(){return new M(w.from(this.node),0,0)}eq(t){return t instanceof n&&t.anchor==this.anchor}toJSON(){return{type:"node",anchor:this.anchor}}getBookmark(){return new ma(this.anchor)}static fromJSON(t,e){if(typeof e.anchor!="number")throw new RangeError("Invalid input for NodeSelection.fromJSON");return new n(t.resolve(e.anchor))}static create(t,e){return new n(t.resolve(e))}static isSelectable(t){return!t.isText&&t.type.spec.selectable!==!1}};N.prototype.visible=!1;P.jsonID("node",N);var ma=class n{constructor(t){this.anchor=t}map(t){let{deleted:e,pos:r}=t.mapResult(this.anchor);return e?new Oi(r,r):new n(r)}resolve(t){let e=t.resolve(this.anchor),r=e.nodeAfter;return r&&N.isSelectable(r)?new N(e):P.near(e)}},Ot=class n extends P{constructor(t){super(t.resolve(0),t.resolve(t.content.size))}replace(t,e=M.empty){if(e==M.empty){t.delete(0,t.doc.content.size);let r=P.atStart(t.doc);r.eq(t.selection)||t.setSelection(r)}else super.replace(t,e)}toJSON(){return{type:"all"}}static fromJSON(t){return new n(t)}map(t){return new n(t)}eq(t){return t instanceof n}getBookmark(){return Qm}};P.jsonID("all",Ot);var Qm={map(){return this},resolve(n){return new Ot(n)}};function Nn(n,t,e,r,i,o=!1){if(t.inlineContent)return _.create(n,e);for(let s=r-(i>0?0:1);i>0?s<t.childCount:s>=0;s+=i){let a=t.child(s);if(a.isAtom){if(!o&&N.isSelectable(a))return N.create(n,e-(i<0?a.nodeSize:0))}else{let l=Nn(n,a,e+i,i<0?a.childCount:0,i,o);if(l)return l}e+=a.nodeSize*i}return null}function Kd(n,t,e){let r=n.steps.length-1;if(r<t)return;let i=n.steps[r];if(!(i instanceof it||i instanceof W))return;let o=n.mapping.maps[r],s;o.forEach((a,l,c,d)=>{s==null&&(s=d)}),n.setSelection(P.near(n.doc.resolve(s),e))}var Wd=1,Ci=2,qd=4,ga=class extends Cn{constructor(t){super(t.doc),this.curSelectionFor=0,this.updated=0,this.meta=Object.create(null),this.time=Date.now(),this.curSelection=t.selection,this.storedMarks=t.storedMarks}get selection(){return this.curSelectionFor<this.steps.length&&(this.curSelection=this.curSelection.map(this.doc,this.mapping.slice(this.curSelectionFor)),this.curSelectionFor=this.steps.length),this.curSelection}setSelection(t){if(t.$from.doc!=this.doc)throw new RangeError("Selection passed to setSelection must point at the current document");return this.curSelection=t,this.curSelectionFor=this.steps.length,this.updated=(this.updated|Wd)&~Ci,this.storedMarks=null,this}get selectionSet(){return(this.updated&Wd)>0}setStoredMarks(t){return this.storedMarks=t,this.updated|=Ci,this}ensureMarks(t){return z.sameSet(this.storedMarks||this.selection.$from.marks(),t)||this.setStoredMarks(t),this}addStoredMark(t){return this.ensureMarks(t.addToSet(this.storedMarks||this.selection.$head.marks()))}removeStoredMark(t){return this.ensureMarks(t.removeFromSet(this.storedMarks||this.selection.$head.marks()))}get storedMarksSet(){return(this.updated&Ci)>0}addStep(t,e){super.addStep(t,e),this.updated=this.updated&~Ci,this.storedMarks=null}setTime(t){return this.time=t,this}replaceSelection(t){return this.selection.replace(this,t),this}replaceSelectionWith(t,e=!0){let r=this.selection;return e&&(t=t.mark(this.storedMarks||(r.empty?r.$from.marks():r.$from.marksAcross(r.$to)||z.none))),r.replaceWith(this,t),this}deleteSelection(){return this.selection.replace(this),this}insertText(t,e,r){let i=this.doc.type.schema;if(e==null)return t?this.replaceSelectionWith(i.text(t),!0):this.deleteSelection();{if(r==null&&(r=e),r=r??e,!t)return this.deleteRange(e,r);let o=this.storedMarks;if(!o){let s=this.doc.resolve(e);o=r==e?s.marks():s.marksAcross(this.doc.resolve(r))}return this.replaceRangeWith(e,r,i.text(t,o)),this.selection.empty||this.setSelection(P.near(this.selection.$to)),this}}setMeta(t,e){return this.meta[typeof t=="string"?t:t.key]=e,this}getMeta(t){return this.meta[typeof t=="string"?t:t.key]}get isGeneric(){for(let t in this.meta)return!1;return!0}scrollIntoView(){return this.updated|=qd,this}get scrolledIntoView(){return(this.updated&qd)>0}};function Jd(n,t){return!t||!n?n:n.bind(t)}var rn=class{constructor(t,e,r){this.name=t,this.init=Jd(e.init,r),this.apply=Jd(e.apply,r)}},Zm=[new rn("doc",{init(n){return n.doc||n.schema.topNodeType.createAndFill()},apply(n){return n.doc}}),new rn("selection",{init(n,t){return n.selection||P.atStart(t.doc)},apply(n){return n.selection}}),new rn("storedMarks",{init(n){return n.storedMarks||null},apply(n,t,e,r){return r.selection.$cursor?n.storedMarks:null}}),new rn("scrollToSelection",{init(){return 0},apply(n,t){return n.scrolledIntoView?t+1:t}})],Tr=class{constructor(t,e){this.schema=t,this.plugins=[],this.pluginsByKey=Object.create(null),this.fields=Zm.slice(),e&&e.forEach(r=>{if(this.pluginsByKey[r.key])throw new RangeError("Adding different instances of a keyed plugin ("+r.key+")");this.plugins.push(r),this.pluginsByKey[r.key]=r,r.spec.state&&this.fields.push(new rn(r.key,r.spec.state,r))})}},Ni=class n{constructor(t){this.config=t}get schema(){return this.config.schema}get plugins(){return this.config.plugins}apply(t){return this.applyTransaction(t).state}filterTransaction(t,e=-1){for(let r=0;r<this.config.plugins.length;r++)if(r!=e){let i=this.config.plugins[r];if(i.spec.filterTransaction&&!i.spec.filterTransaction.call(i,t,this))return!1}return!0}applyTransaction(t){if(!this.filterTransaction(t))return{state:this,transactions:[]};let e=[t],r=this.applyInner(t),i=null;for(;;){let o=!1;for(let s=0;s<this.config.plugins.length;s++){let a=this.config.plugins[s];if(a.spec.appendTransaction){let l=i?i[s].n:0,c=i?i[s].state:this,d=l<e.length&&a.spec.appendTransaction.call(a,l?e.slice(l):e,c,r);if(d&&r.filterTransaction(d,s)){if(d.setMeta("appendedTransaction",t),!i){i=[];for(let u=0;u<this.config.plugins.length;u++)i.push(u<s?{state:r,n:e.length}:{state:this,n:0})}e.push(d),r=r.applyInner(d),o=!0}i&&(i[s]={state:r,n:e.length})}}if(!o)return{state:r,transactions:e}}}applyInner(t){if(!t.before.eq(this.doc))throw new RangeError("Applying a mismatched transaction");let e=new n(this.config),r=this.config.fields;for(let i=0;i<r.length;i++){let o=r[i];e[o.name]=o.apply(t,this[o.name],this,e)}return e}get tr(){return new ga(this)}static create(t){let e=new Tr(t.doc?t.doc.type.schema:t.schema,t.plugins),r=new n(e);for(let i=0;i<e.fields.length;i++)r[e.fields[i].name]=e.fields[i].init(t,r);return r}reconfigure(t){let e=new Tr(this.schema,t.plugins),r=e.fields,i=new n(e);for(let o=0;o<r.length;o++){let s=r[o].name;i[s]=this.hasOwnProperty(s)?this[s]:r[o].init(t,i)}return i}toJSON(t){let e={doc:this.doc.toJSON(),selection:this.selection.toJSON()};if(this.storedMarks&&(e.storedMarks=this.storedMarks.map(r=>r.toJSON())),t&&typeof t=="object")for(let r in t){if(r=="doc"||r=="selection")throw new RangeError("The JSON fields `doc` and `selection` are reserved");let i=t[r],o=i.spec.state;o&&o.toJSON&&(e[r]=o.toJSON.call(i,this[i.key]))}return e}static fromJSON(t,e,r){if(!e)throw new RangeError("Invalid input for EditorState.fromJSON");if(!t.schema)throw new RangeError("Required config field 'schema' missing");let i=new Tr(t.schema,t.plugins),o=new n(i);return i.fields.forEach(s=>{if(s.name=="doc")o.doc=jt.fromJSON(t.schema,e.doc);else if(s.name=="selection")o.selection=P.fromJSON(o.doc,e.selection);else if(s.name=="storedMarks")e.storedMarks&&(o.storedMarks=e.storedMarks.map(t.schema.markFromJSON));else{if(r)for(let a in r){let l=r[a],c=l.spec.state;if(l.key==s.name&&c&&c.fromJSON&&Object.prototype.hasOwnProperty.call(e,a)){o[s.name]=c.fromJSON.call(l,t,e[a],o);return}}o[s.name]=s.init(t,o)}}),o}};function Gd(n,t,e){for(let r in n){let i=n[r];i instanceof Function?i=i.bind(t):r=="handleDOMEvents"&&(i=Gd(i,t,{})),e[r]=i}return e}var R=class{constructor(t){this.spec=t,this.props={},t.props&&Gd(t.props,this,this.props),this.key=t.key?t.key.key:Yd("plugin")}getState(t){return t[this.key]}},pa=Object.create(null);function Yd(n){return n in pa?n+"$"+ ++pa[n]:(pa[n]=0,n+"$")}var L=class{constructor(t="key"){this.key=Yd(t)}get(t){return t.config.pluginsByKey[this.key]}getState(t){return t[this.key]}};var Nt=function(n){for(var t=0;;t++)if(n=n.previousSibling,!n)return t},Nr=function(n){let t=n.assignedSlot||n.parentNode;return t&&t.nodeType==11?t.host:t},Xd=null,ge=function(n,t,e){let r=Xd||(Xd=document.createRange());return r.setEnd(n,e??n.nodeValue.length),r.setStart(n,t||0),r},dn=function(n,t,e,r){return e&&(Qd(n,t,e,r,-1)||Qd(n,t,e,r,1))},tg=/^(img|br|input|textarea|hr)$/i;function Qd(n,t,e,r,i){for(;;){if(n==e&&t==r)return!0;if(t==(i<0?0:Qt(n))){let o=n.parentNode;if(!o||o.nodeType!=1||ng(n)||tg.test(n.nodeName)||n.contentEditable=="false")return!1;t=Nt(n)+(i<0?0:1),n=o}else if(n.nodeType==1){if(n=n.childNodes[t+(i<0?-1:0)],n.contentEditable=="false")return!1;t=i<0?Qt(n):0}else return!1}}function Qt(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function eg(n,t,e){for(let r=t==0,i=t==Qt(n);r||i;){if(n==e)return!0;let o=Nt(n);if(n=n.parentNode,!n)return!1;r=r&&o==0,i=i&&o==Qt(n)}}function ng(n){let t;for(let e=n;e&&!(t=e.pmViewDesc);e=e.parentNode);return t&&t.node&&t.node.isBlock&&(t.dom==n||t.contentDOM==n)}var Hi=function(n){return n.focusNode&&dn(n.focusNode,n.focusOffset,n.anchorNode,n.anchorOffset)};function Dn(n,t){let e=document.createEvent("Event");return e.initEvent("keydown",!0,!0),e.keyCode=n,e.key=e.code=t,e}function rg(n){let t=n.activeElement;for(;t&&t.shadowRoot;)t=t.shadowRoot.activeElement;return t}var Pe=typeof navigator<"u"?navigator:null,Zd=typeof document<"u"?document:null,Re=Pe&&Pe.userAgent||"",wa=/Edge\/(\d+)/.exec(Re),Tu=/MSIE \d/.exec(Re),Ea=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(Re),Et=!!(Tu||Ea||wa),Ne=Tu?document.documentMode:Ea?+Ea[1]:wa?+wa[1]:0,qt=!Et&&/gecko\/(\d+)/i.test(Re);qt&&+(/Firefox\/(\d+)/.exec(Re)||[0,0])[1];var Aa=!Et&&/Chrome\/(\d+)/.exec(Re),wt=!!Aa,ig=Aa?+Aa[1]:0,gt=!Et&&!!Pe&&/Apple Computer/.test(Pe.vendor),Ln=gt&&(/Mobile\/\w+/.test(Re)||!!Pe&&Pe.maxTouchPoints>2),$t=Ln||(Pe?/Mac/.test(Pe.platform):!1),Zt=/Android \d/.test(Re),Fi=!!Zd&&"webkitFontSmoothing"in Zd.documentElement.style,og=Fi?+(/\bAppleWebKit\/(\d+)/.exec(navigator.userAgent)||[0,0])[1]:0;function sg(n){return{left:0,right:n.documentElement.clientWidth,top:0,bottom:n.documentElement.clientHeight}}function Ce(n,t){return typeof n=="number"?n:n[t]}function ag(n){let t=n.getBoundingClientRect(),e=t.width/n.offsetWidth||1,r=t.height/n.offsetHeight||1;return{left:t.left,right:t.left+n.clientWidth*e,top:t.top,bottom:t.top+n.clientHeight*r}}function tu(n,t,e){let r=n.someProp("scrollThreshold")||0,i=n.someProp("scrollMargin")||5,o=n.dom.ownerDocument;for(let s=e||n.dom;s;s=Nr(s)){if(s.nodeType!=1)continue;let a=s,l=a==o.body,c=l?sg(o):ag(a),d=0,u=0;if(t.top<c.top+Ce(r,"top")?u=-(c.top-t.top+Ce(i,"top")):t.bottom>c.bottom-Ce(r,"bottom")&&(u=t.bottom-c.bottom+Ce(i,"bottom")),t.left<c.left+Ce(r,"left")?d=-(c.left-t.left+Ce(i,"left")):t.right>c.right-Ce(r,"right")&&(d=t.right-c.right+Ce(i,"right")),d||u)if(l)o.defaultView.scrollBy(d,u);else{let h=a.scrollLeft,f=a.scrollTop;u&&(a.scrollTop+=u),d&&(a.scrollLeft+=d);let p=a.scrollLeft-h,x=a.scrollTop-f;t={left:t.left-p,top:t.top-x,right:t.right-p,bottom:t.bottom-x}}if(l)break}}function lg(n){let t=n.dom.getBoundingClientRect(),e=Math.max(0,t.top),r,i;for(let o=(t.left+t.right)/2,s=e+1;s<Math.min(innerHeight,t.bottom);s+=5){let a=n.root.elementFromPoint(o,s);if(!a||a==n.dom||!n.dom.contains(a))continue;let l=a.getBoundingClientRect();if(l.top>=e-20){r=a,i=l.top;break}}return{refDOM:r,refTop:i,stack:Cu(n.dom)}}function Cu(n){let t=[],e=n.ownerDocument;for(let r=n;r&&(t.push({dom:r,top:r.scrollTop,left:r.scrollLeft}),n!=e);r=Nr(r));return t}function cg({refDOM:n,refTop:t,stack:e}){let r=n?n.getBoundingClientRect().top:0;_u(e,r==0?0:r-t)}function _u(n,t){for(let e=0;e<n.length;e++){let{dom:r,top:i,left:o}=n[e];r.scrollTop!=i+t&&(r.scrollTop=i+t),r.scrollLeft!=o&&(r.scrollLeft=o)}}var Pn=null;function dg(n){if(n.setActive)return n.setActive();if(Pn)return n.focus(Pn);let t=Cu(n);n.focus(Pn==null?{get preventScroll(){return Pn={preventScroll:!0},!0}}:void 0),Pn||(Pn=!1,_u(t,0))}function Ou(n,t){let e,r=2e8,i,o=0,s=t.top,a=t.top;for(let l=n.firstChild,c=0;l;l=l.nextSibling,c++){let d;if(l.nodeType==1)d=l.getClientRects();else if(l.nodeType==3)d=ge(l).getClientRects();else continue;for(let u=0;u<d.length;u++){let h=d[u];if(h.top<=s&&h.bottom>=a){s=Math.max(h.bottom,s),a=Math.min(h.top,a);let f=h.left>t.left?h.left-t.left:h.right<t.left?t.left-h.right:0;if(f<r){e=l,r=f,i=f&&e.nodeType==3?{left:h.right<t.left?h.right:h.left,top:t.top}:t,l.nodeType==1&&f&&(o=c+(t.left>=(h.left+h.right)/2?1:0));continue}}!e&&(t.left>=h.right&&t.top>=h.top||t.left>=h.left&&t.top>=h.bottom)&&(o=c+1)}}return e&&e.nodeType==3?ug(e,i):!e||r&&e.nodeType==1?{node:n,offset:o}:Ou(e,i)}function ug(n,t){let e=n.nodeValue.length,r=document.createRange();for(let i=0;i<e;i++){r.setEnd(n,i+1),r.setStart(n,i);let o=_e(r,1);if(o.top!=o.bottom&&ja(t,o))return{node:n,offset:i+(t.left>=(o.left+o.right)/2?1:0)}}return{node:n,offset:0}}function ja(n,t){return n.left>=t.left-1&&n.left<=t.right+1&&n.top>=t.top-1&&n.top<=t.bottom+1}function hg(n,t){let e=n.parentNode;return e&&/^li$/i.test(e.nodeName)&&t.left<n.getBoundingClientRect().left?e:n}function fg(n,t,e){let{node:r,offset:i}=Ou(t,e),o=-1;if(r.nodeType==1&&!r.firstChild){let s=r.getBoundingClientRect();o=s.left!=s.right&&e.left>(s.left+s.right)/2?1:-1}return n.docView.posFromDOM(r,i,o)}function pg(n,t,e,r){let i=-1;for(let o=t;o!=n.dom;){let s=n.docView.nearestDesc(o,!0);if(!s)return null;if(s.node.isBlock&&s.parent){let a=s.dom.getBoundingClientRect();if(a.left>r.left||a.top>r.top)i=s.posBefore;else if(a.right<r.left||a.bottom<r.top)i=s.posAfter;else break}o=s.dom.parentNode}return i>-1?i:n.docView.posFromDOM(t,e,1)}function Nu(n,t,e){let r=n.childNodes.length;if(r&&e.top<e.bottom)for(let i=Math.max(0,Math.min(r-1,Math.floor(r*(t.top-e.top)/(e.bottom-e.top))-2)),o=i;;){let s=n.childNodes[o];if(s.nodeType==1){let a=s.getClientRects();for(let l=0;l<a.length;l++){let c=a[l];if(ja(t,c))return Nu(s,t,c)}}if((o=(o+1)%r)==i)break}return n}function mg(n,t){let e=n.dom.ownerDocument,r,i=0;if(e.caretPositionFromPoint)try{let l=e.caretPositionFromPoint(t.left,t.top);l&&({offsetNode:r,offset:i}=l)}catch{}if(!r&&e.caretRangeFromPoint){let l=e.caretRangeFromPoint(t.left,t.top);l&&({startContainer:r,startOffset:i}=l)}let o=(n.root.elementFromPoint?n.root:e).elementFromPoint(t.left,t.top),s;if(!o||!n.dom.contains(o.nodeType!=1?o.parentNode:o)){let l=n.dom.getBoundingClientRect();if(!ja(t,l)||(o=Nu(n.dom,t,l),!o))return null}if(gt)for(let l=o;r&&l;l=Nr(l))l.draggable&&(r=void 0);if(o=hg(o,t),r){if(qt&&r.nodeType==1&&(i=Math.min(i,r.childNodes.length),i<r.childNodes.length)){let l=r.childNodes[i],c;l.nodeName=="IMG"&&(c=l.getBoundingClientRect()).right<=t.left&&c.bottom>t.top&&i++}r==n.dom&&i==r.childNodes.length-1&&r.lastChild.nodeType==1&&t.top>r.lastChild.getBoundingClientRect().bottom?s=n.state.doc.content.size:(i==0||r.nodeType!=1||r.childNodes[i-1].nodeName!="BR")&&(s=pg(n,r,i,t))}s==null&&(s=fg(n,o,t));let a=n.docView.nearestDesc(o,!0);return{pos:s,inside:a?a.posAtStart-a.border:-1}}function _e(n,t){let e=n.getClientRects();return e.length?e[t<0?0:e.length-1]:n.getBoundingClientRect()}var gg=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;function Pu(n,t,e){let{node:r,offset:i,atom:o}=n.docView.domFromPos(t,e<0?-1:1),s=Fi||qt;if(r.nodeType==3)if(s&&(gg.test(r.nodeValue)||(e<0?!i:i==r.nodeValue.length))){let l=_e(ge(r,i,i),e);if(qt&&i&&/\s/.test(r.nodeValue[i-1])&&i<r.nodeValue.length){let c=_e(ge(r,i-1,i-1),-1);if(c.top==l.top){let d=_e(ge(r,i,i+1),-1);if(d.top!=l.top)return Cr(d,d.left<c.left)}}return l}else{let l=i,c=i,d=e<0?1:-1;return e<0&&!i?(c++,d=-1):e>=0&&i==r.nodeValue.length?(l--,d=1):e<0?l--:c++,Cr(_e(ge(r,l,c),1),d<0)}if(!n.state.doc.resolve(t-(o||0)).parent.inlineContent){if(o==null&&i&&(e<0||i==Qt(r))){let l=r.childNodes[i-1];if(l.nodeType==1)return ba(l.getBoundingClientRect(),!1)}if(o==null&&i<Qt(r)){let l=r.childNodes[i];if(l.nodeType==1)return ba(l.getBoundingClientRect(),!0)}return ba(r.getBoundingClientRect(),e>=0)}if(o==null&&i&&(e<0||i==Qt(r))){let l=r.childNodes[i-1],c=l.nodeType==3?ge(l,Qt(l)-(s?0:1)):l.nodeType==1&&(l.nodeName!="BR"||!l.nextSibling)?l:null;if(c)return Cr(_e(c,1),!1)}if(o==null&&i<Qt(r)){let l=r.childNodes[i];for(;l.pmViewDesc&&l.pmViewDesc.ignoreForCoords;)l=l.nextSibling;let c=l?l.nodeType==3?ge(l,0,s?0:1):l.nodeType==1?l:null:null;if(c)return Cr(_e(c,-1),!0)}return Cr(_e(r.nodeType==3?ge(r):r,-e),e>=0)}function Cr(n,t){if(n.width==0)return n;let e=t?n.left:n.right;return{top:n.top,bottom:n.bottom,left:e,right:e}}function ba(n,t){if(n.height==0)return n;let e=t?n.top:n.bottom;return{top:e,bottom:e,left:n.left,right:n.right}}function Ru(n,t,e){let r=n.state,i=n.root.activeElement;r!=t&&n.updateState(t),i!=n.dom&&n.focus();try{return e()}finally{r!=t&&n.updateState(r),i!=n.dom&&i&&i.focus()}}function bg(n,t,e){let r=t.selection,i=e=="up"?r.$from:r.$to;return Ru(n,t,()=>{let{node:o}=n.docView.domFromPos(i.pos,e=="up"?-1:1);for(;;){let a=n.docView.nearestDesc(o,!0);if(!a)break;if(a.node.isBlock){o=a.dom;break}o=a.dom.parentNode}let s=Pu(n,i.pos,1);for(let a=o.firstChild;a;a=a.nextSibling){let l;if(a.nodeType==1)l=a.getClientRects();else if(a.nodeType==3)l=ge(a,0,a.nodeValue.length).getClientRects();else continue;for(let c=0;c<l.length;c++){let d=l[c];if(d.bottom>d.top+1&&(e=="up"?s.top-d.top>(d.bottom-s.top)*2:d.bottom-s.bottom>(s.bottom-d.top)*2))return!1}}return!0})}var yg=/[\u0590-\u08ac]/;function xg(n,t,e){let{$head:r}=t.selection;if(!r.parent.isTextblock)return!1;let i=r.parentOffset,o=!i,s=i==r.parent.content.size,a=n.domSelection();return!yg.test(r.parent.textContent)||!a.modify?e=="left"||e=="backward"?o:s:Ru(n,t,()=>{let{focusNode:l,focusOffset:c,anchorNode:d,anchorOffset:u}=n.domSelectionRange(),h=a.caretBidiLevel;a.modify("move",e,"character");let f=r.depth?n.docView.domAfterPos(r.before()):n.dom,{focusNode:p,focusOffset:x}=n.domSelectionRange(),S=p&&!f.contains(p.nodeType==1?p:p.parentNode)||l==p&&c==x;try{a.collapse(d,u),l&&(l!=d||c!=u)&&a.extend&&a.extend(l,c)}catch{}return h!=null&&(a.caretBidiLevel=h),S})}var eu=null,nu=null,ru=!1;function vg(n,t,e){return eu==t&&nu==e?ru:(eu=t,nu=e,ru=e=="up"||e=="down"?bg(n,t,e):xg(n,t,e))}var Wt=0,iu=1,$n=2,te=3,un=class{constructor(t,e,r,i){this.parent=t,this.children=e,this.dom=r,this.contentDOM=i,this.dirty=Wt,r.pmViewDesc=this}matchesWidget(t){return!1}matchesMark(t){return!1}matchesNode(t,e,r){return!1}matchesHack(t){return!1}parseRule(){return null}stopEvent(t){return!1}get size(){let t=0;for(let e=0;e<this.children.length;e++)t+=this.children[e].size;return t}get border(){return 0}destroy(){this.parent=void 0,this.dom.pmViewDesc==this&&(this.dom.pmViewDesc=void 0);for(let t=0;t<this.children.length;t++)this.children[t].destroy()}posBeforeChild(t){for(let e=0,r=this.posAtStart;;e++){let i=this.children[e];if(i==t)return r;r+=i.size}}get posBefore(){return this.parent.posBeforeChild(this)}get posAtStart(){return this.parent?this.parent.posBeforeChild(this)+this.border:0}get posAfter(){return this.posBefore+this.size}get posAtEnd(){return this.posAtStart+this.size-2*this.border}localPosFromDOM(t,e,r){if(this.contentDOM&&this.contentDOM.contains(t.nodeType==1?t:t.parentNode))if(r<0){let o,s;if(t==this.contentDOM)o=t.childNodes[e-1];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.previousSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.previousSibling;return o?this.posBeforeChild(s)+s.size:this.posAtStart}else{let o,s;if(t==this.contentDOM)o=t.childNodes[e];else{for(;t.parentNode!=this.contentDOM;)t=t.parentNode;o=t.nextSibling}for(;o&&!((s=o.pmViewDesc)&&s.parent==this);)o=o.nextSibling;return o?this.posBeforeChild(s):this.posAtEnd}let i;if(t==this.dom&&this.contentDOM)i=e>Nt(this.contentDOM);else if(this.contentDOM&&this.contentDOM!=this.dom&&this.dom.contains(this.contentDOM))i=t.compareDocumentPosition(this.contentDOM)&2;else if(this.dom.firstChild){if(e==0)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!1;break}if(o.previousSibling)break}if(i==null&&e==t.childNodes.length)for(let o=t;;o=o.parentNode){if(o==this.dom){i=!0;break}if(o.nextSibling)break}}return i??r>0?this.posAtEnd:this.posAtStart}nearestDesc(t,e=!1){for(let r=!0,i=t;i;i=i.parentNode){let o=this.getDesc(i),s;if(o&&(!e||o.node))if(r&&(s=o.nodeDOM)&&!(s.nodeType==1?s.contains(t.nodeType==1?t:t.parentNode):s==t))r=!1;else return o}}getDesc(t){let e=t.pmViewDesc;for(let r=e;r;r=r.parent)if(r==this)return e}posFromDOM(t,e,r){for(let i=t;i;i=i.parentNode){let o=this.getDesc(i);if(o)return o.localPosFromDOM(t,e,r)}return-1}descAt(t){for(let e=0,r=0;e<this.children.length;e++){let i=this.children[e],o=r+i.size;if(r==t&&o!=r){for(;!i.border&&i.children.length;)i=i.children[0];return i}if(t<o)return i.descAt(t-r-i.border);r=o}}domFromPos(t,e){if(!this.contentDOM)return{node:this.dom,offset:0,atom:t+1};let r=0,i=0;for(let o=0;r<this.children.length;r++){let s=this.children[r],a=o+s.size;if(a>t||s instanceof Di){i=t-o;break}o=a}if(i)return this.children[r].domFromPos(i-this.children[r].border,e);for(let o;r&&!(o=this.children[r-1]).size&&o instanceof Pi&&o.side>=0;r--);if(e<=0){let o,s=!0;for(;o=r?this.children[r-1]:null,!(!o||o.dom.parentNode==this.contentDOM);r--,s=!1);return o&&e&&s&&!o.border&&!o.domAtom?o.domFromPos(o.size,e):{node:this.contentDOM,offset:o?Nt(o.dom)+1:0}}else{let o,s=!0;for(;o=r<this.children.length?this.children[r]:null,!(!o||o.dom.parentNode==this.contentDOM);r++,s=!1);return o&&s&&!o.border&&!o.domAtom?o.domFromPos(0,e):{node:this.contentDOM,offset:o?Nt(o.dom):this.contentDOM.childNodes.length}}}parseRange(t,e,r=0){if(this.children.length==0)return{node:this.contentDOM,from:t,to:e,fromOffset:0,toOffset:this.contentDOM.childNodes.length};let i=-1,o=-1;for(let s=r,a=0;;a++){let l=this.children[a],c=s+l.size;if(i==-1&&t<=c){let d=s+l.border;if(t>=d&&e<=c-l.border&&l.node&&l.contentDOM&&this.contentDOM.contains(l.contentDOM))return l.parseRange(t,e,d);t=s;for(let u=a;u>0;u--){let h=this.children[u-1];if(h.size&&h.dom.parentNode==this.contentDOM&&!h.emptyChildAt(1)){i=Nt(h.dom)+1;break}t-=h.size}i==-1&&(i=0)}if(i>-1&&(c>e||a==this.children.length-1)){e=c;for(let d=a+1;d<this.children.length;d++){let u=this.children[d];if(u.size&&u.dom.parentNode==this.contentDOM&&!u.emptyChildAt(-1)){o=Nt(u.dom);break}e+=u.size}o==-1&&(o=this.contentDOM.childNodes.length);break}s=c}return{node:this.contentDOM,from:t,to:e,fromOffset:i,toOffset:o}}emptyChildAt(t){if(this.border||!this.contentDOM||!this.children.length)return!1;let e=this.children[t<0?0:this.children.length-1];return e.size==0||e.emptyChildAt(t)}domAfterPos(t){let{node:e,offset:r}=this.domFromPos(t,0);if(e.nodeType!=1||r==e.childNodes.length)throw new RangeError("No node after pos "+t);return e.childNodes[r]}setSelection(t,e,r,i=!1){let o=Math.min(t,e),s=Math.max(t,e);for(let h=0,f=0;h<this.children.length;h++){let p=this.children[h],x=f+p.size;if(o>f&&s<x)return p.setSelection(t-f-p.border,e-f-p.border,r,i);f=x}let a=this.domFromPos(t,t?-1:1),l=e==t?a:this.domFromPos(e,e?-1:1),c=r.getSelection(),d=!1;if((qt||gt)&&t==e){let{node:h,offset:f}=a;if(h.nodeType==3){if(d=!!(f&&h.nodeValue[f-1]==`
`),d&&f==h.nodeValue.length)for(let p=h,x;p;p=p.parentNode){if(x=p.nextSibling){x.nodeName=="BR"&&(a=l={node:x.parentNode,offset:Nt(x)+1});break}let S=p.pmViewDesc;if(S&&S.node&&S.node.isBlock)break}}else{let p=h.childNodes[f-1];d=p&&(p.nodeName=="BR"||p.contentEditable=="false")}}if(qt&&c.focusNode&&c.focusNode!=l.node&&c.focusNode.nodeType==1){let h=c.focusNode.childNodes[c.focusOffset];h&&h.contentEditable=="false"&&(i=!0)}if(!(i||d&>)&&dn(a.node,a.offset,c.anchorNode,c.anchorOffset)&&dn(l.node,l.offset,c.focusNode,c.focusOffset))return;let u=!1;if((c.extend||t==e)&&!d){c.collapse(a.node,a.offset);try{t!=e&&c.extend(l.node,l.offset),u=!0}catch{}}if(!u){if(t>e){let f=a;a=l,l=f}let h=document.createRange();h.setEnd(l.node,l.offset),h.setStart(a.node,a.offset),c.removeAllRanges(),c.addRange(h)}}ignoreMutation(t){return!this.contentDOM&&t.type!="selection"}get contentLost(){return this.contentDOM&&this.contentDOM!=this.dom&&!this.dom.contains(this.contentDOM)}markDirty(t,e){for(let r=0,i=0;i<this.children.length;i++){let o=this.children[i],s=r+o.size;if(r==s?t<=s&&e>=r:t<s&&e>r){let a=r+o.border,l=s-o.border;if(t>=a&&e<=l){this.dirty=t==r||e==s?$n:iu,t==a&&e==l&&(o.contentLost||o.dom.parentNode!=this.contentDOM)?o.dirty=te:o.markDirty(t-a,e-a);return}else o.dirty=o.dom==o.contentDOM&&o.dom.parentNode==this.contentDOM&&!o.children.length?$n:te}r=s}this.dirty=$n}markParentsDirty(){let t=1;for(let e=this.parent;e;e=e.parent,t++){let r=t==1?$n:iu;e.dirty<r&&(e.dirty=r)}}get domAtom(){return!1}get ignoreForCoords(){return!1}},Pi=class extends un{constructor(t,e,r,i){let o,s=e.type.toDOM;if(typeof s=="function"&&(s=s(r,()=>{if(!o)return i;if(o.parent)return o.parent.posBeforeChild(o)})),!e.type.spec.raw){if(s.nodeType!=1){let a=document.createElement("span");a.appendChild(s),s=a}s.contentEditable="false",s.classList.add("ProseMirror-widget")}super(t,[],s,null),this.widget=e,this.widget=e,o=this}matchesWidget(t){return this.dirty==Wt&&t.type.eq(this.widget.type)}parseRule(){return{ignore:!0}}stopEvent(t){let e=this.widget.spec.stopEvent;return e?e(t):!1}ignoreMutation(t){return t.type!="selection"||this.widget.spec.ignoreSelection}destroy(){this.widget.type.destroy(this.dom),super.destroy()}get domAtom(){return!0}get side(){return this.widget.type.side}},Ma=class extends un{constructor(t,e,r,i){super(t,[],e,null),this.textDOM=r,this.text=i}get size(){return this.text.length}localPosFromDOM(t,e){return t!=this.textDOM?this.posAtStart+(e?this.size:0):this.posAtStart+e}domFromPos(t){return{node:this.textDOM,offset:t}}ignoreMutation(t){return t.type==="characterData"&&t.target.nodeValue==t.oldValue}},Bn=class n extends un{constructor(t,e,r,i){super(t,[],r,i),this.mark=e}static create(t,e,r,i){let o=i.nodeViews[e.type.name],s=o&&o(e,i,r);return(!s||!s.dom)&&(s=_t.renderSpec(document,e.type.spec.toDOM(e,r))),new n(t,e,s.dom,s.contentDOM||s.dom)}parseRule(){return this.dirty&te||this.mark.type.spec.reparseInView?null:{mark:this.mark.type.name,attrs:this.mark.attrs,contentElement:this.contentDOM||void 0}}matchesMark(t){return this.dirty!=te&&this.mark.eq(t)}markDirty(t,e){if(super.markDirty(t,e),this.dirty!=Wt){let r=this.parent;for(;!r.node;)r=r.parent;r.dirty<this.dirty&&(r.dirty=this.dirty),this.dirty=Wt}}slice(t,e,r){let i=n.create(this.parent,this.mark,!0,r),o=this.children,s=this.size;e<s&&(o=Na(o,e,s,r)),t>0&&(o=Na(o,0,t,r));for(let a=0;a<o.length;a++)o[a].parent=i;return i.children=o,i}},hn=class n extends un{constructor(t,e,r,i,o,s,a,l,c){super(t,[],o,s),this.node=e,this.outerDeco=r,this.innerDeco=i,this.nodeDOM=a,s&&this.updateChildren(l,c)}static create(t,e,r,i,o,s){let a=o.nodeViews[e.type.name],l,c=a&&a(e,o,()=>{if(!l)return s;if(l.parent)return l.parent.posBeforeChild(l)},r,i),d=c&&c.dom,u=c&&c.contentDOM;if(e.isText){if(!d)d=document.createTextNode(e.text);else if(d.nodeType!=3)throw new RangeError("Text must be rendered as a DOM text node")}else d||({dom:d,contentDOM:u}=_t.renderSpec(document,e.type.spec.toDOM(e)));!u&&!e.isText&&d.nodeName!="BR"&&(d.hasAttribute("contenteditable")||(d.contentEditable="false"),e.type.spec.draggable&&(d.draggable=!0));let h=d;return d=Iu(d,r,e),c?l=new Ta(t,e,r,i,d,u||null,h,c,o,s+1):e.isText?new Ri(t,e,r,i,d,h,o):new n(t,e,r,i,d,u||null,h,o,s+1)}parseRule(){if(this.node.type.spec.reparseInView)return null;let t={node:this.node.type.name,attrs:this.node.attrs};if(this.node.type.whitespace=="pre"&&(t.preserveWhitespace="full"),!this.contentDOM)t.getContent=()=>this.node.content;else if(!this.contentLost)t.contentElement=this.contentDOM;else{for(let e=this.children.length-1;e>=0;e--){let r=this.children[e];if(this.dom.contains(r.dom.parentNode)){t.contentElement=r.dom.parentNode;break}}t.contentElement||(t.getContent=()=>w.empty)}return t}matchesNode(t,e,r){return this.dirty==Wt&&t.eq(this.node)&&_a(e,this.outerDeco)&&r.eq(this.innerDeco)}get size(){return this.node.nodeSize}get border(){return this.node.isLeaf?0:1}updateChildren(t,e){let r=this.node.inlineContent,i=e,o=t.composing?this.localCompositionInfo(t,e):null,s=o&&o.pos>-1?o:null,a=o&&o.pos<0,l=new Oa(this,s&&s.node,t);Eg(this.node,this.innerDeco,(c,d,u)=>{c.spec.marks?l.syncToMarks(c.spec.marks,r,t):c.type.side>=0&&!u&&l.syncToMarks(d==this.node.childCount?z.none:this.node.child(d).marks,r,t),l.placeWidget(c,t,i)},(c,d,u,h)=>{l.syncToMarks(c.marks,r,t);let f;l.findNodeMatch(c,d,u,h)||a&&t.state.selection.from>i&&t.state.selection.to<i+c.nodeSize&&(f=l.findIndexWithChild(o.node))>-1&&l.updateNodeAt(c,d,u,f,t)||l.updateNextNode(c,d,u,t,h)||l.addNode(c,d,u,t,i),i+=c.nodeSize}),l.syncToMarks([],r,t),this.node.isTextblock&&l.addTextblockHacks(),l.destroyRest(),(l.changed||this.dirty==$n)&&(s&&this.protectLocalComposition(t,s),Du(this.contentDOM,this.children,t),Ln&&Ag(this.dom))}localCompositionInfo(t,e){let{from:r,to:i}=t.state.selection;if(!(t.state.selection instanceof _)||r<e||i>e+this.node.content.size)return null;let o=t.domSelectionRange(),s=Mg(o.focusNode,o.focusOffset);if(!s||!this.dom.contains(s.parentNode))return null;if(this.node.inlineContent){let a=s.nodeValue,l=Tg(this.node.content,a,r-e,i-e);return l<0?null:{node:s,pos:l,text:a}}else return{node:s,pos:-1,text:""}}protectLocalComposition(t,{node:e,pos:r,text:i}){if(this.getDesc(e))return;let o=e;for(;o.parentNode!=this.contentDOM;o=o.parentNode){for(;o.previousSibling;)o.parentNode.removeChild(o.previousSibling);for(;o.nextSibling;)o.parentNode.removeChild(o.nextSibling);o.pmViewDesc&&(o.pmViewDesc=void 0)}let s=new Ma(this,o,e,i);t.input.compositionNodes.push(s),this.children=Na(this.children,r,r+i.length,t,s)}update(t,e,r,i){return this.dirty==te||!t.sameMarkup(this.node)?!1:(this.updateInner(t,e,r,i),!0)}updateInner(t,e,r,i){this.updateOuterDeco(e),this.node=t,this.innerDeco=r,this.contentDOM&&this.updateChildren(i,this.posAtStart),this.dirty=Wt}updateOuterDeco(t){if(_a(t,this.outerDeco))return;let e=this.nodeDOM.nodeType!=1,r=this.dom;this.dom=$u(this.dom,this.nodeDOM,Ca(this.outerDeco,this.node,e),Ca(t,this.node,e)),this.dom!=r&&(r.pmViewDesc=void 0,this.dom.pmViewDesc=this),this.outerDeco=t}selectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.add("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&(this.dom.draggable=!0)}deselectNode(){this.nodeDOM.nodeType==1&&this.nodeDOM.classList.remove("ProseMirror-selectednode"),(this.contentDOM||!this.node.type.spec.draggable)&&this.dom.removeAttribute("draggable")}get domAtom(){return this.node.isAtom}};function ou(n,t,e,r,i){return Iu(r,t,n),new hn(void 0,n,t,e,r,r,r,i,0)}var Ri=class n extends hn{constructor(t,e,r,i,o,s,a){super(t,e,r,i,o,null,s,a,0)}parseRule(){let t=this.nodeDOM.parentNode;for(;t&&t!=this.dom&&!t.pmIsDeco;)t=t.parentNode;return{skip:t||!0}}update(t,e,r,i){return this.dirty==te||this.dirty!=Wt&&!this.inParent()||!t.sameMarkup(this.node)?!1:(this.updateOuterDeco(e),(this.dirty!=Wt||t.text!=this.node.text)&&t.text!=this.nodeDOM.nodeValue&&(this.nodeDOM.nodeValue=t.text,i.trackWrites==this.nodeDOM&&(i.trackWrites=null)),this.node=t,this.dirty=Wt,!0)}inParent(){let t=this.parent.contentDOM;for(let e=this.nodeDOM;e;e=e.parentNode)if(e==t)return!0;return!1}domFromPos(t){return{node:this.nodeDOM,offset:t}}localPosFromDOM(t,e,r){return t==this.nodeDOM?this.posAtStart+Math.min(e,this.node.text.length):super.localPosFromDOM(t,e,r)}ignoreMutation(t){return t.type!="characterData"&&t.type!="selection"}slice(t,e,r){let i=this.node.cut(t,e),o=document.createTextNode(i.text);return new n(this.parent,i,this.outerDeco,this.innerDeco,o,o,r)}markDirty(t,e){super.markDirty(t,e),this.dom!=this.nodeDOM&&(t==0||e==this.nodeDOM.nodeValue.length)&&(this.dirty=te)}get domAtom(){return!1}},Di=class extends un{parseRule(){return{ignore:!0}}matchesHack(t){return this.dirty==Wt&&this.dom.nodeName==t}get domAtom(){return!0}get ignoreForCoords(){return this.dom.nodeName=="IMG"}},Ta=class extends hn{constructor(t,e,r,i,o,s,a,l,c,d){super(t,e,r,i,o,s,a,c,d),this.spec=l}update(t,e,r,i){if(this.dirty==te)return!1;if(this.spec.update){let o=this.spec.update(t,e,r);return o&&this.updateInner(t,e,r,i),o}else return!this.contentDOM&&!t.isLeaf?!1:super.update(t,e,r,i)}selectNode(){this.spec.selectNode?this.spec.selectNode():super.selectNode()}deselectNode(){this.spec.deselectNode?this.spec.deselectNode():super.deselectNode()}setSelection(t,e,r,i){this.spec.setSelection?this.spec.setSelection(t,e,r):super.setSelection(t,e,r,i)}destroy(){this.spec.destroy&&this.spec.destroy(),super.destroy()}stopEvent(t){return this.spec.stopEvent?this.spec.stopEvent(t):!1}ignoreMutation(t){return this.spec.ignoreMutation?this.spec.ignoreMutation(t):super.ignoreMutation(t)}};function Du(n,t,e){let r=n.firstChild,i=!1;for(let o=0;o<t.length;o++){let s=t[o],a=s.dom;if(a.parentNode==n){for(;a!=r;)r=su(r),i=!0;r=r.nextSibling}else i=!0,n.insertBefore(a,r);if(s instanceof Bn){let l=r?r.previousSibling:n.lastChild;Du(s.contentDOM,s.children,e),r=l?l.nextSibling:n.firstChild}}for(;r;)r=su(r),i=!0;i&&e.trackWrites==n&&(e.trackWrites=null)}var _r=function(n){n&&(this.nodeName=n)};_r.prototype=Object.create(null);var sn=[new _r];function Ca(n,t,e){if(n.length==0)return sn;let r=e?sn[0]:new _r,i=[r];for(let o=0;o<n.length;o++){let s=n[o].type.attrs;if(s){s.nodeName&&i.push(r=new _r(s.nodeName));for(let a in s){let l=s[a];l!=null&&(e&&i.length==1&&i.push(r=new _r(t.isInline?"span":"div")),a=="class"?r.class=(r.class?r.class+" ":"")+l:a=="style"?r.style=(r.style?r.style+";":"")+l:a!="nodeName"&&(r[a]=l))}}}return i}function $u(n,t,e,r){if(e==sn&&r==sn)return t;let i=t;for(let o=0;o<r.length;o++){let s=r[o],a=e[o];if(o){let l;a&&a.nodeName==s.nodeName&&i!=n&&(l=i.parentNode)&&l.nodeName.toLowerCase()==s.nodeName||(l=document.createElement(s.nodeName),l.pmIsDeco=!0,l.appendChild(i),a=sn[0]),i=l}kg(i,a||sn[0],s)}return i}function kg(n,t,e){for(let r in t)r!="class"&&r!="style"&&r!="nodeName"&&!(r in e)&&n.removeAttribute(r);for(let r in e)r!="class"&&r!="style"&&r!="nodeName"&&e[r]!=t[r]&&n.setAttribute(r,e[r]);if(t.class!=e.class){let r=t.class?t.class.split(" ").filter(Boolean):[],i=e.class?e.class.split(" ").filter(Boolean):[];for(let o=0;o<r.length;o++)i.indexOf(r[o])==-1&&n.classList.remove(r[o]);for(let o=0;o<i.length;o++)r.indexOf(i[o])==-1&&n.classList.add(i[o]);n.classList.length==0&&n.removeAttribute("class")}if(t.style!=e.style){if(t.style){let r=/\s*([\w\-\xa1-\uffff]+)\s*:(?:"(?:\\.|[^"])*"|'(?:\\.|[^'])*'|\(.*?\)|[^;])*/g,i;for(;i=r.exec(t.style);)n.style.removeProperty(i[1])}e.style&&(n.style.cssText+=e.style)}}function Iu(n,t,e){return $u(n,n,sn,Ca(t,e,n.nodeType!=1))}function _a(n,t){if(n.length!=t.length)return!1;for(let e=0;e<n.length;e++)if(!n[e].type.eq(t[e].type))return!1;return!0}function su(n){let t=n.nextSibling;return n.parentNode.removeChild(n),t}var Oa=class{constructor(t,e,r){this.lock=e,this.view=r,this.index=0,this.stack=[],this.changed=!1,this.top=t,this.preMatch=Sg(t.node.content,t)}destroyBetween(t,e){if(t!=e){for(let r=t;r<e;r++)this.top.children[r].destroy();this.top.children.splice(t,e-t),this.changed=!0}}destroyRest(){this.destroyBetween(this.index,this.top.children.length)}syncToMarks(t,e,r){let i=0,o=this.stack.length>>1,s=Math.min(o,t.length);for(;i<s&&(i==o-1?this.top:this.stack[i+1<<1]).matchesMark(t[i])&&t[i].type.spec.spanning!==!1;)i++;for(;i<o;)this.destroyRest(),this.top.dirty=Wt,this.index=this.stack.pop(),this.top=this.stack.pop(),o--;for(;o<t.length;){this.stack.push(this.top,this.index+1);let a=-1;for(let l=this.index;l<Math.min(this.index+3,this.top.children.length);l++)if(this.top.children[l].matchesMark(t[o])){a=l;break}if(a>-1)a>this.index&&(this.changed=!0,this.destroyBetween(this.index,a)),this.top=this.top.children[this.index];else{let l=Bn.create(this.top,t[o],e,r);this.top.children.splice(this.index,0,l),this.top=l,this.changed=!0}this.index=0,o++}}findNodeMatch(t,e,r,i){let o=-1,s;if(i>=this.preMatch.index&&(s=this.preMatch.matches[i-this.preMatch.index]).parent==this.top&&s.matchesNode(t,e,r))o=this.top.children.indexOf(s,this.index);else for(let a=this.index,l=Math.min(this.top.children.length,a+5);a<l;a++){let c=this.top.children[a];if(c.matchesNode(t,e,r)&&!this.preMatch.matched.has(c)){o=a;break}}return o<0?!1:(this.destroyBetween(this.index,o),this.index++,!0)}updateNodeAt(t,e,r,i,o){let s=this.top.children[i];return s.dirty==te&&s.dom==s.contentDOM&&(s.dirty=$n),s.update(t,e,r,o)?(this.destroyBetween(this.index,i),this.index++,!0):!1}findIndexWithChild(t){for(;;){let e=t.parentNode;if(!e)return-1;if(e==this.top.contentDOM){let r=t.pmViewDesc;if(r){for(let i=this.index;i<this.top.children.length;i++)if(this.top.children[i]==r)return i}return-1}t=e}}updateNextNode(t,e,r,i,o){for(let s=this.index;s<this.top.children.length;s++){let a=this.top.children[s];if(a instanceof hn){let l=this.preMatch.matched.get(a);if(l!=null&&l!=o)return!1;let c=a.dom;if(!(this.lock&&(c==this.lock||c.nodeType==1&&c.contains(this.lock.parentNode))&&!(t.isText&&a.node&&a.node.isText&&a.nodeDOM.nodeValue==t.text&&a.dirty!=te&&_a(e,a.outerDeco)))&&a.update(t,e,r,i))return this.destroyBetween(this.index,s),a.dom!=c&&(this.changed=!0),this.index++,!0;break}}return!1}addNode(t,e,r,i,o){this.top.children.splice(this.index++,0,hn.create(this.top,t,e,r,i,o)),this.changed=!0}placeWidget(t,e,r){let i=this.index<this.top.children.length?this.top.children[this.index]:null;if(i&&i.matchesWidget(t)&&(t==i.widget||!i.widget.type.toDOM.parentNode))this.index++;else{let o=new Pi(this.top,t,e,r);this.top.children.splice(this.index++,0,o),this.changed=!0}}addTextblockHacks(){let t=this.top.children[this.index-1],e=this.top;for(;t instanceof Bn;)e=t,t=e.children[e.children.length-1];(!t||!(t instanceof Ri)||/\n$/.test(t.node.text)||this.view.requiresGeckoHackNode&&/\s$/.test(t.node.text))&&((gt||wt)&&t&&t.dom.contentEditable=="false"&&this.addHackNode("IMG",e),this.addHackNode("BR",this.top))}addHackNode(t,e){if(e==this.top&&this.index<e.children.length&&e.children[this.index].matchesHack(t))this.index++;else{let r=document.createElement(t);t=="IMG"&&(r.className="ProseMirror-separator",r.alt=""),t=="BR"&&(r.className="ProseMirror-trailingBreak");let i=new Di(this.top,[],r,null);e!=this.top?e.children.push(i):e.children.splice(this.index++,0,i),this.changed=!0}}};function Sg(n,t){let e=t,r=e.children.length,i=n.childCount,o=new Map,s=[];t:for(;i>0;){let a;for(;;)if(r){let c=e.children[r-1];if(c instanceof Bn)e=c,r=c.children.length;else{a=c,r--;break}}else{if(e==t)break t;r=e.parent.children.indexOf(e),e=e.parent}let l=a.node;if(l){if(l!=n.child(i-1))break;--i,o.set(a,i),s.push(a)}}return{index:i,matched:o,matches:s.reverse()}}function wg(n,t){return n.type.side-t.type.side}function Eg(n,t,e,r){let i=t.locals(n),o=0;if(i.length==0){for(let c=0;c<n.childCount;c++){let d=n.child(c);r(d,i,t.forChild(o,d),c),o+=d.nodeSize}return}let s=0,a=[],l=null;for(let c=0;;){if(s<i.length&&i[s].to==o){let p=i[s++],x;for(;s<i.length&&i[s].to==o;)(x||(x=[p])).push(i[s++]);if(x){x.sort(wg);for(let S=0;S<x.length;S++)e(x[S],c,!!l)}else e(p,c,!!l)}let d,u;if(l)u=-1,d=l,l=null;else if(c<n.childCount)u=c,d=n.child(c++);else break;for(let p=0;p<a.length;p++)a[p].to<=o&&a.splice(p--,1);for(;s<i.length&&i[s].from<=o&&i[s].to>o;)a.push(i[s++]);let h=o+d.nodeSize;if(d.isText){let p=h;s<i.length&&i[s].from<p&&(p=i[s].from);for(let x=0;x<a.length;x++)a[x].to<p&&(p=a[x].to);p<h&&(l=d.cut(p-o),d=d.cut(0,p-o),h=p,u=-1)}let f=d.isInline&&!d.isLeaf?a.filter(p=>!p.inline):a.slice();r(d,f,t.forChild(o,d),u),o=h}}function Ag(n){if(n.nodeName=="UL"||n.nodeName=="OL"){let t=n.style.cssText;n.style.cssText=t+"; list-style: square !important",window.getComputedStyle(n).listStyle,n.style.cssText=t}}function Mg(n,t){for(;;){if(n.nodeType==3)return n;if(n.nodeType==1&&t>0){if(n.childNodes.length>t&&n.childNodes[t].nodeType==3)return n.childNodes[t];n=n.childNodes[t-1],t=Qt(n)}else if(n.nodeType==1&&t<n.childNodes.length)n=n.childNodes[t],t=0;else return null}}function Tg(n,t,e,r){for(let i=0,o=0;i<n.childCount&&o<=r;){let s=n.child(i++),a=o;if(o+=s.nodeSize,!s.isText)continue;let l=s.text;for(;i<n.childCount;){let c=n.child(i++);if(o+=c.nodeSize,!c.isText)break;l+=c.text}if(o>=e){let c=a<r?l.lastIndexOf(t,r-a-1):-1;if(c>=0&&c+t.length+a>=e)return a+c;if(e==r&&l.length>=r+t.length-a&&l.slice(r-a,r-a+t.length)==t)return r}}return-1}function Na(n,t,e,r,i){let o=[];for(let s=0,a=0;s<n.length;s++){let l=n[s],c=a,d=a+=l.size;c>=e||d<=t?o.push(l):(c<t&&o.push(l.slice(0,t-c,r)),i&&(o.push(i),i=void 0),d>e&&o.push(l.slice(e-c,l.size,r)))}return o}function Ka(n,t=null){let e=n.domSelectionRange(),r=n.state.doc;if(!e.focusNode)return null;let i=n.docView.nearestDesc(e.focusNode),o=i&&i.size==0,s=n.docView.posFromDOM(e.focusNode,e.focusOffset,1);if(s<0)return null;let a=r.resolve(s),l,c;if(Hi(e)){for(l=a;i&&!i.node;)i=i.parent;let d=i.node;if(i&&d.isAtom&&N.isSelectable(d)&&i.parent&&!(d.isInline&&eg(e.focusNode,e.focusOffset,i.dom))){let u=i.posBefore;c=new N(s==u?a:r.resolve(u))}}else{let d=n.docView.posFromDOM(e.anchorNode,e.anchorOffset,1);if(d<0)return null;l=r.resolve(d)}if(!c){let d=t=="pointer"||n.state.selection.head<a.pos&&!o?1:-1;c=Wa(n,l,a,d)}return c}function Lu(n){return n.editable?n.hasFocus():zu(n)&&document.activeElement&&document.activeElement.contains(n.dom)}function be(n,t=!1){let e=n.state.selection;if(Bu(n,e),!!Lu(n)){if(!t&&n.input.mouseDown&&n.input.mouseDown.allowDefault&&wt){let r=n.domSelectionRange(),i=n.domObserver.currentSelection;if(r.anchorNode&&i.anchorNode&&dn(r.anchorNode,r.anchorOffset,i.anchorNode,i.anchorOffset)){n.input.mouseDown.delayedSelectionSync=!0,n.domObserver.setCurSelection();return}}if(n.domObserver.disconnectSelection(),n.cursorWrapper)_g(n);else{let{anchor:r,head:i}=e,o,s;au&&!(e instanceof _)&&(e.$from.parent.inlineContent||(o=lu(n,e.from)),!e.empty&&!e.$from.parent.inlineContent&&(s=lu(n,e.to))),n.docView.setSelection(r,i,n.root,t),au&&(o&&cu(o),s&&cu(s)),e.visible?n.dom.classList.remove("ProseMirror-hideselection"):(n.dom.classList.add("ProseMirror-hideselection"),"onselectionchange"in document&&Cg(n))}n.domObserver.setCurSelection(),n.domObserver.connectSelection()}}var au=gt||wt&&ig<63;function lu(n,t){let{node:e,offset:r}=n.docView.domFromPos(t,0),i=r<e.childNodes.length?e.childNodes[r]:null,o=r?e.childNodes[r-1]:null;if(gt&&i&&i.contentEditable=="false")return ya(i);if((!i||i.contentEditable=="false")&&(!o||o.contentEditable=="false")){if(i)return ya(i);if(o)return ya(o)}}function ya(n){return n.contentEditable="true",gt&&n.draggable&&(n.draggable=!1,n.wasDraggable=!0),n}function cu(n){n.contentEditable="false",n.wasDraggable&&(n.draggable=!0,n.wasDraggable=null)}function Cg(n){let t=n.dom.ownerDocument;t.removeEventListener("selectionchange",n.input.hideSelectionGuard);let e=n.domSelectionRange(),r=e.anchorNode,i=e.anchorOffset;t.addEventListener("selectionchange",n.input.hideSelectionGuard=()=>{(e.anchorNode!=r||e.anchorOffset!=i)&&(t.removeEventListener("selectionchange",n.input.hideSelectionGuard),setTimeout(()=>{(!Lu(n)||n.state.selection.visible)&&n.dom.classList.remove("ProseMirror-hideselection")},20))})}function _g(n){let t=n.domSelection(),e=document.createRange(),r=n.cursorWrapper.dom,i=r.nodeName=="IMG";i?e.setEnd(r.parentNode,Nt(r)+1):e.setEnd(r,0),e.collapse(!1),t.removeAllRanges(),t.addRange(e),!i&&!n.state.selection.visible&&Et&&Ne<=11&&(r.disabled=!0,r.disabled=!1)}function Bu(n,t){if(t instanceof N){let e=n.docView.descAt(t.from);e!=n.lastSelectedViewDesc&&(du(n),e&&e.selectNode(),n.lastSelectedViewDesc=e)}else du(n)}function du(n){n.lastSelectedViewDesc&&(n.lastSelectedViewDesc.parent&&n.lastSelectedViewDesc.deselectNode(),n.lastSelectedViewDesc=void 0)}function Wa(n,t,e,r){return n.someProp("createSelectionBetween",i=>i(n,t,e))||_.between(t,e,r)}function uu(n){return n.editable&&!n.hasFocus()?!1:zu(n)}function zu(n){let t=n.domSelectionRange();if(!t.anchorNode)return!1;try{return n.dom.contains(t.anchorNode.nodeType==3?t.anchorNode.parentNode:t.anchorNode)&&(n.editable||n.dom.contains(t.focusNode.nodeType==3?t.focusNode.parentNode:t.focusNode))}catch{return!1}}function Og(n){let t=n.docView.domFromPos(n.state.selection.anchor,0),e=n.domSelectionRange();return dn(t.node,t.offset,e.anchorNode,e.anchorOffset)}function Pa(n,t){let{$anchor:e,$head:r}=n.selection,i=t>0?e.max(r):e.min(r),o=i.parent.inlineContent?i.depth?n.doc.resolve(t>0?i.after():i.before()):null:i;return o&&P.findFrom(o,t)}function on(n,t){return n.dispatch(n.state.tr.setSelection(t).scrollIntoView()),!0}function hu(n,t,e){let r=n.state.selection;if(r instanceof _){if(!r.empty||e.indexOf("s")>-1)return!1;if(n.endOfTextblock(t>0?"right":"left")){let i=Pa(n.state,t);return i&&i instanceof N?on(n,i):!1}else if(!($t&&e.indexOf("m")>-1)){let i=r.$head,o=i.textOffset?null:t<0?i.nodeBefore:i.nodeAfter,s;if(!o||o.isText)return!1;let a=t<0?i.pos-o.nodeSize:i.pos;return o.isAtom||(s=n.docView.descAt(a))&&!s.contentDOM?N.isSelectable(o)?on(n,new N(t<0?n.state.doc.resolve(i.pos-o.nodeSize):i)):Fi?on(n,new _(n.state.doc.resolve(t<0?a:a+o.nodeSize))):!1:!1}}else{if(r instanceof N&&r.node.isInline)return on(n,new _(t>0?r.$to:r.$from));{let i=Pa(n.state,t);return i?on(n,i):!1}}}function $i(n){return n.nodeType==3?n.nodeValue.length:n.childNodes.length}function Or(n){let t=n.pmViewDesc;return t&&t.size==0&&(n.nextSibling||n.nodeName!="BR")}function xa(n){let t=n.domSelectionRange(),e=t.focusNode,r=t.focusOffset;if(!e)return;let i,o,s=!1;for(qt&&e.nodeType==1&&r<$i(e)&&Or(e.childNodes[r])&&(s=!0);;)if(r>0){if(e.nodeType!=1)break;{let a=e.childNodes[r-1];if(Or(a))i=e,o=--r;else if(a.nodeType==3)e=a,r=e.nodeValue.length;else break}}else{if(Hu(e))break;{let a=e.previousSibling;for(;a&&Or(a);)i=e.parentNode,o=Nt(a),a=a.previousSibling;if(a)e=a,r=$i(e);else{if(e=e.parentNode,e==n.dom)break;r=0}}}s?Ra(n,e,r):i&&Ra(n,i,o)}function va(n){let t=n.domSelectionRange(),e=t.focusNode,r=t.focusOffset;if(!e)return;let i=$i(e),o,s;for(;;)if(r<i){if(e.nodeType!=1)break;let a=e.childNodes[r];if(Or(a))o=e,s=++r;else break}else{if(Hu(e))break;{let a=e.nextSibling;for(;a&&Or(a);)o=a.parentNode,s=Nt(a)+1,a=a.nextSibling;if(a)e=a,r=0,i=$i(e);else{if(e=e.parentNode,e==n.dom)break;r=i=0}}}o&&Ra(n,o,s)}function Hu(n){let t=n.pmViewDesc;return t&&t.node&&t.node.isBlock}function Ra(n,t,e){let r=n.domSelection();if(Hi(r)){let o=document.createRange();o.setEnd(t,e),o.setStart(t,e),r.removeAllRanges(),r.addRange(o)}else r.extend&&r.extend(t,e);n.domObserver.setCurSelection();let{state:i}=n;setTimeout(()=>{n.state==i&&be(n)},50)}function fu(n,t,e){let r=n.state.selection;if(r instanceof _&&!r.empty||e.indexOf("s")>-1||$t&&e.indexOf("m")>-1)return!1;let{$from:i,$to:o}=r;if(!i.parent.inlineContent||n.endOfTextblock(t<0?"up":"down")){let s=Pa(n.state,t);if(s&&s instanceof N)return on(n,s)}if(!i.parent.inlineContent){let s=t<0?i:o,a=r instanceof Ot?P.near(s,t):P.findFrom(s,t);return a?on(n,a):!1}return!1}function pu(n,t){if(!(n.state.selection instanceof _))return!0;let{$head:e,$anchor:r,empty:i}=n.state.selection;if(!e.sameParent(r))return!0;if(!i)return!1;if(n.endOfTextblock(t>0?"forward":"backward"))return!0;let o=!e.textOffset&&(t<0?e.nodeBefore:e.nodeAfter);if(o&&!o.isText){let s=n.state.tr;return t<0?s.delete(e.pos-o.nodeSize,e.pos):s.delete(e.pos,e.pos+o.nodeSize),n.dispatch(s),!0}return!1}function mu(n,t,e){n.domObserver.stop(),t.contentEditable=e,n.domObserver.start()}function Ng(n){if(!gt||n.state.selection.$head.parentOffset>0)return!1;let{focusNode:t,focusOffset:e}=n.domSelectionRange();if(t&&t.nodeType==1&&e==0&&t.firstChild&&t.firstChild.contentEditable=="false"){let r=t.firstChild;mu(n,r,"true"),setTimeout(()=>mu(n,r,"false"),20)}return!1}function Pg(n){let t="";return n.ctrlKey&&(t+="c"),n.metaKey&&(t+="m"),n.altKey&&(t+="a"),n.shiftKey&&(t+="s"),t}function Rg(n,t){let e=t.keyCode,r=Pg(t);return e==8||$t&&e==72&&r=="c"?pu(n,-1)||xa(n):e==46||$t&&e==68&&r=="c"?pu(n,1)||va(n):e==13||e==27?!0:e==37||$t&&e==66&&r=="c"?hu(n,-1,r)||xa(n):e==39||$t&&e==70&&r=="c"?hu(n,1,r)||va(n):e==38||$t&&e==80&&r=="c"?fu(n,-1,r)||xa(n):e==40||$t&&e==78&&r=="c"?Ng(n)||fu(n,1,r)||va(n):r==($t?"m":"c")&&(e==66||e==73||e==89||e==90)}function Fu(n,t){n.someProp("transformCopied",f=>{t=f(t)});let e=[],{content:r,openStart:i,openEnd:o}=t;for(;i>1&&o>1&&r.childCount==1&&r.firstChild.childCount==1;){i--,o--;let f=r.firstChild;e.push(f.type.name,f.attrs!=f.type.defaultAttrs?f.attrs:null),r=f.content}let s=n.someProp("clipboardSerializer")||_t.fromSchema(n.state.schema),a=qu(),l=a.createElement("div");l.appendChild(s.serializeFragment(r,{document:a}));let c=l.firstChild,d,u=0;for(;c&&c.nodeType==1&&(d=Wu[c.nodeName.toLowerCase()]);){for(let f=d.length-1;f>=0;f--){let p=a.createElement(d[f]);for(;l.firstChild;)p.appendChild(l.firstChild);l.appendChild(p),u++}c=l.firstChild}c&&c.nodeType==1&&c.setAttribute("data-pm-slice",`${i} ${o}${u?` -${u}`:""} ${JSON.stringify(e)}`);let h=n.someProp("clipboardTextSerializer",f=>f(t))||t.content.textBetween(0,t.content.size,`
`);return{dom:l,text:h}}function Vu(n,t,e,r,i){let o=i.parent.type.spec.code,s,a;if(!e&&!t)return null;let l=t&&(r||o||!e);if(l){if(n.someProp("transformPastedText",h=>{t=h(t,o||r)}),o)return t?new M(w.from(n.state.schema.text(t.replace(/\r\n?/g,`
`))),0,0):M.empty;let u=n.someProp("clipboardTextParser",h=>h(t,i,r));if(u)a=u;else{let h=i.marks(),{schema:f}=n.state,p=_t.fromSchema(f);s=document.createElement("div"),t.split(/(?:\r\n?|\n)+/).forEach(x=>{let S=s.appendChild(document.createElement("p"));x&&S.appendChild(p.serializeNode(f.text(x,h)))})}}else n.someProp("transformPastedHTML",u=>{e=u(e)}),s=Ig(e),Fi&&Lg(s);let c=s&&s.querySelector("[data-pm-slice]"),d=c&&/^(\d+) (\d+)(?: -(\d+))? (.*)/.exec(c.getAttribute("data-pm-slice")||"");if(d&&d[3])for(let u=+d[3];u>0&&s.firstChild;u--)s=s.firstChild;if(a||(a=(n.someProp("clipboardParser")||n.someProp("domParser")||fe.fromSchema(n.state.schema)).parseSlice(s,{preserveWhitespace:!!(l||d),context:i,ruleFromNode(h){return h.nodeName=="BR"&&!h.nextSibling&&h.parentNode&&!Dg.test(h.parentNode.nodeName)?{ignore:!0}:null}})),d)a=Bg(gu(a,+d[1],+d[2]),d[4]);else if(a=M.maxOpen($g(a.content,i),!0),a.openStart||a.openEnd){let u=0,h=0;for(let f=a.content.firstChild;u<a.openStart&&!f.type.spec.isolating;u++,f=f.firstChild);for(let f=a.content.lastChild;h<a.openEnd&&!f.type.spec.isolating;h++,f=f.lastChild);a=gu(a,u,h)}return n.someProp("transformPasted",u=>{a=u(a)}),a}var Dg=/^(a|abbr|acronym|b|cite|code|del|em|i|ins|kbd|label|output|q|ruby|s|samp|span|strong|sub|sup|time|u|tt|var)$/i;function $g(n,t){if(n.childCount<2)return n;for(let e=t.depth;e>=0;e--){let i=t.node(e).contentMatchAt(t.index(e)),o,s=[];if(n.forEach(a=>{if(!s)return;let l=i.findWrapping(a.type),c;if(!l)return s=null;if(c=s.length&&o.length&&ju(l,o,a,s[s.length-1],0))s[s.length-1]=c;else{s.length&&(s[s.length-1]=Ku(s[s.length-1],o.length));let d=Uu(a,l);s.push(d),i=i.matchType(d.type),o=l}}),s)return w.from(s)}return n}function Uu(n,t,e=0){for(let r=t.length-1;r>=e;r--)n=t[r].create(null,w.from(n));return n}function ju(n,t,e,r,i){if(i<n.length&&i<t.length&&n[i]==t[i]){let o=ju(n,t,e,r.lastChild,i+1);if(o)return r.copy(r.content.replaceChild(r.childCount-1,o));if(r.contentMatchAt(r.childCount).matchType(i==n.length-1?e.type:n[i+1]))return r.copy(r.content.append(w.from(Uu(e,n,i+1))))}}function Ku(n,t){if(t==0)return n;let e=n.content.replaceChild(n.childCount-1,Ku(n.lastChild,t-1)),r=n.contentMatchAt(n.childCount).fillBefore(w.empty,!0);return n.copy(e.append(r))}function Da(n,t,e,r,i,o){let s=t<0?n.firstChild:n.lastChild,a=s.content;return i<r-1&&(a=Da(a,t,e,r,i+1,o)),i>=e&&(a=t<0?s.contentMatchAt(0).fillBefore(a,n.childCount>1||o<=i).append(a):a.append(s.contentMatchAt(s.childCount).fillBefore(w.empty,!0))),n.replaceChild(t<0?0:n.childCount-1,s.copy(a))}function gu(n,t,e){return t<n.openStart&&(n=new M(Da(n.content,-1,t,n.openStart,0,n.openEnd),t,n.openEnd)),e<n.openEnd&&(n=new M(Da(n.content,1,e,n.openEnd,0,0),n.openStart,e)),n}var Wu={thead:["table"],tbody:["table"],tfoot:["table"],caption:["table"],colgroup:["table"],col:["table","colgroup"],tr:["table","tbody"],td:["table","tbody","tr"],th:["table","tbody","tr"]},bu=null;function qu(){return bu||(bu=document.implementation.createHTMLDocument("title"))}function Ig(n){let t=/^(\s*<meta [^>]*>)*/.exec(n);t&&(n=n.slice(t[0].length));let e=qu().createElement("div"),r=/<([a-z][^>\s]+)/i.exec(n),i;if((i=r&&Wu[r[1].toLowerCase()])&&(n=i.map(o=>"<"+o+">").join("")+n+i.map(o=>"</"+o+">").reverse().join("")),e.innerHTML=n,i)for(let o=0;o<i.length;o++)e=e.querySelector(i[o])||e;return e}function Lg(n){let t=n.querySelectorAll(wt?"span:not([class]):not([style])":"span.Apple-converted-space");for(let e=0;e<t.length;e++){let r=t[e];r.childNodes.length==1&&r.textContent=="\xA0"&&r.parentNode&&r.parentNode.replaceChild(n.ownerDocument.createTextNode(" "),r)}}function Bg(n,t){if(!n.size)return n;let e=n.content.firstChild.type.schema,r;try{r=JSON.parse(t)}catch{return n}let{content:i,openStart:o,openEnd:s}=n;for(let a=r.length-2;a>=0;a-=2){let l=e.nodes[r[a]];if(!l||l.hasRequiredAttrs())break;i=w.from(l.create(r[a+1],i)),o++,s++}return new M(i,o,s)}var bt={},yt={},zg={touchstart:!0,touchmove:!0},$a=class{constructor(){this.shiftKey=!1,this.mouseDown=null,this.lastKeyCode=null,this.lastKeyCodeTime=0,this.lastClick={time:0,x:0,y:0,type:""},this.lastSelectionOrigin=null,this.lastSelectionTime=0,this.lastIOSEnter=0,this.lastIOSEnterFallbackTimeout=-1,this.lastFocus=0,this.lastTouch=0,this.lastAndroidDelete=0,this.composing=!1,this.composingTimeout=-1,this.compositionNodes=[],this.compositionEndedAt=-2e8,this.domChangeCount=0,this.eventHandlers=Object.create(null),this.hideSelectionGuard=null}};function Hg(n){for(let t in bt){let e=bt[t];n.dom.addEventListener(t,n.input.eventHandlers[t]=r=>{Vg(n,r)&&!qa(n,r)&&(n.editable||!(r.type in yt))&&e(n,r)},zg[t]?{passive:!0}:void 0)}gt&&n.dom.addEventListener("input",()=>null),Ia(n)}function Oe(n,t){n.input.lastSelectionOrigin=t,n.input.lastSelectionTime=Date.now()}function Fg(n){n.domObserver.stop();for(let t in n.input.eventHandlers)n.dom.removeEventListener(t,n.input.eventHandlers[t]);clearTimeout(n.input.composingTimeout),clearTimeout(n.input.lastIOSEnterFallbackTimeout)}function Ia(n){n.someProp("handleDOMEvents",t=>{for(let e in t)n.input.eventHandlers[e]||n.dom.addEventListener(e,n.input.eventHandlers[e]=r=>qa(n,r))})}function qa(n,t){return n.someProp("handleDOMEvents",e=>{let r=e[t.type];return r?r(n,t)||t.defaultPrevented:!1})}function Vg(n,t){if(!t.bubbles)return!0;if(t.defaultPrevented)return!1;for(let e=t.target;e!=n.dom;e=e.parentNode)if(!e||e.nodeType==11||e.pmViewDesc&&e.pmViewDesc.stopEvent(t))return!1;return!0}function Ug(n,t){!qa(n,t)&&bt[t.type]&&(n.editable||!(t.type in yt))&&bt[t.type](n,t)}yt.keydown=(n,t)=>{let e=t;if(n.input.shiftKey=e.keyCode==16||e.shiftKey,!Gu(n,e)&&(n.input.lastKeyCode=e.keyCode,n.input.lastKeyCodeTime=Date.now(),!(Zt&&wt&&e.keyCode==13)))if(e.keyCode!=229&&n.domObserver.forceFlush(),Ln&&e.keyCode==13&&!e.ctrlKey&&!e.altKey&&!e.metaKey){let r=Date.now();n.input.lastIOSEnter=r,n.input.lastIOSEnterFallbackTimeout=setTimeout(()=>{n.input.lastIOSEnter==r&&(n.someProp("handleKeyDown",i=>i(n,Dn(13,"Enter"))),n.input.lastIOSEnter=0)},200)}else n.someProp("handleKeyDown",r=>r(n,e))||Rg(n,e)?e.preventDefault():Oe(n,"key")};yt.keyup=(n,t)=>{t.keyCode==16&&(n.input.shiftKey=!1)};yt.keypress=(n,t)=>{let e=t;if(Gu(n,e)||!e.charCode||e.ctrlKey&&!e.altKey||$t&&e.metaKey)return;if(n.someProp("handleKeyPress",i=>i(n,e))){e.preventDefault();return}let r=n.state.selection;if(!(r instanceof _)||!r.$from.sameParent(r.$to)){let i=String.fromCharCode(e.charCode);n.someProp("handleTextInput",o=>o(n,r.$from.pos,r.$to.pos,i))||n.dispatch(n.state.tr.insertText(i).scrollIntoView()),e.preventDefault()}};function Vi(n){return{left:n.clientX,top:n.clientY}}function jg(n,t){let e=t.x-n.clientX,r=t.y-n.clientY;return e*e+r*r<100}function Ja(n,t,e,r,i){if(r==-1)return!1;let o=n.state.doc.resolve(r);for(let s=o.depth+1;s>0;s--)if(n.someProp(t,a=>s>o.depth?a(n,e,o.nodeAfter,o.before(s),i,!0):a(n,e,o.node(s),o.before(s),i,!1)))return!0;return!1}function In(n,t,e){n.focused||n.focus();let r=n.state.tr.setSelection(t);e=="pointer"&&r.setMeta("pointer",!0),n.dispatch(r)}function Kg(n,t){if(t==-1)return!1;let e=n.state.doc.resolve(t),r=e.nodeAfter;return r&&r.isAtom&&N.isSelectable(r)?(In(n,new N(e),"pointer"),!0):!1}function Wg(n,t){if(t==-1)return!1;let e=n.state.selection,r,i;e instanceof N&&(r=e.node);let o=n.state.doc.resolve(t);for(let s=o.depth+1;s>0;s--){let a=s>o.depth?o.nodeAfter:o.node(s);if(N.isSelectable(a)){r&&e.$from.depth>0&&s>=e.$from.depth&&o.before(e.$from.depth+1)==e.$from.pos?i=o.before(e.$from.depth):i=o.before(s);break}}return i!=null?(In(n,N.create(n.state.doc,i),"pointer"),!0):!1}function qg(n,t,e,r,i){return Ja(n,"handleClickOn",t,e,r)||n.someProp("handleClick",o=>o(n,t,r))||(i?Wg(n,e):Kg(n,e))}function Jg(n,t,e,r){return Ja(n,"handleDoubleClickOn",t,e,r)||n.someProp("handleDoubleClick",i=>i(n,t,r))}function Gg(n,t,e,r){return Ja(n,"handleTripleClickOn",t,e,r)||n.someProp("handleTripleClick",i=>i(n,t,r))||Yg(n,e,r)}function Yg(n,t,e){if(e.button!=0)return!1;let r=n.state.doc;if(t==-1)return r.inlineContent?(In(n,_.create(r,0,r.content.size),"pointer"),!0):!1;let i=r.resolve(t);for(let o=i.depth+1;o>0;o--){let s=o>i.depth?i.nodeAfter:i.node(o),a=i.before(o);if(s.inlineContent)In(n,_.create(r,a+1,a+1+s.content.size),"pointer");else if(N.isSelectable(s))In(n,N.create(r,a),"pointer");else continue;return!0}}function Ga(n){return Ii(n)}var Ju=$t?"metaKey":"ctrlKey";bt.mousedown=(n,t)=>{let e=t;n.input.shiftKey=e.shiftKey;let r=Ga(n),i=Date.now(),o="singleClick";i-n.input.lastClick.time<500&&jg(e,n.input.lastClick)&&!e[Ju]&&(n.input.lastClick.type=="singleClick"?o="doubleClick":n.input.lastClick.type=="doubleClick"&&(o="tripleClick")),n.input.lastClick={time:i,x:e.clientX,y:e.clientY,type:o};let s=n.posAtCoords(Vi(e));s&&(o=="singleClick"?(n.input.mouseDown&&n.input.mouseDown.done(),n.input.mouseDown=new La(n,s,e,!!r)):(o=="doubleClick"?Jg:Gg)(n,s.pos,s.inside,e)?e.preventDefault():Oe(n,"pointer"))};var La=class{constructor(t,e,r,i){this.view=t,this.pos=e,this.event=r,this.flushed=i,this.delayedSelectionSync=!1,this.mightDrag=null,this.startDoc=t.state.doc,this.selectNode=!!r[Ju],this.allowDefault=r.shiftKey;let o,s;if(e.inside>-1)o=t.state.doc.nodeAt(e.inside),s=e.inside;else{let d=t.state.doc.resolve(e.pos);o=d.parent,s=d.depth?d.before():0}let a=i?null:r.target,l=a?t.docView.nearestDesc(a,!0):null;this.target=l?l.dom:null;let{selection:c}=t.state;(r.button==0&&o.type.spec.draggable&&o.type.spec.selectable!==!1||c instanceof N&&c.from<=s&&c.to>s)&&(this.mightDrag={node:o,pos:s,addAttr:!!(this.target&&!this.target.draggable),setUneditable:!!(this.target&&qt&&!this.target.hasAttribute("contentEditable"))}),this.target&&this.mightDrag&&(this.mightDrag.addAttr||this.mightDrag.setUneditable)&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&(this.target.draggable=!0),this.mightDrag.setUneditable&&setTimeout(()=>{this.view.input.mouseDown==this&&this.target.setAttribute("contentEditable","false")},20),this.view.domObserver.start()),t.root.addEventListener("mouseup",this.up=this.up.bind(this)),t.root.addEventListener("mousemove",this.move=this.move.bind(this)),Oe(t,"pointer")}done(){this.view.root.removeEventListener("mouseup",this.up),this.view.root.removeEventListener("mousemove",this.move),this.mightDrag&&this.target&&(this.view.domObserver.stop(),this.mightDrag.addAttr&&this.target.removeAttribute("draggable"),this.mightDrag.setUneditable&&this.target.removeAttribute("contentEditable"),this.view.domObserver.start()),this.delayedSelectionSync&&setTimeout(()=>be(this.view)),this.view.input.mouseDown=null}up(t){if(this.done(),!this.view.dom.contains(t.target))return;let e=this.pos;this.view.state.doc!=this.startDoc&&(e=this.view.posAtCoords(Vi(t))),this.updateAllowDefault(t),this.allowDefault||!e?Oe(this.view,"pointer"):qg(this.view,e.pos,e.inside,t,this.selectNode)?t.preventDefault():t.button==0&&(this.flushed||gt&&this.mightDrag&&!this.mightDrag.node.isAtom||wt&&!this.view.state.selection.visible&&Math.min(Math.abs(e.pos-this.view.state.selection.from),Math.abs(e.pos-this.view.state.selection.to))<=2)?(In(this.view,P.near(this.view.state.doc.resolve(e.pos)),"pointer"),t.preventDefault()):Oe(this.view,"pointer")}move(t){this.updateAllowDefault(t),Oe(this.view,"pointer"),t.buttons==0&&this.done()}updateAllowDefault(t){!this.allowDefault&&(Math.abs(this.event.x-t.clientX)>4||Math.abs(this.event.y-t.clientY)>4)&&(this.allowDefault=!0)}};bt.touchstart=n=>{n.input.lastTouch=Date.now(),Ga(n),Oe(n,"pointer")};bt.touchmove=n=>{n.input.lastTouch=Date.now(),Oe(n,"pointer")};bt.contextmenu=n=>Ga(n);function Gu(n,t){return n.composing?!0:gt&&Math.abs(t.timeStamp-n.input.compositionEndedAt)<500?(n.input.compositionEndedAt=-2e8,!0):!1}var Xg=Zt?5e3:-1;yt.compositionstart=yt.compositionupdate=n=>{if(!n.composing){n.domObserver.flush();let{state:t}=n,e=t.selection.$from;if(t.selection.empty&&(t.storedMarks||!e.textOffset&&e.parentOffset&&e.nodeBefore.marks.some(r=>r.type.spec.inclusive===!1)))n.markCursor=n.state.storedMarks||e.marks(),Ii(n,!0),n.markCursor=null;else if(Ii(n),qt&&t.selection.empty&&e.parentOffset&&!e.textOffset&&e.nodeBefore.marks.length){let r=n.domSelectionRange();for(let i=r.focusNode,o=r.focusOffset;i&&i.nodeType==1&&o!=0;){let s=o<0?i.lastChild:i.childNodes[o-1];if(!s)break;if(s.nodeType==3){n.domSelection().collapse(s,s.nodeValue.length);break}else i=s,o=-1}}n.input.composing=!0}Yu(n,Xg)};yt.compositionend=(n,t)=>{n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=t.timeStamp,Yu(n,20))};function Yu(n,t){clearTimeout(n.input.composingTimeout),t>-1&&(n.input.composingTimeout=setTimeout(()=>Ii(n),t))}function Xu(n){for(n.composing&&(n.input.composing=!1,n.input.compositionEndedAt=Qg());n.input.compositionNodes.length>0;)n.input.compositionNodes.pop().markParentsDirty()}function Qg(){let n=document.createEvent("Event");return n.initEvent("event",!0,!0),n.timeStamp}function Ii(n,t=!1){if(!(Zt&&n.domObserver.flushingSoon>=0)){if(n.domObserver.forceFlush(),Xu(n),t||n.docView&&n.docView.dirty){let e=Ka(n);return e&&!e.eq(n.state.selection)?n.dispatch(n.state.tr.setSelection(e)):n.updateState(n.state),!0}return!1}}function Zg(n,t){if(!n.dom.parentNode)return;let e=n.dom.parentNode.appendChild(document.createElement("div"));e.appendChild(t),e.style.cssText="position: fixed; left: -10000px; top: 10px";let r=getSelection(),i=document.createRange();i.selectNodeContents(t),n.dom.blur(),r.removeAllRanges(),r.addRange(i),setTimeout(()=>{e.parentNode&&e.parentNode.removeChild(e),n.focus()},50)}var zn=Et&&Ne<15||Ln&&og<604;bt.copy=yt.cut=(n,t)=>{let e=t,r=n.state.selection,i=e.type=="cut";if(r.empty)return;let o=zn?null:e.clipboardData,s=r.content(),{dom:a,text:l}=Fu(n,s);o?(e.preventDefault(),o.clearData(),o.setData("text/html",a.innerHTML),o.setData("text/plain",l)):Zg(n,a),i&&n.dispatch(n.state.tr.deleteSelection().scrollIntoView().setMeta("uiEvent","cut"))};function tb(n){return n.openStart==0&&n.openEnd==0&&n.content.childCount==1?n.content.firstChild:null}function eb(n,t){if(!n.dom.parentNode)return;let e=n.input.shiftKey||n.state.selection.$from.parent.type.spec.code,r=n.dom.parentNode.appendChild(document.createElement(e?"textarea":"div"));e||(r.contentEditable="true"),r.style.cssText="position: fixed; left: -10000px; top: 10px",r.focus(),setTimeout(()=>{n.focus(),r.parentNode&&r.parentNode.removeChild(r),e?Ba(n,r.value,null,t):Ba(n,r.textContent,r.innerHTML,t)},50)}function Ba(n,t,e,r){let i=Vu(n,t,e,n.input.shiftKey,n.state.selection.$from);if(n.someProp("handlePaste",a=>a(n,r,i||M.empty)))return!0;if(!i)return!1;let o=tb(i),s=o?n.state.tr.replaceSelectionWith(o,n.input.shiftKey):n.state.tr.replaceSelection(i);return n.dispatch(s.scrollIntoView().setMeta("paste",!0).setMeta("uiEvent","paste")),!0}yt.paste=(n,t)=>{let e=t;if(n.composing&&!Zt)return;let r=zn?null:e.clipboardData;r&&Ba(n,r.getData("text/plain"),r.getData("text/html"),e)?e.preventDefault():eb(n,e)};var za=class{constructor(t,e){this.slice=t,this.move=e}},Qu=$t?"altKey":"ctrlKey";bt.dragstart=(n,t)=>{let e=t,r=n.input.mouseDown;if(r&&r.done(),!e.dataTransfer)return;let i=n.state.selection,o=i.empty?null:n.posAtCoords(Vi(e));if(!(o&&o.pos>=i.from&&o.pos<=(i instanceof N?i.to-1:i.to))){if(r&&r.mightDrag)n.dispatch(n.state.tr.setSelection(N.create(n.state.doc,r.mightDrag.pos)));else if(e.target&&e.target.nodeType==1){let c=n.docView.nearestDesc(e.target,!0);c&&c.node.type.spec.draggable&&c!=n.docView&&n.dispatch(n.state.tr.setSelection(N.create(n.state.doc,c.posBefore)))}}let s=n.state.selection.content(),{dom:a,text:l}=Fu(n,s);e.dataTransfer.clearData(),e.dataTransfer.setData(zn?"Text":"text/html",a.innerHTML),e.dataTransfer.effectAllowed="copyMove",zn||e.dataTransfer.setData("text/plain",l),n.dragging=new za(s,!e[Qu])};bt.dragend=n=>{let t=n.dragging;window.setTimeout(()=>{n.dragging==t&&(n.dragging=null)},50)};yt.dragover=yt.dragenter=(n,t)=>t.preventDefault();yt.drop=(n,t)=>{let e=t,r=n.dragging;if(n.dragging=null,!e.dataTransfer)return;let i=n.posAtCoords(Vi(e));if(!i)return;let o=n.state.doc.resolve(i.pos),s=r&&r.slice;s?n.someProp("transformPasted",p=>{s=p(s)}):s=Vu(n,e.dataTransfer.getData(zn?"Text":"text/plain"),zn?null:e.dataTransfer.getData("text/html"),!1,o);let a=!!(r&&!e[Qu]);if(n.someProp("handleDrop",p=>p(n,e,s||M.empty,a))){e.preventDefault();return}if(!s)return;e.preventDefault();let l=s?Ti(n.state.doc,o.pos,s):o.pos;l==null&&(l=o.pos);let c=n.state.tr;a&&c.deleteSelection();let d=c.mapping.map(l),u=s.openStart==0&&s.openEnd==0&&s.content.childCount==1,h=c.doc;if(u?c.replaceRangeWith(d,d,s.content.firstChild):c.replaceRange(d,d,s),c.doc.eq(h))return;let f=c.doc.resolve(d);if(u&&N.isSelectable(s.content.firstChild)&&f.nodeAfter&&f.nodeAfter.sameMarkup(s.content.firstChild))c.setSelection(new N(f));else{let p=c.mapping.map(l);c.mapping.maps[c.mapping.maps.length-1].forEach((x,S,b,v)=>p=v),c.setSelection(Wa(n,f,c.doc.resolve(p)))}n.focus(),n.dispatch(c.setMeta("uiEvent","drop"))};bt.focus=n=>{n.input.lastFocus=Date.now(),n.focused||(n.domObserver.stop(),n.dom.classList.add("ProseMirror-focused"),n.domObserver.start(),n.focused=!0,setTimeout(()=>{n.docView&&n.hasFocus()&&!n.domObserver.currentSelection.eq(n.domSelectionRange())&&be(n)},20))};bt.blur=(n,t)=>{let e=t;n.focused&&(n.domObserver.stop(),n.dom.classList.remove("ProseMirror-focused"),n.domObserver.start(),e.relatedTarget&&n.dom.contains(e.relatedTarget)&&n.domObserver.currentSelection.clear(),n.focused=!1)};bt.beforeinput=(n,t)=>{if(wt&&Zt&&t.inputType=="deleteContentBackward"){n.domObserver.flushSoon();let{domChangeCount:r}=n.input;setTimeout(()=>{if(n.input.domChangeCount!=r||(n.dom.blur(),n.focus(),n.someProp("handleKeyDown",o=>o(n,Dn(8,"Backspace")))))return;let{$cursor:i}=n.state.selection;i&&i.pos>0&&n.dispatch(n.state.tr.delete(i.pos-1,i.pos).scrollIntoView())},50)}};for(let n in yt)bt[n]=yt[n];function Pr(n,t){if(n==t)return!0;for(let e in n)if(n[e]!==t[e])return!1;for(let e in t)if(!(e in n))return!1;return!0}var Ha=class n{constructor(t,e){this.toDOM=t,this.spec=e||ln,this.side=this.spec.side||0}map(t,e,r,i){let{pos:o,deleted:s}=t.mapResult(e.from+i,this.side<0?-1:1);return s?null:new ot(o-r,o-r,this)}valid(){return!0}eq(t){return this==t||t instanceof n&&(this.spec.key&&this.spec.key==t.spec.key||this.toDOM==t.toDOM&&Pr(this.spec,t.spec))}destroy(t){this.spec.destroy&&this.spec.destroy(t)}},an=class n{constructor(t,e){this.attrs=t,this.spec=e||ln}map(t,e,r,i){let o=t.map(e.from+i,this.spec.inclusiveStart?-1:1)-r,s=t.map(e.to+i,this.spec.inclusiveEnd?1:-1)-r;return o>=s?null:new ot(o,s,this)}valid(t,e){return e.from<e.to}eq(t){return this==t||t instanceof n&&Pr(this.attrs,t.attrs)&&Pr(this.spec,t.spec)}static is(t){return t.type instanceof n}destroy(){}},Fa=class n{constructor(t,e){this.attrs=t,this.spec=e||ln}map(t,e,r,i){let o=t.mapResult(e.from+i,1);if(o.deleted)return null;let s=t.mapResult(e.to+i,-1);return s.deleted||s.pos<=o.pos?null:new ot(o.pos-r,s.pos-r,this)}valid(t,e){let{index:r,offset:i}=t.content.findIndex(e.from),o;return i==e.from&&!(o=t.child(r)).isText&&i+o.nodeSize==e.to}eq(t){return this==t||t instanceof n&&Pr(this.attrs,t.attrs)&&Pr(this.spec,t.spec)}destroy(){}},ot=class n{constructor(t,e,r){this.from=t,this.to=e,this.type=r}copy(t,e){return new n(t,e,this.type)}eq(t,e=0){return this.type.eq(t.type)&&this.from+e==t.from&&this.to+e==t.to}map(t,e,r){return this.type.map(t,this,e,r)}static widget(t,e,r){return new n(t,t,new Ha(e,r))}static inline(t,e,r,i){return new n(t,e,new an(r,i))}static node(t,e,r,i){return new n(t,e,new Fa(r,i))}get spec(){return this.type.spec}get inline(){return this.type instanceof an}},Rn=[],ln={},q=class n{constructor(t,e){this.local=t.length?t:Rn,this.children=e.length?e:Rn}static create(t,e){return e.length?Bi(e,t,0,ln):ft}find(t,e,r){let i=[];return this.findInner(t??0,e??1e9,i,0,r),i}findInner(t,e,r,i,o){for(let s=0;s<this.local.length;s++){let a=this.local[s];a.from<=e&&a.to>=t&&(!o||o(a.spec))&&r.push(a.copy(a.from+i,a.to+i))}for(let s=0;s<this.children.length;s+=3)if(this.children[s]<e&&this.children[s+1]>t){let a=this.children[s]+1;this.children[s+2].findInner(t-a,e-a,r,i+a,o)}}map(t,e,r){return this==ft||t.maps.length==0?this:this.mapInner(t,e,0,0,r||ln)}mapInner(t,e,r,i,o){let s;for(let a=0;a<this.local.length;a++){let l=this.local[a].map(t,r,i);l&&l.type.valid(e,l)?(s||(s=[])).push(l):o.onRemove&&o.onRemove(this.local[a].spec)}return this.children.length?nb(this.children,s||[],t,e,r,i,o):s?new n(s.sort(cn),Rn):ft}add(t,e){return e.length?this==ft?n.create(t,e):this.addInner(t,e,0):this}addInner(t,e,r){let i,o=0;t.forEach((a,l)=>{let c=l+r,d;if(d=th(e,a,c)){for(i||(i=this.children.slice());o<i.length&&i[o]<l;)o+=3;i[o]==l?i[o+2]=i[o+2].addInner(a,d,c+1):i.splice(o,0,l,l+a.nodeSize,Bi(d,a,c+1,ln)),o+=3}});let s=Zu(o?eh(e):e,-r);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||s.splice(a--,1);return new n(s.length?this.local.concat(s).sort(cn):this.local,i||this.children)}remove(t){return t.length==0||this==ft?this:this.removeInner(t,0)}removeInner(t,e){let r=this.children,i=this.local;for(let o=0;o<r.length;o+=3){let s,a=r[o]+e,l=r[o+1]+e;for(let d=0,u;d<t.length;d++)(u=t[d])&&u.from>a&&u.to<l&&(t[d]=null,(s||(s=[])).push(u));if(!s)continue;r==this.children&&(r=this.children.slice());let c=r[o+2].removeInner(s,a+1);c!=ft?r[o+2]=c:(r.splice(o,3),o-=3)}if(i.length){for(let o=0,s;o<t.length;o++)if(s=t[o])for(let a=0;a<i.length;a++)i[a].eq(s,e)&&(i==this.local&&(i=this.local.slice()),i.splice(a--,1))}return r==this.children&&i==this.local?this:i.length||r.length?new n(i,r):ft}forChild(t,e){if(this==ft)return this;if(e.isLeaf)return n.empty;let r,i;for(let a=0;a<this.children.length;a+=3)if(this.children[a]>=t){this.children[a]==t&&(r=this.children[a+2]);break}let o=t+1,s=o+e.content.size;for(let a=0;a<this.local.length;a++){let l=this.local[a];if(l.from<s&&l.to>o&&l.type instanceof an){let c=Math.max(o,l.from)-o,d=Math.min(s,l.to)-o;c<d&&(i||(i=[])).push(l.copy(c,d))}}if(i){let a=new n(i.sort(cn),Rn);return r?new Li([a,r]):a}return r||ft}eq(t){if(this==t)return!0;if(!(t instanceof n)||this.local.length!=t.local.length||this.children.length!=t.children.length)return!1;for(let e=0;e<this.local.length;e++)if(!this.local[e].eq(t.local[e]))return!1;for(let e=0;e<this.children.length;e+=3)if(this.children[e]!=t.children[e]||this.children[e+1]!=t.children[e+1]||!this.children[e+2].eq(t.children[e+2]))return!1;return!0}locals(t){return Ya(this.localsInner(t))}localsInner(t){if(this==ft)return Rn;if(t.inlineContent||!this.local.some(an.is))return this.local;let e=[];for(let r=0;r<this.local.length;r++)this.local[r].type instanceof an||e.push(this.local[r]);return e}};q.empty=new q([],[]);q.removeOverlap=Ya;var ft=q.empty,Li=class n{constructor(t){this.members=t}map(t,e){let r=this.members.map(i=>i.map(t,e,ln));return n.from(r)}forChild(t,e){if(e.isLeaf)return q.empty;let r=[];for(let i=0;i<this.members.length;i++){let o=this.members[i].forChild(t,e);o!=ft&&(o instanceof n?r=r.concat(o.members):r.push(o))}return n.from(r)}eq(t){if(!(t instanceof n)||t.members.length!=this.members.length)return!1;for(let e=0;e<this.members.length;e++)if(!this.members[e].eq(t.members[e]))return!1;return!0}locals(t){let e,r=!0;for(let i=0;i<this.members.length;i++){let o=this.members[i].localsInner(t);if(o.length)if(!e)e=o;else{r&&(e=e.slice(),r=!1);for(let s=0;s<o.length;s++)e.push(o[s])}}return e?Ya(r?e:e.sort(cn)):Rn}static from(t){switch(t.length){case 0:return ft;case 1:return t[0];default:return new n(t)}}};function nb(n,t,e,r,i,o,s){let a=n.slice();for(let c=0,d=o;c<e.maps.length;c++){let u=0;e.maps[c].forEach((h,f,p,x)=>{let S=x-p-(f-h);for(let b=0;b<a.length;b+=3){let v=a[b+1];if(v<0||h>v+d-u)continue;let m=a[b]+d-u;f>=m?a[b+1]=h<=m?-2:-1:p>=i&&S&&(a[b]+=S,a[b+1]+=S)}u+=S}),d=e.maps[c].map(d,-1)}let l=!1;for(let c=0;c<a.length;c+=3)if(a[c+1]<0){if(a[c+1]==-2){l=!0,a[c+1]=-1;continue}let d=e.map(n[c]+o),u=d-i;if(u<0||u>=r.content.size){l=!0;continue}let h=e.map(n[c+1]+o,-1),f=h-i,{index:p,offset:x}=r.content.findIndex(u),S=r.maybeChild(p);if(S&&x==u&&x+S.nodeSize==f){let b=a[c+2].mapInner(e,S,d+1,n[c]+o+1,s);b!=ft?(a[c]=u,a[c+1]=f,a[c+2]=b):(a[c+1]=-2,l=!0)}else l=!0}if(l){let c=rb(a,n,t,e,i,o,s),d=Bi(c,r,0,s);t=d.local;for(let u=0;u<a.length;u+=3)a[u+1]<0&&(a.splice(u,3),u-=3);for(let u=0,h=0;u<d.children.length;u+=3){let f=d.children[u];for(;h<a.length&&a[h]<f;)h+=3;a.splice(h,0,d.children[u],d.children[u+1],d.children[u+2])}}return new q(t.sort(cn),a)}function Zu(n,t){if(!t||!n.length)return n;let e=[];for(let r=0;r<n.length;r++){let i=n[r];e.push(new ot(i.from+t,i.to+t,i.type))}return e}function rb(n,t,e,r,i,o,s){function a(l,c){for(let d=0;d<l.local.length;d++){let u=l.local[d].map(r,i,c);u?e.push(u):s.onRemove&&s.onRemove(l.local[d].spec)}for(let d=0;d<l.children.length;d+=3)a(l.children[d+2],l.children[d]+c+1)}for(let l=0;l<n.length;l+=3)n[l+1]==-1&&a(n[l+2],t[l]+o+1);return e}function th(n,t,e){if(t.isLeaf)return null;let r=e+t.nodeSize,i=null;for(let o=0,s;o<n.length;o++)(s=n[o])&&s.from>e&&s.to<r&&((i||(i=[])).push(s),n[o]=null);return i}function eh(n){let t=[];for(let e=0;e<n.length;e++)n[e]!=null&&t.push(n[e]);return t}function Bi(n,t,e,r){let i=[],o=!1;t.forEach((a,l)=>{let c=th(n,a,l+e);if(c){o=!0;let d=Bi(c,a,e+l+1,r);d!=ft&&i.push(l,l+a.nodeSize,d)}});let s=Zu(o?eh(n):n,-e).sort(cn);for(let a=0;a<s.length;a++)s[a].type.valid(t,s[a])||(r.onRemove&&r.onRemove(s[a].spec),s.splice(a--,1));return s.length||i.length?new q(s,i):ft}function cn(n,t){return n.from-t.from||n.to-t.to}function Ya(n){let t=n;for(let e=0;e<t.length-1;e++){let r=t[e];if(r.from!=r.to)for(let i=e+1;i<t.length;i++){let o=t[i];if(o.from==r.from){o.to!=r.to&&(t==n&&(t=n.slice()),t[i]=o.copy(o.from,r.to),yu(t,i+1,o.copy(r.to,o.to)));continue}else{o.from<r.to&&(t==n&&(t=n.slice()),t[e]=r.copy(r.from,o.from),yu(t,i,r.copy(o.from,r.to)));break}}}return t}function yu(n,t,e){for(;t<n.length&&cn(e,n[t])>0;)t++;n.splice(t,0,e)}function ka(n){let t=[];return n.someProp("decorations",e=>{let r=e(n.state);r&&r!=ft&&t.push(r)}),n.cursorWrapper&&t.push(q.create(n.state.doc,[n.cursorWrapper.deco])),Li.from(t)}var ib={childList:!0,characterData:!0,characterDataOldValue:!0,attributes:!0,attributeOldValue:!0,subtree:!0},ob=Et&&Ne<=11,Va=class{constructor(){this.anchorNode=null,this.anchorOffset=0,this.focusNode=null,this.focusOffset=0}set(t){this.anchorNode=t.anchorNode,this.anchorOffset=t.anchorOffset,this.focusNode=t.focusNode,this.focusOffset=t.focusOffset}clear(){this.anchorNode=this.focusNode=null}eq(t){return t.anchorNode==this.anchorNode&&t.anchorOffset==this.anchorOffset&&t.focusNode==this.focusNode&&t.focusOffset==this.focusOffset}},Ua=class{constructor(t,e){this.view=t,this.handleDOMChange=e,this.queue=[],this.flushingSoon=-1,this.observer=null,this.currentSelection=new Va,this.onCharData=null,this.suppressingSelectionUpdates=!1,this.observer=window.MutationObserver&&new window.MutationObserver(r=>{for(let i=0;i<r.length;i++)this.queue.push(r[i]);Et&&Ne<=11&&r.some(i=>i.type=="childList"&&i.removedNodes.length||i.type=="characterData"&&i.oldValue.length>i.target.nodeValue.length)?this.flushSoon():this.flush()}),ob&&(this.onCharData=r=>{this.queue.push({target:r.target,type:"characterData",oldValue:r.prevValue}),this.flushSoon()}),this.onSelectionChange=this.onSelectionChange.bind(this)}flushSoon(){this.flushingSoon<0&&(this.flushingSoon=window.setTimeout(()=>{this.flushingSoon=-1,this.flush()},20))}forceFlush(){this.flushingSoon>-1&&(window.clearTimeout(this.flushingSoon),this.flushingSoon=-1,this.flush())}start(){this.observer&&(this.observer.takeRecords(),this.observer.observe(this.view.dom,ib)),this.onCharData&&this.view.dom.addEventListener("DOMCharacterDataModified",this.onCharData),this.connectSelection()}stop(){if(this.observer){let t=this.observer.takeRecords();if(t.length){for(let e=0;e<t.length;e++)this.queue.push(t[e]);window.setTimeout(()=>this.flush(),20)}this.observer.disconnect()}this.onCharData&&this.view.dom.removeEventListener("DOMCharacterDataModified",this.onCharData),this.disconnectSelection()}connectSelection(){this.view.dom.ownerDocument.addEventListener("selectionchange",this.onSelectionChange)}disconnectSelection(){this.view.dom.ownerDocument.removeEventListener("selectionchange",this.onSelectionChange)}suppressSelectionUpdates(){this.suppressingSelectionUpdates=!0,setTimeout(()=>this.suppressingSelectionUpdates=!1,50)}onSelectionChange(){if(uu(this.view)){if(this.suppressingSelectionUpdates)return be(this.view);if(Et&&Ne<=11&&!this.view.state.selection.empty){let t=this.view.domSelectionRange();if(t.focusNode&&dn(t.focusNode,t.focusOffset,t.anchorNode,t.anchorOffset))return this.flushSoon()}this.flush()}}setCurSelection(){this.currentSelection.set(this.view.domSelectionRange())}ignoreSelectionChange(t){if(!t.focusNode)return!0;let e=new Set,r;for(let o=t.focusNode;o;o=Nr(o))e.add(o);for(let o=t.anchorNode;o;o=Nr(o))if(e.has(o)){r=o;break}let i=r&&this.view.docView.nearestDesc(r);if(i&&i.ignoreMutation({type:"selection",target:r.nodeType==3?r.parentNode:r}))return this.setCurSelection(),!0}flush(){let{view:t}=this;if(!t.docView||this.flushingSoon>-1)return;let e=this.observer?this.observer.takeRecords():[];this.queue.length&&(e=this.queue.concat(e),this.queue.length=0);let r=t.domSelectionRange(),i=!this.suppressingSelectionUpdates&&!this.currentSelection.eq(r)&&uu(t)&&!this.ignoreSelectionChange(r),o=-1,s=-1,a=!1,l=[];if(t.editable)for(let d=0;d<e.length;d++){let u=this.registerMutation(e[d],l);u&&(o=o<0?u.from:Math.min(u.from,o),s=s<0?u.to:Math.max(u.to,s),u.typeOver&&(a=!0))}if(qt&&l.length>1){let d=l.filter(u=>u.nodeName=="BR");if(d.length==2){let u=d[0],h=d[1];u.parentNode&&u.parentNode.parentNode==h.parentNode?h.remove():u.remove()}}let c=null;o<0&&i&&t.input.lastFocus>Date.now()-200&&t.input.lastTouch<Date.now()-300&&Hi(r)&&(c=Ka(t))&&c.eq(P.near(t.state.doc.resolve(0),1))?(t.input.lastFocus=0,be(t),this.currentSelection.set(r),t.scrollToSelection()):(o>-1||i)&&(o>-1&&(t.docView.markDirty(o,s),sb(t)),this.handleDOMChange(o,s,a,l),t.docView&&t.docView.dirty?t.updateState(t.state):this.currentSelection.eq(r)||be(t),this.currentSelection.set(r))}registerMutation(t,e){if(e.indexOf(t.target)>-1)return null;let r=this.view.docView.nearestDesc(t.target);if(t.type=="attributes"&&(r==this.view.docView||t.attributeName=="contenteditable"||t.attributeName=="style"&&!t.oldValue&&!t.target.getAttribute("style"))||!r||r.ignoreMutation(t))return null;if(t.type=="childList"){for(let d=0;d<t.addedNodes.length;d++)e.push(t.addedNodes[d]);if(r.contentDOM&&r.contentDOM!=r.dom&&!r.contentDOM.contains(t.target))return{from:r.posBefore,to:r.posAfter};let i=t.previousSibling,o=t.nextSibling;if(Et&&Ne<=11&&t.addedNodes.length)for(let d=0;d<t.addedNodes.length;d++){let{previousSibling:u,nextSibling:h}=t.addedNodes[d];(!u||Array.prototype.indexOf.call(t.addedNodes,u)<0)&&(i=u),(!h||Array.prototype.indexOf.call(t.addedNodes,h)<0)&&(o=h)}let s=i&&i.parentNode==t.target?Nt(i)+1:0,a=r.localPosFromDOM(t.target,s,-1),l=o&&o.parentNode==t.target?Nt(o):t.target.childNodes.length,c=r.localPosFromDOM(t.target,l,1);return{from:a,to:c}}else return t.type=="attributes"?{from:r.posAtStart-r.border,to:r.posAtEnd+r.border}:{from:r.posAtStart,to:r.posAtEnd,typeOver:t.target.nodeValue==t.oldValue}}},xu=new WeakMap,vu=!1;function sb(n){if(!xu.has(n)&&(xu.set(n,null),["normal","nowrap","pre-line"].indexOf(getComputedStyle(n.dom).whiteSpace)!==-1)){if(n.requiresGeckoHackNode=qt,vu)return;console.warn("ProseMirror expects the CSS white-space property to be set, preferably to 'pre-wrap'. It is recommended to load style/prosemirror.css from the prosemirror-view package."),vu=!0}}function ab(n){let t;function e(l){l.preventDefault(),l.stopImmediatePropagation(),t=l.getTargetRanges()[0]}n.dom.addEventListener("beforeinput",e,!0),document.execCommand("indent"),n.dom.removeEventListener("beforeinput",e,!0);let r=t.startContainer,i=t.startOffset,o=t.endContainer,s=t.endOffset,a=n.domAtPos(n.state.selection.anchor);return dn(a.node,a.offset,o,s)&&([r,i,o,s]=[o,s,r,i]),{anchorNode:r,anchorOffset:i,focusNode:o,focusOffset:s}}function lb(n,t,e){let{node:r,fromOffset:i,toOffset:o,from:s,to:a}=n.docView.parseRange(t,e),l=n.domSelectionRange(),c,d=l.anchorNode;if(d&&n.dom.contains(d.nodeType==1?d:d.parentNode)&&(c=[{node:d,offset:l.anchorOffset}],Hi(l)||c.push({node:l.focusNode,offset:l.focusOffset})),wt&&n.input.lastKeyCode===8)for(let S=o;S>i;S--){let b=r.childNodes[S-1],v=b.pmViewDesc;if(b.nodeName=="BR"&&!v){o=S;break}if(!v||v.size)break}let u=n.state.doc,h=n.someProp("domParser")||fe.fromSchema(n.state.schema),f=u.resolve(s),p=null,x=h.parse(r,{topNode:f.parent,topMatch:f.parent.contentMatchAt(f.index()),topOpen:!0,from:i,to:o,preserveWhitespace:f.parent.type.whitespace=="pre"?"full":!0,findPositions:c,ruleFromNode:cb,context:f});if(c&&c[0].pos!=null){let S=c[0].pos,b=c[1]&&c[1].pos;b==null&&(b=S),p={anchor:S+s,head:b+s}}return{doc:x,sel:p,from:s,to:a}}function cb(n){let t=n.pmViewDesc;if(t)return t.parseRule();if(n.nodeName=="BR"&&n.parentNode){if(gt&&/^(ul|ol)$/i.test(n.parentNode.nodeName)){let e=document.createElement("div");return e.appendChild(document.createElement("li")),{skip:e}}else if(n.parentNode.lastChild==n||gt&&/^(tr|table)$/i.test(n.parentNode.nodeName))return{ignore:!0}}else if(n.nodeName=="IMG"&&n.getAttribute("mark-placeholder"))return{ignore:!0};return null}function db(n,t,e,r,i){if(t<0){let A=n.input.lastSelectionTime>Date.now()-50?n.input.lastSelectionOrigin:null,B=Ka(n,A);if(B&&!n.state.selection.eq(B)){let K=n.state.tr.setSelection(B);A=="pointer"?K.setMeta("pointer",!0):A=="key"&&K.scrollIntoView(),n.dispatch(K)}return}let o=n.state.doc.resolve(t),s=o.sharedDepth(e);t=o.before(s+1),e=n.state.doc.resolve(e).after(s+1);let a=n.state.selection,l=lb(n,t,e),c=n.state.doc,d=c.slice(l.from,l.to),u,h;n.input.lastKeyCode===8&&Date.now()-100<n.input.lastKeyCodeTime?(u=n.state.selection.to,h="end"):(u=n.state.selection.from,h="start"),n.input.lastKeyCode=null;let f=fb(d.content,l.doc.content,l.from,u,h);if((Ln&&n.input.lastIOSEnter>Date.now()-225||Zt)&&i.some(A=>A.nodeName=="DIV"||A.nodeName=="P")&&(!f||f.endA>=f.endB)&&n.someProp("handleKeyDown",A=>A(n,Dn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(!f)if(r&&a instanceof _&&!a.empty&&a.$head.sameParent(a.$anchor)&&!n.composing&&!(l.sel&&l.sel.anchor!=l.sel.head))f={start:a.from,endA:a.to,endB:a.to};else{if(l.sel){let A=ku(n,n.state.doc,l.sel);A&&!A.eq(n.state.selection)&&n.dispatch(n.state.tr.setSelection(A))}return}if(wt&&n.cursorWrapper&&l.sel&&l.sel.anchor==n.cursorWrapper.deco.from&&l.sel.head==l.sel.anchor){let A=f.endB-f.start;l.sel={anchor:l.sel.anchor+A,head:l.sel.anchor+A}}n.input.domChangeCount++,n.state.selection.from<n.state.selection.to&&f.start==f.endB&&n.state.selection instanceof _&&(f.start>n.state.selection.from&&f.start<=n.state.selection.from+2&&n.state.selection.from>=l.from?f.start=n.state.selection.from:f.endA<n.state.selection.to&&f.endA>=n.state.selection.to-2&&n.state.selection.to<=l.to&&(f.endB+=n.state.selection.to-f.endA,f.endA=n.state.selection.to)),Et&&Ne<=11&&f.endB==f.start+1&&f.endA==f.start&&f.start>l.from&&l.doc.textBetween(f.start-l.from-1,f.start-l.from+1)==" \xA0"&&(f.start--,f.endA--,f.endB--);let p=l.doc.resolveNoCache(f.start-l.from),x=l.doc.resolveNoCache(f.endB-l.from),S=c.resolve(f.start),b=p.sameParent(x)&&p.parent.inlineContent&&S.end()>=f.endA,v;if((Ln&&n.input.lastIOSEnter>Date.now()-225&&(!b||i.some(A=>A.nodeName=="DIV"||A.nodeName=="P"))||!b&&p.pos<l.doc.content.size&&(v=P.findFrom(l.doc.resolve(p.pos+1),1,!0))&&v.head==x.pos)&&n.someProp("handleKeyDown",A=>A(n,Dn(13,"Enter")))){n.input.lastIOSEnter=0;return}if(n.state.selection.anchor>f.start&&hb(c,f.start,f.endA,p,x)&&n.someProp("handleKeyDown",A=>A(n,Dn(8,"Backspace")))){Zt&&wt&&n.domObserver.suppressSelectionUpdates();return}wt&&Zt&&f.endB==f.start&&(n.input.lastAndroidDelete=Date.now()),Zt&&!b&&p.start()!=x.start()&&x.parentOffset==0&&p.depth==x.depth&&l.sel&&l.sel.anchor==l.sel.head&&l.sel.head==f.endA&&(f.endB-=2,x=l.doc.resolveNoCache(f.endB-l.from),setTimeout(()=>{n.someProp("handleKeyDown",function(A){return A(n,Dn(13,"Enter"))})},20));let m=f.start,g=f.endA,k,y,O;if(b){if(p.pos==x.pos)Et&&Ne<=11&&p.parentOffset==0&&(n.domObserver.suppressSelectionUpdates(),setTimeout(()=>be(n),20)),k=n.state.tr.delete(m,g),y=c.resolve(f.start).marksAcross(c.resolve(f.endA));else if(f.endA==f.endB&&(O=ub(p.parent.content.cut(p.parentOffset,x.parentOffset),S.parent.content.cut(S.parentOffset,f.endA-S.start()))))k=n.state.tr,O.type=="add"?k.addMark(m,g,O.mark):k.removeMark(m,g,O.mark);else if(p.parent.child(p.index()).isText&&p.index()==x.index()-(x.textOffset?0:1)){let A=p.parent.textBetween(p.parentOffset,x.parentOffset);if(n.someProp("handleTextInput",B=>B(n,m,g,A)))return;k=n.state.tr.insertText(A,m,g)}}if(k||(k=n.state.tr.replace(m,g,l.doc.slice(f.start-l.from,f.endB-l.from))),l.sel){let A=ku(n,k.doc,l.sel);A&&!(wt&&Zt&&n.composing&&A.empty&&(f.start!=f.endB||n.input.lastAndroidDelete<Date.now()-100)&&(A.head==m||A.head==k.mapping.map(g)-1)||Et&&A.empty&&A.head==m)&&k.setSelection(A)}y&&k.ensureMarks(y),n.dispatch(k.scrollIntoView())}function ku(n,t,e){return Math.max(e.anchor,e.head)>t.content.size?null:Wa(n,t.resolve(e.anchor),t.resolve(e.head))}function ub(n,t){let e=n.firstChild.marks,r=t.firstChild.marks,i=e,o=r,s,a,l;for(let d=0;d<r.length;d++)i=r[d].removeFromSet(i);for(let d=0;d<e.length;d++)o=e[d].removeFromSet(o);if(i.length==1&&o.length==0)a=i[0],s="add",l=d=>d.mark(a.addToSet(d.marks));else if(i.length==0&&o.length==1)a=o[0],s="remove",l=d=>d.mark(a.removeFromSet(d.marks));else return null;let c=[];for(let d=0;d<t.childCount;d++)c.push(l(t.child(d)));if(w.from(c).eq(n))return{mark:a,type:s}}function hb(n,t,e,r,i){if(!r.parent.isTextblock||e-t<=i.pos-r.pos||Sa(r,!0,!1)<i.pos)return!1;let o=n.resolve(t);if(o.parentOffset<o.parent.content.size||!o.parent.isTextblock)return!1;let s=n.resolve(Sa(o,!0,!0));return!s.parent.isTextblock||s.pos>e||Sa(s,!0,!1)<e?!1:r.parent.content.cut(r.parentOffset).eq(s.parent.content)}function Sa(n,t,e){let r=n.depth,i=t?n.end():n.pos;for(;r>0&&(t||n.indexAfter(r)==n.node(r).childCount);)r--,i++,t=!1;if(e){let o=n.node(r).maybeChild(n.indexAfter(r));for(;o&&!o.isLeaf;)o=o.firstChild,i++}return i}function fb(n,t,e,r,i){let o=n.findDiffStart(t,e);if(o==null)return null;let{a:s,b:a}=n.findDiffEnd(t,e+n.size,e+t.size);if(i=="end"){let l=Math.max(0,o-Math.min(s,a));r-=s+l-o}if(s<o&&n.size<t.size){let l=r<=o&&r>=s?o-r:0;o-=l,a=o+(a-s),s=o}else if(a<o){let l=r<=o&&r>=a?o-r:0;o-=l,s=o+(s-a),a=o}return{start:o,endA:s,endB:a}}var zi=class{constructor(t,e){this._root=null,this.focused=!1,this.trackWrites=null,this.mounted=!1,this.markCursor=null,this.cursorWrapper=null,this.lastSelectedViewDesc=void 0,this.input=new $a,this.prevDirectPlugins=[],this.pluginViews=[],this.requiresGeckoHackNode=!1,this.dragging=null,this._props=e,this.state=e.state,this.directPlugins=e.plugins||[],this.directPlugins.forEach(Mu),this.dispatch=this.dispatch.bind(this),this.dom=t&&t.mount||document.createElement("div"),t&&(t.appendChild?t.appendChild(this.dom):typeof t=="function"?t(this.dom):t.mount&&(this.mounted=!0)),this.editable=Eu(this),wu(this),this.nodeViews=Au(this),this.docView=ou(this.state.doc,Su(this),ka(this),this.dom,this),this.domObserver=new Ua(this,(r,i,o,s)=>db(this,r,i,o,s)),this.domObserver.start(),Hg(this),this.updatePluginViews()}get composing(){return this.input.composing}get props(){if(this._props.state!=this.state){let t=this._props;this._props={};for(let e in t)this._props[e]=t[e];this._props.state=this.state}return this._props}update(t){t.handleDOMEvents!=this._props.handleDOMEvents&&Ia(this);let e=this._props;this._props=t,t.plugins&&(t.plugins.forEach(Mu),this.directPlugins=t.plugins),this.updateStateInner(t.state,e)}setProps(t){let e={};for(let r in this._props)e[r]=this._props[r];e.state=this.state;for(let r in t)e[r]=t[r];this.update(e)}updateState(t){this.updateStateInner(t,this._props)}updateStateInner(t,e){let r=this.state,i=!1,o=!1;t.storedMarks&&this.composing&&(Xu(this),o=!0),this.state=t;let s=r.plugins!=t.plugins||this._props.plugins!=e.plugins;if(s||this._props.plugins!=e.plugins||this._props.nodeViews!=e.nodeViews){let h=Au(this);mb(h,this.nodeViews)&&(this.nodeViews=h,i=!0)}(s||e.handleDOMEvents!=this._props.handleDOMEvents)&&Ia(this),this.editable=Eu(this),wu(this);let a=ka(this),l=Su(this),c=r.plugins!=t.plugins&&!r.doc.eq(t.doc)?"reset":t.scrollToSelection>r.scrollToSelection?"to selection":"preserve",d=i||!this.docView.matchesNode(t.doc,l,a);(d||!t.selection.eq(r.selection))&&(o=!0);let u=c=="preserve"&&o&&this.dom.style.overflowAnchor==null&&lg(this);if(o){this.domObserver.stop();let h=d&&(Et||wt)&&!this.composing&&!r.selection.empty&&!t.selection.empty&&pb(r.selection,t.selection);if(d){let f=wt?this.trackWrites=this.domSelectionRange().focusNode:null;(i||!this.docView.update(t.doc,l,a,this))&&(this.docView.updateOuterDeco([]),this.docView.destroy(),this.docView=ou(t.doc,l,a,this.dom,this)),f&&!this.trackWrites&&(h=!0)}h||!(this.input.mouseDown&&this.domObserver.currentSelection.eq(this.domSelectionRange())&&Og(this))?be(this,h):(Bu(this,t.selection),this.domObserver.setCurSelection()),this.domObserver.start()}this.updatePluginViews(r),c=="reset"?this.dom.scrollTop=0:c=="to selection"?this.scrollToSelection():u&&cg(u)}scrollToSelection(){let t=this.domSelectionRange().focusNode;if(!this.someProp("handleScrollToSelection",e=>e(this)))if(this.state.selection instanceof N){let e=this.docView.domAfterPos(this.state.selection.from);e.nodeType==1&&tu(this,e.getBoundingClientRect(),t)}else tu(this,this.coordsAtPos(this.state.selection.head,1),t)}destroyPluginViews(){let t;for(;t=this.pluginViews.pop();)t.destroy&&t.destroy()}updatePluginViews(t){if(!t||t.plugins!=this.state.plugins||this.directPlugins!=this.prevDirectPlugins){this.prevDirectPlugins=this.directPlugins,this.destroyPluginViews();for(let e=0;e<this.directPlugins.length;e++){let r=this.directPlugins[e];r.spec.view&&this.pluginViews.push(r.spec.view(this))}for(let e=0;e<this.state.plugins.length;e++){let r=this.state.plugins[e];r.spec.view&&this.pluginViews.push(r.spec.view(this))}}else for(let e=0;e<this.pluginViews.length;e++){let r=this.pluginViews[e];r.update&&r.update(this,t)}}someProp(t,e){let r=this._props&&this._props[t],i;if(r!=null&&(i=e?e(r):r))return i;for(let s=0;s<this.directPlugins.length;s++){let a=this.directPlugins[s].props[t];if(a!=null&&(i=e?e(a):a))return i}let o=this.state.plugins;if(o)for(let s=0;s<o.length;s++){let a=o[s].props[t];if(a!=null&&(i=e?e(a):a))return i}}hasFocus(){if(Et){let t=this.root.activeElement;if(t==this.dom)return!0;if(!t||!this.dom.contains(t))return!1;for(;t&&this.dom!=t&&this.dom.contains(t);){if(t.contentEditable=="false")return!1;t=t.parentElement}return!0}return this.root.activeElement==this.dom}focus(){this.domObserver.stop(),this.editable&&dg(this.dom),be(this),this.domObserver.start()}get root(){let t=this._root;if(t==null){for(let e=this.dom.parentNode;e;e=e.parentNode)if(e.nodeType==9||e.nodeType==11&&e.host)return e.getSelection||(Object.getPrototypeOf(e).getSelection=()=>e.ownerDocument.getSelection()),this._root=e}return t||document}posAtCoords(t){return mg(this,t)}coordsAtPos(t,e=1){return Pu(this,t,e)}domAtPos(t,e=0){return this.docView.domFromPos(t,e)}nodeDOM(t){let e=this.docView.descAt(t);return e?e.nodeDOM:null}posAtDOM(t,e,r=-1){let i=this.docView.posFromDOM(t,e,r);if(i==null)throw new RangeError("DOM position not inside the editor");return i}endOfTextblock(t,e){return vg(this,e||this.state,t)}destroy(){this.docView&&(Fg(this),this.destroyPluginViews(),this.mounted?(this.docView.update(this.state.doc,[],ka(this),this),this.dom.textContent=""):this.dom.parentNode&&this.dom.parentNode.removeChild(this.dom),this.docView.destroy(),this.docView=null)}get isDestroyed(){return this.docView==null}dispatchEvent(t){return Ug(this,t)}dispatch(t){let e=this._props.dispatchTransaction;e?e.call(this,t):this.updateState(this.state.apply(t))}domSelectionRange(){return gt&&this.root.nodeType===11&&rg(this.dom.ownerDocument)==this.dom?ab(this):this.domSelection()}domSelection(){return this.root.getSelection()}};function Su(n){let t=Object.create(null);return t.class="ProseMirror",t.contenteditable=String(n.editable),t.translate="no",n.someProp("attributes",e=>{if(typeof e=="function"&&(e=e(n.state)),e)for(let r in e)r=="class"&&(t.class+=" "+e[r]),r=="style"?t.style=(t.style?t.style+";":"")+e[r]:!t[r]&&r!="contenteditable"&&r!="nodeName"&&(t[r]=String(e[r]))}),[ot.node(0,n.state.doc.content.size,t)]}function wu(n){if(n.markCursor){let t=document.createElement("img");t.className="ProseMirror-separator",t.setAttribute("mark-placeholder","true"),t.setAttribute("alt",""),n.cursorWrapper={dom:t,deco:ot.widget(n.state.selection.head,t,{raw:!0,marks:n.markCursor})}}else n.cursorWrapper=null}function Eu(n){return!n.someProp("editable",t=>t(n.state)===!1)}function pb(n,t){let e=Math.min(n.$anchor.sharedDepth(n.head),t.$anchor.sharedDepth(t.head));return n.$anchor.start(e)!=t.$anchor.start(e)}function Au(n){let t=Object.create(null);function e(r){for(let i in r)Object.prototype.hasOwnProperty.call(t,i)||(t[i]=r[i])}return n.someProp("nodeViews",e),n.someProp("markViews",e),t}function mb(n,t){let e=0,r=0;for(let i in n){if(n[i]!=t[i])return!0;e++}for(let i in t)r++;return e!=r}function Mu(n){if(n.spec.state||n.spec.filterTransaction||n.spec.appendTransaction)throw new RangeError("Plugins passed directly to the view must not have a state component")}var ye={8:"Backspace",9:"Tab",10:"Enter",12:"NumLock",13:"Enter",16:"Shift",17:"Control",18:"Alt",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",44:"PrintScreen",45:"Insert",46:"Delete",59:";",61:"=",91:"Meta",92:"Meta",106:"*",107:"+",108:",",109:"-",110:".",111:"/",144:"NumLock",145:"ScrollLock",160:"Shift",161:"Shift",162:"Control",163:"Control",164:"Alt",165:"Alt",173:"-",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},ji={48:")",49:"!",50:"@",51:"#",52:"$",53:"%",54:"^",55:"&",56:"*",57:"(",59:":",61:"+",173:"_",186:":",187:"+",188:"<",189:"_",190:">",191:"?",192:"~",219:"{",220:"|",221:"}",222:'"'},gb=typeof navigator<"u"&&/Mac/.test(navigator.platform),bb=typeof navigator<"u"&&/MSIE \d|Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(navigator.userAgent);for(tt=0;tt<10;tt++)ye[48+tt]=ye[96+tt]=String(tt);var tt;for(tt=1;tt<=24;tt++)ye[tt+111]="F"+tt;var tt;for(tt=65;tt<=90;tt++)ye[tt]=String.fromCharCode(tt+32),ji[tt]=String.fromCharCode(tt);var tt;for(Ui in ye)ji.hasOwnProperty(Ui)||(ji[Ui]=ye[Ui]);var Ui;function nh(n){var t=gb&&n.metaKey&&n.shiftKey&&!n.ctrlKey&&!n.altKey||bb&&n.shiftKey&&n.key&&n.key.length==1||n.key=="Unidentified",e=!t&&n.key||(n.shiftKey?ji:ye)[n.keyCode]||n.key||"Unidentified";return e=="Esc"&&(e="Escape"),e=="Del"&&(e="Delete"),e=="Left"&&(e="ArrowLeft"),e=="Up"&&(e="ArrowUp"),e=="Right"&&(e="ArrowRight"),e=="Down"&&(e="ArrowDown"),e}var yb=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):!1;function xb(n){let t=n.split(/-(?!$)/),e=t[t.length-1];e=="Space"&&(e=" ");let r,i,o,s;for(let a=0;a<t.length-1;a++){let l=t[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))yb?s=!0:i=!0;else throw new Error("Unrecognized modifier name: "+l)}return r&&(e="Alt-"+e),i&&(e="Ctrl-"+e),s&&(e="Meta-"+e),o&&(e="Shift-"+e),e}function vb(n){let t=Object.create(null);for(let e in n)t[xb(e)]=n[e];return t}function Xa(n,t,e=!0){return t.altKey&&(n="Alt-"+n),t.ctrlKey&&(n="Ctrl-"+n),t.metaKey&&(n="Meta-"+n),e&&t.shiftKey&&(n="Shift-"+n),n}function rh(n){return new R({props:{handleKeyDown:Qa(n)}})}function Qa(n){let t=vb(n);return function(e,r){let i=nh(r),o,s=t[Xa(i,r)];if(s&&s(e.state,e.dispatch,e))return!0;if(i.length==1&&i!=" "){if(r.shiftKey){let a=t[Xa(i,r,!1)];if(a&&a(e.state,e.dispatch,e))return!0}if((r.shiftKey||r.altKey||r.metaKey||i.charCodeAt(0)>127)&&(o=ye[r.keyCode])&&o!=i){let a=t[Xa(o,r)];if(a&&a(e.state,e.dispatch,e))return!0}}return!1}}var Ki=(n,t)=>n.selection.empty?!1:(t&&t(n.tr.deleteSelection().scrollIntoView()),!0);function oh(n,t){let{$cursor:e}=n.selection;return!e||(t?!t.endOfTextblock("backward",n):e.parentOffset>0)?null:e}var tl=(n,t,e)=>{let r=oh(n,e);if(!r)return!1;let i=nl(r);if(!i){let s=r.blockRange(),a=s&&me(s);return a==null?!1:(t&&t(n.tr.lift(s,a).scrollIntoView()),!0)}let o=i.nodeBefore;if(ph(n,i,t,-1))return!0;if(r.parent.content.size==0&&(Hn(o,"end")||N.isSelectable(o)))for(let s=r.depth;;s--){let a=Mr(n.doc,r.before(s),r.after(s),M.empty);if(a&&a.slice.size<a.to-a.from){if(t){let l=n.tr.step(a);l.setSelection(Hn(o,"end")?P.findFrom(l.doc.resolve(l.mapping.map(i.pos,-1)),-1):N.create(l.doc,i.pos-o.nodeSize)),t(l.scrollIntoView())}return!0}if(s==1||r.node(s-1).childCount>1)break}return o.isAtom&&i.depth==r.depth-1?(t&&t(n.tr.delete(i.pos-o.nodeSize,i.pos).scrollIntoView()),!0):!1},sh=(n,t,e)=>{let r=oh(n,e);if(!r)return!1;let i=nl(r);return i?lh(n,i,t):!1},ah=(n,t,e)=>{let r=ch(n,e);if(!r)return!1;let i=ol(r);return i?lh(n,i,t):!1};function lh(n,t,e){let r=t.nodeBefore,i=r,o=t.pos-1;for(;!i.isTextblock;o--){if(i.type.spec.isolating)return!1;let d=i.lastChild;if(!d)return!1;i=d}let s=t.nodeAfter,a=s,l=t.pos+1;for(;!a.isTextblock;l++){if(a.type.spec.isolating)return!1;let d=a.firstChild;if(!d)return!1;a=d}let c=Mr(n.doc,o,l,M.empty);if(!c||c.from!=o||c instanceof it&&c.slice.size>=l-o)return!1;if(e){let d=n.tr.step(c);d.setSelection(_.create(d.doc,o)),e(d.scrollIntoView())}return!0}function Hn(n,t,e=!1){for(let r=n;r;r=t=="start"?r.firstChild:r.lastChild){if(r.isTextblock)return!0;if(e&&r.childCount!=1)return!1}return!1}var el=(n,t,e)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(e?!e.endOfTextblock("backward",n):r.parentOffset>0)return!1;o=nl(r)}let s=o&&o.nodeBefore;return!s||!N.isSelectable(s)?!1:(t&&t(n.tr.setSelection(N.create(n.doc,o.pos-s.nodeSize)).scrollIntoView()),!0)};function nl(n){if(!n.parent.type.spec.isolating)for(let t=n.depth-1;t>=0;t--){if(n.index(t)>0)return n.doc.resolve(n.before(t+1));if(n.node(t).type.spec.isolating)break}return null}function ch(n,t){let{$cursor:e}=n.selection;return!e||(t?!t.endOfTextblock("forward",n):e.parentOffset<e.parent.content.size)?null:e}var rl=(n,t,e)=>{let r=ch(n,e);if(!r)return!1;let i=ol(r);if(!i)return!1;let o=i.nodeAfter;if(ph(n,i,t,1))return!0;if(r.parent.content.size==0&&(Hn(o,"start")||N.isSelectable(o))){let s=Mr(n.doc,r.before(),r.after(),M.empty);if(s&&s.slice.size<s.to-s.from){if(t){let a=n.tr.step(s);a.setSelection(Hn(o,"start")?P.findFrom(a.doc.resolve(a.mapping.map(i.pos)),1):N.create(a.doc,a.mapping.map(i.pos))),t(a.scrollIntoView())}return!0}}return o.isAtom&&i.depth==r.depth-1?(t&&t(n.tr.delete(i.pos,i.pos+o.nodeSize).scrollIntoView()),!0):!1},il=(n,t,e)=>{let{$head:r,empty:i}=n.selection,o=r;if(!i)return!1;if(r.parent.isTextblock){if(e?!e.endOfTextblock("forward",n):r.parentOffset<r.parent.content.size)return!1;o=ol(r)}let s=o&&o.nodeAfter;return!s||!N.isSelectable(s)?!1:(t&&t(n.tr.setSelection(N.create(n.doc,o.pos)).scrollIntoView()),!0)};function ol(n){if(!n.parent.type.spec.isolating)for(let t=n.depth-1;t>=0;t--){let e=n.node(t);if(n.index(t)+1<e.childCount)return n.doc.resolve(n.after(t+1));if(e.type.spec.isolating)break}return null}var dh=(n,t)=>{let e=n.selection,r=e instanceof N,i;if(r){if(e.node.isTextblock||!Kt(n.doc,e.from))return!1;i=e.from}else if(i=On(n.doc,e.from,-1),i==null)return!1;if(t){let o=n.tr.join(i);r&&o.setSelection(N.create(o.doc,i-n.doc.resolve(i).nodeBefore.nodeSize)),t(o.scrollIntoView())}return!0},uh=(n,t)=>{let e=n.selection,r;if(e instanceof N){if(e.node.isTextblock||!Kt(n.doc,e.to))return!1;r=e.to}else if(r=On(n.doc,e.to,1),r==null)return!1;return t&&t(n.tr.join(r).scrollIntoView()),!0},hh=(n,t)=>{let{$from:e,$to:r}=n.selection,i=e.blockRange(r),o=i&&me(i);return o==null?!1:(t&&t(n.tr.lift(i,o).scrollIntoView()),!0)},sl=(n,t)=>{let{$head:e,$anchor:r}=n.selection;return!e.parent.type.spec.code||!e.sameParent(r)?!1:(t&&t(n.tr.insertText(`
`).scrollIntoView()),!0)};function al(n){for(let t=0;t<n.edgeCount;t++){let{type:e}=n.edge(t);if(e.isTextblock&&!e.hasRequiredAttrs())return e}return null}var ll=(n,t)=>{let{$head:e,$anchor:r}=n.selection;if(!e.parent.type.spec.code||!e.sameParent(r))return!1;let i=e.node(-1),o=e.indexAfter(-1),s=al(i.contentMatchAt(o));if(!s||!i.canReplaceWith(o,o,s))return!1;if(t){let a=e.after(),l=n.tr.replaceWith(a,a,s.createAndFill());l.setSelection(P.near(l.doc.resolve(a),1)),t(l.scrollIntoView())}return!0},Fn=(n,t)=>{let e=n.selection,{$from:r,$to:i}=e;if(e instanceof Ot||r.parent.inlineContent||i.parent.inlineContent)return!1;let o=al(i.parent.contentMatchAt(i.indexAfter()));if(!o||!o.isTextblock)return!1;if(t){let s=(!r.parentOffset&&i.index()<i.parent.childCount?r:i).pos,a=n.tr.insert(s,o.createAndFill());a.setSelection(_.create(a.doc,s+1)),t(a.scrollIntoView())}return!0},cl=(n,t)=>{let{$cursor:e}=n.selection;if(!e||e.parent.content.size)return!1;if(e.depth>1&&e.after()!=e.end(-1)){let o=e.before();if(Dt(n.doc,o))return t&&t(n.tr.split(o).scrollIntoView()),!0}let r=e.blockRange(),i=r&&me(r);return i==null?!1:(t&&t(n.tr.lift(r,i).scrollIntoView()),!0)};function kb(n){return(t,e)=>{let{$from:r,$to:i}=t.selection;if(t.selection instanceof N&&t.selection.node.isBlock)return!r.parentOffset||!Dt(t.doc,r.pos)?!1:(e&&e(t.tr.split(r.pos).scrollIntoView()),!0);if(!r.depth)return!1;let o=[],s,a,l=!1,c=!1;for(let f=r.depth;;f--)if(r.node(f).isBlock){l=r.end(f)==r.pos+(r.depth-f),c=r.start(f)==r.pos-(r.depth-f),a=al(r.node(f-1).contentMatchAt(r.indexAfter(f-1)));let x=n&&n(i.parent,l,r);o.unshift(x||(l&&a?{type:a}:null)),s=f;break}else{if(f==1)return!1;o.unshift(null)}let d=t.tr;(t.selection instanceof _||t.selection instanceof Ot)&&d.deleteSelection();let u=d.mapping.map(r.pos),h=Dt(d.doc,u,o.length,o);if(h||(o[0]=a?{type:a}:null,h=Dt(d.doc,u,o.length,o)),d.split(u,o.length,o),!l&&c&&r.node(s).type!=a){let f=d.mapping.map(r.before(s)),p=d.doc.resolve(f);a&&r.node(s-1).canReplaceWith(p.index(),p.index()+1,a)&&d.setNodeMarkup(d.mapping.map(r.before(s)),a)}return e&&e(d.scrollIntoView()),!0}}var Sb=kb();var fh=(n,t)=>{let{$from:e,to:r}=n.selection,i,o=e.sharedDepth(r);return o==0?!1:(i=e.before(o),t&&t(n.tr.setSelection(N.create(n.doc,i))),!0)},wb=(n,t)=>(t&&t(n.tr.setSelection(new Ot(n.doc))),!0);function Eb(n,t,e){let r=t.nodeBefore,i=t.nodeAfter,o=t.index();return!r||!i||!r.type.compatibleContent(i.type)?!1:!r.content.size&&t.parent.canReplace(o-1,o)?(e&&e(n.tr.delete(t.pos-r.nodeSize,t.pos).scrollIntoView()),!0):!t.parent.canReplace(o,o+1)||!(i.isTextblock||Kt(n.doc,t.pos))?!1:(e&&e(n.tr.join(t.pos).scrollIntoView()),!0)}function ph(n,t,e,r){let i=t.nodeBefore,o=t.nodeAfter,s,a,l=i.type.spec.isolating||o.type.spec.isolating;if(!l&&Eb(n,t,e))return!0;let c=!l&&t.parent.canReplace(t.index(),t.index()+1);if(c&&(s=(a=i.contentMatchAt(i.childCount)).findWrapping(o.type))&&a.matchType(s[0]||o.type).validEnd){if(e){let f=t.pos+o.nodeSize,p=w.empty;for(let b=s.length-1;b>=0;b--)p=w.from(s[b].create(null,p));p=w.from(i.copy(p));let x=n.tr.step(new W(t.pos-1,f,t.pos,f,new M(p,1,0),s.length,!0)),S=x.doc.resolve(f+2*s.length);S.nodeAfter&&S.nodeAfter.type==i.type&&Kt(x.doc,S.pos)&&x.join(S.pos),e(x.scrollIntoView())}return!0}let d=o.type.spec.isolating||r>0&&l?null:P.findFrom(t,1),u=d&&d.$from.blockRange(d.$to),h=u&&me(u);if(h!=null&&h>=t.depth)return e&&e(n.tr.lift(u,h).scrollIntoView()),!0;if(c&&Hn(o,"start",!0)&&Hn(i,"end")){let f=i,p=[];for(;p.push(f),!f.isTextblock;)f=f.lastChild;let x=o,S=1;for(;!x.isTextblock;x=x.firstChild)S++;if(f.canReplace(f.childCount,f.childCount,x.content)){if(e){let b=w.empty;for(let m=p.length-1;m>=0;m--)b=w.from(p[m].copy(b));let v=n.tr.step(new W(t.pos-p.length,t.pos+o.nodeSize,t.pos+S,t.pos+o.nodeSize-S,new M(b,p.length,0),0,!0));e(v.scrollIntoView())}return!0}}return!1}function mh(n){return function(t,e){let r=t.selection,i=n<0?r.$from:r.$to,o=i.depth;for(;i.node(o).isInline;){if(!o)return!1;o--}return i.node(o).isTextblock?(e&&e(t.tr.setSelection(_.create(t.doc,n<0?i.start(o):i.end(o)))),!0):!1}}var dl=mh(-1),ul=mh(1);function gh(n,t=null){return function(e,r){let{$from:i,$to:o}=e.selection,s=i.blockRange(o),a=s&&_n(s,n,t);return a?(r&&r(e.tr.wrap(s,a).scrollIntoView()),!0):!1}}function hl(n,t=null){return function(e,r){let i=!1;for(let o=0;o<e.selection.ranges.length&&!i;o++){let{$from:{pos:s},$to:{pos:a}}=e.selection.ranges[o];e.doc.nodesBetween(s,a,(l,c)=>{if(i)return!1;if(!(!l.isTextblock||l.hasMarkup(n,t)))if(l.type==n)i=!0;else{let d=e.doc.resolve(c),u=d.index();i=d.parent.canReplaceWith(u,u+1,n)}})}if(!i)return!1;if(r){let o=e.tr;for(let s=0;s<e.selection.ranges.length;s++){let{$from:{pos:a},$to:{pos:l}}=e.selection.ranges[s];o.setBlockType(a,l,n,t)}r(o.scrollIntoView())}return!0}}function Vn(...n){return function(t,e,r){for(let i=0;i<n.length;i++)if(n[i](t,e,r))return!0;return!1}}var Za=Vn(Ki,tl,el),ih=Vn(Ki,rl,il),De={Enter:Vn(sl,Fn,cl,Sb),"Mod-Enter":ll,Backspace:Za,"Mod-Backspace":Za,"Shift-Backspace":Za,Delete:ih,"Mod-Delete":ih,"Mod-a":wb},Ab={"Ctrl-h":De.Backspace,"Alt-Backspace":De["Mod-Backspace"],"Ctrl-d":De.Delete,"Ctrl-Alt-Backspace":De["Mod-Delete"],"Alt-Delete":De["Mod-Delete"],"Alt-d":De["Mod-Delete"],"Ctrl-a":dl,"Ctrl-e":ul};for(let n in De)Ab[n]=De[n];var Yv=typeof navigator<"u"?/Mac|iP(hone|[oa]d)/.test(navigator.platform):typeof os<"u"&&os.platform?os.platform()=="darwin":!1;function bh(n,t=null){return function(e,r){let{$from:i,$to:o}=e.selection,s=i.blockRange(o),a=!1,l=s;if(!s)return!1;if(s.depth>=2&&i.node(s.depth-1).type.compatibleContent(n)&&s.startIndex==0){if(i.index(s.depth-1)==0)return!1;let d=e.doc.resolve(s.start-2);l=new tn(d,d,s.depth),s.endIndex<s.parent.childCount&&(s=new tn(i,e.doc.resolve(o.end(s.depth)),s.depth)),a=!0}let c=_n(l,n,t,s);return c?(r&&r(Mb(e.tr,s,c,a,n).scrollIntoView()),!0):!1}}function Mb(n,t,e,r,i){let o=w.empty;for(let d=e.length-1;d>=0;d--)o=w.from(e[d].type.create(e[d].attrs,o));n.step(new W(t.start-(r?2:0),t.end,t.start,t.end,new M(o,0,0),e.length,!0));let s=0;for(let d=0;d<e.length;d++)e[d].type==i&&(s=d+1);let a=e.length-s,l=t.start+e.length-(r?2:0),c=t.parent;for(let d=t.startIndex,u=t.endIndex,h=!0;d<u;d++,h=!1)!h&&Dt(n.doc,l,a)&&(n.split(l,a),l+=2*a),l+=c.child(d).nodeSize;return n}function yh(n){return function(t,e){let{$from:r,$to:i}=t.selection,o=r.blockRange(i,s=>s.childCount>0&&s.firstChild.type==n);return o?e?r.node(o.depth-1).type==n?Tb(t,e,n,o):Cb(t,e,o):!0:!1}}function Tb(n,t,e,r){let i=n.tr,o=r.end,s=r.$to.end(r.depth);o<s&&(i.step(new W(o-1,s,o,s,new M(w.from(e.create(null,r.parent.copy())),1,0),1,!0)),r=new tn(i.doc.resolve(r.$from.pos),i.doc.resolve(s),r.depth));let a=me(r);if(a==null)return!1;i.lift(r,a);let l=i.mapping.map(o,-1)-1;return Kt(i.doc,l)&&i.join(l),t(i.scrollIntoView()),!0}function Cb(n,t,e){let r=n.tr,i=e.parent;for(let f=e.end,p=e.endIndex-1,x=e.startIndex;p>x;p--)f-=i.child(p).nodeSize,r.delete(f-1,f+1);let o=r.doc.resolve(e.start),s=o.nodeAfter;if(r.mapping.map(e.end)!=e.start+o.nodeAfter.nodeSize)return!1;let a=e.startIndex==0,l=e.endIndex==i.childCount,c=o.node(-1),d=o.index(-1);if(!c.canReplace(d+(a?0:1),d+1,s.content.append(l?w.empty:w.from(i))))return!1;let u=o.pos,h=u+s.nodeSize;return r.step(new W(u-(a?1:0),h+(l?1:0),u+1,h-1,new M((a?w.empty:w.from(i.copy(w.empty))).append(l?w.empty:w.from(i.copy(w.empty))),a?0:1,l?0:1),a?0:1)),t(r.scrollIntoView()),!0}function xh(n){return function(t,e){let{$from:r,$to:i}=t.selection,o=r.blockRange(i,c=>c.childCount>0&&c.firstChild.type==n);if(!o)return!1;let s=o.startIndex;if(s==0)return!1;let a=o.parent,l=a.child(s-1);if(l.type!=n)return!1;if(e){let c=l.lastChild&&l.lastChild.type==a.type,d=w.from(c?n.create():null),u=new M(w.from(n.create(null,w.from(a.type.create(null,d)))),c?3:1,0),h=o.start,f=o.end;e(t.tr.step(new W(h-(c?3:1),f,h,f,u,1,!0)).scrollIntoView())}return!0}}function Qi(n){let{state:t,transaction:e}=n,{selection:r}=e,{doc:i}=e,{storedMarks:o}=e;return{...t,apply:t.apply.bind(t),applyTransaction:t.applyTransaction.bind(t),plugins:t.plugins,schema:t.schema,reconfigure:t.reconfigure.bind(t),toJSON:t.toJSON.bind(t),get storedMarks(){return o},get selection(){return r},get doc(){return i},get tr(){return r=e.selection,i=e.doc,o=e.storedMarks,e}}}var Un=class{constructor(t){this.editor=t.editor,this.rawCommands=this.editor.extensionManager.commands,this.customState=t.state}get hasCustomState(){return!!this.customState}get state(){return this.customState||this.editor.state}get commands(){let{rawCommands:t,editor:e,state:r}=this,{view:i}=e,{tr:o}=r,s=this.buildProps(o);return Object.fromEntries(Object.entries(t).map(([a,l])=>[a,(...d)=>{let u=l(...d)(s);return!o.getMeta("preventDispatch")&&!this.hasCustomState&&i.dispatch(o),u}]))}get chain(){return()=>this.createChain()}get can(){return()=>this.createCan()}createChain(t,e=!0){let{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a=[],l=!!t,c=t||o.tr,d=()=>(!l&&e&&!c.getMeta("preventDispatch")&&!this.hasCustomState&&s.dispatch(c),a.every(h=>h===!0)),u={...Object.fromEntries(Object.entries(r).map(([h,f])=>[h,(...x)=>{let S=this.buildProps(c,e),b=f(...x)(S);return a.push(b),u}])),run:d};return u}createCan(t){let{rawCommands:e,state:r}=this,i=!1,o=t||r.tr,s=this.buildProps(o,i);return{...Object.fromEntries(Object.entries(e).map(([l,c])=>[l,(...d)=>c(...d)({...s,dispatch:void 0})])),chain:()=>this.createChain(o,i)}}buildProps(t,e=!0){let{rawCommands:r,editor:i,state:o}=this,{view:s}=i,a={tr:t,editor:i,view:s,state:Qi({state:o,transaction:t}),dispatch:e?()=>{}:void 0,chain:()=>this.createChain(t,e),can:()=>this.createCan(t),get commands(){return Object.fromEntries(Object.entries(r).map(([l,c])=>[l,(...d)=>c(...d)(a)]))}};return a}},gl=class{constructor(){this.callbacks={}}on(t,e){return this.callbacks[t]||(this.callbacks[t]=[]),this.callbacks[t].push(e),this}emit(t,...e){let r=this.callbacks[t];return r&&r.forEach(i=>i.apply(this,e)),this}off(t,e){let r=this.callbacks[t];return r&&(e?this.callbacks[t]=r.filter(i=>i!==e):delete this.callbacks[t]),this}removeAllListeners(){this.callbacks={}}};function C(n,t,e){return n.config[t]===void 0&&n.parent?C(n.parent,t,e):typeof n.config[t]=="function"?n.config[t].bind({...e,parent:n.parent?C(n.parent,t,e):null}):n.config[t]}function Zi(n){let t=n.filter(i=>i.type==="extension"),e=n.filter(i=>i.type==="node"),r=n.filter(i=>i.type==="mark");return{baseExtensions:t,nodeExtensions:e,markExtensions:r}}function Mh(n){let t=[],{nodeExtensions:e,markExtensions:r}=Zi(n),i=[...e,...r],o={default:null,rendered:!0,renderHTML:null,parseHTML:null,keepOnSplit:!0,isRequired:!1};return n.forEach(s=>{let a={name:s.name,options:s.options,storage:s.storage,extensions:i},l=C(s,"addGlobalAttributes",a);if(!l)return;l().forEach(d=>{d.types.forEach(u=>{Object.entries(d.attributes).forEach(([h,f])=>{t.push({type:u,name:h,attribute:{...o,...f}})})})})}),i.forEach(s=>{let a={name:s.name,options:s.options,storage:s.storage},l=C(s,"addAttributes",a);if(!l)return;let c=l();Object.entries(c).forEach(([d,u])=>{let h={...o,...u};typeof h?.default=="function"&&(h.default=h.default()),h?.isRequired&&h?.default===void 0&&delete h.default,t.push({type:s.name,name:d,attribute:h})})}),t}function et(n,t){if(typeof n=="string"){if(!t.nodes[n])throw Error(`There is no node type named '${n}'. Maybe you forgot to add the extension?`);return t.nodes[n]}return n}function D(...n){return n.filter(t=>!!t).reduce((t,e)=>{let r={...t};return Object.entries(e).forEach(([i,o])=>{if(!r[i]){r[i]=o;return}if(i==="class"){let a=o?o.split(" "):[],l=r[i]?r[i].split(" "):[],c=a.filter(d=>!l.includes(d));r[i]=[...l,...c].join(" ")}else if(i==="style"){let a=o?o.split(";").map(d=>d.trim()).filter(Boolean):[],l=r[i]?r[i].split(";").map(d=>d.trim()).filter(Boolean):[],c=new Map;l.forEach(d=>{let[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),a.forEach(d=>{let[u,h]=d.split(":").map(f=>f.trim());c.set(u,h)}),r[i]=Array.from(c.entries()).map(([d,u])=>`${d}: ${u}`).join("; ")}else r[i]=o}),r},{})}function bl(n,t){return t.filter(e=>e.type===n.type.name).filter(e=>e.attribute.rendered).map(e=>e.attribute.renderHTML?e.attribute.renderHTML(n.attrs)||{}:{[e.name]:n.attrs[e.name]}).reduce((e,r)=>D(e,r),{})}function Th(n){return typeof n=="function"}function I(n,t=void 0,...e){return Th(n)?t?n.bind(t)(...e):n(...e):n}function _b(n={}){return Object.keys(n).length===0&&n.constructor===Object}function Ob(n){return typeof n!="string"?n:n.match(/^[+-]?(?:\d*\.)?\d+$/)?Number(n):n==="true"?!0:n==="false"?!1:n}function vh(n,t){return"style"in n?n:{...n,getAttrs:e=>{let r=n.getAttrs?n.getAttrs(e):n.attrs;if(r===!1)return!1;let i=t.reduce((o,s)=>{let a=s.attribute.parseHTML?s.attribute.parseHTML(e):Ob(e.getAttribute(s.name));return a==null?o:{...o,[s.name]:a}},{});return{...r,...i}}}}function kh(n){return Object.fromEntries(Object.entries(n).filter(([t,e])=>t==="attrs"&&_b(e)?!1:e!=null))}function Nb(n,t){var e;let r=Mh(n),{nodeExtensions:i,markExtensions:o}=Zi(n),s=(e=i.find(c=>C(c,"topNode")))===null||e===void 0?void 0:e.name,a=Object.fromEntries(i.map(c=>{let d=r.filter(b=>b.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:t},h=n.reduce((b,v)=>{let m=C(v,"extendNodeSchema",u);return{...b,...m?m(c):{}}},{}),f=kh({...h,content:I(C(c,"content",u)),marks:I(C(c,"marks",u)),group:I(C(c,"group",u)),inline:I(C(c,"inline",u)),atom:I(C(c,"atom",u)),selectable:I(C(c,"selectable",u)),draggable:I(C(c,"draggable",u)),code:I(C(c,"code",u)),whitespace:I(C(c,"whitespace",u)),defining:I(C(c,"defining",u)),isolating:I(C(c,"isolating",u)),attrs:Object.fromEntries(d.map(b=>{var v;return[b.name,{default:(v=b?.attribute)===null||v===void 0?void 0:v.default}]}))}),p=I(C(c,"parseHTML",u));p&&(f.parseDOM=p.map(b=>vh(b,d)));let x=C(c,"renderHTML",u);x&&(f.toDOM=b=>x({node:b,HTMLAttributes:bl(b,d)}));let S=C(c,"renderText",u);return S&&(f.toText=S),[c.name,f]})),l=Object.fromEntries(o.map(c=>{let d=r.filter(S=>S.type===c.name),u={name:c.name,options:c.options,storage:c.storage,editor:t},h=n.reduce((S,b)=>{let v=C(b,"extendMarkSchema",u);return{...S,...v?v(c):{}}},{}),f=kh({...h,inclusive:I(C(c,"inclusive",u)),excludes:I(C(c,"excludes",u)),group:I(C(c,"group",u)),spanning:I(C(c,"spanning",u)),code:I(C(c,"code",u)),attrs:Object.fromEntries(d.map(S=>{var b;return[S.name,{default:(b=S?.attribute)===null||b===void 0?void 0:b.default}]}))}),p=I(C(c,"parseHTML",u));p&&(f.parseDOM=p.map(S=>vh(S,d)));let x=C(c,"renderHTML",u);return x&&(f.toDOM=S=>x({mark:S,HTMLAttributes:bl(S,d)})),[c.name,f]}));return new yr({topNode:s,nodes:a,marks:l})}function fl(n,t){return t.nodes[n]||t.marks[n]||null}function Sh(n,t){return Array.isArray(t)?t.some(e=>(typeof e=="string"?e:e.name)===n.name):t}var Pb=(n,t=500)=>{let e="",r=n.parentOffset;return n.parent.nodesBetween(Math.max(0,r-t),r,(i,o,s,a)=>{var l,c;let d=((c=(l=i.type.spec).toText)===null||c===void 0?void 0:c.call(l,{node:i,pos:o,parent:s,index:a}))||i.textContent||"%leaf%";e+=i.isAtom&&!i.isText?d:d.slice(0,Math.max(0,r-o))}),e};function El(n){return Object.prototype.toString.call(n)==="[object RegExp]"}var jn=class{constructor(t){this.find=t.find,this.handler=t.handler}},Rb=(n,t)=>{if(El(t))return t.exec(n);let e=t(n);if(!e)return null;let r=[e.text];return r.index=e.index,r.input=n,r.data=e.data,e.replaceWith&&(e.text.includes(e.replaceWith)||console.warn('[tiptap warn]: "inputRuleMatch.replaceWith" must be part of "inputRuleMatch.text".'),r.push(e.replaceWith)),r};function Wi(n){var t;let{editor:e,from:r,to:i,text:o,rules:s,plugin:a}=n,{view:l}=e;if(l.composing)return!1;let c=l.state.doc.resolve(r);if(c.parent.type.spec.code||!((t=c.nodeBefore||c.nodeAfter)===null||t===void 0)&&t.marks.find(h=>h.type.spec.code))return!1;let d=!1,u=Pb(c)+o;return s.forEach(h=>{if(d)return;let f=Rb(u,h.find);if(!f)return;let p=l.state.tr,x=Qi({state:l.state,transaction:p}),S={from:r-(f[0].length-o.length),to:i},{commands:b,chain:v,can:m}=new Un({editor:e,state:x});h.handler({state:x,range:S,match:f,commands:b,chain:v,can:m})===null||!p.steps.length||(p.setMeta(a,{transform:p,from:r,to:i,text:o}),l.dispatch(p),d=!0)}),d}function Db(n){let{editor:t,rules:e}=n,r=new R({state:{init(){return null},apply(i,o){let s=i.getMeta(r);if(s)return s;let a=i.getMeta("applyInputRules");return!!a&&setTimeout(()=>{let{from:c,text:d}=a,u=c+d.length;Wi({editor:t,from:c,to:u,text:d,rules:e,plugin:r})}),i.selectionSet||i.docChanged?null:o}},props:{handleTextInput(i,o,s,a){return Wi({editor:t,from:o,to:s,text:a,rules:e,plugin:r})},handleDOMEvents:{compositionend:i=>(setTimeout(()=>{let{$cursor:o}=i.state.selection;o&&Wi({editor:t,from:o.pos,to:o.pos,text:"",rules:e,plugin:r})}),!1)},handleKeyDown(i,o){if(o.key!=="Enter")return!1;let{$cursor:s}=i.state.selection;return s?Wi({editor:t,from:s.pos,to:s.pos,text:`
`,rules:e,plugin:r}):!1}},isInputRules:!0});return r}function $b(n){return Object.prototype.toString.call(n).slice(8,-1)}function qi(n){return $b(n)!=="Object"?!1:n.constructor===Object&&Object.getPrototypeOf(n)===Object.prototype}function to(n,t){let e={...n};return qi(n)&&qi(t)&&Object.keys(t).forEach(r=>{qi(t[r])&&qi(n[r])?e[r]=to(n[r],t[r]):e[r]=t[r]}),e}var Pt=class n{constructor(t={}){this.type="mark",this.name="mark",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=I(C(this,"addOptions",{name:this.name}))),this.storage=I(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new n(t)}configure(t={}){let e=this.extend({...this.config,addOptions:()=>to(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){let e=new n(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=I(C(e,"addOptions",{name:e.name})),e.storage=I(C(e,"addStorage",{name:e.name,options:e.options})),e}static handleExit({editor:t,mark:e}){let{tr:r}=t.state,i=t.state.selection.$from;if(i.pos===i.end()){let s=i.marks();if(!!!s.find(c=>c?.type.name===e.name))return!1;let l=s.find(c=>c?.type.name===e.name);return l&&r.removeStoredMark(l),r.insertText(" ",i.pos),t.view.dispatch(r),!0}return!1}};function Ib(n){return typeof n=="number"}var yl=class{constructor(t){this.find=t.find,this.handler=t.handler}},Lb=(n,t,e)=>{if(El(t))return[...n.matchAll(t)];let r=t(n,e);return r?r.map(i=>{let o=[i.text];return o.index=i.index,o.input=n,o.data=i.data,i.replaceWith&&(i.text.includes(i.replaceWith)||console.warn('[tiptap warn]: "pasteRuleMatch.replaceWith" must be part of "pasteRuleMatch.text".'),o.push(i.replaceWith)),o}):[]};function Bb(n){let{editor:t,state:e,from:r,to:i,rule:o,pasteEvent:s,dropEvent:a}=n,{commands:l,chain:c,can:d}=new Un({editor:t,state:e}),u=[];return e.doc.nodesBetween(r,i,(f,p)=>{if(!f.isTextblock||f.type.spec.code)return;let x=Math.max(r,p),S=Math.min(i,p+f.content.size),b=f.textBetween(x-p,S-p,void 0,"\uFFFC");Lb(b,o.find,s).forEach(m=>{if(m.index===void 0)return;let g=x+m.index+1,k=g+m[0].length,y={from:e.tr.mapping.map(g),to:e.tr.mapping.map(k)},O=o.handler({state:e,range:y,match:m,commands:l,chain:c,can:d,pasteEvent:s,dropEvent:a});u.push(O)})}),u.every(f=>f!==null)}var zb=n=>{var t;let e=new ClipboardEvent("paste",{clipboardData:new DataTransfer});return(t=e.clipboardData)===null||t===void 0||t.setData("text/html",n),e};function Hb(n){let{editor:t,rules:e}=n,r=null,i=!1,o=!1,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,a=typeof DragEvent<"u"?new DragEvent("drop"):null,l=({state:d,from:u,to:h,rule:f,pasteEvt:p})=>{let x=d.tr,S=Qi({state:d,transaction:x});if(!(!Bb({editor:t,state:S,from:Math.max(u-1,0),to:h.b-1,rule:f,pasteEvent:p,dropEvent:a})||!x.steps.length))return a=typeof DragEvent<"u"?new DragEvent("drop"):null,s=typeof ClipboardEvent<"u"?new ClipboardEvent("paste"):null,x};return e.map(d=>new R({view(u){let h=f=>{var p;r=!((p=u.dom.parentElement)===null||p===void 0)&&p.contains(f.target)?u.dom.parentElement:null};return window.addEventListener("dragstart",h),{destroy(){window.removeEventListener("dragstart",h)}}},props:{handleDOMEvents:{drop:(u,h)=>(o=r===u.dom.parentElement,a=h,!1),paste:(u,h)=>{var f;let p=(f=h.clipboardData)===null||f===void 0?void 0:f.getData("text/html");return s=h,i=!!p?.includes("data-pm-slice"),!1}}},appendTransaction:(u,h,f)=>{let p=u[0],x=p.getMeta("uiEvent")==="paste"&&!i,S=p.getMeta("uiEvent")==="drop"&&!o,b=p.getMeta("applyPasteRules"),v=!!b;if(!x&&!S&&!v)return;if(v){let{from:k,text:y}=b,O=k+y.length,A=zb(y);return l({rule:d,state:f,from:k,to:{b:O},pasteEvt:A})}let m=h.doc.content.findDiffStart(f.doc.content),g=h.doc.content.findDiffEnd(f.doc.content);if(!(!Ib(m)||!g||m===g.b))return l({rule:d,state:f,from:m,to:g,pasteEvt:s})}}))}function Fb(n){let t=n.filter((e,r)=>n.indexOf(e)!==r);return Array.from(new Set(t))}var xl=class n{constructor(t,e){this.splittableMarks=[],this.editor=e,this.extensions=n.resolve(t),this.schema=Nb(this.extensions,e),this.setupExtensions()}static resolve(t){let e=n.sort(n.flatten(t)),r=Fb(e.map(i=>i.name));return r.length&&console.warn(`[tiptap warn]: Duplicate extension names found: [${r.map(i=>`'${i}'`).join(", ")}]. This can lead to issues.`),e}static flatten(t){return t.map(e=>{let r={name:e.name,options:e.options,storage:e.storage},i=C(e,"addExtensions",r);return i?[e,...this.flatten(i())]:e}).flat(10)}static sort(t){return t.sort((r,i)=>{let o=C(r,"priority")||100,s=C(i,"priority")||100;return o>s?-1:o<s?1:0})}get commands(){return this.extensions.reduce((t,e)=>{let r={name:e.name,options:e.options,storage:e.storage,editor:this.editor,type:fl(e.name,this.schema)},i=C(e,"addCommands",r);return i?{...t,...i()}:t},{})}get plugins(){let{editor:t}=this,e=n.sort([...this.extensions].reverse()),r=[],i=[],o=e.map(s=>{let a={name:s.name,options:s.options,storage:s.storage,editor:t,type:fl(s.name,this.schema)},l=[],c=C(s,"addKeyboardShortcuts",a),d={};if(s.type==="mark"&&C(s,"exitable",a)&&(d.ArrowRight=()=>Pt.handleExit({editor:t,mark:s})),c){let x=Object.fromEntries(Object.entries(c()).map(([S,b])=>[S,()=>b({editor:t})]));d={...d,...x}}let u=rh(d);l.push(u);let h=C(s,"addInputRules",a);Sh(s,t.options.enableInputRules)&&h&&r.push(...h());let f=C(s,"addPasteRules",a);Sh(s,t.options.enablePasteRules)&&f&&i.push(...f());let p=C(s,"addProseMirrorPlugins",a);if(p){let x=p();l.push(...x)}return l}).flat();return[Db({editor:t,rules:r}),...Hb({editor:t,rules:i}),...o]}get attributes(){return Mh(this.extensions)}get nodeViews(){let{editor:t}=this,{nodeExtensions:e}=Zi(this.extensions);return Object.fromEntries(e.filter(r=>!!C(r,"addNodeView")).map(r=>{let i=this.attributes.filter(l=>l.type===r.name),o={name:r.name,options:r.options,storage:r.storage,editor:t,type:et(r.name,this.schema)},s=C(r,"addNodeView",o);if(!s)return[];let a=(l,c,d,u,h)=>{let f=bl(l,i);return s()({node:l,view:c,getPos:d,decorations:u,innerDecorations:h,editor:t,extension:r,HTMLAttributes:f})};return[r.name,a]}))}setupExtensions(){this.extensions.forEach(t=>{var e;this.editor.extensionStorage[t.name]=t.storage;let r={name:t.name,options:t.options,storage:t.storage,editor:this.editor,type:fl(t.name,this.schema)};t.type==="mark"&&(!((e=I(C(t,"keepOnSplit",r)))!==null&&e!==void 0)||e)&&this.splittableMarks.push(t.name);let i=C(t,"onBeforeCreate",r),o=C(t,"onCreate",r),s=C(t,"onUpdate",r),a=C(t,"onSelectionUpdate",r),l=C(t,"onTransaction",r),c=C(t,"onFocus",r),d=C(t,"onBlur",r),u=C(t,"onDestroy",r);i&&this.editor.on("beforeCreate",i),o&&this.editor.on("create",o),s&&this.editor.on("update",s),a&&this.editor.on("selectionUpdate",a),l&&this.editor.on("transaction",l),c&&this.editor.on("focus",c),d&&this.editor.on("blur",d),u&&this.editor.on("destroy",u)})}},F=class n{constructor(t={}){this.type="extension",this.name="extension",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=I(C(this,"addOptions",{name:this.name}))),this.storage=I(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new n(t)}configure(t={}){let e=this.extend({...this.config,addOptions:()=>to(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){let e=new n({...this.config,...t});return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=I(C(e,"addOptions",{name:e.name})),e.storage=I(C(e,"addStorage",{name:e.name,options:e.options})),e}};function Ch(n,t,e){let{from:r,to:i}=t,{blockSeparator:o=`
`,textSerializers:s={}}=e||{},a="";return n.nodesBetween(r,i,(l,c,d,u)=>{var h;l.isBlock&&c>r&&(a+=o);let f=s?.[l.type.name];if(f)return d&&(a+=f({node:l,pos:c,parent:d,index:u,range:t})),!1;l.isText&&(a+=(h=l?.text)===null||h===void 0?void 0:h.slice(Math.max(r,c)-c,i-c))}),a}function _h(n){return Object.fromEntries(Object.entries(n.nodes).filter(([,t])=>t.spec.toText).map(([t,e])=>[t,e.spec.toText]))}var Vb=F.create({name:"clipboardTextSerializer",addOptions(){return{blockSeparator:void 0}},addProseMirrorPlugins(){return[new R({key:new L("clipboardTextSerializer"),props:{clipboardTextSerializer:()=>{let{editor:n}=this,{state:t,schema:e}=n,{doc:r,selection:i}=t,{ranges:o}=i,s=Math.min(...o.map(d=>d.$from.pos)),a=Math.max(...o.map(d=>d.$to.pos)),l=_h(e);return Ch(r,{from:s,to:a},{...this.options.blockSeparator!==void 0?{blockSeparator:this.options.blockSeparator}:{},textSerializers:l})}}})]}}),Ub=()=>({editor:n,view:t})=>(requestAnimationFrame(()=>{var e;n.isDestroyed||(t.dom.blur(),(e=window?.getSelection())===null||e===void 0||e.removeAllRanges())}),!0),jb=(n=!1)=>({commands:t})=>t.setContent("",n),Kb=()=>({state:n,tr:t,dispatch:e})=>{let{selection:r}=t,{ranges:i}=r;return e&&i.forEach(({$from:o,$to:s})=>{n.doc.nodesBetween(o.pos,s.pos,(a,l)=>{if(a.type.isText)return;let{doc:c,mapping:d}=t,u=c.resolve(d.map(l)),h=c.resolve(d.map(l+a.nodeSize)),f=u.blockRange(h);if(!f)return;let p=me(f);if(a.type.isTextblock){let{defaultType:x}=u.parent.contentMatchAt(u.index());t.setNodeMarkup(f.start,x)}(p||p===0)&&t.lift(f,p)})}),!0},Wb=n=>t=>n(t),qb=()=>({state:n,dispatch:t})=>Fn(n,t),Jb=(n,t)=>({editor:e,tr:r})=>{let{state:i}=e,o=i.doc.slice(n.from,n.to);r.deleteRange(n.from,n.to);let s=r.mapping.map(t);return r.insert(s,o.content),r.setSelection(new _(r.doc.resolve(s-1))),!0},Gb=()=>({tr:n,dispatch:t})=>{let{selection:e}=n,r=e.$anchor.node();if(r.content.size>0)return!1;let i=n.selection.$anchor;for(let o=i.depth;o>0;o-=1)if(i.node(o).type===r.type){if(t){let a=i.before(o),l=i.after(o);n.delete(a,l).scrollIntoView()}return!0}return!1},Yb=n=>({tr:t,state:e,dispatch:r})=>{let i=et(n,e.schema),o=t.selection.$anchor;for(let s=o.depth;s>0;s-=1)if(o.node(s).type===i){if(r){let l=o.before(s),c=o.after(s);t.delete(l,c).scrollIntoView()}return!0}return!1},Xb=n=>({tr:t,dispatch:e})=>{let{from:r,to:i}=n;return e&&t.delete(r,i),!0},Qb=()=>({state:n,dispatch:t})=>Ki(n,t),Zb=()=>({commands:n})=>n.keyboardShortcut("Enter"),t0=()=>({state:n,dispatch:t})=>ll(n,t);function Kn(n,t,e={strict:!0}){let r=Object.keys(t);return r.length?r.every(i=>e.strict?t[i]===n[i]:El(t[i])?t[i].test(n[i]):t[i]===n[i]):!0}function vl(n,t,e={}){return n.find(r=>r.type===t&&Kn(r.attrs,e))}function e0(n,t,e={}){return!!vl(n,t,e)}function Al(n,t,e={}){if(!n||!t)return;let r=n.parent.childAfter(n.parentOffset);if((!r.node||!r.node.marks.some(c=>c.type===t))&&(r=n.parent.childBefore(n.parentOffset)),!r.node||!r.node.marks.some(c=>c.type===t))return;let i=vl([...r.node.marks],t,e);if(!i)return;let o=r.index,s=n.start()+r.offset,a=o+1,l=s+r.node.nodeSize;for(vl([...r.node.marks],t,e);o>0&&i.isInSet(n.parent.child(o-1).marks);)o-=1,s-=n.parent.child(o).nodeSize;for(;a<n.parent.childCount&&e0([...n.parent.child(a).marks],t,e);)l+=n.parent.child(a).nodeSize,a+=1;return{from:s,to:l}}function $e(n,t){if(typeof n=="string"){if(!t.marks[n])throw Error(`There is no mark type named '${n}'. Maybe you forgot to add the extension?`);return t.marks[n]}return n}var n0=(n,t={})=>({tr:e,state:r,dispatch:i})=>{let o=$e(n,r.schema),{doc:s,selection:a}=e,{$from:l,from:c,to:d}=a;if(i){let u=Al(l,o,t);if(u&&u.from<=c&&u.to>=d){let h=_.create(s,u.from,u.to);e.setSelection(h)}}return!0},r0=n=>t=>{let e=typeof n=="function"?n(t):n;for(let r=0;r<e.length;r+=1)if(e[r](t))return!0;return!1};function eo(n){return n instanceof _}function xe(n=0,t=0,e=0){return Math.min(Math.max(n,t),e)}function Oh(n,t=null){if(!t)return null;let e=P.atStart(n),r=P.atEnd(n);if(t==="start"||t===!0)return e;if(t==="end")return r;let i=e.from,o=r.to;return t==="all"?_.create(n,xe(0,i,o),xe(n.content.size,i,o)):_.create(n,xe(t,i,o),xe(t,i,o))}function Ml(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&"ontouchend"in document}var i0=(n=null,t={})=>({editor:e,view:r,tr:i,dispatch:o})=>{t={scrollIntoView:!0,...t};let s=()=>{Ml()&&r.dom.focus(),requestAnimationFrame(()=>{e.isDestroyed||(r.focus(),t?.scrollIntoView&&e.commands.scrollIntoView())})};if(r.hasFocus()&&n===null||n===!1)return!0;if(o&&n===null&&!eo(e.state.selection))return s(),!0;let a=Oh(i.doc,n)||e.state.selection,l=e.state.selection.eq(a);return o&&(l||i.setSelection(a),l&&i.storedMarks&&i.setStoredMarks(i.storedMarks),s()),!0},o0=(n,t)=>e=>n.every((r,i)=>t(r,{...e,index:i})),s0=(n,t)=>({tr:e,commands:r})=>r.insertContentAt({from:e.selection.from,to:e.selection.to},n,t),Nh=n=>{let t=n.childNodes;for(let e=t.length-1;e>=0;e-=1){let r=t[e];r.nodeType===3&&r.nodeValue&&/^(\n\s\s|\n)$/.test(r.nodeValue)?n.removeChild(r):r.nodeType===1&&Nh(r)}return n};function Ji(n){let t=`<body>${n}</body>`,e=new window.DOMParser().parseFromString(t,"text/html").body;return Nh(e)}function Yi(n,t,e){e={slice:!0,parseOptions:{},...e};let r=typeof n=="object"&&n!==null,i=typeof n=="string";if(r)try{if(Array.isArray(n)&&n.length>0)return w.fromArray(n.map(a=>t.nodeFromJSON(a)));let s=t.nodeFromJSON(n);return e.errorOnInvalidContent&&s.check(),s}catch(o){if(e.errorOnInvalidContent)throw new Error("[tiptap error]: Invalid JSON content",{cause:o});return console.warn("[tiptap warn]: Invalid content.","Passed value:",n,"Error:",o),Yi("",t,e)}if(i){if(e.errorOnInvalidContent){let s=!1,a="",l=new yr({topNode:t.spec.topNode,marks:t.spec.marks,nodes:t.spec.nodes.append({__tiptap__private__unknown__catch__all__node:{content:"inline*",group:"block",parseDOM:[{tag:"*",getAttrs:c=>(s=!0,a=typeof c=="string"?c:c.outerHTML,null)}]}})});if(e.slice?fe.fromSchema(l).parseSlice(Ji(n),e.parseOptions):fe.fromSchema(l).parse(Ji(n),e.parseOptions),e.errorOnInvalidContent&&s)throw new Error("[tiptap error]: Invalid HTML content",{cause:new Error(`Invalid element found: ${a}`)})}let o=fe.fromSchema(t);return e.slice?o.parseSlice(Ji(n),e.parseOptions).content:o.parse(Ji(n),e.parseOptions)}return Yi("",t,e)}function Tl(n,t,e){let r=n.steps.length-1;if(r<t)return;let i=n.steps[r];if(!(i instanceof it||i instanceof W))return;let o=n.mapping.maps[r],s=0;o.forEach((a,l,c,d)=>{s===0&&(s=d)}),n.setSelection(P.near(n.doc.resolve(s),e))}var a0=n=>!("type"in n),l0=(n,t,e)=>({tr:r,dispatch:i,editor:o})=>{var s;if(i){e={parseOptions:o.options.parseOptions,updateSelection:!0,applyInputRules:!1,applyPasteRules:!1,...e};let a;try{a=Yi(t,o.schema,{parseOptions:{preserveWhitespace:"full",...e.parseOptions},errorOnInvalidContent:(s=e.errorOnInvalidContent)!==null&&s!==void 0?s:o.options.enableContentCheck})}catch(p){return o.emit("contentError",{editor:o,error:p,disableCollaboration:()=>{o.storage.collaboration&&(o.storage.collaboration.isDisabled=!0)}}),!1}let{from:l,to:c}=typeof n=="number"?{from:n,to:n}:{from:n.from,to:n.to},d=!0,u=!0;if((a0(a)?a:[a]).forEach(p=>{p.check(),d=d?p.isText&&p.marks.length===0:!1,u=u?p.isBlock:!1}),l===c&&u){let{parent:p}=r.doc.resolve(l);p.isTextblock&&!p.type.spec.code&&!p.childCount&&(l-=1,c+=1)}let f;d?(Array.isArray(t)?f=t.map(p=>p.text||"").join(""):typeof t=="object"&&t&&t.text?f=t.text:f=t,r.insertText(f,l,c)):(f=a,r.replaceWith(l,c,f)),e.updateSelection&&Tl(r,r.steps.length-1,-1),e.applyInputRules&&r.setMeta("applyInputRules",{from:l,text:f}),e.applyPasteRules&&r.setMeta("applyPasteRules",{from:l,text:f})}return!0},c0=()=>({state:n,dispatch:t})=>dh(n,t),d0=()=>({state:n,dispatch:t})=>uh(n,t),u0=()=>({state:n,dispatch:t})=>tl(n,t),h0=()=>({state:n,dispatch:t})=>rl(n,t),f0=()=>({state:n,dispatch:t,tr:e})=>{try{let r=On(n.doc,n.selection.$from.pos,-1);return r==null?!1:(e.join(r,2),t&&t(e),!0)}catch{return!1}},p0=()=>({state:n,dispatch:t,tr:e})=>{try{let r=On(n.doc,n.selection.$from.pos,1);return r==null?!1:(e.join(r,2),t&&t(e),!0)}catch{return!1}},m0=()=>({state:n,dispatch:t})=>sh(n,t),g0=()=>({state:n,dispatch:t})=>ah(n,t);function Ph(){return typeof navigator<"u"?/Mac/.test(navigator.platform):!1}function b0(n){let t=n.split(/-(?!$)/),e=t[t.length-1];e==="Space"&&(e=" ");let r,i,o,s;for(let a=0;a<t.length-1;a+=1){let l=t[a];if(/^(cmd|meta|m)$/i.test(l))s=!0;else if(/^a(lt)?$/i.test(l))r=!0;else if(/^(c|ctrl|control)$/i.test(l))i=!0;else if(/^s(hift)?$/i.test(l))o=!0;else if(/^mod$/i.test(l))Ml()||Ph()?s=!0:i=!0;else throw new Error(`Unrecognized modifier name: ${l}`)}return r&&(e=`Alt-${e}`),i&&(e=`Ctrl-${e}`),s&&(e=`Meta-${e}`),o&&(e=`Shift-${e}`),e}var y0=n=>({editor:t,view:e,tr:r,dispatch:i})=>{let o=b0(n).split(/-(?!$)/),s=o.find(c=>!["Alt","Ctrl","Meta","Shift"].includes(c)),a=new KeyboardEvent("keydown",{key:s==="Space"?" ":s,altKey:o.includes("Alt"),ctrlKey:o.includes("Ctrl"),metaKey:o.includes("Meta"),shiftKey:o.includes("Shift"),bubbles:!0,cancelable:!0}),l=t.captureTransaction(()=>{e.someProp("handleKeyDown",c=>c(e,a))});return l?.steps.forEach(c=>{let d=c.map(r.mapping);d&&i&&r.maybeStep(d)}),!0};function Rr(n,t,e={}){let{from:r,to:i,empty:o}=n.selection,s=t?et(t,n.schema):null,a=[];n.doc.nodesBetween(r,i,(u,h)=>{if(u.isText)return;let f=Math.max(r,h),p=Math.min(i,h+u.nodeSize);a.push({node:u,from:f,to:p})});let l=i-r,c=a.filter(u=>s?s.name===u.node.type.name:!0).filter(u=>Kn(u.node.attrs,e,{strict:!1}));return o?!!c.length:c.reduce((u,h)=>u+h.to-h.from,0)>=l}var x0=(n,t={})=>({state:e,dispatch:r})=>{let i=et(n,e.schema);return Rr(e,i,t)?hh(e,r):!1},v0=()=>({state:n,dispatch:t})=>cl(n,t),k0=n=>({state:t,dispatch:e})=>{let r=et(n,t.schema);return yh(r)(t,e)},S0=()=>({state:n,dispatch:t})=>sl(n,t);function no(n,t){return t.nodes[n]?"node":t.marks[n]?"mark":null}function wh(n,t){let e=typeof t=="string"?[t]:t;return Object.keys(n).reduce((r,i)=>(e.includes(i)||(r[i]=n[i]),r),{})}var w0=(n,t)=>({tr:e,state:r,dispatch:i})=>{let o=null,s=null,a=no(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(o=et(n,r.schema)),a==="mark"&&(s=$e(n,r.schema)),i&&e.selection.ranges.forEach(l=>{r.doc.nodesBetween(l.$from.pos,l.$to.pos,(c,d)=>{o&&o===c.type&&e.setNodeMarkup(d,void 0,wh(c.attrs,t)),s&&c.marks.length&&c.marks.forEach(u=>{s===u.type&&e.addMark(d,d+c.nodeSize,s.create(wh(u.attrs,t)))})})}),!0):!1},E0=()=>({tr:n,dispatch:t})=>(t&&n.scrollIntoView(),!0),A0=()=>({tr:n,commands:t})=>t.setTextSelection({from:0,to:n.doc.content.size}),M0=()=>({state:n,dispatch:t})=>el(n,t),T0=()=>({state:n,dispatch:t})=>il(n,t),C0=()=>({state:n,dispatch:t})=>fh(n,t),_0=()=>({state:n,dispatch:t})=>ul(n,t),O0=()=>({state:n,dispatch:t})=>dl(n,t);function kl(n,t,e={},r={}){return Yi(n,t,{slice:!1,parseOptions:e,errorOnInvalidContent:r.errorOnInvalidContent})}var N0=(n,t=!1,e={},r={})=>({editor:i,tr:o,dispatch:s,commands:a})=>{var l,c;let{doc:d}=o;if(e.preserveWhitespace!=="full"){let u=kl(n,i.schema,e,{errorOnInvalidContent:(l=r.errorOnInvalidContent)!==null&&l!==void 0?l:i.options.enableContentCheck});return s&&o.replaceWith(0,d.content.size,u).setMeta("preventUpdate",!t),!0}return s&&o.setMeta("preventUpdate",!t),a.insertContentAt({from:0,to:d.content.size},n,{parseOptions:e,errorOnInvalidContent:(c=r.errorOnInvalidContent)!==null&&c!==void 0?c:i.options.enableContentCheck})};function Rh(n,t){let e=$e(t,n.schema),{from:r,to:i,empty:o}=n.selection,s=[];o?(n.storedMarks&&s.push(...n.storedMarks),s.push(...n.selection.$head.marks())):n.doc.nodesBetween(r,i,l=>{s.push(...l.marks)});let a=s.find(l=>l.type.name===e.name);return a?{...a.attrs}:{}}function Dh(n,t){let e=new Cn(n);return t.forEach(r=>{r.steps.forEach(i=>{e.step(i)})}),e}function P0(n){for(let t=0;t<n.edgeCount;t+=1){let{type:e}=n.edge(t);if(e.isTextblock&&!e.hasRequiredAttrs())return e}return null}function $h(n,t,e){let r=[];return n.nodesBetween(t.from,t.to,(i,o)=>{e(i)&&r.push({node:i,pos:o})}),r}function R0(n,t){for(let e=n.depth;e>0;e-=1){let r=n.node(e);if(t(r))return{pos:e>0?n.before(e):0,start:n.start(e),depth:e,node:r}}}function Cl(n){return t=>R0(t.$from,n)}function D0(n,t){let e=_t.fromSchema(t).serializeFragment(n),i=document.implementation.createHTMLDocument().createElement("div");return i.appendChild(e),i.innerHTML}function $0(n,t){let e={from:0,to:n.content.size};return Ch(n,e,t)}function I0(n,t){let e=et(t,n.schema),{from:r,to:i}=n.selection,o=[];n.doc.nodesBetween(r,i,a=>{o.push(a)});let s=o.reverse().find(a=>a.type.name===e.name);return s?{...s.attrs}:{}}function _l(n,t){let e=no(typeof t=="string"?t:t.name,n.schema);return e==="node"?I0(n,t):e==="mark"?Rh(n,t):{}}function L0(n,t=JSON.stringify){let e={};return n.filter(r=>{let i=t(r);return Object.prototype.hasOwnProperty.call(e,i)?!1:e[i]=!0})}function B0(n){let t=L0(n);return t.length===1?t:t.filter((e,r)=>!t.filter((o,s)=>s!==r).some(o=>e.oldRange.from>=o.oldRange.from&&e.oldRange.to<=o.oldRange.to&&e.newRange.from>=o.newRange.from&&e.newRange.to<=o.newRange.to))}function Ih(n){let{mapping:t,steps:e}=n,r=[];return t.maps.forEach((i,o)=>{let s=[];if(i.ranges.length)i.forEach((a,l)=>{s.push({from:a,to:l})});else{let{from:a,to:l}=e[o];if(a===void 0||l===void 0)return;s.push({from:a,to:l})}s.forEach(({from:a,to:l})=>{let c=t.slice(o).map(a,-1),d=t.slice(o).map(l),u=t.invert().map(c,-1),h=t.invert().map(d);r.push({oldRange:{from:u,to:h},newRange:{from:c,to:d}})})}),B0(r)}function ro(n,t,e){let r=[];return n===t?e.resolve(n).marks().forEach(i=>{let o=e.resolve(n),s=Al(o,i.type);s&&r.push({mark:i,...s})}):e.nodesBetween(n,t,(i,o)=>{!i||i?.nodeSize===void 0||r.push(...i.marks.map(s=>({from:o,to:o+i.nodeSize,mark:s})))}),r}function Gi(n,t,e){return Object.fromEntries(Object.entries(e).filter(([r])=>{let i=n.find(o=>o.type===t&&o.name===r);return i?i.attribute.keepOnSplit:!1}))}function Sl(n,t,e={}){let{empty:r,ranges:i}=n.selection,o=t?$e(t,n.schema):null;if(r)return!!(n.storedMarks||n.selection.$from.marks()).filter(u=>o?o.name===u.type.name:!0).find(u=>Kn(u.attrs,e,{strict:!1}));let s=0,a=[];if(i.forEach(({$from:u,$to:h})=>{let f=u.pos,p=h.pos;n.doc.nodesBetween(f,p,(x,S)=>{if(!x.isText&&!x.marks.length)return;let b=Math.max(f,S),v=Math.min(p,S+x.nodeSize),m=v-b;s+=m,a.push(...x.marks.map(g=>({mark:g,from:b,to:v})))})}),s===0)return!1;let l=a.filter(u=>o?o.name===u.mark.type.name:!0).filter(u=>Kn(u.mark.attrs,e,{strict:!1})).reduce((u,h)=>u+h.to-h.from,0),c=a.filter(u=>o?u.mark.type!==o&&u.mark.type.excludes(o):!0).reduce((u,h)=>u+h.to-h.from,0);return(l>0?l+c:l)>=s}function z0(n,t,e={}){if(!t)return Rr(n,null,e)||Sl(n,null,e);let r=no(t,n.schema);return r==="node"?Rr(n,t,e):r==="mark"?Sl(n,t,e):!1}function Eh(n,t){let{nodeExtensions:e}=Zi(t),r=e.find(s=>s.name===n);if(!r)return!1;let i={name:r.name,options:r.options,storage:r.storage},o=I(C(r,"group",i));return typeof o!="string"?!1:o.split(" ").includes("list")}function Dr(n,{checkChildren:t=!0,ignoreWhitespace:e=!1}={}){var r;if(e){if(n.type.name==="hardBreak")return!0;if(n.isText)return/^\s*$/m.test((r=n.text)!==null&&r!==void 0?r:"")}if(n.isText)return!n.text;if(n.isAtom||n.isLeaf)return!1;if(n.content.childCount===0)return!0;if(t){let i=!0;return n.content.forEach(o=>{i!==!1&&(Dr(o,{ignoreWhitespace:e,checkChildren:t})||(i=!1))}),i}return!1}function Wn(n){return n instanceof N}function io(n,t,e){let i=n.state.doc.content.size,o=xe(t,0,i),s=xe(e,0,i),a=n.coordsAtPos(o),l=n.coordsAtPos(s,-1),c=Math.min(a.top,l.top),d=Math.max(a.bottom,l.bottom),u=Math.min(a.left,l.left),h=Math.max(a.right,l.right),f=h-u,p=d-c,b={top:c,bottom:d,left:u,right:h,width:f,height:p,x:u,y:c};return{...b,toJSON:()=>b}}function H0(n,t,e){var r;let{selection:i}=t,o=null;if(eo(i)&&(o=i.$cursor),o){let a=(r=n.storedMarks)!==null&&r!==void 0?r:o.marks();return!!e.isInSet(a)||!a.some(l=>l.type.excludes(e))}let{ranges:s}=i;return s.some(({$from:a,$to:l})=>{let c=a.depth===0?n.doc.inlineContent&&n.doc.type.allowsMarkType(e):!1;return n.doc.nodesBetween(a.pos,l.pos,(d,u,h)=>{if(c)return!1;if(d.isInline){let f=!h||h.type.allowsMarkType(e),p=!!e.isInSet(d.marks)||!d.marks.some(x=>x.type.excludes(e));c=f&&p}return!c}),c})}var F0=(n,t={})=>({tr:e,state:r,dispatch:i})=>{let{selection:o}=e,{empty:s,ranges:a}=o,l=$e(n,r.schema);if(i)if(s){let c=Rh(r,l);e.addStoredMark(l.create({...c,...t}))}else a.forEach(c=>{let d=c.$from.pos,u=c.$to.pos;r.doc.nodesBetween(d,u,(h,f)=>{let p=Math.max(f,d),x=Math.min(f+h.nodeSize,u);h.marks.find(b=>b.type===l)?h.marks.forEach(b=>{l===b.type&&e.addMark(p,x,l.create({...b.attrs,...t}))}):e.addMark(p,x,l.create(t))})});return H0(r,e,l)},V0=(n,t)=>({tr:e})=>(e.setMeta(n,t),!0),U0=(n,t={})=>({state:e,dispatch:r,chain:i})=>{let o=et(n,e.schema);return o.isTextblock?i().command(({commands:s})=>hl(o,t)(e)?!0:s.clearNodes()).command(({state:s})=>hl(o,t)(s,r)).run():(console.warn('[tiptap warn]: Currently "setNode()" only supports text block nodes.'),!1)},j0=n=>({tr:t,dispatch:e})=>{if(e){let{doc:r}=t,i=xe(n,0,r.content.size),o=N.create(r,i);t.setSelection(o)}return!0},K0=n=>({tr:t,dispatch:e})=>{if(e){let{doc:r}=t,{from:i,to:o}=typeof n=="number"?{from:n,to:n}:n,s=_.atStart(r).from,a=_.atEnd(r).to,l=xe(i,s,a),c=xe(o,s,a),d=_.create(r,l,c);t.setSelection(d)}return!0},W0=n=>({state:t,dispatch:e})=>{let r=et(n,t.schema);return xh(r)(t,e)};function Ah(n,t){let e=n.storedMarks||n.selection.$to.parentOffset&&n.selection.$from.marks();if(e){let r=e.filter(i=>t?.includes(i.type.name));n.tr.ensureMarks(r)}}var q0=({keepMarks:n=!0}={})=>({tr:t,state:e,dispatch:r,editor:i})=>{let{selection:o,doc:s}=t,{$from:a,$to:l}=o,c=i.extensionManager.attributes,d=Gi(c,a.node().type.name,a.node().attrs);if(o instanceof N&&o.node.isBlock)return!a.parentOffset||!Dt(s,a.pos)?!1:(r&&(n&&Ah(e,i.extensionManager.splittableMarks),t.split(a.pos).scrollIntoView()),!0);if(!a.parent.isBlock)return!1;let u=l.parentOffset===l.parent.content.size,h=a.depth===0?void 0:P0(a.node(-1).contentMatchAt(a.indexAfter(-1))),f=u&&h?[{type:h,attrs:d}]:void 0,p=Dt(t.doc,t.mapping.map(a.pos),1,f);if(!f&&!p&&Dt(t.doc,t.mapping.map(a.pos),1,h?[{type:h}]:void 0)&&(p=!0,f=h?[{type:h,attrs:d}]:void 0),r){if(p&&(o instanceof _&&t.deleteSelection(),t.split(t.mapping.map(a.pos),1,f),h&&!u&&!a.parentOffset&&a.parent.type!==h)){let x=t.mapping.map(a.before()),S=t.doc.resolve(x);a.node(-1).canReplaceWith(S.index(),S.index()+1,h)&&t.setNodeMarkup(t.mapping.map(a.before()),h)}n&&Ah(e,i.extensionManager.splittableMarks),t.scrollIntoView()}return p},J0=(n,t={})=>({tr:e,state:r,dispatch:i,editor:o})=>{var s;let a=et(n,r.schema),{$from:l,$to:c}=r.selection,d=r.selection.node;if(d&&d.isBlock||l.depth<2||!l.sameParent(c))return!1;let u=l.node(-1);if(u.type!==a)return!1;let h=o.extensionManager.attributes;if(l.parent.content.size===0&&l.node(-1).childCount===l.indexAfter(-1)){if(l.depth===2||l.node(-3).type!==a||l.index(-2)!==l.node(-2).childCount-1)return!1;if(i){let b=w.empty,v=l.index(-1)?1:l.index(-2)?2:3;for(let A=l.depth-v;A>=l.depth-3;A-=1)b=w.from(l.node(A).copy(b));let m=l.indexAfter(-1)<l.node(-2).childCount?1:l.indexAfter(-2)<l.node(-3).childCount?2:3,g={...Gi(h,l.node().type.name,l.node().attrs),...t},k=((s=a.contentMatch.defaultType)===null||s===void 0?void 0:s.createAndFill(g))||void 0;b=b.append(w.from(a.createAndFill(null,k)||void 0));let y=l.before(l.depth-(v-1));e.replace(y,l.after(-m),new M(b,4-v,0));let O=-1;e.doc.nodesBetween(y,e.doc.content.size,(A,B)=>{if(O>-1)return!1;A.isTextblock&&A.content.size===0&&(O=B+1)}),O>-1&&e.setSelection(_.near(e.doc.resolve(O))),e.scrollIntoView()}return!0}let f=c.pos===l.end()?u.contentMatchAt(0).defaultType:null,p={...Gi(h,u.type.name,u.attrs),...t},x={...Gi(h,l.node().type.name,l.node().attrs),...t};e.delete(l.pos,c.pos);let S=f?[{type:a,attrs:p},{type:f,attrs:x}]:[{type:a,attrs:p}];if(!Dt(e.doc,l.pos,2))return!1;if(i){let{selection:b,storedMarks:v}=r,{splittableMarks:m}=o.extensionManager,g=v||b.$to.parentOffset&&b.$from.marks();if(e.split(l.pos,2,S).scrollIntoView(),!g||!i)return!0;let k=g.filter(y=>m.includes(y.type.name));e.ensureMarks(k)}return!0},pl=(n,t)=>{let e=Cl(s=>s.type===t)(n.selection);if(!e)return!0;let r=n.doc.resolve(Math.max(0,e.pos-1)).before(e.depth);if(r===void 0)return!0;let i=n.doc.nodeAt(r);return e.node.type===i?.type&&Kt(n.doc,e.pos)&&n.join(e.pos),!0},ml=(n,t)=>{let e=Cl(s=>s.type===t)(n.selection);if(!e)return!0;let r=n.doc.resolve(e.start).after(e.depth);if(r===void 0)return!0;let i=n.doc.nodeAt(r);return e.node.type===i?.type&&Kt(n.doc,r)&&n.join(r),!0},G0=(n,t,e,r={})=>({editor:i,tr:o,state:s,dispatch:a,chain:l,commands:c,can:d})=>{let{extensions:u,splittableMarks:h}=i.extensionManager,f=et(n,s.schema),p=et(t,s.schema),{selection:x,storedMarks:S}=s,{$from:b,$to:v}=x,m=b.blockRange(v),g=S||x.$to.parentOffset&&x.$from.marks();if(!m)return!1;let k=Cl(y=>Eh(y.type.name,u))(x);if(m.depth>=1&&k&&m.depth-k.depth<=1){if(k.node.type===f)return c.liftListItem(p);if(Eh(k.node.type.name,u)&&f.validContent(k.node.content)&&a)return l().command(()=>(o.setNodeMarkup(k.pos,f),!0)).command(()=>pl(o,f)).command(()=>ml(o,f)).run()}return!e||!g||!a?l().command(()=>d().wrapInList(f,r)?!0:c.clearNodes()).wrapInList(f,r).command(()=>pl(o,f)).command(()=>ml(o,f)).run():l().command(()=>{let y=d().wrapInList(f,r),O=g.filter(A=>h.includes(A.type.name));return o.ensureMarks(O),y?!0:c.clearNodes()}).wrapInList(f,r).command(()=>pl(o,f)).command(()=>ml(o,f)).run()},Y0=(n,t={},e={})=>({state:r,commands:i})=>{let{extendEmptyMarkRange:o=!1}=e,s=$e(n,r.schema);return Sl(r,s,t)?i.unsetMark(s,{extendEmptyMarkRange:o}):i.setMark(s,t)},X0=(n,t,e={})=>({state:r,commands:i})=>{let o=et(n,r.schema),s=et(t,r.schema),a=Rr(r,o,e),l;return r.selection.$anchor.sameParent(r.selection.$head)&&(l=r.selection.$anchor.parent.attrs),a?i.setNode(s,l):i.setNode(o,{...l,...e})},Q0=(n,t={})=>({state:e,commands:r})=>{let i=et(n,e.schema);return Rr(e,i,t)?r.lift(i):r.wrapIn(i,t)},Z0=()=>({state:n,dispatch:t})=>{let e=n.plugins;for(let r=0;r<e.length;r+=1){let i=e[r],o;if(i.spec.isInputRules&&(o=i.getState(n))){if(t){let s=n.tr,a=o.transform;for(let l=a.steps.length-1;l>=0;l-=1)s.step(a.steps[l].invert(a.docs[l]));if(o.text){let l=s.doc.resolve(o.from).marks();s.replaceWith(o.from,o.to,n.schema.text(o.text,l))}else s.delete(o.from,o.to)}return!0}}return!1},ty=()=>({tr:n,dispatch:t})=>{let{selection:e}=n,{empty:r,ranges:i}=e;return r||t&&i.forEach(o=>{n.removeMark(o.$from.pos,o.$to.pos)}),!0},ey=(n,t={})=>({tr:e,state:r,dispatch:i})=>{var o;let{extendEmptyMarkRange:s=!1}=t,{selection:a}=e,l=$e(n,r.schema),{$from:c,empty:d,ranges:u}=a;if(!i)return!0;if(d&&s){let{from:h,to:f}=a,p=(o=c.marks().find(S=>S.type===l))===null||o===void 0?void 0:o.attrs,x=Al(c,l,p);x&&(h=x.from,f=x.to),e.removeMark(h,f,l)}else u.forEach(h=>{e.removeMark(h.$from.pos,h.$to.pos,l)});return e.removeStoredMark(l),!0},ny=(n,t={})=>({tr:e,state:r,dispatch:i})=>{let o=null,s=null,a=no(typeof n=="string"?n:n.name,r.schema);return a?(a==="node"&&(o=et(n,r.schema)),a==="mark"&&(s=$e(n,r.schema)),i&&e.selection.ranges.forEach(l=>{let c=l.$from.pos,d=l.$to.pos;r.doc.nodesBetween(c,d,(u,h)=>{o&&o===u.type&&e.setNodeMarkup(h,void 0,{...u.attrs,...t}),s&&u.marks.length&&u.marks.forEach(f=>{if(s===f.type){let p=Math.max(h,c),x=Math.min(h+u.nodeSize,d);e.addMark(p,x,s.create({...f.attrs,...t}))}})})}),!0):!1},ry=(n,t={})=>({state:e,dispatch:r})=>{let i=et(n,e.schema);return gh(i,t)(e,r)},iy=(n,t={})=>({state:e,dispatch:r})=>{let i=et(n,e.schema);return bh(i,t)(e,r)},oy=Object.freeze({__proto__:null,blur:Ub,clearContent:jb,clearNodes:Kb,command:Wb,createParagraphNear:qb,cut:Jb,deleteCurrentNode:Gb,deleteNode:Yb,deleteRange:Xb,deleteSelection:Qb,enter:Zb,exitCode:t0,extendMarkRange:n0,first:r0,focus:i0,forEach:o0,insertContent:s0,insertContentAt:l0,joinBackward:u0,joinDown:d0,joinForward:h0,joinItemBackward:f0,joinItemForward:p0,joinTextblockBackward:m0,joinTextblockForward:g0,joinUp:c0,keyboardShortcut:y0,lift:x0,liftEmptyBlock:v0,liftListItem:k0,newlineInCode:S0,resetAttributes:w0,scrollIntoView:E0,selectAll:A0,selectNodeBackward:M0,selectNodeForward:T0,selectParentNode:C0,selectTextblockEnd:_0,selectTextblockStart:O0,setContent:N0,setMark:F0,setMeta:V0,setNode:U0,setNodeSelection:j0,setTextSelection:K0,sinkListItem:W0,splitBlock:q0,splitListItem:J0,toggleList:G0,toggleMark:Y0,toggleNode:X0,toggleWrap:Q0,undoInputRule:Z0,unsetAllMarks:ty,unsetMark:ey,updateAttributes:ny,wrapIn:ry,wrapInList:iy}),sy=F.create({name:"commands",addCommands(){return{...oy}}}),ay=F.create({name:"drop",addProseMirrorPlugins(){return[new R({key:new L("tiptapDrop"),props:{handleDrop:(n,t,e,r)=>{this.editor.emit("drop",{editor:this.editor,event:t,slice:e,moved:r})}}})]}}),ly=F.create({name:"editable",addProseMirrorPlugins(){return[new R({key:new L("editable"),props:{editable:()=>this.editor.options.editable}})]}}),cy=F.create({name:"focusEvents",addProseMirrorPlugins(){let{editor:n}=this;return[new R({key:new L("focusEvents"),props:{handleDOMEvents:{focus:(t,e)=>{n.isFocused=!0;let r=n.state.tr.setMeta("focus",{event:e}).setMeta("addToHistory",!1);return t.dispatch(r),!1},blur:(t,e)=>{n.isFocused=!1;let r=n.state.tr.setMeta("blur",{event:e}).setMeta("addToHistory",!1);return t.dispatch(r),!1}}}})]}}),dy=F.create({name:"keymap",addKeyboardShortcuts(){let n=()=>this.editor.commands.first(({commands:s})=>[()=>s.undoInputRule(),()=>s.command(({tr:a})=>{let{selection:l,doc:c}=a,{empty:d,$anchor:u}=l,{pos:h,parent:f}=u,p=u.parent.isTextblock&&h>0?a.doc.resolve(h-1):u,x=p.parent.type.spec.isolating,S=u.pos-u.parentOffset,b=x&&p.parent.childCount===1?S===u.pos:P.atStart(c).from===h;return!d||!f.type.isTextblock||f.textContent.length||!b||b&&u.parent.type.name==="paragraph"?!1:s.clearNodes()}),()=>s.deleteSelection(),()=>s.joinBackward(),()=>s.selectNodeBackward()]),t=()=>this.editor.commands.first(({commands:s})=>[()=>s.deleteSelection(),()=>s.deleteCurrentNode(),()=>s.joinForward(),()=>s.selectNodeForward()]),r={Enter:()=>this.editor.commands.first(({commands:s})=>[()=>s.newlineInCode(),()=>s.createParagraphNear(),()=>s.liftEmptyBlock(),()=>s.splitBlock()]),"Mod-Enter":()=>this.editor.commands.exitCode(),Backspace:n,"Mod-Backspace":n,"Shift-Backspace":n,Delete:t,"Mod-Delete":t,"Mod-a":()=>this.editor.commands.selectAll()},i={...r},o={...r,"Ctrl-h":n,"Alt-Backspace":n,"Ctrl-d":t,"Ctrl-Alt-Backspace":t,"Alt-Delete":t,"Alt-d":t,"Ctrl-a":()=>this.editor.commands.selectTextblockStart(),"Ctrl-e":()=>this.editor.commands.selectTextblockEnd()};return Ml()||Ph()?o:i},addProseMirrorPlugins(){return[new R({key:new L("clearDocument"),appendTransaction:(n,t,e)=>{let r=n.some(x=>x.docChanged)&&!t.doc.eq(e.doc),i=n.some(x=>x.getMeta("preventClearDocument"));if(!r||i)return;let{empty:o,from:s,to:a}=t.selection,l=P.atStart(t.doc).from,c=P.atEnd(t.doc).to;if(o||!(s===l&&a===c)||!Dr(e.doc))return;let h=e.tr,f=Qi({state:e,transaction:h}),{commands:p}=new Un({editor:this.editor,state:f});if(p.clearNodes(),!!h.steps.length)return h}})]}}),uy=F.create({name:"paste",addProseMirrorPlugins(){return[new R({key:new L("tiptapPaste"),props:{handlePaste:(n,t,e)=>{this.editor.emit("paste",{editor:this.editor,event:t,slice:e})}}})]}}),hy=F.create({name:"tabindex",addProseMirrorPlugins(){return[new R({key:new L("tabindex"),props:{attributes:()=>this.editor.isEditable?{tabindex:"0"}:{}}})]}});var wl=class n{get name(){return this.node.type.name}constructor(t,e,r=!1,i=null){this.currentNode=null,this.actualDepth=null,this.isBlock=r,this.resolvedPos=t,this.editor=e,this.currentNode=i}get node(){return this.currentNode||this.resolvedPos.node()}get element(){return this.editor.view.domAtPos(this.pos).node}get depth(){var t;return(t=this.actualDepth)!==null&&t!==void 0?t:this.resolvedPos.depth}get pos(){return this.resolvedPos.pos}get content(){return this.node.content}set content(t){let e=this.from,r=this.to;if(this.isBlock){if(this.content.size===0){console.error(`You can\u2019t set content on a block node. Tried to set content on ${this.name} at ${this.pos}`);return}e=this.from+1,r=this.to-1}this.editor.commands.insertContentAt({from:e,to:r},t)}get attributes(){return this.node.attrs}get textContent(){return this.node.textContent}get size(){return this.node.nodeSize}get from(){return this.isBlock?this.pos:this.resolvedPos.start(this.resolvedPos.depth)}get range(){return{from:this.from,to:this.to}}get to(){return this.isBlock?this.pos+this.size:this.resolvedPos.end(this.resolvedPos.depth)+(this.node.isText?0:1)}get parent(){if(this.depth===0)return null;let t=this.resolvedPos.start(this.resolvedPos.depth-1),e=this.resolvedPos.doc.resolve(t);return new n(e,this.editor)}get before(){let t=this.resolvedPos.doc.resolve(this.from-(this.isBlock?1:2));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.from-3)),new n(t,this.editor)}get after(){let t=this.resolvedPos.doc.resolve(this.to+(this.isBlock?2:1));return t.depth!==this.depth&&(t=this.resolvedPos.doc.resolve(this.to+3)),new n(t,this.editor)}get children(){let t=[];return this.node.content.forEach((e,r)=>{let i=e.isBlock&&!e.isTextblock,o=e.isAtom&&!e.isText,s=this.pos+r+(o?0:1),a=this.resolvedPos.doc.resolve(s);if(!i&&a.depth<=this.depth)return;let l=new n(a,this.editor,i,i?e:null);i&&(l.actualDepth=this.depth+1),t.push(new n(a,this.editor,i,i?e:null))}),t}get firstChild(){return this.children[0]||null}get lastChild(){let t=this.children;return t[t.length-1]||null}closest(t,e={}){let r=null,i=this.parent;for(;i&&!r;){if(i.node.type.name===t)if(Object.keys(e).length>0){let o=i.node.attrs,s=Object.keys(e);for(let a=0;a<s.length;a+=1){let l=s[a];if(o[l]!==e[l])break}}else r=i;i=i.parent}return r}querySelector(t,e={}){return this.querySelectorAll(t,e,!0)[0]||null}querySelectorAll(t,e={},r=!1){let i=[];if(!this.children||this.children.length===0)return i;let o=Object.keys(e);return this.children.forEach(s=>{r&&i.length>0||(s.node.type.name===t&&o.every(l=>e[l]===s.node.attrs[l])&&i.push(s),!(r&&i.length>0)&&(i=i.concat(s.querySelectorAll(t,e,r))))}),i}setAttribute(t){let{tr:e}=this.editor.state;e.setNodeMarkup(this.from,void 0,{...this.node.attrs,...t}),this.editor.view.dispatch(e)}},fy=`.ProseMirror {
position: relative;
}
.ProseMirror {
word-wrap: break-word;
white-space: pre-wrap;
white-space: break-spaces;
-webkit-font-variant-ligatures: none;
font-variant-ligatures: none;
font-feature-settings: "liga" 0; /* the above doesn't seem to work in Edge */
}
.ProseMirror [contenteditable="false"] {
white-space: normal;
}
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
white-space: pre-wrap;
}
.ProseMirror pre {
white-space: pre-wrap;
}
img.ProseMirror-separator {
display: inline !important;
border: none !important;
margin: 0 !important;
width: 0 !important;
height: 0 !important;
}
.ProseMirror-gapcursor {
display: none;
pointer-events: none;
position: absolute;
margin: 0;
}
.ProseMirror-gapcursor:after {
content: "";
display: block;
position: absolute;
top: -2px;
width: 20px;
border-top: 1px solid black;
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
@keyframes ProseMirror-cursor-blink {
to {
visibility: hidden;
}
}
.ProseMirror-hideselection *::selection {
background: transparent;
}
.ProseMirror-hideselection *::-moz-selection {
background: transparent;
}
.ProseMirror-hideselection * {
caret-color: transparent;
}
.ProseMirror-focused .ProseMirror-gapcursor {
display: block;
}
.tippy-box[data-animation=fade][data-state=hidden] {
opacity: 0
}`;function py(n,t,e){let r=document.querySelector(`style[data-tiptap-style${e?`-${e}`:""}]`);if(r!==null)return r;let i=document.createElement("style");return t&&i.setAttribute("nonce",t),i.setAttribute(`data-tiptap-style${e?`-${e}`:""}`,""),i.innerHTML=n,document.getElementsByTagName("head")[0].appendChild(i),i}var Xi=class extends gl{constructor(t={}){super(),this.isFocused=!1,this.isInitialized=!1,this.extensionStorage={},this.options={element:document.createElement("div"),content:"",injectCSS:!0,injectNonce:void 0,extensions:[],autofocus:!1,editable:!0,editorProps:{},parseOptions:{},coreExtensionOptions:{},enableInputRules:!0,enablePasteRules:!0,enableCoreExtensions:!0,enableContentCheck:!1,onBeforeCreate:()=>null,onCreate:()=>null,onUpdate:()=>null,onSelectionUpdate:()=>null,onTransaction:()=>null,onFocus:()=>null,onBlur:()=>null,onDestroy:()=>null,onContentError:({error:e})=>{throw e},onPaste:()=>null,onDrop:()=>null},this.isCapturingTransaction=!1,this.capturedTransaction=null,this.setOptions(t),this.createExtensionManager(),this.createCommandManager(),this.createSchema(),this.on("beforeCreate",this.options.onBeforeCreate),this.emit("beforeCreate",{editor:this}),this.on("contentError",this.options.onContentError),this.createView(),this.injectCSS(),this.on("create",this.options.onCreate),this.on("update",this.options.onUpdate),this.on("selectionUpdate",this.options.onSelectionUpdate),this.on("transaction",this.options.onTransaction),this.on("focus",this.options.onFocus),this.on("blur",this.options.onBlur),this.on("destroy",this.options.onDestroy),this.on("drop",({event:e,slice:r,moved:i})=>this.options.onDrop(e,r,i)),this.on("paste",({event:e,slice:r})=>this.options.onPaste(e,r)),window.setTimeout(()=>{this.isDestroyed||(this.commands.focus(this.options.autofocus),this.emit("create",{editor:this}),this.isInitialized=!0)},0)}get storage(){return this.extensionStorage}get commands(){return this.commandManager.commands}chain(){return this.commandManager.chain()}can(){return this.commandManager.can()}injectCSS(){this.options.injectCSS&&document&&(this.css=py(fy,this.options.injectNonce))}setOptions(t={}){this.options={...this.options,...t},!(!this.view||!this.state||this.isDestroyed)&&(this.options.editorProps&&this.view.setProps(this.options.editorProps),this.view.updateState(this.state))}setEditable(t,e=!0){this.setOptions({editable:t}),e&&this.emit("update",{editor:this,transaction:this.state.tr})}get isEditable(){return this.options.editable&&this.view&&this.view.editable}get state(){return this.view.state}registerPlugin(t,e){let r=Th(e)?e(t,[...this.state.plugins]):[...this.state.plugins,t],i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}unregisterPlugin(t){if(this.isDestroyed)return;let e=this.state.plugins,r=e;if([].concat(t).forEach(o=>{let s=typeof o=="string"?`${o}$`:o.key;r=e.filter(a=>!a.key.startsWith(s))}),e.length===r.length)return;let i=this.state.reconfigure({plugins:r});return this.view.updateState(i),i}createExtensionManager(){var t,e;let i=[...this.options.enableCoreExtensions?[ly,Vb.configure({blockSeparator:(e=(t=this.options.coreExtensionOptions)===null||t===void 0?void 0:t.clipboardTextSerializer)===null||e===void 0?void 0:e.blockSeparator}),sy,cy,dy,hy,ay,uy].filter(o=>typeof this.options.enableCoreExtensions=="object"?this.options.enableCoreExtensions[o.name]!==!1:!0):[],...this.options.extensions].filter(o=>["extension","node","mark"].includes(o?.type));this.extensionManager=new xl(i,this)}createCommandManager(){this.commandManager=new Un({editor:this})}createSchema(){this.schema=this.extensionManager.schema}createView(){let t;try{t=kl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:this.options.enableContentCheck})}catch(o){if(!(o instanceof Error)||!["[tiptap error]: Invalid JSON content","[tiptap error]: Invalid HTML content"].includes(o.message))throw o;this.emit("contentError",{editor:this,error:o,disableCollaboration:()=>{this.storage.collaboration&&(this.storage.collaboration.isDisabled=!0),this.options.extensions=this.options.extensions.filter(s=>s.name!=="collaboration"),this.createExtensionManager()}}),t=kl(this.options.content,this.schema,this.options.parseOptions,{errorOnInvalidContent:!1})}let e=Oh(t,this.options.autofocus);this.view=new zi(this.options.element,{...this.options.editorProps,dispatchTransaction:this.dispatchTransaction.bind(this),state:Ni.create({doc:t,selection:e||void 0})}),this.view.dom.setAttribute("role","textbox"),this.view.dom.getAttribute("aria-label")||this.view.dom.setAttribute("aria-label","Rich-Text Editor");let r=this.state.reconfigure({plugins:this.extensionManager.plugins});this.view.updateState(r),this.createNodeViews(),this.prependClass();let i=this.view.dom;i.editor=this}createNodeViews(){this.view.isDestroyed||this.view.setProps({nodeViews:this.extensionManager.nodeViews})}prependClass(){this.view.dom.className=`tiptap ${this.view.dom.className}`}captureTransaction(t){this.isCapturingTransaction=!0,t(),this.isCapturingTransaction=!1;let e=this.capturedTransaction;return this.capturedTransaction=null,e}dispatchTransaction(t){if(this.view.isDestroyed)return;if(this.isCapturingTransaction){if(!this.capturedTransaction){this.capturedTransaction=t;return}t.steps.forEach(s=>{var a;return(a=this.capturedTransaction)===null||a===void 0?void 0:a.step(s)});return}let e=this.state.apply(t),r=!this.state.selection.eq(e.selection);this.emit("beforeTransaction",{editor:this,transaction:t,nextState:e}),this.view.updateState(e),this.emit("transaction",{editor:this,transaction:t}),r&&this.emit("selectionUpdate",{editor:this,transaction:t});let i=t.getMeta("focus"),o=t.getMeta("blur");i&&this.emit("focus",{editor:this,event:i.event,transaction:t}),o&&this.emit("blur",{editor:this,event:o.event,transaction:t}),!(!t.docChanged||t.getMeta("preventUpdate"))&&this.emit("update",{editor:this,transaction:t})}getAttributes(t){return _l(this.state,t)}isActive(t,e){let r=typeof t=="string"?t:null,i=typeof t=="string"?e:t;return z0(this.state,r,i)}getJSON(){return this.state.doc.toJSON()}getHTML(){return D0(this.state.doc.content,this.schema)}getText(t){let{blockSeparator:e=`
`,textSerializers:r={}}=t||{};return $0(this.state.doc,{blockSeparator:e,textSerializers:{..._h(this.schema),...r}})}get isEmpty(){return Dr(this.state.doc)}getCharacterCount(){return console.warn('[tiptap warn]: "editor.getCharacterCount()" is deprecated. Please use "editor.storage.characterCount.characters()" instead.'),this.state.doc.content.size-2}destroy(){if(this.emit("destroy"),this.view){let t=this.view.dom;t&&t.editor&&delete t.editor,this.view.destroy()}this.removeAllListeners()}get isDestroyed(){var t;return!(!((t=this.view)===null||t===void 0)&&t.docView)}$node(t,e){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelector(t,e))||null}$nodes(t,e){var r;return((r=this.$doc)===null||r===void 0?void 0:r.querySelectorAll(t,e))||null}$pos(t){let e=this.state.doc.resolve(t);return new wl(e,this)}get $doc(){return this.$pos(0)}};function ee(n){return new jn({find:n.find,handler:({state:t,range:e,match:r})=>{let i=I(n.getAttributes,void 0,r);if(i===!1||i===null)return null;let{tr:o}=t,s=r[r.length-1],a=r[0];if(s){let l=a.search(/\S/),c=e.from+a.indexOf(s),d=c+s.length;if(ro(e.from,e.to,t.doc).filter(f=>f.mark.type.excluded.find(x=>x===n.type&&x!==f.mark.type)).filter(f=>f.to>c).length)return null;d<e.to&&o.delete(d,e.to),c>e.from&&o.delete(e.from+l,c);let h=e.from+l+s.length;o.addMark(e.from+l,h,n.type.create(i||{})),o.removeStoredMark(n.type)}}})}function Lh(n){return new jn({find:n.find,handler:({state:t,range:e,match:r})=>{let i=I(n.getAttributes,void 0,r)||{},{tr:o}=t,s=e.from,a=e.to,l=n.type.create(i);if(r[1]){let c=r[0].lastIndexOf(r[1]),d=s+c;d>a?d=a:a=d+r[1].length;let u=r[0][r[0].length-1];o.insertText(u,s+r[0].length-1),o.replaceWith(d,a,l)}else if(r[0]){let c=n.type.isInline?s:s-1;o.insert(c,n.type.create(i)).delete(o.mapping.map(s),o.mapping.map(a))}o.scrollIntoView()}})}function $r(n){return new jn({find:n.find,handler:({state:t,range:e,match:r})=>{let i=t.doc.resolve(e.from),o=I(n.getAttributes,void 0,r)||{};if(!i.node(-1).canReplaceWith(i.index(-1),i.indexAfter(-1),n.type))return null;t.tr.delete(e.from,e.to).setBlockType(e.from,e.from,n.type,o)}})}function Ie(n){return new jn({find:n.find,handler:({state:t,range:e,match:r,chain:i})=>{let o=I(n.getAttributes,void 0,r)||{},s=t.tr.delete(e.from,e.to),l=s.doc.resolve(e.from).blockRange(),c=l&&_n(l,n.type,o);if(!c)return null;if(s.wrap(l,c),n.keepMarks&&n.editor){let{selection:u,storedMarks:h}=t,{splittableMarks:f}=n.editor.extensionManager,p=h||u.$to.parentOffset&&u.$from.marks();if(p){let x=p.filter(S=>f.includes(S.type.name));s.ensureMarks(x)}}if(n.keepAttributes){let u=n.type.name==="bulletList"||n.type.name==="orderedList"?"listItem":"taskList";i().updateAttributes(u,o).run()}let d=s.doc.resolve(e.from-1).nodeBefore;d&&d.type===n.type&&Kt(s.doc,e.from-1)&&(!n.joinPredicate||n.joinPredicate(r,d))&&s.join(e.from-1)}})}var H=class n{constructor(t={}){this.type="node",this.name="node",this.parent=null,this.child=null,this.config={name:this.name,defaultOptions:{}},this.config={...this.config,...t},this.name=this.config.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${this.name}".`),this.options=this.config.defaultOptions,this.config.addOptions&&(this.options=I(C(this,"addOptions",{name:this.name}))),this.storage=I(C(this,"addStorage",{name:this.name,options:this.options}))||{}}static create(t={}){return new n(t)}configure(t={}){let e=this.extend({...this.config,addOptions:()=>to(this.options,t)});return e.name=this.name,e.parent=this.parent,e}extend(t={}){let e=new n(t);return e.parent=this,this.child=e,e.name=t.name?t.name:e.parent.name,t.defaultOptions&&Object.keys(t.defaultOptions).length>0&&console.warn(`[tiptap warn]: BREAKING CHANGE: "defaultOptions" is deprecated. Please use "addOptions" instead. Found in extension: "${e.name}".`),e.options=I(C(e,"addOptions",{name:e.name})),e.storage=I(C(e,"addStorage",{name:e.name,options:e.options})),e}};function It(n){return new yl({find:n.find,handler:({state:t,range:e,match:r,pasteEvent:i})=>{let o=I(n.getAttributes,void 0,r,i);if(o===!1||o===null)return null;let{tr:s}=t,a=r[r.length-1],l=r[0],c=e.to;if(a){let d=l.search(/\S/),u=e.from+l.indexOf(a),h=u+a.length;if(ro(e.from,e.to,t.doc).filter(p=>p.mark.type.excluded.find(S=>S===n.type&&S!==p.mark.type)).filter(p=>p.to>u).length)return null;h<e.to&&s.delete(h,e.to),u>e.from&&s.delete(e.from+d,u),c=e.from+d+a.length,s.addMark(e.from+d,c,n.type.create(o||{})),s.removeStoredMark(n.type)}}})}var Bh=G`
.ProseMirror {
position: relative;
word-wrap: break-word;
white-space: pre-wrap;
white-space: break-spaces;
-webkit-font-variant-ligatures: none;
font-variant-ligatures: none;
font-feature-settings: "liga" 0;
}
.ProseMirror [contenteditable="false"] [contenteditable="true"] {
white-space: pre-wrap;
}
.ProseMirror pre {
white-space: pre-wrap;
}
img.ProseMirror-separator {
display: inline !important;
border: none !important;
margin: 0 !important;
width: 1px !important;
height: 1px !important;
}
.ProseMirror-gapcursor {
display: none;
pointer-events: none;
position: absolute;
margin: 0;
min-width: 1px;
}
.ProseMirror-gapcursor:after {
content: "";
display: block;
position: absolute;
top: -2px;
width: 20px;
border-top: 1px solid black;
animation: ProseMirror-cursor-blink 1.1s steps(2, start) infinite;
}
@keyframes ProseMirror-cursor-blink {
to {
visibility: hidden;
}
}
.ProseMirror-hideselection *::selection {
background: transparent;
}
.ProseMirror-hideselection *::-moz-selection {
background: transparent;
}
.ProseMirror-hideselection * {
caret-color: transparent;
}
.ProseMirror-focused .ProseMirror-gapcursor {
display: block;
}
.tippy-box[data-animation="fade"][data-state="hidden"] {
opacity: 0;
}
`;var my=/^\s*>\s$/,zh=H.create({name:"blockquote",addOptions(){return{HTMLAttributes:{}}},content:"block+",group:"block",defining:!0,parseHTML(){return[{tag:"blockquote"}]},renderHTML({HTMLAttributes:n}){return["blockquote",D(this.options.HTMLAttributes,n),0]},addCommands(){return{setBlockquote:()=>({commands:n})=>n.wrapIn(this.name),toggleBlockquote:()=>({commands:n})=>n.toggleWrap(this.name),unsetBlockquote:()=>({commands:n})=>n.lift(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-b":()=>this.editor.commands.toggleBlockquote()}},addInputRules(){return[Ie({find:my,type:this.type})]}});var gy=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))$/,by=/(?:^|\s)(\*\*(?!\s+\*\*)((?:[^*]+))\*\*(?!\s+\*\*))/g,yy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))$/,xy=/(?:^|\s)(__(?!\s+__)((?:[^_]+))__(?!\s+__))/g,Hh=Pt.create({name:"bold",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"strong"},{tag:"b",getAttrs:n=>n.style.fontWeight!=="normal"&&null},{style:"font-weight=400",clearMark:n=>n.type.name===this.name},{style:"font-weight",getAttrs:n=>/^(bold(er)?|[5-9]\d{2,})$/.test(n)&&null}]},renderHTML({HTMLAttributes:n}){return["strong",D(this.options.HTMLAttributes,n),0]},addCommands(){return{setBold:()=>({commands:n})=>n.setMark(this.name),toggleBold:()=>({commands:n})=>n.toggleMark(this.name),unsetBold:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-b":()=>this.editor.commands.toggleBold(),"Mod-B":()=>this.editor.commands.toggleBold()}},addInputRules(){return[ee({find:gy,type:this.type}),ee({find:yy,type:this.type})]},addPasteRules(){return[It({find:by,type:this.type}),It({find:xy,type:this.type})]}});var vy="listItem",Fh="textStyle",Vh=/^\s*([-+*])\s$/,Uh=H.create({name:"bulletList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},parseHTML(){return[{tag:"ul"}]},renderHTML({HTMLAttributes:n}){return["ul",D(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleBulletList:()=>({commands:n,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(vy,this.editor.getAttributes(Fh)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList()}},addInputRules(){let n=Ie({find:Vh,type:this.type});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ie({find:Vh,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:()=>this.editor.getAttributes(Fh),editor:this.editor})),[n]}});var ky=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))$/,Sy=/(?:^|\s)(`(?!\s+`)((?:[^`]+))`(?!\s+`))/g,jh=Pt.create({name:"code",addOptions(){return{HTMLAttributes:{}}},excludes:"_",code:!0,exitable:!0,parseHTML(){return[{tag:"code"}]},renderHTML({HTMLAttributes:n}){return["code",D(this.options.HTMLAttributes,n),0]},addCommands(){return{setCode:()=>({commands:n})=>n.setMark(this.name),toggleCode:()=>({commands:n})=>n.toggleMark(this.name),unsetCode:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-e":()=>this.editor.commands.toggleCode()}},addInputRules(){return[ee({find:ky,type:this.type})]},addPasteRules(){return[It({find:Sy,type:this.type})]}});var wy=/^```([a-z]+)?[\s\n]$/,Ey=/^~~~([a-z]+)?[\s\n]$/,Kh=H.create({name:"codeBlock",addOptions(){return{languageClassPrefix:"language-",exitOnTripleEnter:!0,exitOnArrowDown:!0,defaultLanguage:null,HTMLAttributes:{}}},content:"text*",marks:"",group:"block",code:!0,defining:!0,addAttributes(){return{language:{default:this.options.defaultLanguage,parseHTML:n=>{var t;let{languageClassPrefix:e}=this.options,o=[...((t=n.firstElementChild)===null||t===void 0?void 0:t.classList)||[]].filter(s=>s.startsWith(e)).map(s=>s.replace(e,""))[0];return o||null},rendered:!1}}},parseHTML(){return[{tag:"pre",preserveWhitespace:"full"}]},renderHTML({node:n,HTMLAttributes:t}){return["pre",D(this.options.HTMLAttributes,t),["code",{class:n.attrs.language?this.options.languageClassPrefix+n.attrs.language:null},0]]},addCommands(){return{setCodeBlock:n=>({commands:t})=>t.setNode(this.name,n),toggleCodeBlock:n=>({commands:t})=>t.toggleNode(this.name,"paragraph",n)}},addKeyboardShortcuts(){return{"Mod-Alt-c":()=>this.editor.commands.toggleCodeBlock(),Backspace:()=>{let{empty:n,$anchor:t}=this.editor.state.selection,e=t.pos===1;return!n||t.parent.type.name!==this.name?!1:e||!t.parent.textContent.length?this.editor.commands.clearNodes():!1},Enter:({editor:n})=>{if(!this.options.exitOnTripleEnter)return!1;let{state:t}=n,{selection:e}=t,{$from:r,empty:i}=e;if(!i||r.parent.type!==this.type)return!1;let o=r.parentOffset===r.parent.nodeSize-2,s=r.parent.textContent.endsWith(`
`);return!o||!s?!1:n.chain().command(({tr:a})=>(a.delete(r.pos-2,r.pos),!0)).exitCode().run()},ArrowDown:({editor:n})=>{if(!this.options.exitOnArrowDown)return!1;let{state:t}=n,{selection:e,doc:r}=t,{$from:i,empty:o}=e;if(!o||i.parent.type!==this.type||!(i.parentOffset===i.parent.nodeSize-2))return!1;let a=i.after();return a===void 0?!1:r.nodeAt(a)?n.commands.command(({tr:c})=>(c.setSelection(P.near(r.resolve(a))),!0)):n.commands.exitCode()}}},addInputRules(){return[$r({find:wy,type:this.type,getAttributes:n=>({language:n[1]})}),$r({find:Ey,type:this.type,getAttributes:n=>({language:n[1]})})]},addProseMirrorPlugins(){return[new R({key:new L("codeBlockVSCodeHandler"),props:{handlePaste:(n,t)=>{if(!t.clipboardData||this.editor.isActive(this.type.name))return!1;let e=t.clipboardData.getData("text/plain"),r=t.clipboardData.getData("vscode-editor-data"),i=r?JSON.parse(r):void 0,o=i?.mode;if(!e||!o)return!1;let{tr:s,schema:a}=n.state,l=a.text(e.replace(/\r\n?/g,`
`));return s.replaceSelectionWith(this.type.create({language:o},l)),s.selection.$from.parent.type!==this.type&&s.setSelection(_.near(s.doc.resolve(Math.max(0,s.selection.from-2)))),s.setMeta("paste",!0),n.dispatch(s),!0}}})]}});var Wh=H.create({name:"doc",topNode:!0,content:"block+"});function qh(n={}){return new R({view(t){return new Ol(t,n)}})}var Ol=class{constructor(t,e){var r;this.editorView=t,this.cursorPos=null,this.element=null,this.timeout=-1,this.width=(r=e.width)!==null&&r!==void 0?r:1,this.color=e.color===!1?void 0:e.color||"black",this.class=e.class,this.handlers=["dragover","dragend","drop","dragleave"].map(i=>{let o=s=>{this[i](s)};return t.dom.addEventListener(i,o),{name:i,handler:o}})}destroy(){this.handlers.forEach(({name:t,handler:e})=>this.editorView.dom.removeEventListener(t,e))}update(t,e){this.cursorPos!=null&&e.doc!=t.state.doc&&(this.cursorPos>t.state.doc.content.size?this.setCursor(null):this.updateOverlay())}setCursor(t){t!=this.cursorPos&&(this.cursorPos=t,t==null?(this.element.parentNode.removeChild(this.element),this.element=null):this.updateOverlay())}updateOverlay(){let t=this.editorView.state.doc.resolve(this.cursorPos),e=!t.parent.inlineContent,r;if(e){let a=t.nodeBefore,l=t.nodeAfter;if(a||l){let c=this.editorView.nodeDOM(this.cursorPos-(a?a.nodeSize:0));if(c){let d=c.getBoundingClientRect(),u=a?d.bottom:d.top;a&&l&&(u=(u+this.editorView.nodeDOM(this.cursorPos).getBoundingClientRect().top)/2),r={left:d.left,right:d.right,top:u-this.width/2,bottom:u+this.width/2}}}}if(!r){let a=this.editorView.coordsAtPos(this.cursorPos);r={left:a.left-this.width/2,right:a.left+this.width/2,top:a.top,bottom:a.bottom}}let i=this.editorView.dom.offsetParent;this.element||(this.element=i.appendChild(document.createElement("div")),this.class&&(this.element.className=this.class),this.element.style.cssText="position: absolute; z-index: 50; pointer-events: none;",this.color&&(this.element.style.backgroundColor=this.color)),this.element.classList.toggle("prosemirror-dropcursor-block",e),this.element.classList.toggle("prosemirror-dropcursor-inline",!e);let o,s;if(!i||i==document.body&&getComputedStyle(i).position=="static")o=-pageXOffset,s=-pageYOffset;else{let a=i.getBoundingClientRect();o=a.left-i.scrollLeft,s=a.top-i.scrollTop}this.element.style.left=r.left-o+"px",this.element.style.top=r.top-s+"px",this.element.style.width=r.right-r.left+"px",this.element.style.height=r.bottom-r.top+"px"}scheduleRemoval(t){clearTimeout(this.timeout),this.timeout=setTimeout(()=>this.setCursor(null),t)}dragover(t){if(!this.editorView.editable)return;let e=this.editorView.posAtCoords({left:t.clientX,top:t.clientY}),r=e&&e.inside>=0&&this.editorView.state.doc.nodeAt(e.inside),i=r&&r.type.spec.disableDropCursor,o=typeof i=="function"?i(this.editorView,e,t):i;if(e&&!o){let s=e.pos;if(this.editorView.dragging&&this.editorView.dragging.slice){let a=Ti(this.editorView.state.doc,s,this.editorView.dragging.slice);a!=null&&(s=a)}this.setCursor(s),this.scheduleRemoval(5e3)}}dragend(){this.scheduleRemoval(20)}drop(){this.scheduleRemoval(20)}dragleave(t){(t.target==this.editorView.dom||!this.editorView.dom.contains(t.relatedTarget))&&this.setCursor(null)}};var Jh=F.create({name:"dropCursor",addOptions(){return{color:"currentColor",width:1,class:void 0}},addProseMirrorPlugins(){return[qh(this.options)]}});var pt=class n extends P{constructor(t){super(t,t)}map(t,e){let r=t.resolve(e.map(this.head));return n.valid(r)?new n(r):P.near(r)}content(){return M.empty}eq(t){return t instanceof n&&t.head==this.head}toJSON(){return{type:"gapcursor",pos:this.head}}static fromJSON(t,e){if(typeof e.pos!="number")throw new RangeError("Invalid input for GapCursor.fromJSON");return new n(t.resolve(e.pos))}getBookmark(){return new Nl(this.anchor)}static valid(t){let e=t.parent;if(e.isTextblock||!Ay(t)||!My(t))return!1;let r=e.type.spec.allowGapCursor;if(r!=null)return r;let i=e.contentMatchAt(t.index()).defaultType;return i&&i.isTextblock}static findGapCursorFrom(t,e,r=!1){t:for(;;){if(!r&&n.valid(t))return t;let i=t.pos,o=null;for(let s=t.depth;;s--){let a=t.node(s);if(e>0?t.indexAfter(s)<a.childCount:t.index(s)>0){o=a.child(e>0?t.indexAfter(s):t.index(s)-1);break}else if(s==0)return null;i+=e;let l=t.doc.resolve(i);if(n.valid(l))return l}for(;;){let s=e>0?o.firstChild:o.lastChild;if(!s){if(o.isAtom&&!o.isText&&!N.isSelectable(o)){t=t.doc.resolve(i+o.nodeSize*e),r=!1;continue t}break}o=s,i+=e;let a=t.doc.resolve(i);if(n.valid(a))return a}return null}}};pt.prototype.visible=!1;pt.findFrom=pt.findGapCursorFrom;P.jsonID("gapcursor",pt);var Nl=class n{constructor(t){this.pos=t}map(t){return new n(t.map(this.pos))}resolve(t){let e=t.resolve(this.pos);return pt.valid(e)?new pt(e):P.near(e)}};function Ay(n){for(let t=n.depth;t>=0;t--){let e=n.index(t),r=n.node(t);if(e==0){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(e-1);;i=i.lastChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function My(n){for(let t=n.depth;t>=0;t--){let e=n.indexAfter(t),r=n.node(t);if(e==r.childCount){if(r.type.spec.isolating)return!0;continue}for(let i=r.child(e);;i=i.firstChild){if(i.childCount==0&&!i.inlineContent||i.isAtom||i.type.spec.isolating)return!0;if(i.inlineContent)return!1}}return!0}function Gh(){return new R({props:{decorations:Oy,createSelectionBetween(n,t,e){return t.pos==e.pos&&pt.valid(e)?new pt(e):null},handleClick:Cy,handleKeyDown:Ty,handleDOMEvents:{beforeinput:_y}}})}var Ty=Qa({ArrowLeft:oo("horiz",-1),ArrowRight:oo("horiz",1),ArrowUp:oo("vert",-1),ArrowDown:oo("vert",1)});function oo(n,t){let e=n=="vert"?t>0?"down":"up":t>0?"right":"left";return function(r,i,o){let s=r.selection,a=t>0?s.$to:s.$from,l=s.empty;if(s instanceof _){if(!o.endOfTextblock(e)||a.depth==0)return!1;l=!1,a=r.doc.resolve(t>0?a.after():a.before())}let c=pt.findGapCursorFrom(a,t,l);return c?(i&&i(r.tr.setSelection(new pt(c))),!0):!1}}function Cy(n,t,e){if(!n||!n.editable)return!1;let r=n.state.doc.resolve(t);if(!pt.valid(r))return!1;let i=n.posAtCoords({left:e.clientX,top:e.clientY});return i&&i.inside>-1&&N.isSelectable(n.state.doc.nodeAt(i.inside))?!1:(n.dispatch(n.state.tr.setSelection(new pt(r))),!0)}function _y(n,t){if(t.inputType!="insertCompositionText"||!(n.state.selection instanceof pt))return!1;let{$from:e}=n.state.selection,r=e.parent.contentMatchAt(e.index()).findWrapping(n.state.schema.nodes.text);if(!r)return!1;let i=w.empty;for(let s=r.length-1;s>=0;s--)i=w.from(r[s].createAndFill(null,i));let o=n.state.tr.replace(e.pos,e.pos,new M(i,0,0));return o.setSelection(_.near(o.doc.resolve(e.pos+1))),n.dispatch(o),!1}function Oy(n){if(!(n.selection instanceof pt))return null;let t=document.createElement("div");return t.className="ProseMirror-gapcursor",q.create(n.doc,[ot.widget(n.selection.head,t,{key:"gapcursor"})])}var Yh=F.create({name:"gapCursor",addProseMirrorPlugins(){return[Gh()]},extendNodeSchema(n){var t;let e={name:n.name,options:n.options,storage:n.storage};return{allowGapCursor:(t=I(C(n,"allowGapCursor",e)))!==null&&t!==void 0?t:null}}});var Xh=H.create({name:"hardBreak",addOptions(){return{keepMarks:!0,HTMLAttributes:{}}},inline:!0,group:"inline",selectable:!1,parseHTML(){return[{tag:"br"}]},renderHTML({HTMLAttributes:n}){return["br",D(this.options.HTMLAttributes,n)]},renderText(){return`
`},addCommands(){return{setHardBreak:()=>({commands:n,chain:t,state:e,editor:r})=>n.first([()=>n.exitCode(),()=>n.command(()=>{let{selection:i,storedMarks:o}=e;if(i.$from.parent.type.spec.isolating)return!1;let{keepMarks:s}=this.options,{splittableMarks:a}=r.extensionManager,l=o||i.$to.parentOffset&&i.$from.marks();return t().insertContent({type:this.name}).command(({tr:c,dispatch:d})=>{if(d&&l&&s){let u=l.filter(h=>a.includes(h.type.name));c.ensureMarks(u)}return!0}).run()})])}},addKeyboardShortcuts(){return{"Mod-Enter":()=>this.editor.commands.setHardBreak(),"Shift-Enter":()=>this.editor.commands.setHardBreak()}}});var Qh=H.create({name:"heading",addOptions(){return{levels:[1,2,3,4,5,6],HTMLAttributes:{}}},content:"inline*",group:"block",defining:!0,addAttributes(){return{level:{default:1,rendered:!1}}},parseHTML(){return this.options.levels.map(n=>({tag:`h${n}`,attrs:{level:n}}))},renderHTML({node:n,HTMLAttributes:t}){return[`h${this.options.levels.includes(n.attrs.level)?n.attrs.level:this.options.levels[0]}`,D(this.options.HTMLAttributes,t),0]},addCommands(){return{setHeading:n=>({commands:t})=>this.options.levels.includes(n.level)?t.setNode(this.name,n):!1,toggleHeading:n=>({commands:t})=>this.options.levels.includes(n.level)?t.toggleNode(this.name,"paragraph",n):!1}},addKeyboardShortcuts(){return this.options.levels.reduce((n,t)=>({...n,[`Mod-Alt-${t}`]:()=>this.editor.commands.toggleHeading({level:t})}),{})},addInputRules(){return this.options.levels.map(n=>$r({find:new RegExp(`^(#{1,${n}})\\s$`),type:this.type,getAttributes:{level:n}}))}});var so=200,lt=function(){};lt.prototype.append=function(t){return t.length?(t=lt.from(t),!this.length&&t||t.length<so&&this.leafAppend(t)||this.length<so&&t.leafPrepend(this)||this.appendInner(t)):this};lt.prototype.prepend=function(t){return t.length?lt.from(t).append(this):this};lt.prototype.appendInner=function(t){return new Ny(this,t)};lt.prototype.slice=function(t,e){return t===void 0&&(t=0),e===void 0&&(e=this.length),t>=e?lt.empty:this.sliceInner(Math.max(0,t),Math.min(this.length,e))};lt.prototype.get=function(t){if(!(t<0||t>=this.length))return this.getInner(t)};lt.prototype.forEach=function(t,e,r){e===void 0&&(e=0),r===void 0&&(r=this.length),e<=r?this.forEachInner(t,e,r,0):this.forEachInvertedInner(t,e,r,0)};lt.prototype.map=function(t,e,r){e===void 0&&(e=0),r===void 0&&(r=this.length);var i=[];return this.forEach(function(o,s){return i.push(t(o,s))},e,r),i};lt.from=function(t){return t instanceof lt?t:t&&t.length?new Zh(t):lt.empty};var Zh=function(n){function t(r){n.call(this),this.values=r}n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t;var e={length:{configurable:!0},depth:{configurable:!0}};return t.prototype.flatten=function(){return this.values},t.prototype.sliceInner=function(i,o){return i==0&&o==this.length?this:new t(this.values.slice(i,o))},t.prototype.getInner=function(i){return this.values[i]},t.prototype.forEachInner=function(i,o,s,a){for(var l=o;l<s;l++)if(i(this.values[l],a+l)===!1)return!1},t.prototype.forEachInvertedInner=function(i,o,s,a){for(var l=o-1;l>=s;l--)if(i(this.values[l],a+l)===!1)return!1},t.prototype.leafAppend=function(i){if(this.length+i.length<=so)return new t(this.values.concat(i.flatten()))},t.prototype.leafPrepend=function(i){if(this.length+i.length<=so)return new t(i.flatten().concat(this.values))},e.length.get=function(){return this.values.length},e.depth.get=function(){return 0},Object.defineProperties(t.prototype,e),t}(lt);lt.empty=new Zh([]);var Ny=function(n){function t(e,r){n.call(this),this.left=e,this.right=r,this.length=e.length+r.length,this.depth=Math.max(e.depth,r.depth)+1}return n&&(t.__proto__=n),t.prototype=Object.create(n&&n.prototype),t.prototype.constructor=t,t.prototype.flatten=function(){return this.left.flatten().concat(this.right.flatten())},t.prototype.getInner=function(r){return r<this.left.length?this.left.get(r):this.right.get(r-this.left.length)},t.prototype.forEachInner=function(r,i,o,s){var a=this.left.length;if(i<a&&this.left.forEachInner(r,i,Math.min(o,a),s)===!1||o>a&&this.right.forEachInner(r,Math.max(i-a,0),Math.min(this.length,o)-a,s+a)===!1)return!1},t.prototype.forEachInvertedInner=function(r,i,o,s){var a=this.left.length;if(i>a&&this.right.forEachInvertedInner(r,i-a,Math.max(o,a)-a,s+a)===!1||o<a&&this.left.forEachInvertedInner(r,Math.min(i,a),o,s)===!1)return!1},t.prototype.sliceInner=function(r,i){if(r==0&&i==this.length)return this;var o=this.left.length;return i<=o?this.left.slice(r,i):r>=o?this.right.slice(r-o,i-o):this.left.slice(r,o).append(this.right.slice(0,i-o))},t.prototype.leafAppend=function(r){var i=this.right.leafAppend(r);if(i)return new t(this.left,i)},t.prototype.leafPrepend=function(r){var i=this.left.leafPrepend(r);if(i)return new t(i,this.right)},t.prototype.appendInner=function(r){return this.left.depth>=Math.max(this.right.depth,r.depth)+1?new t(this.left,new t(this.right,r)):new t(this,r)},t}(lt),Pl=lt;var Py=500,pn=class n{constructor(t,e){this.items=t,this.eventCount=e}popEvent(t,e){if(this.eventCount==0)return null;let r=this.items.length;for(;;r--)if(this.items.get(r-1).selection){--r;break}let i,o;e&&(i=this.remapping(r,this.items.length),o=i.maps.length);let s=t.tr,a,l,c=[],d=[];return this.items.forEach((u,h)=>{if(!u.step){i||(i=this.remapping(r,h+1),o=i.maps.length),o--,d.push(u);return}if(i){d.push(new ne(u.map));let f=u.step.map(i.slice(o)),p;f&&s.maybeStep(f).doc&&(p=s.mapping.maps[s.mapping.maps.length-1],c.push(new ne(p,void 0,void 0,c.length+d.length))),o--,p&&i.appendMap(p,o)}else s.maybeStep(u.step);if(u.selection)return a=i?u.selection.map(i.slice(o)):u.selection,l=new n(this.items.slice(0,r).append(d.reverse().concat(c)),this.eventCount-1),!1},this.items.length,0),{remaining:l,transform:s,selection:a}}addTransform(t,e,r,i){let o=[],s=this.eventCount,a=this.items,l=!i&&a.length?a.get(a.length-1):null;for(let d=0;d<t.steps.length;d++){let u=t.steps[d].invert(t.docs[d]),h=new ne(t.mapping.maps[d],u,e),f;(f=l&&l.merge(h))&&(h=f,d?o.pop():a=a.slice(0,a.length-1)),o.push(h),e&&(s++,e=void 0),i||(l=h)}let c=s-r.depth;return c>Dy&&(a=Ry(a,c),s-=c),new n(a.append(o),s)}remapping(t,e){let r=new Sr;return this.items.forEach((i,o)=>{let s=i.mirrorOffset!=null&&o-i.mirrorOffset>=t?r.maps.length-i.mirrorOffset:void 0;r.appendMap(i.map,s)},t,e),r}addMaps(t){return this.eventCount==0?this:new n(this.items.append(t.map(e=>new ne(e))),this.eventCount)}rebased(t,e){if(!this.eventCount)return this;let r=[],i=Math.max(0,this.items.length-e),o=t.mapping,s=t.steps.length,a=this.eventCount;this.items.forEach(h=>{h.selection&&a--},i);let l=e;this.items.forEach(h=>{let f=o.getMirror(--l);if(f==null)return;s=Math.min(s,f);let p=o.maps[f];if(h.step){let x=t.steps[f].invert(t.docs[f]),S=h.selection&&h.selection.map(o.slice(l+1,f));S&&a++,r.push(new ne(p,x,S))}else r.push(new ne(p))},i);let c=[];for(let h=e;h<s;h++)c.push(new ne(o.maps[h]));let d=this.items.slice(0,i).append(c).append(r),u=new n(d,a);return u.emptyItemCount()>Py&&(u=u.compress(this.items.length-r.length)),u}emptyItemCount(){let t=0;return this.items.forEach(e=>{e.step||t++}),t}compress(t=this.items.length){let e=this.remapping(0,t),r=e.maps.length,i=[],o=0;return this.items.forEach((s,a)=>{if(a>=t)i.push(s),s.selection&&o++;else if(s.step){let l=s.step.map(e.slice(r)),c=l&&l.getMap();if(r--,c&&e.appendMap(c,r),l){let d=s.selection&&s.selection.map(e.slice(r));d&&o++;let u=new ne(c.invert(),l,d),h,f=i.length-1;(h=i.length&&i[f].merge(u))?i[f]=h:i.push(u)}}else s.map&&r--},this.items.length,0),new n(Pl.from(i.reverse()),o)}};pn.empty=new pn(Pl.empty,0);function Ry(n,t){let e;return n.forEach((r,i)=>{if(r.selection&&t--==0)return e=i,!1}),n.slice(e)}var ne=class n{constructor(t,e,r,i){this.map=t,this.step=e,this.selection=r,this.mirrorOffset=i}merge(t){if(this.step&&t.step&&!t.selection){let e=t.step.merge(this.step);if(e)return new n(e.getMap().invert(),e,this.selection)}}},re=class{constructor(t,e,r,i,o){this.done=t,this.undone=e,this.prevRanges=r,this.prevTime=i,this.prevComposition=o}},Dy=20;function $y(n,t,e,r){let i=e.getMeta(fn),o;if(i)return i.historyState;e.getMeta(By)&&(n=new re(n.done,n.undone,null,0,-1));let s=e.getMeta("appendedTransaction");if(e.steps.length==0)return n;if(s&&s.getMeta(fn))return s.getMeta(fn).redo?new re(n.done.addTransform(e,void 0,r,ao(t)),n.undone,tf(e.mapping.maps),n.prevTime,n.prevComposition):new re(n.done,n.undone.addTransform(e,void 0,r,ao(t)),null,n.prevTime,n.prevComposition);if(e.getMeta("addToHistory")!==!1&&!(s&&s.getMeta("addToHistory")===!1)){let a=e.getMeta("composition"),l=n.prevTime==0||!s&&n.prevComposition!=a&&(n.prevTime<(e.time||0)-r.newGroupDelay||!Iy(e,n.prevRanges)),c=s?Rl(n.prevRanges,e.mapping):tf(e.mapping.maps);return new re(n.done.addTransform(e,l?t.selection.getBookmark():void 0,r,ao(t)),pn.empty,c,e.time,a??n.prevComposition)}else return(o=e.getMeta("rebased"))?new re(n.done.rebased(e,o),n.undone.rebased(e,o),Rl(n.prevRanges,e.mapping),n.prevTime,n.prevComposition):new re(n.done.addMaps(e.mapping.maps),n.undone.addMaps(e.mapping.maps),Rl(n.prevRanges,e.mapping),n.prevTime,n.prevComposition)}function Iy(n,t){if(!t)return!1;if(!n.docChanged)return!0;let e=!1;return n.mapping.maps[0].forEach((r,i)=>{for(let o=0;o<t.length;o+=2)r<=t[o+1]&&i>=t[o]&&(e=!0)}),e}function tf(n){let t=[];for(let e=n.length-1;e>=0&&t.length==0;e--)n[e].forEach((r,i,o,s)=>t.push(o,s));return t}function Rl(n,t){if(!n)return null;let e=[];for(let r=0;r<n.length;r+=2){let i=t.map(n[r],1),o=t.map(n[r+1],-1);i<=o&&e.push(i,o)}return e}function Ly(n,t,e){let r=ao(t),i=fn.get(t).spec.config,o=(e?n.undone:n.done).popEvent(t,r);if(!o)return null;let s=o.selection.resolve(o.transform.doc),a=(e?n.done:n.undone).addTransform(o.transform,t.selection.getBookmark(),i,r),l=new re(e?a:o.remaining,e?o.remaining:a,null,0,-1);return o.transform.setSelection(s).setMeta(fn,{redo:e,historyState:l})}var Dl=!1,ef=null;function ao(n){let t=n.plugins;if(ef!=t){Dl=!1,ef=t;for(let e=0;e<t.length;e++)if(t[e].spec.historyPreserveItems){Dl=!0;break}}return Dl}var fn=new L("history"),By=new L("closeHistory");function nf(n={}){return n={depth:n.depth||100,newGroupDelay:n.newGroupDelay||500},new R({key:fn,state:{init(){return new re(pn.empty,pn.empty,null,0,-1)},apply(t,e,r){return $y(e,r,t,n)}},config:n,props:{handleDOMEvents:{beforeinput(t,e){let r=e.inputType,i=r=="historyUndo"?$l:r=="historyRedo"?Il:null;return i?(e.preventDefault(),i(t.state,t.dispatch)):!1}}}})}function lo(n,t){return(e,r)=>{let i=fn.getState(e);if(!i||(n?i.undone:i.done).eventCount==0)return!1;if(r){let o=Ly(i,e,n);o&&r(t?o.scrollIntoView():o)}return!0}}var $l=lo(!1,!0),Il=lo(!0,!0),tS=lo(!1,!1),eS=lo(!0,!1);var rf=F.create({name:"history",addOptions(){return{depth:100,newGroupDelay:500}},addCommands(){return{undo:()=>({state:n,dispatch:t})=>$l(n,t),redo:()=>({state:n,dispatch:t})=>Il(n,t)}},addProseMirrorPlugins(){return[nf(this.options)]},addKeyboardShortcuts(){return{"Mod-z":()=>this.editor.commands.undo(),"Shift-Mod-z":()=>this.editor.commands.redo(),"Mod-y":()=>this.editor.commands.redo(),"Mod-\u044F":()=>this.editor.commands.undo(),"Shift-Mod-\u044F":()=>this.editor.commands.redo()}}});var of=H.create({name:"horizontalRule",addOptions(){return{HTMLAttributes:{}}},group:"block",parseHTML(){return[{tag:"hr"}]},renderHTML({HTMLAttributes:n}){return["hr",D(this.options.HTMLAttributes,n)]},addCommands(){return{setHorizontalRule:()=>({chain:n,state:t})=>{let{selection:e}=t,{$from:r,$to:i}=e,o=n();return r.parentOffset===0?o.insertContentAt({from:Math.max(r.pos-1,0),to:i.pos},{type:this.name}):Wn(e)?o.insertContentAt(i.pos,{type:this.name}):o.insertContent({type:this.name}),o.command(({tr:s,dispatch:a})=>{var l;if(a){let{$to:c}=s.selection,d=c.end();if(c.nodeAfter)c.nodeAfter.isTextblock?s.setSelection(_.create(s.doc,c.pos+1)):c.nodeAfter.isBlock?s.setSelection(N.create(s.doc,c.pos)):s.setSelection(_.create(s.doc,c.pos));else{let u=(l=c.parent.type.contentMatch.defaultType)===null||l===void 0?void 0:l.create();u&&(s.insert(d,u),s.setSelection(_.create(s.doc,d+1)))}s.scrollIntoView()}return!0}).run()}}},addInputRules(){return[Lh({find:/^(?:---|—-|___\s|\*\*\*\s)$/,type:this.type})]}});var zy=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))$/,Hy=/(?:^|\s)(\*(?!\s+\*)((?:[^*]+))\*(?!\s+\*))/g,Fy=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))$/,Vy=/(?:^|\s)(_(?!\s+_)((?:[^_]+))_(?!\s+_))/g,sf=Pt.create({name:"italic",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"em"},{tag:"i",getAttrs:n=>n.style.fontStyle!=="normal"&&null},{style:"font-style=normal",clearMark:n=>n.type.name===this.name},{style:"font-style=italic"}]},renderHTML({HTMLAttributes:n}){return["em",D(this.options.HTMLAttributes,n),0]},addCommands(){return{setItalic:()=>({commands:n})=>n.setMark(this.name),toggleItalic:()=>({commands:n})=>n.toggleMark(this.name),unsetItalic:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-i":()=>this.editor.commands.toggleItalic(),"Mod-I":()=>this.editor.commands.toggleItalic()}},addInputRules(){return[ee({find:zy,type:this.type}),ee({find:Fy,type:this.type})]},addPasteRules(){return[It({find:Hy,type:this.type}),It({find:Vy,type:this.type})]}});var af=H.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",D(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}});var Uy="listItem",lf="textStyle",cf=/^(\d+)\.\s$/,df=H.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1},type:{default:void 0,parseHTML:n=>n.getAttribute("type")}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){let{start:t,...e}=n;return t===1?["ol",D(this.options.HTMLAttributes,e),0]:["ol",D(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:t})=>this.options.keepAttributes?t().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(Uy,this.editor.getAttributes(lf)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=Ie({find:cf,type:this.type,getAttributes:t=>({start:+t[1]}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=Ie({find:cf,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:t=>({start:+t[1],...this.editor.getAttributes(lf)}),joinPredicate:(t,e)=>e.childCount+e.attrs.start===+t[1],editor:this.editor})),[n]}});var uf=H.create({name:"paragraph",priority:1e3,addOptions(){return{HTMLAttributes:{}}},group:"block",content:"inline*",parseHTML(){return[{tag:"p"}]},renderHTML({HTMLAttributes:n}){return["p",D(this.options.HTMLAttributes,n),0]},addCommands(){return{setParagraph:()=>({commands:n})=>n.setNode(this.name)}},addKeyboardShortcuts(){return{"Mod-Alt-0":()=>this.editor.commands.setParagraph()}}});var jy=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/,Ky=/(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g,co=Pt.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",D(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-Shift-s":()=>this.editor.commands.toggleStrike()}},addInputRules(){return[ee({find:jy,type:this.type})]},addPasteRules(){return[It({find:Ky,type:this.type})]}});var hf=H.create({name:"text",group:"inline"});var ff=F.create({name:"starterKit",addExtensions(){var n,t,e,r,i,o,s,a,l,c,d,u,h,f,p,x,S,b;let v=[];return this.options.bold!==!1&&v.push(Hh.configure((n=this.options)===null||n===void 0?void 0:n.bold)),this.options.blockquote!==!1&&v.push(zh.configure((t=this.options)===null||t===void 0?void 0:t.blockquote)),this.options.bulletList!==!1&&v.push(Uh.configure((e=this.options)===null||e===void 0?void 0:e.bulletList)),this.options.code!==!1&&v.push(jh.configure((r=this.options)===null||r===void 0?void 0:r.code)),this.options.codeBlock!==!1&&v.push(Kh.configure((i=this.options)===null||i===void 0?void 0:i.codeBlock)),this.options.document!==!1&&v.push(Wh.configure((o=this.options)===null||o===void 0?void 0:o.document)),this.options.dropcursor!==!1&&v.push(Jh.configure((s=this.options)===null||s===void 0?void 0:s.dropcursor)),this.options.gapcursor!==!1&&v.push(Yh.configure((a=this.options)===null||a===void 0?void 0:a.gapcursor)),this.options.hardBreak!==!1&&v.push(Xh.configure((l=this.options)===null||l===void 0?void 0:l.hardBreak)),this.options.heading!==!1&&v.push(Qh.configure((c=this.options)===null||c===void 0?void 0:c.heading)),this.options.history!==!1&&v.push(rf.configure((d=this.options)===null||d===void 0?void 0:d.history)),this.options.horizontalRule!==!1&&v.push(of.configure((u=this.options)===null||u===void 0?void 0:u.horizontalRule)),this.options.italic!==!1&&v.push(sf.configure((h=this.options)===null||h===void 0?void 0:h.italic)),this.options.listItem!==!1&&v.push(af.configure((f=this.options)===null||f===void 0?void 0:f.listItem)),this.options.orderedList!==!1&&v.push(df.configure((p=this.options)===null||p===void 0?void 0:p.orderedList)),this.options.paragraph!==!1&&v.push(uf.configure((x=this.options)===null||x===void 0?void 0:x.paragraph)),this.options.strike!==!1&&v.push(co.configure((S=this.options)===null||S===void 0?void 0:S.strike)),this.options.text!==!1&&v.push(hf.configure((b=this.options)===null||b===void 0?void 0:b.text)),v}});function Ll(){let n=window.crypto||window.msCrypto;return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,t=>(t^n.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}var Bl={};Jp(Bl,{attachFiles:()=>n1,blockQuote:()=>Xy,bold:()=>Wy,bulletList:()=>t1,close:()=>o1,closeSvgPath:()=>uo,code:()=>Qy,codeBlock:()=>Zy,decreaseIndentation:()=>a1,heading:()=>Yy,increaseIndentation:()=>s1,italics:()=>qy,link:()=>Gy,orderedList:()=>e1,redo:()=>i1,strike:()=>Jy,toSvg:()=>Y,undo:()=>r1,warning:()=>l1,warningSvgPath:()=>ho});function Y(n,t=24,e=["toolbar__icon"]){return T`<svg
xmlns="http://www.w3.org/2000/svg"
aria-hidden="true"
fill="currentColor"
viewBox="0 0 ${t} ${t}"
width="${t}"
height="${t}"
part="${e.join(" ")}"
>
${n}
</svg>`}var Wy=Y(nt`<path fill-rule="evenodd" d="M6 4.75c0-.69.56-1.25 1.25-1.25h5a4.75 4.75 0 013.888 7.479A5 5 0 0114 20.5H7.25c-.69 0-1.25-.56-1.25-1.25V4.75zM8.5 13v5H14a2.5 2.5 0 000-5H8.5zm0-2.5h3.751A2.25 2.25 0 0012.25 6H8.5v4.5z"></path>`),qy=Y(nt`<path fill-rule="evenodd" d="M10 4.75a.75.75 0 01.75-.75h8.5a.75.75 0 010 1.5h-3.514l-5.828 13h3.342a.75.75 0 010 1.5h-8.5a.75.75 0 010-1.5h3.514l5.828-13H10.75a.75.75 0 01-.75-.75z"></path>`),Jy=Y(nt`<path fill-rule="evenodd" d="M12.36 5C9.37 5 8.105 6.613 8.105 7.848c0 .411.072.744.193 1.02a.75.75 0 01-1.373.603 3.993 3.993 0 01-.32-1.623c0-2.363 2.271-4.348 5.755-4.348 1.931 0 3.722.794 4.814 1.5a.75.75 0 11-.814 1.26c-.94-.607-2.448-1.26-4-1.26zm4.173 7.5h3.717a.75.75 0 000-1.5H3.75a.75.75 0 000 1.5h9.136c1.162.28 2.111.688 2.76 1.211.642.518.979 1.134.979 1.898a2.63 2.63 0 01-.954 2.036c-.703.601-1.934 1.105-3.999 1.105-2.018 0-3.529-.723-4.276-1.445a.75.75 0 10-1.042 1.08c1.066 1.028 2.968 1.865 5.318 1.865 2.295 0 3.916-.56 4.974-1.464a4.131 4.131 0 001.479-3.177c0-1.296-.608-2.316-1.538-3.066a5.77 5.77 0 00-.054-.043z"></path>`),Gy=Y(nt`<path d="M14.78 3.653a3.936 3.936 0 115.567 5.567l-3.627 3.627a3.936 3.936 0 01-5.88-.353.75.75 0 00-1.18.928 5.436 5.436 0 008.12.486l3.628-3.628a5.436 5.436 0 10-7.688-7.688l-3 3a.75.75 0 001.06 1.061l3-3z"></path> <path d="M7.28 11.153a3.936 3.936 0 015.88.353.75.75 0 001.18-.928 5.436 5.436 0 00-8.12-.486L2.592 13.72a5.436 5.436 0 107.688 7.688l3-3a.75.75 0 10-1.06-1.06l-3 3a3.936 3.936 0 01-5.567-5.568l3.627-3.627z"></path>`),Yy=Y(nt`<path fill-rule="evenodd" d="M6.25 4a.75.75 0 01.75.75V11h10V4.75a.75.75 0 011.5 0v14.5a.75.75 0 01-1.5 0V12.5H7v6.75a.75.75 0 01-1.5 0V4.75A.75.75 0 016.25 4z"></path>`),Xy=Y(nt`<path d="M2.678 11.894a1 1 0 0 1 .287.801 10.97 10.97 0 0 1-.398 2c1.395-.323 2.247-.697 2.634-.893a1 1 0 0 1 .71-.074A8.06 8.06 0 0 0 8 14c3.996 0 7-2.807 7-6 0-3.192-3.004-6-7-6S1 4.808 1 8c0 1.468.617 2.83 1.678 3.894zm-.493 3.905a21.682 21.682 0 0 1-.713.129c-.2.032-.352-.176-.273-.362a9.68 9.68 0 0 0 .244-.637l.003-.01c.248-.72.45-1.548.524-2.319C.743 11.37 0 9.76 0 8c0-3.866 3.582-7 8-7s8 3.134 8 7-3.582 7-8 7a9.06 9.06 0 0 1-2.347-.306c-.52.263-1.639.742-3.468 1.105z" /> <path d="M7.066 6.76A1.665 1.665 0 0 0 4 7.668a1.667 1.667 0 0 0 2.561 1.406c-.131.389-.375.804-.777 1.22a.417.417 0 0 0 .6.58c1.486-1.54 1.293-3.214.682-4.112zm4 0A1.665 1.665 0 0 0 8 7.668a1.667 1.667 0 0 0 2.561 1.406c-.131.389-.375.804-.777 1.22a.417.417 0 0 0 .6.58c1.486-1.54 1.293-3.214.682-4.112z" />`,16),Qy=Y(nt`
<path d="M10.478 1.647a.5.5 0 1 0-.956-.294l-4 13a.5.5 0 0 0 .956.294zM4.854 4.146a.5.5 0 0 1 0 .708L1.707 8l3.147 3.146a.5.5 0 0 1-.708.708l-3.5-3.5a.5.5 0 0 1 0-.708l3.5-3.5a.5.5 0 0 1 .708 0m6.292 0a.5.5 0 0 0 0 .708L14.293 8l-3.147 3.146a.5.5 0 0 0 .708.708l3.5-3.5a.5.5 0 0 0 0-.708l-3.5-3.5a.5.5 0 0 0-.708 0"/>`,16),Zy=Y(nt`
<path d="M14 1a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H2a1 1 0 0 1-1-1V2a1 1 0 0 1 1-1zM2 0a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V2a2 2 0 0 0-2-2z"/>
<path d="M6.854 4.646a.5.5 0 0 1 0 .708L4.207 8l2.647 2.646a.5.5 0 0 1-.708.708l-3-3a.5.5 0 0 1 0-.708l3-3a.5.5 0 0 1 .708 0m2.292 0a.5.5 0 0 0 0 .708L11.793 8l-2.647 2.646a.5.5 0 0 0 .708.708l3-3a.5.5 0 0 0 0-.708l-3-3a.5.5 0 0 0-.708 0"/>
`,16),t1=Y(nt`<path fill-rule="evenodd" d="M4 7a1 1 0 100-2 1 1 0 000 2zm4.75-1.5a.75.75 0 000 1.5h11.5a.75.75 0 000-1.5H8.75zm0 6a.75.75 0 000 1.5h11.5a.75.75 0 000-1.5H8.75zm0 6a.75.75 0 000 1.5h11.5a.75.75 0 000-1.5H8.75zM5 12a1 1 0 11-2 0 1 1 0 012 0zm-1 7a1 1 0 100-2 1 1 0 000 2z"></path>`),e1=Y(nt`<path
d="M3.604 3.089A.75.75 0 014 3.75V8.5h.75a.75.75 0 010 1.5h-3a.75.75 0 110-1.5h.75V5.151l-.334.223a.75.75 0 01-.832-1.248l1.5-1a.75.75 0 01.77-.037zM8.75 5.5a.75.75 0 000 1.5h11.5a.75.75 0 000-1.5H8.75zm0 6a.75.75 0 000 1.5h11.5a.75.75 0 000-1.5H8.75zm0 6a.75.75 0 000 1.5h11.5a.75.75 0 000-1.5H8.75zM5.5 15.75c0-.704-.271-1.286-.72-1.686a2.302 2.302 0 00-1.53-.564c-.535 0-1.094.178-1.53.565-.449.399-.72.982-.72 1.685a.75.75 0 001.5 0c0-.296.104-.464.217-.564A.805.805 0 013.25 15c.215 0 .406.072.533.185.113.101.217.268.217.565 0 .332-.069.48-.21.657-.092.113-.216.24-.403.419l-.147.14c-.152.144-.33.313-.52.504l-1.5 1.5a.75.75 0 00-.22.53v.25c0 .414.336.75.75.75H5A.75.75 0 005 19H3.31l.47-.47c.176-.176.333-.324.48-.465l.165-.156a5.98 5.98 0 00.536-.566c.358-.447.539-.925.539-1.593z"></path>`),n1=Y(nt`<path d="M4.5 3a2.5 2.5 0 0 1 5 0v9a1.5 1.5 0 0 1-3 0V5a.5.5 0 0 1 1 0v7a.5.5 0 0 0 1 0V3a1.5 1.5 0 1 0-3 0v9a2.5 2.5 0 0 0 5 0V5a.5.5 0 0 1 1 0v7a3.5 3.5 0 1 1-7 0V3z" />`,16),r1=Y(nt`<path fill-rule="evenodd" d="M14.5 1.5a.5.5 0 0 1 .5.5v4.8a2.5 2.5 0 0 1-2.5 2.5H2.707l3.347 3.346a.5.5 0 0 1-.708.708l-4.2-4.2a.5.5 0 0 1 0-.708l4-4a.5.5 0 1 1 .708.708L2.707 8.3H12.5A1.5 1.5 0 0 0 14 6.8V2a.5.5 0 0 1 .5-.5z" />`,16),i1=Y(nt`<path fill-rule="evenodd" d="M1.5 1.5A.5.5 0 0 0 1 2v4.8a2.5 2.5 0 0 0 2.5 2.5h9.793l-3.347 3.346a.5.5 0 0 0 .708.708l4.2-4.2a.5.5 0 0 0 0-.708l-4-4a.5.5 0 0 0-.708.708L13.293 8.3H3.5A1.5 1.5 0 0 1 2 6.8V2a.5.5 0 0 0-.5-.5z" />`,16),uo=nt`<path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z" />`,o1=Y(uo,16),s1=Y(nt`<path d="M2 3.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm.646 2.146a.5.5 0 0 1 .708 0l2 2a.5.5 0 0 1 0 .708l-2 2a.5.5 0 0 1-.708-.708L4.293 8 2.646 6.354a.5.5 0 0 1 0-.708zM7 6.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5zm-5 3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/>`,16),a1=Y(nt`<path d="M2 3.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5zm10.646 2.146a.5.5 0 0 1 .708.708L11.707 8l1.647 1.646a.5.5 0 0 1-.708.708l-2-2a.5.5 0 0 1 0-.708l2-2zM2 6.5a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6a.5.5 0 0 1-.5-.5zm0 3a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 0 1h-11a.5.5 0 0 1-.5-.5z"/>`,16),ho=nt`
<path d="M7.938 2.016A.13.13 0 0 1 8.002 2a.13.13 0 0 1 .063.016.15.15 0 0 1 .054.057l6.857 11.667c.036.06.035.124.002.183a.2.2 0 0 1-.054.06.1.1 0 0 1-.066.017H1.146a.1.1 0 0 1-.066-.017.2.2 0 0 1-.054-.06.18.18 0 0 1 .002-.183L7.884 2.073a.15.15 0 0 1 .054-.057m1.044-.45a1.13 1.13 0 0 0-1.96 0L.165 13.233c-.457.778.091 1.767.98 1.767h13.713c.889 0 1.438-.99.98-1.767z"/>
<path d="M7.002 12a1 1 0 1 1 2 0 1 1 0 0 1-2 0M7.1 5.995a.905.905 0 1 1 1.8 0l-.35 3.507a.552.552 0 0 1-1.1 0z"/>`,l1=Y(ho,16,[]);function fo(n){let t=n/1024;if(t<1)return n.toString()+"B";let e=t/1024;return e<1?t.toFixed(0).toString()+" KB":e.toFixed(0).toString()+" MB"}var po=G`
[hidden] {
display: none !important;
}
*,
*::after,
*::before {
box-sizing: border-box;
}
button {
background-color: inherit;
border: none;
color: inherit;
cursor: pointer;
}
`;var mo=/Mac|iOS|iPhone|iPad|iPod/i.test(window.navigator.platform),Lt=mo?"cmd":"ctrl",pf=mo?"option":"alt",Ir="Unable to upload this file.",zl="Add a caption...",mf={attachFiles:"Attach Files",bold:`Bold <${Lt}+b>`,italics:`Italicize <${Lt}+i>`,strike:`Strikethrough <${Lt}+shift+x>`,link:`Link <${Lt}+k>`,heading:`Heading <${Lt}+${pf}+1>`,blockQuote:`Blockquote <${Lt}+shift+b>`,code:`Inline code <${Lt}+e>`,codeBlock:`Codeblock <${Lt}+${pf}+c>`,bulletList:`Bullet List <${Lt}+shift+7>`,orderedList:`Ordered List <${Lt}+shift+8>`,undo:`Undo <${Lt}+z>`,redo:`Redo <${Lt}+shift+z>`,linkDialogLink:"Link",linkDialogUnlink:"Unlink",placeholder:"Write something...",increaseIndentation:"Increase indentation",decreaseIndentation:"Decrease indentation",fileUploadErrorMessage:Ir,captionPlaceholder:zl};function Lr(n,t,e){return n?t(n):e?.(n)}var Jt=Object.freeze({notStarted:"not-started",loading:"loading",error:"error",success:"success"}),Br=class extends Ye{constructor(){super();this.altTextEditor=!1;this.altTextDialogOpen=!1;this.altText="";this.imgSrc="";this.editorValue=null;this.handleClick=e=>{if(e.defaultPrevented)return;let r=e.composedPath(),i=this.shadowRoot?.querySelector("[part~='alt-text-button']");if(i&&r.includes(i)){this.altTextDialogOpen=!0,this.setNodeAttributes({altTextDialogOpen:this.altTextDialogOpen}),e.preventDefault();return}if(!this.altTextDialogOpen)return;let o=this.shadowRoot?.querySelector("dialog");o&&o&&!r.includes(o)&&(this.altTextDialogOpen=!1,this.setNodeAttributes({altTextDialogOpen:this.altTextDialogOpen}))};this.handleKeydown=e=>{this.altTextDialogOpen&&e.key==="Escape"&&(this.altTextDialogOpen=!1,this.setNodeAttributes({altTextDialogOpen:this.altTextDialogOpen}))};this.loadingState="not-started",this.fileUploadErrorMessage=Ir,this.altTextMaxLength=2e3,this.altTextMinLength=1,this.removeFigure=()=>{},this.setNodeAttributes=e=>{}}closeIcon(e=["icon","close-icon"]){return T`${Y(uo,16,e)}`}warningIcon(){return T`${Y(ho,16,["icon","warning-icon"])}`}static get properties(){return{fileName:{attribute:"file-name",type:String},fileSize:{attribute:"file-size",type:Number},progress:{type:Number},class:{attribute:"class",type:String},loadingState:{attribute:"loading-state"},fileUploadErrorMessage:{state:!0},altTextDialogOpen:{attribute:"show-alt-text-dialog",type:Boolean},altTextMaxLength:{type:Number},imgSrc:{attribute:"img-src"},showMetadata:{attribute:"show-metadata",reflect:!0,type:Boolean},editorValue:{},altText:{attribute:"alt-text"},previewable:{reflect:!0,type:Boolean}}}connectedCallback(){super.connectedCallback(),this.classList.add("rhino-attachment-editor"),document.addEventListener("click",this.handleClick),document.addEventListener("keydown",this.handleKeydown)}firstUpdated(e){this.editorValue=this.altText}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.handleClick),document.removeEventListener("keydown",this.handleKeydown)}static get styles(){return G`
${po}
:host {
/* Set to none because we need height / width set. */
pointer-events: none;
position: absolute;
width: 100%;
top: 0;
left: 0;
height: 100%;
z-index: 0;
--rhino-error-background-color: hsl(0 100% 89%);
--rhino-error-text-color: hsl(0 66% 30%);
--rhino-error-border-color: hsl(0 66% 30%);
}
* {
pointer-events: initial;
}
button {
background: Canvas;
border: 2px solid var(--rhino-button-border-color);
display: flex;
align-items: center;
pointer-events: all;
padding: 0.4em 0.6em;
}
button:is(:focus-within) {
border-color: var(--rhino-button-active-border-color);
}
button[part~="alt-text-save-button"] {
display: block;
margin: 0 auto;
margin-top: 1rem;
width: 50%;
font-size: 1.15rem;
text-align: center;
border-radius: 8px;
}
button[part~="delete-button"] {
position: absolute;
top: 0;
right: 50%;
transform: translate(50%, -20px);
border-radius: 9999px;
padding: 0.15rem;
border-color: Highlight;
}
:host(:not([previewable])) button[part~="alt-text-button"] {
display: none;
}
:host(:state(image-error)) button[part~="alt-text-button"] {
display: none;
}
button[part~="alt-text-button"] {
position: absolute;
top: 4px;
left: 14px;
background: rgba(0, 0, 0, 0.8);
color: white;
border: 2px solid white;
border-radius: 4px;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 4px;
}
button[part~="alt-text-button"]:is(:focus-within, :focus, :hover):not(
[aria-disabled="true"],
:disabled
) {
border-color: var(--rhino-button-active-border-color);
background-color: rgba(0, 0, 0, 0.74);
}
:host(:state(invalid-alt-text)) [part~="alt-text-button"] {
color: orange;
border-color: orange;
}
button svg {
flex: 1 1 auto;
height: 1em;
width: 1em;
}
button:is([part~="delete-button"], [part~="dialog-close-button"]) svg {
height: 1.5rem;
width: 1.5rem;
}
button:is(:disabled, [aria-disabled="true"]) {
border-color: var(--rhino-button-border-color);
color: var(--rhino-button-disabled-text-color);
}
button[part~="dialog-close-button"] {
border-color: transparent;
border-radius: 50%;
outline-offset: 0 !important;
padding: 0.1em;
}
button:is(:focus, :focus-within):not([aria-disabled="true"], :disabled) {
outline: 2px solid var(--rhino-button-active-border-color);
outline-offset: 3px;
}
button:is(:hover):not([aria-disabled="true"], :disabled) {
background-color: var(--rhino-button-active-background-color);
}
.file-metadata {
position: absolute;
left: 50%;
top: 2em;
transform: translate(-50%, 0);
display: flex;
flex-wrap: wrap;
align-items: center;
justify-content: center;
text-align: center;
max-width: 90%;
padding: 0.4rem 0.6rem;
outline: 1px solid white;
font-size: 0.8rem;
color: #fff;
background-color: hsla(0 0% 0% / 70%);
border-radius: 3px;
}
.file-name {
display: inline-block;
max-width: 100%;
vertical-align: bottom;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.file-size {
margin-left: 0.2em;
white-space: nowrap;
}
.file-progress-container {
top: 50%;
transform: translate(0px, -50%);
left: 5%;
width: 90%;
position: absolute;
z-index: 1;
pointer-events: none;
}
.file-progress {
--border-radius: 8px;
--progress-value-color: blue;
--progress-background-color: #eee;
height: 10px;
padding: 0;
margin: 0;
opacity: 0.9;
width: 100%;
transition: opacity 200ms ease-out visibility 200ms ease-out;
border-radius: var(--border-radius);
background-color: var(--progress-background-color);
border: 1px solid gray;
}
progress::-webkit-progress-bar {
background-color: var(--progress-background-color);
border-radius: var(--border-radius);
}
progress::-webkit-progress-value {
background-color: var(--progress-value-color);
border-radius: var(--border-radius);
}
progress::-moz-progress-bar {
/* style rules */
border-radius: var(--border-radius);
background-color: var(--progress-value-color);
}
:host([loading-state="error"]) .file-progress-error {
background-color: var(--rhino-error-background-color);
color: var(--rhino-error-text-color);
border: 1px solid var(--rhino-error-border-color);
padding: 0.4em 0.6em;
margin-top: 0.25rem;
display: inline-block;
border-radius: 8px;
}
:host([loading-state="error"]) .file-progress {
background-color: var(--rhino-error-background-color);
border-color: var(--rhino-error-border-color);
}
.file-progress[value="100"] {
opacity: 0;
visibility: hidden;
}
dialog::backdrop {
background: rgba(0, 0, 0, 0.8);
}
dialog[open]::backdrop {
pointer-events: none;
}
dialog {
border: 1px solid gray;
border-radius: 4px;
width: clamp(200px, 75vw, 800px);
}
img {
display: block;
height: auto;
width: 100%;
/* Image is scaled to fit within the container. */
/* Aspect ratio IS maintained */
object-fit: contain;
aspect-ratio: 16 / 9;
background: lightgray;
border: 2px solid gray;
border-radius: 8px;
}
textarea {
width: 100%;
resize: none;
height: 100px;
font-size: 1.25em;
border: 1px solid var(--rhino-border-color);
padding: 8px;
border-radius: 8px;
}
label {
margin-top: 1rem;
display: block;
text-align: start;
}
textarea:focus {
border-color: dodgerblue;
outline: 2px solid var(--rhino-button-active-border-color);
outline-offset: 3px;
}
[part~="dialog-heading"] {
font-size: 1.5rem;
margin: 0;
}
[part~="dialog-heading-wrapper"] {
display: flex;
justify-content: space-between;
align-items: baseline;
margin-bottom: 8px;
}
[part~="alt-text-editor-label"] {
display: flex;
justify-content: space-between;
align-items: baseline;
}
`}toFileSize(){return this.fileSize?fo(this.fileSize):""}updated(e){if(e.has("altTextDialogOpen")){let r=this.shadowRoot?.querySelector("dialog");if(r)try{this.altTextDialogOpen?r.showModal():r.close()}catch{}}return e.has("altText")&&(this.altText.length>=this.altTextMinLength&&this.altText.length<=this.altTextMaxLength?this.deleteCustomState("invalid-alt-text"):this.addCustomState("invalid-alt-text")),super.updated(e)}render(){return T`
<button
class="delete-button"
part="button delete-button"
@pointerdown=${e=>{e.preventDefault(),this.removeFigure()}}
type="button"
>
${this.closeIcon()}
</button>
${Lr(this.altTextEditor,()=>T`
${this.renderAltTextButton()} ${this.renderAltTextDialog()}
`,()=>T``)}
<span
part="file-metadata"
class="file-metadata"
?hidden=${!this.showMetadata||!(this.fileName||this.toFileSize())}
>
<span class="file-name" part="file-name">${this.fileName}</span>
<br />
<span class="file-size" part="file-size">${this.toFileSize()}</span>
</span>
<div class="file-progress-container" part="file-progress-container">
<progress
id="file-progress"
class="file-progress"
part="file-progress"
value=${this.progress||0}
min="0"
max="100"
></progress>
<label
for="file-progress"
class="file-progress-error"
part="file-progress-error"
>
${this.loadingState==="error"?this.fileUploadErrorMessage:null}
</label>
</div>
`}renderAltTextButton(){return T`
<button
part="button alt-text-button"
type="button"
@pointerdown=${e=>{this.altTextDialogOpen=!0,this.setNodeAttributes({altTextDialogOpen:this.altTextDialogOpen})}}
>
${this.altText?T``:this.warningIcon()}
<span part="alt-text-button-label">Alt</span>
</button>
`}renderAltTextDialog(){return T`
<dialog
part="dialog"
@close=${e=>{e.target,e.currentTarget}}
>
<div part="dialog-heading-wrapper">
<h2 part="dialog-heading">Add alt text</h2>
<button
part="button dialog-close-button"
@mousedown=${e=>e.preventDefault()}
@click=${e=>{e.preventDefault(),this.altTextDialogOpen=!1,this.setNodeAttributes({altTextDialogOpen:this.altTextDialogOpen})}}
>
${this.closeIcon()}
</button>
</div>
<img
part="alt-text-image"
src="${this.imgSrc}"
@load=${()=>{this.deleteCustomState("image-error")}}
@error=${()=>{this.addCustomState("image-error")}}
/>
<label part="alt-text-editor-label" for="alt-text-editor">
<span part="alt-text-editor-label-text"> Descriptive alt text </span>
<span part="alt-text-editor-label-counter"
>${this.editorValue?.length||0} / ${this.altTextMaxLength}</span
>
</label>
<textarea
part="alt-text-editor"
id="alt-text-editor"
.value=${this.altText}
@input=${e=>this.editorValue=e.currentTarget.value}
maxlength="${this.altTextMaxLength}"
minlength="${this.altTextMinLength}"
></textarea>
<button
part="button alt-text-save-button"
type="button"
@pointerdown=${e=>{e.currentTarget.ariaDisabled!=="true"&&e.preventDefault()}}
@click=${e=>{if(e.currentTarget.ariaDisabled==="true")return;e.preventDefault();let r=this.shadowRoot?.querySelector("textarea")?.value||"";this.altText=r,this.altTextDialogOpen=!1,this.setNodeAttributes({alt:this.altText,altTextDialogOpen:this.altTextDialogOpen})}}
aria-disabled="${(this.editorValue?.length||0)>this.altTextMaxLength||(this.editorValue?.length||0)<this.altTextMinLength}}"
>
Save
</button>
</dialog>
`}};Br.baseName="rhino-attachment-editor";function go({fileName:n,fileSize:t}){return!n||!t?"":`${n} \xB7 ${fo(Number(t))}`}var yf={exports:{}};(function(n,t){(function(e){n.exports=e()})(function(e){var r=["0","1","2","3","4","5","6","7","8","9","a","b","c","d","e","f"];function i(b,v){var m=b[0],g=b[1],k=b[2],y=b[3];m+=(g&k|~g&y)+v[0]-680876936|0,m=(m<<7|m>>>25)+g|0,y+=(m&g|~m&k)+v[1]-389564586|0,y=(y<<12|y>>>20)+m|0,k+=(y&m|~y&g)+v[2]+606105819|0,k=(k<<17|k>>>15)+y|0,g+=(k&y|~k&m)+v[3]-1044525330|0,g=(g<<22|g>>>10)+k|0,m+=(g&k|~g&y)+v[4]-176418897|0,m=(m<<7|m>>>25)+g|0,y+=(m&g|~m&k)+v[5]+1200080426|0,y=(y<<12|y>>>20)+m|0,k+=(y&m|~y&g)+v[6]-1473231341|0,k=(k<<17|k>>>15)+y|0,g+=(k&y|~k&m)+v[7]-45705983|0,g=(g<<22|g>>>10)+k|0,m+=(g&k|~g&y)+v[8]+1770035416|0,m=(m<<7|m>>>25)+g|0,y+=(m&g|~m&k)+v[9]-1958414417|0,y=(y<<12|y>>>20)+m|0,k+=(y&m|~y&g)+v[10]-42063|0,k=(k<<17|k>>>15)+y|0,g+=(k&y|~k&m)+v[11]-1990404162|0,g=(g<<22|g>>>10)+k|0,m+=(g&k|~g&y)+v[12]+1804603682|0,m=(m<<7|m>>>25)+g|0,y+=(m&g|~m&k)+v[13]-40341101|0,y=(y<<12|y>>>20)+m|0,k+=(y&m|~y&g)+v[14]-1502002290|0,k=(k<<17|k>>>15)+y|0,g+=(k&y|~k&m)+v[15]+1236535329|0,g=(g<<22|g>>>10)+k|0,m+=(g&y|k&~y)+v[1]-165796510|0,m=(m<<5|m>>>27)+g|0,y+=(m&k|g&~k)+v[6]-1069501632|0,y=(y<<9|y>>>23)+m|0,k+=(y&g|m&~g)+v[11]+643717713|0,k=(k<<14|k>>>18)+y|0,g+=(k&m|y&~m)+v[0]-373897302|0,g=(g<<20|g>>>12)+k|0,m+=(g&y|k&~y)+v[5]-701558691|0,m=(m<<5|m>>>27)+g|0,y+=(m&k|g&~k)+v[10]+38016083|0,y=(y<<9|y>>>23)+m|0,k+=(y&g|m&~g)+v[15]-660478335|0,k=(k<<14|k>>>18)+y|0,g+=(k&m|y&~m)+v[4]-405537848|0,g=(g<<20|g>>>12)+k|0,m+=(g&y|k&~y)+v[9]+568446438|0,m=(m<<5|m>>>27)+g|0,y+=(m&k|g&~k)+v[14]-1019803690|0,y=(y<<9|y>>>23)+m|0,k+=(y&g|m&~g)+v[3]-187363961|0,k=(k<<14|k>>>18)+y|0,g+=(k&m|y&~m)+v[8]+1163531501|0,g=(g<<20|g>>>12)+k|0,m+=(g&y|k&~y)+v[13]-1444681467|0,m=(m<<5|m>>>27)+g|0,y+=(m&k|g&~k)+v[2]-51403784|0,y=(y<<9|y>>>23)+m|0,k+=(y&g|m&~g)+v[7]+1735328473|0,k=(k<<14|k>>>18)+y|0,g+=(k&m|y&~m)+v[12]-1926607734|0,g=(g<<20|g>>>12)+k|0,m+=(g^k^y)+v[5]-378558|0,m=(m<<4|m>>>28)+g|0,y+=(m^g^k)+v[8]-2022574463|0,y=(y<<11|y>>>21)+m|0,k+=(y^m^g)+v[11]+1839030562|0,k=(k<<16|k>>>16)+y|0,g+=(k^y^m)+v[14]-35309556|0,g=(g<<23|g>>>9)+k|0,m+=(g^k^y)+v[1]-1530992060|0,m=(m<<4|m>>>28)+g|0,y+=(m^g^k)+v[4]+1272893353|0,y=(y<<11|y>>>21)+m|0,k+=(y^m^g)+v[7]-155497632|0,k=(k<<16|k>>>16)+y|0,g+=(k^y^m)+v[10]-1094730640|0,g=(g<<23|g>>>9)+k|0,m+=(g^k^y)+v[13]+681279174|0,m=(m<<4|m>>>28)+g|0,y+=(m^g^k)+v[0]-358537222|0,y=(y<<11|y>>>21)+m|0,k+=(y^m^g)+v[3]-722521979|0,k=(k<<16|k>>>16)+y|0,g+=(k^y^m)+v[6]+76029189|0,g=(g<<23|g>>>9)+k|0,m+=(g^k^y)+v[9]-640364487|0,m=(m<<4|m>>>28)+g|0,y+=(m^g^k)+v[12]-421815835|0,y=(y<<11|y>>>21)+m|0,k+=(y^m^g)+v[15]+530742520|0,k=(k<<16|k>>>16)+y|0,g+=(k^y^m)+v[2]-995338651|0,g=(g<<23|g>>>9)+k|0,m+=(k^(g|~y))+v[0]-198630844|0,m=(m<<6|m>>>26)+g|0,y+=(g^(m|~k))+v[7]+1126891415|0,y=(y<<10|y>>>22)+m|0,k+=(m^(y|~g))+v[14]-1416354905|0,k=(k<<15|k>>>17)+y|0,g+=(y^(k|~m))+v[5]-57434055|0,g=(g<<21|g>>>11)+k|0,m+=(k^(g|~y))+v[12]+1700485571|0,m=(m<<6|m>>>26)+g|0,y+=(g^(m|~k))+v[3]-1894986606|0,y=(y<<10|y>>>22)+m|0,k+=(m^(y|~g))+v[10]-1051523|0,k=(k<<15|k>>>17)+y|0,g+=(y^(k|~m))+v[1]-2054922799|0,g=(g<<21|g>>>11)+k|0,m+=(k^(g|~y))+v[8]+1873313359|0,m=(m<<6|m>>>26)+g|0,y+=(g^(m|~k))+v[15]-30611744|0,y=(y<<10|y>>>22)+m|0,k+=(m^(y|~g))+v[6]-1560198380|0,k=(k<<15|k>>>17)+y|0,g+=(y^(k|~m))+v[13]+1309151649|0,g=(g<<21|g>>>11)+k|0,m+=(k^(g|~y))+v[4]-145523070|0,m=(m<<6|m>>>26)+g|0,y+=(g^(m|~k))+v[11]-1120210379|0,y=(y<<10|y>>>22)+m|0,k+=(m^(y|~g))+v[2]+718787259|0,k=(k<<15|k>>>17)+y|0,g+=(y^(k|~m))+v[9]-343485551|0,g=(g<<21|g>>>11)+k|0,b[0]=m+b[0]|0,b[1]=g+b[1]|0,b[2]=k+b[2]|0,b[3]=y+b[3]|0}function o(b){var v=[],m;for(m=0;m<64;m+=4)v[m>>2]=b.charCodeAt(m)+(b.charCodeAt(m+1)<<8)+(b.charCodeAt(m+2)<<16)+(b.charCodeAt(m+3)<<24);return v}function s(b){var v=[],m;for(m=0;m<64;m+=4)v[m>>2]=b[m]+(b[m+1]<<8)+(b[m+2]<<16)+(b[m+3]<<24);return v}function a(b){var v=b.length,m=[1732584193,-271733879,-1732584194,271733878],g,k,y,O,A,B;for(g=64;g<=v;g+=64)i(m,o(b.substring(g-64,g)));for(b=b.substring(g-64),k=b.length,y=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g=0;g<k;g+=1)y[g>>2]|=b.charCodeAt(g)<<(g%4<<3);if(y[g>>2]|=128<<(g%4<<3),g>55)for(i(m,y),g=0;g<16;g+=1)y[g]=0;return O=v*8,O=O.toString(16).match(/(.*?)(.{0,8})$/),A=parseInt(O[2],16),B=parseInt(O[1],16)||0,y[14]=A,y[15]=B,i(m,y),m}function l(b){var v=b.length,m=[1732584193,-271733879,-1732584194,271733878],g,k,y,O,A,B;for(g=64;g<=v;g+=64)i(m,s(b.subarray(g-64,g)));for(b=g-64<v?b.subarray(g-64):new Uint8Array(0),k=b.length,y=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],g=0;g<k;g+=1)y[g>>2]|=b[g]<<(g%4<<3);if(y[g>>2]|=128<<(g%4<<3),g>55)for(i(m,y),g=0;g<16;g+=1)y[g]=0;return O=v*8,O=O.toString(16).match(/(.*?)(.{0,8})$/),A=parseInt(O[2],16),B=parseInt(O[1],16)||0,y[14]=A,y[15]=B,i(m,y),m}function c(b){var v="",m;for(m=0;m<4;m+=1)v+=r[b>>m*8+4&15]+r[b>>m*8&15];return v}function d(b){var v;for(v=0;v<b.length;v+=1)b[v]=c(b[v]);return b.join("")}d(a("hello")),typeof ArrayBuffer<"u"&&!ArrayBuffer.prototype.slice&&function(){function b(v,m){return v=v|0||0,v<0?Math.max(v+m,0):Math.min(v,m)}ArrayBuffer.prototype.slice=function(v,m){var g=this.byteLength,k=b(v,g),y=g,O,A,B,K;return m!==e&&(y=b(m,g)),k>y?new ArrayBuffer(0):(O=y-k,A=new ArrayBuffer(O),B=new Uint8Array(A),K=new Uint8Array(this,k,O),B.set(K),A)}}();function u(b){return/[\u0080-\uFFFF]/.test(b)&&(b=unescape(encodeURIComponent(b))),b}function h(b,v){var m=b.length,g=new ArrayBuffer(m),k=new Uint8Array(g),y;for(y=0;y<m;y+=1)k[y]=b.charCodeAt(y);return v?k:g}function f(b){return String.fromCharCode.apply(null,new Uint8Array(b))}function p(b,v,m){var g=new Uint8Array(b.byteLength+v.byteLength);return g.set(new Uint8Array(b)),g.set(new Uint8Array(v),b.byteLength),m?g:g.buffer}function x(b){var v=[],m=b.length,g;for(g=0;g<m-1;g+=2)v.push(parseInt(b.substr(g,2),16));return String.fromCharCode.apply(String,v)}function S(){this.reset()}return S.prototype.append=function(b){return this.appendBinary(u(b)),this},S.prototype.appendBinary=function(b){this._buff+=b,this._length+=b.length;var v=this._buff.length,m;for(m=64;m<=v;m+=64)i(this._hash,o(this._buff.substring(m-64,m)));return this._buff=this._buff.substring(m-64),this},S.prototype.end=function(b){var v=this._buff,m=v.length,g,k=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],y;for(g=0;g<m;g+=1)k[g>>2]|=v.charCodeAt(g)<<(g%4<<3);return this._finish(k,m),y=d(this._hash),b&&(y=x(y)),this.reset(),y},S.prototype.reset=function(){return this._buff="",this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.prototype.getState=function(){return{buff:this._buff,length:this._length,hash:this._hash.slice()}},S.prototype.setState=function(b){return this._buff=b.buff,this._length=b.length,this._hash=b.hash,this},S.prototype.destroy=function(){delete this._hash,delete this._buff,delete this._length},S.prototype._finish=function(b,v){var m=v,g,k,y;if(b[m>>2]|=128<<(m%4<<3),m>55)for(i(this._hash,b),m=0;m<16;m+=1)b[m]=0;g=this._length*8,g=g.toString(16).match(/(.*?)(.{0,8})$/),k=parseInt(g[2],16),y=parseInt(g[1],16)||0,b[14]=k,b[15]=y,i(this._hash,b)},S.hash=function(b,v){return S.hashBinary(u(b),v)},S.hashBinary=function(b,v){var m=a(b),g=d(m);return v?x(g):g},S.ArrayBuffer=function(){this.reset()},S.ArrayBuffer.prototype.append=function(b){var v=p(this._buff.buffer,b,!0),m=v.length,g;for(this._length+=b.byteLength,g=64;g<=m;g+=64)i(this._hash,s(v.subarray(g-64,g)));return this._buff=g-64<m?new Uint8Array(v.buffer.slice(g-64)):new Uint8Array(0),this},S.ArrayBuffer.prototype.end=function(b){var v=this._buff,m=v.length,g=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],k,y;for(k=0;k<m;k+=1)g[k>>2]|=v[k]<<(k%4<<3);return this._finish(g,m),y=d(this._hash),b&&(y=x(y)),this.reset(),y},S.ArrayBuffer.prototype.reset=function(){return this._buff=new Uint8Array(0),this._length=0,this._hash=[1732584193,-271733879,-1732584194,271733878],this},S.ArrayBuffer.prototype.getState=function(){var b=S.prototype.getState.call(this);return b.buff=f(b.buff),b},S.ArrayBuffer.prototype.setState=function(b){return b.buff=h(b.buff,!0),S.prototype.setState.call(this,b)},S.ArrayBuffer.prototype.destroy=S.prototype.destroy,S.ArrayBuffer.prototype._finish=S.prototype._finish,S.ArrayBuffer.hash=function(b,v){var m=l(new Uint8Array(b)),g=d(m);return v?x(g):g},S})})(yf);var c1=yf.exports,d1=File.prototype.slice||File.prototype.mozSlice||File.prototype.webkitSlice,Fl=class n{static create(t,e){new n(t).create(e)}constructor(t){this.file=t,this.chunkSize=2097152,this.chunkCount=Math.ceil(this.file.size/this.chunkSize),this.chunkIndex=0}create(t){this.callback=t,this.md5Buffer=new c1.ArrayBuffer,this.fileReader=new FileReader,this.fileReader.addEventListener("load",e=>this.fileReaderDidLoad(e)),this.fileReader.addEventListener("error",e=>this.fileReaderDidError(e)),this.readNextChunk()}fileReaderDidLoad(t){if(this.md5Buffer.append(t.target.result),!this.readNextChunk()){let e=this.md5Buffer.end(!0),r=btoa(e);this.callback(null,r)}}fileReaderDidError(t){this.callback(`Error reading ${this.file.name}`)}readNextChunk(){if(this.chunkIndex<this.chunkCount||this.chunkIndex==0&&this.chunkCount==0){let t=this.chunkIndex*this.chunkSize,e=Math.min(t+this.chunkSize,this.file.size),r=d1.call(this.file,t,e);return this.fileReader.readAsArrayBuffer(r),this.chunkIndex++,!0}else return!1}};function u1(n){let t=xf(document.head,`meta[name="${n}"]`);if(t)return t.getAttribute("content")}function h1(n,t){typeof n=="string"&&(t=n,n=document);let e=n.querySelectorAll(t);return kf(e)}function xf(n,t){return typeof n=="string"&&(t=n,n=document),n.querySelector(t)}function vf(n,t,e={}){let{disabled:r}=n,{bubbles:i,cancelable:o,detail:s}=e,a=document.createEvent("Event");a.initEvent(t,i||!0,o||!0),a.detail=s||{};try{n.disabled=!1,n.dispatchEvent(a)}finally{n.disabled=r}return a}function kf(n){return Array.isArray(n)?n:Array.from?Array.from(n):[].slice.call(n)}var Vl=class{constructor(t,e,r,i={}){this.file=t,this.attributes={filename:t.name,content_type:t.type||"application/octet-stream",byte_size:t.size,checksum:e},this.xhr=new XMLHttpRequest,this.xhr.open("POST",r,!0),this.xhr.responseType="json",this.xhr.setRequestHeader("Content-Type","application/json"),this.xhr.setRequestHeader("Accept","application/json"),this.xhr.setRequestHeader("X-Requested-With","XMLHttpRequest"),Object.keys(i).forEach(s=>{this.xhr.setRequestHeader(s,i[s])});let o=u1("csrf-token");o!=null&&this.xhr.setRequestHeader("X-CSRF-Token",o),this.xhr.addEventListener("load",s=>this.requestDidLoad(s)),this.xhr.addEventListener("error",s=>this.requestDidError(s))}get status(){return this.xhr.status}get response(){let{responseType:t,response:e}=this.xhr;return t=="json"?e:JSON.parse(e)}create(t){this.callback=t,this.xhr.send(JSON.stringify({blob:this.attributes}))}requestDidLoad(t){if(this.status>=200&&this.status<300){let{response:e}=this,{direct_upload:r}=e;delete e.direct_upload,this.attributes=e,this.directUploadData=r,this.callback(null,this.toJSON())}else this.requestDidError(t)}requestDidError(t){this.callback(`Error creating Blob for "${this.file.name}". Status: ${this.status}`)}toJSON(){let t={};for(let e in this.attributes)t[e]=this.attributes[e];return t}},Ul=class{constructor(t){this.blob=t,this.file=t.file;let{url:e,headers:r}=t.directUploadData;this.xhr=new XMLHttpRequest,this.xhr.open("PUT",e,!0),this.xhr.responseType="text";for(let i in r)this.xhr.setRequestHeader(i,r[i]);this.xhr.addEventListener("load",i=>this.requestDidLoad(i)),this.xhr.addEventListener("error",i=>this.requestDidError(i))}create(t){this.callback=t,this.xhr.send(this.file.slice())}requestDidLoad(t){let{status:e,response:r}=this.xhr;e>=200&&e<300?this.callback(null,r):this.requestDidError(t)}requestDidError(t){this.callback(`Error storing "${this.file.name}". Status: ${this.xhr.status}`)}},f1=0,zr=class{constructor(t,e,r,i={}){this.id=++f1,this.file=t,this.url=e,this.delegate=r,this.customHeaders=i}create(t){Fl.create(this.file,(e,r)=>{if(e){t(e);return}let i=new Vl(this.file,r,this.url,this.customHeaders);gf(this.delegate,"directUploadWillCreateBlobWithXHR",i.xhr),i.create(o=>{if(o)t(o);else{let s=new Ul(i);gf(this.delegate,"directUploadWillStoreFileWithXHR",s.xhr),s.create(a=>{a?t(a):t(null,i.toJSON())})}})})}};function gf(n,t,...e){if(n&&typeof n[t]=="function")return n[t](...e)}var jl=class{constructor(t,e){this.input=t,this.file=e,this.directUpload=new zr(this.file,this.url,this),this.dispatch("initialize")}start(t){let e=document.createElement("input");e.type="hidden",e.name=this.input.name,this.input.insertAdjacentElement("beforebegin",e),this.dispatch("start"),this.directUpload.create((r,i)=>{r?(e.parentNode.removeChild(e),this.dispatchError(r)):e.value=i.signed_id,this.dispatch("end"),t(r)})}uploadRequestDidProgress(t){let e=t.loaded/t.total*100;e&&this.dispatch("progress",{progress:e})}get url(){return this.input.getAttribute("data-direct-upload-url")}dispatch(t,e={}){return e.file=this.file,e.id=this.directUpload.id,vf(this.input,`direct-upload:${t}`,{detail:e})}dispatchError(t){this.dispatch("error",{error:t}).defaultPrevented||alert(t)}directUploadWillCreateBlobWithXHR(t){this.dispatch("before-blob-request",{xhr:t})}directUploadWillStoreFileWithXHR(t){this.dispatch("before-storage-request",{xhr:t}),t.upload.addEventListener("progress",e=>this.uploadRequestDidProgress(e))}},p1="input[type=file][data-direct-upload-url]:not([disabled])",Kl=class{constructor(t){this.form=t,this.inputs=h1(t,p1).filter(e=>e.files.length)}start(t){let e=this.createDirectUploadControllers(),r=()=>{let i=e.shift();i?i.start(o=>{o?(t(o),this.dispatch("end")):r()}):(t(),this.dispatch("end"))};this.dispatch("start"),r()}createDirectUploadControllers(){let t=[];return this.inputs.forEach(e=>{kf(e.files).forEach(r=>{let i=new jl(e,r);t.push(i)})}),t}dispatch(t,e={}){return vf(this.form,`direct-uploads:${t}`,{detail:e})}},Hl="data-direct-uploads-processing",Wl=new WeakMap,bf=!1;function m1(){bf||(bf=!0,document.addEventListener("click",g1,!0),document.addEventListener("submit",b1,!0),document.addEventListener("ajax:before",y1))}function g1(n){let t=n.target.closest("button, input");t&&t.type==="submit"&&t.form&&Wl.set(t.form,t)}function b1(n){Sf(n)}function y1(n){n.target.tagName=="FORM"&&Sf(n)}function Sf(n){let t=n.target;if(t.hasAttribute(Hl)){n.preventDefault();return}let e=new Kl(t),{inputs:r}=e;r.length&&(n.preventDefault(),t.setAttribute(Hl,""),r.forEach(v1),e.start(i=>{t.removeAttribute(Hl),i?r.forEach(k1):x1(t)}))}function x1(n){let t=Wl.get(n)||xf(n,"input[type=submit], button[type=submit]");if(t){let{disabled:e}=t;t.disabled=!1,t.focus(),t.click(),t.disabled=e}else t=document.createElement("input"),t.type="submit",t.style.display="none",n.appendChild(t),t.click(),n.removeChild(t);Wl.delete(n)}function v1(n){n.disabled=!0}function k1(n){n.disabled=!1}function S1(){window.ActiveStorage&&m1()}setTimeout(S1,1);var V=class extends Event{constructor(t,e){e==null&&(e={}),e.bubbles==null&&(e.bubbles=!0),e.composed==null&&(e.composed=!0),e.cancelable==null&&(e.cancelable=!0),super(t,e)}};var xo=class xo extends V{constructor(e,r){super(xo.eventName,r);this.attachmentUpload=e;this.attachmentUpload=e}};xo.eventName="rhino-direct-upload:start";var Hr=xo,vo=class vo extends V{constructor(e,r){super(vo.eventName,r);this.attachmentUpload=e;this.attachmentUpload=e}};vo.eventName="rhino-direct-upload:progress";var ql=vo,ko=class ko extends V{constructor(e,r){super(ko.eventName,r);this.attachmentUpload=e;this.attachmentUpload=e}};ko.eventName="rhino-direct-upload:error";var Jl=ko,So=class So extends V{constructor(e,r){super(So.eventName,r);this.attachmentUpload=e;this.attachmentUpload=e}};So.eventName="rhino-direct-upload:succeed";var bo=So,wo=class wo extends V{constructor(e,r){super(wo.eventName,r);this.attachmentUpload=e;this.attachmentUpload=e}};wo.eventName="rhino-direct-upload:complete";var mn=wo,yo=class{constructor(t,e){this.progress=0;if(this.attachment=t,this.element=e,this.attachment.file==null)throw"No file found for direct upload";this.directUpload=new zr(this.attachment.file,this.directUploadUrl,this)}start(){this.directUpload.create(this.directUploadDidComplete.bind(this)),this.element.dispatchEvent(new Hr(this))}directUploadWillStoreFileWithXHR(t){t.upload.addEventListener("progress",r=>{let i=Math.min(r.loaded/r.total*100,90);this.progress=i,this.setUploadProgress(),this.element.dispatchEvent(new ql(this))})}handleError(t){if(this.progress=0,this.attachment.content==null&&this.attachment.setNodeMarkup({progress:0,loadingState:Jt.error}),this.element.dispatchEvent(new Jl(this)),this.element.dispatchEvent(new mn(this)),t)throw Error(`Direct upload failed: ${t}`)}directUploadDidComplete(t,e){if(t){this.handleError(t);return}if(e.attachable_sgid){let r=this.createBlobUrl(e.signed_id,e.filename);this.attachment.directUpload=this,this.attachment.setAttributes({sgid:e.attachable_sgid,url:r})}}setUploadProgress(){if(this.progress>=100){this.progress=100,this.attachment.setUploadProgress(100);return}this.attachment.setUploadProgress(this.progress)}createBlobUrl(t,e){return this.blobUrlTemplate==null?"":this.blobUrlTemplate.replace(":signed_id",t).replace(":filename",encodeURIComponent(e))}get directUploadUrl(){if(this.element.dataset.directUploadUrl==null)throw Error(`No "data-direct-upload-url" attribute is set on ${this.element}`);return this.element.dataset.directUploadUrl}get blobUrlTemplate(){return this.element.dataset.blobUrlTemplate}};var Le=class n{static get previewableRegex(){return/^image(\/(gif|png|jpe?g)|$)/}static isPreviewable(t){return(this||n).previewableRegex.test(t)}constructor(t,e){this.editorView=e,this.attributes={attachmentId:Ll(),content:null,imageId:Ll(),sgid:null,url:null,...t},this.attributes.previewable=this.isPreviewable}setUploadProgress(t){this.content==null&&this.setNodeMarkup({progress:t,loadingState:t>=100?Jt.success:Jt.loading})}setAttributes(t){if(this.attributes=Object.assign(this.attributes,t),t.content){this.setNodeMarkup({sgid:this.attributes.sgid,content:this.attributes.content,previewable:this.isPreviewable}),this.handleSuccess();return}if(t.url){if(this.isPreviewable){let e=new Image;e.setAttribute("src",t.url),e.onload=()=>{this.attributes.width=e.naturalWidth,this.attributes.height=e.naturalHeight,this.setNodeMarkup({sgid:this.attributes.sgid,url:this.attributes.url,src:this.attributes.url,href:this.attributes.url+"?content-disposition=attachment",width:this.attributes.width,height:this.attributes.height,contentType:this.contentType,previewable:this.isPreviewable}),e.remove(),this.handleSuccess()};return}this.setNodeMarkup({sgid:this.attributes.sgid,url:this.attributes.url,contentType:this.contentType,previewable:this.isPreviewable}),this.handleSuccess()}}handleSuccess(){this.setUploadProgress(100);let t=this.directUpload;t&&(t.element.dispatchEvent(new bo(t)),t.element.dispatchEvent(new mn(t)))}setNodeMarkup(t){let e=this.editorView;e?.state.doc.descendants((r,i)=>{r.attrs.attachmentId===this.attachmentId&&e.dispatch(e.state.tr.setNodeMarkup(i,void 0,{...r.attrs,...t}))})}get attachmentId(){return this.attributes.attachmentId}get imageId(){return this.attributes.imageId}get src(){return this.attributes.src}set src(t){this.attributes.src=t}get sgid(){return this.attributes.sgid}get file(){return this.attributes.file}get contentType(){return this.attributes.contentType||this.file?.type}get fileName(){return this.attributes.fileName||this.file?.name}get fileSize(){return this.attributes.fileSize||this.file?.size}get content(){return this.attributes.content}set content(t){this.attributes.content=t}get height(){return this.attributes.height}get width(){return this.attributes.width}get isPreviewable(){let t=this.constructor.isPreviewable,e=this.contentType;return t(e||"")}get caption(){let t=go({fileName:this.attributes.fileName,fileSize:this.attributes.fileSize});return this.isPreviewable?t:this.attributes.caption||t||""}};function wf(n,t,e){let r=n.steps.length-1;if(r<t)return;let i=n.steps[r];if(!(i instanceof it||i instanceof W))return;let o=n.mapping.maps[r],s=0;o.forEach((a,l,c,d)=>{s===0&&(s=d)}),n.setSelection(P.near(n.doc.resolve(s),e))}function J(n,t){let e=n.closest("action-text-attachment")?.getAttribute(t);if(e)return e;let r=n.closest("[data-trix-attachment]")?.getAttribute("data-trix-attachment");return r?JSON.parse(r)[t]:null}var w1=(n,t)=>Array.isArray(n)&&n.indexOf(t.type)>-1||t.type===n;var E1=(n,t)=>{for(let e=n.depth;e>0;e--){let r=n.node(e);if(t(r))return{pos:e>0?n.before(e):0,start:n.start(e),depth:e,node:r}}};var qn=(n,t)=>E1(n,e=>w1(t,e));var A1=(n,t=!0)=>{if(!n)throw new Error('Invalid "node" parameter');let e=[];return n.descendants((r,i)=>{if(e.push({node:r,pos:i}),!t)return!1}),e},M1=(n,t,e=!0)=>{if(n){if(!t)throw new Error('Invalid "predicate" parameter')}else throw new Error('Invalid "node" parameter');return A1(n,e).filter(r=>t(r.node))};var Gl=(n,t,e=!0)=>M1(n,r=>r.type===t,e);var Eo=class Eo extends V{constructor(e,r={}){super(Eo.eventName,r);this.attachment=e;this.attachment=e}};Eo.eventName="rhino-attachment-remove";var Jn=Eo;var Fr=class extends Me{constructor(t){if(super(t),this.it=U,t.type!==An.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(t){if(t===U||t==null)return this._t=void 0,this.it=t;if(t===Ut)return t;if(typeof t!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(t===this.it)return this._t;this.it=t;let e=[t];return e.raw=e,this._t={_$litType$:this.constructor.resultType,strings:e,values:[]}}};Fr.directiveName="unsafeHTML",Fr.resultType=1;var Ef=Ge(Fr);var Gn=n=>n??U;var Vr=["previewable-attachment-figure","attachment-figure"];function Cf(n){return J(n,"content-type")||JSON.parse(n.getAttribute("data-trix-attachment")||"{}").contentType||"application/octet-stream"}var Yl=(n,t)=>{if(n instanceof HTMLElement){if(Cf(n)==="application/octet-stream")return!1;let r=n.closest("action-text-attachment");if(r){let o=r.getAttribute("previewable")==="true";return r.getAttribute("sgid")?o===t:!1}if(Yn(J(n,"previewable"),J(n,"contentType"))===t)return!0}return!1};function T1(n,t,e,r){let i=!1;if(Vr.includes(n.type.name)===!1)return i;let o=document.createElement("div");o.appendChild(_t.fromSchema(e.schema).serializeNode(n));let s=o.querySelector("figcaption");if(s==null)return i;let a=s.innerHTML;return n.attrs.caption!==a&&(t.setNodeMarkup(r,void 0,{...n.attrs,caption:a}),i=!0),i}function Yn(n,t){return!!(n||Le.isPreviewable(t||""))}function Af(n){return n?"attachment--"+n.match(/\.(\w+)$/)?.[1].toLowerCase():""}function Mf(n,t){return t?"attachment--preview":n?"attachment--content":"attachment--file"}var Ao=H.create({name:"attachment-figure",group:"block attachmentFigure",content:"inline*",selectable:!0,draggable:!0,isolating:!0,defining:!0,addProseMirrorPlugins(){return[new R({key:new L("rhino-attachment-fixer"),appendTransaction(n,t,e){let r=e.tr,i=!1;if(e.doc.descendants((o,s,a)=>{[T1(o,r,e,s)].some(d=>d===!0)&&(i=!0)}),i)return r}}),new R({key:new L("rhino-prevent-unintended-figcaption-behavior"),props:{handlePaste:(n,t)=>{let e=n.state.selection.$anchor.parent.type.name,{clipboardData:r}=t;if(!r)return!1;if(Vr.includes(e)){t.preventDefault();let i=n.state.tr,o=r.getData("text/plain");return i.insertText(o),n.dispatch(i),!0}return!1},handleKeyDown:(n,t)=>{if(["Backspace","Enter"].includes(t.key)){let e=n.state.selection.$head.parent.type.name,r=n.state.selection.$head.parent.textContent;if(n.state.selection.to!==n.state.selection.from)return!1;if(Vr.includes(e)&&r==="")return t.preventDefault(),!0}return!1}}}),new R({key:new L("rhino-attachment-remove-event"),view(){let n=new Map;return{update(t,e){[t.state.schema.nodes["previewable-attachment-figure"],t.state.schema.nodes["attachment-figure"]].forEach(i=>{let o=Gl(e.doc,i);Gl(t.state.doc,i).forEach(s=>{let a=s.node.attrs,l=a.sgid,c=a.attachmentId;l&&n.set(l,s),c&&n.set(c,s)}),o.forEach(s=>{let a=s.node.attrs,{sgid:l,attachmentId:c}=a;if(l&&n.has(l)||c&&n.has(c))return;let d=new Le(a,t);t.dom.dispatchEvent(new Jn(d))}),n.clear()})}}}})]},addOptions(){return{HTMLAttributes:{class:"attachment"},fileUploadErrorMessage:Ir,captionPlaceholder:zl,previewable:!1,altTextEditor:!1,shouldStopEvent:n=>!!n.composedPath().find(r=>r?.tagName?.toLowerCase()==="rhino-attachment-editor")}},parseHTML(){return[{tag:"figure[data-trix-attachment]",getAttrs:n=>Yl(n,this.options.previewable)?null:!1},{tag:"action-text-attachment > figure.attachment",contentElement:"figcaption",getAttrs:n=>Yl(n,this.options.previewable)?null:!1},{tag:"action-text-attachment",getAttrs:n=>Yl(n,this.options.previewable)?null:!1}]},renderHTML({node:n}){let{content:t,contentType:e,sgid:r,fileName:i,fileSize:o,caption:s,url:a,previewable:l,src:c,width:d,height:u,alt:h}=n.attrs,f={caption:s,contentType:e,content:t,filename:i,filesize:o,height:u,width:d,sgid:r,url:a,src:c,alt:h},p=["figure",D(this.options.HTMLAttributes,{class:this.options.HTMLAttributes.class+" "+Mf(t,Yn(l,e))+" "+Af(i),"data-trix-content-type":e,"data-trix-attachment":JSON.stringify(f),"data-trix-attributes":JSON.stringify({caption:s,...Yn(l,e)?{presentation:"gallery"}:{}})})],x=["figcaption",D({},{class:"attachment__caption attachment__caption--edited"}),0],S=["img",D({},{src:a||c,contenteditable:!1,width:d,height:u,alt:h})];return!t&&Yn(l,e)?[...p,S,x]:[...p,x]},addAttributes(){return{attachmentId:{default:null},altTextDialogOpen:{default:!1},caption:{default:"",parseHTML:n=>n.querySelector("figcaption")?.innerHTML||J(n,"caption")},progress:{default:0,parseHTML:n=>J(n,"sgid")||J(n,"content")||n.closest("action-text-attachment")?.innerHTML?100:0},loadingState:{default:Jt.notStarted,parseHTML:n=>J(n,"sgid")?Jt.success:Jt.notStarted},alt:{default:"",parseHTML:n=>J(n,"alt")||n.querySelector("img")?.getAttribute("alt")||""},sgid:{default:"",parseHTML:n=>J(n,"sgid")},src:{default:"",parseHTML:n=>J(n,"src")},height:{default:"",parseHTML:n=>J(n,"height")},width:{default:"",parseHTML:n=>J(n,"width")},contentType:{default:"",parseHTML:n=>Cf(n)},fileName:{default:"",parseHTML:n=>J(n,"filename")},fileSize:{default:"",parseHTML:n=>J(n,"filesize")},content:{default:"",parseHTML:n=>{let t=n.closest("action-text-attachment"),e="";if(t){let o=new DOMParser().parseFromString(t.innerHTML,"text/html").body.firstElementChild;o&&(o.tagName.toLowerCase()!=="figure"||!o.classList.contains("attachment"))&&(e=t.innerHTML)}return e||J(n,"content")}},url:{default:"",parseHTML:n=>J(n,"url")},previewable:{default:!1,parseHTML:n=>{let{previewable:t}=JSON.parse(n.getAttribute("data-trix-attachment")||"{}");return t==null&&(t=J(n,"previewable")),t}}}},addNodeView(){return({node:n,getPos:t,editor:e})=>{let{content:r,contentType:i,sgid:o,fileName:s,progress:a,fileSize:l,url:c,src:d,width:u,height:h,caption:f,previewable:p,loadingState:x,alt:S,altTextDialogOpen:b}=n.attrs,v=JSON.stringify({contentType:i,content:r,filename:s,filesize:l,alt:S,height:h,width:u,sgid:o,url:c,caption:f}),m=Yn(p,i),g=JSON.stringify({...m?{presentation:"gallery"}:{},caption:f}),k=`
${this.options.HTMLAttributes.class}
${Mf(r,Yn(p,i))}
${Af(s)}
`;function y(ut){let Ct=ut.currentTarget,Ae=Ct.querySelector("figcaption"),Ue=Ct.querySelector("rhino-attachment-editor"),Pc=ut.composedPath();if(!(Ae&&Pc.includes(Ae))&&!(Ue&&Pc.includes(Ue))&&typeof t=="function"){let{view:ni}=e,{tr:Rc}=ni.state,Dc=ni.state.doc.nodeAt(t()+1);Dc?.nodeSize,Rc.setSelection(_.create(ni.state.doc,t()+1+(Dc?.nodeSize||0))),ni.dispatch(Rc)}}let O;m&&(c||d)&&(O=c||d);let A=!1,B=null,K=ut=>{B=setTimeout(()=>{A=!0},20)},kt=ut=>{A=!1,B&&clearTimeout(B)},mt=ut=>{if(A&&typeof t=="function"){let{view:Ct}=e;Ct.dispatch(Ct.state.tr.setSelection(N.create(Ct.state.doc,t())))}};function St(ut){if(typeof t=="function"){let{view:Ct}=e,{tr:Ae}=Ct.state,Ue=t();Ae.setNodeMarkup(Ue,null,{...n.attrs,...ut}),Ct.dispatch(Ae)}}function X(){if(typeof t=="function"){let{view:Ct}=e,{tr:Ae}=Ct.state,Ue=t();Ae.delete(Ue,Ue+1),Ct.dispatch(Ae)}let ut=this.closest(".attachment");ut&&ut.remove()}let Rt=T`
<figure
class=${k}
attachment-type=${this.name}
sgid=${Gn(o||void 0)}
data-trix-content-type=${i}
data-trix-attachment=${v}
data-trix-attributes=${g}
@click=${y}
@mousedown=${K}
@mouseup=${kt}
@mousemove=${mt}
>
<rhino-attachment-editor
file-name=${s||""}
file-size=${String(l||0)}
loading-state=${x||Jt.notStarted}
img-src=${Gn(O)}
progress=${String(a||(o||r||!l?100:a))}
contenteditable="false"
?previewable=${m}
?show-metadata=${m}
.fileUploadErrorMessage=${this.options.fileUploadErrorMessage}
.removeFigure=${X}
.setNodeAttributes=${St}
.altTextDialogOpen=${b}
.altTextEditor=${!!this.options.altTextEditor}
alt-text=${S}
>
</rhino-attachment-editor>
${Lr(r,()=>T`${Ef(r)}`,()=>T``)}
${Lr(m&&!r,()=>T` <img
class=${x===Jt.error?"rhino-upload-error":""}
width=${String(u)}
height=${String(h)}
src=${Gn(O)}
alt=${S}
contenteditable="false"
/>`,()=>T``)}
<figcaption
style="${r?"display: none;":""}"
class=${`attachment__caption ${f?"attachment__caption--edited":"is-empty"}`}
data-placeholder=${this.options.captionPlaceholder}
data-default-caption=${go({fileName:s,fileSize:l})}
></figcaption>
</figure>
`,st=document.createElement("div");ci(Rt,st);let Q=st.firstElementChild,dt=Q?.querySelector("figcaption"),Vt=!1,Fs=this.options.shouldStopEvent;return{dom:Q,contentDOM:dt,stopEvent(ut){return Fs(ut)},update(ut){if(ut.type.name!=="attachment")return!1;if(!Vt&&ut.attrs.url){Vt=!0;try{URL.revokeObjectURL(ut.attrs.src)}catch{}}return!1}}}},addCommands(){return{setAttachmentAtCoords:(n,t)=>({view:e,state:r,tr:i,dispatch:o})=>{let s=e.posAtCoords(t),a=r.doc.resolve(s?.pos||0);return Tf(n,a,{state:r,tr:i,dispatch:o})},setAttachment:n=>({state:t,tr:e,dispatch:r})=>{let i=t.doc.resolve(t.selection.anchor);return Tf(n,i,{state:t,tr:e,dispatch:r})}}}}),_f=Ao.extend({name:"previewable-attachment-figure",group:"block previewableAttachmentFigure",addOptions(){return{...Ao.options,previewable:!0}},addProseMirrorPlugins(){return[]}});function Tf(n,t,{state:e,tr:r,dispatch:i}){let{schema:o}=e,s=0,a=r.doc.content.size;function l(g,k=s,y=a){return g<k?k:g>y?y:g}let c=o.nodes["attachment-gallery"]==null,d=e.doc.resolve(t.pos),u=qn(d,o.nodes.paragraph),h=qn(e.doc.resolve(t.pos),o.nodes["attachment-gallery"]),f=null;if(u){let g=t.parent.textContent==="",k=e.doc.resolve(l(u.pos-1));g&&k.parent.type.name==="attachment-gallery"&&(f=l(u.pos-1))}let p=h||f,x=Array.isArray(n)?n:[].concat(n),S=!0,b=[],v=[];x.forEach(g=>{let k=g.isPreviewable?"previewable-attachment-figure":"attachment-figure",y=o.nodes[k].create(g,g.caption?[o.text(g.caption)]:[]);if(c){b.push(y);return}if(!g.isPreviewable){S=!1,v.length>=1&&(b=b.concat(o.nodes["attachment-gallery"].create({},v)),v=[]),b.push(y);return}v.push(y)});let m=0;if(h?m=h.start+h.node.nodeSize-2:f!=null&&(m=f),m=l(m),c)return b=b.flatMap(g=>[g]),r.insert(m,b.concat([o.nodes.paragraph.create()])),i&&i(r),!0;if(p)S?r.insert(m,v):(!c&&v.length>=1&&(b=b.concat(o.nodes["attachment-gallery"].create({},v))),r.insert(m+1,b));else{let g=e.selection;!c&&v.length>=1&&(b=b.concat(o.nodes["attachment-gallery"].create({},v)));let k=g.from,y=e.doc.resolve(k-1),O=y.parent;if(O&&O.type.name==="doc")k-=1;else{let A=qn(y,o.nodes.paragraph);A&&A.node.textContent===""&&(k-=1)}r.replaceWith(k,g.to,[...b,o.nodes.paragraph.create()]),wf(r,r.steps.length-1,-1)}return i&&i(r),!0}var Of=H.create({name:"attachment-image",selectable:!1,draggable:!1,group:"block",addOptions(){return{HTMLAttributes:{}}},addAttributes(){return{src:{default:"",parseHTML:n=>J(n,"url")},height:{default:"",parseHTML:n=>J(n,"height")},width:{default:"",parseHTML:n=>J(n,"width")},attachmentId:{default:null}}},parseHTML(){return[{tag:"figure[data-trix-attachment] img[src]"}]},renderHTML({HTMLAttributes:n}){return["img",D(this.options.HTMLAttributes,n)]}});function C1(n,t,e,r){let i=!1;return n.type.name!="attachment-gallery"||n.nodeSize===2&&(t.replaceWith(r,r+n.nodeSize,e.schema.node("paragraph",null,[])),i=!0),i}var Nf=H.create({name:"attachment-gallery",group:"block",draggable:!1,selectable:!1,content:"(paragraph | previewableAttachmentFigure)*",parseHTML(){return[{tag:"div.attachment-gallery"}]},renderHTML(){return["div",D({},{class:"attachment-gallery"}),0]},addProseMirrorPlugins(){return[new R({props:{handleDOMEvents:{keydown:(n,t)=>{if(t.key==="Enter"){let e=n.state.selection.$head.parent.type.name;if(e==="attachment-gallery")return t.preventDefault(),Vn(Fn)(n.state,n.dispatch),!0;if(Vr.includes(e)){t.preventDefault(),Vn(Fn)(n.state,n.dispatch);let r=qn(n.state.selection.$anchor,n.state.schema.nodes["attachment-gallery"]);if(r){let i=n.state.tr;i.insert(r.pos+r.node.nodeSize,n.state.schema.nodes.paragraph.create()),Tl(i,i.steps.length-1,-1),n.dispatch(i)}return!0}}return!1}}},appendTransaction:(n,t,e)=>{let r=e.tr,i=!1;if(e.doc.descendants((o,s,a)=>{[C1(o,r,e,s)].some(d=>d===!0)&&(i=!0)}),i)return r}})]}});var Pf=H.create({name:"attachment-figcaption",group:"block figcaption",content:"inline*",selectable:!1,draggable:!1,defining:!0,isolating:!0,addOptions(){return{HTMLAttributes:{class:"attachment__caption attachment--edited"}}},parseHTML(){return[{tag:"figure.attachment figcaption"}]},renderHTML({HTMLAttributes:n}){return["figcaption",D(this.options.HTMLAttributes,n),0]}});var Rf=co.extend({name:"rhino-strike",renderHTML({HTMLAttributes:n}){return["del",D(this.options.HTMLAttributes,n),0]}});var Df=F.create({name:"placeholder",addOptions(){return{emptyEditorClass:"is-editor-empty",emptyNodeClass:"is-empty",placeholder:"Write something \u2026",showOnlyWhenEditable:!0,showOnlyCurrent:!0,includeChildren:!1}},addProseMirrorPlugins(){return[new R({key:new L("placeholder"),props:{decorations:({doc:n,selection:t})=>{let e=this.editor.isEditable||!this.options.showOnlyWhenEditable,{anchor:r}=t,i=[];if(!e)return null;let o=this.editor.isEmpty;return n.descendants((s,a)=>{let l=r>=a&&r<=a+s.nodeSize,c=!s.isLeaf&&Dr(s);if((l||!this.options.showOnlyCurrent)&&c){let d=[this.options.emptyNodeClass];o&&d.push(this.options.emptyEditorClass);let u=ot.node(a,a+s.nodeSize,{class:d.join(" "),"data-placeholder":typeof this.options.placeholder=="function"?this.options.placeholder({editor:this.editor,node:s,pos:a,hasAnchor:l}):this.options.placeholder});i.push(u)}return this.options.includeChildren}),q.create(n,i)}}})]}});var $f=F.create({name:"focus",addOptions(){return{className:"has-focus",mode:"all"}},addProseMirrorPlugins(){return[new R({key:new L("focus"),props:{decorations:({doc:n,selection:t})=>{let{isEditable:e,isFocused:r}=this.editor,{anchor:i}=t,o=[];if(!e||!r)return q.create(n,[]);let s=0;this.options.mode==="deepest"&&n.descendants((l,c)=>{if(l.isText)return;if(!(i>=c&&i<=c+l.nodeSize-1))return!1;s+=1});let a=0;return n.descendants((l,c)=>{if(l.isText||!(i>=c&&i<=c+l.nodeSize-1))return!1;if(a+=1,this.options.mode==="deepest"&&s-a>0||this.options.mode==="shallowest"&&a>1)return this.options.mode==="deepest";o.push(ot.node(c,c+l.nodeSize,{class:this.options.className}))}),q.create(n,o)}}})]}});var _1="aaa1rp3bb0ott3vie4c1le2ogado5udhabi7c0ademy5centure6ountant0s9o1tor4d0s1ult4e0g1ro2tna4f0l1rica5g0akhan5ency5i0g1rbus3force5tel5kdn3l0ibaba4pay4lfinanz6state5y2sace3tom5m0azon4ericanexpress7family11x2fam3ica3sterdam8nalytics7droid5quan4z2o0l2partments8p0le4q0uarelle8r0ab1mco4chi3my2pa2t0e3s0da2ia2sociates9t0hleta5torney7u0ction5di0ble3o3spost5thor3o0s4vianca6w0s2x0a2z0ure5ba0by2idu3namex3narepublic11d1k2r0celona5laycard4s5efoot5gains6seball5ketball8uhaus5yern5b0c1t1va3cg1n2d1e0ats2uty4er2ntley5rlin4st0buy5t2f1g1h0arti5i0ble3d1ke2ng0o3o1z2j1lack0friday9ockbuster8g1omberg7ue3m0s1w2n0pparibas9o0ats3ehringer8fa2m1nd2o0k0ing5sch2tik2on4t1utique6x2r0adesco6idgestone9oadway5ker3ther5ussels7s1t1uild0ers6siness6y1zz3v1w1y1z0h3ca0b1fe2l0l1vinklein9m0era3p2non3petown5ital0one8r0avan4ds2e0er0s4s2sa1e1h1ino4t0ering5holic7ba1n1re3c1d1enter4o1rn3f0a1d2g1h0anel2nel4rity4se2t2eap3intai5ristmas6ome4urch5i0priani6rcle4sco3tadel4i0c2y3k1l0aims4eaning6ick2nic1que6othing5ud3ub0med6m1n1o0ach3des3ffee4llege4ogne5m0cast4mbank4unity6pany2re3uter5sec4ndos3struction8ulting7tact3ractors9oking4l1p2rsica5untry4pon0s4rses6pa2r0edit0card4union9icket5own3s1uise0s6u0isinella9v1w1x1y0mru3ou3z2dabur3d1nce3ta1e1ing3sun4y2clk3ds2e0al0er2s3gree4livery5l1oitte5ta3mocrat6ntal2ist5si0gn4v2hl2iamonds6et2gital5rect0ory7scount3ver5h2y2j1k1m1np2o0cs1tor4g1mains5t1wnload7rive4tv2ubai3nlop4pont4rban5vag2r2z2earth3t2c0o2deka3u0cation8e1g1mail3erck5nergy4gineer0ing9terprises10pson4quipment8r0icsson6ni3s0q1tate5t1u0rovision8s2vents5xchange6pert3osed4ress5traspace10fage2il1rwinds6th3mily4n0s2rm0ers5shion4t3edex3edback6rrari3ero6i0delity5o2lm2nal1nce1ial7re0stone6mdale6sh0ing5t0ness6j1k1lickr3ghts4r2orist4wers5y2m1o0o0d1tball6rd1ex2sale4um3undation8x2r0ee1senius7l1ogans4ntier7tr2ujitsu5n0d2rniture7tbol5yi3ga0l0lery3o1up4me0s3p1rden4y2b0iz3d0n2e0a1nt0ing5orge5f1g0ee3h1i0ft0s3ves2ing5l0ass3e1obal2o4m0ail3bh2o1x2n1odaddy5ld0point6f2o0dyear5g0le4p1t1v2p1q1r0ainger5phics5tis4een3ipe3ocery4up4s1t1u0ardian6cci3ge2ide2tars5ru3w1y2hair2mburg5ngout5us3bo2dfc0bank7ealth0care8lp1sinki6re1mes5iphop4samitsu7tachi5v2k0t2m1n1ockey4ldings5iday5medepot5goods5s0ense7nda3rse3spital5t0ing5t0els3mail5use3w2r1sbc3t1u0ghes5yatt3undai7ibm2cbc2e1u2d1e0ee3fm2kano4l1m0amat4db2mo0bilien9n0c1dustries8finiti5o2g1k1stitute6urance4e4t0ernational10uit4vestments10o1piranga7q1r0ish4s0maili5t0anbul7t0au2v3jaguar4va3cb2e0ep2tzt3welry6io2ll2m0p2nj2o0bs1urg4t1y2p0morgan6rs3uegos4niper7kaufen5ddi3e0rryhotels6logistics9properties14fh2g1h1i0a1ds2m1ndle4tchen5wi3m1n1oeln3matsu5sher5p0mg2n2r0d1ed3uokgroup8w1y0oto4z2la0caixa5mborghini8er3ncaster6d0rover6xess5salle5t0ino3robe5w0yer5b1c1ds2ease3clerc5frak4gal2o2xus4gbt3i0dl2fe0insurance9style7ghting6ke2lly3mited4o2ncoln4k2psy3ve1ing5k1lc1p2oan0s3cker3us3l1ndon4tte1o3ve3pl0financial11r1s1t0d0a3u0ndbeck6xe1ury5v1y2ma0drid4if1son4keup4n0agement7go3p1rket0ing3s4riott5shalls7ttel5ba2c0kinsey7d1e0d0ia3et2lbourne7me1orial6n0u2rckmsd7g1h1iami3crosoft7l1ni1t2t0subishi9k1l0b1s2m0a2n1o0bi0le4da2e1i1m1nash3ey2ster5rmon3tgage6scow4to0rcycles9v0ie4p1q1r1s0d2t0n1r2u0seum3ic4v1w1x1y1z2na0b1goya4me2tura4vy3ba2c1e0c1t0bank4flix4work5ustar5w0s2xt0direct7us4f0l2g0o2hk2i0co2ke1on3nja3ssan1y5l1o0kia3rton4w0ruz3tv4p1r0a1w2tt2u1yc2z2obi1server7ffice5kinawa6layan0group9dnavy5lo3m0ega4ne1g1l0ine5oo2pen3racle3nge4g0anic5igins6saka4tsuka4t2vh3pa0ge2nasonic7ris2s1tners4s1y3y2ccw3e0t2f0izer5g1h0armacy6d1ilips5one2to0graphy6s4ysio5ics1tet2ures6d1n0g1k2oneer5zza4k1l0ace2y0station9umbing5s3m1n0c2ohl2ker3litie5rn2st3r0america6xi3ess3ime3o0d0uctions8f1gressive8mo2perties3y5tection8u0dential9s1t1ub2w0c2y2qa1pon3uebec3st5racing4dio4e0ad1lestate6tor2y4cipes5d0stone5umbrella9hab3ise0n3t2liance6n0t0als5pair3ort3ublican8st0aurant8view0s5xroth6ich0ardli6oh3l1o1p2o0cks3deo3gers4om3s0vp3u0gby3hr2n2w0e2yukyu6sa0arland6fe0ty4kura4le1on3msclub4ung5ndvik0coromant12ofi4p1rl2s1ve2xo3b0i1s2c0a1b1haeffler7midt4olarships8ol3ule3warz5ience5ot3d1e0arch3t2cure1ity6ek2lect4ner3rvices6ven3w1x0y3fr2g1h0angrila6rp2w2ell3ia1ksha5oes2p0ping5uji3w3i0lk2na1gles5te3j1k0i0n2y0pe4l0ing4m0art3ile4n0cf3o0ccer3ial4ftbank4ware6hu2lar2utions7ng1y2y2pa0ce3ort2t3r0l2s1t0ada2ples4r1tebank4farm7c0group6ockholm6rage3e3ream4udio2y3yle4u0cks3pplies3y2ort5rf1gery5zuki5v1watch4iss4x1y0dney4stems6z2tab1ipei4lk2obao4rget4tamotors6r2too4x0i3c0i2d0k2eam2ch0nology8l1masek5nnis4va3f1g1h0d1eater2re6iaa2ckets5enda4ps2res2ol4j0maxx4x2k0maxx5l1m0all4n1o0day3kyo3ols3p1ray3shiba5tal3urs3wn2yota3s3r0ade1ing4ining5vel0ers0insurance16ust3v2t1ube2i1nes3shu4v0s2w1z2ua1bank3s2g1k1nicom3versity8o2ol2ps2s1y1z2va0cations7na1guard7c1e0gas3ntures6risign5m\xF6gensberater2ung14sicherung10t2g1i0ajes4deo3g1king4llas4n1p1rgin4sa1ion4va1o3laanderen9n1odka3lvo3te1ing3o2yage5u2wales2mart4ter4ng0gou5tch0es6eather0channel12bcam3er2site5d0ding5ibo2r3f1hoswho6ien2ki2lliamhill9n0dows4e1ners6me2olterskluwer11odside6rk0s2ld3w2s1tc1f3xbox3erox4finity6ihuan4n2xx2yz3yachts4hoo3maxun5ndex5e1odobashi7ga2kohama6u0tube6t1un3za0ppos4ra3ero3ip2m1one3uerich6w2",O1="\u03B5\u03BB1\u03C52\u0431\u04331\u0435\u043B3\u0434\u0435\u0442\u04384\u0435\u044E2\u043A\u0430\u0442\u043E\u043B\u0438\u043A6\u043E\u043C3\u043C\u043A\u04342\u043E\u043D1\u0441\u043A\u0432\u04306\u043E\u043D\u043B\u0430\u0439\u043D5\u0440\u04333\u0440\u0443\u04412\u04442\u0441\u0430\u0439\u04423\u0440\u04313\u0443\u043A\u04403\u049B\u0430\u04373\u0570\u0561\u05753\u05D9\u05E9\u05E8\u05D0\u05DC5\u05E7\u05D5\u05DD3\u0627\u0628\u0648\u0638\u0628\u064A5\u0631\u0627\u0645\u0643\u06485\u0644\u0627\u0631\u062F\u06464\u0628\u062D\u0631\u064A\u06465\u062C\u0632\u0627\u0626\u06315\u0633\u0639\u0648\u062F\u064A\u06296\u0639\u0644\u064A\u0627\u06465\u0645\u063A\u0631\u06285\u0645\u0627\u0631\u0627\u062A5\u06CC\u0631\u0627\u06465\u0628\u0627\u0631\u062A2\u0632\u0627\u06314\u064A\u062A\u06433\u06BE\u0627\u0631\u062A5\u062A\u0648\u0646\u06334\u0633\u0648\u062F\u0627\u06463\u0631\u064A\u06295\u0634\u0628\u0643\u06294\u0639\u0631\u0627\u06422\u06282\u0645\u0627\u06464\u0641\u0644\u0633\u0637\u064A\u06466\u0642\u0637\u06313\u0643\u0627\u062B\u0648\u0644\u064A\u06436\u0648\u06453\u0645\u0635\u06312\u0644\u064A\u0633\u064A\u06275\u0648\u0631\u064A\u062A\u0627\u0646\u064A\u06277\u0642\u06394\u0647\u0645\u0631\u0627\u06475\u067E\u0627\u06A9\u0633\u062A\u0627\u06467\u0680\u0627\u0631\u062A4\u0915\u0949\u092E3\u0928\u0947\u091F3\u092D\u093E\u0930\u09240\u092E\u094D3\u094B\u09245\u0938\u0902\u0917\u0920\u09285\u09AC\u09BE\u0982\u09B2\u09BE5\u09AD\u09BE\u09B0\u09A42\u09F0\u09A44\u0A2D\u0A3E\u0A30\u0A244\u0AAD\u0ABE\u0AB0\u0AA44\u0B2D\u0B3E\u0B30\u0B244\u0B87\u0BA8\u0BCD\u0BA4\u0BBF\u0BAF\u0BBE6\u0BB2\u0B99\u0BCD\u0B95\u0BC86\u0B9A\u0BBF\u0B99\u0BCD\u0B95\u0BAA\u0BCD\u0BAA\u0BC2\u0BB0\u0BCD11\u0C2D\u0C3E\u0C30\u0C24\u0C4D5\u0CAD\u0CBE\u0CB0\u0CA44\u0D2D\u0D3E\u0D30\u0D24\u0D025\u0DBD\u0D82\u0D9A\u0DCF4\u0E04\u0E2D\u0E213\u0E44\u0E17\u0E223\u0EA5\u0EB2\u0EA73\u10D2\u10D42\u307F\u3093\u306A3\u30A2\u30DE\u30BE\u30F34\u30AF\u30E9\u30A6\u30C94\u30B0\u30FC\u30B0\u30EB4\u30B3\u30E02\u30B9\u30C8\u30A23\u30BB\u30FC\u30EB3\u30D5\u30A1\u30C3\u30B7\u30E7\u30F36\u30DD\u30A4\u30F3\u30C84\u4E16\u754C2\u4E2D\u4FE11\u56FD1\u570B1\u6587\u7F513\u4E9A\u9A6C\u900A3\u4F01\u4E1A2\u4F5B\u5C712\u4FE1\u606F2\u5065\u5EB72\u516B\u53662\u516C\u53F81\u76CA2\u53F0\u6E7E1\u70632\u5546\u57CE1\u5E971\u68072\u5609\u91CC0\u5927\u9152\u5E975\u5728\u7EBF2\u5927\u62FF2\u5929\u4E3B\u65593\u5A31\u4E502\u5BB6\u96FB2\u5E7F\u4E1C2\u5FAE\u535A2\u6148\u55842\u6211\u7231\u4F603\u624B\u673A2\u62DB\u80582\u653F\u52A11\u5E9C2\u65B0\u52A0\u57612\u95FB2\u65F6\u5C1A2\u66F8\u7C4D2\u673A\u67842\u6DE1\u9A6C\u95213\u6E38\u620F2\u6FB3\u95802\u70B9\u770B2\u79FB\u52A82\u7EC4\u7EC7\u673A\u67844\u7F51\u57401\u5E971\u7AD91\u7EDC2\u8054\u901A2\u8C37\u6B4C2\u8D2D\u72692\u901A\u8CA92\u96C6\u56E22\u96FB\u8A0A\u76C8\u79D14\u98DE\u5229\u6D663\u98DF\u54C12\u9910\u53852\u9999\u683C\u91CC\u62C93\u6E2F2\uB2F7\uB1371\uCEF42\uC0BC\uC1312\uD55C\uAD6D2",Zn=(n,t)=>{for(let e in t)n[e]=t[e];return n},ec="numeric",nc="ascii",rc="alpha",Oo="asciinumeric",Mo="alphanumeric",ic="domain",jf="emoji",N1="scheme",P1="slashscheme",If="whitespace";function R1(n,t){return n in t||(t[n]=[]),t[n]}function gn(n,t,e){t[ec]&&(t[Oo]=!0,t[Mo]=!0),t[nc]&&(t[Oo]=!0,t[rc]=!0),t[Oo]&&(t[Mo]=!0),t[rc]&&(t[Mo]=!0),t[Mo]&&(t[ic]=!0),t[jf]&&(t[ic]=!0);for(let r in t){let i=R1(r,e);i.indexOf(n)<0&&i.push(n)}}function D1(n,t){let e={};for(let r in t)t[r].indexOf(n)>=0&&(e[r]=!0);return e}function At(n){n===void 0&&(n=null),this.j={},this.jr=[],this.jd=null,this.t=n}At.groups={};At.prototype={accepts(){return!!this.t},go(n){let t=this,e=t.j[n];if(e)return e;for(let r=0;r<t.jr.length;r++){let i=t.jr[r][0],o=t.jr[r][1];if(o&&i.test(n))return o}return t.jd},has(n,t){return t===void 0&&(t=!1),t?n in this.j:!!this.go(n)},ta(n,t,e,r){for(let i=0;i<n.length;i++)this.tt(n[i],t,e,r)},tr(n,t,e,r){r=r||At.groups;let i;return t&&t.j?i=t:(i=new At(t),e&&r&&gn(t,e,r)),this.jr.push([n,i]),i},ts(n,t,e,r){let i=this,o=n.length;if(!o)return i;for(let s=0;s<o-1;s++)i=i.tt(n[s]);return i.tt(n[o-1],t,e,r)},tt(n,t,e,r){r=r||At.groups;let i=this;if(t&&t.j)return i.j[n]=t,t;let o=t,s,a=i.go(n);if(a?(s=new At,Zn(s.j,a.j),s.jr.push.apply(s.jr,a.jr),s.jd=a.jd,s.t=a.t):s=new At,o){if(r)if(s.t&&typeof s.t=="string"){let l=Zn(D1(s.t,r),e);gn(o,l,r)}else e&&gn(o,e,r);s.t=o}return i.j[n]=s,s}};var $=(n,t,e,r,i)=>n.ta(t,e,r,i),Bt=(n,t,e,r,i)=>n.tr(t,e,r,i),Lf=(n,t,e,r,i)=>n.ts(t,e,r,i),E=(n,t,e,r,i)=>n.tt(t,e,r,i),ve="WORD",oc="UWORD",Wr="LOCALHOST",sc="TLD",ac="UTLD",No="SCHEME",Qn="SLASH_SCHEME",lc="NUM",Kf="WS",cc="NL",Ur="OPENBRACE",jr="CLOSEBRACE",Po="OPENBRACKET",Ro="CLOSEBRACKET",Do="OPENPAREN",$o="CLOSEPAREN",Io="OPENANGLEBRACKET",Lo="CLOSEANGLEBRACKET",Bo="FULLWIDTHLEFTPAREN",zo="FULLWIDTHRIGHTPAREN",Ho="LEFTCORNERBRACKET",Fo="RIGHTCORNERBRACKET",Vo="LEFTWHITECORNERBRACKET",Uo="RIGHTWHITECORNERBRACKET",jo="FULLWIDTHLESSTHAN",Ko="FULLWIDTHGREATERTHAN",Wo="AMPERSAND",qo="APOSTROPHE",Jo="ASTERISK",ze="AT",Go="BACKSLASH",Yo="BACKTICK",Xo="CARET",He="COLON",dc="COMMA",Qo="DOLLAR",ie="DOT",Zo="EQUALS",uc="EXCLAMATION",oe="HYPHEN",ts="PERCENT",es="PIPE",ns="PLUS",rs="POUND",is="QUERY",hc="QUOTE",fc="SEMI",se="SLASH",Kr="TILDE",ss="UNDERSCORE",Wf="EMOJI",as="SYM",qf=Object.freeze({__proto__:null,WORD:ve,UWORD:oc,LOCALHOST:Wr,TLD:sc,UTLD:ac,SCHEME:No,SLASH_SCHEME:Qn,NUM:lc,WS:Kf,NL:cc,OPENBRACE:Ur,CLOSEBRACE:jr,OPENBRACKET:Po,CLOSEBRACKET:Ro,OPENPAREN:Do,CLOSEPAREN:$o,OPENANGLEBRACKET:Io,CLOSEANGLEBRACKET:Lo,FULLWIDTHLEFTPAREN:Bo,FULLWIDTHRIGHTPAREN:zo,LEFTCORNERBRACKET:Ho,RIGHTCORNERBRACKET:Fo,LEFTWHITECORNERBRACKET:Vo,RIGHTWHITECORNERBRACKET:Uo,FULLWIDTHLESSTHAN:jo,FULLWIDTHGREATERTHAN:Ko,AMPERSAND:Wo,APOSTROPHE:qo,ASTERISK:Jo,AT:ze,BACKSLASH:Go,BACKTICK:Yo,CARET:Xo,COLON:He,COMMA:dc,DOLLAR:Qo,DOT:ie,EQUALS:Zo,EXCLAMATION:uc,HYPHEN:oe,PERCENT:ts,PIPE:es,PLUS:ns,POUND:rs,QUERY:is,QUOTE:hc,SEMI:fc,SLASH:se,TILDE:Kr,UNDERSCORE:ss,EMOJI:Wf,SYM:as}),Xn=/[a-z]/,Xl=/\p{L}/u,Ql=/\p{Emoji}/u;var Zl=/\d/,Bf=/\s/;var zf=`
`,$1="\uFE0F",I1="\u200D",To=null,Co=null;function L1(n){n===void 0&&(n=[]);let t={};At.groups=t;let e=new At;To==null&&(To=Hf(_1)),Co==null&&(Co=Hf(O1)),E(e,"'",qo),E(e,"{",Ur),E(e,"}",jr),E(e,"[",Po),E(e,"]",Ro),E(e,"(",Do),E(e,")",$o),E(e,"<",Io),E(e,">",Lo),E(e,"\uFF08",Bo),E(e,"\uFF09",zo),E(e,"\u300C",Ho),E(e,"\u300D",Fo),E(e,"\u300E",Vo),E(e,"\u300F",Uo),E(e,"\uFF1C",jo),E(e,"\uFF1E",Ko),E(e,"&",Wo),E(e,"*",Jo),E(e,"@",ze),E(e,"`",Yo),E(e,"^",Xo),E(e,":",He),E(e,",",dc),E(e,"$",Qo),E(e,".",ie),E(e,"=",Zo),E(e,"!",uc),E(e,"-",oe),E(e,"%",ts),E(e,"|",es),E(e,"+",ns),E(e,"#",rs),E(e,"?",is),E(e,'"',hc),E(e,"/",se),E(e,";",fc),E(e,"~",Kr),E(e,"_",ss),E(e,"\\",Go);let r=Bt(e,Zl,lc,{[ec]:!0});Bt(r,Zl,r);let i=Bt(e,Xn,ve,{[nc]:!0});Bt(i,Xn,i);let o=Bt(e,Xl,oc,{[rc]:!0});Bt(o,Xn),Bt(o,Xl,o);let s=Bt(e,Bf,Kf,{[If]:!0});E(e,zf,cc,{[If]:!0}),E(s,zf),Bt(s,Bf,s);let a=Bt(e,Ql,Wf,{[jf]:!0});Bt(a,Ql,a),E(a,$1,a);let l=E(a,I1);Bt(l,Ql,a);let c=[[Xn,i]],d=[[Xn,null],[Xl,o]];for(let u=0;u<To.length;u++)Be(e,To[u],sc,ve,c);for(let u=0;u<Co.length;u++)Be(e,Co[u],ac,oc,d);gn(sc,{tld:!0,ascii:!0},t),gn(ac,{utld:!0,alpha:!0},t),Be(e,"file",No,ve,c),Be(e,"mailto",No,ve,c),Be(e,"http",Qn,ve,c),Be(e,"https",Qn,ve,c),Be(e,"ftp",Qn,ve,c),Be(e,"ftps",Qn,ve,c),gn(No,{scheme:!0,ascii:!0},t),gn(Qn,{slashscheme:!0,ascii:!0},t),n=n.sort((u,h)=>u[0]>h[0]?1:-1);for(let u=0;u<n.length;u++){let h=n[u][0],p=n[u][1]?{[N1]:!0}:{[P1]:!0};h.indexOf("-")>=0?p[ic]=!0:Xn.test(h)?Zl.test(h)?p[Oo]=!0:p[nc]=!0:p[ec]=!0,Lf(e,h,h,p)}return Lf(e,"localhost",Wr,{ascii:!0}),e.jd=new At(as),{start:e,tokens:Zn({groups:t},qf)}}function B1(n,t){let e=z1(t.replace(/[A-Z]/g,a=>a.toLowerCase())),r=e.length,i=[],o=0,s=0;for(;s<r;){let a=n,l=null,c=0,d=null,u=-1,h=-1;for(;s<r&&(l=a.go(e[s]));)a=l,a.accepts()?(u=0,h=0,d=a):u>=0&&(u+=e[s].length,h++),c+=e[s].length,o+=e[s].length,s++;o-=u,s-=h,c-=u,i.push({t:d.t,v:t.slice(o-c,o),s:o-c,e:o})}return i}function z1(n){let t=[],e=n.length,r=0;for(;r<e;){let i=n.charCodeAt(r),o,s=i<55296||i>56319||r+1===e||(o=n.charCodeAt(r+1))<56320||o>57343?n[r]:n.slice(r,r+2);t.push(s),r+=s.length}return t}function Be(n,t,e,r,i){let o,s=t.length;for(let a=0;a<s-1;a++){let l=t[a];n.j[l]?o=n.j[l]:(o=new At(r),o.jr=i.slice(),n.j[l]=o),n=o}return o=new At(e),o.jr=i.slice(),n.j[t[s-1]]=o,o}function Hf(n){let t=[],e=[],r=0,i="0123456789";for(;r<n.length;){let o=0;for(;i.indexOf(n[r+o])>=0;)o++;if(o>0){t.push(e.join(""));for(let s=parseInt(n.substring(r,r+o),10);s>0;s--)e.pop();r+=o}else e.push(n[r]),r++}return t}var qr={defaultProtocol:"http",events:null,format:Ff,formatHref:Ff,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function pc(n,t){t===void 0&&(t=null);let e=Zn({},qr);n&&(e=Zn(e,n instanceof pc?n.o:n));let r=e.ignoreTags,i=[];for(let o=0;o<r.length;o++)i.push(r[o].toUpperCase());this.o=e,t&&(this.defaultRender=t),this.ignoreTags=i}pc.prototype={o:qr,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,t,e){let r=t!=null,i=this.o[n];return i&&(typeof i=="object"?(i=e.t in i?i[e.t]:qr[n],typeof i=="function"&&r&&(i=i(t,e))):typeof i=="function"&&r&&(i=i(t,e.t,e)),i)},getObj(n,t,e){let r=this.o[n];return typeof r=="function"&&t!=null&&(r=r(t,e.t,e)),r},render(n){let t=n.render(this);return(this.get("render",null,n)||this.defaultRender)(t,n.t,n)}};function Ff(n){return n}function Jf(n,t){this.t="token",this.v=n,this.tk=t}Jf.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){let t=this.toString(),e=n.get("truncate",t,this),r=n.get("format",t,this);return e&&r.length>e?r.substring(0,e)+"\u2026":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=qr.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){let t=this,e=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",e,this),i=n.get("tagName",e,t),o=this.toFormattedString(n),s={},a=n.get("className",e,t),l=n.get("target",e,t),c=n.get("rel",e,t),d=n.getObj("attributes",e,t),u=n.getObj("events",e,t);return s.href=r,a&&(s.class=a),l&&(s.target=l),c&&(s.rel=c),d&&Zn(s,d),{tagName:i,attributes:s,content:o,eventListeners:u}}};function ls(n,t){class e extends Jf{constructor(i,o){super(i,o),this.t=n}}for(let r in t)e.prototype[r]=t[r];return e.t=n,e}var Vf=ls("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Uf=ls("text"),H1=ls("nl"),_o=ls("url",{isLink:!0,toHref(n){return n===void 0&&(n=qr.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){let n=this.tk;return n.length>=2&&n[0].t!==Wr&&n[1].t===He}});var zt=n=>new At(n);function F1(n){let{groups:t}=n,e=t.domain.concat([Wo,Jo,ze,Go,Yo,Xo,Qo,Zo,oe,lc,ts,es,ns,rs,se,as,Kr,ss]),r=[qo,He,dc,ie,uc,is,hc,fc,Io,Lo,Ur,jr,Ro,Po,Do,$o,Bo,zo,Ho,Fo,Vo,Uo,jo,Ko],i=[Wo,qo,Jo,Go,Yo,Xo,Qo,Zo,oe,Ur,jr,ts,es,ns,rs,is,se,as,Kr,ss],o=zt(),s=E(o,Kr);$(s,i,s),$(s,t.domain,s);let a=zt(),l=zt(),c=zt();$(o,t.domain,a),$(o,t.scheme,l),$(o,t.slashscheme,c),$(a,i,s),$(a,t.domain,a);let d=E(a,ze);E(s,ze,d),E(l,ze,d),E(c,ze,d);let u=E(s,ie);$(u,i,s),$(u,t.domain,s);let h=zt();$(d,t.domain,h),$(h,t.domain,h);let f=E(h,ie);$(f,t.domain,h);let p=zt(Vf);$(f,t.tld,p),$(f,t.utld,p),E(d,Wr,p);let x=E(h,oe);$(x,t.domain,h),$(p,t.domain,h),E(p,ie,f),E(p,oe,x);let S=E(p,He);$(S,t.numeric,Vf);let b=E(a,oe),v=E(a,ie);$(b,t.domain,a),$(v,i,s),$(v,t.domain,a);let m=zt(_o);$(v,t.tld,m),$(v,t.utld,m),$(m,t.domain,a),$(m,i,s),E(m,ie,v),E(m,oe,b),E(m,ze,d);let g=E(m,He),k=zt(_o);$(g,t.numeric,k);let y=zt(_o),O=zt();$(y,e,y),$(y,r,O),$(O,e,y),$(O,r,O),E(m,se,y),E(k,se,y);let A=E(l,He),B=E(c,He),K=E(B,se),kt=E(K,se);$(l,t.domain,a),E(l,ie,v),E(l,oe,b),$(c,t.domain,a),E(c,ie,v),E(c,oe,b),$(A,t.domain,y),E(A,se,y),$(kt,t.domain,y),$(kt,e,y),E(kt,se,y);let mt=[[Ur,jr],[Po,Ro],[Do,$o],[Io,Lo],[Bo,zo],[Ho,Fo],[Vo,Uo],[jo,Ko]];for(let St=0;St<mt.length;St++){let[X,Rt]=mt[St],st=E(y,X);E(O,X,st),E(st,Rt,y);let Q=zt(_o);$(st,e,Q);let dt=zt();$(st,r),$(Q,e,Q),$(Q,r,dt),$(dt,e,Q),$(dt,r,dt),E(Q,Rt,y),E(dt,Rt,y)}return E(o,Wr,m),E(o,cc,H1),{start:o,tokens:qf}}function V1(n,t,e){let r=e.length,i=0,o=[],s=[];for(;i<r;){let a=n,l=null,c=null,d=0,u=null,h=-1;for(;i<r&&!(l=a.go(e[i].t));)s.push(e[i++]);for(;i<r&&(c=l||a.go(e[i].t));)l=null,a=c,a.accepts()?(h=0,u=a):h>=0&&h++,i++,d++;if(h<0)i-=d,i<r&&(s.push(e[i]),i++);else{s.length>0&&(o.push(tc(Uf,t,s)),s=[]),i-=h,d-=h;let f=u.t,p=e.slice(i-d,i);o.push(tc(f,t,p))}}return s.length>0&&o.push(tc(Uf,t,s)),o}function tc(n,t,e){let r=e[0].s,i=e[e.length-1].e,o=t.slice(r,i);return new n(o,e)}var U1=typeof console<"u"&&console&&console.warn||(()=>{}),j1="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",j={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function Gf(){At.groups={},j.scanner=null,j.parser=null,j.tokenQueue=[],j.pluginQueue=[],j.customSchemes=[],j.initialized=!1}function mc(n,t){if(t===void 0&&(t=!1),j.initialized&&U1(`linkifyjs: already initialized - will not register custom scheme "${n}" ${j1}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
1. Must only contain digits, lowercase ASCII letters or "-"
2. Cannot start or end with "-"
3. "-" cannot repeat`);j.customSchemes.push([n,t])}function K1(){j.scanner=L1(j.customSchemes);for(let n=0;n<j.tokenQueue.length;n++)j.tokenQueue[n][1]({scanner:j.scanner});j.parser=F1(j.scanner.tokens);for(let n=0;n<j.pluginQueue.length;n++)j.pluginQueue[n][1]({scanner:j.scanner,parser:j.parser});j.initialized=!0}function gc(n){return j.initialized||K1(),V1(j.parser.start,n,B1(j.scanner.start,n))}function bc(n,t,e){if(t===void 0&&(t=null),e===void 0&&(e=null),t&&typeof t=="object"){if(e)throw Error(`linkifyjs: Invalid link type ${t}; must be a string`);e=t,t=null}let r=new pc(e),i=gc(n),o=[];for(let s=0;s<i.length;s++){let a=i[s];a.isLink&&(!t||a.t===t)&&r.check(a)&&o.push(a.toFormattedObject(r))}return o}function W1(n){return n.length===1?n[0].isLink:n.length===3&&n[1].isLink?["()","[]"].includes(n[0].value+n[2].value):!1}function q1(n){return new R({key:new L("autolink"),appendTransaction:(t,e,r)=>{let i=t.some(c=>c.docChanged)&&!e.doc.eq(r.doc),o=t.some(c=>c.getMeta("preventAutolink"));if(!i||o)return;let{tr:s}=r,a=Dh(e.doc,[...t]);if(Ih(a).forEach(({newRange:c})=>{let d=$h(r.doc,c,f=>f.isTextblock),u,h;if(d.length>1?(u=d[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ")):d.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(u=d[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")),u&&h){let f=h.split(" ").filter(b=>b!=="");if(f.length<=0)return!1;let p=f[f.length-1],x=u.pos+h.lastIndexOf(p);if(!p)return!1;let S=gc(p).map(b=>b.toObject(n.defaultProtocol));if(!W1(S))return!1;S.filter(b=>b.isLink).map(b=>({...b,from:x+b.start+1,to:x+b.end+1})).filter(b=>r.schema.marks.code?!r.doc.rangeHasMark(b.from,b.to,r.schema.marks.code):!0).filter(b=>n.validate(b.value)).forEach(b=>{ro(b.from,b.to,r.doc).some(v=>v.mark.type===n.type)||s.addMark(b.from,b.to,n.type.create({href:b.href}))})}}),!!s.steps.length)return s}})}function J1(n){return new R({key:new L("handleClickLink"),props:{handleClick:(t,e,r)=>{var i,o;if(r.button!==0||!t.editable)return!1;let s=r.target,a=[];for(;s.nodeName!=="DIV";)a.push(s),s=s.parentNode;if(!a.find(h=>h.nodeName==="A"))return!1;let l=_l(t.state,n.type.name),c=r.target,d=(i=c?.href)!==null&&i!==void 0?i:l.href,u=(o=c?.target)!==null&&o!==void 0?o:l.target;return c&&d?(window.open(d,u),!0):!1}}})}function G1(n){return new R({key:new L("handlePasteLink"),props:{handlePaste:(t,e,r)=>{let{state:i}=t,{selection:o}=i,{empty:s}=o;if(s)return!1;let a="";r.content.forEach(c=>{a+=c.textContent});let l=bc(a,{defaultProtocol:n.defaultProtocol}).find(c=>c.isLink&&c.value===a);return!a||!l?!1:(n.editor.commands.setMark(n.type,{href:l.href}),!0)}}})}var Y1=/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g;function Yf(n,t){let e=["http","https","ftp","ftps","mailto","tel","callto","sms","cid","xmpp"];return t&&t.forEach(r=>{let i=typeof r=="string"?r:r.scheme;i&&e.push(i)}),!n||n.replace(Y1,"").match(new RegExp(`^(?:(?:${e.join("|")}):|[^a-z]|[a-z+.-]+(?:[^a-z+.-:]|$))`,"i"))}var Xf=Pt.create({name:"link",priority:1e3,keepOnSplit:!1,exitable:!0,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){mc(n);return}mc(n.scheme,n.optionalSlashes)})},onDestroy(){Gf()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:"http",HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:n=>!!n}},addAttributes(){return{href:{default:null,parseHTML(n){return n.getAttribute("href")}},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:"a[href]",getAttrs:n=>{let t=n.getAttribute("href");return!t||!Yf(t,this.options.protocols)?!1:null}}]},renderHTML({HTMLAttributes:n}){return Yf(n.href,this.options.protocols)?["a",D(this.options.HTMLAttributes,n),0]:["a",D(this.options.HTMLAttributes,{...n,href:""}),0]},addCommands(){return{setLink:n=>({chain:t})=>t().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:t})=>t().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[It({find:n=>{let t=[];if(n){let{validate:e}=this.options,r=bc(n).filter(i=>i.isLink&&e(i.value));r.length&&r.forEach(i=>t.push({text:i.value,data:{href:i.href},index:i.start}))}return t},type:this.type,getAttributes:n=>{var t;return{href:(t=n.data)===null||t===void 0?void 0:t.href}}})]},addProseMirrorPlugins(){let n=[];return this.options.autolink&&n.push(q1({type:this.type,defaultProtocol:this.options.defaultProtocol,validate:this.options.validate})),this.options.openOnClick===!0&&n.push(J1({type:this.type})),this.options.linkOnPaste&&n.push(G1({editor:this.editor,defaultProtocol:this.options.defaultProtocol,type:this.type})),n}});var ds=class ds extends V{constructor(e,r,i){super(ds.eventName,i);this.clipboardData=e;this.originalPasteEvent=r;this.clipboardData=e,this.originalPasteEvent=r}};ds.eventName="rhino-paste";var cs=ds;function Qf(){let n=new WeakMap;return new R({key:new L("rhino-paste-event"),props:{handlePaste(t,e){let{clipboardData:r}=e;if(n.has(e)||(n.set(e,null),e.defaultPrevented))return!1;let i=new cs(r,e);return t.dom.dispatchEvent(i),!1}}})}function xc({view:n,from:t,editor:e}){let r=n.nodeDOM(t);(e.isActive("attachment-figure")||e.isActive("previewable-attachment-figure"))&&(r=r.querySelector("figcaption")||r);let i=r.dataset.nodeViewWrapper?r:r.querySelector("[data-node-view-wrapper]");return i&&(r=i.firstChild),r}var yc=class{constructor({editor:t,element:e,view:r,updateDelay:i=250,shouldShow:o,determineNodeViewAnchor:s}){this.preventHide=!1;this.shouldShow=({view:t,state:e,from:r,to:i})=>{let{doc:o,selection:s}=e,{empty:a}=s,l=!o.textBetween(r,i).length&&eo(e.selection),c=this.element.matches(":focus-within");return!(!(t.hasFocus()||c)||a||l||!this.editor.isEditable)};this.determineNodeViewAnchor=({view:t,from:e})=>xc({view:t,from:e,editor:this.editor});this.dragstartHandler=()=>{};this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))};this.blurHandler=()=>{setTimeout(()=>{!this.element.matches(":focus-within")&&!this.view.dom.matches(":focus-within")&&this.hide()})};this.handleDebouncedUpdate=(t,e)=>{let r=!e?.selection.eq(t.state.selection),i=!e?.doc.eq(t.state.doc);!r&&!i||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(t,r,i,e)},this.updateDelay))};this.updateHandler=(t,e,r,i)=>{let{state:o,composing:s}=t,{selection:a}=o;if(s||!e&&!r)return;let{ranges:c}=a,d=Math.min(...c.map(p=>p.$from.pos)),u=Math.max(...c.map(p=>p.$to.pos));if(!this.shouldShow?.({editor:this.editor,view:t,state:o,oldState:i,from:d,to:u})){this.hide();return}let f=null;if(Wn(o.selection)){let p=this.determineNodeViewAnchor?.({editor:this.editor,view:t,state:o,oldState:i,from:d,to:u})||t.nodeDOM(d);p&&(f=()=>p.getBoundingClientRect())}else f=()=>{let p=io(t,d,u);return p.x=p.x-p.width/2,p};f&&this.show(f)};this.editor=t,this.element=e,this.view=r,this.updateDelay=i,o&&(this.shouldShow=o),s&&(this.determineNodeViewAnchor=s),this.view.dom.addEventListener("dragstart",this.dragstartHandler),this.editor.on("focus",this.focusHandler),this.editor.on("blur",this.blurHandler),this.element.addEventListener("focusout",this.blurHandler)}destroy(){this.view.dom.removeEventListener("dragstart",this.dragstartHandler),this.editor.off("focus",this.focusHandler),this.editor.off("blur",this.blurHandler),this.element.removeEventListener("focusout",this.blurHandler)}update(t,e){let{state:r}=t,i=r.selection.from!==r.selection.to;if(this.updateDelay>0&&i){this.handleDebouncedUpdate(t,e);return}let o=!e?.selection.eq(t.state.selection),s=!e?.doc.eq(t.state.doc);this.updateHandler(t,o,s,e)}show(t){let e=new Event("rhino-bubble-menu-show",{bubbles:!0,composed:!0,cancelable:!0});e.clientRect=t,this.element.dispatchEvent(e)}hide(){let t=new Event("rhino-bubble-menu-hide",{bubbles:!0,composed:!0});this.element.dispatchEvent(t)}},X1=n=>new R({key:typeof n.pluginKey=="string"?new L(n.pluginKey):n.pluginKey,view:t=>new yc({view:t,...n})}),Zf=F.create({name:"rhino-bubble-menu",addOptions(){return{element:null,pluginKey:"rhino-bubble-menu",updateDelay:void 0,shouldShow:null}},addProseMirrorPlugins(){return this.options.element?[X1({pluginKey:this.options.pluginKey,editor:this.editor,element:this.options.element,updateDelay:this.options.updateDelay,shouldShow:this.options.shouldShow,determineNodeViewAnchor:this.options.determineNodeViewAnchor})]:[]}});var Q1="codemark",Jr=100,tp=new L(Q1);function ae(n,t){var e,r;return"schema"in n?(e=t?.markType)!==null&&e!==void 0?e:n.schema.marks.code:(r=t?.markType)!==null&&r!==void 0?r:n.state.schema.marks.code}function ke(n,t){return n.resolve(Math.min(Math.max(1,t),n.nodeSize-2))}function rp(n,t,e,r){var i;let o=n.isInSet((i=t.state.storedMarks)!==null&&i!==void 0?i:t.state.doc.resolve(e).marks()),s=t.state.doc.rangeHasMark(e,r,n);return!!(o||s)}var ep={match:/`((?:[^`\w]|[\w])+)`$/,handler:(n,t,e,r,i,o,s)=>{if(rp(n,t,i,o))return!1;let a=r[1],l=n.create(),c=i+a.length,d=t.state.tr.delete(i,o).insertText(a).addMark(i,c,l),u=d.setSelection(_.create(d.doc,c)).removeStoredMark(n),h=u.setMeta(s.input,{transform:u,from:i,to:o,text:`\`${a}${e}`});return t.dispatch(h),!0}},np={match:/^`((?:[^`\w]|[\w])+)`/,handler:(n,t,e,r,i,o,s)=>{if(rp(n,t,i,o))return!1;let a=n.create(),l=r[1],c=i,d=t.state.tr.delete(i,o).insertText(l).addMark(i,i+l.length,a),u=d.setSelection(_.create(d.doc,c)).addStoredMark(n.create()),h=u.setMeta(s.input,{transform:u,from:i,to:o,text:`\`${l}${e}`});return t.dispatch(h),!0}};function Z1(n,t,e,r,i,o){if(t.composing)return!1;let{state:s}=t,a=s.doc.resolve(e);if(a.parent.type.spec.code)return!1;let l="\uFFFC",c=a.parent.textBetween(Math.max(0,a.parentOffset-Jr),a.parentOffset,void 0,l)+i,d=i+a.parent.textBetween(a.parentOffset,Math.min(a.parent.nodeSize-2,a.parentOffset+Jr),void 0,l),u=ep.match.exec(c),h=np.match.exec(d);if(u){let f=ep.handler(n,t,i,u,e-u[0].length+i.length,r,o);if(f)return f}return h?np.handler(n,t,i,h,e,r+h[0].length-i.length,o):!1}function ip(n,t){let e=new R({isInputRules:!0,state:{init:()=>null,apply(r,i){let o=r.getMeta(e);return o||(r.selectionSet||r.docChanged?null:i)}},props:{handleTextInput(r,i,o,s){let a=ae(r,t);return Z1(a,r,i,o,s,{input:e,cursor:n})}}});return e}function le(n,t,e="next"){let r={action:e};return n.dispatch(n.state.tr.setMeta(t,r)),!1}function op(n,t,e,r){if(n.state.selection.empty||e.metaKey||e.shiftKey||e.altKey||e.ctrlKey)return!1;let{from:i,to:o}=n.state.selection;if(o-i>=Jr||n.state.doc.rangeHasMark(i,o,r))return!1;let s=n.state.tr.addMark(i,o,r.create()),a=s.setSelection(_.create(s.doc,o)).removeStoredMark(r);return n.dispatch(a),!0}function tx(n,t,e,r){var i;if(e.metaKey)return le(n,t);if(e.shiftKey||e.altKey||e.ctrlKey)return!1;let{selection:o,doc:s}=n.state;if(!o.empty)return!1;let a=t.getState(n.state),l=o.$from,c=!!r.isInSet(l.marks()),d=!!r.isInSet((i=l.marksAcross(ke(s,o.from+1)))!==null&&i!==void 0?i:[]);return l.pos===n.state.doc.nodeSize-3&&l.parentOffset===l.parent.nodeSize-2&&a?.active?(n.dispatch(n.state.tr.removeStoredMark(r)),!0):c===d&&l.parentOffset!==0?!1:c&&(!a?.active||a.side===-1)&&l.parentOffset!==0?(n.dispatch(n.state.tr.removeStoredMark(r)),!0):d&&a?.side===-1?(n.dispatch(n.state.tr.addStoredMark(r.create())),!0):!1}function sp(n,t,e,r){if(tx(n,t,e,r))return!0;let{selection:o}=n.state,s=o.$from;return o.empty&&s.parentOffset===s.parent.nodeSize-2?le(n,t):!1}function ex(n,t,e,r){var i;if(e.metaKey)return le(n,t);if(e.shiftKey||e.altKey||e.ctrlKey)return!1;let{selection:o,doc:s}=n.state,a=t.getState(n.state),l=!!r.isInSet(o.$from.marks()),c=!!r.isInSet((i=ke(s,o.empty?o.from-1:o.from+1).marks())!==null&&i!==void 0?i:[]);if(l&&a?.side===-1&&o.$from.parentOffset===0)return!1;if(a?.side===0&&o.$from.parentOffset===0)return n.dispatch(n.state.tr.removeStoredMark(r)),!0;if(l&&c&&a?.side===0)return n.dispatch(n.state.tr.addStoredMark(r.create())),!0;if(l&&!c&&a?.active&&o.$from.parentOffset===0||!l&&a?.active&&a?.side===0)return n.dispatch(n.state.tr.removeStoredMark(r)),!0;if(l===c)return!1;if(c||!o.empty&&l){let d=o.empty?o.from-1:o.from,u=n.state.tr.setSelection(_.create(s,d));return!o.empty&&c?n.dispatch(u.addStoredMark(r.create())):n.dispatch(u.removeStoredMark(r)),!0}if((c||!o.empty&&l)&&!a?.active){let d=o.empty?o.from-1:o.from;return n.dispatch(n.state.tr.setSelection(_.create(s,d)).removeStoredMark(r)),!0}if(l&&!a?.active&&o.$from.parentOffset>0)return n.dispatch(n.state.tr.setSelection(_.create(s,o.from-1)).addStoredMark(r.create())),!0;if(l&&!c&&a?.active&&a.side!==-1)return n.dispatch(n.state.tr.addStoredMark(r.create())),!0;if(l&&!c&&a?.active){let d=o.from-1;return n.dispatch(n.state.tr.setSelection(_.create(s,d)).addStoredMark(r.create())),!0}return!1}function ap(n,t,e,r){if(ex(n,t,e,r))return!0;let{selection:o}=n.state,s=o.$from,a=t.getState(n.state);return s.pos===1&&s.parentOffset===0&&a?.side===-1?!0:o.empty&&s.parentOffset===0?le(n,t):!1}function lp(n,t,e,r){if(e.metaKey||e.shiftKey||e.altKey||e.ctrlKey)return!1;let{selection:i,doc:o}=n.state,s=ke(o,i.from-1),a=!!r.isInSet(s.marks()),l=s.parentOffset===0,c=!!r.isInSet(ke(o,i.to+1).marks());if((!a||l)&&!c)return le(n,t);let d=t.getState(n.state);if(i.empty&&d?.side===-1){let u=n.state.tr.delete(i.from-1,i.from);return n.dispatch(u),!0}return!1}function cp(n,t,e,r){if(e.metaKey||e.shiftKey||e.altKey||e.ctrlKey)return!1;let{selection:i,doc:o}=n.state,s=!!r.isInSet(i.$from.marks()),a=i.$from.parentOffset===0,l=!!r.isInSet(ke(o,i.to+2).marks());return(!s||a)&&!l?le(n,t):!1}function dp(n,t){var e,r;if(!n)return null;let{selection:i,doc:o}=n;if(!i.empty)return null;let s=!!t.isInSet((e=n.storedMarks)!==null&&e!==void 0?e:[]),a=!!t.isInSet(i.$from.marks()),l=!!t.isInSet((r=ke(o,i.from+1).marks())!==null&&r!==void 0?r:[]),c=i.$from.parentOffset===0;return a!==l||!a&&s!==a||a&&c?n.tr.removeStoredMark(t):null}function nx(){let n=document.createElement("span");return n.classList.add("fake-cursor"),n}function rx(n){let t=new R({key:tp,appendTransaction:(e,r,i)=>{var o;let s=t.getState(r),a=(o=e[0])===null||o===void 0?void 0:o.getMeta(t);return s?.next||a?.action==="click"?dp(i,ae(i,n)):null},state:{init:()=>null,apply(e,r,i,o){var s;let a=e.getMeta(t);if(a?.action==="next")return{next:!0};let l=ae(o,n),c=l.isInSet((s=o.storedMarks)!==null&&s!==void 0?s:o.doc.resolve(e.selection.from).marks()),d=l.isInSet(o.doc.resolve(e.selection.from).marks()),u=l.isInSet(ke(o.doc,e.selection.from+1).marks()),h=e.selection.$from.parentOffset===0;return e.selection.empty?!c&&u&&(!d||h)?{active:!0,side:-1}:c&&(!d||h)?{active:!0,side:0}:!c&&d&&!u?{active:!0,side:0}:c&&d&&!u?{active:!0,side:-1}:null:null}},props:{attributes:e=>{var r;let{active:i=!1}=(r=t.getState(e))!==null&&r!==void 0?r:{};return Object.assign({},i?{class:"no-cursor"}:{})},decorations:e=>{var r;let{active:i,side:o}=(r=t.getState(e))!==null&&r!==void 0?r:{};if(!i)return q.empty;let s=ot.widget(e.selection.from,nx,{side:o});return q.create(e.doc,[s])},handleKeyDown(e,r){switch(r.key){case"`":return op(e,t,r,ae(e,n));case"ArrowRight":return sp(e,t,r,ae(e,n));case"ArrowLeft":return ap(e,t,r,ae(e,n));case"Backspace":return lp(e,t,r,ae(e,n));case"Delete":return cp(e,t,r,ae(e,n));case"ArrowUp":case"ArrowDown":case"Home":case"End":return le(e,t);case"e":case"a":return r.ctrlKey?le(e,t):!1;default:return!1}},handleClick(e){return le(e,t,"click")}}});return t}function up(n){let t=rx(n),e=ip(t,n);return[t,e]}var hp=up;var fp=F.create({name:"rhino-codemark-plugin",addProseMirrorPlugins(){return hp({markType:this.editor.schema.marks.code})}});var ix=n=>{let t=new R({key:new L("rhino-selection"),state:{init(){return q.empty},apply(e,r){if(!e.getMeta(t))return r;r=r.map(e.mapping,e.doc);let i=r.find(void 0,void 0,l=>l.rhinoSelection===!0);i?.length>=1&&(r=r.remove(i));let{doc:o,selection:s}=e,a=null;return s.to!==s.from&&(a=ot.inline(s.from,s.to,n.HTMLAttributes||{},{rhinoSelection:!0})),a&&(r=r.add(o,[a])),r}},props:{handleDOMEvents:{blur:e=>{let{tr:r}=e.state,i=r.setMeta(t,{from:r.selection.from,to:r.selection.to});e.dispatch(i)},focus:e=>{let{tr:r}=e.state,i=r.setMeta(t,{from:r.selection.from,to:r.selection.to});e.dispatch(i)}},decorations(e){return this.getState(e)}}});return t},pp=F.create({name:"rhino-selection",addOptions(){return{HTMLAttributes:{class:"rhino-selection",readonly:""}}},addProseMirrorPlugins(){return[ix(this.options)]}});var mp=F.create({name:"rhino-starter-kit",addProseMirrorPlugins(){let n=[];return[["rhinoPasteEvent",Qf]].forEach(([e,r])=>{let i=this.options[e];i!==!1&&n.push(r(i))}),n},addExtensions(){let n=[];return[["rhinoGallery",Nf],["rhinoAttachment",Ao],["rhinoImage",Of],["rhinoFigcaption",Pf],["rhinoStrike",Rf],["rhinoLink",Xf],["rhinoFocus",$f],["rhinoPlaceholder",Df],["rhinoBubbleMenu",Zf],["rhinoCodemarkPlugin",fp],["rhinoSelection",pp]].forEach(([e,r])=>{let i=this.options[e];i!==!1&&(n.push(r.configure(i)),e==="rhinoAttachment"&&n.push(_f.configure(i)))}),n}});var us=class us extends V{constructor(e,r={}){super(us.eventName,r);this.attachment=e;this.attachment=e}};us.eventName="rhino-attachment-add";var Gr=us;var fs=class fs extends V{constructor(e,r){super(fs.eventName,r);this.file=e;this.file=e}};fs.eventName="rhino-file-accept";var hs=fs;var ms=class ms extends V{constructor(t){super(ms.eventName,t)}};ms.eventName="rhino-before-initialize";var ps=ms;var bs=class bs extends V{constructor(t){super(bs.eventName,t)}};bs.eventName="rhino-initialize";var gs=bs;var xs=class xs extends V{constructor(t){super(xs.eventName,t)}};xs.eventName="rhino-focus";var ys=xs;var ks=class ks extends V{constructor(t){super(ks.eventName,t)}};ks.eventName="rhino-blur";var vs=ks;var ws=class ws extends V{constructor(t){super(ws.eventName,t)}};ws.eventName="rhino-change";var Ss=ws;var As=class As extends V{constructor({transaction:t},e){super(As.eventName,e),this.transaction=t}};As.eventName="rhino-selection-change";var Es=As;var bn=class extends Ye{constructor(){super();this.readonly=!1;this.hasInitialized=!1;this.pendingAttachments=[];this.serializer="html";this.accept="*";this.starterKitOptions={strike:!1,rhinoLink:{openOnClick:!1}};this.extensions=[];this.deferInitialize=!1;this.__initialAttributes={};this.__hasRendered=!1;this.__initializationPromise__=null;this.__initializationResolver__=null;this.handleAttachment=e=>{setTimeout(()=>{if(e.defaultPrevented)return;let{attachment:r,target:i}=e;i instanceof HTMLElement&&r.file&&new yo(r,i).start()})};this.handleFileAccept=e=>{};this.handleDropFile=(e,r,i,o)=>!(r instanceof DragEvent)||o?!1:this.handleNativeDrop(r);this.handlePaste=async e=>{if(this.editor==null||e==null)return;let{clipboardData:r}=e;if(r==null)return;let i=!1,o=r.files?.length>0,s=[];if(o)s=await this.handleFiles(r.files);else{let a="text/plain";r.types.includes("text/html")&&(a="text/html"),i=r.getData(a)}setTimeout(async()=>{if(!(e.defaultPrevented||e.originalPasteEvent.defaultPrevented)){if(i!==!1){this.editor?.chain().focus().insertContent(i).run();return}if(s.length>0){this.editor?.chain().focus().setAttachment(s).run();return}}})};this.__handleCreate=()=>{this.requestUpdate()};this.__handleUpdate=()=>{this.requestUpdate(),this.hasInitialized&&(this.updateInputElementValue(),this.dispatchEvent(new Ss))};this.__handleFocus=()=>{this.dispatchEvent(new ys),this.requestUpdate()};this.__handleBlur=()=>{this.updateInputElementValue(),this.requestUpdate(),this.dispatchEvent(new vs)};this.__handleSelectionUpdate=({transaction:e})=>{this.requestUpdate(),this.dispatchEvent(new Es({transaction:e}))};this.__handleTransaction=()=>{this.requestUpdate()};this.__addPendingAttachment=this.__addPendingAttachment.bind(this),this.__removePendingAttachment=this.__removePendingAttachment.bind(this),this.registerDependencies(),this.addEventListener(Gr.eventName,this.handleAttachment),this.addEventListener(Hr.eventName,this.__addPendingAttachment),this.addEventListener(mn.eventName,this.__removePendingAttachment),this.addEventListener(Jn.eventName,this.__removePendingAttachment),this.addEventListener("drop",this.handleNativeDrop),this.addEventListener("rhino-paste",this.handlePaste),this.addEventListener("rhino-file-accept",this.handleFileAccept)}static get styles(){return[po,Bh,rd]}static get properties(){return{readonly:{type:Boolean,reflect:!0},input:{reflect:!0},class:{reflect:!0},accept:{reflect:!0},serializer:{reflect:!0},deferInitialize:{type:Boolean,attribute:"defer-initialize",reflect:!0},editor:{state:!0},editorElement:{state:!0},starterKitOptions:{state:!0},extensions:{state:!0}}}__getInitialAttributes(){if(this.__hasRendered)return;let e=this.slottedEditor;e&&(this.__initialAttributes={},[...e.attributes].forEach(r=>{let{nodeName:i,nodeValue:o}=r;i&&o!=null&&(this.__initialAttributes[i]=o)})),this.__hasRendered=!0}rebuildEditor(){if(!this.hasInitialized)return;let e=this.querySelectorAll("[slot='editor']");this.__getInitialAttributes(),this.editor&&this.editor.destroy(),e.forEach(r=>{r.editor?.destroy(),r.remove()}),this.editor=this.__setupEditor(this),this.__bindEditorListeners(),this.editorElement=this.querySelector(".ProseMirror"),Object.entries(this.__initialAttributes)?.forEach(([r,i])=>{if(r==="class"){this.editorElement?.classList.add(...i.split(" "));return}this.editorElement?.setAttribute(r,i)}),this.editorElement?.setAttribute("slot","editor"),this.editorElement?.classList.add("trix-content"),this.editorElement?.setAttribute("tabindex","0"),this.editorElement?.setAttribute("role","textbox"),this.requestUpdate()}getHTMLContentFromRange(e,r){let i=this.editor;if(!i)return"";let o;if(!e&&!r){let c=i.state.selection;e=c.from,r=c.to}if(o||e==null||r==null)return"";let{state:s}=i,a=[],l=document.createElement("script");return l.type="text/plain",s.doc.nodesBetween(e,r,(c,d,u)=>{if(u===s.doc){l.innerHTML="";let f=_t.fromSchema(i.schema).serializeNode(c);l.appendChild(f),a.push(l.innerHTML),l.innerHTML=""}}),a.join("")}getTextContentFromRange(e,r){let i=this.editor;if(!i)return"";let o;if(!e&&!r){let s=i.state.selection;e=s.from,r=s.to,o=s.empty}return o||e==null||r==null?"":i.state.doc.textBetween(e,r," ")}willUpdate(e){e.has("deferInitialize")&&!this.deferInitialize&&this.startEditor(),e.has("class")&&this.classList.add("rhino-editor"),super.willUpdate(e)}updated(e){if(!this.hasInitialized)return super.updated(e);e.has("readonly")&&this.editor?.setEditable(!this.readonly),(e.has("extensions")||e.has("serializer")||e.has("starterKitOptions")||e.has("translations"))&&this.rebuildEditor(),e.has("serializer")&&this.updateInputElementValue(),super.updated(e),this.dispatchEvent(new Event("rhino-update",{bubbles:!0,composed:!0,cancelable:!1}))}registerDependencies(){[Br].forEach(e=>e.define())}get slottedEditor(){return this.querySelector("[slot='editor']")}__addPendingAttachment(e){this.pendingAttachments.push(e.attachmentUpload)}__removePendingAttachment(e){let r=this.pendingAttachments.findIndex(i=>"attachmentUpload"in e?i===e.attachmentUpload:"attachment"in e?i.attachment.attachmentId===e.attachment.attachmentId:!1);r>-1&&this.pendingAttachments.splice(r,1)}async connectedCallback(){super.connectedCallback(),this.__setupInitialization__(),this.editor&&this.__unBindEditorListeners(),this.classList.add("rhino-editor"),this.deferInitialize||this.startEditor()}async startEditor(){await this.updateComplete,setTimeout(()=>{this.dispatchEvent(new ps),setTimeout(async()=>{await this.updateComplete,this.hasInitialized=!0,this.rebuildEditor(),this.dispatchEvent(new gs),this.__initializationResolver__?.()})})}disconnectedCallback(){super.disconnectedCallback(),this.editor?.destroy(),this.hasInitialized=!1,this.__initializationPromise__=null,this.__initializationResolver__=null}__setupInitialization__(){this.__initializationPromise__||(this.__initializationPromise__=new Promise(e=>{this.__initializationResolver__=e}))}get initializationComplete(){return this.__setupInitialization__(),this.__initializationPromise__}addExtensions(...e){let r=[];e.forEach(o=>{if(Array.isArray(o)){r=r.concat(o.flat(1));return}r.push(o)});let i=this.extensions.map(o=>o.name);r=r.filter(o=>!i.includes(o.name)),this.extensions=this.extensions.concat(r)}disableStarterKitOptions(...e){let r={};e.forEach(i=>{if(Array.isArray(i)){i.flat(1).forEach(o=>r[o]=!1);return}r[i]=!1}),this.starterKitOptions={...this.starterKitOptions,...r}}editorOptions(e){return{}}updateInputElementValue(){this.inputElement!=null&&this.editor!=null&&!this.readonly&&(this.inputElement.value=this.serialize())}serialize(){return this.editor==null?"":this.serializer?.toLowerCase()==="json"?JSON.stringify(this.editor.getJSON()):this.editor.getHTML()}get inputElement(){return this.input?(this.getRootNode()||document).querySelector(`#${this.input}`):void 0}async handleFiles(e){return this.editor==null?[]:e==null?[]:new Promise((r,i)=>{let o=[...e].map(l=>{let c=new hs(l);return this.dispatchEvent(c),c}),s=[];for(let l=0;l<o.length;l++){let c=o[l];c.defaultPrevented||s.push(c.file)}let a=this.transformFilesToAttachments(s);a==null||a.length<=0||(a.forEach(l=>{this.dispatchEvent(new Gr(l))}),r(a))})}handleNativeDrop(e){if(this.editor==null||e==null)return!1;let{dataTransfer:r}=e;return r==null||r.files.length<=0||e.defaultPrevented?!1:(e.preventDefault(),this.handleFiles(r.files).then(i=>{this.editor?.chain().focus().setAttachmentAtCoords(i,{top:e.clientY,left:e.clientX}).run()}),!0)}transformFilesToAttachments(e){if(this.editor==null||e==null||e.length===0)return;let r=[];for(let i=0;i<e.length;i++){let o=e[i];if(o==null)return;let s=URL.createObjectURL(o),a=new Le({src:s,file:o},this.editor.view);r.push(a)}return r}renderToolbar(){return T``}renderDialog(){return T``}render(){return T`
${this.renderToolbar()}
<div class="editor-wrapper" part="editor-wrapper">
${this.renderDialog()}
<div class="editor" part="editor">
<slot name="editor">
<div class="trix-content"></div>
</slot>
</div>
</div>
`}allOptions(e){return{...this.__defaultOptions(e),...this.editorOptions(e)}}normalizeDOM(e,r=new DOMParser){if(e==null||e.value==null)return;let i=r.parseFromString(e.value,"text/html"),s=[...i.querySelectorAll("figure[data-trix-attachment]")].filter(l=>l.querySelector("figcaption")==null);i.querySelectorAll("div > figure:first-child").forEach(l=>{l.parentElement?.classList.add("attachment-gallery")}),s.forEach(l=>{let c=l.getAttribute("data-trix-attributes");if(!c)return;let{caption:d}=JSON.parse(c);if(d){l.insertAdjacentHTML("beforeend",`<figcaption class="attachment__caption">${d}</figcaption>`);return}}),i.querySelectorAll("figure :not(.attachment__caption--edited) .attachment__name").forEach(l=>{l.textContent?.includes(" \xB7 ")!==!1&&l.insertAdjacentText("beforeend"," \xB7 ")});let a=i.querySelector("body");a&&(e.value=a.innerHTML)}get __starterKitExtensions__(){return[ff.configure(this.starterKitOptions),mp.configure(this.starterKitOptions)]}__defaultOptions(e){let r=this.inputElement?.value||"";if(r)try{r=JSON.parse(r)}catch{}return{injectCSS:!1,extensions:this.__starterKitExtensions__.concat(this.extensions),autofocus:!1,element:e,content:r,editable:!this.readonly,editorProps:{handleDrop:this.handleDropFile}}}__bindEditorListeners(){this.editor!=null&&(this.editor.on("focus",this.__handleFocus),this.editor.on("create",this.__handleCreate),this.editor.on("update",this.__handleUpdate),this.editor.on("selectionUpdate",this.__handleSelectionUpdate),this.editor.on("transaction",this.__handleTransaction),this.editor.on("blur",this.__handleBlur))}__unBindEditorListeners(){this.editor!=null&&(this.editor.off("focus",this.__handleFocus),this.editor.off("create",this.__handleCreate),this.editor.off("update",this.__handleUpdate),this.editor.off("selectionUpdate",this.__handleSelectionUpdate),this.editor.off("transaction",this.__handleTransaction),this.editor.off("blur",this.__handleBlur))}__setupEditor(e=this){return(!this.serializer||this.serializer==="html")&&this.normalizeDOM(this.inputElement),new Xi(this.allOptions(e))}};bn.baseName="rhino-editor";function Ms(n){var t;return t=class extends n{static define(r,i,o){r||(r=this.baseName),i||(i=this);let s=window.customElements;this.__registry instanceof CustomElementRegistry&&(s=this.__registry);let a=!!s.get(r);a&&this.warnOnExistingElement&&console.warn(`${r} has already been registered.`),!a&&i&&s.define(r,class extends i{},o)}},Z(t,"baseName",""),Z(t,"warnOnExistingElement",!1),t}var vc=class extends Ms(HTMLElement){};var gp=new WeakMap;function ox(n,t){let e=t;for(;e;){if(gp.get(e)===n)return!0;e=Object.getPrototypeOf(e)}return!1}function Yr(n){return t=>{if(ox(n,t))return t;let e=n(t);return gp.set(e,n),e}}var Ts=!!ShadowRoot.prototype.createElement,sx=n=>{var t;return t=class extends n{static get scopedElements(){return{}}static get shadowRootOptions(){return this.__shadowRootOptions||{mode:"open"}}static set shadowRootOptions(r){this.__shadowRootOptions=r}constructor(...r){super(...r),this.renderOptions=this.renderOptions||void 0}get registry(){return this.constructor.__registry}set registry(r){let i=this.constructor;i.__registry=r}createRenderRoot(){let r=this.constructor,{scopedElements:i,shadowRootOptions:o}=r;if(!this.registry||this.registry===r.__registry&&!Object.prototype.hasOwnProperty.call(this.constructor,"__registry")){this.registry=Ts?new CustomElementRegistry:customElements;for(let[c,d]of Object.entries(i))this.defineScopedElement(c,d)}let a={mode:"open",...o,customElements:this.registry},l=this.attachShadow(a);return Ts&&(this.renderOptions.creationScope=l),l instanceof ShadowRoot&&this.adoptStyles(l),l}createScopedElement(r){return(Ts?this.shadowRoot:document).createElement(r)}adoptStyles(r){}defineScopedElement(r,i){let o=this.registry.get(r);return o&&Ts===!1&&o!==i&&console.error([`You are trying to re-register the "${r}" custom element with a different class via ScopedElementsMixin.`,"This is only possible with a CustomElementRegistry.","Your browser does not support this feature so you will need to load a polyfill for it.",'Load "@webcomponents/scoped-custom-element-registry" before you register ANY web component to the global customElements registry.','e.g. add "<script src="/node_modules/@webcomponents/scoped-custom-element-registry/scoped-custom-element-registry.min.js"><\/script>" as your first script tag.',"For more details you can visit https://open-wc.org/docs/development/scoped-elements/"].join(`
`)),o?this.registry.get(r):this.registry.define(r,i)}},Z(t,"__registry",window.customElements),t},ax=Yr(sx);var lx=n=>class extends n{static get shadowRootOptions(){return this.__shadowRootOptions||{mode:"open"}}static set shadowRootOptions(e){this.__shadowRootOptions=e}get shadowRootOptions(){return this.constructor.shadowRootOptions}createRenderRoot(){return this.shadowRoot??this.attachShadow(this.shadowRootOptions||{mode:"open"})}connectedCallback(){typeof super.connectedCallback=="function"&&super.connectedCallback(),this.renderRoot==null&&(this.renderRoot=this.createRenderRoot())}},cx=Yr(lx);function bp(){let n=window.crypto||window.msCrypto;return("10000000-1000-4000-8000"+-1e11).replace(/[018]/g,t=>(t^n.getRandomValues(new Uint8Array(1))[0]&15>>t/4).toString(16))}var xt=class xt{constructor(t){this.element=t,this.handleLangChange=()=>{},this.handleDirChange=()=>{},this.__handleLangChange=()=>this.handleLangChange(),this.__handleDirChange=()=>this.handleDirChange(),this.constructor.eventTarget.addEventListener("lang-change",this.__handleLangChange),this.constructor.eventTarget.addEventListener("dir-change",this.__handleDirChange)}start(){let t=this.constructor;t.observer.observe(document.documentElement,t.options);let e=this.element.getRootNode().host;return e&&t.observer.observe(e,t.options),this}stop(){return this.constructor.observer.disconnect(),this}};Z(xt,"options",{subtree:!0,attributes:!0,childList:!0,attributeFilter:["lang","dir"],attributeOldValue:!0}),Z(xt,"langTimeout",null),Z(xt,"dirTimeout",null),Z(xt,"eventTarget",new EventTarget),Z(xt,"observer",new MutationObserver(t=>{for(let e of t)e.type==="attributes"&&(e.attributeName==="lang"&&(xt.langTimeout&&clearTimeout(xt.langTimeout),xt.langTimeout=setTimeout(()=>{xt.eventTarget.dispatchEvent(new Event("lang-change"))},20)),e.attributeName==="dir"&&(xt.dirTimeout&&clearTimeout(xt.dirTimeout),xt.dirTimeout=setTimeout(()=>{xt.eventTarget.dispatchEvent(new Event("dir-change"))},20)))}));var Cs=xt;var kc=class{constructor(t){this.element=t,this.events=new WeakMap}get(t){let e=this.events.get(t);return e||(e=(...r)=>t.apply(this.element,r),this.events.set(t,e)),e}},Fe=class extends Ms(Xt){static get dependencies(){return{}}constructor(...t){super(...t),Object.entries(this.constructor.dependencies).forEach(([e,r])=>{customElements.get(e)||customElements.define(e,r)}),this.textDirection="ltr",this.eventHandler=new kc(this),this.languageObserver=new Cs(this).start(),this.languageObserver.handleLangChange=()=>{let e=this.textDirection;this.textDirection=this.getTextDirection(),this.requestUpdate("textDirection",e)},this.languageObserver.handleDirChange=()=>{let e=this.textDirection;this.textDirection=this.getTextDirection(),this.requestUpdate("textDirection",e)},this.__debounceMap__=null,this.internals||(this.internals=this.attachInternals())}getOrAssignId(t="",e=!1){let r=this.id;return(!r||e)&&(r=t+"-"+bp(),this.id=r),r}getTextDirection(){return this.matches(":dir(rtl)")?"rtl":"ltr"}disconnectedCallback(){super.disconnectedCallback(),this.__debounceMap__=null}debounce(t,e){this.__debounceMap__==null&&(this.__debounceMap__=new Map);let r=this.__debounceMap__.get(e.key);return r&&clearTimeout(r),r=setTimeout(()=>{t()},e.wait),this.__debounceMap__.set(e.key,r),r}setAria(t,e){this.internals[t]=e,this[t]=e}};var yp=G`
clip: rect(0 0 0 0);
clip-path: inset(50%);
height: 1px;
overflow: hidden;
position: absolute;
white-space: nowrap;
width: 1px;
`,tr=G`
:host {
--role-background-hover-color: #005a9c;
--role-border-focus-color: #005a9c;
display: block;
box-sizing: border-box;
}
*,
*:after,
*:before {
box-sizing: border-box;
}
[hidden] {
display: none !important;
}
[invisible] {
visibility: hidden !important;
}
[popover]:not(:popover-open):not(dialog[open]) {
display: none;
}
.visually-hidden:not(:focus-within):not(:active) {
${yp}
}
.always-visually-hidden {
${yp}
}
`;var er=class extends Fe{constructor(){super(),this._currentFocusIndex=0,this.orientation="horizontal",this._toolbarItems=[],this.orientation="horizontal",this.ignoreQuery="textarea, select, input, [contenteditable='true'], [data-toolbar-ignore]",this.addEventListener("click",this.eventHandler.get(this.handleClick)),this.addEventListener("keydown",this.eventHandler.get(this.handleKeyDown)),this.addEventListener("focus",this.eventHandler.get(this.handleClick))}willUpdate(t){t.has("_toolbarItems")&&this.updateToolbarItems(),t.has("orientation")&&(this.ariaOrientation=this.orientation),super.willUpdate(t)}static get baseName(){return"role-toolbar"}static get styles(){return[tr,G`
.base {
display: flex;
max-width: 100%;
padding: 0.4rem 0.6rem;
border-radius: 4px;
border: 2px solid transparent;
gap: 4px;
overflow: auto;
}
:host([orientation="vertical"]) .base {
flex-direction: column;
}
:host(:focus-within) .base {
border-color: var(--role-border-focus-color);
}
`]}get keydownHandlers(){return this._keydownHandlers?this._keydownHandlers:(this._keydownHandlers={arrowleft:this.focusPrevious,arrowup:this.focusPrevious,arrowright:this.focusNext,arrowdown:this.focusNext,home:this.focusFirst,end:this.focusLast},this._keydownHandlers)}render(){return T`
<div role="toolbar" class="base" part="base">
<slot @slotchange=${this.updateToolbarItems}></slot>
</div>
`}handleClick(t){let e=!1,r=t.composedPath().find(i=>{if(i?.matches?.(this.ignoreQuery)){e=!0;return}return(i?.getAttribute?.("data-role")||"").includes("toolbar-item")});e||(r?(this._toolbarItems.forEach((i,o)=>{if(i===r){this._currentFocusIndex=o;return}i.setAttribute("tabindex","-1")}),this.setTabIndex({focus:!1})):this.setTabIndex({focus:!0}))}handleKeyDown(t){let e=t.key?.toLowerCase();this.orientation==="vertical"&&(e==="arrowleft"||e==="arrowright")||this.orientation==="horizontal"&&(e==="arrowdown"||e==="arrowup")||t.composedPath().find(r=>r.matches?.(this.ignoreQuery))||Object.keys(this.keydownHandlers).includes(e)&&(t.preventDefault(),this.keydownHandlers[e].call(this,t))}focusNext(t){if(this.currentFocusElement?.setAttribute("tabindex","-1"),this._currentFocusIndex+=1,this._currentFocusIndex>=this._toolbarItems.length){this.focusFirst();return}this.setTabIndex()}focusPrevious(t){if(this.currentFocusElement?.setAttribute("tabindex","-1"),this._currentFocusIndex-=1,this._currentFocusIndex<0){this.focusLast();return}this.setTabIndex()}focusFirst(){this._currentFocusIndex=0,this.setTabIndex()}focusLast(){this._toolbarItems!=null&&(this._currentFocusIndex=this._toolbarItems.length-1,this.setTabIndex())}setTabIndex({focus:t=!0}={}){this.currentFocusElement?.setAttribute("tabindex","0"),t&&this.currentFocusElement?.focus?.()}get currentFocusElement(){if(this._toolbarItems!=null)return this._toolbarItems[this._currentFocusIndex]}updateToolbarItems(t){let e=t?.target||this.shadowRoot.querySelector("slot");if(e==null)return;let r=e.assignedElements({flatten:!0}).filter(i=>i instanceof HTMLElement&&i.dataset.role?.match(/toolbar-item/));this._toolbarItems=r,this._currentFocusIndex=this._toolbarItems.findIndex(i=>i.getAttribute("tabindex")==="0"),this._toolbarItems.forEach(i=>{this._toolbarItems[this._currentFocusIndex]!==i&&i.setAttribute("tabindex","-1")}),this._currentFocusIndex===-1&&(this._currentFocusIndex=0,this.currentFocusElement?.setAttribute("tabindex","0"))}};Z(er,"properties",{orientation:{reflect:!0},ariaOrientation:{reflect:!0},_currentFocusIndex:{state:!0},_toolbarItems:{state:!0}});var ce=Math.min,vt=Math.max,Qr=Math.round,Zr=Math.floor,Se=n=>({x:n,y:n}),dx={left:"right",right:"left",bottom:"top",top:"bottom"},ux={start:"end",end:"start"};function Os(n,t,e){return vt(n,ce(t,e))}function yn(n,t){return typeof n=="function"?n(t):n}function we(n){return n.split("-")[0]}function xn(n){return n.split("-")[1]}function Sc(n){return n==="x"?"y":"x"}function Ns(n){return n==="y"?"height":"width"}function Ve(n){return["top","bottom"].includes(we(n))?"y":"x"}function Ps(n){return Sc(Ve(n))}function xp(n,t,e){e===void 0&&(e=!1);let r=xn(n),i=Ps(n),o=Ns(i),s=i==="x"?r===(e?"end":"start")?"right":"left":r==="start"?"bottom":"top";return t.reference[o]>t.floating[o]&&(s=Xr(s)),[s,Xr(s)]}function vp(n){let t=Xr(n);return[_s(n),t,_s(t)]}function _s(n){return n.replace(/start|end/g,t=>ux[t])}function hx(n,t,e){let r=["left","right"],i=["right","left"],o=["top","bottom"],s=["bottom","top"];switch(n){case"top":case"bottom":return e?t?i:r:t?r:i;case"left":case"right":return t?o:s;default:return[]}}function kp(n,t,e,r){let i=xn(n),o=hx(we(n),e==="start",r);return i&&(o=o.map(s=>s+"-"+i),t&&(o=o.concat(o.map(_s)))),o}function Xr(n){return n.replace(/left|right|bottom|top/g,t=>dx[t])}function fx(n){return{top:0,right:0,bottom:0,left:0,...n}}function wc(n){return typeof n!="number"?fx(n):{top:n,right:n,bottom:n,left:n}}function vn(n){let{x:t,y:e,width:r,height:i}=n;return{width:r,height:i,top:e,left:t,right:t+r,bottom:e+i,x:t,y:e}}function Sp(n,t,e){let{reference:r,floating:i}=n,o=Ve(t),s=Ps(t),a=Ns(s),l=we(t),c=o==="y",d=r.x+r.width/2-i.width/2,u=r.y+r.height/2-i.height/2,h=r[a]/2-i[a]/2,f;switch(l){case"top":f={x:d,y:r.y-i.height};break;case"bottom":f={x:d,y:r.y+r.height};break;case"right":f={x:r.x+r.width,y:u};break;case"left":f={x:r.x-i.width,y:u};break;default:f={x:r.x,y:r.y}}switch(xn(t)){case"start":f[s]-=h*(e&&c?-1:1);break;case"end":f[s]+=h*(e&&c?-1:1);break}return f}var wp=async(n,t,e)=>{let{placement:r="bottom",strategy:i="absolute",middleware:o=[],platform:s}=e,a=o.filter(Boolean),l=await(s.isRTL==null?void 0:s.isRTL(t)),c=await s.getElementRects({reference:n,floating:t,strategy:i}),{x:d,y:u}=Sp(c,r,l),h=r,f={},p=0;for(let x=0;x<a.length;x++){let{name:S,fn:b}=a[x],{x:v,y:m,data:g,reset:k}=await b({x:d,y:u,initialPlacement:r,placement:h,strategy:i,middlewareData:f,rects:c,platform:s,elements:{reference:n,floating:t}});d=v??d,u=m??u,f={...f,[S]:{...f[S],...g}},k&&p<=50&&(p++,typeof k=="object"&&(k.placement&&(h=k.placement),k.rects&&(c=k.rects===!0?await s.getElementRects({reference:n,floating:t,strategy:i}):k.rects),{x:d,y:u}=Sp(c,h,l)),x=-1)}return{x:d,y:u,placement:h,strategy:i,middlewareData:f}};async function Rs(n,t){var e;t===void 0&&(t={});let{x:r,y:i,platform:o,rects:s,elements:a,strategy:l}=n,{boundary:c="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:h=!1,padding:f=0}=yn(t,n),p=wc(f),S=a[h?u==="floating"?"reference":"floating":u],b=vn(await o.getClippingRect({element:(e=await(o.isElement==null?void 0:o.isElement(S)))==null||e?S:S.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:c,rootBoundary:d,strategy:l})),v=u==="floating"?{x:r,y:i,width:s.floating.width,height:s.floating.height}:s.reference,m=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),g=await(o.isElement==null?void 0:o.isElement(m))?await(o.getScale==null?void 0:o.getScale(m))||{x:1,y:1}:{x:1,y:1},k=vn(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:v,offsetParent:m,strategy:l}):v);return{top:(b.top-k.top+p.top)/g.y,bottom:(k.bottom-b.bottom+p.bottom)/g.y,left:(b.left-k.left+p.left)/g.x,right:(k.right-b.right+p.right)/g.x}}var Ep=n=>({name:"arrow",options:n,async fn(t){let{x:e,y:r,placement:i,rects:o,platform:s,elements:a,middlewareData:l}=t,{element:c,padding:d=0}=yn(n,t)||{};if(c==null)return{};let u=wc(d),h={x:e,y:r},f=Ps(i),p=Ns(f),x=await s.getDimensions(c),S=f==="y",b=S?"top":"left",v=S?"bottom":"right",m=S?"clientHeight":"clientWidth",g=o.reference[p]+o.reference[f]-h[f]-o.floating[p],k=h[f]-o.reference[f],y=await(s.getOffsetParent==null?void 0:s.getOffsetParent(c)),O=y?y[m]:0;(!O||!await(s.isElement==null?void 0:s.isElement(y)))&&(O=a.floating[m]||o.floating[p]);let A=g/2-k/2,B=O/2-x[p]/2-1,K=ce(u[b],B),kt=ce(u[v],B),mt=K,St=O-x[p]-kt,X=O/2-x[p]/2+A,Rt=Os(mt,X,St),st=!l.arrow&&xn(i)!=null&&X!==Rt&&o.reference[p]/2-(X<mt?K:kt)-x[p]/2<0,Q=st?X<mt?X-mt:X-St:0;return{[f]:h[f]+Q,data:{[f]:Rt,centerOffset:X-Rt-Q,...st&&{alignmentOffset:Q}},reset:st}}});var Ap=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(t){var e,r;let{placement:i,middlewareData:o,rects:s,initialPlacement:a,platform:l,elements:c}=t,{mainAxis:d=!0,crossAxis:u=!0,fallbackPlacements:h,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:x=!0,...S}=yn(n,t);if((e=o.arrow)!=null&&e.alignmentOffset)return{};let b=we(i),v=Ve(a),m=we(a)===a,g=await(l.isRTL==null?void 0:l.isRTL(c.floating)),k=h||(m||!x?[Xr(a)]:vp(a)),y=p!=="none";!h&&y&&k.push(...kp(a,x,p,g));let O=[a,...k],A=await Rs(t,S),B=[],K=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&B.push(A[b]),u){let X=xp(i,s,g);B.push(A[X[0]],A[X[1]])}if(K=[...K,{placement:i,overflows:B}],!B.every(X=>X<=0)){var kt,mt;let X=(((kt=o.flip)==null?void 0:kt.index)||0)+1,Rt=O[X];if(Rt)return{data:{index:X,overflows:K},reset:{placement:Rt}};let st=(mt=K.filter(Q=>Q.overflows[0]<=0).sort((Q,dt)=>Q.overflows[1]-dt.overflows[1])[0])==null?void 0:mt.placement;if(!st)switch(f){case"bestFit":{var St;let Q=(St=K.filter(dt=>{if(y){let Vt=Ve(dt.placement);return Vt===v||Vt==="y"}return!0}).map(dt=>[dt.placement,dt.overflows.filter(Vt=>Vt>0).reduce((Vt,Fs)=>Vt+Fs,0)]).sort((dt,Vt)=>dt[1]-Vt[1])[0])==null?void 0:St[0];Q&&(st=Q);break}case"initialPlacement":st=a;break}if(i!==st)return{reset:{placement:st}}}return{}}}};async function px(n,t){let{placement:e,platform:r,elements:i}=n,o=await(r.isRTL==null?void 0:r.isRTL(i.floating)),s=we(e),a=xn(e),l=Ve(e)==="y",c=["left","top"].includes(s)?-1:1,d=o&&l?-1:1,u=yn(t,n),{mainAxis:h,crossAxis:f,alignmentAxis:p}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof p=="number"&&(f=a==="end"?p*-1:p),l?{x:f*d,y:h*c}:{x:h*c,y:f*d}}var Mp=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(t){var e,r;let{x:i,y:o,placement:s,middlewareData:a}=t,l=await px(t,n);return s===((e=a.offset)==null?void 0:e.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:i+l.x,y:o+l.y,data:{...l,placement:s}}}}},Tp=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(t){let{x:e,y:r,placement:i}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:a={fn:S=>{let{x:b,y:v}=S;return{x:b,y:v}}},...l}=yn(n,t),c={x:e,y:r},d=await Rs(t,l),u=Ve(we(i)),h=Sc(u),f=c[h],p=c[u];if(o){let S=h==="y"?"top":"left",b=h==="y"?"bottom":"right",v=f+d[S],m=f-d[b];f=Os(v,f,m)}if(s){let S=u==="y"?"top":"left",b=u==="y"?"bottom":"right",v=p+d[S],m=p-d[b];p=Os(v,p,m)}let x=a.fn({...t,[h]:f,[u]:p});return{...x,data:{x:x.x-e,y:x.y-r,enabled:{[h]:o,[u]:s}}}}}};var Cp=function(n){return n===void 0&&(n={}),{name:"size",options:n,async fn(t){var e,r;let{placement:i,rects:o,platform:s,elements:a}=t,{apply:l=()=>{},...c}=yn(n,t),d=await Rs(t,c),u=we(i),h=xn(i),f=Ve(i)==="y",{width:p,height:x}=o.floating,S,b;u==="top"||u==="bottom"?(S=u,b=h===(await(s.isRTL==null?void 0:s.isRTL(a.floating))?"start":"end")?"left":"right"):(b=u,S=h==="end"?"top":"bottom");let v=x-d.top-d.bottom,m=p-d.left-d.right,g=ce(x-d[S],v),k=ce(p-d[b],m),y=!t.middlewareData.shift,O=g,A=k;if((e=t.middlewareData.shift)!=null&&e.enabled.x&&(A=m),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(O=v),y&&!h){let K=vt(d.left,0),kt=vt(d.right,0),mt=vt(d.top,0),St=vt(d.bottom,0);f?A=p-2*(K!==0||kt!==0?K+kt:vt(d.left,d.right)):O=x-2*(mt!==0||St!==0?mt+St:vt(d.top,d.bottom))}await l({...t,availableWidth:A,availableHeight:O});let B=await s.getDimensions(a.floating);return p!==B.width||x!==B.height?{reset:{rects:!0}}:{}}}};function Ds(){return typeof window<"u"}function kn(n){return Op(n)?(n.nodeName||"").toLowerCase():"#document"}function Mt(n){var t;return(n==null||(t=n.ownerDocument)==null?void 0:t.defaultView)||window}function Gt(n){var t;return(t=(Op(n)?n.ownerDocument:n.document)||window.document)==null?void 0:t.documentElement}function Op(n){return Ds()?n instanceof Node||n instanceof Mt(n).Node:!1}function Ht(n){return Ds()?n instanceof Element||n instanceof Mt(n).Element:!1}function Yt(n){return Ds()?n instanceof HTMLElement||n instanceof Mt(n).HTMLElement:!1}function _p(n){return!Ds()||typeof ShadowRoot>"u"?!1:n instanceof ShadowRoot||n instanceof Mt(n).ShadowRoot}function rr(n){let{overflow:t,overflowX:e,overflowY:r,display:i}=Ft(n);return/auto|scroll|overlay|hidden|clip/.test(t+r+e)&&!["inline","contents"].includes(i)}function Np(n){return["table","td","th"].includes(kn(n))}function ti(n){return[":popover-open",":modal"].some(t=>{try{return n.matches(t)}catch{return!1}})}function $s(n){let t=Is(),e=Ht(n)?Ft(n):n;return e.transform!=="none"||e.perspective!=="none"||(e.containerType?e.containerType!=="normal":!1)||!t&&(e.backdropFilter?e.backdropFilter!=="none":!1)||!t&&(e.filter?e.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(e.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(e.contain||"").includes(r))}function Pp(n){let t=Ee(n);for(;Yt(t)&&!Sn(t);){if($s(t))return t;if(ti(t))return null;t=Ee(t)}return null}function Is(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Sn(n){return["html","body","#document"].includes(kn(n))}function Ft(n){return Mt(n).getComputedStyle(n)}function ei(n){return Ht(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function Ee(n){if(kn(n)==="html")return n;let t=n.assignedSlot||n.parentNode||_p(n)&&n.host||Gt(n);return _p(t)?t.host:t}function Rp(n){let t=Ee(n);return Sn(t)?n.ownerDocument?n.ownerDocument.body:n.body:Yt(t)&&rr(t)?t:Rp(t)}function nr(n,t,e){var r;t===void 0&&(t=[]),e===void 0&&(e=!0);let i=Rp(n),o=i===((r=n.ownerDocument)==null?void 0:r.body),s=Mt(i);if(o){let a=Ls(s);return t.concat(s,s.visualViewport||[],rr(i)?i:[],a&&e?nr(a):[])}return t.concat(i,nr(i,[],e))}function Ls(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Ip(n){let t=Ft(n),e=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=Yt(n),o=i?n.offsetWidth:e,s=i?n.offsetHeight:r,a=Qr(e)!==o||Qr(r)!==s;return a&&(e=o,r=s),{width:e,height:r,$:a}}function Mc(n){return Ht(n)?n:n.contextElement}function ir(n){let t=Mc(n);if(!Yt(t))return Se(1);let e=t.getBoundingClientRect(),{width:r,height:i,$:o}=Ip(t),s=(o?Qr(e.width):e.width)/r,a=(o?Qr(e.height):e.height)/i;return(!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var mx=Se(0);function Lp(n){let t=Mt(n);return!Is()||!t.visualViewport?mx:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gx(n,t,e){return t===void 0&&(t=!1),!e||t&&e!==Mt(n)?!1:t}function wn(n,t,e,r){t===void 0&&(t=!1),e===void 0&&(e=!1);let i=n.getBoundingClientRect(),o=Mc(n),s=Se(1);t&&(r?Ht(r)&&(s=ir(r)):s=ir(n));let a=gx(o,e,r)?Lp(o):Se(0),l=(i.left+a.x)/s.x,c=(i.top+a.y)/s.y,d=i.width/s.x,u=i.height/s.y;if(o){let h=Mt(o),f=r&&Ht(r)?Mt(r):r,p=h,x=Ls(p);for(;x&&r&&f!==p;){let S=ir(x),b=x.getBoundingClientRect(),v=Ft(x),m=b.left+(x.clientLeft+parseFloat(v.paddingLeft))*S.x,g=b.top+(x.clientTop+parseFloat(v.paddingTop))*S.y;l*=S.x,c*=S.y,d*=S.x,u*=S.y,l+=m,c+=g,p=Mt(x),x=Ls(p)}}return vn({width:d,height:u,x:l,y:c})}function bx(n){let{elements:t,rect:e,offsetParent:r,strategy:i}=n,o=i==="fixed",s=Gt(r),a=t?ti(t.floating):!1;if(r===s||a&&o)return e;let l={scrollLeft:0,scrollTop:0},c=Se(1),d=Se(0),u=Yt(r);if((u||!u&&!o)&&((kn(r)!=="body"||rr(s))&&(l=ei(r)),Yt(r))){let h=wn(r);c=ir(r),d.x=h.x+r.clientLeft,d.y=h.y+r.clientTop}return{width:e.width*c.x,height:e.height*c.y,x:e.x*c.x-l.scrollLeft*c.x+d.x,y:e.y*c.y-l.scrollTop*c.y+d.y}}function yx(n){return Array.from(n.getClientRects())}function Ac(n,t){let e=ei(n).scrollLeft;return t?t.left+e:wn(Gt(n)).left+e}function xx(n){let t=Gt(n),e=ei(n),r=n.ownerDocument.body,i=vt(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),o=vt(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),s=-e.scrollLeft+Ac(n),a=-e.scrollTop;return Ft(r).direction==="rtl"&&(s+=vt(t.clientWidth,r.clientWidth)-i),{width:i,height:o,x:s,y:a}}function vx(n,t){let e=Mt(n),r=Gt(n),i=e.visualViewport,o=r.clientWidth,s=r.clientHeight,a=0,l=0;if(i){o=i.width,s=i.height;let c=Is();(!c||c&&t==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:o,height:s,x:a,y:l}}function kx(n,t){let e=wn(n,!0,t==="fixed"),r=e.top+n.clientTop,i=e.left+n.clientLeft,o=Yt(n)?ir(n):Se(1),s=n.clientWidth*o.x,a=n.clientHeight*o.y,l=i*o.x,c=r*o.y;return{width:s,height:a,x:l,y:c}}function Dp(n,t,e){let r;if(t==="viewport")r=vx(n,e);else if(t==="document")r=xx(Gt(n));else if(Ht(t))r=kx(t,e);else{let i=Lp(n);r={...t,x:t.x-i.x,y:t.y-i.y}}return vn(r)}function Bp(n,t){let e=Ee(n);return e===t||!Ht(e)||Sn(e)?!1:Ft(e).position==="fixed"||Bp(e,t)}function Sx(n,t){let e=t.get(n);if(e)return e;let r=nr(n,[],!1).filter(a=>Ht(a)&&kn(a)!=="body"),i=null,o=Ft(n).position==="fixed",s=o?Ee(n):n;for(;Ht(s)&&!Sn(s);){let a=Ft(s),l=$s(s);!l&&a.position==="fixed"&&(i=null),(o?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||rr(s)&&!l&&Bp(n,s))?r=r.filter(d=>d!==s):i=a,s=Ee(s)}return t.set(n,r),r}function wx(n){let{element:t,boundary:e,rootBoundary:r,strategy:i}=n,s=[...e==="clippingAncestors"?ti(t)?[]:Sx(t,this._c):[].concat(e),r],a=s[0],l=s.reduce((c,d)=>{let u=Dp(t,d,i);return c.top=vt(u.top,c.top),c.right=ce(u.right,c.right),c.bottom=ce(u.bottom,c.bottom),c.left=vt(u.left,c.left),c},Dp(t,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Ex(n){let{width:t,height:e}=Ip(n);return{width:t,height:e}}function Ax(n,t,e){let r=Yt(t),i=Gt(t),o=e==="fixed",s=wn(n,!0,o,t),a={scrollLeft:0,scrollTop:0},l=Se(0);if(r||!r&&!o)if((kn(t)!=="body"||rr(i))&&(a=ei(t)),r){let f=wn(t,!0,o,t);l.x=f.x+t.clientLeft,l.y=f.y+t.clientTop}else i&&(l.x=Ac(i));let c=0,d=0;if(i&&!r&&!o){let f=i.getBoundingClientRect();d=f.top+a.scrollTop,c=f.left+a.scrollLeft-Ac(i,f)}let u=s.left+a.scrollLeft-l.x-c,h=s.top+a.scrollTop-l.y-d;return{x:u,y:h,width:s.width,height:s.height}}function Ec(n){return Ft(n).position==="static"}function $p(n,t){if(!Yt(n)||Ft(n).position==="fixed")return null;if(t)return t(n);let e=n.offsetParent;return Gt(n)===e&&(e=e.ownerDocument.body),e}function zp(n,t){let e=Mt(n);if(ti(n))return e;if(!Yt(n)){let i=Ee(n);for(;i&&!Sn(i);){if(Ht(i)&&!Ec(i))return i;i=Ee(i)}return e}let r=$p(n,t);for(;r&&Np(r)&&Ec(r);)r=$p(r,t);return r&&Sn(r)&&Ec(r)&&!$s(r)?e:r||Pp(n)||e}var Mx=async function(n){let t=this.getOffsetParent||zp,e=this.getDimensions,r=await e(n.floating);return{reference:Ax(n.reference,await t(n.floating),n.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Tx(n){return Ft(n).direction==="rtl"}var Cx={convertOffsetParentRelativeRectToViewportRelativeRect:bx,getDocumentElement:Gt,getClippingRect:wx,getOffsetParent:zp,getElementRects:Mx,getClientRects:yx,getDimensions:Ex,getScale:ir,isElement:Ht,isRTL:Tx};function _x(n,t){let e=null,r,i=Gt(n);function o(){var a;clearTimeout(r),(a=e)==null||a.disconnect(),e=null}function s(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();let{left:c,top:d,width:u,height:h}=n.getBoundingClientRect();if(a||t(),!u||!h)return;let f=Zr(d),p=Zr(i.clientWidth-(c+u)),x=Zr(i.clientHeight-(d+h)),S=Zr(c),v={rootMargin:-f+"px "+-p+"px "+-x+"px "+-S+"px",threshold:vt(0,ce(1,l))||1},m=!0;function g(k){let y=k[0].intersectionRatio;if(y!==l){if(!m)return s();y?s(!1,y):r=setTimeout(()=>{s(!1,1e-7)},1e3)}m=!1}try{e=new IntersectionObserver(g,{...v,root:i.ownerDocument})}catch{e=new IntersectionObserver(g,v)}e.observe(n)}return s(!0),o}function Hp(n,t,e,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:o=!0,elementResize:s=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,c=Mc(n),d=i||o?[...c?nr(c):[],...nr(t)]:[];d.forEach(b=>{i&&b.addEventListener("scroll",e,{passive:!0}),o&&b.addEventListener("resize",e)});let u=c&&a?_x(c,e):null,h=-1,f=null;s&&(f=new ResizeObserver(b=>{let[v]=b;v&&v.target===c&&f&&(f.unobserve(t),cancelAnimationFrame(h),h=requestAnimationFrame(()=>{var m;(m=f)==null||m.observe(t)})),e()}),c&&!l&&f.observe(c),f.observe(t));let p,x=l?wn(n):null;l&&S();function S(){let b=wn(n);x&&(b.x!==x.x||b.y!==x.y||b.width!==x.width||b.height!==x.height)&&e(),x=b,p=requestAnimationFrame(S)}return e(),()=>{var b;d.forEach(v=>{i&&v.removeEventListener("scroll",e),o&&v.removeEventListener("resize",e)}),u?.(),(b=f)==null||b.disconnect(),f=null,l&&cancelAnimationFrame(p)}}var Fp=Mp;var Vp=Tp,Up=Ap,Tc=Cp;var jp=Ep;var Kp=(n,t,e)=>{let r=new Map,i={platform:Cx,...e},o={...i.platform,_c:r};return wp(n,t,{...i,platform:o})};var Wp=Ge(class extends Me{constructor(n){if(super(n),n.type!==An.ATTRIBUTE||n.name!=="class"||n.strings?.length>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(n){return" "+Object.keys(n).filter(t=>n[t]).join(" ")+" "}update(n,[t]){if(this.st===void 0){this.st=new Set,n.strings!==void 0&&(this.nt=new Set(n.strings.join(" ").split(/\s/).filter(r=>r!=="")));for(let r in t)t[r]&&!this.nt?.has(r)&&this.st.add(r);return this.render(t)}let e=n.element.classList;for(let r of this.st)r in t||(e.remove(r),this.st.delete(r));for(let r in t){let i=!!t[r];i===this.st.has(r)||this.nt?.has(r)||(i?(e.add(r),this.st.add(r)):(e.remove(r),this.st.delete(r)))}return Ut}});function Cc(n){let t="";for(let[e,r]of Object.entries(n))r&&(t+=`${e} `);return t}var or=class extends Event{constructor(t,e){e==null&&(e={}),e.bubbles==null&&(e.bubbles=!0),e.composed==null&&(e.composed=!0),e.cancelable==null&&(e.cancelable=!1),super(t,e)}};var Bs=class extends or{constructor(t={}){super("role-reposition",t)}};function Ox(n){return n!==null&&typeof n=="object"&&"getBoundingClientRect"in n&&("contextElement"in n?n instanceof Element:!0)}function _c(n){return class extends n{constructor(...e){super(...e),this.anchor=this.anchor??null,this.placement=this.placement??"top",this.currentPlacement=this.placement??null,this.strategy=this.strategy??"fixed",this.distance=this.distance??0,this.skidding=this.skidding??0,this.arrow=this.arrow??!1,this.arrowPlacement=this.arrowPlacement??"anchor",this.arrowPadding=this.arrowPadding??10,this.flip=this.flip??!0,this.flipFallbackPlacements=this.flipFallbackPlacements??"",this.flipFallbackStrategy=this.flipFallbackStrategy??"best-fit",this.flipBoundary=this.flipBoundary??void 0,this.flipPadding=this.flipPadding??0,this.shift=this.shift??!0,this.shiftBoundary=this.shiftBoundary??void 0,this.shiftPadding=this.shiftPadding??0,this.autoSize=this.autoSize??null,this.sync=this.sync??null,this.autoSizeBoundary=this.autoSizeBoundary??void 0,this.autoSizePadding=this.autoSizePadding??0,this.hoverBridge=this.hoverBridge??!0,this.active=this.active??!1,this.anchoredPopoverType=this.anchoredPopoverType??"auto"}}}var Oc=()=>({active:{type:Boolean,reflect:!0},anchor:{attribute:!1,state:!0},placement:{reflect:!0},currentPlacement:{attribute:"current-placement",reflect:!0},strategy:{reflect:!0},distance:{type:Number},skidding:{type:Number},arrow:{type:Boolean},arrowPlacement:{attribute:"arrow-placement"},arrowPadding:{attribute:"arrow-padding",type:Number},flip:{type:Boolean},flipFallbackPlacements:{attribute:"flip-fallback-placements",converter:{fromAttribute:n=>n.split(" ").map(t=>t.trim()).filter(t=>t!==""),toAttribute:n=>n.join(" ")}},flipFallbackStrategy:{attribute:"flip-fallback-strategy"},flipBoundary:{attribute:!1,type:Object},flipPadding:{attribute:"flip-padding",type:Number},shift:{type:Boolean},shiftBoundary:{attribute:!1,type:Object},shiftPadding:{attribute:"shift-padding",type:Number},autoSize:{attribute:"auto-size"},sync:{},autoSizeBoundary:{type:Object},autoSizePadding:{attribute:"auto-size-padding",type:Number},hoverBridge:{attribute:"hover-bridge",type:Boolean},anchoredPopoverType:{attribute:"anchored-popover-type",reflect:!0}}),de=class extends _c(Fe){constructor(){super();Z(this,"updateHoverBridge",()=>{if(this.hoverBridge&&this.__anchorEl&&this.popoverElement){let e=this.__anchorEl.getBoundingClientRect(),r=this.popoverElement.getBoundingClientRect(),i=(this.currentPlacement?.includes("top")||this.currentPlacement?.includes("bottom"))??!0,o=0,s=0,a=0,l=0,c=0,d=0,u=0,h=0;i?e.top<r.top?(o=e.left,s=e.bottom,a=e.right,l=e.bottom,c=r.left,d=r.top,u=r.right,h=r.top):(o=r.left,s=r.bottom,a=r.right,l=r.bottom,c=e.left,d=e.top,u=e.right,h=e.top):this.currentPlacement?.includes("left")?(o=r.right,s=r.top,a=e.right,l=e.top,c=r.right,d=r.bottom,u=e.right,h=e.bottom):(o=e.left,s=e.top,a=r.left,l=r.top,c=e.left,d=e.bottom,u=r.left,h=r.bottom),this.style.setProperty("--hover-bridge-top-left-x",`${o}px`),this.style.setProperty("--hover-bridge-top-left-y",`${s}px`),this.style.setProperty("--hover-bridge-top-right-x",`${a}px`),this.style.setProperty("--hover-bridge-top-right-y",`${l}px`),this.style.setProperty("--hover-bridge-bottom-left-x",`${c}px`),this.style.setProperty("--hover-bridge-bottom-left-y",`${d}px`),this.style.setProperty("--hover-bridge-bottom-right-x",`${u}px`),this.style.setProperty("--hover-bridge-bottom-right-y",`${h}px`)}});window.process==null&&(window.process={}),window.process.env==null&&(window.process.env="development"),this.anchor=null,this.active=!1,this.__anchorEl=null,this.__cleanup}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.__start()}disconnectedCallback(){super.disconnectedCallback(),this.__stop()}willUpdate(e){super.willUpdate(e),e.has("active")&&(this.active?this.__start():this.__stop()),e.has("anchor")&&this.__handleAnchorChange()}async updated(e){super.updated(e),this.active&&(await this.updateComplete,this.reposition())}get popoverElement(){return this.shadowRoot?.querySelector('[part~="popover"]')||null}get arrowElement(){return this.shadowRoot?.querySelector('[part~="arrow"]')||null}async __handleAnchorChange(){if(await this.__stop(),this.anchor&&typeof this.anchor=="string"){let e=this.getRootNode();this.__anchorEl=e.getElementById(this.anchor)}else this.anchor instanceof Element||Ox(this.anchor)?this.__anchorEl=this.anchor:this.__anchorEl=this.querySelector('[slot="anchor"]');this.__anchorEl instanceof HTMLSlotElement&&(this.__anchorEl=this.__anchorEl.assignedElements({flatten:!0})[0]),this.__anchorEl&&this.__start()}__start(){this.__anchorEl&&this.popoverElement&&(this.__togglePopover__(),this.cleanup=Hp(this.__anchorEl,this.popoverElement,()=>{this.reposition()}))}async __stop(){return new Promise(e=>{this.cleanup?(this.cleanup(),this.cleanup=void 0,this.currentPlacement=null,this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height"),requestAnimationFrame(()=>{e(),this.__togglePopover__()})):(this.__togglePopover__(),e())})}__togglePopover__(){let e=this.shadowRoot?.querySelector("[popover]")||null;if(e)if(this.active)try{e.showPopover()}catch{}else try{e.hidePopover()}catch{}}reposition(){let e=this.popoverElement;if(!this.active||!this.__anchorEl||!e)return;let r=[Fp({mainAxis:this.distance,crossAxis:this.skidding})];this.sync?r.push(Tc({apply:({rects:i})=>{let o=this.sync==="width"||this.sync==="both",s=this.sync==="height"||this.sync==="both";e.style.width=o?`${i.reference.width}px`:"",e.style.height=s?`${i.reference.height}px`:""}})):(e.style.width="",e.style.height=""),this.flip&&r.push(Up({boundary:this.flipBoundary,fallbackPlacements:this.flipFallbackPlacements,fallbackStrategy:this.flipFallbackStrategy==="best-fit"?"bestFit":"initialPlacement",padding:this.flipPadding})),this.shift&&r.push(Vp({boundary:this.shiftBoundary,padding:this.shiftPadding})),this.autoSize?r.push(Tc({boundary:this.autoSizeBoundary,padding:this.autoSizePadding,apply:({availableWidth:i,availableHeight:o})=>{this.autoSize==="vertical"||this.autoSize==="both"?this.style.setProperty("--auto-size-available-height",`${o}px`):this.style.removeProperty("--auto-size-available-height"),this.autoSize==="horizontal"||this.autoSize==="both"?this.style.setProperty("--auto-size-available-width",`${i}px`):this.style.removeProperty("--auto-size-available-width")}})):(this.style.removeProperty("--auto-size-available-width"),this.style.removeProperty("--auto-size-available-height")),this.arrow&&this.arrowElement&&r.push(jp({element:this.arrowElement,padding:this.arrowPadding})),Kp(this.__anchorEl,e,{placement:this.placement,middleware:r,strategy:this.strategy}).then(({x:i,y:o,middlewareData:s,placement:a})=>{let l=getComputedStyle(this).direction==="rtl";this.currentPlacement=a;let c={top:"bottom",right:"left",bottom:"top",left:"right"}[a.split("-")[0]]||this.placement;if(Object.assign(e.style,{left:`${i}px`,top:`${o}px`}),this.arrow&&s.arrow){let d=s.arrow.x,u=s.arrow.y,h="",f="",p="",x="";if(this.arrowPlacement==="start"){let S=typeof d=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";h=typeof u=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"",f=l?S:"",x=l?"":S}else if(this.arrowPlacement==="end"){let S=typeof d=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:"";f=l?"":S,x=l?S:"",p=typeof u=="number"?`calc(${this.arrowPadding}px - var(--arrow-padding-offset))`:""}else this.arrowPlacement==="center"?(x=typeof d=="number"?"calc(50% - var(--arrow-size-diagonal))":"",h=typeof u=="number"?"calc(50% - var(--arrow-size-diagonal))":""):(x=typeof d=="number"?`${d}px`:"",h=typeof u=="number"?`${u}px`:"");this.arrowElement&&Object.assign(this.arrowElement.style,{top:h,right:f,bottom:p,left:x,[c]:"calc(var(--arrow-size-diagonal) * -1)"})}}),requestAnimationFrame(()=>this.updateHoverBridge()),this.dispatchEvent(new Bs)}render(){return T`
<slot name="anchor" @slotchange=${this.__handleAnchorChange}></slot>
<div
part="popover-base"
popover=${Gn(this.anchoredPopoverType==="none"?null:this.anchoredPopoverType)}
>
<span
part=${Cc({"hover-bridge":!0,"hover-bridge--visible":this.hoverBridge&&this.active})}
></span>
<div
part=${Cc({popover:!0,"popover--active":this.active,"popover--fixed":this.strategy==="fixed","popover--has-arrow":this.arrow})}
class=${Wp({"visually-hidden":!this.active})}
>
<slot></slot>
${this.arrow?T`<div part="arrow" role="presentation"></div>`:""}
</div>
</div>
`}};Z(de,"baseName","role-anchored-region"),Z(de,"styles",[tr,G`
:host {
--__background: var(--background, #222);
--__border-color: var(--border-color, #222);
--__border-width: var(--border-width, 1px);
--__arrow-size: var(--arrow-size, 8px);
/*
* These properties are computed to account for the arrow's dimensions after being rotated 45º. The constant
* 0.7071 is derived from sin(45), which is the diagonal size of the arrow's container after rotating.
*/
--arrow-size-diagonal: calc(var(--__arrow-size) * 0.7071);
--arrow-padding-offset: calc(var(--arrow-size-diagonal) - var(--__arrow-size));
display: contents;
}
[part~="popover"] {
position: absolute;
isolation: isolate;
max-width: var(--auto-size-available-width, none);
max-height: var(--auto-size-available-height, none);
border: var(--__border-width) solid var(--__border-color);
background: var(--__background);
}
[popover] {
position: fixed;
border: none;
background: none;
inset: unset;
color: inherit;
margin: 0;
padding: 0;
}
[part~="popover--fixed"] {
position: fixed;
}
[part~="arrow"] {
position: absolute;
width: calc(var(--arrow-size-diagonal) * 2);
height: calc(var(--arrow-size-diagonal) * 2);
background: var(--__background);
/* background: tomato; */
z-index: -1;
margin: 0;
transform-style: preserve-3d;
border: var(--__border-width) solid var(--__border-color);
border-top-color: transparent;
border-right-color: transparent;
}
/* Hover bridge */
[part~="hover-bridge"]:not([part~="hover-bridge--visible"]) {
display: none;
}
[part~="hover-bridge"] {
/* background: tomato; */
position: fixed;
z-index: calc(var(--z-index-dropdown, 900) - 1);
top: 0;
right: 0;
bottom: 0;
left: 0;
clip-path: polygon(
var(--hover-bridge-top-left-x, 0) var(--hover-bridge-top-left-y, 0),
var(--hover-bridge-top-right-x, 0) var(--hover-bridge-top-right-y, 0),
var(--hover-bridge-bottom-right-x, 0) var(--hover-bridge-bottom-right-y, 0),
var(--hover-bridge-bottom-left-x, 0) var(--hover-bridge-bottom-left-y, 0)
);
}
:host([current-placement="top"]) [part~="arrow"] {
transform: rotate(315deg);
}
:host([current-placement="bottom"]) [part~="arrow"] {
transform: rotate(135deg);
}
:host([current-placement="left"]) [part~="arrow"] {
transform: rotate(225deg);
}
:host([current-placement="right"]) [part~="arrow"] {
transform: rotate(45deg);
}
`]),Z(de,"properties",{...Oc()});var zs=class extends or{constructor(t){super("role-tooltip-toggle",t),this.triggerElement=t.triggerElement,this.triggerEvent=t.triggerEvent}};function Nx(n){let t=n.composedPath().find(e=>e.getAttribute?.("data-role-tooltip"));return t||null}function Px(n){let t=n.getRootNode(),e=n.getAttribute("data-role-tooltip");if(!e)return null;let r=t.querySelector(`#${e}`);return r||null}function Rx(n){let t=Nx(n);if(!t)return;let e=Px(t);if(!e)return;let r=new zs({triggerElement:t,triggerEvent:n});e.dispatchEvent(r)}var sr=class extends _c(Fe){static get properties(){return{...Oc(),role:{reflect:!0},__triggerSource:{attribute:!1,state:!0}}}static get baseName(){return"role-tooltip"}static get styles(){return[tr,G`
@media screen and (prefers-color-scheme: dark) {
:host {
--border-color: CanvasText;
}
}
@media screen and not (prefers-color-scheme: dark) {
:host {
--border-color: transparent;
}
}
:host {
--background: #222;
--border-color: #222;
--border-width: 2px;
--arrow-size: 8px;
color: white;
margin: 0;
border: none;
background: transparent;
display: inline-block;
}
:host([active]) [part~="anchored-region"]::part(popover) {
opacity: 1;
transform: scale(1.0);
}
:host([active][trigger-source="hover"]) [part~="anchored-region"]::part(popover) {
transition:
opacity var(--transition-speed, 200ms) var(--transition-timing, ease-in-out) var(--transition-delay, 100ms),
transform var(--transition-speed, 200ms) var(--transition-timing, ease-in-out) var(--transition-delay, 100ms);
}
[part~="anchored-region"]::part(popover) {
opacity: 0;
transform: scale(0.8);
padding: 0.2em 0.4em;
border-radius: 4px;
}
`]}constructor(){super(),this.role="tooltip",this.active=!1,this.anchor=null,this.arrow=!0,this.distance=10,this.__triggerSource=null,this.__eventAbortController=new AbortController,this.addEventListener("role-tooltip-toggle",this.eventHandler.get(this.handlePopoverTriggerEvent)),this.addEventListener("role-reposition",this.eventHandler.get(this.handleReposition)),document.addEventListener("click",Rx),this.__activeElements=[]}handlePopoverTriggerEvent(t){this.active?this.hide("click"):this.show(t.triggerElement,"click")}handleReposition(){let t=this.anchoredRegion;!t||!t.popoverElement||(this.currentPlacement=this.anchoredRegion.currentPlacement)}get anchoredRegion(){return this.shadowRoot?.querySelector("[part~='anchored-region']")||null}connectedCallback(){super.connectedCallback();let{signal:t}=this.__eventAbortController,e=this.getRootNode();document.addEventListener("focusout",this.eventHandler.get(this.handleHide),{signal:t}),e.addEventListener("pointerover",this.eventHandler.get(this.handleShow),{passive:!0,signal:t}),e.addEventListener("focusin",this.eventHandler.get(this.handleFocusChange),{passive:!0,signal:t}),e.addEventListener("focusout",this.eventHandler.get(this.handleFocusChange),{passive:!0,signal:t}),document.addEventListener("focusin",this.eventHandler.get(this.handleFocusChange),{passive:!0,signal:t}),document.addEventListener("focusout",this.eventHandler.get(this.handleFocusChange),{passive:!0,signal:t}),document.addEventListener("keydown",this.eventHandler.get(this.handleKeyDown),{passive:!0,signal:t})}disconnectedCallback(){super.disconnectedCallback(),this.__eventAbortController?.abort()}handleKeyDown(t){if(t.key==="Escape"){this.hide("focus");return}t.key==="Tab"&&this.handleFocusChange()}handleFocusChange(){this.__activeElements=[];let t=i=>{this.__activeElements.push(i);let o=i?.shadowRoot?.activeElement;o&&t(o)},e=document.activeElement;if(!e){this.hide("focus");return}t(e);let r=this.__activeElements.find(i=>i.getAttribute?.("data-role-tooltip")===this.id);if(r){this.anchor=r,this.active=!0,this.__triggerSource="focus";return}this.hide("focus")}render(){return T`
<role-anchored-region
part="anchored-region"
exportparts="
popover,
popover--active,
popover--fixed,
popover--has-arrow,
arrow,
hover-bridge,
hover-bridge--visible
"
.anchor=${this.anchor}
?active=${this.active}
.anchoredPopoverType=${this.anchoredPopoverType}
.placement=${this.placement}
.strategy=${this.strategy}
.distance=${this.distance}
.skidding=${this.skidding}
.arrow=${this.arrow}
.arrowPlacement=${this.arrowPlacement}
.arrowPadding=${this.arrowPadding}
.flip=${this.flip}
.flipFallbackPlacements=${this.flipFallbackPlacements}
.flipFallbackStrategy=${this.flipFallbackStrategy}
.flipBoundary=${this.flipBoundary}
.flipPadding=${this.flipPadding}
.shift=${this.shift}
.shiftBoundary=${this.shiftBoundary}
.shiftPadding=${this.shiftPadding}
.autoSize=${this.autoSize}
.sync=${this.sync}
.autoSizeBoundary=${this.autoSizeBoundary}
.autoSizePadding=${this.autoSizePadding}
.hoverBridge=${this.hoverBridge}
class="${this.active?"":"visually-hidden"}"
>
<slot></slot>
</role-anchored-region>
`}handleShow(t){let e=t.type.startsWith("pointer")?"hover":"focus",r=this.findTriggerForTooltip(t);r&&this.show(r,e)}show(t,e=null){e||(e=null),this.__triggerSource!=="focus"&&(this.__triggerSource=e),this.anchor=t,this.active=!0}findTriggerForTooltip(t){let e=t.target;if(!e)return null;let r=e.closest("[data-role-tooltip]");if(!r)return null;let i=r.getAttribute?.("data-role-tooltip");return!i||i!==this.id?null:r}willUpdate(t){if(t.has("active")){let e=this.getRootNode(),{signal:r}=this.__eventAbortController;if(this.active){if(e.addEventListener("pointermove",this.eventHandler.get(this.handleHide),{signal:r}),document.addEventListener("pointermove",this.eventHandler.get(this.handleHide),{signal:r}),this.anchor instanceof Element){let i=this.anchor?.getAttribute("aria-describedby")||"";i||this.anchor?.setAttribute("aria-describedby",this.id),i.split(/\s+/).includes(this.id)||this.anchor?.setAttribute("aria-describedby",i+" "+this.id)}}else e.removeEventListener("pointermove",this.eventHandler.get(this.handleHide)),document.removeEventListener("pointermove",this.eventHandler.get(this.handleHide))}super.willUpdate(t)}handleHide(t){let e=t.composedPath();if(e.includes(this)||this.anchor instanceof HTMLElement&&e.includes(this.anchor))return;let r=t.type.startsWith("pointer")?"hover":"focus";this.hide(r)}hide(t){t||(t=null),!(this.active&&this.__triggerSource==="focus"&&t==="hover")&&(this.__triggerSource=null,this.active=!1)}};Z(sr,"dependencies",{"role-anchored-region":de});function ct(n){let t="";for(let[e,r]of Object.entries(n))r&&(t+=`${e} `);return t}function Nc(n,t,e={}){let{from:r,to:i,empty:o}=n.selection,s=t?et(t,n.schema):null,a=[];n.doc.nodesBetween(r,i,(u,h)=>{if(u.isText)return;let f=Math.max(r,h),p=Math.min(i,h+u.nodeSize);a.push({node:u,from:f,to:p})});let l=i-r,c=a.slice(-3).filter(u=>s?s.name===u.node.type.name:!0).filter(u=>Kn(u.node.attrs,e,{strict:!1}));return o?!!c.length:c.reduce((u,h)=>u+h.to-h.from,0)>=l}function Dx(n){if(!n)return null;let t=n.state,{selection:e}=t,r=n.view;if(r.composing)return null;let{ranges:i}=e,o=Math.min(...i.map(l=>l.$from.pos)),s=Math.max(...i.map(l=>l.$to.pos)),a=null;if(Wn(t.selection)){let l=xc?.({editor:n,view:r,from:o})||r.nodeDOM(o);l&&(l.scrollIntoView({block:"nearest"}),a=()=>l.getBoundingClientRect())}else{let l=r.domAtPos(s).node;l instanceof HTMLElement&&l.scrollIntoView({block:"nearest"}),a=()=>{let c=io(r,o,s);return c.x=c.x-c.width/2,c}}return a}var Hs=class extends bn{constructor(){super();this.altTextEditor=!1;this.defaultHeadingLevel=1;this.translations=mf;this.linkInputRef=Gc();this.linkDialogExpanded=!1;this.__invalidLink__=!1;this.handleKeyboardDialogToggle=e=>{let{key:r,metaKey:i,ctrlKey:o}=e;if(r==null)return;if(r=r.toLowerCase(),r==="escape"&&this.linkDialogExpanded){this.closeLinkDialog();return}r==="k"&&(mo?i:o)&&this.showLinkDialog()};this.__handleLinkDialogClick=e=>{if(e.defaultPrevented)return;let r=this.shadowRoot?.querySelector(".link-dialog__container");if(!r){this.linkDialogExpanded=!1;return}let i=e.composedPath(),o=this.shadowRoot?.querySelector("[name='link-button']");i.includes(r)||o&&i.includes(o)||(this.linkDialogExpanded=!1)};this.starterKitOptions=Object.assign(this.starterKitOptions,{rhinoPlaceholder:{placeholder:this.translations.placeholder},rhinoAttachment:{fileUploadErrorMessage:this.translations.fileUploadErrorMessage,captionPlaceholder:this.translations.captionPlaceholder}}),this.addEventListener("keydown",this.handleKeyboardDialogToggle)}static get styles(){return bn.styles.concat([nd])}static get properties(){return Object.assign(bn.properties,{linkDialogExpanded:{type:Boolean,reflect:!0,attribute:"link-dialog-expanded"},altTextEditor:{type:Boolean,reflect:!0,attribute:"alt-text-editor"},defaultHeadingLevel:{attribute:"default-heading-level",type:Number},linkInputRef:{state:!0},translations:{state:!0},__invalidLink__:{state:!0,type:Boolean}})}registerDependencies(){super.registerDependencies(),[er,sr,de].forEach(e=>e.define())}updated(e){if(e.has("altTextEditor")&&this.starterKitOptions.rhinoAttachment!==!1&&(this.starterKitOptions={...this.starterKitOptions,rhinoAttachment:{...this.starterKitOptions.rhinoAttachment,altTextEditor:this.altTextEditor}}),!this.hasInitialized)return super.updated(e);if(e.has("translations")){let{rhinoAttachment:r,rhinoPlaceholder:i}=this.starterKitOptions;i&&(i.placeholder=this.translations.placeholder),r&&(r.captionPlaceholder=this.translations.captionPlaceholder,r.fileUploadErrorMessage=this.translations.fileUploadErrorMessage)}return super.updated(e)}async connectedCallback(){super.connectedCallback(),await this.updateComplete,this.starterKitOptions=Object.assign(this.starterKitOptions,{rhinoBubbleMenu:{...this.starterKitOptions.rhinoBubbleMenu,element:this.shadowRoot?.querySelector("role-anchored-region")}}),document.addEventListener("click",this.__handleLinkDialogClick)}async startEditor(){await super.startEditor(),this.editor&&this.editor.on("focus",this.closeLinkDialog)}disconnectedCallback(){super.disconnectedCallback(),document.removeEventListener("click",this.__handleLinkDialogClick)}get icons(){return Bl}toggleLinkDialog(){if(this.linkDialogExpanded){this.closeLinkDialog();return}this.showLinkDialog()}closeLinkDialog(){this.linkDialogExpanded=!1,this.editor?.commands.focus()}showLinkDialog(){let e=this.linkInputRef.value;e!=null&&(e.value=this.editor?.getAttributes("link").href||"",e.setSelectionRange(0,e.value.length)),this.__invalidLink__=!1,this.linkDialogExpanded=!0,setTimeout(()=>{requestAnimationFrame(()=>{e?.focus()})})}get linkDialog(){return this.shadowRoot?.querySelector("#link-dialog")}attachFiles(){let e=this.fileInputEl;e?.click()}addLink(){let e=this.linkInputRef.value;if(e==null)return;let r=e.value;try{new URL(r),e.setCustomValidity(""),this.__invalidLink__=!1}catch{e.setCustomValidity("Not a valid URL"),this.__invalidLink__=!0,e.reportValidity();return}if(this.editor&&r){if(this.closeLinkDialog(),e.value="",this.editor.state.selection.empty&&!this.editor.getAttributes("link").href){let i=this.editor.state.selection.anchor;this.editor.commands.insertContent(r);let o=this.editor.state.selection.anchor;this.editor.commands.setTextSelection({from:i,to:o})}this.editor?.chain().extendMarkRange("link").setLink({href:r}).run()}}get fileInputEl(){return this.shadowRoot?.getElementById("file-input")}async handleFileUpload(){let e=this.fileInputEl;if(e==null||e.files==null)return;let r=await this.handleFiles(e.files);r.length>0&&this.editor?.chain().focus().setAttachment(r).run(),e.value=""}get __tooltipExportParts(){return"base:toolbar__tooltip__base, arrow:toolbar__tooltip__arrow"}renderBoldButton(e=""){if(!(this.starterKitOptions.bold!==!1||!!this.editor?.commands.toggleBold))return T``;let i=this.editor==null||!this.editor.can().toggleBold(),o=!!this.editor?.isActive("bold"),s="bold-tooltip",a="bold",l="toolbar__tooltip toolbar__tooltip--bold",c="bold-icon";return e&&(s=e+"__"+s,c=e+"__"+c,a=e+"__"+a),T`
<slot name=${s}>
<role-tooltip
id=${a}
part=${l}
exportparts=${this.__tooltipExportParts}
>
${this.translations.bold}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
type="button"
part=${ct({toolbar__button:!0,"toolbar__button--bold":!0,"toolbar__button--active":o,"toolbar__button--disabled":i})}
aria-disabled=${i}
aria-pressed=${o}
data-role="toolbar-item"
data-role-tooltip=${a}
@click=${async d=>{Tt(d.currentTarget)||this.editor?.chain().focus().toggleBold().run()}}
>
<slot name=${c}>${this.icons.bold}</slot>
</button>
`}renderItalicButton(e=""){if(!(this.starterKitOptions.italic!==!1||!!this.editor?.commands.toggleItalic))return T``;let i=!!this.editor?.isActive("italic"),o=this.editor==null||!this.editor.can().toggleItalic(),s="italics-tooltip",a="italics",l="toolbar__tooltip toolbar__tooltip--italics",c="italics-icon";return e&&(s=e+"__"+s,c=e+"__"+c,a=e+"__"+a),T`
<slot name=${s}>
<role-tooltip
id=${a}
part=${l}
exportparts=${this.__tooltipExportParts}
>
${this.translations.italics}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
tabindex="-1"
type="button"
part=${ct({toolbar__button:!0,"toolbar__button--italic":!0,"toolbar__button--active":i,"toolbar__button--disabled":o})}
aria-disabled=${o}
aria-pressed=${i}
data-role="toolbar-item"
data-role-tooltip=${a}
@click=${d=>{Tt(d.currentTarget)||this.editor?.chain().focus().toggleItalic().run()}}
>
<slot name=${c}> ${this.icons.italics} </slot>
</button>
`}renderStrikeButton(e=""){if(!(this.starterKitOptions.rhinoStrike!==!1||!!this.editor?.commands.toggleStrike))return T``;let i=!!this.editor?.isActive("rhino-strike"),o=this.editor==null||!this.editor.can().toggleStrike(),s="strike-tooltip",a="strike",l="toolbar__tooltip toolbar__tooltip--strike",c="strike-icon";return e&&(s=e+"__"+s,c=e+"__"+c,a=e+"__"+a),T`
<slot name=${s}>
<role-tooltip
id=${a}
part=${l}
exportparts=${this.__tooltipExportParts}
>
${this.translations.strike}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
type="button"
tabindex="-1"
part=${ct({toolbar__button:!0,"toolbar__button--strike":!0,"toolbar__button--active":i,"toolbar__button--disabled":o})}
aria-disabled=${o}
aria-pressed=${i}
data-role-tooltip=${a}
data-role="toolbar-item"
@click=${d=>{Tt(d.currentTarget)||this.editor?.chain().focus().toggleStrike().run()}}
>
<slot name=${c}>${this.icons.strike}</slot>
</button>
`}renderLinkButton(e=""){if(!(this.starterKitOptions.rhinoLink!==!1||!!this.editor?.commands.setLink))return T``;let i=!!(this.editor?.isActive("link")||this.linkDialogExpanded),o=this.editor==null||!this.editor.can().setLink({href:""}),s="link-tooltip",a="link",l="toolbar__tooltip toolbar__tooltip--link",c="link-icon";return e&&(s=e+"__"+s,c=e+"__"+c,a=e+"__"+a),T`
<slot name=${s}>
<role-tooltip
id=${a}
part=${l}
exportparts=${this.__tooltipExportParts}
>
${this.translations.link}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
type="button"
tabindex="-1"
part=${ct({toolbar__button:!0,"toolbar__button--link":!0,"toolbar__button--active":i,"toolbar__button--disabled":o})}
aria-disabled=${o}
aria-pressed=${i}
aria-controls="link-dialog"
data-role="toolbar-item"
data-role-tooltip=${a}
@click=${d=>{this.editor!=null&&(Tt(d.currentTarget)||(d.preventDefault(),this.toggleLinkDialog()))}}
>
<slot name=${c}>${this.icons.link}</slot>
</button>
`}renderHeadingButton(e=""){if(!(this.starterKitOptions.heading!==!1||!!this.editor?.commands.toggleHeading))return T``;let i=this.defaultHeadingLevel||1,o=!!this.editor?.isActive("heading"),s=this.editor==null||!this.editor.can().toggleHeading({level:i}),a="heading-tooltip",l="heading",c="toolbar__tooltip toolbar__tooltip--heading",d="heading-icon";return e&&(d=e+"__"+d,a=e+"__"+a,l=e+"__"+l),T`
<slot name=${a}>
<role-tooltip
id=${l}
part=${c}
exportparts=${this.__tooltipExportParts}
>
${this.translations.heading}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
type="button"
tabindex="-1"
part=${ct({toolbar__button:!0,"toolbar__button--heading":!0,"toolbar__button--active":o,"toolbar__button--disabled":s})}
aria-disabled=${s}
aria-pressed=${o}
data-role="toolbar-item"
data-role-tooltip=${l}
@click=${u=>{Tt(u.currentTarget)||this.editor?.chain().focus().toggleHeading({level:i}).run()}}
>
<slot name=${d}>${this.icons.heading}</slot>
</button>
`}renderBlockquoteButton(e=""){if(!(this.starterKitOptions.blockquote!==!1||!!this.editor?.commands.toggleBlockquote))return T``;let i=!!this.editor?.isActive("blockquote"),o=this.editor==null||!this.editor.can().toggleBlockquote(),s="blockquote-tooltip",a="blockquote",l="toolbar__tooltip toolbar__tooltip--blockquote",c="blockquote-icon";return e&&(c=e+"__"+c,s=e+"__"+s,a=e+"__"+a),T`
<slot name=${s}>
<role-tooltip
id=${a}
part=${l}
exportparts=${this.__tooltipExportParts}
>
${this.translations.blockQuote}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
type="button"
tabindex="-1"
part=${ct({toolbar__button:!0,"toolbar__button--blockquote":!0,"toolbar__button--active":i,"toolbar__button--disabled":o})}
aria-disabled=${o}
aria-pressed=${i}
data-role-tooltip=${a}
data-role="toolbar-item"
@click=${d=>{Tt(d.currentTarget)||this.editor?.chain().focus().toggleBlockquote().run()}}
>
<slot name=${c}>${this.icons.blockQuote}</slot>
</button>
`}renderCodeButton(e=""){if(!(this.starterKitOptions.code!==!1||!!this.editor?.commands.toggleCode))return T``;let i=!!this.editor?.isActive("code"),o=this.editor==null||!this.editor.can().toggleCode(),s="code-tooltip",a="code",l="toolbar__tooltip toolbar__tooltip--code",c="code-icon";return e&&(c=e+"__"+c,s=e+"__"+s,a=e+"__"+a),T`
<slot name=${s}>
<role-tooltip
id=${a}
part=${l}
exportparts=${this.__tooltipExportParts}
>
${this.translations.code}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
type="button"
tabindex="-1"
part=${ct({toolbar__button:!0,"toolbar__button--code":!0,"toolbar__button--active":i,"toolbar__button--disabled":o})}
aria-disabled=${o}
aria-pressed=${i}
data-role-tooltip=${a}
data-role="toolbar-item"
@click=${d=>{Tt(d.currentTarget)||this.editor?.chain().focus().toggleCode().run()}}
>
<slot name=${c}>${this.icons.code}</slot>
</button>
`}renderCodeBlockButton(e=""){if(!(this.starterKitOptions.codeBlock!==!1||!!this.editor?.commands.toggleCodeBlock))return T``;let i=!!this.editor?.isActive("codeBlock"),o=this.editor==null||!this.editor.can().toggleCodeBlock(),s="code-block-tooltip",a="code-block",l="toolbar__tooltip toolbar__tooltip--code-block",c="code-block-icon";return e&&(c=e+"__"+c,s=e+"__"+s,a=e+"__"+a),T`
<slot name=${s}>
<role-tooltip
id=${a}
part=${l}
exportparts=${this.__tooltipExportParts}
>
${this.translations.codeBlock}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
type="button"
tabindex="-1"
part=${ct({toolbar__button:!0,"toolbar__button--code-block":!0,"toolbar__button--active":i,"toolbar__button--disabled":o})}
aria-disabled=${o}
aria-pressed=${i}
data-role-tooltip=${a}
data-role="toolbar-item"
@click=${d=>{Tt(d.currentTarget)||this.editor?.chain().focus().toggleCodeBlock().run()}}
>
<slot name=${c}>${this.icons.codeBlock}</slot>
</button>
`}renderBulletListButton(e=""){if(!(this.starterKitOptions.bulletList!==!1||!!this.editor?.commands.toggleBulletList))return T``;let i=this.editor==null||!(this.editor.can().toggleOrderedList?.()||this.editor.can().toggleBulletList()),o=!!(this.editor!=null&&Nc(this.editor.state,"bulletList")),s="bullet-list-tooltip",a="bullet-list",l="toolbar__tooltip toolbar__tooltip--bullet-list",c="bullet-list-icon";return e&&(c=e+"__"+c,s=e+"__"+s,a=e+"__"+a),T`
<slot name=${s}>
<role-tooltip
id=${a}
part=${l}
exportparts=${this.__tooltipExportParts}
>
${this.translations.bulletList}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
type="button"
tabindex="-1"
part=${ct({toolbar__button:!0,"toolbar__button--bullet-list":!0,"toolbar__button--active":o,"toolbar__button--disabled":i})}
aria-disabled=${i}
aria-pressed=${o}
data-role-tooltip=${a}
data-role="toolbar-item"
@click=${d=>{Tt(d.currentTarget)||this.editor?.chain().focus().toggleBulletList().run()}}
>
<slot name=${c}>${this.icons.bulletList}</slot>
</button>
`}renderOrderedListButton(e=""){if(!(this.starterKitOptions.orderedList!==!1||!!this.editor?.commands.toggleOrderedList))return T``;let i=this.editor==null||!(this.editor.can().toggleOrderedList()||this.editor.can().toggleBulletList?.()),o=!!(this.editor!=null&&Nc(this.editor.state,"orderedList")),s="ordered-list-tooltip",a="ordered-list",l="toolbar__tooltip toolbar__tooltip--ordered-list",c="ordered-list-icon";return e&&(c=e+"__"+c,s=e+"__"+s,a=e+"__"+a),T`
<slot name=${s}>
<role-tooltip
id=${a}
part=${l}
exportparts=${this.__tooltipExportParts}
>
${this.translations.orderedList}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
type="button"
tabindex="-1"
part=${ct({toolbar__button:!0,"toolbar__button--ordered-list":!0,"toolbar__button--active":o,"toolbar__button--disabled":i})}
aria-disabled=${i}
aria-pressed=${o}
data-role-tooltip=${a}
data-role="toolbar-item"
@click=${d=>{Tt(d.currentTarget)||this.editor?.chain().focus().toggleOrderedList().run()}}
>
<slot name=${c}>${this.icons.orderedList}</slot>
</button>
`}renderAttachmentButton(e=""){if(!(this.starterKitOptions.rhinoAttachment!==!1||!!this.editor?.commands.setAttachment))return T``;let i=this.editor==null,o="attach-files-tooltip",s="attach-files",a="toolbar__tooltip toolbar__tooltip--attach-files",l="attach-files-icon",c="file-input";return e&&(l=e+"__"+l,o=e+"__"+o,s=e+"__"+s,c=e+"__"+c),T`
<slot name=${o}>
<role-tooltip
id=${s}
part=${a}
exportparts=${this.__tooltipExportParts}
>
${this.translations.attachFiles}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
tabindex="-1"
type="button"
part=${ct({toolbar__button:!0,"toolbar__button--attach-files":!0,"toolbar__button--disabled":i})}
aria-disabled=${i}
data-role-tooltip=${s}
data-role="toolbar-item"
@click=${this.attachFiles}
>
<slot name=${l}>${this.icons.attachFiles}</slot>
<!-- @TODO: Write documentation. Hookup onchange to the slotted elements? -->
<slot name="attach-files-input">
<input
id=${c}
type="file"
hidden
multiple
accept=${this.accept||"*"}
@change=${this.handleFileUpload}
/>
</slot>
</button>
`}renderUndoButton(e=""){if(!(this.starterKitOptions.history!==!1||!!this.editor?.commands.undo))return T``;let i=this.editor==null||!this.editor.can().undo(),o="undo-tooltip",s="undo",a="toolbar__tooltip toolbar__tooltip--undo",l="undo-icon";return e&&(l=e+"__"+l,o=e+"__"+o,s=e+"__"+s),T`
<slot name=${o}>
<role-tooltip
id=${s}
part=${a}
exportparts=${this.__tooltipExportParts}
>
${this.translations.undo}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
type="button"
tabindex="-1"
part=${ct({toolbar__button:!0,"toolbar__button--undo":!0,"toolbar__button--disabled":i})}
aria-disabled=${i}
data-role-tooltip=${s}
data-role="toolbar-item"
@click=${c=>{Tt(c.currentTarget)||this.editor?.chain().focus().undo().run()}}
>
<slot name=${l}>${this.icons.undo}</slot>
</button>
`}renderDecreaseIndentation(e=""){if(!(this.starterKitOptions.decreaseIndentation!==!1))return T``;let i=this.editor==null||!this.editor.can().liftListItem("listItem"),o="decrease-indentation-tooltip",s="decrease-indentation",a="toolbar__tooltip toolbar__tooltip--decrease-indentation",l="decrease-indentation-icon";return e&&(l=e+"__"+l,o=e+"__"+o,s=e+"__"+s),T`
<slot name=${o}>
<role-tooltip
id=${s}
part=${a}
exportparts=${this.__tooltipExportParts}
>
${this.translations.decreaseIndentation}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
type="button"
tabindex="-1"
part=${ct({toolbar__button:!0,"toolbar__button--decrease-indentation":!0,"toolbar__button--disabled":i})}
aria-disabled=${i}
data-role-tooltip=${s}
data-role="toolbar-item"
@click=${c=>{Tt(c.currentTarget)||this.editor?.chain().focus().liftListItem("listItem").run()}}
>
<slot name=${l}> ${this.icons.decreaseIndentation} </slot>
</button>
`}renderIncreaseIndentation(e=""){if(!(this.starterKitOptions.increaseIndentation!==!1))return T``;let i=this.editor==null||!this.editor.can().sinkListItem("listItem"),o="increase-indentation-tooltip",s="increase-indentation",a="toolbar__tooltip toolbar__tooltip--increase-indentation",l="increase-indentation-icon";return e&&(l=e+"__"+l,o=e+"__"+o,s=e+"__"+s),T`
<slot name=${o}>
<role-tooltip
id=${s}
part=${a}
exportparts=${this.__tooltipExportParts}
>
${this.translations.increaseIndentation}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
type="button"
tabindex="-1"
part=${ct({toolbar__button:!0,"toolbar__button--increase-indentation":!0,"toolbar__button--disabled":i})}
aria-disabled=${i}
data-role-tooltip=${s}
data-role="toolbar-item"
@click=${c=>{Tt(c.currentTarget)||this.editor?.chain().focus().sinkListItem("listItem").run()}}
>
<slot name=${l}> ${this.icons.increaseIndentation} </slot>
</button>
`}renderRedoButton(e=""){if(!(this.starterKitOptions.history!==!1||!!this.editor?.commands.redo))return T``;let i=this.editor==null||!this.editor.can().redo?.(),o="redo-indentation-tooltip",s="redo-indentation",a="toolbar__tooltip toolbar__tooltip--redo-indentation",l="redo-indentation-icon";return e&&(l=e+"__"+l,o=e+"__"+o,s=e+"__"+s),T`
<slot name=${o}>
<role-tooltip
id=${s}
part=${a}
exportparts=${this.__tooltipExportParts}
>
${this.translations.redo}
</role-tooltip>
</slot>
<button
class="toolbar__button rhino-toolbar-button"
tabindex="-1"
type="button"
part=${ct({toolbar__button:!0,"toolbar__button--redo":!0,"toolbar__button--disabled":i})}
aria-disabled=${i}
data-role-tooltip=${s}
data-role="toolbar-item"
@click=${c=>{Tt(c.currentTarget)||this.editor?.chain().focus().redo().run()}}
>
<slot name=${l}>${this.icons.redo}</slot>
</button>
`}renderToolbarStart(){return T``}renderToolbarEnd(){return T``}renderToolbar(){return this.readonly?T``:T`
<slot name="toolbar">
<role-toolbar
part="toolbar main__toolbar"
role="toolbar"
exportparts="
base:toolbar__base,
base:main__toolbar__base
"
>
<slot name="toolbar-start">${this.renderToolbarStart()}</slot>
<!-- Bold -->
<slot name="before-bold-button"></slot>
<slot name="bold-button">${this.renderBoldButton()}</slot>
<slot name="after-bold-button"></slot>
<!-- Italic -->
<slot name="before-italic-button"></slot>
<slot name="italic-button">${this.renderItalicButton()}</slot>
<slot name="after-italic-button"></slot>
<!-- Strike -->
<slot name="before-strike-button"></slot>
<slot name="strike-button">${this.renderStrikeButton()}</slot>
<slot name="after-strike-button"></slot>
<!-- Code -->
<slot name="before-code-button"></slot>
<slot name="code-button">${this.renderCodeButton()}</slot>
<slot name="after-code-button"></slot>
<!-- Link -->
<slot name="before-link-button"></slot>
<slot name="link-button">${this.renderLinkButton()}</slot>
<slot name="after-link-button"></slot>
<!-- Heading -->
<slot name="before-heading-button"></slot>
<slot name="heading-button">${this.renderHeadingButton()}</slot>
<slot name="after-heading-button"></slot>
<!-- Blockquote -->
<slot name="before-blockquote-button"></slot>
<slot name="blockquote-button">${this.renderBlockquoteButton()}</slot>
<slot name="after-blockquote-button"></slot>
<!-- Code block -->
<slot name="before-code-block-button"></slot>
<slot name="code-block-button">${this.renderCodeBlockButton()}</slot>
<slot name="after-code-block-button"></slot>
<!-- Bullet List -->
<slot name="before-bullet-list-button"></slot>
<slot name="bullet-list-button"
>${this.renderBulletListButton()}</slot
>
<slot name="after-bullet-list-button"></slot>
<!-- Ordered list -->
<slot name="before-ordered-list-button"></slot>
<slot name="ordered-list-button">
${this.renderOrderedListButton()}
</slot>
<slot name="after-ordered-list-button"></slot>
<slot name="before-decrease-indentation-button"></slot>
<slot name="decrease-indentation-button"
>${this.renderDecreaseIndentation()}</slot
>
<slot name="after-decrease-indentation-button"></slot>
<slot name="before-increase-indentation-button"></slot>
<slot name="increase-indentation-button"
>${this.renderIncreaseIndentation()}</slot
>
<slot name="after-increase-indentation-button"></slot>
<!-- Attachments -->
<slot name="before-attach-files-button"></slot>
<slot name="attach-files-button"
>${this.renderAttachmentButton()}</slot
>
<slot name="after-attach-files-button"></slot>
<!-- Undo -->
<slot name="before-undo-button"></slot>
<!-- @ts-expect-error -->
<slot name="undo-button"> ${this.renderUndoButton()} </slot>
<slot name="after-undo-button"></slot>
<!-- Redo -->
<slot name="before-redo-button"></slot>
<slot name="redo-button"> ${this.renderRedoButton()} </slot>
<slot name="after-redo-button"></slot>
<slot name="toolbar-end">${this.renderToolbarEnd()}</slot>
</role-toolbar>
</slot>
${this.renderBubbleMenuToolbar()} ${this.renderLinkDialogAnchoredRegion()}
`}renderLinkDialogAnchoredRegion(){let e=this.linkDialogExpanded?Dx(this.editor):null;return T`
<role-anchored-region
part="link-bubble-menu__anchored-region"
exportparts="
popover-base:link-bubble-menu__popover-base,
hover-bridge:link-bubble-menu__hover-bridge,
hover-bridge--visible:link-bubble-menu__hover-bridge--visible,
popover:link-bubble-menu__popover
popover--active:link-bubble-menu__popover--active,
popover--fixed:link-bubble-menu__popover--fixed,
popover--has-arrow:link-bubble-menu__popover--has-arrow
arrow:link-bubble-menu__arrow
"
anchored-popover-type="manual"
distance="4"
.active=${this.linkDialogExpanded}
.shiftBoundary=${this.querySelector(".ProseMirror")||this}
.flipBoundary=${this.querySelector(".ProseMirror")||this}
.anchor=${typeof e=="function"?{getBoundingClientRect:e}:null}
>
<slot name="link-bubble-menu-dialog"> ${this.renderLinkDialog()} </slot>
</role-anchored-region>
`}renderLinkDialog(){return this.readonly?T``:T` <div
id="link-dialog"
part=${ct({"link-dialog":!0,"link-dialog--expanded":this.linkDialogExpanded})}
>
<div class="link-dialog__container" part="link-dialog__container">
<input
id="link-dialog__input"
class=${`link-dialog__input ${this.__invalidLink__?"link-validate":""}`}
part=${`link-dialog__input ${this.__invalidLink__?"link-dialog__input--invalid":""}`}
type="text"
placeholder="Enter a URL..."
aria-label="Enter a URL"
required
type="url"
${Yc(this.linkInputRef)}
@input=${()=>{let e=this.linkInputRef.value;e!=null&&(e.setCustomValidity(""),this.__invalidLink__=!1)}}
@blur=${()=>{this.linkInputRef.value!=null&&(this.__invalidLink__=!1)}}
@keydown=${e=>{e.key?.toLowerCase()==="enter"&&(e.preventDefault(),this.addLink())}}
/>
<div class="link-dialog__buttons" part="link-dialog__buttons">
<button
class="rhino-toolbar-button link-dialog__button"
part="link-dialog__button link-dialog__button--link"
@click=${this.addLink}
>
${this.translations.linkDialogLink}
</button>
<button
class="rhino-toolbar-button link-dialog__button"
part="link-dialog__button link-dialog__button--unlink"
@click=${()=>{this.linkDialogExpanded=!1,this.editor?.chain().focus().extendMarkRange("link").unsetLink().run()}}
>
${this.translations.linkDialogUnlink}
</button>
</div>
</div>
</div>`}get defaultBubbleMenuToolbar(){return this.shadowRoot?.querySelector("[part~='bubble-menu__toolbar']")}renderBubbleMenuToolbar(){return T`
<role-anchored-region
part="bubble-menu__anchored-region"
exportparts="
popover-base:bubble-menu__popover-base,
hover-bridge:bubble-menu__hover-bridge,
hover-bridge--visible:bubble-menu__hover-bridge--visible,
popover:bubble-menu__popover
popover--active:bubble-menu__popover--active,
popover--fixed:bubble-menu__popover--fixed,
popover--has-arrow:bubble-menu__popover--has-arrow
arrow:bubble-menu__arrow
"
@rhino-bubble-menu-show=${e=>{if(e.defaultPrevented)return;let r=e.currentTarget;r.anchor={getBoundingClientRect:e.clientRect},r.shiftBoundary=this.querySelector(".ProseMirror")||this,r.flipBoundary=this.querySelector(".ProseMirror")||this,r.active=!0}}
@rhino-bubble-menu-hide=${e=>{if(e.defaultPrevented)return;let r=e.currentTarget;r.anchor=null,r.active=!1}}
anchored-popover-type="manual"
distance="4"
>
<slot name="bubble-menu-toolbar">
<role-toolbar
part="toolbar bubble-menu__toolbar"
role="toolbar"
exportparts="
base:toolbar__base,
base:bubble-menu__toolbar__base
"
>
<slot name="after-bubble-menu-toolbar-items"></slot>
<slot name="bubble-menu-toolbar-items">
${this.renderBoldButton("bubble-menu")}
${this.renderItalicButton("bubble-menu")}
${this.renderStrikeButton("bubble-menu")}
${this.renderCodeButton("bubble-menu")}
${this.renderLinkButton("bubble-menu")}
</slot>
<slot name="after-bubble-menu-toolbar-items"></slot>
</role-toolbar>
</slot>
<slot name="additional-bubble-menu-toolbar"></slot>
</role-anchored-region>
`}};function Tt(n){return n==null||!("getAttribute"in n)?!0:n.getAttribute("aria-disabled")==="true"||n.hasAttribute("disabled")}Hs.define();export{Le as AttachmentManager,Hs as TipTapEditor};
/*! Bundled license information:
lit-html/lit-html.js:
(**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/directive-helpers.js:
(**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/directive.js:
(**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/async-directive.js:
(**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/directives/ref.js:
(**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
@lit/reactive-element/css-tag.js:
(**
* @license
* Copyright 2019 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
@lit/reactive-element/reactive-element.js:
(**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-element/lit-element.js:
(**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/is-server.js:
(**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/directives/when.js:
(**
* @license
* Copyright 2021 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/directives/unsafe-html.js:
(**
* @license
* Copyright 2017 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/directives/if-defined.js:
(**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
lit-html/directives/class-map.js:
(**
* @license
* Copyright 2018 Google LLC
* SPDX-License-Identifier: BSD-3-Clause
*)
*/
//# sourceMappingURL=index.module.js.map